code stringlengths 4 1.01M | language stringclasses 2 values |
|---|---|
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">
<head>
<link href="http://gmpg.org/xfn/11" rel="profile">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="/public/font-awesome/css/font-awesome.min.css">
<!-- Enable responsiveness on mobile devices-->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<title>
404: Page not found · Home
</title>
<!-- CSS -->
<link rel="stylesheet" href="/public/css/poole.css">
<link rel="stylesheet" href="/public/css/syntax.css">
<link rel="stylesheet" href="/public/css/hyde.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Sans:400,400italic,700|Abril+Fatface">
<!-- Icons -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/public/apple-touch-icon-144-precomposed.png">
<link rel="shortcut icon" href="/public/favicon.ico">
<!-- RSS -->
<link rel="alternate" type="application/rss+xml" title="RSS" href="/atom.xml">
</head>
<body>
<div class="sidebar">
<div class="container sidebar-sticky">
<div class="sidebar-about">
<img src="/public/logo.png">
<p class="lead"></p>
</div>
<ul class="sidebar-nav">
<li class="sidebar-nav-item">
<a href="/"> Home</a>
</li>
<li class="sidebar-nav-item">
<a href="/about.html">About</a>
</li>
<li class="sidebar-nav-item">
<a href="/projects.html">Projects</a>
</li>
<li class="sidebar-nav-item">
<a href="/feedback.html">Feedback</a>
</li>
</ul>
<p>© 2014. All rights reserved.</p>
</div>
</div>
<div class="content container">
<div class="page">
<h1 class="page-title">404: Page not found</h1>
<p class="lead">Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. <a href="/">Head back home</a> to try finding it again.</p>
</div>
</div>
</body>
</html>
| Java |
#pragma once
#include "dg/enums.h"
#include "json/json.h"
namespace eule{
/**
* @brief Provide a mapping between input file and named parameters
*/
struct Parameters
{
unsigned n; //!< \# of polynomial coefficients in R and Z
unsigned Nx; //!< \# of cells in x -direction
unsigned Ny; //!< \# of cells in y -direction
unsigned Nz; //!< \# of cells in z -direction
double dt; //!< timestep
unsigned n_out; //!< \# of polynomial coefficients in output file
unsigned Nx_out; //!< \# of cells in x-direction in output file
unsigned Ny_out; //!< \# of cells in y-direction in output file
unsigned Nz_out; //!< \# of cells in z-direction in output file
unsigned itstp; //!< \# of steps between outputs
unsigned maxout; //!< \# of outputs excluding first
double eps_pol; //!< accuracy of polarization
double jfactor; //jump factor € [1,0.01]
double eps_maxwell; //!< accuracy of induction equation
double eps_gamma; //!< accuracy of gamma operator
double eps_time;//!< accuracy of implicit timestep
double eps_hat;//!< 1
double mu[2]; //!< mu[0] = mu_e, m[1] = mu_i
double tau[2]; //!< tau[0] = -1, tau[1] = tau_i
double beta; //!< plasma beta
double nu_perp; //!< perpendicular diffusion
double nu_parallel; //!< parallel diffusion
double c; //!< parallel resistivity
double amp; //!< blob amplitude
double sigma; //!< perpendicular blob width
double posX; //!< perpendicular position relative to box width
double posY; //!< perpendicular position relative to box height
double sigma_z; //!< parallel blob width in units of pi
double k_psi; //!< mode number
double omega_source; //!< source amplitude
double nprofileamp; //!< amplitude of profile
double bgprofamp; //!< background profile amplitude
double boxscaleRp; //!< box can be larger
double boxscaleRm;//!< box can be larger
double boxscaleZp;//!< box can be larger
double boxscaleZm;//!< box can be larger
enum dg::bc bc; //!< global perpendicular boundary condition
unsigned pollim; //!< 0= no poloidal limiter, 1 = poloidal limiter
unsigned pardiss; //!< 0 = adjoint parallel dissipation, 1 = nonadjoint parallel dissipation
unsigned mode; //!< 0 = blob simulations (several rounds fieldaligned), 1 = straight blob simulation( 1 round fieldaligned), 2 = turbulence simulations ( 1 round fieldaligned),
unsigned initcond; //!< 0 = zero electric potential, 1 = ExB vorticity equals ion diamagnetic vorticity
unsigned curvmode; //!< 0 = low beta, 1 = toroidal field line
Parameters( const Json::Value& js) {
n = js["n"].asUInt();
Nx = js["Nx"].asUInt();
Ny = js["Ny"].asUInt();
Nz = js["Nz"].asUInt();
dt = js["dt"].asDouble();
n_out = js["n_out"].asUInt();
Nx_out = js["Nx_out"].asUInt();
Ny_out = js["Ny_out"].asUInt();
Nz_out = js["Nz_out"].asUInt();
itstp = js["itstp"].asUInt();
maxout = js["maxout"].asUInt();
eps_pol = js["eps_pol"].asDouble();
jfactor = js["jumpfactor"].asDouble();
eps_maxwell = js["eps_maxwell"].asDouble();
eps_gamma = js["eps_gamma"].asDouble();
eps_time = js["eps_time"].asDouble();
eps_hat = 1.;
mu[0] = js["mu"].asDouble();
mu[1] = +1.;
tau[0] = -1.;
tau[1] = js["tau"].asDouble();
beta = js["beta"].asDouble();
nu_perp = js["nu_perp"].asDouble();
nu_parallel = js["nu_parallel"].asDouble();
c = js["resistivity"].asDouble();
amp = js["amplitude"].asDouble();
sigma = js["sigma"].asDouble();
posX = js["posX"].asDouble();
posY = js["posY"].asDouble();
sigma_z = js["sigma_z"].asDouble();
k_psi = js["k_psi"].asDouble();
omega_source = js["source"].asDouble();
bc = dg::str2bc(js["bc"].asString());
nprofileamp = js["nprofileamp"].asDouble();
bgprofamp = js["bgprofamp"].asDouble();
boxscaleRp = js.get("boxscaleRp",1.05).asDouble();
boxscaleRm = js.get("boxscaleRm",1.05).asDouble();
boxscaleZp = js.get("boxscaleZp",1.05).asDouble();
boxscaleZm = js.get("boxscaleZm",1.05).asDouble();
pollim = js.get( "pollim", 0).asUInt();
pardiss = js.get( "pardiss", 0).asUInt();
mode = js.get( "mode", 0).asUInt();
initcond = js.get( "initial", 0).asUInt();
curvmode = js.get( "curvmode", 0).asUInt();
}
/**
* @brief Display parameters
*
* @param os Output stream
*/
void display( std::ostream& os = std::cout ) const
{
os << "Physical parameters are: \n"
<<" mu_e = "<<mu[0]<<"\n"
<<" mu_i = "<<mu[1]<<"\n"
<<" beta = "<<beta<<"\n"
<<" El.-temperature: = "<<tau[0]<<"\n"
<<" Ion-temperature: = "<<tau[1]<<"\n"
<<" perp. Viscosity: = "<<nu_perp<<"\n"
<<" par. Resistivity: = "<<c<<"\n"
<<" par. Viscosity: = "<<nu_parallel<<"\n";
os <<"Blob parameters are: \n"
<< " amplitude: "<<amp<<"\n"
<< " width: "<<sigma<<"\n"
<< " posX: "<<posX<<"\n"
<< " posY: "<<posY<<"\n"
<< " sigma_z: "<<sigma_z<<"\n";
os << "Profile parameters are: \n"
<<" omega_source: "<<omega_source<<"\n"
<<" density profile amplitude: "<<nprofileamp<<"\n"
<<" background profile amplitude: "<<bgprofamp<<"\n"
<<" boxscale R+: "<<boxscaleRp<<"\n"
<<" boxscale R-: "<<boxscaleRm<<"\n"
<<" boxscale Z+: "<<boxscaleZp<<"\n"
<<" boxscale Z-: "<<boxscaleZm<<"\n";
os << "Algorithmic parameters are: \n"
<<" n = "<<n<<"\n"
<<" Nx = "<<Nx<<"\n"
<<" Ny = "<<Ny<<"\n"
<<" Nz = "<<Nz<<"\n"
<<" dt = "<<dt<<"\n";
os << " Stopping for Polar CG: "<<eps_pol<<"\n"
<<" Jump scale factor: "<<jfactor<<"\n"
<<" Stopping for Maxwell CG: "<<eps_maxwell<<"\n"
<<" Stopping for Gamma CG: "<<eps_gamma<<"\n"
<<" Stopping for Time CG: "<<eps_time<<"\n";
os << "Output parameters are: \n"
<<" n_out = "<<n_out<<"\n"
<<" Nx_out = "<<Nx_out<<"\n"
<<" Ny_out = "<<Ny_out<<"\n"
<<" Nz_out = "<<Nz_out<<"\n"
<<" Steps between output: "<<itstp<<"\n"
<<" Number of outputs: "<<maxout<<"\n";
os << "Boundary condition is: \n"
<<" global BC = "<<dg::bc2str(bc)<<"\n"
<<" Poloidal limiter = "<<pollim<<"\n"
<<" Parallel dissipation = "<<pardiss<<"\n"
<<" Computation mode = "<<mode<<"\n"
<<" init cond = "<<initcond<<"\n"
<<" curvature mode = "<<curvmode<<"\n";
os << std::flush;
}
};
}//namespace eule
| Java |
import PartyBot from 'partybot-http-client';
import React, { PropTypes, Component } from 'react';
import cssModules from 'react-css-modules';
import styles from './index.module.scss';
import Heading from 'grommet/components/Heading';
import Box from 'grommet/components/Box';
import Footer from 'grommet/components/Footer';
import Button from 'grommet/components/Button';
import Form from 'grommet/components/Form';
import FormField from 'grommet/components/FormField';
import FormFields from 'grommet/components/FormFields';
import NumberInput from 'grommet/components/NumberInput';
import CloseIcon from 'grommet/components/icons/base/Close';
import Dropzone from 'react-dropzone';
import Layer from 'grommet/components/Layer';
import Header from 'grommet/components/Header';
import Section from 'grommet/components/Section';
import Paragraph from 'grommet/components/Paragraph';
import request from 'superagent';
import Select from 'react-select';
import { CLOUDINARY_UPLOAD_PRESET, CLOUDINARY_NAME, CLOUDINARY_KEY, CLOUDINARY_SECRET, CLOUDINARY_UPLOAD_URL } from '../../constants';
import Immutable from 'immutable';
import _ from 'underscore';
class ManageTablesPage extends Component {
constructor(props) {
super(props);
this.handleMobile = this.handleMobile.bind(this);
this.closeSetup = this.closeSetup.bind(this);
this.onDrop = this.onDrop.bind(this);
this.addVariant = this.addVariant.bind(this);
this.submitSave = this.submitSave.bind(this);
this.submitDelete = this.submitDelete.bind(this);
this.state = {
isMobile: false,
tableId: props.params.table_id || null,
confirm: false,
name: '',
variants: [],
organisationId: '5800471acb97300011c68cf7',
venues: [],
venueId: '',
events: [],
eventId: '',
selectedEvents: [],
tableTypes: [],
tableTypeId: undefined,
tags: 'table',
image: null,
prevImage: null,
isNewImage: null,
prices: []
};
}
componentWillMount() {
if (this.state.tableId) {
this.setState({variants: []});
}
}
componentDidMount() {
if (typeof window !== 'undefined') {
window.addEventListener('resize', this.handleMobile);
}
let options = {
organisationId: this.state.organisationId
};
this.getVenues(options);
// IF TABLE ID EXISTS
if(this.props.params.table_id) {
let tOptions = {
organisationId: this.state.organisationId,
productId: this.props.params.table_id
}
this.getTable(tOptions);
}
}
componentWillUnmount() {
if (typeof window !== 'undefined') {
window.removeEventListener('resize', this.handleMobile);
}
}
handleMobile() {
const isMobile = window.innerWidth <= 768;
this.setState({
isMobile,
});
};
getVenues = (options) => {
PartyBot.venues.getAllInOrganisation(options, (errors, response, body) => {
if(response.statusCode == 200) {
if(body.length > 0) {
this.setState({venueId: body[0]._id});
let ttOptions = {
organisationId: this.state.organisationId,
venue_id: this.state.venueId
}
// this.getEvents(ttOptions);
this.getTableTypes(ttOptions);
}
this.setState({venues: body, events: []});
}
});
}
getEvents = (options) => {
PartyBot.events.getEventsInOrganisation(options, (err, response, body) => {
if(!err && response.statusCode == 200) {
if(body.length > 0) {
this.setState({eventId: body[0]._id});
}
body.map((value, index) =>{
this.setState({events: this.state.events.concat({ _event: value._id, name: value.name, selected: false })});
});
}
});
}
getTableTypes = (options) => {
PartyBot.tableTypes.getTableTypesInOrganisation(options, (errors, response, body) => {
if(response.statusCode == 200) {
if(body.length > 0) {
this.setState({tableTypes: body});
let params = {
organisationId: this.state.organisationId,
venueId: this.state.venueId,
tableTypeId: body[0]._id
}
PartyBot.tableTypes.getTableType(params, (aerr, aresponse, abody) => {
let events = abody._events.map((value) => {
return value._event_id.map((avalue) => {
return {
value: avalue._id,
label: avalue.name
}
});
});
this.setState({
tableTypeId: body[0]._id,
events: _.flatten(events)
});
});
}
}
});
}
getTable = (options) => {
PartyBot.products.getProductsInOrganisation(options, (error, response, body) => {
if(response.statusCode == 200) {
this.setState({
name: body.name,
image: {
preview: body.image
},
prevImage: {
preview: body.image
},
variants: body.prices.map((value, index) => {
return { _event: value._event, price: value.price }
})
});
}
});
}
onVenueChange = (event) => {
let id = event.target.value;
this.setState({ venueId: id, events: [], variants: []});
let options = {
organisationId: this.state.organisationId,
venue_id: id
};
this.getTableTypes(options);
// this.getEvents(options);
}
onEventChange = (item, index, event) => {
let variants = Immutable.List(this.state.variants);
let mutated = variants.set(index, { _event: event.target.value, price: item.price});
this.setState( { variants: mutated.toArray() } );
}
onPriceChange = (item, index, event) => {
let variants = Immutable.List(this.state.variants);
let mutated = variants.set(index, { _event: item._event, price: event.target.value});
this.setState( { variants: mutated.toArray() } );
}
closeSetup(){
this.setState({
confirm: false
});
this.context.router.push('/tables');
}
addVariant() { // will create then get?
var newArray = this.state.variants.slice();
newArray.push({
_event_id: [],
description: "",
image: null,
imageUrl: ""
});
this.setState({variants:newArray})
}
removeVariant(index, event){ // delete variant ID
let variants = Immutable.List(this.state.variants);
let mutated = variants.remove(index);
// let selectedEvents = Immutable.List(this.state.selectedEvents);
// let mutatedEvents = selectedEvents.remove(index);
this.setState({
variants: mutated.toJS(),
});
}
onEventAdd = (index, selectedEvents) => {
let cloned = Immutable.List(this.state.variants);
let anIndex = Immutable.fromJS(cloned.get(index));
anIndex = anIndex.set('_event_id', selectedEvents);
let newClone = cloned.set(index, anIndex);
let selectedEventState = Immutable.List(this.state.selectedEvents);
let newSelectedEventState = selectedEventState.set(index, selectedEvents);
this.setState({selectedEvents: newSelectedEventState.toJS(), variants: newClone.toJS()});
}
setDescrpiption = (index, event) => {
let cloned = Immutable.List(this.state.variants);
let anIndex = Immutable.fromJS(cloned.get(index));
anIndex = anIndex.set('description', event.target.value);
let newClone = cloned.set(index, anIndex);
this.setState({variants: newClone.toJS()});
}
onDrop = (index, file) => {
this.setState({ isBusy: true });
let upload = request.post(CLOUDINARY_UPLOAD_URL)
.field('upload_preset', CLOUDINARY_UPLOAD_PRESET)
.field('file', file[0]);
console.log('dragged');
upload.end((err, response) => {
if (err) {
} else {
let cloned = Immutable.List(this.state.variants);
let anIndex = Immutable.fromJS(cloned.get(index));
anIndex = anIndex.set('image', file[0]);
anIndex = anIndex.set('imageUrl', response.body.secure_url);
let newClone = cloned.set(index, anIndex);
this.setState({variants: newClone.toJS(), isBusy: false});
}
});
}
onTypeChange = (event) => {
var id = event.target.value;
let params = {
organisationId: this.state.organisationId,
venueId: this.state.venueId,
tableTypeId: id
}
PartyBot.tableTypes.getTableType(params, (err, response, body) => {
let events = body._events.map((value) => {
return value._event_id.map((avalue) => {
return {
value: avalue._id,
label: avalue.name
}
});
});
this.setState({
tableTypeId: id,
variants: [],
events: _.flatten(events)
});
});
}
setName = (event) => {
this.setState({name: event.target.value});
}
getTypeOptions = () => {
return this.state.tableTypes.map((value, index) => {
return <option key={index} value={value._id}>{value.name}</option>;
});
}
getTableVariants = () => {
return this.state.variants.map((value, index) => {
return (
<Box key={index} separator="all">
<FormField label="Event" htmlFor="events" />
<Select
name="events"
options={this.state.events.filter((x) => {
let a = _.contains(_.uniq(_.flatten(this.state.selectedEvents)), x);
return !a;
})}
value={value._event_id}
onChange={this.onEventAdd.bind(this, index)}
multi={true}
/>
<FormField label="Description" htmlFor="tableTypedescription">
<input id="tableTypedescription" type="text" onChange={this.setDescrpiption.bind(this, index)} value={value.description}/>
</FormField>
<FormField label="Image">
{value.image ?
<Box size={{ width: 'large' }} align="center" justify="center">
<div>
<img src={value.image.preview} width="200" />
</div>
<Box size={{ width: 'large' }}>
<Button label="Cancel" onClick={this.onRemoveImage.bind(this)} plain={true} icon={<CloseIcon />}/>
</Box>
</Box> :
<Box align="center" justify="center" size={{ width: 'large' }}>
<Dropzone multiple={false} ref={(node) => { this.dropzone = node; }} onDrop={this.onDrop.bind(this, index)} accept='image/*'>
Drop image here or click to select image to upload.
</Dropzone>
</Box>
}
<Button label="Remove" onClick={this.removeVariant.bind(this, index)} primary={true} float="right"/>
</FormField>
</Box>)
});
// return this.state.variants.map( (item, index) => {
// return <div key={index}>
// <FormField label="Event" htmlFor="tableName">
// <select id="tableVenue" onChange={this.onEventChange.bind(this, item, index)} value={item._event||this.state.events[0]._event}>
// {
// this.state.events.map( (value, index) => {
// return (<option key={index} value={value._event}>{value.name}</option>)
// })
// }
// </select>
// </FormField>
// <FormField label="Price(Php)" htmlFor="tablePrice">
// <input type="number" onChange={this.onPriceChange.bind(this, item, index)} value={item.price}/>
// </FormField>
// <Footer pad={{"vertical": "small"}}>
// <Heading align="center">
// <Button className={styles.eventButton} label="Update" primary={true} onClick={() => {}} />
// <Button className={styles.eventButton} label="Remove" onClick={this.removeVariant.bind(this, index)} />
// </Heading>
// </Footer>
// </div>;
// });
}
onDrop(file) {
this.setState({
image: file[0],
isNewImage: true
});
}
onRemoveImage = () => {
this.setState({
image: null,
isNewImage: false
});
}
handleImageUpload(file, callback) {
if(this.state.isNewImage) {
let options = {
url: CLOUDINARY_UPLOAD_URL,
formData: {
file: file
}
};
let upload = request.post(CLOUDINARY_UPLOAD_URL)
.field('upload_preset', CLOUDINARY_UPLOAD_PRESET)
.field('file', file);
upload.end((err, response) => {
if (err) {
console.error(err);
}
if (response.body.secure_url !== '') {
callback(null, response.body.secure_url)
} else {
callback(err, '');
}
});
} else {
callback(null, null);
}
}
submitDelete (event) {
event.preventDefault();
let delParams = {
organisationId: this.state.organisationId,
productId: this.state.tableId
};
PartyBot.products.deleteProduct(delParams, (error, response, body) => {
if(!error && response.statusCode == 200) {
this.setState({
confirm: true
});
} else {
}
});
}
submitSave() {
event.preventDefault();
this.handleImageUpload(this.state.image, (err, imageLink) => {
if(err) {
console.log(err);
} else {
let updateParams = {
name: this.state.name,
organisationId: this.state.organisationId,
productId: this.state.tableId,
venueId: this.state.venueId,
table_type: this.state.tableTypeId,
image: imageLink || this.state.prevImage.preview,
prices: this.state.variants
};
PartyBot.products.update(updateParams, (errors, response, body) => {
if(response.statusCode == 200) {
this.setState({
confirm: true
});
}
});
}
});
}
submitCreate = () => {
event.preventDefault();
console.log(this.state);
let params = {};
// this.handleImageUpload(this.state.image, (err, imageLink) => {
// if(err) {
// console.log(err);
// } else {
// let createParams = {
// name: this.state.name,
// organisationId: this.state.organisationId,
// venueId: this.state.venueId,
// tags: this.state.tags,
// table_type: this.state.tableTypeId,
// image: imageLink,
// prices: this.state.variants
// };
// PartyBot.products.create(createParams, (errors, response, body) => {
// if(response.statusCode == 200) {
// this.setState({
// confirm: true
// });
// }
// });
// }
// });
}
render() {
const {
router,
} = this.context;
const {
isMobile,
} = this.state;
const {
files,
variants,
} = this.state;
return (
<div className={styles.container}>
<link rel="stylesheet" href="https://unpkg.com/react-select/dist/react-select.css"/>
{this.state.confirm !== false ?
<Layer align="center">
<Header>
Table successfully created.
</Header>
<Section>
<Button label="Close" onClick={this.closeSetup} plain={true} icon={<CloseIcon />}/>
</Section>
</Layer>
:
null
}
<Box>
{this.state.tableId !== null ?
<Heading align="center">
Edit Table
</Heading>
:
<Heading align="center">
Add Table
</Heading>
}
</Box>
<Box size={{ width: 'large' }} direction="row" justify="center" align="center" wrap={true} margin="small">
<Form>
<FormFields>
<fieldset>
<FormField label="Venue" htmlFor="tableVenue">
<select id="tableVenue" onChange={this.onVenueChange} value={this.state.venueId}>
{this.state.venues.map((value, index) => {
return <option key={index} value={value._id}>{value.name}</option>;
})}
</select>
</FormField>
<FormField label="Table Type" htmlFor="tableType">
<select id="tableType" onChange={this.onTypeChange} value={this.state.tableTypeId}>
{this.state.tableTypes.map((value, index) => {
return <option key={index} value={value._id}>{value.name}</option>;
})}
</select>
</FormField>
<FormField label=" Name" htmlFor="tableName">
<input id="tableName" type="text" onChange={this.setName} value={this.state.name}/>
</FormField>
{
//Dynamic Price/Event Component
this.getTableVariants()
}
<Button label="Add Event" primary={true} onClick={this.addVariant} />
</fieldset>
</FormFields>
<Footer pad={{"vertical": "medium"}}>
{
this.state.tableId !== null ?
<Heading align="center">
<Button label="Save Changes" primary={true} onClick={this.submitSave} />
<Button label="Delete" primary={true} onClick={this.submitDelete} />
</Heading>
:
<Heading align="center">
<Button label="Create Table" primary={true} onClick={this.submitCreate} />
</Heading>
}
</Footer>
</Form>
</Box>
</div>
);
}
}
ManageTablesPage.contextTypes = {
router: PropTypes.object.isRequired,
};
export default cssModules(ManageTablesPage, styles);
| Java |
# Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
I2db::Application.config.secret_token = 'f30c2c606ad3fe5dee77ef556c72975365eecdaf0d7487c8944e755182923e1b29d57c90c64b4015705a25c000d989975ff1dd08abb608ebebde302bc4991582'
| Java |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Core.Interfaces
{
public static class IApplicationCommandConstants
{
/// <summary>
/// This application name represents default commands - when there is no
/// command for specific application
/// </summary>
public const string DEFAULT_APPLICATION = "DEFAULT";
}
/// <summary>
/// Represents simple association that connects application, remote command and feedback to this command.
/// If ApplicationName is null - this is a default behaviour.
/// </summary>
public interface IApplicationCommand
{
/// <summary>
/// Name of the application
/// </summary>
string ApplicationName { get; }
/// <summary>
/// Remote command
/// </summary>
RemoteCommand RemoteCommand { get; }
/// <summary>
/// Command to be executed
/// </summary>
ICommand Command { get; }
/// <summary>
/// Executes associated command
/// </summary>
void Do();
}
}
| Java |
module HealthSeven::V2_3
class QryQ02 < ::HealthSeven::Message
attribute :msh, Msh, position: "MSH", require: true
attribute :qrd, Qrd, position: "QRD", require: true
attribute :qrf, Qrf, position: "QRF"
attribute :dsc, Dsc, position: "DSC"
end
end | Java |
<?php
namespace seregazhuk\tests\Bot\Providers;
use seregazhuk\PinterestBot\Api\Providers\User;
use seregazhuk\PinterestBot\Helpers\UrlBuilder;
/**
* Class ProfileSettingsTest
* @method User getProvider()
*/
class ProfileSettingsTest extends ProviderBaseTest
{
/** @test */
public function it_retrieves_current_user_sessions_history()
{
$provider = $this->getProvider();
$provider->sessionsHistory();
$this->assertWasGetRequest(UrlBuilder::RESOURCE_SESSIONS_HISTORY);
}
/** @test */
public function it_returns_list_of_available_locales()
{
$provider = $this->getProvider();
$provider->getLocales();
$this->assertWasGetRequest(UrlBuilder::RESOURCE_AVAILABLE_LOCALES);
}
/** @test */
public function it_returns_list_of_available_countries()
{
$provider = $this->getProvider();
$provider->getCountries();
$this->assertWasGetRequest(UrlBuilder::RESOURCE_AVAILABLE_COUNTRIES);
}
/** @test */
public function it_returns_list_of_available_account_types()
{
$provider = $this->getProvider();
$provider->getAccountTypes();
$this->assertWasGetRequest(UrlBuilder::RESOURCE_AVAILABLE_ACCOUNT_TYPES);
}
protected function getProviderClass()
{
return User::class;
}
}
| Java |
//
// Copyright 2014-2015 Amazon.com,
// Inc. or its affiliates. All Rights Reserved.
//
// Licensed under the Amazon Software License (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/asl/
//
// or in the "license" file accompanying this file. This file is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, express or implied. See the License
// for the specific language governing permissions and
// limitations under the License.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Amazon.Runtime.Internal.Transform
{
public static class CustomMarshallTransformations
{
public static long ConvertDateTimeToEpochMilliseconds(DateTime dateTime)
{
TimeSpan ts = new TimeSpan(dateTime.ToUniversalTime().Ticks - Amazon.Util.AWSSDKUtils.EPOCH_START.Ticks);
return (long)ts.TotalMilliseconds;
}
}
}
| Java |
<wicket:extend>
<div class="row">
<div class="col-md-12">
<h3>Ergebnisse</h3>
<br/>
</div>
</div>
<div class="row">
<div class="col-md-12 result-border">
<div class="row">
<div class="col-md-12">
<h4>
Erkannte Version:
<wicket:container wicket:id="schemaVersion"/>
</h4>
</div>
</div>
<div wicket:id="schemvalidationOK">
<div class="row">
<div class="col-md-12">
<br/>
<h4>Schemavalidierung</h4>
</div>
</div>
<div class="row">
<div class="col-md-12 alert alert-success">
<p>Die gewählte ebInterface Instanz entspricht den Vorgaben
des ebInterface Schemas.</p>
</div>
</div>
</div>
<div wicket:id="schemvalidationNOK">
<div class="row">
<div class="col-md-12">
<br/>
<h4>Schemavalidierung</h4>
</div>
</div>
<div class="row">
<div class="col-md-12 alert alert-danger">
<p>Die gewählte ebInterface Instanz entspricht nicht den
Vorgaben des ebInterface Schemas.</p>
<p>
<strong>Fehlerdetails: </strong>
<wicket:container wicket:id="schemaValidationError"/>
</p>
</div>
</div>
</div>
<div wicket:id="signatureResultContainer">
<div class="row">
<div class="col-md-12">
<br/>
<h4>Validierung der XML Signatur</h4>
</div>
</div>
<div class="row">
<div class="col-md-12">
<h5>Signatur</h5>
<div wicket:id="signatureDetails"/>
<h5>Zertifikat:</h5>
<div wicket:id="certificateDetails"/>
<h5>Manifest:</h5>
<div wicket:id="manifestDetails"/>
</div>
</div>
</div>
<div wicket:id="schematronOK">
<div class="row">
<div class="col-md-12">
<br/>
<h4>
Schematronvalidierung
<wicket:container wicket:id="selectedSchematron"/>
</h4>
</div>
</div>
<div class="row">
<div class="col-md-12 alert alert-success">
<p>Die gewählte ebInterface Instanz verletzt keine der
Schematronregeln</p>
</div>
</div>
</div>
<div wicket:id="schematronNOK">
<div class="row">
<div class="col-md-12">
<br/>
<h4>
Schematronvalidierung
<wicket:container wicket:id="selectedSchematron"/>
</h4>
</div>
</div>
<div class="row">
<div class="col-md-12 alert alert-danger">
<p>Die gewählte ebInterface Instanz verletzt Schematron
Regeln:</p>
<div wicket:id="errorDetailsPanel"></div>
</div>
</div>
</div>
<div wicket:id="zugferdMappingLog">
<div class="row">
<div class="col-md-12">
<br/>
<h4>
ZUGFeRD-Konvertierung
</h4>
</div>
</div>
<div class="row">
<div wicket:id="zugferdMappingLogSuccess">
<div class="col-md-12 alert alert-success">
<div wicket:id="zugferdLogSuccessPanel"></div>
</div>
</div>
<div wicket:id="zugferdMappingLogError">
<div class="col-md-12 alert alert-danger">
<div wicket:id="zugferdLogErrorPanel"></div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<br/> <br/>
<a class="btn btn-ghost btn-ghost--red" type="submit"
wicket:id="linkZugferdXMLDownload">Download ZUGFeRD XML</a>
<a class="btn btn-ghost btn-ghost--red" type="submit"
wicket:id="linkZugferdPDFDownload">Download ZUGFeRD PDF</a>
</div>
<div class="col-md-12">
<br/> <br/> <a class="btn btn-ghost btn-ghost--red" wicket:id="returnLink">Neue
Anfrage starten</a> <br/> <br/> <br/> <br/>
</div>
</div>
</wicket:extend> | Java |
package edu.isep.sixcolors.view.listener;
import edu.isep.sixcolors.model.Config;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* A popup window asking if the player want's to exit Six Colors
*/
public class Exit implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
int option = JOptionPane.showConfirmDialog(
null,
Config.EXIT_MESSAGE,
Config.EXIT_TITLE,
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE
);
if (option == JOptionPane.YES_OPTION){
System.exit(0);
}
}
}
| Java |
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using gView.Framework.IO;
using gView.Framework.Data;
using gView.Framework.UI;
namespace gView.Framework.UI.Dialogs
{
public partial class FormMetadata : Form
{
private Metadata _metadata;
private object _metadataObject;
public FormMetadata(XmlStream xmlStream, object metadataObject)
{
InitializeComponent();
_metadata = new Metadata();
_metadata.ReadMetadata(xmlStream);
_metadataObject = metadataObject;
}
private void FormMetadata_Load(object sender, EventArgs e)
{
if (_metadata.Providers == null) return;
foreach (IMetadataProvider provider in _metadata.Providers)
{
if (provider == null) continue;
TabPage page = new TabPage(provider.Name);
if (provider is IPropertyPage)
{
Control ctrl = ((IPropertyPage)provider).PropertyPage(null) as Control;
if (ctrl != null)
{
page.Controls.Add(ctrl);
ctrl.Dock = DockStyle.Fill;
}
if (ctrl is IMetadataObjectParameter)
((IMetadataObjectParameter)ctrl).MetadataObject = _metadataObject;
}
tabControl1.TabPages.Add(page);
}
}
public XmlStream Stream
{
get
{
XmlStream stream = new XmlStream("Metadata");
if (_metadata != null)
_metadata.WriteMetadata(stream);
return stream;
}
}
}
} | Java |
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
| Java |
This is an example from `pst-solides3d` documentation.
Compiled example
----------------

| Java |
namespace EgaViewer_v2
{
partial class CustomPictureBox
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}
| Java |
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2019 Marco Antognini (antognini.marco@gmail.com),
// Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
//
////////////////////////////////////////////////////////////
#import <Cocoa/Cocoa.h>
#import <SFML/Graphics.hpp>
/*
* NB: We need pointers for C++ objects fields in Obj-C interface !
* The recommended way is to use PIMPL idiom.
*
* It's elegant. Moreover, we do no constrain
* other file including this one to be Obj-C++.
*/
struct SFMLmainWindow;
@interface CocoaAppDelegate : NSObject <NSApplicationDelegate>
{
@private
NSWindow* m_window;
NSView* m_sfmlView;
NSTextField* m_textField;
SFMLmainWindow* m_mainWindow;
NSTimer* m_renderTimer;
BOOL m_visible;
BOOL m_initialized;
}
@property (retain) IBOutlet NSWindow* window;
@property (assign) IBOutlet NSView* sfmlView;
@property (assign) IBOutlet NSTextField* textField;
-(IBAction)colorChanged:(NSPopUpButton*)sender;
-(IBAction)rotationChanged:(NSSlider*)sender;
-(IBAction)visibleChanged:(NSButton*)sender;
-(IBAction)textChanged:(NSTextField*)sender;
-(IBAction)updateText:(NSButton*)sender;
@end
/*
* This interface is used to prevent the system alert produced when the SFML view
* has the focus and the user press a key.
*/
@interface SilentWindow : NSWindow
-(void)keyDown:(NSEvent*)theEvent;
@end
| Java |
namespace StudentClass
{
public class Course
{
public Course(string name)
: this()
{
this.Name = name;
}
public Course()
{
}
public string Name { get; private set; }
public override string ToString()
{
return this.Name;
}
}
}
| Java |
//
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import "CDStructures.h"
@interface IDEEditorDocumentValidatedUserInterfaceItem : NSObject <NSValidatedUserInterfaceItem>
{
SEL _action;
long long _tag;
}
@property long long tag; // @synthesize tag=_tag;
@property SEL action; // @synthesize action=_action;
@end
| Java |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_112-google-v7) on Thu Mar 02 16:51:04 PST 2017 -->
<title>ResourceTableFactory</title>
<meta name="date" content="2017-03-02">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="ResourceTableFactory";
}
}
catch(err) {
}
//-->
var methods = {"i0":9,"i1":9};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../org/robolectric/res/ResourceTable.Visitor.html" title="interface in org.robolectric.res"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../org/robolectric/res/ResourceValueConverter.html" title="interface in org.robolectric.res"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?org/robolectric/res/ResourceTableFactory.html" target="_top">Frames</a></li>
<li><a href="ResourceTableFactory.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li><a href="#constructor.summary">Constr</a> | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor.detail">Constr</a> | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.robolectric.res</div>
<h2 title="Class ResourceTableFactory" class="title">Class ResourceTableFactory</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>org.robolectric.res.ResourceTableFactory</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="typeNameLabel">ResourceTableFactory</span>
extends java.lang.Object</pre>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../org/robolectric/res/ResourceTableFactory.html#ResourceTableFactory--">ResourceTableFactory</a></span>()</code> </td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>static <a href="../../../org/robolectric/res/PackageResourceTable.html" title="class in org.robolectric.res">PackageResourceTable</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/robolectric/res/ResourceTableFactory.html#newFrameworkResourceTable-org.robolectric.res.ResourcePath-">newFrameworkResourceTable</a></span>(<a href="../../../org/robolectric/res/ResourcePath.html" title="class in org.robolectric.res">ResourcePath</a> resourcePath)</code>
<div class="block">Builds an Android framework resource table in the "android" package space.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>static <a href="../../../org/robolectric/res/PackageResourceTable.html" title="class in org.robolectric.res">PackageResourceTable</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/robolectric/res/ResourceTableFactory.html#newResourceTable-java.lang.String-org.robolectric.res.ResourcePath...-">newResourceTable</a></span>(java.lang.String packageName,
<a href="../../../org/robolectric/res/ResourcePath.html" title="class in org.robolectric.res">ResourcePath</a>... resourcePaths)</code>
<div class="block">Creates an application resource table which can be constructed with multiple resources paths representing
overlayed resource libraries.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="ResourceTableFactory--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>ResourceTableFactory</h4>
<pre>public ResourceTableFactory()</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="newFrameworkResourceTable-org.robolectric.res.ResourcePath-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>newFrameworkResourceTable</h4>
<pre>public static <a href="../../../org/robolectric/res/PackageResourceTable.html" title="class in org.robolectric.res">PackageResourceTable</a> newFrameworkResourceTable(<a href="../../../org/robolectric/res/ResourcePath.html" title="class in org.robolectric.res">ResourcePath</a> resourcePath)</pre>
<div class="block">Builds an Android framework resource table in the "android" package space.</div>
</li>
</ul>
<a name="newResourceTable-java.lang.String-org.robolectric.res.ResourcePath...-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>newResourceTable</h4>
<pre>public static <a href="../../../org/robolectric/res/PackageResourceTable.html" title="class in org.robolectric.res">PackageResourceTable</a> newResourceTable(java.lang.String packageName,
<a href="../../../org/robolectric/res/ResourcePath.html" title="class in org.robolectric.res">ResourcePath</a>... resourcePaths)</pre>
<div class="block">Creates an application resource table which can be constructed with multiple resources paths representing
overlayed resource libraries.</div>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../org/robolectric/res/ResourceTable.Visitor.html" title="interface in org.robolectric.res"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../org/robolectric/res/ResourceValueConverter.html" title="interface in org.robolectric.res"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?org/robolectric/res/ResourceTableFactory.html" target="_top">Frames</a></li>
<li><a href="ResourceTableFactory.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li><a href="#constructor.summary">Constr</a> | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor.detail">Constr</a> | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| Java |
//Generated by the Argon Build System
/***********************************************************************
Copyright (c) 2006-2011, Skype Limited. 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 Internet Society, IETF or IETF Trust, nor the
names of specific 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 OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "opus/silk/float/main_FLP.h"
/* Autocorrelations for a warped frequency axis */
void silk_warped_autocorrelation_FLP(
silk_float *corr, /* O Result [order + 1] */
const silk_float *input, /* I Input data to correlate */
const silk_float warping, /* I Warping coefficient */
const opus_int length, /* I Length of input */
const opus_int order /* I Correlation order (even) */
)
{
opus_int n, i;
double tmp1, tmp2;
double state[ MAX_SHAPE_LPC_ORDER + 1 ] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
double C[ MAX_SHAPE_LPC_ORDER + 1 ] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
/* Order must be even */
silk_assert( ( order & 1 ) == 0 );
/* Loop over samples */
for( n = 0; n < length; n++ ) {
tmp1 = input[ n ];
/* Loop over allpass sections */
for( i = 0; i < order; i += 2 ) {
/* Output of allpass section */
tmp2 = state[ i ] + warping * ( state[ i + 1 ] - tmp1 );
state[ i ] = tmp1;
C[ i ] += state[ 0 ] * tmp1;
/* Output of allpass section */
tmp1 = state[ i + 1 ] + warping * ( state[ i + 2 ] - tmp2 );
state[ i + 1 ] = tmp2;
C[ i + 1 ] += state[ 0 ] * tmp2;
}
state[ order ] = tmp1;
C[ order ] += state[ 0 ] * tmp1;
}
/* Copy correlations in silk_float output format */
for( i = 0; i < order + 1; i++ ) {
corr[ i ] = ( silk_float )C[ i ];
}
}
| Java |
export const ic_restaurant_menu_twotone = {"viewBox":"0 0 24 24","children":[{"name":"path","attribs":{"d":"M0 0h24v24H0V0z","fill":"none"},"children":[]},{"name":"path","attribs":{"d":"M8.1 13.34l2.83-2.83L3.91 3.5c-1.56 1.56-1.56 4.09 0 5.66l4.19 4.18zm12.05-3.19c1.91-1.91 2.28-4.65.81-6.12-1.46-1.46-4.2-1.1-6.12.81-1.59 1.59-2.09 3.74-1.38 5.27L3.7 19.87l1.41 1.41L12 14.41l6.88 6.88 1.41-1.41L13.41 13l1.47-1.47c1.53.71 3.68.21 5.27-1.38z"},"children":[]}]}; | Java |
# encoding: UTF-8
module DocuBot::LinkTree; end
class DocuBot::LinkTree::Node
attr_accessor :title, :link, :page, :parent
def initialize( title=nil, link=nil, page=nil )
@title,@link,@page = title,link,page
@children = []
end
def anchor
@link[/#(.+)/,1]
end
def file
@link.sub(/#.+/,'')
end
def leaf?
!@children.any?{ |node| node.page != @page }
end
# Add a new link underneath a link to its logical parent
def add_to_link_hierarchy( title, link, page=nil )
node = DocuBot::LinkTree::Node.new( title, link, page )
parent_link = if node.anchor
node.file
elsif File.basename(link)=='index.html'
File.dirname(File.dirname(link))/'index.html'
else
(File.dirname(link) / 'index.html')
end
#puts "Adding #{title.inspect} (#{link}) to hierarchy under #{parent_link}"
parent = descendants.find{ |n| n.link==parent_link } || self
parent << node
end
def <<( node )
node.parent = self
@children << node
end
def []( child_index )
@children[child_index]
end
def children( parent_link=nil, &block )
if parent_link
root = find( parent_link )
root ? root.children( &block ) : []
else
@children
end
end
def descendants
( @children + @children.map{ |child| child.descendants } ).flatten
end
def find( link )
# TODO: this is eminently cachable
descendants.find{ |node| node.link==link }
end
def depth
# Cached assuming no one is going to shuffle the nodes after placement
@depth ||= ancestors.length
end
def ancestors
# Cached assuming no one is going to shuffle the nodes after placement
return @ancestors if @ancestors
@ancestors = []
node = self
@ancestors << node while node = node.parent
@ancestors.reverse!
end
def to_s
"#{@title} (#{@link}) - #{@page && @page.title}"
end
def to_txt( depth=0 )
indent = " "*depth
[
indent+to_s,
children.map{|kid|kid.to_txt(depth+1)}
].flatten.join("\n")
end
end
class DocuBot::LinkTree::Root < DocuBot::LinkTree::Node
undef_method :title
undef_method :link
undef_method :page
attr_reader :bundle
def initialize( bundle )
@bundle = bundle
@children = []
end
def <<( node )
node.parent = nil
@children << node
end
def to_s
"(Table of Contents)"
end
end
| Java |
"use strict"
const messages = require("..").messages
const ruleName = require("..").ruleName
const rules = require("../../../rules")
const rule = rules[ruleName]
testRule(rule, {
ruleName,
config: ["always"],
accept: [ {
code: "a { background-size: 0 , 0; }",
}, {
code: "a { background-size: 0 ,0; }",
}, {
code: "a::before { content: \"foo,bar,baz\"; }",
description: "strings",
}, {
code: "a { transform: translate(1,1); }",
description: "function arguments",
} ],
reject: [ {
code: "a { background-size: 0, 0; }",
message: messages.expectedBefore(),
line: 1,
column: 23,
}, {
code: "a { background-size: 0 , 0; }",
message: messages.expectedBefore(),
line: 1,
column: 25,
}, {
code: "a { background-size: 0\n, 0; }",
message: messages.expectedBefore(),
line: 2,
column: 1,
}, {
code: "a { background-size: 0\r\n, 0; }",
description: "CRLF",
message: messages.expectedBefore(),
line: 2,
column: 1,
}, {
code: "a { background-size: 0\t, 0; }",
message: messages.expectedBefore(),
line: 1,
column: 24,
} ],
})
testRule(rule, {
ruleName,
config: ["never"],
accept: [ {
code: "a { background-size: 0, 0; }",
}, {
code: "a { background-size: 0,0; }",
}, {
code: "a::before { content: \"foo ,bar ,baz\"; }",
description: "strings",
}, {
code: "a { transform: translate(1 ,1); }",
description: "function arguments",
} ],
reject: [ {
code: "a { background-size: 0 , 0; }",
message: messages.rejectedBefore(),
line: 1,
column: 24,
}, {
code: "a { background-size: 0 , 0; }",
message: messages.rejectedBefore(),
line: 1,
column: 25,
}, {
code: "a { background-size: 0\n, 0; }",
message: messages.rejectedBefore(),
line: 2,
column: 1,
}, {
code: "a { background-size: 0\r\n, 0; }",
description: "CRLF",
message: messages.rejectedBefore(),
line: 2,
column: 1,
}, {
code: "a { background-size: 0\t, 0; }",
message: messages.rejectedBefore(),
line: 1,
column: 24,
} ],
})
testRule(rule, {
ruleName,
config: ["always-single-line"],
accept: [ {
code: "a { background-size: 0 , 0; }",
}, {
code: "a { background-size: 0 ,0; }",
}, {
code: "a { background-size: 0 ,0;\n}",
description: "single-line list, multi-line block",
}, {
code: "a { background-size: 0 ,0;\r\n}",
description: "single-line list, multi-line block with CRLF",
}, {
code: "a { background-size: 0,\n0; }",
description: "ignores multi-line list",
}, {
code: "a { background-size: 0,\r\n0; }",
description: "ignores multi-line list with CRLF",
}, {
code: "a::before { content: \"foo,bar,baz\"; }",
description: "strings",
}, {
code: "a { transform: translate(1,1); }",
description: "function arguments",
} ],
reject: [ {
code: "a { background-size: 0, 0; }",
message: messages.expectedBeforeSingleLine(),
line: 1,
column: 23,
}, {
code: "a { background-size: 0, 0;\n}",
message: messages.expectedBeforeSingleLine(),
line: 1,
column: 23,
}, {
code: "a { background-size: 0, 0;\r\n}",
description: "CRLF",
message: messages.expectedBeforeSingleLine(),
line: 1,
column: 23,
}, {
code: "a { background-size: 0 , 0; }",
message: messages.expectedBeforeSingleLine(),
line: 1,
column: 25,
}, {
code: "a { background-size: 0\t, 0; }",
message: messages.expectedBeforeSingleLine(),
line: 1,
column: 24,
} ],
})
testRule(rule, {
ruleName,
config: ["never-single-line"],
accept: [ {
code: "a { background-size: 0, 0; }",
}, {
code: "a { background-size: 0,0; }",
}, {
code: "a { background-size: 0,0;\n}",
description: "single-line list, multi-line block",
}, {
code: "a { background-size: 0,0;\r\n}",
description: "single-line list, multi-line block with CRLF",
}, {
code: "a { background-size: 0 ,\n0; }",
description: "ignores multi-line list",
}, {
code: "a { background-size: 0 ,\r\n0; }",
description: "ignores multi-line list with CRLF",
}, {
code: "a::before { content: \"foo ,bar ,baz\"; }",
description: "strings",
}, {
code: "a { transform: translate(1 ,1); }",
description: "function arguments",
} ],
reject: [ {
code: "a { background-size: 0 , 0; }",
message: messages.rejectedBeforeSingleLine(),
line: 1,
column: 24,
}, {
code: "a { background-size: 0 , 0;\n}",
message: messages.rejectedBeforeSingleLine(),
line: 1,
column: 24,
}, {
code: "a { background-size: 0 , 0;\r\n}",
description: "CRLF",
message: messages.rejectedBeforeSingleLine(),
line: 1,
column: 24,
}, {
code: "a { background-size: 0 , 0; }",
message: messages.rejectedBeforeSingleLine(),
line: 1,
column: 25,
}, {
code: "a { background-size: 0\t, 0; }",
message: messages.rejectedBeforeSingleLine(),
line: 1,
column: 24,
} ],
})
| Java |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Login Page - Photon Admin Panel Theme</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
<link rel="shortcut icon" href="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/favicon.ico"/>
<link rel="apple-touch-icon" href="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/iosicon.png"/>
<link rel="stylesheet" href="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/css/css_compiled/photon-min.css?v1.1" media="all"/>
<link rel="stylesheet" href="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/css/css_compiled/photon-min-part2.css?v1.1" media="all"/>
<link rel="stylesheet" href="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/css/css_compiled/photon-responsive-min.css?v1.1" media="all"/>
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="css/css_compiled/ie-only-min.css?v1.1" />
<![endif]-->
<!--[if lt IE 9]>
<link rel="stylesheet" type="text/css" href="css/css_compiled/ie8-only-min.css?v1.1" />
<script type="text/javascript" src="js/plugins/excanvas.js"></script>
<script type="text/javascript" src="js/plugins/html5shiv.js"></script>
<script type="text/javascript" src="js/plugins/respond.min.js"></script>
<script type="text/javascript" src="js/plugins/fixFontIcons.js"></script>
<![endif]-->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/jquery-ui.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/bootstrap/bootstrap.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/modernizr.custom.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/jquery.pnotify.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/less-1.3.1.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/xbreadcrumbs.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/jquery.maskedinput-1.3.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/jquery.autotab-1.1b.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/charCount.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/jquery.textareaCounter.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/elrte.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/elrte.en.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/select2.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/jquery-picklist.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/jquery.validate.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/additional-methods.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/jquery.form.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/jquery.metadata.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/jquery.mockjax.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/jquery.uniform.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/jquery.tagsinput.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/jquery.rating.pack.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/farbtastic.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/jquery.timeentry.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/jquery.jstree.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/dataTables.bootstrap.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/jquery.mousewheel.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/jquery.mCustomScrollbar.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/jquery.flot.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/jquery.flot.stack.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/jquery.flot.pie.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/jquery.flot.resize.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/raphael.2.1.0.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/justgage.1.0.1.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/jquery.qrcode.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/jquery.clock.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/jquery.countdown.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/jquery.jqtweet.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/jquery.cookie.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/bootstrap-fileupload.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/prettify/prettify.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/bootstrapSwitch.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/plugins/mfupload.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/js/common.js"></script>
</head>
<body class="body-login">
<div class="nav-fixed-topright" style="visibility: hidden">
<ul class="nav nav-user-menu">
<li class="user-sub-menu-container">
<a href="javascript:;">
<i class="user-icon"></i><span class="nav-user-selection">Theme Options</span><i class="icon-menu-arrow"></i>
</a>
<ul class="nav user-sub-menu">
<li class="light">
<a href="javascript:;">
<i class='icon-photon stop'></i>Light Version
</a>
</li>
<li class="dark">
<a href="javascript:;">
<i class='icon-photon stop'></i>Dark Version
</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-photon mail"></i>
</a>
</li>
<li>
<a href="javascript:;">
<i class="icon-photon comment_alt2_stroke"></i>
<div class="notification-count">12</div>
</a>
</li>
</ul>
</div>
<script>
$(function(){
setTimeout(function(){
$('.nav-fixed-topright').removeAttr('style');
}, 300);
$(window).scroll(function(){
if($('.breadcrumb-container').length){
var scrollState = $(window).scrollTop();
if (scrollState > 0) $('.nav-fixed-topright').addClass('nav-released');
else $('.nav-fixed-topright').removeClass('nav-released')
}
});
$('.user-sub-menu-container').on('click', function(){
$(this).toggleClass('active-user-menu');
});
$('.user-sub-menu .light').on('click', function(){
if ($('body').is('.light-version')) return;
$('body').addClass('light-version');
setTimeout(function() {
$.cookie('themeColor', 'light', {
expires: 7,
path: '/'
});
}, 500);
});
$('.user-sub-menu .dark').on('click', function(){
if ($('body').is('.light-version')) {
$('body').removeClass('light-version');
$.cookie('themeColor', 'dark', {
expires: 7,
path: '/'
});
}
});
});
</script>
<div class="container-login">
<div class="form-centering-wrapper">
<div class="form-window-login">
<div class="form-window-login-logo">
<div class="login-logo">
<img src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/js/bootstrap/js/plugins/prettify/js/plugins/images/photon/login-logo@2x.png" alt="Photon UI"/>
</div>
<h2 class="login-title">Welcome to Photon UI!</h2>
<div class="login-member">Not a Member? <a href="jquery.autotab-1.1b.js.html#">Sign Up »</a>
<a href="jquery.autotab-1.1b.js.html#" class="btn btn-facebook"><i class="icon-fb"></i>Login with Facebook<i class="icon-fb-arrow"></i></a>
</div>
<div class="login-or">Or</div>
<div class="login-input-area">
<form method="POST" action="dashboard.php">
<span class="help-block">Login With Your Photon Account</span>
<input type="text" name="email" placeholder="Email">
<input type="password" name="password" placeholder="Password">
<button type="submit" class="btn btn-large btn-success btn-login">Login</button>
</form>
<a href="jquery.autotab-1.1b.js.html#" class="forgot-pass">Forgot Your Password?</a>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-1936460-27']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>
| Java |
/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+bash+css-extras+git+php+php-extras+jsx+scss+twig+yaml&plugins=line-highlight+line-numbers */
/**
* prism.js default theme for JavaScript, CSS and HTML
* Based on dabblet (http://dabblet.com)
* @author Lea Verou
*/
code[class*="language-"],
pre[class*="language-"] {
color: black;
text-shadow: 0 1px white;
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
direction: ltr;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
line-height: 1.5;
-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}
pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection,
code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection {
text-shadow: none;
background: #b3d4fc;
}
pre[class*="language-"]::selection, pre[class*="language-"] ::selection,
code[class*="language-"]::selection, code[class*="language-"] ::selection {
text-shadow: none;
background: #b3d4fc;
}
@media print {
code[class*="language-"],
pre[class*="language-"] {
text-shadow: none;
}
}
/* Code blocks */
pre[class*="language-"] {
padding: 1em;
margin: .5em 0;
overflow: auto;
}
:not(pre) > code[class*="language-"],
pre[class*="language-"] {
background: #f5f2f0;
}
/* Inline code */
:not(pre) > code[class*="language-"] {
padding: .1em;
border-radius: .3em;
}
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
color: slategray;
}
.token.punctuation {
color: #999;
}
.namespace {
opacity: .7;
}
.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
color: #905;
}
.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
color: #690;
}
.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
color: #a67f59;
background: hsla(0, 0%, 100%, .5);
}
.token.atrule,
.token.attr-value,
.token.keyword {
color: #07a;
}
.token.function {
color: #DD4A68;
}
.token.regex,
.token.important,
.token.variable {
color: #e90;
}
.token.important,
.token.bold {
font-weight: bold;
}
.token.italic {
font-style: italic;
}
.token.entity {
cursor: help;
}
pre[data-line] {
position: relative;
padding: 1em 0 1em 3em;
}
.line-highlight {
position: absolute;
left: 0;
right: 0;
padding: inherit 0;
margin-top: 1em; /* Same as .prism’s padding-top */
background: hsla(24, 20%, 50%,.08);
background: -moz-linear-gradient(left, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));
background: -webkit-linear-gradient(left, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));
background: -o-linear-gradient(left, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));
background: linear-gradient(left, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));
pointer-events: none;
line-height: inherit;
white-space: pre;
}
.line-highlight:before,
.line-highlight[data-end]:after {
content: attr(data-start);
position: absolute;
top: .4em;
left: .6em;
min-width: 1em;
padding: 0 .5em;
background-color: hsla(24, 20%, 50%,.4);
color: hsl(24, 20%, 95%);
font: bold 65%/1.5 sans-serif;
text-align: center;
vertical-align: .3em;
border-radius: 999px;
text-shadow: none;
box-shadow: 0 1px white;
}
.line-highlight[data-end]:after {
content: attr(data-end);
top: auto;
bottom: .4em;
}
pre.line-numbers {
position: relative;
padding-left: 3.8em;
counter-reset: linenumber;
}
pre.line-numbers > code {
position: relative;
}
.line-numbers .line-numbers-rows {
position: absolute;
pointer-events: none;
top: 0;
font-size: 100%;
left: -3.8em;
width: 3em; /* works for line-numbers below 1000 lines */
letter-spacing: -1px;
border-right: 1px solid #999;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.line-numbers-rows > span {
pointer-events: none;
display: block;
counter-increment: linenumber;
}
.line-numbers-rows > span:before {
content: counter(linenumber);
color: #999;
display: block;
padding-right: 0.8em;
text-align: right;
}
| Java |
# -*- coding: utf-8 -*-
"""
"""
from datetime import datetime, timedelta
import os
from flask import request
from flask import Flask
import pytz
import db
from utils import get_remote_addr, get_location_data
app = Flask(__name__)
@app.route('/yo-water/', methods=['POST', 'GET'])
def yowater():
payload = request.args if request.args else request.get_json(force=True)
username = payload.get('username')
reminder = db.reminders.find_one({'username': username})
reply_object = payload.get('reply')
if reply_object is None:
if db.reminders.find_one({'username': username}) is None:
address = get_remote_addr(request)
data = get_location_data(address)
if not data:
return 'Timezone needed'
user_data = {'created': datetime.now(pytz.utc),
'username': username}
if data.get('time_zone'):
user_data.update({'timezone': data.get('time_zone')})
db.reminders.insert(user_data)
return 'OK'
else:
reply_text = reply_object.get('text')
if reply_text == u'Can\'t right now 😖':
reminder['trigger_date'] = datetime.now(pytz.utc) + timedelta(minutes=15)
else:
reminder['step'] += 1
reminder['trigger_date'] = datetime.now(pytz.utc) + timedelta(minutes=60)
reminder['last_reply_date'] = datetime.now(pytz.utc)
db.reminders.update({'username': username},
reminder)
db.replies.insert({'username': username,
'created': datetime.now(pytz.utc),
'reply': reply_text})
return 'OK'
if __name__ == "__main__":
app.debug = True
app.run(host="0.0.0.0", port=int(os.environ.get("PORT", "5000")))
| Java |
<html>
<head>
<title>Terry George's panel show appearances</title>
<script type="text/javascript" src="../common.js"></script>
<link rel="stylesheet" media="all" href="../style.css" type="text/css"/>
<script type="text/javascript" src="../people.js"></script>
<!--#include virtual="head.txt" -->
</head>
<body>
<!--#include virtual="nav.txt" -->
<div class="page">
<h1>Terry George's panel show appearances</h1>
<p>Terry George has appeared in <span class="total">1</span> episodes between 2009-2009. <a href="http://www.imdb.com/name/nm313623">Terry George on IMDB</a>. <a href="https://en.wikipedia.org/wiki/Terry_George">Terry George on Wikipedia</a>.</p>
<div class="performerholder">
<table class="performer">
<tr style="vertical-align:bottom;">
<td><div style="height:100px;" class="performances male" title="1"></div><span class="year">2009</span></td>
</tr>
</table>
</div>
<ol class="episodes">
<li><strong>2009-06-26</strong> / <a href="../shows/loosewomen.html">Loose Women</a></li>
</ol>
</div>
</body>
</html>
| Java |
{% extends "base.html" %}
{% block title %} new statement
{% endblock title %}
{% load crispy_forms_tags %}
{% block content %}
<h1>Create a new {{ model_name_lower }}!</h1>
{% if request.user.is_anonymous %}
Only signed-in users can create {{ model_name_lower }}s!
{% else %}
{% crispy form form.helper %}
{% endif %}
{% endblock content %}
{% block javascript %}
{{ block.super }}
{{ form.media }}
{% endblock javascript %}
| Java |
from django.conf.urls import patterns, include, url
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
admin.autodiscover()
import views
urlpatterns = patterns('',
url(r'^pis', views.pis),
url(r'^words', views.words, { 'titles': False }),
url(r'^projects', views.projects),
url(r'^posters', views.posters),
url(r'^posterpresenters', views.posterpresenters),
url(r'^pigraph', views.pigraph),
url(r'^institutions', views.institutions),
url(r'^institution/(?P<institutionid>\d+)', views.institution),
url(r'^profile/$', views.profile),
url(r'^schedule/(?P<email>\S+)', views.schedule),
url(r'^ratemeeting/(?P<rmid>\d+)/(?P<email>\S+)', views.ratemeeting),
url(r'^submitrating/(?P<rmid>\d+)/(?P<email>\S+)', views.submitrating),
url(r'^feedback/(?P<email>\S+)', views.after),
url(r'^breakouts', views.breakouts),
url(r'^breakout/(?P<bid>\d+)', views.breakout),
url(r'^about', views.about),
url(r'^buginfo', views.buginfo),
url(r'^allrms', views.allrms),
url(r'^allratings', views.allratings),
url(r'^login', views.login),
url(r'^logout', views.logout),
url(r'^edit_home_page', views.edit_home_page),
url(r'^pi/(?P<userid>\d+)', views.pi), # , name = 'pi'),
url(r'^pi/(?P<email>\S+)', views.piEmail), # , name = 'pi'),
url(r'^project/(?P<abstractid>\S+)', views.project, name = 'project'),
url(r'^scope=(?P<scope>\w+)/(?P<url>.+)$', views.set_scope),
url(r'^active=(?P<active>\d)/(?P<url>.+)$', views.set_active),
url(r'^admin/', include(admin.site.urls)),
(r'', include('django_browserid.urls')),
url(r'^$', views.index, name = 'index'),
) + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
| Java |
var test = require('tap').test;
var CronExpression = require('../lib/expression');
test('Fields are exposed', function(t){
try {
var interval = CronExpression.parse('0 1 2 3 * 1-3,5');
t.ok(interval, 'Interval parsed');
CronExpression.map.forEach(function(field) {
interval.fields[field] = [];
t.throws(function() {
interval.fields[field].push(-1);
}, /Cannot add property .*?, object is not extensible/, field + ' is frozen');
delete interval.fields[field];
});
interval.fields.dummy = [];
t.same(interval.fields.dummy, undefined, 'Fields is frozen');
t.same(interval.fields.second, [0], 'Second matches');
t.same(interval.fields.minute, [1], 'Minute matches');
t.same(interval.fields.hour, [2], 'Hour matches');
t.same(interval.fields.dayOfMonth, [3], 'Day of month matches');
t.same(interval.fields.month, [1,2,3,4,5,6,7,8,9,10,11,12], 'Month matches');
t.same(interval.fields.dayOfWeek, [1,2,3,5], 'Day of week matches');
} catch (err) {
t.error(err, 'Interval parse error');
}
t.end();
});
| Java |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>Boost::context future: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">Boost::context future
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="class_future.html">Future</a></li><li class="navelem"><a class="el" href="struct_future_1_1_already_fulfilled.html">AlreadyFulfilled</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">Future< ValueType, ErrorType >::AlreadyFulfilled Member List</div> </div>
</div><!--header-->
<div class="contents">
<p>This is the complete list of members for <a class="el" href="struct_future_1_1_already_fulfilled.html">Future< ValueType, ErrorType >::AlreadyFulfilled</a>, including all inherited members.</p>
<table class="directory">
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>what</b>() const noexcept (defined in <a class="el" href="struct_future_1_1_already_fulfilled.html">Future< ValueType, ErrorType >::AlreadyFulfilled</a>)</td><td class="entry"><a class="el" href="struct_future_1_1_already_fulfilled.html">Future< ValueType, ErrorType >::AlreadyFulfilled</a></td><td class="entry"><span class="mlabel">inline</span></td></tr>
</table></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Tue Jul 7 2015 13:05:59 for Boost::context future by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
</body>
</html>
| Java |
<?php
use Illuminate\Database\Seeder;
// composer require laracasts/testdummy
use Laracasts\TestDummy\Factory as TestDummy;
class UsersTableSeeder extends Seeder
{
public function run()
{
DB::table('users')->insert([
'name' => 'system',
'email' => 'system@levelup.app',
'password' => bcrypt('system'),
]);
}
}
| Java |
package br.eti.qisolucoes.contactcloud.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private UserDetailsService userDetailsService;
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().antMatchers("/").authenticated()
.antMatchers("/theme/**", "/plugins/**", "/page/**", "/", "/usuario/form", "/usuario/salvar").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginProcessingUrl("/login").loginPage("/login").permitAll().defaultSuccessUrl("/agenda/abrir", true)
.and()
.logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout")).logoutSuccessUrl("/");
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
super.configure(auth);
auth.userDetailsService(userDetailsService);
}
}
| Java |
package de.chandre.admintool.security.dbuser.repo;
import java.util.List;
import java.util.Set;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import de.chandre.admintool.security.dbuser.domain.ATRole;
/**
*
* @author André
* @since 1.1.7
*/
@Repository
public interface RoleRepository extends JpaRepository<ATRole, String> {
ATRole findByName(String name);
@Query("SELECT r.name FROM ATRole r")
List<String> findAllRoleNames();
List<ATRole> findByNameIn(Set<String> ids);
List<ATRole> findByIdIn(Set<String> ids);
void deleteByName(String name);
}
| Java |
#! /bin/bash
defaults write com.apple.finder AppleShowAllFiles FALSE
killall Finder
| Java |
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, fillIn } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
module('Integration | Component | inputs/text-input', function (hooks) {
setupRenderingTest(hooks);
hooks.beforeEach(async function () {
this.config = {
value: '123 hello',
name: 'myInput',
disabled: false,
autocomplete: 'name',
texts: {
placeholder: 'Your name',
},
};
await render(hbs`<Inputs::TextInput @config={{config}} />`);
});
test('it renders', async function (assert) {
assert.dom('textarea').hasAttribute('name', 'myInput');
assert.dom('textarea').hasAttribute('autocomplete', 'name');
assert.dom('textarea').hasAttribute('placeholder', 'Your name');
});
test('it updates value', async function (assert) {
assert.dom('textarea').hasValue('123 hello');
this.set('config.value', 'hello?');
assert.dom('textarea').hasValue('hello?');
await fillIn('textarea', 'bye!');
assert.equal(this.config.value, 'bye!');
});
test('it can be disabled', async function (assert) {
assert.dom('textarea').isNotDisabled();
this.set('config.disabled', true);
assert.dom('textarea').isDisabled();
});
test('it supports presence validations', async function (assert) {
assert.dom('textarea').doesNotHaveAttribute('required');
this.set('config.validations', { required: true });
assert.dom('textarea').hasAttribute('required');
});
});
| Java |
#!/usr/bin/env node
var listCommand = [];
require('./listCommand')(listCommand)
var logDetail = (str) => {
console.log(' > '+str);
}
var printHelp = () => {
var txtHelp = "";
var h = ' ';
var t = ' ';
txtHelp += "\n"+h+"Usage : rider [command] \n";
txtHelp += "\n"+h+"Command List : \n";
var maxText = 0;
if(listCommand == undefined){
logDetail("not found help detail");
return;
}
Object.keys(listCommand).forEach((keyName) => {
var item = listCommand[keyName];
if(maxText < item.name.length+item.params.length)
maxText = item.name.length+item.params.length+4;
});
var maxT = Math.ceil(maxText/4);
Object.keys(listCommand).forEach((keyName) => {
var item = listCommand[keyName];
var x = (item.name.length+item.params.length+4)/4;
x = Math.ceil(x);
var space = '\t';
for (var i = 0; i < maxT-x-1; i++) {
space += '\t';
}
var txt = "";
if(item.params.length > 0){
space += '\t';
txt = '\t'+item.name +" [" +item.params+"] " + space +item.desc+"\n";
}else{
txt = '\t'+item.name + space +item.desc+"\n";
}
txtHelp +=txt;
txtHelp +"\n";
});
console.log(txtHelp);
process.exit(0);
}
var parseParams = (params, cb) => {
if(params.length < 3){
return cb(true);
}
cb(false);
}
var checkCommand = (cmd) => {
var foundCmd = false;
Object.keys(listCommand).forEach((keyName) => {
if(keyName == cmd){
foundCmd = true;
return;
}
});
return !foundCmd;
}
var runCommand = (params, cb) => {
var opt = params[2];
var objRun = listCommand[opt];
if(objRun != undefined && objRun != null){
objRun.runCommand(params, cb);
}
}
var main = () => {
console.log(">> Rider ... ");
var params = process.argv;
parseParams(params, (err) => {
if(err){
printHelp();
return;
}
var opt = params[2];
if(opt == "-h" || opt == "--help"){
printHelp();
return;
}
if(checkCommand(opt)){
printHelp();
return;
}
runCommand(params, () => {
process.exit(0);
});
});
}
// -- call main function --
main();
| Java |
<?php
/*
* Arabian language
*/
$lang = [
'albums' => 'Альбомы'
]; | Java |
//
// RSAEncryptor.h
// iOSProject
//
// Created by Alpha on 2017/6/12.
// Copyright © 2017年 STT. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface RSAEncryptor : NSObject
/**
* 加密方法
*
* @param str 需要加密的字符串
* @param path '.der'格式的公钥文件路径
*/
+ (NSString *)encryptString:(NSString *)str publicKeyWithContentsOfFile:(NSString *)path;
/**
* 解密方法
*
* @param str 需要解密的字符串
* @param path '.p12'格式的私钥文件路径
* @param password 私钥文件密码
*/
+ (NSString *)decryptString:(NSString *)str privateKeyWithContentsOfFile:(NSString *)path password:(NSString *)password;
/**
* 加密方法
*
* @param str 需要加密的字符串
* @param pubKey 公钥字符串
*/
+ (NSString *)encryptString:(NSString *)str publicKey:(NSString *)pubKey;
/**
* 解密方法
*
* @param str 需要解密的字符串
* @param privKey 私钥字符串
*/
+ (NSString *)decryptString:(NSString *)str privateKey:(NSString *)privKey;
@end
| Java |
# Digital ecosystem dashboard
This dashboard was technically and graphically made by [Sebcreation](http://www.sebcreation.com)
## Requirements
This application requires [Node JS](http://nodejs.org/), the streaming build system [gulp.js](http://gulpjs.com/) and the [compass](http://compass-style.org/) ruby gem.
After installing Node JS, gulp.js can easily be installed via Terminal :
```
$ npm install -g gulp
```
Compass can easily be installed via Terminal :
```
$ gem update --system
$ gem install compass
```
Please refer the [user guide](http://compass-style.org/install/)
| Java |
<?php
namespace Hal\Controller;
/*
* File: /app/code/core/system/base_controller.php
* Purpose: Base class from which all controllers extend
*/
class Base_Controller {
protected $action;
public $cache;
public $config;
private $controller;
private $controller_class;
private $controller_filename;
protected $core;
protected $cron;
protected $data;
protected $db;
protected $dispatcher;
public $load;
public $log;
protected $model;
protected $param;
protected $route;
public $session;
public $template;
public $toolbox;
public $view;
public function __construct($app)
{
$this->config = $app['config'];
$this->core = $app;
$this->cron = $app['cron'];
$this->db = $app['database'];
$this->dispatcher = $app['dispatcher'];
$this->event = $app['event'];
$this->load = $app['load'];
$this->log = $app['log'];
$this->model = $app['system_model'];
$this->orm = $app['orm'];
$this->route = $app['router'];
$this->session = $app['session'];
$this->template = $app['template'];
$this->toolbox = $app['toolbox'];
}
public final function parse()
{
# Define child controller extending this class
$this->controller = $this->route->controller;
# The class name contained inside child controller
$this->controller_class = $this->controller.'_Controller';
# File name of child controller
$this->controller_filename = ucwords($this->controller_class).'.php';
# Action being requested from child controller
$this->action = $this->route->action;
$action = trim(strtolower($this->route->action));
# URL parameters
$this->param = $this->route->param;
# Pass controller information to view files; used for debugger
$this->template->assign('controller', $this->controller);
$this->template->assign('controller_class', $this->controller_class);
$this->template->assign('controller_filename', $this->controller_filename);
$this->template->assign('action', $action);
# Admin, Public and Override classes
$_admin_class = $this->controller_class;
$_web_class = "\Web\Controller\\".$this->controller_class;
$_override_class = "\Hal\ControllerOverride\\".$this->controller_class;
# Check if the admin controller is being requested
if ($this->controller == $this->config->setting('admin_controller') && is_readable(CORE_PATH.'controllers/'.$this->controller_filename) && $this->controller_filename) {
# File was found and has proper file permissions
require_once CORE_PATH.'controllers/'.$this->controller_filename;
if (class_exists($_admin_class)) {
# File found and class exists, so instantiate controller class
$__instantiate_class = new $this->controller_class($this->core);
if (method_exists($__instantiate_class, $action)) {
# Class method exists
$__instantiate_class->$action();
} else {
# Valid controller, but invalid action
$this->template->assign('controller_path', CORE_PATH.'controllers/'.$this->controller_filename);
$this->template->assign('content', 'error/action.tpl');
}
} else {
# Controller file exists, but class name
# is not formatted / spelled properly
$this->template->assign('content', 'error/controller-bad-classname.tpl');
}
}
# First search for requested controller file in override directory
elseif (is_readable(PUBLIC_OVERRIDE_PATH.'controllers/'.$this->controller_filename) && class_exists($_web_class)) {
# File was found and has proper file permissions
require_once PUBLIC_OVERRIDE_PATH.'controllers/'.$this->controller_filename;
if (class_exists($_override_class)) {
# File found and class exists, so instantiate controller class
$__instantiate_class = new $_override_class($this->core);
// if (!is_subclass_of($__instantiate_class, $_web_class))
// {
// echo $_override_class . ' DOES NOT EXTEND ' . $_web_class;
// }
if (method_exists($__instantiate_class, $action)) {
# Class method exists
$__instantiate_class->$action();
} else {
# Valid controller, but invalid action
$this->template->assign('controller_path', PUBLIC_OVERRIDE_PATH.'controllers/'.$this->controller_filename);
$this->template->assign('content', 'error/action.tpl');
}
} else {
# Controller file exists, but class name
# is not formatted / spelled properly
$this->template->assign('content', 'error/controller-bad-classname.tpl');
}
} else {
if (!is_readable($this->config->setting('controllers_path').$this->controller_filename)) {
# Controller file does not exist, or
# does not have read permissions
if ($this->config->setting('debug_mode') === 'OFF' {
return $this->redirect('error/_404');
} else {
$controller = new \Web\Controller\Error_Controller($this->core);
$controller->controller();
}
}
# Search for requested controller file in public directory
if (is_readable($this->config->setting('controllers_path').$this->controller_filename) && $this->controller_filename) {
# File was found and has proper file permissions
require_once $this->config->setting('controllers_path').$this->controller_filename;
if (class_exists($_web_class)) {
# File found and class exists, so instantiate controller class
$__instantiate_class = new $_web_class($this->core);
if (method_exists($__instantiate_class, $action)) {
# Class method exists
$__instantiate_class->$action();
} else {
# Valid controller, but invalid action
if ($this->config->setting('debug_mode') === 'OFF' {
$this->redirect('error/_404');
} else {
$this->template->assign('controller_path', $this->config->setting('controllers_path').$this->controller_filename);
$this->template->assign('content', 'error/action.tpl');
}
}
} else {
# Controller file exists, but class name is not formatted / spelled properly
if ($this->config->setting('debug_mode') === 'OFF' {
$this->redirect('error/_404');
} else {
$this->template->assign('content', 'error/controller-bad-classname.tpl');
}
}
} else {
# Controller file does not exist, or
# does not have read permissions
if ($this->config->setting('debug_mode') === 'OFF' {
$this->redirect('error/_404');
} else {
$this->template->assign('content', 'error/controller.tpl');
}
}
}
}
public function model($model) {
return $this->load->model("$model");
}
public function redirect($url) {
if ($url === 'http_referer') {
return header('Location: '.$_SERVER['HTTP_REFERER']);
exit;
}
return header('Location: '.BASE_URL.$url);
}
public function session() {
return $this->toolbox('session');
}
public function toolbox($helper) {
# Load a Toolbox helper
return $this->toolbox["$helper"];
}
}
| Java |
---
title: While We're At It
category: The Guts of FP
order: 1
---
You won't get very far in most imperative languages without the humble `while` loop or one of it's variants such as `for`. Even though for loops are more commonly used, they are just syntactic sugar on while, so let's start there:
{% highlight javascript %}
let i = 0;
while (i < someEndValue) {
// do something interesting here
i++;
}
{% endhighlight %}
While it's possible for `someEndValue` to be anything it's extremely common for it to be the length of a collection.
{% highlight javascript %}
let i = 0;
while (i < someCollection.length) {
// do something with someCollection[i] here
i++;
}
{% endhighlight %}
This immediately brings up a problem, if we want to avoid mutating state, what useful thing could we do in the body of the while loop? While is not an expression, so we can't be returning a value. While demands that we mutate something inside the body, even if we are creating a new value each loop we're still rebinding the variable to a new value. This is as close to no-mutation as we can accomplish with while, but we're still clobbering that outer variable each time.
{% highlight javascript %}
let numbers = [];
let i = 0;
while (i < 5) {
numbers.push(i);
i++;
}
{% endhighlight %}
Furthermore, since `while` is not an expression, there is no way to really combine it with anything else. This is a concept known as composition and we'll return to it later. Fortunately there's another construct that can be used to accomplish a looping structure but allows you to return a value at the end and doesn't need to mutate anything or reassign variables. This means you can use `const someValue = doTheThing(...)` or even `const someValue = doTheThing(...).andThen(...)`. You may have never thought about `recursion` this way, but it's true!
> Recursion is the ability of a function to be applied to an argument inside itself. If done wrong this leads to an infinite chain of application in much the same way that forgetting the `i++` at the end of a `while` is an infinite loop.
{% highlight javascript %}
const populateArray =
(numbers, i, endValue) =>
i < endValue
? populateArray([...numbers, i], i + 1, endValue)
: numbers;
const result = populateArray([], 0, 5);
{% endhighlight %}
The process of running this function would look like this.
{% highlight javascript %}
numbers i
| |
v v
populateArray([], 0, 5)
numbers i
| |
v v
populateArray([0], 1, 5)
numbers i
| |
v v
populateArray([0, 1], 2, 5)
numbers i
| |
v v
populateArray([0, 1, 2], 3, 5)
numbers i
| |
v v
populateArray([0, 1, 2, 3], 4, 5)
numbers i
| |
v v
populateArray([0, 1, 2, 3, 4], 5, 5)
{% endhighlight %}
When we run `populateArray`, 0 is less than 5, so we recursively call `populateArray` again, but this time with `[0]` and `1` for the `numbers` and `i` arguments. This continues down until `i` is 5 at which point we return the current value of numbers which is `[0, 1, 2, 3, 4]`. This value is in turn returned by each prior `populateArray` and the final result is thus `[0, 1, 2, 3, 4]`.
This may look more complex than the `while` example if you're not used to thinking recursively and using it in this manner. Hopefully though you see much of the operations we're performing are the same.
- `i < 5` is the same as `i < endValue`
- `numbers.push(i)` and `[...numbers, i]` are both adding an element to the array
- `i++` and `i + 1` both move the counter up one
Everything we could express in a while loop we can do via recursion and not need to mutate an outer variable along the way. With that said though, you probably don't write many while loops given there are constructs that more directly do what you want such as for. Let's look at a few common cases.
#### Filter: reject unwanted values
{% highlight javascript %}
const itemsToKeep = [];
for (var i = 0; i < collection.length; i++) {
if (someCriteria(collection[i])) {
itemsToKeep.push(collection[i]);
}
}
{% endhighlight %}
#### Map: transform values
{% highlight javascript %}
const newCollection = [];
for (var i = 0; i < collection.length; i++) {
newCollection.push(
someOperation(collection[i])
);
}
{% endhighlight %}
If your language supports a `foreach` style iteration (`for x of y` in ES6) where the value itself is bound to a local variable instead of using an index, these could both be re-written using that.
Both these cases have a striking amount of similarity. Hopefully you've noticed this at some point as well. In fact, almost every line of each of these two cases are the same
- `const itemsToKeep = []` is `const newCollection = []`
- `for (var i = 0; i < collection.length; i++) {` is identical for both
- `itemsToKeep.push` is `newCollection.push`
The only difference is that in the first case the item is conditionally added, and in the second, the item is processed before being added. This is the fundamental difference between the two operations, one filters out elements, the other maps one value to another. **_If the "when and what to insert" decision could be parameterized, then the rest of the code could be written once and not every time we need this construct._**
### Higher Order Functions
To accomplish this feat we would need a function that could be parameterized by another function.
{% highlight javascript %}
const doThing = (someFunction, someValue) => someFunction(someValue);
{% endhighlight %}
What are `someFunction` and `someValue`? No idea! Here's a function that receives _another_ function as an argument and can use it to produce a return value. We can go in the opposite direction as well.
{% highlight javascript %}
const makeFunction = () =>
(someNumber) =>
someNumber + 1;
const newFunction = makeFunction();
newFunction(5); // 6
{% endhighlight %}
This is not particularly interesting, in fact a function written like this could be converted back to a constant like you're used to.
{% highlight javascript %}
const newFunction = (someNumber) => someNumber + 1;
{% endhighlight %}
The interesting part is simply that functions are just values and can be returned like any other value, although this is not particularly common in JavaScript.
The first function does not need to have zero arguments, in fact it's often useful for it to have arguments since the function that is returned can see and reference those variables.
{% highlight javascript %}
const makeGreeting =
(message) =>
(name) =>
message + " " + name;
const jolly = makeGreeting("Hello there");
const grouchy = makeGreeting("Get off my lawn!");
jolly("Tina"); // "Hello there Tina"
grouchy("Max"); // "Get off my lawn! Max"
// we don't need to create an intermediate function
makeGreeting("Look ma, no funtion, right")("Sam"); // "Look ma, no funtion, right Sam"
{% endhighlight %}
The inner returned functions can also be written on a single line
{% highlight javascript %}
const makeGreeting = (message) => (name) => message + " " + name;
{% endhighlight %}
> A function that receives another function as an argument, or returns a new function as a return value is known as a **higher order function**.
This may not seem very useful at first, but let's apply the idea to the problem from before and see how this both helps eliminates the need for mutation of a variable, and solves a broad class of problems, all at once.
### Fold and Friends
For any while loop of the shape with the form:
- Initialize a new collection
- Iterate over existing collection
- Insert values into new collection
there is a generalized solution known commonly as `fold`, `reduce`, or `aggregate`.
general shape of:
{% highlight javascript %}
const newValue = fold(thingToDoWithEachNewElement, initialNewValue, collectionToIterateOver);
{% endhighlight %}
The `thingToDoWithEachNewElement` is a function that takes the working `initialNewValue` and combines it with an element from `collectionToIterateOver`. This might be done by doing a if check in the case of a filter type operation, or by running the element through a function first as in the case of the map type operation. Or it might be something unrelated to collections in the case of a sum type operation.
#### Filter type operation
{% highlight javascript %}
const filterFn =
(element, collection) =>
someCondition(element)
? [...collection, element]
: collection;
const someCondition = (x) => x > 5;
filterFn(7, [4, 5]) // [4, 5, 7]
filterFn(4, [4, 5]) // [4, 5]
{% endhighlight %}
#### Map type operation
{% highlight javascript %}
const mapFn = (element, collection) => [...collection, someOperation(element)];
const someOperation = (str) => str + "!";
mapFn("hi", []) // ["hi!"]
mapFn("excited", ["I", "am"]) // ["I", "am", "excited!"]
{% endhighlight %}
And we could use these functions with `fold` in a more concrete setting:
{% highlight javascript %}
const filteredValues = fold(filterFn, [], [3, 4, 5, 6]);
const transformedValues = fold(mapFn, [], ["programming", "is", "fun"]);
{% endhighlight %}
> This is generally the point where people's eyes glaze over as we begin to get a bit more abstract. From here on out, we will be working with concepts you likely have never encountered. This is genuinely hard to get at first, but the "different paradigm" type of understanding is on the other side, so hang in there!
### Exercise
Ready for a challenge? Open `exercises/fold.js` in your editor and implement the `fold` function that can operate on arrays. Do this either using a for loop or using recursion (or try both). It matters much less how something like `fold` is implemented "under the hood" as long as the interface is pure.
To test your changes, run `npm run -s fold` from the `exercises` directory.
> Ask questions!
## [Next](/3-guts-of-fp/type-it-out)
| Java |
import { BaseController } from "./BaseController";
import { Route } from "./BaseController";
import * as loadHtml from "./HtmlLoader";
export class MainController extends BaseController
{
main = (): void =>
{
loadHtml.load(this.requestData, '/views/index.html', {});
}
routes: Route[] = [
new Route("/", this.main)
];
} | Java |
import React from "react";
import $ from "jquery";
import "bootstrap/dist/js/bootstrap.min";
import "jquery-ui/ui/widgets/datepicker";
import {
postFulltimeEmployer,
postParttimeEmployer,
putFullTimeEmployer,
putParttimeEmployer
} from "../actions/PostData";
import DropDownBtn from "../components/DropDownBtn";
import {parseBirthdayForServer} from "../utils/Utils";
import {connect} from "react-redux";
class ModalEmployer extends React.Component {
componentWillReceiveProps = (nextProps) => {
if (nextProps.data) {
this.setState(nextProps.data);
if (nextProps.data.day_salary) {
this.setState({
type: 'congNhat'
})
} else {
this.setState({
type: 'bienChe'
})
}
}
if (nextProps.data == null) {
this.setState(this.emptyObject)
}
}
emptyObject = {
"salary_level": "",
"name": "",
"month_salary": "",
"phone": "",
"birthday": "",
"allowance": "",
"department_id": this.props.departments.length > 0 ? this.props.departments[0].id : "",
day_salary: "",
}
onClickSave = () => {
let data = {
"name": this.state.name,
"phone": this.state.phone,
"birthday": parseBirthdayForServer(this.state.birthday),
"department_id": this.state.department_id,
}
if (this.state.type === "bienChe") {
data.salary_level = this.state.salary_level;
data.month_salary = this.state.month_salary;
data.allowance = this.state.allowance;
if (this.props.data) {
putFullTimeEmployer(this.props.data.id, data, this.props.fetchEmployers);
}
else {
postFulltimeEmployer(data, this.props.fetchEmployers);
}
}
if (this.state.type === "congNhat") {
data.day_salary = this.state.day_salary;
if (this.props.data) {
putParttimeEmployer(this.props.data.id, data, this.props.fetchEmployers);
}
else {
postParttimeEmployer(data, this.props.fetchEmployers)
}
}
$('#create').modal('toggle');
}
constructor(props) {
super(props);
this.state = Object.assign(this.emptyObject, {type: null})
}
onChangeText = (event) => {
this.setState({
[event.target.name]: event.target.value
})
}
clickType = (type) => {
this.setState({
type
})
}
componentDidMount = () => {
$('#datepicker').datepicker({
uiLibrary: 'bootstrap4',
iconsLibrary: 'fontawesome',
onSelect: (dateText) => {
this.setState({
birthday: dateText
})
},
dateFormat: 'dd/mm/yy'
});
}
renderExtraForm = () => {
if (this.state.type) {
switch (this.state.type) {
case "bienChe":
return <div>
<label htmlFor="id">Lương tháng</label>
<div className="input-group">
<input onChange={this.onChangeText} name="month_salary" type="text" className="form-control"
id="id" aria-describedby="basic-addon3" value={this.state.month_salary}/>
</div>
<label htmlFor="id">Bậc lương</label>
<div className="input-group">
<input onChange={this.onChangeText} name="salary_level" type="text" className="form-control"
id="id" aria-describedby="basic-addon3" value={this.state.salary_level}/>
</div>
<label htmlFor="id">Phụ cấp</label>
<div className="input-group">
<input onChange={this.onChangeText} name="allowance" type="text" className="form-control"
id="id" aria-describedby="basic-addon3" value={this.state.allowance}/>
</div>
</div>
break;
case "congNhat":
return <div>
<label htmlFor="id">Lương ngày</label>
<div className="input-group">
<input name="day_salary" value={this.state.day_salary} onChange={this.onChangeText}
type="text"
className="form-control" id="id" aria-describedby="basic-addon3"/>
</div>
</div>
break;
}
}
}
onSelectDepartment = (item) => {
this.setState({
department_id: item.id
})
}
renderDropDownBtn = () => {
if (this.props.departments.length > 0) {
return (
<DropDownBtn onChange={this.onSelectDepartment} default data={this.props.departments}></DropDownBtn>
)
}
}
render() {
return (
<div className="modal fade" id="create" tabIndex="-1" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div className="modal-dialog" role="document">
<div className="modal-content">
<div className="modal-header">
<h5 className="modal-title" id="exampleModalLabel">Thêm nhân viên</h5>
<button type="button" className="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div className="modal-body">
<label htmlFor="name">Tên nhân viên</label>
<div className="input-group">
<input onChange={this.onChangeText} value={this.state.name} name="name" type="text"
className="form-control" id="name" aria-describedby="basic-addon3"/>
</div>
<label htmlFor="datepicker">Ngày tháng năm sinh</label>
<div className="input-group date" data-provide="datepicker">
<input onClick={this.onChangeText} onChange={this.onChangeText}
value={this.state.birthday}
name="birthday" type="text" className="form-control" id="datepicker"/>
</div>
<label htmlFor="phone">Số điện thoại</label>
<div className="input-group">
<input onChange={this.onChangeText} value={this.state.phone} name="phone" type="text"
className="form-control" id="phone" aria-describedby="basic-addon3"/>
</div>
<div className="btn-group">
<label htmlFor="name" className="margin-R10">Chọn phòng ban</label>
{this.renderDropDownBtn()}
</div>
<div className="btn-group btn-middle align-middle">
{
(() => {
if (this.props.data) {
if (this.props.data.day_salary === null) {
return (<button className="btn btn-primary"
id="bien-che">Nhân viên Biên chế
</button>)
}
else {
return (
<button className="btn btn-info"
id="cong-nhat">Nhân viên Công nhật
</button>
)
}
}
else {
let arr = [];
arr.push(<button onClick={this.clickType.bind(this, "bienChe")}
className="btn btn-primary"
id="bien-che">Nhân viên Biên chế
</button>);
arr.push(<button onClick={this.clickType.bind(this, "congNhat")}
className="btn btn-info"
id="cong-nhat">Nhân viên Công nhật
</button>);
return arr;
}
})()
}
</div>
{
this.renderExtraForm()
}
</div>
<div className="modal-footer">
<button type="button" className="btn btn-secondary" data-dismiss="modal">Hủy</button>
<button onClick={this.onClickSave} type="button" className="btn btn-primary">Lưu</button>
</div>
</div>
</div>
</div>
)
}
}
const mapStateToProps = state => {
return {
departments: state.app.departments
}
}
export default connect(mapStateToProps)(ModalEmployer) | Java |
require 'spec_helper'
describe Character do
before do
@character = Character.new(name: "Walder Frey", page: 'index.html')
end
subject { @character}
it { should respond_to(:name)}
it { should respond_to(:icon)}
it { should respond_to(:page)}
it { should respond_to(:degrees)}
it { should respond_to(:all_relationships)}
it { should respond_to(:children)}
it { should respond_to(:parents)}
it { should respond_to(:relationships)}
it { should respond_to(:reverse_relationships)}
it { should be_valid}
describe "when name is not present" do
before {@character.name = nil}
it {should_not be_valid}
end
describe "when page is not present" do
before {@character.page = nil}
it {should_not be_valid}
end
describe "character with page already exists" do
before do
character_with_same_page = @character.dup
character_with_same_page.page.upcase!
character_with_same_page.save
end
it { should_not be_valid}
end
describe "character relationships" do
before{ @character.save}
let!(:child_character) do
FactoryGirl.create(:character)
end
let!(:relationship) { @character.relationships.build(:child_id => child_character.id)}
it "should display for both" do
expect(@character.all_relationships.to_a).to eq child_character.all_relationships.to_a
end
it "should destroy relationships" do
relationships = @character.relationships.to_a
@character.destroy
expect(relationships).not_to be_empty
relationships.each do |relationship|
expect(Relationship.where(:id => relationship.id)).to be_empty
end
end
end
end
| Java |
package net.sf.jabref.gui.util;
import javafx.concurrent.Task;
/**
* An object that executes submitted {@link Task}s. This
* interface provides a way of decoupling task submission from the
* mechanics of how each task will be run, including details of thread
* use, scheduling, thread pooling, etc.
*/
public interface TaskExecutor {
/**
* Runs the given task.
*
* @param task the task to run
* @param <V> type of return value of the task
*/
<V> void execute(BackgroundTask<V> task);
}
| Java |
require 'test_helper'
class Test45sHelperTest < ActionView::TestCase
end
| Java |
---
author: generalchoa
comments: true
date: 2014-01-31 23:22:32+00:00
layout: post
slug: week13-day35b-beefmode
title: Week13 - Day35B - Beefmode
wordpress_id: 1429
categories:
- B
- StrongLifts
tags:
- agile 8
- deadlift
- dips
- incline db press
- plank
- preacher curls
- push-up
- seated db curls
- shoulder shocker
- squat
- standing bb curls
---
**Weight: **185 lbs ??
**Duration**: 11:45am - 1:02pm ~ 1hr. 17min.
Time recorded is from when I started the pre-workout stretches until I started my post-workout stretches. The Shoulder Shocker felt hugely improved, weights felt light for the first 2 sets. Usually, I'm dying at the end of the second set. Weight on the scale was at 187 this morning! Getting into freshly washed and dried jeans was pretty tough, haha. Legs are getting too beefy from all this squatting.
**Squats: **3x5xBar + 5x115 + 3x145 + 2x165 + 1x185 + 3x5x205
Went down pretty slow to control the bar and prevent tweaking the back. This makes it quite a bit harder since I'm increasing time under the bar. These are getting pretty heavy. Getting close to the magical 225, 2-plate squat. I think I may incorporate some back off sets, very similar to Madcow's heavy day scheme or Wendler's Boring But Big accessory.
**Seated Plate Raises: **3x10x25
**Seated Lateral Raise: **3x10x12
**Seated DB Shrug + Clean + Half Press: **3x10x12
Able to get to the end of the second set without feeling dead. Felt a huge improvement here. Doing the cleaning movement, I'm using a more explosive pull to clean the dumbbells up instead just using all shoulders. It is a clean after all.
**Deadlift: **5x135 + 3x165 + 2x185 + 1x215 + 1x240 + 5x265
Supinated left, regular right. Pretty heavy, kept the bar glued to my shins. Not sure if I was rounding, but my low back wasn't killing me afterwards.
**Accessories:
**Preacher BB Curls: **14x50**
Incline DB Press: **10x50**
Standing EZ Bar Curls: 10x40
Dips: **12**/4/4
Seated DB Curls: **10x30**
Pushups: 10/10/8
Cranked out some extra reps on the 50lb preacher. I think once I get to 18+ reps on the 50, I'm going to jump up. Went up to 50lbs on the incline db press. These were pretty difficult, so definitely sticking to 50s for a while. Dips are still improving, both in strength and endurance. Pushups felt improved today as well. Going to for 3 sets of 10 reps across next time.
**Core:
**Elbow Planks: **1min.**
Burn, baby, burn.
| Java |
package com.mgireesh;
public class Solution extends VersionControl {
public int firstBadVersion(int n) {
int badVersion = 0;
int start = 1;
int end = n;
while (start < end) {
int mid = start + (end - start) / 2;
if (isBadVersion(mid)) {
end = mid;
} else {
start = mid + 1;
}
}
return start;
}
} | Java |
<?php
namespace Aurex\Framework\Module\Modules\FormDoctrineModule;
use Symfony\Bridge\Doctrine\Form\DoctrineOrmExtension,
Silex\Provider\TranslationServiceProvider,
Aurex\Framework\Module\ModuleInterface,
Silex\Provider\SessionServiceProvider,
Silex\Provider\FormServiceProvider,
Aurex\Framework\Aurex;
/**
* Class FormDoctrineModule
*
* @package Aurex\Framework\Module\Modules\FormDoctrineModule
*/
class FormDoctrineModule implements ModuleInterface
{
/**
* {@inheritDoc}
*/
public function integrate(Aurex $aurex)
{
$aurex->register(new FormServiceProvider);
$aurex->register(new SessionServiceProvider);
$aurex->register(new TranslationServiceProvider, [
'locale' => 'en'
]);
$aurex['form.extensions'] = $aurex->extend('form.extensions', function ($extensions, $app) {
$managerRegistry = new FormManagerRegistry(null, [], ['default'], null, null, '\Doctrine\ORM\Proxy\Proxy');
$managerRegistry->setContainer($app);
unset($extensions);
return [(new DoctrineOrmExtension($managerRegistry))];
});
$aurex->getInjector()->share($aurex['form.factory']);
}
/**
* {@inheritDoc}
*/
public function usesConfigurationKey()
{
return null;
}
} | Java |
<html><!-- Created using the cpp_pretty_printer from the dlib C++ library. See http://dlib.net for updates. --><head><title>dlib C++ Library - matrix_expressions_ex.cpp</title></head><body bgcolor='white'><pre>
<font color='#009900'>// The contents of this file are in the public domain. See LICENSE_FOR_EXAMPLE_PROGRAMS.txt
</font>
<font color='#009900'>/*
This example contains a detailed discussion of the template expression
technique used to implement the matrix tools in the dlib C++ library.
It also gives examples showing how a user can create their own custom
matrix expressions.
Note that you should be familiar with the dlib::matrix before reading
this example. So if you haven't done so already you should read the
matrix_ex.cpp example program.
*/</font>
<font color='#0000FF'>#include</font> <font color='#5555FF'><</font>iostream<font color='#5555FF'>></font>
<font color='#0000FF'>#include</font> <font color='#5555FF'><</font>dlib<font color='#5555FF'>/</font>matrix.h<font color='#5555FF'>></font>
<font color='#0000FF'>using</font> <font color='#0000FF'>namespace</font> dlib;
<font color='#0000FF'>using</font> <font color='#0000FF'>namespace</font> std;
<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<font color='#0000FF'><u>void</u></font> <b><a name='custom_matrix_expressions_example'></a>custom_matrix_expressions_example</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<font color='#0000FF'><u>int</u></font> <b><a name='main'></a>main</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>
<b>{</b>
<font color='#009900'>// Declare some variables used below
</font> matrix<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font>,<font color='#979000'>3</font>,<font color='#979000'>1</font><font color='#5555FF'>></font> y;
matrix<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font>,<font color='#979000'>3</font>,<font color='#979000'>3</font><font color='#5555FF'>></font> M;
matrix<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font><font color='#5555FF'>></font> x;
<font color='#009900'>// set all elements to 1
</font> y <font color='#5555FF'>=</font> <font color='#979000'>1</font>;
M <font color='#5555FF'>=</font> <font color='#979000'>1</font>;
<font color='#009900'>// ------------------------- Template Expressions -----------------------------
</font> <font color='#009900'>// Now I will discuss the "template expressions" technique and how it is
</font> <font color='#009900'>// used in the matrix object. First consider the following expression:
</font> x <font color='#5555FF'>=</font> y <font color='#5555FF'>+</font> y;
<font color='#009900'>/*
Normally this expression results in machine code that looks, at a high
level, like the following:
temp = y + y;
x = temp
Temp is a temporary matrix returned by the overloaded + operator.
temp then contains the result of adding y to itself. The assignment
operator copies the value of temp into x and temp is then destroyed while
the blissful C++ user never sees any of this.
This is, however, totally inefficient. In the process described above
you have to pay for the cost of constructing a temporary matrix object
and allocating its memory. Then you pay the additional cost of copying
it over to x. It also gets worse when you have more complex expressions
such as x = round(y + y + y + M*y) which would involve the creation and copying
of 5 temporary matrices.
All these inefficiencies are removed by using the template expressions
technique. The basic idea is as follows, instead of having operators and
functions return temporary matrix objects you return a special object that
represents the expression you wish to perform.
So consider the expression x = y + y again. With dlib::matrix what happens
is the expression y+y returns a matrix_exp object instead of a temporary matrix.
The construction of a matrix_exp does not allocate any memory or perform any
computations. The matrix_exp however has an interface that looks just like a
dlib::matrix object and when you ask it for the value of one of its elements
it computes that value on the spot. Only in the assignment operator does
someone ask the matrix_exp for these values so this avoids the use of any
temporary matrices. Thus the statement x = y + y is equivalent to the following
code:
// loop over all elements in y matrix
for (long r = 0; r < y.nr(); ++r)
for (long c = 0; c < y.nc(); ++c)
x(r,c) = y(r,c) + y(r,c);
This technique works for expressions of arbitrary complexity. So if you
typed x = round(y + y + y + M*y) it would involve no temporary matrices being
created at all. Each operator takes and returns only matrix_exp objects.
Thus, no computations are performed until the assignment operator requests
the values from the matrix_exp it receives as input.
There is, however, a slight complication in all of this. It is for statements
that involve the multiplication of a complex matrix_exp such as the following:
*/</font>
x <font color='#5555FF'>=</font> M<font color='#5555FF'>*</font><font face='Lucida Console'>(</font>M<font color='#5555FF'>+</font>M<font color='#5555FF'>+</font>M<font color='#5555FF'>+</font>M<font color='#5555FF'>+</font>M<font color='#5555FF'>+</font>M<font color='#5555FF'>+</font>M<font face='Lucida Console'>)</font>;
<font color='#009900'>/*
According to the discussion above, this statement would compute the value of
M*(M+M+M+M+M+M+M) totally without any temporary matrix objects. This sounds
good but we should take a closer look. Consider that the + operator is
invoked 6 times. This means we have something like this:
x = M * (matrix_exp representing M+M+M+M+M+M+M);
M is being multiplied with a quite complex matrix_exp. Now recall that when
you ask a matrix_exp what the value of any of its elements are it computes
their values *right then*.
If you think on what is involved in performing a matrix multiply you will
realize that each element of a matrix is accessed M.nr() times. In the
case of our above expression the cost of accessing an element of the
matrix_exp on the right hand side is the cost of doing 6 addition operations.
Thus, it would be faster to assign M+M+M+M+M+M+M to a temporary matrix and then
multiply that by M. This is exactly what the dlib::matrix does under the covers.
This is because it is able to spot expressions where the introduction of a
temporary is needed to speed up the computation and it will automatically do this
for you.
Another complication that is dealt with automatically is aliasing. All matrix
expressions are said to "alias" their contents. For example, consider
the following expressions:
M + M
M * M
We say that the expressions (M + M) and (M * M) alias M. Additionally, we say that
the expression (M * M) destructively aliases M.
To understand why we say (M * M) destructively aliases M consider what would happen
if we attempted to evaluate it without first assigning (M * M) to a temporary matrix.
That is, if we attempted to perform the following:
for (long r = 0; r < M.nr(); ++r)
for (long c = 0; c < M.nc(); ++c)
M(r,c) = rowm(M,r)*colm(M,c);
It is clear that the result would be corrupted and M wouldn't end up with the right
values in it. So in this case we must perform the following:
temp = M*M;
M = temp;
This sort of interaction is what defines destructive aliasing. Whenever we are
assigning a matrix expression to a destination that is destructively aliased by
the expression we need to introduce a temporary. The dlib::matrix is capable of
recognizing the two forms of aliasing and introduces temporary matrices only when
necessary.
*/</font>
<font color='#009900'>// Next we discuss how to create custom matrix expressions. In what follows we
</font> <font color='#009900'>// will define three different matrix expressions and show their use.
</font> <font color='#BB00BB'>custom_matrix_expressions_example</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#009900'>// ----------------------------------------------------------------------------------------
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> M<font color='#5555FF'>></font>
<font color='#0000FF'>struct</font> <b><a name='example_op_trans'></a>example_op_trans</b>
<b>{</b>
<font color='#009900'>/*!
This object defines a matrix expression that represents a transposed matrix.
As discussed above, constructing this object doesn't compute anything. It just
holds a reference to a matrix and presents an interface which defines
matrix transposition.
!*/</font>
<font color='#009900'>// Here we simply hold a reference to the matrix we are supposed to be the transpose of.
</font> <b><a name='example_op_trans'></a>example_op_trans</b><font face='Lucida Console'>(</font> <font color='#0000FF'>const</font> M<font color='#5555FF'>&</font> m_<font face='Lucida Console'>)</font> : m<font face='Lucida Console'>(</font>m_<font face='Lucida Console'>)</font><b>{</b><b>}</b>
<font color='#0000FF'>const</font> M<font color='#5555FF'>&</font> m;
<font color='#009900'>// The cost field is used by matrix multiplication code to decide if a temporary needs to
</font> <font color='#009900'>// be introduced. It represents the computational cost of evaluating an element of the
</font> <font color='#009900'>// matrix expression. In this case we say that the cost of obtaining an element of the
</font> <font color='#009900'>// transposed matrix is the same as obtaining an element of the original matrix (since
</font> <font color='#009900'>// transpose doesn't really compute anything).
</font> <font color='#0000FF'>const</font> <font color='#0000FF'>static</font> <font color='#0000FF'><u>long</u></font> cost <font color='#5555FF'>=</font> M::cost;
<font color='#009900'>// Here we define the matrix expression's compile-time known dimensions. Since this
</font> <font color='#009900'>// is a transpose we define them to be the reverse of M's dimensions.
</font> <font color='#0000FF'>const</font> <font color='#0000FF'>static</font> <font color='#0000FF'><u>long</u></font> NR <font color='#5555FF'>=</font> M::NC;
<font color='#0000FF'>const</font> <font color='#0000FF'>static</font> <font color='#0000FF'><u>long</u></font> NC <font color='#5555FF'>=</font> M::NR;
<font color='#009900'>// Define the type of element in this matrix expression. Also define the
</font> <font color='#009900'>// memory manager type used and the layout. Usually we use the same types as the
</font> <font color='#009900'>// input matrix.
</font> <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> M::type type;
<font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> M::mem_manager_type mem_manager_type;
<font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> M::layout_type layout_type;
<font color='#009900'>// This is where the action is. This function is what defines the value of an element of
</font> <font color='#009900'>// this matrix expression. Here we are saying that m(c,r) == trans(m)(r,c) which is just
</font> <font color='#009900'>// the definition of transposition. Note also that we must define the return type from this
</font> <font color='#009900'>// function as a typedef. This typedef lets us either return our argument by value or by
</font> <font color='#009900'>// reference. In this case we use the same type as the underlying m matrix. Later in this
</font> <font color='#009900'>// example program you will see two other options.
</font> <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> M::const_ret_type const_ret_type;
const_ret_type <b><a name='apply'></a>apply</b> <font face='Lucida Console'>(</font><font color='#0000FF'><u>long</u></font> r, <font color='#0000FF'><u>long</u></font> c<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>return</font> <font color='#BB00BB'>m</font><font face='Lucida Console'>(</font>c,r<font face='Lucida Console'>)</font>; <b>}</b>
<font color='#009900'>// Define the run-time defined dimensions of this matrix.
</font> <font color='#0000FF'><u>long</u></font> <b><a name='nr'></a>nr</b> <font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>return</font> m.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <b>}</b>
<font color='#0000FF'><u>long</u></font> <b><a name='nc'></a>nc</b> <font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>return</font> m.<font color='#BB00BB'>nr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <b>}</b>
<font color='#009900'>// Recall the discussion of aliasing. Each matrix expression needs to define what
</font> <font color='#009900'>// kind of aliasing it introduces so that we know when to introduce temporaries. The
</font> <font color='#009900'>// aliases() function indicates that the matrix transpose expression aliases item if
</font> <font color='#009900'>// and only if the m matrix aliases item.
</font> <font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> U<font color='#5555FF'>></font> <font color='#0000FF'><u>bool</u></font> <b><a name='aliases'></a>aliases</b> <font face='Lucida Console'>(</font> <font color='#0000FF'>const</font> matrix_exp<font color='#5555FF'><</font>U<font color='#5555FF'>></font><font color='#5555FF'>&</font> item<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>return</font> m.<font color='#BB00BB'>aliases</font><font face='Lucida Console'>(</font>item<font face='Lucida Console'>)</font>; <b>}</b>
<font color='#009900'>// This next function indicates that the matrix transpose expression also destructively
</font> <font color='#009900'>// aliases anything m aliases. I.e. transpose has destructive aliasing.
</font> <font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> U<font color='#5555FF'>></font> <font color='#0000FF'><u>bool</u></font> <b><a name='destructively_aliases'></a>destructively_aliases</b> <font face='Lucida Console'>(</font> <font color='#0000FF'>const</font> matrix_exp<font color='#5555FF'><</font>U<font color='#5555FF'>></font><font color='#5555FF'>&</font> item<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>return</font> m.<font color='#BB00BB'>aliases</font><font face='Lucida Console'>(</font>item<font face='Lucida Console'>)</font>; <b>}</b>
<b>}</b>;
<font color='#009900'>// Here we define a simple function that creates and returns transpose expressions. Note that the
</font><font color='#009900'>// matrix_op<> template is a matrix_exp object and exists solely to reduce the amount of boilerplate
</font><font color='#009900'>// you have to write to create a matrix expression.
</font><font color='#0000FF'>template</font> <font color='#5555FF'><</font> <font color='#0000FF'>typename</font> M <font color='#5555FF'>></font>
<font color='#0000FF'>const</font> matrix_op<font color='#5555FF'><</font>example_op_trans<font color='#5555FF'><</font>M<font color='#5555FF'>></font> <font color='#5555FF'>></font> <b><a name='example_trans'></a>example_trans</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> matrix_exp<font color='#5555FF'><</font>M<font color='#5555FF'>></font><font color='#5555FF'>&</font> m
<font face='Lucida Console'>)</font>
<b>{</b>
<font color='#0000FF'>typedef</font> example_op_trans<font color='#5555FF'><</font>M<font color='#5555FF'>></font> op;
<font color='#009900'>// m.ref() returns a reference to the object of type M contained in the matrix expression m.
</font> <font color='#0000FF'>return</font> matrix_op<font color='#5555FF'><</font>op<font color='#5555FF'>></font><font face='Lucida Console'>(</font><font color='#BB00BB'>op</font><font face='Lucida Console'>(</font>m.<font color='#BB00BB'>ref</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>></font>
<font color='#0000FF'>struct</font> <b><a name='example_op_vector_to_matrix'></a>example_op_vector_to_matrix</b>
<b>{</b>
<font color='#009900'>/*!
This object defines a matrix expression that holds a reference to a std::vector<T>
and makes it look like a column vector. Thus it enables you to use a std::vector
as if it was a dlib::matrix.
!*/</font>
<b><a name='example_op_vector_to_matrix'></a>example_op_vector_to_matrix</b><font face='Lucida Console'>(</font> <font color='#0000FF'>const</font> std::vector<font color='#5555FF'><</font>T<font color='#5555FF'>></font><font color='#5555FF'>&</font> vect_<font face='Lucida Console'>)</font> : vect<font face='Lucida Console'>(</font>vect_<font face='Lucida Console'>)</font><b>{</b><b>}</b>
<font color='#0000FF'>const</font> std::vector<font color='#5555FF'><</font>T<font color='#5555FF'>></font><font color='#5555FF'>&</font> vect;
<font color='#009900'>// This expression wraps direct memory accesses so we use the lowest possible cost.
</font> <font color='#0000FF'>const</font> <font color='#0000FF'>static</font> <font color='#0000FF'><u>long</u></font> cost <font color='#5555FF'>=</font> <font color='#979000'>1</font>;
<font color='#0000FF'>const</font> <font color='#0000FF'>static</font> <font color='#0000FF'><u>long</u></font> NR <font color='#5555FF'>=</font> <font color='#979000'>0</font>; <font color='#009900'>// We don't know the length of the vector until runtime. So we put 0 here.
</font> <font color='#0000FF'>const</font> <font color='#0000FF'>static</font> <font color='#0000FF'><u>long</u></font> NC <font color='#5555FF'>=</font> <font color='#979000'>1</font>; <font color='#009900'>// We do know that it only has one column (since it's a vector)
</font> <font color='#0000FF'>typedef</font> T type;
<font color='#009900'>// Since the std::vector doesn't use a dlib memory manager we list the default one here.
</font> <font color='#0000FF'>typedef</font> default_memory_manager mem_manager_type;
<font color='#009900'>// The layout type also doesn't really matter in this case. So we list row_major_layout
</font> <font color='#009900'>// since it is a good default.
</font> <font color='#0000FF'>typedef</font> row_major_layout layout_type;
<font color='#009900'>// Note that we define const_ret_type to be a reference type. This way we can
</font> <font color='#009900'>// return the contents of the std::vector by reference.
</font> <font color='#0000FF'>typedef</font> <font color='#0000FF'>const</font> T<font color='#5555FF'>&</font> const_ret_type;
const_ret_type <b><a name='apply'></a>apply</b> <font face='Lucida Console'>(</font><font color='#0000FF'><u>long</u></font> r, <font color='#0000FF'><u>long</u></font> <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>return</font> vect[r]; <b>}</b>
<font color='#0000FF'><u>long</u></font> <b><a name='nr'></a>nr</b> <font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>return</font> vect.<font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <b>}</b>
<font color='#0000FF'><u>long</u></font> <b><a name='nc'></a>nc</b> <font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>return</font> <font color='#979000'>1</font>; <b>}</b>
<font color='#009900'>// This expression never aliases anything since it doesn't contain any matrix expression (it
</font> <font color='#009900'>// contains only a std::vector which doesn't count since you can't assign a matrix expression
</font> <font color='#009900'>// to a std::vector object).
</font> <font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> U<font color='#5555FF'>></font> <font color='#0000FF'><u>bool</u></font> <b><a name='aliases'></a>aliases</b> <font face='Lucida Console'>(</font> <font color='#0000FF'>const</font> matrix_exp<font color='#5555FF'><</font>U<font color='#5555FF'>></font><font color='#5555FF'>&</font> <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>return</font> <font color='#979000'>false</font>; <b>}</b>
<font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> U<font color='#5555FF'>></font> <font color='#0000FF'><u>bool</u></font> <b><a name='destructively_aliases'></a>destructively_aliases</b> <font face='Lucida Console'>(</font> <font color='#0000FF'>const</font> matrix_exp<font color='#5555FF'><</font>U<font color='#5555FF'>></font><font color='#5555FF'>&</font> <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>return</font> <font color='#979000'>false</font>; <b>}</b>
<b>}</b>;
<font color='#0000FF'>template</font> <font color='#5555FF'><</font> <font color='#0000FF'>typename</font> T <font color='#5555FF'>></font>
<font color='#0000FF'>const</font> matrix_op<font color='#5555FF'><</font>example_op_vector_to_matrix<font color='#5555FF'><</font>T<font color='#5555FF'>></font> <font color='#5555FF'>></font> <b><a name='example_vector_to_matrix'></a>example_vector_to_matrix</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> std::vector<font color='#5555FF'><</font>T<font color='#5555FF'>></font><font color='#5555FF'>&</font> vector
<font face='Lucida Console'>)</font>
<b>{</b>
<font color='#0000FF'>typedef</font> example_op_vector_to_matrix<font color='#5555FF'><</font>T<font color='#5555FF'>></font> op;
<font color='#0000FF'>return</font> matrix_op<font color='#5555FF'><</font>op<font color='#5555FF'>></font><font face='Lucida Console'>(</font><font color='#BB00BB'>op</font><font face='Lucida Console'>(</font>vector<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> M, <font color='#0000FF'>typename</font> T<font color='#5555FF'>></font>
<font color='#0000FF'>struct</font> <b><a name='example_op_add_scalar'></a>example_op_add_scalar</b>
<b>{</b>
<font color='#009900'>/*!
This object defines a matrix expression that represents a matrix with a single
scalar value added to all its elements.
!*/</font>
<b><a name='example_op_add_scalar'></a>example_op_add_scalar</b><font face='Lucida Console'>(</font> <font color='#0000FF'>const</font> M<font color='#5555FF'>&</font> m_, <font color='#0000FF'>const</font> T<font color='#5555FF'>&</font> val_<font face='Lucida Console'>)</font> : m<font face='Lucida Console'>(</font>m_<font face='Lucida Console'>)</font>, val<font face='Lucida Console'>(</font>val_<font face='Lucida Console'>)</font><b>{</b><b>}</b>
<font color='#009900'>// A reference to the matrix
</font> <font color='#0000FF'>const</font> M<font color='#5555FF'>&</font> m;
<font color='#009900'>// A copy of the scalar value that should be added to each element of m
</font> <font color='#0000FF'>const</font> T val;
<font color='#009900'>// This time we add 1 to the cost since evaluating an element of this
</font> <font color='#009900'>// expression means performing 1 addition operation.
</font> <font color='#0000FF'>const</font> <font color='#0000FF'>static</font> <font color='#0000FF'><u>long</u></font> cost <font color='#5555FF'>=</font> M::cost <font color='#5555FF'>+</font> <font color='#979000'>1</font>;
<font color='#0000FF'>const</font> <font color='#0000FF'>static</font> <font color='#0000FF'><u>long</u></font> NR <font color='#5555FF'>=</font> M::NR;
<font color='#0000FF'>const</font> <font color='#0000FF'>static</font> <font color='#0000FF'><u>long</u></font> NC <font color='#5555FF'>=</font> M::NC;
<font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> M::type type;
<font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> M::mem_manager_type mem_manager_type;
<font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> M::layout_type layout_type;
<font color='#009900'>// Note that we declare const_ret_type to be a non-reference type. This is important
</font> <font color='#009900'>// since apply() computes a new temporary value and thus we can't return a reference
</font> <font color='#009900'>// to it.
</font> <font color='#0000FF'>typedef</font> type const_ret_type;
const_ret_type <b><a name='apply'></a>apply</b> <font face='Lucida Console'>(</font><font color='#0000FF'><u>long</u></font> r, <font color='#0000FF'><u>long</u></font> c<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>return</font> <font color='#BB00BB'>m</font><font face='Lucida Console'>(</font>r,c<font face='Lucida Console'>)</font> <font color='#5555FF'>+</font> val; <b>}</b>
<font color='#0000FF'><u>long</u></font> <b><a name='nr'></a>nr</b> <font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>return</font> m.<font color='#BB00BB'>nr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <b>}</b>
<font color='#0000FF'><u>long</u></font> <b><a name='nc'></a>nc</b> <font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>return</font> m.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <b>}</b>
<font color='#009900'>// This expression aliases anything m aliases.
</font> <font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> U<font color='#5555FF'>></font> <font color='#0000FF'><u>bool</u></font> <b><a name='aliases'></a>aliases</b> <font face='Lucida Console'>(</font> <font color='#0000FF'>const</font> matrix_exp<font color='#5555FF'><</font>U<font color='#5555FF'>></font><font color='#5555FF'>&</font> item<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>return</font> m.<font color='#BB00BB'>aliases</font><font face='Lucida Console'>(</font>item<font face='Lucida Console'>)</font>; <b>}</b>
<font color='#009900'>// Unlike the transpose expression. This expression only destructively aliases something if m does.
</font> <font color='#009900'>// So this expression has the regular non-destructive kind of aliasing.
</font> <font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> U<font color='#5555FF'>></font> <font color='#0000FF'><u>bool</u></font> <b><a name='destructively_aliases'></a>destructively_aliases</b> <font face='Lucida Console'>(</font> <font color='#0000FF'>const</font> matrix_exp<font color='#5555FF'><</font>U<font color='#5555FF'>></font><font color='#5555FF'>&</font> item<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>return</font> m.<font color='#BB00BB'>destructively_aliases</font><font face='Lucida Console'>(</font>item<font face='Lucida Console'>)</font>; <b>}</b>
<b>}</b>;
<font color='#0000FF'>template</font> <font color='#5555FF'><</font> <font color='#0000FF'>typename</font> M, <font color='#0000FF'>typename</font> T <font color='#5555FF'>></font>
<font color='#0000FF'>const</font> matrix_op<font color='#5555FF'><</font>example_op_add_scalar<font color='#5555FF'><</font>M,T<font color='#5555FF'>></font> <font color='#5555FF'>></font> <b><a name='add_scalar'></a>add_scalar</b> <font face='Lucida Console'>(</font>
<font color='#0000FF'>const</font> matrix_exp<font color='#5555FF'><</font>M<font color='#5555FF'>></font><font color='#5555FF'>&</font> m,
T val
<font face='Lucida Console'>)</font>
<b>{</b>
<font color='#0000FF'>typedef</font> example_op_add_scalar<font color='#5555FF'><</font>M,T<font color='#5555FF'>></font> op;
<font color='#0000FF'>return</font> matrix_op<font color='#5555FF'><</font>op<font color='#5555FF'>></font><font face='Lucida Console'>(</font><font color='#BB00BB'>op</font><font face='Lucida Console'>(</font>m.<font color='#BB00BB'>ref</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>, val<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
<b>}</b>
<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<font color='#0000FF'><u>void</u></font> <b><a name='custom_matrix_expressions_example'></a>custom_matrix_expressions_example</b><font face='Lucida Console'>(</font>
<font face='Lucida Console'>)</font>
<b>{</b>
matrix<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font><font color='#5555FF'>></font> <font color='#BB00BB'>x</font><font face='Lucida Console'>(</font><font color='#979000'>2</font>,<font color='#979000'>3</font><font face='Lucida Console'>)</font>;
x <font color='#5555FF'>=</font> <font color='#979000'>1</font>, <font color='#979000'>1</font>, <font color='#979000'>1</font>,
<font color='#979000'>2</font>, <font color='#979000'>2</font>, <font color='#979000'>2</font>;
cout <font color='#5555FF'><</font><font color='#5555FF'><</font> x <font color='#5555FF'><</font><font color='#5555FF'><</font> endl;
<font color='#009900'>// Finally, lets use the matrix expressions we defined above.
</font>
<font color='#009900'>// prints the transpose of x
</font> cout <font color='#5555FF'><</font><font color='#5555FF'><</font> <font color='#BB00BB'>example_trans</font><font face='Lucida Console'>(</font>x<font face='Lucida Console'>)</font> <font color='#5555FF'><</font><font color='#5555FF'><</font> endl;
<font color='#009900'>// prints this:
</font> <font color='#009900'>// 11 11 11
</font> <font color='#009900'>// 12 12 12
</font> cout <font color='#5555FF'><</font><font color='#5555FF'><</font> <font color='#BB00BB'>add_scalar</font><font face='Lucida Console'>(</font>x, <font color='#979000'>10</font><font face='Lucida Console'>)</font> <font color='#5555FF'><</font><font color='#5555FF'><</font> endl;
<font color='#009900'>// matrix expressions can be nested, even the user defined ones.
</font> <font color='#009900'>// the following statement prints this:
</font> <font color='#009900'>// 11 12
</font> <font color='#009900'>// 11 12
</font> <font color='#009900'>// 11 12
</font> cout <font color='#5555FF'><</font><font color='#5555FF'><</font> <font color='#BB00BB'>example_trans</font><font face='Lucida Console'>(</font><font color='#BB00BB'>add_scalar</font><font face='Lucida Console'>(</font>x, <font color='#979000'>10</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font> <font color='#5555FF'><</font><font color='#5555FF'><</font> endl;
<font color='#009900'>// Since we setup the alias detection correctly we can even do this:
</font> x <font color='#5555FF'>=</font> <font color='#BB00BB'>example_trans</font><font face='Lucida Console'>(</font><font color='#BB00BB'>add_scalar</font><font face='Lucida Console'>(</font>x, <font color='#979000'>10</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
cout <font color='#5555FF'><</font><font color='#5555FF'><</font> "<font color='#CC0000'>new x:\n</font>" <font color='#5555FF'><</font><font color='#5555FF'><</font> x <font color='#5555FF'><</font><font color='#5555FF'><</font> endl;
cout <font color='#5555FF'><</font><font color='#5555FF'><</font> "<font color='#CC0000'>Do some testing with the example_vector_to_matrix() function: </font>" <font color='#5555FF'><</font><font color='#5555FF'><</font> endl;
std::vector<font color='#5555FF'><</font><font color='#0000FF'><u>float</u></font><font color='#5555FF'>></font> vect;
vect.<font color='#BB00BB'>push_back</font><font face='Lucida Console'>(</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>;
vect.<font color='#BB00BB'>push_back</font><font face='Lucida Console'>(</font><font color='#979000'>3</font><font face='Lucida Console'>)</font>;
vect.<font color='#BB00BB'>push_back</font><font face='Lucida Console'>(</font><font color='#979000'>5</font><font face='Lucida Console'>)</font>;
<font color='#009900'>// Now lets treat our std::vector like a matrix and print some things.
</font> cout <font color='#5555FF'><</font><font color='#5555FF'><</font> <font color='#BB00BB'>example_vector_to_matrix</font><font face='Lucida Console'>(</font>vect<font face='Lucida Console'>)</font> <font color='#5555FF'><</font><font color='#5555FF'><</font> endl;
cout <font color='#5555FF'><</font><font color='#5555FF'><</font> <font color='#BB00BB'>add_scalar</font><font face='Lucida Console'>(</font><font color='#BB00BB'>example_vector_to_matrix</font><font face='Lucida Console'>(</font>vect<font face='Lucida Console'>)</font>, <font color='#979000'>10</font><font face='Lucida Console'>)</font> <font color='#5555FF'><</font><font color='#5555FF'><</font> endl;
<font color='#009900'>/*
As an aside, note that dlib contains functions equivalent to the ones we
defined above. They are:
- dlib::trans()
- dlib::mat() (converts things into matrices)
- operator+ (e.g. you can say my_mat + 1)
Also, if you are going to be creating your own matrix expression you should also
look through the matrix code in the dlib/matrix folder. There you will find
many other examples of matrix expressions.
*/</font>
<b>}</b>
<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
</pre></body></html> | Java |
define('exports@*', [], function(require, exports, module){
exports.a = 1;
}); | Java |
package types
// ApiVersion custom ENUM for SDK forward compatibility
type ApiVersion int
const (
ApiV1 ApiVersion = iota
)
// EnvironmentType
// https://docs.coinapi.io/#endpoints-2
type EnvironmentType int
const (
ProdEncrypted EnvironmentType = iota
ProdInsecure
TestEncrypted
TestInsecure
)
// MessageType replicates the official incoming message types as (kinda) string enum.
// https://docs.coinapi.io/#messages
type MessageType string
const (
TRADE MessageType = "trade"
QUOTE MessageType = "quote"
BOOK_L2_FULL MessageType = "book" // Orderbook L2 (Full)
BOOK_L2_TOP_5 MessageType = "book5" // Orderbook L2 (5 best Bid / Ask)
BOOK_L2_TOP_20 MessageType = "book20" // Orderbook L2 (20 best Bid / Ask)
BOOK_L2_TOP_50 MessageType = "book50" // Orderbook L2 (50 best Bid / Ask)
BOOK_L3_FULL MessageType = "book_l3" // Orderbook L3 (Full) https://docs.coinapi.io/#orderbook-l3-full-in
OHLCV MessageType = "ohlcv"
VOLUME MessageType = "volume"
HEARTBEAT MessageType = "hearbeat" // DO NOT FIX! it's a typo in the official msg spec!
ERROR MessageType = "error" // Otherwise processMessage(.) fails to handle heartbeat messages!
EXCHANGERATE MessageType = "exrate"
RECONNECT MessageType = "reconnect"
)
// ReconnectType defines the reconnect behavior upon receiving a reconnect message
// https://docs.coinapi.io/#reconnect-in
type ReconnectType int
const (
OnConnectionClose ReconnectType = iota
OnReconnectMessage
)
| Java |
require 'rubygems'
require 'bundler'
Bundler.require
require 'sinatra'
set :public_folder, 'static'
get '/' do
File.read(File.join('index.html'))
end
get '/api/' do
#content_type :js
content_type("application/javascript")
response["Content-Type"] = "application/javascript"
#require 'config/initializers/beamly.rb'
root = ::File.dirname(__FILE__)
require ::File.join( root, 'config', 'initializers', 'beamly' )
#require 'config/initializers/beamly'
z = Beamly::Epg.new
region_id = z.regions.first.id
provider_id = z.providers.first.id
result = z.catalogues(region_id, provider_id)
services = z.epg(result.first.epg_id)
today = Date.today.strftime("%Y/%m/%d")
schedule = z.schedule(services[8].service_id, today)
today_formatted = Date.today.strftime("%Y-%m-%d")
headers "Content-Type" => "application/json"
json = '['
schedule.each do |item|
time_formatted = Time.at(item.start).getlocal.strftime("%Y-%m-%d %H:%M")
json += '
{
"date": "'+time_formatted+'",
"episodes":
[
{
"show": {
"title": "'+item.title+'",
"year": 2013,
"genres": ["Comedy"],
},
"episode":{"images": {"screen": "http://img-a.zeebox.com/940x505/'+item.img+'"}}
}
]
},
'
end
json += ']'
formatted_callback = "#{params['callback']}("+json+')'
content_type("application/javascript")
response["Content-Type"] = "application/javascript"
formatted_callback
end
| Java |
using System.Threading.Tasks;
using FluentAssertions;
using Histrio.Testing;
using Xunit;
namespace Histrio.Tests.Cell
{
public class When_getting_a_value_from_a_cell : GivenWhenThen
{
[Theory,
InlineData(true),
InlineData(333),
InlineData(new[] {true, true}),
InlineData("foo")]
public void Then_value_the_cell_is_holding_on_to_is_returned<T>(T expectedValue)
{
var theater = new Theater();
var taskCompletionSource = new TaskCompletionSource<Reply<T>>();
;
Address customer = null;
Address cell = null;
Given(() =>
{
cell = theater.CreateActor(new CellBehavior<T>());
var set = new Set<T>(expectedValue);
theater.Dispatch(set, cell);
customer = theater.CreateActor(new AssertionBehavior<Reply<T>>(taskCompletionSource, 1));
});
When(() =>
{
var get = new Get(customer);
theater.Dispatch(get, cell);
});
Then(async () =>
{
var actualValue = await taskCompletionSource.Task;
actualValue.Content.ShouldBeEquivalentTo(expectedValue);
});
}
}
} | Java |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class oscilation : MonoBehaviour {
public float m_speed = 0.008f;
public int m_distance = 45;
private int compteur = 0;
private int compteur2 = 0;
// Use this for initialization
void Start () {
Vector3 yOrigin = transform.localPosition;
/*Vector3 move = new Vector3(0.0f,0.0f,0.0f);
Vector3 move2 = new Vector3(0.0f,0.0f,0.0f);
move.y = m_speed;
move2.y = -m_speed;*/
}
// Update is called once per frame
void Update () {
if (compteur < m_distance) {
Vector3 move = new Vector3(0.0f,0.0f,0.0f);
move.y = m_speed;
transform.localPosition = transform.localPosition + move;
compteur++;
} else if (compteur2 < m_distance) {
Vector3 move2 = new Vector3(0.0f,0.0f,0.0f);
move2.y = -m_speed;
compteur2++;
transform.localPosition = transform.localPosition + move2;
} else {
compteur = 0;
compteur2 = 0;
}
}
}
| Java |
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Threading.Tasks;
using System.Net;
using System.Web;
using System.Web.Mvc;
using Transit.Models;
namespace Transit.Controllers
{
public class RoutesController : Controller
{
private ApplicationDbContext db = new ApplicationDbContext();
// GET: Routes
public async Task<ActionResult> Index()
{
var routes = db.Routes.Include(r => r.agency).Include(r => r.type);
return View(await routes.ToListAsync());
}
// GET: Routes/Details/5
public async Task<ActionResult> Details(int? id)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
Route route = await db.Routes.FindAsync(id);
if (route == null)
{
return HttpNotFound();
}
return View(route);
}
// GET: Routes/Create
public ActionResult Create()
{
ViewBag.agencyId = new SelectList(db.Agencies, "id", "name");
ViewBag.typeId = new SelectList(db.RouteTypes, "id", "label");
return View();
}
// POST: Routes/Create
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<ActionResult> Create([Bind(Include = "id,agencyId,label,fullName,description,typeId,url,color,textColor")] Route route)
{
if (ModelState.IsValid)
{
db.Routes.Add(route);
await db.SaveChangesAsync();
return RedirectToAction("Index");
}
ViewBag.agencyId = new SelectList(db.Agencies, "id", "name", route.agencyId);
ViewBag.typeId = new SelectList(db.RouteTypes, "id", "label", route.typeId);
return View(route);
}
// GET: Routes/Edit/5
public async Task<ActionResult> Edit(int? id)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
Route route = await db.Routes.FindAsync(id);
if (route == null)
{
return HttpNotFound();
}
ViewBag.agencyId = new SelectList(db.Agencies, "id", "name", route.agencyId);
ViewBag.typeId = new SelectList(db.RouteTypes, "id", "label", route.typeId);
return View(route);
}
// POST: Routes/Edit/5
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<ActionResult> Edit([Bind(Include = "id,agencyId,label,fullName,description,typeId,url,color,textColor")] Route route)
{
if (ModelState.IsValid)
{
db.Entry(route).State = EntityState.Modified;
await db.SaveChangesAsync();
return RedirectToAction("Index");
}
ViewBag.agencyId = new SelectList(db.Agencies, "id", "name", route.agencyId);
ViewBag.typeId = new SelectList(db.RouteTypes, "id", "label", route.typeId);
return View(route);
}
// GET: Routes/Delete/5
public async Task<ActionResult> Delete(int? id)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
Route route = await db.Routes.FindAsync(id);
if (route == null)
{
return HttpNotFound();
}
return View(route);
}
// POST: Routes/Delete/5
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<ActionResult> DeleteConfirmed(int id)
{
Route route = await db.Routes.FindAsync(id);
db.Routes.Remove(route);
await db.SaveChangesAsync();
return RedirectToAction("Index");
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
db.Dispose();
}
base.Dispose(disposing);
}
}
}
| Java |
/*
* This file is part of LuckPerms, licensed under the MIT License.
*
* Copyright (c) lucko (Luck) <luck@lucko.me>
* Copyright (c) contributors
*
* 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.
*/
package me.lucko.luckperms.nukkit.inject.server;
import me.lucko.luckperms.nukkit.LPNukkitPlugin;
import cn.nukkit.Server;
import cn.nukkit.permission.Permissible;
import cn.nukkit.plugin.PluginManager;
import java.lang.reflect.Field;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
/**
* Injects a {@link LuckPermsSubscriptionMap} into the {@link PluginManager}.
*/
public class InjectorSubscriptionMap implements Runnable {
private static final Field PERM_SUBS_FIELD;
static {
Field permSubsField = null;
try {
permSubsField = PluginManager.class.getDeclaredField("permSubs");
permSubsField.setAccessible(true);
} catch (Exception e) {
// ignore
}
PERM_SUBS_FIELD = permSubsField;
}
private final LPNukkitPlugin plugin;
public InjectorSubscriptionMap(LPNukkitPlugin plugin) {
this.plugin = plugin;
}
@Override
public void run() {
try {
LuckPermsSubscriptionMap subscriptionMap = inject();
if (subscriptionMap != null) {
this.plugin.setSubscriptionMap(subscriptionMap);
}
} catch (Exception e) {
this.plugin.getLogger().severe("Exception occurred whilst injecting LuckPerms Permission Subscription map.", e);
}
}
private LuckPermsSubscriptionMap inject() throws Exception {
Objects.requireNonNull(PERM_SUBS_FIELD, "PERM_SUBS_FIELD");
PluginManager pluginManager = this.plugin.getBootstrap().getServer().getPluginManager();
Object map = PERM_SUBS_FIELD.get(pluginManager);
if (map instanceof LuckPermsSubscriptionMap) {
if (((LuckPermsSubscriptionMap) map).plugin == this.plugin) {
return null;
}
map = ((LuckPermsSubscriptionMap) map).detach();
}
//noinspection unchecked
Map<String, Set<Permissible>> castedMap = (Map<String, Set<Permissible>>) map;
// make a new subscription map & inject it
LuckPermsSubscriptionMap newMap = new LuckPermsSubscriptionMap(this.plugin, castedMap);
PERM_SUBS_FIELD.set(pluginManager, newMap);
return newMap;
}
public static void uninject() {
try {
Objects.requireNonNull(PERM_SUBS_FIELD, "PERM_SUBS_FIELD");
PluginManager pluginManager = Server.getInstance().getPluginManager();
Object map = PERM_SUBS_FIELD.get(pluginManager);
if (map instanceof LuckPermsSubscriptionMap) {
LuckPermsSubscriptionMap lpMap = (LuckPermsSubscriptionMap) map;
PERM_SUBS_FIELD.set(pluginManager, lpMap.detach());
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
| Java |
jQuery(document).ready(function(){
jQuery('.carousel').carousel()
var FPS = 30;
var player = $('#player')
var pWidth = player.width();
$window = $(window)
var wWidth = $window.width();
setInterval(function() {
update();
}, 1000/FPS);
function update() {
if(keydown.space) {
player.shoot();
}
if(keydown.left) {
console.log('go left')
player.css('left', '-=10');
}
if(keydown.right) {
console.log('go right')
var x = player.position().left;
if(x + pWidth > wWidth)
{
player.css('left', '0')
}
else if(x < 0 )
{
var p = wWidth + x - pWidth;
var t = p + 'px'
player.css('left', t)
}
else {
player.css('left', '+=10');
}
}
}
$('')
})
| Java |
/// <reference path="tsUnit.ts" />
/// <reference path="MockExpression.ts" />
/// <reference path="../src/EventBinding.ts" />
module jsBind {
private fireEvent(elem: any): void {
if (document.createEventObject) {
// IE 9 & 10
var event: any = document.createEventObject();
event.eventType = "onclick";
elem.fireEvent("onclick", event);
} else if (dispatchEvent) {
// For DOM
var evt = document.createEvent("HTMLEvents");
evt.initEvent("click", false, true);
elem.dispatchEvent(evt);
} else {
// IE 8-
elem.fireEvent("onclick");
}
}
export class EventBindingTests {
public testEvaluate(c: tsUnit.TestContext): void {
var elem: any = document.getElementById("Results");
var expr = new MockExpression(42);
var binding = new EventBinding(elem, "click", expr, null, null);
binding.evaluate();
fireEvent(elem);
c.isTrue(expr.wasEvaluated);
}
public testDispose(c: tsUnit.TestContext): void {
var elem: any = document.getElementById("Results");
var expr = new MockExpression(42);
var binding = new EventBinding(elem, "click", expr, null, null);
binding.evaluate();
// Check the dispose occurs
binding.dispose();
c.isTrue(expr.isDisposed);
fireEvent(elem);
c.isFalse(expr.wasEvaluated);
}
}
} | Java |
// Copyright (c) 2015 The original author or authors
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
#if UNITY_EDITOR
using SpriterDotNet;
using System;
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEngine;
namespace SpriterDotNetUnity
{
public class SpriterImporter : AssetPostprocessor
{
private static readonly string[] ScmlExtensions = new string[] { ".scml" };
private static readonly float DeltaZ = -0.001f;
private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromPath)
{
foreach (string asset in importedAssets)
{
if (!IsScml(asset)) continue;
CreateSpriter(asset);
}
foreach (string asset in deletedAssets)
{
if (!IsScml(asset)) continue;
}
for (int i = 0; i < movedAssets.Length; i++)
{
string asset = movedAssets[i];
if (!IsScml(asset)) continue;
}
}
private static bool IsScml(string path)
{
return ScmlExtensions.Any(path.EndsWith);
}
private static void CreateSpriter(string path)
{
string data = File.ReadAllText(path);
Spriter spriter = SpriterParser.Parse(data);
string rootFolder = Path.GetDirectoryName(path);
foreach (SpriterEntity entity in spriter.Entities)
{
GameObject go = new GameObject();
go.name = entity.Name;
SpriterDotNetBehaviour sdnBehaviour = go.AddComponent<SpriterDotNetBehaviour>();
sdnBehaviour.Entity = entity;
sdnBehaviour.enabled = true;
LoadSprites(sdnBehaviour, spriter, rootFolder);
CreateChildren(entity, sdnBehaviour, spriter, go);
string prefabPath = rootFolder + "/" + entity.Name + ".prefab";
PrefabUtility.CreatePrefab(prefabPath, go, ReplacePrefabOptions.ConnectToPrefab);
GameObject.DestroyImmediate(go);
}
}
private static void CreateChildren(SpriterEntity entity, SpriterDotNetBehaviour sdnBehaviour, Spriter spriter, GameObject parent)
{
int maxObjects = 0;
foreach (SpriterAnimation animation in entity.Animations)
{
foreach (SpriterMainLineKey mainKey in animation.MainlineKeys)
{
maxObjects = Math.Max(maxObjects, mainKey.ObjectRefs.Length);
}
}
sdnBehaviour.Children = new GameObject[maxObjects];
sdnBehaviour.Pivots = new GameObject[maxObjects];
for (int i = 0; i < maxObjects; ++i)
{
GameObject pivot = new GameObject();
GameObject child = new GameObject();
sdnBehaviour.Pivots[i] = pivot;
sdnBehaviour.Children[i] = child;
pivot.transform.SetParent(parent.transform);
child.transform.SetParent(pivot.transform);
child.transform.localPosition = new Vector3(0, 0, DeltaZ * i);
pivot.name = "pivot " + i;
child.name = "child " + i;
child.AddComponent<SpriteRenderer>();
}
}
private static void LoadSprites(SpriterDotNetBehaviour sdnBehaviour, Spriter spriter, string rootFolder)
{
sdnBehaviour.Folders = new SdnFolder[spriter.Folders.Length];
for (int i = 0; i < spriter.Folders.Length; ++i)
{
SpriterFolder folder = spriter.Folders[i];
SdnFolder sdnFolder = new SdnFolder();
sdnFolder.Files = new Sprite[folder.Files.Length];
sdnBehaviour.Folders[i] = sdnFolder;
for (int j = 0; j < folder.Files.Length; ++j)
{
SpriterFile file = folder.Files[j];
string spritePath = rootFolder;
spritePath += "/";
spritePath += file.Name;
Sprite sprite = AssetDatabase.LoadAssetAtPath<Sprite>(spritePath);
if (sprite == null)
{
Debug.LogWarning("Unable to load sprite: " + spritePath);
continue;
}
sdnFolder.Files[j] = sprite;
}
}
}
}
}
#endif
| Java |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import base64
import json
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
from behave import *
@step('I share first element in the history list')
def step_impl(context):
context.execute_steps(u'''
given I open History dialog
''')
history = context.browser.find_element_by_id("HistoryPopup")
entries = history.find_elements_by_xpath('.//li[not(@data-clone-template)]')
assert len(entries) > 0, "There are no entries in the history"
item = entries[0]
item.find_elements_by_xpath('.//*[@data-share-item]')[0].click()
@then('the json to share is shown with url "{url}" and contains the following headers')
def step_impl(context, url):
# Wait for modal to appear
WebDriverWait(context.browser, 10).until(
expected_conditions.visibility_of_element_located(
(By.ID, 'ShareRequestForm')))
output = context.browser.execute_script("return restman.ui.editors.get('#ShareRequestEditor').getValue();")
snippet = json.loads(output)
assert url == snippet["url"], "URL: \"{}\" not in output.\nOutput: {}".format(value, output)
for row in context.table:
assert row['key'] in snippet['headers'], "Header {} is not in output".format(row['key'])
assert row['value'] == snippet['headers'][row['key']], "Header value is not correct. Expected: {}; Actual: {}".format(value, snippet['headers'][name])
@step('I click on import request')
def step_impl(context):
context.execute_steps(u'''
given I open History dialog
''')
# Click on import
context.browser.find_element_by_id('ImportHistory').click()
WebDriverWait(context.browser, 10).until(
expected_conditions.visibility_of_element_located(
(By.ID, 'ImportRequestForm')))
@step('I write a shared request for "{url}"')
def step_impl(context, url):
req = json.dumps({
"method": "POST",
"url": url,
"headers": {
"Content-Type": "application/json",
"X-Test-Header": "shared_request"
},
"body": {
"type": "form",
"content": {
"SomeKey": "SomeValue11233",
"SomeOtherKey": "SomeOtherValue019",
}
}
})
context.browser.execute_script("return restman.ui.editors.setValue('#ImportRequestEditor', atob('{}'));".format(base64.b64encode(req)))
@step('I click on load import request')
def step_impl(context):
# Import request
context.browser.find_element_by_xpath("//*[@id='ImportRequestForm']//input[@value='Import']").click()
| Java |
---
layout: link
type: link
link: https://www.bloomberg.com/news/articles/2019-11-05/why-indonesia-failed-to-cash-in-on-the-china-u-s-trade-war
title: "Bloomberg: Why Indonesia Failed to Cash in on the China-U.S. Trade War"
category: links
tags:
- life
- "daily found"
- development
- indonesia
categories: dailyfound
published: true
comments: true
---
Dengan adanya perang dagang antara Amerika dan Tiongkok, banyak berimbas terhadap industri-industri yang ada didua negara itu, dan beberapa negara di asia tenggara bisa mengambil untung dari kondisi itu.
Sebut Vietnam, Thailand, banyak investor yang mengalihkan investasinya ke negara tersebut, alasan kenapa Indonesia tidak begitu besar terkena imbasnya.
<!--more-->
> The reasons for the poor performance are well documented: inadequate infrastructure, particularly in transport; rigid labor rules; limits on how much foreigners can invest in several industries; bureaucratic red tape and a habit of backtracking on regulations that makes it tricky to do business in the country.
Memang sangat berbelit investasi di sini, belum lagi kondisi pekerjanya yang terhitung mahal, belum juga preman-preman, ditambah isu investor asing yang berkonotasi negatif, pemerintah dianggap menjual negara ini ke asing, padahal membuka investasi.
Membangun infrastuktur yang bisa dijadikan pendukung pemerataan usaha, juga mempermudah transportasi sehingga atraktif untuk investor, tapi tetap itu dianggap sebagai suatu pemborosan.
Ada juga kalimat andalan "Negara ini kaya, masa *gak* bisa mengambil untung dari itu? tidak butuh asing untuk mengelola", dan ucapan-ucapan sejenis, yang mana tentu itu keluar dari ketidak tahuan akan kondisi, seperti penonton bola, biasanya penonton bola lebih pintar dari pemainnya, yang latihan 10 jam sehari, kalau gagal gol akan dibilang bodoh oleh penonton budiman.
Sama seperti warga yang mengomentari pemerintah, merasa lebih pintar. | Java |
import { entryPoint } from '@rpgjs/standalone'
import globalConfigClient from './config/client'
import globalConfigServer from './config/server'
import modules from './modules'
document.addEventListener('DOMContentLoaded', function() {
entryPoint(modules, {
globalConfigClient,
globalConfigServer
}).start()
}) | Java |
/* Copyright (c) MediaArea.net SARL. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license that can
* be found in the License.html file in the root of the source tree.
*/
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// Elements part
//
// Contributor: Lionel Duchateau, kurtnoise@free.fr
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//---------------------------------------------------------------------------
// Pre-compilation
#include "MediaInfo/PreComp.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#include "MediaInfo/Setup.h"
#include <ZenLib/Ztring.h>
#include <string>
using namespace std;
using namespace ZenLib;
//---------------------------------------------------------------------------
//***************************************************************************
// Infos
//***************************************************************************
//---------------------------------------------------------------------------
#if defined(MEDIAINFO_RIFF_YES) || defined(MEDIAINFO_MK_YES)
//---------------------------------------------------------------------------
namespace MediaInfoLib
{
//---------------------------------------------------------------------------
std::string ExtensibleWave_ChannelMask (int32u ChannelMask)
{
std::string Text;
if ((ChannelMask&0x0007)!=0x0000)
Text+="Front:";
if (ChannelMask&0x0001)
Text+=" L";
if (ChannelMask&0x0004)
Text+=" C";
if (ChannelMask&0x0002)
Text+=" R";
if ((ChannelMask&0x0600)!=0x0000)
Text+=", Side:";
if (ChannelMask&0x0200)
Text+=" L";
if (ChannelMask&0x0400)
Text+=" R";
if ((ChannelMask&0x0130)!=0x0000)
Text+=", Back:";
if (ChannelMask&0x0010)
Text+=" L";
if (ChannelMask&0x0100)
Text+=" C";
if (ChannelMask&0x0020)
Text+=" R";
if ((ChannelMask&0x0008)!=0x0000)
Text+=", LFE";
return Text;
}
//---------------------------------------------------------------------------
std::string ExtensibleWave_ChannelMask2 (int32u ChannelMask)
{
std::string Text;
int8u Count=0;
if (ChannelMask&0x0001)
Count++;
if (ChannelMask&0x0004)
Count++;
if (ChannelMask&0x0002)
Count++;
Text+=Ztring::ToZtring(Count).To_UTF8();
Count=0;
if (ChannelMask&0x0200)
Count++;
if (ChannelMask&0x0400)
Count++;
Text+="/"+Ztring::ToZtring(Count).To_UTF8();
Count=0;
if (ChannelMask&0x0010)
Count++;
if (ChannelMask&0x0100)
Count++;
if (ChannelMask&0x0020)
Count++;
Text+="/"+Ztring::ToZtring(Count).To_UTF8();
Count=0;
if (ChannelMask&0x0008)
Text+=".1";
return Text;
}
}
//---------------------------------------------------------------------------
#endif
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#ifdef MEDIAINFO_RIFF_YES
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#include "MediaInfo/Multiple/File_Riff.h"
#if defined(MEDIAINFO_DVDIF_YES)
#include "MediaInfo/Multiple/File_DvDif.h"
#endif
#if defined(MEDIAINFO_OGG_YES)
#include "MediaInfo/Multiple/File_Ogg.h"
#include "MediaInfo/Multiple/File_Ogg_SubElement.h"
#endif
#if defined(MEDIAINFO_FFV1_YES)
#include "MediaInfo/Video/File_Ffv1.h"
#endif
#if defined(MEDIAINFO_HUFFYUV_YES)
#include "MediaInfo/Video/File_HuffYuv.h"
#endif
#if defined(MEDIAINFO_MPEG4V_YES)
#include "MediaInfo/Video/File_Mpeg4v.h"
#endif
#if defined(MEDIAINFO_MPEGV_YES)
#include "MediaInfo/Video/File_Mpegv.h"
#endif
#if defined(MEDIAINFO_PRORES_YES)
#include "MediaInfo/Video/File_ProRes.h"
#endif
#if defined(MEDIAINFO_AVC_YES)
#include "MediaInfo/Video/File_Avc.h"
#endif
#if defined(MEDIAINFO_CANOPUS_YES)
#include "MediaInfo/Video/File_Canopus.h"
#endif
#if defined(MEDIAINFO_FRAPS_YES)
#include "MediaInfo/Video/File_Fraps.h"
#endif
#if defined(MEDIAINFO_LAGARITH_YES)
#include "MediaInfo/Video/File_Lagarith.h"
#endif
#if defined(MEDIAINFO_MPEGA_YES)
#include "MediaInfo/Audio/File_Mpega.h"
#endif
#if defined(MEDIAINFO_AAC_YES)
#include "MediaInfo/Audio/File_Aac.h"
#endif
#if defined(MEDIAINFO_AC3_YES)
#include "MediaInfo/Audio/File_Ac3.h"
#endif
#if defined(MEDIAINFO_DTS_YES)
#include "MediaInfo/Audio/File_Dts.h"
#endif
#if defined(MEDIAINFO_JPEG_YES)
#include "MediaInfo/Image/File_Jpeg.h"
#endif
#if defined(MEDIAINFO_SUBRIP_YES)
#include "MediaInfo/Text/File_SubRip.h"
#endif
#if defined(MEDIAINFO_OTHERTEXT_YES)
#include "MediaInfo/Text/File_OtherText.h"
#endif
#if defined(MEDIAINFO_ADPCM_YES)
#include "MediaInfo/Audio/File_Adpcm.h"
#endif
#if defined(MEDIAINFO_PCM_YES)
#include "MediaInfo/Audio/File_Pcm.h"
#endif
#if defined(MEDIAINFO_SMPTEST0337_YES)
#include "MediaInfo/Audio/File_SmpteSt0337.h"
#endif
#if defined(MEDIAINFO_ID3_YES)
#include "MediaInfo/Tag/File_Id3.h"
#endif
#if defined(MEDIAINFO_ID3V2_YES)
#include "MediaInfo/Tag/File_Id3v2.h"
#endif
#if defined(MEDIAINFO_GXF_YES)
#if defined(MEDIAINFO_CDP_YES)
#include "MediaInfo/Text/File_Cdp.h"
#include <cstring>
#endif
#endif //MEDIAINFO_GXF_YES
#include <vector>
#include "MediaInfo/MediaInfo_Config_MediaInfo.h"
using namespace std;
//---------------------------------------------------------------------------
namespace MediaInfoLib
{
//***************************************************************************
// Const
//***************************************************************************
namespace Elements
{
const int32u FORM=0x464F524D;
const int32u LIST=0x4C495354;
const int32u ON2_=0x4F4E3220;
const int32u RIFF=0x52494646;
const int32u RF64=0x52463634;
const int32u AIFC=0x41494643;
const int32u AIFC_COMM=0x434F4D4D;
const int32u AIFC_COMT=0x434F4D54;
const int32u AIFC_FVER=0x46564552;
const int32u AIFC_SSND=0x53534E44;
const int32u AIFF=0x41494646;
const int32u AIFF_COMM=0x434F4D4D;
const int32u AIFF_COMT=0x434F4D54;
const int32u AIFF_SSND=0x53534E44;
const int32u AIFF__c__=0x28632920;
const int32u AIFF_ANNO=0x414E4E4F;
const int32u AIFF_AUTH=0x41555448;
const int32u AIFF_NAME=0x4E414D45;
const int32u AIFF_ID3_=0x49443320;
const int32u AVI_=0x41564920;
const int32u AVI__cset=0x63736574;
const int32u AVI__Cr8r=0x43723872;
const int32u AVI__exif=0x65786966;
const int32u AVI__exif_ecor=0x65636F72;
const int32u AVI__exif_emdl=0x656D646C;
const int32u AVI__exif_emnt=0x656D6E74;
const int32u AVI__exif_erel=0x6572656C;
const int32u AVI__exif_etim=0x6574696D;
const int32u AVI__exif_eucm=0x6575636D;
const int32u AVI__exif_ever=0x65766572;
const int32u AVI__goog=0x676F6F67;
const int32u AVI__goog_GDAT=0x47444154;
const int32u AVI__GMET=0x474D4554;
const int32u AVI__hdlr=0x6864726C;
const int32u AVI__hdlr_avih=0x61766968;
const int32u AVI__hdlr_JUNK=0x4A554E4B;
const int32u AVI__hdlr_strl=0x7374726C;
const int32u AVI__hdlr_strl_indx=0x696E6478;
const int32u AVI__hdlr_strl_JUNK=0x4A554E4B;
const int32u AVI__hdlr_strl_strd=0x73747264;
const int32u AVI__hdlr_strl_strf=0x73747266;
const int32u AVI__hdlr_strl_strh=0x73747268;
const int32u AVI__hdlr_strl_strh_auds=0x61756473;
const int32u AVI__hdlr_strl_strh_iavs=0x69617673;
const int32u AVI__hdlr_strl_strh_mids=0x6D696473;
const int32u AVI__hdlr_strl_strh_vids=0x76696473;
const int32u AVI__hdlr_strl_strh_txts=0x74787473;
const int32u AVI__hdlr_strl_strn=0x7374726E;
const int32u AVI__hdlr_strl_vprp=0x76707270;
const int32u AVI__hdlr_odml=0x6F646D6C;
const int32u AVI__hdlr_odml_dmlh=0x646D6C68;
const int32u AVI__hdlr_ON2h=0x4F4E3268;
const int32u AVI__idx1=0x69647831;
const int32u AVI__INFO=0x494E464F;
const int32u AVI__INFO_IARL=0x4941524C;
const int32u AVI__INFO_IART=0x49415254;
const int32u AVI__INFO_IAS1=0x49415331;
const int32u AVI__INFO_IAS2=0x49415332;
const int32u AVI__INFO_IAS3=0x49415333;
const int32u AVI__INFO_IAS4=0x49415334;
const int32u AVI__INFO_IAS5=0x49415335;
const int32u AVI__INFO_IAS6=0x49415336;
const int32u AVI__INFO_IAS7=0x49415337;
const int32u AVI__INFO_IAS8=0x49415338;
const int32u AVI__INFO_IAS9=0x49415339;
const int32u AVI__INFO_ICDS=0x49434453;
const int32u AVI__INFO_ICMS=0x49434D53;
const int32u AVI__INFO_ICMT=0x49434D54;
const int32u AVI__INFO_ICNT=0x49434E54;
const int32u AVI__INFO_ICOP=0x49434F50;
const int32u AVI__INFO_ICNM=0x49434E4D;
const int32u AVI__INFO_ICRD=0x49435244;
const int32u AVI__INFO_ICRP=0x49435250;
const int32u AVI__INFO_IDIM=0x4944494D;
const int32u AVI__INFO_IDIT=0x49444954;
const int32u AVI__INFO_IDPI=0x49445049;
const int32u AVI__INFO_IDST=0x49445354;
const int32u AVI__INFO_IEDT=0x49454454;
const int32u AVI__INFO_IENG=0x49454E47;
const int32u AVI__INFO_IFRM=0x4946524D;
const int32u AVI__INFO_IGNR=0x49474E52;
const int32u AVI__INFO_IID3=0x49494433;
const int32u AVI__INFO_IKEY=0x494B4559;
const int32u AVI__INFO_ILGT=0x494C4754;
const int32u AVI__INFO_ILNG=0x494C4E47;
const int32u AVI__INFO_ILYC=0x494C5943;
const int32u AVI__INFO_IMED=0x494D4544;
const int32u AVI__INFO_IMP3=0x494D5033;
const int32u AVI__INFO_IMUS=0x494D5553;
const int32u AVI__INFO_INAM=0x494E414D;
const int32u AVI__INFO_IPLT=0x49504C54;
const int32u AVI__INFO_IPDS=0x49504453;
const int32u AVI__INFO_IPRD=0x49505244;
const int32u AVI__INFO_IPRT=0x49505254;
const int32u AVI__INFO_IPRO=0x4950524F;
const int32u AVI__INFO_IRTD=0x49525444;
const int32u AVI__INFO_ISBJ=0x4953424A;
const int32u AVI__INFO_ISGN=0x4953474E;
const int32u AVI__INFO_ISTD=0x49535444;
const int32u AVI__INFO_ISTR=0x49535452;
const int32u AVI__INFO_ISFT=0x49534654;
const int32u AVI__INFO_ISHP=0x49534850;
const int32u AVI__INFO_ISMP=0x49534D50;
const int32u AVI__INFO_ISRC=0x49535243;
const int32u AVI__INFO_ISRF=0x49535246;
const int32u AVI__INFO_ITCH=0x49544348;
const int32u AVI__INFO_IWEB=0x49574542;
const int32u AVI__INFO_IWRI=0x49575249;
const int32u AVI__INFO_JUNK=0x4A554E4B;
const int32u AVI__JUNK=0x4A554E4B;
const int32u AVI__MD5_=0x4D443520;
const int32u AVI__movi=0x6D6F7669;
const int32u AVI__movi_rec_=0x72656320;
const int32u AVI__movi_xxxx_____=0x00005F5F;
const int32u AVI__movi_xxxx___db=0x00006462;
const int32u AVI__movi_xxxx___dc=0x00006463;
const int32u AVI__movi_xxxx___sb=0x00007362;
const int32u AVI__movi_xxxx___tx=0x00007478;
const int32u AVI__movi_xxxx___wb=0x00007762;
const int32u AVI__PrmA=0x50726D41;
const int32u AVI__Tdat=0x54646174;
const int32u AVI__Tdat_rn_A=0x726E5F41;
const int32u AVI__Tdat_rn_O=0x726E5F4F;
const int32u AVI__Tdat_tc_A=0x74635F41;
const int32u AVI__Tdat_tc_O=0x74635F4F;
const int32u AVIX=0x41564958;
const int32u AVIX_idx1=0x69647831;
const int32u AVIX_movi=0x6D6F7669;
const int32u AVIX_movi_rec_=0x72656320;
const int32u CADP=0x43414450;
const int32u CDDA=0x43444441;
const int32u CDDA_fmt_=0x666D7420;
const int32u CMJP=0x434D4A50;
const int32u CMP4=0x434D5034;
const int32u IDVX=0x49445658;
const int32u INDX=0x494E4458;
const int32u JUNK=0x4A554E4B;
const int32u menu=0x6D656E75;
const int32u MThd=0x4D546864;
const int32u MTrk=0x4D54726B;
const int32u PAL_=0x50414C20;
const int32u QLCM=0x514C434D;
const int32u QLCM_fmt_=0x666D7420;
const int32u rcrd=0x72637264;
const int32u rcrd_desc=0x64657363;
const int32u rcrd_fld_=0x666C6420;
const int32u rcrd_fld__anc_=0x616E6320;
const int32u rcrd_fld__anc__pos_=0x706F7320;
const int32u rcrd_fld__anc__pyld=0x70796C64;
const int32u rcrd_fld__finf=0x66696E66;
const int32u RDIB=0x52444942;
const int32u RMID=0x524D4944;
const int32u RMMP=0x524D4D50;
const int32u RMP3=0x524D5033;
const int32u RMP3_data=0x64617461;
const int32u RMP3_INFO=0x494E464F;
const int32u RMP3_INFO_IID3=0x49494433;
const int32u RMP3_INFO_ILYC=0x494C5943;
const int32u RMP3_INFO_IMP3=0x494D5033;
const int32u RMP3_INFO_JUNK=0x4A554E4B;
const int32u SMV0=0x534D5630;
const int32u SMV0_xxxx=0x534D563A;
const int32u WAVE=0x57415645;
const int32u WAVE__pmx=0x20786D70;
const int32u WAVE_aXML=0x61584D4C;
const int32u WAVE_bext=0x62657874;
const int32u WAVE_cue_=0x63756520;
const int32u WAVE_data=0x64617461;
const int32u WAVE_ds64=0x64733634;
const int32u WAVE_fact=0x66616374;
const int32u WAVE_fmt_=0x666D7420;
const int32u WAVE_ID3_=0x49443320;
const int32u WAVE_id3_=0x69643320;
const int32u WAVE_INFO=0x494E464F;
const int32u WAVE_iXML=0x69584D4C;
const int32u wave=0x77617665;
const int32u wave_data=0x64617461;
const int32u wave_fmt_=0x666D7420;
const int32u W3DI=0x57334449;
#define UUID(NAME, PART1, PART2, PART3, PART4, PART5) \
const int64u NAME =0x##PART3##PART2##PART1##ULL; \
const int64u NAME##2=0x##PART4##PART5##ULL; \
UUID(QLCM_QCELP1, 5E7F6D41, B115, 11D0, BA91, 00805FB4B97E)
UUID(QLCM_QCELP2, 5E7F6D42, B115, 11D0, BA91, 00805FB4B97E)
UUID(QLCM_EVRC, E689D48D, 9076, 46B5, 91EF, 736A5100CEB4)
UUID(QLCM_SMV, 8D7C2B75, A797, ED49, 985E, D53C8CC75F84)
}
//***************************************************************************
// Format
//***************************************************************************
//---------------------------------------------------------------------------
void File_Riff::Data_Parse()
{
//Alignement specific
Element_Size-=Alignement_ExtraByte;
DATA_BEGIN
LIST(AIFC)
ATOM_BEGIN
ATOM(AIFC_COMM)
ATOM(AIFC_COMT)
ATOM(AIFC_FVER)
ATOM(AIFC_SSND)
ATOM_DEFAULT(AIFC_xxxx)
ATOM_END_DEFAULT
LIST(AIFF)
ATOM_BEGIN
ATOM(AIFF_COMM)
ATOM(AIFF_COMT)
ATOM(AIFF_ID3_)
LIST_SKIP(AIFF_SSND)
ATOM_DEFAULT(AIFF_xxxx)
ATOM_END_DEFAULT
LIST(AVI_)
ATOM_BEGIN
ATOM(AVI__Cr8r);
ATOM(AVI__cset)
LIST(AVI__exif)
ATOM_DEFAULT_ALONE(AVI__exif_xxxx)
LIST(AVI__goog)
ATOM_BEGIN
ATOM(AVI__goog_GDAT)
ATOM_END
ATOM(AVI__GMET)
LIST(AVI__hdlr)
ATOM_BEGIN
ATOM(AVI__hdlr_avih)
ATOM(AVI__hdlr_JUNK)
LIST(AVI__hdlr_strl)
ATOM_BEGIN
ATOM(AVI__hdlr_strl_indx)
ATOM(AVI__hdlr_strl_JUNK)
ATOM(AVI__hdlr_strl_strd)
ATOM(AVI__hdlr_strl_strf)
ATOM(AVI__hdlr_strl_strh)
ATOM(AVI__hdlr_strl_strn)
ATOM(AVI__hdlr_strl_vprp)
ATOM_END
LIST(AVI__hdlr_odml)
ATOM_BEGIN
ATOM(AVI__hdlr_odml_dmlh)
ATOM_END
ATOM(AVI__hdlr_ON2h)
LIST(AVI__INFO)
ATOM_BEGIN
ATOM(AVI__INFO_IID3)
ATOM(AVI__INFO_ILYC)
ATOM(AVI__INFO_IMP3)
ATOM(AVI__INFO_JUNK)
ATOM_DEFAULT(AVI__INFO_xxxx)
ATOM_END_DEFAULT
ATOM_DEFAULT(AVI__hdlr_xxxx)
ATOM_END_DEFAULT
ATOM(AVI__idx1)
LIST(AVI__INFO)
ATOM_BEGIN
ATOM(AVI__INFO_IID3)
ATOM(AVI__INFO_ILYC)
ATOM(AVI__INFO_IMP3)
ATOM(AVI__INFO_JUNK)
ATOM_DEFAULT(AVI__INFO_xxxx)
ATOM_END_DEFAULT
ATOM(AVI__JUNK)
ATOM(AVI__MD5_)
LIST(AVI__movi)
ATOM_BEGIN
LIST(AVI__movi_rec_)
ATOM_DEFAULT_ALONE(AVI__movi_xxxx)
ATOM_DEFAULT(AVI__movi_xxxx)
ATOM_END_DEFAULT
ATOM(AVI__PrmA);
LIST(AVI__Tdat)
ATOM_BEGIN
ATOM(AVI__Tdat_rn_A)
ATOM(AVI__Tdat_rn_O)
ATOM(AVI__Tdat_tc_A)
ATOM(AVI__Tdat_tc_O)
ATOM_END
ATOM_DEFAULT(AVI__xxxx)
ATOM_END_DEFAULT
LIST(AVIX) //OpenDML
ATOM_BEGIN
ATOM(AVIX_idx1)
LIST(AVIX_movi)
ATOM_BEGIN
LIST(AVIX_movi_rec_)
ATOM_DEFAULT_ALONE(AVIX_movi_xxxx)
ATOM_DEFAULT(AVIX_movi_xxxx)
ATOM_END_DEFAULT
ATOM_END
ATOM_PARTIAL(CADP)
LIST(CDDA)
ATOM_BEGIN
ATOM(CDDA_fmt_)
ATOM_END
ATOM_PARTIAL(CMJP)
ATOM(CMP4)
ATOM(IDVX)
LIST(INDX)
ATOM_DEFAULT_ALONE(INDX_xxxx)
LIST_SKIP(JUNK)
LIST_SKIP(menu)
ATOM(MThd)
LIST_SKIP(MTrk)
LIST_SKIP(PAL_)
LIST(QLCM)
ATOM_BEGIN
ATOM(QLCM_fmt_)
ATOM_END
#if defined(MEDIAINFO_GXF_YES)
LIST(rcrd)
ATOM_BEGIN
ATOM(rcrd_desc)
LIST(rcrd_fld_)
ATOM_BEGIN
LIST(rcrd_fld__anc_)
ATOM_BEGIN
ATOM(rcrd_fld__anc__pos_)
ATOM(rcrd_fld__anc__pyld)
ATOM_END
ATOM(rcrd_fld__finf)
ATOM_END
ATOM_END
#endif //defined(MEDIAINFO_GXF_YES)
LIST_SKIP(RDIB)
LIST_SKIP(RMID)
LIST_SKIP(RMMP)
LIST(RMP3)
ATOM_BEGIN
LIST(RMP3_data)
break;
LIST(RMP3_INFO)
ATOM_BEGIN
ATOM(RMP3_INFO_IID3)
ATOM(RMP3_INFO_ILYC)
ATOM(RMP3_INFO_IMP3)
ATOM(RMP3_INFO_JUNK)
ATOM_DEFAULT(RMP3_INFO_xxxx)
ATOM_END_DEFAULT
ATOM_END
ATOM(SMV0)
ATOM(SMV0_xxxx)
ATOM(W3DI)
LIST(WAVE)
ATOM_BEGIN
ATOM(WAVE__pmx)
ATOM(WAVE_aXML)
ATOM(WAVE_bext)
LIST(WAVE_data)
break;
ATOM(WAVE_cue_)
ATOM(WAVE_ds64)
ATOM(WAVE_fact)
ATOM(WAVE_fmt_)
ATOM(WAVE_ID3_)
ATOM(WAVE_id3_)
LIST(WAVE_INFO)
ATOM_DEFAULT_ALONE(WAVE_INFO_xxxx)
ATOM(WAVE_iXML)
ATOM_END
LIST(wave)
ATOM_BEGIN
LIST(wave_data)
break;
ATOM(wave_fmt_)
ATOM_END
DATA_END
if (Alignement_ExtraByte)
{
Element_Size+=Alignement_ExtraByte;
if (Element_Offset+Alignement_ExtraByte==Element_Size)
Skip_XX(Alignement_ExtraByte, "Alignement");
}
}
//***************************************************************************
// Elements
//***************************************************************************
//---------------------------------------------------------------------------
void File_Riff::AIFC()
{
Data_Accept("AIFF Compressed");
Element_Name("AIFF Compressed");
//Filling
Fill(Stream_General, 0, General_Format, "AIFF");
Stream_Prepare(Stream_Audio);
Kind=Kind_Aiff;
#if MEDIAINFO_EVENTS
StreamIDs_Width[0]=0;
#endif //MEDIAINFO_EVENTS
}
//---------------------------------------------------------------------------
void File_Riff::AIFC_COMM()
{
AIFF_COMM();
}
//---------------------------------------------------------------------------
void File_Riff::AIFC_COMT()
{
AIFF_COMT();
}
//---------------------------------------------------------------------------
void File_Riff::AIFC_FVER()
{
Element_Name("Format Version");
//Parsing
Skip_B4( "Version");
}
//---------------------------------------------------------------------------
void File_Riff::AIFC_SSND()
{
AIFF_SSND();
}
//---------------------------------------------------------------------------
void File_Riff::AIFC_xxxx()
{
AIFF_xxxx();
}
//---------------------------------------------------------------------------
void File_Riff::AIFF()
{
Data_Accept("AIFF");
Element_Name("AIFF");
//Filling
Fill(Stream_General, 0, General_Format, "AIFF");
Stream_Prepare(Stream_Audio);
Kind=Kind_Aiff;
#if MEDIAINFO_EVENTS
StreamIDs_Width[0]=0;
#endif //MEDIAINFO_EVENTS
}
//---------------------------------------------------------------------------
void File_Riff::AIFF_COMM()
{
Element_Name("Common");
int32u numSampleFrames;
int16u numChannels, sampleSize;
float80 sampleRate;
//Parsing
Get_B2 (numChannels, "numChannels");
Get_B4 (numSampleFrames, "numSampleFrames");
Get_B2 (sampleSize, "sampleSize");
Get_BF10(sampleRate, "sampleRate");
if (Data_Remain()) //AIFC
{
int32u compressionType;
Get_C4 (compressionType, "compressionType");
Skip_PA( "compressionName");
//Filling
CodecID_Fill(Ztring().From_CC4(compressionType), Stream_Audio, StreamPos_Last, InfoCodecID_Format_Mpeg4);
Fill(Stream_Audio, StreamPos_Last, Audio_Codec, Ztring().From_CC4(compressionType));
}
else
{
//Filling
Fill(Stream_Audio, StreamPos_Last, Audio_Format, "PCM");
Fill(Stream_Audio, StreamPos_Last, Audio_Codec, "PCM");
}
//Filling
Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, numChannels);
Fill(Stream_Audio, StreamPos_Last, Audio_BitDepth, sampleSize);
if (sampleRate)
Fill(Stream_Audio, StreamPos_Last, Audio_Duration, numSampleFrames/sampleRate*1000);
Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, sampleRate, 0);
//Compute the current codec ID
Element_Code=(int64u)-1;
Stream_ID=(int32u)-1;
stream_Count=1;
//Specific cases
#if defined(MEDIAINFO_SMPTEST0337_YES)
if (Retrieve(Stream_Audio, 0, Audio_CodecID).empty() && numChannels==2 && sampleSize<=32 && sampleRate==48000) //Some SMPTE ST 337 streams are hidden in PCM stream
{
File_SmpteSt0337* Parser=new File_SmpteSt0337;
Parser->Endianness='B';
Parser->Container_Bits=(int8u)sampleSize;
Parser->ShouldContinueParsing=true;
#if MEDIAINFO_DEMUX
if (Config->Demux_Unpacketize_Get())
{
Parser->Demux_Level=2; //Container
Parser->Demux_UnpacketizeContainer=true;
Demux_Level=4; //Intermediate
}
#endif //MEDIAINFO_DEMUX
Stream[Stream_ID].Parsers.push_back(Parser);
}
#endif
stream& StreamItem = Stream[Stream_ID];
#if defined(MEDIAINFO_PCM_YES)
File_Pcm* Parser=new File_Pcm;
Parser->Codec=Retrieve(Stream_Audio, StreamPos_Last, Audio_CodecID);
if (Parser->Codec.empty() || Parser->Codec==__T("NONE"))
Parser->Endianness='B';
Parser->BitDepth=(int8u)sampleSize;
#if MEDIAINFO_DEMUX
if (Demux_Rate)
Parser->Frame_Count_Valid = float64_int64s(Demux_Rate);
if (Config->Demux_Unpacketize_Get())
{
Parser->Demux_Level=2; //Container
Parser->Demux_UnpacketizeContainer=true;
Demux_Level=4; //Intermediate
}
#else //MEDIAINFO_DEMUX
Parser->Frame_Count_Valid=(int64u)-1; //Disabling it, waiting for SMPTE ST 337 parser reject
#endif //MEDIAINFO_DEMUX
StreamItem.Parsers.push_back(Parser);
StreamItem.IsPcm=true;
StreamItem.StreamKind=Stream_Audio;
#endif
#if MEDIAINFO_DEMUX
BlockAlign=numChannels*sampleSize/8;
AvgBytesPerSec=(int32u)float64_int64s(BlockAlign*(float64)sampleRate);
#endif //MEDIAINFO_DEMUX
Element_Code=(int64u)-1;
Open_Buffer_Init_All();
}
//---------------------------------------------------------------------------
void File_Riff::AIFF_COMT()
{
//Parsing
int16u numComments;
Get_B2(numComments, "numComments");
for (int16u Pos=0; Pos<=numComments; Pos++)
{
Ztring text;
int16u count;
Element_Begin1("Comment");
Skip_B4( "timeStamp");
Skip_B4( "marker");
Get_B2 (count, "count");
count+=count%1; //always even
Get_Local(count, text, "text");
Element_End0();
//Filling
Fill(Stream_General, 0, General_Comment, text);
}
}
//---------------------------------------------------------------------------
void File_Riff::AIFF_SSND()
{
WAVE_data();
}
//---------------------------------------------------------------------------
void File_Riff::AIFF_SSND_Continue()
{
WAVE_data_Continue();
}
//---------------------------------------------------------------------------
void File_Riff::AIFF_xxxx()
{
#define ELEMENT_CASE(_ELEMENT, _NAME) \
case Elements::_ELEMENT : Element_Name(_NAME); Name=_NAME; break;
//Known?
std::string Name;
switch(Element_Code)
{
ELEMENT_CASE(AIFF__c__, "Copyright");
ELEMENT_CASE(AIFF_ANNO, "Comment");
ELEMENT_CASE(AIFF_AUTH, "Performer");
ELEMENT_CASE(AIFF_NAME, "Title");
default : Skip_XX(Element_Size, "Unknown");
return;
}
//Parsing
Ztring text;
Get_Local(Element_Size, text, "text");
//Filling
Fill(Stream_General, 0, Name.c_str(), text);
}
//---------------------------------------------------------------------------
void File_Riff::AVI_()
{
Element_Name("AVI");
//Test if there is only one AVI chunk
if (Status[IsAccepted])
{
Element_Info1("Problem: 2 AVI chunks, this is not normal");
Skip_XX(Element_TotalSize_Get(), "Data");
return;
}
Data_Accept("AVI");
//Filling
Fill(Stream_General, 0, General_Format, "AVI");
Kind=Kind_Avi;
//Configuration
Buffer_MaximumSize=64*1024*1024; //Some big frames are possible (e.g YUV 4:2:2 10 bits 1080p)
}
//---------------------------------------------------------------------------
void File_Riff::AVI__Cr8r()
{
Element_Name("Adobe Premiere Cr8r");
//Parsing
Skip_C4( "FourCC");
Skip_B4( "Size");
Skip_XX(Element_Size-Element_Offset, "Unknown");
}
//---------------------------------------------------------------------------
void File_Riff::AVI__cset()
{
Element_Name("Regional settings");
//Parsing
Skip_L2( "CodePage"); //TODO: take a look about IBM/MS RIFF/MCI Specification 1.0
Skip_L2( "CountryCode");
Skip_L2( "LanguageCode");
Skip_L2( "Dialect");
}
//---------------------------------------------------------------------------
void File_Riff::AVI__exif()
{
Element_Name("Exif (Exchangeable Image File Format)");
}
//---------------------------------------------------------------------------
void File_Riff::AVI__exif_xxxx()
{
Element_Name("Value");
//Parsing
Ztring Value;
Get_Local(Element_Size, Value, "Value");
//Filling
switch (Element_Code)
{
case Elements::AVI__exif_ecor : Fill(Stream_General, 0, "Make", Value); break;
case Elements::AVI__exif_emdl : Fill(Stream_General, 0, "Model", Value); break;
case Elements::AVI__exif_emnt : Fill(Stream_General, 0, "MakerNotes", Value); break;
case Elements::AVI__exif_erel : Fill(Stream_General, 0, "RelatedImageFile", Value); break;
case Elements::AVI__exif_etim : Fill(Stream_General, 0, "Written_Date", Value); break;
case Elements::AVI__exif_eucm : Fill(Stream_General, 0, General_Comment, Value); break;
case Elements::AVI__exif_ever : break; //Exif version
default: Fill(Stream_General, 0, Ztring().From_CC4((int32u)Element_Code).To_Local().c_str(), Value);
}
}
//---------------------------------------------------------------------------
void File_Riff::AVI__goog()
{
Element_Name("Google specific");
//Filling
Fill(Stream_General, 0, General_Format, "Google Video", Unlimited, false, true);
}
//---------------------------------------------------------------------------
void File_Riff::AVI__goog_GDAT()
{
Element_Name("Google datas");
}
//---------------------------------------------------------------------------
// Google Metadata
//
void File_Riff::AVI__GMET()
{
Element_Name("Google Metadatas");
//Parsing
Ztring Value; Value.From_Local((const char*)(Buffer+Buffer_Offset+0), (size_t)Element_Size);
ZtringListList List;
List.Separator_Set(0, __T("\n"));
List.Separator_Set(1, __T(":"));
List.Max_Set(1, 2);
List.Write(Value);
//Details
#if MEDIAINFO_TRACE
if (Config_Trace_Level)
{
//for (size_t Pos=0; Pos<List.size(); Pos++)
// Details_Add_Info(Pos, List(Pos, 0).To_Local().c_str(), List(Pos, 1));
}
#endif //MEDIAINFO_TRACE
//Filling
for (size_t Pos=0; Pos<List.size(); Pos++)
{
if (List(Pos, 0)==__T("title")) Fill(Stream_General, 0, General_Title, List(Pos, 1));
if (List(Pos, 0)==__T("description")) Fill(Stream_General, 0, General_Title_More, List(Pos, 1));
if (List(Pos, 0)==__T("url")) Fill(Stream_General, 0, General_Title_Url, List(Pos, 1));
if (List(Pos, 0)==__T("docid")) Fill(Stream_General, 0, General_UniqueID, List(Pos, 1));
}
}
//---------------------------------------------------------------------------
void File_Riff::AVI__hdlr()
{
Element_Name("AVI Header");
}
//---------------------------------------------------------------------------
void File_Riff::AVI__hdlr_avih()
{
Element_Name("File header");
//Parsing
int32u MicrosecPerFrame, Flags;
Get_L4 (MicrosecPerFrame, "MicrosecPerFrame");
Skip_L4( "MaxBytesPerSec");
Skip_L4( "PaddingGranularity");
Get_L4 (Flags, "Flags");
Skip_Flags(Flags, 4, "HasIndex");
Skip_Flags(Flags, 5, "MustUseIndex");
Skip_Flags(Flags, 8, "IsInterleaved");
Skip_Flags(Flags, 9, "UseCKTypeToFindKeyFrames");
Skip_Flags(Flags, 11, "TrustCKType");
Skip_Flags(Flags, 16, "WasCaptureFile");
Skip_Flags(Flags, 17, "Copyrighted");
Get_L4 (avih_TotalFrame, "TotalFrames");
Skip_L4( "InitialFrames");
Skip_L4( "StreamsCount");
Skip_L4( "SuggestedBufferSize");
Skip_L4( "Width");
Skip_L4( "Height");
Skip_L4( "Reserved");
Skip_L4( "Reserved");
Skip_L4( "Reserved");
Skip_L4( "Reserved");
if(Element_Offset<Element_Size)
Skip_XX(Element_Size-Element_Offset, "Unknown");
//Filling
if (MicrosecPerFrame>0)
avih_FrameRate=1000000.0/MicrosecPerFrame;
}
//---------------------------------------------------------------------------
void File_Riff::AVI__hdlr_JUNK()
{
Element_Name("Garbage");
}
//---------------------------------------------------------------------------
void File_Riff::AVI__hdlr_odml()
{
Element_Name("OpenDML");
}
//---------------------------------------------------------------------------
void File_Riff::AVI__hdlr_odml_dmlh()
{
Element_Name("OpenDML Header");
//Parsing
Get_L4(dmlh_TotalFrame, "GrandFrames");
if (Element_Offset<Element_Size)
Skip_XX(Element_Size-Element_Offset, "Unknown");
}
//---------------------------------------------------------------------------
void File_Riff::AVI__hdlr_ON2h()
{
Element_Name("On2 header");
//Parsing
Skip_XX(Element_Size, "Unknown");
}
//---------------------------------------------------------------------------
void File_Riff::AVI__hdlr_strl()
{
Element_Name("Stream info");
Element_Info1(stream_Count);
//Clean up
StreamKind_Last=Stream_Max;
StreamPos_Last=(size_t)-1;
//Compute the current codec ID
Stream_ID=(('0'+stream_Count/10)*0x01000000
+('0'+stream_Count )*0x00010000);
stream_Count++;
}
//---------------------------------------------------------------------------
void File_Riff::AVI__hdlr_strl_indx()
{
Element_Name("Index");
int32u Entry_Count, ChunkId;
int16u LongsPerEntry;
int8u IndexType, IndexSubType;
Get_L2 (LongsPerEntry, "LongsPerEntry"); //Size of each entry in aIndex array
Get_L1 (IndexSubType, "IndexSubType");
Get_L1 (IndexType, "IndexType");
Get_L4 (Entry_Count, "EntriesInUse"); //Index of first unused member in aIndex array
Get_C4 (ChunkId, "ChunkId"); //FCC of what is indexed
//Depends of size of structure...
switch (IndexType)
{
case 0x01 : //AVI_INDEX_OF_CHUNKS
switch (IndexSubType)
{
case 0x00 : AVI__hdlr_strl_indx_StandardIndex(Entry_Count, ChunkId); break;
case 0x01 : AVI__hdlr_strl_indx_FieldIndex(Entry_Count, ChunkId); break; //AVI_INDEX_2FIELD
default: Skip_XX(Element_Size-Element_Offset, "Unknown");
}
break;
case 0x0 : //AVI_INDEX_OF_INDEXES
switch (IndexSubType)
{
case 0x00 :
case 0x01 : AVI__hdlr_strl_indx_SuperIndex(Entry_Count, ChunkId); break; //AVI_INDEX_2FIELD
default: Skip_XX(Element_Size-Element_Offset, "Unknown");
}
break;
default: Skip_XX(Element_Size-Element_Offset, "Unknown");
}
}
//---------------------------------------------------------------------------
void File_Riff::AVI__hdlr_strl_indx_StandardIndex(int32u Entry_Count, int32u ChunkId)
{
Element_Name("Standard Index");
//Parsing
int64u BaseOffset, StreamSize=0;
Get_L8 (BaseOffset, "BaseOffset");
Skip_L4( "Reserved3");
for (int32u Pos=0; Pos<Entry_Count; Pos++)
{
//Is too slow
/*
Element_Begin1("Index");
int32u Offset, Size;
Get_L4 (Offset, "Offset"); //BaseOffset + this is absolute file offset
Get_L4 (Size, "Size"); //Bit 31 is set if this is NOT a keyframe
Element_Info1(Size&0x7FFFFFFF);
if (Size)
Element_Info1("KeyFrame");
Element_End0();
*/
//Faster method
if (Element_Offset+8>Element_Size)
break; //Malformed index
int32u Offset=LittleEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset );
int32u Size =LittleEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset+4)&0x7FFFFFFF;
Element_Offset+=8;
//Stream Position and size
if (Pos<300 || MediaInfoLib::Config.ParseSpeed_Get()==1.00)
{
Stream_Structure[BaseOffset+Offset-8].Name=ChunkId&0xFFFF0000;
Stream_Structure[BaseOffset+Offset-8].Size=Size;
}
StreamSize+=(Size&0x7FFFFFFF);
Stream[ChunkId&0xFFFF0000].PacketCount++;
//Interleaved
if (Pos== 0 && (ChunkId&0xFFFF0000)==0x30300000 && Interleaved0_1 ==0)
Interleaved0_1 =BaseOffset+Offset-8;
if (Pos==Entry_Count/10 && (ChunkId&0xFFFF0000)==0x30300000 && Interleaved0_10==0)
Interleaved0_10=BaseOffset+Offset-8;
if (Pos== 0 && (ChunkId&0xFFFF0000)==0x30310000 && Interleaved1_1 ==0)
Interleaved1_1 =BaseOffset+Offset-8;
if (Pos==Entry_Count/10 && (ChunkId&0xFFFF0000)==0x30310000 && Interleaved1_10==0)
Interleaved1_10=BaseOffset+Offset-8;
}
Stream[ChunkId&0xFFFF0000].StreamSize+=StreamSize;
if (Element_Offset<Element_Size)
Skip_XX(Element_Size-Element_Offset, "Garbage");
}
//---------------------------------------------------------------------------
void File_Riff::AVI__hdlr_strl_indx_FieldIndex(int32u Entry_Count, int32u)
{
Element_Name("Field Index");
//Parsing
Skip_L8( "Offset");
Skip_L4( "Reserved2");
for (int32u Pos=0; Pos<Entry_Count; Pos++)
{
Element_Begin1("Index");
Skip_L4( "Offset"); //BaseOffset + this is absolute file offset
Skip_L4( "Size"); //Bit 31 is set if this is NOT a keyframe
Skip_L4( "OffsetField2"); //Offset to second field
Element_End0();
}
}
//---------------------------------------------------------------------------
void File_Riff::AVI__hdlr_strl_indx_SuperIndex(int32u Entry_Count, int32u ChunkId)
{
Element_Name("Index of Indexes");
//Parsing
int64u Offset;
Skip_L4( "Reserved0");
Skip_L4( "Reserved1");
Skip_L4( "Reserved2");
stream& StreamItem = Stream[Stream_ID];
for (int32u Pos=0; Pos<Entry_Count; Pos++)
{
int32u Duration;
Element_Begin1("Index of Indexes");
Get_L8 (Offset, "Offset");
Skip_L4( "Size"); //Size of index chunk at this offset
Get_L4 (Duration, "Duration"); //time span in stream ticks
Index_Pos[Offset]=ChunkId;
StreamItem.indx_Duration+=Duration;
Element_End0();
}
//We needn't anymore Old version
NeedOldIndex=false;
}
//---------------------------------------------------------------------------
void File_Riff::AVI__hdlr_strl_JUNK()
{
Element_Name("Garbage");
}
//---------------------------------------------------------------------------
void File_Riff::AVI__hdlr_strl_strd()
{
Element_Name("Stream datas");
//Parsing
Skip_XX(Element_Size, "Unknown");
}
//---------------------------------------------------------------------------
void File_Riff::AVI__hdlr_strl_strf()
{
Element_Name("Stream format");
//Parse depending of kind of stream
stream& StreamItem = Stream[Stream_ID];
switch (StreamItem.fccType)
{
case Elements::AVI__hdlr_strl_strh_auds : AVI__hdlr_strl_strf_auds(); break;
case Elements::AVI__hdlr_strl_strh_iavs : AVI__hdlr_strl_strf_iavs(); break;
case Elements::AVI__hdlr_strl_strh_mids : AVI__hdlr_strl_strf_mids(); break;
case Elements::AVI__hdlr_strl_strh_txts : AVI__hdlr_strl_strf_txts(); break;
case Elements::AVI__hdlr_strl_strh_vids : AVI__hdlr_strl_strf_vids(); break;
default : Element_Info1("Unknown");
}
//Registering stream
StreamItem.StreamKind=StreamKind_Last;
StreamItem.StreamPos=StreamPos_Last;
}
//---------------------------------------------------------------------------
void File_Riff::AVI__hdlr_strl_strf_auds()
{
Element_Info1("Audio");
//Parsing
#if !MEDIAINFO_DEMUX
int32u AvgBytesPerSec;
#endif //!MEDIAINFO_DEMUX
int16u FormatTag, Channels;
BitsPerSample=0;
Get_L2 (FormatTag, "FormatTag");
Get_L2 (Channels, "Channels");
Get_L4 (SamplesPerSec, "SamplesPerSec");
Get_L4 (AvgBytesPerSec, "AvgBytesPerSec");
#if MEDIAINFO_DEMUX
Get_L2 (BlockAlign, "BlockAlign");
#else //MEDIAINFO_DEMUX
Skip_L2( "BlockAlign");
#endif //MEDIAINFO_DEMUX
if (Element_Offset+2<=Element_Size)
Get_L2 (BitsPerSample, "BitsPerSample");
if (FormatTag==1) //Only for PCM
{
//Coherancy
if (BitsPerSample && SamplesPerSec*BitsPerSample*Channels/8==AvgBytesPerSec*8)
AvgBytesPerSec*=8; //Found in one file. TODO: Provide information to end user about such error
//Computing of missing value
if (!BitsPerSample && AvgBytesPerSec && SamplesPerSec && Channels)
BitsPerSample=(int16u)(AvgBytesPerSec*8/SamplesPerSec/Channels);
}
//Filling
Stream_Prepare(Stream_Audio);
stream& StreamItem = Stream[Stream_ID];
StreamItem.Compression=FormatTag;
Ztring Codec; Codec.From_Number(FormatTag, 16);
Codec.MakeUpperCase();
CodecID_Fill(Codec, Stream_Audio, StreamPos_Last, InfoCodecID_Format_Riff);
Fill(Stream_Audio, StreamPos_Last, Audio_Codec, Codec); //May be replaced by codec parser
Fill(Stream_Audio, StreamPos_Last, Audio_Codec_CC, Codec);
if (Channels)
Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, (Channels!=5 || FormatTag==0xFFFE)?Channels:6);
if (SamplesPerSec)
Fill(Stream_Audio, StreamPos_Last, Audio_SamplingRate, SamplesPerSec);
if (AvgBytesPerSec)
Fill(Stream_Audio, StreamPos_Last, Audio_BitRate, AvgBytesPerSec*8);
if (BitsPerSample)
Fill(Stream_Audio, StreamPos_Last, Audio_BitDepth, BitsPerSample);
StreamItem.AvgBytesPerSec=AvgBytesPerSec; //Saving bitrate for each stream
if (SamplesPerSec && TimeReference!=(int64u)-1)
{
Fill(Stream_Audio, 0, Audio_Delay, float64_int64s(((float64)TimeReference)*1000/SamplesPerSec));
Fill(Stream_Audio, 0, Audio_Delay_Source, "Container (bext)");
}
//Specific cases
#if defined(MEDIAINFO_DTS_YES) || defined(MEDIAINFO_SMPTEST0337_YES)
if (FormatTag==0x1 && Retrieve(Stream_General, 0, General_Format)==__T("Wave")) //Some DTS or SMPTE ST 337 streams are coded "1"
{
#if defined(MEDIAINFO_DTS_YES)
{
File_Dts* Parser=new File_Dts;
Parser->Frame_Count_Valid=2;
Parser->ShouldContinueParsing=true;
#if MEDIAINFO_DEMUX
if (Config->Demux_Unpacketize_Get() && Retrieve(Stream_General, 0, General_Format)==__T("Wave"))
{
Parser->Demux_Level=2; //Container
Parser->Demux_UnpacketizeContainer=true;
Demux_Level=4; //Intermediate
}
#endif //MEDIAINFO_DEMUX
StreamItem.Parsers.push_back(Parser);
}
#endif
#if defined(MEDIAINFO_SMPTEST0337_YES)
{
File_SmpteSt0337* Parser=new File_SmpteSt0337;
Parser->Container_Bits=(int8u)BitsPerSample;
Parser->Aligned=true;
Parser->ShouldContinueParsing=true;
#if MEDIAINFO_DEMUX
if (Config->Demux_Unpacketize_Get() && Retrieve(Stream_General, 0, General_Format)==__T("Wave"))
{
Parser->Demux_Level=2; //Container
Parser->Demux_UnpacketizeContainer=true;
Demux_Level=4; //Intermediate
}
#endif //MEDIAINFO_DEMUX
StreamItem.Parsers.push_back(Parser);
}
#endif
}
#endif
//Creating the parser
if (0);
#if defined(MEDIAINFO_MPEGA_YES)
else if (MediaInfoLib::Config.CodecID_Get(Stream_Audio, InfoCodecID_Format_Riff, Codec)==__T("MPEG Audio"))
{
File_Mpega* Parser=new File_Mpega;
Parser->CalculateDelay=true;
Parser->ShouldContinueParsing=true;
StreamItem.Parsers.push_back(Parser);
}
#endif
#if defined(MEDIAINFO_AC3_YES)
else if (MediaInfoLib::Config.CodecID_Get(Stream_Audio, InfoCodecID_Format_Riff, Codec)==__T("AC-3"))
{
File_Ac3* Parser=new File_Ac3;
Parser->Frame_Count_Valid=2;
Parser->CalculateDelay=true;
Parser->ShouldContinueParsing=true;
StreamItem.Parsers.push_back(Parser);
}
#endif
#if defined(MEDIAINFO_DTS_YES)
else if (MediaInfoLib::Config.CodecID_Get(Stream_Audio, InfoCodecID_Format_Riff, Codec)==__T("DTS"))
{
File_Dts* Parser=new File_Dts;
Parser->Frame_Count_Valid=2;
Parser->ShouldContinueParsing=true;
StreamItem.Parsers.push_back(Parser);
}
#endif
#if defined(MEDIAINFO_AAC_YES)
else if (MediaInfoLib::Config.CodecID_Get(Stream_Audio, InfoCodecID_Format_Riff, Codec)==__T("AAC"))
{
File_Aac* Parser=new File_Aac;
Parser->Mode=File_Aac::Mode_ADTS;
Parser->Frame_Count_Valid=1;
Parser->ShouldContinueParsing=true;
StreamItem.Parsers.push_back(Parser);
}
#endif
#if defined(MEDIAINFO_PCM_YES)
else if (MediaInfoLib::Config.CodecID_Get(Stream_Audio, InfoCodecID_Format_Riff, Codec)==__T("PCM"))
{
File_Pcm* Parser=new File_Pcm;
Parser->Codec=Codec;
Parser->Endianness='L';
Parser->BitDepth=(int8u)BitsPerSample;
#if MEDIAINFO_DEMUX
if (Demux_Rate)
Parser->Frame_Count_Valid = float64_int64s(Demux_Rate);
if (Config->Demux_Unpacketize_Get() && Retrieve(Stream_General, 0, General_Format)==__T("Wave"))
{
Parser->Demux_Level=2; //Container
Parser->Demux_UnpacketizeContainer=true;
Demux_Level=4; //Intermediate
}
#else //MEDIAINFO_DEMUX
Parser->Frame_Count_Valid=(int64u)-1; //Disabling it, waiting for SMPTE ST 337 parser reject
#endif //MEDIAINFO_DEMUX
stream& StreamItem = Stream[Stream_ID];
StreamItem.Parsers.push_back(Parser);
StreamItem.IsPcm=true;
}
#endif
#if defined(MEDIAINFO_ADPCM_YES)
else if (MediaInfoLib::Config.CodecID_Get(Stream_Audio, InfoCodecID_Format_Riff, Codec)==__T("ADPCM"))
{
//Creating the parser
File_Adpcm MI;
MI.Codec=Codec;
//Parsing
Open_Buffer_Init(&MI);
Open_Buffer_Continue(&MI, 0);
//Filling
Finish(&MI);
Merge(MI, StreamKind_Last, 0, StreamPos_Last);
}
#endif
#if defined(MEDIAINFO_OGG_YES)
else if (MediaInfoLib::Config.CodecID_Get(Stream_Audio, InfoCodecID_Format_Riff, Codec)==__T("Vorbis")
&& FormatTag!=0x566F) //0x566F has config in this chunk
{
File_Ogg* Parser=new File_Ogg;
Parser->ShouldContinueParsing=true;
StreamItem.Parsers.push_back(Parser);
}
#endif
Open_Buffer_Init_All();
//Options
if (Element_Offset+2>Element_Size)
return; //No options
//Parsing
int16u Option_Size;
Get_L2 (Option_Size, "cbSize");
//Filling
if (Option_Size>0)
{
if (0);
else if (MediaInfoLib::Config.CodecID_Get(Stream_Audio, InfoCodecID_Format_Riff, Codec)==__T("MPEG Audio"))
{
if (Option_Size==12)
AVI__hdlr_strl_strf_auds_Mpega();
else
Skip_XX(Option_Size, "MPEG Audio - Uknown");
}
else if (Codec==__T("AAC") || Codec==__T("FF") || Codec==__T("8180"))
AVI__hdlr_strl_strf_auds_Aac();
else if (FormatTag==0x566F) //Vorbis with Config in this chunk
AVI__hdlr_strl_strf_auds_Vorbis();
else if (FormatTag==0x6750) //Vorbis with Config in this chunk
AVI__hdlr_strl_strf_auds_Vorbis2();
else if (FormatTag==0xFFFE) //Extensible Wave
AVI__hdlr_strl_strf_auds_ExtensibleWave();
else if (Element_Offset+Option_Size<=Element_Size)
Skip_XX(Option_Size, "Unknown");
else if (Element_Offset!=Element_Size)
Skip_XX(Element_Size-Element_Offset, "Error");
}
}
//---------------------------------------------------------------------------
void File_Riff::AVI__hdlr_strl_strf_auds_Mpega()
{
//Parsing
Element_Begin1("MPEG Audio options");
Skip_L2( "ID");
Skip_L4( "Flags");
Skip_L2( "BlockSize");
Skip_L2( "FramesPerBlock");
Skip_L2( "CodecDelay");
Element_End0();
}
//---------------------------------------------------------------------------
void File_Riff::AVI__hdlr_strl_strf_auds_Aac()
{
//Parsing
Element_Begin1("AAC options");
#if defined(MEDIAINFO_AAC_YES)
File_Aac* MI=new File_Aac();
MI->Mode=File_Aac::Mode_AudioSpecificConfig;
Open_Buffer_Init(MI);
Open_Buffer_Continue(MI);
Finish(MI);
Merge(*MI, StreamKind_Last, 0, StreamPos_Last);
delete MI; //MI=NULL;
#else //MEDIAINFO_MPEG4_YES
Skip_XX(Element_Size-Element_Offset, "(AudioSpecificConfig)");
#endif
Element_End0();
}
//---------------------------------------------------------------------------
void File_Riff::AVI__hdlr_strl_strf_auds_Vorbis()
{
//Parsing
Element_Begin1("Vorbis options");
#if defined(MEDIAINFO_OGG_YES)
File_Ogg_SubElement MI;
Open_Buffer_Init(&MI);
Element_Begin1("Element sizes");
//All elements parsing, except last one
std::vector<size_t> Elements_Size;
size_t Elements_TotalSize=0;
int8u Elements_Count;
Get_L1(Elements_Count, "Element count");
Elements_Size.resize(Elements_Count+1); //+1 for the last block
for (int8u Pos=0; Pos<Elements_Count; Pos++)
{
int8u Size;
Get_L1(Size, "Size");
Elements_Size[Pos]=Size;
Elements_TotalSize+=Size;
}
Element_End0();
if (Element_Offset+Elements_TotalSize>Element_Size)
return;
//Adding the last block
Elements_Size[Elements_Count]=(size_t)(Element_Size-(Element_Offset+Elements_TotalSize));
Elements_Count++;
//Parsing blocks
for (int8u Pos=0; Pos<Elements_Count; Pos++)
{
Open_Buffer_Continue(&MI, Elements_Size[Pos]);
Open_Buffer_Continue(&MI, 0);
Element_Offset+=Elements_Size[Pos];
}
//Finalizing
Finish(&MI);
Merge(MI, StreamKind_Last, 0, StreamPos_Last);
Clear(Stream_Audio, StreamPos_Last, Audio_BitDepth); //Resolution is not valid for Vorbis
Element_Show();
#else //MEDIAINFO_MPEG4_YES
Skip_XX(Element_Size-Element_Offset, "(Vorbis headers)");
#endif
Element_End0();
}
//---------------------------------------------------------------------------
void File_Riff::AVI__hdlr_strl_strf_auds_Vorbis2()
{
//Parsing
Skip_XX(8, "Vorbis Unknown");
Element_Begin1("Vorbis options");
#if defined(MEDIAINFO_OGG_YES)
stream& StreamItem = Stream[Stream_ID];
Open_Buffer_Continue(StreamItem.Parsers[0]);
Open_Buffer_Continue(StreamItem.Parsers[0], 0);
Finish(StreamItem.Parsers[0]);
Merge(*StreamItem.Parsers[0], StreamKind_Last, 0, StreamPos_Last);
Element_Show();
#else //MEDIAINFO_MPEG4_YES
Skip_XX(Element_Size-Element_Offset, "(Vorbis headers)");
#endif
Element_End0();
}
//---------------------------------------------------------------------------
void File_Riff::AVI__hdlr_strl_strf_auds_ExtensibleWave()
{
//Parsing
int128u SubFormat;
int32u ChannelMask;
Skip_L2( "ValidBitsPerSample / SamplesPerBlock");
Get_L4 (ChannelMask, "ChannelMask");
Get_GUID(SubFormat, "SubFormat");
FILLING_BEGIN();
if ((SubFormat.hi&0xFFFFFFFFFFFF0000LL)==0x0010000000000000LL && SubFormat.lo==0x800000AA00389B71LL)
{
CodecID_Fill(Ztring().From_Number((int16u)SubFormat.hi, 16), Stream_Audio, StreamPos_Last, InfoCodecID_Format_Riff);
Fill(Stream_Audio, StreamPos_Last, Audio_CodecID, Ztring().From_GUID(SubFormat), true);
Fill(Stream_Audio, StreamPos_Last, Audio_Codec, MediaInfoLib::Config.Codec_Get(Ztring().From_Number((int16u)SubFormat.hi, 16)), true);
//Creating the parser
if (0);
#if defined(MEDIAINFO_PCM_YES)
else if (MediaInfoLib::Config.CodecID_Get(Stream_Audio, InfoCodecID_Format_Riff, Ztring().From_Number((int16u)SubFormat.hi, 16))==__T("PCM"))
{
//Creating the parser
File_Pcm* Parser=new File_Pcm;
Parser->Codec=Ztring().From_GUID(SubFormat);
Parser->Endianness='L';
Parser->Sign='S';
Parser->BitDepth=(int8u)BitsPerSample;
#if MEDIAINFO_DEMUX
if (Config->Demux_Unpacketize_Get() && Retrieve(Stream_General, 0, General_Format)==__T("Wave"))
{
Parser->Demux_Level=2; //Container
Parser->Demux_UnpacketizeContainer=true;
Demux_Level=4; //Intermediate
}
#endif //MEDIAINFO_DEMUX
stream& StreamItem = Stream[Stream_ID];
StreamItem.Parsers.push_back(Parser);
StreamItem.IsPcm=true;
}
#endif
Open_Buffer_Init_All();
}
else
{
CodecID_Fill(Ztring().From_GUID(SubFormat), Stream_Audio, StreamPos_Last, InfoCodecID_Format_Riff);
}
Fill(Stream_Audio, StreamPos_Last, Audio_ChannelPositions, ExtensibleWave_ChannelMask(ChannelMask));
Fill(Stream_Audio, StreamPos_Last, Audio_ChannelPositions_String2, ExtensibleWave_ChannelMask2(ChannelMask));
FILLING_END();
}
//---------------------------------------------------------------------------
void File_Riff::AVI__hdlr_strl_strf_iavs()
{
//Standard video header before Iavs?
if (Element_Size==72)
{
Element_Begin0();
AVI__hdlr_strl_strf_vids();
Element_End0();
}
Element_Info1("Interleaved Audio/Video");
#ifdef MEDIAINFO_DVDIF_YES
if (Element_Size<8*4)
return;
//Parsing
DV_FromHeader=new File_DvDif();
Open_Buffer_Init(DV_FromHeader);
//DVAAuxSrc
((File_DvDif*)DV_FromHeader)->AuxToAnalyze=0x50; //Audio source
Open_Buffer_Continue(DV_FromHeader, 4);
//DVAAuxCtl
((File_DvDif*)DV_FromHeader)->AuxToAnalyze=0x51; //Audio control
Open_Buffer_Continue(DV_FromHeader, Buffer+Buffer_Offset+(size_t)Element_Offset, 4);
Element_Offset+=4;
//DVAAuxSrc1
Skip_L4( "DVAAuxSrc1");
//DVAAuxCtl1
Skip_L4( "DVAAuxCtl1");
//DVVAuxSrc
((File_DvDif*)DV_FromHeader)->AuxToAnalyze=0x60; //Video source
Open_Buffer_Continue(DV_FromHeader, 4);
//DVAAuxCtl
((File_DvDif*)DV_FromHeader)->AuxToAnalyze=0x61; //Video control
Open_Buffer_Continue(DV_FromHeader, 4);
//Reserved
if (Element_Offset<Element_Size)
{
Skip_L4( "DVReserved");
Skip_L4( "DVReserved");
}
Finish(DV_FromHeader);
Stream_Prepare(Stream_Video);
stream& StreamItem = Stream[Stream_ID];
StreamItem.Parsers.push_back(new File_DvDif);
Open_Buffer_Init(StreamItem.Parsers[0]);
#else //MEDIAINFO_DVDIF_YES
//Parsing
Skip_L4( "DVAAuxSrc");
Skip_L4( "DVAAuxCtl");
Skip_L4( "DVAAuxSrc1");
Skip_L4( "DVAAuxCtl1");
Skip_L4( "DVVAuxSrc");
Skip_L4( "DVVAuxCtl");
Skip_L4( "DVReserved");
Skip_L4( "DVReserved");
//Filling
Ztring Codec; Codec.From_CC4(Stream[Stream_ID].fccHandler);
Stream_Prepare(Stream_Video);
float32 FrameRate=Retrieve(Stream_Video, StreamPos_Last, Video_FrameRate).To_float32();
Fill(Stream_Video, StreamPos_Last, Video_Codec, Codec); //May be replaced by codec parser
Fill(Stream_Video, StreamPos_Last, Video_Codec_CC, Codec);
if (Codec==__T("dvsd")
|| Codec==__T("dvsl"))
{
Fill(Stream_Video, StreamPos_Last, Video_Width, 720);
if (FrameRate==25.000) Fill(Stream_Video, StreamPos_Last, Video_Height, 576);
else if (FrameRate==29.970) Fill(Stream_Video, StreamPos_Last, Video_Height, 480);
Fill(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio, 4.0/3, 3, true);
}
else if (Codec==__T("dvhd"))
{
Fill(Stream_Video, StreamPos_Last, Video_Width, 1440);
if (FrameRate==25.000) Fill(Stream_Video, StreamPos_Last, Video_Height, 1152);
else if (FrameRate==30.000) Fill(Stream_Video, StreamPos_Last, Video_Height, 960);
Fill(Stream_Video, StreamPos_Last, Video_DisplayAspectRatio, 4.0/3, 3, true);
}
Stream_Prepare(Stream_Audio);
CodecID_Fill(Codec, Stream_Audio, StreamPos_Last, InfoCodecID_Format_Riff);
Fill(Stream_Audio, StreamPos_Last, Audio_Codec, Codec); //May be replaced by codec parser
Fill(Stream_Audio, StreamPos_Last, Audio_Codec_CC, Codec);
#endif //MEDIAINFO_DVDIF_YES
}
//---------------------------------------------------------------------------
void File_Riff::AVI__hdlr_strl_strf_mids()
{
Element_Info1("Midi");
//Filling
Stream_Prepare(Stream_Audio);
Fill(Stream_Audio, StreamPos_Last, Audio_Format, "MIDI");
Fill(Stream_Audio, StreamPos_Last, Audio_Codec, "Midi");
}
//---------------------------------------------------------------------------
void File_Riff::AVI__hdlr_strl_strf_txts()
{
Element_Info1("Text");
//Parsing
Ztring Format;
if (Element_Size)
{
Get_Local(10, Format, "Format");
Skip_XX(22, "Unknown");
}
FILLING_BEGIN_PRECISE();
Stream_Prepare(Stream_Text);
if (Element_Size==0)
{
//Creating the parser
stream& StreamItem = Stream[Stream_ID];
#if defined(MEDIAINFO_SUBRIP_YES)
StreamItem.Parsers.push_back(new File_SubRip);
#endif
#if defined(MEDIAINFO_OTHERTEXT_YES)
StreamItem.Parsers.push_back(new File_OtherText); //For SSA
#endif
Open_Buffer_Init_All();
}
else
{
Fill(Stream_Text, StreamPos_Last, Text_Format, Format);
}
FILLING_END();
}
//---------------------------------------------------------------------------
void File_Riff::AVI__hdlr_strl_strf_vids()
{
Element_Info1("Video");
//Parsing
int32u Compression, Width, Height;
int16u Resolution;
Skip_L4( "Size");
Get_L4 (Width, "Width");
Get_L4 (Height, "Height");
Skip_L2( "Planes");
Get_L2 (Resolution, "BitCount"); //Do not use it
Get_C4 (Compression, "Compression");
Skip_L4( "SizeImage");
Skip_L4( "XPelsPerMeter");
Skip_L4( "YPelsPerMeter");
Skip_L4( "ClrUsed");
Skip_L4( "ClrImportant");
//Filling
Stream[Stream_ID].Compression=Compression;
if (Compression==CC4("DXSB"))
{
//Divx.com hack for subtitle, this is a text stream in a DivX Format
Fill(Stream_General, 0, General_Format, "DivX", Unlimited, true, true);
Stream_Prepare(Stream_Text);
}
else
Stream_Prepare(Stream_Video);
//Filling
CodecID_Fill(Ztring().From_CC4(Compression), StreamKind_Last, StreamPos_Last, InfoCodecID_Format_Riff);
Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Codec), Ztring().From_CC4(Compression).To_Local().c_str()); //FormatTag, may be replaced by codec parser
Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Codec_CC), Ztring().From_CC4(Compression).To_Local().c_str()); //FormatTag
Fill(StreamKind_Last, StreamPos_Last, "Width", Width, 10, true);
Fill(StreamKind_Last, StreamPos_Last, "Height", Height>=0x80000000?(-((int32s)Height)):Height, 10, true); // AVI can use negative height for raw to signal that it's coded top-down, not bottom-up
if (Resolution==32 && Compression==0x74736363) //tscc
Fill(StreamKind_Last, StreamPos_Last, "BitDepth", 8);
else if (Compression==0x44495633) //DIV3
Fill(StreamKind_Last, StreamPos_Last, "BitDepth", 8);
else if (MediaInfoLib::Config.CodecID_Get(StreamKind_Last, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression)).find(__T("Canopus"))!=std::string::npos) //Canopus codecs
Fill(StreamKind_Last, StreamPos_Last, "BitDepth", Resolution/3);
else if (Compression==0x44585342) //DXSB
Fill(StreamKind_Last, StreamPos_Last, "BitDepth", Resolution);
else if (MediaInfoLib::Config.CodecID_Get(StreamKind_Last, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression), InfoCodecID_ColorSpace).find(__T("RGBA"))!=std::string::npos) //RGB codecs
Fill(StreamKind_Last, StreamPos_Last, "BitDepth", Resolution/4);
else if (Compression==0x00000000 //RGB
|| MediaInfoLib::Config.CodecID_Get(StreamKind_Last, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression), InfoCodecID_ColorSpace).find(__T("RGB"))!=std::string::npos) //RGB codecs
{
if (Resolution==32)
{
Fill(StreamKind_Last, StreamPos_Last, Fill_Parameter(StreamKind_Last, Generic_Format), "RGBA", Unlimited, true, true);
Fill(StreamKind_Last, StreamPos_Last, "BitDepth", Resolution/4); //With Alpha
}
else
Fill(StreamKind_Last, StreamPos_Last, "BitDepth", Resolution<=16?8:(Resolution/3)); //indexed or normal
}
else if (Compression==0x56503632 //VP62
|| MediaInfoLib::Config.CodecID_Get(StreamKind_Last, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression), InfoCodecID_Format)==__T("H.263") //H.263
|| MediaInfoLib::Config.CodecID_Get(StreamKind_Last, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression), InfoCodecID_Format)==__T("VC-1")) //VC-1
Fill(StreamKind_Last, StreamPos_Last, "BitDepth", Resolution/3);
Stream[Stream_ID].StreamKind=StreamKind_Last;
//Creating the parser
if (0);
#if defined(MEDIAINFO_FFV1_YES)
else if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression), InfoCodecID_Format)==__T("FFV1"))
{
File_Ffv1* Parser=new File_Ffv1;
Parser->Width=Width;
Parser->Height=Height;
Stream[Stream_ID].Parsers.push_back(Parser);
}
#endif
#if defined(MEDIAINFO_HUFFYUV_YES)
else if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression), InfoCodecID_Format)==__T("HuffYUV"))
{
File_HuffYuv* Parser=new File_HuffYuv;
Stream[Stream_ID].Parsers.push_back(Parser);
}
#endif
#if defined(MEDIAINFO_MPEGV_YES)
else if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression), InfoCodecID_Format)==__T("MPEG Video"))
{
File_Mpegv* Parser=new File_Mpegv;
Parser->FrameIsAlwaysComplete=true;
Parser->TimeCodeIsNotTrustable=true;
Stream[Stream_ID].Parsers.push_back(Parser);
}
#endif
#if defined(MEDIAINFO_MPEG4V_YES)
else if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression))==__T("MPEG-4 Visual"))
{
File_Mpeg4v* Parser=new File_Mpeg4v;
Stream[Stream_ID].Specific_IsMpeg4v=true;
Parser->FrameIsAlwaysComplete=true;
if (MediaInfoLib::Config.ParseSpeed_Get()>=0.5)
Parser->ShouldContinueParsing=true;
Stream[Stream_ID].Parsers.push_back(Parser);
}
#endif
#if defined(MEDIAINFO_PRORES_YES)
else if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression), InfoCodecID_Format)==__T("ProRes"))
{
File_ProRes* Parser=new File_ProRes;
Stream[Stream_ID].Parsers.push_back(Parser);
}
#endif
#if defined(MEDIAINFO_AVC_YES)
else if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression))==__T("AVC"))
{
File_Avc* Parser=new File_Avc;
Parser->FrameIsAlwaysComplete=true;
Stream[Stream_ID].Parsers.push_back(Parser);
}
#endif
#if defined(MEDIAINFO_CANOPUS_YES)
else if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression))==__T("Canopus HQ"))
{
File_Canopus* Parser=new File_Canopus;
Stream[Stream_ID].Parsers.push_back(Parser);
}
#endif
#if defined(MEDIAINFO_JPEG_YES)
else if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression))==__T("JPEG"))
{
File_Jpeg* Parser=new File_Jpeg;
Parser->StreamKind=Stream_Video;
Stream[Stream_ID].Parsers.push_back(Parser);
}
#endif
#if defined(MEDIAINFO_DVDIF_YES)
else if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression))==__T("DV"))
{
File_DvDif* Parser=new File_DvDif;
Parser->IgnoreAudio=true;
Stream[Stream_ID].Parsers.push_back(Parser);
}
#endif
#if defined(MEDIAINFO_FRAPS_YES)
else if (Compression==0x46505331) //"FPS1"
{
File_Fraps* Parser=new File_Fraps;
Stream[Stream_ID].Parsers.push_back(Parser);
}
#endif
else if (Compression==0x48465955) //"HFUY"
{
switch (Resolution)
{
case 16 : Fill(Stream_Video, StreamPos_Last, Video_ColorSpace, "YUV"); Fill(Stream_Video, StreamPos_Last, Video_ChromaSubsampling, "4:2:2"); Fill(Stream_Video, StreamPos_Last, Video_BitDepth, 8); break;
case 24 : Fill(Stream_Video, StreamPos_Last, Video_ColorSpace, "RGB"); Fill(Stream_Video, StreamPos_Last, Video_BitDepth, 8); break;
case 32 : Fill(Stream_Video, StreamPos_Last, Video_ColorSpace, "RGBA"); Fill(Stream_Video, StreamPos_Last, Video_BitDepth, 8); break;
default : ;
}
}
#if defined(MEDIAINFO_LAGARITH_YES)
else if (Compression==0x4C414753) //"LAGS"
{
File_Lagarith* Parser=new File_Lagarith;
Stream[Stream_ID].Parsers.push_back(Parser);
}
#endif
Open_Buffer_Init_All();
//Options
if (Element_Offset>=Element_Size)
return; //No options
//Filling
if (0);
else if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression))==__T("AVC"))
AVI__hdlr_strl_strf_vids_Avc();
else if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression))==__T("FFV1"))
AVI__hdlr_strl_strf_vids_Ffv1();
else if (MediaInfoLib::Config.CodecID_Get(Stream_Video, InfoCodecID_Format_Riff, Ztring().From_CC4(Compression))==__T("HuffYUV"))
AVI__hdlr_strl_strf_vids_HuffYUV(Resolution, Height);
else Skip_XX(Element_Size-Element_Offset, "Unknown");
}
//---------------------------------------------------------------------------
void File_Riff::AVI__hdlr_strl_strf_vids_Avc()
{
//Parsing
Element_Begin1("AVC options");
#if defined(MEDIAINFO_AVC_YES)
//Can be sized block or with 000001
stream& StreamItem = Stream[Stream_ID];
File_Avc* Parser=(File_Avc*)StreamItem.Parsers[0];
Parser->MustParse_SPS_PPS=false;
Parser->SizedBlocks=false;
Parser->MustSynchronize=true;
int64u Element_Offset_Save=Element_Offset;
Open_Buffer_Continue(Parser);
if (!Parser->Status[IsAccepted])
{
Element_Offset=Element_Offset_Save;
delete StreamItem.Parsers[0]; StreamItem.Parsers[0]=new File_Avc;
Parser=(File_Avc*)StreamItem.Parsers[0];
Open_Buffer_Init(Parser);
Parser->FrameIsAlwaysComplete=true;
Parser->MustParse_SPS_PPS=true;
Parser->SizedBlocks=true;
Parser->MustSynchronize=false;
Open_Buffer_Continue(Parser);
Element_Show();
}
#else //MEDIAINFO_AVC_YES
Skip_XX(Element_Size-Element_Offset, "(AVC headers)");
#endif
Element_End0();
}
//---------------------------------------------------------------------------
void File_Riff::AVI__hdlr_strl_strf_vids_Ffv1()
{
//Parsing
Element_Begin1("FFV1 options");
#if defined(MEDIAINFO_FFV1_YES)
File_Ffv1* Parser=(File_Ffv1*)Stream[Stream_ID].Parsers[0];
Open_Buffer_OutOfBand(Parser);
#else //MEDIAINFO_FFV1_YES
Skip_XX(Element_Size-Element_Offset, "(FFV1 headers)");
#endif
Element_End0();
}
//---------------------------------------------------------------------------
void File_Riff::AVI__hdlr_strl_strf_vids_HuffYUV(int16u BitCount, int32u Height)
{
//Parsing
Element_Begin1("HuffYUV options");
#if defined(MEDIAINFO_HUFFYUV_YES)
File_HuffYuv* Parser=(File_HuffYuv*)Stream[Stream_ID].Parsers[0];
Parser->IsOutOfBandData=true;
Parser->BitCount=BitCount;
Parser->Height=Height;
Open_Buffer_Continue(Parser);
#else //MEDIAINFO_HUFFYUV_YES
Skip_XX(Element_Size-Element_Offset, "(HuffYUV headers)");
#endif
Element_End0();
}
//---------------------------------------------------------------------------
void File_Riff::AVI__hdlr_strl_strh()
{
Element_Name("Stream header");
//Parsing
int32u fccType, fccHandler, Scale, Rate, Start, Length;
int16u Left, Top, Right, Bottom;
Get_C4 (fccType, "fccType");
switch (fccType)
{
case Elements::AVI__hdlr_strl_strh_auds :
Get_L4 (fccHandler, "fccHandler");
break;
default:
Get_C4 (fccHandler, "fccHandler");
}
Skip_L4( "Flags");
Skip_L2( "Priority");
Skip_L2( "Language");
Skip_L4( "InitialFrames");
Get_L4 (Scale, "Scale");
Get_L4 (Rate, "Rate"); //Rate/Scale is stream tick rate in ticks/sec
Get_L4 (Start, "Start");
Get_L4 (Length, "Length");
Skip_L4( "SuggestedBufferSize");
Skip_L4( "Quality");
Skip_L4( "SampleSize");
Get_L2 (Left, "Frame_Left");
Get_L2 (Top, "Frame_Top");
Get_L2 (Right, "Frame_Right");
Get_L2 (Bottom, "Frame_Bottom");
if(Element_Offset<Element_Size)
Skip_XX(Element_Size-Element_Offset, "Unknown");
//Filling
float32 FrameRate=0;
if (Rate>0 && Scale>0)
{
//FrameRate (without known value detection)
FrameRate=((float32)Rate)/Scale;
if (FrameRate>1)
{
float32 Rest=FrameRate-(int32u)FrameRate;
if (Rest<0.01)
FrameRate-=Rest;
else if (Rest>0.99)
FrameRate+=1-Rest;
else
{
float32 Rest1001=FrameRate*1001/1000-(int32u)(FrameRate*1001/1000);
if (Rest1001<0.001)
FrameRate=(float32)((int32u)(FrameRate*1001/1000))*1000/1001;
if (Rest1001>0.999)
FrameRate=(float32)((int32u)(FrameRate*1001/1000)+1)*1000/1001;
}
}
//Duration
if (FrameRate)
{
int64u Duration=float32_int64s((1000*(float32)Length)/FrameRate);
if (avih_TotalFrame>0 //avih_TotalFrame is here because some files have a wrong Audio Duration if TotalFrame==0 (which is a bug, of course!)
&& (avih_FrameRate==0 || Duration<((float32)avih_TotalFrame)/avih_FrameRate*1000*1.10) //Some file have a nearly perfect header, except that the value is false, trying to detect it (false if 10% more than 1st video)
&& (avih_FrameRate==0 || Duration>((float32)avih_TotalFrame)/avih_FrameRate*1000*0.90)) //Some file have a nearly perfect header, except that the value is false, trying to detect it (false if 10% less than 1st video)
{
Fill(StreamKind_Last, StreamPos_Last, "Duration", Duration);
}
}
}
switch (fccType)
{
case Elements::AVI__hdlr_strl_strh_vids :
if (FrameRate>0) Fill(Stream_Video, StreamPos_Last, Video_FrameRate, FrameRate, 3);
if (Right-Left>0) Fill(Stream_Video, StreamPos_Last, Video_Width, Right-Left, 10, true);
if (Bottom-Top>0) Fill(Stream_Video, StreamPos_Last, Video_Height, Bottom-Top, 10, true);
break;
case Elements::AVI__hdlr_strl_strh_txts :
if (Right-Left>0) Fill(Stream_Text, StreamPos_Last, Text_Width, Right-Left, 10, true);
if (Bottom-Top>0) Fill(Stream_Text, StreamPos_Last, Text_Height, Bottom-Top, 10, true);
break;
default: ;
}
stream& StreamItem = Stream[Stream_ID];
StreamItem.fccType=fccType;
StreamItem.fccHandler=fccHandler;
StreamItem.Scale=Scale;
StreamItem.Rate=Rate;
StreamItem.Start=Start;
StreamItem.Length=Length;
}
//---------------------------------------------------------------------------
void File_Riff::AVI__hdlr_strl_strn()
{
Element_Name("Stream name");
//Parsing
Ztring Title;
Get_Local(Element_Size, Title, "StreamName");
//Filling
Fill(StreamKind_Last, StreamPos_Last, "Title", Title);
}
//---------------------------------------------------------------------------
void File_Riff::AVI__hdlr_strl_vprp()
{
Element_Name("Video properties");
//Parsing
int32u FieldPerFrame;
int16u FrameAspectRatio_H, FrameAspectRatio_W;
Skip_L4( "VideoFormatToken");
Skip_L4( "VideoStandard");
Skip_L4( "VerticalRefreshRate");
Skip_L4( "HTotalInT");
Skip_L4( "VTotalInLines");
Get_L2 (FrameAspectRatio_H, "FrameAspectRatio Height");
Get_L2 (FrameAspectRatio_W, "FrameAspectRatio Width");
Skip_L4( "FrameWidthInPixels");
Skip_L4( "FrameHeightInLines");
Get_L4 (FieldPerFrame, "FieldPerFrame");
vector<int32u> VideoYValidStartLines;
for (int32u Pos=0; Pos<FieldPerFrame; Pos++)
{
Element_Begin1("Field");
int32u VideoYValidStartLine;
Skip_L4( "CompressedBMHeight");
Skip_L4( "CompressedBMWidth");
Skip_L4( "ValidBMHeight");
Skip_L4( "ValidBMWidth");
Skip_L4( "ValidBMXOffset");
Skip_L4( "ValidBMYOffset");
Skip_L4( "VideoXOffsetInT");
Get_L4 (VideoYValidStartLine, "VideoYValidStartLine");
VideoYValidStartLines.push_back(VideoYValidStartLine);
Element_End0();
}
if(Element_Offset<Element_Size)
Skip_XX(Element_Size-Element_Offset, "Unknown");
FILLING_BEGIN();
if (FrameAspectRatio_H && FrameAspectRatio_W)
Fill(Stream_Video, 0, Video_DisplayAspectRatio, ((float32)FrameAspectRatio_W)/FrameAspectRatio_H, 3);
switch (FieldPerFrame)
{
case 1 :
Fill(Stream_Video, 0, Video_ScanType, "Progressive");
break;
case 2 :
Fill(Stream_Video, 0, Video_ScanType, "Interlaced");
if (VideoYValidStartLines.size()==2 && VideoYValidStartLines[0]<VideoYValidStartLines[1])
Fill(Stream_Video, 0, Video_ScanOrder, "TFF");
if (VideoYValidStartLines.size()==2 && VideoYValidStartLines[0]>VideoYValidStartLines[1])
Fill(Stream_Video, 0, Video_ScanOrder, "BFF");
default: ;
}
FILLING_END();
}
//---------------------------------------------------------------------------
void File_Riff::AVI__hdlr_xxxx()
{
AVI__INFO_xxxx();
}
//---------------------------------------------------------------------------
void File_Riff::AVI__idx1()
{
Element_Name("Index (old)");
//Tests
if (!NeedOldIndex || Idx1_Offset==(int64u)-1)
{
Skip_XX(Element_Size, "Data");
return;
}
//Testing malformed index (index is based on start of the file, wrong)
if (16<=Element_Size && Idx1_Offset+4==LittleEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset+ 8))
Idx1_Offset=0; //Fixing base of movi atom, the index think it is the start of the file
//Parsing
while (Element_Offset+16<=Element_Size)
{
//Is too slow
/*
int32u ChunkID, Offset, Size;
Element_Begin1("Index");
Get_C4 (ChunkID, "ChunkID"); //Bit 31 is set if this is NOT a keyframe
Info_L4(Flags, "Flags");
Skip_Flags(Flags, 0, "NoTime");
Skip_Flags(Flags, 1, "Lastpart");
Skip_Flags(Flags, 2, "Firstpart");
Skip_Flags(Flags, 3, "Midpart");
Skip_Flags(Flags, 4, "KeyFrame");
Get_L4 (Offset, "Offset"); //qwBaseOffset + this is absolute file offset
Get_L4 (Size, "Size"); //Bit 31 is set if this is NOT a keyframe
Element_Info1(Ztring().From_CC4(ChunkID));
Element_Info1(Size);
//Stream Pos and Size
int32u StreamID=(ChunkID&0xFFFF0000);
Stream[StreamID].StreamSize+=Size;
Stream[StreamID].PacketCount++;
Stream_Structure[Idx1_Offset+Offset].Name=StreamID;
Stream_Structure[Idx1_Offset+Offset].Size=Size;
Element_End0();
*/
//Faster method
int32u StreamID=BigEndian2int32u (Buffer+Buffer_Offset+(size_t)Element_Offset )&0xFFFF0000;
int32u Offset =LittleEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset+ 8);
int32u Size =LittleEndian2int32u(Buffer+Buffer_Offset+(size_t)Element_Offset+12);
stream& Stream_Item=Stream[StreamID];
Stream_Item.StreamSize+=Size;
Stream_Item.PacketCount++;
stream_structure& Stream_Structure_Item=Stream_Structure[Idx1_Offset+Offset];
Stream_Structure_Item.Name=StreamID;
Stream_Structure_Item.Size=Size;
Element_Offset+=16;
}
//Interleaved
size_t Pos0=0;
size_t Pos1=0;
for (std::map<int64u, stream_structure>::iterator Temp=Stream_Structure.begin(); Temp!=Stream_Structure.end(); ++Temp)
{
switch (Temp->second.Name)
{
case 0x30300000 :
if (Interleaved0_1==0) Interleaved0_1=Temp->first;
if (Interleaved0_10==0)
{
Pos0++;
if (Pos0>1)
Interleaved0_10=Temp->first;
}
break;
case 0x30310000 :
if (Interleaved1_1==0) Interleaved1_1=Temp->first;
if (Interleaved1_10==0)
{
Pos1++;
if (Pos1>1)
Interleaved1_10=Temp->first;
}
break;
default:;
}
}
}
//---------------------------------------------------------------------------
void File_Riff::AVI__INFO()
{
Element_Name("Tags");
}
//---------------------------------------------------------------------------
void File_Riff::AVI__INFO_IID3()
{
Element_Name("ID3 Tag");
//Parsing
#if defined(MEDIAINFO_ID3_YES)
File_Id3 MI;
Open_Buffer_Init(&MI);
Open_Buffer_Continue(&MI);
Finish(&MI);
Merge(MI, Stream_General, 0, 0);
#endif
}
//---------------------------------------------------------------------------
void File_Riff::AVI__INFO_ILYC()
{
Element_Name("Lyrics");
}
//---------------------------------------------------------------------------
void File_Riff::AVI__INFO_IMP3()
{
Element_Name("MP3 Information");
}
//---------------------------------------------------------------------------
void File_Riff::AVI__INFO_JUNK()
{
Element_Name("Garbage");
}
//---------------------------------------------------------------------------
// List of information atoms
// Name X bytes, Pos=0
//
void File_Riff::AVI__INFO_xxxx()
{
//Parsing
Ztring Value;
Get_Local(Element_Size, Value, "Value");
//Filling
stream_t StreamKind=Stream_General;
size_t StreamPos=0;
size_t Parameter=(size_t)-1;
switch (Element_Code)
{
case 0x00000000 : Parameter=General_Comment; break;
case Elements::AVI__INFO_IARL : Parameter=General_Archival_Location; break;
case Elements::AVI__INFO_IART : Parameter=General_Director; break;
case Elements::AVI__INFO_IAS1 : Parameter=Audio_Language; StreamKind=Stream_Audio; StreamPos=0; break;
case Elements::AVI__INFO_IAS2 : Parameter=Audio_Language; StreamKind=Stream_Audio; StreamPos=1; break;
case Elements::AVI__INFO_IAS3 : Parameter=Audio_Language; StreamKind=Stream_Audio; StreamPos=2; break;
case Elements::AVI__INFO_IAS4 : Parameter=Audio_Language; StreamKind=Stream_Audio; StreamPos=3; break;
case Elements::AVI__INFO_IAS5 : Parameter=Audio_Language; StreamKind=Stream_Audio; StreamPos=4; break;
case Elements::AVI__INFO_IAS6 : Parameter=Audio_Language; StreamKind=Stream_Audio; StreamPos=5; break;
case Elements::AVI__INFO_IAS7 : Parameter=Audio_Language; StreamKind=Stream_Audio; StreamPos=6; break;
case Elements::AVI__INFO_IAS8 : Parameter=Audio_Language; StreamKind=Stream_Audio; StreamPos=7; break;
case Elements::AVI__INFO_IAS9 : Parameter=Audio_Language; StreamKind=Stream_Audio; StreamPos=8; break;
case Elements::AVI__INFO_ICDS : Parameter=General_CostumeDesigner; break;
case Elements::AVI__INFO_ICMS : Parameter=General_CommissionedBy; break;
case Elements::AVI__INFO_ICMT : Parameter=General_Comment; break;
case Elements::AVI__INFO_ICNM : Parameter=General_DirectorOfPhotography; break;
case Elements::AVI__INFO_ICNT : Parameter=General_Movie_Country; break;
case Elements::AVI__INFO_ICOP : Parameter=General_Copyright; break;
case Elements::AVI__INFO_ICRD : Parameter=General_Recorded_Date; Value.Date_From_String(Value.To_Local().c_str()); break;
case Elements::AVI__INFO_ICRP : Parameter=General_Cropped; break;
case Elements::AVI__INFO_IDIM : Parameter=General_Dimensions; break;
case Elements::AVI__INFO_IDIT : Parameter=General_Mastered_Date; Value.Date_From_String(Value.To_Local().c_str()); break;
case Elements::AVI__INFO_IDPI : Parameter=General_DotsPerInch; break;
case Elements::AVI__INFO_IDST : Parameter=General_DistributedBy; break;
case Elements::AVI__INFO_IEDT : Parameter=General_EditedBy; break;
case Elements::AVI__INFO_IENG : Parameter=General_EncodedBy; break;
case Elements::AVI__INFO_IGNR : Parameter=General_Genre; break;
case Elements::AVI__INFO_IFRM : Parameter=General_Part_Position_Total; break;
case Elements::AVI__INFO_IKEY : Parameter=General_Keywords; break;
case Elements::AVI__INFO_ILGT : Parameter=General_Lightness; break;
case Elements::AVI__INFO_ILNG : Parameter=Audio_Language; StreamKind=Stream_Audio; break;
case Elements::AVI__INFO_IMED : Parameter=General_OriginalSourceMedium; break;
case Elements::AVI__INFO_IMUS : Parameter=General_MusicBy; break;
case Elements::AVI__INFO_INAM : Parameter=General_Title; break;
case Elements::AVI__INFO_IPDS : Parameter=General_ProductionDesigner; break;
case Elements::AVI__INFO_IPLT : Parameter=General_OriginalSourceForm_NumColors; break;
case Elements::AVI__INFO_IPRD : Parameter=General_OriginalSourceForm_Name; break;
case Elements::AVI__INFO_IPRO : Parameter=General_Producer; break;
case Elements::AVI__INFO_IPRT : Parameter=General_Part_Position; break;
case Elements::AVI__INFO_IRTD : Parameter=General_LawRating; break;
case Elements::AVI__INFO_ISBJ : Parameter=General_Subject; break;
case Elements::AVI__INFO_ISFT : Parameter=General_Encoded_Application; break;
case Elements::AVI__INFO_ISGN : Parameter=General_Genre; break;
case Elements::AVI__INFO_ISHP : Parameter=General_OriginalSourceForm_Sharpness; break;
case Elements::AVI__INFO_ISRC : Parameter=General_OriginalSourceForm_DistributedBy; break;
case Elements::AVI__INFO_ISRF : Parameter=General_OriginalSourceForm; break;
case Elements::AVI__INFO_ISTD : Parameter=General_ProductionStudio; break;
case Elements::AVI__INFO_ISTR : Parameter=General_Performer; break;
case Elements::AVI__INFO_ITCH : Parameter=General_EncodedBy; break;
case Elements::AVI__INFO_IWEB : Parameter=General_Movie_Url; break;
case Elements::AVI__INFO_IWRI : Parameter=General_WrittenBy; break;
default : ;
}
Element_Name(MediaInfoLib::Config.Info_Get(StreamKind, Parameter, Info_Name));
Element_Info1(Value);
switch (Element_Code)
{
case Elements::AVI__INFO_ISMP : INFO_ISMP=Value;
break;
case Elements::AVI__INFO_IGNR :
{
Ztring ISGN=Retrieve(Stream_General, 0, General_Genre);
Clear(Stream_General, 0, General_Genre);
Fill(StreamKind, StreamPos, General_Genre, Value);
if (!ISGN.empty())
Fill(StreamKind, StreamPos, General_Genre, ISGN);
}
break;
default :
if (!Value.empty())
{
if (Parameter!=(size_t)-1)
Fill(StreamKind, StreamPos, Parameter, Value);
else
Fill(StreamKind, StreamPos, Ztring().From_CC4((int32u)Element_Code).To_Local().c_str(), Value, true);
}
}
}
//---------------------------------------------------------------------------
void File_Riff::AVI__JUNK()
{
Element_Name("Garbage"); //Library defined size for padding, often used to store library name
if (Element_Size<8)
{
Skip_XX(Element_Size, "Junk");
return;
}
//Detect DivX files
if (CC5(Buffer+Buffer_Offset)==CC5("DivX "))
{
Fill(Stream_General, 0, General_Format, "DivX", Unlimited, true, true);
}
//MPlayer
else if (CC8(Buffer+Buffer_Offset)==CC8("[= MPlay") && Retrieve(Stream_General, 0, General_Encoded_Library).empty())
Fill(Stream_General, 0, General_Encoded_Library, "MPlayer");
//Scenalyzer
else if (CC8(Buffer+Buffer_Offset)==CC8("scenalyz") && Retrieve(Stream_General, 0, General_Encoded_Library).empty())
Fill(Stream_General, 0, General_Encoded_Library, "Scenalyzer");
//FFMpeg broken files detection
else if (CC8(Buffer+Buffer_Offset)==CC8("odmldmlh"))
dmlh_TotalFrame=0; //this is not normal to have this string in a JUNK block!!! and in files tested, in this case TotalFrame is broken too
//VirtualDubMod
else if (CC8(Buffer+Buffer_Offset)==CC8("INFOISFT"))
{
int32u Size=LittleEndian2int32u(Buffer+Buffer_Offset+8);
if (Size>Element_Size-12)
Size=(int32u)Element_Size-12;
Fill(Stream_General, 0, General_Encoded_Library, (const char*)(Buffer+Buffer_Offset+12), Size);
}
else if (CC8(Buffer+Buffer_Offset)==CC8("INFOIENG"))
{
int32u Size=LittleEndian2int32u(Buffer+Buffer_Offset+8);
if (Size>Element_Size-12)
Size=(int32u)Element_Size-12;
Fill(Stream_General, 0, General_Encoded_Library, (const char*)(Buffer+Buffer_Offset+12), Size);
}
//Other libraries?
else if (CC1(Buffer+Buffer_Offset)>=CC1("A") && CC1(Buffer+Buffer_Offset)<=CC1("z") && Retrieve(Stream_General, 0, General_Encoded_Library).empty())
Fill(Stream_General, 0, General_Encoded_Library, (const char*)(Buffer+Buffer_Offset), (size_t)Element_Size);
Skip_XX(Element_Size, "Data");
}
//---------------------------------------------------------------------------
void File_Riff::AVI__MD5_()
{
//Parsing
while (Element_Offset<Element_Size)
{
int128u MD5Stored;
Get_L16 (MD5Stored, "MD5");
Ztring MD5_PerItem;
MD5_PerItem.From_Number(MD5Stored, 16);
while (MD5_PerItem.size()<32)
MD5_PerItem.insert(MD5_PerItem.begin(), '0'); //Padding with 0, this must be a 32-byte string
MD5_PerItem.MakeLowerCase();
MD5s.push_back(MD5_PerItem);
}
}
//---------------------------------------------------------------------------
void File_Riff::AVI__movi()
{
Element_Name("Datas");
//Only the first time, no need in AVIX
if (movi_Size==0)
{
Idx1_Offset=File_Offset+Buffer_Offset-4;
BookMark_Set(); //Remenbering this place, for stream parsing in phase 2
//For each stream
std::map<int32u, stream>::iterator Temp=Stream.begin();
while (Temp!=Stream.end())
{
if ((Temp->second.Parsers.empty() || Temp->second.Parsers[0]==NULL) && Temp->second.fccType!=Elements::AVI__hdlr_strl_strh_txts)
{
Temp->second.SearchingPayload=false;
stream_Count--;
}
++Temp;
}
}
//Probing rec (with index, this is not always tested in the flow
if (Element_Size<12)
{
Element_WaitForMoreData();
return;
}
if (CC4(Buffer+Buffer_Offset+8)==0x72656320) //"rec "
rec__Present=true;
//Filling
if (!SecondPass)
movi_Size+=Element_TotalSize_Get();
//We must parse moov?
if (NeedOldIndex || (stream_Count==0 && Index_Pos.empty()))
{
//Jumping
#if MEDIAINFO_TRACE
if (Trace_Activated)
Param("Data", Ztring("(")+Ztring::ToZtring(Element_TotalSize_Get())+Ztring(" bytes)"));
#endif //MEDIAINFO_TRACE
Element_Offset=Element_TotalSize_Get(); //Not using Skip_XX() because we want to skip data we don't have, and Skip_XX() does a test on size of buffer
return;
}
//Jump to next useful data
AVI__movi_StreamJump();
}
//---------------------------------------------------------------------------
void File_Riff::AVI__movi_rec_()
{
Element_Name("Syncronisation");
rec__Present=true;
}
//---------------------------------------------------------------------------
void File_Riff::AVI__movi_rec__xxxx()
{
AVI__movi_xxxx();
}
//---------------------------------------------------------------------------
void File_Riff::AVI__movi_xxxx()
{
if (Element_Code==Elements::AVI__JUNK)
{
Skip_XX(Element_Size, "Junk");
AVI__movi_StreamJump();
return;
}
if (Element_Code!=(int64u)-1)
Stream_ID=(int32u)(Element_Code&0xFFFF0000);
else
Stream_ID=(int32u)-1;
if (Stream_ID==0x69780000) //ix..
{
//AVI Standard Index Chunk
AVI__hdlr_strl_indx();
Stream_ID=(int32u)(Element_Code&0x0000FFFF)<<16;
AVI__movi_StreamJump();
return;
}
if ((Element_Code&0x0000FFFF)==0x00006978) //..ix (Out of specs, but found in a Adobe After Effects CS4 DV file
{
//AVI Standard Index Chunk
AVI__hdlr_strl_indx();
Stream_ID=(int32u)(Element_Code&0xFFFF0000);
AVI__movi_StreamJump();
return;
}
stream& StreamItem = Stream[Stream_ID];
#if MEDIAINFO_DEMUX
if (StreamItem.Rate) //AVI
{
int64u Element_Code_Old=Element_Code;
Element_Code=((Element_Code_Old>>24)&0xF)*10+((Element_Code_Old>>16)&0xF);
Frame_Count_NotParsedIncluded= StreamItem.PacketPos;
FrameInfo.DTS=Frame_Count_NotParsedIncluded*1000000000* StreamItem.Scale/ StreamItem.Rate;
Demux(Buffer+Buffer_Offset, (size_t)Element_Size, ContentType_MainStream);
Element_Code=Element_Code_Old;
Frame_Count_NotParsedIncluded=(int64u)-1;
}
else //WAV
{
//TODO
}
#endif //MEDIAINFO_DEMUX
StreamItem.PacketPos++;
//Finished?
if (!StreamItem.SearchingPayload)
{
Element_DoNotShow();
AVI__movi_StreamJump();
return;
}
#if MEDIAINFO_TRACE
if (Config_Trace_Level)
{
switch (Element_Code&0x0000FFFF) //2 last bytes
{
case Elements::AVI__movi_xxxx_____ : Element_Info1("DV"); break;
case Elements::AVI__movi_xxxx___db :
case Elements::AVI__movi_xxxx___dc : Element_Info1("Video"); break;
case Elements::AVI__movi_xxxx___sb :
case Elements::AVI__movi_xxxx___tx : Element_Info1("Text"); break;
case Elements::AVI__movi_xxxx___wb : Element_Info1("Audio"); break;
default : Element_Info1("Unknown"); break;
}
Element_Info1(Stream[Stream_ID].PacketPos);
}
#endif //MEDIAINFO_TRACE
//Some specific stuff
switch (Element_Code&0x0000FFFF) //2 last bytes
{
case Elements::AVI__movi_xxxx___tx : AVI__movi_xxxx___tx(); break;
default : ;
}
//Parsing
for (size_t Pos=0; Pos<StreamItem.Parsers.size(); Pos++)
if (StreamItem.Parsers[Pos])
{
if (FrameInfo.PTS!=(int64u)-1)
StreamItem.Parsers[Pos]->FrameInfo.PTS=FrameInfo.PTS;
if (FrameInfo.DTS!=(int64u)-1)
StreamItem.Parsers[Pos]->FrameInfo.DTS=FrameInfo.DTS;
Open_Buffer_Continue(StreamItem.Parsers[Pos], Buffer+Buffer_Offset+(size_t)Element_Offset, (size_t)(Element_Size-Element_Offset));
Element_Show();
if (StreamItem.Parsers.size()==1 && StreamItem.Parsers[Pos]->Buffer_Size>0)
StreamItem.ChunksAreComplete=false;
if (StreamItem.Parsers.size()>1)
{
if (!StreamItem.Parsers[Pos]->Status[IsAccepted] && StreamItem.Parsers[Pos]->Status[IsFinished])
{
delete *(StreamItem.Parsers.begin()+Pos);
StreamItem.Parsers.erase(StreamItem.Parsers.begin()+Pos);
Pos--;
}
else if (StreamItem.Parsers.size()>1 && StreamItem.Parsers[Pos]->Status[IsAccepted])
{
File__Analyze* Parser= StreamItem.Parsers[Pos];
for (size_t Pos2=0; Pos2<StreamItem.Parsers.size(); Pos2++)
{
if (Pos2!=Pos)
delete *(StreamItem.Parsers.begin()+Pos2);
}
StreamItem.Parsers.clear();
StreamItem.Parsers.push_back(Parser);
Pos=0;
}
}
#if MEDIAINFO_DEMUX
if (Config->Demux_EventWasSent)
{
Demux_Parser= StreamItem.Parsers[Pos];
return;
}
#endif //MEDIAINFO_DEMUX
}
Element_Offset=Element_Size;
//Some specific stuff
switch (Element_Code&0x0000FFFF) //2 last bytes
{
case Elements::AVI__movi_xxxx_____ :
case Elements::AVI__movi_xxxx___db :
case Elements::AVI__movi_xxxx___dc : AVI__movi_xxxx___dc(); break;
case Elements::AVI__movi_xxxx___wb : AVI__movi_xxxx___wb(); break;
default : ;
}
//We must always parse moov?
AVI__movi_StreamJump();
Element_Show();
}
//---------------------------------------------------------------------------
void File_Riff::AVI__movi_xxxx___dc()
{
//Finish (if requested)
stream& StreamItem = Stream[Stream_ID];
if (StreamItem.Parsers.empty()
|| StreamItem.Parsers[0]->Status[IsFinished]
|| (StreamItem.PacketPos>=300 && MediaInfoLib::Config.ParseSpeed_Get()<1.00))
{
StreamItem.SearchingPayload=false;
stream_Count--;
return;
}
}
//---------------------------------------------------------------------------
void File_Riff::AVI__movi_xxxx___tx()
{
//Parsing
int32u Name_Size;
Ztring Value;
int32u GAB2;
Peek_B4(GAB2);
if (GAB2==0x47414232 && Element_Size>=17)
{
Skip_C4( "GAB2");
Skip_L1( "Zero");
Skip_L2( "CodePage"); //2=Unicode
Get_L4 (Name_Size, "Name_Size");
Skip_UTF16L(Name_Size, "Name");
Skip_L2( "Four");
Skip_L4( "File_Size");
if (Element_Offset>Element_Size)
Element_Offset=Element_Size; //Problem
}
//Skip it
Stream[Stream_ID].SearchingPayload=false;
stream_Count--;
}
//---------------------------------------------------------------------------
void File_Riff::AVI__movi_xxxx___wb()
{
//Finish (if requested)
stream& StreamItem = Stream[Stream_ID];
if (StreamItem.PacketPos>=4 //For having the chunk alignement
&& (StreamItem.Parsers.empty()
|| StreamItem.Parsers[0]->Status[IsFinished]
|| (StreamItem.PacketPos>=300 && MediaInfoLib::Config.ParseSpeed_Get()<1.00)))
{
StreamItem.SearchingPayload=false;
stream_Count--;
}
}
//---------------------------------------------------------------------------
void File_Riff::AVI__movi_StreamJump()
{
//Jump to next useful data
if (!Index_Pos.empty())
{
if (Index_Pos.begin()->first<=File_Offset+Buffer_Offset && Element_Code!=Elements::AVI__movi)
Index_Pos.erase(Index_Pos.begin());
int64u ToJump=File_Size;
if (!Index_Pos.empty())
ToJump=Index_Pos.begin()->first;
if (ToJump>File_Size)
ToJump=File_Size;
if (ToJump>=File_Offset+Buffer_Offset+Element_TotalSize_Get(Element_Level-2)) //We want always Element movi
{
#if MEDIAINFO_HASH
if (Config->File_Hash_Get().to_ulong() && SecondPass)
Hash_ParseUpTo=File_Offset+Buffer_Offset+Element_TotalSize_Get(Element_Level-2);
else
#endif //MEDIAINFO_HASH
GoTo(File_Offset+Buffer_Offset+Element_TotalSize_Get(Element_Level-2), "AVI"); //Not in this chunk
}
else if (ToJump!=File_Offset+Buffer_Offset+(Element_Code==Elements::AVI__movi?0:Element_Size))
{
#if MEDIAINFO_HASH
if (Config->File_Hash_Get().to_ulong() && SecondPass)
Hash_ParseUpTo=File_Offset+Buffer_Offset+Element_TotalSize_Get(Element_Level-2);
else
#endif //MEDIAINFO_HASH
GoTo(ToJump, "AVI"); //Not just after
}
}
else if (stream_Count==0)
{
//Jumping
Element_Show();
if (rec__Present)
Element_End0();
Info("movi, Jumping to end of chunk");
if (SecondPass)
{
std::map<int32u, stream>::iterator Temp=Stream.begin();
while (Temp!=Stream.end())
{
for (size_t Pos=0; Pos<Temp->second.Parsers.size(); ++Pos)
{
Temp->second.Parsers[Pos]->Fill();
Temp->second.Parsers[Pos]->Open_Buffer_Unsynch();
}
++Temp;
}
Finish("AVI"); //The rest is already parsed
}
else
GoTo(File_Offset+Buffer_Offset+Element_TotalSize_Get(), "AVI");
}
else if (Stream_Structure_Temp!=Stream_Structure.end())
{
do
Stream_Structure_Temp++;
while (Stream_Structure_Temp!=Stream_Structure.end() && !(Stream[(int32u)Stream_Structure_Temp->second.Name].SearchingPayload && Config->ParseSpeed<1.0));
if (Stream_Structure_Temp!=Stream_Structure.end())
{
int64u ToJump=Stream_Structure_Temp->first;
if (ToJump>=File_Offset+Buffer_Offset+Element_TotalSize_Get(Element_Level-2))
{
#if MEDIAINFO_HASH
if (Config->File_Hash_Get().to_ulong() && SecondPass)
Hash_ParseUpTo=File_Offset+Buffer_Offset+Element_TotalSize_Get(Element_Level-2);
else
#endif //MEDIAINFO_HASH
GoTo(File_Offset+Buffer_Offset+Element_TotalSize_Get(Element_Level-2), "AVI"); //Not in this chunk
}
else if (ToJump!=File_Offset+Buffer_Offset+Element_Size)
{
#if MEDIAINFO_HASH
if (Config->File_Hash_Get().to_ulong() && SecondPass)
Hash_ParseUpTo=ToJump;
else
#endif //MEDIAINFO_HASH
GoTo(ToJump, "AVI"); //Not just after
}
}
else
Finish("AVI");
}
}
//---------------------------------------------------------------------------
void File_Riff::AVI__PrmA()
{
Element_Name("Adobe Premiere PrmA");
//Parsing
int32u FourCC, Size;
Get_C4 (FourCC, "FourCC");
Get_B4 (Size, "Size");
switch (FourCC)
{
case 0x50415266:
if (Size==20)
{
int32u PAR_X, PAR_Y;
Skip_B4( "Unknown");
Get_B4 (PAR_X, "PAR_X");
Get_B4 (PAR_Y, "PAR_Y");
if (PAR_Y)
PAR=((float64)PAR_X)/PAR_Y;
}
else
Skip_XX(Element_Size-Element_Offset, "Unknown");
break;
default:
for (int32u Pos=8; Pos<Size; Pos++)
Skip_B4( "Unknown");
}
}
//---------------------------------------------------------------------------
void File_Riff::AVI__Tdat()
{
Element_Name("Adobe Premiere Tdat");
}
//---------------------------------------------------------------------------
void File_Riff::AVI__Tdat_tc_A()
{
Element_Name("tc_A");
//Parsing
Ztring Value;
Get_Local(Element_Size, Value, "Unknown");
if (Value.find_first_not_of(__T("0123456789:;"))==string::npos)
Tdat_tc_A=Value;
}
//---------------------------------------------------------------------------
void File_Riff::AVI__Tdat_tc_O()
{
Element_Name("tc_O");
//Parsing
Ztring Value;
Get_Local(Element_Size, Value, "Unknown");
if (Value.find_first_not_of(__T("0123456789:;"))==string::npos)
Tdat_tc_O=Value;
}
//---------------------------------------------------------------------------
void File_Riff::AVI__Tdat_rn_A()
{
Element_Name("rn_A");
//Parsing
Skip_Local(Element_Size, "Unknown");
}
//---------------------------------------------------------------------------
void File_Riff::AVI__Tdat_rn_O()
{
Element_Name("rn_O");
//Parsing
Skip_Local(Element_Size, "Unknown");
}
//---------------------------------------------------------------------------
void File_Riff::AVI__xxxx()
{
Stream_ID=(int32u)(Element_Code&0xFFFF0000);
if (Stream_ID==0x69780000) //ix..
{
//AVI Standard Index Chunk
AVI__hdlr_strl_indx();
Stream_ID=(int32u)(Element_Code&0x0000FFFF)<<16;
AVI__movi_StreamJump();
return;
}
if ((Element_Code&0x0000FFFF)==0x00006978) //..ix (Out of specs, but found in a Adobe After Effects CS4 DV file
{
//AVI Standard Index Chunk
AVI__hdlr_strl_indx();
Stream_ID=(int32u)(Element_Code&0xFFFF0000);
AVI__movi_StreamJump();
return;
}
}
//---------------------------------------------------------------------------
void File_Riff::AVIX()
{
//Filling
Fill(Stream_General, 0, General_Format_Profile, "OpenDML", Unlimited, true, true);
}
//---------------------------------------------------------------------------
void File_Riff::AVIX_idx1()
{
AVI__idx1();
}
//---------------------------------------------------------------------------
void File_Riff::AVIX_movi()
{
AVI__movi();
}
//---------------------------------------------------------------------------
void File_Riff::AVIX_movi_rec_()
{
AVI__movi_rec_();
}
//---------------------------------------------------------------------------
void File_Riff::AVIX_movi_rec__xxxx()
{
AVIX_movi_xxxx();
}
//---------------------------------------------------------------------------
void File_Riff::AVIX_movi_xxxx()
{
AVI__movi_xxxx();
}
//---------------------------------------------------------------------------
void File_Riff::CADP()
{
Element_Name("CMP4 - ADPCM");
//Testing if we have enough data
if (Element_Size<4)
{
Element_WaitForMoreData();
return;
}
//Parsing
int32u Codec;
Get_C4 (Codec, "Codec");
#if MEDIAINFO_TRACE
if (Trace_Activated)
Param("Data", Ztring("(")+Ztring::ToZtring(Element_TotalSize_Get()-Element_Offset)+Ztring(" bytes)"));
#endif //MEDIAINFO_TRACE
Element_Offset=Element_TotalSize_Get(); //Not using Skip_XX() because we want to skip data we don't have, and Skip_XX() does a test on size of buffer
FILLING_BEGIN();
Stream_Prepare(Stream_Audio);
if (Codec==0x41647063) //Adpc
Fill(Stream_Audio, StreamPos_Last, Audio_Format, "ADPCM");
Fill(Stream_Audio, StreamPos_Last, Audio_StreamSize, Element_TotalSize_Get());
FILLING_END();
}
//---------------------------------------------------------------------------
void File_Riff::CDDA()
{
Element_Name("Compact Disc for Digital Audio");
//Filling
Accept("CDDA");
}
//---------------------------------------------------------------------------
void File_Riff::CDDA_fmt_()
{
//Specs: http://fr.wikipedia.org/wiki/Compact_Disc_Audio_track
//Specs: http://www.moon-soft.com/program/FORMAT/sound/cda.htm
Element_Name("Stream format");
//Parsing
int32u id;
int16u Version, tracknb=1;
int8u TPositionF=0, TPositionS=0, TPositionM=0, TDurationF=0, TDurationS=0, TDurationM=0;
Get_L2 (Version, "Version"); // Always 1
if (Version!=1)
{
//Not supported
Skip_XX(Element_Size-2, "Data");
return;
}
Get_L2 (tracknb, "Number"); // Start at 1
Get_L4 (id, "id");
Skip_L4( "offset"); // in frames //Priority of FSM format
Skip_L4( "Duration"); // in frames //Priority of FSM format
Get_L1 (TPositionF, "Track_PositionF"); // in frames
Get_L1 (TPositionS, "Track_PositionS"); // in seconds
Get_L1 (TPositionM, "Track_PositionM"); // in minutes
Skip_L1( "empty");
Get_L1 (TDurationF, "Track_DurationF"); // in frames
Get_L1 (TDurationS, "Track_DurationS"); // in seconds
Get_L1 (TDurationM, "Track_DurationM"); // in minutes
Skip_L1( "empty");
FILLING_BEGIN();
int32u TPosition=TPositionM*60*75+TPositionS*75+TPositionF;
int32u TDuration=TDurationM*60*75+TDurationS*75+TDurationF;
Fill(Stream_General, 0, General_Track_Position, tracknb);
Fill(Stream_General, 0, General_Format, "CDDA");
Fill(Stream_General, 0, General_Format_Info, "Compact Disc for Digital Audio");
Fill(Stream_General, 0, General_UniqueID, id);
Fill(Stream_General, 0, General_FileSize, File_Size+TDuration*2352, 10, true);
Stream_Prepare(Stream_Audio);
Fill(Stream_Audio, 0, Audio_Format, "PCM");
Fill(Stream_Audio, 0, Audio_Format_Settings_Endianness, "Little");
Fill(Stream_Audio, 0, Audio_BitDepth, 16);
Fill(Stream_Audio, 0, Audio_Channel_s_, 2);
Fill(Stream_Audio, 0, Audio_SamplingRate, 44100);
Fill(Stream_Audio, 0, Audio_FrameRate, (float)75);
Fill(Stream_Audio, 0, Audio_BitRate, 1411200);
Fill(Stream_Audio, 0, Audio_Compression_Mode, "Lossless");
Fill(Stream_Audio, 0, Audio_FrameCount, TDuration);
Fill(Stream_Audio, 0, Audio_Duration, float32_int32s(((float32)TDuration)*1000/75));
Fill(Stream_Audio, 0, Audio_Delay, float32_int32s(((float32)TPosition)*1000/75));
//No more need data
Finish("CDDA");
FILLING_END();
}
//---------------------------------------------------------------------------
void File_Riff::CMJP()
{
Element_Name("CMP4 - JPEG");
//Parsing
#ifdef MEDIAINFO_JPEG_YES
Stream_ID=0;
File_Jpeg* Parser=new File_Jpeg;
Open_Buffer_Init(Parser);
Parser->StreamKind=Stream_Video;
Open_Buffer_Continue(Parser);
Element_Offset=Element_TotalSize_Get(); //Not using Skip_XX() because we want to skip data we don't have, and Skip_XX() does a test on size of buffer
FILLING_BEGIN();
Stream_Prepare(Stream_Video);
Fill(Stream_Video, StreamPos_Last, Video_StreamSize, Element_TotalSize_Get());
Finish(Parser);
Merge(*Parser, StreamKind_Last, 0, StreamPos_Last);
FILLING_END();
Stream[Stream_ID].Parsers.push_back(Parser);
#else
Element_Offset=Element_TotalSize_Get(); //Not using Skip_XX() because we want to skip data we don't have, and Skip_XX() does a test on size of buffer
FILLING_BEGIN();
Stream_Prepare(Stream_Video);
Fill(Stream_Video, StreamPos_Last, Video_Format, "JPEG");
Fill(Stream_Video, StreamPos_Last, Video_StreamSize, Element_TotalSize_Get());
FILLING_END();
#endif
}
//---------------------------------------------------------------------------
void File_Riff::CMP4()
{
Accept("CMP4");
Element_Name("CMP4 - Header");
//Parsing
Ztring Title;
Get_Local(Element_Size, Title, "Title");
FILLING_BEGIN();
Fill(Stream_General, 0, General_Format, "CMP4");
Fill(Stream_General, 0, "Title", Title);
FILLING_END();
}
//---------------------------------------------------------------------------
void File_Riff::IDVX()
{
Element_Name("Tags");
}
//---------------------------------------------------------------------------
void File_Riff::INDX()
{
Element_Name("Index (from which spec?)");
}
//---------------------------------------------------------------------------
void File_Riff::INDX_xxxx()
{
Stream_ID=(int32u)(Element_Code&0xFFFF0000);
if (Stream_ID==0x69780000) //ix..
{
//Index
int32u Entry_Count, ChunkId;
int16u LongsPerEntry;
int8u IndexType, IndexSubType;
Get_L2 (LongsPerEntry, "LongsPerEntry"); //Size of each entry in aIndex array
Get_L1 (IndexSubType, "IndexSubType");
Get_L1 (IndexType, "IndexType");
Get_L4 (Entry_Count, "EntriesInUse"); //Index of first unused member in aIndex array
Get_C4 (ChunkId, "ChunkId"); //FCC of what is indexed
Skip_L4( "Unknown");
Skip_L4( "Unknown");
Skip_L4( "Unknown");
for (int32u Pos=0; Pos<Entry_Count; Pos++)
{
Skip_L8( "Offset");
Skip_L4( "Size");
Skip_L4( "Frame number?");
Skip_L4( "Frame number?");
Skip_L4( "Zero");
}
}
//Currently, we do not use the index
//TODO: use the index
Stream_Structure.clear();
}
//---------------------------------------------------------------------------
void File_Riff::JUNK()
{
Element_Name("Junk");
//Parse
#if MEDIAINFO_TRACE
if (Trace_Activated)
Param("Junk", Ztring("(")+Ztring::ToZtring(Element_TotalSize_Get())+Ztring(" bytes)"));
#endif //MEDIAINFO_TRACE
Element_Offset=Element_TotalSize_Get(); //Not using Skip_XX() because we want to skip data we don't have, and Skip_XX() does a test on size of buffer
}
//---------------------------------------------------------------------------
void File_Riff::menu()
{
Element_Name("DivX Menu");
//Filling
Stream_Prepare(Stream_Menu);
Fill(Stream_Menu, StreamPos_Last, Menu_Format, "DivX Menu");
Fill(Stream_Menu, StreamPos_Last, Menu_Codec, "DivX");
}
//---------------------------------------------------------------------------
void File_Riff::MThd()
{
Element_Name("MIDI header");
//Parsing
Skip_B2( "format");
Skip_B2( "ntrks");
Skip_B2( "division");
FILLING_BEGIN_PRECISE();
Accept("MIDI");
Fill(Stream_General, 0, General_Format, "MIDI");
FILLING_ELSE();
Reject("MIDI");
FILLING_END();
}
//---------------------------------------------------------------------------
void File_Riff::MTrk()
{
Element_Name("MIDI Track");
//Parsing
#if MEDIAINFO_TRACE
if (Trace_Activated)
Param("Data", Ztring("(")+Ztring::ToZtring(Element_TotalSize_Get())+Ztring(" bytes)"));
#endif //MEDIAINFO_TRACE
Element_Offset=Element_TotalSize_Get(); //Not using Skip_XX() because we want to skip data we don't have, and Skip_XX() does a test on size of buffer
FILLING_BEGIN();
Stream_Prepare(Stream_Audio);
Fill(Stream_Audio, StreamPos_Last, Audio_Format, "MIDI");
Fill(Stream_Audio, StreamPos_Last, Audio_Codec, "Midi");
Finish("MIDI");
FILLING_END();
}
//---------------------------------------------------------------------------
void File_Riff::PAL_()
{
Data_Accept("RIFF Palette");
Element_Name("RIFF Palette");
//Filling
Fill(Stream_General, 0, General_Format, "RIFF Palette");
}
//---------------------------------------------------------------------------
void File_Riff::QLCM()
{
Data_Accept("QLCM");
Element_Name("QLCM");
//Filling
Fill(Stream_General, 0, General_Format, "QLCM");
}
//---------------------------------------------------------------------------
void File_Riff::QLCM_fmt_()
{
//Parsing
Ztring codec_name;
int128u codec_guid;
int32u num_rates;
int16u codec_version, average_bps, packet_size, block_size, sampling_rate, sample_size;
int8u major, minor;
Get_L1 (major, "major");
Get_L1 (minor, "minor");
Get_GUID(codec_guid, "codec-guid");
Get_L2 (codec_version, "codec-version");
Get_Local(80, codec_name, "codec-name");
Get_L2 (average_bps, "average-bps");
Get_L2 (packet_size, "packet-size");
Get_L2 (block_size, "block-size");
Get_L2 (sampling_rate, "sampling-rate");
Get_L2 (sample_size, "sample-size");
Element_Begin1("rate-map-table");
Get_L4 (num_rates, "num-rates");
for (int32u rate=0; rate<num_rates; rate++)
{
Skip_L2( "rate-size");
Skip_L2( "rate-octet");
}
Element_End0();
Skip_L4( "Reserved");
Skip_L4( "Reserved");
Skip_L4( "Reserved");
Skip_L4( "Reserved");
if (Element_Offset<Element_Size)
Skip_L4( "Reserved"); //Some files don't have the 5th reserved dword
FILLING_BEGIN_PRECISE();
Stream_Prepare (Stream_Audio);
switch (codec_guid.hi)
{
case Elements::QLCM_QCELP1 :
case Elements::QLCM_QCELP2 : Fill(Stream_Audio, 0, Audio_Format, "QCELP"); Fill(Stream_Audio, 0, Audio_Codec, "QCELP"); break;
case Elements::QLCM_EVRC : Fill(Stream_Audio, 0, Audio_Format, "EVRC"); Fill(Stream_Audio, 0, Audio_Codec, "EVRC"); break;
case Elements::QLCM_SMV : Fill(Stream_Audio, 0, Audio_Format, "SMV"); Fill(Stream_Audio, 0, Audio_Codec, "SMV"); break;
default : ;
}
Fill(Stream_Audio, 0, Audio_BitRate, average_bps);
Fill(Stream_Audio, 0, Audio_SamplingRate, sampling_rate);
Fill(Stream_Audio, 0, Audio_BitDepth, sample_size);
Fill(Stream_Audio, 0, Audio_Channel_s_, 1);
FILLING_END();
}
#if defined(MEDIAINFO_GXF_YES)
//---------------------------------------------------------------------------
void File_Riff::rcrd()
{
Data_Accept("Ancillary media packets");
Element_Name("Ancillary media packets");
//Filling
if (Retrieve(Stream_General, 0, General_Format).empty())
Fill(Stream_General, 0, General_Format, "Ancillary media packets"); //GXF, RDD14-2007
//Clearing old data
if (Ancillary)
{
(*Ancillary)->FrameInfo.DTS=FrameInfo.DTS;
Open_Buffer_Continue(*Ancillary, Buffer, 0);
}
}
//---------------------------------------------------------------------------
void File_Riff::rcrd_desc()
{
Element_Name("Ancillary media packet description");
//Parsing
int32u Version;
Get_L4 (Version, "Version");
if (Version==2)
{
Skip_L4( "Number of fields");
Skip_L4( "Length of the ancillary data field descriptions");
Skip_L4( "Byte size of the complete ancillary media packet");
Skip_L4( "Format of the video");
}
else
Skip_XX(Element_Size-Element_Offset, "Unknown");
}
//---------------------------------------------------------------------------
void File_Riff::rcrd_fld_()
{
Element_Name("Ancillary data field description");
}
//---------------------------------------------------------------------------
void File_Riff::rcrd_fld__anc_()
{
Element_Name("Ancillary data sample description");
rcrd_fld__anc__pos__LineNumber=(int32u)-1;
}
//---------------------------------------------------------------------------
void File_Riff::rcrd_fld__anc__pos_()
{
Element_Name("Ancillary data sample description");
//Parsing
Get_L4 (rcrd_fld__anc__pos__LineNumber, "Video line number");
Skip_L4( "Ancillary video color difference or luma space");
Skip_L4( "Ancillary video space");
}
//---------------------------------------------------------------------------
void File_Riff::rcrd_fld__anc__pyld()
{
Element_Name("Ancillary data sample payload");
if (Ancillary)
{
(*Ancillary)->FrameInfo.DTS=FrameInfo.DTS;
(*Ancillary)->LineNumber=rcrd_fld__anc__pos__LineNumber;
Open_Buffer_Continue(*Ancillary);
}
}
//---------------------------------------------------------------------------
void File_Riff::rcrd_fld__finf()
{
Element_Name("Data field description");
//Parsing
Skip_L4( "Video field identifier");
}
#endif //MEDIAINFO_GXF_YES
//---------------------------------------------------------------------------
void File_Riff::RDIB()
{
Data_Accept("RIFF DIB");
Element_Name("RIFF DIB");
//Filling
Fill(Stream_General, 0, General_Format, "RIFF DIB");
}
//---------------------------------------------------------------------------
void File_Riff::RMID()
{
Data_Accept("RIFF MIDI");
Element_Name("RIFF MIDI");
//Filling
Fill(Stream_General, 0, General_Format, "RIFF MIDI");
}
//---------------------------------------------------------------------------
void File_Riff::RMMP()
{
Data_Accept("RIFF MMP");
Element_Name("RIFF MMP");
//Filling
Fill(Stream_General, 0, General_Format, "RIFF MMP");
}
//---------------------------------------------------------------------------
void File_Riff::RMP3()
{
Data_Accept("RMP3");
Element_Name("RMP3");
//Filling
Fill(Stream_General, 0, General_Format, "RMP3");
Kind=Kind_Rmp3;
}
//---------------------------------------------------------------------------
void File_Riff::RMP3_data()
{
Element_Name("Raw datas");
Fill(Stream_Audio, 0, Audio_StreamSize, Buffer_DataToParse_End-Buffer_DataToParse_Begin);
Stream_Prepare(Stream_Audio);
//Creating parser
#if defined(MEDIAINFO_MPEGA_YES)
File_Mpega* Parser=new File_Mpega;
Parser->CalculateDelay=true;
Parser->ShouldContinueParsing=true;
Open_Buffer_Init(Parser);
stream& StreamItem=Stream[(int32u)-1];
StreamItem.StreamKind=Stream_Audio;
StreamItem.StreamPos=0;
StreamItem.Parsers.push_back(Parser);
#else //MEDIAINFO_MPEG4_YES
Fill(Stream_Audio, 0, Audio_Format, "MPEG Audio");
Skip_XX(Buffer_DataToParse_End-Buffer_DataToParse_Begin, "Data");
#endif
}
//---------------------------------------------------------------------------
void File_Riff::RMP3_data_Continue()
{
#if MEDIAINFO_DEMUX
if (Element_Size)
{
Demux_random_access=true;
Demux(Buffer+Buffer_Offset, (size_t)Element_Size, ContentType_MainStream);
}
#endif //MEDIAINFO_DEMUX
Element_Code=(int64u)-1;
AVI__movi_xxxx();
}
//---------------------------------------------------------------------------
void File_Riff::SMV0()
{
Accept("SMV");
//Parsing
int8u Version;
Skip_C1( "Identifier (continuing)");
Get_C1 (Version, "Version");
Skip_C3( "Identifier (continuing)");
if (Version=='1')
{
int32u Width, Height, FrameRate, BlockSize, FrameCount;
Get_B3 (Width, "Width");
Get_B3 (Height, "Height");
Skip_B3( "0x000010");
Skip_B3( "0x000001");
Get_B3 (BlockSize, "Block size");
Get_B3 (FrameRate, "Frame rate");
Get_B3 (FrameCount, "Frame count");
Skip_B3( "0x000000");
Skip_B3( "0x000000");
Skip_B3( "0x000000");
Skip_B3( "0x010101");
Skip_B3( "0x010101");
Skip_B3( "0x010101");
Skip_B3( "0x010101");
//Filling
Fill(Stream_General, 0, General_Format_Profile, "SMV v1");
Stream_Prepare(Stream_Video);
Fill(Stream_Video, 0, Video_MuxingMode, "SMV v1");
Fill(Stream_Video, 0, Video_Width, Width);
Fill(Stream_Video, 0, Video_Height, Height);
Fill(Stream_Video, 0, Video_FrameRate, (float)FrameRate);
Fill(Stream_Video, 0, Video_FrameCount, FrameCount);
Finish("SMV");
}
else if (Version=='2')
{
int32u Width, Height, FrameRate;
Get_L3 (Width, "Width");
Get_L3 (Height, "Height");
Skip_L3( "0x000010");
Skip_L3( "0x000001");
Get_L3 (SMV_BlockSize, "Block size");
Get_L3 (FrameRate, "Frame rate");
Get_L3 (SMV_FrameCount, "Frame count");
Skip_L3( "0x000001");
Skip_L3( "0x000000");
Skip_L3( "Frame rate");
Skip_L3( "0x010101");
Skip_L3( "0x010101");
Skip_L3( "0x010101");
Skip_L3( "0x010101");
//Filling
SMV_BlockSize+=3;
SMV_FrameCount++;
Fill(Stream_General, 0, General_Format_Profile, "SMV v2");
Stream_Prepare(Stream_Video);
Fill(Stream_Video, 0, Video_Format, "JPEG");
Fill(Stream_Video, 0, Video_Codec, "JPEG");
Fill(Stream_Video, 0, Video_MuxingMode, "SMV v2");
Fill(Stream_Video, 0, Video_Width, Width);
Fill(Stream_Video, 0, Video_Height, Height);
Fill(Stream_Video, 0, Video_FrameRate, FrameRate);
Fill(Stream_Video, 0, Video_FrameCount, SMV_FrameCount);
Fill(Stream_Video, 0, Video_StreamSize, SMV_BlockSize*SMV_FrameCount);
}
else
Finish("SMV");
}
//---------------------------------------------------------------------------
void File_Riff::SMV0_xxxx()
{
//Parsing
int32u Size;
Get_L3 (Size, "Size");
#if defined(MEDIAINFO_JPEG_YES)
//Creating the parser
File_Jpeg MI;
Open_Buffer_Init(&MI);
//Parsing
Open_Buffer_Continue(&MI, Size);
//Filling
Finish(&MI);
Merge(MI, Stream_Video, 0, StreamPos_Last);
//Positioning
Element_Offset+=Size;
#else
//Parsing
Skip_XX(Size, "JPEG data");
#endif
Skip_XX(Element_Size-Element_Offset, "Padding");
//Filling
#if MEDIAINFO_HASH
if (Config->File_Hash_Get().to_ulong())
Element_Offset=Element_Size+(SMV_FrameCount-1)*SMV_BlockSize;
#endif //MEDIAINFO_HASH
Data_GoTo(File_Offset+Buffer_Offset+(size_t)Element_Size+(SMV_FrameCount-1)*SMV_BlockSize, "SMV");
SMV_BlockSize=0;
}
//---------------------------------------------------------------------------
void File_Riff::WAVE()
{
Data_Accept("Wave");
Element_Name("Wave");
//Filling
Fill(Stream_General, 0, General_Format, "Wave");
Kind=Kind_Wave;
#if MEDIAINFO_EVENTS
StreamIDs_Width[0]=0;
#endif //MEDIAINFO_EVENTS
}
//---------------------------------------------------------------------------
void File_Riff::WAVE__pmx()
{
Element_Name("XMP");
//Parsing
Ztring XML_Data;
Get_Local(Element_Size, XML_Data, "XML data");
}
//---------------------------------------------------------------------------
void File_Riff::WAVE_aXML()
{
Element_Name("aXML");
//Parsing
Skip_Local(Element_Size, "XML data");
}
//---------------------------------------------------------------------------
void File_Riff::WAVE_bext()
{
Element_Name("Broadcast extension");
//Parsing
Ztring Description, Originator, OriginatorReference, OriginationDate, OriginationTime, History;
int16u Version;
Get_Local(256, Description, "Description");
Get_Local( 32, Originator, "Originator");
Get_Local( 32, OriginatorReference, "OriginatorReference");
Get_Local( 10, OriginationDate, "OriginationDate");
Get_Local( 8, OriginationTime, "OriginationTime");
Get_L8 ( TimeReference, "TimeReference"); //To be divided by SamplesPerSec
Get_L2 ( Version, "Version");
if (Version==1)
Skip_UUID( "UMID");
Skip_XX (602-Element_Offset, "Reserved");
if (Element_Offset<Element_Size)
Get_Local(Element_Size-Element_Offset, History, "History");
FILLING_BEGIN();
Fill(Stream_General, 0, General_Description, Description);
Fill(Stream_General, 0, General_Producer, Originator);
Fill(Stream_General, 0, "Producer_Reference", OriginatorReference);
Fill(Stream_General, 0, General_Encoded_Date, OriginationDate+__T(' ')+OriginationTime);
Fill(Stream_General, 0, General_Encoded_Library_Settings, History);
if (SamplesPerSec && TimeReference!=(int64u)-1)
{
Fill(Stream_Audio, 0, Audio_Delay, float64_int64s(((float64)TimeReference)*1000/SamplesPerSec));
Fill(Stream_Audio, 0, Audio_Delay_Source, "Container (bext)");
}
FILLING_END();
}
//---------------------------------------------------------------------------
void File_Riff::WAVE_cue_()
{
Element_Name("Cue points");
//Parsing
int32u numCuePoints;
Get_L4(numCuePoints, "numCuePoints");
for (int32u Pos=0; Pos<numCuePoints; Pos++)
{
Element_Begin1("Cue point");
Skip_L4( "ID");
Skip_L4( "Position");
Skip_C4( "DataChunkID");
Skip_L4( "ChunkStart");
Skip_L4( "BlockStart");
Skip_L4( "SampleOffset");
Element_End0();
}
}
//---------------------------------------------------------------------------
void File_Riff::WAVE_data()
{
Element_Name("Raw datas");
if (Buffer_DataToParse_End-Buffer_DataToParse_Begin<100)
{
Skip_XX(Buffer_DataToParse_End-Buffer_Offset, "Unknown");
return; //This is maybe embeded in another container, and there is only the header (What is the junk?)
}
FILLING_BEGIN();
Fill(Stream_Audio, 0, Audio_StreamSize, Buffer_DataToParse_End-Buffer_DataToParse_Begin);
FILLING_END();
//Parsing
Element_Code=(int64u)-1;
FILLING_BEGIN();
int64u Duration=Retrieve(Stream_Audio, 0, Audio_Duration).To_int64u();
int64u BitRate=Retrieve(Stream_Audio, 0, Audio_BitRate).To_int64u();
if (Duration)
{
int64u BitRate_New=(Buffer_DataToParse_End-Buffer_DataToParse_Begin)*8*1000/Duration;
if (BitRate_New<BitRate*0.95 || BitRate_New>BitRate*1.05)
Fill(Stream_Audio, 0, Audio_BitRate, BitRate_New, 10, true); //Correcting the bitrate, it was false in the header
}
else if (BitRate)
{
if (IsSub)
//Retrieving "data" real size, in case of truncated files and/or wave header in another container
Duration=((int64u)LittleEndian2int32u(Buffer+Buffer_Offset-4))*8*1000/BitRate; //TODO: RF64 is not handled
else
Duration=(Buffer_DataToParse_End-Buffer_DataToParse_Begin)*8*1000/BitRate;
Fill(Stream_General, 0, General_Duration, Duration, 10, true);
Fill(Stream_Audio, 0, Audio_Duration, Duration, 10, true);
}
FILLING_END();
}
//---------------------------------------------------------------------------
void File_Riff::WAVE_data_Continue()
{
#if MEDIAINFO_DEMUX
Element_Code=(int64u)-1;
if (AvgBytesPerSec && Demux_Rate)
{
FrameInfo.DTS=float64_int64s((File_Offset+Buffer_Offset-Buffer_DataToParse_Begin)*1000000000.0/AvgBytesPerSec);
FrameInfo.PTS=FrameInfo.DTS;
Frame_Count_NotParsedIncluded=float64_int64s(((float64)FrameInfo.DTS)/1000000000.0*Demux_Rate);
}
Demux_random_access=true;
Demux(Buffer+Buffer_Offset, (size_t)Element_Size, ContentType_MainStream);
Frame_Count_NotParsedIncluded=(int64u)-1;
#endif //MEDIAINFO_DEMUX
Element_Code=(int64u)-1;
AVI__movi_xxxx();
}
//---------------------------------------------------------------------------
void File_Riff::WAVE_ds64()
{
Element_Name("DataSize64");
//Parsing
int32u tableLength;
Skip_L8( "riffSize"); //Is directly read from the header parser
Get_L8 (WAVE_data_Size, "dataSize");
Get_L8 (WAVE_fact_samplesCount, "sampleCount");
Get_L4 (tableLength, "tableLength");
for (int32u Pos=0; Pos<tableLength; Pos++)
Skip_L8( "table[]");
}
//---------------------------------------------------------------------------
void File_Riff::WAVE_fact()
{
Element_Name("Sample count");
//Parsing
int64u SamplesCount64;
int32u SamplesCount;
Get_L4 (SamplesCount, "SamplesCount");
SamplesCount64=SamplesCount;
if (SamplesCount64==0xFFFFFFFF)
SamplesCount64=WAVE_fact_samplesCount;
FILLING_BEGIN();
int32u SamplingRate=Retrieve(Stream_Audio, 0, Audio_SamplingRate).To_int32u();
if (SamplingRate)
{
//Calculating
int64u Duration=(SamplesCount64*1000)/SamplingRate;
//Coherency test
bool IsOK=true;
if (File_Size!=(int64u)-1)
{
int64u BitRate=Retrieve(Stream_Audio, 0, Audio_BitRate).To_int64u();
if (BitRate)
{
int64u Duration_FromBitRate = File_Size * 8 * 1000 / BitRate;
if (Duration_FromBitRate > Duration*1.10 || Duration_FromBitRate < Duration*0.9)
IsOK = false;
}
}
//Filling
if (IsOK)
Fill(Stream_Audio, 0, Audio_Duration, Duration);
}
FILLING_END();
}
//---------------------------------------------------------------------------
void File_Riff::WAVE_fmt_()
{
//Compute the current codec ID
Element_Code=(int64u)-1;
Stream_ID=(int32u)-1;
stream_Count=1;
Stream[(int32u)-1].fccType=Elements::AVI__hdlr_strl_strh_auds;
AVI__hdlr_strl_strf();
}
//---------------------------------------------------------------------------
void File_Riff::WAVE_ID3_()
{
Element_Name("ID3v2 tags");
//Parsing
#if defined(MEDIAINFO_ID3V2_YES)
File_Id3v2 MI;
Open_Buffer_Init(&MI);
Open_Buffer_Continue(&MI);
Finish(&MI);
Merge(MI, Stream_General, 0, 0);
#endif
}
//---------------------------------------------------------------------------
void File_Riff::WAVE_iXML()
{
Element_Name("iXML");
//Parsing
Skip_Local(Element_Size, "XML data");
}
//---------------------------------------------------------------------------
void File_Riff::wave()
{
Data_Accept("Wave64");
Element_Name("Wave64");
//Filling
Fill(Stream_General, 0, General_Format, "Wave64");
}
//---------------------------------------------------------------------------
void File_Riff::W3DI()
{
Element_Name("IDVX tags (Out of specs!)");
//Parsing
int32u Size=(int32u)Element_Size;
Ztring Title, Artist, Album, Unknown, Genre, Comment;
int32u TrackPos;
Get_Local(Size, Title, "Title");
Element_Offset=(int32u)Title.size();
Size-=(int32u)Title.size();
if (Size==0) return;
Skip_L1( "Zero"); Size--; //NULL char
Get_Local(Size, Artist, "Artist");
Element_Offset=(int32u)Title.size()+1+(int32u)Artist.size();
Size-=(int32u)Artist.size();
if (Size==0) return;
Skip_L1( "Zero"); Size--; //NULL char
Get_Local(Size, Album, "Album");
Element_Offset=(int32u)Title.size()+1+(int32u)Artist.size()+1+(int32u)Album.size();
Size-=(int32u)Album.size();
if (Size==0) return;
Skip_L1( "Zero"); Size--; //NULL char
Get_Local(Size, Unknown, "Unknown");
Element_Offset=(int32u)Title.size()+1+(int32u)Artist.size()+1+(int32u)Album.size()+1+(int32u)Unknown.size();
Size-=(int32u)Unknown.size();
if (Size==0) return;
Skip_L1( "Zero"); Size--; //NULL char
Get_Local(Size, Genre, "Genre");
Element_Offset=(int32u)Title.size()+1+(int32u)Artist.size()+1+(int32u)Album.size()+1+(int32u)Unknown.size()+1+(int32u)Genre.size();
Size-=(int32u)Genre.size();
if (Size==0) return;
Skip_L1( "Zero"); Size--; //NULL char
Get_Local(Size, Comment, "Comment");
Element_Offset=(int32u)Title.size()+1+(int32u)Artist.size()+1+(int32u)Album.size()+1+(int32u)Unknown.size()+1+(int32u)Genre.size()+1+(int32u)Comment.size();
Size-=(int32u)Comment.size();
if (Size==0) return;
Skip_L1( "Zero"); Size--; //NULL char
Get_L4 (TrackPos, "Track_Position");
if(Element_Offset+8<Element_Size)
Skip_XX(Element_Size-Element_Offset, "Unknown");
Element_Begin1("Footer");
Skip_L4( "Size");
Skip_C4( "Name");
Element_End0();
//Filling
Fill(Stream_General, 0, General_Track, Title);
Fill(Stream_General, 0, General_Performer, Artist);
Fill(Stream_General, 0, General_Album, Album);
Fill(Stream_General, 0, "Unknown", Unknown);
Fill(Stream_General, 0, General_Genre, Genre);
Fill(Stream_General, 0, General_Comment, Comment);
Fill(Stream_General, 0, General_Track_Position, TrackPos);
}
void File_Riff::Open_Buffer_Init_All()
{
stream& StreamItem = Stream[Stream_ID];
for (size_t Pos = 0; Pos<StreamItem.Parsers.size(); Pos++)
Open_Buffer_Init(StreamItem.Parsers[Pos]);
}
//***************************************************************************
// C++
//***************************************************************************
} //NameSpace
#endif //MEDIAINFO_RIFF_YES
| Java |
///////////////////////////////////////////////////////////////////////////////
//
// (C) Autodesk, Inc. 2007-2011. All rights reserved.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef ATILDEFS_H
#include "AtilDefs.h"
#endif
#ifndef FORMATCODECPROPERTYINTERFACE_H
#include "FormatCodecPropertyInterface.h"
#endif
#ifndef FORMATCODECINCLUSIVEPROPERTYSETINTERFACE_H
#define FORMATCODECINCLUSIVEPROPERTYSETINTERFACE_H
#if __GNUC__ >= 4
#pragma GCC visibility push(default)
#endif
namespace Atil
{
/// <summary>
/// This class groups properties into a set of properties much
/// like a "structure" in "c".
/// </summary>
///
class FormatCodecInclusivePropertySetInterface : public FormatCodecPropertyInterface
{
public:
/// <summary>
/// The virtual destructor.
/// </summary>
///
virtual ~FormatCodecInclusivePropertySetInterface ();
/// <summary>
/// This returns the number of properties in the set.
/// </summary>
///
/// <returns>
/// The number of properties in the set.
/// </returns>
///
virtual int getNumProperties () const;
/// <summary>
/// This returns a selected property from the properties in the set.
/// </summary>
///
/// <param name="nIndex">
/// The index of the property to that is returned.
/// </param>
///
/// <returns>
/// A pointer to the property at the index. This pointer should not be freed by the caller.
/// </returns>
///
virtual FormatCodecPropertyInterface* getProperty (int nIndex) const;
protected:
/// <summary>
/// (Protected) Copy constructor.
/// </summary>
///
/// <param name="iter">
/// The instance to be copied.
/// </param>
///
FormatCodecInclusivePropertySetInterface (const FormatCodecInclusivePropertySetInterface& iter);
/// <summary>
/// (Protected) The simple constructor.
/// </summary>
///
FormatCodecInclusivePropertySetInterface ();
/// <summary>
/// (Protected) The pre-allocating constructor.
/// </summary>
///
/// <param name="nNumToAlloc">
/// The number of properties that will be in the set.
/// </param>
///
FormatCodecInclusivePropertySetInterface (int nNumToAlloc);
/// <summary>
/// (Protected) This sets the property at index in the set.
/// </summary>
///
/// <param name="nIndex">
/// The index of the property that is to be set.
/// </param>
///
/// <param name="pProperty">
/// A pointer to the property that should be placed at the index. The
/// property will be <c>clone()</c> copied. The pointer is not held by the set.
/// </param>
///
void setProperty (int nIndex, FormatCodecPropertyInterface* pProperty);
/// <summary>
/// (Protected) This adds the property to the set.
/// </summary>
///
/// <param name="pProperty">
/// A pointer to the property that should be placed at the index. The
/// property will be <c>clone()</c> copied. The pointer is not held by the set.
/// </param>
///
void appendProperty (FormatCodecPropertyInterface* pProperty);
/// <summary>
/// (Protected) The array of property pointers held by the set.
/// </summary>
///
FormatCodecPropertyInterface** mppProperties;
/// <summary>
/// (Protected) The number of properties that have been set into the set.
/// </summary>
int mnNumProperties;
/// <summary>
/// (Protected) The length of the property array.
/// </summary>
int mnArraySize;
private:
FormatCodecInclusivePropertySetInterface& operator= (const FormatCodecInclusivePropertySetInterface& from);
};
} // end of namespace Atil
#if __GNUC__ >= 4
#pragma GCC visibility pop
#endif
#endif
| Java |
'use strict';
// Configuring the Articles module
angular.module('about').run(['Menus',
function(Menus) {
// Set top bar menu items
Menus.addMenuItem('mainmenu', 'About Us', 'about', 'left-margin', '/about-us', true, null, 3);
}
]);
| Java |
package cwr;
import java.util.ArrayList;
public class RobotBite
{
//0 = time [state]
//1 = x [state]
//2 = y [state]
//3 = energy [state]
//4 = bearing radians [relative position]
//5 = distance [relative position]
//6 = heading radians [travel]
//7 = velocity [travel]
String name;
long cTime;
double cx;
double cy;
cwruBase origin;
double cEnergy;
double cBearing_radians;
double cDistance;
double cHeading_radians;
double cVelocity;
ArrayList<Projection> projec; //forward projections for x
public RobotBite(String name, long time, cwruBase self,
double energy, double bearing_radians, double distance,
double heading_radians, double velocity)
{
this.name = name;
cTime = time;
origin = self;
cEnergy = energy;
cBearing_radians = bearing_radians;
double myBearing = self.getHeadingRadians();
//System.out.println("I'm going "+self.getHeadingRadians());
double adjust_bearing = (bearing_radians+myBearing)%(2*Math.PI);
//System.out.println("input bearing "+(bearing_radians));
//System.out.println("adjust bearing "+(adjust_bearing));
//System.out.println("math bearing"+(-adjust_bearing+Math.PI/2));
cDistance = distance;
cHeading_radians = heading_radians;
//System.out.println("location heading "+heading_radians);
cVelocity = velocity;
double myX = self.getX();
double myY = self.getY();
double math_bearing = (-adjust_bearing+Math.PI/2)%(2*Math.PI);
//double math_heading = (-heading_radians+Math.PI/2)%(2*Math.PI);
/*
* 0
* 90
* -90 180 0 90
* -90
* 180
*/
double dX = distance*Math.cos(math_bearing);
//System.out.println("location dx:" + dX);
double dY = distance*Math.sin(math_bearing);
//System.out.println("location dy:" + dY);
cx = myX+dX;
cy = myY+dY;
}
public void attachProjection(ArrayList<Projection> projList)
{
projec = projList;
}
}
| Java |
export default function closest(n, arr) {
let i
let ndx
let diff
let best = Infinity
let low = 0
let high = arr.length - 1
while (low <= high) {
// eslint-disable-next-line no-bitwise
i = low + ((high - low) >> 1)
diff = arr[i] - n
if (diff < 0) {
low = i + 1
} else if (diff > 0) {
high = i - 1
}
diff = Math.abs(diff)
if (diff < best) {
best = diff
ndx = i
}
if (arr[i] === n) break
}
return arr[ndx]
}
| Java |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ClearScript.Installer.Demo
{
public class Class1
{
}
}
| Java |
/**
* 斐波那契数列
*/
export default function fibonacci(n){
if(n <= 2){
return 1;
}
let n1 = 1, n2 = 1, sn = 0;
for(let i = 0; i < n - 2; i ++){
sn = n1 + n2;
n1 = n2;
n2 = sn;
}
return sn;
}
| Java |
import * as UTILS from '@utils';
const app = new WHS.App([
...UTILS.appModules({
position: new THREE.Vector3(0, 40, 70)
})
]);
const halfMat = {
transparent: true,
opacity: 0.5
};
const box = new WHS.Box({
geometry: {
width: 30,
height: 2,
depth: 2
},
modules: [
new PHYSICS.BoxModule({
mass: 0
})
],
material: new THREE.MeshPhongMaterial({
color: UTILS.$colors.mesh,
...halfMat
}),
position: {
y: 40
}
});
const box2 = new WHS.Box({
geometry: {
width: 30,
height: 1,
depth: 20
},
modules: [
new PHYSICS.BoxModule({
mass: 10,
damping: 0.1
})
],
material: new THREE.MeshPhongMaterial({
color: UTILS.$colors.softbody,
...halfMat
}),
position: {
y: 38,
z: 12
}
});
const pointer = new WHS.Sphere({
modules: [
new PHYSICS.SphereModule()
],
material: new THREE.MeshPhongMaterial({
color: UTILS.$colors.mesh
})
});
console.log(pointer);
pointer.position.set(0, 60, -8);
pointer.addTo(app);
box.addTo(app);
box2.addTo(app).then(() => {
const constraint = new PHYSICS.DOFConstraint(box2, box,
new THREE.Vector3(0, 38, 1)
);
app.addConstraint(constraint);
constraint.enableAngularMotor(10, 20);
});
UTILS.addPlane(app, 250);
UTILS.addBasicLights(app);
app.start();
| Java |
package unit.com.bitdubai.fermat_dmp_plugin.layer.basic_wallet.bitcoin_wallet.developer.bitdubai.version_1.structure.BitcoinWalletBasicWalletAvailableBalance;
import com.bitdubai.fermat_api.layer.dmp_basic_wallet.common.exceptions.CantRegisterDebitException;
import com.bitdubai.fermat_api.layer.dmp_basic_wallet.bitcoin_wallet.interfaces.BitcoinWalletTransactionRecord;
import com.bitdubai.fermat_api.layer.osa_android.database_system.Database;
import com.bitdubai.fermat_api.layer.osa_android.database_system.DatabaseTable;
import com.bitdubai.fermat_api.layer.osa_android.database_system.DatabaseTableRecord;
import com.bitdubai.fermat_api.layer.osa_android.database_system.DatabaseTransaction;
import com.bitdubai.fermat_api.layer.osa_android.database_system.PluginDatabaseSystem;
import com.bitdubai.fermat_api.layer.osa_android.database_system.exceptions.CantLoadTableToMemoryException;
import com.bitdubai.fermat_api.layer.osa_android.database_system.exceptions.CantOpenDatabaseException;
import com.bitdubai.fermat_api.layer.osa_android.database_system.exceptions.DatabaseNotFoundException;
import com.bitdubai.fermat_pip_api.layer.pip_platform_service.error_manager.ErrorManager;
import com.bitdubai.fermat_dmp_plugin.layer.basic_wallet.bitcoin_wallet.developer.bitdubai.version_1.structure.BitcoinWalletBasicWalletAvailableBalance;
import com.bitdubai.fermat_dmp_plugin.layer.basic_wallet.bitcoin_wallet.developer.bitdubai.version_1.structure.BitcoinWalletDatabaseConstants;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import java.util.ArrayList;
import java.util.List;
import unit.com.bitdubai.fermat_dmp_plugin.layer.basic_wallet.bitcoin_wallet.developer.bitdubai.version_1.structure.mocks.MockBitcoinWalletTransactionRecord;
import unit.com.bitdubai.fermat_dmp_plugin.layer.basic_wallet.bitcoin_wallet.developer.bitdubai.version_1.structure.mocks.MockDatabaseTableRecord;
import static com.googlecode.catchexception.CatchException.catchException;
import static com.googlecode.catchexception.CatchException.caughtException;
import static org.fest.assertions.api.Assertions.assertThat;
import static org.fest.assertions.api.Assertions.fail;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.when;
/**
* Created by jorgegonzalez on 2015.07.14..
*/
@RunWith(MockitoJUnitRunner.class)
public class DebitTest {
@Mock
private ErrorManager mockErrorManager;
@Mock
private PluginDatabaseSystem mockPluginDatabaseSystem;
@Mock
private Database mockDatabase;
@Mock
private DatabaseTable mockWalletTable;
@Mock
private DatabaseTable mockBalanceTable;
@Mock
private DatabaseTransaction mockTransaction;
private List<DatabaseTableRecord> mockRecords;
private DatabaseTableRecord mockBalanceRecord;
private DatabaseTableRecord mockWalletRecord;
private BitcoinWalletTransactionRecord mockTransactionRecord;
private BitcoinWalletBasicWalletAvailableBalance testBalance;
@Before
public void setUpMocks(){
mockTransactionRecord = new MockBitcoinWalletTransactionRecord();
mockBalanceRecord = new MockDatabaseTableRecord();
mockWalletRecord = new MockDatabaseTableRecord();
mockRecords = new ArrayList<>();
mockRecords.add(mockBalanceRecord);
setUpMockitoRules();
}
public void setUpMockitoRules(){
when(mockDatabase.getTable(BitcoinWalletDatabaseConstants.BITCOIN_WALLET_TABLE_NAME)).thenReturn(mockWalletTable);
when(mockDatabase.getTable(BitcoinWalletDatabaseConstants.BITCOIN_WALLET_BALANCE_TABLE_NAME)).thenReturn(mockBalanceTable);
when(mockBalanceTable.getRecords()).thenReturn(mockRecords);
when(mockWalletTable.getEmptyRecord()).thenReturn(mockWalletRecord);
when(mockDatabase.newTransaction()).thenReturn(mockTransaction);
}
@Before
public void setUpAvailableBalance(){
testBalance = new BitcoinWalletBasicWalletAvailableBalance(mockDatabase);
}
@Test
public void Debit_SuccesfullyInvoked_ReturnsAvailableBalance() throws Exception{
catchException(testBalance).debit(mockTransactionRecord);
assertThat(caughtException()).isNull();
}
@Test
public void Debit_OpenDatabaseCantOpenDatabase_ReturnsAvailableBalance() throws Exception{
doThrow(new CantOpenDatabaseException("MOCK", null, null, null)).when(mockDatabase).openDatabase();
catchException(testBalance).debit(mockTransactionRecord);
assertThat(caughtException())
.isNotNull()
.isInstanceOf(CantRegisterDebitException.class);
}
@Test
public void Debit_OpenDatabaseDatabaseNotFound_Throws() throws Exception{
doThrow(new DatabaseNotFoundException("MOCK", null, null, null)).when(mockDatabase).openDatabase();
catchException(testBalance).debit(mockTransactionRecord);
assertThat(caughtException())
.isNotNull()
.isInstanceOf(CantRegisterDebitException.class);
}
@Test
public void Debit_DaoCantCalculateBalanceException_ReturnsAvailableBalance() throws Exception{
doThrow(new CantLoadTableToMemoryException("MOCK", null, null, null)).when(mockWalletTable).loadToMemory();
catchException(testBalance).debit(mockTransactionRecord);
assertThat(caughtException())
.isNotNull()
.isInstanceOf(CantRegisterDebitException.class);
}
}
| Java |
// ******************************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THE CODE 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 CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
//
// ******************************************************************
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using Windows.Foundation;
namespace Microsoft.Toolkit.Uwp.Services.OAuth
{
/// <summary>
/// OAuth Uri extensions.
/// </summary>
internal static class OAuthUriExtensions
{
/// <summary>
/// Get query parameters from Uri.
/// </summary>
/// <param name="uri">Uri to process.</param>
/// <returns>Dictionary of query parameters.</returns>
public static IDictionary<string, string> GetQueryParams(this Uri uri)
{
return new WwwFormUrlDecoder(uri.Query).ToDictionary(decoderEntry => decoderEntry.Name, decoderEntry => decoderEntry.Value);
}
/// <summary>
/// Get absolute Uri.
/// </summary>
/// <param name="uri">Uri to process.</param>
/// <returns>Uri without query string.</returns>
public static string AbsoluteWithoutQuery(this Uri uri)
{
if (string.IsNullOrEmpty(uri.Query))
{
return uri.AbsoluteUri;
}
return uri.AbsoluteUri.Replace(uri.Query, string.Empty);
}
/// <summary>
/// Normalize the Uri into string.
/// </summary>
/// <param name="uri">Uri to process.</param>
/// <returns>Normalized string.</returns>
public static string Normalize(this Uri uri)
{
var result = new StringBuilder(string.Format(CultureInfo.InvariantCulture, "{0}://{1}", uri.Scheme, uri.Host));
if (!((uri.Scheme == "http" && uri.Port == 80) || (uri.Scheme == "https" && uri.Port == 443)))
{
result.Append(string.Concat(":", uri.Port));
}
result.Append(uri.AbsolutePath);
return result.ToString();
}
}
}
| Java |
<html><body>
<h4>Windows 10 x64 (18363.900)</h4><br>
<h2>_OPENCOUNT_REASON</h2>
<font face="arial"> OpenCount_SkipLogging = 0n0<br>
OpenCount_AsyncRead = 0n1<br>
OpenCount_FlushCache = 0n2<br>
OpenCount_GetDirtyPage = 0n3<br>
OpenCount_GetFlushedVDL = 0n4<br>
OpenCount_InitCachemap1 = 0n5<br>
OpenCount_InitCachemap2 = 0n6<br>
OpenCount_InitCachemap3 = 0n7<br>
OpenCount_InitCachemap4 = 0n8<br>
OpenCount_InitCachemap5 = 0n9<br>
OpenCount_MdlWrite = 0n10<br>
OpenCount_MdlWriteAbort = 0n11<br>
OpenCount_NotifyMappedWrite = 0n12<br>
OpenCount_NotifyMappedWriteCompCallback = 0n13<br>
OpenCount_PurgeCache = 0n14<br>
OpenCount_PurgeCacheActiveViews = 0n15<br>
OpenCount_ReadAhead = 0n16<br>
OpenCount_SetFileSize = 0n17<br>
OpenCount_SetFileSizeSection = 0n18<br>
OpenCount_UninitCachemapReadAhead = 0n19<br>
OpenCount_UninitCachemapReg = 0n20<br>
OpenCount_UnmapInactiveViews = 0n21<br>
OpenCount_UnmapInactiveViews1 = 0n22<br>
OpenCount_UnmapInactiveViews2 = 0n23<br>
OpenCount_UnmapInactiveViews3 = 0n24<br>
OpenCount_WriteBehind = 0n25<br>
OpenCount_WriteBehindComplete = 0n26<br>
OpenCount_WriteBehindFailAcquire = 0n27<br>
</font></body></html> | Java |
#ifndef BITMAP_H
#define BITMAP_H
#include <allegro5/allegro.h>
#include <memory>
#include "renderlist.h"
// This class does double duty as a renderable, and a wrapper for allegro bitmap.
class Bitmap;
using BitmapPtr = std::shared_ptr<Bitmap>;
class Bitmap : public Renderable
{
ALLEGRO_BITMAP* bitmap;
float x, y;
float scale;
public:
Bitmap() : bitmap(nullptr), x(0), y(0), scale(1.0f)
{}
Bitmap( ALLEGRO_BITMAP* _bitmap, int _x = 0 , int _y = 0 ) : bitmap(_bitmap), x(_x), y(_y), scale(1.0f)
{}
~Bitmap();
void render();
void create( int w, int h, int flags = 0 );
bool loadFromFile( const std::string& filename, int flags = 0 );
bool saveToFile( const std::string& filename );
BitmapPtr getSubBitmap( int _x, int _y, int _w, int _h );
void setBitmap( ALLEGRO_BITMAP* nb );
void setBitmap( BitmapPtr& nb );
void blit( const BitmapPtr& other, float x, float y, float scale );
float getX() { return x; }
float getY() { return y; }
float getScale() { return scale; }
void setX( int _x ) { x = _x; }
void setY( int _y ) { y = _y; }
int getWidth() { return al_get_bitmap_width( bitmap ); }
int getHeight() { return al_get_bitmap_height( bitmap ); }
void setScale( float _scale ) { scale = _scale; }
};
#endif // BITMAP_H
| Java |
# BullDawgBeds | Java |
/*
gopm (Go Package Manager)
Copyright (c) 2012 cailei (dancercl@gmail.com)
The MIT License (MIT)
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.
*/
package main
import (
"fmt"
"github.com/cailei/gopm_index/gopm/index"
"github.com/hailiang/gosocks"
"io"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"
)
type Agent struct {
client *http.Client
}
func newAgent() *Agent {
client := http.DefaultClient
// check if using a proxy
proxy_addr := os.Getenv("GOPM_PROXY")
if proxy_addr != "" {
fmt.Printf("NOTE: Using socks5 proxy: %v\n", proxy_addr)
proxy := socks.DialSocksProxy(socks.SOCKS5, proxy_addr)
transport := &http.Transport{Dial: proxy}
client = &http.Client{Transport: transport}
}
return &Agent{client}
}
func (agent *Agent) getFullIndexReader() io.Reader {
request := remote_db_host + "/all"
return agent._get_body_reader(request)
}
func (agent *Agent) uploadPackage(meta index.PackageMeta) {
request := fmt.Sprintf("%v/publish", remote_db_host)
// marshal PackageMeta to json
json, err := meta.ToJson()
if err != nil {
log.Fatalln(err)
}
// create a POST request
response, err := http.PostForm(request, url.Values{"pkg": {string(json)}})
if err != nil {
log.Fatalln(err)
}
body, err := ioutil.ReadAll(response.Body)
defer response.Body.Close()
if err != nil {
log.Fatalln(err)
}
if len(body) > 0 {
fmt.Println(string(body))
}
// check response
if response.StatusCode != 200 {
log.Fatalln(response.Status)
}
}
func (agent *Agent) _get_body_reader(request string) io.ReadCloser {
// GET the index content
response, err := agent.client.Get(request)
if err != nil {
log.Fatalln(err)
}
// check response
if response.StatusCode != 200 {
body, err := ioutil.ReadAll(response.Body)
if err != nil {
log.Fatalln(err)
}
if len(body) > 0 {
fmt.Println(string(body))
}
log.Fatalln(response.Status)
}
return response.Body
}
| Java |
package org.usfirst.frc.team6135.robot.subsystems;
import java.awt.geom.Arc2D.Double;
import org.usfirst.frc.team6135.robot.RobotMap;
import org.usfirst.frc.team6135.robot.commands.teleopDrive;
import com.kauailabs.navx.frc.AHRS;
import edu.wpi.first.wpilibj.ADXRS450_Gyro;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SerialPort;
import edu.wpi.first.wpilibj.VictorSP;
import edu.wpi.first.wpilibj.command.Subsystem;
public class Drive extends Subsystem {
//Constants
private static final boolean rReverse = true;
private static final boolean lReverse = false;
private static final double kA=0.03;
//Objects
private VictorSP leftDrive = null;
private VictorSP rightDrive = null;
public ADXRS450_Gyro gyro=null;
public AHRS ahrs=null;
public RobotDrive robotDrive=null;
//Constructors
public Drive() {
gyro=RobotMap.gyro;
ahrs=new AHRS(SerialPort.Port.kUSB1);
robotDrive=new RobotDrive(RobotMap.leftDriveVictor,RobotMap.rightDriveVictor);
leftDrive = RobotMap.leftDriveVictor;
rightDrive = RobotMap.rightDriveVictor;
leftDrive.set(0);
rightDrive.set(0);
leftDrive.setInverted(lReverse);
rightDrive.setInverted(rReverse);
ahrs.reset();
}
//Direct object access methods
public void setMotors(double l, double r) {//sets motor speeds accounting for directions of motors
leftDrive.set(l);
rightDrive.set(r);
}
public void setLeft(double d) {
leftDrive.set(d);
}
public void setRight(double d) {
rightDrive.set(d);
}
//Teleop Driving methods
private static final double accBoundX = 0.7; //The speed after which the drive starts to accelerate over time
private static final int accLoopX = 15; //The number of loops for the bot to accelerate to max speed
private int accLoopCountX = 0;
public double accCalcX(double input) {//applies a delay for motors to reach full speed for larger joystick inputs
if(input > accBoundX && accLoopCountX < accLoopX) {//positive inputs
return accBoundX + (input - accBoundX) * (accLoopCountX++ / (double) accLoopX);
}
else if(input < -accBoundX && accLoopCountX < accLoopX) {//negative inputs
return -accBoundX + (input + accBoundX) * (accLoopCountX++ / (double) accLoopX);
}
else if(Math.abs(input) <= accBoundX) {
accLoopCountX = 0;
}
return input;
}
private static final double accBoundY = 0.7; //The speed after which the drive starts to accelerate over time
private static final int accLoopY = 15; //The number of loops for the bot to accelerate to max speed
private int accLoopCountY = 0;
public double accCalcY(double input) {//applies a delay for motors to reach full speed for larger joystick inputs
if(input > accBoundY && accLoopCountY < accLoopY) {//positive inputs
return accBoundY + (input - accBoundY) * (accLoopCountY++ / (double) accLoopY);
}
else if(input < -accBoundY && accLoopCountY < accLoopY) {//negative inputs
return -accBoundY + (input + accBoundY) * (accLoopCountY++ / (double) accLoopY);
}
else if(Math.abs(input) <= accBoundY) {
accLoopCountY = 0;
}
return input;
}
private static final double accBoundZ = 0.7; //The speed after which the drive starts to accelerate over time
private static final int accLoopZ = 15; //The number of loops for the bot to accelerate to max speed
private int accLoopCountZ = 0;
public double accCalcZ(double input) {//applies a delay for motors to reach full speed for larger joystick inputs
if(input > accBoundZ && accLoopCountZ < accLoopZ) {//positive inputs
return accBoundZ + (input - accBoundZ) * (accLoopCountZ++ / (double) accLoopZ);
}
else if(input < -accBoundZ && accLoopCountZ < accLoopZ) {//negative inputs
return -accBoundZ + (input + accBoundZ) * (accLoopCountZ++ / (double) accLoopZ);
}
else if(Math.abs(input) <= accBoundZ) {
accLoopCountZ = 0;
}
return input;
}
public double sensitivityCalc(double input) {//Squares magnitude of input to reduce magnitude of smaller joystick inputs
if (input >= 0.0) {
return (input * input);
}
else {
return -(input * input);
}
}
public void reverse() {
leftDrive.setInverted(!leftDrive.getInverted());
rightDrive.setInverted(!rightDrive.getInverted());
VictorSP temp1 = leftDrive;
VictorSP temp2 = rightDrive;
rightDrive = temp1;
leftDrive = temp2;
}
public double getGyroAngle()
{
return gyro.getAngle();
}
public double getNAVXAngle()
{
return ahrs.getAngle();
}
public void driveStraight()
{
robotDrive.drive(0.6, -gyro.getAngle()*kA);
}
@Override
protected void initDefaultCommand() {
setDefaultCommand(new teleopDrive());
}
}
| Java |
module Shopping
class LineItem < ActiveRecord::Base
extend Shopping::AttributeAccessibleHelper
belongs_to :cart
belongs_to :source, polymorphic: true
validate :unique_source_and_cart, on: :create
validate :unpurchased_cart
validates :quantity, allow_nil: true, numericality: {only_integer: true, greater_than: -1}
validates :cart_id, presence: true
validates :source_id, presence: true
validates :source_type, presence: true
attr_accessible :cart_id, :source, :source_id, :source_type, :quantity, :list_price, :sale_price, :options
before_create :set_prices, :set_name
def unique_source_and_cart
other = Shopping::LineItem.where(source_id: self.source_id, source_type: self.source_type, cart_id: self.cart_id)
if other.count > 0
self.errors.add(:source, "A line item with identical source and cart exists, update quantity instead (id=#{other.first.id})")
end
end
def unpurchased_cart
if cart && cart.purchased?
changes.keys.each do |k|
self.errors.add(k, "Cannot change `#{k}', cart is purchased")
end
end
end
def set_name
self.source_name ||= source.try(:name)
end
def set_prices
self.list_price ||= source.try(:price)
self.sale_price ||= source.try(:price)
end
end
end
| Java |
<?php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new Tuhn\HelloBundle\TuhnHelloBundle(),
new Trungnd\StoreBundle\TrungndStoreBundle(),
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Acme\DemoBundle\AcmeDemoBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
}
return $bundles;
}
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
}
}
| Java |
#!/usr/bin/env python
"""
This script is used to run tests, create a coverage report and output the
statistics at the end of the tox run.
To run this script just execute ``tox``
"""
import re
from fabric.api import local, warn
from fabric.colors import green, red
if __name__ == '__main__':
# Kept some files for backwards compatibility. If support is dropped,
# remove it here
deprecated_files = '*utils_email*,*utils_log*'
local('flake8 --ignore=E126 --ignore=W391 --statistics'
' --exclude=submodules,migrations,build .')
local('coverage run --source="django_libs" manage.py test -v 2'
' --traceback --failfast --settings=django_libs.tests.settings'
' --pattern="*_tests.py"')
local('coverage html -d coverage'
' --omit="*__init__*,*/settings/*,*/migrations/*,*/tests/*,'
'*admin*,{}"'.format(deprecated_files))
total_line = local('grep -n pc_cov coverage/index.html', capture=True)
percentage = float(re.findall(r'(\d+)%', total_line)[-1])
if percentage < 100:
warn(red('Coverage is {0}%'.format(percentage)))
else:
print(green('Coverage is {0}%'.format(percentage)))
| Java |
using System;
namespace KeyWatcher.Reactive
{
internal sealed class ObservingKeyWatcher
: IObserver<char>
{
private readonly string id;
internal ObservingKeyWatcher(string id) =>
this.id = id;
public void OnCompleted() =>
Console.Out.WriteLine($"{this.id} - {nameof(this.OnCompleted)}");
public void OnError(Exception error) =>
Console.Out.WriteLine($"{this.id} - {nameof(this.OnError)} - {error.Message}");
public void OnNext(char value) =>
Console.Out.WriteLine($"{this.id} - {nameof(this.OnNext)} - {value}");
}
}
| Java |
from baroque.entities.event import Event
class EventCounter:
"""A counter of events."""
def __init__(self):
self.events_count = 0
self.events_count_by_type = dict()
def increment_counting(self, event):
"""Counts an event
Args:
event (:obj:`baroque.entities.event.Event`): the event to be counted
"""
assert isinstance(event, Event)
self.events_count += 1
t = type(event.type)
if t in self.events_count_by_type:
self.events_count_by_type[t] += 1
else:
self.events_count_by_type[t] = 1
def count_all(self):
"""Tells how many events have been counted globally
Returns:
int
"""
return self.events_count
def count(self, eventtype):
"""Tells how many events have been counted of the specified type
Args:
eventtype (:obj:`baroque.entities.eventtype.EventType`): the type of events to be counted
Returns:
int
"""
return self.events_count_by_type.get(type(eventtype), 0)
| Java |
/*
Fontname: -Adobe-Times-Medium-R-Normal--11-80-100-100-P-54-ISO10646-1
Copyright: Copyright (c) 1984, 1987 Adobe Systems Incorporated. All Rights Reserved. Copyright (c) 1988, 1991 Digital Equipment Corporation. All Rights Reserved.
Glyphs: 191/913
BBX Build Mode: 0
*/
const uint8_t u8g2_font_timR08_tf[2170] U8G2_FONT_SECTION("u8g2_font_timR08_tf") =
"\277\0\3\2\4\4\2\4\5\13\15\377\375\7\376\7\376\1H\2\277\10a \5\0\246\4!\7q\343"
"\304\240\4\42\7#\66E\242\4#\16ubM)I\6\245\62(\245$\1$\14\224^U\64D\242"
"i\310\22\0%\21w\42\316\60$Q\322\226$RRJ\332\22\0&\20x\42\226\232\244\312\264D\221"
"\226)\311\242\0'\6!\266\204\0(\13\223\32U\22%Q-\312\2)\14\223\32E\26eQ%J"
"\42\0*\7\63sE\322\1+\12U\242U\30\15R\30\1,\6\42\336\204\22-\6\23*\305\0."
"\6\21\343D\0/\12s\342T%\252D\21\0\60\12tb\215\22yJ\24\0\61\10scM\42u"
"\31\62\14tb\215\22eQ\26EC\0\63\14tb\215\22e\211\230\15\11\0\64\14ub]&%"
"\245d\320\302\4\65\13tb\315\22\215Y\66$\0\66\13tb\225\22-\221)Q\0\67\12tb\305"
" \325\242\254\4\70\14tb\215\22I\211\22I\211\2\71\13tb\215\22\231\222)\221\0:\6Q\343"
"D\26;\7b\336L\254\4<\7ScUR+=\10\65\246\305\240\16\2>\10SbEV)\1"
"?\13s\42\305\220DI\224&\0@\24\230Z\326\220\205I\264(Q\242D\211\222\230\332\221A\1A"
"\15w\42^:&a\222\15R\226\34B\15u\242\305\20U\242d\252D\203\2C\14v\342\315\60d"
"jUK\206\4D\20v\342\305 EJ\226dI\226D\303\220\0E\14u\242\305\240DI\70\205\321"
"\60F\14u\242\305\240DI\70\205\331\4G\16v\342\315\60dj\64\204[\62$\0H\17w\42\306"
"\262dQ\26\15R\26e\311\1I\10s\42\305\22u\31J\12t\42\315\224\265T$\0K\16v\342"
"\305\242D\225LL\262(Y\4L\11u\242\305\26v\32\6M\21y\242\306\266hR\322\224\64%K"
"\324\262$\3N\20w\42\306\262H\225RR\212\244H\231\22\0O\14v\342\315\220H\243qR\206\4"
"P\14u\242\305\20U\242d\12\263\11Q\14\226\332\315\220H\243qRV\3R\15v\342\305\220EM"
"[\222E\311\42S\13tb\315\20m\242\64$\0T\12u\242\305\245\24\266-\0U\17w\42\306\262"
"dQ\26eQ\26)\332\4V\17w\42\306\262d\221\242%a\222\306\31\0W\22{\241\306r\311J"
"R\244%K\230\264fq\226\1X\14w\42\306\262d\225\264\222U\16Y\14w\42\306\262d\225p\215"
"\323\11Z\10u\242\305\255\267a[\10\222\332\304\322\27\1\134\11s\342D\224E\265(]\10\222\332\204"
"\322\227\1^\7\63sME\11_\6\25V\305 `\6\42\372D\24a\10S\42\205\226\34\2b\14"
"ua\205\30N\225(\211\222\5c\7S\42\315T\23d\15ub\225\30-Q\22%Q\244\4e\7"
"S\42\315%\23f\12t\42\225\22MYi\1g\14tZ\315\220\64eJ\64$\0h\13va\205"
"\232nQO\212\0i\7r\342L\244tj\11\223\331T(uZ\0k\13va\205Z\252d[T"
"\22l\10s\42\205\324\313\0m\14X\42\306\42\265D\225\250\342\0n\12Ub\305T\211\222(\61o"
"\11Tb\215\22\231\22\5p\16\205U\305\20U\242$J\246\60\233\0q\14\205V\315\22%Q\22E"
"cmr\11S\42E\222(Q\62s\10S\42\315\226\15\1t\11d\42M\64eE\1u\14Ub"
"\205\62%Q\22EJ\0v\14Va\305\242DY\222\251\21\0w\15Y!\306b\211jIQQ\223"
"\14x\12U\242\205\242\324*\211\1y\14vY\205\262D\225P\14\65\21z\11Tb\305\20\65\15\2"
"{\12\223\32U\22U\262\250\26|\6\221\232\304\3}\13\223\32E\26\325\222\250\22\1~\7&\352\215"
"d\1\240\5\0\246\4\241\7q\333D\62\10\242\14t^U\64DZ\224H\21\0\243\14ub\225\224"
"D\331\226I\203\2\244\14efE\226LI\224DK\26\245\15ubE\226TL\321 e\13\0\246"
"\6q\242\304\62\247\17\224Z\315\20%QRJJI\64$\0\250\6\23wE\22\251\16wc\326V"
"\211\24%\223\224Z\66\1\252\10S*\205\246d\3\253\11DfM\242\64%\1\254\7%\347\305 \6"
"\255\6\23*\305\0\256\15wc\326VI\26\223\322-\233\0\257\6\23\66\305\0\260\11D.\215\22I"
"\211\2\261\14u\242U\30\15R\230\3\203\0\262\7C\356\314R\31\263\10C\356\304\222-\0\264\6\42"
"\366\214\2\265\16uZE\224DI\224D\311\42\206\0\266\23\226\232\315\60(\311\222,\221\222%Y\222"
"%Y\222\0\267\6\21\252D\0\270\7\63\26M\266\0\271\10C\356L\42%\3\272\7S*M\307\1"
"\273\12DfE\22%\25%\1\274\21w\42N\226HY\24\15I\226h\203\222%\0\275\17w\42N"
"\226HY\24\15\211\224\224\232\6\276\17w\42\306\324\230DJ-\321\6%K\0\277\12s\32M\32%"
"Q\62\4\300\20\247\42V\16\344p:&a\222\15R\226\34\301\17\247\42f\232\303\351\230\204I\66H"
"Yr\302\20\247\42^\232\344h:&a\222\15R\226\34\303\21\247\42^\222%\71\232\216I\230d\203"
"\224%\7\304\17\227\42V\222\243\351\230\204I\66HYr\305\20\247\42^\232\244q:&a\222\15R"
"\226\34\306\20xb\336 M\225\64\231\206\60\212\206d\10\307\17\246\326\315\60djUK\206,\316\64"
"\0\310\17\245\242M\232\3\203\22%\341\24F\303\0\311\16\245\242]\35\30\224(\11\247\60\32\6\312\17"
"\245\242U\226\304\203\22%\341\24F\303\0\313\15\225\242MyP\242$\234\302h\30\314\12\243\42E\26"
".Q\227\1\315\12\243\42U\22.Q\227\1\316\11\243\42M\333\22u\31\317\12\223\42E\222-Q\227"
"\1\320\20v\342\305 EJ\66DI\226D\303\220\0\321\23\247\42^\222%\71$-R$UJI"
")R\246\4\322\17\246\342U\234CC\42\215\306I\31\22\0\323\17\246\342]\230cC\42\215\306I\31"
"\22\0\324\17\246\342]\230\344\310\220H\243qR\206\4\325\20\246\342U\22%\71\64$\322h\234\224!"
"\1\326\17\226\342M\224#C\42\215\306I\31\22\0\327\12U\242E\226\324*\265\0\330\22\230\35>\20"
"\15\222\251\22\205Q\22E\246A\312\1\331\22\247\42V\16\344\330\262dQ\26eQ\26)\332\4\332\22"
"\247\42f\232c\313\222EY\224EY\244h\23\0\333\22\247\42^\232\344\320\262dQ\26eQ\26)"
"\332\4\334\22\227\42V\222C\313\222EY\224EY\244h\23\0\335\16\247\42f\232c\226\254\22\256q"
":\1\336\13u\242\305\26N\225)\233\0\337\13tbU\245EJ*C\2\340\11\203\42E\26j\311"
"!\341\11\203\42U\22j\311!\342\11\203\42M\233\226\34\2\343\14\204\42M\242\244b\244T\26\0\344"
"\11s\42E\222i\311!\345\11\203\42M\27-\71\4\346\13U\242\205\42%\311RR\4\347\11\203\26"
"\315TS\262\5\350\11\203\42E\226.K&\351\11\203\42U\222.K&\352\11\203\42M\343\262d\2"
"\353\11s\42E\22.K&\354\10\202\342D\24)\35\355\11\203\342T\22J]\0\356\10\203\342L\233"
"\324\5\357\11s\342D\222I]\0\360\14\204bM\66$\321\20\231\22\5\361\14\205bMw`\252D"
"I\224\30\362\13\204bM\30+\221)Q\0\363\13\204bU\35P\42S\242\0\364\14\204bM\224\304"
"JdJ\24\0\365\14\204bM\242\304JdJ\24\0\366\13tbE\22+\221)Q\0\367\12U\242"
"U\16\14:\20\1\370\12v]m\64\365iJ\1\371\17\205bM\232\3Q\22%Q\22EJ\0\372"
"\17\205bU\226#Q\22%Q\22EJ\0\373\17\205bU\226\304Q\22%Q\22EJ\0\374\15u"
"bM\71J\242$J\242H\11\375\17\246Y]\230C\312\22UB\61\324D\0\376\17\245U\205\30N"
"\225(\211\222)\314&\0\377\16\226YM\35Q\226\250\22\212\241&\2\0\0\0";
| Java |
import React from 'react'
import { PlanItineraryContainer } from './index'
const PlanMapRoute = () => {
return (
<div>
<PlanItineraryContainer />
</div>
)
}
export default PlanMapRoute
| Java |
//
// Reliant.h
// Reliant
//
// Created by Michael Seghers on 18/09/14.
//
//
#ifndef Reliant_Header____FILEEXTENSION___
#define Reliant_Header____FILEEXTENSION___
#import "OCSObjectContext.h"
#import "OCSConfiguratorFromClass.h"
#import "NSObject+OCSReliantContextBinding.h"
#import "NSObject+OCSReliantInjection.h"
#endif
| Java |
// ==========================================================================
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex UG (haftungsbeschraenkt)
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Collections.Immutable;
using OpenIddict.Abstractions;
using OpenIddict.Server;
using static OpenIddict.Server.OpenIddictServerEvents;
namespace Squidex.Areas.IdentityServer.Config
{
public sealed class AlwaysAddTokenHandler : IOpenIddictServerHandler<ProcessSignInContext>
{
public ValueTask HandleAsync(ProcessSignInContext context)
{
if (context == null)
{
return default;
}
if (!string.IsNullOrWhiteSpace(context.Response.AccessToken))
{
var scopes = context.AccessTokenPrincipal?.GetScopes() ?? ImmutableArray<string>.Empty;
context.Response.Scope = string.Join(" ", scopes);
}
return default;
}
}
}
| Java |
using System.Diagnostics.CodeAnalysis;
namespace Npoi.Mapper
{
/// <summary>
/// Information for one row that read from file.
/// </summary>
/// <typeparam name="TTarget">The target mapping type for a row.</typeparam>
[SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Global")]
public class RowInfo<TTarget> : IRowInfo
{
#region Properties
/// <summary>
/// Row number.
/// </summary>
public int RowNumber { get; set; }
/// <summary>
/// Constructed value object from the row.
/// </summary>
public TTarget Value { get; set; }
/// <summary>
/// Column index of the first error.
/// </summary>
public int ErrorColumnIndex { get; set; }
/// <summary>
/// Error message for the first error.
/// </summary>
public string ErrorMessage { get; set; }
#endregion
#region Constructors
/// <summary>
/// Initialize a new RowData object.
/// </summary>
/// <param name="rowNumber">The row number</param>
/// <param name="value">Constructed value object from the row</param>
/// <param name="errorColumnIndex">Column index of the first error cell</param>
/// <param name="errorMessage">The error message</param>
public RowInfo(int rowNumber, TTarget value, int errorColumnIndex, string errorMessage)
{
RowNumber = rowNumber;
Value = value;
ErrorColumnIndex = errorColumnIndex;
ErrorMessage = errorMessage;
}
#endregion
}
}
| Java |
const path = require('path');
module.exports = {
lazyLoad: true,
pick: {
posts(markdownData) {
return {
meta: markdownData.meta,
description: markdownData.description,
};
},
},
plugins: [path.join(__dirname, '..', 'node_modules', 'bisheng-plugin-description')],
routes: [{
path: '/',
component: './template/Archive',
}, {
path: '/posts/:post',
dataPath: '/:post',
component: './template/Post',
}, {
path: '/tags',
component: './template/TagCloud',
}],
};
| Java |
<?php
namespace WindowsAzure\DistributionBundle\Deployment;
/**
* @author Stéphane Escandell <stephane.escandell@gmail.com>
*/
interface CustomIteratorInterface
{
/**
* @param array $dirs
* @param array $subdirs
*/
public function getIterator(array $dirs, array $subdirs);
} | Java |
import { Injectable } from '@angular/core';
import {Http,Response,ConnectionBackend,Headers,RequestMethod} from '@angular/http';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/toPromise';
import{AppHttpUtil} from '../appUtil/httpUtil';
import {AppPermService} from "./permService";
import {AppUrlConfig} from "../appConfig/urlConfig";
@Injectable()
export class AppLoginService {
constructor(private httpUtil: AppHttpUtil,private urlConfig:AppUrlConfig){
}
/**
* 用户登录
*/
login(_name:string,_pass:string){
return this.httpUtil.ajax({
url:this.urlConfig.emarketService+'system/login/',
method:RequestMethod.Post,
body:{
loginName:_name,
password:_pass
}
});
}
}
| Java |
/****************************************************************************
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2013-2016 zilongshanren
http://www.cocos2d-x.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.
****************************************************************************/
#import <AppKit/AppKit.h>
#include "ui/UIEditBox/Mac/CCUITextInput.h"
@interface CCUIPasswordTextField : NSTextField<CCUITextInput>
{
NSMutableDictionary* _placeholderAttributes;
}
@end
| Java |
// Init ES2015 + .jsx environments for .require()
require('babel-register');
var express = require('express');
var fluxexapp = require('./fluxexapp');
var serverAction = require('./actions/server');
var fluxexServerExtra = require('fluxex/extra/server');
var app = express();
// Provide /static/js/main.js
fluxexServerExtra.initStatic(app);
// Mount test page at /test
app.use('/product', fluxexServerExtra.createMiddlewareByAction(fluxexapp, serverAction.samplePage));
// Start server
app.listen(process.env.TESTPORT || 3000);
console.log('Fluxex started! Go http://localhost:3001/product?id=124');
| Java |
import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surface's coordinate system.
:param image: image array
:param edge_points3d: array of 3d coordinates of 4 corner points in clockwise direction
:param edge_points2d: array of 2d coordinates of 4 corner points in clockwise direction
"""
assert len(edge_points3d) == 4 and len(edge_points2d) == 4
self.image = image
self.edge_points3d = edge_points3d
self.edge_points2d = np.float32(edge_points2d) # This is required for using cv2's getPerspectiveTransform
self.normal = self._get_normal_vector()
def top_left_corner3d(self):
return self.edge_points3d[0]
def top_right_corner3d(self):
return self.edge_points3d[1]
def bottom_right_corner3d(self):
return self.edge_points3d[2]
def bottom_left_corner3d(self):
return self.edge_points3d[3]
def distance_to_point(self, point):
point_to_surface = point - self.top_left_corner3d()
distance_to_surface = self.normal.dot(point_to_surface)
return distance_to_surface
def _get_normal_vector(self):
"""
:return: the normal vector of the surface. It determined the front side
of the surface and it's not necessarily a unit vector
"""
p0 = self.edge_points3d[0]
p1 = self.edge_points3d[1]
p3 = self.edge_points3d[3]
v1 = p3 - p0
v2 = p1 - p0
normal = np.cross(v1, v2)
norm = np.linalg.norm(normal)
return normal / norm
class Polyhedron(object):
def __init__(self, surfaces):
self.surfaces = surfaces
class Space(object):
def __init__(self, models=None):
self.models = models or []
def add_model(self, model):
assert isinstance(model, Polyhedron)
self.models.append(model)
class Line2D(object):
def __init__(self, point1, point2):
"""
Using the line equation a*x + b*y + c = 0 with b >= 0
:param point1: starting point
:param point2: ending point
:return: a Line object
"""
assert len(point1) == 2 and len(point2) == 2
self.a = point2[1] - point1[1]
self.b = point1[0] - point2[0]
self.c = point1[1] * point2[0] - point1[0] * point2[1]
if self.b < 0:
self.a = -self.a
self.b = -self.b
self.c = -self.c
def is_point_on_left(self, point):
return self.a * point[0] + self.b * point[1] + self.c > 0
def is_point_on_right(self, point):
return self.a * point[0] + self.b * point[1] + self.c < 0
def is_point_on_line(self, point):
return self.a * point[0] + self.b * point[1] + self.c == 0
def get_y_from_x(self, x):
if self.b == 0:
return 0.0
return 1.0 * (-self.c - self.a * x) / self.b
def get_x_from_y(self, y):
if self.a == 0:
return 0.0
return 1.0 * (-self.c - self.b * y) / self.a
| Java |
# Sparse Arrays
Internally the V8 engine can represent `Array`s following one of two approaches:
- **Fast Elements**: linear storage for compact keys sets.
- **Dictionary Elements**: hash table storage (more expensive to access on runtime).
If you want V8 to represent your `Array` in the `Fast Elements` form, you need to take into account the following:
- Use contiguous keys starting at `0`.
- Don't pre-allocate large `Array` (e.g. *> 64K* elements) that you don't use.
- Don't delete elements, specially in numeric `Array`s.
- Don't load uninitialized or deleted elements.
Another consideration: any name used as property name that is not a `String` will be serialized, read more at [Properties Names](v8-tips/properties-names).
| Java |
<?php
return [
/**
*--------------------------------------------------------------------------
* Logging Configuration
*--------------------------------------------------------------------------
*
* Here you may configure the log settings for your application. Out of
* the box, the application uses the Monolog PHP logging library. This gives
* you a variety of powerful log handlers / formatters to utilize.
*
* Available Settings: "single", "daily", "syslog", "errorlog"
*
*/
'log' => env('APP_LOG', 'single'),
'log_level' => env('APP_LOG_LEVEL', 'debug'),
];
| Java |
# [Demo](https://keaws.github.io/git-api-client/)
## Install
```
npm i
npm start
```
| Java |
A PvPGNChatParser converts raw messages received from PvPGNChat to ChatMessage objects | Java |
import { fullSrc } from '../element/element';
import { pixels } from '../math/unit';
import { Clone } from './clone';
import { Container } from './container';
import { Image } from './image';
import { Overlay } from './overlay';
import { Wrapper } from './wrapper';
export class ZoomDOM {
static useExisting(element: HTMLImageElement, parent: HTMLElement, grandparent: HTMLElement): ZoomDOM {
let overlay = Overlay.create();
let wrapper = new Wrapper(grandparent);
let container = new Container(parent);
let image = new Image(element);
let src = fullSrc(element);
if (src === element.src) {
return new ZoomDOM(overlay, wrapper, container, image);
} else {
return new ZoomDOM(overlay, wrapper, container, image, new Clone(container.clone()));
}
}
static create(element: HTMLImageElement): ZoomDOM {
let overlay = Overlay.create();
let wrapper = Wrapper.create();
let container = Container.create();
let image = new Image(element);
let src = fullSrc(element);
if (src === element.src) {
return new ZoomDOM(overlay, wrapper, container, image);
} else {
return new ZoomDOM(overlay, wrapper, container, image, Clone.create(src));
}
}
readonly overlay: Overlay;
readonly wrapper: Wrapper;
readonly container: Container;
readonly image: Image;
readonly clone?: Clone;
constructor(overlay: Overlay, wrapper: Wrapper, container: Container, image: Image, clone?: Clone) {
this.overlay = overlay;
this.wrapper = wrapper;
this.container = container;
this.image = image;
this.clone = clone;
}
appendContainerToWrapper(): void {
this.wrapper.element.appendChild(this.container.element);
}
replaceImageWithWrapper(): void {
let parent = this.image.element.parentElement as HTMLElement;
parent.replaceChild(this.wrapper.element, this.image.element);
}
appendImageToContainer(): void {
this.container.element.appendChild(this.image.element);
}
appendCloneToContainer(): void {
if (this.clone !== undefined) {
this.container.element.appendChild(this.clone.element);
}
}
replaceImageWithClone(): void {
if (this.clone !== undefined) {
this.clone.show();
this.image.hide();
}
}
replaceCloneWithImage(): void {
if (this.clone !== undefined) {
this.image.show();
this.clone.hide();
}
}
fixWrapperHeight(): void {
this.wrapper.element.style.height = pixels(this.image.element.height);
}
collapsed(): void {
this.overlay.removeFrom(document.body);
this.image.deactivate();
this.wrapper.finishCollapsing();
}
/**
* Called at the end of an expansion to check if the clone loaded before our expansion finished. If it did, and is
* still not visible, we can now show it to the client.
*/
showCloneIfLoaded(): void {
if (this.clone !== undefined && this.clone.isLoaded() && this.clone.isHidden()) {
this.replaceImageWithClone();
}
}
}
| Java |
define(function(){
return {"乙":"乚乛",
"人":"亻",
"刀":"刂",
"卩":"㔾",
"尢":"尣𡯂兀",
"巛":"巜川",
"己":"已巳",
"彐":"彑",
"心":"忄",
"手":"扌",
"攴":"攵",
"无":"旡",
"歹":"歺",
"水":"氵氺",
"爪":"爫",
"火":"灬",
"":"户",
"牛":"牜",
"犬":"犭",
"玉":"王",
"疋":"",
"目":"",
"示":"礻",
"玄":"𤣥",
"糸":"糹",
"网":"冈",
"艸":"艹",
"竹":"",
"衣":"衤",
"襾":"西覀",
"老":"",
"聿":"",
"肉":"⺼",
"言":"訁",
"足":"",
"辵":"辶",
"邑":"⻏",
"阜":"阝",
"金":"釒",
"長":"镸",
"食":"飠",
"金":"釒",
"廾":"廾",
"爿":"丬"};
}); | Java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.