answer
stringlengths
15
1.25M
const sizeOf = { object: function () { return function (object) { let $start = 0 $start += 1 * object.array.length + 2 return $start } } () } const serializer = { all: { object: function () { return function (object, $buffer, $start) { let $i = [] for ($i[0] = 0; $i[0] < object.array.length; $i[0]++) { $buffer[$start++] = object.array[$i[0]] & 0xff } $buffer[$start++] = 0xd $buffer[$start++] = 0xa return { start: $start, serialize: null } } } () }, inc: { object: function () { return function (object, $step = 0, $i = []) { let $_, $bite return function $serialize ($buffer, $start, $end) { for (;;) { switch ($step) { case 0: $i[0] = 0 $step = 1 case 1: $bite = 0 $_ = object.array[$i[0]] case 2: while ($bite != -1) { if ($start == $end) { $step = 2 return { start: $start, serialize: $serialize } } $buffer[$start++] = $_ >>> $bite * 8 & 0xff $bite } if (++$i[0] != object.array.length) { $step = 1 continue } $step = 3 case 3: if ($start == $end) { $step = 3 return { start: $start, serialize: $serialize } } $buffer[$start++] = 0xd case 4: if ($start == $end) { $step = 4 return { start: $start, serialize: $serialize } } $buffer[$start++] = 0xa case 5: } break } return { start: $start, serialize: null } } } } () } } const parser = { all: { object: function () { return function ($buffer, $start) { let $i = [] let object = { array: [] } $i[0] = 0 for (;;) { if ( $buffer[$start] == 0xd && $buffer[$start + 1] == 0xa ) { $start += 2 break } object.array[$i[0]] = $buffer[$start++] $i[0]++ } return object } } () }, inc: { object: function () { return function (object, $step = 0, $i = []) { let $length = 0 return function $parse ($buffer, $start, $end) { for (;;) { switch ($step) { case 0: object = { array: [] } case 1: $i[0] = 0 case 2: $step = 2 if ($start == $end) { return { start: $start, object: null, parse: $parse } } if ($buffer[$start] != 0xd) { $step = 4 continue } $start++ $step = 3 case 3: $step = 3 if ($start == $end) { return { start: $start, object: null, parse: $parse } } if ($buffer[$start] != 0xa) { $step = 4 $parse(Buffer.from([ 0xd ]), 0, 1) continue } $start++ $step = 7 continue case 4: case 5: if ($start == $end) { $step = 5 return { start: $start, object: null, parse: $parse } } object.array[$i[0]] = $buffer[$start++] case 6: $i[0]++ $step = 2 continue case 7: } return { start: $start, object: object, parse: null } break } } } } () } } module.exports = { sizeOf: sizeOf, serializer: { all: serializer.all, inc: serializer.inc, bff: function ($incremental) { return { object: function () { return function (object) { return function ($buffer, $start, $end) { let $i = [] if ($end - $start < 2 + object.array.length * 1) { return $incremental.object(object, 0, $i)($buffer, $start, $end) } for ($i[0] = 0; $i[0] < object.array.length; $i[0]++) { $buffer[$start++] = object.array[$i[0]] & 0xff } $buffer[$start++] = 0xd $buffer[$start++] = 0xa return { start: $start, serialize: null } } } } () } } (serializer.inc) }, parser: { all: parser.all, inc: parser.inc, bff: function ($incremental) { return { object: function () { return function () { return function ($buffer, $start, $end) { let $i = [] let object = { array: [] } $i[0] = 0 for (;;) { if ($end - $start < 2) { return $incremental.object(object, 2, $i)($buffer, $start, $end) } if ( $buffer[$start] == 0xd && $buffer[$start + 1] == 0xa ) { $start += 2 break } if ($end - $start < 1) { return $incremental.object(object, 4, $i)($buffer, $start, $end) } object.array[$i[0]] = $buffer[$start++] $i[0]++ } return { start: $start, object: object, parse: null } } } () } } } (parser.inc) } }
#body { width: auto; } /* Coding Table */ .table_stat { z-index: 2; position: relative; } .table_bar { height: 80%; position: absolute; background: #DEF; /* cornflowerblue */ z-index: -1; top: 10%; left: 0%; } #agreement_table, #tweet_table { font-size: 10pt; } #agreement_table small { opacity: 0.5; } .tweet_table_Text { width: 60%; } #agreement_table tr:nth-child(even){ background-color: #F7F7F7; } .matrix-table-div { text-align: center; display: inline-block; position: relative; } .ylabel { top: 50%; height: 100%; left: 0px; transform: translate(-100%, -50%); text-orientation: sideways; writing-mode: vertical-lr; position: absolute; } #lMatrices table { table-layout: fixed; width: inherit; } #lMatrices td { font-size: 12px; width: 23px; height: 23px; overflow: hidden; white-space: nowrap; text-align: center; border-right-style: dotted; border-bottom-style: dotted; border-top-style: none; border-left-style: none; border-width: 1px; } #lMatrices tr td:last-child { border-right-style: none; border-left-style: double; border-left-width: 3px; } #lMatrices table tr:first-child, #lMatrices tr td:first-child { font-weight: bold; } #<API key> td { width: 30px; height: 30px; } #<API key> tr:last-child td { border-bottom-style: none; border-top-style: double; border-top-width: 3px; } /* #matrices tr:hover { background: #EEE; }*/ .coding_header h2 { display: inline; margin-right: 30px; } .u_cell_plain { border-right-style: none !important; border-left-style: none !important; border-top-style: none !important; border-bottom-style: none !important; } .u_cell_pairwise { border-right-style: dotted !important; border-left-style: none !important; border-top-style: none !important; border-bottom-style: dotted !important; } .u_cell_coltotal { border-right-style: dotted !important; border-left-style: none !important; border-top-style: double !important; border-bottom-style: none !important; } .u_cell_rowtotal { border-right-style: none !important; border-left-style: double !important; border-top-style: none !important; border-bottom-style: dotted !important; } .u_cell_toolow { background-color: #ff9896 } .u_cell_toohigh { background-color: #aec7e8 } .u_cell_lt75 { background-color: #dbdb8d } .u_cell_gt90 { background-color: #98df8a } .u_cell_colorscale { padding: 0px 5px; margin: 0px 5px; }
<!DOCTYPE HTML PUBLIC "- <html> <head> <title>Submission 944</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0"> <img src="gallery/submissions/944.jpg" height="400"> </body> </html>
@charset "UTF-8"; /* line 6, /vagrant/app/assets/stylesheets/staff/container.css.scss */ div#wrapper div#container h1 { margin: 0; padding: 9px 6px; font-size: 16px; font-weight: normal; background-color: #1a3333; color: #eeeeee; } /* line 4, /vagrant/app/assets/stylesheets/staff/layout.css.scss */ html, body { margin: 0; padding: 0; height: 100%; } /* line 9, /vagrant/app/assets/stylesheets/staff/layout.css.scss */ div#wrapper { position: relative; box-sizing: border-box; min-height: 100%; margin: 0 auto; padding-bottom: 48px; background-color: #cccccc; } /* line 17, /vagrant/app/assets/stylesheets/staff/layout.css.scss */ header { padding: 6px; background-color: #448888; color: #fafafa; } /* line 21, /vagrant/app/assets/stylesheets/staff/layout.css.scss */ header span.logo-mark { font-weight: bold; } /* line 25, /vagrant/app/assets/stylesheets/staff/layout.css.scss */ footer { bottom: 0; position: absolute; width: 100%; background-color: #666666; color: #fafafa; } /* line 31, /vagrant/app/assets/stylesheets/staff/layout.css.scss */ footer p { text-align: center; padding: 6px; margin: 0; } /* * This is a manifest file that'll be compiled into application.css, which will include all the files * listed below. * * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. * * You're free to add application-wide styles to this file and they'll appear at the bottom of the * compiled file so the styles you add here take precedence over styles defined in any styles * defined in the other CSS/SCSS files in this directory. It is generally better to create a new * file per style scope. * */
<?php namespace Fannan\MembersModule\Member; use Anomaly\Streams\Platform\Database\Seeder\Seeder; class MemberSeeder extends Seeder { /** * Run the seeder. */ public function run() { } }
<?php namespace InfinityGames\InfinityBundle\DependencyInjection; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\Config\FileLocator; use Symfony\Component\HttpKernel\DependencyInjection\Extension; use Symfony\Component\DependencyInjection\Loader; class <API key> extends Extension { /** * {@inheritDoc} */ public function load(array $configs, ContainerBuilder $container) { $configuration = new Configuration(); $config = $this-><API key>($configuration, $configs); $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('services.yml'); } }
import modelExtend from 'dva-model-extend' import { create, remove, update } from '../services/user' import * as usersService from '../services/users' import { pageModel } from './common' import { config } from 'utils' const { query } = usersService const { prefix } = config export default modelExtend(pageModel, { namespace: 'user', state: { currentItem: {}, modalVisible: false, modalType: 'create', selectedRowKeys: [], isMotion: localStorage.getItem(`${prefix}userIsMotion`) === 'true', }, subscriptions: { setup ({ dispatch, history }) { history.listen(location => { if (location.pathname === '/user') { dispatch({ type: 'query', payload: location.query, }) } }) }, }, effects: { *query ({ payload = {} }, { call, put }) { const data = yield call(query, payload) if (data) { yield put({ type: 'querySuccess', payload: { list: data.data, pagination: { current: Number(payload.page) || 1, pageSize: Number(payload.pageSize) || 10, total: data.total, }, }, }) } }, *'delete' ({ payload }, { call, put, select }) { const data = yield call(remove, { id: payload }) const { selectedRowKeys } = yield select(_ => _.user) if (data.success) { yield put({ type: 'updateState', payload: { selectedRowKeys: selectedRowKeys.filter(_ => _ !== payload) } }) yield put({ type: 'query' }) } else { throw data } }, *'multiDelete' ({ payload }, { call, put }) { const data = yield call(usersService.remove, payload) if (data.success) { yield put({ type: 'updateState', payload: { selectedRowKeys: [] } }) yield put({ type: 'query' }) } else { throw data } }, *create ({ payload }, { call, put }) { const data = yield call(create, payload) if (data.success) { yield put({ type: 'hideModal' }) yield put({ type: 'query' }) } else { throw data } }, *update ({ payload }, { select, call, put }) { const id = yield select(({ user }) => user.currentItem.id) const newUser = { ...payload, id } const data = yield call(update, newUser) if (data.success) { yield put({ type: 'hideModal' }) yield put({ type: 'query' }) } else { throw data } }, }, reducers: { showModal (state, { payload }) { return { ...state, ...payload, modalVisible: true } }, hideModal (state) { return { ...state, modalVisible: false } }, switchIsMotion (state) { localStorage.setItem(`${prefix}userIsMotion`, !state.isMotion) return { ...state, isMotion: !state.isMotion } }, }, })
#!/bin/bash cd "$(dirname "$BASH_SOURCE")" || { echo "Error getting script directory" >&2 exit 1 } ./hallo.command sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
<?php class C_admin extends CI_Controller { public function __construct() { parent::__construct(); if($this->session->userdata('level') != 'admin') { redirect('auth'); } } public function index() { $data['username'] = $this->session->userdata('username'); $this->load->view('dashboard_admin', $data); } public function activity() { $data['username'] = $this->session->userdata('username'); $this->load->view('activity_admin', $data); } public function mahasiswa() { $data['username'] = $this->session->userdata('username'); $this->load->view('mahasiswa_admin', $data); } public function logout() { $this->session->unset_userdata('username'); $this->session->unset_userdata('level'); $this->session->sess_destroy(); redirect('auth'); } } ?>
var blueMarker = L.AwesomeMarkers.icon({ icon: 'record', prefix: 'glyphicon', markerColor: 'blue' }); var airportMarker = L.AwesomeMarkers.icon({ icon: 'plane', prefix: 'fa', markerColor: 'cadetblue' }); var cityMarker = L.AwesomeMarkers.icon({ icon: 'home', markerColor: 'red' }); var stationMarker = L.AwesomeMarkers.icon({ icon: 'train', prefix: 'fa', markerColor: 'cadetblue' });
<?php namespace Phossa\Cache; interface CachePoolInterface { } class CachePool implements CachePoolInterface { } class TestMap { private $cache; public function __construct(CachePoolInterface $cache) { $this->cache = $cache; } public function getCache() { return $this->cache; } }
/** * jspsych plugin for categorization trials with feedback and animated stimuli * Josh de Leeuw * * documentation: docs.jspsych.org **/ jsPsych.plugins["<API key>"] = (function() { var plugin = {}; jsPsych.pluginAPI.registerPreload('<API key>', 'stimuli', 'image'); plugin.info = { name: '<API key>', description: '', parameters: { stimuli: { type: jsPsych.plugins.parameterType.IMAGE, pretty_name: 'Stimuli', default: undefined, description: 'Array of paths to image files.' }, key_answer: { type: jsPsych.plugins.parameterType.KEYCODE, pretty_name: 'Key answer', default: undefined, description: 'The key to indicate correct response' }, choices: { type: jsPsych.plugins.parameterType.KEYCODE, pretty_name: 'Choices', default: jsPsych.ALL_KEYS, array: true, description: 'The keys subject is allowed to press to respond to stimuli.' }, text_answer: { type: jsPsych.plugins.parameterType.STRING, pretty_name: 'Text answer', default: null, description: 'Text to describe correct answer.' }, correct_text: { type: jsPsych.plugins.parameterType.STRING, pretty_name: 'Correct text', default: 'Correct.', description: 'String to show when subject gives correct answer' }, incorrect_text: { type: jsPsych.plugins.parameterType.STRING, pretty_name: 'Incorrect text', default: 'Wrong.', description: 'String to show when subject gives incorrect answer.' }, frame_time: { type: jsPsych.plugins.parameterType.INT, pretty_name: 'Frame time', default: 500, description: 'Duration to display each image.' }, sequence_reps: { type: jsPsych.plugins.parameterType.INT, pretty_name: 'Sequence repetitions', default: 1, description: 'How many times to display entire sequence.' }, <API key>: { type: jsPsych.plugins.parameterType.BOOL, pretty_name: 'Allow response before complete', default: false, description: 'If true, subject can response before the animation sequence finishes' }, feedback_duration: { type: jsPsych.plugins.parameterType.INT, pretty_name: 'Feedback duration', default: 2000, description: 'How long to show feedback' }, prompt: { type: jsPsych.plugins.parameterType.STRING, pretty_name: 'Prompt', default: null, description: 'Any content here will be displayed below the stimulus.' }, render_on_canvas: { type: jsPsych.plugins.parameterType.BOOL, pretty_name: 'Render on canvas', default: true, description: 'If true, the images will be drawn onto a canvas element (prevents blank screen between consecutive images in some browsers).'+ 'If false, the image will be shown via an img element.' } } } plugin.trial = function(display_element, trial) { var animate_frame = -1; var reps = 0; var showAnimation = true; var responded = false; var timeoutSet = false; var correct; if (trial.render_on_canvas) { // first clear the display element (because the render_on_canvas method appends to display_element instead of overwriting it with .innerHTML) if (display_element.hasChildNodes()) { while (display_element.firstChild) { display_element.removeChild(display_element.firstChild); } } var canvas = document.createElement("canvas"); canvas.id = "<API key>"; canvas.style.margin = 0; canvas.style.padding = 0; display_element.insertBefore(canvas, null); var ctx = canvas.getContext("2d"); if (trial.prompt !== null) { var prompt_div = document.createElement("div"); prompt_div.id = "<API key>"; prompt_div.style.visibility = "hidden"; prompt_div.innerHTML = trial.prompt; display_element.insertBefore(prompt_div, canvas.nextElementSibling); } var feedback_div = document.createElement("div"); display_element.insertBefore(feedback_div, display_element.nextElementSibling); } // show animation var animate_interval = setInterval(function() { if (!trial.render_on_canvas) { display_element.innerHTML = ''; // clear everything } animate_frame++; if (animate_frame == trial.stimuli.length) { animate_frame = 0; reps++; // check if reps complete // if (trial.sequence_reps != -1 && reps >= trial.sequence_reps) { // done with animation showAnimation = false; } } if (showAnimation) { if (trial.render_on_canvas) { display_element.querySelector('#<API key>').style.visibility = 'visible'; var img = new Image(); img.src = trial.stimuli[animate_frame]; canvas.height = img.naturalHeight; canvas.width = img.naturalWidth; ctx.drawImage(img,0,0); } else { display_element.innerHTML += '<img src="'+trial.stimuli[animate_frame]+'" class="<API key>"></img>'; } } if (!responded && trial.<API key>) { // in here if the user can respond before the animation is done if (trial.prompt !== null) { if (trial.render_on_canvas) { prompt_div.style.visibility = "visible"; } else { display_element.innerHTML += trial.prompt; } } if (trial.render_on_canvas) { if (!showAnimation) { canvas.remove(); } } } else if (!responded) { // in here if the user has to wait to respond until animation is done. // if this is the case, don't show the prompt until the animation is over. if (!showAnimation) { if (trial.prompt !== null) { if (trial.render_on_canvas) { prompt_div.style.visibility = "visible"; } else { display_element.innerHTML += trial.prompt; } } if (trial.render_on_canvas) { canvas.remove(); } } } else { // user has responded if we get here. // show feedback var feedback_text = ""; if (correct) { feedback_text = trial.correct_text.replace("%ANS%", trial.text_answer); } else { feedback_text = trial.incorrect_text.replace("%ANS%", trial.text_answer); } if (trial.render_on_canvas) { if (trial.prompt !== null) { prompt_div.remove(); } feedback_div.innerHTML = feedback_text; } else { display_element.innerHTML += feedback_text; } // set timeout to clear feedback if (!timeoutSet) { timeoutSet = true; jsPsych.pluginAPI.setTimeout(function() { endTrial(); }, trial.feedback_duration); } } }, trial.frame_time); var keyboard_listener; var trial_data = {}; var after_response = function(info) { // ignore the response if animation is playing and subject // not allowed to respond before it is complete if (!trial.<API key> && showAnimation) { return false; } correct = false; if (trial.key_answer == info.key) { correct = true; } responded = true; trial_data = { "stimulus": JSON.stringify(trial.stimuli), "rt": info.rt, "correct": correct, "key_press": info.key }; jsPsych.pluginAPI.<API key>(keyboard_listener); } keyboard_listener = jsPsych.pluginAPI.getKeyboardResponse({ callback_function: after_response, valid_responses: trial.choices, rt_method: 'performance', persist: true, allow_held_key: false }); function endTrial() { clearInterval(animate_interval); // stop animation! display_element.innerHTML = ''; // clear everything jsPsych.finishTrial(trial_data); } }; return plugin; })();
<?php namespace Pho\Lib\Graph; /** * Holds the relationship between nodes and edges. * * EdgeList objects are attached to all Node objects, they are * created at object initialization. They contain edge objects * categorized by their direction. * * @see ImmutableEdgeList For a list that doesn't accept new values. * * @author Emre Sokullu <emre@phonetworks.org> */ class EdgeList { /** * The node thay this edgelist belongs to * * @var NodeInterface */ private $master; /** * An internal pointer of outgoing nodes in [ID=>EncapsulatedEdge] format * where ID belongs to the edge. * * @var array */ private $out = []; /** * An internal pointer of incoming nodes in [ID=>EncapsulatedEdge] format * where ID belongs to the edge * * @var array */ private $in = []; /** * An internal pointer of incoming nodes in [ID=>[ID=>EncapsulatedEdge]] format * where first ID belongs to the node, and second to the edge. * * @var array */ private $from = []; /** * An internal pointer of outgoing nodes in [ID=>[ID=>EncapsulatedEdge]] format * where first ID belongs to the node, and second to the edge. * * @var array */ private $to = []; /** * Constructor * * For performance reasons, the constructor doesn't load the seed data * (if available) but waits for a method to attempt to access. * * @param NodeInterface $node The master, the owner of this EdgeList object. * @param array $data Initial data to seed. */ public function __construct(NodeInterface $node, array $data = []) { $this->master = $node; $this->import($data); } public function delete(ID $id): void { $id = (string) $id; foreach($this->from as $key=>$val) { unset($this->from[$key][$id]); } foreach($this->to as $key=>$val) { unset($this->to[$key][$id]); } unset($this->in[$id]); unset($this->out[$id]); $this->master->emit("modified"); } /** * Imports data from given array source * * @param array $data Data source. * * @return void */ public function import(array $data): void { if(!$this->isDataSetProperly($data)) { return; } $wakeup = function (array $array): EncapsulatedEdge { return EncapsulatedEdge::fromArray($array); }; $this->out = array_map($wakeup, $data["out"]); $this->in = array_map($wakeup, $data["in"]); foreach($data["from"] as $from => $frozen) { $this->from[$from] = array_map($wakeup, $frozen); } foreach($data["to"] as $to => $frozen) { $this->to[$to] = array_map($wakeup, $frozen); } } /** * Checks if the data source for import is valid. * * @param array $data * * @return bool */ private function isDataSetProperly(array $data): bool { return (isset($data["in"]) && isset($data["out"]) && isset($data["from"]) && isset($data["to"])); } /** * Retrieves this object in array format * * With all "in" and "out" values in simple string format. * The "to" array can be reconstructed. * * @return array */ public function toArray(): array { $to_array = function (EncapsulatedEdge $encapsulated): array { return $encapsulated->toArray(); }; $array = []; $array["to"] = []; foreach($this->to as $to => $encapsulated) { $array["to"][$to] = array_map($to_array, $encapsulated); } $array["from"] = []; foreach($this->from as $from => $encapsulated) { $array["from"][$from] = array_map($to_array, $encapsulated); } $array["in"] = array_map($to_array, $this->in); $array["out"] = array_map($to_array, $this->out); return $array; } /** * Adds an incoming edge to the list. * * The edge must be already initialized. * * @param EdgeInterface $edge * * @return void */ public function addIncoming(EdgeInterface $edge): void { $edge_encapsulated = EncapsulatedEdge::fromEdge($edge); $this->from[(string) $edge->tail()->id()][(string) $edge->id()] = $edge_encapsulated; $this->in[(string) $edge->id()] = $edge_encapsulated; $this->master->emit("modified"); } /** * Adds an outgoing edge to the list. * * The edge must be already initialized. * * @param EdgeInterface $edge * * @return void */ public function addOutgoing(EdgeInterface $edge): void { $edge_encapsulated = EncapsulatedEdge::fromEdge($edge); $this->to[(string) $edge->head()->id()][(string) $edge->id()] = $edge_encapsulated; $this->out[(string) $edge->id()] = $edge_encapsulated; $this->master->emit("modified"); } /** * Returns a list of all the edges directed towards * this particular node. * * @see retrieve Used by this method to fetch objects. * * @param string $class The type of edge (defined in edge class) to return * * @return \ArrayIterator An array of EdgeInterface objects. */ public function in(string $class=""): \ArrayIterator { return $this->retrieve(Direction::in(), $class); } /** * Returns a list of all the edges originating from * this particular node. * * @see retrieve Used by this method to fetch objects. * * @param string $class The type of edge (defined in edge class) to return * * @return \ArrayIterator An array of EdgeInterface objects. */ public function out(string $class=""): \ArrayIterator { return $this->retrieve(Direction::out(), $class); } /** * A helper method to retrieve edges. * * @see out A method that uses this function * @see in A method that uses this function * * @param Direction $direction Lets you choose to fetch incoming or outgoing edges. * @param string $class The type of edge (defined in edge class) to return * * @return \ArrayIterator An array of EdgeInterface objects. */ protected function retrieve(Direction $direction, string $class): \ArrayIterator { $d = (string) $direction; $hydrate = function (EncapsulatedEdge $encapsulated): EdgeInterface { if(!$encapsulated->hydrated()) return $this->master->edge($encapsulated->id()); return $encapsulated->edge(); }; $filter_classes = function (EncapsulatedEdge $encapsulated) use ($class): bool { return in_array($class, $encapsulated->classes()); }; if(empty($class)) { return new \ArrayIterator( array_map($hydrate, $this->$d) ); } return new \ArrayIterator( array_map($hydrate, array_filter($this->$d, $filter_classes) ) ); } /** * Returns a list of all the edges (both in and out) pertaining to * this particular node. * * @param string $class The type of edge (defined in edge class) to return * * @return \ArrayIterator An array of EdgeInterface objects. */ public function all(string $class=""): \ArrayIterator { return new \ArrayIterator( array_merge( $this->in($class)->getArrayCopy(), $this->out($class)->getArrayCopy() ) ); } /** * Retrieves a list of edges from the list's owner node to the given * target node. * * @param ID $node_id Target (head) node. * @param string $class The type of edge (defined in edge class) to return * * @return \ArrayIterator An array of edge objects to. Returns an empty array if there is no such connections. */ public function to(ID $node_id, string $class=""): \ArrayIterator { return $this->retrieveDirected(Direction::out(), $node_id, $class); } /** * Retrieves a list of edges to the list's owner node from the given * source node. * * @param ID $node_id Source (tail) node. * @param string $class The type of edge (defined in edge class) to return * * @return \ArrayIterator An array of edge objects from. Returns an empty array if there is no such connections. */ public function from(ID $node_id, string $class=""): \ArrayIterator { return $this->retrieveDirected(Direction::in(), $node_id, $class); } /** * Retrieves a list of edges between the list's owner node and the given * node. * * @param ID $node_id The other node. * @param string $class The type of edge (defined in edge class) to return * * @return \ArrayIterator An array of edge objects in between. Returns an empty array if there is no such connections. */ public function between(ID $node_id, string $class=""): \ArrayIterator { return new \ArrayIterator( array_merge( $this->from($node_id, $class)->getArrayCopy(), $this->to($node_id, $class)->getArrayCopy() ) ); } /** * A helper method to retrieve directed edges. * * @see from A method that uses this function * @see to A method that uses this function * * @param Direction $direction Lets you choose to fetch incoming or outgoing edges. * @param ID $node_id Directed towards which node. * @param string $class The type of edge (defined in edge class) to return. * * @return \ArrayIterator An array of EdgeInterface objects. */ protected function retrieveDirected(Direction $direction, ID $node_id, string $class): \ArrayIterator { $key = $direction->equals(Direction::in()) ? "from" : "to"; $direction = (string) $direction; $hydrate = function (EncapsulatedEdge $encapsulated): EdgeInterface { if(!$encapsulated->hydrated()) return $this->master->edge($encapsulated->id()); return $encapsulated->edge(); }; $filter_classes = function (EncapsulatedEdge $encapsulated) use ($class): bool { return in_array($class, $encapsulated->classes()); }; if(!isset($this->$key[(string) $node_id])) { return new \ArrayIterator(); } if(empty($class)) { return new \ArrayIterator( array_map($hydrate, $this->$key[(string) $node_id]) ); } return new \ArrayIterator( array_map($hydrate, array_filter($this->$key[(string) $node_id], $filter_classes)) ); } }
package me.august.lumen.data; import me.august.lumen.compile.resolve.data.ClassData; import me.august.lumen.compile.resolve.lookup.DependencyManager; import org.junit.Assert; import org.junit.Test; public class DataTest { @Test public void testClassData() { ClassData data = ClassData.fromClass(String.class); Assert.assertEquals( String.class.getName(), data.getName() ); String[] expected = new String[]{ "java.io.Serializable", "java.lang.Comparable", "java.lang.CharSequence" }; Assert.assertArrayEquals( expected, data.getInterfaces() ); } @Test public void testAssignableTo() { DependencyManager deps = new DependencyManager(); ClassData data; data = ClassData.fromClass(String.class); Assert.assertTrue( "Expected String to be assignable to String", data.isAssignableTo("java.lang.String", deps) ); Assert.assertTrue( "Expected String to be assignable to Object", data.isAssignableTo("java.lang.Object", deps) ); Assert.assertTrue( "Expected String to be assignable to CharSequence", data.isAssignableTo("java.lang.CharSequence", deps) ); data = ClassData.fromClass(Object.class); Assert.assertFalse( "Expected Object to not be assignable to String", data.isAssignableTo("java.lang.String", deps) ); data = ClassData.fromClass(CharSequence.class); Assert.assertTrue( "Expected CharSequence to be assignable to Object", data.isAssignableTo("java.lang.Object", deps) ); } }
<?php define("SITEDOMAIN", "{SITE-DOMAIN}"); define("DB_HOST", "{DB-HOST}"); define("DB_USER", "{DB-USER}"); define("DB_PASSWORD", "{DB-PASS}"); define("DB_NAME", "{DB-NAME}"); define("DB_PREFIX", "{DB-PREFIX}"); //Flag: (1=ON, 0=OFF) $devMode = 0; $link = "{GRAVATAR-LINK}"; if (!$devMode) error_reporting(0); define("BASEROOT", dirname(__FILE__)); define("SESSIONNAME", "CodeClipboard"); require BASEROOT . "/includes/functions.php"; session_name(SESSIONNAME);
<?php namespace Wtk\Response\Header\Field; use Wtk\Response\Header\Field\AbstractField; use Wtk\Response\Header\Field\FieldInterface; /** * Basic implementation - simple Value Object for Header elements * * @author Wojtek Zalewski <wojtek@neverbland.com> */ class Field extends AbstractField implements FieldInterface { /** * Field name * * @var string */ protected $name; /** * Field value * * @var mixed */ protected $value; /** * * @param string $name * @param mixed $value */ public function __construct($name, $value) { $this->name = $name; /** * @todo: is is object, than it has to * implement toString method * We have to check for it now. */ $this->value = $value; } /** * Returns field name * * @return string */ public function getName() { return $this->name; } /** * Returns header field value * * @return string */ public function getValue() { return $this->value; } }
'use strict'; var app = angular.module('Fablab'); app.controller('<API key>', function ($scope, $location, $filter, $window, PurchaseService, NotificationService, StaticDataService, SupplyService) { $scope.selected = {purchase: undefined}; $scope.currency = App.CONFIG.CURRENCY; $scope.loadPurchase = function (id) { PurchaseService.get(id, function (data) { $scope.purchase = data; }); }; $scope.save = function () { var purchaseCurrent = angular.copy($scope.purchase); updateStock(); PurchaseService.save(purchaseCurrent, function (data) { $scope.purchase = data; NotificationService.notify("success", "purchase.notification.saved"); $location.path("purchases"); }); }; var updateStock = function () { var stockInit = $scope.purchase.supply.quantityStock; $scope.purchase.supply.quantityStock = parseFloat(stockInit) - parseFloat($scope.purchase.quantity); var supplyCurrent = angular.copy($scope.purchase.supply); SupplyService.save(supplyCurrent, function (data) { $scope.purchase.supply = data; }); }; $scope.maxMoney = function () { return parseFloat($scope.purchase.quantity) * parseFloat($scope.purchase.supply.sellingPrice); }; $scope.updatePrice = function () { var interTotal = parseFloat($scope.purchase.quantity) * parseFloat($scope.purchase.supply.sellingPrice); if ($scope.purchase.discount === undefined || !$scope.purchase.discount) { //0.05 cts ceil var val = $window.Math.ceil(interTotal * 20) / 20; $scope.purchase.purchasePrice = $filter('number')(val, 2); ; } else { if ($scope.purchase.discountPercent) { var discountInter = parseFloat(interTotal) * (parseFloat($scope.purchase.discount) / parseFloat(100)); var total = parseFloat(interTotal) - parseFloat(discountInter); //0.05 cts ceil var val = $window.Math.ceil(total * 20) / 20; $scope.purchase.purchasePrice = $filter('number')(val, 2); } else { var total = parseFloat(interTotal) - parseFloat($scope.purchase.discount); //0.05 cts ceil var val = $window.Math.ceil(total * 20) / 20; $scope.purchase.purchasePrice = $filter('number')(val, 2); } } }; $scope.firstPercent = App.CONFIG.FIRST_PERCENT.toUpperCase() === "PERCENT"; $scope.optionsPercent = [{ name: "%", value: true }, { name: App.CONFIG.CURRENCY, value: false }]; $scope.today = function () { $scope.dt = new Date(); }; $scope.today(); $scope.clear = function () { $scope.dt = null; }; $scope.open = function ($event) { $event.preventDefault(); $event.stopPropagation(); $scope.opened = true; }; $scope.dateOptions = { formatYear: 'yy', startingDay: 1 }; $scope.formats = ['dd-MMMM-yyyy', 'yyyy/MM/dd', 'dd.MM.yyyy', 'shortDate']; $scope.format = $scope.formats[2]; var tomorrow = new Date(); tomorrow.setDate(tomorrow.getDate() + 1); var afterTomorrow = new Date(); afterTomorrow.setDate(tomorrow.getDate() + 2); $scope.events = [ { date: tomorrow, status: 'full' }, { date: afterTomorrow, status: 'partially' } ]; $scope.getDayClass = function (date, mode) { if (mode === 'day') { var dayToCheck = new Date(date).setHours(0, 0, 0, 0); for (var i = 0; i < $scope.events.length; i++) { var currentDay = new Date($scope.events[i].date).setHours(0, 0, 0, 0); if (dayToCheck === currentDay) { return $scope.events[i].status; } } } return ''; }; StaticDataService.loadSupplyStock(function (data) { $scope.supplyStock = data; }); StaticDataService.loadCashiers(function (data) { $scope.cashierList = data; }); } ); app.controller('<API key>', function ($scope, $controller, $rootScope) { $controller('<API key>', {$scope: $scope}); $scope.newPurchase = true; $scope.paidDirectly = false; $scope.purchase = { purchaseDate: new Date(), user: $rootScope.connectedUser.user }; } ); app.controller('<API key>', function ($scope, $routeParams, $controller) { $controller('<API key>', {$scope: $scope}); $scope.newPurchase = false; $scope.loadPurchase($routeParams.id); } );
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package ons; import ons.util.WeightedGraph; import org.w3c.dom.*; /** * The physical topology of a network refers to he physical layout of devices on * a network, or to the way that the devices on a network are arranged and how * they communicate with each other. * * @author andred */ public abstract class PhysicalTopology { protected int nodes; protected int links; protected OXC[] nodeVector; protected Link[] linkVector; protected Link[][] adjMatrix; /** * Creates a new PhysicalTopology object. Takes the XML file containing all * the information about the simulation environment and uses it to populate * the PhysicalTopology object. The physical topology is basically composed * of nodes connected by links, each supporting different wavelengths. * * @param xml file that contains the simulation environment information */ public PhysicalTopology(Element xml) { try { if (Simulator.verbose) { System.out.println(xml.getAttribute("name")); } } catch (Throwable t) { t.printStackTrace(); } } /** * Retrieves the number of nodes in a given PhysicalTopology. * * @return the value of the PhysicalTopology's nodes attribute */ public int getNumNodes() { return nodes; } /** * Retrieves the number of links in a given PhysicalTopology. * * @return number of items in the PhysicalTopology's linkVector attribute */ public int getNumLinks() { return linkVector.length; } /** * Retrieves a specific node in the PhysicalTopology object. * * @param id the node's unique identifier * @return specified node from the PhysicalTopology's nodeVector */ public OXC getNode(int id) { return nodeVector[id]; } /** * Retrieves a specific link in the PhysicalTopology object, based on its * unique identifier. * * @param linkid the link's unique identifier * @return specified link from the PhysicalTopology's linkVector */ public Link getLink(int linkid) { return linkVector[linkid]; } /** * Retrieves a specific link in the PhysicalTopology object, based on its * source and destination nodes. * * @param src the link's source node * @param dst the link's destination node * @return the specified link from the PhysicalTopology's adjMatrix */ public Link getLink(int src, int dst) { return adjMatrix[src][dst]; } /** * Retrives a given PhysicalTopology's adjancency matrix, which contains the * links between source and destination nodes. * * @return the PhysicalTopology's adjMatrix */ public Link[][] getAdjMatrix() { return adjMatrix; } /** * Says whether exists or not a link between two given nodes. * * @param node1 possible link's source node * @param node2 possible link's destination node * @return true if the link exists in the PhysicalTopology's adjMatrix */ public boolean hasLink(int node1, int node2) { if (adjMatrix[node1][node2] != null) { return true; } else { return false; } } /** * Checks if a path made of links makes sense by checking its continuity * * @param links to be checked * @return true if the link exists in the PhysicalTopology's adjMatrix */ public boolean checkLinkPath(int links[]) { for (int i = 0; i < links.length - 1; i++) { if (!(getLink(links[i]).dst == getLink(links[i + 1]).src)) { return false; } } return true; } /** * Returns a weighted graph with vertices, edges and weights representing * the physical network nodes, links and weights implemented by this class * object. * * @return an WeightedGraph class object */ public WeightedGraph getWeightedGraph() { WeightedGraph g = new WeightedGraph(nodes); for (int i = 0; i < nodes; i++) { for (int j = 0; j < nodes; j++) { if (hasLink(i, j)) { g.addEdge(i, j, getLink(i, j).getWeight()); } } } return g; } public void <API key>() { // Edges System.out.println("EDGES: ["); for (int i = 0; i < this.getNumNodes(); i++) { for (int j = 0; j < this.getNumNodes(); j++) { if (this.hasLink(i, j)) { System.out.println("(" + Integer.toString(i + 1) + " " + Integer.toString(j + 1) + ") 1"); } else { System.out.println("(" + Integer.toString(i + 1) + " " + Integer.toString(j + 1) + ") 0"); } } } System.out.println("]"); System.out.println(); // SD Pairs System.out.println("TRAFFIC: ["); for (int i = 0; i < this.getNumNodes(); i++) { for (int j = 0; j < this.getNumNodes(); j++) { if (i != j) { System.out.println("(" + Integer.toString(i + 1) + " " + Integer.toString(j + 1) + ") 1"); } else { System.out.println("(" + Integer.toString(i + 1) + " " + Integer.toString(j + 1) + ") 0"); } } } System.out.println("]"); } /** * Prints all nodes and links between them in the PhysicalTopology object. * * @return string containing the PhysicalTopology's adjMatrix values */ @Override public String toString() { String topo = ""; for (int i = 0; i < nodes; i++) { for (int j = 0; j < nodes; j++) { if (adjMatrix[i][j] != null) { topo += adjMatrix[i][j].toString() + "\n\n"; } } } return topo; } public abstract void <API key>(LightPath lp); public abstract void <API key>(LightPath lp); public abstract boolean <API key>(LightPath lp); public abstract double getBW(LightPath lp); public abstract double getBWAvailable(LightPath lp); public abstract boolean canAddFlow(Flow flow, LightPath lightpath); public abstract void addFlow(Flow flow, LightPath lightpath); public abstract void addBulkData(BulkData bulkData, LightPath lightpath); public abstract void removeFlow(Flow flow, LightPath lightpath); public abstract boolean canAddBulkData(BulkData bulkData, LightPath lightpath); }
require File.join [Pluct.root, 'lib/pluct/extensions/json'] describe JSON do it 'returns false for invalid data' do ['', ' ', 'string'].each do |s| expect(JSON.is_json?(s)).to be_false end end it 'returns true for valid data' do expect(JSON.is_json?('{"name" : "foo"}')).to be_true end end
module VhdlTestScript class Wait CLOCK_LENGTH = 2 def initialize(length) @length = length end def to_vhdl "wait for #{@length * CLOCK_LENGTH} ns;" end def in(ports) self end def origin self end end end
version: v1.4.13 category: API redirect_from: - /docs/v0.37.8/api/global-shortcut - /docs/v0.37.7/api/global-shortcut - /docs/v0.37.6/api/global-shortcut - /docs/v0.37.5/api/global-shortcut - /docs/v0.37.4/api/global-shortcut - /docs/v0.37.3/api/global-shortcut - /docs/v0.36.12/api/global-shortcut - /docs/v0.37.1/api/global-shortcut - /docs/v0.37.0/api/global-shortcut - /docs/v0.36.11/api/global-shortcut - /docs/v0.36.10/api/global-shortcut - /docs/v0.36.9/api/global-shortcut - /docs/v0.36.8/api/global-shortcut - /docs/v0.36.7/api/global-shortcut - /docs/v0.36.6/api/global-shortcut - /docs/v0.36.5/api/global-shortcut - /docs/v0.36.4/api/global-shortcut - /docs/v0.36.3/api/global-shortcut - /docs/v0.35.5/api/global-shortcut - /docs/v0.36.2/api/global-shortcut - /docs/v0.36.0/api/global-shortcut - /docs/v0.35.4/api/global-shortcut - /docs/v0.35.3/api/global-shortcut - /docs/v0.35.2/api/global-shortcut - /docs/v0.34.4/api/global-shortcut - /docs/v0.35.1/api/global-shortcut - /docs/v0.34.3/api/global-shortcut - /docs/v0.34.2/api/global-shortcut - /docs/v0.34.1/api/global-shortcut - /docs/v0.34.0/api/global-shortcut - /docs/v0.33.9/api/global-shortcut - /docs/v0.33.8/api/global-shortcut - /docs/v0.33.7/api/global-shortcut - /docs/v0.33.6/api/global-shortcut - /docs/v0.33.4/api/global-shortcut - /docs/v0.33.3/api/global-shortcut - /docs/v0.33.2/api/global-shortcut - /docs/v0.33.1/api/global-shortcut - /docs/v0.33.0/api/global-shortcut - /docs/v0.32.3/api/global-shortcut - /docs/v0.32.2/api/global-shortcut - /docs/v0.31.2/api/global-shortcut - /docs/v0.31.0/api/global-shortcut - /docs/v0.30.4/api/global-shortcut - /docs/v0.29.2/api/global-shortcut - /docs/v0.29.1/api/global-shortcut - /docs/v0.28.3/api/global-shortcut - /docs/v0.28.2/api/global-shortcut - /docs/v0.28.1/api/global-shortcut - /docs/v0.28.0/api/global-shortcut - /docs/v0.27.3/api/global-shortcut - /docs/v0.27.2/api/global-shortcut - /docs/v0.27.1/api/global-shortcut - /docs/v0.27.0/api/global-shortcut - /docs/v0.26.1/api/global-shortcut - /docs/v0.26.0/api/global-shortcut - /docs/v0.25.3/api/global-shortcut - /docs/v0.25.2/api/global-shortcut - /docs/v0.25.1/api/global-shortcut - /docs/v0.25.0/api/global-shortcut - /docs/v0.24.0/api/global-shortcut - /docs/v0.23.0/api/global-shortcut - /docs/v0.22.3/api/global-shortcut - /docs/v0.22.2/api/global-shortcut - /docs/v0.22.1/api/global-shortcut - /docs/v0.21.3/api/global-shortcut - /docs/v0.21.2/api/global-shortcut - /docs/v0.21.1/api/global-shortcut - /docs/v0.21.0/api/global-shortcut - /docs/v0.20.8/api/global-shortcut - /docs/v0.20.7/api/global-shortcut - /docs/v0.20.6/api/global-shortcut - /docs/v0.20.5/api/global-shortcut - /docs/v0.20.4/api/global-shortcut - /docs/v0.20.3/api/global-shortcut - /docs/v0.20.2/api/global-shortcut - /docs/v0.20.1/api/global-shortcut - /docs/v0.20.0/api/global-shortcut - /docs/vlatest/api/global-shortcut source_url: 'https://github.com/electron/electron/blob/master/docs/api/global-shortcut.md' title: globalShortcut excerpt: Detect keyboard events when the application does not have keyboard focus. sort_title: global-shortcut # globalShortcut > Detect keyboard events when the application does not have keyboard focus. Process: [Main]({{site.baseurl}}/docs/tutorial/quick-start#main-process) The `globalShortcut` module can register/unregister a global keyboard shortcut with the operating system so that you can customize the operations for various shortcuts. **Note:** The shortcut is global; it will work even if the app does not have the keyboard focus. You should not use this module until the `ready` event of the app module is emitted. javascript const {app, globalShortcut} = require('electron') app.on('ready', () => { // Register a 'CommandOrControl+X' shortcut listener. const ret = globalShortcut.register('CommandOrControl+X', () => { console.log('CommandOrControl+X is pressed') }) if (!ret) { console.log('registration failed') } // Check whether a shortcut is registered. console.log(globalShortcut.isRegistered('CommandOrControl+X')) }) app.on('will-quit', () => { // Unregister a shortcut. globalShortcut.unregister('CommandOrControl+X') // Unregister all shortcuts. globalShortcut.unregisterAll() }) ## Methods The `globalShortcut` module has the following methods: `globalShortcut.register(accelerator, callback)` * `accelerator` [Accelerator]({{site.baseurl}}/docs/api/accelerator) * `callback` Function Registers a global shortcut of `accelerator`. The `callback` is called when the registered shortcut is pressed by the user. When the accelerator is already taken by other applications, this call will silently fail. This behavior is intended by operating systems, since they don't want applications to fight for global shortcuts. `globalShortcut.isRegistered(accelerator)` * `accelerator` [Accelerator]({{site.baseurl}}/docs/api/accelerator) Returns `Boolean` - Whether this application has registered `accelerator`. When the accelerator is already taken by other applications, this call will still return `false`. This behavior is intended by operating systems, since they don't want applications to fight for global shortcuts. `globalShortcut.unregister(accelerator)` * `accelerator` [Accelerator]({{site.baseurl}}/docs/api/accelerator) Unregisters the global shortcut of `accelerator`. `globalShortcut.unregisterAll()` Unregisters all of the global shortcuts.
uid: <API key>.BSplineCurve2d.GetParameterRange(System.Double@,System.Double@) summary: remarks: syntax: parameters: - id: End description: Specifies the end parameter of the curve. - id: Start description: Specifies the start parameter of the curve.
#ifndef <API key> #define <API key> #include <stdint.h> #include <map> #include <memory> #include <set> #include <vector> #include "base/atomicops.h" #include "base/containers/hash_tables.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/singleton.h" #include "base/synchronization/lock.h" #include "base/timer/timer.h" #include "base/trace_event/<API key>.h" #include "base/trace_event/process_memory_dump.h" #include "base/trace_event/trace_event.h" namespace base { class <API key>; class Thread; namespace trace_event { class <API key>; class MemoryDumpProvider; class <API key>; // This is the interface exposed to the rest of the codebase to deal with // memory tracing. The main entry point for clients is represented by // RequestDumpPoint(). The extension by Un(<API key>). class BASE_EXPORT MemoryDumpManager : public TraceLog::<API key> { public: static const char* const kTraceCategory; // This value is returned as the tracing id of the child processes by // GetTracingProcessId() when tracing is not enabled. static const uint64_t <API key>; static MemoryDumpManager* GetInstance(); // Invoked once per process to listen to trace begin / end events. // Initialization can happen after (Un)<API key>() calls // and the MemoryDumpManager guarantees to support this. // On the other side, the MemoryDumpManager will not be fully operational // (i.e. will NACK any <API key>()) until initialized. // Arguments: // is_coordinator: if true this MemoryDumpManager instance will act as a // coordinator and schedule periodic dumps (if enabled via TraceConfig); // false when the MemoryDumpManager is initialized in a slave process. // delegate: <API key> interface for embedder-specific behaviors // (multiprocess handshaking). See the lifetime and thread-safety // requirements in the |<API key>| docstring. void Initialize(<API key>* delegate, bool is_coordinator); // (Un)Registers a MemoryDumpProvider instance. // Args: // - mdp: the MemoryDumpProvider instance to be registered. MemoryDumpManager // does NOT take memory ownership of |mdp|, which is expected to either // be a singleton or unregister itself. // - name: a friendly name (duplicates allowed). Used for debugging and // run-time profiling of memory-infra internals. Must be a long-lived // C string. // - task_runner: either a <API key> or SequencedTaskRunner. All // the calls to |mdp| will be run on the given |task_runner|. If passed // null |mdp| should be able to handle calls on arbitrary threads. // - options: extra optional arguments. See <API key>.h. void <API key>(MemoryDumpProvider* mdp, const char* name, scoped_refptr<<API key>> task_runner); void <API key>(MemoryDumpProvider* mdp, const char* name, scoped_refptr<<API key>> task_runner, MemoryDumpProvider::Options options); void <API key>( MemoryDumpProvider* mdp, const char* name, scoped_refptr<SequencedTaskRunner> task_runner, MemoryDumpProvider::Options options); void <API key>(MemoryDumpProvider* mdp); // Unregisters an unbound dump provider and takes care about its deletion // asynchronously. Can be used only for for dump providers with no // task-runner affinity. // This method takes ownership of the dump provider and guarantees that: // - The |mdp| will be deleted at some point in the near future. // - Its deletion will not happen concurrently with the OnMemoryDump() call. // Note that OnMemoryDump() calls can still happen after this method returns. void <API key>(scoped_ptr<MemoryDumpProvider> mdp); // Requests a memory dump. The dump might happen or not depending on the // filters and categories specified when enabling tracing. // The optional |callback| is executed asynchronously, on an arbitrary thread, // to notify about the completion of the global dump (i.e. after all the // processes have dumped) and its success (true iff all the dumps were // successful). void RequestGlobalDump(MemoryDumpType dump_type, <API key> level_of_detail, const MemoryDumpCallback& callback); // Same as above (still asynchronous), but without callback. void RequestGlobalDump(MemoryDumpType dump_type, <API key> level_of_detail); // TraceLog::<API key> implementation. void OnTraceLogEnabled() override; void OnTraceLogDisabled() override; // Returns the <API key> object, which is shared by all the // ProcessMemoryDump and MemoryAllocatorDump instances through all the tracing // session lifetime. const scoped_refptr<<API key>>& session_state() const { return session_state_; } // Returns a unique id for identifying the processes. The id can be // retrieved by child processes only when tracing is enabled. This is // intended to express cross-process sharing of memory dumps on the // child-process side, without having to know its own child process id. uint64_t GetTracingProcessId() const; // Returns the name for a the allocated_objects dump. Use this to declare // suballocator dumps from other dump providers. // It will return nullptr if there is no dump provider for the system // allocator registered (which is currently the case for Mac OS). const char* <API key>() const { return <API key>; }; // When set to true, calling |<API key>| is a no-op. void <API key>(bool ignored) { <API key> = ignored; } private: friend std::default_delete<MemoryDumpManager>; // For the testing instance. friend struct <API key><MemoryDumpManager>; friend class <API key>; friend class <API key>; // Descriptor used to hold information about registered MDPs. // Some important considerations about lifetime of this object: // - In nominal conditions, all the <API key> instances live in // the |dump_providers_| collection (% unregistration while dumping). // - Upon each dump they (actually their scoped_refptr-s) are copied into // the <API key>. This is to allow removal (see below). // - When the MDP.OnMemoryDump() is invoked, the corresponding MDPInfo copy // inside <API key> is removed. // - In most cases, the MDPInfo is destroyed within <API key>(). // - If <API key>() is called while a dump is in progress, the // MDPInfo is destroyed in SetupNextMemoryDump() or InvokeOnMemoryDump(), // when the copy inside <API key> is erase()-d. // - The non-const fields of <API key> are safe to access only // on tasks running in the |task_runner|, unless the thread has been // destroyed. struct <API key> : public <API key><<API key>> { // Define a total order based on the |task_runner| affinity, so that MDPs // belonging to the same SequencedTaskRunner are adjacent in the set. struct Comparator { bool operator()(const scoped_refptr<<API key>>& a, const scoped_refptr<<API key>>& b) const; }; using OrderedSet = std::set<scoped_refptr<<API key>>, Comparator>; <API key>(MemoryDumpProvider* dump_provider, const char* name, scoped_refptr<SequencedTaskRunner> task_runner, const MemoryDumpProvider::Options& options); MemoryDumpProvider* const dump_provider; // Used to transfer ownership for <API key>(). // nullptr in all other cases. scoped_ptr<MemoryDumpProvider> owned_dump_provider; // Human readable name, for debugging and testing. Not necessarily unique. const char* const name; // The task runner affinity. Can be nullptr, in which case the dump provider // will be invoked on |dump_thread_|. const scoped_refptr<SequencedTaskRunner> task_runner; // The |options| arg passed to <API key>(). const MemoryDumpProvider::Options options; // For fail-safe logic (auto-disable failing MDPs). int <API key>; // Flagged either by the auto-disable logic or during unregistration. bool disabled; private: friend class base::<API key><<API key>>; ~<API key>(); <API key>(<API key>); }; // Holds the state of a process memory dump that needs to be carried over // across task runners in order to fulfil an asynchronous CreateProcessDump() // request. At any time exactly one task runner owns a // <API key>. struct <API key> { <API key>( <API key> req_args, const <API key>::OrderedSet& dump_providers, scoped_refptr<<API key>> session_state, MemoryDumpCallback callback, scoped_refptr<<API key>> <API key>); ~<API key>(); // Gets or creates the memory dump container for the given target process. ProcessMemoryDump* <API key>(ProcessId pid); // A map of ProcessId -> ProcessMemoryDump, one for each target process // being dumped from the current process. Typically each process dumps only // for itself, unless dump providers specify a different |target_process| in // MemoryDumpProvider::Options. std::map<ProcessId, scoped_ptr<ProcessMemoryDump>> process_dumps; // The arguments passed to the initial CreateProcessDump() request. const <API key> req_args; // An ordered sequence of dump providers that have to be invoked to complete // the dump. This is a copy of |dump_providers_| at the beginning of a dump // and becomes empty at the end, when all dump providers have been invoked. std::vector<scoped_refptr<<API key>>> <API key>; // The trace-global session state. scoped_refptr<<API key>> session_state; // Callback passed to the initial call to CreateProcessDump(). MemoryDumpCallback callback; // The |success| field that will be passed as argument to the |callback|. bool dump_successful; // The thread on which <API key>() (and hence |callback|) // should be invoked. This is the thread on which the initial // CreateProcessDump() request was called. const scoped_refptr<<API key>> <API key>; // The thread on which unbound dump providers should be invoked. // This is essentially |dump_thread_|.task_runner() but needs to be kept // as a separate variable as it needs to be accessed by arbitrary dumpers' // threads outside of the lock_ to avoid races when disabling tracing. // It is immutable for all the duration of a tracing session. const scoped_refptr<<API key>> <API key>; private: <API key>(<API key>); }; static const int <API key>; static const char* const <API key>; MemoryDumpManager(); ~MemoryDumpManager() override; static void <API key>(MemoryDumpManager* instance); static void <API key>( scoped_ptr<<API key>> pmd_async_state); // Enable heap profiling if <API key> is specified. void <API key>(); // Internal, used only by <API key>. // Creates a memory dump for the current process and appends it to the trace. // |callback| will be invoked asynchronously upon completion on the same // thread on which CreateProcessDump() was called. void CreateProcessDump(const <API key>& args, const MemoryDumpCallback& callback); // Calls InvokeOnMemoryDump() for the next MDP on the task runner specified by // the MDP while registration. On failure to do so, skips and continues to // next MDP. void SetupNextMemoryDump( scoped_ptr<<API key>> pmd_async_state); // Invokes OnMemoryDump() of the next MDP and calls SetupNextMemoryDump() at // the end to continue the ProcessMemoryDump. Should be called on the MDP task // runner. void InvokeOnMemoryDump(<API key>* <API key>); // Helper for RegierDumpProvider* functions. void <API key>( MemoryDumpProvider* mdp, const char* name, scoped_refptr<SequencedTaskRunner> task_runner, const MemoryDumpProvider::Options& options); // Helper for the public <API key>* functions. void <API key>(MemoryDumpProvider* mdp, bool <API key>); // An ordererd set of registered <API key>(s), sorted by task // runner affinity (MDPs belonging to the same task runners are adjacent). <API key>::OrderedSet dump_providers_; // Shared among all the PMDs to keep state scoped to the tracing session. scoped_refptr<<API key>> session_state_; <API key>* delegate_; // Not owned. // When true, this instance is in charge of coordinating periodic dumps. bool is_coordinator_; // Protects from concurrent accesses to the |dump_providers_*| and |delegate_| // to guard against disabling logging while dumping on another thread. Lock lock_; // Optimization to avoid attempting any memory dump (i.e. to not walk an empty // <API key> list) when tracing is not enabled. subtle::AtomicWord <API key>; // For time-triggered periodic dumps. RepeatingTimer <API key>; // Thread used for MemoryDumpProviders which don't specify a task runner // affinity. scoped_ptr<Thread> dump_thread_; // expected to be valid only when tracing is enabled. uint64_t tracing_process_id_; // When true, calling |<API key>| is a no-op. bool <API key>; // Whether new memory dump providers should be told to enable heap profiling. bool <API key>; <API key>(MemoryDumpManager); }; // The delegate is supposed to be long lived (read: a Singleton) and thread // safe (i.e. should expect calls from any thread and handle thread hopping). class BASE_EXPORT <API key> { public: virtual void <API key>(const <API key>& args, const MemoryDumpCallback& callback) = 0; // Returns tracing process id of the current process. This is used by // MemoryDumpManager::GetTracingProcessId. virtual uint64_t GetTracingProcessId() const = 0; protected: <API key>() {} virtual ~<API key>() {} void CreateProcessDump(const <API key>& args, const MemoryDumpCallback& callback) { MemoryDumpManager::GetInstance()->CreateProcessDump(args, callback); } private: <API key>(<API key>); }; } // namespace trace_event } // namespace base #endif // <API key>
class CreateUser < ActiveRecord::Migration def up create_table :users do |t| t.integer :user_id, :limit => 8 t.string :screen_name t.boolean :following, :default => false t.boolean :followed, :default => false t.boolean :unfollowed, :default => false t.timestamp :followed_at t.timestamp :created_at t.timestamp :updated_at t.boolean :keep t.text :<TwitterConsumerkey> end end end
// DomapInfo_dlg.cpp : implementation file #include "stdafx.h" #include "winprom.h" #include "DomapInfo_dlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif // CDomapInfo_dlg dialog CDomapInfo_dlg::CDomapInfo_dlg(const Area_info& a, const Area_info& d, const CString& n, bool m) : CMapInfo_dlg(a,d,n,m,CDomapInfo_dlg::IDD) { //{{AFX_DATA_INIT(CDomapInfo_dlg) m_ndom_0peak = 0; m_ndom_1peak = 0; m_ndom_peaks = 0; m_ndom_total = 0; m_ndom_area = 0; //}}AFX_DATA_INIT } void CDomapInfo_dlg::DoDataExchange(CDataExchange* pDX) { CMapInfo_dlg::DoDataExchange(pDX); //{{AFX_DATA_MAP(CDomapInfo_dlg) DDX_Text(pDX, IDC_NDOM_0PEAK, m_ndom_0peak); DDX_Text(pDX, IDC_NDOM_1PEAK, m_ndom_1peak); DDX_Text(pDX, IDC_NDOM_PEAKS, m_ndom_peaks); DDX_Text(pDX, IDC_NDOM, m_ndom_total); DDX_Text(pDX, IDC_NDOM_AREA, m_ndom_area); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CDomapInfo_dlg, CMapInfo_dlg) //{{AFX_MSG_MAP(CDomapInfo_dlg) // NOTE: the ClassWizard will add message map macros here //}}AFX_MSG_MAP END_MESSAGE_MAP() // CDomapInfo_dlg message handlers
{{<govuk_template}} {{$head}} {{>includes/elements_head}} {{>includes/elements_scripts}} {{/head}} {{$propositionHeader}} {{>includes/<API key>}} {{/propositionHeader}} {{$headerClass}}with-proposition{{/headerClass}} {{$content}} <script> if(sessionStorage.condition) { sessionStorage.removeItem('condition'); } function start() { window.location.href = 'condition-selection'; } </script> <main id="page-container" role="main"> {{>includes/phase_banner}} <div id="notify" class="starthidden"> <div class="grid-row" style="margin-top:1.5em"> <div class="column-two-thirds"> <h1 style="margin-top:0.5em;" class="form-title heading-xlarge"> Tell DVLA about your medical condition </h1> <p>You can use this service to tell DVLA about your medical condition.</p> <p>It is a legal requirement to tell DVLA of a medical condition that might affect your driving.</p> <div style="padding-top: 0px; padding-bottom: 5px;" class="panel-indent"> <!--div class="help-notice"> <h2 class="heading-medium">Don’t worry</h2> </div <h2 class="heading-medium">Don’t worry</h2> <p>Most drivers are allowed to continue driving.</p> </div> <h2 class="heading-medium">What you'll need</h2> <ul class="list-bullet" style="margin-bottom: 0;"> <li>to be a resident in Great Britain - there is a different process in <a href="http://amdr.herokuapp.com/COA_Direct_v4/Landing_page">Northern Ireland, Isle of Man and the Channel Islands</a> <li>your healthcare professionals' (eg GP, nurse, consultant) details</li> </ul> <!--details style="margin-top: 1em;"> <summary> <span class="summary"> What you'll need </span> </summary> <div class="panel-indent"> <ul class="list-bullet" style="margin-bottom: 0;"> <li>to be a resident in Great Britain - there is a different process in <a href="http://amdr.herokuapp.com/COA_Direct_v4/Landing_page">Northern Ireland, Isle of Man and the Channel Islands</a>. <li>your personal details</li> <li>your healthcare professionals' (e.g. GP, Nurse, Consultant) details</li> </ul> </div> </details <br/><br/> <div style=""> <h2 style="display: inline;"> <img src="/public/images/verify-logo-inline.png" style="width: 100px; display: inline; float: left;"/> <strong>GOV.UK</strong> <br/> VERIFY </h2> </div> <br/> <p>This service uses GOV.UK Verify to check your identity.</p> <br/> <a href="javascript:start();" class="button button-get-started" role="button">Start now</a> </div> <div class="column-third" style=";margin-bottom:0.75em"> <nav class="popular-needs"> <h3 class="heading-medium" style="border-top:10px solid #005ea5;margin-top:1em;padding-top:1em">Driving with a medical condition</h3> <ul style="list-style-type: none;"> <li style="margin-top: 0.5em;"><a href="https: <li style="margin-top: 0.5em;"><a href="https: <li style="margin-top: 0.5em;"><a href="https: </ul> </nav> </div> </div> </div> <div id="renewal" class="starthidden"> <div class="grid-row" style="margin-top:1.5em"> <div class="column-two-thirds"> <h1 style="margin-top:0.5em;" class="form-title heading-xlarge"> Renew your medical driving licence </h1> <p>Use this service to:</p> <ul class="list-bullet"> <li>renew your medical driving licence</li> </ul> <p>If you need to tell DVLA about a different condition, download and complete the paper form – then post it to DVLA.</p> <a href="javascript:start();" class="button button-get-started" role="button">Start now</a> <h2 class="heading-medium" style="margin-top:0.75em">Other ways to apply</h2> <h2 class="heading-small" style="margin-top:0.75em">By post</h2> Please provide the following: <ul class="list-bullet"> <li>your full name and address</li> <li>your driving licence number (or your date of birth if you do not know your driving licence number)</li> <li>details about your medical condition</li> </ul> <p>Send to:</p> Drivers Medical Group <br> DVLA <br> Swansea <br> SA99 1TU </div> <div class="column-third" style=";margin-bottom:0.75em"> <nav class="popular-needs"> <h3 class="heading-medium" style="border-top:10px solid #005ea5;margin-top:1em;padding-top:1em">Driving with a medical condition</h3> <ul style=";list-style-type: none"> <li style="margin-top: 0.5em;"><a href="https: <li style="margin-top: 0.5em;"><a href="https: <li style="margin-top: 0.5em;"><a href="https: </ul> </nav> </div> </div> </div> <script> show((QueryString.service == null) ? 'notify' : QueryString.service); </script> </main> {{/content}} {{$bodyEnd}} {{/bodyEnd}} {{/govuk_template}}
// of this software and associated documentation files( the "Software" ), to deal // in the Software without restriction, including without limitation the rights // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions : // copies or substantial portions of the Software. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // 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. // Vulkan Cookbook // ISBN: 9781786468154 // Chapter: 11 Lighting // Recipe: 01 Rendering a geometry with vertex diffuse lighting #include "<API key>.h" using namespace VulkanCookbook; class Sample : public <API key> { Mesh Model; VkDestroyer(VkBuffer) VertexBuffer; VkDestroyer(VkDeviceMemory) VertexBufferMemory; VkDestroyer(<API key>) DescriptorSetLayout; VkDestroyer(VkDescriptorPool) DescriptorPool; std::vector<VkDescriptorSet> DescriptorSets; VkDestroyer(VkRenderPass) RenderPass; VkDestroyer(VkPipelineLayout) PipelineLayout; VkDestroyer(VkPipeline) Pipeline; VkDestroyer(VkBuffer) StagingBuffer; VkDestroyer(VkDeviceMemory) StagingBufferMemory; bool UpdateUniformBuffer; VkDestroyer(VkBuffer) UniformBuffer; VkDestroyer(VkDeviceMemory) UniformBufferMemory; virtual bool Initialize( WindowParameters window_parameters ) override { if( !InitializeVulkan( window_parameters ) ) { return false; } // Vertex data if( !<API key>( "Data/Models/knot.obj", true, false, false, true, Model ) ) { return false; } InitVkDestroyer( LogicalDevice, VertexBuffer ); if( !CreateBuffer( *LogicalDevice, sizeof( Model.Data[0] ) * Model.Data.size(), <API key> | <API key>, *VertexBuffer ) ) { return false; } InitVkDestroyer( LogicalDevice, VertexBufferMemory ); if( !<API key>( PhysicalDevice, *LogicalDevice, *VertexBuffer, <API key>, *VertexBufferMemory ) ) { return false; } if( !<API key>( PhysicalDevice, *LogicalDevice, sizeof( Model.Data[0] ) * Model.Data.size(), &Model.Data[0], *VertexBuffer, 0, 0, <API key>, <API key>, <API key>, GraphicsQueue.Handle, FramesResources.front().CommandBuffer, {} ) ) { return false; } // Staging buffer InitVkDestroyer( LogicalDevice, StagingBuffer ); if( !CreateBuffer( *LogicalDevice, 2 * 16 * sizeof(float), <API key>, *StagingBuffer ) ) { return false; } InitVkDestroyer( LogicalDevice, StagingBufferMemory ); if( !<API key>( PhysicalDevice, *LogicalDevice, *StagingBuffer, <API key>, *StagingBufferMemory ) ) { return false; } // Uniform buffer InitVkDestroyer( LogicalDevice, UniformBuffer ); InitVkDestroyer( LogicalDevice, UniformBufferMemory ); if( !CreateUniformBuffer( PhysicalDevice, *LogicalDevice, 2 * 16 * sizeof( float ), <API key> | <API key>, *UniformBuffer, *UniformBufferMemory ) ) { return false; } if( !UpdateStagingBuffer( true ) ) { return false; } // Descriptor set with uniform buffer <API key> <API key> = { 0, // uint32_t binding <API key>, // VkDescriptorType descriptorType 1, // uint32_t descriptorCount <API key>, // VkShaderStageFlags stageFlags nullptr // const VkSampler * pImmutableSamplers }; InitVkDestroyer( LogicalDevice, DescriptorSetLayout ); if( !<API key>( *LogicalDevice, { <API key> }, *DescriptorSetLayout ) ) { return false; } <API key> <API key> = { <API key>, // VkDescriptorType type 1 // uint32_t descriptorCount }; InitVkDestroyer( LogicalDevice, DescriptorPool ); if( !<API key>( *LogicalDevice, false, 1, { <API key> }, *DescriptorPool ) ) { return false; } if( !<API key>( *LogicalDevice, *DescriptorPool, { *DescriptorSetLayout }, DescriptorSets ) ) { return false; } <API key> <API key> = { DescriptorSets[0], // VkDescriptorSet TargetDescriptorSet 0, // uint32_t <API key> 0, // uint32_t TargetArrayElement <API key>, // VkDescriptorType <API key> { // std::vector<<API key>> BufferInfos { *UniformBuffer, // VkBuffer buffer 0, // VkDeviceSize offset VK_WHOLE_SIZE // VkDeviceSize range } } }; <API key>( *LogicalDevice, {}, { <API key> }, {}, {} ); // Render pass std::vector<<API key>> <API key> = { { 0, // <API key> flags Swapchain.Format, // VkFormat format <API key>, // <API key> samples <API key>, // VkAttachmentLoadOp loadOp <API key>, // VkAttachmentStoreOp storeOp <API key>, // VkAttachmentLoadOp stencilLoadOp <API key>, // VkAttachmentStoreOp stencilStoreOp <API key>, // VkImageLayout initialLayout <API key> // VkImageLayout finalLayout }, { 0, // <API key> flags DepthFormat, // VkFormat format <API key>, // <API key> samples <API key>, // VkAttachmentLoadOp loadOp <API key>, // VkAttachmentStoreOp storeOp <API key>, // VkAttachmentLoadOp stencilLoadOp <API key>, // VkAttachmentStoreOp stencilStoreOp <API key>, // VkImageLayout initialLayout <API key> // VkImageLayout finalLayout } }; <API key> depth_attachment = { 1, // uint32_t attachment <API key> // VkImageLayout layout }; std::vector<SubpassParameters> subpass_parameters = { { <API key>, // VkPipelineBindPoint PipelineType {}, // std::vector<<API key>> InputAttachments { // std::vector<<API key>> ColorAttachments { 0, // uint32_t attachment <API key>, // VkImageLayout layout } }, {}, // std::vector<<API key>> ResolveAttachments &depth_attachment, // <API key> const * <API key> {} // std::vector<uint32_t> PreserveAttachments } }; std::vector<VkSubpassDependency> <API key> = { { VK_SUBPASS_EXTERNAL, // uint32_t srcSubpass 0, // uint32_t dstSubpass <API key>, // <API key> srcStageMask <API key>, // <API key> dstStageMask <API key>, // VkAccessFlags srcAccessMask <API key>, // VkAccessFlags dstAccessMask <API key> // VkDependencyFlags dependencyFlags }, { 0, // uint32_t srcSubpass VK_SUBPASS_EXTERNAL, // uint32_t dstSubpass <API key>, // <API key> srcStageMask <API key>, // <API key> dstStageMask <API key>, // VkAccessFlags srcAccessMask <API key>, // VkAccessFlags dstAccessMask <API key> // VkDependencyFlags dependencyFlags } }; InitVkDestroyer( LogicalDevice, RenderPass ); if( !CreateRenderPass( *LogicalDevice, <API key>, subpass_parameters, <API key>, *RenderPass ) ) { return false; } // Graphics pipeline InitVkDestroyer( LogicalDevice, PipelineLayout ); if( !<API key>( *LogicalDevice, { *DescriptorSetLayout }, {}, *PipelineLayout ) ) { return false; } std::vector<unsigned char> vertex_shader_spirv; if( !<API key>( "Data/Shaders/11 Lighting/01 Rendering a geometry with vertex diffuse lighting/shader.vert.spv", vertex_shader_spirv ) ) { return false; } VkDestroyer(VkShaderModule) <API key>; InitVkDestroyer( LogicalDevice, <API key> ); if( !CreateShaderModule( *LogicalDevice, vertex_shader_spirv, *<API key> ) ) { return false; } std::vector<unsigned char> <API key>; if( !<API key>( "Data/Shaders/11 Lighting/01 Rendering a geometry with vertex diffuse lighting/shader.frag.spv", <API key> ) ) { return false; } VkDestroyer(VkShaderModule) <API key>; InitVkDestroyer( LogicalDevice, <API key> ); if( !CreateShaderModule( *LogicalDevice, <API key>, *<API key> ) ) { return false; } std::vector<<API key>> shader_stage_params = { { <API key>, // <API key> ShaderStage *<API key>, // VkShaderModule ShaderModule "main", // char const * EntryPointName nullptr // <API key> const * SpecializationInfo }, { <API key>, // <API key> ShaderStage *<API key>, // VkShaderModule ShaderModule "main", // char const * EntryPointName nullptr // <API key> const * SpecializationInfo } }; std::vector<<API key>> <API key>; <API key>( shader_stage_params, <API key> ); std::vector<<API key>> <API key> = { { 0, // uint32_t binding 6 * sizeof( float ), // uint32_t stride <API key> // VkVertexInputRate inputRate } }; std::vector<<API key>> <API key> = { { 0, // uint32_t location 0, // uint32_t binding <API key>, // VkFormat format 0 // uint32_t offset }, { 1, // uint32_t location 0, // uint32_t binding <API key>, // VkFormat format 3 * sizeof( float ) // uint32_t offset } }; <API key> <API key>; <API key>( <API key>, <API key>, <API key> ); <API key> <API key>; <API key>( <API key>, false, <API key> ); ViewportInfo viewport_infos = { { // std::vector<VkViewport> Viewports { 0.0f, // float x 0.0f, // float y 500.0f, // float width 500.0f, // float height 0.0f, // float minDepth 1.0f // float maxDepth } }, { // std::vector<VkRect2D> Scissors { { // VkOffset2D offset 0, // int32_t x 0 // int32_t y }, { // VkExtent2D extent 500, // uint32_t width 500 // uint32_t height } } } }; <API key> <API key>; <API key>( viewport_infos, <API key> ); <API key> <API key>; <API key>( false, false, <API key>, <API key>, <API key>, false, 0.0f, 0.0f, 0.0f, 1.0f, <API key> ); <API key> <API key>; <API key>( <API key>, false, 0.0f, nullptr, false, false, <API key> ); <API key> <API key>; <API key>( true, true, <API key>, false, 0.0f, 1.0f, false, {}, {}, <API key> ); std::vector<<API key>> <API key> = { { false, // VkBool32 blendEnable VK_BLEND_FACTOR_ONE, // VkBlendFactor srcColorBlendFactor VK_BLEND_FACTOR_ONE, // VkBlendFactor dstColorBlendFactor VK_BLEND_OP_ADD, // VkBlendOp colorBlendOp VK_BLEND_FACTOR_ONE, // VkBlendFactor srcAlphaBlendFactor VK_BLEND_FACTOR_ONE, // VkBlendFactor dstAlphaBlendFactor VK_BLEND_OP_ADD, // VkBlendOp alphaBlendOp <API key> | // <API key> colorWriteMask <API key> | <API key> | <API key> } }; <API key> <API key>; <API key>( false, VK_LOGIC_OP_COPY, <API key>, { 1.0f, 1.0f, 1.0f, 1.0f }, <API key> ); std::vector<VkDynamicState> dynamic_states = { <API key>, <API key> }; <API key> <API key>; <API key>( dynamic_states, <API key> ); <API key> <API key>; <API key>( 0, <API key>, <API key>, <API key>, nullptr, &<API key>, <API key>, &<API key>, &<API key>, &<API key>, &<API key>, *PipelineLayout, *RenderPass, 0, VK_NULL_HANDLE, -1, <API key> ); std::vector<VkPipeline> pipeline; if( !<API key>( *LogicalDevice, { <API key> }, VK_NULL_HANDLE, pipeline ) ) { return false; } InitVkDestroyer( LogicalDevice, Pipeline ); *Pipeline = pipeline[0]; return true; } virtual bool Draw() override { auto prepare_frame = [&]( VkCommandBuffer command_buffer, uint32_t <API key>, VkFramebuffer framebuffer ) { if( !<API key>( command_buffer, <API key>, nullptr ) ) { return false; } if( UpdateUniformBuffer ) { UpdateUniformBuffer = false; BufferTransition <API key> = { *UniformBuffer, // VkBuffer Buffer <API key>, // VkAccessFlags CurrentAccess <API key>, // VkAccessFlags NewAccess <API key>, // uint32_t CurrentQueueFamily <API key> // uint32_t NewQueueFamily }; <API key>( command_buffer, <API key>, <API key>, { <API key> } ); std::vector<VkBufferCopy> regions = { { 0, // VkDeviceSize srcOffset 0, // VkDeviceSize dstOffset 2 * 16 * sizeof( float ) // VkDeviceSize size } }; <API key>( command_buffer, *StagingBuffer, *UniformBuffer, regions ); BufferTransition <API key> = { *UniformBuffer, // VkBuffer Buffer <API key>, // VkAccessFlags CurrentAccess <API key>, // VkAccessFlags NewAccess <API key>, // uint32_t CurrentQueueFamily <API key> // uint32_t NewQueueFamily }; <API key>( command_buffer, <API key>, <API key>, { <API key> } ); } if( PresentQueue.FamilyIndex != GraphicsQueue.FamilyIndex ) { ImageTransition <API key> = { Swapchain.Images[<API key>], // VkImage Image <API key>, // VkAccessFlags CurrentAccess <API key>, // VkAccessFlags NewAccess <API key>, // VkImageLayout CurrentLayout <API key>, // VkImageLayout NewLayout PresentQueue.FamilyIndex, // uint32_t CurrentQueueFamily GraphicsQueue.FamilyIndex, // uint32_t NewQueueFamily <API key> // VkImageAspectFlags Aspect }; <API key>( command_buffer, <API key>, <API key>, { <API key> } ); } // Drawing BeginRenderPass( command_buffer, *RenderPass, framebuffer, { { 0, 0 }, Swapchain.Size }, { { 0.1f, 0.2f, 0.3f, 1.0f }, { 1.0f, 0 } }, <API key> ); VkViewport viewport = { 0.0f, // float x 0.0f, // float y static_cast<float>(Swapchain.Size.width), // float width static_cast<float>(Swapchain.Size.height), // float height 0.0f, // float minDepth 1.0f, // float maxDepth }; <API key>( command_buffer, 0, { viewport } ); VkRect2D scissor = { { // VkOffset2D offset 0, // int32_t x 0 // int32_t y }, { // VkExtent2D extent Swapchain.Size.width, // uint32_t width Swapchain.Size.height // uint32_t height } }; <API key>( command_buffer, 0, { scissor } ); BindVertexBuffers( command_buffer, 0, { { *VertexBuffer, 0 } } ); BindDescriptorSets( command_buffer, <API key>, *PipelineLayout, 0, DescriptorSets, {} ); BindPipelineObject( command_buffer, <API key>, *Pipeline ); for( size_t i = 0; i < Model.Parts.size(); ++i ) { DrawGeometry( command_buffer, Model.Parts[i].VertexCount, 1, Model.Parts[i].VertexOffset, 0 ); } EndRenderPass( command_buffer ); if( PresentQueue.FamilyIndex != GraphicsQueue.FamilyIndex ) { ImageTransition <API key> = { Swapchain.Images[<API key>], // VkImage Image <API key>, // VkAccessFlags CurrentAccess <API key>, // VkAccessFlags NewAccess <API key>, // VkImageLayout CurrentLayout <API key>, // VkImageLayout NewLayout GraphicsQueue.FamilyIndex, // uint32_t CurrentQueueFamily PresentQueue.FamilyIndex, // uint32_t NewQueueFamily <API key> // VkImageAspectFlags Aspect }; <API key>( command_buffer, <API key>, <API key>, { <API key> } ); } if( !<API key>( command_buffer ) ) { return false; } return true; }; return <API key>( *LogicalDevice, GraphicsQueue.Handle, PresentQueue.Handle, *Swapchain.Handle, Swapchain.Size, Swapchain.ImageViewsRaw, *RenderPass, {}, prepare_frame, FramesResources ); } void OnMouseEvent() { UpdateStagingBuffer( false ); } bool UpdateStagingBuffer( bool force ) { UpdateUniformBuffer = true; static float horizontal_angle = 0.0f; static float vertical_angle = 0.0f; if( MouseState.Buttons[0].IsPressed || force ) { horizontal_angle += 0.5f * MouseState.Position.Delta.X; vertical_angle -= 0.5f * MouseState.Position.Delta.Y; if( vertical_angle > 90.0f ) { vertical_angle = 90.0f; } if( vertical_angle < -90.0f ) { vertical_angle = -90.0f; } Matrix4x4 rotation_matrix = <API key>( vertical_angle, { 1.0f, 0.0f, 0.0f } ) * <API key>( horizontal_angle, { 0.0f, -1.0f, 0.0f } ); Matrix4x4 translation_matrix = <API key>( 0.0f, 0.0f, -4.0f ); Matrix4x4 model_view_matrix = translation_matrix * rotation_matrix; if( !<API key>( *LogicalDevice, *StagingBufferMemory, 0, sizeof( model_view_matrix[0] ) * model_view_matrix.size(), &model_view_matrix[0], true, nullptr ) ) { return false; } Matrix4x4 perspective_matrix = <API key>( static_cast<float>(Swapchain.Size.width) / static_cast<float>(Swapchain.Size.height), 50.0f, 0.5f, 10.0f ); if( !<API key>( *LogicalDevice, *StagingBufferMemory, sizeof( model_view_matrix[0] ) * model_view_matrix.size(), sizeof( perspective_matrix[0] ) * perspective_matrix.size(), &perspective_matrix[0], true, nullptr ) ) { return false; } } return true; } virtual bool Resize() override { if( !CreateSwapchain() ) { return false; } if( IsReady() ) { if( !UpdateStagingBuffer( true ) ) { return false; } } return true; } }; <API key>( "11/01 - Rendering a geometry with vertex diffuse lighting", 50, 25, 1280, 800, Sample )
# == Schema Information # Table name: currencies # id :integer not null, primary key # name :string # abbrev :string # created_at :datetime not null # updated_at :datetime not null class Currency < ActiveRecord::Base validates :name, :abbrev, presence: true end
shared_examples 'collection::ansible' do include_examples 'python::toolchain' include_examples 'ansible::toolchain' end
export const <API key> = {"viewBox":"0 0 24 24","children":[{"name":"path","attribs":{"d":"M0 0h24v24H0V0z","fill":"none"},"children":[]},{"name":"path","attribs":{"d":"M13 3.06V1h-2v2.06C6.83 3.52 3.52 6.83 3.06 11H1v2h2.06c.46 4.17 3.77 7.48 7.94 7.94V23h2v-2.06c4.17-.46 7.48-3.77 7.94-7.94H23v-2h-2.06c-.46-4.17-3.77-7.48-7.94-7.94zM12 19c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"},"children":[]},{"name":"circle","attribs":{"cx":"12","cy":"12","opacity":".3","r":"2"},"children":[]},{"name":"path","attribs":{"d":"M12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm0 6c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"},"children":[]}]};
<div class="form-group fg-float"> <div class="fg-line"> {!! Form::text('name', null, array('class' => 'form-control fg-input')) !!} </div> {!! Form::label('name', 'Name', array('class' => 'fg-label')) !!} </div> <div class="form-group fg-float"> <div class="fg-line"> {!! Form::textarea('description', null, array('class' => 'form-control fg-input')) !!} </div> {!! Form::label('description', 'Description', array('class' => 'fg-label')) !!} </div> <div class="form-group fg-float"> <div class="fg-line"> {!! Form::text('count', null, array('class' => 'form-control fg-input')) !!} </div> {!! Form::label('count', 'Count', array('class' => 'fg-label')) !!} </div> <div class="form-group fg-float"> <div class="fg-line"> {!! Form::checkbox('sub_visible', 1, null, array('class' => 'form-control fg-input')) !!} </div> {!! Form::label('sub_visible', 'Visible', array('class' => 'fg-label')) !!} </div> <div class="form-group"> {!! Form::submit($submit_text, array('class' => 'btn btn-primary')) !!} </div>
package exercise.<API key>.utils; public class MessegeLogger { public static void log(String message){ System.out.println(message); } }
[![Build Status](https: # Artsy+OSSUIFonts This project contains the fonts and UIFont categories required to make a project with standard artsy design. We cannot include the fonts that we would normally use in a public project, so these are the closest equivilents that are available and have open source-compatible licenses. You can find out more by checking out the websites for [EB Garamond](http: To make it work you have to include in the Applications XX-Info.plist. See [here](https://github.com/artsy/Artsy-OSSUIFonts/blob/master/Example/FontApp/FontApp-Info.plist#L37-L45) for an example. <array> <string>EBGaramond08-Italic.ttf</string> <string><API key>.ttf</string> <string>EBGaramond12-Italic.ttf</string> <string><API key>.ttf</string> <string><API key>.ttf</string> </array> ## Usage To run the example project; clone the repo, and run `pod install` from the Example directory first. ## Installation Artsy+OSSUIFonts is available through [CocoaPods](http: To install the Specs repo run: pod repo add artsy https://github.com/artsy/Specs.git To install the pod, add following line to your Podfile: pod "Artsy+OSSUIFonts" ## Wrapper Orta, orta.therox@gmail.com The Code itself is MIT. The font license for EB Garamonds is the [SIL Open Fonts License](http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL) The font license for Text Gyre Adventor is the [GUST Font License](http://www.gust.org.pl/projects/e-foundry/index_html#GFL)
<?php ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>Tin Đất Đai | Quản lý bài đăng</title> <?php $this->load->view('/admin/common/header-js') ?> <link rel="stylesheet" href="<?=base_url('/admin/css/<API key>.min.css')?>"> </head> <body class="hold-transition skin-blue sidebar-mini"> <div class="wrapper"> <!-- Main Header --> <?php $this->load->view('/admin/common/admin-header')?> <!-- Left side column. contains the logo and sidebar --> <?php $this->load->view('/admin/common/left-menu') ?> <!-- Content Wrapper. Contains page content --> <div class="content-wrapper"> <!-- Content Header (Page header) --> <section class="content-header"> <h1> Quản lý bài đăng <?=isset($user) ? 'của:<b> '.$user->FullName.' - '.$user->Phone.'</b>': ''?> </h1> <ol class="breadcrumb"> <li><a href=" <li class="active">Quản lý bài đăng</li> </ol> </section> <!-- Main content --> <?php $attributes = array("id" => "frmPost"); echo form_open("admin/product/list", $attributes); ?> <section class="content container-fluid"> <?php if(!empty($message_response)){ echo '<div class="alert alert-success">'; echo '<a href="#" class="close" data-dismiss="alert" aria-label="close" title="close">&times;</a>'; echo $message_response; echo '</div>'; }?> <div class="box"> <div class="box-header"> <h3 class="box-title">Danh sách bài đăng</h3> </div> <!-- /.box-header --> <div class="box-body"> <div class="search-filter"> <div class="row"> <div class="col-sm-6"> <label>Tiêu đề</label> <div class="form-group"> <input type="text" name="searchFor" placeholder="Tìm tiêu đề" class="form-control" id="searchKey"> </div> </div> <div class="col-sm-2"> <label>Số điện thoại</label> <div class="form-group"> <input type="text" name="phoneNumber" class="form-control" id="phoneNumber"> </div> </div> <div class="col-sm-2"> <label>Từ ngày</label> <div class="form-group"> <input type="text" name="postFromDate" class="form-control datepicker" id="fromDate"> </div> </div> <div class="col-sm-2"> <label>Đến ngày</label> <div class="form-group"> <input type="text" name="postToDate" class="form-control datepicker" id="toDate"> </div> </div> <div class="col-sm-2"> <label>Mã tin(ID)</label> <div class="form-group"> <input type="text" name="code" class="form-control" id="code"> </div> </div> <div class="col-sm-3"> <label>Loại tin</label> <div class="form-group"> <label><input id="chb-0" checked="checked" type="radio" name="hasAuthor" value="-1"> Tất cả</label> <label><input id="chb-2" type="radio" name="hasAuthor" value="1"> Chính chủ</label> <label><input id="chb-1" type="radio" name="hasAuthor" value="0"> Crawler</label> </div> </div> <div class="col-sm-4"> <label>Tình trạng</label> <div class="form-group"> <label><input id="st_0" checked="checked" type="radio" name="status" value="-1"> Tất cả</label> <label><input id="st-1" type="radio" name="status" value="1"> Hoạt động</label> <label><input id="st-0" type="radio" name="status" value="0"> Tạm dừng</label> <label><input id="st-2" type="radio" name="status" value="2"> Chờ thanh toán</label> </div> </div> </div> <div class="text-center"> <a class="btn btn-primary" onclick="sendRequest()">Tìm kiếm</a> </div> </div> <div class="row no-margin"> <a class="btn btn-danger" id="deleteMulti">Xóa Nhiều</a> </div> <div class="table-responsive"> <table class="admin-table table table-bordered table-striped"> <thead> <tr> <th><input name="checkAll" value="1" type="checkbox" ></th> <th data-action="sort" data-title="Title" data-direction="ASC"><span>Tiêu đề</span><i class="glyphicon <API key>"></i></th> <th data-action="sort" data-title="Status" data-direction="ASC"><span>Status</span><i class="glyphicon <API key>"></i></th> <th data-action="sort" data-title="Vip" data-direction="ASC"><span>Loại tin</span><i class="glyphicon <API key>"></i></th> <th data-action="sort" data-title="View" data-direction="ASC"><span>Lượt xem</span><i class="glyphicon <API key>"></i></th> <th data-action="sort" data-title="PostDate" data-direction="ASC"><span>Ngày đăng</span><i class="glyphicon <API key>"></i></th> <th data-action="sort" data-title="ExpireDate" data-direction="ASC"><span>Hết hạn</span><i class="glyphicon <API key>"></i></th> <th data-action="sort" data-title="ModifiedDate" data-direction="ASC"><span>Cập nhật</span><i class="glyphicon <API key>"></i></th> <th data-action="sort" data-title="CreatedByID" data-direction="ASC"><span>Người đăng</span><i class="glyphicon <API key>"></i></th> <th data-action="sort" data-title="IpAddress" data-direction="ASC"><span>Ip Address</span><i class="glyphicon <API key>"></i></th> <th></th> </tr> </thead> <tbody> <?php $counter = 1; foreach ($products as $product) { ?> <tr> <td><input name="checkList[]" type="checkbox" value="<?=$product->ProductID?>"></td> <td><a class="vip<?=$product->Vip?>" data-toggle="tooltip" title="<?=$product->Title?>" href="<?=base_url(seo_url($product->Title).'-p').$product->ProductID.'.html'?>"><?=substr_at_middle($product->Title, 60)?></a></td> <td> <?php if($product->Status == ACTIVE){ echo '<span class="label label-success">Show</span>'; }else if($product->Status == PAYMENT_DELAY){ echo '<span class="label label-info">Payment</span>'; } else{ echo '<span class="label label-danger">Hide</span>'; } ?> </td> <td> <select onchange="updateVip('<?=$product->ProductID?>', this.value);"> <option value="0" <?=$product->Vip == 0 ? ' selected' : ''?>>Vip 0</option> <option value="1" <?=$product->Vip == 1 ? ' selected' : ''?>>Vip 1</option> <option value="2" <?=$product->Vip == 2 ? ' selected' : ''?>>Vip 2</option> <option value="3" <?=$product->Vip == 3 ? ' selected' : ''?>>Vip 3</option> <option value="5" <?=$product->Vip == 5 ? ' selected' : ''?>>Thường</option> </select> </td> <td class="text-right"> <?php if(isset($product->FullName)) { ?> <input class="txtView" id="pr-<?=$product->ProductID?>" type="text" value="<?= $product->View?>" onchange="updateView('<?=$product->ProductID?>', this.value);"/> <?php }else{ echo $product->View; } ?> </td> <td><?=date('d/m/Y H:i', strtotime($product->PostDate))?></td> <td><?=date('d/m/Y', strtotime($product->ExpireDate))?></td> <td id="modifiedDate_<?=$product->ProductID?>"><?=date('d/m/Y H:i', strtotime($product->ModifiedDate))?></td> <td><a href="<?=base_url('/admin/product/list.html?createdById='.$product->CreatedByID)?>"><?=$product->FullName?></a> </td> <td><?=$product->IpAddress?></td> <td> <a href="<?=base_url('/admin/product/edit.html?postId='.$product->ProductID)?>" data-toggle="tooltip" title="Chỉnh sửa"><i class="glyphicon glyphicon-edit"></i></a>&nbsp;|&nbsp; <a onclick="pushPostUp('<?=$product->ProductID?>');" data-toggle="tooltip" title="Làm mới tin"><i class="glyphicon glyphicon-refresh"></i></a>&nbsp;|&nbsp; <a class="remove-post" data-post="<?=$product->ProductID?>" data-toggle="tooltip" title="Xóa tin đăng"><i class="glyphicon glyphicon-remove"></i></a> </td> </tr> <?php } ?> </tbody> </table> <div class="text-center"> <?php echo $pagination; ?> </div> </div> </div> </div> </section> <!-- /.content --> <input type="hidden" id="crudaction" name="crudaction"> <input type="hidden" id="productId" name="productId"> <?php echo form_close(); ?> </div> <!-- /.content-wrapper --> <!-- Main Footer --> <?php $this->load->view('/admin/common/admin-footer')?> </div> <!-- ./wrapper --> <!-- REQUIRED JS SCRIPTS --> <!-- jQuery 3 --> <script src="<?=base_url('/admin/js/jquery.min.js')?>"></script> <!-- Bootstrap 3.3.7 --> <script src="<?=base_url('/admin/js/bootstrap.min.js')?>"></script> <!-- AdminLTE App --> <script src="<?=base_url('/admin/js/adminlte.min.js')?>"></script> <script src="<?=base_url('/js/bootbox.min.js')?>"></script> <script src="<?=base_url('/admin/js/<API key>.min.js')?>"></script> <script src="<?=base_url('/admin/js/tindatdai_admin.js')?>"></script> <script type="text/javascript"> var sendRequest = function(){ var searchKey = $('#searchKey').val()||""; var fromDate = $('#fromDate').val()||""; var toDate = $('#toDate').val()||""; var code = $('#code').val()||""; var hasAuthor = $('input[name=hasAuthor]:checked').val(); var status = $('input[name=status]:checked').val(); var phoneNumber = $('#phoneNumber').val()||""; window.location.href = '<?=base_url('admin/product/list.html')?>?query='+searchKey + '&phoneNumber=' + phoneNumber + '&fromDate=' + fromDate + '&toDate=' + toDate + '&hasAuthor=' + hasAuthor + '&code=' + code + '&status=' + status + '&orderField='+curOrderField+'&orderDirection='+curOrderDirection; } var curOrderField, curOrderDirection; $('[data-action="sort"]').on('click', function(e){ curOrderField = $(this).data('title'); curOrderDirection = $(this).data('direction'); sendRequest(); }); $('#searchKey').val(decodeURIComponent(getNamedParameter('query')||"")); $('#fromDate').val(decodeURIComponent(getNamedParameter('fromDate')||"")); $('#toDate').val(decodeURIComponent(getNamedParameter('toDate')||"")); $('#code').val(decodeURIComponent(getNamedParameter('code')||"")); $('#phoneNumber').val(decodeURIComponent(getNamedParameter('phoneNumber')||"")); if(decodeURIComponent(getNamedParameter('hasAuthor')) != null){ $("#chb-" + (parseInt(decodeURIComponent(getNamedParameter('hasAuthor'))) + 1)).prop( "checked", true ); }else{ $("#chb-0").prop( "checked", true ); } if(decodeURIComponent(getNamedParameter('status')) != null){ $("#st-" + (parseInt(decodeURIComponent(getNamedParameter('status'))))).prop( "checked", true ); }else{ $("#st_0").prop( "checked", true ); } var curOrderField = getNamedParameter('orderField')||""; var curOrderDirection = getNamedParameter('orderDirection')||""; var currentSort = $('[data-action="sort"][data-title="'+getNamedParameter('orderField')+'"]'); if(curOrderDirection=="ASC"){ currentSort.attr('data-direction', "DESC").find('i.glyphicon').removeClass('<API key>').addClass('<API key> active'); }else{ currentSort.attr('data-direction', "ASC").find('i.glyphicon').removeClass('<API key>').addClass('<API key> active'); } function updateView(productId, val){ $("#pr-" + productId).addClass("process"); jQuery.ajax({ type: "POST", url: '<?=base_url("/Ajax_controller/<API key>")?>', dataType: 'json', data: {productId: productId, view: val}, success: function(res){ if(res == 'success'){ $("#pr-" + productId).addClass("success"); } } }); } function updateVip(productId, val){ jQuery.ajax({ type: "POST", url: '<?=base_url("/Ajax_controller/<API key>")?>', dataType: 'json', data: {productId: productId, vip: val}, success: function(res){ if(res == 'success'){ bootbox.alert("Cập nhật thành công"); } } }); } function pushPostUp(productId){ jQuery.ajax({ type: "POST", url: '<?=base_url("/admin/<API key>/pushPostUp")?>', dataType: 'json', data: {productId: productId}, success: function(res){ if(res == 'success'){ bootbox.alert("Cập nhật thành công"); } } }); } function <API key>(){ $("#deleteMulti").click(function(){ var selectedItems = $("input[name='checkList[]']:checked").length; if(selectedItems > 0) { bootbox.confirm("Bạn đã chắc chắn xóa những tin rao này chưa?", function (result) { if (result) { $("#crudaction").val("delete-multiple"); $("#frmPost").submit(); } }); }else{ bootbox.alert("Bạn chưa check chọn tin cần xóa!"); } }); } function deletePostHandler(){ $('.remove-post').click(function(){ var prId = $(this).data('post'); bootbox.confirm("Bạn đã chắc chắn xóa tin rao này chưa?", function(result){ if(result){ $("#productId").val(prId); $("#crudaction").val("delete"); $("#frmPost").submit(); } }); }); } $(document).ready(function(){ deletePostHandler(); <API key>(); }); </script> </body> </html>
import Form from '<API key>/Form' import submitForm from './chains/submitForm' import resetForm from './chains/resetForm' import validateForm from './chains/validateForm' export default (options = {}) => { return (module, controller) => { module.addState(Form({ name: { value: '', isRequired: true }, email: { value: '', validations: ['isEmail'], errorMessages: ['Not valid email'], isRequired: true }, password: { value: '', validations: ['equalsField:repeatPassword'], dependsOn: 'simple.repeatPassword', errorMessages: ['Not equal to repeated password'], isRequired: true }, repeatPassword: { value: '', validations: ['equalsField:password'], dependsOn: 'simple.password', errorMessages: ['Not equal to password'], isRequired: true }, address: Form({ street: { value: '' }, postalCode: { value: '', validations: ['isLength:4', 'isNumeric'], errorMessages: ['Has to be length 4', 'Can only contain numbers'] } }) })) module.addSignals({ formSubmitted: submitForm, resetClicked: resetForm, validateFormClicked: validateForm }) } }
namespace GarboDev { using System; using System.Collections.Generic; using System.Text; public partial class Renderer : IRenderer { private Memory memory; private uint[] scanline = new uint[240]; private byte[] blend = new byte[240]; private byte[] windowCover = new byte[240]; private uint[] back = new uint[240 * 160]; //private uint[] front = new uint[240 * 160]; private const uint pitch = 240; // Convenience variable as I use it everywhere, set once in RenderLine private ushort dispCnt; // Window helper variables private byte win0x1, win0x2, win0y1, win0y2; private byte win1x1, win1x2, win1y1, win1y2; private byte win0Enabled, win1Enabled, winObjEnabled, winOutEnabled; private bool winEnabled; private byte blendSource, blendTarget; private byte blendA, blendB, blendY; private int blendType; private int curLine = 0; private static uint[] colorLUT; static Renderer() { colorLUT = new uint[0x10000]; // Pre-calculate the color LUT for (uint i = 0; i <= 0xFFFF; i++) { uint r = (i & 0x1FU); uint g = (i & 0x3E0U) >> 5; uint b = (i & 0x7C00U) >> 10; r = (r << 3) | (r >> 2); g = (g << 3) | (g >> 2); b = (b << 3) | (b >> 2); colorLUT[i] = (r << 16) | (g << 8) | b; } } public Memory Memory { set { this.memory = value; } } public void Initialize(object data) { } public void Reset() { } public uint[] ShowFrame() { //Array.Copy(this.back, this.front, this.front.Length); //return this.front; return this.back; } public void RenderLine(int line) { this.curLine = line; // Render the line this.dispCnt = Memory.ReadU16(this.memory.IORam, Memory.DISPCNT); if ((this.dispCnt & (1 << 7)) != 0) { uint bgColor = Renderer.GbaTo32((ushort)0x7FFF); for (int i = 0; i < 240; i++) this.scanline[i] = bgColor; } else { this.winEnabled = false; if ((this.dispCnt & (1 << 13)) != 0) { // Calculate window 0 information ushort winy = Memory.ReadU16(this.memory.IORam, Memory.WIN0V); this.win0y1 = (byte)(winy >> 8); this.win0y2 = (byte)(winy & 0xff); ushort winx = Memory.ReadU16(this.memory.IORam, Memory.WIN0H); this.win0x1 = (byte)(winx >> 8); this.win0x2 = (byte)(winx & 0xff); if (this.win0x2 > 240 || this.win0x1 > this.win0x2) { this.win0x2 = 240; } if (this.win0y2 > 160 || this.win0y1 > this.win0y2) { this.win0y2 = 160; } this.win0Enabled = this.memory.IORam[Memory.WININ]; this.winEnabled = true; } if ((this.dispCnt & (1 << 14)) != 0) { // Calculate window 1 information ushort winy = Memory.ReadU16(this.memory.IORam, Memory.WIN1V); this.win1y1 = (byte)(winy >> 8); this.win1y2 = (byte)(winy & 0xff); ushort winx = Memory.ReadU16(this.memory.IORam, Memory.WIN1H); this.win1x1 = (byte)(winx >> 8); this.win1x2 = (byte)(winx & 0xff); if (this.win1x2 > 240 || this.win1x1 > this.win1x2) { this.win1x2 = 240; } if (this.win1y2 > 160 || this.win1y1 > this.win1y2) { this.win1y2 = 160; } this.win1Enabled = this.memory.IORam[Memory.WININ + 1]; this.winEnabled = true; } if ((this.dispCnt & (1 << 15)) != 0 && (this.dispCnt & (1 << 12)) != 0) { // Object windows are enabled this.winObjEnabled = this.memory.IORam[Memory.WINOUT + 1]; this.winEnabled = true; } if (this.winEnabled) { this.winOutEnabled = this.memory.IORam[Memory.WINOUT]; } // Calculate blending information ushort bldcnt = Memory.ReadU16(this.memory.IORam, Memory.BLDCNT); this.blendType = (bldcnt >> 6) & 0x3; this.blendSource = (byte)(bldcnt & 0x3F); this.blendTarget = (byte)((bldcnt >> 8) & 0x3F); ushort bldalpha = Memory.ReadU16(this.memory.IORam, Memory.BLDALPHA); this.blendA = (byte)(bldalpha & 0x1F); if (this.blendA > 0x10) this.blendA = 0x10; this.blendB = (byte)((bldalpha >> 8) & 0x1F); if (this.blendB > 0x10) this.blendB = 0x10; this.blendY = (byte)(this.memory.IORam[Memory.BLDY] & 0x1F); if (this.blendY > 0x10) this.blendY = 0x10; switch (this.dispCnt & 0x7) { case 0: this.RenderMode0Line(); break; case 1: this.RenderMode1Line(); break; case 2: this.RenderMode2Line(); break; case 3: this.RenderMode3Line(); break; case 4: this.RenderMode4Line(); break; case 5: this.RenderMode5Line(); break; } } Array.Copy(this.scanline, 0, this.back, this.curLine * Renderer.pitch, Renderer.pitch); } private void DrawBackdrop() { byte[] palette = this.memory.PaletteRam; // Initialize window coverage buffer if neccesary if (this.winEnabled) { for (int i = 0; i < 240; i++) { this.windowCover[i] = this.winOutEnabled; } if ((this.dispCnt & (1 << 15)) != 0) { // Sprite window this.DrawSpriteWindows(); } if ((this.dispCnt & (1 << 14)) != 0) { // Window 1 if (this.curLine >= this.win1y1 && this.curLine < this.win1y2) { for (int i = this.win1x1; i < this.win1x2; i++) { this.windowCover[i] = this.win1Enabled; } } } if ((this.dispCnt & (1 << 13)) != 0) { // Window 0 if (this.curLine >= this.win0y1 && this.curLine < this.win0y2) { for (int i = this.win0x1; i < this.win0x2; i++) { this.windowCover[i] = this.win0Enabled; } } } } // Draw backdrop first uint bgColor = Renderer.GbaTo32((ushort)(palette[0] | (palette[1] << 8))); uint modColor = bgColor; if (this.blendType == 2 && (this.blendSource & (1 << 5)) != 0) { // Brightness increase uint r = bgColor & 0xFF; uint g = (bgColor >> 8) & 0xFF; uint b = (bgColor >> 16) & 0xFF; r = r + (((0xFF - r) * this.blendY) >> 4); g = g + (((0xFF - g) * this.blendY) >> 4); b = b + (((0xFF - b) * this.blendY) >> 4); modColor = r | (g << 8) | (b << 16); } else if (this.blendType == 3 && (this.blendSource & (1 << 5)) != 0) { // Brightness decrease uint r = bgColor & 0xFF; uint g = (bgColor >> 8) & 0xFF; uint b = (bgColor >> 16) & 0xFF; r = r - ((r * this.blendY) >> 4); g = g - ((g * this.blendY) >> 4); b = b - ((b * this.blendY) >> 4); modColor = r | (g << 8) | (b << 16); } if (this.winEnabled) { for (int i = 0; i < 240; i++) { if ((this.windowCover[i] & (1 << 5)) != 0) { this.scanline[i] = modColor; } else { this.scanline[i] = bgColor; } this.blend[i] = 1 << 5; } } else { for (int i = 0; i < 240; i++) { this.scanline[i] = modColor; this.blend[i] = 1 << 5; } } } private void RenderTextBg(int bg) { if (this.winEnabled) { switch (this.blendType) { case 0: this.RenderTextBgWindow(bg); break; case 1: if ((this.blendSource & (1 << bg)) != 0) this.<API key>(bg); else this.RenderTextBgWindow(bg); break; case 2: if ((this.blendSource & (1 << bg)) != 0) this.<API key>(bg); else this.RenderTextBgWindow(bg); break; case 3: if ((this.blendSource & (1 << bg)) != 0) this.<API key>(bg); else this.RenderTextBgWindow(bg); break; } } else { switch (this.blendType) { case 0: this.RenderTextBgNormal(bg); break; case 1: if ((this.blendSource & (1 << bg)) != 0) this.RenderTextBgBlend(bg); else this.RenderTextBgNormal(bg); break; case 2: if ((this.blendSource & (1 << bg)) != 0) this.<API key>(bg); else this.RenderTextBgNormal(bg); break; case 3: if ((this.blendSource & (1 << bg)) != 0) this.<API key>(bg); else this.RenderTextBgNormal(bg); break; } } } private void RenderRotScaleBg(int bg) { if (this.winEnabled) { switch (this.blendType) { case 0: this.<API key>(bg); break; case 1: if ((this.blendSource & (1 << bg)) != 0) this.<API key>(bg); else this.<API key>(bg); break; case 2: if ((this.blendSource & (1 << bg)) != 0) this.<API key>(bg); else this.<API key>(bg); break; case 3: if ((this.blendSource & (1 << bg)) != 0) this.<API key>(bg); else this.<API key>(bg); break; } } else { switch (this.blendType) { case 0: this.<API key>(bg); break; case 1: if ((this.blendSource & (1 << bg)) != 0) this.<API key>(bg); else this.<API key>(bg); break; case 2: if ((this.blendSource & (1 << bg)) != 0) this.<API key>(bg); else this.<API key>(bg); break; case 3: if ((this.blendSource & (1 << bg)) != 0) this.<API key>(bg); else this.<API key>(bg); break; } } } private void DrawSprites(int pri) { if (this.winEnabled) { switch (this.blendType) { case 0: this.DrawSpritesWindow(pri); break; case 1: if ((this.blendSource & (1 << 4)) != 0) this.<API key>(pri); else this.DrawSpritesWindow(pri); break; case 2: if ((this.blendSource & (1 << 4)) != 0) this.<API key>(pri); else this.DrawSpritesWindow(pri); break; case 3: if ((this.blendSource & (1 << 4)) != 0) this.<API key>(pri); else this.DrawSpritesWindow(pri); break; } } else { switch (this.blendType) { case 0: this.DrawSpritesNormal(pri); break; case 1: if ((this.blendSource & (1 << 4)) != 0) this.DrawSpritesBlend(pri); else this.DrawSpritesNormal(pri); break; case 2: if ((this.blendSource & (1 << 4)) != 0) this.<API key>(pri); else this.DrawSpritesNormal(pri); break; case 3: if ((this.blendSource & (1 << 4)) != 0) this.<API key>(pri); else this.DrawSpritesNormal(pri); break; } } } private void RenderMode0Line() { byte[] palette = this.memory.PaletteRam; byte[] vram = this.memory.VideoRam; this.DrawBackdrop(); for (int pri = 3; pri >= 0; pri { for (int i = 3; i >= 0; i { if ((this.dispCnt & (1 << (8 + i))) != 0) { ushort bgcnt = Memory.ReadU16(this.memory.IORam, Memory.BG0CNT + 0x2 * (uint)i); if ((bgcnt & 0x3) == pri) { this.RenderTextBg(i); } } } this.DrawSprites(pri); } } private void RenderMode1Line() { byte[] palette = this.memory.PaletteRam; byte[] vram = this.memory.VideoRam; this.DrawBackdrop(); for (int pri = 3; pri >= 0; pri { if ((this.dispCnt & (1 << (8 + 2))) != 0) { ushort bgcnt = Memory.ReadU16(this.memory.IORam, Memory.BG2CNT); if ((bgcnt & 0x3) == pri) { this.RenderRotScaleBg(2); } } for (int i = 1; i >= 0; i { if ((this.dispCnt & (1 << (8 + i))) != 0) { ushort bgcnt = Memory.ReadU16(this.memory.IORam, Memory.BG0CNT + 0x2 * (uint)i); if ((bgcnt & 0x3) == pri) { this.RenderTextBg(i); } } } this.DrawSprites(pri); } } private void RenderMode2Line() { byte[] palette = this.memory.PaletteRam; byte[] vram = this.memory.VideoRam; this.DrawBackdrop(); for (int pri = 3; pri >= 0; pri { for (int i = 3; i >= 2; i { if ((this.dispCnt & (1 << (8 + i))) != 0) { ushort bgcnt = Memory.ReadU16(this.memory.IORam, Memory.BG0CNT + 0x2 * (uint)i); if ((bgcnt & 0x3) == pri) { this.RenderRotScaleBg(i); } } } this.DrawSprites(pri); } } private void RenderMode3Line() { ushort bg2Cnt = Memory.ReadU16(this.memory.IORam, Memory.BG2CNT); byte[] palette = this.memory.PaletteRam; byte[] vram = this.memory.VideoRam; this.DrawBackdrop(); byte blendMaskType = (byte)(1 << 2); int bgPri = bg2Cnt & 0x3; for (int pri = 3; pri > bgPri; pri { this.DrawSprites(pri); } if ((this.dispCnt & (1 << 10)) != 0) { // Background enabled, render it int x = this.memory.Bgx[0]; int y = this.memory.Bgy[0]; short dx = (short)Memory.ReadU16(this.memory.IORam, Memory.BG2PA); short dy = (short)Memory.ReadU16(this.memory.IORam, Memory.BG2PC); for (int i = 0; i < 240; i++) { int ax = ((int)x) >> 8; int ay = ((int)y) >> 8; if (ax >= 0 && ax < 240 && ay >= 0 && ay < 160) { int curIdx = ((ay * 240) + ax) * 2; this.scanline[i] = Renderer.GbaTo32((ushort)(vram[curIdx] | (vram[curIdx + 1] << 8))); this.blend[i] = blendMaskType; } x += dx; y += dy; } } for (int pri = bgPri; pri >= 0; pri { this.DrawSprites(pri); } } private void RenderMode4Line() { ushort bg2Cnt = Memory.ReadU16(this.memory.IORam, Memory.BG2CNT); byte[] palette = this.memory.PaletteRam; byte[] vram = this.memory.VideoRam; this.DrawBackdrop(); byte blendMaskType = (byte)(1 << 2); int bgPri = bg2Cnt & 0x3; for (int pri = 3; pri > bgPri; pri { this.DrawSprites(pri); } if ((this.dispCnt & (1 << 10)) != 0) { // Background enabled, render it int baseIdx = 0; if ((this.dispCnt & (1 << 4)) == 1 << 4) baseIdx = 0xA000; int x = this.memory.Bgx[0]; int y = this.memory.Bgy[0]; short dx = (short)Memory.ReadU16(this.memory.IORam, Memory.BG2PA); short dy = (short)Memory.ReadU16(this.memory.IORam, Memory.BG2PC); for (int i = 0; i < 240; i++) { int ax = ((int)x) >> 8; int ay = ((int)y) >> 8; if (ax >= 0 && ax < 240 && ay >= 0 && ay < 160) { int lookup = vram[baseIdx + (ay * 240) + ax]; if (lookup != 0) { this.scanline[i] = Renderer.GbaTo32((ushort)(palette[lookup * 2] | (palette[lookup * 2 + 1] << 8))); this.blend[i] = blendMaskType; } } x += dx; y += dy; } } for (int pri = bgPri; pri >= 0; pri { this.DrawSprites(pri); } } private void RenderMode5Line() { ushort bg2Cnt = Memory.ReadU16(this.memory.IORam, Memory.BG2CNT); byte[] palette = this.memory.PaletteRam; byte[] vram = this.memory.VideoRam; this.DrawBackdrop(); byte blendMaskType = (byte)(1 << 2); int bgPri = bg2Cnt & 0x3; for (int pri = 3; pri > bgPri; pri { this.DrawSprites(pri); } if ((this.dispCnt & (1 << 10)) != 0) { // Background enabled, render it int baseIdx = 0; if ((this.dispCnt & (1 << 4)) == 1 << 4) baseIdx += 160 * 128 * 2; int x = this.memory.Bgx[0]; int y = this.memory.Bgy[0]; short dx = (short)Memory.ReadU16(this.memory.IORam, Memory.BG2PA); short dy = (short)Memory.ReadU16(this.memory.IORam, Memory.BG2PC); for (int i = 0; i < 240; i++) { int ax = ((int)x) >> 8; int ay = ((int)y) >> 8; if (ax >= 0 && ax < 160 && ay >= 0 && ay < 128) { int curIdx = (int)(ay * 160 + ax) * 2; this.scanline[i] = Renderer.GbaTo32((ushort)(vram[baseIdx + curIdx] | (vram[baseIdx + curIdx + 1] << 8))); this.blend[i] = blendMaskType; } x += dx; y += dy; } } for (int pri = bgPri; pri >= 0; pri { this.DrawSprites(pri); } } private void DrawSpriteWindows() { byte[] palette = this.memory.PaletteRam; byte[] vram = this.memory.VideoRam; // OBJ must be enabled in this.dispCnt if ((this.dispCnt & (1 << 12)) == 0) return; for (int oamNum = 127; oamNum >= 0; oamNum { ushort attr0 = this.memory.ReadU16Debug(Memory.OAM_BASE + (uint)(oamNum * 8) + 0); // Not an object window, so continue if (((attr0 >> 10) & 3) != 2) continue; ushort attr1 = this.memory.ReadU16Debug(Memory.OAM_BASE + (uint)(oamNum * 8) + 2); ushort attr2 = this.memory.ReadU16Debug(Memory.OAM_BASE + (uint)(oamNum * 8) + 4); int x = attr1 & 0x1FF; int y = attr0 & 0xFF; int width = -1, height = -1; switch ((attr0 >> 14) & 3) { case 0: // Square switch ((attr1 >> 14) & 3) { case 0: width = 8; height = 8; break; case 1: width = 16; height = 16; break; case 2: width = 32; height = 32; break; case 3: width = 64; height = 64; break; } break; case 1: // Horizontal Rectangle switch ((attr1 >> 14) & 3) { case 0: width = 16; height = 8; break; case 1: width = 32; height = 8; break; case 2: width = 32; height = 16; break; case 3: width = 64; height = 32; break; } break; case 2: // Vertical Rectangle switch ((attr1 >> 14) & 3) { case 0: width = 8; height = 16; break; case 1: width = 8; height = 32; break; case 2: width = 16; height = 32; break; case 3: width = 32; height = 64; break; } break; } // Check double size flag here int rwidth = width, rheight = height; if ((attr0 & (1 << 8)) != 0) { // Rot-scale on if ((attr0 & (1 << 9)) != 0) { rwidth *= 2; rheight *= 2; } } else { // Invalid sprite if ((attr0 & (1 << 9)) != 0) width = -1; } if (width == -1) { // Invalid sprite continue; } // Y clipping if (y > ((y + rheight) & 0xff)) { if (this.curLine >= ((y + rheight) & 0xff) && !(y < this.curLine)) continue; } else { if (this.curLine < y || this.curLine >= ((y + rheight) & 0xff)) continue; } int scale = 1; if ((attr0 & (1 << 13)) != 0) scale = 2; int spritey = this.curLine - y; if (spritey < 0) spritey += 256; if ((attr0 & (1 << 8)) == 0) { if ((attr1 & (1 << 13)) != 0) spritey = (height - 1) - spritey; int baseSprite; if ((this.dispCnt & (1 << 6)) != 0) { // 1 dimensional baseSprite = (attr2 & 0x3FF) + ((spritey / 8) * (width / 8)) * scale; } else { // 2 dimensional baseSprite = (attr2 & 0x3FF) + ((spritey / 8) * 0x20); } int baseInc = scale; if ((attr1 & (1 << 12)) != 0) { baseSprite += ((width / 8) * scale) - scale; baseInc = -baseInc; } if ((attr0 & (1 << 13)) != 0) { // 256 colors for (int i = x; i < x + width; i++) { if ((i & 0x1ff) < 240) { int tx = (i - x) & 7; if ((attr1 & (1 << 12)) != 0) tx = 7 - tx; int curIdx = baseSprite * 32 + ((spritey & 7) * 8) + tx; int lookup = vram[0x10000 + curIdx]; if (lookup != 0) { this.windowCover[i & 0x1ff] = this.winObjEnabled; } } if (((i - x) & 7) == 7) baseSprite += baseInc; } } else { // 16 colors int palIdx = 0x200 + (((attr2 >> 12) & 0xF) * 16 * 2); for (int i = x; i < x + width; i++) { if ((i & 0x1ff) < 240) { int tx = (i - x) & 7; if ((attr1 & (1 << 12)) != 0) tx = 7 - tx; int curIdx = baseSprite * 32 + ((spritey & 7) * 4) + (tx / 2); int lookup = vram[0x10000 + curIdx]; if ((tx & 1) == 0) { lookup &= 0xf; } else { lookup >>= 4; } if (lookup != 0) { this.windowCover[i & 0x1ff] = this.winObjEnabled; } } if (((i - x) & 7) == 7) baseSprite += baseInc; } } } else { int rotScaleParam = (attr1 >> 9) & 0x1F; short dx = (short)this.memory.ReadU16Debug(Memory.OAM_BASE + (uint)(rotScaleParam * 8 * 4) + 0x6); short dmx = (short)this.memory.ReadU16Debug(Memory.OAM_BASE + (uint)(rotScaleParam * 8 * 4) + 0xE); short dy = (short)this.memory.ReadU16Debug(Memory.OAM_BASE + (uint)(rotScaleParam * 8 * 4) + 0x16); short dmy = (short)this.memory.ReadU16Debug(Memory.OAM_BASE + (uint)(rotScaleParam * 8 * 4) + 0x1E); int cx = rwidth / 2; int cy = rheight / 2; int baseSprite = attr2 & 0x3FF; int pitch; if ((this.dispCnt & (1 << 6)) != 0) { // 1 dimensional pitch = (width / 8) * scale; } else { // 2 dimensional pitch = 0x20; } short rx = (short)((dmx * (spritey - cy)) - (cx * dx) + (width << 7)); short ry = (short)((dmy * (spritey - cy)) - (cx * dy) + (height << 7)); // Draw a rot/scale sprite if ((attr0 & (1 << 13)) != 0) { // 256 colors for (int i = x; i < x + rwidth; i++) { int tx = rx >> 8; int ty = ry >> 8; if ((i & 0x1ff) < 240 && tx >= 0 && tx < width && ty >= 0 && ty < height) { int curIdx = (baseSprite + ((ty / 8) * pitch) + ((tx / 8) * scale)) * 32 + ((ty & 7) * 8) + (tx & 7); int lookup = vram[0x10000 + curIdx]; if (lookup != 0) { this.windowCover[i & 0x1ff] = this.winObjEnabled; } } rx += dx; ry += dy; } } else { // 16 colors int palIdx = 0x200 + (((attr2 >> 12) & 0xF) * 16 * 2); for (int i = x; i < x + rwidth; i++) { int tx = rx >> 8; int ty = ry >> 8; if ((i & 0x1ff) < 240 && tx >= 0 && tx < width && ty >= 0 && ty < height) { int curIdx = (baseSprite + ((ty / 8) * pitch) + ((tx / 8) * scale)) * 32 + ((ty & 7) * 4) + ((tx & 7) / 2); int lookup = vram[0x10000 + curIdx]; if ((tx & 1) == 0) { lookup &= 0xf; } else { lookup >>= 4; } if (lookup != 0) { this.windowCover[i & 0x1ff] = this.winObjEnabled; } } rx += dx; ry += dy; } } } } } public static uint GbaTo32(ushort color) { // more accurate, but slower :( // return colorLUT[color]; return ((color & 0x1FU) << 19) | ((color & 0x3E0U) << 6) | ((color & 0x7C00U) >> 7); } } }
package models import java.util.UUID import play.api.db.slick.Config.driver.simple._ import org.joda.time.DateTime import com.github.tototoshi.slick.HsqldbJodaSupport._ case class ClientGrantType( clientId: String, grantTypeId: Int ) extends Model class ClientGrantTypes(tag: Tag) extends Table[ClientGrantType](tag, "CLIENT_GRANT_TYPES") { def clientId = column[String]("CLIENT_ID") def grantTypeId = column[Int]("GRANT_TYPE_ID") def * = (clientId, grantTypeId) <> (ClientGrantType.tupled, ClientGrantType.unapply) val pk = primaryKey("<API key>", (clientId, grantTypeId)) } object ClientGrantTypes extends BaseSlickTrait[ClientGrantType] { override protected def model = TableQueries.clientGrantTypes }
<?php $data = array ( 0 => array ( 'id' => '3', 'name' => '', 'desc' => '', 'parent_id' => '0', 'has_child' => '0', 'is_show' => '0', 'level' => '1', 'type' => '0', 'sort' => '0', ), ); ?>
<?php namespace AppBundle\Controller; use AppBundle\Entity\BillingAddress; use AppBundle\Entity\ShippingAddress; use AppBundle\Form\<API key>; use AppBundle\Form\<API key>; use AppBundle\Form\<API key>; use Sensio\Bundle\<API key>\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; class CheckoutController extends Controller { /** * @Route("/checkout/billing",name="billing-address") * */ public function <API key>(Request $request) { $user = $this->get('security.token_storage')->getToken()->getUser(); $em = $this->getDoctrine()->getManager(); $cart = $em->getRepository('AppBundle:Cart') ->findMyCart($user); $billingAddress = new BillingAddress(); $billingAddress->setUser($user); $billingAddress->setFirstName($user->getFirstName()); $billingAddress->setLastName($user->getLastName()); $billingAddress->setEmailAddress($user->getUserName()); $form = $this->createForm(<API key>::class, $billingAddress); //only handles data on POST $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $billingAddress = $form->getData(); $em = $this->getDoctrine()->getManager(); $em->persist($billingAddress); $em->flush(); return $this->redirectToRoute('shipping-address'); } return $this->render(':partials:checkout-billing.htm.twig', [ 'billingAddressForm' => $form->createView(), 'cart' => $cart[0] ]); } /** * @Route("/checkout/shipping",name="shipping-address") * */ public function <API key>(Request $request) { $user = $this->get('security.token_storage')->getToken()->getUser(); $em = $this->getDoctrine()->getManager(); $cart = $em->getRepository('AppBundle:Cart') ->findMyCart($user); $shippingAddress = new ShippingAddress(); $shippingAddress->setUser($user); $shippingAddress->setFirstName($user->getFirstName()); $shippingAddress->setLastName($user->getLastName()); $shippingAddress->setEmailAddress($user->getUserName()); $form = $this->createForm(<API key>::class, $shippingAddress); //only handles data on POST $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $shippingAddress = $form->getData(); $em = $this->getDoctrine()->getManager(); $em->persist($shippingAddress); $em->flush(); return $this->redirectToRoute('shipping-method'); } return $this->render(':partials:<API key>.htm.twig', [ 'shippingAddressForm' => $form->createView(), 'cart' => $cart[0] ]); } /** * @Route("/checkout/shipping-method",name="shipping-method") * */ public function <API key>(Request $request) { $user = $this->get('security.token_storage')->getToken()->getUser(); $em = $this->getDoctrine()->getManager(); $cart = $em->getRepository('AppBundle:Cart') ->findMyCart($user); $shippingAddress = new ShippingAddress(); $shippingAddress->setUser($user); $form = $this->createForm(<API key>::class); //only handles data on POST $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $category = $form->getData(); $em = $this->getDoctrine()->getManager(); $em->persist($category); $em->flush(); return $this->redirectToRoute('shipping-method'); } return $this->render(':partials:<API key>.htm.twig', [ 'shippingMethodForm' => $form->createView(), 'cart' => $cart[0] ]); } /** * @Route("/checkout/payment",name="payment") * */ public function paymentAction(Request $request) { $user = $this->get('security.token_storage')->getToken()->getUser(); $em = $this->getDoctrine()->getManager(); $cart = $em->getRepository('AppBundle:Cart') ->findMyCart($user); $form = $this->createForm(<API key>::class); //only handles data on POST $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $category = $form->getData(); $em = $this->getDoctrine()->getManager(); $em->persist($category); $em->flush(); return $this->redirectToRoute('shipping-method'); } return $this->render(':partials:checkout-pay.htm.twig', [ 'paymentForm' => $form->createView(), 'cart' => $cart[0] ]); } }
<?php declare(strict_types=1); namespace phpDocumentor\Descriptor; use Mockery\Adapter\Phpunit\MockeryTestCase; use stdClass; /** * Tests the functionality for the Collection class. * * @coversDefaultClass \phpDocumentor\Descriptor\Collection */ final class CollectionTest extends MockeryTestCase { /** @var Collection $fixture */ private $fixture; /** * Creates a new (empty) fixture object. */ protected function setUp() : void { $this->fixture = new Collection(); } /** * @covers ::__construct */ public function testInitialize() : void { $fixture = new Collection(); $this->assertEmpty($fixture->getAll()); } /** * @covers ::__construct */ public function <API key>() : void { $expected = [1, 2]; $fixture = new Collection($expected); $this->assertEquals($expected, $fixture->getAll()); } /** * @covers ::add */ public function testAddNewItem() : void { $expected = ['abc']; $expectedSecondRun = ['abc', 'def']; $this->fixture->add('abc'); $this->assertEquals($expected, $this->fixture->getAll()); $this->fixture->add('def'); $this->assertEquals($expectedSecondRun, $this->fixture->getAll()); } /** * @covers ::set * @covers ::offsetSet */ public function testSetItemsWithKey() : void { $expected = ['z' => 'abc']; $expectedSecondRun = ['z' => 'abc', 'y' => 'def']; $this->assertEquals([], $this->fixture->getAll()); $this->fixture->set('z', 'abc'); $this->assertEquals($expected, $this->fixture->getAll()); $this->fixture->set('y', 'def'); $this->assertEquals($expectedSecondRun, $this->fixture->getAll()); } /** * @covers ::set */ public function <API key>() : void { $this->expectException('<API key>'); $this->fixture->set('', 'abc'); } /** * @covers ::offsetSet */ public function <API key>() : void { $this->expectException('<API key>'); $this->fixture->offsetSet('', 'abc'); } /** * @covers ::get * @covers ::__get * @covers ::offsetGet */ public function <API key>() : void { $this->fixture['a'] = 'abc'; $this->assertEquals('abc', $this->fixture->__get('a')); $this->assertEquals('abc', $this->fixture['a']); $this->assertEquals('abc', $this->fixture->get('a')); $this->assertCount(1, $this->fixture); $this->assertEquals('def', $this->fixture->fetch(1, 'def')); $this->assertCount(2, $this->fixture); } /** * @covers ::getAll */ public function <API key>() : void { $this->fixture['a'] = 'abc'; $this->assertSame(['a' => 'abc'], $this->fixture->getAll()); } /** * @covers ::getIterator */ public function testGetIterator() : void { $this->fixture['a'] = 'abc'; $this->assertInstanceOf('ArrayIterator', $this->fixture->getIterator()); $this->assertSame(['a' => 'abc'], $this->fixture->getIterator()->getArrayCopy()); } /** * @covers ::count * @covers ::offsetUnset */ public function <API key>() : void { $this->assertCount(0, $this->fixture); $this->assertEquals(0, $this->fixture->count()); $this->fixture[0] = 'abc'; $this->assertCount(1, $this->fixture); $this->assertEquals(1, $this->fixture->count()); $this->fixture[1] = 'def'; $this->assertCount(2, $this->fixture); $this->assertEquals(2, $this->fixture->count()); unset($this->fixture[0]); $this->assertCount(1, $this->fixture); $this->assertEquals(1, $this->fixture->count()); } /** * @covers ::clear */ public function <API key>() : void { $this->fixture[1] = 'a'; $this->fixture[2] = 'b'; $this->assertCount(2, $this->fixture); $this->fixture->clear(); $this->assertCount(0, $this->fixture); } /** * @covers ::offsetExists */ public function <API key>() : void { $this-><API key>(0, $this->fixture); $this->assertFalse($this->fixture->offsetExists(0)); $this->fixture[0] = 'abc'; $this->assertArrayHasKey(0, $this->fixture); $this->assertTrue($this->fixture->offsetExists(0)); } /** * @covers ::merge */ public function <API key>() : void { $expected = [0 => 'a', 1 => 'b', 2 => 'c']; $this->fixture[1] = 'a'; $this->fixture[2] = 'b'; $collection2 = new Collection(); $collection2[4] = 'c'; $result = $this->fixture->merge($collection2); $this->assertSame($expected, $result->getAll()); } /** * @covers ::filter */ public function <API key>() : void { $expected = [0 => new stdClass()]; $this->fixture[0] = new stdClass(); $this->fixture[1] = false; $this->fixture[2] = 'string'; $result = $this->fixture->filter(stdClass::class)->getAll(); $this->assertEquals($expected, $result); } }
"use strict"; define("ace/snippets/scala", ["require", "exports", "module"], function (require, exports, module) { "use strict"; exports.snippetText = undefined; exports.scope = "scala"; });
// Use of this source code is governed by a BSD-style package main import ( "errors" "go/build" "testing" "github.com/golang/dep/internal/gps" "github.com/golang/dep/internal/gps/pkgtree" ) func <API key>(t *testing.T) { ec := &ensureCommand{ update: true, add: true, } if err := ec.validateFlags(); err == nil { t.Error("-add and -update together should fail validation") } ec.vendorOnly, ec.add = true, false if err := ec.validateFlags(); err == nil { t.Error("-vendor-only with -update should fail validation") } ec.add, ec.update = true, false if err := ec.validateFlags(); err == nil { t.Error("-vendor-only with -add should fail validation") } ec.noVendor, ec.add = true, false if err := ec.validateFlags(); err == nil { t.Error("-vendor-only with -no-vendor should fail validation") } ec.noVendor = false // Also verify that the plain ensure path takes no args. This is a shady // test, as lots of other things COULD return errors, and we don't check // anything other than the error being non-nil. For now, it works well // because a panic will quickly result if the initial arg length validation // checks are incorrectly handled. if err := ec.runDefault(nil, []string{"foo"}, nil, nil, gps.SolveParameters{}); err == nil { t.Errorf("no args to plain ensure with -vendor-only") } ec.vendorOnly = false if err := ec.runDefault(nil, []string{"foo"}, nil, nil, gps.SolveParameters{}); err == nil { t.Errorf("no args to plain ensure") } } func TestCheckErrors(t *testing.T) { tt := []struct { name string fatal bool pkgOrErrMap map[string]pkgtree.PackageOrErr }{ { name: "noErrors", fatal: false, pkgOrErrMap: map[string]pkgtree.PackageOrErr{ "mypkg": { P: pkgtree.Package{}, }, }, }, { name: "hasErrors", fatal: true, pkgOrErrMap: map[string]pkgtree.PackageOrErr{ "github.com/me/pkg": { Err: &build.NoGoError{}, }, "github.com/someone/pkg": { Err: errors.New("code is busted"), }, }, }, { name: "onlyGoErrors", fatal: false, pkgOrErrMap: map[string]pkgtree.PackageOrErr{ "github.com/me/pkg": { Err: &build.NoGoError{}, }, "github.com/someone/pkg": { P: pkgtree.Package{}, }, }, }, { name: "onlyBuildErrors", fatal: false, pkgOrErrMap: map[string]pkgtree.PackageOrErr{ "github.com/me/pkg": { Err: &build.NoGoError{}, }, "github.com/someone/pkg": { P: pkgtree.Package{}, }, }, }, { name: "allGoErrors", fatal: true, pkgOrErrMap: map[string]pkgtree.PackageOrErr{ "github.com/me/pkg": { Err: &build.NoGoError{}, }, }, }, { name: "allMixedErrors", fatal: true, pkgOrErrMap: map[string]pkgtree.PackageOrErr{ "github.com/me/pkg": { Err: &build.NoGoError{}, }, "github.com/someone/pkg": { Err: errors.New("code is busted"), }, }, }, } for _, tc := range tt { t.Run(tc.name, func(t *testing.T) { fatal, err := checkErrors(tc.pkgOrErrMap) if tc.fatal != fatal { t.Fatalf("expected fatal flag to be %T, got %T", tc.fatal, fatal) } if err == nil && fatal { t.Fatal("unexpected fatal flag value while err is nil") } }) } }
'use strict'; module.exports = { set: function (v) { this.setProperty('src', v); }, get: function () { return this.getPropertyValue('src'); }, enumerable: true };
<?php namespace App\Modules\OAuth\Controllers; use App\Http\Controllers\Controller; use App\Modules\Users\Controllers\UserController; use App\Modules\Users\Models\User; use App\Modules\Users\Supports\MailCheckSupport; use Laravel\Socialite\Facades\Socialite as Socialite; use Illuminate\Http\Request; use Tymon\JWTAuth\JWTAuth; use Tymon\JWTAuth\Exceptions\JWTException; use Tymon\JWTAuth\Exceptions\<API key>; use Tymon\JWTAuth\Exceptions\<API key>; /** * Class LoginController * @package App\Modules\OAuth\Controllers */ class LoginController extends Controller { /** * @var JWTAuth */ protected $jwt; /** * @var UserController */ public $userController; /** * LoginController constructor. * @param JWTAuth $jwt * @param UserController $userController */ public function __construct(JWTAuth $jwt, UserController $userController) { $this->jwt = $jwt; $this->userController = $userController; } /** * @param $provider * @return mixed */ public function redirectToProvider($provider) { return Socialite::driver($provider) ->stateless() ->redirect(); } /** * @param $provider * @return \Illuminate\Http\Response|\Laravel\Lumen\Http\ResponseFactory */ public function <API key>($provider) { try { /** * get user infos with callback provider token */ $user = Socialite::driver($provider) ->stateless() ->user(); /** * check if user email exists in database */ if(!MailCheckSupport::userEmailCheck($user->email)) { /** * create user array infos to save in database */ $userInfos = [ 'name' => $user->name, 'email' => $user->email, 'password' => null, 'remember_token' => str_random(10), 'provider' => $provider, 'provider_id' => $user->id, 'avatar_url' => $user->avatar ]; /** * generate a personal token access from this new user */ $token = $this->userController-><API key>($userInfos); } else { /** * search existent user in database and generate your personal token access */ $existsUser = User::where('email',$user->email)->first(); $token = $this->jwt->fromUser($existsUser); } if ( env('REDIR_URL') ) { if (env('<API key>')) { $redirWithToken = env('REDIR_URL') . "/token:{$token}"; } else { $redirWithToken = env('REDIR_URL') . "?token={$token}"; } return redirect($redirWithToken); } return response()->json(compact('token')); } catch (\Exception $ex) { return response($ex->getMessage(),500); } } /** * @param Request $request * @return \Illuminate\Http\JsonResponse */ public function authenticate(Request $request) { $this->validate($request, [ 'email' => 'required|email|max:255', 'password' => 'required', ]); try { if (! $token = $this->jwt->attempt($request->only('email', 'password'))) { return response()->json(['user_not_found'], 404); } } catch (<API key> $e) { return response()->json(['token_expired'], $e->getStatusCode()); } catch (<API key> $e) { return response()->json(['token_invalid'], $e->getStatusCode()); } catch (JWTException $e) { return response()->json(['token_absent' => $e->getMessage()], $e->getStatusCode()); } return response()->json(compact('token')); } }
body { font: 10px sans-serif; } .axis path, .axis line { fill: none; stroke: #000; shape-rendering: crispEdges; } .bar { fill: steelblue; } g.orbit, g.main { cursor: pointer; pointer-events: all; }
#!/bin/sh # Compile script to compile against Elysion library # Works for Mac OS X and Linux FPC_BIN=`which fpc` BIN_FOLDER="../bin" LIB_FOLDER="../lib" RES_FOLDER="../resources" SRC_FOLDER="../source" # Info.plist constants BUNDLE_REGION="English" BUNDLE_ICON="logo.icns" BUNDLE_IDENT="com.mycompanyname" BUNDLE_SIGNATURE="????" BUNDLE_VERSION="1.0" SRC_MAIN="main.lpr" BIN_MAIN=`basename ${SRC_MAIN} .lpr` CONFIG_FILE="@config.cfg" EXEC_NAME="myapp" APP_NAME="My App Title" cd ${SRC_FOLDER} if [ -f /System/Library/Frameworks/Cocoa.framework/Cocoa ] then SDL_PATH= SDL_MIXER_PATH= SDL_TTF_PATH= SDL_NET_PATH= DEV_LINK_PPC= DEV_LINK_INTEL32= DEV_LINK_INTEL64= MIN_PPC= MIN_INTEL32= MIN_INTEL64= if [ -d /Library/Frameworks/SDL.framework ] then SDL_PATH="/Library/Frameworks/SDL.framework" elif [ -d ~/Library/Frameworks/SDL.framework ] then SDL_PATH="~/Library/Frameworks/SDL.framework" else echo "SDL not detected. Please check: https://github.com/freezedev/elysion/wiki/<API key>" exit 1 fi if [ -d /Library/Frameworks/SDL_mixer.framework ] then SDL_MIXER_PATH="/Library/Frameworks/SDL_mixer.framework" elif [ -d ~/Library/Frameworks/SDL_mixer.framework ] then SDL_MIXER_PATH="~/Library/Frameworks/SDL_mixer.framework" fi if [ -d /Library/Frameworks/SDL_ttf.framework ] then SDL_TTF_PATH="/Library/Frameworks/SDL_ttf.framework" elif [ -d ~/Library/Frameworks/SDL_ttf.framework ] then SDL_TTF_PATH="~/Library/Frameworks/SDL_ttf.framework" fi if [ -d /Library/Frameworks/SDL_net.framework ] then SDL_NET_PATH="/Library/Frameworks/SDL_net.framework" elif [ -d ~/Library/Frameworks/SDL_net.framework ] then SDL_NET_PATH="~/Library/Frameworks/SDL_net.framework" fi if [ [ -d /Developer/SDKs/MacOSX10.7.sdk ] || [ -d /Developer/SDKs/MacOSX10.6.sdk ] || [ -d /Developer/SDKs/MacOSX10.5.sdk ] || [ -d /Developer/SDKs/MacOSX10.4u.sdk ] ] then echo "At least one Mac OS X SDK found" else echo "XCode does not seem be installed. Please install XCode." exit 1 fi if [ -d "/Developer/SDKs/MacOSX10.7.sdk" ] then DEV_LINK_PPC= DEV_LINK_INTEL32="/Developer/SDKs/MacOSX10.7.sdk" DEV_LINK_INTEL64="/Developer/SDKs/MacOSX10.7.sdk" MIN_INTEL32="10.7.0" MIN_INTEL64="10.7.0" fi if [ -d "/Developer/SDKs/MacOSX10.6.sdk" ] then DEV_LINK_PPC= DEV_LINK_INTEL32="/Developer/SDKs/MacOSX10.6.sdk" DEV_LINK_INTEL64="/Developer/SDKs/MacOSX10.6.sdk" MIN_INTEL32="10.6.0" MIN_INTEL64="10.6.0" fi if [ -d "/Developer/SDKs/MacOSX10.5.sdk" ] then DEV_LINK_PPC="/Developer/SDKs/MacOSX10.5.sdk" DEV_LINK_INTEL32="/Developer/SDKs/MacOSX10.5.sdk" MIN_INTEL32="10.5.0" fi if [ -d "/Developer/SDKs/MacOSX10.4u.sdk" ] then DEV_LINK_PPC="/Developer/SDKs/MacOSX10.4u.sdk" DEV_LINK_INTEL32="/Developer/SDKs/MacOSX10.4u.sdk" MIN_PPC="10.4.0" MIN_INTEL32="10.4.0" fi FPC_BIN=`which ppc386` # Compiling Intel x86 binary ${FPC_BIN} ${CONFIG_FILE} -XR${DEV_LINK_INTEL32} -k"-L${LIB_FOLDER}/MacOSX -L/usr/X11R6/lib" ${SRC_MAIN} mv "${BIN_FOLDER}/${BIN_MAIN}" "${BIN_FOLDER}/${BIN_MAIN}-intel_x86"
# Tablespoon **This repository is no longer being maintained. Please use [https: Easily query spreadsheet-like or json data with SQLite or PostgreSQL. Built around[ node-postgres](https: Installation To install as a Node.js module ` npm install tablespoon ` To use Tablespoon's command line interface, install with the global flag ` npm install tablespoon -g ` If you want to use Tablespoon in both circumstances, run both commands. Documentation Check out [the wiki](https://github.com/ajam/tablespoon/wiki) for the latest documentation and the [FAQ](https://github.com/ajam/tablespoon/wiki/Faq), which includes [helpful tips](https://github.com/ajam/tablespoon/wiki/Faq#<API key>) on how to load in `csv` or `tsv` data into Node.js. Example usage See more [examples](https://github.com/ajam/tablespoon/tree/master/examples). `js var ts = require('tablespoon.js').pgsql(); var data = [ { city: "New York", temp: [0,35], country: 'USA' }, { city: 'Los Angeles', temp: [15,35], country: 'USA' }, { city: 'Paris', temp: [2,33], country: 'France' }, { city: 'Marseille', temp: [5,27], country: 'France' }, { city: 'London', temp: [2,25], country: 'UK' } ] ts.createTable(data, 'cities') // Get the rows that don't have 15 ts.query('SELECT * FROM cities WHERE 15 != ALL (temp)', function(rows){ console.log(rows) /*{ query: 'SELECT * FROM cities WHERE 15 != ALL (temp)', rows: [ { uid: '1', city: 'New York', temp: [0,35], country: 'USA' }, { uid: '3', city: 'Paris', temp: [2,33], country: 'France' }, { uid: '4', city: 'Marseille', temp: [5,27], country: 'France' }, { uid: '5', city: 'London', temp: [2,25], country: 'UK' } ] }*/ }) ` Testing Examples and testing require a `postgres` role unless you change the connection string your own role. Create with `createuser -s -r postgres` from the command line. Used in Analysis for [Nominated for the Oscars but failing the Bechdel sexism test](http://america.aljazeera.com/articles/2014/1/17/<API key>.html) - Al Jazeera America
#include <QApplication> #include "bitcoingui.h" #include "clientmodel.h" #include "walletmodel.h" #include "optionsmodel.h" #include "guiutil.h" #include "guiconstants.h" #include "init.h" #include "util.h" #include "ui_interface.h" #include "paymentserver.h" #include "splashscreen.h" #include <QMessageBox> #if QT_VERSION < 0x050000 #include <QTextCodec> #endif #include <QLocale> #include <QTimer> #include <QTranslator> #include <QLibraryInfo> #ifdef Q_OS_MAC #include "macdockiconhandler.h" #endif #if defined(<API key>) && !defined(<API key>) #define <API key> #define __INSURE__ #include <QtPlugin> Q_IMPORT_PLUGIN(qcncodecs) Q_IMPORT_PLUGIN(qjpcodecs) Q_IMPORT_PLUGIN(qtwcodecs) Q_IMPORT_PLUGIN(qkrcodecs) Q_IMPORT_PLUGIN(qtaccessiblewidgets) #endif // Declare meta types used for QMetaObject::invokeMethod Q_DECLARE_METATYPE(bool*) // Need a global reference for the notifications to find the GUI static BitcoinGUI *guiref; static SplashScreen *splashref; static bool <API key>(const std::string& message, const std::string& caption, unsigned int style) { // Message from network thread if(guiref) { bool modal = (style & CClientUIInterface::MODAL); bool ret = false; // In case of modal message, use blocking connection to wait for user to click a button QMetaObject::invokeMethod(guiref, "message", modal ? GUIUtil::<API key>() : Qt::QueuedConnection, Q_ARG(QString, QString::fromStdString(caption)), Q_ARG(QString, QString::fromStdString(message)), Q_ARG(unsigned int, style), Q_ARG(bool*, &ret)); return ret; } else { printf("%s: %s\n", caption.c_str(), message.c_str()); fprintf(stderr, "%s: %s\n", caption.c_str(), message.c_str()); return false; } } static bool ThreadSafeAskFee(int64 nFeeRequired) { if(!guiref) return false; if(nFeeRequired < CTransaction::nMinTxFee || nFeeRequired <= nTransactionFee || fDaemon) return true; bool payFee = false; QMetaObject::invokeMethod(guiref, "askFee", GUIUtil::<API key>(), Q_ARG(qint64, nFeeRequired), Q_ARG(bool*, &payFee)); return payFee; } static void InitMessage(const std::string &message) { if(splashref) { splashref->showMessage(QString::fromStdString(message), Qt::AlignBottom|Qt::AlignHCenter, QColor(55,55,55)); qApp->processEvents(); } printf("init message: %s\n", message.c_str()); } /* Translate string to current locale using Qt. */ static std::string Translate(const char* psz) { return QCoreApplication::translate("bitcoin-core", psz).toStdString(); } /* Handle runaway exceptions. Shows a message box with the problem and quits the program. */ static void <API key>(std::exception *e) { <API key>(e, "Runaway exception"); QMessageBox::critical(0, "Runaway exception", BitcoinGUI::tr("A fatal error occurred. Amerios can no longer continue safely and will quit.") + QString("\n\n") + QString::fromStdString(strMiscWarning)); exit(1); } #ifndef BITCOIN_QT_TEST int main(int argc, char *argv[]) { // Command-line options take precedence: ParseParameters(argc, argv); #if QT_VERSION < 0x050000 // Internal string conversion is all UTF-8 QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8")); QTextCodec::setCodecForCStrings(QTextCodec::codecForTr()); #endif Q_INIT_RESOURCE(bitcoin); QApplication app(argc, argv); // Register meta types used for QMetaObject::invokeMethod qRegisterMetaType< bool* >(); // Do this early as we don't want to bother initializing if we are just calling IPC // ... but do it after creating app, so QCoreApplication::arguments is initialized: if (PaymentServer::ipcSendCommandLine()) exit(0); PaymentServer* paymentServer = new PaymentServer(&app); // Install global event filter that makes sure that long tooltips can be word-wrapped app.installEventFilter(new GUIUtil::<API key>(<API key>, &app)); // ... then bitcoin.conf: if (!boost::filesystem::is_directory(GetDataDir(false))) { // This message can not be translated, as translation is not initialized yet // (which not yet possible because lang=XX can be overridden in bitcoin.conf in the data directory) QMessageBox::critical(0, "Amerios", QString("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(mapArgs["-datadir"]))); return 1; } ReadConfigFile(mapArgs, mapMultiArgs); // Application identification (must be set before OptionsModel is initialized, // as it is used to locate QSettings) QApplication::setOrganizationName("Amerios"); QApplication::<API key>("amerios.org"); if(GetBoolArg("-testnet")) // Separate UI settings for testnet QApplication::setApplicationName("Amerios-Qt-testnet"); else QApplication::setApplicationName("Amerios-Qt"); // ... then GUI settings: OptionsModel optionsModel; // Get desired locale (e.g. "de_DE") from command line or use system locale QString lang_territory = QString::fromStdString(GetArg("-lang", QLocale::system().name().toStdString())); QString lang = lang_territory; // Convert to "de" only by truncating "_DE" lang.truncate(lang_territory.lastIndexOf('_')); QTranslator qtTranslatorBase, qtTranslator, translatorBase, translator; // Load language files for configured locale: // - First load the translator for the base language, without territory // - Then load the more specific locale translator // Load e.g. qt_de.qm if (qtTranslatorBase.load("qt_" + lang, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) app.installTranslator(&qtTranslatorBase); // Load e.g. qt_de_DE.qm if (qtTranslator.load("qt_" + lang_territory, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) app.installTranslator(&qtTranslator); // Load e.g. bitcoin_de.qm (shortcut "de" needs to be defined in bitcoin.qrc) if (translatorBase.load(lang, ":/translations/")) app.installTranslator(&translatorBase); // Load e.g. bitcoin_de_DE.qm (shortcut "de_DE" needs to be defined in bitcoin.qrc) if (translator.load(lang_territory, ":/translations/")) app.installTranslator(&translator); // Subscribe to global signals from core uiInterface.<API key>.connect(<API key>); uiInterface.ThreadSafeAskFee.connect(ThreadSafeAskFee); uiInterface.InitMessage.connect(InitMessage); uiInterface.Translate.connect(Translate); // Show help message immediately after parsing command-line options (for "-lang") and setting locale, // but before showing splash screen. if (mapArgs.count("-?") || mapArgs.count("--help")) { GUIUtil::HelpMessageBox help; help.showOrPrint(); return 1; } #ifdef Q_OS_MAC // on mac, also change the icon now because it would look strange to have a testnet splash (green) and a std app icon (orange) if(GetBoolArg("-testnet")) { MacDockIconHandler::instance()->setIcon(QIcon(":icons/bitcoin_testnet")); } #endif SplashScreen splash(QPixmap(), 0); if (GetBoolArg("-splash", true) && !GetBoolArg("-min")) { splash.show(); splash.<API key>(true); splashref = &splash; } app.processEvents(); app.<API key>(false); try { #ifndef Q_OS_MAC // Regenerate startup link, to fix links to old versions // OSX: makes no sense on mac and might also scan/mount external (and sleeping) volumes (can take up some secs) if (GUIUtil::<API key>()) GUIUtil::<API key>(true); #endif boost::thread_group threadGroup; BitcoinGUI window; guiref = &window; QTimer* pollShutdownTimer = new QTimer(guiref); QObject::connect(pollShutdownTimer, SIGNAL(timeout()), guiref, SLOT(detectShutdown())); pollShutdownTimer->start(200); if(AppInit2(threadGroup)) { { // Put this in a block, so that the Model objects are cleaned up before // calling Shutdown(). optionsModel.Upgrade(); // Must be done after AppInit2 if (splashref) splash.finish(&window); ClientModel clientModel(&optionsModel); WalletModel *walletModel = 0; if(pwalletMain) walletModel = new WalletModel(pwalletMain, &optionsModel); window.setClientModel(&clientModel); if(walletModel) { window.addWallet("~Default", walletModel); window.setCurrentWallet("~Default"); } // If -min option passed, start window minimized. if(GetBoolArg("-min")) { window.showMinimized(); } else { window.show(); } // Now that initialization/startup is done, process any command-line // bitcoin: URIs QObject::connect(paymentServer, SIGNAL(receivedURI(QString)), &window, SLOT(handleURI(QString))); QTimer::singleShot(100, paymentServer, SLOT(uiReady())); app.exec(); window.hide(); window.setClientModel(0); window.removeAllWallets(); guiref = 0; delete walletModel; } // Shutdown the core and its threads, but don't exit Bitcoin-Qt here threadGroup.interrupt_all(); threadGroup.join_all(); Shutdown(); } else { threadGroup.interrupt_all(); threadGroup.join_all(); Shutdown(); return 1; } } catch (std::exception& e) { <API key>(&e); } catch (...) { <API key>(NULL); } return 0; } #endif // BITCOIN_QT_TEST
.letra-ciudad { color: #fff; font-weight: 100; cursor: pointer; font-family: 'Moonbeam' !important; font-size: 43px; padding-left: 15px; } .letra-placer { color: #fff; font-weight: 100; cursor: pointer; font-size: 44px; font-family: 'QaskinBlack'; } #cabecera_sup_buscar { text-align: center; } #header { z-index: 1000; } #cabecera .cabecera_sup { height: 50px; position: relative; background: linear-gradient(to bottom, #da0000, #a60000); }
#3.4 Chrome Dev Tools 1. Change in Colors ![Change in Colors](imgs/1-Colours.png "Colors") 2. Column ![Column](imgs/2-column.png "Column") 3. Row ![Row](imgs/3-row.png "Row") 4. Make Equidistant ![Equidistant](imgs/4-equidistant.png "Equidistant") 5. Squares ![Squares](imgs/5-squares.png "Square") 6. Footer ![Footer](imgs/6-footer.png "Footer") 7. Header ![Header](imgs/7-header.png "Header") 8. Sidebar ![Sidebar](imgs/8-sidebar.png "sidebar") 9. Get Creative ![Creative](imgs/9-creative.png "creative") * **Reflection** * **How can you use Chrome's DevTools inspector to help you format or position elements?** Chrome DevTools allows you to update the HTML and CSS on the fly with real time updates, meaning you can see the results instantly once the change has been made. You can play around with the values to position the elements on the page to see how it would appear on the page. * **How can you resize elements on the DOM using CSS?** You can resize the elements on the DOM by setting the property of width and height. You select any of the elements whether they are tags, classes, or ids. * **What are the differences between Absolute, Fixed, Static, and Relative Positioning? Which did you find easiest to use? Which was most difficult?** Absolute positioning is positioning of elements referenced to the parent node that the node being styled is contained in. Absolute positioning also is not affected and does not affect other elements in the same node, meaning other elements will either appear over top of or in behind the other elements that are in the same container. Fixed position is when elements are fixed to the viewport of the browser. When a user scrolls down the page the element remains in the view constantly. Again the elements that are fixed are not affected by the other elements on the page. Static position is the default position used by the browsers. Elements that are set to static flow in accordance to its position in the structure of the HTML tree. Relative positioning is the position of an element relative to where it would have been in the normal flow of elements. * **What are the differences between Margin, Border, and Padding?** The margin is the space between the outside of the element the margin is being applied to and the element that it is contained within. The border is the outer edge of the element, inside of the margin. The padding is the space between the border and the content contained within the element. * **What was your impression of this challenge overall? (love, hate, and why?)** My impression of this challenge was that it was pretty easy but good to know. Being able to make quick changes on the fly and seeing the results is much quicker than editing a file in the text editor, committing the changes, pushing them, going to the browser and refreshing the view. You are able to iterate over your ideas much quicker.
<?php namespace Tox\SatelliteBundle\Tests\Controller; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; class <API key> extends WebTestCase { }
#<API key> { margin-bottom: 20px; text-align: center; } #tag { margin-left: auto; margin-right: auto; } #inbox { margin-top: 20px; } #<API key> { margin-bottom: 20px; } #graphs-container { margin-bottom: 20px; } #selectors-container { text-align: center; margin-bottom: 20px; } #graph-container { text-align: center; }
package ir.abforce.dinorunner.custom; import com.makersf.andengine.extension.collisions.entity.sprite.PixelPerfectSprite; import com.makersf.andengine.extension.collisions.opengl.texture.region.<API key>; import ir.abforce.dinorunner.managers.RM; public class SPixelPerfectSprite extends PixelPerfectSprite { public SPixelPerfectSprite(float pX, float pY, <API key> pTextureRegion) { super(pX, pY, pTextureRegion, RM.VBO); setScale(RM.S); } }
SET DEFINE OFF; CREATE SEQUENCE <API key> START WITH 1 MAXVALUE <API key> MINVALUE 1 NOCYCLE CACHE 20 NOORDER /
// Castor : Logic Programming Library #ifndef CASTOR_PREDICATE_H #define CASTOR_PREDICATE_H 1 #include "relation.h" #include "helpers.h" #include "workaround.h" namespace castor { // predicate : Adaptor relation for treating predicate functions as relations template<typename Pred> struct Predicate0_r : public detail::TestOnlyRelation<Predicate0_r<Pred> > { Pred pred; Predicate0_r (const Pred& pred) : pred(pred) { } bool apply() { return pred(); } }; template<typename Pred, typename A1> struct Predicate1_r : public detail::TestOnlyRelation<Predicate1_r<Pred,A1> > { Pred pred; A1 a1; Predicate1_r (const Pred& pred, const A1& a1) : pred(pred), a1(a1) { } bool apply() { return pred(effective_value(a1)); } }; template<typename Pred, typename A1, typename A2> struct Predicate2_r : public detail::TestOnlyRelation<Predicate2_r<Pred,A1,A2> > { Pred pred; A1 a1; A2 a2; Predicate2_r (const Pred& pred, const A1& a1, const A2& a2) : pred(pred), a1(a1), a2(a2) { } bool apply() { return pred(effective_value(a1),effective_value(a2)); } }; template<typename Pred, typename A1, typename A2, typename A3> struct Predicate3_r : public detail::TestOnlyRelation<Predicate3_r<Pred,A1,A2,A3> > { Pred pred; A1 a1; A2 a2; A3 a3; Predicate3_r (const Pred& pred, const A1& a1, const A2& a2, const A3& a3) : pred(pred), a1(a1), a2(a2), a3(a3) { } bool apply() { return pred(effective_value(a1),effective_value(a2),effective_value(a3)); } }; template<typename Pred, typename A1, typename A2, typename A3, typename A4> struct Predicate4_r : public detail::TestOnlyRelation<Predicate4_r<Pred,A1,A2,A3,A4> > { Pred pred; A1 a1; A2 a2; A3 a3; A4 a4; Predicate4_r (const Pred& pred, const A1& a1, const A2& a2, const A3& a3, const A4& a4) : pred(pred), a1(a1), a2(a2), a3(a3), a4(a4) { } bool apply() { return pred(effective_value(a1),effective_value(a2),effective_value(a3),effective_value(a4)); } }; template<typename Pred, typename A1, typename A2, typename A3, typename A4, typename A5> struct Predicate5_r : public detail::TestOnlyRelation<Predicate5_r<Pred,A1,A2,A3,A4,A5> > { Pred pred; A1 a1; A2 a2; A3 a3; A4 a4; A5 a5; Predicate5_r (const Pred& pred, const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5) : pred(pred), a1(a1), a2(a2), a3(a3), a4(a4), a5(a5) { } bool apply() { return pred(effective_value(a1),effective_value(a2),effective_value(a3),effective_value(a4),effective_value(a5)); } }; template<typename Pred, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6> struct Predicate6_r : public detail::TestOnlyRelation<Predicate6_r<Pred,A1,A2,A3,A4,A5,A6> > { Pred pred; A1 a1; A2 a2; A3 a3; A4 a4; A5 a5; A6 a6; Predicate6_r (const Pred& pred, const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6) : pred(pred), a1(a1), a2(a2), a3(a3), a4(a4), a5(a5), a6(a6) { } bool apply() { return pred(effective_value(a1),effective_value(a2),effective_value(a3),effective_value(a4),effective_value(a5),effective_value(a6)); } }; // support for function objects template<typename Pred> inline Predicate0_r<Pred> predicate(Pred pred) { return Predicate0_r<Pred>(pred); } template<typename Pred, typename A1> inline Predicate1_r<Pred,A1> predicate(Pred pred, const A1& a1_) { return Predicate1_r<Pred,A1>(pred,a1_); } template<typename Pred, typename A1, typename A2> inline Predicate2_r<Pred,A1,A2> predicate(Pred pred, const A1& a1_, const A2& a2_) { return Predicate2_r<Pred,A1,A2>(pred,a1_,a2_); } template<typename Pred, typename A1, typename A2, typename A3> inline Predicate3_r<Pred,A1,A2,A3> predicate(Pred pred, const A1& a1_, const A2& a2_, const A3& a3_) { return Predicate3_r<Pred,A1,A2,A3>(pred,a1_,a2_,a3_); } template<typename Pred, typename A1, typename A2, typename A3, typename A4> inline Predicate4_r<Pred,A1,A2,A3,A4> predicate(Pred pred, const A1& a1_, const A2& a2_, const A3& a3_, const A4& a4_) { return Predicate4_r<Pred,A1,A2,A3,A4>(pred,a1_,a2_,a3_,a4_); } template<typename Pred, typename A1, typename A2, typename A3, typename A4 ,typename A5> inline Predicate5_r<Pred,A1,A2,A3,A4,A5> predicate(Pred pred, const A1& a1_, const A2& a2_, const A3& a3_, const A4& a4_, const A5& a5_) { return Predicate5_r<Pred,A1,A2,A3,A4,A5>(pred,a1_,a2_,a3_,a4_,a5_); } template<typename Pred, typename A1, typename A2, typename A3, typename A4 ,typename A5, typename A6> inline Predicate6_r<Pred,A1,A2,A3,A4,A5,A6> predicate(Pred pred, const A1& a1_, const A2& a2_, const A3& a3_, const A4& a4_, const A5& a5_, const A6& a6_) { return Predicate6_r<Pred,A1,A2,A3,A4,A5,A6>(pred,a1_,a2_,a3_,a4_,a5_,a6_); } // support for function pointers template<typename R> inline Predicate0_r<R(*)(void)> predicate(R(* pred)(void)) { return Predicate0_r<R(*)(void)>(pred); } template<typename R, typename P1, typename A1> inline Predicate1_r<R(*)(P1),A1> predicate(R(* pred)(P1), const A1& a1_) { return Predicate1_r<R(*)(P1),A1>(pred,a1_); } template<typename R, typename P1, typename P2, typename A1, typename A2> inline Predicate2_r<R(*)(P1,P2),A1,A2> predicate(R(* pred)(P1,P2), const A1& a1_, const A2& a2_) { return Predicate2_r<R(*)(P1,P2),A1,A2>(pred,a1_,a2_); } template<typename R, typename P1, typename P2, typename P3, typename A1, typename A2, typename A3> inline Predicate3_r<R(*)(P1,P2,P3),A1,A2,A3> predicate(R(* pred)(P1,P2,P3), const A1& a1_, const A2& a2_, const A3& a3_) { return Predicate3_r<R(*)(P1,P2,P3),A1,A2,A3>(pred,a1_,a2_,a3_); } template<typename R, typename P1, typename P2, typename P3, typename P4, typename A1, typename A2, typename A3, typename A4> inline Predicate4_r<R(*)(P1,P2,P3,P4),A1,A2,A3,A4> predicate(R(* pred)(P1,P2,P3,P4), const A1& a1_, const A2& a2_, const A3& a3_, const A4& a4_) { return Predicate4_r<R(*)(P1,P2,P3,P4),A1,A2,A3,A4>(pred,a1_,a2_,a3_,a4_); } template<typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename A1, typename A2, typename A3, typename A4, typename A5> inline Predicate5_r<R(*)(P1,P2,P3,P4,P5),A1,A2,A3,A4,A5> predicate(R(* pred)(P1,P2,P3,P4,P5), const A1& a1_, const A2& a2_, const A3& a3_, const A4& a4_, const A5& a5_) { return Predicate5_r<R(*)(P1,P2,P3,P4,P5),A1,A2,A3,A4,A5>(pred,a1_,a2_,a3_,a4_,a5_); } template<typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6> inline Predicate6_r<R(*)(P1,P2,P3,P4,P5,P6),A1,A2,A3,A4,A5,A6> predicate(R(* pred)(P1,P2,P3,P4,P5,P6), const A1& a1_, const A2& a2_, const A3& a3_, const A4& a4_, const A5& a5_, const A6& a6_) { return Predicate6_r<R(*)(P1,P2,P3,P4,P5,P6),A1,A2,A3,A4,A5,A6>(pred,a1_,a2_,a3_,a4_,a5_,a6_); } // predicate_mf : Adaptor relation for treating predicate methods as relations template<typename Obj, typename MemPred> class MemPredicate0_r : public detail::TestOnlyRelation<MemPredicate0_r<Obj,MemPred> > { lref<Obj> obj_; MemPred pred; public: MemPredicate0_r (lref<Obj> obj_, MemPred pred) : obj_(obj_), pred(pred) { } bool apply() { return ((*obj_).*pred)(); } }; template<typename Obj, typename MemPred, typename A1> class MemPredicate1_r : public detail::TestOnlyRelation<MemPredicate1_r<Obj,MemPred,A1> > { lref<Obj> obj_; MemPred pred; A1 arg1; public: MemPredicate1_r (lref<Obj> obj_, MemPred pred, const A1& arg1) : obj_(obj_), pred(pred), arg1(arg1) { } bool apply() { return ((*obj_).*pred)(effective_value(arg1)); } }; template<typename Obj, typename MemPred, typename A1, typename A2> class MemPredicate2_r : public detail::TestOnlyRelation<MemPredicate2_r<Obj,MemPred,A1,A2> > { lref<Obj> obj_; MemPred pred; A1 arg1; A2 arg2; public: MemPredicate2_r (lref<Obj> obj_, MemPred pred, const A1& arg1, const A2& arg2) : obj_(obj_), pred(pred), arg1(arg1), arg2(arg2) { } bool apply() { return ((*obj_).*pred)( effective_value(arg1), effective_value(arg2) ); } }; template<typename Obj, typename MemPred, typename A1, typename A2, typename A3> class MemPredicate3_r : public detail::TestOnlyRelation<MemPredicate3_r<Obj,MemPred,A1,A2,A3> > { lref<Obj> obj_; MemPred pred; A1 arg1; A2 arg2; A3 arg3; public: MemPredicate3_r (lref<Obj> obj_, MemPred pred, const A1& arg1, const A2& arg2, const A2& arg3) : obj_(obj_), pred(pred), arg1(arg1), arg2(arg2), arg3(arg3) { } bool apply() { return ((*obj_).*pred)(effective_value(arg1), effective_value(arg2), effective_value(arg3)); } }; template<typename Obj, typename MemPred, typename A1, typename A2, typename A3, typename A4> class MemPredicate4_r : public detail::TestOnlyRelation<MemPredicate4_r<Obj,MemPred,A1,A2,A3,A4> > { lref<Obj> obj_; MemPred pred; A1 arg1; A2 arg2; A3 arg3; A4 arg4; public: MemPredicate4_r (lref<Obj> obj_, MemPred pred, const A1& arg1, const A2& arg2, const A3& arg3, const A4& arg4) :obj_(obj_), pred(pred), arg1(arg1), arg2(arg2), arg3(arg3), arg4(arg4) { } bool apply() { return ((*obj_).*pred)(effective_value(arg1), effective_value(arg2), effective_value(arg3), effective_value(arg4) ); } }; template<typename Obj, typename MemPred, typename A1, typename A2, typename A3, typename A4, typename A5> class MemPredicate5_r : public detail::TestOnlyRelation<MemPredicate5_r<Obj,MemPred,A1,A2,A3,A4,A5> > { lref<Obj> obj_; MemPred pred; A1 arg1; A2 arg2; A3 arg3; A4 arg4; A5 arg5; public: MemPredicate5_r (lref<Obj> obj_, MemPred pred, const A1& arg1, const A2& arg2, const A3& arg3, const A4& arg4, const A5& arg5) : obj_(obj_), pred(pred), arg1(arg1), arg2(arg2), arg3(arg3), arg4(arg4), arg5(arg5) { } bool apply() { return ((*obj_).*pred)(effective_value(arg1), effective_value(arg2), effective_value(arg3), effective_value(arg4), effective_value(arg5) ); } }; template<typename Obj, typename MemPred, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6> class MemPredicate6_r : public detail::TestOnlyRelation<MemPredicate6_r<Obj,MemPred,A1,A2,A3,A4,A5,A6> > { lref<Obj> obj_; MemPred pred; A1 arg1; A2 arg2; A3 arg3; A4 arg4; A5 arg5; A6 arg6; public: MemPredicate6_r (const lref<Obj>& obj_, MemPred pred, const A1& arg1, const A2& arg2, const A3& arg3, const A4& arg4, const A5& arg5, const A6& arg6) : obj_(obj_), pred(pred), arg1(arg1), arg2(arg2), arg3(arg3), arg4(arg4), arg5(arg5), arg6(arg6) { } bool apply() { return ((*obj_).*pred)(effective_value(arg1), effective_value(arg2), effective_value(arg3), effective_value(arg4), effective_value(arg5), effective_value(arg6)); } }; template<typename R, typename Obj, typename Obj2> inline MemPredicate0_r<Obj,R(Obj::*)(void)> predicate_mf(lref<Obj>& obj_, R(Obj2::* mempred)(void) ) { return MemPredicate0_r<Obj,R(Obj::*)(void)>(obj_, mempred); } template<typename R, typename Obj, typename Obj2> inline MemPredicate0_r<Obj,R(Obj::*)(void) const> predicate_mf(lref<Obj>& obj_, R(Obj2::* mempred)(void) const) { return MemPredicate0_r<Obj,R(Obj::*)(void) const>(obj_, mempred); } template<typename R, typename P1, typename Obj, typename Obj2, typename A1> inline MemPredicate1_r<Obj,R(Obj::*)(P1),A1> predicate_mf(lref<Obj>& obj_, R(Obj2::* mempred)(P1), const A1& arg1) { return MemPredicate1_r<Obj,R(Obj::*)(P1),A1>(obj_, mempred, arg1); } template<typename R, typename P1, typename Obj, typename Obj2, typename A1> inline MemPredicate1_r<Obj,R(Obj::*)(P1) const,A1> predicate_mf(lref<Obj>& obj_, R(Obj2::* mempred)(P1) const, const A1& arg1) { return MemPredicate1_r<Obj,R(Obj::*)(P1) const,A1>(obj_, mempred, arg1); } template<typename R, typename P1, typename P2, typename Obj, typename Obj2, typename A1, typename A2> inline MemPredicate2_r<Obj,R(Obj::*)(P1,P2),A1,A2> predicate_mf(lref<Obj>& obj_, R(Obj2::* mempred)(P1,P2), const A1& arg1, const A2& arg2) { return MemPredicate2_r<Obj,R(Obj::*)(P1,P2),A1,A2>(obj_, mempred, arg1, arg2); } template<typename R, typename P1, typename P2, typename Obj, typename Obj2, typename A1, typename A2> inline MemPredicate2_r<Obj,R(Obj::*)(P1,P2) const,A1,A2> predicate_mf(lref<Obj>& obj_, R(Obj2::* mempred)(P1,P2) const, const A1& arg1, const A2& arg2) { return MemPredicate2_r<Obj,R(Obj::*)(P1,P2) const,A1,A2>(obj_, mempred, arg1, arg2); } template<typename R, typename P1, typename P2, typename P3, typename Obj, typename Obj2, typename A1, typename A2, typename A3> inline MemPredicate3_r<Obj,R(Obj::*)(P1,P2,P3),A1,A2,A3> predicate_mf(lref<Obj>& obj_, R(Obj2::* mempred)(P1,P2,P3), const A1& arg1, const A2& arg2, const A3& arg3) { return MemPredicate3_r<Obj,R(Obj::*)(P1,P2,P3),A1,A2,A3>(obj_, mempred, arg1, arg2, arg3); } template<typename R, typename P1, typename P2, typename P3, typename Obj, typename Obj2, typename A1, typename A2, typename A3> inline MemPredicate3_r<Obj,R(Obj::*)(P1,P2,P3) const,A1,A2,A3> predicate_mf(lref<Obj>& obj_, R(Obj2::* mempred)(P1,P2,P3) const, const A1& arg1, const A2& arg2, const A3& arg3) { return MemPredicate3_r<Obj,R(Obj::*)(P1,P2,P3) const,A1,A2,A3>(obj_, mempred, arg1, arg2, arg3); } template<typename R, typename P1, typename P2, typename P3, typename P4, typename Obj, typename Obj2, typename A1, typename A2, typename A3, typename A4> inline MemPredicate4_r<Obj,R(Obj::*)(P1,P2,P3,P4),A1,A2,A3,A4> predicate_mf(lref<Obj>& obj_, R(Obj2::* mempred)(P1,P2,P3,P4), const A1& arg1, const A2& arg2, const A3& arg3, const A4& arg4) { return MemPredicate4_r<Obj,R(Obj::*)(P1,P2,P3,P4),A1,A2,A3,A4>(obj_, mempred, arg1, arg2, arg3, arg4); } template<typename R, typename P1, typename P2, typename P3, typename P4, typename Obj, typename Obj2, typename A1, typename A2, typename A3, typename A4> inline MemPredicate4_r<Obj,R(Obj::*)(P1,P2,P3,P4) const,A1,A2,A3,A4> predicate_mf(lref<Obj>& obj_, R(Obj2::* mempred)(P1,P2,P3,P4) const, const A1& arg1, const A2& arg2, const A3& arg3, const A4& arg4) { return MemPredicate4_r<Obj,R(Obj::*)(P1,P2,P3,P4) const,A1,A2,A3,A4>(obj_, mempred, arg1, arg2, arg3, arg4); } template<typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename Obj, typename Obj2, typename A1, typename A2, typename A3, typename A4, typename A5> inline MemPredicate5_r<Obj,R(Obj::*)(P1,P2,P3,P4,P5),A1,A2,A3,A4,A5> predicate_mf(lref<Obj>& obj_, R(Obj2::* mempred)(P1,P2,P3,P4,P5), const A1& arg1, const A2& arg2, const A3& arg3, const A4& arg4, const A5& arg5) { return MemPredicate5_r<Obj,R(Obj::*)(P1,P2,P3,P4,P5),A1,A2,A3,A4,A5>(obj_, mempred, arg1, arg2, arg3, arg4, arg5); } template<typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename Obj, typename Obj2, typename A1, typename A2, typename A3, typename A4, typename A5> inline MemPredicate5_r<Obj,R(Obj::*)(P1,P2,P3,P4,P5) const,A1,A2,A3,A4,A5> predicate_mf(lref<Obj>& obj_, R(Obj2::* mempred)(P1,P2,P3,P4,P5) const, const A1& arg1, const A2& arg2, const A3& arg3, const A4& arg4, const A5& arg5) { return MemPredicate5_r<Obj,R(Obj::*)(P1,P2,P3,P4,P5) const,A1,A2,A3,A4,A5>(obj_, mempred, arg1, arg2, arg3, arg4, arg5); } template<typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename Obj, typename Obj2, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6> inline MemPredicate6_r<Obj,R(Obj::*)(P1,P2,P3,P4,P5,P6),A1,A2,A3,A4,A5,A6> predicate_mf(lref<Obj>& obj_, R(Obj2::* mempred)(P1,P2,P3,P4,P5,P6), const A1& arg1, const A2& arg2, const A3& arg3, const A4& arg4, const A5& arg5, const A6& arg6) { return MemPredicate6_r<Obj,R(Obj::*)(P1,P2,P3,P4,P5,P6),A1,A2,A3,A4,A5,A6>(obj_, mempred, arg1, arg2, arg3, arg4, arg5, arg6); } template<typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename Obj, typename Obj2, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6> inline MemPredicate6_r<Obj,R(Obj::*)(P1,P2,P3,P4,P5,P6) const,A1,A2,A3,A4,A5,A6> predicate_mf(lref<Obj>& obj_, R(Obj2::* mempred)(P1,P2,P3,P4,P5,P6) const, const A1& arg1, const A2& arg2, const A3& arg3, const A4& arg4, const A5& arg5, const A6& arg6) { return MemPredicate6_r<Obj,R(Obj::*)(P1,P2,P3,P4,P5,P6) const,A1,A2,A3,A4,A5,A6>(obj_, mempred, arg1, arg2, arg3, arg4, arg5, arg6); } // predicate_mem : Unify with a member variable template<typename Obj, typename MemberT> class Predicate_mem_r : public detail::TestOnlyRelation<Predicate_mem_r<Obj,MemberT> > { lref<Obj> obj_; MemberT Obj::* mem; public: Predicate_mem_r(const lref<Obj>& obj_, MemberT Obj::* mem) : obj_(obj_), mem(mem) { } bool apply() { return (*obj_).*mem; } }; template<typename Obj, typename Obj2, typename MemberT> inline Predicate_mem_r<Obj, MemberT> predicate_mem(lref<Obj>& obj_, MemberT Obj2::* mem) { return Predicate_mem_r<Obj, MemberT>(obj_, mem); } } // namespace castor #endif
'use strict'; exports.connect = function () { var mongoose = require('mongoose'), config = require('../config'), options = { user : config.mongo.user, pass : config.mongo.pass }; mongoose.connect(config.db, options); return mongoose.connection; };
# encoding: utf-8 # <API key>: true require 'spec_helper' describe RuboCop::Cop::Style::ElseAlignment do subject(:cop) { described_class.new(config) } let(:config) do RuboCop::Config.new('Lint/EndAlignment' => <API key>) end let(:<API key>) do { 'Enabled' => true, 'AlignWith' => 'variable' } end it 'accepts a ternary if' do inspect_source(cop, 'cond ? func1 : func2') expect(cop.offenses).to be_empty end context 'with if statement' do it 'registers an offense for misaligned else' do inspect_source(cop, ['if cond', ' func1', ' else', ' func2', 'end']) expect(cop.messages).to eq(['Align `else` with `if`.']) expect(cop.highlights).to eq(['else']) end it 'registers an offense for misaligned elsif' do inspect_source(cop, [' if a1', ' b1', 'elsif a2', ' b2', ' end']) expect(cop.messages).to eq(['Align `elsif` with `if`.']) expect(cop.highlights).to eq(['elsif']) end it 'accepts indentation after else when if is on new line after ' \ 'assignment' do inspect_source(cop, ['Rails.application.config.ideal_postcodes_key =', ' if Rails.env.production? || Rails.env.staging?', ' "AAAA-AAAA-AAAA-AAAA"', ' else', ' "BBBB-BBBB-BBBB-BBBB"', ' end']) expect(cop.offenses).to be_empty end describe '#autocorrect' do it 'corrects bad alignment' do corrected = autocorrect_source(cop, [' if a1', ' b1', ' elsif a2', ' b2', 'else', ' c', ' end']) expect(cop.messages).to eq(['Align `elsif` with `if`.', 'Align `else` with `if`.']) expect(corrected) .to eq [' if a1', ' b1', ' elsif a2', ' b2', ' else', ' c', ' end'].join("\n") end end it 'accepts a one line if statement' do inspect_source(cop, 'if cond then func1 else func2 end') expect(cop.offenses).to be_empty end it 'accepts a correctly aligned if/elsif/else/end' do inspect_source(cop, ['if a1', ' b1', 'elsif a2', ' b2', 'else', ' c', 'end']) expect(cop.offenses).to be_empty end context 'with assignment' do context 'when alignment style is variable' do context 'and end is aligned with variable' do it 'accepts an if-else with end aligned with setter' do inspect_source(cop, ['foo.bar = if baz', ' derp1', 'else', ' derp2', 'end']) expect(cop.offenses).to be_empty end it 'accepts an if-elsif-else with end aligned with setter' do inspect_source(cop, ['foo.bar = if baz', ' derp1', 'elsif meh', ' derp2', 'else', ' derp3', 'end']) expect(cop.offenses).to be_empty end it 'accepts an if with end aligned with element assignment' do inspect_source(cop, ['foo[bar] = if baz', ' derp', 'end']) expect(cop.offenses).to be_empty end it 'accepts an if/else' do inspect_source(cop, ['var = if a', ' 0', 'else', ' 1', 'end']) expect(cop.offenses).to be_empty end it 'accepts an if/else with chaining after the end' do inspect_source(cop, ['var = if a', ' 0', 'else', ' 1', 'end.abc.join("")']) expect(cop.offenses).to be_empty end it 'accepts an if/else with chaining with a block after the end' do inspect_source(cop, ['var = if a', ' 0', 'else', ' 1', 'end.abc.tap {}']) expect(cop.offenses).to be_empty end end context 'and end is aligned with keyword' do it 'registers offenses for an if with setter' do inspect_source(cop, ['foo.bar = if baz', ' derp1', ' elsif meh', ' derp2', ' else', ' derp3', ' end']) expect(cop.messages).to eq(['Align `elsif` with `foo.bar`.', 'Align `else` with `foo.bar`.']) end it 'registers an offense for an if with element assignment' do inspect_source(cop, ['foo[bar] = if baz', ' derp1', ' else', ' derp2', ' end']) expect(cop.messages).to eq(['Align `else` with `foo[bar]`.']) end it 'registers an offense for an if' do inspect_source(cop, ['var = if a', ' 0', ' else', ' 1', ' end']) expect(cop.messages).to eq(['Align `else` with `var`.']) end end end shared_examples 'assignment and if with keyword alignment' do context 'and end is aligned with variable' do it 'registers an offense for an if' do inspect_source(cop, ['var = if a', ' 0', 'elsif b', ' 1', 'end']) expect(cop.messages).to eq(['Align `elsif` with `if`.']) end it 'autocorrects bad alignment' do corrected = autocorrect_source(cop, ['var = if a', ' b1', 'else', ' b2', 'end']) expect(corrected).to eq ['var = if a', ' b1', ' else', ' b2', 'end'].join("\n") end end context 'and end is aligned with keyword' do it 'accepts an if in assignment' do inspect_source(cop, ['var = if a', ' 0', ' end']) expect(cop.offenses).to be_empty end it 'accepts an if/else in assignment' do inspect_source(cop, ['var = if a', ' 0', ' else', ' 1', ' end']) expect(cop.offenses).to be_empty end it 'accepts an if/else in assignment on next line' do inspect_source(cop, ['var =', ' if a', ' 0', ' else', ' 1', ' end']) expect(cop.offenses).to be_empty end it 'accepts a while in assignment' do inspect_source(cop, ['var = while a', ' b', ' end']) expect(cop.offenses).to be_empty end it 'accepts an until in assignment' do inspect_source(cop, ['var = until a', ' b', ' end']) expect(cop.offenses).to be_empty end end end context 'when alignment style is keyword by choice' do let(:<API key>) do { 'Enabled' => true, 'AlignWith' => 'keyword' } end include_examples 'assignment and if with keyword alignment' end context 'when alignment style is keyword by default' do let(:<API key>) do { 'Enabled' => false, 'AlignWith' => 'variable' } end include_examples 'assignment and if with keyword alignment' end end it 'accepts an if/else branches with rescue clauses' do # Because of how the rescue clauses come out of Parser, these are # special and need to be tested. inspect_source(cop, ['if a', ' a rescue nil', 'else', ' a rescue nil', 'end']) expect(cop.offenses).to be_empty end end context 'with unless' do it 'registers an offense for misaligned else' do inspect_source(cop, ['unless cond', ' func1', ' else', ' func2', 'end']) expect(cop.messages).to eq(['Align `else` with `unless`.']) end it 'accepts a correctly aligned else in an otherwise empty unless' do inspect_source(cop, ['unless a', 'else', 'end']) expect(cop.offenses).to be_empty end it 'accepts an empty unless' do inspect_source(cop, ['unless a', 'end']) expect(cop.offenses).to be_empty end end context 'with case' do it 'registers an offense for misaligned else' do inspect_source(cop, ['case a', 'when b', ' c', 'when d', ' e', ' else', ' f', 'end']) expect(cop.messages).to eq(['Align `else` with `when`.']) end it 'accepts correctly aligned case/when/else' do inspect_source(cop, ['case a', 'when b', ' c', ' c', 'when d', 'else', ' f', 'end']) expect(cop.offenses).to be_empty end it 'accepts case without else' do inspect_source(cop, ['case superclass', 'when /\A(#{NAMESPACEMATCH})(?:\s|\Z)/', ' $1', 'when "self"', ' namespace.path', 'end']) expect(cop.offenses).to be_empty end it 'accepts else aligned with when but not with case' do # "Indent when as deep as case" is the job of another cop, and this is # one of the possible styles supported by configuration. inspect_source(cop, ['case code_type', " when 'ruby', 'sql', 'plain'", ' code_type', " when 'erb'", " 'ruby; html-script: true'", ' when "html"', " 'xml'", ' else', " 'plain'", 'end']) expect(cop.offenses).to be_empty end end context 'with def/defs' do it 'accepts an empty def body' do inspect_source(cop, ['def test', 'end']) expect(cop.offenses).to be_empty end it 'accepts an empty defs body' do inspect_source(cop, ['def self.test', 'end']) expect(cop.offenses).to be_empty end if RUBY_VERSION >= '2.1' context 'when modifier and def are on the same line' do it 'accepts a correctly aligned body' do inspect_source(cop, ['private def test', ' something', 'rescue', ' handling', 'else', ' something_else', 'end']) expect(cop.offenses).to be_empty end it 'registers an offense for else not aligned with private' do inspect_source(cop, ['private def test', ' something', ' rescue', ' handling', ' else', ' something_else', ' end']) expect(cop.messages).to eq(['Align `else` with `private`.']) end end end end context 'with begin/rescue/else/ensure/end' do it 'registers an offense for misaligned else' do inspect_source(cop, ['def my_func', " puts 'do something outside block'", ' begin', " puts 'do something error prone'", ' rescue SomeException, SomeOther => e', " puts 'wrongly intended error handling'", ' rescue', " puts 'wrongly intended error handling'", 'else', " puts 'wrongly intended normal case handling'", ' ensure', " puts 'wrongly intended common handling'", ' end', 'end']) expect(cop.messages).to eq(['Align `else` with `begin`.']) end it 'accepts a correctly aligned else' do inspect_source(cop, ['begin', " raise StandardError.new('Fail') if rand(2).odd?", 'rescue StandardError => error', ' $stderr.puts error.message', 'else', " $stdout.puts 'Lucky you!'", 'end']) expect(cop.offenses).to be_empty end end context 'with def/rescue/else/ensure/end' do it 'accepts a correctly aligned else' do inspect_source(cop, ['def my_func(string)', ' puts string', 'rescue => e', ' puts e', 'else', ' puts e', 'ensure', " puts 'I love methods that print'", 'end']) expect(cop.offenses).to be_empty end it 'registers an offense for misaligned else' do inspect_source(cop, ['def my_func(string)', ' puts string', 'rescue => e', ' puts e', ' else', ' puts e', 'ensure', " puts 'I love methods that print'", 'end']) expect(cop.messages).to eq(['Align `else` with `def`.']) end end context 'with def/rescue/else/end' do it 'accepts a correctly aligned else' do inspect_source(cop, ['def my_func', " puts 'do something error prone'", 'rescue SomeException', " puts 'error handling'", 'rescue', " puts 'error handling'", 'else', " puts 'normal handling'", 'end']) expect(cop.messages).to be_empty end it 'registers an offense for misaligned else' do inspect_source(cop, ['def my_func', " puts 'do something error prone'", 'rescue SomeException', " puts 'error handling'", 'rescue', " puts 'error handling'", ' else', " puts 'normal handling'", 'end']) expect(cop.messages).to eq(['Align `else` with `def`.']) end end end
// CollectionViewCell.h // Timetable #import <UIKit/UIKit.h> //CollectionView @interface CollectionViewCell : <API key> @property (nonatomic, copy) NSString *cellName; @property (nonatomic, copy) NSString *place; @property (nonatomic, assign) NSInteger signNumber; @end
class TripsController < <API key> before_action :set_trip, only: [:show, :update, :destroy, :edit] def index if current_user @created_trips = current_user.created_trips @joined_trips = current_user.trips else @trips = Trip.order(:start_at).limit(25) end end def new @trip = Trip.new end def create @trip = Trip.new(trip_params) @trip.user_id = current_user.id if @trip.save redirect_to @trip else redirect_to '/' end end def show #For Mapbox @coord = [[@trip.destination.lat, @trip.destination.lng], [@trip.origin.lat, @trip.origin.lng]] respond_to do |format| format.html format.json { render json: @coord } end end private def set_trip @trip = Trip.find(params[:id]) end def trip_params params.require(:trip).permit(:origin_id, :destination_id, :start_at, :end_at) end end
module RedditKit class Client # Methods for searching reddit's links. module Search # Search for links. # @param query [String] The search query. # @option options [String, RedditKit::Subreddit] subreddit The optional subreddit to search. # @option options [true, false] <API key> Whether to search only in a specified subreddit. # @option options [1..100] limit The number of links to return. # @option options [String] count The number of results to return before or after. This is different from `limit`. # @option options [relevance, new, hot, top, comments] sort The sorting order for search results. # @option options [String] before Only return links before this full name. # @option options [String] after Only return links after this full name. # @option options [hour, day, week, month, year, all] time Show results with a specific time period. # @return [RedditKit::PaginatedResponse] def search(query, options = {}) path = "%s/search.json" % ('r/' + options[:subreddit] if options[:subreddit]) parameters = { :q => query, :restrict_sr => options[:<API key>], :limit => options[:limit], :count => options[:count], :sort => options[:sort], :before => options[:before], :after => options[:after], :syntax => options[:syntax], :t => options[:time] } <API key>(:get, path, parameters) end end end end
//APP var app = angular.module('PortfolioApp', ['ngRoute', 'slick']); //ROUTING app.config(function ($routeProvider) { "ngInject"; $routeProvider .when('/', { controller: "HomeController", templateUrl: "js/angular/views/home-view.html" }) .when('/work/:projectId', { controller: 'ProjectController', templateUrl: 'js/angular/views/project-view.html' }) .otherwise({ redirectTo: '/' }); }); //CONTROLLERS app.controller('HomeController', ['$scope', 'projects', function($scope, projects) { "ngInject"; projects.success(function(data) { $scope.projects = data; }); //init function for binding function bindListeners() { $("header").on("click", ".mobile-toggle", function() { $(this).toggleClass("active"); }) $("header, .about").on("click", ".nav-link", function(e) { e.preventDefault(); e.<API key>(); if($(window).width() <= 740) $(".mobile-toggle").removeClass("active"); var anchor = $(this).attr("href"); $('html, body').animate({ scrollTop: $(anchor).offset().top - 70 }, 500); }) } //Home page initializations angular.element(document).ready(function () { bindListeners(); }); }]); app.controller('ProjectController', ['$scope', '$routeParams', '$http', function($scope, $routeParams, $http, $sce) { "ngInject"; $scope.video = false; $http.get('projects/' + $routeParams.projectId + '.json').success(function(data) { $scope.detail = data; }) .error(function(data) { console.log("Failed to get data") }); } ]); //SERVICES app.factory('projects', ['$http', function($http) { "ngInject"; return $http.get('projects/project-list.json') .success(function(data) { return data; }) .error(function(data) { return data; console.log("Failed to get data") }); }]); //FILTERS app.filter('safe', function($sce) { "ngInject"; return function(val) { return $sce.trustAsHtml(val); }; });
// of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // copies or substantial portions of the Software. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. using System; using System.Threading; namespace Unicorn { public static class Cancellation<API key> { public static void CancelAndDispose(this <API key> <API key>) { if (<API key> == null) { return; } try { <API key>.Cancel(); <API key>.Dispose(); } catch (<API key>) { } catch (AggregateException) { } } } }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content="Creative One Page Parallax Template"> <meta name="keywords" content="Creative, Onepage, Parallax, HTML5, Bootstrap, Popular, custom, personal, portfolio" /> <meta name="author" content=""> <title>Sistem Monitoring KP - Sisfor ITS</title> <link href="<?php echo base_url().'/asset_umum/css/bootstrap.min.css';?>" rel="stylesheet"> <link href="<?php echo base_url().'/asset_umum/css/prettyPhoto.css';?>" rel="stylesheet"> <link href="<?php echo base_url().'/asset_umum/css/font-awesome.min.css';?>" rel="stylesheet"> <link href="<?php echo base_url().'/asset_umum/css/animate.css';?>" rel="stylesheet"> <link href="<?php echo base_url().'/asset_umum/css/main.css';?>" rel="stylesheet"> <link href="<?php echo base_url().'/asset_umum/css/responsive.css';?>" rel="stylesheet"> <!--[if lt IE 9]> <script src="js/html5shiv.js"></script> <script src="js/respond.min.js"></script> <![endif] <link rel="shortcut icon" href="images/ico/favicon.png"> <link rel="<API key>" sizes="144x144" href="<?php echo base_url().'/asset_umum/images/ico/<API key>.png';?>"> <link rel="<API key>" sizes="114x114" href="<?php echo base_url().'/asset_umum/images/ico/<API key>.png';?>"> <link rel="<API key>" sizes="72x72" href="<?php echo base_url().'/asset_umum/images/ico/<API key>.png';?>"> <link rel="<API key>" href="<?php echo base_url().'/asset_umum/images/ico/<API key>.png';?>"> </head><!--/head--> <body> <div class="preloader"> <div class="preloder-wrap"> <div class="preloder-inner"> <div class="ball"></div> <div class="ball"></div> <div class="ball"></div> <div class="ball"></div> <div class="ball"></div> <div class="ball"></div> <div class="ball"></div> </div> </div> </div><!--/.preloader--> <header id="navigation"> <div class="navbar navbar-inverse navbar-fixed-top" role="banner"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="#navigation"><h1><img src="<?php echo base_url().'/asset_umum/images/logo1.png';?>" alt="logo"></h1></a> </div> <div class="collapse navbar-collapse"> <ul class="nav navbar-nav navbar-right"> <li class="scroll active"><a href="#navigation">Home</a></li> <li class="scroll"><a href="<?php echo base_url('index.php/c_user/lapor');?>">Laporan</a></li> <li class="scroll"><a href="#history">History</a></li> <li class="scroll"><a href="#contact">Contact</a></li> <li class="scroll"><a href="<?php echo base_url('index.php/c_user/logout');?>">Logout</a></li> </ul> </div> </div> </div><!--/navbar--> </header> <!--/#navigation--> <section id="home"> <div class="home-pattern"></div> <div id="main-carousel" class="carousel slide" data-ride="carousel"> <ol class="carousel-indicators"> <li data-target="#main-carousel" data-slide-to="0" class="active"></li> <li data-target="#main-carousel" data-slide-to="1"></li> <li data-target="#main-carousel" data-slide-to="2"></li> </ol><!--/.carousel-indicators--> <div class="carousel-inner"> <div class="item active" style="background-image: url(<?php echo base_url().'/asset_umum/images/slider/s1.jpg';?>)"> <div class="carousel-caption"> <div> <h2 class="heading animated bounceInDown">Institut Teknologi Sepuluh Nopember</h2> <p class="animated bounceInUp">Information Systems Department</p> </div> </div> </div> <div class="item" style="background-image: url(<?php echo base_url().'asset_umum/images/slider/s2.jpg';?>)"> <div class="carousel-caption"> <div> <h2 class="heading animated bounceInDown"><span>Sistem Monitoring KP</span></h2> <p class="animated bounceInUp">Sistem terintegrasi untuk mahasiswa Sistem Informasi</p> </div> </div> </div> <div class="item" style="background-image: url(<?php echo base_url().'asset_umum/images/slider/s3.jpg';?>)"> <div class="carousel-caption"> <div> <h2 class="heading animated bounceInRight">Create and Submit!</h2> <p class="animated bounceInLeft">Mudah dan praktis digunakan</p> <a class="btn btn-default slider-btn animated bounceInUp" href="<?php echo base_url('index.php/c_user/logout');?>">Get Started</a> </div> </div> </div> </div><!--/.carousel-inner--> <a class="carousel-left <API key> hidden-xs" href="#main-carousel" data-slide="prev"><i class="fa fa-angle-left"></i></a> <a class="carousel-right <API key> hidden-xs" href="#main-carousel" data-slide="next"><i class="fa fa-angle-right"></i></a> </div> </section><!--/#home--> <section id="history"> <div class="container"> <div class="row text-center clearfix"> <div class="col-sm-8 col-sm-offset-2"> <h2 class="title-one">History</h2> <p class="blog-heading">Historis pengumpulan laporan KP</p> </div> </div> <div class="row"> <div class="col-sm-4"> <div class="single-blog"> <img src="images/blog/1.jpg" alt="" /> <h2>Lorem ipsum dolor sit amet</h2> <ul class="post-meta"> <li><i class="fa fa-pencil-square-o"></i><strong> Posted By:</strong> John</li> <li><i class="fa fa-clock-o"></i><strong> Posted On:</strong> Apr 15 2014</li> </ul> <div class="blog-content"> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p> </div> <a href="" class="btn btn-primary" data-toggle="modal" data-target="#blog-detail">Read More</a> </div> <div class="modal fade" id="blog-detail" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-body"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <img src="images/blog/3.jpg" alt="" /> <h2>Lorem ipsum dolor sit amet</h2> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p> </div> </div> </div> </div> </div> <div class="col-sm-4"> <div class="single-blog"> <img src="images/blog/2.jpg" alt="" /> <h2>Lorem ipsum dolor sit amet</h2> <ul class="post-meta"> <li><i class="fa fa-pencil-square-o"></i><strong> Posted By:</strong> John</li> <li><i class="fa fa-clock-o"></i><strong> Posted On:</strong> Apr 15 2014</li> </ul> <div class="blog-content"> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p> </div> <a href="" class="btn btn-primary" data-toggle="modal" data-target="#blog-two">Read More</a> </div> <div class="modal fade" id="blog-two" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-body"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <img src="images/blog/2.jpg" alt="" /> <h2>Lorem ipsum dolor sit amet</h2> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p> </div> </div> </div> </div> </div> <div class="col-sm-4"> <div class="single-blog"> <img src="images/blog/3.jpg" alt="" /> <h2>Lorem ipsum dolor sit amet</h2> <ul class="post-meta"> <li><i class="fa fa-pencil-square-o"></i><strong> Posted By:</strong> John</li> <li><i class="fa fa-clock-o"></i><strong> Posted On:</strong> Apr 15 2014</li> </ul> <div class="blog-content"> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p> </div> <a href="" class="btn btn-primary" data-toggle="modal" data-target="#blog-three">Read More</a> </div> <div class="modal fade" id="blog-three" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-body"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <img src="images/blog/3.jpg" alt="" /> <h2>Lorem ipsum dolor sit amet</h2> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p> </div> </div> </div> </div> </div> <div class="col-sm-4"> <div class="single-blog"> <img src="images/blog/3.jpg" alt="" /> <h2>Lorem ipsum dolor sit amet</h2> <ul class="post-meta"> <li><i class="fa fa-pencil-square-o"></i><strong> Posted By:</strong> John</li> <li><i class="fa fa-clock-o"></i><strong> Posted On:</strong> Apr 15 2014</li> </ul> <div class="blog-content"> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p> </div> <a href="" class="btn btn-primary" data-toggle="modal" data-target="#blog-four">Read More</a></div> <div class="modal fade" id="blog-four" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-body"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <img src="images/blog/3.jpg" alt="" /> <h2>Lorem ipsum dolor sit amet</h2> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p> </div> </div> </div> </div> </div> <div class="col-sm-4"> <div class="single-blog"> <img src="images/blog/2.jpg" alt="" /> <h2>Lorem ipsum dolor sit amet</h2> <ul class="post-meta"> <li><i class="fa fa-pencil-square-o"></i><strong> Posted By:</strong> John</li> <li><i class="fa fa-clock-o"></i><strong> Posted On:</strong> Apr 15 2014</li> </ul> <div class="blog-content"> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p> </div> <a href="" class="btn btn-primary" data-toggle="modal" data-target="#blog-six">Read More</a> </div> <div class="modal fade" id="blog-six" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-body"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <img src="images/blog/2.jpg" alt="" /> <h2>Lorem ipsum dolor sit amet</h2> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p> </div> </div> </div> </div> </div> <div class="col-sm-4"> <div class="single-blog"> <img src="images/blog/1.jpg" alt="" /> <h2>Lorem ipsum dolor sit amet</h2> <ul class="post-meta"> <li><i class="fa fa-pencil-square-o"></i><strong> Posted By:</strong> John</li> <li><i class="fa fa-clock-o"></i><strong> Posted On:</strong> Apr 15 2014</li> </ul> <div class="blog-content"> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p> </div> <a href="" class="btn btn-primary" data-toggle="modal" data-target="#blog-seven">Read More</a> </div> <div class="modal fade" id="blog-seven" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-body"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <img src="images/blog/1.jpg" alt="" /> <h2>Lorem ipsum dolor sit amet</h2> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p> </div> </div> </div> </div> </div> </div> </div> </section> <!--/#blog--> <section id="contact"> <div class="container"> <div class="row text-center clearfix"> <div class="col-sm-8 col-sm-offset-2"> <div class="contact-heading"> <h2 class="title-one">Contact With Us</h2> <p></p> </div> </div> </div> </div> <div class="container"> <div class="contact-details"> <div class="pattern"></div> <div class="row text-center clearfix"> <div class="col-sm-6"> <div class="contact-address"> <address><p><span>Departemen </span>Sistem Informasi</p><strong> Sekretariat <br> Lt. 2 Gd. Lama FTIf ITS <br> Institut Teknologi Sepuluh Nopember, Sukolilo <br> Surabaya, 60111 <br> Indonesia <br> Phone: +62 31 5999944 <br> </strong> </address> </div> </div> <div class="col-sm-6"> <div id="contact-details"> <div class="status alert alert-success" style="display: none"></div> <div class="contact-address"><address><p>Sisfor <span>KP</span></p><strong>Jam Buka : 08.00-16.00<br> +62 31 5999944</strong><br></address> <div class="social-icons"> <a href="https://ms-my.facebook.com/pages/<API key>/149235835122966" class="facebook external" data-animate-hover="shake"><i class="fa fa-facebook"></i></a> <a href="https: <a href="https://mail.google.com/mail/?view=cm&fs=1&tf=1&to=jurusan@is.its.ac.id&su=Hello&shva=1" class="email external" data-animate-hover="shake"><i class="fa fa-envelope"></i></a> </div> </div> </div> </div> </div> </div> </div> </section> <!--/#contact--> <footer id="footer"> <div class="container"> <div class="text-center"> <p>Copyright &copy; 2017 - <a href="http://is.its.ac.id/">Information System Department</a> | ITS </p> </div> </div> </footer> <!--/#footer--> <script type="text/javascript" src="<?php echo base_url().'/asset_umum/js/jquery.js';?>"></script> <script type="text/javascript" src="<?php echo base_url().'/asset_umum/js/bootstrap.min.js';?>"></script> <script type="text/javascript" src="<?php echo base_url().'/asset_umum/js/smoothscroll.js';?>"></script> <script type="text/javascript" src="<?php echo base_url().'/asset_umum/js/jquery.isotope.min.js';?>"></script> <script type="text/javascript" src="<?php echo base_url().'/asset_umum/js/jquery.prettyPhoto.js';?>"></script> <script type="text/javascript" src="<?php echo base_url().'/asset_umum/js/jquery.parallax.js';?>"></script> <script type="text/javascript" src="<?php echo base_url().'/asset_umum/js/main.js';?>"></script> </body> </html>
let original: (fn: <API key>) => number; let requesters: any[] = []; function fakeRaf(fn: <API key>): number { requesters.push(fn); return requesters.length; } function use() { original = window.<API key>; window.<API key> = fakeRaf; } function restore() { setTimeout(() => { window.<API key> = original; }, 2000); } function step() { let cur = requesters; requesters = []; cur.forEach(function(f) { return f(16); }); } export default { use, restore, step, };
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MotoBotCore.Interfaces { public interface IChannel { string Name { get; set; } string Motd { get; set; } } }
#include <string.h> #include <math.h> #include "MpegDecoder.h" void CDecompressMpeg::imdct_init() { int k, p, n; double t, pi; n = 18; pi = 4.0 * atan(1.0); t = pi / (4 * n); for (p = 0; p < n; p++) w[p] = (float) (2.0 * cos(t * (2 * p + 1))); for (p = 0; p < 9; p++) w2[p] = (float) (2.0 * cos(2 * t * (2 * p + 1))); t = pi / (2 * n); for (k = 0; k < 9; k++) { for (p = 0; p < 4; p++) coef[k][p] = (float) (cos(t * (2 * k) * (2 * p + 1))); } n = 6; pi = 4.0 * atan(1.0); t = pi / (4 * n); for (p = 0; p < n; p++) v[p] = (float) (2.0 * cos(t * (2 * p + 1))); for (p = 0; p < 3; p++) v2[p] = (float) (2.0 * cos(2 * t * (2 * p + 1))); t = pi / (2 * n); k = 1; p = 0; coef87 = (float) (cos(t * (2 * k) * (2 * p + 1))); for (p = 0; p < 6; p++) v[p] = v[p] / 2.0f; coef87 = (float) (2.0 * coef87); } void CDecompressMpeg::imdct18(float f[18]) /* 18 point */ { int p; float a[9], b[9]; float ap, bp, a8p, b8p; float g1, g2; for (p = 0; p < 4; p++) { g1 = w[p] * f[p]; g2 = w[17 - p] * f[17 - p]; ap = g1 + g2; bp = w2[p] * (g1 - g2); g1 = w[8 - p] * f[8 - p]; g2 = w[9 + p] * f[9 + p]; a8p = g1 + g2; // a[8-p] b8p = w2[8 - p] * (g1 - g2); // b[8-p] a[p] = ap + a8p; a[5 + p] = ap - a8p; b[p] = bp + b8p; b[5 + p] = bp - b8p; } g1 = w[p] * f[p]; g2 = w[17 - p] * f[17 - p]; a[p] = g1 + g2; b[p] = w2[p] * (g1 - g2); f[0] = 0.5f * (a[0] + a[1] + a[2] + a[3] + a[4]); f[1] = 0.5f * (b[0] + b[1] + b[2] + b[3] + b[4]); f[2] = coef[1][0] * a[5] + coef[1][1] * a[6] + coef[1][2] * a[7] + coef[1][3] * a[8]; f[3] = coef[1][0] * b[5] + coef[1][1] * b[6] + coef[1][2] * b[7] + coef[1][3] * b[8] - f[1]; f[1] = f[1] - f[0]; f[2] = f[2] - f[1]; f[4] = coef[2][0] * a[0] + coef[2][1] * a[1] + coef[2][2] * a[2] + coef[2][3] * a[3] - a[4]; f[5] = coef[2][0] * b[0] + coef[2][1] * b[1] + coef[2][2] * b[2] + coef[2][3] * b[3] - b[4] - f[3]; f[3] = f[3] - f[2]; f[4] = f[4] - f[3]; f[6] = coef[3][0] * (a[5] - a[7] - a[8]); f[7] = coef[3][0] * (b[5] - b[7] - b[8]) - f[5]; f[5] = f[5] - f[4]; f[6] = f[6] - f[5]; f[8] = coef[4][0] * a[0] + coef[4][1] * a[1] + coef[4][2] * a[2] + coef[4][3] * a[3] + a[4]; f[9] = coef[4][0] * b[0] + coef[4][1] * b[1] + coef[4][2] * b[2] + coef[4][3] * b[3] + b[4] - f[7]; f[7] = f[7] - f[6]; f[8] = f[8] - f[7]; f[10] = coef[5][0] * a[5] + coef[5][1] * a[6] + coef[5][2] * a[7] + coef[5][3] * a[8]; f[11] = coef[5][0] * b[5] + coef[5][1] * b[6] + coef[5][2] * b[7] + coef[5][3] * b[8] - f[9]; f[9] = f[9] - f[8]; f[10] = f[10] - f[9]; f[12] = 0.5f * (a[0] + a[2] + a[3]) - a[1] - a[4]; f[13] = 0.5f * (b[0] + b[2] + b[3]) - b[1] - b[4] - f[11]; f[11] = f[11] - f[10]; f[12] = f[12] - f[11]; f[14] = coef[7][0] * a[5] + coef[7][1] * a[6] + coef[7][2] * a[7] + coef[7][3] * a[8]; f[15] = coef[7][0] * b[5] + coef[7][1] * b[6] + coef[7][2] * b[7] + coef[7][3] * b[8] - f[13]; f[13] = f[13] - f[12]; f[14] = f[14] - f[13]; f[16] = coef[8][0] * a[0] + coef[8][1] * a[1] + coef[8][2] * a[2] + coef[8][3] * a[3] + a[4]; f[17] = coef[8][0] * b[0] + coef[8][1] * b[1] + coef[8][2] * b[2] + coef[8][3] * b[3] + b[4] - f[15]; f[15] = f[15] - f[14]; f[16] = f[16] - f[15]; f[17] = f[17] - f[16]; } /* does 3, 6 pt dct. changes order from f[i][window] c[window][i] */ void CDecompressMpeg::imdct6_3(float f[]) /* 6 point */ { int w; float buf[18]; float* a,* c; // b[i] = a[3+i] float g1, g2; float a02, b02; c = f; a = buf; for (w = 0; w < 3; w++) { g1 = v[0] * f[3 * 0]; g2 = v[5] * f[3 * 5]; a[0] = g1 + g2; a[3 + 0] = v2[0] * (g1 - g2); g1 = v[1] * f[3 * 1]; g2 = v[4] * f[3 * 4]; a[1] = g1 + g2; a[3 + 1] = v2[1] * (g1 - g2); g1 = v[2] * f[3 * 2]; g2 = v[3] * f[3 * 3]; a[2] = g1 + g2; a[3 + 2] = v2[2] * (g1 - g2); a += 6; f++; } a = buf; for (w = 0; w < 3; w++) { a02 = (a[0] + a[2]); b02 = (a[3 + 0] + a[3 + 2]); c[0] = a02 + a[1]; c[1] = b02 + a[3 + 1]; c[2] = coef87 * (a[0] - a[2]); c[3] = coef87 * (a[3 + 0] - a[3 + 2]) - c[1]; c[1] = c[1] - c[0]; c[2] = c[2] - c[1]; c[4] = a02 - a[1] - a[1]; c[5] = b02 - a[3 + 1] - a[3 + 1] - c[3]; c[3] = c[3] - c[2]; c[4] = c[4] - c[3]; c[5] = c[5] - c[4]; a += 6; c += 6; } } void CDecompressMpeg::fdct_init() /* gen coef for N=32 (31 coefs) */ { int p, n, i, k; double t, pi; pi = 4.0 * atan(1.0); n = 16; k = 0; for (i = 0; i < 5; i++, n = n / 2) { for (p = 0; p < n; p++, k++) { t = (pi / (4 * n)) * (2 * p + 1); coef32[k] = (float) (0.50 / cos(t)); } } } void CDecompressMpeg::forward_bf(int m, int n, float x[], float f[], float coef[]) { int i, j, n2; int p, q, p0, k; p0 = 0; n2 = n >> 1; for (i = 0; i < m; i++, p0 += n) { k = 0; p = p0; q = p + n - 1; for (j = 0; j < n2; j++, p++, q f[p] = x[p] + x[q]; f[n2 + p] = coef[k] * (x[p] - x[q]); } } } void CDecompressMpeg::back_bf(int m, int n, float x[], float f[]) { int i, j, n2, n21; int p, q, p0; p0 = 0; n2 = n >> 1; n21 = n2 - 1; for (i = 0; i < m; i++, p0 += n) { p = p0; q = p0; for (j = 0; j < n2; j++, p += 2, q++) f[p] = x[q]; p = p0 + 1; for (j = 0; j < n21; j++, p += 2, q++) f[p] = x[q] + x[q + 1]; f[p] = x[q]; } } void CDecompressMpeg::fdct32(float x[], float c[]) { float a[32]; /* ping pong buffers */ float b[32]; int p, q; /* if (m_enableEQ) { for (p = 0; p < 32; p++) x[p] *= m_equalizer[p]; }*/ /* special first stage */ for (p = 0, q = 31; p < 16; p++, q a[p] = x[p] + x[q]; a[16 + p] = coef32[p] * (x[p] - x[q]); } forward_bf(2, 16, a, b, coef32 + 16); forward_bf(4, 8, b, a, coef32 + 16 + 8); forward_bf(8, 4, a, b, coef32 + 16 + 8 + 4); forward_bf(16, 2, b, a, coef32 + 16 + 8 + 4 + 2); back_bf(8, 4, a, b); back_bf(4, 8, b, a); back_bf(2, 16, a, b); back_bf(1, 32, b, c); } void CDecompressMpeg::fdct32_dual(float x[], float c[]) { float a[32]; /* ping pong buffers */ float b[32]; int p, pp, qq; /* if (m_enableEQ) { for (p = 0; p < 32; p++) x[p] *= m_equalizer[p]; }*/ /* special first stage for dual chan (interleaved x) */ pp = 0; qq = 2 * 31; for (p = 0; p < 16; p++, pp += 2, qq -= 2) { a[p] = x[pp] + x[qq]; a[16 + p] = coef32[p] * (x[pp] - x[qq]); } forward_bf(2, 16, a, b, coef32 + 16); forward_bf(4, 8, b, a, coef32 + 16 + 8); forward_bf(8, 4, a, b, coef32 + 16 + 8 + 4); forward_bf(16, 2, b, a, coef32 + 16 + 8 + 4 + 2); back_bf(8, 4, a, b); back_bf(4, 8, b, a); back_bf(2, 16, a, b); back_bf(1, 32, b, c); } void CDecompressMpeg::fdct32_dual_mono(float x[], float c[]) { float a[32]; /* ping pong buffers */ float b[32]; float t1, t2; int p, pp, qq; /* special first stage */ pp = 0; qq = 2 * 31; for (p = 0; p < 16; p++, pp += 2, qq -= 2) { t1 = 0.5F * (x[pp] + x[pp + 1]); t2 = 0.5F * (x[qq] + x[qq + 1]); a[p] = t1 + t2; a[16 + p] = coef32[p] * (t1 - t2); } forward_bf(2, 16, a, b, coef32 + 16); forward_bf(4, 8, b, a, coef32 + 16 + 8); forward_bf(8, 4, a, b, coef32 + 16 + 8 + 4); forward_bf(16, 2, b, a, coef32 + 16 + 8 + 4 + 2); back_bf(8, 4, a, b); back_bf(4, 8, b, a); back_bf(2, 16, a, b); back_bf(1, 32, b, c); } void CDecompressMpeg::fdct16(float x[], float c[]) { float a[16]; /* ping pong buffers */ float b[16]; int p, q; /* special first stage (drop highest sb) */ a[0] = x[0]; a[8] = coef32[16] * x[0]; for (p = 1, q = 14; p < 8; p++, q a[p] = x[p] + x[q]; a[8 + p] = coef32[16 + p] * (x[p] - x[q]); } forward_bf(2, 8, a, b, coef32 + 16 + 8); forward_bf(4, 4, b, a, coef32 + 16 + 8 + 4); forward_bf(8, 2, a, b, coef32 + 16 + 8 + 4 + 2); back_bf(4, 4, b, a); back_bf(2, 8, a, b); back_bf(1, 16, b, c); } void CDecompressMpeg::fdct16_dual(float x[], float c[]) { float a[16]; /* ping pong buffers */ float b[16]; int p, pp, qq; /* special first stage for interleaved input */ a[0] = x[0]; a[8] = coef32[16] * x[0]; pp = 2; qq = 2 * 14; for (p = 1; p < 8; p++, pp += 2, qq -= 2) { a[p] = x[pp] + x[qq]; a[8 + p] = coef32[16 + p] * (x[pp] - x[qq]); } forward_bf(2, 8, a, b, coef32 + 16 + 8); forward_bf(4, 4, b, a, coef32 + 16 + 8 + 4); forward_bf(8, 2, a, b, coef32 + 16 + 8 + 4 + 2); back_bf(4, 4, b, a); back_bf(2, 8, a, b); back_bf(1, 16, b, c); } void CDecompressMpeg::fdct16_dual_mono(float x[], float c[]) { float a[16]; /* ping pong buffers */ float b[16]; float t1, t2; int p, pp, qq; /* special first stage */ a[0] = 0.5F * (x[0] + x[1]); a[8] = coef32[16] * a[0]; pp = 2; qq = 2 * 14; for (p = 1; p < 8; p++, pp += 2, qq -= 2) { t1 = 0.5F * (x[pp] + x[pp + 1]); t2 = 0.5F * (x[qq] + x[qq + 1]); a[p] = t1 + t2; a[8 + p] = coef32[16 + p] * (t1 - t2); } forward_bf(2, 8, a, b, coef32 + 16 + 8); forward_bf(4, 4, b, a, coef32 + 16 + 8 + 4); forward_bf(8, 2, a, b, coef32 + 16 + 8 + 4 + 2); back_bf(4, 4, b, a); back_bf(2, 8, a, b); back_bf(1, 16, b, c); } void CDecompressMpeg::fdct8(float x[], float c[]) { float a[8]; /* ping pong buffers */ float b[8]; int p, q; /* special first stage */ b[0] = x[0] + x[7]; b[4] = coef32[16 + 8] * (x[0] - x[7]); for (p = 1, q = 6; p < 4; p++, q b[p] = x[p] + x[q]; b[4 + p] = coef32[16 + 8 + p] * (x[p] - x[q]); } forward_bf(2, 4, b, a, coef32 + 16 + 8 + 4); forward_bf(4, 2, a, b, coef32 + 16 + 8 + 4 + 2); back_bf(2, 4, b, a); back_bf(1, 8, a, c); } void CDecompressMpeg::fdct8_dual(float x[], float c[]) { float a[8]; /* ping pong buffers */ float b[8]; int p, pp, qq; /* special first stage for interleaved input */ b[0] = x[0] + x[14]; b[4] = coef32[16 + 8] * (x[0] - x[14]); pp = 2; qq = 2 * 6; for (p = 1; p < 4; p++, pp += 2, qq -= 2) { b[p] = x[pp] + x[qq]; b[4 + p] = coef32[16 + 8 + p] * (x[pp] - x[qq]); } forward_bf(2, 4, b, a, coef32 + 16 + 8 + 4); forward_bf(4, 2, a, b, coef32 + 16 + 8 + 4 + 2); back_bf(2, 4, b, a); back_bf(1, 8, a, c); } void CDecompressMpeg::fdct8_dual_mono(float x[], float c[]) { float a[8]; /* ping pong buffers */ float b[8]; float t1, t2; int p, pp, qq; /* special first stage */ t1 = 0.5F * (x[0] + x[1]); t2 = 0.5F * (x[14] + x[15]); b[0] = t1 + t2; b[4] = coef32[16 + 8] * (t1 - t2); pp = 2; qq = 2 * 6; for (p = 1; p < 4; p++, pp += 2, qq -= 2) { t1 = 0.5F * (x[pp] + x[pp + 1]); t2 = 0.5F * (x[qq] + x[qq + 1]); b[p] = t1 + t2; b[4 + p] = coef32[16 + 8 + p] * (t1 - t2); } forward_bf(2, 4, b, a, coef32 + 16 + 8 + 4); forward_bf(4, 2, a, b, coef32 + 16 + 8 + 4 + 2); back_bf(2, 4, b, a); back_bf(1, 8, a, c); } void CDecompressMpeg::bitget_init(unsigned char* buf) { bs_ptr0 = bs_ptr = buf; bits = 0; bitbuf = 0; } int CDecompressMpeg::bitget(int n) { unsigned int x; if (bits < n) { /* refill bit buf if necessary */ while (bits <= 24) { bitbuf = (bitbuf << 8) | *bs_ptr++; bits += 8; } } bits -= n; x = bitbuf >> bits; bitbuf -= x << bits; return x; } void CDecompressMpeg::bitget_skip(int n) { unsigned int k; if (bits < n) { n -= bits; k = n >> 3; /*--- bytes = n/8 --*/ bs_ptr += k; n -= k << 3; bitbuf = *bs_ptr++; bits = 8; } bits -= n; bitbuf -= (bitbuf >> bits) << bits; } void CDecompressMpeg::bitget_init_end(unsigned char* buf_end) { bs_ptr_end = buf_end; } int CDecompressMpeg::bitget_overrun() { return bs_ptr > bs_ptr_end; } int CDecompressMpeg::bitget_bits_used() { unsigned int n; n = ((bs_ptr - bs_ptr0) << 3) - bits; return n; } void CDecompressMpeg::bitget_check(int n) { if (bits < n) { while (bits <= 24) { bitbuf = (bitbuf << 8) | *bs_ptr++; bits += 8; } } } /* only huffman */ int CDecompressMpeg::bitget_lb(int n) { unsigned int x; if (bits < (n + 2)) { /* refill bit buf if necessary */ while (bits <= 24) { bitbuf = (bitbuf << 8) | *bs_ptr++; bits += 8; } } bits -= n; x = bitbuf >> bits; bitbuf -= x << bits; return x; } int CDecompressMpeg::bitget2(int n) { unsigned int x; if (bits < (MAXBITS + 2)) { /* refill bit buf if necessary */ while (bits <= 24) { bitbuf = (bitbuf << 8) | *bs_ptr++; bits += 8; } } x = bitbuf >> (bits - n); return x; } void CDecompressMpeg::bitget_purge(int n) { bits -= n; bitbuf -= (bitbuf >> bits) << bits; } void CDecompressMpeg::mac_bitget_check(int n) { if (bits < n) { while (bits <= 24) { bitbuf = (bitbuf << 8) | *bs_ptr++; bits += 8; } } } int CDecompressMpeg::mac_bitget(int n) { unsigned int code; bits -= n; code = bitbuf >> bits; bitbuf -= code << bits; return code; } int CDecompressMpeg::mac_bitget2(int n) { return (bitbuf >> (bits - n)); } int CDecompressMpeg::mac_bitget_1bit() { unsigned int code; bits code = bitbuf >> bits; bitbuf -= code << bits; return code; } void CDecompressMpeg::mac_bitget_purge(int n) { bits -= n; bitbuf -= (bitbuf >> bits) << bits; } void CDecompressMpeg::windowB(float* vbuf, int vb_ptr, unsigned char* pcm) { int i, j; int si, bx; float* coef; float sum; long tmp; si = vb_ptr + 16; bx = (si + 32) & 511; coef = wincoef; /*-- first 16 --*/ for (i = 0; i < 16; i++) { sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef++) * vbuf[si]; si = (si + 64) & 511; sum -= (*coef++) * vbuf[bx]; bx = (bx + 64) & 511; } si++; bx tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm++ = ((unsigned char) (tmp >> 8)) ^ 0x80; } /*-- special case --*/ sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef++) * vbuf[bx]; bx = (bx + 64) & 511; } tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm++ = ((unsigned char) (tmp >> 8)) ^ 0x80; /*-- last 15 --*/ coef = wincoef + 255; /* back pass through coefs */ for (i = 0; i < 15; i++) { si bx++; sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef--) * vbuf[si]; si = (si + 64) & 511; sum += (*coef--) * vbuf[bx]; bx = (bx + 64) & 511; } tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm++ = ((unsigned char) (tmp >> 8)) ^ 0x80; } } void CDecompressMpeg::windowB_dual(float* vbuf, int vb_ptr, unsigned char* pcm) { int i, j; /* dual window interleaves output */ int si, bx; float* coef; float sum; long tmp; si = vb_ptr + 16; bx = (si + 32) & 511; coef = wincoef; /*-- first 16 --*/ for (i = 0; i < 16; i++) { sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef++) * vbuf[si]; si = (si + 64) & 511; sum -= (*coef++) * vbuf[bx]; bx = (bx + 64) & 511; } si++; bx tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm = ((unsigned char) (tmp >> 8)) ^ 0x80; pcm += 2; } /*-- special case --*/ sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef++) * vbuf[bx]; bx = (bx + 64) & 511; } tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm = ((unsigned char) (tmp >> 8)) ^ 0x80; pcm += 2; /*-- last 15 --*/ coef = wincoef + 255; /* back pass through coefs */ for (i = 0; i < 15; i++) { si bx++; sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef--) * vbuf[si]; si = (si + 64) & 511; sum += (*coef--) * vbuf[bx]; bx = (bx + 64) & 511; } tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm = ((unsigned char) (tmp >> 8)) ^ 0x80; pcm += 2; } } void CDecompressMpeg::windowB16(float* vbuf, int vb_ptr, unsigned char* pcm) { int i, j; unsigned char si, bx; float* coef; float sum; long tmp; si = vb_ptr + 8; bx = si + 16; coef = wincoef; /*-- first 8 --*/ for (i = 0; i < 8; i++) { sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef++) * vbuf[si]; si += 32; sum -= (*coef++) * vbuf[bx]; bx += 32; } si++; bx coef += 16; tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm++ = ((unsigned char) (tmp >> 8)) ^ 0x80; } /*-- special case --*/ sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef++) * vbuf[bx]; bx += 32; } tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm++ = ((unsigned char) (tmp >> 8)) ^ 0x80; /*-- last 7 --*/ coef = wincoef + 255; /* back pass through coefs */ for (i = 0; i < 7; i++) { coef -= 16; si bx++; sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef--) * vbuf[si]; si += 32; sum += (*coef--) * vbuf[bx]; bx += 32; } tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm++ = ((unsigned char) (tmp >> 8)) ^ 0x80; } } void CDecompressMpeg::windowB16_dual(float* vbuf, int vb_ptr, unsigned char* pcm) { int i, j; unsigned char si, bx; float* coef; float sum; long tmp; si = vb_ptr + 8; bx = si + 16; coef = wincoef; /*-- first 8 --*/ for (i = 0; i < 8; i++) { sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef++) * vbuf[si]; si += 32; sum -= (*coef++) * vbuf[bx]; bx += 32; } si++; bx coef += 16; tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm = ((unsigned char) (tmp >> 8)) ^ 0x80; pcm += 2; } /*-- special case --*/ sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef++) * vbuf[bx]; bx += 32; } tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm = ((unsigned char) (tmp >> 8)) ^ 0x80; pcm += 2; /*-- last 7 --*/ coef = wincoef + 255; /* back pass through coefs */ for (i = 0; i < 7; i++) { coef -= 16; si bx++; sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef--) * vbuf[si]; si += 32; sum += (*coef--) * vbuf[bx]; bx += 32; } tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm = ((unsigned char) (tmp >> 8)) ^ 0x80; pcm += 2; } } void CDecompressMpeg::windowB8(float* vbuf, int vb_ptr, unsigned char* pcm) { int i, j; int si, bx; float* coef; float sum; long tmp; si = vb_ptr + 4; bx = (si + 8) & 127; coef = wincoef; /*-- first 4 --*/ for (i = 0; i < 4; i++) { sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef++) * vbuf[si]; si = (si + 16) & 127; sum -= (*coef++) * vbuf[bx]; bx = (bx + 16) & 127; } si++; bx coef += 48; tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm++ = ((unsigned char) (tmp >> 8)) ^ 0x80; } /*-- special case --*/ sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef++) * vbuf[bx]; bx = (bx + 16) & 127; } tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm++ = ((unsigned char) (tmp >> 8)) ^ 0x80; /*-- last 3 --*/ coef = wincoef + 255; /* back pass through coefs */ for (i = 0; i < 3; i++) { coef -= 48; si bx++; sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef--) * vbuf[si]; si = (si + 16) & 127; sum += (*coef--) * vbuf[bx]; bx = (bx + 16) & 127; } tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm++ = ((unsigned char) (tmp >> 8)) ^ 0x80; } } void CDecompressMpeg::windowB8_dual(float* vbuf, int vb_ptr, unsigned char* pcm) { int i, j; int si, bx; float* coef; float sum; long tmp; si = vb_ptr + 4; bx = (si + 8) & 127; coef = wincoef; /*-- first 4 --*/ for (i = 0; i < 4; i++) { sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef++) * vbuf[si]; si = (si + 16) & 127; sum -= (*coef++) * vbuf[bx]; bx = (bx + 16) & 127; } si++; bx coef += 48; tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm = ((unsigned char) (tmp >> 8)) ^ 0x80; pcm += 2; } /*-- special case --*/ sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef++) * vbuf[bx]; bx = (bx + 16) & 127; } tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm = ((unsigned char) (tmp >> 8)) ^ 0x80; pcm += 2; /*-- last 3 --*/ coef = wincoef + 255; /* back pass through coefs */ for (i = 0; i < 3; i++) { coef -= 48; si bx++; sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef--) * vbuf[si]; si = (si + 16) & 127; sum += (*coef--) * vbuf[bx]; bx = (bx + 16) & 127; } tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm = ((unsigned char) (tmp >> 8)) ^ 0x80; pcm += 2; } } void CDecompressMpeg::sbtB_mono(float* sample, void* in_pcm, int n) { int i; unsigned char * pcm = (unsigned char *) in_pcm; for (i = 0; i < n; i++) { fdct32(sample, vbuf + vb_ptr); windowB(vbuf, vb_ptr, pcm); sample += 64; vb_ptr = (vb_ptr - 32) & 511; pcm += 32; } } void CDecompressMpeg::sbtB_dual(float* sample, void* in_pcm, int n) { int i; unsigned char * pcm = (unsigned char *) in_pcm; for (i = 0; i < n; i++) { fdct32_dual(sample, vbuf + vb_ptr); fdct32_dual(sample + 1, vbuf2 + vb_ptr); windowB_dual(vbuf, vb_ptr, pcm); windowB_dual(vbuf2, vb_ptr, pcm + 1); sample += 64; vb_ptr = (vb_ptr - 32) & 511; pcm += 64; } } void CDecompressMpeg::sbtB_dual_mono(float* sample, void* in_pcm, int n) { int i; unsigned char * pcm = (unsigned char *) in_pcm; for (i = 0; i < n; i++) { fdct32_dual_mono(sample, vbuf + vb_ptr); windowB(vbuf, vb_ptr, pcm); sample += 64; vb_ptr = (vb_ptr - 32) & 511; pcm += 32; } } void CDecompressMpeg::sbtB_dual_left(float* sample, void* in_pcm, int n) { int i; unsigned char * pcm = (unsigned char *) in_pcm; for (i = 0; i < n; i++) { fdct32_dual(sample, vbuf + vb_ptr); windowB(vbuf, vb_ptr, pcm); sample += 64; vb_ptr = (vb_ptr - 32) & 511; pcm += 32; } } void CDecompressMpeg::sbtB_dual_right(float* sample, void* in_pcm, int n) { int i; unsigned char * pcm = (unsigned char *) in_pcm; sample++; /* point to right chan */ for (i = 0; i < n; i++) { fdct32_dual(sample, vbuf + vb_ptr); windowB(vbuf, vb_ptr, pcm); sample += 64; vb_ptr = (vb_ptr - 32) & 511; pcm += 32; } } void CDecompressMpeg::sbtB16_mono(float* sample, void* in_pcm, int n) { int i; unsigned char * pcm = (unsigned char *) in_pcm; for (i = 0; i < n; i++) { fdct16(sample, vbuf + vb_ptr); windowB16(vbuf, vb_ptr, pcm); sample += 64; vb_ptr = (vb_ptr - 16) & 255; pcm += 16; } } void CDecompressMpeg::sbtB16_dual(float* sample, void* in_pcm, int n) { int i; unsigned char * pcm = (unsigned char *) in_pcm; for (i = 0; i < n; i++) { fdct16_dual(sample, vbuf + vb_ptr); fdct16_dual(sample + 1, vbuf2 + vb_ptr); windowB16_dual(vbuf, vb_ptr, pcm); windowB16_dual(vbuf2, vb_ptr, pcm + 1); sample += 64; vb_ptr = (vb_ptr - 16) & 255; pcm += 32; } } void CDecompressMpeg::sbtB16_dual_mono(float* sample, void* in_pcm, int n) { int i; unsigned char * pcm = (unsigned char *) in_pcm; for (i = 0; i < n; i++) { fdct16_dual_mono(sample, vbuf + vb_ptr); windowB16(vbuf, vb_ptr, pcm); sample += 64; vb_ptr = (vb_ptr - 16) & 255; pcm += 16; } } void CDecompressMpeg::sbtB16_dual_left(float* sample, void* in_pcm, int n) { int i; unsigned char * pcm = (unsigned char *) in_pcm; for (i = 0; i < n; i++) { fdct16_dual(sample, vbuf + vb_ptr); windowB16(vbuf, vb_ptr, pcm); sample += 64; vb_ptr = (vb_ptr - 16) & 255; pcm += 16; } } void CDecompressMpeg::sbtB16_dual_right(float* sample, void* in_pcm, int n) { int i; unsigned char * pcm = (unsigned char *) in_pcm; sample++; for (i = 0; i < n; i++) { fdct16_dual(sample, vbuf + vb_ptr); windowB16(vbuf, vb_ptr, pcm); sample += 64; vb_ptr = (vb_ptr - 16) & 255; pcm += 16; } } void CDecompressMpeg::sbtB8_mono(float* sample, void* in_pcm, int n) { int i; unsigned char * pcm = (unsigned char *) in_pcm; for (i = 0; i < n; i++) { fdct8(sample, vbuf + vb_ptr); windowB8(vbuf, vb_ptr, pcm); sample += 64; vb_ptr = (vb_ptr - 8) & 127; pcm += 8; } } void CDecompressMpeg::sbtB8_dual(float* sample, void* in_pcm, int n) { int i; unsigned char * pcm = (unsigned char *) in_pcm; for (i = 0; i < n; i++) { fdct8_dual(sample, vbuf + vb_ptr); fdct8_dual(sample + 1, vbuf2 + vb_ptr); windowB8_dual(vbuf, vb_ptr, pcm); windowB8_dual(vbuf2, vb_ptr, pcm + 1); sample += 64; vb_ptr = (vb_ptr - 8) & 127; pcm += 16; } } void CDecompressMpeg::sbtB8_dual_mono(float* sample, void* in_pcm, int n) { int i; unsigned char * pcm = (unsigned char *) in_pcm; for (i = 0; i < n; i++) { fdct8_dual_mono(sample, vbuf + vb_ptr); windowB8(vbuf, vb_ptr, pcm); sample += 64; vb_ptr = (vb_ptr - 8) & 127; pcm += 8; } } void CDecompressMpeg::sbtB8_dual_left(float* sample, void* in_pcm, int n) { int i; unsigned char * pcm = (unsigned char *) in_pcm; for (i = 0; i < n; i++) { fdct8_dual(sample, vbuf + vb_ptr); windowB8(vbuf, vb_ptr, pcm); sample += 64; vb_ptr = (vb_ptr - 8) & 127; pcm += 8; } } void CDecompressMpeg::sbtB8_dual_right(float* sample, void* in_pcm, int n) { int i; unsigned char * pcm = (unsigned char *) in_pcm; sample++; for (i = 0; i < n; i++) { fdct8_dual(sample, vbuf + vb_ptr); windowB8(vbuf, vb_ptr, pcm); sample += 64; vb_ptr = (vb_ptr - 8) & 127; pcm += 8; } } void CDecompressMpeg::sbtB_mono_L3(float* sample, void* in_pcm, int ch) { int i; unsigned char * pcm = (unsigned char *) in_pcm; ch = 0; for (i = 0; i < 18; i++) { fdct32(sample, vbuf + vb_ptr); windowB(vbuf, vb_ptr, pcm); sample += 32; vb_ptr = (vb_ptr - 32) & 511; pcm += 32; } } void CDecompressMpeg::sbtB_dual_L3(float* sample, void* in_pcm, int ch) { int i; unsigned char * pcm = (unsigned char *) in_pcm; if (ch == 0) for (i = 0; i < 18; i++) { fdct32(sample, vbuf + vb_ptr); windowB_dual(vbuf, vb_ptr, pcm); sample += 32; vb_ptr = (vb_ptr - 32) & 511; pcm += 64; } else for (i = 0; i < 18; i++) { fdct32(sample, vbuf2 + vb2_ptr); windowB_dual(vbuf2, vb2_ptr, pcm + 1); sample += 32; vb2_ptr = (vb2_ptr - 32) & 511; pcm += 64; } } void CDecompressMpeg::sbtB16_mono_L3(float* sample, void* in_pcm, int ch) { int i; unsigned char * pcm = (unsigned char *) in_pcm; ch = 0; for (i = 0; i < 18; i++) { fdct16(sample, vbuf + vb_ptr); windowB16(vbuf, vb_ptr, pcm); sample += 32; vb_ptr = (vb_ptr - 16) & 255; pcm += 16; } } void CDecompressMpeg::sbtB16_dual_L3(float* sample, void* in_pcm, int ch) { int i; unsigned char * pcm = (unsigned char *) in_pcm; if (ch == 0) { for (i = 0; i < 18; i++) { fdct16(sample, vbuf + vb_ptr); windowB16_dual(vbuf, vb_ptr, pcm); sample += 32; vb_ptr = (vb_ptr - 16) & 255; pcm += 32; } } else { for (i = 0; i < 18; i++) { fdct16(sample, vbuf2 + vb2_ptr); windowB16_dual(vbuf2, vb2_ptr, pcm + 1); sample += 32; vb2_ptr = (vb2_ptr - 16) & 255; pcm += 32; } } } void CDecompressMpeg::sbtB8_mono_L3(float* sample, void* in_pcm, int ch) { int i; unsigned char * pcm = (unsigned char *) in_pcm; ch = 0; for (i = 0; i < 18; i++) { fdct8(sample, vbuf + vb_ptr); windowB8(vbuf, vb_ptr, pcm); sample += 32; vb_ptr = (vb_ptr - 8) & 127; pcm += 8; } } void CDecompressMpeg::sbtB8_dual_L3(float* sample, void* in_pcm, int ch) { int i; unsigned char * pcm = (unsigned char *) in_pcm; if (ch == 0) { for (i = 0; i < 18; i++) { fdct8(sample, vbuf + vb_ptr); windowB8_dual(vbuf, vb_ptr, pcm); sample += 32; vb_ptr = (vb_ptr - 8) & 127; pcm += 16; } } else { for (i = 0; i < 18; i++) { fdct8(sample, vbuf2 + vb2_ptr); windowB8_dual(vbuf2, vb2_ptr, pcm + 1); sample += 32; vb2_ptr = (vb2_ptr - 8) & 127; pcm += 16; } } } // window coefs float CDecompressMpeg::wincoef[264] = { 0.000000000f, 0.000442505f, -0.003250122f, 0.007003784f, -0.031082151f, 0.078628540f, -0.100311279f, 0.572036743f, -1.144989014f, -0.572036743f, -0.100311279f, -0.078628540f, -0.031082151f, -0.007003784f, -0.003250122f, -0.000442505f, 0.000015259f, 0.000473022f, -0.003326416f, 0.007919312f, -0.030517576f, 0.084182739f, -0.090927124f, 0.600219727f, -1.144287109f, -0.543823242f, -0.108856201f, -0.073059082f, -0.031478882f, -0.006118774f, -0.003173828f, -0.000396729f, 0.000015259f, 0.000534058f, -0.003387451f, 0.008865356f, -0.029785154f, 0.089706421f, -0.080688477f, 0.628295898f, -1.142211914f, -0.515609741f, -0.116577141f, -0.067520142f, -0.031738281f, -0.005294800f, -0.003082275f, -0.000366211f, 0.000015259f, 0.000579834f, -0.003433228f, 0.009841919f, -0.028884888f, 0.095169067f, -0.069595337f, 0.656219482f, -1.138763428f, -0.487472534f, -0.123474121f, -0.061996460f, -0.031845093f, -0.004486084f, -0.002990723f, -0.000320435f, 0.000015259f, 0.000625610f, -0.003463745f, 0.010848999f, -0.027801514f, 0.100540161f, -0.057617184f, 0.683914185f, -1.133926392f, -0.459472656f, -0.129577637f, -0.056533810f, -0.031814575f, -0.003723145f, -0.002899170f, -0.000289917f, 0.000015259f, 0.000686646f, -0.003479004f, 0.011886597f, -0.026535034f, 0.105819702f, -0.044784546f, 0.711318970f, -1.127746582f, -0.431655884f, -0.134887695f, -0.051132202f, -0.031661987f, -0.003005981f, -0.002792358f, -0.000259399f, 0.000015259f, 0.000747681f, -0.003479004f, 0.012939452f, -0.025085449f, 0.110946655f, -0.031082151f, 0.738372803f, -1.120223999f, -0.404083252f, -0.139450073f, -0.045837402f, -0.031387329f, -0.002334595f, -0.002685547f, -0.000244141f, 0.000030518f, 0.000808716f, -0.003463745f, 0.014022826f, -0.023422241f, 0.115921021f, -0.016510010f, 0.765029907f, -1.111373901f, -0.376800537f, -0.143264771f, -0.040634155f, -0.031005858f, -0.001693726f, -0.002578735f, -0.000213623f, 0.000030518f, 0.000885010f, -0.003417969f, 0.015121460f, -0.021575928f, 0.120697014f, -0.001068115f, 0.791213989f, -1.101211548f, -0.349868774f, -0.146362305f, -0.035552979f, -0.030532837f, -0.001098633f, -0.002456665f, -0.000198364f, 0.000030518f, 0.000961304f, -0.003372192f, 0.016235352f, -0.019531250f, 0.125259399f, 0.015228271f, 0.816864014f, -1.089782715f, -0.323318481f, -0.148773193f, -0.030609131f, -0.029937742f, -0.000549316f, -0.002349854f, -0.000167847f, 0.000030518f, 0.001037598f, -0.003280640f, 0.017349243f, -0.017257690f, 0.129562378f, 0.032379150f, 0.841949463f, -1.077117920f, -0.297210693f, -0.150497437f, -0.025817871f, -0.029281614f, -0.000030518f, -0.002243042f, -0.000152588f, 0.000045776f, 0.001113892f, -0.003173828f, 0.018463135f, -0.014801024f, 0.133590698f, 0.050354004f, 0.866363525f, -1.063217163f, -0.271591187f, -0.151596069f, -0.021179199f, -0.028533936f, 0.000442505f, -0.002120972f, -0.000137329f, 0.000045776f, 0.001205444f, -0.003051758f, 0.019577026f, -0.012115479f, 0.137298584f, 0.069168091f, 0.890090942f, -1.048156738f, -0.246505737f, -0.152069092f, -0.016708374f, -0.027725220f, 0.000869751f, -0.002014160f, -0.000122070f, 0.000061035f, 0.001296997f, -0.002883911f, 0.020690918f, -0.009231566f, 0.140670776f, 0.088775635f, 0.913055420f, -1.031936646f, -0.221984863f, -0.151962280f, -0.012420653f, -0.026840210f, 0.001266479f, -0.001907349f, -0.000106812f, 0.000061035f, 0.001388550f, -0.002700806f, 0.021789551f, -0.006134033f, 0.143676758f, 0.109161377f, 0.935195923f, -1.014617920f, -0.198059082f, -0.151306152f, -0.008316040f, -0.025909424f, 0.001617432f, -0.001785278f, -0.000106812f, 0.000076294f, 0.001480103f, -0.002487183f, 0.022857666f, -0.002822876f, 0.146255493f, 0.130310059f, 0.956481934f, -0.996246338f, -0.174789429f, -0.150115967f, -0.004394531f, -0.024932859f, 0.001937866f, -0.001693726f, -0.000091553f, -0.001586914f, -0.023910521f, -0.148422241f, -0.976852417f, 0.152206421f, 0.000686646f, -0.002227783f, 0.000076294f, }; void CDecompressMpeg::window(float* vbuf, int vb_ptr, short* pcm) { int i, j; int si, bx; float* coef; float sum; long tmp; si = vb_ptr + 16; bx = (si + 32) & 511; coef = wincoef; /*-- first 16 --*/ for (i = 0; i < 16; i++) { sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef++) * vbuf[si]; si = (si + 64) & 511; sum -= (*coef++) * vbuf[bx]; bx = (bx + 64) & 511; } si++; bx tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm++ = (short) tmp; } /*-- special case --*/ sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef++) * vbuf[bx]; bx = (bx + 64) & 511; } tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm++ = (short) tmp; /*-- last 15 --*/ coef = wincoef + 255; /* back pass through coefs */ for (i = 0; i < 15; i++) { si bx++; sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef--) * vbuf[si]; si = (si + 64) & 511; sum += (*coef--) * vbuf[bx]; bx = (bx + 64) & 511; } tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm++ = (short) tmp; } } void CDecompressMpeg::window_dual(float* vbuf, int vb_ptr, short* pcm) { int i, j; /* dual window interleaves output */ int si, bx; float* coef; float sum; long tmp; si = vb_ptr + 16; bx = (si + 32) & 511; coef = wincoef; /*-- first 16 --*/ for (i = 0; i < 16; i++) { sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef++) * vbuf[si]; si = (si + 64) & 511; sum -= (*coef++) * vbuf[bx]; bx = (bx + 64) & 511; } si++; bx tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm = (short) tmp; pcm += 2; } /*-- special case --*/ sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef++) * vbuf[bx]; bx = (bx + 64) & 511; } tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm = (short) tmp; pcm += 2; /*-- last 15 --*/ coef = wincoef + 255; /* back pass through coefs */ for (i = 0; i < 15; i++) { si bx++; sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef--) * vbuf[si]; si = (si + 64) & 511; sum += (*coef--) * vbuf[bx]; bx = (bx + 64) & 511; } tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm = (short) tmp; pcm += 2; } } void CDecompressMpeg::window16(float* vbuf, int vb_ptr, short* pcm) { int i, j; unsigned char si, bx; float* coef; float sum; long tmp; si = vb_ptr + 8; bx = si + 16; coef = wincoef; /*-- first 8 --*/ for (i = 0; i < 8; i++) { sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef++) * vbuf[si]; si += 32; sum -= (*coef++) * vbuf[bx]; bx += 32; } si++; bx coef += 16; tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm++ = (short) tmp; } /*-- special case --*/ sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef++) * vbuf[bx]; bx += 32; } tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm++ = (short) tmp; /*-- last 7 --*/ coef = wincoef + 255; /* back pass through coefs */ for (i = 0; i < 7; i++) { coef -= 16; si bx++; sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef--) * vbuf[si]; si += 32; sum += (*coef--) * vbuf[bx]; bx += 32; } tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm++ = (short) tmp; } } void CDecompressMpeg::window16_dual(float* vbuf, int vb_ptr, short* pcm) { int i, j; unsigned char si, bx; float* coef; float sum; long tmp; si = vb_ptr + 8; bx = si + 16; coef = wincoef; /*-- first 8 --*/ for (i = 0; i < 8; i++) { sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef++) * vbuf[si]; si += 32; sum -= (*coef++) * vbuf[bx]; bx += 32; } si++; bx coef += 16; tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm = (short) tmp; pcm += 2; } /*-- special case --*/ sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef++) * vbuf[bx]; bx += 32; } tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm = (short) tmp; pcm += 2; /*-- last 7 --*/ coef = wincoef + 255; /* back pass through coefs */ for (i = 0; i < 7; i++) { coef -= 16; si bx++; sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef--) * vbuf[si]; si += 32; sum += (*coef--) * vbuf[bx]; bx += 32; } tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm = (short) tmp; pcm += 2; } } void CDecompressMpeg::window8(float* vbuf, int vb_ptr, short* pcm) { int i, j; int si, bx; float* coef; float sum; long tmp; si = vb_ptr + 4; bx = (si + 8) & 127; coef = wincoef; /*-- first 4 --*/ for (i = 0; i < 4; i++) { sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef++) * vbuf[si]; si = (si + 16) & 127; sum -= (*coef++) * vbuf[bx]; bx = (bx + 16) & 127; } si++; bx coef += 48; tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm++ = (short) tmp; } /*-- special case --*/ sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef++) * vbuf[bx]; bx = (bx + 16) & 127; } tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm++ = (short) tmp; /*-- last 3 --*/ coef = wincoef + 255; /* back pass through coefs */ for (i = 0; i < 3; i++) { coef -= 48; si bx++; sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef--) * vbuf[si]; si = (si + 16) & 127; sum += (*coef--) * vbuf[bx]; bx = (bx + 16) & 127; } tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm++ = (short) tmp; } } void CDecompressMpeg::window8_dual(float* vbuf, int vb_ptr, short* pcm) { int i, j; int si, bx; float* coef; float sum; long tmp; si = vb_ptr + 4; bx = (si + 8) & 127; coef = wincoef; /*-- first 4 --*/ for (i = 0; i < 4; i++) { sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef++) * vbuf[si]; si = (si + 16) & 127; sum -= (*coef++) * vbuf[bx]; bx = (bx + 16) & 127; } si++; bx coef += 48; tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm = (short) tmp; pcm += 2; } /*-- special case --*/ sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef++) * vbuf[bx]; bx = (bx + 16) & 127; } tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm = (short) tmp; pcm += 2; /*-- last 3 --*/ coef = wincoef + 255; /* back pass through coefs */ for (i = 0; i < 3; i++) { coef -= 48; si bx++; sum = 0.0F; for (j = 0; j < 8; j++) { sum += (*coef--) * vbuf[si]; si = (si + 16) & 127; sum += (*coef--) * vbuf[bx]; bx = (bx + 16) & 127; } tmp = (long) sum; if (tmp > 32767) tmp = 32767; else if (tmp < -32768) tmp = -32768; *pcm = (short) tmp; pcm += 2; } } void CDecompressMpeg::sbt_init() { int i; /* clear window vbuf */ for (i = 0; i < 512; i++) { vbuf[i] = 0.0F; vbuf2[i] = 0.0F; } vb2_ptr = vb_ptr = 0; } void CDecompressMpeg::sbt_mono(float* sample, void* in_pcm, int n) { int i; short* pcm = (short*) in_pcm; for (i = 0; i < n; i++) { fdct32(sample, vbuf + vb_ptr); window(vbuf, vb_ptr, pcm); sample += 64; vb_ptr = (vb_ptr - 32) & 511; pcm += 32; } } void CDecompressMpeg::sbt_dual(float* sample, void* in_pcm, int n) { int i; short* pcm = (short*) in_pcm; for (i = 0; i < n; i++) { fdct32_dual(sample, vbuf + vb_ptr); fdct32_dual(sample + 1, vbuf2 + vb_ptr); window_dual(vbuf, vb_ptr, pcm); window_dual(vbuf2, vb_ptr, pcm + 1); sample += 64; vb_ptr = (vb_ptr - 32) & 511; pcm += 64; } } void CDecompressMpeg::sbt_dual_mono(float* sample, void* in_pcm, int n) { int i; short* pcm = (short*) in_pcm; for (i = 0; i < n; i++) { fdct32_dual_mono(sample, vbuf + vb_ptr); window(vbuf, vb_ptr, pcm); sample += 64; vb_ptr = (vb_ptr - 32) & 511; pcm += 32; } } void CDecompressMpeg::sbt_dual_left(float* sample, void* in_pcm, int n) { int i; short* pcm = (short*) in_pcm; for (i = 0; i < n; i++) { fdct32_dual(sample, vbuf + vb_ptr); window(vbuf, vb_ptr, pcm); sample += 64; vb_ptr = (vb_ptr - 32) & 511; pcm += 32; } } void CDecompressMpeg::sbt_dual_right(float* sample, void* in_pcm, int n) { int i; short* pcm = (short*) in_pcm; sample++; /* point to right chan */ for (i = 0; i < n; i++) { fdct32_dual(sample, vbuf + vb_ptr); window(vbuf, vb_ptr, pcm); sample += 64; vb_ptr = (vb_ptr - 32) & 511; pcm += 32; } } void CDecompressMpeg::sbt16_mono(float* sample, void* in_pcm, int n) { int i; short* pcm = (short*) in_pcm; for (i = 0; i < n; i++) { fdct16(sample, vbuf + vb_ptr); window16(vbuf, vb_ptr, pcm); sample += 64; vb_ptr = (vb_ptr - 16) & 255; pcm += 16; } } void CDecompressMpeg::sbt16_dual(float* sample, void* in_pcm, int n) { int i; short* pcm = (short*) in_pcm; for (i = 0; i < n; i++) { fdct16_dual(sample, vbuf + vb_ptr); fdct16_dual(sample + 1, vbuf2 + vb_ptr); window16_dual(vbuf, vb_ptr, pcm); window16_dual(vbuf2, vb_ptr, pcm + 1); sample += 64; vb_ptr = (vb_ptr - 16) & 255; pcm += 32; } } void CDecompressMpeg::sbt16_dual_mono(float* sample, void* in_pcm, int n) { int i; short* pcm = (short*) in_pcm; for (i = 0; i < n; i++) { fdct16_dual_mono(sample, vbuf + vb_ptr); window16(vbuf, vb_ptr, pcm); sample += 64; vb_ptr = (vb_ptr - 16) & 255; pcm += 16; } } void CDecompressMpeg::sbt16_dual_left(float* sample, void* in_pcm, int n) { int i; short* pcm = (short*) in_pcm; for (i = 0; i < n; i++) { fdct16_dual(sample, vbuf + vb_ptr); window16(vbuf, vb_ptr, pcm); sample += 64; vb_ptr = (vb_ptr - 16) & 255; pcm += 16; } } void CDecompressMpeg::sbt16_dual_right(float* sample, void* in_pcm, int n) { int i; short* pcm = (short*) in_pcm; sample++; for (i = 0; i < n; i++) { fdct16_dual(sample, vbuf + vb_ptr); window16(vbuf, vb_ptr, pcm); sample += 64; vb_ptr = (vb_ptr - 16) & 255; pcm += 16; } } void CDecompressMpeg::sbt8_mono(float* sample, void* in_pcm, int n) { int i; short* pcm = (short*) in_pcm; for (i = 0; i < n; i++) { fdct8(sample, vbuf + vb_ptr); window8(vbuf, vb_ptr, pcm); sample += 64; vb_ptr = (vb_ptr - 8) & 127; pcm += 8; } } void CDecompressMpeg::sbt8_dual(float* sample, void* in_pcm, int n) { int i; short* pcm = (short*) in_pcm; for (i = 0; i < n; i++) { fdct8_dual(sample, vbuf + vb_ptr); fdct8_dual(sample + 1, vbuf2 + vb_ptr); window8_dual(vbuf, vb_ptr, pcm); window8_dual(vbuf2, vb_ptr, pcm + 1); sample += 64; vb_ptr = (vb_ptr - 8) & 127; pcm += 16; } } void CDecompressMpeg::sbt8_dual_mono(float* sample, void* in_pcm, int n) { int i; short* pcm = (short*) in_pcm; for (i = 0; i < n; i++) { fdct8_dual_mono(sample, vbuf + vb_ptr); window8(vbuf, vb_ptr, pcm); sample += 64; vb_ptr = (vb_ptr - 8) & 127; pcm += 8; } } void CDecompressMpeg::sbt8_dual_left(float* sample, void* in_pcm, int n) { int i; short* pcm = (short*) in_pcm; for (i = 0; i < n; i++) { fdct8_dual(sample, vbuf + vb_ptr); window8(vbuf, vb_ptr, pcm); sample += 64; vb_ptr = (vb_ptr - 8) & 127; pcm += 8; } } void CDecompressMpeg::sbt8_dual_right(float* sample, void* in_pcm, int n) { int i; short* pcm = (short*) in_pcm; sample++; for (i = 0; i < n; i++) { fdct8_dual(sample, vbuf + vb_ptr); window8(vbuf, vb_ptr, pcm); sample += 64; vb_ptr = (vb_ptr - 8) & 127; pcm += 8; } } void CDecompressMpeg::sbt_mono_L3(float* sample, void* in_pcm, int ch) { int i; short* pcm = (short*) in_pcm; ch = 0; for (i = 0; i < 18; i++) { fdct32(sample, vbuf + vb_ptr); window(vbuf, vb_ptr, pcm); sample += 32; vb_ptr = (vb_ptr - 32) & 511; pcm += 32; } } void CDecompressMpeg::sbt_dual_L3(float* sample, void* in_pcm, int ch) { int i; short* pcm = (short*) in_pcm; if (ch == 0) for (i = 0; i < 18; i++) { fdct32(sample, vbuf + vb_ptr); window_dual(vbuf, vb_ptr, pcm); sample += 32; vb_ptr = (vb_ptr - 32) & 511; pcm += 64; } else for (i = 0; i < 18; i++) { fdct32(sample, vbuf2 + vb2_ptr); window_dual(vbuf2, vb2_ptr, pcm + 1); sample += 32; vb2_ptr = (vb2_ptr - 32) & 511; pcm += 64; } } void CDecompressMpeg::sbt16_mono_L3(float* sample, void* in_pcm, int ch) { int i; short* pcm = (short*) in_pcm; ch = 0; for (i = 0; i < 18; i++) { fdct16(sample, vbuf + vb_ptr); window16(vbuf, vb_ptr, pcm); sample += 32; vb_ptr = (vb_ptr - 16) & 255; pcm += 16; } } void CDecompressMpeg::sbt16_dual_L3(float* sample, void* in_pcm, int ch) { int i; short* pcm = (short*) in_pcm; if (ch == 0) { for (i = 0; i < 18; i++) { fdct16(sample, vbuf + vb_ptr); window16_dual(vbuf, vb_ptr, pcm); sample += 32; vb_ptr = (vb_ptr - 16) & 255; pcm += 32; } } else { for (i = 0; i < 18; i++) { fdct16(sample, vbuf2 + vb2_ptr); window16_dual(vbuf2, vb2_ptr, pcm + 1); sample += 32; vb2_ptr = (vb2_ptr - 16) & 255; pcm += 32; } } } void CDecompressMpeg::sbt8_mono_L3(float* sample, void* in_pcm, int ch) { int i; short* pcm = (short*) in_pcm; ch = 0; for (i = 0; i < 18; i++) { fdct8(sample, vbuf + vb_ptr); window8(vbuf, vb_ptr, pcm); sample += 32; vb_ptr = (vb_ptr - 8) & 127; pcm += 8; } } void CDecompressMpeg::sbt8_dual_L3(float* sample, void* in_pcm, int ch) { int i; short* pcm = (short*) in_pcm; if (ch == 0) { for (i = 0; i < 18; i++) { fdct8(sample, vbuf + vb_ptr); window8_dual(vbuf, vb_ptr, pcm); sample += 32; vb_ptr = (vb_ptr - 8) & 127; pcm += 16; } } else { for (i = 0; i < 18; i++) { fdct8(sample, vbuf2 + vb2_ptr); window8_dual(vbuf2, vb2_ptr, pcm + 1); sample += 32; vb2_ptr = (vb2_ptr - 8) & 127; pcm += 16; } } } int CDecompressMpeg::br_tbl[3][3][16] = { {// MPEG-1 // Layer1 { 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 0 }, // Layer2 { 0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 0 }, // Layer3 { 0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 0 }, }, {// MPEG-2 // Layer1 { 0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, 0 }, // Layer2 { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0 }, // Layer3 { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0 }, }, {// MPEG-2.5 // Layer1 (not available) { 0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, 0 }, // Layer2 (not available) { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0 }, // Layer3 { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0 }, }, }; int CDecompressMpeg::fr_tbl[3][4] = { { 44100, 48000, 32000, 0 }, // MPEG-1 { 22050, 24000, 16000, 0 }, // MPEG-2 { 11025, 12000, 8000, 0 }, // MPEG-2.5 }; void CDecompressMpeg::mp3DecodeInit() { m_option.reduction = 0; m_option.convert = 0; m_option.freqLimit = 24000; L1table_init(); L2table_init(); L3table_init(); } int CDecompressMpeg::mp3GetHeader(BYTE* buf, MPEG_HEADER* h) { h->version = (buf[1] & 0x08) >> 3; h->layer = (buf[1] & 0x06) >> 1; h->error_prot = (buf[1] & 0x01); h->br_index = (buf[2] & 0xf0) >> 4; h->fr_index = (buf[2] & 0x0c) >> 2; h->padding = (buf[2] & 0x02) >> 1; h->extension = (buf[2] & 0x01); h->mode = (buf[3] & 0xc0) >> 6; h->mode_ext = (buf[3] & 0x30) >> 4; h->copyright = (buf[3] & 0x08) >> 3; h->original = (buf[3] & 0x04) >> 2; h->emphasis = (buf[3] & 0x03); if (buf[0] != 0xFF) { //sync error m_last_error = <API key>; return 0; } if ((buf[1] & 0xF0) == 0xF0) //MPEG-1, MPEG-2 h->version = (h->version) ? 1 : 2; else if ((buf[1] & 0xF0) == 0xE0) //MPEG-2.5 h->version = 3; else { m_last_error = <API key>; return 0; } if (h->fr_index >= 3 || h->br_index == 0 || h->br_index >= 15 || h->layer == 0 || h->layer >= 4) { m_last_error = <API key>; return 0; } h->layer = 4 - h->layer; h->error_prot = (h->error_prot) ? 0 : 1; return 1; } bool CDecompressMpeg::mp3GetHeaderInfo(BYTE* buffer, MPEG_HEADER_INFO* info) { int ch, ver; MPEG_HEADER* h =& info->header; if (!mp3GetHeader(buffer, h)) return false; info->curBitRate = br_tbl[h->version - 1][h->layer - 1][h->br_index] * 1000; switch (h->layer) { case 1: //layer1 info->curFrameSize = (12 * info->curBitRate / m_frequency + h->padding) * 4; break; case 2: //layer2 info->curFrameSize = 144 * info->curBitRate / m_frequency + h->padding; break; case 3: //layer3 if (h->version == 1) info->curFrameSize = 144 * info->curBitRate / m_frequency + h->padding; else info->curFrameSize = (144 * info->curBitRate / m_frequency) / 2 + h->padding; break; } ch = (h->mode == 3) ? 1 : 2; ver = (h->version == 1) ? 1 : 2; info->samplesInFrame = (1152 >> m_option.reduction) / ver; info->outputSize = info->samplesInFrame * 2 * ch; return true; } int CDecompressMpeg::mp3GetLastError() { return m_last_error; } int CDecompressMpeg::mp3FindSync(BYTE* buf, int size, int* sync) { int i; MPEG_HEADER h; *sync = 0; size -= 3; if (size <= 0) { m_last_error = <API key>; return 0; } for (i = 0; i < size; i++) { if (buf[i] == 0xFF) { if (mp3GetHeader(buf + i, & h)) { if ((h.layer == _layer) && (h.version == _version) && (h.br_index == _br_index) && (h.fr_index == _fr_index) && (h.mode == _mode)) break; } } } if (i == size) { m_last_error = <API key>; return 0; } *sync = i; return 1; } void CDecompressMpeg::mp3GetDecodeOption(MPEG_DECODE_OPTION* option) { *option = m_option; } int CDecompressMpeg::mp3SetDecodeOption(MPEG_DECODE_OPTION* option) { m_option = *option; return 1; } #define VBR_FRAMES_FLAG 0x0001 #define VBR_BYTES_FLAG 0x0002 #define VBR_TOC_FLAG 0x0004 #define VBR_SCALE_FLAG 0x0008 // big endian extract int CDecompressMpeg::extractInt4(BYTE* buf) { return buf[3] | (buf[2] << 8) | (buf[1] << 16) | (buf[0] << 24); } int CDecompressMpeg::mp3GetDecodeInfo(BYTE* mpeg, int size, MPEG_DECODE_INFO* info, int decFlag) { MPEG_HEADER* h =& info->header; byte* p = mpeg; int vbr; DWORD minBitRate, maxBitRate; DWORD i, j, flags; //int bitRate; //int frame_size; // if (size < 156) {//max vbr header size // m_last_error = <API key>; // return 0; if (!mp3GetHeader(p, h)) { return 0; } //check VBR Header p += 4;//skip mpeg header if (h->error_prot) p += 2;//skip crc if (h->layer == 3) { //skip side info if (h->version == 1) { //MPEG-1 if (h->mode != 3) p += 32; else p += 17; } else { //MPEG-2, MPEG-2.5 if (h->mode != 3) p += 17; else p += 9; } } info->bitRate = br_tbl[h->version - 1][h->layer - 1][h->br_index] * 1000; info->frequency = fr_tbl[h->version - 1][h->fr_index]; if (memcmp(p, "Xing", 4) == 0) { //VBR p += 4; flags = extractInt4(p); p += 4; if (!(flags & (VBR_FRAMES_FLAG | VBR_BYTES_FLAG))) { m_last_error = <API key>; return 0; } info->frames = extractInt4(p); p += 4; info->dataSize = extractInt4(p); p += 4; if (flags & VBR_TOC_FLAG) p += 100; if (flags & VBR_SCALE_FLAG) p += 4; vbr = 1; minBitRate = 0xffffffff; maxBitRate = 0; for (i = 1; i < 15; i ++) { j = br_tbl[h->version - 1][h->layer - 1][i] * 1000; if (j < minBitRate) minBitRate = j; if (j > maxBitRate) maxBitRate = j; } } else if (memcmp(p, "VBRI", 4) == 0) { //VBRI p += 10; info->dataSize = extractInt4(p); p += 4; info->frames = extractInt4(p); p += 4; vbr = 1; minBitRate = 0xffffffff; maxBitRate = 0; for (i = 1; i < 15; i ++) { j = br_tbl[h->version - 1][h->layer - 1][i] * 1000; if (j < minBitRate) minBitRate = j; if (j > maxBitRate) maxBitRate = j; } } else { //not VBR vbr = 0; info->frames = 0; //info->skipSize = 0; info->dataSize = 0; //info->bitRate = br_tbl[h->version-1][h->layer-1][h->br_index] * 1000; } // info->frequency = fr_tbl[h->version-1][h->fr_index]; // info->msPerFrame = ms_p_f_table[h->layer-1][h->fr_index]; // if (h->version == 3) info->msPerFrame *= 2; switch (h->layer) { case 1: //layer1 info->outputSize = 384 >> m_option.reduction; //if (info->bitRate) { if (!vbr) { info->skipSize = 0; info->minInputSize = (12 * info->bitRate / info->frequency) * 4;//one slot is 4 bytes long info->maxInputSize = info->minInputSize + 4; } else { info->skipSize = (12 * info->bitRate / info->frequency + h->padding) * 4; info->minInputSize = (12 * minBitRate / info->frequency) * 4; info->maxInputSize = (12 * maxBitRate / info->frequency) * 4 + 4; } break; case 2: //layer2 info->outputSize = 1152 >> m_option.reduction; //if (info->bitRate) { if (!vbr) { info->skipSize = 0; info->minInputSize = 144 * info->bitRate / info->frequency; info->maxInputSize = info->minInputSize + 1; } else { info->skipSize = 144 * info->bitRate / info->frequency + h->padding; info->minInputSize = 144 * minBitRate / info->frequency; info->maxInputSize = 144 * maxBitRate / info->frequency + 1; } break; case 3: //layer3 i = (h->version == 1) ? 1 : 2; //info->outputSize = 1152 >> m_option.reduction; info->outputSize = (1152 >> m_option.reduction) / i; //if (info->bitRate) { if (!vbr) { info->skipSize = 0; info->minInputSize = 144 * info->bitRate / info->frequency / i; info->maxInputSize = info->minInputSize + 1; } else { info->skipSize = 144 * info->bitRate / info->frequency / i + h->padding; info->minInputSize = 144 * minBitRate / info->frequency / i; info->maxInputSize = 144 * maxBitRate / info->frequency / i + 1; } break; /* if (h->version != 1) { //MPEG-2, MPEG-2.5 info->outputSize /= 2; info->minInputSize /= 2; info->maxInputSize /= 2; } info->maxInputSize ++; break; */ } if ((h->mode == 3) || (m_option.convert & 3)) info->channels = 1; else info->channels = 2; if (m_option.convert & 8) { //not available info->bitsPerSample = 8; info->outputSize *= info->channels; } else { info->bitsPerSample = 16; info->outputSize *= info->channels * 2; } if (decFlag == 1) { m_frequency = info->frequency; m_pcm_size = info->outputSize; } info->frequency >>= m_option.reduction; info->HeadBitRate = info->bitRate; if (vbr) info->bitRate = 0; return 1; } int CDecompressMpeg::mp3DecodeStart(BYTE* mpeg, int size) { MPEG_DECODE_INFO info; MPEG_HEADER* h =& info.header; if (!mp3GetDecodeInfo(mpeg, size, & info, 1)) return 0; sbt_init(); switch (h->layer) { case 1: L1decode_start(h); break; case 2: L2decode_start(h); break; case 3: L3decode_start(h); break; } return 1; } int CDecompressMpeg::mp3DecodeFrame(MPEG_DECODE_PARAM* param) { MPEG_HEADER* h =& param->header; if (param->inputSize <= 4) { m_last_error = <API key>; return 0; } if (!mp3GetHeader((unsigned char *) param->inputBuf, h)) { return 0; } param->bitRate = br_tbl[h->version - 1][h->layer - 1][h->br_index] * 1000; switch (h->layer) { //layer1 case 1: m_frame_size = (12 * param->bitRate / m_frequency + h->padding) * 4; break; //layer2 case 2: m_frame_size = 144 * param->bitRate / m_frequency + h->padding; break; //layer3 case 3: if (h->version == 1) m_frame_size = 144 * param->bitRate / m_frequency + h->padding; else m_frame_size = (144 * param->bitRate / m_frequency) / 2 + h->padding; break; } if (param->inputSize < m_frame_size) { m_last_error = <API key>; return 0; } switch (h->layer) { case 1: L1decode_frame(h, (unsigned char *) param->inputBuf, (unsigned char *) param->outputBuf); break; case 2: L2decode_frame(h, (unsigned char *) param->inputBuf, (unsigned char *) param->outputBuf); break; case 3: L3decode_frame(h, (unsigned char *) param->inputBuf, (unsigned char *) param->outputBuf); break; } //!!!todo m_frame_proc(h, (unsigned char*)param->inputBuf, (unsigned char *)param->outputBuf); param->inputSize = m_frame_size; param->outputSize = m_pcm_size; return 1; } void CDecompressMpeg::mp3Reset(void) { sbt_init(); L3decode_reset(); } int CDecompressMpeg::mp3seek(DWORD frame) { DWORD cur = 0; DWORD back = 3; int off = 0; DWORD need_frame_offset = 0; if (_curFrame != frame) { if (_curFrame != (frame - 1)) { if (frame > back) frame -= back; else { back = frame; frame = 0; } if (!_vbr) { need_frame_offset = (DWORD) floor(((double) frame * _bitPerFrame) / 8); while (1) { if (SourceData->seek(need_frame_offset, 0) != need_frame_offset) return 0; if (SourceData->eof()) return 0; if (SourceData->peek(_frameBuffer, _minFrameSize) != _minFrameSize) return 0; if (!mp3FindSync(_frameBuffer, _minFrameSize, & off)) { need_frame_offset += (_minFrameSize - 3); } else { need_frame_offset += off; break; } }; } else { need_frame_offset = _vbrFrameOffTable[frame]; } if (SourceData->seek(need_frame_offset, 0) != need_frame_offset) return 0; mp3Reset(); for (int ch = 0; ch < 2; ch++) { for (int gr = 0; gr < 2; gr++) { for (int sam = 0; sam < 576; sam++) { m_sample[ch][gr][sam].s = 0; m_sample[ch][gr][sam].x = 0; } } } for (cur = 0; cur < back; cur++) { SourceData->peek(_frameBuffer, 4); if (!mp3GetHeaderInfo(_frameBuffer, & _mpegHI)) return 0; _curFrameSize = _mpegHI.curFrameSize; if (SourceData->read(_frameBuffer, _curFrameSize) != _curFrameSize) return 0; _mpegDP.header = _mpegHI.header; _mpegDP.bitRate = _mpegHI.curBitRate; _mpegDP.inputBuf = _frameBuffer; _mpegDP.inputSize = _mpegHI.curFrameSize; _mpegDP.outputBuf = _sampleBuffer; _mpegDP.outputSize = _mpegHI.outputSize; if (!mp3DecodeFrame(&_mpegDP)) return 0; } } } return 1; } CDecompressMpeg::CDecompressMpeg(WAVEFORMATEX* pcm_format, bool& flag, CAbstractSoundFile* a) : <API key>(pcm_format, flag, a) { DWORD cur; DWORD pos; MPEG_HEADER_INFO info; BYTE head[156]; flag = false; mp3DecodeInit(); m_cs_factorL1 = m_cs_factor[0]; // m_enableEQ = 0; memset(&m_side_info, 0, sizeof(SIDE_INFO)); memset(&m_scale_fac, 0, sizeof(SCALE_FACTOR) * 4); memset(&m_cb_info, 0, sizeof(CB_INFO) * 4); memset(&m_nsamp, 0, sizeof(int) * 4); _frameBuffer = 0; _vbr = 0; _vbrFrameOffTable = 0; if (SourceData->peek(head, sizeof(head)) != sizeof(head)) return; if (!mp3GetDecodeInfo(head, sizeof(head), & _mpegDI, 1)) return; if (!mp3GetHeaderInfo(head, & _mpegHI)) return; _channels = _mpegDI.channels; _frequency = _mpegDI.frequency; _bitrate = _mpegDI.HeadBitRate; _vbr = _mpegDI.bitRate ? false : true; _minFrameSize = _mpegDI.minInputSize; _maxFrameSize = _mpegDI.maxInputSize; _samplesInFrame = _mpegHI.samplesInFrame; _curFrameSize = _mpegHI.curFrameSize; _version = _mpegDI.header.version; _layer = _mpegDI.header.layer; _br_index = _mpegDI.header.br_index; _fr_index = _mpegDI.header.fr_index; _mode = _mpegDI.header.mode; _slotSize = (_mpegDI.header.layer == 1) ? 4 : 1; _bitPerFrame = (_mpegDI.header.version == 1) ? (double) (144 * 8 * _bitrate) / (double) _frequency : (double) (144 * 8 * _bitrate) / (double) (_frequency * 2); _frames = _vbr ? _mpegDI.frames : (DWORD) floor(((double) ((SourceData->size + _slotSize) * 8)) / _bitPerFrame); _samplesInFile = _frames * _samplesInFrame;
import { moduleForModel, test } from 'ember-qunit'; import Pretender from 'pretender'; // ToDo: Install ember-cli-faker import mocks from './mocks'; const { inventoryMock, productMock, componentsMock } = mocks; let mockServer; moduleForModel('inventory', 'Unit | Serializer | inventory', { needs: ['serializer:application', 'model:product', 'model:inventory', 'model:component'], beforeEach() { mockServer = new Pretender(function() { this.get('/products', function() { const response = { records: [productMock] }; return [200, { "Content-Type": "application/json" }, JSON.stringify(response)]; }); this.get(`/products/${productMock.id}`, function() { return [200, { "Content-Type": "application/json" }, JSON.stringify(productMock)]; }); this.get('/inventories', function() { const response = { records: [inventoryMock] }; return [200, { "Content-Type": "application/json" }, JSON.stringify(response)]; }); this.get(`/components/${componentsMock[0].id}`, function() { return [200, { "Content-Type": "application/json" }, JSON.stringify(componentsMock[0])]; }); this.get(`/components/${componentsMock[1].id}`, function() { return [200, { "Content-Type": "application/json" }, JSON.stringify(componentsMock[1])]; }); }); }, afterEach() { mockServer.shutdown(); } }); test('it serializes records', function(assert) { return this.store().findAll('inventory').then((inventories) => { assert.equal(inventories.get('length'), 1); const inventory = inventories.objectAt(0); assert.ok(inventory.get('created')); assert.equal(inventory.get('qty'), inventoryMock.fields['qty']); assert.equal(inventory.get('restock-at'), inventoryMock.fields['restock-at']); }); }); test('it serializes belongsTo relationship', function(assert) { return this.store().findAll('inventory').then((inventories) => { const inventory = inventories.objectAt(0); inventory.get('product').then((product) => { assert.equal(product.get('name'), productMock.fields.name); assert.equal(product.get('description'), productMock.fields.description); }); }); }); test('it serializes hasMany relationship', function(assert) { return this.store().findAll('product').then((products) => { const product = products.objectAt(0); product.get('components').then((components) => { components.forEach((component, index) => { assert.equal(component.get('name'), componentsMock[index].fields.name); }); }); }); });
# Acknowledgements This application makes use of the following third party libraries: ## FMDB If you are using FMDB in your project, I'd love to hear about it. Let Gus know by sending an email to gus@flyingmeat.com. And if you happen to come across either Gus Mueller or Rob Ryan in a bar, you might consider purchasing a drink of their choosing if FMDB has been useful to you. Finally, and shortly, this is the MIT License. Copyright (c) 2008-2014 Flying Meat Inc. 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. ## MBProgressHUD Copyright (c) 2009-2015 Matej Bukovinski 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. Generated by CocoaPods - http://cocoapods.org
package com.asksunny.batch.tasklets; public class Demo1 { long id; String name; public Demo1() { } public long getId() { return id; } public void setId(long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
package net.glowstone.net.codec.play.game; import com.flowpowered.network.Codec; import io.netty.buffer.ByteBuf; import java.io.IOException; import net.glowstone.net.GlowBufUtils; import net.glowstone.net.message.play.game.<API key>; import net.glowstone.util.nbt.CompoundTag; import org.bukkit.util.BlockVector; public final class <API key> implements Codec<<API key>> { @Override public <API key> decode(ByteBuf buffer) throws IOException { BlockVector pos = GlowBufUtils.readBlockPosition(buffer); int action = buffer.readByte(); CompoundTag nbt = GlowBufUtils.readCompound(buffer); return new <API key>(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ(), action, nbt); } @Override public ByteBuf encode(ByteBuf buf, <API key> message) throws IOException { GlowBufUtils.writeBlockPosition(buf, message.getX(), message.getY(), message.getZ()); buf.writeByte(message.getAction()); GlowBufUtils.writeCompound(buf, message.getNbt()); return buf; } }
// <summary> // Part of the Deployment Tools Foundation project. // </summary> namespace Microsoft.PackageManagement.Archivers.Internal.Compression { using System; using System.IO; <summary> Duplicates a source stream by maintaining a separate position. </summary> <remarks> WARNING: duplicate streams are not thread-safe with respect to each other or the original stream. If multiple threads use duplicate copies of the same stream, they must synchronize for any operations. </remarks> public class DuplicateStream : Stream { private Stream source; private long position; <summary> Creates a new duplicate of a stream. </summary> <param name="source">source of the duplicate</param> public DuplicateStream(Stream source) { if (source == null) { throw new <API key>("source"); } this.source = DuplicateStream.OriginalStream(source); } <summary> Gets the original stream that was used to create the duplicate. </summary> public Stream Source { get { return this.source; } } <summary> Gets a value indicating whether the source stream supports reading. </summary> <value>true if the stream supports reading; otherwise, false.</value> public override bool CanRead { get { return this.source.CanRead; } } <summary> Gets a value indicating whether the source stream supports writing. </summary> <value>true if the stream supports writing; otherwise, false.</value> public override bool CanWrite { get { return this.source.CanWrite; } } <summary> Gets a value indicating whether the source stream supports seeking. </summary> <value>true if the stream supports seeking; otherwise, false.</value> public override bool CanSeek { get { return this.source.CanSeek; } } <summary> Gets the length of the source stream. </summary> public override long Length { get { return this.source.Length; } } <summary> Gets or sets the position of the current stream, ignoring the position of the source stream. </summary> public override long Position { get { return this.position; } set { this.position = value; } } <summary> Retrieves the original stream from a possible duplicate stream. </summary> <param name="stream">Possible duplicate stream.</param> <returns>If the stream is a DuplicateStream, returns the duplicate's source; otherwise returns the same stream.</returns> public static Stream OriginalStream(Stream stream) { DuplicateStream dupStream = stream as DuplicateStream; return dupStream != null ? dupStream.Source : stream; } <summary> Flushes the source stream. </summary> public override void Flush() { this.source.Flush(); } <summary> Sets the length of the source stream. </summary> <param name="value">The desired length of the stream in bytes.</param> public override void SetLength(long value) { this.source.SetLength(value); } #if !CORECLR <summary> Closes the underlying stream, effectively closing ALL duplicates. </summary> public override void Close() { this.source.Close(); } #endif <summary> Disposes the stream </summary> <param name="disposing"></param> protected override void Dispose(bool disposing) { if (disposing) { this.source.Dispose(); } } <summary> Reads from the source stream while maintaining a separate position and not impacting the source stream's position. </summary> <param name="buffer">An array of bytes. When this method returns, the buffer contains the specified byte array with the values between offset and (offset + count - 1) replaced by the bytes read from the current source.</param> <param name="offset">The zero-based byte offset in buffer at which to begin storing the data read from the current stream.</param> <param name="count">The maximum number of bytes to be read from the current stream.</param> <returns>The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero (0) if the end of the stream has been reached.</returns> public override int Read(byte[] buffer, int offset, int count) { long saveSourcePosition = this.source.Position; this.source.Position = this.position; int read = this.source.Read(buffer, offset, count); this.position = this.source.Position; this.source.Position = saveSourcePosition; return read; } <summary> Writes to the source stream while maintaining a separate position and not impacting the source stream's position. </summary> <param name="buffer">An array of bytes. This method copies count bytes from buffer to the current stream.</param> <param name="offset">The zero-based byte offset in buffer at which to begin copying bytes to the current stream.</param> <param name="count">The number of bytes to be written to the current stream.</param> public override void Write(byte[] buffer, int offset, int count) { long saveSourcePosition = this.source.Position; this.source.Position = this.position; this.source.Write(buffer, offset, count); this.position = this.source.Position; this.source.Position = saveSourcePosition; } <summary> Changes the position of this stream without impacting the source stream's position. </summary> <param name="offset">A byte offset relative to the origin parameter.</param> <param name="origin">A value of type SeekOrigin indicating the reference point used to obtain the new position.</param> <returns>The new position within the current stream.</returns> public override long Seek(long offset, SeekOrigin origin) { long originPosition = 0; if (origin == SeekOrigin.Current) { originPosition = this.position; } else if (origin == SeekOrigin.End) { originPosition = this.Length; } this.position = originPosition + offset; return this.position; } } }
+(function () { 'use strict'; angular .module('<API key>') .controller('<API key>', ['$scope', '$q', 'Event', 'FoldersRest', <API key>]); function <API key>($scope, $q, Event, FoldersRest) { var vm = this; var folderId = $scope.ngDialogData.folderId; vm.removeFolder = removeFolder; function removeFolder() { var id = folderId; var $defer = $q.defer(); FoldersRest.one(id).remove().then(function () { console.log("FoldersRest"); debugger; Event.publish('<API key>'); alert('فولدر با موفقیت حذف شد', 'انجام شد!'); $defer.resolve(); }, function (error) { $defer.reject(error); }); return $defer.promise; } } })();
package co.colector.model.request; import java.util.ArrayList; import java.util.List; import co.colector.ColectorApplication; import co.colector.R; import co.colector.model.IdInputValue; import co.colector.model.IdValue; import co.colector.model.Survey; import co.colector.model.AnswerValue; import co.colector.session.AppSession; import co.colector.utils.NetworkUtils; public class SendSurveyRequest { private String colector_id; private String form_id; private String longitud; private String latitud; private String horaini; private String horafin; private List<IdInputValue> responses; public SendSurveyRequest(Survey survey) { this.colector_id = String.valueOf(AppSession.getInstance().getUser().getColector_id()); this.form_id = String.valueOf(survey.getForm_id()); this.longitud = survey.<API key>(); this.latitud = survey.getInstanceLatitude(); this.horaini = survey.getInstanceHoraIni(); this.horafin = survey.getInstanceHoraFin(); this.setResponsesData(survey.getInstanceAnswers()); } public List<IdInputValue> getResponses() { return responses; } public void setResponses(List<IdInputValue> responses) { this.responses = responses; } private void setResponsesData(List<IdValue> responsesData) { responses = new ArrayList<>(); for (IdValue item : responsesData) { switch (item.getmType()) { case 6: case 14: case 16: for (AnswerValue answerValue : item.getValue()) if (!answerValue.getValue().equals("")) { int lastIndex = answerValue.getValue().length(); int slashIndex = answerValue.getValue().lastIndexOf("/"); responses.add(new IdInputValue(String.valueOf(item.getId()), ColectorApplication.getInstance().getString(R.string.image_name_format, NetworkUtils.getAndroidID(ColectorApplication.getInstance()), answerValue.getValue().substring((slashIndex + 1), lastIndex)))); } break; default: for (AnswerValue answerValue : item.getValue()) responses.add(new IdInputValue(String.valueOf(item.getId()), answerValue.getValue())); } } } }
package controllers import ( "github.com/revel/revel" "AuthKeyPush/app/models" ) type Auth struct { *revel.Controller } func (c Auth) Github(code string) revel.Result { login := models.GitHub(code) if login == true { c.Session["login"] = "true" } else { c.Session["login"] = "false" c.Session["msg"] = "Login faied. Check conf/site.json or README.md" } return c.Redirect("/") }
// VisibleBuildConfig.h // VisibleBuildConfig #import <Foundation/Foundation.h> #define <API key> @"<API key>" @interface VisibleBuildConfig : NSObject //ConfigName is reqired and unique @property(nonatomic, strong) NSString *configName; + (instancetype)sharedInstance; //setup configuration data with plist - (void)setupWithPlist:(NSString *)plistFile; //Fix to use the build config with Release parameter valued YES. If no Release, use the first. - (void)setAsRelease; //Enable left swipe to show build config browser - (void)enableSwipe; //Show build config browser - (void)showConfigBrowser; //Get value with key from the current build config data - (id)configValueForKey:(NSString *)key; @end
/** * @module {Module} utils/math * @parent utils * * The module's description is the first paragraph. * * The body of the module's documentation. */ import _ from 'lodash'; /** * @function * * This function's description is the first * paragraph. * * This starts the body. This text comes after the signature. * * @param {Number} first This param's description. * @param {Number} second This param's description. * @return {Number} This return value's description. */ export function sum(first, second){ ... }; /** * @property {{}} * * This function's description is the first * paragraph. * * @option {Number} pi The description of pi. * * @option {Number} e The description of e. */ export var constants = { pi: 3.14159265359, e: 2.71828 };
# dotfiles My config files for linux Looking for a sane default vimrc? wget https://raw.githubusercontent.com/ekohilas/dotfiles/master/.vimrc.default -O ~/.vimrc Want the DarkIdle Colorscheme? wget https://raw.githubusercontent.com/ekohilas/dotfiles/master/.vim/colors/DarkIdle.vim -O ~/.vim/colors/DarkIdle.vim Don't forget to add ```colorscheme DarkIdle``` to your .vimrc
<?php /* WebProfilerBundle:Collector:router.html.twig */ class <API key> extends Twig_Template { public function __construct(Twig_Environment $env) { parent::__construct($env); // line 1 $this->parent = $this->loadTemplate("@WebProfiler/Profiler/layout.html.twig", "WebProfilerBundle:Collector:router.html.twig", 1); $this->blocks = array( 'toolbar' => array($this, 'block_toolbar'), 'menu' => array($this, 'block_menu'), 'panel' => array($this, 'block_panel'), ); } protected function doGetParent(array $context) { return "@WebProfiler/Profiler/layout.html.twig"; } protected function doDisplay(array $context, array $blocks = array()) { $<API key> = $this->env->getExtension("Symfony\\Bundle\\WebProfilerBundle\\Twig\\<API key>"); $<API key>->enter($<API key> = new <API key>($this->getTemplateName(), "template", "WebProfilerBundle:Collector:router.html.twig")); $<API key> = $this->env->getExtension("Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"); $<API key>->enter($<API key> = new <API key>($this->getTemplateName(), "template", "WebProfilerBundle:Collector:router.html.twig")); $this->parent->display($context, array_merge($this->blocks, $blocks)); $<API key>->leave($<API key>); $<API key>->leave($<API key>); } // line 3 public function block_toolbar($context, array $blocks = array()) { $<API key> = $this->env->getExtension("Symfony\\Bundle\\WebProfilerBundle\\Twig\\<API key>"); $<API key>->enter($<API key> = new <API key>($this->getTemplateName(), "block", "toolbar")); $<API key> = $this->env->getExtension("Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"); $<API key>->enter($<API key> = new <API key>($this->getTemplateName(), "block", "toolbar")); $<API key>->leave($<API key>); $<API key>->leave($<API key>); } // line 5 public function block_menu($context, array $blocks = array()) { $<API key> = $this->env->getExtension("Symfony\\Bundle\\WebProfilerBundle\\Twig\\<API key>"); $<API key>->enter($<API key> = new <API key>($this->getTemplateName(), "block", "menu")); $<API key> = $this->env->getExtension("Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"); $<API key>->enter($<API key> = new <API key>($this->getTemplateName(), "block", "menu")); // line 6 echo "<span class=\"label\"> <span class=\"icon\">"; // line 7 echo twig_include($this->env, $context, "@WebProfiler/Icon/router.svg"); echo "</span> <strong>Routing</strong> </span> "; $<API key>->leave($<API key>); $<API key>->leave($<API key>); } // line 12 public function block_panel($context, array $blocks = array()) { $<API key> = $this->env->getExtension("Symfony\\Bundle\\WebProfilerBundle\\Twig\\<API key>"); $<API key>->enter($<API key> = new <API key>($this->getTemplateName(), "block", "panel")); $<API key> = $this->env->getExtension("Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"); $<API key>->enter($<API key> = new <API key>($this->getTemplateName(), "block", "panel")); // line 13 echo " "; echo $this->env->getRuntime('Symfony\Bridge\Twig\Extension\HttpKernelRuntime')->renderFragment($this->env->getExtension('Symfony\Bridge\Twig\Extension\RoutingExtension')->getPath("_profiler_router", array("token" => (isset($context["token"]) ? $context["token"] : $this->getContext($context, "token"))))); echo " "; $<API key>->leave($<API key>); $<API key>->leave($<API key>); } public function getTemplateName() { return "WebProfilerBundle:Collector:router.html.twig"; } public function isTraitable() { return false; } public function getDebugInfo() { return array ( 94 => 13, 85 => 12, 71 => 7, 68 => 6, 59 => 5, 42 => 3, 11 => 1,); } /** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */ public function getSource() { @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED); return $this->getSourceContext()->getCode(); } public function getSourceContext() { return new Twig_Source("{% extends '@WebProfiler/Profiler/layout.html.twig' %} {% block toolbar %}{% endblock %} {% block menu %} <span class=\"label\"> <span class=\"icon\">{{ include('@WebProfiler/Icon/router.svg') }}</span> <strong>Routing</strong> </span> {% endblock %} {% block panel %} {{ render(path('_profiler_router', { token: token })) }} {% endblock %} ", "WebProfilerBundle:Collector:router.html.twig", "/Applications/MAMP/htdocs/Symfony/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/router.html.twig"); } }
<!doctype html> <html lang="en" xmlns="http: <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>Photo - A History of UCSF</title> <link href='http://fonts.googleapis.com/css?family=Gilda+Display%7CPT+Sans+Narrow:300' rel='stylesheet' type='text/css'> <link href="ucsf_history.css" rel="stylesheet" type="text/css" media="all" /> {% include google_analytics.html %} </head> <body> <div id="mainbody"> {% include ucsf_banner.html %} <div class="banner"><h1><a href="/">A History of UCSF</a></h1></div> <div id="insidebody"> <div id="photocopy"> <div id="photocopy_text"><h2 class="title"><span class="title-primary">Photos</span></h2> <div id="subhead">William Searby (1835-1909)</div> <br /> <img src="images/pictures/Searby.jpg" width="550" height="563"/><br /> <br/> <br/><br/> <br/> </div> </div> <div id="sidebar"> <div id="sidenav_inside">{% include search_include.html %}<br /> <div id="sidenavtype"> <a href="story.html" class="sidenavtype"><strong>THE STORY</strong></a><br/> <br/> <a href="special_topics.html" class="sidenavtype"><strong>SPECIAL TOPICS</strong></a><br/><br/> <a href="people.html" class="sidenavtype"><strong>PEOPLE</strong></a><br/> <br/> <div id="<API key>"><strong><a href="photos.html" class="<API key>">PHOTOS</a></strong></div> <br/> <a href="buildings.html" class="sidenavtype"><strong>BUILDINGS</strong></a><br/> <br/> <a href="index.html" class="sidenavtype"><strong>HOME</strong></a></div> </div> </div> </div> {% include footer.html %} </div> {% include bottom_js.html %} </body> </html>
<div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title">Relationships</h3> </div> <div class="panel-body"> <div ng-repeat="relationship in contactGroupMember.Relationships"> <div class="form-group"> <label for="inputRelationship" class="col-sm-2 control-label">Relationship</label> <div class="col-sm-10"> <input type="text" class="form-control" id="inputRelationship" placeholder="Relationship" ng-model="relationship.Name" /> </div> </div> <div class="form-group"> <div class="col-sm-10 col-sm-offset-2"> <button type="button" class="btn btn-default btn-xs" ng-click="contactGroupMember.removeRelationship(relationship)"><span class="glyphicon glyphicon-remove"></span> Remove</button> </div> </div> </div> <div class="form-group"> <div class="col-sm-12"> <button type="button" class="btn btn-default btn-xs" ng-click="contactGroupMember.addRelationship('')"><span class="glyphicon glyphicon-plus"></span> Add a Relationship</button> </div> </div> </div> </div>
// This example plugins/index.js can be used to load plugins // You can change the location of this file or turn off loading // the plugins file with the 'pluginsFile' configuration option. // You can read more here: // This function is called when a project is opened or re-opened (e.g. due to // the project's config changing) module.exports = (on, config) => { // `on` is used to hook into various events Cypress emits // `config` is the resolved Cypress config if (process.env.<API key>) { on(`before:browser:launch`, (browser = {}, args) => { if ( browser.name === `chrome` && process.env.<API key> === `slow` ) { args.push(`--<API key>=2G`) } return args }) } }
#!/bin/bash # ./run pixel_inicio pixel_final pixel_paso frecuencia_inicio frecuencia_final # frecuencia_paso resolucion_espacial Rt modelo path COUNTERX=$1 while [ $COUNTERX -le $2 ]; do if [ ! -d "/home/vdelaluz/ARTs/papers/cavity2D/data/SEL05/${COUNTERX}" ]; then # Control will enter here if $DIRECTORY doesn't exist mkdir /home/vdelaluz/ARTs/papers/cavity2D/data/SEL05/${COUNTERX} fi COUNTER=$4 while [ $COUNTER -le $5 ]; do echo Computing $COUNTERX $COUNTER mpiexec -n 1 ./pakal -model $9 -min 1e-40 -r $7 -xy ${COUNTERX} 0 -detail 1 -big 1 -nu ${COUNTER} -Rt $8 -h 7.353e5 -f -7.36e5 -v 10 > /home/vdelaluz/ARTs/papers/cavity2D/data/SEL05/${COUNTERX}/${COUNTER}GHz.dat mv emission_${COUNTERX}_0.dat /home/vdelaluz/ARTs/papers/cavity2D/data/SEL05/${COUNTERX}/${COUNTER}GHz_emission_0_0.dat mv profile_${COUNTERX}_0.dat /home/vdelaluz/ARTs/papers/cavity2D/data/SEL05/${COUNTERX}/${COUNTER}GHz_profile_0_0.dat let COUNTER=COUNTER+$6 done let COUNTERX=COUNTERX+$3 done
<p> Yo </p> <div *ngFor ="let task of taskList;let i=index;" style="padding:10px;width:100%;"> <input type="checkbox" name="task" value= "xyz" [checked]="task.status!=='N'">{{task.name}} <br> <button (click)="clearTask(task)" style="display:inline-block;">Delete</button> </div> <div> <input type= "text" name ="enterTask" [(ngModel)]="taskName"> <button (click)="addTask()" class="btn-primary">Add</button> </div>
<?php if ($_SESSION['manager']==""){ header("Location: admin_login.php"); exit; }; header("Location: admin_index.php"); ?>
using UnityEngine; using UnityEditor; using CreateThis.Factory.VR.UI.Button; namespace MMVR.Factory.UI.Button { [CustomEditor(typeof(<API key>))] [<API key>] public class <API key> : <API key> { SerializedProperty fileManager; protected override void OnEnable() { base.OnEnable(); fileManager = serializedObject.FindProperty("fileManager"); } protected override void BuildGenerateButton() { if (GUILayout.Button("Generate")) { if (target.GetType() == typeof(<API key>)) { <API key> buttonFactory = (<API key>)target; buttonFactory.Generate(); } } } protected override void <API key>() { base.<API key>(); EditorGUILayout.PropertyField(fileManager); } } }
var box, mbox; function demo() { cam ( 0, 20, 40 ); world = new OIMO.World(); world.add({ size:[50, 10, 50], pos:[0,-5,0] }); // ground var options = { type:'box', size:[10, 10, 10], pos:[0,20,0], density:1, move:true } box = world.add( options ); mbox = view.add( options ); // three mesh }; function update () { world.step(); mbox.position.copy( box.getPosition() ); mbox.quaternion.copy( box.getQuaternion() ); }
class CreateCourses < ActiveRecord::Migration def change create_table :courses do |t| t.string :name t.string :short_name t.string :sisid t.text :description t.integer :department_id t.integer :term_id t.boolean :graded t.boolean :archived t.string :type t.timestamps end end end
// AppDelegate.h // topController #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <<API key>> @property (strong, nonatomic) UIWindow *window; @end
import traceback class <API key>: """Helper for ensuring that Future's exceptions were handled. This solves a nasty problem with Futures and Tasks that have an exception set: if nobody asks for the exception, the exception is never logged. This violates the Zen of Python: 'Errors should never pass silently. Unless explicitly silenced.' However, we don't want to log the exception as soon as set_exception() is called: if the calling code is written properly, it will get the exception and handle it properly. But we *do* want to log it if result() or exception() was never called -- otherwise developers waste a lot of time wondering why their buggy code fails silently. An earlier attempt added a __del__() method to the Future class itself, but this backfired because the presence of __del__() prevents garbage collection from breaking cycles. A way out of this catch-22 is to avoid having a __del__() method on the Future class itself, but instead to have a reference to a helper object with a __del__() method that logs the traceback, where we ensure that the helper object doesn't participate in cycles, and only the Future has a reference to it. The helper object is added when set_exception() is called. When the Future is collected, and the helper is present, the helper object is also collected, and its __del__() method will log the traceback. When the Future's result() or exception() method is called (and a helper object is present), it removes the the helper object, after calling its clear() method to prevent it from logging. One downside is that we do a fair amount of work to extract the traceback from the exception, even when it is never logged. It would seem cheaper to just store the exception object, but that references the traceback, which references stack frames, which may reference the Future, which references the <API key>, and then the <API key> would be included in a cycle, which is what we're trying to avoid! As an optimization, we don't immediately format the exception; we only do the work when activate() is called, which call is delayed until after all the Future's callbacks have run. Since usually a Future has at least one callback (typically set by 'yield from') and usually that callback extracts the callback, thereby removing the need to format the exception. PS. I don't claim credit for this solution. I first heard of it in a discussion about closing files when they are collected. """ __slots__ = ['exc', 'tb', 'hndl', 'cls'] def __init__(self, exc, handler): self.exc = exc self.hndl = handler self.cls = type(exc) self.tb = None def activate(self): exc = self.exc if exc is not None: self.exc = None self.tb = traceback.format_exception(exc.__class__, exc, exc.__traceback__) def clear(self): self.exc = None self.tb = None def __del__(self): if self.tb: self.hndl(self.cls, self.tb)
module GitNetworkitis class Getter include HTTParty include JSONHelper base_uri 'https://api.github.com' attr_accessor :url, :local_options, :query_options LOCAL_KEYS = [:batch, :since] def initialize(url, options={}) @url = url scrub_local_options options @query_options = options end def get local_options[:batch] ? batched_get : single_get end private def scrub_local_options(options={}) @local_options = LOCAL_KEYS.inject({}) {|opts, key| opts[key] = options.delete(key); opts } @local_options[:batch] = true unless @local_options[:since].nil? end def single_get(use_query_options=true) ret = use_query_options ? Getter.get(url, query: query_options) : Getter.get(url) if ret.response.code == "200" return ret else raise "Unable to find Github Repository" end end def batched_get resps = [] links = {next: url} first_batch = true while links[:next] do self.url = links[:next] resp = single_get first_batch resps << resp first_batch = false links = <API key> resp.headers['link'] end BatchResponse.new resps end # see the json files in spec/vcr_cassettes for examples of what the link headers look like def <API key>(headers) return {} if headers.nil? links = headers.split(',') links.inject({}) do |rel, link| l = link.strip.split(';') next_link = l.first[1...-1] # [1...-1] because the actual link is enclosed within '<' '>' tags rel_command = l.last.strip.match(/rel=\"(.*)\"/).captures.first.to_sym # e.g. "rel=\"next\"" #=> :next rel.tap {|r| r[rel_command] = next_link } end end end end
<!DOCTYPE html><html><head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=Edge"> <meta name="description"> <meta name="keywords" content="static content generator,static site generator,static site,HTML,web development,.NET,C#,Razor,Markdown,YAML"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="shortcut icon" href="/OpenTl.Schema/assets/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="/OpenTl.Schema/assets/img/favicon.ico" type="image/x-icon"> <title>OpenTl.Schema - API - IChannelDifference Interface</title> <link href="/OpenTl.Schema/assets/css/mermaid.css" rel="stylesheet"> <link href="/OpenTl.Schema/assets/css/highlight.css" rel="stylesheet"> <link href="/OpenTl.Schema/assets/css/bootstrap/bootstrap.css" rel="stylesheet"> <link href="/OpenTl.Schema/assets/css/adminlte/AdminLTE.css" rel="stylesheet"> <link href="/OpenTl.Schema/assets/css/theme/theme.css" rel="stylesheet"> <link href="//fonts.googleapis.com/css?family=Roboto+Mono:400,700|Roboto:400,400i,700,700i" rel="stylesheet"> <link href="/OpenTl.Schema/assets/css/font-awesome.min.css" rel="stylesheet" type="text/css"> <link href="/OpenTl.Schema/assets/css/override.css" rel="stylesheet"> <script src="/OpenTl.Schema/assets/js/jquery-2.2.3.min.js"></script> <script src="/OpenTl.Schema/assets/js/bootstrap.min.js"></script> <script src="/OpenTl.Schema/assets/js/app.min.js"></script> <script src="/OpenTl.Schema/assets/js/highlight.pack.js"></script> <script src="/OpenTl.Schema/assets/js/jquery.slimscroll.min.js"></script> <script src="/OpenTl.Schema/assets/js/jquery.sticky-kit.min.js"></script> <script src="/OpenTl.Schema/assets/js/mermaid.min.js"></script> <!--[if lt IE 9]> <script src="/OpenTl.Schema/assets/js/html5shiv.min.js"></script> <script src="/OpenTl.Schema/assets/js/respond.min.js"></script> <![endif] </head> <body class="hold-transition wyam layout-boxed "> <div class="top-banner"></div> <div class="wrapper with-container"> <!-- Header --> <header class="main-header"> <a href="/OpenTl.Schema/" class="logo"> <span>OpenTl.Schema</span> </a> <nav class="navbar navbar-static-top" role="navigation"> <!-- Sidebar toggle button--> <a href="#" class="sidebar-toggle visible-xs-block" data-toggle="offcanvas" role="button"> <span class="sr-only">Toggle side menu</span> <i class="fa <API key>"></i> </a> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse"> <span class="sr-only">Toggle side menu</span> <i class="fa <API key>"></i> </button> </div> <!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse pull-left" id="navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="/OpenTl.Schema/about.html">About This Project</a></li> <li class="active"><a href="/OpenTl.Schema/api">API</a></li> </ul> </div> <!-- /.navbar-collapse --> <!-- Navbar Right Menu --> </nav> </header> <!-- Left side column. contains the logo and sidebar --> <aside class="main-sidebar "> <section class="infobar" data-spy="affix" data-offset-top="60" data-offset-bottom="200"> <div id="infobar-headings"><h6>On This Page</h6><p><a href="#Syntax">Syntax</a></p> <p><a href="#ExtensionMethods">Extension Methods</a></p> <hr class="infobar-hidden"> </div> </section> <section class="sidebar"> <script src="/OpenTl.Schema/assets/js/lunr.min.js"></script> <script src="/OpenTl.Schema/assets/js/searchIndex.js"></script> <div class="sidebar-form"> <div class="input-group"> <input type="text" name="search" id="search" class="form-control" placeholder="Search Types..."> <span class="input-group-btn"> <button class="btn btn-flat"><i class="fa fa-search"></i></button> </span> </div> </div> <div id="search-results"> </div> <script> function runSearch(query){ $("#search-results").empty(); if( query.length < 2 ){ return; } var results = searchModule.search("*" + query + "*"); var listHtml = "<ul class='sidebar-menu'>"; listHtml += "<li class='header'>Type Results</li>"; if(results.length == 0 ){ listHtml += "<li>No results found</li>"; } else { for(var i = 0; i < results.length; ++i){ var res = results[i]; listHtml += "<li><a href='" + res.url + "'>" + htmlEscape(res.title) + "</a></li>"; } } listHtml += "</ul>"; $("#search-results").append(listHtml); } $(document).ready(function(){ $("#search").on('input propertychange paste', function() { runSearch($("#search").val()); }); }); function htmlEscape(html) { return document.createElement('div') .appendChild(document.createTextNode(html)) .parentNode .innerHTML; } </script> <hr> <ul class="sidebar-menu"> <li class="header">Namespace</li> <li><a href="/OpenTl.Schema/api/OpenTl.Schema.Updates">OpenTl<wbr>.Schema<wbr>.Updates</a></li> <li role="separator" class="divider"></li> <li class="header">Class Types</li> <li><a href="/OpenTl.Schema/api/OpenTl.Schema.Updates/<API key>">Request<wbr>Get<wbr>Channel<wbr>Difference</a></li> <li><a href="/OpenTl.Schema/api/OpenTl.Schema.Updates/<API key>"><API key></a></li> <li><a href="/OpenTl.Schema/api/OpenTl.Schema.Updates/RequestGetState">RequestGetState</a></li> <li><a href="/OpenTl.Schema/api/OpenTl.Schema.Updates/TChannelDifference">TChannelDifference</a></li> <li><a href="/OpenTl.Schema/api/OpenTl.Schema.Updates/<API key>">T<wbr>Channel<wbr>Difference<wbr>Empty</a></li> <li><a href="/OpenTl.Schema/api/OpenTl.Schema.Updates/<API key>">T<wbr>Channel<wbr>Difference<wbr>Too<wbr>Long</a></li> <li><a href="/OpenTl.Schema/api/OpenTl.Schema.Updates/TDifference">TDifference</a></li> <li><a href="/OpenTl.Schema/api/OpenTl.Schema.Updates/TDifferenceEmpty">TDifferenceEmpty</a></li> <li><a href="/OpenTl.Schema/api/OpenTl.Schema.Updates/TDifferenceSlice">TDifferenceSlice</a></li> <li><a href="/OpenTl.Schema/api/OpenTl.Schema.Updates/TDifferenceTooLong">TDifferenceTooLong</a></li> <li><a href="/OpenTl.Schema/api/OpenTl.Schema.Updates/TState">TState</a></li> <li class="header">Interface Types</li> <li class="selected"><a href="/OpenTl.Schema/api/OpenTl.Schema.Updates/IChannelDifference">IChannelDifference</a></li> <li><a href="/OpenTl.Schema/api/OpenTl.Schema.Updates/<API key>">I<wbr>Channel<wbr>Difference<wbr>Common</a></li> <li><a href="/OpenTl.Schema/api/OpenTl.Schema.Updates/IDifference">IDifference</a></li> <li><a href="/OpenTl.Schema/api/OpenTl.Schema.Updates/IDifferenceCommon">IDifferenceCommon</a></li> <li><a href="/OpenTl.Schema/api/OpenTl.Schema.Updates/IState">IState</a></li> </ul> </section> </aside> <!-- Content Wrapper. Contains page content --> <div class="content-wrapper"> <section class="content-header"> <h1>IChannelDifference <small>Interface</small></h1> </section> <section class="content"> <div class="panel panel-default"> <div class="panel-body"> <div class="row"> <div class="col-md-6"> <dl class="dl-horizontal"> <dt>Namespace</dt> <dd><a href="/OpenTl.Schema/api/OpenTl.Schema.Updates">OpenTl<wbr>.Schema<wbr>.Updates</a></dd> <dt>Interfaces</dt> <dd> <ul class="list-unstyled"> <li><a href="/OpenTl.Schema/api/OpenTl.Schema/IObject">IObject</a></li> </ul> </dd> <dt>Implementing Types</dt> <dd> <ul class="list-unstyled"> <li><a href="/OpenTl.Schema/api/OpenTl.Schema.Updates/TChannelDifference">TChannelDifference</a></li> <li><a href="/OpenTl.Schema/api/OpenTl.Schema.Updates/<API key>">T<wbr>Channel<wbr>Difference<wbr>Empty</a></li> <li><a href="/OpenTl.Schema/api/OpenTl.Schema.Updates/<API key>">T<wbr>Channel<wbr>Difference<wbr>Too<wbr>Long</a></li> </ul> </dd> </dl> </div> <div class="col-md-6"> <div class="mermaid"> graph TD Interface0["IObject"]-.-&gt;Type click Interface0 "/OpenTl.Schema/api/OpenTl.Schema/IObject" Type["IChannelDifference"] class Type type-node Type-.-&gt;Implementing0["TChannelDifference"] click Implementing0 "/OpenTl.Schema/api/OpenTl.Schema.Updates/TChannelDifference" Type-.-&gt;Implementing1["<API key>"] click Implementing1 "/OpenTl.Schema/api/OpenTl.Schema.Updates/<API key>" Type-.-&gt;Implementing2["<API key>"] click Implementing2 "/OpenTl.Schema/api/OpenTl.Schema.Updates/<API key>" </div> </div> </div> </div> </div> <h1 id="Syntax">Syntax</h1> <pre><code>public interface IChannelDifference : IObject</code></pre> <h1 id="ExtensionMethods">Extension Methods</h1> <div class="box"> <div class="box-body no-padding table-responsive"> <table class="table table-striped table-hover three-cols"> <thead> <tr> <th>Name</th> <th>Value</th> <th>Summary</th> </tr> </thead> <tbody><tr> <td><a href="/OpenTl.Schema/api/OpenTl.Schema/Utils/A1A958DE.html">As<wbr>&lt;T&gt;<wbr><wbr>()<wbr></a></td> <td>T</td> <td> <div></div> <div><small><em>From <a href="/OpenTl.Schema/api/OpenTl.Schema/Utils">Utils</a></em></small></div> </td> </tr> <tr> <td><a href="/OpenTl.Schema/api/OpenTl.Schema/Utils/4941F7D3.html">Is<wbr>&lt;T&gt;<wbr><wbr>()<wbr></a></td> <td>T</td> <td> <div></div> <div><small><em>From <a href="/OpenTl.Schema/api/OpenTl.Schema/Utils">Utils</a></em></small></div> </td> </tr> <tr> <td><a href="/OpenTl.Schema/api/OpenTl.Schema/Utils/CF7043C9.html">IsEmpty<wbr>()<wbr></a></td> <td>bool</td> <td> <div></div> <div><small><em>From <a href="/OpenTl.Schema/api/OpenTl.Schema/Utils">Utils</a></em></small></div> </td> </tr> </tbody></table> </div> </div> </section> </div> <!-- Footer --> <footer class="main-footer"> </footer> </div> <div class="wrapper bottom-wrapper"> <footer class="bottom-footer"> Generated by <a href="https://wyam.io">Wyam</a> </footer> </div> <a href="javascript:" id="return-to-top"><i class="fa fa-chevron-up"></i></a> <script> // Close the sidebar if we select an anchor link $(".main-sidebar a[href^='#']:not('.expand')").click(function(){ $(document.body).removeClass('sidebar-open'); }); $(document).load(function() { mermaid.initialize( { flowchart: { htmlLabels: false, useMaxWidth:false } }); mermaid.init(undefined, ".mermaid") $('svg').addClass('img-responsive'); $('pre code').each(function(i, block) { hljs.highlightBlock(block); }); }); hljs.<API key>(); // Back to top $(window).scroll(function() { if ($(this).scrollTop() >= 200) { // If page is scrolled more than 50px $('#return-to-top').fadeIn(1000); // Fade in the arrow } else { $('#return-to-top').fadeOut(1000); // Else fade out the arrow } }); $('#return-to-top').click(function() { // When arrow is clicked $('body,html').animate({ scrollTop : 0 // Scroll to top of body }, 500); }); </script> </body></html>
var fs = require('fs'), cons = require('consolidate'), dust = require('dustjs-linkedin'); var pages = [ 'index', 'contact', 'faq', 'registration', 'sponsors', 'travel', 'visit', 'volunteers' ]; pages.forEach(function(page) { cons.dust('views/'+page+'.dust', { views: __dirname+'/views'}, function(err, html) { if(err) return console.log('error: ', err); fs.writeFile(__dirname+'/dist/'+page+'.html', html, function(err) { if(err) return console.log('error saving file: ', page, err); console.log('create page: ', page); }); }); });
#pragma once #include "Prerequisites.h" #include "NodeFlowData.h" #include "NodeProperty.h" #include "NodeException.h" #include "NodeLink.h" #include "Kommon/EnumFlags.h" class NodeSocketTracer { public: NodeSocketTracer() : _traced{InvalidNodeID, InvalidSocketID, false} { } void setNode(NodeID nodeID) { _traced.node = nodeID; } void setSocket(SocketID socketID, bool isOutput) { _traced.socket = socketID; _traced.isOutput = isOutput; } NodeID lastNode() const { return _traced.node; } SocketID lastSocket() const { return _traced.socket; } bool isLastOutput() const { return _traced.isOutput; } private: SocketAddress _traced; }; // Class responsible for reading data from a node socket class LOGIC_EXPORT NodeSocketReader { K_DISABLE_COPY(NodeSocketReader); friend class NodeTree; public: explicit NodeSocketReader(NodeTree* tree, NodeSocketTracer& tracer) : _tracer(tracer) , _nodeTree(tree) , _numInputSockets(0) , _nodeID(InvalidNodeID) { } // Reads data from the socket of given ID const NodeFlowData& operator()(SocketID socketID) const { return readSocket(socketID); } // Reads data from the socket of given ID const NodeFlowData& readSocket(SocketID socketID) const; private: void setNode(NodeID nodeID, SocketID numInputSockets); private: NodeSocketTracer& _tracer; NodeTree* _nodeTree; SocketID _numInputSockets; NodeID _nodeID; }; // Class responsible for writing data to a node socket class LOGIC_EXPORT NodeSocketWriter { K_DISABLE_COPY(NodeSocketWriter); friend class Node; public: explicit NodeSocketWriter(NodeSocketTracer& tracer) : _tracer(tracer) , _outputs(nullptr) { } // Returns a reference to underlying socket data NodeFlowData& operator()(SocketID socketID) { return acquireSocket(socketID); } // Returns a reference to underlying socket data NodeFlowData& acquireSocket(SocketID socketID); private: void setOutputSockets(std::vector<NodeFlowData>& outputs); private: NodeSocketTracer& _tracer; std::vector<NodeFlowData>* _outputs; }; // Interface for property value validator struct PropertyValidator { virtual bool validate(const NodeProperty& value) = 0; }; // Helper method to construct property validator template <class T, class... Args, class = typename std::enable_if<std::is_base_of<PropertyValidator, T>::value>::type> std::unique_ptr<PropertyValidator> make_validator(Args&&... args) { return std::unique_ptr<PropertyValidator>(new T(std::forward<Args>(args)...)); } // Interface for property value observer struct PropertyObserver { virtual void notifyChanged(const NodeProperty& value) = 0; }; // Helper method to construct property observer template <class T, class... Args, class = typename std::enable_if<std::is_base_of<PropertyObserver, T>::value>::type> std::unique_ptr<PropertyObserver> make_observer(Args&&... args) { return std::unique_ptr<PropertyObserver>(new T(std::forward<Args>(args)...)); } // Property observer invoking given callable object on value changed class FuncObserver : public PropertyObserver { public: using func = std::function<void(const NodeProperty&)>; explicit FuncObserver(func op) : _op(std::move(op)) {} virtual void notifyChanged(const NodeProperty& value) override { _op(value); } private: func _op; }; // Property validator using given callable object for validation class FuncValidator : public PropertyValidator { public: using func = std::function<bool(const NodeProperty&)>; explicit FuncValidator(func op) : _op(std::move(op)) {} virtual bool validate(const NodeProperty& value) override { return _op(value); } private: func _op; }; // Validate property value checking if new value is in given range template <class T, class MinOp, class MaxOp> class <API key> : public PropertyValidator { public: typedef T type; explicit <API key>(T min, T max = 0) : min(min), max(max) { if(propertyType<T>() == EPropertyType::Unknown) throw BadConfigException(); } virtual bool validate(const NodeProperty& value) override { return validateImpl(value.cast_value<T>()); } private: bool validateImpl(const T& value) { return MinOp()(value, min) && MaxOp()(value, max); } private: type min; type max; }; template <class T> struct no_limit : public std::binary_function<T, T, bool> { bool operator()(const T&, const T&) const { return true; } }; // Range validator for (a, b) template <class T> using <API key> = <API key><T, std::greater<T>, std::less<T>>; // Range validator for [a, b] template <class T> using <API key> = <API key><T, std::greater_equal<T>, std::less_equal<T>>; // Range validator for [a, inf+) template <class T> using <API key> = <API key><T, std::greater_equal<T>, no_limit<T>>; // Range validator for (a, inf+) template <class T> using <API key> = <API key><T, std::greater<T>, no_limit<T>>; // Range validator for (-inf, b] template <class T> using <API key> = <API key><T, no_limit<T>, std::less_equal<T>>; // Range validator for (-inf, b) template <class T> using <API key> = <API key><T, no_limit<T>, std::less<T>>; // Describes input/output socket parameters class LOGIC_EXPORT SocketConfig { public: explicit SocketConfig(SocketID socketID, std::string name, ENodeFlowDataType type) : _socketID(socketID) , _type(type) , _name(std::move(name)) { } SocketConfig(const SocketConfig&) = default; SocketConfig& operator=(const SocketConfig&) = delete; SocketConfig(SocketConfig&& other) : _socketID(other._socketID) , _type(other._type) , _name(std::move(other._name)) , _description(std::move(other._description)) { } SocketConfig& operator=(SocketConfig&& other) = delete; SocketConfig& setDescription(std::string description) { _description = std::move(description); return *this; } SocketID socketID() const { return _socketID; } ENodeFlowDataType type() const { return _type; } const std::string& name() const { return _name; } const std::string& description() const { return _description; } bool isValid() const { return _socketID != InvalidSocketID; } private: // Socket sequential number for given node type const SocketID _socketID; // Type of underlying data const ENodeFlowDataType _type; // Name of input socket const std::string _name; // Optional description std::string _description; }; // Describes node property parameters class LOGIC_EXPORT PropertyConfig { public: explicit PropertyConfig(PropertyID propertyID, std::string name, NodeProperty& nodeProperty) : _propertyID(propertyID) , _nodeProperty(nodeProperty) , _type(nodeProperty.type()) , _name(std::move(name)) { } PropertyConfig(const PropertyConfig&) = delete; PropertyConfig& operator=(const PropertyConfig&) = delete; PropertyConfig(PropertyConfig&& other) : _propertyID(other._propertyID) , _nodeProperty(other._nodeProperty) , _type(other._type) , _name(std::move(other._name)) , _uiHints(std::move(other._uiHints)) , _description(std::move(other._description)) , _validator(std::move(other._validator)) , _observer(std::move(other._observer)) { } PropertyConfig& operator=(PropertyConfig&& other) = delete; PropertyConfig& setUiHints(std::string uiHints) { _uiHints = std::move(uiHints); return *this; } PropertyConfig& setDescription(std::string description) { _description = std::move(description); return *this; } PropertyConfig& setValidator(std::unique_ptr<PropertyValidator> validator) { _validator = std::move(validator); return *this; } PropertyConfig& setObserver(std::unique_ptr<PropertyObserver> observer) { _observer = std::move(observer); return *this; } PropertyID propertyID() const { return _propertyID; } EPropertyType type() const { return _type; } const std::string& name() const { return _name; } const std::string& uiHints() const { return _uiHints; } const std::string& description() const { return _description; } bool isValid() const { return _propertyID != InvalidPropertyID; } bool setPropertyValue(const NodeProperty& newPropertyValue); const NodeProperty& propertyValue() const { return _nodeProperty; } private: // Property sequential number for given node type const PropertyID _propertyID; // Reference to actual node property NodeProperty& _nodeProperty; // Type of property data const EPropertyType _type; // Human-readable property name const std::string _name; // Optional parameters for UI engine std::string _uiHints; // Optional description std::string _description; // Optional property value validator std::unique_ptr<PropertyValidator> _validator; // Optional observer notified when property is changed std::unique_ptr<PropertyObserver> _observer; }; // Additional, per-node settings enum class ENodeConfig { NoFlags = 0, // Node markes as a stateful HasState = K_BIT(0), // After one exec-run, node should be tagged for next one AutoTag = K_BIT(1), // Don't automatically do time computations for this node as it'll do it itself <API key> = K_BIT(2) }; typedef EnumFlags<ENodeConfig> NodeConfigFlags; <API key>(NodeConfigFlags) // Describes node type with all its i/o sockets and properties class LOGIC_EXPORT NodeConfig { public: explicit NodeConfig() : _flags(ENodeConfig::NoFlags) { } NodeConfig(const NodeConfig&) = delete; NodeConfig& operator=(const NodeConfig&) = delete; NodeConfig(NodeConfig&& other); NodeConfig& operator=(NodeConfig&& other); SocketConfig& addInput(std::string name, ENodeFlowDataType dataType); SocketConfig& addOutput(std::string name, ENodeFlowDataType dataType); PropertyConfig& addProperty(std::string name, NodeProperty& nodeProperty); void clearInputs(); void clearOutputs(); void clearProperties(); NodeConfig& setDescription(std::string description) { _description = std::move(description); return *this; } NodeConfig& setModule(std::string module) { _module = std::move(module); return *this; } NodeConfig& setFlags(NodeConfigFlags configFlags) { _flags = configFlags; return *this; } const std::vector<SocketConfig>& inputs() const { return _inputs; } const std::vector<SocketConfig>& outputs() const { return _outputs; } const std::vector<PropertyConfig>& properties() const { return _properties; } std::vector<PropertyConfig>& properties() { return _properties; } const std::string& description() const { return _description; } const std::string& module() const { return _module; } NodeConfigFlags flags() const { return _flags; } private: template <class T> bool checkNameUniqueness(const std::vector<T>& containter, const std::string& name); private: // Array of input socket descriptors std::vector<SocketConfig> _inputs; // Array of output socket descriptors std::vector<SocketConfig> _outputs; // Array of node property descriptors std::vector<PropertyConfig> _properties; // Optional human-readable description std::string _description; // Optional name of module that this node belongs to std::string _module; // Additional settings NodeConfigFlags _flags; }; // Node execution status enum class EStatus : int { // Everything was ok Ok, // There was an error during execution Error, // Mark this node for execution for next run // (requires Node_AutoTag flag set on) Tag }; // Represents execution return information struct ExecutionStatus { ExecutionStatus() : timeElapsed(0) , status(EStatus::Ok) , message() { } ExecutionStatus(EStatus status, const std::string& message = std::string()) : timeElapsed(0) , status(status) , message(message) { } ExecutionStatus(EStatus status, double timeElapsed, const std::string& message = std::string()) : timeElapsed(timeElapsed) , status(status) , message(message) { } // If <API key> is set on this value will be used // to display overriden time elapsed value double timeElapsed; // Node execution status EStatus status; // Additional message in case of an error std::string message; }; class NodeType : public NodeConfig { public: virtual ~NodeType() {} // Required methods virtual ExecutionStatus execute(NodeSocketReader& reader, NodeSocketWriter& writer) = 0; // Optional methods virtual bool restart(); virtual void finish(); virtual bool init(const std::shared_ptr<NodeModule>& module); NodeConfig& config() { return *this; } const NodeConfig& config() const { return *this; } }; inline bool NodeType::restart() { return false; } inline void NodeType::finish() { return; } inline bool NodeType::init(const std::shared_ptr<NodeModule>&) { return false; } class NodeTypeIterator { public: struct NodeTypeInfo { NodeTypeID typeID; std::string typeName; }; virtual ~NodeTypeIterator() {} virtual bool next(NodeTypeInfo& nodeTypeInfo) = 0; };
package com.team2502.robot2017.command.autonomous; import edu.wpi.first.wpilibj.command.CommandGroup; public class ShinyFollow extends CommandGroup { /** * Does a follow */ public ShinyFollow() { addSequential(new AutoVisionCommand(200, 0.3)); } }
package br.com.caelum.rest.server; import javax.servlet.http.HttpServletRequest; public class SimpleAction implements Action { public String getUri() { return uri; } public String getRel() { return rel; } private final String uri; private final String rel; public SimpleAction(String rel, String uri) { this.rel = rel; this.uri = uri; } public SimpleAction(String rel, HttpServletRequest request, String uri) { this.rel = rel; this.uri = "http://restful-server.appspot.com" + uri; } }
body { font-family: 'Rancho', cursive; font-weight: bold; margin: auto; padding: 5%; background-color: #F49D37; } .score, .game { color: #0A1128; font-size: 28px; } #board { width: 450px; height: 450px; } #board .square { width: 33.333333333%; height: 33.333333333%; background-color: #496DDB; float: left; text-align: center; line-height: 155px; } .square { font-size: 170px; color: #2E4052; border: 2px dashed #F49D37; } .topRow { border-top: none; } .right { border-right: none; } .botRow { border-bottom: none; } .left { border-left: none; } .topRow.right { border-radius: 0 10% 0 0; } .topRow.left { border-radius: 10% 0 0 0; } .botRow.right { border-radius: 0 0 10% 0; } .botRow.left { border-radius: 0 0 0 10%; } #data-bottom, #data-top { width: 450px; } .btnText { color: #0A1128; font-size: 50px; }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>Couch411 | Login</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"/> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.16/angular.min.js"></script> <link rel="stylesheet" type="text/css" href="/semantic-ui/dist/semantic.min.css"> <script src="semantic-ui/dist/semantic.min.js"></script> <link href="./ng-cropper/dist/ngCropper.all.css" rel="stylesheet"> <script src="./ng-cropper/dist/ngCropper.all.js"></script> <script src="./js/picture.js"></script> <!--<script src="ng-flow-standalone.js"></script> <script src="ng-img-crop.js"></script> <link rel="stylesheet" type="text/css" href="ng-img-crop.css"/> </head> <body ng-app="picture" ng-controller="pictureController" ng-init="printSessionStorage()"> <h4 class = "text-center"> My Profile </h4> <button class="ui button">Follow</button> <script type="text/javascript"> $(window).load(function(){ $('#myModal').modal('show'); }); var closemodal = function() { $('#myModal').modal('hide'); }; </script> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <form id = "uploadForm" action="/api/uploadAttempt" method="post" enctype="multipart/form-data"> <div class="modal-header"> <!--<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button> <h4 class="modal-title" id="myModalLabel">Upload Profile Picture</h4> </div> <div class="modal-body">
package com.ms.<API key>.features.meizi.model; import android.content.Context; import com.ms.<API key>.features.base.pojo.ImgItem; import com.ms.retrofitlibrary.web.MyOkHttpClient; import org.loader.model.OnModelListener; import java.util.List; import rx.Observable; import rx.Subscription; public class DbGroupBreastModel extends DbGroupModel { private String pager_offset; public Subscription loadWeb(Context context, OnModelListener<List<ImgItem>> listener, String pager_offset) { this.pager_offset = pager_offset; return loadWeb(context, listener); } @Override protected Subscription reSubscription(Context context, OnModelListener<List<ImgItem>> listener) { Observable<String> dbGroupBreast = getDbGroup().RxDbGroupBreast( MyOkHttpClient.getCacheControl(context), pager_offset ); return rxDbGroup(dbGroupBreast, listener); } }
import logging.handlers import os _pabotlog = logging.getLogger('PABot') _pabotlog.setLevel(logging.DEBUG) _logPath = os.path.abspath("./logging/pabot.log") _formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(name)s - %(message)s') <API key> = logging.StreamHandler() <API key>.setLevel(logging.DEBUG) <API key>.setFormatter(_formatter) <API key> = logging.handlers.RotatingFileHandler(_logPath, maxBytes=2000000, backupCount=5) <API key>.setLevel(logging.DEBUG) <API key>.setFormatter(_formatter) _pabotlog.addHandler(<API key>) _pabotlog.addHandler(<API key>) def LogPABotMessage(message): _pabotlog.info(message) def LogPABotError(message): _pabotlog.error(message)
{ {# INDIVIDUAL VIEW FOR EACH storycontributor #} {# This page can use any data from http:localhost:2000/cms/#/form/storycontributor/ #} {# Webhook uses the SWIG.js (like Djagno/Twig) templating system. Their documentation is here: #} { {# Learn about calling data into Webhook pages here: #} { { {# Confused what extends and blocks do? Watch a primer: #} { {% extends "templates/partials/base.html" %} {# This sets our page <title>. It will append this storycontributor's name to the site title defined in base.html #} {% block title %}{% parent %} - {{ item.name }}{% endblock %} {% block content %} <p><a href="{{ url('storycontributor') }}">View a list of all storycontributor</a></p> <h1>{{ item.name }}</h1> <ul> <li> <strong>Name: </strong> {{ item.name }} </li> <li> <strong>Create Date: </strong> { {{ item.create_date|date('F d Y') }} </li> <li> <strong>Last Updated: </strong> { {{ item.last_updated|date('F d Y') }} </li> <li> <strong>Publish Date: </strong> { {{ item.publish_date|date('F d Y') }} </li> <li> <strong>First Name: </strong> {{ item.first_name }} </li> <li> <strong>Last Name: </strong> {{ item.last_name }} </li> <li> <strong>Title: </strong> {{ item.title }} </li> <li> <strong>Company: </strong> {{ item.company }} </li> <li> <strong>Bio - Short: </strong> {{ item.bio__short }} </li> <li> <strong>Bio - Full: </strong> {{ item.bio__full|safe }} </li> <li> <strong>Avatar: </strong> {# You can pull out a lot more information from the image property. Info here: #} { <img src="{{ item.avatar|imageSize(200) }}" /> </li> <li> <strong>Website: </strong> {{ item.website }} </li> <li> <strong>Twitter: </strong> {{ item.twitter }} </li> <li> <strong>LinkedIn: </strong> {{ item.linkedin }} </li> <li> <strong>Preview URL: </strong> {{ item.preview_url }} </li> <li> <strong>Slug: </strong> {{ item.slug }} </li> <li> <strong>Story (Contributor - Primary): </strong> {# Relations require some special code. More info about relations here: #} { {% for relation in item.<API key> %} {# You can ouput more than just the name. Feel free to output more fields from the CMS. #} <a href="{{ url(relation) }}">{{ relation.name }}</a>{% if not loop.last %},{% endif %} {% endfor %} </li> <li> <strong>Story (Contributor - Additional): </strong> {# Relations require some special code. More info about relations here: #} { {% for relation in item.<API key> %} {# You can ouput more than just the name. Feel free to output more fields from the CMS. #} <a href="{{ url(relation) }}">{{ relation.name }}</a>{% if not loop.last %},{% endif %} {% endfor %} </li> </ul> {% endblock %}