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 |
|---|---|---|---|---|---|---|---|---|---|
/*
* NOTE: This copyright does *not* cover user programs that use HQ
* program services by normal system calls through the application
* program interfaces provided as part of the Hyperic Plug-in Development
* Kit or the Hyperic Client Development Kit - this is merely considered
* normal use of the program, and does *not* fall under the heading of
* "derived work".
*
* Copyright (C) [2004, 2005, 2006], Hyperic, Inc.
* This file is part of HQ.
*
* HQ is free software; you can redistribute it and/or modify
* it under the terms version 2 of the GNU General Public License as
* published by the Free Software Foundation. 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-1307
* USA.
*/
package org.hyperic.hq.ui.util.minitab;
/**
* A simple bean that represents a subminitab in the monitor
* subsection.
*/
public class SubMiniTab {
//-------------------------------------instance variables
private String count;
private String id;
private String key;
private String name;
private String param;
private Boolean selected;
//-------------------------------------constructors
public SubMiniTab() {
super();
}
//-------------------------------------public methods
public String getCount() {
return count;
}
public void setCount(String s) {
count = s;
}
public String getId() {
return id;
}
public void setId(String s) {
id = s;
}
public String getKey() {
return key;
}
public void setKey(String s) {
key = s;
}
public String getName() {
return name;
}
public void setName(String s) {
name = s;
}
public String getParam() {
return param;
}
public void setParam(String s) {
param = s;
}
public Boolean getSelected() {
return selected;
}
public void setSelected(Boolean b) {
selected = b;
}
public String toString() {
StringBuffer b = new StringBuffer("{");
b.append("name=").append(name);
b.append(" id=").append(id);
b.append(" count=").append(count);
b.append(" key=").append(key);
b.append(" param=").append(param);
b.append(" selected=").append(selected);
return b.append("}").toString();
}
}
| cc14514/hq6 | hq-web/src/main/java/org/hyperic/hq/ui/util/minitab/SubMiniTab.java | Java | unlicense | 2,754 | [
30522,
1013,
1008,
1008,
3602,
1024,
2023,
9385,
2515,
1008,
2025,
1008,
3104,
5310,
3454,
2008,
2224,
16260,
1008,
2565,
2578,
2011,
3671,
2291,
4455,
2083,
1996,
4646,
1008,
2565,
19706,
3024,
2004,
2112,
1997,
1996,
23760,
2594,
13354,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
# Welcome to your ATS Blog
It doesn't work yet. :(
| soundobj/angular-blog | posts/welcome/content.md | Markdown | mit | 52 | [
30522,
1001,
6160,
2000,
2115,
2012,
2015,
9927,
2009,
2987,
1005,
1056,
2147,
2664,
1012,
1024,
1006,
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,
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... |
/**
* Genji Scrum Tool and Issue Tracker
* Copyright (C) 2015 Steinbeis GmbH & Co. KG Task Management Solutions
* <a href="http://www.trackplus.com">Genji Scrum Tool</a>
*
* 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/>.
*/
/* $Id:$ */
package com.aurel.track.admin.customize.category.filter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import com.aurel.track.admin.customize.category.filter.tree.design.FieldExpressionInTreeTO;
import com.aurel.track.admin.customize.category.filter.tree.design.FieldExpressionSimpleTO;
import com.aurel.track.admin.customize.category.filter.tree.design.FilterSelectsListsLoader;
import com.aurel.track.admin.customize.role.FieldsRestrictionsToRoleBL;
import com.aurel.track.admin.project.ProjectBL;
import com.aurel.track.beans.ILabelBean;
import com.aurel.track.beans.TFieldConfigBean;
import com.aurel.track.beans.TPersonBean;
import com.aurel.track.beans.TProjectBean;
import com.aurel.track.beans.TQueryRepositoryBean;
import com.aurel.track.beans.TReportLayoutBean;
import com.aurel.track.fieldType.constants.SystemFields;
import com.aurel.track.fieldType.runtime.base.IFieldTypeRT;
import com.aurel.track.fieldType.runtime.bl.FieldRuntimeBL;
import com.aurel.track.fieldType.runtime.custom.text.CustomDoubleRT;
import com.aurel.track.fieldType.runtime.matchers.MatchRelations;
import com.aurel.track.fieldType.runtime.matchers.converter.AccountingTimeMatcherConverter;
import com.aurel.track.fieldType.runtime.matchers.converter.DoubleMatcherConverter;
import com.aurel.track.fieldType.runtime.matchers.converter.MatcherConverter;
import com.aurel.track.fieldType.runtime.matchers.converter.SelectMatcherConverter;
import com.aurel.track.fieldType.runtime.matchers.design.AccountingTimeMatcherDT;
import com.aurel.track.fieldType.runtime.matchers.design.DoubleMatcherDT;
import com.aurel.track.fieldType.runtime.matchers.design.IMatcherDT;
import com.aurel.track.fieldType.runtime.matchers.design.IMatcherValue;
import com.aurel.track.fieldType.runtime.matchers.design.MatcherDatasourceContext;
import com.aurel.track.fieldType.runtime.matchers.design.SelectMatcherDT;
import com.aurel.track.fieldType.runtime.matchers.run.MatcherContext;
import com.aurel.track.fieldType.runtime.system.select.SystemManagerRT;
import com.aurel.track.fieldType.types.FieldTypeManager;
import com.aurel.track.item.consInf.RaciRole;
import com.aurel.track.itemNavigator.layout.column.ColumnFieldsBL;
import com.aurel.track.resources.LocalizeUtil;
import com.aurel.track.util.GeneralUtils;
import com.aurel.track.util.IntegerStringBean;
public class FieldExpressionBL {
//the following names should comply with the setter field names
//in the filter actions which will be set as a result of a form submit
public static String MATCHER_RELATION_BASE_NAME = "MatcherRelationMap";
public static String VALUE_BASE_NAME = "DisplayValueMap";
public static String VALUE_BASE_ITEM_ID = "DisplayValue";
public static String SIMPLE = "simple";
public static String IN_TREE = "inTree";
public static String CASCADING_PART = "CascadingPart";
public static String FIELD_NAME = "fieldMap";
public static String FIELD_MOMENT_NAME = "fieldMomentMap";
public static String OPERATION_NAME = "operationMap";
public static String PARENTHESIS_OPEN_NAME = "parenthesisOpenedMap";
public static String PARENTHESIS_CLOSED_NAME = "parenthesisClosedMap";
public static String NEGATION_NAME = "negationMap";
public static String MATCH_RELATION_PREFIX = "admin.customize.queryFilter.opt.relation.";
/**
* Prepares a JSON string after matcher relation change
* @param baseName
* @param stringValue
* @param fieldID
* @param matcherID
* @param modifiable
* @param personID
* @param locale
* @return
*/
static String selectMatcher(Integer[] projectIDs, Integer[] itemTypeIDs, String baseName, String baseItemId, Integer index, String stringValue,
Integer fieldID, Integer matcherID, boolean modifiable, TPersonBean personBean, Locale locale) {
FieldExpressionInTreeTO fieldExpressionInTreeTO =
configureValueDetails(projectIDs, itemTypeIDs, baseName, baseItemId, index, stringValue, fieldID, matcherID, modifiable, personBean, locale);
return FilterJSON.getFieldExpressionValueJSON(fieldExpressionInTreeTO.getValueItemId(), fieldExpressionInTreeTO.isNeedMatcherValue(),
fieldExpressionInTreeTO.getValueRenderer(), fieldExpressionInTreeTO.getJsonConfig());
}
/**
* Reload part of the filter expression after a field change: possible matchers and the value part
* @param baseName
* @param stringValue
* @param index
* @param fieldID
* @param matcherID
* @param personID
* @param locale
* @param withParameter
* @return
*/
static String selectField(Integer[] projectIDs, Integer[] itemTypeIDs, String baseName, String baseItemId, Integer index, String stringValue, Integer fieldID, Integer matcherID,
boolean modifiable, TPersonBean personBean, Locale locale, boolean withParameter) {
List<IntegerStringBean> matcherRelations = getMatchers(fieldID, withParameter, true, locale);
if (matcherID == null) {
//set the matcher relation to the first when not yet selected
matcherID = matcherRelations.get(0).getValue();
} else {
Iterator<IntegerStringBean> iterator = matcherRelations.iterator();
boolean found = false;
while (iterator.hasNext()) {
IntegerStringBean integerStringBean = iterator.next();
if (matcherID.equals(integerStringBean.getValue())) {
found = true;
break;
}
}
if (!found) {
//change the matcher relation to the first
//only if the old one is not found among the new matcherRelations list
matcherID = matcherRelations.get(0).getValue();
}
}
FieldExpressionInTreeTO fieldExpressionInTreeTO =
configureValueDetails(projectIDs, itemTypeIDs, baseName, baseItemId, index, stringValue, fieldID, matcherID, modifiable, personBean, locale);
String valueJSON = FilterJSON.getFieldExpressionValueBaseJSON(fieldExpressionInTreeTO.getValueItemId(), fieldExpressionInTreeTO.isNeedMatcherValue(),
fieldExpressionInTreeTO.getValueRenderer(), fieldExpressionInTreeTO.getJsonConfig(), true);
return FilterJSON.getFieldExpressionMatcherAndValueValueJSON(matcherRelations, matcherID, valueJSON);
}
/**
* Prepares a JSON string after matcher relation or field change
* @param name
* @param stringValue
* @param fieldID
* @param matcherID
* @param modifiable
* @param personID
* @param locale
* @return
*/
private static FieldExpressionInTreeTO configureValueDetails(Integer[] projectIDs, Integer[] itemTypeIDs, String baseName, String baseItemId, Integer index, String stringValue,
Integer fieldID, Integer matcherID, boolean modifiable, TPersonBean personBean, Locale locale) {
FieldExpressionInTreeTO fieldExpressionInTreeTO = new FieldExpressionInTreeTO();
fieldExpressionInTreeTO.setField(fieldID);
fieldExpressionInTreeTO.setSelectedMatcher(matcherID);
MatcherConverter matcherConverter = null;
if (fieldID>0) {
//system or custom field
IFieldTypeRT fieldTypeRT = FieldTypeManager.getFieldTypeRT(fieldID);
if (fieldTypeRT!=null) {
matcherConverter = fieldTypeRT.getMatcherConverter();
}
} else {
//pseudo field
matcherConverter = getPseudoFieldMatcherConverter(fieldID);
}
Object value = null;
if (matcherConverter!=null) {
value = matcherConverter.fromValueString(stringValue, locale, matcherID);
}
fieldExpressionInTreeTO.setValue(value);
Integer[] ancestorProjectIDs = null;
if (projectIDs==null || projectIDs.length==0) {
//none of the projects is selected -> get the other lists datasource as all available projects would be selected
List<TProjectBean> projectBeans = ProjectBL.loadUsedProjectsFlat(personBean.getObjectID());
if (projectBeans!=null && !projectBeans.isEmpty()) {
projectIDs = GeneralUtils.createIntegerArrFromCollection(GeneralUtils.createIntegerListFromBeanList(projectBeans));
ancestorProjectIDs = projectIDs;
}
} else {
ancestorProjectIDs = ProjectBL.getAncestorProjects(projectIDs);
}
setExpressionValue(fieldExpressionInTreeTO, projectIDs, ancestorProjectIDs, itemTypeIDs, baseName, baseItemId, index, modifiable, personBean, locale);
return fieldExpressionInTreeTO;
}
/**
* Prepares a FieldExpressionSimpleTO for rendering:
* Only the matcher and the value controls are "active",
* field is fixed (only label is rendered for field)
* @param fieldID
* @param matcherID
* @param modifiable
* @param withParameter
* @param personID
* @param locale
* @param value
* @return
*/
public static FieldExpressionSimpleTO loadFilterExpressionSimple(Integer fieldID, Integer[] projectIDs, Integer[] itemTypeIDs,
Integer matcherID, boolean modifiable, boolean withParameter, TPersonBean personBean,
Locale locale, Map<Integer, String> fieldLabelsMap, Object value) {
FieldExpressionSimpleTO fieldExpressionSimpleTO = new FieldExpressionSimpleTO();
fieldExpressionSimpleTO.setField(fieldID);
fieldExpressionSimpleTO.setSelectedMatcher(matcherID);
fieldExpressionSimpleTO.setValue(value);
fieldExpressionSimpleTO.setFieldLabel(fieldLabelsMap.get(fieldID));
fieldExpressionSimpleTO.setMatcherName(getName(SIMPLE + MATCHER_RELATION_BASE_NAME, fieldID));
fieldExpressionSimpleTO.setMatcherItemId(getItemId(SIMPLE + MATCHER_RELATION_BASE_NAME, fieldID));
List<IntegerStringBean> matchers = getMatchers(fieldID, withParameter, false, locale);
//add empty matcher for FieldExpressionSimpleTO to give the possibility to not filter by this field
matchers.add(0, new IntegerStringBean("-", MatchRelations.NO_MATCHER));
fieldExpressionSimpleTO.setMatchersList(matchers);
Integer[] ancestorProjectIDs = null;
if (projectIDs==null || projectIDs.length==0) {
//none of the projects is selected -> get the other lists datasource as all available projects would be selected
List<TProjectBean> projectBeans = ProjectBL.loadUsedProjectsFlat(personBean.getObjectID());
if (projectBeans!=null && !projectBeans.isEmpty()) {
projectIDs = GeneralUtils.createIntegerArrFromCollection(GeneralUtils.createIntegerListFromBeanList(projectBeans));
ancestorProjectIDs = projectIDs;
}
} else {
ancestorProjectIDs = ProjectBL.getAncestorProjects(projectIDs);
}
setExpressionValue(fieldExpressionSimpleTO, projectIDs, ancestorProjectIDs, itemTypeIDs,
SIMPLE + VALUE_BASE_NAME, SIMPLE + VALUE_BASE_ITEM_ID, fieldID, modifiable, personBean, locale);
return fieldExpressionSimpleTO;
}
/**
* Prepares a FieldExpressionSimpleTO created from a parameterized FieldExpressionInTreeTO for rendering:
* @param fieldExpressionSimpleTO
* @param projectIDs
* @param showClosed
* @param personID
* @param locale
* @param index
* @return
*/
public static FieldExpressionSimpleTO loadFieldExpressionSimpleForInTreeParameter(
FieldExpressionSimpleTO fieldExpressionSimpleTO, Integer[] projectIDs, Integer[] itemTypeIDs,
TPersonBean personBean, Locale locale, Map<Integer, String> fieldLabelsMap, int index) {
Integer fieldID = fieldExpressionSimpleTO.getField();
fieldExpressionSimpleTO.setIndex(index);
fieldExpressionSimpleTO.setFieldLabel(fieldLabelsMap.get(fieldID));
setMatchers(fieldExpressionSimpleTO, true, locale);
fieldExpressionSimpleTO.setMatcherName(getName(IN_TREE + MATCHER_RELATION_BASE_NAME, index));
fieldExpressionSimpleTO.setMatcherItemId(getItemId(IN_TREE + MATCHER_RELATION_BASE_NAME, index));
Integer[] ancestorProjectIDs = null;
if (projectIDs==null || projectIDs.length==0) {
//none of the projects is selected -> get the other lists datasource as all available projects would be selected
List<TProjectBean> projectBeans = ProjectBL.loadUsedProjectsFlat(personBean.getObjectID());
if (projectBeans!=null && !projectBeans.isEmpty()) {
projectIDs = GeneralUtils.createIntegerArrFromCollection(GeneralUtils.createIntegerListFromBeanList(projectBeans));
ancestorProjectIDs = projectIDs;
}
} else {
ancestorProjectIDs = ProjectBL.getAncestorProjects(projectIDs);
}
setExpressionValue(fieldExpressionSimpleTO, projectIDs, ancestorProjectIDs, itemTypeIDs,
IN_TREE + VALUE_BASE_NAME, IN_TREE + VALUE_BASE_ITEM_ID, index, true, personBean, locale);
return fieldExpressionSimpleTO;
}
/**
* Set the matchers for parameter fields
* @param fieldExpressionSimpleTO
* @param locale
* @return
*/
public static FieldExpressionSimpleTO setMatchers(FieldExpressionSimpleTO fieldExpressionSimpleTO, boolean isTree, Locale locale) {
List<IntegerStringBean> matcherRelations = getMatchers(fieldExpressionSimpleTO.getField(), false, isTree, locale);
//add empty matcher for FieldExpressionSimpleTO to give the possibility to
//not to set parameter for this field consequently do not filter by this field
//TODO do we need this empty matcher for parameters or not?
matcherRelations.add(0, new IntegerStringBean("", MatchRelations.NO_MATCHER));
fieldExpressionSimpleTO.setMatchersList(matcherRelations);
Integer matcherID = fieldExpressionSimpleTO.getSelectedMatcher();
if (matcherID==null || matcherID.equals(MatcherContext.PARAMETER)) {
//matcher was parameter, now set it to the first
matcherID = matcherRelations.get(0).getValue();
fieldExpressionSimpleTO.setSelectedMatcher(matcherID);
}
return fieldExpressionSimpleTO;
}
/**
* Prepares the "in tree" filter expressions for rendering
* @param fieldExpressionInTreeList
* @param modifiable
* @param personID
* @param locale
* @param instant
* @param withFieldMoment
*/
public static void loadFilterExpressionInTreeList(List<FieldExpressionInTreeTO> fieldExpressionInTreeList, Integer[] projectIDs,
Integer[] itemTypeIDs, boolean modifiable, TPersonBean personBean, Locale locale, boolean withParameter, boolean withFieldMoment) {
if (fieldExpressionInTreeList!=null && !fieldExpressionInTreeList.isEmpty()) {
List<IntegerStringBean> fieldsWithMatcher = getAllMatcherColumns(projectIDs, personBean.getObjectID(), locale);
List<IntegerStringBean> localizedOperationList = getLocalizedOperationList(locale);
List<IntegerStringBean> parenthesisOpenList = createParenthesisOpenList();
List<IntegerStringBean> parenthesisClosedList = createParenthesisClosedList();
List<IntegerStringBean> fieldMoments = null;
if (withFieldMoment) {
fieldMoments = prepareFieldMomentList(locale);
}
Integer[] ancestorProjects = null;
if (projectIDs==null || projectIDs.length==0) {
//none of the projects is selected -> get the other lists datasource as all available projects would be selected
List<TProjectBean> projectBeans = ProjectBL.loadUsedProjectsFlat(personBean.getObjectID());
if (projectBeans!=null && !projectBeans.isEmpty()) {
projectIDs = GeneralUtils.createIntegerArrFromCollection(GeneralUtils.createIntegerListFromBeanList(projectBeans));
ancestorProjects = projectIDs;
}
} else {
ancestorProjects = ProjectBL.getAncestorProjects(projectIDs);
}
int i=0;
for (FieldExpressionInTreeTO fieldExpressionInTreeTO : fieldExpressionInTreeList) {
fieldExpressionInTreeTO.setOperationsList(localizedOperationList);
fieldExpressionInTreeTO.setParenthesisOpenList(parenthesisOpenList);
fieldExpressionInTreeTO.setParenthesisClosedList(parenthesisClosedList);
if (withFieldMoment) {
fieldExpressionInTreeTO.setFieldMomentsList(fieldMoments);
}
loadFieldExpressionInTree(fieldExpressionInTreeTO, projectIDs, ancestorProjects, itemTypeIDs, fieldsWithMatcher,
modifiable, personBean, locale, withParameter, withFieldMoment, i++);
}
}
}
/**
* Prepares the "in tree" filter expressions for rendering
* @param index
* @param operation the default operation
* @param modifiable
* @param personID
* @param locale
* @param instant
* @param withFieldMoment
* @return
*/
static FieldExpressionInTreeTO loadFilterExpressionInTree(Integer[] projectIDs, Integer[] itemTypeIDs, Integer fieldID, Integer index,
boolean modifiable, TPersonBean personBean, Locale locale, boolean withParameter, boolean withFieldMoment) {
List<IntegerStringBean> fieldsWithMatcher = getAllMatcherColumns(projectIDs, personBean.getObjectID(), locale);
FieldExpressionInTreeTO fieldExpressionInTreeTO = new FieldExpressionInTreeTO();
List<IntegerStringBean> operationList = getLocalizedOperationList(locale);
fieldExpressionInTreeTO.setOperationsList(operationList);
//if added from the first add (For adds from a filter expression
//it takes the operation from the actual filter expression as default on the client side)
fieldExpressionInTreeTO.setSelectedOperation(QNode.OR);
fieldExpressionInTreeTO.setField(fieldID);
fieldExpressionInTreeTO.setParenthesisOpenList(createParenthesisOpenList());
fieldExpressionInTreeTO.setParenthesisClosedList(createParenthesisClosedList());
if (withFieldMoment) {
List<IntegerStringBean> fieldMoments = prepareFieldMomentList(locale);
fieldExpressionInTreeTO.setFieldMomentsList(fieldMoments);
fieldExpressionInTreeTO.setFieldMoment(fieldMoments.get(0).getValue());
}
Integer[] ancestorProjects = null;
if (projectIDs==null || projectIDs.length==0) {
//none of the projects is selected -> get the other lists datasource as all available projects would be selected
List<TProjectBean> projectBeans = ProjectBL.loadUsedProjectsFlat(personBean.getObjectID());
if (projectBeans!=null && !projectBeans.isEmpty()) {
projectIDs = GeneralUtils.createIntegerArrFromCollection(GeneralUtils.createIntegerListFromBeanList(projectBeans));
ancestorProjects = projectIDs;
}
} else {
ancestorProjects = ProjectBL.getAncestorProjects(projectIDs);
}
loadFieldExpressionInTree(fieldExpressionInTreeTO, projectIDs, ancestorProjects, itemTypeIDs, fieldsWithMatcher,
modifiable, personBean, locale, withParameter, withFieldMoment, index);
return fieldExpressionInTreeTO;
}
/**
* Get all matcher columns
* @param projectIDs
* @param personID
* @param locale
* @return
*/
private static List<IntegerStringBean> getAllMatcherColumns(Integer[] projectIDs, Integer personID, Locale locale) {
List<TFieldConfigBean> fieldConfigsWithMatcher =
FieldRuntimeBL.getDefaultFieldConfigsWithMatcher(locale);
List<IntegerStringBean> fieldsWithMatcher = new LinkedList<IntegerStringBean>();
for (TFieldConfigBean fieldConfigBean : fieldConfigsWithMatcher) {
fieldsWithMatcher.add(new IntegerStringBean(fieldConfigBean.getLabel(), fieldConfigBean.getField()));
}
fieldsWithMatcher.addAll(getPseudoColumns(personID, locale));
Collections.sort(fieldsWithMatcher);
return fieldsWithMatcher;
}
/**
* Gets the pseudo columns allowed to see
* @param projectIDs
* @param locale
* @return
*/
private static List<IntegerStringBean> getPseudoColumns(Integer personID, Locale locale) {
boolean hasAccounting = ColumnFieldsBL.hasAccounting(personID);
Map<Integer, Boolean> pseudoFieldsVisible = ColumnFieldsBL.getVisisblePseudoFields(personID, hasAccounting);
List<IntegerStringBean> fieldsWithMatcher = new LinkedList<IntegerStringBean>();
Boolean watcherFieldsAllowed = pseudoFieldsVisible.get(FieldsRestrictionsToRoleBL.PSEUDO_COLUMNS.WATCHERS);
if (watcherFieldsAllowed!=null && watcherFieldsAllowed.booleanValue()) {
fieldsWithMatcher.add(new IntegerStringBean(LocalizeUtil.getLocalizedTextFromApplicationResources(TReportLayoutBean.PSEUDO_COLUMN_LABELS.CONSULTANT_LIST, locale), TReportLayoutBean.PSEUDO_COLUMNS.CONSULTANT_LIST));
fieldsWithMatcher.add(new IntegerStringBean(LocalizeUtil.getLocalizedTextFromApplicationResources(TReportLayoutBean.PSEUDO_COLUMN_LABELS.INFORMANT_LIST, locale), TReportLayoutBean.PSEUDO_COLUMNS.INFORMANT_LIST));
}
Boolean ownExpense = pseudoFieldsVisible.get(FieldsRestrictionsToRoleBL.PSEUDO_COLUMNS.MY_EXPENSES);
if (ownExpense!=null && ownExpense.booleanValue()) {
fieldsWithMatcher.add(new IntegerStringBean(LocalizeUtil.getLocalizedTextFromApplicationResources(TReportLayoutBean.PSEUDO_COLUMN_LABELS.MY_EXPENSE_TIME, locale), TReportLayoutBean.PSEUDO_COLUMNS.MY_EXPENSE_TIME));
fieldsWithMatcher.add(new IntegerStringBean(LocalizeUtil.getLocalizedTextFromApplicationResources(TReportLayoutBean.PSEUDO_COLUMN_LABELS.MY_EXPENSE_COST, locale), TReportLayoutBean.PSEUDO_COLUMNS.MY_EXPENSE_COST));
}
Boolean viewAllExpenses = pseudoFieldsVisible.get(FieldsRestrictionsToRoleBL.PSEUDO_COLUMNS.ALL_EXPENSES);
if (viewAllExpenses!=null && viewAllExpenses.booleanValue()) {
fieldsWithMatcher.add(new IntegerStringBean(LocalizeUtil.getLocalizedTextFromApplicationResources(TReportLayoutBean.PSEUDO_COLUMN_LABELS.TOTAL_EXPENSE_TIME, locale), TReportLayoutBean.PSEUDO_COLUMNS.TOTAL_EXPENSE_TIME));
fieldsWithMatcher.add(new IntegerStringBean(LocalizeUtil.getLocalizedTextFromApplicationResources(TReportLayoutBean.PSEUDO_COLUMN_LABELS.TOTAL_EXPENSE_COST, locale), TReportLayoutBean.PSEUDO_COLUMNS.TOTAL_EXPENSE_COST));
}
Boolean planVisible = pseudoFieldsVisible.get(FieldsRestrictionsToRoleBL.PSEUDO_COLUMNS.PLAN);
if (planVisible!=null && planVisible.booleanValue()) {
fieldsWithMatcher.add(new IntegerStringBean(LocalizeUtil.getLocalizedTextFromApplicationResources(TReportLayoutBean.PSEUDO_COLUMN_LABELS.TOTAL_PLANNED_TIME, locale), TReportLayoutBean.PSEUDO_COLUMNS.TOTAL_PLANNED_TIME));
fieldsWithMatcher.add(new IntegerStringBean(LocalizeUtil.getLocalizedTextFromApplicationResources(TReportLayoutBean.PSEUDO_COLUMN_LABELS.TOTAL_PLANNED_COST, locale), TReportLayoutBean.PSEUDO_COLUMNS.TOTAL_PLANNED_COST));
fieldsWithMatcher.add(new IntegerStringBean(LocalizeUtil.getLocalizedTextFromApplicationResources(TReportLayoutBean.PSEUDO_COLUMN_LABELS.REMAINING_PLANNED_TIME, locale), TReportLayoutBean.PSEUDO_COLUMNS.REMAINING_PLANNED_TIME));
fieldsWithMatcher.add(new IntegerStringBean(LocalizeUtil.getLocalizedTextFromApplicationResources(TReportLayoutBean.PSEUDO_COLUMN_LABELS.REMAINING_PLANNED_COST, locale), TReportLayoutBean.PSEUDO_COLUMNS.REMAINING_PLANNED_COST));
}
Boolean budgetVisible = pseudoFieldsVisible.get(FieldsRestrictionsToRoleBL.PSEUDO_COLUMNS.BUDGET);
if (budgetVisible!=null && budgetVisible) {
fieldsWithMatcher.add(new IntegerStringBean(LocalizeUtil.getLocalizedTextFromApplicationResources(TReportLayoutBean.PSEUDO_COLUMN_LABELS.BUDGET_TIME, locale), TReportLayoutBean.PSEUDO_COLUMNS.BUDGET_TIME));
fieldsWithMatcher.add(new IntegerStringBean(LocalizeUtil.getLocalizedTextFromApplicationResources(TReportLayoutBean.PSEUDO_COLUMN_LABELS.BUDGET_COST, locale), TReportLayoutBean.PSEUDO_COLUMNS.BUDGET_COST));
}
return fieldsWithMatcher;
}
/**
* Populates an "in tree" filter expression
* @param fieldExpressionInTreeTO
* @param fieldsWithMatcher
* @param modifiable
* @param personID
* @param locale
* @param instant
* @param withFieldMoment
* @param index
*/
private static void loadFieldExpressionInTree(FieldExpressionInTreeTO fieldExpressionInTreeTO, Integer[] projectIDs,
Integer[] ancestorProjectIDs, Integer[] itemTypeIDs, List<IntegerStringBean> fieldsWithMatcher, boolean modifiable, TPersonBean personBean,
Locale locale, boolean withParameter, boolean withFieldMoment, int index) {
fieldExpressionInTreeTO.setIndex(index);
//field moment
if (withFieldMoment) {
Integer selectedFieldMoment = fieldExpressionInTreeTO.getFieldMoment();
if (selectedFieldMoment==null) {
fieldExpressionInTreeTO.setFieldMoment(Integer.valueOf(TQueryRepositoryBean.FIELD_MOMENT.NEW));
}
fieldExpressionInTreeTO.setFieldMomentName(getName(FIELD_MOMENT_NAME, index));
fieldExpressionInTreeTO.setWithFieldMoment(withFieldMoment);
}
//field
Integer fieldID = fieldExpressionInTreeTO.getField();
if (fieldID==null &&
fieldsWithMatcher!=null && !fieldsWithMatcher.isEmpty()) {
//new field expression: preselect the first available field
fieldID = fieldsWithMatcher.get(0).getValue();
fieldExpressionInTreeTO.setField(fieldID);
}
fieldExpressionInTreeTO.setFieldsList(fieldsWithMatcher);
fieldExpressionInTreeTO.setFieldName(getName(FIELD_NAME, index));
fieldExpressionInTreeTO.setFieldItemId(getItemId(FIELD_NAME, index));
//matcher
List<IntegerStringBean> matcherList = getMatchers(fieldID, withParameter, true, locale);
fieldExpressionInTreeTO.setMatchersList(matcherList);
Integer matcherID = fieldExpressionInTreeTO.getSelectedMatcher();
if (matcherID==null) {
//new field expression: preselect the first available matcher:
//in FieldExpressionInTreeTO no empty matcher is available (like in FieldExpressionSimpleTO)
if (matcherList!=null && !matcherList.isEmpty()) {
matcherID = matcherList.get(0).getValue();
fieldExpressionInTreeTO.setSelectedMatcher(matcherID);
}
}
fieldExpressionInTreeTO.setMatcherName(getName(IN_TREE + MATCHER_RELATION_BASE_NAME, index));
fieldExpressionInTreeTO.setMatcherItemId(getItemId(IN_TREE + MATCHER_RELATION_BASE_NAME, index));
//value
setExpressionValue(fieldExpressionInTreeTO, projectIDs, ancestorProjectIDs, itemTypeIDs, IN_TREE + VALUE_BASE_NAME, IN_TREE + VALUE_BASE_ITEM_ID, index, modifiable, personBean, locale);
fieldExpressionInTreeTO.setOperationName(getName(OPERATION_NAME, index));
fieldExpressionInTreeTO.setOperationItemId(getItemId(OPERATION_NAME, index));
fieldExpressionInTreeTO.setParenthesisOpenName(getName(PARENTHESIS_OPEN_NAME, index));
fieldExpressionInTreeTO.setParenthesisClosedName(getName(PARENTHESIS_CLOSED_NAME, index));
}
/**
* Set expression value attributes: needMatcherValue, matcherID, valueRenderer and JsonConfig string
* The field, the matcher (if it is the case) and the value object should be already set for FieldExpressionSimpleTO
* @param fieldExpressionSimpleTreeTO
* @param projectIDs
* @param ancestorProjectIDs
* @param itemTypeIDs
* @param baseName
* @param baseItemId
* @param index
* @param modifiable
* @param personID
* @param locale
*/
private static void setExpressionValue(FieldExpressionSimpleTO fieldExpressionSimpleTreeTO,
Integer[] projectIDs, Integer[] ancestorProjectIDs, Integer[] itemTypeIDs, String baseName, String baseItemId, Integer index,
boolean modifiable, TPersonBean personBean, Locale locale) {
Integer personID = personBean.getObjectID();
Integer matcherID = fieldExpressionSimpleTreeTO.getSelectedMatcher();
fieldExpressionSimpleTreeTO.setValueItemId(getItemId(baseItemId, index));
if (matcherID!=null) {
//do not force the matcher to a value if not specified because no matcher means no filtering by that field
//even if the field is always present (it is set as upper filter field)
//(it was set already to a value if if was the case)
boolean needMatcherValue = getNeedMatcherValue(matcherID);
fieldExpressionSimpleTreeTO.setNeedMatcherValue(needMatcherValue);
if (needMatcherValue) {
Integer fieldID = fieldExpressionSimpleTreeTO.getField();
IMatcherDT matcherDT = null;
Object possibleValues = null;
//for field expressions the "withParameter" is false for getting the datasoucre,
//because only the matcher is parameterized not the value
//but "initValueIfNull" is true to preselect the first entry if nothing selected
//do not show the closed entities in field expressions (typically used for release but it can be
//interpreted also for person (deactivated), deleted custom entries etc.)
MatcherDatasourceContext matcherDatasourceContext = new MatcherDatasourceContext(projectIDs, ancestorProjectIDs, itemTypeIDs, personBean, locale, false, true, false, false);
if (fieldID.intValue()>0) {
IFieldTypeRT fieldTypeRT = FieldTypeManager.getFieldTypeRT(fieldID);
if (fieldTypeRT!=null) {
matcherDT = fieldTypeRT.processLoadMatcherDT(fieldID);
possibleValues = fieldTypeRT.getMatcherDataSource(fieldExpressionSimpleTreeTO, matcherDatasourceContext, null);
}
} else {
matcherDT = getPseudoMatcherDT(fieldID);
possibleValues = getPseudoFieldMatcherDataSource(fieldExpressionSimpleTreeTO, matcherDatasourceContext);
}
if (matcherDT!=null) {
matcherDT.setRelation(matcherID);
fieldExpressionSimpleTreeTO.setValueRenderer(matcherDT.getMatchValueControlClass());
fieldExpressionSimpleTreeTO.setJsonConfig(matcherDT.getMatchValueJsonConfig(fieldID,
baseName, index, fieldExpressionSimpleTreeTO.getValue(), !modifiable, possibleValues, projectIDs, matcherID, locale, personID));
}
}
}
}
/**
* Gets the datasource for pseudo fields (only for lists)
* @param matcherValue
* @param matcherDatasourceContext
* @param parameterCode
* @return
*/
private static Object getPseudoFieldMatcherDataSource(IMatcherValue matcherValue, MatcherDatasourceContext matcherDatasourceContext) {
Integer fieldID = matcherValue.getField();
if (fieldID!=null) {
String raciRole;
switch (fieldID.intValue()) {
case TReportLayoutBean.PSEUDO_COLUMNS.CONSULTANT_LIST:
raciRole = RaciRole.CONSULTANT;
break;
case TReportLayoutBean.PSEUDO_COLUMNS.INFORMANT_LIST:
raciRole = RaciRole.INFORMANT;
break;
default:
//expense/budget/plan
return null;
}
Integer[] projects = matcherDatasourceContext.getProjectIDs();
Integer[] ancestorProjects = matcherDatasourceContext.getAncestorProjectIDs();
if (projects!=null && projects.length>0) {
List<ILabelBean> watcherList = FilterSelectsListsLoader.getConsultantsInformants(projects, ancestorProjects,
matcherDatasourceContext.getPersonBean().getObjectID(), false, raciRole, matcherDatasourceContext.getLocale());
if (matcherDatasourceContext.isInitValueIfNull() && matcherValue!=null && watcherList!=null && !watcherList.isEmpty()) {
Object value = matcherValue.getValue();
if (value==null) {
matcherValue.setValue(new Integer[] {watcherList.get(0).getObjectID()});
}
}
return watcherList;
}
}
return null;
}
/**
* Whether do we need a matcherValue field: for matcherRelations
* IS_NULL NOT_IS_NULL and LATER_AS_LASTLOGIN we do not need it
* @param matcherRelation
* @return
*/
public static boolean getNeedMatcherValue(Integer matcherRelation) {
if (matcherRelation==null) {
return false;
}
if (matcherRelation.equals(MatcherContext.PARAMETER)) {
return false;
}
switch(matcherRelation.intValue()) {
case MatchRelations.IS_NULL:
case MatchRelations.NOT_IS_NULL:
case MatchRelations.LATER_AS_LASTLOGIN:
case MatchRelations.SET:
case MatchRelations.RESET:
return false;
default:
return true;
}
}
/**
* Builds the name of the client side controls for submit
* @param name
* @param suffix
* @return
*/
private static String getName(String name, Integer suffix) {
StringBuilder stringBuilder = new StringBuilder();
return stringBuilder.append(name).append("[").append(suffix).append("]").toString();
}
/**
* Builds the name of the client side controls for submit
* @param name
* @param suffix
* @return
*/
private static String getItemId(String name, Integer suffix) {
StringBuilder stringBuilder = new StringBuilder();
return stringBuilder.append(name).append(suffix).toString();
}
/**
* Gets the localized operations
* @param locale
* @return
*/
private static List<IntegerStringBean> getLocalizedOperationList(Locale locale) {
List<IntegerStringBean> operationList = new ArrayList<IntegerStringBean>();
operationList.add(new IntegerStringBean(
LocalizeUtil.getLocalizedTextFromApplicationResources(
"admin.customize.queryFilter.opt.operation.and", locale), QNode.AND));
operationList.add(new IntegerStringBean(
LocalizeUtil.getLocalizedTextFromApplicationResources(
"admin.customize.queryFilter.opt.operation.or", locale), QNode.OR));
operationList.add(new IntegerStringBean(
LocalizeUtil.getLocalizedTextFromApplicationResources(
"admin.customize.queryFilter.opt.operation.notAnd", locale), QNode.NOT_AND));
operationList.add(new IntegerStringBean(
LocalizeUtil.getLocalizedTextFromApplicationResources(
"admin.customize.queryFilter.opt.operation.notOr", locale), QNode.NOT_OR));
return operationList;
}
//max number of parenthesis
private static final int MAX_PARENTHESIS_DEEP = 6;
/**
* Generate the parenthesisOpenList
* @return
*/
private static List<IntegerStringBean> createParenthesisOpenList() {
return getParenthesisList('(', MAX_PARENTHESIS_DEEP);
}
/**
* Generate the parenthesisClosedList
* @return
*/
private static List<IntegerStringBean> createParenthesisClosedList() {
return getParenthesisList(')', MAX_PARENTHESIS_DEEP);
}
/**
* Generate the parenthesis list
* @param parenthesis
* @param maxDeep
* @return
*/
private static List<IntegerStringBean> getParenthesisList(char parenthesis, int maxDeep) {
List<IntegerStringBean> parenthesisList = new ArrayList<IntegerStringBean>();
StringBuffer stringBuffer = new StringBuffer();
for (int i = 0; i < maxDeep; i++) {
parenthesisList.add(new IntegerStringBean(stringBuffer.toString(), Integer.valueOf(i)));
stringBuffer.append(parenthesis);
}
return parenthesisList;
}
/**
* Prepares the field moment list for notification filters
* @param locale
* @return
*/
private static List<IntegerStringBean> prepareFieldMomentList(Locale locale) {
List<IntegerStringBean> fieldMomentList = new ArrayList<IntegerStringBean>();
fieldMomentList.add
(new IntegerStringBean(LocalizeUtil.getLocalizedTextFromApplicationResources(
"common.opt.fieldMoment.new", locale),
Integer.valueOf(TQueryRepositoryBean.FIELD_MOMENT.NEW)));
fieldMomentList.add
(new IntegerStringBean(LocalizeUtil.getLocalizedTextFromApplicationResources(
"common.opt.fieldMoment.old", locale),
Integer.valueOf(TQueryRepositoryBean.FIELD_MOMENT.OLD)));
return fieldMomentList;
}
/**
* Get the matchers corresponding to the field
* @param fieldID
* @param withParameter
* @param inTree
* @param locale
* @return
*/
public static List<IntegerStringBean> getMatchers(Integer fieldID, boolean withParameter, boolean inTree, Locale locale) {
List<IntegerStringBean> localizedRelations = new ArrayList<IntegerStringBean>();
if (fieldID==null) {
return localizedRelations;
} else {
IMatcherDT matcherDT = null;
if (fieldID>0) {
IFieldTypeRT fieldTypeRT = FieldTypeManager.getFieldTypeRT(fieldID);
if (fieldTypeRT==null) {
//for example the Keyword pseudo field
return localizedRelations;
}
matcherDT = fieldTypeRT.processLoadMatcherDT(fieldID);
} else {
matcherDT = getPseudoMatcherDT(fieldID);
}
if (matcherDT!=null) {
List<Integer> possibleRelations = matcherDT.getPossibleRelations(withParameter, inTree);
if (possibleRelations!=null) {
localizedRelations = LocalizeUtil.getLocalizedList(
MATCH_RELATION_PREFIX, possibleRelations, locale);
}
}
}
return localizedRelations;
}
/**
* Gets the pseudo field matcherDTs
* @param fieldID
* @return
*/
private static IMatcherDT getPseudoMatcherDT(Integer fieldID) {
if (fieldID!=null) {
switch (fieldID.intValue()) {
case TReportLayoutBean.PSEUDO_COLUMNS.CONSULTANT_LIST:
case TReportLayoutBean.PSEUDO_COLUMNS.INFORMANT_LIST:
return new SelectMatcherDT(fieldID);
case TReportLayoutBean.PSEUDO_COLUMNS.TOTAL_EXPENSE_TIME:
case TReportLayoutBean.PSEUDO_COLUMNS.MY_EXPENSE_TIME:
case TReportLayoutBean.PSEUDO_COLUMNS.TOTAL_PLANNED_TIME:
case TReportLayoutBean.PSEUDO_COLUMNS.BUDGET_TIME:
case TReportLayoutBean.PSEUDO_COLUMNS.REMAINING_PLANNED_TIME:
return new AccountingTimeMatcherDT(fieldID);
case TReportLayoutBean.PSEUDO_COLUMNS.TOTAL_EXPENSE_COST:
case TReportLayoutBean.PSEUDO_COLUMNS.MY_EXPENSE_COST:
case TReportLayoutBean.PSEUDO_COLUMNS.TOTAL_PLANNED_COST:
case TReportLayoutBean.PSEUDO_COLUMNS.BUDGET_COST:
case TReportLayoutBean.PSEUDO_COLUMNS.REMAINING_PLANNED_COST:
return new DoubleMatcherDT(fieldID);
}
}
return null;
}
/**
* Gets the pseudo fields matcher converter
* @param fieldID
* @return
*/
public static MatcherConverter getPseudoFieldMatcherConverter(Integer fieldID) {
if (fieldID!=null) {
switch (fieldID.intValue()) {
case TReportLayoutBean.PSEUDO_COLUMNS.CONSULTANT_LIST:
case TReportLayoutBean.PSEUDO_COLUMNS.INFORMANT_LIST:
return new SelectMatcherConverter();
case TReportLayoutBean.PSEUDO_COLUMNS.TOTAL_EXPENSE_TIME:
case TReportLayoutBean.PSEUDO_COLUMNS.MY_EXPENSE_TIME:
case TReportLayoutBean.PSEUDO_COLUMNS.TOTAL_PLANNED_TIME:
case TReportLayoutBean.PSEUDO_COLUMNS.BUDGET_TIME:
case TReportLayoutBean.PSEUDO_COLUMNS.REMAINING_PLANNED_TIME:
return new AccountingTimeMatcherConverter();
case TReportLayoutBean.PSEUDO_COLUMNS.TOTAL_EXPENSE_COST:
case TReportLayoutBean.PSEUDO_COLUMNS.MY_EXPENSE_COST:
case TReportLayoutBean.PSEUDO_COLUMNS.TOTAL_PLANNED_COST:
case TReportLayoutBean.PSEUDO_COLUMNS.BUDGET_COST:
case TReportLayoutBean.PSEUDO_COLUMNS.REMAINING_PLANNED_COST:
return new DoubleMatcherConverter();
}
}
return null;
}
/**
* Gets the pseudo field matcherDTs
* @param fieldID
* @return
*/
public static IFieldTypeRT getPseudoFieldFieldTypeRT(Integer fieldID) {
if (fieldID!=null) {
switch (fieldID.intValue()) {
case TReportLayoutBean.PSEUDO_COLUMNS.CONSULTANT_LIST:
case TReportLayoutBean.PSEUDO_COLUMNS.INFORMANT_LIST:
return new SystemManagerRT();
case TReportLayoutBean.PSEUDO_COLUMNS.TOTAL_EXPENSE_TIME:
case TReportLayoutBean.PSEUDO_COLUMNS.TOTAL_EXPENSE_COST:
case TReportLayoutBean.PSEUDO_COLUMNS.MY_EXPENSE_TIME:
case TReportLayoutBean.PSEUDO_COLUMNS.MY_EXPENSE_COST:
case TReportLayoutBean.PSEUDO_COLUMNS.TOTAL_PLANNED_TIME:
case TReportLayoutBean.PSEUDO_COLUMNS.TOTAL_PLANNED_COST:
case TReportLayoutBean.PSEUDO_COLUMNS.BUDGET_TIME:
case TReportLayoutBean.PSEUDO_COLUMNS.BUDGET_COST:
case TReportLayoutBean.PSEUDO_COLUMNS.REMAINING_PLANNED_TIME:
case TReportLayoutBean.PSEUDO_COLUMNS.REMAINING_PLANNED_COST:
return new CustomDoubleRT();
}
}
return null;
}
/**
* Gets the pseudo field matcherDTs
* @param fieldID
* @return
*/
public static Integer getPseudoFieldSystemOption(Integer fieldID) {
if (fieldID!=null) {
switch (fieldID.intValue()) {
case TReportLayoutBean.PSEUDO_COLUMNS.CONSULTANT_LIST:
case TReportLayoutBean.PSEUDO_COLUMNS.INFORMANT_LIST:
return SystemFields.INTEGER_PERSON;
case TReportLayoutBean.PSEUDO_COLUMNS.TOTAL_EXPENSE_TIME:
case TReportLayoutBean.PSEUDO_COLUMNS.TOTAL_EXPENSE_COST:
case TReportLayoutBean.PSEUDO_COLUMNS.MY_EXPENSE_TIME:
case TReportLayoutBean.PSEUDO_COLUMNS.MY_EXPENSE_COST:
case TReportLayoutBean.PSEUDO_COLUMNS.TOTAL_PLANNED_TIME:
case TReportLayoutBean.PSEUDO_COLUMNS.TOTAL_PLANNED_COST:
case TReportLayoutBean.PSEUDO_COLUMNS.BUDGET_TIME:
case TReportLayoutBean.PSEUDO_COLUMNS.BUDGET_COST:
case TReportLayoutBean.PSEUDO_COLUMNS.REMAINING_PLANNED_TIME:
case TReportLayoutBean.PSEUDO_COLUMNS.REMAINING_PLANNED_COST:
return fieldID;
}
}
return null;
}
}
| trackplus/Genji | src/main/java/com/aurel/track/admin/customize/category/filter/FieldExpressionBL.java | Java | gpl-3.0 | 40,054 | [
30522,
1013,
1008,
1008,
1008,
8991,
4478,
8040,
6824,
6994,
1998,
3277,
27080,
1008,
9385,
1006,
1039,
1007,
2325,
14233,
19205,
2015,
18289,
1004,
2522,
1012,
4705,
4708,
2968,
7300,
1008,
1026,
1037,
17850,
12879,
1027,
1000,
8299,
1024,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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';
/**
* Module dependencies.
*/
var mongoose = require('mongoose'),
extend = require('mongoose-schema-extend'),
Schema = mongoose.Schema,
moment = require('moment'),
crypto = require('crypto');
/**
* A Validation function for local strategy properties
*/
var validateLocalStrategyProperty = function(property) {
return ((this.provider !== 'local' && !this.updated) || property.length);
};
/**
* A Validation function for local strategy password
*/
var validateLocalStrategyPassword = function(password) {
return (this.provider !== 'local' || (password && password.length > 6));
};
/**
* User Schema
*/
var UserSchema = new Schema({
firstName: {
type: String,
trim: true,
default: '',
validate: [validateLocalStrategyProperty, 'Please fill in your first name']
},
lastName: {
type: String,
trim: true,
default: '',
validate: [validateLocalStrategyProperty, 'Please fill in your last name']
},
email: {
type: String,
trim: true,
default: '',
validate: [validateLocalStrategyProperty, 'Please fill in your email'],
match: [/.+\@.+\..+/, 'Please fill a valid email address']
},
username: {
type: String,
required: 'Please fill in a username',
trim: true
},
password: {
type: String,
default: '',
validate: [validateLocalStrategyPassword, 'Password should be longer']
},
salt: {
type: String
},
provider: {
type: String,
required: 'Provider is required',
},
providerData: {},
additionalProvidersData: {},
updated: {
type: Date
},
created: {
type: Date,
default: Date.now
}
}, {
collection: 'users',
discriminatorKey: '_type'
});
/**
* SkillCategory Schema
*/
var SkillCategorySchema = new Schema({
name: {
type: String,
required: 'Name of skill category is important'
}
});
/**
* Skill Schema
*/
var SkillSchema = new Schema({
name: {
type: String
},
category: {
type: Schema.ObjectId,
ref: 'SkillCategory'
},
});
/**
* Assessment Schema
*/
var AssessmentSchema = new Schema({
assessment_name: {
type: String,
trim: true,
required: 'Name of assessment is important'
},
assessment_date: {
type: Date,
required: 'Date of assessment is important'
},
applicantId: {
type: Schema.ObjectId,
ref: 'Applicant'
},
instructorId: {
type: Schema.ObjectId,
ref: 'Instructor'
},
score: {
type: Number,
required: 'The Applicant score is compulsory'
}
});
/**
* Placement Schema
*/
var PlacementSchema = new Schema({
company: {
type: String,
trim: true,
required: 'Name of company is important'
},
jobDescription: {
type: String,
required: 'Job description is important'
},
start_date: {
type: Date,
required: 'Start date is important'
},
end_date: {
type: Date,
required: 'End date is important'
}
});
/**
*
* Applicant Schema, Trainee and Fellow
*/
var ApplicantSchema = UserSchema.extend({
testScore: {
type: Number,
required: 'Applicant score must be submitted'
},
cvPath: {
type: String
},
photo_path: String,
role: {
type: String,
enum: ['applicant', 'trainee', 'fellow']
},
status: {
name: {
type: String,
enum: ['pending', 'rejected', 'selected for bootcamp', 'selected for interview'],
default: 'pending'
},
reason: {
type: String,
default: ''
}
},
portfolio: {
type: String
},
skillSet: [{
skill: {
type: Schema.Types.ObjectId,
ref: 'Skill'
},
rating: {
type: Number
}
}],
skillSummary: {},
profile: {
type: String
},
campId: {
type: Schema.ObjectId,
ref: 'Bootcamp'
},
assessments: [AssessmentSchema],
placements: [{
type: Schema.Types.ObjectId,
ref: 'Placement'
}]
});
/**
* Instructor Schema
*/
var InstructorSchema = UserSchema.extend({
experience: {
type: String
},
photo: {
type: String
},
role: {
type: String,
enum: ['instructor', 'admin']
},
skillSet: [SkillSchema]
});
/**
* Bootcamp Schema
*/
var BootcampSchema = new Schema({
camp_name: {
type: String,
trim: true
},
location: {
type: String,
required: 'Please fill in the Bootcamp location',
default: 'Lagos',
trim: true
},
start_date: {
type: Date
},
end_date: {
type: Date
},
created: {
type: Date,
default: Date.now
},
applicants: [{
type: Schema.Types.ObjectId,
ref: 'Applicant'
}]
});
/**
* Hook a pre save method to hash the password
*/
UserSchema.pre('save', function(next) {
if (this.password && this.password.length > 6) {
this.salt = new Buffer(crypto.randomBytes(16).toString('base64'), 'base64');
this.password = this.hashPassword(this.password);
}
next();
});
ApplicantSchema.pre('save', function(next) {
if (this.password && this.password.length > 6) {
this.salt = new Buffer(crypto.randomBytes(16).toString('base64'), 'base64');
if (this.constructor.name === 'EmbeddedDocument') {
var TempApplicant = mongoose.model('Applicant');
var embeddedDocApplicant = new TempApplicant(this);
this.password = embeddedDocApplicant.hashPassword(this.password);
} else {
this.password = this.hashPassword(this.password);
}
}
next();
});
InstructorSchema.pre('save', function(next) {
if (this.password && this.password.length > 6) {
this.salt = new Buffer(crypto.randomBytes(16).toString('base64'), 'base64');
this.password = this.hashPassword(this.password);
}
next();
});
BootcampSchema.pre('save', function(next) {
if (this.start_date && this.location) {
this.camp_name = moment(this.start_date).format('MMMM D, YYYY') + ', ' + this.location;
}
next();
});
SkillSchema.post('save', function(next) {
var skill = this;
var Applicant = mongoose.model('Applicant');
Applicant.find().exec(function(err, applicants) {
applicants.forEach(function(applicant) {
Applicant.update({
_id: applicant._id
}, {
$push: {
'skillSet': {
skill: skill._id,
rating: 0
}
}
}, function(err) {
if (err) {
return {
message: 'Couldn\'t add skill to applicant'
};
}
});
});
});
});
ApplicantSchema.post('save', function(next) {
var applicant = this;
var Skill = mongoose.model('Skill');
var Applicant = mongoose.model('Applicant');
//Initialize skill summary
var SkillCategory = mongoose.model('SkillCategory');
var skillSummary = {};
SkillCategory.find().exec(function(err, skillCategories) {
skillCategories.forEach(function(category) {
skillSummary[category.name] = 0;
});
Skill.find().exec(function(err, skills) {
skills.forEach(function(skill) {
Applicant.update({
_id: applicant._id
}, {
$push: {
'skillSet': {
skill: skill._id,
rating: 0
}
},
$set: {
'skillSummary': skillSummary
}
}, function(err) {
if (err) {
return {
message: 'Couldn\'t add skill to applicant'
};
}
});
});
});
});
});
/**
* Create instance method for hashing a password
*/
UserSchema.methods.hashPassword = function(password) {
if (this.salt && password) {
return crypto.pbkdf2Sync(password, this.salt, 10000, 64).toString('base64');
} else {
return password;
}
};
ApplicantSchema.methods.hashPassword = function(password) {
if (this.salt && password) {
return crypto.pbkdf2Sync(password, this.salt, 10000, 64).toString('base64');
} else {
return password;
}
};
InstructorSchema.methods.hashPassword = function(password) {
if (this.salt && password) {
return crypto.pbkdf2Sync(password, this.salt, 10000, 64).toString('base64');
} else {
return password;
}
};
/**
* Create instance method for authenticating user
*/
UserSchema.methods.authenticate = function(password) {
return this.password === this.hashPassword(password);
};
ApplicantSchema.methods.authenticate = function(password) {
return this.password === this.hashPassword(password);
};
InstructorSchema.methods.authenticate = function(password) {
return this.password === this.hashPassword(password);
};
/**
* Find possible not used username
*/
UserSchema.statics.findUniqueUsername = function(username, suffix, callback) {
var _this = this;
var possibleUsername = username + (suffix || '');
_this.findOne({
username: possibleUsername
}, function(err, user) {
if (!err) {
if (!user) {
callback(possibleUsername);
} else {
return _this.findUniqueUsername(username, (suffix || 0) + 1, callback);
}
} else {
callback(null);
}
});
};
ApplicantSchema.statics.findUniqueUsername = function(username, suffix, callback) {
var _this = this;
var possibleUsername = username + (suffix || '');
_this.findOne({
username: possibleUsername
}, function(err, user) {
if (!err) {
if (!user) {
callback(possibleUsername);
} else {
return _this.findUniqueUsername(username, (suffix || 0) + 1, callback);
}
} else {
callback(null);
}
});
};
InstructorSchema.statics.findUniqueUsername = function(username, suffix, callback) {
var _this = this;
var possibleUsername = username + (suffix || '');
_this.findOne({
username: possibleUsername
}, function(err, user) {
if (!err) {
if (!user) {
callback(possibleUsername);
} else {
return _this.findUniqueUsername(username, (suffix || 0) + 1, callback);
}
} else {
callback(null);
}
});
};
mongoose.model('Placement', PlacementSchema);
mongoose.model('User', UserSchema);
mongoose.model('Applicant', ApplicantSchema);
mongoose.model('Instructor', InstructorSchema);
mongoose.model('Bootcamp', BootcampSchema);
mongoose.model('SkillCategory', SkillCategorySchema);
mongoose.model('Skill', SkillSchema);
mongoose.model('Assessment', AssessmentSchema);
| andela-ogaruba/AndelaAPI | app/models/user.server.model.js | JavaScript | mit | 11,542 | [
30522,
1005,
2224,
9384,
1005,
1025,
1013,
1008,
1008,
1008,
11336,
12530,
15266,
1012,
1008,
1013,
13075,
12256,
3995,
9232,
1027,
5478,
1006,
1005,
12256,
3995,
9232,
1005,
1007,
1010,
7949,
1027,
5478,
1006,
1005,
12256,
3995,
9232,
1011... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 game as game
import pytest
import sys
sys.path.insert(0, '..')
def trim_board(ascii_board):
return '\n'.join([i.strip() for i in ascii_board.splitlines()])
t = trim_board
def test_new_board():
game.Board(3,3).ascii() == t("""
...
...
...
""")
game.Board(4,3).ascii() == t("""
....
....
....
""")
game.Board(3,4).ascii() == t("""
...
...
...
...
""")
def test_game():
board = game.Board(3,3,win=3)
assert board.count_tokens == 0
assert board.game_status == 'active'
assert board.turn_color == None
# drop first token
token = board.drop('x',0)
assert board.game_status == 'active'
assert token.position == (0,0)
assert token.color == 'x'
assert board.ascii() == t("""
...
...
x..
""")
assert board.count_tokens == 1
assert board.turn_color == 'o'
# drop second token
token = board.drop('o',0)
assert board.game_status == 'active'
assert token.position == (0,1)
assert token.color == 'o'
assert board.ascii() == t("""
...
o..
x..
""")
assert board.count_tokens == 2
assert board.turn_color == 'x'
# dropping the wrong color should raise an error
with pytest.raises(Exception):
token = board.drop('o',1)
# drop third token
token = board.drop('x',1)
assert board.game_status == 'active'
assert token.position == (1,0)
assert token.color == 'x'
board.ascii() == t("""
...
o..
xx.
""")
assert board.count_tokens == 3
assert board.turn_color == 'o'
# drop fourth token
token = board.drop('o',0)
assert board.game_status == 'active'
assert token.position == (0,2)
assert token.color == 'o'
board.ascii() == t("""
o..
o..
xx.
""")
assert board.count_tokens == 4
# drop fifth token
token = board.drop('x',2)
assert board.game_status == 'over'
assert board.won_by == 'x'
assert token.position == (2,0)
assert token.color == 'x'
board.ascii() == t("""
o..
o..
xxx
""")
assert board.count_tokens == 5
def test_load_board():
"""
The Board class should provide a load method to load a predefined board.
the load method should be implemented as a static method like this:
>>> class Test:
>>> @staticmethod
>>> def a_static_factory():
>>> t = Test()
>>> # do something with t and return it
>>> return t
the load function accepts a board layout. It retrieves the dimensions of the board
and loads the provided data into the board.
"""
board = game.Board.load(t("""
o..
o..
xxx
"""))
def test_axis_strings():
board = game.Board.load(t("""
o..
o..
xxx
"""))
# get the axis strings in this order: | \ / -
axis_strings = board.axis_strings(0,0)
assert axis_strings[0] == 'xoo'
assert axis_strings[1] == 'x'
assert axis_strings[2] == 'x..'
assert axis_strings[3] == 'xxx' # the winner :-)
assert board.won_by == 'x'
| fweidemann14/x-gewinnt | game/test_game.py | Python | gpl-3.0 | 3,095 | [
30522,
12324,
2208,
2004,
2208,
12324,
1052,
17250,
3367,
12324,
25353,
2015,
25353,
2015,
1012,
4130,
1012,
19274,
1006,
1014,
1010,
1005,
1012,
1012,
1005,
1007,
13366,
12241,
1035,
2604,
1006,
2004,
6895,
2072,
1035,
2604,
1007,
1024,
27... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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) 2017 Billy Araujo
This file is part of Bombermaaan.
Bombermaaan 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.
Bombermaaan 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 Bombermaaan. If not, see <http://www.gnu.org/licenses/>.
************************************************************************************/
/**
* \file CAllegroInput.h
* \brief Header file of the Allegro input
*/
#ifndef __CALLEGROINPUT_H__
#define __CALLEGROINPUT_H__
#include "allegro.h"
//******************************************************************************************************************************
//******************************************************************************************************************************
//******************************************************************************************************************************
#define MAX_JOYSTICK_BUTTONS 32 //!< Maximum number of buttons a joystick can have
#define MAX_KEYS ALLEGROK_LAST //!< Maximum number of keys a keyboard can have
#define KEYBOARD_ESCAPE ALLEGROK_ESCAPE //!< ID for the escape key
#define KEYBOARD_1 ALLEGROK_1 //!< ID for the 1 key
#define KEYBOARD_2 ALLEGROK_2
#define KEYBOARD_3 ALLEGROK_3
#define KEYBOARD_4 ALLEGROK_4
#define KEYBOARD_5 ALLEGROK_5
#define KEYBOARD_6 ALLEGROK_6
#define KEYBOARD_7 ALLEGROK_7
#define KEYBOARD_8 ALLEGROK_8
#define KEYBOARD_9 ALLEGROK_9
#define KEYBOARD_0 ALLEGROK_0
#define KEYBOARD_MINUS ALLEGROK_MINUS //!< - on main keyboard
#define KEYBOARD_EQUALS ALLEGROK_EQUALS
#define KEYBOARD_BACK ALLEGROK_BACKSPACE //!< backspace
#define KEYBOARD_TAB ALLEGROK_TAB
#define KEYBOARD_Q ALLEGROK_q
#define KEYBOARD_W ALLEGROK_w
#define KEYBOARD_E ALLEGROK_e
#define KEYBOARD_R ALLEGROK_r
#define KEYBOARD_T ALLEGROK_t
#define KEYBOARD_Y ALLEGROK_y
#define KEYBOARD_U ALLEGROK_u
#define KEYBOARD_I ALLEGROK_i
#define KEYBOARD_O ALLEGROK_o
#define KEYBOARD_P ALLEGROK_p
#define KEYBOARD_LBRACKET ALLEGROK_LEFTPAREN
#define KEYBOARD_RBRACKET ALLEGROK_RIGHTPAREN
#define KEYBOARD_RETURN ALLEGROK_RETURN //!< Enter on main keyboard
#define KEYBOARD_LCONTROL ALLEGROK_LCTRL
#define KEYBOARD_A ALLEGROK_a
#define KEYBOARD_S ALLEGROK_s
#define KEYBOARD_D ALLEGROK_d
#define KEYBOARD_F ALLEGROK_f
#define KEYBOARD_G ALLEGROK_g
#define KEYBOARD_H ALLEGROK_h
#define KEYBOARD_J ALLEGROK_j
#define KEYBOARD_K ALLEGROK_k
#define KEYBOARD_L ALLEGROK_l
#define KEYBOARD_SEMICOLON ALLEGROK_SEMICOLON
#define KEYBOARD_APOSTROPHE ALLEGROK_QUOTE
#define KEYBOARD_GRAVE ALLEGROK_BACKQUOTE //!< accent grave
#define KEYBOARD_LSHIFT ALLEGROK_LSHIFT
#define KEYBOARD_BACKSLASH ALLEGROK_BACKSLASH
#define KEYBOARD_Z ALLEGROK_z
#define KEYBOARD_X ALLEGROK_x
#define KEYBOARD_C ALLEGROK_c
#define KEYBOARD_V ALLEGROK_v
#define KEYBOARD_B ALLEGROK_b
#define KEYBOARD_N ALLEGROK_n
#define KEYBOARD_M ALLEGROK_m
#define KEYBOARD_COMMA ALLEGROK_COMMA
#define KEYBOARD_PERIOD ALLEGROK_PERIOD //!< . on main keyboard
#define KEYBOARD_SLASH ALLEGROK_SLASH //!< / on main keyboard
#define KEYBOARD_RSHIFT ALLEGROK_RSHIFT
#define KEYBOARD_MULTIPLY ALLEGROK_KP_MULTIPLY //!< * on numeric keypad
#define KEYBOARD_LMENU ALLEGROK_LALT //!< left Alt
#define KEYBOARD_SPACE ALLEGROK_SPACE
#define KEYBOARD_CAPITAL ALLEGROK_CAPSLOCK
#define KEYBOARD_F1 ALLEGROK_F1
#define KEYBOARD_F2 ALLEGROK_F2
#define KEYBOARD_F3 ALLEGROK_F3
#define KEYBOARD_F4 ALLEGROK_F4
#define KEYBOARD_F5 ALLEGROK_F5
#define KEYBOARD_F6 ALLEGROK_F6
#define KEYBOARD_F7 ALLEGROK_F7
#define KEYBOARD_F8 ALLEGROK_F8
#define KEYBOARD_F9 ALLEGROK_F9
#define KEYBOARD_F10 ALLEGROK_F10
#define KEYBOARD_NUMLOCK ALLEGROK_NUMLOCK
#define KEYBOARD_SCROLL ALLEGROK_SCROLLOCK //!< Scroll Lock
#define KEYBOARD_NUMPAD7 ALLEGROK_KP7
#define KEYBOARD_NUMPAD8 ALLEGROK_KP8
#define KEYBOARD_NUMPAD9 ALLEGROK_KP9
#define KEYBOARD_SUBTRACT ALLEGROK_KP_MINUS //!< - on numeric keypad
#define KEYBOARD_NUMPAD4 ALLEGROK_KP4
#define KEYBOARD_NUMPAD5 ALLEGROK_KP5
#define KEYBOARD_NUMPAD6 ALLEGROK_KP6
#define KEYBOARD_ADD ALLEGROK_KP_PLUS //!< + on numeric keypad
#define KEYBOARD_NUMPAD1 ALLEGROK_KP1
#define KEYBOARD_NUMPAD2 ALLEGROK_KP2
#define KEYBOARD_NUMPAD3 ALLEGROK_KP3
#define KEYBOARD_NUMPAD0 ALLEGROK_KP0
#define KEYBOARD_DECIMAL ALLEGROK_KP_PERIOD //!< . on numeric keypad
#define KEYBOARD_F11 ALLEGROK_F11
#define KEYBOARD_F12 ALLEGROK_F12
#define KEYBOARD_NUMPADENTER ALLEGROK_KP_ENTER //!< Enter on numeric keypad
#define KEYBOARD_RCONTROL ALLEGROK_RCTRL
#define KEYBOARD_DIVIDE ALLEGROK_KP_DIVIDE //!< / on numeric keypad
#define KEYBOARD_SYSRQ ALLEGROK_SYSREQ
#define KEYBOARD_RMENU ALLEGROK_RALT //!< right Alt
#define KEYBOARD_PAUSE ALLEGROK_BREAK //!< Pause
#define KEYBOARD_HOME ALLEGROK_HOME //!< Home on arrow keypad
#define KEYBOARD_UP ALLEGROK_UP //!< UpArrow on arrow keypad
#define KEYBOARD_PRIOR ALLEGROK_PAGEUP //!< PgUp on arrow keypad
#define KEYBOARD_LEFT ALLEGROK_LEFT //!< LeftArrow on arrow keypad
#define KEYBOARD_RIGHT ALLEGROK_RIGHT //!< RightArrow on arrow keypad
#define KEYBOARD_END ALLEGROK_END //!< End on arrow keypad
#define KEYBOARD_DOWN ALLEGROK_DOWN //!< DownArrow on arrow keypad
#define KEYBOARD_NEXT ALLEGROK_PAGEDOWN //!< PgDn on arrow keypad
#define KEYBOARD_INSERT ALLEGROK_INSERT //!< Insert on arrow keypad
#define KEYBOARD_DELETE ALLEGROK_DELETE //!< Delete on arrow keypad
#define KEYBOARD_LWIN ALLEGROK_LSUPER //!< Left Windows key
#define KEYBOARD_RWIN ALLEGROK_RSUPER //!< Right Windows key
#define KEYBOARD_APPS ALLEGROK_MENU //!< AppMenu key
#define JOYSTICK_UP 0
#define JOYSTICK_DOWN 1
#define JOYSTICK_LEFT 2
#define JOYSTICK_RIGHT 3
#define JOYSTICK_BUTTON(x) (4 + (x))
#define NUMBER_OF_JOYSTICK_DIRECTIONS 4 //!< Number of joystick directions (up down left right)
#define JOYSTICK_AXIS_THRESHOLD 3200
//! The third joystick button can be used for leaving the winner screen
#define JOYSTICK_BUTTON_MENU_PREVIOUS JOYSTICK_BUTTON(1)
#define JOYSTICK_BUTTON_MENU_NEXT JOYSTICK_BUTTON(0)
//! The 9th joystick button (this usually is the "start" button) can be used for leaving the winner screen
//! On xbox controller, the start button could be the 7th button (see tracker item #2907122)
#define JOYSTICK_BUTTON_BREAK JOYSTICK_BUTTON(8) // pause
#define JOYSTICK_BUTTON_START JOYSTICK_BUTTON(9) // start
typedef struct AllegroJOYSTATE
{
LONG lX; /* x-axis position */
LONG lY; /* y-axis position */
LONG lZ; /* z-axis position */
LONG lRx; /* x-axis rotation */
LONG lRy; /* y-axis rotation */
LONG lRz; /* z-axis rotation */
LONG rglSlider[2]; /* extra axes positions */
DWORD rgdwPOV[4]; /* POV directions */
BYTE rgbButtons[32]; /* 32 buttons */
} AllegroJOYSTATE, *LPAllegroJOYSTATE;
//******************************************************************************************************************************
//******************************************************************************************************************************
//******************************************************************************************************************************
//! The SJoystick structure contains information about one joystick created by AllegroInput.
struct SJoystick
{
Allegro_Joystick* pDevice; //!< Pointer on the AllegroInput input device
AllegroJOYSTATE State; //!< Most recent state of the joystick, filled on last update (has been DIJOYSTATE)
bool Opened; //!< Is the joystick _supposed_ to be opened? Updated on each general update.
};
//******************************************************************************************************************************
//******************************************************************************************************************************
//******************************************************************************************************************************
class CAllegroInput
{
private:
bool m_Ready;
HINSTANCE m_hInstance; //!< Handle to the application instance (needed to use AllegroInput)
HWND m_hWnd; //!< Handle to the window (needed to use AllegroInput)
bool m_KeyboardOpened; //!< Is the system keyboard _supposed_ to be opened?
char m_KeyState[MAX_KEYS]; //!< State of each key on the system keyboard
char m_KeyFriendlyName[MAX_KEYS][MAX_PATH]; //!< More friendly name for each key
vector<SJoystick*> m_pJoysticks; //!< All joystick AllegroInput devices installed in the system
bool UpdateDevice(void* pState, int StateSize);
bool UpdateDevice(Allegro_Joystick* pDevice, void* pState, int StateSize);
void MakeKeyFriendlyNames(void);
int m_joystickCount;
public:
CAllegroInput(void);
~CAllegroInput(void);
inline void SetWindowHandle(HWND hWnd);
inline void SetInstanceHandle(HINSTANCE hInstance);
bool Create(void);
void Destroy(void);
inline void OpenKeyboard(void);
inline bool IsKeyboardOpened(void);
inline void CloseKeyboard(void);
void UpdateKeyboard(void);
inline bool GetKey(int Key);
inline void SetKey(int Key, bool KeySet);
inline const char* GetKeyFriendlyName(int Key);
inline int GetJoystickCount(void);
inline void OpenJoystick(int Joystick);
inline bool IsJoystickOpened(int Joystick);
inline void CloseJoystick(int Joystick);
void UpdateJoystick(int Joystick);
inline int GetJoystickAxisX(int Joystick);
inline int GetJoystickAxisY(int Joystick);
inline bool GetJoystickButton(int Joystick, int Button);
inline void SetJoystickAxisX(int Joystick, int AxisX);
inline void SetJoystickAxisY(int Joystick, int AxisY);
inline void SetJoystickButton(int Joystick, int Button, bool onoff);
inline bool TestUp(int Joystick);
inline bool TestDown(int Joystick);
inline bool TestLeft(int Joystick);
inline bool TestRight(int Joystick);
inline bool TestNext(int Joystick);
inline bool TestPrevious(int Joystick);
inline bool TestBreak(int Joystick);
inline bool TestStart(int Joystick);
};
typedef CAllegroInput InputClass;
//******************************************************************************************************************************
//******************************************************************************************************************************
//******************************************************************************************************************************
inline void CAllegroInput::SetWindowHandle(HWND hWnd) { m_hWnd = hWnd; }
inline void CAllegroInput::SetInstanceHandle(HINSTANCE hInstance) { m_hInstance = hInstance; }
inline void CAllegroInput::OpenKeyboard(void) { m_KeyboardOpened = true; }
inline bool CAllegroInput::IsKeyboardOpened(void)
{
// Return the opened state of the keyboard
return m_KeyboardOpened;
}
inline void CAllegroInput::CloseKeyboard(void) { m_KeyboardOpened = false; }
inline bool CAllegroInput::GetKey(int Key)
{
// Assert the key number is correct
ASSERT(Key >= 0 && Key < MAX_KEYS);
// Return the state of the key
return (m_KeyState[Key] & 0x80) != 0;
}
inline void CAllegroInput::SetKey(int Key, bool KeySet)
{
// Assert the key number is correct
ASSERT(Key >= 0 && Key < MAX_KEYS);
// Set/remove state of the key
if (KeySet)
{
m_KeyState[Key] |= 0x80;
}
else
{
m_KeyState[Key] &= ~0x80;
}
return;
}
inline const char* CAllegroInput::GetKeyFriendlyName(int Key)
{
// Assert the key number is correct
ASSERT(Key >= 0 && Key < MAX_KEYS);
// Return the name of the key
return m_KeyFriendlyName[Key];
}
inline int CAllegroInput::GetJoystickCount(void)
{
// Return the number of joysticks installed on the system
return m_pJoysticks.size();
}
inline void CAllegroInput::OpenJoystick(int Joystick)
{
// Check if the joystick number is correct
if (Joystick >= 0 && Joystick < (int)m_pJoysticks.size())
{
if (m_pJoysticks[Joystick]->Opened)
return;
// Try to acquire the joystick
m_pJoysticks[Joystick]->pDevice = Allegro_JoystickOpen(Joystick);
// Set the opened state according to the return value
m_pJoysticks[Joystick]->Opened = (m_pJoysticks[Joystick]->pDevice != NULL);
}
}
inline bool CAllegroInput::IsJoystickOpened(int Joystick)
{
// Check if the joystick number is correct
ASSERT(Joystick >= 0 && Joystick < (int)m_pJoysticks.size());
// Return the opened state of this joystick
return m_pJoysticks[Joystick]->Opened;
}
inline void CAllegroInput::CloseJoystick(int Joystick)
{
// Check if the joystick number is correct
if (Joystick >= 0 && Joystick < (int)m_pJoysticks.size())
{
// Release access to this joystick
Allegro_JoystickClose(m_pJoysticks[Joystick]->pDevice);
// We are sure this joystick is not opened */
m_pJoysticks[Joystick]->Opened = false;
m_pJoysticks[Joystick]->pDevice = NULL;
}
}
inline int CAllegroInput::GetJoystickAxisX(int Joystick)
{
// Check if the joystick number is correct
ASSERT(Joystick >= 0 && Joystick < (int)m_pJoysticks.size());
// Return the value of the X axis of this joystick
return m_pJoysticks[Joystick]->State.lX;
}
inline int CAllegroInput::GetJoystickAxisY(int Joystick)
{
// Check if the joystick number is correct
ASSERT(Joystick >= 0 && Joystick < (int)m_pJoysticks.size());
// Return the value of the Y axis of this joystick
return m_pJoysticks[Joystick]->State.lY;
}
inline bool CAllegroInput::GetJoystickButton(int Joystick, int Button)
{
// Check if the joystick number is correct
ASSERT(Joystick >= 0 && Joystick < (int)m_pJoysticks.size());
// Assert the button number is correct
ASSERT(Button >= 0 && Button < MAX_JOYSTICK_BUTTONS);
// Return the state of the specified button on this joystick
return (m_pJoysticks[Joystick]->State.rgbButtons[Button] & 0x80) != 0;
}
inline void CAllegroInput::SetJoystickAxisX(int Joystick, int AxisX)
{
// Check if the joystick number is correct
ASSERT(Joystick >= 0 && Joystick < (int)m_pJoysticks.size());
// Set the value of the X axis of this joystick
m_pJoysticks[Joystick]->State.lX = AxisX;
return;
}
inline void CAllegroInput::SetJoystickAxisY(int Joystick, int AxisY)
{
// Check if the joystick number is correct
ASSERT(Joystick >= 0 && Joystick < (int)m_pJoysticks.size());
// Set the value of the Y axis of this joystick
m_pJoysticks[Joystick]->State.lY = AxisY;
return;
}
inline void CAllegroInput::SetJoystickButton(int Joystick, int Button, bool onoff)
{
// Check if the joystick number is correct
ASSERT(Joystick >= 0 && Joystick < (int)m_pJoysticks.size());
// Assert the button number is correct
ASSERT(Button >= 0 && Button < MAX_JOYSTICK_BUTTONS);
// Return the state of the specified button on this joystick
if (onoff)
{
m_pJoysticks[Joystick]->State.rgbButtons[Button] |= 0x80;
}
else
{
m_pJoysticks[Joystick]->State.rgbButtons[Button] &= ~0x80;
}
return;
}
inline bool CAllegroInput::TestUp(int Joystick)
{
if (Joystick >= 0 && Joystick < (int)m_pJoysticks.size())
{
m_joystickCount++;
if (m_joystickCount > 200)
{
if (m_pJoysticks[Joystick]->State.lY < -JOYSTICK_AXIS_THRESHOLD)
{
m_joystickCount = 0;
return true;
}
}
}
return false;
}
inline bool CAllegroInput::TestDown(int Joystick)
{
if (Joystick >= 0 && Joystick < (int)m_pJoysticks.size())
{
m_joystickCount++;
if (m_joystickCount > 200)
{
if (m_pJoysticks[Joystick]->State.lY > +JOYSTICK_AXIS_THRESHOLD)
{
m_joystickCount = 0;
return true;
}
}
}
return false;
}
inline bool CAllegroInput::TestLeft(int Joystick)
{
if (Joystick >= 0 && Joystick < (int)m_pJoysticks.size())
{
m_joystickCount++;
if (m_joystickCount > 200)
{
if (m_pJoysticks[Joystick]->State.lX < -JOYSTICK_AXIS_THRESHOLD)
{
m_joystickCount = 0;
return true;
}
}
}
return false;
}
inline bool CAllegroInput::TestRight(int Joystick)
{
if (Joystick >= 0 && Joystick < (int)m_pJoysticks.size())
{
m_joystickCount++;
if (m_joystickCount > 200)
{
if (m_pJoysticks[Joystick]->State.lX > +JOYSTICK_AXIS_THRESHOLD)
{
m_joystickCount = 0;
return true;
}
}
}
return false;
}
inline bool CAllegroInput::TestNext(int Joystick)
{
if (Joystick >= 0 && Joystick < (int)m_pJoysticks.size())
{
if ((m_pJoysticks[Joystick]->State.rgbButtons[JOYSTICK_BUTTON_MENU_NEXT - NUMBER_OF_JOYSTICK_DIRECTIONS] & 0x80) != 0)
return true;
}
return false;
}
inline bool CAllegroInput::TestPrevious(int Joystick)
{
if (Joystick >= 0 && Joystick < (int)m_pJoysticks.size())
{
if ((m_pJoysticks[Joystick]->State.rgbButtons[JOYSTICK_BUTTON_MENU_PREVIOUS - NUMBER_OF_JOYSTICK_DIRECTIONS] & 0x80) != 0)
return true;
}
return false;
}
inline bool CAllegroInput::TestBreak(int Joystick)
{
if (Joystick >= 0 && Joystick < (int)m_pJoysticks.size())
{
if ((m_pJoysticks[Joystick]->State.rgbButtons[JOYSTICK_BUTTON_BREAK - NUMBER_OF_JOYSTICK_DIRECTIONS] & 0x80) != 0)
return true;
}
return false;
}
inline bool CAllegroInput::TestStart(int Joystick)
{
if (Joystick >= 0 && Joystick < (int)m_pJoysticks.size())
{
if ((m_pJoysticks[Joystick]->State.rgbButtons[JOYSTICK_BUTTON_START - NUMBER_OF_JOYSTICK_DIRECTIONS] & 0x80) != 0)
return true;
}
return false;
}
//******************************************************************************************************************************
//******************************************************************************************************************************
//******************************************************************************************************************************
#endif // __CALLEGROINPUT_H__
| bjaraujo/bombermaaan | trunk/src/CAllegroInput.h | C | gpl-3.0 | 19,017 | [
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... |
namespace Logs.Data.Migrations
{
using System.Data.Entity.Migrations;
using Logs.Data;
public sealed class Configuration : DbMigrationsConfiguration<Logs.Data.LogsDbContext>
{
public Configuration()
{
this.AutomaticMigrationsEnabled = true;
this.AutomaticMigrationDataLossAllowed = true;
}
protected override void Seed(LogsDbContext context)
{
}
}
}
| TsvetanMilanov/TelerikAcademyHW | 11_Databases/13_DatabasePerformance/DatabasePerformance/Logs.Data/Migrations/Configuration.cs | C# | mit | 445 | [
30522,
3415,
15327,
15664,
1012,
2951,
1012,
9230,
2015,
1063,
2478,
2291,
1012,
2951,
1012,
9178,
1012,
9230,
2015,
1025,
2478,
15664,
1012,
2951,
1025,
2270,
10203,
2465,
9563,
1024,
16962,
4328,
29397,
9363,
2078,
8873,
27390,
3370,
1026... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_151) on Thu Feb 08 09:04:06 MST 2018 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>org.wildfly.swarm.spi.api.cdi (BOM: * : All 2018.2.0 API)</title>
<meta name="date" content="2018-02-08">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="org.wildfly.swarm.spi.api.cdi (BOM: * : All 2018.2.0 API)";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li class="navBarCell1Rev">Package</li>
<li>Class</li>
<li><a href="package-use.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">WildFly Swarm API, 2018.2.0</div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../org/wildfly/swarm/spi/api/annotations/package-summary.html">Prev Package</a></li>
<li><a href="../../../../../../org/wildfly/swarm/spi/api/config/package-summary.html">Next Package</a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/wildfly/swarm/spi/api/cdi/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h1 title="Package" class="title">Package org.wildfly.swarm.spi.api.cdi</h1>
</div>
<div class="contentContainer">
<ul class="blockList">
<li class="blockList">
<table class="typeSummary" border="0" cellpadding="3" cellspacing="0" summary="Class Summary table, listing classes, and an explanation">
<caption><span>Class Summary</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../../org/wildfly/swarm/spi/api/cdi/CommonBean.html" title="class in org.wildfly.swarm.spi.api.cdi">CommonBean</a><T></td>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../../org/wildfly/swarm/spi/api/cdi/CommonBeanBuilder.html" title="class in org.wildfly.swarm.spi.api.cdi">CommonBeanBuilder</a><T></td>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li class="navBarCell1Rev">Package</li>
<li>Class</li>
<li><a href="package-use.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">WildFly Swarm API, 2018.2.0</div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../org/wildfly/swarm/spi/api/annotations/package-summary.html">Prev Package</a></li>
<li><a href="../../../../../../org/wildfly/swarm/spi/api/config/package-summary.html">Next Package</a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/wildfly/swarm/spi/api/cdi/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2018 <a href="http://www.jboss.org">JBoss by Red Hat</a>. All rights reserved.</small></p>
</body>
</html>
| wildfly-swarm/wildfly-swarm-javadocs | 2018.2.0/apidocs/org/wildfly/swarm/spi/api/cdi/package-summary.html | HTML | apache-2.0 | 5,687 | [
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... |
/*
* This file is part of Nucleus, licensed under the MIT License (MIT). See the LICENSE.txt file
* at the root of this project for more details.
*/
package io.github.nucleuspowered.nucleus.core.scaffold.command.modifier.impl;
import io.github.nucleuspowered.nucleus.core.scaffold.command.ICommandContext;
import io.github.nucleuspowered.nucleus.core.scaffold.command.annotation.CommandModifier;
import io.github.nucleuspowered.nucleus.core.scaffold.command.control.CommandControl;
import io.github.nucleuspowered.nucleus.core.scaffold.command.modifier.ICommandModifier;
import io.github.nucleuspowered.nucleus.core.services.INucleusServiceCollection;
import net.kyori.adventure.text.Component;
import java.util.Optional;
public class RequiresEconomyModifier implements ICommandModifier {
@Override
public Optional<Component> testRequirement(final ICommandContext source, final CommandControl control,
final INucleusServiceCollection serviceCollection, final CommandModifier modifier) {
if (!serviceCollection.economyServiceProvider().serviceExists()) {
return Optional.of(serviceCollection.messageProvider().getMessageFor(source.cause().audience(), "command.economyrequired"));
}
return Optional.empty();
}
}
| NucleusPowered/Nucleus | nucleus-core/src/main/java/io/github/nucleuspowered/nucleus/core/scaffold/command/modifier/impl/RequiresEconomyModifier.java | Java | mit | 1,279 | [
30522,
1013,
1008,
1008,
2023,
5371,
2003,
2112,
1997,
13502,
1010,
7000,
2104,
1996,
10210,
6105,
1006,
10210,
1007,
1012,
2156,
1996,
6105,
1012,
19067,
2102,
5371,
1008,
2012,
1996,
7117,
1997,
2023,
2622,
2005,
2062,
4751,
1012,
1008,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
/*
For more information, please see: http://software.sci.utah.edu
The MIT License
Copyright (c) 2015 Scientific Computing and Imaging Institute,
University of Utah.
License for the specific language governing rights and limitations under
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#ifndef DATAFLOW_NETWORK_GeometryGeneratingModule_H
#define DATAFLOW_NETWORK_GeometryGeneratingModule_H
#include <Dataflow/Network/Module.h>
#include <Dataflow/Network/share.h>
namespace SCIRun {
namespace Dataflow {
namespace Networks {
class SCISHARE ModuleLevelUniqueIDGenerator
{
public:
ModuleLevelUniqueIDGenerator(const ModuleInterface& module, const std::string& name) :
module_(module), name_(name)
{}
std::string operator()() const { return generateModuleLevelUniqueID(module_, name_); }
private:
const ModuleInterface& module_;
std::string name_;
static std::hash<std::string> hash_;
std::string generateModuleLevelUniqueID(const ModuleInterface& module, const std::string& name) const;
};
class SCISHARE GeometryGeneratingModule : public Module, public Core::GeometryIDGenerator
{
public:
explicit GeometryGeneratingModule(const ModuleLookupInfo& info);
std::string generateGeometryID(const std::string& tag) const override;
};
}}}
#endif
| ajanson/SCIRun | src/Dataflow/Network/GeometryGeneratingModule.h | C | mit | 2,345 | [
30522,
1013,
1008,
2005,
2062,
2592,
1010,
3531,
2156,
1024,
8299,
1024,
1013,
1013,
4007,
1012,
16596,
1012,
6646,
1012,
3968,
2226,
1996,
10210,
6105,
9385,
1006,
1039,
1007,
2325,
4045,
9798,
1998,
12126,
2820,
1010,
2118,
1997,
6646,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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":"74937510","logradouro":"Rua H 152","bairro":"Cidade Vera Cruz","cidade":"Aparecida de Goi\u00e2nia","uf":"GO","estado":"Goi\u00e1s"});
| lfreneda/cepdb | api/v1/74937510.jsonp.js | JavaScript | cc0-1.0 | 149 | [
30522,
1046,
3385,
2361,
1006,
1063,
1000,
8292,
2361,
1000,
1024,
1000,
6356,
2683,
24434,
22203,
2692,
1000,
1010,
1000,
8833,
12173,
8162,
2080,
1000,
1024,
1000,
21766,
2050,
1044,
15017,
1000,
1010,
1000,
21790,
18933,
1000,
1024,
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... |
/*****************************************************************************/
/* */
/* RobotIRC 0.1.2 */
/* Copyright (c) 2013-2017, Frederic Cambus */
/* https://github.com/fcambus/robotirc */
/* */
/* Created: 2013-12-17 */
/* Last Updated: 2017-02-03 */
/* */
/* RobotIRC is released under the BSD 2-Clause license. */
/* See LICENSE file for details. */
/* */
/*****************************************************************************/
var crypto = require('crypto');
var dns = require('dns');
var net = require('net');
/**[ NPM Modules ]************************************************************/
var alexa = require('alexarank');
var irc = require('irc');
var log = require('npmlog');
var request = require('request');
/**[ RobotIRC ]***************************************************************/
module.exports = function(config) {
var client = new irc.Client(config.server, config.nickname, config.options);
/**[ Connection ]*********************************************************/
client.addListener('registered', function(message) {
log.info("", "RobotIRC is now connected to " + config.server);
});
/**[ Error handler ]******************************************************/
client.addListener('error', function(message) {
log.error("", message.args.splice(1, message.args.length).join(" - "));
});
/**[ CTCP VERSION handler ]***********************************************/
client.addListener('ctcp-version', function(from, to, message) {
client.ctcp(from, 'notice', "VERSION " + config.options.realName);
});
/**[ Message handler ]****************************************************/
client.addListener('message', function(from, to, message) {
var params = message.split(' ').slice(1).join(' ');
if (to == client.nick) { // Handling private messages
to = from;
}
/**********************************************************[ !help ]**/
if (message.match(/^!help/)) {
var help = "RobotIRC 0.1.2 supports the following commands:\n" +
"!alexa => Get Alexa traffic rank for a domain or URL\n" +
"!date => Display server local time\n" +
"!expand => Expand a shortened URL\n" +
"!headers => Display HTTP headers for queried URL\n" +
"!resolve => Get A records (IPv4) and AAAA records (IPv6) for queried domain\n" +
"!reverse => Get reverse (PTR) records from IPv4 or IPv6 addresses\n" +
"!wikipedia => Query Wikipedia for an article summary\n";
client.say(to, help);
}
/*********************************************************[ !alexa ]**/
if (message.match(/^!alexa/)) {
alexa(params, function(error, result) {
if (!error && typeof result.rank != "undefined") {
client.say(to, "Alexa Traffic Rank for " + result.idn.slice(0, -1) + ": " + result.rank);
}
});
}
/**********************************************************[ !date ]**/
if (message.match(/^!date/)) {
client.say(to, Date());
}
/********************************************************[ !expand ]**/
if (message.match(/^!expand/)) {
request({
method: "HEAD",
url: params,
followAllRedirects: true
},
function(error, response) {
if (!error && response.statusCode == 200) {
client.say(to, response.request.href);
}
});
}
/*******************************************************[ !headers ]**/
if (message.match(/^!headers/)) {
request(params, function(error, response, body) {
if (!error && response.statusCode == 200) {
for (var item in response.headers) {
client.say(to, item + ": " + response.headers[item] + "\n");
}
}
});
}
/*******************************************************[ !resolve ]**/
if (message.match(/^!resolve/)) {
dns.resolve4(params, function(error, addresses) {
if (!error) {
for (var item in addresses) {
client.say(to, addresses[item] + "\n");
}
}
dns.resolve6(params, function(error, addresses) {
if (!error) {
for (var item in addresses) {
client.say(to, addresses[item] + "\n");
}
}
});
});
}
/*******************************************************[ !reverse ]**/
if (message.match(/^!reverse/)) {
if (net.isIP(params)) {
dns.reverse(params, function(error, domains) {
if (!error) {
client.say(to, domains[0]);
}
});
}
}
/*****************************************************[ !wikipedia ]**/
if (message.match(/^!wikipedia/)) {
params.split(' ').join('_');
dns.resolveTxt(params + ".wp.dg.cx", function(error, txt) {
if (!error) {
client.say(to, txt[0]);
}
});
}
});
};
| fcambus/robotirc | lib/robotirc.js | JavaScript | bsd-2-clause | 6,242 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
30524,
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,
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... |
/*
* Simple Mail Submission Agent using SMTP with libEtPan!
* TODO: Full sendmail like interface
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <libetpan/libetpan.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifdef WIN32
# include "win_etpan.h"
#ifdef _MSC_VER
# include "../src/bsd/getopt.h"
# define STDIN_FILENO _fileno(stdin)
#else
# include <getopt.h>
#endif
#else
# include <netdb.h>
# include <netinet/in.h>
# include <sys/socket.h>
# include <sys/mman.h>
# include <unistd.h>
# include <sys/ioctl.h>
# include <pwd.h>
# define _GNU_SOURCE
# include <getopt.h>
#endif
/* globals */
char *smtp_server;
uint16_t smtp_port = 25;
char *smtp_user;
char *smtp_password;
char *smtp_from;
int smtp_tls = 0;
int smtp_esmtp = 1;
struct mem_message {
char *data;
size_t len;
MMAPString *mstring;
};
#define BLOCKSIZE 4096
int collect(struct mem_message *message) {
struct stat sb;
int len;
memset(message, 0, sizeof(struct mem_message));
#ifndef MMAP_UNAVAILABLE
/* if stdin is a file whose size is known, try to mmap it */
if (!fstat(0, &sb) && S_ISREG(sb.st_mode) && sb.st_size >= 0) {
message->len = sb.st_size;
if ((message->data = mmap(NULL, message->len, PROT_READ, MAP_SHARED,
STDIN_FILENO, 0)) != MAP_FAILED)
return 0;
}
#endif
/* read the buffer from stdin by blocks, until EOF or error.
save the message in a mmap_string */
if ((message->mstring = mmap_string_sized_new(BLOCKSIZE)) == NULL) {
perror("mmap_string_new");
goto error;
}
message->len = 0;
while ((len = read(STDIN_FILENO,
message->mstring->str + message->len, BLOCKSIZE)) > 0) {
message->len += len;
/* reserve room for next block */
if ((mmap_string_set_size(message->mstring,
message->len + BLOCKSIZE)) == NULL) {
perror("mmap_string_set_size");
goto error;
}
}
if (len == 0) {
message->data = message->mstring->str;
return 0; /* OK */
}
perror("read");
error:
if (message->mstring != NULL)
mmap_string_free(message->mstring);
return -1;
}
char *guessfrom(void) {
#ifndef WIN32
uid_t uid;
struct passwd *pw;
char hostname[256];
int len;
char *gfrom;
if (gethostname(hostname, sizeof(hostname))) {
perror("gethostname");
return NULL;
}
hostname[sizeof(hostname) - 1] = '\0';
uid = getuid();
pw = getpwuid(uid);
len = ((pw != NULL) ? strlen(pw->pw_name) : 12)
+ strlen(hostname) + 2;
if ((gfrom = malloc(len)) == NULL) {
perror("malloc");
return NULL;
}
if (pw != NULL && pw->pw_name != NULL)
snprintf(gfrom, len, "%s@%s", pw->pw_name, hostname);
else
snprintf(gfrom, len, "#%u@%s", uid, hostname);
return gfrom;
#else
return NULL;
#endif
}
void release(struct mem_message *message) {
if (message->mstring != NULL)
mmap_string_free(message->mstring);
#ifndef MMAP_UNAVAILABLE
else if (message->data != NULL)
munmap(message->data, message->len);
#endif
}
int send_message(char *data, size_t len, char**rcpts) {
int s = -1;
int ret;
char **r;
int esmtp = 0;
mailsmtp *smtp = NULL;
if ((smtp = mailsmtp_new(0, NULL)) == NULL) {
perror("mailsmtp_new");
goto error;
}
/* first open the stream */
if ((ret = mailsmtp_socket_connect(smtp,
(smtp_server != NULL ? smtp_server : "localhost"),
smtp_port)) != MAILSMTP_NO_ERROR) {
fprintf(stderr, "mailsmtp_socket_connect: %s\n", mailsmtp_strerror(ret));
goto error;
}
/* then introduce ourselves */
if (smtp_esmtp && (ret = mailesmtp_ehlo(smtp)) == MAILSMTP_NO_ERROR)
esmtp = 1;
else if (!smtp_esmtp || ret == MAILSMTP_ERROR_NOT_IMPLEMENTED)
ret = mailsmtp_helo(smtp);
if (ret != MAILSMTP_NO_ERROR) {
fprintf(stderr, "mailsmtp_helo: %s\n", mailsmtp_strerror(ret));
goto error;
}
if (esmtp && smtp_tls &&
(ret = mailsmtp_socket_starttls(smtp)) != MAILSMTP_NO_ERROR) {
fprintf(stderr, "mailsmtp_starttls: %s\n", mailsmtp_strerror(ret));
goto error;
}
if (esmtp && smtp_user != NULL &&
(ret = mailsmtp_auth(smtp, smtp_user,
(smtp_password != NULL) ? smtp_password : ""))
!= MAILSMTP_NO_ERROR) {
fprintf(stderr, "mailsmtp_auth: %s: %s\n", smtp_user, mailsmtp_strerror(ret));
goto error;
}
/* source */
if ((ret = (esmtp ?
mailesmtp_mail(smtp, smtp_from, 1, "etPanSMTPTest") :
mailsmtp_mail(smtp, smtp_from))) != MAILSMTP_NO_ERROR) {
fprintf(stderr, "mailsmtp_mail: %s, %s\n", smtp_from, mailsmtp_strerror(ret));
goto error;
}
/* recipients */
for (r = rcpts; *r != NULL; r++) {
if ((ret = (esmtp ?
mailesmtp_rcpt(smtp, *r,
MAILSMTP_DSN_NOTIFY_FAILURE|MAILSMTP_DSN_NOTIFY_DELAY,
NULL) :
mailsmtp_rcpt(smtp, *r))) != MAILSMTP_NO_ERROR) {
fprintf(stderr, "mailsmtp_rcpt: %s: %s\n", *r, mailsmtp_strerror(ret));
goto error;
}
}
/* message */
if ((ret = mailsmtp_data(smtp)) != MAILSMTP_NO_ERROR) {
fprintf(stderr, "mailsmtp_data: %s\n", mailsmtp_strerror(ret));
goto error;
}
if ((ret = mailsmtp_data_message(smtp, data, len)) != MAILSMTP_NO_ERROR) {
fprintf(stderr, "mailsmtp_data_message: %s\n", mailsmtp_strerror(ret));
goto error;
}
mailsmtp_free(smtp);
return 0;
error:
if (smtp != NULL)
mailsmtp_free(smtp);
if (s >= 0)
close(s);
return -1;
}
int main(int argc, char **argv) {
struct mem_message message;
int indx, r;
static struct option long_options[] = {
{"server", 1, 0, 's'},
{"port", 1, 0, 'p'},
{"user", 1, 0, 'u'},
{"password", 1, 0, 'v'},
{"from", 1, 0, 'f'},
{"tls", 0, 0, 'S'},
{"no-esmtp", 0, 0, 'E'},
};
while(1) {
if ((r = getopt_long(argc, argv, "s:p:u:v:f:SE", long_options, &indx)) < 0)
break;
switch (r) {
case 's':
if (smtp_server != NULL)
free(smtp_server);
smtp_server = strdup(optarg);
break;
case 'p':
smtp_port = (uint16_t) strtoul(optarg, NULL, 10);
break;
case 'u':
if (smtp_user != NULL)
free(smtp_user);
smtp_user = strdup(optarg);
break;
case 'v':
if (smtp_password != NULL)
free(smtp_password);
smtp_password = strdup(optarg);
break;
case 'f':
if (smtp_from != NULL)
free(smtp_from);
smtp_from = strdup(optarg);
break;
case 'S':
smtp_tls = 1;
break;
case 'E':
smtp_esmtp = 0;
break;
}
}
argc -= optind;
argv += optind;
if (argc < 1) {
fprintf(stderr, "usage: smtpsend [-f from] [-u user] [-v password] [-s server] [-p port] [-S] <rcpts>...\n");
return EXIT_FAILURE;
}
if (smtp_from == NULL && (smtp_from = guessfrom()) == NULL) {
fprintf(stderr, "can't guess a valid from, please use -f option.\n");
return EXIT_FAILURE;
}
/* reads message from stdin */
if (collect(&message))
return EXIT_FAILURE;
send_message(message.data, message.len, argv);
release(&message);
return EXIT_SUCCESS;
}
| chriskmanx/qmole | QMOLEDEV/libetpan-0.57/tests/smtpsend.c | C | gpl-3.0 | 7,073 | [
30522,
1013,
1008,
1008,
3722,
5653,
12339,
4005,
2478,
15488,
25856,
2007,
5622,
20915,
9739,
999,
1008,
28681,
2080,
1024,
2440,
4604,
21397,
2066,
8278,
1008,
1013,
1001,
2065,
3207,
2546,
2031,
1035,
9530,
8873,
2290,
1035,
1044,
1001,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 2009-2012 the original author or authors.
--
-- 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.
--
drop table if exists users;
create table users (
id int,
name varchar(20)
);
insert into users (id, name) values(1, 'User1');
insert into users (id, name) values(2, 'User2');
insert into users (id, name) values(3, 'User3');
| qiuyesuifeng/mybatis-3 | src/test/java/org/apache/ibatis/submitted/result_handler/CreateDB.sql | SQL | apache-2.0 | 879 | [
30522,
1011,
1011,
1011,
1011,
9385,
2268,
1011,
2262,
1996,
2434,
3166,
2030,
6048,
1012,
1011,
1011,
1011,
1011,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1011,
1011,
2017,
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... |
This quick start guide will teach you how to wire up TypeScript with [Knockout.js](http://knockoutjs.com/).
We assume that you're already using [Node.js](https://nodejs.org/) with [npm](https://www.npmjs.com/).
# Lay out the project
Let's start out with a new directory.
We'll name it `proj` for now, but you can change it to whatever you want.
```shell
mkdir proj
cd proj
```
To start, we're going to structure our project in the following way:
```text
proj/
+- src/
+- built/
```
TypeScript files will start out in your `src` folder, run through the TypeScript compiler, and end up in `built`.
Let's scaffold this out:
```shell
mkdir src
mkdir built
```
# Install our build dependencies
First ensure TypeScript and Typings are installed globally.
```shell
npm install -g typescript typings
```
You obviously know about TypeScript, but you might not know about Typings.
[Typings](https://www.npmjs.com/package/typings) is a package manager for grabbing definition files.
We'll now use Typings to grab declaration files for Knockout:
```shell
typings install --global --save dt~knockout
```
The `--global` flag will tell Typings to grab any declaration files from [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped), a repository of community-authored `.d.ts` files.
This command will create a file called `typings.json` and a folder called `typings` in the current directory.
# Grab our runtime dependencies
We'll need to grab Knockout itself, as well as something called RequireJS.
[RequireJS](http://www.requirejs.org/) is a library that enables us to load modules at runtime asynchronously.
There are several ways we can go about this:
1. Download the files manually and host them.
2. Download the files through a package manager like [Bower](http://bower.io/) and host them.
3. Use a Content Delivery Network (CDN) to host both files.
We'll keep it simple and go with the first option, but Knockout's documentation has [details on using a CDN](http://knockoutjs.com/downloads/index.html), and more libraries like RequireJS can be searched for on [cdnjs](https://cdnjs.com/).
Let's create an `externals` folder in the root of our project.
```shell
mkdir externals
```
Now [download Knockout](http://knockoutjs.com/downloads/index.html) and [download RequireJS](http://www.requirejs.org/docs/download.html#latest) into that folder.
The latest and minified versions of the files should work just fine.
# Add a TypeScript configuration file
You'll want to bring your TypeScript files together - both the code you'll be writing as well as any necessary declaration files.
To do this, you'll need to create a `tsconfig.json` which contains a list of your input files as well as all your compilation settings.
Simply create a new file in your project root named `tsconfig.json` and fill it with the following contents:
```json
{
"compilerOptions": {
"outDir": "./built/",
"sourceMap": true,
"noImplicitAny": true,
"module": "amd",
"target": "es5"
},
"files": [
"./typings/index.d.ts",
"./src/require-config.ts",
"./src/hello.ts"
]
}
```
We're including `typings/index.d.ts`, which Typings created for us.
That file automatically includes all of your installed dependencies.
You can learn more about `tsconfig.json` files [here](../tsconfig.json.md).
# Write some code
Let's write our first TypeScript file using Knockout.
First, create a new file in your `src` directory named `hello.ts`.
```ts
import * as ko from "knockout";
class HelloViewModel {
language: KnockoutObservable<string>
framework: KnockoutObservable<string>
constructor(language: string, framework: string) {
this.language = ko.observable(language);
this.framework = ko.observable(framework);
}
}
ko.applyBindings(new HelloViewModel("TypeScript", "Knockout"));
```
Next, we'll create a file named `require-config.ts` in `src` as well.
```ts
declare var require: any;
require.config({
paths: {
"knockout": "externals/knockout-3.4.0",
}
});
```
This file will tell RequireJS where to find Knockout when we import it, just like we did in `hello.ts`.
Any page that you create should include this immediately after RequireJS, but before importing anything else.
To get a better understanding of this file and how to configure RequireJS, you can [read up on its documentation](http://requirejs.org/docs/api.html#config).
We'll also need a view to display our `HelloViewModel`.
Create a file at the root of `proj` named `index.html` with the following contents:
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello Knockout!</title>
</head>
<body>
<p>
Hello from
<strong data-bind="text: language">todo</strong>
and
<strong data-bind="text: framework">todo</strong>!
</p>
<p>Language: <input data-bind="value: language" /></p>
<p>Framework: <input data-bind="value: framework" /></p>
<script src="./externals/require.js"></script>
<script src="./built/require-config.js"></script>
<script>
require(["built/hello"]);
</script>
</body>
</html>
```
Notice there are three script tags.
First, we're including RequireJS itself.
Then we're mapping the paths of our external dependencies in `require-config.js` so that RequireJS knows where to look for them.
Finally, we're calling `require` with a list of modules we'd like to load.
# Putting it all together
Just run:
```shell
tsc
```
Now open up `index.html` in your favorite browser and everything should be ready to use!
You should see a page that says "Hello from TypeScript and Knockout!"
Below that, you'll also see two input boxes.
As you modify their contents and switch focus, you'll see that the original message changes.
| zspitz/TypeScript-Handbook | pages/tutorials/Knockout.md | Markdown | apache-2.0 | 5,913 | [
30522,
2023,
4248,
2707,
5009,
2097,
6570,
2017,
2129,
2000,
7318,
2039,
4127,
23235,
2007,
1031,
11369,
1012,
1046,
2015,
1033,
1006,
8299,
1024,
1013,
1013,
11369,
22578,
1012,
4012,
1013,
1007,
1012,
30524,
4012,
1013,
1007,
1012,
1001,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 MIT License (MIT)
Copyright (c) 2013 Clover Studio Ltd. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#import "HUBaseViewController.h"
#import "HUEditableLabelDelegate.h"
#define kLabelMarginLeft 60
#define kMargin 5
@class ModelUser,HUImageView;
@interface HUProfileViewController : HUBaseViewController <UIImagePickerControllerDelegate, UINavigationControllerDelegate,HUEditableLabelDelegate,UIActionSheetDelegate>{
IBOutlet UIButton *_startConversationBtn;
IBOutlet UILabel *_nameLabel;
IBOutlet UILabel *_nameValueLabel;
IBOutlet UILabel *_lastLoginLabel;
IBOutlet UILabel *_lastLoginValueLabel;
IBOutlet UILabel *_aboutLabel;
IBOutlet UILabel *_aboutValueLabel;
IBOutlet UILabel *_birthdayLabel;
IBOutlet UILabel *_birthdayValueLabel;
IBOutlet UILabel *_genderLabel;
IBOutlet UILabel *_genderValueLabel;
IBOutlet UILabel *_statusLabel;
IBOutlet UILabel *_statusValueLabel;
IBOutlet UIView *_bottomElement;
IBOutlet UIImageView *_onlineStatusIconView;
IBOutlet NSLayoutConstraint *_avatarImageViewHeightConstraint;
IBOutlet NSLayoutConstraint *_aboutViewHeightConstraint;
IBOutlet NSLayoutConstraint *_contentHeightConstraint;
}
@property (nonatomic, strong) ModelUser *user;
@property (nonatomic, strong) IBOutlet UIScrollView *contentView;
@property (nonatomic, strong) IBOutlet HUImageView *userAvatarImageView;
- (id)initWithUser:(ModelUser *) user;
- (id)initWithNibName:(NSString *)nibNameOrNil withUser:(ModelUser *)user;
- (IBAction)startConversation:(id)sender;
@end
| JustinMuniz/HoverChat-iOS-App | Spika/ViewControllers/Profile/HUProfileViewController.h | C | mit | 2,664 | [
30522,
1013,
1008,
1996,
10210,
6105,
1006,
10210,
1007,
9385,
1006,
1039,
1007,
2286,
25133,
2996,
5183,
1012,
2035,
2916,
9235,
1012,
6656,
2003,
2182,
3762,
4379,
1010,
2489,
1997,
3715,
1010,
2000,
2151,
2711,
11381,
1037,
6100,
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... |
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Iterating Over the Matches Within An MFC String</title>
<link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
<link rel="home" href="../../../../index.html" title="Boost.Regex">
<link rel="up" href="../mfc_strings.html" title="Using Boost Regex With MFC Strings">
<link rel="prev" href="mfc_algo.html" title="Overloaded Algorithms For MFC String Types">
<link rel="next" href="../../posix.html" title="POSIX Compatible C API's">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="mfc_algo.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../mfc_strings.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../../posix.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section" lang="en">
<div class="titlepage"><div><div><h5 class="title">
<a name="boost_regex.ref.non_std_strings.mfc_strings.mfc_iter"></a><a class="link" href="mfc_iter.html" title="Iterating Over the Matches Within An MFC String">Iterating
Over the Matches Within An MFC String</a>
</h5></div></div></div>
<p>
The following helper functions are provided to ease the conversion from
an MFC/ATL string to a <a class="link" href="../../regex_iterator.html" title="regex_iterator"><code class="computeroutput"><span class="identifier">regex_iterator</span></code></a> or <a class="link" href="../../regex_token_iterator.html" title="regex_token_iterator"><code class="computeroutput"><span class="identifier">regex_token_iterator</span></code></a>:
</p>
<a name="boost_regex.ref.non_std_strings.mfc_strings.mfc_iter.regex_iterator_creation_helper"></a><h5>
<a name="id1108946"></a>
<a class="link" href="mfc_iter.html#boost_regex.ref.non_std_strings.mfc_strings.mfc_iter.regex_iterator_creation_helper">regex_iterator
creation helper</a>
</h5>
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">></span>
<span class="identifier">regex_iterator</span><span class="special"><</span><span class="identifier">charT</span> <span class="keyword">const</span><span class="special">*></span>
<span class="identifier">make_regex_iterator</span><span class="special">(</span>
<span class="keyword">const</span> <span class="identifier">ATL</span><span class="special">::</span><span class="identifier">CSimpleStringT</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>&</span> <span class="identifier">s</span><span class="special">,</span>
<span class="keyword">const</span> <span class="identifier">basic_regex</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>&</span> <span class="identifier">e</span><span class="special">,</span>
<span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">f</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_default</span><span class="special">);</span>
</pre>
<p>
<span class="bold"><strong>Effects</strong></span>: returns <code class="computeroutput"><span class="identifier">regex_iterator</span><span class="special">(</span><span class="identifier">s</span><span class="special">.</span><span class="identifier">GetString</span><span class="special">(),</span> <span class="identifier">s</span><span class="special">.</span><span class="identifier">GetString</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">s</span><span class="special">.</span><span class="identifier">GetLength</span><span class="special">(),</span>
<span class="identifier">e</span><span class="special">,</span>
<span class="identifier">f</span><span class="special">);</span></code>
</p>
<p>
<span class="bold"><strong>Example</strong></span>:
</p>
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">enumerate_links</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">CString</span><span class="special">&</span> <span class="identifier">html</span><span class="special">)</span>
<span class="special">{</span>
<span class="comment">// enumerate and print all the links in some HTML text,
</span> <span class="comment">// the expression used is by Andew Lee on www.regxlib.com:
</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">tregex</span> <span class="identifier">r</span><span class="special">(</span>
<span class="identifier">__T</span><span class="special">(</span><span class="string">"href=[\"\']((http:\\/\\/|\\.\\/|\\/)?\\w+"</span>
<span class="string">"(\\.\\w+)*(\\/\\w+(\\.\\w+)?)*"</span>
<span class="string">"(\\/|\\?\\w*=\\w*(&\\w*=\\w*)*)?)[\"\']"</span><span class="special">));</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">tregex_iterator</span> <span class="identifier">i</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_regex_iterator</span><span class="special">(</span><span class="identifier">html</span><span class="special">,</span> <span class="identifier">r</span><span class="special">)),</span> <span class="identifier">j</span><span class="special">;</span>
<span class="keyword">while</span><span class="special">(</span><span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">j</span><span class="special">)</span>
<span class="special">{</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="special">(*</span><span class="identifier">i</span><span class="special">)[</span><span class="number">1</span><span class="special">]</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
<span class="special">++</span><span class="identifier">i</span><span class="special">;</span>
<span class="special">}</span>
<span class="special">}</span>
</pre>
<a name="boost_regex.ref.non_std_strings.mfc_strings.mfc_iter.regex_token_iterator_creation_helpers"></a><h5>
<a name="id1109494"></a>
<a class="link" href="mfc_iter.html#boost_regex.ref.non_std_strings.mfc_strings.mfc_iter.regex_token_iterator_creation_helpers">regex_token_iterator
creation helpers</a>
</h5>
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">></span>
<span class="identifier">regex_token_iterator</span><span class="special"><</span><span class="identifier">charT</span> <span class="keyword">const</span><span class="special">*></span>
<span class="identifier">make_regex_token_iterator</span><span class="special">(</span>
<span class="keyword">const</span> <span class="identifier">ATL</span><span class="special">::</span><span class="identifier">CSimpleStringT</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>&</span> <span class="identifier">s</span><span class="special">,</span>
<span class="keyword">const</span> <span class="identifier">basic_regex</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>&</span> <span class="identifier">e</span><span class="special">,</span>
<span class="keyword">int</span> <span class="identifier">sub</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span>
<span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">f</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_default</span><span class="special">);</span>
</pre>
<p>
<span class="bold"><strong>Effects</strong></span>: returns <code class="computeroutput"><span class="identifier">regex_token_iterator</span><span class="special">(</span><span class="identifier">s</span><span class="special">.</span><span class="identifier">GetString</span><span class="special">(),</span> <span class="identifier">s</span><span class="special">.</span><span class="identifier">GetString</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">s</span><span class="special">.</span><span class="identifier">GetLength</span><span class="special">(),</span>
<span class="identifier">e</span><span class="special">,</span>
<span class="identifier">sub</span><span class="special">,</span>
<span class="identifier">f</span><span class="special">);</span></code>
</p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">></span>
<span class="identifier">regex_token_iterator</span><span class="special"><</span><span class="identifier">charT</span> <span class="keyword">const</span><span class="special">*></span>
<span class="identifier">make_regex_token_iterator</span><span class="special">(</span>
<span class="keyword">const</span> <span class="identifier">ATL</span><span class="special">::</span><span class="identifier">CSimpleStringT</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>&</span> <span class="identifier">s</span><span class="special">,</span>
<span class="keyword">const</span> <span class="identifier">basic_regex</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>&</span> <span class="identifier">e</span><span class="special">,</span>
<span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">int</span><span class="special">>&</span> <span class="identifier">subs</span><span class="special">,</span>
<span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">f</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_default</span><span class="special">);</span>
</pre>
<p>
<span class="bold"><strong>Effects</strong></span>: returns <code class="computeroutput"><span class="identifier">regex_token_iterator</span><span class="special">(</span><span class="identifier">s</span><span class="special">.</span><span class="identifier">GetString</span><span class="special">(),</span> <span class="identifier">s</span><span class="special">.</span><span class="identifier">GetString</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">s</span><span class="special">.</span><span class="identifier">GetLength</span><span class="special">(),</span>
<span class="identifier">e</span><span class="special">,</span>
<span class="identifier">subs</span><span class="special">,</span>
<span class="identifier">f</span><span class="special">);</span></code>
</p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">charT</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">N</span><span class="special">></span>
<span class="identifier">regex_token_iterator</span><span class="special"><</span><span class="identifier">charT</span> <span class="keyword">const</span><span class="special">*></span>
<span class="identifier">make_regex_token_iterator</span><span class="special">(</span>
<span class="keyword">const</span> <span class="identifier">ATL</span><span class="special">::</span><span class="identifier">CSimpleStringT</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>&</span> <span class="identifier">s</span><span class="special">,</span>
<span class="keyword">const</span> <span class="identifier">basic_regex</span><span class="special"><</span><span class="identifier">charT</span><span class="special">>&</span> <span class="identifier">e</span><span class="special">,</span>
<span class="keyword">const</span> <span class="keyword">int</span> <span class="special">(&</span> <span class="identifier">subs</span><span class="special">)[</span><span class="identifier">N</span><span class="special">],</span>
<span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_flag_type</span> <span class="identifier">f</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">regex_constants</span><span class="special">::</span><span class="identifier">match_default</span><span class="special">);</span>
</pre>
<p>
<span class="bold"><strong>Effects</strong></span>: returns <code class="computeroutput"><span class="identifier">regex_token_iterator</span><span class="special">(</span><span class="identifier">s</span><span class="special">.</span><span class="identifier">GetString</span><span class="special">(),</span> <span class="identifier">s</span><span class="special">.</span><span class="identifier">GetString</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">s</span><span class="special">.</span><span class="identifier">GetLength</span><span class="special">(),</span>
<span class="identifier">e</span><span class="special">,</span>
<span class="identifier">subs</span><span class="special">,</span>
<span class="identifier">f</span><span class="special">);</span></code>
</p>
<p>
<span class="bold"><strong>Example</strong></span>:
</p>
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">enumerate_links2</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">CString</span><span class="special">&</span> <span class="identifier">html</span><span class="special">)</span>
<span class="special">{</span>
<span class="comment">// enumerate and print all the links in some HTML text,
</span> <span class="comment">// the expression used is by Andew Lee on www.regxlib.com:
</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">tregex</span> <span class="identifier">r</span><span class="special">(</span>
<span class="identifier">__T</span><span class="special">(</span><span class="string">"href=[\"\']((http:\\/\\/|\\.\\/|\\/)?\\w+"</span>
<span class="string">"(\\.\\w+)*(\\/\\w+(\\.\\w+)?)*"</span>
<span class="string">"(\\/|\\?\\w*=\\w*(&\\w*=\\w*)*)?)[\"\']"</span><span class="special">));</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">tregex_token_iterator</span> <span class="identifier">i</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_regex_token_iterator</span><span class="special">(</span><span class="identifier">html</span><span class="special">,</span> <span class="identifier">r</span><span class="special">,</span> <span class="number">1</span><span class="special">)),</span> <span class="identifier">j</span><span class="special">;</span>
<span class="keyword">while</span><span class="special">(</span><span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">j</span><span class="special">)</span>
<span class="special">{</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="special">*</span><span class="identifier">i</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
<span class="special">++</span><span class="identifier">i</span><span class="special">;</span>
<span class="special">}</span>
<span class="special">}</span>
</pre>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 1998 -2010 John Maddock<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="mfc_algo.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../mfc_strings.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../../posix.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
| gorkinovich/DefendersOfMankind | dependencies/boost-1.46.0/libs/regex/doc/html/boost_regex/ref/non_std_strings/mfc_strings/mfc_iter.html | HTML | gpl-3.0 | 20,037 | [
30522,
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,
2149,
1011,
2004,
6895,
2072,
1000,
1028,
1026,
2516,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
/**
* @package Gantry5
* @author RocketTheme http://www.rockettheme.com
* @copyright Copyright (C) 2007 - 2015 RocketTheme, LLC
* @license Dual License: MIT or GNU/GPLv2 and later
*
* http://opensource.org/licenses/MIT
* http://www.gnu.org/licenses/gpl-2.0.html
*
* Gantry Framework code that extends GPL code is considered GNU/GPLv2 and later
*/
namespace Gantry\Component\Stylesheet;
use Gantry\Component\Stylesheet\Less\Compiler;
use Gantry\Framework\Base\Gantry;
use RocketTheme\Toolbox\File\File;
use RocketTheme\Toolbox\ResourceLocator\UniformResourceLocator;
class LessCompiler extends CssCompiler
{
/**
* @var string
*/
public $type = 'less';
/**
* @var string
*/
public $name = 'LESS';
/**
* @var Compiler
*/
protected $compiler;
/**
* Constructor.
*/
public function __construct()
{
parent::__construct();
$this->compiler = new Compiler();
if ($this->production) {
$this->compiler->setFormatter('lessjs');
} else {
$this->compiler->setFormatter('compressed');
$this->compiler->setPreserveComments(true);
}
}
public function setFonts(array $fonts)
{
$this->fonts = $fonts;
}
public function compile($in)
{
return $this->compiler->compile($in);
}
public function resetCache()
{
}
/**
* @param string $in Filename without path or extension.
* @return bool True if the output file was saved.
*/
public function compileFile($in)
{
// Buy some extra time as compilation may take a lot of time in shared environments.
@set_time_limit(30);
ob_start();
$gantry = Gantry::instance();
/** @var UniformResourceLocator $locator */
$locator = $gantry['locator'];
$out = $this->getCssUrl($in);
$path = $locator->findResource($out, true, true);
$file = File::instance($path);
// Attempt to lock the file for writing.
try {
$file->lock(false);
} catch (\Exception $e) {
// Another process has locked the file; we will check this in a bit.
}
if ($file->locked() === false) {
// File was already locked by another process, lets avoid compiling the same file twice.
return false;
}
$paths = $locator->mergeResources($this->paths);
// Set the lookup paths.
$this->compiler->setBasePath($path);
$this->compiler->setImportDir($paths);
// Run the compiler.
$this->compiler->setVariables($this->getVariables());
$css = $this->compiler->compileFile($in . '.less"');
$warnings = trim(ob_get_clean());
if ($warnings) {
$this->warnings[$in] = explode("\n", $warnings);
}
if (!$this->production) {
$warning = <<<WARN
/* GANTRY5 DEVELOPMENT MODE ENABLED.
WARNING: This file is automatically generated by Gantry5. Any modifications to this file will be lost!
For more information on modifying CSS, please read:
http://docs.gantry.org/gantry5/configure/styles
http://docs.gantry.org/gantry5/tutorials/adding-a-custom-style-sheet
*/
WARN;
$css = $warning . "\n\n" . $css;
}
$file->save($css);
$file->unlock();
$file->free();
$this->createMeta($out, md5($css));
return true;
}
/**
* @param string $name Name of function to register to the compiler.
* @param callable $callback Function to run when called by the compiler.
* @return $this
*/
public function registerFunction($name, callable $callback)
{
$this->compiler->registerFunction($name, $callback);
return $this;
}
/**
* @param string $name Name of function to unregister.
* @return $this
*/
public function unregisterFunction($name)
{
$this->compiler->unregisterFunction($name);
return $this;
}
}
| JozefAB/neoacu | libraries/gantry5/classes/Gantry/Component/Stylesheet/LessCompiler.php | PHP | gpl-2.0 | 4,104 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
1030,
7427,
25957,
11129,
2629,
1008,
1030,
3166,
7596,
10760,
4168,
8299,
1024,
1013,
1013,
7479,
1012,
7596,
10760,
4168,
1012,
4012,
1008,
1030,
9385,
9385,
1006,
1039,
1007,
2289,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
define([], function() {
return function($translateProvider) {
$translateProvider.translations('en', {
WELCOME_TO_PIO: 'Welcome to PIO',
SIGN_IN: 'Sign in',
SIGN_UP: 'Sign up',
SIGN_OUT: 'Sign out',
FORGOT_PASSWORD: 'Forgot password?',
DO_NOT_HAVE_AN_ACCOUNT: 'Do not have an account?',
CREATE_AN_ACCOUNT: 'Create an account',
POLLS: 'Polls',
ADMINISTRATION: 'Administration',
TITLE: 'Title',
USERS: 'Users',
CREATE: 'Create',
DASHBOARD: 'Dashboard',
DETAILS: 'Details',
DETAIL: 'Detail',
CREATE_POLL: 'Create poll',
CREATE_USER: 'Create user',
POLL_DETAILS: 'Poll details',
USER_DETAILS: 'User details',
TAGS: 'Tags',
SUMMARY: 'Summary',
STATUS: 'Status',
NAME: 'Name',
AVATAR: 'Avatar',
POLLINGS: 'Pollings',
NOTES: 'Notes',
EMAIL: 'Email',
DATE: 'Date',
SAVE: 'Save',
CANCEL: 'Cancel'
});
$translateProvider.translations('es', {
WELCOME_TO_PIO: 'Bienvenido a PIO',
SIGN_IN: 'Acceder',
SIGN_UP: 'Registro',
SIGN_OUT: 'Salir',
FORGOT_PASSWORD: '¿Olvidó la contraseña?',
DO_NOT_HAVE_AN_ACCOUNT: '¿No tiene una cuenta?',
CREATE_AN_ACCOUNT: 'Crear un acuenta',
POLLS: 'Encuestas',
ADMINISTRATION: 'Administración',
TITLE: 'Título',
USERS: 'Usuarios',
CREATE: 'Crear',
DASHBOARD: 'Panel',
DETAILS: 'Detalles',
DETAIL: 'Detalle',
CREATE_POLL: 'Crear encuesta',
CREATE_USER: 'Crear usuario',
POLL_DETAILS: 'Detalles de encuesta',
USER_DETAILS: 'Detalles de usuario',
TAGS: 'Etiquetas',
SUMMARY: 'Resumen',
STATUS: 'Estado',
NAME: 'Nombre',
AVATAR: 'Avatar',
POLLINGS: 'Votaciones',
NOTES: 'Notas',
EMAIL: 'Correo',
DATE: 'Fecha',
SAVE: 'Guardar',
CANCEL: 'Cancelar'
});
$translateProvider.useSanitizeValueStrategy('escapeParameters');
$translateProvider.preferredLanguage('es');
};
});
| rubeniskov/node-pio | app/src/i18n.js | JavaScript | mit | 2,466 | [
30522,
9375,
1006,
1031,
1033,
1010,
3853,
1006,
1007,
1063,
2709,
3853,
1006,
1002,
17637,
21572,
17258,
2121,
1007,
1063,
1002,
17637,
21572,
17258,
2121,
1012,
11913,
1006,
1005,
4372,
1005,
1010,
1063,
6160,
1035,
2000,
1035,
14255,
208... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 TrinityCore Project. See AUTHORS file for Copyright information
*
* 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, see <http://www.gnu.org/licenses/>.
*/
/* ScriptData
SDName: Silverpine_Forest
SD%Complete: 100
SDComment: Quest support: 435
SDCategory: Silverpine Forest
EndScriptData */
/* ContentData
npc_deathstalker_erland
EndContentData */
#include "ScriptMgr.h"
#include "Player.h"
#include "ScriptedEscortAI.h"
/*######
## npc_deathstalker_erland
######*/
enum eErland
{
SAY_QUESTACCEPT = 0,
SAY_START = 1,
SAY_AGGRO = 2,
SAY_PROGRESS = 3,
SAY_LAST = 4,
SAY_RANE = 0,
SAY_RANE_ANSWER = 5,
SAY_MOVE_QUINN = 6,
SAY_QUINN = 7,
SAY_QUINN_ANSWER = 0,
SAY_BYE = 8,
QUEST_ESCORTING = 435,
NPC_RANE = 1950,
NPC_QUINN = 1951
};
class npc_deathstalker_erland : public CreatureScript
{
public:
npc_deathstalker_erland() : CreatureScript("npc_deathstalker_erland") { }
struct npc_deathstalker_erlandAI : public EscortAI
{
npc_deathstalker_erlandAI(Creature* creature) : EscortAI(creature) { }
void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
{
Player* player = GetPlayerForEscort();
if (!player)
return;
switch (waypointId)
{
case 1:
Talk(SAY_START, player);
break;
case 10:
Talk(SAY_PROGRESS);
break;
case 13:
Talk(SAY_LAST, player);
player->GroupEventHappens(QUEST_ESCORTING, me);
break;
case 15:
if (Creature* rane = me->FindNearestCreature(NPC_RANE, 20.0f))
rane->AI()->Talk(SAY_RANE);
break;
case 16:
Talk(SAY_RANE_ANSWER);
break;
case 17:
Talk(SAY_MOVE_QUINN);
break;
case 24:
Talk(SAY_QUINN);
break;
case 25:
if (Creature* quinn = me->FindNearestCreature(NPC_QUINN, 20.0f))
quinn->AI()->Talk(SAY_QUINN_ANSWER);
break;
case 26:
Talk(SAY_BYE);
break;
}
}
void Reset() override { }
void EnterCombat(Unit* who) override
{
Talk(SAY_AGGRO, who);
}
void QuestAccept(Player* player, Quest const* quest) override
{
if (quest->GetQuestId() == QUEST_ESCORTING)
{
Talk(SAY_QUESTACCEPT, player);
Start(true, false, player->GetGUID());
}
}
};
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_deathstalker_erlandAI(creature);
}
};
/*######
## AddSC
######*/
void AddSC_silverpine_forest()
{
new npc_deathstalker_erland();
}
| Nalliestrasza/LegionHearth | src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp | C++ | gpl-2.0 | 3,786 | [
30522,
1013,
1008,
1008,
2023,
5371,
2003,
2112,
1997,
1996,
7124,
17345,
2622,
1012,
2156,
6048,
5371,
2005,
9385,
2592,
1008,
1008,
2023,
2565,
2003,
2489,
4007,
1025,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1998,
1013,
2030,
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... |
<div class="sidebar">
<div class="container sidebar-sticky">
<div class="sidebar-about">
<h1>{{ site.title }}</h1>
<p class="lead">{{ site.description }}</p>
</div>
<ul class="sidebar-nav">
<li class="sidebar-nav-item{% if page.title == "Home" %} active{% endif %}">
<a href="/">Home</a>
</li>
{% comment %}
The code below dynamically generates a sidebar nav of pages with
`layout: page` in the front-matter. See readme for usage.
{% endcomment %}
{% assign pages_list = site.pages %}
{% for node in pages_list %}
{% if node.title != null %}
{% if node.layout == "page" %}
<li class="sidebar-nav-item{% if page.url == node.url %} active{% endif %}">
<a href="{{ node.url }}">{{ node.title }}</a>
</li>
{% endif %}
{% endif %}
{% endfor %}
<li class="sidebar-nav-item"><a href="{{ site.github.repo }}">GitHub</a></li>
<li class="sidebar-nav-item"><a href="{{ site.linkedin.url }}">LinkedIn</a></li>
<li class="sidebar-nav-item"><a href="{{ site.twitter }}">Twitter</a></li>
<li class="sidebar-nav-item"><a href="{{ site.resume }}">Resume</a></li>
<li class="sidebar-nav-item">Currently v{{ site.version }}</li>
</ul>
<p>© {{ site.time | date: '%Y' }}. All rights reserved.</p>
</div>
</div>
| edwinbosire/edwinbosire.github.io | _includes/sidebar.html | HTML | apache-2.0 | 1,406 | [
30522,
1026,
4487,
2615,
2465,
1027,
1000,
2217,
8237,
1000,
1028,
1026,
4487,
2615,
2465,
1027,
1000,
11661,
2217,
8237,
1011,
15875,
1000,
1028,
1026,
4487,
2615,
2465,
1027,
1000,
2217,
8237,
1011,
2055,
1000,
1028,
1026,
1044,
2487,
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... |
var data = {videos-content: {}} | ulabspro/ilq | markup/components/videos-content/data/data.js | JavaScript | mit | 31 | [
30522,
13075,
2951,
1027,
1063,
6876,
1011,
4180,
1024,
1063,
1065,
1065,
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,
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 issues.issue130;
public class Impl_0 {
public int a = 0;
protected void printMe(String s) {
System.out.println(s);
}
}
| intrigus/jtransc | jtransc-main/test/issues/issue130/Impl_0.java | Java | apache-2.0 | 134 | [
30522,
7427,
3314,
1012,
3277,
17134,
2692,
1025,
2270,
2465,
17727,
2140,
1035,
1014,
1063,
2270,
20014,
1037,
1027,
1014,
1025,
5123,
11675,
6140,
4168,
1006,
5164,
1055,
1007,
1063,
2291,
1012,
2041,
1012,
6140,
19666,
1006,
1055,
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... |
/*
* 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 tech.tablesaw.sorting;
import static java.util.stream.Collectors.toSet;
import com.google.common.base.MoreObjects;
import com.google.common.base.Preconditions;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import tech.tablesaw.api.Table;
/**
* Provides fine-grained control over sorting.
*
* <p>Use:
*
* <p>table.sortOn(first("Year", DESCEND).next("State", ASCEND));
*
* <p>This sorts table on the column named year in descending order, such that the most recent years
* appear first, then on State, in ascending order so "AL" will appear before "CA". You can add
* additional instructions for multi-column sorts by chaining additional calls to next() with the
* appropriate column names and Order.
*/
public class Sort implements Iterable<Map.Entry<String, Sort.Order>> {
private final LinkedHashMap<String, Order> sortOrder = new LinkedHashMap<>();
/**
* Constructs a Sort specifying the order (ascending or descending) to apply to the column with
* the given name
*/
public Sort(String columnName, Order order) {
next(columnName, order);
}
/**
* Returns a Sort specifying the order (ascending or descending) to apply to the column with the
* given name
*/
public static Sort on(String columnName, Order order) {
return new Sort(columnName, order);
}
/**
* Returns a Sort that concatenates a new sort on the given order (ascending or descending) and
* columnName onto the sort specified here. This method is used to construct complex sorts such
* as: Sort.on("foo", Order.ASCEND).next("bar", Order.DESCEND);
*/
public Sort next(String columnName, Order order) {
sortOrder.put(columnName, order);
return this;
}
/** Returns true if no order has been set */
public boolean isEmpty() {
return sortOrder.isEmpty();
}
/** Returns the number of columns used in this sort */
public int size() {
return sortOrder.size();
}
/**
* Create a Sort object from the given table and sort column names. Does not sort the table.
*
* @param table to sort. Used only to pull the table's schema. Does not modify the table.
* @param columnNames The columns to sort on. Can prefix column name with + for ascending, - for
* descending. Default to ascending if no prefix is added.
* @return a {@link #Sort} Object.
*/
public static Sort create(Table table, String... columnNames) {
Preconditions.checkArgument(columnNames.length > 0, "At least one sort column must provided.");
Sort key = null;
Set<String> names = table.columnNames().stream().map(String::toUpperCase).collect(toSet());
for (String columnName : columnNames) {
Sort.Order order = Sort.Order.ASCEND;
if (!names.contains(columnName.toUpperCase())) {
// the column name has been annotated with a prefix.
// get the prefix which could be - or +
String prefix = columnName.substring(0, 1);
Optional<Order> orderOptional = getOrder(prefix);
// Invalid prefix, column name exists on table.
if (!orderOptional.isPresent() && names.contains(columnName.substring(1).toUpperCase())) {
throw new IllegalStateException("Column prefix: " + prefix + " is unknown.");
}
// Valid prefix, column name does not exist on table.
if (orderOptional.isPresent() && !names.contains(columnName.substring(1).toUpperCase())) {
throw new IllegalStateException(
String.format(
"Column %s does not exist in table %s", columnName.substring(1), table.name()));
}
// Invalid prefix, column name does not exist on table.
if (!orderOptional.isPresent()) {
throw new IllegalStateException("Unrecognized Column: '" + columnName + "'");
}
// Valid Prefix, column name exists on table.
// remove - prefix so provided name matches actual column name
columnName = columnName.substring(1);
order = orderOptional.get();
}
if (key == null) { // key will be null the first time through
key = new Sort(columnName, order);
} else {
key.next(columnName, order);
}
}
return key;
}
private static Optional<Order> getOrder(String prefix) {
switch (prefix) {
case "+":
return Optional.of(Order.ASCEND);
case "-":
return Optional.of(Order.DESCEND);
default:
return Optional.empty();
}
}
/**
* Returns an iterator over elements of type {@code T}.
*
* @return an Iterator.
*/
@Override
public Iterator<Map.Entry<String, Order>> iterator() {
return sortOrder.entrySet().iterator();
}
@Override
public String toString() {
return MoreObjects.toStringHelper(this).add("order", sortOrder).toString();
}
public enum Order {
ASCEND,
DESCEND
}
}
| jtablesaw/tablesaw | core/src/main/java/tech/tablesaw/sorting/Sort.java | Java | apache-2.0 | 5,503 | [
30522,
1013,
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,
5371,
3272,
1999,
12646,
2007,
1996,
6105,
1012,
1008,
2017,
2089,
6855,
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... |
# Psychopsis limminghei (E.Morren ex Lindl.) M.W.Chase SPECIES
#### Status
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
Oncidium limminghei E.Morren ex Lindl.
### Remarks
null | mdoering/backbone | life/Plantae/Magnoliophyta/Liliopsida/Asparagales/Orchidaceae/Psychopsis/Psychopsis limminghei/README.md | Markdown | apache-2.0 | 244 | [
30522,
1001,
18224,
18409,
18525,
6562,
26036,
1006,
1041,
1012,
22822,
7389,
4654,
11409,
19422,
1012,
1007,
1049,
1012,
1059,
1012,
5252,
2427,
1001,
1001,
1001,
1001,
3570,
3970,
1001,
1001,
1001,
1001,
2429,
2000,
1996,
10161,
1997,
216... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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: default
title: (unrecognied function)(FIXME!)
---
[Top](../index.html)
---
### 定義場所(file name)
hotspot/src/share/vm/prims/jni.cpp
### 説明(description)
```
// Returns the function structure
```
### 名前(function name)
```
struct JNINativeInterface_* jni_functions_nocheck() {
```
### 本体部(body)
```
return &jni_NativeInterface;
}
```
| hsmemo/hsmemo.github.com | articles/no17119H4h.md | Markdown | gpl-2.0 | 376 | [
30522,
1011,
1011,
1011,
9621,
1024,
12398,
2516,
1024,
1006,
4895,
2890,
3597,
29076,
2098,
3853,
1007,
1006,
8081,
4168,
999,
1007,
1011,
1011,
1011,
1031,
2327,
1033,
1006,
1012,
1012,
1013,
5950,
1012,
16129,
1007,
1011,
1011,
1011,
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... |
/**-------------------------------------------------------------------------
@file adc_nau7802.h
@brief Nuvoton NAU7802 24-Bit Dual-Channel ADC For Bridge Sensors
This device has 2 channels multiplexed. Same settings for both. In order
to capture both channel.
For single channel operation, channel 0 (VIN1P/N) must used and filter caps must be
enabled on channel 1 (VIN2P/N)
@author Hoang Nguyen Hoan
@date Nov. 3, 2019
@license
MIT License
Copyright (c) 2019 I-SYST inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
----------------------------------------------------------------------------*/
#ifndef __ADC_NAU7802_H__
#define __ADC_NAU7802_H__
#include <stdint.h>
#include "adc_device.h"
/** @addtogroup Converters
* @{
*/
#define NAU7802_I2C_ADDR 0x2A // NAU7802 I2C 7 bits slave address
#define NAU7802_DEV_REV_REG 0x1F
#define NAU7802_DEV_REV_ID_MASK (0xF<<0)
#define NAU7802_DEV_REV_ID (0xF<<0)
#define NAU7802_PU_CTRL_REG 0x0 //
#define NAU7802_PU_CTRL_RR_RESET (1<<0) // Reset
#define NAU7802_PU_CTRL_PUD_PWRUPD (1<<1) // Power up digital circuit
#define NAU7802_PU_CTRL_PUA_PWRUPA (1<<2) // Power up analog circuit
#define NAU7802_PU_CTRL_PUR_PWRUP_RDY (1<<3) // Power up ready
#define NAU7802_PU_CTRL_CS (1<<4) // Start conversion
#define NAU7802_PU_CTRL_CR (1<<5) // Data ready
#define NAU7802_PU_CTRL_OSCS_EXT (1<<6) // Select external crystal
#define NAU7802_PU_CTRL_AVDDS_LDO (1<<7) // Select internal LDO
#define NAU7802_CTRL1_REG 0x1 //
#define NAU7802_CTRL1_GAINS_MASK (7<<0) // Gain select mask
#define NAU7802_CTRL1_GAINS_X1 (0<<0) // Gains x1
#define NAU7802_CTRL1_GAINS_X2 (1<<0) // Gains x2
#define NAU7802_CTRL1_GAINS_X4 (2<<0) // Gains x4
#define NAU7802_CTRL1_GAINS_X8 (3<<0) // Gains x8
#define NAU7802_CTRL1_GAINS_X16 (4<<0) // Gains x16
#define NAU7802_CTRL1_GAINS_X32 (5<<0) // Gains x32
#define NAU7802_CTRL1_GAINS_X64 (6<<0) // Gains x64
#define NAU7802_CTRL1_GAINS_X128 (7<<0) // Gains x128
#define NAU7802_CTRL1_VLDO_MASK (7<<3) // LDO voltage select mask
#define NAU7802_CTRL1_VLDO_4_5 (0<<3) // LDO 4.5V
#define NAU7802_CTRL1_VLDO_4_2 (1<<3) // LDO 4.2V
#define NAU7802_CTRL1_VLDO_3_9 (2<<3) // LDO 3.9V
#define NAU7802_CTRL1_VLDO_3_6 (3<<3) // LDO 3.6V
#define NAU7802_CTRL1_VLDO_3_3 (4<<3) // LDO 3.3V
#define NAU7802_CTRL1_VLDO_3_0 (5<<3) // LDO 3.0V
#define NAU7802_CTRL1_VLDO_2_7 (6<<3) // LDO 2.7V
#define NAU7802_CTRL1_VLDO_2_4 (7<<3) // LDO 2.4V
#define NAU7802_CTRL1_DRDY_SEL_DRDY (0<<6) // Select DRDY pin as data ready flag
#define NAU7802_CTRL1_DRDY_SEL_CLOCK (1<<6) // Select DRDY pin as clock output
#define NAU7802_CTRL1_CRP_CRDY_LOW (1<<7) // Select CRDY pin active low (avail on 16 pins package only)
#define NAU7802_CTRL2_REG 0x2 //
#define NAU7802_CTRL2_CALMOD_MASK (3<<0) // Calibration mode mask
#define NAU7802_CTRL2_CALMOD_INTERNAL (0<<0) // Offset calibration internal
#define NAU7802_CTRL2_CALMOD_OFFSET (2<<0) // Offset calibration system
#define NAU7802_CTRL2_CALMOD_GAIN (3<<0) // Gain calibration system
#define NAU7802_CTRL2_CALS_TRIG_CAL (1<<2) // Trigger calibration. This bit will reset to 0 when calibration done
#define NAU7802_CTRL2_CAL_ERR (1<<3) // Calibration error
#define NAU7802_CTRL2_CRS_MASK (7<<4) // Conversion rate
#define NAU7802_CTRL2_CRS_10SPS (0<<4) // 10 samples per second
#define NAU7802_CTRL2_CRS_20SPS (1<<4) // 20 samples per second
#define NAU7802_CTRL2_CRS_40SPS (2<<4) // 40 samples per second
#define NAU7802_CTRL2_CRS_80SPS (3<<4) // 80 samples per second
#define NAU7802_CTRL2_CRS_320SPS (7<<4) // 320 samples per second
#define NAU7802_CTRL2_CHS_1 (0<<7) // Select analog input channel 1
#define NAU7802_CTRL2_CHS_2 (1<<7) // Select analog input channel 2
#define NAU7802_CTRL2_CHS_BITPOS (7)
#define NAU7802_OCAL1_B2_REG 0x3 //
#define NAU7802_OCAL1_B1_REG 0x4 //
#define NAU7802_OCAL1_B0_REG 0x5 //
#define NAU7802_GCAL1_B3_REG 0x6 //
#define NAU7802_GCAL1_B2_REG 0x7 //
#define NAU7802_GCAL1_B1_REG 0x8 //
#define NAU7802_GCAL1_B0_REG 0x9 //
#define NAU7802_OCAL2_B2_REG 0xA //
#define NAU7802_OCAL2_B1_REG 0xB //
#define NAU7802_OCAL2_B0_REG 0xC //
#define NAU7802_GCAL2_B3_REG 0xD //
#define NAU7802_GCAL2_B2_REG 0xE //
#define NAU7802_GCAL2_B1_REG 0xF //
#define NAU7802_GCAL2_B0_REG 0x10 //
#define NAU7802_I2C_CONTROL_REG 0x11
#define NAU7802_I2C_CONTROL_BGPCP (1<<0) // Disable bandgap chopper
#define NAU7802_I2C_CONTROL_TS (1<<1) // Switches PGA input to temperature sensor
#define NAU7802_I2C_CONTROL_BOPGA (1<<2) // Enable 2.5uA burnout current source to PGA positive
#define NAU7802_I2C_CONTROL_SI (1<<3) // Short input together, measure offset
#define NAU7802_I2C_CONTROL_WPD (1<<4) // Disable weak pullup for I2C
#define NAU7802_I2C_CONTROL_SPE (1<<5) // Enable strong strong pullup for I2C
#define NAU7802_I2C_CONTROL_FRD (1<<6) // Enable fast read, register 0x15 bit 7 must also be 1
#define NAU7802_I2C_CONTROL_CRSD (1<<7) // Enable bit for pull SDA low
#define NAU7802_ADCO_B2_REG 0x12
#define NAU7802_ADCO_B1_REG 0x13
#define NAU7802_ADCO_B0_REG 0x14
#define NAU7802_ADC_REG 0x15
#define NAU7802_ADC_REG_CHP_MASK (3<<0)
#define NAU7802_ADC_ADC_VCM_MASK (3<<2)
#define NAU7802_ADC_REG_CHPS_MASK (3<<4)
#define NAU7802_OPT_B1_REG 0x15
#define NAU7802_OPT_B0_REG 0x16
#define NAU7802_PGA_REG 0x1B
#define NAU7802_PGA_PGACHPDIS (1<<0) // Chopper disable
#define NAU7802_PGA_PGAINV (1<<3) // invert PGA input phase
#define NAU7802_PGA_BYPASS_EN (1<<4) // PGA bypass enable
#define NAU7802_PGA_BUFFER_EN (1<<5) // PGA output buffer enable
#define NAU7802_PGA_LDOMODE (1<<6) // Improve stability and lower DC gain
#define NAU7802_PGA_RD_OTP_SEL (1<<7) // Select reg 0x15 reads OTP
#define NAU7802_PGA_RD_ADC_SEL (0<<7) // Select reg 0x15 reads ADC
#define NAU7802_POWER_CONTROL_REG 0x1C
#define NAU7802_POWER_CONTROL_PGA_CURR_MASK (3<<0) // PGA current mask
#define NAU7802_POWER_CONTROL_PGA_CURR_100 (0<<0) // 100% of master bias
#define NAU7802_POWER_CONTROL_PGA_CURR_95 (1<<0) // 95% of master bias
#define NAU7802_POWER_CONTROL_PGA_CURR_86 (2<<0) // 86% of master bias
#define NAU7802_POWER_CONTROL_PGA_CURR_70 (3<<0) // 70% of master bias
#define NAU7802_POWER_CONTROL_PGA_CAP_EN (1<<7)
#define NAU7802_MAX_CHAN 2
class AdcNau7802 : public AdcDevice {
public:
bool Enable();
void Disable();
void Reset();
uint32_t Rate(uint32_t Val);
uint16_t Resolution(uint16_t Val);
bool OpenChannel(const ADC_CHAN_CFG * const pChanCfg, int NbChan);
void CloseChannel(int Chan);
bool StartConversion();
void StopConversion();
int Read(ADC_DATA *pBuff, int Len);
bool Read(int Chan, ADC_DATA *pBuff);
bool Calibrate();
bool Init(const ADC_CFG &Cfg, Timer * const pTimer, DeviceIntrf * const pIntrf);
void IntHandler() { UpdateData(); }
bool UpdateData();
private:
uint8_t vChanOpened;
int32_t vAdcVal[NAU7802_MAX_CHAN];
ADC_DATA vData[NAU7802_MAX_CHAN];
};
/** @} End of group Converters */
#endif // __ADC_NAU7802_H__
| I-SYST/EHAL | include/converters/adc_nau7802.h | C | bsd-3-clause | 8,312 | [
30522,
1013,
1008,
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,
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... |
RSpec::Matchers.define :be_in_conference do |expected|
match do |actual|
agent_call_sid = actual.sid
conversation = actual.conversation
conferences = twilio_rest_client.account.conferences.list
agent_conference = conferences.detect { |conference|
conference.friendly_name == "conference-#{conversation.id}"
}
agent_call = agent_conference.participants.get agent_call_sid
agent_call.should be
end
failure_message_for_should do |actual|
"expected that '#{actual}' would be in the conference"
end
failure_message_for_should_not do |actual|
"expected that '#{actual}' would not be in the conference"
end
end
| ZestFinance/zestphone | features/support/matchers/be_in_conference.rb | Ruby | mit | 662 | [
30522,
12667,
5051,
2278,
1024,
1024,
2674,
2545,
1012,
9375,
1024,
2022,
1035,
1999,
1035,
3034,
2079,
1064,
3517,
1064,
2674,
2079,
1064,
5025,
1064,
4005,
1035,
2655,
1035,
15765,
1027,
5025,
1012,
15765,
4512,
1027,
5025,
1012,
4512,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 _MODEL_H_
#define _MODEL_H_
#include "texturer.h"
#include "teges_object.h"
#include <vector>
/**
* The model can be rendered and can have logic. It is also texturable and can be put on the engine models list.
*/
class Model : public Texturable, public virtual TegesObject {
//static const char className[];
public:
Model(Teges* _engine);
virtual void render() { };
virtual void logic() { };
//virtual const char* getClass() { return className; }
};
typedef std::vector<Model*> ModelList;
#endif // MODEL_H
| stammen/angleproject | samples/Asteroids/src/engine/model.h | C | bsd-3-clause | 527 | [
30522,
1001,
2065,
13629,
2546,
1035,
2944,
1035,
1044,
1035,
1001,
9375,
1035,
2944,
1035,
1044,
1035,
1001,
2421,
1000,
14902,
2099,
1012,
1044,
1000,
1001,
2421,
1000,
8915,
8449,
1035,
4874,
1012,
1044,
1000,
1001,
2421,
1026,
9207,
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... |
{% extends 'magicflatpages/base_content.html' %}
{% load floppyforms %}
{% block js_top %}
{{ block.super }}
{{ form.media }}
{% endblock %}
{% block navbar %}
{% endblock navbar %}
{% block footer_area %}
{% endblock footer_area %}
{% block content %}
<div class="popup-content">
<div class="row">
<div class="col-sm-2">
<div class="side-fix-menus">
<ul class="nav nav-pills nav-stacked" id="nav-elements">
<li role="presentation" class="active">
<a href="#" id="goto-title">Page<br/><i class="fa fa-minus"></i></a>
</li>
</ul>
</div>
</div>
<div class="col-lg-9">
<h1><small>Page {{ object.title }} details</h1>
<form method='post' enctype="multipart/form-data">{% csrf_token %}
{{ form }}
<div class="bottom-fix-menu" align="center">
<h1>
<input type="submit" class="btn btn-lg btn-success" value="Save" />
<a href="{% url 'magiccontent.windows_close' %}?dont_reload=1" class="btn btn-lg btn-danger" role="button" >Cancel</a>
</h1>
</div>
</form>
<br/><br/><br/><br/>
</div>
</div>
</div>
{% endblock content %}
{% block post_content %}{% endblock post_content %}
{% block extrajs %}
<script type="text/javascript">
// hide the picture filters when there is no picture
$(document).ready(function(){
$("#id_url").prop('readonly', true);
});
</script>
{% endblock extrajs %} | DjenieLabs/django-magicflatpages | magicflatpages/templates/flatpages/page_form.html | HTML | bsd-3-clause | 1,501 | [
30522,
1063,
1003,
8908,
1005,
3894,
10258,
4017,
13704,
2015,
1013,
2918,
1035,
4180,
1012,
16129,
1005,
1003,
1065,
1063,
1003,
7170,
28491,
22694,
1003,
1065,
1063,
1003,
3796,
1046,
2015,
1035,
2327,
1003,
1065,
1063,
1063,
3796,
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... |
import os
import re
import sys
import json
import shlex
import logging
import inspect
import functools
import importlib
from pprint import pformat
from collections import namedtuple
from traceback import format_tb
from requests.exceptions import RequestException
import strutil
from cachely.loader import Loader
from .lib import library, interpreter_library, DataProxy
from . import utils
from . import core
from . import exceptions
logger = logging.getLogger(__name__)
BASE_LIBS = ['snagit.lib.text', 'snagit.lib.lines', 'snagit.lib.soup']
ReType = type(re.compile(''))
class Instruction(namedtuple('Instruction', 'cmd args kws line lineno')):
'''
``Instruction``'s take the form::
command [arg [arg ...]] [key=arg [key=arg ...]]
Where ``arg`` can be one of: single quoted string, double quoted string,
digit, True, False, None, or a simple, unquoted string.
'''
values_pat = r'''
[rj]?'(?:(\'|[^'])*?)' |
[r]?"(?:(\"|[^"])*?)" |
(\d+) |
(True|False|None) |
([^\s,]+)
'''
args_re = re.compile(
r'''^(
(?P<kwd>\w[\w\d-]*)=(?P<val>{0}) |
(?P<arg>{0}|([\s,]+))
)\s*'''.format(values_pat),
re.VERBOSE
)
value_dict = {'True': True, 'False': False, 'None': None}
def __str__(self):
def _repr(w):
if isinstance(w, ReType):
return 'r"{}"'.format(str(w.pattern))
return repr(w)
return '{}{}{}'.format(
self.cmd.upper(),
' {}'.format(
' '.join([_repr(c) for c in self.args]) if self.args else ''
),
' {}'.format(' '.join(
'{}={}'.format(k, _repr(v)) for k, v in self.kws.items()
) if self.kws else '')
)
@classmethod
def get_value(cls, s):
if s.isdigit():
return int(s)
elif s in cls.value_dict:
return cls.value_dict[s]
elif s.startswith(('r"', "r'")):
return re.compile(utils.escaped(s[2:-1]))
elif s.startswith("j'"):
return json.loads(utils.escaped(s[2:-1]))
elif s.startswith(('"', "'")):
return utils.escaped(s[1:-1])
else:
return s.strip()
@classmethod
def parse(cls, line, lineno):
args = []
kws = {}
cmd, text = strutil.splitter(line, expected=2, strip=True)
cmd = cmd.lower()
while text:
m = cls.args_re.search(text)
if not m:
break
gdict = m.groupdict()
kwd = gdict.get('kwd')
if kwd:
kws[kwd] = cls.get_value(gdict.get('val', ''))
else:
arg = gdict.get('arg', '').strip()
if arg != ',':
args.append(cls.get_value(arg))
text = text[len(m.group()):]
if text:
raise SyntaxError(
'Syntax error: "{}" (line {})'.format(text, lineno)
)
return cls(cmd, args, kws, line, lineno)
def lexer(code, lineno=0):
'''
Takes the script source code, scans it, and lexes it into
``Instructions``
'''
for chars in code.splitlines():
lineno += 1
line = chars.rstrip()
if not line or line.lstrip().startswith('#'):
continue
logger.debug('Lexed {} byte(s) line {}'.format(len(line), chars))
yield Instruction.parse(line, lineno)
def load_libraries(extensions=None):
if isinstance(extensions, str):
extensions = [extensions]
libs = BASE_LIBS + (extensions or [])
for lib in libs:
importlib.import_module(lib)
class Interpreter:
def __init__(
self,
contents=None,
loader=None,
use_cache=False,
do_pm=False,
extensions=None
):
self.use_cache = use_cache
self.loader = loader if loader else Loader(use_cache=use_cache)
self.contents = Contents(contents)
self.do_debug = False
self.do_pm = do_pm
self.instructions = []
load_libraries(extensions)
def load_sources(self, sources, use_cache=None):
use_cache = self.use_cache if use_cache is None else bool(use_cache)
contents = self.loader.load_sources(sources)
self.contents.update([
ct.decode() if isinstance(ct, bytes) else ct for ct in contents
])
def listing(self, linenos=False):
items = []
for instr in self.instructions:
items.append('{}{}'.format(
'{} '.format(instr.lineno) if linenos else '',
instr.line
))
return items
def lex(self, code):
lineno = self.instructions[-1].lineno if self.instructions else 0
instructions = list(lexer(code, lineno))
self.instructions.extend(instructions)
return instructions
def execute(self, code):
for instr in self.lex(code):
try:
self._execute_instruction(instr)
except exceptions.ProgramWarning as why:
print(why)
return self.contents
def _load_handler(self, instr):
if instr.cmd in library.registry:
func = library.registry[instr.cmd]
return self.contents, (func, instr.args, instr.kws)
elif instr.cmd in interpreter_library.registry:
func = interpreter_library.registry[instr.cmd]
return func, (self, instr.args, instr.kws)
raise exceptions.ProgramWarning(
'Unknown instruction (line {}): {}'.format(instr.lineno, instr.cmd)
)
def _execute_instruction(self, instr):
logger.debug('Executing {}'.format(instr.cmd))
handler, args = self._load_handler(instr)
do_debug, self.do_debug = self.do_debug, False
if do_debug:
utils.pdb.set_trace()
try:
handler(*args)
except Exception:
exc, value, tb = sys.exc_info()
if self.do_pm:
logger.error(
'Script exception, line {}: {} (Entering post_mortem)'.format( # noqa
instr.lineno,
value
)
)
utils.pdb.post_mortem(tb)
else:
raise
def execute_script(filename, contents=''):
code = utils.read_file(filename)
return execute_code(code, contents)
def execute_code(code, contents=''):
intrep = Interpreter(contents)
return str(intrep.execute(code))
class Contents:
def __init__(self, contents=None):
self.stack = []
self.set_contents(contents)
def __iter__(self):
return iter(self.contents)
def __len__(self):
return len(self.contents)
def __str__(self):
return '\n'.join(str(c) for c in self)
# def __getitem__(self, index):
# return self.contents[index]
def pop(self):
if self.stack:
self.contents = self.stack.pop()
def __call__(self, func, args, kws):
contents = []
for data in self:
result = func(data, args, kws)
contents.append(result)
self.update(contents)
def merge(self):
if self.contents:
first = self.contents[0]
data = first.merge(self.contents)
self.update([data])
def update(self, contents):
if self.contents:
self.stack.append(self.contents)
self.set_contents(contents)
def set_contents(self, contents):
self.contents = []
if isinstance(contents, (str, bytes)):
contents = [contents]
contents = contents or []
for ct in contents:
if isinstance(ct, (str, bytes)):
ct = DataProxy(ct)
self.contents.append(ct)
| dakrauth/snarf | snagit/core.py | Python | mit | 7,965 | [
30522,
12324,
9808,
12324,
2128,
12324,
25353,
2015,
12324,
1046,
3385,
12324,
14021,
2571,
2595,
12324,
15899,
12324,
22459,
12324,
4569,
6593,
13669,
2015,
12324,
12324,
29521,
2013,
4903,
6657,
2102,
12324,
1052,
14192,
4017,
2013,
6407,
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... |
#include <hw/cpu/cpu.h>
#include <stdint.h>
char *vga_gets(unsigned int maxlen);
void vga_moveto(unsigned char x,unsigned char y);
void vga_scroll_up(unsigned char lines);
void vga_cursor_down();
void vga_writec(char c);
void vga_write(const char *msg);
void vga_write_sync();
void vga_clear();
int vga_getch();
#if defined(TARGET_PC98)
# include <hw/necpc98/necpc98.h>
void vga_tty_pc98_mapping(nec_pc98_intdc_keycode_state_ext *map);
void vga_writecw(unsigned short c);
void vga_writew(const char *msg);
# define VGATTY_SC_Fn(x) (0x7F30 + (x) - 1)
# define VGATTY_SC_VFn(x) (0x7F3A + (x) - 1)
# define VGATTY_SC_sFn(x) (0x7F40 + (x) - 1)
# define VGATTY_SC_sVFn(x) (0x7F4A + (x) - 1)
# define VGATTY_SC_cFn(x) (0x7F50 + (x) - 1)
# define VGATTY_SC_cVFn(x) (0x7F5A + (x) - 1)
# define VGATTY_LEFT_ARROW (0x7F60 + PC98_INTDC_EK_LEFT_ARROW)
# define VGATTY_RIGHT_ARROW (0x7F60 + PC98_INTDC_EK_RIGHT_ARROW)
# define VGATTY_UP_ARROW (0x7F60 + PC98_INTDC_EK_UP_ARROW)
# define VGATTY_DOWN_ARROW (0x7F60 + PC98_INTDC_EK_DOWN_ARROW)
# define VGATTY_ALT_LEFT_ARROW (0x7F60 + PC98_INTDC_EK_LEFT_ARROW)
# define VGATTY_ALT_RIGHT_ARROW (0x7F60 + PC98_INTDC_EK_RIGHT_ARROW)
# define VGATTY_ALT_UP_ARROW (0x7F60 + PC98_INTDC_EK_UP_ARROW)
# define VGATTY_ALT_DOWN_ARROW (0x7F60 + PC98_INTDC_EK_DOWN_ARROW)
#else
# define VGATTY_SC_Fn(x) (0x3B00 + ((x) << 8) - 0x100 + ((x) >= 11 ? (0x8500-0x4500) : 0))
# define VGATTY_SC_sFn(x) (0x5400 + ((x) << 8) - 0x100 + ((x) >= 11 ? (0x8700-0x5E00) : 0))
# define VGATTY_SC_cFn(x) (0x5E00 + ((x) << 8) - 0x100 + ((x) >= 11 ? (0x8900-0x6800) : 0))
# define VGATTY_LEFT_ARROW (0x4B00)
# define VGATTY_RIGHT_ARROW (0x4D00)
# define VGATTY_UP_ARROW (0x4800)
# define VGATTY_DOWN_ARROW (0x5000)
# define VGATTY_ALT_LEFT_ARROW (0x9B00)
# define VGATTY_ALT_RIGHT_ARROW (0x9D00)
# define VGATTY_ALT_UP_ARROW (0x9800)
# define VGATTY_ALT_DOWN_ARROW (0xA000)
#endif
| joncampbell123/doslib | hw/vga/vgatty.h | C | lgpl-2.1 | 1,995 | [
30522,
1001,
2421,
1026,
1044,
2860,
1013,
17368,
1013,
17368,
1012,
1044,
1028,
1001,
2421,
1026,
2358,
8718,
2102,
1012,
1044,
1028,
25869,
1008,
1058,
3654,
1035,
4152,
1006,
27121,
20014,
4098,
7770,
1007,
1025,
11675,
1058,
3654,
1035,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 org.esa.snap.pixex.aggregators;
import org.esa.snap.pixex.calvalus.ma.Record;
import java.util.Arrays;
/**
* {@inheritDoc}
* <p>
* Retrieves the median value for a record.
* If the record contains an even number of values, the mean of the left and the right median is taken.
*/
public class MedianAggregatorStrategy extends AbstractAggregatorStrategy {
/**
* Returns the median value for the given record and raster index.
*
* @param record The record containing the data for all rasters.
* @param rasterIndex The raster the values shall be aggregated for.
* @return The median value.
*/
@Override
public Number[] getValues(Record record, int rasterIndex) {
final float median = getMedian((Number[]) record.getAttributeValues()[rasterIndex]);
return new Number[]{
median,
getAggregatedNumber(record, rasterIndex).nT
};
}
@Override
public String[] getSuffixes() {
return new String[]{"median", NUM_PIXELS_SUFFIX};
}
float getMedian(Number[] bandValues) {
if (bandValues == null || bandValues.length == 0) {
return Float.NaN;
}
Number[] values = bandValues.clone();
Arrays.sort(values);
if (values.length % 2 == 1) {
return values[values.length / 2].floatValue();
}
final float leftMedian = values[values.length / 2 - 1].floatValue();
final float rightMedian = values[values.length / 2].floatValue();
return (leftMedian + rightMedian) / 2;
}
}
| arraydev/snap-engine | snap-pixel-extraction/src/main/java/org/esa/snap/pixex/aggregators/MedianAggregatorStrategy.java | Java | gpl-3.0 | 1,592 | [
30522,
7427,
8917,
1012,
28776,
1012,
10245,
1012,
14255,
2595,
10288,
1012,
24089,
2015,
1025,
12324,
8917,
1012,
28776,
1012,
10245,
1012,
14255,
2595,
10288,
1012,
10250,
10175,
2271,
1012,
5003,
1012,
2501,
1025,
12324,
9262,
1012,
21183,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
/*
* @version $Id$
-------------------------------------------------------------------------
GLPI - Gestionnaire Libre de Parc Informatique
Copyright (C) 2015-2016 Teclib'.
http://glpi-project.org
based on GLPI - Gestionnaire Libre de Parc Informatique
Copyright (C) 2003-2014 by the INDEPNET Development Team.
-------------------------------------------------------------------------
LICENSE
This file is part of GLPI.
GLPI 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.
GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
/** @file
* @brief
*/
if (!defined('GLPI_ROOT')) {
die("Sorry. You can't access this file directly");
}
/**
* Relation between item and devices
**/
class Item_DeviceDrive extends Item_Devices {
static public $itemtype_2 = 'DeviceDrive';
static public $items_id_2 = 'devicedrives_id';
static protected $notable = false;
/**
* @since version 0.85
**/
static function getSpecificities($specif='') {
return array('serial' => parent::getSpecificities('serial'),
'busID' => parent::getSpecificities('busID'));
}
}
?>
| Diegoromeropanes/glpi | inc/item_devicedrive.class.php | PHP | gpl-2.0 | 1,694 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1030,
2544,
1002,
8909,
1002,
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,
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... |
#!/usr/bin/perl
use warnings;
use strict;
use CGI;
use Graphics::Magick;
use POSIX qw(ceil);
use autouse 'Data::Dumper' => qw(Dumper);
use C4::Context;
use C4::Auth;
use C4::Output;
use C4::Debug;
use C4::Creators 1.000000;
use C4::Patroncards 1.000000;
my $cgi = CGI->new;
my ($template, $loggedinuser, $cookie) = get_template_and_user({
template_name => "patroncards/image-manage.tmpl",
query => $cgi,
type => "intranet",
authnotrequired => 0,
flagsrequired => {tools => 'batch_upload_patron_images'}, # FIXME: establish flag for patron card creator
debug => 0,
});
my $image_name = $cgi->param('image_name') || '';
my $file_name = $cgi->param('uploadfile') || '';
my $upload_file = $cgi->upload('uploadfile') || '';
my $op = $cgi->param('op') || 'none';
my @image_ids = $cgi->param('image_id') if $cgi->param('image_id');
my $source_file = "$file_name"; # otherwise we end up with what amounts to a pointer to a filehandle rather than a user-friendly filename
my $display_columns = { image => [ #{db column => {label => 'col label', is link? }},
{image_id => {label => 'ID', link_field => 0}},
{image_name => {label => 'Name', link_field => 0}},
{select => {label => 'Select', value => 'image_id'}},
],
};
my $table = html_table($display_columns->{'image'}, get_image(undef, "image_id, image_name"));
my $image_limit = C4::Context->preference('ImageLimit') || '';
my $errstr = ''; # NOTE: For error codes see error-messages.inc
if ($op eq 'upload') {
if (!$upload_file) {
warn sprintf('An error occurred while attempting to upload file %s.', $source_file);
$errstr = 301;
$template->param(
IMPORT_SUCCESSFUL => 0,
SOURCE_FILE => $source_file,
IMAGE_NAME => $image_name,
TABLE => $table,
error => 1,
$errstr => 1,
);
}
else {
my $image = Graphics::Magick->new;
eval{$image->Read($cgi->tmpFileName($file_name));};
if ($@) {
warn sprintf('An error occurred while creating the image object: %s',$@);
$errstr = 202;
$template->param(
IMPORT_SUCCESSFUL => 0,
SOURCE_FILE => $source_file,
IMAGE_NAME => $image_name,
TABLE => $table,
error => 1,
$errstr => 1,
);
}
else {
my $errstr = '';
my $size = $image->Get('filesize');
$errstr = 302 if $size > 500000;
$image->Set(magick => 'png'); # convert all images to png as this is a lossless format which is important for resizing operations later on
my $err = put_image($image_name, $image->ImageToBlob()) || '0';
$errstr = 101 if $err == 1;
$errstr = 303 if $err == 202;
if ($errstr) {
$template->param(
IMPORT_SUCCESSFUL => 0,
SOURCE_FILE => $source_file,
IMAGE_NAME => $image_name,
TABLE => $table,
error => 1,
$errstr => 1,
image_limit => $image_limit,
);
}
else {
$table = html_table($display_columns->{'image'}, get_image(undef, "image_id, image_name")); # refresh table data after successfully performing save operation
$template->param(
IMPORT_SUCCESSFUL => 1,
SOURCE_FILE => $source_file,
IMAGE_NAME => $image_name,
TABLE => $table,
);
}
}
}
}
elsif ($op eq 'delete') {
my $err = '';
my $errstr = '';
if (@image_ids) {
$err = rm_image(\@image_ids);
$errstr = 102 if $err;
}
else {
warn sprintf('No image ids passed in to delete.');
$errstr = 202;
}
if ($errstr) {
$template->param(
DELETE_SUCCESSFULL => 0,
IMAGE_IDS => join(', ', @image_ids),
TABLE => $table,
error => 1,
$errstr => 1,
image_ids => join(',',@image_ids),
);
}
else {
$table = html_table($display_columns->{'image'}, get_image(undef, "image_id, image_name")); # refresh table data after successfully performing delete operation
$template->param(
DELETE_SUCCESSFULL => 1,
TABLE => $table,
);
}
}
elsif ($op eq 'none') {
$template->param(
IMPORT_SUCCESSFUL => 0,
SOURCE_FILE => $source_file,
IMAGE_NAME => $image_name,
TABLE => $table,
);
}
else { # to trap unsupported operations
warn sprintf('Image upload interface called an unsupported operation: %s',$op);
$errstr = 201;
$template->param(
IMPORT_SUCCESSFUL => 0,
SOURCE_FILE => $source_file,
IMAGE_NAME => $image_name,
TABLE => $table,
error => 1,
$errstr => 1,
);
}
output_html_with_http_headers $cgi, $cookie, $template->output;
__END__
=head1 NAME
image-upload.pl - Script for handling uploading of single images and importing them into the database.
=head1 SYNOPSIS
image-upload.pl
=head1 DESCRIPTION
This script is called and presents the user with an interface allowing him/her to upload a single image file. Files greater than 500K will be refused.
=head1 AUTHOR
Chris Nighswonger <cnighswonger AT foundations DOT edu>
=head1 COPYRIGHT
Copyright 2009 Foundations Bible College.
=head1 LICENSE
This file is part of Koha.
Koha 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.
You should have received a copy of the GNU General Public License along with Koha; if not, write to the Free Software Foundation, Inc., 51 Franklin Street,
Fifth Floor, Boston, MA 02110-1301 USA.
=head1 DISCLAIMER OF WARRANTY
Koha 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.
=cut
| MASmedios/koha | patroncards/image-manage.pl | Perl | gpl-2.0 | 6,701 | [
30522,
1001,
999,
1013,
2149,
2099,
1013,
8026,
1013,
2566,
2140,
2224,
16234,
1025,
2224,
9384,
1025,
2224,
1039,
5856,
1025,
2224,
8389,
1024,
1024,
3894,
2243,
1025,
2224,
13433,
5332,
2595,
1053,
2860,
1006,
8292,
4014,
1007,
1025,
22... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
PHPExcel_Autoloader::register();
// As we always try to run the autoloader before anything else, we can use it to do a few
// simple checks and initialisations
//PHPExcel_Shared_ZipStreamWrapper::register();
// check mbstring.func_overload
if (ini_get('mbstring.func_overload') & 2) {
throw new PHPExcel_Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
}
PHPExcel_Shared_String::buildCharacterSets();
/**
* PHPExcel
*
* Copyright (c) 2006 - 2015 PHPExcel
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPExcel
* @package PHPExcel
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
class PHPExcel_Autoloader
{
/**
* Register the Autoloader with SPL
*
*/
public static function register()
{
if (function_exists('__autoload')) {
// Register any existing autoloader function with SPL, so we don't get any clashes
spl_autoload_register('__autoload');
}
// Register ourselves with SPL
if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
return spl_autoload_register(array('PHPExcel_Autoloader', 'load'), true, true);
} else {
return spl_autoload_register(array('PHPExcel_Autoloader', 'load'));
}
}
/**
* Autoload a class identified by name
*
* @param string $pClassName Name of the object to load
*/
public static function load($pClassName)
{
if ((class_exists($pClassName, false)) || (strpos($pClassName, 'PHPExcel') !== 0)) {
// Either already loaded, or not a PHPExcel class request
return false;
}
$pClassFilePath = PHPEXCEL_ROOT .
str_replace('_', DIRECTORY_SEPARATOR, $pClassName) .
'.php';
if ((file_exists($pClassFilePath) === false) || (is_readable($pClassFilePath) === false)) {
// Can't load
return false;
}
require($pClassFilePath);
}
}
| yysun2000/delibelight | yc/lib/PHPExcel/Autoloader.php | PHP | mit | 2,884 | [
30522,
1026,
1029,
25718,
25718,
10288,
29109,
1035,
8285,
11066,
2121,
1024,
1024,
4236,
1006,
1007,
1025,
1013,
1013,
2004,
2057,
2467,
3046,
2000,
2448,
1996,
8285,
11066,
2121,
2077,
2505,
2842,
1010,
2057,
2064,
2224,
2009,
2000,
2079,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 MIT License (MIT)
//
// CoreTweet - A .NET Twitter Library supporting Twitter API 1.1
// Copyright (c) 2013-2015 CoreTweet Development Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
namespace CoreTweet
{
/// <summary>
/// Twitter parameter attribute.
/// </summary>
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
public class TwitterParameterAttribute : Attribute
{
/// <summary>
/// Name of the parameter binding for.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Default value of the parameter.
/// </summary>
/// <value>The default value.</value>
public object DefaultValue { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="CoreTweet.TwitterParameterAttribute"/> class.
/// </summary>
/// <param name="name">Name.</param>
/// <param name="defaultValue">Default value.</param>
public TwitterParameterAttribute(string name = null, object defaultValue = null)
{
Name = name;
DefaultValue = defaultValue;
}
}
/// <summary>
/// Twitter parameters attribute.
/// This is used for a class.
/// </summary>
[AttributeUsage(AttributeTargets.Class)]
public class TwitterParametersAttribute : Attribute {}
}
| haripo/CoreTweet | CoreTweet.Shared/Attribute.cs | C# | mit | 2,476 | [
30522,
1013,
1013,
1996,
10210,
6105,
1006,
10210,
1007,
1013,
1013,
1013,
1013,
4563,
2102,
28394,
2102,
1011,
1037,
1012,
5658,
10474,
3075,
4637,
10474,
17928,
1015,
1012,
1015,
1013,
1013,
9385,
1006,
1039,
1007,
2286,
1011,
2325,
4563,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
# encoding: utf-8
import datetime
__all__ = [
'info',
]
def info():
return {
'birthday': datetime.date(1992, 2, 10),
'class': 3,
'family_name_en': u'nakagawa',
'family_name_kana': u'なかがわ',
'first_name_en': u'haruka',
'first_name_kana': u'はるか',
'graduate_date': None,
'hometown': u'東京',
'name_en': u'Nakagawa Haruka',
'name_ja': u'仲川遥香',
'name_kana': u'なかがわ はるか',
'nick': u'はるごん',
'team': u'A',
}
| moriyoshi/pyakb48 | akb48/member/nakagawa_haruka.py | Python | mit | 655 | [
30522,
1001,
17181,
1024,
21183,
2546,
1011,
1022,
12324,
3058,
7292,
1035,
1035,
2035,
1035,
1035,
1027,
1031,
1005,
18558,
1005,
1010,
1033,
13366,
18558,
1006,
1007,
1024,
2709,
1063,
1005,
5798,
1005,
1024,
3058,
7292,
1012,
3058,
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... |
<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Unity - Scripting API: AnimationClip.humanMotion</title>
<meta name="description" content="Develop once, publish everywhere! Unity is the ultimate tool for video game development, architectural visualizations, and interactive media installations - publish to the web, Windows, OS X, Wii, Xbox 360, and iPhone with many more platforms to come." />
<meta name="author" content="Unity Technologies" />
<link rel="shortcut icon" href="../StaticFiles/images/favicons/favicon.ico" />
<link rel="icon" type="image/png" href="../StaticFiles/images/favicons/favicon.png" />
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../StaticFiles/images/favicons/apple-touch-icon-152x152.png" />
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="../StaticFiles/images/favicons/apple-touch-icon-144x144.png" />
<link rel="apple-touch-icon-precomposed" sizes="120x120" href="../StaticFiles/images/favicons/apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="../StaticFiles/images/favicons/apple-touch-icon-114x114.png" />
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="../StaticFiles/images/favicons/apple-touch-icon-72x72.png" />
<link rel="apple-touch-icon-precomposed" href="../StaticFiles/images/favicons/apple-touch-icon.png" />
<meta name="msapplication-TileColor" content="#222c37" />
<meta name="msapplication-TileImage" content="../StaticFiles/images/favicons/tileicon-144x144.png" />
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-2854981-1']);
_gaq.push(['_setDomainName', 'unity3d.com']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<script type="text/javascript" src="../StaticFiles/js/jquery.js">
</script>
<script type="text/javascript" src="docdata/toc.js">//toc</script>
<!--local TOC-->
<script type="text/javascript" src="docdata/global_toc.js">//toc</script>
<!--global TOC, including other platforms-->
<script type="text/javascript" src="../StaticFiles/js/core.js">
</script>
<link href="http://fonts.googleapis.com/css?family=Open+Sans:400,700,400italic" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="../StaticFiles/css/core.css" />
</head>
<body>
<div class="header-wrapper">
<div id="header" class="header">
<div class="content">
<div class="spacer">
<div class="menu">
<div class="logo">
<a href="http://docs.unity3d.com">
</a>
</div>
<div class="search-form">
<form action="30_search.html" method="get" class="apisearch">
<input type="text" name="q" placeholder="Search scripting..." autosave="Unity Reference" results="5" class="sbox field" id="q">
</input>
<input type="submit" class="submit">
</input>
</form>
</div>
<ul>
<li>
<a href="http://docs.unity3d.com">Overview</a>
</li>
<li>
<a href="../Manual/index.html">Manual</a>
</li>
<li>
<a href="../ScriptReference/index.html" class="selected">Scripting API</a>
</li>
</ul>
</div>
</div>
<div class="more">
<div class="filler">
</div>
<ul>
<li>
<a href="http://unity3d.com/">unity3d.com</a>
</li>
</ul>
</div>
</div>
</div>
<div class="toolbar">
<div class="content clear">
<div class="lang-switcher hide">
<div class="current toggle" data-target=".lang-list">
<div class="lbl">Language: <span class="b">English</span></div>
<div class="arrow">
</div>
</div>
<div class="lang-list" style="display:none;">
<ul>
<li>
<a href="">English</a>
</li>
</ul>
</div>
</div>
<div class="script-lang">
<ul>
<li class="selected" data-lang="CS">C#</li>
<li data-lang="JS">JS</li>
</ul>
<div id="script-lang-dialog" class="dialog hide">
<div class="dialog-content clear">
<h2>Script language</h2>
<div class="close">
</div>
<p class="clear">Select your preferred scripting language. All code snippets will be displayed in this language.</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="master-wrapper" class="master-wrapper clear">
<div id="sidebar" class="sidebar">
<div class="sidebar-wrap">
<div class="content">
<div class="sidebar-menu">
<div class="toc">
<h2>Scripting API</h2>
</div>
</div>
<p>
<a href="40_history.html" class="cw">History</a>
</p>
</div>
</div>
</div>
<div id="content-wrap" class="content-wrap">
<div class="content-block">
<div class="content">
<div class="section">
<div class="mb20 clear">
<h1 class="heading inherit">
<a href="AnimationClip.html">AnimationClip</a>.humanMotion</h1>
<div class="clear">
</div>
<div class="clear">
</div>
<div class="suggest">
<a class="blue-btn sbtn">Suggest a change</a>
<div class="suggest-wrap rel hide">
<div class="loading hide">
<div>
</div>
<div>
</div>
<div>
</div>
</div>
<div class="suggest-success hide">
<h2>Success!</h2>
<p>Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.</p>
<a class="gray-btn sbtn close">Close</a>
</div>
<div class="suggest-failed hide">
<h2>Sumbission failed</h2>
<p>For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.</p>
<a class="gray-btn sbtn close">Close</a>
</div>
<div class="suggest-form clear">
<label for="suggest_name">Your name</label>
<input id="suggest_name" type="text">
</input>
<label for="suggest_email">Your email</label>
<input id="suggest_email" type="email">
</input>
<label for="suggest_body" class="clear">Suggestion <span class="r">*</span></label>
<textarea id="suggest_body" class="req">
</textarea>
<button id="suggest_submit" class="blue-btn mr10">Submit suggestion</button>
<p class="mb0">
<a class="cancel left lh42 cn">Cancel</a>
</p>
</div>
</div>
</div>
<a href='../Manual/class-AnimationClip.html' title='Go to AnimationClip Component in the Manual' class='switch-link gray-btn sbtn left show'>Switch to Manual</a>
<div class="clear">
</div>
</div>
<div class="subsection">
<div class="signature">
<div class="signature-JS sig-block">public
var <span class="sig-kw">humanMotion</span>: bool;
</div>
<div class="signature-CS sig-block">public bool <span class="sig-kw">humanMotion</span>;
</div>
</div>
</div>
<div class="subsection">
<h2>Description</h2>
<p>Returns true if the animation contains curve that drives a humanoid rig.</p>
</div>
</div>
<div class="footer-wrapper">
<div class="footer clear">
<div class="copy">Copyright © 2014 Unity Technologies</div>
<div class="menu">
<a href="http://unity3d.com/learn">Learn</a>
<a href="http://unity3d.com/community">Community</a>
<a href="http://unity3d.com/asset-store">Asset Store</a>
<a href="https://store.unity3d.com">Buy</a>
<a href="http://unity3d.com/unity/download">Download</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html> | rakuten/Uinty3D-Docs-zhcn | ScriptReference/AnimationClip-humanMotion.html | HTML | gpl-3.0 | 10,158 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
11374,
1027,
1000,
4372,
1000,
2465,
1027,
1000,
2053,
1011,
1046,
2015,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1013,
1028... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
chrome.runtime.onInstalled.addListener(function(details){
if(details.reason == "install"){
console.log("This is a first install!");
}else if(details.reason == "update"){
var thisVersion = chrome.runtime.getManifest().version;
console.log("Updated from " + details.previousVersion + " to " + thisVersion + "!");
}
});
//Redirect from Valve's version of gamehighlightplayer.js to our stub file. We need this to prevent errors.
chrome.webRequest.onBeforeRequest.addListener(
function(details) {
console.log('this ran');
if( details.url.indexOf("gamehighlightplayer.js")>-1){
return {redirectUrl: "chrome-extension://"+chrome.runtime.id+"/js/gamehighlightplayer_stub.js" };
}
},
{urls: ["*://*.steamstatic.com/*"]},
["blocking"]);
| dbalz3/SuperSteam_Chrome | js/background.js | JavaScript | gpl-3.0 | 821 | [
30522,
18546,
1012,
2448,
7292,
1012,
2006,
7076,
9080,
3709,
1012,
5587,
9863,
24454,
1006,
3853,
1006,
4751,
1007,
1063,
2065,
1006,
4751,
1012,
3114,
1027,
1027,
1000,
16500,
1000,
1007,
1063,
10122,
1012,
8833,
1006,
1000,
2023,
2003,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
### Image Color Analysis
This color analysis tool was built to support a data visual analytics method for the study of national Webs. It was initially used to analyze the changing colors of the former Yugoslav domain, .yu, during the Kosovo War. For more information please refer to:
Ben-David, A., Amram, A., & Bekkerman, R. (in press). [The Colors of the National Web: Visual Data Analysis of the Historical Yugoslav Web Domain](https://www.academia.edu/30508702/The_colors_of_the_national_Web_visual_data_analysis_of_the_historical_Yugoslav_Web_domain._Int_J_Digit_Libr_2016_._doi_10.1007_s00799-016-0202-6). *Internation Journal on Digital Libraries*.
The method can be readily applied to any other national Web (or Web archive), and, in fact, to any folder of images.
The following is a tutorial for using the tool on a given folder of images. We will compare the color histogram of Google images results to "Donald Trump" and "Hillary Clinton" (as of November 2016). Two demo folders are included in this tutorial.
#### Preparations
1. Please Download and install [Anaconda, version Python 2.7](https://www.continuum.io/downloads).
2. Please 'download zip' the project folders from [Github](https://github.com/omilab/image-color-analysis/archive/master.zip).
3. Unzip the folder
#### A Step by Step Guide for using the tool
1. In Anaconda, open "Jupyter Notebook".
2. When notebook opens - it automatically opens your default browser and shows your file directory.
3. Open your downloaded and extracted folder.
4. Open the file "image_color_analysis.ipynb".
#### Now, let's have some fun!
The script in the file you just opened is divided into three sections:
1. Building a collage from all the images.
2. Fitting a K-Means clustering model (identifying clusters of colors in the images).
3. Creating a color histogram that summarizes the color histogram of the images.
Although the code is annotated, below is an explanation of each section.
##### Part 1: Creating a collage
In this section, we first specify the location of an images folder and load the images. Then, we create a collage from all the images. This is done by calculating the maximal width of all images and the sum of the heights of all images. Finally, it creates a new image with an alpha channel. That is, all images are arranged one below the other, and the empty spaces between them are marked as transparent.
Click the 'run' button to start this procedure. When it's done, it prints the time it took to build the collage (this give a good indication of the process when analyzing a large corpus). The generated collage pops up. You may want to view or save it.
##### Part 2: Building a K-Means model and running it on the collage
In order to calculate and identify clusters of colors in the dataset, we first need to convert the images into a numerical representation - a color array. The array has four dimensions: Red, Green, Blue (RGB) and Alpha (the transparent color we added to mark the empty spaces in the previous section).
Subsequently, the collage is represented as a matrix of the total height * total width * 4(that is, RGB+A).
Since KMeans does not work on a matrix, we need to transform it into a continuous, one-dimensional layer. For example, if the maximum height of the collage is 100, and the maximum width is 400, instead of representing the collage as a 100 * 400 * 4, it is represented as one line of the sum: 160,000.
Finally, we remove all transparent colors, as they are not necessary for the calculation, and we fit the model. In the code, we specify 5 clusters, but this number can be changed.
Click the 'run' button to start this procedure. When it's done, it prints the time it took to build the collage. (The larger your collage is and the larger the number of clusters, the longer it will take to complete).
##### Part 3: Generating the color histogram
This section calculates the proportion of colors for each section. Then, it normalizes the histogram, so that the proportions sum to 1.
Finally, it generates an image that puts the width of each color in a histogram.
1.for each cluster, calculate the proportion of each color.
Click the 'run' button to start this procedure. The resulting histogram that pops up summarizes the color composition of your corpus!
##### N.B.
this is the bit of code where you may change the name of the demo folder to your own folder of images:
folder = 'YOUR FOLDER'
This is the bit of code where you may change the number of clusters (=colors in the histogram):
kmeans_model = KMeans(n_clusters=YOUR NUMBER)
| omilab/image-color-analysis | README.md | Markdown | mit | 4,595 | [
30522,
1001,
1001,
1001,
3746,
3609,
4106,
2023,
3609,
4106,
6994,
2001,
2328,
2000,
2490,
1037,
2951,
5107,
25095,
4118,
2005,
1996,
2817,
1997,
2120,
4773,
2015,
1012,
2009,
2001,
3322,
2109,
2000,
17908,
1996,
5278,
6087,
1997,
1996,
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... |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="es">
<head>
<!-- Generated by javadoc (version 1.7.0_65) on Fri Oct 31 22:35:35 CET 2014 -->
<title>R-Index</title>
<meta name="date" content="2014-10-31">
<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="R-Index";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../overview-summary.html">Overview</a></li>
<li>Package</li>
<li>Class</li>
<li>Use</li>
<li><a href="../overview-tree.html">Tree</a></li>
<li><a href="../deprecated-list.html">Deprecated</a></li>
<li class="navBarCell1Rev">Index</li>
<li><a href="../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="index-12.html">Prev Letter</a></li>
<li><a href="index-14.html">Next Letter</a></li>
</ul>
<ul class="navList">
<li><a href="../index.html?index-filesindex-13.html" target="_top">Frames</a></li>
<li><a href="index-13.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="contentContainer"><a href="index-1.html">A</a> <a href="index-2.html">B</a> <a href="index-3.html">C</a> <a href="index-4.html">D</a> <a href="index-5.html">E</a> <a href="index-6.html">F</a> <a href="index-7.html">G</a> <a href="index-8.html">H</a> <a href="index-9.html">I</a> <a href="index-10.html">L</a> <a href="index-11.html">M</a> <a href="index-12.html">P</a> <a href="index-13.html">R</a> <a href="index-14.html">S</a> <a href="index-15.html">T</a> <a href="index-16.html">U</a> <a href="index-17.html">V</a> <a href="index-18.html">W</a> <a name="_R_">
<!-- -->
</a>
<h2 class="title">R</h2>
<dl>
<dt><span class="strong"><a href="../es/udc/fi/dc/fd/follow/FollowRepository.html#removeFollowed(es.udc.fi.dc.fd.follow.Follow)">removeFollowed(Follow)</a></span> - Method in class es.udc.fi.dc.fd.follow.<a href="../es/udc/fi/dc/fd/follow/FollowRepository.html" title="class in es.udc.fi.dc.fd.follow">FollowRepository</a></dt>
<dd> </dd>
<dt><span class="strong"><a href="../es/udc/fi/dc/fd/account/UserAuthenticationIntegrationTest.html#requiresAuthentication()">requiresAuthentication()</a></span> - Method in class es.udc.fi.dc.fd.account.<a href="../es/udc/fi/dc/fd/account/UserAuthenticationIntegrationTest.html" title="class in es.udc.fi.dc.fd.account">UserAuthenticationIntegrationTest</a></dt>
<dd> </dd>
</dl>
<a href="index-1.html">A</a> <a href="index-2.html">B</a> <a href="index-3.html">C</a> <a href="index-4.html">D</a> <a href="index-5.html">E</a> <a href="index-6.html">F</a> <a href="index-7.html">G</a> <a href="index-8.html">H</a> <a href="index-9.html">I</a> <a href="index-10.html">L</a> <a href="index-11.html">M</a> <a href="index-12.html">P</a> <a href="index-13.html">R</a> <a href="index-14.html">S</a> <a href="index-15.html">T</a> <a href="index-16.html">U</a> <a href="index-17.html">V</a> <a href="index-18.html">W</a> </div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../overview-summary.html">Overview</a></li>
<li>Package</li>
<li>Class</li>
<li>Use</li>
<li><a href="../overview-tree.html">Tree</a></li>
<li><a href="../deprecated-list.html">Deprecated</a></li>
<li class="navBarCell1Rev">Index</li>
<li><a href="../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="index-12.html">Prev Letter</a></li>
<li><a href="index-14.html">Next Letter</a></li>
</ul>
<ul class="navList">
<li><a href="../index.html?index-filesindex-13.html" target="_top">Frames</a></li>
<li><a href="index-13.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| iago-suarez/fd-tuiter11 | doc/index-files/index-13.html | HTML | gpl-2.0 | 5,415 | [
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... |
//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#ifndef SAMPLE_UTIL_TGA_UTILS_HPP
#define SAMPLE_UTIL_TGA_UTILS_HPP
#include <GLES2/gl2.h>
#include <array>
#include <vector>
typedef std::array<unsigned char, 4> Byte4;
struct TGAImage
{
size_t width;
size_t height;
std::vector<Byte4> data;
TGAImage();
};
bool LoadTGAImageFromFile(const std::string &path, TGAImage *image);
GLuint LoadTextureFromTGAImage(const TGAImage &image);
#endif // SAMPLE_UTIL_TGA_UTILS_HPP
| sgraham/nope | third_party/angle/samples/angle/sample_util/tga_utils.h | C | bsd-3-clause | 621 | [
30522,
1013,
1013,
1013,
1013,
9385,
1006,
1039,
1007,
2297,
1996,
6466,
2622,
6048,
1012,
2035,
2916,
9235,
1012,
1013,
1013,
2224,
1997,
2023,
3120,
3642,
2003,
9950,
2011,
1037,
18667,
2094,
1011,
2806,
6105,
2008,
2064,
2022,
1013,
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... |
#-*- coding: utf-8 -*-
from openerp.osv import fields, osv
class project_issue(osv.osv):
_inherit = 'project.issue'
_columns = {
'project_issue_solution_id': fields.many2one('project.issue.solution', 'Linked Solution'),
'issue_description': fields.html('Issue Description'),
'solution_description': fields.html('Solution Description'),
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
| jorsea/odoo-addons | project_issue_solutions/project_issue.py | Python | agpl-3.0 | 445 | [
30522,
1001,
1011,
1008,
1011,
16861,
1024,
21183,
2546,
1011,
1022,
1011,
1008,
1011,
2013,
16181,
2361,
1012,
9808,
2615,
12324,
4249,
1010,
9808,
2615,
2465,
2622,
1035,
3277,
1006,
9808,
2615,
1012,
9808,
2615,
1007,
1024,
1035,
22490,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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) 2013 Autodesk, Inc.
All rights reserved.
Use of this software is subject to the terms of the Autodesk license agreement
provided at the time of installation or download, or which otherwise accompanies
this software in either electronic or hard copy form.
****************************************************************************************/
//! \file fbxpatch.h
#ifndef _FBXSDK_SCENE_GEOMETRY_PATCH_H_
#define _FBXSDK_SCENE_GEOMETRY_PATCH_H_
#include <fbxsdk/fbxsdk_def.h>
#include <fbxsdk/scene/geometry/fbxgeometry.h>
#include <fbxsdk/fbxsdk_nsbegin.h>
/** A patch is a type of node attribute with parametric surface.
* A patch object is useful for creating gently curved surfaces, and provides very detailed control for manipulating complex geometry.
* \nosubgrouping
*/
class FBXSDK_DLL FbxPatch : public FbxGeometry
{
FBXSDK_OBJECT_DECLARE(FbxPatch,FbxGeometry);
public:
//! Returns the FbxNodeAttribute::EType::ePatch node attribute type.
virtual FbxNodeAttribute::EType GetAttributeType() const;
//! Resets the patch to its default values.
void Reset();
/**
* \name Patch Properties
*/
//@{
/** Sets the surface mode.
* \param pMode Surface mode identifier (see Class FbxGeometry).
*/
void SetSurfaceMode(FbxGeometry::ESurfaceMode pMode);
/** Returns the surface mode.
* \return The current surface mode identifier.
*/
inline FbxGeometry::ESurfaceMode GetSurfaceMode() const {return mSurfaceMode;}
/** \enum EType Patch types.
* - \e eBezier
* - \e eBezierQuadric
* - \e eCardinal
* - \e eBSpline
* - \e eLinear
*/
enum EType
{
eBezier,
eBezierQuadric,
eCardinal,
eBSpline,
eLinear
};
/** Allocates memory space for the control points array.
* \param pUCount Number of U-dimension control points.
* \param pUType U-dimension patch type.
* \param pVCount Number of V-dimension control points.
* \param pVType V-dimension patch type.
*/
void InitControlPoints(int pUCount, EType pUType, int pVCount, EType pVType);
/** Returns the number of control points in the U-dimension.
* \return The number of control points in the U-dimension.
*/
inline int GetUCount() const {return mUCount;}
/** Returns the number of control points in the V-dimension.
* \return The number of control points in the V-dimension.
*/
inline int GetVCount() const {return mVCount;}
/** Returns the U-dimension patch type.
* \return Patch type identifier in the U-dimension.
*/
inline EType GetPatchUType() const {return mUType;}
/** Returns the V-dimension patch type.
* \return Patch type identifier in the V-dimension.
*/
inline EType GetPatchVType () const {return mVType;}
/** Sets the patch step.
* The step is the number of divisions between adjacent control points.
* \param pUStep Steps in U-dimension.
* \param pVStep Steps in V-dimension.
*/
void SetStep(int pUStep, int pVStep);
/** Returns the number of divisions between adjacent control points in the U-dimension.
* \return Step value in the U-dimension.
*/
inline int GetUStep() const {return mUStep;}
/** Returns the number of divisions between adjacent control points in the V-dimension.
* \return Step value in the V-dimension.
*/
inline int GetVStep() const {return mVStep;}
/** Sets closed flags.
* \param pU Set to \c true if the patch is closed in U dimension.
* \param pV Set to \c true if the patch is closed in V dimension.
*/
void SetClosed(bool pU, bool pV);
/** Returns state of the U closed flag.
* \return \c True if the patch is closed in U dimension.
*/
inline bool GetUClosed() const {return mUClosed;}
/** Returns state of the V closed flag.
* \return \c True if the patch is closed in V dimension.
*/
inline bool GetVClosed() const {return mVClosed;}
/** Sets U-capped flags.
* \param pUBottom Set to \c true if the patch is capped at the bottom in the U-dimension.
* \param pUTop \c Set to \c true if the patch is capped on the top in the U-dimension.
* \remarks Capping options are saved but not loaded by Motionbuilder because they
* are computed from the patch topography.
*/
void SetUCapped(bool pUBottom, bool pUTop);
/** Returns state of the bottom U-capped flag.
* \return \c True if the patch is capped at the bottom in the U-dimension.
*/
inline bool GetUCappedBottom() const {return mUCappedBottom;}
/** Returns state of the top U-capped flag.
* \return \c True if the patch is capped on the top in the U-dimension.
*/
inline bool GetUCappedTop() const {return mUCappedTop;}
/** Sets V-capped flags.
* \param pVBottom Sets to \c true if the patch is capped at the bottom in the V-dimension.
* \param pVTop Sets to \c true if the patch is capped on the top in the V-dimension.
* \remarks Capping options are saved but not loaded by Motionbuilder because they
* are computed from the patch topography.
*/
void SetVCapped(bool pVBottom, bool pVTop);
/** Returns state of the bottom V-capped flag.
* \return \c True if the patch is capped at the bottom.
*/
inline bool GetVCappedBottom() const {return mVCappedBottom;}
/** Returns state of the top V-capped flag.
* \return \c True if the patch is capped on the top.
*/
inline bool GetVCappedTop() const {return mVCappedTop;}
//@}
/**
* \name Off-loading Serialization section
*/
//@{
/** Writes the content of the patch to the given stream.
* \param pStream The destination stream.
* \return \c True if the content is successfully processed by the receiving stream.
* If it is not successful, returns \c false.
*/
virtual bool ContentWriteTo(FbxStream& pStream) const;
/** Reads the content of the patch from the given stream.
* \param pStream The source stream.
* \return \c True if the patch completes with the data received from the stream successfully.
* If it is not successful, returns \c false.
*/
virtual bool ContentReadFrom(const FbxStream& pStream);
//@}
/*****************************************************************************************************************************
** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
*****************************************************************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
virtual FbxObject& Copy(const FbxObject& pObject);
protected:
virtual void Construct(const FbxPatch* pFrom);
virtual void Destruct(bool pRecursive);
EType mUType, mVType;
int mUCount, mVCount;
int mUStep, mVStep;
bool mUClosed, mVClosed;
bool mUCappedBottom, mUCappedTop;
bool mVCappedBottom, mVCappedTop;
FbxGeometry::ESurfaceMode mSurfaceMode;
#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
};
#include <fbxsdk/fbxsdk_nsend.h>
#endif /* _FBXSDK_SCENE_GEOMETRY_PATCH_H_ */
| demiurghg/FusionEngine | SDKs/FbxSdk/include/fbxsdk/scene/geometry/fbxpatch.h | C | mit | 8,315 | [
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... |
package ch.rasc.eds.starter.service;
import static ch.ralscha.extdirectspring.annotation.ExtDirectMethodType.STORE_MODIFY;
import static ch.ralscha.extdirectspring.annotation.ExtDirectMethodType.STORE_READ;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.UUID;
import javax.validation.Validator;
import org.bson.conversions.Bson;
import org.springframework.context.MessageSource;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import com.mongodb.client.FindIterable;
import com.mongodb.client.model.Filters;
import com.mongodb.client.model.FindOneAndUpdateOptions;
import com.mongodb.client.model.ReturnDocument;
import com.mongodb.client.model.Sorts;
import com.mongodb.client.model.UpdateOptions;
import com.mongodb.client.model.Updates;
import ch.ralscha.extdirectspring.annotation.ExtDirectMethod;
import ch.ralscha.extdirectspring.bean.ExtDirectStoreReadRequest;
import ch.ralscha.extdirectspring.bean.ExtDirectStoreResult;
import ch.ralscha.extdirectspring.filter.StringFilter;
import ch.rasc.eds.starter.config.MongoDb;
import ch.rasc.eds.starter.config.security.RequireAdminAuthority;
import ch.rasc.eds.starter.entity.Authority;
import ch.rasc.eds.starter.entity.CPersistentLogin;
import ch.rasc.eds.starter.entity.CUser;
import ch.rasc.eds.starter.entity.PersistentLogin;
import ch.rasc.eds.starter.entity.User;
import ch.rasc.eds.starter.util.QueryUtil;
import ch.rasc.eds.starter.util.ValidationMessages;
import ch.rasc.eds.starter.util.ValidationMessagesResult;
import ch.rasc.eds.starter.util.ValidationUtil;
import de.danielbechler.diff.ObjectDiffer;
import de.danielbechler.diff.ObjectDifferBuilder;
import de.danielbechler.diff.node.DiffNode;
import de.danielbechler.diff.node.DiffNode.State;
@Service
@RequireAdminAuthority
public class UserService {
private final MessageSource messageSource;
private final Validator validator;
private final MongoDb mongoDb;
private final MailService mailService;
public UserService(MongoDb mongoDb, Validator validator, MessageSource messageSource,
MailService mailService) {
this.mongoDb = mongoDb;
this.messageSource = messageSource;
this.validator = validator;
this.mailService = mailService;
}
@ExtDirectMethod(STORE_READ)
public ExtDirectStoreResult<User> read(ExtDirectStoreReadRequest request) {
List<Bson> andFilters = new ArrayList<>();
StringFilter filter = request.getFirstFilterForField("filter");
if (filter != null) {
List<Bson> orFilters = new ArrayList<>();
orFilters.add(Filters.regex(CUser.loginName, filter.getValue(), "i"));
orFilters.add(Filters.regex(CUser.lastName, filter.getValue(), "i"));
orFilters.add(Filters.regex(CUser.firstName, filter.getValue(), "i"));
orFilters.add(Filters.regex(CUser.email, filter.getValue(), "i"));
andFilters.add(Filters.or(orFilters));
}
andFilters.add(Filters.eq(CUser.deleted, false));
long total = this.mongoDb.getCollection(User.class)
.countDocuments(Filters.and(andFilters));
FindIterable<User> find = this.mongoDb.getCollection(User.class)
.find(Filters.and(andFilters));
find.sort(Sorts.orderBy(QueryUtil.getSorts(request)));
find.skip(request.getStart());
find.limit(request.getLimit());
return new ExtDirectStoreResult<>(total, QueryUtil.toList(find));
}
@ExtDirectMethod(STORE_MODIFY)
public ExtDirectStoreResult<User> destroy(User destroyUser) {
ExtDirectStoreResult<User> result = new ExtDirectStoreResult<>();
if (!isLastAdmin(destroyUser.getId())) {
this.mongoDb.getCollection(User.class)
.deleteOne(Filters.eq(CUser.id, destroyUser.getId()));
result.setSuccess(Boolean.TRUE);
deletePersistentLogins(destroyUser.getId());
}
else {
result.setSuccess(Boolean.FALSE);
}
return result;
}
private void deletePersistentLogins(String userId) {
this.mongoDb.getCollection(PersistentLogin.class)
.deleteMany(Filters.eq(CPersistentLogin.userId, userId));
}
@ExtDirectMethod(STORE_MODIFY)
public ValidationMessagesResult<User> update(User updatedEntity, Locale locale) {
List<ValidationMessages> violations = validateEntity(updatedEntity, locale);
violations.addAll(checkIfLastAdmin(updatedEntity, locale));
if (violations.isEmpty()) {
List<Bson> updates = new ArrayList<>();
updates.add(Updates.set(CUser.loginName, updatedEntity.getLoginName()));
updates.add(Updates.set(CUser.email, updatedEntity.getEmail()));
updates.add(Updates.set(CUser.firstName, updatedEntity.getFirstName()));
updates.add(Updates.set(CUser.lastName, updatedEntity.getLastName()));
updates.add(Updates.set(CUser.locale, updatedEntity.getLocale()));
updates.add(Updates.set(CUser.enabled, updatedEntity.isEnabled()));
if (updatedEntity.getAuthorities() != null
&& !updatedEntity.getAuthorities().isEmpty()) {
updates.add(
Updates.set(CUser.authorities, updatedEntity.getAuthorities()));
}
else {
updates.add(Updates.unset(CUser.authorities));
}
updates.add(Updates.setOnInsert(CUser.deleted, false));
this.mongoDb.getCollection(User.class).updateOne(
Filters.eq(CUser.id, updatedEntity.getId()), Updates.combine(updates),
new UpdateOptions().upsert(true));
if (!updatedEntity.isEnabled()) {
deletePersistentLogins(updatedEntity.getId());
}
return new ValidationMessagesResult<>(updatedEntity);
}
ValidationMessagesResult<User> result = new ValidationMessagesResult<>(
updatedEntity);
result.setValidations(violations);
return result;
}
private List<ValidationMessages> checkIfLastAdmin(User updatedEntity, Locale locale) {
User dbUser = this.mongoDb.getCollection(User.class)
.find(Filters.eq(CUser.id, updatedEntity.getId())).first();
List<ValidationMessages> validationErrors = new ArrayList<>();
if (dbUser != null && (!updatedEntity.isEnabled()
|| updatedEntity.getAuthorities() == null
|| !updatedEntity.getAuthorities().contains(Authority.ADMIN.name()))) {
if (isLastAdmin(updatedEntity.getId())) {
ObjectDiffer objectDiffer = ObjectDifferBuilder.startBuilding()
.filtering().returnNodesWithState(State.UNTOUCHED).and().build();
DiffNode diff = objectDiffer.compare(updatedEntity, dbUser);
DiffNode diffNode = diff.getChild(CUser.enabled);
if (!diffNode.isUntouched()) {
updatedEntity.setEnabled(dbUser.isEnabled());
ValidationMessages validationError = new ValidationMessages();
validationError.setField(CUser.enabled);
validationError.setMessage(this.messageSource
.getMessage("user_lastadmin_error", null, locale));
validationErrors.add(validationError);
}
diffNode = diff.getChild(CUser.authorities);
if (!diffNode.isUntouched()) {
updatedEntity.setAuthorities(dbUser.getAuthorities());
ValidationMessages validationError = new ValidationMessages();
validationError.setField(CUser.authorities);
validationError.setMessage(this.messageSource
.getMessage("user_lastadmin_error", null, locale));
validationErrors.add(validationError);
}
}
}
return validationErrors;
}
private List<ValidationMessages> validateEntity(User user, Locale locale) {
List<ValidationMessages> validations = ValidationUtil
.validateEntity(this.validator, user);
if (!isEmailUnique(this.mongoDb, user.getId(), user.getEmail())) {
ValidationMessages validationError = new ValidationMessages();
validationError.setField(CUser.email);
validationError.setMessage(
this.messageSource.getMessage("user_emailtaken", null, locale));
validations.add(validationError);
}
if (!isLoginNameUnique(this.mongoDb, user.getId(), user.getLoginName())) {
ValidationMessages validationError = new ValidationMessages();
validationError.setField(CUser.loginName);
validationError.setMessage(
this.messageSource.getMessage("user_loginnametaken", null, locale));
validations.add(validationError);
}
return validations;
}
private boolean isLastAdmin(String id) {
long count = this.mongoDb.getCollection(User.class)
.countDocuments(Filters.and(Filters.ne(CUser.id, id),
Filters.eq(CUser.deleted, false),
Filters.eq(CUser.authorities, Authority.ADMIN.name()),
Filters.eq(CUser.enabled, true)));
return count == 0;
}
public static boolean isEmailUnique(MongoDb mongoDb, String userId, String email) {
if (StringUtils.hasText(email)) {
long count;
if (userId != null) {
count = mongoDb.getCollection(User.class)
.countDocuments(Filters.and(
Filters.regex(CUser.email, "^" + email + "$", "i"),
Filters.ne(CUser.id, userId)));
}
else {
count = mongoDb.getCollection(User.class)
.countDocuments(Filters.regex(CUser.email, "^" + email + "$", "i"));
}
return count == 0;
}
return true;
}
public static boolean isLoginNameUnique(MongoDb mongoDb, String userId,
String loginName) {
if (StringUtils.hasText(loginName)) {
long count;
if (userId != null) {
count = mongoDb.getCollection(User.class)
.countDocuments(Filters.and(Filters.regex(CUser.loginName,
"^" + loginName + "$", "i"),
Filters.ne(CUser.id, userId)));
}
else {
count = mongoDb.getCollection(User.class).countDocuments(
Filters.regex(CUser.loginName, "^" + loginName + "$", "i"));
}
return count == 0;
}
return false;
}
@ExtDirectMethod
public void unlock(String userId) {
this.mongoDb.getCollection(User.class).updateOne(Filters.eq(CUser.id, userId),
Updates.combine(Updates.unset(CUser.lockedOutUntil),
Updates.set(CUser.failedLogins, 0)));
}
@ExtDirectMethod
public void disableTwoFactorAuth(String userId) {
this.mongoDb.getCollection(User.class).updateOne(Filters.eq(CUser.id, userId),
Updates.unset(CUser.secret));
}
@ExtDirectMethod
public void sendPassordResetEmail(String userId) {
String token = UUID.randomUUID().toString();
User user = this.mongoDb.getCollection(User.class).findOneAndUpdate(
Filters.eq(CUser.id, userId),
Updates.combine(
Updates.set(CUser.passwordResetTokenValidUntil,
Date.from(ZonedDateTime.now(ZoneOffset.UTC).plusHours(4)
.toInstant())),
Updates.set(CUser.passwordResetToken, token)),
new FindOneAndUpdateOptions().returnDocument(ReturnDocument.AFTER));
this.mailService.sendPasswortResetEmail(user);
}
}
| ralscha/eds-starter6-mongodb | src/main/java/ch/rasc/eds/starter/service/UserService.java | Java | apache-2.0 | 10,491 | [
30522,
7427,
10381,
1012,
20710,
2278,
1012,
11985,
1012,
11753,
1012,
2326,
1025,
12324,
10763,
10381,
1012,
10958,
4877,
7507,
1012,
4654,
2102,
4305,
2890,
16649,
18098,
2075,
1012,
5754,
17287,
3508,
1012,
4654,
2102,
4305,
2890,
30524,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
if(isset($_GET['pemail']))
{
$pemail=$_GET['pemail'];
}
else
{
$pemail = '';
}
//echo $pemail;
//exit;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Diesel Subscribe</title>
<link href="<?=base_url();?>css/newsletter.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="<?=base_url();?>css/MyFontsWebfontsKit.min.css"/>
<style>
body{background:none;overflow: hidden!important;}
</style>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
// Place ID's of all required fields here.
required = ["email", "postcode", "fname", "lname", "male", "female"];
// If using an ID other than #email or #error then replace it here
email = $("#email");
postcode = $("#postcode");
errornotice = $("#error");
// The text to show up within a field when it is incorrect
emptyerror = "REQUIRED";
emailerror = "ENTER VALID EMAIL ADDRESS";
posterror = "INVALID POSTCODE";
$("form").submit(function(){
//Validate required fields
for (i=0;i<required.length;i++) {
var input = $('#'+required[i]);
if ((input.val() == "") || (input.val() == emptyerror)) {
input.addClass("needsfilled");
input.val("");
input.attr("placeholder", emptyerror);
/*if( input.attr("type") == "password" ) {
input.attr("placeholder", passwerror );
}*/
errornotice.fadeIn(750);
} else {
input.removeClass("needsfilled");
}
}
// Validate the e-mail.
if (!/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(email.val())) {
email.addClass("needsfilled");
email.val("");
email.attr("placeholder", emailerror);
}
if (!/^\d{4}$/.test(postcode.val())){
postcode.addClass("needsfilled");
postcode.val("");
postcode.attr("placeholder", posterror);
}
//if any inputs on the page have the class 'needsfilled' the form will not submit
if ($(":input").hasClass("needsfilled")) {
return false;
} else {
errornotice.hide();
return true;
}
});
});
</script>
<style type="text/css">.fancybox-overlay{background:rgba(0, 0, 0, 0.70); }</style>
</head>
<body>
<div class="main-popup">
<div class="images-left">
<img src="<?=base_url();?>images/newsletter-new.png" />
</div>
<div id="signup">
<?php if(isset($msg) && $msg != '') {
if($msg == 'Newsletter Successfully Subscribed!!') { ?>
<!-- success -->
<div class="heading-newsletter subscribe-new">thanks for joining <br /> diesel tribe</div>
<table border="0" cellspacing="0" cellpadding="0" style="width:100%">
<tr>
<td width="50%"></td><td width="50%"></td>
</tr>
<tr>
<td width="100%" colspan="2"><p class="text1 subscribe-text1">Check your inbox for an email to <br />confirm your subscription. </p></td>
</tr>
<tr>
<td width="100%" colspan="2"><p class="text1">Your <b>15% OFF</b> code will be <br /> emailed to you following.</p></td>
</tr>
</table>
<?php } elseif ($msg == 'You are already subscribed') { ?>
<!-- subscribe -->
<div class="heading-newsletter subscribe-new">you clearly have style!</div>
<table border="0" cellspacing="0" cellpadding="0" style="width:100%">
<tr>
<td width="50%"></td><td width="50%"></td>
</tr>
<tr>
<td width="100%" colspan="2"><p class="text1 subscribe-text1"> You’re already subscribed <br /> to Diesel Tribe.</p></td>
</tr>
<tr>
<td width="100%" colspan="2"><p class="text1">Keep an eye on your <br /> inbox for more style news <br /> and offers shortly</p></td>
</tr>
</table>
<?php } else { ?>
<!-- fail -->
<p class="success"><?=$msg?><br></p>
<?php } ?>
<?php } else { ?>
<form id="form1" method="post" action="<?=base_url();?>newsletter/signupprocess" name="form1">
<center>
<input type="hidden" name="Testform hidden" value="1" />
<div class="heading-newsletter">LIVE MORE SUCCESSFULLY</div>
<table border="0" cellspacing="0" cellpadding="0" style="width:100%">
<tr>
<td width="50%"></td><td width="50%"></td>
</tr>
<tr>
<td width="100%" colspan="2"><p class="text1">Join the Diesel Tribe and <br /> get <b>15% off</b> your first purchase online.</p></td>
</tr>
<tr>
<td colspan="2"><p class="ftxtarea name-txt"><span class="txt_field"><input placeholder="EMAIL ADDRESS" onfocus="this.placeholder = ''" onblur="this.placeholder = 'EMAIL ADDRESS'" name="email" id="email" type="text" value="<?=$pemail?>" style="width:99%;margin:0 auto;text-align:center;" /></span></p></td>
</tr>
<tr>
<td><p class="ftxtarea name-txt"><span class="txt_field"><input placeholder="FIRST NAME" onfocus="this.placeholder = ''" onblur="this.placeholder = 'FIRST NAME'" name="fname" id="fname" type="text" value="<?=$pemail?>" style="width: 95%;float: left;text-align:center;" /></span></p></td>
<td><p class="ftxtarea name-txt"><span class="txt_field"><input placeholder="LAST NAME" onfocus="this.placeholder = ''" onblur="this.placeholder = 'LAST NAME'" name="lname" id="lname" type="text" value="<?=$pemail?>" style="width: 95%;float: right;text-align:center;" /></span></p></td>
</tr>
<tr>
<td><p class="ftxtarea radiotext-m"><input placeholder="MALE" name="gender" id="male" type="radio" value="Male" style="" checked="checked" /> <label class="txt_field radio_txt" for="male">MALE</label></p></td>
<td><p class="ftxtarea radiotext-f"><input placeholder="FEMALE" name="gender" id="female" type="radio" value="Female" style="" /> <label class="txt_field radio_txt" for="female">FEMALE</label></p></td>
</tr>
<tr>
<td colspan="2">
<div class="main-fields">
<p class="ftxtarea ftext1"><span class="txt_field"><input placeholder="POSTCODE" onfocus="this.placeholder = ''" onblur="this.placeholder = 'POSTCODE'" name="postcode" id="postcode" type="text" value="<?php /*?><?=$postcode?><?php */?>" maxlength="4" style=" width: 191px;text-align: center;" /></span></p>
</div>
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" name="Submit" value="SUBSCRIBE" class="subscribe-newsignup" />
</td>
</tr>
<tr>
<td colspan="2">
<a href="<?=base_url();?>info/policy" class="info-a" target="_blank">information on privacy</a>
</td>
</tr>
</table>
</center>
</form>
<?php } ?>
</div>
</div> <!-- ------------- main popup ------------- -->
</body>
</html>
| sygcom/diesel_2016 | application/views/newsletter/signup_view-06-12-2016.php | PHP | mit | 7,492 | [
30522,
1026,
1029,
25718,
2065,
1006,
26354,
3388,
1006,
1002,
1035,
2131,
1031,
1005,
21877,
21397,
1005,
1033,
1007,
1007,
1063,
1002,
21877,
21397,
1027,
1002,
1035,
2131,
1031,
1005,
21877,
21397,
1005,
1033,
1025,
1065,
2842,
1063,
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 kubernetes
import (
"crypto/x509"
"net/http"
"strings"
"time"
"github.com/golang/glog"
"k8s.io/kubernetes/pkg/auth/authenticator"
kauthorizer "k8s.io/kubernetes/pkg/auth/authorizer"
"k8s.io/kubernetes/pkg/auth/user"
unversionedauthentication "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/authentication/unversioned"
oauthenticator "github.com/openshift/origin/pkg/auth/authenticator"
"github.com/openshift/origin/pkg/auth/authenticator/anonymous"
"github.com/openshift/origin/pkg/auth/authenticator/request/bearertoken"
"github.com/openshift/origin/pkg/auth/authenticator/request/unionrequest"
"github.com/openshift/origin/pkg/auth/authenticator/request/x509request"
authncache "github.com/openshift/origin/pkg/auth/authenticator/token/cache"
authnremote "github.com/openshift/origin/pkg/auth/authenticator/token/remotetokenreview"
"github.com/openshift/origin/pkg/auth/group"
authorizationapi "github.com/openshift/origin/pkg/authorization/api"
oauthorizer "github.com/openshift/origin/pkg/authorization/authorizer"
authzadapter "github.com/openshift/origin/pkg/authorization/authorizer/adapter"
authzcache "github.com/openshift/origin/pkg/authorization/authorizer/cache"
authzremote "github.com/openshift/origin/pkg/authorization/authorizer/remote"
oclient "github.com/openshift/origin/pkg/client"
"github.com/openshift/origin/pkg/cmd/server/bootstrappolicy"
)
func newAuthenticator(authenticationClient unversionedauthentication.TokenReviewsGetter, clientCAs *x509.CertPool, cacheTTL time.Duration, cacheSize int) (authenticator.Request, error) {
authenticators := []oauthenticator.Request{}
// API token auth
var (
tokenAuthenticator oauthenticator.Token
err error
)
// Authenticate against the remote master
tokenAuthenticator, err = authnremote.NewAuthenticator(authenticationClient)
if err != nil {
return nil, err
}
// Cache results
if cacheTTL > 0 && cacheSize > 0 {
tokenAuthenticator, err = authncache.NewAuthenticator(tokenAuthenticator, cacheTTL, cacheSize)
if err != nil {
return nil, err
}
}
authenticators = append(authenticators, bearertoken.New(tokenAuthenticator, true))
// Client-cert auth
if clientCAs != nil {
opts := x509request.DefaultVerifyOptions()
opts.Roots = clientCAs
certauth := x509request.New(opts, x509request.SubjectToUserConversion)
authenticators = append(authenticators, certauth)
}
ret := &unionrequest.Authenticator{
// Anonymous requests will pass the token and cert checks without errors
// Bad tokens or bad certs will produce errors, in which case we should not continue to authenticate them as "system:anonymous"
FailOnError: true,
Handlers: []oauthenticator.Request{
// Add the "system:authenticated" group to users that pass token/cert authentication
group.NewGroupAdder(unionrequest.NewUnionAuthentication(authenticators...), []string{bootstrappolicy.AuthenticatedGroup}),
// Fall back to the "system:anonymous" user
anonymous.NewAuthenticator(),
},
}
return ret, nil
}
func newAuthorizerAttributesGetter(nodeName string) (kauthorizer.RequestAttributesGetter, error) {
return NodeAuthorizerAttributesGetter{nodeName}, nil
}
type NodeAuthorizerAttributesGetter struct {
nodeName string
}
func isSubpath(r *http.Request, path string) bool {
path = strings.TrimSuffix(path, "/")
return r.URL.Path == path || strings.HasPrefix(r.URL.Path, path+"/")
}
// GetRequestAttributes populates authorizer attributes for the requests to the kubelet API.
// Default attributes are {apiVersion=v1,verb=proxy,resource=nodes,resourceName=<node name>}
// More specific verb/resource is set for the following request patterns:
// /stats/* => verb=<api verb from request>, resource=nodes/stats
// /metrics/* => verb=<api verb from request>, resource=nodes/metrics
// /logs/* => verb=<api verb from request>, resource=nodes/log
func (n NodeAuthorizerAttributesGetter) GetRequestAttributes(u user.Info, r *http.Request) kauthorizer.Attributes {
// Default verb/resource is proxy nodes, which allows full access to the kubelet API
attrs := oauthorizer.DefaultAuthorizationAttributes{
APIVersion: "v1",
APIGroup: "",
Verb: "proxy",
Resource: "nodes",
ResourceName: n.nodeName,
URL: r.URL.Path,
}
namespace := ""
apiVerb := ""
switch r.Method {
case "POST":
apiVerb = "create"
case "GET":
apiVerb = "get"
case "PUT":
apiVerb = "update"
case "PATCH":
apiVerb = "patch"
case "DELETE":
apiVerb = "delete"
}
// Override verb/resource for specific paths
// Updates to these rules require updating NodeAdminRole and NodeReaderRole in bootstrap policy
switch {
case isSubpath(r, "/stats"):
attrs.Verb = apiVerb
attrs.Resource = authorizationapi.NodeStatsResource
case isSubpath(r, "/metrics"):
attrs.Verb = apiVerb
attrs.Resource = authorizationapi.NodeMetricsResource
case isSubpath(r, "/logs"):
attrs.Verb = apiVerb
attrs.Resource = authorizationapi.NodeLogResource
}
// TODO: handle other things like /healthz/*? not sure if "non-resource" urls on the kubelet make sense to authorize against master non-resource URL policy
glog.V(2).Infof("Node request attributes: namespace=%s, user=%#v, attrs=%#v", namespace, u, attrs)
return authzadapter.KubernetesAuthorizerAttributes(namespace, u, attrs)
}
func newAuthorizer(c *oclient.Client, cacheTTL time.Duration, cacheSize int) (kauthorizer.Authorizer, error) {
var (
authz oauthorizer.Authorizer
err error
)
// Authorize against the remote master
authz, err = authzremote.NewAuthorizer(c)
if err != nil {
return nil, err
}
// Cache results
if cacheTTL > 0 && cacheSize > 0 {
authz, err = authzcache.NewAuthorizer(authz, cacheTTL, cacheSize)
if err != nil {
return nil, err
}
}
// Adapt to the Kubernetes authorizer interface
kauthz, err := authzadapter.NewAuthorizer(authz)
if err != nil {
return nil, err
}
return kauthz, nil
}
| tracyrankin/origin | pkg/cmd/server/kubernetes/node_auth.go | GO | apache-2.0 | 5,989 | [
30522,
7427,
13970,
5677,
7159,
2229,
12324,
1006,
1000,
19888,
2080,
1013,
1060,
12376,
2683,
1000,
1000,
5658,
1013,
8299,
1000,
1000,
7817,
1000,
1000,
2051,
1000,
1000,
21025,
2705,
12083,
1012,
4012,
1013,
2175,
25023,
1013,
1043,
2119... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
---
title: Fall's Fabulous Floral, Fruit, and Foliage Finery
date: 2014-10-13 00:00:00 -06:00
categories:
- whats-blooming
layout: post
blog-banner: whats-blooming-now-fall.jpg
post-date: October 13, 2014
post-time: 2:32 PM
blog-image: wbn-default.jpg
---
<div class="text-center">Fall weather brings about a fabulous display throughout the Garden. Many of our plants are creating a show not only with their flowers, but with their fruits and leaves as well. Be sure to take heed of the cool autumn air as it beckons you to the Garden!</div>
<br>
<br>
<div class="text-center">
<img src="/images/blogs/old-posts/550x377xRudbeckia,P20fulgida,P20var.,P20sullivantii,P20,P27Goldstrum,P27,P20Fall,P20Flower,P20Fruit,P20SQS12.jpg.pagespeed.ic.f1uSSoBXkl.jpg" width="560" height="377" alt="" title="" />
<p>Black-Eyed Susan <i> Rudbeckia fulgida</i> var. <i>sullivantii </i> 'Goldstrum'</p>
<p>Bright yellow petals adorn this perennial in the summer, but fall has given this sturdy flower a more manila appearance.</p>
</div>
<br>
<br>
<div class="text-center">
<img src="/images/blogs/old-posts/550x718xDianthus,P20chinensis,P20,P27Baby,P20Doll,P27,P20Flower,P20SQS14.jpg.pagespeed.ic.NulNQJ865H.jpg" width="560" height="718" alt="" title="" />
<p>Baby Doll Dianthus <i>Dianthus chinensis</i> 'Baby Doll'</p>
<p>This diminutive Dianthus displays blooms that range from a deep rose pink to a bright white and about every shade in between.</p>
</div>
<br>
<br>
<div class="text-center">
<img src="/images/blogs/old-posts/550x804xDelphinium,P20elatum,P20,P27Royal,P20Aspirations,P27,P20Flower,P20SQS14.jpg.pagespeed.ic.HiSf5VqLN4.jpg" width="560" height="804" alt="" title="" />
<p>Candle Larkspur <i> Delphinium elatum</i> 'Royal Aspirations'</p>
<p>Bold spikes of purple-blue are complemented with white centers on this dense-flowering larkspur.</p>
</div>
<br>
<br>
<div class="text-center">
<img src="/images/blogs/old-posts/550x712xDatura,P20wrightii,P20Fruit,P20SQS14.jpg.pagespeed.ic.XnicWsL0jE.jpg" width="560" height="712" alt="" title="" />
<p>Sacred Datura <i> Datura wrightii</i> </p>
<p>Large, fragrant white flowers develop into decorative, but poisonous, spiky fruits on this Utah native.</p>
</div>
<br>
<br>
<div class="text-center">
<img src="/images/blogs/old-posts/550x383xScabiosa,P20ochroleuca,P20Fruit,P20SQS12.jpg.pagespeed.ic.2fjs1lx_k0.jpg" width="560" height="383" alt="" title="" />
<p>Yellow Scabiosa <i> Scabiosa ochroleuca</i> </p>
<p>The multitude of spikes adorning this fun, decorative seed head give this plant it's other common name of pincushion flower.</p>
</div>
<br>
<br>
<div class="text-center">
<img src="/images/blogs/old-posts/550x395xTaxus,P20x,P20media,P20,P27Hicksii,P27,P20Fruit,P20SQS14.jpg.pagespeed.ic.qczwZHOutw.jpg" width="560" height="395" alt="" title="" />
<p>Hick's Yew <i> Taxus x media</i> 'Hicksii'</p>
<p>The almost alien looking fruits of this evergreen range from bright red to opaque pink.</p>
</div>
<br>
<br>
<div class="text-center">
<img src="/images/blogs/old-posts/550x383xScabiosa,P20ochroleuca,P20Fruit,P20SQS12.jpg.pagespeed.ic.2fjs1lx_k0.jpg" width="560" height="383" alt="" title="" />
<p>Yellow Scabiosa <i> Scabiosa ochroleuca</i> </p>
<p>The multitude of spikes adorning this fun, decorative seed head give this plant it's other common name of pincushion flower.</p>
</div>
<br>
<br>
<div class="text-center">
<img src="/images/blogs/old-posts/550x383xScabiosa,P20ochroleuca,P20Fruit,P20SQS12.jpg.pagespeed.ic.2fjs1lx_k0.jpg" width="560" height="383" alt="" title="" />
<p>Yellow Scabiosa <i> Scabiosa ochroleuca</i> </p>
<p>The multitude of spikes adorning this fun, decorative seed head give this plant it's other common name of pincushion flower.</p>
</div>
<br>
<br>
<div class="text-center">
<img src="/images/blogs/old-posts/550x395xTaxus,P20x,P20media,P20,P27Hicksii,P27,P20Fruit,P20SQS14.jpg.pagespeed.ic.qczwZHOutw.jpg" width="560" height="395" alt="" title="" />
<p>Hick's Yew <i> Taxus x media</i> 'Hicksii'</p>
<p>The almost alien looking fruits of this evergreen range from bright red to opaque pink.</p>
</div>
<br>
<br>
<div class="text-center">
<img src="/images/blogs/old-posts/550x367xEuonymus,P20europaeus,P20,P27Red,P20Cascade,P27,P20Fall,P20Leaves,P20SQS12,P202.jpg.pagespeed.ic._frvi_J7Kk.jpg" width="560" height="367" alt="" title="" />
<p>Common Spindle Tree <i> Euonymus europaeus</i> 'Red Cascade'</p>
<p>The leaves of this tree become decorated with a spectacular array and design of colors in the fall.</p>
</div>
<br>
<br>
<div class="text-center">
<img src="/images/blogs/old-posts/550x563xViburnum,P20x,P20burkwoodii,P20Fall,P20Leaves,P20SQS13.JPG.pagespeed.ic.qQmTdz6e3i.jpg" width="560" height="563" alt="" title="" />
<p>Burkwood Viburnum <i>Viburnum x burkwoodii</i> </p>
<p>The leaves of this Viburnum make a lovely show of their transition from green to a deep wine-red hue.</p>
</div>
<br>
<br>
<div class="text-center">
<p>This is a spectacular time of year to visit the Garden and bask in the warmth of the sun. Don't take these autumnal opportunities for granted, winter will be here soon!</p>
</div>
<br>
<h5 class="text-center green">Photos by Sarah Sandoval</h5>
| redbuttegarden/redbuttegarden.github.io | whats-blooming/_posts/2014-10-13-falls-fabulous-floral-fruit-and-foliage-finery.html | HTML | apache-2.0 | 5,555 | [
30522,
1011,
1011,
1011,
2516,
1024,
2991,
1005,
1055,
18783,
18686,
1010,
5909,
1010,
1998,
19624,
26954,
2100,
3058,
1024,
2297,
1011,
2184,
1011,
2410,
4002,
1024,
4002,
1024,
4002,
1011,
5757,
1024,
4002,
7236,
1024,
1011,
2054,
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... |
/*
SPC5 HAL - Copyright (C) 2013 STMicroelectronics
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.
*/
/**
* @file SPC56ELxx/hal_lld.c
* @brief SPC56ELxx HAL subsystem low level driver source.
*
* @addtogroup HAL
* @{
*/
#include "hal.h"
/*===========================================================================*/
/* Driver exported variables. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver local variables and types. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver local functions. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver interrupt handlers. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver exported functions. */
/*===========================================================================*/
/**
* @brief Low level HAL driver initialization.
*
* @notapi
*/
void hal_lld_init(void) {
uint32_t n;
/* The system is switched to the RUN0 mode, the default for normal
operations.*/
if (halSPCSetRunMode(SPC5_RUNMODE_RUN0) == OSAL_FAILED) {
SPC5_CLOCK_FAILURE_HOOK();
}
/* Decrementer timer initialized for system tick use, note, it is
initialized here because in the OSAL layer the system clock frequency
is not yet known.*/
n = halSPCGetSystemClock() / OSAL_ST_FREQUENCY;
asm volatile ("mtspr 22, %[n] \t\n" /* Init. DEC register. */
"mtspr 54, %[n] \t\n" /* Init. DECAR register.*/
"e_lis %%r3, 0x0440 \t\n" /* DIE ARE bits. */
"mtspr 340, %%r3" /* TCR register. */
: : [n] "r" (n) : "r3");
/* TB counter enabled for debug and measurements.*/
asm volatile ("e_li %%r3, 0x4000 \t\n" /* TBEN bit. */
"mtspr 1008, %%r3" /* HID0 register. */
: : : "r3");
/* EDMA initialization.*/
edmaInit();
}
/**
* @brief SPC56ELxx early initialization.
* @note All the involved constants come from the file @p board.h and
* @p hal_lld.h
* @note This function must be invoked only after the system reset.
*
* @special
*/
void spc_clock_init(void) {
/* Waiting for IRC stabilization before attempting anything else.*/
while (!ME.GS.B.S_IRCOSC)
;
#if !SPC5_NO_INIT
#if SPC5_DISABLE_WATCHDOG
/* SWT disabled.*/
SWT.SR.R = 0xC520;
SWT.SR.R = 0xD928;
SWT.CR.R = 0xFF00000A;
#endif
/* Enabling peripheral bridges to allow any operation.*/
AIPS.MPROT.R = 0x77777777;
AIPS.PACR0_7.R = 0;
AIPS.PACR8_15.R = 0;
AIPS.PACR16_23.R = 0;
AIPS.PACR24_31.R = 0;
AIPS.OPACR0_7.R = 0;
AIPS.OPACR8_15.R = 0;
AIPS.OPACR16_23.R = 0;
AIPS.OPACR24_31.R = 0;
AIPS.OPACR32_39.R = 0;
AIPS.OPACR40_47.R = 0;
AIPS.OPACR48_55.R = 0;
AIPS.OPACR56_63.R = 0;
AIPS.OPACR64_71.R = 0;
AIPS.OPACR72_79.R = 0;
AIPS.OPACR80_87.R = 0;
AIPS.OPACR88_95.R = 0;
/* SSCM initialization. Setting up the most restrictive handling of
invalid accesses to peripherals.*/
SSCM.ERROR.R = 3; /* PAE and RAE bits. */
/* FCCU CF errors clearing.*/
FCCU.CFK.R = 0x618B7A50;
FCCU.CFS[0].R = 0xFFFFFFFF;
while (FCCU.CTRL.B.OPS != 3)
;
FCCU.CFK.R = 0x618B7A50;
FCCU.CFS[1].R = 0xFFFFFFFF;
while (FCCU.CTRL.B.OPS != 3)
;
/* FCCU NCF errors clearing.*/
FCCU.NCFK.R = 0xAB3498FE;
FCCU.NCFS[0].R = 0xFFFFFFFF;
while (FCCU.CTRL.B.OPS != 3)
;
/* RGM errors clearing.*/
RGM.FES.R = 0xFFFF;
RGM.DES.R = 0xFFFF;
/* The system must be in DRUN mode on entry, if this is not the case then
it is considered a serious anomaly.*/
if (ME.GS.B.S_CURRENT_MODE != SPC5_RUNMODE_DRUN) {
SPC5_CLOCK_FAILURE_HOOK();
}
#if defined(SPC5_OSC_BYPASS)
/* If the board is equipped with an oscillator instead of a crystal then the
bypass must be activated.*/
CGM.OSC_CTL.B.OSCBYP = TRUE;
#endif /* SPC5_OSC_BYPASS */
/* Setting the various dividers and source selectors.*/
CGM.SC_DC0.R = SPC5_CGM_SC_DC0;
CGM.AC0_DC0_3.R = SPC5_CGM_AC0_DC0 | SPC5_CGM_AC0_DC1;
CGM.AC0_SC.R = SPC5_AUX0CLK_SRC;
CGM.AC1_DC0_3.R = SPC5_CGM_AC1_DC0;
CGM.AC1_SC.R = SPC5_AUX1CLK_SRC;
CGM.AC2_DC0_3.R = SPC5_CGM_AC2_DC0;
CGM.AC2_SC.R = SPC5_AUX2CLK_SRC;
CGM.AC3_SC.R = SPC5_FMPLL0_CLK_SRC;
CGM.AC4_SC.R = SPC5_FMPLL1_CLK_SRC;
/* Enables the XOSC in order to check its functionality before proceeding
with the initialization.*/
ME.DRUN.R = SPC5_ME_MC_SYSCLK_IRC | SPC5_ME_MC_IRCON | SPC5_ME_MC_XOSC0ON | \
SPC5_ME_MC_FLAON_NORMAL | SPC5_ME_MC_MVRON;
if (halSPCSetRunMode(SPC5_RUNMODE_DRUN) == OSAL_FAILED) {
SPC5_CLOCK_FAILURE_HOOK();
}
/* Initialization of the FMPLLs settings.
TODO: Add settings for the MR registers.*/
CGM.FMPLL[0].CR.R = SPC5_FMPLL0_ODF |
((SPC5_FMPLL0_IDF_VALUE - 1) << 26) |
(SPC5_FMPLL0_NDIV_VALUE << 16);
CGM.FMPLL[0].MR.R = 0;
CGM.FMPLL[1].CR.R = SPC5_FMPLL1_ODF |
((SPC5_FMPLL1_IDF_VALUE - 1) << 26) |
(SPC5_FMPLL1_NDIV_VALUE << 16);
CGM.FMPLL[1].MR.R = 0;
/* Run modes initialization, note writes to the MC registers are verified
by a protection mechanism, the operation success is verified at the
end of the sequence.*/
ME.IS.R = 8; /* Resetting I_ICONF status.*/
ME.MER.R = SPC5_ME_ME_BITS; /* Enabled run modes. */
ME.SAFE.R = SPC5_ME_SAFE_MC_BITS; /* SAFE run mode. */
ME.DRUN.R = SPC5_ME_DRUN_MC_BITS; /* DRUN run mode. */
ME.RUN[0].R = SPC5_ME_RUN0_MC_BITS; /* RUN0 run mode. */
ME.RUN[1].R = SPC5_ME_RUN1_MC_BITS; /* RUN1 run mode. */
ME.RUN[2].R = SPC5_ME_RUN2_MC_BITS; /* RUN2 run mode. */
ME.RUN[3].R = SPC5_ME_RUN3_MC_BITS; /* RUN0 run mode. */
ME.HALT0.R = SPC5_ME_HALT0_MC_BITS; /* HALT0 run mode. */
ME.STOP0.R = SPC5_ME_STOP0_MC_BITS; /* STOP0 run mode. */
if (ME.IS.B.I_ICONF) {
/* Configuration rejected.*/
SPC5_CLOCK_FAILURE_HOOK();
}
/* Peripherals run and low power modes initialization.*/
ME.RUNPC[0].R = SPC5_ME_RUN_PC0_BITS;
ME.RUNPC[1].R = SPC5_ME_RUN_PC1_BITS;
ME.RUNPC[2].R = SPC5_ME_RUN_PC2_BITS;
ME.RUNPC[3].R = SPC5_ME_RUN_PC3_BITS;
ME.RUNPC[4].R = SPC5_ME_RUN_PC4_BITS;
ME.RUNPC[5].R = SPC5_ME_RUN_PC5_BITS;
ME.RUNPC[6].R = SPC5_ME_RUN_PC6_BITS;
ME.RUNPC[7].R = SPC5_ME_RUN_PC7_BITS;
ME.LPPC[0].R = SPC5_ME_LP_PC0_BITS;
ME.LPPC[1].R = SPC5_ME_LP_PC1_BITS;
ME.LPPC[2].R = SPC5_ME_LP_PC2_BITS;
ME.LPPC[3].R = SPC5_ME_LP_PC3_BITS;
ME.LPPC[4].R = SPC5_ME_LP_PC4_BITS;
ME.LPPC[5].R = SPC5_ME_LP_PC5_BITS;
ME.LPPC[6].R = SPC5_ME_LP_PC6_BITS;
ME.LPPC[7].R = SPC5_ME_LP_PC7_BITS;
/* CFLASH settings initialized for a maximum clock of 120MHz.*/
CFLASH.PFCR0.B.B02_APC = 3;
CFLASH.PFCR0.B.B02_WWSC = 3;
CFLASH.PFCR0.B.B02_RWSC = 3;
/* Switches again to DRUN mode (current mode) in order to update the
settings.*/
if (halSPCSetRunMode(SPC5_RUNMODE_DRUN) == OSAL_FAILED) {
SPC5_CLOCK_FAILURE_HOOK();
}
#endif /* !SPC5_NO_INIT */
}
/**
* @brief Switches the system to the specified run mode.
*
* @param[in] mode one of the possible run modes
*
* @return The operation status.
* @retval OSAL_SUCCESS if the switch operation has been completed.
* @retval OSAL_FAILED if the switch operation failed.
*/
bool halSPCSetRunMode(spc5_runmode_t mode) {
/* Clearing status register bits I_IMODE(4) and I_IMTC(1).*/
ME.IS.R = 5;
/* Starts a transition process.*/
ME.MCTL.R = SPC5_ME_MCTL_MODE(mode) | SPC5_ME_MCTL_KEY;
ME.MCTL.R = SPC5_ME_MCTL_MODE(mode) | SPC5_ME_MCTL_KEY_INV;
/* Waits for the mode switch or an error condition.*/
while (TRUE) {
uint32_t r = ME.IS.R;
if (r & 1)
return OSAL_SUCCESS;
if (r & 4)
return OSAL_FAILED;
}
}
/**
* @brief Changes the clock mode of a peripheral.
*
* @param[in] n index of the @p PCTL register
* @param[in] pctl new value for the @p PCTL register
*
* @notapi
*/
void halSPCSetPeripheralClockMode(uint32_t n, uint32_t pctl) {
uint32_t mode;
ME.PCTL[n].R = pctl;
mode = ME.MCTL.B.TARGET_MODE;
ME.MCTL.R = SPC5_ME_MCTL_MODE(mode) | SPC5_ME_MCTL_KEY;
ME.MCTL.R = SPC5_ME_MCTL_MODE(mode) | SPC5_ME_MCTL_KEY_INV;
}
#if !SPC5_NO_INIT || defined(__DOXYGEN__)
/**
* @brief Returns the system clock under the current run mode.
*
* @return The system clock in Hertz.
*/
uint32_t halSPCGetSystemClock(void) {
uint32_t sysclk;
sysclk = ME.GS.B.S_SYSCLK;
switch (sysclk) {
case SPC5_ME_GS_SYSCLK_IRC:
return SPC5_IRC_CLK;
case SPC5_ME_GS_SYSCLK_XOSC:
return SPC5_XOSC_CLK;
case SPC5_ME_GS_SYSCLK_FMPLL0:
return SPC5_FMPLL0_CLK;
default:
return 0;
}
}
#endif /* !SPC5_NO_INIT */
/** @} */
| bhimebau/ChibiOS | os/hal/ports/SPC5/SPC56ELxx/hal_lld.c | C | gpl-3.0 | 10,673 | [
30522,
1013,
1008,
11867,
2278,
2629,
11085,
1011,
9385,
1006,
1039,
1007,
2286,
2358,
7712,
3217,
12260,
6593,
4948,
6558,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
30524,
1013,
1013,
7479,
1012,
15895,
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... |
/*
* <auto-generated>
* This code was generated by a tool.
*
* Changes to this file may cause incorrect behavior and will be lost if
* the code is regenerated.
* </auto-generated>
*/
#import <Foundation/Foundation.h>
#import "JSONModel.h"
#import "MOZUAuditInfo.h"
@protocol MOZUOrderNote
@end
/**
Properties of an order note for a merchant, which is internal only for administrative purposes and not available to the shopper.
*/
@interface MOZUOrderNote : JSONModel<MOZUOrderNote>
/**
Unique identifier of the source product property. For a product field it will be the name of the field. For a product attribute it will be the Attribute FQN.
*/
@property(nonatomic) NSString * id;
/**
The text content of the order note.
*/
@property(nonatomic) NSString * text;
/**
Identifier and datetime stamp information recorded when a user or application creates, updates, or deletes a resource entity. This value is system-supplied and read-only.
*/
@property(nonatomic) MOZUAuditInfo *auditInfo;
@end
| Mozu/mozu-ios-sdk | MozuApi/Contracts/CommerceRuntime/Orders/MOZUOrderNote.h | C | mit | 1,067 | [
30522,
1013,
1008,
1008,
1026,
8285,
1011,
7013,
1028,
1008,
2023,
3642,
2001,
7013,
2011,
1037,
6994,
1012,
1008,
1008,
3431,
2000,
30524,
1000,
1046,
3385,
5302,
9247,
1012,
1044,
1000,
1001,
12324,
1000,
9587,
9759,
19513,
25090,
2078,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 fr.javatronic.blog.massive.annotation1.sub1;
import fr.javatronic.blog.processor.Annotation_001;
@Annotation_001
public class Class_5815 {
}
| lesaint/experimenting-annotation-processing | experimenting-rounds/massive-count-of-annotated-classes/src/main/java/fr/javatronic/blog/massive/annotation1/sub1/Class_5815.java | Java | apache-2.0 | 151 | [
30522,
7427,
10424,
1012,
9262,
15312,
2594,
1012,
9927,
1012,
5294,
1012,
5754,
17287,
3508,
2487,
1012,
4942,
2487,
1025,
12324,
10424,
1012,
9262,
15312,
2594,
1012,
9927,
1012,
13151,
1012,
5754,
17287,
3508,
1035,
25604,
1025,
1030,
57... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 FbGraph2
class Edge
module Games
def games(params = {})
pages = self.edge :games, params
pages.collect! do |page|
Page.new(page[:id], page).authenticate self.access_token
end
end
end
end
end | jurriaan/fb_graph2 | lib/fb_graph2/edge/games.rb | Ruby | mit | 255 | [
30522,
11336,
1042,
2497,
14413,
2475,
2465,
3341,
11336,
2399,
13366,
2399,
1006,
11498,
5244,
1027,
1063,
1065,
1007,
5530,
1027,
2969,
1012,
3341,
1024,
2399,
1010,
11498,
5244,
5530,
1012,
8145,
999,
2079,
1064,
3931,
1064,
3931,
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... |
module.exports = {
login: function(user, req)
{
// Parse detailed information from user-agent string
var r = require('ua-parser').parse(req.headers['user-agent']);
// Create new UserLogin row to database
sails.models.loglogin.create({
ip: req.ip,
host: req.host,
agent: req.headers['user-agent'],
browser: r.ua.toString(),
browserVersion: r.ua.toVersionString(),
browserFamily: r.ua.family,
os: r.os.toString(),
osVersion: r.os.toVersionString(),
osFamily: r.os.family,
device: r.device.family,
user: user.id
})
.exec(function(err, created) {
if(err) sails.log(err);
created.user = user;
sails.models.loglogin.publishCreate(created);
});
},
request: function(log, req, resp)
{
//var userId = -1;
// if (req.token) {
// userId = req.token;
// } else {
// userId = -1;
// }
sails.models.logrequest.create({
ip: log.ip,
protocol: log.protocol,
method: log.method,
url: log.diagnostic.url,
headers: req.headers || {},
parameters: log.diagnostic.routeParams,
body: log.diagnostic.bodyParams,
query: log.diagnostic.queryParams,
responseTime: log.responseTime || 0,
middlewareLatency: log.diagnostic.middlewareLatency || 0,
user: req.token || 0
})
.exec(function(err, created) {
if(err) sails.log(err);
sails.models.logrequest.publishCreate(created);
});
}
};
| modulr/modulr | api/api/services/LogService.js | JavaScript | mit | 1,506 | [
30522,
11336,
1012,
14338,
1027,
1063,
8833,
2378,
1024,
3853,
1006,
5310,
1010,
2128,
4160,
1007,
1063,
1013,
1013,
11968,
3366,
6851,
2592,
2013,
5310,
1011,
4005,
5164,
13075,
1054,
1027,
5478,
1006,
1005,
25423,
1011,
11968,
8043,
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... |
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example - example-example89-jquery</title>
<script src="../../components/jquery-2.1.1/jquery.js"></script>
<script src="../../../angular.js"></script>
<script src="script.js"></script>
</head>
<body ng-app="dragModule">
<span my-draggable>Drag ME</span>
</body>
</html> | petervyvey/portfolio | webkit/app/vendor/angular/lib/docs/examples/example-example89/index-jquery.html | HTML | mit | 364 | [
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,
2516,
1028,
2742,
1011,
2742,
1011,
2742,
2620... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
/*
* spi_butterfly.c - parport-to-butterfly adapter
*
* Copyright (C) 2005 David Brownell
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/parport.h>
#include <linux/sched.h>
#include <linux/spi/spi.h>
#include <linux/spi/spi_bitbang.h>
#include <linux/spi/flash.h>
#include <linux/mtd/partitions.h>
/*
* This uses SPI to talk with an "AVR Butterfly", which is a $US20 card
* with a battery powered AVR microcontroller and lots of goodies. You
* can use GCC to develop firmware for this.
*
* See Documentation/spi/butterfly for information about how to build
* and use this custom parallel port cable.
*/
/* DATA output bits (pins 2..9 == D0..D7) */
#define butterfly_nreset (1 << 1) /* pin 3 */
#define spi_sck_bit (1 << 0) /* pin 2 */
#define spi_mosi_bit (1 << 7) /* pin 9 */
#define vcc_bits ((1 << 6) | (1 << 5)) /* pins 7, 8 */
/* STATUS input bits */
#define spi_miso_bit PARPORT_STATUS_BUSY /* pin 11 */
/* CONTROL output bits */
#define spi_cs_bit PARPORT_CONTROL_SELECT /* pin 17 */
static inline struct butterfly *spidev_to_pp(struct spi_device *spi)
{
return spi->controller_data;
}
struct butterfly {
/* REVISIT ... for now, this must be first */
struct spi_bitbang bitbang;
struct parport *port;
struct pardevice *pd;
u8 lastbyte;
struct spi_device *dataflash;
struct spi_device *butterfly;
struct spi_board_info info[2];
};
/*----------------------------------------------------------------------*/
static inline void
setsck(struct spi_device *spi, int is_on)
{
struct butterfly *pp = spidev_to_pp(spi);
u8 bit, byte = pp->lastbyte;
bit = spi_sck_bit;
if (is_on)
byte |= bit;
else
byte &= ~bit;
parport_write_data(pp->port, byte);
pp->lastbyte = byte;
}
static inline void
setmosi(struct spi_device *spi, int is_on)
{
struct butterfly *pp = spidev_to_pp(spi);
u8 bit, byte = pp->lastbyte;
bit = spi_mosi_bit;
if (is_on)
byte |= bit;
else
byte &= ~bit;
parport_write_data(pp->port, byte);
pp->lastbyte = byte;
}
static inline int getmiso(struct spi_device *spi)
{
struct butterfly *pp = spidev_to_pp(spi);
int value;
u8 bit;
bit = spi_miso_bit;
/* only STATUS_BUSY is NOT negated */
value = !(parport_read_status(pp->port) & bit);
return (bit == PARPORT_STATUS_BUSY) ? value : !value;
}
static void butterfly_chipselect(struct spi_device *spi, int value)
{
struct butterfly *pp = spidev_to_pp(spi);
/* set default clock polarity */
if (value != BITBANG_CS_INACTIVE)
setsck(spi, spi->mode & SPI_CPOL);
/* here, value == "activate or not";
* most PARPORT_CONTROL_* bits are negated, so we must
* morph it to value == "bit value to write in control register"
*/
if (spi_cs_bit == PARPORT_CONTROL_INIT)
value = !value;
parport_frob_control(pp->port, spi_cs_bit, value ? spi_cs_bit : 0);
}
/* we only needed to implement one mode here, and choose SPI_MODE_0 */
#define spidelay(X) do{}while(0)
//#define spidelay ndelay
#include "spi_bitbang_txrx.h"
static u32
butterfly_txrx_word_mode0(struct spi_device *spi,
unsigned nsecs,
u32 word, u8 bits)
{
return bitbang_txrx_be_cpha0(spi, nsecs, 0, word, bits);
}
/*----------------------------------------------------------------------*/
/* override default partitioning with cmdlinepart */
static struct mtd_partition partitions[] = { {
/* JFFS2 wants partitions of 4*N blocks for this device,
* so sectors 0 and 1 can't be partitions by themselves.
*/
/* sector 0 = 8 pages * 264 bytes/page (1 block)
* sector 1 = 248 pages * 264 bytes/page
*/
.name = "bookkeeping", // 66 KB
.offset = 0,
.size = (8 + 248) * 264,
// .mask_flags = MTD_WRITEABLE,
}, {
/* sector 2 = 256 pages * 264 bytes/page
* sectors 3-5 = 512 pages * 264 bytes/page
*/
.name = "filesystem", // 462 KB
.offset = MTDPART_OFS_APPEND,
.size = MTDPART_SIZ_FULL,
} };
static struct flash_platform_data flash = {
.name = "butterflash",
.parts = partitions,
.nr_parts = ARRAY_SIZE(partitions),
};
/* REVISIT remove this ugly global and its "only one" limitation */
static struct butterfly *butterfly;
static void butterfly_attach(struct parport *p)
{
struct pardevice *pd;
int status;
struct butterfly *pp;
struct spi_master *master;
struct device *dev = p->physport->dev;
if (butterfly || !dev)
return;
/* REVISIT: this just _assumes_ a butterfly is there ... no probe,
* and no way to be selective about what it binds to.
*/
master = spi_alloc_master(dev, sizeof *pp);
if (!master) {
status = -ENOMEM;
goto done;
}
pp = spi_master_get_devdata(master);
/*
* SPI and bitbang hookup
*
* use default setup(), cleanup(), and transfer() methods; and
* only bother implementing mode 0. Start it later.
*/
master->bus_num = 42;
master->num_chipselect = 2;
pp->bitbang.master = spi_master_get(master);
pp->bitbang.chipselect = butterfly_chipselect;
pp->bitbang.txrx_word[SPI_MODE_0] = butterfly_txrx_word_mode0;
/*
* parport hookup
*/
pp->port = p;
pd = parport_register_device(p, "spi_butterfly",
NULL, NULL, NULL,
0 /* FLAGS */, pp);
if (!pd) {
status = -ENOMEM;
goto clean0;
}
pp->pd = pd;
status = parport_claim(pd);
if (status < 0)
goto clean1;
/*
* Butterfly reset, powerup, run firmware
*/
pr_debug("%s: powerup/reset Butterfly\n", p->name);
/* nCS for dataflash (this bit is inverted on output) */
parport_frob_control(pp->port, spi_cs_bit, 0);
/* stabilize power with chip in reset (nRESET), and
* spi_sck_bit clear (CPOL=0)
*/
pp->lastbyte |= vcc_bits;
parport_write_data(pp->port, pp->lastbyte);
msleep(5);
/* take it out of reset; assume long reset delay */
pp->lastbyte |= butterfly_nreset;
parport_write_data(pp->port, pp->lastbyte);
msleep(100);
/*
* Start SPI ... for now, hide that we're two physical busses.
*/
status = spi_bitbang_start(&pp->bitbang);
if (status < 0)
goto clean2;
/* Bus 1 lets us talk to at45db041b (firmware disables AVR SPI), AVR
* (firmware resets at45, acts as spi slave) or neither (we ignore
* both, AVR uses AT45). Here we expect firmware for the first option.
*/
pp->info[0].max_speed_hz = 15 * 1000 * 1000;
strcpy(pp->info[0].modalias, "mtd_dataflash");
pp->info[0].platform_data = &flash;
pp->info[0].chip_select = 1;
pp->info[0].controller_data = pp;
pp->dataflash = spi_new_device(pp->bitbang.master, &pp->info[0]);
if (pp->dataflash)
pr_debug("%s: dataflash at %s\n", p->name,
dev_name(&pp->dataflash->dev));
// dev_info(_what?_, ...)
pr_info("%s: AVR Butterfly\n", p->name);
butterfly = pp;
return;
clean2:
/* turn off VCC */
parport_write_data(pp->port, 0);
parport_release(pp->pd);
clean1:
parport_unregister_device(pd);
clean0:
(void) spi_master_put(pp->bitbang.master);
done:
pr_debug("%s: butterfly probe, fail %d\n", p->name, status);
}
static void butterfly_detach(struct parport *p)
{
struct butterfly *pp;
int status;
/* FIXME this global is ugly ... but, how to quickly get from
* the parport to the "struct butterfly" associated with it?
* "old school" driver-internal device lists?
*/
if (!butterfly || butterfly->port != p)
return;
pp = butterfly;
butterfly = NULL;
/* stop() unregisters child devices too */
status = spi_bitbang_stop(&pp->bitbang);
/* turn off VCC */
parport_write_data(pp->port, 0);
msleep(10);
parport_release(pp->pd);
parport_unregister_device(pp->pd);
(void) spi_master_put(pp->bitbang.master);
}
static struct parport_driver butterfly_driver = {
.name = "spi_butterfly",
.attach = butterfly_attach,
.detach = butterfly_detach,
};
static int __init butterfly_init(void)
{
return parport_register_driver(&butterfly_driver);
}
device_initcall(butterfly_init);
static void __exit butterfly_exit(void)
{
parport_unregister_driver(&butterfly_driver);
}
module_exit(butterfly_exit);
MODULE_DESCRIPTION("Parport Adapter driver for AVR Butterfly");
MODULE_LICENSE("GPL");
| KOala888/GB_kernel | linux_kernel_galaxyplayer-master/drivers/spi/spi_butterfly.c | C | gpl-2.0 | 8,678 | [
30522,
1013,
1008,
1008,
11867,
2072,
1035,
9112,
1012,
1039,
1011,
11968,
6442,
1011,
2000,
1011,
9112,
15581,
2121,
1008,
1008,
9385,
1006,
1039,
1007,
2384,
2585,
15005,
3363,
1008,
1008,
2023,
2565,
2003,
2489,
4007,
1025,
2017,
2064,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
# frozen_string_literal: true
class Account
include Mongoid::Document
field :_id, type: String, overwrite: true, default: ->{ name.try(:parameterize) }
field :number, type: String
field :balance, type: String
field :nickname, type: String
field :name, type: String
field :balanced, type: Mongoid::Boolean, default: ->{ balance? ? true : false }
field :overridden, type: String
embeds_many :memberships
belongs_to :creator, class_name: "User", foreign_key: :creator_id
belongs_to :person
has_many :alerts, autosave: false
has_and_belongs_to_many :agents
has_one :comment, validate: false
validates_presence_of :name
validates_presence_of :nickname, on: :upsert
validates_length_of :name, maximum: 10, on: :create
def overridden
self[:overridden] = "not recommended"
end
# MONGOID-3365
field :period_started_at, type: Time
has_many :consumption_periods, dependent: :destroy, validate: false
def current_consumption
consumption_periods.find_or_create_by(started_at: period_started_at)
end
end
| jonhyman/mongoid | spec/app/models/account.rb | Ruby | mit | 1,055 | [
30522,
1001,
7708,
1035,
5164,
1035,
18204,
1024,
2995,
2465,
4070,
2421,
12256,
3995,
3593,
1024,
1024,
6254,
2492,
1024,
1035,
8909,
1010,
2828,
1024,
5164,
1010,
2058,
26373,
1024,
2995,
1010,
12398,
1024,
1011,
1028,
1063,
2171,
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... |
import Data.Bits ((.&.))
flags :: Int -> Int
flags x
| x .&. 128 > 0 = 12
| otherwise = 13
{-# NOINLINE flags #-}
main :: IO ()
main = print (flags 255)
| ezyang/ghc | testsuite/tests/codeGen/should_run/T13425.hs | Haskell | bsd-3-clause | 159 | [
30522,
12324,
2951,
1012,
9017,
1006,
1006,
1012,
1004,
1012,
1007,
1007,
9245,
1024,
1024,
20014,
1011,
1028,
20014,
9245,
1060,
1064,
1060,
1012,
1004,
1012,
11899,
1028,
1014,
1027,
2260,
1064,
4728,
1027,
2410,
1063,
1011,
1001,
2053,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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) 2006 Dave Hylands <dhylands@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* Alternatively, this software may be distributed under the terms of BSD
* license.
*
* See README and COPYING for more details.
*
****************************************************************************/
/**
*
* @file Hardware.h
*
* @brief Defines all of the hardware definitions for the chip.
*
****************************************************************************/
#if !defined( HARDWARE_H )
#define HARDWARE_H /**< Include Guard */
/* ---- Include Files ---------------------------------------------------- */
#include "Config.h"
#include <avr/io.h>
//--------------------------------------------------------------------------
// LED Constants
#define RED_LED_PIN 4
#define RED_LED_MASK ( 1 << RED_LED_PIN )
#define RED_LED_DDR DDRG
#define RED_LED_PORT PORTG
#define BLUE_LED_PIN 3
#define BLUE_LED_MASK ( 1 << BLUE_LED_PIN )
#define BLUE_LED_DDR DDRG
#define BLUE_LED_PORT PORTG
#define YELLOW_LED_PIN 4
#define YELLOW_LED_MASK ( 1 << YELLOW_LED_PIN )
#define YELLOW_LED_DDR DDRB
#define YELLOW_LED_PORT PORTB
//--------------------------------------------------------------------------
// Some convenience macros to turn the LEDs on/off.
//
// Usage: LED_ON( BLUE );
//
// to turn on the blue LED.
//
// Note: Setting the pin to 0 turns the LED on.
#define LED_ON( color ) do { color ## _LED_PORT &= ~color ## _LED_MASK; } while (0)
#define LED_OFF( color ) do { color ## _LED_PORT |= color ## _LED_MASK; } while (0)
//--------------------------------------------------------------------------
// Port registers.
//
// Note: For input ports, writing a 1 to the PORT register casues an internal
// pullup resistor to be activated. This feature also requires the
// PUD bit to be set in the SFIOR register.
//
// For the DDR pins, 0 = input, 1 = output
// Port A if the one that's just pads on the bottom of the board
#define PORTA_INIT 0xFF
#define DDRA_INIT 0x00
// Port B has 3 PWM lines, and SPI. Pin 4 is connected to the Yellow LED
//
// 7 - OC2 ATM_PWM1C
// 6 - OC1B ATM_PWM1B
// 5 - OC1A ATM_PWM1A
// 4 - OC0 PB4 (Yellow LED)
// 3 - MISO ATM_MISO
// 2 - MOSI ATM_MOSI
// 1 - SCK ATM_SCK
// 0 - SS ATM_SS
#define PORTB_INIT 0xFF // Enable pullups for inputs, Yellow LED off
#define DDRB_INIT YELLOW_LED_MASK
// Port C is available on the headers as 8 I/O lines. We'll assume all inputs
// for now.
#define PORTC_INIT 0xFF // enable pullups for all inputs
#define DDRC_INIT 0x00
// Port D
//
// 7 - T2 ATM_T2
// 6 - T1 ATM_T1
// 5 - PD5 ATM_PD5
// 4 - IC1 ATM_IC1
// 3 - INT3 ATM_TX1
// 2 - INT2 ATM_RX1
// 1 - INT1 ATM_SDA
// 0 - INT0 ATM_SCL
#define PORTD_INIT 0xFF // enable pullups for all inputs
#define DDRD_INIT 0x00
// Port E
//
// 7 - INT7 ATM_INT7
// 6 - INT6 ATM_INT6
// 5 - OC3C ATM_PWM3C
// 4 - OC3B ATM_PWM3B
// 3 - OC3A ATM_PWM3A
// 2 - PE2 ATM_IRQ Used to interrupt gumstix
// 1 - TXD ATM_TX0
// 0 - RXD ATM_RX0
#define PORTE_INIT 0xFF // enable pullups for all inputs
#define DDRE_INIT 0x00
// Port F - A/D lines - could be used as GPIO
//
// We disable all pullups by default so they don't mess with the A/D
#define PORTF_INIT 0x00 // disable pullups for A/D channels
#define DDRF_INIT 0x00
// Port G
//
// 7 - N/A
// 6 - N/A
// 5 - N/A
// 4 - TOSC1 ATM_PG4 - Red LED
// 3 - TOSC2 ATM_PG3 - Blue LED
// 2 - ALE ATM_PG2
// 1 - /RD ATM_PG1
// 0 - /WR ATM_PG0
#define PORTG_INIT 0xFF // Enable pullups for inputs, LEDs off
#define DDRG_INIT ( RED_LED_MASK | BLUE_LED_MASK ) // Make LEDs outputs
//--------------------------------------------------------------------------
// ASSR - Asynchronous Status Register
//
// TOSC1 & TOSC2 are connected to the Red/Blue LEDs so we need to set
// AS0 to 0. AS0 is the only writable bit.
#define ASSR_INIT 0x00
//--------------------------------------------------------------------------
// ADC Settings
#define ADC_PRESCALAR_2 (( 0 << ADPS2 ) | ( 0 << ADPS1 ) | ( 1 << ADPS0 ))
#define ADC_PRESCALAR_4 (( 0 << ADPS2 ) | ( 1 << ADPS1 ) | ( 0 << ADPS0 ))
#define ADC_PRESCALAR_8 (( 0 << ADPS2 ) | ( 1 << ADPS1 ) | ( 1 << ADPS0 ))
#define ADC_PRESCALAR_16 (( 1 << ADPS2 ) | ( 0 << ADPS1 ) | ( 0 << ADPS0 ))
#define ADC_PRESCALAR_32 (( 1 << ADPS2 ) | ( 0 << ADPS1 ) | ( 1 << ADPS0 ))
#define ADC_PRESCALAR_64 (( 1 << ADPS2 ) | ( 1 << ADPS1 ) | ( 0 << ADPS0 ))
#define ADC_PRESCALAR_128 (( 1 << ADPS2 ) | ( 1 << ADPS1 ) | ( 1 << ADPS0 ))
#define ADCSR_INIT (( 1 << ADEN ) | ( 1 << ADSC ) | ADC_PRESCALAR_128 )
#define ADMUX_REF_AREF (( 0 << REFS1 ) | ( 0 << REFS0 ))
#define ADMUX_REF_AVCC (( 0 << REFS1 ) | ( 1 << REFS0 ))
#define ADMUX_REF_INTERNAL (( 1 << REFS1 ) | ( 1 << REFS0 ))
#define ADMUX_INIT ADMUX_REF_AVCC
//--------------------------------------------------------------------------
// UART settings
#define UART0_BAUD_RATE 38400
#define UART1_BAUD_RATE 38400
#define UART_DATA_BIT_8 (( 1 << UCSZ1 ) | ( 1 << UCSZ0 ))
#define UART_PARITY_NONE (( 0 << UPM1 ) | ( 0 << UPM0 ))
#define UART_STOP_BIT_1 ( 0 << USBS )
#define UBRR0_INIT (( CFG_CPU_CLOCK / 16 / UART0_BAUD_RATE ) - 1 )
#define UBRR1_INIT (( CFG_CPU_CLOCK / 16 / UART1_BAUD_RATE ) - 1 )
#define UCSR0A_INIT 0
#define UCSR0B_INIT (( 1 << RXCIE ) | ( 1 << RXEN ) | ( 1 << TXEN ))
#define UCSR0C_INIT ( UART_DATA_BIT_8 | UART_PARITY_NONE | UART_STOP_BIT_1 )
#define UCSR1A_INIT 0
#define UCSR1B_INIT (( 1 << RXCIE ) | ( 1 << RXEN ) | ( 1 << TXEN ))
#define UCSR1C_INIT ( UART_DATA_BIT_8 | UART_PARITY_NONE | UART_STOP_BIT_1 )
/* ---- Variable Externs ------------------------------------------------- */
/**
* Description of variable.
*/
/* ---- Function Prototypes ---------------------------------------------- */
void InitHardware( void );
/** @} */
#endif // HARDWARE_H
| ptLong/linux-code-collections | avr/Flash-LED-robostix/Hardware.h | C | gpl-2.0 | 6,386 | [
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... |
/*
* UFTP - UDP based FTP with multicast
*
* Copyright (C) 2001-2013 Dennis A. Bush, Jr. bush@tcnj.edu
*
* 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/>.
*
* Additional permission under GNU GPL version 3 section 7
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, the copyright holder
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#ifndef _CLIENT_FILEINFO_H
#define _CLIENT_FILEINFO_H
void handle_fileinfo(struct group_list_t *group, const unsigned char *message,
unsigned meslen, struct timeval rxtime);
void send_fileinfo_ack(struct group_list_t *group, int restart);
#endif // _CLIENT_FILEINFO_H
| No9/uftp | deps/uftp-4.7/client_fileinfo.h | C | gpl-3.0 | 1,645 | [
30522,
1013,
1008,
1008,
1057,
6199,
2361,
1011,
20904,
2361,
2241,
3027,
2361,
2007,
4800,
10526,
1008,
1008,
9385,
1006,
1039,
1007,
2541,
1011,
2286,
6877,
1037,
1012,
5747,
1010,
3781,
1012,
5747,
1030,
22975,
2078,
3501,
1012,
3968,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fap.h>
#define EXIT_SUCCESS 0
char *readstdin(void);
int main()
{
char* input;
unsigned int input_len;
fap_packet_t* packet;
char fap_error_output[1024];
fap_init();
/* Get packet to parse from stdin */
input = readstdin();
input_len = strlen(input);
/* Process the packet. */
packet = fap_parseaprs(input, input_len, 0);
if ( packet->error_code ) {
fap_explain_error(*packet->error_code, fap_error_output);
printf("Failed to parse packet (%s): %s\n",
input, fap_error_output);
} else if ( packet->src_callsign ) {
printf("Got packet from %s.\n", packet->src_callsign);
}
fap_free(packet);
fap_cleanup();
return EXIT_SUCCESS;
}
char *readstdin(void)
{
#define BUF_SIZE 1024
char buffer[BUF_SIZE];
size_t contentSize = 1; /* includes NULL */
/* Preallocate space. We could just allocate one char here,
but that wouldn't be efficient. */
char *content = malloc(sizeof(char) * BUF_SIZE);
if(content == NULL) {
perror("Failed to allocate content");
exit(1);
}
content[0] = '\0'; /* null-terminated */
while(fgets(buffer, BUF_SIZE, stdin)) {
char *old = content;
contentSize += strlen(buffer);
content = realloc(content, contentSize);
if(content == NULL) {
perror("Failed to reallocate content");
free(old);
exit(2);
}
strcat(content, buffer);
}
if(ferror(stdin)) {
free(content);
perror("Error reading from stdin.");
exit(3);
}
return(content);
} | n7nix/dantracker | faptest.c | C | gpl-3.0 | 1,515 | [
30522,
1001,
2421,
1026,
4895,
2923,
2094,
1012,
1044,
1028,
1001,
2421,
1026,
2358,
20617,
1012,
1044,
1028,
1001,
2421,
1026,
2358,
19422,
12322,
1012,
1044,
1028,
1001,
2421,
1026,
5164,
1012,
1044,
1028,
1001,
2421,
1026,
6904,
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... |
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef MOZILLA_MEDIASOURCEUTILS_H_
#define MOZILLA_MEDIASOURCEUTILS_H_
#include "nsString.h"
#include "TimeUnits.h"
namespace mozilla {
nsCString DumpTimeRanges(const media::TimeIntervals& aRanges);
} // namespace mozilla
#endif /* MOZILLA_MEDIASOURCEUTILS_H_ */
| Yukarumya/Yukarum-Redfoxes | dom/media/mediasource/MediaSourceUtils.h | C | mpl-2.0 | 596 | [
30522,
1013,
1008,
1011,
1008,
1011,
5549,
1024,
1039,
1009,
1009,
1025,
21628,
1011,
9381,
1024,
1022,
1025,
27427,
4765,
1011,
21628,
2015,
1011,
5549,
1024,
9152,
2140,
1025,
1039,
1011,
3937,
1011,
16396,
1024,
1016,
1011,
1008,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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>
<head>
<meta charset="UTF-8">
<title>Peace Corps Kenya - KSL Glossary</title>
<link rel="icon" href="images/favicon.gif" type="image/x-icon"/>
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link rel="shortcut icon" href="images/favicon.gif" type="image/x-icon"/>
<link rel="stylesheet" type="text/css" href="css/styles.css"/>
<link type="text/css" href="css/css3.css" rel="stylesheet" />
<script type="text/javascript" src=" https://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.js"></script>
<script type="text/javascript" src="js/jquery.pikachoose.js"></script>
<script language="javascript">
$(document).ready(
function (){
$("#pikame").PikaChoose();
});
</script>
</head>
<body>
<!--start container-->
<div id="container">
<!--start header-->
<header>
<!--start logo-->
<a href=“http://www.peacecorps.gov” id="logo"><img src=images/logo.jpg height=“100%” alt=“Peace” Corps/></a>
<!--end logo-->
<!--start menu-->
<nav>
<ul>
<li><a href=welcome.html class="current">Home</a>
</li>
<li><a href=allsigns.html>All Signs</a></li>
<li><a href=biology.html>Biology</a></li>
<li><a href=chemistry.html>Chemistry</a></li>
<li><a href=/math.html>Math</a></li>
<li><a href=physics.html>Physics</a></li>
</ul>
</nav>
<!--end menu-->
<!—end header-->
</header>
<!--start intro-->
<div id="intro">
<header class="group_bannner">
<hgroup>
<h1>Kenyan Sign Language Glossary </h1>
<h3>Signs for Math and Science </h3>
</hgroup>
</header>
</div>
<!--end intro-->
<!--start holder-->
<div class="holder_content">
<section class="group1">
<h3>Glossary</h3>
<p>
<a href=A.html>A</a>
</p>
<p>
<a href=B.html>B</a>
</p>
<p>
<a href=C.html>C</a>
</p>
<p>
<a href=D.html>D</a>
</p>
<p>
<a href=E.html>E</a>
</p>
<p>
<a href=F.html>F</a>
</p>
<p>
<a href=G.html>G</a>
</p>
<p>
<a href=H.html>H</a>
</p>
<p>
<a href=I.html>I</a>
</p>
<p>
<a href=J.html>J</a>
</p>
<p>
<a href=K.html>K</a>
</p>
<p>
<a href=L.html>L</a>
</p>
<p>
<a href=M.html>M</a>
</p>
<p>
<a href=N.html>N</a>
</p>
<p>
<a href=O.html>O</a>
</p>
<p>
<a href=P.html>P</a>
</p>
<p>
<a href=Q.html>Q</a>
</p>
<p>
<a href=R.html>R</a>
</p>
<p>
<a href=S.html>S</a>
</p>
<p>
<a href=T.html>T</a>
</p>
<p>
<a href=U.html>U</a>
</p>
<p>
<a href=V.html>V</a>
</p>
<p>
<a href=W.html>W</a>
</p>
<p>
<a href=X.html>X</a>
</p>
<p>
<a href=Y.html>Y</a>
</p>
<p>
<a href=Z.html>Z</a>
</p>
</section>
<section class="group2">
<h3>Vocabulary for F</h3>
<h4>
<p> <a href=factor.html>Factor (Maths)</a> </p>
<p> <a href=factorise.html>Factorise</a> </p>
<p> <a href=Field.html>Field</a> </p>
<p> <a href=figure.html>Figure</a> </p>
<p> <a href=filter.html>Filter</a> </p>
<p> <a href=filtration.html>Filtration</a> </p>
<p> <a href=firstaid.html>First Aid</a> </p>
<p> <a href=flame.html>Flame</a> </p>
<p> <a href=foetus.html>Foetus</a> </p>
<p> <a href=force.html>Force</a> </p>
<p> <a href=formula.html>Formula</a> </p>
<p> <a href=fraction.html>Fraction</a> </p>
<p> <a href=freeze.html>Freeze</a> </p>
<p> <a href=frequencymaths.html>Frequency (Maths)</a> </p>
<p> <a href=frequencyphysics.html>Frequency (Physics)</a> </p>
<p> <a href=friction.html>Friction</a> </p>
<p> <a href=functionbiology.html>Function (Biology)</a></p>
<p> <a href=functionmaths.html>Function (Maths)</a> </p>
<p> <a href=funnel.html>Funnel</a> </p>
</h4>
</section>
</div>
<!--end holder-->
</div>
<!--end container-->
<!--start footer-->
<footer>
<div class="container">
<div id="FooterTwo"> © 2014 Peace Corps Kenya </div>
<div id="FooterTree"> Code by Peter Hess, PCVL 2014 </a> </div>
</div>
</footer>
<!--end footer-->
<!-- Free template distributed by http://freehtml5templates.com -->
</body></html>
| PeaceCorpsKenya/KSL-Glossary | site/F.html | HTML | mit | 4,152 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
2516,
1028,
3521,
3650,
7938,
1011,
29535,
2140,
27068,
5649,
1026,
1013,
2516,
1028,
1026,
4957... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_55) on Sun Oct 26 05:56:42 EDT 2014 -->
<meta http-equiv="Content-Type" content="text/html" charset="utf-8">
<title>All Classes (Solr 4.10.2 API)</title>
<meta name="date" content="2014-10-26">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
</head>
<body>
<h1 class="bar">All Classes</h1>
<div class="indexContainer">
<ul>
<li><a href="org/apache/solr/schema/ICUCollationField.html" title="class in org.apache.solr.schema">ICUCollationField</a></li>
</ul>
</div>
</body>
</html>
| eissac/solr4sentiment | docs/solr-analysis-extras/allclasses-noframe.html | HTML | apache-2.0 | 693 | [
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... |
import Message from './Message';
export default Message;
export * from './Message';
| ringcentral/ringcentral-js-widget | packages/ringcentral-widgets/components/Message/index.ts | TypeScript | mit | 85 | [
30522,
12324,
4471,
2013,
1005,
1012,
1013,
4471,
1005,
1025,
9167,
12398,
4471,
1025,
9167,
1008,
2013,
1005,
1012,
1013,
4471,
1005,
1025,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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>.
*/
//$Id: $
package org.hibernate.test.join;
/**
* @author Chris Jones
*/
public class Thing {
private Employee salesperson;
private String comments;
/**
* @return Returns the salesperson.
*/
public Employee getSalesperson() {
return salesperson;
}
/**
* @param salesperson The salesperson to set.
*/
public void setSalesperson(Employee salesperson) {
this.salesperson = salesperson;
}
/**
* @return Returns the comments.
*/
public String getComments() {
return comments;
}
/**
* @param comments The comments to set.
*/
public void setComments(String comments) {
this.comments = comments;
}
Long id;
String name;
/**
* @return Returns the ID.
*/
public Long getId() {
return id;
}
/**
* @param id The ID to set.
*/
public void setId(Long id) {
this.id = id;
}
/**
* @return Returns the name.
*/
public String getName() {
return name;
}
/**
* @param name The name to set.
*/
public void setName(String name) {
this.name = name;
}
}
| 1fechner/FeatureExtractor | sources/FeatureExtractor/lib/hibernate-release-5.1.0.Final/project/hibernate-core/src/test/java/org/hibernate/test/join/Thing.java | Java | lgpl-2.1 | 1,249 | [
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... |
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
#ifndef __gnu_xml_validation_relaxng_InterleavePattern__
#define __gnu_xml_validation_relaxng_InterleavePattern__
#pragma interface
#include <gnu/xml/validation/relaxng/Pattern.h>
extern "Java"
{
namespace gnu
{
namespace xml
{
namespace validation
{
namespace relaxng
{
class InterleavePattern;
class Pattern;
}
}
}
}
}
class gnu::xml::validation::relaxng::InterleavePattern : public ::gnu::xml::validation::relaxng::Pattern
{
public: // actually package-private
InterleavePattern();
::gnu::xml::validation::relaxng::Pattern * __attribute__((aligned(__alignof__( ::gnu::xml::validation::relaxng::Pattern)))) pattern1;
::gnu::xml::validation::relaxng::Pattern * pattern2;
public:
static ::java::lang::Class class$;
};
#endif // __gnu_xml_validation_relaxng_InterleavePattern__
| SanDisk-Open-Source/SSD_Dashboard | uefi/gcc/gcc-4.6.3/libjava/gnu/xml/validation/relaxng/InterleavePattern.h | C | gpl-2.0 | 939 | [
30522,
1013,
1013,
2079,
2025,
10086,
2023,
5371,
1011,
2009,
2003,
3698,
7013,
1011,
1008,
1011,
1039,
1009,
1009,
1011,
1008,
1011,
1001,
2065,
13629,
2546,
1035,
1035,
27004,
1035,
20950,
1035,
27354,
1035,
9483,
3070,
1035,
6970,
19738,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 AssimpSceneLoader_H
#define AssimpSceneLoader_H
#include <string>
#include <assimp/scene.h>
#include <assimp/postprocess.h>
#include <assimp/Importer.hpp>
#include "Common/Singleton.h"
#include "Mesh/Mesh.h"
#include "Shader/ShaderProgram.h"
#include "Scene/Material.h"
using std::string;
class AssimpSceneLoader : public Singleton<AssimpSceneLoader>
{
public:
vector<Mesh*> meshes;
const aiScene* assimpScene;
vector<Material*> materials;
AssimpSceneLoader();
void load(string file);
Mesh * initMesh(aiMesh * assMesh);
void initNode(aiNode * parent);
void printColor(const string &name, const aiColor4D & color);
};
#endif // AssimpSceneLoader_H
| lubosz/liblub | src/Load/AssimpSceneLoader.h | C | gpl-3.0 | 694 | [
30522,
1001,
2065,
13629,
2546,
4632,
5714,
4523,
17968,
11066,
2121,
1035,
1044,
1001,
9375,
4632,
5714,
4523,
17968,
11066,
2121,
1035,
1044,
1001,
2421,
1026,
5164,
1028,
1001,
2421,
1026,
4632,
5714,
2361,
1013,
3496,
1012,
1044,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_74) on Mon Jan 02 20:06:46 EET 2017 -->
<title>Uses of Class com.complet.DatabaseConnection</title>
<meta name="date" content="2017-01-02">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class com.complet.DatabaseConnection";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../com/complet/package-summary.html">Package</a></li>
<li><a href="../../../com/complet/DatabaseConnection.html" title="class in com.complet">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?com/complet/class-use/DatabaseConnection.html" target="_top">Frames</a></li>
<li><a href="DatabaseConnection.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class com.complet.DatabaseConnection" class="title">Uses of Class<br>com.complet.DatabaseConnection</h2>
</div>
<div class="classUseContainer">No usage of com.complet.DatabaseConnection</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../com/complet/package-summary.html">Package</a></li>
<li><a href="../../../com/complet/DatabaseConnection.html" title="class in com.complet">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?com/complet/class-use/DatabaseConnection.html" target="_top">Frames</a></li>
<li><a href="DatabaseConnection.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| milouk/Web_Crawler | doc/com/complet/class-use/DatabaseConnection.html | HTML | apache-2.0 | 4,246 | [
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... |
#include <algorithm>
#include "GI/uvmapper.h"
UVMapper::UVMapper( glm::ivec2 size) :
m_size(size),
m_scale(0.f),
m_border(glm::vec2(1.)/glm::vec2(size))
{}
UVMapper::~UVMapper()
{}
void UVMapper::computeLightmapPack(std::vector<Object*> &obj)
{
m_obj = obj;
std::vector<Quadrilateral> m_quad;
//UV Planar projection
for(unsigned o=0; o<m_obj.size(); o++)
{
glm::vec3 *vertex = m_obj[o]->getVertex();
glm::vec2 *uv = m_obj[o]->getTexCoordsLightmap();
for(unsigned i=0; i<m_obj[o]->getNbFaces(); i++)
{
glm::vec3 pn = glm::abs( m_obj[o]->getNormalsFaces()[i]);
if( pn.x > pn.y && pn.x > pn.z) //Plane X
{
for(int j=0; j<4; j++)
{
uv[i*4+j].x = vertex[i*4+j].y;
uv[i*4+j].y = vertex[i*4+j].z;
}
}
else if( pn.y > pn.x && pn.y > pn.z) //Plane Y
{
for(int j=0; j<4; j++)
{
uv[i*4+j].x = vertex[i*4+j].x;
uv[i*4+j].y = vertex[i*4+j].z;
}
}
else //Plane Z
{
for(int j=0; j<4; j++)
{
uv[i*4+j].x = vertex[i*4+j].y;
uv[i*4+j].y = vertex[i*4+j].x;
}
}
//Normalize to 0 .. X & store the edges
glm::vec2 min=uv[i*4],max=uv[i*4];
for(int j=1; j<4; j++)
{
min = glm::min( min, uv[i*4+j]);
max = glm::max( max, uv[i*4+j]);
}
Quadrilateral q;
q.edge = max-min;
q.p1 = &uv[i*4+0]; q.p2 = &uv[i*4+1]; q.p3 = &uv[i*4+2], q.p4 = &uv[i*4+3];
m_quad.push_back( q );
//Because TRIGONOMETRIC ORDER... =)
uv[i*4+0] = glm::vec2(0.f);
uv[i*4+1] = glm::vec2(q.edge.x,0.f);
uv[i*4+2] = q.edge;
uv[i*4+3] = glm::vec2(0.f,q.edge.y);
}
}
//Compute areaMax
m_scale = 0.f;
for(unsigned i=0; i<m_quad.size(); i++)
m_scale += m_quad[i].getArea();
m_scale = sqrt(m_scale)*1.35;
//Normalize to fit to texture
for(unsigned i = 0; i < m_quad.size(); ++i)
m_quad[i].edge /= m_scale;
for(unsigned i=0; i<m_obj.size(); i++)
for(unsigned j=0; j<m_obj[i]->getNbVertex(); j++)
m_obj[i]->getTexCoordsLightmap()[j] /= m_scale;
//Sort by area
std::sort(m_quad.begin(), m_quad.end());
//Recursive packing
Node root;
for(unsigned i = 0; i < m_quad.size(); ++i)
{
if( insert(&root,m_quad[i]) == NULL)
{
std::cout << m_quad[i].edge.x << " | " << m_quad[i].edge.y << std::endl;
std::cout << "UV MAP PROBLEM" << std::endl;
}
}
}
Node* UVMapper::insert(Node *n, Quadrilateral &q)
{
//If this node have children, we try to recursively insert into them
if(n->child[0] && n->child[1])
{
Node *c = insert(n->child[0],q);
return c ? c : insert(n->child[1],q);
}
else
{
//Can this rectangle be packed into this node ?
if( q.edge.x > n->rect.z || q.edge.y > n->rect.w)
{
return NULL;
}
//Does this rectangle have exactly the same size as this node ?
if( q.edge.x == n->rect.z && q.edge.y == n->rect.w)
{
glm::vec2 offset(n->rect.x, n->rect.y);
*(q.p1) += offset;
*(q.p2) += offset;
*(q.p3) += offset;
*(q.p4) += offset;
return n;
}
n->child[0] = new Node();
n->child[1] = new Node();
//Decide which way to split
float dw = n->rect.z - q.edge.x;
float dh = n->rect.w - q.edge.y;
if( dw < dh)
{
n->child[0]->rect = glm::vec4(n->rect.x+q.edge.x, n->rect.y, n->rect.z-q.edge.x, q.edge.y);
n->child[1]->rect = glm::vec4(n->rect.x, n->rect.y+q.edge.y, n->rect.z, n->rect.w-q.edge.y);
n->child[0]->rect += glm::vec4(m_border.x,0.f,-m_border.x,0.f);
n->child[1]->rect += glm::vec4(0.f,m_border.y,0.f,-m_border.y);
}
else
{
n->child[0]->rect = glm::vec4(n->rect.x, n->rect.y+q.edge.y, q.edge.x, n->rect.w-q.edge.y);
n->child[1]->rect = glm::vec4(n->rect.x+q.edge.x, n->rect.y, n->rect.z-q.edge.x, n->rect.w);
n->child[0]->rect += glm::vec4(0.f,m_border.y,0.f,-m_border.y);
n->child[1]->rect += glm::vec4(m_border.x,0.f,-m_border.x,0.f);
}
//Update the uv of the rectangle
glm::vec2 offset(n->rect.x, n->rect.y);
q.offset = offset;
*(q.p1) += offset;
*(q.p2) += offset;
*(q.p3) += offset;
*(q.p4) += offset;
return n;
}
}
| XT95/PBGI | src/GI/uvmapper.cpp | C++ | mit | 4,909 | [
30522,
1001,
2421,
1026,
9896,
1028,
1001,
2421,
1000,
21025,
1013,
23068,
2863,
18620,
1012,
1044,
1000,
23068,
2863,
18620,
1024,
1024,
23068,
2863,
18620,
1006,
1043,
13728,
1024,
1024,
4921,
8586,
2475,
2946,
1007,
1024,
1049,
1035,
294... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
//
// XQQVoicePlayAnimationTool.h
// XQQChatProj
//
// Created by XQQ on 2016/11/25.
// Copyright © 2016年 UIP. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "XQQChatBtn.h"
@interface XQQVoicePlayAnimationTool : NSObject
+ (instancetype)sharedTool;
/*开始动画*/
- (void)startAnimationWithBtn:(XQQChatBtn*)button
isMine:(BOOL)isMine;
/*停止动画*/
- (void)endAnimation;
@end
| xiaogehenjimo/XQQDemo | XQQChatProj/XQQChatProj/Classes/Chat/View/animationView/XQQVoicePlayAnimationTool.h | C | apache-2.0 | 422 | [
30522,
1013,
1013,
1013,
1013,
1060,
4160,
4160,
6767,
6610,
13068,
7088,
28649,
3406,
4747,
1012,
1044,
1013,
1013,
1060,
4160,
4160,
7507,
25856,
3217,
3501,
1013,
1013,
1013,
1013,
2580,
2011,
1060,
4160,
4160,
2006,
2355,
1013,
2340,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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("umbraco")
.controller("Umbraco.PropertyEditors.RTEController",
function ($rootScope, $scope, $q, $locale, dialogService, $log, imageHelper, assetsService, $timeout, tinyMceService, angularHelper, stylesheetResource, macroService, editorState) {
$scope.isLoading = true;
//To id the html textarea we need to use the datetime ticks because we can have multiple rte's per a single property alias
// because now we have to support having 2x (maybe more at some stage) content editors being displayed at once. This is because
// we have this mini content editor panel that can be launched with MNTP.
var d = new Date();
var n = d.getTime();
$scope.textAreaHtmlId = $scope.model.alias + "_" + n + "_rte";
function syncContent(editor){
editor.save();
angularHelper.safeApply($scope, function () {
$scope.model.value = editor.getContent();
});
//make the form dirty manually so that the track changes works, setting our model doesn't trigger
// the angular bits because tinymce replaces the textarea.
angularHelper.getCurrentForm($scope).$setDirty();
}
tinyMceService.configuration().then(function (tinyMceConfig) {
//config value from general tinymce.config file
var validElements = tinyMceConfig.validElements;
//These are absolutely required in order for the macros to render inline
//we put these as extended elements because they get merged on top of the normal allowed elements by tiny mce
var extendedValidElements = "@[id|class|style],-div[id|dir|class|align|style],ins[datetime|cite],-ul[class|style],-li[class|style],span[id|class|style]";
var invalidElements = tinyMceConfig.inValidElements;
var plugins = _.map(tinyMceConfig.plugins, function (plugin) {
if (plugin.useOnFrontend) {
return plugin.name;
}
}).join(" ");
var editorConfig = $scope.model.config.editor;
if (!editorConfig || angular.isString(editorConfig)) {
editorConfig = tinyMceService.defaultPrevalues();
}
//config value on the data type
var toolbar = editorConfig.toolbar.join(" | ");
var stylesheets = [];
var styleFormats = [];
var await = [];
if (!editorConfig.maxImageSize && editorConfig.maxImageSize != 0) {
editorConfig.maxImageSize = tinyMceService.defaultPrevalues().maxImageSize;
}
//queue file loading
if (typeof tinymce === "undefined") { // Don't reload tinymce if already loaded
await.push(assetsService.loadJs("lib/tinymce/tinymce.min.js", $scope));
}
//queue rules loading
angular.forEach(editorConfig.stylesheets, function (val, key) {
stylesheets.push(Umbraco.Sys.ServerVariables.umbracoSettings.cssPath + "/" + val + ".css?" + new Date().getTime());
await.push(stylesheetResource.getRulesByName(val).then(function (rules) {
angular.forEach(rules, function (rule) {
var r = {};
r.title = rule.name;
if (rule.selector[0] == ".") {
r.inline = "span";
r.classes = rule.selector.substring(1);
}
else if (rule.selector[0] == "#") {
r.inline = "span";
r.attributes = { id: rule.selector.substring(1) };
}
else if (rule.selector[0] != "." && rule.selector.indexOf(".") > -1) {
var split = rule.selector.split(".");
r.block = split[0];
r.classes = rule.selector.substring(rule.selector.indexOf(".") + 1).replace(".", " ");
}
else if (rule.selector[0] != "#" && rule.selector.indexOf("#") > -1) {
var split = rule.selector.split("#");
r.block = split[0];
r.classes = rule.selector.substring(rule.selector.indexOf("#") + 1);
}
else {
r.block = rule.selector;
}
styleFormats.push(r);
});
}));
});
//stores a reference to the editor
var tinyMceEditor = null;
// these languages are available for localization
var availableLanguages = [
'da',
'de',
'en',
'en_us',
'fi',
'fr',
'he',
'it',
'ja',
'nl',
'no',
'pl',
'pt',
'ru',
'sv',
'zh'
];
//define fallback language
var language = 'en_us';
//get locale from angular and match tinymce format. Angular localization is always in the format of ru-ru, de-de, en-gb, etc.
//wheras tinymce is in the format of ru, de, en, en_us, etc.
var localeId = $locale.id.replace('-', '_');
//try matching the language using full locale format
var languageMatch = _.find(availableLanguages, function(o) { return o === localeId; });
//if no matches, try matching using only the language
if (languageMatch === undefined) {
var localeParts = localeId.split('_');
languageMatch = _.find(availableLanguages, function(o) { return o === localeParts[0]; });
}
//if a match was found - set the language
if (languageMatch !== undefined) {
language = languageMatch;
}
//wait for queue to end
$q.all(await).then(function () {
//create a baseline Config to exten upon
var baseLineConfigObj = {
mode: "exact",
skin: "umbraco",
plugins: plugins,
valid_elements: validElements,
invalid_elements: invalidElements,
extended_valid_elements: extendedValidElements,
menubar: false,
statusbar: false,
relative_urls: false,
height: editorConfig.dimensions.height,
width: editorConfig.dimensions.width,
maxImageSize: editorConfig.maxImageSize,
toolbar: toolbar,
content_css: stylesheets,
style_formats: styleFormats,
language: language,
//see http://archive.tinymce.com/wiki.php/Configuration:cache_suffix
cache_suffix: "?umb__rnd=" + Umbraco.Sys.ServerVariables.application.cacheBuster
};
if (tinyMceConfig.customConfig) {
//if there is some custom config, we need to see if the string value of each item might actually be json and if so, we need to
// convert it to json instead of having it as a string since this is what tinymce requires
for (var i in tinyMceConfig.customConfig) {
var val = tinyMceConfig.customConfig[i];
if (val) {
val = val.toString().trim();
if (val.detectIsJson()) {
try {
tinyMceConfig.customConfig[i] = JSON.parse(val);
//now we need to check if this custom config key is defined in our baseline, if it is we don't want to
//overwrite the baseline config item if it is an array, we want to concat the items in the array, otherwise
//if it's an object it will overwrite the baseline
if (angular.isArray(baseLineConfigObj[i]) && angular.isArray(tinyMceConfig.customConfig[i])) {
//concat it and below this concat'd array will overwrite the baseline in angular.extend
tinyMceConfig.customConfig[i] = baseLineConfigObj[i].concat(tinyMceConfig.customConfig[i]);
}
}
catch (e) {
//cannot parse, we'll just leave it
}
}
if (val === "true") {
tinyMceConfig.customConfig[i] = true;
}
if (val === "false") {
tinyMceConfig.customConfig[i] = false;
}
}
}
angular.extend(baseLineConfigObj, tinyMceConfig.customConfig);
}
//set all the things that user configs should not be able to override
baseLineConfigObj.elements = $scope.textAreaHtmlId; //this is the exact textarea id to replace!
baseLineConfigObj.setup = function (editor) {
//set the reference
tinyMceEditor = editor;
//enable browser based spell checking
editor.on('init', function (e) {
editor.getBody().setAttribute('spellcheck', true);
});
//We need to listen on multiple things here because of the nature of tinymce, it doesn't
//fire events when you think!
//The change event doesn't fire when content changes, only when cursor points are changed and undo points
//are created. the blur event doesn't fire if you insert content into the editor with a button and then
//press save.
//We have a couple of options, one is to do a set timeout and check for isDirty on the editor, or we can
//listen to both change and blur and also on our own 'saving' event. I think this will be best because a
//timer might end up using unwanted cpu and we'd still have to listen to our saving event in case they clicked
//save before the timeout elapsed.
//TODO: We need to re-enable something like this to ensure the track changes is working with tinymce
// so we can detect if the form is dirty or not, Per has some better events to use as this one triggers
// even if you just enter/exit with mouse cursuor which doesn't really mean it's changed.
// see: http://issues.umbraco.org/issue/U4-4485
//var alreadyDirty = false;
//editor.on('change', function (e) {
// angularHelper.safeApply($scope, function () {
// $scope.model.value = editor.getContent();
// if (!alreadyDirty) {
// //make the form dirty manually so that the track changes works, setting our model doesn't trigger
// // the angular bits because tinymce replaces the textarea.
// var currForm = angularHelper.getCurrentForm($scope);
// currForm.$setDirty();
// alreadyDirty = true;
// }
// });
//});
//when we leave the editor (maybe)
editor.on('blur', function (e) {
editor.save();
angularHelper.safeApply($scope, function () {
$scope.model.value = editor.getContent();
});
});
//when buttons modify content
editor.on('ExecCommand', function (e) {
syncContent(editor);
});
// Update model on keypress
editor.on('KeyUp', function (e) {
syncContent(editor);
});
// Update model on change, i.e. copy/pasted text, plugins altering content
editor.on('SetContent', function (e) {
if (!e.initial) {
syncContent(editor);
}
});
editor.on('ObjectResized', function (e) {
var qs = "?width=" + e.width + "&height=" + e.height + "&mode=max";
var srcAttr = $(e.target).attr("src");
var path = srcAttr.split("?")[0];
$(e.target).attr("data-mce-src", path + qs);
syncContent(editor);
});
tinyMceService.createLinkPicker(editor, $scope, function(currentTarget, anchorElement) {
$scope.linkPickerOverlay = {
view: "linkpicker",
currentTarget: currentTarget,
anchors: editorState.current ? tinyMceService.getAnchorNames(JSON.stringify(editorState.current.properties)) : [],
ignoreUserStartNodes: $scope.model.config.ignoreUserStartNodes === "1",
show: true,
submit: function(model) {
tinyMceService.insertLinkInEditor(editor, model.target, anchorElement);
$scope.linkPickerOverlay.show = false;
$scope.linkPickerOverlay = null;
}
};
});
//Create the insert media plugin
tinyMceService.createMediaPicker(editor, $scope, function(currentTarget, userData){
var ignoreUserStartNodes = false;
var startNodeId = userData.startMediaIds.length !== 1 ? -1 : userData.startMediaIds[0];
var startNodeIsVirtual = userData.startMediaIds.length !== 1;
if ($scope.model.config.ignoreUserStartNodes === "1") {
ignoreUserStartNodes = true;
startNodeId = -1;
startNodeIsVirtual = true;
}
$scope.mediaPickerOverlay = {
currentTarget: currentTarget,
onlyImages: true,
showDetails: true,
disableFolderSelect: true,
startNodeId: startNodeId,
startNodeIsVirtual: startNodeIsVirtual,
ignoreUserStartNodes: ignoreUserStartNodes,
view: "mediapicker",
show: true,
submit: function(model) {
tinyMceService.insertMediaInEditor(editor, model.selectedImages[0]);
$scope.mediaPickerOverlay.show = false;
$scope.mediaPickerOverlay = null;
}
};
});
//Create the embedded plugin
tinyMceService.createInsertEmbeddedMedia(editor, $scope, function() {
$scope.embedOverlay = {
view: "embed",
show: true,
submit: function(model) {
tinyMceService.insertEmbeddedMediaInEditor(editor, model.embed.preview);
$scope.embedOverlay.show = false;
$scope.embedOverlay = null;
}
};
});
//Create the insert macro plugin
tinyMceService.createInsertMacro(editor, $scope, function(dialogData) {
$scope.macroPickerOverlay = {
view: "macropicker",
dialogData: dialogData,
show: true,
submit: function(model) {
var macroObject = macroService.collectValueData(model.selectedMacro, model.macroParams, dialogData.renderingEngine);
tinyMceService.insertMacroInEditor(editor, macroObject, $scope);
$scope.macroPickerOverlay.show = false;
$scope.macroPickerOverlay = null;
}
};
});
};
/** Loads in the editor */
function loadTinyMce() {
//we need to add a timeout here, to force a redraw so TinyMCE can find
//the elements needed
$timeout(function () {
tinymce.DOM.events.domLoaded = true;
tinymce.init(baseLineConfigObj);
$scope.isLoading = false;
}, 200, false);
}
loadTinyMce();
//here we declare a special method which will be called whenever the value has changed from the server
//this is instead of doing a watch on the model.value = faster
$scope.model.onValueChanged = function (newVal, oldVal) {
//update the display val again if it has changed from the server;
//uses an empty string in the editor when the value is null
tinyMceEditor.setContent(newVal || "", { format: 'raw' });
//we need to manually fire this event since it is only ever fired based on loading from the DOM, this
// is required for our plugins listening to this event to execute
tinyMceEditor.fire('LoadContent', null);
};
//listen for formSubmitting event (the result is callback used to remove the event subscription)
var unsubscribe = $scope.$on("formSubmitting", function () {
//TODO: Here we should parse out the macro rendered content so we can save on a lot of bytes in data xfer
// we do parse it out on the server side but would be nice to do that on the client side before as well.
if (tinyMceEditor !== undefined && tinyMceEditor != null && !$scope.isLoading) {
$scope.model.value = tinyMceEditor.getContent();
}
});
//when the element is disposed we need to unsubscribe!
// NOTE: this is very important otherwise if this is part of a modal, the listener still exists because the dom
// element might still be there even after the modal has been hidden.
$scope.$on('$destroy', function () {
unsubscribe();
if (tinyMceEditor !== undefined && tinyMceEditor != null) {
tinyMceEditor.destroy();
}
});
});
});
});
| tompipe/Umbraco-CMS | src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.controller.js | JavaScript | mit | 20,615 | [
30522,
16108,
1012,
11336,
1006,
1000,
8529,
10024,
3597,
1000,
1007,
1012,
11486,
1006,
1000,
8529,
10024,
3597,
1012,
3200,
2098,
27287,
1012,
20375,
8663,
13181,
10820,
1000,
1010,
3853,
1006,
1002,
6147,
16186,
1010,
1002,
9531,
1010,
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... |
--
-- Copyright 2009 The Kuali Foundation
--
-- Licensed under the Educational Community License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.opensource.org/licenses/ecl2.php
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
-- Create role "r1" with members "p1" and "g2"
INSERT INTO KRIM_ROLE_T (ACTV_IND,KIM_TYP_ID,NMSPC_CD,OBJ_ID,ROLE_ID,ROLE_NM,VER_NBR, DESC_TXT)
VALUES ('Y','1','AUTH_SVC_TEST1','ea9ed94a-7e6b-102c-97b6-ed716fdaf540','r1','RoleOne',1, 'Role 1 Description')
/
INSERT INTO KRIM_ROLE_MBR_T (MBR_ID,MBR_TYP_CD,OBJ_ID,ROLE_ID,ROLE_MBR_ID,VER_NBR)
VALUES ('p1','P','7e2ced96-7e6c-102c-97b6-ed716fdaf540','r1','r1p1',1)
/
INSERT INTO KRIM_ROLE_MBR_T (MBR_ID,MBR_TYP_CD,OBJ_ID,ROLE_ID,ROLE_MBR_ID,VER_NBR)
VALUES ('entity123pId','P','88EBA5DF-F5B8-4089-8F5F-E9BAD615BF61','r1','r1entity123pId',1)
/
INSERT INTO KRIM_ROLE_MBR_T (MBR_ID,MBR_TYP_CD,OBJ_ID,ROLE_ID,ROLE_MBR_ID,VER_NBR)
VALUES ('entity123pId','P','FEF9B38A-E396-4D67-93A3-372D4C55DEA4','1','1entity123pId',1)
/
-- Create role "r2" with members "p3", "g1", "r1"
INSERT INTO KRIM_ROLE_T (ACTV_IND,KIM_TYP_ID,NMSPC_CD,OBJ_ID,ROLE_ID,ROLE_NM,VER_NBR, DESC_TXT)
VALUES ('Y','1','AUTH_SVC_TEST2','6afda2ba-7e71-102c-97b6-ed716fdaf540','r2','RoleTwo',1, 'Role 2 Description')
/
INSERT INTO KRIM_ROLE_MBR_T (MBR_ID,MBR_TYP_CD,OBJ_ID,ROLE_ID,ROLE_MBR_ID,VER_NBR)
VALUES ('p3','P','b6a044fc-7e6c-102c-97b6-ed716fdaf540','r2','r2p3',1)
/
INSERT INTO KRIM_ROLE_MBR_T (MBR_ID,MBR_TYP_CD,OBJ_ID,ROLE_ID,ROLE_MBR_ID,VER_NBR)
VALUES ('g1','G','d922e502-7e6c-102c-97b6-ed716fdaf540','r2','r2g1',1)
/
INSERT INTO KRIM_ROLE_MBR_T (MBR_ID,MBR_TYP_CD,OBJ_ID,ROLE_ID,ROLE_MBR_ID,VER_NBR)
VALUES ('r1','R','d9ab94d8-7e6c-102c-97b6-ed716fdaf540','r2','r2r1',1)
/
-- Create role "r3" with member "p5"
INSERT INTO KRIM_ROLE_T (ACTV_IND,KIM_TYP_ID,NMSPC_CD,OBJ_ID,ROLE_ID,ROLE_NM,VER_NBR, DESC_TXT)
VALUES ('Y','1','AUTH_SVC_TEST2','6afda2ba-7e71-102c-97b6-ed716fdaf541','r3','RoleThree',1, 'Role 3 Description')
/
INSERT INTO KRIM_ROLE_MBR_T (MBR_ID,MBR_TYP_CD,OBJ_ID,ROLE_ID,ROLE_MBR_ID,VER_NBR)
VALUES ('p5','P','b6a044fc-7e6c-102c-97b6-ed716fdaf541','r3','r3p5',1)
/
-- Create role "r4" with members "p10", "g5"
INSERT INTO KRIM_ROLE_T (ACTV_IND,KIM_TYP_ID,NMSPC_CD,OBJ_ID,ROLE_ID,ROLE_NM,VER_NBR, DESC_TXT)
VALUES ('Y','1','AUTH_SVC_TEST2','6afda2ba-7e71-102c-97b6-ed716fdaf542','r4','RoleFour',1, 'Role 4 Description')
/
INSERT INTO KRIM_ROLE_MBR_T (MBR_ID,MBR_TYP_CD,OBJ_ID,ROLE_ID,ROLE_MBR_ID,VER_NBR)
VALUES ('p10','P','b6a044fc-7e6c-102c-97b6-ed716fdaf542','r4','r4p10',1)
/
INSERT INTO KRIM_ROLE_MBR_T (MBR_ID,MBR_TYP_CD,OBJ_ID,ROLE_ID,ROLE_MBR_ID,VER_NBR)
VALUES ('g5','G','d922e502-7e6c-102c-97b6-ed716fdaf542','r4','r4g5',1)
/
-- Create role "r5" with members "p6", "g6", "r3"
INSERT INTO KRIM_ROLE_T (ACTV_IND,KIM_TYP_ID,NMSPC_CD,OBJ_ID,ROLE_ID,ROLE_NM,VER_NBR, DESC_TXT)
VALUES ('Y','1','AUTH_SVC_TEST2','6afda2ba-7e71-102c-97b6-ed716fdaf543','r5','RoleFive',1, 'Role 5 Description')
/
INSERT INTO KRIM_ROLE_MBR_T (MBR_ID,MBR_TYP_CD,OBJ_ID,ROLE_ID,ROLE_MBR_ID,VER_NBR)
VALUES ('p6','P','b6a044fc-7e6c-102c-97b6-ed716fdaf543','r5','r5p6',1)
/
INSERT INTO KRIM_ROLE_MBR_T (MBR_ID,MBR_TYP_CD,OBJ_ID,ROLE_ID,ROLE_MBR_ID,VER_NBR)
VALUES ('g6','G','d922e502-7e6c-102c-97b6-ed716fdaf543','r5','r5g6',1)
/
INSERT INTO KRIM_ROLE_MBR_T (MBR_ID,MBR_TYP_CD,OBJ_ID,ROLE_ID,ROLE_MBR_ID,VER_NBR)
VALUES ('r3','R','d9ab94d8-7e6c-102c-97b6-ed716fdaf543','r5','r5r3',1)
/
-- Create role "r6" with members "p9", "r4"
INSERT INTO KRIM_ROLE_T (ACTV_IND,KIM_TYP_ID,NMSPC_CD,OBJ_ID,ROLE_ID,ROLE_NM,VER_NBR, DESC_TXT)
VALUES ('Y','1','AUTH_SVC_TEST2','6afda2ba-7e71-102c-97b6-ed716fdaf544','r6','RoleSix',1, 'Role 6 Description')
/
INSERT INTO KRIM_ROLE_MBR_T (MBR_ID,MBR_TYP_CD,OBJ_ID,ROLE_ID,ROLE_MBR_ID,VER_NBR)
VALUES ('p9','P','b6a044fc-7e6c-102c-97b6-ed716fdaf544','r6','r6p9',1)
/
INSERT INTO KRIM_ROLE_MBR_T (MBR_ID,MBR_TYP_CD,OBJ_ID,ROLE_ID,ROLE_MBR_ID,VER_NBR)
VALUES ('r4','R','d9ab94d8-7e6c-102c-97b6-ed716fdaf544','r6','r6r4',1)
/
-- Create delegation "d1" with members "p7", "r4"
INSERT INTO KRIM_DLGN_T (DLGN_ID,VER_NBR,OBJ_ID,ROLE_ID,ACTV_IND,KIM_TYP_ID,DLGN_TYP_CD)
VALUES ('d1',1,'6afda2ba-7e71-102c-97b6-ed716fdaf545','r5','Y','1','P')
/
INSERT INTO KRIM_DLGN_MBR_T (DLGN_MBR_ID,VER_NBR,OBJ_ID,DLGN_ID,MBR_ID,MBR_TYP_CD,ROLE_MBR_ID)
VALUES ('d1p7',1,'b6a044fc-7e6c-102c-97b6-ed716fdaf545','d1','p7','P','r5p6')
/
INSERT INTO KRIM_DLGN_MBR_T (DLGN_MBR_ID,VER_NBR,OBJ_ID,DLGN_ID,MBR_ID,MBR_TYP_CD,ROLE_MBR_ID)
VALUES ('d1r4',1,'d9ab94d8-7e6c-102c-97b6-ed716fdaf545','d1','r4','R','r5r3')
/
-- Create delegation "d2" with member "g7"
INSERT INTO KRIM_DLGN_T (DLGN_ID,VER_NBR,OBJ_ID,ROLE_ID,ACTV_IND,KIM_TYP_ID,DLGN_TYP_CD)
VALUES ('d2',1,'6afda2ba-7e71-102c-97b6-ed716fdaf546','r5','Y','1','S')
/
INSERT INTO KRIM_DLGN_MBR_T (DLGN_MBR_ID,VER_NBR,OBJ_ID,DLGN_ID,MBR_ID,MBR_TYP_CD,ROLE_MBR_ID)
VALUES ('d2g7',1,'d922e502-7e6c-102c-97b6-ed716fdaf546','d2','g7','G','r5g6')
/
-- create permissions
INSERT INTO KRIM_PERM_T (ACTV_IND,NMSPC_CD,OBJ_ID,PERM_ID,NM,PERM_TMPL_ID,VER_NBR)
VALUES ('Y','KR-NS','96394208-7e6d-102c-97b6-ed716fdaf540','p1','perm1','1',1)
/
INSERT INTO KRIM_PERM_T (ACTV_IND,NMSPC_CD,OBJ_ID,PERM_ID,NM,PERM_TMPL_ID,VER_NBR)
VALUES ('Y','KR-NS','6c42db88-7e6f-102c-97b6-ed716fdaf540','p2','perm2','1',1)
/
INSERT INTO KRIM_PERM_T (ACTV_IND,NMSPC_CD,OBJ_ID,PERM_ID,NM,PERM_TMPL_ID,VER_NBR)
VALUES ('Y','KR-NS','6cb942b4-7e6f-102c-97b6-ed716fdaf540','p3','perm3','1',1)
/
-- create permission templates
-- INSERT INTO KRIM_PERM_TMPL_T (PERM_TMPL_ID, OBJ_ID, VER_NBR, NMSPC_CD, NM, DESC_TXT, KIM_TYP_ID, ACTV_IND)
-- VALUES('1', '0D4CC939-73EA-4294-A9CE-2A867AEED8B9', 1, 'KR-NS', 'Edit Document', 'Document Editing Permission Template', '8', 'Y')
-- /
-- assign permissions to roles
-- p1 -> r1
-- p2 -> r1
-- p3 -> r2
-- p1 -> r3
-- p2 -> r4
-- p3 -> r5
-- p1 -> r6
INSERT INTO KRIM_ROLE_PERM_T (ACTV_IND,OBJ_ID,PERM_ID,ROLE_ID,ROLE_PERM_ID,VER_NBR)
VALUES ('Y','fa02d546-7e6e-102c-97b6-ed716fdaf540','p1','r1','r1p1',1)
/
INSERT INTO KRIM_ROLE_PERM_T (ACTV_IND,OBJ_ID,PERM_ID,ROLE_ID,ROLE_PERM_ID,VER_NBR)
VALUES ('Y','4102a53e-7e6f-102c-97b6-ed716fdaf540','p2','r1','r1p2',1)
/
INSERT INTO KRIM_ROLE_PERM_T (ACTV_IND,OBJ_ID,PERM_ID,ROLE_ID,ROLE_PERM_ID,VER_NBR)
VALUES ('Y','415e3cb4-7e6f-102c-97b6-ed716fdaf540','p3','r2','r2p3',1)
/
INSERT INTO KRIM_ROLE_PERM_T (ACTV_IND,OBJ_ID,PERM_ID,ROLE_ID,ROLE_PERM_ID,VER_NBR)
VALUES ('Y','fa02d546-7e6e-102c-97b6-ed716fdaf541','p1','r3','r3p1',1)
/
INSERT INTO KRIM_ROLE_PERM_T (ACTV_IND,OBJ_ID,PERM_ID,ROLE_ID,ROLE_PERM_ID,VER_NBR)
VALUES ('Y','4102a53e-7e6f-102c-97b6-ed716fdaf541','p2','r4','r4p2',1)
/
INSERT INTO KRIM_ROLE_PERM_T (ACTV_IND,OBJ_ID,PERM_ID,ROLE_ID,ROLE_PERM_ID,VER_NBR)
VALUES ('Y','415e3cb4-7e6f-102c-97b6-ed716fdaf541','p3','r5','r5p3',1)
/
INSERT INTO KRIM_ROLE_PERM_T (ACTV_IND,OBJ_ID,PERM_ID,ROLE_ID,ROLE_PERM_ID,VER_NBR)
VALUES ('Y','fa02d546-7e6e-102c-97b6-ed716fdaf542','p1','r6','r6p1',1)
/
INSERT INTO krim_perm_t(PERM_ID, OBJ_ID, VER_NBR, PERM_TMPL_ID, NMSPC_CD, NM, DESC_TXT, ACTV_IND)
VALUES('307', '638DD46953F9BCD5E0404F8189D86240', 1, '1', 'KR-IDM', 'Modify Entity', 'Users who can modify entity records in Kuali Identity Management.', 'Y')
/
INSERT INTO krim_role_perm_t(ROLE_PERM_ID, OBJ_ID, VER_NBR, ROLE_ID, PERM_ID, ACTV_IND)
VALUES('850', '70086A2DF17C62E4E0404F8189D863CD', 1, '63', '307', 'Y')
/
-- create some entities for the UIDocumentServiceImplTest
INSERT INTO KRIM_ENTITY_T (ACTV_IND,ENTITY_ID,OBJ_ID,VER_NBR)
VALUES ('Y','entity123eId','31ba4224-7ea3-102c-97b6-ed716fdaf540',1)
/
INSERT INTO KRIM_ENTITY_ENT_TYP_T (ACTV_IND,ENTITY_ID,ENT_TYP_CD,OBJ_ID,VER_NBR)
VALUES ('Y','entity123eId','PERSON','a8d21c86-7eaf-102c-97b6-ed716fdaf540',1)
/
INSERT INTO KRIM_ENTITY_EXT_ID_T (ENTITY_EXT_ID_ID, ENTITY_ID, EXT_ID_TYP_CD, EXT_ID, OBJ_ID)
VALUES ('entity123extId', 'entity123eId', 'SSN', '555-55-5555', '31ba4238-7ea3-102c-97b6-ed716fdaf540')
/
INSERT INTO KRIM_ENTITY_ADDR_T (ENTITY_ADDR_ID, OBJ_ID, ENTITY_ID, ENT_TYP_CD, ADDR_TYP_CD, ADDR_LINE_1, CITY,
STATE_PVC_CD, POSTAL_CD, POSTAL_CNTRY_CD, DFLT_IND)
VALUES ('entity123addrId', '31ba4238-7ea3-102c-97b6-ed716fdaf540', 'entity123eId', 'PERSON', 'HM', '123 Easy Street', 'Bloomington', 'IN', '47403', 'US', 'Y')
/
INSERT INTO KRIM_ENTITY_PHONE_T (ENTITY_PHONE_ID, OBJ_ID, ENTITY_ID, ENT_TYP_CD, PHONE_TYP_CD, PHONE_NBR, POSTAL_CNTRY_CD, DFLT_IND)
VALUES ('entity123phoneId', '31ba424c-7ea3-102c-97b6-ed716fdaf540', 'entity123eId', 'PERSON', 'WRK', '555=555-5555', 'US', 'Y')
/
INSERT INTO KRIM_ENTITY_EMAIL_T (ACTV_IND,DFLT_IND,EMAIL_ADDR,EMAIL_TYP_CD,ENTITY_EMAIL_ID,ENTITY_ID,ENT_TYP_CD,OBJ_ID,VER_NBR)
VALUES ('Y','Y','entity123@localhost','WRK','entity123emailId','entity123eId','PERSON','39e42c30-7ea3-102c-97b6-ed716fdaf540',1)
/
INSERT INTO KRIM_ENTITY_NM_T (ACTV_IND,DFLT_IND,ENTITY_ID,ENTITY_NM_ID,FIRST_NM,LAST_NM,NM_TYP_CD,OBJ_ID,VER_NBR)
VALUES ('Y','Y','entity123eId','entity123nameId','Entity','123','PRFR','39e42c4e-7ea3-102c-97b6-ed716fdaf540',1)
/
INSERT INTO KRIM_ENTITY_AFLTN_T(ENTITY_AFLTN_ID, OBJ_ID, VER_NBR, ENTITY_ID, AFLTN_TYP_CD, CAMPUS_CD, DFLT_IND, ACTV_IND)
VALUES('entity123afltnId', '39e42c62-7ea3-102c-97b6-ed716fdaf540', 1, 'entity123eId', 'STAFF', 'IN', 'Y', 'Y')
/
INSERT INTO KRIM_ENTITY_EMP_INFO_T(ENTITY_EMP_ID, OBJ_ID, VER_NBR, ENTITY_ID, ENTITY_AFLTN_ID, EMP_STAT_CD, EMP_TYP_CD, BASE_SLRY_AMT, PRMRY_IND, ACTV_IND, PRMRY_DEPT_CD, EMP_ID, EMP_REC_ID)
VALUES('entity123empInfoId', '39e42c6c-7ea3-102c-97b6-ed716fdaf540', 1, 'entity123eId', 'entity123afltnId', 'A', 'N', 50000, 'Y', 'Y', 'IN-ENGT', '0000000001', NULL)
/
INSERT INTO KRIM_PRNCPL_T (ACTV_IND,ENTITY_ID,OBJ_ID,PRNCPL_ID,PRNCPL_NM,VER_NBR)
VALUES ('Y','entity123eId','31ba4210-7ea3-102c-97b6-ed716fdaf540','entity123pId','entity123',1)
/
INSERT INTO KRIM_ENTITY_T (ACTV_IND,ENTITY_ID,OBJ_ID,VER_NBR)
VALUES ('Y','entity124eId','7C93D6EA-9473-4D4B-B485-AAAFAB703A7B',1)
/
INSERT INTO KRIM_ENTITY_ENT_TYP_T (ACTV_IND,ENTITY_ID,ENT_TYP_CD,OBJ_ID,VER_NBR)
VALUES ('Y','entity124eId','PERSON','76D464BF-3702-4F7D-AFDC-2296D7ACD963',1)
/
INSERT INTO KRIM_ENTITY_EXT_ID_T (ENTITY_EXT_ID_ID, ENTITY_ID, EXT_ID_TYP_CD, EXT_ID, OBJ_ID)
VALUES ('entity124extId', 'entity124eId', 'RFID', '1234567', '3FD7129D-73FC-495A-882A-B608C355F22E')
/
INSERT INTO KRIM_ENTITY_ADDR_T (ENTITY_ADDR_ID, OBJ_ID, ENTITY_ID, ENT_TYP_CD, ADDR_TYP_CD, ADDR_LINE_1, CITY,
STATE_PVC_CD, POSTAL_CD, POSTAL_CNTRY_CD, DFLT_IND)
VALUES ('entity124addrId', '98536C34-B6D0-47AD-A00B-F95D5B8AA6C4', 'entity124eId', 'PERSON', 'HM', '124 Easy Street', 'Bloomington', 'IN', '47403', 'US', 'Y')
/
INSERT INTO KRIM_ENTITY_PHONE_T (ENTITY_PHONE_ID, OBJ_ID, ENTITY_ID, ENT_TYP_CD, PHONE_TYP_CD, PHONE_NBR, POSTAL_CNTRY_CD, DFLT_IND)
VALUES ('entity124phoneId', '8C1047D3-FB57-4539-BF16-78B3D5FEFB4F', 'entity124eId', 'PERSON', 'WRK', '555=555-5555', 'US', 'Y')
/
INSERT INTO KRIM_ENTITY_EMAIL_T (ACTV_IND,DFLT_IND,EMAIL_ADDR,EMAIL_TYP_CD,ENTITY_EMAIL_ID,ENTITY_ID,ENT_TYP_CD,OBJ_ID,VER_NBR)
VALUES ('Y','Y','entity124@localhost','WRK','entity124emailId','entity124eId','PERSON','442BD7D0-006F-48CB-AF9C-1292059C1ACD',1)
/
INSERT INTO KRIM_ENTITY_NM_T (ACTV_IND,DFLT_IND,ENTITY_ID,ENTITY_NM_ID,FIRST_NM,LAST_NM,NM_TYP_CD,OBJ_ID,VER_NBR)
VALUES ('Y','Y','entity124eId','entity124nameId','Entity','124','PRFR','DCDB7CAB-73ED-4EA2-9832-BCDC0650E854',1)
/
INSERT INTO KRIM_ENTITY_AFLTN_T(ENTITY_AFLTN_ID, OBJ_ID, VER_NBR, ENTITY_ID, AFLTN_TYP_CD, CAMPUS_CD, DFLT_IND, ACTV_IND)
VALUES('entity124afltnId', '86DD6DA9-8511-4F76-9DB6-52A71C03B009', 1, 'entity124eId', 'STAFF', 'IN', 'Y', 'Y')
/
INSERT INTO KRIM_ENTITY_EMP_INFO_T(ENTITY_EMP_ID, OBJ_ID, VER_NBR, ENTITY_ID, ENTITY_AFLTN_ID, EMP_STAT_CD, EMP_TYP_CD, BASE_SLRY_AMT, PRMRY_IND, ACTV_IND, PRMRY_DEPT_CD, EMP_ID, EMP_REC_ID)
VALUES('entity124empInfoId', 'C8E356C9-7F0F-48DD-9E25-88296368F486', 1, 'entity124eId', 'entity124afltnId', 'A', 'N', 50000, 'Y', 'Y', 'IN-ENGT', '0000000001', NULL)
/
INSERT INTO KRIM_PRNCPL_T (ACTV_IND,ENTITY_ID,OBJ_ID,PRNCPL_ID,PRNCPL_NM,VER_NBR)
VALUES ('Y','entity124eId','43939AC1-23D3-4027-9A04-6E448EFDB633','entity124pId','entity124',1)
/
| sbower/kuali-rice-1 | it/kim/src/test/resources/org/kuali/rice/kim/test/DefaultSuiteTestData.sql | SQL | apache-2.0 | 12,665 | [
30522,
1011,
1011,
1011,
1011,
9385,
2268,
1996,
13970,
11475,
3192,
1011,
1011,
1011,
1011,
7000,
2104,
1996,
4547,
2451,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1011,
1011,
2017,
2089,
2025,
2224,
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... |
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Expires" content="-1">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<title>105年第十四任總統副總統及第九屆立法委員選舉</title>
<link href="../css/style.css" rel="stylesheet" type="text/css">
<link href="../css/style2.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../js/ftiens4.js"></script>
<script type="text/javascript" src="../js/ua.js"></script>
<script type="text/javascript" src="../js/func.js"></script>
<script type="text/javascript" src="../js/treeP1.js"></script>
<script type="text/javascript" src="../js/refresh.js"></script>
</head>
<body id="main-body">
<div id="main-header">
<div id="main-top">
<a class="main-top-logo" href="#">中央選舉委員會</a>
<ul class="main-top-list">
<li class="main-top-item"><a class="main-top-link main-top-link-home" href="../index.html">回首頁</a></li>
<li class="main-top-item"><a class="main-top-link main-top-link-cec" href="http://2016.cec.gov.tw">中選會網站</a></li>
<li class="main-top-item"><a class="main-top-link main-top-link-english" href="../../en/index.html">English</a></li>
</ul>
</div>
</div>
<div id="main-wrap">
<div id="main-banner">
<div class="slideshow">
<img src="../img/main_bg_1.jpg" width="1024" height="300" alt="background" title="background">
</div>
<div class="main-deco"></div>
<div class="main-title"></div>
<a class="main-pvpe main-pvpe-current" href="../IDX/indexP1.html">總統副總統選舉</a>
<a class="main-le" href="../IDX/indexT.html">立法委員選舉</a>
</div>
<div id="main-container">
<div id="main-content">
<table width="1024" border="1" cellpadding="0" cellspacing="0">
<tr>
<td width="180" valign="top">
<div id="divMenu">
<table border="0">
<tr>
<td><a style="text-decoration:none;color:silver" href="http://www.treemenu.net/" target=_blank></a></td>
</tr>
</table>
<span class="TreeviewSpanArea">
<script>initializeDocument()</script>
<noscript>請開啟Javascript功能</noscript>
</span>
</div>
</td>
<td width="796" valign="top">
<div id="divContent">
<!-- 修改區塊 -->
<table width="100%" border="0" cellpadding="0" cellspacing="4">
<tr>
<td><img src="../images/search.png" alt="候選人得票數" title="候選人得票數"> <b>總統副總統選舉 候選人在 臺中市 和平區得票數 </b></td>
</tr>
<tr valign="bottom">
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr valign="bottom">
<td class="fontNumber"> <img src="../images/nav.gif" alt="候選組數" title="候選組數"> <img src="../images/nav.gif" alt="候選組數" title="候選組數"> 候選組數:3 <img src="../images/nav.gif" alt="應選組數" title="應選組數"> <img src="../images/nav.gif" alt="應選組數" title="應選組數"> 應選組數:1</td>
<td align="right">
<select name="selector_order" class="selectC" tabindex="1" id="orderBy" onChange="changeOrder();">
<option value="n">依號次排序</option>
<option value="s">依得票排序</option>
</select>
</td>
</tr>
</table>
</td>
</tr>
<tr valign="top">
<td>
<table width="100%" border="0" cellpadding="6" cellspacing="1" class="tableT">
<tr class="trHeaderT">
<td>註記</td>
<td>號次</td>
<td><table><tr><td>總統</td><td rowspan=2> 候選人姓名</td></tr><td>副總統</td></table></td>
<td>性別</td>
<td>得票數</td>
<td>得票率%</td>
<td>登記方式</td>
</tr>
<tr class="trT">
<td> </td>
<td>1</td>
<td>朱立倫<br>王如玄</td>
<td>男<br>女</td>
<td class="tdAlignRight">2,087</td>
<td class="tdAlignRight">39.2072</td>
<td>中國國民黨 推薦</td>
</tr>
<tr class="trT">
<td> </td>
<td>2</td>
<td>蔡英文<br>陳建仁</td>
<td>女<br>男</td>
<td class="tdAlignRight">1,878</td>
<td class="tdAlignRight">35.2809</td>
<td>民主進步黨 推薦</td>
</tr>
<tr class="trT">
<td> </td>
<td>3</td>
<td>宋楚瑜<br>徐欣瑩</td>
<td>男<br>女</td>
<td class="tdAlignRight">1,358</td>
<td class="tdAlignRight">25.5119</td>
<td>親民黨 推薦</td>
</tr>
<tr class="trFooterT">
<td colspan="7" align="right">投開票所數 已送/應送: 16/16 </td>
</tr>
</table>
</td>
</tr>
<tr valign="top">
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="10"></td>
<td valign="top" class="fontNote">
<table>
<tr>
<td>註記說明:</td>
<td align="center">◎</td>
<td>自然當選</td>
</tr>
<tr>
<td></td>
<td align="center">?</td>
<td>同票待抽籤</td>
</tr>
</table>
</td>
<td valign="top" class="fontTimer"><img src="../images/clock2.png" alt="Sat, 16 Jan 2016 20:51:11 +0800" title="Sat, 16 Jan 2016 20:51:11 +0800"> 資料更新時間: 01/16 20:51:06 <br>(網頁每3分鐘自動更新一次)</td>
</tr>
<tr>
<td colspan="3" class="fontNote"></td>
</tr>
</table>
</td>
</tr>
</table>
<!-- 修改區塊 -->
</div>
</td>
</tr>
</table>
</div>
<div class="main-footer"></div>
<div id="divFooter" align=center>[中央選舉委員會] </div>
<!--main-content-->
</div><!--main-container-->
</div><!--END main-wrap-->
<script>setOrder();</script>
<script>setMenuScrollPosY();</script>
</body>
</html>
| gugod/vote-watch-2016 | data/president/n400002900000000/20160116125206/page.html | HTML | cc0-1.0 | 6,577 | [
30522,
1026,
999,
9986,
13874,
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,
1011,
1022,
1000,
1028... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.daemon.impl;
import com.intellij.codeHighlighting.EditorBoundHighlightingPass;
import com.intellij.codeHighlighting.HighlightingPass;
import com.intellij.codeHighlighting.TextEditorHighlightingPass;
import com.intellij.codeHighlighting.TextEditorHighlightingPassRegistrar;
import com.intellij.concurrency.Job;
import com.intellij.concurrency.JobLauncher;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.application.ex.ApplicationManagerEx;
import com.intellij.openapi.application.ex.ApplicationUtil;
import com.intellij.openapi.application.impl.ApplicationImpl;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.fileEditor.TextEditor;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiManager;
import com.intellij.util.Functions;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.HashingStrategy;
import com.intellij.util.ui.UIUtil;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
import java.util.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
final class PassExecutorService implements Disposable {
static final Logger LOG = Logger.getInstance(PassExecutorService.class);
private static final boolean CHECK_CONSISTENCY = ApplicationManager.getApplication().isUnitTestMode();
private final Map<ScheduledPass, Job<Void>> mySubmittedPasses = new ConcurrentHashMap<>();
private final Project myProject;
private volatile boolean isDisposed;
private final AtomicInteger nextAvailablePassId; // used to assign random id to a pass if not set
PassExecutorService(@NotNull Project project) {
myProject = project;
nextAvailablePassId = ((TextEditorHighlightingPassRegistrarImpl)TextEditorHighlightingPassRegistrar.getInstance(myProject)).getNextAvailableId();
}
@Override
public void dispose() {
cancelAll(true);
// some workers could, although idle, still retain some thread references for some time causing leak hunter to frown
ForkJoinPool.commonPool().awaitQuiescence(1, TimeUnit.SECONDS);
isDisposed = true;
}
void cancelAll(boolean waitForTermination) {
for (Map.Entry<ScheduledPass, Job<Void>> entry : mySubmittedPasses.entrySet()) {
Job<Void> job = entry.getValue();
ScheduledPass pass = entry.getKey();
pass.myUpdateProgress.cancel();
job.cancel();
}
try {
if (waitForTermination) {
while (!waitFor(50)) {
int i = 0;
}
}
}
catch (ProcessCanceledException ignored) {
}
catch (Error | RuntimeException e) {
throw e;
}
catch (Throwable throwable) {
LOG.error(throwable);
}
finally {
mySubmittedPasses.clear();
}
}
void submitPasses(@NotNull Map<FileEditor, HighlightingPass[]> passesMap,
// a list of opened FileEditors for each Document. The first FileEditor in the list is the preferred one
@NotNull Map<Document, List<FileEditor>> documentToEditors,
@NotNull DaemonProgressIndicator updateProgress) {
if (isDisposed()) return;
Map<FileEditor, List<TextEditorHighlightingPass>> documentBoundPasses = new HashMap<>();
Map<FileEditor, List<EditorBoundHighlightingPass>> editorBoundPasses = new HashMap<>();
Map<FileEditor, Int2ObjectMap<TextEditorHighlightingPass>> id2Pass = new HashMap<>();
List<ScheduledPass> freePasses = new ArrayList<>(documentToEditors.size() * 5);
AtomicInteger threadsToStartCountdown = new AtomicInteger(0);
for (Map.Entry<FileEditor, HighlightingPass[]> entry : passesMap.entrySet()) {
FileEditor fileEditor = entry.getKey();
HighlightingPass[] passes = entry.getValue();
for (HighlightingPass pass : passes) {
Int2ObjectMap<TextEditorHighlightingPass> thisEditorId2Pass = id2Pass.computeIfAbsent(fileEditor, __ -> new Int2ObjectOpenHashMap<>(30));
if (pass instanceof EditorBoundHighlightingPass) {
EditorBoundHighlightingPass editorPass = (EditorBoundHighlightingPass)pass;
// have to make ids unique for this document
assignUniqueId(editorPass, thisEditorId2Pass);
editorBoundPasses.computeIfAbsent(fileEditor, __->new ArrayList<>()).add(editorPass);
}
else if (pass instanceof TextEditorHighlightingPass) {
TextEditorHighlightingPass tePass = (TextEditorHighlightingPass)pass;
assignUniqueId(tePass, thisEditorId2Pass);
documentBoundPasses.computeIfAbsent(fileEditor, __->new ArrayList<>()).add(tePass);
}
else {
// generic HighlightingPass, run all of them concurrently
freePasses.add(new ScheduledPass(fileEditor, pass, updateProgress, threadsToStartCountdown));
}
}
}
List<ScheduledPass> dependentPasses = new ArrayList<>(documentToEditors.size() * 10);
// fileEditor-> (passId -> created pass)
Map<FileEditor, Int2ObjectMap<ScheduledPass>> toBeSubmitted = new HashMap<>(passesMap.size());
for (Map.Entry<Document, List<FileEditor>> entry : documentToEditors.entrySet()) {
List<FileEditor> fileEditors = entry.getValue();
FileEditor preferredFileEditor = fileEditors.get(0); // assumption: the preferred fileEditor is stored first
List<TextEditorHighlightingPass> passes = documentBoundPasses.get(preferredFileEditor);
if (passes == null || passes.isEmpty()) {
continue;
}
sortById(passes);
for (TextEditorHighlightingPass pass : passes) {
createScheduledPass(preferredFileEditor, pass, toBeSubmitted, id2Pass, freePasses, dependentPasses, updateProgress,
threadsToStartCountdown);
}
}
for (Map.Entry<FileEditor, List<EditorBoundHighlightingPass>> entry : editorBoundPasses.entrySet()) {
FileEditor fileEditor = entry.getKey();
Collection<EditorBoundHighlightingPass> createdEditorBoundPasses = entry.getValue();
for (EditorBoundHighlightingPass pass : createdEditorBoundPasses) {
createScheduledPass(fileEditor, pass, toBeSubmitted, id2Pass, freePasses, dependentPasses, updateProgress, threadsToStartCountdown);
}
}
if (CHECK_CONSISTENCY && !ApplicationManagerEx.isInStressTest()) {
assertConsistency(freePasses, toBeSubmitted, threadsToStartCountdown);
}
if (LOG.isDebugEnabled()) {
Set<VirtualFile> vFiles = ContainerUtil.map2Set(passesMap.keySet(), FileEditor::getFile);
log(updateProgress, null, vFiles + " ----- starting " + threadsToStartCountdown.get(), freePasses);
}
for (ScheduledPass dependentPass : dependentPasses) {
mySubmittedPasses.put(dependentPass, Job.nullJob());
}
for (ScheduledPass freePass : freePasses) {
submit(freePass);
}
}
private void assignUniqueId(@NotNull TextEditorHighlightingPass pass, @NotNull Int2ObjectMap<TextEditorHighlightingPass> id2Pass) {
int id = pass.getId();
if (id == -1 || id == 0) {
id = nextAvailablePassId.incrementAndGet();
pass.setId(id);
}
TextEditorHighlightingPass prevPass = id2Pass.put(id, pass);
if (prevPass != null) {
LOG.error("Duplicate pass id found: "+id+". Both passes returned the same getId(): "+prevPass+" ("+prevPass.getClass() +") and "+pass+" ("+pass.getClass()+")");
}
}
private void assertConsistency(@NotNull List<ScheduledPass> freePasses,
@NotNull Map<FileEditor, Int2ObjectMap<ScheduledPass>> toBeSubmitted,
@NotNull AtomicInteger threadsToStartCountdown) {
assert threadsToStartCountdown.get() == toBeSubmitted.values().stream().mapToInt(m->m.size()).sum();
Map<ScheduledPass, Pair<ScheduledPass, Integer>> id2Visits = CollectionFactory.createCustomHashingStrategyMap(new HashingStrategy<>() {
@Override
public int hashCode(@Nullable PassExecutorService.ScheduledPass sp) {
if (sp == null) return 0;
return ((TextEditorHighlightingPass)sp.myPass).getId() * 31 + sp.myFileEditor.hashCode();
}
@Override
public boolean equals(@Nullable PassExecutorService.ScheduledPass sp1, @Nullable PassExecutorService.ScheduledPass sp2) {
if (sp1 == null || sp2 == null) return sp1 == sp2;
int id1 = ((TextEditorHighlightingPass)sp1.myPass).getId();
int id2 = ((TextEditorHighlightingPass)sp2.myPass).getId();
return id1 == id2 && sp1.myFileEditor == sp2.myFileEditor;
}
});
for (ScheduledPass freePass : freePasses) {
HighlightingPass pass = freePass.myPass;
if (pass instanceof TextEditorHighlightingPass) {
id2Visits.put(freePass, Pair.create(freePass, 0));
checkConsistency(freePass, id2Visits);
}
}
for (Map.Entry<ScheduledPass, Pair<ScheduledPass, Integer>> entry : id2Visits.entrySet()) {
int count = entry.getValue().second;
assert count == 0 : entry.getKey();
}
assert id2Visits.size() == threadsToStartCountdown.get() : "Expected "+threadsToStartCountdown+" but got "+id2Visits.size()+": "+id2Visits;
}
private void checkConsistency(@NotNull ScheduledPass pass, Map<ScheduledPass, Pair<ScheduledPass, Integer>> id2Visits) {
for (ScheduledPass succ : ContainerUtil.concat(pass.mySuccessorsOnCompletion, pass.mySuccessorsOnSubmit)) {
Pair<ScheduledPass, Integer> succPair = id2Visits.get(succ);
if (succPair == null) {
succPair = Pair.create(succ, succ.myRunningPredecessorsCount.get());
id2Visits.put(succ, succPair);
}
int newPred = succPair.second - 1;
id2Visits.put(succ, Pair.create(succ, newPred));
assert newPred >= 0;
if (newPred == 0) {
checkConsistency(succ, id2Visits);
}
}
}
@NotNull
private ScheduledPass createScheduledPass(@NotNull FileEditor fileEditor,
@NotNull TextEditorHighlightingPass pass,
@NotNull Map<FileEditor, Int2ObjectMap<ScheduledPass>> toBeSubmitted,
@NotNull Map<FileEditor, Int2ObjectMap<TextEditorHighlightingPass>> id2Pass,
@NotNull List<ScheduledPass> freePasses,
@NotNull List<ScheduledPass> dependentPasses,
@NotNull DaemonProgressIndicator updateProgress,
@NotNull AtomicInteger threadsToStartCountdown) {
Int2ObjectMap<ScheduledPass> thisEditorId2ScheduledPass = toBeSubmitted.computeIfAbsent(fileEditor, __ -> new Int2ObjectOpenHashMap<>(20));
Int2ObjectMap<TextEditorHighlightingPass> thisEditorId2Pass = id2Pass.computeIfAbsent(fileEditor, __ -> new Int2ObjectOpenHashMap<>(20));
int passId = pass.getId();
ScheduledPass scheduledPass = thisEditorId2ScheduledPass.get(passId);
if (scheduledPass != null) return scheduledPass;
scheduledPass = new ScheduledPass(fileEditor, pass, updateProgress, threadsToStartCountdown);
threadsToStartCountdown.incrementAndGet();
thisEditorId2ScheduledPass.put(passId, scheduledPass);
for (int predecessorId : pass.getCompletionPredecessorIds()) {
ScheduledPass predecessor = findOrCreatePredecessorPass(fileEditor, toBeSubmitted, id2Pass, freePasses, dependentPasses,
updateProgress, threadsToStartCountdown, predecessorId,
thisEditorId2ScheduledPass, thisEditorId2Pass);
if (predecessor != null) {
predecessor.addSuccessorOnCompletion(scheduledPass);
}
}
for (int predecessorId : pass.getStartingPredecessorIds()) {
ScheduledPass predecessor = findOrCreatePredecessorPass(fileEditor, toBeSubmitted, id2Pass, freePasses, dependentPasses,
updateProgress, threadsToStartCountdown, predecessorId,
thisEditorId2ScheduledPass, thisEditorId2Pass);
if (predecessor != null) {
predecessor.addSuccessorOnSubmit(scheduledPass);
}
}
if (scheduledPass.myRunningPredecessorsCount.get() == 0 && !freePasses.contains(scheduledPass)) {
freePasses.add(scheduledPass);
}
else if (!dependentPasses.contains(scheduledPass)) {
dependentPasses.add(scheduledPass);
}
if (pass.isRunIntentionPassAfter() && fileEditor instanceof TextEditor) {
Editor editor = ((TextEditor)fileEditor).getEditor();
VirtualFile virtualFile = fileEditor.getFile();
PsiFile psiFile = virtualFile == null ? null : ReadAction.compute(() -> PsiManager.getInstance(myProject).findFile(virtualFile));
if (psiFile != null) {
ShowIntentionsPass ip = new ShowIntentionsPass(psiFile, editor, false);
assignUniqueId(ip, thisEditorId2Pass);
ip.setCompletionPredecessorIds(new int[]{passId});
createScheduledPass(fileEditor, ip, toBeSubmitted, id2Pass, freePasses, dependentPasses, updateProgress, threadsToStartCountdown);
}
}
return scheduledPass;
}
private ScheduledPass findOrCreatePredecessorPass(@NotNull FileEditor fileEditor,
@NotNull Map<FileEditor, Int2ObjectMap<ScheduledPass>> toBeSubmitted,
@NotNull Map<FileEditor, Int2ObjectMap<TextEditorHighlightingPass>> id2Pass,
@NotNull List<ScheduledPass> freePasses,
@NotNull List<ScheduledPass> dependentPasses,
@NotNull DaemonProgressIndicator updateProgress,
@NotNull AtomicInteger myThreadsToStartCountdown,
int predecessorId,
@NotNull Int2ObjectMap<ScheduledPass> thisEditorId2ScheduledPass,
@NotNull Int2ObjectMap<? extends TextEditorHighlightingPass> thisEditorId2Pass) {
ScheduledPass predecessor = thisEditorId2ScheduledPass.get(predecessorId);
if (predecessor == null) {
TextEditorHighlightingPass textEditorPass = thisEditorId2Pass.get(predecessorId);
predecessor = textEditorPass == null ? null : createScheduledPass(fileEditor, textEditorPass, toBeSubmitted,
id2Pass, freePasses,
dependentPasses, updateProgress, myThreadsToStartCountdown);
}
return predecessor;
}
private void submit(@NotNull ScheduledPass pass) {
if (!pass.myUpdateProgress.isCanceled()) {
Job<Void> job = JobLauncher.getInstance().submitToJobThread(pass, future -> {
try {
if (!future.isCancelled()) { // for canceled task .get() generates CancellationException which is expensive
future.get();
}
}
catch (CancellationException | InterruptedException ignored) {
}
catch (ExecutionException e) {
LOG.error(e.getCause());
}
});
mySubmittedPasses.put(pass, job);
}
}
private final class ScheduledPass implements Runnable {
private final FileEditor myFileEditor;
private final HighlightingPass myPass;
private final AtomicInteger myThreadsToStartCountdown;
private final AtomicInteger myRunningPredecessorsCount = new AtomicInteger(0);
private final List<ScheduledPass> mySuccessorsOnCompletion = new ArrayList<>();
private final List<ScheduledPass> mySuccessorsOnSubmit = new ArrayList<>();
@NotNull private final DaemonProgressIndicator myUpdateProgress;
private ScheduledPass(@NotNull FileEditor fileEditor,
@NotNull HighlightingPass pass,
@NotNull DaemonProgressIndicator progressIndicator,
@NotNull AtomicInteger threadsToStartCountdown) {
myFileEditor = fileEditor;
myPass = pass;
myThreadsToStartCountdown = threadsToStartCountdown;
myUpdateProgress = progressIndicator;
}
@Override
public void run() {
((ApplicationImpl)ApplicationManager.getApplication()).executeByImpatientReader(() -> {
try {
doRun();
}
catch (ApplicationUtil.CannotRunReadActionException e) {
myUpdateProgress.cancel();
}
catch (RuntimeException | Error e) {
saveException(e, myUpdateProgress);
throw e;
}
});
}
private void doRun() {
if (myUpdateProgress.isCanceled()) return;
log(myUpdateProgress, myPass, "Started. ");
for (ScheduledPass successor : mySuccessorsOnSubmit) {
int predecessorsToRun = successor.myRunningPredecessorsCount.decrementAndGet();
if (predecessorsToRun == 0) {
submit(successor);
}
}
ProgressManager.getInstance().executeProcessUnderProgress(() -> {
boolean success = ApplicationManagerEx.getApplicationEx().tryRunReadAction(() -> {
try {
if (DumbService.getInstance(myProject).isDumb() && !DumbService.isDumbAware(myPass)) {
return;
}
if (!myUpdateProgress.isCanceled() && !myProject.isDisposed()) {
myPass.collectInformation(myUpdateProgress);
}
}
catch (ProcessCanceledException e) {
log(myUpdateProgress, myPass, "Canceled ");
if (!myUpdateProgress.isCanceled()) {
myUpdateProgress.cancel(e); //in case when some smart asses throw PCE just for fun
}
}
catch (RuntimeException | Error e) {
myUpdateProgress.cancel(e);
LOG.error(e);
throw e;
}
});
if (!success) {
myUpdateProgress.cancel();
}
}, myUpdateProgress);
log(myUpdateProgress, myPass, "Finished. ");
if (!myUpdateProgress.isCanceled()) {
applyInformationToEditorsLater(myFileEditor, myPass, myUpdateProgress, myThreadsToStartCountdown, ()->{
for (ScheduledPass successor : mySuccessorsOnCompletion) {
int predecessorsToRun = successor.myRunningPredecessorsCount.decrementAndGet();
if (predecessorsToRun == 0) {
submit(successor);
}
}
});
}
}
@NonNls
@Override
public String toString() {
return "SP: " + myPass;
}
private void addSuccessorOnCompletion(@NotNull ScheduledPass successor) {
mySuccessorsOnCompletion.add(successor);
successor.myRunningPredecessorsCount.incrementAndGet();
}
private void addSuccessorOnSubmit(@NotNull ScheduledPass successor) {
mySuccessorsOnSubmit.add(successor);
successor.myRunningPredecessorsCount.incrementAndGet();
}
}
private void applyInformationToEditorsLater(@NotNull FileEditor fileEditor,
@NotNull HighlightingPass pass,
@NotNull DaemonProgressIndicator updateProgress,
@NotNull AtomicInteger threadsToStartCountdown,
@NotNull Runnable callbackOnApplied) {
ApplicationManager.getApplication().invokeLater(() -> {
if (isDisposed() || !fileEditor.isValid()) {
updateProgress.cancel();
}
if (updateProgress.isCanceled()) {
log(updateProgress, pass, " is canceled during apply, sorry");
return;
}
try {
if (UIUtil.isShowing(fileEditor.getComponent())) {
pass.applyInformationToEditor();
repaintErrorStripeAndIcon(fileEditor);
if (pass instanceof TextEditorHighlightingPass) {
FileStatusMap fileStatusMap = DaemonCodeAnalyzerEx.getInstanceEx(myProject).getFileStatusMap();
Document document = ((TextEditorHighlightingPass)pass).getDocument();
int passId = ((TextEditorHighlightingPass)pass).getId();
fileStatusMap.markFileUpToDate(document, passId);
}
log(updateProgress, pass, " Applied");
}
}
catch (ProcessCanceledException e) {
log(updateProgress, pass, "Error " + e);
throw e;
}
catch (RuntimeException e) {
VirtualFile file = fileEditor.getFile();
FileType fileType = file == null ? null : file.getFileType();
String message = "Exception while applying information to " + fileEditor + "("+fileType+")";
log(updateProgress, pass, message + e);
throw new RuntimeException(message, e);
}
if (threadsToStartCountdown.decrementAndGet() == 0) {
HighlightingSessionImpl.waitForAllSessionsHighlightInfosApplied(updateProgress);
log(updateProgress, pass, "Stopping ");
updateProgress.stopIfRunning();
clearStaleEntries();
}
else {
log(updateProgress, pass, "Finished but there are passes in the queue: " + threadsToStartCountdown.get());
}
callbackOnApplied.run();
}, updateProgress.getModalityState(), pass.getExpiredCondition());
}
private void clearStaleEntries() {
mySubmittedPasses.keySet().removeIf(pass -> pass.myUpdateProgress.isCanceled());
}
private void repaintErrorStripeAndIcon(@NotNull FileEditor fileEditor) {
if (fileEditor instanceof TextEditor) {
DefaultHighlightInfoProcessor.repaintErrorStripeAndIcon(((TextEditor)fileEditor).getEditor(), myProject);
}
}
private boolean isDisposed() {
return isDisposed || myProject.isDisposed();
}
@NotNull
List<HighlightingPass> getAllSubmittedPasses() {
List<HighlightingPass> result = new ArrayList<>(mySubmittedPasses.size());
for (ScheduledPass scheduledPass : mySubmittedPasses.keySet()) {
if (!scheduledPass.myUpdateProgress.isCanceled()) {
result.add(scheduledPass.myPass);
}
}
return result;
}
private static void sortById(@NotNull List<? extends TextEditorHighlightingPass> result) {
ContainerUtil.quickSort(result, Comparator.comparingInt(TextEditorHighlightingPass::getId));
}
private static int getThreadNum() {
Matcher matcher = Pattern.compile("JobScheduler FJ pool (\\d*)/(\\d*)").matcher(Thread.currentThread().getName());
String num = matcher.matches() ? matcher.group(1) : null;
return StringUtil.parseInt(num, 0);
}
static void log(ProgressIndicator progressIndicator, HighlightingPass pass, @NonNls Object @NotNull ... info) {
if (LOG.isDebugEnabled()) {
Document document = pass instanceof TextEditorHighlightingPass ? ((TextEditorHighlightingPass)pass).getDocument() : null;
CharSequence docText = document == null ? "" : ": '" + StringUtil.first(document.getCharsSequence(), 10, true)+ "'";
synchronized (PassExecutorService.class) {
String infos = StringUtil.join(info, Functions.TO_STRING(), " ");
String message = StringUtil.repeatSymbol(' ', getThreadNum() * 4)
+ " " + pass + " "
+ infos
+ "; progress=" + (progressIndicator == null ? null : progressIndicator.hashCode())
+ " " + (progressIndicator == null ? "?" : progressIndicator.isCanceled() ? "X" : "V")
+ docText;
LOG.debug(message);
//System.out.println(message);
}
}
}
private static final Key<Throwable> THROWABLE_KEY = Key.create("THROWABLE_KEY");
static void saveException(@NotNull Throwable e, @NotNull DaemonProgressIndicator indicator) {
indicator.putUserDataIfAbsent(THROWABLE_KEY, e);
}
@TestOnly
static Throwable getSavedException(@NotNull DaemonProgressIndicator indicator) {
return indicator.getUserData(THROWABLE_KEY);
}
// return true if terminated
boolean waitFor(int millis) throws Throwable {
try {
for (Job<Void> job : mySubmittedPasses.values()) {
job.waitForCompletion(millis);
}
return true;
}
catch (TimeoutException ignored) {
return false;
}
catch (InterruptedException e) {
return true;
}
catch (ExecutionException e) {
throw e.getCause();
}
}
}
| jwren/intellij-community | platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/PassExecutorService.java | Java | apache-2.0 | 25,837 | [
30522,
1013,
1013,
9385,
2456,
1011,
25682,
6892,
10024,
7076,
1055,
1012,
1054,
1012,
1051,
1012,
2224,
1997,
2023,
3120,
3642,
2003,
9950,
2011,
1996,
15895,
1016,
1012,
1014,
6105,
2008,
2064,
2022,
2179,
1999,
1996,
6105,
5371,
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... |
//#############################################################################
//# #
//# Copyright (C) <2014> <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/>. #
//# #
//#############################################################################
//#EOH
// This code was generated by Barbara Worwood using IMS Development Environment (version 1.80 build 5007.25751)
// Copyright (C) 1995-2014 IMS MAXIMS. All rights reserved.
// WARNING: DO NOT MODIFY the content of this file
package ims.ocrr.domain.base.impl;
import ims.domain.impl.DomainImpl;
public abstract class BaseCumulateResultsImpl extends DomainImpl implements ims.ocrr.domain.CumulateResults, ims.domain.impl.Transactional
{
private static final long serialVersionUID = 1L;
@SuppressWarnings("unused")
public void validatelistResults(ims.core.patient.vo.PatientRefVo patient, ims.ocrr.configuration.vo.AnalyteRefVoCollection analytes, ims.framework.utils.Date startDate, ims.framework.utils.Date endDate, Boolean isTabularView)
{
}
@SuppressWarnings("unused")
public void validategetDataset(ims.ocrr.configuration.vo.AnalyteRefVo analyte)
{
}
@SuppressWarnings("unused")
public void validategetOrder(ims.ocrr.orderingresults.vo.OrderInvestigationRefVo orderRef)
{
}
@SuppressWarnings("unused")
public void validategetOrderSpecimen(ims.ocrr.orderingresults.vo.OrderSpecimenRefVo specimenRef)
{
}
@SuppressWarnings("unused")
public void validategetDTFOrderInvestigation(ims.ocrr.orderingresults.vo.OrderInvestigationRefVo orderInvestigationRef)
{
}
@SuppressWarnings("unused")
public void validategetOrderInvestigation(ims.ocrr.orderingresults.vo.OrderInvestigationRefVo orderInvestigationRef)
{
}
}
| open-health-hub/openmaxims-linux | openmaxims_workspace/OCRR/src/ims/ocrr/domain/base/impl/BaseCumulateResultsImpl.java | Java | agpl-3.0 | 2,950 | [
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... |
//#############################################################################
//# #
//# Copyright (C) <2014> <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/>. #
//# #
//#############################################################################
//#EOH
// This code was generated by Daniel Laffan using IMS Development Environment (version 1.22 build 50211.900)
// Copyright (C) 1995-2005 IMS MAXIMS plc. All rights reserved.
// 23/03/2005 - AU - Null pointer exception fixed
package ims.spinalinjuries.domain.impl;
import java.util.ArrayList;
import ims.admin.domain.HcpAdmin;
import ims.admin.domain.impl.HcpAdminImpl;
import ims.core.vo.CareContextShortVo;
import ims.core.vo.PatientCurrentConcernVo;
import ims.core.vo.domain.PatientCurrentConcernVoAssembler;
import ims.domain.exceptions.StaleObjectException;
import ims.domain.DomainFactory;
import ims.domain.exceptions.DomainRuntimeException;
import ims.domain.impl.DomainImpl;
import ims.generalmedical.vo.MedicalProbOnAdmisVoCollection;
import ims.generalmedical.vo.domain.MedicalProbOnAdmisVoAssembler;
import ims.spinalinjuries.domain.MedConcernOnAdmis;
import ims.core.clinical.domain.objects.PatientConcern;
import ims.core.clinical.vo.PatientConcernRefVo;
public class SharedNewConcernImpl extends DomainImpl implements ims.spinalinjuries.domain.SharedNewConcern, ims.domain.impl.Transactional
{
public ims.core.vo.PatientCurrentConcernVo saveConcern(ims.core.vo.PatientCurrentConcernVo concern, ims.core.vo.PatientShort patient) throws StaleObjectException
{
if(!concern.isValidated())
{
throw new DomainRuntimeException("PatientCurrentConcern Value Object Alert has not been validated");
}
DomainFactory factory = getDomainFactory();
PatientConcern doConcern = PatientCurrentConcernVoAssembler.extractPatientConcern(factory,concern);
factory.save(doConcern);
return PatientCurrentConcernVoAssembler.create(doConcern);
}
public ims.core.vo.HcpCollection listHcps(ims.core.vo.HcpFilter filter)
{
HcpAdmin impl = (HcpAdmin) getDomainImpl(HcpAdminImpl.class);
return impl.listHCPs(filter);
}
public MedicalProbOnAdmisVoCollection listProbsOnAdmission(CareContextShortVo voClinicalContactShort)
{
DomainFactory factory = getDomainFactory();
String hql = " from PatientProblem medicalProbOnAdmis ";
StringBuffer condStr = new StringBuffer();
String andStr = " ";
ArrayList markers = new ArrayList();
ArrayList values = new ArrayList();
if(voClinicalContactShort != null)
{
condStr.append(andStr + " medicalProbOnAdmis.careContext.id = :id_CareContext");
markers.add("id_CareContext");
values.add(voClinicalContactShort.getID_CareContext());
andStr = " and ";
}
if (andStr.equals(" and "))
hql += " where ";
hql += condStr.toString();
return MedicalProbOnAdmisVoAssembler.createMedicalProbOnAdmisVoCollectionFromPatientProblem(factory.find(hql, markers, values));
}
public PatientCurrentConcernVo getConcern(PatientConcernRefVo concernId) {
MedConcernOnAdmis impl = (MedConcernOnAdmis) getDomainImpl(MedConcernOnAdmisImpl.class);
return impl.getConcern(concernId);
}
}
| open-health-hub/openmaxims-linux | openmaxims_workspace/SpinalInjuries/src/ims/spinalinjuries/domain/impl/SharedNewConcernImpl.java | Java | agpl-3.0 | 4,427 | [
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... |
package ojvm.loading.instructions;
import ojvm.data.JavaException;
import ojvm.operations.InstructionVisitor;
import ojvm.util.RuntimeConstants;
/**
* The encapsulation of a ldiv instruction.
* @author Amr Sabry
* @version jdk-1.1
*/
public class Ins_ldiv extends Instruction {
public Ins_ldiv (InstructionInputStream classFile) {
super(RuntimeConstants.opc_ldiv);
}
public void accept (InstructionVisitor iv) throws JavaException {
iv.visit_ldiv (this);
}
public String toString () {
return opcodeName;
}
}
| adum/bitbath | hackjvm/src/ojvm/loading/instructions/Ins_ldiv.java | Java | gpl-2.0 | 570 | [
30522,
7427,
1051,
3501,
2615,
2213,
1012,
10578,
1012,
8128,
1025,
12324,
1051,
3501,
2615,
2213,
1012,
2951,
1012,
9262,
10288,
24422,
1025,
12324,
1051,
3501,
2615,
2213,
1012,
3136,
1012,
7899,
11365,
15660,
1025,
12324,
1051,
3501,
261... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 Acme\UserBundle\Entity;
use Doctrine\ORM\EntityRepository;
/**
* MunicipalityRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class MunicipalityRepository extends EntityRepository
{
} | isidro-amv/sistema-bibliotecario-symfony2 | src/Acme/UserBundle/Entity/MunicipalityRepository.php | PHP | mit | 270 | [
30522,
1026,
1029,
25718,
3415,
15327,
9353,
4168,
1032,
5310,
27265,
2571,
1032,
9178,
1025,
2224,
8998,
1032,
2030,
2213,
1032,
9178,
2890,
6873,
28307,
2100,
1025,
1013,
1008,
1008,
1008,
3250,
2890,
6873,
28307,
2100,
1008,
1008,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
// regversion.c - Oniguruma (regular expression library)
// Copyright (c) 2002-2020 K.Kosako All rights reserved.
//
#include "regint.h"
#pragma hdrstop
extern const char * onig_version(void)
{
static char s[12];
/*xsnprintf*/slsprintf_s(s, sizeof(s), "%d.%d.%d", ONIGURUMA_VERSION_MAJOR, ONIGURUMA_VERSION_MINOR, ONIGURUMA_VERSION_TEENY);
return s;
}
extern const char * onig_copyright(void)
{
static char s[58];
/*xsnprintf*/slsprintf_s(s, sizeof(s), "Oniguruma %d.%d.%d : Copyright (C) 2002-2018 K.Kosako", ONIGURUMA_VERSION_MAJOR, ONIGURUMA_VERSION_MINOR, ONIGURUMA_VERSION_TEENY);
return s;
}
| papyrussolution/OpenPapyrus | Src/OSF/oniguruma/src/regversion.c | C | agpl-3.0 | 608 | [
30522,
1013,
1013,
19723,
27774,
1012,
1039,
1011,
2006,
8004,
14129,
2863,
1006,
3180,
3670,
3075,
1007,
1013,
1013,
9385,
1006,
1039,
1007,
2526,
1011,
12609,
1047,
1012,
12849,
3736,
3683,
2035,
2916,
9235,
1012,
1013,
1013,
1001,
2421,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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":"27935080","logradouro":"Rua Salvador","bairro":"Riviera Fluminense","cidade":"Maca\u00e9","uf":"RJ","estado":"Rio de Janeiro"});
| lfreneda/cepdb | api/v1/27935080.jsonp.js | JavaScript | cc0-1.0 | 143 | [
30522,
1046,
3385,
2361,
1006,
1063,
1000,
8292,
2361,
1000,
1024,
1000,
25745,
19481,
2692,
17914,
1000,
1010,
1000,
8833,
12173,
8162,
2080,
1000,
1024,
1000,
21766,
2050,
10582,
1000,
1010,
1000,
21790,
18933,
1000,
1024,
1000,
15544,
14... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.4.2) on Mon Dec 14 20:07:22 GMT 2009 -->
<TITLE>
Uses of Class org.jibble.pircbot.InputThread (PircBot 1.5.0 - Java IRC API Bot Framework)
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../pircbot-style.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="Uses of Class org.jibble.pircbot.InputThread (PircBot 1.5.0 - Java IRC API Bot Framework)";
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../org/jibble/pircbot/InputThread.html" title="class in org.jibble.pircbot"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<b>PircBot Java IRC Bot</b></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html" target="_top"><B>FRAMES</B></A>
<A HREF="InputThread.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<CENTER>
<H2>
<B>Uses of Class<br>org.jibble.pircbot.InputThread</B></H2>
</CENTER>
No usage of org.jibble.pircbot.InputThread
<P>
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../org/jibble/pircbot/InputThread.html" title="class in org.jibble.pircbot"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<b>PircBot Java IRC Bot</b></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html" target="_top"><B>FRAMES</B></A>
<A HREF="InputThread.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>
| DynaLogic/com.DynaLogic.sandbox | pircbot-1.5.0/javadocs/org/jibble/pircbot/class-use/InputThread.html | HTML | gpl-3.0 | 5,496 | [
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... |
package ru.nsc.interval.globalopt;
import java.io.IOException;
import java.nio.file.Paths;
import net.java.jinterval.expression.OptimizationProblem;
import net.java.jinterval.expression.example.FireRisk;
import net.java.jinterval.interval.set.*;
import net.java.jinterval.rational.ExtendedRational;
public class Main {
public static void test(String msg, OptimizationProblem problem, SetIntervalContext ic, double... tolerances) {
System.out.println(msg);
for (double tolerance : tolerances) {
SetInterval[] box = new SetInterval[problem.getNumInps()];
for (int i = 0; i < box.length; i++) {
box[i] = ic.textToInterval(problem.getInpRange(i));
}
IAOGO algorithm = new IAOGO(problem.getObjective());
long startTime = System.currentTimeMillis();
algorithm.start(box, ExtendedRational.valueOf(tolerance), ic);
long stopTime = System.currentTimeMillis();
System.out.println("tol=" + tolerance + " time=" + (stopTime - startTime) / 1E3 + "s");
}
}
public static void main(String[] args) {
OptimizationProblem lit = FireRisk.createOptimizationProblem(FireRisk.From.tpac_T_uw_d, FireRisk.To.Fsqr, true);
OptimizationProblem num = Functions.createOptimizationProblem();
SetIntervalContext plain = SetIntervalContexts.getPlain();
SetIntervalContext accur = SetIntervalContexts.getAccur64();
switch (2) {
case 1:
test("num plain", num, plain, 1E-9);
break;
case 2:
test("num accur", num, accur, 1E-9);
break;
case 3:
test("lit plain", lit, plain, 1E-9);
break;
case 4:
test("lit accur", lit, accur, 1E-9);
break;
}
}
private static void Help() {
System.out.println("Usage: [-p] problemfile tolerance");
System.out.println(" -p plain mode (faster but without guarantee");
System.exit(1);
}
public static void mainWithArgs(String[] args) {
SetIntervalContext ic = SetIntervalContexts.getDefault();
String problemFile = null;
Double tolerance = null;
for (String arg : args) {
if (arg.startsWith("-")) {
if (arg.equals("-p")) {
ic = SetIntervalContexts.getPlain();
} else {
Help();
}
} else if (problemFile == null) {
problemFile = arg;
} else if (tolerance == null) {
tolerance = new Double(arg);
} else {
Help();
}
}
if (tolerance == null) {
Help();
}
OptimizationProblem problem = null;
try {
problem = OptimizationProblem.load(Paths.get(problemFile));
} catch (IOException e) {
System.out.println("File " + problemFile + " not found");
Help();
}
SetInterval[] box = new SetInterval[problem.getNumInps()];
for (int i = 0; i < box.length; i++) {
box[i] = ic.textToInterval(problem.getInpRange(i));
}
IAOGO algorithm = new IAOGO(problem.getObjective());
long startTime = System.currentTimeMillis();
algorithm.start(box, ExtendedRational.valueOf(tolerance), ic);
long stopTime = System.currentTimeMillis();
System.out.println("tol=" + tolerance + " time=" + (stopTime - startTime) / 1E3 + "s");
}
}
/*
-Fsqr
num plain
83573
-0.007023416664737814 [170.000000000000000000, 170.000000000000000000] [299.000000000000000000, 299.000000000000000000] [9.000000000000000000, 9.000000000000000000] [34.800000000000000000, 34.800000000000000000]
-0.007023416664737814 [170.000000000000000000, 170.000000000000000000] [299.000000000000000000, 299.000000000000000000] [9.000000000000000000, 9.000000000000000000] [34.800000000000000000, 34.800000000000000000]
tol=1.0E-9 time=393.574s
num accur
83573
-0.007023416664739057 [170.000000000000000000, 170.000000000000000000] [299.000000000000000000, 299.000000000000000000] [9.000000000000000000, 9.000000000000000000] [34.800000000000004000, 34.800000000000004000]
-0.007023416664739057 [170.000000000000000000, 170.000000000000000000] [299.000000000000000000, 299.000000000000000000] [9.000000000000000000, 9.000000000000000000] [34.800000000000004000, 34.800000000000004000]
tol=1.0E-9 time=487.459s
lit plain
83573
-0.007023416664738106 [170.000000000000000000, 170.000000000000000000] [299.000000000000000000, 299.000000000000000000] [9.000000000000000000, 9.000000000000000000] [34.800000000000000000, 34.800000000000000000]
-0.007023416664738106 [170.000000000000000000, 170.000000000000000000] [299.000000000000000000, 299.000000000000000000] [9.000000000000000000, 9.000000000000000000] [34.800000000000000000, 34.800000000000000000]
tol=1.0E-9 time=265.774s
lit accur
83573
-0.007023416664740045 [170.000000000000000000, 170.000000000000000000] [299.000000000000000000, 299.000000000000000000] [9.000000000000000000, 9.000000000000000000] [34.800000000000004000, 34.800000000000004000]
-0.007023416664740045 [170.000000000000000000, 170.000000000000000000] [299.000000000000000000, 299.000000000000000000] [9.000000000000000000, 9.000000000000000000] [34.800000000000004000, 34.800000000000004000]
tol=1.0E-9 time=412.011s
*/
| jinterval/jinterval | ru-nsc-globalopt/src/main/java/ru/nsc/interval/globalopt/Main.java | Java | bsd-2-clause | 5,500 | [
30522,
7427,
21766,
1012,
24978,
2278,
1012,
13483,
1012,
3795,
7361,
2102,
1025,
12324,
9262,
1012,
22834,
1012,
22834,
10288,
24422,
1025,
12324,
9262,
1012,
9152,
2080,
1012,
5371,
1012,
10425,
1025,
12324,
5658,
1012,
9262,
1012,
9743,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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: post
title: The Most Expensive Anti-Pattern
date: 2015-07-22 11:08
---
In this post, I'd like to talk about the most expensive programming anti-pattern I know:
**Manipulating structured data formats using string functions.**
I will be referring to it as "*printf anti-pattern*".
<!-- more -->
# The cost
When I call it "the most expensive" anti-pattern, it is not an empty claim.
I [counted vulnerabilities by type](https://gist.github.com/m1el/44e2500910a0dba31cbc) using data from [cve.mitre.org](https://cve.mitre.org/), and I got this list of top vulnerability types:
```
rexec: 19268
DoS: 14849
xss: 9236
memory: 8212
sqlinj: 6230
privilege: 3321
dirtraversal: 2762
arith: 1260
csrf: 1117
```
*You're free to criticize how I did it and do it better.*
If you look at top entries, you will notice that XSS and SQL injections contribute a noticeable chunk to the list.
I claim that most XSS and SQL injections are caused by printf anti-pattern.
Inserting random strings into HTML is a terrible idea. Same goes for SQL.
# Examples
Once you know the definition of printf anti-pattern, you will notice that it is *ubiquitous*.
You will find that this anti-pattern is most common in HTML and SQL.
That's why there are so many SQL injections and XSS vulnerabilities.
Here are a few examples:
- Nearly every PHP web-site in existence
```php
<div class="greeting">Hello, <?php echo $username; ?>!</div>
```
- Any example of SQL query generated using string manipulation (see PHP's docs for [`mysql_query`](http://php.net/manual/en/function.mysql-query.php))
```php
$query = sprintf("SELECT firstname, lastname, address, age FROM friends
WHERE firstname='%s' AND lastname='%s'",
mysql_real_escape_string($firstname),
mysql_real_escape_string($lastname));
```
- Lots of programmers generating dynamic elements in JavaScript using innerHtml-like techniques, [example](http://mrbool.com/how-to-create-an-editable-html-table-with-jquery/27425):
```javascript
var OriginalContent = $(this).text();
$(this).html("<input type='text' value='" + OriginalContent + "' />");
```
- Some poor programmer writing a dynamic web-site in C:
```C
sprintf(buffer, "<tr><td onclick=putpgtl(\"?j=%d&k=%d&v=%d&h=24\")>%s24時間</td></tr>", ...)
```
- Generating JSON using string formatting: [gist.github.com/varemenos/e95c2e098e657c7688fd](https://gist.github.com/varemenos/e95c2e098e657c7688fd)
```bash
git log --pretty=format:'{ %n "commit": "%H",%n "abbreviated_commit": "%h",%n "tree": "%T",%n "abbreviated_tree": "%t",%n "parent": "%P",%n "abbreviated_parent": "%p",%n "refs": "%D",%n "encoding": "%e",%n "subject": "%s",%n "sanitized_subject_line": "%f",%n "body": "%b",%n "commit_notes": "%N",%n "verification_flag": "%G?",%n "signer": "%GS",%n "signer_key": "%GK",%n "author": { %n "name": "%aN",%n "email": "%aE",%n "date": "%aD"%n },%n "commiter": { %n "name": "%cN",%n "email": "%cE",%n "date": "%cD"%n }%n},'
```
```bash
# jesus christ why
(curl json) | jq -c '.[] | {value: .value, name: .name}' | sed -e 's/"name":"//g' -e 's/","value"//g' | tr -d '"}' | grep -v ':0' | awk '{FS=":" ; printf "%20s\t\%d\n",$1,$2}' | less
```
- Using `sed` to process XML:
```bash
# http://askubuntu.com/questions/442013/using-sed-to-search-and-replace-text-in-xml-file
sed -i 's#<!--UpdateAccountGUIDs>UpdateAndExit</UpdateAccountGUIDs-->#<UpdateAccountGUIDs>UpdateAndExit</UpdateAccountGUIDs>#' File.XML
# http://askubuntu.com/questions/284983/print-text-between-two-xml-tags
sed -n '/<serverName/,/<\/serverName/p' big_xml_file.xml
```
- [Code generation in ExtJS](https://github.com/probonogeek/extjs/blob/master/src/data/reader/Reader.js#L662):
```javascript
'<tpl if="hasCustomConvert">',
' dest["{name}"] = value === undefined ? __field{#}.convert(__field{#}.defaultValue, record) : __field{#}.convert(value, record);\n',
...
// exploited using
// Ext.define('m',{extend:'Ext.data.Model',fields:['id']});
// var store = Ext.create('Ext.data.Store',{model:m});
// store.loadRawData({metaData:{fields:['"+alert(1)+"']}});
```
- mal [defining](https://github.com/kanaka/mal/blob/master/process/guide.md#step6) `load-file` as `eval` on string concatenation
> Define a `load-file` function using mal itself. In your main program call the `rep` function with this string: `"(def! load-file (fn* (f) (eval (read-string (str \"(do \" (slurp f) \")\")))))"`.
# Proper Alternatives
*So if I'm generating HTML using string functions, what should I be doing instead?*
You will see that all proposed solutions have a common theme:
manipulate the underlying data structure and then serialize it.
There is no point where a serialized data structure is modified as a string.
### For HTML
- [hiccup](https://github.com/weavejester/hiccup), [hiccup-examples](https://github.com/yokolet/hiccup-samples)
```clojure
(html [:ul
(for [x (range 1 4)]
[:li x])])
(defn index []
[:div {:id "content"}
[:h1 {:class "text-success"} "Hello Hiccup"]])
```
- lxml [e-factory](http://lxml.de/tutorial.html#the-e-factory)
```python
html = page = (
E.html( # create an Element called "html"
E.head(
E.title("This is a sample document")
),
E.body(
E.h1("Hello!", CLASS("title")),
E.p("This is a paragraph with ", E.b("bold"), " text in it!"),
E.p("This is another paragraph, with a", "\n ",
E.a("link", href="http://www.python.org"), "."),
E.p("Here are some reservered characters: <spam&egg>."),
)
)
)
```
- Manipulate the DOM, then serialize HTML
A toy example would look something like this:
```python
html = etree.parse('template.html')
name_node = html.xpath('//div[@id="user-name"]')[0]
name_node.text = user.name
print(etree.tostring(html))
```
- Server-side AngularJS or React
- Manipulate the DOM directly
e.g. jQuery:
```javascript
var OriginalContent = $(this).text();
$(this).empty().append($('<input type=text>').val(OriginalContent))
// Bad code. BAD!
// $(this).html("<input type='text' value='" + OriginalContent + "' />");
```
### For JSON
- Use object literals or list comprehensions to make a JSON object, then serialize it
- Generate a JSON object and then serialize it
### For SQL
- Use query placeholders
- Manipulate SQL Abstract Syntax Trees, then emit SQL
- [LINQ to SQL](https://msdn.microsoft.com/en-us/library/bb425822.aspx)
### For XML
- Use a sane serialization format instead (see JSON)
- Manipulate the DOM, then serialize XML
- XSLT would qualify if it was not terrible
### For meta-programming
- Lisp
- Manipulate Abstract Syntax Trees for your language
# The Reason
So how did we get here?
I suspect that it happened because people are lazy.
> — Oh, so we have this markup that we can generate simply using string concatenation? Yeah, let's just do that.
>
> — But if some string contains `<img/src/onerror=alert(1)>`, it will cause JavaScript code execution!
>
> — Ugh, let's write the `htmlspecialchars` function and every time we put some string into HTML, pass the string through this function...
>
> — But if you write `"<img class=" + htmlspecialchars($_GET['cls']) + " src=dot.gif>"`, you can still inject JavaScript!
>
> — But only an idiot would write that code.
>
> — What should we do if our code emits invalid HTML in the first place, without string substitution?
>
> — Just write it carefully next time.
So here we are, generating HTML using string concatenation.
Of course, if you are being really, *really* careful, you can emit valid HTML and SQL with no injection problems.
But you don't use manual memory management and pointer arithmetics when you generate your web-site, do you?
Why would you walk on a razor's edge if you can program in a safe way?
# Browsers
There is, of course, a funnier side to this story: browsers.
Browser vendors had to tune their parsers for broken HTML because many web-sites gave the browsers invalid HTML.
People chose browsers that were able to process nearly arbitrary chunks of bytes as HTML because these browsers were able to display their favorite web-sites.
Browser vendors had to implement XSS filters, because web-sites are prone to putting raw user requests straight into HTML.
The rationale for XSS filters is simple: if browser vendor *can* prevent 90% of XSS attacks on the user, the user will be happy.
However, these filters simply [*can not*](http://securitee.tk/files/chrome_xss.php?a=%3Cscript%3E%27&b=%27;alert%281%29%3C/script%3E) protect from all XSS attacks.
These two examples are browsers dealing with symptoms of the problem, and not with the problem itself.
The problem is in the head of a programmer who thinks that it is reasonable to generate dynamic HTML using string manipulation.
# Conclusion
The state of HTML as a structured data format is terrible because people started manipulating it as a string from the very beginning.
There are many problems (including, but not limited to: XSS, invalid HTML, browser parsing differences) caused by this mistreating of HTML format.
Maybe, just maybe, if available tools did not encourage people to generate HTML as a string, the web would be a better place.
Maybe, just maybe, if we chose a different serialization format for documents on the web, we would not treat it as a string that can be written using printf.
We would definitely have less vulnerabilities if programmers did not think that constructing structured data formats using string functions is an acceptable idea.
| m1el/m1el.github.com | _posts/2015-07-22-printf-antipattern.md | Markdown | mit | 9,529 | [
30522,
1011,
1011,
1011,
9621,
1024,
2695,
2516,
1024,
1996,
2087,
6450,
3424,
1011,
5418,
3058,
1024,
2325,
1011,
5718,
1011,
2570,
2340,
1024,
5511,
1011,
1011,
1011,
1999,
2023,
2695,
1010,
1045,
1005,
1040,
2066,
2000,
2831,
2055,
199... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.html" %}
{% load static from staticfiles %}
{% load thumbnail %}
{% load endless %}
{% block color_line %}
<div class="green-bar museums">
<h2>Музеи Выборга и окрестностей</h2>
</div>
{% endblock %}
{% block man-hand %}
<img src="{% static 'img/bg-excursion-hand-m.png' %}">
{% endblock %}
{% block js %}
{{ block.super }}
<script src="{{ STATIC_URL }}endless_pagination/js/endless-pagination.js"></script>
<script>$.endlessPaginate();</script>
{% endblock %}
{% block main_content %}
<div class="block-museum-n-filters bg-museum">
<div class="container">
<div class="row">
<div class="block-museum-filters clearfix" role="tabpanel">
<div class="col-md-8 col-md-offset-2 col-xs-12">
<!-- Nav tabs -->
{# <ul class="nav nav-tabs" role="tablist">#}
{# <li role="presentation" class="active">#}
{# <a href="#profile" aria-controls="profile" role="tab" data-toggle="tab" class="btn btn-default btn-fab btn-raised btn-ico-ruller" style="background-color: #9B59B6 !important;"></a>#}
{# <div class="nt-m">Удаленность</div>#}
{# </li>#}
{# </ul>#}
<!-- Tab panes -->
<div class="tab-content margin-top-10">
<div role="tabpanel" class="tab-pane active" id="profile">
<div class="row">
<div class="col-sm-4 col-xs-4">
<div class="text-center"><a href="?dist=1{% if dist == "1" %}-{% endif %}" class="btn-filter {% if dist == "1" %}active{% endif %}">Город</a></div>
<div class="text-center"><a href="?dist=2{% if dist == "2" %}-{% endif %}" class="btn-filter {% if dist == "2" %}active{% endif %}"><10км.</a></div>
</div>
<div class="col-sm-4 col-xs-4">
<div class="text-center"><a href="?dist=3{% if dist == "3" %}-{% endif %}" class="btn-filter {% if dist == "3" %}active{% endif %}">10-30км.</a></div>
<div class="text-center"><a href="?dist=4{% if dist == "4" %}-{% endif %}" class="btn-filter {% if dist == "4" %}active{% endif %}">30-50км.</a></div>
</div>
<div class="col-sm-4 col-xs-4">
<div class="text-center"><a href="?dist=5{% if dist == "5" %}-{% endif %}" class="btn-filter {% if dist == "5" %}active{% endif %}">50-100км.</a></div>
<div class="text-center"><a href="?dist=6{% if dist == "6" %}-{% endif %}" class="btn-filter {% if dist == "6" %}active{% endif %}">>100км.</a></div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="block-museum-rows margin-for-icons">
<!-- START OF INFO ROW -->
<div class="museum-rows clearfix">
<!-- START OF INFO BLOCK (4 in line) -->
{% for obj in object_list %}
{% if forloop.counter0 < 4 %}
<div class="col-md-3 col-sm-6 col-xs-12">
<a class="museum-row btn btn-raised" href="{{ obj.get_absolute_path }}">
<span class="label label-default label-place">{% if obj.distance > 1 %}{{ obj.distance }} км. от Выборга{% else %}Выборг{% endif %}</span>
<h3>{{ obj.title }}</h3>
<div class="img text-center margin-top-15">
{% thumbnail obj.image "180x180" crop="center" as im %}
<img src="{{ obj.image.url }}" width="{{ im.width }}" height="{{ im.height }}">
{% empty %}
<img src="{% static 'img/img-city-teaser-1.jpg' %}">
{% endthumbnail %}
</div>
<div class="text margin-top-15">
{{ obj.description|striptags|safe }}
</div>
</a>
</div>
{% endif %}
{% endfor %}
<!-- END OF INFO BLOCK -->
</div>
<!-- END OF INFO ROW -->
</div>
</div>
</div>
</div>
<div class="block-slider-promo bg-night-blue margin-top-20">
<div class="container">
<ul class="bxslider clearfix">
<li><a href="javascript:void(0)"><img src="{% static 'img/img-slider-1.png' %}" alt="image" /></a></li>
<li><a href="javascript:void(0)"><img src="{% static 'img/img-slider-1.png' %}" alt="image" /></a></li>
<li><a href="javascript:void(0)"><img src="{% static 'img/img-slider-1.png' %}" alt="image" /></a></li>
<li><a href="javascript:void(0)"><img src="{% static 'img/img-slider-1.png' %}" alt="image" /></a></li>
</ul>
</div>
</div>
{# <div class="bg-night-blue margin-top-20"> #}
{# <div class="container"> #}
{# <a href="javascript:void(0)"><img src="{% static 'img/img-slider-1.png' %}" alt="img" class="img-responsive margin-top-20 margin-bottom-20" /></a> #}
{# </div> #}
{# </div> #}
<div class="block-museum-n-filters bg-museum margin-top-20">
<div class="container">
<div class="row">
<div class="block-museum-rows margin-for-icons">
<!-- START OF INFO ROW -->
<div class="museum-rows clearfix endless_page_template">
<!-- START OF INFO BLOCK (4 in line) -->
{% include page_template %}
<!-- END OF INFO BLOCK -->
</div>
<!-- END OF INFO ROW -->
</div>
</div>
</div>
</div>
{% endblock %}
| Guest007/vgid | templates/museums/museums_list.html | HTML | mit | 5,330 | [
30522,
1063,
1003,
8908,
1000,
2918,
1012,
16129,
1000,
1003,
1065,
1063,
1003,
7170,
10763,
2013,
10763,
8873,
4244,
1003,
1065,
1063,
1003,
7170,
7639,
25464,
1003,
1065,
1063,
1003,
7170,
10866,
1003,
1065,
1063,
1003,
3796,
3609,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 -*-
# Generated by Django 1.11 on 2018-08-21 18:59
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
dependencies = [
('dispatch', '0017_subsections'),
]
operations = [
migrations.CreateModel(
name='Podcast',
fields=[
('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
('slug', models.SlugField(unique=True)),
('title', models.CharField(max_length=255)),
('description', models.TextField()),
('author', models.CharField(max_length=255)),
('owner_name', models.CharField(max_length=255)),
('owner_email', models.EmailField(max_length=255)),
('category', models.CharField(max_length=255)),
('image', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='dispatch.Image')),
],
),
migrations.CreateModel(
name='PodcastEpisode',
fields=[
('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
('title', models.CharField(max_length=255)),
('description', models.TextField()),
('author', models.CharField(max_length=255)),
('duration', models.PositiveIntegerField(null=True)),
('published_at', models.DateTimeField()),
('explicit', models.CharField(choices=[(b'no', b'No'), (b'yes', b'Yes'), (b'clean', b'Clean')], default=b'no', max_length=5)),
('file', models.FileField(upload_to=b'podcasts/')),
('type', models.CharField(default='audio/mp3', max_length=255)),
('image', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='dispatch.Image')),
('podcast', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dispatch.Podcast')),
],
),
]
| ubyssey/dispatch | dispatch/migrations/0018_podcasts.py | Python | gpl-2.0 | 2,099 | [
30522,
1001,
1011,
1008,
1011,
16861,
1024,
21183,
2546,
1011,
1022,
1011,
1008,
1011,
1001,
7013,
2011,
6520,
23422,
1015,
1012,
2340,
2006,
2760,
1011,
5511,
1011,
2538,
2324,
1024,
5354,
2013,
6520,
23422,
1012,
16962,
12324,
9230,
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... |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_25) on Mon Aug 05 13:52:19 CST 2013 -->
<title>DefaultWatchdog</title>
<meta name="date" content="2013-08-05">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="DefaultWatchdog";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/DefaultWatchdog.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev Class</li>
<li><a href="../../../../../com/opentech/camel/task/watchdog/Watchdog.html" title="interface in com.opentech.camel.task.watchdog"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?com/opentech/camel/task/watchdog/DefaultWatchdog.html" target="_top">Frames</a></li>
<li><a href="DefaultWatchdog.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">com.opentech.camel.task.watchdog</div>
<h2 title="Class DefaultWatchdog" class="title">Class DefaultWatchdog</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li><a href="../../../../../com/opentech/camel/task/lifecycle/AbstractLifeCycle.html" title="class in com.opentech.camel.task.lifecycle">com.opentech.camel.task.lifecycle.AbstractLifeCycle</a></li>
<li>
<ul class="inheritance">
<li>com.opentech.camel.task.watchdog.DefaultWatchdog</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><a href="../../../../../com/opentech/camel/task/lifecycle/LifeCycle.html" title="interface in com.opentech.camel.task.lifecycle">LifeCycle</a>, <a href="../../../../../com/opentech/camel/task/watchdog/Watchdog.html" title="interface in com.opentech.camel.task.watchdog">Watchdog</a></dd>
</dl>
<hr>
<br>
<pre>public class <span class="strong">DefaultWatchdog</span>
extends <a href="../../../../../com/opentech/camel/task/lifecycle/AbstractLifeCycle.html" title="class in com.opentech.camel.task.lifecycle">AbstractLifeCycle</a>
implements <a href="../../../../../com/opentech/camel/task/watchdog/Watchdog.html" title="interface in com.opentech.camel.task.watchdog">Watchdog</a></pre>
<div class="block">Default implement of watchdog
TODO support multithread and control queue capacity</div>
<dl><dt><span class="strong">Author:</span></dt>
<dd>sihai</dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<ul class="blockList">
<li class="blockList"><a name="fields_inherited_from_class_com.opentech.camel.task.watchdog.Watchdog">
<!-- -->
</a>
<h3>Fields inherited from interface com.opentech.camel.task.watchdog.<a href="../../../../../com/opentech/camel/task/watchdog/Watchdog.html" title="interface in com.opentech.camel.task.watchdog">Watchdog</a></h3>
<code><a href="../../../../../com/opentech/camel/task/watchdog/Watchdog.html#DEFAULT_WATCHDOG_QUEUE_CAPACITY">DEFAULT_WATCHDOG_QUEUE_CAPACITY</a>, <a href="../../../../../com/opentech/camel/task/watchdog/Watchdog.html#DEFAULT_WATCHDOG_THREAD_COUNT">DEFAULT_WATCHDOG_THREAD_COUNT</a></code></li>
</ul>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../com/opentech/camel/task/watchdog/DefaultWatchdog.html#DefaultWatchdog(int, int)">DefaultWatchdog</a></strong>(int threadCount,
int queueCapacity)</code> </td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/opentech/camel/task/watchdog/DefaultWatchdog.html#initialize()">initialize</a></strong>()</code>
<div class="block">Initialize</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/opentech/camel/task/watchdog/DefaultWatchdog.html#shutdown()">shutdown</a></strong>()</code>
<div class="block">Shutdown</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../com/opentech/camel/task/watchdog/DefaultWatchdog.html#watch(com.opentech.camel.task.watchdog.WatchedTask)">watch</a></strong>(<a href="../../../../../com/opentech/camel/task/watchdog/WatchedTask.html" title="class in com.opentech.camel.task.watchdog">WatchedTask</a> wt)</code> </td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="DefaultWatchdog(int, int)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>DefaultWatchdog</h4>
<pre>public DefaultWatchdog(int threadCount,
int queueCapacity)</pre>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>threadCount</code> - </dd><dd><code>queueCapacity</code> - </dd></dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="initialize()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>initialize</h4>
<pre>public void initialize()</pre>
<div class="block"><strong>Description copied from interface: <code><a href="../../../../../com/opentech/camel/task/lifecycle/LifeCycle.html#initialize()">LifeCycle</a></code></strong></div>
<div class="block">Initialize</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../com/opentech/camel/task/lifecycle/LifeCycle.html#initialize()">initialize</a></code> in interface <code><a href="../../../../../com/opentech/camel/task/lifecycle/LifeCycle.html" title="interface in com.opentech.camel.task.lifecycle">LifeCycle</a></code></dd>
<dt><strong>Overrides:</strong></dt>
<dd><code><a href="../../../../../com/opentech/camel/task/lifecycle/AbstractLifeCycle.html#initialize()">initialize</a></code> in class <code><a href="../../../../../com/opentech/camel/task/lifecycle/AbstractLifeCycle.html" title="class in com.opentech.camel.task.lifecycle">AbstractLifeCycle</a></code></dd>
</dl>
</li>
</ul>
<a name="shutdown()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>shutdown</h4>
<pre>public void shutdown()</pre>
<div class="block"><strong>Description copied from interface: <code><a href="../../../../../com/opentech/camel/task/lifecycle/LifeCycle.html#shutdown()">LifeCycle</a></code></strong></div>
<div class="block">Shutdown</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../com/opentech/camel/task/lifecycle/LifeCycle.html#shutdown()">shutdown</a></code> in interface <code><a href="../../../../../com/opentech/camel/task/lifecycle/LifeCycle.html" title="interface in com.opentech.camel.task.lifecycle">LifeCycle</a></code></dd>
<dt><strong>Overrides:</strong></dt>
<dd><code><a href="../../../../../com/opentech/camel/task/lifecycle/AbstractLifeCycle.html#shutdown()">shutdown</a></code> in class <code><a href="../../../../../com/opentech/camel/task/lifecycle/AbstractLifeCycle.html" title="class in com.opentech.camel.task.lifecycle">AbstractLifeCycle</a></code></dd>
</dl>
</li>
</ul>
<a name="watch(com.opentech.camel.task.watchdog.WatchedTask)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>watch</h4>
<pre>public void watch(<a href="../../../../../com/opentech/camel/task/watchdog/WatchedTask.html" title="class in com.opentech.camel.task.watchdog">WatchedTask</a> wt)</pre>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../com/opentech/camel/task/watchdog/Watchdog.html#watch(com.opentech.camel.task.watchdog.WatchedTask)">watch</a></code> in interface <code><a href="../../../../../com/opentech/camel/task/watchdog/Watchdog.html" title="interface in com.opentech.camel.task.watchdog">Watchdog</a></code></dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/DefaultWatchdog.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev Class</li>
<li><a href="../../../../../com/opentech/camel/task/watchdog/Watchdog.html" title="interface in com.opentech.camel.task.watchdog"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?com/opentech/camel/task/watchdog/DefaultWatchdog.html" target="_top">Frames</a></li>
<li><a href="DefaultWatchdog.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| sihai/camel | doc/com/opentech/camel/task/watchdog/DefaultWatchdog.html | HTML | gpl-2.0 | 13,742 | [
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... |
/*
* linux/arch/arm/mach-realview/realview_eb.c
*
* Copyright (C) 2004 ARM Limited
* Copyright (C) 2000 Deep Blue Solutions Ltd
*
* 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-1307 USA
*/
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/sysdev.h>
#include <linux/amba/bus.h>
#include <linux/amba/pl061.h>
#include <linux/amba/mmci.h>
#include <linux/amba/pl022.h>
#include <linux/io.h>
#include <mach/hardware.h>
#include <asm/irq.h>
#include <asm/leds.h>
#include <asm/mach-types.h>
#include <asm/pmu.h>
#include <asm/pgtable.h>
#include <asm/hardware/gic.h>
#include <asm/hardware/cache-l2x0.h>
#include <asm/localtimer.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/mach/time.h>
#include <mach/board-eb.h>
#include <mach/irqs.h>
#include "core.h"
static struct map_desc realview_eb_io_desc[] __initdata = {
{
.virtual = IO_ADDRESS(REALVIEW_SYS_BASE),
.pfn = __phys_to_pfn(REALVIEW_SYS_BASE),
.length = SZ_4K,
.type = MT_DEVICE,
}, {
.virtual = IO_ADDRESS(REALVIEW_EB_GIC_CPU_BASE),
.pfn = __phys_to_pfn(REALVIEW_EB_GIC_CPU_BASE),
.length = SZ_4K,
.type = MT_DEVICE,
}, {
.virtual = IO_ADDRESS(REALVIEW_EB_GIC_DIST_BASE),
.pfn = __phys_to_pfn(REALVIEW_EB_GIC_DIST_BASE),
.length = SZ_4K,
.type = MT_DEVICE,
}, {
.virtual = IO_ADDRESS(REALVIEW_SCTL_BASE),
.pfn = __phys_to_pfn(REALVIEW_SCTL_BASE),
.length = SZ_4K,
.type = MT_DEVICE,
}, {
.virtual = IO_ADDRESS(REALVIEW_EB_TIMER0_1_BASE),
.pfn = __phys_to_pfn(REALVIEW_EB_TIMER0_1_BASE),
.length = SZ_4K,
.type = MT_DEVICE,
}, {
.virtual = IO_ADDRESS(REALVIEW_EB_TIMER2_3_BASE),
.pfn = __phys_to_pfn(REALVIEW_EB_TIMER2_3_BASE),
.length = SZ_4K,
.type = MT_DEVICE,
},
#ifdef CONFIG_DEBUG_LL
{
.virtual = IO_ADDRESS(REALVIEW_EB_UART0_BASE),
.pfn = __phys_to_pfn(REALVIEW_EB_UART0_BASE),
.length = SZ_4K,
.type = MT_DEVICE,
}
#endif
};
static struct map_desc realview_eb11mp_io_desc[] __initdata = {
{
.virtual = IO_ADDRESS(REALVIEW_EB11MP_SCU_BASE),
.pfn = __phys_to_pfn(REALVIEW_EB11MP_SCU_BASE),
.length = SZ_4K,
.type = MT_DEVICE,
}, {
.virtual = IO_ADDRESS(REALVIEW_EB11MP_GIC_DIST_BASE),
.pfn = __phys_to_pfn(REALVIEW_EB11MP_GIC_DIST_BASE),
.length = SZ_4K,
.type = MT_DEVICE,
}, {
.virtual = IO_ADDRESS(REALVIEW_EB11MP_L220_BASE),
.pfn = __phys_to_pfn(REALVIEW_EB11MP_L220_BASE),
.length = SZ_8K,
.type = MT_DEVICE,
}
};
static void __init realview_eb_map_io(void)
{
iotable_init(realview_eb_io_desc, ARRAY_SIZE(realview_eb_io_desc));
if (core_tile_eb11mp() || core_tile_a9mp())
iotable_init(realview_eb11mp_io_desc, ARRAY_SIZE(realview_eb11mp_io_desc));
}
static struct pl061_platform_data gpio0_plat_data = {
.gpio_base = 0,
.irq_base = -1,
};
static struct pl061_platform_data gpio1_plat_data = {
.gpio_base = 8,
.irq_base = -1,
};
static struct pl061_platform_data gpio2_plat_data = {
.gpio_base = 16,
.irq_base = -1,
};
static struct pl022_ssp_controller ssp0_plat_data = {
.bus_id = 0,
.enable_dma = 0,
.num_chipselect = 1,
};
/*
* RealView EB AMBA devices
*/
/*
* These devices are connected via the core APB bridge
*/
#define GPIO2_IRQ { IRQ_EB_GPIO2, NO_IRQ }
#define GPIO3_IRQ { IRQ_EB_GPIO3, NO_IRQ }
#define AACI_IRQ { IRQ_EB_AACI, NO_IRQ }
#define MMCI0_IRQ { IRQ_EB_MMCI0A, IRQ_EB_MMCI0B }
#define KMI0_IRQ { IRQ_EB_KMI0, NO_IRQ }
#define KMI1_IRQ { IRQ_EB_KMI1, NO_IRQ }
/*
* These devices are connected directly to the multi-layer AHB switch
*/
#define EB_SMC_IRQ { NO_IRQ, NO_IRQ }
#define MPMC_IRQ { NO_IRQ, NO_IRQ }
#define EB_CLCD_IRQ { IRQ_EB_CLCD, NO_IRQ }
#define DMAC_IRQ { IRQ_EB_DMA, NO_IRQ }
/*
* These devices are connected via the core APB bridge
*/
#define SCTL_IRQ { NO_IRQ, NO_IRQ }
#define EB_WATCHDOG_IRQ { IRQ_EB_WDOG, NO_IRQ }
#define EB_GPIO0_IRQ { IRQ_EB_GPIO0, NO_IRQ }
#define GPIO1_IRQ { IRQ_EB_GPIO1, NO_IRQ }
#define EB_RTC_IRQ { IRQ_EB_RTC, NO_IRQ }
/*
* These devices are connected via the DMA APB bridge
*/
#define SCI_IRQ { IRQ_EB_SCI, NO_IRQ }
#define EB_UART0_IRQ { IRQ_EB_UART0, NO_IRQ }
#define EB_UART1_IRQ { IRQ_EB_UART1, NO_IRQ }
#define EB_UART2_IRQ { IRQ_EB_UART2, NO_IRQ }
#define EB_UART3_IRQ { IRQ_EB_UART3, NO_IRQ }
#define EB_SSP_IRQ { IRQ_EB_SSP, NO_IRQ }
/* FPGA Primecells */
AMBA_DEVICE(aaci, "fpga:aaci", AACI, NULL);
AMBA_DEVICE(mmc0, "fpga:mmc0", MMCI0, &realview_mmc0_plat_data);
AMBA_DEVICE(kmi0, "fpga:kmi0", KMI0, NULL);
AMBA_DEVICE(kmi1, "fpga:kmi1", KMI1, NULL);
AMBA_DEVICE(uart3, "fpga:uart3", EB_UART3, NULL);
/* DevChip Primecells */
AMBA_DEVICE(smc, "dev:smc", EB_SMC, NULL);
AMBA_DEVICE(clcd, "dev:clcd", EB_CLCD, &clcd_plat_data);
AMBA_DEVICE(dmac, "dev:dmac", DMAC, NULL);
AMBA_DEVICE(sctl, "dev:sctl", SCTL, NULL);
AMBA_DEVICE(wdog, "dev:wdog", EB_WATCHDOG, NULL);
AMBA_DEVICE(gpio0, "dev:gpio0", EB_GPIO0, &gpio0_plat_data);
AMBA_DEVICE(gpio1, "dev:gpio1", GPIO1, &gpio1_plat_data);
AMBA_DEVICE(gpio2, "dev:gpio2", GPIO2, &gpio2_plat_data);
AMBA_DEVICE(rtc, "dev:rtc", EB_RTC, NULL);
AMBA_DEVICE(sci0, "dev:sci0", SCI, NULL);
AMBA_DEVICE(uart0, "dev:uart0", EB_UART0, NULL);
AMBA_DEVICE(uart1, "dev:uart1", EB_UART1, NULL);
AMBA_DEVICE(uart2, "dev:uart2", EB_UART2, NULL);
AMBA_DEVICE(ssp0, "dev:ssp0", EB_SSP, &ssp0_plat_data);
static struct amba_device *amba_devs[] __initdata = {
&dmac_device,
&uart0_device,
&uart1_device,
&uart2_device,
&uart3_device,
&smc_device,
&clcd_device,
&sctl_device,
&wdog_device,
&gpio0_device,
&gpio1_device,
&gpio2_device,
&rtc_device,
&sci0_device,
&ssp0_device,
&aaci_device,
&mmc0_device,
&kmi0_device,
&kmi1_device,
};
/*
* RealView EB platform devices
*/
static struct resource realview_eb_flash_resource = {
.start = REALVIEW_EB_FLASH_BASE,
.end = REALVIEW_EB_FLASH_BASE + REALVIEW_EB_FLASH_SIZE - 1,
.flags = IORESOURCE_MEM,
};
static struct resource realview_eb_eth_resources[] = {
[0] = {
.start = REALVIEW_EB_ETH_BASE,
.end = REALVIEW_EB_ETH_BASE + SZ_64K - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = IRQ_EB_ETH,
.end = IRQ_EB_ETH,
.flags = IORESOURCE_IRQ,
},
};
/*
* Detect and register the correct Ethernet device. RealView/EB rev D
* platforms use the newer SMSC LAN9118 Ethernet chip
*/
static int eth_device_register(void)
{
void __iomem *eth_addr = ioremap(REALVIEW_EB_ETH_BASE, SZ_4K);
const char *name = NULL;
u32 idrev;
if (!eth_addr)
return -ENOMEM;
idrev = readl(eth_addr + 0x50);
if ((idrev & 0xFFFF0000) != 0x01180000)
/* SMSC LAN9118 not present, use LAN91C111 instead */
name = "smc91x";
iounmap(eth_addr);
return realview_eth_register(name, realview_eb_eth_resources);
}
static struct resource realview_eb_isp1761_resources[] = {
[0] = {
.start = REALVIEW_EB_USB_BASE,
.end = REALVIEW_EB_USB_BASE + SZ_128K - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = IRQ_EB_USB,
.end = IRQ_EB_USB,
.flags = IORESOURCE_IRQ,
},
};
static struct resource pmu_resources[] = {
[0] = {
.start = IRQ_EB11MP_PMU_CPU0,
.end = IRQ_EB11MP_PMU_CPU0,
.flags = IORESOURCE_IRQ,
},
[1] = {
.start = IRQ_EB11MP_PMU_CPU1,
.end = IRQ_EB11MP_PMU_CPU1,
.flags = IORESOURCE_IRQ,
},
[2] = {
.start = IRQ_EB11MP_PMU_CPU2,
.end = IRQ_EB11MP_PMU_CPU2,
.flags = IORESOURCE_IRQ,
},
[3] = {
.start = IRQ_EB11MP_PMU_CPU3,
.end = IRQ_EB11MP_PMU_CPU3,
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device pmu_device = {
.name = "arm-pmu",
.id = ARM_PMU_DEVICE_CPU,
.num_resources = ARRAY_SIZE(pmu_resources),
.resource = pmu_resources,
};
static struct resource char_lcd_resources[] = {
{
.start = REALVIEW_CHAR_LCD_BASE,
.end = (REALVIEW_CHAR_LCD_BASE + SZ_4K - 1),
.flags = IORESOURCE_MEM,
},
{
.start = IRQ_EB_CHARLCD,
.end = IRQ_EB_CHARLCD,
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device char_lcd_device = {
.name = "arm-charlcd",
.id = -1,
.num_resources = ARRAY_SIZE(char_lcd_resources),
.resource = char_lcd_resources,
};
static void __init gic_init_irq(void)
{
if (core_tile_eb11mp() || core_tile_a9mp()) {
unsigned int pldctrl;
/* new irq mode */
writel(0x0000a05f, __io_address(REALVIEW_SYS_LOCK));
pldctrl = readl(__io_address(REALVIEW_SYS_BASE) + REALVIEW_EB11MP_SYS_PLD_CTRL1);
pldctrl |= 0x00800000;
writel(pldctrl, __io_address(REALVIEW_SYS_BASE) + REALVIEW_EB11MP_SYS_PLD_CTRL1);
writel(0x00000000, __io_address(REALVIEW_SYS_LOCK));
/* core tile GIC, primary */
gic_init(0, 29, __io_address(REALVIEW_EB11MP_GIC_DIST_BASE),
__io_address(REALVIEW_EB11MP_GIC_CPU_BASE));
#ifndef CONFIG_REALVIEW_EB_ARM11MP_REVB
/* board GIC, secondary */
gic_init(1, 96, __io_address(REALVIEW_EB_GIC_DIST_BASE),
__io_address(REALVIEW_EB_GIC_CPU_BASE));
gic_cascade_irq(1, IRQ_EB11MP_EB_IRQ1);
#endif
} else {
/* board GIC, primary */
gic_init(0, 29, __io_address(REALVIEW_EB_GIC_DIST_BASE),
__io_address(REALVIEW_EB_GIC_CPU_BASE));
}
}
/*
* Fix up the IRQ numbers for the RealView EB/ARM11MPCore tile
*/
static void realview_eb11mp_fixup(void)
{
/* AMBA devices */
dmac_device.irq[0] = IRQ_EB11MP_DMA;
uart0_device.irq[0] = IRQ_EB11MP_UART0;
uart1_device.irq[0] = IRQ_EB11MP_UART1;
uart2_device.irq[0] = IRQ_EB11MP_UART2;
uart3_device.irq[0] = IRQ_EB11MP_UART3;
clcd_device.irq[0] = IRQ_EB11MP_CLCD;
wdog_device.irq[0] = IRQ_EB11MP_WDOG;
gpio0_device.irq[0] = IRQ_EB11MP_GPIO0;
gpio1_device.irq[0] = IRQ_EB11MP_GPIO1;
gpio2_device.irq[0] = IRQ_EB11MP_GPIO2;
rtc_device.irq[0] = IRQ_EB11MP_RTC;
sci0_device.irq[0] = IRQ_EB11MP_SCI;
ssp0_device.irq[0] = IRQ_EB11MP_SSP;
aaci_device.irq[0] = IRQ_EB11MP_AACI;
mmc0_device.irq[0] = IRQ_EB11MP_MMCI0A;
mmc0_device.irq[1] = IRQ_EB11MP_MMCI0B;
kmi0_device.irq[0] = IRQ_EB11MP_KMI0;
kmi1_device.irq[0] = IRQ_EB11MP_KMI1;
/* platform devices */
realview_eb_eth_resources[1].start = IRQ_EB11MP_ETH;
realview_eb_eth_resources[1].end = IRQ_EB11MP_ETH;
realview_eb_isp1761_resources[1].start = IRQ_EB11MP_USB;
realview_eb_isp1761_resources[1].end = IRQ_EB11MP_USB;
}
static void __init realview_eb_timer_init(void)
{
unsigned int timer_irq;
timer0_va_base = __io_address(REALVIEW_EB_TIMER0_1_BASE);
timer1_va_base = __io_address(REALVIEW_EB_TIMER0_1_BASE) + 0x20;
timer2_va_base = __io_address(REALVIEW_EB_TIMER2_3_BASE);
timer3_va_base = __io_address(REALVIEW_EB_TIMER2_3_BASE) + 0x20;
if (core_tile_eb11mp() || core_tile_a9mp()) {
#ifdef CONFIG_LOCAL_TIMERS
twd_base = __io_address(REALVIEW_EB11MP_TWD_BASE);
#endif
timer_irq = IRQ_EB11MP_TIMER0_1;
} else
timer_irq = IRQ_EB_TIMER0_1;
realview_timer_init(timer_irq);
}
static struct sys_timer realview_eb_timer = {
.init = realview_eb_timer_init,
};
static void realview_eb_reset(char mode)
{
void __iomem *reset_ctrl = __io_address(REALVIEW_SYS_RESETCTL);
void __iomem *lock_ctrl = __io_address(REALVIEW_SYS_LOCK);
/*
* To reset, we hit the on-board reset register
* in the system FPGA
*/
__raw_writel(REALVIEW_SYS_LOCK_VAL, lock_ctrl);
if (core_tile_eb11mp())
__raw_writel(0x0008, reset_ctrl);
}
static void __init realview_eb_init(void)
{
int i;
if (core_tile_eb11mp() || core_tile_a9mp()) {
realview_eb11mp_fixup();
#ifdef CONFIG_CACHE_L2X0
/* 1MB (128KB/way), 8-way associativity, evmon/parity/share enabled
* Bits: .... ...0 0111 1001 0000 .... .... .... */
l2x0_init(__io_address(REALVIEW_EB11MP_L220_BASE), 0x00790000, 0xfe000fff);
#endif
platform_device_register(&pmu_device);
}
realview_flash_register(&realview_eb_flash_resource, 1);
platform_device_register(&realview_i2c_device);
platform_device_register(&char_lcd_device);
eth_device_register();
realview_usb_register(realview_eb_isp1761_resources);
for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
struct amba_device *d = amba_devs[i];
amba_device_register(d, &iomem_resource);
}
#ifdef CONFIG_LEDS
leds_event = realview_leds_event;
#endif
realview_reset = realview_eb_reset;
}
MACHINE_START(REALVIEW_EB, "ARM-RealView EB")
/* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
.atag_offset = 0x100,
.fixup = realview_fixup,
.map_io = realview_eb_map_io,
.init_early = realview_init_early,
.init_irq = gic_init_irq,
.timer = &realview_eb_timer,
.handle_irq = gic_handle_irq,
.init_machine = realview_eb_init,
#ifdef CONFIG_ZONE_DMA
.dma_zone_size = SZ_256M,
#endif
MACHINE_END
| zhengsjembest/linux_am335x | linux-3.2.0-psp04.06.00.08.sdk/arch/arm/mach-realview/realview_eb.c | C | gpl-2.0 | 13,095 | [
30522,
1013,
1008,
1008,
11603,
1013,
7905,
1013,
2849,
1013,
24532,
1011,
2613,
8584,
1013,
2613,
8584,
1035,
1041,
2497,
1012,
1039,
1008,
1008,
9385,
1006,
1039,
1007,
2432,
2849,
3132,
1008,
9385,
1006,
1039,
1007,
2456,
2784,
2630,
7... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 2000-2014 JetBrains s.r.o.
*
* 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.intellij.psi.formatter.java;
import com.intellij.formatting.*;
import com.intellij.formatting.alignment.AlignmentStrategy;
import com.intellij.lang.ASTNode;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
import com.intellij.psi.codeStyle.JavaCodeStyleSettings;
import com.intellij.psi.formatter.FormatterUtil;
import com.intellij.psi.formatter.common.AbstractBlock;
import com.intellij.psi.formatter.java.wrap.JavaWrapManager;
import com.intellij.psi.formatter.java.wrap.ReservedWrapsProvider;
import com.intellij.psi.impl.source.SourceTreeToPsiMap;
import com.intellij.psi.impl.source.codeStyle.ShiftIndentInsideHelper;
import com.intellij.psi.impl.source.tree.*;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.intellij.psi.impl.source.tree.java.ClassElement;
import com.intellij.psi.jsp.JspElementType;
import com.intellij.psi.tree.IElementType;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.text.CharArrayUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static com.intellij.psi.formatter.java.JavaFormatterUtil.getWrapType;
import static com.intellij.psi.formatter.java.MultipleFieldDeclarationHelper.findLastFieldInGroup;
public abstract class AbstractJavaBlock extends AbstractBlock implements JavaBlock, ReservedWrapsProvider {
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.formatter.java.AbstractJavaBlock");
@NotNull protected final CommonCodeStyleSettings mySettings;
@NotNull protected final JavaCodeStyleSettings myJavaSettings;
protected final CommonCodeStyleSettings.IndentOptions myIndentSettings;
private final Indent myIndent;
protected Indent myChildIndent;
protected Alignment myChildAlignment;
protected boolean myUseChildAttributes = false;
@NotNull protected final AlignmentStrategy myAlignmentStrategy;
private boolean myIsAfterClassKeyword = false;
protected Alignment myReservedAlignment;
protected Alignment myReservedAlignment2;
private final JavaWrapManager myWrapManager;
private Map<IElementType, Wrap> myPreferredWraps;
private AbstractJavaBlock myParentBlock;
protected AbstractJavaBlock(@NotNull final ASTNode node,
final Wrap wrap,
final Alignment alignment,
final Indent indent,
@NotNull final CommonCodeStyleSettings settings,
@NotNull JavaCodeStyleSettings javaSettings)
{
this(node, wrap, indent, settings, javaSettings, JavaWrapManager.INSTANCE, AlignmentStrategy.wrap(alignment));
}
protected AbstractJavaBlock(@NotNull final ASTNode node,
final Wrap wrap,
@NotNull final AlignmentStrategy alignmentStrategy,
final Indent indent,
@NotNull final CommonCodeStyleSettings settings,
@NotNull JavaCodeStyleSettings javaSettings)
{
this(node, wrap, indent, settings, javaSettings, JavaWrapManager.INSTANCE, alignmentStrategy);
}
private AbstractJavaBlock(@NotNull ASTNode ignored,
@NotNull CommonCodeStyleSettings commonSettings,
@NotNull JavaCodeStyleSettings javaSettings) {
super(ignored, null, null);
mySettings = commonSettings;
myJavaSettings = javaSettings;
myIndentSettings = commonSettings.getIndentOptions();
myIndent = null;
myWrapManager = JavaWrapManager.INSTANCE;
myAlignmentStrategy = AlignmentStrategy.getNullStrategy();
}
protected AbstractJavaBlock(@NotNull final ASTNode node,
final Wrap wrap,
final Indent indent,
@NotNull final CommonCodeStyleSettings settings,
@NotNull JavaCodeStyleSettings javaSettings,
final JavaWrapManager wrapManager,
@NotNull final AlignmentStrategy alignmentStrategy) {
super(node, wrap, createBlockAlignment(alignmentStrategy, node));
mySettings = settings;
myJavaSettings = javaSettings;
myIndentSettings = settings.getIndentOptions();
myIndent = indent;
myWrapManager = wrapManager;
myAlignmentStrategy = alignmentStrategy;
}
@Nullable
private static Alignment createBlockAlignment(@NotNull AlignmentStrategy strategy, @NotNull ASTNode node) {
// There is a possible case that 'implements' section is incomplete (e.g. ends with comma). We may want to align lbrace
// to the first implemented interface reference then.
if (node.getElementType() == JavaElementType.IMPLEMENTS_LIST) {
return null;
}
return strategy.getAlignment(node.getElementType());
}
@NotNull
public Block createJavaBlock(@NotNull ASTNode child,
@NotNull CommonCodeStyleSettings settings,
@NotNull JavaCodeStyleSettings javaSettings,
@Nullable Indent indent,
@Nullable Wrap wrap,
Alignment alignment) {
return createJavaBlock(child, settings, javaSettings,indent, wrap, AlignmentStrategy.wrap(alignment));
}
@NotNull
public Block createJavaBlock(@NotNull ASTNode child,
@NotNull CommonCodeStyleSettings settings,
@NotNull JavaCodeStyleSettings javaSettings,
final Indent indent,
@Nullable Wrap wrap,
@NotNull AlignmentStrategy alignmentStrategy) {
return createJavaBlock(child, settings, javaSettings, indent, wrap, alignmentStrategy, -1);
}
@NotNull
private Block createJavaBlock(@NotNull ASTNode child,
@NotNull CommonCodeStyleSettings settings,
@NotNull JavaCodeStyleSettings javaSettings,
@Nullable Indent indent,
Wrap wrap,
@NotNull AlignmentStrategy alignmentStrategy,
int startOffset) {
Indent actualIndent = indent == null ? getDefaultSubtreeIndent(child, getJavaIndentOptions(settings)) : indent;
final IElementType elementType = child.getElementType();
Alignment alignment = alignmentStrategy.getAlignment(elementType);
if (child.getPsi() instanceof PsiWhiteSpace) {
String text = child.getText();
int start = CharArrayUtil.shiftForward(text, 0, " \t\n");
int end = CharArrayUtil.shiftBackward(text, text.length() - 1, " \t\n") + 1;
LOG.assertTrue(start < end);
return new PartialWhitespaceBlock(child, new TextRange(start + child.getStartOffset(), end + child.getStartOffset()),
wrap, alignment, actualIndent, settings, javaSettings);
}
if (child.getPsi() instanceof PsiClass) {
return new CodeBlockBlock(child, wrap, alignment, actualIndent, settings, javaSettings);
}
if (isBlockType(elementType)) {
return new BlockContainingJavaBlock(child, wrap, alignment, actualIndent, settings, javaSettings);
}
if (isStatement(child, child.getTreeParent())) {
return new CodeBlockBlock(child, wrap, alignment, actualIndent, settings, javaSettings);
}
if (isBuildInjectedBlocks() &&
child instanceof PsiComment &&
child instanceof PsiLanguageInjectionHost &&
InjectedLanguageUtil.hasInjections((PsiLanguageInjectionHost)child)) {
return new CommentWithInjectionBlock(child, wrap, alignment, indent, settings, javaSettings);
}
if (child instanceof LeafElement) {
final LeafBlock block = new LeafBlock(child, wrap, alignment, actualIndent);
block.setStartOffset(startOffset);
return block;
}
else if (isLikeExtendsList(elementType)) {
return new ExtendsListBlock(child, wrap, alignmentStrategy, settings, javaSettings);
}
else if (elementType == JavaElementType.CODE_BLOCK) {
return new CodeBlockBlock(child, wrap, alignment, actualIndent, settings, javaSettings);
}
else if (elementType == JavaElementType.LABELED_STATEMENT) {
return new LabeledJavaBlock(child, wrap, alignment, actualIndent, settings, javaSettings);
}
else if (elementType == JavaDocElementType.DOC_COMMENT) {
return new DocCommentBlock(child, wrap, alignment, actualIndent, settings, javaSettings);
}
else {
final SimpleJavaBlock simpleJavaBlock = new SimpleJavaBlock(child, wrap, alignmentStrategy, actualIndent, settings, javaSettings);
simpleJavaBlock.setStartOffset(startOffset);
return simpleJavaBlock;
}
}
@NotNull
public static Block newJavaBlock(@NotNull ASTNode child,
@NotNull CommonCodeStyleSettings settings,
@NotNull JavaCodeStyleSettings javaSettings) {
final Indent indent = getDefaultSubtreeIndent(child, getJavaIndentOptions(settings));
return newJavaBlock(child, settings, javaSettings, indent, null, AlignmentStrategy.getNullStrategy());
}
@NotNull
public static Block newJavaBlock(@NotNull ASTNode child,
@NotNull CommonCodeStyleSettings settings,
@NotNull JavaCodeStyleSettings javaSettings,
@Nullable Indent indent,
@Nullable Wrap wrap,
@NotNull AlignmentStrategy strategy) {
return new AbstractJavaBlock(child, settings, javaSettings) {
@Override
protected List<Block> buildChildren() {
return null;
}
}.createJavaBlock(child, settings, javaSettings, indent, wrap, strategy);
}
@NotNull
private static CommonCodeStyleSettings.IndentOptions getJavaIndentOptions(CommonCodeStyleSettings settings) {
CommonCodeStyleSettings.IndentOptions indentOptions = settings.getIndentOptions();
assert indentOptions != null : "Java indent options are not initialized";
return indentOptions;
}
private static boolean isLikeExtendsList(final IElementType elementType) {
return elementType == JavaElementType.EXTENDS_LIST
|| elementType == JavaElementType.IMPLEMENTS_LIST
|| elementType == JavaElementType.THROWS_LIST;
}
private static boolean isBlockType(final IElementType elementType) {
return elementType == JavaElementType.SWITCH_STATEMENT
|| elementType == JavaElementType.FOR_STATEMENT
|| elementType == JavaElementType.WHILE_STATEMENT
|| elementType == JavaElementType.DO_WHILE_STATEMENT
|| elementType == JavaElementType.TRY_STATEMENT
|| elementType == JavaElementType.CATCH_SECTION
|| elementType == JavaElementType.IF_STATEMENT
|| elementType == JavaElementType.METHOD
|| elementType == JavaElementType.ARRAY_INITIALIZER_EXPRESSION
|| elementType == JavaElementType.ANNOTATION_ARRAY_INITIALIZER
|| elementType == JavaElementType.CLASS_INITIALIZER
|| elementType == JavaElementType.SYNCHRONIZED_STATEMENT
|| elementType == JavaElementType.FOREACH_STATEMENT;
}
@Nullable
private static Indent getDefaultSubtreeIndent(@NotNull ASTNode child, @NotNull CommonCodeStyleSettings.IndentOptions indentOptions) {
final ASTNode parent = child.getTreeParent();
final IElementType childNodeType = child.getElementType();
if (childNodeType == JavaElementType.ANNOTATION) {
if (parent.getPsi() instanceof PsiArrayInitializerMemberValue) {
return Indent.getNormalIndent();
}
return Indent.getNoneIndent();
}
final ASTNode prevElement = FormatterUtil.getPreviousNonWhitespaceSibling(child);
if (prevElement != null && prevElement.getElementType() == JavaElementType.MODIFIER_LIST) {
return Indent.getNoneIndent();
}
if (childNodeType == JavaDocElementType.DOC_TAG) return Indent.getNoneIndent();
if (childNodeType == JavaDocTokenType.DOC_COMMENT_LEADING_ASTERISKS) return Indent.getSpaceIndent(1);
if (child.getPsi() instanceof PsiFile) return Indent.getNoneIndent();
if (parent != null) {
final Indent defaultChildIndent = getChildIndent(parent, indentOptions);
if (defaultChildIndent != null) return defaultChildIndent;
}
if (child.getTreeParent() instanceof PsiLambdaExpression && child instanceof PsiCodeBlock) {
return Indent.getNoneIndent();
}
return null;
}
@Nullable
private static Indent getChildIndent(@NotNull ASTNode parent, @NotNull CommonCodeStyleSettings.IndentOptions indentOptions) {
final IElementType parentType = parent.getElementType();
if (parentType == JavaElementType.MODIFIER_LIST) return Indent.getNoneIndent();
if (parentType == JspElementType.JSP_CODE_BLOCK) return Indent.getNormalIndent();
if (parentType == JspElementType.JSP_CLASS_LEVEL_DECLARATION_STATEMENT) return Indent.getNormalIndent();
if (parentType == TokenType.DUMMY_HOLDER) return Indent.getNoneIndent();
if (parentType == JavaElementType.CLASS) return Indent.getNoneIndent();
if (parentType == JavaElementType.IF_STATEMENT) return Indent.getNoneIndent();
if (parentType == JavaElementType.TRY_STATEMENT) return Indent.getNoneIndent();
if (parentType == JavaElementType.CATCH_SECTION) return Indent.getNoneIndent();
if (parentType == JavaElementType.FOR_STATEMENT) return Indent.getNoneIndent();
if (parentType == JavaElementType.FOREACH_STATEMENT) return Indent.getNoneIndent();
if (parentType == JavaElementType.BLOCK_STATEMENT) return Indent.getNoneIndent();
if (parentType == JavaElementType.DO_WHILE_STATEMENT) return Indent.getNoneIndent();
if (parentType == JavaElementType.WHILE_STATEMENT) return Indent.getNoneIndent();
if (parentType == JavaElementType.SWITCH_STATEMENT) return Indent.getNoneIndent();
if (parentType == JavaElementType.METHOD) return Indent.getNoneIndent();
if (parentType == JavaDocElementType.DOC_COMMENT) return Indent.getNoneIndent();
if (parentType == JavaDocElementType.DOC_TAG) return Indent.getNoneIndent();
if (parentType == JavaDocElementType.DOC_INLINE_TAG) return Indent.getNoneIndent();
if (parentType == JavaElementType.IMPORT_LIST) return Indent.getNoneIndent();
if (parentType == JavaElementType.FIELD) return Indent.getContinuationWithoutFirstIndent(indentOptions.USE_RELATIVE_INDENTS);
if (parentType == JavaElementType.EXPRESSION_STATEMENT) return Indent.getNoneIndent();
if (SourceTreeToPsiMap.treeElementToPsi(parent) instanceof PsiFile) {
return Indent.getNoneIndent();
}
return null;
}
protected static boolean isRBrace(@NotNull final ASTNode child) {
return child.getElementType() == JavaTokenType.RBRACE;
}
@Nullable
@Override
public Spacing getSpacing(Block child1, @NotNull Block child2) {
return JavaSpacePropertyProcessor.getSpacing(getTreeNode(child2), mySettings, myJavaSettings);
}
@Override
public ASTNode getFirstTreeNode() {
return myNode;
}
@Override
public Indent getIndent() {
return myIndent;
}
protected static boolean isStatement(final ASTNode child, @Nullable final ASTNode parentNode) {
if (parentNode != null) {
final IElementType parentType = parentNode.getElementType();
if (parentType == JavaElementType.CODE_BLOCK) return false;
final int role = ((CompositeElement)parentNode).getChildRole(child);
if (parentType == JavaElementType.IF_STATEMENT) return role == ChildRole.THEN_BRANCH || role == ChildRole.ELSE_BRANCH;
if (parentType == JavaElementType.FOR_STATEMENT) return role == ChildRole.LOOP_BODY;
if (parentType == JavaElementType.WHILE_STATEMENT) return role == ChildRole.LOOP_BODY;
if (parentType == JavaElementType.DO_WHILE_STATEMENT) return role == ChildRole.LOOP_BODY;
if (parentType == JavaElementType.FOREACH_STATEMENT) return role == ChildRole.LOOP_BODY;
}
return false;
}
@Nullable
protected Wrap createChildWrap() {
return myWrapManager.createChildBlockWrap(this, getSettings(), this);
}
@Nullable
protected Alignment createChildAlignment() {
IElementType nodeType = myNode.getElementType();
if (nodeType == JavaElementType.POLYADIC_EXPRESSION) nodeType = JavaElementType.BINARY_EXPRESSION;
if (nodeType == JavaElementType.ASSIGNMENT_EXPRESSION) {
if (myNode.getTreeParent() != null
&& myNode.getTreeParent().getElementType() == JavaElementType.ASSIGNMENT_EXPRESSION
&& myAlignment != null) {
return myAlignment;
}
return createAlignment(mySettings.ALIGN_MULTILINE_ASSIGNMENT, null);
}
if (nodeType == JavaElementType.PARENTH_EXPRESSION) {
return createAlignment(mySettings.ALIGN_MULTILINE_PARENTHESIZED_EXPRESSION, null);
}
if (nodeType == JavaElementType.CONDITIONAL_EXPRESSION) {
return createAlignment(mySettings.ALIGN_MULTILINE_TERNARY_OPERATION, null);
}
if (nodeType == JavaElementType.FOR_STATEMENT) {
return createAlignment(mySettings.ALIGN_MULTILINE_FOR, null);
}
if (nodeType == JavaElementType.EXTENDS_LIST || nodeType == JavaElementType.IMPLEMENTS_LIST) {
return createAlignment(mySettings.ALIGN_MULTILINE_EXTENDS_LIST, null);
}
if (nodeType == JavaElementType.THROWS_LIST) {
return createAlignment(mySettings.ALIGN_MULTILINE_THROWS_LIST, null);
}
if (nodeType == JavaElementType.PARAMETER_LIST) {
return createAlignment(mySettings.ALIGN_MULTILINE_PARAMETERS, null);
}
if (nodeType == JavaElementType.RESOURCE_LIST) {
return createAlignment(mySettings.ALIGN_MULTILINE_RESOURCES, null);
}
if (nodeType == JavaElementType.BINARY_EXPRESSION) {
Alignment defaultAlignment = null;
if (shouldInheritAlignment()) {
defaultAlignment = myAlignment;
}
return createAlignment(mySettings.ALIGN_MULTILINE_BINARY_OPERATION, defaultAlignment);
}
if (nodeType == JavaElementType.CLASS || nodeType == JavaElementType.METHOD) {
return null;
}
return null;
}
@Nullable
protected Alignment chooseAlignment(@Nullable Alignment alignment, @Nullable Alignment alignment2, @NotNull ASTNode child) {
if (isTernaryOperatorToken(child)) {
return alignment2;
}
return alignment;
}
private boolean isTernaryOperatorToken(@NotNull final ASTNode child) {
final IElementType nodeType = myNode.getElementType();
if (nodeType == JavaElementType.CONDITIONAL_EXPRESSION) {
IElementType childType = child.getElementType();
return childType == JavaTokenType.QUEST || childType ==JavaTokenType.COLON;
}
else {
return false;
}
}
private boolean shouldInheritAlignment() {
if (myNode instanceof PsiPolyadicExpression) {
final ASTNode treeParent = myNode.getTreeParent();
if (treeParent instanceof PsiPolyadicExpression) {
return JavaFormatterUtil.areSamePriorityBinaryExpressions(myNode, treeParent);
}
}
return false;
}
@Nullable
protected ASTNode processChild(@NotNull final List<Block> result,
@NotNull ASTNode child,
Alignment defaultAlignment,
final Wrap defaultWrap,
final Indent childIndent) {
return processChild(result, child, AlignmentStrategy.wrap(defaultAlignment), defaultWrap, childIndent, -1);
}
@Nullable
protected ASTNode processChild(@NotNull final List<Block> result,
@NotNull ASTNode child,
@NotNull AlignmentStrategy alignmentStrategy,
@Nullable final Wrap defaultWrap,
final Indent childIndent) {
return processChild(result, child, alignmentStrategy, defaultWrap, childIndent, -1);
}
@Nullable
protected ASTNode processChild(@NotNull final List<Block> result,
@NotNull ASTNode child,
@NotNull AlignmentStrategy alignmentStrategy,
final Wrap defaultWrap,
final Indent childIndent,
int childOffset) {
final IElementType childType = child.getElementType();
if (childType == JavaTokenType.CLASS_KEYWORD || childType == JavaTokenType.INTERFACE_KEYWORD) {
myIsAfterClassKeyword = true;
}
if (childType == JavaElementType.METHOD_CALL_EXPRESSION) {
Alignment alignment = shouldAlignChild(child) ? alignmentStrategy.getAlignment(childType) : null;
result.add(createMethodCallExpressionBlock(child, arrangeChildWrap(child, defaultWrap), alignment, childIndent));
}
else {
IElementType nodeType = myNode.getElementType();
if (nodeType == JavaElementType.POLYADIC_EXPRESSION) nodeType = JavaElementType.BINARY_EXPRESSION;
if (childType == JavaTokenType.LBRACE && nodeType == JavaElementType.ARRAY_INITIALIZER_EXPRESSION) {
final Wrap wrap = Wrap.createWrap(getWrapType(mySettings.ARRAY_INITIALIZER_WRAP), false);
child = processParenthesisBlock(JavaTokenType.LBRACE, JavaTokenType.RBRACE,
result,
child,
WrappingStrategy.createDoNotWrapCommaStrategy(wrap),
mySettings.ALIGN_MULTILINE_ARRAY_INITIALIZER_EXPRESSION);
}
else if (childType == JavaTokenType.LBRACE && nodeType == JavaElementType.ANNOTATION_ARRAY_INITIALIZER) {
final Wrap wrap = Wrap.createWrap(getWrapType(mySettings.ARRAY_INITIALIZER_WRAP), false);
child = processParenthesisBlock(JavaTokenType.LBRACE, JavaTokenType.RBRACE,
result,
child,
WrappingStrategy.createDoNotWrapCommaStrategy(wrap),
mySettings.ALIGN_MULTILINE_ARRAY_INITIALIZER_EXPRESSION);
}
else if (childType == JavaTokenType.LPARENTH && nodeType == JavaElementType.EXPRESSION_LIST) {
final Wrap wrap = Wrap.createWrap(getWrapType(mySettings.CALL_PARAMETERS_WRAP), false);
if (mySettings.PREFER_PARAMETERS_WRAP && !isInsideMethodCall(myNode.getPsi())) {
wrap.ignoreParentWraps();
}
child = processParenthesisBlock(result, child,
WrappingStrategy.createDoNotWrapCommaStrategy(wrap),
mySettings.ALIGN_MULTILINE_PARAMETERS_IN_CALLS);
}
else if (childType == JavaTokenType.LPARENTH && nodeType == JavaElementType.PARAMETER_LIST) {
ASTNode parent = myNode.getTreeParent();
boolean isLambdaParameterList = parent != null && parent.getElementType() == JavaElementType.LAMBDA_EXPRESSION;
Wrap wrapToUse = isLambdaParameterList ? null : getMethodParametersWrap();
WrappingStrategy wrapStrategy = WrappingStrategy.createDoNotWrapCommaStrategy(wrapToUse);
child = processParenthesisBlock(result, child, wrapStrategy, mySettings.ALIGN_MULTILINE_PARAMETERS);
}
else if (childType == JavaTokenType.LPARENTH && nodeType == JavaElementType.RESOURCE_LIST) {
Wrap wrap = Wrap.createWrap(getWrapType(mySettings.RESOURCE_LIST_WRAP), false);
child = processParenthesisBlock(result, child,
WrappingStrategy.createDoNotWrapCommaStrategy(wrap),
mySettings.ALIGN_MULTILINE_RESOURCES);
}
else if (childType == JavaTokenType.LPARENTH && nodeType == JavaElementType.ANNOTATION_PARAMETER_LIST) {
Wrap wrap = Wrap.createWrap(getWrapType(myJavaSettings.ANNOTATION_PARAMETER_WRAP), false);
child = processParenthesisBlock(result, child,
WrappingStrategy.createDoNotWrapCommaStrategy(wrap),
myJavaSettings.ALIGN_MULTILINE_ANNOTATION_PARAMETERS);
}
else if (childType == JavaTokenType.LPARENTH && nodeType == JavaElementType.PARENTH_EXPRESSION) {
child = processParenthesisBlock(result, child,
WrappingStrategy.DO_NOT_WRAP,
mySettings.ALIGN_MULTILINE_PARENTHESIZED_EXPRESSION);
}
else if (childType == JavaElementType.ENUM_CONSTANT && myNode instanceof ClassElement) {
child = processEnumBlock(result, child, ((ClassElement)myNode).findEnumConstantListDelimiterPlace());
}
else if (mySettings.TERNARY_OPERATION_SIGNS_ON_NEXT_LINE && isTernaryOperationSign(child)) {
child = processTernaryOperationRange(result, child, defaultWrap, childIndent);
}
else if (childType == JavaElementType.FIELD) {
child = processField(result, child, alignmentStrategy, defaultWrap, childIndent);
}
else if (childType == JavaElementType.LOCAL_VARIABLE
|| childType == JavaElementType.DECLARATION_STATEMENT
&& (nodeType == JavaElementType.METHOD || nodeType == JavaElementType.CODE_BLOCK))
{
result.add(new SimpleJavaBlock(child, defaultWrap, alignmentStrategy, childIndent, mySettings, myJavaSettings));
}
else {
Alignment alignment = alignmentStrategy.getAlignment(childType);
AlignmentStrategy alignmentStrategyToUse = shouldAlignChild(child)
? AlignmentStrategy.wrap(alignment)
: AlignmentStrategy.getNullStrategy();
if (myAlignmentStrategy.getAlignment(nodeType, childType) != null &&
(nodeType == JavaElementType.IMPLEMENTS_LIST || nodeType == JavaElementType.CLASS)) {
alignmentStrategyToUse = myAlignmentStrategy;
}
Wrap wrap = arrangeChildWrap(child, defaultWrap);
Block block = createJavaBlock(child, mySettings, myJavaSettings, childIndent, wrap, alignmentStrategyToUse, childOffset);
if (block instanceof AbstractJavaBlock) {
final AbstractJavaBlock javaBlock = (AbstractJavaBlock)block;
if (nodeType == JavaElementType.METHOD_CALL_EXPRESSION && childType == JavaElementType.REFERENCE_EXPRESSION ||
nodeType == JavaElementType.REFERENCE_EXPRESSION && childType == JavaElementType.METHOD_CALL_EXPRESSION) {
javaBlock.setReservedWrap(getReservedWrap(nodeType), nodeType);
javaBlock.setReservedWrap(getReservedWrap(childType), childType);
}
else if (nodeType == JavaElementType.BINARY_EXPRESSION) {
javaBlock.setReservedWrap(defaultWrap, nodeType);
}
}
result.add(block);
}
}
return child;
}
private boolean isInsideMethodCall(@NotNull PsiElement element) {
PsiElement e = element.getParent();
int parentsVisited = 0;
while (e != null && !(e instanceof PsiStatement) && parentsVisited < 5) {
if (e instanceof PsiExpressionList) {
return true;
}
e = e.getParent();
parentsVisited++;
}
return false;
}
@NotNull
private Wrap getMethodParametersWrap() {
Wrap preferredWrap = getModifierListWrap();
if (preferredWrap == null) {
return Wrap.createWrap(getWrapType(mySettings.METHOD_PARAMETERS_WRAP), false);
} else {
return Wrap.createChildWrap(preferredWrap, getWrapType(mySettings.METHOD_PARAMETERS_WRAP), false);
}
}
@Nullable
private Wrap getModifierListWrap() {
AbstractJavaBlock parentBlock = getParentBlock();
if (parentBlock != null) {
return parentBlock.getReservedWrap(JavaElementType.MODIFIER_LIST);
}
return null;
}
private ASTNode processField(@NotNull final List<Block> result,
ASTNode child,
@NotNull final AlignmentStrategy alignmentStrategy,
final Wrap defaultWrap,
final Indent childIndent) {
ASTNode lastFieldInGroup = findLastFieldInGroup(child);
if (lastFieldInGroup == child) {
result.add(createJavaBlock(child, getSettings(), myJavaSettings, childIndent, arrangeChildWrap(child, defaultWrap), alignmentStrategy));
return child;
}
else {
final ArrayList<Block> localResult = new ArrayList<Block>();
while (child != null) {
if (!FormatterUtil.containsWhiteSpacesOnly(child)) {
localResult.add(createJavaBlock(
child, getSettings(), myJavaSettings,
Indent.getContinuationWithoutFirstIndent(myIndentSettings.USE_RELATIVE_INDENTS),
arrangeChildWrap(child, defaultWrap),
alignmentStrategy
)
);
}
if (child == lastFieldInGroup) break;
child = child.getTreeNext();
}
if (!localResult.isEmpty()) {
result.add(new SyntheticCodeBlock(localResult, null, getSettings(), myJavaSettings, childIndent, null));
}
return lastFieldInGroup;
}
}
@Nullable
private ASTNode processTernaryOperationRange(@NotNull final List<Block> result,
@NotNull final ASTNode child,
final Wrap defaultWrap,
final Indent childIndent) {
final ArrayList<Block> localResult = new ArrayList<Block>();
final Wrap wrap = arrangeChildWrap(child, defaultWrap);
final Alignment alignment = myReservedAlignment;
final Alignment alignment2 = myReservedAlignment2;
localResult.add(new LeafBlock(child, wrap, chooseAlignment(alignment, alignment2, child), childIndent));
ASTNode current = child.getTreeNext();
while (current != null) {
if (!FormatterUtil.containsWhiteSpacesOnly(current) && current.getTextLength() > 0) {
if (isTernaryOperationSign(current)) break;
current = processChild(localResult, current, chooseAlignment(alignment, alignment2, current), defaultWrap, childIndent);
}
if (current != null) {
current = current.getTreeNext();
}
}
result.add(new SyntheticCodeBlock(localResult, chooseAlignment(alignment, alignment2, child), getSettings(), myJavaSettings, null, wrap));
if (current == null) {
return null;
}
return current.getTreePrev();
}
private boolean isTernaryOperationSign(@NotNull final ASTNode child) {
if (myNode.getElementType() != JavaElementType.CONDITIONAL_EXPRESSION) return false;
final int role = ((CompositeElement)child.getTreeParent()).getChildRole(child);
return role == ChildRole.OPERATION_SIGN || role == ChildRole.COLON;
}
@NotNull
private Block createMethodCallExpressionBlock(@NotNull ASTNode node, Wrap blockWrap, Alignment alignment, Indent indent) {
final ArrayList<ASTNode> nodes = new ArrayList<ASTNode>();
collectNodes(nodes, node);
return new ChainMethodCallsBlockBuilder(alignment, blockWrap, indent, mySettings, myJavaSettings).build(nodes);
}
private static void collectNodes(@NotNull List<ASTNode> nodes, @NotNull ASTNode node) {
ASTNode child = node.getFirstChildNode();
while (child != null) {
if (!FormatterUtil.containsWhiteSpacesOnly(child)) {
if (child.getElementType() == JavaElementType.METHOD_CALL_EXPRESSION || child.getElementType() ==
JavaElementType
.REFERENCE_EXPRESSION) {
collectNodes(nodes, child);
}
else {
nodes.add(child);
}
}
child = child.getTreeNext();
}
}
private boolean shouldAlignChild(@NotNull final ASTNode child) {
int role = getChildRole(child);
final IElementType nodeType = myNode.getElementType();
if (nodeType == JavaElementType.FOR_STATEMENT) {
if (role == ChildRole.FOR_INITIALIZATION || role == ChildRole.CONDITION || role == ChildRole.FOR_UPDATE) {
return true;
}
return false;
}
else if (nodeType == JavaElementType.EXTENDS_LIST || nodeType == JavaElementType.IMPLEMENTS_LIST) {
if (role == ChildRole.REFERENCE_IN_LIST || role == ChildRole.IMPLEMENTS_KEYWORD) {
return true;
}
return false;
}
else if (nodeType == JavaElementType.THROWS_LIST) {
if (role == ChildRole.REFERENCE_IN_LIST) {
return true;
}
return false;
}
else if (nodeType == JavaElementType.CLASS) {
if (role == ChildRole.CLASS_OR_INTERFACE_KEYWORD) return true;
if (myIsAfterClassKeyword) return false;
if (role == ChildRole.MODIFIER_LIST) return true;
return false;
}
else if (JavaElementType.FIELD == nodeType) {
return shouldAlignFieldInColumns(child);
}
else if (nodeType == JavaElementType.METHOD) {
if (role == ChildRole.MODIFIER_LIST) return true;
if (role == ChildRole.TYPE_PARAMETER_LIST) return true;
if (role == ChildRole.TYPE) return true;
if (role == ChildRole.NAME) return true;
if (role == ChildRole.THROWS_LIST && mySettings.ALIGN_THROWS_KEYWORD) return true;
return false;
}
else if (nodeType == JavaElementType.ASSIGNMENT_EXPRESSION) {
if (role == ChildRole.LOPERAND) return true;
if (role == ChildRole.ROPERAND && child.getElementType() == JavaElementType.ASSIGNMENT_EXPRESSION) {
return true;
}
return false;
}
else if (child.getElementType() == JavaTokenType.END_OF_LINE_COMMENT) {
ASTNode previous = child.getTreePrev();
// There is a special case - comment block that is located at the very start of the line. We don't reformat such a blocks,
// hence, no alignment should be applied to them in order to avoid subsequent blocks aligned with the same alignment to
// be located at the left editor edge as well.
CharSequence prevChars;
if (previous != null && previous.getElementType() == TokenType.WHITE_SPACE && (prevChars = previous.getChars()).length() > 0
&& prevChars.charAt(prevChars.length() - 1) == '\n') {
return false;
}
return true;
}
else if (nodeType == JavaElementType.MODIFIER_LIST) {
// There is a possible case that modifier list contains from more than one elements, e.g. 'private final'. It's also possible
// that the list is aligned. We want to apply alignment rule only to the first element then.
ASTNode previous = child.getTreePrev();
if (previous == null || previous.getTreeParent() != myNode) {
return true;
}
return false;
}
else {
return true;
}
}
private static int getChildRole(@NotNull ASTNode child) {
return ((CompositeElement)child.getTreeParent()).getChildRole(child);
}
/**
* Encapsulates alignment retrieval logic for variable declaration use-case assuming that given node is a child node
* of basic variable declaration node.
*
* @param child variable declaration child node which alignment is to be defined
* @return alignment to use for the given node
* @see CodeStyleSettings#ALIGN_GROUP_FIELD_DECLARATIONS
*/
@Nullable
private boolean shouldAlignFieldInColumns(@NotNull ASTNode child) {
// The whole idea of variable declarations alignment is that complete declaration blocks which children are to be aligned hold
// reference to the same AlignmentStrategy object, hence, reuse the same Alignment objects. So, there is no point in checking
// if it's necessary to align sub-blocks if shared strategy is not defined.
if (!mySettings.ALIGN_GROUP_FIELD_DECLARATIONS) {
return false;
}
IElementType childType = child.getElementType();
// We don't want to align subsequent identifiers in single-line declarations like 'int i1, i2, i3'. I.e. only 'i1'
// should be aligned then.
ASTNode previousNode = FormatterUtil.getPreviousNonWhitespaceSibling(child);
if (childType == JavaTokenType.IDENTIFIER && (previousNode == null || previousNode.getElementType() == JavaTokenType.COMMA)) {
return false;
}
return true;
}
@Nullable
public static Alignment createAlignment(final boolean alignOption, @Nullable final Alignment defaultAlignment) {
return alignOption ? createAlignmentOrDefault(null, defaultAlignment) : defaultAlignment;
}
@Nullable
public static Alignment createAlignment(Alignment base, final boolean alignOption, @Nullable final Alignment defaultAlignment) {
return alignOption ? createAlignmentOrDefault(base, defaultAlignment) : defaultAlignment;
}
@Nullable
protected Wrap arrangeChildWrap(final ASTNode child, Wrap defaultWrap) {
return myWrapManager.arrangeChildWrap(child, myNode, mySettings, myJavaSettings, defaultWrap, this);
}
@NotNull
private ASTNode processParenthesisBlock(@NotNull List<Block> result,
@NotNull ASTNode child,
@NotNull WrappingStrategy wrappingStrategy,
final boolean doAlign) {
myUseChildAttributes = true;
final IElementType from = JavaTokenType.LPARENTH;
final IElementType to = JavaTokenType.RPARENTH;
return processParenthesisBlock(from, to, result, child, wrappingStrategy, doAlign);
}
@NotNull
private ASTNode processParenthesisBlock(@NotNull IElementType from,
@Nullable final IElementType to,
@NotNull final List<Block> result,
@NotNull ASTNode child,
@NotNull final WrappingStrategy wrappingStrategy,
final boolean doAlign) {
final Indent externalIndent = Indent.getNoneIndent();
final Indent internalIndent = Indent.getContinuationWithoutFirstIndent(myIndentSettings.USE_RELATIVE_INDENTS);
final Indent internalIndentEnforcedToChildren = Indent.getIndent(Indent.Type.CONTINUATION, myIndentSettings.USE_RELATIVE_INDENTS, true);
AlignmentStrategy alignmentStrategy = AlignmentStrategy.wrap(createAlignment(doAlign, null), JavaTokenType.COMMA);
setChildIndent(internalIndent);
setChildAlignment(alignmentStrategy.getAlignment(null));
boolean methodParametersBlock = true;
ASTNode lBracketParent = child.getTreeParent();
if (lBracketParent != null) {
ASTNode methodCandidate = lBracketParent.getTreeParent();
methodParametersBlock = methodCandidate != null && (methodCandidate.getElementType() == JavaElementType.METHOD
|| methodCandidate.getElementType() == JavaElementType.METHOD_CALL_EXPRESSION);
}
Alignment bracketAlignment = methodParametersBlock && mySettings.ALIGN_MULTILINE_METHOD_BRACKETS ? Alignment.createAlignment() : null;
AlignmentStrategy anonymousClassStrategy = doAlign ? alignmentStrategy
: AlignmentStrategy.wrap(Alignment.createAlignment(),
false,
JavaTokenType.NEW_KEYWORD,
JavaElementType.NEW_EXPRESSION,
JavaTokenType.RBRACE);
setChildIndent(internalIndent);
setChildAlignment(alignmentStrategy.getAlignment(null));
boolean isAfterIncomplete = false;
ASTNode prev = child;
boolean afterAnonymousClass = false;
final boolean enforceIndent = shouldEnforceIndentToChildren();
while (child != null) {
isAfterIncomplete = isAfterIncomplete || child.getElementType() == TokenType.ERROR_ELEMENT ||
child.getElementType() == JavaElementType.EMPTY_EXPRESSION;
if (!FormatterUtil.containsWhiteSpacesOnly(child) && child.getTextLength() > 0) {
if (child.getElementType() == from) {
result.add(createJavaBlock(child, mySettings, myJavaSettings, externalIndent, null, bracketAlignment));
}
else if (child.getElementType() == to) {
result.add(createJavaBlock(child, mySettings, myJavaSettings,
isAfterIncomplete && !afterAnonymousClass ? internalIndent : externalIndent,
null,
isAfterIncomplete ? alignmentStrategy.getAlignment(null) : bracketAlignment)
);
return child;
}
else {
final IElementType elementType = child.getElementType();
Indent indentToUse = enforceIndent ? internalIndentEnforcedToChildren : internalIndent;
AlignmentStrategy alignmentStrategyToUse = canUseAnonymousClassAlignment(child) ? anonymousClassStrategy : alignmentStrategy;
processChild(result, child, alignmentStrategyToUse.getAlignment(elementType), wrappingStrategy.getWrap(elementType), indentToUse);
if (to == null) {//process only one statement
return child;
}
}
isAfterIncomplete = false;
if (child.getElementType() != JavaTokenType.COMMA) {
afterAnonymousClass = isAnonymousClass(child);
}
}
prev = child;
child = child.getTreeNext();
}
return prev;
}
private static boolean canUseAnonymousClassAlignment(@NotNull ASTNode child) {
// The general idea is to handle situations like below:
// test(new Runnable() {
// public void run() {
// }
// }, new Runnable() {
// public void run() {
// }
// }
// );
// I.e. we want to align subsequent anonymous class argument to the previous one if it's not preceded by another argument
// at the same line, e.g.:
// test("this is a long argument", new Runnable() {
// public void run() {
// }
// }, new Runnable() {
// public void run() {
// }
// }
// );
if (!isAnonymousClass(child)) {
return false;
}
for (ASTNode node = child.getTreePrev(); node != null; node = node.getTreePrev()) {
if (node.getElementType() == TokenType.WHITE_SPACE) {
if (StringUtil.countNewLines(node.getChars()) > 0) {
return false;
}
}
else if (node.getElementType() == JavaTokenType.LPARENTH) {
// First method call argument.
return true;
}
else if (node.getElementType() != JavaTokenType.COMMA && !isAnonymousClass(node)) {
return false;
}
}
return true;
}
private boolean shouldEnforceIndentToChildren() {
if (myNode.getElementType() != JavaElementType.EXPRESSION_LIST) {
return false;
}
ASTNode parent = myNode.getTreeParent();
if (parent == null || parent.getElementType() != JavaElementType.METHOD_CALL_EXPRESSION) {
return false;
}
PsiExpression[] arguments = ((PsiExpressionList)myNode.getPsi()).getExpressions();
return JavaFormatterUtil.hasMultilineArguments(arguments) && JavaFormatterUtil.isMultilineExceptArguments(arguments);
}
private static boolean isAnonymousClass(@Nullable ASTNode node) {
if (node == null || node.getElementType() != JavaElementType.NEW_EXPRESSION) {
return false;
}
ASTNode lastChild = node.getLastChildNode();
return lastChild != null && lastChild.getElementType() == JavaElementType.ANONYMOUS_CLASS;
}
@Nullable
private ASTNode processEnumBlock(@NotNull List<Block> result,
@Nullable ASTNode child,
ASTNode last)
{
final WrappingStrategy wrappingStrategy = WrappingStrategy.createDoNotWrapCommaStrategy(Wrap
.createWrap(getWrapType(mySettings.ENUM_CONSTANTS_WRAP), true));
while (child != null) {
if (!FormatterUtil.containsWhiteSpacesOnly(child) && child.getTextLength() > 0) {
result.add(createJavaBlock(child, mySettings, myJavaSettings, Indent.getNormalIndent(),
wrappingStrategy.getWrap(child.getElementType()), AlignmentStrategy.getNullStrategy()));
if (child == last) return child;
}
child = child.getTreeNext();
}
return null;
}
private void setChildAlignment(final Alignment alignment) {
myChildAlignment = alignment;
}
private void setChildIndent(final Indent internalIndent) {
myChildIndent = internalIndent;
}
@Nullable
private static Alignment createAlignmentOrDefault(@Nullable Alignment base, @Nullable final Alignment defaultAlignment) {
if (defaultAlignment == null) {
return base == null ? Alignment.createAlignment() : Alignment.createChildAlignment(base);
}
return defaultAlignment;
}
private int getBraceStyle() {
final PsiElement psiNode = SourceTreeToPsiMap.treeElementToPsi(myNode);
if (psiNode instanceof PsiClass) {
return mySettings.CLASS_BRACE_STYLE;
}
if (psiNode instanceof PsiMethod
|| psiNode instanceof PsiCodeBlock && psiNode.getParent() != null && psiNode.getParent() instanceof PsiMethod) {
return mySettings.METHOD_BRACE_STYLE;
}
return mySettings.BRACE_STYLE;
}
protected Indent getCodeBlockInternalIndent(final int baseChildrenIndent) {
return getCodeBlockInternalIndent(baseChildrenIndent, false);
}
protected Indent getCodeBlockInternalIndent(final int baseChildrenIndent, boolean enforceParentIndent) {
if (isTopLevelClass() && mySettings.DO_NOT_INDENT_TOP_LEVEL_CLASS_MEMBERS) {
return Indent.getNoneIndent();
}
final int braceStyle = getBraceStyle();
return braceStyle == CommonCodeStyleSettings.NEXT_LINE_SHIFTED ?
createNormalIndent(baseChildrenIndent - 1, enforceParentIndent)
: createNormalIndent(baseChildrenIndent, enforceParentIndent);
}
protected static Indent createNormalIndent(final int baseChildrenIndent) {
return createNormalIndent(baseChildrenIndent, false);
}
protected static Indent createNormalIndent(final int baseChildrenIndent, boolean enforceIndentToChildren) {
if (baseChildrenIndent == 1) {
return Indent.getIndent(Indent.Type.NORMAL, false, enforceIndentToChildren);
}
else if (baseChildrenIndent <= 0) {
return Indent.getNoneIndent();
}
else {
LOG.assertTrue(false);
return Indent.getIndent(Indent.Type.NORMAL, false, enforceIndentToChildren);
}
}
private boolean isTopLevelClass() {
return myNode.getElementType() == JavaElementType.CLASS &&
SourceTreeToPsiMap.treeElementToPsi(myNode.getTreeParent()) instanceof PsiFile;
}
protected Indent getCodeBlockExternalIndent() {
final int braceStyle = getBraceStyle();
if (braceStyle == CommonCodeStyleSettings.END_OF_LINE || braceStyle == CommonCodeStyleSettings.NEXT_LINE ||
braceStyle == CommonCodeStyleSettings.NEXT_LINE_IF_WRAPPED) {
return Indent.getNoneIndent();
}
return Indent.getNormalIndent();
}
protected Indent getCodeBlockChildExternalIndent(final int newChildIndex) {
final int braceStyle = getBraceStyle();
if (!isAfterCodeBlock(newChildIndex)) {
return Indent.getNormalIndent();
}
if (braceStyle == CommonCodeStyleSettings.NEXT_LINE ||
braceStyle == CommonCodeStyleSettings.NEXT_LINE_IF_WRAPPED ||
braceStyle == CommonCodeStyleSettings.END_OF_LINE) {
return Indent.getNoneIndent();
}
return Indent.getNormalIndent();
}
private boolean isAfterCodeBlock(final int newChildIndex) {
if (newChildIndex == 0) return false;
Block blockBefore = getSubBlocks().get(newChildIndex - 1);
return blockBefore instanceof CodeBlockBlock;
}
/**
* <b>Note:</b> this method is considered to be a legacy heritage and is assumed to be removed as soon as formatting processing
* is refactored
*
* @param elementType target element type
* @return <code>null</code> all the time
*/
@Nullable
@Override
public Wrap getReservedWrap(IElementType elementType) {
return myPreferredWraps != null ? myPreferredWraps.get(elementType) : null;
}
/**
* Defines contract for associating operation type and particular wrap instance. I.e. given wrap object <b>may</b> be returned
* from subsequent {@link #getReservedWrap(IElementType)} call if given operation type is used as an argument there.
* <p/>
* Default implementation ({@link AbstractJavaBlock#setReservedWrap(Wrap, IElementType)}) does nothing.
* <p/>
* <b>Note:</b> this method is considered to be a legacy heritage and is assumed to be removed as soon as formatting processing
* is refactored
*
* @param reservedWrap reserved wrap instance
* @param operationType target operation type to associate with the given wrap instance
*/
public void setReservedWrap(final Wrap reservedWrap, final IElementType operationType) {
if (myPreferredWraps == null) {
myPreferredWraps = ContainerUtil.newHashMap();
}
myPreferredWraps.put(operationType, reservedWrap);
}
@Nullable
protected static ASTNode getTreeNode(final Block child2) {
if (child2 instanceof JavaBlock) {
return ((JavaBlock)child2).getFirstTreeNode();
}
if (child2 instanceof LeafBlock) {
return ((LeafBlock)child2).getTreeNode();
}
return null;
}
@Override
@NotNull
public ChildAttributes getChildAttributes(final int newChildIndex) {
if (myUseChildAttributes) {
return new ChildAttributes(myChildIndent, myChildAlignment);
}
if (isAfter(newChildIndex, new IElementType[]{JavaDocElementType.DOC_COMMENT})) {
return new ChildAttributes(Indent.getNoneIndent(), myChildAlignment);
}
return super.getChildAttributes(newChildIndex);
}
@Override
@Nullable
protected Indent getChildIndent() {
return getChildIndent(myNode, myIndentSettings);
}
@NotNull
public CommonCodeStyleSettings getSettings() {
return mySettings;
}
protected boolean isAfter(final int newChildIndex, @NotNull final IElementType[] elementTypes) {
if (newChildIndex == 0) return false;
final Block previousBlock = getSubBlocks().get(newChildIndex - 1);
if (!(previousBlock instanceof AbstractBlock)) return false;
final IElementType previousElementType = ((AbstractBlock)previousBlock).getNode().getElementType();
for (IElementType elementType : elementTypes) {
if (previousElementType == elementType) return true;
}
return false;
}
@Nullable
protected Alignment getUsedAlignment(final int newChildIndex) {
final List<Block> subBlocks = getSubBlocks();
for (int i = 0; i < newChildIndex; i++) {
if (i >= subBlocks.size()) return null;
final Block block = subBlocks.get(i);
final Alignment alignment = block.getAlignment();
if (alignment != null) return alignment;
}
return null;
}
@Override
public boolean isLeaf() {
return ShiftIndentInsideHelper.mayShiftIndentInside(myNode);
}
@Nullable
protected ASTNode composeCodeBlock(@NotNull final List<Block> result,
ASTNode child,
final Indent indent,
final int childrenIndent,
@Nullable final Wrap childWrap) {
final ArrayList<Block> localResult = new ArrayList<Block>();
processChild(localResult, child, AlignmentStrategy.getNullStrategy(), null, Indent.getNoneIndent());
child = child.getTreeNext();
ChildAlignmentStrategyProvider alignmentStrategyProvider = getStrategyProvider();
while (child != null) {
if (FormatterUtil.containsWhiteSpacesOnly(child)) {
child = child.getTreeNext();
continue;
}
Indent childIndent = getIndentForCodeBlock(child, childrenIndent);
AlignmentStrategy alignmentStrategyToUse = alignmentStrategyProvider.getNextChildStrategy(child);
final boolean isRBrace = isRBrace(child);
child = processChild(localResult, child, alignmentStrategyToUse, childWrap, childIndent);
if (isRBrace) {
result.add(createCodeBlockBlock(localResult, indent, childrenIndent));
return child;
}
if (child != null) {
child = child.getTreeNext();
}
}
result.add(createCodeBlockBlock(localResult, indent, childrenIndent));
return null;
}
private ChildAlignmentStrategyProvider getStrategyProvider() {
if (mySettings.ALIGN_GROUP_FIELD_DECLARATIONS && myNode.getElementType() == JavaElementType.CLASS) {
return new SubsequentFieldAligner(mySettings);
}
ASTNode parent = myNode.getTreeParent();
IElementType parentType = parent != null ? parent.getElementType() : null;
if (mySettings.ALIGN_CONSECUTIVE_VARIABLE_DECLARATIONS && parentType == JavaElementType.METHOD) {
return new SubsequentVariablesAligner();
}
return ChildAlignmentStrategyProvider.NULL_STRATEGY_PROVIDER;
}
private Indent getIndentForCodeBlock(ASTNode child, int childrenIndent) {
if (child.getElementType() == JavaElementType.CODE_BLOCK
&& (getBraceStyle() == CommonCodeStyleSettings.NEXT_LINE_SHIFTED
|| getBraceStyle() == CommonCodeStyleSettings.NEXT_LINE_SHIFTED2))
{
return Indent.getNormalIndent();
}
return isRBrace(child) ? Indent.getNoneIndent() : getCodeBlockInternalIndent(childrenIndent, false);
}
public AbstractJavaBlock getParentBlock() {
return myParentBlock;
}
public void setParentBlock(@NotNull AbstractJavaBlock parentBlock) {
myParentBlock = parentBlock;
}
@NotNull
public SyntheticCodeBlock createCodeBlockBlock(final List<Block> localResult, final Indent indent, final int childrenIndent) {
final SyntheticCodeBlock result = new SyntheticCodeBlock(localResult, null, getSettings(), myJavaSettings, indent, null);
result.setChildAttributes(new ChildAttributes(getCodeBlockInternalIndent(childrenIndent), null));
return result;
}
}
| robovm/robovm-studio | java/java-impl/src/com/intellij/psi/formatter/java/AbstractJavaBlock.java | Java | apache-2.0 | 55,736 | [
30522,
1013,
1008,
1008,
9385,
2456,
1011,
2297,
6892,
10024,
7076,
1055,
1012,
1054,
1012,
1051,
1012,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
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... |
package com.mob.thor.rpc.common.utils;
import java.util.Iterator;
import java.util.List;
import org.apache.log4j.Level;
import com.mob.thor.rpc.common.logger.Logger;
import com.mob.thor.rpc.common.logger.LoggerFactory;
public class LogUtil {
private static Logger Log = LoggerFactory.getLogger(LogUtil.class);
public static void start() {
DubboAppender.doStart();
}
public static void stop() {
DubboAppender.doStop();
}
public static boolean checkNoError() {
if (findLevel(Level.ERROR) == 0) {
return true;
} else {
return false;
}
}
public static int findName(String expectedLogName) {
int count = 0;
List<Log> logList = DubboAppender.logList;
for (int i = 0; i < logList.size(); i++) {
String logName = logList.get(i).getLogName();
if (logName.contains(expectedLogName)) count++;
}
return count;
}
public static int findLevel(Level expectedLevel) {
int count = 0;
List<Log> logList = DubboAppender.logList;
for (int i = 0; i < logList.size(); i++) {
Level logLevel = logList.get(i).getLogLevel();
if (logLevel.equals(expectedLevel)) count++;
}
return count;
}
public static int findLevelWithThreadName(Level expectedLevel, String threadName) {
int count = 0;
List<Log> logList = DubboAppender.logList;
for (int i = 0; i < logList.size(); i++) {
Log log = logList.get(i);
if (log.getLogLevel().equals(expectedLevel) && log.getLogThread().equals(threadName)) count++;
}
return count;
}
public static int findThread(String expectedThread) {
int count = 0;
List<Log> logList = DubboAppender.logList;
for (int i = 0; i < logList.size(); i++) {
String logThread = logList.get(i).getLogThread();
if (logThread.contains(expectedThread)) count++;
}
return count;
}
public static int findMessage(String expectedMessage) {
int count = 0;
List<Log> logList = DubboAppender.logList;
for (int i = 0; i < logList.size(); i++) {
String logMessage = logList.get(i).getLogMessage();
if (logMessage.contains(expectedMessage)) count++;
}
return count;
}
public static int findMessage(Level expectedLevel, String expectedMessage) {
int count = 0;
List<Log> logList = DubboAppender.logList;
for (int i = 0; i < logList.size(); i++) {
Level logLevel = logList.get(i).getLogLevel();
if (logLevel.equals(expectedLevel)) {
String logMessage = logList.get(i).getLogMessage();
if (logMessage.contains(expectedMessage)) count++;
}
}
return count;
}
public static <T> void printList(List<T> list) {
Log.info("PrintList:");
Iterator<T> it = list.iterator();
while (it.hasNext()) {
Log.info(it.next().toString());
}
}
}
| MOBX/Thor | thor-rpc/src/main/java/com/mob/thor/rpc/common/utils/LogUtil.java | Java | apache-2.0 | 3,230 | [
30522,
7427,
4012,
1012,
11240,
1012,
15321,
1012,
1054,
15042,
1012,
2691,
1012,
21183,
12146,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
2009,
6906,
4263,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
2862,
1025,
12324,
8917,
1012,
15895,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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\Inflector;
use yii\helpers\StringHelper;
/* @var $this yii\web\View */
/* @var $generator backend\modules\gii\giiTemplates\crud\Generator */
/* @var $model \yii\db\ActiveRecord */
$model = new $generator->modelClass;
$safeAttributes = $model->safeAttributes();
if (empty($safeAttributes)) {
$safeAttributes = $model->attributes();
}
$dontGenerateAttributes = ['created_by', 'created_at', 'updated_by', 'updated_at', 'slug'];
foreach ($safeAttributes as $i => $attribute) {
if (in_array($attribute, $dontGenerateAttributes)) {
unset($safeAttributes[$i]);
}
}
$modelVariable = Inflector::variablize(StringHelper::basename($generator->modelClass));
/*TODO: (ruben) insert "use ClassName" to use allow the use of getMappedArray*/
echo "<?php\n";
?>
use yii\helpers\Html;
use yii\widgets\ActiveForm;
<?php if ($generator->useSummernoteOnTextFields && $generator->hasTextFields()): ?>
use Zelenin\yii\widgets\Summernote\Summernote;
<?php endif; ?>
<?php if ($generator->useSelect2ForHasManyRelations): ?>
use \kartik\select2\Select2;
<?php endif; ?>
<?php if ($generator->hasImageFields()): ?>
use kartik\file\FileInput;
<?php endif; ?>
/* @var $this yii\web\View */
/* @var $<?= $modelVariable ?> <?= ltrim($generator->modelClass, '\\') ?> */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="<?= Inflector::camel2id(StringHelper::basename($generator->modelClass)) ?>-form">
<?php if ($generator->hasFileFields()): ?>
<?= "<?php " ?>$form = ActiveForm::begin(['options' => ['enctype'=>'multipart/form-data'],]); ?>
<?php else: ?>
<?= "<?php " ?>$form = ActiveForm::begin(); ?>
<?php endif; ?>
<?php foreach ($generator->getColumnNames() as $attribute) {
if (in_array($attribute, $safeAttributes)) {
echo " <?= " . $generator->generateActiveField($attribute) . " ?>\n\n";
}
} ?>
<?php if ($generator->useSelect2ForHasManyRelations): ?>
<?php foreach ($generator->getAllJunctionRelations() as $multipleRelation): ?>
<?php
$class = $generator->modelClass;
$modelVariable = $generator->variablize($class);
$relationName = $multipleRelation['name'];
$pkRelatedTable = $multipleRelation['pkRelatedTable'];
$nameRelatedTable = $multipleRelation['nameRelatedTable'];
$relatedClassAndNamespace = $generator->getNameSpace() . '\\' . $nameRelatedTable;
?>
<div class="form-group">
<label class="control-label" for="<?= $modelVariable ?>-<?= $relationName ?>">
<?= "<?= \${$modelVariable}->getAttributeLabel('{$relationName}') ?>" ?>
</label>
<?= " <?= " ?>
Select2::widget([
'name' => '<?= $relationName ?>',
'data' => <?= $relatedClassAndNamespace ?>::getMappedArray(),
'value' => $<?= $modelVariable ?>->getColumnFromRelation('<?= $pkRelatedTable ?>', '<?= $relationName ?>'),
'options' => [
'placeholder' => 'Select a <?= $nameRelatedTable ?> ...',
'multiple' => true,
],
'pluginOptions' => [
'tags' => true,
'tokenSeparators' => [','],
],
]);
<?= " ?> " ?>
</div>
<?php endforeach; ?>
<?php endif; ?>
<div class="form-group">
<?= "<?= " ?>Html::submitButton($<?= $modelVariable ?>->isNewRecord ? <?= $generator->generateString('Create') ?> : <?= $generator->generateString('Update') ?>, ['class' => $<?= $modelVariable ?>->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?= "<?php " ?>ActiveForm::end(); ?>
| RubenDjOn/PrivateTeacher | backend/modules/gii/giiTemplates/crud/defaultTemplate/views/_form.php | PHP | gpl-2.0 | 3,844 | [
30522,
1026,
1029,
25718,
2224,
12316,
2072,
1032,
2393,
2545,
1032,
1999,
21031,
16761,
1025,
2224,
12316,
2072,
1032,
2393,
2545,
1032,
5164,
16001,
4842,
1025,
1013,
1008,
1030,
13075,
1002,
2023,
12316,
2072,
1032,
4773,
1032,
3193,
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... |
// =============================================================================
// PROJECT CHRONO - http://projectchrono.org
//
// Copyright (c) 2014 projectchrono.org
// All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file at the top level of the distribution and at
// http://projectchrono.org/license-chrono.txt.
//
// =============================================================================
// Authors: Alessandro Tasora
// =============================================================================
#include "chrono/fea/ChMaterialShellKirchhoff.h"
namespace chrono {
namespace fea {
void ChElasticityKirchhoff::ComputeStiffnessMatrix(ChMatrixRef mC,
const ChVector<>& eps,
const ChVector<>& kur,
const double z_inf,
const double z_sup,
const double angle) {
assert(mC.rows() == 6);
assert(mC.cols() == 6);
mC.setZero();
ChVectorN<double, 6> strain_0;
strain_0.segment(0, 3) = eps.eigen();
strain_0.segment(3, 3) = kur.eigen();
ChVector<> n, m;
this->ComputeStress(n, m, eps, kur, z_inf, z_sup, angle);
ChVectorN<double, 6> stress_0;
stress_0.segment(0,3) = n.eigen();
stress_0.segment(3,3) = m.eigen();
double delta = 1e-9;
for (int i = 0; i < 6; ++i) {
strain_0(i, 0) += delta;
ChVector<> deps(strain_0.segment(0, 3));
ChVector<> dkur(strain_0.segment(3, 3));
this->ComputeStress(n,m, deps, dkur, z_inf, z_sup, angle);
ChVectorN<double, 6> stress_1;
stress_1.segment(0,3) = n.eigen();
stress_1.segment(3,3) = m.eigen();
ChVectorN<double, 6> stress_d = (1. / delta) * (stress_1 - stress_0);
mC.block(0, i, 6, 1) = stress_d;
strain_0(i, 0) -= delta;
}
}
//--------------------------------------------------------------
ChElasticityKirchhoffIsothropic::ChElasticityKirchhoffIsothropic( double E,
double nu) {
m_E = E;
m_nu = nu;
}
void ChElasticityKirchhoffIsothropic::ComputeStress( ChVector<>& n,
ChVector<>& m,
const ChVector<>& eps,
const ChVector<>& kur,
const double z_inf,
const double z_sup,
const double angle) {
if (z_inf == -z_sup) {
// simplified computation for centered layer
double h = z_sup - z_inf;
double G = m_E / (2. * (1. + m_nu));
double C = m_E * h / (1. - m_nu * m_nu);
double D = C * h * h / 12.;
double F = G * h * h * h / 12.;
n.x() = eps.x() * C + eps.y() * m_nu * C;
n.y() = eps.y() * C + eps.x() * m_nu * C;
n.z() = eps.z() * G * h;
m.x() = kur.x() * D + kur.y() * (m_nu * D);
m.y() = kur.y() * D + kur.x() * (m_nu * D);
m.z() = kur.z() * F;
} else {
double G = m_E / (2. * (1. + m_nu));
double Q11 = m_E / (1. - m_nu * m_nu);
double Q22 = Q11;
double Q12 = m_nu * Q11;
double Q33 = G;
double h1 = z_sup - z_inf;
double h2 = 0.5 * (pow(z_sup, 2) - pow(z_inf, 2));
double h3 = (1. / 3.) * (pow(z_sup, 3) - pow(z_inf, 3));
ChMatrix33<> Q;
Q(0, 0) = m_E / (1. - m_nu * m_nu);
Q(0, 1) = m_nu * Q(0, 0);
Q(0, 2) = 0;
Q(1, 0) = Q(0, 1);
Q(1, 1) = Q(0, 0);
Q(1, 3) = 0;
Q(2, 0) = 0;
Q(2, 1) = 0;
Q(2, 2) = G;
n = h1 * (Q * eps) + h2 * (Q * kur);
m = h2 * (Q * eps) + h3 * (Q * kur);
}
}
void ChElasticityKirchhoffIsothropic::ComputeStiffnessMatrix(ChMatrixRef mC,
const ChVector<>& eps,
const ChVector<>& kur,
const double z_inf,
const double z_sup,
const double angle) {
assert(mC.rows() == 6);
assert(mC.cols() == 6);
mC.setZero();
if (z_inf == -z_sup) {
// simplified computation for centered layer
double h = z_sup - z_inf;
double G = m_E / (2. * (1. + m_nu));
double C = m_E * h / (1. - m_nu * m_nu);
double D = C * h * h / 12.;
double F = G * h * h * h / 12.;
mC(0, 0) = C;
mC(1, 1) = C;
mC(0, 1) = m_nu * C;
mC(1, 0) = m_nu * C;
mC(2, 2) = G * h;
mC(3, 3) = D;
mC(4, 4) = D;
mC(3, 4) = m_nu * D;
mC(4, 3) = m_nu * D;
mC(5, 5) = F;
} else {
double G = m_E / (2. * (1. + m_nu));
double Q11 = m_E / (1. - m_nu * m_nu);
double Q22 = Q11;
double Q12 = m_nu * Q11;
double Q33 = G;
double h1 = z_sup - z_inf;
double h2 = 0.5 * (pow(z_sup, 2) - pow(z_inf, 2));
double h3 = (1. / 3.) * (pow(z_sup, 3) - pow(z_inf, 3));
ChMatrix33<> Q;
Q(0, 0) = m_E / (1. - m_nu * m_nu);
Q(0, 1) = m_nu * Q(0, 0);
Q(0, 2) = 0;
Q(1, 0) = Q(0, 1);
Q(1, 1) = Q(0, 0);
Q(1, 3) = 0;
Q(2, 0) = 0;
Q(2, 1) = 0;
Q(2, 2) = G;
mC.block<3,3>(0,0) = Q * h1;
mC.block<3,3>(0,3) = Q * h2;
mC.block<3,3>(3,0) = Q * h2;
mC.block<3,3>(3,3) = Q * h3;
}
}
//--------------------------------------------------------------
/// Construct an orthotropic material
ChElasticityKirchhoffOrthotropic::ChElasticityKirchhoffOrthotropic( double m_E_x,
double m_E_y,
double m_nu_xy,
double m_G_xy) {
E_x = m_E_x;
E_y = m_E_y;
nu_xy = m_nu_xy;
G_xy = m_G_xy;
}
ChElasticityKirchhoffOrthotropic::ChElasticityKirchhoffOrthotropic( double m_E,
double m_nu) {
double m_G = m_E / (2. * (1. + m_nu)); // default value of G for special subcase of isotropic constructor
this->E_x = m_E;
this->E_y = m_E;
this->nu_xy = m_nu;
this->G_xy = m_G;
}
void ChElasticityKirchhoffOrthotropic::ComputeStress (ChVector<>& n,
ChVector<>& m,
const ChVector<>& eps,
const ChVector<>& kur,
const double z_inf,
const double z_sup,
const double angle) {
// Since it is a linear material, just compute S by using the
// constitutive matrix, as S = C*eps, where S={n, m}
ChMatrixNM<double, 6, 6> mC;
this->ComputeStiffnessMatrix(mC, eps, kur, z_inf, z_sup, angle);
ChVectorN<double, 6> ek;
ek.segment(0,3) = eps.eigen();
ek.segment(3,3) = kur.eigen();
ChVectorN<double, 6> Sigma = mC * ek;
n = Sigma.segment(0, 3);
m = Sigma.segment(3, 3);
}
void ChElasticityKirchhoffOrthotropic::ComputeStiffnessMatrix(ChMatrixRef mC,
const ChVector<>& eps,
const ChVector<>& kur,
const double z_inf,
const double z_sup,
const double angle) {
assert(mC.rows() == 6);
assert(mC.cols() == 6);
mC.setZero();
// Compute Qm_local for inplane stresses in material coordinate, as in sigma_local = Qm_local * eps_local
double nu_yx = this->Get_nu_yx(); // follows xy as it must be nu_yx*E_x = nu_xy*E_y
ChMatrix33<> Qm_local;
Qm_local.setZero();
Qm_local(0, 0) = E_x / (1. - nu_xy * nu_yx);
Qm_local(0, 1) = (nu_xy * E_y) / (1. - nu_xy * nu_yx);
Qm_local(1, 0) = (nu_yx * E_x) / (1. - nu_xy * nu_yx);
Qm_local(1, 1) = E_y / (1. - nu_xy * nu_yx);
Qm_local(2, 2) = G_xy;
// Rotate Qm_local into Q, as Q = Ts'*Qm_local*Te
double Co = cos(angle);
double Si = sin(angle);
double CC = Co * Co;
double SS = Si * Si;
double SC = Si * Co;
ChMatrix33<> Tm; // T^{-1} , transforms sigma from rotated material direction to local direction
Tm << CC, SS, -2*SC,
SS, CC, 2*SC,
SC, -SC, CC-SS;
// Q = T^{-1}*Qm_local*T^{-1 T}
ChMatrix33<> Q = Tm * Qm_local * Tm.transpose();
double h1 = z_sup - z_inf;
double h2 = 0.5 * (pow(z_sup, 2) - pow(z_inf, 2));
double h3 = (1. / 3.) * (pow(z_sup, 3) - pow(z_inf, 3));
mC.block<3,3>(0,0) = Q * h1;
mC.block<3,3>(0,3) = Q * h2;
mC.block<3,3>(3,0) = Q * h2;
mC.block<3,3>(3,3) = Q * h3;
}
//--------------------------------------------------------------
ChElasticityKirchhoffGeneric::ChElasticityKirchhoffGeneric() {
mE.setIdentity();
}
void ChElasticityKirchhoffGeneric::ComputeStress(
ChVector<>& n, ///< forces n_11, n_22, n_12 (per unit length)
ChVector<>& m, ///< torques m_11, m_22, m_12 (per unit length)
const ChVector<>& eps, ///< strains e_11, e_22, e_12
const ChVector<>& kur, ///< curvature k_11, k_22, k_12
const double z_inf, ///< layer lower z value (along thickness coord)
const double z_sup, ///< layer upper z value (along thickness coord)
const double angle ///< layer angle respect to x (if needed) -not used in this, isotropic
) {
ChVectorN<double, 6> mstrain;
ChVectorN<double, 6> mstress;
mstrain.segment(0 , 3) = eps.eigen();
mstrain.segment(3 , 3) = kur.eigen();
mstress = this->mE * mstrain;
n = mstress.segment(0, 3);
m = mstress.segment(3, 3);
}
void ChElasticityKirchhoffGeneric::ComputeStiffnessMatrix(
ChMatrixRef mC, ///< tangent matrix
const ChVector<>& eps, ///< strains e_11, e_22, e_12
const ChVector<>& kur, ///< curvature k_11, k_22, k_12
const double z_inf, ///< layer lower z value (along thickness coord)
const double z_sup, ///< layer upper z value (along thickness coord)
const double angle ///< layer angle respect to x (if needed)
) {
mC = this->mE;
}
//----------------------------------------------------------------
ChPlasticityKirchhoff::ChPlasticityKirchhoff() : section(nullptr), nr_yeld_tolerance(1e-7), nr_yeld_maxiters(5) {}
void ChPlasticityKirchhoff::ComputeStiffnessMatrixElastoplastic(
ChMatrixRef K, ///< 6x6 material elastoplastic stiffness matrix values here
const ChVector<>& eps, ///< strains
const ChVector<>& kur, ///< curvature
const ChShellKirchhoffInternalData& data, ///< updated material internal variables, at this point including {p_strain_e, p_strain_k, p_strain_acc}
const double z_inf, ///< layer lower z value (along thickness coord)
const double z_sup, ///< layer upper z value (along thickness coord)
const double angle ///< layer angle respect to x (if needed)
) {
ChVector<> n;
ChVector<> m;
std::vector<std::unique_ptr<ChShellKirchhoffInternalData>> a_plastic_data;
this->CreatePlasticityData(1, a_plastic_data);
std::vector<std::unique_ptr<ChShellKirchhoffInternalData>> b_plastic_data;
this->CreatePlasticityData(1, b_plastic_data);
bool in_plastic = ComputeStressWithReturnMapping(n, m,
*a_plastic_data[0], eps, kur, data, z_inf, z_sup, angle
);
if (!in_plastic) {
// if no return mapping is needed at this strain state, just use elastic matrix:
return this->section->GetElasticity()->ComputeStiffnessMatrix(K, eps, kur, z_inf, z_sup, angle);
} else {
// if return mapping is needed at this strain state, compute the elastoplastic stiffness by brute force BDF
ChVectorN<double, 6> strain_0;
strain_0.segment(0, 3) = eps.eigen();
strain_0.segment(3, 3) = kur.eigen();
ChVectorN<double, 6> stress_0;
stress_0.segment(0,3) = n.eigen();
stress_0.segment(3,3) = m.eigen();
double delta = 1e-6;
double invdelta = 1.0 / delta;
for (int i = 0; i < 6; ++i) {
strain_0(i, 0) += delta;
ChVector<> deps(strain_0.segment(0, 3));
ChVector<> dkur(strain_0.segment(3, 3));
this->ComputeStressWithReturnMapping(n, m, *b_plastic_data[0], deps, dkur, data, z_inf, z_sup, angle);
ChVectorN<double, 6> stress_1;
stress_1.segment(0,3) = n.eigen();
stress_1.segment(3,3) = m.eigen();
ChVectorN<double, 6> stress_d = invdelta * (stress_1 - stress_0);
K.block(0, i, 6, 1) = stress_d;
strain_0(i, 0) -= delta;
}
}
}
void ChPlasticityKirchhoff::CreatePlasticityData(
int numpoints,
std::vector<std::unique_ptr<ChShellKirchhoffInternalData>>& plastic_data) {
plastic_data.resize(numpoints);
for (int i = 0; i < numpoints; ++i) {
plastic_data[i] = std::unique_ptr<ChShellKirchhoffInternalData>(new ChShellKirchhoffInternalData());
}
}
//-----------------------------------------------------------------------
void ChDampingKirchhoff::ComputeDampingMatrix(
ChMatrixRef R, // 6x6 material damping matrix values here
const ChVector<>& deps, // time derivative of strains
const ChVector<>& dkur, // time derivative of curvatures
const double z_inf, // layer lower z value (along thickness coord)
const double z_sup, // layer upper z value (along thickness coord)
const double angle // layer angle respect to x (if needed) -not used in this, isotropic+
) {
assert(R.rows() == 6);
assert(R.cols() == 6);
R.setZero();
ChVectorN<double, 6> dstrain_0;
dstrain_0.segment(0, 3) = deps.eigen();
dstrain_0.segment(3, 3) = dkur.eigen();
ChVector<> n, m;
this->ComputeStress(n, m, deps, dkur, z_inf, z_sup, angle);
ChVectorN<double, 6> stress_0;
stress_0.segment(0,3) = n.eigen();
stress_0.segment(3,3) = m.eigen();
double delta = 1e-9;
for (int i = 0; i < 6; ++i) {
dstrain_0(i, 0) += delta;
ChVector<> ddeps(dstrain_0.segment(0, 3));
ChVector<> ddkur(dstrain_0.segment(3, 3));
this->ComputeStress(n, m, ddeps, ddkur, z_inf, z_sup, angle);
ChVectorN<double, 6> stress_1;
stress_1.segment(0,3) = n.eigen();
stress_1.segment(3,3) = m.eigen();
ChVectorN<double, 6> stress_d = (1. / delta) * (stress_1 - stress_0);
R.block(0, i, 6, 1) = stress_d;
dstrain_0(i, 0) -= delta;
}
}
// -----------------------------------------------------------------------------
ChDampingKirchhoffRayleigh::ChDampingKirchhoffRayleigh(
std::shared_ptr<ChElasticityKirchhoff> melasticity,
const double& mbeta) {
this->beta = mbeta;
this->section_elasticity = melasticity;
this->updated = false;
}
void ChDampingKirchhoffRayleigh::ComputeStress(
ChVector<>& n, ///< forces n_11, n_22, n_12 (per unit length)
ChVector<>& m, ///< torques m_11, m_22, m_12 (per unit length)
const ChVector<>& deps, ///< time derivative of strains de_11/dt, de_22/dt, de_12/dt
const ChVector<>& dkur, ///< time derivative of curvature dk_11/dt, dk_22/dt, dk_12/dt
const double z_inf, ///< layer lower z value (along thickness coord)
const double z_sup, ///< layer upper z value (along thickness coord)
const double angle ///< layer angle respect to x (if needed)
) {
if (!this->updated && this->section_elasticity->section) {
this->section_elasticity->ComputeStiffnessMatrix(this->E_const, VNULL, VNULL, z_inf, z_sup, angle);
this->updated = true;
}
ChVectorN<double, 6> mdstrain;
ChVectorN<double, 6> mstress;
mdstrain.segment(0 , 3) = deps.eigen();
mdstrain.segment(3 , 3) = dkur.eigen();
mstress = this->beta * this->E_const * mdstrain;
n = mstress.segment(0, 3);
m = mstress.segment(3, 3);
}
void ChDampingKirchhoffRayleigh::ComputeDampingMatrix( ChMatrixRef R, ///< 6x6 material damping matrix values here
const ChVector<>& deps, ///< time derivative of strains de_11/dt, de_22/dt, de_12/dt
const ChVector<>& dkur, ///< time derivative of curvature dk_11/dt, dk_22/dt, dk_12/dt
const double z_inf, ///< layer lower z value (along thickness coord)
const double z_sup, ///< layer upper z value (along thickness coord)
const double angle ///< layer angle respect to x (if needed) -not used in this, isotropic
) {
R = this->beta * this->E_const;
}
// -----------------------------------------------------------------------------
ChMaterialShellKirchhoff::ChMaterialShellKirchhoff(std::shared_ptr<ChElasticityKirchhoff> melasticity) {
this->SetElasticity(melasticity);
}
ChMaterialShellKirchhoff::ChMaterialShellKirchhoff(std::shared_ptr<ChElasticityKirchhoff> melasticity,
std::shared_ptr<ChPlasticityKirchhoff> mplasticity) {
this->SetElasticity(melasticity);
this->SetPlasticity(mplasticity);
}
ChMaterialShellKirchhoff::ChMaterialShellKirchhoff(std::shared_ptr<ChElasticityKirchhoff> melasticity,
std::shared_ptr<ChPlasticityKirchhoff> mplasticity,
std::shared_ptr<ChDampingKirchhoff> mdamping) {
this->SetElasticity(melasticity);
if (mplasticity)
this->SetPlasticity(mplasticity);
if (mdamping)
this->SetDamping(mdamping);
}
void ChMaterialShellKirchhoff::ComputeStress(ChVector<>& n,
ChVector<>& m,
const ChVector<>& eps,
const ChVector<>& kur,
const double z_inf,
const double z_sup,
const double angle,
ChShellKirchhoffInternalData* mdata_new,
const ChShellKirchhoffInternalData* mdata) {
if (!plasticity || !mdata || !mdata_new)
this->elasticity->ComputeStress(n, m, eps, kur, z_inf, z_sup, angle);
else {
this->plasticity->ComputeStressWithReturnMapping(n, m, *mdata_new, eps, kur, *mdata, z_inf, z_sup, angle);
}
}
void ChMaterialShellKirchhoff::ComputeStiffnessMatrix(ChMatrixRef K,
const ChVector<>& eps,
const ChVector<>& kur,
const double z_inf,
const double z_sup,
const double angle,
const ChShellKirchhoffInternalData* mdata) {
if (!plasticity || !mdata)
this->elasticity->ComputeStiffnessMatrix(K, eps, kur, z_inf, z_sup, angle);
else {
this->plasticity->ComputeStiffnessMatrixElastoplastic(K, eps, kur, *mdata, z_inf, z_sup, angle);
}
}
void ChMaterialShellKirchhoff::SetElasticity(std::shared_ptr<ChElasticityKirchhoff> melasticity) {
elasticity = melasticity;
elasticity->section = this;
}
void ChMaterialShellKirchhoff::SetPlasticity(std::shared_ptr<ChPlasticityKirchhoff> mplasticity) {
plasticity = mplasticity;
mplasticity->section = this;
}
void ChMaterialShellKirchhoff::SetDamping(std::shared_ptr<ChDampingKirchhoff> mdamping) {
damping = mdamping;
damping->section = this;
}
} // end of namespace fea
} // end of namespace chrono
| dariomangoni/chrono | src/chrono/fea/ChMaterialShellKirchhoff.cpp | C++ | bsd-3-clause | 19,802 | [
30522,
1013,
1013,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
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... |
<?php
exit;
include_once "config/config.php";
include_once "engine/fhq_class_security.php";
include_once "engine/fhq_class_database.php";
include_once "engine/fhq_class_mail.php";
if(!isset($_GET['email']))
{
echo "not found parametr ?email=";
exit;
};
$email = $_GET['email'];
echo "send to mail: ".$email."<br>";
$security = new fhq_security();
$db = new fhq_database();
$mail = new fhq_mail();
echo "mail created <br>";
$error = "";
echo "try send email<br>";
$mail->send($email,'','','Test Mail', 'Test messages', $error);
echo "sended";
echo $error;
?>
| SibirCTF/2014-jury-system-fhq | php/fhq/test_mail.php | PHP | mit | 568 | [
30522,
1026,
1029,
25718,
6164,
1025,
2421,
1035,
2320,
1000,
9530,
8873,
2290,
1013,
9530,
8873,
2290,
1012,
25718,
1000,
1025,
2421,
1035,
2320,
1000,
3194,
1013,
1042,
2232,
4160,
1035,
2465,
1035,
3036,
1012,
25718,
1000,
1025,
2421,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
/**
*
* SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
*
* SuiteCRM is an extension to SugarCRM Community Edition developed by SalesAgility Ltd.
* Copyright (C) 2011 - 2018 SalesAgility Ltd.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
* reasonably feasible for technical reasons, the Appropriate Legal Notices must
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
*/
var aclviewer = function () {
var lastDisplay = '';
return {
view: function (role_id, role_module) {
YAHOO.util.Connect.asyncRequest('POST', 'index.php', {
'success': aclviewer.display,
'failure': aclviewer.failed
}, 'module=ACLRoles&action=EditRole&record=' + role_id + '&category_name=' + role_module);
ajaxStatus.showStatus(SUGAR.language.get('app_strings', 'LBL_REQUEST_PROCESSED'));
},
save: function (form_name) {
var formObject = document.getElementById(form_name);
YAHOO.util.Connect.setForm(formObject);
YAHOO.util.Connect.asyncRequest('POST', 'index.php', {
'success': aclviewer.postSave,
'failure': aclviewer.failed
});
ajaxStatus.showStatus(SUGAR.language.get('app_strings', 'LBL_SAVING'));
},
postSave: function (o) {
SUGAR.util.globalEval(o.responseText);
aclviewer.view(result['role_id'], result['module']);
},
display: function (o) {
aclviewer.lastDisplay = '';
ajaxStatus.flashStatus('Done');
document.getElementById('category_data').innerHTML = o.responseText;
},
failed: function () {
ajax.flashStatus('Could Not Connect');
},
toggleDisplay: function (id) {
if (aclviewer.lastDisplay != '' && typeof(aclviewer.lastDisplay) != 'undefined') {
aclviewer.hideDisplay(aclviewer.lastDisplay);
}
if (aclviewer.lastDisplay != id) {
aclviewer.showDisplay(id);
aclviewer.lastDisplay = id;
} else {
aclviewer.lastDisplay = '';
}
},
hideDisplay: function (id) {
document.getElementById(id).style.display = 'none';
document.getElementById(id + 'link').style.display = '';
},
showDisplay: function (id) {
document.getElementById(id).style.display = '';
document.getElementById(id + 'link').style.display = 'none';
}
};
}();
| lionixevolve/SuiteCRM | jssource/src_files/modules/ACLRoles/ACLRoles.js | JavaScript | agpl-3.0 | 3,972 | [
30522,
1013,
1008,
1008,
1008,
1008,
5699,
26775,
2213,
2451,
3179,
2003,
1037,
8013,
3276,
2968,
2565,
2764,
2011,
1008,
5699,
26775,
2213,
1010,
4297,
1012,
9385,
1006,
1039,
1007,
2432,
1011,
2286,
5699,
26775,
2213,
4297,
1012,
1008,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 React, { Component } from 'react';
import {
StyleSheet,
Text,
View,
Navigator,
ScrollView,
ListView,
} from 'react-native'
import NavigationBar from 'react-native-navbar';
var REQUEST_URL = 'https://calm-garden-29993.herokuapp.com/index/groupsinfo/?';
class GroupDetails extends Component {
constructor(props, context) {
super(props, context);
this.state = {
loggedIn: true,
loaded: false,
rando: "a",
};
this.fetchData();
}
backOnePage () {
this.props.navigator.pop();
}
renderRide (ride) {
return (
<View>
<Text style={styles.title}>{ride.title}</Text>
</View>
);
}
componentDidMount () {
this.fetchData();
}
toQueryString(obj) {
return obj ? Object.keys(obj).sort().map(function (key) {
var val = obj[key];
if (Array.isArray(val)) {
return val.sort().map(function (val2) {
return encodeURIComponent(key) + '=' + encodeURIComponent(val2);
}).join('&');
}
return encodeURIComponent(key) + '=' + encodeURIComponent(val);
}).join('&') : '';
}
fetchData() {
console.log(this.props.group_info.pk);
fetch(REQUEST_URL + this.toQueryString({"group": this.props.group_info.pk}))
.then((response) => response.json())
.then((responseData) => {
console.log(responseData);
this.setState({
group_info: responseData,
loaded: true,
});
})
.done();
}
render () {
if (!this.state.loaded) {
return (<View>
<Text>Loading!</Text>
</View>);
}
else if (this.state.loggedIn) {
console.log(this.props.group_info.fields);
console.log(this.state);
console.log(this.state.group_info[0]);
const backButton = {
title: "Back",
handler: () => this.backOnePage(),
};
return (
<ScrollView>
<NavigationBar
style={{ backgroundColor: "white", }}
leftButton={backButton}
statusBar={{ tintColor: "white", }}
/>
<Text style={styles.headTitle}>
Group Name: {this.state.group_info.name}
</Text>
<Text style={styles.headerOtherText}>Group Leader: {this.state.group_info.admin}</Text>
<Text style={styles.headerOtherText}>{this.state.group_info.users} people in this group.</Text>
</ScrollView>
);
} else {
this.props.navigator.push({id: "LoginPage", name:"Index"})
}
}
}
var styles = StyleSheet.create({
headerOtherText : {
color: 'black',
fontSize: 15 ,
fontWeight: 'normal',
fontFamily: 'Helvetica Neue',
alignSelf: "center",
},
headTitle: {
color: 'black',
fontSize: 30 ,
fontWeight: 'normal',
fontFamily: 'Helvetica Neue',
alignSelf: "center",
},
header: {
marginTop: 20,
flex: 1,
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
},
container: {
flex: 1,
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#ff7f50',
},
rightContainer: {
flex: 1,
},
title: {
fontSize: 20,
marginBottom: 8,
textAlign: 'center',
},
year: {
textAlign: 'center',
},
thumbnail: {
width: 53,
height: 81,
},
listView: {
backgroundColor: '#0000ff',
paddingBottom: 200,
},
});
module.exports = GroupDetails;
| adnanhemani/RideApp | App/GroupDetails.js | JavaScript | mit | 3,798 | [
30522,
12324,
10509,
1010,
1063,
6922,
1065,
2013,
1005,
10509,
1005,
1025,
12324,
1063,
6782,
21030,
2102,
1010,
3793,
1010,
3193,
1010,
20532,
1010,
17186,
8584,
1010,
2862,
8584,
1010,
1065,
2013,
1005,
10509,
1011,
3128,
1005,
12324,
91... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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";
var mapnik = require('../');
var assert = require('assert');
var path = require('path');
mapnik.register_datasource(path.join(mapnik.settings.paths.input_plugins,'geojson.input'));
describe('mapnik.Geometry ', function() {
it('should throw with invalid usage', function() {
// geometry cannot be created directly for now
assert.throws(function() { mapnik.Geometry(); });
});
it('should access a geometry from a feature', function() {
var feature = new mapnik.Feature(1);
var point = {
"type": "MultiPoint",
"coordinates": [[0,0],[1,1]]
};
var input = {
type: "Feature",
properties: {},
geometry: point
};
var f = new mapnik.Feature.fromJSON(JSON.stringify(input));
var geom = f.geometry();
assert.equal(geom.type(),mapnik.Geometry.MultiPoint);
assert.deepEqual(JSON.parse(geom.toJSONSync()),point);
var expected_wkb = new Buffer('0104000000020000000101000000000000000000000000000000000000000101000000000000000000f03f000000000000f03f', 'hex');
assert.deepEqual(geom.toWKB(),expected_wkb);
});
it('should fail on toJSON due to bad parameters', function() {
var feature = new mapnik.Feature(1);
var point = {
"type": "MultiPoint",
"coordinates": [[0,0],[1,1]]
};
var input = {
type: "Feature",
properties: {},
geometry: point
};
var f = new mapnik.Feature.fromJSON(JSON.stringify(input));
var geom = f.geometry();
assert.equal(geom.type(),mapnik.Geometry.MultiPoint);
assert.throws(function() { geom.toJSONSync(null); });
assert.throws(function() { geom.toJSONSync({transform:null}); });
assert.throws(function() { geom.toJSONSync({transform:{}}); });
assert.throws(function() { geom.toJSON(null, function(err,json) {}); });
assert.throws(function() { geom.toJSON({transform:null}, function(err, json) {}); });
assert.throws(function() { geom.toJSON({transform:{}}, function(err, json) {}); });
});
it('should throw if we attempt to create a Feature from a geojson geometry (rather than geojson feature)', function() {
var geometry = {
type: 'Point',
coordinates: [ 7.415119300000001, 43.730364300000005 ]
};
// starts throwing, as expected, at Mapnik v3.0.9 (https://github.com/mapnik/node-mapnik/issues/560)
if (mapnik.versions.mapnik_number >= 300009) {
assert.throws(function() {
var transformed = mapnik.Feature.fromJSON(JSON.stringify(geometry));
});
}
});
it('should throw from empty geometry from toWKB', function() {
var s = new mapnik.Feature(1);
assert.throws(function() {
var geom = s.geometry().toWKB();
});
});
});
| langateam/node-mapnik | test/geometry.test.js | JavaScript | bsd-3-clause | 2,955 | [
30522,
1000,
2224,
9384,
1000,
1025,
13075,
4949,
8238,
1027,
5478,
1006,
1005,
1012,
1012,
1013,
1005,
1007,
1025,
13075,
20865,
1027,
5478,
1006,
1005,
20865,
1005,
1007,
1025,
13075,
4130,
1027,
5478,
1006,
1005,
4130,
1005,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 _BZOS_TYPE_H_
#define _BZOS_TYPE_H_
typedef unsigned long long u64;
typedef unsigned int u32;
typedef unsigned short u16;
typedef unsigned char u8;
typedef void (*irq_handler)(int irq);
typedef void (*int_handler)();
typedef void (*task_f)();
typedef void* system_call;
typedef char* va_list;
/* mesaage mechanism borrowed from MINIX */
struct mess1{
int m1i1;
int m1i2;
int m1i3;
int m1i4;
};
struct mess2{
void* m2p1;
void* m2p2;
void* m2p3;
void* m2p4;
};
struct mess3{
int m3i1;
int m3i2;
int m3i3;
int m3i4;
u64 m3l1;
u64 m3l2;
void* m3p1;
void* m3p2;
};
typedef struct{
int source; /* who sends this message */
int type;
union{
struct mess1 m1;
struct mess2 m2;
struct mess3 m3; /* @see include/const.h RETVAL == u.m3.m3i1 */
} u;
} MESSAGE;
/* */
struct boot_params{
int mem_size; /* memory size */
u8* kernel_file; /* addr of kernel file */
};
#endif
| liangbizhi/bzOS | include/type.h | C | gpl-2.0 | 915 | [
30522,
1001,
2065,
13629,
2546,
1035,
1038,
28370,
1035,
2828,
1035,
1044,
1035,
1001,
9375,
1035,
1038,
28370,
1035,
2828,
1035,
1044,
1035,
21189,
12879,
27121,
2146,
2146,
1057,
21084,
1025,
21189,
12879,
27121,
20014,
1057,
16703,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 actionTypes from '../../client/actions/types';
const defaultState = {
data: {},
errors: 'Not Found',
};
export default function domainDetailReducer(state = defaultState, action = {}) {
switch (action.type) {
case actionTypes.getDomainDetail:
return Object.assign({}, state, {
data: action.data.domain,
errors: action.errors,
});
default:
return state;
}
}
| willopez/domainsjs | shared/report/domain-detail.js | JavaScript | mit | 415 | [
30522,
12324,
2895,
13874,
2015,
2013,
1005,
1012,
1012,
1013,
1012,
1012,
1013,
7396,
1013,
4506,
1013,
4127,
1005,
1025,
9530,
3367,
12398,
9153,
2618,
1027,
1063,
2951,
1024,
1063,
1065,
1010,
10697,
1024,
1005,
2025,
2179,
1005,
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... |
a.reference.image-reference {
border-bottom: none;
}
| dejlek/pulsar | docs/source/_static/pulsar.css | CSS | bsd-3-clause | 58 | [
30522,
1037,
1012,
4431,
1012,
3746,
1011,
4431,
1063,
3675,
1011,
3953,
1024,
3904,
1025,
1065,
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,
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 Client from '../../../api';
import { AsyncActionStatus } from '../../../const/AsyncActionStatus';
import { getCurrency, getNobtName, getPersonNames } from './selectors';
export const UPDATE_CREATE_NOBT_STATUS = 'NewNobt.UPDATE_CREATE_NOBT_STATUS';
export const SELECT_CURRENCY = 'NewNobt.SELECT_CURRENCY';
export const CHANGE_NOBT_NAME = 'NewNobt.CHANGE_NOBT_NAME';
export const ADD_PERSON = 'NewNobt.ADD_PERSON';
export const REMOVE_PERSON = 'NewNobt.REMOVE_PERSON';
export const UPDATE_NAME_OF_PERSON_TO_ADD =
'NewNobt.UPDATE_NAME_OF_PERSON_TO_ADD';
function createNobtStarted() {
return {
type: UPDATE_CREATE_NOBT_STATUS,
payload: {
status: AsyncActionStatus.IN_PROGRESS,
},
};
}
function createNobtSucceeded(response) {
return {
type: UPDATE_CREATE_NOBT_STATUS,
payload: {
id: response.data.id,
status: AsyncActionStatus.SUCCESSFUL,
},
};
}
function createNobtFailed(error) {
return {
type: UPDATE_CREATE_NOBT_STATUS,
payload: {
error,
status: AsyncActionStatus.FAILED,
},
};
}
export function createNobt() {
return (dispatch, getState) => {
dispatch(createNobtStarted());
let nobtToCreate = {
nobtName: getNobtName(getState()),
currency: getCurrency(getState()),
explicitParticipants: getPersonNames(getState()),
};
Client.createNobt(nobtToCreate).then(
response => {
dispatch(createNobtSucceeded(response));
},
error => dispatch(createNobtFailed(error))
);
};
}
export function selectCurrency(newCurrency) {
return {
type: SELECT_CURRENCY,
payload: {
newCurrency,
},
};
}
export function changeNobtName(newName) {
return {
type: CHANGE_NOBT_NAME,
payload: {
newName,
},
};
}
export function addCurrentNameAsPerson() {
return {
type: ADD_PERSON,
};
}
export function removePerson(name) {
return {
type: REMOVE_PERSON,
payload: {
name,
},
};
}
export function updateNameOfPersonToAdd(name) {
return {
type: UPDATE_NAME_OF_PERSON_TO_ADD,
payload: {
name,
},
};
}
| nobt-io/frontend | src/routes/CreateNobt/modules/actions.js | JavaScript | gpl-3.0 | 2,130 | [
30522,
12324,
7396,
2013,
1005,
1012,
1012,
1013,
1012,
1012,
1013,
1012,
1012,
1013,
17928,
1005,
1025,
12324,
1063,
2004,
6038,
3540,
22014,
29336,
2271,
1065,
2013,
1005,
1012,
1012,
1013,
1012,
1012,
1013,
1012,
1012,
1013,
9530,
3367,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.