text stringlengths 2 1.04M | meta dict |
|---|---|
package fr.univnantes.termsuite.ui.services.impl;
import static java.util.stream.Collectors.toList;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.inject.Inject;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.services.events.IEventBroker;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
import com.google.common.base.Preconditions;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import com.google.common.collect.Lists;
import fr.univnantes.termsuite.api.TermSuiteException;
import fr.univnantes.termsuite.ui.TermSuiteEvents;
import fr.univnantes.termsuite.ui.TermSuiteUI;
import fr.univnantes.termsuite.ui.TermSuiteUIPreferences;
import fr.univnantes.termsuite.ui.model.termsuiteui.ECorporaList;
import fr.univnantes.termsuite.ui.model.termsuiteui.ECorpus;
import fr.univnantes.termsuite.ui.model.termsuiteui.EOccurrenceMode;
import fr.univnantes.termsuite.ui.model.termsuiteui.EPipeline;
import fr.univnantes.termsuite.ui.model.termsuiteui.EPipelineList;
import fr.univnantes.termsuite.ui.model.termsuiteui.EResource;
import fr.univnantes.termsuite.ui.model.termsuiteui.ESingleLanguageCorpus;
import fr.univnantes.termsuite.ui.model.termsuiteui.ETagger;
import fr.univnantes.termsuite.ui.model.termsuiteui.ETaggerConfig;
import fr.univnantes.termsuite.ui.model.termsuiteui.ETerminology;
import fr.univnantes.termsuite.ui.model.termsuiteui.TermsuiteuiFactory;
import fr.univnantes.termsuite.ui.services.ResourceService;
import fr.univnantes.termsuite.ui.services.TaggerService;
import fr.univnantes.termsuite.ui.util.WorkspaceUtil;
public class ResourceServiceImpl implements ResourceService {
@Inject
private IEventBroker eventBroker;
@Inject
private IEclipseContext context;
private ECorporaList corpora = TermsuiteuiFactory.eINSTANCE.createECorporaList();
private EPipelineList pipelines = TermsuiteuiFactory.eINSTANCE.createEPipelineList();
private BiMap<String, EResource> resources = HashBiMap.create();
public ResourceServiceImpl() {
// Register the XMI resource factory for the .pipeline extension
List<EPipeline> list = WorkspaceUtil.loadResources(PIPELINE_DIR, PIPELINE_EXTENSION, EPipeline.class);
pipelines.getPipelines().addAll(list);
Map<String, Object> m = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap();
// Register the XMI resource factory for the .pipeline extension
m.put(CORPUS_EXTENSION, new XMIResourceFactoryImpl());
List<ECorpus> list2 = WorkspaceUtil.loadResources(CORPUS_DIR, CORPUS_EXTENSION, ECorpus.class);
corpora.getCorpora().addAll(list2);
}
@Override
public String getResourceId(EResource termsuiteUIObject) {
String id = resources.inverse().get(termsuiteUIObject);
if(id == null) {
// id = UUID.randomUUID().toString();
id = EcoreUtil.getURI(termsuiteUIObject).toString();
resources.put(id, termsuiteUIObject);
}
return id;
}
@Override
public EResource getResource(String resourceId) {
return resources.get(resourceId);
}
@Override
public String toModelTag(ETerminology targetTerminology) {
return MODEL_TAG_PREFIX + getResourceId(targetTerminology);
}
@Override
public Path getOutputDirectory() {
IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(TermSuiteUI.PLUGIN_ID);
String path = preferences.get(
TermSuiteUIPreferences.OUTPUT_DIRECTORY,
WorkspaceUtil.getWorkspacePath( TermSuiteUIPreferences.OUTPUT_DIRECTORY_DEFAULT).toString());
Path path2 = Paths.get(path);
path2.toFile().mkdirs();
return path2;
}
@Override
public EResource fromModelTag(List<String> modelTags) {
for(String modelTag:modelTags) {
if(modelTag.startsWith(MODEL_TAG_PREFIX)) {
String resourceId = modelTag.replaceFirst(MODEL_TAG_PREFIX, "");
return getResource(resourceId);
}
}
return null;
}
private static final Class<?>[] RENAMEABLE_RESOURCES = new Class<?>[]{
EPipeline.class,
ETerminology.class
};
@Override
public boolean isRenameable(Class<? extends EObject> cls) {
for(Class<?> editableResource:RENAMEABLE_RESOURCES)
if(editableResource.isAssignableFrom(cls))
return true;
return false;
}
@Override
public String getResourceName(EObject resource) {
Optional<EAttribute> att = getNameEAttribute(resource.eClass());
if(att.isPresent())
return resource.eGet(att.get()) == null ? null :resource.eGet(att.get()).toString();
else
return null;
}
@Override
public String canRename(EObject resource, String newName) {
if(!isRenameable(resource.getClass()) || getResourceName(resource) == null)
return "Renaming object of type " + resource.getClass().getSimpleName() + " is not allowed";
else if(getResourceName(resource).equals(newName))
return "New name must be different from current name";
else if(asFilePath(resource).resolve(newName).toFile().exists())
return "File or directory " + asFilePath(resource).resolve(newName).toAbsolutePath() + " already exists";
else {
if(resource instanceof ECorpus) {
List<String> corpusNames = getCorporaList().getCorpora().stream().map(ECorpus::getName).collect(toList());
if(corpusNames.contains(newName))
return "A corpus named " + newName + " already exists";
} else if(resource instanceof EPipeline) {
List<String> pipelineNames = getPipelineList().getPipelines().stream().map(EPipeline::getName).collect(toList());
if(pipelineNames.contains(newName))
return "A pipeline named " + newName + " already exists";
} else if(resource instanceof ETerminology) {
List<String> terminologyNames = ((ETerminology)resource).getCorpus().getTerminologies().stream().map(ETerminology::getName).collect(toList());
if(terminologyNames.contains(newName))
return "A terminology named " + newName + " already exists";
}
}
return null;
}
@Override
public Path asFilePath(EObject object) {
if(object instanceof ECorpus)
return getWorkspacePath((ECorpus)object);
else if(object instanceof ESingleLanguageCorpus)
return getWorkspacePath((ESingleLanguageCorpus)object);
if(object instanceof ETerminology)
return getWorkspacePath((ETerminology)object);
if(object instanceof EPipeline)
return getPath((EPipeline)object);
else throw new IllegalArgumentException("A resource of type "+object.getClass().getSimpleName()+" cannot have a filepath.");
}
@Override
public void rename(EObject object, String newName) {
Preconditions.checkArgument(isRenameable(object.getClass()), "Not allwed to rename a resource of class %s", object.getClass().getName());
try {
if(object instanceof ETerminology) {
// terminology belongs to the corpus. The corpus must be saved instead of the terminology.
ETerminology termino = (ETerminology)object;
Path oldPath = getWorkspacePath(termino);
termino.setName(newName);
Path newPath = getWorkspacePath(termino);
saveCorpus(termino.getCorpus().getCorpus());
Files.move(oldPath, newPath);
} else if(object instanceof EResource) {
/*
* An EResource has a file within workspace.
*
* This piece of code cannot be applied on a corpus for example.
*
*/
Path oldPath = asFilePath(object);
Optional<EAttribute> a = getNameEAttribute(object.eClass());
if(a.isPresent())
object.eSet(a.get(), newName);
else
throw new IllegalArgumentException("Found no attribute \"name\" for class: " + object.eClass().getName());
Path newPath = asFilePath(object);
Files.move(oldPath, newPath);
save((EResource)object);
}
} catch (IOException e) {
throw new TermSuiteException("Cloud not rename the resource file: " + e.getMessage(), e);
}
eventBroker.post(TermSuiteEvents.OBJECT_RENAMED, object);
}
@Override
public void save(EResource resource) {
WorkspaceUtil.saveResource(resource, asFilePath(resource));
}
private Optional<EAttribute> getNameEAttribute(EClass eClass) {
return eClass.getEAllAttributes().stream().filter(a -> a.getName().equals("name")).findFirst();
}
/* (non-Javadoc)
* @see fr.univnantes.termsuite.ui.services.PipelineService#savePipeline(fr.univnantes.termsuite.ui.model.termsuiteui.EPipeline)
*/
@Override
public void savePipeline(EPipeline pipeline) throws IOException {
WorkspaceUtil.saveResource(pipeline, PIPELINE_DIR, pipeline.getName(), PIPELINE_EXTENSION);
}
/* (non-Javadoc)
* @see fr.univnantes.termsuite.ui.services.PipelineService#getPipelineList()
*/
@Override
public EPipelineList getPipelineList() {
return pipelines;
}
/* (non-Javadoc)
* @see fr.univnantes.termsuite.ui.services.PipelineService#createPipeline(java.lang.String)
*/
@Override
public EPipeline createPipeline(String name) throws IOException {
EPipeline p = TermsuiteuiFactory.eINSTANCE.createEPipeline();
p.setName(name);
TaggerService taggerService = this.context.get(TaggerService.class);
if(taggerService.getTaggerConfigs().size() > 0) {
ETaggerConfig treeTagger = null;
for(ETaggerConfig config:taggerService.getTaggerConfigs())
if(config.getTaggerType() == ETagger.TREE_TAGGER)
treeTagger = config;
ETaggerConfig selectedConfig = treeTagger != null ? treeTagger : taggerService.getTaggerConfigs().iterator().next();
p.setTaggerConfigName(selectedConfig.getName());
}
pipelines.getPipelines().add(p);
savePipeline(p);
return p;
}
/* (non-Javadoc)
* @see fr.univnantes.termsuite.ui.services.PipelineService#canCreatePipeline(java.lang.String)
*/
@Override
public boolean canCreatePipeline(String string) {
for(EPipeline p:pipelines.getPipelines()) {
if(p.getName().equals(string))
return false;
}
return true;
}
@Override
public void remove(EPipeline s) {
pipelines.getPipelines().remove(s);
WorkspaceUtil.removeResource(PIPELINE_DIR, s.getName(), PIPELINE_EXTENSION);
eventBroker.post(TermSuiteEvents.PIPELINE_REMOVED, s);
}
@Override
public Optional<EPipeline> getPipeline(String pipelineName) {
return pipelines.getPipelines().stream()
.filter(p -> p.getName().equals(pipelineName))
.findFirst();
}
@Override
public Path getPath(EPipeline pipeline) {
return WorkspaceUtil.getWorkspacePath(PIPELINE_DIR, pipeline.getName() + "." + PIPELINE_EXTENSION);
}
/* (non-Javadoc)
* @see fr.univnantes.termsuite.ui.services.CorpusService#getCorporaList()
*/
@Override
public ECorporaList getCorporaList() {
return corpora;
}
@Override
public void saveCorpus(ECorpus corpus) {
WorkspaceUtil.saveResource(corpus, CORPUS_DIR, corpus.getName(), CORPUS_EXTENSION);
}
@Override
public ETerminology createTerminology(ESingleLanguageCorpus corpus, String terminologyName, EOccurrenceMode occMode, boolean hasContexts) {
/*
* Ensure that any termino with the same name is removed.
* (Override behaviour)
*/
for(Iterator<ETerminology> it = corpus.getTerminologies().iterator(); it.hasNext(); )
if(it.next().getName().equals(terminologyName))
it.remove();
ETerminology terminology = TermsuiteuiFactory.eINSTANCE.createETerminology();
terminology.setName(terminologyName);
terminology.setHasOccurrences(occMode != EOccurrenceMode.DO_NOT_KEEP);
terminology.setHasContexts(hasContexts);
corpus.getTerminologies().add(terminology);
return terminology;
}
@Override
public void removeTerminology(ETerminology terminology) {
ECorpus corpus = terminology.getCorpus().getCorpus();
getWorkspacePath(terminology).toFile().delete();
terminology.getCorpus().getTerminologies().remove(terminology);
saveCorpus(corpus);
eventBroker.post(TermSuiteEvents.TERMINOLOGY_REMOVED, terminology);
}
@Override
public Path getOutputDirectory(ESingleLanguageCorpus corpus) {
return context.get(ResourceService.class).getOutputDirectory()
.resolve(corpus.getCorpus().getName())
.resolve(corpus.getLanguage().getName());
}
@Override
public Path getOutputDirectory(ESingleLanguageCorpus corpus, EPipeline pipeline) {
return getOutputDirectory(corpus).resolve(pipeline.getName());
}
@Override
public void removeCorpus(ECorpus s) {
corpora.getCorpora().remove(s);
WorkspaceUtil.removeResource(CORPUS_DIR, s.getName(), CORPUS_EXTENSION);
eventBroker.post(TermSuiteEvents.CORPUS_REMOVED, s);
}
@Override
public Collection<ETerminology> getTerminologies() {
List<ETerminology> terminologies = Lists.newArrayList();
for(ECorpus corpus:getCorporaList().getCorpora()) {
for(ESingleLanguageCorpus slc:corpus.getSingleLanguageCorpora()) {
terminologies.addAll(slc.getTerminologies());
}
}
return terminologies;
}
@Override
public Path getWorkspacePath(ECorpus corpus) {
return createParents(getOutputDirectory().resolve(corpus.getName()));
}
@Override
public Path getWorkspacePath(ESingleLanguageCorpus slc) {
Path corpusPath = getWorkspacePath(slc.getCorpus());
Path slcPath = corpusPath.resolve(slc.getLanguage().toString());
return createParents(slcPath);
}
@Override
public Path getWorkspacePath(ETerminology resource) {
Path path = getWorkspacePath(resource.getCorpus()).resolve(resource.getName() + "." + JSON_EXTENSION);
return createParents(path);
}
private Path createParents(Path path) {
path.toFile().getParentFile().mkdirs();
return path;
}
}
| {
"content_hash": "723db1cbbd0ade08faffd433ed2afe16",
"timestamp": "",
"source": "github",
"line_count": 410,
"max_line_length": 146,
"avg_line_length": 33.65853658536585,
"alnum_prop": 0.7579710144927536,
"repo_name": "termsuite/termsuite-ui",
"id": "2c71fe44a2a37c20f10a4a97ebf1a22079478673",
"size": "13800",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "bundles/fr.univnantes.termsuite.ui/src/fr/univnantes/termsuite/ui/services/impl/ResourceServiceImpl.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "1038391"
},
{
"name": "Shell",
"bytes": "488"
}
],
"symlink_target": ""
} |
#include "mitkIOExtObjectFactory.h"
#include "mitkCoreObjectFactory.h"
#include "mitkParRecFileIOFactory.h"
//#include "mitkObjFileIOFactory.h"
#include "mitkStlVolumeTimeSeriesIOFactory.h"
#include "mitkVtkVolumeTimeSeriesIOFactory.h"
#include "mitkUnstructuredGridVtkWriter.h"
#include "mitkUnstructuredGridVtkWriterFactory.h"
#include "mitkVolumeMapperVtkSmart3D.h"
#include "mitkMesh.h"
#include "mitkMeshMapper2D.h"
#include "mitkMeshVtkMapper3D.h"
#include "mitkUnstructuredGridMapper2D.h"
#include "mitkUnstructuredGridVtkMapper3D.h"
#include "mitkVtkGLMapperWrapper.h"
#include <vtkUnstructuredGridWriter.h>
#include <vtkXMLPUnstructuredGridWriter.h>
#include <vtkXMLUnstructuredGridWriter.h>
mitk::IOExtObjectFactory::IOExtObjectFactory()
: CoreObjectFactoryBase(),
m_ParRecFileIOFactory(ParRecFileIOFactory::New().GetPointer())
//, m_ObjFileIOFactory(ObjFileIOFactory::New().GetPointer())
,
m_StlVolumeTimeSeriesIOFactory(StlVolumeTimeSeriesIOFactory::New().GetPointer()),
m_VtkVolumeTimeSeriesIOFactory(VtkVolumeTimeSeriesIOFactory::New().GetPointer()),
m_UnstructuredGridVtkWriterFactory(UnstructuredGridVtkWriterFactory::New().GetPointer())
{
static bool alreadyDone = false;
if (!alreadyDone)
{
MITK_DEBUG << "IOExtObjectFactory c'tor" << std::endl;
itk::ObjectFactoryBase::RegisterFactory(m_ParRecFileIOFactory);
itk::ObjectFactoryBase::RegisterFactory(m_StlVolumeTimeSeriesIOFactory);
itk::ObjectFactoryBase::RegisterFactory(m_VtkVolumeTimeSeriesIOFactory);
itk::ObjectFactoryBase::RegisterFactory(m_UnstructuredGridVtkWriterFactory);
m_FileWriters.push_back(mitk::UnstructuredGridVtkWriter<vtkUnstructuredGridWriter>::New().GetPointer());
m_FileWriters.push_back(mitk::UnstructuredGridVtkWriter<vtkXMLUnstructuredGridWriter>::New().GetPointer());
m_FileWriters.push_back(mitk::UnstructuredGridVtkWriter<vtkXMLPUnstructuredGridWriter>::New().GetPointer());
CreateFileExtensionsMap();
alreadyDone = true;
}
}
mitk::IOExtObjectFactory::~IOExtObjectFactory()
{
itk::ObjectFactoryBase::UnRegisterFactory(m_ParRecFileIOFactory);
itk::ObjectFactoryBase::UnRegisterFactory(m_StlVolumeTimeSeriesIOFactory);
itk::ObjectFactoryBase::UnRegisterFactory(m_VtkVolumeTimeSeriesIOFactory);
itk::ObjectFactoryBase::UnRegisterFactory(m_UnstructuredGridVtkWriterFactory);
}
mitk::Mapper::Pointer mitk::IOExtObjectFactory::CreateMapper(mitk::DataNode *node, MapperSlotId id)
{
mitk::Mapper::Pointer newMapper = nullptr;
mitk::BaseData *data = node->GetData();
if (id == mitk::BaseRenderer::Standard2D)
{
if ((dynamic_cast<Mesh *>(data) != nullptr))
{
newMapper = mitk::MeshMapper2D::New();
newMapper->SetDataNode(node);
}
else if ((dynamic_cast<UnstructuredGrid *>(data) != nullptr))
{
newMapper = mitk::VtkGLMapperWrapper::New(mitk::UnstructuredGridMapper2D::New().GetPointer());
newMapper->SetDataNode(node);
}
}
else if (id == mitk::BaseRenderer::Standard3D)
{
if ((dynamic_cast<Image *>(data) != nullptr) && std::string("Image").compare(node->GetData()->GetNameOfClass())==0)
{
newMapper = mitk::VolumeMapperVtkSmart3D::New();
newMapper->SetDataNode(node);
}
else if ((dynamic_cast<Mesh *>(data) != nullptr))
{
newMapper = mitk::MeshVtkMapper3D::New();
newMapper->SetDataNode(node);
}
else if ((dynamic_cast<UnstructuredGrid *>(data) != nullptr))
{
newMapper = mitk::UnstructuredGridVtkMapper3D::New();
newMapper->SetDataNode(node);
}
}
return newMapper;
}
void mitk::IOExtObjectFactory::SetDefaultProperties(mitk::DataNode *node)
{
if (node == nullptr)
return;
mitk::DataNode::Pointer nodePointer = node;
mitk::Image::Pointer image = dynamic_cast<mitk::Image *>(node->GetData());
if (image.IsNotNull() && image->IsInitialized())
{
mitk::VolumeMapperVtkSmart3D::SetDefaultProperties(node);
}
if (dynamic_cast<mitk::UnstructuredGrid *>(node->GetData()))
{
mitk::UnstructuredGridVtkMapper3D::SetDefaultProperties(node);
}
}
const char *mitk::IOExtObjectFactory::GetFileExtensions()
{
std::string fileExtension;
this->CreateFileExtensions(m_FileExtensionsMap, fileExtension);
return fileExtension.c_str();
}
mitk::CoreObjectFactoryBase::MultimapType mitk::IOExtObjectFactory::GetFileExtensionsMap()
{
return m_FileExtensionsMap;
}
mitk::CoreObjectFactoryBase::MultimapType mitk::IOExtObjectFactory::GetSaveFileExtensionsMap()
{
return m_SaveFileExtensionsMap;
}
void mitk::IOExtObjectFactory::CreateFileExtensionsMap()
{
m_FileExtensionsMap.insert(std::pair<std::string, std::string>("*.vtu", "VTK Unstructured Grid"));
m_FileExtensionsMap.insert(std::pair<std::string, std::string>("*.vtk", "VTK Unstructured Grid"));
m_FileExtensionsMap.insert(std::pair<std::string, std::string>("*.pvtu", "VTK Unstructured Grid"));
m_SaveFileExtensionsMap.insert(std::pair<std::string, std::string>("*.pvtu", "VTK Parallel XML Unstructured Grid"));
m_SaveFileExtensionsMap.insert(std::pair<std::string, std::string>("*.vtu", "VTK XML Unstructured Grid"));
m_SaveFileExtensionsMap.insert(std::pair<std::string, std::string>("*.vtk", "VTK Legacy Unstructured Grid"));
}
const char *mitk::IOExtObjectFactory::GetSaveFileExtensions()
{
std::string fileExtension;
this->CreateFileExtensions(m_SaveFileExtensionsMap, fileExtension);
return fileExtension.c_str();
}
struct RegisterIOExtObjectFactory
{
RegisterIOExtObjectFactory() : m_Factory(mitk::IOExtObjectFactory::New())
{
mitk::CoreObjectFactory::GetInstance()->RegisterExtraFactory(m_Factory);
}
~RegisterIOExtObjectFactory() { mitk::CoreObjectFactory::GetInstance()->UnRegisterExtraFactory(m_Factory); }
mitk::IOExtObjectFactory::Pointer m_Factory;
};
static RegisterIOExtObjectFactory registerIOExtObjectFactory;
| {
"content_hash": "b36542a5ce260769e5f527557a3d3f2f",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 119,
"avg_line_length": 34.53529411764706,
"alnum_prop": 0.7479134730028956,
"repo_name": "fmilano/mitk",
"id": "ee4c2453dcf5669f919a4385d7c136ad9deec33e",
"size": "6252",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Modules/IOExt/Internal/mitkIOExtObjectFactory.cpp",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "2668761"
},
{
"name": "C++",
"bytes": "25270216"
},
{
"name": "CSS",
"bytes": "52056"
},
{
"name": "Java",
"bytes": "350330"
},
{
"name": "JavaScript",
"bytes": "47660"
},
{
"name": "Makefile",
"bytes": "742"
},
{
"name": "Objective-C",
"bytes": "509788"
},
{
"name": "Perl",
"bytes": "982"
},
{
"name": "Python",
"bytes": "7545"
},
{
"name": "Shell",
"bytes": "6507"
},
{
"name": "TeX",
"bytes": "1204"
},
{
"name": "XSLT",
"bytes": "15769"
}
],
"symlink_target": ""
} |
'use strict';
var expect = require('chai').expect;
var DashboardController = require('../DashboardController');
describe('DashboardController', function () {
var scope,
Controller;
beforeEach(function () {
scope = {};
Controller = new DashboardController[DashboardController.length - 1](scope);
});
it('should exist', function () {
expect(!!Controller).to.be.true;
});
});
| {
"content_hash": "4a16f635ba50cdd67392f1075d9e607a",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 84,
"avg_line_length": 23.833333333333332,
"alnum_prop": 0.6223776223776224,
"repo_name": "likesalmon/modular-mean",
"id": "a05bf43a7822273a502d5c50894ec04f9343d1be",
"size": "429",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "client/Dashboard/test/DashboardController.test.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "460"
},
{
"name": "HTML",
"bytes": "4771"
},
{
"name": "JavaScript",
"bytes": "41090"
}
],
"symlink_target": ""
} |
While collections are a useful AG extension, they may be undesirable due to memory requirements; we can still consider DAGs where they are provided as input and therefore not require collections. The challenge is that we can no longer rewrite the grammar to propagate phantom attributes alongside references in order to schedule reads of non-local attributes. Our basic solution is to require \emph{all} instance of an attribute to be solved before \emph{any} are accessed.
In terms of our original rewrite, instead of propagating phantom attributes alongside reference values, we conservatively assume the propagation is universal. Our rewrite is now to \emph{gather} all phantom instances of an attributes and then \emph{broadcast} a joined phantom value. Consider our ongoing example, where we must gather all instances of attribute \code{width} of node \code{Cell} and broadcast when they are all ready to any dereference of any instance (i.e., in \code{Column}). We reuse primitives from before, but also introduce $\O(\cdot, \cdot)$ to join two dependencies:
\pagebreak
\begin{lstlisting}[mathescape]
//grammar schema
@Start Table $\rightarrow$ Row Column {
phantom c_w_gather : int;
phantom c_w_broadcast : int
}
Cell $\rightarrow$ $\epsilon$ {
input width : int;
phantom c_w_gather : int;
phantom c_w_broadcast : int
}
Row $\rightarrow$ Cell {
phantom c_w_gather : int;
phantom c_w_broadcast : int
}
Column $\rightarrow$ $\epsilon$ {
input CellAlias : ref Cell;
var width : int;
phantom c_w_gather : int;
phantom c_w_broadcast : int
}
//attribute constraints
Table {
Col.CellAlias := @(Row.Cell_ptr);
c_w_gather := $\O$(Row.c_w_gather, Col.c_w_gather);
c_w_broadcast := c_w_gather;
Row.c_w_broadcast = c_w_broadcast;
Col.c_w_broadcast = c_w_broadcast;
}
Column {
width := $\rightarrow$(CellAlias.width, c_w_broadcast);
c_w_gather := true;
}
Row {
c_w_gather := $\O$(Row.c_w_gather, Col.c_w_gather);
cell.c_w_broadcast = c_w_broadcast;
}
Cell {
c_w_gather := width;
}
\end{lstlisting}
Our example has several important properties:
\begin{enumerate}
\item \textbf{Input graph}. Note that the schema of \text{Column} treats \code{myCellAlias} as an input. Our input is thus a minimum spanning tree (MST) augmented with non-local edges.
\item \textbf{Global propagation}. We add phantom attributes \code{c_w_gather} and \code{c_w_broadcast} to all nodes.
\item \textbf{Gathering.} The first step is to \emph{gather} all uses of an attribute into one dependency; we do this in a bottom-up flow on the MST. Phantom attribute \code{c_w_gather} is ready when all of the \code{width} attributes of its subtree (in the MST) is ready. Most nodes are propagation nodes, e.g., \code{Row}, which merges flows from its children. Leaves such as \code{Column} have nothing to gather. \code{Cell} provides a \code{width} value in the original grammar, so it adds a dependency from where.
\item \textbf{Broadcasting.} Phantom attribute \code{c_w_broadcast} is ready when all instances of \code{c_w_gather} are ready. \code{Table} is the root of any tree allowed by our grammar, so it is responsible for this transfer. The remaining types further broadcast to their children.
\item \textbf{Dependent dereferences.} The non-local attribute read in \code{Column} is dependent on the broadcast of the attribute; it occurs after all instances of the attribute have been gathered.
\end{enumerate}
Finally, as with our dynamically computed graph connections, we use phantom attributes and operations to track non-local dependencies while still using the appropriate pointer-based code generation. Phantom code is not emitted.
\subsection{Rewrite rules}
See Figure~\ref{fig:statrewrites}.
\input{rewritestatic} | {
"content_hash": "b0786c61a0570a5dae52ddd4ec3f9f53",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 590,
"avg_line_length": 58.765625,
"alnum_prop": 0.7505982451475671,
"repo_name": "Superconductor/superconductor",
"id": "287904841c002a00c17e99cf1fbd423f59ce0947",
"size": "3761",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "compiler/attrib-gram-evaluator-swipl/Docs/DAGs/static.tex",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "21942"
},
{
"name": "C++",
"bytes": "12492"
},
{
"name": "CSS",
"bytes": "13437"
},
{
"name": "DOT",
"bytes": "34776"
},
{
"name": "Java",
"bytes": "581380"
},
{
"name": "JavaScript",
"bytes": "929946"
},
{
"name": "Perl",
"bytes": "133145"
},
{
"name": "Shell",
"bytes": "6004"
},
{
"name": "TeX",
"bytes": "511870"
}
],
"symlink_target": ""
} |
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { OverlayModule } from '@angular/cdk/overlay';
import { VCLIconModule } from '../icon/index';
import { VCLButtonModule } from '../button/index';
import { VCLInputModule } from '../input/index';
import { VCLIcogramModule } from '../icogram/index';
import { VCLSelectListModule } from '../select-list/index';
import { AutocompleteDirective, AutocompleteSelectListDirective, AutocompleteConfig } from './autocomplete.directive';
import { AutocompleteInputDirective } from './autocomplete-input.directive';
export { AutocompleteDirective, AutocompleteSelectListDirective, AutocompleteConfig, AutocompleteInputDirective };
@NgModule({
imports: [CommonModule, OverlayModule, VCLInputModule, VCLIconModule, VCLIcogramModule, VCLButtonModule, VCLSelectListModule],
exports: [AutocompleteDirective, AutocompleteSelectListDirective, AutocompleteInputDirective, VCLSelectListModule],
declarations: [AutocompleteDirective, AutocompleteSelectListDirective, AutocompleteInputDirective],
providers: [],
})
export class VCLAutocompleteModule { }
| {
"content_hash": "d67991a28194d2c114cad9c9b2e24d5a",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 128,
"avg_line_length": 51.77272727272727,
"alnum_prop": 0.7945566286215979,
"repo_name": "ng-vcl/ng-vcl",
"id": "738ccca09958b32f5b9c237b57c9a9e18cf014d6",
"size": "1139",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/ng-vcl/src/autocomplete/index.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1313"
},
{
"name": "HTML",
"bytes": "37253"
},
{
"name": "JavaScript",
"bytes": "5986"
},
{
"name": "Shell",
"bytes": "32"
},
{
"name": "TypeScript",
"bytes": "417292"
}
],
"symlink_target": ""
} |
using namespace std;
static UINT32 count_lines(const char *f_name);
ObjectModel::ObjectModel()
{
vertice_list = new VerticeList();
normal_list = new NormalList();
triangle_list = new TriangleList();
}
ObjectModel::ObjectModel(float *vertice, UINT64 n_vertice, float *normal,
UINT64 n_normal, UINT32 *triangle, UINT64 n_triangle) : ObjectModel()
{
vertice_list->set_list(vertice, n_vertice);
normal_list->set_list(normal, n_normal);
triangle_list->set_list(triangle, n_triangle);
reset();
}
ObjectModel::ObjectModel(const std::string& f_name) : ObjectModel()
{
ModelLoader::load(f_name, vertice_list, normal_list, triangle_list);
reset();
}
ObjectModel::~ObjectModel()
{
delete(vertice_list);
delete(normal_list);
delete(triangle_list);
}
TriangleList *ObjectModel::get_triangle_list()
{
return triangle_list;
}
VerticeList *ObjectModel::get_vertice_list()
{
return vertice_list;
}
void ObjectModel::render()
{
material.render();
UINT32 *indices = triangle_list->get_pointer();
float *normals = normal_list->get_pointer();
float *vertices = vertice_list->get_pointer();
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glVertexPointer(3, GL_FLOAT, 6 * sizeof(GLfloat), vertices);
glNormalPointer(GL_FLOAT, 0, normals);
glDrawElements(GL_TRIANGLES, triangle_list->get_size() * triangle_list->get_offset(), GL_UNSIGNED_INT, indices);
material.set_default_material();
}
void ObjectModel::reset()
{
float *vertice;
UINT64 n_vertices = vertice_list->get_size();
float max_c[3], min_c[3];
for (register UINT8 i = 0; i < 3; ++i)
{
max_c[i] = -10e30;
min_c[i] = 10e30;
}
for (register UINT64 i = 0; i < n_vertices; ++i)
{
vertice = vertice_list->get_item(i);
for (register UINT8 j = 0; j < 3; ++j)
{
max_c[j] = max(max_c[j], vertice[j]);
min_c[j] = min(min_c[j], vertice[j]);
}
}
scale = min(World::near_plane_width / (max_c[0] - min_c[0]), World::near_plane_height / (max_c[1] - min_c[1]));
for (register UINT8 i = 0; i < 3; ++i)
{
position[i] = -scale * (max_c[i] + min_c[i]) / 2.0;
}
Object::updateMatrix();
} | {
"content_hash": "e652a033e98c91e99eff746de441d2b4",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 116,
"avg_line_length": 23.833333333333332,
"alnum_prop": 0.6188811188811189,
"repo_name": "matheusvxf/Lighting-and-Shaders",
"id": "c762254210fd1e770ec9f33d5005832807050cd9",
"size": "2479",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "components/source/ObjectModel.cpp",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "2055120"
},
{
"name": "C++",
"bytes": "173371997"
},
{
"name": "GLSL",
"bytes": "2338"
},
{
"name": "Objective-C",
"bytes": "288"
},
{
"name": "Perl",
"bytes": "5041"
}
],
"symlink_target": ""
} |
ActiveRecord::Schema.define(version: 20150114231953) do
create_table "interests", force: :cascade do |t|
t.string "subreddits"
t.string "user_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "profiles", force: :cascade do |t|
t.string "name"
t.string "created"
t.string "gold_creddits"
t.string "link_karma"
t.string "comment_karma"
t.boolean "over_18"
t.boolean "is_gold"
t.boolean "is_mod"
t.string "user_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "users", force: :cascade do |t|
t.string "provider"
t.string "uid"
t.string "name"
t.string "token"
t.string "secret"
t.string "profile_image"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
end
| {
"content_hash": "d8c8e66f7d53ec450e00b5e9765b1f5b",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 55,
"avg_line_length": 26.4,
"alnum_prop": 0.6103896103896104,
"repo_name": "mendokusai/yaps",
"id": "9fda41a4c8259531771036dc710c51d0f84d9280",
"size": "1665",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "db/schema.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "16494"
},
{
"name": "HTML",
"bytes": "17744"
},
{
"name": "JavaScript",
"bytes": "2186"
},
{
"name": "Ruby",
"bytes": "33757"
}
],
"symlink_target": ""
} |
package io.sidecar.query;
import java.util.List;
import java.util.Objects;
import com.google.common.base.CharMatcher;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import io.sidecar.util.CollectionUtils;
import org.apache.commons.lang.StringUtils;
// TODO: make this a builder..
public final class Query {
private final String stream;
private final ImmutableList<Arg> args;
public Query(String stream, List<Arg> args) {
Preconditions.checkArgument(StringUtils.isNotBlank(stream));
Preconditions.checkArgument(CharMatcher.WHITESPACE.matchesNoneOf(stream));
this.stream = stream;
this.args = CollectionUtils.filterNulls(args);
}
/**
* The Stream the query should be executed against. This should correspond to the stream name the event
* was ingested into.
*
* @return The name of the stream.
*/
public String getStream() {
return stream;
}
public ImmutableList<Arg> getArgs() {
return args;
}
@Override
public String toString() {
return "Query{" +
"stream=" + stream +
", args=" + args +
"} " + super.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Query that = (Query) o;
return Objects.equals(this.stream, that.stream) &&
Objects.equals(this.args, that.args);
}
@Override
public int hashCode() {
return Objects.hash(stream, args);
}
}
| {
"content_hash": "5d3c80b1f0d8de55d6d5ae9e634c7bfe",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 107,
"avg_line_length": 24.3,
"alnum_prop": 0.6096413874191652,
"repo_name": "sidecar-io/sidecar-java-sdk",
"id": "988f1767d2ba49312fe39ebc8c210d004b1390e8",
"size": "2296",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "model/src/main/java/io/sidecar/query/Query.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "280511"
}
],
"symlink_target": ""
} |
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
scripts: {
files: ['Gruntfile.js', 'LJS.js', 'modules/**/*.js', 'modules/**/*.html', 'utils/**/*.js', '*.js'],
tasks: 'default',
options: {
spawn: false,
},
},
},
requirejs: {
compile: {
options: {
baseUrl: ".",
paths: {
jquery: 'empty:',
jquery_autocomplete: 'empty:',
qunit: 'empty:',
vexflow: 'empty:',
Midijs: 'empty:',
text: 'external-libs/require-text',
pubsub: 'empty:',
jsPDF: 'empty:',
mustache: 'empty:'
},
cjsTranslate: true,
//findNestedDependencies: true,
optimize: "none", // "uglify2", "none"
/*modules: [
{
name: 'leadsheet',
include: ['modules/main']
},
{
name: 'viewer',
include: ['modules/core/src/main', 'modules/core/src/LSViewer']
}
],*/
name: "ChordSeq",
//name: "build/LeadsheetJS-0.1.0.min.js",
//name: "samples/simpleInterface/interface",
// include: ['modules/**/*.js', '!modules/core/src/SongModel.old.js'],
out: "build/chordseq-<%= pkg.version %>.min.js",
// exclude: ["jquery, jquery_autocomplete, qunit, vexflow_helper, vexflow, Midijs, pubsub, jsPDF, mustache, bootstrap"],
fileExclusionRegExp: /\.git/,
/*done: function(done, output) {
var duplicates = require('rjs-build-analysis').duplicates(output);
if (duplicates.length > 0) {
grunt.log.subhead('Duplicates found in requirejs build:');
grunt.log.warn(duplicates);
return done(new Error('r.js built duplicate modules, please check the excludes option.'));
}
done();
}*/
}
}
},
qunit: {
all: ['tests/test.html']
},
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-qunit');
// grunt.loadNpmTasks('grunt-jsdoc');
// grunt.loadNpmTasks('grunt-umd');
// Default task(s).
grunt.registerTask('all', ['requirejs', 'jsdoc']);
grunt.registerTask('default', ['requirejs']);
}; | {
"content_hash": "5ffb4841999b7cb06d1ebaf3ae1f413d",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 125,
"avg_line_length": 27.40506329113924,
"alnum_prop": 0.5824480369515012,
"repo_name": "dmmz/LeadsheetJS",
"id": "f70e0791d7b58b45fcd8bcad374651302c2053a2",
"size": "2165",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "gruntChordSeq.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "9621"
},
{
"name": "HTML",
"bytes": "25543"
},
{
"name": "JavaScript",
"bytes": "1378477"
}
],
"symlink_target": ""
} |
'use strict';
var __DEV__ = true; // TODO: Replace this based on environment.
var React = require('react');
var invariant = require('react/lib/invariant');
var warning = require('react/lib/warning');
var extend = require('xtend');
/**
* Updates the `children` attribute of the provided props object to accurately
* reflect the argument list (since you can pass in children as more than one
* argument). Mutates the provided `props` object. Taken from
* `ReactDescriptor.createFactory`.
*/
function formatProps(props, children) {
if (props == null) {
props = {};
} else {
props = extend(props);
}
var childrenLength = arguments.length - 1;
if (childrenLength === 1) {
props.children = children;
} else if (childrenLength > 1) {
var childArray = new Array(childrenLength);
for (var i = 0; i < childrenLength; i++) {
childArray[i] = arguments[i + 1];
}
props.children = childArray;
}
return props;
}
/**
* Adds the missing defaults to the provided props object. This function mutates
* the props object. Taken from `ReactCompositeComponent.mountComponent`.
*/
function fillDefaultProps(props, defaultProps) {
for (var propName in defaultProps) {
if (typeof props[propName] === 'undefined') {
props[propName] = defaultProps[propName];
}
}
}
/**
* Assert that the props are valid. Taken from
* `ReactCompositeComponent._checkPropTypes`
*
* @param {object} propTypes Map of prop name to a ReactPropType
* @param {object} props
* @param {string} location e.g. "prop", "context", "child context"
*/
function checkPropTypes(propTypes, props, location) {
for (var propName in propTypes) {
if (propTypes.hasOwnProperty(propName)) {
var error =
propTypes[propName](props, propName, 'ReactTemplate', location);
if (error instanceof Error) {
warning(false, error.message);
}
}
}
}
function createTemplate(spec) {
// Allow for creation using just a function.
if (typeof spec === 'function') {
spec = {render: spec};
}
var render = spec.render;
invariant(
render,
'You must provide a render function.'
);
// Create a template function.
var template = function(props, children) {
props = formatProps.apply(null, arguments);
// Fill in the defaults.
var defaultProps = spec.getDefaultProps ? spec.getDefaultProps() : null;
fillDefaultProps(props, defaultProps);
// Check the prop types.
if (__DEV__) {
var propTypes = spec.propTypes;
if (propTypes) {
checkPropTypes(propTypes, props, 'prop');
}
}
// Create a context with a `props` property and bound methods.
var ctx = {props: props};
for (var key in spec) {
if (!spec.hasOwnProperty(key)) continue;
var member = spec[key];
if (typeof member === 'function') {
ctx[key] = member.bind(ctx);
} else {
ctx[key] = member;
}
}
// Call the render method.
var el = ctx.render();
invariant(
(React.isValidElement || React.isValidComponent)(el),
'A valid ReactComponent must be returned. You may have ' +
'returned undefined, an array or some other invalid object.'
);
return el;
};
if (spec.statics) {
for (var k in spec.statics) {
if (!spec.statics.hasOwnProperty(k)) continue;
template[k] = spec.statics[k];
}
}
return template;
}
module.exports = {
create: createTemplate
};
| {
"content_hash": "c12682c0f0bd276871f057c3592550eb",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 80,
"avg_line_length": 26.412213740458014,
"alnum_prop": 0.6427745664739885,
"repo_name": "matthewwithanm/react-template",
"id": "e864bd17a75ec7bafdce589f629cc9f71e1876dd",
"size": "3460",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/index.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "8804"
}
],
"symlink_target": ""
} |
Use simple functions
| {
"content_hash": "c1b4c07bef373005be698e58c46f639d",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 20,
"avg_line_length": 21,
"alnum_prop": 0.8571428571428571,
"repo_name": "alvarofernandezarjona/Basic",
"id": "194bbc9021765aebfd1fac0fce1df51a88a3cdc5",
"size": "29",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
UIColor category that converts Hex and RGB color string values to UIColor.
## Supports color formats
- Hex string
- fff (short, without #)
- #fff (short, with #)
- 00ff00 (long, without #)
- #00ff00 (long, with #)
- RGB(A) string
- 99,159,137 (without alpha)
- 99,159,137,0.5 (with alpha)
- Hex integer
- 0x00ff00
## Installation
- Add `UIColor+HexRGB.h` and `UIColor+HexRGB.h` to your project.
- Or use CocoaPods: `pod 'UIColor-HexRGB'`.
## Requirements
Requires iOS 4.3 and above.
## Usage
``` cpp
#import "UIColor+HexRGB.h"
- (void)viewDidLoad {
[super viewDidLoad];
self.label1.backgroundColor = [UIColor colorWithHex: @"2eeea3"];
self.label2.backgroundColor = [UIColor colorWithHex: @"#fd482f"];
self.label3.backgroundColor = [UIColor colorWithRGB: @"99,159,137"];
self.label4.backgroundColor = [UIColor colorWithRGBA: @"137,99,59,0.5"];
self.label5.backgroundColor = [UIColor colorWithHex: @"0f0"];
self.label6.backgroundColor = [UIColor colorWithHexNum: 0xfd482f alpha: 0.5];
}
```
## Example
 | {
"content_hash": "2c0c2915116c4e2310328e9f2a64df16",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 83,
"avg_line_length": 22.48076923076923,
"alnum_prop": 0.6672369546621043,
"repo_name": "tinymind/UIColor-HexRGB",
"id": "33a7dcd0f5b90bb745501ff4757e882fac9cae3d",
"size": "1186",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "9569"
},
{
"name": "Ruby",
"bytes": "547"
}
],
"symlink_target": ""
} |
import sys
if sys.version_info < (3, 7):
from ._visible import VisibleValidator
from ._thickness import ThicknessValidator
from ._textfont import TextfontValidator
from ._side import SideValidator
from ._edgeshape import EdgeshapeValidator
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relative_import(
__name__,
[],
[
"._visible.VisibleValidator",
"._thickness.ThicknessValidator",
"._textfont.TextfontValidator",
"._side.SideValidator",
"._edgeshape.EdgeshapeValidator",
],
)
| {
"content_hash": "70f25741c0fb3b3973309e797f6c4204",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 55,
"avg_line_length": 29.454545454545453,
"alnum_prop": 0.6080246913580247,
"repo_name": "plotly/python-api",
"id": "76ab60d1d9918cb9fede7e9a6359ff7260fd98ca",
"size": "648",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "packages/python/plotly/plotly/validators/treemap/pathbar/__init__.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "6870"
},
{
"name": "Makefile",
"bytes": "1708"
},
{
"name": "Python",
"bytes": "823245"
},
{
"name": "Shell",
"bytes": "3238"
}
],
"symlink_target": ""
} |
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.ide.actions;
import com.intellij.icons.AllIcons;
import com.intellij.openapi.actionSystem.ActionPlaces;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.ui.tabs.impl.MorePopupAware;
import org.jetbrains.annotations.NotNull;
/**
* Shows the popup of all tabs when single row editor tab layout is used and all tabs don't fit on the screen.
*
* @author yole
*/
public class TabListAction extends AnAction {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
MorePopupAware morePopupAware = e.getData(MorePopupAware.KEY);
if (morePopupAware != null) {
morePopupAware.showMorePopup();
}
}
@Override
public void update(@NotNull AnActionEvent e) {
e.getPresentation().setIcon(AllIcons.Actions.FindAndShowNextMatches);
if (ApplicationManager.getApplication().isHeadlessEnvironment()) {
e.getPresentation().setEnabledAndVisible(false);
return;
}
boolean available = isTabListAvailable(e) || e.getPlace() == ActionPlaces.TABS_MORE_TOOLBAR;
e.getPresentation().setEnabledAndVisible(available);
}
private static boolean isTabListAvailable(@NotNull AnActionEvent e) {
MorePopupAware morePopupAware = e.getData(MorePopupAware.KEY);
return morePopupAware != null && morePopupAware.canShowMorePopup();
}
}
| {
"content_hash": "f20af4a2cb4653e24446245b34c36344",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 140,
"avg_line_length": 38.707317073170735,
"alnum_prop": 0.7643352236925016,
"repo_name": "leafclick/intellij-community",
"id": "1d3c87b82403ef90f0e0abc0dca275d49f993c6d",
"size": "1587",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "platform/platform-impl/src/com/intellij/ide/actions/TabListAction.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package org.apache.commons.jcs3.engine;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import org.apache.commons.jcs3.engine.behavior.ICache;
import org.apache.commons.jcs3.engine.behavior.ICacheEventQueue;
/**
* Used to associates a set of [cache listener to cache event queue] for a
* cache.
*/
public class CacheListeners<K, V>
{
/** The cache using the queue. */
public final ICache<K, V> cache;
/** Map ICacheListener to ICacheEventQueue */
public final ConcurrentMap<Long, ICacheEventQueue<K, V>> eventQMap =
new ConcurrentHashMap<>();
/**
* Constructs with the given cache.
* <p>
* @param cache
*/
public CacheListeners( final ICache<K, V> cache )
{
if ( cache == null )
{
throw new IllegalArgumentException( "cache must not be null" );
}
this.cache = cache;
}
/** @return info on the listeners */
@Override
public String toString()
{
final StringBuilder buffer = new StringBuilder();
buffer.append( "\n CacheListeners" );
buffer.append( "\n Region = " + cache.getCacheName() );
buffer.append( "\n Event Queue Map " );
buffer.append( "\n size = " + eventQMap.size() );
eventQMap.forEach((key, value)
-> buffer.append( "\n Entry: key: ").append(key)
.append(", value: ").append(value));
return buffer.toString();
}
}
| {
"content_hash": "b92c4d517ce2028353c840172d9e981e",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 75,
"avg_line_length": 28.71153846153846,
"alnum_prop": 0.6121902210314802,
"repo_name": "apache/commons-jcs",
"id": "789f2790dffe32224085fbb5e182ec8096ad0cc5",
"size": "2300",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/CacheListeners.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "12127"
},
{
"name": "HTML",
"bytes": "12964"
},
{
"name": "Java",
"bytes": "3300954"
},
{
"name": "Shell",
"bytes": "9464"
}
],
"symlink_target": ""
} |
<?php
namespace App\Services\Parsers;
use App\Entities\Asset;
use App\Entities\Vulnerability;
use App\Entities\VulnerabilityHttpData;
use App\Entities\VulnerabilityReferenceCode;
use App\Entities\Workspace;
use App\Repositories\AssetRepository;
use App\Repositories\FileRepository;
use App\Services\JsonLogService;
use Doctrine\ORM\EntityManager;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Validation\Factory;
use League\Tactician\CommandBus;
use XMLReader;
class NetsparkerXmlParserService extends AbstractXmlParserService
{
/**
* NetsparkerXmlParserService constructor.
*
* @param XMLReader $parser
* @param Filesystem $fileSystem
* @param Factory $validatorFactory
* @param AssetRepository $assetRepository
* @param FileRepository $fileRepository
* @param EntityManager $em
* @param JsonLogService $logger
* @param CommandBus $commandBus
*/
public function __construct(
XMLReader $parser, Filesystem $fileSystem, Factory $validatorFactory, AssetRepository $assetRepository,
FileRepository $fileRepository, EntityManager $em, JsonLogService $logger, CommandBus $commandBus
)
{
parent::__construct(
$parser, $fileSystem, $validatorFactory, $assetRepository, $fileRepository, $em, $logger, $commandBus
);
// Create the mappings to use when parsing the NMAP XML output
$this->fileToSchemaMapping = collect([
'target.url' => collect([
'setHostname' => collect([
parent::MAP_ATTRIBUTE_ENTITY_CLASS => Asset::class,
parent::MAP_ATTRIBUTE_VALIDATION => [
'filled',
'regex:' . Asset::REGEX_HOSTNAME
],
]),
]),
'vulnerability.url' => collect([
'setHttpUri' => collect([
parent::MAP_ATTRIBUTE_ENTITY_CLASS => VulnerabilityHttpData::class,
parent::MAP_ATTRIBUTE_VALIDATION => 'filled|url',
]),
]),
'type' => collect([
'setName' => collect([
parent::MAP_ATTRIBUTE_ENTITY_CLASS => Vulnerability::class,
parent::MAP_ATTRIBUTE_VALIDATION => 'filled',
]),
'setIdFromScanner' => collect([
parent::MAP_ATTRIBUTE_ENTITY_CLASS => Vulnerability::class,
parent::MAP_ATTRIBUTE_VALIDATION => 'filled',
]),
]),
'severity' => collect([
'setSeverity' => collect([
parent::MAP_ATTRIBUTE_ENTITY_CLASS => Vulnerability::class,
parent::MAP_ATTRIBUTE_VALIDATION => 'filled|in:Critical,High,Medium,Low,Information',
]),
]),
'extrainformation' => collect([
'setGenericOutput' => collect([
parent::MAP_ATTRIBUTE_ENTITY_CLASS => Vulnerability::class,
parent::MAP_ATTRIBUTE_VALIDATION => 'filled',
])
]),
'vulnerableparameter' => collect([
'setHttpTestParameter' => collect([
parent::MAP_ATTRIBUTE_ENTITY_CLASS => Vulnerability::class,
parent::MAP_ATTRIBUTE_VALIDATION => 'filled',
]),
]),
'vulnerableparametervalue' => collect([
'setHttpAttackPattern' => collect([
parent::MAP_ATTRIBUTE_ENTITY_CLASS => Vulnerability::class,
parent::MAP_ATTRIBUTE_VALIDATION => 'filled',
]),
]),
'vulnerableparametertype' => collect([
'setHttpMethod' => collect([
parent::MAP_ATTRIBUTE_ENTITY_CLASS => Vulnerability::class,
parent::MAP_ATTRIBUTE_VALIDATION => 'filled|in:GET,HEAD,POST,PUT,OPTIONS,CONNECT,TRACE,DELETE',
]),
]),
]);
// Pre-processing method map
$this->nodePreprocessingMap = collect([
'target' => collect([
'initialiseNewEntity' => collect([
Asset::class,
]),
]),
'vulnerability' => collect([
'initialiseNewEntity' => collect([
Vulnerability::class,
]),
]),
'url' => collect([
'initialiseNewEntity' => collect([
VulnerabilityHttpData::class,
]),
]),
'rawrequest' => collect([
'captureCDataField' => collect([
VulnerabilityHttpData::class,
'setHttpRawRequest',
]),
]),
'rawresponse' => collect([
'captureCDataField' => collect([
VulnerabilityHttpData::class,
'setHttpRawResponse',
]),
]),
'classification' => 'extractVulnerabilityReferences',
]);
// Post-processing method map
$this->nodePostProcessingMap = collect([
'target' => collect([
'persistPopulatedEntity' => collect([
Asset::class,
[
Asset::HOSTNAME => null,
Asset::IP_ADDRESS_V4 => null,
],
Workspace::class
]),
]),
'rawresponse' => collect([
'persistPopulatedEntity' => collect([
VulnerabilityHttpData::class,
[
VulnerabilityHttpData::HTTP_URI => null,
VulnerabilityHttpData::HTTP_METHOD => null,
VulnerabilityHttpData::HTTP_PORT => null,
VulnerabilityHttpData::HTTP_STATUS_CODE => null,
VulnerabilityHttpData::HTTP_TEST_PARAMETER => null,
VulnerabilityHttpData::VULNERABILITY => null,
],
Vulnerability::class,
]),
]),
'vulnerability' => collect([
'persistPopulatedEntity' => collect([
Vulnerability::class,
[
Vulnerability::ID_FROM_SCANNER => null,
Vulnerability::NAME => null,
Vulnerability::FILE => null,
],
Asset::class,
]),
]),
'netsparker' => 'flushDoctrineUnitOfWork',
]);
}
/**
* Extract the VulnerabilityReferenceCodes and add them to the parent Vulnerability entity
*/
protected function extractVulnerabilityReferences()
{
// Iterate until we hit the ending classification tag
do {
$this->parser->read();
if ($this->parser->nodeType !== XMLReader::ELEMENT) {
continue;
}
// Create and populate a new VulnerabilityReferenceCode entity
$this->initialiseNewEntity(VulnerabilityReferenceCode::class);
$this->entities->get(VulnerabilityReferenceCode::class)
->setReferenceType($this->parser->name)
->setValue($this->parser->readInnerXml());
// Add the populated VulnerabilityReferenceCode entity to the parent Vulnerability, but don't persist. They
// will be persisted by a cascade persist operation when the parent Vulnerability is persisted
$this->persistPopulatedEntity(
VulnerabilityReferenceCode::class,
[
VulnerabilityReferenceCode::REFERENCE_TYPE => null,
VulnerabilityReferenceCode::VALUE => null
],
Vulnerability::class,
false,
false
);
} while ($this->parser->name != 'classification');
}
/**
* @inheritdoc
* @return string
*/
protected function getBaseTagName()
{
return 'netsparker';
}
/**
* @inheritdoc
* @return string
*/
public function getStoragePath(): string
{
return storage_path('scans/xml/netsparker');
}
/**
* @inheritdoc
*/
public function getLogFilename(): string
{
return 'netsparker-xml-parser.json.log';
}
} | {
"content_hash": "92c45836d6540e6d566eea70cab5419d",
"timestamp": "",
"source": "github",
"line_count": 233,
"max_line_length": 119,
"avg_line_length": 37.14592274678112,
"alnum_prop": 0.5080300404390525,
"repo_name": "Ruggedy-Limited/ruggedy-vma",
"id": "a18c038a19b9595297967ce28bd17fde6142ee16",
"size": "8655",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/Services/Parsers/NetsparkerXmlParserService.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Dockerfile",
"bytes": "4027"
},
{
"name": "Gherkin",
"bytes": "244"
},
{
"name": "HTML",
"bytes": "123087"
},
{
"name": "JavaScript",
"bytes": "16943"
},
{
"name": "PHP",
"bytes": "988175"
},
{
"name": "Shell",
"bytes": "424"
},
{
"name": "Vue",
"bytes": "563"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>{{ $playlist->title }}</title>
<!-- Bootstrap -->
<link href="/css/bootstrap/bootstrap.min.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for 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.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
@if($alert)
<div class="alert alert-info alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<strong>Heads-up!</strong> You are looking at a password protected playlist.
</div>
@endif
<div class="page-header">
<h1>Example page header <small>Subtext for header</small></h1>
</div>
<div class="container-fluid">
...
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
</body>
</html> | {
"content_hash": "6449b9136bd3727bf5d0a52ac4558740",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 136,
"avg_line_length": 40.945945945945944,
"alnum_prop": 0.633003300330033,
"repo_name": "jonjonus/videogallery",
"id": "6d306291576b57c3821fa00774a8d06ac0b1ff79",
"size": "1515",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "resources/views/player/_index.blade.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "835979"
},
{
"name": "HTML",
"bytes": "87185"
},
{
"name": "JavaScript",
"bytes": "5398300"
},
{
"name": "PHP",
"bytes": "174308"
}
],
"symlink_target": ""
} |
#include "TintinCDKCameraFactory.h"
#include <Logger.h>
#include "TintinCDKCamera.h"
#include "TintinCDKCameraUVC.h"
#include "SymbolExports.h"
namespace Voxel
{
namespace TI
{
TintinCDKCameraFactory::TintinCDKCameraFactory(const String &name): ToFCameraFactoryBase(name)
{
_addSupportedDevices({
DevicePtr(new USBDevice(TINTIN_CDK_VENDOR_ID, TINTIN_CDK_PRODUCT_BULK, "")),
DevicePtr(new USBDevice(TINTIN_CDK_VENDOR_ID, TINTIN_CDK_PRODUCT_UVC, "")),
});
}
DepthCameraPtr TintinCDKCameraFactory::getDepthCamera(DevicePtr device)
{
if(device->interfaceID() == Device::USB)
{
USBDevice &d = (USBDevice &)*device;
if(d.vendorID() == TINTIN_CDK_VENDOR_ID &&
(d.productID() == TINTIN_CDK_PRODUCT_BULK))
return DepthCameraPtr(new TintinCDKCamera(device));
if (d.vendorID() == TINTIN_CDK_VENDOR_ID &&
(d.productID() == TINTIN_CDK_PRODUCT_UVC))
return DepthCameraPtr(new TintinCDKCameraUVC(device));
}
return 0;
}
extern "C" void SYMBOL_EXPORT getDepthCameraFactory(DepthCameraFactoryPtr &ptr)
{
ptr = DepthCameraFactoryPtr(new TintinCDKCameraFactory("TintinCDK"));
}
extern "C" int SYMBOL_EXPORT getABIVersion()
{
return VOXEL_ABI_VERSION; // Return the Voxel ABI version which was used to compile this DepthCameraFactory
}
}
}
| {
"content_hash": "f4604211d8301c5a63926f83af041050",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 109,
"avg_line_length": 23.392857142857142,
"alnum_prop": 0.7145038167938931,
"repo_name": "3dtof/voxelsdk",
"id": "0cbf7767c960cd9e731d5714014aeaff79c05351",
"size": "1391",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "TI3DToF/boards/TintinCDK/TintinCDKCameraFactory.cpp",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "563"
},
{
"name": "C++",
"bytes": "1377616"
},
{
"name": "CMake",
"bytes": "38392"
},
{
"name": "Python",
"bytes": "3601"
},
{
"name": "Shell",
"bytes": "5649"
}
],
"symlink_target": ""
} |
package ts
import (
"bytes"
"fmt"
"math"
"reflect"
"sync"
"testing"
"time"
"golang.org/x/net/context"
"github.com/cockroachdb/cockroach/pkg/keys"
"github.com/cockroachdb/cockroach/pkg/kv"
"github.com/cockroachdb/cockroach/pkg/roachpb"
"github.com/cockroachdb/cockroach/pkg/storage/engine"
"github.com/cockroachdb/cockroach/pkg/testutils"
"github.com/cockroachdb/cockroach/pkg/testutils/localtestcluster"
"github.com/cockroachdb/cockroach/pkg/ts/tspb"
"github.com/cockroachdb/cockroach/pkg/util/hlc"
"github.com/cockroachdb/cockroach/pkg/util/leaktest"
"github.com/cockroachdb/cockroach/pkg/util/log"
"github.com/cockroachdb/cockroach/pkg/util/stop"
"github.com/cockroachdb/cockroach/pkg/util/tracing"
"github.com/gogo/protobuf/proto"
)
// testModel is a model-based testing structure used to verify that time
// series data sent to the Cockroach time series DB is stored correctly.
//
// This structure maintains a single ts.DB instance which stores data in a
// monolithic Cockroach Store. It additionally maintains a simple in-memory key
// value map, which is used as a model of the time series data stored in
// Cockroach. The model maintains an expected copy of all keys beginning with
// the time series data prefix.
//
// Each test should send a series of commands to the testModel. Commands are
// dispatched to the ts.DB instance, but are also used to modify the
// in-memory key value model. Tests should periodically compare the in-memory
// model to the actual data stored in the cockroach engine, ensuring that the
// data matches.
type testModel struct {
t testing.TB
modelData map[string]roachpb.Value
seenSources map[string]struct{}
*localtestcluster.LocalTestCluster
DB *DB
}
// newTestModel creates a new testModel instance. The Start() method must
// be called before using it.
func newTestModel(t *testing.T) testModel {
return testModel{
t: t,
modelData: make(map[string]roachpb.Value),
seenSources: make(map[string]struct{}),
LocalTestCluster: &localtestcluster.LocalTestCluster{},
}
}
// Start constructs and starts the local test server and creates a
// time series DB.
func (tm *testModel) Start() {
tm.LocalTestCluster.Start(tm.t, testutils.NewNodeTestBaseContext(),
kv.InitSenderForLocalTestCluster)
tm.DB = NewDB(tm.LocalTestCluster.DB)
}
// getActualData returns the actual value of all time series keys in the
// underlying engine. Data is returned as a map of strings to roachpb.Values.
func (tm *testModel) getActualData() map[string]roachpb.Value {
// Scan over all TS Keys stored in the engine
startKey := keys.TimeseriesPrefix
endKey := startKey.PrefixEnd()
keyValues, _, _, err := engine.MVCCScan(context.Background(), tm.Eng, startKey, endKey, math.MaxInt64, tm.Clock.Now(), true, nil)
if err != nil {
tm.t.Fatalf("error scanning TS data from engine: %s", err.Error())
}
kvMap := make(map[string]roachpb.Value)
for _, kv := range keyValues {
kvMap[string(kv.Key)] = kv.Value
}
return kvMap
}
// assertModelCorrect asserts that the model data being maintained by this
// testModel is equivalent to the actual time series data stored in the
// engine. If the actual data does not match the model, this method will print
// out detailed information about the differences between the two data sets.
func (tm *testModel) assertModelCorrect() {
actualData := tm.getActualData()
if !reflect.DeepEqual(tm.modelData, actualData) {
// Provide a detailed differencing of the actual data and the expected
// model. This is done by comparing individual keys, and printing human
// readable information about any keys which differ in value between the
// two data sets.
var buf bytes.Buffer
buf.WriteString("Found unexpected differences in model data and actual data:\n")
for k, vActual := range actualData {
n, s, r, ts, err := DecodeDataKey([]byte(k))
if err != nil {
tm.t.Fatal(err)
}
if vModel, ok := tm.modelData[k]; !ok {
fmt.Fprintf(&buf, "\nKey %s/%s@%d, r:%d from actual data was not found in model", n, s, ts, r)
} else {
if !proto.Equal(&vActual, &vModel) {
fmt.Fprintf(&buf, "\nKey %s/%s@%d, r:%d differs between model and actual:", n, s, ts, r)
if its, err := vActual.GetTimeseries(); err != nil {
fmt.Fprintf(&buf, "\nActual value is not a valid time series: %v", vActual)
} else {
fmt.Fprintf(&buf, "\nActual value: %s", &its)
}
if its, err := vModel.GetTimeseries(); err != nil {
fmt.Fprintf(&buf, "\nModel value is not a valid time series: %v", vModel)
} else {
fmt.Fprintf(&buf, "\nModel value: %s", &its)
}
}
}
}
// Detect keys in model which were not present in the actual data.
for k := range tm.modelData {
n, s, r, ts, err := DecodeDataKey([]byte(k))
if err != nil {
tm.t.Fatal(err)
}
if _, ok := actualData[k]; !ok {
fmt.Fprintf(&buf, "Key %s/%s@%d, r:%d from model was not found in actual data", n, s, ts, r)
}
}
tm.t.Fatal(buf.String())
}
}
// assertKeyCount asserts that the model contains the expected number of keys.
// This is used to ensure that data is actually being generated in the test
// model.
func (tm *testModel) assertKeyCount(expected int) {
if a, e := len(tm.modelData), expected; a != e {
tm.t.Errorf("model data key count did not match expected value: %d != %d", a, e)
}
}
func (tm *testModel) storeInModel(r Resolution, data tspb.TimeSeriesData) {
// Note the source, used to construct keys for model queries.
tm.seenSources[data.Source] = struct{}{}
// Process and store data in the model.
internalData, err := data.ToInternal(r.SlabDuration(), r.SampleDuration())
if err != nil {
tm.t.Fatalf("test could not convert time series to internal format: %s", err.Error())
}
for _, idata := range internalData {
key := MakeDataKey(data.Name, data.Source, r, idata.StartTimestampNanos)
keyStr := string(key)
existing, ok := tm.modelData[keyStr]
var newTs roachpb.InternalTimeSeriesData
if ok {
existingTs, err := existing.GetTimeseries()
if err != nil {
tm.t.Fatalf("test could not extract time series from existing model value: %s", err.Error())
}
newTs, err = engine.MergeInternalTimeSeriesData(existingTs, idata)
if err != nil {
tm.t.Fatalf("test could not merge time series into model value: %s", err.Error())
}
} else {
newTs, err = engine.MergeInternalTimeSeriesData(idata)
if err != nil {
tm.t.Fatalf("test could not merge time series into model value: %s", err.Error())
}
}
var val roachpb.Value
if err := val.SetProto(&newTs); err != nil {
tm.t.Fatal(err)
}
tm.modelData[keyStr] = val
}
}
// storeTimeSeriesData instructs the model to store the given time series data
// in both the model and the system under test.
func (tm *testModel) storeTimeSeriesData(r Resolution, data []tspb.TimeSeriesData) {
// Store data in the system under test.
if err := tm.DB.StoreData(context.TODO(), r, data); err != nil {
tm.t.Fatalf("error storing time series data: %s", err.Error())
}
// Store data in the model.
for _, d := range data {
tm.storeInModel(r, d)
}
}
// prune time series from the model. "nowNanos" represents the current time,
// and is used to compute threshold ages. Only time series in the provided list
// of time series/resolution pairs will be considered for deletion.
func (tm *testModel) prune(nowNanos int64, timeSeries ...timeSeriesResolutionInfo) {
// Prune time series from the system under test.
if err := pruneTimeSeries(
context.TODO(),
tm.LocalTestCluster.DB,
timeSeries,
hlc.Timestamp{
WallTime: nowNanos,
Logical: 0,
},
); err != nil {
tm.t.Fatalf("error pruning time series data: %s", err)
}
// Prune data from the model.
thresholds := computeThresholds(nowNanos)
for k := range tm.modelData {
name, _, res, ts, err := DecodeDataKey(roachpb.Key(k))
if err != nil {
tm.t.Fatalf("corrupt key %s found in model data, error: %s", k, err)
}
for _, tsr := range timeSeries {
threshold, ok := thresholds[res]
if !ok {
threshold = nowNanos
}
if name == tsr.Name && res == tsr.Resolution && ts < threshold {
delete(tm.modelData, k)
}
}
}
}
// modelDataSource is used to create a mock DataSource. It returns a
// deterministic set of data to GetTimeSeriesData, storing the returned data in
// the model whenever GetTimeSeriesData is called. Data is returned until all
// sets are exhausted, at which point the supplied stop.Stopper is stopped.
type modelDataSource struct {
model testModel
datasets [][]tspb.TimeSeriesData
r Resolution
stopper *stop.Stopper
calledCount int
once sync.Once
}
// GetTimeSeriesData implements the DataSource interface, returning a predefined
// set of TimeSeriesData to subsequent calls. It stores each TimeSeriesData
// object in the test model before returning it. If all TimeSeriesData objects
// have been returned, this method will stop the provided Stopper.
func (mds *modelDataSource) GetTimeSeriesData() []tspb.TimeSeriesData {
if len(mds.datasets) == 0 {
// Stop on goroutine to prevent deadlock.
go mds.once.Do(func() { mds.stopper.Stop(context.Background()) })
return nil
}
mds.calledCount++
data := mds.datasets[0]
mds.datasets = mds.datasets[1:]
for _, d := range data {
mds.model.storeInModel(mds.r, d)
}
return data
}
// datapoint quickly generates a time series datapoint.
func datapoint(timestamp int64, val float64) tspb.TimeSeriesDatapoint {
return tspb.TimeSeriesDatapoint{
TimestampNanos: timestamp,
Value: val,
}
}
// TestStoreTimeSeries is a simple test of the Time Series module, ensuring that
// it is storing time series correctly.
func TestStoreTimeSeries(t *testing.T) {
defer leaktest.AfterTest(t)()
tm := newTestModel(t)
tm.Start()
defer tm.Stop()
// Basic storage operation: one data point.
tm.storeTimeSeriesData(Resolution10s, []tspb.TimeSeriesData{
{
Name: "test.metric",
Datapoints: []tspb.TimeSeriesDatapoint{
datapoint(-446061360000000000, 100),
},
},
})
tm.assertKeyCount(1)
tm.assertModelCorrect()
// Store data with different sources, and with multiple data points that
// aggregate into the same key.
tm.storeTimeSeriesData(Resolution10s, []tspb.TimeSeriesData{
{
Name: "test.metric.float",
Source: "cpu01",
Datapoints: []tspb.TimeSeriesDatapoint{
datapoint(1428713843000000000, 100.0),
datapoint(1428713843000000001, 50.2),
datapoint(1428713843000000002, 90.9),
},
},
})
tm.storeTimeSeriesData(Resolution10s, []tspb.TimeSeriesData{
{
Name: "test.metric.float",
Source: "cpu02",
Datapoints: []tspb.TimeSeriesDatapoint{
datapoint(1428713843000000000, 900.8),
datapoint(1428713843000000001, 30.12),
datapoint(1428713843000000002, 72.324),
},
},
})
tm.assertKeyCount(3)
tm.assertModelCorrect()
// A single storage operation that stores to multiple keys, including an
// existing key.
tm.storeTimeSeriesData(Resolution10s, []tspb.TimeSeriesData{
{
Name: "test.metric",
Datapoints: []tspb.TimeSeriesDatapoint{
datapoint(-446061360000000001, 200),
datapoint(450000000000000000, 1),
datapoint(460000000000000000, 777),
},
},
})
tm.assertKeyCount(5)
tm.assertModelCorrect()
}
// TestPollSource verifies that polled data sources are called as expected.
func TestPollSource(t *testing.T) {
defer leaktest.AfterTest(t)()
tm := newTestModel(t)
tm.Start()
defer tm.Stop()
testSource := modelDataSource{
model: tm,
r: Resolution10s,
stopper: stop.NewStopper(),
datasets: [][]tspb.TimeSeriesData{
{
{
Name: "test.metric.float",
Source: "cpu01",
Datapoints: []tspb.TimeSeriesDatapoint{
datapoint(1428713843000000000, 100.0),
datapoint(1428713843000000001, 50.2),
datapoint(1428713843000000002, 90.9),
},
},
{
Name: "test.metric.float",
Source: "cpu02",
Datapoints: []tspb.TimeSeriesDatapoint{
datapoint(1428713843000000000, 900.8),
datapoint(1428713843000000001, 30.12),
datapoint(1428713843000000002, 72.324),
},
},
},
{
{
Name: "test.metric",
Datapoints: []tspb.TimeSeriesDatapoint{
datapoint(-446061360000000000, 100),
},
},
},
},
}
ambient := log.AmbientContext{Tracer: tracing.NewTracer()}
tm.DB.PollSource(ambient, &testSource, time.Millisecond, Resolution10s, testSource.stopper)
<-testSource.stopper.IsStopped()
if a, e := testSource.calledCount, 2; a != e {
t.Errorf("testSource was called %d times, expected %d", a, e)
}
tm.assertKeyCount(3)
tm.assertModelCorrect()
}
| {
"content_hash": "cebb730f975ac479ec5604e07879c3fd",
"timestamp": "",
"source": "github",
"line_count": 394,
"max_line_length": 130,
"avg_line_length": 32.22081218274111,
"alnum_prop": 0.6976762504923198,
"repo_name": "nvanbenschoten/epaxos",
"id": "6f042a1b17c20775fea74cd41db3c5d949a61a03",
"size": "13345",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "vendor/github.com/cockroachdb/cockroach/pkg/ts/db_test.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Go",
"bytes": "85764"
},
{
"name": "Makefile",
"bytes": "1079"
}
],
"symlink_target": ""
} |
<?php
namespace Drupal\workflows\Form;
use Drupal\Component\Plugin\PluginManagerInterface;
use Drupal\workflows\Entity\Workflow;
use Drupal\Core\Entity\EntityForm;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Form for adding workflows.
*
* @internal
*/
class WorkflowAddForm extends EntityForm {
/**
* The workflow type plugin manager.
*
* @var \Drupal\Component\Plugin\PluginManagerInterface
*/
protected $workflowTypePluginManager;
/**
* WorkflowAddForm constructor.
*
* @param \Drupal\Component\Plugin\PluginManagerInterface $workflow_type_plugin_manager
* The workflow type plugin manager.
*/
public function __construct(PluginManagerInterface $workflow_type_plugin_manager) {
$this->workflowTypePluginManager = $workflow_type_plugin_manager;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('plugin.manager.workflows.type')
);
}
/**
* {@inheritdoc}
*/
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
/** @var \Drupal\workflows\WorkflowInterface $workflow */
$workflow = $this->entity;
$form['label'] = [
'#type' => 'textfield',
'#title' => $this->t('Label'),
'#maxlength' => 255,
'#default_value' => $workflow->label(),
'#required' => TRUE,
];
$form['id'] = [
'#type' => 'machine_name',
'#default_value' => $workflow->id(),
'#machine_name' => [
'exists' => [Workflow::class, 'load'],
],
];
$workflow_types = array_column($this->workflowTypePluginManager->getDefinitions(), 'label', 'id');
$form['workflow_type'] = [
'#type' => 'select',
'#title' => $this->t('Workflow type'),
'#required' => TRUE,
'#options' => $workflow_types,
];
return $form;
}
/**
* {@inheritdoc}
*/
public function save(array $form, FormStateInterface $form_state) {
/** @var \Drupal\workflows\WorkflowInterface $workflow */
$workflow = $this->entity;
$return = $workflow->save();
if (empty($workflow->getTypePlugin()->getStates())) {
$this->messenger()->addStatus($this->t('Created the %label Workflow. In order for the workflow to be enabled there needs to be at least one state.', [
'%label' => $workflow->label(),
]));
$form_state->setRedirectUrl($workflow->toUrl('add-state-form'));
}
else {
$this->messenger()->addStatus($this->t('Created the %label Workflow.', [
'%label' => $workflow->label(),
]));
$form_state->setRedirectUrl($workflow->toUrl('edit-form'));
}
return $return;
}
/**
* {@inheritdoc}
*/
protected function copyFormValuesToEntity(EntityInterface $entity, array $form, FormStateInterface $form_state) {
// This form can only set the workflow's ID, label and the weights for each
// state.
/** @var \Drupal\workflows\WorkflowInterface $entity */
$values = $form_state->getValues();
$entity->set('label', $values['label']);
$entity->set('id', $values['id']);
$entity->set('type', $values['workflow_type']);
}
}
| {
"content_hash": "db22309b07fbaf84e02cc34dd8742bdc",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 156,
"avg_line_length": 28.551724137931036,
"alnum_prop": 0.6271135265700483,
"repo_name": "electric-eloquence/fepper-drupal",
"id": "3c29aa95684a1f0767d293dcad6e266336758962",
"size": "3312",
"binary": false,
"copies": "10",
"ref": "refs/heads/dev",
"path": "backend/drupal/core/modules/workflows/src/Form/WorkflowAddForm.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2300765"
},
{
"name": "HTML",
"bytes": "68444"
},
{
"name": "JavaScript",
"bytes": "2453602"
},
{
"name": "Mustache",
"bytes": "40698"
},
{
"name": "PHP",
"bytes": "41684915"
},
{
"name": "PowerShell",
"bytes": "755"
},
{
"name": "Shell",
"bytes": "72896"
},
{
"name": "Stylus",
"bytes": "32803"
},
{
"name": "Twig",
"bytes": "1820730"
},
{
"name": "VBScript",
"bytes": "466"
}
],
"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_18) on Thu Dec 18 17:18:41 PST 2014 -->
<title>Uses of Class javax.xml.bind.annotation.XmlEnumValue (Java Platform SE 7 )</title>
<meta name="date" content="2014-12-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 javax.xml.bind.annotation.XmlEnumValue (Java Platform SE 7 )";
}
//-->
</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="../../../../../javax/xml/bind/annotation/XmlEnumValue.html" title="annotation in javax.xml.bind.annotation">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-files/index-1.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><em><strong>Java™ Platform<br>Standard Ed. 7</strong></em></div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?javax/xml/bind/annotation/class-use/XmlEnumValue.html" target="_top">Frames</a></li>
<li><a href="XmlEnumValue.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 javax.xml.bind.annotation.XmlEnumValue" class="title">Uses of Class<br>javax.xml.bind.annotation.XmlEnumValue</h2>
</div>
<div class="classUseContainer">No usage of javax.xml.bind.annotation.XmlEnumValue</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="../../../../../javax/xml/bind/annotation/XmlEnumValue.html" title="annotation in javax.xml.bind.annotation">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-files/index-1.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><em><strong>Java™ Platform<br>Standard Ed. 7</strong></em></div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?javax/xml/bind/annotation/class-use/XmlEnumValue.html" target="_top">Frames</a></li>
<li><a href="XmlEnumValue.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small><font size="-1"> <a href="http://bugreport.sun.com/bugreport/">Submit a bug or feature</a> <br>For further API reference and developer documentation, see <a href="http://docs.oracle.com/javase/7/docs/index.html" target="_blank">Java SE Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.<br> <a href="../../../../../../legal/cpyr.html">Copyright</a> © 1993, 2015, Oracle and/or its affiliates. All rights reserved. </font></small></p>
</body>
</html>
| {
"content_hash": "8cce3f8ddbcaa32b0260d5117ac9e352",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 602,
"avg_line_length": 42.76271186440678,
"alnum_prop": 0.6341656757827983,
"repo_name": "fbiville/annotation-processing-ftw",
"id": "30fcfc4255fe8a86f9bb7675c74649a541088636",
"size": "5046",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "doc/java/jdk7/javax/xml/bind/annotation/class-use/XmlEnumValue.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "191178"
},
{
"name": "HTML",
"bytes": "63904"
},
{
"name": "Java",
"bytes": "107042"
},
{
"name": "JavaScript",
"bytes": "246677"
}
],
"symlink_target": ""
} |
<?php
namespace Email;
interface Driver {
public function onInit($options);
public function onSend(Envelope $envelope);
}
| {
"content_hash": "3ab4699e5e8eeb7b9734d398ac983e38",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 45,
"avg_line_length": 13,
"alnum_prop": 0.7307692307692307,
"repo_name": "lastguest/core",
"id": "489b470758e431879298cfefe8544819c7ab2a8b",
"size": "309",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "classes/Email/Driver.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "249720"
}
],
"symlink_target": ""
} |
package com.alapshin.arctor.presenter;
import android.os.Bundle;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import static org.assertj.core.api.Assertions.*;
@RunWith(RobolectricTestRunner.class)
public class PresenterBundleUtilTest {
@Test
public void checkBundleInteraction() {
Bundle outState = new Bundle();
PresenterBundle presenterBundle = new PresenterBundle();
presenterBundle.putString("foo", "bar");
PresenterBundleUtil.setPresenterBundle(outState, presenterBundle);
PresenterBundle presenterBundle1 = PresenterBundleUtil.getPresenterBundle(outState);
assertThat(presenterBundle1.getString("foo")).isEqualTo("bar");
}
}
| {
"content_hash": "f8ae47e87fb102a5dd70b6027d9b7439",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 92,
"avg_line_length": 35.76190476190476,
"alnum_prop": 0.7576564580559254,
"repo_name": "alapshin/arctor",
"id": "bf3991b942248e8d95b0479becd2fd61c4f020ce",
"size": "751",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "arctor-base/src/test/java/com/alapshin/arctor/presenter/PresenterBundleUtilTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "118872"
},
{
"name": "Kotlin",
"bytes": "3759"
},
{
"name": "Shell",
"bytes": "84"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<!--
Copyright 2016 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<link rel="import" href="/tracing/core/test_utils.html">
<link rel="import" href="/tracing/value/diagnostics/diagnostic_map.html">
<link rel="import" href="/tracing/value/histogram_set.html">
<script>
'use strict';
tr.b.unittest.testSuite(function() {
test('clone', function() {
const diagnostics = new tr.v.d.DiagnosticMap();
diagnostics.set('generic', new tr.v.d.GenericSet([{a: ['b', 3]}]));
diagnostics.set('breakdown', new tr.v.d.Breakdown());
diagnostics.set('events', new tr.v.d.RelatedEventSet());
diagnostics.set('set', new tr.v.d.RelatedHistogramSet());
diagnostics.set('map', new tr.v.d.RelatedHistogramMap());
diagnostics.set('histogram breakdown',
new tr.v.d.RelatedHistogramBreakdown());
const clone = tr.v.d.DiagnosticMap.fromDict(diagnostics.asDict());
assert.instanceOf(clone.get('generic'), tr.v.d.GenericSet);
assert.deepEqual(tr.b.getOnlyElement(clone.get('generic')),
tr.b.getOnlyElement(diagnostics.get('generic')));
assert.instanceOf(clone.get('breakdown'), tr.v.d.Breakdown);
assert.instanceOf(clone.get('events'), tr.v.d.RelatedEventSet);
assert.instanceOf(clone.get('set'), tr.v.d.RelatedHistogramSet);
assert.instanceOf(clone.get('map'), tr.v.d.RelatedHistogramMap);
assert.instanceOf(clone.get('histogram breakdown'),
tr.v.d.RelatedHistogramBreakdown);
});
test('cloneWithRef', function() {
const diagnostics = new tr.v.d.DiagnosticMap();
diagnostics.set('ref', new tr.v.d.DiagnosticRef('abc'));
const clone = tr.v.d.DiagnosticMap.fromDict(diagnostics.asDict());
assert.instanceOf(clone.get('ref'), tr.v.d.DiagnosticRef);
assert.strictEqual(clone.get('ref').guid, 'abc');
});
test('requireFromDict', function() {
class MissingFromDict extends tr.v.d.Diagnostic { }
assert.throws(() => tr.v.d.Diagnostic.register(MissingFromDict));
class InvalidFromDict extends tr.v.d.Diagnostic {
static fromDict() {
}
}
assert.throws(() => tr.v.d.Diagnostic.register(InvalidFromDict));
});
test('merge', function() {
const event = tr.c.TestUtils.newSliceEx({
title: 'event',
start: 0,
duration: 1,
});
event.parentContainer = {
sliceGroup: {
stableId: 'fake_thread',
slices: [event],
},
};
const generic = new tr.v.d.GenericSet(['generic diagnostic']);
const generic2 = new tr.v.d.GenericSet(['generic diagnostic 2']);
const relatedSet = new tr.v.d.RelatedHistogramSet();
const events = new tr.v.d.RelatedEventSet([event]);
// When Histograms are merged, first an empty clone is created with an empty
// DiagnosticMap.
const hist = new tr.v.Histogram('', tr.b.Unit.byName.count);
const hist2 = new tr.v.Histogram('', tr.b.Unit.byName.count);
hist2.diagnostics.set('a', generic);
hist.diagnostics.addDiagnostics(hist2.diagnostics);
assert.strictEqual(tr.b.getOnlyElement(generic),
tr.b.getOnlyElement(hist.diagnostics.get('a')));
// Separate keys are not merged.
const hist3 = new tr.v.Histogram('', tr.b.Unit.byName.count);
hist3.diagnostics.set('b', generic2);
hist.diagnostics.addDiagnostics(hist3.diagnostics);
assert.strictEqual(
tr.b.getOnlyElement(generic),
tr.b.getOnlyElement(hist.diagnostics.get('a')));
assert.strictEqual(
tr.b.getOnlyElement(generic2),
tr.b.getOnlyElement(hist.diagnostics.get('b')));
// Merging unmergeable diagnostics should produce an
// UnmergeableDiagnosticSet.
const hist4 = new tr.v.Histogram('', tr.b.Unit.byName.count);
hist4.diagnostics.set('a', relatedSet);
hist.diagnostics.addDiagnostics(hist4.diagnostics);
assert.instanceOf(hist.diagnostics.get('a'),
tr.v.d.UnmergeableDiagnosticSet);
let diagnostics = Array.from(hist.diagnostics.get('a'));
assert.strictEqual(
tr.b.getOnlyElement(generic), tr.b.getOnlyElement(diagnostics[0]));
// Don't test merging relationships here.
assert.instanceOf(diagnostics[1], tr.v.d.RelatedHistogramSet);
// UnmergeableDiagnosticSets are mergeable.
const hist5 = new tr.v.Histogram('', tr.b.Unit.byName.count);
hist5.diagnostics.set('a', new tr.v.d.UnmergeableDiagnosticSet([
events, generic2]));
hist.diagnostics.addDiagnostics(hist5.diagnostics);
assert.instanceOf(hist.diagnostics.get('a'),
tr.v.d.UnmergeableDiagnosticSet);
diagnostics = Array.from(hist.diagnostics.get('a'));
assert.lengthOf(diagnostics, 3);
assert.instanceOf(diagnostics[0], tr.v.d.GenericSet);
assert.deepEqual(Array.from(diagnostics[0]), [...generic, ...generic2]);
assert.instanceOf(diagnostics[1], tr.v.d.RelatedHistogramSet);
assert.instanceOf(diagnostics[2], tr.v.d.CollectedRelatedEventSet);
});
test('mergeRelationships', function() {
const aHist0 = new tr.v.Histogram('a', tr.b.Unit.byName.count);
const bHist0 = new tr.v.Histogram('b', tr.b.Unit.byName.count);
aHist0.diagnostics.set('set', new tr.v.d.RelatedHistogramSet([bHist0]));
let map = new tr.v.d.RelatedHistogramMap();
map.set('c', bHist0);
aHist0.diagnostics.set('map', map);
let breakdown = new tr.v.d.RelatedHistogramBreakdown();
breakdown.set('d', bHist0);
aHist0.diagnostics.set('breakdown', breakdown);
aHist0.diagnostics.set('unmergeable',
new tr.v.d.GenericSet(['unmergeable']));
const histograms0 = new tr.v.HistogramSet([aHist0, bHist0]);
histograms0.addSharedDiagnostic(
tr.v.d.RESERVED_NAMES.LABELS, new tr.v.d.GenericSet(['0']));
const aHist1 = new tr.v.Histogram('a', tr.b.Unit.byName.count);
const bHist1 = new tr.v.Histogram('b', tr.b.Unit.byName.count);
aHist1.diagnostics.set('set', new tr.v.d.RelatedHistogramSet([bHist1]));
map = new tr.v.d.RelatedHistogramMap();
map.set('c', bHist1);
aHist1.diagnostics.set('map', map);
breakdown = new tr.v.d.RelatedHistogramBreakdown();
breakdown.set('d', bHist1);
aHist1.diagnostics.set('breakdown', breakdown);
aHist1.diagnostics.set('unmergeable', new tr.v.d.RelatedHistogramSet(
[bHist1]));
const histograms1 = new tr.v.HistogramSet([aHist1, bHist1]);
histograms1.addSharedDiagnostic(
tr.v.d.RESERVED_NAMES.LABELS, new tr.v.d.GenericSet(['1']));
const aMergedHist = aHist0.clone();
aMergedHist.addHistogram(aHist1);
new tr.v.d.GroupingPath([]).addToHistogram(aMergedHist);
const bMergedHist = bHist0.clone();
bMergedHist.addHistogram(bHist1);
new tr.v.d.GroupingPath([]).addToHistogram(bMergedHist);
const mergedHists = new tr.v.HistogramSet([aMergedHist, bMergedHist]);
mergedHists.deduplicateDiagnostics();
aMergedHist.diagnostics.mergeRelationships(aMergedHist);
bMergedHist.diagnostics.mergeRelationships(bMergedHist);
const aMergedSet = aMergedHist.diagnostics.get('set');
assert.instanceOf(aMergedSet, tr.v.d.RelatedHistogramSet);
assert.strictEqual(bMergedHist, tr.b.getOnlyElement(aMergedSet));
const aMergedMap = aMergedHist.diagnostics.get('map');
assert.instanceOf(aMergedMap, tr.v.d.RelatedHistogramMap);
assert.lengthOf(aMergedMap, 1);
assert.strictEqual(bMergedHist, aMergedMap.get('c'));
const aMergedBreakdown = aMergedHist.diagnostics.get('breakdown');
assert.instanceOf(aMergedBreakdown, tr.v.d.RelatedHistogramBreakdown);
assert.lengthOf(aMergedBreakdown, 1);
assert.strictEqual(bMergedHist, aMergedBreakdown.get('d'));
const aMergedUnmergeable = aMergedHist.diagnostics.get('unmergeable');
assert.instanceOf(aMergedUnmergeable, tr.v.d.UnmergeableDiagnosticSet);
});
test('validateDiagnosticTypes', function() {
const hist = new tr.v.Histogram('', tr.b.Unit.byName.count);
function addInvalidDiagnosticType() {
hist.diagnostics.set(
tr.v.d.RESERVED_NAMES.GROUPING_PATH, new tr.v.d.GenericSet());
}
assert.throw(addInvalidDiagnosticType, Error,
'Diagnostics named "grouping path" must be GroupingPath, not ' +
'GenericSet');
});
});
</script>
| {
"content_hash": "c9239741326901eb90243f2ab2dd4fe8",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 80,
"avg_line_length": 40.55882352941177,
"alnum_prop": 0.6915639352187576,
"repo_name": "catapult-project/catapult-csm",
"id": "60f3af3ce98ae3563827eddc0a64194ae4d97405",
"size": "8274",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tracing/tracing/value/diagnostics/diagnostic_map_test.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "4902"
},
{
"name": "C++",
"bytes": "43728"
},
{
"name": "CSS",
"bytes": "24873"
},
{
"name": "Go",
"bytes": "80325"
},
{
"name": "HTML",
"bytes": "11817766"
},
{
"name": "JavaScript",
"bytes": "518002"
},
{
"name": "Makefile",
"bytes": "1588"
},
{
"name": "Python",
"bytes": "6207634"
},
{
"name": "Shell",
"bytes": "2558"
}
],
"symlink_target": ""
} |
<?php
namespace CommerceGuys\AuthNet\DataTypes;
class Sorting extends BaseDataType
{
protected $propertyMap = [
'orderBy',
'orderDescending',
];
public function __construct(array $values = [])
{
$this->validate($values);
foreach ($values as $name => $value) {
$this->$name = $value;
if ($name == 'orderDescending') {
$this->$name = filter_var($value, FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false';
}
}
}
}
| {
"content_hash": "93de5d25e93648b6e6ce54b0954731a3",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 94,
"avg_line_length": 22.608695652173914,
"alnum_prop": 0.5288461538461539,
"repo_name": "commerceguys/authnet",
"id": "0b57326154976b0d4d12e6c27f772b93db5bbf0a",
"size": "520",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/DataTypes/Sorting.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "101321"
}
],
"symlink_target": ""
} |
class Comment < ActiveRecord::Base
belongs_to :user
belongs_to :item
end
| {
"content_hash": "adf09d6e819fed70d69dce94247893b2",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 34,
"avg_line_length": 19.25,
"alnum_prop": 0.7402597402597403,
"repo_name": "tingtingchiang/rorHW",
"id": "d1c12342d01b25991d234661259b882b0a222cf1",
"size": "77",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "UCUtrade/app/models/comment.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1724"
},
{
"name": "CoffeeScript",
"bytes": "422"
},
{
"name": "HTML",
"bytes": "9776"
},
{
"name": "JavaScript",
"bytes": "1334"
},
{
"name": "Puppet",
"bytes": "3987"
},
{
"name": "Ruby",
"bytes": "60680"
},
{
"name": "Shell",
"bytes": "1916"
}
],
"symlink_target": ""
} |
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.42000
//
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Demo.Properties {
using System;
/// <summary>
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
/// </summary>
// Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Demo.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
/// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}
| {
"content_hash": "10f038f358b060453bb1879995acea23",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 170,
"avg_line_length": 47.3968253968254,
"alnum_prop": 0.6356329537843268,
"repo_name": "ptv-logistics/SharpMap.Ptv",
"id": "0b8fdd0ba41cdd531dbdafbeaf4a2a4b7470eb7b",
"size": "2996",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Demo/Properties/Resources.Designer.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "359406"
}
],
"symlink_target": ""
} |
from __future__ import unicode_literals
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name="ankieta",
version="0.1.0",
author="Adam Dobrawy",
author_email="naczelnik@jawnosc.tk",
packages=[
"ankieta",
],
include_package_data=True,
install_requires=[
"Django==1.7.6",
],
zip_safe=False,
scripts=["ankieta/manage.py"],
)
| {
"content_hash": "4711084af13521eddff8fb64af644b73",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 40,
"avg_line_length": 19.863636363636363,
"alnum_prop": 0.620137299771167,
"repo_name": "ad-m/petycja-faoo",
"id": "36214554026dc5ef17652b1ae8ba2f9f836a3029",
"size": "483",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "setup.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "133849"
},
{
"name": "HTML",
"bytes": "8707"
},
{
"name": "JavaScript",
"bytes": "250769"
},
{
"name": "Python",
"bytes": "35823"
}
],
"symlink_target": ""
} |
#pragma once
#include <aws/kinesisanalyticsv2/KinesisAnalyticsV2_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
namespace Aws
{
namespace KinesisAnalyticsV2
{
namespace Model
{
enum class MetricsLevel
{
NOT_SET,
APPLICATION,
TASK,
OPERATOR,
PARALLELISM
};
namespace MetricsLevelMapper
{
AWS_KINESISANALYTICSV2_API MetricsLevel GetMetricsLevelForName(const Aws::String& name);
AWS_KINESISANALYTICSV2_API Aws::String GetNameForMetricsLevel(MetricsLevel value);
} // namespace MetricsLevelMapper
} // namespace Model
} // namespace KinesisAnalyticsV2
} // namespace Aws
| {
"content_hash": "02ec9c5e0ee4ce8603293bd68b42ee65",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 88,
"avg_line_length": 20.4,
"alnum_prop": 0.7696078431372549,
"repo_name": "jt70471/aws-sdk-cpp",
"id": "a69b048626d751bcc94833501eef6e9bf42a3353",
"size": "731",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "aws-cpp-sdk-kinesisanalyticsv2/include/aws/kinesisanalyticsv2/model/MetricsLevel.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "13452"
},
{
"name": "C++",
"bytes": "278594037"
},
{
"name": "CMake",
"bytes": "653931"
},
{
"name": "Dockerfile",
"bytes": "5555"
},
{
"name": "HTML",
"bytes": "4471"
},
{
"name": "Java",
"bytes": "302182"
},
{
"name": "Python",
"bytes": "110380"
},
{
"name": "Shell",
"bytes": "4674"
}
],
"symlink_target": ""
} |
<?php
?>
<!DOCTYPE html>
<html>
<head>
<title>PHP oefening 30 - image manipulation</title>
<link rel="stylesheet" type="text/css" href="../../_assets/css/global.css">
</head>
<body class="web-backend-voorbeeld">
<h1>PHP oefening 30 - image manipulation</h1>
<form action="oplossing-image-manipulation-thumb.php" method="POST" enctype="multipart/form-data">
<label for="image">image</label>
<input type="file" name="image" id="image">
<input type="submit" name="submit">
</form>
</body>
</html> | {
"content_hash": "fd14e2a41a7f1ff47b040d7cc06ca710",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 99,
"avg_line_length": 19.25925925925926,
"alnum_prop": 0.6634615384615384,
"repo_name": "EvaVanRumst/web-backend",
"id": "f10ec82b7fe2f3d99a67e8aad59c26f37e1dc31c",
"size": "520",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "public/cursus/opdrachten/opdracht-image-manipulation-thumb/oplossing-image-manipulation-thumb/oplossing-image-manipulation-thumb-form.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ApacheConf",
"bytes": "3835"
},
{
"name": "CSS",
"bytes": "12101"
},
{
"name": "HTML",
"bytes": "379517"
},
{
"name": "JavaScript",
"bytes": "25"
},
{
"name": "PHP",
"bytes": "1624078"
}
],
"symlink_target": ""
} |
/**
* Author: Bob Chen
* Kylin Soong
*/
package com.jcommerce.core.service.impl;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Hibernate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.jcommerce.core.dao.RegionDAO;
import com.jcommerce.core.model.Region;
import com.jcommerce.core.service.Criteria;
import com.jcommerce.core.service.RegionManager;
@Service("RegionManager")
public class RegionManagerImpl extends ManagerImpl implements RegionManager {
private static Log log = LogFactory.getLog(RegionManagerImpl.class);
@Autowired
private RegionDAO dao;
public void setRegionDAO(RegionDAO dao) {
this.dao = dao;
super.setDao(dao);
}
public Region initialize(Region obj) {
if (obj != null && !Hibernate.isInitialized(obj)) {
obj = dao.getRegion(obj.getId());
}
return obj;
}
public List<Region> getRegionList(int firstRow, int maxRow) {
List list = getList(firstRow, maxRow);
return (List<Region>)list;
}
public int getRegionCount(Criteria criteria) {
return getCount(criteria);
}
public List<Region> getRegionList(Criteria criteria) {
List list = getList(criteria);
return (List<Region>)list;
}
public List<Region> getRegionList(int firstRow, int maxRow, Criteria criteria) {
List list = getList(firstRow, maxRow, criteria);
return (List<Region>)list;
}
public List<Region> getRegionList() {
return dao.getRegionList();
}
public List<Region> getChildList(String parent_id){
List<Region> list = getList("from Region t where t.parent = "+parent_id);
return list;
}
public Region getRegion(Long id) {
Region obj = dao.getRegion(id);
return obj;
}
public void saveRegion(Region obj) {
dao.saveRegion(obj);
}
public void removeRegion(Long id) {
dao.removeRegion(id);
}
public List<Region> getCountries(){
List<Region> countries = getList("from Region t where t.type = 0");
return countries;
}
}
| {
"content_hash": "3dbe095cab7ba42df4fb757fd2cfd9cf",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 84,
"avg_line_length": 26.611764705882354,
"alnum_prop": 0.6666666666666666,
"repo_name": "jbosschina/jcommerce",
"id": "c94a0c73ba210953868d6af9a6c77a2f368916ea",
"size": "2262",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spring/core/src/main/java/com/jcommerce/core/service/impl/RegionManagerImpl.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "200608"
},
{
"name": "GAP",
"bytes": "2286"
},
{
"name": "Java",
"bytes": "4485563"
}
],
"symlink_target": ""
} |
<?php
namespace Propel\Generator\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Propel\Generator\Manager\MigrationManager;
use Propel\Generator\Util\SqlParser;
/**
* @author William Durand <william.durand1@gmail.com>
*/
class MigrationDownCommand extends AbstractCommand
{
const DEFAULT_OUTPUT_DIRECTORY = 'generated-migrations';
const DEFAULT_MIGRATION_TABLE = 'propel_migration';
/**
* {@inheritdoc}
*/
protected function configure()
{
parent::configure();
$this
->addOption('output-dir', null, InputOption::VALUE_REQUIRED, 'The output directory', self::DEFAULT_OUTPUT_DIRECTORY)
->addOption('migration-table', null, InputOption::VALUE_REQUIRED, 'Migration table name', self::DEFAULT_MIGRATION_TABLE)
->addOption('connection', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Connection to use', array())
->setName('migration:down')
->setAliases(array('down'))
->setDescription('Execute migrations down')
;
}
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$generatorConfig = $this->getGeneratorConfig(array(
'propel.platform.class' => $input->getOption('platform'),
), $input);
$this->createDirectory($input->getOption('output-dir'));
$manager = new MigrationManager();
$manager->setGeneratorConfig($generatorConfig);
$connections = array();
$optionConnections = $input->getOption('connection');
if (!$optionConnections) {
$connections = $generatorConfig->getBuildConnections($input->getOption('input-dir'));
} else {
foreach ($optionConnections as $connection) {
list($name, $dsn, $infos) = $this->parseConnection($connection);
$connections[$name] = array_merge(array('dsn' => $dsn), $infos);
}
}
$manager->setConnections($connections);
$manager->setMigrationTable($input->getOption('migration-table'));
$manager->setWorkingDirectory($input->getOption('output-dir'));
$previousTimestamps = $manager->getAlreadyExecutedMigrationTimestamps();
if (!$nextMigrationTimestamp = array_pop($previousTimestamps)) {
$output->writeln('No migration were ever executed on this database - nothing to reverse.');
return false;
}
$output->writeln(sprintf(
'Executing migration %s down',
$manager->getMigrationClassName($nextMigrationTimestamp)
));
if ($nbPreviousTimestamps = count($previousTimestamps)) {
$previousTimestamp = array_pop($previousTimestamps);
} else {
$previousTimestamp = 0;
}
$migration = $manager->getMigrationObject($nextMigrationTimestamp);
if (false === $migration->preDown($manager)) {
$output->writeln('<error>preDown() returned false. Aborting migration.</error>');
return false;
}
foreach ($migration->getDownSQL() as $datasource => $sql) {
$connection = $manager->getConnection($datasource);
if ($input->getOption('verbose')) {
$output->writeln(sprintf(
'Connecting to database "%s" using DSN "%s"',
$datasource,
$connection['dsn']
));
}
$conn = $manager->getAdapterConnection($datasource);
$res = 0;
$statements = SqlParser::parseString($sql);
foreach ($statements as $statement) {
try {
if ($input->getOption('verbose')) {
$output->writeln(sprintf('Executing statement "%s"', $statement));
}
$stmt = $conn->prepare($statement);
$stmt->execute();
$res++;
} catch (\PDOException $e) {
$output->writeln(sprintf('<error>Failed to execute SQL "%s"</error>', $statement));
}
}
if (!$res) {
$output->writeln('No statement was executed. The version was not updated.');
$output->writeln(sprintf(
'Please review the code in "%s"',
$manager->getMigrationDir() . DIRECTORY_SEPARATOR . $manager->getMigrationClassName($nextMigrationTimestamp)
));
$output->writeln('<error>Migration aborted</error>');
return false;
}
$output->writeln(sprintf(
'%d of %d SQL statements executed successfully on datasource "%s"',
$res,
count($statements),
$datasource
));
$manager->removeMigrationTimestamp($datasource, $nextMigrationTimestamp);
if ($input->getOption('verbose')) {
$output->writeln(sprintf(
'Downgraded migration date to %d for datasource "%s"',
$previousTimestamp,
$datasource
));
}
}
$migration->postDown($manager);
if ($nbPreviousTimestamps) {
$output->writeln(sprintf('Reverse migration complete. %d more migrations available for reverse.', $nbPreviousTimestamps));
} else {
$output->writeln('Reverse migration complete. No more migration available for reverse');
}
}
}
| {
"content_hash": "73ca00ba3dd0bd66e7eba9204200f10a",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 138,
"avg_line_length": 36.40506329113924,
"alnum_prop": 0.5648470097357441,
"repo_name": "TonnyORG/ScioTest1",
"id": "95fcf6804c086ad05d1d642de29ad2421dd09178",
"size": "5960",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "vendor/propel/propel/src/Propel/Generator/Command/MigrationDownCommand.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "13219"
},
{
"name": "JavaScript",
"bytes": "11071"
},
{
"name": "PHP",
"bytes": "186966"
},
{
"name": "Ruby",
"bytes": "971"
}
],
"symlink_target": ""
} |
namespace base {
class SingleThreadTaskRunner;
}
namespace blink {
class WebMediaPlayer;
// This class is a VideoCapturerSource taking video snapshots of the ctor-passed
// blink::WebMediaPlayer on Render Main thread. The captured data is converted
// and sent back to |io_task_runner_| via the registered |new_frame_callback_|.
class MODULES_EXPORT HtmlVideoElementCapturerSource final
: public VideoCapturerSource {
public:
static std::unique_ptr<HtmlVideoElementCapturerSource>
CreateFromWebMediaPlayerImpl(
blink::WebMediaPlayer* player,
const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> task_runner);
HtmlVideoElementCapturerSource(
const base::WeakPtr<blink::WebMediaPlayer>& player,
const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> task_runner);
HtmlVideoElementCapturerSource(const HtmlVideoElementCapturerSource&) =
delete;
HtmlVideoElementCapturerSource& operator=(
const HtmlVideoElementCapturerSource&) = delete;
~HtmlVideoElementCapturerSource() override;
// VideoCapturerSource Implementation.
media::VideoCaptureFormats GetPreferredFormats() override;
void StartCapture(const media::VideoCaptureParams& params,
const VideoCaptureDeliverFrameCB& new_frame_callback,
const RunningCallback& running_callback) override;
void StopCapture() override;
private:
friend class HTMLVideoElementCapturerSourceTest;
// This method includes collecting data from the WebMediaPlayer and converting
// it into a format suitable for MediaStreams.
void sendNewFrame();
gfx::Size natural_size_;
const base::WeakPtr<blink::WebMediaPlayer> web_media_player_;
const scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
const scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
// These three configuration items are passed on StartCapture();
RunningCallback running_callback_;
VideoCaptureDeliverFrameCB new_frame_callback_;
double capture_frame_rate_;
// base::TimeTicks on which the first captured VideoFrame is produced.
base::TimeTicks start_capture_time_;
// Target time for the next frame.
base::TimeTicks next_capture_time_;
// Bound to the main render thread.
THREAD_CHECKER(thread_checker_);
// Used on main render thread to schedule future capture events.
base::WeakPtrFactory<HtmlVideoElementCapturerSource> weak_factory_{this};
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_MEDIACAPTUREFROMELEMENT_HTML_VIDEO_ELEMENT_CAPTURER_SOURCE_H_
| {
"content_hash": "3b0c131006345dd52d251d055b58734e",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 107,
"avg_line_length": 36.63013698630137,
"alnum_prop": 0.7677636499626028,
"repo_name": "ric2b/Vivaldi-browser",
"id": "f35835b77aad86dea66c2c7000d07397652acdb6",
"size": "3368",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "chromium/third_party/blink/renderer/modules/mediacapturefromelement/html_video_element_capturer_source.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SFML.Graphics;
using SFML.Window;
namespace Fartseer.Components
{
public enum ComponentEvent
{
ChildComponentAdded,
ChildComponentRemoving,
Removing,
Initialized
}
public enum ComponentRestriction
{
Either,
Normal, // TODO: maybe make something else than "Normal"
Drawable
}
public class ComponentEventArgs : EventArgs
{
public ComponentEvent Event { get; private set; }
public object[] Data { get; private set; }
public ComponentEventArgs(ComponentEvent componentEvent, params object[] data)
{
Event = componentEvent;
Data = data;
}
}
public abstract class GameComponent
{
public bool Enabled { get; set; }
public List<GameComponent> Components { get; private set; }
public GameComponent Parent { get; private set; }
public Game Game { get; protected set; }
public event EventHandler<ComponentEventArgs> ChildComponentAdded;
public event EventHandler<ComponentEventArgs> ChildComponentRemoving;
public event EventHandler<ComponentEventArgs> Removing;
public event EventHandler<ComponentEventArgs> Initialized;
protected int initIndex;
public int initPriority; // components are initialized in descending order of init priorities
protected ComponentRestriction parentRestriction;
public GameComponent(int initPriority)
{
this.initPriority = initPriority;
Components = new List<GameComponent>();
Enabled = true;
parentRestriction = ComponentRestriction.Either;
//Console.WriteLine("{0} {1}", this, this is DrawableGameComponent);
}
public string GetComponentTypeString()
{
if (this is DrawableGameComponent)
return "DrawableGameComponent";
else
return "GameComponent";
}
// supposed to be overridden by component
protected virtual List<GameComponent> GetInitComponents()
{
return new List<GameComponent>();
}
// used by AddComponent, makes sure the component is initialized correctly
public bool DoInit(int initIndex)
{
System.Diagnostics.Stopwatch initTimer = System.Diagnostics.Stopwatch.StartNew();
Console.WriteLine("{0} initializing\n\tInit priority: {1}, init index: {2}\n\tParent restriction: {3}",
this.GetType().Name, initPriority, initIndex, parentRestriction);
this.initIndex = initIndex;
if (!InitComponents())
return false;
if (!Init())
return false;
initTimer.Stop();
Console.WriteLine("{0} initializing took {1} ms", this.GetType().Name, initTimer.Elapsed.TotalMilliseconds);
return true;
}
bool InitComponents()
{
// get init components (method above), sort them by init priority and add them
List<GameComponent> initComponents = GetInitComponents();
initComponents = initComponents.OrderByDescending(c => c.initPriority).ToList();
foreach (GameComponent component in initComponents)
if (!AddComponent(component))
return false;
return true;
}
// init should never be called by something else than DoInit (above)
protected virtual bool Init()
{
if (!parentRestriction.Matches(Parent))
{
Console.WriteLine("{0} component's parent's type does not match parent type restriction (Parent: {1}, Restriction: {2}",
this.GetType().Name, Parent.GetComponentTypeString(), parentRestriction);
return false;
}
if (Initialized != null)
Initialized(this, new ComponentEventArgs(ComponentEvent.Initialized));
return true;
}
public virtual void Update(double frametime)
{
if (Enabled)
foreach (GameComponent component in Components)
component.Update(frametime);
}
public bool AddComponent(GameComponent component)
{
component.Parent = this;
component.Game = Game;
if (!component.DoInit(initIndex + 1))
{
Console.WriteLine("{0} component failed to initialize and will not be added to {1} component", component.GetType().Name, this.GetType().Name);
return false;
}
Components.Add(component);
if (ChildComponentAdded != null)
ChildComponentAdded(this, new ComponentEventArgs(ComponentEvent.ChildComponentAdded, component));
return true;
}
public void RemoveComponent(GameComponent component)
{
if (Components.Contains(component))
{
if (ChildComponentRemoving != null)
ChildComponentRemoving(this, new ComponentEventArgs(ComponentEvent.ChildComponentRemoving, component));
Components.Remove(component);
}
}
public void Remove()
{
if (Removing != null)
Removing(this, new ComponentEventArgs(ComponentEvent.Removing));
Parent.RemoveComponent(this);
}
public T GetComponent<T>() where T : GameComponent
{
return GetComponent<T>(c => true);
}
public T GetComponent<T>(Func<T, bool> condition) where T : GameComponent
{
T component = Components.Find(c => c is T && condition(c as T)) as T;
return component;
}
public List<GameComponent> GetComponents(ComponentList components)
{
return GetComponents(components, c => true);
}
public List<GameComponent> GetComponents(ComponentList components, Func<GameComponent, bool> condition)
{
List<GameComponent> list = Components.FindAll((c) =>
{
if (!components.Contains(c.GetType()))
return false;
if (!condition(c))
return false;
return true;
});
return list;
}
public bool ContainsComponent<T>() where T : GameComponent
{
// source: http://stackoverflow.com/questions/8216881/how-do-i-check-if-a-list-contains-an-object-of-a-certain-type-c-sharp
return Components.OfType<T>().Any();
}
}
public abstract class DrawableGameComponent : GameComponent, Drawable
{
public bool Visible { get; set; }
public virtual Vector2f Position { get; set; }
public DrawableGameComponent(int initPriority)
: base(initPriority)
{
Visible = true;
}
public virtual void Draw(RenderTarget target, RenderStates states)
{
if (Visible)
{
foreach (GameComponent component in Components)
{
// maybe not best implementation
if (component is DrawableGameComponent)
((DrawableGameComponent)component).Draw(target, states);
}
}
}
}
}
| {
"content_hash": "c65c670d7da656e483b7671381147eb7",
"timestamp": "",
"source": "github",
"line_count": 228,
"max_line_length": 146,
"avg_line_length": 26.94298245614035,
"alnum_prop": 0.7185414292690868,
"repo_name": "Spanfile/Fartseer",
"id": "a316b529027f5772c193301018d9343a0eb8e4df",
"size": "6145",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Fartseer/Components/GameComponent.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "48736"
}
],
"symlink_target": ""
} |
import { ImageProps } from '../Image';
export interface HeroImageProps extends ImageProps {}
export * from '../Image/types';
| {
"content_hash": "ae2056c46c57ebec9610db9c64a619fc",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 53,
"avg_line_length": 25.4,
"alnum_prop": 0.7165354330708661,
"repo_name": "wix/wix-style-react",
"id": "b42bff885bc68e82ada558ad4e2f1e8b347f8388",
"size": "127",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "packages/wix-ui-tpa/src/components/HeroImage/types.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "325595"
},
{
"name": "HTML",
"bytes": "20584"
},
{
"name": "JavaScript",
"bytes": "4465095"
},
{
"name": "Shell",
"bytes": "4264"
},
{
"name": "TypeScript",
"bytes": "219813"
}
],
"symlink_target": ""
} |
package com.google.cloud.solutions.datamesh.model;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.stream.Stream;
import org.apache.beam.sdk.schemas.Schema;
import org.apache.beam.sdk.schemas.Schema.Field;
import org.apache.beam.sdk.schemas.Schema.FieldType;
public class ClickSchema {
public static final String REQUEST_TIME = "request_time";
public static final String CUSTOMER_ID = "customer_id";
public static final String IP_ADDR = "ip_addr";
public static final String URL = "url";
public static final String SOURCE_COUNTRY = "source_country";
public static final String SOURCE_REGION = "source_region";
public static final Field[] initialsFields = new Field[]{
Field.of(REQUEST_TIME, FieldType.INT64),
Field.of(CUSTOMER_ID, FieldType.STRING),
Field.of(IP_ADDR, FieldType.STRING),
Field.of(URL, FieldType.STRING)
};
public static final Field[] additionalFields = new Field[]{
Field.of(SOURCE_COUNTRY, FieldType.STRING),
Field.of(SOURCE_REGION, FieldType.STRING)
};
public static final Schema clickSchema = Schema.of(initialsFields);
public static Field[] enrichedFields = Stream
.concat(Arrays.stream(initialsFields), Arrays.stream(additionalFields))
.toArray(
size -> (Field[]) Array.newInstance(initialsFields.getClass().getComponentType(), size));
public static final Schema enrichedClickSchema = Schema.of(enrichedFields);
}
| {
"content_hash": "53b94b87d30e7e0b2b028f0fa4e64ee8",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 99,
"avg_line_length": 35.48780487804878,
"alnum_prop": 0.7360824742268042,
"repo_name": "GoogleCloudPlatform/data-mesh-demo",
"id": "59f16ad093f642afb795420384ecf23c0448663d",
"size": "2049",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "streaming-product/ingest-pipeline/src/main/java/com/google/cloud/solutions/datamesh/model/ClickSchema.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HCL",
"bytes": "35320"
},
{
"name": "Java",
"bytes": "44393"
},
{
"name": "Shell",
"bytes": "25538"
}
],
"symlink_target": ""
} |
package cn.xing.mypassword.activity;
import android.app.ActionBar;
import android.app.FragmentTransaction;
import android.app.ListFragment;
import android.app.SearchManager;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.widget.ArrayAdapter;
import cn.xing.mypassword.R;
public class SearchResultPasswordActivity extends BaseActivity {
private MyFragment current = null;
private class MyFragment extends ListFragment {
private final String[] rows = { "abc", "aab", "aac", "aaa", "abb",
"acc", "cab", "ccc", "bbb" };
MyFragment() {
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// ListViewにFilterをかけれるようにする
getListView().setTextFilterEnabled(true);
// ListViewに表示するItemの設定
setListAdapter(new ArrayAdapter(getActivity(),
android.R.layout.simple_list_item_1, rows));
}
/**
* ListViewにFilterをかける
* @param s
*/
public void setFilter(String s){
getListView().setFilterText(s);
}
/**
* ListViewのFilterをClearする
*/
public void clearFilter(){
getListView().clearTextFilter();
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.search_password);
initActionBar();
// ListViewを表示するFragment
FragmentTransaction ft = getFragmentManager().beginTransaction();
current = new MyFragment();
ft.replace(R.id.container, current, "MyFragment");
ft.commit();
}
@Override
protected void onNewIntent(Intent intent) {
// TODO Auto-generated method stub
super.onNewIntent(intent);
doSearchQuery(intent);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
return super.onCreateOptionsMenu(menu);
}
private void initActionBar() {
ActionBar actionBar = getActionBar();
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setTitle(R.string.search_result);
}
private void doSearchQuery(Intent intent){
if(intent == null)
return;
String queryAction = intent.getAction();
if(Intent.ACTION_SEARCH.equals(queryAction)){
String queryString = intent.getStringExtra(SearchManager.QUERY);
Log.w("Search", "搜索内容:" + queryString);
}
}
}
| {
"content_hash": "01a1d7bd707d643d28ce1797d9d2eca6",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 76,
"avg_line_length": 28.7319587628866,
"alnum_prop": 0.6142805884463581,
"repo_name": "lymons/MyPassword",
"id": "1812539b2179520ecada46e559c83b37a32093e6",
"size": "2863",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "MyPassword/src/cn/xing/mypassword/activity/SearchResultPasswordActivity.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "218912"
},
{
"name": "Shell",
"bytes": "338"
}
],
"symlink_target": ""
} |
// .NAME vtkNIFTIImageWriter - Write NIfTI-1 and NIfTI-2 medical image files
// .SECTION Description
// This class writes NIFTI files, either in .nii format or as separate
// .img and .hdr files. If told to write a file that ends in ".gz",
// then the writer will automatically compress the file with zlib.
// Images of type unsigned char that have 3 or 4 scalar components
// will automatically be written as RGB or RGBA respectively. Images
// of type float or double that have 2 components will automatically be
// written as complex values.
// .SECTION Thanks
// This class was contributed to VTK by the Calgary Image Processing and
// Analysis Centre (CIPAC).
// .SECTION See Also
// vtkNIFTIImageReader
#ifndef vtkNIFTIImageWriter_h
#define vtkNIFTIImageWriter_h
#include "vtkIOImageModule.h" // For export macro
#include "vtkImageWriter.h"
class vtkMatrix4x4;
class vtkNIFTIImageHeader;
class VTKIOIMAGE_EXPORT vtkNIFTIImageWriter : public vtkImageWriter
{
public:
// Description:
// Static method for construction.
static vtkNIFTIImageWriter *New();
vtkTypeMacro(vtkNIFTIImageWriter, vtkImageWriter);
// Description:
// Print information about this object.
void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
// Description:
// Set the version number for the NIfTI file format to use.
// This can be 1, 2, or 0 (the default). If set to zero, then it
// will save as NIfTI version 1 unless SetNIFTIHeader() provided
// header information from a NIfTI version 2 file.
vtkSetMacro(NIFTIVersion, int);
vtkGetMacro(NIFTIVersion, int);
// Description:
// Set a short description (max 80 chars) of how the file was produced.
// The default description is "VTKX.Y" where X.Y is the VTK version.
vtkSetStringMacro(Description);
vtkGetStringMacro(Description);
// Description:
// Set the time dimension to use in the NIFTI file (or zero if none).
// The number of components of the input data must be divisible by the time
// dimension if the time dimension is not set to zero. The vector dimension
// will be set to the number of components divided by the time dimension.
vtkGetMacro(TimeDimension, int);
vtkSetMacro(TimeDimension, int);
vtkGetMacro(TimeSpacing, double);
vtkSetMacro(TimeSpacing, double);
// Description:
// Set the slope and intercept for calibrating the scalar values.
// Other programs that read the NIFTI file can use the equation
// v = u*RescaleSlope + RescaleIntercept to rescale the data to
// real values. If both the slope and the intercept are zero,
// then the SclSlope and SclIntercept in the header info provided
// via SetNIFTIHeader() are used instead.
vtkSetMacro(RescaleSlope, double);
vtkGetMacro(RescaleSlope, double);
vtkSetMacro(RescaleIntercept, double);
vtkGetMacro(RescaleIntercept, double);
// Description:
// Write planar RGB (separate R, G, and B planes), rather than packed RGB.
// Use this option with extreme caution: the NIFTI standard requires RGB
// pixels to be packed. The Analyze format, however, was used to store
// both planar RGB and packed RGB depending on the software, without any
// indication in the header about which convention was being used.
vtkGetMacro(PlanarRGB, bool);
vtkSetMacro(PlanarRGB, bool);
vtkBooleanMacro(PlanarRGB, bool);
// Description:
// The QFac sets the ordering of the slices in the NIFTI file.
// If QFac is -1, then the slice ordering in the file will be reversed
// as compared to VTK. Use with caution.
vtkSetMacro(QFac, double);
vtkGetMacro(QFac, double);
// Description:
// Set the "qform" orientation and offset for the image data.
// The 3x3 portion of the matrix must be orthonormal and have a
// positive determinant, it will be used to compute the quaternion.
// The last column of the matrix will be used for the offset.
// In the NIFTI header, the qform_code will be set to 1.
void SetQFormMatrix(vtkMatrix4x4 *);
vtkMatrix4x4 *GetQFormMatrix() { return this->QFormMatrix; }
// Description:
// Set a matrix for the "sform" transformation stored in the file.
// Unlike the qform matrix, the sform matrix can contain scaling
// information. Before being stored in the NIFTI header, the
// first three columns of the matrix will be multipled by the voxel
// spacing. In the NIFTI header, the sform_code will be set to 2.
void SetSFormMatrix(vtkMatrix4x4 *);
vtkMatrix4x4 *GetSFormMatrix() { return this->SFormMatrix; }
// Description:
// Set the NIFTI header information to use when writing the file.
// The data dimensions and pixdim from the supplied header will be
// ignored. Likewise, the QForm and SForm information in the supplied
// header will be ignored if you have called SetQFormMatrix() or
// SetSFormMatrix() to provide the orientation information for the file.
void SetNIFTIHeader(vtkNIFTIImageHeader *hdr);
vtkNIFTIImageHeader *GetNIFTIHeader();
protected:
vtkNIFTIImageWriter();
~vtkNIFTIImageWriter();
// Description:
// Generate the header information for the file.
int GenerateHeader(vtkInformation *info, bool singleFile);
// Description:
// The main execution method, which writes the file.
virtual int RequestData(vtkInformation *request,
vtkInformationVector** inputVector,
vtkInformationVector* outputVector);
// Description:
// Make a new filename by replacing extension "ext1" with "ext2".
// The extensions must include a period, must be three characters
// long, and must be lower case. A new string is returned that must
// be deleted by the caller.
static char *ReplaceExtension(
const char *fname, const char *ext1, const char *ext2);
// Description:
// The size and spacing of the Time dimension to use in the file.
int TimeDimension;
double TimeSpacing;
// Description:
// Information for rescaling data to quantitative units.
double RescaleIntercept;
double RescaleSlope;
// Description:
// Is -1 if VTK slice order is opposite to NIFTI slice order, +1 otherwise.
double QFac;
// Description:
// The orientation matrices for the NIFTI file.
vtkMatrix4x4 *QFormMatrix;
vtkMatrix4x4 *SFormMatrix;
// Description
// A description of how the file was produced.
char *Description;
// Description:
// The header information.
vtkNIFTIImageHeader *NIFTIHeader;
vtkNIFTIImageHeader *OwnHeader;
int NIFTIVersion;
// Description:
// Use planar RGB instead of the default (packed).
bool PlanarRGB;
private:
vtkNIFTIImageWriter(const vtkNIFTIImageWriter&) VTK_DELETE_FUNCTION;
void operator=(const vtkNIFTIImageWriter&) VTK_DELETE_FUNCTION;
};
#endif // vtkNIFTIImageWriter_h
| {
"content_hash": "16e9688277161b735832ba5834d3f6f3",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 78,
"avg_line_length": 37.89887640449438,
"alnum_prop": 0.7349540468425734,
"repo_name": "keithroe/vtkoptix",
"id": "a201a55cdf6235e943bf982385bdae4df1a8a51c",
"size": "7335",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "IO/Image/vtkNIFTIImageWriter.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Assembly",
"bytes": "37444"
},
{
"name": "Batchfile",
"bytes": "106"
},
{
"name": "C",
"bytes": "46217717"
},
{
"name": "C++",
"bytes": "73779038"
},
{
"name": "CMake",
"bytes": "1786055"
},
{
"name": "CSS",
"bytes": "7532"
},
{
"name": "Cuda",
"bytes": "37418"
},
{
"name": "D",
"bytes": "2081"
},
{
"name": "GAP",
"bytes": "14120"
},
{
"name": "GLSL",
"bytes": "222494"
},
{
"name": "Groff",
"bytes": "65394"
},
{
"name": "HTML",
"bytes": "193016"
},
{
"name": "Java",
"bytes": "148789"
},
{
"name": "JavaScript",
"bytes": "54139"
},
{
"name": "Lex",
"bytes": "50109"
},
{
"name": "M4",
"bytes": "159710"
},
{
"name": "Makefile",
"bytes": "275672"
},
{
"name": "Objective-C",
"bytes": "22779"
},
{
"name": "Objective-C++",
"bytes": "191216"
},
{
"name": "Perl",
"bytes": "173168"
},
{
"name": "Prolog",
"bytes": "4406"
},
{
"name": "Python",
"bytes": "15765617"
},
{
"name": "Shell",
"bytes": "88087"
},
{
"name": "Slash",
"bytes": "1476"
},
{
"name": "Smarty",
"bytes": "393"
},
{
"name": "Tcl",
"bytes": "1404085"
},
{
"name": "Yacc",
"bytes": "191144"
}
],
"symlink_target": ""
} |
"""Transaction create/delete/update subclass unit tests."""
# Copyright (c) 2001-2009 ElevenCraft Inc.
# See LICENSE for details.
from schevo.test import CreatesSchema
class BaseTransactionCDUSubclass(CreatesSchema):
body = '''
class Foo(E.Entity):
name = f.string()
_key(name)
@extentmethod
def t_custom_create(extent, **kw):
return E.Foo._CustomCreate(**kw)
def t_custom_delete(self):
return self._CustomDelete(self)
def t_custom_update(self, **kw):
return self._CustomUpdate(self, **kw)
class _CustomCreate(T.Create):
def _setup(self):
self.x.before = False
self.x.after = False
def _before_execute(self, db):
self.x.before = True
def _after_execute(self, db, foo):
self.x.after = True
class _CustomDelete(T.Delete):
def _setup(self):
self.x.before = False
self.x.after = False
def _before_execute(self, db, foo):
self.x.before = True
def _after_execute(self, db):
self.x.after = True
class _CustomUpdate(T.Update):
def _setup(self):
self.x.before = False
self.x.after = False
def _before_execute(self, db, foo):
self.x.before = True
def _after_execute(self, db, foo):
self.x.after = True
'''
def test(self):
tx = db.Foo.t.custom_create()
assert tx.x.before == False
assert tx.x.after == False
tx.name = 'hi'
foo = db.execute(tx)
assert foo.name == 'hi'
assert tx.x.before == True
assert tx.x.after == True
tx = foo.t.custom_update()
assert tx.x.before == False
assert tx.x.after == False
tx.name = 'ha'
db.execute(tx)
assert foo.name == 'ha'
assert tx.x.before == True
assert tx.x.after == True
tx = foo.t.custom_delete()
assert tx.x.before == False
assert tx.x.after == False
db.execute(tx)
assert foo not in db.Foo
assert tx.x.before == True
assert tx.x.after == True
# class TestTransactionCDUSubclass1(BaseTransactionCDUSubclass):
# include = True
# format = 1
class TestTransactionCDUSubclass2(BaseTransactionCDUSubclass):
include = True
format = 2
| {
"content_hash": "f39bc9c2fd60a2b6601fdcc39b5343f1",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 64,
"avg_line_length": 24.637254901960784,
"alnum_prop": 0.535216872264226,
"repo_name": "Schevo/schevo",
"id": "6fb1a26edbb59cc689b8e93edd6ab650fc99ee07",
"size": "2513",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "schevo/test/test_transaction_cdu_subclass.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "8687"
},
{
"name": "Python",
"bytes": "954297"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<!--<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">-->
<title> SmartAdmin </title>
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<!-- Basic Styles -->
<link rel="stylesheet" type="text/css" media="screen" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" media="screen" href="css/font-awesome.min.css">
<!-- SmartAdmin Styles : Please note (smartadmin-production.css) was created using LESS variables -->
<link rel="stylesheet" type="text/css" media="screen" href="css/smartadmin-production.min.css">
<link rel="stylesheet" type="text/css" media="screen" href="css/smartadmin-skins.min.css">
<!-- SmartAdmin RTL Support is under construction
This RTL CSS will be released in version 1.5
<link rel="stylesheet" type="text/css" media="screen" href="css/smartadmin-rtl.min.css"> -->
<!-- We recommend you use "your_style.css" to override SmartAdmin
specific styles this will also ensure you retrain your customization with each SmartAdmin update.
<link rel="stylesheet" type="text/css" media="screen" href="css/your_style.css"> -->
<!-- Demo purpose only: goes with demo.js, you can delete this css when designing your own WebApp -->
<link rel="stylesheet" type="text/css" media="screen" href="css/demo.min.css">
<!-- FAVICONS -->
<link rel="shortcut icon" href="img/favicon/favicon.ico" type="image/x-icon">
<link rel="icon" href="img/favicon/favicon.ico" type="image/x-icon">
<!-- GOOGLE FONT -->
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,300,400,700">
<!-- Specifying a Webpage Icon for Web Clip
Ref: https://developer.apple.com/library/ios/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html -->
<link rel="apple-touch-icon" href="img/splash/sptouch-icon-iphone.png">
<link rel="apple-touch-icon" sizes="76x76" href="img/splash/touch-icon-ipad.png">
<link rel="apple-touch-icon" sizes="120x120" href="img/splash/touch-icon-iphone-retina.png">
<link rel="apple-touch-icon" sizes="152x152" href="img/splash/touch-icon-ipad-retina.png">
<!-- iOS web-app metas : hides Safari UI Components and Changes Status Bar Appearance -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<!-- Startup image for web apps -->
<link rel="apple-touch-startup-image" href="img/splash/ipad-landscape.png" media="screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:landscape)">
<link rel="apple-touch-startup-image" href="img/splash/ipad-portrait.png" media="screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:portrait)">
<link rel="apple-touch-startup-image" href="img/splash/iphone.png" media="screen and (max-device-width: 320px)">
</head>
<body class="">
<!-- possible classes: minified, fixed-ribbon, fixed-header, fixed-width-->
<!-- HEADER -->
<header id="header">
<div id="logo-group">
<!-- PLACE YOUR LOGO HERE -->
<span id="logo"> <img src="img/logo.png" alt="SmartAdmin"> </span>
<!-- END LOGO PLACEHOLDER -->
<!-- Note: The activity badge color changes when clicked and resets the number to 0
Suggestion: You may want to set a flag when this happens to tick off all checked messages / notifications -->
<span id="activity" class="activity-dropdown"> <i class="fa fa-user"></i> <b class="badge"> 21 </b> </span>
<!-- AJAX-DROPDOWN : control this dropdown height, look and feel from the LESS variable file -->
<div class="ajax-dropdown">
<!-- the ID links are fetched via AJAX to the ajax container "ajax-notifications" -->
<div class="btn-group btn-group-justified" data-toggle="buttons">
<label class="btn btn-default">
<input type="radio" name="activity" id="ajax/notify/mail.html">
Msgs (14) </label>
<label class="btn btn-default">
<input type="radio" name="activity" id="ajax/notify/notifications.html">
notify (3) </label>
<label class="btn btn-default">
<input type="radio" name="activity" id="ajax/notify/tasks.html">
Tasks (4) </label>
</div>
<!-- notification content -->
<div class="ajax-notifications custom-scroll">
<div class="alert alert-transparent">
<h4>Click a button to show messages here</h4>
This blank page message helps protect your privacy, or you can show the first message here automatically.
</div>
<i class="fa fa-lock fa-4x fa-border"></i>
</div>
<!-- end notification content -->
<!-- footer: refresh area -->
<span> Last updated on: 12/12/2013 9:43AM
<button type="button" data-loading-text="<i class='fa fa-refresh fa-spin'></i> Loading..." class="btn btn-xs btn-default pull-right">
<i class="fa fa-refresh"></i>
</button>
</span>
<!-- end footer -->
</div>
<!-- END AJAX-DROPDOWN -->
</div>
<!-- projects dropdown -->
<div class="project-context hidden-xs">
<span class="label">Projects:</span>
<span class="project-selector dropdown-toggle" data-toggle="dropdown">Recent projects <i class="fa fa-angle-down"></i></span>
<!-- Suggestion: populate this list with fetch and push technique -->
<ul class="dropdown-menu">
<li>
<a href="javascript:void(0);">Online e-merchant management system - attaching integration with the iOS</a>
</li>
<li>
<a href="javascript:void(0);">Notes on pipeline upgradee</a>
</li>
<li>
<a href="javascript:void(0);">Assesment Report for merchant account</a>
</li>
<li class="divider"></li>
<li>
<a href="javascript:void(0);"><i class="fa fa-power-off"></i> Clear</a>
</li>
</ul>
<!-- end dropdown-menu-->
</div>
<!-- end projects dropdown -->
<!-- pulled right: nav area -->
<div class="pull-right">
<!-- collapse menu button -->
<div id="hide-menu" class="btn-header pull-right">
<span> <a href="javascript:void(0);" data-action="toggleMenu" title="Collapse Menu"><i class="fa fa-reorder"></i></a> </span>
</div>
<!-- end collapse menu -->
<!-- #MOBILE -->
<!-- Top menu profile link : this shows only when top menu is active -->
<ul id="mobile-profile-img" class="header-dropdown-list hidden-xs padding-5">
<li class="">
<a href="#" class="dropdown-toggle no-margin userdropdown" data-toggle="dropdown">
<img src="img/avatars/sunny.png" alt="John Doe" class="online" />
</a>
<ul class="dropdown-menu pull-right">
<li>
<a href="javascript:void(0);" class="padding-10 padding-top-0 padding-bottom-0"><i class="fa fa-cog"></i> Setting</a>
</li>
<li class="divider"></li>
<li>
<a href="profile.html" class="padding-10 padding-top-0 padding-bottom-0"> <i class="fa fa-user"></i> <u>P</u>rofile</a>
</li>
<li class="divider"></li>
<li>
<a href="javascript:void(0);" class="padding-10 padding-top-0 padding-bottom-0" data-action="toggleShortcut"><i class="fa fa-arrow-down"></i> <u>S</u>hortcut</a>
</li>
<li class="divider"></li>
<li>
<a href="javascript:void(0);" class="padding-10 padding-top-0 padding-bottom-0" data-action="launchFullscreen"><i class="fa fa-arrows-alt"></i> Full <u>S</u>creen</a>
</li>
<li class="divider"></li>
<li>
<a href="login.html" class="padding-10 padding-top-5 padding-bottom-5" data-action="userLogout"><i class="fa fa-sign-out fa-lg"></i> <strong><u>L</u>ogout</strong></a>
</li>
</ul>
</li>
</ul>
<!-- logout button -->
<div id="logout" class="btn-header transparent pull-right">
<span> <a href="login.html" title="Sign Out" data-action="userLogout" data-logout-msg="You can improve your security further after logging out by closing this opened browser"><i class="fa fa-sign-out"></i></a> </span>
</div>
<!-- end logout button -->
<!-- search mobile button (this is hidden till mobile view port) -->
<div id="search-mobile" class="btn-header transparent pull-right">
<span> <a href="javascript:void(0)" title="Search"><i class="fa fa-search"></i></a> </span>
</div>
<!-- end search mobile button -->
<!-- input: search field -->
<form action="search.html" class="header-search pull-right">
<input id="search-fld" type="text" name="param" placeholder="Find reports and more" data-autocomplete='[
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"]'>
<button type="submit">
<i class="fa fa-search"></i>
</button>
<a href="javascript:void(0);" id="cancel-search-js" title="Cancel Search"><i class="fa fa-times"></i></a>
</form>
<!-- end input: search field -->
<!-- fullscreen button -->
<div id="fullscreen" class="btn-header transparent pull-right">
<span> <a href="javascript:void(0);" data-action="launchFullscreen" title="Full Screen"><i class="fa fa-arrows-alt"></i></a> </span>
</div>
<!-- end fullscreen button -->
<!-- #Voice Command: Start Speech -->
<div id="speech-btn" class="btn-header transparent pull-right hidden-sm hidden-xs">
<div>
<a href="javascript:void(0)" title="Voice Command" data-action="voiceCommand"><i class="fa fa-microphone"></i></a>
<div class="popover bottom"><div class="arrow"></div>
<div class="popover-content">
<h4 class="vc-title">Voice command activated <br><small>Please speak clearly into the mic</small></h4>
<h4 class="vc-title-error text-center">
<i class="fa fa-microphone-slash"></i> Voice command failed
<br><small class="txt-color-red">Must <strong>"Allow"</strong> Microphone</small>
<br><small class="txt-color-red">Must have <strong>Internet Connection</strong></small>
</h4>
<a href="javascript:void(0);" class="btn btn-success" onclick="commands.help()">See Commands</a>
<a href="javascript:void(0);" class="btn bg-color-purple txt-color-white" onclick="$('#speech-btn .popover').fadeOut(50);">Close Popup</a>
</div>
</div>
</div>
</div>
<!-- end voice command -->
<!-- multiple lang dropdown : find all flags in the flags page -->
<ul class="header-dropdown-list hidden-xs">
<li>
<a href="#" class="dropdown-toggle" data-toggle="dropdown"> <img src="img/blank.gif" class="flag flag-us" alt="United States"> <span> English (US) </span> <i class="fa fa-angle-down"></i> </a>
<ul class="dropdown-menu pull-right">
<li class="active">
<a href="javascript:void(0);"><img src="img/blank.gif" class="flag flag-us" alt="United States"> English (US)</a>
</li>
<li>
<a href="javascript:void(0);"><img src="img/blank.gif" class="flag flag-fr" alt="France"> Français</a>
</li>
<li>
<a href="javascript:void(0);"><img src="img/blank.gif" class="flag flag-es" alt="Spanish"> Español</a>
</li>
<li>
<a href="javascript:void(0);"><img src="img/blank.gif" class="flag flag-de" alt="German"> Deutsch</a>
</li>
<li>
<a href="javascript:void(0);"><img src="img/blank.gif" class="flag flag-jp" alt="Japan"> 日本語</a>
</li>
<li>
<a href="javascript:void(0);"><img src="img/blank.gif" class="flag flag-cn" alt="China"> 中文</a>
</li>
<li>
<a href="javascript:void(0);"><img src="img/blank.gif" class="flag flag-it" alt="Italy"> Italiano</a>
</li>
<li>
<a href="javascript:void(0);"><img src="img/blank.gif" class="flag flag-pt" alt="Portugal"> Portugal</a>
</li>
<li>
<a href="javascript:void(0);"><img src="img/blank.gif" class="flag flag-ru" alt="Russia"> Русский язык</a>
</li>
<li>
<a href="javascript:void(0);"><img src="img/blank.gif" class="flag flag-kp" alt="Korea"> 한국어</a>
</li>
</ul>
</li>
</ul>
<!-- end multiple lang -->
</div>
<!-- end pulled right: nav area -->
</header>
<!-- END HEADER -->
<!-- Left panel : Navigation area -->
<!-- Note: This width of the aside area can be adjusted through LESS variables -->
<aside id="left-panel">
<!-- User info -->
<div class="login-info">
<span> <!-- User image size is adjusted inside CSS, it should stay as it -->
<a href="javascript:void(0);" id="show-shortcut" data-action="toggleShortcut">
<img src="img/avatars/sunny.png" alt="me" class="online" />
<span>
john.doe
</span>
<i class="fa fa-angle-down"></i>
</a>
</span>
</div>
<!-- end user info -->
<!-- NAVIGATION : This navigation is also responsive
To make this navigation dynamic please make sure to link the node
(the reference to the nav > ul) after page load. Or the navigation
will not initialize.
-->
<nav>
<!-- NOTE: Notice the gaps after each icon usage <i></i>..
Please note that these links work a bit different than
traditional href="" links. See documentation for details.
-->
<ul>
<li class="active">
<a href="index.html" title="Dashboard"><i class="fa fa-lg fa-fw fa-home"></i> <span class="menu-item-parent">Dashboard</span></a>
</li>
<li>
<a href="inbox.html"><i class="fa fa-lg fa-fw fa-inbox"></i> <span class="menu-item-parent">Inbox</span><span class="badge pull-right inbox-badge">14</span></a>
</li>
<li>
<a href="#"><i class="fa fa-lg fa-fw fa-bar-chart-o"></i> <span class="menu-item-parent">Graphs</span></a>
<ul>
<li>
<a href="flot.html">Flot Chart</a>
</li>
<li>
<a href="morris.html">Morris Charts</a>
</li>
<li>
<a href="inline-charts.html">Inline Charts</a>
</li>
<li>
<a href="dygraphs.html">Dygraphs <span class="badge pull-right inbox-badge bg-color-yellow">new</span></a>
</li>
</ul>
</li>
<li>
<a href="#"><i class="fa fa-lg fa-fw fa-table"></i> <span class="menu-item-parent">Tables</span></a>
<ul>
<li>
<a href="table.html">Normal Tables</a>
</li>
<li>
<a href="datatables.html">Data Tables <span class="badge inbox-badge bg-color-greenLight">v1.10</span></a>
</li>
<li>
<a href="jqgrid.html">Jquery Grid</a>
</li>
</ul>
</li>
<li>
<a href="#"><i class="fa fa-lg fa-fw fa-pencil-square-o"></i> <span class="menu-item-parent">Forms</span></a>
<ul>
<li>
<a href="form-elements.html">Smart Form Elements</a>
</li>
<li>
<a href="form-templates.html">Smart Form Layouts</a>
</li>
<li>
<a href="validation.html">Smart Form Validation</a>
</li>
<li>
<a href="bootstrap-forms.html">Bootstrap Form Elements</a>
</li>
<li>
<a href="plugins.html">Form Plugins</a>
</li>
<li>
<a href="wizard.html">Wizards</a>
</li>
<li>
<a href="other-editors.html">Bootstrap Editors</a>
</li>
<li>
<a href="dropzone.html">Dropzone </a>
</li>
<li>
<a href="image-editor.html">Image Cropping <span class="badge pull-right inbox-badge bg-color-yellow">new</span></a>
</li>
</ul>
</li>
<li>
<a href="#"><i class="fa fa-lg fa-fw fa-desktop"></i> <span class="menu-item-parent">UI Elements</span></a>
<ul>
<li>
<a href="general-elements.html">General Elements</a>
</li>
<li>
<a href="buttons.html">Buttons</a>
</li>
<li>
<a href="#">Icons</a>
<ul>
<li>
<a href="fa.html"><i class="fa fa-plane"></i> Font Awesome</a>
</li>
<li>
<a href="glyph.html"><i class="glyphicon glyphicon-plane"></i> Glyph Icons</a>
</li>
<li>
<a href="flags.html"><i class="fa fa-flag"></i> Flags</a>
</li>
</ul>
</li>
<li>
<a href="grid.html">Grid</a>
</li>
<li>
<a href="treeview.html">Tree View</a>
</li>
<li>
<a href="nestable-list.html">Nestable Lists</a>
</li>
<li>
<a href="jqui.html">JQuery UI</a>
</li>
<li>
<a href="typography.html">Typography</a>
</li>
<li>
<a href="#">Six Level Menu</a>
<ul>
<li>
<a href="#"><i class="fa fa-fw fa-folder-open"></i> Item #2</a>
<ul>
<li>
<a href="#"><i class="fa fa-fw fa-folder-open"></i> Sub #2.1 </a>
<ul>
<li>
<a href="#"><i class="fa fa-fw fa-file-text"></i> Item #2.1.1</a>
</li>
<li>
<a href="#"><i class="fa fa-fw fa-plus"></i> Expand</a>
<ul>
<li>
<a href="#"><i class="fa fa-fw fa-file-text"></i> File</a>
</li>
<li>
<a href="#"><i class="fa fa-fw fa-trash-o"></i> Delete</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li>
<a href="#"><i class="fa fa-fw fa-folder-open"></i> Item #3</a>
<ul>
<li>
<a href="#"><i class="fa fa-fw fa-folder-open"></i> 3ed Level </a>
<ul>
<li>
<a href="#"><i class="fa fa-fw fa-file-text"></i> File</a>
</li>
<li>
<a href="#"><i class="fa fa-fw fa-file-text"></i> File</a>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li>
<a href="calendar.html"><i class="fa fa-lg fa-fw fa-calendar"><em>3</em></i> <span class="menu-item-parent">Calendar</span></a>
</li>
<li>
<a href="widgets.html"><i class="fa fa-lg fa-fw fa-list-alt"></i> <span class="menu-item-parent">Widgets</span></a>
</li>
<li>
<a href="gallery.html"><i class="fa fa-lg fa-fw fa-picture-o"></i> <span class="menu-item-parent">Gallery</span></a>
</li>
<li>
<a href="gmap-xml.html"><i class="fa fa-lg fa-fw fa-map-marker"></i> <span class="menu-item-parent">GMap Skins</span><span class="badge bg-color-greenLight pull-right inbox-badge">9</span></a>
</li>
<li>
<a href="#"><i class="fa fa-lg fa-fw fa-windows"></i> <span class="menu-item-parent">Miscellaneous</span></a>
<ul>
<li>
<a href="#"><i class="fa fa-lg fa-fw fa-file"></i> Other Pages</a>
<ul>
<li>
<a href="forum.html">Forum Layout</a>
</li>
<li>
<a href="profile.html">Profile</a>
</li>
<li>
<a href="timeline.html">Timeline</a>
</li>
</ul>
</li>
<li>
<a href="pricing-table.html">Pricing Tables</a>
</li>
<li>
<a href="invoice.html">Invoice</a>
</li>
<li>
<a href="login.html" target="_top">Login</a>
</li>
<li>
<a href="register.html" target="_top">Register</a>
</li>
<li>
<a href="lock.html" target="_top">Locked Screen</a>
</li>
<li>
<a href="error404.html">Error 404</a>
</li>
<li>
<a href="error500.html">Error 500</a>
</li>
<li>
<a href="blank_.html">Blank Page</a>
</li>
<li>
<a href="email-template.html">Email Template</a>
</li>
<li>
<a href="search.html">Search Page</a>
</li>
<li>
<a href="ckeditor.html">CK Editor</a>
</li>
</ul>
</li>
<li class="top-menu-hidden">
<a href="#"><i class="fa fa-lg fa-fw fa-cube txt-color-blue"></i> <span class="menu-item-parent">SmartAdmin Intel</span></a>
<ul>
<li>
<a href="difver.html"><i class="fa fa-stack-overflow"></i> Different Versions</a>
</li>
<li>
<a href="applayout.html"><i class="fa fa-cube"></i> App Settings</a>
</li>
<li>
<a href="http://bootstraphunter.com/smartadmin/BUGTRACK/track_/documentation/index.html" target="_blank"><i class="fa fa-book"></i> Documentation</a>
</li>
<li>
<a href="http://bootstraphunter.com/smartadmin/BUGTRACK/track_/" target="_blank"><i class="fa fa-bug"></i> Bug Tracker</a>
</li>
</ul>
</li>
</ul>
</nav>
<span class="minifyme" data-action="minifyMenu">
<i class="fa fa-arrow-circle-left hit"></i>
</span>
</aside>
<!-- END NAVIGATION -->
<!-- MAIN PANEL -->
<div id="main" role="main">
<!-- RIBBON -->
<div id="ribbon">
<span class="ribbon-button-alignment">
<span id="refresh" class="btn btn-ribbon" data-action="resetWidgets" data-title="refresh" rel="tooltip" data-placement="bottom" data-original-title="<i class='text-warning fa fa-warning'></i> Warning! This will reset all your widget settings." data-html="true">
<i class="fa fa-refresh"></i>
</span>
</span>
<!-- breadcrumb -->
<ol class="breadcrumb">
<li>Home</li><li>Dashboard</li>
</ol>
<!-- end breadcrumb -->
<!-- You can also add more buttons to the
ribbon for further usability
Example below:
<span class="ribbon-button-alignment pull-right">
<span id="search" class="btn btn-ribbon hidden-xs" data-title="search"><i class="fa-grid"></i> Change Grid</span>
<span id="add" class="btn btn-ribbon hidden-xs" data-title="add"><i class="fa-plus"></i> Add</span>
<span id="search" class="btn btn-ribbon" data-title="search"><i class="fa-search"></i> <span class="hidden-mobile">Search</span></span>
</span> -->
</div>
<!-- END RIBBON -->
<!-- MAIN CONTENT -->
<div id="content">
<div class="row">
<div class="col-xs-12 col-sm-7 col-md-7 col-lg-4">
<h1 class="page-title txt-color-blueDark"><i class="fa-fw fa fa-home"></i> Dashboard <span>> My Dashboard</span></h1>
</div>
<div class="col-xs-12 col-sm-5 col-md-5 col-lg-8">
<ul id="sparks" class="">
<li class="sparks-info">
<h5> My Income <span class="txt-color-blue">$47,171</span></h5>
<div class="sparkline txt-color-blue hidden-mobile hidden-md hidden-sm">
1300, 1877, 2500, 2577, 2000, 2100, 3000, 2700, 3631, 2471, 2700, 3631, 2471
</div>
</li>
<li class="sparks-info">
<h5> Site Traffic <span class="txt-color-purple"><i class="fa fa-arrow-circle-up"></i> 45%</span></h5>
<div class="sparkline txt-color-purple hidden-mobile hidden-md hidden-sm">
110,150,300,130,400,240,220,310,220,300, 270, 210
</div>
</li>
<li class="sparks-info">
<h5> Site Orders <span class="txt-color-greenDark"><i class="fa fa-shopping-cart"></i> 2447</span></h5>
<div class="sparkline txt-color-greenDark hidden-mobile hidden-md hidden-sm">
110,150,300,130,400,240,220,310,220,300, 270, 210
</div>
</li>
</ul>
</div>
</div>
<!-- widget grid -->
<section id="widget-grid" class="">
<!-- row -->
<div class="row">
<article class="col-sm-12">
<!-- new widget -->
<div class="jarviswidget" id="wid-id-0" data-widget-togglebutton="false" data-widget-editbutton="false" data-widget-fullscreenbutton="false" data-widget-colorbutton="false" data-widget-deletebutton="false">
<!-- widget options:
usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false">
data-widget-colorbutton="false"
data-widget-editbutton="false"
data-widget-togglebutton="false"
data-widget-deletebutton="false"
data-widget-fullscreenbutton="false"
data-widget-custombutton="false"
data-widget-collapsed="true"
data-widget-sortable="false"
-->
<header>
<span class="widget-icon"> <i class="glyphicon glyphicon-stats txt-color-darken"></i> </span>
<h2>Live Feeds </h2>
<ul class="nav nav-tabs pull-right in" id="myTab">
<li class="active">
<a data-toggle="tab" href="#s1"><i class="fa fa-clock-o"></i> <span class="hidden-mobile hidden-tablet">Live Stats</span></a>
</li>
<li>
<a data-toggle="tab" href="#s2"><i class="fa fa-facebook"></i> <span class="hidden-mobile hidden-tablet">Social Network</span></a>
</li>
<li>
<a data-toggle="tab" href="#s3"><i class="fa fa-dollar"></i> <span class="hidden-mobile hidden-tablet">Revenue</span></a>
</li>
</ul>
</header>
<!-- widget div-->
<div class="no-padding">
<!-- widget edit box -->
<div class="jarviswidget-editbox">
test
</div>
<!-- end widget edit box -->
<div class="widget-body">
<!-- content -->
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in padding-10 no-padding-bottom" id="s1">
<div class="row no-space">
<div class="col-xs-12 col-sm-12 col-md-8 col-lg-8">
<span class="demo-liveupdate-1"> <span class="onoffswitch-title">Live switch</span> <span class="onoffswitch">
<input type="checkbox" name="start_interval" class="onoffswitch-checkbox" id="start_interval">
<label class="onoffswitch-label" for="start_interval">
<span class="onoffswitch-inner" data-swchon-text="ON" data-swchoff-text="OFF"></span>
<span class="onoffswitch-switch"></span> </label> </span> </span>
<div id="updating-chart" class="chart-large txt-color-blue"></div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4 show-stats">
<div class="row">
<div class="col-xs-6 col-sm-6 col-md-12 col-lg-12"> <span class="text"> My Tasks <span class="pull-right">130/200</span> </span>
<div class="progress">
<div class="progress-bar bg-color-blueDark" style="width: 65%;"></div>
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-12 col-lg-12"> <span class="text"> Transfered <span class="pull-right">440 GB</span> </span>
<div class="progress">
<div class="progress-bar bg-color-blue" style="width: 34%;"></div>
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-12 col-lg-12"> <span class="text"> Bugs Squashed<span class="pull-right">77%</span> </span>
<div class="progress">
<div class="progress-bar bg-color-blue" style="width: 77%;"></div>
</div> </div>
<div class="col-xs-6 col-sm-6 col-md-12 col-lg-12"> <span class="text"> User Testing <span class="pull-right">7 Days</span> </span>
<div class="progress">
<div class="progress-bar bg-color-greenLight" style="width: 84%;"></div>
</div> </div>
<span class="show-stat-buttons"> <span class="col-xs-12 col-sm-6 col-md-6 col-lg-6"> <a href="javascript:void(0);" class="btn btn-default btn-block hidden-xs">Generate PDF</a> </span> <span class="col-xs-12 col-sm-6 col-md-6 col-lg-6"> <a href="javascript:void(0);" class="btn btn-default btn-block hidden-xs">Report a bug</a> </span> </span>
</div>
</div>
</div>
<div class="show-stat-microcharts">
<div class="col-xs-12 col-sm-3 col-md-3 col-lg-3">
<div class="easy-pie-chart txt-color-orangeDark" data-percent="33" data-pie-size="50">
<span class="percent percent-sign">35</span>
</div>
<span class="easy-pie-title"> Server Load <i class="fa fa-caret-up icon-color-bad"></i> </span>
<ul class="smaller-stat hidden-sm pull-right">
<li>
<span class="label bg-color-greenLight"><i class="fa fa-caret-up"></i> 97%</span>
</li>
<li>
<span class="label bg-color-blueLight"><i class="fa fa-caret-down"></i> 44%</span>
</li>
</ul>
<div class="sparkline txt-color-greenLight hidden-sm hidden-md pull-right" data-sparkline-type="line" data-sparkline-height="33px" data-sparkline-width="70px" data-fill-color="transparent">
130, 187, 250, 257, 200, 210, 300, 270, 363, 247, 270, 363, 247
</div>
</div>
<div class="col-xs-12 col-sm-3 col-md-3 col-lg-3">
<div class="easy-pie-chart txt-color-greenLight" data-percent="78.9" data-pie-size="50">
<span class="percent percent-sign">78.9 </span>
</div>
<span class="easy-pie-title"> Disk Space <i class="fa fa-caret-down icon-color-good"></i></span>
<ul class="smaller-stat hidden-sm pull-right">
<li>
<span class="label bg-color-blueDark"><i class="fa fa-caret-up"></i> 76%</span>
</li>
<li>
<span class="label bg-color-blue"><i class="fa fa-caret-down"></i> 3%</span>
</li>
</ul>
<div class="sparkline txt-color-blue hidden-sm hidden-md pull-right" data-sparkline-type="line" data-sparkline-height="33px" data-sparkline-width="70px" data-fill-color="transparent">
257, 200, 210, 300, 270, 363, 130, 187, 250, 247, 270, 363, 247
</div>
</div>
<div class="col-xs-12 col-sm-3 col-md-3 col-lg-3">
<div class="easy-pie-chart txt-color-blue" data-percent="23" data-pie-size="50">
<span class="percent percent-sign">23 </span>
</div>
<span class="easy-pie-title"> Transfered <i class="fa fa-caret-up icon-color-good"></i></span>
<ul class="smaller-stat hidden-sm pull-right">
<li>
<span class="label bg-color-darken">10GB</span>
</li>
<li>
<span class="label bg-color-blueDark"><i class="fa fa-caret-up"></i> 10%</span>
</li>
</ul>
<div class="sparkline txt-color-darken hidden-sm hidden-md pull-right" data-sparkline-type="line" data-sparkline-height="33px" data-sparkline-width="70px" data-fill-color="transparent">
200, 210, 363, 247, 300, 270, 130, 187, 250, 257, 363, 247, 270
</div>
</div>
<div class="col-xs-12 col-sm-3 col-md-3 col-lg-3">
<div class="easy-pie-chart txt-color-darken" data-percent="36" data-pie-size="50">
<span class="percent degree-sign">36 <i class="fa fa-caret-up"></i></span>
</div>
<span class="easy-pie-title"> Temperature <i class="fa fa-caret-down icon-color-good"></i></span>
<ul class="smaller-stat hidden-sm pull-right">
<li>
<span class="label bg-color-red"><i class="fa fa-caret-up"></i> 124</span>
</li>
<li>
<span class="label bg-color-blue"><i class="fa fa-caret-down"></i> 40 F</span>
</li>
</ul>
<div class="sparkline txt-color-red hidden-sm hidden-md pull-right" data-sparkline-type="line" data-sparkline-height="33px" data-sparkline-width="70px" data-fill-color="transparent">
2700, 3631, 2471, 2700, 3631, 2471, 1300, 1877, 2500, 2577, 2000, 2100, 3000
</div>
</div>
</div>
</div>
<!-- end s1 tab pane -->
<div class="tab-pane fade" id="s2">
<div class="widget-body-toolbar bg-color-white">
<form class="form-inline" role="form">
<div class="form-group">
<label class="sr-only" for="s123">Show From</label>
<input type="email" class="form-control input-sm" id="s123" placeholder="Show From">
</div>
<div class="form-group">
<input type="email" class="form-control input-sm" id="s124" placeholder="To">
</div>
<div class="btn-group hidden-phone pull-right">
<a class="btn dropdown-toggle btn-xs btn-default" data-toggle="dropdown"><i class="fa fa-cog"></i> More <span class="caret"> </span> </a>
<ul class="dropdown-menu pull-right">
<li>
<a href="javascript:void(0);"><i class="fa fa-file-text-alt"></i> Export to PDF</a>
</li>
<li>
<a href="javascript:void(0);"><i class="fa fa-question-sign"></i> Help</a>
</li>
</ul>
</div>
</form>
</div>
<div class="padding-10">
<div id="statsChart" class="chart-large has-legend-unique"></div>
</div>
</div>
<!-- end s2 tab pane -->
<div class="tab-pane fade" id="s3">
<div class="widget-body-toolbar bg-color-white smart-form" id="rev-toggles">
<div class="inline-group">
<label for="gra-0" class="checkbox">
<input type="checkbox" name="gra-0" id="gra-0" checked="checked">
<i></i> Target </label>
<label for="gra-1" class="checkbox">
<input type="checkbox" name="gra-1" id="gra-1" checked="checked">
<i></i> Actual </label>
<label for="gra-2" class="checkbox">
<input type="checkbox" name="gra-2" id="gra-2" checked="checked">
<i></i> Signups </label>
</div>
<div class="btn-group hidden-phone pull-right">
<a class="btn dropdown-toggle btn-xs btn-default" data-toggle="dropdown"><i class="fa fa-cog"></i> More <span class="caret"> </span> </a>
<ul class="dropdown-menu pull-right">
<li>
<a href="javascript:void(0);"><i class="fa fa-file-text-alt"></i> Export to PDF</a>
</li>
<li>
<a href="javascript:void(0);"><i class="fa fa-question-sign"></i> Help</a>
</li>
</ul>
</div>
</div>
<div class="padding-10">
<div id="flotcontainer" class="chart-large has-legend-unique"></div>
</div>
</div>
<!-- end s3 tab pane -->
</div>
<!-- end content -->
</div>
</div>
<!-- end widget div -->
</div>
<!-- end widget -->
</article>
</div>
<!-- end row -->
<!-- row -->
<div class="row">
<article class="col-sm-12 col-md-12 col-lg-6">
<!-- new widget -->
<div class="jarviswidget jarviswidget-color-blueDark" id="wid-id-1" data-widget-editbutton="false" data-widget-fullscreenbutton="false">
<!-- widget options:
usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false">
data-widget-colorbutton="false"
data-widget-editbutton="false"
data-widget-togglebutton="false"
data-widget-deletebutton="false"
data-widget-fullscreenbutton="false"
data-widget-custombutton="false"
data-widget-collapsed="true"
data-widget-sortable="false"
-->
<header>
<span class="widget-icon"> <i class="fa fa-comments txt-color-white"></i> </span>
<h2> SmartChat </h2>
<div class="widget-toolbar">
<!-- add: non-hidden - to disable auto hide -->
<div class="btn-group">
<button class="btn dropdown-toggle btn-xs btn-success" data-toggle="dropdown">
Status <i class="fa fa-caret-down"></i>
</button>
<ul class="dropdown-menu pull-right js-status-update">
<li>
<a href="javascript:void(0);"><i class="fa fa-circle txt-color-green"></i> Online</a>
</li>
<li>
<a href="javascript:void(0);"><i class="fa fa-circle txt-color-red"></i> Busy</a>
</li>
<li>
<a href="javascript:void(0);"><i class="fa fa-circle txt-color-orange"></i> Away</a>
</li>
<li class="divider"></li>
<li>
<a href="javascript:void(0);"><i class="fa fa-power-off"></i> Log Off</a>
</li>
</ul>
</div>
</div>
</header>
<!-- widget div-->
<div>
<!-- widget edit box -->
<div class="jarviswidget-editbox">
<div>
<label>Title:</label>
<input type="text" />
</div>
</div>
<!-- end widget edit box -->
<div class="widget-body widget-hide-overflow no-padding">
<!-- content goes here -->
<!-- CHAT CONTAINER -->
<div id="chat-container">
<span class="chat-list-open-close"><i class="fa fa-user"></i><b>!</b></span>
<div class="chat-list-body custom-scroll">
<ul id="chat-users">
<li>
<a href="javascript:void(0);"><img src="img/avatars/5.png" alt="">Robin Berry <span class="badge badge-inverse">23</span><span class="state"><i class="fa fa-circle txt-color-green pull-right"></i></span></a>
</li>
<li>
<a href="javascript:void(0);"><img src="img/avatars/male.png" alt="">Mark Zeukartech <span class="state"><i class="last-online pull-right">2hrs</i></span></a>
</li>
<li>
<a href="javascript:void(0);"><img src="img/avatars/male.png" alt="">Belmain Dolson <span class="state"><i class="last-online pull-right">45m</i></span></a>
</li>
<li>
<a href="javascript:void(0);"><img src="img/avatars/male.png" alt="">Galvitch Drewbery <span class="state"><i class="fa fa-circle txt-color-green pull-right"></i></span></a>
</li>
<li>
<a href="javascript:void(0);"><img src="img/avatars/male.png" alt="">Sadi Orlaf <span class="state"><i class="fa fa-circle txt-color-green pull-right"></i></span></a>
</li>
<li>
<a href="javascript:void(0);"><img src="img/avatars/male.png" alt="">Markus <span class="state"><i class="last-online pull-right">2m</i></span> </a>
</li>
<li>
<a href="javascript:void(0);"><img src="img/avatars/sunny.png" alt="">Sunny <span class="state"><i class="last-online pull-right">2m</i></span> </a>
</li>
<li>
<a href="javascript:void(0);"><img src="img/avatars/male.png" alt="">Denmark <span class="state"><i class="last-online pull-right">2m</i></span> </a>
</li>
</ul>
</div>
<div class="chat-list-footer">
<div class="control-group">
<form class="smart-form">
<section>
<label class="input">
<input type="text" id="filter-chat-list" placeholder="Filter">
</label>
</section>
</form>
</div>
</div>
</div>
<!-- CHAT BODY -->
<div id="chat-body" class="chat-body custom-scroll">
<ul>
<li class="message">
<img src="img/avatars/5.png" class="online" alt="">
<div class="message-text">
<time>
2014-01-13
</time> <a href="javascript:void(0);" class="username">Sadi Orlaf</a> Hey did you meet the new board of director? He's a bit of an arse if you ask me...anyway here is the report you requested. I am off to launch with Lisa and Andrew, you wanna join?
<p class="chat-file row">
<b class="pull-left col-sm-6"> <!--<i class="fa fa-spinner fa-spin"></i>--> <i class="fa fa-file"></i> report-2013-demographic-report-annual-earnings.xls </b>
<span class="col-sm-6 pull-right"> <a href="javascript:void(0);" class="btn btn-xs btn-default">cancel</a> <a href="javascript:void(0);" class="btn btn-xs btn-success">save</a> </span>
</p>
<p class="chat-file row">
<b class="pull-left col-sm-6"> <i class="fa fa-ok txt-color-green"></i> tobacco-report-2012.doc </b>
<span class="col-sm-6 pull-right"> <a href="javascript:void(0);" class="btn btn-xs btn-primary">open</a> </span>
</p> </div>
</li>
<li class="message">
<img src="img/avatars/sunny.png" class="online" alt="">
<div class="message-text">
<time>
2014-01-13
</time> <a href="javascript:void(0);" class="username">John Doe</a> Haha! Yeah I know what you mean. Thanks for the file Sadi! <i class="fa fa-smile-o txt-color-orange"></i>
</div>
</li>
</ul>
</div>
<!-- CHAT FOOTER -->
<div class="chat-footer">
<!-- CHAT TEXTAREA -->
<div class="textarea-div">
<div class="typearea">
<textarea placeholder="Write a reply..." id="textarea-expand" class="custom-scroll"></textarea>
</div>
</div>
<!-- CHAT REPLY/SEND -->
<span class="textarea-controls">
<button class="btn btn-sm btn-primary pull-right">
Reply
</button> <span class="pull-right smart-form" style="margin-top: 3px; margin-right: 10px;"> <label class="checkbox pull-right">
<input type="checkbox" name="subscription" id="subscription">
<i></i>Press <strong> ENTER </strong> to send </label> </span> <a href="javascript:void(0);" class="pull-left"><i class="fa fa-camera fa-fw fa-lg"></i></a> </span>
</div>
<!-- end content -->
</div>
</div>
<!-- end widget div -->
</div>
<!-- end widget -->
<!-- new widget -->
<div class="jarviswidget jarviswidget-color-blueDark" id="wid-id-3" data-widget-colorbutton="false">
<!-- widget options:
usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false">
data-widget-colorbutton="false"
data-widget-editbutton="false"
data-widget-togglebutton="false"
data-widget-deletebutton="false"
data-widget-fullscreenbutton="false"
data-widget-custombutton="false"
data-widget-collapsed="true"
data-widget-sortable="false"
-->
<header>
<span class="widget-icon"> <i class="fa fa-calendar"></i> </span>
<h2> My Events </h2>
<div class="widget-toolbar">
<!-- add: non-hidden - to disable auto hide -->
<div class="btn-group">
<button class="btn dropdown-toggle btn-xs btn-default" data-toggle="dropdown">
Showing <i class="fa fa-caret-down"></i>
</button>
<ul class="dropdown-menu js-status-update pull-right">
<li>
<a href="javascript:void(0);" id="mt">Month</a>
</li>
<li>
<a href="javascript:void(0);" id="ag">Agenda</a>
</li>
<li>
<a href="javascript:void(0);" id="td">Today</a>
</li>
</ul>
</div>
</div>
</header>
<!-- widget div-->
<div>
<!-- widget edit box -->
<div class="jarviswidget-editbox">
<input class="form-control" type="text">
</div>
<!-- end widget edit box -->
<div class="widget-body no-padding">
<!-- content goes here -->
<div class="widget-body-toolbar">
<div id="calendar-buttons">
<div class="btn-group">
<a href="javascript:void(0)" class="btn btn-default btn-xs" id="btn-prev"><i class="fa fa-chevron-left"></i></a>
<a href="javascript:void(0)" class="btn btn-default btn-xs" id="btn-next"><i class="fa fa-chevron-right"></i></a>
</div>
</div>
</div>
<div id="calendar"></div>
<!-- end content -->
</div>
</div>
<!-- end widget div -->
</div>
<!-- end widget -->
</article>
<article class="col-sm-12 col-md-12 col-lg-6">
<!-- new widget -->
<div class="jarviswidget" id="wid-id-2" data-widget-colorbutton="false" data-widget-editbutton="false">
<!-- widget options:
usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false">
data-widget-colorbutton="false"
data-widget-editbutton="false"
data-widget-togglebutton="false"
data-widget-deletebutton="false"
data-widget-fullscreenbutton="false"
data-widget-custombutton="false"
data-widget-collapsed="true"
data-widget-sortable="false"
-->
<header>
<span class="widget-icon"> <i class="fa fa-map-marker"></i> </span>
<h2>Birds Eye</h2>
<div class="widget-toolbar hidden-mobile">
<span class="onoffswitch-title"><i class="fa fa-location-arrow"></i> Realtime</span>
<span class="onoffswitch">
<input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" checked="checked" id="myonoffswitch">
<label class="onoffswitch-label" for="myonoffswitch"> <span class="onoffswitch-inner" data-swchon-text="YES" data-swchoff-text="NO"></span> <span class="onoffswitch-switch"></span> </label> </span>
</div>
</header>
<!-- widget div-->
<div>
<!-- widget edit box -->
<div class="jarviswidget-editbox">
<div>
<label>Title:</label>
<input type="text" />
</div>
</div>
<!-- end widget edit box -->
<div class="widget-body no-padding">
<!-- content goes here -->
<div id="vector-map" class="vector-map"></div>
<div id="heat-fill">
<span class="fill-a">0</span>
<span class="fill-b">5,000</span>
</div>
<table class="table table-striped table-hover table-condensed">
<thead>
<tr>
<th>Country</th>
<th>Visits</th>
<th class="text-align-center">User Activity</th>
<th class="text-align-center">Online</th>
<th class="text-align-center">Demographic</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="javascript:void(0);">USA</a></td>
<td>4,977</td>
<td class="text-align-center">
<div class="sparkline txt-color-blue text-align-center" data-sparkline-height="22px" data-sparkline-width="90px" data-sparkline-barwidth="2">
2700, 3631, 2471, 1300, 1877, 2500, 2577, 2700, 3631, 2471, 2000, 2100, 3000
</div></td>
<td class="text-align-center">143</td>
<td class="text-align-center">
<div class="sparkline display-inline" data-sparkline-type='pie' data-sparkline-piecolor='["#E979BB", "#57889C"]' data-sparkline-offset="90" data-sparkline-piesize="23px">
17,83
</div>
<div class="btn-group display-inline pull-right text-align-left hidden-tablet">
<button class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-cog fa-lg"></i>
</button>
<ul class="dropdown-menu dropdown-menu-xs pull-right">
<li>
<a href="javascript:void(0);"><i class="fa fa-file fa-lg fa-fw txt-color-greenLight"></i> <u>P</u>DF</a>
</li>
<li>
<a href="javascript:void(0);"><i class="fa fa-times fa-lg fa-fw txt-color-red"></i> <u>D</u>elete</a>
</li>
<li class="divider"></li>
<li class="text-align-center">
<a href="javascript:void(0);">Cancel</a>
</li>
</ul>
</div></td>
</tr>
<tr>
<td><a href="javascript:void(0);">Australia</a></td>
<td>4,873</td>
<td class="text-align-center">
<div class="sparkline txt-color-blue text-align-center" data-sparkline-height="22px" data-sparkline-width="90px" data-sparkline-barwidth="2">
1000, 1100, 3030, 1300, -1877, -2500, -2577, -2700, 3631, 2471, 4700, 1631, 2471
</div></td>
<td class="text-align-center">247</td>
<td class="text-align-center">
<div class="sparkline display-inline" data-sparkline-type='pie' data-sparkline-piecolor='["#E979BB", "#57889C"]' data-sparkline-offset="90" data-sparkline-piesize="23px">
22,88
</div>
<div class="btn-group display-inline pull-right text-align-left hidden-tablet">
<button class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-cog fa-lg"></i>
</button>
<ul class="dropdown-menu dropdown-menu-xs pull-right">
<li>
<a href="javascript:void(0);"><i class="fa fa-file fa-lg fa-fw txt-color-greenLight"></i> <u>P</u>DF</a>
</li>
<li>
<a href="javascript:void(0);"><i class="fa fa-times fa-lg fa-fw txt-color-red"></i> <u>D</u>elete</a>
</li>
<li class="divider"></li>
<li class="text-align-center">
<a href="javascript:void(0);">Cancel</a>
</li>
</ul>
</div></td>
</tr>
<tr>
<td><a href="javascript:void(0);">India</a></td>
<td>3,671</td>
<td class="text-align-center">
<div class="sparkline txt-color-blue text-align-center" data-sparkline-height="22px" data-sparkline-width="90px" data-sparkline-barwidth="2">
3631, 1471, 2400, 3631, 471, 1300, 1177, 2500, 2577, 3000, 4100, 3000, 7700
</div></td>
<td class="text-align-center">373</td>
<td class="text-align-center">
<div class="sparkline display-inline" data-sparkline-type='pie' data-sparkline-piecolor='["#E979BB", "#57889C"]' data-sparkline-offset="90" data-sparkline-piesize="23px">
10,90
</div>
<div class="btn-group display-inline pull-right text-align-left hidden-tablet">
<button class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-cog fa-lg"></i>
</button>
<ul class="dropdown-menu dropdown-menu-xs pull-right">
<li>
<a href="javascript:void(0);"><i class="fa fa-file fa-lg fa-fw txt-color-greenLight"></i> <u>P</u>DF</a>
</li>
<li>
<a href="javascript:void(0);"><i class="fa fa-times fa-lg fa-fw txt-color-red"></i> <u>D</u>elete</a>
</li>
<li class="divider"></li>
<li class="text-align-center">
<a href="javascript:void(0);">Cancel</a>
</li>
</ul>
</div></td>
</tr>
<tr>
<td><a href="javascript:void(0);">Brazil</a></td>
<td>2,476</td>
<td class="text-align-center">
<div class="sparkline txt-color-blue text-align-center" data-sparkline-height="22px" data-sparkline-width="90px" data-sparkline-barwidth="2">
2700, 1877, 2500, 2577, 2000, 3631, 2471, -2700, -3631, 2471, 1300, 2100, 3000,
</div></td>
<td class="text-align-center">741</td>
<td class="text-align-center">
<div class="sparkline display-inline" data-sparkline-type='pie' data-sparkline-piecolor='["#E979BB", "#57889C"]' data-sparkline-offset="90" data-sparkline-piesize="23px">
34,66
</div>
<div class="btn-group display-inline pull-right text-align-left hidden-tablet">
<button class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-cog fa-lg"></i>
</button>
<ul class="dropdown-menu dropdown-menu-xs pull-right">
<li>
<a href="javascript:void(0);"><i class="fa fa-file fa-lg fa-fw txt-color-greenLight"></i> <u>P</u>DF</a>
</li>
<li>
<a href="javascript:void(0);"><i class="fa fa-times fa-lg fa-fw txt-color-red"></i> <u>D</u>elete</a>
</li>
<li class="divider"></li>
<li class="text-align-center">
<a href="javascript:void(0);">Cancel</a>
</li>
</ul>
</div></td>
</tr>
<tr>
<td><a href="javascript:void(0);">Turkey</a></td>
<td>1,476</td>
<td class="text-align-center">
<div class="sparkline txt-color-blue text-align-center" data-sparkline-height="22px" data-sparkline-width="90px" data-sparkline-barwidth="2">
1300, 1877, 2500, 2577, 2000, 2100, 3000, -2471, -2700, -3631, -2471, 2700, 3631
</div></td>
<td class="text-align-center">123</td>
<td class="text-align-center">
<div class="sparkline display-inline" data-sparkline-type='pie' data-sparkline-piecolor='["#E979BB", "#57889C"]' data-sparkline-offset="90" data-sparkline-piesize="23px">
75,25
</div>
<div class="btn-group display-inline pull-right text-align-left hidden-tablet">
<button class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-cog fa-lg"></i>
</button>
<ul class="dropdown-menu dropdown-menu-xs pull-right">
<li>
<a href="javascript:void(0);"><i class="fa fa-file fa-lg fa-fw txt-color-greenLight"></i> <u>P</u>DF</a>
</li>
<li>
<a href="javascript:void(0);"><i class="fa fa-times fa-lg fa-fw txt-color-red"></i> <u>D</u>elete</a>
</li>
<li class="divider"></li>
<li class="text-align-center">
<a href="javascript:void(0);">Cancel</a>
</li>
</ul>
</div></td>
</tr>
<tr>
<td><a href="javascript:void(0);">Canada</a></td>
<td>146</td>
<td class="text-align-center">
<div class="sparkline txt-color-orange text-align-center" data-sparkline-height="22px" data-sparkline-width="90px" data-sparkline-barwidth="2">
5, 34, 10, 1, 4, 6, -9, -1, 0, 0, 5, 6, 7
</div></td>
<td class="text-align-center">23</td>
<td class="text-align-center">
<div class="sparkline display-inline" data-sparkline-type='pie' data-sparkline-piecolor='["#E979BB", "#57889C"]' data-sparkline-offset="90" data-sparkline-piesize="23px">
50,50
</div>
<div class="btn-group display-inline pull-right text-align-left hidden-tablet">
<button class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-cog fa-lg"></i>
</button>
<ul class="dropdown-menu dropdown-menu-xs pull-right">
<li>
<a href="javascript:void(0);"><i class="fa fa-file fa-lg fa-fw txt-color-greenLight"></i> <u>P</u>DF</a>
</li>
<li>
<a href="javascript:void(0);"><i class="fa fa-times fa-lg fa-fw txt-color-red"></i> <u>D</u>elete</a>
</li>
<li class="divider"></li>
<li class="text-align-center">
<a href="javascript:void(0);">Cancel</a>
</li>
</ul>
</div></td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan=5>
<ul class="pagination pagination-xs no-margin">
<li class="prev disabled">
<a href="javascript:void(0);">Previous</a>
</li>
<li class="active">
<a href="javascript:void(0);">1</a>
</li>
<li>
<a href="javascript:void(0);">2</a>
</li>
<li>
<a href="javascript:void(0);">3</a>
</li>
<li class="next">
<a href="javascript:void(0);">Next</a>
</li>
</ul></td>
</tr>
</tfoot>
</table>
<!-- end content -->
</div>
</div>
<!-- end widget div -->
</div>
<!-- end widget -->
<!-- new widget -->
<div class="jarviswidget jarviswidget-color-blue" id="wid-id-4" data-widget-editbutton="false" data-widget-colorbutton="false">
<!-- widget options:
usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false">
data-widget-colorbutton="false"
data-widget-editbutton="false"
data-widget-togglebutton="false"
data-widget-deletebutton="false"
data-widget-fullscreenbutton="false"
data-widget-custombutton="false"
data-widget-collapsed="true"
data-widget-sortable="false"
-->
<header>
<span class="widget-icon"> <i class="fa fa-check txt-color-white"></i> </span>
<h2> ToDo's </h2>
<!-- <div class="widget-toolbar">
add: non-hidden - to disable auto hide
</div>-->
</header>
<!-- widget div-->
<div>
<!-- widget edit box -->
<div class="jarviswidget-editbox">
<div>
<label>Title:</label>
<input type="text" />
</div>
</div>
<!-- end widget edit box -->
<div class="widget-body no-padding smart-form">
<!-- content goes here -->
<h5 class="todo-group-title"><i class="fa fa-warning"></i> Critical Tasks (<small class="num-of-tasks">1</small>)</h5>
<ul id="sortable1" class="todo">
<li>
<span class="handle"> <label class="checkbox">
<input type="checkbox" name="checkbox-inline">
<i></i> </label> </span>
<p>
<strong>Ticket #17643</strong> - Hotfix for WebApp interface issue [<a href="javascript:void(0);" class="font-xs">More Details</a>] <span class="text-muted">Sea deep blessed bearing under darkness from God air living isn't. </span>
<span class="date">Jan 1, 2014</span>
</p>
</li>
</ul>
<h5 class="todo-group-title"><i class="fa fa-exclamation"></i> Important Tasks (<small class="num-of-tasks">3</small>)</h5>
<ul id="sortable2" class="todo">
<li>
<span class="handle"> <label class="checkbox">
<input type="checkbox" name="checkbox-inline">
<i></i> </label> </span>
<p>
<strong>Ticket #1347</strong> - Inbox email is being sent twice <small>(bug fix)</small> [<a href="javascript:void(0);" class="font-xs">More Details</a>] <span class="date">Nov 22, 2013</span>
</p>
</li>
<li>
<span class="handle"> <label class="checkbox">
<input type="checkbox" name="checkbox-inline">
<i></i> </label> </span>
<p>
<strong>Ticket #1314</strong> - Call customer support re: Issue <a href="javascript:void(0);" class="font-xs">#6134</a><small>(code review)</small>
<span class="date">Nov 22, 2013</span>
</p>
</li>
<li>
<span class="handle"> <label class="checkbox">
<input type="checkbox" name="checkbox-inline">
<i></i> </label> </span>
<p>
<strong>Ticket #17643</strong> - Hotfix for WebApp interface issue [<a href="javascript:void(0);" class="font-xs">More Details</a>] <span class="text-muted">Sea deep blessed bearing under darkness from God air living isn't. </span>
<span class="date">Jan 1, 2014</span>
</p>
</li>
</ul>
<h5 class="todo-group-title"><i class="fa fa-check"></i> Completed Tasks (<small class="num-of-tasks">1</small>)</h5>
<ul id="sortable3" class="todo">
<li class="complete">
<span class="handle" style="display:none"> <label class="checkbox state-disabled">
<input type="checkbox" name="checkbox-inline" checked="checked" disabled="disabled">
<i></i> </label> </span>
<p>
<strong>Ticket #17643</strong> - Hotfix for WebApp interface issue [<a href="javascript:void(0);" class="font-xs">More Details</a>] <span class="text-muted">Sea deep blessed bearing under darkness from God air living isn't. </span>
<span class="date">Jan 1, 2014</span>
</p>
</li>
</ul>
<!-- end content -->
</div>
</div>
<!-- end widget div -->
</div>
<!-- end widget -->
</article>
</div>
<!-- end row -->
</section>
<!-- end widget grid -->
</div>
<!-- END MAIN CONTENT -->
</div>
<!-- END MAIN PANEL -->
<!-- PAGE FOOTER -->
<div class="page-footer">
<div class="row">
<div class="col-xs-12 col-sm-6">
<span class="txt-color-white">SmartAdmin WebApp © 2013-2014</span>
</div>
<div class="col-xs-6 col-sm-6 text-right hidden-xs">
<div class="txt-color-white inline-block">
<i class="txt-color-blueLight hidden-mobile">Last account activity <i class="fa fa-clock-o"></i> <strong>52 mins ago </strong> </i>
<div class="btn-group dropup">
<button class="btn btn-xs dropdown-toggle bg-color-blue txt-color-white" data-toggle="dropdown">
<i class="fa fa-link"></i> <span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right text-left">
<li>
<div class="padding-5">
<p class="txt-color-darken font-sm no-margin">Download Progress</p>
<div class="progress progress-micro no-margin">
<div class="progress-bar progress-bar-success" style="width: 50%;"></div>
</div>
</div>
</li>
<li class="divider"></li>
<li>
<div class="padding-5">
<p class="txt-color-darken font-sm no-margin">Server Load</p>
<div class="progress progress-micro no-margin">
<div class="progress-bar progress-bar-success" style="width: 20%;"></div>
</div>
</div>
</li>
<li class="divider"></li>
<li>
<div class="padding-5">
<p class="txt-color-darken font-sm no-margin">Memory Load <span class="text-danger">*critical*</span></p>
<div class="progress progress-micro no-margin">
<div class="progress-bar progress-bar-danger" style="width: 70%;"></div>
</div>
</div>
</li>
<li class="divider"></li>
<li>
<div class="padding-5">
<button class="btn btn-block btn-default">refresh</button>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<!-- END PAGE FOOTER -->
<!-- SHORTCUT AREA : With large tiles (activated via clicking user name tag)
Note: These tiles are completely responsive,
you can add as many as you like
-->
<div id="shortcut">
<ul>
<li>
<a href="#inbox.html" class="jarvismetro-tile big-cubes bg-color-blue"> <span class="iconbox"> <i class="fa fa-envelope fa-4x"></i> <span>Mail <span class="label pull-right bg-color-darken">14</span></span> </span> </a>
</li>
<li>
<a href="#calendar.html" class="jarvismetro-tile big-cubes bg-color-orangeDark"> <span class="iconbox"> <i class="fa fa-calendar fa-4x"></i> <span>Calendar</span> </span> </a>
</li>
<li>
<a href="#gmap-xml.html" class="jarvismetro-tile big-cubes bg-color-purple"> <span class="iconbox"> <i class="fa fa-map-marker fa-4x"></i> <span>Maps</span> </span> </a>
</li>
<li>
<a href="#invoice.html" class="jarvismetro-tile big-cubes bg-color-blueDark"> <span class="iconbox"> <i class="fa fa-book fa-4x"></i> <span>Invoice <span class="label pull-right bg-color-darken">99</span></span> </span> </a>
</li>
<li>
<a href="#gallery.html" class="jarvismetro-tile big-cubes bg-color-greenLight"> <span class="iconbox"> <i class="fa fa-picture-o fa-4x"></i> <span>Gallery </span> </span> </a>
</li>
<li>
<a href="javascript:void(0);" class="jarvismetro-tile big-cubes selected bg-color-pinkDark"> <span class="iconbox"> <i class="fa fa-user fa-4x"></i> <span>My Profile </span> </span> </a>
</li>
</ul>
</div>
<!-- END SHORTCUT AREA -->
<!--================================================== -->
<!-- PACE LOADER - turn this on if you want ajax loading to show (caution: uses lots of memory on iDevices)-->
<script data-pace-options='{ "restartOnRequestAfter": true }' src="js/plugin/pace/pace.min.js"></script>
<!-- Link to Google CDN's jQuery + jQueryUI; fall back to local -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<script>
if (!window.jQuery) {
document.write('<script src="js/libs/jquery-2.0.2.min.js"><\/script>');
}
</script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<script>
if (!window.jQuery.ui) {
document.write('<script src="js/libs/jquery-ui-1.10.3.min.js"><\/script>');
}
</script>
<!-- IMPORTANT: APP CONFIG -->
<script src="js/app.config.js"></script>
<!-- JS TOUCH : include this plugin for mobile drag / drop touch events-->
<script src="js/plugin/jquery-touch/jquery.ui.touch-punch.min.js"></script>
<!-- BOOTSTRAP JS -->
<script src="js/bootstrap/bootstrap.min.js"></script>
<!-- CUSTOM NOTIFICATION -->
<script src="js/notification/SmartNotification.min.js"></script>
<!-- JARVIS WIDGETS -->
<script src="js/smartwidgets/jarvis.widget.min.js"></script>
<!-- EASY PIE CHARTS -->
<script src="js/plugin/easy-pie-chart/jquery.easy-pie-chart.min.js"></script>
<!-- SPARKLINES -->
<script src="js/plugin/sparkline/jquery.sparkline.min.js"></script>
<!-- JQUERY VALIDATE -->
<script src="js/plugin/jquery-validate/jquery.validate.min.js"></script>
<!-- JQUERY MASKED INPUT -->
<script src="js/plugin/masked-input/jquery.maskedinput.min.js"></script>
<!-- JQUERY SELECT2 INPUT -->
<script src="js/plugin/select2/select2.min.js"></script>
<!-- JQUERY UI + Bootstrap Slider -->
<script src="js/plugin/bootstrap-slider/bootstrap-slider.min.js"></script>
<!-- browser msie issue fix -->
<script src="js/plugin/msie-fix/jquery.mb.browser.min.js"></script>
<!-- FastClick: For mobile devices -->
<script src="js/plugin/fastclick/fastclick.min.js"></script>
<!--[if IE 8]>
<h1>Your browser is out of date, please update your browser by going to www.microsoft.com/download</h1>
<![endif]-->
<!-- Demo purpose only -->
<script src="js/demo.min.js"></script>
<!-- MAIN APP JS FILE -->
<script src="js/app.min.js"></script>
<!-- ENHANCEMENT PLUGINS : NOT A REQUIREMENT -->
<!-- Voice command : plugin -->
<script src="js/speech/voicecommand.min.js"></script>
<!-- PAGE RELATED PLUGIN(S) -->
<!-- Flot Chart Plugin: Flot Engine, Flot Resizer, Flot Tooltip -->
<script src="js/plugin/flot/jquery.flot.cust.min.js"></script>
<script src="js/plugin/flot/jquery.flot.resize.min.js"></script>
<script src="js/plugin/flot/jquery.flot.tooltip.min.js"></script>
<!-- Vector Maps Plugin: Vectormap engine, Vectormap language -->
<script src="js/plugin/vectormap/jquery-jvectormap-1.2.2.min.js"></script>
<script src="js/plugin/vectormap/jquery-jvectormap-world-mill-en.js"></script>
<!-- Full Calendar -->
<script src="js/plugin/fullcalendar/jquery.fullcalendar.min.js"></script>
<script>
$(document).ready(function() {
// DO NOT REMOVE : GLOBAL FUNCTIONS!
pageSetUp();
/*
* PAGE RELATED SCRIPTS
*/
$(".js-status-update a").click(function() {
var selText = $(this).text();
var $this = $(this);
$this.parents('.btn-group').find('.dropdown-toggle').html(selText + ' <span class="caret"></span>');
$this.parents('.dropdown-menu').find('li').removeClass('active');
$this.parent().addClass('active');
});
/*
* TODO: add a way to add more todo's to list
*/
// initialize sortable
$(function() {
$("#sortable1, #sortable2").sortable({
handle : '.handle',
connectWith : ".todo",
update : countTasks
}).disableSelection();
});
// check and uncheck
$('.todo .checkbox > input[type="checkbox"]').click(function() {
var $this = $(this).parent().parent().parent();
if ($(this).prop('checked')) {
$this.addClass("complete");
// remove this if you want to undo a check list once checked
//$(this).attr("disabled", true);
$(this).parent().hide();
// once clicked - add class, copy to memory then remove and add to sortable3
$this.slideUp(500, function() {
$this.clone().prependTo("#sortable3").effect("highlight", {}, 800);
$this.remove();
countTasks();
});
} else {
// insert undo code here...
}
})
// count tasks
function countTasks() {
$('.todo-group-title').each(function() {
var $this = $(this);
$this.find(".num-of-tasks").text($this.next().find("li").size());
});
}
/*
* RUN PAGE GRAPHS
*/
/* TAB 1: UPDATING CHART */
// For the demo we use generated data, but normally it would be coming from the server
var data = [], totalPoints = 200, $UpdatingChartColors = $("#updating-chart").css('color');
function getRandomData() {
if (data.length > 0)
data = data.slice(1);
// do a random walk
while (data.length < totalPoints) {
var prev = data.length > 0 ? data[data.length - 1] : 50;
var y = prev + Math.random() * 10 - 5;
if (y < 0)
y = 0;
if (y > 100)
y = 100;
data.push(y);
}
// zip the generated y values with the x values
var res = [];
for (var i = 0; i < data.length; ++i)
res.push([i, data[i]])
return res;
}
// setup control widget
var updateInterval = 1500;
$("#updating-chart").val(updateInterval).change(function() {
var v = $(this).val();
if (v && !isNaN(+v)) {
updateInterval = +v;
$(this).val("" + updateInterval);
}
});
// setup plot
var options = {
yaxis : {
min : 0,
max : 100
},
xaxis : {
min : 0,
max : 100
},
colors : [$UpdatingChartColors],
series : {
lines : {
lineWidth : 1,
fill : true,
fillColor : {
colors : [{
opacity : 0.4
}, {
opacity : 0
}]
},
steps : false
}
}
};
var plot = $.plot($("#updating-chart"), [getRandomData()], options);
/* live switch */
$('input[type="checkbox"]#start_interval').click(function() {
if ($(this).prop('checked')) {
$on = true;
updateInterval = 1500;
update();
} else {
clearInterval(updateInterval);
$on = false;
}
});
function update() {
if ($on == true) {
plot.setData([getRandomData()]);
plot.draw();
setTimeout(update, updateInterval);
} else {
clearInterval(updateInterval)
}
}
var $on = false;
/*end updating chart*/
/* TAB 2: Social Network */
$(function() {
// jQuery Flot Chart
var twitter = [[1, 27], [2, 34], [3, 51], [4, 48], [5, 55], [6, 65], [7, 61], [8, 70], [9, 65], [10, 75], [11, 57], [12, 59], [13, 62]], facebook = [[1, 25], [2, 31], [3, 45], [4, 37], [5, 38], [6, 40], [7, 47], [8, 55], [9, 43], [10, 50], [11, 47], [12, 39], [13, 47]], data = [{
label : "Twitter",
data : twitter,
lines : {
show : true,
lineWidth : 1,
fill : true,
fillColor : {
colors : [{
opacity : 0.1
}, {
opacity : 0.13
}]
}
},
points : {
show : true
}
}, {
label : "Facebook",
data : facebook,
lines : {
show : true,
lineWidth : 1,
fill : true,
fillColor : {
colors : [{
opacity : 0.1
}, {
opacity : 0.13
}]
}
},
points : {
show : true
}
}];
var options = {
grid : {
hoverable : true
},
colors : ["#568A89", "#3276B1"],
tooltip : true,
tooltipOpts : {
//content : "Value <b>$x</b> Value <span>$y</span>",
defaultTheme : false
},
xaxis : {
ticks : [[1, "JAN"], [2, "FEB"], [3, "MAR"], [4, "APR"], [5, "MAY"], [6, "JUN"], [7, "JUL"], [8, "AUG"], [9, "SEP"], [10, "OCT"], [11, "NOV"], [12, "DEC"], [13, "JAN+1"]]
},
yaxes : {
}
};
var plot3 = $.plot($("#statsChart"), data, options);
});
// END TAB 2
// TAB THREE GRAPH //
/* TAB 3: Revenew */
$(function() {
var trgt = [[1354586000000, 153], [1364587000000, 658], [1374588000000, 198], [1384589000000, 663], [1394590000000, 801], [1404591000000, 1080], [1414592000000, 353], [1424593000000, 749], [1434594000000, 523], [1444595000000, 258], [1454596000000, 688], [1464597000000, 364]], prft = [[1354586000000, 53], [1364587000000, 65], [1374588000000, 98], [1384589000000, 83], [1394590000000, 980], [1404591000000, 808], [1414592000000, 720], [1424593000000, 674], [1434594000000, 23], [1444595000000, 79], [1454596000000, 88], [1464597000000, 36]], sgnups = [[1354586000000, 647], [1364587000000, 435], [1374588000000, 784], [1384589000000, 346], [1394590000000, 487], [1404591000000, 463], [1414592000000, 479], [1424593000000, 236], [1434594000000, 843], [1444595000000, 657], [1454596000000, 241], [1464597000000, 341]], toggles = $("#rev-toggles"), target = $("#flotcontainer");
var data = [{
label : "Target Profit",
data : trgt,
bars : {
show : true,
align : "center",
barWidth : 30 * 30 * 60 * 1000 * 80
}
}, {
label : "Actual Profit",
data : prft,
color : '#3276B1',
lines : {
show : true,
lineWidth : 3
},
points : {
show : true
}
}, {
label : "Actual Signups",
data : sgnups,
color : '#71843F',
lines : {
show : true,
lineWidth : 1
},
points : {
show : true
}
}]
var options = {
grid : {
hoverable : true
},
tooltip : true,
tooltipOpts : {
//content: '%x - %y',
//dateFormat: '%b %y',
defaultTheme : false
},
xaxis : {
mode : "time"
},
yaxes : {
tickFormatter : function(val, axis) {
return "$" + val;
},
max : 1200
}
};
plot2 = null;
function plotNow() {
var d = [];
toggles.find(':checkbox').each(function() {
if ($(this).is(':checked')) {
d.push(data[$(this).attr("name").substr(4, 1)]);
}
});
if (d.length > 0) {
if (plot2) {
plot2.setData(d);
plot2.draw();
} else {
plot2 = $.plot(target, d, options);
}
}
};
toggles.find(':checkbox').on('change', function() {
plotNow();
});
plotNow()
});
/*
* VECTOR MAP
*/
data_array = {
"US" : 4977,
"AU" : 4873,
"IN" : 3671,
"BR" : 2476,
"TR" : 1476,
"CN" : 146,
"CA" : 134,
"BD" : 100
};
$('#vector-map').vectorMap({
map : 'world_mill_en',
backgroundColor : '#fff',
regionStyle : {
initial : {
fill : '#c4c4c4'
},
hover : {
"fill-opacity" : 1
}
},
series : {
regions : [{
values : data_array,
scale : ['#85a8b6', '#4d7686'],
normalizeFunction : 'polynomial'
}]
},
onRegionLabelShow : function(e, el, code) {
if ( typeof data_array[code] == 'undefined') {
e.preventDefault();
} else {
var countrylbl = data_array[code];
el.html(el.html() + ': ' + countrylbl + ' visits');
}
}
});
/*
* FULL CALENDAR JS
*/
if ($("#calendar").length) {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
var calendar = $('#calendar').fullCalendar({
editable : true,
draggable : true,
selectable : false,
selectHelper : true,
unselectAuto : false,
disableResizing : false,
header : {
left : 'title', //,today
center : 'prev, next, today',
right : 'month, agendaWeek, agenDay' //month, agendaDay,
},
select : function(start, end, allDay) {
var title = prompt('Event Title:');
if (title) {
calendar.fullCalendar('renderEvent', {
title : title,
start : start,
end : end,
allDay : allDay
}, true // make the event "stick"
);
}
calendar.fullCalendar('unselect');
},
events : [{
title : 'All Day Event',
start : new Date(y, m, 1),
description : 'long description',
className : ["event", "bg-color-greenLight"],
icon : 'fa-check'
}, {
title : 'Long Event',
start : new Date(y, m, d - 5),
end : new Date(y, m, d - 2),
className : ["event", "bg-color-red"],
icon : 'fa-lock'
}, {
id : 999,
title : 'Repeating Event',
start : new Date(y, m, d - 3, 16, 0),
allDay : false,
className : ["event", "bg-color-blue"],
icon : 'fa-clock-o'
}, {
id : 999,
title : 'Repeating Event',
start : new Date(y, m, d + 4, 16, 0),
allDay : false,
className : ["event", "bg-color-blue"],
icon : 'fa-clock-o'
}, {
title : 'Meeting',
start : new Date(y, m, d, 10, 30),
allDay : false,
className : ["event", "bg-color-darken"]
}, {
title : 'Lunch',
start : new Date(y, m, d, 12, 0),
end : new Date(y, m, d, 14, 0),
allDay : false,
className : ["event", "bg-color-darken"]
}, {
title : 'Birthday Party',
start : new Date(y, m, d + 1, 19, 0),
end : new Date(y, m, d + 1, 22, 30),
allDay : false,
className : ["event", "bg-color-darken"]
}, {
title : 'Smartadmin Open Day',
start : new Date(y, m, 28),
end : new Date(y, m, 29),
className : ["event", "bg-color-darken"]
}],
eventRender : function(event, element, icon) {
if (!event.description == "") {
element.find('.fc-event-title').append("<br/><span class='ultra-light'>" + event.description + "</span>");
}
if (!event.icon == "") {
element.find('.fc-event-title').append("<i class='air air-top-right fa " + event.icon + " '></i>");
}
}
});
};
/* hide default buttons */
$('.fc-header-right, .fc-header-center').hide();
// calendar prev
$('#calendar-buttons #btn-prev').click(function() {
$('.fc-button-prev').click();
return false;
});
// calendar next
$('#calendar-buttons #btn-next').click(function() {
$('.fc-button-next').click();
return false;
});
// calendar today
$('#calendar-buttons #btn-today').click(function() {
$('.fc-button-today').click();
return false;
});
// calendar month
$('#mt').click(function() {
$('#calendar').fullCalendar('changeView', 'month');
});
// calendar agenda week
$('#ag').click(function() {
$('#calendar').fullCalendar('changeView', 'agendaWeek');
});
// calendar agenda day
$('#td').click(function() {
$('#calendar').fullCalendar('changeView', 'agendaDay');
});
/*
* CHAT
*/
$.filter_input = $('#filter-chat-list');
$.chat_users_container = $('#chat-container > .chat-list-body')
$.chat_users = $('#chat-users')
$.chat_list_btn = $('#chat-container > .chat-list-open-close');
$.chat_body = $('#chat-body');
/*
* LIST FILTER (CHAT)
*/
// custom css expression for a case-insensitive contains()
jQuery.expr[':'].Contains = function(a, i, m) {
return (a.textContent || a.innerText || "").toUpperCase().indexOf(m[3].toUpperCase()) >= 0;
};
function listFilter(list) {// header is any element, list is an unordered list
// create and add the filter form to the header
$.filter_input.change(function() {
var filter = $(this).val();
if (filter) {
// this finds all links in a list that contain the input,
// and hide the ones not containing the input while showing the ones that do
$.chat_users.find("a:not(:Contains(" + filter + "))").parent().slideUp();
$.chat_users.find("a:Contains(" + filter + ")").parent().slideDown();
} else {
$.chat_users.find("li").slideDown();
}
return false;
}).keyup(function() {
// fire the above change event after every letter
$(this).change();
});
}
// on dom ready
listFilter($.chat_users);
// open chat list
$.chat_list_btn.click(function() {
$(this).parent('#chat-container').toggleClass('open');
})
$.chat_body.animate({
scrollTop : $.chat_body[0].scrollHeight
}, 500);
});
</script>
<!-- Your GOOGLE ANALYTICS CODE Below -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX-X']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>
| {
"content_hash": "644109e0e7eef6fae342addc52c65624",
"timestamp": "",
"source": "github",
"line_count": 2279,
"max_line_length": 881,
"avg_line_length": 36.89600702062308,
"alnum_prop": 0.5320148419475299,
"repo_name": "networksoft/erp.wellnet",
"id": "1fa2b434f673b969aab5b59a695bd2bfe796e743",
"size": "84116",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "template/index.html",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "ApacheConf",
"bytes": "383"
},
{
"name": "Batchfile",
"bytes": "310"
},
{
"name": "C",
"bytes": "479526"
},
{
"name": "CSS",
"bytes": "916036"
},
{
"name": "Groff",
"bytes": "60910"
},
{
"name": "HTML",
"bytes": "7195685"
},
{
"name": "JavaScript",
"bytes": "1616267"
},
{
"name": "Makefile",
"bytes": "16519"
},
{
"name": "PHP",
"bytes": "12824429"
},
{
"name": "Perl",
"bytes": "50950"
},
{
"name": "Shell",
"bytes": "27957"
}
],
"symlink_target": ""
} |
package pl.pronux.sokker.ui.widgets.wizards.xmlimporter;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import pl.pronux.sokker.data.cache.Cache;
import pl.pronux.sokker.model.Club;
import pl.pronux.sokker.ui.widgets.wizards.Wizard;
import pl.pronux.sokker.ui.widgets.wizards.xmlimporter.pages.ApplicationsPage;
import pl.pronux.sokker.ui.widgets.wizards.xmlimporter.pages.ChooseFilePage;
import pl.pronux.sokker.ui.widgets.wizards.xmlimporter.pages.DirectoryPage;
import pl.pronux.sokker.ui.widgets.wizards.xmlimporter.pages.ImportPage;
public class ImporterWizard extends Wizard {
public ImporterWizard(Shell parent, int decorator) {
super(parent, decorator);
addPage(new ApplicationsPage(this));
addPage(new DirectoryPage(this));
addPage(new ChooseFilePage(this));
addPage(new ImportPage(this));
// addPage(new FinishPage(this));
}
public ImporterWizard(Display display) {
super(display);
addPage(new ApplicationsPage(this));
addPage(new DirectoryPage(this));
addPage(new ChooseFilePage(this));
addPage(new ImportPage(this));
}
public static void main(String[] args) {
Display display = new Display();
Cache.setClub(new Club());
Cache.getClub().setId(17008);
ImporterWizard wizard = new ImporterWizard(display);
wizard.open();
}
}
| {
"content_hash": "eaadd3e3ca54e7b5ac7b85a3a238ceed",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 78,
"avg_line_length": 33.75,
"alnum_prop": 0.7525925925925926,
"repo_name": "rrymaszewski/SokkerViewer",
"id": "9626fc7e026d84502eac078c2dcc9378dce901da",
"size": "1350",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/main/java/pl/pronux/sokker/ui/widgets/wizards/xmlimporter/ImporterWizard.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "2245211"
}
],
"symlink_target": ""
} |
#include <stdio.h>
#include <stdlib.h>
#include <pcap/pcap.h>
#include <inttypes.h>
#include <string.h>
#include <arpa/inet.h>
#include <string>
#include <map>
#include <iterator>
#include <ctime> // a.k.a time.h
struct ScanContext
{
uintmax_t packetCount;
uintmax_t ethernetPacketCount;
uintmax_t arpPacketCount;
uintmax_t byteCount;
unsigned int maxPacketLength;
unsigned int minPacketLength;
int isEthernet;
struct timeval startTime;
struct timeval endTime;
std::map<std::string, long> packetCountPerSourceMac;
std::map<std::string, long> packetCountPerDestMac;
std::map<std::string, std::string> ipToMac;
ScanContext() : packetCount(0), ethernetPacketCount(0), arpPacketCount(0), byteCount(0), maxPacketLength(0), minPacketLength(0), isEthernet(0)
{
memset(&this->startTime, 0, sizeof(struct timeval));
memset(&this->endTime, 0, sizeof(struct timeval));
}
};
#define TABLE_BITMASK 0xF
#define TABLE_SIZE (TABLE_BITMASK+1)
static char* macToString(const unsigned char* bytes)
{
static char mac[TABLE_SIZE][20];
static int count = 0;
count++;
snprintf(mac[count & TABLE_BITMASK], 20, "%02x:%02x:%02x:%02x:%02x:%02x",
bytes[0],
bytes[1],
bytes[2],
bytes[3],
bytes[4],
bytes[5]);
return mac[count & TABLE_BITMASK];
}
static char* ipv4ToString(const unsigned char* bytes)
{
static char ip[TABLE_SIZE][16];
static int count = 0;
count++;
snprintf(ip[count & TABLE_BITMASK], 16, "%u.%u.%u.%u",
bytes[0],
bytes[1],
bytes[2],
bytes[3]);
return ip[count & TABLE_BITMASK];
}
static void insertOrIncrementCounter(std::map<std::string, long> &map, std::string &key)
{
if(map.find(key) != map.end())
{
map[key]++;
}
else
{
map[key] = 1;
}
}
static std::string insertOrReplaceMac(std::map<std::string, std::string> &map, std::string &key, std::string &value)
{
std::string tmp = "";
if(map.find(key) != map.end())
{
tmp = map[key];
}
map[key] = value;
return tmp;
}
static void handlePossibleEthernetPacket(u_char *user, const struct pcap_pkthdr *h, const u_char *bytes)
{
ScanContext* ctx = (struct ScanContext*) user;
if(ctx->packetCount == 0)
{
ctx->startTime = h->ts;
}
else
{
// we don't know what the last packet will be...
ctx->endTime = h->ts;
}
ctx->packetCount++;
if(h->len > ctx->maxPacketLength)
{
ctx->maxPacketLength = h->len;
}
if(ctx->minPacketLength == 0 || h->len < ctx->minPacketLength)
{
ctx->minPacketLength = h->len;
}
ctx->byteCount += h->len;
if(ctx->isEthernet)
{
ctx->ethernetPacketCount++;
if(h->caplen >= 12)
{
std::string sourceMacString = macToString(bytes+6);
std::string destMacString = macToString(bytes);
insertOrIncrementCounter(ctx->packetCountPerDestMac, destMacString);
insertOrIncrementCounter(ctx->packetCountPerSourceMac, sourceMacString);
}
}
}
static void handleArpPacket(u_char *user, const struct pcap_pkthdr *h, const u_char *bytes)
{
ScanContext* ctx = (struct ScanContext*) user;
ctx->arpPacketCount++;
// 14 byte Ethernet header + 28 byte ARP header
if(h->caplen >= 42)
{
// XXX check h->caplen
uint16_t hardwareFormat;
uint16_t protocolFormat;
uint8_t hardwareLen;
uint8_t protocolLen;
uint16_t operation;
uint8_t sourceHardware[6];
uint8_t sourceProtocol[4];
uint8_t targetHardware[6];
uint8_t targetProtocol[4];
char* senderMac = NULL;
char* senderIp = NULL;
char* targetMac = NULL;
char* targetIp = NULL;
// skip Ethernet header
// TODO ensure 14-byte Ethernet is the only encapsulation type
const u_char* arp_hdr = bytes + 14;
memcpy(&hardwareFormat, arp_hdr , 2);
memcpy(&protocolFormat, arp_hdr + 2, 2);
hardwareFormat = htons(hardwareFormat);
protocolFormat = htons(protocolFormat);
hardwareLen = *(arp_hdr + 4);
protocolLen = *(arp_hdr + 5);
if(hardwareLen != 6)
{
fprintf(stderr, "[!] ARP: Unexpected hardware length\n");
return;
}
if(protocolLen != 4)
{
fprintf(stderr, "[!] ARP: Unexpected protocol length\n");
return;
}
if(protocolFormat != 0x800)
{
fprintf(stderr, "[!] ARP: Unexpected protocol type\n");
return;
}
if(hardwareFormat != 1)
{
fprintf(stderr, "[!] ARP: Unexpected hardware type\n");
return;
}
memcpy(&operation, arp_hdr + 6, 2);
operation = htons(operation);
senderMac = macToString(arp_hdr + 8);
senderIp = ipv4ToString(arp_hdr + 14);
targetMac = macToString(arp_hdr + 18);
targetIp = ipv4ToString(arp_hdr + 24);
#if 0
fprintf(stderr, "arp caplen=%d hFormat=%d pFormat=%d hLen=%d pLen=%d op=0x%04x sender(%s, %s) target(%s, %s)\n",
h->caplen,
hardwareFormat,
protocolFormat,
hardwareLen,
protocolLen,
operation,
senderMac,
senderIp,
targetMac,
targetIp
);
#endif
// Update ARP information with address of sender
std::string senderIpString = senderIp;
std::string senderMacString = senderMac;
// if the sender isn't claiming it owns an IP address, don't update the table
if(senderIpString.compare("0.0.0.0"))
{
std::string previous = insertOrReplaceMac(ctx->ipToMac, senderIpString, senderMacString);
if(previous.compare("") != 0 && previous.compare(senderIp) == 0)
{
fprintf(stderr, "[!] %s rebound: was bound to %s\n", senderIp, previous.c_str());
}
}
}
#if 0
else
{
fprintf(stderr, "[!] Truncated ARP packet\n");
}
#endif
}
static void printCountPerAddress(std::map<std::string, long> &macToCount)
{
std::map<std::string, long>::iterator it;
for (it = macToCount.begin();
it != macToCount.end();
it++)
{
printf("%8ld %s\n",
it->second,
it->first.c_str());
}
}
static void printIpToMac(std::map<std::string, std::string> &ipToMac)
{
std::map<std::string, std::string>::iterator it;
for (it = ipToMac.begin();
it != ipToMac.end();
it++)
{
printf(" %-16s %20s\n",
it->first.c_str(),
it->second.c_str());
}
}
static inline const char* timevalToLocalTime(struct timeval* time)
{
time_t unixTime = time->tv_sec;
struct tm* localTime = localtime(&unixTime);
char* localTimeString = asctime(localTime);
// note: the result from asctime() has a '\n' at the end, so we truncate it
if(localTimeString)
{
localTimeString[strlen(localTimeString) - 1] = '\0';
}
return localTimeString ? localTimeString : "?";
}
static void printStatistics(struct ScanContext* ctx)
{
printf("%ju packets\n", ctx->packetCount);
printf("%ju Ethernet packets\n", ctx->ethernetPacketCount);
printf("%ju ARP packets\n", ctx->arpPacketCount);
printf("Min size packet: %u\n", ctx->minPacketLength);
printf("Max size packet: %u\n", ctx->maxPacketLength);
if(0 != ctx->packetCount)
{
printf("Average size packet: %ju\n", ctx->byteCount / ctx->packetCount);
}
printf("Start time: %ju.%06ju seconds (%s)\n",
(uintmax_t) ctx->startTime.tv_sec, (uintmax_t) ctx->startTime.tv_usec,
timevalToLocalTime(&ctx->startTime));
printf("End time: %ju.%06ju seconds (%s)\n",
(uintmax_t) ctx->endTime.tv_sec, (uintmax_t) ctx->endTime.tv_usec,
timevalToLocalTime(&ctx->endTime));
long totalCaptureTime = ctx->endTime.tv_sec - ctx->startTime.tv_sec;
if(0 == totalCaptureTime)
{
// round up to avoid divide by zero
totalCaptureTime = 1;
}
printf("Total time: %ld seconds (%ld.%01ld minutes)\n",
totalCaptureTime, totalCaptureTime / 60, totalCaptureTime % 60 * 10 / 60);
printf("Total bytes captured: %ju bytes / %ju kilobytes / %ju megabytes\n",
ctx->byteCount,
ctx->byteCount / 1024,
ctx->byteCount / 1024 / 1024);
long kilobits = ctx->byteCount * 8 / 1024;
long kilobitsPerSecond = kilobits / totalCaptureTime;
printf("Overall capture speed: %ld Kbps (%ld Mbps)\n", kilobitsPerSecond, kilobitsPerSecond / 1024);
if(!ctx->packetCountPerDestMac.empty())
{
printf("\nEthernet destinations:\n");
printCountPerAddress(ctx->packetCountPerDestMac);
}
if(!ctx->packetCountPerSourceMac.empty())
{
printf("\nEthernet sources:\n");
printCountPerAddress(ctx->packetCountPerSourceMac);
}
if(!ctx->ipToMac.empty())
{
printf("\nARP table:\n");
printIpToMac(ctx->ipToMac);
}
}
static int applyCaptureFilter(pcap_t* pcap, const char* filter)
{
int result = 0;
struct bpf_program* bpf = (struct bpf_program*) calloc(1, sizeof(struct bpf_program));
if(NULL == bpf)
{
perror("calloc");
result = -1;
goto exit;
}
if(-1 == pcap_compile(pcap,
bpf,
filter,
1 /* optimize */,
PCAP_NETMASK_UNKNOWN))
{
// TODO: need a -v flag?
// this error will trigger for captures with zero ARPs, for example
//fprintf(stderr, "%s\n", pcap_geterr(pcap));
result = -1;
goto exit;
}
if(-1 == pcap_setfilter(pcap, bpf))
{
fprintf(stderr, "%s\n", pcap_geterr(pcap));
result = -1;
goto exit;
}
exit:
if(NULL != bpf)
{
pcap_freecode(bpf);
free(bpf);
}
return result;
}
int main(int argc, char* argv[])
{
int result = 0;
pcap_t* pcap;
char errbuf[PCAP_ERRBUF_SIZE];
struct ScanContext ctx;
if(argc < 2)
{
fprintf(stderr, "Not enough arguments. Please specify a pcap file.\n");
result = 2;
goto exit;
}
pcap = pcap_open_offline(argv[1], errbuf);
if(NULL == pcap)
{
fprintf(stderr, "%s\n", errbuf);
result = 3;
goto exit;
}
if(DLT_EN10MB == pcap_datalink(pcap))
{
ctx.isEthernet = 1;
}
pcap_loop(pcap, -1, handlePossibleEthernetPacket, (u_char*) &ctx);
// reopen file and check against a capture filter
pcap_close(pcap);
pcap = pcap_open_offline(argv[1], errbuf);
if(NULL == pcap)
{
fprintf(stderr, "%s\n", errbuf);
result = 4;
goto exit;
}
if(0 != applyCaptureFilter(pcap, "arp"))
{
// expression could reject all packets and throw an error
goto skip_arp;
}
pcap_loop(pcap, -1, handleArpPacket, (u_char*) &ctx);
skip_arp:
pcap_close(pcap);
// All done with packet processing.
printStatistics(&ctx);
exit:
return result;
}
| {
"content_hash": "cc3e2b10097dfa786617900fc3794dd7",
"timestamp": "",
"source": "github",
"line_count": 452,
"max_line_length": 146,
"avg_line_length": 25.243362831858406,
"alnum_prop": 0.5705521472392638,
"repo_name": "pontillo/scanpcap",
"id": "b3013279a2508a896962022f3b484c398d6c2ce5",
"size": "12004",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "scanpcap.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C++",
"bytes": "12004"
},
{
"name": "CMake",
"bytes": "295"
}
],
"symlink_target": ""
} |
title: Writefull Icon
date: 2015-06-27
description: A circular icon made for Writefull, a light-weight app that provides feedback on your writing by checking your text against databases of correct language.
image: https://i.imgur.com/yE0QMDf.jpg
categories:
- portfolio
tags:
- design
---
A circular icon made for [Writefull](https://writefullapp.com/), a light-weight app that provides feedback on your writing by checking your text against databases of correct language.
Download the icon for Xcode, OSX, iOS, Windows, Android, favicon, folders, etc. [from GitHub](https://github.com/fvcproductions/icon-designs/tree/master/writefull).

| {
"content_hash": "7b785b1bab3e158fa3bf29b1a8c99ae4",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 183,
"avg_line_length": 46.4,
"alnum_prop": 0.7758620689655172,
"repo_name": "fvcproductions/fvcproductions.github.io",
"id": "40b7920f96d83342a948831334d7c21c8ff0a679",
"size": "700",
"binary": false,
"copies": "1",
"ref": "refs/heads/production",
"path": "content/posts/2015-06-27-writefull-icon.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "25819"
},
{
"name": "HTML",
"bytes": "114390"
},
{
"name": "JavaScript",
"bytes": "11717"
}
],
"symlink_target": ""
} |
<?php defined('SYSPATH') OR die('No direct script access.');
abstract class Session extends Kohana_Session {
private $_flash_styles = array(
'warning' => array(
'theme' => 'warning',
'icon' => 'fa-exclamation-circle'
),
'info' => array(
'theme' => 'success',
'icon' => 'fa-check-circle'
),
'error' => array(
'theme' => 'danger',
'icon' => 'fa-times-circle'
),
);
/**
* Sets a flash message.
*
* @param string $message A flash message
*/
public function flashError($message)
{
$this->set('flash_message', array('type' => 'error', 'message' => Messages::get($message)));
}
public function flashSuccess($message)
{
$this->set('flash_message', array('type' => 'info', 'message' => Messages::get($message)));
}
public function flashWarning($message)
{
$this->set('flash_message', array('type' => 'warning', 'message' => Messages::get($message)));
}
/**
* Gets the flash message as a plain string.
*
* @return string
*/
public function getFlash()
{
return $this->get_once('flash_message', NULL);
}
/**
* Gets the flash message as an HTML formatted string.
*
* @return string
*/
public function getFlashHtml()
{
$flash = $this->getFlash();
if ( ! $flash)
return NULL;
$style = array_key_exists($flash['type'], $this->_flash_styles)
? $this->_flash_styles[$flash['type']]
: $this->_flash_styles['info']; // Default to info
return View::factory('shared/flash_message')
->set('style', $style)
->set('message', $flash['message'])
->render();
}
/**
* Generates a CSRF token for the session. Called from Controller_Login::action_login()
* upon successful authentication.
*/
public function makeToken()
{
$auth = Auth::instance();
$this->set('crsf_token', $auth->hash(md5(uniqid(rand(), true))));
}
public function getToken()
{
return $this->get('crsf_token');
}
}
| {
"content_hash": "145c9541c3dc1a0f60f2edffdba58694",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 102,
"avg_line_length": 26.24705882352941,
"alnum_prop": 0.5186015239802779,
"repo_name": "victor-nbcuni/bugger",
"id": "c97d9f601974a003dc1176f9138c16f5da60f0c2",
"size": "2231",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "application/classes/Session.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ApacheConf",
"bytes": "517"
},
{
"name": "CSS",
"bytes": "490273"
},
{
"name": "JavaScript",
"bytes": "1097874"
},
{
"name": "PHP",
"bytes": "1662158"
},
{
"name": "Shell",
"bytes": "1670"
}
],
"symlink_target": ""
} |
class Capability < ActiveRecord::Base
end
| {
"content_hash": "cd3ac7d15b6ab01cb435ef605bdf7e89",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 37,
"avg_line_length": 21,
"alnum_prop": 0.8095238095238095,
"repo_name": "Batname/emaster_2.0",
"id": "e49900934dbd59a24cd54fd7b490d897f62b8d33",
"size": "42",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "app/models/capability.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2745"
},
{
"name": "CoffeeScript",
"bytes": "11600"
},
{
"name": "HTML",
"bytes": "15493"
},
{
"name": "JavaScript",
"bytes": "3860"
},
{
"name": "R",
"bytes": "252"
},
{
"name": "Ruby",
"bytes": "60788"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
NUB Generator [autonym]
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "1b02b6833ab5d279e8b95e506a18d101",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 23,
"avg_line_length": 9.076923076923077,
"alnum_prop": 0.6779661016949152,
"repo_name": "mdoering/backbone",
"id": "cd28a5bf787c11befe00f8558e60c6e53b65a99a",
"size": "190",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Ascomycota/Dothideomycetes/Aspidotheliaceae/Aspidothelium/Aspidothelium scutellicarpum/Aspidothelium scutellicarpum scutellicarpum/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
var Dispatcher = require('../../modules/Dispatcher');
var ItemsConstants = require('./ItemsConstants');
var ItemsModelFactories = require('./ItemsModelFactories');
var PlayersConstants = require('./PlayerConstants');
var RegisteredStore = require('../../modules/RegisteredStore');
var Immutable = require('../../modules/immutable');
var ItemsStore = RegisteredStore.create('ItemsStore');
var saveTimeout;
var data = {
isFetching:false,
remaining:0,
map:Immutable.List(),
flags:[],
items:Immutable.Dictionary()
};
/**
* Save all items to browser's local storage and trigger store change
*/
function persistAndEmitChange(){
if(saveTimeout){
window.clearTimeout(saveTimeout);
}
saveTimeout = window.setTimeout(function(){
localStorage.setItem('items',JSON.stringify(data.items.values));
},1000);
ItemsStore.emitChange();
}
/**
* Update the data in the store
* @param payload Object
*/
function updateAllItems(payload){
var flags = [];
var remaining = 0;
var transaction = data.items.transaction();
payload.arguments.items.forEach(function(item){
if(item.isFlag){
flags.push(item);
}
if(!item.isRevealed && !item.isBomb){
remaining++;
}
transaction.addOrUpdate(item.id,item);
});
data.flags = flags;
data.remaining = remaining;
data.items = transaction.commit();
}
function updateFlaggedItem(item){
var found = false;
var i = 0;
var len = data.flags.length;
while(i < len){
if(data.flags[i].id == item.id){
found = true;
break;
}
i++;
}
if(item.isFlag && !found){
data.flags.push(item);
} else if(!item.isFlag && found){
data.flags.splice(i,1);
}
var transaction = data.items.transaction();
transaction.update(item.id,item);
data.items = transaction.commit();
}
function buildMap(){
data.map = data.map.transaction().clear().commit();
data.items.forEach(function(item){
var mapTransaction = data.map.transaction();
var row = data.map.index(item.row);
if(!row){
row = Immutable.List();
mapTransaction.add(item.row,row);
}
var transaction = row.transaction();
transaction.add(item.col,item);
row = transaction.commit();
mapTransaction.update(item.row,row);
data.map = mapTransaction.commit();
});
}
/**
* Update the map with the new item
* @param item {ItemModel|Object}
*/
function updateMapItem(item){
var row = data.map.index(item.row);
var transaction = row.transaction();
transaction.update(item.col,item);
row = transaction.commit();
data.map = data.map.transaction().update(item.row,row).commit();
}
function revealNeighbors(item){
item.neighbors.forEach(function(id){
var item = data.items.index(id);
if(!item.isBomb && !item.isFlag && !item.isRevealed){
revealItem(item);
}
});
}
function revealItem(item){
var updatedItem = item.transaction().set('isRevealed',true).commit();
var transaction = data.items.transaction();
transaction.update(updatedItem.id,updatedItem);
data.items = transaction.commit();
data.remaining--;
updateMapItem(updatedItem);
persistAndEmitChange();
if(!updatedItem.label){
revealNeighbors(updatedItem);
}
}
function revealAllItems(){
var transaction = data.items.transaction();
data.items.forEach(function(item){
if(!item.isRevealed){
var model = item.shallowClone();
model.isRevealed = true;
model.isFlag = false;
transaction.update(item.id,new ItemsModelFactories.ItemModel(model))
}
});
data.items = transaction.commit();
buildMap();
}
function _dispatcher(payload){
switch(payload.actionType){
case ItemsConstants.BEGIN_GENERATE_MAP:
data.isFetching = true;
ItemsStore.emitChange();
break;
case ItemsConstants.END_GENERATE_MAP_SUCCESS:
data.isFetching = false;
data.items = data.items.transaction().clear().commit();
updateAllItems(payload);
buildMap();
data.hasFetched = true;
persistAndEmitChange();
break;
case ItemsConstants.END_GENERATE_MAP_FAILURE:
data.isFetching = false;
data.hasFetched = true;
ItemsStore.emitChange();
break;
case ItemsConstants.REVEAL_ALL_ITEMS:
case PlayersConstants.GAME_OVER:
revealAllItems();
persistAndEmitChange();
break;
case ItemsConstants.REVEAL_ITEM:
revealItem(payload.arguments.items[0]);
break;
case ItemsConstants.TOGGLE_ITEM_FLAG:
updateFlaggedItem(payload.arguments.items[0]);
updateMapItem(payload.arguments.items[0]);
persistAndEmitChange();
break;
}
return true;
}
module.exports = ItemsStore.assign({
getDebugData:function(){
return data;
},
isFetching:function(){
return data.isFetching;
},
hasFetched:function(){
return data.hasFetched;
},
getItems:function(){
return data.items;
},
getMap:function(){
return data.map;
},
getRemaining:function(){
return data.remaining;
},
getFlags:function(){
return data.flags;
},
getById:function(id){
return data.items.index(id);
},
dispatcherIndex:Dispatcher.register(_dispatcher)
});
| {
"content_hash": "f315c13e27c2e5c4c20685dc1ff1ce32",
"timestamp": "",
"source": "github",
"line_count": 219,
"max_line_length": 80,
"avg_line_length": 25.926940639269407,
"alnum_prop": 0.6079605494892568,
"repo_name": "EnzoMartin/Minesweeper-React",
"id": "4a045c9f22514078f450e134a48da1dc9c468907",
"size": "5678",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "client-src/js/app/game/ItemsStore.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "3339"
},
{
"name": "CSS",
"bytes": "7822"
},
{
"name": "HTML",
"bytes": "2158"
},
{
"name": "JavaScript",
"bytes": "254954"
}
],
"symlink_target": ""
} |
// @(#)ATIMEndTimer.java 7/2003
// Copyright (c) 1998-2003, Distributed Real-time Computing Lab (DRCL)
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// 3. Neither the name of "DRCL" nor the names of its contributors may be used
// to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
package drcl.inet.mac;
import java.math.*;
import drcl.inet.*;
import drcl.net.*;
import drcl.comp.*;
/** This class defines the handler for the end of ATIM window
* @see Mac_802_11_Timer
* @author Rong Zheng
*/
public class ATIMEndTimer extends Mac_802_11_Timer {
public ATIMEndTimer(Mac_802_11 h) {
super(h);
o_.setType(MacTimeoutEvt.ATIMEnd_timeout);
}
public void handle( ) {
busy_ = false;
paused_ = false;
stime = 0.0;
rtime = 0.0;
}
}
| {
"content_hash": "632a7225162769969461b1786f9521a8",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 80,
"avg_line_length": 39.716981132075475,
"alnum_prop": 0.7368171021377672,
"repo_name": "yunxao/JN-Sim",
"id": "ec198bff18ead5dd29a8f54abd71d88c56616433",
"size": "2105",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Simulador/src/drcl/inet/mac/ATIMEndTimer.java",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Erlang",
"bytes": "2987"
},
{
"name": "Java",
"bytes": "6913737"
},
{
"name": "JavaScript",
"bytes": "2300"
},
{
"name": "Makefile",
"bytes": "2965"
},
{
"name": "Perl",
"bytes": "222"
},
{
"name": "Ruby",
"bytes": "1863"
},
{
"name": "Shell",
"bytes": "34539"
},
{
"name": "Tcl",
"bytes": "149661"
},
{
"name": "TeX",
"bytes": "2339807"
}
],
"symlink_target": ""
} |
Welcome to the documentation for TOAD!
======================================
.. image:: images/toad_logo.png
:align: center
:width: 225px
Project Overview
----------------
TOAD (TripleO Automated Deployer) is a system that helps automate various
OpenStack deployment scenarios using `TripleO
Quickstart <https://github.com/openstack/tripleo-quickstart>`_.
In conjunction with Jenkins Job Builder and Jenkins, various scenarios and
topologies can be scripted and then triggered via the Jenkins dashboard.
TOAD is used as a simple spin-up environment to bootstrap a testing
infrastructure with the ability to run tests with TripleO Quickstart, and parse
logs and write data into an ELK stack for data visualization.
Find below an image of how the general workflow happens within TOAD:
.. image:: ../../TOAD_Workflow.png
Get The Code
------------
The `source <https://github.com/redhat-nfvpe/toad>`_ is available on GitHub.
Contents
--------
.. toctree::
:maxdepth: 2
:glob:
quickstart
tracking_development
requirements
deployment
overrides
| {
"content_hash": "a91627786ae031072e30f57a1eabae1a",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 79,
"avg_line_length": 25.162790697674417,
"alnum_prop": 0.7097966728280961,
"repo_name": "leifmadsen/toad",
"id": "6f460cdd4df78106da60551e16148c382aa5f75c",
"size": "1082",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "doc/source/index.rst",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Shell",
"bytes": "5533"
}
],
"symlink_target": ""
} |
namespace GitVersion
{
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using GitVersion.Configuration.Init.Wizard;
using GitVersion.Helpers;
public class ConfigurationProvider
{
internal const string DefaultTagPrefix = "[vV]";
public static Config Provide(string workingDirectory, IFileSystem fileSystem, bool applyDefaults = true)
{
var readConfig = ReadConfig(workingDirectory, fileSystem);
if (applyDefaults)
ApplyDefaultsTo(readConfig);
return readConfig;
}
public static void ApplyDefaultsTo(Config config)
{
MigrateBranches(config);
config.AssemblyVersioningScheme = config.AssemblyVersioningScheme ?? AssemblyVersioningScheme.MajorMinorPatch;
config.TagPrefix = config.TagPrefix ?? DefaultTagPrefix;
config.VersioningMode = config.VersioningMode ?? VersioningMode.ContinuousDelivery;
config.ContinuousDeploymentFallbackTag = config.ContinuousDeploymentFallbackTag ?? "ci";
config.MajorVersionBumpMessage = config.MajorVersionBumpMessage ?? IncrementStrategyFinder.DefaultMajorPattern;
config.MinorVersionBumpMessage = config.MinorVersionBumpMessage ?? IncrementStrategyFinder.DefaultMinorPattern;
config.PatchVersionBumpMessage = config.PatchVersionBumpMessage ?? IncrementStrategyFinder.DefaultPatchPattern;
config.CommitMessageIncrementing = config.CommitMessageIncrementing ?? CommitMessageIncrementMode.Enabled;
config.LegacySemVerPadding = config.LegacySemVerPadding ?? 4;
config.BuildMetaDataPadding = config.BuildMetaDataPadding ?? 4;
var configBranches = config.Branches.ToList();
ApplyBranchDefaults(config, GetOrCreateBranchDefaults(config, "master"), defaultTag: string.Empty, defaultPreventIncrement: true);
ApplyBranchDefaults(config, GetOrCreateBranchDefaults(config, "releases?[/-]"), defaultTag: "beta", defaultPreventIncrement: true);
ApplyBranchDefaults(config, GetOrCreateBranchDefaults(config, "features?[/-]"), defaultIncrementStrategy: IncrementStrategy.Inherit);
ApplyBranchDefaults(config, GetOrCreateBranchDefaults(config, @"(pull|pull\-requests|pr)[/-]"),
defaultTag: "PullRequest",
defaultTagNumberPattern: @"[/-](?<number>\d+)[-/]",
defaultIncrementStrategy: IncrementStrategy.Inherit);
ApplyBranchDefaults(config, GetOrCreateBranchDefaults(config, "hotfix(es)?[/-]"), defaultTag: "beta");
ApplyBranchDefaults(config, GetOrCreateBranchDefaults(config, "support[/-]"), defaultTag: string.Empty, defaultPreventIncrement: true);
ApplyBranchDefaults(config, GetOrCreateBranchDefaults(config, "dev(elop)?(ment)?$"),
defaultTag: "unstable",
defaultIncrementStrategy: IncrementStrategy.Minor,
defaultVersioningMode: VersioningMode.ContinuousDeployment,
defaultTrackMergeTarget: true);
// Any user defined branches should have other values defaulted after known branches filled in
// This allows users to override one value of
foreach (var branchConfig in configBranches)
{
ApplyBranchDefaults(config, branchConfig.Value);
}
}
static void MigrateBranches(Config config)
{
// Map of current names and previous names
var dict = new Dictionary<string, string[]>
{
{ "hotfix(es)?[/-]", new []{"hotfix[/-]"}},
{ "features?[/-]", new []{"feature[/-]"}},
{ "releases?[/-]", new []{"release[/-]"}},
{ "dev(elop)?(ment)?$", new []{"develop"}}
};
foreach (var mapping in dict)
{
foreach (var source in mapping.Value)
{
if (config.Branches.ContainsKey(source))
{
// found one, rename
var bc = config.Branches[source];
config.Branches.Remove(source);
config.Branches[mapping.Key] = bc; // re-add with new name
}
}
}
}
static BranchConfig GetOrCreateBranchDefaults(Config config, string branch)
{
if (!config.Branches.ContainsKey(branch))
{
var branchConfig = new BranchConfig();
config.Branches.Add(branch, branchConfig);
return branchConfig;
}
return config.Branches[branch];
}
public static void ApplyBranchDefaults(Config config,
BranchConfig branchConfig,
string defaultTag = "useBranchName",
IncrementStrategy defaultIncrementStrategy = IncrementStrategy.Patch,
bool defaultPreventIncrement = false,
VersioningMode? defaultVersioningMode = null, // Looked up from main config
bool defaultTrackMergeTarget = false,
string defaultTagNumberPattern = null)
{
branchConfig.Tag = branchConfig.Tag ?? defaultTag;
branchConfig.TagNumberPattern = branchConfig.TagNumberPattern ?? defaultTagNumberPattern;
branchConfig.Increment = branchConfig.Increment ?? defaultIncrementStrategy;
branchConfig.PreventIncrementOfMergedBranchVersion = branchConfig.PreventIncrementOfMergedBranchVersion ?? defaultPreventIncrement;
branchConfig.TrackMergeTarget = branchConfig.TrackMergeTarget ?? defaultTrackMergeTarget;
branchConfig.VersioningMode = branchConfig.VersioningMode ?? defaultVersioningMode ?? config.VersioningMode;
}
static Config ReadConfig(string workingDirectory, IFileSystem fileSystem)
{
var configFilePath = GetConfigFilePath(workingDirectory);
if (fileSystem.Exists(configFilePath))
{
var readAllText = fileSystem.ReadAllText(configFilePath);
LegacyConfigNotifier.Notify(new StringReader(readAllText));
return ConfigSerialiser.Read(new StringReader(readAllText));
}
return new Config();
}
public static string GetEffectiveConfigAsString(string gitDirectory, IFileSystem fileSystem)
{
var config = Provide(gitDirectory, fileSystem);
var stringBuilder = new StringBuilder();
using (var stream = new StringWriter(stringBuilder))
{
ConfigSerialiser.Write(config, stream);
stream.Flush();
}
return stringBuilder.ToString();
}
static string GetConfigFilePath(string workingDirectory)
{
return Path.Combine(workingDirectory, "GitVersionConfig.yaml");
}
public static void Init(string workingDirectory, IFileSystem fileSystem, IConsole console)
{
var configFilePath = GetConfigFilePath(workingDirectory);
var currentConfiguration = Provide(workingDirectory, fileSystem, applyDefaults: false);
var config = new ConfigInitWizard(console, fileSystem).Run(currentConfiguration, workingDirectory);
if (config == null) return;
using (var stream = fileSystem.OpenWrite(configFilePath))
using (var writer = new StreamWriter(stream))
{
Logger.WriteInfo("Saving config file");
ConfigSerialiser.Write(config, writer);
stream.Flush();
}
}
}
} | {
"content_hash": "8eec6b2de30953670c88770c655125ab",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 147,
"avg_line_length": 47.006024096385545,
"alnum_prop": 0.6311674996796104,
"repo_name": "alexhardwicke/GitVersion",
"id": "0c7987cd873adc42d01709f32df7306d22fcb591",
"size": "7803",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/GitVersionCore/Configuration/ConfigurationProvider.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "451"
},
{
"name": "C#",
"bytes": "461504"
},
{
"name": "Groff",
"bytes": "812"
},
{
"name": "PowerShell",
"bytes": "611"
},
{
"name": "Ruby",
"bytes": "7612"
}
],
"symlink_target": ""
} |
package org.apache.camel.management;
import java.util.Set;
import javax.management.JMX;
import javax.management.MBeanServer;
import javax.management.ObjectName;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.ServiceStatus;
import org.apache.camel.api.management.mbean.ManagedThrottlingExceptionRoutePolicyMBean;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.throttling.ThrottlingExceptionHalfOpenHandler;
import org.apache.camel.throttling.ThrottlingExceptionRoutePolicy;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class ManagedThrottlingExceptionRoutePolicyTest extends ManagementTestSupport {
@Test
public void testRoutes() throws Exception {
MBeanServer mbeanServer = getMBeanServer();
// get the Camel route
Set<ObjectName> set = mbeanServer.queryNames(new ObjectName("*:type=routes,*"), null);
assertEquals(1, set.size());
ObjectName on = set.iterator().next();
boolean registered = mbeanServer.isRegistered(on);
assertEquals(true, registered, "Should be registered");
// check the starting endpoint uri
String uri = (String) mbeanServer.getAttribute(on, "EndpointUri");
assertEquals("direct://start", uri);
// should be started
String state = (String) mbeanServer.getAttribute(on, "State");
assertEquals(ServiceStatus.Started.name(), state);
// should have ThrottlingExceptionRoutePolicy route policy
String policy = (String) mbeanServer.getAttribute(on, "RoutePolicyList");
assertNotNull(policy);
assertTrue(policy.startsWith("ThrottlingExceptionRoutePolicy"));
// get the RoutePolicy
String mbeanName
= String.format("org.apache.camel:context=" + context.getManagementName() + ",name=%s,type=services", policy);
set = mbeanServer.queryNames(new ObjectName(mbeanName), null);
assertEquals(1, set.size());
on = set.iterator().next();
assertTrue(mbeanServer.isRegistered(on));
// the route has no failures
String myType = (String) mbeanServer.getAttribute(on, "ServiceType");
assertEquals("ThrottlingExceptionRoutePolicy", myType);
ManagedThrottlingExceptionRoutePolicyMBean proxy
= JMX.newMBeanProxy(mbeanServer, on, ManagedThrottlingExceptionRoutePolicyMBean.class);
assertNotNull(proxy);
// state should be closed w/ no failures
String myState = proxy.currentState();
assertEquals("State closed, failures 0", myState);
// the route has no failures
Integer val = proxy.getCurrentFailures();
assertEquals(0, val.intValue());
// the route has no failures
Long lastFail = proxy.getLastFailure();
assertEquals(0L, lastFail.longValue());
// the route is closed
Long openAt = proxy.getOpenAt();
assertEquals(0L, openAt.longValue());
// the route has a handler
String handlerClass = proxy.getHalfOpenHandlerName();
assertEquals("DummyHandler", handlerClass);
// values set during construction of class
Integer threshold = proxy.getFailureThreshold();
assertEquals(10, threshold.intValue());
Long window = proxy.getFailureWindow();
assertEquals(1000L, window.longValue());
Long halfOpenAfter = proxy.getHalfOpenAfter();
assertEquals(5000L, halfOpenAfter.longValue());
// change value
proxy.setHalfOpenAfter(10000L);
halfOpenAfter = proxy.getHalfOpenAfter();
assertEquals(10000L, halfOpenAfter.longValue());
try {
getMockEndpoint("mock:result").expectedMessageCount(0);
template.sendBody("direct:start", "Hello World");
assertMockEndpointsSatisfied();
} catch (Exception e) {
// expected
}
// state should be closed w/ no failures
myState = proxy.currentState();
assertTrue(myState.contains("State closed, failures 1, last failure"));
// the route has 1 failure
val = proxy.getCurrentFailures();
assertEquals(1, val.intValue());
Thread.sleep(200);
// the route has 1 failure X mills ago
lastFail = proxy.getLastFailure();
assertTrue(lastFail.longValue() > 0);
}
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
ThrottlingExceptionRoutePolicy policy = new ThrottlingExceptionRoutePolicy(10, 1000, 5000, null);
policy.setHalfOpenHandler(new DummyHandler());
return new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").routeId("testRoute")
.routePolicy(policy)
.to("log:foo")
.process(new BoomProcess())
.to("mock:result");
}
};
}
class BoomProcess implements Processor {
@Override
public void process(Exchange exchange) throws Exception {
// need to sleep a little to cause last failure to be slow
Thread.sleep(50);
throw new RuntimeException("boom!");
}
}
class DummyHandler implements ThrottlingExceptionHalfOpenHandler {
@Override
public boolean isReadyToBeClosed() {
return false;
}
}
}
| {
"content_hash": "0e90190754c11f4077e85d4908bae4d9",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 126,
"avg_line_length": 35.672955974842765,
"alnum_prop": 0.6574400564174894,
"repo_name": "nikhilvibhav/camel",
"id": "fe11faaf439c5982a3686583e732c32f097b6b6f",
"size": "6474",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "core/camel-management/src/test/java/org/apache/camel/management/ManagedThrottlingExceptionRoutePolicyTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Apex",
"bytes": "6521"
},
{
"name": "Batchfile",
"bytes": "2353"
},
{
"name": "CSS",
"bytes": "5472"
},
{
"name": "Elm",
"bytes": "10852"
},
{
"name": "FreeMarker",
"bytes": "8015"
},
{
"name": "Groovy",
"bytes": "14479"
},
{
"name": "HTML",
"bytes": "915679"
},
{
"name": "Java",
"bytes": "84966020"
},
{
"name": "JavaScript",
"bytes": "100326"
},
{
"name": "Makefile",
"bytes": "513"
},
{
"name": "RobotFramework",
"bytes": "8461"
},
{
"name": "Shell",
"bytes": "17240"
},
{
"name": "TSQL",
"bytes": "28835"
},
{
"name": "Tcl",
"bytes": "4974"
},
{
"name": "Thrift",
"bytes": "6979"
},
{
"name": "XQuery",
"bytes": "546"
},
{
"name": "XSLT",
"bytes": "280849"
}
],
"symlink_target": ""
} |
package io.cucumber.java8;
import org.apiguardian.api.API;
import java.lang.reflect.Type;
@FunctionalInterface
@API(status = API.Status.STABLE)
public interface DefaultParameterTransformerBody {
Object accept(String fromValue, Type toValueType) throws Throwable;
}
| {
"content_hash": "25a5cd5901cf1d5351771fffe321a866",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 71,
"avg_line_length": 21.076923076923077,
"alnum_prop": 0.7992700729927007,
"repo_name": "cucumber/cucumber-jvm",
"id": "c707d29dcddb2d49bc6137659d52501015317ef2",
"size": "274",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "cucumber-java8/src/main/java/io/cucumber/java8/DefaultParameterTransformerBody.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Awk",
"bytes": "408"
},
{
"name": "CSS",
"bytes": "680"
},
{
"name": "Gherkin",
"bytes": "27788"
},
{
"name": "Groovy",
"bytes": "7986"
},
{
"name": "HTML",
"bytes": "1275"
},
{
"name": "Java",
"bytes": "2373051"
},
{
"name": "JavaScript",
"bytes": "3362"
},
{
"name": "Kotlin",
"bytes": "2734"
},
{
"name": "Makefile",
"bytes": "971"
},
{
"name": "Shell",
"bytes": "2157"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>qcert: 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.6 / qcert - 1.4.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
qcert
<small>
1.4.0
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-10-09 00:26:25 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-10-09 00:26:25 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-num base Num library distributed with the OCaml compiler
base-threads base
base-unix base
camlp5 7.14 Preprocessor-pretty-printer of OCaml
conf-findutils 1 Virtual package relying on findutils
conf-perl 2 Virtual package relying on perl
coq 8.6 Formal proof management system
num 0 The Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.03.0 The OCaml compiler (virtual package)
ocaml-base-compiler 4.03.0 Official 4.03.0 release
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.5 A library manager for OCaml
# opam file:
opam-version: "2.0"
maintainer: "Jerome Simeon <jeromesimeon@me.com>"
homepage: "https://querycert.github.io"
bug-reports: "https://github.com/querycert/qcert/issues"
dev-repo: "git+https://github.com/querycert/qcert"
license: "Apache-2.0"
build: [
[make "-j%{jobs}%" "qcert-coq"]
]
install: [
[make "install-coq"]
]
depends: [
"ocaml"
"coq" {>= "8.8.2" & < "8.9~"}
"coq-flocq" {>= "2.6.1" & < "3.0~"}
"coq-jsast" {>= "1.0.8"}
]
tags: [ "keyword:databases" "keyword:queries" "keyword:relational" "keyword:compiler" "date:2019-05-29" "logpath:Qcert" ]
authors: [ "Josh Auerbach <>" "Martin Hirzel <>" "Louis Mandel <>" "Avi Shinnar <>" "Jerome Simeon <>" ]
synopsis: "Verified compiler for data-centric languages"
description: """
This is the Coq library for Q*cert, a platform for implementing and verifying query compilers. It includes abstract syntax and semantics for several source query languages (OQL, SQL), for intermediate database representations (nested relational algebra and calculus), and correctness proofs for part of the compilation pipeline to JavaScript and Java.
"""
url {
src: "https://github.com/querycert/qcert/archive/v1.4.0.tar.gz"
checksum: "bca7708b6c455b0a1c1049cbf6c7473a"
}
</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-qcert.1.4.0 coq.8.6</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.6).
The following dependencies couldn't be met:
- coq-qcert -> coq >= 8.8.2 -> ocaml >= 4.05.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-qcert.1.4.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": "9870bb5c89b7dc437ac535b2827e8bcc",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 351,
"avg_line_length": 43.47953216374269,
"alnum_prop": 0.550773369199731,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "a4466ce604c12dfdfe354e6d26ef5a2615484f4e",
"size": "7460",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.03.0-2.0.5/released/8.6/qcert/1.4.0.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
__author__ = 'Anand Madhavan'
# TODO(Anand) Remove this from pants proper when a code adjoinment mechanism exists
# or ok if/when thriftstore is open sourced as well
import os
import re
import subprocess
from collections import defaultdict
from twitter.common import log
from twitter.common.collections import OrderedSet
from twitter.common.dirutil import safe_mkdir
from twitter.pants import is_jvm
from twitter.pants.targets import JavaLibrary, JavaThriftstoreDMLLibrary, JavaThriftLibrary
from twitter.pants.tasks import TaskError
from twitter.pants.tasks.binary_utils import select_binary
from twitter.pants.tasks.code_gen import CodeGen
class ThriftstoreDMLGen(CodeGen):
@classmethod
def setup_parser(cls, option_group, args, mkflag):
option_group.add_option(mkflag("outdir"), dest="thriftstore_gen_create_outdir",
help="Emit thriftstore generated code in to this directory.")
def __init__(self, context):
CodeGen.__init__(self, context)
self.thriftstore_admin = context.config.get('thriftstore-dml-gen', 'thriftstore-admin')
self.output_dir = (context.options.thriftstore_gen_create_outdir
or context.config.get('thriftstore-dml-gen', 'workdir'))
self.verbose = context.config.getbool('thriftstore-dml-gen', 'verbose')
def create_javadeps():
gen_info = context.config.getlist('thriftstore-dml-gen', 'javadeps')
deps = OrderedSet()
for dep in gen_info:
deps.update(context.resolve(dep))
return deps
def is_thriftstore_dml_instance(target):
return isinstance(target, JavaThriftstoreDMLLibrary)
# Resolved java library targets go in javadeps
self.javadeps = create_javadeps()
self.gen_thriftstore_java_dir = os.path.join(self.output_dir, 'gen-thriftstore-java')
def insert_java_dml_targets():
self.gen_dml_jls = {}
# Create a synthetic java library for each dml target
for dml_lib_target in context.targets(is_thriftstore_dml_instance):
# Add one JavaThriftLibrary target
thrift_dml_lib = self.context.add_new_target(dml_lib_target.target_base, # Dir where sources are relative to
JavaThriftLibrary,
name=dml_lib_target.id,
sources=dml_lib_target.sources)
# Add one generated JavaLibrary target (whose sources we will fill in later on)
java_dml_lib = self.context.add_new_target(self.gen_thriftstore_java_dir,
JavaLibrary,
name=dml_lib_target.id,
sources=[],
dependencies=self.javadeps)
java_dml_lib.id = dml_lib_target.id + '.thriftstore_dml_gen'
java_dml_lib.add_label('codegen')
java_dml_lib.update_dependencies([thrift_dml_lib])
self.gen_dml_jls[dml_lib_target] = java_dml_lib
for dependee, dmls in context.dependants(is_thriftstore_dml_instance).items():
jls = map(lambda dml: self.gen_dml_jls[dml], dmls)
dependee.update_dependencies(jls)
insert_java_dml_targets()
def invalidate_for(self):
return set('java')
def is_gentarget(self, target):
return isinstance(target, JavaThriftstoreDMLLibrary)
def is_forced(self, lang):
return True
def genlangs(self):
return dict(java=is_jvm)
def genlang(self, lang, targets):
bases, sources = self._calculate_sources(targets)
safe_mkdir(self.gen_thriftstore_java_dir)
args = [
self.thriftstore_admin,
'dml',
'-o', self.gen_thriftstore_java_dir
]
if self.verbose:
args.append('-verbose')
args.extend(sources)
self.context.log.debug('Executing: %s' % ' '.join(args))
result = subprocess.call(args)
if result!=0:
raise TaskError()
def _calculate_sources(self, thrift_targets):
bases = set()
sources = set()
def collect_sources(target):
if self.is_gentarget(target):
bases.add(target.target_base)
sources.update(os.path.join(target.target_base, source) for source in target.sources)
for target in thrift_targets:
target.walk(collect_sources)
return bases, sources
def createtarget(self, lang, gentarget, dependees):
if lang == 'java':
return self._create_java_target(gentarget)
else:
raise TaskError('Unrecognized thrift gen lang: %s' % lang)
def _calculate_genfiles(self, source):
args = [
self.thriftstore_admin,
'parse',
source
]
self.context.log.debug('Executing: %s' % ' '.join(args))
p = subprocess.Popen(args,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
output, error = p.communicate()
if p.wait() != 0:
raise TaskError
thriftstore_classes = filter(lambda s: s.strip() != '', output.split('\n'))
return thriftstore_classes
def _create_java_target(self, target):
genfiles = []
for source in target.sources:
genfiles.extend(self._calculate_genfiles(os.path.join(target.target_base, source)))
self.gen_dml_jls[target].sources = genfiles
return self.gen_dml_jls[target]
| {
"content_hash": "0aa6bacea42a6ee61b87541b46612258",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 116,
"avg_line_length": 36.1986301369863,
"alnum_prop": 0.6467360454115421,
"repo_name": "foursquare/commons-old",
"id": "41b8bdc393d9ab6462225471532c249369bdb21f",
"size": "5285",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/python/twitter/pants/tasks/thriftstore_dml_gen.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "2164475"
},
{
"name": "Python",
"bytes": "1285839"
},
{
"name": "Scala",
"bytes": "24999"
},
{
"name": "Shell",
"bytes": "6233"
},
{
"name": "Smalltalk",
"bytes": "10614"
}
],
"symlink_target": ""
} |
<!--
Copyright 2004-2014 The Kuali Foundation
Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php
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.
-->
<config>
<param name="kpme.pm.ehcache.config.location" override="false">classpath:kpme.pm.ehcache.xml</param>
<param name="kpme.pm.position.display.qualifications">true</param>
<param name="kpme.pm.position.display.duties">true</param>
<param name="kpme.pm.position.display.flags">true</param>
<param name="kpme.pm.position.display.responsibility">true</param>
<param name="kpme.pm.position.display.funding">true</param>
<param name="kpme.pm.position.display.adhocrecipients">true</param>
</config> | {
"content_hash": "8da8de399c4cb76953aa8fe360c710a2",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 104,
"avg_line_length": 44.69230769230769,
"alnum_prop": 0.73407917383821,
"repo_name": "kuali/kpme",
"id": "30a79313a3bfc09d9968b71bdcd2ba3c9cc13402",
"size": "1162",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pm/impl/src/main/resources/META-INF/kpme-pm-config-defaults.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ActionScript",
"bytes": "15982"
},
{
"name": "CSS",
"bytes": "203547"
},
{
"name": "Cucumber",
"bytes": "597"
},
{
"name": "Groovy",
"bytes": "22637"
},
{
"name": "HTML",
"bytes": "166124"
},
{
"name": "Java",
"bytes": "9817071"
},
{
"name": "JavaScript",
"bytes": "1205339"
},
{
"name": "PLSQL",
"bytes": "2723986"
},
{
"name": "XSLT",
"bytes": "5439"
}
],
"symlink_target": ""
} |
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace offset
{
template
<
typename Range,
typename RangeOut,
typename JoinStrategy,
typename Distance
>
struct offset_range
{
typedef typename coordinate_type<RangeOut>::type coordinate_type;
typedef typename point_type<RangeOut>::type output_point_type;
typedef model::referring_segment<output_point_type const> segment_type;
typedef typename boost::range_iterator<Range const>::type iterator_type;
static inline void apply(Range const& range,
RangeOut& out,
JoinStrategy const& join,
Distance const& distance)
{
output_point_type previous_p1, previous_p2;
output_point_type first_p1, first_p2;
bool first = true;
iterator_type it = boost::begin(range);
for (iterator_type prev = it++; it != boost::end(range); ++it)
{
if (! detail::equals::equals_point_point(*prev, *it))
{
bool skip = false;
// Simulate a vector d (dx,dy)
coordinate_type dx = get<0>(*it) - get<0>(*prev);
coordinate_type dy = get<1>(*it) - get<1>(*prev);
// For normalization [0,1] (=dot product d.d, sqrt)
coordinate_type length = sqrt(dx * dx + dy * dy);
// Because coordinates are not equal, length should not be zero
BOOST_ASSERT((! geometry::math::equals(length, 0)));
// Generate the normalized perpendicular p, to the left (ccw)
coordinate_type px = -dy / length;
coordinate_type py = dx / length;
output_point_type p1, p2;
set<0>(p2, get<0>(*it) + px * distance);
set<1>(p2, get<1>(*it) + py * distance);
set<0>(p1, get<0>(*prev) + px * distance);
set<1>(p1, get<1>(*prev) + py * distance);
if (! first)
{
output_point_type p;
segment_type s1(p1, p2);
segment_type s2(previous_p1, previous_p2);
if (detail::buffer::line_line_intersection<output_point_type, segment_type>::apply(s1, s2, p))
{
join.apply(p, *prev, previous_p2, p1, distance, out);
}
else
{
skip = false;
}
}
else
{
first = false;
first_p1 = p1;
first_p2 = p2;
out.push_back(p1);
}
if (! skip)
{
previous_p1 = p1;
previous_p2 = p2;
prev = it;
}
}
}
// Last one
out.push_back(previous_p2);
}
};
}} // namespace detail::offset
#endif
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template
<
typename GeometryTag,
typename GeometryOutTag,
typename Geometry,
typename GeometryOut,
typename JoinStrategy,
typename Distance
>
struct offset
{};
template
<
typename Geometry,
typename GeometryOut,
typename JoinStrategy,
typename Distance
>
struct offset
<
linestring_tag,
linestring_tag,
Geometry,
GeometryOut,
JoinStrategy,
Distance
>
: detail::offset::offset_range
<
Geometry,
GeometryOut,
JoinStrategy,
Distance
>
{};
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH
template
<
typename Geometry,
typename GeometryOut,
typename JoinStrategy,
typename Distance
>
inline void offset(Geometry const& geometry, GeometryOut& out,
JoinStrategy const& join,
Distance const& distance)
{
concept::check<Geometry const>();
concept::check<GeometryOut>();
dispatch::offset
<
typename tag<Geometry>::type,
typename tag<GeometryOut>::type,
Geometry,
GeometryOut,
JoinStrategy,
Distance
>::apply(geometry, out, join, distance);
}
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_EXTENSIONS_ALGORITHMS_OFFSET_HPP
| {
"content_hash": "cca79ce46027ad1737b6a7119496072c",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 114,
"avg_line_length": 24.335164835164836,
"alnum_prop": 0.5174983066154888,
"repo_name": "LevinJ/Pedestrian-detection-and-tracking",
"id": "92da0b7f262157ebb6309bdb4e9929069d0d7b22",
"size": "5180",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/doppia/libs/boost/geometry/extensions/algorithms/offset.hpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "10112"
},
{
"name": "C",
"bytes": "9241106"
},
{
"name": "C++",
"bytes": "17667301"
},
{
"name": "Cuda",
"bytes": "268238"
},
{
"name": "M",
"bytes": "2374"
},
{
"name": "Makefile",
"bytes": "2488"
},
{
"name": "Matlab",
"bytes": "55886"
},
{
"name": "Objective-C",
"bytes": "176"
},
{
"name": "Perl",
"bytes": "1417"
},
{
"name": "Python",
"bytes": "482759"
},
{
"name": "Shell",
"bytes": "2863"
},
{
"name": "Tcl",
"bytes": "1739"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<label ng-model="currentPhenomenonDisplayName">Speed</label>
<md-select ng-model="currentPhenomenonDisplayName">
<md-option ng-repeat="phenomenonName in phenomenonNames" >
{{phenomenonName}}
</md-option>
</md-select> | {
"content_hash": "027bb1fc98940e5bcb8a605703caed7a",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 66,
"avg_line_length": 38.857142857142854,
"alnum_prop": 0.6654411764705882,
"repo_name": "enviroCar/envirocar-www-ng",
"id": "b5084e11134e3d016185f636db5cfc9bdb5685ac",
"size": "272",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/components/track_analysis/chart/toolbar.partials/phenomenon_dropdown.directive.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "17744"
},
{
"name": "Dockerfile",
"bytes": "801"
},
{
"name": "HTML",
"bytes": "103486"
},
{
"name": "JavaScript",
"bytes": "492799"
},
{
"name": "SCSS",
"bytes": "19493"
},
{
"name": "Shell",
"bytes": "313"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OfficeOpenXml;
using OfficeOpenXml.Style;
namespace Excel
{
/// <summary>
/// Clase base que representa un registro de una hoja de un archivo Excel.
/// </summary>
public abstract class ExcelRegistroBase
{
public ExcelRegistroBase(ExcelWorksheet hoja, int fila)
{
if (hoja == null)
throw new ArgumentNullException("hoja");
Hoja = hoja;
Fila = fila;
Errores = new List<string>();
}
#region Propiedades
#region Publicas
public int Fila { get; private set; }
public List<string> Errores { get; private set; }
public bool EsValido
{
get { return Errores.Count == 0; }
}
/// <summary>
/// Indica si el registro es un registro vacío.
/// </summary>
public abstract bool EsRegistroVacio { get; }
#endregion Publicos
#region Privadas
private ExcelWorksheet Hoja { get; set; }
#endregion Privadas
#endregion Propiedades
#region Metodos
#region Protegidos
protected string ObtenerTexto(int columna, string descripcion, bool esRequerido = true)
{
var celda = Hoja.Cells[Fila, columna];
var valor = celda.Value;
if (valor != null)
return Convert.ToString(valor);
else
{
if (esRequerido)
Errores.Add(string.Format("El dato '{0}' es requerido y no ha sido especificado (celda {1}).", descripcion, celda.Address));
return null;
}
}
protected T? ObtenerValor<T>(int columna, string descripcion, bool esRequerido = true)
where T : struct
{
var celda = Hoja.Cells[Fila, columna];
var valor = celda.Value;
if (valor != null)
{
try
{
return (T)Convert.ChangeType(valor, typeof(T));
}
catch (Exception)
{
Errores.Add(string.Format("El dato '{0}' no es válido (celda {1}).", descripcion, celda.Address));
return null;
}
}
else
{
if (esRequerido)
Errores.Add(string.Format("El dato '{0}' es requerido y no ha sido especificado (celda {1}).", descripcion, celda.Address));
return null;
}
}
public T? ObtenerEnum<T>(int columna, string descripcion, bool esRequerido = true)
where T : struct
{
var tipo = typeof(T);
if (!tipo.IsEnum)
throw new ArgumentException(string.Format("El tipo '{0}' no es un Enum válido.", tipo.Name));
var celda = Hoja.Cells[Fila, columna];
var valor = celda.Value;
if (valor != null)
{
try
{
return (T?)Enum.Parse(tipo, Convert.ToString(valor));
}
catch (Exception)
{
Errores.Add(string.Format("El dato '{0}' no es válido (celda {1}).", descripcion, celda.Address));
return null;
}
}
else
{
if (esRequerido)
Errores.Add(string.Format("El dato '{0}' es requerido y no ha sido especificado (celda {1}).", descripcion, celda.Address));
return null;
}
}
#endregion Protegidos
#endregion Metodos
}
}
| {
"content_hash": "40dd4acb010739cec69772acf8bcae8e",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 144,
"avg_line_length": 28.198529411764707,
"alnum_prop": 0.5011734028683181,
"repo_name": "MatiasALopez/ExcelConEPPlus",
"id": "4a88a72f12f63055a6a83004cec5ae5b9de45c61",
"size": "3841",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Excel/ExcelRegistroBase.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "21422"
}
],
"symlink_target": ""
} |
A pop-up, 32-bit color palette used as part of a PaintBoxMorph.
| {
"content_hash": "679e7fee7962f8379e3c7fdf622d8cbb",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 63,
"avg_line_length": 64,
"alnum_prop": 0.765625,
"repo_name": "camillobruni/squeak-camis-addons",
"id": "c02f6acc37ac726adf3d71fbdbd7a446f38b9e5f",
"size": "64",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "repository/Morphic.package/PaintBoxColorPicker.class/README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Smalltalk",
"bytes": "5568735"
}
],
"symlink_target": ""
} |
/**
@ngdoc directive
@name umbraco.directives.directive:umbConfirm
@restrict E
@scope
@description
A confirmation dialog
<h3>Markup example</h3>
<pre>
<div ng-controller="My.Controller as vm">
<umb-confirm caption="Title" on-confirm="vm.onConfirm()" on-cancel="vm.onCancel()"></umb-confirm>
</div>
</pre>
<h3>Controller example</h3>
<pre>
(function () {
"use strict";
function Controller() {
var vm = this;
vm.onConfirm = function() {
alert('Confirm clicked');
};
vm.onCancel = function() {
alert('Cancel clicked');
}
}
angular.module("umbraco").controller("My.Controller", Controller);
})();
</pre>
@param {string} caption (<code>attribute</code>): The caption shown above the buttons
@param {callback} on-confirm (<code>attribute</code>): The call back when the "OK" button is clicked. If not set the button will not be shown
@param {callback} on-cancel (<code>atribute</code>): The call back when the "Cancel" button is clicked. If not set the button will not be shown
**/
function confirmDirective() {
return {
restrict: "E", // restrict to an element
replace: true, // replace the html element with the template
templateUrl: 'views/components/umb-confirm.html',
scope: {
onConfirm: '=',
onCancel: '=',
caption: '@'
},
link: function (scope, element, attr, ctrl) {
scope.showCancel = false;
scope.showConfirm = false;
if (scope.onConfirm) {
scope.showConfirm = true;
}
if (scope.onCancel) {
scope.showCancel = true;
}
}
};
}
angular.module('umbraco.directives').directive("umbConfirm", confirmDirective);
| {
"content_hash": "4cd38994b1fa9dcfb679b3e340af2761",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 143,
"avg_line_length": 25.383561643835616,
"alnum_prop": 0.5833783054506206,
"repo_name": "lars-erik/Umbraco-CMS",
"id": "18e08bb97338e017f3f4e67ef9a960239b36d83b",
"size": "1855",
"binary": false,
"copies": "1",
"ref": "refs/heads/temp8-u4-11427-remove-propertyinjection",
"path": "src/Umbraco.Web.UI.Client/src/common/directives/components/umbconfirm.directive.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "753790"
},
{
"name": "ActionScript",
"bytes": "11355"
},
{
"name": "Batchfile",
"bytes": "10962"
},
{
"name": "C#",
"bytes": "11869028"
},
{
"name": "CSS",
"bytes": "287452"
},
{
"name": "Erlang",
"bytes": "1782"
},
{
"name": "HTML",
"bytes": "497648"
},
{
"name": "JavaScript",
"bytes": "2430525"
},
{
"name": "PowerShell",
"bytes": "1212"
},
{
"name": "Python",
"bytes": "876"
},
{
"name": "Ruby",
"bytes": "765"
},
{
"name": "XSLT",
"bytes": "49960"
}
],
"symlink_target": ""
} |
#if !defined(WELS_ENCODER_EXTERN_H__)
#define WELS_ENCODER_EXTERN_H__
#include "typedefs.h"
#include "encoder_context.h"
namespace WelsSVCEnc {
//#pragma pack()
/*!
* \brief initialize source picture body
* \param kpSrc SSourcePicture*
* \param kiCsp internal csp format
* \param kiWidth widht of picture in pixels
* \param kiHeight height of picture in pixels
* \return successful - 0; otherwise none 0 for failed
*/
int32_t InitPic (const void* kpSrc, const int32_t kiCsp, const int32_t kiWidth, const int32_t kiHeight);
/*
* SVC core encoder external interfaces
*/
/*!
* \brief validate checking in parameter configuration
* \pParam pParam SWelsSvcCodingParam*
* \return successful - 0; otherwise none 0 for failed
*/
int32_t ParamValidationExt (void* pParam);
// GOM based RC related for uiSliceNum decision
void GomValidCheck (const int32_t kiMbWidth, const int32_t kiMbHeight, int32_t* pSliceNum);
/*!
* \brief initialize Wels avc encoder core library
* \param ppCtx sWelsEncCtx**
* \param para SWelsSvcCodingParam*
* \return successful - 0; otherwise none 0 for failed
*/
int32_t WelsInitEncoderExt (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pPara);
/*!
* \brief uninitialize Wels encoder core library
* \param pEncCtx sWelsEncCtx*
* \return none
*/
void WelsUninitEncoderExt (sWelsEncCtx** ppCtx);
/*!
* \brief core svc encoding process
*
* \param h sWelsEncCtx*, encoder context
* \param dst FrameBSInfo*
* \param pSrc SSourcePicture* for need_ds = true or SSourcePicture** for need_ds = false
* \param kiConfiguredLayerNum =1 in case need_ds = true or >1 in case need_ds = false
* \param need_ds Indicate whether need down sampling desired
* [NO in picture list case, YES in console aplication based]
* \return EFrameType (WELS_FRAME_TYPE_IDR/WELS_FRAME_TYPE_I/WELS_FRAME_TYPE_P)
*/
int32_t WelsEncoderEncodeExt (sWelsEncCtx*, void* pDst, const SSourcePicture** kppSrcList,
const int32_t kiConfiguredLayerNum);
/*
* Force coding IDR as follows
*/
int32_t ForceCodingIDR (sWelsEncCtx* pCtx);
/*!
* \brief Wels SVC encoder parameters adjustment
* SVC adjustment results in new requirement in memory blocks adjustment
*/
int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNew);
int32_t FilterLTRRecoveryRequest (sWelsEncCtx* pCtx, SLTRRecoverRequest* pLTRRecoverRequest);
void FilterLTRMarkingFeedback (sWelsEncCtx* pCtx, SLTRMarkingFeedback* pLTRMarkingFeedback);
}
#endif//WELS_ENCODER_CALLBACK_H__
| {
"content_hash": "354c1cd1826983bee98460bd8a7ec193",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 104,
"avg_line_length": 30.926829268292682,
"alnum_prop": 0.735410094637224,
"repo_name": "chenxy/openh264",
"id": "f55f6414d889ecf2ec2ce0d7693cf4fbeb3612e9",
"size": "4256",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "codec/encoder/core/inc/extern.h",
"mode": "33188",
"license": "bsd-2-clause",
"language": [],
"symlink_target": ""
} |
import {Viewport, ViewportBindingNatural_, ViewportBindingNaturalIosEmbed_,
ViewportBindingVirtual_, parseViewportMeta, stringifyViewportMeta,
updateViewportMetaString} from '../../src/viewport';
import {getStyle} from '../../src/style';
import * as sinon from 'sinon';
describe('Viewport', () => {
let sandbox;
let clock;
let viewport;
let binding;
let viewer;
let viewerMock;
let windowApi;
let viewerViewportHandler;
beforeEach(() => {
sandbox = sinon.sandbox.create();
clock = sandbox.useFakeTimers();
viewerViewportHandler = undefined;
viewer = {
getViewportWidth: () => 111,
getViewportHeight: () => 222,
getScrollTop: () => 17,
getPaddingTop: () => 19,
onViewportEvent: handler => {
viewerViewportHandler = handler;
}
};
viewerMock = sandbox.mock(viewer);
windowApi = {
document: {
documentElement: {style: {}}
}
};
binding = new ViewportBindingVirtual_(windowApi, viewer);
viewport = new Viewport(windowApi, binding, viewer);
viewport.getSize();
});
afterEach(() => {
viewport = null;
binding = null;
viewer = null;
clock.restore();
clock = null;
sandbox.restore();
sandbox = null;
});
it('should pass through size and scroll', () => {
expect(viewport.getPaddingTop()).to.equal(19);
expect(windowApi.document.documentElement.style.paddingTop).to
.equal('19px');
expect(viewport.getSize().width).to.equal(111);
expect(viewport.getSize().height).to.equal(222);
expect(viewport.getTop()).to.equal(17);
expect(viewport.getRect().left).to.equal(0);
expect(viewport.getRect().top).to.equal(17);
expect(viewport.getRect().width).to.equal(111);
expect(viewport.getRect().height).to.equal(222);
});
it('should not relayout on height resize', () => {
let changeEvent = null;
viewport.onChanged(event => {
changeEvent = event;
});
viewerMock.expects('getViewportHeight').returns(223).atLeast(1);
viewerViewportHandler();
expect(changeEvent).to.not.equal(null);
expect(changeEvent.relayoutAll).to.equal(false);
expect(changeEvent.velocity).to.equal(0);
});
it('should relayout on width resize', () => {
let changeEvent = null;
viewport.onChanged(event => {
changeEvent = event;
});
viewerMock.expects('getViewportWidth').returns(112).atLeast(1);
viewerViewportHandler();
expect(changeEvent).to.not.equal(null);
expect(changeEvent.relayoutAll).to.equal(true);
expect(changeEvent.velocity).to.equal(0);
});
it('should update padding when changed only', () => {
// Shouldn't call updatePaddingTop since it hasn't changed.
let bindingMock = sandbox.mock(binding);
bindingMock.expects('updatePaddingTop').never();
viewerViewportHandler();
bindingMock.verify();
bindingMock.restore();
// Should call updatePaddingTop.
bindingMock = sandbox.mock(binding);
viewerMock.expects('getPaddingTop').returns(21).atLeast(1);
bindingMock.expects('updatePaddingTop').withArgs(21).once();
viewerViewportHandler();
bindingMock.verify();
bindingMock.restore();
});
it('should call binding.updateViewerViewport', () => {
const bindingMock = sandbox.mock(binding);
bindingMock.expects('updateViewerViewport').once();
viewerViewportHandler();
bindingMock.verify();
bindingMock.restore();
});
it('should defer scroll events', () => {
let changeEvent = null;
viewport.onChanged(event => {
changeEvent = event;
});
viewer.getScrollTop = () => {return 34;};
viewerViewportHandler();
expect(changeEvent).to.equal(null);
// Not enough time past.
clock.tick(100);
viewer.getScrollTop = () => {return 35;};
viewerViewportHandler();
expect(changeEvent).to.equal(null);
// A bit more time.
clock.tick(750);
expect(changeEvent).to.not.equal(null);
expect(changeEvent.relayoutAll).to.equal(false);
expect(changeEvent.velocity).to.be.closeTo(0.002, 1e-4);
});
it('should defer scroll events and react to reset of scroll pos', () => {
let changeEvent = null;
viewport.onChanged(event => {
changeEvent = event;
});
viewer.getScrollTop = () => {return 34;};
viewerViewportHandler();
expect(changeEvent).to.equal(null);
// Not enough time past.
clock.tick(100);
viewer.getScrollTop = () => {return 35;};
viewerViewportHandler();
expect(changeEvent).to.equal(null);
// Reset and wait a bit more time.
viewport./*OK*/scrollTop_ = null;
clock.tick(750);
expect(changeEvent).to.not.equal(null);
expect(changeEvent.relayoutAll).to.equal(false);
expect(changeEvent.velocity).to.equal(0);
});
it('should update scroll pos and reset cache', () => {
const bindingMock = sandbox.mock(binding);
bindingMock.expects('setScrollTop').withArgs(117).once();
viewport.setScrollTop(117);
expect(viewport./*OK*/scrollTop_).to.be.null;
});
it('should change scrollTop for scrollIntoView and respect padding', () => {
const element = document.createElement('div');
const bindingMock = sandbox.mock(binding);
bindingMock.expects('getLayoutRect').withArgs(element)
.returns({top: 111}).once();
bindingMock.expects('setScrollTop').withArgs(111 - /* padding */ 19).once();
viewport.scrollIntoView(element);
});
it('should deletegate scrollWidth', () => {
const bindingMock = sandbox.mock(binding);
bindingMock.expects('getScrollWidth').withArgs().returns(111).once();
expect(viewport.getScrollWidth()).to.equal(111);
});
});
describe('Viewport META', () => {
describe('parseViewportMeta', () => {
it('should accept null or empty strings', () => {
expect(parseViewportMeta(null)).to.be.empty;
});
it('should parse single key-value', () => {
expect(parseViewportMeta('width=device-width')).to.deep.equal({
'width': 'device-width'
});
});
it('should parse two key-values', () => {
expect(parseViewportMeta('width=device-width,minimum-scale=1')).to.deep
.equal({
'width': 'device-width',
'minimum-scale': '1'
});
});
it('should parse empty value', () => {
expect(parseViewportMeta('width=device-width,minimal-ui')).to.deep.equal({
'width': 'device-width',
'minimal-ui': ''
});
expect(parseViewportMeta('minimal-ui,width=device-width')).to.deep.equal({
'width': 'device-width',
'minimal-ui': ''
});
});
it('should return last dupe', () => {
expect(parseViewportMeta('width=100,width=200')).to.deep.equal({
'width': '200'
});
});
it('should ignore extra delims', () => {
expect(parseViewportMeta(',,,width=device-width,,,,minimum-scale=1,,,'))
.to.deep.equal({
'width': 'device-width',
'minimum-scale': '1'
});
});
});
describe('stringifyViewportMeta', () => {
it('should stringify empty', () => {
expect(stringifyViewportMeta({})).to.equal('');
});
it('should stringify single key-value', () => {
expect(stringifyViewportMeta({'width': 'device-width'}))
.to.equal('width=device-width');
});
it('should stringify two key-values', () => {
const res = stringifyViewportMeta({
'width': 'device-width',
'minimum-scale': '1'
});
expect(res == 'width=device-width,minimum-scale=1' ||
res == 'minimum-scale=1,width=device-width')
.to.be.true;
});
it('should stringify empty values', () => {
const res = stringifyViewportMeta({
'width': 'device-width',
'minimal-ui': ''
});
expect(res == 'width=device-width,minimal-ui' ||
res == 'minimal-ui,width=device-width')
.to.be.true;
});
});
describe('updateViewportMetaString', () => {
it('should do nothing with empty values', () => {
expect(updateViewportMetaString(
'', {})).to.equal('');
expect(updateViewportMetaString(
'width=device-width', {})).to.equal('width=device-width');
});
it('should add a new value', () => {
expect(updateViewportMetaString(
'', {'minimum-scale': '1'})).to.equal('minimum-scale=1');
expect(parseViewportMeta(updateViewportMetaString(
'width=device-width', {'minimum-scale': '1'})))
.to.deep.equal({
'width': 'device-width',
'minimum-scale': '1'
});
});
it('should replace the existing value', () => {
expect(parseViewportMeta(updateViewportMetaString(
'width=device-width,minimum-scale=2', {'minimum-scale': '1'})))
.to.deep.equal({
'width': 'device-width',
'minimum-scale': '1'
});
});
it('should delete the existing value', () => {
expect(parseViewportMeta(updateViewportMetaString(
'width=device-width,minimum-scale=1', {'minimum-scale': undefined})))
.to.deep.equal({
'width': 'device-width'
});
});
it('should ignore delete for a non-existing value', () => {
expect(parseViewportMeta(updateViewportMetaString(
'width=device-width', {'minimum-scale': undefined})))
.to.deep.equal({
'width': 'device-width'
});
});
it('should do nothing if values did not change', () => {
expect(updateViewportMetaString(
'width=device-width,minimum-scale=1', {'minimum-scale': '1'}))
.to.equal('width=device-width,minimum-scale=1');
});
});
describe('TouchZoom', () => {
let sandbox;
let clock;
let viewport;
let binding;
let viewer;
let viewerMock;
let windowApi;
let originalViewportMetaString, viewportMetaString;
let viewportMeta;
let viewportMetaSetter;
beforeEach(() => {
sandbox = sinon.sandbox.create();
clock = sandbox.useFakeTimers();
viewer = {
getViewportWidth: () => 111,
getViewportHeight: () => 222,
getScrollTop: () => 0,
getPaddingTop: () => 0,
onViewportEvent: () => {},
isEmbedded: () => false
};
viewerMock = sandbox.mock(viewer);
originalViewportMetaString = 'width=device-width,minimum-scale=1';
viewportMetaString = originalViewportMetaString;
viewportMeta = Object.create(null);
viewportMetaSetter = sinon.spy();
Object.defineProperty(viewportMeta, 'content', {
get: () => viewportMetaString,
set: value => {
viewportMetaSetter(value);
viewportMetaString = value;
}
});
windowApi = {
document: {
documentElement: {style: {}},
querySelector: selector => {
if (selector == 'meta[name=viewport]') {
return viewportMeta;
}
return undefined;
}
}
};
binding = new ViewportBindingVirtual_(windowApi, viewer);
viewport = new Viewport(windowApi, binding, viewer);
});
afterEach(() => {
viewport = null;
binding = null;
viewer = null;
clock.restore();
clock = null;
sandbox.restore();
sandbox = null;
});
it('should initialize original viewport meta', () => {
viewport.getViewportMeta_();
expect(viewport.originalViewportMetaString_).to.equal(viewportMetaString);
expect(viewportMetaSetter.callCount).to.equal(0);
});
it('should disable TouchZoom', () => {
viewport.disableTouchZoom();
expect(viewportMetaSetter.callCount).to.equal(1);
expect(viewportMetaString).to.have.string('maximum-scale=1');
expect(viewportMetaString).to.have.string('user-scalable=no');
});
it('should ignore disable TouchZoom if already disabled', () => {
viewportMetaString = 'width=device-width,minimum-scale=1,' +
'maximum-scale=1,user-scalable=no';
viewport.disableTouchZoom();
expect(viewportMetaSetter.callCount).to.equal(0);
});
it('should ignore disable TouchZoom if embedded', () => {
viewerMock.expects('isEmbedded').returns(true).atLeast(1);
viewport.disableTouchZoom();
expect(viewportMetaSetter.callCount).to.equal(0);
});
it('should restore TouchZoom', () => {
viewport.disableTouchZoom();
expect(viewportMetaSetter.callCount).to.equal(1);
expect(viewportMetaString).to.have.string('maximum-scale=1');
expect(viewportMetaString).to.have.string('user-scalable=no');
viewport.restoreOriginalTouchZoom();
expect(viewportMetaSetter.callCount).to.equal(2);
expect(viewportMetaString).to.equal(originalViewportMetaString);
});
it('should reset TouchZoom; zooming state unknown', () => {
viewport.resetTouchZoom();
expect(viewportMetaSetter.callCount).to.equal(1);
expect(viewportMetaString).to.have.string('maximum-scale=1');
expect(viewportMetaString).to.have.string('user-scalable=no');
clock.tick(1000);
expect(viewportMetaSetter.callCount).to.equal(2);
expect(viewportMetaString).to.equal(originalViewportMetaString);
});
it('should ignore reset TouchZoom if not currently zoomed', () => {
windowApi.document.documentElement.clientHeight = 500;
windowApi.innerHeight = 500;
viewport.resetTouchZoom();
expect(viewportMetaSetter.callCount).to.equal(0);
});
it('should proceed with reset TouchZoom if currently zoomed', () => {
windowApi.document.documentElement.clientHeight = 500;
windowApi.innerHeight = 300;
viewport.resetTouchZoom();
expect(viewportMetaSetter.callCount).to.equal(1);
});
it('should ignore reset TouchZoom if embedded', () => {
viewerMock.expects('isEmbedded').returns(true).atLeast(1);
viewport.resetTouchZoom();
expect(viewportMetaSetter.callCount).to.equal(0);
});
});
});
describe('ViewportBindingNatural', () => {
let sandbox;
let windowMock;
let binding;
let windowApi;
let windowEventHandlers;
beforeEach(() => {
sandbox = sinon.sandbox.create();
const WindowApi = function() {};
windowEventHandlers = {};
WindowApi.prototype.addEventListener = function(eventType, handler) {
windowEventHandlers[eventType] = handler;
};
windowApi = new WindowApi();
windowMock = sandbox.mock(windowApi);
binding = new ViewportBindingNatural_(windowApi);
});
afterEach(() => {
binding = null;
windowMock.verify();
windowMock = null;
sandbox.restore();
sandbox = null;
});
it('should subscribe to scroll and resize events', () => {
expect(windowEventHandlers['scroll']).to.not.equal(undefined);
expect(windowEventHandlers['resize']).to.not.equal(undefined);
});
it('should update padding', () => {
windowApi.document = {
documentElement: {style: {}}
};
binding.updatePaddingTop(31);
expect(windowApi.document.documentElement.style.paddingTop).to
.equal('31px');
});
it('should calculate size', () => {
windowApi.innerWidth = 111;
windowApi.innerHeight = 222;
windowApi.document = {
documentElement: {
clientWidth: 111,
clientHeight: 222
}
};
const size = binding.getSize();
expect(size.width).to.equal(111);
expect(size.height).to.equal(222);
});
it('should calculate scrollTop from scrollElement', () => {
windowApi.pageYOffset = 11;
windowApi.document = {
scrollingElement: {
scrollTop: 17
}
};
expect(binding.getScrollTop()).to.equal(17);
});
it('should calculate scrollWidth from scrollElement', () => {
windowApi.pageYOffset = 11;
windowApi.document = {
scrollingElement: {
scrollWidth: 117
}
};
expect(binding.getScrollWidth()).to.equal(117);
});
it('should update scrollTop on scrollElement', () => {
windowApi.pageYOffset = 11;
windowApi.document = {
scrollingElement: {
scrollTop: 17
}
};
binding.setScrollTop(21);
expect(windowApi.document.scrollingElement./*OK*/scrollTop).to.equal(21);
});
it('should fallback scrollTop to pageYOffset', () => {
windowApi.pageYOffset = 11;
windowApi.document = {scrollingElement: {}};
expect(binding.getScrollTop()).to.equal(11);
});
it('should offset client rect for layout', () => {
windowApi.pageXOffset = 100;
windowApi.pageYOffset = 200;
windowApi.document = {scrollingElement: {}};
const el = {
getBoundingClientRect: () => {
return {left: 11.5, top: 12.5, width: 13.5, height: 14.5};
}
};
const rect = binding.getLayoutRect(el);
expect(rect.left).to.equal(112); // round(100 + 11.5)
expect(rect.top).to.equal(213); // round(200 + 12.5)
expect(rect.width).to.equal(14); // round(13.5)
expect(rect.height).to.equal(15); // round(14.5)
});
});
describe('ViewportBindingNaturalIosEmbed', () => {
let sandbox;
let clock;
let windowMock;
let binding;
let windowApi;
let windowEventHandlers;
let bodyEventListeners;
let bodyChildren;
beforeEach(() => {
sandbox = sinon.sandbox.create();
clock = sandbox.useFakeTimers();
const WindowApi = function() {};
windowEventHandlers = {};
bodyEventListeners = {};
bodyChildren = [];
WindowApi.prototype.addEventListener = function(eventType, handler) {
windowEventHandlers[eventType] = handler;
};
windowApi = new WindowApi();
windowApi.innerWidth = 555;
windowApi.document = {
readyState: 'complete',
documentElement: {style: {}},
body: {
scrollWidth: 777,
style: {},
appendChild: child => {
bodyChildren.push(child);
},
addEventListener: (eventType, handler) => {
bodyEventListeners[eventType] = handler;
}
},
createElement: tagName => {
return {
tagName: tagName,
id: '',
style: {},
scrollIntoView: sinon.spy()
};
}
};
windowMock = sandbox.mock(windowApi);
binding = new ViewportBindingNaturalIosEmbed_(windowApi);
clock.tick(1);
return Promise.resolve();
});
afterEach(() => {
binding = null;
windowMock.verify();
windowMock = null;
sandbox.restore();
sandbox = null;
});
it('should subscribe to resize events on window, scroll on body', () => {
expect(windowEventHandlers['resize']).to.not.equal(undefined);
expect(windowEventHandlers['scroll']).to.equal(undefined);
expect(bodyEventListeners['scroll']).to.not.equal(undefined);
});
it('should pre-calculate scrollWidth', () => {
expect(binding.scrollWidth_).to.equal(777);
});
it('should defer scrollWidth to max of window.innerHeight ' +
' and body.scrollWidth', () => {
binding.scrollWidth_ = 0;
expect(binding.getScrollWidth()).to.equal(555);
binding.scrollWidth_ = 1000;
expect(binding.getScrollWidth()).to.equal(1000);
});
it('should setup document for embed scrolling', () => {
const documentElement = windowApi.document.documentElement;
const body = windowApi.document.body;
expect(documentElement.style.overflow).to.equal('auto');
expect(documentElement.style.webkitOverflowScrolling).to.equal('touch');
expect(body.style.overflow).to.equal('auto');
expect(body.style.webkitOverflowScrolling).to.equal('touch');
expect(body.style.position).to.equal('absolute');
expect(body.style.top).to.equal(0);
expect(body.style.left).to.equal(0);
expect(body.style.right).to.equal(0);
expect(body.style.bottom).to.equal(0);
expect(bodyChildren.length).to.equal(2);
expect(bodyChildren[0].id).to.equal('-amp-scrollpos');
expect(bodyChildren[0].style.position).to.equal('absolute');
expect(bodyChildren[0].style.top).to.equal(0);
expect(bodyChildren[0].style.left).to.equal(0);
expect(bodyChildren[0].style.width).to.equal(0);
expect(bodyChildren[0].style.height).to.equal(0);
expect(bodyChildren[0].style.visibility).to.equal('hidden');
expect(bodyChildren[1].id).to.equal('-amp-scrollmove');
expect(bodyChildren[1].style.position).to.equal('absolute');
expect(bodyChildren[1].style.top).to.equal(0);
expect(bodyChildren[1].style.left).to.equal(0);
expect(bodyChildren[1].style.width).to.equal(0);
expect(bodyChildren[1].style.height).to.equal(0);
expect(bodyChildren[1].style.visibility).to.equal('hidden');
});
it('should update padding on BODY', () => {
windowApi.document = {
body: {style: {}}
};
binding.updatePaddingTop(31);
expect(windowApi.document.body.style.paddingTop).to
.equal('31px');
});
it('should calculate size', () => {
windowApi.innerWidth = 111;
windowApi.innerHeight = 222;
const size = binding.getSize();
expect(size.width).to.equal(111);
expect(size.height).to.equal(222);
});
it('should calculate scrollTop from scrollpos element', () => {
bodyChildren[0].getBoundingClientRect = () => {
return {top: -17, left: -11};
};
binding.onScrolled_();
expect(binding.getScrollTop()).to.equal(17);
});
it('should update scroll position via moving element', () => {
const moveEl = bodyChildren[1];
binding.setScrollTop(17);
expect(getStyle(moveEl, 'transform')).to.equal('translateY(17px)');
expect(moveEl.scrollIntoView.callCount).to.equal(1);
expect(moveEl.scrollIntoView.firstCall.args[0]).to.equal(true);
});
it('should offset client rect for layout', () => {
bodyChildren[0].getBoundingClientRect = () => {
return {top: -200, left: -100};
};
binding.onScrolled_();
const el = {
getBoundingClientRect: () => {
return {left: 11.5, top: 12.5, width: 13.5, height: 14.5};
}
};
const rect = binding.getLayoutRect(el);
expect(rect.left).to.equal(112); // round(100 + 11.5)
expect(rect.top).to.equal(213); // round(200 + 12.5)
expect(rect.width).to.equal(14); // round(13.5)
expect(rect.height).to.equal(15); // round(14.5)
});
it('should set scroll position via moving element', () => {
const moveEl = bodyChildren[1];
binding.setScrollPos_(10);
expect(getStyle(moveEl, 'transform')).to.equal('translateY(10px)');
expect(moveEl.scrollIntoView.callCount).to.equal(1);
expect(moveEl.scrollIntoView.firstCall.args[0]).to.equal(true);
});
it('should adjust scroll position when scrolled to 0', () => {
const posEl = bodyChildren[0];
posEl.getBoundingClientRect = () => {return {top: 0, left: 0};};
const moveEl = bodyChildren[1];
const event = {preventDefault: sinon.spy()};
binding.adjustScrollPos_(event);
expect(getStyle(moveEl, 'transform')).to.equal('translateY(1px)');
expect(moveEl.scrollIntoView.callCount).to.equal(1);
expect(moveEl.scrollIntoView.firstCall.args[0]).to.equal(true);
expect(event.preventDefault.callCount).to.equal(1);
});
it('should adjust scroll position when scrolled to 0; w/o event', () => {
const posEl = bodyChildren[0];
posEl.getBoundingClientRect = () => {return {top: 0, left: 0};};
const moveEl = bodyChildren[1];
binding.adjustScrollPos_();
expect(moveEl.scrollIntoView.callCount).to.equal(1);
});
it('should NOT adjust scroll position when scrolled away from 0', () => {
const posEl = bodyChildren[0];
posEl.getBoundingClientRect = () => {return {top: -10, left: 0};};
const moveEl = bodyChildren[1];
const event = {preventDefault: sinon.spy()};
binding.adjustScrollPos_(event);
expect(moveEl.scrollIntoView.callCount).to.equal(0);
expect(event.preventDefault.callCount).to.equal(0);
});
it('should NOT adjust scroll position when overscrolled', () => {
const posEl = bodyChildren[0];
posEl.getBoundingClientRect = () => {return {top: 10, left: 0};};
const moveEl = bodyChildren[1];
const event = {preventDefault: sinon.spy()};
binding.adjustScrollPos_(event);
expect(moveEl.scrollIntoView.callCount).to.equal(0);
expect(event.preventDefault.callCount).to.equal(0);
});
});
describe('ViewportBindingVirtual', () => {
let sandbox;
let binding;
let windowApi;
let viewer;
let viewerMock;
beforeEach(() => {
sandbox = sinon.sandbox.create();
viewer = {
getViewportWidth: () => 111,
getViewportHeight: () => 222,
getScrollTop: () => 17,
getPaddingTop: () => 19
};
viewerMock = sandbox.mock(viewer);
windowApi = {
document: {
documentElement: {style: {}}
}
};
binding = new ViewportBindingVirtual_(windowApi, viewer);
});
afterEach(() => {
binding = null;
viewer = null;
sandbox.restore();
sandbox = null;
});
it('should configure viewport parameters', () => {
expect(binding.getSize().width).to.equal(111);
expect(binding.getSize().height).to.equal(222);
expect(binding.getScrollTop()).to.equal(17);
});
it('should update padding', () => {
windowApi.document = {
documentElement: {style: {}}
};
binding.updatePaddingTop(33);
expect(windowApi.document.documentElement.style.paddingTop).to
.equal('33px');
});
it('should send event on scroll changed', () => {
const scrollHandler = sinon.spy();
binding.onScroll(scrollHandler);
expect(scrollHandler.callCount).to.equal(0);
// No value.
binding.updateViewerViewport(viewer);
expect(scrollHandler.callCount).to.equal(0);
expect(binding.getScrollTop()).to.equal(17);
// Value didn't change.
viewer.getScrollTop = () => {return 17;};
binding.updateViewerViewport(viewer);
expect(scrollHandler.callCount).to.equal(0);
expect(binding.getScrollTop()).to.equal(17);
// Value changed.
viewer.getScrollTop = () => {return 19;};
binding.updateViewerViewport(viewer);
expect(scrollHandler.callCount).to.equal(1);
expect(binding.getScrollTop()).to.equal(19);
});
it('should send event on size changed', () => {
const resizeHandler = sinon.spy();
binding.onResize(resizeHandler);
expect(resizeHandler.callCount).to.equal(0);
// No size.
binding.updateViewerViewport(viewer);
expect(resizeHandler.callCount).to.equal(0);
expect(binding.getSize().width).to.equal(111);
// Size didn't change.
viewer.getViewportWidth = () => {return 111;};
viewer.getViewportHeight = () => {return 222;};
binding.updateViewerViewport(viewer);
expect(resizeHandler.callCount).to.equal(0);
expect(binding.getSize().width).to.equal(111);
expect(binding.getSize().height).to.equal(222);
// Width changed.
viewer.getViewportWidth = () => {return 112;};
binding.updateViewerViewport(viewer);
expect(resizeHandler.callCount).to.equal(1);
expect(binding.getSize().width).to.equal(112);
expect(binding.getSize().height).to.equal(222);
// Height changed.
viewer.getViewportHeight = () => {return 223;};
binding.updateViewerViewport(viewer);
expect(resizeHandler.callCount).to.equal(2);
expect(binding.getSize().width).to.equal(112);
expect(binding.getSize().height).to.equal(223);
});
it('should NOT offset client rect for layout', () => {
const el = {
getBoundingClientRect: () => {
return {left: 11.5, top: 12.5, width: 13.5, height: 14.5};
}
};
const rect = binding.getLayoutRect(el);
expect(rect.left).to.equal(12); // round(11.5)
expect(rect.top).to.equal(13); // round(12.5)
expect(rect.width).to.equal(14); // round(13.5)
expect(rect.height).to.equal(15); // round(14.5)
});
});
| {
"content_hash": "6d6f459b5ad42b1d8404e98a87711310",
"timestamp": "",
"source": "github",
"line_count": 867,
"max_line_length": 80,
"avg_line_length": 32.13725490196079,
"alnum_prop": 0.6273193841294907,
"repo_name": "lugray/amphtml",
"id": "06348204eff3c444f8437d232402e6d53ecf5630",
"size": "28490",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/functional/test-viewport.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "19586"
},
{
"name": "HTML",
"bytes": "49085"
},
{
"name": "JavaScript",
"bytes": "1300248"
},
{
"name": "Protocol Buffer",
"bytes": "10115"
},
{
"name": "Python",
"bytes": "19379"
}
],
"symlink_target": ""
} |
package gofigure
// MIT Licensed (see README.md)- Copyright (c) 2014 Ryan S. Brown <sb@ryansb.com>
import (
"fmt"
)
type ParseFailure struct {
Field string
Type string
Value string
}
func (p *ParseFailure) Error() string {
return fmt.Sprintf("gofigure.Parsing: failure converting field=%s "+
"value with='%s' to type=%s", p.Field, p.Value, p.Type)
}
| {
"content_hash": "a0942b65745f32698644c151749e05e1",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 81,
"avg_line_length": 20.11111111111111,
"alnum_prop": 0.6933701657458563,
"repo_name": "ryansb/gofigure",
"id": "27c64af880d42f77a8b4a197b7d196e50dab24f0",
"size": "362",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "errors.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "13232"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head><meta charset='UTF-8'>
<title>ToDo -- test mashlib</title>
<link type="text/css" rel="stylesheet" href="/timbl/Automation/Library/Mashup/tabbedtab.css" />
<script type="text/javascript" src="/timbl/Automation/Library/Mashup/mashup-node-2.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
var UI = require('mashup')
var uri = window.location.href;
var data_uri = window.document.title = uri.slice(0, uri.lastIndexOf('/')+1) + 'config.ttl#tracker';
var kb = UI.store;
//var path = uri.indexOf('/', uri.indexOf('//') +2) + 1;
//var origin = uri.slice(0, path);
var subject = kb.sym(data_uri);
UI.outline.GotoSubject(subject, true, undefined, true, undefined);
});
</script>
</head>
<body>
<div class="TabulatorOutline" id="DummyUUID">
<table id="outline"></table>
</div>
</body>
</html>
| {
"content_hash": "f4597b2afd1a66d697453814b116c8c4",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 103,
"avg_line_length": 30.655172413793103,
"alnum_prop": 0.6602924634420697,
"repo_name": "linkeddata/mashlib",
"id": "8b1e8bbebed49f9e2c778c0d500319223237470b",
"size": "889",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "test/issue/todo/index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "23452"
},
{
"name": "HTML",
"bytes": "8630"
},
{
"name": "JavaScript",
"bytes": "1952"
},
{
"name": "Shell",
"bytes": "1016"
}
],
"symlink_target": ""
} |
require "spec_helper"
require "container/warden_client_provider"
describe WardenClientProvider do
let(:socket_path) { "/tmp/warden.sock.notreally" }
let(:connection_name) { "connection_name" }
let(:connected) { false }
let(:response) { "response" }
let(:connection) do
double("fake connection",
:name => connection_name,
:connect => response,
:connected? => connected
)
end
subject(:client_provider) { described_class.new(socket_path) }
describe "#get" do
before do
EventMachine::Warden::FiberAwareClient.stub(:new).with(socket_path).and_return(connection)
end
context "when connection is cached" do
before do
@client = client_provider.get(connection_name)
end
context "when connection is connected" do
let(:connected) { true }
it "uses cached connection" do
expect(client_provider.get(connection_name)).to equal(@client)
end
end
context "when connection is not connected" do
let(:connected) { false }
it "creates new connection" do
EventMachine::Warden::FiberAwareClient.should_receive(:new).with(socket_path).and_return(connection)
client_provider.get(connection_name)
end
end
end
context "when connection is not cached" do
let(:connected) { false }
before do
EventMachine::Warden::FiberAwareClient.should_receive(:new).with(socket_path).and_return(connection)
end
it "creates a new connection and caches it" do
client_provider.get(connection_name)
expect(client_provider.get(connection_name)).to eq(connection)
end
context "if connection fails" do
let(:connection) { double("failing connection")}
it "raises an error" do
connection.stub(:create).and_raise("whoops")
expect {
client_provider.get(connection_name)
}.to raise_error
end
end
end
end
describe "keeping track of connections" do
describe "#close_all" do
let(:connection_name_two) { "connection_name_two" }
let(:connection_two) do
double("fake connection 2",
:name => connection_name_two,
:connect => response,
:disconnect => "disconnecting",
:connected? => connected)
end
before do
EventMachine::Warden::FiberAwareClient.should_receive(:new).
with(socket_path).ordered.and_return(connection)
EventMachine::Warden::FiberAwareClient.should_receive(:new).
with(socket_path).ordered.and_return(connection_two)
client_provider.get(connection_name)
client_provider.get(connection_name_two)
end
it "closes all connections" do
connection.should_receive(:disconnect)
connection_two.should_receive(:disconnect)
client_provider.close_all
end
it "removes the connections from the cache" do
connection.stub(:disconnect)
connection_two.stub(:disconnect)
client_provider.close_all
EventMachine::Warden::FiberAwareClient.should_receive(:new).ordered.
with(socket_path).and_return(connection)
client_provider.get(connection_name)
end
end
end
end
| {
"content_hash": "309bbab6ad97450eb68aea0358a6dcee",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 110,
"avg_line_length": 29.54054054054054,
"alnum_prop": 0.640134187252211,
"repo_name": "cloudfoundry-attic/container_tools",
"id": "651e222a18ba37a829cf51e5eabe364748458dbd",
"size": "3279",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/container/warden_client_provider_spec.rb",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Ruby",
"bytes": "27032"
},
{
"name": "Shell",
"bytes": "136"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<GameData>
<MinorCivilization_CityNames>
<Row>
<MinorCivType>MINOR_CIV_SASKATCHEWAN</MinorCivType>
<CityName>TXT_KEY_CITYSTATE_SASKATCHEWAN_CITYTHREE</CityName>
</Row>
<Row>
<MinorCivType>MINOR_CIV_SASKATCHEWAN</MinorCivType>
<CityName>TXT_KEY_CITYSTATE_SASKATCHEWAN_CAPITAL</CityName>
</Row>
<Row>
<MinorCivType>MINOR_CIV_SASKATCHEWAN</MinorCivType>
<CityName>TXT_KEY_CITYSTATE_SASKATCHEWAN_CITYTWO</CityName>
</Row>
<Delete CityName="TXT_KEY_CITYSTATE_SASKATCHEWAN" />
</MinorCivilization_CityNames>
<Language_en_US>
<Row Tag="TXT_KEY_CITYSTATE_SASKATCHEWAN_CAPITAL">
<Text>Saskatoon</Text>
</Row>
<Row Tag="TXT_KEY_CITYSTATE_SASKATCHEWAN_CITYTHREE">
<Text>*Regina*</Text>
</Row>
<Row Tag="TXT_KEY_CITYSTATE_SASKATCHEWAN_CITYTWO">
<Text>Moose Jaw</Text>
</Row>
<Row Tag="TXT_KEY_CITYSTATE_SASKATCHEWAN">
<Text>Saskatchewan</Text>
</Row>
</Language_en_US>
</GameData> | {
"content_hash": "bc4f836724f0239fdfab899a7a083f11",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 64,
"avg_line_length": 31.3125,
"alnum_prop": 0.6916167664670658,
"repo_name": "joshuaexler/civ-5-united-civilizations",
"id": "d6f449af914220cdd0385f95ff1efff060e8544b",
"size": "1002",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "CityNames/SASKATCHEWAN_CityNames.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Lua",
"bytes": "16873"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html itemscope lang="en-us">
<head><meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta charset="utf-8">
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><meta name="generator" content="Hugo 0.57.2" />
<meta property="og:title" content="Location" />
<meta name="twitter:title" content="Location"/>
<meta itemprop="name" content="Location"><meta property="og:description" content="Venue DevOpsDay LA will be held at the Pasadena Convention Center on March 9, 2018.
Parking The convention center’s subterranean parking structure has plenty of available space. There are two entrances, (a) on Marengo Avenue, and (b) Euclid Avenue, both between Green Street and Cordova Street. Park will cost $12 a day for up to 16 hours; $18 a day for in-and-out privileges (subject to change). Alternate parking options are available on Parkopedia Hotel Room Block We have arranged for discounted hotel rooms at the Sheraton Pasadena offering rooms at $189/night (+tax) and Hilton Pasadena offering rooms at $179/night (+tax)." />
<meta name="twitter:description" content="Venue DevOpsDay LA will be held at the Pasadena Convention Center on March 9, 2018.
Parking The convention center’s subterranean parking structure has plenty of available space. There are two entrances, (a) on Marengo Avenue, and (b) Euclid Avenue, both between Green Street and Cordova Street. Park will cost $12 a day for up to 16 hours; $18 a day for in-and-out privileges (subject to change). Alternate parking options are available on Parkopedia Hotel Room Block We have arranged for discounted hotel rooms at the Sheraton Pasadena offering rooms at $189/night (+tax) and Hilton Pasadena offering rooms at $179/night (+tax)." />
<meta itemprop="description" content="Venue DevOpsDay LA will be held at the Pasadena Convention Center on March 9, 2018.
Parking The convention center’s subterranean parking structure has plenty of available space. There are two entrances, (a) on Marengo Avenue, and (b) Euclid Avenue, both between Green Street and Cordova Street. Park will cost $12 a day for up to 16 hours; $18 a day for in-and-out privileges (subject to change). Alternate parking options are available on Parkopedia Hotel Room Block We have arranged for discounted hotel rooms at the Sheraton Pasadena offering rooms at $189/night (+tax) and Hilton Pasadena offering rooms at $179/night (+tax)."><meta name="twitter:site" content="@devopsdays">
<meta property="og:type" content="event" />
<meta property="og:url" content="/events/2018-los-angeles/location/" /><meta name="twitter:label1" value="Event" />
<meta name="twitter:data1" value="devopsdays Los Angeles 2018" /><meta name="twitter:label2" value="Date" />
<meta name="twitter:data2" value="March 9, 2018" /><meta property="og:image" content="https://www.devopsdays.org/img/sharing.jpg" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:image" content="https://www.devopsdays.org/img/sharing.jpg" />
<meta itemprop="image" content="https://www.devopsdays.org/img/sharing.jpg" />
<meta property="fb:app_id" content="1904065206497317" /><meta itemprop="wordCount" content="122">
<title>devopsdays Los Angeles 2018 - location information
</title>
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-9713393-1', 'auto');
ga('send', 'pageview');
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>
<link href="/css/site.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto+Condensed:300,400,700" rel="stylesheet"><link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
<link href="/events/index.xml" rel="alternate" type="application/rss+xml" title="DevOpsDays" />
<link href="/events/index.xml" rel="feed" type="application/rss+xml" title="DevOpsDays" />
<script src=/js/devopsdays-min.js></script></head>
<body lang="">
<nav class="navbar navbar-expand-md navbar-light">
<a class="navbar-brand" href="/">
<img src="/img/devopsdays-brain.png" height="30" class="d-inline-block align-top" alt="devopsdays Logo">
DevOpsDays
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto"><li class="nav-item global-navigation"><a class = "nav-link" href="/events">events</a></li><li class="nav-item global-navigation"><a class = "nav-link" href="/blog">blog</a></li><li class="nav-item global-navigation"><a class = "nav-link" href="/sponsor">sponsor</a></li><li class="nav-item global-navigation"><a class = "nav-link" href="/speaking">speaking</a></li><li class="nav-item global-navigation"><a class = "nav-link" href="/organizing">organizing</a></li><li class="nav-item global-navigation"><a class = "nav-link" href="/about">about</a></li></ul>
</div>
</nav>
<nav class="navbar event-navigation navbar-expand-md navbar-light">
<a href="/events/2018-los-angeles" class="nav-link">Los Angeles</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar2">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse" id="navbar2">
<ul class="navbar-nav"><li class="nav-item active">
<a class="nav-link" href="/events/2018-los-angeles/location">location</a>
</li><li class="nav-item active">
<a class="nav-link" href="/events/2018-los-angeles/propose">propose</a>
</li><li class="nav-item active">
<a class="nav-link" href="/events/2018-los-angeles/program">program</a>
</li><li class="nav-item active">
<a class="nav-link" href="/events/2018-los-angeles/registration">registration</a>
</li><li class="nav-item active">
<a class="nav-link" href="/events/2018-los-angeles/speakers">speakers</a>
</li><li class="nav-item active">
<a class="nav-link" href="/events/2018-los-angeles/contact">contact</a>
</li><li class="nav-item active">
<a class="nav-link" href="/events/2018-los-angeles/conduct">conduct</a>
</li></ul>
</div>
</nav>
<div class="container-fluid">
<div class="row">
<div class="col-md-12"><div class="row">
<div class="col-md-12 content-text"><h1>devopsdays Los Angeles - Location</h1>
<h2>Venue</h2>
<p>DevOpsDay LA will be held at the <a href='http://pasadenacenter.visitpasadena.com'>Pasadena Convention Center</a> on March 9, 2018.</p>
<h3>Parking</h2>
The convention center’s subterranean parking structure has plenty of available space. There are two entrances, (a) on Marengo Avenue, and (b) Euclid Avenue, both between Green Street and Cordova Street.
Park will cost $12 a day for up to 16 hours; $18 a day for in-and-out privileges (subject to change).
Alternate parking options are available on <a href='http://en.parkopedia.com/parking/pasadena_convention_center_east_green_street_pasadena_ca_united_states/?ac=1&country=US&lat=34.143823&lng=-118.1441489'>Parkopedia</a>
<h3>Hotel Room Block</h3>
<p>We have arranged for discounted hotel rooms at the <a href='https://www.starwoodmeeting.com/events/start.action?id=1708177230&key=350A6FC0'>Sheraton Pasadena</a> offering rooms at $189/night (+tax) and <a href='http://www.hilton.com/en/hi/groups/personalized/P/PASPHHF-ASCLE-20180306/index.jhtml?WT.mc_id=POG'>Hilton Pasadena</a> offering rooms at $179/night (+tax).</p>
<p>The Sheraton Pasadena is onsite at the Convention Center, while the Hilton Pasadena is a short 5 minute walk from the venue.</p>
<div style="clear: both"></div>
<br /><div class="row cta-row">
<div class="col-md-12"><h4 class="sponsor-cta"> Sponsors</h4></div>
</div><div class="row sponsor-row"><div class = "col-lg-1 col-md-2 col-4">
<a href = "http://www.bmc.com"><img src = "/img/sponsors/bmc.png" alt = "bmc" title = "bmc" class="img-fluid"></a>
</div><div class = "col-lg-1 col-md-2 col-4">
<a href = "https://www.catchpoint.com/"><img src = "/img/sponsors/catchpoint.png" alt = "Catchpoint" title = "Catchpoint" class="img-fluid"></a>
</div><div class = "col-lg-1 col-md-2 col-4">
<a href = "https://www.cloudbolt.io"><img src = "/img/sponsors/cloudbolt.png" alt = "CloudBolt" title = "CloudBolt" class="img-fluid"></a>
</div><div class = "col-lg-1 col-md-2 col-4">
<a href = "https://www.contrastsecurity.com/"><img src = "/img/sponsors/contrast_security.png" alt = "Contrast Security" title = "Contrast Security" class="img-fluid"></a>
</div><div class = "col-lg-1 col-md-2 col-4">
<a href = "https://www.conjur.org/"><img src = "/img/sponsors/cyberark-before-20180816.png" alt = "cyberark-conjur" title = "cyberark-conjur" class="img-fluid"></a>
</div><div class = "col-lg-1 col-md-2 col-4">
<a href = "https://www.datadoghq.com"><img src = "/img/sponsors/datadog.png" alt = "Datadog" title = "Datadog" class="img-fluid"></a>
</div><div class = "col-lg-1 col-md-2 col-4">
<a href = "http://www.dynatrace.com/"><img src = "/img/sponsors/dynatrace.png" alt = "Dynatrace" title = "Dynatrace" class="img-fluid"></a>
</div><div class = "col-lg-1 col-md-2 col-4">
<a href = "https://www.influxdata.com/"><img src = "/img/sponsors/influxdata.png" alt = "InfluxData" title = "InfluxData" class="img-fluid"></a>
</div><div class = "col-lg-1 col-md-2 col-4">
<a href = "http://kaizenops.io"><img src = "/img/sponsors/kaizenops-before-20181008.png" alt = "kaizenOps" title = "kaizenOps" class="img-fluid"></a>
</div><div class = "col-lg-1 col-md-2 col-4">
<a href = "https://logz.io/"><img src = "/img/sponsors/logzio.png" alt = "logz.io" title = "logz.io" class="img-fluid"></a>
</div><div class = "col-lg-1 col-md-2 col-4">
<a href = "http://www.microsoft.com/"><img src = "/img/sponsors/microsoft.png" alt = "Microsoft" title = "Microsoft" class="img-fluid"></a>
</div><div class = "col-lg-1 col-md-2 col-4">
<a href = "https://www.newrelic.com/culture"><img src = "/img/sponsors/newrelic.png" alt = "New Relic" title = "New Relic" class="img-fluid"></a>
</div><div class = "col-lg-1 col-md-2 col-4">
<a href = "https://portworx.com/use-case/kubernetes-storage/"><img src = "/img/sponsors/portworx.png" alt = "portworx" title = "portworx" class="img-fluid"></a>
</div><div class = "col-lg-1 col-md-2 col-4">
<a href = "https://www.scalyr.com"><img src = "/img/sponsors/scalyr.png" alt = "Scalyr" title = "Scalyr" class="img-fluid"></a>
</div><div class = "col-lg-1 col-md-2 col-4">
<a href = "http://www.signalfx.com"><img src = "/img/sponsors/signalfx-before-20180508.png" alt = "SignalFX" title = "SignalFX" class="img-fluid"></a>
</div><div class = "col-lg-1 col-md-2 col-4">
<a href = "https://sysdig.com/"><img src = "/img/sponsors/sysdig.png" alt = "Sysdig" title = "Sysdig" class="img-fluid"></a>
</div><div class = "col-lg-1 col-md-2 col-4">
<a href = "http://www.verizondigitalmedia.com"><img src = "/img/sponsors/vdms.png" alt = "Verizon Digital Media Services" title = "Verizon Digital Media Services" class="img-fluid"></a>
</div></div><div class="row cta-row">
<div class="col-md-12"><h4 class="sponsor-cta">Startup Sponsors</h4><a href = "/events/2018-los-angeles/sponsor" class="sponsor-cta"><i>Join as Startup Sponsor!</i>
</a></div>
</div><div class="row sponsor-row"><div class = "col-lg-1 col-md-2 col-4">
<a href = "http://www.diag.ai"><img src = "/img/sponsors/diagai.png" alt = "diagai" title = "diagai" class="img-fluid"></a>
</div><div class = "col-lg-1 col-md-2 col-4">
<a href = "https://sensu.io/"><img src = "/img/sponsors/sensu.png" alt = "sensu" title = "sensu" class="img-fluid"></a>
</div><div class = "col-lg-1 col-md-2 col-4">
<a href = "https://sensu.io/"><img src = "/img/sponsors/sensu.png" alt = "sensu" title = "sensu" class="img-fluid"></a>
</div></div><div class="row cta-row">
<div class="col-md-12"><h4 class="sponsor-cta">Lanyard Sponsors</h4><a href = "/events/2018-los-angeles/sponsor" class="sponsor-cta"><i>Join as Lanyard Sponsor!</i>
</a></div>
</div><div class="row sponsor-row"></div><br />
</div>
</div>
</div></div>
</div>
<nav class="navbar bottom navbar-light footer-nav-row" style="background-color: #bfbfc1;">
<div class = "row">
<div class = "col-md-12 footer-nav-background">
<div class = "row">
<div class = "col-md-6 col-lg-3 footer-nav-col">
<h3 class="footer-nav">@DEVOPSDAYS</h3>
<div>
<a class="twitter-timeline" data-dnt="true" href="https://twitter.com/devopsdays/lists/devopsdays" data-chrome="noheader" height="440"></a>
<script>
! function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0],
p = /^http:/.test(d.location) ? 'http' : 'https';
if (!d.getElementById(id)) {
js = d.createElement(s);
js.id = id;
js.src = p + "://platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js, fjs);
}
}(document, "script", "twitter-wjs");
</script>
</div>
</div>
<div class="col-md-6 col-lg-3 footer-nav-col footer-content">
<h3 class="footer-nav">BLOG</h3><a href = "https://www.devopsdays.org/blog/2019/05/10/10-years-of-devopsdays/"><h1 class = "footer-heading">10 years of devopsdays</h1></a><h2 class="footer-heading">by Kris Buytaert - 10 May, 2019</h2><p class="footer-content">It’s hard to believe but it is almost 10 years ago since #devopsdays happened for the first time in Gent. Back then there were almost 70 of us talking about topics that were of interest to both Operations and Development, we were exchanging our ideas and experiences `on how we were improving the quality of software delivery.
Our ideas got started on the crossroads of Open Source, Agile and early Cloud Adoption.</p><a href = "https://www.devopsdays.org/blog/"><h1 class = "footer-heading">Blogs</h1></a><h2 class="footer-heading">10 May, 2019</h2><p class="footer-content"></p><a href="https://www.devopsdays.org/blog/index.xml">Feed</a>
</div>
<div class="col-md-6 col-lg-3 footer-nav-col">
<h3 class="footer-nav">CFP OPEN</h3><a href = "/events/2019-campinas" class = "footer-content">Campinas</a><br /><a href = "/events/2019-macapa" class = "footer-content">Macapá</a><br /><a href = "/events/2019-shanghai" class = "footer-content">Shanghai</a><br /><a href = "/events/2019-recife" class = "footer-content">Recife</a><br /><a href = "/events/2020-charlotte" class = "footer-content">Charlotte</a><br /><a href = "/events/2020-prague" class = "footer-content">Prague</a><br /><a href = "/events/2020-tokyo" class = "footer-content">Tokyo</a><br /><a href = "/events/2020-salt-lake-city" class = "footer-content">Salt Lake City</a><br />
<br />Propose a talk at an event near you!<br />
</div>
<div class="col-md-6 col-lg-3 footer-nav-col">
<h3 class="footer-nav">About</h3>
devopsdays is a worldwide community conference series for anyone interested in IT improvement.<br /><br />
<a href="/about/" class = "footer-content">About devopsdays</a><br />
<a href="/privacy/" class = "footer-content">Privacy Policy</a><br />
<a href="/conduct/" class = "footer-content">Code of Conduct</a>
<br />
<br />
<a href="https://www.netlify.com">
<img src="/img/netlify-light.png" alt="Deploys by Netlify">
</a>
</div>
</div>
</div>
</div>
</nav>
<script>
$(document).ready(function () {
$("#share").jsSocials({
shares: ["email", {share: "twitter", via: ''}, "facebook", "linkedin"],
text: 'devopsdays Los Angeles - 2018',
showLabel: false,
showCount: false
});
});
</script>
</body>
</html>
| {
"content_hash": "f369e37cde6cd483d5159d3f453e5e23",
"timestamp": "",
"source": "github",
"line_count": 250,
"max_line_length": 654,
"avg_line_length": 72.396,
"alnum_prop": 0.6451185148350738,
"repo_name": "gomex/devopsdays-web",
"id": "aca11e16fb39b3f45765adba578a70d5a20a9e85",
"size": "18108",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "static/events/2018-los-angeles/location/index.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1568"
},
{
"name": "HTML",
"bytes": "1937025"
},
{
"name": "JavaScript",
"bytes": "14313"
},
{
"name": "PowerShell",
"bytes": "291"
},
{
"name": "Ruby",
"bytes": "650"
},
{
"name": "Shell",
"bytes": "12282"
}
],
"symlink_target": ""
} |
r3
* Redesigned playlist, with thanks to @mikerhodes
+ New font
+ Slide down context menus
+ Repositioned add player
r2
* Abstracted CSS from HTML.
* Fixed player name overflow issue in the playlist.
* Added support for Soundcloud.com players.
* Players can be renamed.
r1
* Initial version of webplayer
| {
"content_hash": "6873acbaeaf184c6f22d1cc9037f6f6d",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 52,
"avg_line_length": 19.41176470588235,
"alnum_prop": 0.7151515151515152,
"repo_name": "elliottd/webplayer",
"id": "655e201bd79c8aafec377380b8856026ce31b58e",
"size": "330",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "CHANGELOG.md",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "5737"
},
{
"name": "JavaScript",
"bytes": "124182"
},
{
"name": "Perl",
"bytes": "13061"
}
],
"symlink_target": ""
} |
package com.vmware.vim25;
/**
* @author Steve Jin (http://www.doublecloud.org)
* @version 5.1
*/
@SuppressWarnings("all")
public class DistributedVirtualSwitchHostMemberPnicSpec extends DynamicData {
public String pnicDevice;
public String uplinkPortKey;
public String uplinkPortgroupKey;
public Integer connectionCookie;
public String getPnicDevice() {
return this.pnicDevice;
}
public String getUplinkPortKey() {
return this.uplinkPortKey;
}
public String getUplinkPortgroupKey() {
return this.uplinkPortgroupKey;
}
public Integer getConnectionCookie() {
return this.connectionCookie;
}
public void setPnicDevice(String pnicDevice) {
this.pnicDevice=pnicDevice;
}
public void setUplinkPortKey(String uplinkPortKey) {
this.uplinkPortKey=uplinkPortKey;
}
public void setUplinkPortgroupKey(String uplinkPortgroupKey) {
this.uplinkPortgroupKey=uplinkPortgroupKey;
}
public void setConnectionCookie(Integer connectionCookie) {
this.connectionCookie=connectionCookie;
}
} | {
"content_hash": "11c14f20a75ae43c1e1bbc4d6b39d061",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 77,
"avg_line_length": 21.895833333333332,
"alnum_prop": 0.758325404376784,
"repo_name": "paksv/vijava",
"id": "d28532cd62706efee349ad0ce6948b9478226b8f",
"size": "2691",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/com/vmware/vim25/DistributedVirtualSwitchHostMemberPnicSpec.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Java",
"bytes": "7900718"
}
],
"symlink_target": ""
} |
<?php
/**
* @file
* Contains \Drupal\views\Render\ViewsRenderPipelineMarkup.
*/
namespace Drupal\views\Render;
use Drupal\Component\Render\MarkupInterface;
use Drupal\Component\Render\MarkupTrait;
/**
* Defines an object that passes safe strings through the Views render system.
*
* This object should only be constructed with a known safe string. If there is
* any risk that the string contains user-entered data that has not been
* filtered first, it must not be used.
*
* @internal
* This object is marked as internal because it should only be used in the
* Views render pipeline.
*
* @see \Drupal\Core\Render\Markup
*/
final class ViewsRenderPipelineMarkup implements MarkupInterface, \Countable {
use MarkupTrait;
}
| {
"content_hash": "c106d6f124d64d1965e7456f7e111a24",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 79,
"avg_line_length": 26.642857142857142,
"alnum_prop": 0.7506702412868632,
"repo_name": "edwardchan/d8-drupalvm",
"id": "4532b9cddcdc17f3e1325e39b89cb1e26118e558",
"size": "746",
"binary": false,
"copies": "172",
"ref": "refs/heads/master",
"path": "drupal/core/modules/views/src/Render/ViewsRenderPipelineMarkup.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "50616"
},
{
"name": "CSS",
"bytes": "1250515"
},
{
"name": "HTML",
"bytes": "646836"
},
{
"name": "JavaScript",
"bytes": "1018469"
},
{
"name": "PHP",
"bytes": "31387248"
},
{
"name": "Shell",
"bytes": "675"
},
{
"name": "SourcePawn",
"bytes": "31943"
}
],
"symlink_target": ""
} |
package self.micromagic.app;
import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
import javax.portlet.PortletMode;
import javax.portlet.WindowState;
import self.micromagic.eterna.digester.ConfigurationException;
import self.micromagic.eterna.model.AppData;
import self.micromagic.eterna.model.Execute;
import self.micromagic.eterna.model.ModelAdapter;
import self.micromagic.eterna.model.ModelExport;
import self.micromagic.eterna.model.impl.AbstractExecute;
import self.micromagic.eterna.share.Generator;
public class RenderExecute extends AbstractExecute
implements Execute, Generator
{
protected ModelExport view = null;
protected ModelExport edit = null;
protected ModelExport help = null;
public void initialize(ModelAdapter model)
throws ConfigurationException
{
if (this.initialized)
{
return;
}
super.initialize(model);
String tmp = (String) this.getAttribute("view");
if (tmp != null)
{
this.view = model.getFactory().getModelExport(tmp);
if (this.view == null)
{
log.warn("The Model Export [" + tmp + "] not found.");
}
}
tmp = (String) this.getAttribute("edit");
if (tmp != null)
{
this.edit = model.getFactory().getModelExport(tmp);
if (this.edit == null)
{
log.warn("The Model Export [" + tmp + "] not found.");
}
}
tmp = (String) this.getAttribute("help");
if (tmp != null)
{
this.help = model.getFactory().getModelExport(tmp);
if (this.help == null)
{
log.warn("The Model Export [" + tmp + "] not found.");
}
}
}
public String getExecuteType() throws ConfigurationException
{
return "doRender";
}
public ModelExport execute(AppData data, Connection conn)
throws ConfigurationException, SQLException, IOException
{
WindowState state = data.renderRequest.getWindowState();
if (!state.equals(WindowState.MINIMIZED))
{
PortletMode mode = data.renderRequest.getPortletMode();
if (PortletMode.VIEW.equals(mode))
{
return this.view;
}
else if (PortletMode.EDIT.equals(mode))
{
return this.edit;
}
else if (PortletMode.HELP.equals(mode))
{
return this.help;
}
else
{
log.error("Unknown portlet mode: " + mode + ".");
}
}
return null;
}
} | {
"content_hash": "aaf650828bcb7419ca5f86ba3fb6a507",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 62,
"avg_line_length": 24.520833333333332,
"alnum_prop": 0.667374681393373,
"repo_name": "micromagic/eterna",
"id": "78ce0491c820f482cd1f4ed60c20d09826b2a4a1",
"size": "2988",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "main/src/share/self/micromagic/app/RenderExecute.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "13798"
},
{
"name": "GAP",
"bytes": "10812"
},
{
"name": "HTML",
"bytes": "1288"
},
{
"name": "Java",
"bytes": "3280227"
},
{
"name": "JavaScript",
"bytes": "266694"
},
{
"name": "Rich Text Format",
"bytes": "1423171"
}
],
"symlink_target": ""
} |
@extends('layout')
@section('title')Apply Application @stop
@section('body')
<p class="bg-warning" style="color:#fff;">
@foreach($errors->all() as $error)
{{ $error }}<br />
@endforeach
</p>
<form method="POST" action="../../application" accept-charset="UTF-8" class="form-horizontal">
{!! csrf_field() !!}
<div class="form-group">
<label class="col-sm-2 control-label">Letter</label>
<div class="col-sm-6">
<textarea class="form-control" name="letter" cols="50" rows="10"></textarea>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-6">
<input type="hidden" name="id" value="{{$id}}">
<input class="btn btn-primary btn-block" type="submit" value="Apply">
</div>
</div>
</form>
@stop
| {
"content_hash": "f24edeb2c8b249c902aeca00a48161c1",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 94,
"avg_line_length": 28.482758620689655,
"alnum_prop": 0.5653753026634383,
"repo_name": "publicarray/2503ict-assign2",
"id": "d25ddde6aa386c01559e26ca352fcb02cce4ec4a",
"size": "826",
"binary": false,
"copies": "1",
"ref": "refs/heads/Laravel5",
"path": "laravel/resources/views/application/create.blade.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "412"
},
{
"name": "JavaScript",
"bytes": "8531"
},
{
"name": "PHP",
"bytes": "153492"
}
],
"symlink_target": ""
} |
<?php
namespace LinkerBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class DefaultControllerTest extends WebTestCase
{
public function testIndex()
{
$client = static::createClient();
$crawler = $client->request('GET', '/');
$this->assertContains('Hello World', $client->getResponse()->getContent());
}
}
| {
"content_hash": "b34ce8f036751f1b2286c35d3f9a1add",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 83,
"avg_line_length": 22.11764705882353,
"alnum_prop": 0.675531914893617,
"repo_name": "tenzinleshy/linker",
"id": "e14239dd8b19062ab2bdedcd3a0f1a8ae2fb02fa",
"size": "376",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/LinkerBundle/Controller/DefaultControllerTest.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "6924"
},
{
"name": "HTML",
"bytes": "7871"
},
{
"name": "PHP",
"bytes": "78556"
}
],
"symlink_target": ""
} |
DEPRECATED
==================
This repository has been moved to
https://github.com/cloudtools/stacker_blueprints and is only kept here for
archival purposes. Please submit all issues & pull requests to the new repo.
Thanks!
stacker_blueprints
==================
An attempt at a common Blueprint library for use with `stacker <https://github.com/remind101/stacker>`_.
If you're new to stacker you may use `stacker_cookiecutter <https://github.com/remind101/stacker_cookiecutter>`_ to setup your project.
| {
"content_hash": "1f7d125a23ceab29a2bd82c39b5ee808",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 135,
"avg_line_length": 33.93333333333333,
"alnum_prop": 0.7288801571709234,
"repo_name": "remind101/stacker_blueprints",
"id": "b3e8b8041bbb90890ef6f27683e85e5674f6de60",
"size": "509",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.rst",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Makefile",
"bytes": "55"
},
{
"name": "Python",
"bytes": "258296"
},
{
"name": "Shell",
"bytes": "535"
}
],
"symlink_target": ""
} |
{% extends "layout.html" %}
{% block bodyClass %}{{ super() }} default-page{% endblock %}
{# Output the current content of the page, with buttons to edit it #}
{# Demonstrate how to test for an empty area #}
{% if (not edit) and aposAreaIsEmpty({ area: page.areas.main }) %}
<p>No one has entered content here yet.</p>
{% endif %}
{% block subnav %}
{% endblock %}
{% block breadcrumbs %}{% endblock %}
{% block marquee %}
<ol class="breadcrumbs ancestors clearfix">
{% for relative in page.ancestors %}
<li><a href="{{ relative.url }}">{{ relative.title | e }} » </a></li>
{% endfor %}
{# Templates for extended URLs of greedy pages (like blog post permalink pages #}
{# will want to make the greedy page itself a link and add more li's #}
{% block extraBreadcrumbs %}
<li>{{ page.title | e }}</li>
{% endblock %}
</ol>
<h1 class="page-title">{{ page.title | e }}</h1>
{% endblock %}
{% block main %}
{{ aposArea({ slug: slug + ':main', area: page.areas.main, edit: edit }) }}
{# Form refers to self via "" #}
<form class="apos-search-form" method="GET" action="">
Search For: <input name="q" value="{{ q | e }}" /> <input type="submit" />
</form>
{% if search %}
<h3>Search Results</h3>
<p>
<input type="checkbox" name="page" checked class="apos-search-filter" /> Pages
<input type="checkbox" name="mapLocation" checked class="apos-search-filter" /> Places
<input type="checkbox" name="event" checked class="apos-search-filter" /> Events
<input type="checkbox" name="blogPost" checked class="apos-search-filter" /> Articles
</p>
<ul>
{% for result in search %}
<li data-type="{{ result.type }}" class="apos-result apos-result-{{ result.type }}">
<h4>
<a href="/apos-pages/search-result?slug={{ result.slug }}">{{ result.title | e }}</a></h4>
<p>{{ result.searchSummary }}</p>
</li>
{% endfor %}
</ul>
{% else %}
<h4>No matches. Try a less specific search.</h4>
{% endif %}
{% endblock %}
{% block sidebar %}
<div class="subnav">
<h2>Subnavigation</h2>
<ol class="children">
{% for relative in page.children %}
<li><a href="{{ relative.url }}">{{ relative.title | e }}</a></li>
{% endfor %}
</ol>
</div>
{% endblock %}
| {
"content_hash": "db79ffaf1fd4d35685f606bc7569ca26",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 102,
"avg_line_length": 31.223684210526315,
"alnum_prop": 0.5747998314369995,
"repo_name": "MichaelMackus/apostrophe-test",
"id": "49a93488a82ce148215a48e7f39a5f139d49b37e",
"size": "2373",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "views/pages/search.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "10384"
},
{
"name": "Shell",
"bytes": "3594"
}
],
"symlink_target": ""
} |
<?xml version="1.0"?>
<phpunit xmlns="http://schema.phpunit.de/coverage/1.0">
<file name="ALL.php">
<totals>
<lines total="27" comments="16" code="11" executable="0" executed="0" percent=""/>
<methods count="0" tested="0" percent=""/>
<functions count="0" tested="0" percent=""/>
<classes count="1" tested="1" percent="100.00%"/>
<traits count="0" tested="0" percent=""/>
</totals>
<class name="ALL" start="21" executable="0" executed="0" crap="1">
<package full="Money" name="Money" sub="" category=""/>
<namespace name="SebastianBergmann\Money"/>
<method name="__construct" signature="__construct($amount)" start="23" end="26" crap="1" executable="0" executed="0" coverage="100"/>
</class>
</file>
</phpunit>
| {
"content_hash": "5ff530a8143ce096d54c3cba1d5638f8",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 139,
"avg_line_length": 45.8235294117647,
"alnum_prop": 0.6033376123234917,
"repo_name": "fey89/Money",
"id": "453d5211a58ee654b20179ad024c3d0e14b29b5a",
"size": "779",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "build/logs/coverage/currency/ALL.php.xml",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "14670"
},
{
"name": "HTML",
"bytes": "3524520"
},
{
"name": "JavaScript",
"bytes": "41952"
},
{
"name": "PHP",
"bytes": "225819"
},
{
"name": "Smarty",
"bytes": "743"
}
],
"symlink_target": ""
} |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.networkfunction.implementation;
import com.azure.core.annotation.ServiceClientBuilder;
import com.azure.core.http.HttpPipeline;
import com.azure.core.http.HttpPipelineBuilder;
import com.azure.core.http.policy.RetryPolicy;
import com.azure.core.http.policy.UserAgentPolicy;
import com.azure.core.management.AzureEnvironment;
import com.azure.core.management.serializer.SerializerFactory;
import com.azure.core.util.serializer.SerializerAdapter;
import java.time.Duration;
/** A builder for creating a new instance of the AzureTrafficCollectorManagementClientImpl type. */
@ServiceClientBuilder(serviceClients = {AzureTrafficCollectorManagementClientImpl.class})
public final class AzureTrafficCollectorManagementClientBuilder {
/*
* Azure Subscription ID.
*/
private String subscriptionId;
/**
* Sets Azure Subscription ID.
*
* @param subscriptionId the subscriptionId value.
* @return the AzureTrafficCollectorManagementClientBuilder.
*/
public AzureTrafficCollectorManagementClientBuilder subscriptionId(String subscriptionId) {
this.subscriptionId = subscriptionId;
return this;
}
/*
* server parameter
*/
private String endpoint;
/**
* Sets server parameter.
*
* @param endpoint the endpoint value.
* @return the AzureTrafficCollectorManagementClientBuilder.
*/
public AzureTrafficCollectorManagementClientBuilder endpoint(String endpoint) {
this.endpoint = endpoint;
return this;
}
/*
* The environment to connect to
*/
private AzureEnvironment environment;
/**
* Sets The environment to connect to.
*
* @param environment the environment value.
* @return the AzureTrafficCollectorManagementClientBuilder.
*/
public AzureTrafficCollectorManagementClientBuilder environment(AzureEnvironment environment) {
this.environment = environment;
return this;
}
/*
* The HTTP pipeline to send requests through
*/
private HttpPipeline pipeline;
/**
* Sets The HTTP pipeline to send requests through.
*
* @param pipeline the pipeline value.
* @return the AzureTrafficCollectorManagementClientBuilder.
*/
public AzureTrafficCollectorManagementClientBuilder pipeline(HttpPipeline pipeline) {
this.pipeline = pipeline;
return this;
}
/*
* The default poll interval for long-running operation
*/
private Duration defaultPollInterval;
/**
* Sets The default poll interval for long-running operation.
*
* @param defaultPollInterval the defaultPollInterval value.
* @return the AzureTrafficCollectorManagementClientBuilder.
*/
public AzureTrafficCollectorManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) {
this.defaultPollInterval = defaultPollInterval;
return this;
}
/*
* The serializer to serialize an object into a string
*/
private SerializerAdapter serializerAdapter;
/**
* Sets The serializer to serialize an object into a string.
*
* @param serializerAdapter the serializerAdapter value.
* @return the AzureTrafficCollectorManagementClientBuilder.
*/
public AzureTrafficCollectorManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) {
this.serializerAdapter = serializerAdapter;
return this;
}
/**
* Builds an instance of AzureTrafficCollectorManagementClientImpl with the provided parameters.
*
* @return an instance of AzureTrafficCollectorManagementClientImpl.
*/
public AzureTrafficCollectorManagementClientImpl buildClient() {
String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com";
AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE;
HttpPipeline localPipeline =
(pipeline != null)
? pipeline
: new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build();
Duration localDefaultPollInterval =
(defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30);
SerializerAdapter localSerializerAdapter =
(serializerAdapter != null)
? serializerAdapter
: SerializerFactory.createDefaultManagementSerializerAdapter();
AzureTrafficCollectorManagementClientImpl client =
new AzureTrafficCollectorManagementClientImpl(
localPipeline,
localSerializerAdapter,
localDefaultPollInterval,
localEnvironment,
subscriptionId,
localEndpoint);
return client;
}
}
| {
"content_hash": "c5c0698b5dbe8eb68060ebecc683464c",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 112,
"avg_line_length": 34.97222222222222,
"alnum_prop": 0.7031374106433678,
"repo_name": "Azure/azure-sdk-for-java",
"id": "15df1fa99ecd92fd69b5ca5d793e89affa64ac80",
"size": "5036",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "sdk/networkfunction/azure-resourcemanager-networkfunction/src/main/java/com/azure/resourcemanager/networkfunction/implementation/AzureTrafficCollectorManagementClientBuilder.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "8762"
},
{
"name": "Bicep",
"bytes": "15055"
},
{
"name": "CSS",
"bytes": "7676"
},
{
"name": "Dockerfile",
"bytes": "2028"
},
{
"name": "Groovy",
"bytes": "3237482"
},
{
"name": "HTML",
"bytes": "42090"
},
{
"name": "Java",
"bytes": "432409546"
},
{
"name": "JavaScript",
"bytes": "36557"
},
{
"name": "Jupyter Notebook",
"bytes": "95868"
},
{
"name": "PowerShell",
"bytes": "737517"
},
{
"name": "Python",
"bytes": "240542"
},
{
"name": "Scala",
"bytes": "1143898"
},
{
"name": "Shell",
"bytes": "18488"
},
{
"name": "XSLT",
"bytes": "755"
}
],
"symlink_target": ""
} |
package it.crs4.pydoop.mapreduce.pipes;
import java.util.Properties;
import java.util.List;
import java.util.Arrays;
import java.io.IOException;
import org.apache.hadoop.mapreduce.RecordReader;
import org.apache.hadoop.mapreduce.InputSplit;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.conf.Configuration;
import org.apache.avro.generic.IndexedRecord;
public class PydoopAvroBridgeKeyReader
extends PydoopAvroBridgeReaderBase<Text, NullWritable> {
private Properties props;
public PydoopAvroBridgeKeyReader(
RecordReader<? extends IndexedRecord, ?> actualReader) {
this.actualReader = actualReader;
props = Submitter.getPydoopProperties();
}
protected List<IndexedRecord> getInRecords()
throws IOException, InterruptedException {
IndexedRecord key = (IndexedRecord) actualReader.getCurrentKey();
return Arrays.asList(key);
}
public void initialize(InputSplit split, TaskAttemptContext context)
throws IOException, InterruptedException {
super.initialize(split, context);
assert schemas.size() == 1;
Configuration conf = context.getConfiguration();
conf.set(props.getProperty("AVRO_INPUT"), Submitter.AvroIO.K.name());
conf.set(props.getProperty("AVRO_KEY_INPUT_SCHEMA"),
schemas.get(0).toString());
}
@Override
public Text getCurrentKey()
throws IOException, InterruptedException {
assert outRecords.size() == 1;
return outRecords.get(0);
}
@Override
public NullWritable getCurrentValue()
throws IOException, InterruptedException {
return NullWritable.get();
}
}
| {
"content_hash": "11507978241779e8d6dc288694f842ae",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 73,
"avg_line_length": 29.344827586206897,
"alnum_prop": 0.7532314923619271,
"repo_name": "elzaggo/pydoop",
"id": "ff1167a996008846e5ff9ad61c29fd4e1ddc5407",
"size": "2330",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "src/it/crs4/pydoop/mapreduce/pipes/PydoopAvroBridgeKeyReader.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "202110"
},
{
"name": "C++",
"bytes": "157645"
},
{
"name": "Emacs Lisp",
"bytes": "153"
},
{
"name": "Java",
"bytes": "180329"
},
{
"name": "Makefile",
"bytes": "3322"
},
{
"name": "Python",
"bytes": "514013"
},
{
"name": "Shell",
"bytes": "18476"
}
],
"symlink_target": ""
} |
////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2016 by EMC Corporation, 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.
///
/// Copyright holder is EMC Corporation
///
/// @author Andrey Abramov
/// @author Vasiliy Nabatchikov
////////////////////////////////////////////////////////////////////////////////
#include "composite_reader_impl.hpp"
#include "utils/directory_utils.hpp"
#include "utils/singleton.hpp"
#include "utils/string_utils.hpp"
#include "utils/type_limits.hpp"
#include "directory_reader.hpp"
#include "segment_reader.hpp"
NS_LOCAL
MSVC_ONLY(__pragma(warning(push)))
MSVC_ONLY(__pragma(warning(disable:4457))) // variable hides function param
irs::index_file_refs::ref_t load_newest_index_meta(
irs::index_meta& meta,
const irs::directory& dir,
const irs::format* codec
) NOEXCEPT {
// if a specific codec was specified
if (codec) {
try {
auto reader = codec->get_index_meta_reader();
if (!reader) {
return nullptr;
}
irs::index_file_refs::ref_t ref;
std::string filename;
// ensure have a valid ref to a filename
while (!ref) {
const bool index_exists = reader->last_segments_file(dir, filename);
if (!index_exists) {
return nullptr;
}
ref = irs::directory_utils::reference(
const_cast<irs::directory&>(dir), filename
);
}
if (ref) {
reader->read(dir, meta, *ref);
}
return ref;
} catch (...) {
IR_LOG_EXCEPTION();
return nullptr;
}
}
std::unordered_set<irs::string_ref> codecs;
auto visitor = [&codecs](const irs::string_ref& name)->bool {
codecs.insert(name);
return true;
};
if (!irs::formats::visit(visitor)) {
return nullptr;
}
struct {
std::time_t mtime;
irs::index_meta_reader::ptr reader;
irs::index_file_refs::ref_t ref;
} newest;
newest.mtime = (irs::integer_traits<time_t>::min)();
try {
for (auto& name: codecs) {
auto codec = irs::formats::get(name);
if (!codec) {
continue; // try the next codec
}
auto reader = codec->get_index_meta_reader();
if (!reader) {
continue; // try the next codec
}
irs::index_file_refs::ref_t ref;
std::string filename;
// ensure have a valid ref to a filename
while (!ref) {
const bool index_exists = reader->last_segments_file(dir, filename);
if (!index_exists) {
break; // try the next codec
}
ref = irs::directory_utils::reference(
const_cast<irs::directory&>(dir), filename
);
}
// initialize to a value that will never pass 'if' below (to make valgrind happy)
std::time_t mtime = std::numeric_limits<std::time_t>::min();
if (ref && dir.mtime(mtime, *ref) && mtime > newest.mtime) {
newest.mtime = std::move(mtime);
newest.reader = std::move(reader);
newest.ref = std::move(ref);
}
}
if (!newest.reader || !newest.ref) {
return nullptr;
}
newest.reader->read(dir, meta, *(newest.ref));
return newest.ref;
} catch (...) {
IR_LOG_EXCEPTION();
}
return nullptr;
}
MSVC_ONLY(__pragma(warning(pop)))
NS_END
NS_ROOT
// -------------------------------------------------------------------
// directory_reader
// -------------------------------------------------------------------
class directory_reader_impl :
public composite_reader<segment_reader> {
public:
DECLARE_SHARED_PTR(directory_reader_impl); // required for NAMED_PTR(...)
const directory& dir() const NOEXCEPT {
return dir_;
}
const directory_meta& meta() const NOEXCEPT { return meta_; }
// open a new directory reader
// if codec == nullptr then use the latest file for all known codecs
// if cached != nullptr then try to reuse its segments
static index_reader::ptr open(
const directory& dir,
const format* codec = nullptr,
const index_reader::ptr& cached = nullptr
);
private:
typedef std::unordered_set<index_file_refs::ref_t> segment_file_refs_t;
typedef std::vector<segment_file_refs_t> reader_file_refs_t;
directory_reader_impl(
const directory& dir,
reader_file_refs_t&& file_refs,
directory_meta&& meta,
readers_t&& readers,
uint64_t docs_count,
uint64_t docs_max
);
const directory& dir_;
reader_file_refs_t file_refs_;
directory_meta meta_;
}; // directory_reader_impl
directory_reader::directory_reader(impl_ptr&& impl) NOEXCEPT
: impl_(std::move(impl)) {
}
directory_reader::directory_reader(const directory_reader& other) NOEXCEPT {
*this = other;
}
directory_reader& directory_reader::operator=(
const directory_reader& other) NOEXCEPT {
if (this != &other) {
// make a copy
impl_ptr impl = atomic_utils::atomic_load(&other.impl_);
atomic_utils::atomic_store(&impl_, impl);
}
return *this;
}
const directory_meta& directory_reader::meta() const {
auto impl = atomic_utils::atomic_load(&impl_); // make a copy
#ifdef IRESEARCH_DEBUG
auto& reader_impl = dynamic_cast<const directory_reader_impl&>(*impl);
#else
auto& reader_impl = static_cast<const directory_reader_impl&>(*impl);
#endif
return reader_impl.meta();
}
/*static*/ directory_reader directory_reader::open(
const directory& dir,
format::ptr codec /*= nullptr*/) {
return directory_reader_impl::open(dir, codec.get());
}
directory_reader directory_reader::reopen(
format::ptr codec /*= nullptr*/) const {
// make a copy
impl_ptr impl = atomic_utils::atomic_load(&impl_);
#ifdef IRESEARCH_DEBUG
auto& reader_impl = dynamic_cast<const directory_reader_impl&>(*impl);
#else
auto& reader_impl = static_cast<const directory_reader_impl&>(*impl);
#endif
return directory_reader_impl::open(
reader_impl.dir(), codec.get(), impl
);
}
// -------------------------------------------------------------------
// directory_reader_impl
// -------------------------------------------------------------------
directory_reader_impl::directory_reader_impl(
const directory& dir,
reader_file_refs_t&& file_refs,
directory_meta&& meta,
readers_t&& readers,
uint64_t docs_count,
uint64_t docs_max)
: composite_reader(std::move(readers), docs_count, docs_max),
dir_(dir),
file_refs_(std::move(file_refs)),
meta_(std::move(meta)) {
}
/*static*/ index_reader::ptr directory_reader_impl::open(
const directory& dir,
const format* codec /*= nullptr*/,
const index_reader::ptr& cached /*= nullptr*/) {
index_meta meta;
index_file_refs::ref_t meta_file_ref = load_newest_index_meta(meta, dir, codec);
if (!meta_file_ref) {
throw index_not_found();
}
#ifdef IRESEARCH_DEBUG
auto* cached_impl = dynamic_cast<const directory_reader_impl*>(cached.get());
assert(!cached || cached_impl);
#else
auto* cached_impl = static_cast<const directory_reader_impl*>(cached.get());
#endif
if (cached_impl && cached_impl->meta_.meta == meta) {
return cached; // no changes to refresh
}
const auto INVALID_CANDIDATE = integer_traits<size_t>::const_max;
std::unordered_map<string_ref, size_t> reuse_candidates; // map by segment name to old segment id
for(size_t i = 0, count = cached_impl ? cached_impl->meta_.meta.size() : 0; i < count; ++i) {
assert(cached_impl); // ensured by loop condition above
auto itr = reuse_candidates.emplace(
cached_impl->meta_.meta.segment(i).meta.name, i
);
if (!itr.second) {
itr.first->second = INVALID_CANDIDATE; // treat collisions as invalid
}
}
readers_t readers(meta.size());
uint64_t docs_max = 0; // overall number of documents (with deleted)
uint64_t docs_count = 0; // number of live documents
reader_file_refs_t file_refs(readers.size() + 1); // +1 for index_meta file refs
segment_file_refs_t tmp_file_refs;
auto visitor = [&tmp_file_refs](index_file_refs::ref_t&& ref)->bool {
tmp_file_refs.emplace(std::move(ref));
return true;
};
for (size_t i = 0, size = meta.size(); i < size; ++i) {
auto& reader = readers[i];
auto& segment = meta.segment(i).meta;
auto& segment_file_refs = file_refs[i];
auto itr = reuse_candidates.find(segment.name);
if (itr != reuse_candidates.end()
&& itr->second != INVALID_CANDIDATE
&& segment == cached_impl->meta_.meta.segment(itr->second).meta) {
reader = (*cached_impl)[itr->second].reopen(segment);
reuse_candidates.erase(itr);
} else {
reader = segment_reader::open(dir, segment);
}
if (!reader) {
throw index_error(string_utils::to_string(
"while opening reader for segment '%s', error: failed to open reader",
segment.name.c_str()
));
}
docs_max += reader.docs_count();
docs_count += reader.live_docs_count();
directory_utils::reference(const_cast<directory&>(dir), segment, visitor, true);
segment_file_refs.swap(tmp_file_refs);
}
directory_utils::reference(const_cast<directory&>(dir), meta, visitor, true);
tmp_file_refs.emplace(meta_file_ref);
file_refs.back().swap(tmp_file_refs); // use last position for storing index_meta refs
directory_meta dir_meta;
dir_meta.filename = *meta_file_ref;
dir_meta.meta = std::move(meta);
PTR_NAMED(
directory_reader_impl,
reader,
dir,
std::move(file_refs),
std::move(dir_meta),
std::move(readers),
docs_count,
docs_max
);
return reader;
}
NS_END
// -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE
// -----------------------------------------------------------------------------
| {
"content_hash": "43817fa049e9221d483585e757011675",
"timestamp": "",
"source": "github",
"line_count": 370,
"max_line_length": 99,
"avg_line_length": 27.972972972972972,
"alnum_prop": 0.5997101449275363,
"repo_name": "fceller/arangodb",
"id": "d06198b2629f12a7d85990097a8534ea9350b232",
"size": "10350",
"binary": false,
"copies": "1",
"ref": "refs/heads/devel",
"path": "3rdParty/iresearch/core/index/directory_reader.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Ada",
"bytes": "89080"
},
{
"name": "AppleScript",
"bytes": "1429"
},
{
"name": "Assembly",
"bytes": "142084"
},
{
"name": "Batchfile",
"bytes": "9073"
},
{
"name": "C",
"bytes": "1938354"
},
{
"name": "C#",
"bytes": "55625"
},
{
"name": "C++",
"bytes": "79379178"
},
{
"name": "CLIPS",
"bytes": "5291"
},
{
"name": "CMake",
"bytes": "109718"
},
{
"name": "CSS",
"bytes": "1341035"
},
{
"name": "CoffeeScript",
"bytes": "94"
},
{
"name": "DIGITAL Command Language",
"bytes": "27303"
},
{
"name": "Emacs Lisp",
"bytes": "15477"
},
{
"name": "Go",
"bytes": "1018005"
},
{
"name": "Groff",
"bytes": "263567"
},
{
"name": "HTML",
"bytes": "459886"
},
{
"name": "JavaScript",
"bytes": "55446690"
},
{
"name": "LLVM",
"bytes": "39361"
},
{
"name": "Lua",
"bytes": "16189"
},
{
"name": "Makefile",
"bytes": "178253"
},
{
"name": "Module Management System",
"bytes": "1545"
},
{
"name": "NSIS",
"bytes": "26909"
},
{
"name": "Objective-C",
"bytes": "4430"
},
{
"name": "Objective-C++",
"bytes": "1857"
},
{
"name": "Pascal",
"bytes": "145262"
},
{
"name": "Perl",
"bytes": "227308"
},
{
"name": "Protocol Buffer",
"bytes": "5837"
},
{
"name": "Python",
"bytes": "3563935"
},
{
"name": "Ruby",
"bytes": "1000962"
},
{
"name": "SAS",
"bytes": "1847"
},
{
"name": "Scheme",
"bytes": "19885"
},
{
"name": "Shell",
"bytes": "488846"
},
{
"name": "VimL",
"bytes": "4075"
},
{
"name": "Yacc",
"bytes": "36950"
}
],
"symlink_target": ""
} |
var config = {
s3 : {
key: process.env.S3_KEY || argv.k,
secret: process.env.S3_SECRET || argv.s,
bucket: process.env.S3_BUCKET || argv.b
},
watchDirectory : process.env.WATCH_DIRECTORY || argv.d,
serverPing : {
host: process.env.PING_HOST || argv.h,
port: process.env.PING_PORT || argv.p
}
};
// #Modules
var chokidar = require('chokidar');
var nStore = require('nstore');
var knox = require('knox');
var path = require('path');
var argv = require('optimist').argv;
var http = require('http');
var gm = require('gm');
var fs = require('fs');
// #S3
var s3client = knox.createClient(config.s3);
// #Folder watching
// /^(?:(?!.*\.jpg).)*$/m
var watcher = chokidar.watch(process.env.WATCH_DIRECTORY || argv.d, { ignored: /^\./, persistent: true });
function startWatching () {
watcher.on('add', function (filepath, stat) {
var filename = path.basename(filepath);
// see if it is a png
if (path.extname(filename) === ".png") {
pngToJpeg(filepath);
return;
}
setTimeout(function () {
if (!hasValidFilename(filename)) { console.log("filename not valid for ", filename); return; }
ifNotSavedAlready(filename, function () {
console.log("Need to save:", filename);
saveFile(filename, function(err) {
if (err) {
console.log(err);
return;
}
// save to nstore
console.log("Saving to nstore key", filename);
uploadsStore.save('feeltv/'+filename, {}, function (err) {
if (err) {
console.log("failed to save to nstore", filename, err);
return;
}
pingServerOfNewImage(filename);
});
});
});
}, 1000);
});
}
// #Connect to the sudo db
// ##Create a store
var uploadsStore = nStore.new('uploads.db', startWatching);
// #Utils
function hasValidFilename(filename) {
return filename.match(/\.(?:bmp|gif|jpe?g|png)$/m) !== null;
}
function pngToJpeg(filepath) {
var dir = path.dirname(filepath);
var ext = path.extname(filepath);
var name = path.basename(filepath, ext);
fs.exists(dir + '/' + name + '.jpg', function (exists) {
if (exists) { return; }
setTimeout(function () {
gm(filepath).write(dir + '/' + name + '.jpg', function(err) {
if (err) {
return console.dir("Error converting file", arguments);
}
console.log(this.outname + " created :: " + arguments[3]);
});
}, 1000);
});
}
function parseFilename(filename) {
return {
filename : "filename",
twitterId : 10001,
timestamp : 10002
};
}
function ifNotSavedAlready(filename, callback) {
uploadsStore.get(filename, function (err, doc, key) {
if (err) { callback(); }
});
}
function saveFile(filename, callback) {
s3client.putFile(path.join(config.watchDirectory, filename), 'feeltv/'+filename, { 'x-amz-acl': 'public-read', 'x-amz-storage-class': 'REDUCED_REDUNDANCY' }, function (err, res) {
if (err) { callback(err); return; }
if (res.statusCode != 200) { callback(res); return; }
console.log(" saved file ", 'feeltv/'+filename);
callback(null);
});
}
function pingServerOfNewImage(filename) {
var tweetId = path.basename(filename, '.jpg');
var requestOptions = {};
requestOptions.host = config.serverPing.host;
requestOptions.port = config.serverPing.port;
requestOptions.path = "/api/imageuploaded/" + tweetId + "/";
http
.get(requestOptions, function(res) {})
.on("error", function(e){
console.log("pingServerOfNewImage : Got error: " + e.message);
});
}
// #Command line
// ##List all files stored
if (argv.l) {
s3client.list({ }, function(err, data) {
if (err) {
console.log("list error", err);
}
console.log(data);
});
}
// ##Delete files
if (argv.d) {
s3client.del(argv.d).on('response', function(res){
console.log("delete status", res.statusCode);
console.log("delete headers", res.headers);
}).end();
} | {
"content_hash": "644d04ee9ce3f1d8f150beef8943db40",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 183,
"avg_line_length": 28.503184713375795,
"alnum_prop": 0.5394413407821229,
"repo_name": "HellicarAndLewis/ProjectVictoryWebSystem",
"id": "24ea4655eb453601d7ea993eb488aafecb4e75dd",
"size": "4475",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app.imageuploader.js",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "17969"
},
{
"name": "JavaScript",
"bytes": "195252"
}
],
"symlink_target": ""
} |
/*!
* Angular Material Design
* https://github.com/angular/material
* @license MIT
* v0.11.1-rc1
*/
(function( window, angular, undefined ){
"use strict";
/**
* @ngdoc module
* @name material.components.sticky
* @description
* Sticky effects for md
*
*/
angular
.module('material.components.sticky', [
'material.core',
'material.components.content'
])
.factory('$mdSticky', MdSticky);
/**
* @ngdoc service
* @name $mdSticky
* @module material.components.sticky
*
* @description
* The `$mdSticky`service provides a mixin to make elements sticky.
*
* @returns A `$mdSticky` function that takes three arguments:
* - `scope`
* - `element`: The element that will be 'sticky'
* - `elementClone`: A clone of the element, that will be shown
* when the user starts scrolling past the original element.
* If not provided, it will use the result of `element.clone()`.
*/
function MdSticky($document, $mdConstant, $$rAF, $mdUtil) {
var browserStickySupport = checkStickySupport();
/**
* Registers an element as sticky, used internally by directives to register themselves
*/
return function registerStickyElement(scope, element, stickyClone) {
var contentCtrl = element.controller('mdContent');
if (!contentCtrl) return;
if (browserStickySupport) {
element.css({
position: browserStickySupport,
top: 0,
'z-index': 2
});
} else {
var $$sticky = contentCtrl.$element.data('$$sticky');
if (!$$sticky) {
$$sticky = setupSticky(contentCtrl);
contentCtrl.$element.data('$$sticky', $$sticky);
}
var deregister = $$sticky.add(element, stickyClone || element.clone());
scope.$on('$destroy', deregister);
}
};
function setupSticky(contentCtrl) {
var contentEl = contentCtrl.$element;
// Refresh elements is very expensive, so we use the debounced
// version when possible.
var debouncedRefreshElements = $$rAF.throttle(refreshElements);
// setupAugmentedScrollEvents gives us `$scrollstart` and `$scroll`,
// more reliable than `scroll` on android.
setupAugmentedScrollEvents(contentEl);
contentEl.on('$scrollstart', debouncedRefreshElements);
contentEl.on('$scroll', onScroll);
var self;
return self = {
prev: null,
current: null, //the currently stickied item
next: null,
items: [],
add: add,
refreshElements: refreshElements
};
/***************
* Public
***************/
// Add an element and its sticky clone to this content's sticky collection
function add(element, stickyClone) {
stickyClone.addClass('md-sticky-clone');
var item = {
element: element,
clone: stickyClone
};
self.items.push(item);
$mdUtil.nextTick(function() {
contentEl.prepend(item.clone);
});
debouncedRefreshElements();
return function remove() {
self.items.forEach(function(item, index) {
if (item.element[0] === element[0]) {
self.items.splice(index, 1);
item.clone.remove();
}
});
debouncedRefreshElements();
};
}
function refreshElements() {
// Sort our collection of elements by their current position in the DOM.
// We need to do this because our elements' order of being added may not
// be the same as their order of display.
self.items.forEach(refreshPosition);
self.items = self.items.sort(function(a, b) {
return a.top < b.top ? -1 : 1;
});
// Find which item in the list should be active,
// based upon the content's current scroll position
var item;
var currentScrollTop = contentEl.prop('scrollTop');
for (var i = self.items.length - 1; i >= 0; i--) {
if (currentScrollTop > self.items[i].top) {
item = self.items[i];
break;
}
}
setCurrentItem(item);
}
/***************
* Private
***************/
// Find the `top` of an item relative to the content element,
// and also the height.
function refreshPosition(item) {
// Find the top of an item by adding to the offsetHeight until we reach the
// content element.
var current = item.element[0];
item.top = 0;
item.left = 0;
while (current && current !== contentEl[0]) {
item.top += current.offsetTop;
item.left += current.offsetLeft;
current = current.offsetParent;
}
item.height = item.element.prop('offsetHeight');
item.clone.css('margin-left', item.left + 'px');
if ($mdUtil.floatingScrollbars()) {
item.clone.css('margin-right', '0');
}
}
// As we scroll, push in and select the correct sticky element.
function onScroll() {
var scrollTop = contentEl.prop('scrollTop');
var isScrollingDown = scrollTop > (onScroll.prevScrollTop || 0);
// Store the previous scroll so we know which direction we are scrolling
onScroll.prevScrollTop = scrollTop;
//
// AT TOP (not scrolling)
//
if (scrollTop === 0) {
// If we're at the top, just clear the current item and return
setCurrentItem(null);
return;
}
//
// SCROLLING DOWN (going towards the next item)
//
if (isScrollingDown) {
// If we've scrolled down past the next item's position, sticky it and return
if (self.next && self.next.top <= scrollTop) {
setCurrentItem(self.next);
return;
}
// If the next item is close to the current one, push the current one up out of the way
if (self.current && self.next && self.next.top - scrollTop <= self.next.height) {
translate(self.current, scrollTop + (self.next.top - self.next.height - scrollTop));
return;
}
}
//
// SCROLLING UP (not at the top & not scrolling down; must be scrolling up)
//
if (!isScrollingDown) {
// If we've scrolled up past the previous item's position, sticky it and return
if (self.current && self.prev && scrollTop < self.current.top) {
setCurrentItem(self.prev);
return;
}
// If the next item is close to the current one, pull the current one down into view
if (self.next && self.current && (scrollTop >= (self.next.top - self.current.height))) {
translate(self.current, scrollTop + (self.next.top - scrollTop - self.current.height));
return;
}
}
//
// Otherwise, just move the current item to the proper place (scrolling up or down)
//
if (self.current) {
translate(self.current, scrollTop);
}
}
function setCurrentItem(item) {
if (self.current === item) return;
// Deactivate currently active item
if (self.current) {
translate(self.current, null);
setStickyState(self.current, null);
}
// Activate new item if given
if (item) {
setStickyState(item, 'active');
}
self.current = item;
var index = self.items.indexOf(item);
// If index === -1, index + 1 = 0. It works out.
self.next = self.items[index + 1];
self.prev = self.items[index - 1];
setStickyState(self.next, 'next');
setStickyState(self.prev, 'prev');
}
function setStickyState(item, state) {
if (!item || item.state === state) return;
if (item.state) {
item.clone.attr('sticky-prev-state', item.state);
item.element.attr('sticky-prev-state', item.state);
}
item.clone.attr('sticky-state', state);
item.element.attr('sticky-state', state);
item.state = state;
}
function translate(item, amount) {
if (!item) return;
if (amount === null || amount === undefined) {
if (item.translateY) {
item.translateY = null;
item.clone.css($mdConstant.CSS.TRANSFORM, '');
}
} else {
item.translateY = amount;
item.clone.css(
$mdConstant.CSS.TRANSFORM,
'translate3d(' + item.left + 'px,' + amount + 'px,0)'
);
}
}
}
// Function to check for browser sticky support
function checkStickySupport($el) {
var stickyProp;
var testEl = angular.element('<div>');
$document[0].body.appendChild(testEl[0]);
var stickyProps = ['sticky', '-webkit-sticky'];
for (var i = 0; i < stickyProps.length; ++i) {
testEl.css({position: stickyProps[i], top: 0, 'z-index': 2});
if (testEl.css('position') == stickyProps[i]) {
stickyProp = stickyProps[i];
break;
}
}
testEl.remove();
return stickyProp;
}
// Android 4.4 don't accurately give scroll events.
// To fix this problem, we setup a fake scroll event. We say:
// > If a scroll or touchmove event has happened in the last DELAY milliseconds,
// then send a `$scroll` event every animationFrame.
// Additionally, we add $scrollstart and $scrollend events.
function setupAugmentedScrollEvents(element) {
var SCROLL_END_DELAY = 200;
var isScrolling;
var lastScrollTime;
element.on('scroll touchmove', function() {
if (!isScrolling) {
isScrolling = true;
$$rAF.throttle(loopScrollEvent);
element.triggerHandler('$scrollstart');
}
element.triggerHandler('$scroll');
lastScrollTime = +$mdUtil.now();
});
function loopScrollEvent() {
if (+$mdUtil.now() - lastScrollTime > SCROLL_END_DELAY) {
isScrolling = false;
element.triggerHandler('$scrollend');
} else {
element.triggerHandler('$scroll');
$$rAF.throttle(loopScrollEvent);
}
}
}
}
MdSticky.$inject = ["$document", "$mdConstant", "$$rAF", "$mdUtil"];
})(window, window.angular); | {
"content_hash": "bb8f68b71a699bf38f343eb4176c146b",
"timestamp": "",
"source": "github",
"line_count": 329,
"max_line_length": 97,
"avg_line_length": 30.19148936170213,
"alnum_prop": 0.5976039464411558,
"repo_name": "brian-lewis/bower-material",
"id": "323fa88bdc521ad34f8bc0dbfccf060ef2125010",
"size": "9933",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "modules/js/sticky/sticky.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1192267"
},
{
"name": "JavaScript",
"bytes": "1558363"
}
],
"symlink_target": ""
} |
import json
import os
import logging
from completor import Completor, vim
from completor.compat import to_unicode
from completor.utils import echo
DIRNAME = os.path.dirname(__file__)
logger = logging.getLogger('completor')
class Jedi(Completor):
filetype = 'python'
trigger = (r'\w{3,}$|'
r'[\w\)\]\}\'\"]+\.\w*$|'
r'^\s*from\s+[\w\.]*(?:\s+import\s+(?:\w*(?:,\s*)?)*)?|'
r'^\s*import\s+(?:[\w\.]*(?:,\s*)?)*')
def __init__(self, *args, **kwargs):
Completor.__init__(self, *args, **kwargs)
self.use_black = bool(self.get_option('black_binary'))
def _jedi_cmd(self, action):
binary = self.get_option('python_binary') or 'python'
cmd = [binary, os.path.join(DIRNAME, 'python_jedi.py')]
return vim.Dictionary(
cmd=cmd,
ftype=self.filetype,
is_daemon=True,
is_sync=False,
)
def _yapf_cmd(self):
if vim.current.buffer.options['modified']:
echo('Save file to format.', severity='warn')
return vim.Dictionary()
binary = self.get_option('yapf_binary') or 'yapf'
line_range = self.meta.get('range')
if not line_range:
return vim.Dictionary()
cmd = [binary, '--in-place']
start, end = line_range
if start != end:
cmd.extend(['--lines', '{}-{}'.format(start, end)])
cmd.append(self.filename)
return vim.Dictionary(
cmd=cmd,
ftype=self.filetype,
is_daemon=False,
is_sync=False,
)
def _black_cmd(self):
binary = self.get_option('black_binary')
if not binary:
return vim.Dictionary()
cmd = [binary, '--line-length', 79, '--quiet']
cmd.append(self.filename)
return vim.Dictionary(
cmd=cmd,
ftype=self.filetype,
is_daemon=False,
is_sync=False,
)
def get_cmd_info(self, action):
if action == b'format':
if self.use_black:
return self._black_cmd()
return self._yapf_cmd()
return self._jedi_cmd(action)
def _is_comment(self):
data = self.input_data.strip()
if data.startswith('#'):
return True
def prepare_request(self, action):
if action == b'complete' and self._is_comment():
return ''
line, _ = self.cursor
col = len(self.input_data)
return json.dumps({
'action': action.decode('ascii'),
'line': line - 1,
'col': col,
'filename': self.filename,
'content': '\n'.join(vim.current.buffer[:])
})
def on_definition(self, data):
return json.loads(to_unicode(data[0], 'utf-8'))
on_signature = on_definition
on_doc = on_definition
def on_complete(self, data):
try:
data = to_unicode(data[0], 'utf-8') \
.replace('\\u', '\\\\\\u') \
.replace('\\U', '\\\\\\U')
return [
i for i in json.loads(data)
if not self.input_data.endswith(i['word'])
]
except Exception as e:
logger.exception(e)
return []
| {
"content_hash": "7b8c09f6236b947ca6b32ee59ae8d600",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 71,
"avg_line_length": 30.321100917431192,
"alnum_prop": 0.5055975794251135,
"repo_name": "maralla/completor.vim",
"id": "a389f434b39a3a50d370c29932013073e2b47be1",
"size": "3330",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pythonx/completers/python/__init__.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "6019"
},
{
"name": "Makefile",
"bytes": "183"
},
{
"name": "Python",
"bytes": "98149"
},
{
"name": "Vim script",
"bytes": "27874"
}
],
"symlink_target": ""
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>Aufgabe XVI: Temperatursensor DS1621: Datei-Elemente</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="Testaufbau.png"/></td>
<td style="padding-left: 0.5em;">
<div id="projectname">Aufgabe XVI: Temperatursensor DS1621
 <span id="projectnumber">2.0</span>
</div>
<div id="projectbrief">M. Auer, N. Lingg, K. Maier</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Erzeugt von Doxygen 1.8.9.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Suchen');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Hauptseite</span></a></li>
<li><a href="pages.html"><span>Zusätzliche Informationen</span></a></li>
<li><a href="modules.html"><span>Module</span></a></li>
<li><a href="annotated.html"><span>Datenstrukturen</span></a></li>
<li class="current"><a href="files.html"><span>Dateien</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Suchen" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>Auflistung der Dateien</span></a></li>
<li class="current"><a href="globals.html"><span>Datei-Elemente</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li><a href="globals.html"><span>Alle</span></a></li>
<li><a href="globals_func.html"><span>Funktionen</span></a></li>
<li><a href="globals_vars.html"><span>Variablen</span></a></li>
<li><a href="globals_type.html"><span>Typdefinitionen</span></a></li>
<li><a href="globals_enum.html"><span>Aufzählungen</span></a></li>
<li><a href="globals_eval.html"><span>Aufzählungswerte</span></a></li>
<li class="current"><a href="globals_defs.html"><span>Makrodefinitionen</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="globals_defs.html#index__"><span>_</span></a></li>
<li><a href="globals_defs_a.html#index_a"><span>a</span></a></li>
<li><a href="globals_defs_c.html#index_c"><span>c</span></a></li>
<li><a href="globals_defs_d.html#index_d"><span>d</span></a></li>
<li><a href="globals_defs_e.html#index_e"><span>e</span></a></li>
<li><a href="globals_defs_f.html#index_f"><span>f</span></a></li>
<li><a href="globals_defs_i.html#index_i"><span>i</span></a></li>
<li><a href="globals_defs_l.html#index_l"><span>l</span></a></li>
<li><a href="globals_defs_m.html#index_m"><span>m</span></a></li>
<li><a href="globals_defs_n.html#index_n"><span>n</span></a></li>
<li><a href="globals_defs_o.html#index_o"><span>o</span></a></li>
<li><a href="globals_defs_p.html#index_p"><span>p</span></a></li>
<li><a href="globals_defs_r.html#index_r"><span>r</span></a></li>
<li><a href="globals_defs_s.html#index_s"><span>s</span></a></li>
<li><a href="globals_defs_t.html#index_t"><span>t</span></a></li>
<li><a href="globals_defs_u.html#index_u"><span>u</span></a></li>
<li><a href="globals_defs_w.html#index_w"><span>w</span></a></li>
<li class="current"><a href="globals_defs_x.html#index_x"><span>x</span></a></li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('globals_defs_x.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="contents">
 
<h3><a class="anchor" id="index_x"></a>- x -</h3><ul>
<li>XTAL
: <a class="el" href="group___l_p_c17xx___system___defines.html#ga3cad0f9b3c40159bd2fbd7f5e60f2fff">system_LPC17xx.c</a>
</li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Erzeugt am Don Jun 11 2015 18:43:39 für Aufgabe XVI: Temperatursensor DS1621 von
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.9.1 </li>
</ul>
</div>
</body>
</html>
| {
"content_hash": "7b1725438ad1e6f7fa35321d2c80e76c",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 154,
"avg_line_length": 43.590062111801245,
"alnum_prop": 0.6262467939583927,
"repo_name": "NicoLingg/TemperatureSensor_DS1621",
"id": "64788799258ea019e0f02df3e1f81f1bfc9dc3bd",
"size": "7022",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "html/globals_defs_x.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "434480"
},
{
"name": "C++",
"bytes": "15212"
},
{
"name": "CSS",
"bytes": "33151"
},
{
"name": "HTML",
"bytes": "6391059"
},
{
"name": "JavaScript",
"bytes": "838903"
}
],
"symlink_target": ""
} |
using System.Collections.Generic;
using Azure.Core;
namespace Azure.ResourceManager.IotHub.Models
{
/// <summary> The JSON-serialized array of EndpointHealthData objects with a next link. </summary>
internal partial class IotHubEndpointHealthInfoListResult
{
/// <summary> Initializes a new instance of IotHubEndpointHealthInfoListResult. </summary>
internal IotHubEndpointHealthInfoListResult()
{
Value = new ChangeTrackingList<IotHubEndpointHealthInfo>();
}
/// <summary> Initializes a new instance of IotHubEndpointHealthInfoListResult. </summary>
/// <param name="value"> JSON-serialized array of Endpoint health data. </param>
/// <param name="nextLink"> Link to more results. </param>
internal IotHubEndpointHealthInfoListResult(IReadOnlyList<IotHubEndpointHealthInfo> value, string nextLink)
{
Value = value;
NextLink = nextLink;
}
/// <summary> JSON-serialized array of Endpoint health data. </summary>
public IReadOnlyList<IotHubEndpointHealthInfo> Value { get; }
/// <summary> Link to more results. </summary>
public string NextLink { get; }
}
}
| {
"content_hash": "bc6094c1b8f5b78e5ca51833915b1ae2",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 115,
"avg_line_length": 42.172413793103445,
"alnum_prop": 0.6794766966475879,
"repo_name": "Azure/azure-sdk-for-net",
"id": "5b8e970505fcdc6781b2584ac79c9c43d368de00",
"size": "1361",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/Models/IotHubEndpointHealthInfoListResult.cs",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
Example Module Documentation
----------------------------
.. include:: replace.txt
.. highlight:: cpp
.. heading hierarchy:
------------- Chapter
************* Section (#.#)
============= Subsection (#.#.#)
############# Paragraph (no number)
This is a suggested outline for adding new module documentation to |ns3|.
See ``src/click/doc/click.rst`` for an example.
The introductory paragraph is for describing what this code is trying to
model.
For consistency (italicized formatting), please use |ns3| to refer to
ns-3 in the documentation (and likewise, |ns2| for ns-2). These macros
are defined in the file ``replace.txt``.
Model Description
*****************
The source code for the new module lives in the directory ``src/p4``.
Add here a basic description of what is being modeled.
Design
======
Briefly describe the software design of the model and how it fits into
the existing ns-3 architecture.
Scope and Limitations
=====================
What can the model do? What can it not do? Please use this section to
describe the scope and limitations of the model.
References
==========
Add academic citations here, such as if you published a paper on this
model, or if readers should read a particular specification or other work.
Usage
*****
This section is principally concerned with the usage of your model, using
the public API. Focus first on most common usage patterns, then go
into more advanced topics.
Building New Module
===================
Include this subsection only if there are special build instructions or
platform limitations.
Helpers
=======
What helper API will users typically use? Describe it here.
Attributes
==========
What classes hold attributes, and what are the key ones worth mentioning?
Output
======
What kind of data does the model generate? What are the key trace
sources? What kind of logging output can be enabled?
Advanced Usage
==============
Go into further details (such as using the API outside of the helpers)
in additional sections, as needed.
Examples
========
What examples using this new code are available? Describe them here.
Troubleshooting
===============
Add any tips for avoiding pitfalls, etc.
Validation
**********
Describe how the model has been tested/validated. What tests run in the
test suite? How much API and code is covered by the tests? Again,
references to outside published work may help here.
| {
"content_hash": "feec15f96ce249cbcdbd44279d990de1",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 74,
"avg_line_length": 24.70408163265306,
"alnum_prop": 0.6939281288723668,
"repo_name": "ns-4/NS4",
"id": "f4b9cce6746be6bf302f4b710f3622ac8ea50fb0",
"size": "2421",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "doc/p4.rst",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "C++",
"bytes": "37494"
},
{
"name": "P4",
"bytes": "461"
},
{
"name": "Python",
"bytes": "2064"
}
],
"symlink_target": ""
} |
package org.fest.swing.driver;
import static org.fest.assertions.Assertions.assertThat;
import static org.fest.swing.edt.GuiActionRunner.execute;
import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;
import org.fest.swing.annotation.RunsInEDT;
import org.fest.swing.edt.GuiQuery;
import org.fest.swing.test.core.MethodInvocations;
import org.fest.swing.test.core.RobotBasedTestCase;
import org.fest.swing.test.swing.TestWindow;
import org.junit.Test;
/**
* Tests for {@link JTreeClearSelectionTask#clearSelectionOf(JTree)}.
*
* @author Alex Ruiz
*/
public class JTreeClearSelectionTask_clearSelectionOf_Test extends RobotBasedTestCase {
static final String TEXTBOX_TEXT = "Hello World";
private MyTree tree;
@Override
protected void onSetUp() {
MyWindow window = MyWindow.createNew();
tree = window.tree;
}
@Test
public void should_clear_selection_in_JTree() {
requireSelectionCount(1);
tree.startRecording();
JTreeClearSelectionTask.clearSelectionOf(tree);
robot.waitForIdle();
requireSelectionCount(0);
tree.requireInvoked("clearSelection");
}
@RunsInEDT
private void requireSelectionCount(int expected) {
assertThat(selectionCountOf(tree)).isEqualTo(expected);
}
@RunsInEDT
private static int selectionCountOf(final MyTree tree) {
return execute(new GuiQuery<Integer>() {
@Override
protected Integer executeInEDT() {
return tree.getSelectionCount();
}
});
}
private static class MyWindow extends TestWindow {
final MyTree tree = new MyTree();
@RunsInEDT
static MyWindow createNew() {
return execute(new GuiQuery<MyWindow>() {
@Override
protected MyWindow executeInEDT() {
return new MyWindow();
}
});
}
private MyWindow() {
super(JTreeClearSelectionTask_clearSelectionOf_Test.class);
add(tree);
}
}
private static class MyTree extends JTree {
private boolean recording;
private final MethodInvocations methodInvocations = new MethodInvocations();
MyTree() {
super(new DefaultMutableTreeNode("root"));
setSelectionRow(0);
}
@Override
public void clearSelection() {
if (recording) {
methodInvocations.invoked("clearSelection");
}
super.clearSelection();
}
void startRecording() {
recording = true;
}
MethodInvocations requireInvoked(String methodName) {
return methodInvocations.requireInvoked(methodName);
}
}
}
| {
"content_hash": "5e350242bbb7e5d5f1f6a26e14e8e321",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 87,
"avg_line_length": 24.892156862745097,
"alnum_prop": 0.7010634107916502,
"repo_name": "google/fest",
"id": "a0b6336ccef582c4cc13c3c3ad9396761e9d9ebf",
"size": "3180",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "third_party/fest-swing/src/test/java/org/fest/swing/driver/JTreeClearSelectionTask_clearSelectionOf_Test.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
require 'i18n_plus/version'
require 'i18n_plus/country'
require 'i18n_plus/state'
require 'i18n_plus/language'
require 'i18n_plus/locale'
require 'i18n_plus/currency'
| {
"content_hash": "04050f663de33f53aa0e6e649b41e8ee",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 28,
"avg_line_length": 27.833333333333332,
"alnum_prop": 0.7844311377245509,
"repo_name": "olivere/i18n_plus",
"id": "f4d738b525e58877835d8e2b3875f50e232cb99f",
"size": "167",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/i18n_plus.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "26858"
}
],
"symlink_target": ""
} |
The MIT License (MIT)
Copyright (c) 2017 Carson McKinstry
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
| {
"content_hash": "9da1cc41c505069db9fe0cfb524f1edb",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 78,
"avg_line_length": 51.57142857142857,
"alnum_prop": 0.804247460757156,
"repo_name": "CarsonMckinstry/recipes-app",
"id": "13d8ad72ff1ded309cb294974ccbf9018212ed12",
"size": "1083",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "LICENSE.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "343"
},
{
"name": "HTML",
"bytes": "1917"
},
{
"name": "JavaScript",
"bytes": "5179"
}
],
"symlink_target": ""
} |
<?php
namespace Oro\Bundle\EmailBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\Translation\TranslatorInterface;
use Oro\Bundle\EmailBundle\Entity\Email;
use Oro\Bundle\EmailBundle\Entity\EmailTemplate;
use Oro\Bundle\EmailBundle\Entity\Repository\EmailTemplateRepository;
use Oro\Bundle\SecurityBundle\SecurityFacade;
class AutoResponseTemplateChoiceType extends AbstractType
{
const NAME = 'oro_email_autoresponse_template_choice';
/** @var SecurityFacade */
protected $securityFacade;
/** @var TranslatorInterface */
protected $translator;
/**
* @param SecurityFacade $securityFacade
* @param TranslatorInterface $translator
*/
public function __construct(SecurityFacade $securityFacade, TranslatorInterface $translator)
{
$this->securityFacade = $securityFacade;
$this->translator = $translator;
}
/**
* {@inheritdoc}
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults([
'selectedEntity' => Email::ENTITY_CLASS,
'query_builder' => function (EmailTemplateRepository $repository) {
return $repository->getEntityTemplatesQueryBuilder(
Email::ENTITY_CLASS,
$this->securityFacade->getOrganization(),
true
);
},
'configs' => [
'allowClear' => true,
'placeholder' => 'oro.form.custom_value',
]
]);
}
/**
* @param FormView $view
* @param FormInterface $form
* @param array $options
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function buildView(FormView $view, FormInterface $form, array $options)
{
/* @var $choice ChoiceView */
foreach ($view->vars['choices'] as $choice) {
/* @var $template EmailTemplate */
$template = $choice->data;
if (!$template->isVisible()) {
$choice->label = $this->translator->trans('oro.form.custom_value');
}
}
}
/**
* {@inheritdoc}
*/
public function getParent()
{
return 'oro_email_template_list';
}
/**
* {@inheritdoc}
*/
public function getName()
{
return static::NAME;
}
}
| {
"content_hash": "90750890ced7871b2981db737008dd76",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 96,
"avg_line_length": 28.560439560439562,
"alnum_prop": 0.617545209696037,
"repo_name": "ramunasd/platform",
"id": "de38e5261f44f72010ed14dfb0ef17a3a2aa97d0",
"size": "2599",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Oro/Bundle/EmailBundle/Form/Type/AutoResponseTemplateChoiceType.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "603774"
},
{
"name": "Cucumber",
"bytes": "660"
},
{
"name": "HTML",
"bytes": "1405665"
},
{
"name": "JavaScript",
"bytes": "4879132"
},
{
"name": "PHP",
"bytes": "21956201"
}
],
"symlink_target": ""
} |
<!doctype html>
<html>
<head>
<!-- a test for issue 37 (and part of 23)-->
<style type="text/css">
#container { position:relative; overflow:scroll; width:30em; height:30em; border:1px dotted red; margin-top:4em;}
.window { position:absolute; width:5em; height:5em; background-color:blue; z-index:2;}
.oWindow { background-color:red; }
.oWindow2 { background-color:yellow; }
#window1 { left:5em; top:5em; }
#window2 { left:15em; top:15em; }
#window3 { left:25em; top:25em; }
#window4 { left:20em; top:20em; z-index:10;}
#window5 { left:10em; top:6em; }
.spot { width:1em; height:1em; background-color:green; position:absolute;z-index:13;}
.testHover { border:1px dotted black; }
#debug { overflow:auto; width:20em; position:absolute; right:0; border:1px dotted blue;height:30em;z-index:10;top:0;margin-top:4em;}
</style>
</head>
<body>
<div id="container">
<div id="window1" class="window"></div>
<div id="window2" class="window"></div>
<div id="window3" class="window"></div>
<div id="window4" class="window oWindow">drop me on the yellow square.</div>
<div id="window5" class="window oWindow2">drop the red square on me.</div>
<div id="spot1" class="spot"></div>
<div id="spot2" class="spot"></div>
</div>
<div id="debug"></div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/mootools/1.3.2/mootools-yui-compressed.js"></script>
<script type="text/javascript" src="../js/lib/mootools-more-1.3.2.1.js"></script>
<script type="text/javascript">
window.addEvent('domready', function() {
document.onselectstart = function () { return false; };
var container = $$("#container"), w4 = $$("#window4"), w5 = $$("#window5"), debug = $$("#debug");
var s1 = $$("#spot1"), s2 = $$("#spot2"), w4w = w4.getSize().x, w4h = w4.getSize().h;
/*var w4drag = new Drag.Move(w4, {
start : function() { debug.html(""); },
drag : function(e, ui) {
var o = w4.offset()
// now attempt to position the spots at the tl and br corners of w4.
s1.offset(o);
s2.offset({left:o.left + w4w, top:o.top+w4h});
},
scope:"testjquerydrag",
cursor:"move"
});
var w5drag = new Drag.Move(w5, {
scope:"testjquerydrag",
hoverClass:"testHover",
drop : function() { debug.html("red square dropped."); },
});*/
new Drag.Move(document.getElementById("window4"));
});
</script>
</body>
</html>
| {
"content_hash": "a566213da5846bbfe6b2961982f325fe",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 138,
"avg_line_length": 38.2,
"alnum_prop": 0.616995569875151,
"repo_name": "doubleblacktech/learn-plumb",
"id": "cf7acb3d71cf78977cc09e70fb54e27e70c23636",
"size": "2483",
"binary": false,
"copies": "18",
"ref": "refs/heads/master",
"path": "tests/miscellaneous/issue37_test-mootools.html",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "65950687"
}
],
"symlink_target": ""
} |
@interface CountlyConsentManager : NSObject
@property (nonatomic) BOOL requiresConsent;
@property (nonatomic, readonly) BOOL consentForSessions;
@property (nonatomic, readonly) BOOL consentForEvents;
@property (nonatomic, readonly) BOOL consentForUserDetails;
@property (nonatomic, readonly) BOOL consentForCrashReporting;
@property (nonatomic, readonly) BOOL consentForPushNotifications;
@property (nonatomic, readonly) BOOL consentForLocation;
@property (nonatomic, readonly) BOOL consentForViewTracking;
@property (nonatomic, readonly) BOOL consentForAttribution;
@property (nonatomic, readonly) BOOL consentForPerformanceMonitoring;
@property (nonatomic, readonly) BOOL consentForFeedback;
@property (nonatomic, readonly) BOOL consentForRemoteConfig;
+ (instancetype)sharedInstance;
- (void)giveConsentForFeatures:(NSArray *)features;
- (void)giveConsentForAllFeatures;
- (void)cancelConsentForFeatures:(NSArray *)features;
- (void)cancelConsentForAllFeatures;
- (void)cancelConsentForAllFeaturesWithoutSendingConsentsRequest;
- (BOOL)hasAnyConsent;
@end
| {
"content_hash": "ad9ec31c49b6f0cae581acf5fdac7b45",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 69,
"avg_line_length": 42.52,
"alnum_prop": 0.8287864534336783,
"repo_name": "Countly/countly-sdk-ios",
"id": "9e7dd0ce3832a206e6e871c9322535e2a9a72c1a",
"size": "1228",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "CountlyConsentManager.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "334492"
},
{
"name": "Ruby",
"bytes": "2972"
},
{
"name": "Shell",
"bytes": "3329"
},
{
"name": "Swift",
"bytes": "1572"
}
],
"symlink_target": ""
} |
package freemarker.ext.servlet;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import java.io.IOException;
import java.util.Collections;
import org.junit.Test;
import com.google.common.collect.ImmutableList;
import freemarker.cache.ClassTemplateLoader;
import freemarker.cache.MultiTemplateLoader;
import freemarker.cache.WebappTemplateLoader;
import freemarker.template.Configuration;
import freemarker.template.MockServletContext;
public class InitParamParserTest {
@Test
public void testFindTemplatePathSettingAssignmentsStart() {
assertEquals(0, InitParamParser.findTemplatePathSettingAssignmentsStart("?settings()"));
assertEquals(1, InitParamParser.findTemplatePathSettingAssignmentsStart("x?settings()"));
assertEquals(1, InitParamParser.findTemplatePathSettingAssignmentsStart("x?settings(x=1, y=2)"));
assertEquals(2, InitParamParser.findTemplatePathSettingAssignmentsStart("x ? settings ( x=1, y=2 ) "));
assertEquals(1, InitParamParser.findTemplatePathSettingAssignmentsStart("x?settings(x=f(), y=g())"));
assertEquals(1, InitParamParser.findTemplatePathSettingAssignmentsStart("x?settings(x=\"(\", y='(')"));
assertEquals(1, InitParamParser.findTemplatePathSettingAssignmentsStart("x?settings(x=\"(\\\"\", y='(\\'')"));
assertEquals(-1, InitParamParser.findTemplatePathSettingAssignmentsStart(""));
assertEquals(-1, InitParamParser.findTemplatePathSettingAssignmentsStart("settings"));
assertEquals(-1, InitParamParser.findTemplatePathSettingAssignmentsStart("settings()"));
assertEquals(-1, InitParamParser.findTemplatePathSettingAssignmentsStart("x?settings"));
assertEquals(-1, InitParamParser.findTemplatePathSettingAssignmentsStart("foo?/settings(x=1)"));
assertEquals(-1, InitParamParser.findTemplatePathSettingAssignmentsStart("x?settings()x=1)"));
assertEquals(-1, InitParamParser.findTemplatePathSettingAssignmentsStart("x?settings((x=1)"));
try {
assertEquals(0, InitParamParser.findTemplatePathSettingAssignmentsStart("x?setting(x = 1)"));
fail();
} catch (Exception e) {
assertThat(e.getMessage(), containsString("\"setting\""));
}
}
@Test
public void testCreateTemplateLoader() throws IOException {
Configuration cfg = new Configuration(Configuration.VERSION_2_3_22);
{
ClassTemplateLoader ctl = (ClassTemplateLoader) InitParamParser.createTemplateLoader(
"classpath:templates",
cfg, this.getClass(), null);
assertEquals("templates/", ctl.getBasePackagePath());
assertNull(ctl.getURLConnectionUsesCaches());
}
{
ClassTemplateLoader ctl = (ClassTemplateLoader) InitParamParser.createTemplateLoader(
"classpath:templates?settings(URLConnectionUsesCaches=false)",
cfg, this.getClass(), null);
assertEquals("templates/", ctl.getBasePackagePath());
assertEquals(Boolean.FALSE, ctl.getURLConnectionUsesCaches());
}
{
MultiTemplateLoader mtl = (MultiTemplateLoader) InitParamParser.createTemplateLoader(
"["
+ "templates?settings(URLConnectionUsesCaches=false, attemptFileAccess=false), "
+ "foo/templates?settings(URLConnectionUsesCaches=true), "
+ "classpath:templates, "
+ "classpath:foo/templates?settings(URLConnectionUsesCaches=true)"
+ "]",
cfg, this.getClass(), new MockServletContext());
assertEquals(4, mtl.getTemplateLoaderCount());
final WebappTemplateLoader tl1 = (WebappTemplateLoader) mtl.getTemplateLoader(0);
assertEquals(Boolean.FALSE, tl1.getURLConnectionUsesCaches());
assertFalse(tl1.getAttemptFileAccess());
final WebappTemplateLoader tl2 = (WebappTemplateLoader) mtl.getTemplateLoader(1);
assertEquals(Boolean.TRUE, tl2.getURLConnectionUsesCaches());
assertTrue(tl2.getAttemptFileAccess());
final ClassTemplateLoader tl3 = (ClassTemplateLoader) mtl.getTemplateLoader(2);
assertNull(tl3.getURLConnectionUsesCaches());
final ClassTemplateLoader tl4 = (ClassTemplateLoader) mtl.getTemplateLoader(3);
assertEquals(Boolean.TRUE, tl4.getURLConnectionUsesCaches());
}
}
@Test
public void testParseCommaSeparatedTemplateLoaderList() {
assertEquals(Collections.emptyList(),
InitParamParser.parseCommaSeparatedTemplatePaths(""));
assertEquals(Collections.emptyList(),
InitParamParser.parseCommaSeparatedTemplatePaths(" "));
assertEquals(Collections.emptyList(),
InitParamParser.parseCommaSeparatedTemplatePaths(","));
assertEquals(ImmutableList.of("a"),
InitParamParser.parseCommaSeparatedTemplatePaths("a"));
assertEquals(ImmutableList.of("a"),
InitParamParser.parseCommaSeparatedTemplatePaths(" a "));
assertEquals(ImmutableList.of("a", "b", "c"),
InitParamParser.parseCommaSeparatedTemplatePaths("a,b,c"));
assertEquals(ImmutableList.of("a", "b", "c"),
InitParamParser.parseCommaSeparatedTemplatePaths(" a , b , c "));
assertEquals(ImmutableList.of("a", "b", "c"),
InitParamParser.parseCommaSeparatedTemplatePaths("a,b,c,"));
try {
assertEquals(ImmutableList.of("a", "b", "c"),
InitParamParser.parseCommaSeparatedTemplatePaths("a,b,,c"));
} catch (Exception e) {
assertThat(e.getMessage(), containsString("comma"));
}
try {
assertEquals(ImmutableList.of("a", "b", "c"),
InitParamParser.parseCommaSeparatedTemplatePaths(",a,b,c"));
} catch (Exception e) {
assertThat(e.getMessage(), containsString("comma"));
}
try {
assertEquals(ImmutableList.of("a", "b", "c"),
InitParamParser.parseCommaSeparatedTemplatePaths(",a,b,c"));
} catch (Exception e) {
assertThat(e.getMessage(), containsString("comma"));
}
assertEquals(ImmutableList.of("a?settings(1)", "b", "c?settings(2)"),
InitParamParser.parseCommaSeparatedTemplatePaths("a?settings(1),b,c?settings(2)"));
assertEquals(ImmutableList.of("a ? settings ( 1 )", "b", "c ? settings ( 2 )"),
InitParamParser.parseCommaSeparatedTemplatePaths(" a ? settings ( 1 ) , b , c ? settings ( 2 ) "));
assertEquals(ImmutableList.of("a?settings(1,2,3)", "b?settings(1,2)", "c?settings()"),
InitParamParser.parseCommaSeparatedTemplatePaths("a?settings(1,2,3),b?settings(1,2),c?settings()"));
assertEquals(ImmutableList.of("a?settings(x=1, y=2)"),
InitParamParser.parseCommaSeparatedTemplatePaths("a?settings(x=1, y=2)"));
try {
InitParamParser.parseCommaSeparatedTemplatePaths("a?foo(x=1, y=2)");
} catch (Exception e) {
assertThat(e.getMessage(), containsString("settings"));
}
}
}
| {
"content_hash": "4c45ddda443474755a1c6c6ad3889766",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 118,
"avg_line_length": 49.01315789473684,
"alnum_prop": 0.6444295302013423,
"repo_name": "apache/incubator-freemarker",
"id": "c712ef25ea57e0bb940f2f6e368d7594ea65c940",
"size": "8257",
"binary": false,
"copies": "2",
"ref": "refs/heads/2.3-gae",
"path": "src/test/java/freemarker/ext/servlet/InitParamParserTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "FreeMarker",
"bytes": "383555"
},
{
"name": "HTML",
"bytes": "20858"
},
{
"name": "Java",
"bytes": "5025665"
}
],
"symlink_target": ""
} |
/**
* Base package containing Datasec data security application
*/
package org.graeme.datasec; | {
"content_hash": "bf09ab8adcff258ae4064afd349ac6ce",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 60,
"avg_line_length": 24,
"alnum_prop": 0.7708333333333334,
"repo_name": "lewismc/datasec",
"id": "494b435aa7d9d0294c74e9b6f5d4423afe05f4ba",
"size": "96",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/org/graeme/datasec/package-info.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "5098"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8" />
<title>
Tags | FIT Math
</title>
<link href="//cdn.jsdelivr.net" rel="dns-prefetch">
<link href="//cdnjs.cloudflare.com" rel="dns-prefetch">
<link href="//at.alicdn.com" rel="dns-prefetch">
<link href="//fonts.googleapis.com" rel="dns-prefetch">
<link href="//fonts.gstatic.com" rel="dns-prefetch">
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@gohugoio">
<meta name="twitter:title" content="FIT Math">
<meta property="og:type" content="website">
<meta property="og:title" content="FIT Math">
<meta property="og:url" content="https://fitmath.github.io/macblog/">
<meta name="generator" content="Hugo 0.52" />
<link rel="canonical" href="https://fitmath.github.io/macblog/">
<link rel="alternate" type="application/rss+xml" href="https://fitmath.github.io/macblog/index.xml" title="FIT Math">
<meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="format-detection" content="telephone=no,email=no,adress=no">
<meta http-equiv="Cache-Control" content="no-transform">
<link rel="preload" href="/styles/main.min.css" as="style">
<link rel="preload" href="https://fonts.googleapis.com/css?family=Raleway" as="style">
<link rel="preload" href="/images/grey-prism.svg" as="image">
<style>
body {
background: rgb(244, 243, 241) url('/images/grey-prism.svg') repeat fixed;
}
</style>
<link rel="stylesheet" href="/styles/main.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Raleway">
<script src="https://cdn.jsdelivr.net/npm/medium-zoom@1.0.2/dist/medium-zoom.min.js"></script>
<!--[if lte IE 8]>
<script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/videojs-ie8@1.1.2/dist/videojs-ie8.min.js"></script>
<![endif]-->
<!--[if lte IE 9]>
<script src="https://cdn.jsdelivr.net/npm/eligrey-classlist-js-polyfill@1.2.20180112/classList.min.js"></script>
<![endif]-->
<script src="https://cdn.jsdelivr.net/npm/smooth-scroll@14.2.1/dist/smooth-scroll.polyfills.min.js"></script>
</head>
<body>
<div class="suspension">
<a title="Go to top" class="to-top is-hide"><span class="icon icon-up"></span></a>
</div>
<section class="main post-list">
<header class="post-header">
<h1 class="post-list-title">FIT-MAC Blog</h1>
</header>
<article class="post-content">
<div style="float: none">
</div>
<div style="clear: both; float:none">
<article class="blogListing">
<header>
<h3><a href="https://fitmath.github.io/macblog/17.08.07/">First Post</a> </h3>
<span class="date">
Published: Oct 2, 2016
</span>
</header>
<div class="summary">
This is the first page
</div>
</article>
<article class="blogListing">
<header>
<h3><a href="https://fitmath.github.io/macblog/readme/"></a> </h3>
<span class="date">
Published: Jan 1, 0001
</span>
</header>
<div class="summary">
MAC Blog Files
fitmath.github.io is a static website built using Hugo by Jonathan Goldfarb.
Go here to get hugo.
This repository hosts the files used to generate the blog portion of fitmath.github.io; cloning [the main repository]() is the best way to go about editing these files.
Getting Started To get started, clone this repository using git, e.g. from the folder into which you would like FITMath.github.io to appear, run
</div>
<footer>
<a href='https://fitmath.github.io/macblog/readme/'><nobr>Read more →</nobr></a>
</footer>
</article>
</article>
</section>
<footer class="site-footer">
<p>© 2018-2019 FIT Math</p>
</footer>
</body>
</html>
| {
"content_hash": "be94e2512bf7af54af74ddca693dfcde",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 168,
"avg_line_length": 23.848837209302324,
"alnum_prop": 0.6333495855680156,
"repo_name": "FITMath/fitmath.github.io",
"id": "bbefbf9d0763f575f3863c64193ebf85cd619474",
"size": "4105",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "macblog/index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1159"
},
{
"name": "HTML",
"bytes": "111410"
}
],
"symlink_target": ""
} |
var mongoose = require('mongoose')
var schema = new mongoose.Schema({
member: String,
thread: String
})
schema.index({member: 1})
schema.index({thread: 1})
module.exports = mongoose.model('Subscription', schema)
| {
"content_hash": "fd7ae9648adb0a4d332af147ca66efaf",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 55,
"avg_line_length": 19.90909090909091,
"alnum_prop": 0.7123287671232876,
"repo_name": "sinfo/eventdeck",
"id": "814da8e55c93249cbb8182fc984809a52df737ee",
"size": "219",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "server/db/subscription.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "18047"
},
{
"name": "Dockerfile",
"bytes": "668"
},
{
"name": "HTML",
"bytes": "149563"
},
{
"name": "JavaScript",
"bytes": "1262593"
}
],
"symlink_target": ""
} |
#include "main/context.h"
#include "main/colormac.h"
#include "main/fbobject.h"
#include "main/macros.h"
#include "main/teximage.h"
#include "main/renderbuffer.h"
#include "swrast/swrast.h"
#include "swrast/s_context.h"
#include "swrast/s_texfetch.h"
/*
* Render-to-texture code for GL_EXT_framebuffer_object
*/
static void
delete_texture_wrapper(struct gl_context *ctx, struct gl_renderbuffer *rb)
{
ASSERT(rb->RefCount == 0);
free(rb);
}
/**
* Update the renderbuffer wrapper for rendering to a texture.
* For example, update the width, height of the RB based on the texture size,
* update the internal format info, etc.
*/
static void
update_wrapper(struct gl_context *ctx, struct gl_renderbuffer_attachment *att)
{
struct gl_renderbuffer *rb = att->Renderbuffer;
struct swrast_renderbuffer *srb = swrast_renderbuffer(rb);
struct swrast_texture_image *swImage;
gl_format format;
GLuint zOffset;
(void) ctx;
swImage = swrast_texture_image(rb->TexImage);
assert(swImage);
format = swImage->Base.TexFormat;
if (att->Texture->Target == GL_TEXTURE_1D_ARRAY_EXT) {
zOffset = 0;
}
else {
zOffset = att->Zoffset;
}
/* Want to store linear values, not sRGB */
rb->Format = _mesa_get_srgb_format_linear(format);
srb->Buffer = swImage->ImageSlices[zOffset];
}
/**
* Called when rendering to a texture image begins, or when changing
* the dest mipmap level, cube face, etc.
* This is a fallback routine for software render-to-texture.
*
* Called via the glRenderbufferTexture1D/2D/3D() functions
* and elsewhere (such as glTexImage2D).
*
* The image we're rendering into is
* att->Texture->Image[att->CubeMapFace][att->TextureLevel];
* It'll never be NULL.
*
* \param fb the framebuffer object the texture is being bound to
* \param att the fb attachment point of the texture
*
* \sa _mesa_framebuffer_renderbuffer
*/
void
_swrast_render_texture(struct gl_context *ctx,
struct gl_framebuffer *fb,
struct gl_renderbuffer_attachment *att)
{
struct gl_renderbuffer *rb = att->Renderbuffer;
(void) fb;
/* plug in our texture_renderbuffer-specific functions */
rb->Delete = delete_texture_wrapper;
update_wrapper(ctx, att);
}
void
_swrast_finish_render_texture(struct gl_context *ctx,
struct gl_renderbuffer *rb)
{
/* do nothing */
/* The renderbuffer texture wrapper will get deleted by the
* normal mechanism for deleting renderbuffers.
*/
(void) ctx;
(void) rb;
}
| {
"content_hash": "0397cd7a7b1e9cd298f3b0afc298aadf",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 78,
"avg_line_length": 24.980582524271846,
"alnum_prop": 0.6793626117372716,
"repo_name": "devlato/kolibrios-llvm",
"id": "751d7767b91df1b1ad1ecef2aea9a61de3897638",
"size": "2573",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "contrib/sdk/sources/Mesa/src/mesa/swrast/s_texrender.c",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "15418643"
},
{
"name": "C",
"bytes": "126021466"
},
{
"name": "C++",
"bytes": "11476220"
},
{
"name": "CSS",
"bytes": "1230161"
},
{
"name": "JavaScript",
"bytes": "687"
},
{
"name": "Logos",
"bytes": "905"
},
{
"name": "Lua",
"bytes": "2055"
},
{
"name": "Objective-C",
"bytes": "482461"
},
{
"name": "Pascal",
"bytes": "6692"
},
{
"name": "Perl",
"bytes": "317449"
},
{
"name": "Puppet",
"bytes": "161697"
},
{
"name": "Python",
"bytes": "1036533"
},
{
"name": "Shell",
"bytes": "448869"
},
{
"name": "Verilog",
"bytes": "2829"
},
{
"name": "Visual Basic",
"bytes": "4346"
},
{
"name": "XSLT",
"bytes": "4325"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en" ng-app="jpm">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="/releases/4.3.0/css/style.css" rel="stylesheet" />
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="/js/releases.js"></script>
<!-- Begin Jekyll SEO tag v2.5.0 -->
<title>reverse (‘;’ LIST )*</title>
<meta name="generator" content="Jekyll v3.8.5" />
<meta property="og:title" content="reverse (‘;’ LIST )*" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="static String _reverse = "${reverse;<list>[;<list>...]}";" />
<meta property="og:description" content="static String _reverse = "${reverse;<list>[;<list>...]}";" />
<script type="application/ld+json">
{"@type":"WebPage","url":"/releases/4.3.0/macros/reverse.html","headline":"reverse (‘;’ LIST )*","description":"static String _reverse = "${reverse;<list>[;<list>...]}";","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
</head>
<body>
<ul class="container12 menu-bar">
<li span=11><a class=menu-link href="/releases/4.3.0/"><img
class=menu-logo src='/releases/4.3.0/img/bnd-80x40-white.png'></a>
<a href="/releases/4.3.0/chapters/110-introduction.html">Intro
</a><a href="/releases/4.3.0/chapters/800-headers.html">Headers
</a><a href="/releases/4.3.0/chapters/825-instructions-ref.html">Instructions
</a><a href="/releases/4.3.0/chapters/855-macros-ref.html">Macros
</a><a href="/releases/4.3.0/chapters/400-commands.html">Commands
</a><div class="releases"><button class="dropbtn">4.3.0</button><div class="dropdown-content"></div></div>
<li class=menu-link span=1>
<a href="https://github.com/bndtools/bnd" target="_"><img
style="position:absolute;top:0;right:0;margin:0;padding:0;z-index:100"
src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67"
alt="Fork me on GitHub"
data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>
</ul>
<ul class=container12>
<li span=3>
<div>
<ul class="side-nav">
<li><a href="/releases/4.3.0/chapters/110-introduction.html">Introduction</a>
<li><a href="/releases/4.3.0/chapters/120-install.html">How to install bnd</a>
<li><a href="/releases/4.3.0/chapters/123-tour-workspace.html">Guided Tour</a>
<li><a href="/releases/4.3.0/chapters/125-tour-features.html">Guided Tour Workspace & Projects</a>
<li><a href="/releases/4.3.0/chapters/130-concepts.html">Concepts</a>
<li><a href="/releases/4.3.0/chapters/140-best-practices.html">Best practices</a>
<li><a href="/releases/4.3.0/chapters/150-build.html">Build</a>
<li><a href="/releases/4.3.0/chapters/155-project-setup.html">Project Setup</a>
<li><a href="/releases/4.3.0/chapters/160-jars.html">Generating JARs</a>
<li><a href="/releases/4.3.0/chapters/170-versioning.html">Versioning</a>
<li><a href="/releases/4.3.0/chapters/180-baselining.html">Baselining</a>
<li><a href="/releases/4.3.0/chapters/200-components.html">Service Components</a>
<li><a href="/releases/4.3.0/chapters/210-metatype.html">Metatype</a>
<li><a href="/releases/4.3.0/chapters/220-contracts.html">Contracts</a>
<li><a href="/releases/4.3.0/chapters/230-manifest-annotations.html">Bundle Annotations</a>
<li><a href="/releases/4.3.0/chapters/235-accessor-properties.html">Accessor Properties</a>
<li><a href="/releases/4.3.0/chapters/240-spi-annotations.html">SPI Annotations</a>
<li><a href="/releases/4.3.0/chapters/250-resolving.html">Resolving Dependencies</a>
<li><a href="/releases/4.3.0/chapters/300-launching.html">Launching</a>
<li><a href="/releases/4.3.0/chapters/305-startlevels.html">Startlevels</a>
<li><a href="/releases/4.3.0/chapters/310-testing.html">Testing</a>
<li><a href="/releases/4.3.0/chapters/315-launchpad-testing.html">Testing with Launchpad</a>
<li><a href="/releases/4.3.0/chapters/320-packaging.html">Packaging Applications</a>
<li><a href="/releases/4.3.0/chapters/330-jpms.html">JPMS Libraries</a>
<li><a href="/releases/4.3.0/chapters/390-wrapping.html">Wrapping Libraries to OSGi Bundles</a>
<li><a href="/releases/4.3.0/chapters/395-generating-documentation.html">Generating Documentation</a>
<li><a href="/releases/4.3.0/chapters/400-commands.html">Commands</a>
<li><a href="/releases/4.3.0/chapters/600-developer.html">For Developers</a>
<li><a href="/releases/4.3.0/chapters/700-tools.html">Tools bound to bnd</a>
<li><a href="/releases/4.3.0/chapters/800-headers.html">Headers</a>
<li><a href="/releases/4.3.0/chapters/820-instructions.html">Instruction Reference</a>
<li><a href="/releases/4.3.0/chapters/825-instructions-ref.html">Instruction Index</a>
<li><a href="/releases/4.3.0/chapters/850-macros.html">Macro Reference</a>
<li><a href="/releases/4.3.0/chapters/855-macros-ref.html">Macro Index</a>
<li><a href="/releases/4.3.0/chapters/870-plugins.html">Plugins</a>
<li><a href="/releases/4.3.0/chapters/880-settings.html">Settings</a>
<li><a href="/releases/4.3.0/chapters/900-errors.html">Errors</a>
<li><a href="/releases/4.3.0/chapters/910-warnings.html">Warnings</a>
<li><a href="/releases/4.3.0/chapters/920-faq.html">Frequently Asked Questions</a>
</ul>
</div>
<li span=9>
<div class=notes-margin>
<h1> reverse (';' LIST )*</h1>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>static String _reverse = "${reverse;<list>[;<list>...]}";
public String _reverse(String args[]) throws Exception {
verifyCommand(args, _reverse, null, 2, Integer.MAX_VALUE);
ExtList<String> list = toList(args, 1, args.length);
Collections.reverse(list);
return Processor.join(list);
}
</code></pre></div></div>
</div>
</ul>
<nav class=next-prev>
<a href='/releases/4.3.0/macros/repos.html'></a> <a href='/releases/4.3.0/macros/select.html'></a>
</nav>
<footer class="container12" style="border-top: 1px solid black;padding:10px 0">
<ul span=12 row>
<li span=12>
<ul>
<li><a href="/releases/4.3.0/">GitHub</a>
</ul>
</ul>
</footer>
</body>
</html>
| {
"content_hash": "ff9d1d524338dabe52bc7e4224f070e7",
"timestamp": "",
"source": "github",
"line_count": 324,
"max_line_length": 233,
"avg_line_length": 20.549382716049383,
"alnum_prop": 0.6691198558125563,
"repo_name": "psoreide/bnd",
"id": "02cdca184ab9987736e90152f103b412a92920e8",
"size": "6670",
"binary": false,
"copies": "8",
"ref": "refs/heads/master",
"path": "docs/releases/4.3.0/macros/reverse.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "5971"
},
{
"name": "Groovy",
"bytes": "137212"
},
{
"name": "HTML",
"bytes": "20589"
},
{
"name": "Java",
"bytes": "4890082"
},
{
"name": "Shell",
"bytes": "13535"
},
{
"name": "XSLT",
"bytes": "24433"
}
],
"symlink_target": ""
} |
<?php
class ClerkPowerstepModuleFrontController extends ModuleFrontController
{
public function initContent()
{
parent::initContent();
$response = [];
$popup = (int)Tools::getValue('popup');
if ($id_product = (int)Tools::getValue('id_product')) {
$product = new Product($id_product, true, $this->context->language->id, $this->context->shop->id);
}
if (!Validate::isLoadedObject($product)) {
$response = [
'success' => false,
'data' => 'Product not found'
];
} else {
$modal = $this->module->renderModal(
$this->context->cart,
Tools::getValue('id_product'),
Tools::getValue('id_product_attribute')
);
$response = [
'success' => true,
'data' => $modal
];
$image = Image::getCover($id_product);
$templatesConfig = Configuration::get('CLERK_POWERSTEP_TEMPLATES', $this->context->language->id, null, $this->context->shop->id);
$templates = array_filter(explode(',', $templatesConfig));
foreach ($templates as $key => $template) {
$templates[$key] = str_replace(' ','', $template);
}
$exclude_duplicates_powerstep = (bool)Configuration::get('CLERK_POWERSTEP_EXCLUDE_DUPLICATES', $this->context->language->id, null, $this->context->shop->id);
$categories = $product->getCategories();
$category = reset($categories);
$this->context->smarty->assign(array(
'templates' => $templates,
'product' => $product,
'category' => $category,
'image' => $image,
'order_process' => Configuration::get('PS_ORDER_PROCESS_TYPE') ? 'order-opc' : 'order',
'continue' => $this->context->link->getProductLink($id_product, $product->link_rewrite),
'popup' => (int)Tools::getValue('popup'),
'unix' => time(),
'ExcludeDuplicates' => $exclude_duplicates_powerstep
));
if ($popup == 1) {
$this->setTemplate('module:clerk/views/templates/front/powerstepmodal.tpl');
} else {
if (version_compare(_PS_VERSION_, '1.7.0', '>=')) {
$this->setTemplate('module:clerk/views/templates/front/powerstep17.tpl');
} else {
$this->setTemplate('powerstep.tpl');
}
}
return $this;
}
header('Content-Type: application/json');
die(json_encode($response));
}
}
| {
"content_hash": "553714fa50446a487e97707f29af3ea1",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 169,
"avg_line_length": 32.75,
"alnum_prop": 0.5030897855325336,
"repo_name": "clerkio/clerk-prestashop",
"id": "8a1e09855a985540a2726a5dcc5af67b72ab0183",
"size": "3928",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "controllers/front/powerstep.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "870"
},
{
"name": "JavaScript",
"bytes": "2098"
},
{
"name": "PHP",
"bytes": "348489"
},
{
"name": "Smarty",
"bytes": "55018"
}
],
"symlink_target": ""
} |
Download the example [or clone the repo](https://github.com/mui-org/material-ui):
```sh
curl https://codeload.github.com/mui-org/material-ui/tar.gz/next | tar -xz --strip=2 material-ui-next/examples/nextjs
cd nextjs
```
Install it and run:
```sh
npm install
npm run dev
```
or:
[](https://codesandbox.io/s/github/mui-org/material-ui/tree/HEAD/examples/nextjs)
## The idea behind the example
The project uses [Next.js](https://github.com/zeit/next.js), which is a framework for server-rendered React apps. It includes `@material-ui/core` and its peer dependencies, including `emotion`, the default style engine in Material-UI v5. If you prefer, you can [use styled-components instead](https://next.material-ui.com/guides/interoperability/#styled-components).
## The link component
Next.js has [a custom Link component](https://nextjs.org/docs/api-reference/next/link).
The example folder provides adapters for usage with Material-UI.
More information [in the documentation](https://next.material-ui.com/guides/routing/#next-js).
| {
"content_hash": "785792ffdf28421b6e985ec40f2fddca",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 366,
"avg_line_length": 41.333333333333336,
"alnum_prop": 0.7580645161290323,
"repo_name": "mbrookes/material-ui",
"id": "d03e247066f4959b4a53716a1e6aa3f4e467b7c7",
"size": "1150",
"binary": false,
"copies": "2",
"ref": "refs/heads/next",
"path": "examples/nextjs/README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "2092"
},
{
"name": "JavaScript",
"bytes": "16089809"
},
{
"name": "TypeScript",
"bytes": "1788737"
}
],
"symlink_target": ""
} |
/*
Section: effects
*/
module Game {
"use strict";
/********************************************************************************
* Group: target selection
********************************************************************************/
/*
Enum: TargetSelectionMethod
Define how we select the actors that are impacted by an effect.
ACTOR_ON_CELL - whatever actor is on the selected cell
CLOSEST_ENEMY - the closest non player creature
SELECTED_ACTOR - an actor manually selected
ACTORS_RANGE - all actors close to the cell
SELECTED_RANGE - all actors close to a manually selected position
*/
export const enum TargetSelectionMethod {
ACTOR_ON_CELL,
CLOSEST_ENEMY,
SELECTED_ACTOR,
ACTORS_IN_RANGE,
SELECTED_RANGE
}
/*
Class: TargetSelector
Various ways to select actors
*/
export class TargetSelector implements Persistent {
className: string;
private _method: TargetSelectionMethod;
private _range: number;
private _radius: number;
__selectedTargets: Actor[];
/*
Constructor: constructor
Parameters:
_method - the target selection method
_range - *optional* for methods requiring a range
_radius - *optional* for methods having a radius of effect
*/
constructor(_method: TargetSelectionMethod = undefined, _range?: number, _radius?: number) {
this.className = "TargetSelector";
this._method = _method;
this._range = _range;
this._radius = _radius;
}
/*
Property: method
The target selection method (read-only)
*/
get method() { return this._method; }
/*
Property: range
The selection range (read-only)
*/
get range() { return this._range; }
/*
Property: radius
Radius of effect around the selected position
*/
get radius() { return this._radius; }
/*
Function: selectTargets
Populates the __selectedTargets field, or triggers the tile picker
Parameters:
owner - the actor owning the effect (the magic item or the scroll)
wearer - the actor using the item
cellPos - the cell where the effect applies (= the wearer position when used from inventory, or a different position when thrown)
Returns:
true if targets have been selected (else wait for TILE_SELECTED event, then call <onTileSelected>)
*/
selectTargets(owner: Actor, wearer: Actor, cellPos: Yendor.Position): boolean {
this.__selectedTargets = [];
var creatureIds: ActorId[] = Engine.instance.actorManager.getCreatureIds();
var data: TilePickerEventData;
switch (this._method) {
case TargetSelectionMethod.ACTOR_ON_CELL :
if ( cellPos ) {
this.__selectedTargets = Engine.instance.actorManager.findActorsOnCell(cellPos, creatureIds);
} else {
this.__selectedTargets.push(wearer);
}
return true;
case TargetSelectionMethod.CLOSEST_ENEMY :
var actor = Engine.instance.actorManager.findClosestActor(cellPos ? cellPos : wearer, this.range, creatureIds);
if ( actor ) {
this.__selectedTargets.push(actor);
}
return true;
case TargetSelectionMethod.ACTORS_IN_RANGE :
this.__selectedTargets = Engine.instance.actorManager.findActorsInRange( cellPos ? cellPos : wearer, this.range, creatureIds );
return true;
case TargetSelectionMethod.SELECTED_ACTOR :
log("Left-click a target creature,\nor right-click to cancel.", Constants.LOG_WARN_COLOR);
data = {origin: new Yendor.Position(wearer.x, wearer.y), range: this._range, radius: this._radius};
Engine.instance.eventBus.publishEvent(EventType.PICK_TILE, data);
return false;
case TargetSelectionMethod.SELECTED_RANGE :
log("Left-click a target tile,\nor right-click to cancel.", Constants.LOG_WARN_COLOR);
data = {origin: new Yendor.Position(wearer.x, wearer.y), range: this._range, radius: this._radius};
Engine.instance.eventBus.publishEvent(EventType.PICK_TILE, data);
return false;
}
}
/*
Function: onTileSelected
Populates the __selectedTargets field for selection methods that require a tile selection
*/
onTileSelected(pos: Yendor.Position) {
var creatureIds: ActorId[] = Engine.instance.actorManager.getCreatureIds();
switch (this._method) {
case TargetSelectionMethod.SELECTED_ACTOR :
this.__selectedTargets = Engine.instance.actorManager.findActorsOnCell( pos, creatureIds);
break;
case TargetSelectionMethod.SELECTED_RANGE :
this.__selectedTargets = Engine.instance.actorManager.findActorsInRange( pos, this._radius, creatureIds );
break;
}
}
}
/********************************************************************************
* Group: conditions
********************************************************************************/
/*
Enum: ConditionType
CONFUSED - moves randomly and attacks anything on path
STUNNED - don't move or attack, then get confused
REGENERATION - regain health points over time
OVERENCUMBERED - walk slower. This also affects all actions relying on walkTime.
DETECT_LIFE - detect nearby living creatures
*/
export const enum ConditionType {
CONFUSED,
STUNNED,
FROZEN,
REGENERATION,
OVERENCUMBERED,
DETECT_LIFE,
}
export interface ConditionAdditionalParam {
amount?: number;
range?: number;
}
/*
Class: Condition
Permanent or temporary effect affecting a creature
*/
export class Condition implements Persistent {
className: string;
/*
Property: time
Time before this condition stops, or -1 for permanent conditions
*/
protected _time: number;
protected _type: ConditionType;
protected _initialTime: number;
private static condNames = [ "confused", "stunned", "frozen", "regeneration", "overencumbered", "life detection" ];
// factory
static create(type: ConditionType, time: number, additionalArgs?: ConditionAdditionalParam): Condition {
switch ( type ) {
case ConditionType.REGENERATION :
return new RegenerationCondition(time, additionalArgs.amount);
case ConditionType.STUNNED :
return new StunnedCondition(time);
case ConditionType.FROZEN :
return new FrozenCondition(time);
case ConditionType.DETECT_LIFE :
return new DetectLifeCondition(time, additionalArgs.range);
default :
return new Condition(type, time);
}
}
constructor(type: ConditionType, time: number) {
this.className = "Condition";
this._initialTime = time;
this._time = time;
this._type = type;
}
get type() { return this._type; }
get time() { return this._time; }
get initialTime() { return this._initialTime; }
getName() { return Condition.condNames[this._type]; }
/*
Function: onApply
What happens when an actor gets this condition
*/
onApply(owner: Actor) {}
/*
Function: onApply
What happens when this condition is removed from an actor
*/
onRemove(owner: Actor) {}
/*
Function: update
What happens every turn when an actor has this condition
Returns:
false if the condition has ended
*/
update(owner: Actor): boolean {
if ( this._time > 0 ) {
this._time --;
return (this._time > 0);
}
return true;
}
}
/*
Class: RegenerationCondition
The creature gain health points over time
*/
export class RegenerationCondition extends Condition {
private hpPerTurn: number;
constructor(nbTurns: number, nbHP : number) {
super(ConditionType.REGENERATION, nbTurns);
this.className = "RegenerationCondition";
this.hpPerTurn = nbHP / nbTurns;
}
update(owner: Actor): boolean {
if (owner.destructible) {
owner.destructible.heal(this.hpPerTurn);
}
return super.update(owner);
}
}
/*
Class: StunnedCondition
The creature cannot move or attack while stunned. Then it gets confused for a few turns
*/
export class StunnedCondition extends Condition {
constructor(nbTurns: number) {
super(ConditionType.STUNNED, nbTurns);
this.className = "StunnedCondition";
}
update(owner: Actor): boolean {
if (! super.update(owner)) {
if ( this.type === ConditionType.STUNNED) {
// after being stunned, wake up confused
this._type = ConditionType.CONFUSED;
this._time = Constants.AFTER_STUNNED_CONFUSION_DELAY;
} else {
return false;
}
}
return true;
}
}
/*
Class: DetectLifeCondition
Detect creatures through walls
*/
export class DetectLifeCondition extends Condition {
// above this range, creatures are not detected
private _range: number;
get range() { return this._range; }
constructor(nbTurns: number, range: number) {
super(ConditionType.DETECT_LIFE, nbTurns);
this.className = "DetectLifeCondition";
this._range = range;
}
}
/*
Class: FrozenCondition
The creature is slowed down
*/
export class FrozenCondition extends Condition {
private originalColor: Yendor.Color;
constructor(nbTurns: number) {
super(ConditionType.FROZEN, nbTurns);
this.className = "FrozenCondition";
}
onApply(owner: Actor) {
this.originalColor = owner.col;
owner.col = Constants.FROST_COLOR;
}
onRemove(owner: Actor) {
owner.col = this.originalColor;
}
update(owner: Actor): boolean {
var progress = (this._time - 1) / this._initialTime;
owner.col = Yendor.ColorUtils.add(Yendor.ColorUtils.multiply(Constants.FROST_COLOR, progress),
Yendor.ColorUtils.multiply(this.originalColor, 1 - progress));
return super.update(owner);
}
}
/********************************************************************************
* Group: effects
********************************************************************************/
/*
Interface: Effect
Some effect that can be applied to actors. The effect might be triggered by using an item or casting a spell.
*/
export interface Effect extends Persistent {
/*
Function: applyTo
Apply an effect to an actor
Parameters:
actor - the actor this effect is applied to
coef - a multiplicator to apply to the effect
Returns:
false if effect cannot be applied
*/
applyTo(actor: Actor, coef: number): boolean;
}
/*
Class: InstantHealthEffect
Add or remove health points.
*/
export class InstantHealthEffect implements Effect {
className: string;
private _amount: number;
private successMessage: string;
private failureMessage: string;
get amount() { return this._amount; }
constructor( amount: number = 0, successMessage?: string, failureMessage?: string) {
this.className = "InstantHealthEffect";
this._amount = amount;
this.successMessage = successMessage;
this.failureMessage = failureMessage;
}
applyTo(actor: Actor, coef: number = 1.0): boolean {
if (! actor.destructible ) {
return false;
}
if ( this._amount > 0 ) {
return this.applyHealingEffectTo(actor, coef);
} else {
return this.applyWoundingEffectTo(actor, coef);
}
return false;
}
private applyHealingEffectTo(actor: Actor, coef: number = 1.0): boolean {
var healPointsCount: number = actor.destructible.heal( coef * this._amount );
if ( healPointsCount > 0 && this.successMessage ) {
log(transformMessage(this.successMessage, actor, undefined, healPointsCount));
} else if ( healPointsCount <= 0 && this.failureMessage ) {
log(transformMessage(this.failureMessage, actor));
}
return true;
}
private applyWoundingEffectTo(actor: Actor, coef: number = 1.0) : boolean {
var realDefense: number = actor.destructible.computeRealDefense(actor);
var damageDealt = -this._amount * coef - realDefense;
if ( damageDealt > 0 && this.successMessage ) {
log(transformMessage(this.successMessage, actor, undefined, damageDealt));
} else if ( damageDealt <= 0 && this.failureMessage ) {
log(transformMessage(this.failureMessage, actor));
}
return actor.destructible.takeDamage(actor, -this._amount * coef) > 0;
}
}
/*
Class: TeleportEffect
Teleport the target at a random location.
*/
export class TeleportEffect implements Effect {
className: string;
private successMessage: string;
constructor(successMessage?: string) {
this.className = "TeleportEffect";
this.successMessage = successMessage;
}
applyTo(actor: Actor, coef: number = 1.0): boolean {
var x: number = Engine.instance.rng.getNumber(0, Engine.instance.map.width - 1);
var y: number = Engine.instance.rng.getNumber(0, Engine.instance.map.height - 1);
while (! Engine.instance.map.canWalk(x, y)) {
x++;
if ( x === Engine.instance.map.width ) {
x = 0;
y++;
if ( y === Engine.instance.map.height ) {
y = 0;
}
}
}
actor.moveTo(x, y);
if ( this.successMessage) {
log(transformMessage(this.successMessage, actor));
}
return true;
}
}
/*
Class: ConditionEffect
Add a condition to an actor.
*/
export class ConditionEffect implements Effect {
className: string;
private type: ConditionType;
private nbTurns: number;
private message: string;
private additionalArgs: ConditionAdditionalParam;
constructor( type: ConditionType, nbTurns: number, message?: string, additionalArgs?: ConditionAdditionalParam ) {
this.className = "ConditionEffect";
this.type = type;
this.nbTurns = nbTurns;
this.message = message;
if (additionalArgs) {
this.additionalArgs = additionalArgs;
}
}
applyTo(actor: Actor, coef: number = 1.0): boolean {
if (!actor.ai) {
return false;
}
actor.ai.addCondition(Condition.create(this.type, Math.floor(coef * this.nbTurns), this.additionalArgs),
actor);
if ( this.message ) {
log(transformMessage(this.message, actor));
}
return true;
}
}
export class MapRevealEffect implements Effect {
className: string;
constructor() {
this.className = "MapRevealEffect";
}
applyTo(actor: Actor, coef: number = 1.0): boolean {
if ( actor === Engine.instance.actorManager.getPlayer() ) {
Engine.instance.map.reveal();
return true;
}
return false;
}
}
/*
Class: Effector
Combines an effect and a target selector. Can also display a message before applying the effect.
*/
export class Effector implements Persistent {
className: string;
private _effect: Effect;
private targetSelector: TargetSelector;
private message: string;
private _coef: number;
private destroyOnEffect: boolean;
get effect() { return this._effect; }
get coef() { return this._coef; }
constructor(_effect?: Effect, _targetSelector?: TargetSelector, _message?: string, destroyOnEffect: boolean = false) {
this.className = "Effector";
this._effect = _effect;
this.targetSelector = _targetSelector;
this.message = _message;
this.destroyOnEffect = destroyOnEffect;
}
/*
Function: apply
Select targets and apply the effect.
Returns:
false if a tile needs to be selected (in that case, wait for TILE_SELECTED event, then call <applyOnPos>)
*/
apply(owner: Actor, wearer: Actor, cellPos?: Yendor.Position, coef: number = 1.0): boolean {
this._coef = coef;
if (this.targetSelector.selectTargets(owner, wearer, cellPos)) {
this.applyEffectToActorList(owner, wearer, this.targetSelector.__selectedTargets);
return true;
}
return false;
}
/*
Function: applyOnPos
Select targets and apply the effect once a tile has been selected.
Returns:
false if no target has been selected
*/
applyOnPos(owner: Actor, wearer: Actor, pos: Yendor.Position): boolean {
this.targetSelector.onTileSelected(pos);
if ( this.targetSelector.__selectedTargets.length > 0 ) {
this.applyEffectToActorList(owner, wearer, this.targetSelector.__selectedTargets);
return true;
} else {
return false;
}
}
private applyEffectToActorList(owner: Actor, wearer: Actor, actors: Actor[]) {
var success: boolean = false;
if ( this.message ) {
log(transformMessage(this.message, wearer));
}
for (var i: number = 0, len: number = actors.length; i < len; ++i) {
if (this._effect.applyTo(actors[i], this._coef)) {
success = true;
}
}
if ( this.destroyOnEffect && success && wearer && wearer.container ) {
wearer.container.remove( owner, wearer );
// actually remove actor from actorManager
}
}
}
}
| {
"content_hash": "974bd17322b92543a10d8beb8487a947",
"timestamp": "",
"source": "github",
"line_count": 553,
"max_line_length": 132,
"avg_line_length": 29.224231464737795,
"alnum_prop": 0.6726687704968752,
"repo_name": "mohsenil85/yendor.ts",
"id": "321f0d317d416d9c74066d81126be286ba82a684",
"size": "16161",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/game/effects.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "66"
},
{
"name": "HTML",
"bytes": "353"
},
{
"name": "JavaScript",
"bytes": "568435"
},
{
"name": "TypeScript",
"bytes": "274448"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.