code stringlengths 4 991k | repo_name stringlengths 6 116 | path stringlengths 4 249 | language stringclasses 30 values | license stringclasses 15 values | size int64 4 991k | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|
//>>built
define("dojox/lang/functional/curry",["dijit","dojo","dojox","dojo/require!dojox/lang/functional/lambda"],function(_1,_2,_3){
_2.provide("dojox.lang.functional.curry");
_2.require("dojox.lang.functional.lambda");
(function(){
var df=_3.lang.functional,ap=Array.prototype;
var _4=function(_5){
return function(){
var _6=_5.args.concat(ap.slice.call(arguments,0));
if(arguments.length+_5.args.length<_5.arity){
return _4({func:_5.func,arity:_5.arity,args:_6});
}
return _5.func.apply(this,_6);
};
};
_2.mixin(df,{curry:function(f,_7){
f=df.lambda(f);
_7=typeof _7=="number"?_7:f.length;
return _4({func:f,arity:_7,args:[]});
},arg:{},partial:function(f){
var a=arguments,l=a.length,_8=new Array(l-1),p=[],i=1,t;
f=df.lambda(f);
for(;i<l;++i){
t=a[i];
_8[i-1]=t;
if(t===df.arg){
p.push(i-1);
}
}
return function(){
var t=ap.slice.call(_8,0),i=0,l=p.length;
for(;i<l;++i){
t[p[i]]=arguments[i];
}
return f.apply(this,t);
};
},mixer:function(f,_9){
f=df.lambda(f);
return function(){
var t=new Array(_9.length),i=0,l=_9.length;
for(;i<l;++i){
t[i]=arguments[_9[i]];
}
return f.apply(this,t);
};
},flip:function(f){
f=df.lambda(f);
return function(){
var a=arguments,l=a.length-1,t=new Array(l+1),i=0;
for(;i<=l;++i){
t[l-i]=a[i];
}
return f.apply(this,t);
};
}});
})();
});
| studentsphere/ApiProxy | wso2am-1.7.0/repository/deployment/server/jaggeryapps/store/site/themes/fancy/templates/utils/dojo-release-1.8.3/dojox/lang/functional/curry.js | JavaScript | apache-2.0 | 1,279 | [
30522,
1013,
1013,
1028,
1028,
2328,
9375,
1006,
1000,
2079,
5558,
2595,
1013,
11374,
1013,
8360,
1013,
15478,
1000,
1010,
1031,
1000,
4487,
18902,
1000,
1010,
1000,
2079,
5558,
1000,
1010,
1000,
2079,
5558,
2595,
1000,
1010,
1000,
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... |
#pragma once
#include "indexer/index.hpp"
#include "geometry/point2d.hpp"
#include "geometry/rect2d.hpp"
#include "geometry/tree4d.hpp"
#include "std/set.hpp"
class Index;
namespace search
{
struct LocalityItem
{
m2::RectD m_rect;
string m_name;
uint32_t m_population;
typedef uint32_t ID;
ID m_id;
LocalityItem(m2::RectD const & rect, uint32_t population, ID id, string const & name);
m2::RectD const & GetLimitRect() const { return m_rect; }
};
class LocalityFinder
{
struct Cache
{
m4::Tree<LocalityItem> m_tree;
set<LocalityItem::ID> m_loaded;
mutable uint32_t m_usage;
m2::RectD m_rect;
Cache() : m_usage(0) {}
void Clear();
void GetLocality(m2::PointD const & pt, string & name) const;
};
public:
LocalityFinder(Index const * pIndex);
void SetLanguage(int8_t lang)
{
if (m_lang != lang)
{
ClearCacheAll();
m_lang = lang;
}
}
void SetViewportByIndex(m2::RectD const & viewport, size_t idx);
/// Set new viewport for the reserved slot only if it's no a part of the previous one.
void SetReservedViewportIfNeeded(m2::RectD const & viewport);
/// Check for localities in pre-cached viewports only.
void GetLocalityInViewport(m2::PointD const & pt, string & name) const;
/// Check for localities in all Index and make new cache if needed.
void GetLocalityCreateCache(m2::PointD const & pt, string & name);
void ClearCacheAll();
void ClearCache(size_t idx);
protected:
void CorrectMinimalRect(m2::RectD & rect) const;
void RecreateCache(Cache & cache, m2::RectD rect) const;
private:
friend class DoLoader;
Index const * m_pIndex;
enum { MAX_VIEWPORT_COUNT = 3 };
Cache m_cache[MAX_VIEWPORT_COUNT];
int8_t m_lang;
};
} // namespace search
| programming086/omim | search/locality_finder.hpp | C++ | apache-2.0 | 1,775 | [
30522,
1001,
10975,
8490,
2863,
2320,
1001,
2421,
1000,
5950,
2121,
1013,
5950,
1012,
6522,
2361,
1000,
1001,
2421,
1000,
10988,
1013,
2391,
2475,
2094,
1012,
6522,
2361,
1000,
1001,
2421,
1000,
10988,
1013,
28667,
2102,
2475,
2094,
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... |
/*
Document : main
Created on : Oct 12, 2013, 12:37:21 PM
Author : Andres
Description: Purpose of the stylesheet follows.
*/
.crud-table td{
padding-right: 10px;
padding-bottom: 10px;
padding-top: 0px;
}
/* ------ Mix ------ */
#Grid{
width: 398px;
margin: 0px;
padding: 0px;
overflow: scroll;
overflow-x: hidden;
max-height: 500px;
}
#Grid:after{
content: '';
display: inline-block;
width: 100%;
}
#Grid .mix{
display: none;
opacity: 0;
vertical-align: top;
text-align: center;
width: 100px;
height: 160px;
font-size: 10px;
color: #000000;
margin-bottom: 10px;
margin-left: 18px;
}
#Grid .mix{
display: none;
opacity: 0;
vertical-align: top;
text-align: center;
width: 100px;
height: 150px;
font-size: 10px;
color: #000000;
margin-bottom: 10px;
margin-left: 18px;
}
#Grid .mix a{
text-decoration: none;
color: #000000;
}
#Grid .mix a span{
display: inline-block;
height: 35px;
}
#Grid .mix.seleccionado{
background: #3297fd;
color: #FFFFFF;
outline: 5px solid #3297fd;
font-weight: bold;
}
#Grid .mix.seleccionado a{
color: #FFFFFF;
}
#Grid .gap{
display: inline-block;
width: 200px;
}
/* ------ Pedido producto -------*/
.pPedidoProducto{
width: 800px;
}
.tProductoPedido td{
vertical-align: top;
padding-bottom: 20px;
padding-right: 10px;
}
/* ------ Tabla colapse --------*/
.tColapse td{
padding: 1px !important;
}
.tColapse th{
padding: 1px !important;
}
/*
.records_list td:last-child{
text-align: right;
}
*/
.crud-table{
border: 10px solid #eeefff;
background-color: #eeefff;
}
/* ------ Selecciones menu --------*/
.controlm.selected{
background: #39b3d7;
}
.cobrosm.selected{
background: #ed9c28;
}
.produccionm.selected{
background: #47a447;
}
.tareasm.selected{
background: #6f5499;
}
.tareasm.selected a, .produccionm.selected a, .cobrosm.selected a, .controlm.selected a{
color: #FFFFFF !important;
}
/*tr.odd td.highlighted {
background-color: #D3D6FF;
}*/
tr.even td.highlighted {
background-color: #EAEBFF;
}
.t_control tr.even td, .t_control tr.odd td, table.t_control.dataTable tr.odd td.sorting_1, table.t_control.dataTable tr.even td.sorting_1{
background-color: #DBF7FF;
}
.t_cobros tr.even td, .t_cobros tr.odd td, table.t_cobros.dataTable tr.odd td.sorting_1, table.t_cobros.dataTable tr.even td.sorting_1{
background-color: #FFE9C9;
}
.t_produccion tr.even td, .t_produccion tr.odd td, table.t_produccion.dataTable tr.odd td.sorting_1, table.t_produccion.dataTable tr.even td.sorting_1{
background-color: #D6FFD6;
}
.t_tareas tr.even td, .t_tareas tr.odd td, table.t_tareas.dataTable tr.odd td.sorting_1, table.t_tareas.dataTable tr.even td.sorting_1{
background-color: #EEE3FF;
} | pacordovad/project3 | web/bundles/frontend/css/main.css | CSS | mit | 2,941 | [
30522,
1013,
1008,
6254,
1024,
2364,
2580,
2006,
1024,
13323,
2260,
1010,
2286,
1010,
2260,
1024,
4261,
1024,
2538,
7610,
3166,
1024,
15614,
6412,
1024,
3800,
1997,
1996,
6782,
21030,
2102,
4076,
1012,
1008,
1013,
1012,
13675,
6784,
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... |
/**
*/
package some.basepackage.root.subpackage.impl;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.impl.EFactoryImpl;
import org.eclipse.emf.ecore.plugin.EcorePlugin;
import some.basepackage.root.subpackage.*;
/**
* <!-- begin-user-doc -->
* An implementation of the model <b>Factory</b>.
* <!-- end-user-doc -->
* @generated
*/
public class SubpackageFactoryImpl extends EFactoryImpl implements SubpackageFactory {
/**
* Creates the default factory implementation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static SubpackageFactory init() {
try {
SubpackageFactory theSubpackageFactory = (SubpackageFactory)EPackage.Registry.INSTANCE.getEFactory(SubpackagePackage.eNS_URI);
if (theSubpackageFactory != null) {
return theSubpackageFactory;
}
}
catch (Exception exception) {
EcorePlugin.INSTANCE.log(exception);
}
return new SubpackageFactoryImpl();
}
/**
* Creates an instance of the factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public SubpackageFactoryImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EObject create(EClass eClass) {
switch (eClass.getClassifierID()) {
case SubpackagePackage.CLASS_B: return createClassB();
case SubpackagePackage.SUPER_B: return createSuperB();
case SubpackagePackage.SUB_A: return createSubA();
default:
throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ClassB createClassB() {
ClassBImpl classB = new ClassBImpl();
return classB;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public SuperB createSuperB() {
SuperBImpl superB = new SuperBImpl();
return superB;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public SubA createSubA() {
SubAImpl subA = new SubAImpl();
return subA;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public SubpackagePackage getSubpackagePackage() {
return (SubpackagePackage)getEPackage();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @deprecated
* @generated
*/
@Deprecated
public static SubpackagePackage getPackage() {
return SubpackagePackage.eINSTANCE;
}
} //SubpackageFactoryImpl
| diverse-project/melange | tests/samples/fr.inria.diverse.melange.test.renaming.model/src/some/basepackage/root/subpackage/impl/SubpackageFactoryImpl.java | Java | epl-1.0 | 2,568 | [
30522,
1013,
1008,
1008,
1008,
1013,
7427,
2070,
1012,
2918,
23947,
30524,
1012,
17338,
2890,
1012,
19044,
3600,
4270,
1025,
12324,
8917,
1012,
13232,
1012,
7861,
2546,
1012,
17338,
2890,
1012,
17727,
2140,
1012,
1041,
21450,
5714,
24759,
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... |
# mod_prowl_ng
eJabberd module - sends an API request to `Prowl` when defined user is offline. It is based on `Robert George` [mod_offline_prowl.erl](http://www.unsleeping.com/2010/07/31/prowl-module-for-ejabberd/).
# Requirements
- eJabberd lib- and header-files >= 15.02
- Prowl API key
# Installation
* modify "build.sh" ebin directory
* modify "Emakefile" header directory
`./build.sh`
* copy `ebin/mod_prowl_ng.beam` to eJabberd ebin directory
# Configuration
modules section ejabberd.yml
mod_prowl_ng:
## "JID": "Prowl API key"
"eris@xmpp.local": "1143ffe24542c23c42c5c25f509e211ef17f0e0f"
"fletz@xmpp.local": "2226ae94105d0c4ae191ed8b8a8e447cd77e9f9e"
| argv/mod_prowl_ng | README.md | Markdown | gpl-3.0 | 693 | [
30522,
1001,
16913,
1035,
4013,
13668,
1035,
12835,
1041,
3900,
29325,
2094,
11336,
1011,
10255,
2019,
17928,
5227,
2000,
1036,
4013,
13668,
1036,
2043,
4225,
5310,
2003,
2125,
4179,
1012,
2009,
2003,
2241,
2006,
1036,
2728,
2577,
1036,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
eslint-plugin-extjs
============
[](https://npmjs.org/package/eslint-plugin-extjs) [](https://travis-ci.org/burnnat/eslint-plugin-extjs) [](https://gemnasium.com/burnnat/eslint-plugin-extjs)
ESLint rules for projects using the ExtJS framework. These rules are targeted for use with ExtJS 4.x. Pull requests for compatibility with 5.x are welcome!
## Rule Details
### ext-array-foreach
The two main array iterator functions provided by ExtJS, [`Ext.Array.forEach`][ext-array-foreach]
and [`Ext.Array.each`][ext-array-each], differ in that `each` provides extra
functionality for early termination and reverse iteration. The `forEach` method,
however, will delegate to the browser's native [`Array.forEach`][array-foreach]
implementation where available, for performance. So, in situations where the
extra features of `each` are not needed, `forEach` should be preferred. As the
`forEach` documentation says:
> [Ext.Array.forEach] will simply delegate to the native Array.prototype.forEach
> method if supported. It doesn't support stopping the iteration by returning
> false in the callback function like each. However, performance could be much
> better in modern browsers comparing with each.
The following patterns are considered warnings:
Ext.Array.each(
['a', 'b'],
function() {
// do something
}
);
Ext.Array.each(
['a', 'b'],
function() {
// do something
},
this,
false
);
The following patterns are not considered warnings:
Ext.Array.forEach(
['a', 'b'],
function() {
// do something
}
);
Ext.Array.each(
['a', 'b'],
function(item) {
if (item === 'a') {
return false;
}
}
);
Ext.Array.each(
['a', 'b'],
function() {
// do something
},
this,
true
);
### ext-deps
One problem with larger ExtJS projects is keeping the [`uses`][ext-uses] and
[`requires`][ext-requires] configs for a class synchronized as its body changes
over time and dependencies are added and removed. This rule checks that all
external references within a particular class have a corresponding entry in the
`uses` or `requires` config, and that there are no extraneous dependencies
listed in the class configuration that are not referenced in the class body.
The following patterns are considered warnings:
Ext.define('App', {
requires: ['Ext.panel.Panel']
});
Ext.define('App', {
constructor: function() {
this.panel = new Ext.panel.Panel();
}
});
The following patterns are not considered warnings:
Ext.define('App', {
requires: ['Ext.panel.Panel'],
constructor: function() {
this.panel = new Ext.panel.Panel();
}
});
Ext.define('App', {
extend: 'Ext.panel.Panel'
});
### no-ext-create
While using [`Ext.create`][ext-create] for instantiation has some benefits
during development, mainly synchronous loading of missing classes, it remains
slower than the `new` operator due to its extra overhead. For projects with
properly configured [`uses`][ext-uses] and [`requires`][ext-requires] blocks,
the extra features of `Ext.create` are not needed, so the `new` keyword should
be preferred in cases where the class name is static. This is confirmed by
Sencha employees, one of whom has [said][ext-create-forum]:
> 'Ext.create' is slower than 'new'. Its chief benefit is for situations where
> the class name is a dynamic value and 'new' is not an option. As long as the
> 'requires' declarations are correct, the overhead of 'Ext.create' is simply
> not needed.
The following patterns are considered warnings:
var panel = Ext.create('Ext.util.Something', {
someConfig: true
});
The following patterns are not considered warnings:
var panel = new Ext.util.Something({
someConfig: true
});
var panel = Ext.create(getDynamicClassName(), {
config: true
});
### no-ext-multi-def
Best practices for ExtJS 4 [dictate][ext-class-system] that each class
definition be placed in its own file, and that the filename should correspond to
the class being defined therein. This rule checks that there is no more than one
top-level class definition included per file.
The following patterns are considered warnings:
// all in one file
Ext.define('App.First', {
// ...
});
Ext.define('App.Second', {
// ...
});
The following patterns are not considered warnings:
// file a
Ext.define('App', {
// class definition
});
// file b
Ext.define('App', {
dynamicDefine: function() {
Ext.define('Dynamic' + Ext.id(), {
// class definition
});
}
});
[array-foreach]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach
[ext-array-foreach]: http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.Array-method-forEach
[ext-array-each]: http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.Array-method-each
[ext-class-system]: http://docs.sencha.com/extjs/4.2.1/#!/guide/class_system-section-2%29-source-files
[ext-create]: http://docs.sencha.com/extjs/4.2.1/#!/api/Ext-method-create
[ext-create-forum]: http://www.sencha.com/forum/showthread.php?166536-Ext.draw-Ext.create-usage-dropped-why&p=700522&viewfull=1#post700522
[ext-requires]: http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.Class-cfg-requires
[ext-uses]: http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.Class-cfg-uses
| burnnat/eslint-plugin-extjs | README.md | Markdown | mit | 5,895 | [
30522,
9686,
4115,
2102,
1011,
13354,
2378,
1011,
4654,
2102,
22578,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1031,
999,
1031,
27937,
2213,
1033,
1006,
16770,
1024,
1013,
1013,
10047,
2290,
1012,
11824,
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... |
<?php
namespace Concrete\Core\Legacy\Controller;
use Controller;
use Environment;
use BlockType;
use \Concrete\Core\View\DialogView;
class ToolController extends Controller {
public function getTheme() {
return false;
}
public function display($tool) {
$env = Environment::get();
$query = false;
if (substr($tool, 0, 9) != 'required/') {
$path = DIR_APPLICATION . '/' . DIRNAME_TOOLS . '/' . $tool . '.php';
$realpath = realpath($path);
if (file_exists($path) && $path == $realpath) {
$query = $tool;
}
} else {
$tool = substr($tool, 9);
$path = DIR_BASE_CORE . '/' . DIRNAME_TOOLS . '/' . $tool . '.php';
$realpath = realpath($path);
if (file_exists($path) && $path == $realpath) {
$query = $tool;
}
}
if ($query) {
$v = new DialogView($query);
$v->setViewRootDirectoryName(DIRNAME_TOOLS);
$this->setViewObject($v);
}
}
public function displayBlock($btHandle, $tool) {
$bt = BlockType::getByHandle($btHandle);
$env = Environment::get();
if (is_object($bt)) {
$pkgHandle = $bt->getPackageHandle();
$r = $env->getRecord(DIRNAME_BLOCKS . '/' . $btHandle . '/' . DIRNAME_TOOLS . '/' . $tool . '.php', $pkgHandle);
if ($r->exists()) {
$v = new DialogView($btHandle . '/' . DIRNAME_TOOLS . '/' . $tool);
$v->setViewRootDirectoryName(DIRNAME_BLOCKS);
$v->setInnerContentFile($r->file);
$this->setViewObject($v);
}
}
}
}
| christiandmiles/cloud9-concrete5 | concrete/src/Legacy/Controller/ToolController.php | PHP | mit | 1,422 | [
30522,
1026,
1029,
25718,
3415,
15327,
5509,
1032,
4563,
1032,
8027,
1032,
11486,
1025,
2224,
11486,
1025,
2224,
4044,
1025,
2224,
3796,
13874,
1025,
2224,
1032,
5509,
1032,
4563,
1032,
3193,
1032,
13764,
8649,
8584,
1025,
2465,
6994,
8663,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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) 2003-2010 University of Florida
*
* 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.
*
* The GNU General Public License is included in this distribution
* in the file COPYRIGHT.
*/
#include <stdio.h>
#include <stdlib.h>
#include "f77_name.h"
#include "f_types.h"
#ifdef HP
#include <stddef.h>
#endif
#ifdef ALTIX
#include <mpp/shmem.h>
#endif
#define MAX_MEM_ALLOC_PTRS 1000
f_int *malloced_pointers[MAX_MEM_ALLOC_PTRS];
int malloced_len[MAX_MEM_ALLOC_PTRS];
int n_malloced_pointers = 0;
void F77_NAME(malloc_wrapper, MALLOC_WRAPPER)(f_int *nwords,
f_int *element_size, f_int *sheap_flag,
void *x, long long *ixmem,
f_int *ierr)
{
size_t nbytes = (*nwords) * (*element_size);
size_t nb_shmalloc;
f_int *fp, *fp2;
long long llvar;
#ifdef HP
ptrdiff_t offset;
#else
long long offset;
#endif
if (*sheap_flag)
{
#ifdef USE_SHMEM
nb_shmalloc = (size_t) nbytes;
printf("Call shmalloc with %ld\n", nb_shmalloc);
fp = (f_int *) shmalloc(nb_shmalloc);
printf("Pointer from shmalloc: %x\n", fp);
#else
printf("Error: shmalloc not implemented for this machine.\n");
*ierr = -1;
return;
#endif
}
else
{
nbytes = (*nwords);
nbytes *= (*element_size);
nbytes += 8;
fp = (f_int *) malloc(nbytes);
}
if (!fp)
{
printf("(SH)MALLOC ERROR: nwords %d, element size %d\n",*nwords,
*element_size);
*ierr = -1;
return;
}
llvar = (long long) fp;
if (llvar/8*8 == llvar)
fp2 = fp;
else
fp2 = fp + 1;
/* Enter the memory pointer into the set of malloc'd pointers. */
if (n_malloced_pointers >= MAX_MEM_ALLOC_PTRS)
{
printf("Error: Limit of %d mem_alloc pointers has been exceeded.\n",
MAX_MEM_ALLOC_PTRS);
*ierr = -1;
return;
}
malloced_pointers[n_malloced_pointers] = fp;
malloced_len[n_malloced_pointers] = nbytes;
n_malloced_pointers++;
offset = ( fp2 - (f_int *) x);
*ixmem = (long long) (( fp2 - (f_int *) x) / (*element_size/sizeof(f_int)) + 1);
/* printf("malloc_wrapper: fp = %x %ld, address of x = %x %ld, ixmem = %ld\n",fp,fp,x,x,*ixmem); */
*ierr = 0;
}
void F77_NAME(free_mem_alloc, FREE_MEM_ALLOC) ()
{
/* Frees all memory allocated by calls to mem_alloc */
int i;
for (i = 0; i < n_malloced_pointers; i++)
{
free( malloced_pointers[i] );
}
n_malloced_pointers = 0;
}
long long F77_NAME(c_loc64, C_LOC64)(char *base, long long *ix, f_int *size)
{
long long addr;
addr = (long long) base + (*ix-1)*(*size);
/* printf("C_LOC64: base address %x %ld, ix %ld, size %d, addr %x %ld\n",
base,base,*ix,*size,addr,addr); */
return addr;
}
long long F77_NAME(c_loc64p, C_LOC64P)(char *base, long long *ix, f_int *size)
{
long long addr;
addr = (long long) base + (*ix-1)*(*size);
return addr;
}
| certik/ACESIII | sip_shared/malloc_wrapper.c | C | gpl-2.0 | 3,415 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2494,
1011,
2230,
2118,
1997,
3516,
1008,
1008,
2023,
2565,
2003,
2489,
4007,
1025,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1998,
1013,
2030,
19933,
1008,
2009,
2104,
1996,
3408,
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... |
package org.tutsflow.json.service;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.i18n.SessionLocaleResolver;
import org.tutsflow.local.service.UserLocalService;
import org.tutsflow.model.User;
import org.tutsflow.view.PaginationJsonView;
import static org.tutsflow.constant.Services.*;
@Controller
public class UserJService {
/* *******************************************************
* *** USER find all : /service/user/{page}/{size} *****
* *******************************************************/
@RequestMapping(value = USER_FIND_ALL, method = RequestMethod.GET, produces = {TXT_P, APP_J})
@ResponseBody
public String findAllPageable(@PathVariable int page, @PathVariable int size,
HttpServletRequest request, HttpServletResponse response) {
// User list
Page<User> usersP = userLocalService.findAll(new PageRequest(page, size));
List<User> users = usersP.getContent();
int totalElements = (int)usersP.getTotalElements();
// Pages Text
int rowsTo = size * (page + 1);
int rowsFrom = (rowsTo - size) + 1;
if (rowsTo > totalElements) {rowsTo = totalElements;}
// View creation
PaginationJsonView<User> output = new PaginationJsonView<>();
output.setData(users);
output.setTotalEntries(totalElements);
output.setTotalPages(usersP.getTotalPages());
output.setPageText( messageSource.getMessage(
"cp.pages.text",
new Object[]{rowsFrom, rowsTo, output.getTotalEntries()},
localeResolver.resolveLocale(request)));
return output.toJSONString();
}
/* *******************************
******* Injected objects ********
****************************** */
private UserLocalService userLocalService;
private ReloadableResourceBundleMessageSource messageSource;
private SessionLocaleResolver localeResolver;
/* *******************************
********** Constructor **********
******************************* */
@Autowired
public UserJService(UserLocalService userLocalService,
ReloadableResourceBundleMessageSource messageSource,
SessionLocaleResolver localeResolver) {
this.userLocalService = userLocalService;
this.messageSource = messageSource;
this.localeResolver = localeResolver;
}
}
| SergioLarios/tuts-flow | tf-web/src/main/java/org/tutsflow/json/service/UserJService.java | Java | mit | 2,839 | [
30522,
7427,
8917,
1012,
10722,
3215,
12314,
1012,
1046,
3385,
1012,
2326,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
2862,
1025,
12324,
9262,
2595,
1012,
14262,
2615,
7485,
1012,
8299,
1012,
16770,
2121,
2615,
7485,
2890,
15500,
1025,
123... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 Ember from 'ember';
import DS from 'ember-data';
import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin';
export default DS.RESTAdapter.extend(DataAdapterMixin, {
authorizer: 'authorizer:dspace',
initENVProperties: Ember.on('init', function() {
let ENV = this.container.lookupFactory('config:environment');
if (Ember.isPresent(ENV.namespace)) {
this.set('namespace', ENV.namespace);
}
if (Ember.isPresent(ENV.host)) {
this.set('host', ENV.host);
}
}),
//coalesceFindRequests: true, -> commented out, because it only works for some endpoints (e.g. items) and not others (e.g. communities)
ajax(url, type, hash) {
if (Ember.isEmpty(hash)) {
hash = {};
}
if (Ember.isEmpty(hash.data)) {
hash.data = {};
}
if (type === "GET") {
hash.data.expand = 'all'; //add ?expand=all to all GET calls
}
return this._super(url, type, hash);
}
});
| atmire/dsember-core | addon/adapters/application.js | JavaScript | mit | 949 | [
30522,
12324,
7861,
5677,
2013,
1005,
7861,
5677,
1005,
1025,
12324,
16233,
2013,
1005,
7861,
5677,
1011,
2951,
1005,
1025,
12324,
2951,
8447,
13876,
2121,
4328,
20303,
2013,
1005,
7861,
5677,
1011,
3722,
1011,
8740,
2705,
1013,
4666,
7076,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 TelegramBot\Api\Types\InputMedia;
use TelegramBot\Api\BaseType;
use TelegramBot\Api\Collection\CollectionItemInterface;
/**
* Class InputMedia
* This object represents the content of a media message to be sent.
*
* @package TelegramBot\Api
*/
class InputMedia extends BaseType implements CollectionItemInterface
{
/**
* {@inheritdoc}
*
* @var array
*/
static protected $requiredParams = ['type', 'media'];
/**
* {@inheritdoc}
*
* @var array
*/
static protected $map = [
'type' => true,
'media' => true,
'caption' => true,
'parse_mode' => true,
];
/**
* Type of the result.
*
* @var string
*/
protected $type;
/**
* File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended),
* pass an HTTP URL for Telegram to get a file from the Internet, or pass "attach://<file_attach_name>"
* to upload a new one using multipart/form-data under <file_attach_name> name.
*
* @var string
*/
protected $media;
/**
* Optional. Caption of the photo to be sent, 0-200 characters.
*
* @var string
*/
protected $caption;
/**
* Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic,
* fixed-width text or inline URLs in the media caption.
*
* @var string
*/
protected $parseMode;
/**
* @return string
*/
public function getType()
{
return $this->type;
}
/**
* @param string $type
*/
public function setType($type)
{
$this->type = $type;
}
/**
* @return string
*/
public function getMedia()
{
return $this->media;
}
/**
* @param string $media
*/
public function setMedia($media)
{
$this->media = $media;
}
/**
* @return string
*/
public function getCaption()
{
return $this->caption;
}
/**
* @param string $caption
*/
public function setCaption($caption)
{
$this->caption = $caption;
}
/**
* @return string
*/
public function getParseMode()
{
return $this->parseMode;
}
/**
* @param string $parseMode
*/
public function setParseMode($parseMode)
{
$this->parseMode = $parseMode;
}
}
| tgbot/api | src/Types/InputMedia/InputMedia.php | PHP | mit | 2,448 | [
30522,
1026,
1029,
25718,
3415,
15327,
23921,
18384,
1032,
17928,
1032,
4127,
1032,
7953,
16969,
1025,
2224,
23921,
18384,
1032,
17928,
1032,
2918,
13874,
1025,
2224,
23921,
18384,
1032,
17928,
1032,
3074,
1032,
3074,
4221,
10020,
3334,
12172... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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>Class template explicit_error_stepper_base</title>
<link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="../../../index.html" title="Chapter 1. Boost.Numeric.Odeint">
<link rel="up" href="../../../header/boost/numeric/odeint/stepper/base/explicit_error_stepper_base_hpp.html" title="Header <boost/numeric/odeint/stepper/base/explicit_error_stepper_base.hpp>">
<link rel="prev" href="../../../header/boost/numeric/odeint/stepper/base/explicit_error_stepper_base_hpp.html" title="Header <boost/numeric/odeint/stepper/base/explicit_error_stepper_base.hpp>">
<link rel="next" href="../../../header/boost/numeric/odeint/stepper/base/explicit_error_stepper_fsal_base_hpp.html" title="Header <boost/numeric/odeint/stepper/base/explicit_error_stepper_fsal_base.hpp>">
</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="../../../logo.jpg"></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="../../../header/boost/numeric/odeint/stepper/base/explicit_error_stepper_base_hpp.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../header/boost/numeric/odeint/stepper/base/explicit_error_stepper_base_hpp.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="../../../header/boost/numeric/odeint/stepper/base/explicit_error_stepper_fsal_base_hpp.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="boost.numeric.odeint.explicit_error_idp26364872"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class template explicit_error_stepper_base</span></h2>
<p>boost::numeric::odeint::explicit_error_stepper_base — Base class for explicit steppers with error estimation. This class can used with controlled steppers for step size control. </p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../../header/boost/numeric/odeint/stepper/base/explicit_error_stepper_base_hpp.html" title="Header <boost/numeric/odeint/stepper/base/explicit_error_stepper_base.hpp>">boost/numeric/odeint/stepper/base/explicit_error_stepper_base.hpp</a>>
</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> Stepper<span class="special">,</span> <span class="keyword">unsigned</span> <span class="keyword">short</span> Order<span class="special">,</span> <span class="keyword">unsigned</span> <span class="keyword">short</span> StepperOrder<span class="special">,</span>
<span class="keyword">unsigned</span> <span class="keyword">short</span> ErrorOrder<span class="special">,</span> <span class="keyword">typename</span> State<span class="special">,</span> <span class="keyword">typename</span> Value<span class="special">,</span>
<span class="keyword">typename</span> Deriv<span class="special">,</span> <span class="keyword">typename</span> Time<span class="special">,</span> <span class="keyword">typename</span> Algebra<span class="special">,</span> <span class="keyword">typename</span> Operations<span class="special">,</span>
<span class="keyword">typename</span> Resizer<span class="special">></span>
<span class="keyword">class</span> <a class="link" href="explicit_error_idp26364872.html" title="Class template explicit_error_stepper_base">explicit_error_stepper_base</a> <span class="special">:</span>
<span class="keyword">public</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">numeric</span><span class="special">::</span><span class="identifier">odeint</span><span class="special">::</span><span class="identifier">algebra_stepper_base</span><span class="special"><</span> <span class="identifier">Algebra</span><span class="special">,</span> <span class="identifier">Operations</span> <span class="special">></span>
<span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
<span class="comment">// types</span>
<span class="keyword">typedef</span> <a class="link" href="algebra_stepper_base.html" title="Class template algebra_stepper_base">algebra_stepper_base</a><span class="special"><</span> <span class="identifier">Algebra</span><span class="special">,</span> <span class="identifier">Operations</span> <span class="special">></span> <a name="boost.numeric.odeint.explicit_error_idp26364872.algebra_stepper_base_type"></a><span class="identifier">algebra_stepper_base_type</span><span class="special">;</span>
<span class="keyword">typedef</span> <span class="identifier">algebra_stepper_base_type</span><span class="special">::</span><span class="identifier">algebra_type</span> <a name="boost.numeric.odeint.explicit_error_idp26364872.algebra_type"></a><span class="identifier">algebra_type</span><span class="special">;</span>
<span class="keyword">typedef</span> <span class="identifier">State</span> <a name="boost.numeric.odeint.explicit_error_idp26364872.state_type"></a><span class="identifier">state_type</span><span class="special">;</span>
<span class="keyword">typedef</span> <span class="identifier">Value</span> <a name="boost.numeric.odeint.explicit_error_idp26364872.value_type"></a><span class="identifier">value_type</span><span class="special">;</span>
<span class="keyword">typedef</span> <span class="identifier">Deriv</span> <a name="boost.numeric.odeint.explicit_error_idp26364872.deriv_type"></a><span class="identifier">deriv_type</span><span class="special">;</span>
<span class="keyword">typedef</span> <span class="identifier">Time</span> <a name="boost.numeric.odeint.explicit_error_idp26364872.time_type"></a><span class="identifier">time_type</span><span class="special">;</span>
<span class="keyword">typedef</span> <span class="identifier">Resizer</span> <a name="boost.numeric.odeint.explicit_error_idp26364872.resizer_type"></a><span class="identifier">resizer_type</span><span class="special">;</span>
<span class="keyword">typedef</span> <span class="identifier">Stepper</span> <a name="boost.numeric.odeint.explicit_error_idp26364872.stepper_type"></a><span class="identifier">stepper_type</span><span class="special">;</span>
<span class="keyword">typedef</span> <span class="identifier">explicit_error_stepper_tag</span> <a name="boost.numeric.odeint.explicit_error_idp26364872.stepper_category"></a><span class="identifier">stepper_category</span><span class="special">;</span>
<span class="keyword">typedef</span> <span class="keyword">unsigned</span> <span class="keyword">short</span> <a name="boost.numeric.odeint.explicit_error_idp26364872.order_type"></a><span class="identifier">order_type</span><span class="special">;</span>
<span class="comment">// <a class="link" href="explicit_error_idp26364872.html#boost.numeric.odeint.explicit_error_idp26364872construct-copy-destruct">construct/copy/destruct</a></span>
<a class="link" href="explicit_error_idp26364872.html#idp26452808-bb"><span class="identifier">explicit_error_stepper_base</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">algebra_type</span> <span class="special">&</span> <span class="special">=</span> <span class="identifier">algebra_type</span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span>
<span class="comment">// <a class="link" href="explicit_error_idp26364872.html#idp26391704-bb">public member functions</a></span>
<span class="identifier">order_type</span> <a class="link" href="explicit_error_idp26364872.html#idp26391912-bb"><span class="identifier">order</span></a><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
<span class="identifier">order_type</span> <a class="link" href="explicit_error_idp26364872.html#idp26393192-bb"><span class="identifier">stepper_order</span></a><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
<span class="identifier">order_type</span> <a class="link" href="explicit_error_idp26364872.html#idp26394472-bb"><span class="identifier">error_order</span></a><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> System<span class="special">,</span> <span class="keyword">typename</span> StateInOut<span class="special">></span>
<span class="keyword">void</span> <a class="link" href="explicit_error_idp26364872.html#idp26395768-bb"><span class="identifier">do_step</span></a><span class="special">(</span><span class="identifier">System</span><span class="special">,</span> <span class="identifier">StateInOut</span> <span class="special">&</span><span class="special">,</span> <span class="identifier">time_type</span><span class="special">,</span> <span class="identifier">time_type</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> System<span class="special">,</span> <span class="keyword">typename</span> StateInOut<span class="special">></span>
<span class="keyword">void</span> <a class="link" href="explicit_error_idp26364872.html#idp26399768-bb"><span class="identifier">do_step</span></a><span class="special">(</span><span class="identifier">System</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">StateInOut</span> <span class="special">&</span><span class="special">,</span> <span class="identifier">time_type</span><span class="special">,</span> <span class="identifier">time_type</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> System<span class="special">,</span> <span class="keyword">typename</span> StateInOut<span class="special">,</span> <span class="keyword">typename</span> DerivIn<span class="special">></span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">disable_if</span><span class="special"><</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_same</span><span class="special"><</span> <span class="identifier">DerivIn</span><span class="special">,</span> <span class="identifier">time_type</span> <span class="special">></span><span class="special">,</span> <span class="keyword">void</span> <span class="special">></span><span class="special">::</span><span class="identifier">type</span>
<a class="link" href="explicit_error_idp26364872.html#idp26402504-bb"><span class="identifier">do_step</span></a><span class="special">(</span><span class="identifier">System</span><span class="special">,</span> <span class="identifier">StateInOut</span> <span class="special">&</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">DerivIn</span> <span class="special">&</span><span class="special">,</span> <span class="identifier">time_type</span><span class="special">,</span> <span class="identifier">time_type</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> System<span class="special">,</span> <span class="keyword">typename</span> StateIn<span class="special">,</span> <span class="keyword">typename</span> StateOut<span class="special">></span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">disable_if</span><span class="special"><</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_same</span><span class="special"><</span> <span class="identifier">StateIn</span><span class="special">,</span> <span class="identifier">time_type</span> <span class="special">></span><span class="special">,</span> <span class="keyword">void</span> <span class="special">></span><span class="special">::</span><span class="identifier">type</span>
<a class="link" href="explicit_error_idp26364872.html#idp26408552-bb"><span class="identifier">do_step</span></a><span class="special">(</span><span class="identifier">System</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">StateIn</span> <span class="special">&</span><span class="special">,</span> <span class="identifier">time_type</span><span class="special">,</span> <span class="identifier">StateOut</span> <span class="special">&</span><span class="special">,</span> <span class="identifier">time_type</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> System<span class="special">,</span> <span class="keyword">typename</span> StateIn<span class="special">,</span> <span class="keyword">typename</span> DerivIn<span class="special">,</span>
<span class="keyword">typename</span> StateOut<span class="special">></span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">disable_if</span><span class="special"><</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_same</span><span class="special"><</span> <span class="identifier">DerivIn</span><span class="special">,</span> <span class="identifier">time_type</span> <span class="special">></span><span class="special">,</span> <span class="keyword">void</span> <span class="special">></span><span class="special">::</span><span class="identifier">type</span>
<a class="link" href="explicit_error_idp26364872.html#idp26414056-bb"><span class="identifier">do_step</span></a><span class="special">(</span><span class="identifier">System</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">StateIn</span> <span class="special">&</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">DerivIn</span> <span class="special">&</span><span class="special">,</span> <span class="identifier">time_type</span><span class="special">,</span> <span class="identifier">StateOut</span> <span class="special">&</span><span class="special">,</span>
<span class="identifier">time_type</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> System<span class="special">,</span> <span class="keyword">typename</span> StateInOut<span class="special">,</span> <span class="keyword">typename</span> Err<span class="special">></span>
<span class="keyword">void</span> <a class="link" href="explicit_error_idp26364872.html#idp26420616-bb"><span class="identifier">do_step</span></a><span class="special">(</span><span class="identifier">System</span><span class="special">,</span> <span class="identifier">StateInOut</span> <span class="special">&</span><span class="special">,</span> <span class="identifier">time_type</span><span class="special">,</span> <span class="identifier">time_type</span><span class="special">,</span> <span class="identifier">Err</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> System<span class="special">,</span> <span class="keyword">typename</span> StateInOut<span class="special">,</span> <span class="keyword">typename</span> Err<span class="special">></span>
<span class="keyword">void</span> <a class="link" href="explicit_error_idp26364872.html#idp26425480-bb"><span class="identifier">do_step</span></a><span class="special">(</span><span class="identifier">System</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">StateInOut</span> <span class="special">&</span><span class="special">,</span> <span class="identifier">time_type</span><span class="special">,</span> <span class="identifier">time_type</span><span class="special">,</span> <span class="identifier">Err</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> System<span class="special">,</span> <span class="keyword">typename</span> StateInOut<span class="special">,</span> <span class="keyword">typename</span> DerivIn<span class="special">,</span>
<span class="keyword">typename</span> Err<span class="special">></span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">disable_if</span><span class="special"><</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_same</span><span class="special"><</span> <span class="identifier">DerivIn</span><span class="special">,</span> <span class="identifier">time_type</span> <span class="special">></span><span class="special">,</span> <span class="keyword">void</span> <span class="special">></span><span class="special">::</span><span class="identifier">type</span>
<a class="link" href="explicit_error_idp26364872.html#idp26428824-bb"><span class="identifier">do_step</span></a><span class="special">(</span><span class="identifier">System</span><span class="special">,</span> <span class="identifier">StateInOut</span> <span class="special">&</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">DerivIn</span> <span class="special">&</span><span class="special">,</span> <span class="identifier">time_type</span><span class="special">,</span> <span class="identifier">time_type</span><span class="special">,</span>
<span class="identifier">Err</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> System<span class="special">,</span> <span class="keyword">typename</span> StateIn<span class="special">,</span> <span class="keyword">typename</span> StateOut<span class="special">,</span> <span class="keyword">typename</span> Err<span class="special">></span>
<span class="keyword">void</span> <a class="link" href="explicit_error_idp26364872.html#idp26435720-bb"><span class="identifier">do_step</span></a><span class="special">(</span><span class="identifier">System</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">StateIn</span> <span class="special">&</span><span class="special">,</span> <span class="identifier">time_type</span><span class="special">,</span> <span class="identifier">StateOut</span> <span class="special">&</span><span class="special">,</span> <span class="identifier">time_type</span><span class="special">,</span>
<span class="identifier">Err</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> System<span class="special">,</span> <span class="keyword">typename</span> StateIn<span class="special">,</span> <span class="keyword">typename</span> DerivIn<span class="special">,</span>
<span class="keyword">typename</span> StateOut<span class="special">,</span> <span class="keyword">typename</span> Err<span class="special">></span>
<span class="keyword">void</span> <a class="link" href="explicit_error_idp26364872.html#idp26441688-bb"><span class="identifier">do_step</span></a><span class="special">(</span><span class="identifier">System</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">StateIn</span> <span class="special">&</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">DerivIn</span> <span class="special">&</span><span class="special">,</span> <span class="identifier">time_type</span><span class="special">,</span>
<span class="identifier">StateOut</span> <span class="special">&</span><span class="special">,</span> <span class="identifier">time_type</span><span class="special">,</span> <span class="identifier">Err</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> StateIn<span class="special">></span> <span class="keyword">void</span> <a class="link" href="explicit_error_idp26364872.html#idp26449048-bb"><span class="identifier">adjust_size</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">StateIn</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span>
<span class="identifier">algebra_type</span> <span class="special">&</span> <a class="link" href="explicit_error_idp26364872.html#idp26450936-bb"><span class="identifier">algebra</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">const</span> <span class="identifier">algebra_type</span> <span class="special">&</span> <a class="link" href="explicit_error_idp26364872.html#idp26451864-bb"><span class="identifier">algebra</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
<span class="comment">// <a class="link" href="explicit_error_idp26364872.html#idp26454872-bb">private member functions</a></span>
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> System<span class="special">,</span> <span class="keyword">typename</span> StateInOut<span class="special">></span>
<span class="keyword">void</span> <a class="link" href="explicit_error_idp26364872.html#idp26455080-bb"><span class="identifier">do_step_v1</span></a><span class="special">(</span><span class="identifier">System</span><span class="special">,</span> <span class="identifier">StateInOut</span> <span class="special">&</span><span class="special">,</span> <span class="identifier">time_type</span><span class="special">,</span> <span class="identifier">time_type</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> System<span class="special">,</span> <span class="keyword">typename</span> StateInOut<span class="special">,</span> <span class="keyword">typename</span> Err<span class="special">></span>
<span class="keyword">void</span> <a class="link" href="explicit_error_idp26364872.html#idp26457576-bb"><span class="identifier">do_step_v5</span></a><span class="special">(</span><span class="identifier">System</span><span class="special">,</span> <span class="identifier">StateInOut</span> <span class="special">&</span><span class="special">,</span> <span class="identifier">time_type</span><span class="special">,</span> <span class="identifier">time_type</span><span class="special">,</span> <span class="identifier">Err</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> StateIn<span class="special">></span> <span class="keyword">bool</span> <a class="link" href="explicit_error_idp26364872.html#idp26460680-bb"><span class="identifier">resize_impl</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">StateIn</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span>
<span class="identifier">stepper_type</span> <span class="special">&</span> <a class="link" href="explicit_error_idp26364872.html#idp26461896-bb"><span class="identifier">stepper</span></a><span class="special">(</span><span class="keyword">void</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">const</span> <span class="identifier">stepper_type</span> <span class="special">&</span> <a class="link" href="explicit_error_idp26364872.html#idp26462696-bb"><span class="identifier">stepper</span></a><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
<span class="comment">// public data members</span>
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">order_type</span> <span class="identifier">order_value</span><span class="special">;</span>
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">order_type</span> <span class="identifier">stepper_order_value</span><span class="special">;</span>
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">order_type</span> <span class="identifier">error_order_value</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="idp54109400"></a><h2>Description</h2>
<p>This class serves as the base class for all explicit steppers with algebra and operations. In contrast to <a class="link" href="explicit_stepper_base.html" title="Class template explicit_stepper_base">explicit_stepper_base</a> it also estimates the error and can be used in a controlled stepper to provide step size control.</p>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>This stepper provides <code class="computeroutput">do_step</code> methods with and without error estimation. It has therefore three orders, one for the order of a step if the error is not estimated. The other two orders are the orders of the step and the error step if the error estimation is performed.</p></td></tr>
</table></div>
<p>
<a class="link" href="explicit_error_idp26364872.html" title="Class template explicit_error_stepper_base">explicit_error_stepper_base</a> is used as the interface in a CRTP (currently recurring template pattern). In order to work correctly the parent class needs to have a method <code class="computeroutput">do_step_impl( system , in , dxdt_in , t , out , dt , xerr )</code>. <a class="link" href="explicit_error_idp26364872.html" title="Class template explicit_error_stepper_base">explicit_error_stepper_base</a> derives from <a class="link" href="algebra_stepper_base.html" title="Class template algebra_stepper_base">algebra_stepper_base</a>.</p>
<p><a class="link" href="explicit_error_idp26364872.html" title="Class template explicit_error_stepper_base">explicit_error_stepper_base</a> provides several overloaded <code class="computeroutput">do_step</code> methods, see the list below. Only two of them are needed to fulfill the Error Stepper concept. The other ones are for convenience and for performance. Some of them simply update the state out-of-place, while other expect that the first derivative at <code class="computeroutput">t</code> is passed to the stepper.</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem"><p><code class="computeroutput">do_step( sys , x , t , dt )</code> - The classical <code class="computeroutput">do_step</code> method needed to fulfill the Error Stepper concept. The state is updated in-place. A type modelling a Boost.Range can be used for x.</p></li>
<li class="listitem"><p><code class="computeroutput">do_step( sys , x , dxdt , t , dt )</code> - This method updates the state in-place, but the derivative at the point <code class="computeroutput">t</code> must be explicitly passed in <code class="computeroutput">dxdt</code>.</p></li>
<li class="listitem"><p><code class="computeroutput">do_step( sys , in , t , out , dt )</code> - This method updates the state out-of-place, hence the result of the step is stored in <code class="computeroutput">out</code>.</p></li>
<li class="listitem"><p><code class="computeroutput">do_step( sys , in , dxdt , t , out , dt )</code> - This method update the state out-of-place and expects that the derivative at the point <code class="computeroutput">t</code> is explicitly passed in <code class="computeroutput">dxdt</code>. It is a combination of the two <code class="computeroutput">do_step</code> methods above.</p></li>
<li class="listitem"><p><code class="computeroutput">do_step( sys , x , t , dt , xerr )</code> - This <code class="computeroutput">do_step</code> method is needed to fulfill the Error Stepper concept. The state is updated in-place and an error estimate is calculated. A type modelling a Boost.Range can be used for x.</p></li>
<li class="listitem"><p><code class="computeroutput">do_step( sys , x , dxdt , t , dt , xerr )</code> - This method updates the state in-place, but the derivative at the point <code class="computeroutput">t</code> must be passed in <code class="computeroutput">dxdt</code>. An error estimate is calculated.</p></li>
<li class="listitem"><p><code class="computeroutput">do_step( sys , in , t , out , dt , xerr )</code> - This method updates the state out-of-place and estimates the error during the step.</p></li>
<li class="listitem"><p><code class="computeroutput">do_step( sys , in , dxdt , t , out , dt , xerr )</code> - This methods updates the state out-of-place and estimates the error during the step. Furthermore, the derivative at <code class="computeroutput">t</code> must be passed in <code class="computeroutput">dxdt</code>.</p></li>
</ul></div>
<p>
</p>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top">
<p>The system is always passed as value, which might result in poor performance if it contains data. In this case it can be used with <code class="computeroutput">boost::ref</code> or <code class="computeroutput">std::ref</code>, for example <code class="computeroutput">stepper.do_step( boost::ref( sys ) , x , t , dt );</code></p>
<p>The time <code class="computeroutput">t</code> is not advanced by the stepper. This has to done manually, or by the appropriate <code class="computeroutput">integrate</code> routines or <code class="computeroutput">iterator</code>s.</p>
</td></tr>
</table></div>
<p>
</p>
<div class="refsect2">
<a name="idp54127096"></a><h3>Template Parameters</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><span class="keyword">typename</span> Stepper</pre>
<p>The stepper on which this class should work. It is used via CRTP, hence <code class="computeroutput"><a class="link" href="explicit_stepper_base.html" title="Class template explicit_stepper_base">explicit_stepper_base</a></code> provides the interface for the Stepper. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">unsigned</span> <span class="keyword">short</span> Order</pre>
<p>The order of a stepper if the stepper is used without error estimation. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">unsigned</span> <span class="keyword">short</span> StepperOrder</pre>
<p>The order of a step if the stepper is used with error estimation. Usually Order and StepperOrder have the same value. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">unsigned</span> <span class="keyword">short</span> ErrorOrder</pre>
<p>The order of the error step if the stepper is used with error estimation. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">typename</span> State</pre>
<p>The state type for the stepper. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">typename</span> Value</pre>
<p>The value type for the stepper. This should be a floating point type, like float, double, or a multiprecision type. It must not necessary be the value_type of the State. For example the State can be a <code class="computeroutput">vector< complex< double > ></code> in this case the Value must be double. The default value is double. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">typename</span> Deriv</pre>
<p>The type representing time derivatives of the state type. It is usually the same type as the state type, only if used with Boost.Units both types differ. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">typename</span> Time</pre>
<p>The type representing the time. Usually the same type as the value type. When Boost.Units is used, this type has usually a unit. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">typename</span> Algebra</pre>
<p>The algebra type which must fulfill the Algebra Concept. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">typename</span> Operations</pre>
<p>The type for the operations which must fulfill the Operations Concept. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">typename</span> Resizer</pre>
<p>The resizer policy class. </p>
</li>
</ol></div>
</div>
<div class="refsect2">
<a name="idp54141832"></a><h3>
<a name="boost.numeric.odeint.explicit_error_idp26364872construct-copy-destruct"></a><code class="computeroutput">explicit_error_stepper_base</code>
public
construct/copy/destruct</h3>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<pre class="literallayout"><a name="idp26452808-bb"></a><span class="identifier">explicit_error_stepper_base</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">algebra_type</span> <span class="special">&</span> algebra <span class="special">=</span> <span class="identifier">algebra_type</span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span></pre>Constructs a <code class="computeroutput"><a class="link" href="explicit_error_idp26364872.html" title="Class template explicit_error_stepper_base">explicit_error_stepper_base</a></code> class. This constructor can be used as a default constructor if the algebra has a default constructor. <p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">algebra</code></span></p></td>
<td><p>A copy of algebra is made and stored inside <code class="computeroutput"><a class="link" href="explicit_stepper_base.html" title="Class template explicit_stepper_base">explicit_stepper_base</a></code>. </p></td>
</tr></tbody>
</table></div></td>
</tr></tbody>
</table></div>
</li></ol></div>
</div>
<div class="refsect2">
<a name="idp54150232"></a><h3>
<a name="idp26391704-bb"></a><code class="computeroutput">explicit_error_stepper_base</code> public member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><span class="identifier">order_type</span> <a name="idp26391912-bb"></a><span class="identifier">order</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p>Returns the order of the stepper if it used without error estimation. </p></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">order_type</span> <a name="idp26393192-bb"></a><span class="identifier">stepper_order</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p>Returns the order of a step if the stepper is used without error estimation. </p></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">order_type</span> <a name="idp26394472-bb"></a><span class="identifier">error_order</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p>Returns the order of an error step if the stepper is used without error estimation. </p></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> System<span class="special">,</span> <span class="keyword">typename</span> StateInOut<span class="special">></span>
<span class="keyword">void</span> <a name="idp26395768-bb"></a><span class="identifier">do_step</span><span class="special">(</span><span class="identifier">System</span> system<span class="special">,</span> <span class="identifier">StateInOut</span> <span class="special">&</span> x<span class="special">,</span> <span class="identifier">time_type</span> t<span class="special">,</span> <span class="identifier">time_type</span> dt<span class="special">)</span><span class="special">;</span></pre>This method performs one step. It transforms the result in-place. <p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><code class="computeroutput">dt</code></span></p></td>
<td><p>The step size. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">system</code></span></p></td>
<td><p>The system function to solve, hence the r.h.s. of the ordinary differential equation. It must fulfill the Simple System concept. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">t</code></span></p></td>
<td><p>The value of the time, at which the step should be performed. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">x</code></span></p></td>
<td><p>The state of the ODE which should be solved. After calling do_step the result is updated in x. </p></td>
</tr>
</tbody>
</table></div></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> System<span class="special">,</span> <span class="keyword">typename</span> StateInOut<span class="special">></span>
<span class="keyword">void</span> <a name="idp26399768-bb"></a><span class="identifier">do_step</span><span class="special">(</span><span class="identifier">System</span> system<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">StateInOut</span> <span class="special">&</span> x<span class="special">,</span> <span class="identifier">time_type</span> t<span class="special">,</span> <span class="identifier">time_type</span> dt<span class="special">)</span><span class="special">;</span></pre>Second version to solve the forwarding problem, can be called with Boost.Range as StateInOut. </li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> System<span class="special">,</span> <span class="keyword">typename</span> StateInOut<span class="special">,</span> <span class="keyword">typename</span> DerivIn<span class="special">></span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">disable_if</span><span class="special"><</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_same</span><span class="special"><</span> <span class="identifier">DerivIn</span><span class="special">,</span> <span class="identifier">time_type</span> <span class="special">></span><span class="special">,</span> <span class="keyword">void</span> <span class="special">></span><span class="special">::</span><span class="identifier">type</span>
<a name="idp26402504-bb"></a><span class="identifier">do_step</span><span class="special">(</span><span class="identifier">System</span> system<span class="special">,</span> <span class="identifier">StateInOut</span> <span class="special">&</span> x<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">DerivIn</span> <span class="special">&</span> dxdt<span class="special">,</span> <span class="identifier">time_type</span> t<span class="special">,</span>
<span class="identifier">time_type</span> dt<span class="special">)</span><span class="special">;</span></pre>The method performs one step with the stepper passed by Stepper. Additionally to the other method the derivative of x is also passed to this method. It is supposed to be used in the following way: <pre class="programlisting">sys( x , dxdt , t );
stepper.do_step( sys , x , dxdt , t , dt );
</pre>
<p>The result is updated in place in x. This method is disabled if Time and Deriv are of the same type. In this case the method could not be distinguished from other <code class="computeroutput">do_step</code> versions.</p>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>This method does not solve the forwarding problem.</p></td></tr>
</table></div>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><code class="computeroutput">dt</code></span></p></td>
<td><p>The step size. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">dxdt</code></span></p></td>
<td><p>The derivative of x at t. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">system</code></span></p></td>
<td><p>The system function to solve, hence the r.h.s. of the ODE. It must fulfill the Simple System concept. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">t</code></span></p></td>
<td><p>The value of the time, at which the step should be performed. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">x</code></span></p></td>
<td><p>The state of the ODE which should be solved. After calling do_step the result is updated in x. </p></td>
</tr>
</tbody>
</table></div></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> System<span class="special">,</span> <span class="keyword">typename</span> StateIn<span class="special">,</span> <span class="keyword">typename</span> StateOut<span class="special">></span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">disable_if</span><span class="special"><</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_same</span><span class="special"><</span> <span class="identifier">StateIn</span><span class="special">,</span> <span class="identifier">time_type</span> <span class="special">></span><span class="special">,</span> <span class="keyword">void</span> <span class="special">></span><span class="special">::</span><span class="identifier">type</span>
<a name="idp26408552-bb"></a><span class="identifier">do_step</span><span class="special">(</span><span class="identifier">System</span> system<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">StateIn</span> <span class="special">&</span> in<span class="special">,</span> <span class="identifier">time_type</span> t<span class="special">,</span> <span class="identifier">StateOut</span> <span class="special">&</span> out<span class="special">,</span>
<span class="identifier">time_type</span> dt<span class="special">)</span><span class="special">;</span></pre>The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place. This method is disabled if StateIn and Time are the same type. In this case the method can not be distinguished from other <code class="computeroutput">do_step</code> variants. <div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>This method does not solve the forwarding problem.</p></td></tr>
</table></div>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><code class="computeroutput">dt</code></span></p></td>
<td><p>The step size. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">in</code></span></p></td>
<td><p>The state of the ODE which should be solved. in is not modified in this method </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">out</code></span></p></td>
<td><p>The result of the step is written in out. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">system</code></span></p></td>
<td><p>The system function to solve, hence the r.h.s. of the ODE. It must fulfill the Simple System concept. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">t</code></span></p></td>
<td><p>The value of the time, at which the step should be performed. </p></td>
</tr>
</tbody>
</table></div></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> System<span class="special">,</span> <span class="keyword">typename</span> StateIn<span class="special">,</span> <span class="keyword">typename</span> DerivIn<span class="special">,</span>
<span class="keyword">typename</span> StateOut<span class="special">></span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">disable_if</span><span class="special"><</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_same</span><span class="special"><</span> <span class="identifier">DerivIn</span><span class="special">,</span> <span class="identifier">time_type</span> <span class="special">></span><span class="special">,</span> <span class="keyword">void</span> <span class="special">></span><span class="special">::</span><span class="identifier">type</span>
<a name="idp26414056-bb"></a><span class="identifier">do_step</span><span class="special">(</span><span class="identifier">System</span> system<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">StateIn</span> <span class="special">&</span> in<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">DerivIn</span> <span class="special">&</span> dxdt<span class="special">,</span>
<span class="identifier">time_type</span> t<span class="special">,</span> <span class="identifier">StateOut</span> <span class="special">&</span> out<span class="special">,</span> <span class="identifier">time_type</span> dt<span class="special">)</span><span class="special">;</span></pre>The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place. Furthermore, the derivative of x at t is passed to the stepper. It is supposed to be used in the following way: <pre class="programlisting">sys( in , dxdt , t );
stepper.do_step( sys , in , dxdt , t , out , dt );
</pre>
<p>This method is disabled if DerivIn and Time are of same type.</p>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>This method does not solve the forwarding problem.</p></td></tr>
</table></div>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><code class="computeroutput">dt</code></span></p></td>
<td><p>The step size. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">dxdt</code></span></p></td>
<td><p>The derivative of x at t. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">in</code></span></p></td>
<td><p>The state of the ODE which should be solved. in is not modified in this method </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">out</code></span></p></td>
<td><p>The result of the step is written in out. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">system</code></span></p></td>
<td><p>The system function to solve, hence the r.h.s. of the ODE. It must fulfill the Simple System concept. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">t</code></span></p></td>
<td><p>The value of the time, at which the step should be performed. </p></td>
</tr>
</tbody>
</table></div></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> System<span class="special">,</span> <span class="keyword">typename</span> StateInOut<span class="special">,</span> <span class="keyword">typename</span> Err<span class="special">></span>
<span class="keyword">void</span> <a name="idp26420616-bb"></a><span class="identifier">do_step</span><span class="special">(</span><span class="identifier">System</span> system<span class="special">,</span> <span class="identifier">StateInOut</span> <span class="special">&</span> x<span class="special">,</span> <span class="identifier">time_type</span> t<span class="special">,</span> <span class="identifier">time_type</span> dt<span class="special">,</span>
<span class="identifier">Err</span> <span class="special">&</span> xerr<span class="special">)</span><span class="special">;</span></pre>The method performs one step with the stepper passed by Stepper and estimates the error. The state of the ODE is updated in-place. <p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><code class="computeroutput">dt</code></span></p></td>
<td><p>The step size. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">system</code></span></p></td>
<td><p>The system function to solve, hence the r.h.s. of the ODE. It must fulfill the Simple System concept. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">t</code></span></p></td>
<td><p>The value of the time, at which the step should be performed. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">x</code></span></p></td>
<td><p>The state of the ODE which should be solved. x is updated by this method. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">xerr</code></span></p></td>
<td><p>The estimation of the error is stored in xerr. </p></td>
</tr>
</tbody>
</table></div></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> System<span class="special">,</span> <span class="keyword">typename</span> StateInOut<span class="special">,</span> <span class="keyword">typename</span> Err<span class="special">></span>
<span class="keyword">void</span> <a name="idp26425480-bb"></a><span class="identifier">do_step</span><span class="special">(</span><span class="identifier">System</span> system<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">StateInOut</span> <span class="special">&</span> x<span class="special">,</span> <span class="identifier">time_type</span> t<span class="special">,</span> <span class="identifier">time_type</span> dt<span class="special">,</span>
<span class="identifier">Err</span> <span class="special">&</span> xerr<span class="special">)</span><span class="special">;</span></pre>Second version to solve the forwarding problem, can be called with Boost.Range as StateInOut. </li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> System<span class="special">,</span> <span class="keyword">typename</span> StateInOut<span class="special">,</span> <span class="keyword">typename</span> DerivIn<span class="special">,</span> <span class="keyword">typename</span> Err<span class="special">></span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">disable_if</span><span class="special"><</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_same</span><span class="special"><</span> <span class="identifier">DerivIn</span><span class="special">,</span> <span class="identifier">time_type</span> <span class="special">></span><span class="special">,</span> <span class="keyword">void</span> <span class="special">></span><span class="special">::</span><span class="identifier">type</span>
<a name="idp26428824-bb"></a><span class="identifier">do_step</span><span class="special">(</span><span class="identifier">System</span> system<span class="special">,</span> <span class="identifier">StateInOut</span> <span class="special">&</span> x<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">DerivIn</span> <span class="special">&</span> dxdt<span class="special">,</span> <span class="identifier">time_type</span> t<span class="special">,</span>
<span class="identifier">time_type</span> dt<span class="special">,</span> <span class="identifier">Err</span> <span class="special">&</span> xerr<span class="special">)</span><span class="special">;</span></pre>The method performs one step with the stepper passed by Stepper. Additionally to the other method the derivative of x is also passed to this method. It is supposed to be used in the following way: <pre class="programlisting">sys( x , dxdt , t );
stepper.do_step( sys , x , dxdt , t , dt , xerr );
</pre>
<p>The result is updated in place in x. This method is disabled if Time and DerivIn are of the same type. In this case the method could not be distinguished from other <code class="computeroutput">do_step</code> versions.</p>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>This method does not solve the forwarding problem.</p></td></tr>
</table></div>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><code class="computeroutput">dt</code></span></p></td>
<td><p>The step size. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">dxdt</code></span></p></td>
<td><p>The derivative of x at t. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">system</code></span></p></td>
<td><p>The system function to solve, hence the r.h.s. of the ODE. It must fulfill the Simple System concept. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">t</code></span></p></td>
<td><p>The value of the time, at which the step should be performed. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">x</code></span></p></td>
<td><p>The state of the ODE which should be solved. After calling do_step the result is updated in x. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">xerr</code></span></p></td>
<td><p>The error estimate is stored in xerr. </p></td>
</tr>
</tbody>
</table></div></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> System<span class="special">,</span> <span class="keyword">typename</span> StateIn<span class="special">,</span> <span class="keyword">typename</span> StateOut<span class="special">,</span> <span class="keyword">typename</span> Err<span class="special">></span>
<span class="keyword">void</span> <a name="idp26435720-bb"></a><span class="identifier">do_step</span><span class="special">(</span><span class="identifier">System</span> system<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">StateIn</span> <span class="special">&</span> in<span class="special">,</span> <span class="identifier">time_type</span> t<span class="special">,</span> <span class="identifier">StateOut</span> <span class="special">&</span> out<span class="special">,</span>
<span class="identifier">time_type</span> dt<span class="special">,</span> <span class="identifier">Err</span> <span class="special">&</span> xerr<span class="special">)</span><span class="special">;</span></pre>The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place. Furthermore, the error is estimated. <div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>This method does not solve the forwarding problem.</p></td></tr>
</table></div>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><code class="computeroutput">dt</code></span></p></td>
<td><p>The step size. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">in</code></span></p></td>
<td><p>The state of the ODE which should be solved. in is not modified in this method </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">out</code></span></p></td>
<td><p>The result of the step is written in out. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">system</code></span></p></td>
<td><p>The system function to solve, hence the r.h.s. of the ODE. It must fulfill the Simple System concept. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">t</code></span></p></td>
<td><p>The value of the time, at which the step should be performed. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">xerr</code></span></p></td>
<td><p>The error estimate. </p></td>
</tr>
</tbody>
</table></div></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> System<span class="special">,</span> <span class="keyword">typename</span> StateIn<span class="special">,</span> <span class="keyword">typename</span> DerivIn<span class="special">,</span>
<span class="keyword">typename</span> StateOut<span class="special">,</span> <span class="keyword">typename</span> Err<span class="special">></span>
<span class="keyword">void</span> <a name="idp26441688-bb"></a><span class="identifier">do_step</span><span class="special">(</span><span class="identifier">System</span> system<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">StateIn</span> <span class="special">&</span> in<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">DerivIn</span> <span class="special">&</span> dxdt<span class="special">,</span>
<span class="identifier">time_type</span> t<span class="special">,</span> <span class="identifier">StateOut</span> <span class="special">&</span> out<span class="special">,</span> <span class="identifier">time_type</span> dt<span class="special">,</span> <span class="identifier">Err</span> <span class="special">&</span> xerr<span class="special">)</span><span class="special">;</span></pre>The method performs one step with the stepper passed by Stepper. The state of the ODE is updated out-of-place. Furthermore, the derivative of x at t is passed to the stepper and the error is estimated. It is supposed to be used in the following way: <pre class="programlisting">sys( in , dxdt , t );
stepper.do_step( sys , in , dxdt , t , out , dt );
</pre>
<p>This method is disabled if DerivIn and Time are of same type.</p>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>This method does not solve the forwarding problem.</p></td></tr>
</table></div>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><code class="computeroutput">dt</code></span></p></td>
<td><p>The step size. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">dxdt</code></span></p></td>
<td><p>The derivative of x at t. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">in</code></span></p></td>
<td><p>The state of the ODE which should be solved. in is not modified in this method </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">out</code></span></p></td>
<td><p>The result of the step is written in out. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">system</code></span></p></td>
<td><p>The system function to solve, hence the r.h.s. of the ODE. It must fulfill the Simple System concept. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">t</code></span></p></td>
<td><p>The value of the time, at which the step should be performed. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">xerr</code></span></p></td>
<td><p>The error estimate. </p></td>
</tr>
</tbody>
</table></div></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> StateIn<span class="special">></span> <span class="keyword">void</span> <a name="idp26449048-bb"></a><span class="identifier">adjust_size</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">StateIn</span> <span class="special">&</span> x<span class="special">)</span><span class="special">;</span></pre>Adjust the size of all temporaries in the stepper manually. <p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">x</code></span></p></td>
<td><p>A state from which the size of the temporaries to be resized is deduced. </p></td>
</tr></tbody>
</table></div></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">algebra_type</span> <span class="special">&</span> <a name="idp26450936-bb"></a><span class="identifier">algebra</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p>A reference to the algebra which is held by this class. </p></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">const</span> <span class="identifier">algebra_type</span> <span class="special">&</span> <a name="idp26451864-bb"></a><span class="identifier">algebra</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p>A const reference to the algebra which is held by this class. </p></td>
</tr></tbody>
</table></div>
</li>
</ol></div>
</div>
<div class="refsect2">
<a name="idp54329816"></a><h3>
<a name="idp26454872-bb"></a><code class="computeroutput">explicit_error_stepper_base</code> private member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem"><pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> System<span class="special">,</span> <span class="keyword">typename</span> StateInOut<span class="special">></span>
<span class="keyword">void</span> <a name="idp26455080-bb"></a><span class="identifier">do_step_v1</span><span class="special">(</span><span class="identifier">System</span> system<span class="special">,</span> <span class="identifier">StateInOut</span> <span class="special">&</span> x<span class="special">,</span> <span class="identifier">time_type</span> t<span class="special">,</span> <span class="identifier">time_type</span> dt<span class="special">)</span><span class="special">;</span></pre></li>
<li class="listitem"><pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> System<span class="special">,</span> <span class="keyword">typename</span> StateInOut<span class="special">,</span> <span class="keyword">typename</span> Err<span class="special">></span>
<span class="keyword">void</span> <a name="idp26457576-bb"></a><span class="identifier">do_step_v5</span><span class="special">(</span><span class="identifier">System</span> system<span class="special">,</span> <span class="identifier">StateInOut</span> <span class="special">&</span> x<span class="special">,</span> <span class="identifier">time_type</span> t<span class="special">,</span> <span class="identifier">time_type</span> dt<span class="special">,</span>
<span class="identifier">Err</span> <span class="special">&</span> xerr<span class="special">)</span><span class="special">;</span></pre></li>
<li class="listitem"><pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> StateIn<span class="special">></span> <span class="keyword">bool</span> <a name="idp26460680-bb"></a><span class="identifier">resize_impl</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">StateIn</span> <span class="special">&</span> x<span class="special">)</span><span class="special">;</span></pre></li>
<li class="listitem"><pre class="literallayout"><span class="identifier">stepper_type</span> <span class="special">&</span> <a name="idp26461896-bb"></a><span class="identifier">stepper</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span><span class="special">;</span></pre></li>
<li class="listitem"><pre class="literallayout"><span class="keyword">const</span> <span class="identifier">stepper_type</span> <span class="special">&</span> <a name="idp26462696-bb"></a><span class="identifier">stepper</span><span class="special">(</span><span class="keyword">void</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre></li>
</ol></div>
</div>
</div>
</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 © 2009-2012 Karsten
Ahnert and Mario Mulansky<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="../../../header/boost/numeric/odeint/stepper/base/explicit_error_stepper_base_hpp.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../header/boost/numeric/odeint/stepper/base/explicit_error_stepper_base_hpp.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="../../../header/boost/numeric/odeint/stepper/base/explicit_error_stepper_fsal_base_hpp.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
| laborautonomo/poedit | deps/boost/libs/numeric/odeint/doc/html/boost/numeric/odeint/explicit_error_idp26364872.html | HTML | mit | 75,492 | [
30522,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
18804,
30524,
2149,
1011,
2004,
6895,
2072,
1000,
1028,
1026,
2516,
1028,
2465,
23561,
13216,
1035,
7561,
1035,
29096,
2099,
1035,
2918,
1026,
1013,
2516,
1028,
1026,
4957,
2128,
2140,
1027,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
var http = require("http");
var server = http.createServer(function(request, response) {
response.writeHead(200, { "Grip-Hold": "response",
"Grip-Channel": "mychannel",
"Grip-Timeout": "60"});
response.write('<b>Hello {{name}}</b>!');
response.end();
});
server.listen(8080);
console.log("Server is listening");
| fruch/compose-pushpin | server.js | JavaScript | mit | 377 | [
30522,
13075,
8299,
1027,
5478,
1006,
1000,
8299,
1000,
1007,
1025,
13075,
8241,
1027,
8299,
1012,
9005,
2121,
6299,
1006,
3853,
1006,
5227,
1010,
3433,
1007,
1063,
3433,
1012,
4339,
4974,
1006,
3263,
1010,
1063,
1000,
6218,
1011,
2907,
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 2018 The Kubernetes 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.
*/
package get
import (
"strings"
"github.com/spf13/cobra"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/cli-runtime/pkg/printers"
"k8s.io/kubernetes/pkg/kubectl/cmd/util/openapi"
)
// PrintFlags composes common printer flag structs
// used in the Get command.
type PrintFlags struct {
JSONYamlPrintFlags *genericclioptions.JSONYamlPrintFlags
NamePrintFlags *genericclioptions.NamePrintFlags
CustomColumnsFlags *CustomColumnsPrintFlags
HumanReadableFlags *HumanPrintFlags
TemplateFlags *genericclioptions.KubeTemplatePrintFlags
NoHeaders *bool
OutputFormat *string
}
// SetKind sets the Kind option of humanreadable flags
func (f *PrintFlags) SetKind(kind schema.GroupKind) {
f.HumanReadableFlags.SetKind(kind)
}
// EnsureWithNamespace ensures that humanreadable flags return
// a printer capable of printing with a "namespace" column.
func (f *PrintFlags) EnsureWithNamespace() error {
return f.HumanReadableFlags.EnsureWithNamespace()
}
// EnsureWithKind ensures that humanreadable flags return
// a printer capable of including resource kinds.
func (f *PrintFlags) EnsureWithKind() error {
return f.HumanReadableFlags.EnsureWithKind()
}
// Copy returns a copy of PrintFlags for mutation
func (f *PrintFlags) Copy() PrintFlags {
printFlags := *f
return printFlags
}
// AllowedFormats is the list of formats in which data can be displayed
func (f *PrintFlags) AllowedFormats() []string {
formats := f.JSONYamlPrintFlags.AllowedFormats()
formats = append(formats, f.NamePrintFlags.AllowedFormats()...)
formats = append(formats, f.TemplateFlags.AllowedFormats()...)
formats = append(formats, f.CustomColumnsFlags.AllowedFormats()...)
formats = append(formats, f.HumanReadableFlags.AllowedFormats()...)
return formats
}
// UseOpenAPIColumns modifies the output format, as well as the
// "allowMissingKeys" option for template printers, to values
// defined in the OpenAPI schema of a resource.
func (f *PrintFlags) UseOpenAPIColumns(api openapi.Resources, mapping *meta.RESTMapping) error {
// Found openapi metadata for this resource
schema := api.LookupResource(mapping.GroupVersionKind)
if schema == nil {
// Schema not found, return empty columns
return nil
}
columns, found := openapi.GetPrintColumns(schema.GetExtensions())
if !found {
// Extension not found, return empty columns
return nil
}
parts := strings.SplitN(columns, "=", 2)
if len(parts) < 2 {
return nil
}
allowMissingKeys := true
f.OutputFormat = &parts[0]
f.TemplateFlags.TemplateArgument = &parts[1]
f.TemplateFlags.AllowMissingKeys = &allowMissingKeys
return nil
}
// ToPrinter attempts to find a composed set of PrintFlags suitable for
// returning a printer based on current flag values.
func (f *PrintFlags) ToPrinter() (printers.ResourcePrinter, error) {
outputFormat := ""
if f.OutputFormat != nil {
outputFormat = *f.OutputFormat
}
noHeaders := false
if f.NoHeaders != nil {
noHeaders = *f.NoHeaders
}
f.HumanReadableFlags.NoHeaders = noHeaders
f.CustomColumnsFlags.NoHeaders = noHeaders
// for "get.go" we want to support a --template argument given, even when no --output format is provided
if f.TemplateFlags.TemplateArgument != nil && len(*f.TemplateFlags.TemplateArgument) > 0 && len(outputFormat) == 0 {
outputFormat = "go-template"
}
if p, err := f.TemplateFlags.ToPrinter(outputFormat); !genericclioptions.IsNoCompatiblePrinterError(err) {
return p, err
}
if f.TemplateFlags.TemplateArgument != nil {
f.CustomColumnsFlags.TemplateArgument = *f.TemplateFlags.TemplateArgument
}
if p, err := f.JSONYamlPrintFlags.ToPrinter(outputFormat); !genericclioptions.IsNoCompatiblePrinterError(err) {
return p, err
}
if p, err := f.HumanReadableFlags.ToPrinter(outputFormat); !genericclioptions.IsNoCompatiblePrinterError(err) {
return p, err
}
if p, err := f.CustomColumnsFlags.ToPrinter(outputFormat); !genericclioptions.IsNoCompatiblePrinterError(err) {
return p, err
}
if p, err := f.NamePrintFlags.ToPrinter(outputFormat); !genericclioptions.IsNoCompatiblePrinterError(err) {
return p, err
}
return nil, genericclioptions.NoCompatiblePrinterError{OutputFormat: &outputFormat, AllowedFormats: f.AllowedFormats()}
}
// AddFlags receives a *cobra.Command reference and binds
// flags related to humanreadable and template printing.
func (f *PrintFlags) AddFlags(cmd *cobra.Command) {
f.JSONYamlPrintFlags.AddFlags(cmd)
f.NamePrintFlags.AddFlags(cmd)
f.TemplateFlags.AddFlags(cmd)
f.HumanReadableFlags.AddFlags(cmd)
f.CustomColumnsFlags.AddFlags(cmd)
if f.OutputFormat != nil {
cmd.Flags().StringVarP(f.OutputFormat, "output", "o", *f.OutputFormat, "Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath].")
}
if f.NoHeaders != nil {
cmd.Flags().BoolVar(f.NoHeaders, "no-headers", *f.NoHeaders, "When using the default or custom-column output format, don't print headers (default print headers).")
}
}
// NewGetPrintFlags returns flags associated with humanreadable,
// template, and "name" printing, with default values set.
func NewGetPrintFlags() *PrintFlags {
outputFormat := ""
noHeaders := false
return &PrintFlags{
OutputFormat: &outputFormat,
NoHeaders: &noHeaders,
JSONYamlPrintFlags: genericclioptions.NewJSONYamlPrintFlags(),
NamePrintFlags: genericclioptions.NewNamePrintFlags(""),
TemplateFlags: genericclioptions.NewKubeTemplatePrintFlags(),
HumanReadableFlags: NewHumanPrintFlags(),
CustomColumnsFlags: NewCustomColumnsPrintFlags(),
}
}
| Stackdriver/heapster | vendor/k8s.io/kubernetes/pkg/kubectl/cmd/get/get_flags.go | GO | apache-2.0 | 6,480 | [
30522,
1013,
1008,
9385,
2760,
1996,
13970,
5677,
7159,
2229,
6048,
1012,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
12646,
2007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
$(document).ready(function(){
///Declare variables
var unitSwap = true;
var latitude = $('#latitude');
var longitude = $('#longitude');
var location = $('#location');
var temperature = $('#temperature');
var weather = $('#weather');
var weatherIcon;
var clock = $('#clock');
var day = $('#day');
///Geolocation
//Find the geolocation
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
///Weather API
//Setup for weather app
var key = 'd160d975b9920be65fcf14313e95afb4';
var weatherNow = 'http://api.openweathermap.org/data/2.5/weather?lat=' + position.coords.latitude + '&lon=' + position.coords.longitude + '&APPID=' + key + '&units=metric';
//Get the weather
$.getJSON(weatherNow, function(data) {
location.html(data.name + ', ' + data.sys.country);
temperature.html(data.main.temp + '<sup>o</sup>C');
weather.html(data.weather[0].main);
//Weather icons https://openweathermap.org/weather-conditions
if(data.weather[0].icon === '01d') {
document.getElementById('weatherIcon').src = 'img/sun.png';
$('body').css("background-image", "url(img/02.jpeg)");
} else if (data.weather[0].icon === '01n') {
document.getElementById('weatherIcon').src = 'img/moon.png';
$('body').css("background-image", "url(img/04.jpeg)");
} else if(data.weather[0].icon === '02d') {
document.getElementById('weatherIcon').src = 'img/cloud.png';
$('body').css("background-image", "url(img/01.jpeg)");
} else if(data.weather[0].icon === '02n') {
document.getElementById('weatherIcon').src = 'img/night.png';
$('body').css("background-image", "url(img/05.jpeg)");
} else if(data.weather[0].icon === '03d' || data.weather[0].icon === '03n') {
document.getElementById('weatherIcon').src = 'img/cloud2.png';
$('body').css("background-image", "url(img/06.jpeg)");
} else if(data.weather[0].icon === '04d' || data.weather[0].icon === '04n') {
document.getElementById('weatherIcon').src = 'img/cloudy.png';
$('body').css("background-image", "url(img/07.jpeg)");
} else if(data.weather[0].icon === '09d' || data.weather[0].icon === '90n' || data.weather[0].icon === '10d' || data.weather[0].icon === '10n') {
document.getElementById('weatherIcon').src = 'img/rain.png';
$('body').css("background-image", "url(img/03.jpeg)");
} else if(data.weather[0].icon === '11d' || data.weather[0].icon === '11n') {
document.getElementById('weatherIcon').src = 'img/flash.png';
$('body').css("background-image", "url(img/08.jpeg)");
} else if(data.weather[0].icon === '13d' || data.weather[0].icon === '13n') {
document.getElementById('weatherIcon').src = 'img/snowflake.png';
$('body').css("background-image", "url(img/09.jpeg)");
} else if(data.weather[0].icon === '50d' || data.weather[0].icon === '50n') {
document.getElementById('weatherIcon').src = 'img/fog.png';
$('body').css("background-image", "url(img/10.jpeg)");
} else {
console.log('photo didn\'t load');
}
//button to change between fahrenheit and celcius
temperature.click(function() {
if (unitSwap === true) {
temperature.html(data.main.temp*9/5+32 + '<sup>o</sup>F');
unitSwap = false;
}else {
temperature.html(data.main.temp + '<sup>o</sup>C');
unitSwap = true;
}
});
});
//Get current time
function time() {
var currentTime = new Date ();
var currentHours = currentTime.getHours ( );
var currentMinutes = currentTime.getMinutes ( );
var weekday = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
//Formatting it to a nice string using ternary operators
currentMinutes = ( currentMinutes < 10 ? '0' : '' ) + currentMinutes;
//Formatting it to 12 hours and adding AM and PM
var timeOfDay = ( currentHours < 12 ) ? 'AM' : 'PM';
currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;
currentHours = ( currentHours === 0 ) ? 12 : currentHours;
//The last part to make the finished formatted string
var currentTimeString = currentHours + ':' + currentMinutes + ' ' + timeOfDay;
day.html(weekday[currentTime.getDay()]);
clock.html(currentTimeString);
}
time();
});
} else {
location.html('Geolocation is not supported by this browser');
}
});
| TheGameFreak720/Weather-App | js/app.js | JavaScript | mit | 5,395 | [
30522,
1002,
1006,
6254,
1007,
1012,
3201,
1006,
3853,
1006,
1007,
1063,
1013,
1013,
1013,
13520,
10857,
13075,
3197,
4213,
2361,
1027,
2995,
1025,
13075,
15250,
1027,
1002,
1006,
1005,
1001,
15250,
1005,
1007,
1025,
13075,
20413,
1027,
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... |
//>>built
define("dojox/form/nls/el/Uploader",{label:"\u0395\u03c0\u03b9\u03bb\u03bf\u03b3\u03ae \u03b1\u03c1\u03c7\u03b5\u03af\u03c9\u03bd..."}); | aconyteds/Esri-Ozone-Map-Widget | vendor/js/esri/arcgis_js_api/library/3.12/3.12compact/dojox/form/nls/el/Uploader.js | JavaScript | apache-2.0 | 146 | [
30522,
1013,
1013,
1028,
1028,
2328,
9375,
1006,
1000,
2079,
5558,
2595,
1013,
2433,
1013,
17953,
2015,
1013,
3449,
1013,
2039,
11066,
2121,
1000,
1010,
1063,
3830,
1024,
1000,
1032,
1057,
2692,
23499,
2629,
1032,
1057,
2692,
2509,
2278,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
class Electron < ActiveRecord::Base
belongs_to :molecule
validates_presence_of :name
end
| rumblefishinc/ruby-ibmdb | test/models/electron.rb | Ruby | mit | 94 | [
30522,
2465,
10496,
1026,
3161,
2890,
27108,
2094,
1024,
1024,
2918,
7460,
1035,
2000,
1024,
13922,
9398,
8520,
1035,
3739,
1035,
1997,
1024,
2171,
2203,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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... |
# Podozamites notabilis SPECIES
#### Status
ACCEPTED
#### According to
Interim Register of Marine and Nonmarine Genera
#### Published in
null
#### Original name
null
### Remarks
null | mdoering/backbone | life/Plantae/Podozamites/Podozamites notabilis/README.md | Markdown | apache-2.0 | 187 | [
30522,
1001,
17491,
25036,
23419,
2015,
2025,
28518,
6856,
2427,
1001,
1001,
1001,
1001,
3570,
3970,
30524,
1001,
1001,
1001,
1001,
2434,
2171,
19701,
1001,
1001,
1001,
12629,
19701,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 {NgbCalendarIslamicCivil} from './ngb-calendar-islamic-civil';
import {NgbDate} from '../ngb-date';
import {Injectable} from '@angular/core';
/**
* Umalqura calendar is one type of Hijri calendars used in islamic countries.
* This Calendar is used by Saudi Arabia for administrative purpose.
* Unlike tabular calendars, the algorithm involves astronomical calculation, but it's still deterministic.
* http://cldr.unicode.org/development/development-process/design-proposals/islamic-calendar-types
*/
const GREGORIAN_FIRST_DATE = new Date(1882, 10, 12);
const GREGORIAN_LAST_DATE = new Date(2174, 10, 25);
const HIJRI_BEGIN = 1300;
const HIJRI_END = 1600;
const ONE_DAY = 1000 * 60 * 60 * 24;
const MONTH_LENGTH = [
// 1300-1304
'101010101010', '110101010100', '111011001001', '011011010100', '011011101010',
// 1305-1309
'001101101100', '101010101101', '010101010101', '011010101001', '011110010010',
// 1310-1314
'101110101001', '010111010100', '101011011010', '010101011100', '110100101101',
// 1315-1319
'011010010101', '011101001010', '101101010100', '101101101010', '010110101101',
// 1320-1324
'010010101110', '101001001111', '010100010111', '011010001011', '011010100101',
// 1325-1329
'101011010101', '001011010110', '100101011011', '010010011101', '101001001101',
// 1330-1334
'110100100110', '110110010101', '010110101100', '100110110110', '001010111010',
// 1335-1339
'101001011011', '010100101011', '101010010101', '011011001010', '101011101001',
// 1340-1344
'001011110100', '100101110110', '001010110110', '100101010110', '101011001010',
// 1345-1349
'101110100100', '101111010010', '010111011001', '001011011100', '100101101101',
// 1350-1354
'010101001101', '101010100101', '101101010010', '101110100101', '010110110100',
// 1355-1359
'100110110110', '010101010111', '001010010111', '010101001011', '011010100011',
// 1360-1364
'011101010010', '101101100101', '010101101010', '101010101011', '010100101011',
// 1365-1369
'110010010101', '110101001010', '110110100101', '010111001010', '101011010110',
// 1370-1374
'100101010111', '010010101011', '100101001011', '101010100101', '101101010010',
// 1375-1379
'101101101010', '010101110101', '001001110110', '100010110111', '010001011011',
// 1380-1384
'010101010101', '010110101001', '010110110100', '100111011010', '010011011101',
// 1385-1389
'001001101110', '100100110110', '101010101010', '110101010100', '110110110010',
// 1390-1394
'010111010101', '001011011010', '100101011011', '010010101011', '101001010101',
// 1395-1399
'101101001001', '101101100100', '101101110001', '010110110100', '101010110101',
// 1400-1404
'101001010101', '110100100101', '111010010010', '111011001001', '011011010100',
// 1405-1409
'101011101001', '100101101011', '010010101011', '101010010011', '110101001001',
// 1410-1414
'110110100100', '110110110010', '101010111001', '010010111010', '101001011011',
// 1415-1419
'010100101011', '101010010101', '101100101010', '101101010101', '010101011100',
// 1420-1424
'010010111101', '001000111101', '100100011101', '101010010101', '101101001010',
// 1425-1429
'101101011010', '010101101101', '001010110110', '100100111011', '010010011011',
// 1430-1434
'011001010101', '011010101001', '011101010100', '101101101010', '010101101100',
// 1435-1439
'101010101101', '010101010101', '101100101001', '101110010010', '101110101001',
// 1440-1444
'010111010100', '101011011010', '010101011010', '101010101011', '010110010101',
// 1445-1449
'011101001001', '011101100100', '101110101010', '010110110101', '001010110110',
// 1450-1454
'101001010110', '111001001101', '101100100101', '101101010010', '101101101010',
// 1455-1459
'010110101101', '001010101110', '100100101111', '010010010111', '011001001011',
// 1460-1464
'011010100101', '011010101100', '101011010110', '010101011101', '010010011101',
// 1465-1469
'101001001101', '110100010110', '110110010101', '010110101010', '010110110101',
// 1470-1474
'001011011010', '100101011011', '010010101101', '010110010101', '011011001010',
// 1475-1479
'011011100100', '101011101010', '010011110101', '001010110110', '100101010110',
// 1480-1484
'101010101010', '101101010100', '101111010010', '010111011001', '001011101010',
// 1485-1489
'100101101101', '010010101101', '101010010101', '101101001010', '101110100101',
// 1490-1494
'010110110010', '100110110101', '010011010110', '101010010111', '010101000111',
// 1495-1499
'011010010011', '011101001001', '101101010101', '010101101010', '101001101011',
// 1500-1504
'010100101011', '101010001011', '110101000110', '110110100011', '010111001010',
// 1505-1509
'101011010110', '010011011011', '001001101011', '100101001011', '101010100101',
// 1510-1514
'101101010010', '101101101001', '010101110101', '000101110110', '100010110111',
// 1515-1519
'001001011011', '010100101011', '010101100101', '010110110100', '100111011010',
// 1520-1524
'010011101101', '000101101101', '100010110110', '101010100110', '110101010010',
// 1525-1529
'110110101001', '010111010100', '101011011010', '100101011011', '010010101011',
// 1530-1534
'011001010011', '011100101001', '011101100010', '101110101001', '010110110010',
// 1535-1539
'101010110101', '010101010101', '101100100101', '110110010010', '111011001001',
// 1540-1544
'011011010010', '101011101001', '010101101011', '010010101011', '101001010101',
// 1545-1549
'110100101001', '110101010100', '110110101010', '100110110101', '010010111010',
// 1550-1554
'101000111011', '010010011011', '101001001101', '101010101010', '101011010101',
// 1555-1559
'001011011010', '100101011101', '010001011110', '101000101110', '110010011010',
// 1560-1564
'110101010101', '011010110010', '011010111001', '010010111010', '101001011101',
// 1565-1569
'010100101101', '101010010101', '101101010010', '101110101000', '101110110100',
// 1570-1574
'010110111001', '001011011010', '100101011010', '101101001010', '110110100100',
// 1575-1579
'111011010001', '011011101000', '101101101010', '010101101101', '010100110101',
// 1580-1584
'011010010101', '110101001010', '110110101000', '110111010100', '011011011010',
// 1585-1589
'010101011011', '001010011101', '011000101011', '101100010101', '101101001010',
// 1590-1594
'101110010101', '010110101010', '101010101110', '100100101110', '110010001111',
// 1595-1599
'010100100111', '011010010101', '011010101010', '101011010110', '010101011101',
// 1600
'001010011101'
];
function getDaysDiff(date1: Date, date2: Date): number {
const diff = Math.abs(date1.getTime() - date2.getTime());
return Math.round(diff / ONE_DAY);
}
@Injectable()
export class NgbCalendarIslamicUmalqura extends NgbCalendarIslamicCivil {
/**
* Returns the equivalent islamic(Umalqura) date value for a give input Gregorian date.
* `gdate` is s JS Date to be converted to Hijri.
*/
fromGregorian(gDate: Date): NgbDate {
let hDay = 1, hMonth = 0, hYear = 1300;
let daysDiff = getDaysDiff(gDate, GREGORIAN_FIRST_DATE);
if (gDate.getTime() - GREGORIAN_FIRST_DATE.getTime() >= 0 && gDate.getTime() - GREGORIAN_LAST_DATE.getTime() <= 0) {
let year = 1300;
for (let i = 0; i < MONTH_LENGTH.length; i++, year++) {
for (let j = 0; j < 12; j++) {
let numOfDays = +MONTH_LENGTH[i][j] + 29;
if (daysDiff <= numOfDays) {
hDay = daysDiff + 1;
if (hDay > numOfDays) {
hDay = 1;
j++;
}
if (j > 11) {
j = 0;
year++;
}
hMonth = j;
hYear = year;
return new NgbDate(hYear, hMonth + 1, hDay);
}
daysDiff = daysDiff - numOfDays;
}
}
} else {
return super.fromGregorian(gDate);
}
}
/**
* Converts the current Hijri date to Gregorian.
*/
toGregorian(hDate: NgbDate): Date {
const hYear = hDate.year;
const hMonth = hDate.month - 1;
const hDay = hDate.day;
let gDate = new Date(GREGORIAN_FIRST_DATE);
let dayDiff = hDay - 1;
if (hYear >= HIJRI_BEGIN && hYear <= HIJRI_END) {
for (let y = 0; y < hYear - HIJRI_BEGIN; y++) {
for (let m = 0; m < 12; m++) {
dayDiff += +MONTH_LENGTH[y][m] + 29;
}
}
for (let m = 0; m < hMonth; m++) {
dayDiff += +MONTH_LENGTH[hYear - HIJRI_BEGIN][m] + 29;
}
gDate.setDate(GREGORIAN_FIRST_DATE.getDate() + dayDiff);
} else {
gDate = super.toGregorian(hDate);
}
return gDate;
}
/**
* Returns the number of days in a specific Hijri hMonth.
* `hMonth` is 1 for Muharram, 2 for Safar, etc.
* `hYear` is any Hijri hYear.
*/
getDaysPerMonth(hMonth: number, hYear: number): number {
if (hYear >= HIJRI_BEGIN && hYear <= HIJRI_END) {
const pos = hYear - HIJRI_BEGIN;
return +MONTH_LENGTH[pos][hMonth - 1] + 29;
}
return super.getDaysPerMonth(hMonth, hYear);
}
}
| ktriek/ng-bootstrap | src/datepicker/hijri/ngb-calendar-islamic-umalqura.ts | TypeScript | mit | 9,063 | [
30522,
12324,
1063,
12835,
9818,
9453,
8943,
6935,
10278,
2594,
6895,
14762,
1065,
2013,
1005,
1012,
1013,
12835,
2497,
1011,
8094,
1011,
5499,
1011,
2942,
1005,
1025,
12324,
1063,
12835,
2497,
13701,
1065,
2013,
1005,
1012,
1012,
1013,
128... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
/*
* GPL HEADER START
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 only,
* 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 version 2 for more details (a copy is included
* in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU General Public License
* version 2 along with this program; If not, see
* http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
* GPL HEADER END
*/
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
* Copyright (c) 2012, 2015, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
* Lustre is a trademark of Sun Microsystems, Inc.
*
* lustre/obdclass/llog_cat.c
*
* OST<->MDS recovery logging infrastructure.
*
* Invariants in implementation:
* - we do not share logs among different OST<->MDS connections, so that
* if an OST or MDS fails it need only look at log(s) relevant to itself
*
* Author: Andreas Dilger <adilger@clusterfs.com>
* Author: Alexey Zhuravlev <alexey.zhuravlev@intel.com>
* Author: Mikhail Pershin <mike.pershin@intel.com>
*/
#define DEBUG_SUBSYSTEM S_LOG
#include "../include/obd_class.h"
#include "llog_internal.h"
/* Open an existent log handle and add it to the open list.
* This log handle will be closed when all of the records in it are removed.
*
* Assumes caller has already pushed us into the kernel context and is locking.
* We return a lock on the handle to ensure nobody yanks it from us.
*
* This takes extra reference on llog_handle via llog_handle_get() and require
* this reference to be put by caller using llog_handle_put()
*/
static int llog_cat_id2handle(const struct lu_env *env,
struct llog_handle *cathandle,
struct llog_handle **res,
struct llog_logid *logid)
{
struct llog_handle *loghandle;
int rc = 0;
if (!cathandle)
return -EBADF;
down_write(&cathandle->lgh_lock);
list_for_each_entry(loghandle, &cathandle->u.chd.chd_head,
u.phd.phd_entry) {
struct llog_logid *cgl = &loghandle->lgh_id;
if (ostid_id(&cgl->lgl_oi) == ostid_id(&logid->lgl_oi) &&
ostid_seq(&cgl->lgl_oi) == ostid_seq(&logid->lgl_oi)) {
if (cgl->lgl_ogen != logid->lgl_ogen) {
CERROR("%s: log "DOSTID" generation %x != %x\n",
loghandle->lgh_ctxt->loc_obd->obd_name,
POSTID(&logid->lgl_oi), cgl->lgl_ogen,
logid->lgl_ogen);
continue;
}
loghandle->u.phd.phd_cat_handle = cathandle;
up_write(&cathandle->lgh_lock);
rc = 0;
goto out;
}
}
up_write(&cathandle->lgh_lock);
rc = llog_open(env, cathandle->lgh_ctxt, &loghandle, logid, NULL,
LLOG_OPEN_EXISTS);
if (rc < 0) {
CERROR("%s: error opening log id "DOSTID":%x: rc = %d\n",
cathandle->lgh_ctxt->loc_obd->obd_name,
POSTID(&logid->lgl_oi), logid->lgl_ogen, rc);
return rc;
}
rc = llog_init_handle(env, loghandle, LLOG_F_IS_PLAIN, NULL);
if (rc < 0) {
llog_close(env, loghandle);
loghandle = NULL;
return rc;
}
down_write(&cathandle->lgh_lock);
list_add(&loghandle->u.phd.phd_entry, &cathandle->u.chd.chd_head);
up_write(&cathandle->lgh_lock);
loghandle->u.phd.phd_cat_handle = cathandle;
loghandle->u.phd.phd_cookie.lgc_lgl = cathandle->lgh_id;
loghandle->u.phd.phd_cookie.lgc_index =
loghandle->lgh_hdr->llh_cat_idx;
out:
llog_handle_get(loghandle);
*res = loghandle;
return 0;
}
int llog_cat_close(const struct lu_env *env, struct llog_handle *cathandle)
{
struct llog_handle *loghandle, *n;
int rc;
list_for_each_entry_safe(loghandle, n, &cathandle->u.chd.chd_head,
u.phd.phd_entry) {
/* unlink open-not-created llogs */
list_del_init(&loghandle->u.phd.phd_entry);
llog_close(env, loghandle);
}
/* if handle was stored in ctxt, remove it too */
if (cathandle->lgh_ctxt->loc_handle == cathandle)
cathandle->lgh_ctxt->loc_handle = NULL;
rc = llog_close(env, cathandle);
return rc;
}
EXPORT_SYMBOL(llog_cat_close);
static int llog_cat_process_cb(const struct lu_env *env,
struct llog_handle *cat_llh,
struct llog_rec_hdr *rec, void *data)
{
struct llog_process_data *d = data;
struct llog_logid_rec *lir = (struct llog_logid_rec *)rec;
struct llog_handle *llh;
int rc;
if (rec->lrh_type != LLOG_LOGID_MAGIC) {
CERROR("invalid record in catalog\n");
return -EINVAL;
}
CDEBUG(D_HA, "processing log "DOSTID":%x at index %u of catalog "
DOSTID"\n", POSTID(&lir->lid_id.lgl_oi), lir->lid_id.lgl_ogen,
rec->lrh_index, POSTID(&cat_llh->lgh_id.lgl_oi));
rc = llog_cat_id2handle(env, cat_llh, &llh, &lir->lid_id);
if (rc) {
CERROR("%s: cannot find handle for llog "DOSTID": %d\n",
cat_llh->lgh_ctxt->loc_obd->obd_name,
POSTID(&lir->lid_id.lgl_oi), rc);
return rc;
}
if (rec->lrh_index < d->lpd_startcat)
/* Skip processing of the logs until startcat */
rc = 0;
else if (d->lpd_startidx > 0) {
struct llog_process_cat_data cd;
cd.lpcd_first_idx = d->lpd_startidx;
cd.lpcd_last_idx = 0;
rc = llog_process_or_fork(env, llh, d->lpd_cb, d->lpd_data,
&cd, false);
/* Continue processing the next log from idx 0 */
d->lpd_startidx = 0;
} else {
rc = llog_process_or_fork(env, llh, d->lpd_cb, d->lpd_data,
NULL, false);
}
llog_handle_put(llh);
return rc;
}
static int llog_cat_process_or_fork(const struct lu_env *env,
struct llog_handle *cat_llh,
llog_cb_t cb, void *data, int startcat,
int startidx, bool fork)
{
struct llog_process_data d;
struct llog_log_hdr *llh = cat_llh->lgh_hdr;
int rc;
LASSERT(llh->llh_flags & LLOG_F_IS_CAT);
d.lpd_data = data;
d.lpd_cb = cb;
d.lpd_startcat = startcat;
d.lpd_startidx = startidx;
if (llh->llh_cat_idx > cat_llh->lgh_last_idx) {
struct llog_process_cat_data cd;
CWARN("catlog "DOSTID" crosses index zero\n",
POSTID(&cat_llh->lgh_id.lgl_oi));
cd.lpcd_first_idx = llh->llh_cat_idx;
cd.lpcd_last_idx = 0;
rc = llog_process_or_fork(env, cat_llh, llog_cat_process_cb,
&d, &cd, fork);
if (rc != 0)
return rc;
cd.lpcd_first_idx = 0;
cd.lpcd_last_idx = cat_llh->lgh_last_idx;
rc = llog_process_or_fork(env, cat_llh, llog_cat_process_cb,
&d, &cd, fork);
} else {
rc = llog_process_or_fork(env, cat_llh, llog_cat_process_cb,
&d, NULL, fork);
}
return rc;
}
int llog_cat_process(const struct lu_env *env, struct llog_handle *cat_llh,
llog_cb_t cb, void *data, int startcat, int startidx)
{
return llog_cat_process_or_fork(env, cat_llh, cb, data, startcat,
startidx, false);
}
EXPORT_SYMBOL(llog_cat_process);
| geminy/aidear | oss/linux/linux-4.7/drivers/staging/lustre/lustre/obdclass/llog_cat.c | C | gpl-3.0 | 7,203 | [
30522,
1013,
1008,
1008,
14246,
2140,
20346,
2707,
1008,
1008,
2079,
2025,
11477,
2030,
6366,
9385,
14444,
2030,
2023,
5371,
20346,
1012,
1008,
1008,
2023,
2565,
2003,
2489,
4007,
1025,
2017,
2064,
2417,
2923,
3089,
30524,
5500,
1999,
1996,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import json
from app import models
from django.test import Client, TestCase
from django.contrib.auth.hashers import make_password
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
# Create your tests here.
class TestLecturerWeb(TestCase):
def _init_test_lecturer(self):
if hasattr(self, '_lecturer'):
return
self.lecturer = "lecturer_oUP1zwTO9"
self.lecturer_pswd = "123"
user_data = {
'password': make_password(self.lecturer_pswd),
'is_staff': False,
'is_superuser': False,
}
user, _ = User.objects.get_or_create(username=self.lecturer,
defaults=user_data)
_lecturer, _ = models.Lecturer.objects.get_or_create(
user=user,
defaults={
"subject": models.Subject.get_english(),
"name": "kaoru"
})
self._lecturer = _lecturer
def setUp(self):
self.client = Client()
self._init_test_lecturer()
self.client.login(username=self.lecturer, password=self.lecturer_pswd)
def tearDown(self):
pass
def test_home(self):
response = self.client.get(reverse('lecturer:home'))
self.assertEqual(302, response.status_code)
def test_index(self):
response = self.client.get(reverse('lecturer:index'))
self.assertEqual(200, response.status_code)
def test_login(self):
client = Client()
response = client.get(reverse('lecturer:login'))
self.assertEqual(200, response.status_code)
def test_login_auth(self):
client = Client()
data = {'username': self.lecturer, 'password': self.lecturer_pswd}
response = client.post(reverse('lecturer:login'), data=data)
self.assertEqual(302, response.status_code)
def test_logout(self):
client = Client()
client.login(username=self.lecturer, password=self.lecturer_pswd)
response = client.get(reverse('lecturer:logout'))
self.assertEqual(302, response.status_code)
def test_timeslots(self):
response = self.client.get(reverse('lecturer:timeslots'))
self.assertEqual(200, response.status_code)
def test_living(self):
response = self.client.get(reverse('lecturer:living'))
self.assertEqual(200, response.status_code)
def test_timeslot_questions(self):
response = self.client.get(
reverse('lecturer:timeslot-questions', kwargs={'tsid': 1}))
self.assertEqual(200, response.status_code)
# update test
response = self.client.post(
reverse('lecturer:timeslot-questions', kwargs={'tsid': 0}),
data={'gids': ''}
)
self.assertEqual(404, response.status_code)
# TODO: create test LiveCourse
def test_exercise_store(self):
response = self.client.get(reverse('lecturer:exercise-store'))
self.assertEqual(200, response.status_code)
data = {
"group": '{"exercises":[{"analyse":"题目解析","solution":"选项1","id":"","title":"题目","options":[{"text":"选项1","id":""},{"text":"选项2","id":""},{"text":"选项3","id":""},{"text":"选项4","id":""}]}],"desc":"题组描述","id":"","title":"题组名称"}'}
response = self.client.post(reverse('lecturer:exercise-store'), data)
self.assertEqual(200, response.status_code)
def test_api_exercise_store(self):
url = reverse('lecturer:api-exercise-store')
response = self.client.get(url)
self.assertEqual(200, response.status_code)
url = reverse('lecturer:api-exercise-store') + '?action=group_list'
response = self.client.get(url)
self.assertEqual(200, response.status_code)
url = reverse('lecturer:api-exercise-store') + '?action=group&gid=1'
response = self.client.get(url)
self.assertEqual(200, response.status_code)
| malaonline/Server | server/lecturer/tests.py | Python | mit | 4,001 | [
30522,
12324,
1046,
3385,
2013,
10439,
12324,
4275,
2013,
6520,
23422,
1012,
3231,
12324,
7396,
1010,
3231,
18382,
2013,
6520,
23422,
1012,
9530,
18886,
2497,
1012,
8740,
2705,
1012,
23325,
2545,
12324,
2191,
1035,
20786,
2013,
6520,
23422,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/health.css" rel="stylesheet">
<script src="js/jquery-3.2.1.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/script.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Bowlby+One|Mogra|Spectral" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<title>PawFect-PawCare</title>
</head>
<body>
<nav class="navbar navbar-default navbar-custom navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="index.html"><i class="fa fa-paw" aria-hidden="true"></i> PawFect</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="about.html">About</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="adopt.html">Adopt</a></li>
<li><a href="health.html">Health</a></li>
<button type="button" class="btn btn-success animated infinite tada" data-toggle="modal" data-target="#myModal">Donate</button>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-->
</nav>
<!-- container for making whole body responsive -->
<div class="container">
<!-- code for main header -->
<div class="row" id="mainhead">
<div class="col-md-6">
<!-- class animate to animate pawcare text -->
<h1 id="healthheader" class="animated bounce">PAWCARE<h1>
</div>
<div class="col-md-6">
<h2 class="bodyfont">Happy dog</h2>
<h2 class="bodyfont">Happy life</h2>
</div>
</div>
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img src="https://wallpaperscraft.com/image/dog_road_friend_73169_1920x1080.jpg" alt="dog" style="height:500px;">
<div class="carousel-caption">
<h3 class="slidertext" class="bodyfont carousel">PET HEALTH</h3>
<p class="slidertext" class="bodyfont carousel">MAKE SURE YOUR DOG IS ALWAYS HEALTHY</p>
<!--button to make health section appear -->
<button id="healthbutton" class="bodyfont animated infinite pulse">GET MORE INFORMATION</button>
</div>
</div>
<div class="item">
<img src="http://media.cleveland.com/business_impact/photo/portfolio-image-9w-at-300-jpg-1ed6502507f441b5.jpg" alt="DOG" style="height:500px;">
<div class="carousel-caption">
<h3 class="slidertext" class="bodyfont carousel">PET FOOD</h3>
<p class="slidertext" class="bodyfont carousel">ENSURE YOUR DOG IS EATING WELL</p>
<!-- button to make food section appear -->
<button class="bodyfont animated infinite pulse" id="foodbutton">GET MORE INFORMATION</button>
</div>
</div>
</div>
<!-- Left and right controls -->
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
<span class="sr-only">Next</span>
</a>
</div>
<!-- row with health submit form header-->
<div class="row" id="rowhealth">
<div class="row" id="healthrow">
<h1 class="pawvet" class="bodyfont">PAWVET</h1>
<p class="pawvet" class="bodyfont">Give your pet the best<br>
medical attention at the best
price</p>
</div>
<!-- row with main content on health for the dog it is hidden-->
<div class="row">
<div class="col-md-4" id="eligibility">
<h1 class="pawvet" class="bodyfont">CHECK ELIGIBILITY</h1>
<p class="bodyfont">Find out if your <br>
dog meets the minimum requirements to<br>
get treated<p>
<ol>
<!-- plan requirements -->
<li class="bodyfont">The animal must have been<br>rescued within the last<br>year</li>
<li class="bodyfont">The dog must be a pure breed</li>
<li class="bodyfont">The dog owner must be a member of<br>pawfectmatch<li>
<li class="bodyfont">The dog must have been registered by pawfectmatch</li>
</ol>
</div>
<div class="col-md-4" id="plans">
<h1 class="pawvet" class="bodyfont">VIEW HEALTH PLANS</h1>
<p class="bodyfont">Pawfectmatch offers a wide variety of<br>
health plans to suit your needs</p>
<ol>
<!-- medical plans amount -->
<li class="bodyfont">Basic plan--ksh1000 per year.--This plan<br>offers basic treatments<br>for
your pet</li>
<li class="bodyfont">Premium plan--ksh2500 per year.--This plan allows the user to get access<br>
to ambulance services and<br> immunisation services plus basic<br> medical care.</li>
<li class="bodyfont">Gold plan--KSH5000 per year-- This plan allows the pet owner to have<br>unlimited access to
pet therapy when the dog is injured and also<br>ALL funeral expenses will be met <br>
in time of death.The owner also gets to get a new companion<br>incase of death</li>
</ol>
</div>
<div class="col-md-4" id="register">
<h1 class="pawvet" class="bodyfont">REGISTER</h1>
<form id="registration">
<!-- registration form for the plan -->
<div class="form-group">
<label for="name" class="bodyfont">ENTER NAME</label>
<input type="text" class="form-control" id="name"/>
</div>
<div class="form-group">
<label for="email-address" class="bodyfont">ENTER EMAIL ADDRESS</label>
<input type="email" class="form-control" id="email"/>
</div>
<div class="form-group">
<label for="name of plan" class="bodyfont">ENTER NAME OF PLAN </label>
<input type="text" class="form-control" id="plan"/>
</div>
<button class="btn" type="submit" class="bodyfont">SUBMIT FORM</button>
</form>
<p class="bodyfont">Make sure to fill the form to ensure you get<br>
access to the best dog healthcare<br>
at the best price.</p>
</div>
</div>
</div>
<div class="row" id="stories">
<!-- success stories for dogs using our products -->
<div class="row">
<div class="col-md-6">
<p class="bodyfont" id="firststory">
<!-- story of healthy dog -->
He was brought to us with a badly injured leg.<br>But due to
our well qualified staff and proper <br>
healthcare, he was able to walk again.Right now<br>
he can be found running through<br>
the country side chasing frogs and snakes.
</p>
</div>
<div class="col-md-6 containers">
<!-- photo of healthy dog -->
<img src="http://www.dogbreedslist.info/uploads/allimg/dog-pictures/Border-Collie-2.jpg" class="img-responsive img-rounded image"/>
<div class="overlay">
<div class="text">
<p class="overlaytext">HE IS A HAPPY DOG BECAUSE OF PAWVET</p>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6 containers2">
<img src="http://www.laraffinerie.ca/wp-content/uploads/2014/09/Dog-Food.jpg" class="img-responsive img-rounded image"/>
<div class="overlay">
<div class="text">
<!--healthy dog-->
<p class="overlaytext">HE IS A HEALTHY DOG BECAUSE OF PAWFEEDS</p>
</div>
</div>
</div>
<div class="col-md-6">
<p class="bodyfont" id="firststory">
Fido was brought to us<br>
very malnutritioned.He was not<br>
able to even walk let alone<br>
play with his owner.After<br>
one month of being under our<br>
diet, Fido was able to regain his<br>
strength.Now he happily plays<br>
with his owner and lives a good life.
</p>
</div>
</div>
</div>
<div class="row" id="feedrow">
<!-- row for dog food.It is hidden -->
<div class="row" id="pawfeed">
<h1 class="feedtext animated swing">PAWFEED</h3>
<h2 class="feedtext animated swing">MAN'S BEST FRIEND DESERVES A TREAT</h2>
<h2 class="feedtext animated swing">TOP RATED BRANDS!!</h2>
</div>
<div class="row" id="topbrand">
<div class="col-md-4">
<img src="http://stories.barkpost.com/wp-content/uploads/2014/05/Wellness-Core-Canine-Original-Formula-Dry-Dog-Food-076344884088.jpg" class="brand1 well well lg img-responsive"/>
</div>
<div class="col-md-8" id="brand1info">
<h3 class="core">WELLNESS CORE</h3>
<P class="core">The Wellness Core product line includes seven dry dog foods six which claim to meet AAFCO nutrient profiles for adult.What does this mean? The brand is way above-average with protein and near-average with fat</P>
<p class="core">Best shopping bet: Amazon.com.<br>
<strong>PRICE:$53.95 for a 26 lb bag</strong></p>
<button class="btn btn-info btn-lg" data-toggle="modal" data-target="#firstmodal" type="button">PURCHASE</button>
</div>
</div>
<div class="row" id="mostbought">
<div class="col-md-8" id="brand2info">
<h3 class="core">TASTE OF THE WORLD</h3>
<P class="core">The Taste of the Wild product line includes seven dry dog foods, and they’re all pretty great. Our top pick is Taste of the Wild High Prairie Formula, which reached it’s five star rating on DogFoodAdvisor (note: not all of their products did, though none were less than 3.5).</P>
<p class="core">Best shopping bet: Amazon.com.<br>
<strong>PRICE:$60.95 for a 26 lb bag</strong></p>
<button class="btn btn-info btn-lg" data-toggle="modal" data-target="#firstmodal" type="button">PURCHASE</button>
</div>
<div class="col-md-4">
<img src="http://stories.barkpost.com/wp-content/uploads/2014/05/dim-011_1z-600x943.jpg" class="brand2 well well lg img-responsive"/>
</div>
</div>
<div class="row" id="limitededition">
<div class="col-md-4">
<img src="http://stories.barkpost.com/wp-content/uploads/2014/05/mpc-194_1z-600x1004.jpg" class="brand2 well well lg img-responsive"/>
</div>
<div class="col-md-8">
<h3 class="core4">THE MERRICK CLASSIC</h3>
<P class="core4">The merric classic product line includes five dry dog foods, and they’re all pretty great. Our top pick is merrico introvio Formula, which reached it’s five star rating on DogFoodAdvisor.</P>
<p class="core4">Best shopping bet: Amazon.com.<br>
<strong>PRICE:$90.95 for a 26 lb bag</strong></p>
<button class="btn btn-info btn-lg" data-toggle="modal" data-target="#firstmodal" type="button">PURCHASE</button>
</div>
</div>
<div class="row" id ="dailydeals">
<div class="col-md-8">
<h3 class="core3">EVO DOG FOOD</h3>
<P class="core3">EVO Dog Food is grain-free and hits the spot with the three major areas of importance. It’s fortified with minerals, easily digestible and high in protein content. It’s also low in carbohydrates, with a mix of ingredients that promote healthy skin and coats.</P>
<p class="core3">Best shopping bet: Amazon.com.<br>
<strong>PRICE:$100.95 for a 26 lb bag</strong></p>
<button class="btn btn-info btn-lg" data-toggle="modal" data-target="#firstmodal" type="button">PURCHASE</button>
</div>
<div class="col-md-4">
<img src="http://stories.barkpost.com/wp-content/uploads/2014/05/nta-132_1z-600x824.jpg" class="brand2 well well lg img-responsive"/>
</div>
</div>
</div>
<div id="firstmodal" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"></button>
<h4 class="modal-title">PURCHASE FORM</h4>
</div>
<div class="modal-body">
<h2>FILL TO BOOK SHIPPING</h2>
<form id="purchase">
<!-- registration form for purchase -->
<div class="form-group">
<label for="name" class="bodyfont">ENTER EMAIL</label>
<input type="email" class="form-control" id="name"/>
</div>
<div class="form-group">
<label for="email-address" class="bodyfont">ENTER LOCATION FOR SHIPPING</label>
<input type="text" class="form-control" id="email"/>
</div>
<div class="form-group">
<label for="name of plan" class="bodyfont">ENTER PAYMENT METHOD</label>
<input type="text" class="form-control" id="plan"/>
</div>
<button class="btn btn-info btn-lg" data-toggle="modal" data-target="#secondmodal" type="button" data-dismiss="modal">PURCHASE</button>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div id="secondmodal" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"></button>
<h4 class="modal-title">PURCHASE CONFIRMATION</h4>
</div>
<div class="modal-body">
<h3 class="modal2">YOUR PURCHASE ORDER WAS SUCCESSFUL</h3>
<h3 class="modal2">DELIVERY WITHIN A WEEK</h3>
<h3 class="modal2">NO SHIPPING FEES</h3>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
| NjeriNjoroge/PawFect | health.html | HTML | mit | 14,331 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
18804,
2171,
1027,
1000,
3193,
6442,
1000,
4180,
1027,
1000,
9381,
1027,
5080... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace Bot.Builder.ChannelConnector.Facebook
{
// response from Facebook upon successfull submit of a message
public class FacebookResponse
{
[JsonProperty("recipient_id")]
public string RecipientId { get; set; }
[JsonProperty("message_id")]
public string MessageId { get; set; }
}
}
| vossccp/BotBuilderChannelConnector | BotBuilderChannelConnector/Facebook/FacebookResponse.cs | C# | mit | 478 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
2291,
1012,
11409,
4160,
1025,
2478,
2291,
1012,
3793,
1025,
2478,
2291,
1012,
11689,
2075,
1012,
8518,
1025,
2478,
8446,
6499,
6199,
1012,
1046,
3385,
1025,
3415,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
2011,2012,2013 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
ChibiOS/RT 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.
ChibiOS/RT 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/>.
*/
/**
* @file GCC/ARMCMx/STM32L1xx/vectors.c
* @brief Interrupt vectors for the STM32 family.
*
* @defgroup ARMCMx_STM32L1xx_VECTORS STM32L1xx Interrupt Vectors
* @ingroup ARMCMx_SPECIFIC
* @details Interrupt vectors for the STM32L1xx family.
* @{
*/
#include "ch.h"
/**
* @brief Type of an IRQ vector.
*/
typedef void (*irq_vector_t)(void);
/**
* @brief Type of a structure representing the whole vectors table.
*/
typedef struct {
uint32_t *init_stack;
irq_vector_t reset_vector;
irq_vector_t nmi_vector;
irq_vector_t hardfault_vector;
irq_vector_t memmanage_vector;
irq_vector_t busfault_vector;
irq_vector_t usagefault_vector;
irq_vector_t vector1c;
irq_vector_t vector20;
irq_vector_t vector24;
irq_vector_t vector28;
irq_vector_t svcall_vector;
irq_vector_t debugmonitor_vector;
irq_vector_t vector34;
irq_vector_t pendsv_vector;
irq_vector_t systick_vector;
irq_vector_t vectors[45];
} vectors_t;
#if !defined(__DOXYGEN__)
extern uint32_t __main_stack_end__;
extern void ResetHandler(void);
extern void NMIVector(void);
extern void HardFaultVector(void);
extern void MemManageVector(void);
extern void BusFaultVector(void);
extern void UsageFaultVector(void);
extern void Vector1C(void);
extern void Vector20(void);
extern void Vector24(void);
extern void Vector28(void);
extern void SVCallVector(void);
extern void DebugMonitorVector(void);
extern void Vector34(void);
extern void PendSVVector(void);
extern void SysTickVector(void);
extern void Vector40(void);
extern void Vector44(void);
extern void Vector48(void);
extern void Vector4C(void);
extern void Vector50(void);
extern void Vector54(void);
extern void Vector58(void);
extern void Vector5C(void);
extern void Vector60(void);
extern void Vector64(void);
extern void Vector68(void);
extern void Vector6C(void);
extern void Vector70(void);
extern void Vector74(void);
extern void Vector78(void);
extern void Vector7C(void);
extern void Vector80(void);
extern void Vector84(void);
extern void Vector88(void);
extern void Vector8C(void);
extern void Vector90(void);
extern void Vector94(void);
extern void Vector98(void);
extern void Vector9C(void);
extern void VectorA0(void);
extern void VectorA4(void);
extern void VectorA8(void);
extern void VectorAC(void);
extern void VectorB0(void);
extern void VectorB4(void);
extern void VectorB8(void);
extern void VectorBC(void);
extern void VectorC0(void);
extern void VectorC4(void);
extern void VectorC8(void);
extern void VectorCC(void);
extern void VectorD0(void);
extern void VectorD4(void);
extern void VectorD8(void);
extern void VectorDC(void);
extern void VectorE0(void);
extern void VectorE4(void);
extern void VectorE8(void);
extern void VectorEC(void);
extern void VectorF0(void);
#endif /* !defined(__DOXYGEN__) */
/**
* @brief STM32L1xx vectors table.
*/
#if !defined(__DOXYGEN__)
__attribute__ ((section("vectors")))
#endif
vectors_t _vectors = {
&__main_stack_end__,ResetHandler, NMIVector, HardFaultVector,
MemManageVector, BusFaultVector, UsageFaultVector, Vector1C,
Vector20, Vector24, Vector28, SVCallVector,
DebugMonitorVector, Vector34, PendSVVector, SysTickVector,
{
Vector40, Vector44, Vector48, Vector4C,
Vector50, Vector54, Vector58, Vector5C,
Vector60, Vector64, Vector68, Vector6C,
Vector70, Vector74, Vector78, Vector7C,
Vector80, Vector84, Vector88, Vector8C,
Vector90, Vector94, Vector98, Vector9C,
VectorA0, VectorA4, VectorA8, VectorAC,
VectorB0, VectorB4, VectorB8, VectorBC,
VectorC0, VectorC4, VectorC8, VectorCC,
VectorD0, VectorD4, VectorD8, VectorDC,
VectorE0, VectorE4, VectorE8, VectorEC,
VectorF0
}
};
/**
* @brief Unhandled exceptions handler.
* @details Any undefined exception vector points to this function by default.
* This function simply stops the system into an infinite loop.
*
* @notapi
*/
#if !defined(__DOXYGEN__)
__attribute__ ((naked))
#endif
void _unhandled_exception(void) {
while (TRUE)
;
}
void NMIVector(void) __attribute__((weak, alias("_unhandled_exception")));
void HardFaultVector(void) __attribute__((weak, alias("_unhandled_exception")));
void MemManageVector(void) __attribute__((weak, alias("_unhandled_exception")));
void BusFaultVector(void) __attribute__((weak, alias("_unhandled_exception")));
void UsageFaultVector(void) __attribute__((weak, alias("_unhandled_exception")));
void Vector1C(void) __attribute__((weak, alias("_unhandled_exception")));
void Vector20(void) __attribute__((weak, alias("_unhandled_exception")));
void Vector24(void) __attribute__((weak, alias("_unhandled_exception")));
void Vector28(void) __attribute__((weak, alias("_unhandled_exception")));
void SVCallVector(void) __attribute__((weak, alias("_unhandled_exception")));
void DebugMonitorVector(void) __attribute__((weak, alias("_unhandled_exception")));
void Vector34(void) __attribute__((weak, alias("_unhandled_exception")));
void PendSVVector(void) __attribute__((weak, alias("_unhandled_exception")));
void SysTickVector(void) __attribute__((weak, alias("_unhandled_exception")));
void Vector40(void) __attribute__((weak, alias("_unhandled_exception")));
void Vector44(void) __attribute__((weak, alias("_unhandled_exception")));
void Vector48(void) __attribute__((weak, alias("_unhandled_exception")));
void Vector4C(void) __attribute__((weak, alias("_unhandled_exception")));
void Vector50(void) __attribute__((weak, alias("_unhandled_exception")));
void Vector54(void) __attribute__((weak, alias("_unhandled_exception")));
void Vector58(void) __attribute__((weak, alias("_unhandled_exception")));
void Vector5C(void) __attribute__((weak, alias("_unhandled_exception")));
void Vector60(void) __attribute__((weak, alias("_unhandled_exception")));
void Vector64(void) __attribute__((weak, alias("_unhandled_exception")));
void Vector68(void) __attribute__((weak, alias("_unhandled_exception")));
void Vector6C(void) __attribute__((weak, alias("_unhandled_exception")));
void Vector70(void) __attribute__((weak, alias("_unhandled_exception")));
void Vector74(void) __attribute__((weak, alias("_unhandled_exception")));
void Vector78(void) __attribute__((weak, alias("_unhandled_exception")));
void Vector7C(void) __attribute__((weak, alias("_unhandled_exception")));
void Vector80(void) __attribute__((weak, alias("_unhandled_exception")));
void Vector84(void) __attribute__((weak, alias("_unhandled_exception")));
void Vector88(void) __attribute__((weak, alias("_unhandled_exception")));
void Vector8C(void) __attribute__((weak, alias("_unhandled_exception")));
void Vector90(void) __attribute__((weak, alias("_unhandled_exception")));
void Vector94(void) __attribute__((weak, alias("_unhandled_exception")));
void Vector98(void) __attribute__((weak, alias("_unhandled_exception")));
void Vector9C(void) __attribute__((weak, alias("_unhandled_exception")));
void VectorA0(void) __attribute__((weak, alias("_unhandled_exception")));
void VectorA4(void) __attribute__((weak, alias("_unhandled_exception")));
void VectorA8(void) __attribute__((weak, alias("_unhandled_exception")));
void VectorAC(void) __attribute__((weak, alias("_unhandled_exception")));
void VectorB0(void) __attribute__((weak, alias("_unhandled_exception")));
void VectorB4(void) __attribute__((weak, alias("_unhandled_exception")));
void VectorB8(void) __attribute__((weak, alias("_unhandled_exception")));
void VectorBC(void) __attribute__((weak, alias("_unhandled_exception")));
void VectorC0(void) __attribute__((weak, alias("_unhandled_exception")));
void VectorC4(void) __attribute__((weak, alias("_unhandled_exception")));
void VectorC8(void) __attribute__((weak, alias("_unhandled_exception")));
void VectorCC(void) __attribute__((weak, alias("_unhandled_exception")));
void VectorD0(void) __attribute__((weak, alias("_unhandled_exception")));
void VectorD4(void) __attribute__((weak, alias("_unhandled_exception")));
void VectorD8(void) __attribute__((weak, alias("_unhandled_exception")));
void VectorDC(void) __attribute__((weak, alias("_unhandled_exception")));
void VectorE0(void) __attribute__((weak, alias("_unhandled_exception")));
void VectorE4(void) __attribute__((weak, alias("_unhandled_exception")));
void VectorE8(void) __attribute__((weak, alias("_unhandled_exception")));
void VectorEC(void) __attribute__((weak, alias("_unhandled_exception")));
void VectorF0(void) __attribute__((weak, alias("_unhandled_exception")));
/** @} */
| kvzhao/Embedded-ROS | os/ports/GCC/ARMCMx/STM32L1xx/vectors.c | C | gpl-3.0 | 9,889 | [
30522,
1013,
1008,
9610,
26282,
2015,
1013,
19387,
1011,
9385,
1006,
1039,
1007,
2294,
1010,
2289,
1010,
2263,
1010,
2268,
1010,
2230,
1010,
2249,
1010,
2262,
1010,
2286,
9136,
4487,
2909,
3695,
1012,
2023,
5371,
2003,
2112,
1997,
9610,
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... |
/*
* hostapd - Driver operations
* Copyright (c) 2009-2010, Jouni Malinen <j@w1.fi>
*
* This software may be distributed under the terms of the BSD license.
* See README for more details.
*/
#include "utils/includes.h"
#include "utils/common.h"
#include "drivers/driver.h"
#include "common/ieee802_11_defs.h"
#include "wps/wps.h"
#include "hostapd.h"
#include "ieee802_11.h"
#include "sta_info.h"
#include "ap_config.h"
#include "p2p_hostapd.h"
#include "ap_drv_ops.h"
u32 hostapd_sta_flags_to_drv(u32 flags)
{
int res = 0;
if (flags & WLAN_STA_AUTHORIZED)
res |= WPA_STA_AUTHORIZED;
if (flags & WLAN_STA_WMM)
res |= WPA_STA_WMM;
if (flags & WLAN_STA_SHORT_PREAMBLE)
res |= WPA_STA_SHORT_PREAMBLE;
if (flags & WLAN_STA_MFP)
res |= WPA_STA_MFP;
return res;
}
int hostapd_build_ap_extra_ies(struct hostapd_data *hapd,
struct wpabuf **beacon_ret,
struct wpabuf **proberesp_ret,
struct wpabuf **assocresp_ret)
{
struct wpabuf *beacon = NULL, *proberesp = NULL, *assocresp = NULL;
u8 buf[200], *pos;
*beacon_ret = *proberesp_ret = *assocresp_ret = NULL;
pos = buf;
pos = hostapd_eid_time_adv(hapd, pos);
if (pos != buf) {
if (wpabuf_resize(&beacon, pos - buf) != 0)
goto fail;
wpabuf_put_data(beacon, buf, pos - buf);
}
pos = hostapd_eid_time_zone(hapd, pos);
if (pos != buf) {
if (wpabuf_resize(&proberesp, pos - buf) != 0)
goto fail;
wpabuf_put_data(proberesp, buf, pos - buf);
}
pos = buf;
pos = hostapd_eid_ext_capab(hapd, pos);
if (pos != buf) {
if (wpabuf_resize(&assocresp, pos - buf) != 0)
goto fail;
wpabuf_put_data(assocresp, buf, pos - buf);
}
pos = hostapd_eid_interworking(hapd, pos);
pos = hostapd_eid_adv_proto(hapd, pos);
pos = hostapd_eid_roaming_consortium(hapd, pos);
if (pos != buf) {
if (wpabuf_resize(&beacon, pos - buf) != 0)
goto fail;
wpabuf_put_data(beacon, buf, pos - buf);
if (wpabuf_resize(&proberesp, pos - buf) != 0)
goto fail;
wpabuf_put_data(proberesp, buf, pos - buf);
}
if (hapd->wps_beacon_ie) {
if (wpabuf_resize(&beacon, wpabuf_len(hapd->wps_beacon_ie)) <
0)
goto fail;
wpabuf_put_buf(beacon, hapd->wps_beacon_ie);
}
if (hapd->wps_probe_resp_ie) {
if (wpabuf_resize(&proberesp,
wpabuf_len(hapd->wps_probe_resp_ie)) < 0)
goto fail;
wpabuf_put_buf(proberesp, hapd->wps_probe_resp_ie);
}
#ifdef CONFIG_P2P
if (hapd->p2p_beacon_ie) {
if (wpabuf_resize(&beacon, wpabuf_len(hapd->p2p_beacon_ie)) <
0)
goto fail;
wpabuf_put_buf(beacon, hapd->p2p_beacon_ie);
}
if (hapd->p2p_probe_resp_ie) {
if (wpabuf_resize(&proberesp,
wpabuf_len(hapd->p2p_probe_resp_ie)) < 0)
goto fail;
wpabuf_put_buf(proberesp, hapd->p2p_probe_resp_ie);
}
#endif /* CONFIG_P2P */
#ifdef CONFIG_WFD //CONN-FY-FixWFD_5.1.3++
if (hapd->wfd_assoc_resp_ie) {
if (wpabuf_resize(&assocresp, wpabuf_len(hapd->wfd_assoc_resp_ie)) <
0)
goto fail;
wpabuf_put_buf(assocresp, hapd->wfd_assoc_resp_ie);
}
#endif /* CONFIG_P2P */ //CONN-FY-FixWFD_5.1.3--
#ifdef CONFIG_P2P_MANAGER
if (hapd->conf->p2p & P2P_MANAGE) {
if (wpabuf_resize(&beacon, 100) == 0) {
u8 *start, *p;
start = wpabuf_put(beacon, 0);
p = hostapd_eid_p2p_manage(hapd, start);
wpabuf_put(beacon, p - start);
}
if (wpabuf_resize(&proberesp, 100) == 0) {
u8 *start, *p;
start = wpabuf_put(proberesp, 0);
p = hostapd_eid_p2p_manage(hapd, start);
wpabuf_put(proberesp, p - start);
}
}
#endif /* CONFIG_P2P_MANAGER */
#ifdef CONFIG_WPS2
if (hapd->conf->wps_state) {
struct wpabuf *a = wps_build_assoc_resp_ie();
if (a && wpabuf_resize(&assocresp, wpabuf_len(a)) == 0)
wpabuf_put_buf(assocresp, a);
wpabuf_free(a);
}
#endif /* CONFIG_WPS2 */
#ifdef CONFIG_P2P_MANAGER
if (hapd->conf->p2p & P2P_MANAGE) {
if (wpabuf_resize(&assocresp, 100) == 0) {
u8 *start, *p;
start = wpabuf_put(assocresp, 0);
p = hostapd_eid_p2p_manage(hapd, start);
wpabuf_put(assocresp, p - start);
}
}
#endif /* CONFIG_P2P_MANAGER */
*beacon_ret = beacon;
*proberesp_ret = proberesp;
*assocresp_ret = assocresp;
return 0;
fail:
wpabuf_free(beacon);
wpabuf_free(proberesp);
wpabuf_free(assocresp);
return -1;
}
void hostapd_free_ap_extra_ies(struct hostapd_data *hapd,
struct wpabuf *beacon,
struct wpabuf *proberesp,
struct wpabuf *assocresp)
{
wpabuf_free(beacon);
wpabuf_free(proberesp);
wpabuf_free(assocresp);
}
int hostapd_set_ap_wps_ie(struct hostapd_data *hapd)
{
struct wpabuf *beacon, *proberesp, *assocresp;
int ret;
if (hapd->driver == NULL || hapd->driver->set_ap_wps_ie == NULL)
return 0;
if (hostapd_build_ap_extra_ies(hapd, &beacon, &proberesp, &assocresp) <
0)
return -1;
ret = hapd->driver->set_ap_wps_ie(hapd->drv_priv, beacon, proberesp,
assocresp);
hostapd_free_ap_extra_ies(hapd, beacon, proberesp, assocresp);
return ret;
}
int hostapd_set_authorized(struct hostapd_data *hapd,
struct sta_info *sta, int authorized)
{
if (authorized) {
return hostapd_sta_set_flags(hapd, sta->addr,
hostapd_sta_flags_to_drv(
sta->flags),
WPA_STA_AUTHORIZED, ~0);
}
return hostapd_sta_set_flags(hapd, sta->addr,
hostapd_sta_flags_to_drv(sta->flags),
0, ~WPA_STA_AUTHORIZED);
}
int hostapd_set_sta_flags(struct hostapd_data *hapd, struct sta_info *sta)
{
int set_flags, total_flags, flags_and, flags_or;
total_flags = hostapd_sta_flags_to_drv(sta->flags);
set_flags = WPA_STA_SHORT_PREAMBLE | WPA_STA_WMM | WPA_STA_MFP;
if (((!hapd->conf->ieee802_1x && !hapd->conf->wpa) ||
sta->auth_alg == WLAN_AUTH_FT) &&
sta->flags & WLAN_STA_AUTHORIZED)
set_flags |= WPA_STA_AUTHORIZED;
flags_or = total_flags & set_flags;
flags_and = total_flags | ~set_flags;
return hostapd_sta_set_flags(hapd, sta->addr, total_flags,
flags_or, flags_and);
}
int hostapd_set_drv_ieee8021x(struct hostapd_data *hapd, const char *ifname,
int enabled)
{
struct wpa_bss_params params;
os_memset(¶ms, 0, sizeof(params));
params.ifname = ifname;
params.enabled = enabled;
if (enabled) {
params.wpa = hapd->conf->wpa;
params.ieee802_1x = hapd->conf->ieee802_1x;
params.wpa_group = hapd->conf->wpa_group;
params.wpa_pairwise = hapd->conf->wpa_pairwise;
params.wpa_key_mgmt = hapd->conf->wpa_key_mgmt;
params.rsn_preauth = hapd->conf->rsn_preauth;
#ifdef CONFIG_IEEE80211W
params.ieee80211w = hapd->conf->ieee80211w;
#endif /* CONFIG_IEEE80211W */
}
return hostapd_set_ieee8021x(hapd, ¶ms);
}
int hostapd_vlan_if_add(struct hostapd_data *hapd, const char *ifname)
{
char force_ifname[IFNAMSIZ];
u8 if_addr[ETH_ALEN];
return hostapd_if_add(hapd, WPA_IF_AP_VLAN, ifname, hapd->own_addr,
NULL, NULL, force_ifname, if_addr, NULL);
}
int hostapd_vlan_if_remove(struct hostapd_data *hapd, const char *ifname)
{
return hostapd_if_remove(hapd, WPA_IF_AP_VLAN, ifname);
}
int hostapd_set_wds_sta(struct hostapd_data *hapd, const u8 *addr, int aid,
int val)
{
const char *bridge = NULL;
if (hapd->driver == NULL || hapd->driver->set_wds_sta == NULL)
return 0;
if (hapd->conf->wds_bridge[0])
bridge = hapd->conf->wds_bridge;
else if (hapd->conf->bridge[0])
bridge = hapd->conf->bridge;
return hapd->driver->set_wds_sta(hapd->drv_priv, addr, aid, val,
bridge);
}
int hostapd_add_sta_node(struct hostapd_data *hapd, const u8 *addr,
u16 auth_alg)
{
if (hapd->driver == NULL || hapd->driver->add_sta_node == NULL)
return 0;
return hapd->driver->add_sta_node(hapd->drv_priv, addr, auth_alg);
}
int hostapd_sta_auth(struct hostapd_data *hapd, const u8 *addr,
u16 seq, u16 status, const u8 *ie, size_t len)
{
if (hapd->driver == NULL || hapd->driver->sta_auth == NULL)
return 0;
return hapd->driver->sta_auth(hapd->drv_priv, hapd->own_addr, addr,
seq, status, ie, len);
}
int hostapd_sta_assoc(struct hostapd_data *hapd, const u8 *addr,
int reassoc, u16 status, const u8 *ie, size_t len)
{
if (hapd->driver == NULL || hapd->driver->sta_assoc == NULL)
return 0;
return hapd->driver->sta_assoc(hapd->drv_priv, hapd->own_addr, addr,
reassoc, status, ie, len);
}
int hostapd_sta_add(struct hostapd_data *hapd,
const u8 *addr, u16 aid, u16 capability,
const u8 *supp_rates, size_t supp_rates_len,
u16 listen_interval,
const struct ieee80211_ht_capabilities *ht_capab,
u32 flags, u8 qosinfo)
{
struct hostapd_sta_add_params params;
if (hapd->driver == NULL)
return 0;
if (hapd->driver->sta_add == NULL)
return 0;
os_memset(¶ms, 0, sizeof(params));
params.addr = addr;
params.aid = aid;
params.capability = capability;
params.supp_rates = supp_rates;
params.supp_rates_len = supp_rates_len;
params.listen_interval = listen_interval;
params.ht_capabilities = ht_capab;
params.flags = hostapd_sta_flags_to_drv(flags);
params.qosinfo = qosinfo;
return hapd->driver->sta_add(hapd->drv_priv, ¶ms);
}
int hostapd_add_tspec(struct hostapd_data *hapd, const u8 *addr,
u8 *tspec_ie, size_t tspec_ielen)
{
if (hapd->driver == NULL || hapd->driver->add_tspec == NULL)
return 0;
return hapd->driver->add_tspec(hapd->drv_priv, addr, tspec_ie,
tspec_ielen);
}
int hostapd_set_privacy(struct hostapd_data *hapd, int enabled)
{
if (hapd->driver == NULL || hapd->driver->set_privacy == NULL)
return 0;
return hapd->driver->set_privacy(hapd->drv_priv, enabled);
}
int hostapd_set_generic_elem(struct hostapd_data *hapd, const u8 *elem,
size_t elem_len)
{
if (hapd->driver == NULL || hapd->driver->set_generic_elem == NULL)
return 0;
return hapd->driver->set_generic_elem(hapd->drv_priv, elem, elem_len);
}
int hostapd_get_ssid(struct hostapd_data *hapd, u8 *buf, size_t len)
{
if (hapd->driver == NULL || hapd->driver->hapd_get_ssid == NULL)
return 0;
return hapd->driver->hapd_get_ssid(hapd->drv_priv, buf, len);
}
int hostapd_set_ssid(struct hostapd_data *hapd, const u8 *buf, size_t len)
{
if (hapd->driver == NULL || hapd->driver->hapd_set_ssid == NULL)
return 0;
return hapd->driver->hapd_set_ssid(hapd->drv_priv, buf, len);
}
int hostapd_if_add(struct hostapd_data *hapd, enum wpa_driver_if_type type,
const char *ifname, const u8 *addr, void *bss_ctx,
void **drv_priv, char *force_ifname, u8 *if_addr,
const char *bridge)
{
if (hapd->driver == NULL || hapd->driver->if_add == NULL)
return -1;
return hapd->driver->if_add(hapd->drv_priv, type, ifname, addr,
bss_ctx, drv_priv, force_ifname, if_addr,
bridge);
}
int hostapd_if_remove(struct hostapd_data *hapd, enum wpa_driver_if_type type,
const char *ifname)
{
if (hapd->driver == NULL || hapd->driver->if_remove == NULL)
return -1;
return hapd->driver->if_remove(hapd->drv_priv, type, ifname);
}
int hostapd_set_ieee8021x(struct hostapd_data *hapd,
struct wpa_bss_params *params)
{
if (hapd->driver == NULL || hapd->driver->set_ieee8021x == NULL)
return 0;
return hapd->driver->set_ieee8021x(hapd->drv_priv, params);
}
int hostapd_get_seqnum(const char *ifname, struct hostapd_data *hapd,
const u8 *addr, int idx, u8 *seq)
{
if (hapd->driver == NULL || hapd->driver->get_seqnum == NULL)
return 0;
return hapd->driver->get_seqnum(ifname, hapd->drv_priv, addr, idx,
seq);
}
int hostapd_flush(struct hostapd_data *hapd)
{
if (hapd->driver == NULL || hapd->driver->flush == NULL)
return 0;
return hapd->driver->flush(hapd->drv_priv);
}
int hostapd_set_freq(struct hostapd_data *hapd, int mode, int freq,
int channel, int ht_enabled, int sec_channel_offset)
{
struct hostapd_freq_params data;
if (hapd->driver == NULL)
return 0;
if (hapd->driver->set_freq == NULL)
return 0;
os_memset(&data, 0, sizeof(data));
data.mode = mode;
data.freq = freq;
data.channel = channel;
data.ht_enabled = ht_enabled;
data.sec_channel_offset = sec_channel_offset;
return hapd->driver->set_freq(hapd->drv_priv, &data);
}
int hostapd_set_rts(struct hostapd_data *hapd, int rts)
{
if (hapd->driver == NULL || hapd->driver->set_rts == NULL)
return 0;
return hapd->driver->set_rts(hapd->drv_priv, rts);
}
int hostapd_set_frag(struct hostapd_data *hapd, int frag)
{
if (hapd->driver == NULL || hapd->driver->set_frag == NULL)
return 0;
return hapd->driver->set_frag(hapd->drv_priv, frag);
}
int hostapd_sta_set_flags(struct hostapd_data *hapd, u8 *addr,
int total_flags, int flags_or, int flags_and)
{
if (hapd->driver == NULL || hapd->driver->sta_set_flags == NULL)
return 0;
return hapd->driver->sta_set_flags(hapd->drv_priv, addr, total_flags,
flags_or, flags_and);
}
int hostapd_set_country(struct hostapd_data *hapd, const char *country)
{
if (hapd->driver == NULL ||
hapd->driver->set_country == NULL)
return 0;
return hapd->driver->set_country(hapd->drv_priv, country);
}
int hostapd_set_tx_queue_params(struct hostapd_data *hapd, int queue, int aifs,
int cw_min, int cw_max, int burst_time)
{
if (hapd->driver == NULL || hapd->driver->set_tx_queue_params == NULL)
return 0;
return hapd->driver->set_tx_queue_params(hapd->drv_priv, queue, aifs,
cw_min, cw_max, burst_time);
}
struct hostapd_hw_modes *
hostapd_get_hw_feature_data(struct hostapd_data *hapd, u16 *num_modes,
u16 *flags)
{
if (hapd->driver == NULL ||
hapd->driver->get_hw_feature_data == NULL)
return NULL;
return hapd->driver->get_hw_feature_data(hapd->drv_priv, num_modes,
flags);
}
int hostapd_driver_commit(struct hostapd_data *hapd)
{
if (hapd->driver == NULL || hapd->driver->commit == NULL)
return 0;
return hapd->driver->commit(hapd->drv_priv);
}
int hostapd_drv_none(struct hostapd_data *hapd)
{
return hapd->driver && os_strcmp(hapd->driver->name, "none") == 0;
}
int hostapd_driver_scan(struct hostapd_data *hapd,
struct wpa_driver_scan_params *params)
{
if (hapd->driver && hapd->driver->scan2)
return hapd->driver->scan2(hapd->drv_priv, params);
return -1;
}
struct wpa_scan_results * hostapd_driver_get_scan_results(
struct hostapd_data *hapd)
{
if (hapd->driver && hapd->driver->get_scan_results2)
return hapd->driver->get_scan_results2(hapd->drv_priv);
return NULL;
}
int hostapd_driver_set_noa(struct hostapd_data *hapd, u8 count, int start,
int duration)
{
if (hapd->driver && hapd->driver->set_noa)
return hapd->driver->set_noa(hapd->drv_priv, count, start,
duration);
return -1;
}
int hostapd_drv_set_key(const char *ifname, struct hostapd_data *hapd,
enum wpa_alg alg, const u8 *addr,
int key_idx, int set_tx,
const u8 *seq, size_t seq_len,
const u8 *key, size_t key_len)
{
if (hapd->driver == NULL || hapd->driver->set_key == NULL)
return 0;
return hapd->driver->set_key(ifname, hapd->drv_priv, alg, addr,
key_idx, set_tx, seq, seq_len, key,
key_len);
}
int hostapd_drv_send_mlme(struct hostapd_data *hapd,
const void *msg, size_t len, int noack)
{
if (hapd->driver == NULL || hapd->driver->send_mlme == NULL)
return 0;
return hapd->driver->send_mlme(hapd->drv_priv, msg, len, noack);
}
int hostapd_drv_sta_deauth(struct hostapd_data *hapd,
const u8 *addr, int reason)
{
if (hapd->driver == NULL || hapd->driver->sta_deauth == NULL)
return 0;
return hapd->driver->sta_deauth(hapd->drv_priv, hapd->own_addr, addr,
reason);
}
int hostapd_drv_sta_disassoc(struct hostapd_data *hapd,
const u8 *addr, int reason)
{
if (hapd->driver == NULL || hapd->driver->sta_disassoc == NULL)
return 0;
return hapd->driver->sta_disassoc(hapd->drv_priv, hapd->own_addr, addr,
reason);
}
| Xperia-Nicki/android_platform_sony_nicki | external/wpa_supplicant_8/src/ap/ap_drv_ops.c | C | apache-2.0 | 15,643 | [
30522,
1013,
1008,
1008,
3677,
9331,
2094,
1011,
4062,
3136,
1008,
9385,
1006,
1039,
30524,
1028,
1008,
1008,
2023,
4007,
2089,
2022,
5500,
2104,
1996,
3408,
1997,
1996,
18667,
2094,
6105,
1012,
1008,
2156,
3191,
4168,
2005,
2062,
4751,
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... |
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>File: checklist.rb [RDoc Documentation]</title>
<link type="text/css" media="screen" href="../../rdoc.css" rel="stylesheet" />
<script src="../../js/jquery.js" type="text/javascript"
charset="utf-8"></script>
<script src="../../js/thickbox-compressed.js" type="text/javascript"
charset="utf-8"></script>
<script src="../../js/quicksearch.js" type="text/javascript"
charset="utf-8"></script>
<script src="../../js/darkfish.js" type="text/javascript"
charset="utf-8"></script>
</head>
<body class="file file-popup">
<div id="metadata">
<dl>
<dt class="modified-date">Last Modified</dt>
<dd class="modified-date">2012-02-13 00:16:22 -0600</dd>
<dt class="requires">Requires</dt>
<dd class="requires">
<ul>
</ul>
</dd>
</dl>
</div>
<div id="documentation">
<div class="description">
<h2>Description</h2>
</div>
</div>
</body>
</html>
| ksamc/ruby-trello | doc/lib/trello/checklist_rb.html | HTML | mit | 1,221 | [
30522,
1026,
1029,
20950,
2544,
1027,
1000,
1015,
1012,
1014,
1000,
17181,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1029,
1028,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
1060,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis.CodeRefactorings.MoveType
{
internal interface IMoveTypeService : ILanguageService
{
Task<ImmutableArray<CodeAction>> GetRefactoringAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken);
}
}
| jkotas/roslyn | src/Features/Core/Portable/CodeRefactorings/MoveType/IMoveTypeService.cs | C# | apache-2.0 | 639 | [
30522,
1013,
1013,
9385,
1006,
1039,
1007,
7513,
1012,
2035,
2916,
9235,
1012,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1012,
2156,
6105,
1012,
19067,
2102,
1999,
1996,
2622,
7117,
2005,
6105,
2592,
1012,
2478,
2291,
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... |
/* FileSaver.js
* A saveAs() & saveTextAs() FileSaver implementation.
* 2014-06-24
*
* Modify by Brian Chen
* Author: Eli Grey, http://eligrey.com
* License: X11/MIT
* See https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md
*/
/*global self */
/*jslint bitwise: true, indent: 4, laxbreak: true, laxcomma: true, smarttabs: true, plusplus: true */
/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */
var saveAs = saveAs
// IE 10+ (native saveAs)
|| (typeof navigator !== "undefined" &&
navigator.msSaveOrOpenBlob && navigator.msSaveOrOpenBlob.bind(navigator))
// Everyone else
|| (function (view) {
"use strict";
// IE <10 is explicitly unsupported
if (typeof navigator !== "undefined" &&
/MSIE [1-9]\./.test(navigator.userAgent)) {
return;
}
var
doc = view.document
// only get URL when necessary in case Blob.js hasn't overridden it yet
, get_URL = function () {
return view.URL || view.webkitURL || view;
}
, save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a")
, can_use_save_link = !view.externalHost && "download" in save_link
, click = function (node) {
var event = doc.createEvent("MouseEvents");
event.initMouseEvent(
"click", true, false, view, 0, 0, 0, 0, 0
, false, false, false, false, 0, null
);
node.dispatchEvent(event);
}
, webkit_req_fs = view.webkitRequestFileSystem
, req_fs = view.requestFileSystem || webkit_req_fs || view.mozRequestFileSystem
, throw_outside = function (ex) {
(view.setImmediate || view.setTimeout)(function () {
throw ex;
}, 0);
}
, force_saveable_type = "application/octet-stream"
, fs_min_size = 0
, deletion_queue = []
, process_deletion_queue = function () {
var i = deletion_queue.length;
while (i--) {
var file = deletion_queue[i];
if (typeof file === "string") { // file is an object URL
get_URL().revokeObjectURL(file);
} else { // file is a File
file.remove();
}
}
deletion_queue.length = 0; // clear queue
}
, dispatch = function (filesaver, event_types, event) {
event_types = [].concat(event_types);
var i = event_types.length;
while (i--) {
var listener = filesaver["on" + event_types[i]];
if (typeof listener === "function") {
try {
listener.call(filesaver, event || filesaver);
} catch (ex) {
throw_outside(ex);
}
}
}
}
, FileSaver = function (blob, name) {
// First try a.download, then web filesystem, then object URLs
var
filesaver = this
, type = blob.type
, blob_changed = false
, object_url
, target_view
, get_object_url = function () {
var object_url = get_URL().createObjectURL(blob);
deletion_queue.push(object_url);
return object_url;
}
, dispatch_all = function () {
dispatch(filesaver, "writestart progress write writeend".split(" "));
}
// on any filesys errors revert to saving with object URLs
, fs_error = function () {
// don't create more object URLs than needed
if (blob_changed || !object_url) {
object_url = get_object_url(blob);
}
if (target_view) {
target_view.location.href = object_url;
} else {
window.open(object_url, "_blank");
}
filesaver.readyState = filesaver.DONE;
dispatch_all();
}
, abortable = function (func) {
return function () {
if (filesaver.readyState !== filesaver.DONE) {
return func.apply(this, arguments);
}
};
}
, create_if_not_found = { create: true, exclusive: false }
, slice
;
filesaver.readyState = filesaver.INIT;
if (!name) {
name = "download";
}
if (can_use_save_link) {
object_url = get_object_url(blob);
save_link.href = object_url;
save_link.download = name;
click(save_link);
filesaver.readyState = filesaver.DONE;
dispatch_all();
return;
}
// Object and web filesystem URLs have a problem saving in Google Chrome when
// viewed in a tab, so I force save with application/octet-stream
// http://code.google.com/p/chromium/issues/detail?id=91158
if (view.chrome && type && type !== force_saveable_type) {
slice = blob.slice || blob.webkitSlice;
blob = slice.call(blob, 0, blob.size, force_saveable_type);
blob_changed = true;
}
// Since I can't be sure that the guessed media type will trigger a download
// in WebKit, I append .download to the filename.
// https://bugs.webkit.org/show_bug.cgi?id=65440
if (webkit_req_fs && name !== "download") {
name += ".download";
}
if (type === force_saveable_type || webkit_req_fs) {
target_view = view;
}
if (!req_fs) {
fs_error();
return;
}
fs_min_size += blob.size;
req_fs(view.TEMPORARY, fs_min_size, abortable(function (fs) {
fs.root.getDirectory("saved", create_if_not_found, abortable(function (dir) {
var save = function () {
dir.getFile(name, create_if_not_found, abortable(function (file) {
file.createWriter(abortable(function (writer) {
writer.onwriteend = function (event) {
target_view.location.href = file.toURL();
deletion_queue.push(file);
filesaver.readyState = filesaver.DONE;
dispatch(filesaver, "writeend", event);
};
writer.onerror = function () {
var error = writer.error;
if (error.code !== error.ABORT_ERR) {
fs_error();
}
};
"writestart progress write abort".split(" ").forEach(function (event) {
writer["on" + event] = filesaver["on" + event];
});
writer.write(blob);
filesaver.abort = function () {
writer.abort();
filesaver.readyState = filesaver.DONE;
};
filesaver.readyState = filesaver.WRITING;
}), fs_error);
}), fs_error);
};
dir.getFile(name, { create: false }, abortable(function (file) {
// delete file if it already exists
file.remove();
save();
}), abortable(function (ex) {
if (ex.code === ex.NOT_FOUND_ERR) {
save();
} else {
fs_error();
}
}));
}), fs_error);
}), fs_error);
}
, FS_proto = FileSaver.prototype
, saveAs = function (blob, name) {
return new FileSaver(blob, name);
}
;
FS_proto.abort = function () {
var filesaver = this;
filesaver.readyState = filesaver.DONE;
dispatch(filesaver, "abort");
};
FS_proto.readyState = FS_proto.INIT = 0;
FS_proto.WRITING = 1;
FS_proto.DONE = 2;
FS_proto.error =
FS_proto.onwritestart =
FS_proto.onprogress =
FS_proto.onwrite =
FS_proto.onabort =
FS_proto.onerror =
FS_proto.onwriteend =
null;
view.addEventListener("unload", process_deletion_queue, false);
saveAs.unload = function () {
process_deletion_queue();
view.removeEventListener("unload", process_deletion_queue, false);
};
return saveAs;
}(
typeof self !== "undefined" && self
|| typeof window !== "undefined" && window
|| this.content
));
// `self` is undefined in Firefox for Android content script context
// while `this` is nsIContentFrameMessageManager
// with an attribute `content` that corresponds to the window
if (typeof module !== "undefined" && module !== null) {
module.exports = saveAs;
} else if ((typeof define !== "undefined" && define !== null) && (define.amd != null)) {
define([], function () {
return saveAs;
});
}
String.prototype.endsWithAny = function () {
var strArray = Array.prototype.slice.call(arguments),
$this = this.toLowerCase().toString();
for (var i = 0; i < strArray.length; i++) {
if ($this.indexOf(strArray[i], $this.length - strArray[i].length) !== -1) return true;
}
return false;
};
var saveTextAs = saveTextAs
|| (function (textContent, fileName, charset) {
fileName = fileName || 'download.txt';
charset = charset || 'utf-8';
textContent = (textContent || '').replace(/\r?\n/g, "\r\n");
if (saveAs && Blob) {
var blob = new Blob([textContent], { type: "text/plain;charset=" + charset });
saveAs(blob, fileName);
return true;
} else {//IE9-
var saveTxtWindow = window.frames.saveTxtWindow;
if (!saveTxtWindow) {
saveTxtWindow = document.createElement('iframe');
saveTxtWindow.id = 'saveTxtWindow';
saveTxtWindow.style.display = 'none';
document.body.insertBefore(saveTxtWindow, null);
saveTxtWindow = window.frames.saveTxtWindow;
if (!saveTxtWindow) {
saveTxtWindow = window.open('', '_temp', 'width=100,height=100');
if (!saveTxtWindow) {
window.alert('Sorry, download file could not be created.');
return false;
}
}
}
var doc = saveTxtWindow.document;
doc.open('text/html', 'replace');
doc.charset = charset;
if (fileName.endsWithAny('.htm', '.html')) {
doc.close();
doc.body.innerHTML = '\r\n' + textContent + '\r\n';
} else {
if (!fileName.endsWithAny('.txt')) fileName += '.txt';
doc.write(textContent);
doc.close();
}
var retValue = doc.execCommand('SaveAs', null, fileName);
saveTxtWindow.close();
return retValue;
}
})
| PTRPlay/PrompterPro | Main/SoftServe.ITA.PrompterPro/PrompterPro.WebApplication/Scripts/FileSaver.js | JavaScript | apache-2.0 | 12,241 | [
30522,
1013,
1008,
6764,
22208,
1012,
1046,
2015,
1008,
1037,
3828,
3022,
1006,
1007,
1004,
3828,
18209,
3022,
1006,
1007,
6764,
22208,
7375,
1012,
1008,
2297,
1011,
5757,
1011,
2484,
1008,
1008,
19933,
2011,
4422,
8802,
1008,
3166,
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... |
<div ng-controller="Umbraco.Editors.Content.CopyController">
<div class="umb-dialog-body form-horizontal" ng-cloak>
<div class="umb-pane">
<div ng-show="error">
<div class="alert alert-error">
<div><strong>{{error.errorMsg}}</strong></div>
<div>{{error.data.message}}</div>
</div>
</div>
<div ng-show="success">
<div class="alert alert-success">
<strong>{{source.name}}</strong>
<localize key="actions_wasCopiedTo">was copied to</localize>
<strong>{{target.name}}</strong>
</div>
<button class="btn btn-primary" ng-click="closeDialog()">Ok</button>
</div>
<p class="abstract" ng-hide="success">
<localize key="actions_chooseWhereToCopy">Choose where to copy</localize>
<strong>{{source.name}}</strong>
<localize key="actions_toInTheTreeStructureBelow">to in the tree structure below</localize>
</p>
<umb-loader ng-show="busy"></umb-loader>
<div ng-hide="success">
<div ng-hide="miniListView">
<umb-tree-search-box
hide-search-callback="hideSearch"
search-callback="onSearchResults"
search-from-id="{{searchInfo.searchFromId}}"
search-from-name="{{searchInfo.searchFromName}}"
show-search="{{searchInfo.showSearch}}"
section="{{section}}">
</umb-tree-search-box>
<br />
<umb-tree-search-results
ng-if="searchInfo.showSearch"
results="searchInfo.results"
select-result-callback="selectResult">
</umb-tree-search-results>
<div ng-hide="searchInfo.showSearch">
<umb-tree
section="content"
hideheader="{{treeModel.hideHeader}}"
hideoptions="true"
isdialog="true"
api="dialogTreeApi"
on-init="onTreeInit()"
enablelistviewexpand="true"
enablecheckboxes="true">
</umb-tree>
</div>
</div>
<umb-mini-list-view
ng-if="miniListView"
node="miniListView"
entity-type="Document"
on-select="selectListViewNode(node)"
on-close="closeMiniListView()">
</umb-mini-list-view>
<umb-pane>
<umb-control-group localize="label" label="@defaultdialogs_relateToOriginalLabel">
<umb-toggle checked="$parent.$parent.relateToOriginal" on-click="$parent.$parent.toggle('relate')"></umb-toggle>
</umb-control-group>
</umb-pane>
<umb-pane>
<umb-control-group localize="label" label="@defaultdialogs_includeDescendants">
<umb-toggle checked="$parent.$parent.recursive" on-click="$parent.$parent.toggle('recursive')"></umb-toggle>
</umb-control-group>
</umb-pane>
</div>
</div>
</div>
<div class="umb-dialog-footer btn-toolbar umb-btn-toolbar" ng-hide="success">
<a class="btn btn-link" ng-click="closeDialog()" ng-show="!busy">
<localize key="general_cancel">Cancel</localize>
</a>
<button class="btn btn-primary" ng-click="copy()" ng-disabled="busy || !target">
<localize key="actions_copy">Copy</localize>
</button>
</div>
</div>
| leekelleher/Umbraco-CMS | src/Umbraco.Web.UI.Client/src/views/content/copy.html | HTML | mit | 4,020 | [
30522,
1026,
4487,
2615,
12835,
1011,
11486,
1027,
1000,
8529,
10024,
3597,
1012,
10195,
1012,
4180,
1012,
6100,
8663,
13181,
10820,
1000,
1028,
1026,
4487,
2615,
2465,
1027,
1000,
8529,
2497,
1011,
13764,
8649,
1011,
2303,
2433,
1011,
9876... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 2013 Cyber Eagle
*
* 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 br.com.cybereagle.androidlibrary.util;
import android.app.Activity;
import android.view.inputmethod.InputMethodManager;
public class Utils {
public static void hideSoftKeyboard(Activity activity) {
InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0);
}
}
| CyberEagle/AndroidLibrary | library/src/main/java/br/com/cybereagle/androidlibrary/util/Utils.java | Java | apache-2.0 | 1,060 | [
30522,
1013,
1008,
1008,
9385,
2286,
16941,
6755,
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,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
/*
* Flash partitions described by the OF (or flattened) device tree
*
* Copyright (C) 2006 MontaVista Software Inc.
* Author: Vitaly Wool <vwool@ru.mvista.com>
*
* Revised to handle newer style flash binding by:
* Copyright (C) 2007 David Gibson, IBM Corporation.
*
* 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.
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/of.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
int __devinit of_mtd_parse_partitions(struct device *dev,
struct mtd_info *mtd,
struct device_node *node,
struct mtd_partition **pparts)
{
const char *partname;
struct device_node *pp;
int nr_parts, i;
/* First count the subnodes */
pp = NULL;
nr_parts = 0;
while ((pp = of_get_next_child(node, pp)))
nr_parts++;
if (nr_parts == 0)
return 0;
*pparts = kzalloc(nr_parts * sizeof(**pparts), GFP_KERNEL);
if (!*pparts)
return -ENOMEM;
pp = NULL;
i = 0;
while ((pp = of_get_next_child(node, pp))) {
const u32 *reg;
int len;
reg = of_get_property(pp, "reg", &len);
if (!reg || (len != 2 * sizeof(u32))) {
of_node_put(pp);
dev_err(dev, "Invalid 'reg' on %s\n", node->full_name);
kfree(*pparts);
*pparts = NULL;
return -EINVAL;
}
(*pparts)[i].offset = reg[0];
(*pparts)[i].size = reg[1];
partname = of_get_property(pp, "label", &len);
if (!partname)
partname = of_get_property(pp, "name", &len);
(*pparts)[i].name = (char *)partname;
if (of_get_property(pp, "read-only", &len))
(*pparts)[i].mask_flags = MTD_WRITEABLE;
i++;
}
return nr_parts;
}
EXPORT_SYMBOL(of_mtd_parse_partitions);
| jkoelndorfer/android-kernel-msm | drivers/mtd/ofpart.c | C | gpl-2.0 | 1,941 | [
30522,
1013,
1008,
1008,
5956,
13571,
2015,
2649,
2011,
1996,
1997,
1006,
2030,
16379,
1007,
5080,
3392,
1008,
1008,
9385,
1006,
1039,
1007,
2294,
18318,
18891,
9153,
4007,
4297,
1012,
1008,
3166,
1024,
8995,
2100,
12121,
1026,
1058,
12155,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
django-mes-fichiers
====================
Django backend for [mes-fichiers](https://github.com/pavelulyashev/mes-fichiers) | pavelulyashev/django-mes-fichiers | README.md | Markdown | bsd-3-clause | 122 | [
30522,
6520,
23422,
1011,
2033,
2015,
1011,
10882,
5428,
2545,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
6520,
23422,
2067,
10497,
2005,
1031,
2033,
2015,
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... |
<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>schrodinger.application.desmond.enhsamp.Series</title>
<link rel="stylesheet" href="epydoc.css" type="text/css" />
<script type="text/javascript" src="epydoc.js"></script>
</head>
<body bgcolor="white" text="black" link="blue" vlink="#204080"
alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
bgcolor="#a0c0ff" cellspacing="0">
<tr valign="middle">
<!-- Home link -->
<th> <a
href="schrodinger-module.html">Home</a> </th>
<!-- Tree link -->
<th> <a
href="module-tree.html">Trees</a> </th>
<!-- Index link -->
<th> <a
href="identifier-index.html">Indices</a> </th>
<!-- Help link -->
<th> <a
href="help.html">Help</a> </th>
<!-- Project homepage -->
<th class="navbar" align="right" width="100%">
<table border="0" cellpadding="0" cellspacing="0">
<tr><th class="navbar" align="center"
>Suite 2012 Schrodinger Python API</th>
</tr></table></th>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="100%">
<span class="breadcrumbs">
<a href="schrodinger-module.html">Package schrodinger</a> ::
<a href="schrodinger.application-module.html">Package application</a> ::
<a href="schrodinger.application.desmond-module.html">Package desmond</a> ::
<a href="schrodinger.application.desmond.enhsamp-module.html">Module enhsamp</a> ::
Class Series
</span>
</td>
<td>
<table cellpadding="0" cellspacing="0">
<!-- hide/show private -->
<tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
onclick="toggle_private();">hide private</a>]</span></td></tr>
<tr><td align="right"><span class="options"
>[<a href="frames.html" target="_top">frames</a
>] | <a href="schrodinger.application.desmond.enhsamp.Series-class.html"
target="_top">no frames</a>]</span></td></tr>
</table>
</td>
</tr>
</table>
<!-- ==================== CLASS DESCRIPTION ==================== -->
<h1 class="epydoc">Class Series</h1><p class="nomargin-top"></p>
<pre class="base-tree">
object --+
|
<a href="schrodinger.application.desmond.enhsamp.Node-class.html">Node</a> --+
|
<strong class="uidshort">Series</strong>
</pre>
<hr />
<!-- ==================== INSTANCE METHODS ==================== -->
<a name="section-InstanceMethods"></a>
<table class="summary" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td colspan="2" class="table-header">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td align="left"><span class="table-header">Instance Methods</span></td>
<td align="right" valign="top"
><span class="options">[<a href="#section-InstanceMethods"
class="privatelink" onclick="toggle_private();"
>hide private</a>]</span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="schrodinger.application.desmond.enhsamp.Series-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">env</span>,
<span class="summary-sig-arg">iters</span>,
<span class="summary-sig-arg">value</span>)</span><br />
x.__init__(...) initializes x; see help(type(x)) for signature</td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="schrodinger.application.desmond.enhsamp.Series-class.html#get_type" class="summary-sig-name">get_type</a>(<span class="summary-sig-arg">self</span>,
<span class="summary-sig-arg">env</span>)</span></td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="schrodinger.application.desmond.enhsamp.Series-class.html#__str__" class="summary-sig-name">__str__</a>(<span class="summary-sig-arg">self</span>)</span><br />
str(x)</td>
<td align="right" valign="top">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" class="summary">
<p class="indent-wrapped-lines"><b>Inherited from <code><a href="schrodinger.application.desmond.enhsamp.Node-class.html">Node</a></code></b>:
<code><a href="schrodinger.application.desmond.enhsamp.Node-class.html#constant_fold">constant_fold</a></code>,
<code><a href="schrodinger.application.desmond.enhsamp.Node-class.html#resolve_atomsel">resolve_atomsel</a></code>
</p>
<p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
<code>__delattr__</code>,
<code>__format__</code>,
<code>__getattribute__</code>,
<code>__hash__</code>,
<code>__new__</code>,
<code>__reduce__</code>,
<code>__reduce_ex__</code>,
<code>__repr__</code>,
<code>__setattr__</code>,
<code>__sizeof__</code>,
<code>__subclasshook__</code>
</p>
</td>
</tr>
</table>
<!-- ==================== PROPERTIES ==================== -->
<a name="section-Properties"></a>
<table class="summary" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td colspan="2" class="table-header">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td align="left"><span class="table-header">Properties</span></td>
<td align="right" valign="top"
><span class="options">[<a href="#section-Properties"
class="privatelink" onclick="toggle_private();"
>hide private</a>]</span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" class="summary">
<p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
<code>__class__</code>
</p>
</td>
</tr>
</table>
<!-- ==================== METHOD DETAILS ==================== -->
<a name="section-MethodDetails"></a>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td colspan="2" class="table-header">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td align="left"><span class="table-header">Method Details</span></td>
<td align="right" valign="top"
><span class="options">[<a href="#section-MethodDetails"
class="privatelink" onclick="toggle_private();"
>hide private</a>]</span></td>
</tr>
</table>
</td>
</tr>
</table>
<a name="__init__"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>,
<span class="sig-arg">env</span>,
<span class="sig-arg">iters</span>,
<span class="sig-arg">value</span>)</span>
<br /><em class="fname">(Constructor)</em>
</h3>
</td><td align="right" valign="top"
>
</td>
</tr></table>
<p>x.__init__(...) initializes x; see help(type(x)) for signature</p>
<dl class="fields">
<dt>Overrides:
object.__init__
<dd><em class="note">(inherited documentation)</em></dd>
</dt>
</dl>
</td></tr></table>
</div>
<a name="get_type"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">get_type</span>(<span class="sig-arg">self</span>,
<span class="sig-arg">env</span>)</span>
</h3>
</td><td align="right" valign="top"
>
</td>
</tr></table>
<dl class="fields">
<dt>Overrides:
<a href="schrodinger.application.desmond.enhsamp.Node-class.html#get_type">Node.get_type</a>
</dt>
</dl>
</td></tr></table>
</div>
<a name="__str__"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">__str__</span>(<span class="sig-arg">self</span>)</span>
<br /><em class="fname">(Informal representation operator)</em>
</h3>
</td><td align="right" valign="top"
>
</td>
</tr></table>
<p>str(x)</p>
<dl class="fields">
<dt>Overrides:
object.__str__
<dd><em class="note">(inherited documentation)</em></dd>
</dt>
</dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
bgcolor="#a0c0ff" cellspacing="0">
<tr valign="middle">
<!-- Home link -->
<th> <a
href="schrodinger-module.html">Home</a> </th>
<!-- Tree link -->
<th> <a
href="module-tree.html">Trees</a> </th>
<!-- Index link -->
<th> <a
href="identifier-index.html">Indices</a> </th>
<!-- Help link -->
<th> <a
href="help.html">Help</a> </th>
<!-- Project homepage -->
<th class="navbar" align="right" width="100%">
<table border="0" cellpadding="0" cellspacing="0">
<tr><th class="navbar" align="center"
>Suite 2012 Schrodinger Python API</th>
</tr></table></th>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0.1 on Tue Sep 25 02:22:59 2012
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
>http://epydoc.sourceforge.net</a>
</td>
</tr>
</table>
<script type="text/javascript">
<!--
// Private objects are initially displayed (because if
// javascript is turned off then we want them to be
// visible); but by default, we want to hide them. So hide
// them unless we have a cookie that says to show them.
checkCookie();
// -->
</script>
</body>
</html>
| platinhom/ManualHom | Schrodinger/Schrodinger_2012_docs/python_api/api/schrodinger.application.desmond.enhsamp.Series-class.html | HTML | gpl-2.0 | 12,010 | [
30522,
1026,
1029,
20950,
2544,
1027,
1000,
1015,
1012,
1014,
1000,
17181,
1027,
1000,
2004,
6895,
2072,
1000,
1029,
1028,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
1060,
11039,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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";
(function (ConflictType) {
ConflictType[ConflictType["IndividualAttendeeConflict"] = 0] = "IndividualAttendeeConflict";
ConflictType[ConflictType["GroupConflict"] = 1] = "GroupConflict";
ConflictType[ConflictType["GroupTooBigConflict"] = 2] = "GroupTooBigConflict";
ConflictType[ConflictType["UnknownAttendeeConflict"] = 3] = "UnknownAttendeeConflict";
})(exports.ConflictType || (exports.ConflictType = {}));
var ConflictType = exports.ConflictType;
| eino-makitalo/ews-javascript-npmbuild | js/Enumerations/ConflictType.js | JavaScript | mit | 481 | [
30522,
1000,
2224,
9384,
1000,
1025,
1006,
3853,
1006,
4736,
13874,
1007,
1063,
4736,
13874,
1031,
4736,
13874,
1031,
1000,
3265,
19321,
10497,
4402,
8663,
29301,
1000,
1033,
1027,
1014,
1033,
1027,
1000,
3265,
19321,
10497,
4402,
8663,
293... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Diagnostics;
using System.Windows.Forms;
using System.Threading;
using System.Collections.Generic;
using CurePlease.Properties;
namespace CurePlease
{
using FFACETools;
public partial class Form1 : Form
{
public static FFACE _FFACEPL;
public FFACE _FFACEMonitored;
public ListBox processids = new ListBox();
// Stores the previously-colored button, if any
float plX;
float plY;
float plZ;
byte playerOptionsSelected;
byte autoOptionsSelected;
bool castingLock = false;
bool pauseActions = false;
int castingSafetyPercentage = 100;
private bool islowmp = false;
//private Dictionary<int, string> PTMemberList;
#region "== Auto Casting bool"
bool[] autoHasteEnabled = new bool[]
{
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false
};
bool[] autoHaste_IIEnabled = new bool[]
{
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false
};
bool[] autoFlurryEnabled = new bool[]
{
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false
};
bool[] autoFlurry_IIEnabled = new bool[]
{
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false
};
bool[] autoPhalanx_IIEnabled = new bool[]
{
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false
};
bool[] autoRegen_IVEnabled = new bool[]
{
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false
};
bool[] autoRegen_VEnabled = new bool[]
{
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false
};
bool[] autoShell_IVEnabled = new bool[]
{
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false
};
bool[] autoShell_VEnabled = new bool[]
{
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false
};
bool[] autoProtect_IVEnabled = new bool[]
{
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false
};
bool[] autoProtect_VEnabled = new bool[]
{
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false
};
bool[] autoRefreshEnabled = new bool[]
{
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false
};
bool[] autoRefresh_IIEnabled = new bool[]
{
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false
};
#endregion
#region "== Auto Casting DateTime"
DateTime currentTime = DateTime.Now;
DateTime[] playerHaste = new DateTime[]
{
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0)
};
DateTime[] playerHaste_II = new DateTime[]
{
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0)
};
DateTime[] playerFlurry = new DateTime[]
{
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0)
};
DateTime[] playerFlurry_II = new DateTime[]
{
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0)
};
DateTime[] playerShell_IV = new DateTime[]
{
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0)
};
DateTime[] playerShell_V = new DateTime[]
{
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0)
};
DateTime[] playerProtect_IV = new DateTime[]
{
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0)
};
DateTime[] playerProtect_V = new DateTime[]
{
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0)
};
DateTime[] playerPhalanx_II = new DateTime[]
{
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0)
};
DateTime[] playerRegen_IV = new DateTime[]
{
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0)
};
DateTime[] playerRegen_V = new DateTime[]
{
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0)
};
DateTime[] playerRefresh = new DateTime[]
{
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0)
};
DateTime[] playerRefresh_II = new DateTime[]
{
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0),
new DateTime(1970, 1, 1, 0, 0, 0)
};
#endregion
#region "== Auto Casting TimeSpan"
TimeSpan[] playerHasteSpan = new TimeSpan[]
{
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan()
};
TimeSpan[] playerHaste_IISpan = new TimeSpan[]
{
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan()
};
TimeSpan[] playerFlurrySpan = new TimeSpan[]
{
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan()
};
TimeSpan[] playerFlurry_IISpan = new TimeSpan[]
{
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan()
};
TimeSpan[] playerShell_IVSpan = new TimeSpan[]
{
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan()
};
TimeSpan[] playerShell_VSpan = new TimeSpan[]
{
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan()
};
TimeSpan[] playerProtect_IVSpan = new TimeSpan[]
{
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan()
};
TimeSpan[] playerProtect_VSpan = new TimeSpan[]
{
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan()
};
TimeSpan[] playerPhalanx_IISpan = new TimeSpan[]
{
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan()
};
TimeSpan[] playerRegen_IVSpan = new TimeSpan[]
{
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan()
};
TimeSpan[] playerRegen_VSpan = new TimeSpan[]
{
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan()
};
TimeSpan[] playerRefreshSpan = new TimeSpan[]
{
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan()
};
TimeSpan[] playerRefresh_IISpan = new TimeSpan[]
{
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan(),
new TimeSpan()
};
#endregion
#region "== Getting POL Process and FFACE dll Check"
//FFXI Process
public Form1()
{
InitializeComponent();
Process[] pol = Process.GetProcessesByName("pol");
if (pol.Length < 1)
{
MessageBox.Show("FFXI not found");
}
else
{
for (int i = 0; i < pol.Length; i++)
{
POLID.Items.Add(pol[i].MainWindowTitle);
POLID2.Items.Add(pol[i].MainWindowTitle);
processids.Items.Add(pol[i].Id);
}
POLID.SelectedIndex = 0;
POLID2.SelectedIndex = 0;
processids.SelectedIndex = 0;
}
}
private void setinstance_Click(object sender, EventArgs e)
{
if (!CheckForDLLFiles())
{
MessageBox.Show(
"Unable to locate FFACE.dll or FFACETools.dll\nMake sure both files are in the same directory as the application",
"Error");
return;
}
processids.SelectedIndex = POLID.SelectedIndex;
_FFACEPL = new FFACE((int)processids.SelectedItem);
plLabel.Text = "Currently selected PL: " + _FFACEPL.Player.Name;
plLabel.ForeColor = Color.Green;
POLID.BackColor = Color.White;
plPosition.Enabled = true;
setinstance2.Enabled = true;
}
private void setinstance2_Click(object sender, EventArgs e)
{
if (!CheckForDLLFiles())
{
MessageBox.Show(
"Unable to locate FFACE.dll or FFACETools.dll\nMake sure both files are in the same directory as the application",
"Error");
return;
}
processids.SelectedIndex = POLID2.SelectedIndex;
_FFACEMonitored = new FFACE((int)processids.SelectedItem);
monitoredLabel.Text = "Currently monitoring: " + _FFACEMonitored.Player.Name;
monitoredLabel.ForeColor = Color.Green;
POLID2.BackColor = Color.White;
partyMembersUpdate.Enabled = true;
actionTimer.Enabled = true;
pauseButton.Enabled = true;
hpUpdates.Enabled = true;
}
private bool CheckForDLLFiles()
{
if (!File.Exists("fface.dll") || !File.Exists("ffacetools.dll"))
{
return false;
}
return true;
}
#endregion
#region "== partyMemberUpdate"
private bool partyMemberUpdateMethod(byte partyMemberId)
{
if (_FFACEMonitored.PartyMember[partyMemberId].Active)
{
if (_FFACEPL.Player.Zone == _FFACEMonitored.PartyMember[partyMemberId].Zone)
return true;
return false;
}
return false;
}
private void partyMembersUpdate_Tick(object sender, EventArgs e)
{
if (_FFACEPL == null || _FFACEMonitored == null)
{
return;
}
if (_FFACEPL.Player.GetLoginStatus == LoginStatus.Loading || _FFACEMonitored.Player.GetLoginStatus == LoginStatus.Loading)
{
// We zoned out so wait 15 seconds before continuing any type of action
Thread.Sleep(15000);
}
if (_FFACEPL.Player.GetLoginStatus != LoginStatus.LoggedIn || _FFACEMonitored.Player.GetLoginStatus != LoginStatus.LoggedIn)
{
return;
}
if (partyMemberUpdateMethod(0))
{
player0.Text = _FFACEMonitored.PartyMember[0].Name;
player0.Enabled = true;
player0optionsButton.Enabled = true;
player0buffsButton.Enabled = true;
}
else
{
player0.Text = "Inactive or out of zone";
player0.Enabled = false;
player0HP.Value = 0;
player0optionsButton.Enabled = false;
player0buffsButton.Enabled = false;
}
if (partyMemberUpdateMethod(1))
{
player1.Text = _FFACEMonitored.PartyMember[1].Name;
player1.Enabled = true;
player1optionsButton.Enabled = true;
player1buffsButton.Enabled = true;
}
else
{
player1.Text = Resources.Form1_partyMembersUpdate_Tick_Inactive;
player1.Enabled = false;
player1HP.Value = 0;
player1optionsButton.Enabled = false;
player1buffsButton.Enabled = false;
}
if (partyMemberUpdateMethod(2))
{
player2.Text = _FFACEMonitored.PartyMember[2].Name;
player2.Enabled = true;
player2optionsButton.Enabled = true;
player2buffsButton.Enabled = true;
}
else
{
player2.Text = Resources.Form1_partyMembersUpdate_Tick_Inactive;
player2.Enabled = false;
player2HP.Value = 0;
player2optionsButton.Enabled = false;
player2buffsButton.Enabled = false;
}
if (partyMemberUpdateMethod(3))
{
player3.Text = _FFACEMonitored.PartyMember[3].Name;
player3.Enabled = true;
player3optionsButton.Enabled = true;
player3buffsButton.Enabled = true;
}
else
{
player3.Text = Resources.Form1_partyMembersUpdate_Tick_Inactive;
player3.Enabled = false;
player3HP.Value = 0;
player3optionsButton.Enabled = false;
player3buffsButton.Enabled = false;
}
if (partyMemberUpdateMethod(4))
{
player4.Text = _FFACEMonitored.PartyMember[4].Name;
player4.Enabled = true;
player4optionsButton.Enabled = true;
player4buffsButton.Enabled = true;
}
else
{
player4.Text = Resources.Form1_partyMembersUpdate_Tick_Inactive;
player4.Enabled = false;
player4HP.Value = 0;
player4optionsButton.Enabled = false;
player4buffsButton.Enabled = false;
}
if (partyMemberUpdateMethod(5))
{
player5.Text = _FFACEMonitored.PartyMember[5].Name;
player5.Enabled = true;
player5optionsButton.Enabled = true;
player5buffsButton.Enabled = true;
}
else
{
player5.Text = Resources.Form1_partyMembersUpdate_Tick_Inactive;
player5.Enabled = false;
player5HP.Value = 0;
player5optionsButton.Enabled = false;
player5buffsButton.Enabled = false;
}
if (partyMemberUpdateMethod(6))
{
player6.Text = _FFACEMonitored.PartyMember[6].Name;
player6.Enabled = true;
player6optionsButton.Enabled = true;
}
else
{
player6.Text = Resources.Form1_partyMembersUpdate_Tick_Inactive;
player6.Enabled = false;
player6HP.Value = 0;
player6optionsButton.Enabled = false;
}
if (partyMemberUpdateMethod(7))
{
player7.Text = _FFACEMonitored.PartyMember[7].Name;
player7.Enabled = true;
player7optionsButton.Enabled = true;
}
else
{
player7.Text = Resources.Form1_partyMembersUpdate_Tick_Inactive;
player7.Enabled = false;
player7HP.Value = 0;
player7optionsButton.Enabled = false;
}
if (partyMemberUpdateMethod(8))
{
player8.Text = _FFACEMonitored.PartyMember[8].Name;
player8.Enabled = true;
player8optionsButton.Enabled = true;
}
else
{
player8.Text = Resources.Form1_partyMembersUpdate_Tick_Inactive;
player8.Enabled = false;
player8HP.Value = 0;
player8optionsButton.Enabled = false;
}
if (partyMemberUpdateMethod(9))
{
player9.Text = _FFACEMonitored.PartyMember[9].Name;
player9.Enabled = true;
player9optionsButton.Enabled = true;
}
else
{
player9.Text = Resources.Form1_partyMembersUpdate_Tick_Inactive;
player9.Enabled = false;
player9HP.Value = 0;
player9optionsButton.Enabled = false;
}
if (partyMemberUpdateMethod(10))
{
player10.Text = _FFACEMonitored.PartyMember[10].Name;
player10.Enabled = true;
player10optionsButton.Enabled = true;
}
else
{
player10.Text = Resources.Form1_partyMembersUpdate_Tick_Inactive;
player10.Enabled = false;
player10HP.Value = 0;
player10optionsButton.Enabled = false;
}
if (partyMemberUpdateMethod(11))
{
player11.Text = _FFACEMonitored.PartyMember[11].Name;
player11.Enabled = true;
player11optionsButton.Enabled = true;
}
else
{
player11.Text = Resources.Form1_partyMembersUpdate_Tick_Inactive;
player11.Enabled = false;
player11HP.Value = 0;
player11optionsButton.Enabled = false;
}
if (partyMemberUpdateMethod(12))
{
player12.Text = _FFACEMonitored.PartyMember[12].Name;
player12.Enabled = true;
player12optionsButton.Enabled = true;
}
else
{
player12.Text = Resources.Form1_partyMembersUpdate_Tick_Inactive;
player12.Enabled = false;
player12HP.Value = 0;
player12optionsButton.Enabled = false;
}
if (partyMemberUpdateMethod(13))
{
player13.Text = _FFACEMonitored.PartyMember[13].Name;
player13.Enabled = true;
player13optionsButton.Enabled = true;
}
else
{
player13.Text = Resources.Form1_partyMembersUpdate_Tick_Inactive;
player13.Enabled = false;
player13HP.Value = 0;
player13optionsButton.Enabled = false;
}
if (partyMemberUpdateMethod(14))
{
player14.Text = _FFACEMonitored.PartyMember[14].Name;
player14.Enabled = true;
player14optionsButton.Enabled = true;
}
else
{
player14.Text = Resources.Form1_partyMembersUpdate_Tick_Inactive;
player14.Enabled = false;
player14HP.Value = 0;
player14optionsButton.Enabled = false;
}
if (partyMemberUpdateMethod(15))
{
player15.Text = _FFACEMonitored.PartyMember[15].Name;
player15.Enabled = true;
player15optionsButton.Enabled = true;
}
else
{
player15.Text = Resources.Form1_partyMembersUpdate_Tick_Inactive;
player15.Enabled = false;
player15HP.Value = 0;
player15optionsButton.Enabled = false;
}
if (partyMemberUpdateMethod(16))
{
player16.Text = _FFACEMonitored.PartyMember[16].Name;
player16.Enabled = true;
player16optionsButton.Enabled = true;
}
else
{
player16.Text = Resources.Form1_partyMembersUpdate_Tick_Inactive;
player16.Enabled = false;
player16HP.Value = 0;
player16optionsButton.Enabled = false;
}
if (partyMemberUpdateMethod(17))
{
player17.Text = _FFACEMonitored.PartyMember[17].Name;
player17.Enabled = true;
player17optionsButton.Enabled = true;
}
else
{
player17.Text = Resources.Form1_partyMembersUpdate_Tick_Inactive;
player17.Enabled = false;
player17HP.Value = 0;
player17optionsButton.Enabled = false;
}
}
#endregion
#region "== hpUpdates"
private void hpUpdates_Tick(object sender, EventArgs e)
{
if (_FFACEPL == null || _FFACEMonitored == null)
{
return;
}
if (_FFACEPL.Player.GetLoginStatus != LoginStatus.LoggedIn || _FFACEMonitored.Player.GetLoginStatus != LoginStatus.LoggedIn)
{
return;
}
if (player0.Enabled) UpdateHPProgressBar(player0HP, _FFACEMonitored.PartyMember[0].HPPCurrent);
if (player0.Enabled) UpdateHPProgressBar(player0HP, _FFACEMonitored.PartyMember[0].HPPCurrent);
if (player1.Enabled) UpdateHPProgressBar(player1HP, _FFACEMonitored.PartyMember[1].HPPCurrent);
if (player2.Enabled) UpdateHPProgressBar(player2HP, _FFACEMonitored.PartyMember[2].HPPCurrent);
if (player3.Enabled) UpdateHPProgressBar(player3HP, _FFACEMonitored.PartyMember[3].HPPCurrent);
if (player4.Enabled) UpdateHPProgressBar(player4HP, _FFACEMonitored.PartyMember[4].HPPCurrent);
if (player5.Enabled) UpdateHPProgressBar(player5HP, _FFACEMonitored.PartyMember[5].HPPCurrent);
if (player6.Enabled) UpdateHPProgressBar(player6HP, _FFACEMonitored.PartyMember[6].HPPCurrent);
if (player7.Enabled) UpdateHPProgressBar(player7HP, _FFACEMonitored.PartyMember[7].HPPCurrent);
if (player8.Enabled) UpdateHPProgressBar(player8HP, _FFACEMonitored.PartyMember[8].HPPCurrent);
if (player9.Enabled) UpdateHPProgressBar(player9HP, _FFACEMonitored.PartyMember[9].HPPCurrent);
if (player10.Enabled) UpdateHPProgressBar(player10HP, _FFACEMonitored.PartyMember[10].HPPCurrent);
if (player11.Enabled) UpdateHPProgressBar(player11HP, _FFACEMonitored.PartyMember[11].HPPCurrent);
if (player12.Enabled) UpdateHPProgressBar(player12HP, _FFACEMonitored.PartyMember[12].HPPCurrent);
if (player13.Enabled) UpdateHPProgressBar(player13HP, _FFACEMonitored.PartyMember[13].HPPCurrent);
if (player14.Enabled) UpdateHPProgressBar(player14HP, _FFACEMonitored.PartyMember[14].HPPCurrent);
if (player15.Enabled) UpdateHPProgressBar(player15HP, _FFACEMonitored.PartyMember[15].HPPCurrent);
if (player16.Enabled) UpdateHPProgressBar(player16HP, _FFACEMonitored.PartyMember[16].HPPCurrent);
if (player17.Enabled) UpdateHPProgressBar(player17HP, _FFACEMonitored.PartyMember[17].HPPCurrent);
label1.Text = _FFACEPL.Item.SelectedItemID.ToString() + ": " + _FFACEPL.Item.SelectedItemName;
}
#endregion
#region "== UpdateHPProgressBar"
private void UpdateHPProgressBar(NewProgressBar playerHP, int hppCurrent)
{
playerHP.Value = hppCurrent;
if (hppCurrent >= 75)
playerHP.ForeColor = Color.Green;
else if (hppCurrent > 50 && hppCurrent < 75)
playerHP.ForeColor = Color.Yellow;
else if (hppCurrent > 25 && hppCurrent < 50)
playerHP.ForeColor = Color.Orange;
else if (hppCurrent < 25)
playerHP.ForeColor = Color.Red;
}
#endregion
#region "== plPosition (Power Levelers Position)"
private void plPosition_Tick(object sender, EventArgs e)
{
if (_FFACEPL == null || _FFACEMonitored == null)
{
return;
}
if (_FFACEPL.Player.GetLoginStatus != LoginStatus.LoggedIn || _FFACEMonitored.Player.GetLoginStatus != LoginStatus.LoggedIn)
{
return;
}
plX = _FFACEPL.Player.PosX;
plY = _FFACEPL.Player.PosY;
plZ = _FFACEPL.Player.PosZ;
}
#endregion
#region "== CastLock"
private void CastLockMethod()
{
castingLock = true;
castingLockLabel.Text = "Casting is LOCKED";
castingLockTimer.Enabled = true;
actionTimer.Enabled = false;
}
#endregion
#region "== ActionLock"
private void ActionLockMethod()
{
castingLock = true;
castingLockLabel.Text = "Casting is LOCKED";
actionUnlockTimer.Enabled = true;
actionTimer.Enabled = false;
}
#endregion
#region "== CureCalculator"
private void CureCalculator(byte partyMemberId)
{
if ((Settings.Default.cure6enabled) && ((((_FFACEMonitored.PartyMember[partyMemberId].HPCurrent * 100) / _FFACEMonitored.PartyMember[partyMemberId].HPPCurrent) - _FFACEMonitored.PartyMember[partyMemberId].HPCurrent) >= Settings.Default.cure6amount) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Cure_VI) == 0) && (_FFACEPL.Player.MPCurrent > 227))
{
_FFACEPL.Windower.SendString("/ma \"Cure VI\" " + _FFACEMonitored.PartyMember[partyMemberId].Name);
CastLockMethod();
}
else if ((Settings.Default.cure5enabled) && ((((_FFACEMonitored.PartyMember[partyMemberId].HPCurrent * 100) / _FFACEMonitored.PartyMember[partyMemberId].HPPCurrent) - _FFACEMonitored.PartyMember[partyMemberId].HPCurrent) >= Settings.Default.cure5amount) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Cure_V) == 0) && (_FFACEPL.Player.MPCurrent > 125))
{
_FFACEPL.Windower.SendString("/ma \"Cure V\" " + _FFACEMonitored.PartyMember[partyMemberId].Name);
CastLockMethod();
}
else if ((Settings.Default.cure4enabled) && ((((_FFACEMonitored.PartyMember[partyMemberId].HPCurrent * 100) / _FFACEMonitored.PartyMember[partyMemberId].HPPCurrent) - _FFACEMonitored.PartyMember[partyMemberId].HPCurrent) >= Settings.Default.cure4amount) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Cure_IV) == 0) && (_FFACEPL.Player.MPCurrent > 88))
{
_FFACEPL.Windower.SendString("/ma \"Cure IV\" " + _FFACEMonitored.PartyMember[partyMemberId].Name);
CastLockMethod();
}
else if ((Settings.Default.cure3enabled) && ((((_FFACEMonitored.PartyMember[partyMemberId].HPCurrent * 100) / _FFACEMonitored.PartyMember[partyMemberId].HPPCurrent) - _FFACEMonitored.PartyMember[partyMemberId].HPCurrent) >= Settings.Default.cure3amount) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Cure_III) == 0) && (_FFACEPL.Player.MPCurrent > 46))
{
_FFACEPL.Windower.SendString("/ma \"Cure III\" " + _FFACEMonitored.PartyMember[partyMemberId].Name);
CastLockMethod();
}
else if ((Settings.Default.cure2enabled) && ((((_FFACEMonitored.PartyMember[partyMemberId].HPCurrent * 100) / _FFACEMonitored.PartyMember[partyMemberId].HPPCurrent) - _FFACEMonitored.PartyMember[partyMemberId].HPCurrent) >= Settings.Default.cure2amount) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Cure_II) == 0) && (_FFACEPL.Player.MPCurrent > 24))
{
_FFACEPL.Windower.SendString("/ma \"Cure II\" " + _FFACEMonitored.PartyMember[partyMemberId].Name);
CastLockMethod();
}
else if ((Settings.Default.cure1enabled) && ((((_FFACEMonitored.PartyMember[partyMemberId].HPCurrent * 100) / _FFACEMonitored.PartyMember[partyMemberId].HPPCurrent) - _FFACEMonitored.PartyMember[partyMemberId].HPCurrent) >= Settings.Default.cure1amount) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Cure) == 0) && (_FFACEPL.Player.MPCurrent > 8))
{
_FFACEPL.Windower.SendString("/ma \"Cure\" " + _FFACEMonitored.PartyMember[partyMemberId].Name);
CastLockMethod();
}
}
#endregion
#region "== CastingPossible (Distance)"
private bool castingPossible(byte partyMemberId)
{
if ((_FFACEPL.NPC.Distance(_FFACEMonitored.PartyMember[partyMemberId].ID) < 21) && (_FFACEPL.NPC.Distance(_FFACEMonitored.PartyMember[partyMemberId].ID) > 0) && (_FFACEMonitored.PartyMember[partyMemberId].HPCurrent > 0) || (_FFACEPL.Player.ID == _FFACEMonitored.PartyMember[partyMemberId].ID) && (_FFACEMonitored.PartyMember[partyMemberId].HPCurrent > 0))
{
return true;
}
return false;
}
#endregion
#region "== PL and Monitored StatusCheck"
private bool plStatusCheck(StatusEffect requestedStatus)
{
bool statusFound = false;
foreach (StatusEffect status in _FFACEPL.Player.StatusEffects)
{
if (requestedStatus == status)
{
statusFound = true;
}
}
return statusFound;
}
private bool monitoredStatusCheck(StatusEffect requestedStatus)
{
bool statusFound = false;
foreach (StatusEffect status in _FFACEMonitored.Player.StatusEffects)
{
if (requestedStatus == status)
{
statusFound = true;
}
}
return statusFound;
}
#endregion
#region "== partyMember Spell Casting (Auto Spells)
private void castSpell(string partyMemberName, string spellName)
{
CastLockMethod();
_FFACEPL.Windower.SendString("/ma \"" + spellName + "\" " + partyMemberName);
}
private void hastePlayer(byte partyMemberId)
{
CastLockMethod();
_FFACEPL.Windower.SendString("/ma \"Haste\" " + _FFACEMonitored.PartyMember[partyMemberId].Name);
playerHaste[partyMemberId] = DateTime.Now;
}
private void haste_IIPlayer(byte partyMemberId)
{
CastLockMethod();
_FFACEPL.Windower.SendString("/ma \"Haste II\" " + _FFACEMonitored.PartyMember[partyMemberId].Name);
playerHaste_II[partyMemberId] = DateTime.Now;
}
private void FlurryPlayer(byte partyMemberId)
{
CastLockMethod();
_FFACEPL.Windower.SendString("/ma \"Flurry\" " + _FFACEMonitored.PartyMember[partyMemberId].Name);
playerFlurry[partyMemberId] = DateTime.Now;
}
private void Flurry_IIPlayer(byte partyMemberId)
{
CastLockMethod();
_FFACEPL.Windower.SendString("/ma \"Flurry II\" " + _FFACEMonitored.PartyMember[partyMemberId].Name);
playerFlurry_II[partyMemberId] = DateTime.Now;
}
private void Phalanx_IIPlayer(byte partyMemberId)
{
CastLockMethod();
_FFACEPL.Windower.SendString("/ma \"Phalanx II\" " + _FFACEMonitored.PartyMember[partyMemberId].Name);
playerPhalanx_II[partyMemberId] = DateTime.Now;
}
private void Regen_IVPlayer(byte partyMemberId)
{
CastLockMethod();
_FFACEPL.Windower.SendString("/ma \"Regen IV\" " + _FFACEMonitored.PartyMember[partyMemberId].Name);
playerRegen_IV[partyMemberId] = DateTime.Now;
}
private void Regen_VPlayer(byte partyMemberId)
{
CastLockMethod();
_FFACEPL.Windower.SendString("/ma \"Regen V\" " + _FFACEMonitored.PartyMember[partyMemberId].Name);
playerRegen_V[partyMemberId] = DateTime.Now;
}
private void RefreshPlayer(byte partyMemberId)
{
CastLockMethod();
_FFACEPL.Windower.SendString("/ma \"Refresh\" " + _FFACEMonitored.PartyMember[partyMemberId].Name);
playerRefresh[partyMemberId] = DateTime.Now;
}
private void Refresh_IIPlayer(byte partyMemberId)
{
CastLockMethod();
_FFACEPL.Windower.SendString("/ma \"Refresh II\" " + _FFACEMonitored.PartyMember[partyMemberId].Name);
playerRefresh_II[partyMemberId] = DateTime.Now;
}
private void protect_IVPlayer(byte partyMemberId)
{
CastLockMethod();
_FFACEPL.Windower.SendString("/ma \"Protect IV\" " + _FFACEMonitored.PartyMember[partyMemberId].Name);
playerProtect_IV[partyMemberId] = DateTime.Now;
}
private void protect_VPlayer(byte partyMemberId)
{
CastLockMethod();
_FFACEPL.Windower.SendString("/ma \"Protect V\" " + _FFACEMonitored.PartyMember[partyMemberId].Name);
playerProtect_V[partyMemberId] = DateTime.Now;
}
private void shell_IVPlayer(byte partyMemberId)
{
CastLockMethod();
_FFACEPL.Windower.SendString("/ma \"Shell IV\" " + _FFACEMonitored.PartyMember[partyMemberId].Name);
playerShell_IV[partyMemberId] = DateTime.Now;
}
private void shell_VPlayer(byte partyMemberId)
{
CastLockMethod();
_FFACEPL.Windower.SendString("/ma \"Shell V\" " + _FFACEMonitored.PartyMember[partyMemberId].Name);
playerShell_V[partyMemberId] = DateTime.Now;
}
#endregion
#region "== actionTimer (LoginStatus)"
private void actionTimer_Tick(object sender, EventArgs e)
{
if (_FFACEPL == null || _FFACEMonitored == null)
{
return;
}
if (_FFACEPL.Player.GetLoginStatus != LoginStatus.LoggedIn || _FFACEMonitored.Player.GetLoginStatus != LoginStatus.LoggedIn)
{
return;
}
if (_FFACEPL.Player.GetLoginStatus == LoginStatus.Loading || _FFACEMonitored.Player.GetLoginStatus == LoginStatus.Loading)
{
// We zoned out so wait 15 seconds before continuing any type of action
Thread.Sleep(15000);
}
#endregion
// Grab current time for calculations below
#region "== Calculate time since an Auto Spell was cast on particular player"
currentTime = DateTime.Now;
// Calculate time since haste was cast on particular player
playerHasteSpan[0] = currentTime.Subtract(playerHaste[0]);
playerHasteSpan[1] = currentTime.Subtract(playerHaste[1]);
playerHasteSpan[2] = currentTime.Subtract(playerHaste[2]);
playerHasteSpan[3] = currentTime.Subtract(playerHaste[3]);
playerHasteSpan[4] = currentTime.Subtract(playerHaste[4]);
playerHasteSpan[5] = currentTime.Subtract(playerHaste[5]);
playerHasteSpan[6] = currentTime.Subtract(playerHaste[6]);
playerHasteSpan[7] = currentTime.Subtract(playerHaste[7]);
playerHasteSpan[8] = currentTime.Subtract(playerHaste[8]);
playerHasteSpan[9] = currentTime.Subtract(playerHaste[9]);
playerHasteSpan[10] = currentTime.Subtract(playerHaste[10]);
playerHasteSpan[11] = currentTime.Subtract(playerHaste[11]);
playerHasteSpan[12] = currentTime.Subtract(playerHaste[12]);
playerHasteSpan[13] = currentTime.Subtract(playerHaste[13]);
playerHasteSpan[14] = currentTime.Subtract(playerHaste[14]);
playerHasteSpan[15] = currentTime.Subtract(playerHaste[15]);
playerHasteSpan[16] = currentTime.Subtract(playerHaste[16]);
playerHasteSpan[17] = currentTime.Subtract(playerHaste[17]);
playerHaste_IISpan[0] = currentTime.Subtract(playerHaste_II[0]);
playerHaste_IISpan[1] = currentTime.Subtract(playerHaste_II[1]);
playerHaste_IISpan[2] = currentTime.Subtract(playerHaste_II[2]);
playerHaste_IISpan[3] = currentTime.Subtract(playerHaste_II[3]);
playerHaste_IISpan[4] = currentTime.Subtract(playerHaste_II[4]);
playerHaste_IISpan[5] = currentTime.Subtract(playerHaste_II[5]);
playerHaste_IISpan[6] = currentTime.Subtract(playerHaste_II[6]);
playerHaste_IISpan[7] = currentTime.Subtract(playerHaste_II[7]);
playerHaste_IISpan[8] = currentTime.Subtract(playerHaste_II[8]);
playerHaste_IISpan[9] = currentTime.Subtract(playerHaste_II[9]);
playerHaste_IISpan[10] = currentTime.Subtract(playerHaste_II[10]);
playerHaste_IISpan[11] = currentTime.Subtract(playerHaste_II[11]);
playerHaste_IISpan[12] = currentTime.Subtract(playerHaste_II[12]);
playerHaste_IISpan[13] = currentTime.Subtract(playerHaste_II[13]);
playerHaste_IISpan[14] = currentTime.Subtract(playerHaste_II[14]);
playerHaste_IISpan[15] = currentTime.Subtract(playerHaste_II[15]);
playerHaste_IISpan[16] = currentTime.Subtract(playerHaste_II[16]);
playerHaste_IISpan[17] = currentTime.Subtract(playerHaste_II[17]);
playerFlurrySpan[0] = currentTime.Subtract(playerFlurry[0]);
playerFlurrySpan[1] = currentTime.Subtract(playerFlurry[1]);
playerFlurrySpan[2] = currentTime.Subtract(playerFlurry[2]);
playerFlurrySpan[3] = currentTime.Subtract(playerFlurry[3]);
playerFlurrySpan[4] = currentTime.Subtract(playerFlurry[4]);
playerFlurrySpan[5] = currentTime.Subtract(playerFlurry[5]);
playerFlurrySpan[6] = currentTime.Subtract(playerFlurry[6]);
playerFlurrySpan[7] = currentTime.Subtract(playerFlurry[7]);
playerFlurrySpan[8] = currentTime.Subtract(playerFlurry[8]);
playerFlurrySpan[9] = currentTime.Subtract(playerFlurry[9]);
playerFlurrySpan[10] = currentTime.Subtract(playerFlurry[10]);
playerFlurrySpan[11] = currentTime.Subtract(playerFlurry[11]);
playerFlurrySpan[12] = currentTime.Subtract(playerFlurry[12]);
playerFlurrySpan[13] = currentTime.Subtract(playerFlurry[13]);
playerFlurrySpan[14] = currentTime.Subtract(playerFlurry[14]);
playerFlurrySpan[15] = currentTime.Subtract(playerFlurry[15]);
playerFlurrySpan[16] = currentTime.Subtract(playerFlurry[16]);
playerFlurrySpan[17] = currentTime.Subtract(playerFlurry[17]);
playerFlurry_IISpan[0] = currentTime.Subtract(playerFlurry_II[0]);
playerFlurry_IISpan[1] = currentTime.Subtract(playerFlurry_II[1]);
playerFlurry_IISpan[2] = currentTime.Subtract(playerFlurry_II[2]);
playerFlurry_IISpan[3] = currentTime.Subtract(playerFlurry_II[3]);
playerFlurry_IISpan[4] = currentTime.Subtract(playerFlurry_II[4]);
playerFlurry_IISpan[5] = currentTime.Subtract(playerFlurry_II[5]);
playerFlurry_IISpan[6] = currentTime.Subtract(playerFlurry_II[6]);
playerFlurry_IISpan[7] = currentTime.Subtract(playerFlurry_II[7]);
playerFlurry_IISpan[8] = currentTime.Subtract(playerFlurry_II[8]);
playerFlurry_IISpan[9] = currentTime.Subtract(playerFlurry_II[9]);
playerFlurry_IISpan[10] = currentTime.Subtract(playerFlurry_II[10]);
playerFlurry_IISpan[11] = currentTime.Subtract(playerFlurry_II[11]);
playerFlurry_IISpan[12] = currentTime.Subtract(playerFlurry_II[12]);
playerFlurry_IISpan[13] = currentTime.Subtract(playerFlurry_II[13]);
playerFlurry_IISpan[14] = currentTime.Subtract(playerFlurry_II[14]);
playerFlurry_IISpan[15] = currentTime.Subtract(playerFlurry_II[15]);
playerFlurry_IISpan[16] = currentTime.Subtract(playerFlurry_II[16]);
playerFlurry_IISpan[17] = currentTime.Subtract(playerFlurry_II[17]);
// Calculate time since protect IV was cast on particular player
playerProtect_IVSpan[0] = currentTime.Subtract(playerProtect_IV[0]);
playerProtect_IVSpan[1] = currentTime.Subtract(playerProtect_IV[1]);
playerProtect_IVSpan[2] = currentTime.Subtract(playerProtect_IV[2]);
playerProtect_IVSpan[3] = currentTime.Subtract(playerProtect_IV[3]);
playerProtect_IVSpan[4] = currentTime.Subtract(playerProtect_IV[4]);
playerProtect_IVSpan[5] = currentTime.Subtract(playerProtect_IV[5]);
playerProtect_IVSpan[6] = currentTime.Subtract(playerProtect_IV[6]);
playerProtect_IVSpan[7] = currentTime.Subtract(playerProtect_IV[7]);
playerProtect_IVSpan[8] = currentTime.Subtract(playerProtect_IV[8]);
playerProtect_IVSpan[9] = currentTime.Subtract(playerProtect_IV[9]);
playerProtect_IVSpan[10] = currentTime.Subtract(playerProtect_IV[10]);
playerProtect_IVSpan[11] = currentTime.Subtract(playerProtect_IV[11]);
playerProtect_IVSpan[12] = currentTime.Subtract(playerProtect_IV[12]);
playerProtect_IVSpan[13] = currentTime.Subtract(playerProtect_IV[13]);
playerProtect_IVSpan[14] = currentTime.Subtract(playerProtect_IV[14]);
playerProtect_IVSpan[15] = currentTime.Subtract(playerProtect_IV[15]);
playerProtect_IVSpan[16] = currentTime.Subtract(playerProtect_IV[16]);
playerProtect_IVSpan[17] = currentTime.Subtract(playerProtect_IV[17]);
// Calculate time since protect V was cast on particular player
playerProtect_VSpan[0] = currentTime.Subtract(playerProtect_V[0]);
playerProtect_VSpan[1] = currentTime.Subtract(playerProtect_V[1]);
playerProtect_VSpan[2] = currentTime.Subtract(playerProtect_V[2]);
playerProtect_VSpan[3] = currentTime.Subtract(playerProtect_V[3]);
playerProtect_VSpan[4] = currentTime.Subtract(playerProtect_V[4]);
playerProtect_VSpan[5] = currentTime.Subtract(playerProtect_V[5]);
playerProtect_VSpan[6] = currentTime.Subtract(playerProtect_V[6]);
playerProtect_VSpan[7] = currentTime.Subtract(playerProtect_V[7]);
playerProtect_VSpan[8] = currentTime.Subtract(playerProtect_V[8]);
playerProtect_VSpan[9] = currentTime.Subtract(playerProtect_V[9]);
playerProtect_VSpan[10] = currentTime.Subtract(playerProtect_V[10]);
playerProtect_VSpan[11] = currentTime.Subtract(playerProtect_V[11]);
playerProtect_VSpan[12] = currentTime.Subtract(playerProtect_V[12]);
playerProtect_VSpan[13] = currentTime.Subtract(playerProtect_V[13]);
playerProtect_VSpan[14] = currentTime.Subtract(playerProtect_V[14]);
playerProtect_VSpan[15] = currentTime.Subtract(playerProtect_V[15]);
playerProtect_VSpan[16] = currentTime.Subtract(playerProtect_V[16]);
playerProtect_VSpan[17] = currentTime.Subtract(playerProtect_V[17]);
// Calculate time since shell IV was cast on particular player
playerShell_IVSpan[0] = currentTime.Subtract(playerShell_IV[0]);
playerShell_IVSpan[1] = currentTime.Subtract(playerShell_IV[1]);
playerShell_IVSpan[2] = currentTime.Subtract(playerShell_IV[2]);
playerShell_IVSpan[3] = currentTime.Subtract(playerShell_IV[3]);
playerShell_IVSpan[4] = currentTime.Subtract(playerShell_IV[4]);
playerShell_IVSpan[5] = currentTime.Subtract(playerShell_IV[5]);
playerShell_IVSpan[6] = currentTime.Subtract(playerShell_IV[6]);
playerShell_IVSpan[7] = currentTime.Subtract(playerShell_IV[7]);
playerShell_IVSpan[8] = currentTime.Subtract(playerShell_IV[8]);
playerShell_IVSpan[9] = currentTime.Subtract(playerShell_IV[9]);
playerShell_IVSpan[10] = currentTime.Subtract(playerShell_IV[10]);
playerShell_IVSpan[11] = currentTime.Subtract(playerShell_IV[11]);
playerShell_IVSpan[12] = currentTime.Subtract(playerShell_IV[12]);
playerShell_IVSpan[13] = currentTime.Subtract(playerShell_IV[13]);
playerShell_IVSpan[14] = currentTime.Subtract(playerShell_IV[14]);
playerShell_IVSpan[15] = currentTime.Subtract(playerShell_IV[15]);
playerShell_IVSpan[16] = currentTime.Subtract(playerShell_IV[16]);
playerShell_IVSpan[17] = currentTime.Subtract(playerShell_IV[17]);
// Calculate time since shell V was cast on particular player
playerShell_VSpan[0] = currentTime.Subtract(playerShell_V[0]);
playerShell_VSpan[1] = currentTime.Subtract(playerShell_V[1]);
playerShell_VSpan[2] = currentTime.Subtract(playerShell_V[2]);
playerShell_VSpan[3] = currentTime.Subtract(playerShell_V[3]);
playerShell_VSpan[4] = currentTime.Subtract(playerShell_V[4]);
playerShell_VSpan[5] = currentTime.Subtract(playerShell_V[5]);
playerShell_VSpan[6] = currentTime.Subtract(playerShell_V[6]);
playerShell_VSpan[7] = currentTime.Subtract(playerShell_V[7]);
playerShell_VSpan[8] = currentTime.Subtract(playerShell_V[8]);
playerShell_VSpan[9] = currentTime.Subtract(playerShell_V[9]);
playerShell_VSpan[10] = currentTime.Subtract(playerShell_V[10]);
playerShell_VSpan[11] = currentTime.Subtract(playerShell_V[11]);
playerShell_VSpan[12] = currentTime.Subtract(playerShell_V[12]);
playerShell_VSpan[13] = currentTime.Subtract(playerShell_V[13]);
playerShell_VSpan[14] = currentTime.Subtract(playerShell_V[14]);
playerShell_VSpan[15] = currentTime.Subtract(playerShell_V[15]);
playerShell_VSpan[16] = currentTime.Subtract(playerShell_V[16]);
playerShell_VSpan[17] = currentTime.Subtract(playerShell_V[17]);
// Calculate time since phalanx II was cast on particular player
playerPhalanx_IISpan[0] = currentTime.Subtract(playerPhalanx_II[0]);
playerPhalanx_IISpan[1] = currentTime.Subtract(playerPhalanx_II[1]);
playerPhalanx_IISpan[2] = currentTime.Subtract(playerPhalanx_II[2]);
playerPhalanx_IISpan[3] = currentTime.Subtract(playerPhalanx_II[3]);
playerPhalanx_IISpan[4] = currentTime.Subtract(playerPhalanx_II[4]);
playerPhalanx_IISpan[5] = currentTime.Subtract(playerPhalanx_II[5]);
// Calculate time since regen IV was cast on particular player
playerRegen_IVSpan[0] = currentTime.Subtract(playerRegen_IV[0]);
playerRegen_IVSpan[1] = currentTime.Subtract(playerRegen_IV[1]);
playerRegen_IVSpan[2] = currentTime.Subtract(playerRegen_IV[2]);
playerRegen_IVSpan[3] = currentTime.Subtract(playerRegen_IV[3]);
playerRegen_IVSpan[4] = currentTime.Subtract(playerRegen_IV[4]);
playerRegen_IVSpan[5] = currentTime.Subtract(playerRegen_IV[5]);
// Calculate time since regen V was cast on particular player
playerRegen_VSpan[0] = currentTime.Subtract(playerRegen_V[0]);
playerRegen_VSpan[1] = currentTime.Subtract(playerRegen_V[1]);
playerRegen_VSpan[2] = currentTime.Subtract(playerRegen_V[2]);
playerRegen_VSpan[3] = currentTime.Subtract(playerRegen_V[3]);
playerRegen_VSpan[4] = currentTime.Subtract(playerRegen_V[4]);
playerRegen_VSpan[5] = currentTime.Subtract(playerRegen_V[5]);
// Calculate time since Refresh was cast on particular player
playerRefreshSpan[0] = currentTime.Subtract(playerRefresh[0]);
playerRefreshSpan[1] = currentTime.Subtract(playerRefresh[1]);
playerRefreshSpan[2] = currentTime.Subtract(playerRefresh[2]);
playerRefreshSpan[3] = currentTime.Subtract(playerRefresh[3]);
playerRefreshSpan[4] = currentTime.Subtract(playerRefresh[4]);
playerRefreshSpan[5] = currentTime.Subtract(playerRefresh[5]);
// Calculate time since Refresh II was cast on particular player
playerRefresh_IISpan[0] = currentTime.Subtract(playerRefresh_II[0]);
playerRefresh_IISpan[1] = currentTime.Subtract(playerRefresh_II[1]);
playerRefresh_IISpan[2] = currentTime.Subtract(playerRefresh_II[2]);
playerRefresh_IISpan[3] = currentTime.Subtract(playerRefresh_II[3]);
playerRefresh_IISpan[4] = currentTime.Subtract(playerRefresh_II[4]);
playerRefresh_IISpan[5] = currentTime.Subtract(playerRefresh_II[5]);
#endregion
#region "== Set array values for GUI (Enabled) Checkboxes"
// Set array values for GUI "Enabled" checkboxes
CheckBox[] enabledBoxes = new CheckBox[18];
enabledBoxes[0] = player0enabled;
enabledBoxes[1] = player1enabled;
enabledBoxes[2] = player2enabled;
enabledBoxes[3] = player3enabled;
enabledBoxes[4] = player4enabled;
enabledBoxes[5] = player5enabled;
enabledBoxes[6] = player6enabled;
enabledBoxes[7] = player7enabled;
enabledBoxes[8] = player8enabled;
enabledBoxes[9] = player9enabled;
enabledBoxes[10] = player10enabled;
enabledBoxes[11] = player11enabled;
enabledBoxes[12] = player12enabled;
enabledBoxes[13] = player13enabled;
enabledBoxes[14] = player14enabled;
enabledBoxes[15] = player15enabled;
enabledBoxes[16] = player16enabled;
enabledBoxes[17] = player17enabled;
#endregion
#region "== Set array values for GUI (High Priority) Checkboxes"
// Set array values for GUI "High Priority" checkboxes
CheckBox[] highPriorityBoxes = new CheckBox[18];
highPriorityBoxes[0] = player0priority;
highPriorityBoxes[1] = player1priority;
highPriorityBoxes[2] = player2priority;
highPriorityBoxes[3] = player3priority;
highPriorityBoxes[4] = player4priority;
highPriorityBoxes[5] = player5priority;
highPriorityBoxes[6] = player6priority;
highPriorityBoxes[7] = player7priority;
highPriorityBoxes[8] = player8priority;
highPriorityBoxes[9] = player9priority;
highPriorityBoxes[10] = player10priority;
highPriorityBoxes[11] = player11priority;
highPriorityBoxes[12] = player12priority;
highPriorityBoxes[13] = player13priority;
highPriorityBoxes[14] = player14priority;
highPriorityBoxes[15] = player15priority;
highPriorityBoxes[16] = player16priority;
highPriorityBoxes[17] = player17priority;
#endregion
#region "== Job ability Divine Seal and Convert"
if (Settings.Default.divineSealBox
&& _FFACEPL.Player.MPPCurrent <= 11 //
&& _FFACEPL.Timer.GetAbilityRecast(AbilityList.Divine_Seal) == 0
&& !_FFACEPL.Player.StatusEffects.Contains(StatusEffect.Weakness))
{
Thread.Sleep(3000);
_FFACEPL.Windower.SendString("/ja \"Divine Seal\" <me>");
ActionLockMethod();
}
else if (Settings.Default.Convert
&& _FFACEPL.Player.MPPCurrent <= 10 //
&& _FFACEPL.Timer.GetAbilityRecast(AbilityList.Convert) == 0
&& !_FFACEPL.Player.StatusEffects.Contains(StatusEffect.Weakness))
{
Thread.Sleep(1000);
_FFACEPL.Windower.SendString("/ja \"Convert\" <me>");
return;
//ActionLockMethod();
}
#endregion
#region "== Low MP Tell / MP OK Tell"
if (_FFACEPL.Player.MPCurrent <= (int)Settings.Default.mpMinCastValue && _FFACEPL.Player.MPCurrent != 0)
{
if (Settings.Default.lowMPcheckBox && !islowmp)
{
_FFACEPL.Windower.SendString("/tell " + _FFACEMonitored.Player.Name + " MP is low!");
islowmp = true;
return;
}
islowmp = true;
return;
}
if (_FFACEPL.Player.MPCurrent > (int)Settings.Default.mpMinCastValue && _FFACEPL.Player.MPCurrent != 0)
{
if (Settings.Default.lowMPcheckBox && islowmp)
{
_FFACEPL.Windower.SendString("/tell " + _FFACEMonitored.Player.Name + " MP OK!");
islowmp = false;
}
}
#endregion
#region "== PL stationary for Cures (Casting Possible)"
// Only perform actions if PL is stationary
if ((_FFACEPL.Player.PosX == plX) && (_FFACEPL.Player.PosY == plY) && (_FFACEPL.Player.PosZ == plZ) && (_FFACEPL.Player.GetLoginStatus == LoginStatus.LoggedIn) && (!pauseActions) && ((_FFACEPL.Player.Status == Status.Standing) || (_FFACEPL.Player.Status == Status.Fighting)))
{
var playerHpOrder = _FFACEMonitored.PartyMember.Keys.OrderBy(k => _FFACEMonitored.PartyMember[k].HPPCurrent);
// Loop through keys in order of lowest HP to highest HP
foreach (byte id in playerHpOrder)
{
// Cures
// First, is casting possible, and enabled?
if (castingPossible(id) && (_FFACEMonitored.PartyMember[id].Active) && (enabledBoxes[id].Checked) && (_FFACEMonitored.PartyMember[id].HPCurrent > 0) && (!castingLock))
{
if ((highPriorityBoxes[id].Checked) && (_FFACEMonitored.PartyMember[id].HPPCurrent <= Settings.Default.priorityCurePercentage))
{
CureCalculator(id);
break;
}
if ((_FFACEMonitored.PartyMember[id].HPPCurrent <= Settings.Default.curePercentage) && (castingPossible(id)))
{
CureCalculator(id);
break;
}
}
}
#endregion
#region "== PL Debuff Removal with Spells or Items"
// PL and Monitored Player Debuff Removal
// Starting with PL
foreach (StatusEffect plEffect in _FFACEPL.Player.StatusEffects)
{
if ((plEffect == StatusEffect.Silence) && (Settings.Default.plSilenceItemEnabled))
{
// Check to make sure we have echo drops
if (_FFACEPL.Item.GetInventoryItemCount((ushort)FFACE.ParseResources.GetItemId(Settings.Default.plSilenceItemString)) > 0 || _FFACEPL.Item.GetTempItemCount((ushort)FFACE.ParseResources.GetItemId(Settings.Default.plSilenceItemString)) > 0)
{
_FFACEPL.Windower.SendString(string.Format("/item \"{0}\" <me>", Settings.Default.plSilenceItemString));
Thread.Sleep(2000);
}
}
if ((plEffect == StatusEffect.Doom && Settings.Default.plDoomEnabled) /* Add more options from UI HERE*/)
{
// Check to make sure we have holy water
if (_FFACEPL.Item.GetInventoryItemCount((ushort)FFACE.ParseResources.GetItemId(Settings.Default.PLDoomitem)) > 0 || _FFACEPL.Item.GetTempItemCount((ushort)FFACE.ParseResources.GetItemId(Settings.Default.PLDoomitem)) > 0)
{
_FFACEPL.Windower.SendString(string.Format("/item \"{0}\" <me>", Settings.Default.PLDoomitem));
Thread.Sleep(2000);
}
}
else if ((plEffect == StatusEffect.Doom) && (Settings.Default.plDoom) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Cursna) == 0)) { castSpell(_FFACEPL.Player.Name, "Cursna"); }
else if ((plEffect == StatusEffect.Paralysis) && (Settings.Default.plParalysis) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Paralyna) == 0)) { castSpell(_FFACEPL.Player.Name, "Paralyna"); }
else if ((plEffect == StatusEffect.Poison) && (Settings.Default.plPoison) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Poisona) == 0)) { castSpell(_FFACEPL.Player.Name, "Poisona"); }
else if ((plEffect == StatusEffect.Attack_Down) && (Settings.Default.plAttackDown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEPL.Player.Name, "Erase"); }
else if ((plEffect == StatusEffect.Blindness) && (Settings.Default.plBlindness) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Blindna) == 0)) { castSpell(_FFACEPL.Player.Name, "Blindna"); }
else if ((plEffect == StatusEffect.Bind) && (Settings.Default.plBind) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEPL.Player.Name, "Erase"); }
else if ((plEffect == StatusEffect.Weight) && (Settings.Default.plWeight) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEPL.Player.Name, "Erase"); }
else if ((plEffect == StatusEffect.Slow) && (Settings.Default.plSlow) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEPL.Player.Name, "Erase"); }
else if ((plEffect == StatusEffect.Curse) && (Settings.Default.plCurse) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Cursna) == 0)) { castSpell(_FFACEPL.Player.Name, "Cursna"); }
else if ((plEffect == StatusEffect.Curse2) && (Settings.Default.plCurse2) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Cursna) == 0)) { castSpell(_FFACEPL.Player.Name, "Cursna"); }
else if ((plEffect == StatusEffect.Addle) && (Settings.Default.plAddle) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEPL.Player.Name, "Erase"); }
else if ((plEffect == StatusEffect.Bane) && (Settings.Default.plBane) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Cursna) == 0)) { castSpell(_FFACEPL.Player.Name, "Cursna"); }
else if ((plEffect == StatusEffect.Plague) && (Settings.Default.plPlague) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Viruna) == 0)) { castSpell(_FFACEPL.Player.Name, "Viruna"); }
else if ((plEffect == StatusEffect.Disease) && (Settings.Default.plDisease) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Viruna) == 0)) { castSpell(_FFACEPL.Player.Name, "Viruna"); }
else if ((plEffect == StatusEffect.Burn) && (Settings.Default.plBurn) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEPL.Player.Name, "Erase"); }
else if ((plEffect == StatusEffect.Frost) && (Settings.Default.plFrost) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEPL.Player.Name, "Erase"); }
else if ((plEffect == StatusEffect.Choke) && (Settings.Default.plChoke) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEPL.Player.Name, "Erase"); }
else if ((plEffect == StatusEffect.Rasp) && (Settings.Default.plRasp) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEPL.Player.Name, "Erase"); }
else if ((plEffect == StatusEffect.Shock) && (Settings.Default.plShock) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEPL.Player.Name, "Erase"); }
else if ((plEffect == StatusEffect.Drown) && (Settings.Default.plDrown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEPL.Player.Name, "Erase"); }
else if ((plEffect == StatusEffect.Dia) && (Settings.Default.plDia) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEPL.Player.Name, "Erase"); }
else if ((plEffect == StatusEffect.Bio) && (Settings.Default.plBio) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEPL.Player.Name, "Erase"); }
else if ((plEffect == StatusEffect.STR_Down) && (Settings.Default.plStrDown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEPL.Player.Name, "Erase"); }
else if ((plEffect == StatusEffect.DEX_Down) && (Settings.Default.plDexDown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEPL.Player.Name, "Erase"); }
else if ((plEffect == StatusEffect.VIT_Down) && (Settings.Default.plVitDown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEPL.Player.Name, "Erase"); }
else if ((plEffect == StatusEffect.AGI_Down) && (Settings.Default.plAgiDown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEPL.Player.Name, "Erase"); }
else if ((plEffect == StatusEffect.INT_Down) && (Settings.Default.plIntDown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEPL.Player.Name, "Erase"); }
else if ((plEffect == StatusEffect.MND_Down) && (Settings.Default.plMndDown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEPL.Player.Name, "Erase"); }
else if ((plEffect == StatusEffect.CHR_Down) && (Settings.Default.plChrDown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEPL.Player.Name, "Erase"); }
else if ((plEffect == StatusEffect.Max_HP_Down) && (Settings.Default.plMaxHpDown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEPL.Player.Name, "Erase"); }
else if ((plEffect == StatusEffect.Max_MP_Down) && (Settings.Default.plMaxMpDown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEPL.Player.Name, "Erase"); }
else if ((plEffect == StatusEffect.Accuracy_Down) && (Settings.Default.plAccuracyDown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEPL.Player.Name, "Erase"); }
else if ((plEffect == StatusEffect.Evasion_Down) && (Settings.Default.plEvasionDown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEPL.Player.Name, "Erase"); }
else if ((plEffect == StatusEffect.Defense_Down) && (Settings.Default.plDefenseDown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEPL.Player.Name, "Erase"); }
else if ((plEffect == StatusEffect.Flash) && (Settings.Default.plFlash) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEPL.Player.Name, "Erase"); }
else if ((plEffect == StatusEffect.Magic_Acc_Down) && (Settings.Default.plMagicAccDown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEPL.Player.Name, "Erase"); }
else if ((plEffect == StatusEffect.Magic_Atk_Down) && (Settings.Default.plMagicAtkDown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEPL.Player.Name, "Erase"); }
else if ((plEffect == StatusEffect.Helix) && (Settings.Default.plHelix) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEPL.Player.Name, "Erase"); }
else if ((plEffect == StatusEffect.Max_TP_Down) && (Settings.Default.plMaxTpDown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEPL.Player.Name, "Erase"); }
else if ((plEffect == StatusEffect.Requiem) && (Settings.Default.plRequiem) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEPL.Player.Name, "Erase"); }
else if ((plEffect == StatusEffect.Elegy) && (Settings.Default.plElegy) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEPL.Player.Name, "Erase"); }
else if ((plEffect == StatusEffect.Threnody) && (Settings.Default.plThrenody) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEPL.Player.Name, "Erase"); }
}
#endregion
#region "== Monitored Player Debuff Removal"
// Next, we check monitored player
if ((_FFACEPL.NPC.Distance(_FFACEMonitored.Player.ID) < 21) && (_FFACEPL.NPC.Distance(_FFACEMonitored.Player.ID) > 0) && (_FFACEMonitored.Player.HPCurrent > 0))
{
foreach (StatusEffect monitoredEffect in _FFACEMonitored.Player.StatusEffects)
{
if ((monitoredEffect == StatusEffect.Doom) && (Settings.Default.monitoredDoom) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Cursna) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Cursna"); }
else if ((monitoredEffect == StatusEffect.Sleep) && (Settings.Default.monitoredSleep) && (Settings.Default.wakeSleepEnabled)) { castSpell(_FFACEMonitored.Player.Name, Settings.Default.wakeSleepSpellString); }
else if ((monitoredEffect == StatusEffect.Sleep2) && (Settings.Default.monitoredSleep2) && (Settings.Default.wakeSleepEnabled)) { castSpell(_FFACEMonitored.Player.Name, Settings.Default.wakeSleepSpellString); }
else if ((monitoredEffect == StatusEffect.Silence) && (Settings.Default.monitoredSilence) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Silena) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Silena"); }
else if ((monitoredEffect == StatusEffect.Petrification) && (Settings.Default.monitoredPetrification) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Stona) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Stona"); }
else if ((monitoredEffect == StatusEffect.Paralysis) && (Settings.Default.monitoredParalysis) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Paralyna) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Paralyna"); }
else if ((monitoredEffect == StatusEffect.Poison) && (Settings.Default.monitoredPoison) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Poisona) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Poisona"); }
else if ((monitoredEffect == StatusEffect.Attack_Down) && (Settings.Default.monitoredAttackDown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Erase"); }
else if ((monitoredEffect == StatusEffect.Blindness) && (Settings.Default.monitoredBlindness && (_FFACEPL.Timer.GetSpellRecast(SpellList.Blindna) == 0))) { castSpell(_FFACEMonitored.Player.Name, "Blindna"); }
else if ((monitoredEffect == StatusEffect.Bind) && (Settings.Default.monitoredBind) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Erase"); }
else if ((monitoredEffect == StatusEffect.Weight) && (Settings.Default.monitoredWeight) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Erase"); }
else if ((monitoredEffect == StatusEffect.Slow) && (Settings.Default.monitoredSlow) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Erase"); }
else if ((monitoredEffect == StatusEffect.Curse) && (Settings.Default.monitoredCurse) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Cursna) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Cursna"); }
else if ((monitoredEffect == StatusEffect.Curse2) && (Settings.Default.monitoredCurse2) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Cursna) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Cursna"); }
else if ((monitoredEffect == StatusEffect.Addle) && (Settings.Default.monitoredAddle) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Erase"); }
else if ((monitoredEffect == StatusEffect.Bane) && (Settings.Default.monitoredBane) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Cursna) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Cursna"); }
else if ((monitoredEffect == StatusEffect.Plague) && (Settings.Default.monitoredPlague) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Viruna) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Viruna"); }
else if ((monitoredEffect == StatusEffect.Disease) && (Settings.Default.monitoredDisease) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Viruna) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Viruna"); }
else if ((monitoredEffect == StatusEffect.Burn) && (Settings.Default.monitoredBurn) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Erase"); }
else if ((monitoredEffect == StatusEffect.Frost) && (Settings.Default.monitoredFrost) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Erase"); }
else if ((monitoredEffect == StatusEffect.Choke) && (Settings.Default.monitoredChoke) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Erase"); }
else if ((monitoredEffect == StatusEffect.Rasp) && (Settings.Default.monitoredRasp) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Erase"); }
else if ((monitoredEffect == StatusEffect.Shock) && (Settings.Default.monitoredShock) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Erase"); }
else if ((monitoredEffect == StatusEffect.Drown) && (Settings.Default.monitoredDrown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Erase"); }
else if ((monitoredEffect == StatusEffect.Dia) && (Settings.Default.monitoredDia) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Erase"); }
else if ((monitoredEffect == StatusEffect.Bio) && (Settings.Default.monitoredBio) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Erase"); }
else if ((monitoredEffect == StatusEffect.STR_Down) && (Settings.Default.monitoredStrDown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Erase"); }
else if ((monitoredEffect == StatusEffect.DEX_Down) && (Settings.Default.monitoredDexDown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Erase"); }
else if ((monitoredEffect == StatusEffect.VIT_Down) && (Settings.Default.monitoredVitDown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Erase"); }
else if ((monitoredEffect == StatusEffect.AGI_Down) && (Settings.Default.monitoredAgiDown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Erase"); }
else if ((monitoredEffect == StatusEffect.INT_Down) && (Settings.Default.monitoredIntDown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Erase"); }
else if ((monitoredEffect == StatusEffect.MND_Down) && (Settings.Default.monitoredMndDown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Erase"); }
else if ((monitoredEffect == StatusEffect.CHR_Down) && (Settings.Default.monitoredChrDown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Erase"); }
else if ((monitoredEffect == StatusEffect.Max_HP_Down) && (Settings.Default.monitoredMaxHpDown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Erase"); }
else if ((monitoredEffect == StatusEffect.Max_MP_Down) && (Settings.Default.monitoredMaxMpDown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Erase"); }
else if ((monitoredEffect == StatusEffect.Accuracy_Down) && (Settings.Default.monitoredAccuracyDown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Erase"); }
else if ((monitoredEffect == StatusEffect.Evasion_Down) && (Settings.Default.monitoredEvasionDown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Erase"); }
else if ((monitoredEffect == StatusEffect.Defense_Down) && (Settings.Default.monitoredDefenseDown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Erase"); }
else if ((monitoredEffect == StatusEffect.Flash) && (Settings.Default.monitoredFlash) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Erase"); }
else if ((monitoredEffect == StatusEffect.Magic_Acc_Down) && (Settings.Default.monitoredMagicAccDown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Erase"); }
else if ((monitoredEffect == StatusEffect.Magic_Atk_Down) && (Settings.Default.monitoredMagicAtkDown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Erase"); }
else if ((monitoredEffect == StatusEffect.Helix) && (Settings.Default.monitoredHelix) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Erase"); }
else if ((monitoredEffect == StatusEffect.Max_TP_Down) && (Settings.Default.monitoredMaxTpDown) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Erase"); }
else if ((monitoredEffect == StatusEffect.Requiem) && (Settings.Default.monitoredRequiem) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Erase"); }
else if ((monitoredEffect == StatusEffect.Elegy) && (Settings.Default.monitoredElegy) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Erase"); }
else if ((monitoredEffect == StatusEffect.Threnody) && (Settings.Default.monitoredThrenody) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Erase) == 0)) { castSpell(_FFACEMonitored.Player.Name, "Erase"); }
}
}
// End Debuff Removal
#endregion
#region "== PL Auto Buffs"
// PL Auto Buffs
if (!castingLock && _FFACEPL.Player.GetLoginStatus == LoginStatus.LoggedIn)
{
if ((Settings.Default.plBlink) && (!plStatusCheck(StatusEffect.Blink)) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Blink) == 0))
{
castSpell("<me>", "Blink");
}
else if ((Settings.Default.plReraise) && (!plStatusCheck(StatusEffect.Reraise)))
{
if ((Settings.Default.plReraiseLevel == 1) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Reraise) == 0) && _FFACEPL.Player.MPCurrent > 150)
{
castSpell("<me>", "Reraise");
}
else if ((Settings.Default.plReraiseLevel == 2) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Reraise_II) == 0) && _FFACEPL.Player.MPCurrent > 150)
{
castSpell("<me>", "Reraise II");
}
else if ((Settings.Default.plReraiseLevel == 3) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Reraise_III) == 0) && _FFACEPL.Player.MPCurrent > 150)
{
castSpell("<me>", "Reraise III");
}
}
else if ((Settings.Default.plRefresh) && (!plStatusCheck(StatusEffect.Refresh)))
{
if ((Settings.Default.plRefreshLevel == 1) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Refresh) == 0))
{
castSpell("<me>", "Refresh");
}
else if ((Settings.Default.plRefreshLevel == 2) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Refresh_II) == 0))
{
castSpell("<me>", "Refresh II");
}
}
else if ((Settings.Default.plStoneskin) && (!plStatusCheck(StatusEffect.Stoneskin)) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Stoneskin) == 0))
{
castSpell("<me>", "Stoneskin");
}
else if ((Settings.Default.plShellra) && (!plStatusCheck(StatusEffect.Shell)) && CheckShellraLevelRecast())
{
castSpell("<me>", GetShellraLevel(Settings.Default.plShellralevel));
}
else if ((Settings.Default.plProtectra) && (!plStatusCheck(StatusEffect.Protect)) && CheckProtectraLevelRecast())
{
castSpell("<me>", GetProtectraLevel(Settings.Default.plProtectralevel));
}
}
// End PL Auto Buffs
#endregion
// Auto Casting
#region "== Auto Haste"
foreach (byte id in playerHpOrder)
{
if ((autoHasteEnabled[id]) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Haste) == 0) && (_FFACEPL.Player.MPCurrent > Settings.Default.mpMinCastValue) && (!castingLock) && (castingPossible(id)))
{
if ((_FFACEPL.Player.ID == _FFACEMonitored.PartyMember[id].ID))
{
if (!plStatusCheck(StatusEffect.Haste))
{
hastePlayer(id);
}
}
else if (_FFACEMonitored.Player.ID == _FFACEMonitored.PartyMember[id].ID)
{
if (!monitoredStatusCheck(StatusEffect.Haste))
{
// Check if we are hasting only if fighting
if (Settings.Default.AutoCastEngageCheckBox)
{
// if we are, check to make sure we are fighting before hasting
if (_FFACEMonitored.Player.Status == Status.Fighting)
{
// Haste player
hastePlayer(id);
}
}
// If we are not hasting only during fighting, cast haste
else
{
hastePlayer(id);
}
}
}
else if ((_FFACEMonitored.PartyMember[id].HPCurrent > 0) && (playerHasteSpan[id].Minutes >= Settings.Default.autoHasteMinutes))
{
hastePlayer(id);
}
}
#endregion
#region "== Auto Haste II"
{
if ((autoHaste_IIEnabled[id]) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Haste_II) == 0) && (_FFACEPL.Player.MPCurrent > Settings.Default.mpMinCastValue) && (!castingLock) && (castingPossible(id)))
{
if ((_FFACEPL.Player.ID == _FFACEMonitored.PartyMember[id].ID))
{
if (!plStatusCheck(StatusEffect.Haste))
{
haste_IIPlayer(id);
}
}
else if (_FFACEMonitored.Player.ID == _FFACEMonitored.PartyMember[id].ID)
{
if (!monitoredStatusCheck(StatusEffect.Haste))
{
// Check if we are hasting only if fighting
if (Settings.Default.AutoCastEngageCheckBox)
{
// if we are, check to make sure we are fighting before hasting
if (_FFACEMonitored.Player.Status == Status.Fighting)
{
// Haste II player
haste_IIPlayer(id);
}
}
// If we are not hasting only during fighting, cast haste
else
{
haste_IIPlayer(id);
}
}
}
else if ((_FFACEMonitored.PartyMember[id].HPCurrent > 0) && (playerHaste_IISpan[id].Minutes >= Settings.Default.autoHasteMinutes))
{
haste_IIPlayer(id);
}
}
#endregion
#region "== Auto Flurry "
{
if ((autoFlurryEnabled[id]) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Flurry) == 0) && (_FFACEPL.Player.MPCurrent > Settings.Default.mpMinCastValue) && (!castingLock) && (castingPossible(id)))
{
if ((_FFACEPL.Player.ID == _FFACEMonitored.PartyMember[id].ID))
{
if (!plStatusCheck((StatusEffect)581))
{
FlurryPlayer(id);
}
}
else if (_FFACEMonitored.Player.ID == _FFACEMonitored.PartyMember[id].ID)
{
if (!monitoredStatusCheck((StatusEffect)581))
{
// Check if we are flurring only if fighting
if (Settings.Default.AutoCastEngageCheckBox)
{
// if we are, check to make sure we are fighting before flurring
if (_FFACEMonitored.Player.Status == Status.Fighting)
{
// Flurry player
FlurryPlayer(id);
}
}
// If we are not flurring only during fighting, cast flurry
else
{
FlurryPlayer(id);
}
}
}
else if ((_FFACEMonitored.PartyMember[id].HPCurrent > 0) && (playerFlurrySpan[id].Minutes >= Settings.Default.autoHasteMinutes))
{
FlurryPlayer(id);
}
}
#endregion
#region "== Auto Flurry II"
{
if ((autoFlurry_IIEnabled[id]) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Flurry_II) == 0) && (_FFACEPL.Player.MPCurrent > Settings.Default.mpMinCastValue) && (!castingLock) && (castingPossible(id)))
{
if ((_FFACEPL.Player.ID == _FFACEMonitored.PartyMember[id].ID))
{
if (!plStatusCheck((StatusEffect)581))
{
Flurry_IIPlayer(id);
}
}
else if (_FFACEMonitored.Player.ID == _FFACEMonitored.PartyMember[id].ID)
{
if (!monitoredStatusCheck((StatusEffect)581))
{
// Check if we are flurring only if fighting
if (Settings.Default.AutoCastEngageCheckBox)
{
// if we are, check to make sure we are fighting before flurring
if (_FFACEMonitored.Player.Status == Status.Fighting)
{
// Flurry II player
Flurry_IIPlayer(id);
}
}
// If we are not flurring only during fighting, cast flurry
else
{
Flurry_IIPlayer(id);
}
}
}
else if ((_FFACEMonitored.PartyMember[id].HPCurrent > 0) && (playerFlurry_IISpan[id].Minutes >= Settings.Default.autoHasteMinutes))
{
Flurry_IIPlayer(id);
}
}
#endregion
#region "== Auto Shell IV & V"
if ((autoShell_IVEnabled[id]) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Shell_IV) == 0) && (_FFACEPL.Player.MPCurrent > Settings.Default.mpMinCastValue) && (!castingLock) && (castingPossible(id)))
{
if ((_FFACEPL.Player.ID == _FFACEMonitored.PartyMember[id].ID))
{
if (!plStatusCheck(StatusEffect.Shell))
{
shell_IVPlayer(id);
}
}
else if (_FFACEMonitored.Player.ID == _FFACEMonitored.PartyMember[id].ID)
{
if (!monitoredStatusCheck(StatusEffect.Shell))
{
if (Settings.Default.AutoCastEngageCheckBox)
{
if (_FFACEMonitored.Player.Status == Status.Fighting)
{
shell_IVPlayer(id);
}
}
else
{
shell_IVPlayer(id);
}
}
}
else if ((_FFACEMonitored.PartyMember[id].HPCurrent > 0) && (playerShell_IVSpan[id].Minutes >= Settings.Default.autoShell_IVMinutes))
{
shell_IVPlayer(id);
}
}
if ((autoShell_VEnabled[id]) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Shell_V) == 0) && (_FFACEPL.Player.MPCurrent > Settings.Default.mpMinCastValue) && (!castingLock) && (castingPossible(id)))
{
if ((_FFACEPL.Player.ID == _FFACEMonitored.PartyMember[id].ID))
{
if (!plStatusCheck(StatusEffect.Shell))
{
shell_VPlayer(id);
}
}
else if (_FFACEMonitored.Player.ID == _FFACEMonitored.PartyMember[id].ID)
{
if (!monitoredStatusCheck(StatusEffect.Shell))
{
if (Settings.Default.AutoCastEngageCheckBox)
{
if (_FFACEMonitored.Player.Status == Status.Fighting)
{
shell_VPlayer(id);
}
}
else
{
shell_VPlayer(id);
}
}
}
else if ((_FFACEMonitored.PartyMember[id].HPCurrent > 0) && (playerShell_VSpan[id].Minutes >= Settings.Default.autoShell_VMinutes))
{
shell_VPlayer(id);
}
}
#endregion
#region "== Auto Protect IV & V"
if ((autoProtect_IVEnabled[id]) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Protect_IV) == 0) && (_FFACEPL.Player.MPCurrent > Settings.Default.mpMinCastValue) && (!castingLock) && (castingPossible(id)))
{
if ((_FFACEPL.Player.ID == _FFACEMonitored.PartyMember[id].ID))
{
if (!plStatusCheck(StatusEffect.Protect))
{
protect_IVPlayer(id);
}
}
else if (_FFACEMonitored.Player.ID == _FFACEMonitored.PartyMember[id].ID)
{
if (!monitoredStatusCheck(StatusEffect.Protect))
{
if (Settings.Default.AutoCastEngageCheckBox)
{
if (_FFACEMonitored.Player.Status == Status.Fighting)
{
protect_IVPlayer(id);
}
}
else
{
protect_IVPlayer(id);
}
}
}
else if ((_FFACEMonitored.PartyMember[id].HPCurrent > 0) && (playerProtect_IVSpan[id].Minutes >= Settings.Default.autoProtect_IVMinutes))
{
protect_IVPlayer(id);
}
}
if ((autoProtect_VEnabled[id]) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Protect_V) == 0) && (_FFACEPL.Player.MPCurrent > Settings.Default.mpMinCastValue) && (!castingLock) && (castingPossible(id)))
{
if ((_FFACEPL.Player.ID == _FFACEMonitored.PartyMember[id].ID))
{
if (!plStatusCheck(StatusEffect.Protect))
{
protect_VPlayer(id);
}
}
else if (_FFACEMonitored.Player.ID == _FFACEMonitored.PartyMember[id].ID)
{
if (!monitoredStatusCheck(StatusEffect.Protect))
{
if (Settings.Default.AutoCastEngageCheckBox)
{
if (_FFACEMonitored.Player.Status == Status.Fighting)
{
protect_VPlayer(id);
}
}
else
{
protect_VPlayer(id);
}
}
}
else if ((_FFACEMonitored.PartyMember[id].HPCurrent > 0) && (playerProtect_VSpan[id].Minutes >= Settings.Default.autoProtect_VMinutes))
{
protect_VPlayer(id);
}
}
#endregion
#region "== Auto Phalanx II"
if ((autoPhalanx_IIEnabled[id]) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Phalanx_II) == 0) && (_FFACEPL.Player.MPCurrent > Settings.Default.mpMinCastValue) && (!castingLock) && (castingPossible(id)))
{
if ((_FFACEPL.Player.ID == _FFACEMonitored.PartyMember[id].ID))
{
if (!plStatusCheck(StatusEffect.Phalanx))
{
Phalanx_IIPlayer(id);
}
}
else if ((_FFACEMonitored.Player.ID == _FFACEMonitored.PartyMember[id].ID))
{
if (!monitoredStatusCheck(StatusEffect.Phalanx))
{
Phalanx_IIPlayer(id);
}
}
else if ((_FFACEMonitored.PartyMember[id].HPCurrent > 0) && (playerPhalanx_IISpan[id].Minutes >= Settings.Default.autoPhalanxIIMinutes))
{
Phalanx_IIPlayer(id);
}
}
#endregion
#region "== Auto Regen IV & V"
if ((autoRegen_IVEnabled[id]) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Regen_IV) == 0) && (_FFACEPL.Player.MPCurrent > Settings.Default.mpMinCastValue) && (!castingLock) && (castingPossible(id)))
{
if ((_FFACEPL.Player.ID == _FFACEMonitored.PartyMember[id].ID))
{
if (!plStatusCheck(StatusEffect.Regen))
{
Regen_IVPlayer(id);
}
}
else if (_FFACEMonitored.Player.ID == _FFACEMonitored.PartyMember[id].ID)
{
if (!monitoredStatusCheck(StatusEffect.Regen))
{
if (Settings.Default.AutoCastEngageCheckBox)
{
if (_FFACEMonitored.Player.Status == Status.Fighting)
{
Regen_IVPlayer(id);
}
}
else
{
Regen_IVPlayer(id);
}
}
}
else if (_FFACEMonitored.PartyMember[id].HPCurrent > 0
&& (playerRegen_IVSpan[id].Equals(TimeSpan.FromMinutes((double)Settings.Default.autoRegenIVMinutes))
|| (playerRegen_IVSpan[id].CompareTo(TimeSpan.FromMinutes((double)Settings.Default.autoRegenIVMinutes)) == 1)))
{
Regen_IVPlayer(id);
}
}
if ((autoRegen_VEnabled[id]) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Regen_V) == 0) && (_FFACEPL.Player.MPCurrent > Settings.Default.mpMinCastValue) && (!castingLock) && (castingPossible(id)))
{
if ((_FFACEPL.Player.ID == _FFACEMonitored.PartyMember[id].ID))
{
if (!plStatusCheck(StatusEffect.Regen))
{
Regen_VPlayer(id);
}
}
else if (_FFACEMonitored.Player.ID == _FFACEMonitored.PartyMember[id].ID)
{
if (!monitoredStatusCheck(StatusEffect.Regen))
{
if (Settings.Default.AutoCastEngageCheckBox)
{
if (_FFACEMonitored.Player.Status == Status.Fighting)
{
Regen_VPlayer(id);
}
}
else
{
Regen_VPlayer(id);
}
}
}
else if (_FFACEMonitored.PartyMember[id].HPCurrent > 0
&& (playerRegen_VSpan[id].Equals(TimeSpan.FromMinutes((double)Settings.Default.autoRegenVMinutes))
|| (playerRegen_VSpan[id].CompareTo(TimeSpan.FromMinutes((double)Settings.Default.autoRegenVMinutes)) == 1)))
{
Regen_VPlayer(id);
}
}
#endregion
#region "== Auto Refresh & II"
if ((autoRefreshEnabled[id]) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Refresh) == 0) && (_FFACEPL.Player.MPCurrent > Settings.Default.mpMinCastValue) && (!castingLock) && (castingPossible(id)))
{
if ((_FFACEPL.Player.ID == _FFACEMonitored.PartyMember[id].ID))
{
if (!plStatusCheck(StatusEffect.Refresh))
{
RefreshPlayer(id);
}
}
else if ((_FFACEMonitored.Player.ID == _FFACEMonitored.PartyMember[id].ID))
{
if (!monitoredStatusCheck(StatusEffect.Refresh))
{
RefreshPlayer(id);
}
}
else if (_FFACEMonitored.PartyMember[id].HPCurrent > 0
&& (playerRefreshSpan[id].Equals(TimeSpan.FromMinutes((double)Settings.Default.autoRefreshMinutes))
|| (playerRefreshSpan[id].CompareTo(TimeSpan.FromMinutes((double)Settings.Default.autoRefreshMinutes)) == 1)))
{
RefreshPlayer(id);
}
}
if ((autoRefresh_IIEnabled[id]) && (_FFACEPL.Timer.GetSpellRecast(SpellList.Refresh_II) == 0) && (_FFACEPL.Player.MPCurrent > Settings.Default.mpMinCastValue) && (!castingLock) && (castingPossible(id)))
{
if ((_FFACEPL.Player.ID == _FFACEMonitored.PartyMember[id].ID))
{
if (!plStatusCheck(StatusEffect.Refresh))
{
Refresh_IIPlayer(id);
}
}
else if ((_FFACEMonitored.Player.ID == _FFACEMonitored.PartyMember[id].ID))
{
if (!monitoredStatusCheck(StatusEffect.Refresh))
{
Refresh_IIPlayer(id);
}
}
else if (_FFACEMonitored.PartyMember[id].HPCurrent > 0
&& (playerRefresh_IISpan[id].Equals(TimeSpan.FromMinutes((double)Settings.Default.autoRefreshIIMinutes))
|| (playerRefresh_IISpan[id].CompareTo(TimeSpan.FromMinutes((double)Settings.Default.autoRefreshIIMinutes)) == 1)))
{
Refresh_IIPlayer(id);
}
}
}
#endregion
// so PL job abilities are in order
#region "== All other Job Abilities"
if (!castingLock && !plStatusCheck(StatusEffect.Amnesia))
{
if ((Settings.Default.afflatusSolice) && (!plStatusCheck(StatusEffect.Afflatus_Solace)) && (_FFACEPL.Timer.GetAbilityRecast(AbilityList.Afflatus_Solace) == 0))
{
_FFACEPL.Windower.SendString("/ja \"Afflatus Solace\" <me>");
ActionLockMethod();
}
else if ((Settings.Default.afflatusMisery) && (!plStatusCheck(StatusEffect.Afflatus_Misery)) && (_FFACEPL.Timer.GetAbilityRecast(AbilityList.Afflatus_Misery) == 0))
{
_FFACEPL.Windower.SendString("/ja \"Afflatus Misery\" <me>");
ActionLockMethod();
}
else if ((Settings.Default.Composure) && (!plStatusCheck(StatusEffect.Composure)) && (_FFACEPL.Timer.GetAbilityRecast(AbilityList.Composure) == 0))
{
_FFACEPL.Windower.SendString("/ja \"Composure\" <me>");
ActionLockMethod();
}
else if ((Settings.Default.lightArts) && (!plStatusCheck(StatusEffect.Light_Arts)) && (!plStatusCheck(StatusEffect.Addendum_White)) && (_FFACEPL.Timer.GetAbilityRecast(AbilityList.Light_Arts) == 0))
{
_FFACEPL.Windower.SendString("/ja \"Light Arts\" <me>");
ActionLockMethod();
}
else if ((Settings.Default.addWhite) && (!plStatusCheck(StatusEffect.Addendum_White)) && (_FFACEPL.Timer.GetAbilityRecast(AbilityList.Stratagems) == 0))
{
_FFACEPL.Windower.SendString("/ja \"Addendum: White\" <me>");
ActionLockMethod();
}
else if ((Settings.Default.sublimation) && (!plStatusCheck(StatusEffect.Sublimation_Activated)) && (!plStatusCheck(StatusEffect.Sublimation_Complete)) && (_FFACEPL.Timer.GetAbilityRecast(AbilityList.Sublimation) == 0))
{
_FFACEPL.Windower.SendString("/ja \"Sublimation\" <me>");
ActionLockMethod();
}
else if ((Settings.Default.sublimation) && ((_FFACEPL.Player.MPMax - _FFACEPL.Player.MPCurrent) > (_FFACEPL.Player.HPMax * .4)) && (plStatusCheck(StatusEffect.Sublimation_Complete)) && (_FFACEPL.Timer.GetAbilityRecast(AbilityList.Sublimation) == 0))
{
_FFACEPL.Windower.SendString("/ja \"Sublimation\" <me>");
ActionLockMethod();
}
}
}
}
}
}
}
#endregion
#region "== Get Shellra & Protectra level"
private string GetShellraLevel (decimal p)
{
switch ((int)p)
{
case 1:
return "Shellra";
case 2:
return "Shellra II";
case 3:
return "Shellra III";
case 4:
return "Shellra IV";
case 5:
return "Shellra V";
default:
return "Shellra";
}
}
private string GetProtectraLevel (decimal p)
{
switch ((int)p)
{
case 1:
return "Protectra";
case 2:
return "Protectra II";
case 3:
return "Protectra III";
case 4:
return "Protectra IV";
case 5:
return "Protectra V";
default:
return "Protectra";
}
}
#endregion
#region "== settingsToolStripMenuItem (settings Tab)"
private void settingsToolStripMenuItem_Click(object sender, EventArgs e)
{
Form2 settings = new Form2();
settings.Show();
}
#endregion
#region "== playerOptionsButtons (MENU Button)"
private void player0optionsButton_Click(object sender, EventArgs e)
{
playerOptionsSelected = 0;
autoHasteToolStripMenuItem.Checked = autoHasteEnabled[0];
autoHasteIIToolStripMenuItem.Checked = autoHaste_IIEnabled[0];
autoFlurryToolStripMenuItem.Checked = autoFlurryEnabled[0];
autoFlurryIIToolStripMenuItem.Checked = autoFlurry_IIEnabled[0];
autoProtectIVToolStripMenuItem1.Checked = autoProtect_IVEnabled[0];
autoProtectVToolStripMenuItem1.Checked = autoProtect_VEnabled[0];
autoShellIVToolStripMenuItem.Checked = autoShell_IVEnabled[0];
autoShellVToolStripMenuItem.Checked = autoShell_VEnabled[0];
playerOptions.Show(party0, new Point(0, 0));
}
private void player1optionsButton_Click(object sender, EventArgs e)
{
playerOptionsSelected = 1;
autoHasteToolStripMenuItem.Checked = autoHasteEnabled[1];
autoHasteIIToolStripMenuItem.Checked = autoHaste_IIEnabled[1];
autoFlurryToolStripMenuItem.Checked = autoFlurryEnabled[1];
autoFlurryIIToolStripMenuItem.Checked = autoFlurry_IIEnabled[1];
autoProtectIVToolStripMenuItem1.Checked = autoProtect_IVEnabled[1];
autoProtectVToolStripMenuItem1.Checked = autoProtect_VEnabled[1];
autoShellIVToolStripMenuItem.Checked = autoShell_IVEnabled[1];
autoShellVToolStripMenuItem.Checked = autoShell_VEnabled[1];
playerOptions.Show(party0, new Point(0, 0));
}
private void player2optionsButton_Click(object sender, EventArgs e)
{
playerOptionsSelected = 2;
autoHasteToolStripMenuItem.Checked = autoHasteEnabled[2];
autoHasteIIToolStripMenuItem.Checked = autoHaste_IIEnabled[2];
autoFlurryToolStripMenuItem.Checked = autoFlurryEnabled[2];
autoFlurryIIToolStripMenuItem.Checked = autoFlurry_IIEnabled[2];
autoProtectIVToolStripMenuItem1.Checked = autoProtect_IVEnabled[2];
autoProtectVToolStripMenuItem1.Checked = autoProtect_VEnabled[2];
autoShellIVToolStripMenuItem.Checked = autoShell_IVEnabled[2];
autoShellVToolStripMenuItem.Checked = autoShell_VEnabled[2];
playerOptions.Show(party0, new Point(0, 0));
}
private void player3optionsButton_Click(object sender, EventArgs e)
{
playerOptionsSelected = 3;
autoHasteToolStripMenuItem.Checked = autoHasteEnabled[3];
autoHasteIIToolStripMenuItem.Checked = autoHaste_IIEnabled[3];
autoFlurryToolStripMenuItem.Checked = autoFlurryEnabled[3];
autoFlurryIIToolStripMenuItem.Checked = autoFlurry_IIEnabled[3];
autoProtectIVToolStripMenuItem1.Checked = autoProtect_IVEnabled[3];
autoProtectVToolStripMenuItem1.Checked = autoProtect_VEnabled[3];
autoShellIVToolStripMenuItem.Checked = autoShell_IVEnabled[3];
autoShellVToolStripMenuItem.Checked = autoShell_VEnabled[3];
playerOptions.Show(party0, new Point(0, 0));
}
private void player4optionsButton_Click(object sender, EventArgs e)
{
playerOptionsSelected = 4;
autoHasteToolStripMenuItem.Checked = autoHasteEnabled[4];
autoHasteIIToolStripMenuItem.Checked = autoHaste_IIEnabled[4];
autoFlurryToolStripMenuItem.Checked = autoFlurryEnabled[4];
autoFlurryIIToolStripMenuItem.Checked = autoFlurry_IIEnabled[4];
autoProtectIVToolStripMenuItem1.Checked = autoProtect_IVEnabled[4];
autoProtectVToolStripMenuItem1.Checked = autoProtect_VEnabled[4];
autoShellIVToolStripMenuItem.Checked = autoShell_IVEnabled[4];
autoShellVToolStripMenuItem.Checked = autoShell_VEnabled[4];
playerOptions.Show(party0, new Point(0, 0));
}
private void player5optionsButton_Click(object sender, EventArgs e)
{
playerOptionsSelected = 5;
autoHasteToolStripMenuItem.Checked = autoHasteEnabled[5];
autoHasteIIToolStripMenuItem.Checked = autoHaste_IIEnabled[5];
autoFlurryToolStripMenuItem.Checked = autoFlurryEnabled[5];
autoFlurryIIToolStripMenuItem.Checked = autoFlurry_IIEnabled[5];
autoProtectIVToolStripMenuItem1.Checked = autoProtect_IVEnabled[5];
autoProtectVToolStripMenuItem1.Checked = autoProtect_VEnabled[5];
autoShellIVToolStripMenuItem.Checked = autoShell_IVEnabled[5];
autoShellVToolStripMenuItem.Checked = autoShell_VEnabled[5];
playerOptions.Show(party0, new Point(0, 0));
}
private void player6optionsButton_Click(object sender, EventArgs e)
{
playerOptionsSelected = 6;
autoHasteToolStripMenuItem.Checked = autoHasteEnabled[6];
autoHasteIIToolStripMenuItem.Checked = autoHaste_IIEnabled[6];
autoFlurryToolStripMenuItem.Checked = autoFlurryEnabled[6];
autoFlurryIIToolStripMenuItem.Checked = autoFlurry_IIEnabled[6];
autoProtectIVToolStripMenuItem1.Checked = autoProtect_IVEnabled[6];
autoProtectVToolStripMenuItem1.Checked = autoProtect_VEnabled[6];
autoShellIVToolStripMenuItem.Checked = autoShell_IVEnabled[6];
autoShellVToolStripMenuItem.Checked = autoShell_VEnabled[6];
playerOptions.Show(party1, new Point(0, 0));
}
private void player7optionsButton_Click(object sender, EventArgs e)
{
playerOptionsSelected = 7;
autoHasteToolStripMenuItem.Checked = autoHasteEnabled[7];
autoHasteIIToolStripMenuItem.Checked = autoHaste_IIEnabled[7];
autoFlurryToolStripMenuItem.Checked = autoFlurryEnabled[7];
autoFlurryIIToolStripMenuItem.Checked = autoFlurry_IIEnabled[7];
autoProtectIVToolStripMenuItem1.Checked = autoProtect_IVEnabled[7];
autoProtectVToolStripMenuItem1.Checked = autoProtect_VEnabled[7];
autoShellIVToolStripMenuItem.Checked = autoShell_IVEnabled[7];
autoShellVToolStripMenuItem.Checked = autoShell_VEnabled[7];
playerOptions.Show(party1, new Point(0, 0));
}
private void player8optionsButton_Click(object sender, EventArgs e)
{
playerOptionsSelected = 8;
autoHasteToolStripMenuItem.Checked = autoHasteEnabled[8];
autoHasteIIToolStripMenuItem.Checked = autoHaste_IIEnabled[8];
autoFlurryToolStripMenuItem.Checked = autoFlurryEnabled[8];
autoFlurryIIToolStripMenuItem.Checked = autoFlurry_IIEnabled[8];
autoProtectIVToolStripMenuItem1.Checked = autoProtect_IVEnabled[8];
autoProtectVToolStripMenuItem1.Checked = autoProtect_VEnabled[8];
autoShellIVToolStripMenuItem.Checked = autoShell_IVEnabled[8];
autoShellVToolStripMenuItem.Checked = autoShell_VEnabled[8];
playerOptions.Show(party1, new Point(0, 0));
}
private void player9optionsButton_Click(object sender, EventArgs e)
{
playerOptionsSelected = 9;
autoHasteToolStripMenuItem.Checked = autoHasteEnabled[9];
autoHasteIIToolStripMenuItem.Checked = autoHaste_IIEnabled[9];
autoFlurryToolStripMenuItem.Checked = autoFlurryEnabled[9];
autoFlurryIIToolStripMenuItem.Checked = autoFlurry_IIEnabled[9];
autoProtectIVToolStripMenuItem1.Checked = autoProtect_IVEnabled[9];
autoProtectVToolStripMenuItem1.Checked = autoProtect_VEnabled[9];
autoShellIVToolStripMenuItem.Checked = autoShell_IVEnabled[9];
autoShellVToolStripMenuItem.Checked = autoShell_VEnabled[9];
playerOptions.Show(party1, new Point(0, 0));
}
private void player10optionsButton_Click(object sender, EventArgs e)
{
playerOptionsSelected = 10;
autoHasteToolStripMenuItem.Checked = autoHasteEnabled[10];
autoHasteIIToolStripMenuItem.Checked = autoHaste_IIEnabled[10];
autoFlurryToolStripMenuItem.Checked = autoFlurryEnabled[10];
autoFlurryIIToolStripMenuItem.Checked = autoFlurry_IIEnabled[10];
autoProtectIVToolStripMenuItem1.Checked = autoProtect_IVEnabled[10];
autoProtectVToolStripMenuItem1.Checked = autoProtect_VEnabled[10];
autoShellIVToolStripMenuItem.Checked = autoShell_IVEnabled[10];
autoShellVToolStripMenuItem.Checked = autoShell_VEnabled[10];
playerOptions.Show(party1, new Point(0, 0));
}
private void player11optionsButton_Click(object sender, EventArgs e)
{
playerOptionsSelected = 11;
autoHasteToolStripMenuItem.Checked = autoHasteEnabled[11];
autoHasteIIToolStripMenuItem.Checked = autoHaste_IIEnabled[11];
autoFlurryToolStripMenuItem.Checked = autoFlurryEnabled[11];
autoFlurryIIToolStripMenuItem.Checked = autoFlurry_IIEnabled[11];
autoProtectIVToolStripMenuItem1.Checked = autoProtect_IVEnabled[11];
autoProtectVToolStripMenuItem1.Checked = autoProtect_VEnabled[11];
autoShellIVToolStripMenuItem.Checked = autoShell_IVEnabled[11];
autoShellVToolStripMenuItem.Checked = autoShell_VEnabled[11];
playerOptions.Show(party1, new Point(0, 0));
}
private void player12optionsButton_Click(object sender, EventArgs e)
{
playerOptionsSelected = 12;
autoHasteToolStripMenuItem.Checked = autoHasteEnabled[12];
autoHasteIIToolStripMenuItem.Checked = autoHaste_IIEnabled[12];
autoFlurryToolStripMenuItem.Checked = autoFlurryEnabled[12];
autoFlurryIIToolStripMenuItem.Checked = autoFlurry_IIEnabled[12];
autoProtectIVToolStripMenuItem1.Checked = autoProtect_IVEnabled[12];
autoProtectVToolStripMenuItem1.Checked = autoProtect_VEnabled[12];
autoShellIVToolStripMenuItem.Checked = autoShell_IVEnabled[12];
autoShellVToolStripMenuItem.Checked = autoShell_VEnabled[12];
playerOptions.Show(party2, new Point(0, 0));
}
private void player13optionsButton_Click(object sender, EventArgs e)
{
playerOptionsSelected = 13;
autoHasteToolStripMenuItem.Checked = autoHasteEnabled[13];
autoHasteIIToolStripMenuItem.Checked = autoHaste_IIEnabled[13];
autoFlurryToolStripMenuItem.Checked = autoFlurryEnabled[13];
autoFlurryIIToolStripMenuItem.Checked = autoFlurry_IIEnabled[13];
autoProtectIVToolStripMenuItem1.Checked = autoProtect_IVEnabled[13];
autoProtectVToolStripMenuItem1.Checked = autoProtect_VEnabled[13];
autoShellIVToolStripMenuItem.Checked = autoShell_IVEnabled[13];
autoShellVToolStripMenuItem.Checked = autoShell_VEnabled[13];
playerOptions.Show(party2, new Point(0, 0));
}
private void player14optionsButton_Click(object sender, EventArgs e)
{
playerOptionsSelected = 14;
autoHasteToolStripMenuItem.Checked = autoHasteEnabled[14];
autoHasteIIToolStripMenuItem.Checked = autoHaste_IIEnabled[14];
autoFlurryToolStripMenuItem.Checked = autoFlurryEnabled[14];
autoFlurryIIToolStripMenuItem.Checked = autoFlurry_IIEnabled[14];
autoProtectIVToolStripMenuItem1.Checked = autoProtect_IVEnabled[14];
autoProtectVToolStripMenuItem1.Checked = autoProtect_VEnabled[14];
autoShellIVToolStripMenuItem.Checked = autoShell_IVEnabled[14];
autoShellVToolStripMenuItem.Checked = autoShell_VEnabled[14];
playerOptions.Show(party2, new Point(0, 0));
}
private void player15optionsButton_Click(object sender, EventArgs e)
{
playerOptionsSelected = 15;
autoHasteToolStripMenuItem.Checked = autoHasteEnabled[15];
autoHasteIIToolStripMenuItem.Checked = autoHaste_IIEnabled[15];
autoFlurryToolStripMenuItem.Checked = autoFlurryEnabled[15];
autoFlurryIIToolStripMenuItem.Checked = autoFlurry_IIEnabled[15];
autoProtectIVToolStripMenuItem1.Checked = autoProtect_IVEnabled[15];
autoProtectVToolStripMenuItem1.Checked = autoProtect_VEnabled[15];
autoShellIVToolStripMenuItem.Checked = autoShell_IVEnabled[15];
autoShellVToolStripMenuItem.Checked = autoShell_VEnabled[15];
playerOptions.Show(party2, new Point(0, 0));
}
private void player16optionsButton_Click(object sender, EventArgs e)
{
playerOptionsSelected = 16;
autoHasteToolStripMenuItem.Checked = autoHasteEnabled[16];
autoHasteIIToolStripMenuItem.Checked = autoHaste_IIEnabled[16];
autoFlurryToolStripMenuItem.Checked = autoFlurryEnabled[16];
autoFlurryIIToolStripMenuItem.Checked = autoFlurry_IIEnabled[16];
autoProtectIVToolStripMenuItem1.Checked = autoProtect_IVEnabled[16];
autoProtectVToolStripMenuItem1.Checked = autoProtect_VEnabled[16];
autoShellIVToolStripMenuItem.Checked = autoShell_IVEnabled[16];
autoShellVToolStripMenuItem.Checked = autoShell_VEnabled[16];
playerOptions.Show(party2, new Point(0, 0));
}
private void player17optionsButton_Click(object sender, EventArgs e)
{
playerOptionsSelected = 17;
autoHasteToolStripMenuItem.Checked = autoHasteEnabled[17];
autoHasteIIToolStripMenuItem.Checked = autoHaste_IIEnabled[17];
autoFlurryToolStripMenuItem.Checked = autoFlurryEnabled[17];
autoFlurryIIToolStripMenuItem.Checked = autoFlurry_IIEnabled[17];
autoProtectIVToolStripMenuItem1.Checked = autoProtect_IVEnabled[17];
autoProtectVToolStripMenuItem1.Checked = autoProtect_VEnabled[17];
autoShellIVToolStripMenuItem.Checked = autoShell_IVEnabled[17];
autoShellVToolStripMenuItem.Checked = autoShell_VEnabled[17];
playerOptions.Show(party2, new Point(0, 0));
}
#endregion
#region "== autoOptions (Auto Button)"
private void player0buffsButton_Click(object sender, EventArgs e)
{
autoOptionsSelected = 0;
autoPhalanxIIToolStripMenuItem1.Checked = autoPhalanx_IIEnabled[0];
autoRegenIVToolStripMenuItem1.Checked = autoRegen_IVEnabled[0];
autoRefreshToolStripMenuItem1.Checked = autoRefreshEnabled[0];
autoRegenVToolStripMenuItem.Checked = autoRegen_VEnabled[0];
autoRefreshIIToolStripMenuItem.Checked = autoRefresh_IIEnabled[0];
autoOptions.Show(party0, new Point(0, 0));
}
private void player1buffsButton_Click(object sender, EventArgs e)
{
autoOptionsSelected = 1;
autoPhalanxIIToolStripMenuItem1.Checked = autoPhalanx_IIEnabled[1];
autoRegenIVToolStripMenuItem1.Checked = autoRegen_IVEnabled[1];
autoRefreshToolStripMenuItem1.Checked = autoRefreshEnabled[1];
autoRegenVToolStripMenuItem.Checked = autoRegen_VEnabled[1];
autoRefreshIIToolStripMenuItem.Checked = autoRefresh_IIEnabled[1];
autoOptions.Show(party0, new Point(0, 0));
}
private void player2buffsButton_Click(object sender, EventArgs e)
{
autoOptionsSelected = 2;
autoPhalanxIIToolStripMenuItem1.Checked = autoPhalanx_IIEnabled[2];
autoRegenIVToolStripMenuItem1.Checked = autoRegen_IVEnabled[2];
autoRefreshToolStripMenuItem1.Checked = autoRefreshEnabled[2];
autoRegenVToolStripMenuItem.Checked = autoRegen_VEnabled[2];
autoRefreshIIToolStripMenuItem.Checked = autoRefresh_IIEnabled[2];
autoOptions.Show(party0, new Point(0, 0));
}
private void player3buffsButton_Click(object sender, EventArgs e)
{
autoOptionsSelected = 3;
autoPhalanxIIToolStripMenuItem1.Checked = autoPhalanx_IIEnabled[3];
autoRegenIVToolStripMenuItem1.Checked = autoRegen_IVEnabled[3];
autoRefreshToolStripMenuItem1.Checked = autoRefreshEnabled[3];
autoRegenVToolStripMenuItem.Checked = autoRegen_VEnabled[3];
autoRefreshIIToolStripMenuItem.Checked = autoRefresh_IIEnabled[3];
autoOptions.Show(party0, new Point(0, 0));
}
private void player4buffsButton_Click(object sender, EventArgs e)
{
autoOptionsSelected = 4;
autoPhalanxIIToolStripMenuItem1.Checked = autoPhalanx_IIEnabled[4];
autoRegenIVToolStripMenuItem1.Checked = autoRegen_IVEnabled[4];
autoRefreshToolStripMenuItem1.Checked = autoRefreshEnabled[4];
autoRegenVToolStripMenuItem.Checked = autoRegen_VEnabled[4];
autoRefreshIIToolStripMenuItem.Checked = autoRefresh_IIEnabled[4];
autoOptions.Show(party0, new Point(0, 0));
}
private void player5buffsButton_Click(object sender, EventArgs e)
{
autoOptionsSelected = 5;
autoPhalanxIIToolStripMenuItem1.Checked = autoPhalanx_IIEnabled[5];
autoRegenIVToolStripMenuItem1.Checked = autoRegen_IVEnabled[5];
autoRefreshToolStripMenuItem1.Checked = autoRefreshEnabled[5];
autoRegenVToolStripMenuItem.Checked = autoRegen_VEnabled[5];
autoRefreshIIToolStripMenuItem.Checked = autoRefresh_IIEnabled[5];
autoOptions.Show(party0, new Point(0, 0));
}
private void player6buffsButton_Click(object sender, EventArgs e)
{
autoOptionsSelected = 6;
autoOptions.Show(party1, new Point(0, 0));
}
private void player7buffsButton_Click(object sender, EventArgs e)
{
autoOptionsSelected = 7;
autoOptions.Show(party1, new Point(0, 0));
}
private void player8buffsButton_Click(object sender, EventArgs e)
{
autoOptionsSelected = 8;
autoOptions.Show(party1, new Point(0, 0));
}
private void player9buffsButton_Click(object sender, EventArgs e)
{
autoOptionsSelected = 9;
autoOptions.Show(party1, new Point(0, 0));
}
private void player10buffsButton_Click(object sender, EventArgs e)
{
autoOptionsSelected = 10;
autoOptions.Show(party1, new Point(0, 0));
}
private void player11buffsButton_Click(object sender, EventArgs e)
{
autoOptionsSelected = 11;
autoOptions.Show(party1, new Point(0, 0));
}
private void player12buffsButton_Click(object sender, EventArgs e)
{
autoOptionsSelected = 12;
autoOptions.Show(party2, new Point(0, 0));
}
private void player13buffsButton_Click(object sender, EventArgs e)
{
autoOptionsSelected = 13;
autoOptions.Show(party2, new Point(0, 0));
}
private void player14buffsButton_Click(object sender, EventArgs e)
{
autoOptionsSelected = 14;
autoOptions.Show(party2, new Point(0, 0));
}
private void player15buffsButton_Click(object sender, EventArgs e)
{
autoOptionsSelected = 15;
autoOptions.Show(party2, new Point(0, 0));
}
private void player16buffsButton_Click(object sender, EventArgs e)
{
autoOptionsSelected = 16;
autoOptions.Show(party2, new Point(0, 0));
}
private void player17buffsButton_Click(object sender, EventArgs e)
{
autoOptionsSelected = 17;
autoOptions.Show(party2, new Point(0, 0));
}
#endregion
#region "== castingLockTimer"
private void castingLockTimer_Tick(object sender, EventArgs e)
{
if (_FFACEPL == null || _FFACEMonitored == null)
{
return;
}
if (_FFACEPL.Player.GetLoginStatus != LoginStatus.LoggedIn || _FFACEMonitored.Player.GetLoginStatus != LoginStatus.LoggedIn)
{
return;
}
castingLockTimer.Enabled = false;
castingStatusCheck.Enabled = true;
}
private void castingStatusCheck_Tick(object sender, EventArgs e)
{
if (_FFACEPL == null || _FFACEMonitored == null)
{
return;
}
if (_FFACEPL.Player.GetLoginStatus != LoginStatus.LoggedIn || _FFACEMonitored.Player.GetLoginStatus != LoginStatus.LoggedIn)
{
return;
}
if (_FFACEPL.Player.CastPercentEx >= 75)
{
castingLockLabel.Text = "Casting is soon to be UNLOCKED!";
castingStatusCheck.Enabled = false;
castingUnlockTimer.Enabled = true;
}
else if (castingSafetyPercentage == _FFACEPL.Player.CastPercentEx)
{
castingLockLabel.Text = "Casting is INTERRUPTED!";
castingStatusCheck.Enabled = false;
castingUnlockTimer.Enabled = true;
}
castingSafetyPercentage = _FFACEPL.Player.CastPercentEx;
}
private void castingUnlockTimer_Tick(object sender, EventArgs e)
{
if (_FFACEPL == null || _FFACEMonitored == null)
{
return;
}
if (_FFACEPL.Player.GetLoginStatus != LoginStatus.LoggedIn || _FFACEMonitored.Player.GetLoginStatus != LoginStatus.LoggedIn)
{
return;
}
castingLockLabel.Text = "Casting is UNLOCKED!";
castingLock = false;
actionTimer.Enabled = true;
castingUnlockTimer.Enabled = false;
}
private void actionUnlockTimer_Tick(object sender, EventArgs e)
{
if (_FFACEPL == null || _FFACEMonitored == null)
{
return;
}
if (_FFACEPL.Player.GetLoginStatus != LoginStatus.LoggedIn || _FFACEMonitored.Player.GetLoginStatus != LoginStatus.LoggedIn)
{
return;
}
castingLockLabel.Text = "Casting is UNLOCKED!";
castingLock = false;
actionUnlockTimer.Enabled = false;
actionTimer.Enabled = true;
}
#endregion
#region "== auto spells ToolStripItem_Click"
private void autoHasteToolStripMenuItem_Click(object sender, EventArgs e)
{
autoHasteEnabled[playerOptionsSelected] = !autoHasteEnabled[playerOptionsSelected];
}
private void autoHasteIIToolStripMenuItem_Click(object sender, EventArgs e)
{
autoHaste_IIEnabled[playerOptionsSelected] = !autoHaste_IIEnabled[playerOptionsSelected];
}
private void autoFlurryToolStripMenuItem_Click(object sender, EventArgs e)
{
autoFlurryEnabled[playerOptionsSelected] = !autoFlurryEnabled[playerOptionsSelected];
}
private void autoFlurryIIToolStripMenuItem_Click(object sender, EventArgs e)
{
autoFlurry_IIEnabled[playerOptionsSelected] = !autoFlurry_IIEnabled[playerOptionsSelected];
}
private void autoProtectIVToolStripMenuItem1_Click(object sender, EventArgs e)
{
autoProtect_IVEnabled[playerOptionsSelected] = !autoProtect_IVEnabled[playerOptionsSelected];
}
private void autoProtectVToolStripMenuItem1_Click(object sender, EventArgs e)
{
autoProtect_VEnabled[playerOptionsSelected] = !autoProtect_VEnabled[playerOptionsSelected];
}
private void autoShellIVToolStripMenuItem_Click(object sender, EventArgs e)
{
autoShell_IVEnabled[playerOptionsSelected] = !autoShell_IVEnabled[playerOptionsSelected];
}
private void autoShellVToolStripMenuItem_Click(object sender, EventArgs e)
{
autoShell_VEnabled[playerOptionsSelected] = !autoShell_VEnabled[playerOptionsSelected];
}
private void autoHasteToolStripMenuItem1_Click(object sender, EventArgs e)
{
autoHasteEnabled[autoOptionsSelected] = !autoHasteEnabled[autoOptionsSelected];
}
private void autoPhalanxIIToolStripMenuItem1_Click(object sender, EventArgs e)
{
autoPhalanx_IIEnabled[autoOptionsSelected] = !autoPhalanx_IIEnabled[autoOptionsSelected];
}
private void autoRegenIVToolStripMenuItem1_Click(object sender, EventArgs e)
{
autoRegen_IVEnabled[autoOptionsSelected] = !autoRegen_IVEnabled[autoOptionsSelected];
}
private void autoRegenVToolStripMenuItem_Click(object sender, EventArgs e)
{
autoRegen_VEnabled[autoOptionsSelected] = !autoRegen_VEnabled[autoOptionsSelected];
}
private void autoRefreshToolStripMenuItem1_Click(object sender, EventArgs e)
{
autoRefreshEnabled[autoOptionsSelected] = !autoRefreshEnabled[autoOptionsSelected];
}
private void autoRefreshIIToolStripMenuItem_Click(object sender, EventArgs e)
{
autoRefresh_IIEnabled[autoOptionsSelected] = !autoRefresh_IIEnabled[autoOptionsSelected];
}
#endregion
#region "== spells ToolStripMenuItem_Click"
private void hasteToolStripMenuItem_Click(object sender, EventArgs e)
{
hastePlayer(playerOptionsSelected);
}
private void followToolStripMenuItem_Click(object sender, EventArgs e)
{
_FFACEPL.Windower.SendString("/follow " + _FFACEMonitored.PartyMember[playerOptionsSelected].Name);
CastLockMethod();
}
private void phalanxIIToolStripMenuItem_Click(object sender, EventArgs e)
{
_FFACEPL.Windower.SendString("/ma \"Phalanx II\" " + _FFACEMonitored.PartyMember[playerOptionsSelected].Name);
CastLockMethod();
}
private void invisibleToolStripMenuItem_Click(object sender, EventArgs e)
{
_FFACEPL.Windower.SendString("/ma \"Invisible\" " + _FFACEMonitored.PartyMember[playerOptionsSelected].Name);
CastLockMethod();
}
private void refreshToolStripMenuItem_Click(object sender, EventArgs e)
{
_FFACEPL.Windower.SendString("/ma \"Refresh\" " + _FFACEMonitored.PartyMember[playerOptionsSelected].Name);
CastLockMethod();
}
private void refreshIIToolStripMenuItem_Click(object sender, EventArgs e)
{
_FFACEPL.Windower.SendString("/ma \"Refresh II\" " + _FFACEMonitored.PartyMember[playerOptionsSelected].Name);
CastLockMethod();
}
private void sneakToolStripMenuItem_Click(object sender, EventArgs e)
{
_FFACEPL.Windower.SendString("/ma \"Sneak\" " + _FFACEMonitored.PartyMember[playerOptionsSelected].Name);
CastLockMethod();
}
private void regenIIToolStripMenuItem_Click(object sender, EventArgs e)
{
_FFACEPL.Windower.SendString("/ma \"Regen II\" " + _FFACEMonitored.PartyMember[playerOptionsSelected].Name);
CastLockMethod();
}
private void regenIIIToolStripMenuItem_Click (object sender, EventArgs e)
{
_FFACEPL.Windower.SendString("/ma \"Regen III\" " + _FFACEMonitored.PartyMember[playerOptionsSelected].Name);
CastLockMethod();
}
private void regenIVToolStripMenuItem_Click (object sender, EventArgs e)
{
_FFACEPL.Windower.SendString("/ma \"Regen IV\" " + _FFACEMonitored.PartyMember[playerOptionsSelected].Name);
CastLockMethod();
}
private void eraseToolStripMenuItem_Click(object sender, EventArgs e)
{
_FFACEPL.Windower.SendString("/ma \"Erase\" " + _FFACEMonitored.PartyMember[playerOptionsSelected].Name);
CastLockMethod();
}
private void sacrificeToolStripMenuItem_Click(object sender, EventArgs e)
{
_FFACEPL.Windower.SendString("/ma \"Sacrifice\" " + _FFACEMonitored.PartyMember[playerOptionsSelected].Name);
CastLockMethod();
}
private void blindnaToolStripMenuItem_Click(object sender, EventArgs e)
{
_FFACEPL.Windower.SendString("/ma \"Blindna\" " + _FFACEMonitored.PartyMember[playerOptionsSelected].Name);
CastLockMethod();
}
private void cursnaToolStripMenuItem_Click(object sender, EventArgs e)
{
_FFACEPL.Windower.SendString("/ma \"Cursna\" " + _FFACEMonitored.PartyMember[playerOptionsSelected].Name);
CastLockMethod();
}
private void paralynaToolStripMenuItem_Click(object sender, EventArgs e)
{
_FFACEPL.Windower.SendString("/ma \"Paralyna\" " + _FFACEMonitored.PartyMember[playerOptionsSelected].Name);
CastLockMethod();
}
private void poisonaToolStripMenuItem_Click(object sender, EventArgs e)
{
_FFACEPL.Windower.SendString("/ma \"Poisona\" " + _FFACEMonitored.PartyMember[playerOptionsSelected].Name);
CastLockMethod();
}
private void stonaToolStripMenuItem_Click(object sender, EventArgs e)
{
_FFACEPL.Windower.SendString("/ma \"Stona\" " + _FFACEMonitored.PartyMember[playerOptionsSelected].Name);
CastLockMethod();
}
private void silenaToolStripMenuItem_Click(object sender, EventArgs e)
{
_FFACEPL.Windower.SendString("/ma \"Silena\" " + _FFACEMonitored.PartyMember[playerOptionsSelected].Name);
CastLockMethod();
}
private void virunaToolStripMenuItem_Click(object sender, EventArgs e)
{
_FFACEPL.Windower.SendString("/ma \"Viruna\" " + _FFACEMonitored.PartyMember[playerOptionsSelected].Name);
CastLockMethod();
}
private void protectIVToolStripMenuItem_Click(object sender, EventArgs e)
{
_FFACEPL.Windower.SendString("/ma \"Protect IV\" " + _FFACEMonitored.PartyMember[playerOptionsSelected].Name);
CastLockMethod();
}
private void protectVToolStripMenuItem_Click(object sender, EventArgs e)
{
_FFACEPL.Windower.SendString("/ma \"Protect V\" " + _FFACEMonitored.PartyMember[playerOptionsSelected].Name);
CastLockMethod();
}
private void shellIVToolStripMenuItem_Click(object sender, EventArgs e)
{
_FFACEPL.Windower.SendString("/ma \"Shell IV\" " + _FFACEMonitored.PartyMember[playerOptionsSelected].Name);
CastLockMethod();
}
private void shellVToolStripMenuItem_Click(object sender, EventArgs e)
{
_FFACEPL.Windower.SendString("/ma \"Shell V\" " + _FFACEMonitored.PartyMember[playerOptionsSelected].Name);
CastLockMethod();
}
#endregion
#region "== Pause Button"
private void button3_Click(object sender, EventArgs e)
{
pauseActions = !pauseActions;
if (!pauseActions)
{
pauseButton.Text = "Pause";
pauseButton.ForeColor = Color.Black;
}
else if (pauseActions)
{
pauseButton.Text = "Paused!";
pauseButton.ForeColor = Color.Red;
}
}
#endregion
#region "== Player (debug) Button"
private void button1_Click(object sender, EventArgs e)
{
if (_FFACEMonitored == null)
{
MessageBox.Show("Attach to process before pressing this button","Error");
return;
}
var items = _FFACEMonitored.PartyMember.Keys.OrderBy(k => _FFACEMonitored.PartyMember[k].HPPCurrent);
/*
* var items = from k in _FFACEMonitored.PartyMember.Keys
orderby _FFACEMonitored.PartyMember[k].HPPCurrent ascending
select k;
*/
foreach (byte id in items)
{
MessageBox.Show(id.ToString() + ": " + _FFACEMonitored.PartyMember[id].Name + ": " + _FFACEMonitored.PartyMember[id].HPPCurrent.ToString() + ": " + _FFACEMonitored.PartyMember[id].Active.ToString());
}
}
#endregion
#region "== Always on Top Check Box"
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
{
if (TopMost)
{
TopMost = false;
}
else
{
TopMost = true;
}
}
}
#endregion
#region "== Tray Icon"
private void MouseClickTray(object sender, MouseEventArgs e)
{
if (this.WindowState == FormWindowState.Minimized && this.Visible == false)
{
this.Show();
this.WindowState = FormWindowState.Normal;
}
else
{
this.Hide();
this.WindowState = FormWindowState.Minimized;
}
}
#endregion
#region "== About Tab ToolStripMenu Item"
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
{
new Form3().Show();
}
#endregion
#region "== Transparency (Opacity Value)"
private void trackBar1_Scroll(object sender, EventArgs e)
{
Opacity = trackBar1.Value * 0.01;
}
#endregion
#region "== Shellra & Protectra Recast Level"
private bool CheckShellraLevelRecast ()
{
switch ((int)Settings.Default.plShellralevel)
{
case 1:
return _FFACEPL.Timer.GetSpellRecast(SpellList.Shellra) == 0;
case 2:
return _FFACEPL.Timer.GetSpellRecast(SpellList.Shellra_II) == 0;
case 3:
return _FFACEPL.Timer.GetSpellRecast(SpellList.Shellra_III) == 0;
case 4:
return _FFACEPL.Timer.GetSpellRecast(SpellList.Shellra_IV) == 0;
case 5:
return _FFACEPL.Timer.GetSpellRecast(SpellList.Shellra_V) == 0;
default:
return false;
}
}
private bool CheckProtectraLevelRecast ()
{
switch ((int)Settings.Default.plProtectralevel)
{
case 1:
return _FFACEPL.Timer.GetSpellRecast(SpellList.Protectra) == 0;
case 2:
return _FFACEPL.Timer.GetSpellRecast(SpellList.Protectra_II) == 0;
case 3:
return _FFACEPL.Timer.GetSpellRecast(SpellList.Protectra_III) == 0;
case 4:
return _FFACEPL.Timer.GetSpellRecast(SpellList.Protectra_IV) == 0;
case 5:
return _FFACEPL.Timer.GetSpellRecast(SpellList.Protectra_V) == 0;
default:
return false;
}
}
#endregion
#region "== pl Medicine Check"
private bool IsMedicated()
{
return plStatusCheck(StatusEffect.Medicine);
}
#endregion
}
} | h1pp0/Cure-Please | Form1.cs | C# | gpl-2.0 | 161,840 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
5059,
1025,
2478,
2291,
1012,
22834,
1025,
2478,
2291,
1012,
11409,
4160,
1025,
2478,
2291,
1012,
16474,
2015,
1025,
2478,
2291,
1012,
3645,
1012,
3596,
1025,
2478,
2291,
1012,
11689,
2075,
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... |
/*
Copyright (c) 2012 Martin Sustrik All rights reserved.
Copyright 2015 Garrett D'Amore <garrett@damore.org>
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.
*/
#include "../src/grid.h"
#include "../src/pair.h"
#include "../src/pubsub.h"
#include "../src/tcp.h"
#include "testutil.h"
/* Tests TCP transport. */
#define SOCKET_ADDRESS "tcp://127.0.0.1:5555"
int sc;
int main ()
{
int rc;
int sb;
int i;
int opt;
size_t sz;
int s1, s2;
void * dummy_buf;
/* Try closing bound but unconnected socket. */
sb = test_socket (AF_SP, GRID_PAIR);
test_bind (sb, SOCKET_ADDRESS);
test_close (sb);
/* Try closing a TCP socket while it not connected. At the same time
test specifying the local address for the connection. */
sc = test_socket (AF_SP, GRID_PAIR);
test_connect (sc, "tcp://127.0.0.1;127.0.0.1:5555");
test_close (sc);
/* Open the socket anew. */
sc = test_socket (AF_SP, GRID_PAIR);
/* Check NODELAY socket option. */
sz = sizeof (opt);
rc = grid_getsockopt (sc, GRID_TCP, GRID_TCP_NODELAY, &opt, &sz);
errno_assert (rc == 0);
grid_assert (sz == sizeof (opt));
grid_assert (opt == 0);
opt = 2;
rc = grid_setsockopt (sc, GRID_TCP, GRID_TCP_NODELAY, &opt, sizeof (opt));
grid_assert (rc < 0 && grid_errno () == EINVAL);
opt = 1;
rc = grid_setsockopt (sc, GRID_TCP, GRID_TCP_NODELAY, &opt, sizeof (opt));
errno_assert (rc == 0);
sz = sizeof (opt);
rc = grid_getsockopt (sc, GRID_TCP, GRID_TCP_NODELAY, &opt, &sz);
errno_assert (rc == 0);
grid_assert (sz == sizeof (opt));
grid_assert (opt == 1);
/* Try using invalid address strings. */
rc = grid_connect (sc, "tcp://*:");
grid_assert (rc < 0);
errno_assert (grid_errno () == EINVAL);
rc = grid_connect (sc, "tcp://*:1000000");
grid_assert (rc < 0);
errno_assert (grid_errno () == EINVAL);
rc = grid_connect (sc, "tcp://*:some_port");
grid_assert (rc < 0);
rc = grid_connect (sc, "tcp://eth10000;127.0.0.1:5555");
grid_assert (rc < 0);
errno_assert (grid_errno () == ENODEV);
rc = grid_connect (sc, "tcp://127.0.0.1");
grid_assert (rc < 0);
errno_assert (grid_errno () == EINVAL);
rc = grid_bind (sc, "tcp://127.0.0.1:");
grid_assert (rc < 0);
errno_assert (grid_errno () == EINVAL);
rc = grid_bind (sc, "tcp://127.0.0.1:1000000");
grid_assert (rc < 0);
errno_assert (grid_errno () == EINVAL);
rc = grid_bind (sc, "tcp://eth10000:5555");
grid_assert (rc < 0);
errno_assert (grid_errno () == ENODEV);
rc = grid_connect (sc, "tcp://:5555");
grid_assert (rc < 0);
errno_assert (grid_errno () == EINVAL);
rc = grid_connect (sc, "tcp://-hostname:5555");
grid_assert (rc < 0);
errno_assert (grid_errno () == EINVAL);
rc = grid_connect (sc, "tcp://abc.123.---.#:5555");
grid_assert (rc < 0);
errno_assert (grid_errno () == EINVAL);
rc = grid_connect (sc, "tcp://[::1]:5555");
grid_assert (rc < 0);
errno_assert (grid_errno () == EINVAL);
rc = grid_connect (sc, "tcp://abc.123.:5555");
grid_assert (rc < 0);
errno_assert (grid_errno () == EINVAL);
rc = grid_connect (sc, "tcp://abc...123:5555");
grid_assert (rc < 0);
errno_assert (grid_errno () == EINVAL);
rc = grid_connect (sc, "tcp://.123:5555");
grid_assert (rc < 0);
errno_assert (grid_errno () == EINVAL);
/* Connect correctly. Do so before binding the peer socket. */
test_connect (sc, SOCKET_ADDRESS);
/* Leave enough time for at least on re-connect attempt. */
grid_sleep (200);
sb = test_socket (AF_SP, GRID_PAIR);
test_bind (sb, SOCKET_ADDRESS);
/* Ping-pong test. */
for (i = 0; i != 100; ++i) {
test_send (sc, "ABC");
test_recv (sb, "ABC");
test_send (sb, "DEF");
test_recv (sc, "DEF");
}
/* Batch transfer test. */
for (i = 0; i != 100; ++i) {
test_send (sc, "0123456789012345678901234567890123456789");
}
for (i = 0; i != 100; ++i) {
test_recv (sb, "0123456789012345678901234567890123456789");
}
test_close (sc);
test_close (sb);
/* Test whether connection rejection is handled decently. */
sb = test_socket (AF_SP, GRID_PAIR);
test_bind (sb, SOCKET_ADDRESS);
s1 = test_socket (AF_SP, GRID_PAIR);
test_connect (s1, SOCKET_ADDRESS);
s2 = test_socket (AF_SP, GRID_PAIR);
test_connect (s2, SOCKET_ADDRESS);
grid_sleep (100);
test_close (s2);
test_close (s1);
test_close (sb);
/* Test two sockets binding to the same address. */
sb = test_socket (AF_SP, GRID_PAIR);
test_bind (sb, SOCKET_ADDRESS);
s1 = test_socket (AF_SP, GRID_PAIR);
test_bind (s1, SOCKET_ADDRESS);
sc = test_socket (AF_SP, GRID_PAIR);
test_connect (sc, SOCKET_ADDRESS);
grid_sleep (100);
test_send (sb, "ABC");
test_recv (sc, "ABC");
test_close (sb);
test_send (s1, "ABC");
test_recv (sc, "ABC");
test_close (sc);
test_close (s1);
/* Test GRID_RCVMAXSIZE limit */
sb = test_socket (AF_SP, GRID_PAIR);
test_bind (sb, SOCKET_ADDRESS);
s1 = test_socket (AF_SP, GRID_PAIR);
test_connect (s1, SOCKET_ADDRESS);
opt = 4;
rc = grid_setsockopt (sb, GRID_SOL_SOCKET, GRID_RCVMAXSIZE, &opt, sizeof (opt));
grid_assert (rc == 0);
grid_sleep (100);
test_send (s1, "ABC");
test_recv (sb, "ABC");
test_send (s1, "0123456789012345678901234567890123456789");
rc = grid_recv (sb, &dummy_buf, GRID_MSG, GRID_DONTWAIT);
grid_assert (rc < 0);
errno_assert (grid_errno () == EAGAIN);
test_close (sb);
test_close (s1);
/* Test that GRID_RCVMAXSIZE can be -1, but not lower */
sb = test_socket (AF_SP, GRID_PAIR);
opt = -1;
rc = grid_setsockopt (sb, GRID_SOL_SOCKET, GRID_RCVMAXSIZE, &opt, sizeof (opt));
grid_assert (rc >= 0);
opt = -2;
rc = grid_setsockopt (sb, GRID_SOL_SOCKET, GRID_RCVMAXSIZE, &opt, sizeof (opt));
grid_assert (rc < 0);
errno_assert (grid_errno () == EINVAL);
test_close (sb);
/* Test closing a socket that is waiting to bind. */
sb = test_socket (AF_SP, GRID_PAIR);
test_bind (sb, SOCKET_ADDRESS);
grid_sleep (100);
s1 = test_socket (AF_SP, GRID_PAIR);
test_bind (s1, SOCKET_ADDRESS);
sc = test_socket (AF_SP, GRID_PAIR);
test_connect (sc, SOCKET_ADDRESS);
grid_sleep (100);
test_send (sb, "ABC");
test_recv (sc, "ABC");
test_close (s1);
test_send (sb, "ABC");
test_recv (sc, "ABC");
test_close (sb);
test_close (sc);
return 0;
}
| gridmq/gridmq | t/tcp.c | C | mit | 7,700 | [
30522,
1013,
1008,
9385,
1006,
1039,
1007,
2262,
3235,
10514,
3367,
15564,
2035,
2916,
9235,
1012,
9385,
2325,
9674,
1040,
1005,
26297,
1026,
9674,
1030,
5477,
5686,
1012,
8917,
1028,
6656,
2003,
2182,
3762,
4379,
1010,
2489,
1997,
3715,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\CatalogSearch\Setup;
use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
/**
* @codeCoverageIgnore
*/
class InstallSchema implements InstallSchemaInterface
{
/**
* {@inheritdoc}
*/
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$installer = $setup;
$installer->startSetup();
$installer->getConnection()->addColumn(
$installer->getTable('catalog_eav_attribute'),
'search_weight',
[
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_FLOAT,
'unsigned' => true,
'nullable' => false,
'default' => '1',
'comment' => 'Search Weight'
]
);
$installer->endSetup();
}
}
| rajmahesh/magento2-master | vendor/magento/module-catalog-search/Setup/InstallSchema.php | PHP | gpl-3.0 | 1,022 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
9385,
1075,
2355,
17454,
13663,
1012,
2035,
2916,
9235,
1012,
1008,
2156,
24731,
1012,
19067,
2102,
2005,
6105,
4751,
1012,
1008,
1013,
3415,
15327,
17454,
13663,
1032,
12105,
17310,
11140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 de.liebig.lighthouse.accounts;
import java.util.Optional;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.myjeeva.digitalocean.DigitalOcean;
import com.myjeeva.digitalocean.exception.DigitalOceanException;
import com.myjeeva.digitalocean.exception.RequestUnsuccessfulException;
import de.liebig.lighthouse.api.ApiManager;
import de.liebig.lighthouse.exceptions.ApiException;
@RestController
@RequestMapping(value = "/account", name = "AccountController")
public class AccountController {
@Autowired
AccountService accountService;
@Autowired
ApiManager apiManager;
@RequestMapping(name = "get", method = RequestMethod.GET)
public com.myjeeva.digitalocean.pojo.Account getAccount() throws ApiException {
DigitalOcean digitalOcean = apiManager.getDigitalOcean();
try {
return digitalOcean.getAccountInfo();
} catch (DigitalOceanException | RequestUnsuccessfulException e) {
throw new ApiException("Could not load account", e);
}
}
@RequestMapping(name = "create", method = RequestMethod.POST)
public Account createAccount(@RequestBody AccountDto accountDto) {
if(apiManager.isDigitalOceanApiKeyValid(accountDto.getApiKey())) {
Optional<Account> createdAccount = accountService.createAccount(accountDto.getApiKey());
if(createdAccount.isPresent()) {
apiManager.setDigitalOceanApiKey(accountDto.getApiKey());
return createdAccount.get();
}
}
return null;
}
}
| liebig/lighthouse | src/main/java/de/liebig/lighthouse/accounts/AccountController.java | Java | mit | 1,831 | [
30522,
7427,
2139,
1012,
4682,
5638,
2290,
1012,
10171,
1012,
6115,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
11887,
1025,
12324,
8917,
1012,
3500,
15643,
6198,
1012,
13435,
1012,
4713,
1012,
14068,
21450,
1025,
12324,
8917,
1012,
3500,
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... |
CollectiveAccess README
-----------------------
[](http://travis-ci.org/collectiveaccess/providence)
Thank you for downloading Providence version 1.6.2!
Version 1.6.1 is a maintenance release. A list of fixes can be found at http://clangers.collectiveaccess.org/jira/browse/PROV-1519?jql=fixVersion%20%3D%20%221.6.1%22
Providence is the “back-end” cataloging component of CollectiveAccess, a web-based suite of applications providing a framework for management, description, and discovery of complex digital and physical collections. Providence is highly configurable and supports a variety of metadata standards, data types, and media formats.
CollectiveAccess is freely available under the open source GNU Public License, meaning it’s not only free to download and use but that users are encouraged to share and distribute code.
Note that 1.6 is the first version of CollectiveAccess compatible with PHP 7.
----Useful Links:----
Web site: http://collectiveaccess.org
Documentation: http://docs.collectiveaccess.org/wiki/Main_Page
Demo: http://demo.collectiveaccess.org/
Installation instructions: http://docs.collectiveaccess.org/wiki/Installing_Providence
Upgrade instructions: http://docs.collectiveaccess.org/wiki/Upgrading_Providence
Release Notes for 1.6: http://docs.collectiveaccess.org/wiki/Release_Notes_for_Providence_1.6
Fixed in version 1.6.1: http://clangers.collectiveaccess.org/jira/browse/PROV-1519?jql=fixVersion%20%3D%20%221.6.1%22
Forum: http://www.collectiveaccess.org/support/forum
Bug Tracker: http://clangers.collectiveaccess.org/jira
----Other modules:----
Pawtucket: https://github.com/collectiveaccess/pawtucket2 (The public access front-end application for Providence)
| pro-memoria/providence | README.md | Markdown | gpl-3.0 | 1,859 | [
30522,
7268,
6305,
9623,
2015,
3191,
4168,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1031,
999,
1031,
3857,
3570,
1033,
1006,
16770,
1024,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Copyright (c) 2016-2019 by the respective copyright holders.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package com.zsmartsystems.zigbee.console.ember;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
import com.zsmartsystems.zigbee.ZigBeeNetworkManager;
import com.zsmartsystems.zigbee.dongle.ember.EmberNcp;
import com.zsmartsystems.zigbee.dongle.ember.ezsp.structure.EzspStatus;
import com.zsmartsystems.zigbee.dongle.ember.ezsp.structure.EzspValueId;
/**
* Reads or writes an NCP {@link EzspValueId}
*
* @author Chris Jackson
*
*/
public class EmberConsoleNcpValueCommand extends EmberConsoleAbstractCommand {
@Override
public String getCommand() {
return "ncpvalue";
}
@Override
public String getDescription() {
return "Read or write an NCP memory value";
}
@Override
public String getSyntax() {
return "[VALUEID] [VALUE]";
}
@Override
public String getHelp() {
return "VALUEID is the Ember NCP value enumeration\n" + "VALUE is the value to write\n"
+ "If VALUE is not defined, then the memory will be read.\n"
+ "If no arguments are supplied then all values will be displayed.";
}
@Override
public void process(ZigBeeNetworkManager networkManager, String[] args, PrintStream out)
throws IllegalArgumentException {
if (args.length > 3) {
throw new IllegalArgumentException("Incorrect number of arguments.");
}
EmberNcp ncp = getEmberNcp(networkManager);
if (args.length == 1) {
Map<EzspValueId, int[]> values = new TreeMap<>();
for (EzspValueId valueId : EzspValueId.values()) {
if (valueId == EzspValueId.UNKNOWN) {
continue;
}
values.put(valueId, ncp.getValue(valueId));
}
for (Entry<EzspValueId, int[]> value : values.entrySet()) {
out.print(String.format("%-50s", value.getKey()));
if (value.getValue() != null) {
out.print(displayValue(value.getKey(), value.getValue()));
}
out.println();
}
return;
}
EzspValueId valueId = EzspValueId.valueOf(args[1].toUpperCase());
if (args.length == 2) {
int[] value = ncp.getValue(valueId);
if (value == null) {
out.println("Error reading Ember NCP value " + valueId.toString());
} else {
out.println("Ember NCP value " + valueId.toString() + " is " + displayValue(valueId, value));
}
} else {
int[] value = parseInput(valueId, Arrays.copyOfRange(args, 2, args.length));
if (value == null) {
throw new IllegalArgumentException("Unable to convert data to value array");
}
EzspStatus response = ncp.setValue(valueId, value);
out.println("Writing Ember NCP value " + valueId.toString() + " was "
+ (response == EzspStatus.EZSP_SUCCESS ? "" : "un") + "successful.");
}
}
private String displayValue(EzspValueId valueId, int[] value) {
StringBuilder builder = new StringBuilder();
switch (valueId) {
default:
boolean first = true;
for (int intVal : value) {
if (!first) {
builder.append(' ');
}
first = false;
builder.append(String.format("%02X", intVal));
}
break;
}
return builder.toString();
}
private int[] parseInput(EzspValueId valueId, String[] args) {
int[] value = null;
switch (valueId) {
case EZSP_VALUE_APS_FRAME_COUNTER:
case EZSP_VALUE_NWK_FRAME_COUNTER:
Long longValue = Long.parseLong(args[0]);
value = new int[4];
value[0] = (int) (longValue & 0x000000FF);
value[1] = (int) (longValue & 0x0000FF00) >> 8;
value[2] = (int) (longValue & 0x00FF0000) >> 16;
value[3] = (int) (longValue & 0xFF000000) >> 24;
break;
default:
break;
}
return value;
}
}
| cschwer/com.zsmartsystems.zigbee | com.zsmartsystems.zigbee.console.ember/src/main/java/com/zsmartsystems/zigbee/console/ember/EmberConsoleNcpValueCommand.java | Java | epl-1.0 | 4,666 | [
30522,
1013,
1008,
1008,
1008,
9385,
1006,
1039,
1007,
2355,
1011,
10476,
2011,
1996,
7972,
9385,
13304,
1012,
1008,
2035,
2916,
9235,
1012,
2023,
2565,
1998,
1996,
10860,
4475,
1008,
2024,
2081,
2800,
2104,
1996,
3408,
1997,
1996,
13232,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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) on Sat Jul 30 16:24:40 CEST 2011 -->
<title>Uses of Class ch.intertec.storybook.view.manage.dnd.SceneTransferHandler</title>
<meta name="date" content="2011-07-30">
<link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class ch.intertec.storybook.view.manage.dnd.SceneTransferHandler";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../../ch/intertec/storybook/view/manage/dnd/SceneTransferHandler.html" title="class in ch.intertec.storybook.view.manage.dnd">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?ch/intertec/storybook/view/manage/dnd//class-useSceneTransferHandler.html" target="_top">Frames</a></li>
<li><a href="SceneTransferHandler.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 ch.intertec.storybook.view.manage.dnd.SceneTransferHandler" class="title">Uses of Class<br>ch.intertec.storybook.view.manage.dnd.SceneTransferHandler</h2>
</div>
<div class="classUseContainer">No usage of ch.intertec.storybook.view.manage.dnd.SceneTransferHandler</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../../ch/intertec/storybook/view/manage/dnd/SceneTransferHandler.html" title="class in ch.intertec.storybook.view.manage.dnd">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?ch/intertec/storybook/view/manage/dnd//class-useSceneTransferHandler.html" target="_top">Frames</a></li>
<li><a href="SceneTransferHandler.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>
| tmhorne/storybook | doc/javadoc/ch/intertec/storybook/view/manage/dnd/class-use/SceneTransferHandler.html | HTML | gpl-3.0 | 4,471 | [
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... |
#! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
import re
from waflib import Utils,Task,TaskGen,Logs
from waflib.TaskGen import feature,before_method,after_method,extension
from waflib.Configure import conf
INC_REGEX="""(?:^|['">]\s*;)\s*(?:|#\s*)INCLUDE\s+(?:\w+_)?[<"'](.+?)(?=["'>])"""
USE_REGEX="""(?:^|;)\s*USE(?:\s+|(?:(?:\s*,\s*(?:NON_)?INTRINSIC)?\s*::))\s*(\w+)"""
MOD_REGEX="""(?:^|;)\s*MODULE(?!\s*PROCEDURE)(?:\s+|(?:(?:\s*,\s*(?:NON_)?INTRINSIC)?\s*::))\s*(\w+)"""
re_inc=re.compile(INC_REGEX,re.I)
re_use=re.compile(USE_REGEX,re.I)
re_mod=re.compile(MOD_REGEX,re.I)
class fortran_parser(object):
def __init__(self,incpaths):
self.seen=[]
self.nodes=[]
self.names=[]
self.incpaths=incpaths
def find_deps(self,node):
txt=node.read()
incs=[]
uses=[]
mods=[]
for line in txt.splitlines():
m=re_inc.search(line)
if m:
incs.append(m.group(1))
m=re_use.search(line)
if m:
uses.append(m.group(1))
m=re_mod.search(line)
if m:
mods.append(m.group(1))
return(incs,uses,mods)
def start(self,node):
self.waiting=[node]
while self.waiting:
nd=self.waiting.pop(0)
self.iter(nd)
def iter(self,node):
path=node.abspath()
incs,uses,mods=self.find_deps(node)
for x in incs:
if x in self.seen:
continue
self.seen.append(x)
self.tryfind_header(x)
for x in uses:
name="USE@%s"%x
if not name in self.names:
self.names.append(name)
for x in mods:
name="MOD@%s"%x
if not name in self.names:
self.names.append(name)
def tryfind_header(self,filename):
found=None
for n in self.incpaths:
found=n.find_resource(filename)
if found:
self.nodes.append(found)
self.waiting.append(found)
break
if not found:
if not filename in self.names:
self.names.append(filename)
| asljivo1/802.11ah-ns3 | ns-3/.waf-1.8.12-f00e5b53f6bbeab1384a38c9cc5d51f7/waflib/Tools/fc_scan.py | Python | gpl-2.0 | 1,859 | [
30522,
1001,
999,
1013,
2149,
2099,
1013,
8026,
1013,
4372,
2615,
18750,
1001,
17181,
1024,
21183,
2546,
1011,
1022,
1001,
5432,
999,
2079,
2025,
10086,
999,
16770,
1024,
1013,
1013,
11333,
2546,
1012,
22834,
1013,
2338,
1013,
5950,
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... |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.ecs;
import java.io.Closeable;
import org.jclouds.ecs.features.InstanceApi;
import org.jclouds.ecs.features.ServerApi;
import org.jclouds.ecs.features.ServerImageApi;
import org.jclouds.rest.annotations.Delegate;
import com.google.common.base.Optional;
/**
* Provides access to EC2 features, broken up by feature group. Use of the
* {@link Optional} type allows you to check to see if the underlying
* implementation supports a particular feature before attempting to use it.
* This is useful in clones like OpenStack, CloudStack, or Eucalyptus, which
* track the api, but are always behind Amazon's service. In the case of Amazon
* ({@code aws-ec2}), you can expect all features to be present.
*
*
* Example
*
* <pre>
* Optional<? extends WindowsApi> windowsOption = ec2Api.getWindowsApi();
* checkState(windowsOption.isPresent(),
* "windows feature required, but not present");
* </pre>
*/
public interface EcsApi extends Closeable {
/**
* Provides synchronous access to Windows features.
*/
@Delegate
Optional<? extends InstanceApi> getInstanceApi();
@Delegate
Optional<? extends ServerImageApi> getServerImageApi();
@Delegate
Optional<? extends ServerApi> getServerApi();
}
| yanzhijun/jclouds-aliyun | apis/ecs/src/main/java/org/jclouds/ecs/EcsApi.java | Java | apache-2.0 | 2,056 | [
30522,
1013,
1008,
1008,
7000,
2000,
30524,
1016,
1012,
1014,
1008,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
12646,
2007,
1008,
1996,
6105,
1012,
2017,
2089,
6855,
1037,
6100,
1997,
1996,
6... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
## Available Agents
| Name | Implementation | Observation Space | Action Space |
| ---------------------- |------------------------| -------------------| ---------------|
| [DQN](/agents/dqn) | `rl.agents.DQNAgent` | discrete or continuous | discrete |
| [DDPG](/agents/ddpg) | `rl.agents.DDPGAgent` | discrete or continuous | continuous |
| [NAF](/agents/naf) | `rl.agents.NAFAgent` | discrete or continuous | continuous |
| [CEM](/agents/cem) | `rl.agents.CEMAgent` | discrete or continuous | discrete |
| [SARSA](/agents/sarsa) | `rl.agents.SARSAAgent` | discrete or continuous | discrete |
---
## Common API
All agents share a common API. This allows you to easily switch between different agents.
That being said, keep in mind that some agents make assumptions regarding the action space, i.e. assume discrete
or continuous actions.
<span style="float:right;">[[source]](https://github.com/keras-rl/keras-rl/blob/master/rl/core.py#L44)</span>
### fit
```python
fit(self, env, nb_steps, action_repetition=1, callbacks=None, verbose=1, visualize=False, nb_max_start_steps=0, start_step_policy=None, log_interval=10000, nb_max_episode_steps=None)
```
Trains the agent on the given environment.
__Arguments__
- __env:__ (`Env` instance): Environment that the agent interacts with. See [Env](#env) for details.
- __nb_steps__ (integer): Number of training steps to be performed.
- __action_repetition__ (integer): Number of times the agent repeats the same action without
observing the environment again. Setting this to a value > 1 can be useful
if a single action only has a very small effect on the environment.
- __callbacks__ (list of `keras.callbacks.Callback` or `rl.callbacks.Callback` instances):
List of callbacks to apply during training. See [callbacks](/callbacks) for details.
- __verbose__ (integer): 0 for no logging, 1 for interval logging (compare `log_interval`), 2 for episode logging
- __visualize__ (boolean): If `True`, the environment is visualized during training. However,
this is likely going to slow down training significantly and is thus intended to be
a debugging instrument.
- __nb_max_start_steps__ (integer): Number of maximum steps that the agent performs at the beginning
of each episode using `start_step_policy`. Notice that this is an upper limit since
the exact number of steps to be performed is sampled uniformly from [0, max_start_steps]
at the beginning of each episode.
- __start_step_policy__ (`lambda observation: action`): The policy
to follow if `nb_max_start_steps` > 0. If set to `None`, a random action is performed.
- __log_interval__ (integer): If `verbose` = 1, the number of steps that are considered to be an interval.
- __nb_max_episode_steps__ (integer): Number of steps per episode that the agent performs before
automatically resetting the environment. Set to `None` if each episode should run
(potentially indefinitely) until the environment signals a terminal state.
__Returns__
A `keras.callbacks.History` instance that recorded the entire training process.
----
<span style="float:right;">[[source]](https://github.com/keras-rl/keras-rl/blob/master/rl/core.py#L231)</span>
### test
```python
test(self, env, nb_episodes=1, action_repetition=1, callbacks=None, visualize=True, nb_max_episode_steps=None, nb_max_start_steps=0, start_step_policy=None, verbose=1)
```
Callback that is called before training begins."
----
<span style="float:right;">[[source]](https://github.com/keras-rl/keras-rl/blob/master/rl/core.py#L391)</span>
### compile
```python
compile(self, optimizer, metrics=[])
```
Compiles an agent and the underlaying models to be used for training and testing.
__Arguments__
- __optimizer__ (`keras.optimizers.Optimizer` instance): The optimizer to be used during training.
- __metrics__ (list of functions `lambda y_true, y_pred: metric`): The metrics to run during training.
----
<span style="float:right;">[[source]](https://github.com/keras-rl/keras-rl/blob/master/rl/core.py#L39)</span>
### get_config
```python
get_config(self)
```
Configuration of the agent for serialization.
----
<span style="float:right;">[[source]](https://github.com/keras-rl/keras-rl/blob/master/rl/core.py#L364)</span>
### reset_states
```python
reset_states(self)
```
Resets all internally kept states after an episode is completed.
----
<span style="float:right;">[[source]](https://github.com/keras-rl/keras-rl/blob/master/rl/core.py#L400)</span>
### load_weights
```python
load_weights(self, filepath)
```
Loads the weights of an agent from an HDF5 file.
__Arguments__
- __filepath__ (str): The path to the HDF5 file.
----
<span style="float:right;">[[source]](https://github.com/keras-rl/keras-rl/blob/master/rl/core.py#L408)</span>
### save_weights
```python
save_weights(self, filepath, overwrite=False)
```
Saves the weights of an agent as an HDF5 file.
__Arguments__
- __filepath__ (str): The path to where the weights should be saved.
- __overwrite__ (boolean): If `False` and `filepath` already exists, raises an error.
| matthiasplappert/keras-rl | docs/sources/agents/overview.md | Markdown | mit | 5,124 | [
30522,
1001,
1001,
2800,
6074,
1064,
2171,
1064,
7375,
1064,
8089,
2686,
1064,
2895,
2686,
1064,
1064,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_HADDOCK show-extensions #-}
-- |
-- Module : Yi.Keymap.Vim.Ex.Commands.Edit
-- License : GPL-2
-- Maintainer : yi-devel@googlegroups.com
-- Stability : experimental
-- Portability : portable
--
-- Implements quit commands.
module Yi.Keymap.Vim.Ex.Commands.Edit (parse) where
import Control.Applicative
import Control.Monad
import qualified Data.Text as T
import qualified Text.ParserCombinators.Parsec as P
import Yi.Editor
import Yi.File
import Yi.Keymap
import Yi.Keymap.Vim.Common
import qualified Yi.Keymap.Vim.Ex.Commands.Common as Common
import Yi.Keymap.Vim.Ex.Types
parse :: EventString -> Maybe ExCommand
parse = Common.parse $ do
tab <- P.many (P.string "tab")
void $ P.try ( P.string "edit") <|> P.string "e"
void $ P.many1 P.space
filename <- T.pack <$> P.many1 P.anyChar
return $! edit (not (null tab)) filename
edit :: Bool -> T.Text -> ExCommand
edit tab f = Common.impureExCommand {
cmdShow = showEdit tab f
, cmdAction = YiA $ do
when tab $ withEditor newTabE
void . editFile $ T.unpack f
, cmdComplete = (fmap . fmap)
(showEdit tab) (Common.filenameComplete f)
}
showEdit :: Bool -> T.Text -> T.Text
showEdit tab f = (if tab then "tab" else "") `T.append` "edit " `T.append` f
| atsukotakahashi/wi | src/library/Yi/Keymap/Vim/Ex/Commands/Edit.hs | Haskell | gpl-2.0 | 1,401 | [
30522,
1063,
1011,
1001,
2653,
2058,
17468,
3367,
4892,
2015,
1001,
1011,
1065,
1063,
1011,
1001,
7047,
1035,
2018,
14647,
2265,
1011,
14305,
1001,
1011,
1065,
1011,
1011,
1064,
1011,
1011,
11336,
1024,
12316,
1012,
3145,
2863,
2361,
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) 2013 Steve Jin. All Rights Reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of VMware, Inc. nor the names of its contributors may be used
to endorse or promote products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL VMWARE, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
================================================================================*/
package com.vmware.vim25;
/**
* @author Steve Jin (http://www.doublecloud.org)
* @version 5.1
*/
public class ArrayOfIpPoolManagerIpAllocation {
public IpPoolManagerIpAllocation[] IpPoolManagerIpAllocation;
public IpPoolManagerIpAllocation[] getIpPoolManagerIpAllocation() {
return this.IpPoolManagerIpAllocation;
}
public IpPoolManagerIpAllocation getIpPoolManagerIpAllocation(int i) {
return this.IpPoolManagerIpAllocation[i];
}
public void setIpPoolManagerIpAllocation(IpPoolManagerIpAllocation[] IpPoolManagerIpAllocation) {
this.IpPoolManagerIpAllocation = IpPoolManagerIpAllocation;
}
} | n4ybn/yavijava | src/main/java/com/vmware/vim25/ArrayOfIpPoolManagerIpAllocation.java | Java | bsd-3-clause | 2,294 | [
30522,
1013,
1008,
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... |
/* eslint-disable security/detect-object-injection */
const path = require("path").posix;
const { calculateInstability, metricsAreCalculable } = require("../module-utl");
const {
getAfferentCouplings,
getEfferentCouplings,
getParentFolders,
object2Array,
} = require("./utl");
function upsertCouplings(pAllDependents, pNewDependents) {
pNewDependents.forEach((pNewDependent) => {
pAllDependents[pNewDependent] = pAllDependents[pNewDependent] || {
count: 0,
};
pAllDependents[pNewDependent].count += 1;
});
}
function upsertFolderAttributes(pAllMetrics, pModule, pDirname) {
pAllMetrics[pDirname] = pAllMetrics[pDirname] || {
dependencies: {},
dependents: {},
moduleCount: 0,
};
upsertCouplings(
pAllMetrics[pDirname].dependents,
getAfferentCouplings(pModule, pDirname)
);
upsertCouplings(
pAllMetrics[pDirname].dependencies,
getEfferentCouplings(pModule, pDirname).map(
(pDependency) => pDependency.resolved
)
);
pAllMetrics[pDirname].moduleCount += 1;
return pAllMetrics;
}
function aggregateToFolder(pAllFolders, pModule) {
getParentFolders(path.dirname(pModule.source)).forEach((pParentDirectory) =>
upsertFolderAttributes(pAllFolders, pModule, pParentDirectory)
);
return pAllFolders;
}
function sumCounts(pAll, pCurrent) {
return pAll + pCurrent.count;
}
function getFolderLevelCouplings(pCouplingArray) {
return Array.from(
new Set(
pCouplingArray.map((pCoupling) =>
path.dirname(pCoupling.name) === "."
? pCoupling.name
: path.dirname(pCoupling.name)
)
)
).map((pCoupling) => ({ name: pCoupling }));
}
function calculateFolderMetrics(pFolder) {
const lModuleDependents = object2Array(pFolder.dependents);
const lModuleDependencies = object2Array(pFolder.dependencies);
// this calculation might look superfluous (why not just .length the dependents
// and dependencies?), but it isn't because there can be > 1 relation between
// two folders
const lAfferentCouplings = lModuleDependents.reduce(sumCounts, 0);
const lEfferentCouplings = lModuleDependencies.reduce(sumCounts, 0);
return {
...pFolder,
afferentCouplings: lAfferentCouplings,
efferentCouplings: lEfferentCouplings,
instability: calculateInstability(lEfferentCouplings, lAfferentCouplings),
dependents: getFolderLevelCouplings(lModuleDependents),
dependencies: getFolderLevelCouplings(lModuleDependencies),
};
}
function findFolderByName(pAllFolders, pName) {
return pAllFolders.find((pFolder) => pFolder.name === pName);
}
function denormalizeInstability(pFolder, _, pAllFolders) {
return {
...pFolder,
dependencies: pFolder.dependencies.map((pDependency) => {
const lFolder = findFolderByName(pAllFolders, pDependency.name) || {};
return {
...pDependency,
instability: lFolder.instability >= 0 ? lFolder.instability : 0,
};
}),
};
}
module.exports = function aggregateToFolders(pModules) {
const lFolders = object2Array(
pModules.filter(metricsAreCalculable).reduce(aggregateToFolder, {})
).map(calculateFolderMetrics);
return lFolders.map(denormalizeInstability);
};
| sverweij/dependency-cruiser | src/enrich/derive/folders/aggregate-to-folders.js | JavaScript | mit | 3,202 | [
30522,
1013,
1008,
9686,
4115,
2102,
1011,
4487,
19150,
3036,
1013,
11487,
1011,
4874,
1011,
13341,
1008,
1013,
9530,
3367,
4130,
1027,
5478,
1006,
1000,
4130,
1000,
1007,
1012,
13433,
5332,
2595,
1025,
9530,
3367,
1063,
18422,
7076,
2696,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 POINT_H
#define POINT_H
#include <string>
using namespace std;
class Point {
public:
Point(string line);
Point(double x, double y);
void setX(double x);
void setY(double y);
double getX();
double getY();
private:
double x;
double y;
};
#endif | mikehelmick/teaching | uc/computerScience1/materials/labs/lab11/Point.h | C | mit | 275 | [
30522,
1001,
2065,
13629,
2546,
2391,
1035,
1044,
1001,
9375,
2391,
1035,
1044,
1001,
2421,
1026,
5164,
1028,
2478,
3415,
15327,
2358,
2094,
1025,
2465,
2391,
1063,
2270,
1024,
2391,
1006,
5164,
2240,
1007,
1025,
2391,
1006,
3313,
1060,
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... |
#!/bin/sh
# CYBERWATCH SAS - 2016
#
# Security fix for RHSA-2012:1169
#
# Security announcement date: 2012-08-14 18:15:46 UTC
# Script generation date: 2016-05-12 18:10:56 UTC
#
# Operating System: Red Hat 6
# Architecture: x86_64
#
# Vulnerable packages fix on version:
# - condor.x86_64:7.6.5-0.14.2.el6_3
# - condor-classads.x86_64:7.6.5-0.14.2.el6_3
# - condor-debuginfo.x86_64:7.6.5-0.14.2.el6_3
# - condor-kbdd.x86_64:7.6.5-0.14.2.el6_3
# - condor-qmf.x86_64:7.6.5-0.14.2.el6_3
# - condor-vm-gahp.x86_64:7.6.5-0.14.2.el6_3
# - condor-aviary.x86_64:7.6.5-0.14.2.el6_3
# - condor-deltacloud-gahp.x86_64:7.6.5-0.14.2.el6_3
# - condor-plumage.x86_64:7.6.5-0.14.2.el6_3
#
# Last versions recommanded by security team:
# - condor.x86_64:7.8.10-0.2.el6
# - condor-classads.x86_64:7.8.10-0.2.el6
# - condor-debuginfo.x86_64:7.8.10-0.2.el6
# - condor-kbdd.x86_64:7.8.10-0.2.el6
# - condor-qmf.x86_64:7.8.10-0.2.el6
# - condor-vm-gahp.x86_64:7.8.10-0.2.el6
# - condor-aviary.x86_64:7.8.10-0.2.el6
# - condor-deltacloud-gahp.x86_64:7.8.10-0.2.el6
# - condor-plumage.x86_64:7.8.10-0.2.el6
#
# CVE List:
# - CVE-2012-3416
#
# More details:
# - https://www.cyberwatch.fr/vulnerabilites
#
# Licence: Released under The MIT License (MIT), See LICENSE FILE
sudo yum install condor.x86_64-7.8.10 -y
sudo yum install condor-classads.x86_64-7.8.10 -y
sudo yum install condor-debuginfo.x86_64-7.8.10 -y
sudo yum install condor-kbdd.x86_64-7.8.10 -y
sudo yum install condor-qmf.x86_64-7.8.10 -y
sudo yum install condor-vm-gahp.x86_64-7.8.10 -y
sudo yum install condor-aviary.x86_64-7.8.10 -y
sudo yum install condor-deltacloud-gahp.x86_64-7.8.10 -y
sudo yum install condor-plumage.x86_64-7.8.10 -y
| Cyberwatch/cbw-security-fixes | Red_Hat_6/x86_64/2012/RHSA-2012:1169.sh | Shell | mit | 1,735 | [
30522,
1001,
999,
1013,
8026,
1013,
14021,
1001,
16941,
18866,
21871,
1011,
2355,
1001,
1001,
3036,
8081,
2005,
1054,
7898,
2050,
1011,
2262,
1024,
12904,
2683,
1001,
1001,
3036,
8874,
3058,
1024,
2262,
1011,
5511,
1011,
2403,
2324,
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... |
/*
Copyright 2014 The Kubernetes 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.
*/
package api
import (
"github.com/FlorianOtel/client-go/pkg/runtime"
"github.com/FlorianOtel/client-go/pkg/runtime/schema"
)
// SchemeGroupVersion is group version used to register these objects
// TODO this should be in the "kubeconfig" group
var SchemeGroupVersion = schema.GroupVersion{Group: "", Version: runtime.APIVersionInternal}
var (
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
AddToScheme = SchemeBuilder.AddToScheme
)
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&Config{},
)
return nil
}
func (obj *Config) GetObjectKind() schema.ObjectKind { return obj }
func (obj *Config) SetGroupVersionKind(gvk schema.GroupVersionKind) {
obj.APIVersion, obj.Kind = gvk.ToAPIVersionAndKind()
}
func (obj *Config) GroupVersionKind() schema.GroupVersionKind {
return schema.FromAPIVersionAndKind(obj.APIVersion, obj.Kind)
}
| FlorianOtel/k8s-client | vendor/github.com/FlorianOtel/client-go/tools/clientcmd/api/register.go | GO | apache-2.0 | 1,468 | [
30522,
1013,
1008,
9385,
2297,
1996,
13970,
5677,
7159,
2229,
6048,
1012,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
12646,
2007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using UnityEngine;
public class SimInit : MonoBehaviour
{
public int MaxMolecules = 500;
public GameObject MoleculeAPrefab;
public GameObject Walls;
public void Start()
{
for ( var i = 0; i < MaxMolecules; i++ ) {
Vector3 pos = new Vector3(
Random.Range( -9, 9 ) + ( Random.Range( 0, 1000 ) / 1000 ),
Random.Range( -9, 9 ) + ( Random.Range( 0, 1000 ) / 1000 ),
0 );
Instantiate( MoleculeAPrefab, pos, Quaternion.identity );
}
}
public void Update()
{
if ( Input.anyKeyDown ) {
Walls.SetActive( !Walls.activeInHierarchy );
}
}
}
| Fortyseven/Brownian | Assets/SimInit.cs | C# | mit | 712 | [
30522,
2478,
8499,
13159,
3170,
1025,
2270,
2465,
28684,
3490,
2102,
1024,
18847,
4783,
3270,
25500,
3126,
1063,
2270,
20014,
4098,
5302,
2571,
21225,
2015,
1027,
3156,
1025,
2270,
2208,
16429,
20614,
13922,
9331,
2890,
7011,
2497,
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... |
! =====================================================================================
! BADLANDS (BAsin anD LANdscape DynamicS)
!
! Copyright (c) Tristan Salles (The University of Sydney)
!
! This program is free software; you can redistribute it and/or modify it under
! the terms of the GNU Lesser General Public License as published by the Free Software
! Foundation; either version 3.0 of the License, or (at your option) any later
! version.
!
! This 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 Lesser General Public License for
! more details.
!
! You should have received a copy of the GNU Lesser 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
! =====================================================================================
! =====================================================================================
!
! Filename: WaveModel.f90
!
! Description: SWAN wave model.
!
! Version: 1.0
! Created: 06/10/15 20:02:47
! Revision: none
!
! Author: Tristan Salles
!
! =====================================================================================
module wave_model
use parallel
use topology
use parameters
use external_forces
use ocean_circ
use swan_coupler_export
use swan_coupler_parallel
use swan_coupler_functions
implicit none
real,dimension(6)::hcast
type(badlands_WADecomp),dimension(:),allocatable::wdcp
contains
! =====================================================================================
subroutine wave_initialisation
if(waveON==0) return
call swan_createinput
call swan_initialize(badlands_world,swaninput(1:80),swaninfo(1:80))
if(allocated(wdcp)) deallocate(wdcp)
allocate(wdcp(npets))
call swan_decomposition_grid(npets,wdcp)
if(allocated(waveU)) deallocate(waveU)
allocate(waveU(nx+2,ny+2,season))
if(allocated(waveV)) deallocate(waveV)
allocate(waveV(nx+2,ny+2,season))
return
end subroutine wave_initialisation
! ============================================================================
subroutine wave_update_bathymetry
integer::p,ic,jc,ii,jj,ks,i,j
real,dimension(nx,ny)::tempZ
if(waveON==0) return
! Read changes in topographic regular grid.
p=0
jc=1
ic=0
tempZ=0.
do j=1,ny+2
do i=1,nx+2
p=p+1
if(i>1.and.i<nx+2.and.j>1.and.j<ny+2)then
ic=ic+1
tempZ(ic,jc)=real(rcoordZ(p))
if(i==nx+1)then
ic=0
jc=jc+1
endif
endif
enddo
enddo
! Get bathymetry from badlands
ii=0
ks=pet_id+1
bathyfield=0.
do i=wdcp(ks)%minX_id,wdcp(ks)%maxX_id
ii=ii+1
jj=0
do j=wdcp(ks)%minY_id,wdcp(ks)%maxY_id
jj=jj+1
bathyfield(ii,jj)=real(gsea%actual_sea)-tempZ(i,j)
if(bathyfield(ii,jj)<0.) bathyfield(ii,jj)=-999999.0
if(bathyfield(ii,jj)>wavebase) bathyfield(ii,jj)=-999999.0
enddo
enddo
return
end subroutine wave_update_bathymetry
! ============================================================================
subroutine swan_createinput
integer::ios,iu
real::mx_x,mx_y
character(len=128)::stg1,stg2
! Create the input for SWAN simulation
swaninput='swan.swn'
call noblnk(swaninput)
call addpath1(swaninput)
swaninfo='swanInfo'
call noblnk(swaninfo)
call addpath1(swaninfo)
swanbot='swan.bot'
call noblnk(swanbot)
call addpath1(swanbot)
swanout='swan.csv'
call noblnk(swanout)
call addpath2(swanout)
if(pet_id==0)then
iu=342
mx_x=real(dx)*(nx-1)
mx_y=real(dx)*(ny-1)
open(iu,file=swaninput,status="replace",action="write",iostat=ios)
write(iu,'(a17)') "PROJECT ' ' 'S01' "
write(iu,102) "CGRID REG",minx,miny,0,mx_x,mx_y,nx-1,ny-1,"CIRCLE 36 0.05 1.0"
102 format(a9,1x,f12.3,1x,f12.3,1x,i1,1x,f12.3,1x,f12.3,1x,i4,1x,i4,1x,a19)
write(iu,103) "INPGRID BOTTOM REG",minx,miny,0,1,1,mx_x,mx_y,'EXC -999999.000'
103 format(a18,1x,f12.3,1x,f12.3,1x,i1,1x,i1,1x,i1,1x,f12.3,1x,f12.3,1x,a15)
stg1="READINP BOTTOM 1 '"
call append_str2(stg1,swanbot)
stg2="' 3 0 FREE"
call append_str2(stg1,stg2)
write(iu,*)trim(stg1)
write(iu,'(a42)') "BOUNd SHAPESPEC JONSWAP 3.3 PEAK DSPR DEGR"
write(iu,'(a7)') 'DIFFRAC'
write(iu,'(a8)') 'FRICTION'
! write(iu,'(a26)') 'BREAKING CONSTANT 1.1 0.73'
! write(iu,'(a8)') 'WCAPPING'
! write(iu,'(a8)') 'OFF QUAD'
write(iu,'(a4)') 'GEN1'
! write(iu,'(a4)') 'QUAD'
! write(iu,'(a10)') 'GEN3 AGROW'
! write(iu,'(a10)') 'OFF BNDCHK'
write(iu,'(a15,1x,i1,1x,i4,1x,i1,1x,i4)')"GROUP 'gf' SUBG",0,nx-1,0,ny-1
stg1="TABLE 'gf' IND '"
call append_str2(stg1,swanout)
stg2="' XP YP DIR UBOT" !HS PER WLEN UBOT"
call append_str2(stg1,stg2)
write(iu,*)trim(stg1)
write(iu,'(a5,2f12.3)') 'WIND ',forecast_param(5:6)
! write(iu,'(a9,4f12.3)')'INIT PAR ',forecast_param(1:4)
write(iu,'(a7)') 'COMPUTE'
close(iu)
open(iu,file=swanbot,status="replace",action="write",iostat=ios)
write(iu,'(a6)')'-1 -1'
write(iu,'(a6)')'-1 -1'
close(iu)
endif
call mpi_barrier(badlands_world,rc)
return
end subroutine swan_createinput
! ============================================================================
subroutine waves_circulation_run(sgp)
integer::sgp
if(waveON==0) return
! Define forcing waves parameters
call import_bathymetry
hcast(1:6)=forecast_param(1:6)
call swan_run(hcast)
call get_wave_velocity(sgp)
return
end subroutine waves_circulation_run
! ============================================================================
subroutine get_wave_velocity(sgp)
integer::i,j,xo,yo,x1,y1,xpart,ypart,ii,jj,p,sgp
real::pp
real,dimension(nx,ny)::velwaveV,velwaveU
real,dimension(nx*ny)::tempU,tempV,gtempU,gtempV
xo=wdcp(pet_id+1)%minX_id
yo=wdcp(pet_id+1)%minY_id
x1=wdcp(pet_id+1)%maxX_id
y1=wdcp(pet_id+1)%maxY_id
xpart=wdcp(pet_id+1)%X_nb
ypart=wdcp(pet_id+1)%Y_nb
pp=4.*atan(1.)
do i=1,xpart
do j=1,ypart
! Wave orbital velocity
if(bathyfield(i,j)<0) exportSWANfields(i,j,1)=0.0
if(bathyfield(i,j)<0) exportSWANfields(i,j,2)=0.0
enddo
enddo
ii=0
velwaveU=0.
velwaveV=0.
do i=xo,x1
ii=ii+1
jj=0
do j=yo,y1
jj=jj+1
velwaveU(i,j)=exportSWANfields(ii,jj,1)
velwaveV(i,j)=exportSWANfields(ii,jj,2)
enddo
enddo
tempU=-1.e8
tempV=-1000.
p=0
do i=1,nx
do j=1,ny
p=p+1
tempU(p)=velwaveU(i,j)
tempV(p)=velwaveV(i,j)
enddo
enddo
call mpi_allreduce(tempU,gtempU,nx*ny,real_type,max_type,badlands_world,rc)
call mpi_allreduce(tempV,gtempV,nx*ny,real_type,max_type,badlands_world,rc)
p=0
do i=1,nx+2
do j=1,ny+2
if(i>1.and.i<nx+2.and.j>1.and.j<ny+2)then
p=p+1
if(gtempU(p)>0.0)then
waveU(i,j,sgp)=real(gtempU(p)*cos(gtempV(p)*pp/180.))
waveV(i,j,sgp)=real(gtempU(p)*sin(gtempV(p)*pp/180.))
else
waveU(i,j,sgp)=0.
waveV(i,j,sgp)=0.
endif
endif
enddo
enddo
! Update border
waveU(2:nx+1,1,sgp)=waveU(2:nx+1,2,sgp)
waveU(2:nx+1,ny+2,sgp)=waveU(2:nx+1,ny+1,sgp)
waveU(1,2:ny+1,sgp)=waveU(2,2:ny+1,sgp)
waveU(nx+2,2:ny+1,sgp)=waveU(nx+1,2:ny+1,sgp)
waveV(2:nx+1,1,sgp)=waveV(2:nx+1,2,sgp)
waveV(2:nx+1,ny+2,sgp)=waveV(2:nx+1,ny+1,sgp)
waveV(1,2:ny+1,sgp)=waveV(2,2:ny+1,sgp)
waveV(nx+2,2:ny+1,sgp)=waveV(nx+1,2:ny+1,sgp)
! Update corner
waveU(1,1,sgp)=waveU(2,2,sgp)
waveU(1,ny+2,sgp)=waveU(2,ny+1,sgp)
waveU(nx+2,1,sgp)=waveU(nx+1,2,sgp)
waveU(nx+2,ny+2,sgp)=waveU(nx+1,ny+1,sgp)
waveV(1,1,sgp)=waveV(2,2,sgp)
waveV(1,ny+2,sgp)=waveV(2,ny+1,sgp)
waveV(nx+2,1,sgp)=waveV(nx+1,2,sgp)
waveV(nx+2,ny+2,sgp)=waveV(nx+1,ny+1,sgp)
return
end subroutine get_wave_velocity
! =====================================================================================
end module wave_model
| badlands-model/badlands | OceanCirc/WaveModel.f90 | FORTRAN | lgpl-3.0 | 8,699 | [
30522,
999,
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,
1027,
1027... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
from __future__ import absolute_import
from sentry.models import Activity
from .mail import ActivityMailDebugView
class DebugUnassignedEmailView(ActivityMailDebugView):
def get_activity(self, request, event):
return {"type": Activity.UNASSIGNED, "user": request.user}
| mvaled/sentry | src/sentry/web/frontend/debug/debug_unassigned_email.py | Python | bsd-3-clause | 284 | [
30522,
2013,
1035,
1035,
2925,
1035,
1035,
12324,
7619,
1035,
12324,
2013,
2741,
2854,
1012,
4275,
12324,
4023,
2013,
1012,
5653,
12324,
4023,
21397,
3207,
8569,
2290,
8584,
2465,
2139,
8569,
12734,
12054,
23773,
14728,
21397,
8584,
1006,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
cask 'sqlworkbenchj' do
version '124'
sha256 '2173c7f00172bef3fed23e7f57e168a9d156c72c311af032ba469139f80d9fe9'
url "http://www.sql-workbench.net/Workbench-Build#{version}-Mac.tgz"
appcast 'http://www.sql-workbench.net/wb_news.xml'
name 'SQL Workbench/J'
homepage 'https://www.sql-workbench.net/'
app 'SQLWorkbenchJ.app'
caveats do
depends_on_java
end
end
| jawshooah/homebrew-cask | Casks/sqlworkbenchj.rb | Ruby | bsd-2-clause | 381 | [
30522,
25222,
2243,
1005,
29296,
6198,
10609,
2818,
3501,
1005,
2079,
2544,
1005,
13412,
1005,
21146,
17788,
2575,
1005,
20335,
2509,
2278,
2581,
2546,
8889,
16576,
2475,
4783,
2546,
2509,
25031,
21926,
2063,
2581,
2546,
28311,
2063,
16048,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# $Id: orders_returns.php $
# TomatoCart Open Source Shopping Cart Solutions
# http://www.tomatocart.com
#
# Copyright (c) 2009 Wuxi Elootec Technology Co., Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License v2 (1991)
# as published by the Free Software Foundation.
heading_title = Return Requests
operation_heading_order_id = Order ID
operation_heading_customer_id = Customer ID
all_status = -- All Status --
table_heading_return_id = Return ID
table_heading_orders_id = Order ID
table_heading_returned_qty = Qty
table_heading_orders_returns_customers = Customers
table_heading_date_added = Date Added
table_heading_admin_comments = Comments
table_heading_status = Status
table_heading_action = Action
section_customers_heading = Customer Information
section_products_heading = Products
section_comments_heading = Comments
field_products = Products:
field_customer = Customer:
field_date = Date:
field_status = Status:
field_comment = Comment:
field_customer_comment = Customer Comment:
field_restock_product_quantity = Restock Product Quantity?
store_orders_returns_number = Return ID: #%s
action_heading_credit_slip = Create Credit Slip
action_heading_store_credit = Create Store Credit
field_sub_total = Sub Total:
field_shipping_fee = Shipping Fee:
field_handling = Handling:
field_store_credit = Store Credit:
field_credit_slip_title = Please fill in the following information for the credit slip.
field_store_credit_title = Please fill in the following information for the store credit.
error_return_quantity_incorrect = The return quantity for <b>%s</b> is incorrect, please check the return history for of order. | ZoilaFlores/Tienda | tomato/TOMATOCART/es_ES/TomatoCart/admin/includes/languages/en_US/orders_returns.php | PHP | gpl-3.0 | 1,712 | [
30522,
1001,
1002,
8909,
1024,
4449,
1035,
5651,
1012,
25718,
1002,
1001,
20856,
10010,
2102,
2330,
3120,
6023,
11122,
7300,
1001,
8299,
1024,
1013,
1013,
7479,
1012,
20856,
10010,
2102,
1012,
4012,
1001,
1001,
9385,
1006,
1039,
1007,
2268,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
# Amomum macrospermum Sm. SPECIES
#### Status
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | mdoering/backbone | life/Plantae/Magnoliophyta/Liliopsida/Zingiberales/Zingiberaceae/Aframomum/Aframomum alboviolaceum/ Syn. Amomum macrospermum/README.md | Markdown | apache-2.0 | 180 | [
30522,
1001,
2572,
5358,
2819,
26632,
17668,
27147,
15488,
1012,
2427,
1001,
1001,
1001,
1001,
3570,
10675,
1001,
1001,
1001,
1001,
2429,
2000,
1996,
10161,
1997,
2166,
1010,
3822,
2254,
2249,
1001,
1001,
1001,
1001,
2405,
1999,
19701,
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... |
<?php
namespace TYPO3\CMS\Rtehtmlarea;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Base extension class which generates the folder tree.
* Used directly by the RTE.
*
* @author Kasper Skårhøj <kasperYYYY@typo3.com>
*/
class FolderTree extends \localFolderTree {
/**
* Wrapping the title in a link, if applicable.
*
* @param string $title Title, ready for output.
* @param \TYPO3\CMS\Core\Resource\Folder $folderObject The "record"
* @return string Wrapping title string.
* @todo Define visibility
*/
public function wrapTitle($title, \TYPO3\CMS\Core\Resource\Folder $folderObject) {
if ($this->ext_isLinkable($folderObject)) {
$aOnClick = 'return jumpToUrl(\'' . $this->getThisScript() . 'act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&editorNo=' . $GLOBALS['SOBE']->browser->editorNo . '&contentTypo3Language=' . $GLOBALS['SOBE']->browser->contentTypo3Language . '&contentTypo3Charset=' . $GLOBALS['SOBE']->browser->contentTypo3Charset . '&expandFolder=' . rawurlencode($folderObject->getCombinedIdentifier()) . '\');';
return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $title . '</a>';
} else {
return '<span class="typo3-dimmed">' . $title . '</span>';
}
}
/**
* Wrap the plus/minus icon in a link
*
* @param string $icon HTML string to wrap, probably an image tag.
* @param string $cmd Command for 'PM' get var
* @param boolean $isExpand If expanded
* @return string Link-wrapped input string
* @access private
*/
public function PMiconATagWrap($icon, $cmd, $isExpand = TRUE) {
if (empty($this->scope)) {
$this->scope = array(
'class' => get_class($this),
'script' => $this->thisScript,
'ext_noTempRecyclerDirs' => $this->ext_noTempRecyclerDirs,
'browser' => array(
'mode' => $GLOBALS['SOBE']->browser->mode,
'act' => $GLOBALS['SOBE']->browser->act,
'editorNo' => $GLOBALS['SOBE']->browser->editorNo
),
);
}
if ($this->thisScript) {
// Activates dynamic AJAX based tree
$scopeData = serialize($this->scope);
$scopeHash = GeneralUtility::hmac($scopeData);
$js = htmlspecialchars('Tree.load(' . GeneralUtility::quoteJSvalue($cmd) . ', ' . (int)$isExpand . ', this, ' . GeneralUtility::quoteJSvalue($scopeData) . ', ' . GeneralUtility::quoteJSvalue($scopeHash) . ');');
return '<a class="pm" onclick="' . $js . '">' . $icon . '</a>';
} else {
return $icon;
}
}
}
| demonege/sutogo | typo3/sysext/rtehtmlarea/Classes/FolderTree.php | PHP | gpl-2.0 | 2,464 | [
30522,
1026,
1029,
25718,
3415,
15327,
5939,
6873,
2509,
1032,
4642,
2015,
1032,
20375,
11039,
19968,
12069,
2050,
1025,
2224,
5939,
6873,
2509,
1032,
4642,
2015,
1032,
4563,
1032,
9710,
1032,
2236,
21823,
18605,
1025,
1013,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html id="htmlId">
<head>
<title>Coverage Report :: Pagination</title>
<style type="text/css">
@import "../../.css/coverage.css";
</style>
</head>
<body>
<div class="header"></div>
<div class="content">
<div class="breadCrumbs">
[ <a href="../../index.html">all classes</a> ]
[ <a href="../index.html">net.sf.jabref.logic.importer.fileformat.medline</a> ]
</div>
<h1>Coverage Summary for Class: Pagination (net.sf.jabref.logic.importer.fileformat.medline)</h1>
<table class="coverageStats">
<tr>
<th class="name">Class</th>
<th class="coverageStat
">
Class, %
</th>
<th class="coverageStat
">
Method, %
</th>
<th class="coverageStat
">
Line, %
</th>
</tr>
<tr>
<td class="name">Pagination</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/ 1)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/ 2)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/ 4)
</span>
</td>
</tr>
</table>
<br/>
<br/>
<div class="sourceCode"><i>1</i> //
<i>2</i> // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4
<i>3</i> // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
<i>4</i> // Any modifications to this file will be lost upon recompilation of the source schema.
<i>5</i> // Generated on: 2017.07.12 at 07:52:43 PM BRT
<i>6</i> //
<i>7</i>
<i>8</i>
<i>9</i> package net.sf.jabref.logic.importer.fileformat.medline;
<i>10</i>
<i>11</i> import java.util.ArrayList;
<i>12</i> import java.util.List;
<i>13</i> import javax.xml.bind.JAXBElement;
<i>14</i> import javax.xml.bind.annotation.XmlAccessType;
<i>15</i> import javax.xml.bind.annotation.XmlAccessorType;
<i>16</i> import javax.xml.bind.annotation.XmlElementRef;
<i>17</i> import javax.xml.bind.annotation.XmlElementRefs;
<i>18</i> import javax.xml.bind.annotation.XmlRootElement;
<i>19</i> import javax.xml.bind.annotation.XmlType;
<i>20</i>
<i>21</i>
<i>22</i> /**
<i>23</i> * <p>Java class for anonymous complex type.
<i>24</i> *
<i>25</i> * <p>The following schema fragment specifies the expected content contained within this class.
<i>26</i> *
<i>27</i> * <pre>
<i>28</i> * &lt;complexType>
<i>29</i> * &lt;complexContent>
<i>30</i> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
<i>31</i> * &lt;choice>
<i>32</i> * &lt;sequence>
<i>33</i> * &lt;element ref="{}StartPage"/>
<i>34</i> * &lt;element ref="{}EndPage" minOccurs="0"/>
<i>35</i> * &lt;element ref="{}MedlinePgn" minOccurs="0"/>
<i>36</i> * &lt;/sequence>
<i>37</i> * &lt;element ref="{}MedlinePgn"/>
<i>38</i> * &lt;/choice>
<i>39</i> * &lt;/restriction>
<i>40</i> * &lt;/complexContent>
<i>41</i> * &lt;/complexType>
<i>42</i> * </pre>
<i>43</i> *
<i>44</i> *
<i>45</i> */
<i>46</i> @XmlAccessorType(XmlAccessType.FIELD)
<i>47</i> @XmlType(name = "", propOrder = {
<i>48</i> "content"
<i>49</i> })
<i>50</i> @XmlRootElement(name = "Pagination")
<b class="nc"><i>51</i> public class Pagination {</b>
<i>52</i>
<i>53</i> @XmlElementRefs({
<i>54</i> @XmlElementRef(name = "StartPage", type = JAXBElement.class, required = false),
<i>55</i> @XmlElementRef(name = "MedlinePgn", type = JAXBElement.class, required = false),
<i>56</i> @XmlElementRef(name = "EndPage", type = JAXBElement.class, required = false)
<i>57</i> })
<i>58</i> protected List<JAXBElement<String>> content;
<i>59</i>
<i>60</i> /**
<i>61</i> * Gets the rest of the content model.
<i>62</i> *
<i>63</i> * <p>
<i>64</i> * You are getting this "catch-all" property because of the following reason:
<i>65</i> * The field name "MedlinePgn" is used by two different parts of a schema. See:
<i>66</i> * line 752 of file:/home/guerra/JabRef_ES2/src/main/resources/xjc/medline/nlmmedlinecitationset_160101.xsd
<i>67</i> * line 750 of file:/home/guerra/JabRef_ES2/src/main/resources/xjc/medline/nlmmedlinecitationset_160101.xsd
<i>68</i> * <p>
<i>69</i> * To get rid of this property, apply a property customization to one
<i>70</i> * of both of the following declarations to change their names:
<i>71</i> * Gets the value of the content property.
<i>72</i> *
<i>73</i> * <p>
<i>74</i> * This accessor method returns a reference to the live list,
<i>75</i> * not a snapshot. Therefore any modification you make to the
<i>76</i> * returned list will be present inside the JAXB object.
<i>77</i> * This is why there is not a <CODE>set</CODE> method for the content property.
<i>78</i> *
<i>79</i> * <p>
<i>80</i> * For example, to add a new item, do as follows:
<i>81</i> * <pre>
<i>82</i> * getContent().add(newItem);
<i>83</i> * </pre>
<i>84</i> *
<i>85</i> *
<i>86</i> * <p>
<i>87</i> * Objects of the following type(s) are allowed in the list
<i>88</i> * {@link JAXBElement }{@code <}{@link String }{@code >}
<i>89</i> * {@link JAXBElement }{@code <}{@link String }{@code >}
<i>90</i> * {@link JAXBElement }{@code <}{@link String }{@code >}
<i>91</i> *
<i>92</i> *
<i>93</i> */
<i>94</i> public List<JAXBElement<String>> getContent() {
<b class="nc"><i>95</i> if (content == null) {</b>
<b class="nc"><i>96</i> content = new ArrayList<JAXBElement<String>>();</b>
<i>97</i> }
<b class="nc"><i>98</i> return this.content;</b>
<i>99</i> }
<i>100</i>
<i>101</i> }
</div>
</div>
<div class="footer">
<div style="float:right;">generated on 2017-07-15 00:44</div>
</div>
</body>
</html>
| JessicaDias/JabRef_ES2 | ReportImportTests/net.sf.jabref.logic.importer.fileformat.medline/.classes/Pagination.html | HTML | mit | 6,908 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
1060,
11039,
19968,
1015,
1012,
1014,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package sysadmin
import org.scalatest._
import scalikejdbc._
import scalikejdbc.scalatest.AutoRollback
import skinny.logging.Logging
import skinny.test.FactoryGirl
class userAdminSpec
extends fixture.FunSpec
with Matchers
with Connection
with CreateTables
with AutoRollback
with Logging {
override def db(): DB = NamedDB('sysadmin).toDB()
describe("factory.conf") {
it("should be available") { implicit session =>
val user = FactoryGirl(User).create()
user.os should equal("Windows 8")
user.java should equal("6")
user.user should equal("sera")
}
}
describe("with os/java/user attributes") {
it("should be available") { implicit session =>
val user = FactoryGirl(User).withAttributes('os -> "MacOS X", 'java -> "8", 'user -> "sera").create()
user.os should equal("MacOS X")
user.java should equal("8")
user.user should equal("sera")
}
}
}
| seratch/skinny-framework | factory-girl/src/test/scala/sysadmin/SystemAdminSpec.scala | Scala | mit | 942 | [
30522,
7427,
25353,
3736,
22117,
2378,
12324,
8917,
1012,
26743,
22199,
1012,
1035,
12324,
8040,
11475,
3489,
3501,
18939,
2278,
1012,
1035,
12324,
8040,
11475,
3489,
3501,
18939,
2278,
1012,
26743,
22199,
1012,
8285,
28402,
5963,
12324,
1562... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
namespace BLL
{
public partial class Task
{
DAL.Task pr = new DAL.Task();
public DataTable GetTaskList(string strWhere)
{
return pr.GetTaskList(strWhere);
}
public bool AddTaskList(Model.Task model)
{
return pr.AddTaskList(model);
}
public bool UpdateTaskList(Model.Task model)
{
return pr.UpdateTaskList(model);
}
}
}
| yongjianzheng/Schedule | BLL/Task.cs | C# | apache-2.0 | 596 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
2291,
1012,
11409,
4160,
1025,
2478,
2291,
1012,
3793,
1025,
2478,
2291,
1012,
11689,
2075,
1012,
8518,
1025,
2478,
2291,
1012,
2951,
1025,
3415,
15327,
1038,
3363,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 2008, 2009 UFPE - Universidade Federal de Pernambuco
Este arquivo é parte do programa Amadeus Sistema de Gestão de Aprendizagem, ou simplesmente Amadeus LMS
O Amadeus LMS é um software livre; você pode redistribui-lo e/ou modifica-lo dentro dos termos da Licença Pública Geral GNU como
publicada pela Fundação do Software Livre (FSF); na versão 2 da Licença.
Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU para maiores detalhes.
Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título "LICENCA.txt", junto com este programa, se não, escreva para a Fundação do Software Livre (FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
**/
package br.ufpe.cin.amadeus.amadeus_mobile.util;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile;
import br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Forum;
import br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Game;
import br.ufpe.cin.amadeus.amadeus_web.domain.content_management.LearningObject;
import br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Poll;
public class Conversor {
/**
* Method that converts AMADeUs Course object into Mobile Course object
* @param curso - AMADeUs Course to be converted
* @return - Converted Mobile Course object
*/
public static br.ufpe.cin.amadeus.amadeus_mobile.basics.CourseMobile converterCurso(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Course curso){
br.ufpe.cin.amadeus.amadeus_mobile.basics.CourseMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.CourseMobile();
retorno.setId(curso.getId());
retorno.setName(curso.getName());
retorno.setContent(curso.getContent());
retorno.setObjectives(curso.getObjectives());
retorno.setModules(converterModulos(curso.getModules()));
retorno.setKeywords(converterKeywords(curso.getKeywords()));
ArrayList<String> nomes = new ArrayList<String>();
nomes.add(curso.getProfessor().getName());
retorno.setTeachers(nomes);
retorno.setCount(0);
retorno.setMaxAmountStudents(curso.getMaxAmountStudents());
retorno.setFinalCourseDate(curso.getFinalCourseDate());
retorno.setInitialCourseDate(curso.getInitialCourseDate());
return retorno;
}
/**
* Method that converts a AMADeUs Course object list into Mobile Course object list
* @param cursos - AMADeUs Course object list to be converted
* @return - Converted Mobile Course object list
*/
public static List<br.ufpe.cin.amadeus.amadeus_mobile.basics.CourseMobile> converterCursos(List<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Course> cursos){
ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.CourseMobile> retorno = new ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.CourseMobile>();
for (br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Course c : cursos){
retorno.add(Conversor.converterCurso(c));
}
return retorno;
}
/**
* Method that converts AMADeUs Module object into Mobile Module object
* @param modulo - AMADeUs Module object to be converted
* @return - Converted Mobile Module object
*/
public static br.ufpe.cin.amadeus.amadeus_mobile.basics.ModuleMobile converterModulo(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Module modulo){
br.ufpe.cin.amadeus.amadeus_mobile.basics.ModuleMobile mod = new br.ufpe.cin.amadeus.amadeus_mobile.basics.ModuleMobile(modulo.getId(), modulo.getName());
List<HomeworkMobile> listHomeworks = new ArrayList<HomeworkMobile>();
for (Poll poll : modulo.getPolls()) {
listHomeworks.add( Conversor.converterPollToHomework(poll) );
}
for (Forum forum : modulo.getForums()) {
listHomeworks.add( Conversor.converterForumToHomework(forum) );
}
for(Game game : modulo.getGames()){
listHomeworks.add( Conversor.converterGameToHomework(game) );
}
for(LearningObject learning : modulo.getLearningObjects()){
listHomeworks.add( Conversor.converterLearningObjectToHomework(learning) );
}
mod.setHomeworks(listHomeworks);
mod.setMaterials(converterMaterials(modulo.getMaterials()));
return mod;
}
/**
* Mothod that converts a AMADeUs Module object list into Mobile Module object list
* @param modulos - AMADeUs Module object list to be converted
* @return - Converted Mobile Module object list
*/
public static List<br.ufpe.cin.amadeus.amadeus_mobile.basics.ModuleMobile> converterModulos(List<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Module> modulos){
ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.ModuleMobile> retorno = new ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.ModuleMobile>();
for (br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Module m : modulos){
retorno.add(Conversor.converterModulo(m));
}
return retorno;
}
/**
* Method that converts AMADeUs Homework object into Mobile Homework object
* @param home - AMADeUs Homework object to be converted
* @return - Converted Mobile Homework object
*/
public static br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile converterHomework(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Homework home){
br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile();
retorno.setId(home.getId());
retorno.setName(home.getName());
retorno.setDescription(home.getDescription());
retorno.setInitDate(home.getInitDate());
retorno.setDeadline(home.getDeadline());
retorno.setAlowPostponing(home.getAllowPostponing());
retorno.setInfoExtra("");
retorno.setTypeActivity(HomeworkMobile.HOMEWORK);
return retorno;
}
/**
* Method that converts AMADeUs Game object into Mobile Homework object
* @param game - AMADeUs Game object to be converted
* @return - Converted Mobile Homework object
*/
public static br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile converterGameToHomework(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Game game){
br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile();
retorno.setId(game.getId());
retorno.setName(game.getName());
retorno.setDescription(game.getDescription());
retorno.setInfoExtra(game.getUrl());
retorno.setTypeActivity(HomeworkMobile.GAME);
return retorno;
}
/**
* Method that converts AMADeUs Forum object into Mobile Homework object
* @param forum - AMADeUs Forum object to be converted
* @return - Converted Mobile Homework object
*/
public static br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile converterForumToHomework(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Forum forum){
br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile();
retorno.setId(forum.getId());
retorno.setName(forum.getName());
retorno.setDescription(forum.getDescription());
retorno.setInitDate(forum.getCreationDate());
retorno.setInfoExtra("");
retorno.setTypeActivity(HomeworkMobile.FORUM);
return retorno;
}
/**
* Method that converts AMADeUs Poll object into Mobile Homework object
* @param poll - AMADeUs Poll object to be converted
* @return - Converted Mobile Homework object
*/
public static br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile converterPollToHomework(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Poll poll){
br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile();
retorno.setId(poll.getId());
retorno.setName(poll.getName());
retorno.setDescription(poll.getQuestion());
retorno.setInitDate(poll.getCreationDate());
retorno.setDeadline(poll.getFinishDate());
retorno.setInfoExtra("");
retorno.setTypeActivity(HomeworkMobile.POLL);
return retorno;
}
/**
* Method that converts AMADeUs Multimedia object into Mobile Homework object
* @param media - AMADeUs Multimedia object to be converted
* @return - Converted Mobile Homework object
*/
public static br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile converterMultimediaToHomework(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Multimedia media){
br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile();
retorno.setId(media.getId());
retorno.setName(media.getName());
retorno.setDescription(media.getDescription());
retorno.setInfoExtra(media.getUrl());
retorno.setTypeActivity(HomeworkMobile.MULTIMEDIA);
return retorno;
}
/**
* Method that converts AMADeUs Video object into Mobile Homework object
* @param video - AMADeUs Video object to be converted
* @return - Converted Mobile Homework object
*/
public static br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile converterVideoToHomework(br.ufpe.cin.amadeus.amadeus_sdmm.dao.Video video){
br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile();
retorno.setId(video.getId());
retorno.setName(video.getName());
retorno.setDescription(video.getDescription());
retorno.setInitDate(video.getDateinsertion());
retorno.setInfoExtra(video.getTags());
retorno.setTypeActivity(HomeworkMobile.VIDEO);
return retorno;
}
public static br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile converterLearningObjectToHomework(
br.ufpe.cin.amadeus.amadeus_web.domain.content_management.LearningObject learning) {
br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile();
retorno.setId(learning.getId());
retorno.setName(learning.getName());
retorno.setUrl(learning.getUrl());
retorno.setDescription(learning.getDescription());
retorno.setDeadline(learning.getCreationDate());
retorno.setTypeActivity(HomeworkMobile.LEARNING_OBJECT);
return retorno;
}
/**
* Method that converts AMADeUs Homework object list into Mobile Homework object list
* @param homes - AMADeUs Homework object list to be converted
* @return - Converted Mobile Homework object list
*/
public static List<br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile> converterHomeworks(List<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Homework> homes){
ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile> retorno = new ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile>();
for (br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Homework h : homes){
retorno.add(Conversor.converterHomework(h));
}
return retorno;
}
/**
* Method that converts AMADeUs Material object into Mobile Material object
* @param mat - AMADeUs Material object to be converted
* @return - Mobile Material object converted
*/
public static br.ufpe.cin.amadeus.amadeus_mobile.basics.MaterialMobile converterMaterial(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Material mat){
br.ufpe.cin.amadeus.amadeus_mobile.basics.MaterialMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.MaterialMobile();
retorno.setId(mat.getId());
retorno.setName(mat.getArchiveName());
retorno.setAuthor(converterPerson(mat.getAuthor()));
retorno.setPostDate(mat.getCreationDate());
return retorno;
}
/**
* Method that converts AMADeUs Mobile Material object list into Mobile Material object list
* @param mats - AMADeUs Material object list
* @return - Mobile Material object list
*/
public static List<br.ufpe.cin.amadeus.amadeus_mobile.basics.MaterialMobile> converterMaterials(List<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Material> mats){
ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.MaterialMobile> retorno = new ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.MaterialMobile>();
for (br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Material mat : mats){
retorno.add(Conversor.converterMaterial(mat));
}
return retorno;
}
/**
* Method that converts AMADeUs Keyword object into Mobile Keyword object
* @param key - AMADeUs Keyword object to be converted
* @return - Converted Keywork object
*/
public static br.ufpe.cin.amadeus.amadeus_mobile.basics.KeywordMobile converterKeyword(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Keyword key){
br.ufpe.cin.amadeus.amadeus_mobile.basics.KeywordMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.KeywordMobile();
retorno.setId(key.getId());
retorno.setName(key.getName());
retorno.setPopularity(key.getPopularity());
return retorno;
}
/**
* Method that converts AMADeUs Keyword object list into a Mobile Keyword HashSet object
* @param keys - AMADeUs Keyword object list to be converted
* @return - Mobile Keywork HashSet object list
*/
public static HashSet<br.ufpe.cin.amadeus.amadeus_mobile.basics.KeywordMobile> converterKeywords(Set<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Keyword> keys){
HashSet<br.ufpe.cin.amadeus.amadeus_mobile.basics.KeywordMobile> retorno = new HashSet<br.ufpe.cin.amadeus.amadeus_mobile.basics.KeywordMobile>();
for (br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Keyword k : keys){
retorno.add(Conversor.converterKeyword(k));
}
return retorno;
}
/**
* Method that converts AMADeUs Choice object into Mobile Choice object
* @param ch - AMADeUs Choice object to be converted
* @return - Converted Mobile Choice object
*/
public static br.ufpe.cin.amadeus.amadeus_mobile.basics.ChoiceMobile converterChoice(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Choice ch){
br.ufpe.cin.amadeus.amadeus_mobile.basics.ChoiceMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.ChoiceMobile();
retorno.setId(ch.getId());
retorno.setAlternative(ch.getAlternative());
retorno.setVotes(ch.getVotes());
retorno.setPercentage(ch.getPercentage());
return retorno;
}
/**
* Method that converts AMADeUs Choice object list into Mobile Choice object list
* @param chs - AMADeUs Choice object list to be converted
* @return - Converted Mobile Choice object list
*/
public static List<br.ufpe.cin.amadeus.amadeus_mobile.basics.ChoiceMobile> converterChoices(List<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Choice> chs){
List<br.ufpe.cin.amadeus.amadeus_mobile.basics.ChoiceMobile> retorno = new ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.ChoiceMobile>();
for (br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Choice c : chs){
retorno.add(Conversor.converterChoice(c));
}
return retorno;
}
/**
* Method that converts AMADeUs Poll object into Mobile Poll Object
* @param p - AMADeUs Poll object to be converted
* @return - Converted Mobile Poll object
*/
public static br.ufpe.cin.amadeus.amadeus_mobile.basics.PollMobile converterPool(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Poll p){
br.ufpe.cin.amadeus.amadeus_mobile.basics.PollMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.PollMobile();
retorno.setId(p.getId());
retorno.setName(p.getName());
retorno.setQuestion(p.getQuestion());
retorno.setInitDate(p.getCreationDate());
retorno.setFinishDate(p.getFinishDate());
retorno.setAnswered(false);
retorno.setChoices(converterChoices(p.getChoices()));
retorno.setAnsewered(converterAnswers(p.getAnswers()));
return retorno;
}
public static br.ufpe.cin.amadeus.amadeus_mobile.basics.LearningObjectMobile converterLearningObject (br.ufpe.cin.amadeus.amadeus_web.domain.content_management.LearningObject learning){
br.ufpe.cin.amadeus.amadeus_mobile.basics.LearningObjectMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.LearningObjectMobile();
retorno.setId(learning.getId());
retorno.setName(learning.getName());
retorno.setDescription(learning.getDescription());
retorno.setDatePublication(learning.getCreationDate());
retorno.setUrl(learning.getUrl());
return retorno;
}
/**
* Method that converts AMADeUs Poll object list into Mobile Poll object list
* @param pls - AMADeUs Poll object list
* @return - Converted Mobile object list
*/
public static List<br.ufpe.cin.amadeus.amadeus_mobile.basics.PollMobile> converterPools(List<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Poll> pls){
List<br.ufpe.cin.amadeus.amadeus_mobile.basics.PollMobile> retorno = new ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.PollMobile>();
for (br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Poll p : pls){
retorno.add(Conversor.converterPool(p));
}
return retorno;
}
/**
* Method that converts AMADeUs Answer object into Mobile Answer object
* @param ans - AMADeUs Answer object to be converted
* @return - Converted Mobile Answer object
*/
public static br.ufpe.cin.amadeus.amadeus_mobile.basics.AnswerMobile converterAnswer(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Answer ans){
br.ufpe.cin.amadeus.amadeus_mobile.basics.AnswerMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.AnswerMobile();
retorno.setId(ans.getId());
retorno.setAnswerDate(ans.getAnswerDate());
retorno.setPerson(converterPerson(ans.getPerson()));
return retorno;
}
/**
* Method that converts AMADeUs Answer object list into Mobile Answer object list
* @param anss - AMADeUs Answer object list
* @return - Converted Mobile object list
*/
public static List<br.ufpe.cin.amadeus.amadeus_mobile.basics.AnswerMobile> converterAnswers(List<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Answer> anss){
List<br.ufpe.cin.amadeus.amadeus_mobile.basics.AnswerMobile> retorno = new ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.AnswerMobile>();
for (br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Answer an : anss){
retorno.add(Conversor.converterAnswer(an));
}
return retorno;
}
/**
* Method that converts AMADeUs Person object into Mobile Person object
* @param p - AMADeUs Person object to be converted
* @return - Converted Mobile Person object
*/
public static br.ufpe.cin.amadeus.amadeus_mobile.basics.PersonMobile converterPerson(br.ufpe.cin.amadeus.amadeus_web.domain.register.Person p){
return new br.ufpe.cin.amadeus.amadeus_mobile.basics.PersonMobile(p.getId(), p.getAccessInfo().getLogin(), p.getPhoneNumber());
}
/**
* Method that converts AMADeUs Person object list into Mobile Person object list
* @param persons - AMADeUs Person object list to be converted
* @return - Converted Mobile Person object list
*/
public static List<br.ufpe.cin.amadeus.amadeus_mobile.basics.PersonMobile> converterPersons(List<br.ufpe.cin.amadeus.amadeus_web.domain.register.Person> persons){
List<br.ufpe.cin.amadeus.amadeus_mobile.basics.PersonMobile> retorno = new ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.PersonMobile>();
for (br.ufpe.cin.amadeus.amadeus_web.domain.register.Person p : persons){
retorno.add(Conversor.converterPerson(p));
}
return retorno;
}
/**
* Method that converts Mobile Poll object into AMADeUs Poll Object
* @param p - Mobile Poll object to be converted
* @return - Converted AMADeUs Poll object
*/
public static br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Poll converterPool(br.ufpe.cin.amadeus.amadeus_mobile.basics.PollMobile p){
br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Poll retorno = new br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Poll();
retorno.setId(p.getId());
retorno.setName(p.getName());
retorno.setQuestion(p.getQuestion());
retorno.setCreationDate(p.getInitDate());
retorno.setFinishDate(p.getFinishDate());
retorno.setChoices(converterChoices2(p.getChoices()));
retorno.setAnswers(converterAnswers2(p.getAnsewered()));
return retorno;
}
/**
* Method that converts Mobile Choice object into AMADeUs Choice object
* @param ch - Mobile Choice object to be converted
* @return - Converted AMADeUs Choice object
*/
public static br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Choice converterChoice(br.ufpe.cin.amadeus.amadeus_mobile.basics.ChoiceMobile ch){
br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Choice retorno = new br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Choice();
retorno.setId(ch.getId());
retorno.setAlternative(ch.getAlternative());
retorno.setVotes(ch.getVotes());
retorno.setPercentage(ch.getPercentage());
return retorno;
}
/**
* Method that converts Mobile Choiceobject list into AMADeUs Choice object list
* @param chs - Mobile Choice object list to be converted
* @return - Converted AMADeUs Choice object list
*/
public static List<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Choice> converterChoices2(List<br.ufpe.cin.amadeus.amadeus_mobile.basics.ChoiceMobile> chs){
List<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Choice> retorno = new ArrayList<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Choice>();
for (br.ufpe.cin.amadeus.amadeus_mobile.basics.ChoiceMobile c : chs){
retorno.add(Conversor.converterChoice(c));
}
return retorno;
}
/**
* Method that converts Mobile Answer object into AMADeUs Answer object
* @param ans - Mobile Answer object to be converted
* @return - Converted AMADeUs Answer object
*/
public static br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Answer converterAnswer(br.ufpe.cin.amadeus.amadeus_mobile.basics.AnswerMobile ans){
br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Answer retorno = new br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Answer();
retorno.setId(ans.getId());
retorno.setAnswerDate(ans.getAnswerDate());
retorno.setPerson(converterPerson(ans.getPerson()));
return retorno;
}
/**
* Method that converts Mobile Answer object list into AMADeUs Answer object list
* @param anss - Mobile Answer object list
* @return - Converted AMADeUs Answer object list
*/
public static List<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Answer> converterAnswers2(List<br.ufpe.cin.amadeus.amadeus_mobile.basics.AnswerMobile> anss){
List<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Answer> retorno = new ArrayList<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Answer>();
for (br.ufpe.cin.amadeus.amadeus_mobile.basics.AnswerMobile an : anss){
retorno.add(Conversor.converterAnswer(an));
}
return retorno;
}
/**
* Method that converts Mobile Person object into AMADeUs Person object
* @param p - Mobile Person object to be converted
* @return - Converted AMADeUs Person object
*/
public static br.ufpe.cin.amadeus.amadeus_web.domain.register.Person converterPerson(br.ufpe.cin.amadeus.amadeus_mobile.basics.PersonMobile p){
br.ufpe.cin.amadeus.amadeus_web.domain.register.Person p1 = new br.ufpe.cin.amadeus.amadeus_web.domain.register.Person();
p1.setId(p.getId());
p1.setName(p.getName());
p1.setPhoneNumber(p.getPhoneNumber());
return p1;
}
} | phcp/AmadeusLMS | src/br/ufpe/cin/amadeus/amadeus_mobile/util/Conversor.java | Java | gpl-2.0 | 24,368 | [
30522,
1013,
1008,
1008,
9385,
2263,
1010,
2268,
1057,
22540,
2063,
1011,
16501,
2063,
2976,
2139,
2566,
13129,
8569,
3597,
28517,
12098,
15549,
6767,
1041,
2112,
2063,
2079,
2565,
2050,
27185,
24761,
18532,
2050,
2139,
16216,
9153,
2080,
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... |
/* $NoKeywords:$ */
/**
* @file
*
* Config FCH HD Audio Controller
*
*
*
* @xrefitem bom "File Content Label" "Release Content"
* @e project: AGESA
* @e sub-project: FCH
* @e \$Revision: 63425 $ @e \$Date: 2011-12-22 11:24:10 -0600 (Thu, 22 Dec 2011) $
*
*/
/*
*****************************************************************************
*
* Copyright 2008 - 2012 ADVANCED MICRO DEVICES, INC. All Rights Reserved.
*
* AMD is granting you permission to use this software (the Materials)
* pursuant to the terms and conditions of your Software License Agreement
* with AMD. This header does *NOT* give you permission to use the Materials
* or any rights under AMD's intellectual property. Your use of any portion
* of these Materials shall constitute your acceptance of those terms and
* conditions. If you do not agree to the terms and conditions of the Software
* License Agreement, please do not use any portion of these Materials.
*
* CONFIDENTIALITY: The Materials and all other information, identified as
* confidential and provided to you by AMD shall be kept confidential in
* accordance with the terms and conditions of the Software License Agreement.
*
* LIMITATION OF LIABILITY: THE MATERIALS AND ANY OTHER RELATED INFORMATION
* PROVIDED TO YOU BY AMD ARE PROVIDED "AS IS" WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTY OF ANY KIND, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
* MERCHANTABILITY, NONINFRINGEMENT, TITLE, FITNESS FOR ANY PARTICULAR PURPOSE,
* OR WARRANTIES ARISING FROM CONDUCT, COURSE OF DEALING, OR USAGE OF TRADE.
* IN NO EVENT SHALL AMD OR ITS LICENSORS BE LIABLE FOR ANY DAMAGES WHATSOEVER
* (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF PROFITS, BUSINESS
* INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF AMD'S NEGLIGENCE,
* GROSS NEGLIGENCE, THE USE OF OR INABILITY TO USE THE MATERIALS OR ANY OTHER
* RELATED INFORMATION PROVIDED TO YOU BY AMD, EVEN IF AMD HAS BEEN ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGES. BECAUSE SOME JURISDICTIONS PROHIBIT THE
* EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES,
* THE ABOVE LIMITATION MAY NOT APPLY TO YOU.
*
* AMD does not assume any responsibility for any errors which may appear in
* the Materials or any other related information provided to you by AMD, or
* result from use of the Materials or any related information.
*
* You agree that you will not reverse engineer or decompile the Materials.
*
* NO SUPPORT OBLIGATION: AMD is not obligated to furnish, support, or make any
* further information, software, technical information, know-how, or show-how
* available to you. Additionally, AMD retains the right to modify the
* Materials at any time, without notice, and is not obligated to provide such
* modified Materials to you.
*
* U.S. GOVERNMENT RESTRICTED RIGHTS: The Materials are provided with
* "RESTRICTED RIGHTS." Use, duplication, or disclosure by the Government is
* subject to the restrictions as set forth in FAR 52.227-14 and
* DFAR252.227-7013, et seq., or its successor. Use of the Materials by the
* Government constitutes acknowledgement of AMD's proprietary rights in them.
*
* EXPORT ASSURANCE: You agree and certify that neither the Materials, nor any
* direct product thereof will be exported directly or indirectly, into any
* country prohibited by the United States Export Administration Act and the
* regulations thereunder, without the required authorization from the U.S.
* government nor will be used for any purpose prohibited by the same.
****************************************************************************
*/
#include "FchPlatform.h"
#define FILECODE (0xB003)
//
// Declaration of local functions
//
VOID
ConfigureAzaliaPinCmd (
IN FCH_DATA_BLOCK *FchDataPtr,
IN UINT32 BAR0,
IN UINT8 ChannelNum
);
VOID
ConfigureAzaliaSetConfigD4Dword (
IN CODEC_ENTRY *TempAzaliaCodecEntryPtr,
IN UINT32 ChannelNumDword,
IN UINT32 BAR0,
IN AMD_CONFIG_PARAMS *StdHeader
);
/**
* FchInitMidAzalia - Config Azalia controller after PCI
* emulation
*
*
*
* @param[in] FchDataPtr Fch configuration structure pointer.
*
*/
VOID
FchInitMidAzalia (
IN VOID *FchDataPtr
)
{
UINT8 Index;
BOOLEAN EnableAzalia;
UINT32 PinRouting;
UINT8 ChannelNum;
UINT8 AzaliaTempVariableByte;
UINT16 AzaliaTempVariableWord;
UINT32 BAR0;
FCH_DATA_BLOCK *LocalCfgPtr;
AMD_CONFIG_PARAMS *StdHeader;
LocalCfgPtr = (FCH_DATA_BLOCK *) FchDataPtr;
StdHeader = LocalCfgPtr->StdHeader;
EnableAzalia = FALSE;
ChannelNum = 0;
AzaliaTempVariableByte = 0;
AzaliaTempVariableWord = 0;
BAR0 = 0;
if ( LocalCfgPtr->Azalia.AzaliaEnable == AzDisable) {
return;
} else {
RwPci ((((0x14<<3)+2) << 16) + 0x04, AccessWidth8, (UINT32)~BIT1, (UINT32)BIT1, StdHeader);
if ( LocalCfgPtr->Azalia.AzaliaSsid != 0 ) {
RwPci ((((0x14<<3)+2) << 16) + 0x2C, AccessWidth32, 0x00, LocalCfgPtr->Azalia.AzaliaSsid, StdHeader);
}
ReadPci ((((0x14<<3)+2) << 16) + 0x10, AccessWidth32, &BAR0, StdHeader);
if ( BAR0 != 0 ) {
if ( BAR0 != 0xFFFFFFFF ) {
BAR0 &= ~(0x03FFF);
EnableAzalia = TRUE;
}
}
}
if ( EnableAzalia ) {
//
// Get SDIN Configuration
//
if ( LocalCfgPtr->Azalia.AzaliaConfig.AzaliaSdin0 == 2 ) {
RwMem (ACPI_MMIO_BASE + GPIO_BASE + FCH_GPIO_REG167, AccessWidth8, 0, 0x3E);
RwMem (ACPI_MMIO_BASE + IOMUX_BASE + FCH_GPIO_REG167, AccessWidth8, 0, 0x00);
} else {
RwMem (ACPI_MMIO_BASE + GPIO_BASE + FCH_GPIO_REG167, AccessWidth8, 0, 0x0);
RwMem (ACPI_MMIO_BASE + IOMUX_BASE + FCH_GPIO_REG167, AccessWidth8, 0, 0x01);
}
if ( LocalCfgPtr->Azalia.AzaliaConfig.AzaliaSdin1 == 2 ) {
RwMem (ACPI_MMIO_BASE + GPIO_BASE + FCH_GPIO_REG168, AccessWidth8, 0, 0x3E);
RwMem (ACPI_MMIO_BASE + IOMUX_BASE + FCH_GPIO_REG168, AccessWidth8, 0, 0x00);
} else {
RwMem (ACPI_MMIO_BASE + GPIO_BASE + FCH_GPIO_REG168, AccessWidth8, 0, 0x0);
RwMem (ACPI_MMIO_BASE + IOMUX_BASE + FCH_GPIO_REG168, AccessWidth8, 0, 0x01);
}
if ( LocalCfgPtr->Azalia.AzaliaConfig.AzaliaSdin2 == 2 ) {
RwMem (ACPI_MMIO_BASE + GPIO_BASE + FCH_GPIO_REG169, AccessWidth8, 0, 0x3E);
RwMem (ACPI_MMIO_BASE + IOMUX_BASE + FCH_GPIO_REG169, AccessWidth8, 0, 0x00);
} else {
RwMem (ACPI_MMIO_BASE + GPIO_BASE + FCH_GPIO_REG169, AccessWidth8, 0, 0x0);
RwMem (ACPI_MMIO_BASE + IOMUX_BASE + FCH_GPIO_REG169, AccessWidth8, 0, 0x01);
}
if ( LocalCfgPtr->Azalia.AzaliaConfig.AzaliaSdin3 == 2 ) {
RwMem (ACPI_MMIO_BASE + GPIO_BASE + FCH_GPIO_REG170, AccessWidth8, 0, 0x3E);
RwMem (ACPI_MMIO_BASE + IOMUX_BASE + FCH_GPIO_REG170, AccessWidth8, 0, 0x00);
} else {
RwMem (ACPI_MMIO_BASE + GPIO_BASE + FCH_GPIO_REG170, AccessWidth8, 0, 0x0);
RwMem (ACPI_MMIO_BASE + IOMUX_BASE + FCH_GPIO_REG170, AccessWidth8, 0, 0x01);
}
Index = 11;
do {
ReadMem ( BAR0 + 0x08, AccessWidth8, &AzaliaTempVariableByte);
AzaliaTempVariableByte |= BIT0;
WriteMem (BAR0 + 0x08, AccessWidth8, &AzaliaTempVariableByte);
FchStall (1000, StdHeader);
ReadMem (BAR0 + 0x08, AccessWidth8, &AzaliaTempVariableByte);
Index--;
} while ((! (AzaliaTempVariableByte & BIT0)) && (Index > 0) );
if ( Index == 0 ) {
return;
}
FchStall (1000, StdHeader);
ReadMem ( BAR0 + 0x0E, AccessWidth16, &AzaliaTempVariableWord);
if ( AzaliaTempVariableWord & 0x0F ) {
//
//at least one azalia codec found
//
//PinRouting = LocalCfgPtr->Azalia.AZALIA_CONFIG.AzaliaSdinPin;
//new structure need make up PinRouting
//need adjust later!!!
//
PinRouting = 0;
PinRouting = (UINT32 )LocalCfgPtr->Azalia.AzaliaConfig.AzaliaSdin3;
PinRouting <<= 8;
PinRouting |= (UINT32 )LocalCfgPtr->Azalia.AzaliaConfig.AzaliaSdin2;
PinRouting <<= 8;
PinRouting |= (UINT32 )LocalCfgPtr->Azalia.AzaliaConfig.AzaliaSdin1;
PinRouting <<= 8;
PinRouting |= (UINT32 )LocalCfgPtr->Azalia.AzaliaConfig.AzaliaSdin0;
do {
if ( ( ! (PinRouting & BIT0) ) && (PinRouting & BIT1) ) {
ConfigureAzaliaPinCmd (LocalCfgPtr, BAR0, ChannelNum);
}
PinRouting >>= 8;
ChannelNum++;
} while ( ChannelNum != 4 );
} else {
//
//No Azalia codec found
//
if ( LocalCfgPtr->Azalia.AzaliaEnable != AzEnable ) {
EnableAzalia = FALSE; ///set flag to disable Azalia
}
}
}
if ( EnableAzalia ) {
if ( LocalCfgPtr->Azalia.AzaliaSnoop == 1 ) {
RwPci ((((0x14<<3)+2) << 16) + 0x42, AccessWidth8, 0xFF, BIT1 + BIT0, StdHeader);
}
} else {
//
//disable Azalia controller
//
RwPci ((((0x14<<3)+2) << 16) + 0x04, AccessWidth16, 0, 0, StdHeader);
RwMem (ACPI_MMIO_BASE + PMIO_BASE + 0xEB , AccessWidth8, (UINT32)~BIT0, 0);
RwMem (ACPI_MMIO_BASE + PMIO_BASE + 0xEB , AccessWidth8, (UINT32)~BIT0, 0);
}
}
/**
* Pin Config for ALC880, ALC882 and ALC883.
*
*
*
*/
CODEC_ENTRY AzaliaCodecAlc882Table[] =
{
{0x14, 0x01014010},
{0x15, 0x01011012},
{0x16, 0x01016011},
{0x17, 0x01012014},
{0x18, 0x01A19030},
{0x19, 0x411111F0},
{0x1a, 0x01813080},
{0x1b, 0x411111F0},
{0x1C, 0x411111F0},
{0x1d, 0x411111F0},
{0x1e, 0x01441150},
{0x1f, 0x01C46160},
{0xff, 0xffffffff}
};
/**
* Pin Config for ALC0262.
*
*
*
*/
CODEC_ENTRY AzaliaCodecAlc262Table[] =
{
{0x14, 0x01014010},
{0x15, 0x411111F0},
{0x16, 0x411111F0},
{0x18, 0x01A19830},
{0x19, 0x02A19C40},
{0x1a, 0x01813031},
{0x1b, 0x02014C20},
{0x1c, 0x411111F0},
{0x1d, 0x411111F0},
{0x1e, 0x0144111E},
{0x1f, 0x01C46150},
{0xff, 0xffffffff}
};
/**
* Pin Config for ALC0269.
*
*
*
*/
CODEC_ENTRY AzaliaCodecAlc269Table[] =
{
{0x12, 0x99A308F0},
{0x14, 0x99130010},
{0x15, 0x0121101F},
{0x16, 0x99036120},
{0x18, 0x01A19850},
{0x19, 0x99A309F0},
{0x1a, 0x01813051},
{0x1b, 0x0181405F},
{0x1d, 0x40134601},
{0x1e, 0x01442130},
{0x11, 0x99430140},
{0x20, 0x0030FFFF},
{0xff, 0xffffffff}
};
/**
* Pin Config for ALC0861.
*
*
*
*/
CODEC_ENTRY AzaliaCodecAlc861Table[] =
{
{0x01, 0x8086C601},
{0x0B, 0x01014110},
{0x0C, 0x01813140},
{0x0D, 0x01A19941},
{0x0E, 0x411111F0},
{0x0F, 0x02214420},
{0x10, 0x02A1994E},
{0x11, 0x99330142},
{0x12, 0x01451130},
{0x1F, 0x411111F0},
{0x20, 0x411111F0},
{0x23, 0x411111F0},
{0xff, 0xffffffff}
};
/**
* Pin Config for ALC0889.
*
*
*
*/
CODEC_ENTRY AzaliaCodecAlc889Table[] =
{
{0x11, 0x411111F0},
{0x14, 0x01014010},
{0x15, 0x01011012},
{0x16, 0x01016011},
{0x17, 0x01013014},
{0x18, 0x01A19030},
{0x19, 0x411111F0},
{0x1a, 0x411111F0},
{0x1b, 0x411111F0},
{0x1C, 0x411111F0},
{0x1d, 0x411111F0},
{0x1e, 0x01442150},
{0x1f, 0x01C42160},
{0xff, 0xffffffff}
};
/**
* Pin Config for ADI1984.
*
*
*
*/
CODEC_ENTRY AzaliaCodecAd1984Table[] =
{
{0x11, 0x0221401F},
{0x12, 0x90170110},
{0x13, 0x511301F0},
{0x14, 0x02A15020},
{0x15, 0x50A301F0},
{0x16, 0x593301F0},
{0x17, 0x55A601F0},
{0x18, 0x55A601F0},
{0x1A, 0x91F311F0},
{0x1B, 0x014511A0},
{0x1C, 0x599301F0},
{0xff, 0xffffffff}
};
/**
* FrontPanel Config table list
*
*
*
*/
CODEC_ENTRY FrontPanelAzaliaCodecTableList[] =
{
{0x19, 0x02A19040},
{0x1b, 0x02214020},
{0xff, 0xffffffff}
};
/**
* Current HD Audio support codec list
*
*
*
*/
CODEC_TBL_LIST AzaliaCodecTableList[] =
{
{0x010ec0880, &AzaliaCodecAlc882Table[0]},
{0x010ec0882, &AzaliaCodecAlc882Table[0]},
{0x010ec0883, &AzaliaCodecAlc882Table[0]},
{0x010ec0885, &AzaliaCodecAlc882Table[0]},
{0x010ec0889, &AzaliaCodecAlc889Table[0]},
{0x010ec0262, &AzaliaCodecAlc262Table[0]},
{0x010ec0269, &AzaliaCodecAlc269Table[0]},
{0x010ec0861, &AzaliaCodecAlc861Table[0]},
{0x011d41984, &AzaliaCodecAd1984Table[0]},
{ (UINT32) 0x0FFFFFFFF, (CODEC_ENTRY*) (UINTN)0x0FFFFFFFF}
};
/**
* ConfigureAzaliaPinCmd - Configuration HD Audio PIN Command
*
*
* @param[in] FchDataPtr Fch configuration structure pointer.
* @param[in] BAR0 HD Audio BAR0 base address.
* @param[in] ChannelNum Channel Number.
*
*/
VOID
ConfigureAzaliaPinCmd (
IN FCH_DATA_BLOCK *FchDataPtr,
IN UINT32 BAR0,
IN UINT8 ChannelNum
)
{
UINT32 AzaliaTempVariable;
UINT32 ChannelNumDword;
CODEC_TBL_LIST *TempAzaliaOemCodecTablePtr;
CODEC_ENTRY *TempAzaliaCodecEntryPtr;
if ( (FchDataPtr->Azalia.AzaliaPinCfg) != 1 ) {
return;
}
ChannelNumDword = ChannelNum << 28;
AzaliaTempVariable = 0xF0000;
AzaliaTempVariable |= ChannelNumDword;
WriteMem (BAR0 + 0x60, AccessWidth32, &AzaliaTempVariable);
FchStall (600, FchDataPtr->StdHeader);
ReadMem (BAR0 + 0x64, AccessWidth32, &AzaliaTempVariable);
if ( ((FchDataPtr->Azalia.AzaliaOemCodecTablePtr) == NULL) || ((FchDataPtr->Azalia.AzaliaOemCodecTablePtr) == ((CODEC_TBL_LIST*) (UINTN)0xFFFFFFFF))) {
TempAzaliaOemCodecTablePtr = (CODEC_TBL_LIST*) (&AzaliaCodecTableList[0]);
} else {
TempAzaliaOemCodecTablePtr = (CODEC_TBL_LIST*) FchDataPtr->Azalia.AzaliaOemCodecTablePtr;
}
while ( TempAzaliaOemCodecTablePtr->CodecId != 0xFFFFFFFF ) {
if ( TempAzaliaOemCodecTablePtr->CodecId == AzaliaTempVariable ) {
break;
} else {
++TempAzaliaOemCodecTablePtr;
}
}
if ( TempAzaliaOemCodecTablePtr->CodecId != 0xFFFFFFFF ) {
TempAzaliaCodecEntryPtr = (CODEC_ENTRY*) TempAzaliaOemCodecTablePtr->CodecTablePtr;
if ( ((FchDataPtr->Azalia.AzaliaOemCodecTablePtr) == NULL) || ((FchDataPtr->Azalia.AzaliaOemCodecTablePtr) == ((CODEC_TBL_LIST*) (UINTN)0xFFFFFFFF)) ) {
TempAzaliaCodecEntryPtr = (CODEC_ENTRY*) (TempAzaliaCodecEntryPtr);
}
ConfigureAzaliaSetConfigD4Dword (TempAzaliaCodecEntryPtr, ChannelNumDword, BAR0, FchDataPtr->StdHeader);
if ( FchDataPtr->Azalia.AzaliaFrontPanel != 1 ) {
if ( (FchDataPtr->Azalia.AzaliaFrontPanel == 2) || (FchDataPtr->Azalia.FrontPanelDetected == 1) ) {
if ( ((FchDataPtr->Azalia.AzaliaOemFpCodecTablePtr) == NULL) || ((FchDataPtr->Azalia.AzaliaOemFpCodecTablePtr) == (VOID*) (UINTN)0xFFFFFFFF) ) {
TempAzaliaCodecEntryPtr = (CODEC_ENTRY*) (&FrontPanelAzaliaCodecTableList[0]);
} else {
TempAzaliaCodecEntryPtr = (CODEC_ENTRY*) FchDataPtr->Azalia.AzaliaOemFpCodecTablePtr;
}
ConfigureAzaliaSetConfigD4Dword (TempAzaliaCodecEntryPtr, ChannelNumDword, BAR0, FchDataPtr->StdHeader);
}
}
}
}
/**
* ConfigureAzaliaSetConfigD4Dword - Configuration HD Audio Codec table
*
*
* @param[in] TempAzaliaCodecEntryPtr HD Audio Codec table structure pointer.
* @param[in] ChannelNumDword HD Audio Channel Number.
* @param[in] BAR0 HD Audio BAR0 base address.
* @param[in] StdHeader
*
*/
VOID
ConfigureAzaliaSetConfigD4Dword (
IN CODEC_ENTRY *TempAzaliaCodecEntryPtr,
IN UINT32 ChannelNumDword,
IN UINT32 BAR0,
IN AMD_CONFIG_PARAMS *StdHeader
)
{
UINT8 TempByte1;
UINT8 TempByte2;
UINT8 Index;
UINT32 TempDword1;
UINT32 TempDword2;
TempDword1 = 0;
TempDword2 = 0;
while ( (TempAzaliaCodecEntryPtr->Nid) != 0xFF ) {
TempByte1 = 0x20;
if ( (TempAzaliaCodecEntryPtr->Nid) == 0x1 ) {
TempByte1 = 0x24;
}
TempDword1 = TempAzaliaCodecEntryPtr->Nid;
TempDword1 &= 0xff;
TempDword1 <<= 20;
TempDword1 |= ChannelNumDword;
TempDword1 |= (0x700 << 8);
for ( Index = 4; Index > 0; Index-- ) {
do {
ReadMem (BAR0 + 0x68, AccessWidth32, &TempDword2);
} while ( (TempDword2 & BIT0) != 0 );
TempByte2 = (UINT8) (( (TempAzaliaCodecEntryPtr->Byte40) >> ((4 - Index) * 8 ) ) & 0xff);
TempDword1 = (TempDword1 & 0xFFFF0000) + ((TempByte1 - Index) << 8) + TempByte2;
WriteMem (BAR0 + 0x60, AccessWidth32, &TempDword1);
FchStall (60, StdHeader);
}
++TempAzaliaCodecEntryPtr;
}
}
| hustcalm/coreboot-hacking | src/vendorcode/amd/agesa/f15tn/Proc/Fch/Azalia/AzaliaMid.c | C | gpl-2.0 | 16,108 | [
30522,
1013,
1008,
1002,
2053,
14839,
22104,
1024,
1002,
1008,
1013,
1013,
1008,
1008,
1008,
1030,
5371,
1008,
1008,
9530,
8873,
2290,
4429,
2232,
10751,
5746,
11486,
1008,
1008,
1008,
1008,
1030,
1060,
2890,
8873,
18532,
8945,
2213,
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... |
##############################################################################
# Build global options
# NOTE: Can be overridden externally.
#
# Compiler options here.
ifeq ($(USE_OPT),)
USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16
endif
# C specific options here (added to USE_OPT).
ifeq ($(USE_COPT),)
USE_COPT =
endif
# C++ specific options here (added to USE_OPT).
ifeq ($(USE_CPPOPT),)
USE_CPPOPT = -fno-rtti
endif
# Enable this if you want the linker to remove unused code and data
ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
endif
# Linker extra options here.
ifeq ($(USE_LDOPT),)
USE_LDOPT =
endif
# Enable this if you want link time optimizations (LTO)
ifeq ($(USE_LTO),)
USE_LTO = yes
endif
# If enabled, this option allows to compile the application in THUMB mode.
ifeq ($(USE_THUMB),)
USE_THUMB = yes
endif
# Enable this if you want to see the full log while compiling.
ifeq ($(USE_VERBOSE_COMPILE),)
USE_VERBOSE_COMPILE = no
endif
#
# Build global options
##############################################################################
##############################################################################
# Architecture or project specific options
#
# Stack size to be allocated to the Cortex-M process stack. This stack is
# the stack used by the main() thread.
ifeq ($(USE_PROCESS_STACKSIZE),)
USE_PROCESS_STACKSIZE = 0x400
endif
# Stack size to the allocated to the Cortex-M main/exceptions stack. This
# stack is used for processing interrupts and exceptions.
ifeq ($(USE_EXCEPTIONS_STACKSIZE),)
USE_EXCEPTIONS_STACKSIZE = 0x400
endif
# Enables the use of FPU on Cortex-M4 (no, softfp, hard).
ifeq ($(USE_FPU),)
USE_FPU = no
endif
#
# Architecture or project specific options
##############################################################################
##############################################################################
# Project, sources and paths
#
# Define project name here
PROJECT = ch
# Imported source files and paths
CHIBIOS = ../../..
# Startup files.
include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_stm32l1xx.mk
# HAL-OSAL files (optional).
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS)/os/hal/ports/STM32/STM32L1xx/platform.mk
include $(CHIBIOS)/os/hal/boards/ST_NUCLEO_L152RE/board.mk
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
# RTOS files (optional).
include $(CHIBIOS)/os/rt/rt.mk
include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
# Other files (optional).
include $(CHIBIOS)/test/rt/test.mk
# Define linker script file here
LDSCRIPT= $(STARTUPLD)/STM32L152xE.ld
# C sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
CSRC = $(STARTUPSRC) \
$(KERNSRC) \
$(PORTSRC) \
$(OSALSRC) \
$(HALSRC) \
$(PLATFORMSRC) \
$(BOARDSRC) \
$(TESTSRC) \
main.c
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
CPPSRC =
# C sources to be compiled in ARM mode regardless of the global setting.
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
# option that results in lower performance and larger code size.
ACSRC =
# C++ sources to be compiled in ARM mode regardless of the global setting.
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
# option that results in lower performance and larger code size.
ACPPSRC =
# C sources to be compiled in THUMB mode regardless of the global setting.
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
# option that results in lower performance and larger code size.
TCSRC =
# C sources to be compiled in THUMB mode regardless of the global setting.
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
# option that results in lower performance and larger code size.
TCPPSRC =
# List ASM source files here
ASMSRC = $(STARTUPASM) $(PORTASM) $(OSALASM)
INCDIR = $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \
$(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \
$(CHIBIOS)/os/various
#
# Project, sources and paths
##############################################################################
##############################################################################
# Compiler settings
#
MCU = cortex-m4
#TRGT = arm-elf-
TRGT = arm-none-eabi-
CC = $(TRGT)gcc
CPPC = $(TRGT)g++
# Enable loading with g++ only if you need C++ runtime support.
# NOTE: You can use C++ even without C++ support if you are careful. C++
# runtime support makes code size explode.
LD = $(TRGT)gcc
#LD = $(TRGT)g++
CP = $(TRGT)objcopy
AS = $(TRGT)gcc -x assembler-with-cpp
AR = $(TRGT)ar
OD = $(TRGT)objdump
SZ = $(TRGT)size
HEX = $(CP) -O ihex
BIN = $(CP) -O binary
# ARM-specific options here
AOPT =
# THUMB-specific options here
TOPT = -mthumb -DTHUMB
# Define C warning options here
CWARN = -Wall -Wextra -Wstrict-prototypes
# Define C++ warning options here
CPPWARN = -Wall -Wextra
#
# Compiler settings
##############################################################################
##############################################################################
# Start of user section
#
# List all user C define here, like -D_DEBUG=1
UDEFS =
# Define ASM defines here
UADEFS =
# List all user directories here
UINCDIR =
# List the user directory to look for the libraries here
ULIBDIR =
# List all user libraries here
ULIBS =
#
# End of user defines
##############################################################################
RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC
include $(RULESPATH)/rules.mk
| bunnie/chibios-orchard | demos/STM32/RT-STM32L152RE-NUCLEO/Makefile | Makefile | gpl-3.0 | 5,899 | [
30522,
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,
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 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#pragma once
#include <aws/ecs/ECS_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
namespace Aws
{
namespace ECS
{
namespace Model
{
enum class AgentUpdateStatus
{
NOT_SET,
PENDING,
STAGING,
STAGED,
UPDATING,
UPDATED,
FAILED
};
namespace AgentUpdateStatusMapper
{
AWS_ECS_API AgentUpdateStatus GetAgentUpdateStatusForName(const Aws::String& name);
AWS_ECS_API Aws::String GetNameForAgentUpdateStatus(AgentUpdateStatus value);
} // namespace AgentUpdateStatusMapper
} // namespace Model
} // namespace ECS
} // namespace Aws
| chiaming0914/awe-cpp-sdk | aws-cpp-sdk-ecs/include/aws/ecs/model/AgentUpdateStatus.h | C | apache-2.0 | 1,149 | [
30522,
1013,
1008,
1008,
9385,
2230,
1011,
2418,
9733,
1012,
4012,
1010,
4297,
1012,
2030,
2049,
18460,
1012,
2035,
2916,
9235,
1012,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
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 "kvazaarfilter.h"
#include "statisticsinterface.h"
#include "common.h"
#include "settingskeys.h"
#include "logger.h"
#include <kvazaar.h>
#include <QtDebug>
#include <QTime>
#include <QSize>
enum RETURN_STATUS {C_SUCCESS = 0, C_FAILURE = -1};
KvazaarFilter::KvazaarFilter(QString id, StatisticsInterface *stats,
std::shared_ptr<HWResourceManager> hwResources):
Filter(id, "Kvazaar", stats, hwResources, DT_YUV420VIDEO, DT_HEVCVIDEO),
api_(nullptr),
config_(nullptr),
enc_(nullptr),
pts_(0),
input_pic_(nullptr),
framerate_num_(30),
framerate_denom_(1),
encodingFrames_()
{
maxBufferSize_ = 3;
}
void KvazaarFilter::updateSettings()
{
Logger::getLogger()->printNormal(this, "Updating kvazaar settings");
stop();
while(isRunning())
{
sleep(1);
}
close();
encodingFrames_.clear();
if(init())
{
Logger::getLogger()->printNormal(this, "Resolution change successful");
}
else
{
Logger::getLogger()->printNormal(this, "Failed to change resolution");
}
start();
Filter::updateSettings();
}
bool KvazaarFilter::init()
{
Logger::getLogger()->printNormal(this, "Iniating Kvazaar");
// input picture should not exist at this point
if(!input_pic_ && !api_)
{
api_ = kvz_api_get(8);
if(!api_)
{
Logger::getLogger()->printDebug(DEBUG_PROGRAM_ERROR, this, "Failed to retrieve Kvazaar API.");
return false;
}
config_ = api_->config_alloc();
enc_ = nullptr;
if(!config_)
{
Logger::getLogger()->printDebug(DEBUG_PROGRAM_ERROR, this, "Failed to allocate Kvazaar config.");
return false;
}
QSettings settings(settingsFile, settingsFileFormat);
api_->config_init(config_);
api_->config_parse(config_, "preset", settings.value(SettingsKey::videoPreset).toString().toUtf8());
// input
#ifdef __linux__
if (settingEnabled(SettingsKey::screenShareStatus))
{
config_->width = settings.value(SettingsKey::videoResultionWidth).toInt();
config_->height = settings.value(SettingsKey::videoResultionHeight).toInt();
framerate_num_ = settings.value(SettingsKey::videoFramerate).toFloat();
config_->framerate_num = framerate_num_;
}
else
{
// On Linux the Camerafilter seems to have a Qt bug that causes not being able to set resolution
config_->width = 640;
config_->height = 480;
config_->framerate_num = 30;
}
#else
config_->width = settings.value(SettingsKey::videoResultionWidth).toInt();
config_->height = settings.value(SettingsKey::videoResultionHeight).toInt();
convertFramerate(settings.value(SettingsKey::videoFramerate).toReal());
config_->framerate_num = framerate_num_;
#endif
config_->framerate_denom = framerate_denom_;
// parallelization
if (settings.value(SettingsKey::videoKvzThreads) == "auto")
{
config_->threads = QThread::idealThreadCount();
}
else if (settings.value(SettingsKey::videoKvzThreads) == "Main")
{
config_->threads = 0;
}
else
{
config_->threads = settings.value(SettingsKey::videoKvzThreads).toInt();
}
config_->owf = settings.value(SettingsKey::videoOWF).toInt();
config_->wpp = settings.value(SettingsKey::videoWPP).toInt();
bool tiles = false;
if (tiles)
{
std::string dimensions = settings.value(SettingsKey::videoTileDimensions).toString().toStdString();
api_->config_parse(config_, "tiles", dimensions.c_str());
}
// this does not work with uvgRTP at the moment. Avoid using slices.
if(settings.value(SettingsKey::videoSlices).toInt() == 1)
{
if(config_->wpp)
{
config_->slices = KVZ_SLICES_WPP;
}
else if (tiles)
{
config_->slices = KVZ_SLICES_TILES;
}
}
// Structure
config_->qp = settings.value(SettingsKey::videoQP).toInt();
config_->intra_period = settings.value(SettingsKey::videoIntra).toInt();
config_->vps_period = settings.value(SettingsKey::videoVPS).toInt();
config_->target_bitrate = settings.value(SettingsKey::videoBitrate).toInt();
if (config_->target_bitrate != 0)
{
QString rcAlgo = settings.value(SettingsKey::videoRCAlgorithm).toString();
if (rcAlgo == "lambda")
{
config_->rc_algorithm = KVZ_LAMBDA;
}
else if (rcAlgo == "oba")
{
config_->rc_algorithm = KVZ_OBA;
config_->clip_neighbour = settings.value(SettingsKey::videoOBAClipNeighbours).toInt();
}
else
{
Logger::getLogger()->printWarning(this, "Some carbage in rc algorithm setting");
config_->rc_algorithm = KVZ_NO_RC;
}
}
else
{
config_->rc_algorithm = KVZ_NO_RC;
}
config_->gop_lowdelay = 1;
if (settings.value(SettingsKey::videoScalingList).toInt() == 0)
{
config_->scaling_list = KVZ_SCALING_LIST_OFF;
}
else
{
config_->scaling_list = KVZ_SCALING_LIST_DEFAULT;
}
config_->lossless = settings.value(SettingsKey::videoLossless).toInt();
QString constraint = settings.value(SettingsKey::videoMVConstraint).toString();
if (constraint == "frame")
{
config_->mv_constraint = KVZ_MV_CONSTRAIN_FRAME;
}
else if (constraint == "tile")
{
config_->mv_constraint = KVZ_MV_CONSTRAIN_TILE;
}
else if (constraint == "frametile")
{
config_->mv_constraint = KVZ_MV_CONSTRAIN_FRAME_AND_TILE;
}
else if (constraint == "frametilemargin")
{
config_->mv_constraint = KVZ_MV_CONSTRAIN_FRAME_AND_TILE_MARGIN;
}
else
{
config_->mv_constraint = KVZ_MV_CONSTRAIN_NONE;
}
config_->set_qp_in_cu = settings.value(SettingsKey::videoQPInCU).toInt();
config_->vaq = settings.value(SettingsKey::videoVAQ).toInt();
// compression-tab
customParameters(settings);
config_->hash = KVZ_HASH_NONE;
enc_ = api_->encoder_open(config_);
if(!enc_)
{
Logger::getLogger()->printDebug(DEBUG_PROGRAM_ERROR, this, "Failed to open Kvazaar encoder.");
return false;
}
input_pic_ = api_->picture_alloc(config_->width, config_->height);
if(!input_pic_)
{
Logger::getLogger()->printDebug(DEBUG_PROGRAM_ERROR, this, "Could not allocate input picture.");
return false;
}
Logger::getLogger()->printNormal(this, "Kvazaar iniation succeeded");
}
return true;
}
void KvazaarFilter::close()
{
if(api_)
{
api_->encoder_close(enc_);
api_->config_destroy(config_);
enc_ = nullptr;
config_ = nullptr;
api_->picture_free(input_pic_);
input_pic_ = nullptr;
api_ = nullptr;
}
pts_ = 0;
Logger::getLogger()->printNormal(this, "Closed Kvazaar");
}
void KvazaarFilter::process()
{
Q_ASSERT(enc_);
Q_ASSERT(config_);
std::unique_ptr<Data> input = getInput();
while(input)
{
if(!input_pic_)
{
Logger::getLogger()->printDebug(DEBUG_PROGRAM_ERROR, this,
"Input picture was not allocated correctly.");
break;
}
feedInput(std::move(input));
input = getInput();
}
}
void KvazaarFilter::customParameters(QSettings& settings)
{
int size = settings.beginReadArray(SettingsKey::videoCustomParameters);
Logger::getLogger()->printNormal(this, "Getting custom Kvazaar parameters",
"Amount", QString::number(size));
for(int i = 0; i < size; ++i)
{
settings.setArrayIndex(i);
QString name = settings.value("Name").toString();
QString value = settings.value("Value").toString();
if (api_->config_parse(config_, name.toStdString().c_str(),
value.toStdString().c_str()) != 1)
{
Logger::getLogger()->printWarning(this, "Invalid custom parameter for kvazaar",
"Amount", QString::number(size));
}
}
settings.endArray();
}
void KvazaarFilter::feedInput(std::unique_ptr<Data> input)
{
kvz_picture *recon_pic = nullptr;
kvz_frame_info frame_info;
kvz_data_chunk *data_out = nullptr;
uint32_t len_out = 0;
if (config_->width != input->vInfo->width
|| config_->height != input->vInfo->height
|| (double)(config_->framerate_num/config_->framerate_denom) != input->vInfo->framerate)
{
// This should not happen.
Logger::getLogger()->printDebug(DEBUG_PROGRAM_ERROR, this,
"Input resolution or framerate differs from settings",
{"Settings", "Input"},
{QString::number(config_->width) + "x" +
QString::number(config_->height) + "p" +
QString::number(config_->framerate_num),
QString::number(input->vInfo->width) + "x" +
QString::number(input->vInfo->height) + "p" +
QString::number(input->vInfo->framerate)});
return;
}
// copy input to kvazaar picture
memcpy(input_pic_->y,
input->data.get(),
input->vInfo->width*input->vInfo->height);
memcpy(input_pic_->u,
&(input->data.get()[input->vInfo->width*input->vInfo->height]),
input->vInfo->width*input->vInfo->height/4);
memcpy(input_pic_->v,
&(input->data.get()[input->vInfo->width*input->vInfo->height + input->vInfo->width*input->vInfo->height/4]),
input->vInfo->width*input->vInfo->height/4);
input_pic_->pts = pts_;
++pts_;
encodingFrames_.push_front(std::move(input));
api_->encoder_encode(enc_, input_pic_,
&data_out, &len_out,
&recon_pic, nullptr,
&frame_info );
while(data_out != nullptr)
{
parseEncodedFrame(data_out, len_out, recon_pic);
// see if there is more output ready
api_->encoder_encode(enc_, nullptr,
&data_out, &len_out,
&recon_pic, nullptr,
&frame_info );
}
}
void KvazaarFilter::parseEncodedFrame(kvz_data_chunk *data_out,
uint32_t len_out, kvz_picture *recon_pic)
{
std::unique_ptr<Data> encodedFrame = std::move(encodingFrames_.back());
encodingFrames_.pop_back();
std::unique_ptr<uchar[]> hevc_frame(new uchar[len_out]);
uint8_t* writer = hevc_frame.get();
uint32_t dataWritten = 0;
for (kvz_data_chunk *chunk = data_out; chunk != nullptr; chunk = chunk->next)
{
if(chunk->len > 3 && chunk->data[0] == 0 && chunk->data[1] == 0
&& ( chunk->data[2] == 1 || (chunk->data[2] == 0 && chunk->data[3] == 1 ))
&& dataWritten != 0 && config_->slices != KVZ_SLICES_NONE)
{
// send previous packet if this is not the first
std::unique_ptr<Data> slice(shallowDataCopy(encodedFrame.get()));
sendEncodedFrame(std::move(slice), std::move(hevc_frame), dataWritten);
hevc_frame = std::unique_ptr<uchar[]>(new uchar[len_out - dataWritten]);
writer = hevc_frame.get();
dataWritten = 0;
}
memcpy(writer, chunk->data, chunk->len);
writer += chunk->len;
dataWritten += chunk->len;
}
api_->chunk_free(data_out);
api_->picture_free(recon_pic);
uint32_t delay = QDateTime::currentMSecsSinceEpoch() - encodedFrame->presentationTime;
getStats()->sendDelay("video", delay);
getStats()->addEncodedPacket("video", len_out);
// send last packet reusing input structure
sendEncodedFrame(std::move(encodedFrame), std::move(hevc_frame), dataWritten);
}
void KvazaarFilter::sendEncodedFrame(std::unique_ptr<Data> input,
std::unique_ptr<uchar[]> hevc_frame,
uint32_t dataWritten)
{
input->type = DT_HEVCVIDEO;
input->data_size = dataWritten;
input->data = std::move(hevc_frame);
sendOutput(std::move(input));
}
void KvazaarFilter::convertFramerate(double framerate)
{
uint32_t wholeNumber = (uint32_t)framerate;
double remainder = framerate - wholeNumber;
if (remainder > 0.0)
{
uint32_t multiplier = 1.0 /remainder;
framerate_num_ = framerate*multiplier;
framerate_denom_ = multiplier;
}
else
{
framerate_num_ = wholeNumber;
framerate_denom_ = 1;
}
Logger::getLogger()->printNormal(this, "Got framerate num and denum", "Framerate",
{QString::number(framerate_num_) + "/" +
QString::number(framerate_denom_) });
}
| ultravideo/kvazzup | src/media/processing/kvazaarfilter.cpp | C++ | isc | 12,600 | [
30522,
1001,
2421,
1000,
24888,
10936,
26526,
8873,
21928,
1012,
1044,
1000,
1001,
2421,
1000,
6747,
18447,
2121,
12172,
1012,
1044,
1000,
1001,
2421,
1000,
2691,
1012,
1044,
1000,
1001,
2421,
1000,
10906,
14839,
2015,
1012,
1044,
1000,
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... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='SkipRequest',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('key', models.CharField(max_length=64, verbose_name='Sender Key')),
],
options={
'verbose_name': 'Skip request',
'verbose_name_plural': 'Skip requests',
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Video',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('description', models.TextField(help_text='Description text for the video', verbose_name='Description', blank=True)),
('youtube_url', models.URLField(help_text='URL to a youtube video', verbose_name='Youtube URL')),
('key', models.CharField(max_length=64, null=True, verbose_name='Sender Key', blank=True)),
('deleted', models.IntegerField(default=False, verbose_name='Deleted')),
('playing', models.BooleanField(default=False, verbose_name='Playing')),
('duration', models.IntegerField(default=0, verbose_name='Duration')),
],
options={
'verbose_name': 'Video',
'verbose_name_plural': 'Videos',
},
bases=(models.Model,),
),
migrations.AddField(
model_name='skiprequest',
name='event',
field=models.ForeignKey(verbose_name='Video', to='manager.Video'),
preserve_default=True,
),
]
| katajakasa/utuputki | Utuputki/manager/migrations/0001_initial.py | Python | mit | 1,910 | [
30522,
1001,
1011,
1008,
1011,
16861,
1024,
21183,
2546,
1011,
1022,
1011,
1008,
1011,
2013,
1035,
1035,
2925,
1035,
1035,
12324,
27260,
1035,
18204,
2015,
2013,
6520,
23422,
1012,
16962,
12324,
4275,
1010,
9230,
2015,
2465,
9230,
1006,
923... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 main
import (
"os"
"github.com/kamaln7/karmabot"
"github.com/kamaln7/karmabot/ctlcommands"
"github.com/aybabtme/log"
"github.com/urfave/cli"
)
var (
ll *log.Log
)
func main() {
// logging
ll = log.KV("version", karmabot.Version)
// commands
cc := &ctlcommands.Commands{
Logger: ll,
}
// app
app := cli.NewApp()
app.Name = "karmabotctl"
app.Version = karmabot.Version
app.Usage = "manually manage karmabot"
// general flags
dbpath := cli.StringFlag{
Name: "db",
Value: "./db.sqlite3",
Usage: "path to sqlite database",
}
debug := cli.BoolFlag{
Name: "debug",
Usage: "set debug mode",
}
leaderboardlimit := cli.IntFlag{
Name: "leaderboardlimit",
Value: 10,
Usage: "the default amount of users to list in the leaderboard",
}
// webui
webuiCommands := []cli.Command{
{
Name: "totp",
Usage: "generate a TOTP token",
Flags: []cli.Flag{
cli.StringFlag{
Name: "totp",
Usage: "totp key",
},
},
Action: cc.Mktotp,
},
{
Name: "serve",
Usage: "start a webserver",
Flags: []cli.Flag{
dbpath,
debug,
leaderboardlimit,
cli.StringFlag{
Name: "totp",
Usage: "totp key",
},
cli.StringFlag{
Name: "path",
Usage: "path to web UI files",
},
cli.StringFlag{
Name: "listenaddr",
Usage: "address to listen and serve the web ui on",
},
cli.StringFlag{
Name: "url",
Usage: "url address for accessing the web ui",
},
},
Action: cc.Serve,
},
}
// karma
karmaCommands := []cli.Command{
{
Name: "add",
Usage: "add karma to a user",
Flags: []cli.Flag{
dbpath,
cli.StringFlag{
Name: "from",
},
cli.StringFlag{
Name: "to",
},
cli.StringFlag{
Name: "reason",
},
cli.IntFlag{
Name: "points",
},
},
Action: cc.AddKarma,
},
{
Name: "migrate",
Usage: "move a user's karma to another user",
Flags: []cli.Flag{
dbpath,
cli.StringFlag{
Name: "from",
},
cli.StringFlag{
Name: "to",
},
cli.StringFlag{
Name: "reason",
},
},
Action: cc.MigrateKarma,
},
{
Name: "reset",
Usage: "reset a user's karma",
Flags: []cli.Flag{
dbpath,
cli.StringFlag{
Name: "user",
},
},
Action: cc.ResetKarma,
},
{
Name: "set",
Usage: "set a user's karma to a specific number",
Flags: []cli.Flag{
dbpath,
cli.StringFlag{
Name: "user",
},
cli.IntFlag{
Name: "points",
},
},
Action: cc.SetKarma,
},
{
Name: "throwback",
Usage: "get a karma throwback for a user",
Flags: []cli.Flag{
dbpath,
cli.StringFlag{
Name: "user",
},
},
Action: cc.GetThrowback,
},
}
// main app
app.Commands = []cli.Command{
{
Name: "karma",
Subcommands: karmaCommands,
},
{
Name: "webui",
Subcommands: webuiCommands,
},
}
app.Run(os.Args)
}
| kamaln7/karmabot | cmd/karmabotctl/main.go | GO | mit | 2,972 | [
30522,
7427,
2364,
12324,
1006,
1000,
9808,
1000,
1000,
21025,
2705,
12083,
1012,
4012,
1013,
21911,
2078,
2581,
1013,
19902,
18384,
1000,
1000,
21025,
2705,
12083,
1012,
4012,
1013,
21911,
2078,
2581,
1013,
19902,
18384,
1013,
14931,
22499,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 diversen\file;
/**
* class contains a utf8 version of pathinfo, and a better realpath (truepath)
* method (to replace the native realpath)
*/
class path {
/**
* Method that returns utf8 pathinfo. The native pathinfo does not work well with utf8
* @param string $path
* @return array $pathinfo
*/
public static function utf8($path) {
return self::pathinfo_utf8($path);
}
//////////////////////////////////////////////////////
//
// http://xszhuchao.blogbus.com/logs/130081187.html
// I Refer above article.
// Fix Some Exception.
// Make a Function like pathinfo.
// This is useful for multi byte characters.
// There some example on the bottom。
// I Use 繁體中文
// My Blog
// http://samwphp.blogspot.com/2012/04/pathinfo-function.html
//////////////////////////////////////////////////////
/**
* function returns utf8 pathinfo as the native pathinfo returns pathinfo
* @param string $path
* @return array $pathinfo
*/
private static function pathinfo_utf8($path) {
$dirname = '';
$basename = '';
$extension = '';
$filename = '';
$pos = strrpos($path, '/');
if ($pos !== false) {
$dirname = substr($path, 0, strrpos($path, '/'));
$basename = substr($path, strrpos($path, '/') + 1);
} else {
$basename = $path;
}
$ext = strrchr($path, '.');
if ($ext !== false) {
$extension = substr($ext, 1);
}
$filename = $basename;
$pos = strrpos($basename, '.');
if ($pos !== false) {
$filename = substr($basename, 0, $pos);
}
return array(
'dirname' => $dirname,
'basename' => $basename,
'extension' => $extension,
'filename' => $filename
);
}
/**
* http://stackoverflow.com/questions/4049856/replace-phps-realpath
* This function is to replace PHP's extremely buggy realpath().
* @param string The original path, can be relative etc.
* @return string The resolved path, it might not exist.
*/
public static function truepath($path) {
$isEmptyPath = (strlen($path) == 0);
$isRelativePath = ($path{0} != '/');
$isWindowsPath = !(strpos($path, ':') === false);
if (($isEmptyPath || $isRelativePath) && !$isWindowsPath){
$path = getcwd() . DIRECTORY_SEPARATOR . $path;
}
// resolve path parts (single dot, double dot and double delimiters)
$path = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $path);
$pathParts = array_filter(explode(DIRECTORY_SEPARATOR, $path), 'strlen');
$absolutePathParts = array();
foreach ($pathParts as $part) {
if ($part == '.')
continue;
if ($part == '..') {
array_pop($absolutePathParts);
} else {
$absolutePathParts[] = $part;
}
}
$path = implode(DIRECTORY_SEPARATOR, $absolutePathParts);
// resolve any symlinks
if (file_exists($path) && linkinfo($path) > 0){
$path = readlink($path);
}
// put initial separator that could have been lost
$path = (!$isWindowsPath ? '/' . $path : $path);
return $path;
}
}
| diversen/simple-php-classes | src/file/path.php | PHP | bsd-3-clause | 3,441 | [
30522,
1026,
1029,
25718,
3415,
15327,
7578,
2078,
1032,
5371,
1025,
1013,
1008,
1008,
1008,
2465,
3397,
1037,
21183,
2546,
2620,
2544,
1997,
4130,
2378,
14876,
1010,
1998,
1037,
2488,
2613,
15069,
1006,
2995,
15069,
1007,
1008,
4118,
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... |
'use strict';
/**
* Module dependencies.
*/
var passport = require('passport'),
url = require('url'),
config = require('../../config'),
GitHubStrategy = require('passport-github').Strategy;
module.exports = function() {
// Use github strategy
passport.use(new GitHubStrategy({
clientID: config.github.clientID,
clientSecret: config.github.clientSecret,
callbackURL: config.github.callbackURL,
passReqToCallback: true
},
function(req, accessToken, refreshToken, profile, done) {
req.session.gitToken = accessToken;
process.nextTick(function () {
return done(null, profile);
});
}
));
};
| ClearcodeHQ/angular-collective | config/strategies/github/github.js | JavaScript | lgpl-3.0 | 663 | [
30522,
1005,
2224,
9384,
1005,
1025,
1013,
1008,
1008,
1008,
11336,
12530,
15266,
1012,
1008,
1013,
13075,
12293,
1027,
5478,
1006,
1005,
12293,
1005,
1007,
1010,
24471,
2140,
1027,
5478,
1006,
1005,
24471,
2140,
1005,
1007,
1010,
9530,
887... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 net.seabears.game.entities.normalmap;
import static java.util.stream.IntStream.range;
import java.io.IOException;
import java.util.List;
import org.joml.Matrix4f;
import org.joml.Vector3f;
import org.joml.Vector4f;
import net.seabears.game.entities.Entity;
import net.seabears.game.entities.Light;
import net.seabears.game.shadows.ShadowShader;
import net.seabears.game.textures.ModelTexture;
import net.seabears.game.util.TransformationMatrix;
public class NormalMappingShader extends ShadowShader {
public static final int TEXTURE_SHADOW = 2;
private final int lights;
private int locationClippingPlane;
private int locationModelTexture;
private int locationNormalMap;
private int[] locationLightAttenuation;
private int[] locationLightColor;
private int[] locationLightPosition;
private int locationProjectionMatrix;
private int locationReflectivity;
private int locationShineDamper;
private int locationSkyColor;
private int locationTextureRows;
private int locationTextureOffset;
private int locationTransformationMatrix;
private int locationViewMatrix;
public NormalMappingShader(int lights) throws IOException {
super(SHADER_ROOT + "normalmap/", TEXTURE_SHADOW);
this.lights = lights;
}
@Override
protected void bindAttributes() {
super.bindAttribute(ATTR_POSITION, "position");
super.bindAttribute(ATTR_TEXTURE, "textureCoords");
super.bindAttribute(ATTR_NORMAL, "normal");
super.bindAttribute(ATTR_TANGENT, "tangent");
}
@Override
protected void getAllUniformLocations() {
super.getAllUniformLocations();
locationClippingPlane = super.getUniformLocation("clippingPlane");
locationModelTexture = super.getUniformLocation("modelTexture");
locationNormalMap = super.getUniformLocation("normalMap");
locationLightAttenuation = super.getUniformLocations("attenuation", lights);
locationLightColor = super.getUniformLocations("lightColor", lights);
locationLightPosition = super.getUniformLocations("lightPosition", lights);
locationProjectionMatrix = super.getUniformLocation("projectionMatrix");
locationReflectivity = super.getUniformLocation("reflectivity");
locationShineDamper = super.getUniformLocation("shineDamper");
locationSkyColor = super.getUniformLocation("skyColor");
locationTextureRows = super.getUniformLocation("textureRows");
locationTextureOffset = super.getUniformLocation("textureOffset");
locationTransformationMatrix = super.getUniformLocation("transformationMatrix");
locationViewMatrix = super.getUniformLocation("viewMatrix");
}
public void loadClippingPlane(Vector4f plane) {
this.loadFloat(locationClippingPlane, plane);
}
public void loadLights(final List<Light> lights, Matrix4f viewMatrix) {
range(0, this.lights)
.forEach(i -> loadLight(i < lights.size() ? lights.get(i) : OFF_LIGHT, i, viewMatrix));
}
private void loadLight(Light light, int index, Matrix4f viewMatrix) {
super.loadFloat(locationLightAttenuation[index], light.getAttenuation());
super.loadFloat(locationLightColor[index], light.getColor());
super.loadFloat(locationLightPosition[index],
getEyeSpacePosition(light.getPosition(), viewMatrix));
}
public void loadProjectionMatrix(Matrix4f matrix) {
super.loadMatrix(locationProjectionMatrix, matrix);
}
public void loadSky(Vector3f color) {
super.loadFloat(locationSkyColor, color);
}
public void loadNormalMap() {
// refers to texture units
// TEXTURE_SHADOW occupies one unit
super.loadInt(locationModelTexture, 0);
super.loadInt(locationNormalMap, 1);
}
public void loadTexture(ModelTexture texture) {
super.loadFloat(locationReflectivity, texture.getReflectivity());
super.loadFloat(locationShineDamper, texture.getShineDamper());
super.loadFloat(locationTextureRows, texture.getRows());
}
public void loadEntity(Entity entity) {
loadTransformationMatrix(
new TransformationMatrix(entity.getPosition(), entity.getRotation(), entity.getScale())
.toMatrix());
super.loadFloat(locationTextureOffset, entity.getTextureOffset());
}
public void loadTransformationMatrix(Matrix4f matrix) {
super.loadMatrix(locationTransformationMatrix, matrix);
}
public void loadViewMatrix(Matrix4f matrix) {
super.loadMatrix(locationViewMatrix, matrix);
}
private static Vector3f getEyeSpacePosition(Vector3f position, Matrix4f viewMatrix) {
final Vector4f eyeSpacePos = new Vector4f(position.x, position.y, position.z, 1.0f);
viewMatrix.transform(eyeSpacePos);
return new Vector3f(eyeSpacePos.x, eyeSpacePos.y, eyeSpacePos.z);
}
}
| cberes/game | engine/src/main/java/net/seabears/game/entities/normalmap/NormalMappingShader.java | Java | gpl-3.0 | 4,691 | [
30522,
7427,
5658,
1012,
2712,
4783,
11650,
1012,
2208,
1012,
11422,
1012,
3671,
2863,
2361,
1025,
12324,
10763,
9262,
1012,
21183,
4014,
1012,
5460,
1012,
20014,
21422,
1012,
2846,
1025,
12324,
9262,
1012,
22834,
1012,
22834,
10288,
24422,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
/*
* acf_get_setting
*
* This function will return a value from the settings array found in the acf object
*
* @type function
* @date 28/09/13
* @since 5.0.0
*
* @param $name (string) the setting name to return
* @return (mixed)
*/
function acf_get_setting( $name, $default = null ) {
// vars
$settings = acf()->settings;
// find setting
$setting = acf_maybe_get( $settings, $name, $default );
// filter for 3rd party customization
$setting = apply_filters( "acf/settings/{$name}", $setting );
// return
return $setting;
}
/*
* acf_get_compatibility
*
* This function will return true or false for a given compatibility setting
*
* @type function
* @date 20/01/2015
* @since 5.1.5
*
* @param $name (string)
* @return (boolean)
*/
function acf_get_compatibility( $name ) {
return apply_filters( "acf/compatibility/{$name}", false );
}
/*
* acf_update_setting
*
* This function will update a value into the settings array found in the acf object
*
* @type function
* @date 28/09/13
* @since 5.0.0
*
* @param $name (string)
* @param $value (mixed)
* @return n/a
*/
function acf_update_setting( $name, $value ) {
acf()->settings[ $name ] = $value;
}
/*
* acf_append_setting
*
* This function will add a value into the settings array found in the acf object
*
* @type function
* @date 28/09/13
* @since 5.0.0
*
* @param $name (string)
* @param $value (mixed)
* @return n/a
*/
function acf_append_setting( $name, $value ) {
// createa array if needed
if( !isset(acf()->settings[ $name ]) ) {
acf()->settings[ $name ] = array();
}
// append to array
acf()->settings[ $name ][] = $value;
}
/*
* acf_get_path
*
* This function will return the path to a file within the ACF plugin folder
*
* @type function
* @date 28/09/13
* @since 5.0.0
*
* @param $path (string) the relative path from the root of the ACF plugin folder
* @return (string)
*/
function acf_get_path( $path ) {
return acf_get_setting('path') . $path;
}
/*
* acf_get_dir
*
* This function will return the url to a file within the ACF plugin folder
*
* @type function
* @date 28/09/13
* @since 5.0.0
*
* @param $path (string) the relative path from the root of the ACF plugin folder
* @return (string)
*/
function acf_get_dir( $path ) {
return acf_get_setting('dir') . $path;
}
/*
* acf_include
*
* This function will include a file
*
* @type function
* @date 10/03/2014
* @since 5.0.0
*
* @param $post_id (int)
* @return $post_id (int)
*/
function acf_include( $file ) {
$path = acf_get_path( $file );
if( file_exists($path) ) {
include_once( $path );
}
}
/*
* acf_parse_args
*
* This function will merge together 2 arrays and also convert any numeric values to ints
*
* @type function
* @date 18/10/13
* @since 5.0.0
*
* @param $args (array)
* @param $defaults (array)
* @return $args (array)
*/
function acf_parse_args( $args, $defaults = array() ) {
// $args may not be na array!
if( !is_array($args) ) {
$args = array();
}
// parse args
$args = wp_parse_args( $args, $defaults );
// parse types
$args = acf_parse_types( $args );
// return
return $args;
}
/*
* acf_parse_types
*
* This function will convert any numeric values to int and trim strings
*
* @type function
* @date 18/10/13
* @since 5.0.0
*
* @param $var (mixed)
* @return $var (mixed)
*/
function acf_parse_types( $array ) {
// some keys are restricted
$restricted = array(
'label',
'name',
'value',
'instructions',
'nonce'
);
// loop
foreach( array_keys($array) as $k ) {
// parse type if not restricted
if( !in_array($k, $restricted, true) ) {
$array[ $k ] = acf_parse_type( $array[ $k ] );
}
}
// return
return $array;
}
/*
* acf_parse_type
*
* description
*
* @type function
* @date 11/11/2014
* @since 5.0.9
*
* @param $post_id (int)
* @return $post_id (int)
*/
function acf_parse_type( $v ) {
// test for array
if( is_array($v) ) {
return acf_parse_types($v);
}
// bail early if not string
if( !is_string($v) ) {
return $v;
}
// trim
$v = trim($v);
// numbers
if( is_numeric($v) && strval((int)$v) === $v ) {
$v = intval( $v );
}
// return
return $v;
}
/*
* acf_get_view
*
* This function will load in a file from the 'admin/views' folder and allow variables to be passed through
*
* @type function
* @date 28/09/13
* @since 5.0.0
*
* @param $view_name (string)
* @param $args (array)
* @return n/a
*/
function acf_get_view( $view_name = '', $args = array() ) {
// vars
$path = acf_get_path("admin/views/{$view_name}.php");
if( file_exists($path) ) {
include( $path );
}
}
/*
* acf_merge_atts
*
* description
*
* @type function
* @date 2/11/2014
* @since 5.0.9
*
* @param $post_id (int)
* @return $post_id (int)
*/
function acf_merge_atts( $atts, $extra = array() ) {
// bail ealry if no $extra
if( empty($extra) ) {
return $atts;
}
// merge in new atts
foreach( $extra as $k => $v ) {
if( $k == 'class' || $k == 'style' ) {
if( $v === '' ) {
continue;
}
$v = $atts[ $k ] . ' ' . $v;
}
$atts[ $k ] = $v;
}
// return
return $atts;
}
/*
* acf_esc_attr
*
* This function will return a render of an array of attributes to be used in markup
*
* @type function
* @date 1/10/13
* @since 5.0.0
*
* @param $atts (array)
* @return n/a
*/
function acf_esc_attr( $atts ) {
// is string?
if( is_string($atts) ) {
$atts = trim( $atts );
return esc_attr( $atts );
}
// validate
if( empty($atts) ) {
return '';
}
// vars
$e = array();
// loop through and render
foreach( $atts as $k => $v ) {
// object
if( is_array($v) || is_object($v) ) {
$v = json_encode($v);
// boolean
} elseif( is_bool($v) ) {
$v = $v ? 1 : 0;
// string
} elseif( is_string($v) ) {
$v = trim($v);
}
// append
$e[] = $k . '="' . esc_attr( $v ) . '"';
}
// echo
return implode(' ', $e);
}
function acf_esc_attr_e( $atts ) {
echo acf_esc_attr( $atts );
}
/*
* acf_hidden_input
*
* description
*
* @type function
* @date 3/02/2014
* @since 5.0.0
*
* @param $post_id (int)
* @return $post_id (int)
*/
function acf_get_hidden_input( $atts ) {
$atts['type'] = 'hidden';
return '<input ' . acf_esc_attr( $atts ) . ' />';
}
function acf_hidden_input( $atts ) {
echo acf_get_hidden_input( $atts );
}
/*
* acf_extract_var
*
* This function will remove the var from the array, and return the var
*
* @type function
* @date 2/10/13
* @since 5.0.0
*
* @param $array (array)
* @param $key (string)
* @return (mixed)
*/
function acf_extract_var( &$array, $key ) {
// check if exists
if( is_array($array) && array_key_exists($key, $array) ) {
// store value
$v = $array[ $key ];
// unset
unset( $array[ $key ] );
// return
return $v;
}
// return
return null;
}
/*
* acf_extract_vars
*
* This function will remove the vars from the array, and return the vars
*
* @type function
* @date 8/10/13
* @since 5.0.0
*
* @param $post_id (int)
* @return $post_id (int)
*/
function acf_extract_vars( &$array, $keys ) {
$r = array();
foreach( $keys as $key ) {
$r[ $key ] = acf_extract_var( $array, $key );
}
return $r;
}
/*
* acf_get_post_types
*
* This function will return an array of available post types
*
* @type function
* @date 7/10/13
* @since 5.0.0
*
* @param $exclude (array)
* @param $include (array)
* @return (array)
*/
function acf_get_post_types( $exclude = array(), $include = array() ) {
// get all custom post types
$post_types = get_post_types();
// core exclude
$exclude = wp_parse_args( $exclude, array('acf-field', 'acf-field-group', 'revision', 'nav_menu_item') );
// include
if( !empty($include) ) {
foreach( array_keys($include) as $i ) {
$post_type = $include[ $i ];
if( post_type_exists($post_type) ) {
$post_types[ $post_type ] = $post_type;
}
}
}
// exclude
foreach( array_values($exclude) as $i ) {
unset( $post_types[ $i ] );
}
// simplify keys
$post_types = array_values($post_types);
// return
return $post_types;
}
function acf_get_pretty_post_types( $post_types = array() ) {
// get post types
if( empty($post_types) ) {
// get all custom post types
$post_types = acf_get_post_types();
}
// get labels
$ref = array();
$r = array();
foreach( $post_types as $post_type ) {
// vars
$label = $post_type;
// check that object exists (case exists when importing field group from another install and post type does not exist)
if( post_type_exists($post_type) ) {
$obj = get_post_type_object($post_type);
$label = $obj->labels->singular_name;
}
// append to r
$r[ $post_type ] = $label;
// increase counter
if( !isset($ref[ $label ]) ) {
$ref[ $label ] = 0;
}
$ref[ $label ]++;
}
// get slugs
foreach( array_keys($r) as $i ) {
// vars
$post_type = $r[ $i ];
if( $ref[ $post_type ] > 1 ) {
$r[ $i ] .= ' (' . $i . ')';
}
}
// return
return $r;
}
/*
* acf_verify_nonce
*
* This function will look at the $_POST['_acfnonce'] value and return true or false
*
* @type function
* @date 15/10/13
* @since 5.0.0
*
* @param $nonce (string)
* @return (boolean)
*/
function acf_verify_nonce( $value, $post_id = 0 ) {
// vars
$nonce = acf_maybe_get( $_POST, '_acfnonce' );
// bail early if no nonce or if nonce does not match (post|user|comment|term)
if( !$nonce || !wp_verify_nonce($nonce, $value) ) {
return false;
}
// if saving specific post
if( $post_id ) {
// vars
$form_post_id = (int) acf_maybe_get( $_POST, 'post_ID' );
$post_parent = wp_is_post_revision( $post_id );
// 1. no $_POST['post_id'] (shopp plugin)
if( !$form_post_id ) {
// do nothing (don't remove this if statement!)
// 2. direct match (this is the post we were editing)
} elseif( $post_id === $form_post_id ) {
// do nothing (don't remove this if statement!)
// 3. revision (this post is a revision of the post we were editing)
} elseif( $post_parent === $form_post_id ) {
// return true early and prevent $_POST['_acfnonce'] from being reset
// this will allow another save_post to save the real post
return true;
// 4. no match (this post is a custom created one during the save proccess via either WP or 3rd party)
} else {
// return false early and prevent $_POST['_acfnonce'] from being reset
// this will allow another save_post to save the real post
return false;
}
}
// reset nonce (only allow 1 save)
$_POST['_acfnonce'] = false;
// return
return true;
}
/*
* acf_verify_ajax
*
* This function will return true if the current AJAX request is valid
* It's action will also allow WPML to set the lang and avoid AJAX get_posts issues
*
* @type function
* @date 7/08/2015
* @since 5.2.3
*
* @param n/a
* @return (boolean)
*/
function acf_verify_ajax() {
// bail early if not acf action
if( empty($_POST['action']) || substr($_POST['action'], 0, 3) !== 'acf' ) {
return false;
}
// bail early if not acf nonce
if( empty($_POST['nonce']) || !wp_verify_nonce($_POST['nonce'], 'acf_nonce') ) {
return false;
}
// action for 3rd party customization
do_action('acf/verify_ajax');
// return
return true;
}
/*
* acf_add_admin_notice
*
* This function will add the notice data to a setting in the acf object for the admin_notices action to use
*
* @type function
* @date 17/10/13
* @since 5.0.0
*
* @param $text (string)
* @param $class (string)
* @return (int) message ID (array position)
*/
function acf_add_admin_notice( $text, $class = '', $wrap = 'p' )
{
// vars
$admin_notices = acf_get_admin_notices();
// add to array
$admin_notices[] = array(
'text' => $text,
'class' => "updated {$class}",
'wrap' => $wrap
);
// update
acf_update_setting( 'admin_notices', $admin_notices );
// return
return ( count( $admin_notices ) - 1 );
}
/*
* acf_get_admin_notices
*
* This function will return an array containing any admin notices
*
* @type function
* @date 17/10/13
* @since 5.0.0
*
* @param n/a
* @return (array)
*/
function acf_get_admin_notices()
{
// vars
$admin_notices = acf_get_setting( 'admin_notices' );
// validate
if( !$admin_notices )
{
$admin_notices = array();
}
// return
return $admin_notices;
}
/*
* acf_get_image_sizes
*
* This function will return an array of available image sizes
*
* @type function
* @date 23/10/13
* @since 5.0.0
*
* @param n/a
* @return (array)
*/
function acf_get_image_sizes() {
// global
global $_wp_additional_image_sizes;
// vars
$sizes = array(
'thumbnail' => __("Thumbnail",'acf'),
'medium' => __("Medium",'acf'),
'large' => __("Large",'acf')
);
// find all sizes
$all_sizes = get_intermediate_image_sizes();
// add extra registered sizes
if( !empty($all_sizes) ) {
foreach( $all_sizes as $size ) {
// bail early if already in array
if( isset($sizes[ $size ]) ) {
continue;
}
// append to array
$label = str_replace('-', ' ', $size);
$label = ucwords( $label );
$sizes[ $size ] = $label;
}
}
// add sizes
foreach( array_keys($sizes) as $s ) {
// vars
$w = isset($_wp_additional_image_sizes[$s]['width']) ? $_wp_additional_image_sizes[$s]['width'] : get_option( "{$s}_size_w" );
$h = isset($_wp_additional_image_sizes[$s]['height']) ? $_wp_additional_image_sizes[$s]['height'] : get_option( "{$s}_size_h" );
if( $w && $h ) {
$sizes[ $s ] .= " ({$w} x {$h})";
}
}
// add full end
$sizes['full'] = __("Full Size",'acf');
// filter for 3rd party customization
$sizes = apply_filters( 'acf/get_image_sizes', $sizes );
// return
return $sizes;
}
/*
* acf_get_taxonomies
*
* This function will return an array of available taxonomies
*
* @type function
* @date 7/10/13
* @since 5.0.0
*
* @param n/a
* @return (array)
*/
function acf_get_taxonomies() {
// get all taxonomies
$taxonomies = get_taxonomies( false, 'objects' );
$ignore = array( 'nav_menu', 'link_category' );
$r = array();
// populate $r
foreach( $taxonomies as $taxonomy )
{
if( in_array($taxonomy->name, $ignore) )
{
continue;
}
$r[ $taxonomy->name ] = $taxonomy->name; //"{$taxonomy->labels->singular_name}"; // ({$taxonomy->name})
}
// return
return $r;
}
function acf_get_pretty_taxonomies( $taxonomies = array() ) {
// get post types
if( empty($taxonomies) ) {
// get all custom post types
$taxonomies = acf_get_taxonomies();
}
// get labels
$ref = array();
$r = array();
foreach( array_keys($taxonomies) as $i ) {
// vars
$taxonomy = acf_extract_var( $taxonomies, $i);
$obj = get_taxonomy( $taxonomy );
$name = $obj->labels->singular_name;
// append to r
$r[ $taxonomy ] = $name;
// increase counter
if( !isset($ref[ $name ]) ) {
$ref[ $name ] = 0;
}
$ref[ $name ]++;
}
// get slugs
foreach( array_keys($r) as $i ) {
// vars
$taxonomy = $r[ $i ];
if( $ref[ $taxonomy ] > 1 ) {
$r[ $i ] .= ' (' . $i . ')';
}
}
// return
return $r;
}
/*
* acf_get_taxonomy_terms
*
* This function will return an array of available taxonomy terms
*
* @type function
* @date 7/10/13
* @since 5.0.0
*
* @param $taxonomies (array)
* @return (array)
*/
function acf_get_taxonomy_terms( $taxonomies = array() ) {
// force array
$taxonomies = acf_get_array( $taxonomies );
// get pretty taxonomy names
$taxonomies = acf_get_pretty_taxonomies( $taxonomies );
// vars
$r = array();
// populate $r
foreach( array_keys($taxonomies) as $taxonomy ) {
// vars
$label = $taxonomies[ $taxonomy ];
$terms = get_terms( $taxonomy, array( 'hide_empty' => false ) );
if( !empty($terms) ) {
$r[ $label ] = array();
foreach( $terms as $term ) {
$k = "{$taxonomy}:{$term->slug}";
$r[ $label ][ $k ] = $term->name;
}
}
}
// return
return $r;
}
/*
* acf_decode_taxonomy_terms
*
* This function decodes the $taxonomy:$term strings into a nested array
*
* @type function
* @date 27/02/2014
* @since 5.0.0
*
* @param $terms (array)
* @return (array)
*/
function acf_decode_taxonomy_terms( $terms = false ) {
// load all taxonomies if not specified in args
if( !$terms ) {
$terms = acf_get_taxonomy_terms();
}
// vars
$r = array();
foreach( $terms as $term ) {
// vars
$data = acf_decode_taxonomy_term( $term );
// create empty array
if( !array_key_exists($data['taxonomy'], $r) )
{
$r[ $data['taxonomy'] ] = array();
}
// append to taxonomy
$r[ $data['taxonomy'] ][] = $data['term'];
}
// return
return $r;
}
/*
* acf_decode_taxonomy_term
*
* This function will convert a term string into an array of term data
*
* @type function
* @date 31/03/2014
* @since 5.0.0
*
* @param $string (string)
* @return (array)
*/
function acf_decode_taxonomy_term( $string ) {
// vars
$r = array();
// vars
$data = explode(':', $string);
$taxonomy = 'category';
$term = '';
// check data
if( isset($data[1]) ) {
$taxonomy = $data[0];
$term = $data[1];
}
// add data to $r
$r['taxonomy'] = $taxonomy;
$r['term'] = $term;
// return
return $r;
}
/*
* acf_cache_get
*
* This function is a wrapper for the wp_cache_get to allow for 3rd party customization
*
* @type function
* @date 4/12/2013
* @since 5.0.0
*
* @param $post_id (int)
* @return $post_id (int)
*/
/*
function acf_cache_get( $key, &$found ) {
// vars
$group = 'acf';
$force = false;
// load from cache
$cache = wp_cache_get( $key, $group, $force, $found );
// allow 3rd party customization if cache was not found
if( !$found )
{
$custom = apply_filters("acf/get_cache/{$key}", $cache);
if( $custom !== $cache )
{
$cache = $custom;
$found = true;
}
}
// return
return $cache;
}
*/
/*
* acf_get_array
*
* This function will force a variable to become an array
*
* @type function
* @date 4/02/2014
* @since 5.0.0
*
* @param $var (mixed)
* @return (array)
*/
function acf_get_array( $var = false, $delimiter = ',' ) {
// is array?
if( is_array($var) ) {
return $var;
}
// bail early if empty
if( empty($var) && !is_numeric($var) ) {
return array();
}
// string
if( is_string($var) && $delimiter ) {
return explode($delimiter, $var);
}
// place in array
return array( $var );
}
/*
* acf_get_posts
*
* This function will return an array of posts making sure the order is correct
*
* @type function
* @date 3/03/2015
* @since 5.1.5
*
* @param $args (array)
* @return (array)
*/
function acf_get_posts( $args = array() ) {
// vars
$posts = array();
// defaults
// leave suppress_filters as true becuase we don't want any plugins to modify the query as we know exactly what
$args = acf_parse_args( $args, array(
'posts_per_page' => -1,
'post_type' => '',
'post_status' => 'any'
));
// post type
if( empty($args['post_type']) ) {
$args['post_type'] = acf_get_post_types();
}
// validate post__in
if( $args['post__in'] ) {
// force value to array
$args['post__in'] = acf_get_array( $args['post__in'] );
// convert to int
$args['post__in'] = array_map('intval', $args['post__in']);
// add filter to remove post_type
// use 'query' filter so that 'suppress_filters' can remain true
//add_filter('query', '_acf_query_remove_post_type');
// order by post__in
$args['orderby'] = 'post__in';
}
// load posts in 1 query to save multiple DB calls from following code
$posts = get_posts($args);
// remove this filter (only once)
//remove_filter('query', '_acf_query_remove_post_type');
// validate order
if( $posts && $args['post__in'] ) {
// vars
$order = array();
// generate sort order
foreach( $posts as $i => $post ) {
$order[ $i ] = array_search($post->ID, $args['post__in']);
}
// sort
array_multisort($order, $posts);
}
// return
return $posts;
}
/*
* _acf_query_remove_post_type
*
* This function will remove the 'wp_posts.post_type' WHERE clause completely
* When using 'post__in', this clause is unneccessary and slow.
*
* @type function
* @date 4/03/2015
* @since 5.1.5
*
* @param $sql (string)
* @return $sql
*/
function _acf_query_remove_post_type( $sql ) {
// global
global $wpdb;
// bail ealry if no 'wp_posts.ID IN'
if( strpos($sql, "$wpdb->posts.ID IN") === false ) {
return $sql;
}
// get bits
$glue = 'AND';
$bits = explode($glue, $sql);
// loop through $where and remove any post_type queries
foreach( $bits as $i => $bit ) {
if( strpos($bit, "$wpdb->posts.post_type") !== false ) {
unset( $bits[ $i ] );
}
}
// join $where back together
$sql = implode($glue, $bits);
// return
return $sql;
}
/*
* acf_get_grouped_posts
*
* This function will return all posts grouped by post_type
* This is handy for select settings
*
* @type function
* @date 27/02/2014
* @since 5.0.0
*
* @param $args (array)
* @return (array)
*/
function acf_get_grouped_posts( $args ) {
// vars
$r = array();
// defaults
$args = acf_parse_args( $args, array(
'posts_per_page' => -1,
'paged' => 0,
'post_type' => 'post',
'orderby' => 'menu_order title',
'order' => 'ASC',
'post_status' => 'any',
'suppress_filters' => false,
'update_post_meta_cache' => false,
));
// find array of post_type
$post_types = acf_get_array( $args['post_type'] );
$post_types_labels = acf_get_pretty_post_types($post_types);
// attachment doesn't work if it is the only item in an array
if( count($post_types) == 1 ) {
$args['post_type'] = current($post_types);
}
// add filter to orderby post type
add_filter('posts_orderby', '_acf_orderby_post_type', 10, 2);
// get posts
$posts = get_posts( $args );
// remove this filter (only once)
remove_filter('posts_orderby', '_acf_orderby_post_type');
// loop
foreach( $post_types as $post_type ) {
// vars
$this_posts = array();
$this_group = array();
// populate $this_posts
foreach( array_keys($posts) as $key ) {
if( $posts[ $key ]->post_type == $post_type ) {
$this_posts[] = acf_extract_var( $posts, $key );
}
}
// bail early if no posts for this post type
if( empty($this_posts) ) {
continue;
}
// sort into hierachial order!
// this will fail if a search has taken place because parents wont exist
if( is_post_type_hierarchical($post_type) && empty($args['s'])) {
// vars
$match_id = $this_posts[ 0 ]->ID;
$offset = 0;
$length = count($this_posts);
$parent = acf_maybe_get( $args, 'post_parent', 0 );
// reset $this_posts
$this_posts = array();
// get all posts
$all_args = array_merge($args, array(
'posts_per_page' => -1,
'paged' => 0,
'post_type' => $post_type
));
$all_posts = get_posts( $all_args );
// loop over posts and update $offset
foreach( $all_posts as $offset => $p ) {
if( $p->ID == $match_id ) {
break;
}
}
// order posts
$all_posts = get_page_children( $parent, $all_posts );
// append
for( $i = $offset; $i < ($offset + $length); $i++ ) {
$this_posts[] = acf_extract_var( $all_posts, $i);
}
}
// populate $this_posts
foreach( array_keys($this_posts) as $key ) {
// extract post
$post = acf_extract_var( $this_posts, $key );
// add to group
$this_group[ $post->ID ] = $post;
}
// group by post type
$post_type_name = $post_types_labels[ $post_type ];
$r[ $post_type_name ] = $this_group;
}
// return
return $r;
}
function _acf_orderby_post_type( $ordeby, $wp_query ) {
// global
global $wpdb;
// get post types
$post_types = $wp_query->get('post_type');
// prepend SQL
if( is_array($post_types) ) {
$post_types = implode("','", $post_types);
$ordeby = "FIELD({$wpdb->posts}.post_type,'$post_types')," . $ordeby;
}
// return
return $ordeby;
}
function acf_get_post_title( $post = 0 ) {
// load post if given an ID
if( is_numeric($post) ) {
$post = get_post($post);
}
// title
$title = get_the_title( $post->ID );
// empty
if( $title === '' ) {
$title = __('(no title)', 'acf');
}
// ancestors
if( $post->post_type != 'attachment' ) {
$ancestors = get_ancestors( $post->ID, $post->post_type );
$title = str_repeat('- ', count($ancestors)) . $title;
}
// status
if( get_post_status( $post->ID ) != "publish" ) {
$title .= ' (' . get_post_status( $post->ID ) . ')';
}
// return
return $title;
}
function acf_order_by_search( $array, $search ) {
// vars
$weights = array();
$needle = strtolower( $search );
// add key prefix
foreach( array_keys($array) as $k ) {
$array[ '_' . $k ] = acf_extract_var( $array, $k );
}
// add search weight
foreach( $array as $k => $v ) {
// vars
$weight = 0;
$haystack = strtolower( $v );
$strpos = strpos( $haystack, $needle );
// detect search match
if( $strpos !== false ) {
// set eright to length of match
$weight = strlen( $search );
// increase weight if match starts at begining of string
if( $strpos == 0 ) {
$weight++;
}
}
// append to wights
$weights[ $k ] = $weight;
}
// sort the array with menu_order ascending
array_multisort( $weights, SORT_DESC, $array );
// remove key prefix
foreach( array_keys($array) as $k ) {
$array[ substr($k,1) ] = acf_extract_var( $array, $k );
}
// return
return $array;
}
/*
* acf_json_encode
*
* This function will return pretty JSON for all PHP versions
*
* @type function
* @date 6/03/2014
* @since 5.0.0
*
* @param $json (array)
* @return (string)
*/
function acf_json_encode( $json ) {
// PHP at least 5.4
if( version_compare(PHP_VERSION, '5.4.0', '>=') ) {
return json_encode($json, JSON_PRETTY_PRINT);
}
// PHP less than 5.4
$json = json_encode($json);
// http://snipplr.com/view.php?codeview&id=60559
$result = '';
$pos = 0;
$strLen = strlen($json);
$indentStr = " ";
$newLine = "\n";
$prevChar = '';
$outOfQuotes = true;
for ($i=0; $i<=$strLen; $i++) {
// Grab the next character in the string.
$char = substr($json, $i, 1);
// Are we inside a quoted string?
if ($char == '"' && $prevChar != '\\') {
$outOfQuotes = !$outOfQuotes;
// If this character is the end of an element,
// output a new line and indent the next line.
} else if(($char == '}' || $char == ']') && $outOfQuotes) {
$result .= $newLine;
$pos --;
for ($j=0; $j<$pos; $j++) {
$result .= $indentStr;
}
}
// Add the character to the result string.
$result .= $char;
// If this character is ':' adda space after it
if($char == ':' && $outOfQuotes) {
$result .= ' ';
}
// If the last character was the beginning of an element,
// output a new line and indent the next line.
if (($char == ',' || $char == '{' || $char == '[') && $outOfQuotes) {
$result .= $newLine;
if ($char == '{' || $char == '[') {
$pos ++;
}
for ($j = 0; $j < $pos; $j++) {
$result .= $indentStr;
}
}
$prevChar = $char;
}
// return
return $result;
}
/*
* acf_str_exists
*
* This function will return true if a sub string is found
*
* @type function
* @date 1/05/2014
* @since 5.0.0
*
* @param $needle (string)
* @param $haystack (string)
* @return (boolean)
*/
function acf_str_exists( $needle, $haystack ) {
// return true if $haystack contains the $needle
if( is_string($haystack) && strpos($haystack, $needle) !== false ) {
return true;
}
// return
return false;
}
/*
* acf_debug
*
* description
*
* @type function
* @date 2/05/2014
* @since 5.0.0
*
* @param $post_id (int)
* @return $post_id (int)
*/
function acf_debug() {
// vars
$args = func_get_args();
$s = array_shift($args);
$o = '';
$nl = "\r\n";
// start script
$o .= '<script type="text/javascript">' . $nl;
$o .= 'console.log("' . $s . '"';
if( !empty($args) ) {
foreach( $args as $arg ) {
if( is_object($arg) || is_array($arg) ) {
$arg = json_encode($arg);
} elseif( is_bool($arg) ) {
$arg = $arg ? 'true' : 'false';
}elseif( is_string($arg) ) {
$arg = '"' . $arg . '"';
}
$o .= ', ' . $arg;
}
}
$o .= ');' . $nl;
// end script
$o .= '</script>' . $nl;
// echo
echo $o;
}
function acf_debug_start() {
acf_update_setting( 'debug_start', memory_get_usage());
}
function acf_debug_end() {
$start = acf_get_setting( 'debug_start' );
$end = memory_get_usage();
return $end - $start;
}
/*
* acf_get_updates
*
* This function will reutrn all or relevant updates for ACF
*
* @type function
* @date 12/05/2014
* @since 5.0.0
*
* @param $post_id (int)
* @return $post_id (int)
*/
function acf_get_updates() {
// vars
$updates = array();
$plugin_version = acf_get_setting('version');
$acf_version = get_option('acf_version');
$path = acf_get_path('admin/updates');
// bail early if no version (not activated)
if( !$acf_version ) {
return false;
}
// check that path exists
if( !file_exists( $path ) ) {
return false;
}
$dir = opendir( $path );
while(false !== ( $file = readdir($dir)) ) {
// only php files
if( substr($file, -4) !== '.php' ) {
continue;
}
// get version number
$update_version = substr($file, 0, -4);
// ignore if update is for a future version. May exist for testing
if( version_compare( $update_version, $plugin_version, '>') ) {
continue;
}
// ignore if update has already been run
if( version_compare( $update_version, $acf_version, '<=') ) {
continue;
}
// append
$updates[] = $update_version;
}
// return
return $updates;
}
/*
* acf_encode_choices
*
* description
*
* @type function
* @date 4/06/2014
* @since 5.0.0
*
* @param $post_id (int)
* @return $post_id (int)
*/
function acf_encode_choices( $array = array() ) {
// bail early if not array
if( !is_array($array) ) {
return $array;
}
// vars
$string = '';
if( !empty($array) ) {
foreach( $array as $k => $v ) {
if( $k !== $v ) {
$array[ $k ] = $k . ' : ' . $v;
}
}
$string = implode("\n", $array);
}
// return
return $string;
}
function acf_decode_choices( $string = '' ) {
// validate
if( $string === '') {
return array();
// force array on single numeric values
} elseif( is_numeric($string) ) {
return array( $string );
// bail early if not a a string
} elseif( !is_string($string) ) {
return $string;
}
// vars
$array = array();
// explode
$lines = explode("\n", $string);
// key => value
foreach( $lines as $line ) {
// vars
$k = trim($line);
$v = trim($line);
// look for ' : '
if( acf_str_exists(' : ', $line) ) {
$line = explode(' : ', $line);
$k = trim($line[0]);
$v = trim($line[1]);
}
// append
$array[ $k ] = $v;
}
// return
return $array;
}
/*
* acf_convert_date_to_php
*
* This fucntion converts a date format string from JS to PHP
*
* @type function
* @date 20/06/2014
* @since 5.0.0
*
* @param $date (string)
* @return $date (string)
*/
acf_update_setting('php_to_js_date_formats', array(
// Year
'Y' => 'yy', // Numeric, 4 digits 1999, 2003
'y' => 'y', // Numeric, 2 digits 99, 03
// Month
'm' => 'mm', // Numeric, with leading zeros 01–12
'n' => 'm', // Numeric, without leading zeros 1–12
'F' => 'MM', // Textual full January – December
'M' => 'M', // Textual three letters Jan - Dec
// Weekday
'l' => 'DD', // Full name (lowercase 'L') Sunday – Saturday
'D' => 'D', // Three letter name Mon – Sun
// Day of Month
'd' => 'dd', // Numeric, with leading zeros 01–31
'j' => 'd', // Numeric, without leading zeros 1–31
'S' => '', // The English suffix for the day of the month st, nd or th in the 1st, 2nd or 15th.
));
function acf_convert_date_to_php( $date ) {
// vars
$ignore = array();
// conversion
$php_to_js = acf_get_setting('php_to_js_date_formats');
// loop over conversions
foreach( $php_to_js as $replace => $search ) {
// ignore this replace?
if( in_array($search, $ignore) ) {
continue;
}
// replace
$date = str_replace($search, $replace, $date);
// append to ignore
$ignore[] = $replace;
}
// return
return $date;
}
/*
* acf_convert_date_to_js
*
* This fucntion converts a date format string from PHP to JS
*
* @type function
* @date 20/06/2014
* @since 5.0.0
*
* @param $post_id (int)
* @return $post_id (int)
*/
function acf_convert_date_to_js( $date ) {
// vars
$ignore = array();
// conversion
$php_to_js = acf_get_setting('php_to_js_date_formats');
// loop over conversions
foreach( $php_to_js as $search => $replace ) {
// ignore this replace?
if( in_array($search, $ignore) ) {
continue;
}
// replace
$date = str_replace($search, $replace, $date);
// append to ignore
$ignore[] = $replace;
}
// return
return $date;
}
/*
* acf_update_user_setting
*
* description
*
* @type function
* @date 15/07/2014
* @since 5.0.0
*
* @param $post_id (int)
* @return $post_id (int)
*/
function acf_update_user_setting( $name, $value ) {
// get current user id
$user_id = get_current_user_id();
// get user settings
$settings = get_user_meta( $user_id, 'acf_user_settings', false );
// find settings
if( isset($settings[0]) ) {
$settings = $settings[0];
} else {
$settings = array();
}
// append setting
$settings[ $name ] = $value;
// update user data
return update_metadata('user', $user_id, 'acf_user_settings', $settings);
}
/*
* acf_get_user_setting
*
* description
*
* @type function
* @date 15/07/2014
* @since 5.0.0
*
* @param $post_id (int)
* @return $post_id (int)
*/
function acf_get_user_setting( $name = '', $default = false ) {
// get current user id
$user_id = get_current_user_id();
// get user settings
$settings = get_user_meta( $user_id, 'acf_user_settings', false );
// bail arly if no settings
if( empty($settings[0][$name]) ) {
return $default;
}
// return
return $settings[0][$name];
}
/*
* acf_in_array
*
* description
*
* @type function
* @date 22/07/2014
* @since 5.0.0
*
* @param $post_id (int)
* @return $post_id (int)
*/
function acf_in_array( $value, $array ) {
// bail early if not array
if( !is_array($array) ) {
return false;
}
// find value in array
return in_array($value, $array);
}
/*
* acf_get_valid_post_id
*
* This function will return a valid post_id based on the current screen / parameter
*
* @type function
* @date 8/12/2013
* @since 5.0.0
*
* @param $post_id (mixed)
* @return $post_id (mixed)
*/
function acf_get_valid_post_id( $post_id = 0 ) {
// set post_id to global
if( !$post_id ) {
$post_id = (int) get_the_ID();
}
// allow for option == options
if( $post_id == 'option' ) {
$post_id = 'options';
}
// $post_id may be an object
if( is_object($post_id) ) {
if( isset($post_id->roles, $post_id->ID) ) {
$post_id = 'user_' . $post_id->ID;
} elseif( isset($post_id->taxonomy, $post_id->term_id) ) {
$post_id = $post_id->taxonomy . '_' . $post_id->term_id;
} elseif( isset($post_id->comment_ID) ) {
$post_id = 'comment_' . $post_id->comment_ID;
} elseif( isset($post_id->ID) ) {
$post_id = $post_id->ID;
}
}
// append language code
if( $post_id == 'options' ) {
$dl = acf_get_setting('default_language');
$cl = acf_get_setting('current_language');
if( $cl && $cl !== $dl ) {
$post_id .= '_' . $cl;
}
}
/*
* Override for preview
*
* If the $_GET['preview_id'] is set, then the user wants to see the preview data.
* There is also the case of previewing a page with post_id = 1, but using get_field
* to load data from another post_id.
* In this case, we need to make sure that the autosave revision is actually related
* to the $post_id variable. If they match, then the autosave data will be used, otherwise,
* the user wants to load data from a completely different post_id
*/
if( isset($_GET['preview_id']) ) {
$autosave = wp_get_post_autosave( $_GET['preview_id'] );
if( $autosave && $autosave->post_parent == $post_id ) {
$post_id = (int) $autosave->ID;
}
}
// return
return $post_id;
}
/*
* acf_upload_files
*
* This function will walk througfh the $_FILES data and upload each found
*
* @type function
* @date 25/10/2014
* @since 5.0.9
*
* @param $ancestors (array) an internal parameter, not required
* @return n/a
*/
function acf_upload_files( $ancestors = array() ) {
// vars
$file = array(
'name' => '',
'type' => '',
'tmp_name' => '',
'error' => '',
'size' => ''
);
// populate with $_FILES data
foreach( array_keys($file) as $k ) {
$file[ $k ] = $_FILES['acf'][ $k ];
}
// walk through ancestors
if( !empty($ancestors) ) {
foreach( $ancestors as $a ) {
foreach( array_keys($file) as $k ) {
$file[ $k ] = $file[ $k ][ $a ];
}
}
}
// is array?
if( is_array($file['name']) ) {
foreach( array_keys($file['name']) as $k ) {
$_ancestors = array_merge($ancestors, array($k));
acf_upload_files( $_ancestors );
}
return;
}
// bail ealry if file has error (no file uploaded)
if( $file['error'] ) {
return;
}
// assign global _acfuploader for media validation
$_POST['_acfuploader'] = end($ancestors);
// file found!
$attachment_id = acf_upload_file( $file );
// update $_POST
array_unshift($ancestors, 'acf');
acf_update_nested_array( $_POST, $ancestors, $attachment_id );
}
/*
* acf_upload_file
*
* This function will uploade a $_FILE
*
* @type function
* @date 27/10/2014
* @since 5.0.9
*
* @param $uploaded_file (array) array found from $_FILE data
* @return $id (int) new attachment ID
*/
function acf_upload_file( $uploaded_file ) {
// required
require_once(ABSPATH . "/wp-load.php");
require_once(ABSPATH . "/wp-admin/includes/file.php");
require_once(ABSPATH . "/wp-admin/includes/image.php");
// required for wp_handle_upload() to upload the file
$upload_overrides = array( 'test_form' => false );
// upload
$file = wp_handle_upload( $uploaded_file, $upload_overrides );
// bail ealry if upload failed
if( isset($file['error']) ) {
return $file['error'];
}
// vars
$url = $file['url'];
$type = $file['type'];
$file = $file['file'];
$filename = basename($file);
// Construct the object array
$object = array(
'post_title' => $filename,
'post_mime_type' => $type,
'guid' => $url,
'context' => 'acf-upload'
);
// Save the data
$id = wp_insert_attachment($object, $file);
// Add the meta-data
wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
/** This action is documented in wp-admin/custom-header.php */
do_action( 'wp_create_file_in_uploads', $file, $id ); // For replication
// return new ID
return $id;
}
/*
* acf_update_nested_array
*
* This function will update a nested array value. Useful for modifying the $_POST array
*
* @type function
* @date 27/10/2014
* @since 5.0.9
*
* @param $array (array) target array to be updated
* @param $ancestors (array) array of keys to navigate through to find the child
* @param $value (mixed) The new value
* @return (boolean)
*/
function acf_update_nested_array( &$array, $ancestors, $value ) {
// if no more ancestors, update the current var
if( empty($ancestors) ) {
$array = $value;
// return
return true;
}
// shift the next ancestor from the array
$k = array_shift( $ancestors );
// if exists
if( isset($array[ $k ]) ) {
return acf_update_nested_array( $array[ $k ], $ancestors, $value );
}
// return
return false;
}
/*
* acf_is_screen
*
* This function will return true if all args are matched for the current screen
*
* @type function
* @date 9/12/2014
* @since 5.1.5
*
* @param $post_id (int)
* @return $post_id (int)
*/
function acf_is_screen( $id = '' ) {
// vars
$current_screen = get_current_screen();
// return
return ($id === $current_screen->id);
}
/*
* acf_maybe_get
*
* This function will return a var if it exists in an array
*
* @type function
* @date 9/12/2014
* @since 5.1.5
*
* @param $array (array) the array to look within
* @param $key (key) the array key to look for. Nested values may be found using '/'
* @param $default (mixed) the value returned if not found
* @return $post_id (int)
*/
function acf_maybe_get( $array, $key, $default = null ) {
// vars
$keys = explode('/', $key);
// loop through keys
foreach( $keys as $k ) {
// return default if does not exist
if( !isset($array[ $k ]) ) {
return $default;
}
// update $array
$array = $array[ $k ];
}
// return
return $array;
}
/*
* acf_get_attachment
*
* This function will return an array of attachment data
*
* @type function
* @date 5/01/2015
* @since 5.1.5
*
* @param $post (mixed) either post ID or post object
* @return (array)
*/
function acf_get_attachment( $post ) {
// get post
if ( !$post = get_post( $post ) ) {
return false;
}
// vars
$thumb_id = 0;
$id = $post->ID;
$a = array(
'ID' => $id,
'id' => $id,
'title' => $post->post_title,
'filename' => wp_basename( $post->guid ),
'url' => wp_get_attachment_url( $id ),
'alt' => get_post_meta($id, '_wp_attachment_image_alt', true),
'author' => $post->post_author,
'description' => $post->post_content,
'caption' => $post->post_excerpt,
'name' => $post->post_name,
'date' => $post->post_date_gmt,
'modified' => $post->post_modified_gmt,
'mime_type' => $post->post_mime_type,
'type' => acf_maybe_get( explode('/', $post->post_mime_type), 0, '' ),
'icon' => wp_mime_type_icon( $id )
);
// video may use featured image
if( $a['type'] === 'image' ) {
$thumb_id = $id;
$src = wp_get_attachment_image_src( $id, 'full' );
$a['url'] = $src[0];
$a['width'] = $src[1];
$a['height'] = $src[2];
} elseif( $a['type'] === 'audio' || $a['type'] === 'video' ) {
// video dimentions
if( $a['type'] == 'video' ) {
$meta = wp_get_attachment_metadata( $id );
$a['width'] = acf_maybe_get($meta, 'width', 0);
$a['height'] = acf_maybe_get($meta, 'height', 0);
}
// feature image
if( $featured_id = get_post_thumbnail_id($id) ) {
$thumb_id = $featured_id;
}
}
// sizes
if( $thumb_id ) {
// find all image sizes
if( $sizes = get_intermediate_image_sizes() ) {
$a['sizes'] = array();
foreach( $sizes as $size ) {
// url
$src = wp_get_attachment_image_src( $thumb_id, $size );
// add src
$a['sizes'][ $size ] = $src[0];
$a['sizes'][ $size . '-width' ] = $src[1];
$a['sizes'][ $size . '-height' ] = $src[2];
}
}
}
// return
return $a;
}
/*
* acf_get_truncated
*
* This function will truncate and return a string
*
* @type function
* @date 8/08/2014
* @since 5.0.0
*
* @param $text (string)
* @param $length (int)
* @return (string)
*/
function acf_get_truncated( $text, $length = 64 ) {
// vars
$text = trim($text);
$the_length = strlen( $text );
// cut
$return = substr( $text, 0, ($length - 3) );
// ...
if( $the_length > ($length - 3) ) {
$return .= '...';
}
// return
return $return;
}
/*
* acf_get_current_url
*
* This function will return the current URL
*
* @type function
* @date 23/01/2015
* @since 5.1.5
*
* @param n/a
* @return (string)
*/
function acf_get_current_url() {
// vars
$home = home_url();
$url = home_url($_SERVER['REQUEST_URI']);
// test
//$home = 'http://acf5/dev/wp-admin';
//$url = $home . '/dev/wp-admin/api-template/acf_form';
// explode url (4th bit is the sub folder)
$bits = explode('/', $home, 4);
/*
Array (
[0] => http:
[1] =>
[2] => acf5
[3] => dev
)
*/
// handle sub folder
if( !empty($bits[3]) ) {
$find = '/' . $bits[3];
$pos = strpos($url, $find);
$length = strlen($find);
if( $pos !== false ) {
$url = substr_replace($url, '', $pos, $length);
}
}
// return
return $url;
}
/*
* acf_current_user_can_admin
*
* This function will return true if the current user can administrate the ACF field groups
*
* @type function
* @date 9/02/2015
* @since 5.1.5
*
* @param $post_id (int)
* @return $post_id (int)
*/
function acf_current_user_can_admin() {
if( acf_get_setting('show_admin') && current_user_can(acf_get_setting('capability')) ) {
return true;
}
// return
return false;
}
/*
* acf_get_filesize
*
* This function will return a numeric value of bytes for a given filesize string
*
* @type function
* @date 18/02/2015
* @since 5.1.5
*
* @param $size (mixed)
* @return (int)
*/
function acf_get_filesize( $size = 1 ) {
// vars
$unit = 'MB';
$units = array(
'TB' => 4,
'GB' => 3,
'MB' => 2,
'KB' => 1,
);
// look for $unit within the $size parameter (123 KB)
if( is_string($size) ) {
// vars
$custom = strtoupper( substr($size, -2) );
foreach( $units as $k => $v ) {
if( $custom === $k ) {
$unit = $k;
$size = substr($size, 0, -2);
}
}
}
// calc bytes
$bytes = floatval($size) * pow(1024, $units[$unit]);
// return
return $bytes;
}
/*
* acf_format_filesize
*
* This function will return a formatted string containing the filesize and unit
*
* @type function
* @date 18/02/2015
* @since 5.1.5
*
* @param $size (mixed)
* @return (int)
*/
function acf_format_filesize( $size = 1 ) {
// convert
$bytes = acf_get_filesize( $size );
// vars
$units = array(
'TB' => 4,
'GB' => 3,
'MB' => 2,
'KB' => 1,
);
// loop through units
foreach( $units as $k => $v ) {
$result = $bytes / pow(1024, $v);
if( $result >= 1 ) {
return $result . ' ' . $k;
}
}
// return
return $bytes . ' B';
}
/*
* acf_get_valid_terms
*
* This function will replace old terms with new split term ids
*
* @type function
* @date 27/02/2015
* @since 5.1.5
*
* @param $terms (int|array)
* @param $taxonomy (string)
* @return $terms
*/
function acf_get_valid_terms( $terms = false, $taxonomy = 'category' ) {
// bail early if function does not yet exist or
if( !function_exists('wp_get_split_term') || empty($terms) ) {
return $terms;
}
// vars
$is_array = is_array($terms);
// force into array
$terms = acf_get_array( $terms );
// force ints
$terms = array_map('intval', $terms);
// attempt to find new terms
foreach( $terms as $i => $term_id ) {
$new_term_id = wp_get_split_term($term_id, $taxonomy);
if( $new_term_id ) {
$terms[ $i ] = $new_term_id;
}
}
// revert array if needed
if( !$is_array ) {
$terms = $terms[0];
}
// return
return $terms;
}
/*
* acf_esc_html_deep
*
* Navigates through an array and escapes html from the values.
*
* @type function
* @date 10/06/2015
* @since 5.2.7
*
* @param $value (mixed)
* @return $value
*/
/*
function acf_esc_html_deep( $value ) {
// array
if( is_array($value) ) {
$value = array_map('acf_esc_html_deep', $value);
// object
} elseif( is_object($value) ) {
$vars = get_object_vars( $value );
foreach( $vars as $k => $v ) {
$value->{$k} = acf_esc_html_deep( $v );
}
// string
} elseif( is_string($value) ) {
$value = esc_html($value);
}
// return
return $value;
}
*/
/*
* acf_validate_attachment
*
* This function will validate an attachment based on a field's resrictions and return an array of errors
*
* @type function
* @date 3/07/2015
* @since 5.2.3
*
* @param $attachment (array) attachment data. Cahnges based on context
* @param $field (array) field settings containing restrictions
* @param $context (string) $file is different when uploading / preparing
* @return $errors (array)
*/
function acf_validate_attachment( $attachment, $field, $context = 'prepare' ) {
// vars
$errors = array();
$file = array(
'type' => '',
'width' => 0,
'height' => 0,
'size' => 0
);
// upload
if( $context == 'upload' ) {
// vars
$file['type'] = pathinfo($attachment['name'], PATHINFO_EXTENSION);
$file['size'] = filesize($attachment['tmp_name']);
if( strpos($attachment['type'], 'image') !== false ) {
$size = getimagesize($attachment['tmp_name']);
$file['width'] = acf_maybe_get($size, 0);
$file['height'] = acf_maybe_get($size, 1);
}
// prepare
} elseif( $context == 'prepare' ) {
$file['type'] = pathinfo($attachment['url'], PATHINFO_EXTENSION);
$file['size'] = acf_maybe_get($attachment, 'filesizeInBytes', 0);
$file['width'] = acf_maybe_get($attachment, 'width', 0);
$file['height'] = acf_maybe_get($attachment, 'height', 0);
// custom
} else {
$file = wp_parse_args($file, $attachment);
}
// image
if( $file['width'] || $file['height'] ) {
// width
$min_width = (int) acf_maybe_get($field, 'min_width', 0);
$max_width = (int) acf_maybe_get($field, 'max_width', 0);
if( $file['width'] ) {
if( $min_width && $file['width'] < $min_width ) {
// min width
$errors['min_width'] = sprintf(__('Image width must be at least %dpx.', 'acf'), $min_width );
} elseif( $max_width && $file['width'] > $max_width ) {
// min width
$errors['max_width'] = sprintf(__('Image width must not exceed %dpx.', 'acf'), $max_width );
}
}
// height
$min_height = (int) acf_maybe_get($field, 'min_height', 0);
$max_height = (int) acf_maybe_get($field, 'max_height', 0);
if( $file['height'] ) {
if( $min_height && $file['height'] < $min_height ) {
// min height
$errors['min_height'] = sprintf(__('Image height must be at least %dpx.', 'acf'), $min_height );
} elseif( $max_height && $file['height'] > $max_height ) {
// min height
$errors['max_height'] = sprintf(__('Image height must not exceed %dpx.', 'acf'), $max_height );
}
}
}
// file size
if( $file['size'] ) {
$min_size = acf_maybe_get($field, 'min_size', 0);
$max_size = acf_maybe_get($field, 'max_size', 0);
if( $min_size && $file['size'] < acf_get_filesize($min_size) ) {
// min width
$errors['min_size'] = sprintf(__('File size must be at least %s.', 'acf'), acf_format_filesize($min_size) );
} elseif( $max_size && $file['size'] > acf_get_filesize($max_size) ) {
// min width
$errors['max_size'] = sprintf(__('File size must must not exceed %s.', 'acf'), acf_format_filesize($max_size) );
}
}
// file type
if( $file['type'] ) {
$mime_types = acf_maybe_get($field, 'mime_types', '');
// lower case
$file['type'] = strtolower($file['type']);
$mime_types = strtolower($mime_types);
// explode
$mime_types = str_replace(array(' ', '.'), '', $mime_types);
$mime_types = explode(',', $mime_types); // split pieces
$mime_types = array_filter($mime_types); // remove empty pieces
if( !empty($mime_types) && !in_array($file['type'], $mime_types) ) {
// glue together last 2 types
if( count($mime_types) > 1 ) {
$last1 = array_pop($mime_types);
$last2 = array_pop($mime_types);
$mime_types[] = $last2 . ' ' . __('or', 'acf') . ' ' . $last1;
}
$errors['mime_types'] = sprintf(__('File type must be %s.', 'acf'), implode(', ', $mime_types) );
}
}
// filter for 3rd party customization
$errors = apply_filters("acf/validate_attachment", $errors, $file, $attachment, $field);
$errors = apply_filters("acf/validate_attachment/type={$field['type']}", $errors, $file, $attachment, $field );
$errors = apply_filters("acf/validate_attachment/name={$field['name']}", $errors, $file, $attachment, $field );
$errors = apply_filters("acf/validate_attachment/key={$field['key']}", $errors, $file, $attachment, $field );
// return
return $errors;
}
/*
* _acf_settings_uploader
*
* Dynamic logic for uploader setting
*
* @type function
* @date 7/05/2015
* @since 5.2.3
*
* @param $uploader (string)
* @return $uploader
*/
add_filter('acf/settings/uploader', '_acf_settings_uploader');
function _acf_settings_uploader( $uploader ) {
// if can't upload files
if( !current_user_can('upload_files') ) {
$uploader = 'basic';
}
// return
return $uploader;
}
/*
* Hacks
*
* description
*
* @type function
* @date 17/01/2014
* @since 5.0.0
*
* @param $post_id (int)
* @return $post_id (int)
*/
add_filter("acf/settings/slug", '_acf_settings_slug');
function _acf_settings_slug( $v ) {
$basename = acf_get_setting('basename');
$slug = explode('/', $basename);
$slug = current($slug);
return $slug;
}
?>
| thomasbodin/baltazare-test | wp-content/plugins/advanced-custom-fields-pro/api/api-helpers.php | PHP | gpl-2.0 | 54,778 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
9353,
2546,
1035,
2131,
1035,
4292,
1008,
1008,
2023,
3853,
2097,
2709,
1037,
3643,
2013,
1996,
10906,
9140,
2179,
1999,
1996,
9353,
2546,
4874,
1008,
1008,
1030,
2828,
3853,
1008,
1030,
3058,
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>
<html>
<head>
<title>torouter configuration interface</title>
<link href="/static/css/bootstrap.min.css" rel="stylesheet">
<style type="text/css">
body {
padding-top: 60px;
padding-bottom: 40px;
}
.sidebar-nav {
padding: 9px 0;
}
</style>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container-fluid">
<a class="brand" href="#">torouter</a>
<div class="nav-collapse collapse">
<p class="navbar-text pull-right">
version {{ config.TOROUTERVERSION or "?.?.?" }}
</p>
</div><!--/.nav-collapse -->
</div>
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="span3">
<div class="well sidebar-nav">
<ul class="nav nav-list">
{% macro pagelink(path, name) -%}
<li {% if path == request.path %}class="active"{% endif %}><a href="{{path}}">{{name}}</a></li>
{%- endmacro %}
{{ pagelink("/", "System Status") }}
{{ pagelink("/about/", "About Project") }}
{{ pagelink("/reboot/", "Reboot...") }}
<li class="nav-header">Configuration</li>
{{ pagelink("/wan/", "Upstream Ethernet") }}
{{ pagelink("/lan/", "Local Ethernet") }}
{{ pagelink("/wifi/", "WiFi") }}
{{ pagelink("/tor/", "Tor Network") }}
<li class="nav-header">Monitoring</li>
{{ pagelink("/logs/", "Logs") }}
{{ pagelink("/processes/", "Processes") }}
</ul>
</div><!--/.well -->
</div><!--/span-->
<div class="span9">
{% if messages %}
{{ mesages }}
{% for category, message in messages %}
<div class="alert alert-{{ category }}">
<button type="button" class="close" data-dismiss="alert">×</button>
{% if category == "warning" %}<strong>Warning:</strong>{% endif %}
{% if category == "error" %}<strong>Error:</strong>{% endif %}
{% if category == "info" %}<strong>Note:</strong>{% endif %}
{{ message }}
</div>
{% endfor %}
{% endif %}
{% block body %}{% endblock %}
</div><!--/span-->
</div><!--/row-->
<hr>
<footer>
<p>© torouter, copyleft 2012</p>
</footer>
</div><!--/.fluid-container-->
</body>
</html>
| ffiiccuuss/torouterui | torouterui/templates/base.html | HTML | bsd-3-clause | 2,405 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
2516,
1028,
23790,
19901,
9563,
8278,
1026,
1013,
2516,
1028,
1026,
4957,
17850,
12879,
1027,
1000,
1013,
10763,
1013,
20116,
2015,
1013,
6879,
6494,
236... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
#
# Cookbook:: openvpn
# Recipe:: default
#
# Copyright:: 2014-2018, Xhost Australia
#
# 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.
#
# ensure inclusion of client recipe sets the correct type
node.override['openvpn']['type'] = 'client'
include_recipe 'openvpn::install'
openvpn_conf 'client' do
notifies :restart, 'service[openvpn]'
action :create
end
include_recipe 'openvpn::service'
| xhost-cookbooks/openvpn | recipes/client.rb | Ruby | apache-2.0 | 893 | [
30522,
1001,
1001,
5660,
8654,
1024,
1024,
2330,
2615,
2361,
2078,
1001,
17974,
1024,
1024,
12398,
1001,
1001,
9385,
1024,
1024,
2297,
1011,
2760,
1010,
1060,
15006,
2102,
2660,
1001,
1001,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright (c) 2012, Event Store LLP
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// Neither the name of the Event Store LLP nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
"use strict";
// these $ globals are defined by external environment
// they are redefined here to make R# like tools understand them
var _log = $log;
var _load_module = $load_module;
function log(message) {
_log("PROJECTIONS (JS): " + message);
}
function initializeModules() {
// load module load new instance of the given module every time
// this is a responsibility of prelude to manage instances of modules
var modules = _load_module('Modules');
// TODO: replace with createRequire($load_module)
modules.$load_module = _load_module;
return modules;
}
function initializeProjections() {
var projections = _load_module('Projections');
return projections;
}
var modules = initializeModules();
var projections = initializeProjections();
var eventProcessor;
function scope($on, $notify) {
eventProcessor = projections.createEventProcessor(log, $notify);
eventProcessor.register_command_handlers($on);
function queryLog(message) {
if (typeof message === "string")
_log(message);
else
_log(JSON.stringify(message));
}
function translateOn(handlers) {
for (var name in handlers) {
if (name == 0 || name === "$init") {
eventProcessor.on_init_state(handlers[name]);
} else if (name === "$initShared") {
eventProcessor.on_init_shared_state(handlers[name]);
} else if (name === "$any") {
eventProcessor.on_any(handlers[name]);
} else if (name === "$deleted") {
eventProcessor.on_deleted_notification(handlers[name]);
} else if (name === "$created") {
eventProcessor.on_created_notification(handlers[name]);
} else {
eventProcessor.on_event(name, handlers[name]);
}
}
}
function $defines_state_transform() {
eventProcessor.$defines_state_transform();
}
function transformBy(by) {
eventProcessor.chainTransformBy(by);
return {
transformBy: transformBy,
filterBy: filterBy,
outputState: outputState,
outputTo: outputTo,
};
}
function filterBy(by) {
eventProcessor.chainTransformBy(function (s) {
var result = by(s);
return result ? s : null;
});
return {
transformBy: transformBy,
filterBy: filterBy,
outputState: outputState,
outputTo: outputTo,
};
}
function outputTo(resultStream, partitionResultStreamPattern) {
eventProcessor.$defines_state_transform();
eventProcessor.options({
resultStreamName: resultStream,
partitionResultStreamNamePattern: partitionResultStreamPattern,
});
}
function outputState() {
eventProcessor.$outputState();
return {
transformBy: transformBy,
filterBy: filterBy,
outputTo: outputTo,
};
}
function when(handlers) {
translateOn(handlers);
return {
$defines_state_transform: $defines_state_transform,
transformBy: transformBy,
filterBy: filterBy,
outputTo: outputTo,
outputState: outputState,
};
}
function foreachStream() {
eventProcessor.byStream();
return {
when: when,
};
}
function partitionBy(byHandler) {
eventProcessor.partitionBy(byHandler);
return {
when: when,
};
}
function fromCategory(category) {
eventProcessor.fromCategory(category);
return {
partitionBy: partitionBy,
foreachStream: foreachStream,
when: when,
outputState: outputState,
};
}
function fromAll() {
eventProcessor.fromAll();
return {
partitionBy: partitionBy,
when: when,
foreachStream: foreachStream,
outputState: outputState,
};
}
function fromStream(stream) {
eventProcessor.fromStream(stream);
return {
partitionBy: partitionBy,
when: when,
outputState: outputState,
};
}
function fromStreamCatalog(streamCatalog, transformer) {
eventProcessor.fromStreamCatalog(streamCatalog, transformer ? transformer : null);
return {
foreachStream: foreachStream,
};
}
function fromStreamsMatching(filter) {
eventProcessor.fromStreamsMatching(filter);
return {
when: when,
};
}
function fromStreams(streams) {
var arr = Array.isArray(streams) ? streams : arguments;
for (var i = 0; i < arr.length; i++)
eventProcessor.fromStream(arr[i]);
return {
partitionBy: partitionBy,
when: when,
outputState: outputState,
};
}
function emit(streamId, eventName, eventBody, metadata) {
var message = { streamId: streamId, eventName: eventName , body: JSON.stringify(eventBody), metadata: metadata, isJson: true };
eventProcessor.emit(message);
}
function linkTo(streamId, event, metadata) {
var message = { streamId: streamId, eventName: "$>", body: event.sequenceNumber + "@" + event.streamId, metadata: metadata, isJson: false };
eventProcessor.emit(message);
}
function copyTo(streamId, event, metadata) {
var m = {};
var em = event.metadata;
if (em)
for (var p1 in em)
if (p1.indexOf("$") !== 0 || p1 === "$correlationId")
m[p1] = em[p1];
if (metadata)
for (var p2 in metadata)
if (p2.indexOf("$") !== 0)
m[p2] = metadata[p2];
var message = { streamId: streamId, eventName: event.eventType, body: event.bodyRaw, metadata: m };
eventProcessor.emit(message);
}
function linkStreamTo(streamId, linkedStreamId, metadata) {
var message = { streamId: streamId, eventName: "$@", body: linkedStreamId, metadata: metadata, isJson: false };
eventProcessor.emit(message);
}
function options(options_object) {
eventProcessor.options(options_object);
}
return {
log: queryLog,
on_any: eventProcessor.on_any,
on_raw: eventProcessor.on_raw,
fromAll: fromAll,
fromCategory: fromCategory,
fromStream: fromStream,
fromStreams: fromStreams,
fromStreamCatalog: fromStreamCatalog,
fromStreamsMatching: fromStreamsMatching,
options: options,
emit: emit,
linkTo: linkTo,
copyTo: copyTo,
linkStreamTo: linkStreamTo,
require: modules.require,
};
};
scope; | Narvalex/Eventing | src/Sample/Inventory.Server/EventStore/Prelude/1Prelude.js | JavaScript | mit | 8,499 | [
30522,
1013,
1013,
9385,
1006,
1039,
1007,
2262,
1010,
2724,
3573,
2222,
2361,
1013,
1013,
2035,
2916,
9235,
1012,
1013,
1013,
1013,
1013,
25707,
1998,
2224,
1999,
3120,
1998,
12441,
3596,
1010,
2007,
2030,
2302,
1013,
1013,
14080,
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... |
const handleError = (message) => {
$("#errorMessage").text(message);
$("#domoMessage").animate({width:'toggle'},350);
}
const sendAjax = (action, data) => {
$.ajax({
cache: false,
type: "POST",
url: action,
data: data,
dataType: "json",
success: (result, status, xhr) => {
$("#domoMessage").animate({width:'hide'},350);
window.location = result.redirect;
},
error: (xhr, status, error) => {
const messageObj = JSON.parse(xhr.responseText);
handleError(messageObj.error);
}
});
}
$(document).ready(() => {
$("#signupForm").on("submit", (e) => {
e.preventDefault();
$("#domoMessage").animate({width:'hide'},350);
if($("#user").val() == '' || $("#pass").val() == '' || $("#pass2").val() == '') {
handleError("RAWR! All fields are required");
return false;
}
if($("#pass").val() !== $("#pass2").val()) {
handleError("RAWR! Passwords do not match");
return false;
}
sendAjax($("#signupForm").attr("action"), $("#signupForm").serialize());
return false;
});
$("#loginForm").on("submit", (e) => {
e.preventDefault();
$("#domoMessage").animate({width:'hide'},350);
if($("#user").val() == '' || $("#pass").val() == '') {
handleError("RAWR! Username or password is empty");
return false;
}
sendAjax($("#loginForm").attr("action"), $("#loginForm").serialize());
return false;
});
$("#domoForm").on("submit", (e) => {
e.preventDefault();
$("#domoMessage").animate({width:'hide'},350);
if($("#domoName").val() == '' || $("#domoAge").val() == '') {
handleError("RAWR! All fields are required");
return false;
}
sendAjax($("#domoForm").attr("action"), $("#domoForm").serialize());
return false;
});
}); | CScavone96/DomomakerA | client/client.js | JavaScript | apache-2.0 | 1,835 | [
30522,
9530,
3367,
5047,
2121,
29165,
1027,
1006,
4471,
1007,
1027,
1028,
1063,
1002,
1006,
1000,
1001,
7561,
7834,
3736,
3351,
1000,
1007,
1012,
3793,
1006,
4471,
1007,
1025,
1002,
1006,
1000,
1001,
14383,
8462,
11488,
3351,
1000,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright (c) 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/extensions/settings_api_bubble_helpers.h"
#include <utility>
#include "build/build_config.h"
#include "chrome/browser/extensions/ntp_overridden_bubble_delegate.h"
#include "chrome/browser/extensions/settings_api_bubble_delegate.h"
#include "chrome/browser/extensions/settings_api_helpers.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/extensions/extension_message_bubble_bridge.h"
#include "chrome/browser/ui/extensions/extension_settings_overridden_dialog.h"
#include "chrome/browser/ui/extensions/settings_overridden_params_providers.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/toolbar/toolbar_actions_bar.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/common/extensions/manifest_handlers/settings_overrides_handler.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/browser_url_handler.h"
#include "content/public/browser/navigation_entry.h"
#include "extensions/common/constants.h"
namespace extensions {
namespace {
// Whether the NTP post-install UI is enabled. By default, this is limited to
// Windows, Mac, and ChromeOS, but can be overridden for testing.
#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS)
bool g_ntp_post_install_ui_enabled = true;
#else
bool g_ntp_post_install_ui_enabled = false;
#endif
#if defined(OS_WIN) || defined(OS_MACOSX)
void ShowSettingsApiBubble(SettingsApiOverrideType type,
Browser* browser) {
ToolbarActionsModel* model = ToolbarActionsModel::Get(browser->profile());
if (model->has_active_bubble())
return;
std::unique_ptr<ExtensionMessageBubbleController> settings_api_bubble(
new ExtensionMessageBubbleController(
new SettingsApiBubbleDelegate(browser->profile(), type), browser));
if (!settings_api_bubble->ShouldShow())
return;
settings_api_bubble->SetIsActiveBubble();
std::unique_ptr<ToolbarActionsBarBubbleDelegate> bridge(
new ExtensionMessageBubbleBridge(std::move(settings_api_bubble)));
browser->window()->GetExtensionsContainer()->ShowToolbarActionBubbleAsync(
std::move(bridge));
}
#endif
} // namespace
void SetNtpPostInstallUiEnabledForTesting(bool enabled) {
g_ntp_post_install_ui_enabled = enabled;
}
void MaybeShowExtensionControlledHomeNotification(Browser* browser) {
#if defined(OS_WIN) || defined(OS_MACOSX)
ShowSettingsApiBubble(BUBBLE_TYPE_HOME_PAGE, browser);
#endif
}
void MaybeShowExtensionControlledSearchNotification(
content::WebContents* web_contents,
AutocompleteMatch::Type match_type) {
#if defined(OS_WIN) || defined(OS_MACOSX)
if (!AutocompleteMatch::IsSearchType(match_type) ||
match_type == AutocompleteMatchType::SEARCH_OTHER_ENGINE) {
return;
}
Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
if (!browser)
return;
if (base::FeatureList::IsEnabled(
features::kExtensionSettingsOverriddenDialogs)) {
base::Optional<ExtensionSettingsOverriddenDialog::Params> params =
settings_overridden_params::GetSearchOverriddenParams(
browser->profile());
if (!params)
return;
auto dialog = std::make_unique<ExtensionSettingsOverriddenDialog>(
std::move(*params), browser->profile());
if (!dialog->ShouldShow())
return;
chrome::ShowExtensionSettingsOverriddenDialog(std::move(dialog), browser);
} else {
ShowSettingsApiBubble(BUBBLE_TYPE_SEARCH_ENGINE, browser);
}
#endif
}
void MaybeShowExtensionControlledNewTabPage(
Browser* browser, content::WebContents* web_contents) {
if (!g_ntp_post_install_ui_enabled)
return;
// Acknowledge existing extensions if necessary.
NtpOverriddenBubbleDelegate::MaybeAcknowledgeExistingNtpExtensions(
browser->profile());
// Jump through a series of hoops to see if the web contents is pointing to
// an extension-controlled NTP.
// TODO(devlin): Some of this is redundant with the checks in the bubble/
// dialog. We should consolidate, but that'll be simpler once we only have
// one UI option. In the meantime, extra checks don't hurt.
content::NavigationEntry* entry =
web_contents->GetController().GetVisibleEntry();
if (!entry)
return;
GURL active_url = entry->GetURL();
if (!active_url.SchemeIs(extensions::kExtensionScheme))
return; // Not a URL that we care about.
// See if the current active URL matches a transformed NewTab URL.
GURL ntp_url(chrome::kChromeUINewTabURL);
content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary(
&ntp_url, web_contents->GetBrowserContext());
if (ntp_url != active_url)
return; // Not being overridden by an extension.
Profile* const profile = browser->profile();
ToolbarActionsModel* model = ToolbarActionsModel::Get(profile);
if (model->has_active_bubble())
return;
if (base::FeatureList::IsEnabled(
features::kExtensionSettingsOverriddenDialogs)) {
base::Optional<ExtensionSettingsOverriddenDialog::Params> params =
settings_overridden_params::GetNtpOverriddenParams(profile);
if (!params)
return;
auto dialog = std::make_unique<ExtensionSettingsOverriddenDialog>(
std::move(*params), profile);
if (!dialog->ShouldShow())
return;
chrome::ShowExtensionSettingsOverriddenDialog(std::move(dialog), browser);
return;
}
std::unique_ptr<ExtensionMessageBubbleController> ntp_overridden_bubble(
new ExtensionMessageBubbleController(
new NtpOverriddenBubbleDelegate(profile), browser));
if (!ntp_overridden_bubble->ShouldShow())
return;
ntp_overridden_bubble->SetIsActiveBubble();
std::unique_ptr<ToolbarActionsBarBubbleDelegate> bridge(
new ExtensionMessageBubbleBridge(std::move(ntp_overridden_bubble)));
browser->window()->GetExtensionsContainer()->ShowToolbarActionBubbleAsync(
std::move(bridge));
}
} // namespace extensions
| endlessm/chromium-browser | chrome/browser/ui/extensions/settings_api_bubble_helpers.cc | C++ | bsd-3-clause | 6,229 | [
30522,
1013,
1013,
9385,
1006,
1039,
1007,
2297,
1996,
10381,
21716,
5007,
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,
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... |
using System.Reflection;
using System.Runtime.InteropServices;
using SIL.TestUtilities;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SIL.DictionaryServices.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3a622e63-660a-488b-be9c-40575b539a4c")]
[assembly: OfflineSldr]
| mccarthyrb/libpalaso | SIL.DictionaryServices.Tests/Properties/AssemblyInfo.cs | C# | mit | 819 | [
30522,
2478,
2291,
1012,
9185,
1025,
2478,
2291,
1012,
2448,
7292,
1012,
6970,
11923,
2121,
7903,
2229,
1025,
2478,
9033,
2140,
1012,
3231,
21823,
15909,
3111,
1025,
1013,
1013,
2236,
2592,
2055,
2019,
3320,
2003,
4758,
2083,
1996,
2206,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package threads;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
/**
*
* @author mars
*/
public class Bounce {
public static void main(String[] args) {
JFrame frame = new BounceFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
/**
* A Ball that moves and bounces off the edges of a rectangle
*
*/
class Ball {
private static final int XSIZE = 15;
private static final int YSIZE = 15;
private double x = 0;
private double y = 0;
private double dx = 1;
private double dy = 1;
/**
* Moves the ball to the next position,reversing direction if it hits one of
* the edges
*/
public void move(Rectangle2D bounds) {
x += dx;
y += dy;
if (x < bounds.getMinX()) {
x = bounds.getMinX();
dx = -dx;
}
if (x + XSIZE >= bounds.getMaxX()) {
x = bounds.getMaxX() - XSIZE;
dx = -dx;
}
if (y < bounds.getMinY()) {
y = bounds.getMinY();
dy = -dy;
}
if (y + YSIZE >= bounds.getMaxY()) {
y = bounds.getMaxY() - YSIZE;
dy = -dy;
}
}
/**
* Gets the shape of the ball at its current position
*/
public Ellipse2D getShape() {
return new Ellipse2D.Double(x, y, XSIZE, YSIZE);
}
}
/**
* The panel that draws the balls.
*/
class BallPanel extends JPanel {
private ArrayList<Ball> balls = new ArrayList<>();
/**
* Add a ball to the panel
*
* @param b the ball to add
*/
public void add(Ball b) {
balls.add(b);
}
@Override
public void paintComponents(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
for (Ball b : balls) {
g2.fill(b.getShape());
}
}
}
/**
* The frame with the panel and buttons
*
*/
class BounceFrame extends JFrame {
private BallPanel panel;
private static final int DEFAULT_WIDTH = 450;
private static final int DEFAULT_HEIGHT = 350;
private final int STEPS = 1000;
private final int DELAY = 3;
/**
* Constructs the frame with the panel for showing the bouncing ball and
* start and close buttons
*/
public BounceFrame() {
setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
setTitle("Bounce");
panel = new BallPanel();
add(panel, BorderLayout.CENTER);
JPanel buttonPanel = new JPanel();
addButton(buttonPanel, "Start", new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
//To change body of generated methods, choose Tools | Templates.
addBall();
}
});
addButton(buttonPanel, "Close", new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
//To change body of generated methods, choose Tools | Templates.
System.exit(0);
}
});
add(buttonPanel, BorderLayout.SOUTH);
}
/**
* Adds a button to a container
*
* @param c the container
* @param title the button title
* @param listener the action listener for the button
*/
public void addButton(Container c, String title, ActionListener listener) {
JButton button = new JButton(title);
c.add(button);
button.addActionListener(listener);
}
/**
* Adds a bouncing ball to the panel and makes it bounce 1,000 times
*/
public void addBall() {
try {
Ball ball = new Ball();
panel.add(ball);
for (int i = 1; i <= STEPS; i++) {
ball.move(panel.getBounds());
panel.paint(panel.getGraphics());
Thread.sleep(DELAY);
}
} catch (InterruptedException e) {
}
}
}
| devopsmwas/javapractice | NetBeansProjects/practice/src/threads/Bounce.java | Java | mit | 4,470 | [
30522,
1013,
1008,
1008,
2000,
2689,
2023,
6105,
20346,
1010,
5454,
6105,
20346,
2015,
1999,
2622,
5144,
1012,
1008,
2000,
2689,
2023,
23561,
5371,
1010,
5454,
5906,
1064,
23561,
2015,
1008,
1998,
2330,
1996,
23561,
1999,
1996,
3559,
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... |
#ifndef BITCOINFIELD_H
#define BITCOINFIELD_H
#include <QWidget>
//#include <QVariant>
QT_BEGIN_NAMESPACE
class QDoubleSpinBox;
class QValueComboBox;
QT_END_NAMESPACE
/** Widget for entering bitcoin amounts.
*/
class BitcoinAmountField: public QWidget
{
Q_OBJECT
Q_PROPERTY(qint64 value READ value WRITE setValue NOTIFY textChanged USER true)
public:
explicit BitcoinAmountField(QWidget *parent = 0);
qint64 value(bool *valid=0) const;
void setValue(qint64 value);
/** Mark current value as invalid in UI. */
void setValid(bool valid);
/** Perform input validation, mark field as invalid if entered value is not valid. */
bool validate();
/** Change unit used to display amount. */
void setDisplayUnit(int unit);
/** Make field empty and ready for new input. */
void clear();
/** Qt messes up the tab chain by default in some cases (issue https://bugreports.qt-project.org/browse/QTBUG-10907),
in these cases we have to set it up manually.
*/
QWidget *setupTabChain(QWidget *prev);
// QVariant inputMethodQuery(Qt::InputMethodQuery property) const;
// Q_INVOKABLE QVariant inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const;
signals:
void textChanged();
protected:
/** Intercept focus-in event and ',' key presses */
bool eventFilter(QObject *object, QEvent *event);
private:
QDoubleSpinBox *amount;
QValueComboBox *unit;
int currentUnit;
void setText(const QString &text);
QString text() const;
private slots:
void unitChanged(int idx);
};
#endif // BITCOINFIELD_H
| artboomerangwin/artboomerang | src/qt/bitcoinamountfield.h | C | mit | 1,617 | [
30522,
1001,
2065,
13629,
2546,
2978,
3597,
2378,
3790,
1035,
1044,
1001,
9375,
2978,
3597,
2378,
3790,
1035,
1044,
1001,
2421,
1026,
1053,
9148,
24291,
1028,
1013,
1013,
1001,
2421,
1026,
1053,
10755,
2937,
2102,
1028,
1053,
2102,
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... |
DELETE FROM `weenie` WHERE `class_Id` = 20478;
INSERT INTO `weenie` (`class_Id`, `class_Name`, `type`, `last_Modified`)
VALUES (20478, 'scrollfireprotectionself7', 34, '2019-02-10 00:00:00') /* Scroll */;
INSERT INTO `weenie_properties_int` (`object_Id`, `type`, `value`)
VALUES (20478, 1, 8192) /* ItemType - Writable */
, (20478, 5, 30) /* EncumbranceVal */
, (20478, 16, 8) /* ItemUseable - Contained */
, (20478, 19, 2000) /* Value */
, (20478, 93, 1044) /* PhysicsState - Ethereal, IgnoreCollisions, Gravity */
, (20478, 8041, 101) /* PCAPRecordedPlacement - Resting */;
INSERT INTO `weenie_properties_bool` (`object_Id`, `type`, `value`)
VALUES (20478, 22, True ) /* Inscribable */;
INSERT INTO `weenie_properties_float` (`object_Id`, `type`, `value`)
VALUES (20478, 39, 1.5) /* DefaultScale */;
INSERT INTO `weenie_properties_string` (`object_Id`, `type`, `value`)
VALUES (20478, 1, 'Scroll of Fiery Blessing') /* Name */
, (20478, 14, 'Use this item to attempt to learn its spell.') /* Use */
, (20478, 16, 'Inscribed spell: Fiery Blessing
Reduces damage the caster takes from Fire by 65%.') /* LongDesc */;
INSERT INTO `weenie_properties_d_i_d` (`object_Id`, `type`, `value`)
VALUES (20478, 1, 0x0200018A) /* Setup */
, (20478, 8, 0x06003555) /* Icon */
, (20478, 22, 0x3400002B) /* PhysicsEffectTable */
, (20478, 28, 2157) /* Spell - FireProtectionSelf7 */
, (20478, 8001, 6307864) /* PCAPRecordedWeenieHeader - Value, Usable, Container, Burden, Spell */
, (20478, 8003, 18) /* PCAPRecordedObjectDesc - Inscribable, Attackable */
, (20478, 8005, 135297) /* PCAPRecordedPhysicsDesc - CSetup, ObjScale, PeTable, AnimationFrame */;
INSERT INTO `weenie_properties_i_i_d` (`object_Id`, `type`, `value`)
VALUES (20478, 8000, 0xDC32EF42) /* PCAPRecordedObjectIID */;
| ACEmulator/ACE-World | Database/3-Core/9 WeenieDefaults/SQL/Scroll/Writable/20478 Scroll of Fiery Blessing.sql | SQL | agpl-3.0 | 1,929 | [
30522,
3972,
12870,
2013,
1036,
16776,
8034,
1036,
2073,
1036,
2465,
1035,
8909,
1036,
1027,
19627,
2581,
2620,
1025,
19274,
2046,
1036,
16776,
8034,
1036,
1006,
1036,
2465,
1035,
8909,
1036,
1010,
1036,
2465,
1035,
2171,
1036,
1010,
1036,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>com.cloudera.oryx.api.serving (Oryx 2.8.0 API)</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
</head>
<body>
<h1 class="bar"><a href="../../../../../com/cloudera/oryx/api/serving/package-summary.html" target="classFrame">com.cloudera.oryx.api.serving</a></h1>
<div class="indexContainer">
<h2 title="Interfaces">Interfaces</h2>
<ul title="Interfaces">
<li><a href="HasCSV.html" title="interface in com.cloudera.oryx.api.serving" target="classFrame"><span class="interfaceName">HasCSV</span></a></li>
<li><a href="ServingModel.html" title="interface in com.cloudera.oryx.api.serving" target="classFrame"><span class="interfaceName">ServingModel</span></a></li>
<li><a href="ServingModelManager.html" title="interface in com.cloudera.oryx.api.serving" target="classFrame"><span class="interfaceName">ServingModelManager</span></a></li>
</ul>
<h2 title="Classes">Classes</h2>
<ul title="Classes">
<li><a href="AbstractServingModelManager.html" title="class in com.cloudera.oryx.api.serving" target="classFrame">AbstractServingModelManager</a></li>
<li><a href="OryxResource.html" title="class in com.cloudera.oryx.api.serving" target="classFrame">OryxResource</a></li>
</ul>
<h2 title="Exceptions">Exceptions</h2>
<ul title="Exceptions">
<li><a href="OryxServingException.html" title="class in com.cloudera.oryx.api.serving" target="classFrame">OryxServingException</a></li>
</ul>
</div>
</body>
</html>
| OryxProject/oryx | docs/apidocs/com/cloudera/oryx/api/serving/package-frame.html | HTML | apache-2.0 | 1,774 | [
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 2014, Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import logging
import threading
import time
from oslo_messaging._drivers.protocols.amqp import controller
from oslo_messaging._i18n import _LW
from oslo_messaging import exceptions
from six import moves
LOG = logging.getLogger(__name__)
class SendTask(controller.Task):
"""A task that sends a message to a target, and optionally waits for a
reply message. The caller may block until the remote confirms receipt or
the reply message has arrived.
"""
def __init__(self, target, request, wait_for_reply, deadline):
super(SendTask, self).__init__()
self._target = target
self._request = request
self._deadline = deadline
self._wait_for_reply = wait_for_reply
self._results_queue = moves.queue.Queue()
def wait(self, timeout):
"""Wait for the send to complete, and, optionally, a reply message from
the remote. Will raise MessagingTimeout if the send does not complete
or no reply is received within timeout seconds. If the request has
failed for any other reason, a MessagingException is raised.
"""
try:
result = self._results_queue.get(timeout=timeout)
except moves.queue.Empty:
if self._wait_for_reply:
reason = "Timed out waiting for a reply."
else:
reason = "Timed out waiting for send to complete."
raise exceptions.MessagingTimeout(reason)
if result["status"] == "OK":
return result.get("response", None)
raise result["error"]
def execute(self, controller):
"""Runs on eventloop thread - sends request."""
if not self._deadline or self._deadline > time.time():
controller.request(self._target, self._request,
self._results_queue, self._wait_for_reply)
else:
LOG.warning(_LW("Send request to %s aborted: TTL expired."),
self._target)
class ListenTask(controller.Task):
"""A task that creates a subscription to the given target. Messages
arriving from the target are given to the listener.
"""
def __init__(self, target, listener, notifications=False):
"""Create a subscription to the target."""
super(ListenTask, self).__init__()
self._target = target
self._listener = listener
self._notifications = notifications
def execute(self, controller):
"""Run on the eventloop thread - subscribes to target. Inbound messages
are queued to the listener's incoming queue.
"""
if self._notifications:
controller.subscribe_notifications(self._target,
self._listener.incoming)
else:
controller.subscribe(self._target, self._listener.incoming)
class ReplyTask(controller.Task):
"""A task that sends 'response' message to 'address'.
"""
def __init__(self, address, response, log_failure):
super(ReplyTask, self).__init__()
self._address = address
self._response = response
self._log_failure = log_failure
self._wakeup = threading.Event()
def wait(self):
"""Wait for the controller to send the message.
"""
self._wakeup.wait()
def execute(self, controller):
"""Run on the eventloop thread - send the response message."""
controller.response(self._address, self._response)
self._wakeup.set()
| dukhlov/oslo.messaging | oslo_messaging/_drivers/protocols/amqp/drivertasks.py | Python | apache-2.0 | 4,126 | [
30522,
1001,
9385,
2297,
1010,
2417,
6045,
1010,
4297,
1012,
1001,
1001,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
2017,
2089,
1001,
2025,
2224,
2023,
5371,
3272,
1999,
12646,
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 org.wordpress.android.ui.notifications;
import com.android.volley.VolleyError;
import org.wordpress.android.models.Note;
import java.util.List;
public class NotificationEvents {
public static class NotificationsChanged {
final public boolean hasUnseenNotes;
public NotificationsChanged() {
this.hasUnseenNotes = false;
}
public NotificationsChanged(boolean hasUnseenNotes) {
this.hasUnseenNotes = hasUnseenNotes;
}
}
public static class NoteModerationFailed {}
public static class NoteModerationStatusChanged {
final boolean isModerating;
final String noteId;
public NoteModerationStatusChanged(String noteId, boolean isModerating) {
this.noteId = noteId;
this.isModerating = isModerating;
}
}
public static class NoteLikeStatusChanged {
final String noteId;
public NoteLikeStatusChanged(String noteId) {
this.noteId = noteId;
}
}
public static class NoteVisibilityChanged {
final boolean isHidden;
final String noteId;
public NoteVisibilityChanged(String noteId, boolean isHidden) {
this.noteId = noteId;
this.isHidden = isHidden;
}
}
public static class NotificationsSettingsStatusChanged {
final String mMessage;
public NotificationsSettingsStatusChanged(String message) {
mMessage = message;
}
public String getMessage() {
return mMessage;
}
}
public static class NotificationsUnseenStatus {
final public boolean hasUnseenNotes;
public NotificationsUnseenStatus(boolean hasUnseenNotes) {
this.hasUnseenNotes = hasUnseenNotes;
}
}
public static class NotificationsRefreshCompleted {
final List<Note> notes;
public NotificationsRefreshCompleted(List<Note> notes) {
this.notes = notes;
}
}
public static class NotificationsRefreshError {
VolleyError error;
public NotificationsRefreshError(VolleyError error) {
this.error = error;
}
public NotificationsRefreshError() {
}
}
}
| mzorz/WordPress-Android | WordPress/src/main/java/org/wordpress/android/ui/notifications/NotificationEvents.java | Java | gpl-2.0 | 2,258 | [
30522,
7427,
8917,
1012,
2773,
20110,
1012,
11924,
1012,
21318,
1012,
26828,
2015,
1025,
12324,
4012,
1012,
11924,
1012,
28073,
1012,
28073,
2121,
29165,
1025,
12324,
8917,
1012,
2773,
20110,
1012,
11924,
1012,
4275,
1012,
3602,
1025,
12324,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# $mol_book
Component for lazy add and/or remove pages depending on the container size. Supports pop left of front page that hides when it blurs.
## [Online demo](http://eigenmethod.github.io/mol/#demo=mol_book_demo)
## Usage example
```
$my_app $mol_book
pages /
<= Nav_bar $side_menu
minimal_width 100
<= Main $main_page
minimal_width 400
```
## Properties
`pages() : $mol_view[]`
The array of "pages"
`event_front_up( next? : Event ) : Event`
Pop left front page.
`event_front_down( next? : Event ) : Event`
Hide front page is its poped.
| nin-jin/mol | book/readme.md | Markdown | mit | 563 | [
30522,
1001,
1002,
9587,
2140,
1035,
2338,
6922,
2005,
13971,
5587,
1998,
1013,
2030,
6366,
5530,
5834,
2006,
1996,
11661,
2946,
1012,
6753,
3769,
2187,
1997,
2392,
3931,
2008,
17382,
2043,
2009,
14819,
2015,
1012,
1001,
1001,
1031,
3784,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#!/usr/bin/env python
'''
Copyright (C) 2005 Aaron Spike, aaron@ekips.org
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 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
'''
import random, math, inkex, cubicsuperpath
def randomize((x, y), rx, ry, norm):
if norm:
r = abs(random.normalvariate(0.0,0.5*max(rx, ry)))
else:
r = random.uniform(0.0,max(rx, ry))
a = random.uniform(0.0,2*math.pi)
x += math.cos(a)*rx
y += math.sin(a)*ry
return [x, y]
class RadiusRandomize(inkex.Effect):
def __init__(self):
inkex.Effect.__init__(self)
self.OptionParser.add_option("--title")
self.OptionParser.add_option("-x", "--radiusx",
action="store", type="float",
dest="radiusx", default=10.0,
help="Randomly move nodes and handles within this radius, X")
self.OptionParser.add_option("-y", "--radiusy",
action="store", type="float",
dest="radiusy", default=10.0,
help="Randomly move nodes and handles within this radius, Y")
self.OptionParser.add_option("-c", "--ctrl",
action="store", type="inkbool",
dest="ctrl", default=True,
help="Randomize control points")
self.OptionParser.add_option("-e", "--end",
action="store", type="inkbool",
dest="end", default=True,
help="Randomize nodes")
self.OptionParser.add_option("-n", "--norm",
action="store", type="inkbool",
dest="norm", default=True,
help="Use normal distribution")
def effect(self):
for id, node in self.selected.iteritems():
if node.tag == inkex.addNS('path','svg'):
d = node.get('d')
p = cubicsuperpath.parsePath(d)
for subpath in p:
for csp in subpath:
if self.options.end:
delta=randomize([0,0], self.options.radiusx, self.options.radiusy, self.options.norm)
csp[0][0]+=delta[0]
csp[0][1]+=delta[1]
csp[1][0]+=delta[0]
csp[1][1]+=delta[1]
csp[2][0]+=delta[0]
csp[2][1]+=delta[1]
if self.options.ctrl:
csp[0]=randomize(csp[0], self.options.radiusx, self.options.radiusy, self.options.norm)
csp[2]=randomize(csp[2], self.options.radiusx, self.options.radiusy, self.options.norm)
node.set('d',cubicsuperpath.formatPath(p))
if __name__ == '__main__':
e = RadiusRandomize()
e.affect()
# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99
| step21/inkscape-osx-packaging-native | packaging/macosx/Inkscape.app/Contents/Resources/extensions/radiusrand.py | Python | lgpl-2.1 | 3,583 | [
30522,
1001,
999,
1013,
2149,
2099,
1013,
8026,
1013,
4372,
2615,
18750,
1005,
1005,
1005,
9385,
1006,
1039,
1007,
2384,
7158,
9997,
1010,
7158,
1030,
23174,
4523,
1012,
8917,
2023,
2565,
2003,
2489,
4007,
1025,
2017,
2064,
2417,
2923,
30... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.cloudtrail.model.transform;
import java.math.*;
import javax.annotation.Generated;
import com.amazonaws.services.cloudtrail.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;
import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;
/**
* InvalidCloudWatchLogsLogGroupArnException JSON Unmarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class InvalidCloudWatchLogsLogGroupArnExceptionUnmarshaller extends EnhancedJsonErrorUnmarshaller {
private InvalidCloudWatchLogsLogGroupArnExceptionUnmarshaller() {
super(com.amazonaws.services.cloudtrail.model.InvalidCloudWatchLogsLogGroupArnException.class, "InvalidCloudWatchLogsLogGroupArnException");
}
@Override
public com.amazonaws.services.cloudtrail.model.InvalidCloudWatchLogsLogGroupArnException unmarshallFromContext(JsonUnmarshallerContext context)
throws Exception {
com.amazonaws.services.cloudtrail.model.InvalidCloudWatchLogsLogGroupArnException invalidCloudWatchLogsLogGroupArnException = new com.amazonaws.services.cloudtrail.model.InvalidCloudWatchLogsLogGroupArnException(
null);
int originalDepth = context.getCurrentDepth();
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;
JsonToken token = context.getCurrentToken();
if (token == null)
token = context.nextToken();
if (token == VALUE_NULL) {
return null;
}
while (true) {
if (token == null)
break;
if (token == FIELD_NAME || token == START_OBJECT) {
} else if (token == END_ARRAY || token == END_OBJECT) {
if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
if (context.getCurrentDepth() <= originalDepth)
break;
}
}
token = context.nextToken();
}
return invalidCloudWatchLogsLogGroupArnException;
}
private static InvalidCloudWatchLogsLogGroupArnExceptionUnmarshaller instance;
public static InvalidCloudWatchLogsLogGroupArnExceptionUnmarshaller getInstance() {
if (instance == null)
instance = new InvalidCloudWatchLogsLogGroupArnExceptionUnmarshaller();
return instance;
}
}
| aws/aws-sdk-java | aws-java-sdk-cloudtrail/src/main/java/com/amazonaws/services/cloudtrail/model/transform/InvalidCloudWatchLogsLogGroupArnExceptionUnmarshaller.java | Java | apache-2.0 | 3,122 | [
30522,
1013,
1008,
1008,
9385,
2418,
1011,
16798,
2475,
9733,
1012,
4012,
1010,
4297,
1012,
2030,
2049,
18460,
1012,
2035,
2916,
9235,
1012,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 "../../src/corelib/io/qurl.h"
| KenanSulayman/node-qt | deps/qt-4.8.0/win32/ia32/include/QtCore/qurl.h | C | bsd-3-clause | 40 | [
30522,
1001,
2421,
1000,
1012,
1012,
1013,
1012,
1012,
1013,
5034,
2278,
1013,
4563,
29521,
1013,
22834,
1013,
23183,
2140,
1012,
1044,
1000,
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... |
package com.felixmilea.vorbit.reddit.connectivity
import java.util.Date
import java.text.SimpleDateFormat
import com.felixmilea.vorbit.utils.JSON
class Session(val modhash: String, val cookie: String, val expiration: Date) {
def isExpired = expiration == null || new Date().after(expiration)
def isValid = modhash != null && cookie != null && !isExpired
}
object Session {
def parse(conn: Connection, data: JSON): Session = {
return new Session(
data("modhash"),
data("cookie"),
new SimpleDateFormat("EEE, dd-MMM-yyyy HH:mm:ss zzz").parse(conn.responseHeader("Set-Cookie").split("expires=")(1).split(";")(0)))
}
} | felixmc/Felix-Milea-Ciobanu-Vorbit | code/com/felixmilea/vorbit/reddit/connectivity/Session.scala | Scala | mit | 646 | [
30522,
7427,
4012,
1012,
8383,
4328,
19738,
1012,
29536,
15185,
4183,
1012,
2417,
23194,
1012,
20831,
12324,
9262,
1012,
21183,
4014,
1012,
3058,
12324,
9262,
1012,
3793,
1012,
3722,
13701,
14192,
4017,
12324,
4012,
1012,
8383,
4328,
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... |
function countBs(string) {
return countChar(string, "B");
}
function countChar(string, ch) {
var counted = 0;
for (var i = 0; i < string.length; i++) {
if (string.charAt(i) == ch)
counted += 1;
}
return counted;
}
console.log(countBs("BBC"));
// -> 2
console.log(countChar("kakkerlak", "k"));
// -> 4
| jdhunterae/eloquent_js | ch03/su03-bean_counting.js | JavaScript | mit | 343 | [
30522,
3853,
4175,
5910,
1006,
5164,
1007,
1063,
2709,
4175,
7507,
2099,
1006,
5164,
1010,
1000,
1038,
1000,
1007,
1025,
1065,
3853,
4175,
7507,
2099,
1006,
5164,
1010,
10381,
1007,
1063,
13075,
8897,
1027,
1014,
1025,
2005,
1006,
13075,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 TweetStream
class Terminated < ::StandardError; end
class Error < ::StandardError; end
class ConnectionError < TweetStream::Error; end
# A ReconnectError is raised when the maximum number of retries has
# failed to re-establish a connection.
class ReconnectError < StandardError
attr_accessor :timeout, :retries
def initialize(timeout, retries)
self.timeout = timeout
self.retries = retries
super("Failed to reconnect after #{retries} tries.")
end
end
end | eerwitt/tweetstream | lib/tweetstream/error.rb | Ruby | mit | 506 | [
30522,
11336,
1056,
28394,
3215,
25379,
2465,
12527,
1026,
1024,
1024,
3115,
2121,
29165,
1025,
2203,
2465,
7561,
1026,
1024,
1024,
3115,
2121,
29165,
1025,
2203,
2465,
4434,
2121,
29165,
1026,
1056,
28394,
3215,
25379,
1024,
1024,
7561,
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... |
module SpecHelpers
def setup_site
site = create('test site')
writers = build(:content_type, site: site, name: "Writers", _user: true)
writers.entries_custom_fields.build(label: "Email", type: "email")
writers.entries_custom_fields.build(label: "First Name", type: "string", required: false)
writers.save!
editors = build(:content_type, site: site, name: "Editors", _user: true)
editors.entries_custom_fields.build(label: "Email", type: "email")
editors.entries_custom_fields.build(label: "First Name", type: "string", required: false)
editors.save!
# @ctype = build(:content_type, site: site, name: "Examples")
# @ctype.entries_custom_fields.build(label: "Name", type: "string", searchable: true)
# @ctype.save!
# @stuff_field = @ctype.entries_custom_fields.build(label: "Stuff", type: "text", searchable: false)
# @stuff_field.save!
# @ctype.entries.create!(name: "Findable entry", stuff: "Some stuff")
# @ctype.entries.create!(name: "Hidden", stuff: "Not findable")
create(:sub_page, site: site, title: "Please search for this findable page", slug: "findable", raw_template: "This is what you were looking for")
create(:sub_page, site: site, title: "Unpublished findable", slug: "unpublished-findable", raw_template: "Not published, so can't be found", published: false)
create(:sub_page, site: site, title: "Seems findable", slug: "seems-findable", raw_template: "Even if it seems findable, it sound't be found because of the searchable flag")
# create(:sub_page, site: site, title: "search", slug: "search", raw_template: <<-EOT
# * Search results:
# <ul>
# {% for result in site.search %}
# {% if result.content_type_slug == 'examples' %}
# <li><a href="/examples/{{result._slug}}">{{ result.name }}</a></li>
# {% else %}
# <li><a href="/{{result.fullpath}}">{{ result.title }}</a></li>
# {% endif %}
# {% endfor %}
# </ul>
# EOT
# )
another_site = create('another site')
create(:sub_page,
site: another_site,
title: 'Writers',
slug: 'writers',
raw_template: 'CMS Writers Page'
)
[site, another_site].each do |s|
create(:sub_page,
site: s,
title: 'User Status',
slug: 'status',
raw_template: <<-EOT
User Status:
{% if end_user.logged_in? %}
Logged in as {{ end_user.type }} with email {{ end_user.email }}
{% else %}
Not logged in.
{% endif %}
EOT
)
home = s.pages.where(slug: 'index').first
home.raw_template = <<-EOF
Notice: {{ flash.notice }}
Error: {{ flash.error }}
Content of the home page.
EOF
home.save!
end
another_editors = build(:content_type, site: another_site, name: "Editors", _user: true)
another_editors.entries_custom_fields.build(label: "Email", type: "email")
another_editors.entries_custom_fields.build(label: "First Name", type: "string", required: false)
another_editors.save!
end
end
RSpec.configure { |c| c.include SpecHelpers }
| ryanaip/locomotivecms-users | spec/support/helpers.rb | Ruby | mit | 3,170 | [
30522,
11336,
28699,
16001,
7347,
13366,
16437,
1035,
2609,
2609,
1027,
3443,
1006,
1005,
3231,
2609,
1005,
1007,
4898,
1027,
3857,
1006,
1024,
4180,
1035,
2828,
1010,
2609,
1024,
2609,
1010,
2171,
1024,
1000,
4898,
1000,
1010,
1035,
5310,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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":"31155020","logradouro":"Rua Padre Felipe da Silva","bairro":"Santa Cruz","cidade":"Belo Horizonte","uf":"MG","estado":"Minas Gerais"});
| lfreneda/cepdb | api/v1/31155020.jsonp.js | JavaScript | cc0-1.0 | 150 | [
30522,
1046,
3385,
2361,
1006,
1063,
1000,
8292,
2361,
1000,
1024,
1000,
23532,
24087,
2692,
11387,
1000,
1010,
1000,
8833,
12173,
8162,
2080,
1000,
1024,
1000,
21766,
2050,
28612,
17095,
4830,
11183,
1000,
1010,
1000,
21790,
18933,
1000,
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... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005, TUBITAK/UEKAE
#
# 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.
#
# Please read the COPYING file.
#
#
# Authors: Eray Ozkural <eray@pardus.org.tr>
# Gurer Ozen <gurer@pardus.org.tr>
# Bahadir Kandemir <bahadir@haftalik.net>
# Baris Metin <baris@pardus.org.tr>
"""
autoxml is a metaclass for automatic XML translation, using
a miniature type system. (w00t!) This is based on an excellent
high-level XML processing prototype that Gurer prepared.
Method names are mixedCase for compatibility with minidom,
an old library.
"""
# System
import locale
import codecs
import types
import formatter
import sys
from StringIO import StringIO
import gettext
__trans = gettext.translation('pisi', fallback=True)
_ = __trans.ugettext
# PiSi
import pisi
from pisi.exml.xmlext import *
from pisi.exml.xmlfile import XmlFile
import pisi.context as ctx
import pisi.util as util
import pisi.oo as oo
class Error(pisi.Error):
pass
# requirement specs
mandatory, optional = range(2) # poor man's enum
# basic types
String = types.StringType
Text = types.UnicodeType
Integer = types.IntType
Long = types.LongType
Float = types.FloatType
#class datatype(type):
# def __init__(cls, name, bases, dict):
# """entry point for metaclass code"""
# # standard initialization
# super(autoxml, cls).__init__(name, bases, dict)
class LocalText(dict):
"""Handles XML tags with localized text"""
def __init__(self, tag = "", req = optional):
self.tag = tag
self.req = req
dict.__init__(self)
def decode(self, node, errs, where = ""):
# flags, tag name, instance attribute
assert self.tag != ''
nodes = getAllNodes(node, self.tag)
if not nodes:
if self.req == mandatory:
errs.append(where + ': ' + _("At least one '%s' tag should have local text") %
self.tag )
else:
for node in nodes:
lang = getNodeAttribute(node, 'xml:lang')
c = getNodeText(node)
if not c:
errs.append(where + ': ' + _("'%s' language of tag '%s' is empty") %
(lang, self.tag))
# FIXME: check for dups and 'en'
if not lang:
lang = 'en'
self[lang] = c
def encode(self, node, errs):
assert self.tag != ''
for key in self.iterkeys():
newnode = addNode(node, self.tag)
setNodeAttribute(newnode, 'xml:lang', key)
addText(newnode, '', self[key].encode('utf8'))
#FIXME: maybe more appropriate for pisi.util
@staticmethod
def get_lang():
try:
(lang, encoding) = locale.getlocale()
if not lang:
(lang, encoding) = locale.getdefaultlocale()
if lang==None: # stupid python means it is C locale
return 'en'
else:
return lang[0:2]
except:
raise Error(_('LocalText: unable to get either current or default locale'))
def errors(self, where = unicode()):
errs = []
langs = [ LocalText.get_lang(), 'en', 'tr', ]
if not util.any(lambda x : self.has_key(x), langs):
errs.append( where + ': ' + _("Tag should have at least the current locale, or failing that an English or Turkish version"))
#FIXME: check if all entries are unicode
return errs
def format(self, f, errs):
L = LocalText.get_lang()
if self.has_key(L):
f.add_flowing_data(self[L])
elif self.has_key('en'):
# fallback to English, blah
f.add_flowing_data(self['en'])
elif self.has_key('tr'):
# fallback to Turkish
f.add_flowing_data(self['tr'])
else:
errs.append(_("Tag should have at least the current locale, or failing that an English or Turkish version"))
#FIXME: factor out these common routines
def print_text(self, file = sys.stdout):
w = Writer(file) # plain text
f = formatter.AbstractFormatter(w)
errs = []
self.format(f, errs)
if errs:
for x in errs:
ctx.ui.warning(x)
def __str__(self):
L = LocalText.get_lang()
if self.has_key(L):
return self[L]
elif self.has_key('en'):
# fallback to English, blah
return self['en']
elif self.has_key('tr'):
# fallback to Turkish
return self['tr']
else:
return ""
class Writer(formatter.DumbWriter):
"""adds unicode support"""
def __init__(self, file=None, maxcol=78):
formatter.DumbWriter.__init__(self, file, maxcol)
def send_literal_data(self, data):
self.file.write(data.encode("utf-8"))
i = data.rfind('\n')
if i >= 0:
self.col = 0
data = data[i+1:]
data = data.expandtabs()
self.col = self.col + len(data)
self.atbreak = 0
class autoxml(oo.autosuper, oo.autoprop):
"""High-level automatic XML transformation interface for xmlfile.
The idea is to declare a class for each XML tag. Inside the
class the tags and attributes nested in the tag are further
elaborated. A simple example follows:
class Employee:
__metaclass__ = autoxml
t_Name = [xmlfile.Text, xmlfile.mandatory]
a_Type = [xmlfile.Integer, xmlfile.optional]
This class defines a tag and an attribute nested in Employee
class. Name is a string and type is an integer, called basic
types.
While the tag is mandatory, the attribute may be left out.
Other basic types supported are: xmlfile.Float, xmlfile.Double
and (not implemented yet): xmlfile.Binary
By default, the class name is taken as the corresponding tag,
which may be overridden by defining a tag attribute. Thus,
the same tag may also be written as:
class EmployeeXML:
...
tag = 'Employee'
...
In addition to basic types, we allow for two kinds of complex
types: class types and list types.
A declared class can be nested in another class as follows
class Position:
__metaclass__ = autoxml
t_Name = [xmlfile.Text, xmlfile.mandatory]
t_Description = [xmlfile.Text, xmlfile.optional]
which we can add to our Employee class.
class Employee:
__metaclass__ = autoxml
t_Name = [xmlfile.Text, xmlfile.mandatory]
a_Type = [xmlfile.Integer, xmlfile.optional]
t_Position = [Position, xmlfile.mandatory]
Note some unfortunate redundancy here with Position; this is
justified by the implementation (kidding). Still, you might
want to assign a different name than the class name that
goes in there, which may be fully qualified.
There is more! Suppose we want to define a company, with
of course many employees.
class Company:
__metaclass__ = autoxml
t_Employees = [ [Employee], xmlfile.mandatory, 'Employees/Employee']
Logically, inside the Company/Employees tag, we will have several
Employee tags, which are inserted to the Employees instance variable of
Company in order of appearance. We can define lists of any other valid
type. Here we used a list of an autoxml class defined above.
The mandatory flag here asserts that at least one such record
is to be found.
You see, it works like magic, when it works of course. All of it
done without a single brain exploding.
"""
def __init__(cls, name, bases, dict):
"""entry point for metaclass code"""
#print 'generating class', name
# standard initialization
super(autoxml, cls).__init__(name, bases, dict)
xmlfile_support = XmlFile in bases
cls.autoxml_bases = filter(lambda base: isinstance(base, autoxml), bases)
#TODO: initialize class attribute __xml_tags
#setattr(cls, 'xml_variables', [])
# default class tag is class name
if not dict.has_key('tag'):
cls.tag = name
# generate helper routines, for each XML component
names = []
inits = []
decoders = []
encoders = []
errorss = []
formatters = []
# read declaration order from source
# code contributed by bahadir kandemir
from inspect import getsourcelines
from itertools import ifilter
import re
fn = re.compile('\s*([tas]_[a-zA-Z]+).*').findall
lines = filter(fn, getsourcelines(cls)[0])
decl_order = map(lambda x:x.split()[0], lines)
# there should be at most one str member, and it should be
# the first to process
order = filter(lambda x: not x.startswith('s_'), decl_order)
# find string member
str_members = filter(lambda x:x.startswith('s_'), decl_order)
if len(str_members)>1:
raise Error('Only one str member can be defined')
elif len(str_members)==1:
order.insert(0, str_members[0])
for var in order:
if var.startswith('t_') or var.startswith('a_') or var.startswith('s_'):
name = var[2:]
if var.startswith('a_'):
x = autoxml.gen_attr_member(cls, name)
elif var.startswith('t_'):
x = autoxml.gen_tag_member(cls, name)
elif var.startswith('s_'):
x = autoxml.gen_str_member(cls, name)
(name, init, decoder, encoder, errors, format_x) = x
names.append(name)
inits.append(init)
decoders.append(decoder)
encoders.append(encoder)
errorss.append(errors)
formatters.append(format_x)
# generate top-level helper functions
cls.initializers = inits
def initialize(self, uri = None, keepDoc = False, tmpDir = '/tmp',
**args):
if xmlfile_support:
if args.has_key('tag'):
XmlFile.__init__(self, tag = args['tag'])
else:
XmlFile.__init__(self, tag = cls.tag)
for base in cls.autoxml_bases:
base.__init__(self)
#super(cls, self).__init__(tag = tag) cooperative shit disabled for now
for init in inits:#self.__class__.initializers:
init(self)
for x in args.iterkeys():
setattr(self, x, args[x])
# init hook
if hasattr(self, 'init'):
self.init(tag)
if xmlfile_support and uri:
self.read(uri, keepDoc, tmpDir)
cls.__init__ = initialize
cls.decoders = decoders
def decode(self, node, errs, where = unicode(cls.tag)):
for base in cls.autoxml_bases:
base.decode(self, node, errs, where)
for decode_member in decoders:#self.__class__.decoders:
decode_member(self, node, errs, where)
if hasattr(self, 'decode_hook'):
self.decode_hook(node, errs, where)
cls.decode = decode
cls.encoders = encoders
def encode(self, node, errs):
for base in cls.autoxml_bases:
base.encode(self, node, errs)
for encode_member in encoders:#self.__class__.encoders:
encode_member(self, node, errs)
if hasattr(self, 'encode_hook'):
self.encode_hook(node, errs)
cls.encode = encode
cls.errorss = errorss
def errors(self, where = unicode(name)):
errs = []
for base in cls.autoxml_bases:
errs.extend(base.errors(self, where))
for errors in errorss:#self.__class__.errorss:
errs.extend(errors(self, where))
if hasattr(self, 'errors_hook'):
errs.extend(self.errors_hook(where))
return errs
cls.errors = errors
def check(self):
errs = self.errors()
if errs:
errs.append(_("autoxml.check: '%s' errors") % len(errs))
raise Error(*errs)
cls.check = check
cls.formatters = formatters
def format(self, f, errs):
for base in cls.autoxml_bases:
base.format(self, f, errs)
for formatter in formatters:#self.__class__.formatters:
formatter(self, f, errs)
cls.format = format
def print_text(self, file = sys.stdout):
w = Writer(file) # plain text
f = formatter.AbstractFormatter(w)
errs = []
self.format(f, errs)
if errs:
for x in errs:
ctx.ui.warning(x)
cls.print_text = print_text
if not dict.has_key('__str__'):
def str(self):
strfile = StringIO(u'')
self.print_text(strfile)
print 'strfile=',unicode(strfile)
s = strfile.getvalue()
strfile.close()
print 's=',s,type(s)
return s
cls.__str__ = str
if not dict.has_key('__eq__'):
def equal(self, other):
# handle None
if other ==None:
return False # well, must be False at this point :)
for name in names:
try:
if getattr(self, name) != getattr(other, name):
return False
except:
return False
return True
def notequal(self, other):
return not self.__eq__(other)
cls.__eq__ = equal
cls.__ne__ = notequal
if xmlfile_support:
def read(self, uri, keepDoc = False, tmpDir = '/tmp',
sha1sum = False, compress = None, sign = None, copylocal = False):
"read XML file and decode it into a python object"
self.readxml(uri, tmpDir, sha1sum=sha1sum,
compress=compress, sign=sign, copylocal=copylocal)
errs = []
self.decode(self.rootNode(), errs)
if errs:
errs.append(_("autoxml.read: File '%s' has errors") % uri)
raise Error(*errs)
if hasattr(self, 'read_hook'):
self.read_hook(errs)
if not keepDoc:
self.unlink() # get rid of the tree
errs = self.errors()
if errs:
errs.append(_("autoxml.read: File '%s' has errors") % uri)
raise Error(*errs)
def write(self, uri, keepDoc = False, tmpDir = '/tmp',
sha1sum = False, compress = None, sign = None):
"encode the contents of the python object into an XML file"
errs = self.errors()
if errs:
errs.append(_("autoxml.write: object validation has failed"))
raise Error(*errs)
errs = []
self.newDocument()
self.encode(self.rootNode(), errs)
if hasattr(self, 'write_hook'):
self.write_hook(errs)
if errs:
errs.append(_("autoxml.write: File encoding '%s' has errors") % uri)
raise Error(*errs)
self.writexml(uri, tmpDir, sha1sum=sha1sum, compress=compress, sign=sign)
if not keepDoc:
self.unlink() # get rid of the tree
cls.read = read
cls.write = write
def gen_attr_member(cls, attr):
"""generate readers and writers for an attribute member"""
#print 'attr:', attr
spec = getattr(cls, 'a_' + attr)
tag_type = spec[0]
assert type(tag_type) == type(type)
def readtext(node, attr):
return getNodeAttribute(node, attr)
def writetext(node, attr, text):
#print 'write attr', attr, text
setNodeAttribute(node, attr, text)
anonfuns = cls.gen_anon_basic(attr, spec, readtext, writetext)
return cls.gen_named_comp(attr, spec, anonfuns)
def gen_tag_member(cls, tag):
"""generate helper funs for tag member of class"""
#print 'tag:', tag
spec = getattr(cls, 't_' + tag)
anonfuns = cls.gen_tag(tag, spec)
return cls.gen_named_comp(tag, spec, anonfuns)
def gen_tag(cls, tag, spec):
"""generate readers and writers for the tag"""
tag_type = spec[0]
if type(tag_type) is types.TypeType and \
autoxml.basic_cons_map.has_key(tag_type):
def readtext(node, tagpath):
#print 'read tag', node, tagpath
return getNodeText(node, tagpath)
def writetext(node, tagpath, text):
#print 'write tag', node, tagpath, text
addText(node, tagpath, text.encode('utf8'))
return cls.gen_anon_basic(tag, spec, readtext, writetext)
elif type(tag_type) is types.ListType:
return cls.gen_list_tag(tag, spec)
elif tag_type is LocalText:
return cls.gen_insetclass_tag(tag, spec)
elif type(tag_type) is autoxml or type(tag_type) is types.TypeType:
return cls.gen_class_tag(tag, spec)
else:
raise Error(_('gen_tag: unrecognized tag type %s in spec') %
str(tag_type))
def gen_str_member(cls, token):
"""generate readers and writers for a string member"""
spec = getattr(cls, 's_' + token)
tag_type = spec[0]
assert type(tag_type) == type(type)
def readtext(node, blah):
#node.normalize() # piksemel doesn't have this
return getNodeText(node)
def writetext(node, blah, text):
#print 'writing', text, type(text)
addText(node, "", text.encode('utf-8'))
anonfuns = cls.gen_anon_basic(token, spec, readtext, writetext)
return cls.gen_named_comp(token, spec, anonfuns)
def gen_named_comp(cls, token, spec, anonfuns):
"""generate a named component tag/attr. a decoration of
anonymous functions that do not bind to variable names"""
name = cls.mixed_case(token)
token_type = spec[0]
req = spec[1]
(init_a, decode_a, encode_a, errors_a, format_a) = anonfuns
def init(self):
"""initialize component"""
setattr(self, name, init_a())
def decode(self, node, errs, where):
"""decode component from DOM node"""
#print '*', name
setattr(self, name, decode_a(node, errs, where + '.' + unicode(name)))
def encode(self, node, errs):
"""encode self inside, possibly new, DOM node using xml"""
if hasattr(self, name):
value = getattr(self, name)
else:
value = None
encode_a(node, value, errs)
def errors(self, where):
"""return errors in the object"""
errs = []
if hasattr(self, name) and getattr(self, name) != None:
value = getattr(self,name)
errs.extend(errors_a(value, where + '.' + name))
else:
if req == mandatory:
errs.append(where + ': ' + _('Mandatory variable %s not available') % name)
return errs
def format(self, f, errs):
if hasattr(self, name):
value = getattr(self,name)
f.add_literal_data(token + ': ')
format_a(value, f, errs)
f.add_line_break()
else:
if req == mandatory:
errs.append(_('Mandatory variable %s not available') % name)
return (name, init, decode, encode, errors, format)
def mixed_case(cls, identifier):
"""helper function to turn token name into mixed case"""
if identifier is "":
return ""
else:
if identifier[0]=='I':
lowly = 'i' # because of pythonic idiots we can't choose locale in lower
else:
lowly = identifier[0].lower()
return lowly + identifier[1:]
def tagpath_head_last(cls, tagpath):
"returns split of the tag path into last tag and the rest"
try:
lastsep = tagpath.rindex('/')
except ValueError, e:
return ('', tagpath)
return (tagpath[:lastsep], tagpath[lastsep+1:])
def parse_spec(cls, token, spec):
"""decompose member specification"""
name = cls.mixed_case(token)
token_type = spec[0]
req = spec[1]
if len(spec)>=3:
path = spec[2] # an alternative path specified
elif type(token_type) is type([]):
if type(token_type[0]) is autoxml:
# if list of class, by default nested like in most PSPEC
path = token + '/' + token_type[0].tag
else:
# if list of ordinary type, just take the name for
path = token
elif type(token_type) is autoxml:
# if a class, by default its tag
path = token_type.tag
else:
path = token # otherwise it's the same name as
# the token
return name, token_type, req, path
def gen_anon_basic(cls, token, spec, readtext, writetext):
"""Generate a tag or attribute with one of the basic
types like integer. This has got to be pretty generic
so that we can invoke it from the complex types such as Class
and List. The readtext and writetext arguments achieve
the DOM text access for this datatype."""
name, token_type, req, tagpath = cls.parse_spec(token, spec)
def initialize():
"""default value for all basic types is None"""
return None
def decode(node, errs, where):
"""decode from DOM node, the value, watching the spec"""
#text = unicode(readtext(node, token), 'utf8') # CRUFT FIXME
text = readtext(node, token)
#print 'decoding', token_type, text, type(text), '.'
if text:
try:
#print token_type, autoxml.basic_cons_map[token_type]
value = autoxml.basic_cons_map[token_type](text)
except Exception, e:
print 'exception', e
value = None
errs.append(where + ': ' + _('Type mismatch: read text cannot be decoded'))
return value
else:
if req == mandatory:
errs.append(where + ': ' + _('Mandatory token %s not available') % token)
return None
def encode(node, value, errs):
"""encode given value inside DOM node"""
if value:
writetext(node, token, unicode(value))
else:
if req == mandatory:
errs.append(_('Mandatory token %s not available') % token)
def errors(value, where):
errs = []
if value and not isinstance(value, token_type):
errs.append(where + ': ' + _('Type mismatch. Expected %s, got %s') %
(token_type, type(value)) )
return errs
def format(value, f, errs):
"""format value for pretty printing"""
f.add_literal_data(unicode(value))
return initialize, decode, encode, errors, format
def gen_class_tag(cls, tag, spec):
"""generate a class datatype"""
name, tag_type, req, path = cls.parse_spec(tag, spec)
def make_object():
obj = tag_type.__new__(tag_type)
obj.__init__(tag=tag, req=req)
return obj
def init():
return make_object()
def decode(node, errs, where):
node = getNode(node, tag)
if node:
try:
obj = make_object()
obj.decode(node, errs, where)
return obj
except Error:
errs.append(where + ': '+ _('Type mismatch: DOM cannot be decoded'))
else:
if req == mandatory:
errs.append(where + ': ' + _('Mandatory argument not available'))
return None
def encode(node, obj, errs):
if node and obj:
try:
#FIXME: this doesn't look pretty
classnode = newNode(node, tag)
obj.encode(classnode, errs)
addNode(node, '', classnode)
except Error:
if req == mandatory:
# note: we can receive an error if obj has no content
errs.append(_('Object cannot be encoded'))
else:
if req == mandatory:
errs.append(_('Mandatory argument not available'))
def errors(obj, where):
return obj.errors(where)
def format(obj, f, errs):
try:
obj.format(f, errs)
except Error:
if req == mandatory:
errs.append(_('Mandatory argument not available'))
return (init, decode, encode, errors, format)
def gen_list_tag(cls, tag, spec):
"""generate a list datatype. stores comps in tag/comp_tag"""
name, tag_type, req, path = cls.parse_spec(tag, spec)
pathcomps = path.split('/')
comp_tag = pathcomps.pop()
list_tagpath = util.makepath(pathcomps, sep='/', relative=True)
if len(tag_type) != 1:
raise Error(_('List type must contain only one element'))
x = cls.gen_tag(comp_tag, [tag_type[0], mandatory])
(init_item, decode_item, encode_item, errors_item, format_item) = x
def init():
return []
def decode(node, errs, where):
l = []
nodes = getAllNodes(node, path)
#print node, tag + '/' + comp_tag, nodes
if len(nodes)==0 and req==mandatory:
errs.append(where + ': ' + _('Mandatory list empty'))
ix = 1
for node in nodes:
dummy = newNode(node, "Dummy")
addNode(dummy, '', node)
l.append(decode_item(dummy, errs, where + unicode("[%s]" % ix, 'utf8')))
#l.append(decode_item(node, errs, where + unicode("[%s]" % ix)))
ix += 1
return l
def encode(node, l, errs):
if l and len(l) > 0:
for item in l:
if list_tagpath:
listnode = addNode(node, list_tagpath, branch = False)
else:
listnode = node
encode_item(listnode, item, errs)
#encode_item(node, item, errs)
else:
if req is mandatory:
errs.append(_('Mandatory list empty'))
def errors(l, where):
errs = []
ix = 1
for node in l:
errs.extend(errors_item(node, where + '[%s]' % ix))
ix += 1
return errs
def format(l, f, errs):
# TODO: indent here
ix = 1
length = len(l)
for node in l:
f.add_flowing_data(str(ix) + ': ')
format_item(node, f, errs)
if ix != length:
f.add_flowing_data(', ')
ix += 1
return (init, decode, encode, errors, format)
def gen_insetclass_tag(cls, tag, spec):
"""generate a class datatype that is highly integrated
don't worry if that means nothing to you. this is a silly
hack to implement local text quickly. it's not the most
elegant thing in the world. it's basically a copy of
class tag"""
name, tag_type, req, path = cls.parse_spec(tag, spec)
def make_object():
obj = tag_type.__new__(tag_type)
obj.__init__(tag=tag, req=req)
return obj
def init():
return make_object()
def decode(node, errs, where):
if node:
try:
obj = make_object()
obj.decode(node, errs, where)
return obj
except Error:
errs.append(where + ': ' + _('Type mismatch: DOM cannot be decoded'))
else:
if req == mandatory:
errs.append(where + ': ' + _('Mandatory argument not available'))
return None
def encode(node, obj, errs):
if node and obj:
try:
#FIXME: this doesn't look pretty
obj.encode(node, errs)
except Error:
if req == mandatory:
# note: we can receive an error if obj has no content
errs.append(_('Object cannot be encoded'))
else:
if req == mandatory:
errs.append(_('Mandatory argument not available'))
def errors(obj, where):
return obj.errors(where)
def format(obj, f, errs):
try:
obj.format(f, errs)
except Error:
if req == mandatory:
errs.append(_('Mandatory argument not available'))
return (init, decode, encode, errors, format)
basic_cons_map = {
types.StringType : str,
#TODO: python 3.x: same behavior?
#python 2.x: basic_cons_map[unicode](a) where a is unicode str yields
#TypeError: decoding Unicode is not supported
#types.UnicodeType : lambda x: unicode(x,'utf8'), lambda x:x?
types.UnicodeType : lambda x:x, #: unicode
types.IntType : int,
types.FloatType : float,
types.LongType : long
}
| examachine/pisi | pisi/exml/autoxml.py | Python | gpl-3.0 | 31,161 | [
30522,
1001,
1011,
1008,
1011,
16861,
1024,
21183,
2546,
1011,
1022,
1011,
1008,
1011,
1001,
1001,
9385,
1006,
1039,
1007,
2384,
1010,
14366,
6590,
2243,
1013,
1057,
19025,
2063,
1001,
1001,
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... |
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
*
* CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.sysml.diagram.common.factory;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.gmf.diagram.common.factory.ShapeViewFactory;
import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes;
public class BlockPropertyCompositeClassifierViewFactory extends ShapeViewFactory {
/**
* Creates BlockPropertyComposite view and add Label and Compartment nodes
*/
@Override
protected void decorateView(View containerView, View view, IAdaptable element, String semanticHint, int index, boolean persisted) {
getViewService().createNode(element, view, UMLGraphicalTypes.LABEL_UML_PROPERTY_LABEL_ID, ViewUtil.APPEND, persisted, getPreferencesHint());
getViewService().createNode(element, view, SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID, ViewUtil.APPEND, persisted, getPreferencesHint());
// this action needs to be done after the compartments creation
super.decorateView(containerView, view, element, semanticHint, index, persisted);
}
// Start of user code preferences
@Override
protected void initializeFromPreferences(View view) {
super.initializeFromPreferences(view);
org.eclipse.jface.preference.IPreferenceStore store = (org.eclipse.jface.preference.IPreferenceStore) getPreferencesHint().getPreferenceStore();
if (store == null) {
return;
}
// Get default size from preferences use set view size.
String preferenceConstantWitdh = org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.getpreferenceKey(view, view.getType(), org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.WIDTH);
String preferenceConstantHeight = org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.getpreferenceKey(view, view.getType(), org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.HEIGHT);
ViewUtil.setStructuralFeatureValue(view, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Width(), store.getInt(preferenceConstantWitdh));
ViewUtil.setStructuralFeatureValue(view, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Height(), store.getInt(preferenceConstantHeight));
}
// End of user code
}
| bmaggi/Papyrus-SysML11 | plugins/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/BlockPropertyCompositeClassifierViewFactory.java | Java | epl-1.0 | 2,938 | [
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... |
# (c) Copyright 2006-2008 Nick Sieger <nicksieger@gmail.com>
# See the file LICENSE.txt included with the distribution for
# software license details.
require File.dirname(__FILE__) + "/../../spec_helper.rb"
require 'stringio'
describe "The RSpec reporter" do
before(:each) do
@error = mock("error")
@error.stub!(:expectation_not_met?).and_return(false)
@error.stub!(:pending_fixed?).and_return(false)
@report_mgr = mock("report manager")
@options = mock("options")
@args = [@options, StringIO.new("")]
@args.shift if Spec::VERSION::MAJOR == 1 && Spec::VERSION::MINOR < 1
@fmt = CI::Reporter::RSpec.new *@args
@fmt.report_manager = @report_mgr
@formatter = mock("formatter")
@fmt.formatter = @formatter
end
it "should use a progress bar formatter by default" do
fmt = CI::Reporter::RSpec.new *@args
fmt.formatter.should be_instance_of(Spec::Runner::Formatter::ProgressBarFormatter)
end
it "should use a specdoc formatter for RSpecDoc" do
fmt = CI::Reporter::RSpecDoc.new *@args
fmt.formatter.should be_instance_of(Spec::Runner::Formatter::SpecdocFormatter)
end
it "should create a test suite with one success, one failure, and one pending" do
@report_mgr.should_receive(:write_report).and_return do |suite|
suite.testcases.length.should == 3
suite.testcases[0].should_not be_failure
suite.testcases[0].should_not be_error
suite.testcases[1].should be_error
suite.testcases[2].name.should =~ /\(PENDING\)/
end
example_group = mock "example group"
example_group.stub!(:description).and_return "A context"
@formatter.should_receive(:start).with(3)
@formatter.should_receive(:example_group_started).with(example_group)
@formatter.should_receive(:example_started).exactly(3).times
@formatter.should_receive(:example_passed).once
@formatter.should_receive(:example_failed).once
@formatter.should_receive(:example_pending).once
@formatter.should_receive(:start_dump).once
@formatter.should_receive(:dump_failure).once
@formatter.should_receive(:dump_summary).once
@formatter.should_receive(:dump_pending).once
@formatter.should_receive(:close).once
@fmt.start(3)
@fmt.example_group_started(example_group)
@fmt.example_started("should pass")
@fmt.example_passed("should pass")
@fmt.example_started("should fail")
@fmt.example_failed("should fail", 1, @error)
@fmt.example_started("should be pending")
@fmt.example_pending("A context", "should be pending", "Not Yet Implemented")
@fmt.start_dump
@fmt.dump_failure(1, mock("failure"))
@fmt.dump_summary(0.1, 3, 1, 1)
@fmt.dump_pending
@fmt.close
end
it "should support RSpec 1.0.8 #add_behavior" do
@formatter.should_receive(:start)
@formatter.should_receive(:add_behaviour).with("A context")
@formatter.should_receive(:example_started).once
@formatter.should_receive(:example_passed).once
@formatter.should_receive(:dump_summary)
@report_mgr.should_receive(:write_report)
@fmt.start(2)
@fmt.add_behaviour("A context")
@fmt.example_started("should pass")
@fmt.example_passed("should pass")
@fmt.dump_summary(0.1, 1, 0, 0)
end
it "should use the example #description method when available" do
group = mock "example group"
group.stub!(:description).and_return "group description"
example = mock "example"
example.stub!(:description).and_return "should do something"
@formatter.should_receive(:start)
@formatter.should_receive(:example_group_started).with(group)
@formatter.should_receive(:example_started).with(example).once
@formatter.should_receive(:example_passed).once
@formatter.should_receive(:dump_summary)
@report_mgr.should_receive(:write_report).and_return do |suite|
suite.testcases.last.name.should == "should do something"
end
@fmt.start(2)
@fmt.example_group_started(group)
@fmt.example_started(example)
@fmt.example_passed(example)
@fmt.dump_summary(0.1, 1, 0, 0)
end
end
| Dreyerized/bananascrum | vendor/gems/ci_reporter-1.6.0/spec/ci/reporter/rspec_spec.rb | Ruby | gpl-2.0 | 4,078 | [
30522,
1001,
1006,
1039,
1007,
9385,
2294,
1011,
2263,
4172,
6859,
2099,
1026,
4172,
11741,
4590,
1030,
20917,
4014,
1012,
30524,
1035,
5371,
1035,
1035,
1007,
1009,
1000,
1013,
1012,
1012,
1013,
1012,
1012,
1013,
28699,
1035,
2393,
2121,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/python
# -*- coding: utf-8 -*-
"Visual Property Editor (using wx PropertyGrid) of gui2py's components"
__author__ = "Mariano Reingart (reingart@gmail.com)"
__copyright__ = "Copyright (C) 2013- Mariano Reingart"
__license__ = "LGPL 3.0"
# some parts where inspired or borrowed from wxFormBuilders & wxPython examples
import sys, time, math, os, os.path
import wx
_ = wx.GetTranslation
import wx.propgrid as wxpg
from gui.component import InitSpec, StyleSpec, Spec, EventSpec, DimensionSpec
from gui.font import Font
DEBUG = False
class PropertyEditorPanel(wx.Panel):
def __init__( self, parent, log ):
wx.Panel.__init__(self, parent, wx.ID_ANY)
self.log = log
self.callback = None
self.panel = panel = wx.Panel(self, wx.ID_ANY)
topsizer = wx.BoxSizer(wx.VERTICAL)
# Difference between using PropertyGridManager vs PropertyGrid is that
# the manager supports multiple pages and a description box.
self.pg = pg = wxpg.PropertyGrid(panel,
style=wxpg.PG_SPLITTER_AUTO_CENTER |
wxpg.PG_AUTO_SORT |
wxpg.PG_TOOLBAR)
# Show help as tooltips
pg.SetExtraStyle(wxpg.PG_EX_HELP_AS_TOOLTIPS)
pg.Bind( wxpg.EVT_PG_CHANGED, self.OnPropGridChange )
pg.Bind( wxpg.EVT_PG_PAGE_CHANGED, self.OnPropGridPageChange )
pg.Bind( wxpg.EVT_PG_SELECTED, self.OnPropGridSelect )
pg.Bind( wxpg.EVT_PG_RIGHT_CLICK, self.OnPropGridRightClick )
##pg.AddPage( "Page 1 - Testing All" )
# store the property grid for future reference
self.pg = pg
# load empty object (just draws categories)
self.load_object(None)
# sizing stuff:
topsizer.Add(pg, 1, wx.EXPAND)
panel.SetSizer(topsizer)
topsizer.SetSizeHints(panel)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(panel, 1, wx.EXPAND)
self.SetSizer(sizer)
self.SetAutoLayout(True)
def load_object(self, obj, callback=None):
pg = self.pg # get the property grid reference
self.callback = callback # store the update method
# delete all properties
pg.Clear()
# clean references and aux structures
appended = set()
self.obj = obj
self.groups = {}
# loop on specs and append each property (categorized):
for i, cat, class_ in ((1, 'Init Specs', InitSpec),
(2, 'Dimension Specs', DimensionSpec),
(3, 'Style Specs', StyleSpec),
(5, 'Events', EventSpec),
(4, 'Basic Specs', Spec),
):
pg.Append(wxpg.PropertyCategory("%s - %s" % (i, cat)))
if obj is None:
continue
specs = sorted(obj._meta.specs.items(), key=lambda it: it[0])
for name, spec in specs:
if DEBUG: print "setting prop", spec, class_, spec.type
if isinstance(spec, class_):
prop = {'string': wxpg.StringProperty,
'integer': wxpg.IntProperty,
'float': wxpg.FloatProperty,
'boolean': wxpg.BoolProperty,
'text': wxpg.LongStringProperty,
'code': wxpg.LongStringProperty,
'enum': wxpg.EnumProperty,
'edit_enum': wxpg.EditEnumProperty,
'expr': wxpg.StringProperty,
'array': wxpg.ArrayStringProperty,
'font': wxpg.FontProperty,
'image_file': wxpg.ImageFileProperty,
'colour': wxpg.ColourProperty}.get(spec.type)
if prop and name not in appended:
value = getattr(obj, name)
if DEBUG: print "name", name, value
if spec.type == "code" and value is None:
value = ""
if spec.type == "boolean" and value is None:
value = False
if spec.type == "integer" and value is None:
value = -1
if spec.type in ("string", "text") and value is None:
value = ""
if spec.type == "expr":
value = repr(value)
if spec.type == "font":
if value is None:
value = wx.NullFont
else:
value = value.get_wx_font()
if callable(value):
# event binded at runtime cannot be modified:
value = str(value)
readonly = True
else:
readonly = False
if spec.type == "enum":
prop = prop(name, name,
spec.mapping.keys(),
spec.mapping.values(),
value=spec.mapping.get(value, 0))
elif spec.type == "edit_enum":
prop = prop(name, name,
spec.mapping.keys(),
range(len(spec.mapping.values())),
value=spec.mapping[value])
else:
try:
prop = prop(name, value=value)
except Exception, e:
print "CANNOT LOAD PROPERTY", name, value, e
prop.SetPyClientData(spec)
appended.add(name)
if spec.group is None:
pg.Append(prop)
if readonly:
pg.SetPropertyReadOnly(prop)
else:
# create a group hierachy (wxpg uses dot notation)
group = ""
prop_parent = None
for grp in spec.group.split("."):
prev_group = group # ancestor
group += ("." if group else "") + grp # path
if group in self.groups:
prop_parent = self.groups[group]
else:
prop_group = wxpg.StringProperty(grp,
value="<composed>")
if not prop_parent:
pg.Append(prop_group)
else:
pg.AppendIn(prev_group, prop_group)
prop_parent = prop_group
self.groups[group] = prop_parent
pg.SetPropertyReadOnly(group)
pg.AppendIn(spec.group, prop)
pg.Collapse(spec.group)
name = spec.group + "." + name
if spec.type == "boolean":
pg.SetPropertyAttribute(name, "UseCheckbox", True)
doc = spec.__doc__
if doc:
pg.SetPropertyHelpString(name, doc)
def edit(self, name=""):
"Programatically select a (default) property to start editing it"
# for more info see DoSelectAndEdit in propgrid.cpp
for name in (name, "label", "value", "text", "title", "filename",
"name"):
prop = self.pg.GetPropertyByName(name)
if prop is not None:
break
self.Parent.SetFocus()
self.Parent.Raise()
self.pg.SetFocus()
# give time to the ui to show the prop grid and set focus:
wx.CallLater(250, self.select, prop.GetName())
def select(self, name, flags=0):
"Select a property (and start the editor)"
# do not call this directly from another window, use edit() instead
# // wxPropertyGrid::DoSelectProperty flags (selFlags) -see propgrid.h-
wxPG_SEL_FOCUS=0x0001 # Focuses to created editor
wxPG_SEL_FORCE=0x0002 # Forces deletion and recreation of editor
flags |= wxPG_SEL_FOCUS # | wxPG_SEL_FORCE
prop = self.pg.GetPropertyByName(name)
self.pg.SelectProperty(prop, flags)
if DEBUG: print "selected!", prop
def OnPropGridChange(self, event):
p = event.GetProperty()
if DEBUG: print "change!", p
if p:
name = p.GetName()
spec = p.GetPyClientData()
if spec and 'enum' in spec.type:
value = p.GetValueAsString()
else:
value = p.GetValue()
#self.log.write(u'%s changed to "%s"\n' % (p,p.GetValueAsString()))
# if it a property child (parent.child), extract its name
if "." in name:
name = name[name.rindex(".") + 1:]
if spec and not name in self.groups:
if name == 'font': # TODO: detect property type
# create a gui font from the wx.Font
font = Font()
font.set_wx_font(value)
value = font
# expressions must be evaluated to store the python object
if spec.type == "expr":
value = eval(value)
# re-create the wx_object with the new property value
# (this is required at least to apply new styles and init specs)
if DEBUG: print "changed", self.obj.name
kwargs = {str(name): value}
wx.CallAfter(self.obj.rebuild, **kwargs)
if name == 'name':
wx.CallAfter(self.callback, **dict(name=self.obj.name))
def OnPropGridSelect(self, event):
p = event.GetProperty()
if p:
self.log.write(u'%s selected\n' % (event.GetProperty().GetName()))
else:
self.log.write(u'Nothing selected\n')
def OnDeleteProperty(self, event):
p = self.pg.GetSelectedProperty()
if p:
self.pg.DeleteProperty(p)
else:
wx.MessageBox("First select a property to delete")
def OnReserved(self, event):
pass
def OnPropGridRightClick(self, event):
p = event.GetProperty()
if p:
self.log.write(u'%s right clicked\n' % (event.GetProperty().GetName()))
else:
self.log.write(u'Nothing right clicked\n')
#self.obj.get_parent().Refresh()
def OnPropGridPageChange(self, event):
index = self.pg.GetSelectedPage()
self.log.write('Page Changed to \'%s\'\n' % (self.pg.GetPageName(index)))
if __name__ == '__main__':
import sys,os
app = wx.App()
f = wx.Frame(None)
from gui.controls import Button, Label, TextBox, CheckBox, ListBox, ComboBox
frame = wx.Frame(None)
#o = Button(frame, name="btnTest", label="click me!", default=True)
#o = Label(frame, name="lblTest", alignment="right", size=(-1, 500), text="hello!")
o = TextBox(frame, name="txtTest", border=False, text="hello world!")
#o = CheckBox(frame, name="chkTest", border='none', label="Check me!")
#o = ListBox(frame, name="lstTest", border='none',
# items={'datum1': 'a', 'datum2':'b', 'datum3':'c'},
# multiselect="--multiselect" in sys.argv)
#o = ComboBox(frame, name="cboTest",
# items={'datum1': 'a', 'datum2':'b', 'datum3':'c'},
# readonly='--readonly' in sys.argv,
# )
frame.Show()
log = sys.stdout
w = PropertyEditorPanel(f, log)
w.load_object(o)
f.Show()
app.MainLoop()
| reingart/gui2py | gui/tools/propeditor.py | Python | lgpl-3.0 | 12,658 | [
30522,
1001,
999,
1013,
2149,
2099,
1013,
8026,
1013,
18750,
1001,
1011,
1008,
1011,
16861,
1024,
21183,
2546,
1011,
1022,
1011,
1008,
1011,
1000,
5107,
3200,
3559,
1006,
2478,
1059,
2595,
3200,
16523,
3593,
1007,
1997,
26458,
2475,
7685,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
/* BFD support for the FRV processor.
Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
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 "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
#define FRV_ARCH(MACHINE, NAME, DEFAULT, NEXT) \
{ \
32, /* 32 bits in a word */ \
32, /* 32 bits in an address */ \
8, /* 8 bits in a byte */ \
bfd_arch_frv, /* architecture */ \
MACHINE, /* which machine */ \
"frv", /* architecture name */ \
NAME, /* machine name */ \
4, /* default alignment */ \
DEFAULT, /* is this the default? */ \
bfd_default_compatible, /* architecture comparison fn */ \
bfd_default_scan, /* string to architecture convert fn */ \
NEXT /* next in list */ \
}
static const bfd_arch_info_type arch_info_300
= FRV_ARCH (bfd_mach_fr300, "fr300", FALSE, (bfd_arch_info_type *)0);
static const bfd_arch_info_type arch_info_400
= FRV_ARCH (bfd_mach_fr400, "fr400", FALSE, &arch_info_300);
static const bfd_arch_info_type arch_info_450
= FRV_ARCH (bfd_mach_fr450, "fr450", FALSE, &arch_info_400);
static const bfd_arch_info_type arch_info_500
= FRV_ARCH (bfd_mach_fr500, "fr500", FALSE, &arch_info_450);
static const bfd_arch_info_type arch_info_550
= FRV_ARCH (bfd_mach_fr550, "fr550", FALSE, &arch_info_500);
static const bfd_arch_info_type arch_info_simple
= FRV_ARCH (bfd_mach_frvsimple, "simple", FALSE, &arch_info_550);
static const bfd_arch_info_type arch_info_tomcat
= FRV_ARCH (bfd_mach_frvtomcat, "tomcat", FALSE, &arch_info_simple);
const bfd_arch_info_type bfd_frv_arch
= FRV_ARCH (bfd_mach_frv, "frv", TRUE, &arch_info_tomcat);
| shaotuanchen/sunflower_exp | tools/source/binutils-2.16.1/bfd/cpu-frv.c | C | bsd-3-clause | 2,434 | [
30522,
1013,
1008,
28939,
2094,
2490,
2005,
1996,
10424,
2615,
13151,
1012,
9385,
2526,
1010,
2494,
1010,
2432,
2489,
4007,
3192,
1010,
4297,
1012,
2023,
5371,
2003,
2112,
1997,
28939,
2094,
1010,
1996,
12441,
5371,
4078,
23235,
2953,
3075,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
* SVG <feSpecularLighting> implementation.
*
*/
/*
* Authors:
* hugo Rodrigues <haa.rodrigues@gmail.com>
* Jean-Rene Reinhard <jr@komite.net>
* Abhishek Sharma
*
* Copyright (C) 2006 Hugo Rodrigues
* 2007 authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include "strneq.h"
#include "attributes.h"
#include "svg/svg.h"
#include "sp-object.h"
#include "svg/svg-color.h"
#include "svg/svg-icc-color.h"
#include "filters/specularlighting.h"
#include "filters/distantlight.h"
#include "filters/pointlight.h"
#include "filters/spotlight.h"
#include "xml/repr.h"
#include "display/nr-filter.h"
#include "display/nr-filter-specularlighting.h"
/* FeSpecularLighting base class */
static void sp_feSpecularLighting_children_modified(SPFeSpecularLighting *sp_specularlighting);
SPFeSpecularLighting::SPFeSpecularLighting() : SPFilterPrimitive() {
this->surfaceScale = 1;
this->specularConstant = 1;
this->specularExponent = 1;
this->lighting_color = 0xffffffff;
this->icc = NULL;
//TODO kernelUnit
this->renderer = NULL;
this->surfaceScale_set = FALSE;
this->specularConstant_set = FALSE;
this->specularExponent_set = FALSE;
this->lighting_color_set = FALSE;
}
SPFeSpecularLighting::~SPFeSpecularLighting() {
}
/**
* Reads the Inkscape::XML::Node, and initializes SPFeSpecularLighting variables. For this to get called,
* our name must be associated with a repr via "sp_object_type_register". Best done through
* sp-object-repr.cpp's repr_name_entries array.
*/
void SPFeSpecularLighting::build(SPDocument *document, Inkscape::XML::Node *repr) {
SPFilterPrimitive::build(document, repr);
/*LOAD ATTRIBUTES FROM REPR HERE*/
this->readAttr( "surfaceScale" );
this->readAttr( "specularConstant" );
this->readAttr( "specularExponent" );
this->readAttr( "kernelUnitLength" );
this->readAttr( "lighting-color" );
}
/**
* Drops any allocated memory.
*/
void SPFeSpecularLighting::release() {
SPFilterPrimitive::release();
}
/**
* Sets a specific value in the SPFeSpecularLighting.
*/
void SPFeSpecularLighting::set(unsigned int key, gchar const *value) {
gchar const *cend_ptr = NULL;
gchar *end_ptr = NULL;
switch(key) {
/*DEAL WITH SETTING ATTRIBUTES HERE*/
//TODO test forbidden values
case SP_ATTR_SURFACESCALE:
end_ptr = NULL;
if (value) {
this->surfaceScale = g_ascii_strtod(value, &end_ptr);
if (end_ptr) {
this->surfaceScale_set = TRUE;
} else {
g_warning("this: surfaceScale should be a number ... defaulting to 1");
}
}
//if the attribute is not set or has an unreadable value
if (!value || !end_ptr) {
this->surfaceScale = 1;
this->surfaceScale_set = FALSE;
}
if (this->renderer) {
this->renderer->surfaceScale = this->surfaceScale;
}
this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_SPECULARCONSTANT:
end_ptr = NULL;
if (value) {
this->specularConstant = g_ascii_strtod(value, &end_ptr);
if (end_ptr && this->specularConstant >= 0) {
this->specularConstant_set = TRUE;
} else {
end_ptr = NULL;
g_warning("this: specularConstant should be a positive number ... defaulting to 1");
}
}
if (!value || !end_ptr) {
this->specularConstant = 1;
this->specularConstant_set = FALSE;
}
if (this->renderer) {
this->renderer->specularConstant = this->specularConstant;
}
this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_SPECULAREXPONENT:
end_ptr = NULL;
if (value) {
this->specularExponent = g_ascii_strtod(value, &end_ptr);
if (this->specularExponent >= 1 && this->specularExponent <= 128) {
this->specularExponent_set = TRUE;
} else {
end_ptr = NULL;
g_warning("this: specularExponent should be a number in range [1, 128] ... defaulting to 1");
}
}
if (!value || !end_ptr) {
this->specularExponent = 1;
this->specularExponent_set = FALSE;
}
if (this->renderer) {
this->renderer->specularExponent = this->specularExponent;
}
this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_ATTR_KERNELUNITLENGTH:
//TODO kernelUnit
//this->kernelUnitLength.set(value);
/*TODOif (feSpecularLighting->renderer) {
feSpecularLighting->renderer->surfaceScale = feSpecularLighting->renderer;
}
*/
this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
case SP_PROP_LIGHTING_COLOR:
cend_ptr = NULL;
this->lighting_color = sp_svg_read_color(value, &cend_ptr, 0xffffffff);
//if a value was read
if (cend_ptr) {
while (g_ascii_isspace(*cend_ptr)) {
++cend_ptr;
}
if (strneq(cend_ptr, "icc-color(", 10)) {
if (!this->icc) this->icc = new SVGICCColor();
if ( ! sp_svg_read_icc_color( cend_ptr, this->icc ) ) {
delete this->icc;
this->icc = NULL;
}
}
this->lighting_color_set = TRUE;
} else {
//lighting_color already contains the default value
this->lighting_color_set = FALSE;
}
if (this->renderer) {
this->renderer->lighting_color = this->lighting_color;
}
this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
default:
SPFilterPrimitive::set(key, value);
break;
}
}
/**
* Receives update notifications.
*/
void SPFeSpecularLighting::update(SPCtx *ctx, guint flags) {
if (flags & (SP_OBJECT_MODIFIED_FLAG)) {
this->readAttr( "surfaceScale" );
this->readAttr( "specularConstant" );
this->readAttr( "specularExponent" );
this->readAttr( "kernelUnitLength" );
this->readAttr( "lighting-color" );
}
SPFilterPrimitive::update(ctx, flags);
}
/**
* Writes its settings to an incoming repr object, if any.
*/
Inkscape::XML::Node* SPFeSpecularLighting::write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) {
/* TODO: Don't just clone, but create a new repr node and write all
* relevant values _and children_ into it */
if (!repr) {
repr = this->getRepr()->duplicate(doc);
//repr = doc->createElement("svg:feSpecularLighting");
}
if (this->surfaceScale_set) {
sp_repr_set_css_double(repr, "surfaceScale", this->surfaceScale);
}
if (this->specularConstant_set) {
sp_repr_set_css_double(repr, "specularConstant", this->specularConstant);
}
if (this->specularExponent_set) {
sp_repr_set_css_double(repr, "specularExponent", this->specularExponent);
}
/*TODO kernelUnits */
if (this->lighting_color_set) {
gchar c[64];
sp_svg_write_color(c, sizeof(c), this->lighting_color);
repr->setAttribute("lighting-color", c);
}
SPFilterPrimitive::write(doc, repr, flags);
return repr;
}
/**
* Callback for child_added event.
*/
void SPFeSpecularLighting::child_added(Inkscape::XML::Node *child, Inkscape::XML::Node *ref) {
SPFilterPrimitive::child_added(child, ref);
sp_feSpecularLighting_children_modified(this);
this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
/**
* Callback for remove_child event.
*/
void SPFeSpecularLighting::remove_child(Inkscape::XML::Node *child) {
SPFilterPrimitive::remove_child(child);
sp_feSpecularLighting_children_modified(this);
this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
void SPFeSpecularLighting::order_changed(Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref) {
SPFilterPrimitive::order_changed(child, old_ref, new_ref);
sp_feSpecularLighting_children_modified(this);
this->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
static void sp_feSpecularLighting_children_modified(SPFeSpecularLighting *sp_specularlighting) {
if (sp_specularlighting->renderer) {
sp_specularlighting->renderer->light_type = Inkscape::Filters::NO_LIGHT;
if (SP_IS_FEDISTANTLIGHT(sp_specularlighting->children)) {
sp_specularlighting->renderer->light_type = Inkscape::Filters::DISTANT_LIGHT;
sp_specularlighting->renderer->light.distant = SP_FEDISTANTLIGHT(sp_specularlighting->children);
}
if (SP_IS_FEPOINTLIGHT(sp_specularlighting->children)) {
sp_specularlighting->renderer->light_type = Inkscape::Filters::POINT_LIGHT;
sp_specularlighting->renderer->light.point = SP_FEPOINTLIGHT(sp_specularlighting->children);
}
if (SP_IS_FESPOTLIGHT(sp_specularlighting->children)) {
sp_specularlighting->renderer->light_type = Inkscape::Filters::SPOT_LIGHT;
sp_specularlighting->renderer->light.spot = SP_FESPOTLIGHT(sp_specularlighting->children);
}
}
}
void SPFeSpecularLighting::build_renderer(Inkscape::Filters::Filter* filter) {
g_assert(this != NULL);
g_assert(filter != NULL);
int primitive_n = filter->add_primitive(Inkscape::Filters::NR_FILTER_SPECULARLIGHTING);
Inkscape::Filters::FilterPrimitive *nr_primitive = filter->get_primitive(primitive_n);
Inkscape::Filters::FilterSpecularLighting *nr_specularlighting = dynamic_cast<Inkscape::Filters::FilterSpecularLighting*>(nr_primitive);
g_assert(nr_specularlighting != NULL);
this->renderer = nr_specularlighting;
sp_filter_primitive_renderer_common(this, nr_primitive);
nr_specularlighting->specularConstant = this->specularConstant;
nr_specularlighting->specularExponent = this->specularExponent;
nr_specularlighting->surfaceScale = this->surfaceScale;
nr_specularlighting->lighting_color = this->lighting_color;
nr_specularlighting->set_icc(this->icc);
//We assume there is at most one child
nr_specularlighting->light_type = Inkscape::Filters::NO_LIGHT;
if (SP_IS_FEDISTANTLIGHT(this->children)) {
nr_specularlighting->light_type = Inkscape::Filters::DISTANT_LIGHT;
nr_specularlighting->light.distant = SP_FEDISTANTLIGHT(this->children);
}
if (SP_IS_FEPOINTLIGHT(this->children)) {
nr_specularlighting->light_type = Inkscape::Filters::POINT_LIGHT;
nr_specularlighting->light.point = SP_FEPOINTLIGHT(this->children);
}
if (SP_IS_FESPOTLIGHT(this->children)) {
nr_specularlighting->light_type = Inkscape::Filters::SPOT_LIGHT;
nr_specularlighting->light.spot = SP_FESPOTLIGHT(this->children);
}
//nr_offset->set_dx(sp_offset->dx);
//nr_offset->set_dy(sp_offset->dy);
}
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
| danieljabailey/inkscape_experiments | src/filters/specularlighting.cpp | C++ | gpl-2.0 | 11,839 | [
30522,
1013,
1008,
1008,
1032,
5371,
1008,
17917,
2290,
1026,
10768,
13102,
8586,
7934,
7138,
2075,
1028,
7375,
1012,
1008,
1008,
1013,
1013,
1008,
1008,
6048,
1024,
1008,
9395,
8473,
22934,
1026,
5292,
2050,
1012,
8473,
22934,
1030,
20917,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
namespace eZ\Bundle\EzPublishCoreBundle\Imagine\Filter\Loader;
use eZ\Bundle\EzPublishCoreBundle\Imagine\Filter\FilterInterface;
use Imagine\Image\ImageInterface;
use Liip\ImagineBundle\Imagine\Filter\Loader\LoaderInterface;
class SwirlFilterLoader implements LoaderInterface
{
/** @var FilterInterface */
private $filter;
public function __construct(FilterInterface $filter)
{
$this->filter = $filter;
}
public function load(ImageInterface $image, array $options = [])
{
if (!empty($options)) {
$this->filter->setOption('degrees', $options[0]);
}
return $this->filter->apply($image);
}
}
| ezsystems/ezpublish-kernel | eZ/Bundle/EzPublishCoreBundle/Imagine/Filter/Loader/SwirlFilterLoader.php | PHP | gpl-2.0 | 857 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
1030,
9385,
9385,
1006,
1039,
1007,
1041,
2480,
3001,
2004,
1012,
2035,
2916,
9235,
1012,
1008,
1030,
6105,
2005,
2440,
9385,
1998,
6105,
2592,
3193,
6105,
5371,
5500,
2007,
2023,
3120,
36... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/
/**
* Zend_Exception
*/
// require_once 'Zend/Exception.php';
/**
* Zend_Gdata_Gapps_Error
*/
// require_once 'Zend/Gdata/Gapps/Error.php';
/** @see Zend_Xml_Security */
// require_once 'Zend/Xml/Security.php';
/**
* Gdata Gapps Exception class. This is thrown when an
* AppsForYourDomainErrors message is received from the Google Apps
* servers.
*
* Several different errors may be represented by this exception. For a list
* of error codes available, see getErrorCode.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Gapps_ServiceException extends Zend_Exception
{
protected $_rootElement = "AppsForYourDomainErrors";
/**
* Array of Zend_Gdata_Error objects indexed by error code.
*
* @var array
*/
protected $_errors = array();
/**
* Create a new ServiceException.
*
* @return array An array containing a collection of
* Zend_Gdata_Gapps_Error objects.
*/
public function __construct($errors = null) {
parent::__construct("Server errors encountered");
if ($errors !== null) {
$this->setErrors($errors);
}
}
/**
* Add a single Error object to the list of errors received by the
* server.
*
* @param Zend_Gdata_Gapps_Error $error An instance of an error returned
* by the server. The error's errorCode must be set.
* @throws Zend_Gdata_App_Exception
*/
public function addError($error) {
// Make sure that we don't try to index an error that doesn't
// contain an index value.
if ($error->getErrorCode() == null) {
// require_once 'Zend/Gdata/App/Exception.php';
throw new Zend_Gdata_App_Exception("Error encountered without corresponding error code.");
}
$this->_errors[$error->getErrorCode()] = $error;
}
/**
* Set the list of errors as sent by the server inside of an
* AppsForYourDomainErrors tag.
*
* @param array $array An associative array containing a collection of
* Zend_Gdata_Gapps_Error objects. All errors must have their
* errorCode value set.
* @throws Zend_Gdata_App_Exception
*/
public function setErrors($array) {
$this->_errors = array();
foreach ($array as $error) {
$this->addError($error);
}
}
/**
* Get the list of errors as sent by the server inside of an
* AppsForYourDomainErrors tag.
*
* @return array An associative array containing a collection of
* Zend_Gdata_Gapps_Error objects, indexed by error code.
*/
public function getErrors() {
return $this->_errors;
}
/**
* Return the Error object associated with a specific error code.
*
* @return Zend_Gdata_Gapps_Error The Error object requested, or null
* if not found.
*/
public function getError($errorCode) {
if (array_key_exists($errorCode, $this->_errors)) {
$result = $this->_errors[$errorCode];
return $result;
} else {
return null;
}
}
/**
* Check whether or not a particular error code was returned by the
* server.
*
* @param integer $errorCode The error code to check against.
* @return boolean Whether or not the supplied error code was returned
* by the server.
*/
public function hasError($errorCode) {
return array_key_exists($errorCode, $this->_errors);
}
/**
* Import an AppsForYourDomain error from XML.
*
* @param string $string The XML data to be imported
* @return Zend_Gdata_Gapps_ServiceException Provides a fluent interface.
* @throws Zend_Gdata_App_Exception
*/
public function importFromString($string) {
if ($string) {
// Check to see if an AppsForYourDomainError exists
//
// track_errors is temporarily enabled so that if an error
// occurs while parsing the XML we can append it to an
// exception by referencing $php_errormsg
@ini_set('track_errors', 1);
$doc = new DOMDocument();
$doc = @Zend_Xml_Security::scan($string, $doc);
@ini_restore('track_errors');
if (!$doc) {
// require_once 'Zend/Gdata/App/Exception.php';
// $php_errormsg is automatically generated by PHP if
// an error occurs while calling loadXML(), above.
throw new Zend_Gdata_App_Exception("DOMDocument cannot parse XML: $php_errormsg");
}
// Ensure that the outermost node is an AppsForYourDomain error.
// If it isn't, something has gone horribly wrong.
$rootElement = $doc->getElementsByTagName($this->_rootElement)->item(0);
if (!$rootElement) {
// require_once 'Zend/Gdata/App/Exception.php';
throw new Zend_Gdata_App_Exception('No root <' . $this->_rootElement . '> element found, cannot parse feed.');
}
foreach ($rootElement->childNodes as $errorNode) {
if (!($errorNode instanceof DOMText)) {
$error = new Zend_Gdata_Gapps_Error();
$error->transferFromDom($errorNode);
$this->addError($error);
}
}
return $this;
} else {
// require_once 'Zend/Gdata/App/Exception.php';
throw new Zend_Gdata_App_Exception('XML passed to transferFromXML cannot be null');
}
}
/**
* Get a human readable version of this exception.
*
* @return string
*/
public function __toString() {
$result = "The server encountered the following errors processing the request:";
foreach ($this->_errors as $error) {
$result .= "\n" . $error->__toString();
}
return $result;
}
}
| calonso-conabio/intranet | protected/vendors/Zend/Gdata/Gapps/ServiceException.php | PHP | apache-2.0 | 6,946 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
16729,
2094,
7705,
1008,
1008,
6105,
1008,
1008,
2023,
3120,
5371,
2003,
3395,
2000,
1996,
2047,
18667,
2094,
6105,
2008,
2003,
24378,
1008,
2007,
2023,
7427,
1999,
1996,
5371,
6105,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.