code stringlengths 5 1.01M | repo_name stringlengths 5 84 | path stringlengths 4 311 | language stringclasses 30
values | license stringclasses 15
values | size int64 5 1.01M | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|
package nu.wasis.stunden.model;
import java.util.Collection;
import java.util.List;
import org.joda.time.DateTime;
import org.joda.time.Duration;
/**
* A day full of work.
*/
public class Day implements Comparable<Day> {
private final DateTime date;
private final List<Entry> entries;
/**
* Create a new {@link Day} object.
* @param date The date of this day. The exact time (hours, minutes etc.) of
* the used {@link DateTime} object are supposed to be ignored. Must
* not be <code>null</code>.
* @param entries A {@link List} of {@link Entry} objects that occured on
* this day. Must not be <code>null</code>.
*/
public Day(final DateTime date, final List<Entry> entries) {
if (null == date) {
throw new IllegalArgumentException("Param `date' must not be null.");
}
if (null == entries) {
throw new IllegalArgumentException("Param `entries' must not be null.");
}
this.date = new DateTime(date);
this.entries = entries;
}
public DateTime getDate() {
return new DateTime(date);
}
public List<Entry> getEntries() {
return entries;
}
/**
* Check if the {@link Day} is tagged with a tag.
* @param tag The tag to check.
* @return <code>true</code> if any of the {@link Entry}s of this day is
* tagged with the provided tag. Else <code>false</code>.
*/
public boolean isTagged(final String tag) {
for (final Entry entry : entries) {
if (entry.isTagged(tag)) {
return true;
}
}
return false;
}
/**
* Check if the {@link Day} is tagged with any of the provided tags.
* @param tags A collection of tags to be checked.
* @return <code>true</code> if any of the {@link Entry}s of this day is
* tagged with any of the provided tags. Else <code>false</code>.
*/
public boolean isTagged(final Collection<String> tags) {
for (final String tag : tags) {
if (isTagged(tag)) {
return true;
}
}
return false;
}
/**
* Get the total (billable) work duration for this {@link Day}.
*
* @return The sum of the (billable) work durations of all {@link Entry}s of
* this day. {@link Entry}s are skipped if their
* <code>isBreak</code> method returns <code>true</code>.
*/
public Duration getWorkDuration() {
Duration duration = new Duration(0);
for (final Entry entry : entries) {
if (!entry.isBreak()) {
duration = duration.plus(entry.getDuration());
}
}
return duration;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((date == null) ? 0 : date.hashCode());
return result;
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Day other = (Day) obj;
if (date == null) {
if (other.date != null) {
return false;
}
} else if (!date.equals(other.date)) {
return false;
}
return true;
}
@Override
public int compareTo(final Day other) {
return getDate().compareTo(other.getDate());
}
@Override
public String toString() {
return "Day [date=" + date + ", entries=" + entries + "]";
}
}
| sne11ius/stunden | src/main/java/nu/wasis/stunden/model/Day.java | Java | gpl-3.0 | 3,616 | [
30522,
7427,
16371,
1012,
2001,
2483,
1012,
24646,
25915,
1012,
2944,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
3074,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
2862,
1025,
12324,
8917,
1012,
8183,
2850,
1012,
2051,
1012,
3058,
7292,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
```R
HYB_subset<-subset(dataset, fly=="HYB")[,-c(1:3)]
ORE_subset<-subset(dataset, fly=="ORE")[,-c(1:3)]
SAM_subset<-subset(dataset, fly=="SAM")[,-c(1:3)]
HYB_dist<-vegdist(decostand(HYB_subset,"pa"),method="jaccard")
ORE_dist<-vegdist(decostand(ORE_subset,"pa"),method="jaccard")
SAM_dist<-vegdist(decostand(SAM_subset,"pa"),method="jaccard")
mantel(ORE_dist,HYB_dist,method="spearman",permutations=9999)
mantel(ORE_dist,SAM_dist,method="spearman",permutations=9999)
mantel(HYB_dist,SAM_dist,method="spearman",permutations=9999)
``` | ryanjw/ngs-3rdweek | visualizations/multivariate-tests/pairwise-mantel.md | Markdown | cc0-1.0 | 535 | [
30522,
1036,
1036,
1036,
1054,
1044,
2100,
2497,
1035,
16745,
1026,
30524,
1010,
1011,
1039,
1006,
1015,
1024,
1017,
1007,
1033,
10848,
1035,
16745,
1026,
1011,
16745,
1006,
2951,
13462,
1010,
4875,
1027,
1027,
1000,
10848,
1000,
1007,
1031... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<div class="uk-width-1-4@m">
<div class="uk-card uk-card-default uk-card-body uk-margin-large-bottom">
<h3 class="uk-panel-title">分类</h3>
<ul class="uk-list uk-list-line">
<li><a href="#">PHP</a></li>
<li><a href="#">Javascript</a></li>
</ul>
</div>
<div class="uk-card uk-card-default uk-card-body">
<h3 class="uk-panel-title">友情链接</h3>
<ul class="uk-list">
</ul>
</div>
</div> | ayermac/cblog | themes/index/inc/side.html | HTML | apache-2.0 | 478 | [
30522,
1026,
4487,
2615,
2465,
1027,
1000,
2866,
1011,
9381,
1011,
1015,
1011,
1018,
1030,
1049,
1000,
1028,
1026,
4487,
2615,
2465,
1027,
1000,
2866,
1011,
4003,
2866,
1011,
4003,
1011,
12398,
2866,
1011,
4003,
1011,
2303,
2866,
1011,
77... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (C) 2011 Andrew Turner
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
*
*/
/*
* Provide an implementation of __aeabi_unwind_cpp_pr{0,1,2}. These are
* required by libc but are implemented in libgcc_eh.a which we don't link
* against. The libgcc_eh.a version will be called so we call abort to
* check this.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: soc2013/dpl/head/lib/libc/arm/aeabi/aeabi_unwind_cpp.c 246856 2013-01-19 05:33:55Z andrew $");
#include <stdlib.h>
void __aeabi_unwind_cpp_pr0(void) __hidden;
void __aeabi_unwind_cpp_pr1(void) __hidden;
void __aeabi_unwind_cpp_pr2(void) __hidden;
void
__aeabi_unwind_cpp_pr0(void)
{
abort();
}
void
__aeabi_unwind_cpp_pr1(void)
{
abort();
}
void
__aeabi_unwind_cpp_pr2(void)
{
abort();
}
| dplbsd/soc2013 | head/lib/libc/arm/aeabi/aeabi_unwind_cpp.c | C | bsd-2-clause | 2,039 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2249,
4080,
6769,
1008,
2035,
2916,
9235,
1012,
1008,
1008,
25707,
1998,
2224,
1999,
3120,
1998,
12441,
3596,
1010,
2007,
2030,
2302,
1008,
14080,
1010,
2024,
7936,
3024,
2008,
1996,
2206,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#!/bin/bash
# Delete a user which was created for sftp access.
# Number of parameters passed is 1
# First parameter: Username
# Enable logging
LOG=/tmp/${0}.log
echo -e "\nCreate FTP User script started. Date: $(date)" >> ${LOG}
# Check for incorrect parameters passed
if [ ! "$#" -eq 1 ]; then
echo "Usage: ${0} username" 1>>${LOG} 2>&1
exit 1
fi
# Set the parameters for the script execution
USERNAME="${1}"
FTPBASE=/ftp/ftp_data
# Check for the username existence
if [ $(grep -c ${USERNAME} /etc/passwd) -ge 1 ]; then
echo "${USERNAME} exists and found in system passwd file." 1>>${LOG} 2>&1
userdel -fr ${USERNAME} 1>>${LOG} 2>&1
# Manually delete the user home directory, because it is mentioned as /uploads when created & it doesnt exist
rm -Rf ${FTPBASE}/${USERNAME} 1>>${LOG} 2>&1
else
# Check for the remains of the directory
if [ -d ${FTPBASE}/${USERNAME} ]; then
rm -Rf ${FTPBASE}/${USERNAME} 1>>${LOG} 2>&1
echo "${USERNAME} does not exist in the system passwd file. User home directory was found. Deleted now!" 1>>${LOG} 2>&1
fi
echo "Username does not exist" 1>>${LOG} 2>&1
exit 1
fi
| SurinderDhillon/shell-scripts | remove-ftpuser.sh | Shell | gpl-3.0 | 1,133 | [
30522,
1001,
999,
1013,
8026,
1013,
24234,
1001,
3972,
12870,
1037,
5310,
2029,
2001,
2580,
2005,
16420,
25856,
3229,
1012,
1001,
2193,
1997,
11709,
2979,
2003,
1015,
1001,
2034,
16381,
1024,
5310,
18442,
1001,
9585,
15899,
8833,
1027,
1013... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/****************************************************************************
**
** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
**
** This file is part of the tools applications of the Qt Toolkit.
**
** This file may be used under the terms of the GNU General Public
** License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Alternatively you may (at
** your option) use any later version of the GNU General Public
** License if such license has been publicly approved by Trolltech ASA
** (or its successors, if any) and the KDE Free Qt Foundation. In
** addition, as a special exception, Trolltech gives you certain
** additional rights. These rights are described in the Trolltech GPL
** Exception version 1.2, which can be found at
** http://www.trolltech.com/products/qt/gplexception/ and in the file
** GPL_EXCEPTION.txt in this package.
**
** Please review the following information to ensure GNU General
** Public Licensing requirements will be met:
** http://trolltech.com/products/qt/licenses/licensing/opensource/. If
** you are unsure which license is appropriate for your use, please
** review the following information:
** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
** or contact the sales department at sales@trolltech.com.
**
** In addition, as a special exception, Trolltech, as the sole
** copyright holder for Qt Designer, grants users of the Qt/Eclipse
** Integration plug-in the right for the Qt/Eclipse Integration to
** link to functionality provided by Qt Designer and its related
** libraries.
**
** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE. Trolltech reserves all rights not expressly
** granted herein.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
****************************************************************************/
/*
qscodemarker.cpp
*/
#include "node.h"
#include "qscodemarker.h"
QsCodeMarker::QsCodeMarker()
{
}
QsCodeMarker::~QsCodeMarker()
{
}
bool QsCodeMarker::recognizeCode( const QString& /* code */ )
{
return true;
}
bool QsCodeMarker::recognizeExtension( const QString& ext )
{
return ext == "js" || ext == "qs";
}
bool QsCodeMarker::recognizeLanguage( const QString& lang )
{
return lang == "JavaScript" || lang == "Qt Script";
}
QString QsCodeMarker::plainName( const Node *node )
{
QString name = node->name();
if ( node->type() == Node::Function )
name += "()";
return name;
}
QString QsCodeMarker::plainFullName( const Node *node, const Node * /* relative */ )
{
QString fullName;
for ( ;; ) {
fullName.prepend( plainName(node) );
if ( node->parent()->name().isEmpty() )
break;
node = node->parent();
fullName.prepend(".");
}
return fullName;
}
QString QsCodeMarker::markedUpCode( const QString& code,
const Node * /* relative */,
const QString& /* dirPath */ )
{
return protect( code );
}
QString QsCodeMarker::markedUpSynopsis( const Node *node,
const Node * /* relative */,
SynopsisStyle style )
{
QString synopsis;
QStringList extras;
QString name;
name = taggedNode( node );
if ( style != Detailed )
name = linkTag( node, name );
name = "<@name>" + name + "</@name>";
if ( style == Detailed && !node->parent()->name().isEmpty() &&
node->type() != Node::Enum )
name.prepend( taggedNode(node->parent()) + "." );
switch ( node->type() ) {
case Node::Class:
synopsis = "class " + name;
break;
case Node::Function:
{
const FunctionNode *func = (const FunctionNode *) node;
synopsis = name;
if ( style == SeparateList ) {
synopsis += "()";
} else {
synopsis += " (";
if ( !func->parameters().isEmpty() ) {
synopsis += " ";
int numOptional = 0;
QList<Parameter>::ConstIterator p = func->parameters().begin();
while ( p != func->parameters().end() ) {
if ( !(*p).defaultValue().isEmpty() ) {
if ( p == func->parameters().begin() ) {
synopsis += "[ ";
} else {
synopsis += " [ , ";
}
numOptional++;
} else {
if ( p != func->parameters().begin() )
synopsis += ", ";
}
if ( !(*p).name().isEmpty() )
synopsis += "<@param>" + protect( (*p).name() ) +
"</@param> : ";
synopsis += protect( (*p).leftType() );
++p;
}
for ( int i = 0; i < numOptional; i++ )
synopsis += " ]";
synopsis += " ";
}
synopsis += ")";
}
if ( style != SeparateList && !func->returnType().isEmpty() )
synopsis += " : " + protect( func->returnType() );
if ( style == Detailed && func->metaness() == FunctionNode::Signal )
extras << "[signal]";
}
break;
case Node::Property:
{
const PropertyNode *property = (const PropertyNode *) node;
synopsis = name;
if ( style != SeparateList )
synopsis += " : " + property->dataType();
if ( style == Detailed && property->setters().isEmpty() )
extras << "[read only]";
}
break;
case Node::Enum:
{
/*
The letters A to F and X (upper- and lower-case) can
appear in a hexadecimal constant (e.g. 0x3F).
*/
QRegExp letterRegExp( "[G-WYZg-wyz_]" );
const EnumNode *enume = (const EnumNode *) node;
synopsis = name;
if ( style == Summary && !enume->items().isEmpty() ) {
synopsis += " : ";
QString comma;
QList<EnumItem>::ConstIterator it = enume->items().begin();
while ( it != enume->items().end() ) {
if ( enume->itemAccess((*it).name()) == Node::Public ) {
synopsis += comma;
synopsis += (*it).name();
if ( (*it).value().indexOf(letterRegExp) != -1 )
synopsis += " = " + (*it).value();
comma = ", ";
}
++it;
}
}
}
break;
case Node::Namespace:
case Node::Typedef:
default:
synopsis = name;
}
if ( style == Summary ) {
if ( node->status() == Node::Preliminary ) {
extras << "(preliminary)";
} else if ( node->status() == Node::Deprecated ) {
extras << "(deprecated)";
} else if ( node->status() == Node::Obsolete ) {
extras << "(obsolete)";
}
}
QString extra;
if ( !extras.isEmpty() )
extra = "<@extra>" + extras.join(" ") + "</@extra>";
return synopsis + extra;
}
QString QsCodeMarker::markedUpName( const Node *node )
{
QString name = linkTag( node, taggedNode(node) );
if ( node->type() == Node::Function )
name += "()";
return name;
}
QString QsCodeMarker::markedUpFullName( const Node *node,
const Node * /* relative */ )
{
QString fullName;
for ( ;; ) {
fullName.prepend( markedUpName(node) );
if ( node->parent()->name().isEmpty() )
break;
node = node->parent();
fullName.prepend( "<@op>.</@op>" );
}
return fullName;
}
QString QsCodeMarker::markedUpEnumValue(const QString & /* enumValue */,
const Node * /* relative */)
{
return QString();
}
QString QsCodeMarker::markedUpIncludes( const QStringList& /* includes */ )
{
return QString();
}
QString QsCodeMarker::functionBeginRegExp( const QString& funcName )
{
return "^function[ \t].*\\b" + QRegExp::escape( funcName );
}
QString QsCodeMarker::functionEndRegExp( const QString& /* funcName */ )
{
return "^}";
}
QList<Section> QsCodeMarker::sections( const InnerNode *inner, SynopsisStyle style, Status status )
{
QList<Section> sections;
if (inner->type() != Node::Class)
return sections;
const ClassNode *classe = static_cast<const ClassNode *>(inner);
if ( style == Summary ) {
FastSection enums(classe, "Enums", "enum", "enums");
FastSection functions(classe, "Functions", "function", "functions");
FastSection readOnlyProperties(classe, "Read-Only Properties", "property", "properties");
FastSection signalz(classe, "Signals", "signal", "signals");
FastSection writableProperties(classe, "Writable Properties", "property", "properties");
QStack<const ClassNode *> stack;
stack.push( classe );
while ( !stack.isEmpty() ) {
const ClassNode *ancestorClass = stack.pop();
NodeList::ConstIterator c = ancestorClass->childNodes().begin();
while ( c != ancestorClass->childNodes().end() ) {
if ( (*c)->access() == Node::Public ) {
if ( (*c)->type() == Node::Enum ) {
insert( enums, *c, style, status );
} else if ( (*c)->type() == Node::Function ) {
const FunctionNode *func = (const FunctionNode *) *c;
if ( func->metaness() == FunctionNode::Signal ) {
insert( signalz, *c, style, status );
} else {
insert( functions, *c, style, status );
}
} else if ( (*c)->type() == Node::Property ) {
const PropertyNode *property =
(const PropertyNode *) *c;
if ( property->setters().isEmpty() ) {
insert( readOnlyProperties, *c, style, status );
} else {
insert( writableProperties, *c, style, status );
}
}
}
++c;
}
QList<RelatedClass>::ConstIterator r = ancestorClass->baseClasses().begin();
while ( r != ancestorClass->baseClasses().end() ) {
stack.prepend( (*r).node );
++r;
}
}
append( sections, enums );
append( sections, writableProperties );
append( sections, readOnlyProperties );
append( sections, functions );
append( sections, signalz );
} else if ( style == Detailed ) {
FastSection enums( classe, "Enum Documentation" );
FastSection functionsAndSignals( classe, "Function and Signal Documentation" );
FastSection properties( classe, "Property Documentation" );
NodeList::ConstIterator c = classe->childNodes().begin();
while ( c != classe->childNodes().end() ) {
if ( (*c)->access() == Node::Public ) {
if ( (*c)->type() == Node::Enum ) {
insert( enums, *c, style, status );
} else if ( (*c)->type() == Node::Function ) {
insert( functionsAndSignals, *c, style, status );
} else if ( (*c)->type() == Node::Property ) {
insert( properties, *c, style, status );
}
}
++c;
}
append( sections, enums );
append( sections, properties );
append( sections, functionsAndSignals );
} else { // ( style == SeparateList )
FastSection all( classe );
QStack<const ClassNode *> stack;
stack.push( classe );
while ( !stack.isEmpty() ) {
const ClassNode *ancestorClass = stack.pop();
NodeList::ConstIterator c = ancestorClass->childNodes().begin();
while ( c != ancestorClass->childNodes().end() ) {
if ( (*c)->access() == Node::Public )
insert( all, *c, style, status );
++c;
}
QList<RelatedClass>::ConstIterator r = ancestorClass->baseClasses().begin();
while ( r != ancestorClass->baseClasses().end() ) {
stack.prepend( (*r).node );
++r;
}
}
append( sections, all );
}
return sections;
}
const Node *QsCodeMarker::resolveTarget( const QString& /* target */,
const Tree * /* tree */,
const Node * /* relative */ )
{
return 0;
}
| muromec/qtopia-ezx | qtopiacore/qt/tools/qdoc3/qscodemarker.cpp | C++ | gpl-2.0 | 11,397 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/*
* Loader: description.
*
* @package Avant
*/
namespace Avant\Core;
require(ROOT . CORE_DIR . '/autoloader.php');
use Avant\Core\Load_Theme;
use Avant\Core\Mopo;
class Loader
{
use Utilities\Inflector;
use Utilities\Request;
public function __construct()
{
$this->createQuery();
$this->setUrl();
$this->loadFunctions();
$this->loadDatabase();
$this->loadLanguages();
$this->loadTheme();
}
private function createQuery()
{
$params = $this->request('params');
if (isset($params)) {
foreach ($params as $key => $param) {
if (!empty($param)) {
if ($key == 0) {
$GLOBALS['avant']['page'] = $param;
} else {
$GLOBALS['avant']['query_params'][] = $param;
}
}
}
}
}
private function setUrl()
{
$GLOBALS['avant']['url'] = $this->request('url');
}
private function loadLanguages()
{
new Mopo();
}
private function loadFunctions()
{
include ROOT . CORE_DIR . DS . 'functions/misc.php';
include ROOT . CORE_DIR . DS . 'functions/themes.php';
include ROOT . CORE_DIR . DS . 'functions/l10n.php';
}
private function loadDatabase()
{
include ROOT . CORE_DIR . DS . 'utilities/avdb.php';
$avdbObj = new \avdb();
if ($avdbObj->checkDatabaseIsActive()) {
$GLOBALS['avdb'] = $avdbObj;
} else {
$GLOBALS['avdb'] = 'Database is not defined';
}
}
private function loadTheme()
{
if (defined('THEME') && THEME != "") {
define('THEME_PATH', ROOT . THEMES_DIR . DS . THEME . DS);
} else {
define('THEME_PATH', ROOT . THEMES_DIR . DS . 'default' . DS);
}
if (is_readable(THEME_PATH . 'index.php')) {
new Load_Theme($this->request());
} else if (DEBUG) {
die("The theme configured doesn't exist or <strong>index.php</strong> file is missing.");
} else {
die();
}
}
}
new Loader();
| mariovalney/The-Proxy | core/loader.php | PHP | apache-2.0 | 2,278 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
7170,
2121,
1024,
6412,
1012,
1008,
1008,
1030,
7427,
14815,
1008,
1013,
3415,
15327,
14815,
1032,
4563,
1025,
5478,
1006,
7117,
1012,
4563,
1035,
16101,
1012,
1005,
1013,
8285,
11066,
2121,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* { dg-do compile } */
/* { dg-options "-mavx512f -O2" } */
/* { dg-final { scan-assembler-times "vpmovzxbq\[ \\t\]+\[^\n\]*%xmm\[0-9\]\[^\n\]*%zmm\[0-9\]\[^\{\]" 1 } } */
/* { dg-final { scan-assembler-times "vpmovzxbq\[ \\t\]+\[^\n\]*%xmm\[0-9\]\[^\n\]*%zmm\[0-9\]\{%k\[1-7\]\}\[^\{\]" 1 } } */
/* { dg-final { scan-assembler-times "vpmovzxbq\[ \\t\]+\[^\n\]*%xmm\[0-9\]\[^\n\]*%zmm\[0-9\]\{%k\[1-7\]\}\{z\}" 1 } } */
#include <immintrin.h>
volatile __m128i s;
volatile __m512i res;
volatile __mmask8 m;
void extern
avx512f_test (void)
{
res = _mm512_cvtepu8_epi64 (s);
res = _mm512_mask_cvtepu8_epi64 (res, m, s);
res = _mm512_maskz_cvtepu8_epi64 (m, s);
}
| periclesroalves/gcc-conair | gcc/testsuite/gcc.target/i386/avx512f-vpmovzxbq-1.c | C | gpl-2.0 | 670 | [
30522,
1013,
1008,
1063,
1040,
2290,
1011,
2079,
4012,
22090,
1065,
1008,
1013,
1013,
1008,
1063,
1040,
2290,
1011,
7047,
1000,
1011,
5003,
2615,
2595,
22203,
2475,
2546,
1011,
1051,
2475,
1000,
1065,
1008,
1013,
1013,
1008,
1063,
1040,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
---
layout: page
title: Pride Solutions Conference
date: 2016-05-24
author: Carl Mccarty
tags: weekly links, java
status: published
summary: Curabitur ipsum ante, aliquam sit.
banner: images/banner/office-01.jpg
booking:
startDate: 05/26/2016
endDate: 05/31/2016
ctyhocn: LITWTHX
groupCode: PSC
published: true
---
Cras vitae ullamcorper libero, id laoreet lacus. Praesent sed ligula suscipit, interdum nulla in, blandit ipsum. Nunc sem massa, posuere ut tellus et, tempus consectetur erat. Suspendisse potenti. Etiam ultricies nunc sit amet congue vestibulum. Pellentesque vehicula tristique tellus, sed pellentesque risus fringilla eget. Nullam id malesuada ligula. Praesent ante nibh, accumsan non urna vel, molestie condimentum justo. Ut feugiat ligula vitae odio mattis, at facilisis neque ultricies. In sagittis ante justo, eu ornare nibh rhoncus non. Ut vel ligula nec est maximus gravida non nec massa. Sed placerat orci sed lacus tristique dictum. Sed id ipsum cursus, lacinia ligula id, scelerisque nibh. Nullam fringilla mi metus, a rutrum tortor aliquam in. Sed et nibh vulputate, iaculis nulla id, auctor mi. Integer elit dui, eleifend eget diam commodo, sagittis vestibulum magna.
* Aenean luctus metus in quam elementum, vitae mollis augue ornare
* Praesent eget ipsum accumsan, scelerisque ex id, pharetra quam.
Aenean tempor sollicitudin aliquet. Ut interdum ex et mauris finibus tempus. Aliquam erat volutpat. Morbi mollis laoreet elit, at iaculis lectus iaculis ut. Donec rutrum volutpat purus, sed pretium urna feugiat a. Mauris porta feugiat ligula, eget posuere tellus vehicula vel. Sed commodo eros eget ante sollicitudin, id pretium enim consequat. Duis sed ex sit amet elit venenatis consequat. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Etiam gravida nisl quis nisl porta, ut malesuada lacus iaculis. Proin suscipit orci id dolor mattis, ac mollis ligula placerat. Curabitur facilisis nibh odio, eu vulputate nulla congue et. Quisque dolor dolor, accumsan et vestibulum a, suscipit nec felis.
| KlishGroup/prose-pogs | pogs/L/LITWTHX/PSC/index.md | Markdown | mit | 2,072 | [
30522,
1011,
1011,
1011,
9621,
1024,
3931,
2516,
1024,
6620,
7300,
3034,
3058,
1024,
2355,
1011,
5709,
1011,
2484,
3166,
1024,
5529,
23680,
23871,
22073,
1024,
4882,
6971,
1010,
9262,
3570,
1024,
2405,
12654,
1024,
12731,
2527,
16313,
3126,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System.ComponentModel;
namespace LinqAn.Google.Dimensions
{
/// <summary>
/// DCM creative type name of the DCM click matching the Google Analytics session (premium only).
/// </summary>
[Description("DCM creative type name of the DCM click matching the Google Analytics session (premium only).")]
public class DcmClickCreativeType: Dimension
{
/// <summary>
/// Instantiates a <seealso cref="DcmClickCreativeType" />.
/// </summary>
public DcmClickCreativeType(): base("DFA Creative Type (GA Model)",false,"ga:dcmClickCreativeType")
{
}
}
}
| kenshinthebattosai/LinqAn.Google | src/LinqAn.Google/Dimensions/DcmClickCreativeType.cs | C# | mit | 575 | [
30522,
2478,
2291,
1012,
6922,
5302,
9247,
1025,
3415,
15327,
11409,
19062,
2078,
1012,
8224,
1012,
9646,
1063,
1013,
1013,
1013,
1026,
12654,
1028,
1013,
1013,
1013,
5887,
2213,
5541,
2828,
2171,
1997,
1996,
5887,
2213,
11562,
9844,
1996,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#include "ampi_base.h"
#include <sstream>
#include <ostream>
#include "ampi.h"
#include "mpi.h"
/**
* @brief AMPI_base::AMPI_base Initilize the class
*/
AMPI_base::AMPI_base(){
rParam=false;
valid=true;
}
/**
* @brief AMPI_base::AMPI_typeName This function is to be used by AMPI for
* transmitting, receiving, and handling type names. It serves as a unique
* identify for the class, and is required to be rewriten for inherited classes
* @return The name of the class
*/
char* AMPI_base::AMPI_typeName(){
return "AMPI_base";
}
/**
* @brief AMPI_base::AMPI_locked this optional function is called when the class
* has been transmitted and it will be modified by another machine.
*/
void AMPI_base::AMPI_locked() {
return;
}
/**
* @brief AMPI_base::AMPI_unlocked this optional function is called when the
* class has been returned from a remote function call.
*/
void AMPI_base::AMPI_unlocked() {
return;
}
/**
* @brief AMPI_base::AMPI_send This is called by AMPI to send data from
* the class to new copy on another machine. This can be left alone if using
* AMPI_base::AMPI_input, however it is left virtual so advaced users may use
* this function and MPI_Send to send the data more efficietly
* @param dest The destination to be sent to
* @param tag The MPI tag to send with
* @param comm the MPI communicant
* @return
*/
int AMPI_base::AMPI_send(int dest, int tag, MPI_Comm comm){
char *buf;
int size;
buf = AMPI_output(&size);
MPI_Send(&size,1,MPI_INT,dest,AMPI::AMPI_TAG_SIZE, comm);
MPI_Send(buf,size,MPI_CHAR,dest,tag,comm);
return 0;
}
/**
* @brief AMPI_base::AMPI_recv This is called by AMPI to receive new data from
* another class on another machine. this can be left alone if using
* AMPI_base::AMPI_input, however it is left virtual so advanced users my use
* this function and MPI_Recv to recive the data more efficently
* @param source The source of the data
* @param tag The MPI tag that to receive from
* @param comm The MPI communicant
* @param status Pointer to an external status variable
* @return
*/
int AMPI_base::AMPI_recv(int source, int tag, MPI_Comm comm,
MPI_Status *status){
int size;
MPI_Recv(&size,1,MPI_INT,source,AMPI::AMPI_TAG_SIZE,comm,status);
char *buf = new char[size];
MPI_Recv(buf,size,MPI_CHAR,source,tag,comm,status);
AMPI_input(buf,size);
return 0;
}
/**
* @brief AMPI_base::AMPI_input This function is called by the default
* AMPI_base::AMPI_recv function to convert the character array received into
* the inherited class's data format. Rewriting this function in the inherited
* class is required unless using AMPI_base::AMPI_recv, however it should be
* nearly identical to a function to read the class froma file.
* @param buf The character array to read from
* @param size the size of the array
*/
void AMPI_base::AMPI_input(char *buf, int size){
return;
}
/**
* @brief AMPI_base::AMPI_output This function is called by the default
* AMPI_base::AMPI_send function to convert the inherted class's data format to
* a character array. Rewirting this function in the inherited class is
* required unless using AMPI_base::AMPI_recv, however it should be nearly
* identicle to a function to write the class to a file.
* @param size pointer to and integer to store the size of the character array
* @return the character array
*/
char* AMPI_base::AMPI_output(int *size){
return "NULL";
}
/**
* @brief AMPI_base::AMPI_returnParameter setting rP to true indecates to AMPI
* that the class will be modified during a remote call and need to be sent back
* @param rP
* @return
*/
bool AMPI_base::AMPI_returnParameter(bool rP){
rParam=rP;
return AMPI_returnParameter();
}
/**
* @brief AMPI_base::AMPI_returnParameter this indecates weather or not the
* class will be returned after a remote call
* @return true if the class will be returned
*/
bool AMPI_base::AMPI_returnParameter(){
return rParam;
}
void AMPI_base::Validate(){
valid=false;
AMPI_locked();
}
void AMPI_base::deValidate(){
valid=true;
AMPI_unlocked();
}
/**
* @brief AMPI_base::AMPI_debug this function is used for debuging AMPI
* it is not need for applications.
*/
void AMPI_base::AMPI_debug(){
std::cerr << AMPI_typeName()
<< ": "
<< rParam << valid << "\n";
}
| PJMack/AMPI | ampi_base.cpp | C++ | gpl-2.0 | 4,404 | [
30522,
1001,
2421,
1000,
23713,
2072,
1035,
2918,
1012,
1044,
1000,
1001,
2421,
1026,
7020,
25379,
1028,
1001,
2421,
1026,
9808,
25379,
1028,
1001,
2421,
1000,
23713,
2072,
1012,
1044,
1000,
1001,
2421,
1000,
6131,
2072,
1012,
1044,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
class LoginForm extends YFormModel
{
public $email;
public $password;
public $remember_me;
public $verifyCode;
private $_identity;
public function rules()
{
$module = Yii::app()->getModule('user');
return array(
array('email, password', 'required'),
array('email', 'email'),
array('remember_me','boolean'),
array('verifyCode', 'YRequiredValidator', 'allowEmpty' => !$module->showCaptcha || !CCaptcha::checkRequirements(), 'message' => Yii::t('UserModule.user', 'Код проверки не корректен.'), 'on' => 'loginLimit'),
array('verifyCode', 'captcha', 'allowEmpty' => !$module->showCaptcha || !CCaptcha::checkRequirements(), 'on' => 'loginLimit'),
array('verifyCode', 'emptyOnInvalid'),
array('password', 'authenticate'),
);
}
public function attributeLabels()
{
return array(
'email' => Yii::t('UserModule.user', 'Email'),
'password' => Yii::t('UserModule.user', 'Пароль'),
'remember_me'=> Yii::t('UserModule.user', 'Запомнить меня'),
'verifyCode' => Yii::t('UserModule.user', 'Код проверки'),
);
}
public function attributeDescriptions()
{
return array(
'email' => Yii::t('UserModule.user', 'Email'),
'password' => Yii::t('UserModule.user', 'Пароль'),
'remember_me'=> Yii::t('UserModule.user', 'Запомнить меня'),
'verifyCode' => Yii::t('UserModule.user', 'Код проверки'),
);
}
public function authenticate()
{
if (!$this->hasErrors())
{
$this->_identity = new UserIdentity($this->email, $this->password);
$duration = 0;
if($this->remember_me)
{
$sessionTimeInWeeks = (int)Yii::app()->getModule('user')->sessionLifeTime;
$duration = $sessionTimeInWeeks*24*60*60;
}
if (!$this->_identity->authenticate())
$this->addError('password', Yii::t('UserModule.user', 'Email или пароль введены неверно!'));
else
Yii::app()->user->login($this->_identity, $duration);
$this->verifyCode = null;
}
}
/**
* Обнуляем введённое значение капчи, если оно введено неверно:
*
* @param string $attribute - имя атрибута
* @param mixed $params - параметры
*
* @return void
**/
public function emptyOnInvalid($attribute, $params)
{
if ($this->hasErrors())
$this->verifyCode = null;
}
} | itrustam/yode | protected/modules/user2/forms/LoginForm.php | PHP | bsd-3-clause | 2,824 | [
30522,
1026,
1029,
25718,
2465,
8833,
2378,
14192,
8908,
1061,
14192,
5302,
9247,
1063,
2270,
1002,
10373,
1025,
2270,
1002,
20786,
1025,
2270,
1002,
3342,
1035,
2033,
1025,
2270,
1002,
20410,
16044,
1025,
2797,
1002,
1035,
4767,
1025,
2270... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#ifndef KVM_UNIFDEF_H
#define KVM_UNIFDEF_H
#ifdef __i386__
#ifndef CONFIG_X86_32
#define CONFIG_X86_32 1
#endif
#endif
#ifdef __x86_64__
#ifndef CONFIG_X86_64
#define CONFIG_X86_64 1
#endif
#endif
#if defined(__i386__) || defined (__x86_64__)
#ifndef CONFIG_X86
#define CONFIG_X86 1
#endif
#endif
#ifdef __PPC__
#ifndef CONFIG_PPC
#define CONFIG_PPC 1
#endif
#endif
#ifdef __s390__
#ifndef CONFIG_S390
#define CONFIG_S390 1
#endif
#endif
#endif
/*
* vmx.h: VMX Architecture related definitions
* Copyright (c) 2004, Intel Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
* Place - Suite 330, Boston, MA 02111-1307 USA.
*
* A few random additions are:
* Copyright (C) 2006 Qumranet
* Avi Kivity <avi@qumranet.com>
* Yaniv Kamay <yaniv@qumranet.com>
*
*/
#ifndef VMX_H
#define VMX_H
#include <linux/types.h>
#include <uapi/asm/vmx.h>
/*
* Definitions of Primary Processor-Based VM-Execution Controls.
*/
#define CPU_BASED_VIRTUAL_INTR_PENDING 0x00000004
#define CPU_BASED_USE_TSC_OFFSETING 0x00000008
#define CPU_BASED_HLT_EXITING 0x00000080
#define CPU_BASED_INVLPG_EXITING 0x00000200
#define CPU_BASED_MWAIT_EXITING 0x00000400
#define CPU_BASED_RDPMC_EXITING 0x00000800
#define CPU_BASED_RDTSC_EXITING 0x00001000
#define CPU_BASED_CR3_LOAD_EXITING 0x00008000
#define CPU_BASED_CR3_STORE_EXITING 0x00010000
#define CPU_BASED_CR8_LOAD_EXITING 0x00080000
#define CPU_BASED_CR8_STORE_EXITING 0x00100000
#define CPU_BASED_TPR_SHADOW 0x00200000
#define CPU_BASED_VIRTUAL_NMI_PENDING 0x00400000
#define CPU_BASED_MOV_DR_EXITING 0x00800000
#define CPU_BASED_UNCOND_IO_EXITING 0x01000000
#define CPU_BASED_USE_IO_BITMAPS 0x02000000
#define CPU_BASED_USE_MSR_BITMAPS 0x10000000
#define CPU_BASED_MONITOR_EXITING 0x20000000
#define CPU_BASED_PAUSE_EXITING 0x40000000
#define CPU_BASED_ACTIVATE_SECONDARY_CONTROLS 0x80000000
/*
* Definitions of Secondary Processor-Based VM-Execution Controls.
*/
#define SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES 0x00000001
#define SECONDARY_EXEC_ENABLE_EPT 0x00000002
#define SECONDARY_EXEC_RDTSCP 0x00000008
#define SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE 0x00000010
#define SECONDARY_EXEC_ENABLE_VPID 0x00000020
#define SECONDARY_EXEC_WBINVD_EXITING 0x00000040
#define SECONDARY_EXEC_UNRESTRICTED_GUEST 0x00000080
#define SECONDARY_EXEC_APIC_REGISTER_VIRT 0x00000100
#define SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY 0x00000200
#define SECONDARY_EXEC_PAUSE_LOOP_EXITING 0x00000400
#define SECONDARY_EXEC_ENABLE_INVPCID 0x00001000
#define SECONDARY_EXEC_SHADOW_VMCS 0x00004000
#define PIN_BASED_EXT_INTR_MASK 0x00000001
#define PIN_BASED_NMI_EXITING 0x00000008
#define PIN_BASED_VIRTUAL_NMIS 0x00000020
#define PIN_BASED_VMX_PREEMPTION_TIMER 0x00000040
#define PIN_BASED_POSTED_INTR 0x00000080
#define PIN_BASED_ALWAYSON_WITHOUT_TRUE_MSR 0x00000016
#define VM_EXIT_SAVE_DEBUG_CONTROLS 0x00000002
#define VM_EXIT_HOST_ADDR_SPACE_SIZE 0x00000200
#define VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL 0x00001000
#define VM_EXIT_ACK_INTR_ON_EXIT 0x00008000
#define VM_EXIT_SAVE_IA32_PAT 0x00040000
#define VM_EXIT_LOAD_IA32_PAT 0x00080000
#define VM_EXIT_SAVE_IA32_EFER 0x00100000
#define VM_EXIT_LOAD_IA32_EFER 0x00200000
#define VM_EXIT_SAVE_VMX_PREEMPTION_TIMER 0x00400000
#define VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR 0x00036dff
#define VM_ENTRY_LOAD_DEBUG_CONTROLS 0x00000002
#define VM_ENTRY_IA32E_MODE 0x00000200
#define VM_ENTRY_SMM 0x00000400
#define VM_ENTRY_DEACT_DUAL_MONITOR 0x00000800
#define VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL 0x00002000
#define VM_ENTRY_LOAD_IA32_PAT 0x00004000
#define VM_ENTRY_LOAD_IA32_EFER 0x00008000
#define VM_ENTRY_ALWAYSON_WITHOUT_TRUE_MSR 0x000011ff
#define VMX_MISC_PREEMPTION_TIMER_RATE_MASK 0x0000001f
#define VMX_MISC_SAVE_EFER_LMA 0x00000020
/* VMCS Encodings */
enum vmcs_field {
VIRTUAL_PROCESSOR_ID = 0x00000000,
POSTED_INTR_NV = 0x00000002,
GUEST_ES_SELECTOR = 0x00000800,
GUEST_CS_SELECTOR = 0x00000802,
GUEST_SS_SELECTOR = 0x00000804,
GUEST_DS_SELECTOR = 0x00000806,
GUEST_FS_SELECTOR = 0x00000808,
GUEST_GS_SELECTOR = 0x0000080a,
GUEST_LDTR_SELECTOR = 0x0000080c,
GUEST_TR_SELECTOR = 0x0000080e,
GUEST_INTR_STATUS = 0x00000810,
HOST_ES_SELECTOR = 0x00000c00,
HOST_CS_SELECTOR = 0x00000c02,
HOST_SS_SELECTOR = 0x00000c04,
HOST_DS_SELECTOR = 0x00000c06,
HOST_FS_SELECTOR = 0x00000c08,
HOST_GS_SELECTOR = 0x00000c0a,
HOST_TR_SELECTOR = 0x00000c0c,
IO_BITMAP_A = 0x00002000,
IO_BITMAP_A_HIGH = 0x00002001,
IO_BITMAP_B = 0x00002002,
IO_BITMAP_B_HIGH = 0x00002003,
MSR_BITMAP = 0x00002004,
MSR_BITMAP_HIGH = 0x00002005,
VM_EXIT_MSR_STORE_ADDR = 0x00002006,
VM_EXIT_MSR_STORE_ADDR_HIGH = 0x00002007,
VM_EXIT_MSR_LOAD_ADDR = 0x00002008,
VM_EXIT_MSR_LOAD_ADDR_HIGH = 0x00002009,
VM_ENTRY_MSR_LOAD_ADDR = 0x0000200a,
VM_ENTRY_MSR_LOAD_ADDR_HIGH = 0x0000200b,
TSC_OFFSET = 0x00002010,
TSC_OFFSET_HIGH = 0x00002011,
VIRTUAL_APIC_PAGE_ADDR = 0x00002012,
VIRTUAL_APIC_PAGE_ADDR_HIGH = 0x00002013,
APIC_ACCESS_ADDR = 0x00002014,
APIC_ACCESS_ADDR_HIGH = 0x00002015,
POSTED_INTR_DESC_ADDR = 0x00002016,
POSTED_INTR_DESC_ADDR_HIGH = 0x00002017,
EPT_POINTER = 0x0000201a,
EPT_POINTER_HIGH = 0x0000201b,
EOI_EXIT_BITMAP0 = 0x0000201c,
EOI_EXIT_BITMAP0_HIGH = 0x0000201d,
EOI_EXIT_BITMAP1 = 0x0000201e,
EOI_EXIT_BITMAP1_HIGH = 0x0000201f,
EOI_EXIT_BITMAP2 = 0x00002020,
EOI_EXIT_BITMAP2_HIGH = 0x00002021,
EOI_EXIT_BITMAP3 = 0x00002022,
EOI_EXIT_BITMAP3_HIGH = 0x00002023,
VMREAD_BITMAP = 0x00002026,
VMWRITE_BITMAP = 0x00002028,
GUEST_PHYSICAL_ADDRESS = 0x00002400,
GUEST_PHYSICAL_ADDRESS_HIGH = 0x00002401,
VMCS_LINK_POINTER = 0x00002800,
VMCS_LINK_POINTER_HIGH = 0x00002801,
GUEST_IA32_DEBUGCTL = 0x00002802,
GUEST_IA32_DEBUGCTL_HIGH = 0x00002803,
GUEST_IA32_PAT = 0x00002804,
GUEST_IA32_PAT_HIGH = 0x00002805,
GUEST_IA32_EFER = 0x00002806,
GUEST_IA32_EFER_HIGH = 0x00002807,
GUEST_IA32_PERF_GLOBAL_CTRL = 0x00002808,
GUEST_IA32_PERF_GLOBAL_CTRL_HIGH= 0x00002809,
GUEST_PDPTR0 = 0x0000280a,
GUEST_PDPTR0_HIGH = 0x0000280b,
GUEST_PDPTR1 = 0x0000280c,
GUEST_PDPTR1_HIGH = 0x0000280d,
GUEST_PDPTR2 = 0x0000280e,
GUEST_PDPTR2_HIGH = 0x0000280f,
GUEST_PDPTR3 = 0x00002810,
GUEST_PDPTR3_HIGH = 0x00002811,
HOST_IA32_PAT = 0x00002c00,
HOST_IA32_PAT_HIGH = 0x00002c01,
HOST_IA32_EFER = 0x00002c02,
HOST_IA32_EFER_HIGH = 0x00002c03,
HOST_IA32_PERF_GLOBAL_CTRL = 0x00002c04,
HOST_IA32_PERF_GLOBAL_CTRL_HIGH = 0x00002c05,
PIN_BASED_VM_EXEC_CONTROL = 0x00004000,
CPU_BASED_VM_EXEC_CONTROL = 0x00004002,
EXCEPTION_BITMAP = 0x00004004,
PAGE_FAULT_ERROR_CODE_MASK = 0x00004006,
PAGE_FAULT_ERROR_CODE_MATCH = 0x00004008,
CR3_TARGET_COUNT = 0x0000400a,
VM_EXIT_CONTROLS = 0x0000400c,
VM_EXIT_MSR_STORE_COUNT = 0x0000400e,
VM_EXIT_MSR_LOAD_COUNT = 0x00004010,
VM_ENTRY_CONTROLS = 0x00004012,
VM_ENTRY_MSR_LOAD_COUNT = 0x00004014,
VM_ENTRY_INTR_INFO_FIELD = 0x00004016,
VM_ENTRY_EXCEPTION_ERROR_CODE = 0x00004018,
VM_ENTRY_INSTRUCTION_LEN = 0x0000401a,
TPR_THRESHOLD = 0x0000401c,
SECONDARY_VM_EXEC_CONTROL = 0x0000401e,
PLE_GAP = 0x00004020,
PLE_WINDOW = 0x00004022,
VM_INSTRUCTION_ERROR = 0x00004400,
VM_EXIT_REASON = 0x00004402,
VM_EXIT_INTR_INFO = 0x00004404,
VM_EXIT_INTR_ERROR_CODE = 0x00004406,
IDT_VECTORING_INFO_FIELD = 0x00004408,
IDT_VECTORING_ERROR_CODE = 0x0000440a,
VM_EXIT_INSTRUCTION_LEN = 0x0000440c,
VMX_INSTRUCTION_INFO = 0x0000440e,
GUEST_ES_LIMIT = 0x00004800,
GUEST_CS_LIMIT = 0x00004802,
GUEST_SS_LIMIT = 0x00004804,
GUEST_DS_LIMIT = 0x00004806,
GUEST_FS_LIMIT = 0x00004808,
GUEST_GS_LIMIT = 0x0000480a,
GUEST_LDTR_LIMIT = 0x0000480c,
GUEST_TR_LIMIT = 0x0000480e,
GUEST_GDTR_LIMIT = 0x00004810,
GUEST_IDTR_LIMIT = 0x00004812,
GUEST_ES_AR_BYTES = 0x00004814,
GUEST_CS_AR_BYTES = 0x00004816,
GUEST_SS_AR_BYTES = 0x00004818,
GUEST_DS_AR_BYTES = 0x0000481a,
GUEST_FS_AR_BYTES = 0x0000481c,
GUEST_GS_AR_BYTES = 0x0000481e,
GUEST_LDTR_AR_BYTES = 0x00004820,
GUEST_TR_AR_BYTES = 0x00004822,
GUEST_INTERRUPTIBILITY_INFO = 0x00004824,
GUEST_ACTIVITY_STATE = 0X00004826,
GUEST_SYSENTER_CS = 0x0000482A,
VMX_PREEMPTION_TIMER_VALUE = 0x0000482E,
HOST_IA32_SYSENTER_CS = 0x00004c00,
CR0_GUEST_HOST_MASK = 0x00006000,
CR4_GUEST_HOST_MASK = 0x00006002,
CR0_READ_SHADOW = 0x00006004,
CR4_READ_SHADOW = 0x00006006,
CR3_TARGET_VALUE0 = 0x00006008,
CR3_TARGET_VALUE1 = 0x0000600a,
CR3_TARGET_VALUE2 = 0x0000600c,
CR3_TARGET_VALUE3 = 0x0000600e,
EXIT_QUALIFICATION = 0x00006400,
GUEST_LINEAR_ADDRESS = 0x0000640a,
GUEST_CR0 = 0x00006800,
GUEST_CR3 = 0x00006802,
GUEST_CR4 = 0x00006804,
GUEST_ES_BASE = 0x00006806,
GUEST_CS_BASE = 0x00006808,
GUEST_SS_BASE = 0x0000680a,
GUEST_DS_BASE = 0x0000680c,
GUEST_FS_BASE = 0x0000680e,
GUEST_GS_BASE = 0x00006810,
GUEST_LDTR_BASE = 0x00006812,
GUEST_TR_BASE = 0x00006814,
GUEST_GDTR_BASE = 0x00006816,
GUEST_IDTR_BASE = 0x00006818,
GUEST_DR7 = 0x0000681a,
GUEST_RSP = 0x0000681c,
GUEST_RIP = 0x0000681e,
GUEST_RFLAGS = 0x00006820,
GUEST_PENDING_DBG_EXCEPTIONS = 0x00006822,
GUEST_SYSENTER_ESP = 0x00006824,
GUEST_SYSENTER_EIP = 0x00006826,
HOST_CR0 = 0x00006c00,
HOST_CR3 = 0x00006c02,
HOST_CR4 = 0x00006c04,
HOST_FS_BASE = 0x00006c06,
HOST_GS_BASE = 0x00006c08,
HOST_TR_BASE = 0x00006c0a,
HOST_GDTR_BASE = 0x00006c0c,
HOST_IDTR_BASE = 0x00006c0e,
HOST_IA32_SYSENTER_ESP = 0x00006c10,
HOST_IA32_SYSENTER_EIP = 0x00006c12,
HOST_RSP = 0x00006c14,
HOST_RIP = 0x00006c16,
};
/*
* Interruption-information format
*/
#define INTR_INFO_VECTOR_MASK 0xff /* 7:0 */
#define INTR_INFO_INTR_TYPE_MASK 0x700 /* 10:8 */
#define INTR_INFO_DELIVER_CODE_MASK 0x800 /* 11 */
#define INTR_INFO_UNBLOCK_NMI 0x1000 /* 12 */
#define INTR_INFO_VALID_MASK 0x80000000 /* 31 */
#define INTR_INFO_RESVD_BITS_MASK 0x7ffff000
#define VECTORING_INFO_VECTOR_MASK INTR_INFO_VECTOR_MASK
#define VECTORING_INFO_TYPE_MASK INTR_INFO_INTR_TYPE_MASK
#define VECTORING_INFO_DELIVER_CODE_MASK INTR_INFO_DELIVER_CODE_MASK
#define VECTORING_INFO_VALID_MASK INTR_INFO_VALID_MASK
#define INTR_TYPE_EXT_INTR (0 << 8) /* external interrupt */
#define INTR_TYPE_NMI_INTR (2 << 8) /* NMI */
#define INTR_TYPE_HARD_EXCEPTION (3 << 8) /* processor exception */
#define INTR_TYPE_SOFT_INTR (4 << 8) /* software interrupt */
#define INTR_TYPE_SOFT_EXCEPTION (6 << 8) /* software exception */
/* GUEST_INTERRUPTIBILITY_INFO flags. */
#define GUEST_INTR_STATE_STI 0x00000001
#define GUEST_INTR_STATE_MOV_SS 0x00000002
#define GUEST_INTR_STATE_SMI 0x00000004
#define GUEST_INTR_STATE_NMI 0x00000008
/* GUEST_ACTIVITY_STATE flags */
#define GUEST_ACTIVITY_ACTIVE 0
#define GUEST_ACTIVITY_HLT 1
#define GUEST_ACTIVITY_SHUTDOWN 2
#define GUEST_ACTIVITY_WAIT_SIPI 3
/*
* Exit Qualifications for MOV for Control Register Access
*/
#define CONTROL_REG_ACCESS_NUM 0x7 /* 2:0, number of control reg.*/
#define CONTROL_REG_ACCESS_TYPE 0x30 /* 5:4, access type */
#define CONTROL_REG_ACCESS_REG 0xf00 /* 10:8, general purpose reg. */
#define LMSW_SOURCE_DATA_SHIFT 16
#define LMSW_SOURCE_DATA (0xFFFF << LMSW_SOURCE_DATA_SHIFT) /* 16:31 lmsw source */
#define REG_EAX (0 << 8)
#define REG_ECX (1 << 8)
#define REG_EDX (2 << 8)
#define REG_EBX (3 << 8)
#define REG_ESP (4 << 8)
#define REG_EBP (5 << 8)
#define REG_ESI (6 << 8)
#define REG_EDI (7 << 8)
#define REG_R8 (8 << 8)
#define REG_R9 (9 << 8)
#define REG_R10 (10 << 8)
#define REG_R11 (11 << 8)
#define REG_R12 (12 << 8)
#define REG_R13 (13 << 8)
#define REG_R14 (14 << 8)
#define REG_R15 (15 << 8)
/*
* Exit Qualifications for MOV for Debug Register Access
*/
#define DEBUG_REG_ACCESS_NUM 0x7 /* 2:0, number of debug reg. */
#define DEBUG_REG_ACCESS_TYPE 0x10 /* 4, direction of access */
#define TYPE_MOV_TO_DR (0 << 4)
#define TYPE_MOV_FROM_DR (1 << 4)
#define DEBUG_REG_ACCESS_REG(eq) (((eq) >> 8) & 0xf) /* 11:8, general purpose reg. */
/*
* Exit Qualifications for APIC-Access
*/
#define APIC_ACCESS_OFFSET 0xfff /* 11:0, offset within the APIC page */
#define APIC_ACCESS_TYPE 0xf000 /* 15:12, access type */
#define TYPE_LINEAR_APIC_INST_READ (0 << 12)
#define TYPE_LINEAR_APIC_INST_WRITE (1 << 12)
#define TYPE_LINEAR_APIC_INST_FETCH (2 << 12)
#define TYPE_LINEAR_APIC_EVENT (3 << 12)
#define TYPE_PHYSICAL_APIC_EVENT (10 << 12)
#define TYPE_PHYSICAL_APIC_INST (15 << 12)
/* segment AR */
#define SEGMENT_AR_L_MASK (1 << 13)
#define AR_TYPE_ACCESSES_MASK 1
#define AR_TYPE_READABLE_MASK (1 << 1)
#define AR_TYPE_WRITEABLE_MASK (1 << 2)
#define AR_TYPE_CODE_MASK (1 << 3)
#define AR_TYPE_MASK 0x0f
#define AR_TYPE_BUSY_64_TSS 11
#define AR_TYPE_BUSY_32_TSS 11
#define AR_TYPE_BUSY_16_TSS 3
#define AR_TYPE_LDT 2
#define AR_UNUSABLE_MASK (1 << 16)
#define AR_S_MASK (1 << 4)
#define AR_P_MASK (1 << 7)
#define AR_L_MASK (1 << 13)
#define AR_DB_MASK (1 << 14)
#define AR_G_MASK (1 << 15)
#define AR_DPL_SHIFT 5
#define AR_DPL(ar) (((ar) >> AR_DPL_SHIFT) & 3)
#define AR_RESERVD_MASK 0xfffe0f00
#define TSS_PRIVATE_MEMSLOT (KVM_USER_MEM_SLOTS + 0)
#define APIC_ACCESS_PAGE_PRIVATE_MEMSLOT (KVM_USER_MEM_SLOTS + 1)
#define IDENTITY_PAGETABLE_PRIVATE_MEMSLOT (KVM_USER_MEM_SLOTS + 2)
#define VMX_NR_VPIDS (1 << 16)
#define VMX_VPID_EXTENT_SINGLE_CONTEXT 1
#define VMX_VPID_EXTENT_ALL_CONTEXT 2
#define VMX_EPT_EXTENT_INDIVIDUAL_ADDR 0
#define VMX_EPT_EXTENT_CONTEXT 1
#define VMX_EPT_EXTENT_GLOBAL 2
#define VMX_EPT_EXECUTE_ONLY_BIT (1ull)
#define VMX_EPT_PAGE_WALK_4_BIT (1ull << 6)
#define VMX_EPTP_UC_BIT (1ull << 8)
#define VMX_EPTP_WB_BIT (1ull << 14)
#define VMX_EPT_2MB_PAGE_BIT (1ull << 16)
#define VMX_EPT_1GB_PAGE_BIT (1ull << 17)
#define VMX_EPT_AD_BIT (1ull << 21)
#define VMX_EPT_EXTENT_CONTEXT_BIT (1ull << 25)
#define VMX_EPT_EXTENT_GLOBAL_BIT (1ull << 26)
#define VMX_VPID_EXTENT_SINGLE_CONTEXT_BIT (1ull << 9) /* (41 - 32) */
#define VMX_VPID_EXTENT_GLOBAL_CONTEXT_BIT (1ull << 10) /* (42 - 32) */
#define VMX_EPT_DEFAULT_GAW 3
#define VMX_EPT_MAX_GAW 0x4
#define VMX_EPT_MT_EPTE_SHIFT 3
#define VMX_EPT_GAW_EPTP_SHIFT 3
#define VMX_EPT_AD_ENABLE_BIT (1ull << 6)
#define VMX_EPT_DEFAULT_MT 0x6ull
#define VMX_EPT_READABLE_MASK 0x1ull
#define VMX_EPT_WRITABLE_MASK 0x2ull
#define VMX_EPT_EXECUTABLE_MASK 0x4ull
#define VMX_EPT_IPAT_BIT (1ull << 6)
#define VMX_EPT_ACCESS_BIT (1ull << 8)
#define VMX_EPT_DIRTY_BIT (1ull << 9)
#define VMX_EPT_IDENTITY_PAGETABLE_ADDR 0xfffbc000ul
#define ASM_VMX_VMCLEAR_RAX ".byte 0x66, 0x0f, 0xc7, 0x30"
#define ASM_VMX_VMLAUNCH ".byte 0x0f, 0x01, 0xc2"
#define ASM_VMX_VMRESUME ".byte 0x0f, 0x01, 0xc3"
#define ASM_VMX_VMPTRLD_RAX ".byte 0x0f, 0xc7, 0x30"
#define ASM_VMX_VMREAD_RDX_RAX ".byte 0x0f, 0x78, 0xd0"
#define ASM_VMX_VMWRITE_RAX_RDX ".byte 0x0f, 0x79, 0xd0"
#define ASM_VMX_VMWRITE_RSP_RDX ".byte 0x0f, 0x79, 0xd4"
#define ASM_VMX_VMXOFF ".byte 0x0f, 0x01, 0xc4"
#define ASM_VMX_VMXON_RAX ".byte 0xf3, 0x0f, 0xc7, 0x30"
#define ASM_VMX_INVEPT ".byte 0x66, 0x0f, 0x38, 0x80, 0x08"
#define ASM_VMX_INVVPID ".byte 0x66, 0x0f, 0x38, 0x81, 0x08"
struct vmx_msr_entry {
u32 index;
u32 reserved;
u64 value;
} __aligned(16);
/*
* Exit Qualifications for entry failure during or after loading guest state
*/
#define ENTRY_FAIL_DEFAULT 0
#define ENTRY_FAIL_PDPTE 2
#define ENTRY_FAIL_NMI 3
#define ENTRY_FAIL_VMCS_LINK_PTR 4
/*
* VM-instruction error numbers
*/
enum vm_instruction_error_number {
VMXERR_VMCALL_IN_VMX_ROOT_OPERATION = 1,
VMXERR_VMCLEAR_INVALID_ADDRESS = 2,
VMXERR_VMCLEAR_VMXON_POINTER = 3,
VMXERR_VMLAUNCH_NONCLEAR_VMCS = 4,
VMXERR_VMRESUME_NONLAUNCHED_VMCS = 5,
VMXERR_VMRESUME_AFTER_VMXOFF = 6,
VMXERR_ENTRY_INVALID_CONTROL_FIELD = 7,
VMXERR_ENTRY_INVALID_HOST_STATE_FIELD = 8,
VMXERR_VMPTRLD_INVALID_ADDRESS = 9,
VMXERR_VMPTRLD_VMXON_POINTER = 10,
VMXERR_VMPTRLD_INCORRECT_VMCS_REVISION_ID = 11,
VMXERR_UNSUPPORTED_VMCS_COMPONENT = 12,
VMXERR_VMWRITE_READ_ONLY_VMCS_COMPONENT = 13,
VMXERR_VMXON_IN_VMX_ROOT_OPERATION = 15,
VMXERR_ENTRY_INVALID_EXECUTIVE_VMCS_POINTER = 16,
VMXERR_ENTRY_NONLAUNCHED_EXECUTIVE_VMCS = 17,
VMXERR_ENTRY_EXECUTIVE_VMCS_POINTER_NOT_VMXON_POINTER = 18,
VMXERR_VMCALL_NONCLEAR_VMCS = 19,
VMXERR_VMCALL_INVALID_VM_EXIT_CONTROL_FIELDS = 20,
VMXERR_VMCALL_INCORRECT_MSEG_REVISION_ID = 22,
VMXERR_VMXOFF_UNDER_DUAL_MONITOR_TREATMENT_OF_SMIS_AND_SMM = 23,
VMXERR_VMCALL_INVALID_SMM_MONITOR_FEATURES = 24,
VMXERR_ENTRY_INVALID_VM_EXECUTION_CONTROL_FIELDS_IN_EXECUTIVE_VMCS = 25,
VMXERR_ENTRY_EVENTS_BLOCKED_BY_MOV_SS = 26,
VMXERR_INVALID_OPERAND_TO_INVEPT_INVVPID = 28,
};
#endif
| Hanjey/kvm-pvm | include/asm-x86/vmx.h | C | gpl-2.0 | 20,400 | [
30522,
1001,
2065,
13629,
2546,
24888,
2213,
1035,
4895,
10128,
3207,
2546,
1035,
1044,
1001,
9375,
24888,
2213,
1035,
4895,
10128,
3207,
2546,
1035,
1044,
1001,
2065,
3207,
2546,
1035,
1035,
1045,
22025,
2575,
1035,
1035,
1001,
2065,
13629... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html lang="{{App::getLocale()}}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ config('app.name') }} - Authorization</title>
<!-- Styles -->
<link href="/css/app.css" rel="stylesheet">
<style>
.passport-authorize .container {
margin-top: 30px;
}
.passport-authorize .scopes {
margin-top: 20px;
}
.passport-authorize .buttons {
margin-top: 25px;
text-align: center;
}
.passport-authorize .btn {
width: 125px;
}
.passport-authorize .btn-approve {
margin-right: 15px;
}
.passport-authorize form {
display: inline;
}
</style>
</head>
<body class="passport-authorize">
<div class="container">
<div class="row">
<div class="col-md-6 col-md-offset-3">
<div class="panel panel-default">
<div class="panel-heading">
Authorization Request
</div>
<div class="panel-body">
<!-- Introduction -->
<p><strong>{{ $client->name }}</strong> is requesting permission to access your account.</p>
<!-- Scope List -->
@if (count($scopes) > 0)
<div class="scopes">
<p><strong>This application will be able to:</strong></p>
<ul>
@foreach ($scopes as $scope)
<li>{{ $scope->description }}</li>
@endforeach
</ul>
</div>
@endif
<div class="buttons">
<!-- Authorize Button -->
<form method="post" action="/oauth/authorize">
{{ csrf_field() }}
<input type="hidden" name="state" value="{{ $request->state }}">
<input type="hidden" name="client_id" value="{{ $client->id }}">
<button type="submit" class="btn btn-success btn-approve">Authorize</button>
</form>
<!-- Cancel Button -->
<form method="post" action="/oauth/authorize">
{{ csrf_field() }}
{{ method_field('DELETE') }}
<input type="hidden" name="state" value="{{ $request->state }}">
<input type="hidden" name="client_id" value="{{ $client->id }}">
<button class="btn btn-danger">Cancel</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
| wcadena/inventarioFinalApp | resources/views/vendor/passport/authorize.blade.php | PHP | epl-1.0 | 3,248 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
11374,
1027,
1000,
1063,
1063,
10439,
1024,
1024,
2131,
4135,
9289,
2063,
1006,
1007,
1065,
1065,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
@page {
size: A4 portrait;
}
body {
counter-reset: h1 h2 h3 h4 h5 h6 figure table;
margin-bottom: 12.10084%;
margin-left: 15.12605%;
margin-right: 15.12605%;
margin-top: 12.10084%;
}
figure {
-uxwrite-display-name: "Figure";
margin-bottom: 12pt;
margin-left: auto;
margin-right: auto;
margin-top: 12pt;
text-align: center;
}
p.Normal {
-uxwrite-default: true;
-uxwrite-display-name: "Normal";
}
span.Default_Paragraph_Font {
-uxwrite-default: true;
-uxwrite-display-name: "Default Paragraph Font";
}
table.Normal_Table {
-uxwrite-default: true;
-uxwrite-display-name: "Normal Table";
}
table.Normal_Table > * > tr > td {
padding-bottom: 0pt;
padding-left: 5.4pt;
padding-right: 5.4pt;
padding-top: 0pt;
}
| apache/incubator-corinthia | DocFormats/filters/ooxml/tests/word/images/common.css | CSS | apache-2.0 | 799 | [
30522,
1030,
3931,
1063,
2946,
1024,
1037,
2549,
6533,
1025,
1065,
2303,
1063,
4675,
1011,
25141,
1024,
1044,
2487,
1044,
2475,
1044,
2509,
1044,
2549,
1044,
2629,
1044,
2575,
3275,
2795,
1025,
7785,
1011,
3953,
1024,
2260,
1012,
2531,
26... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.xcode.mobile.smilealarm.alarmpointmanager;
import android.content.Context;
import java.io.IOException;
import java.sql.Date;
import java.sql.Time;
import java.util.Calendar;
import java.util.HashMap;
import com.xcode.mobile.smilealarm.DataHelper;
import com.xcode.mobile.smilealarm.DateTimeHelper;
import com.xcode.mobile.smilealarm.R;
public class RisingPlanHandler {
private static final int VALID_CODE = 1;
private static final int INVALID_CODE_EXP = 2;
private static final int INVALID_CODE_EXP_SOONER_AVG = 3;
private static final int INVALID_CODE_EXP_AVG_TOO_FAR = 4;
private static final int INVALID_CODE_EXP_AVG_TOO_NEAR = 5;
private static final int INVALID_CODE_STARTDATE_BEFORE_THE_DAY_AFTER_TOMORROW = 6;
private static final int[] ListOfDescreasingMinutes = new int[]{-1, 2, 5, 10, 15, 18, 20};
private HashMap<Date, AlarmPoint> _risingPlan;
private int _currentStage;
private Date _theDateBefore;
private Time _theWakingTimeBefore;
private Time _expWakingTime;
private int _checkCode;
public static int Connect(Context ctx) {
AlarmPointListHandler aplh_RisingPlan = new AlarmPointListHandler(true);
AlarmPointListHandler aplh_AlarmPoint = new AlarmPointListHandler(false);
return aplh_AlarmPoint.overwriteAlarmPointList(aplh_RisingPlan.getCurrentList(), ctx);
}
public int createRisingPlan(Time avgWakingTime, Time expWakingTime, Date startDate, Context ctx)
throws IOException {
_checkCode = checkParameters(avgWakingTime, expWakingTime, startDate);
if (_checkCode != VALID_CODE)
return _checkCode;
_risingPlan = new HashMap<Date, AlarmPoint>();
_currentStage = 1;
_theDateBefore = new Date(DateTimeHelper.GetTheDateBefore(startDate));
_theWakingTimeBefore = avgWakingTime;
_expWakingTime = expWakingTime;
AlarmPoint ap0 = new AlarmPoint(_theDateBefore);
ap0.setColor();
_risingPlan.put(ap0.getSQLDate(), ap0);
while (DateTimeHelper.DurationTwoSQLTime(_theWakingTimeBefore,
_expWakingTime) >= ListOfDescreasingMinutes[_currentStage]) {
generateRisingPlanInCurrentStage();
_currentStage++;
}
generateTheLastAlarmPoint();
DataHelper.getInstance().saveAlarmPointListToData(true, _risingPlan);
return ReturnCode.OK;
}
public String getNotificationFromErrorCode(Context ctx) {
switch (_checkCode) {
case INVALID_CODE_EXP:
return ctx.getString(R.string.not_ExpTime);
case INVALID_CODE_EXP_SOONER_AVG:
return ctx.getString(R.string.not_AvgTime);
case INVALID_CODE_EXP_AVG_TOO_FAR:
return ctx.getString(R.string.not_AvgExpTooLong);
case INVALID_CODE_EXP_AVG_TOO_NEAR:
return ctx.getString(R.string.not_AvgExpTooShort);
case INVALID_CODE_STARTDATE_BEFORE_THE_DAY_AFTER_TOMORROW:
return ctx.getString(R.string.not_StrDate);
default:
return "invalid Code";
}
}
private int checkParameters(Time avgTime, Time expTime, Date startDate) {
if (!isAfterTomorrow(startDate))
return INVALID_CODE_STARTDATE_BEFORE_THE_DAY_AFTER_TOMORROW;
if (DateTimeHelper.CompareTo(avgTime, expTime) < 0)
return INVALID_CODE_EXP_SOONER_AVG;
Time BeginExpTime = new Time(DateTimeHelper.GetSQLTime(5, 0));
Time EndExpTime = new Time(DateTimeHelper.GetSQLTime(8, 0));
if (DateTimeHelper.CompareTo(expTime, BeginExpTime) < 0 || DateTimeHelper.CompareTo(expTime, EndExpTime) > 0) {
return INVALID_CODE_EXP;
}
int maxMinutes = 875;
int minMinutes = 20;
if (DateTimeHelper.DurationTwoSQLTime(avgTime, expTime) > maxMinutes)
return INVALID_CODE_EXP_AVG_TOO_FAR;
if (DateTimeHelper.DurationTwoSQLTime(avgTime, expTime) < minMinutes)
return INVALID_CODE_EXP_AVG_TOO_NEAR;
return VALID_CODE;
}
private void generateRisingPlanInCurrentStage() {
int daysInStage = 10;
if (ListOfDescreasingMinutes[_currentStage] == 15)
daysInStage = 15;
for (int i = 0; i < daysInStage && DateTimeHelper.DurationTwoSQLTime(_theWakingTimeBefore,
_expWakingTime) >= ListOfDescreasingMinutes[_currentStage]; i++) {
// WakingTime
Date currentDate = new Date(DateTimeHelper.GetTheNextDate(_theDateBefore));
AlarmPoint ap = new AlarmPoint(currentDate);
ap.setColor();
Time currentWakingTime = DateTimeHelper.GetSQLTime(_theWakingTimeBefore,
-(ListOfDescreasingMinutes[_currentStage]));
ap.setTimePoint(currentWakingTime, 1);
// SleepingTime
Time sleepingTimeBefore = getSleepingTime(currentWakingTime);
AlarmPoint apBefore = _risingPlan.get(_theDateBefore);
apBefore.setTimePoint(sleepingTimeBefore, 2);
// put
_risingPlan.put(apBefore.getSQLDate(), apBefore);
_risingPlan.put(ap.getSQLDate(), ap);
// reset before
_theDateBefore = currentDate;
_theWakingTimeBefore = currentWakingTime;
}
}
private void generateTheLastAlarmPoint() {
// WakingTime
Date currentDate = new Date(DateTimeHelper.GetTheNextDate(_theDateBefore));
AlarmPoint ap = new AlarmPoint(currentDate);
ap.setColor();
Time currentWakingTime = _expWakingTime;
ap.setTimePoint(currentWakingTime, 1);
// SleepingTime
Time sleepingTimeBefore = getSleepingTime(currentWakingTime);
AlarmPoint apBefore = _risingPlan.get(_theDateBefore);
apBefore.setTimePoint(sleepingTimeBefore, 2);
// put
_risingPlan.put(apBefore.getSQLDate(), apBefore);
_risingPlan.put(ap.getSQLDate(), ap);
// reset before
_theDateBefore = currentDate;
_theWakingTimeBefore = currentWakingTime;
}
private Time getSleepingTime(Time wakingTime) {
// wakingTime - 11 PM of thedaybefore > 8 hours => 11 PM
// <=> if wakingTime >= 7 AM
// or wakingTime >= 7AM => 11PM
// 6AM <= wakingTime < 7AM => 10:30 PM
// 5AM <= wakingTime < 6AM => 10 PM
Time SevenAM = new Time(DateTimeHelper.GetSQLTime(7, 0));
Time SixAM = new Time(DateTimeHelper.GetSQLTime(6, 0));
Time FiveAM = new Time(DateTimeHelper.GetSQLTime(5, 0));
Time EleventPM = new Time(DateTimeHelper.GetSQLTime(23, 0));
Time Ten30PM = new Time(DateTimeHelper.GetSQLTime(22, 30));
Time TenPM = new Time(DateTimeHelper.GetSQLTime(22, 0));
if (DateTimeHelper.CompareTo(wakingTime, SevenAM) >= 0) {
return EleventPM;
}
if (DateTimeHelper.CompareTo(wakingTime, SevenAM) < 0 && DateTimeHelper.CompareTo(wakingTime, SixAM) >= 0) {
return Ten30PM;
}
if (DateTimeHelper.CompareTo(wakingTime, SixAM) < 0 && DateTimeHelper.CompareTo(wakingTime, FiveAM) >= 0) {
return TenPM;
}
return null;
}
private Boolean isAfterTomorrow(Date startDate) {
Date today = new Date(Calendar.getInstance().getTimeInMillis());
Date tomorrow = new Date(DateTimeHelper.GetTheNextDate(today));
return (DateTimeHelper.CompareTo(startDate, tomorrow) > 0);
}
}
| anhnguyenbk/XCODE-MOBILE-APPS-DEV | SmileAlarm/app/src/main/java/com/xcode/mobile/smilealarm/alarmpointmanager/RisingPlanHandler.java | Java | mit | 7,754 | [
30522,
7427,
4012,
1012,
1060,
16044,
1012,
4684,
1012,
2868,
7911,
10867,
1012,
8598,
8400,
24805,
4590,
1025,
12324,
11924,
1012,
4180,
1012,
6123,
1025,
12324,
9262,
1012,
22834,
1012,
22834,
10288,
24422,
1025,
12324,
9262,
1012,
29296,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Constants
export const USERS_INCREMENT = 'USERS_INCREMENT'
export const USERS_DOUBLE_ASYNC = 'USERS_DOUBLE_ASYNC'
// Actions
export function increment(value = 1) {
return {
type: USERS_INCREMENT,
payload: value
}
}
export const doubleAsync = () => {
return (dispatch, getState) => {
return new Promise((resolve) => {
setTimeout(() => {
dispatch({
type: USERS_DOUBLE_ASYNC,
payload: getState().users
})
resolve()
}, 200)
})
}
}
export const actions = {
increment,
doubleAsync
}
// Action Handlers
const ACTION_HANDLERS = {
[USERS_INCREMENT]: (state, action) => state + action.payload,
[USERS_DOUBLE_ASYNC]: (state) => state * 2
}
// Reducer
const initialState = 0
export default function usersReducer(state = initialState, action) {
const handler = ACTION_HANDLERS[action.type]
return handler ? handler(state, action) : state
}
| jancarloviray/graphql-react-starter | src/client/routes/Users/modules/users.js | JavaScript | mit | 928 | [
30522,
1013,
1013,
5377,
2015,
9167,
9530,
3367,
5198,
1035,
4297,
28578,
4765,
1027,
1005,
5198,
1035,
4297,
28578,
4765,
1005,
9167,
9530,
3367,
5198,
1035,
3313,
1035,
2004,
6038,
2278,
1027,
1005,
5198,
1035,
3313,
1035,
2004,
6038,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
var Component = new Brick.Component();
Component.requires = {
mod: [
{name: '{C#MODNAME}', files: ['mail.js']}
]
};
Component.entryPoint = function(NS){
var Y = Brick.YUI,
COMPONENT = this,
SYS = Brick.mod.sys;
NS.MailTestWidget = Y.Base.create('MailTestWidget', SYS.AppWidget, [], {
onInitAppWidget: function(err, appInstance, options){
},
destructor: function(){
this.hideResult();
},
sendTestMail: function(){
var tp = this.template,
email = tp.getValue('email');
this.set('waiting', true);
this.get('appInstance').mailTestSend(email, function(err, result){
this.set('waiting', false);
if (!err){
this.showResult(result.mailTestSend);
}
}, this);
},
showResult: function(mail){
var tp = this.template;
tp.show('resultPanel');
this._resultMailWidget = new NS.MailViewWidget({
srcNode: tp.append('resultMail', '<div></div>'),
mail: mail
});
},
hideResult: function(){
var widget = this._resultMailWidget;
if (!widget){
return;
}
widget.destroy();
this._resultMailWidget = null;
this.template.hide('resultPanel');
}
}, {
ATTRS: {
component: {value: COMPONENT},
templateBlockName: {value: 'widget'},
},
CLICKS: {
send: 'sendTestMail'
},
});
}; | abricos/abricos-mod-notify | src/js/mailTest.js | JavaScript | mit | 1,659 | [
30522,
13075,
6922,
1027,
2047,
5318,
1012,
6922,
1006,
1007,
1025,
6922,
1012,
5942,
1027,
1063,
16913,
1024,
1031,
1063,
2171,
1024,
1005,
1063,
1039,
1001,
16913,
18442,
1065,
1005,
1010,
6764,
1024,
1031,
1005,
5653,
1012,
1046,
2015,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jsonp({"cep":"31170580","logradouro":"Rua Al\u00edrio Elias Ferreira","bairro":"Uni\u00e3o","cidade":"Belo Horizonte","uf":"MG","estado":"Minas Gerais"});
| lfreneda/cepdb | api/v1/31170580.jsonp.js | JavaScript | cc0-1.0 | 155 | [
30522,
1046,
3385,
2361,
1006,
1063,
1000,
8292,
2361,
1000,
1024,
1000,
23532,
19841,
27814,
2692,
1000,
1010,
1000,
8833,
12173,
8162,
2080,
1000,
1024,
1000,
21766,
2050,
2632,
1032,
1057,
8889,
2098,
9488,
14579,
26135,
1000,
1010,
1000... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class GeneralLevel : Level
{
public float completeLevelWaitTimeInSecs = 2;
private bool completeLevelTriggered;
private IEnumerator CompleteLevel()
{
yield return new WaitForSeconds(this.completeLevelWaitTimeInSecs);
if(SceneManager.GetActiveScene().buildIndex < SceneManager.sceneCount - 1)
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
}
else
{
SceneManager.LoadScene("Credits");
}
}
public void CheckForCompletion()
{
StartCoroutine(GameManager.Instance.CheckIfWon());
}
public override void TriggerCompleteLevel()
{
if (!this.completeLevelTriggered)
{
this.completeLevelTriggered = true;
base.TriggerCompleteLevel();
StartCoroutine(this.CompleteLevel());
}
}
}
| p4dd9/ngj17_spirit | Assets/Scripts/GeneralLevel.cs | C# | mit | 1,012 | [
30522,
2478,
2291,
1012,
6407,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
8499,
13159,
3170,
1025,
2478,
8499,
13159,
3170,
1012,
3496,
24805,
20511,
1025,
2270,
2465,
2236,
20414,
2884,
1024,
2504,
1063,
2270,
14257,
3143,
2041... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* Copyright 2019 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* Kohaku board configuration */
#ifndef __CROS_EC_BOARD_H
#define __CROS_EC_BOARD_H
/* Baseboard features */
#include "baseboard.h"
#define CONFIG_DPTF_MOTION_LID_NO_GMR_SENSOR
#define CONFIG_DPTF_MULTI_PROFILE
#define CONFIG_POWER_BUTTON
#define CONFIG_KEYBOARD_PROTOCOL_8042
#define CONFIG_LED_COMMON
#define CONFIG_LOW_POWER_IDLE
#define CONFIG_HOST_INTERFACE_ESPI
#undef CONFIG_UART_TX_BUF_SIZE
#define CONFIG_UART_TX_BUF_SIZE 4096
/* Keyboard features */
#define CONFIG_PWM_KBLIGHT
/* Sensors */
/* BMI160 Base accel/gyro */
#define CONFIG_ACCEL_INTERRUPTS
#define CONFIG_ACCELGYRO_BMI160
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
#define CONFIG_ACCELGYRO_BMI160_INT2_OUTPUT
/* Camera VSYNC */
#define CONFIG_SYNC
#define CONFIG_SYNC_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
/* BMA253 Lid accel */
#define CONFIG_ACCEL_BMA255
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
#define CONFIG_LID_ANGLE_UPDATE
/* BH1730 and TCS3400 ALS */
#define CONFIG_ALS
#define ALS_COUNT 2
#define I2C_PORT_ALS I2C_PORT_SENSOR
#define CONFIG_ALS_BH1730
#define CONFIG_ALS_TCS3400
#define CONFIG_ALS_TCS3400_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(CLEAR_ALS)
/* Sensors without hardware FIFO are in forced mode */
#define CONFIG_ACCEL_FORCE_MODE_MASK \
(BIT(LID_ACCEL) | BIT(BASE_ALS) | BIT(CLEAR_ALS))
/* Parameter to calculate LUX on Kohaku */
#define CONFIG_ALS_BH1730_LUXTH_PARAMS
/*
* Calulation formula depends on characteristic of optical window.
* In case of kohaku, we can select two different formula
* as characteristic of optical window.
* BH1730_LUXTH1_1K is charateristic of optical window.
* 1. d1_1K/d0_1K * 1000 < BH1730_LUXTH1_1K
* 2. d1_1K/d0_1K * 1000 >= BH1730_LUXTH1_1K
* d0 and d1 are unsigned 16 bit. So, d1/d0 max is 65535
* To meet 2nd condition, make BH1730_LUXTH2_1K to (max+1)*1000
* Kohaku will not use both BH1730_LUXTH3_1K condition
* and BH1730_LUXTH4_1K condition.
*/
#define BH1730_LUXTH1_1K 270
#define BH1730_LUXTH1_D0_1K 19200
#define BH1730_LUXTH1_D1_1K 30528
#define BH1730_LUXTH2_1K 655360000
#define BH1730_LUXTH2_D0_1K 11008
#define BH1730_LUXTH2_D1_1K 10752
#define BH1730_LUXTH3_1K 1030
#define BH1730_LUXTH3_D0_1K 11008
#define BH1730_LUXTH3_D1_1K 10752
#define BH1730_LUXTH4_1K 3670
#define BH1730_LUXTH4_D0_1K 11008
#define BH1730_LUXTH4_D1_1K 10752
/* USB Type C and USB PD defines */
#define CONFIG_USB_PD_COMM_LOCKED
#define CONFIG_USB_PD_TCPM_PS8751
#define BOARD_TCPC_C0_RESET_HOLD_DELAY PS8XXX_RESET_DELAY_MS
#define BOARD_TCPC_C0_RESET_POST_DELAY 0
#define BOARD_TCPC_C1_RESET_HOLD_DELAY PS8XXX_RESET_DELAY_MS
#define BOARD_TCPC_C1_RESET_POST_DELAY 0
#define GPIO_USB_C0_TCPC_RST GPIO_USB_C0_TCPC_RST_ODL
#define GPIO_USB_C1_TCPC_RST GPIO_USB_C1_TCPC_RST_ODL
#define GPIO_BAT_LED_RED_L GPIO_LED_1_L
#define GPIO_BAT_LED_GREEN_L GPIO_LED_3_L
#define GPIO_PWR_LED_BLUE_L GPIO_LED_2_L
/* BC 1.2 */
#define CONFIG_BC12_DETECT_MAX14637
/* Charger features */
/*
* The IDCHG current limit is set in 512 mA steps. The value set here is
* somewhat specific to the battery pack being currently used. The limit here
* was set via experimentation by finding how high it can be set and still boot
* the AP successfully, then backing off to provide margin.
*
* TODO(b/133444665): Revisit this threshold once peak power consumption tuning
* for the AP is completed.
*/
#define CONFIG_CHARGER_BQ25710_IDCHG_LIMIT_MA 6144
#define CONFIG_BATTERY_CHECK_CHARGE_TEMP_LIMITS
#define CONFIG_CHARGER_PROFILE_OVERRIDE
/* Volume Button feature */
#define CONFIG_VOLUME_BUTTONS
#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
/* Thermal features */
#define CONFIG_TEMP_SENSOR_POWER
#define CONFIG_THERMISTOR
#define CONFIG_THROTTLE_AP
#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
/*
* Macros for GPIO signals used in common code that don't match the
* schematic names. Signal names in gpio.inc match the schematic and are
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
#define GPIO_AC_PRESENT GPIO_ACOK_OD
#define GPIO_PG_EC_RSMRST_ODL GPIO_PG_EC_RSMRST_L
#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
#define GPIO_TEMP_SENSOR_POWER GPIO_EN_A_RAILS
#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
#include "registers.h"
/* GPIO signals updated base on board version. */
extern enum gpio_signal gpio_en_pp5000_a;
enum adc_channel {
ADC_TEMP_SENSOR_1, /* ADC0 */
ADC_TEMP_SENSOR_2, /* ADC1 */
ADC_TEMP_SENSOR_3, /* ADC2 */
ADC_TEMP_SENSOR_4, /* ADC3 */
ADC_CH_COUNT
};
enum sensor_id {
LID_ACCEL = 0,
BASE_ACCEL,
BASE_GYRO,
BASE_ALS,
VSYNC,
CLEAR_ALS,
RGB_ALS,
SENSOR_COUNT,
};
enum pwm_channel {
PWM_CH_KBLIGHT,
PWM_CH_COUNT
};
enum temp_sensor_id {
TEMP_SENSOR_1,
TEMP_SENSOR_2,
TEMP_SENSOR_3,
TEMP_SENSOR_4,
TEMP_SENSOR_COUNT
};
/* List of possible batteries */
enum battery_type {
BATTERY_DYNA,
BATTERY_SDI,
BATTERY_TYPE_COUNT,
};
#endif /* !__ASSEMBLER__ */
#endif /* __CROS_EC_BOARD_H */
| coreboot/chrome-ec | board/kohaku/board.h | C | bsd-3-clause | 5,718 | [
30522,
1013,
1008,
9385,
10476,
1996,
10381,
21716,
5007,
9808,
6048,
1012,
2035,
2916,
9235,
1012,
1008,
2224,
1997,
2023,
3120,
3642,
2003,
9950,
2011,
1037,
18667,
2094,
1011,
2806,
6105,
2008,
2064,
2022,
1008,
2179,
1999,
1996,
6105,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
*/
namespace Magento\Sales\Model\Grid;
class CollectionUpdater implements \Magento\Framework\View\Layout\Argument\UpdaterInterface
{
/**
* @var \Magento\Framework\Registry
*/
protected $registryManager;
/**
* @param \Magento\Framework\Registry $registryManager
*/
public function __construct(\Magento\Framework\Registry $registryManager)
{
$this->registryManager = $registryManager;
}
/**
* Update grid collection according to chosen order
*
* @param \Magento\Sales\Model\Resource\Transaction\Grid\Collection $argument
* @return \Magento\Sales\Model\Resource\Transaction\Grid\Collection
*/
public function update($argument)
{
$order = $this->registryManager->registry('current_order');
if ($order) {
$argument->setOrderFilter($order->getId());
}
$argument->addOrderInformation(['increment_id']);
return $argument;
}
}
| webadvancedservicescom/magento | app/code/Magento/Sales/Model/Grid/CollectionUpdater.php | PHP | apache-2.0 | 1,062 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
1030,
9385,
9385,
1006,
1039,
1007,
2297,
1060,
1012,
6236,
1010,
4297,
1012,
1006,
8299,
1024,
1013,
1013,
7479,
1012,
17454,
13663,
9006,
5017,
3401,
1012,
4012,
1007,
1008,
1013,
3415,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2016-present Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package com.facebook.buck.io;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeThat;
import com.facebook.buck.io.file.MorePaths;
import com.facebook.buck.testutil.ProcessResult;
import com.facebook.buck.testutil.TemporaryPaths;
import com.facebook.buck.testutil.integration.ProjectWorkspace;
import com.facebook.buck.testutil.integration.TestDataHelper;
import com.facebook.buck.util.environment.Platform;
import com.google.common.base.Splitter;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
public class ConfiguredBuckOutIntegrationTest {
private ProjectWorkspace workspace;
@Rule public TemporaryPaths tmp = new TemporaryPaths();
@Before
public void setUp() throws IOException {
workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "configured_buck_out", tmp);
workspace.setUp();
}
@Test
public void outputPathsUseConfiguredBuckOut() throws IOException {
String buckOut = "new-buck-out";
Path output = workspace.buildAndReturnOutput("-c", "project.buck_out=" + buckOut, "//:dummy");
assertTrue(Files.exists(output));
assertThat(workspace.getDestPath().relativize(output).toString(), Matchers.startsWith(buckOut));
}
@Test
public void configuredBuckOutAffectsRuleKey() throws IOException {
String out =
workspace
.runBuckCommand("targets", "--show-rulekey", "//:dummy")
.assertSuccess()
.getStdout();
String ruleKey = Splitter.on(' ').splitToList(out).get(1);
String configuredOut =
workspace
.runBuckCommand(
"targets", "--show-rulekey", "-c", "project.buck_out=something", "//:dummy")
.assertSuccess()
.getStdout();
String configuredRuleKey = Splitter.on(' ').splitToList(configuredOut).get(1);
assertThat(ruleKey, Matchers.not(Matchers.equalTo(configuredRuleKey)));
}
@Test
public void buckOutCompatSymlink() throws IOException {
assumeThat(Platform.detect(), Matchers.not(Matchers.is(Platform.WINDOWS)));
ProcessResult result =
workspace.runBuckBuild(
"-c",
"project.buck_out=something",
"-c",
"project.buck_out_compat_link=true",
"//:dummy");
result.assertSuccess();
assertThat(
Files.readSymbolicLink(workspace.resolve("buck-out/gen")),
Matchers.equalTo(workspace.getDestPath().getFileSystem().getPath("../something/gen")));
}
@Test
public void verifyTogglingConfiguredBuckOut() throws IOException {
assumeThat(Platform.detect(), Matchers.not(Matchers.is(Platform.WINDOWS)));
workspace
.runBuckBuild(
"-c",
"project.buck_out=something",
"-c",
"project.buck_out_compat_link=true",
"//:dummy")
.assertSuccess();
workspace.runBuckBuild("//:dummy").assertSuccess();
workspace
.runBuckBuild(
"-c",
"project.buck_out=something",
"-c",
"project.buck_out_compat_link=true",
"//:dummy")
.assertSuccess();
}
@Test
public void verifyNoopBuildWithCompatSymlink() throws IOException {
assumeThat(Platform.detect(), Matchers.not(Matchers.is(Platform.WINDOWS)));
// Do an initial build.
workspace
.runBuckBuild(
"-c",
"project.buck_out=something",
"-c",
"project.buck_out_compat_link=true",
"//:dummy")
.assertSuccess();
workspace.getBuildLog().assertTargetBuiltLocally("//:dummy");
// Run another build immediately after and verify everything was up to date.
workspace
.runBuckBuild(
"-c",
"project.buck_out=something",
"-c",
"project.buck_out_compat_link=true",
"//:dummy")
.assertSuccess();
workspace.getBuildLog().assertTargetHadMatchingRuleKey("//:dummy");
}
@Test
public void targetsShowOutput() throws IOException {
String output =
workspace
.runBuckCommand(
"targets", "--show-output", "-c", "project.buck_out=something", "//:dummy")
.assertSuccess()
.getStdout()
.trim();
output = Splitter.on(' ').splitToList(output).get(1);
assertThat(MorePaths.pathWithUnixSeparators(output), Matchers.startsWith("something/"));
}
@Test
public void targetsShowOutputCompatSymlink() throws IOException {
assumeThat(Platform.detect(), Matchers.not(Matchers.is(Platform.WINDOWS)));
String output =
workspace
.runBuckCommand(
"targets",
"--show-output",
"-c",
"project.buck_out=something",
"-c",
"project.buck_out_compat_link=true",
"//:dummy")
.assertSuccess()
.getStdout()
.trim();
output = Splitter.on(' ').splitToList(output).get(1);
assertThat(MorePaths.pathWithUnixSeparators(output), Matchers.startsWith("buck-out/gen/"));
}
@Test
public void buildShowOutput() throws IOException {
Path output = workspace.buildAndReturnOutput("-c", "project.buck_out=something", "//:dummy");
assertThat(
MorePaths.pathWithUnixSeparators(workspace.getDestPath().relativize(output)),
Matchers.startsWith("something/"));
}
@Test
public void buildShowOutputCompatSymlink() throws IOException {
assumeThat(Platform.detect(), Matchers.not(Matchers.is(Platform.WINDOWS)));
Path output =
workspace.buildAndReturnOutput(
"-c",
"project.buck_out=something",
"-c",
"project.buck_out_compat_link=true",
"//:dummy");
assertThat(
MorePaths.pathWithUnixSeparators(workspace.getDestPath().relativize(output)),
Matchers.startsWith("buck-out/gen/"));
}
}
| LegNeato/buck | test/com/facebook/buck/io/ConfiguredBuckOutIntegrationTest.java | Java | apache-2.0 | 6,709 | [
30522,
1013,
1008,
1008,
9385,
2355,
1011,
2556,
9130,
1010,
4297,
1012,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
2017,
2089,
1008,
2025,
2224,
2023,
5371,
3272,
19... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# This file is part of the Frescobaldi project, http://www.frescobaldi.org/
#
# Copyright (c) 2008 - 2014 by Wilbert Berendsen
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# See http://www.gnu.org/licenses/ for more information.
"""
Import and export of snippets.
"""
import os
try:
import xml.etree.cElementTree as ET
except ImportError:
import xml.etree.ElementTree as ET
from PyQt5.QtCore import QSize, Qt
from PyQt5.QtGui import QKeySequence
from PyQt5.QtWidgets import QMessageBox, QTreeWidget, QTreeWidgetItem
import app
import appinfo
import qutil
import userguide
import widgets.dialog
from . import model
from . import snippets
from . import builtin
def save(names, filename):
"""Saves the named snippets to a file."""
root = ET.Element('snippets')
root.text = '\n\n'
root.tail = '\n'
d = ET.ElementTree(root)
comment = ET.Comment(_comment.format(appinfo=appinfo))
comment.tail = '\n\n'
root.append(comment)
for name in names:
snippet = ET.Element('snippet')
snippet.set('id', name)
snippet.text = '\n'
snippet.tail = '\n\n'
title = ET.Element('title')
title.text = snippets.title(name, False)
title.tail = '\n'
shortcuts = ET.Element('shortcuts')
ss = model.shortcuts(name)
if ss:
shortcuts.text = '\n'
for s in ss:
shortcut = ET.Element('shortcut')
shortcut.text = s.toString()
shortcut.tail = '\n'
shortcuts.append(shortcut)
shortcuts.tail = '\n'
body = ET.Element('body')
body.text = snippets.text(name)
body.tail = '\n'
snippet.append(title)
snippet.append(shortcuts)
snippet.append(body)
root.append(snippet)
d.write(filename, "UTF-8")
def load(filename, widget):
"""Loads snippets from a file, displaying them in a list.
The user can then choose:
- overwrite builtin snippets or not
- overwrite own snippets with same title or not
- select and view snippets contents.
"""
try:
d = ET.parse(filename)
elements = list(d.findall('snippet'))
if not elements:
raise ValueError(_("No snippets found."))
except Exception as e:
QMessageBox.critical(widget, app.caption(_("Error")),
_("Can't read from source:\n\n{url}\n\n{error}").format(
url=filename, error=e))
return
dlg = widgets.dialog.Dialog(widget)
dlg.setWindowModality(Qt.WindowModal)
dlg.setWindowTitle(app.caption(_("dialog title", "Import Snippets")))
tree = QTreeWidget(headerHidden=True, rootIsDecorated=False)
dlg.setMainWidget(tree)
userguide.addButton(dlg.buttonBox(), "snippet_import_export")
allnames = frozenset(snippets.names())
builtins = frozenset(builtin.builtin_snippets)
titles = dict((snippets.title(n), n) for n in allnames if n not in builtins)
new = QTreeWidgetItem(tree, [_("New Snippets")])
updated = QTreeWidgetItem(tree, [_("Updated Snippets")])
unchanged = QTreeWidgetItem(tree, [_("Unchanged Snippets")])
new.setFlags(Qt.ItemIsEnabled)
updated.setFlags(Qt.ItemIsEnabled)
unchanged.setFlags(Qt.ItemIsEnabled)
new.setExpanded(True)
updated.setExpanded(True)
items = []
for snip in elements:
item = QTreeWidgetItem()
item.body = snip.find('body').text
item.title = snip.find('title').text
item.shortcuts = list(e.text for e in snip.findall('shortcuts/shortcut'))
title = item.title or snippets.maketitle(snippets.parse(item.body).text)
item.setText(0, title)
name = snip.get('id')
name = name if name in builtins else None
# determine if new, updated or unchanged
if not name:
name = titles.get(title)
item.name = name
if not name or name not in allnames:
new.addChild(item)
items.append(item)
item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsUserCheckable)
item.setCheckState(0, Qt.Checked)
elif name:
if (item.body != snippets.text(name)
or title != snippets.title(name)
or (item.shortcuts and item.shortcuts !=
[s.toString() for s in model.shortcuts(name) or ()])):
updated.addChild(item)
items.append(item)
item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsUserCheckable)
item.setCheckState(0, Qt.Checked)
else:
unchanged.addChild(item)
item.setFlags(Qt.ItemIsEnabled)
# count:
for i in new, updated, unchanged:
i.setText(0, i.text(0) + " ({0})".format(i.childCount()))
for i in new, updated:
if i.childCount():
i.setFlags(Qt.ItemIsEnabled | Qt.ItemIsUserCheckable)
i.setCheckState(0, Qt.Checked)
def changed(item):
if item in (new, updated):
for i in range(item.childCount()):
c = item.child(i)
c.setCheckState(0, item.checkState(0))
tree.itemChanged.connect(changed)
importShortcuts = QTreeWidgetItem([_("Import Keyboard Shortcuts")])
if items:
tree.addTopLevelItem(importShortcuts)
importShortcuts.setFlags(Qt.ItemIsEnabled | Qt.ItemIsUserCheckable)
importShortcuts.setCheckState(0, Qt.Checked)
dlg.setMessage(_("Choose which snippets you want to import:"))
else:
dlg.setMessage(_("There are no new or updated snippets in the file."))
unchanged.setExpanded(True)
tree.setWhatsThis(_(
"<p>Here the snippets from {filename} are displayed.</p>\n"
"<p>If there are new or updated snippets, you can select or deselect "
"them one by one, or all at once, using the checkbox of the group. "
"Then click OK to import all the selected snippets.</p>\n"
"<p>Existing, unchanged snippets can't be imported.</p>\n"
).format(filename=os.path.basename(filename)))
qutil.saveDialogSize(dlg, "snippettool/import/size", QSize(400, 300))
if not dlg.exec_() or not items:
return
ac = model.collection()
m = model.model()
with qutil.busyCursor():
for i in items:
if i.checkState(0) == Qt.Checked:
index = m.saveSnippet(i.name, i.body, i.title)
if i.shortcuts and importShortcuts.checkState(0):
shortcuts = list(map(QKeySequence.fromString, i.shortcuts))
ac.setShortcuts(m.name(index), shortcuts)
widget.updateColumnSizes()
_comment = """
Created by {appinfo.appname} {appinfo.version}.
Every snippet is represented by:
title: title text
shortcuts: list of shortcut elements, every shortcut is a key sequence
body: the snippet text
The snippet id attribute can be the name of a builtin snippet or a random
name like 'n123456'. In the latter case, the title is used to determine
whether a snippet is new or updated.
"""
| wbsoft/frescobaldi | frescobaldi_app/snippet/import_export.py | Python | gpl-2.0 | 7,763 | [
30522,
1001,
2023,
5371,
2003,
2112,
1997,
1996,
26991,
28807,
2622,
1010,
8299,
1024,
1013,
1013,
7479,
1012,
26991,
28807,
1012,
8917,
1013,
1001,
1001,
9385,
1006,
1039,
1007,
2263,
1011,
2297,
2011,
19863,
8296,
2022,
7389,
5104,
2368,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Nana GUI Programming Interface Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
* @file: nana/gui/programming_interface.hpp
*/
#ifndef NANA_GUI_PROGRAMMING_INTERFACE_HPP
#define NANA_GUI_PROGRAMMING_INTERFACE_HPP
#include <nana/config.hpp>
#include "detail/bedrock.hpp"
#include "effects.hpp"
#include "detail/general_events.hpp"
#include <nana/paint/image.hpp>
#include <memory>
namespace nana
{
class drawer_trigger;
class widget;
namespace dev
{
/// Traits for widget classes
template<typename Widget>
struct widget_traits
{
using event_type = ::nana::general_events;
using scheme_type = ::nana::widget_colors;
};
}
namespace API
{
void effects_edge_nimbus(window, effects::edge_nimbus);
effects::edge_nimbus effects_edge_nimbus(window);
void effects_bground(window, const effects::bground_factory_interface&, double fade_rate);
bground_mode effects_bground_mode(window);
void effects_bground_remove(window);
//namespace dev
//@brief: The interfaces defined in namespace dev are used for developing the nana.gui
namespace dev
{
bool set_events(window, const std::shared_ptr<general_events>&);
template<typename Scheme>
std::unique_ptr<Scheme> make_scheme()
{
return std::unique_ptr<Scheme>(
static_cast<Scheme*>(::nana::detail::bedrock::instance().make_scheme(::nana::detail::scheme_factory<Scheme>()).release()));
}
void set_scheme(window, widget_colors*);
widget_colors* get_scheme(window);
void attach_drawer(widget&, drawer_trigger&);
nana::string window_caption(window) throw();
void window_caption(window, nana::string);
window create_window(window, bool nested, const rectangle&, const appearance&, widget* attached);
window create_widget(window, const rectangle&, widget* attached);
window create_lite_widget(window, const rectangle&, widget* attached);
window create_frame(window, const rectangle&, widget* attached);
paint::graphics* window_graphics(window);
void delay_restore(bool);
}//end namespace dev
namespace detail
{
general_events* get_general_events(window);
}//end namespace detail
void exit();
nana::string transform_shortkey_text(nana::string text, nana::string::value_type &shortkey, nana::string::size_type *skpos);
bool register_shortkey(window, unsigned long);
void unregister_shortkey(window);
nana::point cursor_position();
rectangle make_center(unsigned width, unsigned height); ///< Retrieves a rectangle which is in the center of the screen.
rectangle make_center(window, unsigned width, unsigned height); ///< Retrieves a rectangle which is in the center of the window
template<typename Widget=::nana::widget, typename EnumFunction>
void enum_widgets(window wd, bool recursive, EnumFunction && ef)
{
static_assert(std::is_convertible<Widget, ::nana::widget>::value, "enum_widgets<Widget>: The specified Widget is not a widget type.");
typedef ::nana::detail::basic_window core_window_t;
auto & brock = ::nana::detail::bedrock::instance();
internal_scope_guard lock;
auto children = brock.wd_manager.get_children(reinterpret_cast<core_window_t*>(wd));
for (auto child : children)
{
auto wgt = dynamic_cast<Widget*>(brock.wd_manager.get_widget(child));
if (nullptr == wgt)
continue;
ef(*wgt);
if (recursive)
enum_widgets<Widget>(wd, recursive, std::forward<EnumFunction>(ef));
}
}
void window_icon_default(const paint::image& small_icon, const paint::image& big_icon = {});
void window_icon(window, const paint::image& small_icon, const paint::image& big_icon = {});
bool empty_window(window); ///< Determines whether a window is existing.
bool is_window(window); ///< Determines whether a window is existing, equal to !empty_window.
bool is_destroying(window); ///< Determines whether a window is destroying
void enable_dropfiles(window, bool);
/// \brief Retrieves the native window of a Nana.GUI window.
///
/// The native window type is platform-dependent. Under Microsoft Windows, a conversion can be employed between
/// nana::native_window_type and HWND through reinterpret_cast operator. Under X System, a conversion can
/// be employed between nana::native_window_type and Window through reinterpret_cast operator.
/// \return If the function succeeds, the return value is the native window handle to the Nana.GUI window. If fails return zero.
native_window_type root(window);
window root(native_window_type); ///< Retrieves the native window of a Nana.GUI window.
void fullscreen(window, bool);
bool enabled_double_click(window, bool);
bool insert_frame(window frame, native_window_type);
native_window_type frame_container(window frame);
native_window_type frame_element(window frame, unsigned index);
void close_window(window);
void show_window(window, bool show); ///< Sets a window visible state.
void restore_window(window);
void zoom_window(window, bool ask_for_max);
bool visible(window);
window get_parent_window(window);
window get_owner_window(window);
bool set_parent_window(window, window new_parent);
template<typename Widget=::nana::widget>
typename ::nana::dev::widget_traits<Widget>::event_type & events(window wd)
{
using event_type = typename ::nana::dev::widget_traits<Widget>::event_type;
internal_scope_guard lock;
auto * general_evt = detail::get_general_events(wd);
if (nullptr == general_evt)
throw std::invalid_argument("API::events(): bad parameter window handle, no events object or invalid window handle.");
if (std::is_same<::nana::general_events, event_type>::value)
return *static_cast<event_type*>(general_evt);
auto * widget_evt = dynamic_cast<event_type*>(general_evt);
if (nullptr == widget_evt)
throw std::invalid_argument("API::events(): bad template parameter Widget, the widget type and window handle do not match.");
return *widget_evt;
}
template<typename EventArg, typename std::enable_if<std::is_base_of< ::nana::event_arg, EventArg>::value>::type* = nullptr>
bool emit_event(event_code evt_code, window wd, const EventArg& arg)
{
auto & brock = ::nana::detail::bedrock::instance();
return brock.emit(evt_code, reinterpret_cast< ::nana::detail::bedrock::core_window_t*>(wd), arg, true, brock.get_thread_context());
}
void umake_event(event_handle);
template<typename Widget = ::nana::widget>
typename ::nana::dev::widget_traits<Widget>::scheme_type & scheme(window wd)
{
using scheme_type = typename ::nana::dev::widget_traits<Widget>::scheme_type;
internal_scope_guard lock;
auto * wdg_colors = dev::get_scheme(wd);
if (nullptr == wdg_colors)
throw std::invalid_argument("API::scheme(): bad parameter window handle, no events object or invalid window handle.");
if (std::is_same<::nana::widget_colors, scheme_type>::value)
return *static_cast<scheme_type*>(wdg_colors);
auto * comp_wdg_colors = dynamic_cast<scheme_type*>(wdg_colors);
if (nullptr == comp_wdg_colors)
throw std::invalid_argument("API::scheme(): bad template parameter Widget, the widget type and window handle do not match.");
return *comp_wdg_colors;
}
point window_position(window);
void move_window(window, int x, int y);
void move_window(window wd, const rectangle&);
void bring_top(window, bool activated);
bool set_window_z_order(window wd, window wd_after, z_order_action action_if_no_wd_after);
void draw_through(window, std::function<void()>);
void map_through_widgets(window, native_drawable_type);
size window_size(window);
void window_size(window, const size&);
size window_outline_size(window);
void window_outline_size(window, const size&);
bool get_window_rectangle(window, rectangle&);
bool track_window_size(window, const size&, bool true_for_max); ///< Sets the minimum or maximum tracking size of a window.
void window_enabled(window, bool);
bool window_enabled(window);
/** @brief A widget drawer draws the widget surface in answering an event.
*
* This function will tell the drawer to copy the graphics into window after event answering.
* Tells Nana.GUI to copy the buffer of event window to screen after the event is processed.
* This function only works for a drawer_trigger, when a drawer_trigger receives an event,
* after drawing, a drawer_trigger should call lazy_refresh to tell the Nana.GUI to refresh
* the window to the screen after the event process finished.
*/
void lazy_refresh();
/** @brief: calls refresh() of a widget's drawer. if currently state is lazy_refresh, Nana.GUI may paste the drawing on the window after an event processing.
* @param window: specify a window to be refreshed.
*/
void refresh_window(window); ///< Refreshs the window and display it immediately calling the refresh method of its drawer_trigger..
void refresh_window_tree(window); ///< Refreshs the specified window and all its children windows, then display it immediately
void update_window(window); ///< Copies the off-screen buffer to the screen for immediate display.
void window_caption(window, const std::string& title_utf8);
void window_caption(window, const nana::string& title);
nana::string window_caption(window);
void window_cursor(window, cursor);
cursor window_cursor(window);
void activate_window(window);
bool is_focus_ready(window);
window focus_window();
void focus_window(window);
window capture_window();
window capture_window(window, bool); ///< Enables or disables the window to grab the mouse input
void capture_ignore_children(bool ignore); ///< Enables or disables the captured window whether redirects the mouse input to its children if the mouse is over its children.
void modal_window(window); ///< Blocks the routine til the specified window is closed.
void wait_for(window);
color fgcolor(window);
color fgcolor(window, const color&);
color bgcolor(window);
color bgcolor(window, const color&);
color activated_color(window);
color activated_color(window, const color&);
void create_caret(window, unsigned width, unsigned height);
void destroy_caret(window);
void caret_effective_range(window, const rectangle&);
void caret_pos(window, const ::nana::point&);
nana::point caret_pos(window);
nana::size caret_size(window);
void caret_size(window, const size&);
void caret_visible(window, bool is_show);
bool caret_visible(window);
void tabstop(window); ///< Sets the window that owns the tabstop.
/// treu: The focus is not to be changed when Tab key is pressed, and a key_char event with tab will be generated.
void eat_tabstop(window, bool);
window move_tabstop(window, bool next); ///< Sets the focus to the window which tabstop is near to the specified window.
bool glass_window(window); /// \deprecated
bool glass_window(window, bool); /// \deprecated
/// Sets the window active state. If a window active state is false, the window will not obtain the focus when a mouse clicks on it wich will be obteined by take_if_has_active_false.
void take_active(window, bool has_active, window take_if_has_active_false);
bool window_graphics(window, nana::paint::graphics&);
bool root_graphics(window, nana::paint::graphics&);
bool get_visual_rectangle(window, nana::rectangle&);
void typeface(window, const nana::paint::font&);
paint::font typeface(window);
bool calc_screen_point(window, point&); ///<Converts window coordinates to screen coordinates
bool calc_window_point(window, point&); ///<Converts screen coordinates to window coordinates.
window find_window(const nana::point& mspos);
void register_menu_window(window, bool has_keyboard);
bool attach_menubar(window menubar);
void detach_menubar(window menubar);
bool is_window_zoomed(window, bool ask_for_max); ///<Tests a window whether it is maximized or minimized.
void widget_borderless(window, bool); ///<Enables or disables a borderless widget.
bool widget_borderless(window); ///<Tests a widget whether it is borderless.
nana::mouse_action mouse_action(window);
nana::element_state element_state(window);
bool ignore_mouse_focus(window, bool ignore); ///< Enables/disables the mouse focus, it returns the previous state
bool ignore_mouse_focus(window); ///< Determines whether the mouse focus is enabled
}//end namespace API
}//end namespace nana
#endif
| Greentwip/Windy | 3rdparty/nana/include/nana/gui/programming_interface.hpp | C++ | mit | 12,662 | [
30522,
1013,
1008,
1008,
17810,
26458,
4730,
8278,
7375,
1008,
17810,
1039,
1009,
1009,
3075,
1006,
8299,
1024,
1013,
1013,
7479,
1012,
17810,
21572,
1012,
8917,
1007,
1008,
9385,
1006,
1039,
1007,
2494,
1011,
2325,
9743,
3270,
2080,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
from netfields import InetAddressField, CidrAddressField
from django.db import models
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from nodeshot.core.base.models import BaseAccessLevel
from ..managers import NetAccessLevelManager
from choices import IP_PROTOCOLS
class Ip(BaseAccessLevel):
""" IP Address Model """
interface = models.ForeignKey('net.Interface', verbose_name=_('interface'))
address = InetAddressField(verbose_name=_('ip address'), unique=True, db_index=True)
protocol = models.CharField(_('IP Protocol Version'), max_length=4, choices=IP_PROTOCOLS, default=IP_PROTOCOLS[0][0], blank=True)
netmask = CidrAddressField(_('netmask (CIDR, eg: 10.40.0.0/24)'), blank=True, null=True)
objects = NetAccessLevelManager()
class Meta:
app_label = 'net'
permissions = (('can_view_ip', 'Can view ip'),)
verbose_name = _('ip address')
verbose_name_plural = _('ip addresses')
def __unicode__(self):
return '%s: %s' % (self.protocol, self.address)
def clean(self, *args, **kwargs):
""" TODO """
# netaddr.IPAddress('10.40.2.1') in netaddr.IPNetwork('10.40.0.0/24')
pass
def save(self, *args, **kwargs):
"""
Determines ip protocol version automatically.
Stores address in interface shortcuts for convenience.
"""
self.protocol = 'ipv%d' % self.address.version
# save
super(Ip, self).save(*args, **kwargs)
# TODO: do we really need this?
# save shortcut on interfaces
#ip_cached_list = self.interface.ip_addresses
## if not present in interface shorctus add it to the list
#if str(self.address) not in ip_cached_list:
# # recalculate cached_ip_list
# recalculated_ip_cached_list = []
# for ip in self.interface.ip_set.all():
# recalculated_ip_cached_list.append(str(ip.address))
# # rebuild string in format "<ip_1>, <ip_2>"
# self.interface.data['ip_addresses'] = recalculated_ip_cached_list
# self.interface.save()
@property
def owner(self):
return self.interface.owner
if 'grappelli' in settings.INSTALLED_APPS:
@staticmethod
def autocomplete_search_fields():
return ('address__icontains',)
| sephiroth6/nodeshot | nodeshot/networking/net/models/ip.py | Python | gpl-3.0 | 2,430 | [
30522,
2013,
5658,
15155,
12324,
1999,
12928,
14141,
8303,
3790,
1010,
28744,
12173,
16200,
4757,
3790,
2013,
6520,
23422,
1012,
16962,
12324,
4275,
2013,
6520,
23422,
1012,
4563,
1012,
11790,
12324,
27354,
2121,
29165,
2013,
6520,
23422,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.cngu.androidfun.main;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import com.cngu.androidfun.R;
import com.cngu.androidfun.data.ActionTopic;
import com.cngu.androidfun.data.MenuTopic;
import com.cngu.androidfun.data.Topic;
import com.cngu.androidfun.view.TopicView;
import java.util.ArrayList;
/**
* A TopicManager serves two purposes:
* <ol>
* <li>contain an in-memory (i.e. not-persisted) database of {@link Topic}s.
* <li>manage a history of selected {@link Topic}s.
* </ol>
*
* <p>Due to the static nature of the Topic menu navigation UI, persistence of these Topics is not
* required and can easily be created on demand.
*/
public class TopicManager implements ITopicManager {
private static final String TAG = TopicManager.class.getSimpleName();
private static final String KEY_HISTORY_STACK = "cngu.key.HISTORY_STACK";
public ArrayList<Topic> mTopics;
public ArrayList<Topic> mHistory;
private boolean mActionTopicReached;
public TopicManager(Context context) {
LayoutInflater inflater = LayoutInflater.from(context);
TopicView rootTopicView = (TopicView) inflater.inflate(R.layout.ui_topic_hierarchy, null);
mTopics = new ArrayList<>();
mHistory = new ArrayList<>();
mActionTopicReached = false;
Topic rootMenu = generateTopicHierarchy(rootTopicView);
mHistory.add(rootMenu);
}
@Override
public boolean isActionTopicReached() {
return mActionTopicReached;
}
@Override
public int getHistorySize() {
return mHistory.size();
}
@Override
public Topic getTopicInHistory(int pageNumber) {
if (pageNumber < 0 || pageNumber >= mHistory.size()) {
return null;
}
return mHistory.get(pageNumber);
}
@Override
public void pushTopicToHistory(Topic topic) {
if (mActionTopicReached) {
throw new IllegalStateException("Cannot navigate to Topics beyond an ActionTopic.");
}
if (topic instanceof ActionTopic) {
mActionTopicReached = true;
}
mHistory.add(topic);
}
@Override
public Topic popTopicFromHistory() {
if (mActionTopicReached) {
mActionTopicReached = false;
}
return mHistory.remove(mHistory.size()-1);
}
@Override
public void loadHistory(Bundle savedInstanceState) {
mHistory = savedInstanceState.getParcelableArrayList(KEY_HISTORY_STACK);
Topic top = mHistory.get(mHistory.size()-1);
mActionTopicReached = (top instanceof ActionTopic);
}
@Override
public void saveHistory(Bundle savedInstanceState) {
savedInstanceState.putParcelableArrayList(KEY_HISTORY_STACK, mHistory);
}
@Override
public boolean isTopicInHistory(Topic topic) {
for (Topic t : mHistory) {
if (topic.equals(t)) {
return true;
}
}
return false;
}
private Topic generateTopicHierarchy(TopicView root) {
if (root == null) {
return null;
}
String title = root.getTitle();
String description = root.getDescription();
if (root.getChildCount() > 0)
{
MenuTopic mt = new MenuTopic(title, description, null);
for (int i = 0; i < root.getChildCount(); i++) {
TopicView child = (TopicView) root.getChildAt(i);
mt.addSubtopic(generateTopicHierarchy(child));
}
return mt;
}
else {
ActionTopic at = new ActionTopic(title, description, root.getDemoFragmentId());
return at;
}
}
}
| cngu/android-fun | app/src/main/java/com/cngu/androidfun/main/TopicManager.java | Java | mit | 3,766 | [
30522,
7427,
4012,
1012,
27166,
12193,
1012,
11924,
11263,
2078,
1012,
2364,
1025,
12324,
11924,
1012,
4180,
1012,
6123,
1025,
12324,
11924,
1012,
9808,
1012,
14012,
1025,
12324,
11924,
1012,
3193,
1012,
9621,
2378,
10258,
24932,
1025,
12324,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>pion-net: common/include/boost/lockfree/detail/tagged_ptr.hpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.7 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
</ul></div>
<h1>common/include/boost/lockfree/detail/tagged_ptr.hpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// tagged pointer, for aba prevention</span>
<a name="l00002"></a>00002 <span class="comment">//</span>
<a name="l00003"></a>00003 <span class="comment">// Copyright (C) 2008 Tim Blechmann</span>
<a name="l00004"></a>00004 <span class="comment">//</span>
<a name="l00005"></a>00005 <span class="comment">// Distributed under the Boost Software License, Version 1.0. (See</span>
<a name="l00006"></a>00006 <span class="comment">// accompanying file LICENSE_1_0.txt or copy at</span>
<a name="l00007"></a>00007 <span class="comment">// http://www.boost.org/LICENSE_1_0.txt)</span>
<a name="l00008"></a>00008
<a name="l00009"></a>00009 <span class="comment">// Disclaimer: Not a Boost library.</span>
<a name="l00010"></a>00010
<a name="l00011"></a>00011 <span class="preprocessor">#ifndef BOOST_LOCKFREE_TAGGED_PTR_HPP_INCLUDED</span>
<a name="l00012"></a>00012 <span class="preprocessor"></span><span class="preprocessor">#define BOOST_LOCKFREE_TAGGED_PTR_HPP_INCLUDED</span>
<a name="l00013"></a>00013 <span class="preprocessor"></span>
<a name="l00014"></a>00014 <span class="preprocessor">#include <boost/lockfree/detail/prefix.hpp></span>
<a name="l00015"></a>00015
<a name="l00016"></a>00016 <span class="preprocessor">#ifndef BOOST_LOCKFREE_PTR_COMPRESSION</span>
<a name="l00017"></a>00017 <span class="preprocessor"></span><span class="preprocessor">#include <boost/lockfree/detail/tagged_ptr_dcas.hpp></span>
<a name="l00018"></a>00018 <span class="preprocessor">#else</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span><span class="preprocessor">#include <boost/lockfree/detail/tagged_ptr_ptrcompression.hpp></span>
<a name="l00020"></a>00020 <span class="preprocessor">#endif</span>
<a name="l00021"></a>00021 <span class="preprocessor"></span>
<a name="l00022"></a>00022 <span class="preprocessor">#endif </span><span class="comment">/* BOOST_LOCKFREE_TAGGED_PTR_HPP_INCLUDED */</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Tue Aug 10 15:23:12 2010 for pion-net by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>
</html>
| enyo/old-brainslug | Contrib/pion-net-3.0.15/net/doc/html/tagged__ptr_8hpp-source.html | HTML | gpl-3.0 | 3,079 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
16129,
1018,
1012,
5890,
17459,
1013,
1013,
4372,
1000,
1028,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
18804,
8299,
1011,
1041,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Created by ken_kilgore1 on 1/11/2015.
*/
jQuery(document).ready(function ($) {
$("#spouse_info").hide();
$("#spouse_spacer").hide();
$("#family_info").hide();
$("#family_spacer").hide();
$("input:radio[name$='memb_type']").click(function () {
if ($("input[name$='memb_type']:checked").val() === 1) {
$("#spouse_info").hide();
$("#spouse_spacer").hide();
$("#family_info").hide();
$("#family_spacer").hide();
} else if ($("input[name$='memb_type']:checked").val() === 2) {
$("#spouse_info").hide();
$("#spouse_spacer").hide();
$("#family_info").show();
$("#family_spacer").show();
} else if ($("input[name$='memb_type']:checked").val() === 3) {
$("#spouse_spacer").show();
$("#spouse_info").show();
$("#family_info").hide();
$("#family_spacer").hide();
} else if ($("input[name$='memb_type']:checked").val() === 4) {
$("#spouse_info").show();
$("#spouse_spacer").show();
$("#family_info").show();
$("#family_spacer").show();
}
});
}); | ctxphc/beach-holiday | includes/js/mp-show-hide-script.js | JavaScript | gpl-3.0 | 1,199 | [
30522,
1013,
1008,
1008,
1008,
2580,
2011,
6358,
1035,
11382,
2140,
20255,
2063,
2487,
2006,
1015,
1013,
2340,
1013,
2325,
1012,
1008,
1013,
1046,
4226,
2854,
1006,
6254,
1007,
1012,
3201,
1006,
3853,
1006,
1002,
1007,
1063,
1002,
1006,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* @link https://github.com/gromver/yii2-platform-basic.git#readme
* @copyright Copyright (c) Gayazov Roman, 2014
* @license https://github.com/gromver/yii2-platform-basic/blob/master/LICENSE
* @package yii2-platform-basic
* @version 1.0.0
*/
namespace gromver\platform\basic\modules\tag\models;
use dosamigos\transliterator\TransliteratorHelper;
use gromver\platform\basic\components\UrlManager;
use gromver\platform\basic\interfaces\model\TranslatableInterface;
use gromver\platform\basic\interfaces\model\ViewableInterface;
use Yii;
use yii\behaviors\BlameableBehavior;
use yii\behaviors\TimestampBehavior;
use yii\db\ActiveQuery;
use yii\db\Query;
use yii\helpers\Inflector;
/**
* This is the model class for table "grom_tag".
* @package yii2-platform-basic
* @author Gayazov Roman <gromver5@gmail.com>
*
* @property integer $id
* @property integer $translation_id
* @property string $language
* @property string $title
* @property string $alias
* @property integer $status
* @property string $group
* @property string $metakey
* @property string $metadesc
* @property integer $created_at
* @property integer $updated_at
* @property integer $created_by
* @property integer $updated_by
* @property integer $hits
* @property integer $lock
*
* @property TagToItem[] $tagToItems
* @property Tag[] $translations
*/
class Tag extends \yii\db\ActiveRecord implements ViewableInterface, TranslatableInterface
{
const STATUS_PUBLISHED = 1;
const STATUS_UNPUBLISHED = 2;
/**
* @inheritdoc
*/
public static function tableName()
{
return '{{%grom_tag}}';
}
/**
* @return string
*/
public static function pivotTableName()
{
return '{{%grom_tag_to_item}}';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['language', 'title', 'status'], 'required'],
[['status', 'created_at', 'updated_at', 'created_by', 'updated_by', 'hits', 'lock'], 'integer'],
[['language'], 'string', 'max' => 7],
[['title'], 'string', 'max' => 100],
[['group'], 'filter', 'filter' => function($value) {
// если во вьюхе используется select2, отфильтровываем значение из массива [0 => 'значение'] -> 'значение'
return is_array($value) ? reset($value) : $value;
}],
[['alias', 'group', 'metakey'], 'string', 'max' => 255],
[['metadesc'], 'string', 'max' => 2048],
[['alias'], 'filter', 'filter' => 'trim'],
[['alias'], 'filter', 'filter' => function($value){
if (empty($value)) {
return Inflector::slug(TransliteratorHelper::process($this->title));
} else {
return Inflector::slug($value);
}
}],
[['alias'], 'unique', 'filter' => function($query){
/** @var $query \yii\db\ActiveQuery */
$query->andWhere(['language' => $this->language]);
}],
[['alias'], 'required', 'enableClientValidation' => false],
[['translation_id'], 'unique', 'filter' => function($query) {
/** @var $query \yii\db\ActiveQuery */
$query->andWhere(['language' => $this->language]);
}, 'message' => Yii::t('gromver.platform', 'Локализация ({language}) для записи (ID:{id}) уже существует.', ['language' => $this->language, 'id' => $this->translation_id])],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => Yii::t('gromver.platform', 'ID'),
'translation_id' => Yii::t('gromver.platform', 'Translation ID'),
'language' => Yii::t('gromver.platform', 'Language'),
'title' => Yii::t('gromver.platform', 'Title'),
'alias' => Yii::t('gromver.platform', 'Alias'),
'status' => Yii::t('gromver.platform', 'Status'),
'group' => Yii::t('gromver.platform', 'Group'),
'metakey' => Yii::t('gromver.platform', 'Meta keywords'),
'metadesc' => Yii::t('gromver.platform', 'Meta description'),
'created_at' => Yii::t('gromver.platform', 'Created At'),
'updated_at' => Yii::t('gromver.platform', 'Updated At'),
'created_by' => Yii::t('gromver.platform', 'Created By'),
'updated_by' => Yii::t('gromver.platform', 'Updated By'),
'hits' => Yii::t('gromver.platform', 'Hits'),
'lock' => Yii::t('gromver.platform', 'Lock'),
];
}
public function behaviors()
{
return [
TimestampBehavior::className(),
BlameableBehavior::className(),
];
}
/**
* @inheritdoc
*/
public function afterSave($insert, $changedAttributes)
{
if ($insert && $this->translation_id === null) {
$this->updateAttributes([
'translation_id' => $this->id
]);
}
parent::afterSave($insert, $changedAttributes);
}
/**
* @inheritdoc
*/
public function afterDelete()
{
parent::afterDelete();
$this->getDb()->createCommand()->delete(self::pivotTableName(), ['tag_id' => $this->id])->execute();
}
private static $_statuses = [
self::STATUS_PUBLISHED => 'Published',
self::STATUS_UNPUBLISHED => 'Unpublished',
];
/**
* @return array
*/
public static function statusLabels()
{
return array_map(function($label) {
return Yii::t('gromver.platform', $label);
}, self::$_statuses);
}
/**
* @param string|null $status
* @return string
*/
public function getStatusLabel($status = null)
{
return Yii::t('gromver.platform', self::$_statuses[$status === null ? $this->status : $status]);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getTagToItems()
{
return $this->hasMany(TagToItem::className(), ['tag_id' => 'id']);
}
/**
* @inheritdoc
*/
public function optimisticLock()
{
return 'lock';
}
/**
* Увеличивает счетчик просмотров
* @return int
*/
public function hit()
{
// todo любую статистику приложения собирать через логи
return 1;//return $this->updateAttributes(['hits' => $this->hits + 1]);
}
//http://www.slideshare.net/edbond/tagging-and-folksonomy-schema-design-for-scalability-and-performance?related=2
/**
* @param $tagText
* @param null $coverage
* @return Query
*/
public static function relatedTagsToTagQuery($tagText, $coverage = null){
$relatedItemsQuery = (new Query())
->select('item_id, item_class')
->from(self::tableName() . 't')->innerJoin(self::pivotTableName() . ' t2i', 't.id=t2i.tag_id')->where(['title'=>$tagText]);
if($coverage) $relatedItemsQuery->limit($coverage);
$resultQuery = (new ActiveQuery(self::className()))->select('t2.*')->from(['t2i1' => $relatedItemsQuery])
->innerJoin(self::pivotTableName() . ' t2i2', 't2i1.item_id=t2i2.item_id AND t2i1.item_class=t2i2.item_class')
->innerJoin(self::tableName() . ' t2', 't2i2.tag_id=t2.id')
->groupBy('t2i2.tag_id');
return $resultQuery;
}
/**
* @param $itemId
* @param $itemClass
* @return ActiveQuery
*/
public static function relatedItemsToItemQuery($itemId, $itemClass)
{
return TagToItem::find()
->select('p2.*')
->from(self::pivotTableName() . ' p1')
->innerJoin(self::pivotTableName() . ' p2', 'p1.tag_id=p2.tag_id')
->where(['p1.item_id' => $itemId, 'p1.item_class' => $itemClass])
->groupBy('p2.item_id');
}
/**
* @param $tags
* @return ActiveQuery
*/
public static function relatedItemsToTagsQuery($tags)
{
$tags = (array)$tags;
$query = TagToItem::find()
->select('t2i0.*')
->from(self::tableName() . ' t0')
->innerJoin(self::pivotTableName() . ' t2i0', 't0.id=t2i0.tag_id');
foreach($tags as $k => $tag) {
if($k) {
$query->join('CROSS JOIN', self::tableName() . ' t'.$k);
$query->innerJoin(self::pivotTableName() . ' t2i'.$k, 't2i'.($k-1).'.item_id=t2i'.$k.'.item_id AND t2i'.($k-1).'.item_class=t2i'.$k.'.item_class AND t'.$k.'.id=t2i'.$k.'.tag_id');
}
$query->andWhere("t{$k}.title=:title{$k}", [":title{$k}"=>$tag]);
}
return $query;
}
/**
* @param $tags
* @return ActiveQuery
*/
public static function relatedItemsToTagsOrQuery($tags)
{
return TagToItem::find()
->select('item_id, item_class')
->from(self::tableName(). ' t')
->innerJoin(self::pivotTableName() . ' t2i', 't.id=t2i.tag_id')
->where(['t.title'=>$tags])
->groupBy('item_id');
}
// ViewableInterface
/**
* @inheritdoc
*/
public function getFrontendViewLink()
{
return ['/grom/tag/frontend/default/view', 'id' => $this->id, 'alias' => $this->alias, UrlManager::LANGUAGE_PARAM => $this->language];
}
/**
* @inheritdoc
*/
public static function frontendViewLink($model)
{
return ['/grom/tag/frontend/default/view', 'id' => $model['id'], 'alias' => $model['alias'], UrlManager::LANGUAGE_PARAM => $model['language']];
}
/**
* @inheritdoc
*/
public function getBackendViewLink()
{
return ['/grom/tag/backend/default/view', 'id' => $this->id];
}
/**
* @inheritdoc
*/
public static function backendViewLink($model)
{
return ['/grom/tag/backend/default/view', 'id' => $model['id']];
}
//TranslatableInterface
/**
* @inheritdoc
*/
public function getTranslations()
{
return self::hasMany(self::className(), ['translation_id' => 'translation_id'])->indexBy('language');
}
/**
* @inheritdoc
*/
public function getLanguage()
{
return $this->language;
}
}
| timoxeen/yii2-platform-basic | modules/tag/models/Tag.php | PHP | gpl-2.0 | 10,531 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
1030,
4957,
16770,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
24665,
5358,
6299,
1013,
12316,
2072,
2475,
1011,
4132,
1011,
3937,
1012,
21025,
2102,
1001,
3191,
4168,
1008,
1030... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (c) 2005 Topspin Communications. All rights reserved.
* Copyright (c) 2005 Mellanox Technologies Ltd. All rights reserved.
* Copyright (c) 2006 Cisco Systems. All rights reserved.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
* General Public License (GPL) Version 2, available from the file
* COPYING in the main directory of this source tree, or the
* OpenIB.org BSD license below:
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
*
* - 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.
*
* 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.
*/
#if HAVE_CONFIG_H
# include <config.h>
#endif /* HAVE_CONFIG_H */
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <netinet/in.h>
#include <string.h>
#include <infiniband/opcode.h>
#include "mthca.h"
#include "doorbell.h"
enum {
MTHCA_CQ_DOORBELL = 0x20
};
enum {
CQ_OK = 0,
CQ_EMPTY = -1,
CQ_POLL_ERR = -2
};
#define MTHCA_TAVOR_CQ_DB_INC_CI (1 << 24)
#define MTHCA_TAVOR_CQ_DB_REQ_NOT (2 << 24)
#define MTHCA_TAVOR_CQ_DB_REQ_NOT_SOL (3 << 24)
#define MTHCA_TAVOR_CQ_DB_SET_CI (4 << 24)
#define MTHCA_TAVOR_CQ_DB_REQ_NOT_MULT (5 << 24)
#define MTHCA_ARBEL_CQ_DB_REQ_NOT_SOL (1 << 24)
#define MTHCA_ARBEL_CQ_DB_REQ_NOT (2 << 24)
#define MTHCA_ARBEL_CQ_DB_REQ_NOT_MULT (3 << 24)
enum {
MTHCA_CQ_ENTRY_OWNER_SW = 0x00,
MTHCA_CQ_ENTRY_OWNER_HW = 0x80,
MTHCA_ERROR_CQE_OPCODE_MASK = 0xfe
};
enum {
SYNDROME_LOCAL_LENGTH_ERR = 0x01,
SYNDROME_LOCAL_QP_OP_ERR = 0x02,
SYNDROME_LOCAL_EEC_OP_ERR = 0x03,
SYNDROME_LOCAL_PROT_ERR = 0x04,
SYNDROME_WR_FLUSH_ERR = 0x05,
SYNDROME_MW_BIND_ERR = 0x06,
SYNDROME_BAD_RESP_ERR = 0x10,
SYNDROME_LOCAL_ACCESS_ERR = 0x11,
SYNDROME_REMOTE_INVAL_REQ_ERR = 0x12,
SYNDROME_REMOTE_ACCESS_ERR = 0x13,
SYNDROME_REMOTE_OP_ERR = 0x14,
SYNDROME_RETRY_EXC_ERR = 0x15,
SYNDROME_RNR_RETRY_EXC_ERR = 0x16,
SYNDROME_LOCAL_RDD_VIOL_ERR = 0x20,
SYNDROME_REMOTE_INVAL_RD_REQ_ERR = 0x21,
SYNDROME_REMOTE_ABORTED_ERR = 0x22,
SYNDROME_INVAL_EECN_ERR = 0x23,
SYNDROME_INVAL_EEC_STATE_ERR = 0x24
};
struct mthca_cqe {
uint32_t my_qpn;
uint32_t my_ee;
uint32_t rqpn;
uint16_t sl_g_mlpath;
uint16_t rlid;
uint32_t imm_etype_pkey_eec;
uint32_t byte_cnt;
uint32_t wqe;
uint8_t opcode;
uint8_t is_send;
uint8_t reserved;
uint8_t owner;
};
struct mthca_err_cqe {
uint32_t my_qpn;
uint32_t reserved1[3];
uint8_t syndrome;
uint8_t vendor_err;
uint16_t db_cnt;
uint32_t reserved2;
uint32_t wqe;
uint8_t opcode;
uint8_t reserved3[2];
uint8_t owner;
};
static inline struct mthca_cqe *get_cqe(struct mthca_cq *cq, int entry)
{
return cq->buf.buf + entry * MTHCA_CQ_ENTRY_SIZE;
}
static inline struct mthca_cqe *cqe_sw(struct mthca_cq *cq, int i)
{
struct mthca_cqe *cqe = get_cqe(cq, i);
return MTHCA_CQ_ENTRY_OWNER_HW & cqe->owner ? NULL : cqe;
}
static inline struct mthca_cqe *next_cqe_sw(struct mthca_cq *cq)
{
return cqe_sw(cq, cq->cons_index & cq->ibv_cq.cqe);
}
static inline void set_cqe_hw(struct mthca_cqe *cqe)
{
VALGRIND_MAKE_MEM_UNDEFINED(cqe, sizeof *cqe);
cqe->owner = MTHCA_CQ_ENTRY_OWNER_HW;
}
/*
* incr is ignored in native Arbel (mem-free) mode, so cq->cons_index
* should be correct before calling update_cons_index().
*/
static inline void update_cons_index(struct mthca_cq *cq, int incr)
{
uint32_t doorbell[2];
if (mthca_is_memfree(cq->ibv_cq.context)) {
*cq->set_ci_db = htonl(cq->cons_index);
wmb();
} else {
doorbell[0] = htonl(MTHCA_TAVOR_CQ_DB_INC_CI | cq->cqn);
doorbell[1] = htonl(incr - 1);
mthca_write64(doorbell, to_mctx(cq->ibv_cq.context), MTHCA_CQ_DOORBELL);
}
}
static void dump_cqe(void *cqe_ptr)
{
uint32_t *cqe = cqe_ptr;
int i;
for (i = 0; i < 8; ++i)
printf(" [%2x] %08x\n", i * 4, ntohl(((uint32_t *) cqe)[i]));
}
static int handle_error_cqe(struct mthca_cq *cq,
struct mthca_qp *qp, int wqe_index, int is_send,
struct mthca_err_cqe *cqe,
struct ibv_wc *wc, int *free_cqe)
{
int err;
int dbd;
uint32_t new_wqe;
if (cqe->syndrome == SYNDROME_LOCAL_QP_OP_ERR) {
printf("local QP operation err "
"(QPN %06x, WQE @ %08x, CQN %06x, index %d)\n",
ntohl(cqe->my_qpn), ntohl(cqe->wqe),
cq->cqn, cq->cons_index);
dump_cqe(cqe);
}
/*
* For completions in error, only work request ID, status, vendor error
* (and freed resource count for RD) have to be set.
*/
switch (cqe->syndrome) {
case SYNDROME_LOCAL_LENGTH_ERR:
wc->status = IBV_WC_LOC_LEN_ERR;
break;
case SYNDROME_LOCAL_QP_OP_ERR:
wc->status = IBV_WC_LOC_QP_OP_ERR;
break;
case SYNDROME_LOCAL_EEC_OP_ERR:
wc->status = IBV_WC_LOC_EEC_OP_ERR;
break;
case SYNDROME_LOCAL_PROT_ERR:
wc->status = IBV_WC_LOC_PROT_ERR;
break;
case SYNDROME_WR_FLUSH_ERR:
wc->status = IBV_WC_WR_FLUSH_ERR;
break;
case SYNDROME_MW_BIND_ERR:
wc->status = IBV_WC_MW_BIND_ERR;
break;
case SYNDROME_BAD_RESP_ERR:
wc->status = IBV_WC_BAD_RESP_ERR;
break;
case SYNDROME_LOCAL_ACCESS_ERR:
wc->status = IBV_WC_LOC_ACCESS_ERR;
break;
case SYNDROME_REMOTE_INVAL_REQ_ERR:
wc->status = IBV_WC_REM_INV_REQ_ERR;
break;
case SYNDROME_REMOTE_ACCESS_ERR:
wc->status = IBV_WC_REM_ACCESS_ERR;
break;
case SYNDROME_REMOTE_OP_ERR:
wc->status = IBV_WC_REM_OP_ERR;
break;
case SYNDROME_RETRY_EXC_ERR:
wc->status = IBV_WC_RETRY_EXC_ERR;
break;
case SYNDROME_RNR_RETRY_EXC_ERR:
wc->status = IBV_WC_RNR_RETRY_EXC_ERR;
break;
case SYNDROME_LOCAL_RDD_VIOL_ERR:
wc->status = IBV_WC_LOC_RDD_VIOL_ERR;
break;
case SYNDROME_REMOTE_INVAL_RD_REQ_ERR:
wc->status = IBV_WC_REM_INV_RD_REQ_ERR;
break;
case SYNDROME_REMOTE_ABORTED_ERR:
wc->status = IBV_WC_REM_ABORT_ERR;
break;
case SYNDROME_INVAL_EECN_ERR:
wc->status = IBV_WC_INV_EECN_ERR;
break;
case SYNDROME_INVAL_EEC_STATE_ERR:
wc->status = IBV_WC_INV_EEC_STATE_ERR;
break;
default:
wc->status = IBV_WC_GENERAL_ERR;
break;
}
wc->vendor_err = cqe->vendor_err;
/*
* Mem-free HCAs always generate one CQE per WQE, even in the
* error case, so we don't have to check the doorbell count, etc.
*/
if (mthca_is_memfree(cq->ibv_cq.context))
return 0;
err = mthca_free_err_wqe(qp, is_send, wqe_index, &dbd, &new_wqe);
if (err)
return err;
/*
* If we're at the end of the WQE chain, or we've used up our
* doorbell count, free the CQE. Otherwise just update it for
* the next poll operation.
*
* This doesn't apply to mem-free HCAs, which never use the
* doorbell count field. In that case we always free the CQE.
*/
if (mthca_is_memfree(cq->ibv_cq.context) ||
!(new_wqe & htonl(0x3f)) || (!cqe->db_cnt && dbd))
return 0;
cqe->db_cnt = htons(ntohs(cqe->db_cnt) - dbd);
cqe->wqe = new_wqe;
cqe->syndrome = SYNDROME_WR_FLUSH_ERR;
*free_cqe = 0;
return 0;
}
static inline int mthca_poll_one(struct mthca_cq *cq,
struct mthca_qp **cur_qp,
int *freed,
struct ibv_wc *wc)
{
struct mthca_wq *wq;
struct mthca_cqe *cqe;
struct mthca_srq *srq;
uint32_t qpn;
uint32_t wqe;
int wqe_index;
int is_error;
int is_send;
int free_cqe = 1;
int err = 0;
cqe = next_cqe_sw(cq);
if (!cqe)
return CQ_EMPTY;
VALGRIND_MAKE_MEM_DEFINED(cqe, sizeof *cqe);
/*
* Make sure we read CQ entry contents after we've checked the
* ownership bit.
*/
rmb();
qpn = ntohl(cqe->my_qpn);
is_error = (cqe->opcode & MTHCA_ERROR_CQE_OPCODE_MASK) ==
MTHCA_ERROR_CQE_OPCODE_MASK;
is_send = is_error ? cqe->opcode & 0x01 : cqe->is_send & 0x80;
if (!*cur_qp || ntohl(cqe->my_qpn) != (*cur_qp)->ibv_qp.qp_num) {
/*
* We do not have to take the QP table lock here,
* because CQs will be locked while QPs are removed
* from the table.
*/
*cur_qp = mthca_find_qp(to_mctx(cq->ibv_cq.context), ntohl(cqe->my_qpn));
if (!*cur_qp) {
err = CQ_POLL_ERR;
goto out;
}
}
wc->qp_num = (*cur_qp)->ibv_qp.qp_num;
if (is_send) {
wq = &(*cur_qp)->sq;
wqe_index = ((ntohl(cqe->wqe) - (*cur_qp)->send_wqe_offset) >> wq->wqe_shift);
wc->wr_id = (*cur_qp)->wrid[wqe_index + (*cur_qp)->rq.max];
} else if ((*cur_qp)->ibv_qp.srq) {
srq = to_msrq((*cur_qp)->ibv_qp.srq);
wqe = htonl(cqe->wqe);
wq = NULL;
wqe_index = wqe >> srq->wqe_shift;
wc->wr_id = srq->wrid[wqe_index];
mthca_free_srq_wqe(srq, wqe_index);
} else {
int32_t wqe;
wq = &(*cur_qp)->rq;
wqe = ntohl(cqe->wqe);
wqe_index = wqe >> wq->wqe_shift;
/*
* WQE addr == base - 1 might be reported by Sinai FW
* 1.0.800 and Arbel FW 5.1.400 in receive completion
* with error instead of (rq size - 1). This bug
* should be fixed in later FW revisions.
*/
if (wqe_index < 0)
wqe_index = wq->max - 1;
wc->wr_id = (*cur_qp)->wrid[wqe_index];
}
if (wq) {
if (wq->last_comp < wqe_index)
wq->tail += wqe_index - wq->last_comp;
else
wq->tail += wqe_index + wq->max - wq->last_comp;
wq->last_comp = wqe_index;
}
if (is_error) {
err = handle_error_cqe(cq, *cur_qp, wqe_index, is_send,
(struct mthca_err_cqe *) cqe,
wc, &free_cqe);
goto out;
}
if (is_send) {
wc->wc_flags = 0;
switch (cqe->opcode) {
case MTHCA_OPCODE_RDMA_WRITE:
wc->opcode = IBV_WC_RDMA_WRITE;
break;
case MTHCA_OPCODE_RDMA_WRITE_IMM:
wc->opcode = IBV_WC_RDMA_WRITE;
wc->wc_flags |= IBV_WC_WITH_IMM;
break;
case MTHCA_OPCODE_SEND:
wc->opcode = IBV_WC_SEND;
break;
case MTHCA_OPCODE_SEND_IMM:
wc->opcode = IBV_WC_SEND;
wc->wc_flags |= IBV_WC_WITH_IMM;
break;
case MTHCA_OPCODE_RDMA_READ:
wc->opcode = IBV_WC_RDMA_READ;
wc->byte_len = ntohl(cqe->byte_cnt);
break;
case MTHCA_OPCODE_ATOMIC_CS:
wc->opcode = IBV_WC_COMP_SWAP;
wc->byte_len = ntohl(cqe->byte_cnt);
break;
case MTHCA_OPCODE_ATOMIC_FA:
wc->opcode = IBV_WC_FETCH_ADD;
wc->byte_len = ntohl(cqe->byte_cnt);
break;
case MTHCA_OPCODE_BIND_MW:
wc->opcode = IBV_WC_BIND_MW;
break;
default:
/* assume it's a send completion */
wc->opcode = IBV_WC_SEND;
break;
}
} else {
wc->byte_len = ntohl(cqe->byte_cnt);
switch (cqe->opcode & 0x1f) {
case IBV_OPCODE_SEND_LAST_WITH_IMMEDIATE:
case IBV_OPCODE_SEND_ONLY_WITH_IMMEDIATE:
wc->wc_flags = IBV_WC_WITH_IMM;
wc->imm_data = cqe->imm_etype_pkey_eec;
wc->opcode = IBV_WC_RECV;
break;
case IBV_OPCODE_RDMA_WRITE_LAST_WITH_IMMEDIATE:
case IBV_OPCODE_RDMA_WRITE_ONLY_WITH_IMMEDIATE:
wc->wc_flags = IBV_WC_WITH_IMM;
wc->imm_data = cqe->imm_etype_pkey_eec;
wc->opcode = IBV_WC_RECV_RDMA_WITH_IMM;
break;
default:
wc->wc_flags = 0;
wc->opcode = IBV_WC_RECV;
break;
}
wc->slid = ntohs(cqe->rlid);
wc->sl = ntohs(cqe->sl_g_mlpath) >> 12;
wc->src_qp = ntohl(cqe->rqpn) & 0xffffff;
wc->dlid_path_bits = ntohs(cqe->sl_g_mlpath) & 0x7f;
wc->pkey_index = ntohl(cqe->imm_etype_pkey_eec) >> 16;
wc->wc_flags |= ntohs(cqe->sl_g_mlpath) & 0x80 ?
IBV_WC_GRH : 0;
}
wc->status = IBV_WC_SUCCESS;
out:
if (free_cqe) {
set_cqe_hw(cqe);
++(*freed);
++cq->cons_index;
}
return err;
}
int mthca_poll_cq(struct ibv_cq *ibcq, int ne, struct ibv_wc *wc)
{
struct mthca_cq *cq = to_mcq(ibcq);
struct mthca_qp *qp = NULL;
int npolled;
int err = CQ_OK;
int freed = 0;
pthread_spin_lock(&cq->lock);
for (npolled = 0; npolled < ne; ++npolled) {
err = mthca_poll_one(cq, &qp, &freed, wc + npolled);
if (err != CQ_OK)
break;
}
if (freed) {
wmb();
update_cons_index(cq, freed);
}
pthread_spin_unlock(&cq->lock);
return err == CQ_POLL_ERR ? err : npolled;
}
int mthca_tavor_arm_cq(struct ibv_cq *cq, int solicited)
{
uint32_t doorbell[2];
doorbell[0] = htonl((solicited ?
MTHCA_TAVOR_CQ_DB_REQ_NOT_SOL :
MTHCA_TAVOR_CQ_DB_REQ_NOT) |
to_mcq(cq)->cqn);
doorbell[1] = 0xffffffff;
mthca_write64(doorbell, to_mctx(cq->context), MTHCA_CQ_DOORBELL);
return 0;
}
int mthca_arbel_arm_cq(struct ibv_cq *ibvcq, int solicited)
{
struct mthca_cq *cq = to_mcq(ibvcq);
uint32_t doorbell[2];
uint32_t sn;
uint32_t ci;
sn = cq->arm_sn & 3;
ci = htonl(cq->cons_index);
doorbell[0] = ci;
doorbell[1] = htonl((cq->cqn << 8) | (2 << 5) | (sn << 3) |
(solicited ? 1 : 2));
mthca_write_db_rec(doorbell, cq->arm_db);
/*
* Make sure that the doorbell record in host memory is
* written before ringing the doorbell via PCI MMIO.
*/
wmb();
doorbell[0] = htonl((sn << 28) |
(solicited ?
MTHCA_ARBEL_CQ_DB_REQ_NOT_SOL :
MTHCA_ARBEL_CQ_DB_REQ_NOT) |
cq->cqn);
doorbell[1] = ci;
mthca_write64(doorbell, to_mctx(ibvcq->context), MTHCA_CQ_DOORBELL);
return 0;
}
void mthca_arbel_cq_event(struct ibv_cq *cq)
{
to_mcq(cq)->arm_sn++;
}
static inline int is_recv_cqe(struct mthca_cqe *cqe)
{
if ((cqe->opcode & MTHCA_ERROR_CQE_OPCODE_MASK) ==
MTHCA_ERROR_CQE_OPCODE_MASK)
return !(cqe->opcode & 0x01);
else
return !(cqe->is_send & 0x80);
}
void __mthca_cq_clean(struct mthca_cq *cq, uint32_t qpn, struct mthca_srq *srq)
{
struct mthca_cqe *cqe;
uint32_t prod_index;
int i, nfreed = 0;
/*
* First we need to find the current producer index, so we
* know where to start cleaning from. It doesn't matter if HW
* adds new entries after this loop -- the QP we're worried
* about is already in RESET, so the new entries won't come
* from our QP and therefore don't need to be checked.
*/
for (prod_index = cq->cons_index;
cqe_sw(cq, prod_index & cq->ibv_cq.cqe);
++prod_index)
if (prod_index == cq->cons_index + cq->ibv_cq.cqe)
break;
/*
* Now sweep backwards through the CQ, removing CQ entries
* that match our QP by copying older entries on top of them.
*/
while ((int) --prod_index - (int) cq->cons_index >= 0) {
cqe = get_cqe(cq, prod_index & cq->ibv_cq.cqe);
if (cqe->my_qpn == htonl(qpn)) {
if (srq && is_recv_cqe(cqe))
mthca_free_srq_wqe(srq,
ntohl(cqe->wqe) >> srq->wqe_shift);
++nfreed;
} else if (nfreed)
memcpy(get_cqe(cq, (prod_index + nfreed) & cq->ibv_cq.cqe),
cqe, MTHCA_CQ_ENTRY_SIZE);
}
if (nfreed) {
for (i = 0; i < nfreed; ++i)
set_cqe_hw(get_cqe(cq, (cq->cons_index + i) & cq->ibv_cq.cqe));
wmb();
cq->cons_index += nfreed;
update_cons_index(cq, nfreed);
}
}
void mthca_cq_clean(struct mthca_cq *cq, uint32_t qpn, struct mthca_srq *srq)
{
pthread_spin_lock(&cq->lock);
__mthca_cq_clean(cq, qpn, srq);
pthread_spin_unlock(&cq->lock);
}
void mthca_cq_resize_copy_cqes(struct mthca_cq *cq, void *buf, int old_cqe)
{
int i;
/*
* In Tavor mode, the hardware keeps the consumer and producer
* indices mod the CQ size. Since we might be making the CQ
* bigger, we need to deal with the case where the producer
* index wrapped around before the CQ was resized.
*/
if (!mthca_is_memfree(cq->ibv_cq.context) && old_cqe < cq->ibv_cq.cqe) {
cq->cons_index &= old_cqe;
if (cqe_sw(cq, old_cqe))
cq->cons_index -= old_cqe + 1;
}
for (i = cq->cons_index; cqe_sw(cq, i & old_cqe); ++i)
memcpy(buf + (i & cq->ibv_cq.cqe) * MTHCA_CQ_ENTRY_SIZE,
get_cqe(cq, i & old_cqe), MTHCA_CQ_ENTRY_SIZE);
}
int mthca_alloc_cq_buf(struct mthca_device *dev, struct mthca_buf *buf, int nent)
{
int i;
if (mthca_alloc_buf(buf, align(nent * MTHCA_CQ_ENTRY_SIZE, dev->page_size),
dev->page_size))
return -1;
for (i = 0; i < nent; ++i)
((struct mthca_cqe *) buf->buf)[i].owner = MTHCA_CQ_ENTRY_OWNER_HW;
return 0;
}
| dplbsd/soc2013 | head/contrib/ofed/libmthca/src/cq.c | C | bsd-2-clause | 16,469 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2384,
13284,
8091,
4806,
1012,
2035,
2916,
9235,
1012,
1008,
9385,
1006,
1039,
1007,
2384,
11463,
5802,
11636,
6786,
5183,
1012,
2035,
2916,
9235,
1012,
1008,
9385,
1006,
1039,
1007,
2294,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php namespace Test\AcceptanceAndUnit\Interpreter\Fake;
class CommandStore implements \App\Interpreter\CommandStore
{
private static $commands = [];
public function fetch_all()
{
return self::$commands;
}
public function store(array $commands)
{
self::$commands = $commands;
}
}
| barryosull/dql-server | tests/AcceptanceAndUnit/Interpreter/Fake/CommandStore.php | PHP | mit | 335 | [
30522,
1026,
1029,
30524,
19555,
1032,
10954,
19277,
1063,
2797,
10763,
1002,
10954,
1027,
1031,
1033,
1025,
2270,
3853,
18584,
1035,
2035,
1006,
1007,
1063,
2709,
2969,
1024,
1024,
1002,
10954,
1025,
1065,
2270,
3853,
3573,
1006,
9140,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* This file is part of ankus.
*
* ankus is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ankus is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ankus. If not, see <http://www.gnu.org/licenses/>.
*/
package org.ankus.core.repository;
/**
* Persistence Object의 공통 CRUD를 정의한 Repository.
*
* @author Edward KIM
* @since 0.3
*/
public interface PersistentRepository<D, P> {
/**
* 새로운 객체를 저장한다.
*
* @param object 저장할 객체
* @param
* @param runcase
* @return 저장한 건수
*/
int insert(D object);
/**
* 지정한 객체의 정보를 업데이트한다.
*
* @param object 업데이트할 객객체
* @param runcase
* @return 업데이트 건수
*/
int update(D object);
/**
* 지정한 식별자에 해당하는 객체를 삭제한다.
*
* @param identifier 식별자
* @return 삭제한 건수
*/
int delete(P identifier);
/**
* 지정한 식별자에 해당하는 객체를 조회한다.
*
* @param identifier 식별자
* @return 식별자로 식별하는 객체
*/
D select(P identifier);
/**
* 지정한 식별자에 해당하는 객체가 존재하는지 확인한다.
*
* @param identifier 식별자
* @return 존재하는 경우 <tt>true</tt>
*/
boolean exists(P identifier);
} | onycom-ankus/ankus_analyzer_G | trunk_web/ankus-web-services/src/main/java/org/ankus/core/repository/PersistentRepository.java | Java | gpl-3.0 | 1,895 | [
30522,
1013,
1008,
1008,
1008,
2023,
5371,
2003,
2112,
1997,
2019,
22332,
1012,
1008,
1008,
2019,
22332,
2003,
2489,
4007,
1024,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1998,
1013,
2030,
19933,
1008,
2009,
2104,
1996,
3408,
1997,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
namespace AppZap\PHPFramework\Tests\Functional\Testapp\Controller;
use AppZap\PHPFramework\Mvc\AbstractController;
class IndexController extends AbstractController {
/**
* @return string
*/
public function cli() {
return '';
}
} | app-zap/PHPFramework | tests/Functional/testapp/classes/Controller/IndexController.php | PHP | bsd-2-clause | 254 | [
30522,
1026,
1029,
25718,
3415,
15327,
10439,
4143,
2361,
1032,
25718,
15643,
6198,
1032,
5852,
1032,
8360,
1032,
3231,
29098,
1032,
11486,
1025,
2224,
10439,
4143,
2361,
1032,
25718,
15643,
6198,
1032,
19842,
2278,
1032,
10061,
8663,
13181,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* $Id: ACLBrowser.h,v 1.2 2003/02/21 22:50:04 robertc Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
* ----------------------------------------------------------
*
* Squid is the result of efforts by numerous individuals from
* the Internet community; see the CONTRIBUTORS file for full
* details. Many organizations have provided support for Squid's
* development; see the SPONSORS file for full details. Squid is
* Copyrighted (C) 2001 by the Regents of the University of
* California; see the COPYRIGHT file for full details. Squid
* incorporates software developed and/or copyrighted by other
* sources; see the CREDITS file for full details.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
*
*
* Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
*/
#ifndef SQUID_ACLBROWSER_H
#define SQUID_ACLBROWSER_H
#include "ACL.h"
#include "ACLData.h"
#include "ACLRequestHeaderStrategy.h"
#include "ACLStrategised.h"
class ACLBrowser
{
private:
static ACL::Prototype RegistryProtoype;
static ACLStrategised<char const *> RegistryEntry_;
};
#endif /* SQUID_ACLBROWSER_H */
| arthurtumanyan/squid-3.0-stable1-shaga | src/ACLBrowser.h | C | gpl-2.0 | 1,826 | [
30522,
1013,
1008,
1008,
1002,
8909,
1024,
9353,
20850,
10524,
8043,
1012,
1044,
1010,
1058,
1015,
1012,
1016,
2494,
1013,
6185,
1013,
2538,
2570,
1024,
2753,
1024,
5840,
2728,
2278,
4654,
2361,
1002,
1008,
1008,
1008,
26852,
4773,
24540,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.androidtweak.inputmethod.myanmar;
import android.content.Context;
import com.androidtweak.inputmethod.keyboard.ProximityInfo;
public class SynchronouslyLoadedUserBinaryDictionary extends UserBinaryDictionary {
public SynchronouslyLoadedUserBinaryDictionary(final Context context, final String locale) {
this(context, locale, false);
}
public SynchronouslyLoadedUserBinaryDictionary(final Context context, final String locale,
final boolean alsoUseMoreRestrictiveLocales) {
super(context, locale, alsoUseMoreRestrictiveLocales);
}
@Override
public synchronized void getWords(final WordComposer codes,
final CharSequence prevWordForBigrams, final WordCallback callback,
final ProximityInfo proximityInfo) {
syncReloadDictionaryIfRequired();
getWordsInner(codes, prevWordForBigrams, callback, proximityInfo);
}
@Override
public synchronized boolean isValidWord(CharSequence word) {
syncReloadDictionaryIfRequired();
return isValidWordInner(word);
}
}
| soeminnminn/MyanmarIME | src/com/androidtweak/inputmethod/myanmar/SynchronouslyLoadedUserBinaryDictionary.java | Java | gpl-2.0 | 1,712 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2262,
1996,
11924,
2330,
3120,
2622,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2025,
2224,
2023,
5... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
module Transmat
class Money
module Arithmetic
def -@
Money.new currency, -amount
end
def == other
amount == other.amount && currencies_match?(other)
end
def eql? other
self == other
end
def <=> other
assert_matching_currencies other
amount <=> other.amount
end
def + other
assert_matching_currencies other
Money.new currency, amount + other.amount
end
def - other
assert_matching_currencies other
Money.new currency, amount - other.amount
end
def * exchange_rate
return self * exchange_rate.swap unless exchange_rate.currencies_match? self
exchange_rate.assert_matching_currencies self
Money(exchange_rate.counter_currency, amount.to_r * exchange_rate.rate)
end
end
end
end
| juliogreff/transmat | lib/transmat/money/arithmetic.rb | Ruby | mit | 873 | [
30522,
11336,
9099,
18900,
2465,
2769,
11336,
20204,
13366,
1011,
1030,
2769,
1012,
2047,
9598,
1010,
1011,
3815,
2203,
13366,
1027,
1027,
2060,
3815,
1027,
1027,
2060,
1012,
3815,
1004,
1004,
12731,
14343,
14767,
1035,
2674,
1029,
1006,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System.Threading.Tasks;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.AspNet.Identity.Owin;
using Microsoft.Owin;
using PushSystem.Models;
namespace PushSystem
{
// Configure the application user manager used in this application. UserManager is defined in ASP.NET Identity and is used by the application.
public class ApplicationUserManager : UserManager<ApplicationUser>
{
public ApplicationUserManager(IUserStore<ApplicationUser> store)
: base(store)
{
}
public static ApplicationUserManager Create(IdentityFactoryOptions<ApplicationUserManager> options, IOwinContext context)
{
var manager = new ApplicationUserManager(new UserStore<ApplicationUser>(context.Get<ApplicationDbContext>()));
// Configure validation logic for usernames
manager.UserValidator = new UserValidator<ApplicationUser>(manager)
{
AllowOnlyAlphanumericUserNames = false,
RequireUniqueEmail = true
};
// Configure validation logic for passwords
manager.PasswordValidator = new PasswordValidator
{
RequiredLength = 6,
RequireNonLetterOrDigit = true,
RequireDigit = true,
RequireLowercase = true,
RequireUppercase = true,
};
var dataProtectionProvider = options.DataProtectionProvider;
if (dataProtectionProvider != null)
{
manager.UserTokenProvider = new DataProtectorTokenProvider<ApplicationUser>(dataProtectionProvider.Create("ASP.NET Identity"));
}
return manager;
}
}
}
| chadmichel/SignalRwithWpf | PushSystem/App_Start/IdentityConfig.cs | C# | mit | 1,784 | [
30522,
2478,
2291,
1012,
11689,
2075,
1012,
8518,
1025,
2478,
7513,
1012,
2004,
2361,
7159,
1012,
4767,
1025,
2478,
7513,
1012,
2004,
2361,
7159,
1012,
4767,
1012,
9178,
15643,
6198,
1025,
2478,
7513,
1012,
2004,
2361,
7159,
1012,
4767,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Validator\Constraints;
/**
* @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
*
* @author Daniel Holmes <daniel@danielholmes.org>
* @author Bernhard Schussek <bschussek@gmail.com>
*/
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
class LessThan extends AbstractComparison
{
const TOO_HIGH_ERROR = '079d7420-2d13-460c-8756-de810eeb37d2';
protected static $errorNames = [
self::TOO_HIGH_ERROR => 'TOO_HIGH_ERROR',
];
public $message = 'This value should be less than {{ compared_value }}.';
}
| mweimerskirch/symfony | src/Symfony/Component/Validator/Constraints/LessThan.php | PHP | mit | 853 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
2023,
5371,
2003,
2112,
1997,
1996,
25353,
2213,
14876,
4890,
7427,
1012,
1008,
1008,
1006,
1039,
1007,
6904,
11283,
2078,
8962,
2368,
19562,
1026,
6904,
11283,
2078,
1030,
25353,
2213,
14876,
489... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package types
import "gopkg.in/pg.v4/internal/parser"
func AppendJSONB(b, jsonb []byte, quote int) []byte {
if quote == 1 {
b = append(b, '\'')
}
p := parser.New(jsonb)
for p.Valid() {
c := p.Read()
switch c {
case '\'':
if quote == 1 {
b = append(b, '\'', '\'')
} else {
b = append(b, '\'')
}
case '\000':
continue
case '\\':
if p.Got("u0000") {
b = append(b, "\\\\u0000"...)
} else {
b = append(b, '\\')
if p.Valid() {
b = append(b, p.Read())
}
}
default:
b = append(b, c)
}
}
if quote == 1 {
b = append(b, '\'')
}
return b
}
| yawhide/Lol-personal-counters | vendor/gopkg.in/pg.v4/types/append_jsonb.go | GO | mit | 612 | [
30522,
7427,
4127,
12324,
1000,
2175,
2361,
2243,
2290,
1012,
1999,
1013,
18720,
1012,
1058,
2549,
1013,
4722,
1013,
11968,
8043,
1000,
4569,
2278,
10439,
10497,
22578,
2239,
2497,
1006,
1038,
1010,
1046,
3385,
2497,
1031,
1033,
24880,
1010... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
GCC_VERSION := $(shell $(CONFIG_SHELL) $(PWD)/scripts/gcc-version.sh $(CROSS_COMPILE)gcc)
ifeq ($(GCC_VERSION),0404)
CFLAGS_REMOVE_msm_vfe8x.o = -Wframe-larger-than=1024
endif
ifeq ($(CONFIG_MSM_CAMERA_V4L2),y)
EXTRA_CFLAGS += -Idrivers/media/video/msm/csi
EXTRA_CFLAGS += -Idrivers/media/video/msm/io
EXTRA_CFLAGS += -Idrivers/media/video/msm/sensors
obj-$(CONFIG_MSM_CAMERA) += msm_isp.o msm.o msm_mem.o msm_mctl.o msm_mctl_buf.o msm_mctl_pp.o
obj-$(CONFIG_MSM_CAMERA) += rawchip-v4l2/ io/ sensors/ actuators/ csi/
else
ifeq ($(CONFIG_ARCH_MSM8X60),y)
obj-$(CONFIG_MSM_CAMERA) += msm_camera-8x60.o sensors/
ifeq ($(CONFIG_CAMERA_3D),y)
obj-$(CONFIG_MSM_CAMERA) += msm_camera_liteon.o sensors/
endif
else
ifeq ($(CONFIG_ARCH_MSM7X30),y)
obj-$(CONFIG_MSM_CAMERA) += msm_camera-7x30.o sensors/ rawchip/
else
obj-$(CONFIG_MSM_CAMERA) += msm_camera.o
endif
endif
endif
obj-$(CONFIG_MSM_CAMERA) += msm_axi_qos.o
ifeq ($(CONFIG_MSM_CAMERA_V4L2),y)
obj-$(CONFIG_MSM_CAMERA) += gemini/
obj-$(CONFIG_MSM_CAMERA_FLASH) += flash_v4l2.o
else
obj-$(CONFIG_MSM_CAMERA) += gemini_8x60/
ifeq ($(CONFIG_ARCH_MSM7X27A),y)
obj-$(CONFIG_MSM_CAMERA_FLASH) += flash.o
else
obj-$(CONFIG_MSM_CAMERA_FLASH) += flash_8x60.o
endif
endif
obj-$(CONFIG_ARCH_MSM_ARM11) += msm_vfe7x.o msm_io7x.o
obj-$(CONFIG_ARCH_MSM7X27A) += msm_vfe7x27a.o msm_io_7x27a.o
obj-$(CONFIG_ARCH_MSM7X30) += msm_vfe_7x30.o msm_io_7x30.o msm_vpe1_7x30.o
obj-$(CONFIG_ARCH_QSD8X50) += msm_vfe8x.o msm_vfe8x_proc.o msm_io8x.o
ifdef CONFIG_S5K4E5YX
obj-$(CONFIG_MACH_BLISS) += s5k4e5yx.o s5k4e5yx_reg_bls.o
obj-$(CONFIG_MACH_BLISSC) += s5k4e5yx.o s5k4e5yx_reg_bls.o
obj-$(CONFIG_MACH_PRIMOU) += s5k4e5yx.o s5k4e5yx_reg_pro.o
obj-$(CONFIG_MACH_PRIMOC) += s5k4e5yx.o s5k4e5yx_reg_pro.o
obj-$(CONFIG_MACH_KINGDOM) += s5k4e5yx.o s5k4e5yx_reg_kin.o
endif
ifdef CONFIG_MACH_VISION
obj-$(CONFIG_S5K4E1GX) += s5k4e1gx.o s5k4e1gx_reg.o
endif
ifeq ($(CONFIG_MSM_CAMERA_V4L2),y)
obj-$(CONFIG_ARCH_MSM8X60) += msm_io_8x60_v4l2.o msm_vfe31_v4l2.o msm_vpe_8x60_v4l2.o
else
ifdef CONFIG_CAMERA_ZSL
obj-$(CONFIG_ARCH_MSM8X60) += msm_io_8x60.o msm_vfe_8x60_ZSL.o msm_vpe1_8x60.o
else
ifdef CONFIG_CAMERA_3D
obj-$(CONFIG_ARCH_MSM8X60) += msm_io_8x60.o msm_vfe_8x60.o msm_vpe1_8x60.o
obj-$(CONFIG_ARCH_MSM8X60) += msm_vfe31_liteon.o msm_vpe1_liteon.o
else
obj-$(CONFIG_ARCH_MSM8X60) += msm_io_8x60.o msm_vfe_8x60.o msm_vpe1_8x60.o
endif
endif
endif
obj-$(CONFIG_ARCH_MSM8960) += msm_io_8960.o msm_ispif.o msm_vfe32.o msm_vpe.o
obj-$(CONFIG_MT9T013) += mt9t013.o mt9t013_reg.o
obj-$(CONFIG_SN12M0PZ) += sn12m0pz.o sn12m0pz_reg.o
obj-$(CONFIG_MT9P012) += mt9p012_reg.o
ifeq ($(CONFIG_S5K4E1),y)
ifdef CONFIG_MACH_PRIMOTD
obj-$(CONFIG_S5K4E1) += s5k4e1_td.o s5k4e1_reg_td.o
else
ifdef CONFIG_MACH_GOLFC
obj-$(CONFIG_S5K4E1) += s5k4e1_ff.o s5k4e1_reg_ff.o
else
obj-$(CONFIG_S5K4E1) += s5k4e1.o s5k4e1_reg.o
endif
endif
endif
obj-$(CONFIG_MSM_CAMERA_AF_FOXCONN) += mt9p012_fox.o
obj-$(CONFIG_MSM_CAMERA_AF_BAM) += mt9p012_bam.o
obj-$(CONFIG_MT9P012_KM) += mt9p012_km.o mt9p012_km_reg.o
obj-$(CONFIG_MT9E013) += mt9e013.o mt9e013_reg.o
obj-$(CONFIG_S5K3E2FX) += s5k3e2fx.o
ifdef CONFIG_MACH_PYRAMID
obj-$(CONFIG_S5K3H1GX) += s5k3h1gx.o s5k3h1gx_reg.o
endif
ifdef CONFIG_S5K3H1GX
obj-$(CONFIG_MACH_SPADE) += s5k3h1gx.o s5k3h1gx_reg.o
obj-$(CONFIG_MACH_VIVO) += s5k3h1gx.o s5k3h1gx_reg.o
obj-$(CONFIG_MACH_VIVOW) += s5k3h1gx.o s5k3h1gx_reg.o
obj-$(CONFIG_MACH_VIVOW_CT) += s5k3h1gx.o s5k3h1gx_reg.o
endif
#FIXME: Merge the two ifeq causes VX6953 preview not coming up.
ifeq ($(CONFIG_MSM_CAMERA_V4L2),y)
obj-$(CONFIG_VX6953) += vx6953_v4l2.o vx6953_reg_v4l2.o
obj-$(CONFIG_MT9V113) += mt9v113_v4l2.o mt9v113_ville_reg_lens_9251.o
else
obj-$(CONFIG_MT9V113) += mt9v113.o mt9v113_reg_lens_9251.o
obj-$(CONFIG_VX6953) += vx6953.o vx6953_reg.o
obj-$(CONFIG_IMX074) += imx074.o imx074_reg.o
endif
obj-$(CONFIG_QS_MT9P017) += qs_mt9p017.o qs_mt9p017_reg.o
obj-$(CONFIG_VB6801) += vb6801.o
obj-$(CONFIG_IMX072) += imx072.o imx072_reg.o
obj-$(CONFIG_WEBCAM_OV9726) += ov9726.o ov9726_reg.o
obj-$(CONFIG_WEBCAM_OV7692) += ov7692.o
obj-$(CONFIG_OV8810) += ov8810.o
obj-$(CONFIG_MT9D112) += mt9d112.o mt9d112_reg.o
obj-$(CONFIG_MT9D113) += mt9d113.o mt9d113_reg.o
| teamblueridge/SuperSickKernel | drivers/media/video/msm/Makefile | Makefile | gpl-2.0 | 4,241 | [
30522,
1043,
9468,
1035,
2544,
1024,
1027,
1002,
1006,
5806,
1002,
1006,
9530,
8873,
2290,
1035,
5806,
1007,
1002,
1006,
1052,
21724,
1007,
1013,
14546,
1013,
1043,
9468,
1011,
2544,
1012,
14021,
1002,
1006,
2892,
1035,
4012,
22090,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#!/bin/bash
set -xv
#adam-example# ./do_coadd_batch.sh MACS1115+01 W-J-B 'all exposure ' 'none' OCFI 2>&1 | tee -a OUT-coadd_W-J-B.log2
#adam-example# ./do_coadd_batch.sh ${cluster} ${filter} 'good ' 'none' 'OCFR' 'yes' 'yes' 2>&1 | tee -a OUT-coadd_${cluster}.${filter}.log
### new coaddition script
###
### the astro-/photometry can be done via SCAMP (preferred) or
### ASTROMETRIX
###
### $Id: do_coadd_batch.sh,v 1.26 2011-03-29 22:50:58 anja Exp $
#adam: you have to deactivate the astroconda environment for some reason
source deactivate astroconda
. progs.ini > /tmp/prog.out 2>&1
. bash_functions.include > /tmp/bash_functions.include.out 2>&1
##################################
export cluster=$1
export filter=$2
# possible coaddition modes:
# - "all" : all images, needs to be run first!
# - "good" : only chips with not too elliptical PSF
# - "exposure" : one coadd per exposure
# - "3s" : coadds the SDSS 3s exposure
# - "gabodsid" : split by gabodsid
# - "rotation" : split by rotation and gabodsid
# - "pretty" : coadds the deep and 3s cluster exposure
requested_coadds=$3
## of the form: "good:((fjgj=gjg)AND(hghg=fjfjf)) all:(fjf=ssss)"
custom_conditions=$4 #optional, NEEDS TO BE A FILE!!!
use_ending=$5 #optional
keep_cats=$6 #optional -> may be "yes"
keep_subs=$7 #optional -> may be "yes"
###########################
if [ -n "${custom_conditions}" ]; then
custom_conditions=`cat ${custom_conditions}`
fi
constructed_condition=
function constructConditions {
coadd_type=$1
standing_condition=$2 #always apply
default_condition=$3 #apply if no custom conditions
#look for custom conditions
custom_condition=''
for entry in ${custom_conditions}; do
custom_condition=`echo ${entry} | awk -F':' '( $1 ~ /'${coadd_type}'/){print $2}'`
if [ -n "${custom_condition}" ]; then
break
fi
done
if [ -z "${custom_condition}" ]; then
custom_condition=${default_condition}
fi
if [ -z "${standing_condition}" ] && [ -z "${custom_condition}" ]; then
constructed_condition=""
return
fi
if [ -n "${standing_condition}" ] && [ -z "${custom_condition}" ]; then
constructed_condition="${standing_condition};"
return
fi
if [ -z "${standing_condition}" ] && [ -n "${custom_condition}" ]; then
constructed_condition="${custom_condition};"
return
fi
constructed_condition="(${standing_condition}AND${custom_condition});"
return
}
######################################
export BONN_LOG=1
export BONN_TARGET=${cluster}
export BONN_FILTER=${filter}
#./BonnLogger.py clear
########################################
REDDIR=`pwd`
HEADDIR="/u/ki/awright/data/coadd_headers/"
export SUBARUDIR=/gpfs/slac/kipac/fs1/u/awright/SUBARU
##########################################
NAXIS1=10000
NAXIS2=10000
IMAGESIZE="${NAXIS1},${NAXIS2}"
export PIXSCALEOUT=0.2
################################
ASTROMMETHOD=SCAMP
ASTROMETRYCAT=`cat ${SUBARUDIR}/Scamp_cat.list | grep "${cluster}" | awk '{if(cl==$1) print $2}' cl=${cluster}`
if [ -z "$ASTROMETRYCAT" ]; then
#./BonnLogger.py comment "Can't find astrometry cat"
exit 1
fi
#adam-tried# ASTROMADD="_scamp_${ASTROMETRYCAT}"
ASTROMADD="_scamp_photom_${ASTROMETRYCAT}"
#####################################
echo ${requested_coadds}
lookupfile=/nfs/slac/g/ki/ki05/anja/SUBARU/SUBARU.list
ra=`grep ${cluster} ${lookupfile} | awk '{if(cl==$1)print $3}' cl=${cluster}`
dec=`grep ${cluster} ${lookupfile} | awk '{if(cl==$1)print $4}' cl=${cluster}`
echo ${cluster} ${ra} ${dec}
#######################################
./setup_general.sh ${SUBARUDIR}/${cluster}/${filter}/SCIENCE instrument_$$
export INSTRUMENT=`cat instrument_$$`
if [[ ( -z ${INSTRUMENT} ) || ( "${INSTRUMENT}" = "UNKNOWN" ) ]]; then
#adam# echo "setup_general failed. Probably due to BonnLogger"
#adam# SET DEFAULT INSTRUMENT=SUBARU
exit 5
fi
rm -f instrument_$$
. ${INSTRUMENT:?}.ini > /tmp/subaru.out 2>&1
if [ "${INSTRUMENT}" == "SUBARU" ]; then
#old SUBARU.ini# CONFIG=`grep 'config=' ${INSTRUMENT}.ini | sed 's/config=//g'`
CONFIG=`grep 'config=' ${INSTRUMENT}.ini | sed 's/export\ config=//g'`
echo "CONFIG=" $CONFIG
fi
########./BonnLogger.py config \
######## cluster=${cluster} \
######## filter=${filter} \
######## config=${config} \
######## ending=${ending} \
######## astrommethod=${ASTROMMETHOD} \
######## astrometrycat=${ASTROMETRYCAT} \
######################
# Find Ending
######################
case ${filter} in
"I" )
ending=mos
;;
"u" | "g" | "r" | "i" | "z" | "r_CALIB" )
if [ -f ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/*_2*.fits ]; then
testfile=`dfits ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/*_2*.fits | fitsort -d BADCCD | awk '{if($2!=1 && $1!~"sub.fits") print $0}' | awk '{if(NR==1) print $1}'`
else
testfile=`dfits ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/*_1*.fits | fitsort -d BADCCD | awk '{if($2!=1 && $1!~"sub.fits") print $0}' | awk '{if(NR==1) print $1}'`
fi
ending=C
;;
"K" )
ending=K
;;
* )
testfilename=`dfits ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/*_2*.fits | fitsort -d BADCCD | awk '{if($2!=1 && $1!~"sub.fits") print $0}' | awk '{if(NR==1) print $1}'`
testfile=${SUBARUDIR}/${cluster}/${filter}/SCIENCE/${testfilename}
echo ${testfile}
base=`basename ${testfile} .fits`
if [ -f $SUBARUDIR/$cluster/${filter}/SCIENCE/${base}I.fits ]; then
testfile=$SUBARUDIR/$cluster/${filter}/SCIENCE/${base}I.fits
fi
if [ -f $SUBARUDIR/$cluster/${filter}/SCIENCE/${base}RI.fits ]; then
testfile=$SUBARUDIR/$cluster/${filter}/SCIENCE/${base}RI.fits
fi
ending=`basename ${testfile} | awk -F'_2' '{print $2}' | awk -F'.' '{print $1}'`
;;
esac
lastchar=`echo $ending | awk '{print substr($1,length)}'`
if [ "$lastchar" = "I" ]; then
origEnding=`echo $ending | awk '{print substr($1,1,length-1)}'`
for f in `ls $SUBARUDIR/$cluster/$filter/WEIGHTS/*${origEnding}.flag.fits`;
do
base=`basename $f ${origEnding}.flag.fits`
ln -s $f $SUBARUDIR/$cluster/$filter/WEIGHTS/${base}${ending}.flag.fits
done
fi
if [ -n "${use_ending}" ]; then
ending=${use_ending}
fi
ZP=`dfits ${testfile} | fitsort -d ZP | awk '{print $2}'`
if [ "${ZP}" != "KEY_N/A" ] && [ "${INSTRUMENT}" == "MEGAPRIME" ]; then
MAGZP=${ZP}
else
MAGZP="-1.0"
fi
#####################
for coadd in ${requested_coadds}
do
if [ ${coadd} == "all" ] && [ ${filter} != "K" ] && [ ${filter} != "I" ]; then
#####################
./parallel_manager.sh ./fixbadccd_para.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE WEIGHTS ${ending}
./test_coadd_ready.sh ${SUBARUDIR}/${cluster} ${filter} ${ending} ${ASTROMETRYCAT} ${ASTROMADD}
if [ $? -gt 0 ]; then
echo "adam-Error: test_coadd_ready failed"
exit 1
fi
######################
echo "keep_cats=" $keep_cats
if [ -z "${keep_cats}" ] || [ "${keep_cats}" != "yes" ]; then #if keep_cats is unset or not "yes"
if [ -d "${SUBARUDIR}/${cluster}/${filter}/SCIENCE/cat" ]; then
rm -rf ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/cat
fi
#rm -rf /tmp/*
./parallel_manager.sh ./create_astromcats_weights_para.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE ${ending} WEIGHTS ${ending}.weight
if [ "$?" -gt "0" ]; then exit $? ; fi
./parallel_manager.sh ./check_science_PSF_para.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE ${ending}
if [ "$?" -gt "0" ]; then exit $? ; fi
#./check_science_PSF_plot.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE ${ending}
./merge_sex_ksb.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE ${ending}
if [ "$?" -gt "0" ]; then exit $? ; fi
./create_stats_table_chips.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE ${ending} headers${ASTROMADD}
if [ "$?" -gt "0" ]; then exit $? ; fi
#adam-note# this file `create_absphotom_photometrix.sh` makes the file chips_phot.cat5 that you don't actually need (it's from an old way of doing the photometry)
#adam-look# so don't worry about errors from chips_phot.cat5 or from "*Error*: found no such key: ZPCHOICE"
./create_absphotom_photometrix.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE
./check_science_PSF_plot.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE ${ending}
if [ "$?" -gt "0" ]; then exit $? ; fi
./make_checkplot_stats.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE chips.cat6 STATS ${cluster}
if [ "$?" -gt "0" ]; then exit $? ; fi
fi
rm -f instrument_$$
#########################
echo "keep_subs=" $keep_subs
if [ -z "${keep_subs}" ] || [ "${keep_subs}" != "yes" ]; then
case ${INSTRUMENT} in
"SUBARU" | "'SUBARU'" )
./parallel_manager.sh ./create_skysub_delink_para.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE ${ending} ".sub" THREEPASS
if [ "$?" -gt "0" ]; then exit $? ; fi
;;
* )
./parallel_manager.sh ./create_skysub_delink_para.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE ${ending} ".sub" TWOPASS
if [ "$?" -gt "0" ]; then exit $? ; fi
;;
esac
fi
##########################
calib=`awk 'BEGIN{if("'${filter}'"~"CALIB") print "1"; else print "0"}'`
if [ ${calib} -eq 0 ]; then
constructConditions all "" "((((RA>(${ra}-0.5))AND(RA<(${ra}+0.5)))AND((DEC>(${dec}-0.5))AND(DEC<(${dec}+0.5))))AND(SEEING<1.9))"
else
constructConditions all "" "(((RA>(${ra}-0.5))AND(RA<(${ra}+0.5)))AND((DEC>(${dec}-0.5))AND(DEC<(${dec}+0.5))))"
fi
CONDITION=${constructed_condition}
./prepare_coadd_swarp.sh -m ${SUBARUDIR}/${cluster}/${filter} \
-s SCIENCE \
-e "${ending}.sub" \
-n ${cluster}_${coadd} \
-w ".sub" \
-eh headers${ASTROMADD} \
-r ${ra} \
-d ${dec} \
-i ${IMAGESIZE} \
-p ${PIXSCALEOUT} \
-l ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/cat/chips.cat6 STATS \
${CONDITION} \
${SUBARUDIR}/${cluster}/${filter}/SCIENCE/${cluster}_${coadd}.cat
#adam-look# don't worry about errors saying '(standard_in) 1: syntax error' as long as there is only one (maybe a problem if you see this for every exposure coadd)
#adam-look# don't worry about errors saying 'cp: cannot create regular file `./coadd.head': File exists' and 'cp: cannot create regular file `coadd.flag.head': File exists'
if [ "$?" -gt "0" ]; then exit $? ; fi
./parallel_manager.sh ./apply_ringmask_para.sh ${SUBARUDIR} ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/coadd_${cluster}_${coadd} ${ending}.sub
if [ "$?" -gt "0" ]; then exit $? ; fi
./parallel_manager.sh ./resample_coadd_swarp_para.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE "${ending}.sub" ${cluster}_${coadd} ${HEADDIR}
if [ "$?" -gt "0" ]; then exit $? ; fi
./perform_coadd_swarp.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE ${cluster}_${coadd} MEDIAN
if [ "$?" -gt "0" ]; then exit $? ; fi
#adam-old# ic -p 8 '16 1 %1 1e-6 < ?' ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/coadd_${cluster}_${coadd}/coadd.weight.fits > ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/coadd_${cluster}_${coadd}/coadd.flag.fits
if [ "$?" -gt "0" ]; then exit $? ; fi
./setup_general.sh ${SUBARUDIR}/${cluster}/${filter}/SCIENCE instrument_$$
rm -f instrument_$$
./update_coadd_header.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE ${cluster}_${coadd} STATS coadd ${MAGZP} AB ${CONDITION}
exit_stat=$?
if [ "${exit_stat}" -gt "0" ]; then
echo "adam-Error: problem with update_coadd_header.sh!"
exit ${exit_stat};
fi
coaddmodes="${coaddmodes} all"
##############################
elif [ ${coadd} == "gabodsid" ]; then
GABODSIDS=`${P_LDACTOASC} -i ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/cat/chips.cat6 -t STATS -b -k GABODSID | sort | uniq | awk '{printf "%i ", $0}'`
for GABODSID in ${GABODSIDS}
do
#adam-ask# I changed it to take CONFIG into account when considering the IMAGEID!=6 cut
if [ "${CONFIG}" == "10_3" ]; then
constructConditions gabodsid "(GABODSID=${GABODSID})" ""
else
constructConditions gabodsid "((IMAGEID!=6)AND(GABODSID=${GABODSID}))" ""
fi
CONDITION=${constructed_condition}
#./prepare_coadd_swarp.sh -m ${SUBARUDIR}/${cluster}/${filter} \
# -s SCIENCE \
# -e "${ending}.sub" \
# -n ${cluster}_gabodsid${GABODSID} \
# -w ".sub" \
# -eh headers${ASTROMADD} \
# -r ${ra} \
# -d ${dec} \
# -i ${IMAGESIZE} \
# -p ${PIXSCALEOUT} \
# -l ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/cat/chips.cat6 STATS \
# ${CONDITION} \
# ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/${cluster}_gabodsid${GABODSID}.cat
./prepare_coadd_swarp_chips.sh -m ${SUBARUDIR}/${cluster}/${filter} \
-s SCIENCE \
-e "${ending}.sub" \
-n ${cluster}_gabodsid${GABODSID} \
-w ".sub" \
-eh headers${ASTROMADD} \
-r ${ra} -d ${dec} \
-i ${IMAGESIZE} \
-p ${PIXSCALEOUT} \
-l ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/cat/chips.cat8 CHIPS_STATS \
${CONDITION} \
${SUBARUDIR}/${cluster}/${filter}/SCIENCE/${cluster}_gabodsid${GABODSID}.cat
if [ "$?" -gt "0" ]; then exit $? ; fi
#maybe# -l ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/cat/chips.cat6 STATS \
./parallel_manager.sh ./resample_coadd_swarp_chips_para.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE "${ending}.sub" ${cluster}_gabodsid${GABODSID} ${HEADDIR} ${cluster}_all
if [ "$?" -gt "0" ]; then exit $? ; fi
./perform_coadd_swarp.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE ${cluster}_gabodsid${GABODSID}
if [ "$?" -gt "0" ]; then exit $? ; fi
./update_coadd_header.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE ${cluster}_gabodsid${GABODSID} CHIPS_STATS coadd ${MAGZP} AB ${CONDITION}
exit_stat=$?
if [ "${exit_stat}" -gt "0" ]; then
echo "adam-Error: problem with update_coadd_header.sh!"
exit ${exit_stat};
fi
./fix_coadd_gabodsid.py ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/coadd_${cluster}_gabodsid${GABODSID}/coadd.fits
./fix_coadd_gabodsid-update_coadd_header.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE ${cluster}_gabodsid${GABODSID} CHIPS_STATS coadd -1.0 AB
ic -p 8 '16 1 %1 1e-6 < ?' ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/coadd_${cluster}_gabodsid${GABODSID}/coadd.weight.fits > ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/coadd_${cluster}_gabodsid${GABODSID}/coadd.flag.fits
if [ "$?" -gt "0" ]; then exit $? ; fi
coaddmodes="${coaddmodes} gabodsid${GABODSID}"
done
##############################
elif [ ${coadd} == "good" ]; then
#adam-ask# is this right? I mean you could be coadding two different configs here couldn't you (I'm not sure if we should in principle, but we do in practice)
if [ "${CONFIG}" == "10_3" ]; then
#adam# constructConditions good "" "((seeing_rh_al<0.8)AND(e_abs<0.08))"
#adam# I have to have some kind of condition here. else I get an error
constructConditions good "" "(seeing_rh_al<3.5)"
else
#adam# constructConditions good "(IMAGEID!=6)" "((seeing_rh_al<0.8)AND(e_abs<0.08))"
#adam# this should only happen for MACS1226+21 10_2 "good" mode
#adam-old# constructConditions good "(IMAGEID!=6)" "((EXPOSURE!=6)AND(EXPOSURE!=7))"
constructConditions good "(IMAGEID!=6)" "(seeing_rh_al<3.5)"
fi
CONDITION=${constructed_condition}
echo "${CONDITION}"
nsub=`find ${SUBARUDIR}/${cluster}/${filter}/SCIENCE -maxdepth 1 -name "*.sub.fits" | wc -l`
if [ ${nsub} -eq 0 ]; then
case ${INSTRUMENT} in
"SUBARU" | "'SUBARU'" )
./parallel_manager.sh ./create_skysub_delink_para.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE ${ending} ".sub" THREEPASS
;;
* )
./parallel_manager.sh ./create_skysub_delink_para.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE ${ending} ".sub" TWOPASS
;;
esac
fi
./prepare_coadd_swarp_chips.sh -m ${SUBARUDIR}/${cluster}/${filter} \
-s SCIENCE \
-e "${ending}.sub" \
-n ${cluster}_${coadd} \
-w ".sub" \
-eh headers${ASTROMADD} \
-r ${ra} \
-d ${dec} \
-i ${IMAGESIZE} \
-p ${PIXSCALEOUT} \
-l ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/cat/chips.cat8 CHIPS_STATS \
${CONDITION} \
${SUBARUDIR}/${cluster}/${filter}/SCIENCE/${cluster}_${coadd}.cat
if [ "$?" -gt "0" ]; then exit $? ; fi
./parallel_manager.sh ./resample_coadd_swarp_chips_para.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE "${ending}.sub" ${cluster}_${coadd} ${HEADDIR} ${cluster}_all
if [ "$?" -gt "0" ]; then exit $? ; fi
./perform_coadd_swarp.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE ${cluster}_${coadd}
if [ "$?" -gt "0" ]; then exit $? ; fi
#adam-note# We can only read the flag values when detecting objects. Since detection is done on the "all" coadd, it's OK to have no rings in the "good" coadd
ic -p 8 '16 1 %1 1e-6 < ?' ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/coadd_${cluster}_${coadd}/coadd.weight.fits > ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/coadd_${cluster}_${coadd}/coadd.flag.fits
if [ "$?" -gt "0" ]; then exit $? ; fi
./update_coadd_header.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE ${cluster}_${coadd} CHIPS_STATS coadd ${MAGZP} AB ${CONDITION}
exit_stat=$?
if [ "${exit_stat}" -gt "0" ]; then
echo "adam-Error: problem with update_coadd_header.sh!"
exit ${exit_stat};
fi
coaddmodes="${coaddmodes} good"
##############################
### new rotation coadd: split by both night and rotation
elif [ ${coadd} == "rotation" ]; then
ROTATIONS=`${P_LDACTOASC} -i ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/cat/chips.cat6 -t STATS -b -k ROTATION | sort | uniq | awk '{printf "%i ", $0}'`
${P_LDACTOASC} -i ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/cat/chips.cat6 -t STATS -b -k GABODSID ROTATION | sort | uniq > gabrot_$$.dat
while read GABODSID ROTATION
do
#adam-ask# definitely wrong the old way, right? I changed it to take CONFIG into account when considering the IMAGEID!=6 cut
if [ "${CONFIG}" == "10_3" ]; then
constructConditions rotation "((GABODSID=${GABODSID})AND(ROTATION=${ROTATION}))" ""
else
constructConditions rotation "(((IMAGEID!=6)AND(GABODSID=${GABODSID}))AND(ROTATION=${ROTATION}))" ""
fi
CONDITION=${constructed_condition}
echo ${CONDITION}
./prepare_coadd_swarp_chips.sh -m ${SUBARUDIR}/${cluster}/${filter} \
-s SCIENCE \
-e "${ending}.sub" \
-n ${cluster}_gab${GABODSID}-rot${ROTATION} \
-w ".sub" \
-eh headers${ASTROMADD} \
-r ${ra} \
-d ${dec} \
-i ${IMAGESIZE} \
-p ${PIXSCALEOUT} \
-l ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/cat/chips.cat8 CHIPS_STATS \
${CONDITION} \
${SUBARUDIR}/${cluster}/${filter}/SCIENCE/${cluster}_gab${GABODSID}-rot${ROTATION}.cat
if [ "$?" -gt "0" ]; then exit $? ; fi
./parallel_manager.sh ./resample_coadd_swarp_chips_para.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE "${ending}.sub" ${cluster}_gab${GABODSID}-rot${ROTATION} ${HEADDIR} ${cluster}_all
if [ "$?" -gt "0" ]; then exit $? ; fi
./perform_coadd_swarp.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE ${cluster}_gab${GABODSID}-rot${ROTATION}
if [ "$?" -gt "0" ]; then exit $? ; fi
ic -p 8 '16 1 %1 1e-6 < ?' ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/coadd_${cluster}_gab${GABODSID}-rot${ROTATION}/coadd.weight.fits > ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/coadd_${cluster}_gab${GABODSID}-rot${ROTATION}/coadd.flag.fits
if [ "$?" -gt "0" ]; then exit $? ; fi
./update_coadd_header.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE ${cluster}_gab${GABODSID}-rot${ROTATION} CHIPS_STATS coadd ${MAGZP} AB ${CONDITION}
exit_stat=$?
if [ "${exit_stat}" -gt "0" ]; then
echo "adam-Error: problem with update_coadd_header.sh!"
exit ${exit_stat};
fi
coaddmodes="${coaddmodes} gab${GABODSID}-rot${ROTATION}"
done < gabrot_$$.dat
###################################
elif [ ${coadd} == "exposure" ] && [ ${filter} != "K" ] && [ ${filter} != "I" ]; then
calib=`awk 'BEGIN{if("'${filter}'"~"CALIB") print "1"; else print "0"}'`
calib="0" #adam-tmp#
if [ ${calib} -eq 0 ]; then
${P_LDACTOASC} -i ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/cat/chips.cat6 -t STATS -s -b -k EXPOSURE IMAGENAME > exposures_$$.list
while read EXPOSURE IMAGENAME
do
constructConditions exposure "(EXPOSURE=${EXPOSURE})" ""
CONDITION=${constructed_condition}
./prepare_coadd_swarp.sh -m ${SUBARUDIR}/${cluster}/${filter} \
-s SCIENCE \
-e "${ending}.sub" \
-n ${cluster}_${IMAGENAME} \
-w ".sub" \
-eh headers${ASTROMADD} \
-r ${ra} \
-d ${dec} \
-i ${IMAGESIZE} \
-p ${PIXSCALEOUT} \
-l ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/cat/chips.cat6 STATS \
${CONDITION} \
${SUBARUDIR}/${cluster}/${filter}/SCIENCE/${cluster}_${IMAGENAME}.cat
if [ "$?" -gt "0" ]; then exit $? ; fi
./parallel_manager.sh ./resample_coadd_swarp_chips_para.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE "${ending}.sub" ${cluster}_${IMAGENAME} ${HEADDIR} ${cluster}_all
if [ "$?" -gt "0" ]; then exit $? ; fi
./perform_coadd_swarp.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE ${cluster}_${IMAGENAME}
if [ "$?" -gt "0" ]; then exit $? ; fi
ic -p 8 '16 %1 %2 1e-6 < ?' ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/coadd_${cluster}_${IMAGENAME}/coadd.flag.fits ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/coadd_${cluster}_${IMAGENAME}/coadd.weight.fits | ic -p 8 '16 %1 %1 0 == ?' ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/coadd_${cluster}_${IMAGENAME}/coadd.flag.fits > ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/coadd_${cluster}_${IMAGENAME}/coadd.flag.temp.fits
if [ "$?" -gt "0" ]; then exit $? ; fi
mv ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/coadd_${cluster}_${IMAGENAME}/coadd.flag.temp.fits ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/coadd_${cluster}_${IMAGENAME}/coadd.flag.fits
./update_coadd_header.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE ${cluster}_${IMAGENAME} STATS coadd ${MAGZP} AB ${CONDITION}
exit_stat=$?
if [ "${exit_stat}" -gt "0" ]; then
echo "adam-Error: problem with update_coadd_header.sh!"
exit ${exit_stat};
fi
coaddmodes="${coaddmodes} ${IMAGENAME}"
done < exposures_$$.list
rm -f exposures_$$.list
fi
###################################
elif [ ${coadd} == "3s" ]; then
calib=`awk 'BEGIN{if("'${filter}'"~"CALIB") print "1"; else print "0"}'`
if [ ${calib} -eq 1 ]; then
./prepare_coadd_swarp_3s.sh -m ${SUBARUDIR}/${cluster}/${filter} \
-s SCIENCE \
-e "${ending}.sub" \
-n ${cluster}_${coadd} \
-w ".sub" \
-eh headers${ASTROMADD} \
-r ${ra} \
-d ${dec} \
-i ${IMAGESIZE} \
-p ${PIXSCALEOUT}
if [ "$?" -gt "0" ]; then exit $? ; fi
./parallel_manager.sh ./resample_coadd_swarp_chips_para.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE "${ending}.sub" ${cluster}_${coadd} ${HEADDIR} ${cluster}_all
if [ "$?" -gt "0" ]; then exit $? ; fi
./perform_coadd_swarp.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE ${cluster}_${coadd}
if [ "$?" -gt "0" ]; then exit $? ; fi
./update_coadd_header.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE ${cluster}_${coadd} STATS coadd ${MAGZP} AB ${CONDITION}
exit_stat=$?
if [ "${exit_stat}" -gt "0" ]; then
echo "adam-Error: problem with update_coadd_header.sh!"
exit ${exit_stat};
fi
coaddmodes="${coaddmodes} 3s"
fi
###################################
elif [ ${coadd} == "pretty" ]; then
lastchar=`echo ${ending} | awk '{print substr($1,length)}'`
if [ "$lastchar" = "R" ]; then
ending=`echo $ending | awk '{print substr($1,1,length-1)}'`
fi
if [ ! -f ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/*_2${ending}.sub.fits ]; then
./parallel_manager.sh ./create_skysub_delink_para.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE ${ending} ".sub" THREEPASS
fi
CONDITION="(((((RA>(${ra}-0.5))AND(RA<(${ra}+0.5)))AND(DEC>(${dec}-0.5)))AND(DEC<(${dec}+0.5)))AND(SEEING<1.9));"
./prepare_coadd_swarp_pretty.sh -m ${SUBARUDIR}/${cluster}/${filter} \
-s SCIENCE \
-e "${ending}.sub" \
-n ${cluster}_${coadd} \
-w ".sub" \
-eh headers${ASTROMADD} \
-r ${ra} \
-d ${dec} \
-i ${IMAGESIZE} \
-p ${PIXSCALEOUT} \
-l ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/cat/chips.cat6 STATS \
${CONDITION} \
${SUBARUDIR}/${cluster}/${filter}/SCIENCE/${cluster}_${coadd}.cat
./parallel_manager.sh ./resample_coadd_swarp_pretty_para.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE "${ending}.sub" ${cluster}_${coadd} ${HEADDIR}
./perform_coadd_swarp_pretty.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE ${cluster}_${coadd} MEDIAN
#
# ./update_coadd_header.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE ${cluster}_${coadd} STATS coadd ${MAGZP} AB ${CONDITION}
###################################
elif [ ${coadd} == "all" ] && [ ${filter} == "K" ] || [ ${filter} == "I" ]; then
if [ -d ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/coadd_${cluster}_all ]; then
rm -rf ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/coadd_${cluster}_all
fi
mkdir ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/coadd_${cluster}_all
cd ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/coadd_${cluster}_all
imagebase=`basename ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/*_1${ending}.fits ${ending}.fits`
cp ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/headers${ASTROMADD}/${imagebase}.head \
${SUBARUDIR}/${cluster}/${filter}/SCIENCE/${imagebase}${ending}.head
swarp ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/${imagebase}${ending}.fits \
-WEIGHT_IMAGE ${SUBARUDIR}/${cluster}/${filter}/WEIGHTS/${imagebase}${ending}.weight.fits \
-WEIGHT_TYPE MAP_WEIGHT \
-IMAGE_SIZE ${IMAGESIZE} -CENTER_TYPE MANUAL -CENTER ${ra},${dec} -PIXELSCALE_TYPE MANUAL -PIXEL_SCALE ${PIXSCALEOUT} \
-IMAGEOUT_NAME ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/coadd_${cluster}_all/coadd.fits
${P_IC} -p 8 '16 1 %1 0 == ?' ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/coadd_${cluster}_all/coadd.weight.fits > ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/coadd_${cluster}_all/coadd.flag.fits
fthedit coadd.fits DUMMY0 add 0
fthedit coadd.fits DUMMY1 add 0
fthedit coadd.fits DUMMY2 add 0
fthedit coadd.fits DUMMY3 add 0
fthedit coadd.fits DUMMY4 add 0
fthedit coadd.fits DUMMY5 add 0
fthedit coadd.fits DUMMY6 add 0
fthedit coadd.fits DUMMY7 add 0
fthedit coadd.fits DUMMY8 add 0
fthedit coadd.fits DUMMY9 add 0
MAGZERO1=`dfits ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/${imagebase}${ending}.fits | fitsort -d MAGZERO1 | awk '{print $2}'`
MAG_ZERO=`dfits ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/${imagebase}${ending}.fits | fitsort -d MAG_ZERO | awk '{print $2}'`
EXPTIME=`dfits ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/${imagebase}${ending}.fits | fitsort -d EXPTIME | awk '{print $2}'`
if [ "${MAGZERO1}" != "KEY_N/A" ]; then
MAGZP=${MAGZERO1}
elif [ ${filter} == "K" ] && [ "${MAG_ZERO}" != "KEY_N/A" ]; then
MAGZP=`awk 'BEGIN{print '${MAG_ZERO}'-2.5*log('${EXPTIME}')/log(10)+1.85}'` # vega to AB
else
MAGZP="-1.0"
fi
cd ${REDDIR}
./update_coadd_header.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE ${cluster}_${coadd} STATS coadd ${MAGZP} AB ${CONDITION}
exit_stat=$?
if [ "${exit_stat}" -gt "0" ]; then
echo "adam-Error: problem with update_coadd_header.sh!"
exit ${exit_stat};
fi
value ${EXPTIME}
writekey ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/coadd_${cluster}_${coadd}/coadd.fits EXPTIME "${VALUE} / exposure time" REPLACE
if [ ${filter} == "I" ]; then
GAIN=2.1
elif [ ${filter} == "K" ]; then
GAIN=3.8
fi
GAINEFF=`awk 'BEGIN{print '${GAIN}'*'${EXPTIME}'}'`
value ${GAINEFF}
writekey ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/coadd_${cluster}_${coadd}/coadd.fits GAIN "${VALUE} / effective gain" REPLACE
coaddmodes="${coaddmodes} all"
###################################
else
constructConditions ${coadd} "(SEEING<1.9)" ""
CONDITION=${constructed_condition}
./prepare_coadd_swarp_chips.sh -m ${SUBARUDIR}/${cluster}/${filter} \
-s SCIENCE \
-e "${ending}.sub" \
-n ${cluster}_${coadd} \
-w ".sub" \
-eh headers${ASTROMADD} \
-r ${ra} \
-d ${dec} \
-i ${IMAGESIZE} \
-p ${PIXSCALEOUT} \
-l ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/cat/chips.cat8 CHIPS_STATS \
${CONDITION} \
${SUBARUDIR}/${cluster}/${filter}/SCIENCE/${cluster}_${coadd}.cat
if [ "$?" -gt "0" ]; then exit $? ; fi
./parallel_manager.sh ./resample_coadd_swarp_chips_para.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE "${ending}.sub" ${cluster}_${coadd} ${HEADDIR} ${cluster}_all
if [ "$?" -gt "0" ]; then exit $? ; fi
./perform_coadd_swarp.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE ${cluster}_${coadd}
if [ "$?" -gt "0" ]; then exit $? ; fi
ic -p 8 '16 1 %1 1e-6 < ?' ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/coadd_${cluster}_${coadd}/coadd.weight.fits > ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/coadd_${cluster}_${coadd}/coadd.flag.fits
if [ "$?" -gt "0" ]; then exit $? ; fi
./update_coadd_header.sh ${SUBARUDIR}/${cluster}/${filter} SCIENCE ${cluster}_${coadd} CHIPS_STATS coadd ${MAGZP} AB ${CONDITION}
exit_stat=$?
if [ "${exit_stat}" -gt "0" ]; then
echo "adam-Error: problem with update_coadd_header.sh!"
exit ${exit_stat};
fi
coaddmodes="${coaddmodes} ${coadd}"
fi
done
for coaddmode in ${coaddmodes}
do
echo ${coaddmode}
### add header keywords
value ${cluster}
writekey ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/coadd_${cluster}_${coaddmode}/coadd.fits OBJECT "${VALUE} / Target" REPLACE
value ${filter}
writekey ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/coadd_${cluster}_${coaddmode}/coadd.fits FILTER "${VALUE} / Filter" REPLACE
### update photometry
if [ -f "${SUBARUDIR}/${cluster}/${filter}/SCIENCE/cat/chips_phot.cat5" ]; then
MAGZP=`${P_LDACTOASC} -i ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/cat/chips_phot.cat5 -t ABSPHOTOM -k COADDZP | tail -n 1`
value ${MAGZP}
writekey ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/coadd_${cluster}_${coaddmode}/coadd.fits MAGZP "${VALUE} / Magnitude zeropoint" REPLACE
else
MAGZP=-1.0
fi
### make PSF plots, and write star reference catalog
./check_psf_coadd.sh ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/coadd_${cluster}_${coaddmode} coadd.fits
if [ "$?" -gt "0" ]; then exit $? ; fi
# if [ ${filter} == "K" ]; then
# ./fit_phot_K.sh ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/coadd_${cluster}_${coaddmode} coadd.fits
# fi
done
if [ ! -d ${SUBARUDIR}/${cluster}/coadds_together_${cluster} ]; then
mkdir ${SUBARUDIR}/${cluster}/coadds_together_${cluster}
mkdir ${SUBARUDIR}/${cluster}/coadds_together_${cluster}/flags
mkdir ${SUBARUDIR}/${cluster}/coadds_together_${cluster}/weights
fi
for coadd_dir in `\ls -d ${SUBARUDIR}/${cluster}/${filter}/SCIENCE/coadd_${cluster}_*/`
do
coadd_name=`basename ${coadd_dir} `
ln -s ${coadd_dir}/coadd.fits ${SUBARUDIR}/${cluster}/coadds_together_${cluster}/${coadd_name}.${filter}.fits
ln -s ${coadd_dir}/coadd.flag.fits ${SUBARUDIR}/${cluster}/coadds_together_${cluster}/flags/${coadd_name}.${filter}.flag.fits
ln -s ${coadd_dir}/coadd.weight.fits ${SUBARUDIR}/${cluster}/coadds_together_${cluster}/weights/${coadd_name}.${filter}.weight.fits
done
echo "adam-look: ds9e ${SUBARUDIR}/${cluster}/coadds_together_${cluster}/coadd_${cluster}_*.fits &"
#adam# may want to run this to make plots of how good the exposures are (might want to throw out bad ones!): ./Plot_cluster_seeing_e1e2.py ${cluster}
| deapplegate/wtgpipeline | adam_do_coadd_batch.sh | Shell | mit | 37,258 | [
30522,
1001,
999,
1013,
8026,
1013,
24234,
2275,
1011,
15566,
1001,
4205,
1011,
2742,
1001,
1012,
1013,
2079,
1035,
28155,
14141,
1035,
14108,
1012,
14021,
6097,
2015,
14526,
16068,
1009,
5890,
1059,
1011,
1046,
1011,
1038,
1005,
2035,
7524... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<html>
<body>
Hello DBC!
<br/>
<br/>
<a href="http://jcolomer.github.io/blog-posts/week1_technical.html">Week 1 Technical: Analyzing the 3 sites in terms of user experience and design.</a>
<br/>
<br/>
<a href="http://jcolomer.github.io/blog-posts/week1_cultural.html">Week 1: Initial impressions of DBC</a>
</body>
</html> | jcolomer/jcolomer.github.io | old-index.html | HTML | mit | 326 | [
30522,
1026,
16129,
1028,
1026,
2303,
1028,
7592,
16962,
2278,
999,
1026,
7987,
1013,
1028,
1026,
7987,
1013,
1028,
1026,
1037,
17850,
12879,
1027,
1000,
8299,
1024,
1013,
1013,
29175,
12898,
5017,
1012,
21025,
2705,
12083,
1012,
22834,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
use yii\helpers\Url;
?>
<div class="bjui-pageContent">
<form action="<?= Url::toRoute([$model?'update':'create','name'=>$model?$model->name:'']) ?>" id="user_form" data-toggle="validate" data-alertmsg="false">
<input name="_csrf" type="hidden" id="_csrf" value="<?= Yii::$app->request->csrfToken ?>">
<table class="table table-condensed table-hover" width="100%">
<tbody>
<tr>
<td><label for="name" class="control-label x120">规则名称:</label> <input type="text" name="name" id="name" value="<?= $model?$model->name:''; ?>" data-rule="required" size="20"></td>
</tr>
<tr>
<td><label for="class" class="control-label x120">规则类名:</label> <input type="text" name="class" id="class" value="<?= $model?$model::className():''; ?>" data-rule="required" size="35"></td>
</tr>
</tbody>
</table>
</form>
</div>
<div class="bjui-pageFooter">
<ul>
<li>
<button type="button" class="btn-close" data-icon="close">取消</button>
</li>
<li>
<button type="submit" class="btn-default" data-icon="save">保存</button>
</li>
</ul>
</div>
| 171906502/wetM2.0 | backend/modules/core/views/rule/view.php | PHP | bsd-3-clause | 1,266 | [
30522,
1026,
1029,
25718,
2224,
12316,
2072,
1032,
2393,
2545,
1032,
24471,
2140,
1025,
1029,
1028,
1026,
4487,
2615,
2465,
1027,
1000,
1038,
9103,
2072,
1011,
3931,
8663,
6528,
2102,
1000,
1028,
1026,
2433,
2895,
1027,
1000,
1026,
1029,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
"use strict";
const hamt = require('../hamt');
const assert = require('chai').assert;
describe('entries', () => {
it('should be empty for empty map', () => {
const h = hamt.make();
const it = hamt.entries(h);
let v = it.next();
assert.ok(v.done);
for (let x of h)
assert.isFalse(true);
});
it('should visit single child', () => {
const h = hamt.make().set('a', 3);
const it = hamt.entries(h);
let v = it.next();
assert.deepEqual(['a', 3], v.value);
assert.notOk(v.done);
v = it.next();
assert.ok(v.done);
assert.deepEqual([['a', 3]], Array.from(h));
});
it('should visit all children', () => {
const h = hamt.make()
.set('a', 3)
.set('b', 5)
.set('c', 7);
const expected = [['a', 3], ['b', 5], ['c', 7]];
{
const it = h.entries();
const results = [];
let v;
for (var i = 0; i < h.count(); ++i) {
v = it.next();
assert.notOk(v.done);
results.push(v.value)
}
v = it.next();
assert.isTrue(v.done);
assert.deepEqual(expected, results);
}
assert.deepEqual(expected, Array.from(h));
});
it('should handle collisions', () => {
const h = hamt.make()
.setHash(0, 'a', 3)
.setHash(0, 'b', 5)
.setHash(0, 'c', 7)
const expected = [['b', 5], ['a', 3], ['c', 7]];
{
const it = h.entries();
const results = [];
let v;
for (var i = 0; i < h.count(); ++i) {
v = it.next();
assert.notOk(v.done);
results.push(v.value)
}
v = it.next();
assert.isTrue(v.done);
assert.deepEqual(expected, results);
}
assert.deepEqual(expected, Array.from(h));
});
it('should handle large map correctly', () => {
let h = hamt.make();
let sum = 0;
for (let i = 0; i < 20000; ++i) {
h = h.set(i + '', i);
sum += i;
}
let foundSum = 0;
for (let x of h)
foundSum += x[1];
assert.strictEqual(sum, foundSum);
});
});
| mattbierner/hamt_plus | tests/entries.js | JavaScript | mit | 2,486 | [
30522,
1000,
2224,
9384,
1000,
1025,
9530,
3367,
10654,
2102,
1027,
5478,
1006,
1005,
1012,
1012,
1013,
10654,
2102,
1005,
1007,
1025,
9530,
3367,
20865,
1027,
5478,
1006,
1005,
15775,
2072,
1005,
1007,
1012,
20865,
1025,
6235,
1006,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
var dir_2e0ad737c5a35fd799870b9d14d04fcf =
[
[ "main.cpp", "TestOpenGl_2TestOpenGl_2main_8cpp.html", "TestOpenGl_2TestOpenGl_2main_8cpp" ],
[ "objloader.cpp", "objloader_8cpp.html", null ],
[ "objloader.h", "objloader_8h.html", [
[ "coordinate", "structcoordinate.html", "structcoordinate" ],
[ "face", "structface.html", "structface" ],
[ "material", "structmaterial.html", "structmaterial" ],
[ "texcoord", "structtexcoord.html", "structtexcoord" ],
[ "objloader", "classobjloader.html", "classobjloader" ]
] ]
]; | will421/StartAir_Safe | html/dir_2e0ad737c5a35fd799870b9d14d04fcf.js | JavaScript | gpl-3.0 | 561 | [
30522,
13075,
16101,
1035,
1016,
2063,
2692,
4215,
2581,
24434,
2278,
2629,
2050,
19481,
2546,
2094,
2581,
2683,
2683,
2620,
19841,
2497,
2683,
2094,
16932,
2094,
2692,
2549,
11329,
2546,
1027,
1031,
1031,
1000,
2364,
1012,
18133,
2361,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# alfirahadian.github.io
Building Hybrid Web Application with Ionic from start to end
| alfirahadian/parade_web | README.md | Markdown | mit | 86 | [
30522,
1001,
24493,
7895,
16102,
2937,
1012,
21025,
2705,
12083,
1012,
22834,
2311,
8893,
4773,
4646,
2007,
24774,
2013,
2707,
2000,
2203,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# pgen
Perl program to generate XKCD-style passwords
## License
I want there to be NO barriers to using this code, so I am releasing it to the public domain. But "public domain" does not have an internationally agreed upon definition, so I use CC0:
Copyright 2017 Steven Ford http://geeky-boy.com and licensed
"public domain" style under
[CC0](http://creativecommons.org/publicdomain/zero/1.0/):

To the extent possible under law, the contributors to this project have
waived all copyright and related or neighboring rights to this work.
In other words, you can use this code for any purpose without any
restrictions. This work is published from: United States. The project home
is https://github.com/fordsfords/pgen
To contact me, Steve Ford, project owner, you can find my email address
at http://geeky-boy.com. Can't see it? Keep looking.
## Introduction
XKCD had an excellent comic -- https://xkcd.com/936/ -- which proposed a style of password generation consisting of randomly selecting 4 words from a list of ~2000 common words. The result is a password which is more secure and easier to remember than most common methods of password creation.
The pgen program uses a list of 3000 common english words and randomly selects some for a password. I used the program to produce some mildly-interesting results in [my blog](http://blog.geeky-boy.com/2017/07/i-got-to-thinking-about-passwords-again.html).
Here are the interesting features of the program:
* It starts with a set of 3000 words that I put together.
I make use of several "lists of common words" for suggestions, including
[Education First](http://www.ef.edu/english-resources/english-vocabulary/top-3000-words/)
and [Wikipedia](https://en.wiktionary.org/wiki/Wiktionary:Frequency_lists/Contemporary_fiction).
But this is not a simple copy of any of the lists, and I consider it
my own.
I wanted them to be words that most people would understand and know how to
spell.
* It can either use Perl's internal pseudo-random number generator (useful for experimentation and statistics gathering), or it can get random numbers from https://random.org which makes the resulting password properly secure.
You can get help by entering:
./pgen.pl -h
Important: if you plan to actually use the passwords you generate, use "-r"! [Here's why](http://blog.geeky-boy.com/2017/07/pseudo-random-passwords-limit-entropy.html).
To try it out without downloading it, go here:
https://repl.it/@fordsfords/pgen#README.md
Click on the right-hand panel and enter:
./pgen.pl -r
| fordsfords/pgen | README.md | Markdown | cc0-1.0 | 2,622 | [
30522,
1001,
18720,
2368,
2566,
2140,
2565,
2000,
9699,
1060,
2243,
19797,
1011,
2806,
20786,
2015,
1001,
1001,
6105,
1045,
2215,
2045,
2000,
2022,
2053,
13500,
2000,
2478,
2023,
3642,
1010,
2061,
1045,
2572,
8287,
2009,
2000,
1996,
2270,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/********************************************************************
FileName: HardwareProfile - PIC24F Starter Kit.h
Dependencies: See INCLUDES section
Processor: PIC24FJ256GB106
Hardware: PIC24F Starter Kit
Compiler: Microchip C30
Company: Microchip Technology, Inc.
Software License Agreement:
The software supplied herewith by Microchip Technology Incorporated
(the Company) for its PIC® Microcontroller is intended and
supplied to you, the Companys customer, for use solely and
exclusively on Microchip PIC Microcontroller products. The
software is owned by the Company and/or its supplier, and is
protected under applicable copyright laws. All rights are reserved.
Any use in violation of the foregoing restrictions may subject the
user to criminal sanctions under applicable laws, as well as to
civil liability for the breach of the terms and conditions of this
license.
THIS SOFTWARE IS PROVIDED IN AN AS IS CONDITION. NO WARRANTIES,
WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
********************************************************************
File Description:
Change History:
Rev Date Description
1.0 11/19/2004 Initial release
2.1 02/26/2007 Updated for simplicity and to use common
coding style
2.3 09/15/2008 Broke out each hardware platform into its own
"HardwareProfile - xxx.h" file
********************************************************************/
#ifndef HARDWARE_PROFILE_PIC24F_STARTER_KIT_H
#define HARDWARE_PROFILE_PIC24F_STARTER_KIT_H
/*******************************************************************/
/******** USB stack hardware selection options *********************/
/*******************************************************************/
//This section is the set of definitions required by the MCHPFSUSB
// framework. These definitions tell the firmware what mode it is
// running in, and where it can find the results to some information
// that the stack needs.
//These definitions are required by every application developed with
// this revision of the MCHPFSUSB framework. Please review each
// option carefully and determine which options are desired/required
// for your application.
//#define USE_SELF_POWER_SENSE_IO
#define tris_self_power TRISAbits.TRISA2 // Input
#define self_power 1
//#define USE_USB_BUS_SENSE_IO
#define tris_usb_bus_sense U1OTGSTATbits.SESVD //TRISBbits.TRISB5 // Input
#define USB_BUS_SENSE U1OTGSTATbits.SESVD
//Uncomment this to make the output HEX of this project
// to be able to be bootloaded using the HID bootloader
#define PROGRAMMABLE_WITH_USB_HID_BOOTLOADER
//If the application is going to be used with the HID bootloader
// then this will provide a function for the application to
// enter the bootloader from the application (optional)
#if defined(PROGRAMMABLE_WITH_USB_HID_BOOTLOADER)
#define EnterBootloader() __asm__("goto 0x400")
#endif
/*******************************************************************/
/*******************************************************************/
/*******************************************************************/
/******** Application specific definitions *************************/
/*******************************************************************/
/*******************************************************************/
/*******************************************************************/
/** Board definition ***********************************************/
//These defintions will tell the main() function which board is
// currently selected. This will allow the application to add
// the correct configuration bits as wells use the correct
// initialization functions for the board. These defitions are only
// required in the stack provided demos. They are not required in
// final application design.
#define DEMO_BOARD PIC24F_STARTER_KIT
#define PIC24F_STARTER_KIT
#define CLOCK_FREQ 32000000
/** LED ************************************************************/
#define mInitAllLEDs() LATG &= 0xFE1F; TRISG &= 0xFE1F; LATF &= 0xFFCF; TRISF &= 0xFFCF; //G6,7,8,9 and F4,5
#define mGetLED_1() (TRISG & ~0x0180?1:0)
#define mGetLED_2() (TRISG & ~0x0060?1:0)
#define mGetLED_3() (TRISF & ~0x0030?1:0)
#define mGetLED_4()
#define mLED_1_On() TRISG |= 0x0180;
#define mLED_2_On() TRISG |= 0x0060;
#define mLED_3_On() TRISF |= 0x0030;
#define mLED_4_On()
#define mLED_1_Off() TRISG &= ~0x0180;
#define mLED_2_Off() TRISG &= ~0x0060;
#define mLED_3_Off() TRISF &= ~0x0030;
#define mLED_4_Off()
#define mLED_1_Toggle() TRISG ^= 0x0180;
#define mLED_2_Toggle() TRISG ^= 0x0060;
#define mLED_3_Toggle() TRISF ^= 0x0030;
#define mLED_4_Toggle()
/** SWITCH *********************************************************/
#define mInitSwitch2() TRISDbits.TRISD6=1;
#define mInitSwitch3() TRISDbits.TRISD7=1;
#define mInitAllSwitches() mInitSwitch2();mInitSwitch3();
#define sw2 PORTDbits.RD6
#define sw3 PORTDbits.RD7
/** I/O pin definitions ********************************************/
#define INPUT_PIN 1
#define OUTPUT_PIN 0
#endif //HARDWARE_PROFILE_PIC24F_STARTER_KIT_H
| andrasfuchs/LibUsbDotNet | stage/Benchmark/Firmware/Microchip Solutions/Device_Benchmark/Firmware/HardwareProfile - PIC24F Starter Kit.h | C | lgpl-3.0 | 6,073 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>The count purpose</title>
</head>
<body><div class="manualnavbar" style="text-align: center;">
<div class="prev" style="text-align: left; float: left;"><a href="yaf-config-ini.construct.html">Yaf_Config_Ini::__construct</a></div>
<div class="next" style="text-align: right; float: right;"><a href="yaf-config-ini.current.html">Yaf_Config_Ini::current</a></div>
<div class="up"><a href="class.yaf-config-ini.html">Yaf_Config_Ini</a></div>
<div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="yaf-config-ini.count" class="refentry">
<div class="refnamediv">
<h1 class="refname">Yaf_Config_Ini::count</h1>
<p class="verinfo">(PECL yaf >=1.0.0)</p><p class="refpurpose"><span class="refname">Yaf_Config_Ini::count</span> — <span class="dc-title">The count purpose</span></p>
</div>
<div class="refsect1 description" id="refsect1-yaf-config-ini.count-description">
<h3 class="title">Description</h3>
<div class="methodsynopsis dc-description">
<span class="modifier">public</span> <span class="type"><span class="type void">void</span></span> <span class="methodname"><strong>Yaf_Config_Ini::count</strong></span>
( <span class="methodparam">void</span>
)</div>
<p class="para rdfs-comment">
</p>
<div class="warning"><strong class="warning">Warning</strong><p class="simpara">This function is
currently not documented; only its argument list is available.
</p></div>
</div>
<div class="refsect1 parameters" id="refsect1-yaf-config-ini.count-parameters">
<h3 class="title">Parameters</h3>
<p class="para">This function has no parameters.</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-yaf-config-ini.count-returnvalues">
<h3 class="title">Return Values</h3>
<p class="para">
</p>
</div>
</div><hr /><div class="manualnavbar" style="text-align: center;">
<div class="prev" style="text-align: left; float: left;"><a href="yaf-config-ini.construct.html">Yaf_Config_Ini::__construct</a></div>
<div class="next" style="text-align: right; float: right;"><a href="yaf-config-ini.current.html">Yaf_Config_Ini::current</a></div>
<div class="up"><a href="class.yaf-config-ini.html">Yaf_Config_Ini</a></div>
<div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
| Sliim/sleemacs | php-manual/yaf-config-ini.count.html | HTML | gpl-3.0 | 2,486 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
16129,
1018,
1012,
5890,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
8917,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
'use strict'
const _toArray = require('lodash.toarray')
const shelljs = require('shelljs')
module.exports = function (config) {
// parse loader
[
'loaders',
'preLoaders',
'postLoaders'
].forEach(key => {
config.module[key] = _toArray(config.module[key])
})
// parse plugin
config.plugins = _toArray(config.plugins)
// install resolve path
require('./load-resolve-path')(config)
if (process.env.NODE_ENV === 'development') {
// install dev server
config.devServer = require('../util/load-server')(config.devServer)
if (config.devServer.enable) {
config.devServer.host = config.devServer.protocol + '//' + config.devServer.hostname + ':' + config.devServer.port
}
// update path
config.output.publicPath = config.devServer.publicPath || config.output.publicPath || '/'
}
// load hot loader
config.entry = require('./hot-reload')(
config.entry,
process.env.NODE_ENV === 'development' ? config.devServer : false
)
if (config.__XDC_CLEAN__) {
shelljs.rm('-rf', config.output.path)
}
return config
}
| x-xdc/xdc | packages/xdc/util/parse.js | JavaScript | mit | 1,092 | [
30522,
1005,
2224,
9384,
1005,
9530,
3367,
1035,
2000,
2906,
9447,
1027,
5478,
1006,
1005,
8840,
8883,
2232,
1012,
2000,
2906,
9447,
1005,
1007,
9530,
3367,
5806,
22578,
1027,
5478,
1006,
1005,
5806,
22578,
1005,
1007,
11336,
1012,
14338,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2011-2019 Amazon.com, Inc. or its affiliates. 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.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.amazonaws.transform;
import java.lang.reflect.Constructor;
import com.amazonaws.AmazonServiceException;
public abstract class AbstractErrorUnmarshaller<T> implements Unmarshaller<AmazonServiceException, T> {
/**
* The type of AmazonServiceException that will be instantiated. Subclasses
* specialized for a specific type of exception can control this through the
* protected constructor.
*/
protected final Class<? extends AmazonServiceException> exceptionClass;
/**
* Constructs a new error unmarshaller that will unmarshall error responses
* into AmazonServiceException objects.
*/
public AbstractErrorUnmarshaller() {
this(AmazonServiceException.class);
}
/**
* Constructs a new error unmarshaller that will unmarshall error responses
* into objects of the specified class, extending AmazonServiceException.
*
* @param exceptionClass
* The subclass of AmazonServiceException which will be
* instantiated and populated by this class.
*/
public AbstractErrorUnmarshaller(Class<? extends AmazonServiceException> exceptionClass) {
this.exceptionClass = exceptionClass;
}
/**
* Constructs a new exception object of the type specified in this class's
* constructor and sets the specified error message.
*
* @param message
* The error message to set in the new exception object.
*
* @return A new exception object of the type specified in this class's
* constructor and sets the specified error message.
*
* @throws Exception
* If there are any problems using reflection to invoke the
* exception class's constructor.
*/
protected AmazonServiceException newException(String message) throws Exception {
Constructor<? extends AmazonServiceException> constructor = exceptionClass.getConstructor(String.class);
return constructor.newInstance(message);
}
}
| jentfoo/aws-sdk-java | aws-java-sdk-core/src/main/java/com/amazonaws/transform/AbstractErrorUnmarshaller.java | Java | apache-2.0 | 2,633 | [
30522,
1013,
1008,
1008,
9385,
2249,
1011,
10476,
9733,
1012,
4012,
1010,
4297,
1012,
2030,
2049,
18460,
1012,
2035,
2916,
9235,
1012,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* Specify a custom persister.
*
* @author Shawn Clowater
*/
@java.lang.annotation.Target( { ElementType.TYPE, ElementType.METHOD, ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
public @interface Persister {
/**
* The custom persister class.
*/
Class<?> impl();
}
| 1fechner/FeatureExtractor | sources/FeatureExtractor/lib/hibernate-release-5.1.0.Final/project/hibernate-core/src/main/java/org/hibernate/annotations/Persister.java | Java | lgpl-2.1 | 686 | [
30522,
1013,
1008,
1008,
7632,
5677,
12556,
1010,
28771,
28297,
2005,
8909,
18994,
12070,
9262,
1008,
1008,
6105,
1024,
27004,
8276,
2236,
2270,
6105,
1006,
1048,
21600,
2140,
1007,
1010,
2544,
1016,
1012,
1015,
2030,
2101,
1012,
1008,
2156... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#!/usr/bin/env python3
# vim: set encoding=utf-8 tabstop=4 softtabstop=4 shiftwidth=4 expandtab
#########################################################################
# Parts Copyright 2016 C. Strassburg (lib.utils) c.strassburg@gmx.de
# Copyright 2017- Serge Wagener serge@wagener.family
#########################################################################
# This file is part of SmartHomeNG
#
# SmartHomeNG is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# SmartHomeNG is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with SmartHomeNG If not, see <http://www.gnu.org/licenses/>.
#########################################################################
"""
| *** ATTENTION: This is early work in progress. Interfaces are subject to change. ***
| *** DO NOT USE IN PRODUCTION until you know what you are doing ***
|
This library contains the future network classes for SmartHomeNG.
New network functions and utilities are going to be implemented in this library.
This classes, functions and methods are mainly meant to be used by plugin developers
"""
import logging
import re
import ipaddress
import requests
import select
import socket
import threading
import time
import queue
class Network(object):
""" This Class has some usefull static methods that you can use in your projects """
@staticmethod
def is_mac(mac):
"""
Validates a MAC address
:param mac: MAC address
:type string: str
:return: True if value is a MAC
:rtype: bool
"""
mac = str(mac)
if len(mac) == 12:
for c in mac:
try:
if int(c, 16) > 15:
return False
except:
return False
return True
octets = re.split('[\:\-\ ]', mac)
if len(octets) != 6:
return False
for i in octets:
try:
if int(i, 16) > 255:
return False
except:
return False
return True
@staticmethod
def is_ip(string):
"""
Checks if a string is a valid ip-address (v4 or v6)
:param string: String to check
:type string: str
:return: True if an ip, false otherwise.
:rtype: bool
"""
return (Network.is_ipv4(string) or Network.is_ipv6(string))
@staticmethod
def is_ipv4(string):
"""
Checks if a string is a valid ip-address (v4)
:param string: String to check
:type string: str
:return: True if an ip, false otherwise.
:rtype: bool
"""
try:
ipaddress.IPv4Address(string)
return True
except ipaddress.AddressValueError:
return False
@staticmethod
def is_ipv6(string):
"""
Checks if a string is a valid ip-address (v6)
:param string: String to check
:type string: str
:return: True if an ipv6, false otherwise.
:rtype: bool
"""
try:
ipaddress.IPv6Address(string)
return True
except ipaddress.AddressValueError:
return False
@staticmethod
def is_hostname(string):
"""
Checks if a string is a valid hostname
The hostname has is checked to have a valid format
:param string: String to check
:type string: str
:return: True if a hostname, false otherwise.
:rtype: bool
"""
try:
return bool(re.match("^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$", string))
except TypeError:
return False
@staticmethod
def get_local_ipv4_address():
"""
Get's local ipv4 address of the interface with the default gateway.
Return '127.0.0.1' if no suitable interface is found
:return: IPv4 address as a string
:rtype: string
"""
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
try:
s.connect(('8.8.8.8', 1))
IP = s.getsockname()[0]
except:
IP = '127.0.0.1'
finally:
s.close()
return IP
@staticmethod
def get_local_ipv6_address():
"""
Get's local ipv6 address of the interface with the default gateway.
Return '::1' if no suitable interface is found
:return: IPv6 address as a string
:rtype: string
"""
s = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
try:
s.connect(('2001:4860:4860::8888', 1))
IP = s.getsockname()[0]
except:
IP = '::1'
finally:
s.close()
return IP
@staticmethod
def ip_port_to_socket(ip, port):
"""
Returns an ip address plus port to a socket string.
Format is 'ip:port' for IPv4 or '[ip]:port' for IPv6
:return: Socket address / IPEndPoint as string
:rtype: string
"""
if Network.is_ipv6(ip):
ip = '[{}]'.format(ip)
return '{}:{}'.format(ip, port)
@staticmethod
def ipver_to_string(ipver):
"""
Converts a socket address family to an ip version string 'IPv4' or 'IPv6'
:param ipver: Socket family
:type ipver: socket.AF_INET or socket.AF_INET6
:return: 'IPv4' or 'IPv6'
:rtype: string
"""
return 'IPv6' if ipver == socket.AF_INET6 else 'IPv4'
class Http(object):
"""
Creates an instance of the Http class.
:param baseurl: base URL used everywhere in this instance (example: http://www.myserver.tld)
:type baseurl: str
"""
def __init__(self, baseurl=None):
self.logger = logging.getLogger(__name__)
self.baseurl = baseurl
self._response = None
self.timeout = 10
def get_json(self, url=None, params=None):
"""
Launches a GET request and returns JSON answer as a dict or None on error.
:param url: Optional URL to fetch from. If None (default) use baseurl given on init.
:param params: Optional dict of parameters to add to URL query string.
:type url: str
:type params: dict
:return: JSON answer decoded into a dict or None on whatever error occured
:rtype: dict | None
"""
self.__get(url=url, params=params)
json = None
try:
json = self._response.json()
except:
self.logger.warning("Invalid JSON received from {} !".format(url if url else self.baseurl))
return json
def get_text(self, url=None, params=None, encoding=None, timeout=None):
"""
Launches a GET request and returns answer as string or None on error.
:param url: Optional URL to fetch from. Default is to use baseurl given to constructor.
:param params: Optional dict of parameters to add to URL query string.
:param encoding: Optional encoding of the received text. Default is to let the lib try to figure out the right encoding.
:type url: str
:type params: dict
:type encoding: str
:return: Answer decoded into a string or None on whatever error occured
:rtype: str | None
"""
_text = None
if self.__get(url=url, params=params, timeout=timeout):
try:
if encoding:
self._response.encoding = encoding
_text = self._response.text
except:
self.logger.error("Successfull GET, but decoding response failed. This should never happen !")
return _text
def get_binary(self, url=None, params=None):
"""
Launches a GET request and returns answer as raw binary data or None on error.
This is usefull for downloading binary objects / files.
:param url: Optional URL to fetch from. Default is to use baseurl given to constructor.
:param params: Optional dict of parameters to add to URL query string.
:type url: str
:type params: dict
:return: Answer as raw binary objector None on whatever error occured
:rtype: bytes | None
"""
self.__get(url=url, params=params)
return self._response.content
def response_status(self):
"""
Returns the status code (200, 404, ...) of the last executed request.
If GET request was not possible and thus no HTTP statuscode is available the returned status code = 0.
:return: Status code and text of last request
:rtype: (int, str)
"""
try:
(code, reason) = (self._response.status_code, self._response.reason)
except:
code = 0
reason = 'Unable to complete GET request'
return (code, reason)
def response_headers(self):
"""
Returns a dictionary with the server return headers of the last executed request
:return: Headers returned by server
:rtype: dict
"""
return self._response.headers
def response_cookies(self):
"""
Returns a dictionary with the cookies the server may have sent on the last executed request
:return: Cookies returned by server
:rtype: dict
"""
return self._response.cookies
def response_object(self):
"""
Returns the raw response object for advanced ussage. Use if you know what you are doing.
Maybe this lib can be extented to your needs instead ?
:return: Reponse object as returned by underlying requests library
:rtype: `requests.Response <http://docs.python-requests.org/en/master/user/quickstart/#response-content>`_
"""
return self._response
def __get(self, url=None, params=None, timeout=None):
url = url if url else self.baseurl
timeout = timeout if timeout else self.timeout
self.logger.info("Sending GET request to {}".format(url))
try:
self._response = requests.get(url, params=params, timeout=timeout)
self.logger.debug("{} Fetched URL {}".format(self.response_status(), self._response.url))
except Exception as e:
self.logger.warning("Error sending GET request to {}: {}".format(url, e))
return False
return True
class Tcp_client(object):
""" Creates a new instance of the Tcp_client class
:param host: Remote host name or ip address (v4 or v6)
:param port: Remote host port to connect to
:param name: Name of this connection (mainly for logging purposes). Try to keep the name short.
:param autoreconnect: Should the socket try to reconnect on lost connection (or finished connect cycle)
:param connect_retries: Number of connect retries per cycle
:param connect_cycle: Time between retries inside a connect cycle
:param retry_cycle: Time between cycles if :param:autoreconnect is True
:param binary: Switch between binary and text mode. Text will be encoded / decoded using encoding parameter.
:param terminator: Terminator to use to split received data into chunks (split lines <cr> for example). If integer then split into n bytes. Default is None means process chunks as received.
:type host: str
:type port: int
:type name: str
:type autoreconnect: bool
:type connect_retries: int
:type connect_cycle: int
:type retry_cycle: int
:type binary: bool
:type terminator: int | bytes | str
"""
def __init__(self, host, port, name=None, autoreconnect=True, connect_retries=5, connect_cycle=5, retry_cycle=30, binary=False, terminator=False):
self.logger = logging.getLogger(__name__)
# Public properties
self.name = name
self.terminator = None
# "Private" properties
self._host = host
self._port = port
self._autoreconnect = autoreconnect
self._is_connected = False
self._connect_retries = connect_retries
self._connect_cycle = connect_cycle
self._retry_cycle = retry_cycle
self._timeout = 1
self._hostip = None
self._ipver = socket.AF_INET
self._socket = None
self._connect_counter = 0
self._binary = binary
self._connected_callback = None
self._disconnected_callback = None
self._data_received_callback = None
# "Secret" properties
self.__connect_thread = None
self.__connect_threadlock = threading.Lock()
self.__receive_thread = None
self.__receive_threadlock = threading.Lock()
self.__running = True
self.logger.setLevel(logging.DEBUG)
self.logger.info("Initializing a connection to {} on TCP port {} {} autoreconnect".format(self._host, self._port, ('with' if self._autoreconnect else 'without')))
# Test if host is an ip address or a host name
if Network.is_ip(self._host):
# host is a valid ip address (v4 or v6)
self.logger.debug("{} is a valid IP address".format(host))
self._hostip = self._host
if Network.is_ipv6(self._host):
self._ipver = socket.AF_INET6
else:
self._ipver = socket.AF_INET
else:
# host is a hostname, trying to resolve to an ip address (v4 or v6)
self.logger.debug("{} is not a valid IP address, trying to resolve it as hostname".format(host))
try:
self._ipver, sockettype, proto, canonname, socketaddr = socket.getaddrinfo(host, None)[0]
# Check if resolved address is IPv4 or IPv6
if self._ipver == socket.AF_INET: # is IPv4
self._hostip, port = socketaddr
elif self._ipver == socket.AF_INET6: # is IPv6
self._hostip, port, flow_info, scope_id = socketaddr
else:
# This should never happen
self.logger.error("Unknown ip address family {}".format(self._ipver))
self._hostip = None
# Print ip address on successfull resolve
if self._hostip is not None:
self.logger.info("Resolved {} to {} address {}".format(self._host, 'IPv6' if self._ipver == socket.AF_INET6 else 'IPv4', self._hostip))
except:
# Unable to resolve hostname
self.logger.error("Cannot resolve {} to a valid ip address (v4 or v6)".format(self._host))
self._hostip = None
def set_callbacks(self, connected=None, data_received=None, disconnected=None):
""" Set callbacks to caller for different socket events
:param connected: Called whenever a connection is established successfully
:param data_received: Called when data is received
:param disconnected: Called when a connection has been dropped for whatever reason
:type connected: function
:type data_received: function
:type disconnected: function
"""
self._connected_callback = connected
self._disconnected_callback = disconnected
self._data_received_callback = data_received
def connect(self):
""" Connects the socket
:return: False if an error prevented us from launching a connection thread. True if a connection thread has been started.
:rtype: bool
"""
if self._hostip is None: # return False if no valid ip to connect to
self.logger.error("No valid IP address to connect to {}".format(self._host))
self._is_connected = False
return False
if self._is_connected: # return false if already connected
self.logger.error("Already connected to {}, ignoring new request".format(self._host))
return False
self.__connect_thread = threading.Thread(target=self._connect_thread_worker, name='TCP_Connect')
self.__connect_thread.daemon = True
self.__connect_thread.start()
return True
def connected(self):
""" Returns the current connection state
:return: True if an active connection exists,else False.
:rtype: bool
"""
return self._is_connected
def send(self, message):
""" Sends a message to the server. Can be a string, bytes or a bytes array.
:return: True if message has been successfully sent, else False.
:rtype: bool
"""
if not isinstance(message, (bytes, bytearray)):
try:
message = message.encode('utf-8')
except:
self.logger.warning("Error encoding message for client {}".format(self.name))
return False
try:
if self._is_connected:
self._socket.send(message)
else:
return False
except:
self.logger.warning("No connection to {}, cannot send data {}".format(self._host, msg))
return False
return True
def _connect_thread_worker(self):
if not self.__connect_threadlock.acquire(blocking=False):
self.logger.warning("Connection attempt already in progress for {}, ignoring new request".format(self._host))
return
if self._is_connected:
self.logger.error("Already connected to {}, ignoring new request".format(self._host))
return
self.logger.debug("Starting connection cycle for {}".format(self._host))
self._connect_counter = 0
while self.__running and not self._is_connected:
# Try a full connect cycle
while not self._is_connected and self._connect_counter < self._connect_retries and self.__running:
self._connect()
if self._is_connected:
try:
self.__connect_threadlock.release()
self._connected_callback and self._connected_callback(self)
self.__receive_thread = threading.Thread(target=self.__receive_thread_worker, name='TCP_Receive')
self.__receive_thread.daemon = True
self.__receive_thread.start()
except:
raise
return True
self._sleep(self._connect_cycle)
if self._autoreconnect:
self._sleep(self._retry_cycle)
self._connect_counter = 0
else:
break
try:
self.__connect_threadlock.release()
except:
pass
def _connect(self):
self.logger.debug("Connecting to {} using {} {} on TCP port {} {} autoreconnect".format(self._host, 'IPv6' if self._ipver == socket.AF_INET6 else 'IPv4', self._hostip, self._port, ('with' if self._autoreconnect else 'without')))
# Try to connect to remote host using ip (v4 or v6)
try:
self._socket = socket.socket(self._ipver, socket.SOCK_STREAM)
self._socket.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
self._socket.settimeout(5)
self._socket.connect(('{}'.format(self._hostip), int(self._port)))
self._socket.settimeout(self._timeout)
self._is_connected = True
self.logger.info("Connected to {} on TCP port {}".format(self._host, self._port))
# Connection error
except Exception as err:
self._is_connected = False
self._connect_counter += 1
self.logger.warning("TCP connection to {}:{} failed with error {}. Counter: {}/{}".format(self._host, self._port, err, self._connect_counter, self._connect_retries))
def __receive_thread_worker(self):
poller = select.poll()
poller.register(self._socket, select.POLLIN | select.POLLPRI | select.POLLHUP | select.POLLERR)
__buffer = b''
while self._is_connected and self.__running:
events = poller.poll(1000)
for fd, event in events:
if event & select.POLLHUP:
self.logger.warning("Client socket closed")
# Check if POLLIN event triggered
if event & (select.POLLIN | select.POLLPRI):
msg = self._socket.recv(4096)
# Check if incoming message is not empty
if msg:
# If we transfer in text mode decode message to string
if not self._binary:
msg = str.rstrip(str(msg, 'utf-8'))
# If we work in line mode (with a terminator) slice buffer into single chunks based on terminator
if self.terminator:
__buffer += msg
while True:
# terminator = int means fixed size chunks
if isinstance(self.terminator, int):
i = self.terminator
if i > len(__buffer):
break
# terminator is str or bytes means search for it
else:
i = __buffer.find(self.terminator)
if i == -1:
break
i += len(self.terminator)
line = __buffer[:i]
__buffer = __buffer[i:]
if self._data_received_callback is not None:
self._data_received_callback(self, line)
# If not in terminator mode just forward what we received
else:
if self._data_received_callback is not None:
self._data_received_callback(self, msg)
# If empty peer has closed the connection
else:
# Peer connection closed
self.logger.warning("Connection closed by peer {}".format(self._host))
self._is_connected = False
poller.unregister(self._socket)
self._disconnected_callback and self._disconnected_callback(self)
if self._autoreconnect:
self.logger.debug("Autoreconnect enabled for {}".format(self._host))
self.connect()
def _sleep(self, time_lapse):
time_start = time.time()
time_end = (time_start + time_lapse)
while self.__running and time_end > time.time():
pass
def close(self):
""" Closes the current client socket """
self.logger.info("Closing connection to {} on TCP port {}".format(self._host, self._port))
self.__running = False
if self.__connect_thread is not None and self.__connect_thread.isAlive():
self.__connect_thread.join()
if self.__receive_thread is not None and self.__receive_thread.isAlive():
self.__receive_thread.join()
class _Client(object):
""" Client object that represents a connected client of tcp_server
:param server: The tcp_server passes a reference to itself to access parent methods
:param socket: socket.Socket class used by the Client object
:param fd: File descriptor of socket used by the Client object
:type server: tcp_server
:type socket: function
:type fd: int
"""
def __init__(self, server=None, socket=None, fd=None):
self.logger = logging.getLogger(__name__)
self.name = None
self.ip = None
self.port = None
self.ipver = None
self._message_queue = queue.Queue()
self._data_received_callback = None
self._will_close_callback = None
self._fd = fd
self.__server = server
self.__socket = socket
@property
def socket(self):
return self.__socket
@property
def fd(self):
return self._fd
def set_callbacks(self, data_received=None, will_close=None):
""" Set callbacks for different socket events (client based)
:param data_received: Called when data is received
:type data_received: function
"""
self._data_received_callback = data_received
self._will_close_callback = will_close
def send(self, message):
""" Send a string to connected client
:param msg: Message to send
:type msg: string | bytes | bytearray
:return: True if message has been queued successfully.
:rtype: bool
"""
if not isinstance(message, (bytes, bytearray)):
try:
message = message.encode('utf-8')
except:
self.logger.warning("Error encoding message for client {}".format(self.name))
return False
try:
self._message_queue.put_nowait(message)
except:
self.logger.warning("Error queueing message for client {}".format(self.name))
return False
return True
def send_echo_off(self):
""" Sends an IAC telnet command to ask client to turn it's echo off """
command = bytearray([0xFF, 0xFB, 0x01])
string = self._iac_to_string(command)
self.logger.debug("Sending IAC telnet command: '{}'".format(string))
self.send(command)
def send_echo_on(self):
""" Sends an IAC telnet command to ask client to turn it's echo on again """
command = bytearray([0xFF, 0xFC, 0x01])
string = self._iac_to_string(command)
self.logger.debug("Sending IAC telnet command: '{}'".format(string))
self.send(command)
def process_IAC(self, msg):
""" Processes incomming IAC messages. Does nothing for now except logging them in clear text """
string = self._iac_to_string(msg)
self.logger.debug("Received IAC telnet command: '{}'".format(string))
def close(self):
""" Client socket closes itself """
self._process_queue() # Be sure that possible remaining messages will be processed
self.__socket.shutdown(socket.SHUT_RDWR)
self.logger.info("Closing connection for client {}".format(self.name))
self._will_close_callback and self._will_close_callback(self)
self.set_callbacks(data_received=None, will_close=None)
del self.__message_queue
self.__socket.close()
return True
def _iac_to_string(self, msg):
iac = {1: 'ECHO', 251: 'WILL', 252: 'WON\'T', 253: 'DO', 254: 'DON\'T', 255: 'IAC'}
string = ''
for char in msg:
if char in iac:
string += iac[char] + ' '
else:
string += '<UNKNOWN> '
return string.rstrip()
def _process_queue(self):
while not self._message_queue.empty():
msg = self._message_queue.get_nowait()
try:
string = str(msg, 'utf-8'),
self.logger.debug("Sending '{}' to {}".format(string, self.name))
except:
self.logger.debug("Sending undecodable bytes to {}".format(self.name))
self.__socket.send(msg)
self._message_queue.task_done()
return True
class Tcp_server(object):
""" Creates a new instance of the Tcp_server class
:param interface: Remote interface name or ip address (v4 or v6). Default is '::' which listens on all IPv4 and all IPv6 addresses available.
:param port: Remote interface port to connect to
:param name: Name of this connection (mainly for logging purposes)
:type interface: str
:type port: int
:type name: str
"""
def __init__(self, port, interface='::', name=None):
self.logger = logging.getLogger(__name__)
# Public properties
self.name = name
# "Private" properties
self._interface = interface
self._port = port
self._is_listening = False
self._timeout = 1
self._interfaceip = None
self._ipver = socket.AF_INET
self._socket = None
self._listening_callback = None
self._incoming_connection_callback = None
self._data_received_callback = None
# "Secret" properties
self.__listening_thread = None
self.__listening_threadlock = threading.Lock()
self.__connection_thread = None
self.__connection_threadlock = threading.Lock()
self.__connection_poller = None
self.__message_queues = {}
self.__connection_map = {}
self.__running = True
# Test if host is an ip address or a host name
if Network.is_ip(self._interface):
# host is a valid ip address (v4 or v6)
self.logger.debug("{} is a valid IP address".format(self._interface))
self._interfaceip = self._interface
if Network.is_ipv6(self._interfaceip):
self._ipver = socket.AF_INET6
else:
self._ipver = socket.AF_INET
else:
# host is a hostname, trying to resolve to an ip address (v4 or v6)
self.logger.debug("{} is not a valid IP address, trying to resolve it as hostname".format(self._interface))
try:
self._ipver, sockettype, proto, canonname, socketaddr = socket.getaddrinfo(self._interface, None)[0]
# Check if resolved address is IPv4 or IPv6
if self._ipver == socket.AF_INET:
self._interfaceip, port = socketaddr
elif self._ipver == socket.AF_INET6:
self._interfaceip, port, flow_info, scope_id = socketaddr
else:
self.logger.error("Unknown ip address family {}".format(self._ipver))
self._interfaceip = None
if self._interfaceip is not None:
self.logger.info("Resolved {} to {} address {}".format(self._interface, ipver_to_string(self._ipver), self._hostip))
except:
# Unable to resolve hostname
self.logger.error("Cannot resolve {} to a valid ip address (v4 or v6)".format(self._interface))
self._interfaceip = None
self.__our_socket = Network.ip_port_to_socket(self._interfaceip, self._port)
if not self.name:
self.name = self.__our_socket
self.logger.info("Initializing TCP server socket {}".format(self.__our_socket))
def set_callbacks(self, listening=None, incoming_connection=None, disconnected=None, data_received=None):
""" Set callbacks to caller for different socket events
:param connected: Called whenever a connection is established successfully
:param data_received: Called when data is received
:param disconnected: Called when a connection has been dropped for whatever reason
:type connected: function
:type data_received: function
:type disconnected: function
"""
self._listening_callback = listening
self._incoming_connection_callback = incoming_connection
self._data_received_callback = data_received
self._disconnected_callback = disconnected
def start(self):
""" Start the server socket
:return: False if an error prevented us from launching a connection thread. True if a connection thread has been started.
:rtype: bool
"""
if self._is_listening:
return
try:
self._socket = socket.socket(self._ipver, socket.SOCK_STREAM)
self._socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self._socket.bind((self._interfaceip, self._port))
except Exception as e:
self.logger.error("Problem binding to interface {} on port {}: {}".format(self._interfaceip, self._port, e))
self._is_listening = False
return False
else:
self.logger.debug("Bound listening socket to interface {} on port {}".format(self._interfaceip, self._port))
try:
self._socket.listen(5)
self._socket.setblocking(0)
self.logger.info("Listening on socket {}".format(self.__our_socket))
except Exception as e:
self.logger.error("Problem starting listening socket on interface {} port {}: {}".format(self._interfaceip, self._port, e))
self._is_listening = False
return False
self._is_listening = True
self._listening_callback and self._listening_callback(self)
self.__listening_thread = threading.Thread(target=self.__listening_thread_worker, name='TCP_Listener')
self.__listening_thread.daemon = True
self.__listening_thread.start()
return True
def __listening_thread_worker(self):
poller = select.poll()
poller.register(self._socket, select.POLLIN | select.POLLPRI | select.POLLHUP | select.POLLERR)
self.logger.debug("Waiting for incomming commections on socket {}".format(self.__our_socket))
while self.__running:
events = poller.poll(1000)
for fd, event in events:
if event & select.POLLERR:
self.logger.debug("Listening thread POLLERR")
if event & select.POLLHUP:
self.logger.debug("Listening thread POLLHUP")
if event & (select.POLLIN | select.POLLPRI):
connection, peer = self._socket.accept()
connection.setblocking(0)
fd = connection.fileno()
__peer_socket = Network.ip_port_to_socket(peer[0], peer[1])
client = _Client(server=self, socket=connection, fd=fd)
client.ip = peer[0]
client.ipver = socket.AF_INET6 if Network.is_ipv6(client.ip) else socket.AF_INET
client.port = peer[1]
client.name = Network.ip_port_to_socket(client.ip, client.port)
self.logger.info("Incoming connection from {} on socket {}".format(__peer_socket, self.__our_socket))
self.__connection_map[fd] = client
self._incoming_connection_callback and self._incoming_connection_callback(self, client)
if self.__connection_thread is None:
self.logger.debug("Connection thread not running yet, firing it up ...")
self.__connection_thread = threading.Thread(target=self.__connection_thread_worker, name='TCP_Server')
if self.__connection_poller is None:
self.__connection_poller = select.poll()
self.__connection_poller.register(connection, select.POLLOUT | select.POLLIN | select.POLLPRI | select.POLLHUP | select.POLLERR)
if not self.__connection_thread.isAlive():
self.__connection_thread.daemon = True
self.__connection_thread.start()
del client
def __connection_thread_worker(self):
""" This thread handles the send & receive tasks of connected clients. """
self.logger.debug("Connection thread on socket {} starting up".format(self.__our_socket))
while self.__running and len(self.__connection_map) > 0:
events = self.__connection_poller.poll(1000)
for fd, event in events:
__client = self.__connection_map[fd]
__socket = __client.socket
if event & select.POLLERR:
self.logger.debug("Connection thread POLLERR")
if event & select.POLLHUP:
self.logger.debug("Connection thread POLLHUP")
if event & select.POLLOUT:
if not __client._message_queue.empty():
__client._process_queue()
if event & (select.POLLIN | select.POLLPRI):
msg = __socket.recv(4096)
if msg:
try:
string = str.rstrip(str(msg, 'utf-8'))
self.logger.debug("Received '{}' from {}".format(string, __client.name))
self._data_received_callback and self._data_received_callback(self, __client, string)
__client._data_received_callback and __client._data_received_callback(self, __client, string)
except:
self.logger.debug("Received undecodable bytes from {}".format(__client.name))
if msg[0] == 0xFF:
__client.process_IAC(msg)
else:
self._remove_client(__client)
del __socket
del __client
self.__connection_poller = None
self.__connection_thread = None
self.logger.debug("Last connection closed for socket {}, stopping connection thread".format(self.__our_socket))
def listening(self):
""" Returns the current listening state
:return: True if the server socket is actually listening, else False.
:rtype: bool
"""
return self._is_listening
def send(self, client, msg):
""" Send a string to connected client
:param client: Client Object to send message to
:param msg: Message to send
:type client: network.Client
:type msg: string | bytes | bytearray
:return: True if message has been queued successfully.
:rtype: bool
"""
return client.send(msg)
def disconnect(self, client):
""" Disconnects a specific client
:param client: Client Object to disconnect
:type client: network.Client
"""
client.close()
return True
def _remove_client(self, client):
self.logger.info("Lost connection to client {}, removing it".format(client.name))
self._disconnected_callback and self._disconnected_callback(self, client)
self.__connection_poller.unregister(client.fd)
del self.__connection_map[client.fd]
return True
def _sleep(self, time_lapse):
""" Non blocking sleep. Does return when self.close is called and running set to False.
:param time_lapse: Time in seconds to sleep
:type time_lapse: float
"""
time_start = time.time()
time_end = (time_start + time_lapse)
while self.__running and time_end > time.time():
pass
def close(self):
""" Closes running listening socket """
self.logger.info("Shutting down listening socket on interface {} port {}".format(self._interface, self._port))
self.__running = False
if self.__listening_thread is not None and self.__listening_thread.isAlive():
self.__listening_thread.join()
if self.__connection_thread is not None and self.__connection_thread.isAlive():
self.__connection_thread.join()
| Foxi352/netlib | network.py | Python | gpl-3.0 | 39,974 | [
30522,
1001,
999,
1013,
2149,
2099,
1013,
8026,
1013,
4372,
2615,
18750,
2509,
1001,
6819,
2213,
1024,
2275,
17181,
1027,
21183,
2546,
1011,
1022,
21628,
16033,
2361,
1027,
1018,
3730,
2696,
5910,
14399,
1027,
1018,
5670,
9148,
11927,
2232,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* Phergie (http://phergie.org)
*
* @link http://github.com/phergie/phergie-irc-generator for the canonical source repository
* @copyright Copyright (c) 2008-2014 Phergie Development Team (http://phergie.org)
* @license http://phergie.org/license Simplified BSD License
* @package Phergie\Irc
*/
namespace Phergie\Irc;
/**
* Canonical implementation of GeneratorInterface.
*
* @category Phergie
* @package Phergie\Irc
*/
class Generator implements GeneratorInterface
{
/**
* Message prefix
*
* @var string
*/
protected $prefix = null;
/**
* Implements GeneratorInterface::setPrefix().
*
* @param string $prefix
*/
public function setPrefix($prefix)
{
$this->prefix = $prefix;
}
/**
* Returns a formatted IRC message.
*
* @param string $type Command or response code
* @param array $params Optional message parameters
* @return string
*/
protected function getIrcMessage($type, array $params = array())
{
$message = '';
if ($this->prefix) {
$message .= ':' . $this->prefix . ' ';
}
$message .= $type;
$params = array_filter($params, function($param) {
return $param !== null;
});
if ($params) {
$last = end($params);
$params[key($params)] = ':' . $last;
$message .= ' ' . implode(' ', $params);
}
$message .= "\r\n";
return $message;
}
/**
* Returns a PASS message.
*
* @param string $password
* @return string
*/
public function ircPass($password)
{
return $this->getIrcMessage('PASS', array($password));
}
/**
* Returns a NICK message.
*
* @param string $nickname
* @param int $hopcount
* @return string
*/
public function ircNick($nickname, $hopcount = null)
{
return $this->getIrcMessage('NICK', array($nickname, $hopcount));
}
/**
* Returns a USER message.
*
* @param string $username
* @param string $hostname
* @param string $servername
* @param string $realname
* @return string
*/
public function ircUser($username, $hostname, $servername, $realname)
{
return $this->getIrcMessage('USER', array($username, $hostname, $servername, $realname));
}
/**
* Returns a SERVER message.
*
* @param string $servername
* @param int $hopcount
* @param string $info
* @return string
*/
public function ircServer($servername, $hopcount, $info)
{
return $this->getIrcMessage('SERVER', array($servername, $hopcount, $info));
}
/**
* Returns an OPER message.
*
* @param string $user
* @param string $password
* @return string
*/
public function ircOper($user, $password)
{
return $this->getIrcMessage('OPER', array($user, $password));
}
/**
* Returns a QUIT message.
*
* @param string $message
* @return string
*/
public function ircQuit($message = null)
{
return $this->getIrcMessage('QUIT', array($message));
}
/**
* Returns an SQUIT message.
*
* @param string $server
* @param string $comment
* @return string
*/
public function ircSquit($server, $comment)
{
return $this->getIrcMessage('SQUIT', array($server, $comment));
}
/**
* Returns a JOIN message.
*
* @param string $channels
* @param string $keys
* @return string
*/
public function ircJoin($channels, $keys = null)
{
return $this->getIrcMessage('JOIN', array($channels, $keys));
}
/**
* Returns a PART message.
*
* @param string $channels
* @param string $message
* @return string
*/
public function ircPart($channels, $message = null)
{
return $this->getIrcMessage('PART', array($channels, $message));
}
/**
* Returns a MODE message.
*
* @param string $target
* @param string|null $mode
* @param string|null $param
* @return string
*/
public function ircMode($target, $mode = null, $param = null)
{
return $this->getIrcMessage('MODE', array($target, $mode, $param));
}
/**
* Returns a TOPIC message.
*
* @param string $channel
* @param string $topic
* @return string
*/
public function ircTopic($channel, $topic = null)
{
return $this->getIrcMessage('TOPIC', array($channel, $topic));
}
/**
* Returns a NAMES message.
*
* @param string $channels
* @return string
*/
public function ircNames($channels)
{
return $this->getIrcMessage('NAMES', array($channels));
}
/**
* Returns a LIST message.
*
* @param string $channels
* @param string $server
* @return string
*/
public function ircList($channels = null, $server = null)
{
return $this->getIrcMessage('LIST', array($channels, $server));
}
/**
* Returns an INVITE message.
*
* @param string $nickname
* @param string $channel
* @return string
*/
public function ircInvite($nickname, $channel)
{
return $this->getIrcMessage('INVITE', array($nickname, $channel));
}
/**
* Returns a KICK message.
*
* @param string $channel
* @param string $user
* @param string $comment
* @return string
*/
public function ircKick($channel, $user, $comment = null)
{
return $this->getIrcMessage('KICK', array($channel, $user, $comment));
}
/**
* Returns a VERSION message.
*
* @param string $server
* @return string
*/
public function ircVersion($server = null)
{
return $this->getIrcMessage('VERSION', array($server));
}
/**
* Returns a STATS message.
*
* @param string $query
* @param string $server
* @return string
*/
public function ircStats($query, $server = null)
{
return $this->getIrcMessage('STATS', array($query, $server));
}
/**
* Returns a LINKS message.
*
* Note that the parameter order of this method is reversed with respect to
* the corresponding IRC message to alleviate the need to explicitly specify
* a null value for $remoteserver when it is not used.
*
* @param string $servermask
* @param string $remoteserver
* @return string
*/
public function ircLinks($servermask = null, $remoteserver = null)
{
return $this->getIrcMessage('LINKS', array($remoteserver, $servermask));
}
/**
* Returns a TIME message.
*
* @param string $server
* @return string
*/
public function ircTime($server = null)
{
return $this->getIrcMessage('TIME', array($server));
}
/**
* Returns a CONNECT message.
*
* @param string $targetserver
* @param int $port
* @param string $remoteserver
* @return string
*/
public function ircConnect($targetserver, $port = null, $remoteserver = null)
{
return $this->getIrcMessage('CONNECT', array($targetserver, $port, $remoteserver));
}
/**
* Returns a TRACE message.
*
* @param string $server
* @return string
*/
public function ircTrace($server = null)
{
return $this->getIrcMessage('TRACE', array($server));
}
/**
* Returns an ADMIN message.
*
* @param string $server
* @return string
*/
public function ircAdmin($server = null)
{
return $this->getIrcMessage('ADMIN', array($server));
}
/**
* Returns an INFO message.
*
* @param string $server
* @return string
*/
public function ircInfo($server = null)
{
return $this->getIrcMessage('INFO', array($server));
}
/**
* Returns a PRIVMSG message.
*
* @param string $receivers
* @param string $text
* @return string
*/
public function ircPrivmsg($receivers, $text)
{
return $this->getIrcMessage('PRIVMSG', array($receivers, $text));
}
/**
* Returns a NOTICE message.
*
* @param string $nickname
* @param string $text
* @return string
*/
public function ircNotice($nickname, $text)
{
return $this->getIrcMessage('NOTICE', array($nickname, $text));
}
/**
* Returns a WHO message.
*
* @param string $name
* @param string $o
* @return string
*/
public function ircWho($name, $o = null)
{
return $this->getIrcMessage('WHO', array($name, $o));
}
/**
* Returns a WHOIS message.
*
* @param string $nickmasks
* @param string $server
* @return string
*/
public function ircWhois($nickmasks, $server = null)
{
return $this->getIrcMessage('WHOIS', array($server, $nickmasks));
}
/**
* Returns a WHOWAS message.
*
* @param string $nickname
* @param int $count
* @param string $server
* @return string
*/
public function ircWhowas($nickname, $count = null, $server = null)
{
return $this->getIrcMessage('WHOWAS', array($nickname, $count, $server));
}
/**
* Returns a KILL message.
*
* @param string $nickname
* @param string $comment
* @return string
*/
public function ircKill($nickname, $comment)
{
return $this->getIrcMessage('KILL', array($nickname, $comment));
}
/**
* Returns a PING message.
*
* @param string $server1
* @param string $server2
* @return string
*/
public function ircPing($server1, $server2 = null)
{
return $this->getIrcMessage('PING', array($server1, $server2));
}
/**
* Returns a PONG message.
*
* @param string $daemon
* @param string $daemon2
* @return string
*/
public function ircPong($daemon, $daemon2 = null)
{
return $this->getIrcMessage('PONG', array($daemon, $daemon2));
}
/**
* Returns an ERROR message.
*
* @param string $message
* @return string
*/
public function ircError($message)
{
return $this->getIrcMessage('ERROR', array($message));
}
/**
* Returns an AWAY message.
*
* @param string $message
* @return string
*/
public function ircAway($message = null)
{
return $this->getIrcMessage('AWAY', array($message));
}
/**
* Returns a REHASH message.
*
* @return string
*/
public function ircRehash()
{
return $this->getIrcMessage('REHASH');
}
/**
* Returns a RESTART message.
*
* @return string
*/
public function ircRestart()
{
return $this->getIrcMessage('RESTART');
}
/**
* Returns a SUMMON message.
*
* @param string $user
* @param string $server
* @return string
*/
public function ircSummon($user, $server = null)
{
return $this->getIrcMessage('SUMMON', array($user, $server));
}
/**
* Returns a USERS message.
*
* @param string $server
* @return string
*/
public function ircUsers($server = null)
{
return $this->getIrcMessage('USERS', array($server));
}
/**
* Returns a WALLOPS message.
*
* @param string $text
* @return string
*/
public function ircWallops($text)
{
return $this->getIrcMessage('WALLOPS', array($text));
}
/**
* Returns a USERHOST message.
*
* @param string $nickname1
* @param string $nickname2
* @param string $nickname3
* @param string $nickname4
* @param string $nickname5
* @return string
*/
public function ircUserhost($nickname1, $nickname2 = null, $nickname3 = null, $nickname4 = null, $nickname5 = null)
{
return $this->getIrcMessage('USERHOST', array($nickname1, $nickname2, $nickname3, $nickname4, $nickname5));
}
/**
* Returns an ISON message.
*
* @param string $nicknames
* @return string
*/
public function ircIson($nicknames)
{
return $this->getIrcMessage('ISON', array($nicknames));
}
/**
* Returns a PROTOCTL message.
*
* @param string $proto
* @return string
*/
public function ircProtoctl($proto)
{
return $this->getIrcMessage('PROTOCTL', array($proto));
}
/**
* Returns a CTCP request.
*
* @param string $receivers
* @param string $message
* @return string
*/
protected function getCtcpRequest($receivers, $message)
{
return $this->ircPrivmsg($receivers, "\001" . $message . "\001");
}
/**
* Returns a CTCP response.
*
* @param string $receivers
* @param string $message
* @return string
*/
protected function getCtcpResponse($receivers, $message)
{
return $this->ircNotice($receivers, "\001" . $message . "\001");
}
/**
* Returns a CTCP FINGER message.
*
* @param string $receivers
* @return string
*/
public function ctcpFinger($receivers)
{
return $this->getCtcpRequest($receivers, 'FINGER');
}
/**
* Returns a CTCP FINGER reply message.
*
* @param string $nickname
* @param string $text
* @return string
*/
public function ctcpFingerResponse($nickname, $text)
{
return $this->getCtcpResponse($nickname, 'FINGER ' . $text);
}
/**
* Returns a CTCP VERSION message.
*
* @param string $receivers
* @return string
*/
public function ctcpVersion($receivers)
{
return $this->getCtcpRequest($receivers, 'VERSION');
}
/**
* Returns a CTCP VERSION reply message.
*
* @param string $nickname
* @param string $name
* @param string $version
* @param string $environment
* @return string
*/
public function ctcpVersionResponse($nickname, $name, $version, $environment)
{
return $this->getCtcpResponse($nickname, 'VERSION ' . $name . ':' . $version . ':' . $environment);
}
/**
* Returns a CTCP SOURCE message.
*
* @param string $receivers
* @return string
*/
public function ctcpSource($receivers)
{
return $this->getCtcpRequest($receivers, 'SOURCE');
}
/**
* Returns a CTCP SOURCE reply message.
*
* @param string $nickname
* @param string $host
* @param string $directories
* @param string $files
* @return string
*/
public function ctcpSourceResponse($nickname, $host, $directories, $files)
{
return $this->getCtcpResponse($nickname, 'SOURCE ' . $host . ':' . $directories . ':' . $files);
}
/**
* Returns a CTCP USERINFO message.
*
* @param string $receivers
* @return string
*/
public function ctcpUserinfo($receivers)
{
return $this->getCtcpRequest($receivers, 'USERINFO');
}
/**
* Returns a CTCP USERINFO reply message.
*
* @param string $nickname
* @param string $text
* @return string
*/
public function ctcpUserinfoResponse($nickname, $text)
{
return $this->getCtcpResponse($nickname, 'USERINFO ' . $text);
}
/**
* Returns a CTCP CLIENTINFO message.
*
* @param string $receivers
* @return string
*/
public function ctcpClientinfo($receivers)
{
return $this->getCtcpRequest($receivers, 'CLIENTINFO');
}
/**
* Returns a CTCP CLIENTINFO reply message.
*
* @param string $nickname
* @param string $client
* @return string
*/
public function ctcpClientinfoResponse($nickname, $client)
{
return $this->getCtcpResponse($nickname, 'CLIENTINFO ' . $client);
}
/**
* Returns a CTCP ERRMSG message.
*
* @param string $receivers
* @param string $query
* @return string
*/
public function ctcpErrmsg($receivers, $query)
{
return $this->getCtcpRequest($receivers, 'ERRMSG ' . $query);
}
/**
* Returns a CTCP ERRMSG reply message.
*
* @param string $nickname
* @param string $query
* @param string $message
* @return string
*/
public function ctcpErrmsgResponse($nickname, $query, $message)
{
return $this->getCtcpResponse($nickname, 'ERRMSG ' . $query . ' :' . $message);
}
/**
* Returns a CTCP PING message.
*
* @param string $receivers
* @param int $timestamp
* @return string
*/
public function ctcpPing($receivers, $timestamp)
{
return $this->getCtcpRequest($receivers, 'PING ' . $timestamp);
}
/**
* Returns a CTCP PING reply message.
*
* @param string $nickname
* @param int $timestamp
* @return string
*/
public function ctcpPingResponse($nickname, $timestamp)
{
return $this->getCtcpResponse($nickname, 'PING ' . $timestamp);
}
/**
* Returns a CTCP TIME message.
*
* @param string $receivers
* @return string
*/
public function ctcpTime($receivers)
{
return $this->getCtcpRequest($receivers, 'TIME');
}
/**
* Returns a CTCP TIME reply message.
*
* @param string $nickname
* @param string $time
* @return string
*/
public function ctcpTimeResponse($nickname, $time)
{
return $this->getCtcpResponse($nickname, 'TIME ' . $time);
}
/**
* Returns a CTCP ACTION message.
*
* @param string $receivers
* @param string $action
* @return string
*/
public function ctcpAction($receivers, $action)
{
return $this->getCtcpRequest($receivers, 'ACTION ' . $action);
}
/**
* Returns a CTCP ACTION reply message.
*
* @param string $nickname
* @param string $action
* @return string
*/
public function ctcpActionResponse($nickname, $action)
{
return $this->getCtcpResponse($nickname, 'ACTION ' . $action);
}
}
| phergie/phergie-irc-generator | src/Generator.php | PHP | bsd-3-clause | 18,448 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
6887,
2121,
11239,
1006,
8299,
1024,
1013,
1013,
6887,
2121,
11239,
1012,
8917,
1007,
1008,
1008,
1030,
4957,
8299,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
6887,
2121,
11239,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//
// BaseNavigationController.h
// Beme
//
// Created by Eric Lewis on 11/22/15.
// Copyright © 2015 Eric Lewis. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "CommonViewHeaders.h"
@interface BaseNavigationController : UINavigationController
@end
| ericlewis/BemeClone | Beme/View Controllers/Common/BaseNavigationController.h | C | mit | 266 | [
30522,
1013,
1013,
1013,
1013,
2918,
2532,
5737,
12540,
8663,
13181,
10820,
1012,
1044,
1013,
1013,
2022,
4168,
1013,
1013,
1013,
1013,
2580,
2011,
4388,
4572,
2006,
2340,
1013,
2570,
1013,
2321,
1012,
1013,
1013,
9385,
1075,
2325,
4388,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magento.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magento.com for more information.
*
* @category Mage
* @package Mage_Dataflow
* @copyright Copyright (c) 2006-2014 X.commerce, Inc. (http://www.magento.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
/**
* Convert profile collection
*
* @category Mage
* @package Mage_Dataflow
* @author Magento Core Team <core@magentocommerce.com>
*/
class Mage_Dataflow_Model_Convert_Profile_Collection
{
protected $_xml;
protected $_containers;
protected $_profiles = array();
protected $_simplexmlDefaultClass = 'Varien_Simplexml_Element';
protected $_profileDefaultClass = 'Mage_Dataflow_Model_Convert_Profile';
protected $_profileCollectionDefaultClass = 'Mage_Dataflow_Model_Convert_Profile_Collection';
protected $_containerDefaultClass = 'Mage_Dataflow_Model_Convert_Container_Generic';
protected $_containerCollectionDefaultClass = 'Mage_Dataflow_Model_Convert_Container_Collection';
public function getContainers()
{
if (!$this->_containers) {
$this->_containers = new $this->_containerCollectionDefaultClass();
$this->_containers->setDefaultClass($this->_containerDefaultClass);
}
return $this->_containers;
}
public function getContainer($name)
{
return $this->getContainers()->getItem($name);
}
public function addContainer($name, Mage_Dataflow_Model_Convert_Container_Interface $container)
{
$container = $this->getContainers()->addItem($name, $container);
return $container;
}
public function getProfiles()
{
return $this->_profiles;
}
public function getProfile($name)
{
if (!isset($this->_profiles[$name])) {
$this->importProfileXml($name);
}
return $this->_profiles[$name];
}
public function addProfile($name, Mage_Dataflow_Model_Convert_Profile_Interface $profile=null)
{
if (is_null($profile)) {
$profile = new $this->_profileDefaultClass();
}
$this->_profiles[$name] = $profile;
return $profile;
}
public function run($profile)
{
$this->getProfile($profile)->run();
return $this;
}
public function getClassNameByType($type)
{
return $type;
}
public function importXml($xml)
{
if (is_string($xml)) {
$xml = @simplexml_load_string($xml, $this->_simplexmlDefaultClass);
}
if (!$xml instanceof SimpleXMLElement) {
return $this;
}
$this->_xml = $xml;
foreach ($xml->container as $containerNode) {
if (!$containerNode['name'] || !$containerNode['type']) {
continue;
}
$class = $this->getClassNameByType((string)$containerNode['type']);
$container = $this->addContainer((string)$containerNode['name'], new $class());
foreach ($containerNode->var as $varNode) {
$container->setVar((string)$varNode['name'], (string)$varNode);
}
}
return $this;
}
public function importProfileXml($name)
{
if (!$this->_xml) {
return $this;
}
$nodes = $this->_xml->xpath("//profile[@name='".$name."']");
if (!$nodes) {
return $this;
}
$profileNode = $nodes[0];
$profile = $this->addProfile($name);
$profile->setContainers($this->getContainers());
foreach ($profileNode->action as $actionNode) {
$action = $profile->addAction();
foreach ($actionNode->attributes() as $key=>$value) {
$action->setParam($key, (string)$value);
}
if ($actionNode['use']) {
$container = $profile->getContainer((string)$actionNode['use']);
} else {
$action->setParam('class', $this->getClassNameByType((string)$actionNode['type']));
$container = $action->getContainer();
}
$action->setContainer($container);
if ($action->getParam('name')) {
$this->addContainer($action->getParam('name'), $container);
}
$country = '';
/** @var $varNode Varien_Simplexml_Element */
foreach ($actionNode->var as $key => $varNode) {
if ($varNode['name'] == 'map') {
$mapData = array();
foreach ($varNode->map as $mapNode) {
$mapData[(string)$mapNode['name']] = (string)$mapNode;
}
$container->setVar((string)$varNode['name'], $mapData);
} else {
$value = (string)$varNode;
/**
* Get state name from directory by iso name
* (only for US)
*/
if ($value && 'filter/country' == (string)$varNode['name']) {
/**
* Save country for convert state iso to name (for US only)
*/
$country = $value;
} elseif ($value && 'filter/region' == (string)$varNode['name'] && 'US' == $country) {
/**
* Get state name by iso for US
*/
/** @var $region Mage_Directory_Model_Region */
$region = Mage::getModel('directory/region');
$state = $region->loadByCode($value, $country)->getDefaultName();
if ($state) {
$value = $state;
}
}
$container->setVar((string)$varNode['name'], $value);
}
}
}
return $this;
}
}
| T0MM0R/magento | web/app/code/core/Mage/Dataflow/Model/Convert/Profile/Collection.php | PHP | gpl-2.0 | 6,645 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
17454,
13663,
1008,
1008,
5060,
1997,
6105,
1008,
1008,
2023,
3120,
5371,
2003,
3395,
2000,
1996,
2330,
4007,
6105,
1006,
9808,
2140,
1017,
1012,
1014,
1007,
1008,
2008,
2003,
24378,
2007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
---------------------------------------------------------------------------
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2020, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following
conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* 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.
* Neither the name of the assimp team, nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission of the assimp team.
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 COPYRIGHT
OWNER 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.
---------------------------------------------------------------------------
*/
/** @file Implementation of the post processing step "MakeVerboseFormat"
*/
#include "MakeVerboseFormat.h"
#include <assimp/scene.h>
#include <assimp/DefaultLogger.hpp>
using namespace Assimp;
// ------------------------------------------------------------------------------------------------
MakeVerboseFormatProcess::MakeVerboseFormatProcess()
{
// nothing to do here
}
// ------------------------------------------------------------------------------------------------
MakeVerboseFormatProcess::~MakeVerboseFormatProcess()
{
// nothing to do here
}
// ------------------------------------------------------------------------------------------------
// Executes the post processing step on the given imported data.
void MakeVerboseFormatProcess::Execute( aiScene* pScene)
{
ai_assert(NULL != pScene);
ASSIMP_LOG_DEBUG("MakeVerboseFormatProcess begin");
bool bHas = false;
for( unsigned int a = 0; a < pScene->mNumMeshes; a++)
{
if( MakeVerboseFormat( pScene->mMeshes[a]))
bHas = true;
}
if (bHas) {
ASSIMP_LOG_INFO("MakeVerboseFormatProcess finished. There was much work to do ...");
} else {
ASSIMP_LOG_DEBUG("MakeVerboseFormatProcess. There was nothing to do.");
}
pScene->mFlags &= ~AI_SCENE_FLAGS_NON_VERBOSE_FORMAT;
}
// ------------------------------------------------------------------------------------------------
// Executes the post processing step on the given imported data.
bool MakeVerboseFormatProcess::MakeVerboseFormat(aiMesh* pcMesh)
{
ai_assert(NULL != pcMesh);
unsigned int iOldNumVertices = pcMesh->mNumVertices;
const unsigned int iNumVerts = pcMesh->mNumFaces*3;
aiVector3D* pvPositions = new aiVector3D[ iNumVerts ];
aiVector3D* pvNormals = NULL;
if (pcMesh->HasNormals())
{
pvNormals = new aiVector3D[iNumVerts];
}
aiVector3D* pvTangents = NULL, *pvBitangents = NULL;
if (pcMesh->HasTangentsAndBitangents())
{
pvTangents = new aiVector3D[iNumVerts];
pvBitangents = new aiVector3D[iNumVerts];
}
aiVector3D* apvTextureCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS] = {0};
aiColor4D* apvColorSets[AI_MAX_NUMBER_OF_COLOR_SETS] = {0};
unsigned int p = 0;
while (pcMesh->HasTextureCoords(p))
apvTextureCoords[p++] = new aiVector3D[iNumVerts];
p = 0;
while (pcMesh->HasVertexColors(p))
apvColorSets[p++] = new aiColor4D[iNumVerts];
// allocate enough memory to hold output bones and vertex weights ...
std::vector<aiVertexWeight>* newWeights = new std::vector<aiVertexWeight>[pcMesh->mNumBones];
for (unsigned int i = 0;i < pcMesh->mNumBones;++i) {
newWeights[i].reserve(pcMesh->mBones[i]->mNumWeights*3);
}
// iterate through all faces and build a clean list
unsigned int iIndex = 0;
for (unsigned int a = 0; a< pcMesh->mNumFaces;++a)
{
aiFace* pcFace = &pcMesh->mFaces[a];
for (unsigned int q = 0; q < pcFace->mNumIndices;++q,++iIndex)
{
// need to build a clean list of bones, too
for (unsigned int i = 0;i < pcMesh->mNumBones;++i)
{
for (unsigned int a = 0; a < pcMesh->mBones[i]->mNumWeights;a++)
{
const aiVertexWeight& w = pcMesh->mBones[i]->mWeights[a];
if(pcFace->mIndices[q] == w.mVertexId)
{
aiVertexWeight wNew;
wNew.mVertexId = iIndex;
wNew.mWeight = w.mWeight;
newWeights[i].push_back(wNew);
}
}
}
pvPositions[iIndex] = pcMesh->mVertices[pcFace->mIndices[q]];
if (pcMesh->HasNormals())
{
pvNormals[iIndex] = pcMesh->mNormals[pcFace->mIndices[q]];
}
if (pcMesh->HasTangentsAndBitangents())
{
pvTangents[iIndex] = pcMesh->mTangents[pcFace->mIndices[q]];
pvBitangents[iIndex] = pcMesh->mBitangents[pcFace->mIndices[q]];
}
unsigned int p = 0;
while (pcMesh->HasTextureCoords(p))
{
apvTextureCoords[p][iIndex] = pcMesh->mTextureCoords[p][pcFace->mIndices[q]];
++p;
}
p = 0;
while (pcMesh->HasVertexColors(p))
{
apvColorSets[p][iIndex] = pcMesh->mColors[p][pcFace->mIndices[q]];
++p;
}
pcFace->mIndices[q] = iIndex;
}
}
// build output vertex weights
for (unsigned int i = 0;i < pcMesh->mNumBones;++i)
{
delete [] pcMesh->mBones[i]->mWeights;
if (!newWeights[i].empty()) {
pcMesh->mBones[i]->mWeights = new aiVertexWeight[newWeights[i].size()];
aiVertexWeight *weightToCopy = &( newWeights[i][0] );
memcpy(pcMesh->mBones[i]->mWeights, weightToCopy,
sizeof(aiVertexWeight) * newWeights[i].size());
} else {
pcMesh->mBones[i]->mWeights = NULL;
}
}
delete[] newWeights;
// delete the old members
delete[] pcMesh->mVertices;
pcMesh->mVertices = pvPositions;
p = 0;
while (pcMesh->HasTextureCoords(p))
{
delete[] pcMesh->mTextureCoords[p];
pcMesh->mTextureCoords[p] = apvTextureCoords[p];
++p;
}
p = 0;
while (pcMesh->HasVertexColors(p))
{
delete[] pcMesh->mColors[p];
pcMesh->mColors[p] = apvColorSets[p];
++p;
}
pcMesh->mNumVertices = iNumVerts;
if (pcMesh->HasNormals())
{
delete[] pcMesh->mNormals;
pcMesh->mNormals = pvNormals;
}
if (pcMesh->HasTangentsAndBitangents())
{
delete[] pcMesh->mTangents;
pcMesh->mTangents = pvTangents;
delete[] pcMesh->mBitangents;
pcMesh->mBitangents = pvBitangents;
}
return (pcMesh->mNumVertices != iOldNumVertices);
}
// ------------------------------------------------------------------------------------------------
bool IsMeshInVerboseFormat(const aiMesh* mesh) {
// avoid slow vector<bool> specialization
std::vector<unsigned int> seen(mesh->mNumVertices,0);
for(unsigned int i = 0; i < mesh->mNumFaces; ++i) {
const aiFace& f = mesh->mFaces[i];
for(unsigned int j = 0; j < f.mNumIndices; ++j) {
if(++seen[f.mIndices[j]] == 2) {
// found a duplicate index
return false;
}
}
}
return true;
}
// ------------------------------------------------------------------------------------------------
bool MakeVerboseFormatProcess::IsVerboseFormat(const aiScene* pScene) {
for(unsigned int i = 0; i < pScene->mNumMeshes; ++i) {
if(!IsMeshInVerboseFormat(pScene->mMeshes[i])) {
return false;
}
}
return true;
}
| Bloodknight/Torque3D | Engine/lib/assimp/code/PostProcessing/MakeVerboseFormat.cpp | C++ | mit | 8,769 | [
30522,
1013,
1008,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
{% extends 'base_with_sidebar.html' %}
{% load i18n %}
{% block head_title %}{% trans 'Settings' %}{%endblock %}
{% block sidebar %}
<li>
<a class="sidebar-mainlink" href="{% url 'projects:main' %}" id="return">
{% trans 'Home' %}
</a>
</li>
<li>
<a class="sidebar-mainlink" href="{% url 'settings:main' %}" id="general">
{% trans 'General' %}
</a>
</li>
<li>
<a class="sidebar-mainlink" href="{% url 'settings:account' %}" id="account">
{% trans 'Account' %}
</a>
</li>
{% endblock %}
| XeryusTC/projman | templates/settings/base.html | HTML | mit | 515 | [
30522,
1063,
1003,
8908,
1005,
2918,
1035,
2007,
1035,
2217,
8237,
1012,
16129,
1005,
1003,
1065,
1063,
1003,
7170,
1045,
15136,
2078,
1003,
1065,
1063,
1003,
3796,
2132,
1035,
2516,
1003,
1065,
1063,
1003,
9099,
1005,
10906,
1005,
1003,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.Collections.Generic;
using System.Linq;
using Antlr4.Runtime;
using Antlr4.Runtime.Misc;
using Rubberduck.CodeAnalysis.Inspections.Abstract;
using Rubberduck.CodeAnalysis.Inspections.Extensions;
using Rubberduck.CodeAnalysis.Inspections.Results;
using Rubberduck.Parsing;
using Rubberduck.Parsing.Grammar;
using Rubberduck.Parsing.Symbols;
using Rubberduck.Parsing.VBA;
using Rubberduck.Parsing.VBA.DeclarationCaching;
using Rubberduck.Parsing.VBA.Parsing;
using Rubberduck.Resources.Inspections;
using Rubberduck.VBEditor;
using Rubberduck.CodeAnalysis.Inspections.Concrete.UnreachableCaseEvaluation;
namespace Rubberduck.CodeAnalysis.Inspections.Concrete
{
/// <summary>
/// Flags 'Case' blocks that will never execute.
/// </summary>
/// <why>
/// Unreachable code is certainly unintended, and is probably either redundant, or a bug.
/// </why>
/// <remarks>
/// Not all unreachable 'Case' blocks may be flagged, depending on expression complexity.
/// </remarks>
/// <example hasresult="true">
/// <module name="MyModule" type="Standard Module">
/// <![CDATA[
/// Private Sub Example(ByVal value As Long)
/// Select Case value
/// Case 0 To 99
/// ' ...
/// Case 50 ' unreachable: case is covered by a preceding condition.
/// ' ...
/// Case Is < 100
/// ' ...
/// Case < 0 ' unreachable: case is covered by a preceding condition.
/// ' ...
/// End Select
/// End Sub
/// ]]>
/// </module>
/// </example>
/// <example hasresult="true">
/// <module name="MyModule" type="Standard Module">
/// <![CDATA[
///
/// 'If the cumulative result of multiple 'Case' statements
/// 'cover the entire range of possible values for a data type,
/// 'then all remaining 'Case' statements are unreachable
///
/// Private Sub ExampleAllValuesCoveredIntegral(ByVal value As Long, ByVal result As Long)
/// Select Case result
/// Case Is < 100
/// ' ...
/// Case Is > -100
/// ' ...
/// 'all possible values are covered by preceding 'Case' statements
/// Case value * value ' unreachable
/// ' ...
/// Case value + value ' unreachable
/// ' ...
/// Case Else ' unreachable
/// ' ...
/// End Select
/// End Sub
/// ]]>
/// </module>
/// </example>
/// <example hasresult="false">
/// <module name="MyModule" type="Standard Module">
/// <![CDATA[
/// Public Enum ProductID
/// Widget = 1
/// Gadget = 2
/// Gizmo = 3
/// End Enum
///
/// Public Sub ExampleEnumCaseElse(ByVal product As ProductID)
///
/// 'Enums are evaluated as the 'Long' data type. So, in this example,
/// 'even though all the ProductID enum values have a 'Case' statement,
/// 'the 'Case Else' will still execute for any value of the 'product'
/// 'parameter that is not a ProductID.
///
/// Select Case product
/// Case Widget
/// ' ...
/// Case Gadget
/// ' ...
/// Case Gizmo
/// ' ...
/// Case Else 'is reachable
/// ' Raise an error for unrecognized/unhandled ProductID
/// End Select
/// End Sub
/// ]]>
/// </module>
/// </example>
/// <example hasresult="true">
/// <module name="MyModule" type="Standard Module">
/// <![CDATA[
///
/// 'The inspection flags Range Clauses that are not of the required form:
/// '[x] To [y] where [x] less than or equal to [y]
///
/// Private Sub ExampleInvalidRangeExpression(ByVal value As String)
/// Select Case value
/// Case "Beginning" To "End"
/// ' ...
/// Case "Start" To "Finish" ' unreachable: incorrect form.
/// ' ...
/// Case Else
/// ' ...
/// End Select
/// End Sub
/// ]]>
/// </module>
/// </example>
internal sealed class UnreachableCaseInspection : InspectionBase, IParseTreeInspection
{
private readonly IUnreachableCaseInspector _inspector;
private readonly IParseTreeValueVisitor _parseTreeValueVisitor;
private readonly IInspectionListener<VBAParser.SelectCaseStmtContext> _listener;
public enum CaseInspectionResultType
{
Unreachable,
InherentlyUnreachable,
MismatchType,
Overflow,
CaseElse
}
public UnreachableCaseInspection(
IDeclarationFinderProvider declarationFinderProvider,
IUnreachableCaseInspector inspector,
IParseTreeValueVisitor parseTreeValueVisitor)
: base(declarationFinderProvider)
{
_inspector = inspector;
_parseTreeValueVisitor = parseTreeValueVisitor;
_listener = new UnreachableCaseInspectionListener();
}
public CodeKind TargetKindOfCode => CodeKind.CodePaneCode;
public IInspectionListener Listener => _listener;
protected override IEnumerable<IInspectionResult> DoGetInspectionResults(DeclarationFinder finder)
{
return finder.UserDeclarations(DeclarationType.Module)
.Where(module => module != null)
.SelectMany(module => DoGetInspectionResults(module.QualifiedModuleName, finder))
.ToList();
}
protected override IEnumerable<IInspectionResult> DoGetInspectionResults(QualifiedModuleName module, DeclarationFinder finder)
{
var qualifiedSelectCaseStmts = _listener.Contexts(module)
// ignore filtering here to make the search space smaller
.Where(result => !result.IsIgnoringInspectionResultFor(finder, AnnotationName));
return qualifiedSelectCaseStmts
.SelectMany(context => ResultsForContext(context, finder))
.ToList();
}
private IEnumerable<IInspectionResult> ResultsForContext(QualifiedContext<VBAParser.SelectCaseStmtContext> qualifiedSelectCaseStmt, DeclarationFinder finder)
{
var module = qualifiedSelectCaseStmt.ModuleName;
var selectStmt = qualifiedSelectCaseStmt.Context;
var contextValues = _parseTreeValueVisitor.VisitChildren(module, selectStmt, finder);
var results = _inspector.InspectForUnreachableCases(module, selectStmt, contextValues, finder);
return results
.Select(resultTpl => CreateInspectionResult(qualifiedSelectCaseStmt, resultTpl.context, resultTpl.resultType))
.ToList();
}
private IInspectionResult CreateInspectionResult(QualifiedContext<VBAParser.SelectCaseStmtContext> selectStmt, ParserRuleContext unreachableBlock, CaseInspectionResultType resultType)
{
return CreateInspectionResult(selectStmt, unreachableBlock, ResultMessage(resultType));
}
//This cannot be a dictionary because the strings have to change after a change in the selected language.
private static string ResultMessage(CaseInspectionResultType resultType)
{
switch (resultType)
{
case CaseInspectionResultType.Unreachable:
return InspectionResults.UnreachableCaseInspection_Unreachable;
case CaseInspectionResultType.InherentlyUnreachable:
return InspectionResults.UnreachableCaseInspection_InherentlyUnreachable;
case CaseInspectionResultType.MismatchType:
return InspectionResults.UnreachableCaseInspection_TypeMismatch;
case CaseInspectionResultType.Overflow:
return InspectionResults.UnreachableCaseInspection_Overflow;
case CaseInspectionResultType.CaseElse:
return InspectionResults.UnreachableCaseInspection_CaseElse;
default:
throw new ArgumentOutOfRangeException(nameof(resultType), resultType, null);
}
}
private IInspectionResult CreateInspectionResult(QualifiedContext<VBAParser.SelectCaseStmtContext> selectStmt, ParserRuleContext unreachableBlock, string message)
{
return new QualifiedContextInspectionResult(this,
message,
new QualifiedContext<ParserRuleContext>(selectStmt.ModuleName, unreachableBlock));
}
private class UnreachableCaseInspectionListener : InspectionListenerBase<VBAParser.SelectCaseStmtContext>
{
public override void EnterSelectCaseStmt([NotNull] VBAParser.SelectCaseStmtContext context)
{
SaveContext(context);
}
}
}
} | rubberduck-vba/Rubberduck | Rubberduck.CodeAnalysis/Inspections/Concrete/UnreachableCaseInspection.cs | C# | gpl-3.0 | 9,101 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
2291,
1012,
11409,
4160,
1025,
2478,
14405,
20974,
2549,
1012,
2448,
7292,
1025,
2478,
14405,
20974,
2549,
1012,
2448,
7292,
1012,
28616,
2278,
1025,
2478,
8903,
8566... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>validsdp: 9 m 3 s 🏆</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.15.0 / validsdp - 1.0.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
validsdp
<small>
1.0.0
<span class="label label-success">9 m 3 s 🏆</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-02-01 04:13:48 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-02-01 04:13:48 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-threads base
base-unix base
conf-findutils 1 Virtual package relying on findutils
conf-gmp 4 Virtual package relying on a GMP lib system installation
coq 8.15.0 Formal proof management system
dune 2.9.3 Fast, portable, and opinionated build system
ocaml 4.12.1 The OCaml compiler (virtual package)
ocaml-base-compiler 4.12.1 Official release 4.12.1
ocaml-config 2 OCaml Switch Configuration
ocaml-options-vanilla 1 Ensure that OCaml is compiled with no special options enabled
ocamlfind 1.9.3 A library manager for OCaml
zarith 1.12 Implements arithmetic and logical operations over arbitrary-precision integers
# opam file:
opam-version: "2.0"
maintainer: [
"Érik Martin-Dorel <erik.martin-dorel@irit.fr>"
"Pierre Roux <pierre.roux@onera.fr>"
]
homepage: "https://sourcesup.renater.fr/validsdp/"
dev-repo: "git+https://github.com/validsdp/validsdp.git"
bug-reports: "https://github.com/validsdp/validsdp/issues"
license: "LGPL-2.1-or-later"
build: [
["sh" "-c" "./configure"]
[make "-j%{jobs}%"]
]
run-test: [make "-j%{jobs}%" "test"]
install: [make "install"]
depends: [
"ocaml"
"coq" {>= "8.12" & < "8.16~"}
"coq-bignums"
"coq-flocq" {>= "3.3.0"}
"coq-interval" {>= "4.0.0" & < "5~"}
"coq-mathcomp-field" {>= "1.12" & < "1.15~"}
"coq-mathcomp-analysis" {>= "0.3.4" & < "0.4~"}
"coq-libvalidsdp" {= "1.0.0"}
"coq-mathcomp-multinomials" {>= "1.2"}
"coq-coqeal" {>= "1.1.0"}
"coq-paramcoq" {>= "1.1.0"}
"osdp" {>= "1.0"}
"ocamlfind" {build}
"conf-autoconf" {build & dev}
]
synopsis: "ValidSDP"
description: """
ValidSDP is a library for the Coq formal proof assistant. It provides
reflexive tactics to prove multivariate inequalities involving
real-valued variables and rational constants, using SDP solvers as
untrusted back-ends and verified checkers based on libValidSDP.
Once installed, you can import the following modules:
From Coq Require Import Reals.
From ValidSDP Require Import validsdp.
"""
tags: [
"keyword:libValidSDP"
"keyword:ValidSDP"
"keyword:floating-point arithmetic"
"keyword:Cholesky decomposition"
"category:Miscellaneous/Coq Extensions"
"logpath:ValidSDP"
]
authors: [
"Érik Martin-Dorel <erik.martin-dorel@irit.fr>"
"Pierre Roux <pierre.roux@onera.fr>"
]
url {
src: "https://github.com/validsdp/validsdp/releases/download/v1.0.0/validsdp-1.0.0.tar.gz"
checksum: "sha512=6cabd5f4b202a78a92e1f55ec2ab37d552b3e295de2b048392ac87c06dfa9d54f53c2160e06db08f32b4d36dfbabff2dc2c4cbbac0c46346d5105d65296cfb26"
}
</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-validsdp.1.0.0 coq.8.15.0</code></dd>
<dt>Return code</dt>
<dd>0</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>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam list; echo; ulimit -Sv 4000000; timeout 4h opam install -y --deps-only coq-validsdp.1.0.0 coq.8.15.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>1 h 23 m</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam list; echo; ulimit -Sv 16000000; timeout 4h opam install -y -v coq-validsdp.1.0.0 coq.8.15.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>9 m 3 s</dd>
</dl>
<h2>Installation size</h2>
<p>Total: 4 M</p>
<ul>
<li>1 M <code>../ocaml-base-compiler.4.12.1/lib/coq/user-contrib/ValidSDP/soswitness.cmxs</code></li>
<li>1 M <code>../ocaml-base-compiler.4.12.1/lib/coq/user-contrib/ValidSDP/validsdp.vo</code></li>
<li>497 K <code>../ocaml-base-compiler.4.12.1/lib/coq/user-contrib/ValidSDP/cholesky_prog.glob</code></li>
<li>496 K <code>../ocaml-base-compiler.4.12.1/lib/coq/user-contrib/ValidSDP/cholesky_prog.vo</code></li>
<li>437 K <code>../ocaml-base-compiler.4.12.1/lib/coq/user-contrib/ValidSDP/validsdp.glob</code></li>
<li>172 K <code>../ocaml-base-compiler.4.12.1/lib/coq/user-contrib/ValidSDP/posdef_check.vo</code></li>
<li>128 K <code>../ocaml-base-compiler.4.12.1/lib/coq/user-contrib/ValidSDP/posdef_check.glob</code></li>
<li>107 K <code>../ocaml-base-compiler.4.12.1/lib/coq/user-contrib/ValidSDP/validsdp.v</code></li>
<li>76 K <code>../ocaml-base-compiler.4.12.1/lib/coq/user-contrib/ValidSDP/cholesky_prog.v</code></li>
<li>72 K <code>../ocaml-base-compiler.4.12.1/lib/coq/user-contrib/ValidSDP/misc.vo</code></li>
<li>64 K <code>../ocaml-base-compiler.4.12.1/lib/coq/user-contrib/ValidSDP/iteri_ord.vo</code></li>
<li>50 K <code>../ocaml-base-compiler.4.12.1/lib/coq/user-contrib/ValidSDP/iteri_ord.glob</code></li>
<li>40 K <code>../ocaml-base-compiler.4.12.1/lib/coq/user-contrib/ValidSDP/soswitness.vo</code></li>
<li>38 K <code>../ocaml-base-compiler.4.12.1/lib/coq/user-contrib/ValidSDP/soswitnesstac.vo</code></li>
<li>36 K <code>../ocaml-base-compiler.4.12.1/lib/coq/user-contrib/ValidSDP/misc.glob</code></li>
<li>32 K <code>../ocaml-base-compiler.4.12.1/lib/coq/user-contrib/ValidSDP/soswitnesstac.glob</code></li>
<li>22 K <code>../ocaml-base-compiler.4.12.1/lib/coq/user-contrib/ValidSDP/posdef_check.v</code></li>
<li>14 K <code>../ocaml-base-compiler.4.12.1/lib/coq/user-contrib/ValidSDP/soswitness.cmi</code></li>
<li>8 K <code>../ocaml-base-compiler.4.12.1/lib/coq/user-contrib/ValidSDP/iteri_ord.v</code></li>
<li>7 K <code>../ocaml-base-compiler.4.12.1/lib/coq/user-contrib/ValidSDP/soswitness.cmx</code></li>
<li>6 K <code>../ocaml-base-compiler.4.12.1/lib/coq/user-contrib/ValidSDP/misc.v</code></li>
<li>6 K <code>../ocaml-base-compiler.4.12.1/lib/coq/user-contrib/ValidSDP/soswitnesstac.v</code></li>
<li>4 K <code>../ocaml-base-compiler.4.12.1/lib/coq/user-contrib/ValidSDP/soswitness.cmxa</code></li>
<li>3 K <code>../ocaml-base-compiler.4.12.1/lib/coq/user-contrib/ValidSDP/soswitness.v</code></li>
<li>1 K <code>../ocaml-base-compiler.4.12.1/lib/coq/user-contrib/ValidSDP/soswitness.glob</code></li>
</ul>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq-validsdp.1.0.0</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>
| coq-bench/coq-bench.github.io | clean/Linux-x86_64-4.12.1-2.0.8/released/8.15.0/validsdp/1.0.0.html | HTML | mit | 11,058 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
11374,
1027,
1000,
4372,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
18804,
2171,
1027,
1000,
3193,
6442,
1000,
418... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# -*- coding: utf-8 -*-
import pilas
archi = open('datos.txt', 'r')
nivel = archi.readline()
pantalla = archi.readline()
idioma = archi.readline()
archi.close()
if idioma == "ES":
from modulos.ES import *
else:
from modulos.EN import *
class EscenaMenu(pilas.escena.Base):
"Es la escena de presentación donde se elijen las opciones del juego."
def __init__(self, musica=False):
pilas.escena.Base.__init__(self)
self.musica = musica
def iniciar(self):
pilas.fondos.Fondo("data/guarida.jpg")
pilas.avisar(menu_aviso)
self.crear_el_menu_principal()
pilas.mundo.agregar_tarea(0.1, self.act)
self.sonido = pilas.sonidos.cargar("data/menu.ogg")
self.sonido.reproducir(repetir=True)
def crear_el_menu_principal(self):
opciones = [
(menu1, self.comenzar_a_jugar),
(menu2, self.mostrar_ayuda_del_juego),
(menu3, self.mostrar_historia),
(menu4, self.mostrar_opciones),
(menu5, self.salir_del_juego)
]
self.trans = pilas.actores.Actor("data/trans.png")
self.trans.x = -155
self.trans.arriba = 85
self.menu = pilas.actores.Menu(opciones, x=-150, y=70, color_normal=
pilas.colores.negro, color_resaltado=pilas.colores.rojo)
self.menu.x = -150
def act(self):
if self.menu.x == -500:
if self.donde == "jugar":
self.sonido.detener()
import escena_niveles
pilas.cambiar_escena(escena_niveles.EscenaNiveles())
return False
elif self.donde == "historia":
self.sonido.detener()
import escena_historia
pilas.cambiar_escena(escena_historia.Historia())
elif self.donde == "ayuda":
self.sonido.detener()
import escena_ayuda
pilas.cambiar_escena(escena_ayuda.Ayuda())
elif self.donde == "opciones":
self.sonido.detener()
import escena_opciones
pilas.cambiar_escena(escena_opciones.Opciones())
return True
def mostrar_historia(self):
self.menu.x = [-500]
self.trans.x = [-500]
self.donde = "historia"
def mostrar_opciones(self):
self.menu.x = [-500]
self.trans.x = [-500]
self.donde = "opciones"
def comenzar_a_jugar(self):
self.menu.x = [-500]
self.trans.x = [-500]
self.donde = "jugar"
def mostrar_ayuda_del_juego(self):
self.menu.x = [-500]
self.trans.x = [-500]
self.donde = "ayuda"
def salir_del_juego(self):
pilas.terminar()
| MendeleievBros/Mendeleiev-Bros | mendeleiev_bros/escena_menu.py | Python | gpl-3.0 | 2,716 | [
30522,
1001,
1011,
1008,
1011,
16861,
1024,
21183,
2546,
1011,
1022,
1011,
1008,
1011,
12324,
14255,
8523,
7905,
2072,
1027,
2330,
1006,
1005,
23755,
2891,
1012,
19067,
2102,
1005,
1010,
1005,
1054,
1005,
1007,
9152,
15985,
1027,
7905,
2072... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#pragma once
#define attr __attribute__
#include <stdbool.h>
#include <netdb.h>
typedef struct sockaddr SockAddr;
typedef struct addrinfo AddrInfo;
#define AutoAddrInfo attr((cleanup(ai_free))) AddrInfo
void ai_free(AddrInfo **const ai)
attr((nonnull));
void ai_print(const char *const prefix,
const int family,
SockAddr *const addr,
const char *const port,
const bool handle_errno)
attr((nonnull));
int xgetai(const char *const host,
const char *const port,
const int family,
const int socktype,
const int flags,
AddrInfo **result)
attr((warn_unused_result, nonnull(2, 6)));
| fredmorcos/attic | projects/backy/backy/ai.h | C | isc | 699 | [
30522,
1001,
10975,
8490,
2863,
2320,
1001,
9375,
2012,
16344,
1035,
1035,
17961,
1035,
1035,
1001,
2421,
1026,
2358,
18939,
13669,
1012,
1044,
1028,
1001,
2421,
1026,
5658,
18939,
1012,
1044,
1028,
21189,
12879,
2358,
6820,
6593,
28407,
42... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import Setting from '../models/setting';
import KhongDau from 'khong-dau';
export function getSettings(req, res) {
Setting.find({ disable: false }).exec((err, settings) => {
if(err) {
res.json({ settings: [] });
} else {
res.json({ settings });
}
})
}
| tranphong001/BIGVN | server/controllers/setting.controller.js | JavaScript | mit | 281 | [
30522,
12324,
4292,
2013,
1005,
1012,
1012,
1013,
4275,
1013,
4292,
1005,
1025,
12324,
1047,
19991,
2850,
2226,
2013,
1005,
1047,
19991,
1011,
4830,
2226,
1005,
1025,
9167,
3853,
4152,
18319,
3070,
2015,
1006,
2128,
4160,
1010,
24501,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright 2010 The Bazel Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.testing.junit.runner.sharding.testing;
import static com.google.common.truth.Truth.assertThat;
import com.google.testing.junit.runner.sharding.api.ShardingFilterFactory;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import junit.framework.TestCase;
import org.junit.Test;
import org.junit.runner.Description;
import org.junit.runner.manipulation.Filter;
/**
* Common base class for all sharding filter tests.
*/
public abstract class ShardingFilterTestCase extends TestCase {
static final List<Description> TEST_DESCRIPTIONS = createGenericTestCaseDescriptions(6);
/**
* Returns a filter of the subclass type using the given descriptions,
* shard index, and total number of shards.
*/
protected abstract ShardingFilterFactory createShardingFilterFactory();
public final void testShardingIsCompleteAndPartitioned_oneShard() {
assertShardingIsCompleteAndPartitioned(createFilters(TEST_DESCRIPTIONS, 1), TEST_DESCRIPTIONS);
}
public final void testShardingIsStable_oneShard() {
assertShardingIsStable(createFilters(TEST_DESCRIPTIONS, 1), TEST_DESCRIPTIONS);
}
public final void testShardingIsCompleteAndPartitioned_moreTestsThanShards() {
assertShardingIsCompleteAndPartitioned(createFilters(TEST_DESCRIPTIONS, 5), TEST_DESCRIPTIONS);
}
public final void testShardingIsStable_moreTestsThanShards() {
assertShardingIsStable(createFilters(TEST_DESCRIPTIONS, 5), TEST_DESCRIPTIONS);
}
public final void testShardingIsCompleteAndPartitioned_sameNumberOfTestsAndShards() {
assertShardingIsCompleteAndPartitioned(createFilters(TEST_DESCRIPTIONS, 6), TEST_DESCRIPTIONS);
}
public final void testShardingIsStable_sameNumberOfTestsAndShards() {
assertShardingIsStable(createFilters(TEST_DESCRIPTIONS, 6), TEST_DESCRIPTIONS);
}
public final void testShardingIsCompleteAndPartitioned_moreShardsThanTests() {
assertShardingIsCompleteAndPartitioned(createFilters(TEST_DESCRIPTIONS, 7), TEST_DESCRIPTIONS);
}
public final void testShardingIsStable_moreShardsThanTests() {
assertShardingIsStable(createFilters(TEST_DESCRIPTIONS, 7), TEST_DESCRIPTIONS);
}
public final void testShardingIsCompleteAndPartitioned_duplicateDescriptions() {
List<Description> descriptions = new ArrayList<>();
descriptions.addAll(createGenericTestCaseDescriptions(6));
descriptions.addAll(createGenericTestCaseDescriptions(6));
assertShardingIsCompleteAndPartitioned(createFilters(descriptions, 7), descriptions);
}
public final void testShardingIsStable_duplicateDescriptions() {
List<Description> descriptions = new ArrayList<>();
descriptions.addAll(createGenericTestCaseDescriptions(6));
descriptions.addAll(createGenericTestCaseDescriptions(6));
assertShardingIsStable(createFilters(descriptions, 7), descriptions);
}
public final void testShouldRunTestSuite() {
Description testSuiteDescription = createTestSuiteDescription();
Filter filter = createShardingFilterFactory().createFilter(TEST_DESCRIPTIONS, 0, 1);
assertThat(filter.shouldRun(testSuiteDescription)).isTrue();
}
/**
* Creates a list of generic test case descriptions.
*
* @param numDescriptions the number of generic test descriptions to add to the list.
*/
public static List<Description> createGenericTestCaseDescriptions(int numDescriptions) {
List<Description> descriptions = new ArrayList<>();
for (int i = 0; i < numDescriptions; i++) {
descriptions.add(Description.createTestDescription(Test.class, "test" + i));
}
return descriptions;
}
protected static final List<Filter> createFilters(List<Description> descriptions, int numShards,
ShardingFilterFactory factory) {
List<Filter> filters = new ArrayList<>();
for (int shardIndex = 0; shardIndex < numShards; shardIndex++) {
filters.add(factory.createFilter(descriptions, shardIndex, numShards));
}
return filters;
}
protected final List<Filter> createFilters(List<Description> descriptions, int numShards) {
return createFilters(descriptions, numShards, createShardingFilterFactory());
}
protected static void assertThrowsExceptionForUnknownDescription(Filter filter) {
try {
filter.shouldRun(Description.createTestDescription(Object.class, "unknown"));
fail("expected thrown exception");
} catch (IllegalArgumentException expected) { }
}
/**
* Simulates test sharding with the given filters and test descriptions.
*
* @param filters a list of filters, one per test shard
* @param descriptions a list of test descriptions
* @return a mapping from each filter to the descriptions of the tests that would be run
* by the shard associated with that filter.
*/
protected static Map<Filter, List<Description>> simulateTestRun(List<Filter> filters,
List<Description> descriptions) {
Map<Filter, List<Description>> descriptionsRun = new HashMap<>();
for (Filter filter : filters) {
for (Description description : descriptions) {
if (filter.shouldRun(description)) {
addDescriptionForFilterToMap(descriptionsRun, filter, description);
}
}
}
return descriptionsRun;
}
/**
* Simulates test sharding with the given filters and test descriptions, for a
* set of test descriptions that is in a different order in every test shard.
*
* @param filters a list of filters, one per test shard
* @param descriptions a list of test descriptions
* @return a mapping from each filter to the descriptions of the tests that would be run
* by the shard associated with that filter.
*/
protected static Map<Filter, List<Description>> simulateSelfRandomizingTestRun(
List<Filter> filters, List<Description> descriptions) {
if (descriptions.isEmpty()) {
return new HashMap<>();
}
Deque<Description> mutatingDescriptions = new LinkedList<>(descriptions);
Map<Filter, List<Description>> descriptionsRun = new HashMap<>();
for (Filter filter : filters) {
// rotate the queue so that each filter gets the descriptions in a different order
mutatingDescriptions.addLast(mutatingDescriptions.pollFirst());
for (Description description : descriptions) {
if (filter.shouldRun(description)) {
addDescriptionForFilterToMap(descriptionsRun, filter, description);
}
}
}
return descriptionsRun;
}
/**
* Creates a test suite description (a Description that returns true
* when {@link org.junit.runner.Description#isSuite()} is called.)
*/
protected static Description createTestSuiteDescription() {
Description testSuiteDescription = Description.createSuiteDescription("testSuite");
testSuiteDescription.addChild(Description.createSuiteDescription("testCase"));
return testSuiteDescription;
}
/**
* Tests that the sharding is complete (each test is run at least once) and
* partitioned (each test is run at most once) -- in other words, that
* each test is run exactly once. This is a requirement of all test
* sharding functions.
*/
protected static void assertShardingIsCompleteAndPartitioned(List<Filter> filters,
List<Description> descriptions) {
Map<Filter, List<Description>> run = simulateTestRun(filters, descriptions);
assertThatCollectionContainsExactlyElementsInList(getAllValuesInMap(run), descriptions);
run = simulateSelfRandomizingTestRun(filters, descriptions);
assertThatCollectionContainsExactlyElementsInList(getAllValuesInMap(run), descriptions);
}
/**
* Tests that sharding is stable for the given filters, regardless of the
* ordering of the descriptions. This is useful for verifying that sharding
* works with self-randomizing test suites, and a requirement of all test
* sharding functions.
*/
protected static void assertShardingIsStable(
List<Filter> filters, List<Description> descriptions) {
Map<Filter, List<Description>> run1 = simulateTestRun(filters, descriptions);
Map<Filter, List<Description>> run2 = simulateTestRun(filters, descriptions);
assertThat(run2).isEqualTo(run1);
Map<Filter, List<Description>> randomizedRun1 =
simulateSelfRandomizingTestRun(filters, descriptions);
Map<Filter, List<Description>> randomizedRun2 =
simulateSelfRandomizingTestRun(filters, descriptions);
assertThat(randomizedRun2).isEqualTo(randomizedRun1);
}
private static void addDescriptionForFilterToMap(
Map<Filter, List<Description>> descriptionsRun, Filter filter, Description description) {
List<Description> descriptions = descriptionsRun.get(filter);
if (descriptions == null) {
descriptions = new ArrayList<>();
descriptionsRun.put(filter, descriptions);
}
descriptions.add(description);
}
private static Collection<Description> getAllValuesInMap(Map<Filter, List<Description>> map) {
Collection<Description> allDescriptions = new ArrayList<>();
for (List<Description> descriptions : map.values()) {
allDescriptions.addAll(descriptions);
}
return allDescriptions;
}
/**
* Returns whether the Collection and the List contain exactly the same elements with the same
* frequency, ignoring the ordering.
*/
private static void assertThatCollectionContainsExactlyElementsInList(
Collection<Description> actual, List<Description> expectedDescriptions) {
String basicAssertionMessage = "Elements of collection " + actual + " are not the same as the "
+ "elements of expected list " + expectedDescriptions + ". ";
if (actual.size() != expectedDescriptions.size()) {
throw new AssertionError(basicAssertionMessage + "The number of elements is different.");
}
List<Description> actualDescriptions = new ArrayList<Description>(actual);
// Keeps track of already reviewed descriptions, so they won't be checked again when next
// encountered.
// Note: this algorithm has O(n^2) time complexity and will be slow for large inputs.
Set<Description> reviewedDescriptions = new HashSet<>();
for (int i = 0; i < actual.size(); i++) {
Description currDescription = actualDescriptions.get(i);
// If already reviewed, skip.
if (reviewedDescriptions.contains(currDescription)) {
continue;
}
int actualFreq = 0;
int expectedFreq = 0;
// Count the frequency of the current description in both lists.
for (int j = 0; j < actual.size(); j++) {
if (currDescription.equals(actualDescriptions.get(j))) {
actualFreq++;
}
if (currDescription.equals(expectedDescriptions.get(j))) {
expectedFreq++;
}
}
if (actualFreq < expectedFreq) {
throw new AssertionError(basicAssertionMessage + "There are " + (expectedFreq - actualFreq)
+ " missing occurrences of " + currDescription + ".");
} else if (actualFreq > expectedFreq) {
throw new AssertionError(basicAssertionMessage + "There are " + (actualFreq - expectedFreq)
+ " unexpected occurrences of " + currDescription + ".");
}
reviewedDescriptions.add(currDescription);
}
}
}
| damienmg/bazel | src/java_tools/junitrunner/java/com/google/testing/junit/runner/sharding/testing/ShardingFilterTestCase.java | Java | apache-2.0 | 12,016 | [
30522,
1013,
1013,
9385,
2230,
1996,
8670,
12638,
6048,
1012,
2035,
2916,
9235,
1012,
1013,
1013,
1013,
1013,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1013,
1013,
2017,
2089,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
--终结的炽天使 柊深夜
function c80060022.initial_effect(c)
--synchro summon
aux.AddSynchroProcedure(c,aux.FilterBoolFunction(Card.IsSetCard,0x92d7),aux.NonTuner(Card.IsSetCard,0x92d7),1)
c:EnableReviveLimit()
--pendulum summon
aux.EnablePendulumAttribute(c,false)
--pendulum set
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_PZONE)
e1:SetCountLimit(1,80060022)
e1:SetTarget(c80060022.pctg)
e1:SetOperation(c80060022.pcop)
c:RegisterEffect(e1)
--destroy
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(80060022,0))
e2:SetCategory(CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetCondition(c80060022.descon)
e2:SetTarget(c80060022.destg)
e2:SetOperation(c80060022.desop)
c:RegisterEffect(e2)
--pendulum
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(80060022,2))
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCode(EVENT_DESTROYED)
e3:SetCondition(c80060022.pencon)
e3:SetTarget(c80060022.pentg)
e3:SetOperation(c80060022.penop)
c:RegisterEffect(e3)
--indes
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e4:SetRange(LOCATION_MZONE)
e4:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e4:SetValue(1)
c:RegisterEffect(e4)
--special summon
local e5=Effect.CreateEffect(c)
e5:SetCategory(CATEGORY_SPECIAL_SUMMON)
e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e5:SetRange(LOCATION_PZONE)
e5:SetCode(EVENT_DESTROYED)
e5:SetCountLimit(1,80060015)
e5:SetCondition(c80060022.spcon)
e5:SetTarget(c80060022.sptg)
e5:SetOperation(c80060022.spop)
c:RegisterEffect(e5)
--act limit
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_FIELD)
e6:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e6:SetCode(EFFECT_CANNOT_ACTIVATE)
e6:SetRange(LOCATION_MZONE)
e6:SetTargetRange(0,1)
e6:SetValue(c80060022.aclimit)
c:RegisterEffect(e6)
end
function c80060022.descon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetSummonType()==SUMMON_TYPE_SYNCHRO
end
function c80060022.desfilter(c)
return c:IsType(TYPE_SPELL+TYPE_TRAP)
end
function c80060022.destg(e,tp,eg,ep,ev,re,r,rp,chk)
local seq=e:GetHandler():GetSequence()
local g=Group.CreateGroup()
local dc=Duel.GetFieldCard(1-tp,LOCATION_MZONE,4-seq)
if dc then g:AddCard(dc) end
dc=Duel.GetFieldCard(1-tp,LOCATION_SZONE,4-seq)
if dc then g:AddCard(dc) end
if chk==0 then return g:GetCount()~=0 end
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
Duel.SetChainLimit(c80060022.chainlm)
end
function c80060022.desop(e,tp,eg,ep,ev,re,r,rp)
local seq=e:GetHandler():GetSequence()
local g=Group.CreateGroup()
local tc=Duel.GetFieldCard(1-tp,LOCATION_MZONE,4-seq)
if tc then g:AddCard(tc) end
tc=Duel.GetFieldCard(1-tp,LOCATION_SZONE,4-seq)
if tc then g:AddCard(tc) end
Duel.Destroy(g,REASON_EFFECT)
end
function c80060022.chainlm(e,rp,tp)
return tp==rp
end
function c80060022.pencon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return bit.band(r,REASON_EFFECT+REASON_BATTLE)~=0 and c:IsPreviousLocation(LOCATION_MZONE) and c:IsFaceup()
end
function c80060022.pentg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLocation(tp,LOCATION_SZONE,6) or Duel.CheckLocation(tp,LOCATION_SZONE,7) end
end
function c80060022.penop(e,tp,eg,ep,ev,re,r,rp)
if not Duel.CheckLocation(tp,LOCATION_SZONE,6) and not Duel.CheckLocation(tp,LOCATION_SZONE,7) then return false end
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEUP,true)
end
end
function c80060022.pcfilter(c)
return c:IsType(TYPE_PENDULUM) and not c:IsForbidden() and c:IsSetCard(0x92d7)
end
function c80060022.pctg(e,tp,eg,ep,ev,re,r,rp,chk)
local seq=e:GetHandler():GetSequence()
if chk==0 then return Duel.CheckLocation(tp,LOCATION_SZONE,13-seq)
and Duel.IsExistingMatchingCard(c80060022.pcfilter,tp,LOCATION_DECK,0,1,nil) end
end
function c80060022.pcop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local seq=e:GetHandler():GetSequence()
if not Duel.CheckLocation(tp,LOCATION_SZONE,13-seq) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD)
local g=Duel.SelectMatchingCard(tp,c80060022.pcfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.MoveToField(g:GetFirst(),tp,tp,LOCATION_SZONE,POS_FACEUP,true)
end
end
function c80060022.cfilter(c,tp)
return c:IsPreviousLocation(LOCATION_MZONE) and c:GetPreviousControler()==tp and c:IsReason(REASON_EFFECT)
end
function c80060022.spcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c80060022.cfilter,1,nil,tp)
end
function c80060022.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c80060022.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
if Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)==0 and Duel.GetLocationCount(tp,LOCATION_MZONE)<=0
and c:IsCanBeSpecialSummoned(e,0,tp,false,false) then
Duel.SendtoGrave(c,REASON_RULE)
end
end
function c80060022.aclimit(e,re,tp)
return (re:GetHandler():GetType()==TYPE_SPELL+TYPE_QUICKPLAY or re:GetHandler():GetType()==TYPE_TRAP+TYPE_COUNTER) and re:IsHasType(EFFECT_TYPE_ACTIVATE)
end | MonokuroInzanaito/ygopro-777DIY | expansions/script/c80060022.lua | Lua | gpl-3.0 | 5,519 | [
30522,
1011,
1011,
100,
100,
1916,
100,
1811,
100,
100,
100,
100,
3853,
1039,
17914,
2692,
16086,
2692,
19317,
1012,
3988,
1035,
3466,
1006,
1039,
1007,
1011,
1011,
26351,
8093,
2080,
18654,
19554,
1012,
9909,
6038,
2818,
18981,
3217,
117... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# -*- coding: utf-8 -*-
"""
pythoner.net
Copyright (C) 2013 PYTHONER.ORG
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from django.contrib import admin
from models import *
class ProfileAdmin(admin.ModelAdmin):
list_display = ('screen_name','city','introduction')
admin.site.register(UserProfile,ProfileAdmin) | yohn89/pythoner.net | pythoner/accounts/admin.py | Python | gpl-3.0 | 915 | [
30522,
1001,
1011,
1008,
1011,
16861,
1024,
21183,
2546,
1011,
1022,
1011,
1008,
1011,
1000,
1000,
1000,
18750,
2121,
1012,
5658,
9385,
1006,
1039,
1007,
2286,
18750,
2121,
1012,
8917,
2023,
2565,
2003,
2489,
4007,
1024,
2017,
2064,
2417,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* Go! AOP framework
*
* @copyright Copyright 2013, Lisachenko Alexander <lisachenko.it@gmail.com>
*
* This source file is subject to the license that is bundled
* with this source code in the file LICENSE.
*/
namespace Demo\Example;
/**
* Human class example
*/
class HumanDemo
{
/**
* Eat something
*/
public function eat()
{
echo "Eating...", PHP_EOL;
}
/**
* Clean the teeth
*/
public function cleanTeeth()
{
echo "Cleaning teeth...", PHP_EOL;
}
/**
* Washing up
*/
public function washUp()
{
echo "Washing up...", PHP_EOL;
}
/**
* Working
*/
public function work()
{
echo "Working...", PHP_EOL;
}
/**
* Go to sleep
*/
public function sleep()
{
echo "Go to sleep...", PHP_EOL;
}
}
| latamautos/goaop | demos/Demo/Example/HumanDemo.php | PHP | mit | 880 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
2175,
999,
20118,
2361,
7705,
1008,
1008,
1030,
9385,
9385,
2286,
1010,
7059,
25872,
3656,
1026,
7059,
25872,
1012,
2009,
1030,
20917,
4014,
1012,
4012,
1028,
1008,
1008,
2023,
3120,
5371,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#adminmenuback,
#adminmenuwrap,
#adminmenu,
#adminmenu .wp-submenu {
width: 160px;
background-color: #222;
}
#adminmenuback {
position: absolute;
top: 0;
bottom: 0;
z-index: -1;
}
#adminmenu {
clear: right;
margin: 12px 0 0;
padding: 0;
list-style: none;
}
.folded #adminmenuback,
.folded #adminmenuwrap,
.folded #adminmenu,
.folded #adminmenu li.menu-top {
width: 36px;
}
.icon16 {
height: 18px;
width: 18px;
padding: 6px 6px;
margin: -6px -8px 0 0;
float: right;
}
/* New Menu icons */
.icon16:before {
color: #999;
font: normal 20px/1 'dashicons';
speak: none;
padding: 6px 0;
height: 34px;
width: 20px;
display: inline-block;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-transition: all .1s ease-in-out;
transition: all .1s ease-in-out;
}
.icon16.icon-dashboard:before,
#adminmenu .menu-icon-dashboard div.wp-menu-image:before {
content: '\f226';
}
.icon16.icon-post:before,
#adminmenu .menu-icon-post div.wp-menu-image:before {
content: '\f109';
}
.icon16.icon-media:before,
#adminmenu .menu-icon-media div.wp-menu-image:before {
content: '\f104';
}
.icon16.icon-links:before,
#adminmenu .menu-icon-links div.wp-menu-image:before {
content: '\f103';
}
.icon16.icon-page:before,
#adminmenu .menu-icon-page div.wp-menu-image:before {
content: '\f105';
}
.icon16.icon-comments:before,
#adminmenu .menu-icon-comments div.wp-menu-image:before {
content: '\f101';
margin-top: 1px;
}
.icon16.icon-appearance:before,
#adminmenu .menu-icon-appearance div.wp-menu-image:before {
content: '\f100';
}
.icon16.icon-plugins:before,
#adminmenu .menu-icon-plugins div.wp-menu-image:before {
content: '\f106';
}
.icon16.icon-users:before,
#adminmenu .menu-icon-users div.wp-menu-image:before {
content: '\f110';
}
.icon16.icon-tools:before,
#adminmenu .menu-icon-tools div.wp-menu-image:before {
content: '\f107';
}
.icon16.icon-settings:before,
#adminmenu .menu-icon-settings div.wp-menu-image:before {
content: '\f108';
}
.icon16.icon-site:before,
#adminmenu .menu-icon-site div.wp-menu-image:before {
content: '\f112'
}
.icon16.icon-generic:before,
#adminmenu .menu-icon-generic div.wp-menu-image:before {
content: '\f111';
}
/* hide background-image for icons above */
.icon16.icon-dashboard,
.menu-icon-dashboard div.wp-menu-image,
.icon16.icon-post,
.menu-icon-post div.wp-menu-image,
.icon16.icon-media,
.menu-icon-media div.wp-menu-image,
.icon16.icon-links,
.menu-icon-links div.wp-menu-image,
.icon16.icon-page,
.menu-icon-page div.wp-menu-image,
.icon16.icon-comments,
.menu-icon-comments div.wp-menu-image,
.icon16.icon-appearance,
.menu-icon-appearance div.wp-menu-image,
.icon16.icon-plugins,
.menu-icon-plugins div.wp-menu-image,
.icon16.icon-users,
.menu-icon-users div.wp-menu-image,
.icon16.icon-tools,
.menu-icon-tools div.wp-menu-image,
.icon16.icon-settings,
.menu-icon-settings div.wp-menu-image,
.icon16.icon-site,
.menu-icon-site div.wp-menu-image,
.icon16.icon-generic,
.menu-icon-generic div.wp-menu-image {
background-image: none !important;
}
/*------------------------------------------------------------------------------
7.0 - Main Navigation (Left Menu)
------------------------------------------------------------------------------*/
#adminmenuwrap {
position: relative;
float: right;
}
/* side admin menu */
#adminmenu * {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
#adminmenu li {
margin: 0;
padding: 0;
cursor: pointer;
}
#adminmenu a {
display: block;
line-height: 18px;
padding: 2px 5px;
color: #eee;
}
#adminmenu a:hover,
#adminmenu li.menu-top > a:focus,
#adminmenu .wp-submenu a:hover,
#adminmenu .wp-submenu a:focus {
color: #2ea2cc;
}
#adminmenu li.menu-top {
border: none;
min-height: 34px;
position: relative;
}
#adminmenu .wp-submenu {
list-style: none;
position: absolute;
top: -1000em;
right: 160px;
overflow: visible;
word-wrap: break-word;
}
#adminmenu .wp-submenu,
.folded #adminmenu a.wp-has-current-submenu:focus + .wp-submenu,
.folded #adminmenu .wp-has-current-submenu .wp-submenu {
padding: 7px 0 8px;
z-index: 9999;
background-color: #333;
-webkit-box-shadow: 0 3px 5px rgba(0,0,0,0.2);
box-shadow: 0 3px 5px rgba(0,0,0,0.2);
}
#adminmenu .wp-submenu a,
.folded #adminmenu a.wp-has-current-submenu:focus + .wp-submenu a,
.folded #adminmenu .wp-has-current-submenu .wp-submenu a {
color: #bbb;
}
#adminmenu .wp-submenu a:hover,
#adminmenu .wp-submenu a:focus {
background: none;
}
.js #adminmenu .sub-open,
.js #adminmenu .opensub .wp-submenu,
#adminmenu a.menu-top:focus + .wp-submenu,
.no-js li.wp-has-submenu:hover .wp-submenu {
top: -1px;
}
#adminmenu .wp-has-current-submenu .wp-submenu,
.no-js li.wp-has-current-submenu:hover .wp-submenu,
#adminmenu a.wp-has-current-submenu:focus + .wp-submenu,
#adminmenu .wp-has-current-submenu .wp-submenu.sub-open,
#adminmenu .wp-has-current-submenu.opensub .wp-submenu {
position: relative;
z-index: 3;
top: auto;
right: auto;
left: auto;
bottom: auto;
border: 0 none;
margin-top: 0;
-webkit-box-shadow: none;
box-shadow: none;
background-color: #333;
}
#adminmenu li.wp-has-current-submenu a.wp-has-current-submenu,
#adminmenu li.current a.menu-top,
.folded #adminmenu li.wp-has-current-submenu,
.folded #adminmenu li.current.menu-top,
#adminmenu .wp-menu-arrow,
#adminmenu .wp-has-current-submenu .wp-submenu .wp-submenu-head,
#adminmenu .wp-menu-arrow div {
background: #0074a2;
color: #fff;
}
.folded #adminmenu .wp-submenu.sub-open,
.folded #adminmenu .opensub .wp-submenu,
.folded #adminmenu .wp-has-current-submenu .wp-submenu.sub-open,
.folded #adminmenu .wp-has-current-submenu.opensub .wp-submenu,
.folded #adminmenu a.menu-top:focus + .wp-submenu,
.folded #adminmenu .wp-has-current-submenu a.menu-top:focus + .wp-submenu,
.no-js.folded #adminmenu .wp-has-submenu:hover .wp-submenu {
top: 0;
right: 36px;
}
.folded #adminmenu a.wp-has-current-submenu:focus + .wp-submenu,
.folded #adminmenu .wp-has-current-submenu .wp-submenu {
position: absolute;
top: -1000em;
}
#adminmenu .wp-not-current-submenu .wp-submenu,
.folded #adminmenu .wp-has-current-submenu .wp-submenu {
min-width: 160px;
width: auto;
}
#adminmenu .wp-submenu a {
font-size: 13px;
line-height: 1.2;
margin: 0;
padding: 6px 0;
}
#adminmenu .wp-submenu li.current,
#adminmenu .wp-submenu li.current a,
#adminmenu .opensub .wp-submenu li.current a,
#adminmenu a.wp-has-current-submenu:focus + .wp-submenu li.current a,
#adminmenu .wp-submenu li.current a:hover,
#adminmenu .wp-submenu li.current a:focus {
color: #fff;
}
#adminmenu .wp-not-current-submenu li > a,
.folded #adminmenu .wp-has-current-submenu li > a {
padding-left: 16px;
padding-right: 14px;
-webkit-transition: all .1s ease-in-out;
transition: all .1s ease-in-out;
}
#adminmenu .wp-has-current-submenu ul > li > a,
.folded #adminmenu li.menu-top .wp-submenu > li > a {
padding: 6px 12px;
}
#adminmenu a.menu-top,
#adminmenu .wp-submenu-head {
font-size: 14px;
font-weight: 400;
line-height: 18px;
padding: 0;
}
#adminmenu .wp-submenu-head,
.folded #adminmenu .wp-menu-name {
display: none;
}
.folded #adminmenu .wp-submenu-head {
display: block;
}
#adminmenu .wp-submenu li {
padding: 0;
margin: 0;
overflow: hidden;
}
#adminmenu .wp-menu-image img {
padding: 9px 0px 0 0;
opacity: 0.6;
filter: alpha(opacity=60);
}
#adminmenu div.wp-menu-name {
padding: 8px 0;
}
#adminmenu div.wp-menu-image {
float: right;
width: 36px;
height: 30px;
margin: 0;
text-align: center;
}
#adminmenu div.wp-menu-image.svg {
background-repeat: no-repeat;
background-position: center;
-webkit-background-size: 20px auto;
background-size: 20px auto;
}
div.wp-menu-image:before {
font: normal 20px/1 'dashicons' !important;
speak: none;
color: #999;
padding: 8px 0;
height: 36px;
width: 20px;
display: inline-block;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-transition: all .1s ease-in-out;
transition: all .1s ease-in-out;
}
#adminmenu div.wp-menu-image:before {
color: #999;
}
#adminmenu li.wp-has-current-submenu:hover div.wp-menu-image:before,
#adminmenu .wp-has-current-submenu div.wp-menu-image:before,
#adminmenu .current div.wp-menu-image:before,
#adminmenu a.wp-has-current-submenu:hover div.wp-menu-image:before,
#adminmenu a.current:hover div.wp-menu-image:before {
color: #fff;
}
#adminmenu li:hover div.wp-menu-image:before {
color: #2ea2cc;
}
.folded #adminmenu div.wp-menu-image {
width: 35px;
height: 30px;
position: absolute;
z-index: 25;
}
.folded #adminmenu a.menu-top {
height: 34px;
}
/* No @font-face support */
.no-font-face #adminmenu .wp-menu-image {
display: none;
}
.no-font-face #adminmenu div.wp-menu-name {
padding: 8px 12px;
}
.no-font-face.auto-fold #adminmenu .wp-menu-name {
margin-right: 0;
}
/* End no @font-face support */
/* Sticky admin menu */
.sticky-menu #adminmenuwrap {
position: fixed;
z-index: 99; /* Match the z-index of .wp-submenu to ensure flyout menus don't appear underneath main column elements */
}
/* A new arrow */
.wp-menu-arrow {
display: none !important;
}
ul#adminmenu a.wp-has-current-submenu {
position: relative;
}
ul#adminmenu a.wp-has-current-submenu:after,
ul#adminmenu > li.current > a.current:after {
left: 0;
border: solid 8px transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-left-color: #f1f1f1;
top: 50%;
margin-top: -8px;
}
.folded ul#adminmenu li:hover a.wp-has-current-submenu:after {
display: none;
}
.folded ul#adminmenu a.wp-has-current-submenu:after,
.folded ul#adminmenu > li a.current:after {
border-width: 4px;
margin-top: -4px;
}
/* flyout menu arrow */
#adminmenu li.wp-has-submenu.wp-not-current-submenu:hover:after {
left: 0;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-width: 8px;
top: 10px;
z-index: 10000;
}
.folded ul#adminmenu li.wp-has-submenu.wp-not-current-submenu:hover:after {
border-width: 4px;
margin-top: -4px;
top: 18px;
}
#adminmenu li.wp-has-submenu.wp-not-current-submenu.opensub:hover:after {
border-left-color: #333;
}
/* ensure that wp-submenu's box shadow doesn't appear on top of the focused menu item's background. */
#adminmenu li.menu-top:hover,
#adminmenu li.opensub > a.menu-top,
#adminmenu li > a.menu-top:focus {
position: relative;
background-color: #111;
}
.folded #adminmenu li.menu-top:hover,
.folded #adminmenu li.opensub > a.menu-top,
.folded #adminmenu li > a.menu-top:focus {
z-index: 10000;
}
#adminmenu li.menu-top:hover .wp-menu-image img,
#adminmenu li.wp-has-current-submenu .wp-menu-image img {
opacity: 1;
filter: alpha(opacity=100);
}
#adminmenu li.wp-menu-separator {
height: 5px;
padding: 0;
margin: 0 0 6px 0;
cursor: inherit;
}
/* @todo: is this even needed given that it's nested beneath the above li.wp-menu-separator? */
#adminmenu div.separator {
height: 2px;
padding: 0;
}
#adminmenu .wp-submenu .wp-submenu-head {
color: #fff;
font-weight: 400;
font-size: 14px;
padding: 8px 11px 8px 4px;
margin: -7px 0px 4px;
}
#adminmenu li.current,
.folded #adminmenu li.wp-menu-open {
border: 0 none;
}
#adminmenu .awaiting-mod,
#adminmenu span.update-plugins,
#sidemenu li a span.update-plugins {
display: inline-block;
background-color: #d54e21;
color: #fff;
font-size: 9px;
line-height: 17px;
font-weight: 600;
margin: 1px 2px 0 0;
vertical-align: top;
-webkit-border-radius: 10px;
border-radius: 10px;
z-index: 26;
}
#adminmenu li .awaiting-mod span,
#adminmenu li span.update-plugins span,
#sidemenu li a span.update-plugins span {
display: block;
padding: 0 6px;
}
#adminmenu li.current a .awaiting-mod,
#adminmenu li a.wp-has-current-submenu .update-plugins {
background-color: #2ea2cc;
color: #fff;
}
#adminmenu li span.count-0,
#sidemenu li a .count-0 {
display: none;
}
#collapse-menu {
font-size: 13px;
line-height: 34px;
margin-top: 10px;
color: #aaa;
-webkit-transition: all .1s ease-in-out;
transition: all .1s ease-in-out;
}
#collapse-menu:hover,
#collapse-menu:hover #collapse-button div:after {
color: #2ea2cc;
}
.folded #collapse-menu span {
display: none;
}
#collapse-button,
#collapse-button div {
width: 15px;
height: 15px;
}
#collapse-button {
float: right;
height: 15px;
margin: 10px 11px 10px 8px;
width: 15px;
-webkit-border-radius: 10px;
border-radius: 10px;
}
#wpwrap #collapse-button div {
padding: 0;
}
#collapse-button div:after {
content: '\f148';
display: block;
line-height: 15px;
right: -3px;
top: -3px;
color: #aaa;
font: normal 20px/1 'dashicons' !important;
speak: none;
margin: 0 auto;
padding: 0 !important;
position: relative;
text-align: center;
width: 20px;
-webkit-transition: all .1s ease-in-out;
transition: all .1s ease-in-out;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.folded #collapse-button div:after,
.rtl #collapse-button div:after {
-webkit-transform: rotate(180deg);
-ms-transform: rotate(180deg);
transform: rotate(180deg);
}
.rtl.folded #collapse-button div:after {
-webkit-transform: none;
-ms-transform: none;
transform: none;
}
/**
* Toolbar menu toggle
*/
li#wp-admin-bar-menu-toggle {
display: none;
}
/* Auto-folding of the admin menu */
@media only screen and (max-width: 900px) {
.auto-fold #wpcontent,
.auto-fold #wpfooter {
margin-right: 56px;
}
.auto-fold #adminmenuback,
.auto-fold #adminmenuwrap,
.auto-fold #adminmenu,
.auto-fold #adminmenu li.menu-top {
width: 36px;
}
.auto-fold #adminmenu .wp-submenu.sub-open,
.auto-fold #adminmenu .opensub .wp-submenu,
.auto-fold #adminmenu .wp-has-current-submenu .wp-submenu.sub-open,
.auto-fold #adminmenu .wp-has-current-submenu.opensub .wp-submenu,
.auto-fold #adminmenu a.menu-top:focus + .wp-submenu,
.auto-fold #adminmenu .wp-has-current-submenu a.menu-top:focus + .wp-submenu {
top: 0px;
right: 36px;
}
.auto-fold #adminmenu a.wp-has-current-submenu:focus + .wp-submenu,
.auto-fold #adminmenu .wp-has-current-submenu .wp-submenu {
position: absolute;
top: -1000em;
margin-left: -1px;
padding: 7px 0 8px;
z-index: 9999;
}
.auto-fold #adminmenu .wp-has-current-submenu .wp-submenu {
min-width: 150px;
width: auto;
}
.auto-fold #adminmenu .wp-has-current-submenu li > a {
padding-left: 16px;
padding-right: 14px;
}
.auto-fold #adminmenu li.menu-top .wp-submenu > li > a {
padding-right: 12px;
}
.auto-fold #adminmenu .wp-menu-name {
display: none;
}
.auto-fold #adminmenu .wp-submenu-head {
display: block;
}
.auto-fold #adminmenu div.wp-menu-image {
height: 30px;
width: 34px;
position: absolute;
z-index: 25;
}
.auto-fold #adminmenu a.menu-top {
height: 34px;
}
.auto-fold #adminmenu li.wp-menu-open {
border: 0 none;
}
.auto-fold #adminmenu .wp-has-current-submenu.menu-top-last {
margin-bottom: 0;
}
.auto-fold ul#adminmenu li:hover a.wp-has-current-submenu:after {
display: none;
}
.auto-fold ul#adminmenu li.wp-has-submenu.wp-not-current-submenu:hover:after {
border-width: 4px;
margin-top: -4px;
top: 16px;
}
.auto-fold ul#adminmenu a.wp-has-current-submenu:after,
.auto-fold ul#adminmenu > li a.current:after {
border-width: 4px;
margin-top: -4px;
}
.auto-fold #adminmenu li.menu-top:hover,
.auto-fold #adminmenu li.opensub > a.menu-top,
.auto-fold #adminmenu li > a.menu-top:focus {
z-index: 10000;
}
.auto-fold #collapse-menu span {
display: none;
}
.auto-fold #collapse-button div {
background: none;
}
.auto-fold #collapse-button div:after {
-webkit-transform: rotate(180deg);
-ms-transform: rotate(180deg);
transform: rotate(180deg);
}
.rtl.auto-fold #collapse-button div:after {
-webkit-transform: none;
-ms-transform: none;
transform: none;
}
}
@media screen and ( max-width: 782px ) {
.auto-fold #wpcontent {
position: relative;
margin-right: 0;
padding-right: 10px;
}
.sticky-menu #adminmenuwrap {
position: relative;
z-index: auto;
top: 0;
}
/* Sidebar Adjustments */
.auto-fold #adminmenu,
.auto-fold #adminmenuback,
.auto-fold #adminmenuwrap {
position: absolute;
width: 190px;
z-index: 100;
}
.auto-fold #adminmenuback,
.auto-fold #adminmenuwrap {
display: none;
}
.auto-fold .wp-responsive-open #adminmenuback,
.auto-fold .wp-responsive-open #adminmenuwrap {
display: block;
}
.auto-fold #adminmenu li.menu-top {
width: 100%;
}
/* Resize the admin menu items to a comfortable touch size */
.auto-fold #adminmenu li a {
font-size: 16px;
padding: 5px;
}
.auto-fold #adminmenu li.menu-top .wp-submenu > li > a {
padding: 10px 20px 10px 10px;
}
/* Restore the menu names */
.auto-fold #adminmenu .wp-menu-name {
display: block;
margin-right: 35px;
}
/* Switch the arrow side */
.auto-fold ul#adminmenu a.wp-has-current-submenu:after,
.auto-fold ul#adminmenu > li.current > a.current:after {
border-width: 8px;
margin-top: -8px;
}
.auto-fold ul#adminmenu li.wp-has-submenu.wp-not-current-submenu:hover:after {
display: none;
}
/* Make the submenus appear correctly when tapped. */
#adminmenu .wp-submenu {
position: relative;
display: none;
}
.auto-fold #adminmenu .selected .wp-submenu,
.auto-fold #adminmenu .wp-menu-open .wp-submenu {
position: relative;
display: block;
top: 0;
right: -1px;
-webkit-box-shadow: none;
box-shadow: none;
}
.auto-fold #adminmenu .selected .wp-submenu:after,
.auto-fold #adminmenu .wp-menu-open .wp-submenu:after {
display: none;
}
.auto-fold #adminmenu .opensub .wp-submenu {
display: none;
}
.auto-fold #adminmenu .selected .wp-submenu {
display: block;
}
.auto-fold ul#adminmenu li:hover a.wp-has-current-submenu:after {
display: block;
}
.auto-fold #adminmenu a.menu-top:focus + .wp-submenu,
.auto-fold #adminmenu .wp-has-current-submenu a.menu-top:focus + .wp-submenu {
position: relative;
right: -1px;
left: 0;
top: 0;
}
/* Remove submenu headers and adjust sub meu*/
#adminmenu .wp-submenu .wp-submenu-head {
display: none;
}
/* Toolbar menu toggle */
#wp-responsive-toggle {
position: fixed;
top: 5px;
right: 4px;
padding-left: 10px;
z-index: 99999;
border: none;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
#wpadminbar #wp-admin-bar-menu-toggle a {
display: block;
padding: 0;
overflow: hidden;
outline: none;
text-decoration: none;
border: 1px solid transparent;
background: none;
height: 44px;
margin-right: -1px;
}
.wp-responsive-open #wpadminbar #wp-admin-bar-menu-toggle a {
background: #333;
}
li#wp-admin-bar-menu-toggle {
display: block;
}
#wpadminbar #wp-admin-bar-menu-toggle a:hover {
border: 1px solid transparent;
}
#wpadminbar #wp-admin-bar-menu-toggle .ab-icon:before {
content: '\f228';
display: inline-block;
float: right;
font: normal 40px/45px 'Dashicons';
vertical-align: middle;
outline: none;
margin: 0;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
height: 44px;
width: 50px;
padding: 0;
border: none;
text-align: center;
text-decoration: none;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
}
/* Smartphone */
@media screen and (max-width: 600px) {
#adminmenuwrap,
#adminmenuback {
display: none;
}
.wp-responsive-open #adminmenuwrap,
.wp-responsive-open #adminmenuback {
display: block;
}
.auto-fold #adminmenu {
top: 46px;
}
}
| dallasmatthews/deleteme-dallasmarketing.co.uk | wp-admin/css/admin-menu-rtl.css | CSS | gpl-2.0 | 19,606 | [
30522,
1001,
4748,
10020,
3549,
19761,
3600,
1010,
1001,
4748,
10020,
3549,
25974,
2527,
2361,
1010,
1001,
4748,
10020,
3549,
2226,
1010,
1001,
4748,
10020,
3549,
2226,
1012,
1059,
2361,
1011,
4942,
3549,
2226,
1063,
9381,
1024,
8148,
2361,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//The following Copyright applies to the LitDev Extension for Small Basic and files in the namespace LitDev.
//Copyright (C) <2011 - 2020> litdev@hotmail.co.uk
//This file is part of the LitDev Extension for Small Basic.
//LitDev Extension is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//LitDev Extension is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.
//You should have received a copy of the GNU General Public License
//along with menu. If not, see <http://www.gnu.org/licenses/>.
using Microsoft.SmallBasic.Library;
using System;
using System.IO;
using System.IO.Packaging;
using SBArray = Microsoft.SmallBasic.Library.Array;
using Ionic.Zip;
using System.Collections.Generic;
namespace LitDev
{
/// <summary>
/// Zip file compression utilities.
/// </summary>
[SmallBasicType]
public static class LDZip
{
private static void AddToArchive(Package zip, string fileToAdd, string root)
{
try
{
string uriFileName = fileToAdd.Replace(" ", "_").Replace('\\', '/');
FileAttributes attr = System.IO.File.GetAttributes(fileToAdd);
if ((attr & FileAttributes.Directory) == FileAttributes.Directory)
{
root = root + "/" + Path.GetFileName(uriFileName);
string[] subfolders = Directory.GetDirectories(fileToAdd);
for (int i = 0; i < subfolders.Length; i++)
{
AddToArchive(zip, subfolders[i], root);
}
string[] subfiles = Directory.GetFiles(fileToAdd);
for (int i = 0; i < subfiles.Length; i++)
{
AddToArchive(zip, subfiles[i], root);
}
}
else
{
string zipUri = string.Concat(root + "/", Path.GetFileName(uriFileName));
Uri partUri = new Uri(zipUri, UriKind.Relative);
string contentType = System.Net.Mime.MediaTypeNames.Application.Zip;
if (zip.PartExists(partUri)) zip.DeletePart(partUri);
PackagePart pkgPart = zip.CreatePart(partUri, contentType, CompressionOption.Normal);
Byte[] bytes = System.IO.File.ReadAllBytes(fileToAdd);
pkgPart.GetStream().Write(bytes, 0, bytes.Length);
}
}
catch (Exception ex)
{
TextWindow.WriteLine(fileToAdd);
Utilities.OnError(Utilities.GetCurrentMethod(), ex);
}
}
private static void RemoveFromArchive(ZipFile zip, string fileToRemove)
{
try
{
fileToRemove = fileToRemove.Replace('\\', '/');
if (zip.ContainsEntry(fileToRemove))
{
zip.RemoveEntry(fileToRemove);
}
else
{
List<string> toRemove = new List<string>();
foreach (ZipEntry e in zip)
{
if (e.FileName.StartsWith(fileToRemove + "/")) toRemove.Add(e.FileName);
}
foreach (string element in toRemove)
{
zip.RemoveEntry(element);
}
}
}
catch (Exception ex)
{
Utilities.OnError(Utilities.GetCurrentMethod(), ex);
}
}
private static void ExtractFile(string rootFolder, ZipPackagePart contentFile)
{
try
{
string contentFilePath = contentFile.Uri.OriginalString.Replace('/', Path.DirectorySeparatorChar);
if (contentFilePath.StartsWith(Path.DirectorySeparatorChar.ToString()))
{
contentFilePath = contentFilePath.TrimStart(Path.DirectorySeparatorChar);
}
contentFilePath = Path.Combine(rootFolder, contentFilePath);
if (Directory.Exists(Path.GetDirectoryName(contentFilePath)) != true)
{
Directory.CreateDirectory(Path.GetDirectoryName(contentFilePath));
}
FileStream newFileStream = System.IO.File.Create(contentFilePath);
newFileStream.Close();
byte[] content = new byte[contentFile.GetStream().Length];
contentFile.GetStream().Read(content, 0, content.Length);
System.IO.File.WriteAllBytes(contentFilePath, content);
}
catch (Exception ex)
{
Utilities.OnError(Utilities.GetCurrentMethod(), ex);
}
}
/// <summary>
/// Compress files to a zip archive.
/// </summary>
/// <param name="zipFile">The zip archive file to create.</param>
/// <param name="files">
/// An array of files to append to the zip archive.
/// A single file or directory may also be set.
/// Any directories will be recursively added to the zip.
/// Any white space in files or directories will be replaced with "_".
/// </param>
/// <returns>An error message or "".</returns>
public static Primitive Zip(Primitive zipFile, Primitive files)
{
try
{
using (Package zip = ZipPackage.Open(zipFile, FileMode.OpenOrCreate, FileAccess.ReadWrite))
{
if (SBArray.IsArray(files))
{
Primitive indices = SBArray.GetAllIndices(files);
int count = SBArray.GetItemCount(indices);
for (int i = 1; i <= count; i++)
{
AddToArchive(zip, files[indices[i]], "");
}
}
else
{
AddToArchive(zip, files, "");
}
zip.Close();
}
return "";
}
catch (Exception ex)
{
Utilities.OnError(Utilities.GetCurrentMethod(), ex);
return Utilities.GetCurrentMethod() + " " + ex.Message;
}
}
/// <summary>
/// Remove a file (or directory with all sub files) from an existing zip archive.
/// </summary>
/// <param name="zipFile">The zip archive to remove a file from.</param>
/// <param name="files">
/// An array of files to remove from the zip archive.
/// A single file or directory may also be deleted.
/// Any directories will be recursively removed from the zip.
/// </param>
/// <returns>An error message or "".</returns>
public static Primitive Remove(Primitive zipFile, Primitive files)
{
try
{
using (ZipFile zip = ZipFile.Read(zipFile))
{
if (SBArray.IsArray(files))
{
Primitive indices = SBArray.GetAllIndices(files);
int count = SBArray.GetItemCount(indices);
for (int i = 1; i <= count; i++)
{
RemoveFromArchive(zip, files[indices[i]]);
}
}
else
{
RemoveFromArchive(zip, files);
}
zip.Save();
}
return "";
}
catch (Exception ex)
{
Utilities.OnError(Utilities.GetCurrentMethod(), ex);
return Utilities.GetCurrentMethod() + " " + ex.Message;
}
}
/// <summary>
/// Uncompress a zip archive.
/// </summary>
/// <param name="zipFile">The zip archive to uncompress.</param>
/// <param name="directory">A directory to uncompress the files to (existing files will be overwritten).</param>
/// <returns>An error message or "".</returns>
public static Primitive UnZip(Primitive zipFile, Primitive directory)
{
try
{
using (ZipFile zip = ZipFile.Read(zipFile))
{
zip.ExtractAll(directory, ExtractExistingFileAction.OverwriteSilently);
}
return "";
}
catch (Exception ex)
{
Utilities.OnError(Utilities.GetCurrentMethod(), ex);
return Utilities.GetCurrentMethod() + " " + ex.Message;
}
}
/// <summary>
/// List the files in a zip archive.
/// </summary>
/// <param name="zipFile">The zip archive.</param>
/// <returns>An array of file names in the zip or an error message.</returns>
public static Primitive ZipList(Primitive zipFile)
{
try
{
string result = "";
using (ZipFile zip = ZipFile.Read(zipFile))
{
int i = 1;
foreach (ZipEntry entry in zip)
{
result += (i++).ToString() + "=" + Utilities.ArrayParse(entry.FileName) + ";";
}
}
return Utilities.CreateArrayMap(result);
}
catch (Exception ex)
{
Utilities.OnError(Utilities.GetCurrentMethod(), ex);
return Utilities.GetCurrentMethod() + " " + ex.Message;
}
}
}
}
| litdev1/LitDev | LitDev/LitDev/Zip.cs | C# | gpl-3.0 | 10,245 | [
30522,
1013,
1013,
1996,
2206,
9385,
12033,
2000,
1996,
5507,
24844,
5331,
2005,
2235,
3937,
1998,
6764,
1999,
1996,
3415,
15327,
5507,
24844,
1012,
1013,
1013,
9385,
1006,
1039,
1007,
1026,
2249,
1011,
12609,
1028,
5507,
24844,
1030,
2980,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* PSP - Phoenix Serial Protocol
Inspired by uBlox serial protocol and multiwii serial protocol
Data structure is subject to change without further notice.
Protocol data structure:
[SYNC1][SYNC2][CODE][LENGTH_L][LENGTH_H][DATA/DATA ARRAY][CRC]
*/
extern "C" {
#include "board.h"
}
#include "dataStorage.h"
#include "serialCommunication.h"
#include "sensors.h"
#include "sensor_mpu6050.h"
#include "kinematics.h"
#include "receiver.h"
#include "frame_type.h"
#include "pilotCommandProcessor.h"
#include "esc.h"
Configurator::Configurator() {
state = 0;
payload_length_expected = 0;
payload_length_received = 0;
}
void Configurator::read_packet() {
while (uartAvailable()) {
data = uartRead();
switch (state) {
case 0:
if (data == PSP_SYNC1) {
state++;
}
break;
case 1:
if (data == PSP_SYNC2) {
state++;
} else {
state = 0; // Restart and try again
}
break;
case 2:
code = data;
message_crc = data;
state++;
break;
case 3: // LSB
payload_length_expected = data;
message_crc ^= data;
state++;
break;
case 4: // MSB
payload_length_expected |= data << 8;
message_crc ^= data;
state++;
break;
case 5:
data_buffer[payload_length_received] = data;
message_crc ^= data;
payload_length_received++;
if (payload_length_received >= payload_length_expected) {
state++;
}
break;
case 6:
if (message_crc == data) {
// CRC is ok, process data
process_data();
} else {
// respond that CRC failed
CRC_FAILED(code, message_crc);
}
// reset variables
memset(data_buffer, 0, sizeof(data_buffer));
payload_length_received = 0;
state = 0;
break;
}
}
}
void Configurator::process_data() {
switch (code) {
case PSP_REQ_CONFIGURATION:
send_UNION();
break;
case PSP_REQ_GYRO_ACC: {
protocol_head(PSP_REQ_GYRO_ACC, 24);
// gyro
for (uint8_t axis = 0; axis <= ZAXIS; axis++) {
serialize_float32(gyro[axis]);
}
// accel
float norm = sqrt(accel[XAXIS] * accel[XAXIS] + accel[YAXIS] * accel[YAXIS] + accel[ZAXIS] * accel[ZAXIS]);
for (uint8_t axis = 0; axis <= ZAXIS; axis++) {
serialize_float32((float)(accel[axis] / norm));
}
}
break;
case PSP_REQ_RC:
protocol_head(PSP_REQ_RC, RX_CHANNELS * 2);
for (uint8_t channel = 0; channel < RX_CHANNELS; channel++) {
serialize_uint16(RX[channel]);
}
break;
case PSP_REQ_KINEMATICS:
protocol_head(PSP_REQ_KINEMATICS, 12);
for (uint8_t axis = 0; axis <= ZAXIS; axis++) {
serialize_float32(kinematicsAngle[axis]);
}
break;
case PSP_REQ_MOTORS_OUTPUT:
protocol_head(PSP_REQ_MOTORS_OUTPUT, MOTORS * 2);
for (uint8_t motor = 0; motor < MOTORS; motor++) {
serialize_uint16(MotorOut[motor]);
}
break;
case PSP_REQ_MOTORS_COUNT:
protocol_head(PSP_REQ_MOTORS_COUNT, 1);
serialize_uint8(MOTORS);
break;
case PSP_REQ_SENSORS_ALIVE:
protocol_head(PSP_REQ_SENSORS_ALIVE, 2);
serialize_uint16(sensors.sensors_detected);
break;
case PSP_REQ_AUX_TRIGGERED:
protocol_head(PSP_REQ_AUX_TRIGGERED, 8);
serialize_uint64(AUX_chan_mask);
break;
// SET
case PSP_SET_CONFIGURATION:
if (payload_length_received == sizeof(CONFIG)) {
// process data from buffer (throw it inside union)
for (uint16_t i = 0; i < sizeof(CONFIG); i++) {
CONFIG.raw[i] = data_buffer[i];
}
// Write config to EEPROM
writeEEPROM();
ACK();
} else {
// Refuse (buffer size doesn't match struct memory size)
REFUSED();
}
break;
case PSP_SET_EEPROM_REINIT:
ACK();
initializeEEPROM(); // initializes default values
writeEEPROM(); // writes default values to eeprom
// Send back configuration union
send_UNION();
break;
case PSP_SET_ACCEL_CALIBRATION:
sensors.calibrateAccel();
// Write config to EEPROM
writeEEPROM();
// Send over the accel calibration data
protocol_head(PSP_SET_ACCEL_CALIBRATION, 6);
for (uint8_t axis = 0; axis <= ZAXIS; axis++) {
serialize_uint16(CONFIG.data.ACCEL_BIAS[axis]);
}
break;
case PSP_SET_MOTOR_TEST_VALUE:
// data_buffer should contain 2 bytes (byte 0 = motor number, byte 1 = value)
if (data_buffer[0] < MOTORS) { // Check if motor number is within our setup
MotorOut[data_buffer[0]] = 1000 + (data_buffer[1] * 10);
updateMotors(); // Update ESCs
} else { // Motor number is not in our setup
REFUSED();
}
break;
case PSP_SET_REBOOT:
// In the future we might also utilize the true flag an allow a standard reboot.
systemReset(true); // reboot to bootloader
break;
default: // Unrecognized code
REFUSED();
}
// send over crc
protocol_tail();
}
void Configurator::protocol_head(uint8_t code, uint16_t length) {
uartWrite(PSP_SYNC1);
uartWrite(PSP_SYNC2);
crc = 0; // reset crc
serialize_uint8(code);
serialize_uint16(length);
}
void Configurator::protocol_tail() {
uartWrite(crc);
}
void Configurator::serialize_uint8(uint8_t data) {
uartWrite(data);
crc ^= data;
}
void Configurator::serialize_uint16(uint16_t data) {
serialize_uint8(lowByte(data));
serialize_uint8(highByte(data));
}
void Configurator::serialize_uint32(uint32_t data) {
for (uint8_t i = 0; i < 4; i++) {
serialize_uint8((uint8_t) (data >> (i * 8)));
}
}
void Configurator::serialize_uint64(uint64_t data) {
for (uint8_t i = 0; i < 8; i++) {
serialize_uint8((uint8_t) (data >> (i * 8)));
}
}
void Configurator::serialize_float32(float f) {
uint8_t *b = (uint8_t*) & f;
for (uint8_t i = 0; i < sizeof(f); i++) {
serialize_uint8(b[i]);
}
}
void Configurator::ACK() {
protocol_head(PSP_INF_ACK, 1);
serialize_uint8(0x01);
}
void Configurator::REFUSED() {
protocol_head(PSP_INF_REFUSED, 1);
serialize_uint8(0x00);
}
void Configurator::CRC_FAILED(uint8_t code, uint8_t failed_crc) {
protocol_head(PSP_INF_CRC_FAIL, 2);
serialize_uint8(code);
serialize_uint8(failed_crc);
}
void Configurator::send_UNION() {
protocol_head(PSP_REQ_CONFIGURATION, sizeof(CONFIG));
for (uint16_t i = 0; i < sizeof(CONFIG); i++) {
serialize_uint8(CONFIG.raw[i]);
}
}
Configurator configurator;
void readSerial() {
configurator.read_packet();
} | cTn-dev/Phoenix-STM32 | src/SerialCommunication.cpp | C++ | gpl-3.0 | 8,201 | [
30522,
1013,
1008,
8827,
2361,
1011,
6708,
7642,
8778,
4427,
2011,
1057,
16558,
11636,
7642,
8778,
1998,
4800,
9148,
2072,
7642,
8778,
2951,
3252,
2003,
3395,
2000,
2689,
2302,
2582,
5060,
1012,
8778,
2951,
3252,
1024,
1031,
26351,
2487,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
'use strict';
describe('Service: awesomeThings', function() {
// load the service's module
beforeEach(module('initApp'));
// instantiate service
var awesomeThings;
beforeEach(inject(function(_awesomeThings_) {
awesomeThings = _awesomeThings_;
}));
it('should return all the awesomeThings at the static list', function() {
expect(awesomeThings.getAll().length).toBe(4);
});
it('should return an specific awesome thing', function() {
// We can test the object itself here. Not doing for simplicity
expect(awesomeThings.get('2').name).toBe('AngularJS');
});
});
| ivosantiago/angular-sample | test/spec/services/awesomethings.js | JavaScript | mit | 602 | [
30522,
1005,
2224,
9384,
1005,
1025,
6235,
1006,
1005,
2326,
1024,
12476,
20744,
2015,
1005,
1010,
3853,
1006,
1007,
1063,
1013,
1013,
7170,
1996,
2326,
1005,
1055,
11336,
2077,
5243,
2818,
1006,
11336,
1006,
1005,
1999,
6590,
9397,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Atomic operations for the Hexagon architecture
*
* Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
*/
#ifndef _ASM_ATOMIC_H
#define _ASM_ATOMIC_H
#include <linux/types.h>
#include <asm/cmpxchg.h>
#include <asm/barrier.h>
#define ATOMIC_INIT(i) { (i) }
/* Normal writes in our arch don't clear lock reservations */
static inline void atomic_set(atomic_t *v, int new)
{
asm volatile(
"1: r6 = memw_locked(%0);\n"
" memw_locked(%0,p0) = %1;\n"
" if (!P0) jump 1b;\n"
:
: "r" (&v->counter), "r" (new)
: "memory", "p0", "r6"
);
}
#define atomic_set_release(v, i) atomic_set((v), (i))
/**
* atomic_read - reads a word, atomically
* @v: pointer to atomic value
*
* Assumes all word reads on our architecture are atomic.
*/
#define atomic_read(v) READ_ONCE((v)->counter)
/**
* atomic_xchg - atomic
* @v: pointer to memory to change
* @new: new value (technically passed in a register -- see xchg)
*/
#define atomic_xchg(v, new) (xchg(&((v)->counter), (new)))
/**
* atomic_cmpxchg - atomic compare-and-exchange values
* @v: pointer to value to change
* @old: desired old value to match
* @new: new value to put in
*
* Parameters are then pointer, value-in-register, value-in-register,
* and the output is the old value.
*
* Apparently this is complicated for archs that don't support
* the memw_locked like we do (or it's broken or whatever).
*
* Kind of the lynchpin of the rest of the generically defined routines.
* Remember V2 had that bug with dotnew predicate set by memw_locked.
*
* "old" is "expected" old val, __oldval is actual old value
*/
static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
{
int __oldval;
asm volatile(
"1: %0 = memw_locked(%1);\n"
" { P0 = cmp.eq(%0,%2);\n"
" if (!P0.new) jump:nt 2f; }\n"
" memw_locked(%1,P0) = %3;\n"
" if (!P0) jump 1b;\n"
"2:\n"
: "=&r" (__oldval)
: "r" (&v->counter), "r" (old), "r" (new)
: "memory", "p0"
);
return __oldval;
}
#define ATOMIC_OP(op) \
static inline void atomic_##op(int i, atomic_t *v) \
{ \
int output; \
\
__asm__ __volatile__ ( \
"1: %0 = memw_locked(%1);\n" \
" %0 = "#op "(%0,%2);\n" \
" memw_locked(%1,P3)=%0;\n" \
" if !P3 jump 1b;\n" \
: "=&r" (output) \
: "r" (&v->counter), "r" (i) \
: "memory", "p3" \
); \
} \
#define ATOMIC_OP_RETURN(op) \
static inline int atomic_##op##_return(int i, atomic_t *v) \
{ \
int output; \
\
__asm__ __volatile__ ( \
"1: %0 = memw_locked(%1);\n" \
" %0 = "#op "(%0,%2);\n" \
" memw_locked(%1,P3)=%0;\n" \
" if !P3 jump 1b;\n" \
: "=&r" (output) \
: "r" (&v->counter), "r" (i) \
: "memory", "p3" \
); \
return output; \
}
#define ATOMIC_FETCH_OP(op) \
static inline int atomic_fetch_##op(int i, atomic_t *v) \
{ \
int output, val; \
\
__asm__ __volatile__ ( \
"1: %0 = memw_locked(%2);\n" \
" %1 = "#op "(%0,%3);\n" \
" memw_locked(%2,P3)=%1;\n" \
" if !P3 jump 1b;\n" \
: "=&r" (output), "=&r" (val) \
: "r" (&v->counter), "r" (i) \
: "memory", "p3" \
); \
return output; \
}
#define ATOMIC_OPS(op) ATOMIC_OP(op) ATOMIC_OP_RETURN(op) ATOMIC_FETCH_OP(op)
ATOMIC_OPS(add)
ATOMIC_OPS(sub)
#undef ATOMIC_OPS
#define ATOMIC_OPS(op) ATOMIC_OP(op) ATOMIC_FETCH_OP(op)
ATOMIC_OPS(and)
ATOMIC_OPS(or)
ATOMIC_OPS(xor)
#undef ATOMIC_OPS
#undef ATOMIC_FETCH_OP
#undef ATOMIC_OP_RETURN
#undef ATOMIC_OP
/**
* atomic_fetch_add_unless - add unless the number is a given value
* @v: pointer to value
* @a: amount to add
* @u: unless value is equal to u
*
* Returns old value.
*
*/
static inline int atomic_fetch_add_unless(atomic_t *v, int a, int u)
{
int __oldval;
register int tmp;
asm volatile(
"1: %0 = memw_locked(%2);"
" {"
" p3 = cmp.eq(%0, %4);"
" if (p3.new) jump:nt 2f;"
" %1 = add(%0, %3);"
" }"
" memw_locked(%2, p3) = %1;"
" {"
" if !p3 jump 1b;"
" }"
"2:"
: "=&r" (__oldval), "=&r" (tmp)
: "r" (v), "r" (a), "r" (u)
: "memory", "p3"
);
return __oldval;
}
#define atomic_fetch_add_unless atomic_fetch_add_unless
#endif
| BPI-SINOVOIP/BPI-Mainline-kernel | linux-5.4/arch/hexagon/include/asm/atomic.h | C | gpl-2.0 | 4,302 | [
30522,
1013,
1008,
23772,
2595,
1011,
6105,
1011,
8909,
4765,
18095,
1024,
14246,
2140,
1011,
1016,
1012,
1014,
1011,
2069,
1008,
1013,
1013,
1008,
1008,
9593,
3136,
2005,
1996,
2002,
18684,
7446,
4294,
1008,
1008,
9385,
1006,
1039,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
electric-run13
==============
The hacked-together spritekit app that I wore at Electric Run in Sydney, 2013, in the pouring rain...
| bionicmonocle/electric-run13 | README.md | Markdown | gpl-2.0 | 133 | [
30522,
3751,
1011,
2448,
17134,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1996,
28719,
1011,
2362,
11867,
17625,
23615,
10439,
2008,
1045,
5078,
2012,
3751,
2448,
1999,
3994,
1010,
2286,
1010,
1999,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# solve cliff-walking task with Q-Learning, very similar to SARSA
# original example problem from the book, introduction for reinforcement learning
# Author: Wenbin Li
# numeric backend
import pygame
from pygame.locals import *
import numpy as np
grid_size = 100
n_row = 4
n_col = 12
state = np.zeros((n_row * grid_size, n_col * grid_size))
step_size = 0.5
epsilon = 0.1 # parameter for epislon-greedy
N_actions = 4 # number of actions {left,up,right,down}
N_episodes = 600 # number of episodes
# as suggested by the book, reach optimality by 8000 time steps
# rewards of -1 until the goal state is reached
# -100 for entering cliff region and instantly return to starting position
# specify goal location
goal_r = 3
goal_c = 11
# specify start location
start_r = 3
start_c = 0
# initialize state-action value function
q = np.zeros((n_row,n_col,N_actions)) # num_row by num_col by num_states
# Note: Q(terminal-state,.) = 0
# undiscounted and episodic task
n_steps = 0
n_episodes = 0
# epsilon-greedy strategy
def ep_greedy(epsilon,num_actions,q,i,j):
roll = np.random.uniform(0,1)
# epsilon-greedy strategy
if roll < epsilon: # exploration
a = np.random.randint(0,num_actions)
else: # exploitation
a = np.argmax(q[i,j,:])
return a
# translate action into state-change
def action2state(i,j,a):
# Note: coordintate system start from the upper-left corner and
# right/downwards are the positive direction
if a == 0: # to left
i_next = i
j_next = j - 1
elif a == 1: # upwards
i_next = i - 1
j_next = j
elif a == 2: # to right
i_next = i
j_next = j + 1
else: # downwards
i_next = i + 1
j_next = j
return i_next,j_next
# Sarsa method
while n_episodes < N_episodes:
# begin of an episode
i = start_r
j = start_c
# end of an episode
n_episodes += 1
print "episode ",str(n_episodes),"..."
while True:
n_steps += 1
# print " step ",str(n_steps),"..."
# choose A from S using policy derived from Q (epsilon-greedy)
a = ep_greedy(epsilon,N_actions,q,i,j)
# translate action into state-change with windy effect
i_next,j_next = action2state(i,j,a)
# update the state-action value function with Sarsa/Q-Learning of choice
# state transitions end in the goal state
# state should be in the range of the gridworld
if i_next == goal_r and j_next == goal_c: # reach the goal position
# q[i,j] = q[i,j] + step_size * (-1 + 0 - q[i,j]) #the Q(terminal,.) = 0
q[i,j,a] = q[i,j,a] + step_size * (-1 + 0 - q[i,j,a]) #the Q(terminal,.) = 0
# Note, transition from noterminal to terminal also gets reward of -1 in this case
break
# different reward/consequence when entering the cliff region
elif i_next == 3 and j_next > 1 and j_next < n_col - 1:
i_next = start_r
j_next = start_c
r = -100
elif i_next < 0 or i_next > n_row -1:
i_next = i
r = -1
elif j_next < 0 or j_next > n_col - 1:
j_next = j
r = -1
else:
r = -1
# a_next = ep_greedy(epsilon,N_actions,q,i_next,j_next)
q[i,j,a] = q[i,j,a] + step_size * (r + max(q[i_next,j_next,:]) - q[i,j,a])
i = i_next
j = j_next
# visualize the solution/GUI-backend
# plot the gridworld as background
# (optional) mark wind direction
pygame.init()
pygame.display.set_mode((n_col * grid_size,n_row * grid_size))
pygame.display.set_caption('Cliff Walking')
screen = pygame.display.get_surface()
surface = pygame.Surface(screen.get_size())
bg = pygame.Surface(screen.get_size())
# draw background, with mark on start/end states & cliff region
def draw_bg(surface,n_row,n_col,grid_size,start_r,start_c,goal_r,goal_c):
for i in range(n_col):
for j in range(n_row):
x = i * grid_size
y = j * grid_size
coords = pygame.Rect(x,y,grid_size,grid_size)
pygame.draw.rect(surface,(255,255,255),coords,1)
# draw start state
pygame.draw.circle(surface,(192,192,192),(start_c * grid_size + grid_size/2,
start_r * grid_size + grid_size/2),grid_size/4)
# draw goal state
pygame.draw.circle(surface,(102,204,0),(goal_c * grid_size + grid_size/2,
goal_r * grid_size + grid_size/2),grid_size/4)
# draw cliff region
x = 1 * grid_size
y = 3 * grid_size
coords = pygame.Rect(x,y,grid_size*10,grid_size)
pygame.draw.rect(surface,(192,192,192),coords)
# use state-action function to find one-step optimal policy
def step_q(q,s_r,s_c,n_row,n_col):
print "state-action value:"
print q[s_r,s_c,:]
a = np.argmax(q[s_r,s_c,:]) # greedy only
# display debug
if a == 0:
print "move left"
elif a == 1:
print "move upward"
elif a == 2:
print "move right"
else:
print "move downwards"
s_r_next,s_c_next = action2state(s_r,s_c,a)
# define rules especially when the agent enter the cliff region
if s_r_next == 3 and s_c_next > 1 and s_c_next < n_col - 1:
s_r_next = start_r
s_c_next = start_c
# in theory, the produced optimal policy should not enter this branch
elif s_r_next < 0 or s_r_next > n_row -1:
s_r_next = s_r
elif s_c_next < 0 or s_c_next > n_col - 1:
s_c_next = s_c
return s_r_next,s_c_next
s_r = start_r
s_c = start_c
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
# draw gridworld background
draw_bg(bg,n_row,n_col,grid_size,start_r,start_c,goal_r,goal_c)
screen.blit(bg,(0,0))
# draw the state of the agent, i.e. the path (start --> end) as the foreground
surface.fill((0,0,0))
# use state-action function to find a optimal policy
# in the loop, should provide a step function
#print (s_r,s_c)
s_r_next,s_c_next = step_q(q,s_r,s_c,n_row,n_col)
#print (s_r_next,s_c_next)
if s_r_next != goal_r or s_c_next != goal_c:
pygame.draw.circle(surface,(255,255,255),(s_c_next * grid_size + grid_size/2,
s_r_next * grid_size + grid_size/2),grid_size/4)
bg.blit(surface,(0,0))
pygame.display.flip() # update
pygame.time.delay(1000)
s_r,s_c = s_r_next,s_c_next # update coordinate
| wenbinli/rl | cliffWalk_QL.py | Python | mit | 6,866 | [
30522,
1001,
9611,
7656,
1011,
3788,
4708,
2007,
1053,
1011,
4083,
1010,
2200,
2714,
2000,
18906,
3736,
1001,
2434,
2742,
3291,
2013,
1996,
2338,
1010,
4955,
2005,
23895,
4083,
1001,
3166,
1024,
19181,
8428,
5622,
1001,
16371,
25531,
2067,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="description" content="Javadoc API documentation for Fresco." />
<link rel="shortcut icon" type="image/x-icon" href="../../../../favicon.ico" />
<title>
com.facebook.imagepipeline.nativecode Details - Fresco API
| Fresco
</title>
<link href="../../../../../assets/doclava-developer-docs.css" rel="stylesheet" type="text/css" />
<link href="../../../../../assets/customizations.css" rel="stylesheet" type="text/css" />
<script src="../../../../../assets/search_autocomplete.js" type="text/javascript"></script>
<script src="../../../../../assets/jquery-resizable.min.js" type="text/javascript"></script>
<script src="../../../../../assets/doclava-developer-docs.js" type="text/javascript"></script>
<script src="../../../../../assets/prettify.js" type="text/javascript"></script>
<script type="text/javascript">
setToRoot("../../../../", "../../../../../assets/");
</script>
<script src="../../../../../assets/doclava-developer-reference.js" type="text/javascript"></script>
<script src="../../../../../assets/navtree_data.js" type="text/javascript"></script>
<script src="../../../../../assets/customizations.js" type="text/javascript"></script>
<noscript>
<style type="text/css">
html,body{overflow:auto;}
#body-content{position:relative; top:0;}
#doc-content{overflow:visible;border-left:3px solid #666;}
#side-nav{padding:0;}
#side-nav .toggle-list ul {display:block;}
#resize-packages-nav{border-bottom:3px solid #666;}
</style>
</noscript>
</head>
<body class="">
<div id="header">
<div id="headerLeft">
<span id="masthead-title"><a href="../../../../packages.html">Fresco</a></span>
</div>
<div id="headerRight">
<div id="search" >
<div id="searchForm">
<form accept-charset="utf-8" class="gsc-search-box"
onsubmit="return submit_search()">
<table class="gsc-search-box" cellpadding="0" cellspacing="0"><tbody>
<tr>
<td class="gsc-input">
<input id="search_autocomplete" class="gsc-input" type="text" size="33" autocomplete="off"
title="search developer docs" name="q"
value="search developer docs"
onFocus="search_focus_changed(this, true)"
onBlur="search_focus_changed(this, false)"
onkeydown="return search_changed(event, true, '../../../../')"
onkeyup="return search_changed(event, false, '../../../../')" />
<div id="search_filtered_div" class="no-display">
<table id="search_filtered" cellspacing=0>
</table>
</div>
</td>
<!-- <td class="gsc-search-button">
<input type="submit" value="Search" title="search" id="search-button" class="gsc-search-button" />
</td>
<td class="gsc-clear-button">
<div title="clear results" class="gsc-clear-button"> </div>
</td> -->
</tr></tbody>
</table>
</form>
</div><!-- searchForm -->
</div><!-- search -->
</div>
</div><!-- header -->
<div class="g-section g-tpl-240" id="body-content">
<div class="g-unit g-first side-nav-resizable" id="side-nav">
<div id="swapper">
<div id="nav-panels">
<div id="resize-packages-nav">
<div id="packages-nav">
<div id="index-links">
<a href="../../../../packages.html" >Packages</a> |
<a href="../../../../classes.html" >Classes</a>
</div>
<ul>
<li class="api apilevel-">
<a href="../../../../com/facebook/animated/gif/package-summary.html">com.facebook.animated.gif</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/animated/webp/package-summary.html">com.facebook.animated.webp</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/binaryresource/package-summary.html">com.facebook.binaryresource</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/cache/common/package-summary.html">com.facebook.cache.common</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/cache/disk/package-summary.html">com.facebook.cache.disk</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/common/activitylistener/package-summary.html">com.facebook.common.activitylistener</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/common/disk/package-summary.html">com.facebook.common.disk</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/common/executors/package-summary.html">com.facebook.common.executors</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/common/file/package-summary.html">com.facebook.common.file</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/common/internal/package-summary.html">com.facebook.common.internal</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/common/lifecycle/package-summary.html">com.facebook.common.lifecycle</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/common/logging/package-summary.html">com.facebook.common.logging</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/common/media/package-summary.html">com.facebook.common.media</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/common/memory/package-summary.html">com.facebook.common.memory</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/common/references/package-summary.html">com.facebook.common.references</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/common/soloader/package-summary.html">com.facebook.common.soloader</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/common/statfs/package-summary.html">com.facebook.common.statfs</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/common/streams/package-summary.html">com.facebook.common.streams</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/common/time/package-summary.html">com.facebook.common.time</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/common/util/package-summary.html">com.facebook.common.util</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/common/webp/package-summary.html">com.facebook.common.webp</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/datasource/package-summary.html">com.facebook.datasource</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/drawable/base/package-summary.html">com.facebook.drawable.base</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/drawee/backends/pipeline/package-summary.html">com.facebook.drawee.backends.pipeline</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/drawee/backends/volley/package-summary.html">com.facebook.drawee.backends.volley</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/drawee/components/package-summary.html">com.facebook.drawee.components</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/drawee/controller/package-summary.html">com.facebook.drawee.controller</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/drawee/debug/package-summary.html">com.facebook.drawee.debug</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/drawee/drawable/package-summary.html">com.facebook.drawee.drawable</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/drawee/generic/package-summary.html">com.facebook.drawee.generic</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/drawee/gestures/package-summary.html">com.facebook.drawee.gestures</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/drawee/interfaces/package-summary.html">com.facebook.drawee.interfaces</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/drawee/span/package-summary.html">com.facebook.drawee.span</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/drawee/view/package-summary.html">com.facebook.drawee.view</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/fresco/animation/backend/package-summary.html">com.facebook.fresco.animation.backend</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/fresco/animation/bitmap/package-summary.html">com.facebook.fresco.animation.bitmap</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/fresco/animation/bitmap/cache/package-summary.html">com.facebook.fresco.animation.bitmap.cache</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/fresco/animation/bitmap/preparation/package-summary.html">com.facebook.fresco.animation.bitmap.preparation</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/fresco/animation/bitmap/wrapper/package-summary.html">com.facebook.fresco.animation.bitmap.wrapper</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/fresco/animation/drawable/package-summary.html">com.facebook.fresco.animation.drawable</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/fresco/animation/drawable/animator/package-summary.html">com.facebook.fresco.animation.drawable.animator</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/fresco/animation/factory/package-summary.html">com.facebook.fresco.animation.factory</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/fresco/animation/frame/package-summary.html">com.facebook.fresco.animation.frame</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/imageformat/package-summary.html">com.facebook.imageformat</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/imagepipeline/animated/base/package-summary.html">com.facebook.imagepipeline.animated.base</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/imagepipeline/animated/factory/package-summary.html">com.facebook.imagepipeline.animated.factory</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/imagepipeline/animated/impl/package-summary.html">com.facebook.imagepipeline.animated.impl</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/imagepipeline/animated/util/package-summary.html">com.facebook.imagepipeline.animated.util</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/imagepipeline/backends/okhttp3/package-summary.html">com.facebook.imagepipeline.backends.okhttp3</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/imagepipeline/backends/volley/package-summary.html">com.facebook.imagepipeline.backends.volley</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/imagepipeline/bitmaps/package-summary.html">com.facebook.imagepipeline.bitmaps</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/imagepipeline/cache/package-summary.html">com.facebook.imagepipeline.cache</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/imagepipeline/common/package-summary.html">com.facebook.imagepipeline.common</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/imagepipeline/core/package-summary.html">com.facebook.imagepipeline.core</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/imagepipeline/datasource/package-summary.html">com.facebook.imagepipeline.datasource</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/imagepipeline/decoder/package-summary.html">com.facebook.imagepipeline.decoder</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/imagepipeline/drawable/package-summary.html">com.facebook.imagepipeline.drawable</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/imagepipeline/image/package-summary.html">com.facebook.imagepipeline.image</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/imagepipeline/listener/package-summary.html">com.facebook.imagepipeline.listener</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/imagepipeline/memory/package-summary.html">com.facebook.imagepipeline.memory</a></li>
<li class="selected api apilevel-">
<a href="../../../../com/facebook/imagepipeline/nativecode/package-summary.html">com.facebook.imagepipeline.nativecode</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/imagepipeline/platform/package-summary.html">com.facebook.imagepipeline.platform</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/imagepipeline/postprocessors/package-summary.html">com.facebook.imagepipeline.postprocessors</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/imagepipeline/producers/package-summary.html">com.facebook.imagepipeline.producers</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/imagepipeline/request/package-summary.html">com.facebook.imagepipeline.request</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/imageutils/package-summary.html">com.facebook.imageutils</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/webpsupport/package-summary.html">com.facebook.webpsupport</a></li>
<li class="api apilevel-">
<a href="../../../../com/facebook/widget/text/span/package-summary.html">com.facebook.widget.text.span</a></li>
</ul><br/>
</div> <!-- end packages -->
</div> <!-- end resize-packages -->
<div id="classes-nav">
<ul>
<li><h2>Interfaces</h2>
<ul>
<li class="api apilevel-"><a href="../../../../com/facebook/imagepipeline/nativecode/WebpTranscoder.html">WebpTranscoder</a></li>
</ul>
</li>
<li><h2>Classes</h2>
<ul>
<li class="api apilevel-"><a href="../../../../com/facebook/imagepipeline/nativecode/Bitmaps.html">Bitmaps</a></li>
<li class="api apilevel-"><a href="../../../../com/facebook/imagepipeline/nativecode/ImagePipelineNativeLoader.html">ImagePipelineNativeLoader</a></li>
<li class="api apilevel-"><a href="../../../../com/facebook/imagepipeline/nativecode/JpegTranscoder.html">JpegTranscoder</a></li>
<li class="api apilevel-"><a href="../../../../com/facebook/imagepipeline/nativecode/NativeBlurFilter.html">NativeBlurFilter</a></li>
<li class="api apilevel-"><a href="../../../../com/facebook/imagepipeline/nativecode/NativeRoundingFilter.html">NativeRoundingFilter</a></li>
<li class="api apilevel-"><a href="../../../../com/facebook/imagepipeline/nativecode/StaticWebpNativeLoader.html">StaticWebpNativeLoader</a></li>
<li class="api apilevel-"><a href="../../../../com/facebook/imagepipeline/nativecode/WebpTranscoderFactory.html">WebpTranscoderFactory</a></li>
<li class="api apilevel-"><a href="../../../../com/facebook/imagepipeline/nativecode/WebpTranscoderImpl.html">WebpTranscoderImpl</a></li>
</ul>
</li>
</ul><br/>
</div><!-- end classes -->
</div><!-- end nav-panels -->
<div id="nav-tree" style="display:none">
<div id="index-links">
<a href="../../../../packages.html" >Packages</a> |
<a href="../../../../classes.html" >Classes</a>
</div>
</div><!-- end nav-tree -->
</div><!-- end swapper -->
</div> <!-- end side-nav -->
<script>
if (!isMobile) {
//$("<a href='#' id='nav-swap' onclick='swapNav();return false;' style='font-size:10px;line-height:9px;margin-left:1em;text-decoration:none;'><span id='tree-link'>Use Tree Navigation</span><span id='panel-link' style='display:none'>Use Panel Navigation</span></a>").appendTo("#side-nav");
chooseDefaultNav();
if ($("#nav-tree").is(':visible')) {
init_default_navtree("../../../../");
} else {
addLoadEvent(function() {
scrollIntoView("packages-nav");
scrollIntoView("classes-nav");
});
}
//$("#swapper").css({borderBottom:"2px solid #aaa"});
} else {
swapNav(); // tree view should be used on mobile
}
</script>
<div class="g-unit" id="doc-content">
<div id="api-info-block">
<div class="api-level">
</div>
</div>
<div id="jd-header">
package
<h1>com.facebook.imagepipeline.nativecode</b></h1>
<div class="jd-nav">
<a class="jd-navlink" href="package-summary.html">Classes</a> | Description
</div>
</div><!-- end header -->
<div id="naMessage"></div>
<div id="jd-content" class="api apilevel-">
<div class="jd-descr">
<p></p>
</div>
<div id="footer">
+Generated by <a href="http://code.google.com/p/doclava/">Doclava</a>.
+</div> <!-- end footer - @generated -->
</div><!-- end jd-content -->
</div> <!-- end doc-content -->
</div> <!-- end body-content -->
<script type="text/javascript">
init(); /* initialize doclava-developer-docs.js */
</script>
</body>
</html>
| MaTriXy/fresco | docs/javadoc/reference/com/facebook/imagepipeline/nativecode/package-descr.html | HTML | bsd-3-clause | 17,812 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
18804,
8299,
1011,
1041,
15549,
2615,
1027,
1000,
4180,
1011,
2828,
1000,
4180,
1027,
1000,
3793,
1013,
16129,
1025,
25869,
13462,
1027,
21183,
2546,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>イノベーション エンジニアブログ</title>
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="description" content="株式会社イノベーションのエンジニアたちの技術系ブログです。ITトレンド・List Finderの開発をベースに、業務外での技術研究などもブログとして発信していってます!">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="イノベーション エンジニアブログ">
<meta name="twitter:description" content="株式会社イノベーションのエンジニアたちの技術系ブログです。ITトレンド・List Finderの開発をベースに、業務外での技術研究などもブログとして発信していってます!">
<meta property="og:type" content="article">
<meta property="og:title" content="イノベーション エンジニアブログ">
<meta property="og:description" content="株式会社イノベーションのエンジニアたちの技術系ブログです。ITトレンド・List Finderの開発をベースに、業務外での技術研究などもブログとして発信していってます!">
<link href="/favicon.ico" rel="shortcut icon" type="image/x-icon">
<link href="/apple-touch-icon-precomposed.png" rel="apple-touch-icon">
<script type="text/javascript">
var _trackingid = 'LFT-10003-1';
(function() {
var lft = document.createElement('script'); lft.type = 'text/javascript'; lft.async = true;
lft.src = document.location.protocol + '//test.list-finder.jp/js/ja/track_test.js';
var snode = document.getElementsByTagName('script')[0]; snode.parentNode.insertBefore(lft, snode);
})();
</script>
<script type="text/javascript">
var _trackingid = 'LFT-10003-1';
(function() {
var lft = document.createElement('script'); lft.type = 'text/javascript'; lft.async = true;
lft.src = document.location.protocol + '//track.list-finder.jp/js/ja/track_prod_wao.js';
var snode = document.getElementsByTagName('script')[0]; snode.parentNode.insertBefore(lft, snode);
})();
</script>
<link rel="stylesheet" type="text/css" href="//tech.innovation.co.jp/themes/uno/assets/css/uno.css?v=1.0.0" />
<link rel="canonical" href="http://tech.innovation.co.jp" />
<meta name="generator" content="Ghost ?" />
<link rel="alternate" type="application/rss+xml" title="イノベーション エンジニアブログ" href="http://tech.innovation.co.jp/rss" />
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/default.min.css">
</head>
<body class="tag-template tag-E-C-M-A-Script2015 home-template no-js">
<span class="mobile btn-mobile-menu">
<i class="icon icon-list btn-mobile-menu__icon"></i>
<i class="icon icon-x-circle btn-mobile-close__icon hidden"></i>
</span>
<header class="panel-cover " >
<div class="panel-main">
<div class="panel-main__inner panel-inverted">
<div class="panel-main__content">
<h1 class="panel-cover__title panel-title"><a href="http://tech.innovation.co.jp" title="link to homepage for イノベーション エンジニアブログ">イノベーション エンジニアブログ</a></h1>
<hr class="panel-cover__divider" />
<p class="panel-cover__description">株式会社イノベーションのエンジニアたちの技術系ブログです。ITトレンド・List Finderの開発をベースに、業務外での技術研究などもブログとして発信していってます!</p>
<hr class="panel-cover__divider panel-cover__divider--secondary" />
<div class="navigation-wrapper">
<nav class="cover-navigation cover-navigation--primary">
<ul class="navigation">
<li class="navigation__item"><a href="http://tech.innovation.co.jp/#blog" title="link to イノベーション エンジニアブログ blog" class="blog-button">Blog</a></li>
</ul>
</nav>
<nav class="cover-navigation navigation--social">
<ul class="navigation">
</ul>
</nav>
</div>
</div>
</div>
<div class="panel-cover--overlay"></div>
</div>
</header>
<div class="content-wrapper">
<!-- ソーシャルボタンここから -->
<div id="boxArea" style="display: table; padding: 0 0 0 2px;">
<div style="width: 74px; height: 22px; float: left;">
<a href="https://twitter.com/share" class="twitter-share-button"
{count} data-lang="ja" data-dnt="true">ツイート</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 style="width: 76px; height: 22px; float: left;">
<div class="g-plusone" data-size="medium"></div>
<script type="text/javascript">
window.___gcfg = {
lang : 'ja'
};
(function() {
var po = document.createElement('script');
po.type = 'text/javascript';
po.async = true;
po.src = 'https://apis.google.com/js/platform.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(po, s);
})();
</script>
</div>
<div style="width: 126px; height: 22px; float: left;">
<a href="http://b.hatena.ne.jp/entry/" class="hatena-bookmark-button"
data-hatena-bookmark-layout="standard-balloon"
data-hatena-bookmark-lang="ja" title="このエントリーをはてなブックマークに追加"><img
src="http://b.st-hatena.com/images/entry-button/button-only@2x.png"
alt="このエントリーをはてなブックマークに追加" width="20" height="20"
style="border: none;" /></a>
<script type="text/javascript"
src="http://b.st-hatena.com/js/bookmark_button.js" charset="utf-8"
async="async"></script>
</div>
<div style="width: 117px; height: 22px; float: left;">
<a data-pocket-label="pocket" data-pocket-count="horizontal"
class="pocket-btn" data-lang="en"></a>
</div>
<div style="width: 86px; height: 22px; float: left;">
<span><script type="text/javascript"
src="//media.line.me/js/line-button.js?v=20140411"></script>
<script type="text/javascript">
new media_line_me.LineButton({
"pc" : true,
"lang" : "ja",
"type" : "a"
});
</script></span>
</div>
<div style="width: 114px; height: 22px; float: left;">
<script src="//platform.linkedin.com/in.js" type="text/javascript">
lang: ja_JP
</script>
<script type="IN/Share" data-counter="right"></script>
</div>
<div style="width: 112px; height: 22px; float: left;">
<iframe
scrolling="no" frameborder="0" id="fbframe"
width="164" height="46" style="border:none;overflow:hidden"
allowTransparency="true"></iframe>
</div>
<script type="text/javascript">
(function() {
var url = encodeURIComponent(location.href);
document.getElementById('fbframe').src="//www.facebook.com/plugins/like.php?href=" + url +
"&width=164&layout=button_count&action=like&show_faces=true&share=true&height=46&appId=1613776965579453"
})();
</script>
</div>
<script type="text/javascript">
!function(d, i) {
if (!d.getElementById(i)) {
var j = d.createElement("script");
j.id = i;
j.src = "https://widgets.getpocket.com/v1/j/btn.js?v=1";
var w = d.getElementById(i);
d.body.appendChild(j);
}
}(document, "pocket-btn-js");
</script>
<!-- ソーシャルボタンここまで -->
<div class="content-wrapper__inner">
<h1 class="archive-title">Tag: E-C-M-A-Script2015</h1>
<hr class="section-title__divider" />
<div class="main-post-list">
<ol class="post-list">
<li>
<h2 class="post-list__post-title post-title"><a href="http://tech.innovation.co.jp/2017/07/09/Serverless-Framework-E-C-M-A-Script2015-1.html" title="link to Serverless Framework + ECMAScript2015 でサーバーレスマイクロサービスを作る その1">Serverless Framework + ECMAScript2015 でサーバーレスマイクロサービスを作る その1</a></h2>
<p class="excerpt">SREチームの城田です。 サーバーレスでマイクロサービスを作れるようになっておけば、 今後役に立つこともあるかなと思いまして作ってみます。 概要 マイクロサービス設計でおおよその場合必要と思われる、 トークン発行やユーザ情報管理をするアカウント周りのプラットフォームを作成したいと思います。 今回は API Gateway から Lambda を起動してトークンを発行し、RDSにデータを保存してHTTPレスポンスを返す、という部分を作成します。 また、 サーバーレスアーキテクチャで行うこと、サーバレスフレームワークを使うこと、ECMAScript2015に準拠したコーディングを行うことも目的としています。 今回使用する環境は、Serverless Framework という、 API Gat…</p>
<div class="post-list__meta">
<time datetime="09 Jul 2017" class="post-list__meta--date date">09 Jul 2017</time> •
<span class="post-list__meta--tags tags"><a href="#blog" title="Shirota">Shirota</a>, <a href="#blog" title=" Serverless Framework"> Serverless Framework</a>, <a href="#blog" title=" ECMAScript2015"> ECMAScript2015</a>, <a href="#blog" title=" ECMAScript6"> ECMAScript6</a>, <a href="#blog" title=" ES6"> ES6</a></span>
</div>
<hr class="post-list__divider" />
</li>
</ol>
<hr class="post-list__divider " />
<nav class="pagination" role="navigation">
<span class="pagination__page-number">Page 1 of 1</span>
</nav>
</div>
<footer class="footer">
<span class="footer__copyright">© 2017. All rights reserved.</span>
<span class="footer__copyright"><a href="http://uno.daleanthony.com" title="link to page for Uno Ghost theme">Uno theme</a> by <a href="http://daleanthony.com" title="link to website for Dale-Anthony">Dale-Anthony</a></span>
<span class="footer__copyright">Proudly published with <a href="http://hubpress.io" title="link to Hubpress website">Hubpress</a></span>
</footer>
</div>
</div>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js?v="></script> <script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment-with-locales.min.js?v="></script> <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/highlight.min.js?v="></script>
<script type="text/javascript">
jQuery( document ).ready(function() {
// change date with ago
jQuery('ago.ago').each(function(){
var element = jQuery(this).parent();
element.html( moment(element.text()).fromNow());
});
});
hljs.initHighlightingOnLoad();
</script>
<script type="text/javascript" src="//tech.innovation.co.jp/themes/uno/assets/js/main.js?v=1.0.0"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-105881090-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>
| innovation-jp/innovation-jp.github.io | tag/E-C-M-A-Script2015/index.html | HTML | mit | 12,905 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1013,
1028,
1026,
18804,
8299,
1011,
1041,
15549,
2615,
1027,
1000,
1060,
1011,
25423,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
@charset "UTF-8";
.flexeditor > ul.flexcontent {
display:none;
}
.flexeditor > ul.flexcontent div.editor {
display:none;
}
.flexeditor > ul.flexcontent > li > div.buttonbar {
display:none;
position:absolute;
padding:4px 0 0 0;
cursor:move;
background-color:#DDD;
top:-30px;
height:30px;
width:100%;
-moz-border-radius-topleft:4px;
-webkit-border-top-left-radius:4px;
-khtml-border-top-left-radius:4px;
border-top-left-radius:4px;
-moz-border-radius-topright:4px;
-webkit-border-top-right-radius:4px;
-khtml-border-top-right-radius:4px;
border-top-right-radius:4px;
}
.flexeditor button.flex-ui-button {
padding:0 3px 0 3px;
margin:0 0 0 4px;
border:1px solid #CCC;
-moz-border-radius:4px;
-webkit-border-radius:4px;
-khtml-border-radius:4px;
border-radius:4px;
width:24px;
height:24px;
float:left;
background-color:white;
cursor:pointer;
}
.flexeditor button.flex-ui-button span {
display:block;
height:16px;
width:16px;
}
.flexeditor > ul.flexcontent > li > div.content {
padding:0;
margin:0;
}
.flexeditor .placeholder {
list-style-type:none;
margin:0;
/*background-color:#CCC;*/
border:1px dashed #CCC;
}
.flexeditor div.modules {
background-color:#CCC;
-moz-border-radius:4px;
-webkit-border-radius:4px;
-khtml-border-radius:4px;
border-radius:4px;
padding:20px 0 0 10px;
}
.flexeditor div.modules > button {
padding:5px 5px 0 5px;
margin:0 10px 10px 0;
border:1px solid #CCC;
-moz-border-radius:4px;
-webkit-border-radius:4px;
-khtml-border-radius:4px;
border-radius:4px;
background-color:white;
cursor:pointer;
width:160px;
height:75px;
font-size:9px;
text-align:left;
float:left;
}
.flexeditor div.modules > button > .name {
font-size:11px;
font-weight:bold;
margin-bottom:5px;
}
.flexeditor div.modules > button > .description {
height:50px;
}
| fashionweb/moraso | adm/css/flexeditor.css | CSS | mit | 2,017 | [
30522,
1030,
25869,
13462,
1000,
21183,
2546,
1011,
1022,
1000,
1025,
1012,
24244,
15660,
1028,
17359,
1012,
23951,
8663,
6528,
2102,
1063,
4653,
1024,
3904,
1025,
1065,
1012,
24244,
15660,
1028,
17359,
1012,
23951,
8663,
6528,
2102,
4487,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Rhodymenia preissiana Sonder SPECIES
#### Status
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | mdoering/backbone | life/Plantae/Rhodophyta/Florideophyceae/Gracilariales/Gracilariaceae/Hydropuntia/Hydropuntia preissiana/ Syn. Rhodymenia preissiana/README.md | Markdown | apache-2.0 | 185 | [
30522,
1001,
1054,
6806,
5149,
3549,
2401,
3653,
14643,
11410,
2365,
4063,
2427,
1001,
1001,
1001,
1001,
3570,
10675,
1001,
1001,
1001,
1001,
2429,
2000,
1996,
10161,
1997,
2166,
1010,
3822,
2254,
2249,
1001,
1001,
1001,
1001,
2405,
1999,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
console.log("VS: loading content_script.js..." + new Date());
// Check if the communication between page and background.js has broken.
var last_message_time = new Date().getTime();
new Promise((resolve) => setTimeout(resolve, 1000000)).then(() => {
var now = new Date().getTime();
if (now - last_message_time > 500000) {
sendAlert('Not having message from background for at least 500s, force reloading');
reloadPage();
}
});
chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
// Update timestamp first.
last_message_time = new Date().getTime();
console.log("VS: received data from content_script.js" + new Date());
console.log(request);
var action = request["action"];
takeAction(action, request);
});
var already_logging_in = false;
function takeAction(action, request) {
var url = window.location.href;
console.log("VS: Taking action: " + action + " in " + url);
if (action === ACTION_FOR_HOMEPAGE) {
homePage(request);
} else if (action === ACTION_FOR_LOGIN_PAGE) {
loginPage(request);
} else if (action === ACTION_FOR_ASYNC_LOGIN) {
loginPage(request);
} else if (action === ACTION_FOR_DASHBOARD_PAGE) {
dashboardPage(request);
} else {
// Other cases.
console.log("VS: unknown action:" + new Date());
console.log(action);
return;
}
}
function dashboardPage(request) {
console.log("VS: In dashboard page" + new Date());
//var val = $('[data-reactid=".0.0.3.0.0.0.0.0.1.0.0.1.0"]');
//if (val) {
// var ts = new Date().getTime();
// var amount = val.text();
// if (!amount) {
// console.log("Failed to parse data from html page. " + new Date());
// } else {
// saveGenerationData({'amount': amount, 'time': ts});
// }
//} else {
// sendAlert('Failed to read data from Dashboard page' + window.location.href);
//}
//console.log("VS: setting to reload page in 60s: " + new Date());
//window.setInterval(function() {
console.log("VS: polling account data" + new Date());
$.ajax({url: "/api/fusion/accounts"}).done(function(msg) {
console.log("VS: got account data" + new Date());
var j = msg;
if (typeof(j) === "object" && 'accounts' in j) {
console.log(j['accounts']);
var acct = j['accounts'][0]['account_no'];
var newUrl = '/api/fusion/accounts/' + acct;
console.log("VS: polling account detail data" + new Date());
$.ajax({url: newUrl}).done(function(msg) {
console.log("VS: got account detail data" + new Date());
var j = msg;
if (typeof(j) === "object" && 'energyToday' in j) {
var ts = new Date().getTime();
var amount = j['energyToday'] / 1000.0;
console.log("VS: saveing energy data" + new Date());
saveGenerationData({'time': ts, 'amount': amount});
return;
}
sendAlert("Failed parse detailed account info from AJAX for: " + textStatus);
reloadPage();
}).fail(function(jqXHR, textStatus) {
sendAlert("Request failed for loading detailed account info from AJAX for: " + textStatus);
reloadPage();
});
return;
}
sendAlert('Failed to parse account data');
reloadPage();
}).fail(function(jqXHR, textStatus) {
sendAlert("Request failed for loading accounts AJAX for: " + textStatus);
reloadPage();
});
//}, 60000);
}
function loginPage(request) {
if (request) {
asyncLogin(request);
} else {
chrome.runtime.sendMessage({"action": ACTION_FOR_ASYNC_LOGIN});
}
}
function homePage(request) {
var links = $('A');
for (var i in links) {
var link = links[i];
if (link.href == LOGIN_PAGE) {
link.click();
}
}
}
function asyncLogin(request) {
if (already_logging_in) {
console.log("VS: already logging in. This is possible, ignoring.." + new Date());
return;
}
already_logging_in = true;
console.log("VS: gettting new data to login" + new Date());
console.log(request);
context = request['data'];
if ($("INPUT[data-reactid='.0.0.0.0.0.1.1']").val(context.username).length > 0
&& $("INPUT[data-reactid='.0.0.0.0.0.2.0']").val(context.passwd).length > 0) {
$("BUTTON[data-reactid='.0.0.0.0.0.4.0']").click();
new Promise((resolve) => setTimeout(resolve, 100000)).then(() => {
sendAlert('Login failed for username' + context.username + ' and passwd: ' + context.passwd);
});
}
$('.email-input.js-initial-focus').val(context.username);
$('.js-password-field').val(context.passwd);
new Promise((resolve) => setTimeout(resolve, 1500)).then(() => {
$('button.submit').click();
});
}
var action = urlToAction(window.location.href);
console.log("VS: intercepted action:" + action + " at " + new Date());
if (action != '') {
takeAction(action, null);
}
console.log("VS: loaded:" + window.location.href);
console.log("VS: registered on load event here handler in content_script.js" + new Date());
| redisliu/chrome-extensions | vivintsolar-monitor/content_script.js | JavaScript | mit | 5,501 | [
30522,
10122,
1012,
8833,
1006,
1000,
5443,
1024,
10578,
4180,
1035,
5896,
1012,
1046,
2015,
1012,
1012,
1012,
1000,
1009,
2047,
3058,
1006,
1007,
1007,
1025,
1013,
1013,
4638,
2065,
1996,
4807,
2090,
3931,
1998,
4281,
1012,
1046,
2015,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/greengrass/Greengrass_EXPORTS.h>
#include <aws/greengrass/model/LocalDeviceResourceData.h>
#include <aws/greengrass/model/LocalVolumeResourceData.h>
#include <aws/greengrass/model/S3MachineLearningModelResourceData.h>
#include <aws/greengrass/model/SageMakerMachineLearningModelResourceData.h>
#include <aws/greengrass/model/SecretsManagerSecretResourceData.h>
#include <utility>
namespace Aws
{
namespace Utils
{
namespace Json
{
class JsonValue;
class JsonView;
} // namespace Json
} // namespace Utils
namespace Greengrass
{
namespace Model
{
/**
* A container for resource data. The container takes only one of the following
* supported resource data types: ''LocalDeviceResourceData'',
* ''LocalVolumeResourceData'', ''SageMakerMachineLearningModelResourceData'',
* ''S3MachineLearningModelResourceData'',
* ''SecretsManagerSecretResourceData''.<p><h3>See Also:</h3> <a
* href="http://docs.aws.amazon.com/goto/WebAPI/greengrass-2017-06-07/ResourceDataContainer">AWS
* API Reference</a></p>
*/
class AWS_GREENGRASS_API ResourceDataContainer
{
public:
ResourceDataContainer();
ResourceDataContainer(Aws::Utils::Json::JsonView jsonValue);
ResourceDataContainer& operator=(Aws::Utils::Json::JsonView jsonValue);
Aws::Utils::Json::JsonValue Jsonize() const;
/**
* Attributes that define the local device resource.
*/
inline const LocalDeviceResourceData& GetLocalDeviceResourceData() const{ return m_localDeviceResourceData; }
/**
* Attributes that define the local device resource.
*/
inline bool LocalDeviceResourceDataHasBeenSet() const { return m_localDeviceResourceDataHasBeenSet; }
/**
* Attributes that define the local device resource.
*/
inline void SetLocalDeviceResourceData(const LocalDeviceResourceData& value) { m_localDeviceResourceDataHasBeenSet = true; m_localDeviceResourceData = value; }
/**
* Attributes that define the local device resource.
*/
inline void SetLocalDeviceResourceData(LocalDeviceResourceData&& value) { m_localDeviceResourceDataHasBeenSet = true; m_localDeviceResourceData = std::move(value); }
/**
* Attributes that define the local device resource.
*/
inline ResourceDataContainer& WithLocalDeviceResourceData(const LocalDeviceResourceData& value) { SetLocalDeviceResourceData(value); return *this;}
/**
* Attributes that define the local device resource.
*/
inline ResourceDataContainer& WithLocalDeviceResourceData(LocalDeviceResourceData&& value) { SetLocalDeviceResourceData(std::move(value)); return *this;}
/**
* Attributes that define the local volume resource.
*/
inline const LocalVolumeResourceData& GetLocalVolumeResourceData() const{ return m_localVolumeResourceData; }
/**
* Attributes that define the local volume resource.
*/
inline bool LocalVolumeResourceDataHasBeenSet() const { return m_localVolumeResourceDataHasBeenSet; }
/**
* Attributes that define the local volume resource.
*/
inline void SetLocalVolumeResourceData(const LocalVolumeResourceData& value) { m_localVolumeResourceDataHasBeenSet = true; m_localVolumeResourceData = value; }
/**
* Attributes that define the local volume resource.
*/
inline void SetLocalVolumeResourceData(LocalVolumeResourceData&& value) { m_localVolumeResourceDataHasBeenSet = true; m_localVolumeResourceData = std::move(value); }
/**
* Attributes that define the local volume resource.
*/
inline ResourceDataContainer& WithLocalVolumeResourceData(const LocalVolumeResourceData& value) { SetLocalVolumeResourceData(value); return *this;}
/**
* Attributes that define the local volume resource.
*/
inline ResourceDataContainer& WithLocalVolumeResourceData(LocalVolumeResourceData&& value) { SetLocalVolumeResourceData(std::move(value)); return *this;}
/**
* Attributes that define an Amazon S3 machine learning resource.
*/
inline const S3MachineLearningModelResourceData& GetS3MachineLearningModelResourceData() const{ return m_s3MachineLearningModelResourceData; }
/**
* Attributes that define an Amazon S3 machine learning resource.
*/
inline bool S3MachineLearningModelResourceDataHasBeenSet() const { return m_s3MachineLearningModelResourceDataHasBeenSet; }
/**
* Attributes that define an Amazon S3 machine learning resource.
*/
inline void SetS3MachineLearningModelResourceData(const S3MachineLearningModelResourceData& value) { m_s3MachineLearningModelResourceDataHasBeenSet = true; m_s3MachineLearningModelResourceData = value; }
/**
* Attributes that define an Amazon S3 machine learning resource.
*/
inline void SetS3MachineLearningModelResourceData(S3MachineLearningModelResourceData&& value) { m_s3MachineLearningModelResourceDataHasBeenSet = true; m_s3MachineLearningModelResourceData = std::move(value); }
/**
* Attributes that define an Amazon S3 machine learning resource.
*/
inline ResourceDataContainer& WithS3MachineLearningModelResourceData(const S3MachineLearningModelResourceData& value) { SetS3MachineLearningModelResourceData(value); return *this;}
/**
* Attributes that define an Amazon S3 machine learning resource.
*/
inline ResourceDataContainer& WithS3MachineLearningModelResourceData(S3MachineLearningModelResourceData&& value) { SetS3MachineLearningModelResourceData(std::move(value)); return *this;}
/**
* Attributes that define an Amazon SageMaker machine learning resource.
*/
inline const SageMakerMachineLearningModelResourceData& GetSageMakerMachineLearningModelResourceData() const{ return m_sageMakerMachineLearningModelResourceData; }
/**
* Attributes that define an Amazon SageMaker machine learning resource.
*/
inline bool SageMakerMachineLearningModelResourceDataHasBeenSet() const { return m_sageMakerMachineLearningModelResourceDataHasBeenSet; }
/**
* Attributes that define an Amazon SageMaker machine learning resource.
*/
inline void SetSageMakerMachineLearningModelResourceData(const SageMakerMachineLearningModelResourceData& value) { m_sageMakerMachineLearningModelResourceDataHasBeenSet = true; m_sageMakerMachineLearningModelResourceData = value; }
/**
* Attributes that define an Amazon SageMaker machine learning resource.
*/
inline void SetSageMakerMachineLearningModelResourceData(SageMakerMachineLearningModelResourceData&& value) { m_sageMakerMachineLearningModelResourceDataHasBeenSet = true; m_sageMakerMachineLearningModelResourceData = std::move(value); }
/**
* Attributes that define an Amazon SageMaker machine learning resource.
*/
inline ResourceDataContainer& WithSageMakerMachineLearningModelResourceData(const SageMakerMachineLearningModelResourceData& value) { SetSageMakerMachineLearningModelResourceData(value); return *this;}
/**
* Attributes that define an Amazon SageMaker machine learning resource.
*/
inline ResourceDataContainer& WithSageMakerMachineLearningModelResourceData(SageMakerMachineLearningModelResourceData&& value) { SetSageMakerMachineLearningModelResourceData(std::move(value)); return *this;}
/**
* Attributes that define a secret resource, which references a secret from AWS
* Secrets Manager.
*/
inline const SecretsManagerSecretResourceData& GetSecretsManagerSecretResourceData() const{ return m_secretsManagerSecretResourceData; }
/**
* Attributes that define a secret resource, which references a secret from AWS
* Secrets Manager.
*/
inline bool SecretsManagerSecretResourceDataHasBeenSet() const { return m_secretsManagerSecretResourceDataHasBeenSet; }
/**
* Attributes that define a secret resource, which references a secret from AWS
* Secrets Manager.
*/
inline void SetSecretsManagerSecretResourceData(const SecretsManagerSecretResourceData& value) { m_secretsManagerSecretResourceDataHasBeenSet = true; m_secretsManagerSecretResourceData = value; }
/**
* Attributes that define a secret resource, which references a secret from AWS
* Secrets Manager.
*/
inline void SetSecretsManagerSecretResourceData(SecretsManagerSecretResourceData&& value) { m_secretsManagerSecretResourceDataHasBeenSet = true; m_secretsManagerSecretResourceData = std::move(value); }
/**
* Attributes that define a secret resource, which references a secret from AWS
* Secrets Manager.
*/
inline ResourceDataContainer& WithSecretsManagerSecretResourceData(const SecretsManagerSecretResourceData& value) { SetSecretsManagerSecretResourceData(value); return *this;}
/**
* Attributes that define a secret resource, which references a secret from AWS
* Secrets Manager.
*/
inline ResourceDataContainer& WithSecretsManagerSecretResourceData(SecretsManagerSecretResourceData&& value) { SetSecretsManagerSecretResourceData(std::move(value)); return *this;}
private:
LocalDeviceResourceData m_localDeviceResourceData;
bool m_localDeviceResourceDataHasBeenSet;
LocalVolumeResourceData m_localVolumeResourceData;
bool m_localVolumeResourceDataHasBeenSet;
S3MachineLearningModelResourceData m_s3MachineLearningModelResourceData;
bool m_s3MachineLearningModelResourceDataHasBeenSet;
SageMakerMachineLearningModelResourceData m_sageMakerMachineLearningModelResourceData;
bool m_sageMakerMachineLearningModelResourceDataHasBeenSet;
SecretsManagerSecretResourceData m_secretsManagerSecretResourceData;
bool m_secretsManagerSecretResourceDataHasBeenSet;
};
} // namespace Model
} // namespace Greengrass
} // namespace Aws
| awslabs/aws-sdk-cpp | aws-cpp-sdk-greengrass/include/aws/greengrass/model/ResourceDataContainer.h | C | apache-2.0 | 9,942 | [
30522,
1013,
1008,
1008,
1008,
9385,
9733,
1012,
4012,
1010,
4297,
1012,
2030,
2049,
18460,
1012,
2035,
2916,
9235,
1012,
1008,
30524,
19673,
1035,
14338,
1012,
1044,
1028,
1001,
2421,
1026,
22091,
2015,
1013,
2665,
19673,
1013,
2944,
1013,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!-- This HTML file has been created by texi2html 1.27
from emacs.texi on 3 March 1994 -->
<TITLE>GNU Emacs Manual - Commands for Human Languages</TITLE>
<P>Go to the <A HREF="emacs_24.html">previous</A>, <A HREF="emacs_26.html">next</A> section.<P>
<A NAME="IDX723"></A>
<A NAME="IDX724"></A>
<H1><A NAME="SEC155" HREF="emacs_toc.html#SEC155">Commands for Human Languages</A></H1>
<P>
The term <DFN>text</DFN> has two widespread meanings in our area of the
computer field. One is data that is a sequence of characters. Any file
that you edit with Emacs is text, in this sense of the word. The other
meaning is more restrictive: a sequence of characters in a human language
for humans to read (possibly after processing by a text formatter), as
opposed to a program or commands for a program.
<P>
Human languages have syntactic/stylistic conventions that can be
supported or used to advantage by editor commands: conventions involving
words, sentences, paragraphs, and capital letters. This chapter
describes Emacs commands for all of these things. There are also
commands for <DFN>filling</DFN>, which means rearranging the lines of a
paragraph to be approximately equal in length. The commands for moving
over and killing words, sentences and paragraphs, while intended
primarily for editing text, are also often useful for editing programs.
<P>
Emacs has several major modes for editing human language text.
If the file contains text pure and simple, use Text mode, which customizes
Emacs in small ways for the syntactic conventions of text. For text which
contains embedded commands for text formatters, Emacs has other major modes,
each for a particular text formatter. Thus, for input to TeX, you would
use TeX mode; for input to nroff, Nroff mode.
<P>
<A NAME="IDX725"></A>
<A NAME="IDX726"></A>
<H2><A NAME="SEC156" HREF="emacs_toc.html#SEC156">Words</A></H2>
<P>
Emacs has commands for moving over or operating on words. By convention,
the keys for them are all Meta characters.
<P>
<DL COMPACT>
<DT><KBD>M-f</KBD>
<DD>Move forward over a word (<CODE>forward-word</CODE>).
<DT><KBD>M-b</KBD>
<DD>Move backward over a word (<CODE>backward-word</CODE>).
<DT><KBD>M-d</KBD>
<DD>Kill up to the end of a word (<CODE>kill-word</CODE>).
<DT><KBD>M-<KBD>DEL</KBD></KBD>
<DD>Kill back to the beginning of a word (<CODE>backward-kill-word</CODE>).
<DT><KBD>M-@</KBD>
<DD>Mark the end of the next word (<CODE>mark-word</CODE>).
<DT><KBD>M-t</KBD>
<DD>Transpose two words or drag a word across other words
(<CODE>transpose-words</CODE>).
</DL>
<P>
Notice how these keys form a series that parallels the
character-based <KBD>C-f</KBD>, <KBD>C-b</KBD>, <KBD>C-d</KBD>, <KBD>C-t</KBD> and
<KBD>DEL</KBD>. <KBD>M-@</KBD> is related to <KBD>C-@</KBD>, which is an alias for
<KBD>C-<KBD>SPC</KBD></KBD>.<A NAME="IDX727"></A>
<A NAME="IDX728"></A>
<A NAME="IDX729"></A>
<A NAME="IDX730"></A>
<P>
The commands <KBD>M-f</KBD> (<CODE>forward-word</CODE>) and <KBD>M-b</KBD>
(<CODE>backward-word</CODE>) move forward and backward over words. These
Meta characters are thus analogous to the corresponding control
characters, <KBD>C-f</KBD> and <KBD>C-b</KBD>, which move over single characters
in the text. The analogy extends to numeric arguments, which serve as
repeat counts. <KBD>M-f</KBD> with a negative argument moves backward, and
<KBD>M-b</KBD> with a negative argument moves forward. Forward motion
stops right after the last letter of the word, while backward motion
stops right before the first letter.<A NAME="IDX731"></A>
<A NAME="IDX732"></A>
<P>
<KBD>M-d</KBD> (<CODE>kill-word</CODE>) kills the word after point. To be
precise, it kills everything from point to the place <KBD>M-f</KBD> would
move to. Thus, if point is in the middle of a word, <KBD>M-d</KBD> kills
just the part after point. If some punctuation comes between point and the
next word, it is killed along with the word. (If you wish to kill only the
next word but not the punctuation before it, simply do <KBD>M-f</KBD> to get
the end, and kill the word backwards with <KBD>M-<KBD>DEL</KBD></KBD>.)
<KBD>M-d</KBD> takes arguments just like <KBD>M-f</KBD>.
<A NAME="IDX733"></A>
<A NAME="IDX734"></A>
<P>
<KBD>M-<KBD>DEL</KBD></KBD> (<CODE>backward-kill-word</CODE>) kills the word before
point. It kills everything from point back to where <KBD>M-b</KBD> would
move to. If point is after the space in <SAMP>`FOO, BAR'</SAMP>, then
<SAMP>`FOO, '</SAMP> is killed. (If you wish to kill just <SAMP>`FOO'</SAMP>, do
<KBD>M-b M-d</KBD> instead of <KBD>M-<KBD>DEL</KBD></KBD>.)
<A NAME="IDX735"></A>
<A NAME="IDX736"></A>
<P>
<KBD>M-t</KBD> (<CODE>transpose-words</CODE>) exchanges the word before or
containing point with the following word. The delimiter characters between
the words do not move. For example, <SAMP>`FOO, BAR'</SAMP> transposes into
<SAMP>`BAR, FOO'</SAMP> rather than <SAMP>`BAR FOO,'</SAMP>. See section <A HREF="emacs_18.html#SEC93">Transposing Text</A>, for
more on transposition and on arguments to transposition commands.
<A NAME="IDX737"></A>
<A NAME="IDX738"></A>
<P>
To operate on the next <VAR>n</VAR> words with an operation which applies
between point and mark, you can either set the mark at point and then move
over the words, or you can use the command <KBD>M-@</KBD> (<CODE>mark-word</CODE>)
which does not move point, but sets the mark where <KBD>M-f</KBD> would move
to. <KBD>M-@</KBD> accepts a numeric argument that says how many words to
scan for the place to put the mark.
<P>
The word commands' understanding of syntax is completely controlled by
the syntax table. Any character can, for example, be declared to be a word
delimiter. See section <A HREF="emacs_35.html#SEC355">The Syntax Table</A>.
<P>
<A NAME="IDX739"></A>
<A NAME="IDX740"></A>
<H2><A NAME="SEC157" HREF="emacs_toc.html#SEC157">Sentences</A></H2>
<P>
The Emacs commands for manipulating sentences and paragraphs are mostly
on Meta keys, so as to be like the word-handling commands.
<P>
<DL COMPACT>
<DT><KBD>M-a</KBD>
<DD>Move back to the beginning of the sentence (<CODE>backward-sentence</CODE>).
<DT><KBD>M-e</KBD>
<DD>Move forward to the end of the sentence (<CODE>forward-sentence</CODE>).
<DT><KBD>M-k</KBD>
<DD>Kill forward to the end of the sentence (<CODE>kill-sentence</CODE>).
<DT><KBD>C-x <KBD>DEL</KBD></KBD>
<DD>Kill back to the beginning of the sentence (<CODE>backward-kill-sentence</CODE>).
</DL>
<A NAME="IDX741"></A>
<A NAME="IDX742"></A>
<A NAME="IDX743"></A>
<A NAME="IDX744"></A>
<P>
The commands <KBD>M-a</KBD> and <KBD>M-e</KBD> (<CODE>backward-sentence</CODE> and
<CODE>forward-sentence</CODE>) move to the beginning and end of the current
sentence, respectively. They were chosen to resemble <KBD>C-a</KBD> and
<KBD>C-e</KBD>, which move to the beginning and end of a line. Unlike them,
<KBD>M-a</KBD> and <KBD>M-e</KBD> if repeated or given numeric arguments move over
successive sentences. Emacs assumes that the typist's convention is
followed, and thus considers a sentence to end wherever there is a
<SAMP>`.'</SAMP>, <SAMP>`?'</SAMP> or <SAMP>`!'</SAMP> followed by the end of a line or two spaces,
with any number of <SAMP>`)'</SAMP>, <SAMP>`]'</SAMP>, <SAMP>`''</SAMP>, or <SAMP>`"'</SAMP> characters
allowed in between. A sentence also begins or ends wherever a paragraph
begins or ends.<P>
Neither <KBD>M-a</KBD> nor <KBD>M-e</KBD> moves past the newline or spaces beyond
the sentence edge at which it is stopping.
<A NAME="IDX745"></A>
<A NAME="IDX746"></A>
<A NAME="IDX747"></A>
<A NAME="IDX748"></A>
<P>
Just as <KBD>C-a</KBD> and <KBD>C-e</KBD> have a kill command, <KBD>C-k</KBD>, to go
with them, so <KBD>M-a</KBD> and <KBD>M-e</KBD> have a corresponding kill command
<KBD>M-k</KBD> (<CODE>kill-sentence</CODE>) which kills from point to the end of the
sentence. With minus one as an argument it kills back to the beginning of
the sentence. Larger arguments serve as a repeat count.<P>
There is a special command, <KBD>C-x <KBD>DEL</KBD></KBD>
(<CODE>backward-kill-sentence</CODE>) for killing back to the beginning of a
sentence, because this is useful when you change your mind in the middle of
composing text.<A NAME="IDX749"></A>
<P>
The variable <CODE>sentence-end</CODE> controls recognition of the end of a
sentence. It is a regexp that matches the last few characters of a
sentence, together with the whitespace following the sentence. Its
normal value is
<P>
<PRE>
"[.?!][]\"')]*\\($\\|\t\\| \\)[ \t\n]*"
</PRE>
<P>
This example is explained in the section on regexps. See section <A HREF="emacs_17.html#SEC83">Syntax of Regular Expressions</A>.
<P>
<A NAME="IDX750"></A>
<A NAME="IDX751"></A>
<A NAME="IDX752"></A>
<A NAME="IDX753"></A>
<A NAME="IDX754"></A>
<A NAME="IDX755"></A>
<H2><A NAME="SEC158" HREF="emacs_toc.html#SEC158">Paragraphs</A></H2>
<P>
The Emacs commands for manipulating paragraphs are also Meta keys.
<P>
<DL COMPACT>
<DT><KBD>M-{</KBD>
<DD>Move back to previous paragraph beginning (<CODE>backward-paragraph</CODE>).
<DT><KBD>M-}</KBD>
<DD>Move forward to next paragraph end (<CODE>forward-paragraph</CODE>).
<DT><KBD>M-h</KBD>
<DD>Put point and mark around this or next paragraph (<CODE>mark-paragraph</CODE>).
</DL>
<P>
<KBD>M-{</KBD> moves to the beginning of the current or previous paragraph,
while <KBD>M-}</KBD> moves to the end of the current or next paragraph.
Blank lines and text formatter command lines separate paragraphs and are
not part of any paragraph. Also, an indented line starts a new
paragraph.
<P>
In major modes for programs (as opposed to Text mode), paragraphs begin
and end only at blank lines. This makes the paragraph commands continue to
be useful even though there are no paragraphs per se.
<P>
When there is a fill prefix, then paragraphs are delimited by all lines
which don't start with the fill prefix. See section <A HREF="emacs_25.html#SEC160">Filling Text</A>.
<A NAME="IDX756"></A>
<A NAME="IDX757"></A>
<P>
When you wish to operate on a paragraph, you can use the command
<KBD>M-h</KBD> (<CODE>mark-paragraph</CODE>) to set the region around it. This
command puts point at the beginning and mark at the end of the paragraph
point was in. If point is between paragraphs (in a run of blank lines, or
at a boundary), the paragraph following point is surrounded by point and
mark. If there are blank lines preceding the first line of the paragraph,
one of these blank lines is included in the region. Thus, for example,
<KBD>M-h C-w</KBD> kills the paragraph around or after point.
<A NAME="IDX758"></A>
<A NAME="IDX759"></A>
<P>
The precise definition of a paragraph boundary is controlled by the
variables <CODE>paragraph-separate</CODE> and <CODE>paragraph-start</CODE>. The
value of <CODE>paragraph-start</CODE> is a regexp that should match any line
that either starts or separates paragraphs. The value of
<CODE>paragraph-separate</CODE> is another regexp that should match only lines
that separate paragraphs without being part of any paragraph. Lines
that start a new paragraph and are contained in it must match only
<CODE>paragraph-start</CODE>, not <CODE>paragraph-separate</CODE>. For example,
normally <CODE>paragraph-start</CODE> is <CODE>"^[ <TT>\</TT>t<TT>\</TT>n<TT>\</TT>f]"</CODE> and
<CODE>paragraph-separate</CODE> is <CODE>"^[ <TT>\</TT>t<TT>\</TT>f]*$"</CODE>.<P>
Normally it is desirable for page boundaries to separate paragraphs.
The default values of these variables recognize the usual separator for
pages.
<P>
<H2><A NAME="SEC159" HREF="emacs_toc.html#SEC159">Pages</A></H2>
<A NAME="IDX760"></A>
<A NAME="IDX761"></A>
<P>
Files are often thought of as divided into <DFN>pages</DFN> by the
<DFN>formfeed</DFN> character (ASCII control-L, octal code 014). For example,
if a file is printed on a line printer, each page of the file, in this
sense, will start on a new page of paper. Emacs treats a page-separator
character just like any other character. You can insert it with <KBD>C-q
C-l</KBD>, or delete it with <KBD>DEL</KBD>. Thus, you are free to paginate your file
or not. However, since pages are often meaningful divisions of the file,
Emacs provides commands to move over them and operate on them.
<P>
<DL COMPACT>
<DT><KBD>C-x [</KBD>
<DD>Move point to previous page boundary (<CODE>backward-page</CODE>).
<DT><KBD>C-x ]</KBD>
<DD>Move point to next page boundary (<CODE>forward-page</CODE>).
<DT><KBD>C-x C-p</KBD>
<DD>Put point and mark around this page (or another page) (<CODE>mark-page</CODE>).
<DT><KBD>C-x l</KBD>
<DD>Count the lines in this page (<CODE>count-lines-page</CODE>).
</DL>
<A NAME="IDX762"></A>
<A NAME="IDX763"></A>
<A NAME="IDX764"></A>
<A NAME="IDX765"></A>
<P>
The <KBD>C-x [</KBD> (<CODE>backward-page</CODE>) command moves point to immediately
after the previous page delimiter. If point is already right after a page
delimiter, it skips that one and stops at the previous one. A numeric
argument serves as a repeat count. The <KBD>C-x ]</KBD> (<CODE>forward-page</CODE>)
command moves forward past the next page delimiter.
<A NAME="IDX766"></A>
<A NAME="IDX767"></A>
<P>
The <KBD>C-x C-p</KBD> command (<CODE>mark-page</CODE>) puts point at the beginning
of the current page and the mark at the end. The page delimiter at the end
is included (the mark follows it). The page delimiter at the front is
excluded (point follows it). This command can be followed by <KBD>C-w</KBD> to
kill a page which is to be moved elsewhere. If it is inserted after a page
delimiter, at a place where <KBD>C-x ]</KBD> or <KBD>C-x [</KBD> would take you, then
the page will be properly delimited before and after once again.
<P>
A numeric argument to <KBD>C-x C-p</KBD> is used to specify which page to go
to, relative to the current one. Zero means the current page. One means
the next page, and -1 means the previous one.
<A NAME="IDX768"></A>
<A NAME="IDX769"></A>
<P>
The <KBD>C-x l</KBD> command (<CODE>count-lines-page</CODE>) is good for deciding
where to break a page in two. It prints in the echo area the total number
of lines in the current page, and then divides it up into those preceding
the current line and those following, as in
<P>
<PRE>
Page has 96 (72+25) lines
</PRE>
<P>
Notice that the sum is off by one; this is correct if point is not at the
beginning of a line.
<A NAME="IDX770"></A>
<P>
The variable <CODE>page-delimiter</CODE> controls where pages begin. Its
value is a regexp that matches the beginning of a line that separates
pages. The normal value of this variable is <CODE>"^<TT>\</TT>f"</CODE>, which
matches a formfeed character at the beginning of a line.
<P>
<A NAME="IDX771"></A>
<H2><A NAME="SEC160" HREF="emacs_toc.html#SEC160">Filling Text</A></H2>
<P>
With Auto Fill mode, text can be <DFN>filled</DFN> (broken up into lines
that fit in a specified width) as you insert it. If you alter existing
text it may no longer be properly filled; then you can use the explicit
fill commands to fill the paragraph again.
<P>
<A NAME="IDX772"></A>
<A NAME="IDX773"></A>
<H3><A NAME="SEC161" HREF="emacs_toc.html#SEC161">Auto Fill Mode</A></H3>
<P>
<DFN>Auto Fill</DFN> mode is a minor mode in which lines are broken
automatically when they become too wide. Breaking happens only when
you type a <KBD>SPC</KBD> or <KBD>RET</KBD>.
<P>
<DL COMPACT>
<DT><KBD>M-x auto-fill-mode</KBD>
<DD>Enable or disable Auto Fill mode.
<DT><KBD><KBD>SPC</KBD></KBD>
<DD><DT><KBD><KBD>RET</KBD></KBD>
<DD>In Auto Fill mode, break lines when appropriate.
</DL>
<A NAME="IDX774"></A>
<P>
<KBD>M-x auto-fill-mode</KBD> turns Auto Fill mode on if it was off, or off if
it was on. With a positive numeric argument it always turns Auto Fill mode
on, and with a negative argument always turns it off. You can see when
Auto Fill mode is in effect by the presence of the word <SAMP>`Fill'</SAMP> in the
mode line, inside the parentheses. Auto Fill mode is a minor mode, turned
on or off for each buffer individually. See section <A HREF="emacs_35.html#SEC333">Minor Modes</A>.
<P>
In Auto Fill mode, lines are broken automatically at spaces when they get
longer than the desired width. Line breaking and rearrangement takes place
only when you type <KBD>SPC</KBD> or <KBD>RET</KBD>. If you wish to insert a space
or newline without permitting line-breaking, type <KBD>C-q <KBD>SPC</KBD></KBD> or
<KBD>C-q <KBD>LFD</KBD></KBD> (recall that a newline is really a linefeed). Also,
<KBD>C-o</KBD> inserts a newline without line breaking.
<P>
Auto Fill mode works well with Lisp mode, because when it makes a new
line in Lisp mode it indents that line with <KBD>TAB</KBD>. If a line ending in
a comment gets too long, the text of the comment is split into two
comment lines. Optionally new comment delimiters are inserted at the end of
the first line and the beginning of the second so that each line is
a separate comment; the variable <CODE>comment-multi-line</CODE> controls the
choice (see section <A HREF="emacs_26.html#SEC187">Manipulating Comments</A>).
<P>
Auto Fill mode does not refill entire paragraphs. It can break lines but
cannot merge lines. So editing in the middle of a paragraph can result in
a paragraph that is not correctly filled. The easiest way to make the
paragraph properly filled again is usually with the explicit fill commands.
<P>
Many users like Auto Fill mode and want to use it in all text files.
The section on init files says how to arrange this permanently for yourself.
See section <A HREF="emacs_35.html#SEC356">The Init File, <TT>`~/.emacs'</TT></A>.
<P>
<H3><A NAME="SEC162" HREF="emacs_toc.html#SEC162">Explicit Fill Commands</A></H3>
<P>
<DL COMPACT>
<DT><KBD>M-q</KBD>
<DD>Fill current paragraph (<CODE>fill-paragraph</CODE>).
<DT><KBD>C-x f</KBD>
<DD>Set the fill column (<CODE>set-fill-column</CODE>).
<DT><KBD>M-x fill-region</KBD>
<DD>Fill each paragraph in the region (<CODE>fill-region</CODE>).
<DT><KBD>M-x fill-region-as-paragraph.</KBD>
<DD>Fill the region, considering it as one paragraph.
<DT><KBD>M-s</KBD>
<DD>Center a line.
</DL>
<A NAME="IDX775"></A>
<A NAME="IDX776"></A>
<P>
To refill a paragraph, use the command <KBD>M-q</KBD>
(<CODE>fill-paragraph</CODE>). This operates on the paragraph that point is
inside, or the one after point if point is between paragraphs.
Refilling works by removing all the line-breaks, then inserting new ones
where necessary.
<A NAME="IDX777"></A>
<A NAME="IDX778"></A>
<A NAME="IDX779"></A>
<P>
The command <KBD>M-s</KBD> (<CODE>center-line</CODE>) centers the current line
within the current fill column. With an argument, it centers several lines
individually and moves past them.
<A NAME="IDX780"></A>
<P>
To refill many paragraphs, use <KBD>M-x fill-region</KBD>, which
divides the region into paragraphs and fills each of them.
<A NAME="IDX781"></A>
<P>
<KBD>M-q</KBD> and <CODE>fill-region</CODE> use the same criteria as <KBD>M-h</KBD>
for finding paragraph boundaries (see section <A HREF="emacs_25.html#SEC158">Paragraphs</A>). For more
control, you can use <KBD>M-x fill-region-as-paragraph</KBD>, which refills
everything between point and mark. This command deletes any blank lines
within the region, so separate blocks of text end up combined into one
block.<A NAME="IDX782"></A>
<P>
A numeric argument to <KBD>M-q</KBD> causes it to <DFN>justify</DFN> the text as
well as filling it. This means that extra spaces are inserted to make
the right margin line up exactly at the fill column. To remove the
extra spaces, use <KBD>M-q</KBD> with no argument. (Likewise for
<CODE>fill-region</CODE>.)
<A NAME="IDX783"></A>
<A NAME="IDX784"></A>
<P>
When <CODE>adaptive-fill-mode</CODE> is non-<CODE>nil</CODE> (which is normally
the case), if you use <CODE>fill-region-as-paragraph</CODE> on an indented
paragraph and you don't have a fill prefix, it uses the indentation of
the second line of the paragraph as the fill prefix. The effect of
adaptive filling is not noticeable in Text mode, because an indented
line counts as a paragraph starter and thus each line of an indented
paragraph is considered a paragraph of its own. But you do notice the
effect in Indented Text mode and some other major modes.
<A NAME="IDX785"></A>
<P>
The maximum line width for filling is in the variable <CODE>fill-column</CODE>.
Altering the value of <CODE>fill-column</CODE> makes it local to the current
buffer; until that time, the default value is in effect. The default is
initially 70. See section <A HREF="emacs_35.html#SEC338">Local Variables</A>.
<A NAME="IDX786"></A>
<A NAME="IDX787"></A>
<P>
The easiest way to set <CODE>fill-column</CODE> is to use the command <KBD>C-x
f</KBD> (<CODE>set-fill-column</CODE>). With no argument, it sets <CODE>fill-column</CODE>
to the current horizontal position of point. With a numeric argument, it
uses that as the new fill column.
<P>
<H3><A NAME="SEC163" HREF="emacs_toc.html#SEC163">The Fill Prefix</A></H3>
<A NAME="IDX788"></A>
<P>
To fill a paragraph in which each line starts with a special marker
(which might be a few spaces, giving an indented paragraph), use the
<DFN>fill prefix</DFN> feature. The fill prefix is a string which Emacs expects
every line to start with, and which is not included in filling.
<P>
<DL COMPACT>
<DT><KBD>C-x .</KBD>
<DD>Set the fill prefix (<CODE>set-fill-prefix</CODE>).
<DT><KBD>M-q</KBD>
<DD>Fill a paragraph using current fill prefix (<CODE>fill-paragraph</CODE>).
<DT><KBD>M-x fill-individual-paragraphs</KBD>
<DD>Fill the region, considering each change of indentation as starting a
new paragraph.
<DT><KBD>M-x fill-nonuniform-paragraphs</KBD>
<DD>Fill the region, considering only paragraph-separator lines as starting
a new paragraph.
</DL>
<A NAME="IDX789"></A>
<A NAME="IDX790"></A>
<P>
To specify a fill prefix, move to a line that starts with the desired
prefix, put point at the end of the prefix, and give the command
<KBD>C-x .</KBD> (<CODE>set-fill-prefix</CODE>). That's a period after the
<KBD>C-x</KBD>. To turn off the fill prefix, specify an empty prefix: type
<KBD>C-x .</KBD> with point at the beginning of a line.<P>
When a fill prefix is in effect, the fill commands remove the fill prefix
from each line before filling and insert it on each line after filling.
The fill prefix is also inserted on new lines made automatically by Auto
Fill mode. Lines that do not start with the fill prefix are considered to
start paragraphs, both in <KBD>M-q</KBD> and the paragraph commands; this is
just right if you are using paragraphs with hanging indentation (every line
indented except the first one). Lines which are blank or indented once the
prefix is removed also separate or start paragraphs; this is what you want
if you are writing multi-paragraph comments with a comment delimiter on
each line.
<P>
For example, if <CODE>fill-column</CODE> is 40 and you set the fill prefix
to <SAMP>`;; '</SAMP>, then <KBD>M-q</KBD> in the following text
<P>
<PRE>
;; This is an
;; example of a paragraph
;; inside a Lisp-style comment.
</PRE>
<P>
produces this:
<P>
<PRE>
;; This is an example of a paragraph
;; inside a Lisp-style comment.
</PRE>
<P>
The <KBD>C-o</KBD> command inserts the fill prefix on new lines it creates,
when you use it at the beginning of a line (see section <A HREF="emacs_8.html#SEC25">Blank Lines</A>).
Conversely, the command <KBD>M-^</KBD> deletes the prefix (if it occurs)
after the newline that it deletes (see section <A HREF="emacs_24.html#SEC151">Indentation</A>).
<A NAME="IDX791"></A>
<P>
You can use <KBD>M-x fill-individual-paragraphs</KBD> to set the fill
prefix for each paragraph automatically. This command divides the
region into paragraphs, treating every change in the amount of
indentation as the start of a new paragraph, and fills each of these
paragraphs. Thus, all the lines in one "paragraph" have the same
amount of indentation. That indentation serves as the fill prefix for
that paragraph.
<A NAME="IDX792"></A>
<P>
<KBD>M-x fill-nonuniform-paragraphs</KBD> is a similar command that divides
the region into paragraphs in a different way. It considers only
paragraph-separating lines (as defined by <CODE>paragraph-separate</CODE>) as
starting a new paragraph. Since this means that the lines of one
paragraph may have different amounts of indentation, the fill prefix
used is the smallest amount of indentation of any of the lines of the
paragraph.
<A NAME="IDX793"></A>
<P>
The fill prefix is stored in the variable <CODE>fill-prefix</CODE>. Its value
is a string, or <CODE>nil</CODE> when there is no fill prefix. This is a
per-buffer variable; altering the variable affects only the current buffer,
but there is a default value which you can change as well. See section <A HREF="emacs_35.html#SEC338">Local Variables</A>.
<P>
<A NAME="IDX794"></A>
<H2><A NAME="SEC164" HREF="emacs_toc.html#SEC164">Case Conversion Commands</A></H2>
<P>
Emacs has commands for converting either a single word or any arbitrary
range of text to upper case or to lower case.
<P>
<DL COMPACT>
<DT><KBD>M-l</KBD>
<DD>Convert following word to lower case (<CODE>downcase-word</CODE>).
<DT><KBD>M-u</KBD>
<DD>Convert following word to upper case (<CODE>upcase-word</CODE>).
<DT><KBD>M-c</KBD>
<DD>Capitalize the following word (<CODE>capitalize-word</CODE>).
<DT><KBD>C-x C-l</KBD>
<DD>Convert region to lower case (<CODE>downcase-region</CODE>).
<DT><KBD>C-x C-u</KBD>
<DD>Convert region to upper case (<CODE>upcase-region</CODE>).
</DL>
<A NAME="IDX795"></A>
<A NAME="IDX796"></A>
<A NAME="IDX797"></A>
<A NAME="IDX798"></A>
<A NAME="IDX799"></A>
<A NAME="IDX800"></A>
<A NAME="IDX801"></A>
<A NAME="IDX802"></A>
<A NAME="IDX803"></A>
<P>
The word conversion commands are the most useful. <KBD>M-l</KBD>
(<CODE>downcase-word</CODE>) converts the word after point to lower case, moving
past it. Thus, repeating <KBD>M-l</KBD> converts successive words.
<KBD>M-u</KBD> (<CODE>upcase-word</CODE>) converts to all capitals instead, while
<KBD>M-c</KBD> (<CODE>capitalize-word</CODE>) puts the first letter of the word
into upper case and the rest into lower case. All these commands convert
several words at once if given an argument. They are especially convenient
for converting a large amount of text from all upper case to mixed case,
because you can move through the text using <KBD>M-l</KBD>, <KBD>M-u</KBD> or
<KBD>M-c</KBD> on each word as appropriate, occasionally using <KBD>M-f</KBD> instead
to skip a word.
<P>
When given a negative argument, the word case conversion commands apply
to the appropriate number of words before point, but do not move point.
This is convenient when you have just typed a word in the wrong case: you
can give the case conversion command and continue typing.
<P>
If a word case conversion command is given in the middle of a word, it
applies only to the part of the word which follows point. This is just
like what <KBD>M-d</KBD> (<CODE>kill-word</CODE>) does. With a negative argument,
case conversion applies only to the part of the word before point.
<A NAME="IDX804"></A>
<A NAME="IDX805"></A>
<A NAME="IDX806"></A>
<A NAME="IDX807"></A>
<P>
The other case conversion commands are <KBD>C-x C-u</KBD>
(<CODE>upcase-region</CODE>) and <KBD>C-x C-l</KBD> (<CODE>downcase-region</CODE>), which
convert everything between point and mark to the specified case. Point and
mark do not move.
<P>
The region case conversion commands <CODE>upcase-region</CODE> and
<CODE>downcase-region</CODE> are normally disabled. This means that they ask
for confirmation if you try to use them. When you confirm, you may
enable the command, which means it will not ask for confirmation again.
See section <A HREF="emacs_35.html#SEC353">Disabling Commands</A>.
<P>
<A NAME="IDX808"></A>
<A NAME="IDX809"></A>
<A NAME="IDX810"></A>
<H2><A NAME="SEC165" HREF="emacs_toc.html#SEC165">Text Mode</A></H2>
<P>
When you edit files of text in a human language, it's more convenient
to use Text mode rather than Fundamental mode. Invoke <KBD>M-x
text-mode</KBD> to enter Text mode. In Text mode, <KBD>TAB</KBD> runs the
function <CODE>tab-to-tab-stop</CODE>, which allows you to use arbitrary tab
stops set with <KBD>M-x edit-tab-stops</KBD> (see section <A HREF="emacs_24.html#SEC153">Tab Stops</A>). Features
concerned with comments in programs are turned off except when
explicitly invoked. The syntax table is changed so that periods are not
considered part of a word, while apostrophes, backspaces and underlines
are.
<A NAME="IDX811"></A>
<A NAME="IDX812"></A>
<A NAME="IDX813"></A>
<A NAME="IDX814"></A>
<P>
A similar variant mode is Indented Text mode, intended for editing
text in which most lines are indented. This mode defines <KBD>TAB</KBD> to
run <CODE>indent-relative</CODE> (see section <A HREF="emacs_24.html#SEC151">Indentation</A>), and makes Auto Fill
indent the lines it creates. The result is that normally a line made by
Auto Filling, or by <KBD>LFD</KBD>, is indented just like the previous line.
In Indented Text mode, only blank lines separate paragraphs--indented
lines continue the current paragraph. Use <KBD>M-x indented-text-mode</KBD>
to select this mode.
<A NAME="IDX815"></A>
<P>
Text mode, and all the modes based on it, define <KBD>M-<KBD>TAB</KBD></KBD> as
the command <CODE>ispell-complete-word</CODE>, which performs completion of
the partial word in the buffer before point, using the spelling
dictionary as the space of possible words. See section <A HREF="emacs_18.html#SEC95">Checking and Correcting Spelling</A>.
<A NAME="IDX816"></A>
<P>
Entering Text mode or Indented Text mode runs the hook
<CODE>text-mode-hook</CODE>. Other major modes related to Text mode also run
this hook, followed by hooks of their own; this includes Nroff mode,
TeX mode, Outline mode and Mail mode. Hook functions on
<CODE>text-mode-hook</CODE> can look at the value of <CODE>major-mode</CODE> to see
which of these modes is actually being entered. See section <A HREF="emacs_35.html#SEC337">Hooks</A>.
<P>
<A NAME="IDX817"></A>
<A NAME="IDX818"></A>
<A NAME="IDX819"></A>
<A NAME="IDX820"></A>
<H2><A NAME="SEC166" HREF="emacs_toc.html#SEC166">Outline Mode</A></H2>
<A NAME="IDX821"></A>
<A NAME="IDX822"></A>
<P>
Outline mode is a major mode much like Text mode but intended for
editing outlines. It allows you to make parts of the text temporarily
invisible so that you can see just the overall structure of the
outline. Type <KBD>M-x outline-mode</KBD> to switch to Outline mode as the
major mode of the current buffer. Type <KBD>M-x outline-minor-mode</KBD>
to enable Outline mode as a minor mode in the current buffer.
When Outline minor mode is enabled, the <KBD>C-c</KBD> commands of Outline
mode replace those of the major mode.
<P>
When a line is invisible in outline mode, it does not appear on the
screen. The screen appears exactly as if the invisible line
were deleted, except that an ellipsis (three periods in a row) appears
at the end of the previous visible line (only one ellipsis no matter
how many invisible lines follow).
<P>
All editing commands treat the text of the invisible line as part of the
previous visible line. For example, <KBD>C-n</KBD> moves onto the next visible
line. Killing an entire visible line, including its terminating newline,
really kills all the following invisible lines along with it; yanking it
all back yanks the invisible lines and they remain invisible.
<A NAME="IDX823"></A>
<P>
Entering Outline mode runs the hook <CODE>text-mode-hook</CODE> followed by
the hook <CODE>outline-mode-hook</CODE> (see section <A HREF="emacs_35.html#SEC337">Hooks</A>).
<P>
<H3><A NAME="SEC167" HREF="emacs_toc.html#SEC167">Format of Outlines</A></H3>
<A NAME="IDX824"></A>
<A NAME="IDX825"></A>
<P>
Outline mode assumes that the lines in the buffer are of two types:
<DFN>heading lines</DFN> and <DFN>body lines</DFN>. A heading line represents a topic in the
outline. Heading lines start with one or more stars; the number of stars
determines the depth of the heading in the outline structure. Thus, a
heading line with one star is a major topic; all the heading lines with
two stars between it and the next one-star heading are its subtopics; and
so on. Any line that is not a heading line is a body line. Body lines
belong with the preceding heading line. Here is an example:
<P>
<PRE>
* Food
This is the body,
which says something about the topic of food.
** Delicious Food
This is the body of the second-level header.
** Distasteful Food
This could have
a body too, with
several lines.
*** Dormitory Food
* Shelter
A second first-level topic with its header line.
</PRE>
<P>
A heading line together with all following body lines is called
collectively an <DFN>entry</DFN>. A heading line together with all following
deeper heading lines and their body lines is called a <DFN>subtree</DFN>.
<A NAME="IDX826"></A>
<P>
You can customize the criterion for distinguishing heading lines
by setting the variable <CODE>outline-regexp</CODE>. Any line whose
beginning has a match for this regexp is considered a heading line.
Matches that start within a line (not at the beginning) do not count.
The length of the matching text determines the level of the heading;
longer matches make a more deeply nested level. Thus, for example,
if a text formatter has commands <SAMP>`@chapter'</SAMP>, <SAMP>`@section'</SAMP>
and <SAMP>`@subsection'</SAMP> to divide the document into chapters and
sections, you could make those lines count as heading lines by
setting <CODE>outline-regexp</CODE> to <SAMP>`"@chap\\|@\\(sub\\)*section"'</SAMP>.
Note the trick: the two words <SAMP>`chapter'</SAMP> and <SAMP>`section'</SAMP> are equally
long, but by defining the regexp to match only <SAMP>`chap'</SAMP> we ensure
that the length of the text matched on a chapter heading is shorter,
so that Outline mode will know that sections are contained in chapters.
This works as long as no other command starts with <SAMP>`@chap'</SAMP>.
<P>
Outline mode makes a line invisible by changing the newline before it
into an ASCII control-M (code 015). Most editing commands that work on
lines treat an invisible line as part of the previous line because,
strictly speaking, it <EM>is</EM> part of that line, since there is no longer a
newline in between. When you save the file in Outline mode, control-M
characters are saved as newlines, so the invisible lines become ordinary
lines in the file. But saving does not change the visibility status of a
line inside Emacs.
<P>
<H3><A NAME="SEC168" HREF="emacs_toc.html#SEC168">Outline Motion Commands</A></H3>
<P>
There are some special motion commands in Outline mode that move
backward and forward to heading lines.
<P>
<DL COMPACT>
<DT><KBD>C-c C-n</KBD>
<DD>Move point to the next visible heading line
(<CODE>outline-next-visible-heading</CODE>).
<DT><KBD>C-c C-p</KBD>
<DD>Move point to the previous visible heading line <BR>
(<CODE>outline-previous-visible-heading</CODE>).
<DT><KBD>C-c C-f</KBD>
<DD>Move point to the next visible heading line at the same level
as the one point is on (<CODE>outline-forward-same-level</CODE>).
<DT><KBD>C-c C-b</KBD>
<DD>Move point to the previous visible heading line at the same level
(<CODE>outline-backward-same-level</CODE>).
<DT><KBD>C-c C-u</KBD>
<DD>Move point up to a lower-level (more inclusive) visible heading line
(<CODE>outline-up-heading</CODE>).
</DL>
<A NAME="IDX827"></A>
<A NAME="IDX828"></A>
<A NAME="IDX829"></A>
<A NAME="IDX830"></A>
<P>
<KBD>C-c C-n</KBD> (<CODE>next-visible-heading</CODE>) moves down to the next
heading line. <KBD>C-c C-p</KBD> (<CODE>previous-visible-heading</CODE>) moves
similarly backward. Both accept numeric arguments as repeat counts. The
names emphasize that invisible headings are skipped, but this is not really
a special feature. All editing commands that look for lines ignore the
invisible lines automatically.<A NAME="IDX831"></A>
<A NAME="IDX832"></A>
<A NAME="IDX833"></A>
<A NAME="IDX834"></A>
<A NAME="IDX835"></A>
<A NAME="IDX836"></A>
<P>
More powerful motion commands understand the level structure of headings.
<KBD>C-c C-f</KBD> (<CODE>outline-forward-same-level</CODE>) and
<KBD>C-c C-b</KBD> (<CODE>outline-backward-same-level</CODE>) move from one
heading line to another visible heading at the same depth in
the outline. <KBD>C-c C-u</KBD> (<CODE>outline-up-heading</CODE>) moves
backward to another heading that is less deeply nested.
<P>
<H3><A NAME="SEC169" HREF="emacs_toc.html#SEC169">Outline Visibility Commands</A></H3>
<P>
The other special commands of outline mode are used to make lines visible
or invisible. Their names all start with <CODE>hide</CODE> or <CODE>show</CODE>.
Most of them fall into pairs of opposites. They are not undoable; instead,
you can undo right past them. Making lines visible or invisible is simply
not recorded by the undo mechanism.
<P>
<DL COMPACT>
<DT><KBD>M-x hide-body</KBD>
<DD>Make all body lines in the buffer invisible.
<DT><KBD>M-x show-all</KBD>
<DD>Make all lines in the buffer visible.
<DT><KBD>C-c C-h</KBD>
<DD>Make everything under this heading invisible, not including this
heading itself<BR> (<CODE>hide-subtree</CODE>).
<DT><KBD>C-c C-s</KBD>
<DD>Make everything under this heading visible, including body,
subheadings, and their bodies (<CODE>show-subtree</CODE>).
<DT><KBD>M-x hide-leaves</KBD>
<DD>Make the body of this heading line, and of all its subheadings,
invisible.
<DT><KBD>M-x show-branches</KBD>
<DD>Make all subheadings of this heading line, at all levels, visible.
<DT><KBD>C-c C-i</KBD>
<DD>Make immediate subheadings (one level down) of this heading line
visible (<CODE>show-children</CODE>).
<DT><KBD>M-x hide-entry</KBD>
<DD>Make this heading line's body invisible.
<DT><KBD>M-x show-entry</KBD>
<DD>Make this heading line's body visible.
</DL>
<A NAME="IDX837"></A>
<A NAME="IDX838"></A>
<P>
Two commands that are exact opposites are <KBD>M-x hide-entry</KBD> and
<KBD>M-x show-entry</KBD>. They are used with point on a heading line, and
apply only to the body lines of that heading. The subtopics and their
bodies are not affected.
<A NAME="IDX839"></A>
<A NAME="IDX840"></A>
<A NAME="IDX841"></A>
<A NAME="IDX842"></A>
<A NAME="IDX843"></A>
<P>
Two more powerful opposites are <KBD>C-c C-h</KBD> (<CODE>hide-subtree</CODE>) and
<KBD>C-c C-s</KBD> (<CODE>show-subtree</CODE>). Both expect to be used when point is
on a heading line, and both apply to all the lines of that heading's
<DFN>subtree</DFN>: its body, all its subheadings, both direct and indirect, and
all of their bodies. In other words, the subtree contains everything
following this heading line, up to and not including the next heading of
the same or higher rank.<A NAME="IDX844"></A>
<A NAME="IDX845"></A>
<P>
Intermediate between a visible subtree and an invisible one is having
all the subheadings visible but none of the body. There are two commands
for doing this, depending on whether you want to hide the bodies or
make the subheadings visible. They are <KBD>M-x hide-leaves</KBD> and
<KBD>M-x show-branches</KBD>.
<A NAME="IDX846"></A>
<A NAME="IDX847"></A>
<P>
A little weaker than <CODE>show-branches</CODE> is <KBD>C-c C-i</KBD>
(<CODE>show-children</CODE>). It makes just the direct subheadings
visible--those one level down. Deeper subheadings remain invisible, if
they were invisible.<A NAME="IDX848"></A>
<A NAME="IDX849"></A>
<P>
Two commands have a blanket effect on the whole file. <KBD>M-x hide-body</KBD>
makes all body lines invisible, so that you see just the outline structure.
<KBD>M-x show-all</KBD> makes all lines visible. These commands can be thought
of as a pair of opposites even though <KBD>M-x show-all</KBD> applies to more
than just body lines.
<P>
You can turn off the use of ellipses at the ends of visible lines by
setting <CODE>selective-display-ellipses</CODE> to <CODE>nil</CODE>. Then there is
no visible indication of the presence of invisible lines.
<P>
<A NAME="IDX850"></A>
<A NAME="IDX851"></A>
<A NAME="IDX852"></A>
<A NAME="IDX853"></A>
<A NAME="IDX854"></A>
<A NAME="IDX855"></A>
<A NAME="IDX856"></A>
<H2><A NAME="SEC170" HREF="emacs_toc.html#SEC170">TeX Mode</A></H2>
<P>
TeX is a powerful text formatter written by Donald Knuth; it is also
free, like GNU Emacs. LaTeX is a simplified input format for TeX,
implemented by TeX macros; it comes with TeX. SliTeX is a special
form of LaTeX.<P>
Emacs has a special TeX mode for editing TeX input files.
It provides facilities for checking the balance of delimiters and for
invoking TeX on all or part of the file.
<A NAME="IDX857"></A>
<P>
TeX mode has three variants, Plain TeX mode, LaTeX mode, and
SliTeX mode (these three distinct major modes differ only slightly).
They are designed for editing the three different formats. The command
<KBD>M-x tex-mode</KBD> looks at the contents of the buffer to determine
whether the contents appear to be either LaTeX input or SliTeX
input; it then selects the appropriate mode. If it can't tell which is
right (e.g., the buffer is empty), the variable <CODE>tex-default-mode</CODE>
controls which mode is used.
<P>
When <KBD>M-x tex-mode</KBD> does not guess right, you can use the commands
<KBD>M-x plain-tex-mode</KBD>, <KBD>M-x latex-mode</KBD>, and <KBD>M-x
slitex-mode</KBD> to select explicitly the particular variants of TeX
mode.
<P>
<H3><A NAME="SEC171" HREF="emacs_toc.html#SEC171">TeX Editing Commands</A></H3>
<P>
Here are the special commands provided in TeX mode for editing the
text of the file.
<P>
<DL COMPACT>
<DT><KBD>"</KBD>
<DD>Insert, according to context, either <SAMP>`"'</SAMP> or <SAMP>`"'</SAMP> or
<SAMP>`"'</SAMP> (<CODE>tex-insert-quote</CODE>).
<DT><KBD><KBD>LFD</KBD></KBD>
<DD>Insert a paragraph break (two newlines) and check the previous
paragraph for unbalanced braces or dollar signs
(<CODE>tex-terminate-paragraph</CODE>).
<DT><KBD>M-x validate-tex-region</KBD>
<DD>Check each paragraph in the region for unbalanced braces or dollar signs.
<DT><KBD>C-c {</KBD>
<DD>Insert <SAMP>`{}'</SAMP> and position point between them (<CODE>tex-insert-braces</CODE>).
<DT><KBD>C-c }</KBD>
<DD>Move forward past the next unmatched close brace (<CODE>up-list</CODE>).
</DL>
<A NAME="IDX858"></A>
<A NAME="IDX859"></A>
<P>
In TeX, the character <SAMP>`"'</SAMP> is not normally used; we use
<SAMP>`"'</SAMP> to start a quotation and <SAMP>`"'</SAMP> to end one. To make
editing easier under this formatting convention, TeX mode overrides
the normal meaning of the key <KBD>"</KBD> with a command that inserts a pair
of single-quotes or backquotes (<CODE>tex-insert-quote</CODE>). To be
precise, this command inserts <SAMP>`"'</SAMP> after whitespace or an open
brace, <SAMP>`"'</SAMP> after a backslash, and <SAMP>`"'</SAMP> after any other
character.
<P>
If you need the character <SAMP>`"'</SAMP> itself in unusual contexts, use
<KBD>C-q</KBD> to insert it. Also, <KBD>"</KBD> with a numeric argument always
inserts that number of <SAMP>`"'</SAMP> characters.
<P>
In TeX mode, <SAMP>`$'</SAMP> has a special syntax code which attempts to
understand the way TeX math mode delimiters match. When you insert a
<SAMP>`$'</SAMP> that is meant to exit math mode, the position of the matching
<SAMP>`$'</SAMP> that entered math mode is displayed for a second. This is the
same feature that displays the open brace that matches a close brace that
is inserted. However, there is no way to tell whether a <SAMP>`$'</SAMP> enters
math mode or leaves it; so when you insert a <SAMP>`$'</SAMP> that enters math
mode, the previous <SAMP>`$'</SAMP> position is shown as if it were a match, even
though they are actually unrelated.
<A NAME="IDX860"></A>
<A NAME="IDX861"></A>
<A NAME="IDX862"></A>
<A NAME="IDX863"></A>
<P>
TeX uses braces as delimiters that must match. Some users prefer
to keep braces balanced at all times, rather than inserting them
singly. Use <KBD>C-c {</KBD> (<CODE>tex-insert-braces</CODE>) to insert a pair of
braces. It leaves point between the two braces so you can insert the
text that belongs inside. Afterward, use the command <KBD>C-c }</KBD>
(<CODE>up-list</CODE>) to move forward past the close brace.
<A NAME="IDX864"></A>
<A NAME="IDX865"></A>
<A NAME="IDX866"></A>
<P>
There are two commands for checking the matching of braces. <KBD>LFD</KBD>
(<CODE>tex-terminate-paragraph</CODE>) checks the paragraph before point, and
inserts two newlines to start a new paragraph. It prints a message in the
echo area if any mismatch is found. <KBD>M-x validate-tex-region</KBD> checks
a region, paragraph by paragraph. When it finds a paragraph that
contains a mismatch, it displays point at the beginning of the paragraph
for a few seconds and pushes a mark at that spot. Scanning continues
until the whole buffer has been checked or until you type another key.
The positions of the last several paragraphs with mismatches can be
found in the mark ring (see section <A HREF="emacs_13.html#SEC52">The Mark Ring</A>).
<P>
Note that Emacs commands count square brackets and parentheses in
TeX mode, not just braces. This is not strictly correct for the
purpose of checking TeX syntax. However, parentheses and square
brackets are likely to be used in text as matching delimiters and it is
useful for the various motion commands and automatic match display to
work with them.
<P>
<H3><A NAME="SEC172" HREF="emacs_toc.html#SEC172">LaTeX Editing Commands</A></H3>
<P>
LaTeX mode provides a few extra features not applicable to plain
TeX.
<P>
<DL COMPACT>
<DT><KBD>C-c C-o</KBD>
<DD>Insert <SAMP>`\begin'</SAMP> and <SAMP>`\end'</SAMP> for LaTeX block and position
point on a line between them. (<CODE>tex-latex-block</CODE>).
<DT><KBD>C-c C-e</KBD>
<DD>Close the last unended block for LaTeX (<CODE>tex-close-latex-block</CODE>).
</DL>
<A NAME="IDX867"></A>
<A NAME="IDX868"></A>
<P>
In LaTeX input, <SAMP>`\begin'</SAMP> and <SAMP>`\end'</SAMP> commands are used to
group blocks of text. To insert a <SAMP>`\begin'</SAMP> and a matching
<SAMP>`\end'</SAMP> (on a new line following the <SAMP>`\begin'</SAMP>), use <KBD>C-c
C-o</KBD> (<CODE>tex-latex-block</CODE>). A blank line is inserted between the
two, and point is left there.<A NAME="IDX869"></A>
<P>
Emacs knows all of the standard LaTeX block names and will
permissively complete a partially entered block name
(see section <A HREF="emacs_10.html#SEC33">Completion</A>). You can add your own list of block names to those
known by Emacs with the variable <CODE>latex-block-names</CODE>. For example,
to add <SAMP>`theorem'</SAMP>, <SAMP>`corollary'</SAMP>, and <SAMP>`proof'</SAMP>, include the line
<P>
<PRE>
(setq latex-block-names '("theorem" "corollary" "proof"))
</PRE>
<P>
to your <TT>`.emacs'</TT> file.
<A NAME="IDX870"></A>
<A NAME="IDX871"></A>
<P>
In LaTeX input, <SAMP>`\begin'</SAMP> and <SAMP>`\end'</SAMP> commands must balance.
You can use <KBD>C-c C-e</KBD> (<CODE>tex-close-latex-block</CODE>) to insert
automatically a matching <SAMP>`\end'</SAMP> to match the last unmatched <SAMP>`\begin'</SAMP>.
The <SAMP>`\end'</SAMP> will be indented to match the corresponding <SAMP>`\begin'</SAMP>.
The <SAMP>`\end'</SAMP> will be followed by a newline if point is at the beginning
of a line.<P>
<H3><A NAME="SEC173" HREF="emacs_toc.html#SEC173">TeX Printing Commands</A></H3>
<P>
You can invoke TeX as an inferior of Emacs on either the entire
contents of the buffer or just a region at a time. Running TeX in
this way on just one chapter is a good way to see what your changes
look like without taking the time to format the entire file.
<P>
<DL COMPACT>
<DT><KBD>C-c C-r</KBD>
<DD>Invoke TeX on the current region, together with the buffer's header
(<CODE>tex-region</CODE>).
<DT><KBD>C-c C-b</KBD>
<DD>Invoke TeX on the entire current buffer (<CODE>tex-buffer</CODE>).
<DT><KBD>C-c TAB</KBD>
<DD>Invoke BibTeX on the current file (<CODE>tex-bibtex-file</CODE>).
<DT><KBD>C-c C-f</KBD>
<DD>Invoke TeX on the current file (<CODE>tex-file</CODE>).
<DT><KBD>C-c C-l</KBD>
<DD>Recenter the window showing output from the inferior TeX so that
the last line can be seen (<CODE>tex-recenter-output-buffer</CODE>).
<DT><KBD>C-c C-k</KBD>
<DD>Kill the TeX subprocess (<CODE>tex-kill-job</CODE>).
<DT><KBD>C-c C-p</KBD>
<DD>Print the output from the last <KBD>C-c C-r</KBD>, <KBD>C-c C-b</KBD>, or <KBD>C-c
C-f</KBD> command (<CODE>tex-print</CODE>).
<DT><KBD>C-c C-v</KBD>
<DD>Preview the output from the last <KBD>C-c C-r</KBD>, <KBD>C-c C-b</KBD>, or <KBD>C-c
C-f</KBD> command (<CODE>tex-view</CODE>).
<DT><KBD>C-c C-q</KBD>
<DD>Show the printer queue (<CODE>tex-show-print-queue</CODE>).
</DL>
<A NAME="IDX872"></A>
<A NAME="IDX873"></A>
<A NAME="IDX874"></A>
<A NAME="IDX875"></A>
<A NAME="IDX876"></A>
<A NAME="IDX877"></A>
<A NAME="IDX878"></A>
<A NAME="IDX879"></A>
<P>
You can pass the current buffer through an inferior TeX by means of
<KBD>C-c C-b</KBD> (<CODE>tex-buffer</CODE>). The formatted output appears in a
temporary; to print it, type <KBD>C-c C-p</KBD> (<CODE>tex-print</CODE>).
Afterward use <KBD>C-c C-q</KBD> (<CODE>tex-show-print-queue</CODE>) to view the
progress of your output towards being printed. If your terminal has the
ability to display TeX output files, you can preview the output on
the terminal with <KBD>C-c C-v</KBD> (<CODE>tex-view</CODE>).
<A NAME="IDX880"></A>
<A NAME="IDX881"></A>
<P>
You can specify the directory to use for running TeX by setting the
variable <CODE>tex-directory</CODE>. <CODE>"."</CODE> is the default value. If
your environment variable <CODE>TEXINPUTS</CODE> contains relative directory
names, or if your files contains <SAMP>`\input'</SAMP> commands with relative
file names, then <CODE>tex-directory</CODE> <EM>must</EM> be <CODE>"."</CODE> or you
will get the wrong results. Otherwise, it is safe to specify some other
directory, such as <TT>`/tmp'</TT>.
<A NAME="IDX882"></A>
<A NAME="IDX883"></A>
<A NAME="IDX884"></A>
<A NAME="IDX885"></A>
<A NAME="IDX886"></A>
<A NAME="IDX887"></A>
<P>
If you want to specify which shell commands are used in the inferior TeX,
you can do so by setting the values of the variables <CODE>tex-run-command</CODE>,
<CODE>latex-run-command</CODE>, <CODE>slitex-run-command</CODE>,
<CODE>tex-dvi-print-command</CODE>, <CODE>tex-dvi-view-command</CODE>, and
<CODE>tex-show-queue-command</CODE>. You <EM>must</EM> set the value of
<CODE>tex-dvi-view-command</CODE> for your particular terminal; this variable
has no default value. The other variables have default values that may
(or may not) be appropriate for your system.
<P>
Normally, the file name given to these commands comes at the end of
the command string; for example, <SAMP>`latex <VAR>filename</VAR>'</SAMP>. In some
cases, however, the file name needs to be embedded in the command; an
example is when you need to provide the file name as an argument to one
command whose output is piped to another. You can specify where to put
the file name with <SAMP>`*'</SAMP> in the command string. For example,
<P>
<PRE>
(setq tex-dvi-print-command "dvips -f * | lpr")
</PRE>
<A NAME="IDX888"></A>
<A NAME="IDX889"></A>
<A NAME="IDX890"></A>
<A NAME="IDX891"></A>
<P>
The terminal output from TeX, including any error messages, appears
in a buffer called <SAMP>`*tex-shell*'</SAMP>. If TeX gets an error, you can
switch to this buffer and feed it input (this works as in Shell mode;
see section <A HREF="emacs_34.html#SEC316">Interactive Inferior Shell</A>). Without switching to this buffer you can
scroll it so that its last line is visible by typing <KBD>C-c
C-l</KBD>.
<P>
Type <KBD>C-c C-k</KBD> (<CODE>tex-kill-job</CODE>) to kill the TeX process if
you see that its output is no longer useful. Using <KBD>C-c C-b</KBD> or
<KBD>C-c C-r</KBD> also kills any TeX process still running.<A NAME="IDX892"></A>
<A NAME="IDX893"></A>
<P>
You can also pass an arbitrary region through an inferior TeX by typing
<KBD>C-c C-r</KBD> (<CODE>tex-region</CODE>). This is tricky, however, because most files
of TeX input contain commands at the beginning to set parameters and
define macros, without which no later part of the file will format
correctly. To solve this problem, <KBD>C-c C-r</KBD> allows you to designate a
part of the file as containing essential commands; it is included before
the specified region as part of the input to TeX. The designated part
of the file is called the <DFN>header</DFN>.
<A NAME="IDX894"></A>
<P>
To indicate the bounds of the header in Plain TeX mode, you insert two
special strings in the file. Insert <SAMP>`%**start of header'</SAMP> before the
header, and <SAMP>`%**end of header'</SAMP> after it. Each string must appear
entirely on one line, but there may be other text on the line before or
after. The lines containing the two strings are included in the header.
If <SAMP>`%**start of header'</SAMP> does not appear within the first 100 lines of
the buffer, <KBD>C-c C-r</KBD> assumes that there is no header.
<P>
In LaTeX mode, the header begins with <SAMP>`\documentstyle'</SAMP> and ends
with <SAMP>`\begin{document}'</SAMP>. These are commands that LaTeX requires
you to use in any case, so nothing special needs to be done to identify the
header.
<A NAME="IDX895"></A>
<A NAME="IDX896"></A>
<P>
The commands (<CODE>tex-buffer</CODE>) and (<CODE>tex-region</CODE>) do all of their
work in a temporary directory, and do not have available any of the auxiliary
files needed by TeX for cross-references; these commands are generally
not suitable for running the final copy in which all of the cross-references
need to be correct. When you want the auxiliary files, use <KBD>C-c C-f</KBD>
(<CODE>tex-file</CODE>) which runs TeX on the current buffer's file, in that
file's directory. Before TeX runs, you will be asked about saving
any modified buffers. Generally, you need to use (<CODE>tex-file</CODE>)
twice to get cross-references correct.
<A NAME="IDX897"></A>
<A NAME="IDX898"></A>
<A NAME="IDX899"></A>
<P>
For LaTeX files, you can use BibTeX to process the auxiliary
file for the current buffer's file. BibTeX looks up bibliographic
citations in a data base and prepares the cited references for the
bibliography section. The command <KBD>C-c TAB</KBD>
(<CODE>tex-bibtex-file</CODE>) runs the shell command
(<CODE>tex-bibtex-command</CODE>) to produce a <SAMP>`.bbl'</SAMP> file for the
current buffer's file. Generally, you need to do <KBD>C-c C-f</KBD>
(<CODE>tex-file</CODE>) once to generate the <SAMP>`.aux'</SAMP> file, then do
<KBD>C-c TAB</KBD> (<CODE>tex-bibtex-file</CODE>), and then repeat <KBD>C-c C-f</KBD>
(<CODE>tex-file</CODE>) twice more to get the cross-references correct.
<A NAME="IDX900"></A>
<A NAME="IDX901"></A>
<A NAME="IDX902"></A>
<A NAME="IDX903"></A>
<A NAME="IDX904"></A>
<P>
Entering any kind of TeX mode runs the hooks <CODE>text-mode-hook</CODE>
and <CODE>tex-mode-hook</CODE>. Then it runs either
<CODE>plain-tex-mode-hook</CODE> or <CODE>latex-mode-hook</CODE>, whichever is
appropriate. For SliTeX files, it calls <CODE>slitex-mode-hook</CODE>.
Starting the TeX shell runs the hook <CODE>tex-shell-hook</CODE>.
See section <A HREF="emacs_35.html#SEC337">Hooks</A>.
<P>
<H3><A NAME="SEC174" HREF="emacs_toc.html#SEC174">Unix TeX Distribution</A></H3>
<P>
TeX for Unix systems can be obtained from the University of Washington
for a distribution fee.
<P>
To order a full distribution, send $200.00 for a 1/2-inch 9-track 1600
bpi (tar or cpio) tape reel, or $210.00 for a 1/4-inch 4-track QIC-24
(tar or cpio) cartridge, payable to the University of Washington to:
<P>
<PRE>
Northwest Computing Support Center
DR-10, Thomson Hall 35
University of Washington
Seattle, Washington 98195
</PRE>
<P>
Purchase orders are acceptable, but there is an extra charge of
$10.00, to pay for processing charges.
<P>
For overseas orders please add $20.00 to the base cost for shipment via
air parcel post, or $30.00 for shipment via courier.
<P>
The normal distribution is a tar tape, blocked 20, 1600 bpi, on an
industry standard 2400 foot half-inch reel. The physical format for
the 1/4 inch streamer cartridges uses QIC-11, 8000 bpi, 4-track
serpentine recording for the SUN. Also, System V tapes can be written
in cpio format, blocked 5120 bytes, ASCII headers.
<P>
<H2><A NAME="SEC175" HREF="emacs_toc.html#SEC175">Nroff Mode</A></H2>
<A NAME="IDX905"></A>
<A NAME="IDX906"></A>
<P>
Nroff mode is a mode like Text mode but modified to handle nroff commands
present in the text. Invoke <KBD>M-x nroff-mode</KBD> to enter this mode. It
differs from Text mode in only a few ways. All nroff command lines are
considered paragraph separators, so that filling will never garble the
nroff commands. Pages are separated by <SAMP>`.bp'</SAMP> commands. Comments
start with backslash-doublequote. Also, three special commands are
provided that are not in Text mode:
<A NAME="IDX907"></A>
<A NAME="IDX908"></A>
<A NAME="IDX909"></A>
<A NAME="IDX910"></A>
<A NAME="IDX911"></A>
<A NAME="IDX912"></A>
<P>
<DL COMPACT>
<DT><KBD>M-n</KBD>
<DD>Move to the beginning of the next line that isn't an nroff command
(<CODE>forward-text-line</CODE>). An argument is a repeat count.
<DT><KBD>M-p</KBD>
<DD>Like <KBD>M-n</KBD> but move up (<CODE>backward-text-line</CODE>).
<DT><KBD>M-?</KBD>
<DD>Prints in the echo area the number of text lines (lines that are not
nroff commands) in the region (<CODE>count-text-lines</CODE>).
</DL>
<A NAME="IDX913"></A>
<P>
The other feature of Nroff mode is that you can turn on Electric Nroff
mode. This is a minor mode that you can turn on or off with <KBD>M-x
electric-nroff-mode</KBD> (see section <A HREF="emacs_35.html#SEC333">Minor Modes</A>). When the mode is on, each
time you use <KBD>RET</KBD> to end a line that contains an nroff command that
opens a kind of grouping, the matching nroff command to close that
grouping is automatically inserted on the following line. For example,
if you are at the beginning of a line and type <KBD>. ( b <KBD>RET</KBD></KBD>,
this inserts the matching command <SAMP>`.)b'</SAMP> on a new line following
point.
<A NAME="IDX914"></A>
<P>
Entering Nroff mode runs the hook <CODE>text-mode-hook</CODE>, followed by
the hook <CODE>nroff-mode-hook</CODE> (see section <A HREF="emacs_35.html#SEC337">Hooks</A>).
<P>Go to the <A HREF="emacs_24.html">previous</A>, <A HREF="emacs_26.html">next</A> section.<P>
| alji2106/CS1300Terminal | doc/emacs/emacs_25.html | HTML | gpl-2.0 | 58,474 | [
30522,
1026,
999,
1011,
1011,
2023,
16129,
5371,
2038,
2042,
2580,
2011,
16060,
2072,
2475,
11039,
19968,
1015,
1012,
2676,
2013,
7861,
6305,
2015,
1012,
16060,
2072,
2006,
1017,
2233,
2807,
1011,
1011,
1028,
1026,
2516,
1028,
27004,
7861,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package Mojo::Base;
use strict;
use warnings;
use utf8;
use feature ();
# No imports because we get subclassed, a lot!
use Carp ();
# Only Perl 5.14+ requires it on demand
use IO::Handle ();
# Protect subclasses using AUTOLOAD
sub DESTROY { }
sub import {
my $class = shift;
return unless my $flag = shift;
# Base
if ($flag eq '-base') { $flag = $class }
# Strict
elsif ($flag eq '-strict') { $flag = undef }
# Module
elsif ((my $file = $flag) && !$flag->can('new')) {
$file =~ s!::|'!/!g;
require "$file.pm";
}
# ISA
if ($flag) {
my $caller = caller;
no strict 'refs';
push @{"${caller}::ISA"}, $flag;
*{"${caller}::has"} = sub { attr($caller, @_) };
}
# Mojo modules are strict!
$_->import for qw(strict warnings utf8);
feature->import(':5.10');
}
sub attr {
my ($self, $attrs, $default) = @_;
return unless (my $class = ref $self || $self) && $attrs;
Carp::croak 'Default has to be a code reference or constant value'
if ref $default && ref $default ne 'CODE';
for my $attr (@{ref $attrs eq 'ARRAY' ? $attrs : [$attrs]}) {
Carp::croak qq{Attribute "$attr" invalid} unless $attr =~ /^[a-zA-Z_]\w*$/;
# Header (check arguments)
my $code = "package $class;\nsub $attr {\n if (\@_ == 1) {\n";
# No default value (return value)
unless (defined $default) { $code .= " return \$_[0]{'$attr'};" }
# Default value
else {
# Return value
$code .= " return \$_[0]{'$attr'} if exists \$_[0]{'$attr'};\n";
# Return default value
$code .= " return \$_[0]{'$attr'} = ";
$code .= ref $default eq 'CODE' ? '$default->($_[0]);' : '$default;';
}
# Footer (store value and return invocant)
$code .= "\n }\n \$_[0]{'$attr'} = \$_[1];\n \$_[0];\n}";
warn "-- Attribute $attr in $class\n$code\n\n" if $ENV{MOJO_BASE_DEBUG};
Carp::croak "Mojo::Base error: $@" unless eval "$code;1";
}
}
sub new {
my $class = shift;
bless @_ ? @_ > 1 ? {@_} : {%{$_[0]}} : {}, ref $class || $class;
}
sub tap {
my ($self, $cb) = (shift, shift);
$_->$cb(@_) for $self;
return $self;
}
1;
=encoding utf8
=head1 NAME
Mojo::Base - Minimal base class for Mojo projects
=head1 SYNOPSIS
package Cat;
use Mojo::Base -base;
has name => 'Nyan';
has [qw(birds mice)] => 2;
package Tiger;
use Mojo::Base 'Cat';
has friend => sub { Cat->new };
has stripes => 42;
package main;
use Mojo::Base -strict;
my $mew = Cat->new(name => 'Longcat');
say $mew->mice;
say $mew->mice(3)->birds(4)->mice;
my $rawr = Tiger->new(stripes => 23, mice => 0);
say $rawr->tap(sub { $_->friend->name('Tacgnol') })->mice;
=head1 DESCRIPTION
L<Mojo::Base> is a simple base class for L<Mojo> projects.
# Automatically enables "strict", "warnings", "utf8" and Perl 5.10 features
use Mojo::Base -strict;
use Mojo::Base -base;
use Mojo::Base 'SomeBaseClass';
All three forms save a lot of typing.
# use Mojo::Base -strict;
use strict;
use warnings;
use utf8;
use feature ':5.10';
use IO::Handle ();
# use Mojo::Base -base;
use strict;
use warnings;
use utf8;
use feature ':5.10';
use IO::Handle ();
use Mojo::Base;
push @ISA, 'Mojo::Base';
sub has { Mojo::Base::attr(__PACKAGE__, @_) }
# use Mojo::Base 'SomeBaseClass';
use strict;
use warnings;
use utf8;
use feature ':5.10';
use IO::Handle ();
require SomeBaseClass;
push @ISA, 'SomeBaseClass';
use Mojo::Base;
sub has { Mojo::Base::attr(__PACKAGE__, @_) }
=head1 FUNCTIONS
L<Mojo::Base> implements the following functions, which can be imported with
the C<-base> flag or by setting a base class.
=head2 has
has 'name';
has [qw(name1 name2 name3)];
has name => 'foo';
has name => sub {...};
has [qw(name1 name2 name3)] => 'foo';
has [qw(name1 name2 name3)] => sub {...};
Create attributes for hash-based objects, just like the L</"attr"> method.
=head1 METHODS
L<Mojo::Base> implements the following methods.
=head2 attr
$object->attr('name');
SubClass->attr('name');
SubClass->attr([qw(name1 name2 name3)]);
SubClass->attr(name => 'foo');
SubClass->attr(name => sub {...});
SubClass->attr([qw(name1 name2 name3)] => 'foo');
SubClass->attr([qw(name1 name2 name3)] => sub {...});
Create attribute accessor for hash-based objects, an array reference can be
used to create more than one at a time. Pass an optional second argument to set
a default value, it should be a constant or a callback. The callback will be
executed at accessor read time if there's no set value. Accessors can be
chained, that means they return their invocant when they are called with an
argument.
=head2 new
my $object = SubClass->new;
my $object = SubClass->new(name => 'value');
my $object = SubClass->new({name => 'value'});
This base class provides a basic constructor for hash-based objects. You can
pass it either a hash or a hash reference with attribute values.
=head2 tap
$object = $object->tap(sub {...});
$object = $object->tap($method);
$object = $object->tap($method, @args);
K combinator, tap into a method chain to perform operations on an object within
the chain. The object will be the first argument passed to the callback and is
also available as C<$_>.
# Longer version
$object = $object->tap(sub { $_->$method(@args) });
# Inject side effects into a method chain
$object->foo('A')->tap(sub { say $_->foo })->foo('B');
=head1 DEBUGGING
You can set the C<MOJO_BASE_DEBUG> environment variable to get some advanced
diagnostics information printed to C<STDERR>.
MOJO_BASE_DEBUG=1
=head1 SEE ALSO
L<Mojolicious>, L<Mojolicious::Guides>, L<http://mojolicio.us>.
=cut
| smotti/delta_reporting | perl5/lib/perl5/Mojo/Base.pm | Perl | gpl-3.0 | 5,699 | [
30522,
7427,
28017,
1024,
1024,
2918,
1025,
2224,
9384,
1025,
2224,
16234,
1025,
2224,
21183,
2546,
2620,
1025,
2224,
3444,
1006,
1007,
1025,
1001,
2053,
17589,
2138,
2057,
2131,
4942,
26266,
2098,
1010,
1037,
2843,
999,
2224,
29267,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
local render2d = ... or _G.render2d
do
local X, Y, W, H = 0,0
function render2d.SetScissor(x, y, w, h)
X = x
Y = y
W = w or render.GetWidth()
H = h or render.GetHeight()
if not x then
X = 0
Y = 0
render.SetScissor()
else
x, y = render2d.ScreenToWorld(-x, -y)
render.SetScissor(-x, -y, w, h)
end
end
function render2d.GetScissor()
return X, Y, W, H
end
utility.MakePushPopFunction(render2d, "Scissor")
end
do
function render2d.SetStencilState(tbl)
if tbl.function_ then
end
end
--[[
local function stencil_pass(func, ref)
if func == "never" then
return false
end
if func == "equal" then
return pixel == ref
end
end
local stencil_pass = stencil_pass(func, ref)
local depth_pass = depth_pass()
if depth_pass and stencil_pass then
elseif not depth_pass and stencil_pass then
elseif not stencil_pass then
if op == "incr" then
pixel = pixel + ref
end
end
1: 000000000 -- clear
2: 000111110 -- draw stencil rect
2: 000112210 -- draw stencil rect
2: 000111110 -- draw stencil rect
]]
local i = 0
local X,Y,W,H
function render2d.PushStencilRect(x,y,w,h, i_override)
render.StencilFunction("never", 1)
render.StencilOperation("increase", "keep", "zero")
render2d.PushTexture()
render.SetColorMask(0,0,0,0)
render2d.DrawRect(x,y,w,h)
render.SetColorMask(1,1,1,1)
render2d.PopTexture()
render.StencilFunction("equal", i)
i = i + 1
X,Y,W,H = x,y,w,h
end
function render2d.PopStencilRect()
render.StencilFunction("never", 1)
render.StencilOperation("decrease", "keep", "zero")
render2d.PushTexture()
render.SetColorMask(0,0,0,0)
render2d.DrawRect(X,Y,W,H)
render.SetColorMask(1,1,1,1)
render2d.PopTexture()
if i >= 4 then i = 0 end
end
local i = 0
local X,Y,W,H
function render2d.PushStencilRect2(x,y,w,h, i_override)
render.StencilFunction("never", 1)
render.StencilOperation("increase", "keep", "zero")
render2d.PushTexture()
render2d.DrawRect(x,y,w,h)
render2d.PopTexture()
render.StencilFunction("equal", i)
i = i + 1
X,Y,W,H = x,y,w,h
end
function render2d.PopStencilRect2()
render.StencilFunction("never", 1)
render.StencilOperation("decrease", "keep", "zero")
render2d.PushTexture()
render2d.DrawRect(X,Y,W,H)
render2d.PopTexture()
if i >= 4 then i = 0 end
end
end
do
local X, Y, W, H
function render2d.EnableClipRect(x, y, w, h, i)
i = i or 1
render.SetStencil(true)
render.GetFrameBuffer():ClearStencil(0) -- out = 0
render.StencilOperation("keep", "replace", "replace")
-- if true then stencil = 33 return true end
render.StencilFunction("always", i)
-- on fail, keep zero value
-- on success replace it with 33
-- write to the stencil buffer
-- on fail is probably never reached
render2d.PushTexture()
render.SetColorMask(0,0,0,0)
render2d.DrawRect(x, y, w, h)
render.SetColorMask(1,1,1,1)
render2d.PopTexture()
-- if stencil == 33 then stencil = 33 return true else return false end
render.StencilFunction("equal", i)
X = x
Y = y
W = w
H = h
end
function render2d.GetClipRect()
return X or 0, Y or 0, W or render.GetWidth(), H or render.GetHeight()
end
function render2d.DisableClipRect()
render.SetStencil(false)
end
end | CapsAdmin/goluwa | framework/lua/libraries/graphics/render2d/stencil.lua | Lua | gpl-3.0 | 3,304 | [
30522,
2334,
17552,
2475,
2094,
1027,
1012,
1012,
1012,
2030,
1035,
1043,
1012,
17552,
2475,
2094,
2079,
2334,
1060,
1010,
1061,
1010,
1059,
1010,
1044,
1027,
1014,
1010,
1014,
3853,
17552,
2475,
2094,
1012,
4520,
22987,
21748,
1006,
1060,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*-------------------------------------------------------------------------
*
* wparser.c
* Standard interface to word parser
*
* Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
*
*
* IDENTIFICATION
* src/backend/tsearch/wparser.c
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include "funcapi.h"
#include "catalog/namespace.h"
#include "catalog/pg_type.h"
#include "commands/defrem.h"
#include "tsearch/ts_cache.h"
#include "tsearch/ts_utils.h"
#include "utils/builtins.h"
#include "utils/jsonapi.h"
#include "utils/varlena.h"
/******sql-level interface******/
typedef struct
{
int cur;
LexDescr *list;
} TSTokenTypeStorage;
/* state for ts_headline_json_* */
typedef struct HeadlineJsonState
{
HeadlineParsedText *prs;
TSConfigCacheEntry *cfg;
TSParserCacheEntry *prsobj;
TSQuery query;
List *prsoptions;
bool transformed;
} HeadlineJsonState;
static text *headline_json_value(void *_state, char *elem_value, int elem_len);
static void
tt_setup_firstcall(FuncCallContext *funcctx, Oid prsid)
{
TupleDesc tupdesc;
MemoryContext oldcontext;
TSTokenTypeStorage *st;
TSParserCacheEntry *prs = lookup_ts_parser_cache(prsid);
if (!OidIsValid(prs->lextypeOid))
elog(ERROR, "method lextype isn't defined for text search parser %u",
prsid);
oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
st = (TSTokenTypeStorage *) palloc(sizeof(TSTokenTypeStorage));
st->cur = 0;
/* lextype takes one dummy argument */
st->list = (LexDescr *) DatumGetPointer(OidFunctionCall1(prs->lextypeOid,
(Datum) 0));
funcctx->user_fctx = (void *) st;
tupdesc = CreateTemplateTupleDesc(3, false);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "tokid",
INT4OID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "alias",
TEXTOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 3, "description",
TEXTOID, -1, 0);
funcctx->attinmeta = TupleDescGetAttInMetadata(tupdesc);
MemoryContextSwitchTo(oldcontext);
}
static Datum
tt_process_call(FuncCallContext *funcctx)
{
TSTokenTypeStorage *st;
st = (TSTokenTypeStorage *) funcctx->user_fctx;
if (st->list && st->list[st->cur].lexid)
{
Datum result;
char *values[3];
char txtid[16];
HeapTuple tuple;
sprintf(txtid, "%d", st->list[st->cur].lexid);
values[0] = txtid;
values[1] = st->list[st->cur].alias;
values[2] = st->list[st->cur].descr;
tuple = BuildTupleFromCStrings(funcctx->attinmeta, values);
result = HeapTupleGetDatum(tuple);
pfree(values[1]);
pfree(values[2]);
st->cur++;
return result;
}
if (st->list)
pfree(st->list);
pfree(st);
return (Datum) 0;
}
Datum
ts_token_type_byid(PG_FUNCTION_ARGS)
{
FuncCallContext *funcctx;
Datum result;
if (SRF_IS_FIRSTCALL())
{
funcctx = SRF_FIRSTCALL_INIT();
tt_setup_firstcall(funcctx, PG_GETARG_OID(0));
}
funcctx = SRF_PERCALL_SETUP();
if ((result = tt_process_call(funcctx)) != (Datum) 0)
SRF_RETURN_NEXT(funcctx, result);
SRF_RETURN_DONE(funcctx);
}
Datum
ts_token_type_byname(PG_FUNCTION_ARGS)
{
FuncCallContext *funcctx;
Datum result;
if (SRF_IS_FIRSTCALL())
{
text *prsname = PG_GETARG_TEXT_PP(0);
Oid prsId;
funcctx = SRF_FIRSTCALL_INIT();
prsId = get_ts_parser_oid(textToQualifiedNameList(prsname), false);
tt_setup_firstcall(funcctx, prsId);
}
funcctx = SRF_PERCALL_SETUP();
if ((result = tt_process_call(funcctx)) != (Datum) 0)
SRF_RETURN_NEXT(funcctx, result);
SRF_RETURN_DONE(funcctx);
}
typedef struct
{
int type;
char *lexeme;
} LexemeEntry;
typedef struct
{
int cur;
int len;
LexemeEntry *list;
} PrsStorage;
static void
prs_setup_firstcall(FuncCallContext *funcctx, Oid prsid, text *txt)
{
TupleDesc tupdesc;
MemoryContext oldcontext;
PrsStorage *st;
TSParserCacheEntry *prs = lookup_ts_parser_cache(prsid);
char *lex = NULL;
int llen = 0,
type = 0;
void *prsdata;
oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
st = (PrsStorage *) palloc(sizeof(PrsStorage));
st->cur = 0;
st->len = 16;
st->list = (LexemeEntry *) palloc(sizeof(LexemeEntry) * st->len);
prsdata = (void *) DatumGetPointer(FunctionCall2(&prs->prsstart,
PointerGetDatum(VARDATA_ANY(txt)),
Int32GetDatum(VARSIZE_ANY_EXHDR(txt))));
while ((type = DatumGetInt32(FunctionCall3(&prs->prstoken,
PointerGetDatum(prsdata),
PointerGetDatum(&lex),
PointerGetDatum(&llen)))) != 0)
{
if (st->cur >= st->len)
{
st->len = 2 * st->len;
st->list = (LexemeEntry *) repalloc(st->list, sizeof(LexemeEntry) * st->len);
}
st->list[st->cur].lexeme = palloc(llen + 1);
memcpy(st->list[st->cur].lexeme, lex, llen);
st->list[st->cur].lexeme[llen] = '\0';
st->list[st->cur].type = type;
st->cur++;
}
FunctionCall1(&prs->prsend, PointerGetDatum(prsdata));
st->len = st->cur;
st->cur = 0;
funcctx->user_fctx = (void *) st;
tupdesc = CreateTemplateTupleDesc(2, false);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "tokid",
INT4OID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "token",
TEXTOID, -1, 0);
funcctx->attinmeta = TupleDescGetAttInMetadata(tupdesc);
MemoryContextSwitchTo(oldcontext);
}
static Datum
prs_process_call(FuncCallContext *funcctx)
{
PrsStorage *st;
st = (PrsStorage *) funcctx->user_fctx;
if (st->cur < st->len)
{
Datum result;
char *values[2];
char tid[16];
HeapTuple tuple;
values[0] = tid;
sprintf(tid, "%d", st->list[st->cur].type);
values[1] = st->list[st->cur].lexeme;
tuple = BuildTupleFromCStrings(funcctx->attinmeta, values);
result = HeapTupleGetDatum(tuple);
pfree(values[1]);
st->cur++;
return result;
}
else
{
if (st->list)
pfree(st->list);
pfree(st);
}
return (Datum) 0;
}
Datum
ts_parse_byid(PG_FUNCTION_ARGS)
{
FuncCallContext *funcctx;
Datum result;
if (SRF_IS_FIRSTCALL())
{
text *txt = PG_GETARG_TEXT_PP(1);
funcctx = SRF_FIRSTCALL_INIT();
prs_setup_firstcall(funcctx, PG_GETARG_OID(0), txt);
PG_FREE_IF_COPY(txt, 1);
}
funcctx = SRF_PERCALL_SETUP();
if ((result = prs_process_call(funcctx)) != (Datum) 0)
SRF_RETURN_NEXT(funcctx, result);
SRF_RETURN_DONE(funcctx);
}
Datum
ts_parse_byname(PG_FUNCTION_ARGS)
{
FuncCallContext *funcctx;
Datum result;
if (SRF_IS_FIRSTCALL())
{
text *prsname = PG_GETARG_TEXT_PP(0);
text *txt = PG_GETARG_TEXT_PP(1);
Oid prsId;
funcctx = SRF_FIRSTCALL_INIT();
prsId = get_ts_parser_oid(textToQualifiedNameList(prsname), false);
prs_setup_firstcall(funcctx, prsId, txt);
}
funcctx = SRF_PERCALL_SETUP();
if ((result = prs_process_call(funcctx)) != (Datum) 0)
SRF_RETURN_NEXT(funcctx, result);
SRF_RETURN_DONE(funcctx);
}
Datum
ts_headline_byid_opt(PG_FUNCTION_ARGS)
{
Oid tsconfig = PG_GETARG_OID(0);
text *in = PG_GETARG_TEXT_PP(1);
TSQuery query = PG_GETARG_TSQUERY(2);
text *opt = (PG_NARGS() > 3 && PG_GETARG_POINTER(3)) ? PG_GETARG_TEXT_PP(3) : NULL;
HeadlineParsedText prs;
List *prsoptions;
text *out;
TSConfigCacheEntry *cfg;
TSParserCacheEntry *prsobj;
cfg = lookup_ts_config_cache(tsconfig);
prsobj = lookup_ts_parser_cache(cfg->prsId);
if (!OidIsValid(prsobj->headlineOid))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("text search parser does not support headline creation")));
memset(&prs, 0, sizeof(HeadlineParsedText));
prs.lenwords = 32;
prs.words = (HeadlineWordEntry *) palloc(sizeof(HeadlineWordEntry) * prs.lenwords);
hlparsetext(cfg->cfgId, &prs, query,
VARDATA_ANY(in), VARSIZE_ANY_EXHDR(in));
if (opt)
prsoptions = deserialize_deflist(PointerGetDatum(opt));
else
prsoptions = NIL;
FunctionCall3(&(prsobj->prsheadline),
PointerGetDatum(&prs),
PointerGetDatum(prsoptions),
PointerGetDatum(query));
out = generateHeadline(&prs);
PG_FREE_IF_COPY(in, 1);
PG_FREE_IF_COPY(query, 2);
if (opt)
PG_FREE_IF_COPY(opt, 3);
pfree(prs.words);
pfree(prs.startsel);
pfree(prs.stopsel);
PG_RETURN_POINTER(out);
}
Datum
ts_headline_byid(PG_FUNCTION_ARGS)
{
PG_RETURN_DATUM(DirectFunctionCall3(ts_headline_byid_opt,
PG_GETARG_DATUM(0),
PG_GETARG_DATUM(1),
PG_GETARG_DATUM(2)));
}
Datum
ts_headline(PG_FUNCTION_ARGS)
{
PG_RETURN_DATUM(DirectFunctionCall3(ts_headline_byid_opt,
ObjectIdGetDatum(getTSCurrentConfig(true)),
PG_GETARG_DATUM(0),
PG_GETARG_DATUM(1)));
}
Datum
ts_headline_opt(PG_FUNCTION_ARGS)
{
PG_RETURN_DATUM(DirectFunctionCall4(ts_headline_byid_opt,
ObjectIdGetDatum(getTSCurrentConfig(true)),
PG_GETARG_DATUM(0),
PG_GETARG_DATUM(1),
PG_GETARG_DATUM(2)));
}
Datum
ts_headline_jsonb_byid_opt(PG_FUNCTION_ARGS)
{
Oid tsconfig = PG_GETARG_OID(0);
Jsonb *jb = PG_GETARG_JSONB_P(1);
TSQuery query = PG_GETARG_TSQUERY(2);
text *opt = (PG_NARGS() > 3 && PG_GETARG_POINTER(3)) ? PG_GETARG_TEXT_P(3) : NULL;
Jsonb *out;
JsonTransformStringValuesAction action = (JsonTransformStringValuesAction) headline_json_value;
HeadlineParsedText prs;
HeadlineJsonState *state = palloc0(sizeof(HeadlineJsonState));
memset(&prs, 0, sizeof(HeadlineParsedText));
prs.lenwords = 32;
prs.words = (HeadlineWordEntry *) palloc(sizeof(HeadlineWordEntry) * prs.lenwords);
state->prs = &prs;
state->cfg = lookup_ts_config_cache(tsconfig);
state->prsobj = lookup_ts_parser_cache(state->cfg->prsId);
state->query = query;
if (opt)
state->prsoptions = deserialize_deflist(PointerGetDatum(opt));
else
state->prsoptions = NIL;
if (!OidIsValid(state->prsobj->headlineOid))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("text search parser does not support headline creation")));
out = transform_jsonb_string_values(jb, state, action);
PG_FREE_IF_COPY(jb, 1);
PG_FREE_IF_COPY(query, 2);
if (opt)
PG_FREE_IF_COPY(opt, 3);
pfree(prs.words);
if (state->transformed)
{
pfree(prs.startsel);
pfree(prs.stopsel);
}
PG_RETURN_JSONB_P(out);
}
Datum
ts_headline_jsonb(PG_FUNCTION_ARGS)
{
PG_RETURN_DATUM(DirectFunctionCall3(ts_headline_jsonb_byid_opt,
ObjectIdGetDatum(getTSCurrentConfig(true)),
PG_GETARG_DATUM(0),
PG_GETARG_DATUM(1)));
}
Datum
ts_headline_jsonb_byid(PG_FUNCTION_ARGS)
{
PG_RETURN_DATUM(DirectFunctionCall3(ts_headline_jsonb_byid_opt,
PG_GETARG_DATUM(0),
PG_GETARG_DATUM(1),
PG_GETARG_DATUM(2)));
}
Datum
ts_headline_jsonb_opt(PG_FUNCTION_ARGS)
{
PG_RETURN_DATUM(DirectFunctionCall4(ts_headline_jsonb_byid_opt,
ObjectIdGetDatum(getTSCurrentConfig(true)),
PG_GETARG_DATUM(0),
PG_GETARG_DATUM(1),
PG_GETARG_DATUM(2)));
}
Datum
ts_headline_json_byid_opt(PG_FUNCTION_ARGS)
{
Oid tsconfig = PG_GETARG_OID(0);
text *json = PG_GETARG_TEXT_P(1);
TSQuery query = PG_GETARG_TSQUERY(2);
text *opt = (PG_NARGS() > 3 && PG_GETARG_POINTER(3)) ? PG_GETARG_TEXT_P(3) : NULL;
text *out;
JsonTransformStringValuesAction action = (JsonTransformStringValuesAction) headline_json_value;
HeadlineParsedText prs;
HeadlineJsonState *state = palloc0(sizeof(HeadlineJsonState));
memset(&prs, 0, sizeof(HeadlineParsedText));
prs.lenwords = 32;
prs.words = (HeadlineWordEntry *) palloc(sizeof(HeadlineWordEntry) * prs.lenwords);
state->prs = &prs;
state->cfg = lookup_ts_config_cache(tsconfig);
state->prsobj = lookup_ts_parser_cache(state->cfg->prsId);
state->query = query;
if (opt)
state->prsoptions = deserialize_deflist(PointerGetDatum(opt));
else
state->prsoptions = NIL;
if (!OidIsValid(state->prsobj->headlineOid))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("text search parser does not support headline creation")));
out = transform_json_string_values(json, state, action);
PG_FREE_IF_COPY(json, 1);
PG_FREE_IF_COPY(query, 2);
if (opt)
PG_FREE_IF_COPY(opt, 3);
pfree(prs.words);
if (state->transformed)
{
pfree(prs.startsel);
pfree(prs.stopsel);
}
PG_RETURN_TEXT_P(out);
}
Datum
ts_headline_json(PG_FUNCTION_ARGS)
{
PG_RETURN_DATUM(DirectFunctionCall3(ts_headline_json_byid_opt,
ObjectIdGetDatum(getTSCurrentConfig(true)),
PG_GETARG_DATUM(0),
PG_GETARG_DATUM(1)));
}
Datum
ts_headline_json_byid(PG_FUNCTION_ARGS)
{
PG_RETURN_DATUM(DirectFunctionCall3(ts_headline_json_byid_opt,
PG_GETARG_DATUM(0),
PG_GETARG_DATUM(1),
PG_GETARG_DATUM(2)));
}
Datum
ts_headline_json_opt(PG_FUNCTION_ARGS)
{
PG_RETURN_DATUM(DirectFunctionCall4(ts_headline_json_byid_opt,
ObjectIdGetDatum(getTSCurrentConfig(true)),
PG_GETARG_DATUM(0),
PG_GETARG_DATUM(1),
PG_GETARG_DATUM(2)));
}
/*
* Return headline in text from, generated from a json(b) element
*/
static text *
headline_json_value(void *_state, char *elem_value, int elem_len)
{
HeadlineJsonState *state = (HeadlineJsonState *) _state;
HeadlineParsedText *prs = state->prs;
TSConfigCacheEntry *cfg = state->cfg;
TSParserCacheEntry *prsobj = state->prsobj;
TSQuery query = state->query;
List *prsoptions = state->prsoptions;
prs->curwords = 0;
hlparsetext(cfg->cfgId, prs, query, elem_value, elem_len);
FunctionCall3(&(prsobj->prsheadline),
PointerGetDatum(prs),
PointerGetDatum(prsoptions),
PointerGetDatum(query));
state->transformed = true;
return generateHeadline(prs);
}
| robins/postgres | src/backend/tsearch/wparser.c | C | gpl-3.0 | 13,513 | [
30522,
1013,
1008,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//#############################################################################
//# #
//# Copyright (C) <2015> <IMS MAXIMS> #
//# #
//# This program is free software: you can redistribute it and/or modify #
//# it under the terms of the GNU Affero General Public License as #
//# published by the Free Software Foundation, either version 3 of the #
//# License, or (at your option) any later version. #
//# #
//# This program is distributed in the hope that it will be useful, #
//# but WITHOUT ANY WARRANTY; without even the implied warranty of #
//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
//# GNU Affero General Public License for more details. #
//# #
//# You should have received a copy of the GNU Affero General Public License #
//# along with this program. If not, see <http://www.gnu.org/licenses/>. #
//# #
//# IMS MAXIMS provides absolutely NO GUARANTEE OF THE CLINICAL SAFTEY of #
//# this program. Users of this software do so entirely at their own risk. #
//# IMS MAXIMS only ensures the Clinical Safety of unaltered run-time #
//# software that it builds, deploys and maintains. #
//# #
//#############################################################################
//#EOH
// This code was generated by Barbara Worwood using IMS Development Environment (version 1.80 build 5589.25814)
// Copyright (C) 1995-2015 IMS MAXIMS. All rights reserved.
// WARNING: DO NOT MODIFY the content of this file
package ims.core.vo.lookups;
import ims.framework.cn.data.TreeModel;
import ims.framework.cn.data.TreeNode;
import ims.vo.LookupInstanceCollection;
import ims.vo.LookupInstVo;
public class ProcedureEndoscopyTypeCollection extends LookupInstanceCollection implements ims.vo.ImsCloneable, TreeModel
{
private static final long serialVersionUID = 1L;
public void add(ProcedureEndoscopyType value)
{
super.add(value);
}
public int indexOf(ProcedureEndoscopyType instance)
{
return super.indexOf(instance);
}
public boolean contains(ProcedureEndoscopyType instance)
{
return indexOf(instance) >= 0;
}
public ProcedureEndoscopyType get(int index)
{
return (ProcedureEndoscopyType)super.getIndex(index);
}
public void remove(ProcedureEndoscopyType instance)
{
if(instance != null)
{
int index = indexOf(instance);
if(index >= 0)
remove(index);
}
}
public Object clone()
{
ProcedureEndoscopyTypeCollection newCol = new ProcedureEndoscopyTypeCollection();
ProcedureEndoscopyType item;
for (int i = 0; i < super.size(); i++)
{
item = this.get(i);
newCol.add(new ProcedureEndoscopyType(item.getID(), item.getText(), item.isActive(), item.getParent(), item.getImage(), item.getColor(), item.getOrder()));
}
for (int i = 0; i < newCol.size(); i++)
{
item = newCol.get(i);
if (item.getParent() != null)
{
int parentIndex = this.indexOf(item.getParent());
if(parentIndex >= 0)
item.setParent(newCol.get(parentIndex));
else
item.setParent((ProcedureEndoscopyType)item.getParent().clone());
}
}
return newCol;
}
public ProcedureEndoscopyType getInstance(int instanceId)
{
return (ProcedureEndoscopyType)super.getInstanceById(instanceId);
}
public TreeNode[] getRootNodes()
{
LookupInstVo[] roots = super.getRoots();
TreeNode[] nodes = new TreeNode[roots.length];
System.arraycopy(roots, 0, nodes, 0, roots.length);
return nodes;
}
public ProcedureEndoscopyType[] toArray()
{
ProcedureEndoscopyType[] arr = new ProcedureEndoscopyType[this.size()];
super.toArray(arr);
return arr;
}
public static ProcedureEndoscopyTypeCollection buildFromBeanCollection(java.util.Collection beans)
{
ProcedureEndoscopyTypeCollection coll = new ProcedureEndoscopyTypeCollection();
if(beans == null)
return coll;
java.util.Iterator iter = beans.iterator();
while(iter.hasNext())
{
coll.add(ProcedureEndoscopyType.buildLookup((ims.vo.LookupInstanceBean)iter.next()));
}
return coll;
}
public static ProcedureEndoscopyTypeCollection buildFromBeanCollection(ims.vo.LookupInstanceBean[] beans)
{
ProcedureEndoscopyTypeCollection coll = new ProcedureEndoscopyTypeCollection();
if(beans == null)
return coll;
for(int x = 0; x < beans.length; x++)
{
coll.add(ProcedureEndoscopyType.buildLookup(beans[x]));
}
return coll;
}
}
| FreudianNM/openMAXIMS | Source Library/openmaxims_workspace/ValueObjects/src/ims/core/vo/lookups/ProcedureEndoscopyTypeCollection.java | Java | agpl-3.0 | 5,052 | [
30522,
1013,
1013,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
1001,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
angular.module('gitphaser').controller('ProfileController', ProfileCtrl);
/**
* @ngdoc object
* @module gitphaser
* @name gitphaser.object:ProfileCtrl
* @description Exposes GitHub.me profile object or account object to the profile template.
* Governs the `/tab/profile` and `others/:username` routes.
*/
function ProfileCtrl ($scope, $stateParams, $state, $cordovaInAppBrowser, GitHub, account) {
var self = this;
self.browser = $cordovaInAppBrowser;
/**
* @ngdoc object
* @propertyOf gitphaser.object:ProfileCtrl
* @name gitphaser..object:ProfileCtrl.modalOpen
* @description `Boolean`: Triggers appearance changes in the template when
* a contact modal opens. See 'contact' directive.
*/
self.modalOpen = false;
// Arbitrary profile
if (account) {
self.user = account.info;
self.repos = account.repos;
self.events = account.events;
self.viewTitle = account.info.login;
self.state = $state;
self.nav = true;
self.canFollow = GitHub.canFollow(account.info.login);
// The user's own profile
} else {
self.user = GitHub.me;
self.repos = GitHub.repos;
self.events = GitHub.events;
self.viewTitle = GitHub.me.login;
self.canFollow = false;
self.nav = false;
}
// Info logic: There are four optional profile fields
// and two spaces to show them in. In order of importance:
// 1. Company, 2. Blog, 3. Email, 4. Location
self.company = self.user.company;
self.email = self.user.email;
self.blog = self.user.blog;
self.location = self.user.location;
// Case: both exist - no space
if (self.company && self.email) {
self.blog = false;
self.location = false;
// Case: One exists - one space, pick blog, or location
} else if ((!self.company && self.email) || (self.company && !self.email)) {
(self.blog) ? self.location = false : true;
}
/**
* @ngdoc method
* @methodOf gitphaser.object:ProfileCtrl
* @name gitphaser.object:ProfileCtrl.back
* @description Navigates back to `$stateParams.origin`. For nav back arrow visible in the `others`
* route.
*/
self.back = function () {
if ($stateParams.origin === 'nearby') $state.go('tab.nearby');
if ($stateParams.origin === 'notifications') $state.go('tab.notifications');
};
/**
* @ngdoc method
* @methodOf gitphaser.object:ProfileCtrl
* @name gitphaser.object:ProfileCtrl.follow
* @description Wraps `GitHub.follow` and hides the follow button when clicked.
*/
self.follow = function () {
self.canFollow = false;
GitHub.follow(self.user);
};
}
| git-phaser/git-phaser | www/js/Controllers/profile.js | JavaScript | mit | 2,628 | [
30522,
16108,
1012,
11336,
1006,
1005,
21025,
25856,
14949,
2121,
1005,
1007,
1012,
11486,
1006,
1005,
6337,
8663,
13181,
10820,
1005,
1010,
6337,
6593,
12190,
1007,
1025,
1013,
1008,
1008,
1008,
1030,
12835,
3527,
2278,
4874,
1008,
1030,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# return_codes.py
#
# Copyright (C) 2018 Kano Computing Ltd.
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2
#
# Return codes of binaries used throughout this project.
class RC(object):
"""Return codes of binaries used throughout this project. See ``source``
for more details."""
SUCCESS = 0
INCORRECT_ARGS = 1
NO_INTERNET = 2
NO_KANO_WORLD_ACC = 3
CANNOT_CREATE_FLAG = 4 # read-only fs?
# kano-feedback-cli specific.
ERROR_SEND_DATA = 10
ERROR_COPY_ARCHIVE = 11
ERROR_CREATE_FLAG = 12
| KanoComputing/kano-feedback | kano_feedback/return_codes.py | Python | gpl-2.0 | 550 | [
30522,
1001,
2709,
1035,
9537,
1012,
1052,
2100,
1001,
1001,
9385,
1006,
1039,
1007,
2760,
22827,
2080,
9798,
5183,
1012,
1001,
6105,
1024,
8299,
1024,
1013,
1013,
7479,
1012,
27004,
1012,
8917,
1013,
15943,
1013,
14246,
2140,
1011,
1016,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#include <xfc/main.hh>
#include <xfc/gtk/checkbutton.hh>
#include <xfc/gtk/label.hh>
#include <xfc/gtk/spinbutton.hh>
#include <xfc/gtk/window.hh>
using namespace Xfc;
class SpinButtonWindow : public Gtk::Window
{
Gtk::SpinButton *spinner1;
Gtk::Label *val_label;
protected:
void on_change_digits(Gtk::SpinButton *spin);
void on_toggle_snap(Gtk::CheckButton *button);
void on_toggle_numeric(Gtk::CheckButton *button);
void on_get_value(bool value_as_int);
public:
SpinButtonWindow();
virtual ~SpinButtonWindow();
};
| interval1066/XFC | examples/howto/spinbutton/spinbutton.hh | C++ | lgpl-2.1 | 529 | [
30522,
1001,
2421,
1026,
1060,
11329,
1013,
2364,
1012,
1044,
2232,
1028,
1001,
2421,
1026,
1060,
11329,
1013,
14181,
2243,
1013,
4638,
8569,
15474,
1012,
1044,
2232,
1028,
1001,
2421,
1026,
1060,
11329,
1013,
14181,
2243,
1013,
3830,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
This file is part of the Grantlee template system.
Copyright (c) 2008 Stephen Kelly <steveire@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either version
2.1 of the Licence, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "texthtmlbuilder.h"
#include <QtCore/QList>
#include <QtGui/QTextDocument>
namespace Grantlee
{
class TextHTMLBuilderPrivate
{
public:
TextHTMLBuilderPrivate( TextHTMLBuilder *b )
: q_ptr( b )
{
}
QList<QTextListFormat::Style> currentListItemStyles;
QString m_text;
TextHTMLBuilder *q_ptr;
Q_DECLARE_PUBLIC( TextHTMLBuilder )
};
}
using namespace Grantlee;
TextHTMLBuilder::TextHTMLBuilder()
: AbstractMarkupBuilder(), d_ptr( new TextHTMLBuilderPrivate( this ) )
{
}
TextHTMLBuilder::~TextHTMLBuilder()
{
delete d_ptr;
}
void TextHTMLBuilder::beginStrong()
{
Q_D( TextHTMLBuilder );;
d->m_text.append( QStringLiteral( "<strong>" ) );
}
void TextHTMLBuilder::endStrong()
{
Q_D( TextHTMLBuilder );
d->m_text.append( QStringLiteral( "</strong>" ) );
}
void TextHTMLBuilder::beginEmph()
{
Q_D( TextHTMLBuilder );
d->m_text.append( QStringLiteral( "<em>" ) );
}
void TextHTMLBuilder::endEmph()
{
Q_D( TextHTMLBuilder );
d->m_text.append( QStringLiteral( "</em>" ) );
}
void TextHTMLBuilder::beginUnderline()
{
Q_D( TextHTMLBuilder );
d->m_text.append( QStringLiteral( "<u>" ) );
}
void TextHTMLBuilder::endUnderline()
{
Q_D( TextHTMLBuilder );
d->m_text.append( QStringLiteral( "</u>" ) );
}
void TextHTMLBuilder::beginStrikeout()
{
Q_D( TextHTMLBuilder );
d->m_text.append( QStringLiteral( "<s>" ) );
}
void TextHTMLBuilder::endStrikeout()
{
Q_D( TextHTMLBuilder );
d->m_text.append( QStringLiteral( "</s>" ) );
}
void TextHTMLBuilder::beginForeground( const QBrush &brush )
{
Q_D( TextHTMLBuilder );
d->m_text.append( QString::fromLatin1( "<span style=\"color:%1;\">" ).arg( brush.color().name() ) );
}
void TextHTMLBuilder::endForeground()
{
Q_D( TextHTMLBuilder );
d->m_text.append( QStringLiteral( "</span>" ) );
}
void TextHTMLBuilder::beginBackground( const QBrush &brush )
{
Q_D( TextHTMLBuilder );
d->m_text.append( QString::fromLatin1( "<span style=\"background-color:%1;\">" ).arg( brush.color().name() ) );
}
void TextHTMLBuilder::endBackground()
{
Q_D( TextHTMLBuilder );
d->m_text.append( QStringLiteral( "</span>" ) );
}
void TextHTMLBuilder::beginAnchor( const QString &href, const QString &name )
{
Q_D( TextHTMLBuilder );
if ( !href.isEmpty() ) {
if ( !name.isEmpty() ) {
d->m_text.append( QString::fromLatin1( "<a href=\"%1\" name=\"%2\">" ).arg( href ).arg( name ) );
} else {
d->m_text.append( QString::fromLatin1( "<a href=\"%1\">" ).arg( href ) );
}
} else {
if ( !name.isEmpty() ) {
d->m_text.append( QString::fromLatin1( "<a name=\"%1\">" ).arg( name ) );
}
}
}
void TextHTMLBuilder::endAnchor()
{
Q_D( TextHTMLBuilder );
d->m_text.append( QStringLiteral( "</a>" ) );
}
void TextHTMLBuilder::beginFontFamily( const QString &family )
{
Q_D( TextHTMLBuilder );
d->m_text.append( QString::fromLatin1( "<span style=\"font-family:%1;\">" ).arg( family ) );
}
void TextHTMLBuilder::endFontFamily()
{
Q_D( TextHTMLBuilder );
d->m_text.append( QStringLiteral( "</span>" ) );
}
void TextHTMLBuilder::beginFontPointSize( int size )
{
Q_D( TextHTMLBuilder );
d->m_text.append( QString::fromLatin1( "<span style=\"font-size:%1pt;\">" ).arg( QString::number( size ) ) );
}
void TextHTMLBuilder::endFontPointSize()
{
Q_D( TextHTMLBuilder );
d->m_text.append( QStringLiteral( "</span>" ) );
}
void TextHTMLBuilder::beginParagraph( Qt::Alignment al, qreal topMargin, qreal bottomMargin, qreal leftMargin, qreal rightMargin )
{
Q_D( TextHTMLBuilder );
// Don't put paragraph tags inside li tags. Qt bug reported.
// if (currentListItemStyles.size() != 0)
// {
QString styleString;
if ( topMargin != 0 ) {
styleString.append( QString::fromLatin1( "margin-top:%1;" ).arg( topMargin ) );
}
if ( bottomMargin != 0 ) {
styleString.append( QString::fromLatin1( "margin-bottom:%1;" ).arg( bottomMargin ) );
}
if ( leftMargin != 0 ) {
styleString.append( QString::fromLatin1( "margin-left:%1;" ).arg( leftMargin ) );
}
if ( rightMargin != 0 ) {
styleString.append( QString::fromLatin1( "margin-right:%1;" ).arg( rightMargin ) );
}
// Using == doesn't work here.
// Using bitwise comparison because an alignment can contain a vertical and a horizontal part.
if ( al & Qt::AlignRight ) {
d->m_text.append( QStringLiteral( "<p align=\"right\" " ) );
} else if ( al & Qt::AlignHCenter ) {
d->m_text.append( QStringLiteral( "<p align=\"center\" " ) );
} else if ( al & Qt::AlignJustify ) {
d->m_text.append( QStringLiteral( "<p align=\"justify\" " ) );
} else if ( al & Qt::AlignLeft ) {
d->m_text.append( QStringLiteral( "<p" ) );
} else {
d->m_text.append( QStringLiteral( "<p" ) );
}
if ( !styleString.isEmpty() ) {
d->m_text.append( QStringLiteral( " \"" ) + styleString + QLatin1Char( '"' ) );
}
d->m_text.append( QLatin1Char( '>' ) );
// }
}
void TextHTMLBuilder::beginHeader( int level )
{
Q_D( TextHTMLBuilder );
switch ( level ) {
case 1:
d->m_text.append( QStringLiteral( "<h1>" ) );
break;
case 2:
d->m_text.append( QStringLiteral( "<h2>" ) );
break;
case 3:
d->m_text.append( QStringLiteral( "<h3>" ) );
break;
case 4:
d->m_text.append( QStringLiteral( "<h4>" ) );
break;
case 5:
d->m_text.append( QStringLiteral( "<h5>" ) );
break;
case 6:
d->m_text.append( QStringLiteral( "<h6>" ) );
break;
default:
break;
}
}
void TextHTMLBuilder::endHeader( int level )
{
Q_D( TextHTMLBuilder );
switch ( level ) {
case 1:
d->m_text.append( QStringLiteral( "</h1>" ) );
break;
case 2:
d->m_text.append( QStringLiteral( "</h2>" ) );
break;
case 3:
d->m_text.append( QStringLiteral( "</h3>" ) );
break;
case 4:
d->m_text.append( QStringLiteral( "</h4>" ) );
break;
case 5:
d->m_text.append( QStringLiteral( "</h5>" ) );
break;
case 6:
d->m_text.append( QStringLiteral( "</h6>" ) );
break;
default:
break;
}
}
void TextHTMLBuilder::endParagraph()
{
Q_D( TextHTMLBuilder );
d->m_text.append( QStringLiteral( "</p>\n" ) );
}
void TextHTMLBuilder::addNewline()
{
Q_D( TextHTMLBuilder );
d->m_text.append( QStringLiteral( "<p> " ) );
}
void TextHTMLBuilder::insertHorizontalRule( int width )
{
Q_D( TextHTMLBuilder );
if ( width != -1 ) {
d->m_text.append( QString::fromLatin1( "<hr width=\"%1\" />\n" ).arg( width ) );
}
d->m_text.append( QStringLiteral( "<hr />\n" ) );
}
void TextHTMLBuilder::insertImage( const QString &src, qreal width, qreal height )
{
Q_D( TextHTMLBuilder );
d->m_text.append( QString::fromLatin1( "<img src=\"%1\" " ).arg( src ) );
if ( width != 0 ) d->m_text.append( QString::fromLatin1( "width=\"%2\" " ).arg( width ) );
if ( height != 0 ) d->m_text.append( QString::fromLatin1( "height=\"%2\" " ).arg( height ) );
d->m_text.append( QStringLiteral( "/>" ) );
}
void TextHTMLBuilder::beginList( QTextListFormat::Style type )
{
Q_D( TextHTMLBuilder );
d->currentListItemStyles.append( type );
switch ( type ) {
case QTextListFormat::ListDisc:
d->m_text.append( QStringLiteral( "<ul type=\"disc\">\n" ) );
break;
case QTextListFormat::ListCircle:
d->m_text.append( QStringLiteral( "\n<ul type=\"circle\">\n" ) );
break;
case QTextListFormat::ListSquare:
d->m_text.append( QStringLiteral( "\n<ul type=\"square\">\n" ) );
break;
case QTextListFormat::ListDecimal:
d->m_text.append( QStringLiteral( "\n<ol type=\"1\">\n" ) );
break;
case QTextListFormat::ListLowerAlpha:
d->m_text.append( QStringLiteral( "\n<ol type=\"a\">\n" ) );
break;
case QTextListFormat::ListUpperAlpha:
d->m_text.append( QStringLiteral( "\n<ol type=\"A\">\n" ) );
break;
case QTextListFormat::ListLowerRoman:
d->m_text.append( QStringLiteral("\n<ol type=\"i\">\n") );
break;
case QTextListFormat::ListUpperRoman:
d->m_text.append( QStringLiteral("\n<ol type=\"I\">\n") );
break;
default:
break;
}
}
void TextHTMLBuilder::endList()
{
Q_D( TextHTMLBuilder );
switch ( d->currentListItemStyles.last() ) {
case QTextListFormat::ListDisc:
case QTextListFormat::ListCircle:
case QTextListFormat::ListSquare:
d->m_text.append( QStringLiteral( "</ul>\n" ) );
break;
case QTextListFormat::ListDecimal:
case QTextListFormat::ListLowerAlpha:
case QTextListFormat::ListUpperAlpha:
case QTextListFormat::ListLowerRoman:
case QTextListFormat::ListUpperRoman:
d->m_text.append( QStringLiteral( "</ol>\n" ) );
break;
default:
break;
}
d->currentListItemStyles.removeLast();
}
void TextHTMLBuilder::beginListItem()
{
Q_D( TextHTMLBuilder );
d->m_text.append( QStringLiteral( "<li>" ) );
}
void TextHTMLBuilder::endListItem()
{
Q_D( TextHTMLBuilder );
d->m_text.append( QStringLiteral( "</li>\n" ) );
}
void TextHTMLBuilder::beginSuperscript()
{
Q_D( TextHTMLBuilder );
d->m_text.append( QStringLiteral( "<sup>" ) );
}
void TextHTMLBuilder::endSuperscript()
{
Q_D( TextHTMLBuilder );
d->m_text.append( QStringLiteral( "</sup>" ) );
}
void TextHTMLBuilder::beginSubscript()
{
Q_D( TextHTMLBuilder );
d->m_text.append( QStringLiteral( "<sub>" ) );
}
void TextHTMLBuilder::endSubscript()
{
Q_D( TextHTMLBuilder );
d->m_text.append( QStringLiteral( "</sub>" ) );
}
void TextHTMLBuilder::beginTable( qreal cellpadding, qreal cellspacing, const QString &width )
{
Q_D( TextHTMLBuilder );
d->m_text.append( QString::fromLatin1( "<table cellpadding=\"%1\" cellspacing=\"%2\" width=\"%3\" border=\"1\">" )
.arg( cellpadding )
.arg( cellspacing )
.arg( width ) );
}
void TextHTMLBuilder::beginTableRow()
{
Q_D( TextHTMLBuilder );
d->m_text.append( QStringLiteral( "<tr>" ) );
}
void TextHTMLBuilder::beginTableHeaderCell( const QString &width, int colspan, int rowspan )
{
Q_D( TextHTMLBuilder );
d->m_text.append( QString::fromLatin1( "<th width=\"%1\" colspan=\"%2\" rowspan=\"%3\">" ).arg( width ).arg( colspan ).arg( rowspan ) );
}
void TextHTMLBuilder::beginTableCell( const QString &width, int colspan, int rowspan )
{
Q_D( TextHTMLBuilder );
d->m_text.append( QString::fromLatin1( "<td width=\"%1\" colspan=\"%2\" rowspan=\"%3\">" ).arg( width ).arg( colspan ).arg( rowspan ) );
}
void TextHTMLBuilder::endTable()
{
Q_D( TextHTMLBuilder );
d->m_text.append( QStringLiteral( "</table>" ) );
}
void TextHTMLBuilder::endTableRow()
{
Q_D( TextHTMLBuilder );
d->m_text.append( QStringLiteral( "</tr>" ) );
}
void TextHTMLBuilder::endTableHeaderCell()
{
Q_D( TextHTMLBuilder );
d->m_text.append( QStringLiteral( "</th>" ) );
}
void TextHTMLBuilder::endTableCell()
{
Q_D( TextHTMLBuilder );
d->m_text.append( QStringLiteral( "</td>" ) );
}
void TextHTMLBuilder::appendLiteralText( const QString &text )
{
Q_D( TextHTMLBuilder );
d->m_text.append( text.toHtmlEscaped() );
}
void TextHTMLBuilder::appendRawText( const QString &text )
{
Q_D( TextHTMLBuilder );
d->m_text.append( text );
}
QString TextHTMLBuilder::getResult()
{
Q_D( TextHTMLBuilder );
QString ret = d->m_text;
d->m_text.clear();
return ret;
}
| cutelyst/grantlee | textdocument/lib/texthtmlbuilder.cpp | C++ | lgpl-2.1 | 11,981 | [
30522,
1013,
1008,
2023,
5371,
2003,
2112,
1997,
1996,
3946,
10559,
23561,
2291,
1012,
9385,
1006,
1039,
1007,
2263,
4459,
5163,
1026,
3889,
7442,
30524,
4007,
3192,
1025,
2593,
2544,
1016,
1012,
1015,
1997,
1996,
11172,
1010,
2030,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
MVP
===
<img src="icon.png" alt="Icon"/>
MVP模式基础包
介绍
---
MVP模式,包括简单的Activity与Fragment基础类,主要是绑定P层,使整个MVP模式具备
生命周期,另外实现了一些基础方法。
先决条件
----
- minSdkVersion 14
- 保持跟其他官方支持库版本一致(如:com.android.support:appcompat-v7)
入门
---
**引用:**
```
dependencies {
...
compile 'am.util:mvp:27.0.2'
...
}
```
注意
---
- 保持跟其他官方支持库版本一致(如:com.android.support:appcompat-v7),否则可能出现错误
支持
---
- Google+: https://plus.google.com/114728839435421501183
- Gmail: moferalex@gmail.com
如果发现错误,请在此处提出:
https://github.com/AlexMofer/ProjectX/issues
许可
---
Copyright (C) 2015 AlexMofer
Licensed to the Apache Software Foundation (ASF) under one or more contributor
license agreements. See the NOTICE file distributed with this work for
additional information regarding copyright ownership. The ASF licenses this
file to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License. | AlexMofer/AMWidget | mvp-ui/README.md | Markdown | apache-2.0 | 1,571 | [
30522,
12041,
1027,
1027,
1027,
1026,
10047,
2290,
5034,
2278,
1027,
1000,
12696,
1012,
1052,
3070,
1000,
12456,
1027,
1000,
12696,
1000,
1013,
1028,
12041,
100,
100,
100,
100,
100,
1759,
100,
1011,
1011,
1011,
12041,
100,
100,
1989,
100,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package band.full.test.video.encoder;
import static band.full.core.Resolution.STD_1080p;
import static band.full.core.Resolution.STD_2160p;
import static band.full.core.Resolution.STD_720p;
import static band.full.video.buffer.Framerate.FPS_23_976;
import static band.full.video.itu.BT2020.BT2020_10bit;
import static band.full.video.itu.BT709.BT709_8bit;
import static java.util.Arrays.asList;
import static java.util.Collections.emptyList;
import static java.util.Optional.empty;
import static java.util.Optional.ofNullable;
import band.full.core.Resolution;
import band.full.video.buffer.Framerate;
import band.full.video.itu.BT2100;
import band.full.video.itu.ColorMatrix;
import java.util.List;
import java.util.Optional;
public class EncoderParameters {
public static final String MASTER_DISPLAY_PRIMARIES =
"G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)";
public static final String MASTER_DISPLAY =
MASTER_DISPLAY_PRIMARIES + "L(10000000,5)";
public static final EncoderParameters HD_MAIN = new EncoderParameters(
STD_720p, BT709_8bit, FPS_23_976);
public static final EncoderParameters FULLHD_MAIN8 = new EncoderParameters(
STD_1080p, BT709_8bit, FPS_23_976);
public static final EncoderParameters UHD4K_MAIN8 = new EncoderParameters(
STD_2160p, BT709_8bit, FPS_23_976);
public static final EncoderParameters UHD4K_MAIN10 = new EncoderParameters(
STD_2160p, BT2020_10bit, FPS_23_976);
public static final EncoderParameters HLG10 = new EncoderParameters(
STD_2160p, BT2100.HLG10, FPS_23_976);
public static final EncoderParameters HLG10ITP = new EncoderParameters(
STD_2160p, BT2100.HLG10ITP, FPS_23_976);
public static final EncoderParameters HDR10 = new EncoderParameters(
STD_2160p, BT2100.PQ10, FPS_23_976)
.withMasterDisplay(MASTER_DISPLAY);
public static final EncoderParameters HDR10FR = new EncoderParameters(
STD_2160p, BT2100.PQ10FR, FPS_23_976)
.withMasterDisplay(MASTER_DISPLAY);
public static final EncoderParameters HDR10ITP = new EncoderParameters(
STD_2160p, BT2100.PQ10ITP, FPS_23_976)
.withMasterDisplay(MASTER_DISPLAY);
public final Resolution resolution;
public final ColorMatrix matrix;
public final Framerate framerate;
public final Optional<String> masterDisplay; // HEVC HDR only
public final List<String> encoderOptions;
public EncoderParameters(Resolution resolution, ColorMatrix matrix,
Framerate framerate) {
this(resolution, matrix, framerate, empty(), emptyList());
}
private EncoderParameters(Resolution resolution, ColorMatrix matrix,
Framerate framerate, Optional<String> masterDisplay,
List<String> encoderOptions) {
this.resolution = resolution;
this.matrix = matrix;
this.framerate = framerate;
this.masterDisplay = masterDisplay;
this.encoderOptions = encoderOptions;
}
public EncoderParameters withFramerate(Framerate framerate) {
return new EncoderParameters(resolution, matrix,
framerate, masterDisplay, encoderOptions);
}
public EncoderParameters withMasterDisplay(String masterDisplay) {
return new EncoderParameters(resolution, matrix,
framerate, ofNullable(masterDisplay), encoderOptions);
}
public EncoderParameters withEncoderOptions(String... options) {
return withEncoderOptions(asList(options));
}
public EncoderParameters withEncoderOptions(List<String> options) {
return new EncoderParameters(resolution, matrix,
framerate, masterDisplay, options);
}
}
| testing-av/testing-video | generators/src/main/java/band/full/test/video/encoder/EncoderParameters.java | Java | gpl-3.0 | 3,811 | [
30522,
7427,
2316,
1012,
2440,
1012,
3231,
1012,
2678,
1012,
4372,
30524,
1035,
22857,
2361,
1025,
12324,
10763,
2316,
1012,
2440,
1012,
2678,
1012,
17698,
1012,
4853,
11657,
1012,
1042,
4523,
1035,
2603,
1035,
5989,
2575,
1025,
12324,
1076... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Copyright 2015, deepsense.io
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.deepsense.deeplang.doperables
import java.sql.Timestamp
import org.apache.spark.rdd.RDD
import org.apache.spark.sql.Row
import org.apache.spark.sql.catalyst.expressions.GenericRowWithSchema
import org.apache.spark.sql.types._
import org.joda.time.DateTime
import io.deepsense.deeplang.DeeplangIntegTestSupport
import io.deepsense.deeplang.doperables.dataframe.DataFrame
import io.deepsense.deeplang.doperables.spark.wrappers.transformers.TransformerSerialization
import io.deepsense.deeplang.doperations.exceptions.{ColumnDoesNotExistException, WrongColumnTypeException}
import io.deepsense.deeplang.params.selections.{IndexSingleColumnSelection, NameSingleColumnSelection}
class DatetimeDecomposerIntegSpec extends DeeplangIntegTestSupport with TransformerSerialization {
private[this] val timestampColumnName = "timestampColumn"
private[this] val t1 = new DateTime(2015, 3, 30, 15, 25)
import TransformerSerialization._
"DatetimeDecomposer" should {
"decompose timestamp column without prefix" in {
val schema = createSchema
val t2 = t1.plusDays(1)
val data = createData(
List(Some(new Timestamp(t1.getMillis)), Some(new Timestamp(t2.getMillis)))
)
val expectedData: Seq[Row] = Seq(
createDecomposedTimestampRow(schema, 0, t1), createDecomposedTimestampRow(schema, 1, t2)
)
shouldDecomposeTimestamp(schema, data, expectedData, "")
}
"decompose timestamp column with prefix" in {
val schema = createSchema
val t2 = t1.plusDays(1)
val data = createData(
List(Some(new Timestamp(t1.getMillis)), Some(new Timestamp(t2.getMillis)))
)
val expectedData: Seq[Row] = Seq(
createDecomposedTimestampRow(schema, 0, t1), createDecomposedTimestampRow(schema, 1, t2)
)
shouldDecomposeTimestamp(schema, data, expectedData, timestampColumnName + "_")
}
"decompose timestamp values to the same zone" in {
val dataFrame = createDataFrame(
Seq(Row(new Timestamp(t1.getMillis))),
StructType(List(StructField(timestampColumnName, TimestampType)))
)
val transformedDataFrame = appendHour(dataFrame)
val List(timestamp, hour) =
transformedDataFrame.report.content.tables.head.values.head.map(_.get)
timestamp.substring(11, 13) shouldBe hour
}
}
it should {
"transform schema without prefix" in {
shouldTransformSchema(createSchema, "")
}
"transform schema with prefix" in {
shouldTransformSchema(createSchema, timestampColumnName + "_")
}
}
it should {
"decompose null timestamp column" in {
val schema = createSchema
val data = createData(List(Some(new Timestamp(t1.getMillis)), None))
val expectedData: Seq[Row] = Seq(
createDecomposedTimestampRow(schema, 0, t1),
new GenericRowWithSchema(Array(1, null, null, null, null, null, null, null),
resultSchema(schema, ""))
)
shouldDecomposeTimestamp(schema, data, expectedData, "")
}
}
it should {
"throw an exception" when {
"column selected by name does not exist" in {
intercept[ColumnDoesNotExistException] {
val operation = new DatetimeDecomposer()
.setTimestampColumn(NameSingleColumnSelection("nonExistsingColumnName"))
.setTimestampParts(partsFromStrings("year"))
.setTimestampPrefix("")
val dataFrame = createDataFrame(
Seq.empty, StructType(List(StructField("id", DoubleType))))
decomposeDatetime(operation, dataFrame)
}
()
}
"column selected by index does not exist" in {
intercept[ColumnDoesNotExistException] {
val operation = new DatetimeDecomposer()
.setTimestampColumn(IndexSingleColumnSelection(1))
.setTimestampParts(partsFromStrings("year"))
.setTimestampPrefix("")
val dataFrame = createDataFrame(
Seq.empty, StructType(List(StructField("id", DoubleType))))
decomposeDatetime(operation, dataFrame)
}
()
}
"selected column is not timestamp" in {
intercept[WrongColumnTypeException] {
val operation = new DatetimeDecomposer()
.setTimestampColumn(IndexSingleColumnSelection(0))
.setTimestampParts(partsFromStrings("year"))
.setTimestampPrefix("")
val dataFrame = createDataFrame(
Seq.empty, StructType(List(StructField("id", DoubleType))))
decomposeDatetime(operation, dataFrame)
}
()
}
}
}
it should {
"throw an exception in transform schema" when {
"column selected by name does not exist" in {
intercept[ColumnDoesNotExistException] {
val operation = new DatetimeDecomposer()
.setTimestampColumn(NameSingleColumnSelection("nonExistsingColumnName"))
.setTimestampParts(partsFromStrings("year"))
.setTimestampPrefix("")
val schema = StructType(List(StructField("id", DoubleType)))
operation._transformSchema(schema)
}
()
}
"column selected by index does not exist" in {
intercept[ColumnDoesNotExistException] {
val operation = new DatetimeDecomposer()
.setTimestampColumn(IndexSingleColumnSelection(1))
.setTimestampParts(partsFromStrings("year"))
.setTimestampPrefix("")
val schema = StructType(List(StructField("id", DoubleType)))
operation._transformSchema(schema)
}
()
}
"selected column is not timestamp" in {
intercept[WrongColumnTypeException] {
val operation = new DatetimeDecomposer()
.setTimestampColumn(IndexSingleColumnSelection(0))
.setTimestampParts(partsFromStrings("year"))
.setTimestampPrefix("")
val schema = StructType(List(StructField("id", DoubleType)))
operation._transformSchema(schema)
}
()
}
}
}
private def shouldDecomposeTimestamp(
schema: StructType, data: RDD[Row],
expectedData: Seq[Row],
prefix: String): Unit = {
val operation: DatetimeDecomposer = operationWithParamsSet(prefix)
val deserialized = operation.loadSerializedTransformer(tempDir)
shouldDecomposeTimestamp(schema, data, expectedData, prefix, operation)
shouldDecomposeTimestamp(schema, data, expectedData, prefix, deserialized)
}
private def shouldDecomposeTimestamp(
schema: StructType,
data: RDD[Row],
expectedData: Seq[Row],
prefix: String,
operation: Transformer): Unit = {
val dataFrame = executionContext.dataFrameBuilder.buildDataFrame(schema, data)
val resultDataFrame: DataFrame = decomposeDatetime(operation, dataFrame)
val expectedSchema: StructType = resultSchema(schema, prefix)
expectedSchema shouldBe resultDataFrame.sparkDataFrame.schema
expectedData.size shouldBe resultDataFrame.sparkDataFrame.count()
val zipped = expectedData zip resultDataFrame.sparkDataFrame.rdd.collect()
zipped.forall { case (p1, p2) => p1 == p2 } shouldBe true
}
private def shouldTransformSchema(
schema: StructType,
prefix: String): Unit = {
val operation: DatetimeDecomposer = operationWithParamsSet(prefix)
val transformedSchema = operation._transformSchema(schema)
val expectedSchema: StructType = resultSchema(schema, prefix)
expectedSchema shouldBe transformedSchema.get
}
private def createDecomposedTimestampRow(schema: StructType, id: Int, t: DateTime): Row = {
new GenericRowWithSchema(Array(id, new Timestamp(t.getMillis), t.getYear, t.getMonthOfYear,
t.getDayOfMonth, t.getHourOfDay, t.getMinuteOfHour, t.getSecondOfMinute), schema)
}
private def resultSchema(originalSchema: StructType, prefix: String): StructType =
StructType(originalSchema.fields ++ Array(
StructField(prefix + "year", DoubleType),
StructField(prefix + "month", DoubleType),
StructField(prefix + "day", DoubleType),
StructField(prefix + "hour", DoubleType),
StructField(prefix + "minutes", DoubleType),
StructField(prefix + "seconds", DoubleType)
))
private def createData(timestamps: Seq[Option[Timestamp]]): RDD[Row] = {
sparkContext.parallelize(timestamps.zipWithIndex.map(p => Row(p._2, p._1.orNull)))
}
private def createSchema: StructType = {
StructType(List(
StructField("id", IntegerType),
StructField(timestampColumnName, TimestampType)
))
}
private def decomposeDatetime(
decomposeDatetime: Transformer,
dataFrame: DataFrame): DataFrame = {
decomposeDatetime.transform.apply(executionContext)(())(dataFrame)
}
private def operationWithParamsSet(prefixParam: String): DatetimeDecomposer = {
new DatetimeDecomposer()
.setTimestampColumn(NameSingleColumnSelection(timestampColumnName))
.setTimestampParts(partsFromStrings("year", "month", "day", "hour", "minutes", "seconds"))
.setTimestampPrefix(prefixParam)
}
private def appendHour(dataFrame: DataFrame): DataFrame = {
new DatetimeDecomposer()
.setTimestampColumn(NameSingleColumnSelection(timestampColumnName))
.setTimestampParts(partsFromStrings("hour"))
._transform(executionContext, dataFrame)
}
private def partsFromStrings(names: String*): Set[DatetimeDecomposer.TimestampPart] = {
import DatetimeDecomposer.TimestampPart._
val allParts = Set(Year(), Month(), Day(), Hour(), Minutes(), Seconds())
names.map(name => allParts.filter(_.name == name).head).toSet
}
}
| deepsense-io/seahorse-workflow-executor | deeplang/src/it/scala/io/deepsense/deeplang/doperables/DatetimeDecomposerIntegSpec.scala | Scala | apache-2.0 | 10,271 | [
30522,
1013,
1008,
1008,
1008,
9385,
2325,
1010,
2784,
5054,
3366,
1012,
22834,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2025,
30524,
8917,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<!--[if lt IE 9]><html class="no-js lt-ie9" lang="en" dir="ltr"><![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="en" dir="ltr">
<!--<![endif]-->
<!-- Usage: /eic/site/ccc-rec.nsf/tpl-eng/template-1col.html?Open&id=3 (optional: ?Open&page=filename.html&id=x) -->
<!-- Created: ; Product Code: 536; Server: stratnotes2.ic.gc.ca -->
<head>
<!-- Title begins / Début du titre -->
<title>
GiltteryStar Technologies Ltd -
Complete profile - Canadian Company Capabilities - Industries and Business - Industry Canada
</title>
<!-- Title ends / Fin du titre -->
<!-- Meta-data begins / Début des métadonnées -->
<meta charset="utf-8" />
<meta name="dcterms.language" title="ISO639-2" content="eng" />
<meta name="dcterms.title" content="" />
<meta name="description" content="" />
<meta name="dcterms.description" content="" />
<meta name="dcterms.type" content="report, data set" />
<meta name="dcterms.subject" content="businesses, industry" />
<meta name="dcterms.subject" content="businesses, industry" />
<meta name="dcterms.issued" title="W3CDTF" content="" />
<meta name="dcterms.modified" title="W3CDTF" content="" />
<meta name="keywords" content="" />
<meta name="dcterms.creator" content="" />
<meta name="author" content="" />
<meta name="dcterms.created" title="W3CDTF" content="" />
<meta name="dcterms.publisher" content="" />
<meta name="dcterms.audience" title="icaudience" content="" />
<meta name="dcterms.spatial" title="ISO3166-1" content="" />
<meta name="dcterms.spatial" title="gcgeonames" content="" />
<meta name="dcterms.format" content="HTML" />
<meta name="dcterms.identifier" title="ICsiteProduct" content="536" />
<!-- EPI-11240 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- MCG-202 -->
<meta content="width=device-width,initial-scale=1" name="viewport">
<!-- EPI-11567 -->
<meta name = "format-detection" content = "telephone=no">
<!-- EPI-12603 -->
<meta name="robots" content="noarchive">
<!-- EPI-11190 - Webtrends -->
<script>
var startTime = new Date();
startTime = startTime.getTime();
</script>
<!--[if gte IE 9 | !IE ]><!-->
<link href="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/assets/favicon.ico" rel="icon" type="image/x-icon">
<link rel="stylesheet" href="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/css/wet-boew.min.css">
<!--<![endif]-->
<link rel="stylesheet" href="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/css/theme.min.css">
<!--[if lt IE 9]>
<link href="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/assets/favicon.ico" rel="shortcut icon" />
<link rel="stylesheet" href="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/css/ie8-wet-boew.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/js/ie8-wet-boew.min.js"></script>
<![endif]-->
<!--[if lte IE 9]>
<![endif]-->
<noscript><link rel="stylesheet" href="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/css/noscript.min.css" /></noscript>
<!-- Google Tag Manager DO NOT REMOVE OR MODIFY - NE PAS SUPPRIMER OU MODIFIER -->
<script>dataLayer1 = [];</script>
<!-- End Google Tag Manager -->
<!-- EPI-11235 -->
<link rel="stylesheet" href="/eic/home.nsf/css/add_WET_4-0_Canada_Apps.css">
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
<link href="/app/ccc/srch/css/print.css" media="print" rel="stylesheet" type="text/css" />
</head>
<body class="home" vocab="http://schema.org/" typeof="WebPage">
<!-- EPIC HEADER BEGIN -->
<!-- Google Tag Manager DO NOT REMOVE OR MODIFY - NE PAS SUPPRIMER OU MODIFIER -->
<noscript><iframe title="Google Tag Manager" src="//www.googletagmanager.com/ns.html?id=GTM-TLGQ9K" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer1'?'&l='+l:'';j.async=true;j.src='//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer1','GTM-TLGQ9K');</script>
<!-- End Google Tag Manager -->
<!-- EPI-12801 -->
<span typeof="Organization"><meta property="legalName" content="Department_of_Industry"></span>
<ul id="wb-tphp">
<li class="wb-slc">
<a class="wb-sl" href="#wb-cont">Skip to main content</a>
</li>
<li class="wb-slc visible-sm visible-md visible-lg">
<a class="wb-sl" href="#wb-info">Skip to "About this site"</a>
</li>
</ul>
<header role="banner">
<div id="wb-bnr" class="container">
<section id="wb-lng" class="visible-md visible-lg text-right">
<h2 class="wb-inv">Language selection</h2>
<div class="row">
<div class="col-md-12">
<ul class="list-inline mrgn-bttm-0">
<li><a href="nvgt.do?V_TOKEN=1492288524919&V_SEARCH.docsCount=3&V_DOCUMENT.docRank=19499&V_SEARCH.docsStart=19498&V_SEARCH.command=navigate&V_SEARCH.resultsJSP=/prfl.do&lang=fra&redirectUrl=/app/scr/imbs/ccc/rgstrtn/?_flId?_flxKy=e1s1&estblmntNo=234567041301&profileId=61&_evId=bck&lang=eng&V_SEARCH.showStricts=false&prtl=1&_flId?_flId?_flxKy=e1s1" title="Français" lang="fr">Français</a></li>
</ul>
</div>
</div>
</section>
<div class="row">
<div class="brand col-xs-8 col-sm-9 col-md-6">
<a href="http://www.canada.ca/en/index.html"><object type="image/svg+xml" tabindex="-1" data="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/assets/sig-blk-en.svg"></object><span class="wb-inv"> Government of Canada</span></a>
</div>
<section class="wb-mb-links col-xs-4 col-sm-3 visible-sm visible-xs" id="wb-glb-mn">
<h2>Search and menus</h2>
<ul class="list-inline text-right chvrn">
<li><a href="#mb-pnl" title="Search and menus" aria-controls="mb-pnl" class="overlay-lnk" role="button"><span class="glyphicon glyphicon-search"><span class="glyphicon glyphicon-th-list"><span class="wb-inv">Search and menus</span></span></span></a></li>
</ul>
<div id="mb-pnl"></div>
</section>
<!-- Site Search Removed -->
</div>
</div>
<nav role="navigation" id="wb-sm" class="wb-menu visible-md visible-lg" data-trgt="mb-pnl" data-ajax-fetch="//cdn.canada.ca/gcweb-cdn-dev/sitemenu/sitemenu-en.html" typeof="SiteNavigationElement">
<h2 class="wb-inv">Topics menu</h2>
<div class="container nvbar">
<div class="row">
<ul class="list-inline menu">
<li><a href="https://www.canada.ca/en/services/jobs.html">Jobs</a></li>
<li><a href="http://www.cic.gc.ca/english/index.asp">Immigration</a></li>
<li><a href="https://travel.gc.ca/">Travel</a></li>
<li><a href="https://www.canada.ca/en/services/business.html">Business</a></li>
<li><a href="https://www.canada.ca/en/services/benefits.html">Benefits</a></li>
<li><a href="http://healthycanadians.gc.ca/index-eng.php">Health</a></li>
<li><a href="https://www.canada.ca/en/services/taxes.html">Taxes</a></li>
<li><a href="https://www.canada.ca/en/services.html">More services</a></li>
</ul>
</div>
</div>
</nav>
<!-- EPIC BODY BEGIN -->
<nav role="navigation" id="wb-bc" class="" property="breadcrumb">
<h2 class="wb-inv">You are here:</h2>
<div class="container">
<div class="row">
<ol class="breadcrumb">
<li><a href="/eic/site/icgc.nsf/eng/home" title="Home">Home</a></li>
<li><a href="/eic/site/icgc.nsf/eng/h_07063.html" title="Industries and Business">Industries and Business</a></li>
<li><a href="/eic/site/ccc-rec.nsf/tpl-eng/../eng/home" >Canadian Company Capabilities</a></li>
</ol>
</div>
</div>
</nav>
</header>
<main id="wb-cont" role="main" property="mainContentOfPage" class="container">
<!-- End Header -->
<!-- Begin Body -->
<!-- Begin Body Title -->
<!-- End Body Title -->
<!-- Begin Body Head -->
<!-- End Body Head -->
<!-- Begin Body Content -->
<br>
<!-- Complete Profile -->
<!-- Company Information above tabbed area-->
<input id="showMore" type="hidden" value='more'/>
<input id="showLess" type="hidden" value='less'/>
<h1 id="wb-cont">
Company profile - Canadian Company Capabilities
</h1>
<div class="profileInfo hidden-print">
<ul class="list-inline">
<li><a href="cccSrch.do?lang=eng&profileId=&prtl=1&key.hitsPerPage=25&searchPage=%252Fapp%252Fccc%252Fsrch%252FcccBscSrch.do%253Flang%253Deng%2526amp%253Bprtl%253D1%2526amp%253Btagid%253D&V_SEARCH.scopeCategory=CCC.Root&V_SEARCH.depth=1&V_SEARCH.showStricts=false&V_SEARCH.sortSpec=title+asc&rstBtn.x=" class="btn btn-link">New Search</a> |</li>
<li><form name="searchForm" method="post" action="/app/ccc/srch/bscSrch.do">
<input type="hidden" name="lang" value="eng" />
<input type="hidden" name="profileId" value="" />
<input type="hidden" name="prtl" value="1" />
<input type="hidden" name="searchPage" value="%2Fapp%2Fccc%2Fsrch%2FcccBscSrch.do%3Flang%3Deng%26amp%3Bprtl%3D1%26amp%3Btagid%3D" />
<input type="hidden" name="V_SEARCH.scopeCategory" value="CCC.Root" />
<input type="hidden" name="V_SEARCH.depth" value="1" />
<input type="hidden" name="V_SEARCH.showStricts" value="false" />
<input id="repeatSearchBtn" class="btn btn-link" type="submit" value="Return to search results" />
</form></li>
<li>| <a href="nvgt.do?V_SEARCH.docsStart=19497&V_DOCUMENT.docRank=19498&V_SEARCH.docsCount=3&lang=eng&prtl=1&sbPrtl=&profile=cmpltPrfl&V_TOKEN=1492288557906&V_SEARCH.command=navigate&V_SEARCH.resultsJSP=%2fprfl.do&estblmntNo=234567156587&profileId=&key.newSearchLabel=">Previous Company</a></li>
<li>| <a href="nvgt.do?V_SEARCH.docsStart=19499&V_DOCUMENT.docRank=19500&V_SEARCH.docsCount=3&lang=eng&prtl=1&sbPrtl=&profile=cmpltPrfl&V_TOKEN=1492288557906&V_SEARCH.command=navigate&V_SEARCH.resultsJSP=%2fprfl.do&estblmntNo=234567035703&profileId=&key.newSearchLabel=">Next Company</a></li>
</ul>
</div>
<details>
<summary>Third-Party Information Liability Disclaimer</summary>
<p>Some of the information on this Web page has been provided by external sources. The Government of Canada is not responsible for the accuracy, reliability or currency of the information supplied by external sources. Users wishing to rely upon this information should consult directly with the source of the information. Content provided by external sources is not subject to official languages, privacy and accessibility requirements.</p>
</details>
<h2>
GiltteryStar Technologies Ltd
</h2>
<div class="row">
<div class="col-md-5">
<h2 class="h5 mrgn-bttm-0">Legal/Operating Name:</h2>
<p>GiltteryStar Technologies Ltd</p>
<p><a href="mailto:jianzhang_2006@yahoo.com" title="jianzhang_2006@yahoo.com">jianzhang_2006@yahoo.com</a></p>
</div>
<div class="col-md-4 mrgn-sm-sm">
<h2 class="h5 mrgn-bttm-0">Mailing Address:</h2>
<address class="mrgn-bttm-md">
87 Castlethorpe Cres<br/>
NEPEAN,
Ontario<br/>
K2G 5R2
<br/>
</address>
<h2 class="h5 mrgn-bttm-0">Location Address:</h2>
<address class="mrgn-bttm-md">
87 Castlethorpe Cres<br/>
NEPEAN,
Ontario<br/>
K2G 5R2
<br/>
</address>
<p class="mrgn-bttm-0"><abbr title="Telephone">Tel.</abbr>:
(613) 225-7215
</p>
<p class="mrgn-bttm-lg"><abbr title="Facsimile">Fax</abbr>:
(613) 225-7215</p>
</div>
<div class="col-md-3 mrgn-tp-md">
</div>
</div>
<div class="row mrgn-tp-md mrgn-bttm-md">
<div class="col-md-12">
<h2 class="wb-inv">Company Profile</h2>
<br> Software consulting services - Enterprise Application Development<br>
</div>
</div>
<!-- <div class="wb-tabs ignore-session update-hash wb-eqht-off print-active"> -->
<div class="wb-tabs ignore-session">
<div class="tabpanels">
<details id="details-panel1">
<summary>
Full profile
</summary>
<!-- Tab 1 -->
<h2 class="wb-invisible">
Full profile
</h2>
<!-- Contact Information -->
<h3 class="page-header">
Contact information
</h3>
<section class="container-fluid">
<div class="row mrgn-tp-lg">
<div class="col-md-3">
<strong>
Jian
Zhang
</strong></div>
</div>
<div class="row mrgn-lft-md">
<div class="col-md-5">
<strong>
Title:
</strong>
</div>
<div class="col-md-7">
Data Provider<br>
</div>
</div>
<div class="row mrgn-lft-md">
<div class="col-md-5">
<strong>
Telephone:
</strong>
</div>
<div class="col-md-7">
(613) 225-7215
</div>
</div>
<div class="row mrgn-lft-md">
<div class="col-md-5">
<strong>
Email:
</strong>
</div>
<div class="col-md-7">
zhgchn@yahoo.com
</div>
</div>
</section>
<p class="mrgn-tp-lg text-right small hidden-print">
<a href="#wb-cont">top of page</a>
</p>
<!-- Company Description -->
<h3 class="page-header">
Company description
</h3>
<section class="container-fluid">
<div class="row">
<div class="col-md-5">
<strong>
Country of Ownership:
</strong>
</div>
<div class="col-md-7">
Canada
</div>
</div>
<div class="row">
<div class="col-md-5">
<strong>
Exporting:
</strong>
</div>
<div class="col-md-7">
No
</div>
</div>
<div class="row">
<div class="col-md-5">
<strong>
Primary Industry (NAICS):
</strong>
</div>
<div class="col-md-7">
541510 - Computer Systems Design and Related Services
</div>
</div>
<div class="row">
<div class="col-md-5">
<strong>
Alternate Industries (NAICS):
</strong>
</div>
<div class="col-md-7">
541690 - Other Scientific and Technical Consulting Services<br>
</div>
</div>
<div class="row">
<div class="col-md-5">
<strong>
Primary Business Activity:
</strong>
</div>
<div class="col-md-7">
Services
</div>
</div>
</section>
<!-- Products / Services / Licensing -->
<h3 class="page-header">
Product / Service / Licensing
</h3>
<section class="container-fluid">
<div class="row mrgn-bttm-md">
<div class="col-md-3">
<strong>
Service Name:
</strong>
</div>
<div class="col-md-9">
Enterprise Application Development<br>
</div>
</div>
<div class="row mrgn-bttm-md">
<div class="col-md-12">
Business requirements analysis, solution architecture design, application development and deployment<br>
<br>
</div>
</div>
</section>
<p class="mrgn-tp-lg text-right small hidden-print">
<a href="#wb-cont">top of page</a>
</p>
<!-- Technology Profile -->
<!-- Market Profile -->
<!-- Sector Information -->
<details class="mrgn-tp-md mrgn-bttm-md">
<summary>
Third-Party Information Liability Disclaimer
</summary>
<p>
Some of the information on this Web page has been provided by external sources. The Government of Canada is not responsible for the accuracy, reliability or currency of the information supplied by external sources. Users wishing to rely upon this information should consult directly with the source of the information. Content provided by external sources is not subject to official languages, privacy and accessibility requirements.
</p>
</details>
</details>
<details id="details-panel2">
<summary>
Contacts
</summary>
<h2 class="wb-invisible">
Contact information
</h2>
<!-- Contact Information -->
<section class="container-fluid">
<div class="row mrgn-tp-lg">
<div class="col-md-3">
<strong>
Jian
Zhang
</strong></div>
</div>
<div class="row mrgn-lft-md">
<div class="col-md-5">
<strong>
Title:
</strong>
</div>
<div class="col-md-7">
Data Provider<br>
</div>
</div>
<div class="row mrgn-lft-md">
<div class="col-md-5">
<strong>
Telephone:
</strong>
</div>
<div class="col-md-7">
(613) 225-7215
</div>
</div>
<div class="row mrgn-lft-md">
<div class="col-md-5">
<strong>
Email:
</strong>
</div>
<div class="col-md-7">
zhgchn@yahoo.com
</div>
</div>
</section>
</details>
<details id="details-panel3">
<summary>
Description
</summary>
<h2 class="wb-invisible">
Company description
</h2>
<section class="container-fluid">
<div class="row">
<div class="col-md-5">
<strong>
Country of Ownership:
</strong>
</div>
<div class="col-md-7">
Canada
</div>
</div>
<div class="row">
<div class="col-md-5">
<strong>
Exporting:
</strong>
</div>
<div class="col-md-7">
No
</div>
</div>
<div class="row">
<div class="col-md-5">
<strong>
Primary Industry (NAICS):
</strong>
</div>
<div class="col-md-7">
541510 - Computer Systems Design and Related Services
</div>
</div>
<div class="row">
<div class="col-md-5">
<strong>
Alternate Industries (NAICS):
</strong>
</div>
<div class="col-md-7">
541690 - Other Scientific and Technical Consulting Services<br>
</div>
</div>
<div class="row">
<div class="col-md-5">
<strong>
Primary Business Activity:
</strong>
</div>
<div class="col-md-7">
Services
</div>
</div>
</section>
</details>
<details id="details-panel4">
<summary>
Products, services and licensing
</summary>
<h2 class="wb-invisible">
Product / Service / Licensing
</h2>
<section class="container-fluid">
<div class="row mrgn-bttm-md">
<div class="col-md-3">
<strong>
Service Name:
</strong>
</div>
<div class="col-md-9">
Enterprise Application Development<br>
</div>
</div>
<div class="row mrgn-bttm-md">
<div class="col-md-12">
Business requirements analysis, solution architecture design, application development and deployment<br>
<br>
</div>
</div>
</section>
</details>
</div>
</div>
<div class="row">
<div class="col-md-12 text-right">
Last Update Date 2016-03-01
</div>
</div>
<!--
- Artifact ID: CBW - IMBS - CCC Search WAR
- Group ID: ca.gc.ic.strategis.imbs.ccc.search
- Version: 3.26
- Built-By: bamboo
- Build Timestamp: 2017-03-02T21:29:28Z
-->
<!-- End Body Content -->
<!-- Begin Body Foot -->
<!-- End Body Foot -->
<!-- END MAIN TABLE -->
<!-- End body -->
<!-- Begin footer -->
<div class="row pagedetails">
<div class="col-sm-5 col-xs-12 datemod">
<dl id="wb-dtmd">
<dt class=" hidden-print">Date Modified:</dt>
<dd class=" hidden-print">
<span><time>2017-03-02</time></span>
</dd>
</dl>
</div>
<div class="clear visible-xs"></div>
<div class="col-sm-4 col-xs-6">
</div>
<div class="col-sm-3 col-xs-6 text-right">
</div>
<div class="clear visible-xs"></div>
</div>
</main>
<footer role="contentinfo" id="wb-info">
<nav role="navigation" class="container wb-navcurr">
<h2 class="wb-inv">About government</h2>
<!-- EPIC FOOTER BEGIN -->
<!-- EPI-11638 Contact us -->
<ul class="list-unstyled colcount-sm-2 colcount-md-3">
<li><a href="http://www.ic.gc.ca/eic/site/icgc.nsf/eng/h_07026.html#pageid=E048-H00000&from=Industries">Contact us</a></li>
<li><a href="https://www.canada.ca/en/government/dept.html">Departments and agencies</a></li>
<li><a href="https://www.canada.ca/en/government/publicservice.html">Public service and military</a></li>
<li><a href="https://www.canada.ca/en/news.html">News</a></li>
<li><a href="https://www.canada.ca/en/government/system/laws.html">Treaties, laws and regulations</a></li>
<li><a href="https://www.canada.ca/en/transparency/reporting.html">Government-wide reporting</a></li>
<li><a href="http://pm.gc.ca/eng">Prime Minister</a></li>
<li><a href="https://www.canada.ca/en/government/system.html">How government works</a></li>
<li><a href="http://open.canada.ca/en/">Open government</a></li>
</ul>
</nav>
<div class="brand">
<div class="container">
<div class="row">
<nav class="col-md-10 ftr-urlt-lnk">
<h2 class="wb-inv">About this site</h2>
<ul>
<li><a href="https://www.canada.ca/en/social.html">Social media</a></li>
<li><a href="https://www.canada.ca/en/mobile.html">Mobile applications</a></li>
<li><a href="http://www1.canada.ca/en/newsite.html">About Canada.ca</a></li>
<li><a href="http://www.ic.gc.ca/eic/site/icgc.nsf/eng/h_07033.html">Terms and conditions</a></li>
<li><a href="http://www.ic.gc.ca/eic/site/icgc.nsf/eng/h_07033.html#p1">Privacy</a></li>
</ul>
</nav>
<div class="col-xs-6 visible-sm visible-xs tofpg">
<a href="#wb-cont">Top of Page <span class="glyphicon glyphicon-chevron-up"></span></a>
</div>
<div class="col-xs-6 col-md-2 text-right">
<object type="image/svg+xml" tabindex="-1" role="img" data="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/assets/wmms-blk.svg" aria-label="Symbol of the Government of Canada"></object>
</div>
</div>
</div>
</div>
</footer>
<!--[if gte IE 9 | !IE ]><!-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/js/wet-boew.min.js"></script>
<!--<![endif]-->
<!--[if lt IE 9]>
<script src="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/js/ie8-wet-boew2.min.js"></script>
<![endif]-->
<script src="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/js/theme.min.js"></script>
<!-- EPI-10519 -->
<span class="wb-sessto"
data-wb-sessto='{"inactivity": 1800000, "reactionTime": 180000, "sessionalive": 1800000, "logouturl": "/app/ccc/srch/cccSrch.do?lang=eng&prtl=1"}'></span>
<script src="/eic/home.nsf/js/jQuery.externalOpensInNewWindow.js"></script>
<!-- EPI-11190 - Webtrends -->
<script src="/eic/home.nsf/js/webtrends.js"></script>
<script>var endTime = new Date();</script>
<noscript>
<div><img alt="" id="DCSIMG" width="1" height="1" src="//wt-sdc.ic.gc.ca/dcs6v67hwe0ei7wsv8g9fv50d_3k6i/njs.gif?dcsuri=/nojavascript&WT.js=No&WT.tv=9.4.0&dcssip=www.ic.gc.ca"/></div>
</noscript>
<!-- /Webtrends -->
<!-- JS deps -->
<script src="/eic/home.nsf/js/jquery.imagesloaded.js"></script>
<!-- EPI-11262 - Util JS -->
<script src="/eic/home.nsf/js/_WET_4-0_utils_canada.min.js"></script>
<!-- EPI-11383 -->
<script src="/eic/home.nsf/js/jQuery.icValidationErrors.js"></script>
<span style="display:none;" id='app-info' data-project-groupid='' data-project-artifactid='' data-project-version='' data-project-build-timestamp='' data-issue-tracking='' data-scm-sha1='' data-scm-sha1-abbrev='' data-scm-branch='' data-scm-commit-date=''></span>
</body></html>
<!-- End Footer -->
<!--
- Artifact ID: CBW - IMBS - CCC Search WAR
- Group ID: ca.gc.ic.strategis.imbs.ccc.search
- Version: 3.26
- Built-By: bamboo
- Build Timestamp: 2017-03-02T21:29:28Z
-->
| GoC-Spending/data-corporations | html/234567110032.html | HTML | mit | 33,187 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
999,
1011,
1011,
1031,
2065,
8318,
29464,
1023,
1033,
1028,
1026,
16129,
2465,
1027,
1000,
2053,
1011,
1046,
2015,
8318,
1011,
29464,
2683,
1000,
11374,
1027,
1000,
4372,
1000,
16101,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!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" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CodeIgniter Features : CodeIgniter User Guide</title>
<style type='text/css' media='all'>@import url('../userguide.css');</style>
<link rel='stylesheet' type='text/css' media='all' href='../userguide.css' />
<script type="text/javascript" src="../nav/nav.js"></script>
<script type="text/javascript" src="../nav/prototype.lite.js"></script>
<script type="text/javascript" src="../nav/moo.fx.js"></script>
<script type="text/javascript" src="../nav/user_guide_menu.js"></script>
<meta http-equiv='expires' content='-1' />
<meta http-equiv= 'pragma' content='no-cache' />
<meta name='robots' content='all' />
<meta name='author' content='ExpressionEngine Dev Team' />
<meta name='description' content='CodeIgniter User Guide' />
</head>
<body>
<!-- START NAVIGATION -->
<div id="nav"><div id="nav_inner"><script type="text/javascript">create_menu('../');</script></div></div>
<div id="nav2"><a name="top"></a><a href="javascript:void(0);" onclick="myHeight.toggle();"><img src="../images/nav_toggle_darker.jpg" width="154" height="43" border="0" title="Toggle Table of Contents" alt="Toggle Table of Contents" /></a></div>
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
<td><h1>CodeIgniter User Guide Version 2.2.5</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
</div>
<!-- END NAVIGATION -->
<!-- START BREADCRUMB -->
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
<td id="breadcrumb">
<a href="http://codeigniter.com/">CodeIgniter Home</a> ›
<a href="../index.html">User Guide Home</a> ›
<a href="index.html">Tutorial</a> ›
News section
</td>
<td id="searchbox"><form method="get" action="http://www.google.com/search"><input type="hidden" name="as_sitesearch" id="as_sitesearch" value="codeigniter.com/user_guide/" />Search User Guide <input type="text" class="input" style="width:200px;" name="q" id="q" size="31" maxlength="255" value="" /> <input type="submit" class="submit" name="sa" value="Go" /></form></td>
</tr>
</table>
<!-- END BREADCRUMB -->
<br clear="all" />
<!-- START CONTENT -->
<div id="content">
<h1>Tutorial − News section</h1>
<p>In the last section, we went over some basic concepts of the framework by writing a class that includes static pages. We cleaned up the URI by adding custom routing rules. Now it's time to introduce dynamic content and start using a database.</p>
<h2>Setting up your model</h2>
<p>Instead of writing database operations right in the controller, queries should be placed in a model, so they can easily be reused later. Models are the place where you retrieve, insert, and update information in your database or other data stores. They represent your data.</p>
<p>Open up the <dfn>application/models</dfn> directory and create a new file called <dfn>news_model.php</dfn> and add the following code. Make sure you've configured your database properly as described <a href="../database/configuration.html">here</a>.</p>
<pre>
<?php
class News_model extends CI_Model {
public function __construct()
{
$this->load->database();
}
}
</pre>
<p>This code looks similar to the controller code that was used earlier. It creates a new model by extending CI_Model and loads the database library. This will make the database class available through the <var>$this->db</var> object.</p>
<p>Before querying the database, a database schema has to be created. Connect to your database and run the SQL command below. Also add some seed records.</p>
<pre>
CREATE TABLE news (
id int(11) NOT NULL AUTO_INCREMENT,
title varchar(128) NOT NULL,
slug varchar(128) NOT NULL,
text text NOT NULL,
PRIMARY KEY (id),
KEY slug (slug)
);
</pre>
<p>Now that the database and a model have been set up, you'll need a method to get all of our posts from our database. To do this, the database abstraction layer that is included with CodeIgniter — <a href="../database/active_record.html">Active Record</a> — is used. This makes it possible to write your 'queries' once and make them work on <a href="../general/requirements.html">all supported database systems</a>. Add the following code to your model.</p>
<pre>
public function get_news($slug = FALSE)
{
if ($slug === FALSE)
{
$query = $this->db->get('news');
return $query->result_array();
}
$query = $this->db->get_where('news', array('slug' => $slug));
return $query->row_array();
}
</pre>
<p>With this code you can perform two different queries. You can get all news records, or get a news item by its <a href="#" title="a URL friendly version of a string">slug</a>. You might have noticed that the <var>$slug</var> variable wasn't sanitized before running the query; Active Record does this for you.</p>
<h2>Display the news</h2>
<p>Now that the queries are written, the model should be tied to the views that are going to display the news items to the user. This could be done in our pages controller created earlier, but for the sake of clarity, a new "news" controller is defined. Create the new controller at <dfn>application/controllers/news.php</dfn>.</p>
<pre>
<?php
class News extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model('news_model');
}
public function index()
{
$data['news'] = $this->news_model->get_news();
}
public function view($slug)
{
$data['news'] = $this->news_model->get_news($slug);
}
}
</pre>
<p>Looking at the code, you may see some similarity with the files we created earlier. First, the "__construct" method: it calls the constructor of its parent class (<dfn>CI_Controller</dfn>) and loads the model, so it can be used in all other methods in this controller.</p>
<p>Next, there are two methods to view all news items and one for a specific news item. You can see that the <var>$slug</var> variable is passed to the model's method in the second method. The model is using this slug to identify the news item to be returned.</p>
<p>Now the data is retrieved by the controller through our model, but nothing is displayed yet. The next thing to do is passing this data to the views.</p>
<pre>
public function index()
{
$data['news'] = $this->news_model->get_news();
$data['title'] = 'News archive';
$this->load->view('templates/header', $data);
$this->load->view('news/index', $data);
$this->load->view('templates/footer');
}
</pre>
<p>The code above gets all news records from the model and assigns it to a variable. The value for the title is also assigned to the <var>$data['title']</var> element and all data is passed to the views. You now need to create a view to render the news items. Create <dfn>application/views/news/index.php</dfn> and add the next piece of code.</p>
<pre>
<?php foreach ($news as $news_item): ?>
<h2><?php echo $news_item['title'] ?></h2>
<div class="main">
<?php echo $news_item['text'] ?>
</div>
<p><a href="news/<?php echo $news_item['slug'] ?>">View article</a></p>
<?php endforeach ?>
</pre>
<p>Here, each news item is looped and displayed to the user. You can see we wrote our template in PHP mixed with HTML. If you prefer to use a template language, you can use CodeIgniter's <a href="../libraries/parser.html">Template Parser</a> class or a third party parser.</p>
<p>The news overview page is now done, but a page to display individual news items is still absent. The model created earlier is made in such way that it can easily be used for this functionality. You only need to add some code to the controller and create a new view. Go back to the news controller and add the following lines to the file.</p>
<pre>
public function view($slug)
{
$data['news_item'] = $this->news_model->get_news($slug);
if (empty($data['news_item']))
{
show_404();
}
$data['title'] = $data['news_item']['title'];
$this->load->view('templates/header', $data);
$this->load->view('news/view', $data);
$this->load->view('templates/footer');
}
</pre>
<p>Instead of calling the <var>get_news()</var> method without a parameter, the <var>$slug</var> variable is passed, so it will return the specific news item. The only things left to do is create the corresponding view at <dfn>application/views/news/view.php</dfn>. Put the following code in this file.</p>
<pre>
<?php
echo '<h2>'.$news_item['title'].'</h2>';
echo $news_item['text'];
</pre>
<h2>Routing</h2>
<p>Because of the wildcard routing rule created earlier, you need need an extra route to view the controller that you just made. Modify your routing file (<dfn>application/config/routes.php</dfn>) so it looks as follows. This makes sure the requests reaches the news controller instead of going directly to the pages controller. The first line routes URI's with a slug to the view method in the news controller.</p>
<pre>
$route['news/(:any)'] = 'news/view/$1';
$route['news'] = 'news';
$route['(:any)'] = 'pages/view/$1';
$route['default_controller'] = 'pages/view';
</pre>
<p>Point your browser to your document root, followed by <dfn>index.php/news</dfn> and watch your news page.</p>
</div>
<!-- END CONTENT -->
<div id="footer">
<p>
Previous Topic: <a href="static_pages.html">Static pages</a>
·
<a href="#top">Top of Page</a> ·
<a href="../index.html">User Guide Home</a> ·
Next Topic: <a href="create_news_items.html">Create news items</a>
</p>
<p><a href="http://codeigniter.com">CodeIgniter</a> · Copyright © 2006 - 2014 · <a href="http://ellislab.com/">EllisLab, Inc.</a> · Copyright © 2014 - 2015 · <a href="http://bcit.ca/">British Columbia Institute of Technology</a></p>
</div>
</body>
</html> | Sprinkle7/Kpitb | user_guide/tutorial/news_section.html | HTML | apache-2.0 | 10,264 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
1060,
11039,
19968,
1015,
1012,
1014,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>PHPXRef 0.7.1 : Unnamed Project : Detail view of glyphicons-halflings-regular.svg</title>
<link rel="stylesheet" href="../../../sample.css" type="text/css">
<link rel="stylesheet" href="../../../sample-print.css" type="text/css" media="print">
<style id="hilight" type="text/css"></style>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
</head>
<body bgcolor="#ffffff" text="#000000" link="#801800" vlink="#300540" alink="#ffffff">
<table class="pagetitle" width="100%">
<tr>
<td valign="top" class="pagetitle">
[ <a href="../../../index.html">Index</a> ]
</td>
<td align="right" class="pagetitle">
<h2 style="margin-bottom: 0px">PHP Cross Reference of Unnamed Project</h2>
</td>
</tr>
</table>
<!-- Generated by PHPXref 0.7.1 at Sat Nov 21 22:13:19 2015 -->
<!-- PHPXref (c) 2000-2010 Gareth Watts - gareth@omnipotent.net -->
<!-- http://phpxref.sourceforge.net/ -->
<script src="../../../phpxref.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript">
<!--
ext='.html';
relbase='../../../';
subdir='rsc/fonts/bootstrap';
filename='glyphicons-halflings-regular.svg.html';
cookiekey='phpxref';
handleNavFrame(relbase, subdir, filename);
// -->
</script>
<script language="JavaScript" type="text/javascript">
if (gwGetCookie('xrefnav')=='off')
document.write('<p class="navlinks">[ <a href="javascript:navOn()">Show Explorer<\/a> ]<\/p>');
else
document.write('<p class="navlinks">[ <a href="javascript:navOff()">Hide Explorer<\/a> ]<\/p>');
</script>
<noscript>
<p class="navlinks">
[ <a href="../../../nav.html" target="_top">Show Explorer</a> ]
[ <a href="index.html" target="_top">Hide Navbar</a> ]
</p>
</noscript>
<script language="JavaScript" type="text/javascript">
<!--
document.writeln('<table align="right" class="searchbox-link"><tr><td><a class="searchbox-link" href="javascript:void(0)" onMouseOver="showSearchBox()">Search</a><br>');
document.writeln('<table border="0" cellspacing="0" cellpadding="0" class="searchbox" id="searchbox">');
document.writeln('<tr><td class="searchbox-title">');
document.writeln('<a class="searchbox-title" href="javascript:showSearchPopup()">Search History +</a>');
document.writeln('<\/td><\/tr>');
document.writeln('<tr><td class="searchbox-body" id="searchbox-body">');
document.writeln('<form name="search" style="margin:0px; padding:0px" onSubmit=\'return jump()\'>');
document.writeln('<a class="searchbox-body" href="../../../_classes/index.html">Class<\/a>: ');
document.writeln('<input type="text" size=10 value="" name="classname"><br>');
document.writeln('<a id="funcsearchlink" class="searchbox-body" href="../../../_functions/index.html">Function<\/a>: ');
document.writeln('<input type="text" size=10 value="" name="funcname"><br>');
document.writeln('<a class="searchbox-body" href="../../../_variables/index.html">Variable<\/a>: ');
document.writeln('<input type="text" size=10 value="" name="varname"><br>');
document.writeln('<a class="searchbox-body" href="../../../_constants/index.html">Constant<\/a>: ');
document.writeln('<input type="text" size=10 value="" name="constname"><br>');
document.writeln('<a class="searchbox-body" href="../../../_tables/index.html">Table<\/a>: ');
document.writeln('<input type="text" size=10 value="" name="tablename"><br>');
document.writeln('<input type="submit" class="searchbox-button" value="Search">');
document.writeln('<\/form>');
document.writeln('<\/td><\/tr><\/table>');
document.writeln('<\/td><\/tr><\/table>');
// -->
</script>
<div id="search-popup" class="searchpopup"><p id="searchpopup-title" class="searchpopup-title">title</p><div id="searchpopup-body" class="searchpopup-body">Body</div><p class="searchpopup-close"><a href="javascript:gwCloseActive()">[close]</a></p></div>
<h2 class="details-heading"><a href="./index.html">/rsc/fonts/bootstrap/</a> -> <a href="glyphicons-halflings-regular.svg.source.html">glyphicons-halflings-regular.svg</a> (summary)</h2>
<div class="details-summary">
<p class="viewlinks">[<a href="glyphicons-halflings-regular.svg.source.html">Source view</a>]
[<a href="javascript:window.print();">Print</a>]
[<a href="../../../_stats.html">Project Stats</a>]</p>
<p><b>(no description)</b></p>
<table>
<tr><td align="right">File Size: </td><td>288 lines (109 kb)</td></tr>
<tr><td align="right">Included or required:</td><td>0 times</td></tr>
<tr><td align="right" valign="top">Referenced: </td><td>0 times</td></tr>
<tr><td align="right" valign="top">Includes or requires: </td><td>0 files</td></tr>
</table>
</div>
<br><div class="details-funclist">
</div>
<!-- A link to the phpxref site in your customized footer file is appreciated ;-) -->
<br><hr>
<table width="100%">
<tr><td>Generated: Sat Nov 21 22:13:19 2015</td>
<td align="right"><i>Cross-referenced by <a href="http://phpxref.sourceforge.net/">PHPXref 0.7.1</a></i></td>
</tr>
</table>
</body></html>
| mgsolipa/b2evolution_phpxref | rsc/fonts/bootstrap/glyphicons-halflings-regular.svg.html | HTML | gpl-2.0 | 5,085 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
16129,
1018,
1012,
1014,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
8917,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<div class="divTable paleBlueRows" style="color:black">
<div class="divTableBody">
<div class="divTableRow">
<div class="divTableCell">Name:</div>
<div class="divTableCell">Pessoal do Augusto/div>
</div>
<div class="divTableRow">
<div class="divTableCell">Advisor:</div>
<div class="divTableCell"></div>
</div>
<div class="divTableRow">
<div class="divTableCell">Research interest:</div>
<div class="divTableCell"></div>
</div>
<div class="divTableRow">
<div class="divTableCell">E-mail:</div>
<div class="divTableCell"></div>
</div>
<div class="divTableRow">
<div class="divTableCell">Personal hobbies:</div>
<div class="divTableCell"></div>
</div>
<div class="divTableRow">
<div class="divTableCell">Others things:</div>
<div class="divTableCell"></div>
</div>
</div>
</div>
| neuroimagem-pucrs/neuroimagem-pucrs.github.io | team/pessoal_augusto_popup.html | HTML | apache-2.0 | 1,025 | [
30522,
1026,
4487,
2615,
2465,
1027,
1000,
4487,
2615,
10880,
5122,
16558,
13094,
15568,
1000,
2806,
1027,
1000,
3609,
1024,
2304,
1000,
1028,
1026,
4487,
2615,
2465,
1027,
1000,
4487,
2615,
10880,
23684,
1000,
1028,
1026,
4487,
2615,
2465,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
moduleForComponent('stage-details', 'Integration | Component | stage details', {
integration: true
});
test('it renders', function(assert) {
assert.expect(2);
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.on('myAction', function(val) { ... });
this.render(hbs`{{stage-details}}`);
assert.equal(this.$().text().trim(), '');
// Template block usage:
this.render(hbs`
{{#stage-details}}
template block text
{{/stage-details}}
`);
assert.equal(this.$().text().trim(), 'template block text');
});
| AcalephStorage/kontinuous-ui | tests/integration/components/stage-details-test.js | JavaScript | apache-2.0 | 681 | [
30522,
12324,
1063,
11336,
29278,
9006,
29513,
3372,
1010,
3231,
1065,
2013,
1005,
7861,
5677,
1011,
24209,
3490,
2102,
1005,
1025,
12324,
1044,
5910,
2013,
1005,
16129,
8237,
2015,
1011,
23881,
1011,
3653,
9006,
22090,
1005,
1025,
11336,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package uk.ac.ebi.spot.webulous.entity;
import org.semanticweb.owlapi.model.OWLEntity;
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.model.OWLOntologyChange;
import uk.ac.ebi.spot.webulous.model.OWLEntityCreationSet;
import java.util.ArrayList;
import java.util.List;/*
* Copyright (C) 2007, University of Manchester
*
* Modifications to the initial code base are copyright of their
* respective authors, or their employers as appropriate. Authorship
* of the modifications may be determined from the ChangeLog placed at
* the end of this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Author: Simon Jupp<br>
* Date: Jan 4, 2011<br>
* The University of Manchester<br>
* Bio-Health Informatics Group<br>
*/
public class SimpleOWLEntityCreationSet<E extends OWLEntity> implements OWLEntityCreationSet{
private E owlEntity;
private List<OWLOntologyChange> changes;
public SimpleOWLEntityCreationSet(E owlEntity, List<? extends OWLOntologyChange> changes) {
this.owlEntity = owlEntity;
this.changes = new ArrayList<OWLOntologyChange>(changes);
}
public SimpleOWLEntityCreationSet(E owlEntity, OWLOntology ontology) {
this.owlEntity = owlEntity;
changes = new ArrayList<OWLOntologyChange>();
// changes.add(new AddEntity(ontology, owlEntity, null));
}
public E getOWLEntity() {
return owlEntity;
}
public List<? extends OWLOntologyChange> getOntologyChanges() {
return changes;
}
} | EBISPOT/webulous | populous-oppl/src/main/java/uk/ac/ebi/spot/webulous/entity/SimpleOWLEntityCreationSet.java | Java | apache-2.0 | 2,234 | [
30522,
7427,
2866,
1012,
9353,
1012,
1041,
5638,
1012,
3962,
1012,
4773,
16203,
1012,
9178,
1025,
12324,
8917,
1012,
21641,
8545,
2497,
1012,
13547,
9331,
2072,
1012,
2944,
1012,
13547,
4765,
3012,
1025,
12324,
8917,
1012,
21641,
8545,
2497... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (C) 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/irq.h>
#include <linux/irqdomain.h>
#include <linux/io.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/stmp_device.h>
#include <asm/exception.h>
#include "irqchip.h"
#define HW_ICOLL_VECTOR 0x0000
#define HW_ICOLL_LEVELACK 0x0010
#define HW_ICOLL_CTRL 0x0020
#define HW_ICOLL_STAT_OFFSET 0x0070
#define HW_ICOLL_INTERRUPTn_SET(n) (0x0124 + (n) * 0x10)
#define HW_ICOLL_INTERRUPTn_CLR(n) (0x0128 + (n) * 0x10)
#define BM_ICOLL_INTERRUPTn_ENABLE 0x00000004
#define BV_ICOLL_LEVELACK_IRQLEVELACK__LEVEL0 0x1
#define ICOLL_NUM_IRQS 128
static void __iomem *icoll_base;
static struct irq_domain *icoll_domain;
static void icoll_ack_irq(struct irq_data *d)
{
/*
* The Interrupt Collector is able to prioritize irqs.
* Currently only level 0 is used. So acking can use
* BV_ICOLL_LEVELACK_IRQLEVELACK__LEVEL0 unconditionally.
*/
__raw_writel(BV_ICOLL_LEVELACK_IRQLEVELACK__LEVEL0,
icoll_base + HW_ICOLL_LEVELACK);
}
static void icoll_mask_irq(struct irq_data *d)
{
__raw_writel(BM_ICOLL_INTERRUPTn_ENABLE,
icoll_base + HW_ICOLL_INTERRUPTn_CLR(d->hwirq));
}
static void icoll_unmask_irq(struct irq_data *d)
{
__raw_writel(BM_ICOLL_INTERRUPTn_ENABLE,
icoll_base + HW_ICOLL_INTERRUPTn_SET(d->hwirq));
}
static struct irq_chip mxs_icoll_chip = {
.irq_ack = icoll_ack_irq,
.irq_mask = icoll_mask_irq,
.irq_unmask = icoll_unmask_irq,
};
asmlinkage void __exception_irq_entry icoll_handle_irq(struct pt_regs *regs)
{
u32 irqnr;
irqnr = __raw_readl(icoll_base + HW_ICOLL_STAT_OFFSET);
__raw_writel(irqnr, icoll_base + HW_ICOLL_VECTOR);
irqnr = irq_find_mapping(icoll_domain, irqnr);
handle_IRQ(irqnr, regs);
}
static int icoll_irq_domain_map(struct irq_domain *d, unsigned int virq,
irq_hw_number_t hw)
{
irq_set_chip_and_handler(virq, &mxs_icoll_chip, handle_level_irq);
set_irq_flags(virq, IRQF_VALID);
return 0;
}
static struct irq_domain_ops icoll_irq_domain_ops = {
.map = icoll_irq_domain_map,
.xlate = irq_domain_xlate_onecell,
};
static int __init icoll_of_init(struct device_node *np,
struct device_node *interrupt_parent)
{
icoll_base = of_iomap(np, 0);
WARN_ON(!icoll_base);
/*
* Interrupt Collector reset, which initializes the priority
* for each irq to level 0.
*/
stmp_reset_block(icoll_base + HW_ICOLL_CTRL);
icoll_domain = irq_domain_add_linear(np, ICOLL_NUM_IRQS,
&icoll_irq_domain_ops, NULL);
return icoll_domain ? 0 : -ENODEV;
}
IRQCHIP_DECLARE(mxs, "fsl,icoll", icoll_of_init);
| dperezde/little-penguin | linux-eudyptula/drivers/irqchip/irq-mxs.c | C | gpl-2.0 | 3,400 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2268,
1011,
2230,
2489,
15782,
2571,
20681,
1010,
4297,
1012,
2035,
2916,
9235,
1012,
1008,
1008,
2023,
2565,
2003,
2489,
4007,
1025,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1998,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.