code
stringlengths
4
1.01M
language
stringclasses
2 values
export * from './about'; export * from './no-content'; export * from './home';
Java
<!--conf <sample> <product version="2.6" edition="std"/> <modifications> <modified date="100609"/> </modifications> </sample> --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Series</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/> <script src="../../../codebase/dhtmlx.js"></script> <script src="../common/testdata.js"></script> </head> <body> <div id="chart1" style="width:900px;height:250px;border:1px solid #A4BED4;"></div> <script> var barChart1 = new dhtmlXChart({ view:"bar", container:"chart1", value:"#sales#", color: "#58dccd", gradient:"rising", tooltip:{ template:"#sales#" }, width:60, tooltip:{ template:"#sales#" }, xAxis:{ template:"'#year#" }, yAxis:{ start:0, step:10, end:100 }, legend:{ values:[{text:"Type A",color:"#58dccd"},{text:"Type B",color:"#a7ee70"},{text:"Type C",color:"#36abee"}], valign:"middle", align:"right", width:90, layout:"y" } }); barChart1.addSeries({ value:"#sales2#", color:"#a7ee70", tooltip:{ template:"#sales2#" } }); barChart1.addSeries({ value:"#sales3#", color:"#36abee", tooltip:{ template:"#sales3#" } }); barChart1.parse(multiple_dataset,"json"); </script> </body> </html>
Java
version https://git-lfs.github.com/spec/v1 oid sha256:d5b913ad3304fa791ac6c6064dcecf37b157290bb0e8292e76aee05bee6dc425 size 3752
Java
--- layout: player radio: gardarica date: 2017-04-06T05:06:27Z ---
Java
/** * Filtering sensitive information */ const _ = require('lodash'); /** * reset option * @param {string|object|array} opt filter option * @param {array} filterKeys filter keys * @param {string|function} replaceChat replace chat or function * @param {boolean} recursion whether recursive , true of false */ const setOption = (option) => { let filterKeys = ['password', 'token', 'authorization']; let replaceChat = '*'; let recursion = false; if (option !== undefined) { if (typeof option === 'string') { filterKeys = [option]; } else if (option instanceof Array && option.length > 0) { filterKeys = option.filter(item => typeof item === 'string'); } else if (_.isPlainObject(option)) { const { filterKeys: fks, recursion: rcs, replaceChat: rpc } = option; recursion = !!rcs; if (fks instanceof Array && fks.length > 0) { filterKeys = fks.filter(item => typeof item === 'string'); } if (typeof rpc === 'string') { replaceChat = rpc; } else { replaceChat = '*'; } } else { console.error(new Error(`option.filter do not support ${typeof option} type !`)); } } return { filterKeys, recursion, replaceChat }; }; /** * replace by replaceChat * @param {string} param content to replace * @param {string|function} replaceChat replace chat or function */ const replace = (param, replaceChat) => { if (typeof replaceChat === 'function') { return replaceChat(param); } return param.replace(/\S/g, '*'); }; /** * filter log message by option * @param {*} message logger message * @param {object} opt filter option * @param {boolean} hit hit the fileterkeys , default false */ const filter = (message, opt, hit = false) => { const result = message; const { filterKeys, replaceChat } = opt; if (_.isPlainObject(result)) { Object.keys(result).forEach((key) => { const dHit = hit || filterKeys.indexOf(key) > -1; result[key] = filter(result[key], opt, dHit); // if (recursion) { // result[key] = filter(param, opt, true); // } else { // result[key] = replaceChat; // // replace the value of hit key // // eslint-disable-next-line no-return-assign // Object.keys(param).forEach(pk => (filterKeys.indexOf(pk) !== -1 ? result[key] = replaceChat : '')); // } }); return result; } else if (typeof result === 'number') { return replace(result.toString(), replaceChat); } else if (result instanceof Array && result.length > 0) { return result.map(param => filter(param, opt, hit)); } return replace(result, replaceChat); }; /** * filter log message by option do not recursion * @param {*} message logger message * @param {object} opt filter option * @param {array} opt.filterKeys filter keys * @param {string} opt.replaceChat replace chat or function */ const filterNoRecursion = (message, opt) => { const result = message; const { filterKeys, replaceChat } = opt; if (_.isPlainObject(result)) { Object.keys(result).forEach((key) => { if (filterKeys.indexOf(key) === -1) { result[key] = filterNoRecursion(result[key], opt); } else { result[key] = replaceChat; } }); return result; } else if (typeof result === 'number') { return result; } else if (result instanceof Array && result.length > 0) { return result; } return result; }; /** * filter sensitive information * @param {object} message log message * @param {*} option filter option */ const filteringSensitiveInfo = (message, option = false) => { if (!option) { return message; } if (typeof option === 'function') { return option(message); } return filterNoRecursion(message, setOption(option)); }; module.exports = { filteringSensitiveInfo, setOption, };
Java
from slm_lab.env.vec_env import make_gym_venv import numpy as np import pytest @pytest.mark.parametrize('name,state_shape,reward_scale', [ ('PongNoFrameskip-v4', (1, 84, 84), 'sign'), ('LunarLander-v2', (8,), None), ('CartPole-v0', (4,), None), ]) @pytest.mark.parametrize('num_envs', (1, 4)) def test_make_gym_venv_nostack(name, num_envs, state_shape, reward_scale): seed = 0 frame_op = None frame_op_len = None venv = make_gym_venv(name, num_envs, seed, frame_op=frame_op, frame_op_len=frame_op_len, reward_scale=reward_scale) venv.reset() for i in range(5): state, reward, done, info = venv.step([venv.action_space.sample()] * num_envs) assert isinstance(state, np.ndarray) assert state.shape == (num_envs,) + state_shape assert isinstance(reward, np.ndarray) assert reward.shape == (num_envs,) assert isinstance(done, np.ndarray) assert done.shape == (num_envs,) assert len(info) == num_envs venv.close() @pytest.mark.parametrize('name,state_shape, reward_scale', [ ('PongNoFrameskip-v4', (1, 84, 84), 'sign'), ('LunarLander-v2', (8,), None), ('CartPole-v0', (4,), None), ]) @pytest.mark.parametrize('num_envs', (1, 4)) def test_make_gym_concat(name, num_envs, state_shape, reward_scale): seed = 0 frame_op = 'concat' # used for image, or for concat vector frame_op_len = 4 venv = make_gym_venv(name, num_envs, seed, frame_op=frame_op, frame_op_len=frame_op_len, reward_scale=reward_scale) venv.reset() for i in range(5): state, reward, done, info = venv.step([venv.action_space.sample()] * num_envs) assert isinstance(state, np.ndarray) stack_shape = (num_envs, frame_op_len * state_shape[0],) + state_shape[1:] assert state.shape == stack_shape assert isinstance(reward, np.ndarray) assert reward.shape == (num_envs,) assert isinstance(done, np.ndarray) assert done.shape == (num_envs,) assert len(info) == num_envs venv.close() @pytest.mark.skip(reason='Not implemented yet') @pytest.mark.parametrize('name,state_shape,reward_scale', [ ('LunarLander-v2', (8,), None), ('CartPole-v0', (4,), None), ]) @pytest.mark.parametrize('num_envs', (1, 4)) def test_make_gym_stack(name, num_envs, state_shape, reward_scale): seed = 0 frame_op = 'stack' # used for rnn frame_op_len = 4 venv = make_gym_venv(name, num_envs, seed, frame_op=frame_op, frame_op_len=frame_op_len, reward_scale=reward_scale) venv.reset() for i in range(5): state, reward, done, info = venv.step([venv.action_space.sample()] * num_envs) assert isinstance(state, np.ndarray) stack_shape = (num_envs, frame_op_len,) + state_shape assert state.shape == stack_shape assert isinstance(reward, np.ndarray) assert reward.shape == (num_envs,) assert isinstance(done, np.ndarray) assert done.shape == (num_envs,) assert len(info) == num_envs venv.close() @pytest.mark.parametrize('name,state_shape,image_downsize', [ ('PongNoFrameskip-v4', (1, 84, 84), (84, 84)), ('PongNoFrameskip-v4', (1, 64, 64), (64, 64)), ]) @pytest.mark.parametrize('num_envs', (1, 4)) def test_make_gym_venv_downsize(name, num_envs, state_shape, image_downsize): seed = 0 frame_op = None frame_op_len = None venv = make_gym_venv(name, num_envs, seed, frame_op=frame_op, frame_op_len=frame_op_len, image_downsize=image_downsize) venv.reset() for i in range(5): state, reward, done, info = venv.step([venv.action_space.sample()] * num_envs) assert isinstance(state, np.ndarray) assert state.shape == (num_envs,) + state_shape assert isinstance(reward, np.ndarray) assert reward.shape == (num_envs,) assert isinstance(done, np.ndarray) assert done.shape == (num_envs,) assert len(info) == num_envs venv.close()
Java
package com.github.pineasaurusrex.inference_engine; import java.util.HashMap; /** * Partially or fully assigned model * A model represents a possible representation of the propositional symbol states in the KB */ public class Model { private HashMap<PropositionalSymbol, Boolean> symbolValues = new HashMap<>(); public boolean holdsTrue(Sentence sentence) { if (sentence.isPropositionSymbol()) { return symbolValues.get(sentence); } else { switch(sentence.getConnective()) { case NOT: return !holdsTrue(sentence.getOperand(0)); case AND: return holdsTrue(sentence.getOperand(0)) && holdsTrue(sentence.getOperand(1)); case OR: return holdsTrue(sentence.getOperand(0)) || holdsTrue(sentence.getOperand(1)); case IMPLICATION: return !holdsTrue(sentence.getOperand(0)) || holdsTrue(sentence.getOperand(1)); case BICONDITIONAL: return holdsTrue(sentence.getOperand(0)) == holdsTrue(sentence.getOperand(1)); } } return false; } public boolean holdsTrue(KnowledgeBase kb) { return kb.getSentences().parallelStream() .map(this::holdsTrue) .allMatch(Boolean::booleanValue); } /** * Returns a new model, with the union of the results of the old model and the result passed in * @param symbol the symbol to merge in * @param b the value to set * @return a new Model object */ public Model union(PropositionalSymbol symbol, boolean b) { Model m = new Model(); m.symbolValues.putAll(this.symbolValues); m.symbolValues.put(symbol, b); return m; } }
Java
describe("The ot object has a forEach method, which allows you: ", function () { it("To iterate over an array", function () { var array = [1, 2, 4, 8, 16]; var sum = 0; var sumIndex = 0; ot.forEach(array, function (value, index) { sum += value; sumIndex += index; expect(this.context).toBe(true); }, {context: true}); expect(sum).toBe(1 + 2 + 4 + 8 + 16); expect(sumIndex).toBe(1 + 2 + 3 + 4); }); it("To iterate over an object's properties", function () { var obj = { prop1: false, prop2: false, prop3: false }; ot.forEach(obj, function (value, key) { obj[key] = !value; expect(this.context).toBe(true); }, {context: true}); expect(obj.prop1).toBe(true); expect(obj.prop2).toBe(true); expect(obj.prop3).toBe(true); }); it("To iterate over user set function properties", function () { var fnWithProps = function aName() { }; fnWithProps.prop1 = false; fnWithProps.prop2 = false; fnWithProps.prop3 = false; ot.forEach(fnWithProps, function (value, key) { fnWithProps[key] = !value; expect(this.context).toBe(true); }, {context: true}); expect(fnWithProps.prop1).toBe(true); expect(fnWithProps.prop2).toBe(true); expect(fnWithProps.prop3).toBe(true); }); it("To iterate over an object with a forEach method", function () { var objectWithForEach = { forEach: function (iterator, context) { iterator.call(context, true); } }; ot.forEach(objectWithForEach, function(calledFromForEach) { expect(calledFromForEach).toBe(true); expect(this.context).toBe(true); }, {context: true}); }); });
Java
#ifndef LWEXML_H #define LWEXML_H #include <LWCore/LWText.h> #include <functional> #include "LWETypes.h" #define LWEXMLMAXNAMELEN 32 #define LWEXMLMAXVALUELEN 256 #define LWEXMLMAXTEXTLEN 1024 struct LWXMLAttribute { char m_Name[LWEXMLMAXNAMELEN]; char m_Value[LWEXMLMAXVALUELEN]; }; struct LWEXMLNode { enum { MaxAttributes = 32 }; LWXMLAttribute m_Attributes[MaxAttributes]; char m_Text[LWEXMLMAXTEXTLEN]; char m_Name[LWEXMLMAXNAMELEN]; uint32_t m_AttributeCount; LWEXMLNode *m_Parent; LWEXMLNode *m_Next; LWEXMLNode *m_FirstChild; LWEXMLNode *m_LastChild; bool PushAttribute(const char *Name, const char *Value); bool PushAttributef(const char *Name, const char *ValueFmt, ...); bool RemoveAttribute(uint32_t i); bool RemoveAttribute(LWXMLAttribute *Attr); LWEXMLNode &SetName(const char *Name); LWEXMLNode &SetText(const char *Text); LWEXMLNode &SetTextf(const char *TextFmt, ...); LWXMLAttribute *FindAttribute(const LWText &Name); }; struct LWEXMLParser { char m_Name[LWEXMLMAXNAMELEN]; std::function<bool(LWEXMLNode *, void *, LWEXML *)> m_Callback; void *m_UserData; }; class LWEXML { public: enum { NodePoolSize = 256, MaxParsers = 32 }; static bool LoadFile(LWEXML &XML, LWAllocator &Allocator, const LWText &Path, bool StripFormatting, LWEXMLNode *Parent, LWEXMLNode *Prev, LWFileStream *ExistingStream = nullptr); static bool LoadFile(LWEXML &XML, LWAllocator &Allocator, const LWText &Path, bool StripFormatting, LWFileStream *ExistingStream = nullptr); static bool ParseBuffer(LWEXML &XML, LWAllocator &Allocator, const char *Buffer, bool StripFormatting, LWEXMLNode *Parent, LWEXMLNode *Prev); static bool ParseBuffer(LWEXML &XML, LWAllocator &Allocator, const char *Buffer, bool StripFormatting); static uint32_t ConstructBuffer(LWEXML &XML, char *Buffer, uint32_t BufferLen, bool Format); LWEXMLNode *NextNode(LWEXMLNode *Current, bool SkipChildren=false); LWEXMLNode *NextNode(LWEXMLNode *Current, LWEXMLNode *Top, bool SkipChildren = false); LWEXMLNode *NextNodeWithName(LWEXMLNode *Current, const LWText &Name, bool SkipChildren =false); template<class Method, class Obj> LWEXML &PushMethodParser(const LWText &XMLNodeName, Method CB, Obj *O, void *UserData) { return PushParser(XMLNodeName, std::bind(CB, O, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3), UserData); } LWEXML &PushParser(const LWText &XMLNodeName, std::function<bool(LWEXMLNode*, void*, LWEXML*)> Callback, void *UserData); LWEXML &Process(void); LWEXMLNode *GetInsertedNodeAfter(LWEXMLNode *Parent, LWEXMLNode *Prev, LWAllocator &Allocator); LWEXMLNode *GetFirstNode(void); LWEXMLNode *GetLastNode(void); LWEXML(); ~LWEXML(); private: LWEXMLNode **m_NodePool; LWEXMLParser m_Parsers[MaxParsers]; uint32_t m_NodeCount; uint32_t m_ParserCount; LWEXMLNode *m_FirstNode; LWEXMLNode *m_LastNode; }; #endif
Java
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace CycleCycleCycle.Services { public interface IRideService { bool Create(int accountId, int routeId, DateTime dateRidden, int? hours, int? minutes, int? seconds); } }
Java
<?php /** * [PHPFOX_HEADER] */ defined('PHPFOX') or exit('NO DICE!'); /** * * * @copyright [PHPFOX_COPYRIGHT] * @author Raymond Benc * @package Module_Mail * @version $Id: index.class.php 4378 2012-06-27 08:44:47Z Raymond_Benc $ */ class Mail_Component_Controller_Index extends Phpfox_Component { /** * Class process method wnich is used to execute this component. */ public function process() { Phpfox::isUser(true); $bIsInLegacyView = false; if (Phpfox::getParam('mail.threaded_mail_conversation') && $this->request()->get('legacy')) { Phpfox::getLib('setting')->setParam('mail.threaded_mail_conversation', false); $bIsInLegacyView = true; } $this->setParam('bIsInLegacyView', $bIsInLegacyView); if (($aItemModerate = $this->request()->get('item_moderate'))) { $sFile = Phpfox::getService('mail')->getThreadsForExport($aItemModerate); Phpfox::getLib('file')->forceDownload($sFile, 'mail.xml'); } $iPage = $this->request()->getInt('page'); $iPageSize = 10; $bIsSentbox = ($this->request()->get('view') == 'sent' ? true : false); $bIsTrash = ($this->request()->get('view') == 'trash' ? true : false); $iPrivateBox = ($this->request()->get('view') == 'box' ? $this->request()->getInt('id') : false); $bIs = $this->getParam('bIsSentbox'); if ($this->request()->get('action') == 'archive') { Phpfox::getService('mail.process')->archiveThread($this->request()->getInt('id'), 1); $this->url()->send('mail.trash', null, Phpfox::getPhrase('mail.message_successfully_archived')); } if ($this->request()->get('action') == 'unarchive') { Phpfox::getService('mail.process')->archiveThread($this->request()->getInt('id'), 0); $this->url()->send('mail', null, Phpfox::getPhrase('mail.message_successfully_unarchived')); } if ($this->request()->get('action') == 'delete') { $iMailId = $this->request()->getInt('id'); if (!is_int($iMailId) || empty($iMailId)) { Phpfox_Error::set(Phpfox::getPhrase('mail.no_mail_specified')); } else { $bTrash = $this->getParam('bIsTrash'); if (!isset($bTrash) || !is_bool($bTrash)) { $bIsTrash = Phpfox::getService('mail')->isDeleted($iMailId); } if ($bIsTrash) { if (Phpfox::getService('mail.process')->deleteTrash($iMailId)) { $this->url()->send('mail.trash', null, Phpfox::getPhrase('mail.mail_deleted_successfully')); } else { Phpfox_Error::set(Phpfox::getPhrase('mail.mail_could_not_be_deleted')); } } else { $bIsSent = $this->getParam('bIsSentbox'); if (!isset($bIsSent) || !is_bool($bIsSent)) { $bIsSentbox = Phpfox::getService('mail')->isSent($iMailId); } if (Phpfox::getService('mail.process')->delete($iMailId, $bIsSentbox)) { $this->url()->send($bIsSentbox == true ? 'mail.sentbox' : 'mail', null, Phpfox::getPhrase('mail.mail_deleted_successfully')); } else { Phpfox_Error::set(Phpfox::getPhrase('mail.mail_could_not_be_deleted')); } } } } if (($aVals = $this->request()->getArray('val')) && isset($aVals['action'])) { if (isset($aVals['id'])) { //make sure there is at least one selected $oMailProcess = Phpfox::getService('mail.process'); switch ($aVals['action']) { case 'unread': case 'read': foreach ($aVals['id'] as $iId) { $oMailProcess->toggleView($iId, ($aVals['action'] == 'unread' ? true : false)); } $sMessage = Phpfox::getPhrase('mail.messages_updated'); break; case 'delete': if (isset($aVals['select']) && $aVals['select'] == 'every') { $aMail = Phpfox::getService('mail')->getAllMailFromFolder(Phpfox::getUserId(),(int)$aVals['folder'], $bIsSentbox, $bIsTrash); $aVals['id'] = $aMail; } foreach ($aVals['id'] as $iId) { ($bIsTrash ? $oMailProcess->deleteTrash($iId) : $oMailProcess->delete($iId, $bIsSentbox)); } $sMessage = Phpfox::getPhrase('mail.messages_deleted'); break; case 'undelete': foreach ($aVals['id'] as $iId) { $oMailProcess->undelete($iId); } $sMessage = Phpfox::getPhrase('mail.messages_updated'); break; } } else { // didnt select any message $sMessage = Phpfox::getPhrase('mail.error_you_did_not_select_any_message'); } // define the mail box that the user was looking at $mSend = null; if ($bIsSentbox) { $mSend = array('sentbox'); } elseif ($bIsTrash) { $mSend = array('trash'); } elseif ($iPrivateBox) { $mSend = array('box', 'id' => $iPrivateBox); } // send the user to that folder with the message $this->url()->send('mail', $mSend, $sMessage); } $this->search()->set(array( 'type' => 'mail', 'field' => 'mail.mail_id', 'search_tool' => array( 'table_alias' => 'm', 'search' => array( 'action' => $this->url()->makeUrl('mail', array('view' => $this->request()->get('view'), 'id' => $this->request()->get('id'))), 'default_value' => Phpfox::getPhrase('mail.search_messages'), 'name' => 'search', 'field' => array('m.subject', 'm.preview') ), 'sort' => array( 'latest' => array('m.time_stamp', Phpfox::getPhrase('mail.latest')), 'most-viewed' => array('m.viewer_is_new', Phpfox::getPhrase('mail.unread_first')) ), 'show' => array(10, 15, 20) ) ) ); $iPageSize = $this->search()->getDisplay(); $aFolders = Phpfox::getService('mail.folder')->get(); $sUrl = ''; $sFolder = ''; if (Phpfox::getParam('mail.threaded_mail_conversation')) { if ($bIsTrash) { $sUrl = $this->url()->makeUrl('mail.trash'); $this->search()->setCondition('AND m.owner_user_id = ' . Phpfox::getUserId() . ' AND m.is_archive = 1'); } else { if ($bIsSentbox) { $sUrl = $this->url()->makeUrl('mail.sentbox'); } else { $sUrl = $this->url()->makeUrl('mail'); } $this->search()->setCondition('AND m.viewer_user_id = ' . Phpfox::getUserId() . ' AND m.is_archive = 0'); } } else { if ($bIsTrash) { $sFolder = Phpfox::getPhrase('mail.trash'); $sUrl = $this->url()->makeUrl('mail.trash'); $this->search()->setCondition('AND (m.viewer_user_id = ' . Phpfox::getUserId() . ' AND m.viewer_type_id = 1) OR (m.owner_user_id = ' . Phpfox::getUserId() . ' AND m.owner_type_id = 1)'); // $this->search()->setCondition('AND m.viewer_user_id = ' . Phpfox::getUserId() . ' AND m.viewer_type_id = 1'); } elseif ($iPrivateBox) { if (isset($aFolders[$iPrivateBox])) { $sFolder = $aFolders[$iPrivateBox]['name']; $sUrl = $this->url()->makeUrl('mail.box', array('id' => (int) $iPrivateBox)); $this->search()->setCondition('AND m.viewer_folder_id = ' . (int) $iPrivateBox . ' AND m.viewer_user_id = ' . Phpfox::getUserId() . ' AND m.viewer_type_id = 0'); } else { $this->url()->send('mail', null, Phpfox::getPhrase('mail.mail_folder_does_not_exist')); } } else { if ($bIsSentbox) { $sFolder = Phpfox::getPhrase('mail.sent_messages'); $sUrl = $this->url()->makeUrl('mail.sentbox'); $this->search()->setCondition('AND m.owner_user_id = ' . Phpfox::getUserId() . ' AND m.owner_type_id = 0'); } else { $sFolder = Phpfox::getPhrase('mail.inbox'); $sUrl = $this->url()->makeUrl('mail'); $this->search()->setCondition('AND m.viewer_folder_id = 0 AND m.viewer_user_id = ' . Phpfox::getUserId() . ' AND m.viewer_type_id = 0'); } } } list($iCnt, $aRows, $aInputs) = Phpfox::getService('mail')->get($this->search()->getConditions(), $this->search()->getSort(), $this->search()->getPage(), $iPageSize, $bIsSentbox, $bIsTrash); Phpfox::getLib('pager')->set(array( 'page' => $iPage, 'size' => $iPageSize, 'count' => $iCnt ) ); Phpfox::getService('mail')->buildMenu(); $aActions = array(); $aActions[] = array( 'phrase' => Phpfox::getPhrase('mail.delete'), 'action' => 'delete' ); if (!$bIsSentbox) { $aActions[] = array( 'phrase' => Phpfox::getPhrase('mail.move'), 'action' => 'move' ); } $aModeration = array( 'name' => 'mail', 'ajax' => 'mail.moderation', 'menu' => $aActions ); if ($bIsSentbox) { $aModeration['custom_fields'] = '<div><input type="hidden" name="sent" value="1" /></div>'; } elseif ($bIsTrash) { $aModeration['custom_fields'] = '<div><input type="hidden" name="trash" value="1" /></div>'; } if (Phpfox::getParam('mail.threaded_mail_conversation')) { $aModeration['ajax'] = 'mail.archive'; $aMenuOptions = array(); if ($bIsTrash) { $aMenuOptions = array( 'phrase' => Phpfox::getPhrase('mail.un_archive'), 'action' => 'un-archive' ); } else { $aMenuOptions = array( 'phrase' => Phpfox::getPhrase('mail.archive'), 'action' => 'archive' ); } $aModeration['menu'] = array($aMenuOptions, array( 'phrase' => Phpfox::getPhrase('mail.export'), 'action' => 'export' ) ); } $this->setParam('global_moderation', $aModeration); if (empty($sFolder)) { $sFolder = Phpfox::getPhrase('mail.mail'); } $iMailSpaceUsed = 0; if ((!Phpfox::getUserParam('mail.override_mail_box_limit') && Phpfox::getParam('mail.enable_mail_box_warning'))) { $iMailSpaceUsed = Phpfox::getService('mail')->getSpaceUsed(Phpfox::getUserId()); } $this->template()->setTitle($sFolder) ->setBreadcrumb(Phpfox::getPhrase('mail.mail'), $this->url()->makeUrl('mail')) ->setPhrase(array( 'mail.add_new_folder', 'mail.adding_new_folder', 'mail.view_folders', 'mail.edit_folders', 'mail.you_will_delete_every_message_in_this_folder', 'mail.updating' ) ) ->setHeader('cache', array( 'jquery/plugin/jquery.highlightFade.js' => 'static_script', 'quick_edit.js' => 'static_script', 'selector.js' => 'static_script', 'mail.js' => 'module_mail', 'pager.css' => 'style_css', 'mail.css' => 'style_css' ) ) ->assign(array( 'aMails' => $aRows, 'bIsSentbox' => $bIsSentbox, 'bIsTrash' => $bIsTrash, 'aInputs' => $aInputs, 'aFolders' => $aFolders, 'iMailSpaceUsed' => $iMailSpaceUsed, 'iMessageAge' => Phpfox::getParam('mail.message_age_to_delete'), 'sUrl' => $sUrl, 'iFolder' => (isset($aFolders[$iPrivateBox]['folder_id']) ? $aFolders[$iPrivateBox]['folder_id'] : 0), 'iTotalMessages' => $iCnt, 'sSiteName' => Phpfox::getParam('core.site_title'), 'bIsInLegacyView' => $bIsInLegacyView ) ); } /** * Garbage collector. Is executed after this class has completed * its job and the template has also been displayed. */ public function clean() { (($sPlugin = Phpfox_Plugin::get('mail.component_controller_index_clean')) ? eval($sPlugin) : false); } } ?>
Java
<?php namespace Vin\FrontOfficeBundle\Entity; use Doctrine\ORM\EntityRepository; /** * MessageRepository * * This class was generated by the Doctrine ORM. Add your own custom * repository methods below. */ class MessageRepository extends EntityRepository { public function countMessages() { $query = $this -> getEntityManager()->createQuery(' SELECT COUNT(m.id) FROM VinFrontOfficeBundle:Message m'); return $query ->getSingleScalarResult(); } }
Java
<!DOCTYPE html><html><head><title>https://cgmonline.co/tags/2ns/</title><link rel="canonical" href="https://cgmonline.co/tags/2ns/"/><meta name="robots" content="noindex"><meta charset="utf-8" /><meta http-equiv="refresh" content="0; url=https://cgmonline.co/tags/2ns/" /></head></html>
Java
"""Classification-based test and kernel two-sample test. Author: Sandro Vega-Pons, Emanuele Olivetti. """ import os import numpy as np from sklearn.metrics import pairwise_distances, confusion_matrix from sklearn.metrics import pairwise_kernels from sklearn.svm import SVC from sklearn.cross_validation import StratifiedKFold, KFold, cross_val_score from sklearn.grid_search import GridSearchCV from kernel_two_sample_test import MMD2u, compute_null_distribution from kernel_two_sample_test import compute_null_distribution_given_permutations import matplotlib.pylab as plt from joblib import Parallel, delayed def compute_rbf_kernel_matrix(X): """Compute the RBF kernel matrix with sigma2 as the median pairwise distance. """ sigma2 = np.median(pairwise_distances(X, metric='euclidean'))**2 K = pairwise_kernels(X, X, metric='rbf', gamma=1.0/sigma2, n_jobs=-1) return K def balanced_accuracy_scoring(clf, X, y): """Scoring function that computes the balanced accuracy to be used internally in the cross-validation procedure. """ y_pred = clf.predict(X) conf_mat = confusion_matrix(y, y_pred) bal_acc = 0. for i in range(len(conf_mat)): bal_acc += (float(conf_mat[i, i])) / np.sum(conf_mat[i]) bal_acc /= len(conf_mat) return bal_acc def compute_svm_cv(K, y, C=100.0, n_folds=5, scoring=balanced_accuracy_scoring): """Compute cross-validated score of SVM with given precomputed kernel. """ cv = StratifiedKFold(y, n_folds=n_folds) clf = SVC(C=C, kernel='precomputed', class_weight='auto') scores = cross_val_score(clf, K, y, scoring=scoring, cv=cv) return scores.mean() def compute_svm_subjects(K, y, n_folds=5): """ """ cv = KFold(len(K)/2, n_folds) scores = np.zeros(n_folds) for i, (train, test) in enumerate(cv): train_ids = np.concatenate((train, len(K)/2+train)) test_ids = np.concatenate((test, len(K)/2+test)) clf = SVC(kernel='precomputed') clf.fit(K[train_ids, :][:, train_ids], y[train_ids]) scores[i] = clf.score(K[test_ids, :][:, train_ids], y[test_ids]) return scores.mean() def permutation_subjects(y): """Permute class labels of Contextual Disorder dataset. """ y_perm = np.random.randint(0, 2, len(y)/2) y_perm = np.concatenate((y_perm, np.logical_not(y_perm).astype(int))) return y_perm def permutation_subjects_ktst(y): """Permute class labels of Contextual Disorder dataset for KTST. """ yp = np.random.randint(0, 2, len(y)/2) yp = np.concatenate((yp, np.logical_not(yp).astype(int))) y_perm = np.arange(len(y)) for i in range(len(y)/2): if yp[i] == 1: y_perm[i] = len(y)/2+i y_perm[len(y)/2+i] = i return y_perm def compute_svm_score_nestedCV(K, y, n_folds, scoring=balanced_accuracy_scoring, random_state=None, param_grid=[{'C': np.logspace(-5, 5, 25)}]): """Compute cross-validated score of SVM using precomputed kernel. """ cv = StratifiedKFold(y, n_folds=n_folds, shuffle=True, random_state=random_state) scores = np.zeros(n_folds) for i, (train, test) in enumerate(cv): cvclf = SVC(kernel='precomputed') y_train = y[train] cvcv = StratifiedKFold(y_train, n_folds=n_folds, shuffle=True, random_state=random_state) clf = GridSearchCV(cvclf, param_grid=param_grid, scoring=scoring, cv=cvcv, n_jobs=1) clf.fit(K[train, :][:, train], y_train) # print clf.best_params_ scores[i] = clf.score(K[test, :][:, train], y[test]) return scores.mean() def apply_svm(K, y, n_folds=5, iterations=10000, subjects=False, verbose=True, random_state=None): """ Compute the balanced accuracy, its null distribution and the p-value. Parameters: ---------- K: array-like Kernel matrix y: array_like class labels cv: Number of folds in the stratified cross-validation verbose: bool Verbosity Returns: ------- acc: float Average balanced accuracy. acc_null: array Null distribution of the balanced accuracy. p_value: float p-value """ # Computing the accuracy param_grid = [{'C': np.logspace(-5, 5, 20)}] if subjects: acc = compute_svm_subjects(K, y, n_folds) else: acc = compute_svm_score_nestedCV(K, y, n_folds, param_grid=param_grid, random_state=random_state) if verbose: print("Mean balanced accuracy = %s" % (acc)) print("Computing the null-distribution.") # Computing the null-distribution # acc_null = np.zeros(iterations) # for i in range(iterations): # if verbose and (i % 1000) == 0: # print(i), # stdout.flush() # y_perm = np.random.permutation(y) # acc_null[i] = compute_svm_score_nestedCV(K, y_perm, n_folds, # param_grid=param_grid) # if verbose: # print '' # Computing the null-distribution if subjects: yis = [permutation_subjects(y) for i in range(iterations)] acc_null = Parallel(n_jobs=-1)(delayed(compute_svm_subjects)(K, yis[i], n_folds) for i in range(iterations)) else: yis = [np.random.permutation(y) for i in range(iterations)] acc_null = Parallel(n_jobs=-1)(delayed(compute_svm_score_nestedCV)(K, yis[i], n_folds, scoring=balanced_accuracy_scoring, param_grid=param_grid) for i in range(iterations)) # acc_null = Parallel(n_jobs=-1)(delayed(compute_svm_cv)(K, yis[i], C=100., n_folds=n_folds) for i in range(iterations)) p_value = max(1.0 / iterations, (acc_null > acc).sum() / float(iterations)) if verbose: print("p-value ~= %s \t (resolution : %s)" % (p_value, 1.0/iterations)) return acc, acc_null, p_value def apply_ktst(K, y, iterations=10000, subjects=False, verbose=True): """ Compute MMD^2_u, its null distribution and the p-value of the kernel two-sample test. Parameters: ---------- K: array-like Kernel matrix y: array_like class labels verbose: bool Verbosity Returns: ------- mmd2u: float MMD^2_u value. acc_null: array Null distribution of the MMD^2_u p_value: float p-value """ assert len(np.unique(y)) == 2, 'KTST only works on binary problems' # Assuming that the first m rows of the kernel matrix are from one # class and the other n rows from the second class. m = len(y[y == 0]) n = len(y[y == 1]) mmd2u = MMD2u(K, m, n) if verbose: print("MMD^2_u = %s" % mmd2u) print("Computing the null distribution.") if subjects: perms = [permutation_subjects_ktst(y) for i in range(iterations)] mmd2u_null = compute_null_distribution_given_permutations(K, m, n, perms, iterations) else: mmd2u_null = compute_null_distribution(K, m, n, iterations, verbose=verbose) p_value = max(1.0/iterations, (mmd2u_null > mmd2u).sum() / float(iterations)) if verbose: print("p-value ~= %s \t (resolution : %s)" % (p_value, 1.0/iterations)) return mmd2u, mmd2u_null, p_value def plot_null_distribution(stats, stats_null, p_value, data_name='', stats_name='$MMD^2_u$', save_figure=True): """Plot the observed value for the test statistic, its null distribution and p-value. """ fig = plt.figure() ax = fig.add_subplot(111) prob, bins, patches = plt.hist(stats_null, bins=50, normed=True) ax.plot(stats, prob.max()/30, 'w*', markersize=15, markeredgecolor='k', markeredgewidth=2, label="%s = %s" % (stats_name, stats)) ax.annotate('p-value: %s' % (p_value), xy=(float(stats), prob.max()/9.), xycoords='data', xytext=(-105, 30), textcoords='offset points', bbox=dict(boxstyle="round", fc="1."), arrowprops={"arrowstyle": "->", "connectionstyle": "angle,angleA=0,angleB=90,rad=10"}, ) plt.xlabel(stats_name) plt.ylabel('p(%s)' % stats_name) plt.legend(numpoints=1) plt.title('Data: %s' % data_name) if save_figure: save_dir = 'figures' if not os.path.exists(save_dir): os.makedirs(save_dir) stn = 'ktst' if stats_name == '$MMD^2_u$' else 'clf' fig_name = os.path.join(save_dir, '%s_%s.pdf' % (data_name, stn)) fig.savefig(fig_name)
Java
#export pid=`ps aux | grep python | grep hello_gevent.py | awk 'NR==1{print $2}' | cut -d' ' -f1`;kill -9 $pid for KILLPID in `ps aux | grep 'python' | grep 'server01' | awk ' { print $2;}'`; do kill -9 $KILLPID; done #ps aux | grep python | grep -v grep | awk '{print $2}' | xargs kill -9
Java
<?php class kml_Overlay extends kml_Feature { protected $tagName = 'Overlay'; var $color; var $drawOrder; var $Icon; /* Constructor */ function kml_Overlay() { parent::kml_Feature(); } /* Assignments */ function set_color($color) { $this->color = $color; } function set_drawOrder($drawOrder) { $this->drawOrder = $drawOrder; } function set_Icon($Icon) { $this->Icon = $Icon; } /* Render */ function render($doc) { $X = parent::render($doc); if (isset($this->color)) $X->appendChild(XML_create_text_element($doc, 'color', $this->color)); if (isset($this->drawOrder)) $X->appendChild(XML_create_text_element($doc, 'drawOrder', $this->drawOrder)); if (isset($this->Icon)) $X->appendChild($this->Icon->render($doc)); return $X; } } /* $a = new kml_Overlay(); $a->set_id('1'); $a->dump(false); */
Java
###Simple CMS written in python3 bottle framework by default, project is configured to work on openshift cloud: https://openshift.redhat.com. You only need to add mongodb cartridge and restart app. If you want to deploy app on your own server, you have to configure ```DB_CREDENTIALS``` variable in ```config/__init__.py``` ``` DB_CREDENTIALS = { 'creds': { 'username': 'database username', 'password': 'database password', 'host': 'database host name', 'port': database port #must be integer }, 'db': 'database name' } ``` When application is deployed default user is created for admin interface. ``` username: admin password: admin ``` **It is strongly recomended to change password after deployment.**
Java
require "importeer_plan/version" require 'importeer_plan/configuration' module ImporteerPlan class Importeer attr_accessor :path, :name, :dir, :size_batch, :sep, :initial, :options #call importeer("filename") to import the file in batches of 1000, optional importeer("filename", size_) def initialize(name, options={}) @options = options @name = name @path = Importeer.dir.join( @name ) @size_batch = options[:size_batch]||1000 @sep = options[:sep]|| ";" @initial = options[:initial]|| false end def self.dir # Rails.root.join('public/imports/') ImporteerPlan.configuration.dir end def bron end def sweep end def importeer sweep bron.each{|batch| importeer_batch batch} end def commaf(str) # comma-float; "1,234" ('%.2f' % str.gsub(',', '.') ).to_f end def pointf(str) # point-float; "1.234" ('%.2f' % str.gsub(',', '.') ).to_f end end class MyXls < Importeer require 'spreadsheet' def initialize(*) super end def bron Spreadsheet.open(@path).worksheet(0).to_a.tap{|x| x.shift}.each_slice(size_batch).each end end class MyCsv< Importeer require 'csv' def initialize(*) super # @sep = options[:sep] end def bron CSV.read(path, { :col_sep => @sep , :encoding => "ISO-8859-1"}).tap{|x| x.shift}.each_slice(@size_batch) end end class MyTxt< Importeer def initialize(*) super end def bron # Csv.open(@path).worksheet(0).to_a.tap{|x| x.shift}.each_slice(size_batch).each end end end
Java
from collections import namedtuple Resolution = namedtuple('Resolution', ['x', 'y']) class Resolutions(object): resolutions = [ (1920, 1200), (1920, 1080), (1680, 1050), (1440, 900), (1360, 768), (1280, 800), (1024, 640) ] @classmethod def parse(self, x, y): if (x,y) not in self.resolutions: resolutions = ', '.join(['%sx%s' % (a, b) for a,b in self.resolutions]) raise Exception('Resolution %s x %s not supported. Available resolutions: %s' % (x,y, resolutions) ) return Resolution(x, y) class Color(object): gray = (0.15, 0.15, 0.13, 1.0) black = (0.0, 0.0, 0.0, 1.0) white = (1.0, 1.0, 1.0, 1.0) red = (1.0, 0.2, 0.0, 1.0) orange = (1.0, 0.4, 0.0, 1.0) yellow = (1.0, 0.9, 0.0, 1.0) light_green = (0.4, 1.0, 0.0, 1.0) green = (0.0, 1.0, 0.2, 1.0) cyan = (0.0, 1.0, 0.4, 1.0) light_blue = (0.0, 0.6, 1.0, 1.0) blue = (0.0, 0.2, 1.0, 1.0) purple = (0.4, 0.0, 1.0, 1.0) pink = (1.0, 0.0, 0.8, 1.0) @classmethod def __colors(self): return [key for key in self.__dict__.keys() if not key.startswith('_') and key != 'named'] @classmethod def named(self, name): if not hasattr(self, name): colors = ', '.join(self.__colors()) raise Exception('Unknown color %s. Available colors are: %s' % (name, colors)) return getattr(self, name) def try_parse(value): try: return int(value) except: return { 'true': True, 'false': False }.get(value.lower(), value) def read_config(): with open('config.cfg', 'r') as cfg_file: lines = cfg_file.readlines() lines = [ line.strip().replace(' ', '').split('=') for line in lines if line.strip() and '=' in line ] cfg = {key:try_parse(value) for key,value in lines} return cfg cfg = read_config() NUM_CELLS = cfg.get('CELLS', 100) RESOLUTION = Resolutions.parse(cfg.get('WINDOW_WIDTH', 1280), cfg.get('WINDOW_HEIGHT', 800)) limit = min(RESOLUTION) PIXEL_PER_CELL = limit / NUM_CELLS OFFSET_X = (RESOLUTION.x - (NUM_CELLS * PIXEL_PER_CELL)) / 2 OFFSET_Y = (RESOLUTION.y - (NUM_CELLS * PIXEL_PER_CELL)) / 2 SHOW_FULLSCREEN = cfg.get('FULLSCREEN', False) SHOW_GRID = cfg.get('SHOW_GRID', True) BACKGROUND_COLOR = Color.named(cfg.get('BACKGROUND_COLOR', 'black')) GRID_BACKDROP_COLOR = Color.named(cfg.get('GRID_BACKDROP_COLOR', 'gray')) GRID_LINE_COLOR = Color.named(cfg.get('GRID_LINE_COLOR', 'black')) CELL_COLOR = Color.named(cfg.get('CELL_COLOR', 'green')) CURSOR_COLOR = Color.named(cfg.get('CURSOR_COLOR', 'red'))
Java
namespace Dapper.SimpleSave.Tests.Dto { [Table("dbo.OneToManySpecialChild")] [ReferenceData(true)] public class OneToManySpecialChildDto : BaseOneToManyChildDto { } }
Java
using System.Diagnostics; namespace AdventOfCode.Day07.SignalProviders { [DebuggerDisplay("{DebuggerDisplay}")] public class Wire : SignalProvider { #region | Properties & fields private readonly Circut _parentCircut; private readonly string _rawProvider; public string ID { get; } private SignalProvider Connection { get; set; } public string DebuggerDisplay => $"{ID}{_rawProvider}"; #endregion #region | ctors public Wire(Circut circut, string wireId, string rawSignalProvider) { _parentCircut = circut; ID = wireId; _rawProvider = rawSignalProvider; } #endregion #region | Non-public members private void ResolveProvider() { Connection = ProviderParser.ParseProviderType(_rawProvider, _parentCircut); } #endregion #region | Overrides public override ushort GetValue() { if (!IsResolved) // cache the value { ResolveProvider(); Value = Connection.GetValue(); IsResolved = true; } return Value; } #endregion } }
Java
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>18 --> 19</title> <link href="./../../assets/style.css" rel="stylesheet"> </head> <body> <h2>You have to be fast</h2> <a href="./c9030aaf9d04a204bbcb52ab81f7d32203b0d25fa13ca8835e8e8174018d7f33.html">Teleport</a> <hr> <a href="./../../about.md">About</a> (Spoilers! ) <script src="./../../assets/md5.js"></script> <script> window.currentLevel = 7; </script> <script src="./../../assets/script.js"></script> </body> </html>
Java
// // SLWordViewController.h // 百思不得姐 // // Created by Anthony on 17/3/30. // Copyright © 2017年 SLZeng. All rights reserved. // #import "SLTopicViewController.h" @interface SLWordViewController : SLTopicViewController @end
Java
# Use this setup block to configure all options available in SimpleForm. SimpleForm.setup do |config| # Wrappers are used by the form builder to generate a # complete input. You can remove any component from the # wrapper, change the order or even add your own to the # stack. The options given below are used to wrap the # whole input. config.wrappers :default, class: :input, hint_class: :field_with_hint, error_class: :field_with_errors do |b| ## Extensions enabled by default # Any of these extensions can be disabled for a # given input by passing: `f.input EXTENSION_NAME => false`. # You can make any of these extensions optional by # renaming `b.use` to `b.optional`. # Determines whether to use HTML5 (:email, :url, ...) # and required attributes b.use :html5 # Calculates placeholders automatically from I18n # You can also pass a string as f.input placeholder: "Placeholder" b.use :placeholder ## Optional extensions # They are disabled unless you pass `f.input EXTENSION_NAME => true` # to the input. If so, they will retrieve the values from the model # if any exists. If you want to enable any of those # extensions by default, you can change `b.optional` to `b.use`. # Calculates maxlength from length validations for string inputs b.optional :maxlength # Calculates pattern from format validations for string inputs b.optional :pattern # Calculates min and max from length validations for numeric inputs b.optional :min_max # Calculates readonly automatically from readonly attributes b.optional :readonly ## Inputs b.use :label_input b.use :hint, wrap_with: { tag: :span, class: :hint } b.use :error, wrap_with: { tag: :span, class: :error } ## full_messages_for # If you want to display the full error message for the attribute, you can # use the component :full_error, like: # # b.use :full_error, wrap_with: { tag: :span, class: :error } end # The default wrapper to be used by the FormBuilder. config.default_wrapper = :default # Define the way to render check boxes / radio buttons with labels. # Defaults to :nested for bootstrap config. # inline: input + label # nested: label > input config.boolean_style = :nested # Default class for buttons config.button_class = 'btn' # Method used to tidy up errors. Specify any Rails Array method. # :first lists the first message for each field. # Use :to_sentence to list all errors for each field. # config.error_method = :first # Default tag used for error notification helper. config.error_notification_tag = :div # CSS class to add for error notification helper. config.error_notification_class = 'error_notification' # ID to add for error notification helper. # config.error_notification_id = nil # Series of attempts to detect a default label method for collection. # config.collection_label_methods = [ :to_label, :name, :title, :to_s ] # Series of attempts to detect a default value method for collection. # config.collection_value_methods = [ :id, :to_s ] # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none. # config.collection_wrapper_tag = nil # You can define the class to use on all collection wrappers. Defaulting to none. # config.collection_wrapper_class = nil # You can wrap each item in a collection of radio/check boxes with a tag, # defaulting to :span. Please note that when using :boolean_style = :nested, # SimpleForm will force this option to be a label. # config.item_wrapper_tag = :span # You can define a class to use in all item wrappers. Defaulting to none. # config.item_wrapper_class = nil # How the label text should be generated altogether with the required text. # config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" } # You can define the class to use on all labels. Default is nil. # config.label_class = nil # You can define the default class to be used on forms. Can be overriden # with `html: { :class }`. Defaulting to none. # config.default_form_class = nil # You can define which elements should obtain additional classes # config.generate_additional_classes_for = [:wrapper, :label, :input] # Whether attributes are required by default (or not). Default is true. # config.required_by_default = true # Tell browsers whether to use the native HTML5 validations (novalidate form option). # These validations are enabled in SimpleForm's internal config but disabled by default # in this configuration, which is recommended due to some quirks from different browsers. # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations, # change this configuration to true. config.browser_validations = false # Collection of methods to detect if a file type was given. # config.file_methods = [ :mounted_as, :file?, :public_filename ] # Custom mappings for input types. This should be a hash containing a regexp # to match as key, and the input type that will be used when the field name # matches the regexp as value. # config.input_mappings = { /count/ => :integer } # Custom wrappers for input types. This should be a hash containing an input # type as key and the wrapper that will be used for all inputs with specified type. # config.wrapper_mappings = { string: :prepend } # Namespaces where SimpleForm should look for custom input classes that # override default inputs. # config.custom_inputs_namespaces << "CustomInputs" # Default priority for time_zone inputs. # config.time_zone_priority = nil # Default priority for country inputs. # config.country_priority = nil # When false, do not use translations for labels. # config.translate_labels = true # Automatically discover new inputs in Rails' autoload path. # config.inputs_discovery = true # Cache SimpleForm inputs discovery # config.cache_discovery = !Rails.env.development? # Default class for inputs # config.input_class = nil # Define the default class of the input wrapper of the boolean input. config.boolean_label_class = 'checkbox' # Defines if the default input wrapper class should be included in radio # collection wrappers. # config.include_default_input_wrapper_class = true # Defines which i18n scope will be used in Simple Form. # config.i18n_scope = 'simple_form' end
Java
<?php namespace Craft\UserBundle; use Symfony\Component\HttpKernel\Bundle\Bundle; class CraftUserBundle extends Bundle { }
Java
<?php defined('BASEPATH') OR exit('No direct script access allowed'); class TestModel extends CI_Model { public function popular_merchants(){ //include total reviews, sum of reviews, mp_id, unit, building, street, city name, region name, merchant name, merchant image, date and time of application approval, sub category $sql = "(SELECT SUM(gr.rev_rate) AS sum_rev, COUNT(gr.rev_rate) AS total_rev, gr.mp_id AS ref_id,mp.mp_unit AS unit_add,mp.mp_building AS building_add,mp.mp_street AS street_add,ac.city_name AS merchant_city_name,ar.region_name AS merchant_region_name,ma.ma_merchant_name AS merchant_name,ma.ma_application_datetime AS datetime_approve, cs.cs_description AS merchant_sub_cat, gml.logo_name AS merchant_image FROM gl_review gr INNER JOIN gl_merchant_profile mp ON gr.mp_id = mp.mp_id INNER JOIN gl_merchant_application ma ON mp.ma_id = ma.ma_id INNER JOIN gl_address_city ac ON mp.city_id = ac.city_id INNER JOIN gl_address_region ar ON mp.region_id = ar.region_id INNER JOIN gl_category_sub cs ON ma.cs_id = cs.cs_id INNER JOIN gl_merchant_logo gml ON gml.mp_id = mp.mp_id AND ma.pub_id= 1 GROUP BY ref_id ORDER BY sum_rev DESC, datetime_approve ASC LIMIT 12)"; $q = $this->db->query($sql); return ($q->num_rows() > 0) ? $q->result() : false; } public function insert_lang($lang_name,$lang_flag){ $this->db->set('lang_name', $lang_name); $this->db->set('lang_flag', $lang_flag); $this->db->insert('language'); return ($this->db->affected_rows() > 0) ? true : false; } public function check_lang($lang_name){ $this->db->where('lang_name', $lang_name); $q = $this->db->get('language'); return ($q->num_rows() > 0) ? true : false; } public function list_lang(){ $q = $this->db->get('language'); return ($q->num_rows() > 0) ? $q->result_array() : false; } public function delete_lang($lang_id){ $this->db->where('lang_id', $lang_id); $this->db->delete('language'); return ($this->db->affected_rows() > 0) ? true : false; } public function bookmarks($ui_id){ $sql = "SELECT CONCAT_WS('-', REPLACE(`ma`.`ma_merchant_name`, ' ', '-'), REPLACE(`ac`.`city_name`, ' ', '-')) AS `merchant_linkname`, `mp`.`mp_id` AS `merchant_prof_id`, `ma`.`ma_id` AS `merchant_app_id`, `ma`.`ma_merchant_name` AS `merchant_name`, `ma`.`cm_id` AS `merchant_main_cat_id`, `cm`.`cm_category` AS `merchant_main_cat_text`, `ma`.`cs_id` AS `merchant_sub_cat_id`, `cs`.`cs_description` AS `merchant_sub_cat_text`, `ma`.`ma_email` AS `merchant_email`, `ma`.`ma_contact_number` AS `merchant_contact_number`, `ma`.`ma_status` AS `merchant_status`, `bk`.book_id AS `book_id` FROM `gl_bookmark` `bk` LEFT JOIN `gl_merchant_profile` `mp` ON `mp`.`mp_id` = `bk`.`mp_id` LEFT JOIN `gl_merchant_application` `ma` ON `ma`.`ma_id` = `mp`.`ma_id` LEFT JOIN `gl_address_city` `ac` ON `ac`.`city_id` = `mp`.`city_id` LEFT JOIN `gl_category_main` `cm` ON `cm`.`cm_id` = `ma`.`cm_id` LEFT JOIN `gl_category_sub` `cs` ON `cs`.`cs_id` = `ma`.`cs_id` LEFT JOIN `gl_address_region` `ar` ON `ar`.`region_id` = `mp`.`region_id` WHERE `bk`.`ui_id` = '".$ui_id."' "; $q = $this->db->query($sql); return ($q->num_rows() > 0) ? $q->result() : false; } public function check_bookmark($ui_id , $mp_id){ $sql = "SELECT * FROM `gl_bookmark` WHERE `ui_id` = '".$ui_id."' AND `mp_id` = '".$mp_id."'"; $q = $this->db->query($sql); return ($q->num_rows() > 0) ? true : false; } public function add_bookmark($data) { return ($this->db->insert('gl_bookmark',$data))?$this->db->insert_id():false; } public function delete_bookmark($ui_id , $book_id){ $sql = "DELETE FROM `gl_bookmark` WHERE `ui_id` = '".$ui_id."' AND `book_id` = '".$book_id."'"; $q = $this->db->query($sql); return ($this->db->affected_rows() > 0) ? true : false; } }
Java
/* * Copyright (c) 2013 Triforce - in association with the University of Pretoria and Epi-Use <Advance/> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package afk.ge.tokyo.ems.nodes; import afk.ge.ems.Node; import afk.ge.tokyo.ems.components.Life; /** * * @author Daniel */ public class LifeNode extends Node { public Life life; }
Java
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Documentation Module: DBConnector</title> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/sunlight.default.css"> <link type="text/css" rel="stylesheet" href="styles/site.flatly.css"> </head> <body> <div class="container-fluid"> <div class="navbar navbar-fixed-top "> <div class="navbar-inner"> <a class="brand" href="index.html">Documentation</a> <ul class="nav"> <li class="dropdown"> <a href="modules.list.html" class="dropdown-toggle" data-toggle="dropdown">Modules<b class="caret"></b></a> <ul class="dropdown-menu "> <li> <a href="module-Dashboard.html">Dashboard</a> </li> <li> <a href="module-DBConnector.html">DBConnector</a> </li> <li> <a href="module-MessageCenter.html">MessageCenter</a> </li> <li> <a href="module-Mocks.html">Mocks</a> </li> <li> <a href="module-Widget.html">Widget</a> </li> <li> <a href="module-WidgetMap.html">WidgetMap</a> </li> </ul> </li> <li class="dropdown"> <a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b class="caret"></b></a> <ul class="dropdown-menu "> <li> <a href="module-Dashboard-Dashboard.html">Dashboard</a> </li> <li> <a href="module-Widget-Widget.html">Widget</a> </li> </ul> </li> </ul> </div> </div> <div class="row-fluid"> <div class="span8"> <div id="main"> <h1 class="page-title">Module: DBConnector</h1> <section> <header> <h2> DBConnector </h2> </header> <article> <div class="container-overview"> <div class="description">Database connector module<br> Implements ajax data fetching from Cache back-end</div> <dl class="details"> </dl> </div> <h3 class="subsection-title">Members</h3> <dl> <dt> <h4 class="name" id="defaults"><span class="type-signature">&lt;private> </span>defaults<code><span class="type-signature"> :Object</span></code></h4> </dt> <dd> <div class="description"> Default settings for DBConnector </div> <h5>Type:</h5> <ul> <li> <span class="param-type">Object</span> </li> </ul> <dl class="details"> <h5 class="subsection-title">Properties:</h5> <dl> <table class="props table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>username</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">Username to connect to DB</td> </tr> <tr> <td class="name"><code>password</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">Password to connect to DB</td> </tr> </tbody> </table> </dl> </dl> </dd> </dl> <h3 class="subsection-title">Methods</h3> <table class="table table-stripped"> <tr> <td> <h4 class="name" id="acquireData"><span class="type-signature"></span>acquireData<span class="signature">()</span><span class="type-signature"></span></h4> </td> <td> <div class="description"> Does ajax request for data from server </div> <dl class="details"> </dl> <h5>Fires:</h5> <ul> <li>module:MessageCenter#event:*_data_acquired</li> </ul> <h5>Listens to Events:</h5> <ul> <li>module:MessageCenter#event:data_requested</li> </ul> </td> </tr> <tr> <td> <h4 class="name" id="acquireFilters"><span class="type-signature"></span>acquireFilters<span class="signature">()</span><span class="type-signature"></span></h4> </td> <td> <div class="description"> Acquires filter list for cube from server </div> <dl class="details"> </dl> <h5>Fires:</h5> <ul> <li>module:MessageCenter#event:filters_acquired</li> </ul> <h5>Listens to Events:</h5> <ul> <li>module:MessageCenter#event:filters_requested</li> </ul> </td> </tr> <tr> <td> <h4 class="name" id="acquireFilterValues"><span class="type-signature"></span>acquireFilterValues<span class="signature">()</span><span class="type-signature"></span></h4> </td> <td> <div class="description"> Acquire possible values for selected filter </div> <dl class="details"> </dl> <h5>Fires:</h5> <ul> <li>module:MessageCenter#event:filter_list_acquired[path]</li> </ul> <h5>Listens to Events:</h5> <ul> <li>module:MessageCenter#event:filter_list_requested</li> </ul> </td> </tr> <tr> <td> <h4 class="name" id="toString"><span class="type-signature"></span>toString<span class="signature">()</span><span class="type-signature"> &rarr; {String}</span></h4> </td> <td> <dl class="details"> </dl> <h5>Returns:</h5> <div class="param-desc"> Module name </div> <dl> <dt> Type </dt> <dd> <span class="param-type">String</span> </dd> </dl> </td> </tr> </table> </article> </section> </div> <div class="clearfix"></div> <footer> <span class="jsdoc-message"> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha8</a> on 2014-09-11T04:54:51+04:00 using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>. </span> </footer> </div> <div class="span3"> <div id="toc"></div> </div> <br clear="both"> </div> </div> <!--<script src="scripts/sunlight.js"></script>--> <script src="scripts/docstrap.lib.js"></script> <script src="scripts/bootstrap-dropdown.js"></script> <script src="scripts/toc.js"></script> <script> $( function () { $( "#toc" ).toc( { anchorName : function ( i, heading, prefix ) { return $( heading ).attr( "id" ) || ( prefix + i ); }, selectors : "h1,h2,h3,h4", showAndHide : false, scrollTo : 60 } ); $( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" ); $( "#main span[id^='toc']" ).addClass( "toc-shim" ); $('.dropdown-toggle').dropdown(); // $( ".tutorial-section pre, .readme-section pre" ).addClass( "sunlight-highlight-javascript" ).addClass( "linenums" ); $( ".tutorial-section pre, .readme-section pre" ).each( function () { var $this = $( this ); var example = $this.find("code" ); exampleText = example.html(); var lang = /{@lang (.*?)}/.exec( exampleText ); if ( lang && lang[1] ) { exampleText = exampleText.replace( lang[0], "" ); example.html(exampleText); lang = lang[1]; } else { lang = "javascript"; } if ( lang ) { $this .addClass( "sunlight-highlight-" + lang ) .addClass( "linenums" ) .html( example.html() ); } } ); Sunlight.highlightAll( { lineNumbers : false, showMenu:true, enableDoclinks:true } ); } ); </script> <!--Google Analytics--> <!--Navigation and Symbol Display--> </body> </html>
Java
import * as types from '../actions/types'; const search = (state = [], action) => { switch(action.type) { case types.SEARCH_INPUT_SUCCESS: return action.data; case types.SEARCH_INPUT_FAILED: return action.error.message; default: return state; } }; export default search;
Java
using System; using System.Collections.Generic; using System.Text; namespace Light.Data.Mysql.Test { class BaseFieldSelectModelNull { #region "Data Property" private int id; /// <summary> /// Id /// </summary> /// <value></value> public int Id { get { return this.id; } set { this.id = value; } } private bool? boolFieldNull; /// <summary> /// BoolField /// </summary> /// <value></value> public bool? BoolFieldNull { get { return this.boolFieldNull; } set { this.boolFieldNull = value; } } private sbyte? sbyteFieldNull; /// <summary> /// SbyteField /// </summary> /// <value></value> public sbyte? SbyteFieldNull { get { return this.sbyteFieldNull; } set { this.sbyteFieldNull = value; } } private byte? byteFieldNull; /// <summary> /// ByteField /// </summary> /// <value></value> public byte? ByteFieldNull { get { return this.byteFieldNull; } set { this.byteFieldNull = value; } } private short? int16FieldNull; /// <summary> /// Int16Field /// </summary> /// <value></value> public short? Int16FieldNull { get { return this.int16FieldNull; } set { this.int16FieldNull = value; } } private ushort? uInt16FieldNull; /// <summary> /// UInt16Field /// </summary> /// <value></value> public ushort? UInt16FieldNull { get { return this.uInt16FieldNull; } set { this.uInt16FieldNull = value; } } private int? int32FieldNull; /// <summary> /// Int32Field /// </summary> /// <value></value> public int? Int32FieldNull { get { return this.int32FieldNull; } set { this.int32FieldNull = value; } } private uint? uInt32FieldNull; /// <summary> /// UInt32Field /// </summary> /// <value></value> public uint? UInt32FieldNull { get { return this.uInt32FieldNull; } set { this.uInt32FieldNull = value; } } private long? int64FieldNull; /// <summary> /// Int64Field /// </summary> /// <value></value> public long? Int64FieldNull { get { return this.int64FieldNull; } set { this.int64FieldNull = value; } } private ulong? uInt64FieldNull; /// <summary> /// UInt64Field /// </summary> /// <value></value> public ulong? UInt64FieldNull { get { return this.uInt64FieldNull; } set { this.uInt64FieldNull = value; } } private float? floatFieldNull; /// <summary> /// FloatField /// </summary> /// <value></value> public float? FloatFieldNull { get { return this.floatFieldNull; } set { this.floatFieldNull = value; } } private double? doubleFieldNull; /// <summary> /// DoubleField /// </summary> /// <value></value> public double? DoubleFieldNull { get { return this.doubleFieldNull; } set { this.doubleFieldNull = value; } } private decimal? decimalFieldNull; /// <summary> /// DecimalField /// </summary> /// <value></value> public decimal? DecimalFieldNull { get { return this.decimalFieldNull; } set { this.decimalFieldNull = value; } } private DateTime? dateTimeFieldNull; /// <summary> /// DateTimeField /// </summary> /// <value></value> public DateTime? DateTimeFieldNull { get { return this.dateTimeFieldNull; } set { this.dateTimeFieldNull = value; } } private string varcharFieldNull; /// <summary> /// VarcharField /// </summary> /// <value></value> public string VarcharFieldNull { get { return this.varcharFieldNull; } set { this.varcharFieldNull = value; } } private string textFieldNull; /// <summary> /// TextField /// </summary> /// <value></value> public string TextFieldNull { get { return this.textFieldNull; } set { this.textFieldNull = value; } } private byte[] bigDataFieldNull; /// <summary> /// BigDataField /// </summary> /// <value></value> public byte[] BigDataFieldNull { get { return this.bigDataFieldNull; } set { this.bigDataFieldNull = value; } } private EnumInt32Type enumInt32FieldNull; /// <summary> /// EnumInt32Field /// </summary> /// <value></value> public EnumInt32Type EnumInt32FieldNull { get { return this.enumInt32FieldNull; } set { this.enumInt32FieldNull = value; } } private EnumInt64Type enumInt64FieldNull; /// <summary> /// EnumInt64Field /// </summary> /// <value></value> public EnumInt64Type EnumInt64FieldNull { get { return this.enumInt64FieldNull; } set { this.enumInt64FieldNull = value; } } #endregion } }
Java
// // YWPayViewController.h // YuWa // // Created by 黄佳峰 on 16/10/10. // Copyright © 2016年 Shanghai DuRui Information Technology Company. All rights reserved. // #import <UIKit/UIKit.h> typedef NS_ENUM(NSInteger,PayCategory){ PayCategoryQRCodePay=0, //二维码支付 PayCategoryWritePay //手写支付 }; @interface YWPayViewController : UIViewController @property(nonatomic,assign)PayCategory whichPay; //哪种支付 @property(nonatomic,strong)NSString*shopID; //店铺的id @property(nonatomic,strong)NSString*shopName; //店铺的名字 @property(nonatomic,assign)CGFloat shopZhekou; //店铺的折扣 //如果是 扫码支付 就得有下面的参数 否则就不需要 @property(nonatomic,assign)CGFloat payAllMoney; //需要支付的总额 @property(nonatomic,assign)CGFloat NOZheMoney; //不打折的金额 //---------------------------------------------- //折扣多少 +(instancetype)payViewControllerCreatWithWritePayAndShopNameStr:(NSString*)shopName andShopID:(NSString*)shopID andZhekou:(CGFloat)shopZhekou; +(instancetype)payViewControllerCreatWithQRCodePayAndShopNameStr:(NSString*)shopName andShopID:(NSString*)shopID andZhekou:(CGFloat)shopZhekou andpayAllMoney:(CGFloat)payAllMoney andNOZheMoney:(CGFloat)NOZheMoney; @end
Java
.ui.video{position:relative;max-width:100%}.ui.video .placeholder{background-color:#333;display:block;width:100%;height:100%}.ui.video .embed,.ui.video.active .placeholder,.ui.video.active .play{display:none}.ui.video .play{cursor:pointer;position:absolute;top:0;left:0;z-index:10;width:100%;height:100%;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=60)";filter:alpha(opacity=60);opacity:.6;-webkit-transition:opacity .3s;-moz-transition:opacity .3s;transition:opacity .3s}.ui.video .play.icon:before{position:absolute;top:50%;left:50%;z-index:11;font-size:6rem;margin:-3rem 0 0 -3rem;color:#FFF;text-shadow:0 3px 3px rgba(0,0,0,.4)}.ui.video .play:hover{opacity:1}.ui.video.active .embed{display:block}
Java
<?php use PHPUnit\Framework\TestCase; use voku\helper\HtmlDomHelper; use voku\helper\HtmlDomParser; /** * @internal */ final class SimpleHtmlHelperTest extends TestCase { public function testMergeHtmlAttributes() { $result = HtmlDomHelper::mergeHtmlAttributes( '<div class="foo" id="bar" data-foo="bar"></div>', 'class="foo2" data-lall="foo"', '#bar' ); self::assertSame('<div class="foo foo2" id="bar" data-foo="bar" data-lall="foo"></div>', $result); } }
Java
<?php namespace Youshido\CommentsBundle; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\Bundle; use Youshido\CommentsBundle\DependencyInjection\CompilerPass\CommentsCompilerPass; /** * Class CommentsBundle */ class CommentsBundle extends Bundle { /** * @param ContainerBuilder $container */ public function build(ContainerBuilder $container) { parent::build($container); $container->addCompilerPass(new CommentsCompilerPass()); } }
Java
<table width="90%" border="0"><tr><td><script>function openfile(url) {fullwin = window.open(url, "fulltext", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes");}</script><div class="layoutclass_pic"><div class="layoutclass_first_pic"><table class="ztable"><tr><th class="ztd1"><b>成語&nbsp;</b></th><td class="ztd2">後起之秀</td></tr> <tr><th class="ztd1"><b>典故說明&nbsp;</b></th><td class="ztd2"> 王忱是東晉的才子,在年輕的時候就已經很有文名,曾當過荊州刺史、建武將軍。他的舅父范甯是當時有名的學者,經常會有一些知名人士前來拜訪他。有一次王忱到范甯家中拜訪,正好有一個叫張玄的人也來拜訪范甯,張玄的學問淵博,也是當時一個有名望的學者。范甯認為他們兩人都是一時俊彥,想介紹他們認識,就請他們彼此交談。張玄覺得自己年紀稍長,就沒有先向王忱開口。結果王忱見張玄不願先開口,自己也不說話。兩人沈默地對坐了很久,最後張玄很失望地離去。范甯見到這種情形,便問王忱說︰「張玄是一個很有才華的人,你怎麼不跟他聊聊呢?」王忱回答道:「如果他真的想要認識我,可以先開口跟我說話啊!」范甯聽了,覺得王忱年紀雖輕,卻自視不凡,便稱讚他說:「你的才智抱負那麼高,真是後來之秀啊!」典源又見《晉書.卷四三.郭舒傳》。「後起之秀」在此處亦用來稱讚郭舒是年輕一輩中的優秀人物。後來「後起之秀」這句成語就從這裡演變而出,用來稱譽後輩中的優秀人物。</font></td></tr> </td></tr></table></div> <!-- layoutclass_first_pic --><div class="layoutclass_second_pic"></div> <!-- layoutclass_second_pic --></div> <!-- layoutclass_pic --></td></tr></table>
Java
#include <stdio.h> #include <set> #include <utility> #include <vector> using namespace std; const int MAXN = 1e+2; int n, x0, y0; typedef pair<int, int> point; set<point> s; int cross(int x0, int y0, const point &a, const point &b) { return (a.first - x0) * (b.second - y0) - (a.second - y0) * (b.first - x0); } int main() { scanf("%d %d %d", &n, &x0, &y0); int x, y; for (int i = 0; i < n; i++) { scanf("%d %d", &x, &y); s.emplace(x, y); } int n = s.size(); vector<point> v(s.begin(), s.end()); vector<bool> dead(n); int count = 0; for (int i = 0; i < n; i++) { if (dead[i]) { continue; } dead[i] = true; count++; for (int j = i + 1; j < n; j++) { if (dead[j]) { continue; } if (!cross(x0, y0, v[i], v[j])) { dead[j] = true; } } } printf("%d\n", count); }
Java
// 1000. 连通性问题 #include <iostream> using namespace std; int unionFind[100001]; int find(int val) { if (val == unionFind[val]) return val; unionFind[val] = find(unionFind[val]); return unionFind[val]; } int main() { int a, b; for (int i = 0; i < 100001; i++) { unionFind[i] = i; } while (cin >> a >> b) { if (find(a) != find(b)) { cout << a << ' ' << b << endl; unionFind[find(a)] = unionFind[find(b)]; } } }
Java
# This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.pw/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse as time_parse import yawhois class TestWhoisNicPwStatusAvailable(object): def setUp(self): fixture_path = "spec/fixtures/responses/whois.nic.pw/status_available.txt" host = "whois.nic.pw" part = yawhois.record.Part(open(fixture_path, "r").read(), host) self.record = yawhois.record.Record(None, [part]) def test_status(self): eq_(self.record.status, []) def test_available(self): eq_(self.record.available, True) def test_domain(self): eq_(self.record.domain, None) def test_nameservers(self): eq_(self.record.nameservers.__class__.__name__, 'list') eq_(self.record.nameservers, []) def test_admin_contacts(self): eq_(self.record.admin_contacts.__class__.__name__, 'list') eq_(self.record.admin_contacts, []) def test_registered(self): eq_(self.record.registered, False) def test_created_on(self): eq_(self.record.created_on, None) def test_registrar(self): eq_(self.record.registrar, None) def test_registrant_contacts(self): eq_(self.record.registrant_contacts.__class__.__name__, 'list') eq_(self.record.registrant_contacts, []) def test_technical_contacts(self): eq_(self.record.technical_contacts.__class__.__name__, 'list') eq_(self.record.technical_contacts, []) def test_updated_on(self): eq_(self.record.updated_on, None) def test_domain_id(self): eq_(self.record.domain_id, None) def test_expires_on(self): eq_(self.record.expires_on, None) def test_disclaimer(self): eq_(self.record.disclaimer, None)
Java
<?php class ProvinceModel extends CI_Model { function __construct() { parent::__construct(); } /** * 插入数据 * @param $insertRows * @return mixed */ function insert_entry($insertRows) { foreach ($insertRows as $key => $val) { $this->$key = $val; } $res = $this->db->insert('province', $this); return $res; } /** * 修改数据 * @param $updateRows * @return mixed */ function update_entry($updateRows) { foreach ($updateRows as $key => $val) { if ($key !== 'id') { $this->$key = $val; } } $res = $this->db->update('province', $this, array('id' => $updateRows['id'])); return $res; } /** * 查询数据 * @param string $field * @param $where * @param int $offset * @param int $count * @return mixed */ function getData($field = '*', $where = '', $offset = 0, $count = 20) { $this->db->select($field); if (!empty($where) && is_array($where)) { foreach ($where as $key => $val) { $this->db->where($key, $val); } } $query = $this->db->get('province', $count, $offset); return $query->result(); } /** * 获取数据总量 * @return mixed */ function getCount() { return $this->db->count_all('province'); } }
Java
.sidenav { height: 100%; width: 0; position: fixed; z-index: 1; top: 0; left: 0; background-color: #111; overflow-x: hidden; transition: 0.5s; padding-top: 60px; } .sidenav a { padding: 8px 8px 8px 32px; text-decoration: none; font-size: 25px; color: #818181; display: block; transition: 0.3s; } .sidenav a:hover, .offcanvas a:focus{ color: #f1f1f1; } .sidenav .closebtn { position: absolute; top: 0; right: 25px; font-size: 36px; margin-left: 50px; } @media screen and (max-height: 450px) { .sidenav {padding-top: 15px;} .sidenav a {font-size: 18px;} }
Java
#!/bin/sh sqlite3 -echo db/test.db < db/schema_context_a.sql
Java
<?xml version="1.0" ?><!DOCTYPE TS><TS language="fa" version="2.0"> <defaultcodec>UTF-8</defaultcodec> <context> <name>AboutDialog</name> <message> <location filename="../forms/aboutdialog.ui" line="+14"/> <source>About KCz</source> <translation>در مورد KCz</translation> </message> <message> <location line="+39"/> <source>&lt;b&gt;KCz&lt;/b&gt; version</source> <translation>نسخه KCz</translation> </message> <message> <location line="+57"/> <source> This is experimental software. Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php. This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard.</source> <translation>⏎ ⏎ این نسخه نرم افزار آزمایشی است⏎ ⏎ نرم افزار تحت لیسانس MIT/X11 منتشر شده است. به فایل coping یا آدرس http://www.opensource.org/licenses/mit-license.php. مراجعه شود⏎ ⏎ این محصول شامل نرم افزاری است که با OpenSSL برای استفاده از OpenSSL Toolkit (http://www.openssl.org/) و نرم افزار نوشته شده توسط اریک یانگ (eay@cryptsoft.com ) و UPnP توسط توماس برنارد طراحی شده است.</translation> </message> <message> <location filename="../aboutdialog.cpp" line="+14"/> <source>Copyright</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>The KCz developers</source> <translation type="unfinished"/> </message> </context> <context> <name>AddressBookPage</name> <message> <location filename="../forms/addressbookpage.ui" line="+14"/> <source>Address Book</source> <translation>فهرست آدرس</translation> </message> <message> <location line="+19"/> <source>Double-click to edit address or label</source> <translation>برای ویرایش آدرس یا بر چسب دو بار کلیک کنید</translation> </message> <message> <location line="+27"/> <source>Create a new address</source> <translation>آدرس جدید ایجاد کنید</translation> </message> <message> <location line="+14"/> <source>Copy the currently selected address to the system clipboard</source> <translation>آدرس انتخاب شده در سیستم تخته رسم گیره دار کپی کنید</translation> </message> <message> <location line="-11"/> <source>&amp;New Address</source> <translation>آدرس جدید</translation> </message> <message> <location filename="../addressbookpage.cpp" line="+63"/> <source>These are your KCz addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source> <translation>این آدرسها، آدرسهای KCz شما برای دریافت وجوه هستند. شما ممکن است آدرسهای متفاوت را به هر گیرنده اختصاص دهید که بتوانید مواردی که پرداخت می کنید را پیگیری نمایید</translation> </message> <message> <location filename="../forms/addressbookpage.ui" line="+14"/> <source>&amp;Copy Address</source> <translation>کپی آدرس</translation> </message> <message> <location line="+11"/> <source>Show &amp;QR Code</source> <translation>نمایش &amp;کد QR</translation> </message> <message> <location line="+11"/> <source>Sign a message to prove you own a KCz address</source> <translation>پیام را برای اثبات آدرس KCz خود امضا کنید</translation> </message> <message> <location line="+3"/> <source>Sign &amp;Message</source> <translation>امضا و پیام</translation> </message> <message> <location line="+25"/> <source>Delete the currently selected address from the list</source> <translation>آدرس انتخاب شده در سیستم تخته رسم گیره دا حذف</translation> </message> <message> <location line="+27"/> <source>Export the data in the current tab to a file</source> <translation>داده ها نوارِ جاری را به فایل انتقال دهید</translation> </message> <message> <location line="+3"/> <source>&amp;Export</source> <translation type="unfinished"/> </message> <message> <location line="-44"/> <source>Verify a message to ensure it was signed with a specified KCz address</source> <translation>یک پیام را برای حصول اطمینان از ورود به سیستم با آدرس KCz مشخص، شناسایی کنید</translation> </message> <message> <location line="+3"/> <source>&amp;Verify Message</source> <translation>شناسایی پیام</translation> </message> <message> <location line="+14"/> <source>&amp;Delete</source> <translation>حذف</translation> </message> <message> <location filename="../addressbookpage.cpp" line="-5"/> <source>These are your KCz addresses for sending payments. Always check the amount and the receiving address before sending coins.</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>Copy &amp;Label</source> <translation>کپی و برچسب گذاری</translation> </message> <message> <location line="+1"/> <source>&amp;Edit</source> <translation>ویرایش</translation> </message> <message> <location line="+1"/> <source>Send &amp;Coins</source> <translation type="unfinished"/> </message> <message> <location line="+260"/> <source>Export Address Book Data</source> <translation>آدرس انتخاب شده در سیستم تخته رسم گیره دار کپی کنید</translation> </message> <message> <location line="+1"/> <source>Comma separated file (*.csv)</source> <translation>Comma separated file (*.csv)</translation> </message> <message> <location line="+13"/> <source>Error exporting</source> <translation>خطای صدور</translation> </message> <message> <location line="+0"/> <source>Could not write to file %1.</source> <translation>تا فایل %1 نمی شود نوشت</translation> </message> </context> <context> <name>AddressTableModel</name> <message> <location filename="../addresstablemodel.cpp" line="+144"/> <source>Label</source> <translation>بر چسب</translation> </message> <message> <location line="+0"/> <source>Address</source> <translation>آدرس</translation> </message> <message> <location line="+36"/> <source>(no label)</source> <translation>بدون برچسب</translation> </message> </context> <context> <name>AskPassphraseDialog</name> <message> <location filename="../forms/askpassphrasedialog.ui" line="+26"/> <source>Passphrase Dialog</source> <translation>دیالوگ Passphrase </translation> </message> <message> <location line="+21"/> <source>Enter passphrase</source> <translation>وارد عبارت عبور</translation> </message> <message> <location line="+14"/> <source>New passphrase</source> <translation>عبارت عبور نو</translation> </message> <message> <location line="+14"/> <source>Repeat new passphrase</source> <translation>تکرار عبارت عبور نو</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="+33"/> <source>Enter the new passphrase to the wallet.&lt;br/&gt;Please use a passphrase of &lt;b&gt;10 or more random characters&lt;/b&gt;, or &lt;b&gt;eight or more words&lt;/b&gt;.</source> <translation>وارد کنید..&amp;lt;br/&amp;gt عبارت عبور نو در پنجره 10 یا بیشتر کاراکتورهای تصادفی استفاده کنید &amp;lt;b&amp;gt لطفا عبارت عبور</translation> </message> <message> <location line="+1"/> <source>Encrypt wallet</source> <translation>رمز بندی پنجره</translation> </message> <message> <location line="+3"/> <source>This operation needs your wallet passphrase to unlock the wallet.</source> <translation>این عملیت نیاز عبارت عبور پنجره شما دارد برای رمز گشایی آن</translation> </message> <message> <location line="+5"/> <source>Unlock wallet</source> <translation>تکرار عبارت عبور نو</translation> </message> <message> <location line="+3"/> <source>This operation needs your wallet passphrase to decrypt the wallet.</source> <translation>این عملیت نیاز عبارت عبور شما دارد برای رمز بندی آن</translation> </message> <message> <location line="+5"/> <source>Decrypt wallet</source> <translation>رمز بندی پنجره</translation> </message> <message> <location line="+3"/> <source>Change passphrase</source> <translation>تغییر عبارت عبور</translation> </message> <message> <location line="+1"/> <source>Enter the old and new passphrase to the wallet.</source> <translation>عبارت عبور نو و قدیم در پنجره وارد کنید</translation> </message> <message> <location line="+46"/> <source>Confirm wallet encryption</source> <translation>تایید رمز گذاری</translation> </message> <message> <location line="+1"/> <source>Warning: If you encrypt your wallet and lose your passphrase, you will &lt;b&gt;LOSE ALL OF YOUR BITCOMMODITIZ&lt;/b&gt;!</source> <translation>هشدار: اگر wallet رمزگذاری شود و شما passphrase را گم کنید شما همه اطلاعات KCz را از دست خواهید داد.</translation> </message> <message> <location line="+0"/> <source>Are you sure you wish to encrypt your wallet?</source> <translation>آیا اطمینان دارید که می خواهید wallet رمزگذاری شود؟</translation> </message> <message> <location line="+15"/> <source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source> <translation type="unfinished"/> </message> <message> <location line="+100"/> <location line="+24"/> <source>Warning: The Caps Lock key is on!</source> <translation>هشدار: Caps lock key روشن است</translation> </message> <message> <location line="-130"/> <location line="+58"/> <source>Wallet encrypted</source> <translation>تغییر عبارت عبور</translation> </message> <message> <location line="-56"/> <source>KCz will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your KCzs from being stolen by malware infecting your computer.</source> <translation>Biticon هم اکنون بسته می‌شود تا فرایند رمزگذاری را تمام کند. به خاطر داشته باشید که رمزگذاری کیف پولتان نمی‌تواند به طور کامل بیتیکون‌های شما را در برابر دزدیده شدن توسط بدافزارهایی که رایانه شما را آلوده می‌کنند، محافظت نماید.</translation> </message> <message> <location line="+13"/> <location line="+7"/> <location line="+42"/> <location line="+6"/> <source>Wallet encryption failed</source> <translation>عبارت عبور نو و قدیم در پنجره وارد کنید</translation> </message> <message> <location line="-54"/> <source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source> <translation>تنا موفق رمز بندی پنجره ناشی از خطای داخل شد. پنجره شما مرز بندی نشده است</translation> </message> <message> <location line="+7"/> <location line="+48"/> <source>The supplied passphrases do not match.</source> <translation>عبارت عبور عرضه تطابق نشد</translation> </message> <message> <location line="-37"/> <source>Wallet unlock failed</source> <translation>نجره رمز گذار شد</translation> </message> <message> <location line="+1"/> <location line="+11"/> <location line="+19"/> <source>The passphrase entered for the wallet decryption was incorrect.</source> <translation>اموفق رمز بندی پنجر</translation> </message> <message> <location line="-20"/> <source>Wallet decryption failed</source> <translation>ناموفق رمز بندی پنجره</translation> </message> <message> <location line="+14"/> <source>Wallet passphrase was successfully changed.</source> <translation>wallet passphrase با موفقیت تغییر یافت</translation> </message> </context> <context> <name>BitcoinGUI</name> <message> <location filename="../bitcoingui.cpp" line="+233"/> <source>Sign &amp;message...</source> <translation>امضا و پیام</translation> </message> <message> <location line="+280"/> <source>Synchronizing with network...</source> <translation>همگام سازی با شبکه ...</translation> </message> <message> <location line="-349"/> <source>&amp;Overview</source> <translation>بررسی اجمالی</translation> </message> <message> <location line="+1"/> <source>Show general overview of wallet</source> <translation>نمای کلی پنجره نشان بده</translation> </message> <message> <location line="+20"/> <source>&amp;Transactions</source> <translation>&amp;معاملات</translation> </message> <message> <location line="+1"/> <source>Browse transaction history</source> <translation>نمایش تاریخ معاملات</translation> </message> <message> <location line="+7"/> <source>Edit the list of stored addresses and labels</source> <translation>ویرایش لیست آدرسها و بر چسب های ذخیره ای</translation> </message> <message> <location line="-14"/> <source>Show the list of addresses for receiving payments</source> <translation>نمایش لیست آدرس ها برای در یافت پر داخت ها</translation> </message> <message> <location line="+31"/> <source>E&amp;xit</source> <translation>خروج</translation> </message> <message> <location line="+1"/> <source>Quit application</source> <translation>خروج از برنامه </translation> </message> <message> <location line="+4"/> <source>Show information about KCz</source> <translation>نمایش اطلاعات در مورد بیتکویین</translation> </message> <message> <location line="+2"/> <source>About &amp;Qt</source> <translation>درباره &amp;Qt</translation> </message> <message> <location line="+1"/> <source>Show information about Qt</source> <translation>نمایش اطلاعات درباره Qt</translation> </message> <message> <location line="+2"/> <source>&amp;Options...</source> <translation>تنظیمات...</translation> </message> <message> <location line="+6"/> <source>&amp;Encrypt Wallet...</source> <translation>رمزگذاری wallet</translation> </message> <message> <location line="+3"/> <source>&amp;Backup Wallet...</source> <translation>پشتیبان گیری از wallet</translation> </message> <message> <location line="+2"/> <source>&amp;Change Passphrase...</source> <translation>تغییر Passphrase</translation> </message> <message> <location line="+285"/> <source>Importing blocks from disk...</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Reindexing blocks on disk...</source> <translation type="unfinished"/> </message> <message> <location line="-347"/> <source>Send coins to a KCz address</source> <translation>سکه ها را به آدرس bitocin ارسال کن</translation> </message> <message> <location line="+49"/> <source>Modify configuration options for KCz</source> <translation>انتخابهای پیکربندی را برای KCz اصلاح کن</translation> </message> <message> <location line="+9"/> <source>Backup wallet to another location</source> <translation>نسخه پیشتیبان wallet را به محل دیگر انتقال دهید</translation> </message> <message> <location line="+2"/> <source>Change the passphrase used for wallet encryption</source> <translation>عبارت عبور رمز گشایی پنجره تغییر کنید</translation> </message> <message> <location line="+6"/> <source>&amp;Debug window</source> <translation>اشکال زدایی از صفحه</translation> </message> <message> <location line="+1"/> <source>Open debugging and diagnostic console</source> <translation>کنسول اشکال زدایی و تشخیص را باز کنید</translation> </message> <message> <location line="-4"/> <source>&amp;Verify message...</source> <translation>بازبینی پیام</translation> </message> <message> <location line="-165"/> <location line="+530"/> <source>KCz</source> <translation>یت کویین </translation> </message> <message> <location line="-530"/> <source>Wallet</source> <translation>wallet</translation> </message> <message> <location line="+101"/> <source>&amp;Send</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>&amp;Receive</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>&amp;Addresses</source> <translation type="unfinished"/> </message> <message> <location line="+22"/> <source>&amp;About KCz</source> <translation>در مورد KCz</translation> </message> <message> <location line="+9"/> <source>&amp;Show / Hide</source> <translation>&amp;نمایش/ عدم نمایش</translation> </message> <message> <location line="+1"/> <source>Show or hide the main Window</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Encrypt the private keys that belong to your wallet</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Sign messages with your KCz addresses to prove you own them</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Verify messages to ensure they were signed with specified KCz addresses</source> <translation type="unfinished"/> </message> <message> <location line="+28"/> <source>&amp;File</source> <translation>فایل</translation> </message> <message> <location line="+7"/> <source>&amp;Settings</source> <translation>تنظیمات</translation> </message> <message> <location line="+6"/> <source>&amp;Help</source> <translation>کمک</translation> </message> <message> <location line="+9"/> <source>Tabs toolbar</source> <translation>نوار ابزار زبانه ها</translation> </message> <message> <location line="+17"/> <location line="+10"/> <source>[testnet]</source> <translation>آزمایش شبکه</translation> </message> <message> <location line="+47"/> <source>KCz client</source> <translation>مشتری KCz</translation> </message> <message numerus="yes"> <location line="+141"/> <source>%n active connection(s) to KCz network</source> <translation><numerusform>در صد ارتباطات فعال بیتکویین با شبکه %n</numerusform></translation> </message> <message> <location line="+22"/> <source>No block source available...</source> <translation type="unfinished"/> </message> <message> <location line="+12"/> <source>Processed %1 of %2 (estimated) blocks of transaction history.</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Processed %1 blocks of transaction history.</source> <translation type="unfinished"/> </message> <message numerus="yes"> <location line="+20"/> <source>%n hour(s)</source> <translation type="unfinished"><numerusform></numerusform></translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n day(s)</source> <translation type="unfinished"><numerusform></numerusform></translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n week(s)</source> <translation type="unfinished"><numerusform></numerusform></translation> </message> <message> <location line="+4"/> <source>%1 behind</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>Last received block was generated %1 ago.</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Transactions after this will not yet be visible.</source> <translation type="unfinished"/> </message> <message> <location line="+22"/> <source>Error</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Warning</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Information</source> <translation type="unfinished"/> </message> <message> <location line="+70"/> <source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source> <translation type="unfinished"/> </message> <message> <location line="-140"/> <source>Up to date</source> <translation>تا تاریخ</translation> </message> <message> <location line="+31"/> <source>Catching up...</source> <translation>ابتلا به بالا</translation> </message> <message> <location line="+113"/> <source>Confirm transaction fee</source> <translation>هزینه تراکنش را تایید کنید</translation> </message> <message> <location line="+8"/> <source>Sent transaction</source> <translation>معامله ارسال شده</translation> </message> <message> <location line="+0"/> <source>Incoming transaction</source> <translation>معامله در یافت شده</translation> </message> <message> <location line="+1"/> <source>Date: %1 Amount: %2 Type: %3 Address: %4 </source> <translation>تاریخ %1 مبلغ%2 نوع %3 آدرس %4</translation> </message> <message> <location line="+33"/> <location line="+23"/> <source>URI handling</source> <translation>مدیریت URI</translation> </message> <message> <location line="-23"/> <location line="+23"/> <source>URI can not be parsed! This can be caused by an invalid KCz address or malformed URI parameters.</source> <translation>URI قابل تحلیل نیست. این خطا ممکن است به دلیل ادرس LITECOIN اشتباه یا پارامترهای اشتباه URI رخ داده باشد</translation> </message> <message> <location line="+17"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;unlocked&lt;/b&gt;</source> <translation>زمایش شبکهه</translation> </message> <message> <location line="+8"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;locked&lt;/b&gt;</source> <translation>زمایش شبکه</translation> </message> <message> <location filename="../bitcoin.cpp" line="+111"/> <source>A fatal error occurred. KCz can no longer continue safely and will quit.</source> <translation>خطا روی داده است. KCz نمی تواند بدون مشکل ادامه دهد و باید بسته شود</translation> </message> </context> <context> <name>ClientModel</name> <message> <location filename="../clientmodel.cpp" line="+104"/> <source>Network Alert</source> <translation>پیام شبکه</translation> </message> </context> <context> <name>EditAddressDialog</name> <message> <location filename="../forms/editaddressdialog.ui" line="+14"/> <source>Edit Address</source> <translation>اصلاح آدرس</translation> </message> <message> <location line="+11"/> <source>&amp;Label</source> <translation>بر چسب</translation> </message> <message> <location line="+10"/> <source>The label associated with this address book entry</source> <translation>بر چسب با دفتر آدرس ورود مرتبط است</translation> </message> <message> <location line="+7"/> <source>&amp;Address</source> <translation>آدرس</translation> </message> <message> <location line="+10"/> <source>The address associated with this address book entry. This can only be modified for sending addresses.</source> <translation>آدرس با دفتر آدرس ورودی مرتبط است. این فقط در مورد آدرسهای ارسال شده است</translation> </message> <message> <location filename="../editaddressdialog.cpp" line="+21"/> <source>New receiving address</source> <translation>آدرس در یافت نو</translation> </message> <message> <location line="+4"/> <source>New sending address</source> <translation>آدرس ارسال نو</translation> </message> <message> <location line="+3"/> <source>Edit receiving address</source> <translation>اصلاح آدرس در یافت</translation> </message> <message> <location line="+4"/> <source>Edit sending address</source> <translation>اصلاح آدرس ارسال</translation> </message> <message> <location line="+76"/> <source>The entered address &quot;%1&quot; is already in the address book.</source> <translation>%1آدرس وارد شده دیگر در دفتر آدرس است</translation> </message> <message> <location line="-5"/> <source>The entered address &quot;%1&quot; is not a valid KCz address.</source> <translation>آدرس وارد شده %1 یک ادرس صحیح KCz نیست</translation> </message> <message> <location line="+10"/> <source>Could not unlock wallet.</source> <translation>رمز گشایی پنجره امکان پذیر نیست</translation> </message> <message> <location line="+5"/> <source>New key generation failed.</source> <translation>کلید نسل جدید ناموفق است</translation> </message> </context> <context> <name>GUIUtil::HelpMessageBox</name> <message> <location filename="../guiutil.cpp" line="+424"/> <location line="+12"/> <source>KCz-Qt</source> <translation>KCz-Qt</translation> </message> <message> <location line="-12"/> <source>version</source> <translation>نسخه</translation> </message> <message> <location line="+2"/> <source>Usage:</source> <translation>ستفاده :</translation> </message> <message> <location line="+1"/> <source>command-line options</source> <translation>انتخابها برای خطوط دستور command line</translation> </message> <message> <location line="+4"/> <source>UI options</source> <translation>انتخابهای UI </translation> </message> <message> <location line="+1"/> <source>Set language, for example &quot;de_DE&quot; (default: system locale)</source> <translation>زبان را تنظیم کنید برای مثال &quot;de_DE&quot; (پیش فرض: system locale)</translation> </message> <message> <location line="+1"/> <source>Start minimized</source> <translation>شروع حد اقل</translation> </message> <message> <location line="+1"/> <source>Show splash screen on startup (default: 1)</source> <translation>نمایش صفحه splash در STARTUP (پیش فرض:1)</translation> </message> </context> <context> <name>OptionsDialog</name> <message> <location filename="../forms/optionsdialog.ui" line="+14"/> <source>Options</source> <translation>اصلی</translation> </message> <message> <location line="+16"/> <source>&amp;Main</source> <translation>اصلی</translation> </message> <message> <location line="+6"/> <source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB.</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>Pay transaction &amp;fee</source> <translation>دستمزد&amp;پر داخت معامله</translation> </message> <message> <location line="+31"/> <source>Automatically start KCz after logging in to the system.</source> <translation>در زمان ورود به سیستم به صورت خودکار KCz را اجرا کن</translation> </message> <message> <location line="+3"/> <source>&amp;Start KCz on system login</source> <translation>اجرای KCz در زمان ورود به سیستم</translation> </message> <message> <location line="+35"/> <source>Reset all client options to default.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>&amp;Reset Options</source> <translation type="unfinished"/> </message> <message> <location line="+13"/> <source>&amp;Network</source> <translation>شبکه</translation> </message> <message> <location line="+6"/> <source>Automatically open the KCz client port on the router. This only works when your router supports UPnP and it is enabled.</source> <translation>اتوماتیک باز کردن بندر بیتکویین در روتر . این فقط در مواردی می باشد که روتر با کمک یو پ ن پ کار می کند</translation> </message> <message> <location line="+3"/> <source>Map port using &amp;UPnP</source> <translation>درگاه با استفاده از</translation> </message> <message> <location line="+7"/> <source>Connect to the KCz network through a SOCKS proxy (e.g. when connecting through Tor).</source> <translation>اتصال به شبکه LITECOIN از طریق پراکسی ساکس (برای مثال وقتی از طریق نرم افزار TOR متصل می شوید)</translation> </message> <message> <location line="+3"/> <source>&amp;Connect through SOCKS proxy:</source> <translation>اتصال با پراکسی SOCKS</translation> </message> <message> <location line="+9"/> <source>Proxy &amp;IP:</source> <translation>پراکسی و آی.پی.</translation> </message> <message> <location line="+19"/> <source>IP address of the proxy (e.g. 127.0.0.1)</source> <translation>درس پروکسی</translation> </message> <message> <location line="+7"/> <source>&amp;Port:</source> <translation>درگاه</translation> </message> <message> <location line="+19"/> <source>Port of the proxy (e.g. 9050)</source> <translation>درگاه پراکسی (مثال 9050)</translation> </message> <message> <location line="+7"/> <source>SOCKS &amp;Version:</source> <translation>SOCKS و نسخه</translation> </message> <message> <location line="+13"/> <source>SOCKS version of the proxy (e.g. 5)</source> <translation>نسخه SOCKS از پراکسی (مثال 5)</translation> </message> <message> <location line="+36"/> <source>&amp;Window</source> <translation>صفحه</translation> </message> <message> <location line="+6"/> <source>Show only a tray icon after minimizing the window.</source> <translation>tray icon را تنها بعد از کوچک کردن صفحه نمایش بده</translation> </message> <message> <location line="+3"/> <source>&amp;Minimize to the tray instead of the taskbar</source> <translation>حد اقل رساندن در جای نوار ابزار ها</translation> </message> <message> <location line="+7"/> <source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.</source> <translation>حد اقل رساندن در جای خروج بر نامه وقتیکه پنجره بسته است.وقتیکه این فعال است برنامه خاموش می شود بعد از انتخاب دستور خاموش در منیو</translation> </message> <message> <location line="+3"/> <source>M&amp;inimize on close</source> <translation>کوچک کردن صفحه در زمان بستن</translation> </message> <message> <location line="+21"/> <source>&amp;Display</source> <translation>نمایش</translation> </message> <message> <location line="+8"/> <source>User Interface &amp;language:</source> <translation>میانجی کاربر و زبان</translation> </message> <message> <location line="+13"/> <source>The user interface language can be set here. This setting will take effect after restarting KCz.</source> <translation>زبان میانجی کاربر می تواند در اینجا تنظیم شود. این تنظیمات بعد از شروع دوباره RESTART در LITECOIN اجرایی خواهند بود.</translation> </message> <message> <location line="+11"/> <source>&amp;Unit to show amounts in:</source> <translation>واحد برای نمایش میزان وجوه در:</translation> </message> <message> <location line="+13"/> <source>Choose the default subdivision unit to show in the interface and when sending coins.</source> <translation>بخش فرعی پیش فرض را برای نمایش میانجی و زمان ارسال سکه ها مشخص و انتخاب نمایید</translation> </message> <message> <location line="+9"/> <source>Whether to show KCz addresses in the transaction list or not.</source> <translation>تا آدرسهای bITCOIN در فهرست تراکنش نمایش داده شوند یا نشوند.</translation> </message> <message> <location line="+3"/> <source>&amp;Display addresses in transaction list</source> <translation>نمایش آدرسها در فهرست تراکنش</translation> </message> <message> <location line="+71"/> <source>&amp;OK</source> <translation>تایید</translation> </message> <message> <location line="+7"/> <source>&amp;Cancel</source> <translation>رد</translation> </message> <message> <location line="+10"/> <source>&amp;Apply</source> <translation>انجام</translation> </message> <message> <location filename="../optionsdialog.cpp" line="+53"/> <source>default</source> <translation>پیش فرض</translation> </message> <message> <location line="+130"/> <source>Confirm options reset</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Some settings may require a client restart to take effect.</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Do you want to proceed?</source> <translation type="unfinished"/> </message> <message> <location line="+42"/> <location line="+9"/> <source>Warning</source> <translation>هشدار</translation> </message> <message> <location line="-9"/> <location line="+9"/> <source>This setting will take effect after restarting KCz.</source> <translation>این تنظیمات پس از اجرای دوباره KCz اعمال می شوند</translation> </message> <message> <location line="+29"/> <source>The supplied proxy address is invalid.</source> <translation>آدرس پراکسی داده شده صحیح نیست</translation> </message> </context> <context> <name>OverviewPage</name> <message> <location filename="../forms/overviewpage.ui" line="+14"/> <source>Form</source> <translation>تراز</translation> </message> <message> <location line="+50"/> <location line="+166"/> <source>The displayed information may be out of date. Your wallet automatically synchronizes with the KCz network after a connection is established, but this process has not completed yet.</source> <translation>اطلاعات نمایش داده شده روزآمد نیستند.wallet شما به صورت خودکار با شبکه KCz بعد از برقراری اتصال روزآمد می شود اما این فرایند هنوز کامل نشده است.</translation> </message> <message> <location line="-124"/> <source>Balance:</source> <translation>راز:</translation> </message> <message> <location line="+29"/> <source>Unconfirmed:</source> <translation>تایید نشده</translation> </message> <message> <location line="-78"/> <source>Wallet</source> <translation>wallet</translation> </message> <message> <location line="+107"/> <source>Immature:</source> <translation>نابالغ</translation> </message> <message> <location line="+13"/> <source>Mined balance that has not yet matured</source> <translation>بالانس/تتمه حساب استخراج شده، نابالغ است /تکمیل نشده است</translation> </message> <message> <location line="+46"/> <source>&lt;b&gt;Recent transactions&lt;/b&gt;</source> <translation>اخرین معاملات&amp;lt</translation> </message> <message> <location line="-101"/> <source>Your current balance</source> <translation>تزار جاری شما</translation> </message> <message> <location line="+29"/> <source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source> <translation>تعداد معاملات که تایید شده ولی هنوز در تزار جاری شما بر شمار نرفته است</translation> </message> <message> <location filename="../overviewpage.cpp" line="+116"/> <location line="+1"/> <source>out of sync</source> <translation>روزآمد نشده</translation> </message> </context> <context> <name>PaymentServer</name> <message> <location filename="../paymentserver.cpp" line="+107"/> <source>Cannot start KCz: click-to-pay handler</source> <translation type="unfinished"/> </message> </context> <context> <name>QRCodeDialog</name> <message> <location filename="../forms/qrcodedialog.ui" line="+14"/> <source>QR Code Dialog</source> <translation>دیالوگ QR CODE</translation> </message> <message> <location line="+59"/> <source>Request Payment</source> <translation>درخواست پرداخت</translation> </message> <message> <location line="+56"/> <source>Amount:</source> <translation>مقدار:</translation> </message> <message> <location line="-44"/> <source>Label:</source> <translation>برچسب:</translation> </message> <message> <location line="+19"/> <source>Message:</source> <translation>پیام</translation> </message> <message> <location line="+71"/> <source>&amp;Save As...</source> <translation>&amp;ذخیره به عنوان...</translation> </message> <message> <location filename="../qrcodedialog.cpp" line="+62"/> <source>Error encoding URI into QR Code.</source> <translation>خطا در زمان رمزدار کردن URI در کد QR</translation> </message> <message> <location line="+40"/> <source>The entered amount is invalid, please check.</source> <translation>میزان وجه وارد شده صحیح نیست، لطفا بررسی نمایید</translation> </message> <message> <location line="+23"/> <source>Resulting URI too long, try to reduce the text for label / message.</source> <translation>URI ذکر شده بسیار طولانی است، متن برچسب/پیام را کوتاه کنید</translation> </message> <message> <location line="+25"/> <source>Save QR Code</source> <translation>ذخیره کد QR</translation> </message> <message> <location line="+0"/> <source>PNG Images (*.png)</source> <translation>تصاویر با فرمت PNG (*.png)</translation> </message> </context> <context> <name>RPCConsole</name> <message> <location filename="../forms/rpcconsole.ui" line="+46"/> <source>Client name</source> <translation>نام مشتری</translation> </message> <message> <location line="+10"/> <location line="+23"/> <location line="+26"/> <location line="+23"/> <location line="+23"/> <location line="+36"/> <location line="+53"/> <location line="+23"/> <location line="+23"/> <location filename="../rpcconsole.cpp" line="+339"/> <source>N/A</source> <translation>-</translation> </message> <message> <location line="-217"/> <source>Client version</source> <translation>نسخه مشتری</translation> </message> <message> <location line="-45"/> <source>&amp;Information</source> <translation>اطلاعات</translation> </message> <message> <location line="+68"/> <source>Using OpenSSL version</source> <translation>استفاده از نسخه OPENSSL</translation> </message> <message> <location line="+49"/> <source>Startup time</source> <translation>زمان آغاز STARTUP</translation> </message> <message> <location line="+29"/> <source>Network</source> <translation>شبکه</translation> </message> <message> <location line="+7"/> <source>Number of connections</source> <translation>تعداد اتصالات</translation> </message> <message> <location line="+23"/> <source>On testnet</source> <translation>در testnetکها</translation> </message> <message> <location line="+23"/> <source>Block chain</source> <translation>زنجیره بلاک</translation> </message> <message> <location line="+7"/> <source>Current number of blocks</source> <translation>تعداد کنونی بلاکها</translation> </message> <message> <location line="+23"/> <source>Estimated total blocks</source> <translation>تعداد تخمینی بلاکها</translation> </message> <message> <location line="+23"/> <source>Last block time</source> <translation>زمان آخرین بلاک</translation> </message> <message> <location line="+52"/> <source>&amp;Open</source> <translation>باز کردن</translation> </message> <message> <location line="+16"/> <source>Command-line options</source> <translation>گزینه های command-line</translation> </message> <message> <location line="+7"/> <source>Show the KCz-Qt help message to get a list with possible KCz command-line options.</source> <translation>پیام راهنمای KCz-Qt را برای گرفتن فهرست گزینه های command-line نشان بده</translation> </message> <message> <location line="+3"/> <source>&amp;Show</source> <translation>نمایش</translation> </message> <message> <location line="+24"/> <source>&amp;Console</source> <translation>کنسول</translation> </message> <message> <location line="-260"/> <source>Build date</source> <translation>ساخت تاریخ</translation> </message> <message> <location line="-104"/> <source>KCz - Debug window</source> <translation>صفحه اشکال زدایی KCz </translation> </message> <message> <location line="+25"/> <source>KCz Core</source> <translation> هسته KCz </translation> </message> <message> <location line="+279"/> <source>Debug log file</source> <translation>فایلِ لاگِ اشکال زدایی</translation> </message> <message> <location line="+7"/> <source>Open the KCz debug log file from the current data directory. This can take a few seconds for large log files.</source> <translation>فایلِ لاگِ اشکال زدایی KCz را از دایرکتوری جاری داده ها باز کنید. این عملیات ممکن است برای فایلهای لاگِ حجیم طولانی شود.</translation> </message> <message> <location line="+102"/> <source>Clear console</source> <translation>پاکسازی کنسول</translation> </message> <message> <location filename="../rpcconsole.cpp" line="-30"/> <source>Welcome to the KCz RPC console.</source> <translation>به کنسول KCz RPC خوش آمدید</translation> </message> <message> <location line="+1"/> <source>Use up and down arrows to navigate history, and &lt;b&gt;Ctrl-L&lt;/b&gt; to clear screen.</source> <translation>دکمه های بالا و پایین برای مرور تاریخچه و Ctrl-L برای پاکسازی صفحه</translation> </message> <message> <location line="+1"/> <source>Type &lt;b&gt;help&lt;/b&gt; for an overview of available commands.</source> <translation>با تایپ عبارت HELP دستورهای در دسترس را مرور خواهید کرد</translation> </message> </context> <context> <name>SendCoinsDialog</name> <message> <location filename="../forms/sendcoinsdialog.ui" line="+14"/> <location filename="../sendcoinsdialog.cpp" line="+124"/> <location line="+5"/> <location line="+5"/> <location line="+5"/> <location line="+6"/> <location line="+5"/> <location line="+5"/> <source>Send Coins</source> <translation>ارسال سکه ها</translation> </message> <message> <location line="+50"/> <source>Send to multiple recipients at once</source> <translation>ارسال چندین در یافت ها فورا</translation> </message> <message> <location line="+3"/> <source>Add &amp;Recipient</source> <translation>اضافه کردن دریافت کننده</translation> </message> <message> <location line="+20"/> <source>Remove all transaction fields</source> <translation>پاک کردن تمام ستون‌های تراکنش</translation> </message> <message> <location line="+3"/> <source>Clear &amp;All</source> <translation>پاکسازی همه</translation> </message> <message> <location line="+22"/> <source>Balance:</source> <translation>تزار :</translation> </message> <message> <location line="+10"/> <source>123.456 BTC</source> <translation>123.456 بتس</translation> </message> <message> <location line="+31"/> <source>Confirm the send action</source> <translation>عملیت دوم تایید کنید</translation> </message> <message> <location line="+3"/> <source>S&amp;end</source> <translation>&amp;;ارسال</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="-59"/> <source>&lt;b&gt;%1&lt;/b&gt; to %2 (%3)</source> <translation>(%3) تا &lt;b&gt;%1&lt;/b&gt; درصد%2</translation> </message> <message> <location line="+5"/> <source>Confirm send coins</source> <translation>ارسال سکه ها تایید کنید</translation> </message> <message> <location line="+1"/> <source>Are you sure you want to send %1?</source> <translation> %1شما متماینید که می خواهید 1% ارسال کنید ؟</translation> </message> <message> <location line="+0"/> <source> and </source> <translation>و</translation> </message> <message> <location line="+23"/> <source>The recipient address is not valid, please recheck.</source> <translation>آدرس گیرنده نادرست است، لطفا دوباره بررسی کنید.</translation> </message> <message> <location line="+5"/> <source>The amount to pay must be larger than 0.</source> <translation>مبلغ پر داخت باید از 0 بیشتر باشد </translation> </message> <message> <location line="+5"/> <source>The amount exceeds your balance.</source> <translation>میزان وجه از بالانس/تتمه حساب شما بیشتر است</translation> </message> <message> <location line="+5"/> <source>The total exceeds your balance when the %1 transaction fee is included.</source> <translation>کل میزان وجه از بالانس/تتمه حساب شما بیشتر می شود وقتی %1 هزینه تراکنش نیز به ین میزان افزوده می شود</translation> </message> <message> <location line="+6"/> <source>Duplicate address found, can only send to each address once per send operation.</source> <translation>آدرس تکراری یافت شده است، در زمان انجام عملیات به هر آدرس تنها یکبار می توانید اطلاعات ارسال کنید</translation> </message> <message> <location line="+5"/> <source>Error: Transaction creation failed!</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source> <translation>خطا: تراکنش تایید نشد. این پیام زمانی روی می دهد که مقداری از سکه های WALLET شما استفاده شده اند برای مثال اگر شما از WALLET.DAT استفاده کرده اید، ممکن است سکه ها استفاده شده باشند اما در اینجا نمایش داده نشوند</translation> </message> </context> <context> <name>SendCoinsEntry</name> <message> <location filename="../forms/sendcoinsentry.ui" line="+14"/> <source>Form</source> <translation>تراز</translation> </message> <message> <location line="+15"/> <source>A&amp;mount:</source> <translation>A&amp;مبلغ :</translation> </message> <message> <location line="+13"/> <source>Pay &amp;To:</source> <translation>به&amp;پر داخت :</translation> </message> <message> <location line="+34"/> <source>The address to send the payment to (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source> <translation type="unfinished"/> </message> <message> <location line="+60"/> <location filename="../sendcoinsentry.cpp" line="+26"/> <source>Enter a label for this address to add it to your address book</source> <translation>برای آدرس بر پسب وارد کنید که در دفتر آدرس اضافه شود</translation> </message> <message> <location line="-78"/> <source>&amp;Label:</source> <translation>&amp;بر چسب </translation> </message> <message> <location line="+28"/> <source>Choose address from address book</source> <translation>اآدرسن ازدفتر آدرس انتخاب کنید</translation> </message> <message> <location line="+10"/> <source>Alt+A</source> <translation>Alt+A</translation> </message> <message> <location line="+7"/> <source>Paste address from clipboard</source> <translation>آدرس از تخته رسم گیره دار پست کنید </translation> </message> <message> <location line="+10"/> <source>Alt+P</source> <translation>Alt+P</translation> </message> <message> <location line="+7"/> <source>Remove this recipient</source> <translation>بر داشتن این در یافت کننده</translation> </message> <message> <location filename="../sendcoinsentry.cpp" line="+1"/> <source>Enter a KCz address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source> <translation>آدرس بیتکویین وارد کنید (bijvoorbeeld: Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation> </message> </context> <context> <name>SignVerifyMessageDialog</name> <message> <location filename="../forms/signverifymessagedialog.ui" line="+14"/> <source>Signatures - Sign / Verify a Message</source> <translation>امضا - امضا کردن /شناسایی یک پیام</translation> </message> <message> <location line="+13"/> <source>&amp;Sign Message</source> <translation>&amp;امضای پیام</translation> </message> <message> <location line="+6"/> <source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source> <translation>شما می توانید پیامها را با آدرس خودتان امضا نمایید تا ثابت شود متعلق به شما هستند. مواظب باشید تا چیزی که بدان مطمئن نیستنید را امضا نکنید زیرا حملات فیشینگ در زمان ورود شما به سیستم فریبنده هستند. تنها مواردی را که حاوی اطلاعات دقیق و قابل قبول برای شما هستند را امضا کنید</translation> </message> <message> <location line="+18"/> <source>The address to sign the message with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source> <translation>آدرس برای امضا کردن پیام با (برای مثال Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation> </message> <message> <location line="+10"/> <location line="+213"/> <source>Choose an address from the address book</source> <translation>یک آدرس را از فهرست آدرسها انتخاب کنید</translation> </message> <message> <location line="-203"/> <location line="+213"/> <source>Alt+A</source> <translation>Alt+A</translation> </message> <message> <location line="-203"/> <source>Paste address from clipboard</source> <translation>آدرس از تخته رسم گیره دار پست کنید </translation> </message> <message> <location line="+10"/> <source>Alt+P</source> <translation>Alt+P</translation> </message> <message> <location line="+12"/> <source>Enter the message you want to sign here</source> <translation>پیامی را که می‌خواهید امضا کنید در اینجا وارد کنید</translation> </message> <message> <location line="+7"/> <source>Signature</source> <translation type="unfinished"/> </message> <message> <location line="+27"/> <source>Copy the current signature to the system clipboard</source> <translation>این امضا را در system clipboard کپی کن</translation> </message> <message> <location line="+21"/> <source>Sign the message to prove you own this KCz address</source> <translation>پیام را برای اثبات آدرس LITECOIN خود امضا کنید</translation> </message> <message> <location line="+3"/> <source>Sign &amp;Message</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>Reset all sign message fields</source> <translation>تنظیم دوباره تمامی فیلدهای پیام</translation> </message> <message> <location line="+3"/> <location line="+146"/> <source>Clear &amp;All</source> <translation>پاکسازی همه</translation> </message> <message> <location line="-87"/> <source>&amp;Verify Message</source> <translation>تایید پیام</translation> </message> <message> <location line="+6"/> <source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source> <translation>آدرس/پیام خود را وارد کنید (مطمئن شوید که فاصله بین خطوط، فاصله ها، تب ها و ... را دقیقا کپی می کنید) و سپس امضا کنید تا پیام تایید شود. مراقب باشید که پیام را بیشتر از مطالب درون امضا مطالعه نمایید تا فریب شخص سوم/دزدان اینترنتی را نخورید.</translation> </message> <message> <location line="+21"/> <source>The address the message was signed with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source> <translation>آدرس برای امضا کردن پیام با (برای مثال Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation> </message> <message> <location line="+40"/> <source>Verify the message to ensure it was signed with the specified KCz address</source> <translation>پیام را برای اطمنان از ورود به سیستم با آدرس LITECOIN مشخص خود،تایید کنید</translation> </message> <message> <location line="+3"/> <source>Verify &amp;Message</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>Reset all verify message fields</source> <translation>تنظیم دوباره تمامی فیلدهای پیام تایید شده</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="+27"/> <location line="+3"/> <source>Enter a KCz address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source> <translation>آدرس بیتکویین وارد کنید (bijvoorbeeld: Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation> </message> <message> <location line="-2"/> <source>Click &quot;Sign Message&quot; to generate signature</source> <translation>با کلیک بر &quot;امضای پیام&quot; شما یک امضای جدید درست می کنید</translation> </message> <message> <location line="+3"/> <source>Enter KCz signature</source> <translation>امضای BITOCOIN خود را وارد کنید</translation> </message> <message> <location line="+82"/> <location line="+81"/> <source>The entered address is invalid.</source> <translation>آدرس وارد شده صحیح نیست</translation> </message> <message> <location line="-81"/> <location line="+8"/> <location line="+73"/> <location line="+8"/> <source>Please check the address and try again.</source> <translation>اطفا آدرس را بررسی کرده و دوباره امتحان کنید</translation> </message> <message> <location line="-81"/> <location line="+81"/> <source>The entered address does not refer to a key.</source> <translation>آدرس وارد شده با کلید وارد شده مرتبط نیست</translation> </message> <message> <location line="-73"/> <source>Wallet unlock was cancelled.</source> <translation>قفل کردن wallet انجام نشد</translation> </message> <message> <location line="+8"/> <source>Private key for the entered address is not available.</source> <translation>کلید شخصی برای آدرس وارد شده در دسترس نیست</translation> </message> <message> <location line="+12"/> <source>Message signing failed.</source> <translation>پیام امضا کردن انجام نشد</translation> </message> <message> <location line="+5"/> <source>Message signed.</source> <translation>پیام امضا شد</translation> </message> <message> <location line="+59"/> <source>The signature could not be decoded.</source> <translation>امضا نمی تواند رمزگشایی شود</translation> </message> <message> <location line="+0"/> <location line="+13"/> <source>Please check the signature and try again.</source> <translation>لطفا امضا را بررسی و دوباره تلاش نمایید</translation> </message> <message> <location line="+0"/> <source>The signature did not match the message digest.</source> <translation>امضا با تحلیلِ پیام مطابقت ندارد</translation> </message> <message> <location line="+7"/> <source>Message verification failed.</source> <translation>عملیات شناسایی پیام انجام نشد</translation> </message> <message> <location line="+5"/> <source>Message verified.</source> <translation>پیام شناسایی شد</translation> </message> </context> <context> <name>SplashScreen</name> <message> <location filename="../splashscreen.cpp" line="+22"/> <source>The KCz developers</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>[testnet]</source> <translation>آزمایش شبکه</translation> </message> </context> <context> <name>TransactionDesc</name> <message> <location filename="../transactiondesc.cpp" line="+20"/> <source>Open until %1</source> <translation>باز کردن تا%1</translation> </message> <message> <location line="+6"/> <source>%1/offline</source> <translation>%1 آفلاین</translation> </message> <message> <location line="+2"/> <source>%1/unconfirmed</source> <translation>%1 تایید نشده </translation> </message> <message> <location line="+2"/> <source>%1 confirmations</source> <translation>ایید %1 </translation> </message> <message> <location line="+18"/> <source>Status</source> <translation>وضعیت</translation> </message> <message numerus="yes"> <location line="+7"/> <source>, broadcast through %n node(s)</source> <translation><numerusform>انتشار از طریق n% گره انتشار از طریق %n گره</numerusform></translation> </message> <message> <location line="+4"/> <source>Date</source> <translation>تاریخ </translation> </message> <message> <location line="+7"/> <source>Source</source> <translation>منبع</translation> </message> <message> <location line="+0"/> <source>Generated</source> <translation>تولید شده</translation> </message> <message> <location line="+5"/> <location line="+17"/> <source>From</source> <translation>فرستنده</translation> </message> <message> <location line="+1"/> <location line="+22"/> <location line="+58"/> <source>To</source> <translation>گیرنده</translation> </message> <message> <location line="-77"/> <location line="+2"/> <source>own address</source> <translation>آدرس شما</translation> </message> <message> <location line="-2"/> <source>label</source> <translation>برچسب</translation> </message> <message> <location line="+37"/> <location line="+12"/> <location line="+45"/> <location line="+17"/> <location line="+30"/> <source>Credit</source> <translation>بدهی </translation> </message> <message numerus="yes"> <location line="-102"/> <source>matures in %n more block(s)</source> <translation><numerusform>بلوغ در n% از بیشتر بلاکها بلوغ در %n از بیشتر بلاکها</numerusform></translation> </message> <message> <location line="+2"/> <source>not accepted</source> <translation>غیرقابل قبول</translation> </message> <message> <location line="+44"/> <location line="+8"/> <location line="+15"/> <location line="+30"/> <source>Debit</source> <translation>اعتبار</translation> </message> <message> <location line="-39"/> <source>Transaction fee</source> <translation>هزینه تراکنش</translation> </message> <message> <location line="+16"/> <source>Net amount</source> <translation>هزینه خالص</translation> </message> <message> <location line="+6"/> <source>Message</source> <translation>پیام</translation> </message> <message> <location line="+2"/> <source>Comment</source> <translation>نظر</translation> </message> <message> <location line="+2"/> <source>Transaction ID</source> <translation>شناسه کاربری برای تراکنش</translation> </message> <message> <location line="+3"/> <source>Generated coins must mature 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to &quot;not accepted&quot; and it won&apos;t be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source> <translation>سکه های ایجاد شده باید 120 بلاک را قبل از استفاده بالغ کنند. در هنگام ایجاد بلاک، آن بلاک در شبکه منتشر می شود تا به زنجیره بلاکها بپیوندد. اگر در زنجیره قرار نگیرد، پیام وضعیت به غیرقابل قبول تغییر می بپیابد و قابل استفاده نیست. این مورد معمولا زمانی پیش می آید که گره دیگری به طور همزمان بلاکی را با فاصل چند ثانیه ای از شما ایجاد کند.</translation> </message> <message> <location line="+7"/> <source>Debug information</source> <translation>اشکال زدایی طلاعات</translation> </message> <message> <location line="+8"/> <source>Transaction</source> <translation>تراکنش</translation> </message> <message> <location line="+3"/> <source>Inputs</source> <translation>درونداد</translation> </message> <message> <location line="+23"/> <source>Amount</source> <translation>مبلغ</translation> </message> <message> <location line="+1"/> <source>true</source> <translation>صحیح</translation> </message> <message> <location line="+0"/> <source>false</source> <translation>نادرست</translation> </message> <message> <location line="-209"/> <source>, has not been successfully broadcast yet</source> <translation>هنوز با مو فقیت ارسال نشده</translation> </message> <message numerus="yes"> <location line="-35"/> <source>Open for %n more block(s)</source> <translation type="unfinished"><numerusform></numerusform></translation> </message> <message> <location line="+70"/> <source>unknown</source> <translation>مشخص نیست </translation> </message> </context> <context> <name>TransactionDescDialog</name> <message> <location filename="../forms/transactiondescdialog.ui" line="+14"/> <source>Transaction details</source> <translation>جزییات معاملات</translation> </message> <message> <location line="+6"/> <source>This pane shows a detailed description of the transaction</source> <translation>در این قاب شیشه توصیف دقیق معامله نشان می شود</translation> </message> </context> <context> <name>TransactionTableModel</name> <message> <location filename="../transactiontablemodel.cpp" line="+225"/> <source>Date</source> <translation>تاریخ</translation> </message> <message> <location line="+0"/> <source>Type</source> <translation>نوع</translation> </message> <message> <location line="+0"/> <source>Address</source> <translation>ایل جدا </translation> </message> <message> <location line="+0"/> <source>Amount</source> <translation>مبلغ</translation> </message> <message numerus="yes"> <location line="+57"/> <source>Open for %n more block(s)</source> <translation type="unfinished"><numerusform></numerusform></translation> </message> <message> <location line="+3"/> <source>Open until %1</source> <translation>از شده تا 1%1</translation> </message> <message> <location line="+3"/> <source>Offline (%1 confirmations)</source> <translation>افلایین (%1)</translation> </message> <message> <location line="+3"/> <source>Unconfirmed (%1 of %2 confirmations)</source> <translation>تایید نشده (%1/%2)</translation> </message> <message> <location line="+3"/> <source>Confirmed (%1 confirmations)</source> <translation>تایید شده (%1)</translation> </message> <message numerus="yes"> <location line="+8"/> <source>Mined balance will be available when it matures in %n more block(s)</source> <translation><numerusform>بالانس/تتمه حساب استخراج شده زمانی که %n از بیشتر بلاکها بالغ شدند در دسترس خواهد بود بالانس/تتمه حساب استخراج شده زمانی که n% از بیشتر بلاکها بالغ شدند در دسترس خواهد بود</numerusform></translation> </message> <message> <location line="+5"/> <source>This block was not received by any other nodes and will probably not be accepted!</source> <translation>این بلوک از دیگر گره ها در یافت نشده بدین دلیل شاید قابل قابول نیست</translation> </message> <message> <location line="+3"/> <source>Generated but not accepted</source> <translation>تولید شده ولی قبول نشده</translation> </message> <message> <location line="+43"/> <source>Received with</source> <translation>در یافت با :</translation> </message> <message> <location line="+2"/> <source>Received from</source> <translation>دریافتی از</translation> </message> <message> <location line="+3"/> <source>Sent to</source> <translation>ارسال به :</translation> </message> <message> <location line="+2"/> <source>Payment to yourself</source> <translation>پر داخت به خودتان</translation> </message> <message> <location line="+2"/> <source>Mined</source> <translation>استخراج</translation> </message> <message> <location line="+38"/> <source>(n/a)</source> <translation>(کاربرد ندارد)</translation> </message> <message> <location line="+199"/> <source>Transaction status. Hover over this field to show number of confirmations.</source> <translation>وضعیت معالمه . عرصه که تعداد تایید نشان می دهد</translation> </message> <message> <location line="+2"/> <source>Date and time that the transaction was received.</source> <translation>تاریخ و ساعت در یافت معامله</translation> </message> <message> <location line="+2"/> <source>Type of transaction.</source> <translation>نوع معاملات</translation> </message> <message> <location line="+2"/> <source>Destination address of transaction.</source> <translation>آدرس مقصود معاملات </translation> </message> <message> <location line="+2"/> <source>Amount removed from or added to balance.</source> <translation>مبلغ از تزار شما خارج یا وارد شده</translation> </message> </context> <context> <name>TransactionView</name> <message> <location filename="../transactionview.cpp" line="+52"/> <location line="+16"/> <source>All</source> <translation>همه</translation> </message> <message> <location line="-15"/> <source>Today</source> <translation>امروز</translation> </message> <message> <location line="+1"/> <source>This week</source> <translation>این هفته</translation> </message> <message> <location line="+1"/> <source>This month</source> <translation>این ماه</translation> </message> <message> <location line="+1"/> <source>Last month</source> <translation>ماه گذشته</translation> </message> <message> <location line="+1"/> <source>This year</source> <translation>امسال</translation> </message> <message> <location line="+1"/> <source>Range...</source> <translation>محدوده </translation> </message> <message> <location line="+11"/> <source>Received with</source> <translation>در یافت با</translation> </message> <message> <location line="+2"/> <source>Sent to</source> <translation>ارسال به</translation> </message> <message> <location line="+2"/> <source>To yourself</source> <translation>به خودتان </translation> </message> <message> <location line="+1"/> <source>Mined</source> <translation>استخراج</translation> </message> <message> <location line="+1"/> <source>Other</source> <translation>یگر </translation> </message> <message> <location line="+7"/> <source>Enter address or label to search</source> <translation>برای جست‌‌وجو نشانی یا برچسب را وارد کنید</translation> </message> <message> <location line="+7"/> <source>Min amount</source> <translation>حد اقل مبلغ </translation> </message> <message> <location line="+34"/> <source>Copy address</source> <translation>کپی آدرس </translation> </message> <message> <location line="+1"/> <source>Copy label</source> <translation>کپی بر چسب</translation> </message> <message> <location line="+1"/> <source>Copy amount</source> <translation>روگرفت مقدار</translation> </message> <message> <location line="+1"/> <source>Copy transaction ID</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Edit label</source> <translation>اصلاح بر چسب</translation> </message> <message> <location line="+1"/> <source>Show transaction details</source> <translation>جزئیات تراکنش را نمایش بده</translation> </message> <message> <location line="+139"/> <source>Export Transaction Data</source> <translation>صادرات تاریخ معامله</translation> </message> <message> <location line="+1"/> <source>Comma separated file (*.csv)</source> <translation>Comma فایل جدا </translation> </message> <message> <location line="+8"/> <source>Confirmed</source> <translation>تایید شده</translation> </message> <message> <location line="+1"/> <source>Date</source> <translation>تاریخ </translation> </message> <message> <location line="+1"/> <source>Type</source> <translation>نوع </translation> </message> <message> <location line="+1"/> <source>Label</source> <translation>ر چسب</translation> </message> <message> <location line="+1"/> <source>Address</source> <translation>ایل جدا </translation> </message> <message> <location line="+1"/> <source>Amount</source> <translation>مبلغ</translation> </message> <message> <location line="+1"/> <source>ID</source> <translation>آی دی</translation> </message> <message> <location line="+4"/> <source>Error exporting</source> <translation>خطای صادرت</translation> </message> <message> <location line="+0"/> <source>Could not write to file %1.</source> <translation>تا فایل %1 نمی شود نوشت</translation> </message> <message> <location line="+100"/> <source>Range:</source> <translation>&gt;محدوده</translation> </message> <message> <location line="+8"/> <source>to</source> <translation>به</translation> </message> </context> <context> <name>WalletModel</name> <message> <location filename="../walletmodel.cpp" line="+193"/> <source>Send Coins</source> <translation>ارسال سکه ها</translation> </message> </context> <context> <name>WalletView</name> <message> <location filename="../walletview.cpp" line="+42"/> <source>&amp;Export</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Export the data in the current tab to a file</source> <translation>داده ها نوارِ جاری را به فایل انتقال دهید</translation> </message> <message> <location line="+193"/> <source>Backup Wallet</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>Wallet Data (*.dat)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Backup Failed</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>There was an error trying to save the wallet data to the new location.</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Backup Successful</source> <translation type="unfinished"/> </message> <message> <location line="+0"/> <source>The wallet data was successfully saved to the new location.</source> <translation type="unfinished"/> </message> </context> <context> <name>bitcoin-core</name> <message> <location filename="../bitcoinstrings.cpp" line="+94"/> <source>KCz version</source> <translation>سخه بیتکویین</translation> </message> <message> <location line="+102"/> <source>Usage:</source> <translation>ستفاده :</translation> </message> <message> <location line="-29"/> <source>Send command to -server or KCzd</source> <translation>ارسال فرمان به سرور یا باتکویین</translation> </message> <message> <location line="-23"/> <source>List commands</source> <translation>لیست فومان ها</translation> </message> <message> <location line="-12"/> <source>Get help for a command</source> <translation>کمک برای فرمان </translation> </message> <message> <location line="+24"/> <source>Options:</source> <translation>تنظیمات</translation> </message> <message> <location line="+24"/> <source>Specify configuration file (default: KCz.conf)</source> <translation>(: KCz.confپیش فرض: )فایل تنظیمی خاص </translation> </message> <message> <location line="+3"/> <source>Specify pid file (default: KCzd.pid)</source> <translation>(KCzd.pidپیش فرض : ) فایل پید خاص</translation> </message> <message> <location line="-1"/> <source>Specify data directory</source> <translation>دایرکتور اطلاعاتی خاص</translation> </message> <message> <location line="-9"/> <source>Set database cache size in megabytes (default: 25)</source> <translation>سایز کَش بانک داده را بر حسب مگابایت تنظیم کنید (پیش فرض:25)</translation> </message> <message> <location line="-28"/> <source>Listen for connections on &lt;port&gt; (default: 9333 or testnet: 19333)</source> <translation>برای اتصالات به &lt;port&gt; (پیش‌فرض: 9333 یا تست‌نت: 19333) گوش کنید</translation> </message> <message> <location line="+5"/> <source>Maintain at most &lt;n&gt; connections to peers (default: 125)</source> <translation>حداکثر &lt;n&gt; اتصال با همکاران برقرار داشته باشید (پیش‌فرض: 125)</translation> </message> <message> <location line="-48"/> <source>Connect to a node to retrieve peer addresses, and disconnect</source> <translation>اتصال به گره برای دریافت آدرسهای قرینه و قطع اتصال</translation> </message> <message> <location line="+82"/> <source>Specify your own public address</source> <translation>آدرس عمومی خود را ذکر کنید</translation> </message> <message> <location line="+3"/> <source>Threshold for disconnecting misbehaving peers (default: 100)</source> <translation>آستانه برای قطع ارتباط با همکاران بدرفتار (پیش‌فرض: 100)</translation> </message> <message> <location line="-134"/> <source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source> <translation>مدت زمان به ثانیه برای جلوگیری از همکاران بدرفتار برای اتصال دوباره (پیش‌فرض: 86400)</translation> </message> <message> <location line="-29"/> <source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source> <translation>در زمان تنظیم درگاه RPX %u در فهرست کردن %s اشکالی رخ داده است</translation> </message> <message> <location line="+27"/> <source>Listen for JSON-RPC connections on &lt;port&gt; (default: 9332 or testnet: 19332)</source> <translation>( 9332پیش فرض :) &amp;lt;poort&amp;gt; JSON-RPC شنوایی برای ارتباطات</translation> </message> <message> <location line="+37"/> <source>Accept command line and JSON-RPC commands</source> <translation>JSON-RPC قابل فرمانها و</translation> </message> <message> <location line="+76"/> <source>Run in the background as a daemon and accept commands</source> <translation>اجرای در پس زمینه به عنوان شبح و قبول فرمان ها</translation> </message> <message> <location line="+37"/> <source>Use the test network</source> <translation>استفاده شبکه آزمایش</translation> </message> <message> <location line="-112"/> <source>Accept connections from outside (default: 1 if no -proxy or -connect)</source> <translation>پذیرش اتصالات از بیرون (پیش فرض:1 بدون پراکسی یا اتصال)</translation> </message> <message> <location line="-80"/> <source>%s, you must set a rpcpassword in the configuration file: %s It is recommended you use the following random password: rpcuser=KCzrpc rpcpassword=%s (you do not need to remember this password) The username and password MUST NOT be the same. If the file does not exist, create it with owner-readable-only file permissions. It is also recommended to set alertnotify so you are notified of problems; for example: alertnotify=echo %%s | mail -s &quot;KCz Alert&quot; admin@foo.com </source> <translation type="unfinished"/> </message> <message> <location line="+17"/> <source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Bind to given address and always listen on it. Use [host]:port notation for IPv6</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Cannot obtain a lock on data directory %s. KCz is probably already running.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds!</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source> <translation type="unfinished"/> </message> <message> <location line="+11"/> <source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source> <translation>حجم حداکثر تراکنشهای با/کم اهمیت را به بایت تنظیم کنید (پیش فرض:27000)</translation> </message> <message> <location line="+6"/> <source>This is a pre-release test build - use at your own risk - do not use for mining or merchant applications</source> <translation type="unfinished"/> </message> <message> <location line="+5"/> <source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source> <translation>هشدار:paytxfee بسیار بالا تعریف شده است! این هزینه تراکنش است که باید در زمان ارسال تراکنش بپردازید</translation> </message> <message> <location line="+3"/> <source>Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.</source> <translation>هشدار: تراکنش نمایش داده شده ممکن است صحیح نباشد! شما/یا یکی از گره ها به روزآمد سازی نیاز دارید </translation> </message> <message> <location line="+3"/> <source>Warning: Please check that your computer&apos;s date and time are correct! If your clock is wrong KCz will not work properly.</source> <translation>هشدار: لطفا زمان و تاریخ رایانه خود را تصحیح نمایید! اگر ساعت رایانه شما اشتباه باشد KCz ممکن است صحیح کار نکند</translation> </message> <message> <location line="+3"/> <source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source> <translation type="unfinished"/> </message> <message> <location line="+14"/> <source>Attempt to recover private keys from a corrupt wallet.dat</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Block creation options:</source> <translation>بستن گزینه ایجاد</translation> </message> <message> <location line="+5"/> <source>Connect only to the specified node(s)</source> <translation>تنها در گره (های) مشخص شده متصل شوید</translation> </message> <message> <location line="+3"/> <source>Corrupted block database detected</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Discover own IP address (default: 1 when listening and no -externalip)</source> <translation>آدرس آی.پی. خود را شناسایی کنید (پیش فرض:1 در زمان when listening وno -externalip)</translation> </message> <message> <location line="+1"/> <source>Do you want to rebuild the block database now?</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Error initializing block database</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Error initializing wallet database environment %s!</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Error loading block database</source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Error opening block database</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Error: Disk space is low!</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Error: Wallet locked, unable to create transaction!</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Error: system error: </source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Failed to listen on any port. Use -listen=0 if you want this.</source> <translation>شنیدن هر گونه درگاه انجام پذیر نیست. ازlisten=0 برای اینکار استفاده کیند.</translation> </message> <message> <location line="+1"/> <source>Failed to read block info</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Failed to read block</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Failed to sync block index</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Failed to write block index</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Failed to write block info</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Failed to write block</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Failed to write file info</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Failed to write to coin database</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Failed to write transaction index</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Failed to write undo data</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Find peers using DNS lookup (default: 1 unless -connect)</source> <translation>قرینه ها را برای جستجوی DNS بیاب (پیش فرض: 1 مگر در زمان اتصال)</translation> </message> <message> <location line="+1"/> <source>Generate coins (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>How many blocks to check at startup (default: 288, 0 = all)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>How thorough the block verification is (0-4, default: 3)</source> <translation type="unfinished"/> </message> <message> <location line="+19"/> <source>Not enough file descriptors available.</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Rebuild block chain index from current blk000??.dat files</source> <translation type="unfinished"/> </message> <message> <location line="+16"/> <source>Set the number of threads to service RPC calls (default: 4)</source> <translation type="unfinished"/> </message> <message> <location line="+26"/> <source>Verifying blocks...</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Verifying wallet...</source> <translation type="unfinished"/> </message> <message> <location line="-69"/> <source>Imports blocks from external blk000??.dat file</source> <translation type="unfinished"/> </message> <message> <location line="-76"/> <source>Set the number of script verification threads (up to 16, 0 = auto, &lt;0 = leave that many cores free, default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="+77"/> <source>Information</source> <translation type="unfinished"/> </message> <message> <location line="+3"/> <source>Invalid -tor address: &apos;%s&apos;</source> <translation>آدرس نرم افزار تور غلط است %s</translation> </message> <message> <location line="+1"/> <source>Invalid amount for -minrelaytxfee=&lt;amount&gt;: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Invalid amount for -mintxfee=&lt;amount&gt;: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Maintain a full transaction index (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Maximum per-connection receive buffer, &lt;n&gt;*1000 bytes (default: 5000)</source> <translation>حداکثر بافر دریافت شده بر اساس اتصال &lt;n&gt;* 1000 بایت (پیش فرض:5000)</translation> </message> <message> <location line="+1"/> <source>Maximum per-connection send buffer, &lt;n&gt;*1000 bytes (default: 1000)</source> <translation>حداکثر بافر دریافت شده بر اساس اتصال &lt;n&gt;* 1000 بایت (پیش فرض:1000)</translation> </message> <message> <location line="+2"/> <source>Only accept block chain matching built-in checkpoints (default: 1)</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Only connect to nodes in network &lt;net&gt; (IPv4, IPv6 or Tor)</source> <translation>تنها =به گره ها در شبکه متصا شوید &lt;net&gt; (IPv4, IPv6 or Tor)</translation> </message> <message> <location line="+2"/> <source>Output extra debugging information. Implies all other -debug* options</source> <translation>برونداد اطلاعات اشکال زدایی اضافی. گزینه های اشکال زدایی دیگر رفع شدند</translation> </message> <message> <location line="+1"/> <source>Output extra network debugging information</source> <translation>برونداد اطلاعات اشکال زدایی اضافی برای شبکه</translation> </message> <message> <location line="+2"/> <source>Prepend debug output with timestamp</source> <translation>به خروجی اشکال‌زدایی برچسب زمان بزنید</translation> </message> <message> <location line="+5"/> <source>SSL options: (see the KCz Wiki for SSL setup instructions)</source> <translation>گزینه ssl (به ویکیKCz برای راهنمای راه اندازی ssl مراجعه شود)</translation> </message> <message> <location line="+1"/> <source>Select the version of socks proxy to use (4-5, default: 5)</source> <translation>نسخه ای از پراکسی ساکس را برای استفاده انتخاب کنید (4-5 پیش فرض:5)</translation> </message> <message> <location line="+3"/> <source>Send trace/debug info to console instead of debug.log file</source> <translation>اطلاعات ردگیری/اشکال‌زدایی را به جای فایل لاگ اشکال‌زدایی به کنسول بفرستید</translation> </message> <message> <location line="+1"/> <source>Send trace/debug info to debugger</source> <translation>اطلاعات ردگیری/اشکال‌زدایی را به اشکال‌زدا بفرستید</translation> </message> <message> <location line="+5"/> <source>Set maximum block size in bytes (default: 250000)</source> <translation>حداکثر سایز بلاک بر اساس بایت تنظیم شود (پیش فرض: 250000)</translation> </message> <message> <location line="+1"/> <source>Set minimum block size in bytes (default: 0)</source> <translation>حداقل سایز بلاک بر اساس بایت تنظیم شود (پیش فرض: 0)</translation> </message> <message> <location line="+2"/> <source>Shrink debug.log file on client startup (default: 1 when no -debug)</source> <translation>فایل debug.log را در startup مشتری کوچک کن (پیش فرض:1 اگر اشکال زدایی روی نداد)</translation> </message> <message> <location line="+1"/> <source>Signing transaction failed</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Specify connection timeout in milliseconds (default: 5000)</source> <translation>(میلی ثانیه )فاصله ارتباط خاص</translation> </message> <message> <location line="+4"/> <source>System error: </source> <translation type="unfinished"/> </message> <message> <location line="+4"/> <source>Transaction amount too small</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Transaction amounts must be positive</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Transaction too large</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Use UPnP to map the listening port (default: 0)</source> <translation>از UPnP برای شناسایی درگاه شنیداری استفاده کنید (پیش فرض:0)</translation> </message> <message> <location line="+1"/> <source>Use UPnP to map the listening port (default: 1 when listening)</source> <translation>از UPnP برای شناسایی درگاه شنیداری استفاده کنید (پیش فرض:1 در زمان شنیدن)</translation> </message> <message> <location line="+1"/> <source>Use proxy to reach tor hidden services (default: same as -proxy)</source> <translation>برای دستیابی به سرویس مخفیانه نرم افزار تور از پراکسی استفاده کنید (پیش فرض:same as -proxy)</translation> </message> <message> <location line="+2"/> <source>Username for JSON-RPC connections</source> <translation>JSON-RPC شناسه برای ارتباطات</translation> </message> <message> <location line="+4"/> <source>Warning</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Warning: This version is obsolete, upgrade required!</source> <translation>هشدار: این نسخه قدیمی است، روزآمدسازی مورد نیاز است</translation> </message> <message> <location line="+1"/> <source>You need to rebuild the databases using -reindex to change -txindex</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>wallet.dat corrupt, salvage failed</source> <translation type="unfinished"/> </message> <message> <location line="-50"/> <source>Password for JSON-RPC connections</source> <translation>JSON-RPC عبارت عبور برای ارتباطات</translation> </message> <message> <location line="-67"/> <source>Allow JSON-RPC connections from specified IP address</source> <translation>از آدرس آی پی خاص JSON-RPC قبول ارتباطات</translation> </message> <message> <location line="+76"/> <source>Send commands to node running on &lt;ip&gt; (default: 127.0.0.1)</source> <translation>(127.0.0.1پیش فرض: ) &amp;lt;ip&amp;gt; دادن فرمانها برای استفاده گره ها روی</translation> </message> <message> <location line="-120"/> <source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source> <translation>زمانی که بهترین بلاک تغییر کرد، دستور را اجرا کن (%s در cmd با block hash جایگزین شده است)</translation> </message> <message> <location line="+147"/> <source>Upgrade wallet to latest format</source> <translation>wallet را به جدیدترین فرمت روزآمد کنید</translation> </message> <message> <location line="-21"/> <source>Set key pool size to &lt;n&gt; (default: 100)</source> <translation> (100پیش فرض:)&amp;lt;n&amp;gt; گذاشتن اندازه کلید روی </translation> </message> <message> <location line="-12"/> <source>Rescan the block chain for missing wallet transactions</source> <translation>اسکان مجدد زنجیر بلوکها برای گم والت معامله</translation> </message> <message> <location line="+35"/> <source>Use OpenSSL (https) for JSON-RPC connections</source> <translation>JSON-RPCبرای ارتباطات استفاده کنید OpenSSL (https)</translation> </message> <message> <location line="-26"/> <source>Server certificate file (default: server.cert)</source> <translation> (server.certپیش فرض: )گواهی نامه سرور</translation> </message> <message> <location line="+1"/> <source>Server private key (default: server.pem)</source> <translation>(server.pemپیش فرض: ) کلید خصوصی سرور</translation> </message> <message> <location line="-151"/> <source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source> <translation>رمز های قابل قبول( TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</translation> </message> <message> <location line="+165"/> <source>This help message</source> <translation>پیام کمکی</translation> </message> <message> <location line="+6"/> <source>Unable to bind to %s on this computer (bind returned error %d, %s)</source> <translation>امکان اتصال به %s از این رایانه وجود ندارد ( bind returned error %d, %s)</translation> </message> <message> <location line="-91"/> <source>Connect through socks proxy</source> <translation>اتصال از طریق پراکسی ساکس</translation> </message> <message> <location line="-10"/> <source>Allow DNS lookups for -addnode, -seednode and -connect</source> <translation>به DNS اجازه بده تا برای addnode ، seednode و اتصال جستجو کند</translation> </message> <message> <location line="+55"/> <source>Loading addresses...</source> <translation>بار گیری آدرس ها</translation> </message> <message> <location line="-35"/> <source>Error loading wallet.dat: Wallet corrupted</source> <translation>خطا در بارگیری wallet.dat: کیف پول خراب شده است</translation> </message> <message> <location line="+1"/> <source>Error loading wallet.dat: Wallet requires newer version of KCz</source> <translation>خطا در بارگیری wallet.dat: کیف پول به ویرایش جدیدتری از Biticon نیاز دارد</translation> </message> <message> <location line="+93"/> <source>Wallet needed to be rewritten: restart KCz to complete</source> <translation>سلام</translation> </message> <message> <location line="-95"/> <source>Error loading wallet.dat</source> <translation>خطا در بارگیری wallet.dat</translation> </message> <message> <location line="+28"/> <source>Invalid -proxy address: &apos;%s&apos;</source> <translation>آدرس پراکسی اشتباه %s</translation> </message> <message> <location line="+56"/> <source>Unknown network specified in -onlynet: &apos;%s&apos;</source> <translation>شبکه مشخص شده غیرقابل شناسایی در onlynet: &apos;%s&apos;</translation> </message> <message> <location line="-1"/> <source>Unknown -socks proxy version requested: %i</source> <translation>نسخه پراکسی ساکس غیرقابل شناسایی درخواست شده است: %i</translation> </message> <message> <location line="-96"/> <source>Cannot resolve -bind address: &apos;%s&apos;</source> <translation>آدرس قابل اتصال- شناسایی نیست %s</translation> </message> <message> <location line="+1"/> <source>Cannot resolve -externalip address: &apos;%s&apos;</source> <translation>آدرس خارجی قابل اتصال- شناسایی نیست %s</translation> </message> <message> <location line="+44"/> <source>Invalid amount for -paytxfee=&lt;amount&gt;: &apos;%s&apos;</source> <translation>میزان وجه اشتباه برای paytxfee=&lt;میزان وجه&gt;: %s</translation> </message> <message> <location line="+1"/> <source>Invalid amount</source> <translation>میزان وجه اشتباه</translation> </message> <message> <location line="-6"/> <source>Insufficient funds</source> <translation>بود جه نا کافی </translation> </message> <message> <location line="+10"/> <source>Loading block index...</source> <translation>بار گیری شاخص بلوک</translation> </message> <message> <location line="-57"/> <source>Add a node to connect to and attempt to keep the connection open</source> <translation>به اتصال یک گره اضافه کنید و اتصال را باز نگاه دارید</translation> </message> <message> <location line="-25"/> <source>Unable to bind to %s on this computer. KCz is probably already running.</source> <translation>اتصال به %s از این رایانه امکان پذیر نیست. KCz احتمالا در حال اجراست.</translation> </message> <message> <location line="+64"/> <source>Fee per KB to add to transactions you send</source> <translation>پر داجت برای هر کیلو بیت برای اضافه به معامله ارسال</translation> </message> <message> <location line="+19"/> <source>Loading wallet...</source> <translation>بار گیری والت</translation> </message> <message> <location line="-52"/> <source>Cannot downgrade wallet</source> <translation>امکان تنزل نسخه در wallet وجود ندارد</translation> </message> <message> <location line="+3"/> <source>Cannot write default address</source> <translation>آدرس پیش فرض قابل ذخیره نیست</translation> </message> <message> <location line="+64"/> <source>Rescanning...</source> <translation>اسکان مجدد</translation> </message> <message> <location line="-57"/> <source>Done loading</source> <translation>بار گیری انجام شده است</translation> </message> <message> <location line="+82"/> <source>To use the %s option</source> <translation>برای استفاده از %s از انتخابات</translation> </message> <message> <location line="-74"/> <source>Error</source> <translation>خطا</translation> </message> <message> <location line="-31"/> <source>You must set rpcpassword=&lt;password&gt; in the configuration file: %s If the file does not exist, create it with owner-readable-only file permissions.</source> <translation>%s، شما باید یک rpcpassword را در فایل پیکربندی تنظیم کنید :⏎%s⏎ اگر فایل ایجاد نشد، یک فایل فقط متنی ایجاد کنید. </translation> </message> </context> </TS>
Java
# Anchor
Java
<?php namespace APP\AppBundle\Controller; use Symfony\Component\HttpFoundation\Request; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use APP\AppBundle\Entity\Cliente; use APP\AppBundle\Form\ClienteType; /** * Cliente controller. * */ class ClienteController extends Controller { /** * Lists all Cliente entities. * */ public function indexAction() { $em = $this->getDoctrine()->getManager(); $entities = $em->getRepository('AppBundle:Cliente')->findAll(); return $this->render('AppBundle:Cliente:index.html.twig', array( 'entities' => $entities, )); } /** * Creates a new Cliente entity. * */ public function createAction(Request $request) { $entity = new Cliente(); $form = $this->CreateForm(ClienteType::class, $entity); $form->handleRequest($request); if ($form->isValid()) { $em = $this->getDoctrine()->getManager(); $entity->setFechaAlta(new \DateTime()); $entity->setFechaMod(new \DateTime()); $usuario = $this->get('security.token_storage')->getToken()->getUser(); $entity->setUsuarioAlta($usuario); $entity->setUsuarioMod($usuario); $em->persist($entity); $em->flush(); return $this->redirect($this->generateUrl('cliente')); } return $this->render('AppBundle:Cliente:new.html.twig', array( 'entity' => $entity, 'form' => $form->createView(), )); } /** * Función para crear Cliente por Ajax */ public function createAjaxAction(Request $request) { if ($request->getMethod() == "POST") { $em = $this->getDoctrine()->getManager(); $name = $request->get('name'); $entity = new Cliente(); $entity->setNombre($name); $usuarioAlta = $this->get('security.token_storage')->getToken()->getUser(); $entity->setUsuarioAlta($usuarioAlta); $em->persist($entity); $em->flush(); } return $this->render("AppBundle:Default:_newOptionEntity.html.twig", array( 'entity' => $entity )); } /** * Displays a form to create a new Cliente entity. * */ public function newAction() { $entity = new Cliente(); $form = $this->CreateForm(ClienteType::class, $entity); return $this->render('AppBundle:Cliente:new.html.twig', array( 'entity' => $entity, 'form' => $form->createView(), )); } /** * Finds and displays a Cliente entity. * */ public function showAction($id) { $em = $this->getDoctrine()->getManager(); $entity = $em->getRepository('AppBundle:Cliente')->find($id); if (!$entity) { throw $this->createNotFoundException('Unable to find Cliente entity.'); } $deleteForm = $this->createForm(ClienteType::class); return $this->render('AppBundle:Cliente:show.html.twig', array( 'entity' => $entity, 'delete_form' => $deleteForm->createView(), )); } /** * Displays a form to edit an existing Cliente entity. * */ public function editAction($id) { $em = $this->getDoctrine()->getManager(); $entity = $em->getRepository('AppBundle:Cliente')->find($id); if (!$entity) { throw $this->createNotFoundException('Unable to find Cliente entity.'); } $editForm = $this->createForm(ClienteType::class, $entity); return $this->render('AppBundle:Cliente:edit.html.twig', array( 'entity' => $entity, 'form' => $editForm->createView() )); } /** * Edits an existing Cliente entity. * */ public function updateAction(Request $request, $id) { $em = $this->getDoctrine()->getManager(); $entity = $em->getRepository('AppBundle:Cliente')->find($id); if (!$entity) { throw $this->createNotFoundException('Unable to find Cliente entity.'); } $editForm = $this->createForm(ClienteType::class, $entity); $editForm->handleRequest($request); if ($editForm->isValid()) { /** @var $entity Cliente */ $usuario = $this->get('security.token_storage')->getToken()->getUser(); $entity->setFechaMod(new \DateTime()); $entity->setUsuarioMod($usuario); $em->persist($entity); $em->flush(); $this->setFlash('success', 'Los cambios se han realizado con éxito'); return $this->redirect($this->generateUrl('compania_edit', array('id' => $id))); } $this->setFlash('error', 'Ha ocurrido un error'); return $this->render('AppBundle:Cliente:edit.html.twig', array( 'entity' => $entity, 'form' => $editForm->createView(), )); } /** * Deletes a Cliente entity. * */ public function deleteAction(Request $request, $id) { $form = $this->createDeleteForm($id); $form->handleRequest($request); if ($form->isValid()) { $em = $this->getDoctrine()->getManager(); $entity = $em->getRepository('AppBundle:Cliente')->find($id); if (!$entity) { throw $this->createNotFoundException('Unable to find Cliente entity.'); } $em->remove($entity); $em->flush(); } return $this->redirect($this->generateUrl('cliente')); } /** * Creates a form to delete a Cliente entity by id. * * @param mixed $id The entity id * * @return \Symfony\Component\Form\Form The form */ private function createDeleteForm($id) { return $this->createFormBuilder() ->setAction($this->generateUrl('companias_delete', array('id' => $id))) ->setMethod('DELETE') ->add('submit', 'submit', array('label' => 'Delete')) ->getForm() ; } private function setFlash($index, $message) { $this->get('session')->getFlashBag()->clear(); $this->get('session')->getFlashBag()->add($index, $message); } }
Java
WebsiteOne::Application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. config.cache_classes = false # Do not eager load code on boot. config.eager_load = false # Show full error reports and disable caching. config.consider_all_requests_local = true config.action_controller.perform_caching = false # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log # Raise an error on page load if there are pending migrations config.active_record.migration_error = :page_load # Debug mode disables concatenation and preprocessing of assets. # This option may cause significant delays in view rendering with a large # number of complex assets. config.assets.debug = true config.action_mailer.delivery_method = :smtp config.action_mailer.perform_deliveries = true config.action_mailer.raise_delivery_errors = true config.action_mailer.smtp_settings = { :address => 'smtp.gmail.com', :port => 587, :domain => '', :user_name => 'wso.av.test@gmail.com', :password => 'Wso12345', :authentication => 'plain', :enable_starttls_auto => true } end
Java
# sails.config.models Your default project-wide **model settings**, conventionally specified in the [config/models.js](http://sailsjs.com/documentation/anatomy/myApp/config/models-js) configuration file. Most of the settings below can also be overridden on a per-model basis-- just edit the appropriate model definition file. There are also some additional model settings, not listed below, which can _only_ be specified on a per-model basis. For more details, see [Concepts > Model Settings](http://sailsjs.com/documentation/concepts/orm/model-settings). ### Properties Property | Type | Default | Details :---------------------|:---------------:|:------------------------------- |:-------- `attributes` | ((dictionary)) | _see [Attributes](http://sailsjs.com/documentation/concepts/models-and-orm/attributes)_ | Default [attributes](http://sailsjs.com/documentation/concepts/models-and-orm/attributes) to implicitly include in all of your app's model definitions. (Can be overridden on an attribute-by-attribute basis.) `migrate` | ((string)) | _see [Model Settings](http://sailsjs.com/documentation/concepts/orm/model-settings)_ | The [auto-migration strategy](http://sailsjs.com/documentation/concepts/models-and-orm/model-settings#?migrate) for your Sails app. How & whether Sails will attempt to automatically rebuild the tables/collections/etc. in your schema every time it lifts. `schema` | ((boolean)) | `false` | Only relevant for models hooked up to a schemaless database like MongoDB. If set to `true`, then the ORM will switch into "schemaful" mode. For example, if properties passed in to `.create()`, `.createEach()`, or `.update()` do not correspond with recognized attributes, then they will be stripped out before saving. `datastore` | ((string)) | `'default'` | The default [datastore configuration](http://sailsjs.com/documentation/reference/sails-config/sails-config-datastores) any given model will use without a configured override. Avoid changing this. `primaryKey` | ((string)) | `'id'` | The name of the attribute that every model in your app should use as its primary key by default. Can be overridden here, or on a per-model basis-- but there's [usually a better way](http://sailsjs.com/documentation/concepts/models-and-orm/model-settings#?primarykey). <docmeta name="displayName" value="sails.config.models"> <docmeta name="pageType" value="property">
Java
require "presigner/version" require 'aws-sdk-v1' class Presigner DEFAULT_DURATION = 60 * 30 def initialize(options) @bucket = options[:bucket] @key = options[:key] @duration = options[:duration] || DEFAULT_DURATION @region = options[:region] || "us-east-1" @base = Time.now.to_i end attr_reader :duration, :base, :bucket, :key, :region def generate s3 = AWS::S3.new(region: region) # check if specified bucket and key exist. begin target_obj = s3.buckets[bucket].objects[key] if !target_obj.exists? $stderr.puts "Specified bucket or key does not exist." exit 1 end rescue AWS::S3::Errors::Forbidden $stderr.puts "Access to the S3 object is denied. Credential or target name might be wrong" exit 1 end if !target_obj.exists? $stderr.puts "Specified bucket or key does not exist." exit 1 end presigner = AWS::S3::PresignV4.new(target_obj) expires = calc_duration url = presigner.presign(:get, expires: base + duration, secure: true) url end def calc_duration duration end end
Java
# frozen_string_literal: true require "administrate/base_dashboard" module Eve class StationDashboard < Administrate::BaseDashboard ATTRIBUTE_TYPES = { id: Field::Number, station_id: Field::Number, name: Field::String, system: Field::BelongsTo.with_options(class_name: "Eve::System"), type_id: Field::Number, # TODO: add type dashboard owner: Field::Number, race: Field::BelongsTo.with_options(class_name: "Eve::Race"), max_dockable_ship_volume: Field::Number, office_rental_cost: Field::Number, reprocessing_efficiency: Field::Number, reprocessing_stations_take: Field::Number, # TODO: t.string "services", array: true # services: Field::String, created_at: Field::DateTime, updated_at: Field::DateTime # position: Field::HasOne }.freeze COLLECTION_ATTRIBUTES = [:id, :station_id, :name].freeze SHOW_PAGE_ATTRIBUTES = [ :id, :station_id, :name, :system, :type_id, :owner, :race, :max_dockable_ship_volume, :office_rental_cost, :reprocessing_efficiency, :reprocessing_stations_take, # :services, :created_at, :updated_at # :position ].freeze COLLECTION_FILTERS = {}.freeze def display_resource(station) station.name end end end
Java
declare namespace jdk { namespace nashorn { namespace api { namespace tree { interface ModuleTree extends jdk.nashorn.api.tree.Tree { getImportEntries(): java.util.List<jdk.nashorn.api.tree.ImportEntryTree> getLocalExportEntries(): java.util.List<jdk.nashorn.api.tree.ExportEntryTree> getIndirectExportEntries(): java.util.List<jdk.nashorn.api.tree.ExportEntryTree> getStarExportEntries(): java.util.List<jdk.nashorn.api.tree.ExportEntryTree> } } } } }
Java
<?php namespace GL\ProtocolloBundle; use Symfony\Component\HttpKernel\Bundle\Bundle; class GLProtocolloBundle extends Bundle { }
Java
/** * Created by lee on 10/13/17. */ import React, { Component } from 'react'; export default class PlacesItem extends Component { constructor(props) { super(props); this.config = this.config.bind(this); this.rateStars = this.rateStars.bind(this); this.startBounce = this.startBounce.bind(this); this.endBounce = this.endBounce.bind(this); } config() { return { itemPhotoSize : { maxWidth: 80, maxHeight: 91 } } } startBounce() { this.props.place.marker.setAnimation(google.maps.Animation.BOUNCE); } endBounce() { this.props.place.marker.setAnimation(null); } // build rate starts rateStars(num) { let stars = []; for(let i = 0; i < num; i++) { stars.push( <span><img key={i} src='./assets/star.png' /></span> ) } return stars } render() { const {place} = this.props.place; const img = place.photos ? place.photos[0].getUrl(this.config().itemPhotoSize) : './assets/no_image.png'; return( <div className="item-box" onMouseOver = {this.startBounce} onMouseOut={this.endBounce}> <div className="item-text"> <strong>{place.name}</strong> { place.rating ?<p>{this.rateStars(place.rating)}<span>&nbsp;&nbsp;&nbsp;{'$'.repeat(place.price_level)}</span></p> : <p>{'$'.repeat(place.price_level)}</p> } <p id="item-address">{place.formatted_address}</p> <p>{place.opening_hours && place.opening_hours.open_now ? "Open" :"Closed"}</p> </div> <img className='item-image' src={img} /> </div> ) } }
Java
The MIT License (MIT) Copyright (c) 2015 Jaro Marval 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.
Java
class Solution(object): def missingNumber(self, nums): """ :type nums: List[int] :rtype: int """ xor = len(nums) for i, n in enumerate(nums): xor ^= n xor ^= i return xor inputs = [ [0], [1], [3,0,1], [9,6,4,2,3,5,7,0,1] ] s = Solution() for i in inputs: print s.missingNumber(i)
Java
/**************************************************************************** * * Copyright (c) 2005 - 2012 by Vivante Corp. All rights reserved. * * The material in this file is confidential and contains trade secrets * of Vivante Corporation. This is proprietary information owned by * Vivante Corporation. No part of this work may be disclosed, * reproduced, copied, transmitted, or used in any way for any purpose, * without the express written permission of Vivante Corporation. * *****************************************************************************/ /** * \file sarea.h * SAREA definitions. * * \author Kevin E. Martin <kevin@precisioninsight.com> * \author Jens Owen <jens@tungstengraphics.com> * \author Rickard E. (Rik) Faith <faith@valinux.com> */ /* * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sub license, 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 (including the * next paragraph) 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 NON-INFRINGEMENT. * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _SAREA_H_ #define _SAREA_H_ #include "xf86drm.h" /* SAREA area needs to be at least a page */ #if defined(__alpha__) #define SAREA_MAX 0x2000 #elif defined(__ia64__) #define SAREA_MAX 0x10000 /* 64kB */ #else /* Intel 830M driver needs at least 8k SAREA */ #define SAREA_MAX 0x2000 #endif #define SAREA_MAX_DRAWABLES 256 #define SAREA_DRAWABLE_CLAIMED_ENTRY 0x80000000 /** * SAREA per drawable information. * * \sa _XF86DRISAREA. */ typedef struct _XF86DRISAREADrawable { unsigned int stamp; unsigned int flags; } XF86DRISAREADrawableRec, *XF86DRISAREADrawablePtr; /** * SAREA frame information. * * \sa _XF86DRISAREA. */ typedef struct _XF86DRISAREAFrame { unsigned int x; unsigned int y; unsigned int width; unsigned int height; unsigned int fullscreen; } XF86DRISAREAFrameRec, *XF86DRISAREAFramePtr; /** * SAREA definition. */ typedef struct _XF86DRISAREA { /** first thing is always the DRM locking structure */ drmLock lock; /** \todo Use readers/writer lock for drawable_lock */ drmLock drawable_lock; XF86DRISAREADrawableRec drawableTable[SAREA_MAX_DRAWABLES]; XF86DRISAREAFrameRec frame; drm_context_t dummy_context; } XF86DRISAREARec, *XF86DRISAREAPtr; typedef struct _XF86DRILSAREA { drmLock lock; drmLock otherLocks[31]; } XF86DRILSAREARec, *XF86DRILSAREAPtr; #endif
Java
<?php namespace spec\Genesis\API\Constants\Transaction; use PhpSpec\ObjectBehavior; use Prophecy\Argument; class StatesSpec extends ObjectBehavior { function it_is_initializable() { $this->shouldHaveType('Genesis\API\Constants\Transaction\States'); } }
Java
# Injections Injections are simply other classes that are included in our component tree. In our example we have `Store` and `Router` injections. Take a look at our `Store`. ```ruby class Store include Inesita::Injection attr_accessor :counter def init @counter = 0 end def increase @counter += 1 end def decrease @counter -= 1 end end ``` This is an `injection` example. We are including `Inesita::Injection` in order to be able to inject this class into the root component. In this example, we're storing counter value. The `init` method initializes our store. At the beginning we're setting the counter value to 0. The `increase` method increments current counter value by 1 The `decrease` method decrements current counter value by 1 There is also `attr_accessor :counter` so we can access that value with `store.counter`. Simple! Right? You can inject other stores, but also things like dispatchers depending on the architecture you want to obtain.
Java
<div class="row-fluid">{namespace ehrm=Beech\Ehrm\ViewHelpers} <div class="span1"> <f:render partial="Forms/Buttons/Icon" arguments="{_all}"/> </div> <div class="span3"><strong><f:translate id="electronicAddress.electronicAddressType.{electronicAddress.electronicAddressType}">{electronicAddress.electronicAddressType}</f:translate></strong></div> <div class="span6">{electronicAddress.address}</div> <div class="span1 primaryIcon"><f:if condition="{electronicAddress.primary}"><i class="icon-check"></i></f:if></div> <div class="span1"> <div class="btn-group"> <f:render partial="Forms/Buttons/Toggle" arguments="{identifier: electronicAddress.id, action: action, icon: 'icon-pencil', collapsed: collapsed}"/> <f:if condition="{electronicAddress.primary}"> <f:then> <f:render partial="Forms/Buttons/Remove" arguments="{class: 'hide'}"/> </f:then> <f:else> <f:render partial="Forms/Buttons/Remove" arguments="{_all}"/> </f:else> </f:if> </div> </div> </div>
Java
// ----------------------------------------------------------------------- // <copyright file="ViewModel.cs" company="Screenmedia"> // Copyright (c) Screenmedia 2018. All rights reserved. // </copyright> // ----------------------------------------------------------------------- namespace VanillaSample.Core.ViewModels { using Screenmedia.Plugin.Vanilla; using Screenmedia.Plugin.Vanilla.Abstractions; public class ViewModel { private readonly IIceCreamMachine _iceCreamMachine; public ViewModel() { _iceCreamMachine = CrossIceCreamMachine.Current; IceCreamFlavour = _iceCreamMachine.Dispense(); } public string IceCreamFlavour { get; set; } = "Empty Cone"; } }
Java
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0-beta2) on Mon Mar 19 19:33:09 CST 2007 --> <META http-equiv="Content-Type" content="text/html; charset=utf-8"> <TITLE> 软件包 org.w3c.dom.bootstrap 的使用 (Java Platform SE 6) </TITLE><script>var _hmt = _hmt || [];(function() {var hm = document.createElement("script");hm.src = "//hm.baidu.com/hm.js?dd1361ca20a10cc161e72d4bc4fef6df";var s = document.getElementsByTagName("script")[0];s.parentNode.insertBefore(hm, s);})();</script> <META NAME="date" CONTENT="2007-03-19"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="软件包 org.w3c.dom.bootstrap 的使用 (Java Platform SE 6)"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="跳过导航链接"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>概述</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>软件包</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">类</FONT>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>使用</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>树</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>已过时</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>索引</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>帮助</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> <b>Java<sup><font size=-2>TM</font></sup>&nbsp;Platform<br>Standard&nbsp;Ed. 6</b></EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;上一个&nbsp; &nbsp;下一个</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?org/w3c/dom/bootstrap/package-use.html" target="_top"><B>框架</B></A> &nbsp; &nbsp;<A HREF="package-use.html" target="_top"><B>无框架</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>所有类</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../allclasses-noframe.html"><B>所有类</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <CENTER> <H2> <B>软件包 org.w3c.dom.bootstrap<br>的使用</B></H2> </CENTER> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 使用 <A HREF="../../../../org/w3c/dom/bootstrap/package-summary.html">org.w3c.dom.bootstrap</A> 的软件包</FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#org.w3c.dom.bootstrap"><B>org.w3c.dom.bootstrap</B></A></TD> <TD>&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <A NAME="org.w3c.dom.bootstrap"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <A HREF="../../../../org/w3c/dom/bootstrap/package-summary.html">org.w3c.dom.bootstrap</A> 使用的 <A HREF="../../../../org/w3c/dom/bootstrap/package-summary.html">org.w3c.dom.bootstrap</A> 中的类</FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><B><A HREF="../../../../org/w3c/dom/bootstrap/class-use/DOMImplementationRegistry.html#org.w3c.dom.bootstrap"><B>DOMImplementationRegistry</B></A></B> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;启用应用程序来获得 <code>DOMImplementation</code> 实例的工厂。</TD> </TR> </TABLE> &nbsp; <P> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="跳过导航链接"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>概述</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>软件包</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">类</FONT>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>使用</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>树</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>已过时</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>索引</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>帮助</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> <b>Java<sup><font size=-2>TM</font></sup>&nbsp;Platform<br>Standard&nbsp;Ed. 6</b></EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;上一个&nbsp; &nbsp;下一个</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?org/w3c/dom/bootstrap/package-use.html" target="_top"><B>框架</B></A> &nbsp; &nbsp;<A HREF="package-use.html" target="_top"><B>无框架</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>所有类</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../allclasses-noframe.html"><B>所有类</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> <font size="-1"><a href="http://bugs.sun.com/services/bugreport/index.jsp">提交错误或意见</a><br>有关更多的 API 参考资料和开发人员文档,请参阅 <a href="http://java.sun.com/javase/6/webnotes/devdocs-vs-specs.html">Java SE 开发人员文档</a>。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。 <p>版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守<a href="http://java.sun.com/javase/6/docs/legal/license.html">许可证条款</a>。另请参阅<a href="http://java.sun.com/docs/redist.html">文档重新分发政策</a>。</font> </BODY> </HTML>
Java
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc --> <title>DoNotInstrument</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> <link rel="stylesheet" type="text/css" href="../../../../jquery/jquery-ui.css" title="Style"> <script type="text/javascript" src="../../../../script.js"></script> <script type="text/javascript" src="../../../../jquery/jszip/dist/jszip.min.js"></script> <script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script> <!--[if IE]> <script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script> <![endif]--> <script type="text/javascript" src="../../../../jquery/jquery-1.10.2.js"></script> <script type="text/javascript" src="../../../../jquery/jquery-ui.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="DoNotInstrument"; } } catch(err) { } //--> var pathtoroot = "../../../../";loadScripts(document, 'script');</script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <div class="fixedNav"> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage"><ul class="navList" style="font-size: 1.5em;"><li>Robolectric 4.4 | <a href="/" target="_top"><img src="http://robolectric.org/images/logo-with-bubbles-down.png" style="max-height: 18pt; vertical-align: sub;"/></a></li></ul></div> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../org/robolectric/annotation/internal/ConfigUtils.html" title="class in org.robolectric.annotation.internal"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li><a href="../../../../org/robolectric/annotation/internal/Instrument.html" title="annotation in org.robolectric.annotation.internal"><span class="typeNameLink">Next&nbsp;Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?org/robolectric/annotation/internal/DoNotInstrument.html" target="_top">Frames</a></li> <li><a href="DoNotInstrument.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <ul class="navListSearch"> <li><span>SEARCH:&nbsp;</span> <input type="text" id="search" value=" " disabled="disabled"> <input type="reset" id="reset" value=" " disabled="disabled"> </li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Required&nbsp;|&nbsp;</li> <li>Optional</li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Element</li> </ul> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> </div> <div class="navPadding">&nbsp;</div> <script type="text/javascript"><!-- $('.navPadding').css('padding-top', $('.fixedNav').css("height")); //--> </script> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <div class="subTitle"><span class="packageLabelInType">Package</span>&nbsp;<a href="../../../../org/robolectric/annotation/internal/package-summary.html">org.robolectric.annotation.internal</a></div> <h2 title="Annotation Type DoNotInstrument" class="title">Annotation Type DoNotInstrument</h2> </div> <div class="contentContainer"> <div class="description"> <ul class="blockList"> <li class="blockList"> <hr> <br> <pre><a href="https://developer.android.com/reference/java/lang/annotation/Documented.html?is-external=true" title="class or interface in java.lang.annotation">@Documented</a> <a href="https://developer.android.com/reference/java/lang/annotation/Retention.html?is-external=true" title="class or interface in java.lang.annotation">@Retention</a>(<a href="https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.html?is-external=true#RUNTIME" title="class or interface in java.lang.annotation">RUNTIME</a>) <a href="https://developer.android.com/reference/java/lang/annotation/Target.html?is-external=true" title="class or interface in java.lang.annotation">@Target</a>(<a href="https://developer.android.com/reference/java/lang/annotation/ElementType.html?is-external=true#TYPE" title="class or interface in java.lang.annotation">TYPE</a>) public @interface <span class="memberNameLabel">DoNotInstrument</span></pre> <div class="block">Indicates that a class should not be stripped/instrumented under any circumstances.</div> </li> </ul> </div> </div> <!-- ========= END OF CLASS DATA ========= --> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage"><ul class="navList" style="font-size: 1.5em;"><li>Robolectric 4.4 | <a href="/" target="_top"><img src="http://robolectric.org/images/logo-with-bubbles-down.png" style="max-height: 18pt; vertical-align: sub;"/></a></li></ul></div> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../org/robolectric/annotation/internal/ConfigUtils.html" title="class in org.robolectric.annotation.internal"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li><a href="../../../../org/robolectric/annotation/internal/Instrument.html" title="annotation in org.robolectric.annotation.internal"><span class="typeNameLink">Next&nbsp;Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?org/robolectric/annotation/internal/DoNotInstrument.html" target="_top">Frames</a></li> <li><a href="DoNotInstrument.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Required&nbsp;|&nbsp;</li> <li>Optional</li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li>Element</li> </ul> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
Java
@import Foundation; #import "FDObjectTransformerAdapter.h" @interface FDURLComponentsTransformerAdapter : NSObject < FDObjectTransformerAdapter > @end
Java
module Goaltender end require "goaltender/version" require "goaltender/base_module" require 'goaltender/value_parser' require 'goaltender/input' require 'goaltender/base'
Java
package com.sms4blood.emergencyhealthservices.util; import android.content.Intent; import android.location.Location; import android.net.Uri; import android.os.Bundle; import android.text.TextUtils; import android.widget.Toast; import com.sms4blood.emergencyhealthservices.Sms; import com.sms4blood.emergencyhealthservices.app.EhsApplication; import java.text.DecimalFormat; /** * Created by Vishnu on 8/1/2015. */ public class AppUtil extends Util { public static boolean callNumber(String phoneNumber) { boolean isValidPhoneNumber = checkPhoneNumber(phoneNumber); if (isValidPhoneNumber) { String callUri = "tel:" + phoneNumber; Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse(callUri)); callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(callIntent); } else { Toast.makeText(EhsApplication.getContext(), "Invalid phone number.", Toast.LENGTH_SHORT).show(); } return isValidPhoneNumber; } public static boolean sendSms(String phoneNumber, String message) { boolean isValidPhoneNumber = checkPhoneNumber(phoneNumber); if (isValidPhoneNumber) { // /*It is better to let the android manage the sms sending task using native messaging app*/ // Intent smsIntent = new Intent(Intent.ACTION_VIEW); // // Invokes only SMS/MMS clients // smsIntent.setType("vnd.android-dir/mms-sms"); // // Specify the Phone Number // smsIntent.putExtra("address", phoneNumber); // // Specify the Message // smsIntent.putExtra("sms_body", message); // smsIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // try { // startActivity(smsIntent); // } catch (Exception e) { // e.printStackTrace(); // Toast.makeText(EhsApplication.getContext(), "Unable to send sms to this number.", Toast.LENGTH_SHORT) // .show(); // } Intent i=new Intent(EhsApplication.getContext(), Sms.class); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Bundle bundle = new Bundle(); bundle.putString("mobileno",phoneNumber); i.putExtras(bundle); startActivity(i); } else { Toast.makeText(EhsApplication.getContext(), "Invalid phone number.", Toast.LENGTH_SHORT).show(); } return isValidPhoneNumber; } public static boolean showMap(String latitude, String longitude) { try { if (!TextUtils.isEmpty(latitude) && (!TextUtils.isEmpty(longitude))) { Uri gmmIntentUri = Uri.parse("google.navigation:q=" + latitude + "," + longitude); Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri); mapIntent.setPackage("com.google.android.apps.maps"); mapIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(mapIntent); return true; } else { Toast.makeText(EhsApplication.getContext(), "Address not available.", Toast.LENGTH_SHORT).show(); } } catch (Exception e) { e.printStackTrace(); } return false; } public static boolean showMap(String address) { try { if (!TextUtils.isEmpty(address)) { String encodedAddress = address.replaceAll("\n", " "); Uri gmmIntentUri = Uri.parse("google.navigation:q=" + encodedAddress); Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri); mapIntent.setPackage("com.google.android.apps.maps"); mapIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(mapIntent); return true; } else { Toast.makeText(EhsApplication.getContext(), "Address not available.", Toast.LENGTH_SHORT).show(); } } catch (Exception e) { e.printStackTrace(); } return false; } /** * @param fromLatitude * @param fromLongitude * @param toLatitude * @param toLongitude * @return distance between the two latitudes and longitudes in kms. */ public static double calculateDistance(double fromLatitude,double fromLongitude,double toLatitude,double toLongitude) { float results[] = new float[1]; try { Location.distanceBetween(fromLatitude, fromLongitude, toLatitude, toLongitude, results); } catch (Exception e) { if (e != null) e.printStackTrace(); } int dist = (int) results[0]; if(dist<=0) { return 0D; } DecimalFormat decimalFormat = new DecimalFormat("#.##"); results[0]/=1000D; String distance = decimalFormat.format(results[0]); double d = Double.parseDouble(distance); return d; } }
Java
<?php namespace App\FrontModule; use App\AppModule\ErrorPresenter as Presenter; class ErrorPresenter extends Presenter { }
Java
# Description: Photography References ### Online References * [None](#): None ### Write Here - None ### Notes - None ### TODOs - None
Java
<html> <head> <title> ABC 트레킹 3 : 시누와 :: 이한결 블로그 </title> <style> /* https://github.com/markdowncss/modest/blob/master/css/modest.css */ @media print { *, *:before, *:after { background: transparent !important; color: #000 !important; box-shadow: none !important; text-shadow: none !important; } a, a:visited { text-decoration: underline; } a[href]:after { content: ' (' attr(href) ')'; } abbr[title]:after { content: ' (' attr(title) ')'; } a[href^='#']:after, a[href^='javascript:']:after { content: ''; } pre, blockquote { border: 1px solid #999; page-break-inside: avoid; } thead { display: table-header-group; } tr, img { page-break-inside: avoid; } img { max-width: 100% !important; } p, h2, h3 { orphans: 3; widows: 3; } h2, h3 { page-break-after: avoid; } } pre, code { font-family: Menlo, Monaco, 'Courier New', monospace; } pre { padding: 0.5rem; line-height: 1.25; overflow-x: scroll; } a, a:visited { color: #3498db; } a:hover, a:focus, a:active { color: #2980b9; } .modest-no-decoration { text-decoration: none; } html { font-size: 12px; } @media screen and (min-width: 32rem) and (max-width: 48rem) { html { font-size: 15px; } } @media screen and (min-width: 48rem) { html { font-size: 16px; } } body { line-height: 1.85; } p, .modest-p { font-size: 1rem; margin-bottom: 1.3rem; } h1, .modest-h1, h2, .modest-h2, h3, .modest-h3, h4, .modest-h4 { margin: 1.414rem 0 0.5rem; font-weight: inherit; line-height: 1.42; } h1, .modest-h1 { margin-top: 0; font-size: 3.998rem; } h2, .modest-h2 { font-size: 2.827rem; } h3, .modest-h3 { font-size: 1.999rem; } h4, .modest-h4 { font-size: 1.414rem; } h5, .modest-h5 { font-size: 1.121rem; } h6, .modest-h6 { font-size: 0.88rem; } small, .modest-small { font-size: 0.707em; } /* https://github.com/mrmrs/fluidity */ img, canvas, iframe, video, svg, select, textarea { max-width: 100%; } @import url( http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300, 300italic, 700 ); @import url(http://fonts.googleapis.com/css?family=Arimo:700, 700italic); html { font-size: 18px; max-width: 100%; } body { color: #444; font-family: 'Open Sans Condensed', sans-serif; font-weight: 300; margin: 0 auto; max-width: 48rem; line-height: 1.45; padding: 0.25rem; } h1, h2, h3, h4, h5, h6 { font-family: Arimo, Helvetica, sans-serif; } h1, h2, h3 { border-bottom: 2px solid #fafafa; margin-bottom: 1.15rem; padding-bottom: 0.5rem; text-align: center; } blockquote { border-left: 8px solid #fafafa; padding: 1rem; } pre, code { background-color: #fafafa; } </style> </head> <body> <header> <h2> 이한결 블로그 <a href="http://leehankyeol.me">✍️</a> <a href="https://github.com/leehankyeol">💻</a> <a href="https://www.instagram.com/leehankyeol.me">📷</a> <a href="https://www.facebook.com/lee.hankyeol">🍻</a> </h2> </header> <article> <h1>ABC 트레킹 3 : 시누와</h1> <ol> <li> <p>산행은 고되다. 그래도 할 만한 수준이다. 가장 무거운 짐을 든 비커스가 항상 앞장을 서고 그보다는 조금 더 가벼운 짐을 든 내가 중간에, 제일 가벼운 배낭을 멨지만 그만큼 제일 귀여운 K가 후방에 선다. 가장 힘들어 하는 K를 챙기는 것은 아무래도 나의 몫이다. 이제는 입모양만 봐도 얼마나 힘든지 알아차릴 수 있다. 앙 다물었지만 입꼬리가 수평을 유지한다면 힘이 날 만한 말을 던질 타이밍이다. 아직까진 정말 잘 가고 있다. 기특하다.</p> </li> <li> <p>거머리에 물렸다. 복장이나 동선을 고려했을 때 노출된 순간은 찰나인데 그 틈을 놓치지 않은 셈이다. 침대에 엎드려 글을 쓰던 나를 보고 먼저 소스라치게 놀란 건 K, 피범벅(은 과장이 아니고 진짜였다.)이 된 발을 돌아보고 뒤늦게 놀란 것은 나였다. 아마도 내 오른발등을 뜯은 것으로 추정되는 거머리는 숙소 천장에서 대롱대롱거리고 있었다. 침착하게 발을 닦고 반창고를 붙인 뒤 천장의 녀석을 사로잡았다. 거머리에 물린 소감을 요약하면, 정말 쥐도새도 모르게 물리고 생각보다 피가 많이 난다는 것.</p> </li> <li> <p>ABC까지 가는 트레킹 코스는, 비커스에 의하면, 하도 한국 사람들이 많이 와서 현지인들 사이에선 코리안 코스라고 불리기도 한단다. 큰 거점에는 “1. 한국라면 2. 김치찌개 3. 백숙 4. 김치”라고 쓰여진 간판을 여럿 볼 수 있으며 롯지가 아닌 쉼터 대부분에서도 한국인 등산객들이 혹할 만한 메뉴를 볼 수 있다. 하지만 코스에 존재하는 모든 롯지와 쉼터는 비단 관광객들만을 위한 것이 아니다. 그곳에서 살아가는 현지인들의 삶을 위해서도 필수적으로 있어야 하는 공간이다. 시내를 한 번 나갔다 오는 것만 해도 며칠이 걸리는 여정이다. 휴식없이 생필품을 짊어지고 이동하는 것은 불가능한 일이다. 70kg 무게의 가스통을 짊어진 당나귀도, 말도, 소도 휴식할 곳이 필요하다. 모든 공사 자재를 등에 지고 머리로 그 무게를 지탱해가며 가는 이들의 무리를 볼 때면 경이로움마저 느껴진다. 이 신성한 삶의 과정을 스쳐지나가는 나 같은 관광객들은 한없이 겸손해져야 할 것이다. 현지인들을 마주칠 때마다 고개를 숙이고 나마스떼를 말하는 것을 잊지 말아야 한다.</p> </li> <li> <p>당연히 이런 트레킹은 초행인 만큼 와보니 안 챙겨서 아쉬운 게 한둘이 아니지만 진짜 위스키 두 병 사올 걸.</p> </li> <li> <p>네팔 현지식이 별 거 없다는 말은 완전히 잘못되었다. 어제 저녁 우연히 시키게 된(오늘 일정부터는 신성한 지역으로 들어서기 때문에 먹을 수 있는 고기의 종류가 제한된다고 했기 때문이다.) 닭고기 베이스의 달밧과 모모는 나와 K의 쇄국입맛을 전면개항하는 네팔발 포탄과도 같았다. 달밧파워 트웬티포아워만 있으면 ABC도 끄떡없다. 오늘 점심도 달밧을 먹었다.</p> </li> </ol> </article> <footer> Styled by <a href="https://github.com/markdowncss/modest/blob/master/css/modest.css" >Modest</a > </footer> </body> </html>
Java
module Perus::Pinger class Upload < Command description 'Uploads a file from the client to the server. Valid values for "path" are contained in the pinger config file.' option :path, restricted: true def run @file = File.new(options.path) end def cleanup @file.close unless @file.nil? || @file.closed? end end end
Java
package miwax.java_conf.gr.jp.frugalitycalc.view; import android.app.AlertDialog; import android.databinding.DataBindingUtil; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import miwax.java_conf.gr.jp.frugalitycalc.R; import miwax.java_conf.gr.jp.frugalitycalc.databinding.ActivityMainBinding; import miwax.java_conf.gr.jp.frugalitycalc.util.messenger.ShowAlertDialogMessage; import miwax.java_conf.gr.jp.frugalitycalc.viewmodel.MainViewModel; import rx.android.schedulers.AndroidSchedulers; import rx.functions.Action1; import rx.subscriptions.CompositeSubscription; public class MainActivity extends AppCompatActivity { private final String VIEW_MODEL = "VIEW_MODEL"; private ActivityMainBinding binding; private MainViewModel mainViewModel; private CompositeSubscription subscriptions = new CompositeSubscription(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); binding = DataBindingUtil.setContentView(this, R.layout.activity_main); if (savedInstanceState != null) { mainViewModel = savedInstanceState.getParcelable(VIEW_MODEL); } else { mainViewModel = new MainViewModel(); } binding.setViewModel(mainViewModel); // ダイアログ表示のメッセージ受信 subscriptions.add( mainViewModel.getMessenger().register(ShowAlertDialogMessage.class) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Action1<ShowAlertDialogMessage>() { @Override public void call(ShowAlertDialogMessage message) { showAlertDialog(message.getTitleId(), message.getTextId()); } }) ); } @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putParcelable(VIEW_MODEL, mainViewModel); } @Override protected void onDestroy() { mainViewModel.unsubscribe(); super.onDestroy(); } private void showAlertDialog(int titleId, int textId) { new AlertDialog.Builder(this) .setTitle(this.getString(titleId)) .setMessage(this.getString(textId)) .setPositiveButton("OK", null) .show(); } }
Java
<?php namespace Manialib\Maniacode\Elements; class ViewReplay extends UrlDownload { protected $nodeName = 'view_replay'; }
Java
import _plotly_utils.basevalidators class MinexponentValidator(_plotly_utils.basevalidators.NumberValidator): def __init__( self, plotly_name="minexponent", parent_name="choropleth.colorbar", **kwargs ): super(MinexponentValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, edit_type=kwargs.pop("edit_type", "colorbars"), min=kwargs.pop("min", 0), **kwargs )
Java
<HTML><HEAD> <TITLE>Review for Timecode (2000)</TITLE> <LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css"> </HEAD> <BODY BGCOLOR="#FFFFFF" TEXT="#000000"> <H1 ALIGN="CENTER" CLASS="title"><A HREF="/Title?0220100">Timecode (2000)</A></H1><H3 ALIGN=CENTER>reviewed by<BR><A HREF="/ReviewsBy?Frankie+Paiva">Frankie Paiva</A></H3><HR WIDTH="40%" SIZE="4"> <PRE>Time Code</PRE> <PRE>rated R 97 minutes Screen Gems starring Jeanne Tripplehorn, Salma Hayek, Stellan Skarsgard, Saffron Burrows, and Kyle MacLachlan written and directed by Mike Figgis</PRE> <PRE>A Review by Frankie Paiva</PRE> <P>I believe it's unfair to call Time Code an actual movie. The word experience is a better fit. The Time Code experience involves the screen being split into four different images, each with a different character focus, as they all play at the same time. The sound gets turned up on the one Figgis wants you to watch. One could describe it as watching four different shows on MTV all at once. The story relies heavily on this split screen factor and this is a very visual film with little complicated dialog. It has to be. Even with a slightly complicated plot, this movie would have been even more of a frenzy of annoying pointless images than it was. Essentially, a frenzy of annoying images describes the film well. This film is a foray into the different and the unusual, but carries little meaning. While Figgis has created a groundbreaking filmmaking approach, he seems concentrated on making sure the audience can handle it, rather than keep an interesting storyline going. It has been a long time since a movie has challenged you in such a way as this one does, but I felt it could have been even more challening if trust was put in the audience. Time Code dares to go freeform, and encourages the viewer to look at these characters and their surroundings with lightning fast comprehension before moving onto the next frame. Like any new method to come onto the film scene, it will take time to master, but consider Time Code the beginning of a new era in film.</P> <P>The movie was shot entirely in one afternoon last November using hand-held cameras. There are no edits. Everything is real time. There is no set plot structure either. While Figgis gave his actors basic character outlines, he decided it would be much more interesting if the film was almost entirely improvisational. This is both an attraction and a detraction. There are times when you sense the actors come up with things right off the top of their heads, and those parts of the film are exciting and fun. Character reactions are a key part of this movie that centers around Red Mullet Productions (both the producers and setting for this film) during auditions for a new movie. In the upper left corner Rose (Wild Wild West recovering Salma Hayek) is going to the audition with Lauren (Jeanne Tripplehorn). Rose and Lauren are lovers, and the latter suspects infidelity. In the upper right, Emma (Saffron Burrows, Figgis's wife) consults her psychiatrist about her husband Alex (Stellan Skarsgard) whom she suspects is cheating on her. Alex is indeed cheating on her, and he occupies the lower right frame. Finally, in the bottom left is an aspiring actress that comes to audition for the lead role at Red Mullet.</P> <P>After this basic setup, the camera roams free. Characters pop up in two different frames at once, or switch frames entirely. It's interesting to see how this effect gets used. One scene that I found bizarre involved Alex and an anonymous female having sex behind a movie screen. The screen was being used to show actresses moaning loudly from sexual pleasure during an audition for a group of executives. Another common element that unites the characters is the frequent bothersome earthquakes. Much care must have been taken into the timing to make the illusion of an earthquake appear in all four parts at the same time. These tremors that connect the characters continuously reminded me of the character connecting amphibians from the end of Magnolia. The ensemble cast that includes Steven Weber, Holly Hunter, Julian Sands, Leslie Mann, and Laurie Metcalf, as well as the actors mentioned above, have fun with their roles. It's no surprise though that the movie is inconsistent, but by the hour mark, I found myself comfortably able to grasp all that was going on. Time Code is almost interactive. It allows people to get a different experience of the movie each time they see it. The themes are the same though. Woe, jealousy, and betrayal all occupy different parts of the screen often. Everyone is cheating on everyone, and all the women are lesbians. Late in the film a young female independent filmmaker comes forward with an idea of new age filmmaking. "The end of editing is upon us!" she preaches. "Imagine a movie with four different images all running at the same time." Alex blows this idea off, and cannot control his laughter at the proposal. He tells her what a load of crap he thinks it is. She takes the criticism surprisingly well, and replies with a thank you stating he's the only honest person she has ever met in Los Angeles. By the time it reaches the conclusion, the facade of quality and honesty in Time Code is gone. It was then I realized the emptiness that ran through this movie. While Time Code is definitely worth seeing for the very original concept it presents, there's no hiding that little actual material lies under its surface.</P> <PRE>B-</PRE> <PRE>Frankie Paiva <A HREF="mailto:SwpStke@aol.com">SwpStke@aol.com</A> <A HREF="http://www.homestead.com/cinemaparadise/moviereviews.html">http://www.homestead.com/cinemaparadise/moviereviews.html</A></PRE> <HR><P CLASS=flush><SMALL>The review above was posted to the <A HREF="news:rec.arts.movies.reviews">rec.arts.movies.reviews</A> newsgroup (<A HREF="news:de.rec.film.kritiken">de.rec.film.kritiken</A> for German reviews).<BR> The Internet Movie Database accepts no responsibility for the contents of the review and has no editorial control. Unless stated otherwise, the copyright belongs to the author.<BR> Please direct comments/criticisms of the review to relevant newsgroups.<BR> Broken URLs inthe reviews are the responsibility of the author.<BR> The formatting of the review is likely to differ from the original due to ASCII to HTML conversion. </SMALL></P> <P ALIGN=CENTER>Related links: <A HREF="/Reviews/">index of all rec.arts.movies.reviews reviews</A></P> </P></BODY></HTML>
Java
// // YSCMacros.h // YSCKit // // Created by Builder on 16/6/29. // Copyright © 2016年 Builder. All rights reserved. // #import <sys/time.h> //============================================================================== // // @Description: // 该文件定义了基础库YSCKit中常用的宏定义 // //============================================================================== #ifndef YSCMacros_h #define YSCMacros_h /** 处于调试或者开发模式 */ #define IS_DEBUG_OR_DEVELOP_MODE (YSCConfigManagerInstance.isDebugModel || [YSCGeneral isArchiveByDevelopment]) /** 是否输出log */ #define IS_NSLOG_AVAILABLE IS_DEBUG_OR_DEVELOP_MODE #define __NSLog(s, ...) do { \ if (IS_NSLOG_AVAILABLE) { \ NSMutableString *logString = [NSMutableString stringWithFormat:@"[%@(%d)] ",[[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__]; \ if (s) { \ [logString appendFormat:(s), ##__VA_ARGS__]; \ } \ else { \ [logString appendString:@"(null)"]; \ } \ NSLog(@"%@", logString); \ [YSCLog saveLog:logString]; \ } \ } while (0) #define NSLog(...) __NSLog(__VA_ARGS__) /** 去掉字符串的头尾空格 */ #define TRIM_STRING(_string) (\ ( ! [_string isKindOfClass:[NSString class]]) ? \ @"" : [_string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] \ ) /** * 对象判空 * 注意:只对原始数据进行判断,即全空的字符串不为空 */ #define OBJECT_IS_EMPTY(_object) (_object == nil \ || [_object isKindOfClass:[NSNull class]] \ || ([_object respondsToSelector:@selector(length)] && [(NSData *)_object length] == 0) \ || ([_object respondsToSelector:@selector(count)] && [(NSArray *)_object count] == 0)) #define OBJECT_ISNOT_EMPTY(_object) ( ! OBJECT_IS_EMPTY(_object)) #define RETURN_WHEN_OBJECT_IS_EMPTY(_object) if (OBJECT_IS_EMPTY(_object)) { return ; } #define RETURN_NIL_WHEN_OBJECT_IS_EMPTY(_object) if (OBJECT_IS_EMPTY(_object)) { return nil; } #define RETURN_EMPTY_WHEN_OBJECT_IS_EMPTY(_object) if (OBJECT_IS_EMPTY(_object)) { return @""; } #define RETURN_YES_WHEN_OBJECT_IS_EMPTY(_object) if (OBJECT_IS_EMPTY(_object)) { return YES; } #define RETURN_NO_WHEN_OBJECT_IS_EMPTY(_object) if (OBJECT_IS_EMPTY(_object)) { return NO; } #define RETURN_ZERO_WHEN_OBJECT_IS_EMPTY(_object) if (OBJECT_IS_EMPTY(_object)) { return 0; } /** * 创建单例 */ #ifndef DEFINE_SHARED_INSTANCE_USING_BLOCK #define DEFINE_SHARED_INSTANCE_USING_BLOCK(block) \ static dispatch_once_t pred = 0; \ __strong static id _sharedObject = nil; \ dispatch_once(&pred, ^{ \ if (block) { \ _sharedObject = block(); \ } \ }); \ return _sharedObject; #endif /** * @brief swizzling instance method * * @usage: * SWIZZLING_INSTANCE_METHOD(self.class, @selector(viewDidLoad), @selector(ysc_viewDidLoad)) */ #ifndef SWIZZLING_INSTANCE_METHOD #define SWIZZLING_INSTANCE_METHOD(clazz, originalSelector, swizzledSelector) { \ Method originalMethod = class_getInstanceMethod(clazz, originalSelector); \ Method swizzledMethod = class_getInstanceMethod(clazz, swizzledSelector); \ BOOL isAddedMethod = class_addMethod(clazz, originalSelector, method_getImplementation(swizzledMethod), method_getTypeEncoding(swizzledMethod)); \ if (isAddedMethod) { \ class_replaceMethod(clazz, swizzledSelector, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod)); \ } \ else { \ method_exchangeImplementations(originalMethod, swizzledMethod); \ } } #endif /** * @brief swizzling class method * * @usage: * SWIZZLING_INSTANCE_METHOD(object_getClass((id)self), @selector(viewDidLoad), @selector(ysc_viewDidLoad)) */ #ifndef SWIZZLING_CLASS_METHOD #define SWIZZLING_CLASS_METHOD(clazz, originalSelector, swizzledSelector) { \ Method originalMethod = class_getInstanceMethod(clazz, originalSelector); \ Method swizzledMethod = class_getInstanceMethod(clazz, swizzledSelector); \ BOOL isAddedMethod = class_addMethod(clazz, originalSelector, method_getImplementation(swizzledMethod), method_getTypeEncoding(swizzledMethod)); \ if (isAddedMethod) { \ class_replaceMethod(clazz, swizzledSelector, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod)); \ } \ else { \ method_exchangeImplementations(originalMethod, swizzledMethod); \ } } #endif /** * 代码段简写 */ #define RGBA(r, g, b, a) [UIColor colorWithRed:r / 255.0f green:g / 255.0f blue:b / 255.0f alpha:a] #define RGB(r, g, b) RGBA(r,g,b,1.0f) #define RGB_GRAY(c) RGBA(c,c,c,1.0f) #define RANDOM_INT(from,to) ((int)((from) + arc4random() % ((to)-(from) + 1))) //随机数 [from,to] 之间 #define GET_NSERROR_MESSAGE(e) ((NSError *)e).userInfo[NSLocalizedDescriptionKey] //=e.localizedDescription #define KEY_WINDOW [UIApplication sharedApplication].keyWindow #define FUNCTION_NAME [NSString stringWithUTF8String:__FUNCTION__] #define IS_NIB_EXISTS(nib) [[NSFileManager defaultManager] fileExistsAtPath:[[NSBundle mainBundle] pathForResource:nib ofType:@"nib"]] #define CREATE_NSERROR_WITH_Code(c,m) [NSError errorWithDomain:@"YSCKit" code:c userInfo:@{NSLocalizedDescriptionKey : m}] #define CREATE_NSERROR(m) CREATE_NSERROR_WITH_Code(0,m) #define PRINT_DEALLOCING NSLog(@"[%@] is deallocing...",NSStringFromClass(self.class)); #define DEPRECATED_MARK(_instead_msg) NS_DEPRECATED(2_0, 2_0, 2_0, 2_0, _instead_msg) // 用于标示变量或方法已经过期了 /** * 1. if (NSOrderedAscending != COMPARE_VERSION(v1,v2)) { //v1 >= v2 } * 2. if (NSOrderedDescending == COMPARE_VERSION(v1,v2)) { //v1 > v2 } * 3. if (NSOrderedAscending == COMPARE_VERSION(v1,v2)) { //v1 < v2 } */ #define COMPARE_VERSION(v1,v2) [v1 compare:v2 options:NSNumericSearch] #define COMPARE_CURRENT_VERSION(v) COMPARE_VERSION([[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"], (v)) #define APP_SKIP_VERSION(v) [NSString stringWithFormat:@"APP_SKIP_VERSION_%@", v] #define APP_LAUNCH_VERSION(v) [NSString stringWithFormat:@"APP_LAUNCH_VERSION_%@", v] /** * @brief 关闭performSelector的leak警告提示 * * @usage: * PERFORM_SELECTOR_WITHOUT_LEAKWARNING( * [_target performSelector:_action withObject:self] * ); * * OR * * id result; * PERFORM_SELECTOR_WITHOUT_LEAKWARNING( * result = [_target performSelector:_action withObject:self] * ); */ #ifndef PERFORM_SELECTOR_WITHOUT_LEAKWARNING #define PERFORM_SELECTOR_WITHOUT_LEAKWARNING(block) \ do { \ _Pragma("clang diagnostic push") \ _Pragma("clang diagnostic ignored \"-Warc-performSelector-leaks\"") \ if (block) { \ block(); \ } \ _Pragma("clang diagnostic pop") \ } while (0) #endif /** * 注册通知与发送通知 */ //注册通知 #define ADD_OBSERVER_WITH_OBJECT(_selector, _name, _object) \ ([[NSNotificationCenter defaultCenter] addObserver:self selector:_selector name:_name object:_object]) #define ADD_OBSERVER(_selector,_name) \ ADD_OBSERVER_WITH_OBJECT(_selector, _name, nil) //发送通知 #define POST_NOTIFICATION_WITH_OBJECT_AND_INFO(_name, _object, _info) \ ([[NSNotificationCenter defaultCenter] postNotificationName:_name object:_object userInfo:(_info)]) #define POST_NOTIFICATION(_name) \ POST_NOTIFICATION_WITH_OBJECT_AND_INFO(_name, nil, nil) #define POST_NOTIFICATION_WITH_OBJECT(_name, _object) \ POST_NOTIFICATION_WITH_OBJECT_AND_INFO(_name, _object, nil) #define POST_NOTIFICATION_WITH_INFO(_name, _info) \ POST_NOTIFICATION_WITH_OBJECT_AND_INFO(_name, nil, _info) //移除通知 #define REMOVE_OBSERVER(_name) \ ([[NSNotificationCenter defaultCenter] removeObserver:self name:_name object:nil]) #define REMOVE_ALL_OBSERVERS(_self) \ ([[NSNotificationCenter defaultCenter] removeObserver:_self]) /** * @usage: * YSCBenchmark(^{ * // code * }, ^(double ms) { * NSLog(@"time cost: %.2f ms",ms); * }); */ static inline void YSCBenchmark(void (^block)(void), void (^complete)(double ms)) { // <QuartzCore/QuartzCore.h> version /* extern double CACurrentMediaTime (void); double begin, end, ms; begin = CACurrentMediaTime(); block(); end = CACurrentMediaTime(); ms = (end - begin) * 1000.0; complete(ms); */ // <sys/time.h> version struct timeval t0, t1; gettimeofday(&t0, NULL); block(); gettimeofday(&t1, NULL); double ms = (double)(t1.tv_sec - t0.tv_sec) * 1e3 + (double)(t1.tv_usec - t0.tv_usec) * 1e-3; complete(ms); } /** * @usage: * @interface NSObject (MyAdd) * @property (nonatomic, strong) NSMutableArray *textFields; * @end * * #import <objc/runtime.h> * @implementation NSObject (MyAdd) * YSC_DYNAMIC_PROPERTY_LAZYLOAD(textFields, NSMutableArray *, [NSMutableArray new]) * @end */ #ifndef YSC_DYNAMIC_PROPERTY_LAZYLOAD #define YSC_DYNAMIC_PROPERTY_LAZYLOAD(_getter_, _type_, _initObject_) \ - (_type_)_getter_ { \ _type_ target = objc_getAssociatedObject(self, _cmd); \ if ( ! target) { \ target = _initObject_; \ objc_setAssociatedObject(self, _cmd, target, OBJC_ASSOCIATION_RETAIN_NONATOMIC); \ } \ return target; \ } #endif /** * usage: * @interface NSObject (MyAdd) * @property (nonatomic, assign) BOOL isError; * @end * * #import <objc/runtime.h> * @implementation NSObject (MyAdd) * YSC_DYNAMIC_PROPERTY_BOOL(isError, setIsError) * @end */ #ifndef YSC_DYNAMIC_PROPERTY_BOOL #define YSC_DYNAMIC_PROPERTY_BOOL(_getter_, _setter_) \ - (void)_setter_:(BOOL)value { \ NSNumber *number = [NSNumber numberWithBool:value]; \ [self willChangeValueForKey:@#_getter_]; \ objc_setAssociatedObject(self, _cmd, number, OBJC_ASSOCIATION_RETAIN); \ [self didChangeValueForKey:@#_getter_]; \ } \ - (BOOL)_getter_ { \ NSNumber *number = objc_getAssociatedObject(self, @selector(_setter_:)); \ return [number boolValue]; \ } #endif /** * Synthsize a dynamic object property in @implementation scope. * It allows us to add custom properties to existing classes in categories. * * @param association ASSIGN / RETAIN / COPY / RETAIN_NONATOMIC / COPY_NONATOMIC * @warning #import <objc/runtime.h> * ******************************************************************************* * * @usage: * @interface NSObject (MyAdd) * @property (nonatomic, retain) UIColor *myColor; * @end * * #import <objc/runtime.h> * @implementation NSObject (MyAdd) * YSC_DYNAMIC_PROPERTY_OBJECT(myColor, setMyColor, RETAIN_NONATOMIC, UIColor *) * @end */ #ifndef YSC_DYNAMIC_PROPERTY_OBJECT #define YSC_DYNAMIC_PROPERTY_OBJECT(_getter_, _setter_, _association_, _type_) \ - (void)_setter_:(_type_)object { \ [self willChangeValueForKey:@#_getter_]; \ objc_setAssociatedObject(self, _cmd, object, OBJC_ASSOCIATION_##_association_); \ [self didChangeValueForKey:@#_getter_]; \ } \ - (_type_)_getter_ { \ return objc_getAssociatedObject(self, @selector(_setter_:)); \ } #endif /** * @usage: * @interface NSObject (MyAdd) * @property (nonatomic, retain) CGPoint myPoint; * @end * * #import <objc/runtime.h> * @implementation NSObject (MyAdd) * YSC_DYNAMIC_PROPERTY_CTYPE(myPoint, setMyPoint, CGPoint) * @end */ #ifndef YSC_DYNAMIC_PROPERTY_CTYPE #define YSC_DYNAMIC_PROPERTY_CTYPE(_getter_, _setter_, _type_) \ - (void)_setter_:(_type_)object { \ [self willChangeValueForKey:@#_getter_]; \ NSValue *value = [NSValue value:&object withObjCType:@encode(_type_)]; \ objc_setAssociatedObject(self, _cmd, value, OBJC_ASSOCIATION_RETAIN); \ [self didChangeValueForKey:@#_getter_]; \ } \ - (_type_)_getter_ { \ _type_ cValue = { 0 }; \ NSValue *value = objc_getAssociatedObject(self, @selector(_setter_:)); \ [value getValue:&cValue]; \ return cValue; \ } #endif /** * @usage: * @weakiy(self) * [self doSomething^{ * @strongiy(self) * if (!self) return; * ... * }]; */ #ifndef weakiy #if DEBUG #if __has_feature(objc_arc) #define weakiy(object) autoreleasepool{} __weak __typeof__(object) weak##_##object = object; #else #define weakiy(object) autoreleasepool{} __block __typeof__(object) block##_##object = object; #endif #else #if __has_feature(objc_arc) #define weakiy(object) try{} @finally{} {} __weak __typeof__(object) weak##_##object = object; #else #define weakiy(object) try{} @finally{} {} __block __typeof__(object) block##_##object = object; #endif #endif #endif #ifndef strongiy #if DEBUG #if __has_feature(objc_arc) #define strongiy(object) autoreleasepool{} __typeof__(object) object = weak##_##object; #else #define strongiy(object) autoreleasepool{} __typeof__(object) object = block##_##object; #endif #else #if __has_feature(objc_arc) #define strongiy(object) try{} @finally{} __typeof__(object) object = weak##_##object; #else #define strongiy(object) try{} @finally{} __typeof__(object) object = block##_##object; #endif #endif #endif #endif /* YSCMacros_h */
Java
/* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": true}] */ import path from 'path'; import webpack from 'webpack'; import CopyWebpackPlugin from 'copy-webpack-plugin'; import HtmlWebpackPlugin from 'html-webpack-plugin'; export default { context: __dirname, entry: './index.jsx', output: { path: `${__dirname}/__dev__`, publicPath: '/', filename: 'bundle.js', }, module: { loaders: [ { test: /\.(jpe?g|png|gif|svg)$/i, loaders: [ 'file?hash=sha512&digest=hex&name=[hash].[ext]', 'image-webpack?bypassOnDebug&optimizationLevel=7&interlaced=false' ] }, { test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel-loader' }, { test: /\.json$/, loader: 'json-loader' }, { test: /\.scss$/, loaders: [ 'style-loader', 'css-loader', 'sass-loader?includePaths[]=' + path.resolve(__dirname, './node_modules/compass-mixins/lib') ]}, ], }, resolve: { extensions: ['.js', '.jsx'], }, plugins: [ new CopyWebpackPlugin([ { from: '404.html' }, { from: 'img', to: 'img' }, { from: 'fonts', to: 'fonts' } ]), new HtmlWebpackPlugin({ template: 'index.template.ejs', inject: 'body' }), ], };
Java
namespace VoiceWall.Web.ViewModels.Search { using System.ComponentModel.DataAnnotations; public class SearchViewModel { [Required] [MinLength(2, ErrorMessage="Search text must be at least 2 characters")] [DataType(DataType.Text)] public string SearchText { get; set; } } }
Java
using SharpDX; using SharpDX.Direct3D11; using System; using System.Runtime.InteropServices; using System.Windows; using System.Xml; using System.IO; using System.Reflection; namespace Profiler.DirectX { public class TextManager : IDisposable { [StructLayout(LayoutKind.Sequential)] public struct Vertex { public Vector2 Position; public Vector2 UV; public SharpDX.Color Color; } DynamicBuffer<Vertex> VertexBuffer; DynamicBuffer<int> IndexBuffer; Mesh TextMesh; class Font : IDisposable { public struct Symbol { public RectangleF UV; public Size2F Size; public float Advance; } public Symbol[] Symbols = new Symbol[256]; public Texture2D Texture; public ShaderResourceView TextureView; public double Size { get; set; } public static Font Create(Device device, String name) { Font font = new Font(); Assembly assembly = Assembly.GetExecutingAssembly(); using (Stream stream = assembly.GetManifestResourceStream(String.Format("Profiler.DirectX.Fonts.{0}.fnt", name))) { XmlDocument doc = new XmlDocument(); doc.Load(stream); XmlNode desc = doc.SelectSingleNode("//info"); font.Size = double.Parse(desc.Attributes["size"].Value); XmlNode info = doc.SelectSingleNode("//common"); float width = float.Parse(info.Attributes["scaleW"].Value); float height = float.Parse(info.Attributes["scaleH"].Value); foreach (XmlNode node in doc.SelectNodes("//char")) { int id = int.Parse(node.Attributes["id"].Value); Symbol symbol = new Symbol(); symbol.Size.Width = float.Parse(node.Attributes["width"].Value); symbol.Size.Height = float.Parse(node.Attributes["height"].Value); int x = int.Parse(node.Attributes["x"].Value); int y = int.Parse(node.Attributes["y"].Value); symbol.UV = new RectangleF(x / width, y / height, symbol.Size.Width / width, symbol.Size.Height / height); symbol.Advance = float.Parse(node.Attributes["xadvance"].Value); font.Symbols[id] = symbol; } using (Stream textureStream = assembly.GetManifestResourceStream(String.Format("Profiler.DirectX.Fonts.{0}_0.png", name))) { font.Texture = TextureLoader.CreateTex2DFromFile(device, textureStream); } font.TextureView = new ShaderResourceView(device, font.Texture); } return font; } public void Dispose() { Utilities.Dispose(ref Texture); Utilities.Dispose(ref TextureView); } } Font SegoeUI; public TextManager(DirectX.DirectXCanvas canvas) { double baseFontSize = 16.0; int desiredFontSize = (int)(RenderSettings.dpiScaleY * baseFontSize); int fontSize = 16; int[] sizes = { 16, 20, 24, 28, 32 }; for (int i = 0; i < sizes.Length; ++i) { if (desiredFontSize < sizes[i]) break; fontSize = sizes[i]; } SegoeUI = Font.Create(canvas.RenderDevice, String.Format("SegoeUI_{0}_Normal", fontSize)); VertexBuffer = new DynamicBuffer<Vertex>(canvas.RenderDevice, BindFlags.VertexBuffer); IndexBuffer = new DynamicBuffer<int>(canvas.RenderDevice, BindFlags.IndexBuffer); TextMesh = canvas.CreateMesh(DirectXCanvas.MeshType.Text); TextMesh.UseAlpha = true; } public void Draw(System.Windows.Point pos, String text, System.Windows.Media.Color color, TextAlignment alignment = TextAlignment.Left, double maxWidth = double.MaxValue) { Color textColor = Utils.Convert(color); char[] str = text.ToCharArray(); switch (alignment) { case TextAlignment.Center: { double totalWidth = 0.0; for (int i = 0; i < str.Length; ++i) totalWidth += SegoeUI.Symbols[str[i]].Advance; double shift = Math.Max(0.0, (maxWidth - totalWidth) * 0.5); Vector2 origin = new Vector2((float)(pos.X + shift), (float)pos.Y); for (int i = 0; i < str.Length; ++i) { Font.Symbol symbol = SegoeUI.Symbols[str[i]]; if (symbol.Size.Width > maxWidth) break; Draw(origin, symbol, textColor); origin.X += symbol.Advance; maxWidth -= symbol.Advance; } } break; case TextAlignment.Right: { Vector2 origin = new Vector2((float)(pos.X + maxWidth), (float)pos.Y); for (int i = str.Length - 1; i >= 0; --i) { Font.Symbol symbol = SegoeUI.Symbols[str[i]]; origin.X -= symbol.Advance; if (symbol.Size.Width > maxWidth) break; Draw(origin, symbol, textColor); maxWidth -= symbol.Advance; } } break; default: { Vector2 origin = new Vector2((float)pos.X, (float)pos.Y); for (int i = 0; i < str.Length; ++i) { Font.Symbol symbol = SegoeUI.Symbols[str[i]]; if (symbol.Size.Width > maxWidth) break; Draw(origin, symbol, textColor); origin.X += symbol.Advance; maxWidth -= symbol.Advance; } } break; } } void Draw(Vector2 pos, Font.Symbol symbol, Color color) { VertexBuffer.Add(new Vertex() { Position = new Vector2(pos.X, pos.Y), UV = symbol.UV.TopLeft, Color = color }); VertexBuffer.Add(new Vertex() { Position = new Vector2(pos.X + symbol.Size.Width, pos.Y), UV = symbol.UV.TopRight, Color = color }); VertexBuffer.Add(new Vertex() { Position = new Vector2(pos.X + symbol.Size.Width, pos.Y + symbol.Size.Height), UV = symbol.UV.BottomRight, Color = color }); VertexBuffer.Add(new Vertex() { Position = new Vector2(pos.X, pos.Y + symbol.Size.Height), UV = symbol.UV.BottomLeft, Color = color }); } public void Render(DirectX.DirectXCanvas canvas) { Freeze(canvas.RenderDevice); canvas.RenderDevice.ImmediateContext.PixelShader.SetSampler(0, canvas.TextSamplerState); canvas.RenderDevice.ImmediateContext.PixelShader.SetShaderResource(0, SegoeUI.TextureView); canvas.Draw(TextMesh); } public void Freeze(Device device) { TextMesh.PrimitiveCount = VertexBuffer.Count * 2 / 4; if (IndexBuffer.Count < TextMesh.PrimitiveCount * 6) { IndexBuffer.Capacity = TextMesh.PrimitiveCount * 6; while (IndexBuffer.Count < TextMesh.PrimitiveCount * 6) { int baseIndex = (IndexBuffer.Count * 4) / 6; foreach (int i in DynamicMesh.BoxTriIndices) IndexBuffer.Add(baseIndex + i); } IndexBuffer.Update(device); } VertexBuffer.Update(device); TextMesh.VertexBuffer = VertexBuffer.Buffer; TextMesh.IndexBuffer = IndexBuffer.Buffer; TextMesh.VertexBufferBinding = new VertexBufferBinding(TextMesh.VertexBuffer, Utilites.SizeOf<Vertex>(), 0); } public void Dispose() { SharpDX.Utilities.Dispose(ref SegoeUI); SharpDX.Utilities.Dispose(ref TextMesh); } } }
Java
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_101) on Fri Oct 21 14:35:23 CEST 2016 --> <title>Uses of Class core.Task</title> <meta name="date" content="2016-10-21"> <link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class core.Task"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../core/Task.html" title="class in core">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../deprecated-list.html">Deprecated</a></li> <li><a href="../../index-files/index-1.html">Index</a></li> <li><a href="../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../index.html?core/class-use/Task.html" target="_top">Frames</a></li> <li><a href="Task.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Class core.Task" class="title">Uses of Class<br>core.Task</h2> </div> <div class="classUseContainer"> <ul class="blockList"> <li class="blockList"> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation"> <caption><span>Packages that use <a href="../../core/Task.html" title="class in core">Task</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Package</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="#core">core</a></td> <td class="colLast">&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="core"> <!-- --> </a> <h3>Uses of <a href="../../core/Task.html" title="class in core">Task</a> in <a href="../../core/package-summary.html">core</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing subclasses, and an explanation"> <caption><span>Subclasses of <a href="../../core/Task.html" title="class in core">Task</a> in <a href="../../core/package-summary.html">core</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Class and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../core/BasicTask.html" title="class in core">BasicTask</a></span></code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../core/ProgrammedEvent.html" title="class in core">ProgrammedEvent</a></span></code>&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../core/SpecialTask.html" title="class in core">SpecialTask</a></span></code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../core/TaskSequence.html" title="class in core">TaskSequence</a></span></code>&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../core/TimedTask.html" title="class in core">TimedTask</a></span></code>&nbsp;</td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing fields, and an explanation"> <caption><span>Fields in <a href="../../core/package-summary.html">core</a> declared as <a href="../../core/Task.html" title="class in core">Task</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Field and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>private <a href="../../core/Task.html" title="class in core">Task</a></code></td> <td class="colLast"><span class="typeNameLabel">Interval.</span><code><span class="memberNameLink"><a href="../../core/Interval.html#fatherTask">fatherTask</a></span></code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code>private <a href="../../core/Task.html" title="class in core">Task</a></code></td> <td class="colLast"><span class="typeNameLabel">TaskSequence.</span><code><span class="memberNameLink"><a href="../../core/TaskSequence.html#nextTask">nextTask</a></span></code>&nbsp;</td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../core/package-summary.html">core</a> that return <a href="../../core/Task.html" title="class in core">Task</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../core/Task.html" title="class in core">Task</a></code></td> <td class="colLast"><span class="typeNameLabel">Interval.</span><code><span class="memberNameLink"><a href="../../core/Interval.html#getFatherTask--">getFatherTask</a></span>()</code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../core/Task.html" title="class in core">Task</a></code></td> <td class="colLast"><span class="typeNameLabel">TimedTask.</span><code><span class="memberNameLink"><a href="../../core/TimedTask.html#getNextTask--">getNextTask</a></span>()</code>&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="../../core/Task.html" title="class in core">Task</a></code></td> <td class="colLast"><span class="typeNameLabel">TaskSequence.</span><code><span class="memberNameLink"><a href="../../core/TaskSequence.html#getNextTask--">getNextTask</a></span>()</code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code>abstract <a href="../../core/Task.html" title="class in core">Task</a></code></td> <td class="colLast"><span class="typeNameLabel">Task.</span><code><span class="memberNameLink"><a href="../../core/Task.html#getNextTask--">getNextTask</a></span>()</code> <div class="block">Implemented by decorator SpecialTask subclass TaskSequence</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>abstract <a href="../../core/Task.html" title="class in core">Task</a></code></td> <td class="colLast"><span class="typeNameLabel">SpecialTask.</span><code><span class="memberNameLink"><a href="../../core/SpecialTask.html#getNextTask--">getNextTask</a></span>()</code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../core/Task.html" title="class in core">Task</a></code></td> <td class="colLast"><span class="typeNameLabel">ProgrammedEvent.</span><code><span class="memberNameLink"><a href="../../core/ProgrammedEvent.html#getNextTask--">getNextTask</a></span>()</code>&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="../../core/Task.html" title="class in core">Task</a></code></td> <td class="colLast"><span class="typeNameLabel">BasicTask.</span><code><span class="memberNameLink"><a href="../../core/BasicTask.html#getNextTask--">getNextTask</a></span>()</code>&nbsp;</td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../core/package-summary.html">core</a> with parameters of type <a href="../../core/Task.html" title="class in core">Task</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><span class="typeNameLabel">Interval.</span><code><span class="memberNameLink"><a href="../../core/Interval.html#setFatherTask-core.Task-">setFatherTask</a></span>(<a href="../../core/Task.html" title="class in core">Task</a>&nbsp;nfatherTask)</code>&nbsp;</td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing constructors, and an explanation"> <caption><span>Constructors in <a href="../../core/package-summary.html">core</a> with parameters of type <a href="../../core/Task.html" title="class in core">Task</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colOne" scope="col">Constructor and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colLast"><code><span class="memberNameLink"><a href="../../core/Interval.html#Interval-java.lang.String-java.lang.String-core.Task-">Interval</a></span>(java.lang.String&nbsp;name, java.lang.String&nbsp;description, <a href="../../core/Task.html" title="class in core">Task</a>&nbsp;fatherTask)</code> <div class="block">Constructs an interval</div> </td> </tr> <tr class="rowColor"> <td class="colLast"><code><span class="memberNameLink"><a href="../../core/TaskSequence.html#TaskSequence-java.lang.String-java.lang.String-core.Project-java.util.ArrayList-core.Task-">TaskSequence</a></span>(java.lang.String&nbsp;name, java.lang.String&nbsp;description, <a href="../../core/Project.html" title="class in core">Project</a>&nbsp;father, java.util.ArrayList&lt;<a href="../../core/Activity.html" title="class in core">Activity</a>&gt;&nbsp;root, <a href="../../core/Task.html" title="class in core">Task</a>&nbsp;nnextTask)</code> <div class="block">Task sequence constructor</div> </td> </tr> </tbody> </table> </li> </ul> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../core/Task.html" title="class in core">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../deprecated-list.html">Deprecated</a></li> <li><a href="../../index-files/index-1.html">Index</a></li> <li><a href="../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../index.html?core/class-use/Task.html" target="_top">Frames</a></li> <li><a href="Task.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
Java
#include <iostream> #include <string> using namespace std; int main(){ int n; string experiment; for(cin>>n; n>0; n--){ cin >> experiment; if (experiment.size() < 3) cout << '+' << endl; else{ string s = experiment.substr(experiment.size()-2, 2); string saux; if(s == "35") cout << '-' << endl; else{ s = s[1]; saux = experiment[0]; if(saux == "9" && s == "4") cout << '*' << endl; else{ s = experiment.substr(0,3); if(s == "190") cout << '?' << endl; else cout << '?' << endl; } } } } return 0; }
Java
import urllib import urllib2 from bs4 import BeautifulSoup textToSearch = 'gorillaz' query = urllib.quote(textToSearch) url = "https://www.youtube.com/results?search_query=" + query response = urllib2.urlopen(url) html = response.read() soup = BeautifulSoup(html) for vid in soup.findAll(attrs={'class':'yt-uix-tile-link'}): print 'https://www.youtube.com' + vid['href']
Java
"use strict" var o = require("../../ospec/ospec") var callAsync = require("../../test-utils/callAsync") var browserMock = require("../../test-utils/browserMock") var m = require("../../render/hyperscript") var callAsync = require("../../test-utils/callAsync") var coreRenderer = require("../../render/render") var apiRedraw = require("../../api/redraw") var apiRouter = require("../../api/router") var Promise = require("../../promise/promise") o.spec("route", function() { void [{protocol: "http:", hostname: "localhost"}, {protocol: "file:", hostname: "/"}].forEach(function(env) { void ["#", "?", "", "#!", "?!", "/foo"].forEach(function(prefix) { o.spec("using prefix `" + prefix + "` starting on " + env.protocol + "//" + env.hostname, function() { var FRAME_BUDGET = Math.floor(1000 / 60) var $window, root, redrawService, route o.beforeEach(function() { $window = browserMock(env) root = $window.document.body redrawService = apiRedraw($window) route = apiRouter($window, redrawService) route.prefix(prefix) }) o("throws on invalid `root` DOM node", function() { var threw = false try { route(null, '/', {'/':{view: function() {}}}) } catch (e) { threw = true } o(threw).equals(true) }) o("renders into `root`", function() { $window.location.href = prefix + "/" route(root, "/", { "/" : { view: function() { return m("div") } } }) o(root.firstChild.nodeName).equals("DIV") }) o("routed mount points can redraw synchronously (#1275)", function() { var view = o.spy() $window.location.href = prefix + "/" route(root, "/", {"/":{view:view}}) o(view.callCount).equals(1) redrawService.redraw() o(view.callCount).equals(2) }) o("default route doesn't break back button", function(done) { $window.location.href = "http://old.com" $window.location.href = "http://new.com" route(root, "/a", { "/a" : { view: function() { return m("div") } } }) callAsync(function() { o(root.firstChild.nodeName).equals("DIV") o(route.get()).equals("/a") $window.history.back() o($window.location.pathname).equals("/") o($window.location.hostname).equals("old.com") done() }) }) o("default route does not inherit params", function(done) { $window.location.href = "/invalid?foo=bar" route(root, "/a", { "/a" : { oninit: init, view: function() { return m("div") } } }) function init(vnode) { o(vnode.attrs.foo).equals(undefined) done() } }) o("redraws when render function is executed", function() { var onupdate = o.spy() var oninit = o.spy() $window.location.href = prefix + "/" route(root, "/", { "/" : { view: function() { return m("div", { oninit: oninit, onupdate: onupdate }) } } }) o(oninit.callCount).equals(1) redrawService.redraw() o(onupdate.callCount).equals(1) }) o("redraws on events", function(done) { var onupdate = o.spy() var oninit = o.spy() var onclick = o.spy() var e = $window.document.createEvent("MouseEvents") e.initEvent("click", true, true) $window.location.href = prefix + "/" route(root, "/", { "/" : { view: function() { return m("div", { oninit: oninit, onupdate: onupdate, onclick: onclick, }) } } }) root.firstChild.dispatchEvent(e) o(oninit.callCount).equals(1) o(onclick.callCount).equals(1) o(onclick.this).equals(root.firstChild) o(onclick.args[0].type).equals("click") o(onclick.args[0].target).equals(root.firstChild) // Wrapped to give time for the rate-limited redraw to fire callAsync(function() { o(onupdate.callCount).equals(1) done() }) }) o("event handlers can skip redraw", function(done) { var onupdate = o.spy() var oninit = o.spy() var onclick = o.spy() var e = $window.document.createEvent("MouseEvents") e.initEvent("click", true, true) $window.location.href = prefix + "/" route(root, "/", { "/" : { view: function() { return m("div", { oninit: oninit, onupdate: onupdate, onclick: function(e) { e.redraw = false }, }) } } }) root.firstChild.dispatchEvent(e) o(oninit.callCount).equals(1) // Wrapped to ensure no redraw fired callAsync(function() { o(onupdate.callCount).equals(0) done() }) }) o("changes location on route.link", function() { var e = $window.document.createEvent("MouseEvents") e.initEvent("click", true, true) $window.location.href = prefix + "/" route(root, "/", { "/" : { view: function() { return m("a", { href: "/test", oncreate: route.link }) } }, "/test" : { view : function() { return m("div") } } }) var slash = prefix[0] === "/" ? "" : "/" o($window.location.href).equals(env.protocol + "//" + (env.hostname === "/" ? "" : env.hostname) + slash + (prefix ? prefix + "/" : "")) root.firstChild.dispatchEvent(e) o($window.location.href).equals(env.protocol + "//" + (env.hostname === "/" ? "" : env.hostname) + slash + (prefix ? prefix + "/" : "") + "test") }) o("accepts RouteResolver with onmatch that returns Component", function(done) { var matchCount = 0 var renderCount = 0 var Component = { view: function() { return m("span") } } var resolver = { onmatch: function(args, requestedPath) { matchCount++ o(args.id).equals("abc") o(requestedPath).equals("/abc") o(this).equals(resolver) return Component }, render: function(vnode) { renderCount++ o(vnode.attrs.id).equals("abc") o(this).equals(resolver) return vnode }, } $window.location.href = prefix + "/abc" route(root, "/abc", { "/:id" : resolver }) callAsync(function() { o(matchCount).equals(1) o(renderCount).equals(1) o(root.firstChild.nodeName).equals("SPAN") done() }) }) o("accepts RouteResolver with onmatch that returns Promise<Component>", function(done) { var matchCount = 0 var renderCount = 0 var Component = { view: function() { return m("span") } } var resolver = { onmatch: function(args, requestedPath) { matchCount++ o(args.id).equals("abc") o(requestedPath).equals("/abc") o(this).equals(resolver) return Promise.resolve(Component) }, render: function(vnode) { renderCount++ o(vnode.attrs.id).equals("abc") o(this).equals(resolver) return vnode }, } $window.location.href = prefix + "/abc" route(root, "/abc", { "/:id" : resolver }) callAsync(function() { o(matchCount).equals(1) o(renderCount).equals(1) o(root.firstChild.nodeName).equals("SPAN") done() }) }) o("accepts RouteResolver with onmatch that returns Promise<undefined>", function(done) { var matchCount = 0 var renderCount = 0 var Component = { view: function() { return m("span") } } var resolver = { onmatch: function(args, requestedPath) { matchCount++ o(args.id).equals("abc") o(requestedPath).equals("/abc") o(this).equals(resolver) return Promise.resolve() }, render: function(vnode) { renderCount++ o(vnode.attrs.id).equals("abc") o(this).equals(resolver) return vnode }, } $window.location.href = prefix + "/abc" route(root, "/abc", { "/:id" : resolver }) callAsync(function() { o(matchCount).equals(1) o(renderCount).equals(1) o(root.firstChild.nodeName).equals("DIV") done() }) }) o("accepts RouteResolver with onmatch that returns Promise<any>", function(done) { var matchCount = 0 var renderCount = 0 var Component = { view: function() { return m("span") } } var resolver = { onmatch: function(args, requestedPath) { matchCount++ o(args.id).equals("abc") o(requestedPath).equals("/abc") o(this).equals(resolver) return Promise.resolve([]) }, render: function(vnode) { renderCount++ o(vnode.attrs.id).equals("abc") o(this).equals(resolver) return vnode }, } $window.location.href = prefix + "/abc" route(root, "/abc", { "/:id" : resolver }) callAsync(function() { o(matchCount).equals(1) o(renderCount).equals(1) o(root.firstChild.nodeName).equals("DIV") done() }) }) o("accepts RouteResolver with onmatch that returns rejected Promise", function(done) { var matchCount = 0 var renderCount = 0 var spy = o.spy() var Component = { view: function() { return m("span") } } var resolver = { onmatch: function(args, requestedPath) { matchCount++ return Promise.reject(new Error("error")) }, render: function(vnode) { renderCount++ return vnode }, } $window.location.href = prefix + "/test/1" route(root, "/default", { "/default" : {view: spy}, "/test/:id" : resolver }) callAsync(function() { callAsync(function() { o(matchCount).equals(1) o(renderCount).equals(0) o(spy.callCount).equals(1) done() }) }) }) o("accepts RouteResolver without `render` method as payload", function(done) { var matchCount = 0 var Component = { view: function() { return m("div") } } $window.location.href = prefix + "/abc" route(root, "/abc", { "/:id" : { onmatch: function(args, requestedPath) { matchCount++ o(args.id).equals("abc") o(requestedPath).equals("/abc") return Component }, }, }) callAsync(function() { o(matchCount).equals(1) o(root.firstChild.nodeName).equals("DIV") done() }) }) o("changing `vnode.key` in `render` resets the component", function(done, timeout){ var oninit = o.spy() var Component = { oninit: oninit, view: function() { return m("div") } } $window.location.href = prefix + "/abc" route(root, "/abc", { "/:id": {render: function(vnode) { return m(Component, {key: vnode.attrs.id}) }} }) callAsync(function() { o(oninit.callCount).equals(1) route.set("/def") callAsync(function() { o(oninit.callCount).equals(2) done() }) }) }) o("accepts RouteResolver without `onmatch` method as payload", function() { var renderCount = 0 var Component = { view: function() { return m("div") } } $window.location.href = prefix + "/abc" route(root, "/abc", { "/:id" : { render: function(vnode) { renderCount++ o(vnode.attrs.id).equals("abc") return m(Component) }, }, }) o(root.firstChild.nodeName).equals("DIV") }) o("RouteResolver `render` does not have component semantics", function(done) { var renderCount = 0 var A = { view: function() { return m("div") } } $window.location.href = prefix + "/a" route(root, "/a", { "/a" : { render: function(vnode) { return m("div") }, }, "/b" : { render: function(vnode) { return m("div") }, }, }) var dom = root.firstChild o(root.firstChild.nodeName).equals("DIV") route.set("/b") callAsync(function() { o(root.firstChild).equals(dom) done() }) }) o("calls onmatch and view correct number of times", function(done) { var matchCount = 0 var renderCount = 0 var Component = { view: function() { return m("div") } } $window.location.href = prefix + "/" route(root, "/", { "/" : { onmatch: function() { matchCount++ return Component }, render: function(vnode) { renderCount++ return vnode }, }, }) callAsync(function() { o(matchCount).equals(1) o(renderCount).equals(1) redrawService.redraw() o(matchCount).equals(1) o(renderCount).equals(2) done() }) }) o("calls onmatch and view correct number of times when not onmatch returns undefined", function(done) { var matchCount = 0 var renderCount = 0 var Component = { view: function() { return m("div") } } $window.location.href = prefix + "/" route(root, "/", { "/" : { onmatch: function() { matchCount++ }, render: function(vnode) { renderCount++ return {tag: Component} }, }, }) callAsync(function() { o(matchCount).equals(1) o(renderCount).equals(1) redrawService.redraw() o(matchCount).equals(1) o(renderCount).equals(2) done() }) }) o("onmatch can redirect to another route", function(done) { var redirected = false var render = o.spy() $window.location.href = prefix + "/a" route(root, "/a", { "/a" : { onmatch: function() { route.set("/b") }, render: render }, "/b" : { view: function() { redirected = true } } }) callAsync(function() { o(render.callCount).equals(0) o(redirected).equals(true) done() }) }) o("onmatch can redirect to another route that has RouteResolver w/ only onmatch", function(done) { var redirected = false var render = o.spy() var view = o.spy(function() {return m("div")}) $window.location.href = prefix + "/a" route(root, "/a", { "/a" : { onmatch: function() { route.set("/b") }, render: render }, "/b" : { onmatch: function() { redirected = true return {view: view} } } }) callAsync(function() { callAsync(function() { o(render.callCount).equals(0) o(redirected).equals(true) o(view.callCount).equals(1) o(root.childNodes.length).equals(1) o(root.firstChild.nodeName).equals("DIV") done() }) }) }) o("onmatch can redirect to another route that has RouteResolver w/ only render", function(done) { var redirected = false var render = o.spy() $window.location.href = prefix + "/a" route(root, "/a", { "/a" : { onmatch: function() { route.set("/b") }, render: render }, "/b" : { render: function(vnode){ redirected = true } } }) callAsync(function() { o(render.callCount).equals(0) o(redirected).equals(true) done() }) }) o("onmatch can redirect to another route that has RouteResolver whose onmatch resolves asynchronously", function(done) { var redirected = false var render = o.spy() var view = o.spy() $window.location.href = prefix + "/a" route(root, "/a", { "/a" : { onmatch: function() { route.set("/b") }, render: render }, "/b" : { onmatch: function() { redirected = true return new Promise(function(fulfill){ callAsync(function(){ fulfill({view: view}) }) }) } } }) callAsync(function() { callAsync(function() { callAsync(function() { o(render.callCount).equals(0) o(redirected).equals(true) o(view.callCount).equals(1) done() }) }) }) }) o("onmatch can redirect to another route asynchronously", function(done) { var redirected = false var render = o.spy() var view = o.spy() $window.location.href = prefix + "/a" route(root, "/a", { "/a" : { onmatch: function() { callAsync(function() {route.set("/b")}) return new Promise(function() {}) }, render: render }, "/b" : { onmatch: function() { redirected = true return {view: view} } } }) callAsync(function() { callAsync(function() { callAsync(function() { o(render.callCount).equals(0) o(redirected).equals(true) o(view.callCount).equals(1) done() }) }) }) }) o("onmatch can redirect w/ window.history.back()", function(done) { var render = o.spy() var component = {view: o.spy()} $window.location.href = prefix + "/a" route(root, "/a", { "/a" : { onmatch: function() { return component }, render: function(vnode) { return vnode } }, "/b" : { onmatch: function() { $window.history.back() return new Promise(function() {}) }, render: render } }) callAsync(function() { route.set('/b') callAsync(function() { callAsync(function() { callAsync(function() { o(render.callCount).equals(0) o(component.view.callCount).equals(2) done() }) }) }) }) }) o("onmatch can redirect to a non-existent route that defaults to a RouteResolver w/ onmatch", function(done) { var redirected = false var render = o.spy() $window.location.href = prefix + "/a" route(root, "/b", { "/a" : { onmatch: function() { route.set("/c") }, render: render }, "/b" : { onmatch: function(vnode){ redirected = true return {view: function() {}} } } }) callAsync(function() { callAsync(function() { o(render.callCount).equals(0) o(redirected).equals(true) done() }) }) }) o("onmatch can redirect to a non-existent route that defaults to a RouteResolver w/ render", function(done) { var redirected = false var render = o.spy() $window.location.href = prefix + "/a" route(root, "/b", { "/a" : { onmatch: function() { route.set("/c") }, render: render }, "/b" : { render: function(vnode){ redirected = true } } }) callAsync(function() { callAsync(function() { o(render.callCount).equals(0) o(redirected).equals(true) done() }) }) }) o("onmatch can redirect to a non-existent route that defaults to a component", function(done) { var redirected = false var render = o.spy() $window.location.href = prefix + "/a" route(root, "/b", { "/a" : { onmatch: function() { route.set("/c") }, render: render }, "/b" : { view: function(vnode){ redirected = true } } }) callAsync(function() { callAsync(function() { o(render.callCount).equals(0) o(redirected).equals(true) done() }) }) }) o("the previous view redraws while onmatch resolution is pending (#1268)", function(done) { var view = o.spy() var onmatch = o.spy(function() { return new Promise(function() {}) }) $window.location.href = prefix + "/a" route(root, "/", { "/a": {view: view}, "/b": {onmatch: onmatch} }) o(view.callCount).equals(1) o(onmatch.callCount).equals(0) route.set("/b") callAsync(function() { o(view.callCount).equals(1) o(onmatch.callCount).equals(1) redrawService.redraw() o(view.callCount).equals(2) o(onmatch.callCount).equals(1) done() }) }) o("when two async routes are racing, the last one set cancels the finalization of the first", function(done) { var renderA = o.spy() var renderB = o.spy() var onmatchA = o.spy(function(){ return new Promise(function(fulfill) { setTimeout(function(){ fulfill() }, 10) }) }) $window.location.href = prefix + "/a" route(root, "/a", { "/a": { onmatch: onmatchA, render: renderA }, "/b": { onmatch: function(){ var p = new Promise(function(fulfill) { o(onmatchA.callCount).equals(1) o(renderA.callCount).equals(0) o(renderB.callCount).equals(0) setTimeout(function(){ o(onmatchA.callCount).equals(1) o(renderA.callCount).equals(0) o(renderB.callCount).equals(0) fulfill() p.then(function(){ o(onmatchA.callCount).equals(1) o(renderA.callCount).equals(0) o(renderB.callCount).equals(1) done() }) }, 20) }) return p }, render: renderB } }) callAsync(function() { o(onmatchA.callCount).equals(1) o(renderA.callCount).equals(0) o(renderB.callCount).equals(0) route.set("/b") o(onmatchA.callCount).equals(1) o(renderA.callCount).equals(0) o(renderB.callCount).equals(0) }) }) o("m.route.set(m.route.get()) re-runs the resolution logic (#1180)", function(done){ var onmatch = o.spy() var render = o.spy(function() {return m("div")}) $window.location.href = prefix + "/" route(root, '/', { "/": { onmatch: onmatch, render: render } }) callAsync(function() { o(onmatch.callCount).equals(1) o(render.callCount).equals(1) route.set(route.get()) callAsync(function() { callAsync(function() { o(onmatch.callCount).equals(2) o(render.callCount).equals(2) done() }) }) }) }) o("m.route.get() returns the last fully resolved route (#1276)", function(done){ $window.location.href = prefix + "/" route(root, "/", { "/": {view: function() {}}, "/2": { onmatch: function() { return new Promise(function() {}) } } }) o(route.get()).equals("/") route.set("/2") callAsync(function() { o(route.get()).equals("/") done() }) }) o("routing with RouteResolver works more than once", function(done) { $window.location.href = prefix + "/a" route(root, '/a', { '/a': { render: function() { return m("a", "a") } }, '/b': { render: function() { return m("b", "b") } } }) route.set('/b') callAsync(function() { route.set('/a') callAsync(function() { o(root.firstChild.nodeName).equals("A") done() }) }) }) o("calling route.set invalidates pending onmatch resolution", function(done) { var rendered = false var resolved $window.location.href = prefix + "/a" route(root, "/a", { "/a": { onmatch: function() { return new Promise(function(resolve) { callAsync(function() { callAsync(function() { resolve({view: function() {rendered = true}}) }) }) }) }, render: function(vnode) { rendered = true resolved = "a" } }, "/b": { view: function() { resolved = "b" } } }) route.set("/b") callAsync(function() { o(rendered).equals(false) o(resolved).equals("b") callAsync(function() { o(rendered).equals(false) o(resolved).equals("b") done() }) }) }) o("route changes activate onbeforeremove", function(done) { var spy = o.spy() $window.location.href = prefix + "/a" route(root, "/a", { "/a": { onbeforeremove: spy, view: function() {} }, "/b": { view: function() {} } }) route.set("/b") callAsync(function() { o(spy.callCount).equals(1) done() }) }) o("asynchronous route.set in onmatch works", function(done) { var rendered = false, resolved route(root, "/a", { "/a": { onmatch: function() { return Promise.resolve().then(function() { route.set("/b") }) }, render: function(vnode) { rendered = true resolved = "a" } }, "/b": { view: function() { resolved = "b" } }, }) callAsync(function() { // tick for popstate for /a callAsync(function() { // tick for promise in onmatch callAsync(function() { // tick for onpopstate for /b o(rendered).equals(false) o(resolved).equals("b") done() }) }) }) }) o("throttles", function(done, timeout) { timeout(200) var i = 0 $window.location.href = prefix + "/" route(root, "/", { "/": {view: function(v) {i++}} }) var before = i redrawService.redraw() redrawService.redraw() redrawService.redraw() redrawService.redraw() var after = i setTimeout(function() { o(before).equals(1) // routes synchronously o(after).equals(2) // redraws synchronously o(i).equals(3) // throttles rest done() }, FRAME_BUDGET * 2) }) o("m.route.param is available outside of route handlers", function(done) { $window.location.href = prefix + "/" route(root, "/1", { "/:id" : { view : function() { o(route.param("id")).equals("1") return m("div") } } }) o(route.param("id")).equals(undefined); o(route.param()).deepEquals(undefined); callAsync(function() { o(route.param("id")).equals("1") o(route.param()).deepEquals({id:"1"}) done() }) }) }) }) }) })
Java
// Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- info: > Math.sqrt, recommended that implementations use the approximation algorithms for IEEE 754 arithmetic contained in fdlibm es5id: 15.8.2.17_A6 description: > Checking if Math.sqrt is approximately equals to its mathematical values on the set of 64 argument values; all the sample values is calculated with LibC includes: - math_precision.js - math_isequal.js ---*/ // CHECK#1 vnum = 64; var x = new Array(); x[0] = 0.00000000000000000000; x[1] = 0.25396825396825395000; x[2] = 0.50793650793650791000; x[3] = 0.76190476190476186000; x[4] = 1.01587301587301580000; x[5] = 1.26984126984126980000; x[6] = 1.52380952380952370000; x[7] = 1.77777777777777770000; x[8] = 2.03174603174603160000; x[9] = 2.28571428571428560000; x[10] = 2.53968253968253950000; x[11] = 2.79365079365079350000; x[12] = 3.04761904761904740000; x[13] = 3.30158730158730140000; x[14] = 3.55555555555555540000; x[15] = 3.80952380952380930000; x[16] = 4.06349206349206330000; x[17] = 4.31746031746031720000; x[18] = 4.57142857142857120000; x[19] = 4.82539682539682510000; x[20] = 5.07936507936507910000; x[21] = 5.33333333333333300000; x[22] = 5.58730158730158700000; x[23] = 5.84126984126984090000; x[24] = 6.09523809523809490000; x[25] = 6.34920634920634890000; x[26] = 6.60317460317460280000; x[27] = 6.85714285714285680000; x[28] = 7.11111111111111070000; x[29] = 7.36507936507936470000; x[30] = 7.61904761904761860000; x[31] = 7.87301587301587260000; x[32] = 8.12698412698412650000; x[33] = 8.38095238095238140000; x[34] = 8.63492063492063440000; x[35] = 8.88888888888888930000; x[36] = 9.14285714285714230000; x[37] = 9.39682539682539720000; x[38] = 9.65079365079365030000; x[39] = 9.90476190476190510000; x[40] = 10.15873015873015800000; x[41] = 10.41269841269841300000; x[42] = 10.66666666666666600000; x[43] = 10.92063492063492100000; x[44] = 11.17460317460317400000; x[45] = 11.42857142857142900000; x[46] = 11.68253968253968200000; x[47] = 11.93650793650793700000; x[48] = 12.19047619047619000000; x[49] = 12.44444444444444500000; x[50] = 12.69841269841269800000; x[51] = 12.95238095238095300000; x[52] = 13.20634920634920600000; x[53] = 13.46031746031746000000; x[54] = 13.71428571428571400000; x[55] = 13.96825396825396800000; x[56] = 14.22222222222222100000; x[57] = 14.47619047619047600000; x[58] = 14.73015873015872900000; x[59] = 14.98412698412698400000; x[60] = 15.23809523809523700000; x[61] = 15.49206349206349200000; x[62] = 15.74603174603174500000; x[63] = 16.00000000000000000000; var y = new Array(); y[0] = 0.00000000000000000000; y[1] = 0.50395263067896967000; y[2] = 0.71269664509979835000; y[3] = 0.87287156094396945000; y[4] = 1.00790526135793930000; y[5] = 1.12687233963802200000; y[6] = 1.23442679969673530000; y[7] = 1.33333333333333330000; y[8] = 1.42539329019959670000; y[9] = 1.51185789203690880000; y[10] = 1.59363814577919150000; y[11] = 1.67142178807468980000; y[12] = 1.74574312188793890000; y[13] = 1.81702705031799170000; y[14] = 1.88561808316412670000; y[15] = 1.95180014589706640000; y[16] = 2.01581052271587870000; y[17] = 2.07784992659727900000; y[18] = 2.13808993529939520000; y[19] = 2.19667858946110380000; y[20] = 2.25374467927604400000; y[21] = 2.30940107675850290000; y[22] = 2.36374736114111530000; y[23] = 2.41687191246657520000; y[24] = 2.46885359939347060000; y[25] = 2.51976315339484810000; y[26] = 2.56966429775848400000; y[27] = 2.61861468283190830000; y[28] = 2.66666666666666650000; y[29] = 2.71386797119523940000; y[30] = 2.76026223736941700000; y[31] = 2.80588949764880670000; y[32] = 2.85078658039919340000; y[33] = 2.89498745782298350000; y[34] = 2.93852354676981160000; y[35] = 2.98142396999971960000; y[36] = 3.02371578407381760000; y[37] = 3.06542417893925380000; y[38] = 3.10657265339049320000; y[39] = 3.14718316987777280000; y[40] = 3.18727629155838300000; y[41] = 3.22687130401855570000; y[42] = 3.26598632371090410000; y[43] = 3.30463839483761390000; y[44] = 3.34284357614937950000; y[45] = 3.38061701891406630000; y[46] = 3.41797303712883060000; y[47] = 3.45492517089848670000; y[48] = 3.49148624377587780000; y[49] = 3.52766841475278750000; y[50] = 3.56348322549899170000; y[51] = 3.59894164336974940000; y[52] = 3.63405410063598340000; y[53] = 3.66883053033489940000; y[54] = 3.70328039909020570000; y[55] = 3.73741273720925400000; y[56] = 3.77123616632825340000; y[57] = 3.80475892484536750000; y[58] = 3.83798889135426350000; y[59] = 3.87093360626696680000; y[60] = 3.90360029179413280000; y[61] = 3.93599587043272870000; y[62] = 3.96812698209517300000; y[63] = 4.00000000000000000000; var val; for (i = 0; i < vnum; i++) { val = Math.sqrt(x[i]); if (!isEqual(val, y[i])) { $ERROR("\nx = " + x[i] + "\nlibc.sqrt(x) = " + y[i] + "\nMath.sqrt(x) = " + Math.sqrt(x[i]) + "\nMath.abs(libc.sqrt(x) - Math.sqrt(x)) > " + prec + "\n\n"); } }
Java
/////////////////////////////////////////////////////////////// // This is generated code. ////////////////////////////////////////////////////////////// // Code is generated using LLBLGen Pro version: 4.2 // Code is generated on: // Code is generated using templates: SD.TemplateBindings.SharedTemplates // Templates vendor: Solutions Design. // Templates version: ////////////////////////////////////////////////////////////// using System; using System.Collections; using System.Collections.Generic; using AdventureWorks.Dal; using AdventureWorks.Dal.FactoryClasses; using AdventureWorks.Dal.HelperClasses; using SD.LLBLGen.Pro.ORMSupportClasses; namespace AdventureWorks.Dal.RelationClasses { /// <summary>Implements the relations factory for the entity: WorkOrderRouting. </summary> public partial class WorkOrderRoutingRelations { /// <summary>CTor</summary> public WorkOrderRoutingRelations() { } /// <summary>Gets all relations of the WorkOrderRoutingEntity as a list of IEntityRelation objects.</summary> /// <returns>a list of IEntityRelation objects</returns> public virtual List<IEntityRelation> GetAllRelations() { List<IEntityRelation> toReturn = new List<IEntityRelation>(); toReturn.Add(this.LocationEntityUsingLocationId); toReturn.Add(this.WorkOrderEntityUsingWorkOrderId); return toReturn; } #region Class Property Declarations /// <summary>Returns a new IEntityRelation object, between WorkOrderRoutingEntity and LocationEntity over the m:1 relation they have, using the relation between the fields: /// WorkOrderRouting.LocationId - Location.LocationId /// </summary> public virtual IEntityRelation LocationEntityUsingLocationId { get { IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToOne, "Location", false); relation.AddEntityFieldPair(LocationFields.LocationId, WorkOrderRoutingFields.LocationId); relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("LocationEntity", false); relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("WorkOrderRoutingEntity", true); return relation; } } /// <summary>Returns a new IEntityRelation object, between WorkOrderRoutingEntity and WorkOrderEntity over the m:1 relation they have, using the relation between the fields: /// WorkOrderRouting.WorkOrderId - WorkOrder.WorkOrderId /// </summary> public virtual IEntityRelation WorkOrderEntityUsingWorkOrderId { get { IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToOne, "WorkOrder", false); relation.AddEntityFieldPair(WorkOrderFields.WorkOrderId, WorkOrderRoutingFields.WorkOrderId); relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("WorkOrderEntity", false); relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("WorkOrderRoutingEntity", true); return relation; } } /// <summary>stub, not used in this entity, only for TargetPerEntity entities.</summary> public virtual IEntityRelation GetSubTypeRelation(string subTypeEntityName) { return null; } /// <summary>stub, not used in this entity, only for TargetPerEntity entities.</summary> public virtual IEntityRelation GetSuperTypeRelation() { return null;} #endregion #region Included Code #endregion } /// <summary>Static class which is used for providing relationship instances which are re-used internally for syncing</summary> internal static class StaticWorkOrderRoutingRelations { internal static readonly IEntityRelation LocationEntityUsingLocationIdStatic = new WorkOrderRoutingRelations().LocationEntityUsingLocationId; internal static readonly IEntityRelation WorkOrderEntityUsingWorkOrderIdStatic = new WorkOrderRoutingRelations().WorkOrderEntityUsingWorkOrderId; /// <summary>CTor</summary> static StaticWorkOrderRoutingRelations() { } } }
Java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to you under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. See the License for the specific language governing * permissions and limitations under the License. */ #include <avro/platform.h> #include <stdlib.h> #include <string.h> #include "avro_private.h" #include "avro/allocation.h" #include "avro/basics.h" #include "avro/data.h" #include "avro/errors.h" #include "avro/refcount.h" #include "avro/resolver.h" #include "avro/schema.h" #include "avro/value.h" #include "st.h" #ifndef AVRO_RESOLVER_DEBUG #define AVRO_RESOLVER_DEBUG 0 #endif #if AVRO_RESOLVER_DEBUG #include <stdio.h> #define AVRO_DEBUG(...) \ do { \ fprintf(stderr, __VA_ARGS__); \ fprintf(stderr, "\n"); \ } while (0) #else #define AVRO_DEBUG(...) /* don't print messages */ #endif typedef struct avro_resolved_reader avro_resolved_reader_t; struct avro_resolved_reader { avro_value_iface_t parent; /** The reference count for this interface. */ volatile int refcount; /** The writer schema. */ avro_schema_t wschema; /** The reader schema. */ avro_schema_t rschema; /* The size of the value instances for this resolver. */ size_t instance_size; /* A function to calculate the instance size once the overall * top-level resolver (and all of its children) have been * constructed. */ void (*calculate_size)(avro_resolved_reader_t *iface); /* A free function for this resolver */ void (*free_iface)(avro_resolved_reader_t *iface, st_table *freeing); /* An initialization function for instances of this resolver. */ int (*init)(const avro_resolved_reader_t *iface, void *self); /* A finalization function for instances of this resolver. */ void (*done)(const avro_resolved_reader_t *iface, void *self); /* Clear out any existing wrappers, if any */ int (*reset_wrappers)(const avro_resolved_reader_t *iface, void *self); }; #define avro_resolved_reader_calculate_size(iface) \ do { \ if ((iface)->calculate_size != NULL) { \ (iface)->calculate_size((iface)); \ } \ } while (0) #define avro_resolved_reader_init(iface, self) \ ((iface)->init == NULL? 0: (iface)->init((iface), (self))) #define avro_resolved_reader_done(iface, self) \ ((iface)->done == NULL? (void) 0: (iface)->done((iface), (self))) #define avro_resolved_reader_reset_wrappers(iface, self) \ ((iface)->reset_wrappers == NULL? 0: \ (iface)->reset_wrappers((iface), (self))) /* * We assume that each instance type in this value contains an an * avro_value_t as its first element, which is the current wrapped * value. */ void avro_resolved_reader_set_source(avro_value_t *resolved, avro_value_t *dest) { avro_value_t *self = (avro_value_t *) resolved->self; if (self->self != NULL) { avro_value_decref(self); } avro_value_copy_ref(self, dest); } void avro_resolved_reader_clear_source(avro_value_t *resolved) { avro_value_t *self = (avro_value_t *) resolved->self; if (self->self != NULL) { avro_value_decref(self); } self->iface = NULL; self->self = NULL; } int avro_resolved_reader_new_value(avro_value_iface_t *viface, avro_value_t *value) { int rval; avro_resolved_reader_t *iface = container_of(viface, avro_resolved_reader_t, parent); void *self = avro_malloc(iface->instance_size + sizeof(volatile int)); if (self == NULL) { value->iface = NULL; value->self = NULL; return ENOMEM; } memset(self, 0, iface->instance_size + sizeof(volatile int)); volatile int *refcount = (volatile int *) self; self = (char *) self + sizeof(volatile int); rval = avro_resolved_reader_init(iface, self); if (rval != 0) { avro_free(self, iface->instance_size + sizeof(volatile int)); value->iface = NULL; value->self = NULL; return rval; } *refcount = 1; value->iface = avro_value_iface_incref(viface); value->self = self; return 0; } static void avro_resolved_reader_free_value(const avro_value_iface_t *viface, void *vself) { avro_resolved_reader_t *iface = container_of(viface, avro_resolved_reader_t, parent); avro_value_t *self = (avro_value_t *) vself; avro_resolved_reader_done(iface, vself); if (self->self != NULL) { avro_value_decref(self); } vself = (char *) vself - sizeof(volatile int); avro_free(vself, iface->instance_size + sizeof(volatile int)); } static void avro_resolved_reader_incref(avro_value_t *value) { /* * This only works if you pass in the top-level value. */ volatile int *refcount = (volatile int *) ((char *) value->self - sizeof(volatile int)); avro_refcount_inc(refcount); } static void avro_resolved_reader_decref(avro_value_t *value) { /* * This only works if you pass in the top-level value. */ volatile int *refcount = (volatile int *) ((char *) value->self - sizeof(volatile int)); if (avro_refcount_dec(refcount)) { avro_resolved_reader_free_value(value->iface, value->self); } } static avro_value_iface_t * avro_resolved_reader_incref_iface(avro_value_iface_t *viface) { avro_resolved_reader_t *iface = container_of(viface, avro_resolved_reader_t, parent); avro_refcount_inc(&iface->refcount); return viface; } static void free_resolver(avro_resolved_reader_t *iface, st_table *freeing) { /* First check if we've already started freeing this resolver. */ if (st_lookup(freeing, (st_data_t) iface, NULL)) { AVRO_DEBUG("Already freed %p", iface); return; } /* Otherwise add this resolver to the freeing set, then free it. */ st_insert(freeing, (st_data_t) iface, (st_data_t) NULL); AVRO_DEBUG("Freeing resolver %p (%s->%s)", iface, avro_schema_type_name(iface->wschema), avro_schema_type_name(iface->rschema)); iface->free_iface(iface, freeing); } static void avro_resolved_reader_calculate_size_(avro_resolved_reader_t *iface) { /* Only calculate the size for any resolver once */ iface->calculate_size = NULL; AVRO_DEBUG("Calculating size for %s->%s", avro_schema_type_name((iface)->wschema), avro_schema_type_name((iface)->rschema)); iface->instance_size = sizeof(avro_value_t); } static void avro_resolved_reader_free_iface(avro_resolved_reader_t *iface, st_table *freeing) { AVRO_UNUSED(freeing); avro_schema_decref(iface->wschema); avro_schema_decref(iface->rschema); avro_freet(avro_resolved_reader_t, iface); } static void avro_resolved_reader_decref_iface(avro_value_iface_t *viface) { avro_resolved_reader_t *iface = container_of(viface, avro_resolved_reader_t, parent); AVRO_DEBUG("Decref resolver %p (before=%d)", iface, iface->refcount); if (avro_refcount_dec(&iface->refcount)) { st_table *freeing = st_init_numtable(); free_resolver(iface, freeing); st_free_table(freeing); } } static int avro_resolved_reader_reset(const avro_value_iface_t *viface, void *vself) { /* * To reset a wrapped value, we first clear out any wrappers, * and then have the wrapped value reset itself. */ int rval; avro_resolved_reader_t *iface = container_of(viface, avro_resolved_reader_t, parent); avro_value_t *self = (avro_value_t *) vself; check(rval, avro_resolved_reader_reset_wrappers(iface, vself)); return avro_value_reset(self); } static avro_type_t avro_resolved_reader_get_type(const avro_value_iface_t *viface, const void *vself) { AVRO_UNUSED(vself); const avro_resolved_reader_t *iface = container_of(viface, avro_resolved_reader_t, parent); return avro_typeof(iface->rschema); } static avro_schema_t avro_resolved_reader_get_schema(const avro_value_iface_t *viface, const void *vself) { AVRO_UNUSED(vself); avro_resolved_reader_t *iface = container_of(viface, avro_resolved_reader_t, parent); return iface->rschema; } static avro_resolved_reader_t * avro_resolved_reader_create(avro_schema_t wschema, avro_schema_t rschema) { avro_resolved_reader_t *self = (avro_resolved_reader_t *) avro_new(avro_resolved_reader_t); memset(self, 0, sizeof(avro_resolved_reader_t)); self->parent.incref_iface = avro_resolved_reader_incref_iface; self->parent.decref_iface = avro_resolved_reader_decref_iface; self->parent.incref = avro_resolved_reader_incref; self->parent.decref = avro_resolved_reader_decref; self->parent.reset = avro_resolved_reader_reset; self->parent.get_type = avro_resolved_reader_get_type; self->parent.get_schema = avro_resolved_reader_get_schema; self->refcount = 1; self->wschema = avro_schema_incref(wschema); self->rschema = avro_schema_incref(rschema); self->calculate_size = avro_resolved_reader_calculate_size_; self->free_iface = avro_resolved_reader_free_iface; self->reset_wrappers = NULL; return self; } /*----------------------------------------------------------------------- * Memoized resolvers */ typedef struct avro_resolved_link_reader avro_resolved_link_reader_t; typedef struct memoize_state_t { avro_memoize_t mem; avro_resolved_link_reader_t *links; } memoize_state_t; static avro_resolved_reader_t * avro_resolved_reader_new_memoized(memoize_state_t *state, avro_schema_t wschema, avro_schema_t rschema); /*----------------------------------------------------------------------- * Recursive schemas */ /* * Recursive schemas are handled specially; the value implementation for * an AVRO_LINK schema is simply a wrapper around the value * implementation for the link's target schema. The value methods all * delegate to the wrapped implementation. * * Complicating the links here is that we might be linking to the writer * schema or the reader schema. This only matters for a couple of * methods, so instead of keeping a boolean flag in the value interface, * we just have separate method implementations that we slot in * appropriately. */ struct avro_resolved_link_reader { avro_resolved_reader_t parent; /** * A pointer to the “next” link resolver that we've had to * create. We use this as we're creating the overall top-level * resolver to keep track of which ones we have to fix up * afterwards. */ avro_resolved_link_reader_t *next; /** The target's implementation. */ avro_resolved_reader_t *target_resolver; }; typedef struct avro_resolved_link_value { avro_value_t wrapped; avro_value_t target; } avro_resolved_link_value_t; static void avro_resolved_wlink_reader_calculate_size(avro_resolved_reader_t *iface) { /* Only calculate the size for any resolver once */ iface->calculate_size = NULL; AVRO_DEBUG("Calculating size for [%s]->%s", avro_schema_type_name((iface)->wschema), avro_schema_type_name((iface)->rschema)); iface->instance_size = sizeof(avro_resolved_link_value_t); } static void avro_resolved_rlink_reader_calculate_size(avro_resolved_reader_t *iface) { /* Only calculate the size for any resolver once */ iface->calculate_size = NULL; AVRO_DEBUG("Calculating size for %s->[%s]", avro_schema_type_name((iface)->wschema), avro_schema_type_name((iface)->rschema)); iface->instance_size = sizeof(avro_resolved_link_value_t); } static void avro_resolved_link_reader_free_iface(avro_resolved_reader_t *iface, st_table *freeing) { avro_resolved_link_reader_t *liface = container_of(iface, avro_resolved_link_reader_t, parent); if (liface->target_resolver != NULL) { free_resolver(liface->target_resolver, freeing); } avro_schema_decref(iface->wschema); avro_schema_decref(iface->rschema); avro_freet(avro_resolved_link_reader_t, iface); } static int avro_resolved_link_reader_init(const avro_resolved_reader_t *iface, void *vself) { int rval; const avro_resolved_link_reader_t *liface = container_of(iface, avro_resolved_link_reader_t, parent); avro_resolved_link_value_t *self = (avro_resolved_link_value_t *) vself; size_t target_instance_size = liface->target_resolver->instance_size; self->target.iface = &liface->target_resolver->parent; self->target.self = avro_malloc(target_instance_size); if (self->target.self == NULL) { return ENOMEM; } AVRO_DEBUG("Allocated <%p:%" PRIsz "> for link", self->target.self, target_instance_size); avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; rval = avro_resolved_reader_init(liface->target_resolver, self->target.self); if (rval != 0) { avro_free(self->target.self, target_instance_size); } return rval; } static void avro_resolved_link_reader_done(const avro_resolved_reader_t *iface, void *vself) { const avro_resolved_link_reader_t *liface = container_of(iface, avro_resolved_link_reader_t, parent); avro_resolved_link_value_t *self = (avro_resolved_link_value_t *) vself; size_t target_instance_size = liface->target_resolver->instance_size; AVRO_DEBUG("Freeing <%p:%" PRIsz "> for link", self->target.self, target_instance_size); avro_resolved_reader_done(liface->target_resolver, self->target.self); avro_free(self->target.self, target_instance_size); self->target.iface = NULL; self->target.self = NULL; } static int avro_resolved_link_reader_reset(const avro_resolved_reader_t *iface, void *vself) { const avro_resolved_link_reader_t *liface = container_of(iface, avro_resolved_link_reader_t, parent); avro_resolved_link_value_t *self = (avro_resolved_link_value_t *) vself; return avro_resolved_reader_reset_wrappers (liface->target_resolver, self->target.self); } static avro_type_t avro_resolved_link_reader_get_type(const avro_value_iface_t *iface, const void *vself) { AVRO_UNUSED(iface); const avro_resolved_link_value_t *self = (const avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_get_type(&self->target); } static avro_schema_t avro_resolved_link_reader_get_schema(const avro_value_iface_t *iface, const void *vself) { AVRO_UNUSED(iface); const avro_resolved_link_value_t *self = (const avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_get_schema(&self->target); } static int avro_resolved_link_reader_get_boolean(const avro_value_iface_t *iface, const void *vself, int *out) { AVRO_UNUSED(iface); const avro_resolved_link_value_t *self = (const avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_get_boolean(&self->target, out); } static int avro_resolved_link_reader_get_bytes(const avro_value_iface_t *iface, const void *vself, const void **buf, size_t *size) { AVRO_UNUSED(iface); const avro_resolved_link_value_t *self = (const avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_get_bytes(&self->target, buf, size); } static int avro_resolved_link_reader_grab_bytes(const avro_value_iface_t *iface, const void *vself, avro_wrapped_buffer_t *dest) { AVRO_UNUSED(iface); const avro_resolved_link_value_t *self = (const avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_grab_bytes(&self->target, dest); } static int avro_resolved_link_reader_get_double(const avro_value_iface_t *iface, const void *vself, double *out) { AVRO_UNUSED(iface); const avro_resolved_link_value_t *self = (const avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_get_double(&self->target, out); } static int avro_resolved_link_reader_get_float(const avro_value_iface_t *iface, const void *vself, float *out) { AVRO_UNUSED(iface); const avro_resolved_link_value_t *self = (const avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_get_float(&self->target, out); } static int avro_resolved_link_reader_get_int(const avro_value_iface_t *iface, const void *vself, int32_t *out) { AVRO_UNUSED(iface); const avro_resolved_link_value_t *self = (const avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_get_int(&self->target, out); } static int avro_resolved_link_reader_get_long(const avro_value_iface_t *iface, const void *vself, int64_t *out) { AVRO_UNUSED(iface); const avro_resolved_link_value_t *self = (const avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_get_long(&self->target, out); } static int avro_resolved_link_reader_get_null(const avro_value_iface_t *iface, const void *vself) { AVRO_UNUSED(iface); const avro_resolved_link_value_t *self = (const avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_get_null(&self->target); } static int avro_resolved_link_reader_get_string(const avro_value_iface_t *iface, const void *vself, const char **str, size_t *size) { AVRO_UNUSED(iface); const avro_resolved_link_value_t *self = (const avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_get_string(&self->target, str, size); } static int avro_resolved_link_reader_grab_string(const avro_value_iface_t *iface, const void *vself, avro_wrapped_buffer_t *dest) { AVRO_UNUSED(iface); const avro_resolved_link_value_t *self = (const avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_grab_string(&self->target, dest); } static int avro_resolved_link_reader_get_enum(const avro_value_iface_t *iface, const void *vself, int *out) { AVRO_UNUSED(iface); const avro_resolved_link_value_t *self = (const avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_get_enum(&self->target, out); } static int avro_resolved_link_reader_get_fixed(const avro_value_iface_t *iface, const void *vself, const void **buf, size_t *size) { AVRO_UNUSED(iface); const avro_resolved_link_value_t *self = (const avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_get_fixed(&self->target, buf, size); } static int avro_resolved_link_reader_grab_fixed(const avro_value_iface_t *iface, const void *vself, avro_wrapped_buffer_t *dest) { AVRO_UNUSED(iface); const avro_resolved_link_value_t *self = (const avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_grab_fixed(&self->target, dest); } static int avro_resolved_link_reader_set_boolean(const avro_value_iface_t *iface, void *vself, int val) { AVRO_UNUSED(iface); avro_resolved_link_value_t *self = (avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_set_boolean(&self->target, val); } static int avro_resolved_link_reader_set_bytes(const avro_value_iface_t *iface, void *vself, void *buf, size_t size) { AVRO_UNUSED(iface); avro_resolved_link_value_t *self = (avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_set_bytes(&self->target, buf, size); } static int avro_resolved_link_reader_give_bytes(const avro_value_iface_t *iface, void *vself, avro_wrapped_buffer_t *buf) { AVRO_UNUSED(iface); avro_resolved_link_value_t *self = (avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_give_bytes(&self->target, buf); } static int avro_resolved_link_reader_set_double(const avro_value_iface_t *iface, void *vself, double val) { AVRO_UNUSED(iface); avro_resolved_link_value_t *self = (avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_set_double(&self->target, val); } static int avro_resolved_link_reader_set_float(const avro_value_iface_t *iface, void *vself, float val) { AVRO_UNUSED(iface); avro_resolved_link_value_t *self = (avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_set_float(&self->target, val); } static int avro_resolved_link_reader_set_int(const avro_value_iface_t *iface, void *vself, int32_t val) { AVRO_UNUSED(iface); avro_resolved_link_value_t *self = (avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_set_int(&self->target, val); } static int avro_resolved_link_reader_set_long(const avro_value_iface_t *iface, void *vself, int64_t val) { AVRO_UNUSED(iface); avro_resolved_link_value_t *self = (avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_set_long(&self->target, val); } static int avro_resolved_link_reader_set_null(const avro_value_iface_t *iface, void *vself) { AVRO_UNUSED(iface); avro_resolved_link_value_t *self = (avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_set_null(&self->target); } static int avro_resolved_link_reader_set_string(const avro_value_iface_t *iface, void *vself, const char *str) { AVRO_UNUSED(iface); avro_resolved_link_value_t *self = (avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_set_string(&self->target, str); } static int avro_resolved_link_reader_set_string_len(const avro_value_iface_t *iface, void *vself, const char *str, size_t size) { AVRO_UNUSED(iface); avro_resolved_link_value_t *self = (avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_set_string_len(&self->target, str, size); } static int avro_resolved_link_reader_give_string_len(const avro_value_iface_t *iface, void *vself, avro_wrapped_buffer_t *buf) { AVRO_UNUSED(iface); avro_resolved_link_value_t *self = (avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_give_string_len(&self->target, buf); } static int avro_resolved_link_reader_set_enum(const avro_value_iface_t *iface, void *vself, int val) { AVRO_UNUSED(iface); avro_resolved_link_value_t *self = (avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_set_enum(&self->target, val); } static int avro_resolved_link_reader_set_fixed(const avro_value_iface_t *iface, void *vself, void *buf, size_t size) { AVRO_UNUSED(iface); avro_resolved_link_value_t *self = (avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_set_fixed(&self->target, buf, size); } static int avro_resolved_link_reader_give_fixed(const avro_value_iface_t *iface, void *vself, avro_wrapped_buffer_t *buf) { AVRO_UNUSED(iface); avro_resolved_link_value_t *self = (avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_give_fixed(&self->target, buf); } static int avro_resolved_link_reader_get_size(const avro_value_iface_t *iface, const void *vself, size_t *size) { AVRO_UNUSED(iface); const avro_resolved_link_value_t *self = (const avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_get_size(&self->target, size); } static int avro_resolved_link_reader_get_by_index(const avro_value_iface_t *iface, const void *vself, size_t index, avro_value_t *child, const char **name) { AVRO_UNUSED(iface); const avro_resolved_link_value_t *self = (const avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_get_by_index(&self->target, index, child, name); } static int avro_resolved_link_reader_get_by_name(const avro_value_iface_t *iface, const void *vself, const char *name, avro_value_t *child, size_t *index) { AVRO_UNUSED(iface); const avro_resolved_link_value_t *self = (const avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_get_by_name(&self->target, name, child, index); } static int avro_resolved_link_reader_get_discriminant(const avro_value_iface_t *iface, const void *vself, int *out) { AVRO_UNUSED(iface); const avro_resolved_link_value_t *self = (const avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_get_discriminant(&self->target, out); } static int avro_resolved_link_reader_get_current_branch(const avro_value_iface_t *iface, const void *vself, avro_value_t *branch) { AVRO_UNUSED(iface); const avro_resolved_link_value_t *self = (const avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_get_current_branch(&self->target, branch); } static int avro_resolved_link_reader_append(const avro_value_iface_t *iface, void *vself, avro_value_t *child_out, size_t *new_index) { AVRO_UNUSED(iface); avro_resolved_link_value_t *self = (avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_append(&self->target, child_out, new_index); } static int avro_resolved_link_reader_add(const avro_value_iface_t *iface, void *vself, const char *key, avro_value_t *child, size_t *index, int *is_new) { AVRO_UNUSED(iface); avro_resolved_link_value_t *self = (avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_add(&self->target, key, child, index, is_new); } static int avro_resolved_link_reader_set_branch(const avro_value_iface_t *iface, void *vself, int discriminant, avro_value_t *branch) { AVRO_UNUSED(iface); avro_resolved_link_value_t *self = (avro_resolved_link_value_t *) vself; avro_value_t *target_vself = (avro_value_t *) self->target.self; *target_vself = self->wrapped; return avro_value_set_branch(&self->target, discriminant, branch); } static avro_resolved_link_reader_t * avro_resolved_link_reader_create(avro_schema_t wschema, avro_schema_t rschema) { avro_resolved_reader_t *self = (avro_resolved_reader_t *) avro_new(avro_resolved_link_reader_t); memset(self, 0, sizeof(avro_resolved_link_reader_t)); self->parent.incref_iface = avro_resolved_reader_incref_iface; self->parent.decref_iface = avro_resolved_reader_decref_iface; self->parent.incref = avro_resolved_reader_incref; self->parent.decref = avro_resolved_reader_decref; self->parent.reset = avro_resolved_reader_reset; self->parent.get_type = avro_resolved_link_reader_get_type; self->parent.get_schema = avro_resolved_link_reader_get_schema; self->parent.get_size = avro_resolved_link_reader_get_size; self->parent.get_by_index = avro_resolved_link_reader_get_by_index; self->parent.get_by_name = avro_resolved_link_reader_get_by_name; self->refcount = 1; self->wschema = avro_schema_incref(wschema); self->rschema = avro_schema_incref(rschema); self->free_iface = avro_resolved_link_reader_free_iface; self->init = avro_resolved_link_reader_init; self->done = avro_resolved_link_reader_done; self->reset_wrappers = avro_resolved_link_reader_reset; self->parent.get_boolean = avro_resolved_link_reader_get_boolean; self->parent.get_bytes = avro_resolved_link_reader_get_bytes; self->parent.grab_bytes = avro_resolved_link_reader_grab_bytes; self->parent.get_double = avro_resolved_link_reader_get_double; self->parent.get_float = avro_resolved_link_reader_get_float; self->parent.get_int = avro_resolved_link_reader_get_int; self->parent.get_long = avro_resolved_link_reader_get_long; self->parent.get_null = avro_resolved_link_reader_get_null; self->parent.get_string = avro_resolved_link_reader_get_string; self->parent.grab_string = avro_resolved_link_reader_grab_string; self->parent.get_enum = avro_resolved_link_reader_get_enum; self->parent.get_fixed = avro_resolved_link_reader_get_fixed; self->parent.grab_fixed = avro_resolved_link_reader_grab_fixed; self->parent.set_boolean = avro_resolved_link_reader_set_boolean; self->parent.set_bytes = avro_resolved_link_reader_set_bytes; self->parent.give_bytes = avro_resolved_link_reader_give_bytes; self->parent.set_double = avro_resolved_link_reader_set_double; self->parent.set_float = avro_resolved_link_reader_set_float; self->parent.set_int = avro_resolved_link_reader_set_int; self->parent.set_long = avro_resolved_link_reader_set_long; self->parent.set_null = avro_resolved_link_reader_set_null; self->parent.set_string = avro_resolved_link_reader_set_string; self->parent.set_string_len = avro_resolved_link_reader_set_string_len; self->parent.give_string_len = avro_resolved_link_reader_give_string_len; self->parent.set_enum = avro_resolved_link_reader_set_enum; self->parent.set_fixed = avro_resolved_link_reader_set_fixed; self->parent.give_fixed = avro_resolved_link_reader_give_fixed; self->parent.get_size = avro_resolved_link_reader_get_size; self->parent.get_by_index = avro_resolved_link_reader_get_by_index; self->parent.get_by_name = avro_resolved_link_reader_get_by_name; self->parent.get_discriminant = avro_resolved_link_reader_get_discriminant; self->parent.get_current_branch = avro_resolved_link_reader_get_current_branch; self->parent.append = avro_resolved_link_reader_append; self->parent.add = avro_resolved_link_reader_add; self->parent.set_branch = avro_resolved_link_reader_set_branch; return container_of(self, avro_resolved_link_reader_t, parent); } static avro_resolved_reader_t * try_wlink(memoize_state_t *state, avro_schema_t wschema, avro_schema_t rschema) { AVRO_UNUSED(rschema); /* * For link schemas, we create a special value implementation * that allocates space for its wrapped value at runtime. This * lets us handle recursive types without having to instantiate * in infinite-size value. */ avro_schema_t wtarget = avro_schema_link_target(wschema); avro_resolved_link_reader_t *lself = avro_resolved_link_reader_create(wtarget, rschema); avro_memoize_set(&state->mem, wschema, rschema, lself); avro_resolved_reader_t *target_resolver = avro_resolved_reader_new_memoized(state, wtarget, rschema); if (target_resolver == NULL) { avro_memoize_delete(&state->mem, wschema, rschema); avro_value_iface_decref(&lself->parent.parent); avro_prefix_error("Link target isn't compatible: "); AVRO_DEBUG("%s", avro_strerror()); return NULL; } lself->parent.calculate_size = avro_resolved_wlink_reader_calculate_size; lself->target_resolver = target_resolver; lself->next = state->links; state->links = lself; return &lself->parent; } static avro_resolved_reader_t * try_rlink(memoize_state_t *state, avro_schema_t wschema, avro_schema_t rschema) { AVRO_UNUSED(rschema); /* * For link schemas, we create a special value implementation * that allocates space for its wrapped value at runtime. This * lets us handle recursive types without having to instantiate * in infinite-size value. */ avro_schema_t rtarget = avro_schema_link_target(rschema); avro_resolved_link_reader_t *lself = avro_resolved_link_reader_create(wschema, rtarget); avro_memoize_set(&state->mem, wschema, rschema, lself); avro_resolved_reader_t *target_resolver = avro_resolved_reader_new_memoized(state, wschema, rtarget); if (target_resolver == NULL) { avro_memoize_delete(&state->mem, wschema, rschema); avro_value_iface_decref(&lself->parent.parent); avro_prefix_error("Link target isn't compatible: "); AVRO_DEBUG("%s", avro_strerror()); return NULL; } lself->parent.calculate_size = avro_resolved_rlink_reader_calculate_size; lself->target_resolver = target_resolver; lself->next = state->links; state->links = lself; return &lself->parent; } /*----------------------------------------------------------------------- * boolean */ static int avro_resolved_reader_get_boolean(const avro_value_iface_t *viface, const void *vself, int *val) { AVRO_UNUSED(viface); const avro_value_t *src = (const avro_value_t *) vself; AVRO_DEBUG("Getting boolean from %p", src->self); return avro_value_get_boolean(src, val); } static avro_resolved_reader_t * try_boolean(memoize_state_t *state, avro_schema_t wschema, avro_schema_t rschema) { if (is_avro_boolean(wschema)) { avro_resolved_reader_t *self = avro_resolved_reader_create(wschema, rschema); avro_memoize_set(&state->mem, wschema, rschema, self); self->parent.get_boolean = avro_resolved_reader_get_boolean; return self; } avro_set_error("Writer %s not compatible with reader boolean", avro_schema_type_name(wschema)); return NULL; } /*----------------------------------------------------------------------- * bytes */ static int avro_resolved_reader_get_bytes(const avro_value_iface_t *viface, const void *vself, const void **buf, size_t *size) { AVRO_UNUSED(viface); const avro_value_t *src = (const avro_value_t *) vself; AVRO_DEBUG("Getting bytes from %p", src->self); return avro_value_get_bytes(src, buf, size); } static int avro_resolved_reader_grab_bytes(const avro_value_iface_t *viface, const void *vself, avro_wrapped_buffer_t *dest) { AVRO_UNUSED(viface); const avro_value_t *src = (const avro_value_t *) vself; AVRO_DEBUG("Grabbing bytes from %p", src->self); return avro_value_grab_bytes(src, dest); } static avro_resolved_reader_t * try_bytes(memoize_state_t *state, avro_schema_t wschema, avro_schema_t rschema) { if (is_avro_bytes(wschema)) { avro_resolved_reader_t *self = avro_resolved_reader_create(wschema, rschema); avro_memoize_set(&state->mem, wschema, rschema, self); self->parent.get_bytes = avro_resolved_reader_get_bytes; self->parent.grab_bytes = avro_resolved_reader_grab_bytes; return self; } avro_set_error("Writer %s not compatible with reader bytes", avro_schema_type_name(wschema)); return NULL; } /*----------------------------------------------------------------------- * double */ static int avro_resolved_reader_get_double(const avro_value_iface_t *viface, const void *vself, double *val) { AVRO_UNUSED(viface); const avro_value_t *src = (const avro_value_t *) vself; AVRO_DEBUG("Getting double from %p", src->self); return avro_value_get_double(src, val); } static int avro_resolved_reader_get_double_float(const avro_value_iface_t *viface, const void *vself, double *val) { int rval; float real_val; AVRO_UNUSED(viface); const avro_value_t *src = (const avro_value_t *) vself; AVRO_DEBUG("Promoting double from float %p", src->self); check(rval, avro_value_get_float(src, &real_val)); *val = real_val; return 0; } static int avro_resolved_reader_get_double_int(const avro_value_iface_t *viface, const void *vself, double *val) { int rval; int32_t real_val; AVRO_UNUSED(viface); const avro_value_t *src = (const avro_value_t *) vself; AVRO_DEBUG("Promoting double from int %p", src->self); check(rval, avro_value_get_int(src, &real_val)); *val = real_val; return 0; } static int avro_resolved_reader_get_double_long(const avro_value_iface_t *viface, const void *vself, double *val) { int rval; int64_t real_val; AVRO_UNUSED(viface); const avro_value_t *src = (const avro_value_t *) vself; AVRO_DEBUG("Promoting double from long %p", src->self); check(rval, avro_value_get_long(src, &real_val)); *val = (double) real_val; return 0; } static avro_resolved_reader_t * try_double(memoize_state_t *state, avro_schema_t wschema, avro_schema_t rschema) { if (is_avro_double(wschema)) { avro_resolved_reader_t *self = avro_resolved_reader_create(wschema, rschema); avro_memoize_set(&state->mem, wschema, rschema, self); self->parent.get_double = avro_resolved_reader_get_double; return self; } else if (is_avro_float(wschema)) { avro_resolved_reader_t *self = avro_resolved_reader_create(wschema, rschema); avro_memoize_set(&state->mem, wschema, rschema, self); self->parent.get_double = avro_resolved_reader_get_double_float; return self; } else if (is_avro_int32(wschema)) { avro_resolved_reader_t *self = avro_resolved_reader_create(wschema, rschema); avro_memoize_set(&state->mem, wschema, rschema, self); self->parent.get_double = avro_resolved_reader_get_double_int; return self; } else if (is_avro_int64(wschema)) { avro_resolved_reader_t *self = avro_resolved_reader_create(wschema, rschema); avro_memoize_set(&state->mem, wschema, rschema, self); self->parent.get_double = avro_resolved_reader_get_double_long; return self; } avro_set_error("Writer %s not compatible with reader double", avro_schema_type_name(wschema)); return NULL; } /*----------------------------------------------------------------------- * float */ static int avro_resolved_reader_get_float(const avro_value_iface_t *viface, const void *vself, float *val) { AVRO_UNUSED(viface); const avro_value_t *src = (const avro_value_t *) vself; AVRO_DEBUG("Getting float from %p", src->self); return avro_value_get_float(src, val); } static int avro_resolved_reader_get_float_int(const avro_value_iface_t *viface, const void *vself, float *val) { int rval; int32_t real_val; AVRO_UNUSED(viface); const avro_value_t *src = (const avro_value_t *) vself; AVRO_DEBUG("Promoting float from int %p", src->self); check(rval, avro_value_get_int(src, &real_val)); *val = (float) real_val; return 0; } static int avro_resolved_reader_get_float_long(const avro_value_iface_t *viface, const void *vself, float *val) { int rval; int64_t real_val; AVRO_UNUSED(viface); const avro_value_t *src = (const avro_value_t *) vself; AVRO_DEBUG("Promoting float from long %p", src->self); check(rval, avro_value_get_long(src, &real_val)); *val = (float) real_val; return 0; } static avro_resolved_reader_t * try_float(memoize_state_t *state, avro_schema_t wschema, avro_schema_t rschema) { if (is_avro_float(wschema)) { avro_resolved_reader_t *self = avro_resolved_reader_create(wschema, rschema); avro_memoize_set(&state->mem, wschema, rschema, self); self->parent.get_float = avro_resolved_reader_get_float; return self; } else if (is_avro_int32(wschema)) { avro_resolved_reader_t *self = avro_resolved_reader_create(wschema, rschema); avro_memoize_set(&state->mem, wschema, rschema, self); self->parent.get_float = avro_resolved_reader_get_float_int; return self; } else if (is_avro_int64(wschema)) { avro_resolved_reader_t *self = avro_resolved_reader_create(wschema, rschema); avro_memoize_set(&state->mem, wschema, rschema, self); self->parent.get_float = avro_resolved_reader_get_float_long; return self; } avro_set_error("Writer %s not compatible with reader float", avro_schema_type_name(wschema)); return NULL; } /*----------------------------------------------------------------------- * int */ static int avro_resolved_reader_get_int(const avro_value_iface_t *viface, const void *vself, int32_t *val) { AVRO_UNUSED(viface); const avro_value_t *src = (const avro_value_t *) vself; AVRO_DEBUG("Getting int from %p", src->self); return avro_value_get_int(src, val); } static avro_resolved_reader_t * try_int(memoize_state_t *state, avro_schema_t wschema, avro_schema_t rschema) { if (is_avro_int32(wschema)) { avro_resolved_reader_t *self = avro_resolved_reader_create(wschema, rschema); avro_memoize_set(&state->mem, wschema, rschema, self); self->parent.get_int = avro_resolved_reader_get_int; return self; } avro_set_error("Writer %s not compatible with reader int", avro_schema_type_name(wschema)); return NULL; } /*----------------------------------------------------------------------- * long */ static int avro_resolved_reader_get_long(const avro_value_iface_t *viface, const void *vself, int64_t *val) { AVRO_UNUSED(viface); const avro_value_t *src = (const avro_value_t *) vself; AVRO_DEBUG("Getting long from %p", src->self); return avro_value_get_long(src, val); } static int avro_resolved_reader_get_long_int(const avro_value_iface_t *viface, const void *vself, int64_t *val) { int rval; int32_t real_val; AVRO_UNUSED(viface); const avro_value_t *src = (const avro_value_t *) vself; AVRO_DEBUG("Promoting long from int %p", src->self); check(rval, avro_value_get_int(src, &real_val)); *val = real_val; return 0; } static avro_resolved_reader_t * try_long(memoize_state_t *state, avro_schema_t wschema, avro_schema_t rschema) { if (is_avro_int64(wschema)) { avro_resolved_reader_t *self = avro_resolved_reader_create(wschema, rschema); avro_memoize_set(&state->mem, wschema, rschema, self); self->parent.get_long = avro_resolved_reader_get_long; return self; } else if (is_avro_int32(wschema)) { avro_resolved_reader_t *self = avro_resolved_reader_create(wschema, rschema); avro_memoize_set(&state->mem, wschema, rschema, self); self->parent.get_long = avro_resolved_reader_get_long_int; return self; } avro_set_error("Writer %s not compatible with reader long", avro_schema_type_name(wschema)); return NULL; } /*----------------------------------------------------------------------- * null */ static int avro_resolved_reader_get_null(const avro_value_iface_t *viface, const void *vself) { AVRO_UNUSED(viface); const avro_value_t *src = (const avro_value_t *) vself; AVRO_DEBUG("Getting null from %p", src->self); return avro_value_get_null(src); } static avro_resolved_reader_t * try_null(memoize_state_t *state, avro_schema_t wschema, avro_schema_t rschema) { if (is_avro_null(wschema)) { avro_resolved_reader_t *self = avro_resolved_reader_create(wschema, rschema); avro_memoize_set(&state->mem, wschema, rschema, self); self->parent.get_null = avro_resolved_reader_get_null; return self; } avro_set_error("Writer %s not compatible with reader null", avro_schema_type_name(wschema)); return NULL; } /*----------------------------------------------------------------------- * string */ static int avro_resolved_reader_get_string(const avro_value_iface_t *viface, const void *vself, const char **str, size_t *size) { AVRO_UNUSED(viface); const avro_value_t *src = (const avro_value_t *) vself; AVRO_DEBUG("Getting string from %p", src->self); return avro_value_get_string(src, str, size); } static int avro_resolved_reader_grab_string(const avro_value_iface_t *viface, const void *vself, avro_wrapped_buffer_t *dest) { AVRO_UNUSED(viface); const avro_value_t *src = (const avro_value_t *) vself; AVRO_DEBUG("Grabbing string from %p", src->self); return avro_value_grab_string(src, dest); } static avro_resolved_reader_t * try_string(memoize_state_t *state, avro_schema_t wschema, avro_schema_t rschema) { if (is_avro_string(wschema)) { avro_resolved_reader_t *self = avro_resolved_reader_create(wschema, rschema); avro_memoize_set(&state->mem, wschema, rschema, self); self->parent.get_string = avro_resolved_reader_get_string; self->parent.grab_string = avro_resolved_reader_grab_string; return self; } avro_set_error("Writer %s not compatible with reader string", avro_schema_type_name(wschema)); return NULL; } /*----------------------------------------------------------------------- * array */ typedef struct avro_resolved_array_reader { avro_resolved_reader_t parent; avro_resolved_reader_t *child_resolver; } avro_resolved_array_reader_t; typedef struct avro_resolved_array_value { avro_value_t wrapped; avro_raw_array_t children; } avro_resolved_array_value_t; static void avro_resolved_array_reader_calculate_size(avro_resolved_reader_t *iface) { avro_resolved_array_reader_t *aiface = container_of(iface, avro_resolved_array_reader_t, parent); /* Only calculate the size for any resolver once */ iface->calculate_size = NULL; AVRO_DEBUG("Calculating size for %s->%s", avro_schema_type_name((iface)->wschema), avro_schema_type_name((iface)->rschema)); iface->instance_size = sizeof(avro_resolved_array_value_t); avro_resolved_reader_calculate_size(aiface->child_resolver); } static void avro_resolved_array_reader_free_iface(avro_resolved_reader_t *iface, st_table *freeing) { avro_resolved_array_reader_t *aiface = container_of(iface, avro_resolved_array_reader_t, parent); free_resolver(aiface->child_resolver, freeing); avro_schema_decref(iface->wschema); avro_schema_decref(iface->rschema); avro_freet(avro_resolved_array_reader_t, iface); } static int avro_resolved_array_reader_init(const avro_resolved_reader_t *iface, void *vself) { const avro_resolved_array_reader_t *aiface = container_of(iface, avro_resolved_array_reader_t, parent); avro_resolved_array_value_t *self = (avro_resolved_array_value_t *) vself; size_t child_instance_size = aiface->child_resolver->instance_size; AVRO_DEBUG("Initializing child array (child_size=%" PRIsz ")", child_instance_size); avro_raw_array_init(&self->children, child_instance_size); return 0; } static void avro_resolved_array_reader_free_elements(const avro_resolved_reader_t *child_iface, avro_resolved_array_value_t *self) { size_t i; for (i = 0; i < avro_raw_array_size(&self->children); i++) { void *child_self = avro_raw_array_get_raw(&self->children, i); avro_resolved_reader_done(child_iface, child_self); } } static void avro_resolved_array_reader_done(const avro_resolved_reader_t *iface, void *vself) { const avro_resolved_array_reader_t *aiface = container_of(iface, avro_resolved_array_reader_t, parent); avro_resolved_array_value_t *self = (avro_resolved_array_value_t *) vself; avro_resolved_array_reader_free_elements(aiface->child_resolver, self); avro_raw_array_done(&self->children); } static int avro_resolved_array_reader_reset(const avro_resolved_reader_t *iface, void *vself) { const avro_resolved_array_reader_t *aiface = container_of(iface, avro_resolved_array_reader_t, parent); avro_resolved_array_value_t *self = (avro_resolved_array_value_t *) vself; /* Clear out our cache of wrapped children */ avro_resolved_array_reader_free_elements(aiface->child_resolver, self); avro_raw_array_clear(&self->children); return 0; } static int avro_resolved_array_reader_get_size(const avro_value_iface_t *viface, const void *vself, size_t *size) { AVRO_UNUSED(viface); const avro_resolved_array_value_t *self = (const avro_resolved_array_value_t *) vself; return avro_value_get_size(&self->wrapped, size); } static int avro_resolved_array_reader_get_by_index(const avro_value_iface_t *viface, const void *vself, size_t index, avro_value_t *child, const char **name) { int rval; size_t old_size; size_t new_size; const avro_resolved_reader_t *iface = container_of(viface, avro_resolved_reader_t, parent); const avro_resolved_array_reader_t *aiface = container_of(iface, avro_resolved_array_reader_t, parent); avro_resolved_array_value_t *self = (avro_resolved_array_value_t *) vself; /* * Ensure that our child wrapper array is big enough to hold * this many elements. */ new_size = index + 1; check(rval, avro_raw_array_ensure_size0(&self->children, new_size)); old_size = avro_raw_array_size(&self->children); if (old_size <= index) { size_t i; for (i = old_size; i < new_size; i++) { check(rval, avro_resolved_reader_init (aiface->child_resolver, avro_raw_array_get_raw(&self->children, i))); } avro_raw_array_size(&self->children) = index+1; } child->iface = &aiface->child_resolver->parent; child->self = avro_raw_array_get_raw(&self->children, index); AVRO_DEBUG("Getting element %" PRIsz " from array %p", index, self->wrapped.self); return avro_value_get_by_index(&self->wrapped, index, (avro_value_t *) child->self, name); } static avro_resolved_array_reader_t * avro_resolved_array_reader_create(avro_schema_t wschema, avro_schema_t rschema) { avro_resolved_reader_t *self = (avro_resolved_reader_t *) avro_new(avro_resolved_array_reader_t); memset(self, 0, sizeof(avro_resolved_array_reader_t)); self->parent.incref_iface = avro_resolved_reader_incref_iface; self->parent.decref_iface = avro_resolved_reader_decref_iface; self->parent.incref = avro_resolved_reader_incref; self->parent.decref = avro_resolved_reader_decref; self->parent.reset = avro_resolved_reader_reset; self->parent.get_type = avro_resolved_reader_get_type; self->parent.get_schema = avro_resolved_reader_get_schema; self->parent.get_size = avro_resolved_array_reader_get_size; self->parent.get_by_index = avro_resolved_array_reader_get_by_index; self->refcount = 1; self->wschema = avro_schema_incref(wschema); self->rschema = avro_schema_incref(rschema); self->calculate_size = avro_resolved_array_reader_calculate_size; self->free_iface = avro_resolved_array_reader_free_iface; self->init = avro_resolved_array_reader_init; self->done = avro_resolved_array_reader_done; self->reset_wrappers = avro_resolved_array_reader_reset; return container_of(self, avro_resolved_array_reader_t, parent); } static avro_resolved_reader_t * try_array(memoize_state_t *state, avro_schema_t wschema, avro_schema_t rschema) { /* * First verify that the writer is an array. */ if (!is_avro_array(wschema)) { return 0; } /* * Array schemas have to have compatible element schemas to be * compatible themselves. Try to create an resolver to check * the compatibility. */ avro_resolved_array_reader_t *aself = avro_resolved_array_reader_create(wschema, rschema); avro_memoize_set(&state->mem, wschema, rschema, aself); avro_schema_t witems = avro_schema_array_items(wschema); avro_schema_t ritems = avro_schema_array_items(rschema); avro_resolved_reader_t *item_resolver = avro_resolved_reader_new_memoized(state, witems, ritems); if (item_resolver == NULL) { avro_memoize_delete(&state->mem, wschema, rschema); avro_value_iface_decref(&aself->parent.parent); avro_prefix_error("Array values aren't compatible: "); return NULL; } /* * The two schemas are compatible. Store the item schema's * resolver into the child_resolver field. */ aself->child_resolver = item_resolver; return &aself->parent; } /*----------------------------------------------------------------------- * enum */ static int avro_resolved_reader_get_enum(const avro_value_iface_t *viface, const void *vself, int *val) { AVRO_UNUSED(viface); const avro_value_t *src = (const avro_value_t *) vself; AVRO_DEBUG("Getting enum from %p", src->self); return avro_value_get_enum(src, val); } static avro_resolved_reader_t * try_enum(memoize_state_t *state, avro_schema_t wschema, avro_schema_t rschema) { /* * Enum schemas have to have the same name — but not the same * list of symbols — to be compatible. */ if (is_avro_enum(wschema)) { const char *wname = avro_schema_name(wschema); const char *rname = avro_schema_name(rschema); if (strcmp(wname, rname) == 0) { avro_resolved_reader_t *self = avro_resolved_reader_create(wschema, rschema); avro_memoize_set(&state->mem, wschema, rschema, self); self->parent.get_enum = avro_resolved_reader_get_enum; return self; } } avro_set_error("Writer %s not compatible with reader %s", avro_schema_type_name(wschema), avro_schema_type_name(rschema)); return NULL; } /*----------------------------------------------------------------------- * fixed */ static int avro_resolved_reader_get_fixed(const avro_value_iface_t *viface, const void *vself, const void **buf, size_t *size) { AVRO_UNUSED(viface); const avro_value_t *src = (const avro_value_t *) vself; AVRO_DEBUG("Getting fixed from %p", vself); return avro_value_get_fixed(src, buf, size); } static int avro_resolved_reader_grab_fixed(const avro_value_iface_t *viface, const void *vself, avro_wrapped_buffer_t *dest) { AVRO_UNUSED(viface); const avro_value_t *src = (const avro_value_t *) vself; AVRO_DEBUG("Grabbing fixed from %p", vself); return avro_value_grab_fixed(src, dest); } static avro_resolved_reader_t * try_fixed(memoize_state_t *state, avro_schema_t wschema, avro_schema_t rschema) { /* * Fixed schemas need the same name and size to be compatible. */ if (avro_schema_equal(wschema, rschema)) { avro_resolved_reader_t *self = avro_resolved_reader_create(wschema, rschema); avro_memoize_set(&state->mem, wschema, rschema, self); self->parent.get_fixed = avro_resolved_reader_get_fixed; self->parent.grab_fixed = avro_resolved_reader_grab_fixed; return self; } avro_set_error("Writer %s not compatible with reader %s", avro_schema_type_name(wschema), avro_schema_type_name(rschema)); return NULL; } /*----------------------------------------------------------------------- * map */ typedef struct avro_resolved_map_reader { avro_resolved_reader_t parent; avro_resolved_reader_t *child_resolver; } avro_resolved_map_reader_t; typedef struct avro_resolved_map_value { avro_value_t wrapped; avro_raw_array_t children; } avro_resolved_map_value_t; static void avro_resolved_map_reader_calculate_size(avro_resolved_reader_t *iface) { avro_resolved_map_reader_t *miface = container_of(iface, avro_resolved_map_reader_t, parent); /* Only calculate the size for any resolver once */ iface->calculate_size = NULL; AVRO_DEBUG("Calculating size for %s->%s", avro_schema_type_name((iface)->wschema), avro_schema_type_name((iface)->rschema)); iface->instance_size = sizeof(avro_resolved_map_value_t); avro_resolved_reader_calculate_size(miface->child_resolver); } static void avro_resolved_map_reader_free_iface(avro_resolved_reader_t *iface, st_table *freeing) { avro_resolved_map_reader_t *miface = container_of(iface, avro_resolved_map_reader_t, parent); free_resolver(miface->child_resolver, freeing); avro_schema_decref(iface->wschema); avro_schema_decref(iface->rschema); avro_freet(avro_resolved_map_reader_t, iface); } static int avro_resolved_map_reader_init(const avro_resolved_reader_t *iface, void *vself) { const avro_resolved_map_reader_t *miface = container_of(iface, avro_resolved_map_reader_t, parent); avro_resolved_map_value_t *self = (avro_resolved_map_value_t *) vself; size_t child_instance_size = miface->child_resolver->instance_size; AVRO_DEBUG("Initializing child array for map (child_size=%" PRIsz ")", child_instance_size); avro_raw_array_init(&self->children, child_instance_size); return 0; } static void avro_resolved_map_reader_free_elements(const avro_resolved_reader_t *child_iface, avro_resolved_map_value_t *self) { size_t i; for (i = 0; i < avro_raw_array_size(&self->children); i++) { void *child_self = avro_raw_array_get_raw(&self->children, i); avro_resolved_reader_done(child_iface, child_self); } } static void avro_resolved_map_reader_done(const avro_resolved_reader_t *iface, void *vself) { const avro_resolved_map_reader_t *miface = container_of(iface, avro_resolved_map_reader_t, parent); avro_resolved_map_value_t *self = (avro_resolved_map_value_t *) vself; avro_resolved_map_reader_free_elements(miface->child_resolver, self); avro_raw_array_done(&self->children); } static int avro_resolved_map_reader_reset(const avro_resolved_reader_t *iface, void *vself) { const avro_resolved_map_reader_t *miface = container_of(iface, avro_resolved_map_reader_t, parent); avro_resolved_map_value_t *self = (avro_resolved_map_value_t *) vself; /* Clear out our cache of wrapped children */ avro_resolved_map_reader_free_elements(miface->child_resolver, self); return 0; } static int avro_resolved_map_reader_get_size(const avro_value_iface_t *viface, const void *vself, size_t *size) { AVRO_UNUSED(viface); const avro_value_t *src = (const avro_value_t *) vself; return avro_value_get_size(src, size); } static int avro_resolved_map_reader_get_by_index(const avro_value_iface_t *viface, const void *vself, size_t index, avro_value_t *child, const char **name) { int rval; const avro_resolved_reader_t *iface = container_of(viface, avro_resolved_reader_t, parent); const avro_resolved_map_reader_t *miface = container_of(iface, avro_resolved_map_reader_t, parent); avro_resolved_map_value_t *self = (avro_resolved_map_value_t *) vself; /* * Ensure that our child wrapper array is big enough to hold * this many elements. */ check(rval, avro_raw_array_ensure_size0(&self->children, index+1)); if (avro_raw_array_size(&self->children) <= index) { avro_raw_array_size(&self->children) = index+1; } child->iface = &miface->child_resolver->parent; child->self = avro_raw_array_get_raw(&self->children, index); AVRO_DEBUG("Getting element %" PRIsz " from map %p", index, self->wrapped.self); return avro_value_get_by_index(&self->wrapped, index, (avro_value_t *) child->self, name); } static int avro_resolved_map_reader_get_by_name(const avro_value_iface_t *viface, const void *vself, const char *name, avro_value_t *child, size_t *index) { int rval; const avro_resolved_reader_t *iface = container_of(viface, avro_resolved_reader_t, parent); const avro_resolved_map_reader_t *miface = container_of(iface, avro_resolved_map_reader_t, parent); avro_resolved_map_value_t *self = (avro_resolved_map_value_t *) vself; /* * This is a bit convoluted. We need to stash the wrapped child * value somewhere in our children array. But we don't know * where to put it until the wrapped map tells us what its index * is. */ avro_value_t real_child; size_t real_index; AVRO_DEBUG("Getting element %s from map %p", name, self->wrapped.self); check(rval, avro_value_get_by_name (&self->wrapped, name, &real_child, &real_index)); /* * Ensure that our child wrapper array is big enough to hold * this many elements. */ check(rval, avro_raw_array_ensure_size0(&self->children, real_index+1)); if (avro_raw_array_size(&self->children) <= real_index) { avro_raw_array_size(&self->children) = real_index+1; } child->iface = &miface->child_resolver->parent; child->self = avro_raw_array_get_raw(&self->children, real_index); avro_value_t *child_vself = (avro_value_t *) child->self; *child_vself = real_child; if (index != NULL) { *index = real_index; } return 0; } static avro_resolved_map_reader_t * avro_resolved_map_reader_create(avro_schema_t wschema, avro_schema_t rschema) { avro_resolved_reader_t *self = (avro_resolved_reader_t *) avro_new(avro_resolved_map_reader_t); memset(self, 0, sizeof(avro_resolved_map_reader_t)); self->parent.incref_iface = avro_resolved_reader_incref_iface; self->parent.decref_iface = avro_resolved_reader_decref_iface; self->parent.incref = avro_resolved_reader_incref; self->parent.decref = avro_resolved_reader_decref; self->parent.reset = avro_resolved_reader_reset; self->parent.get_type = avro_resolved_reader_get_type; self->parent.get_schema = avro_resolved_reader_get_schema; self->parent.get_size = avro_resolved_map_reader_get_size; self->parent.get_by_index = avro_resolved_map_reader_get_by_index; self->parent.get_by_name = avro_resolved_map_reader_get_by_name; self->refcount = 1; self->wschema = avro_schema_incref(wschema); self->rschema = avro_schema_incref(rschema); self->calculate_size = avro_resolved_map_reader_calculate_size; self->free_iface = avro_resolved_map_reader_free_iface; self->init = avro_resolved_map_reader_init; self->done = avro_resolved_map_reader_done; self->reset_wrappers = avro_resolved_map_reader_reset; return container_of(self, avro_resolved_map_reader_t, parent); } static avro_resolved_reader_t * try_map(memoize_state_t *state, avro_schema_t wschema, avro_schema_t rschema) { /* * First verify that the reader is an map. */ if (!is_avro_map(wschema)) { return 0; } /* * Map schemas have to have compatible element schemas to be * compatible themselves. Try to create an resolver to check * the compatibility. */ avro_resolved_map_reader_t *mself = avro_resolved_map_reader_create(wschema, rschema); avro_memoize_set(&state->mem, wschema, rschema, mself); avro_schema_t witems = avro_schema_map_values(wschema); avro_schema_t ritems = avro_schema_map_values(rschema); avro_resolved_reader_t *item_resolver = avro_resolved_reader_new_memoized(state, witems, ritems); if (item_resolver == NULL) { avro_memoize_delete(&state->mem, wschema, rschema); avro_value_iface_decref(&mself->parent.parent); avro_prefix_error("Map values aren't compatible: "); return NULL; } /* * The two schemas are compatible. Store the item schema's * resolver into the child_resolver field. */ mself->child_resolver = item_resolver; return &mself->parent; } /*----------------------------------------------------------------------- * record */ typedef struct avro_resolved_record_reader { avro_resolved_reader_t parent; size_t field_count; size_t *field_offsets; avro_resolved_reader_t **field_resolvers; size_t *index_mapping; } avro_resolved_record_reader_t; typedef struct avro_resolved_record_value { avro_value_t wrapped; /* The rest of the struct is taken up by the inline storage * needed for each field. */ } avro_resolved_record_value_t; /** Return a pointer to the given field within a record struct. */ #define avro_resolved_record_field(iface, rec, index) \ (((char *) (rec)) + (iface)->field_offsets[(index)]) static void avro_resolved_record_reader_calculate_size(avro_resolved_reader_t *iface) { avro_resolved_record_reader_t *riface = container_of(iface, avro_resolved_record_reader_t, parent); /* Only calculate the size for any resolver once */ iface->calculate_size = NULL; AVRO_DEBUG("Calculating size for %s->%s", avro_schema_type_name((iface)->wschema), avro_schema_type_name((iface)->rschema)); /* * Once we've figured out which reader fields we actually need, * calculate an offset for each one. */ size_t ri; size_t next_offset = sizeof(avro_resolved_record_value_t); for (ri = 0; ri < riface->field_count; ri++) { riface->field_offsets[ri] = next_offset; if (riface->field_resolvers[ri] != NULL) { avro_resolved_reader_calculate_size (riface->field_resolvers[ri]); size_t field_size = riface->field_resolvers[ri]->instance_size; AVRO_DEBUG("Field %" PRIsz " has size %" PRIsz, ri, field_size); next_offset += field_size; } else { AVRO_DEBUG("Field %" PRIsz " is being skipped", ri); } } AVRO_DEBUG("Record has size %" PRIsz, next_offset); iface->instance_size = next_offset; } static void avro_resolved_record_reader_free_iface(avro_resolved_reader_t *iface, st_table *freeing) { avro_resolved_record_reader_t *riface = container_of(iface, avro_resolved_record_reader_t, parent); if (riface->field_offsets != NULL) { avro_free(riface->field_offsets, riface->field_count * sizeof(size_t)); } if (riface->field_resolvers != NULL) { size_t i; for (i = 0; i < riface->field_count; i++) { if (riface->field_resolvers[i] != NULL) { AVRO_DEBUG("Freeing field %" PRIsz " %p", i, riface->field_resolvers[i]); free_resolver(riface->field_resolvers[i], freeing); } } avro_free(riface->field_resolvers, riface->field_count * sizeof(avro_resolved_reader_t *)); } if (riface->index_mapping != NULL) { avro_free(riface->index_mapping, riface->field_count * sizeof(size_t)); } avro_schema_decref(iface->wschema); avro_schema_decref(iface->rschema); avro_freet(avro_resolved_record_reader_t, iface); } static int avro_resolved_record_reader_init(const avro_resolved_reader_t *iface, void *vself) { int rval; const avro_resolved_record_reader_t *riface = container_of(iface, avro_resolved_record_reader_t, parent); avro_resolved_record_value_t *self = (avro_resolved_record_value_t *) vself; /* Initialize each field */ size_t i; for (i = 0; i < riface->field_count; i++) { if (riface->field_resolvers[i] != NULL) { check(rval, avro_resolved_reader_init (riface->field_resolvers[i], avro_resolved_record_field(riface, self, i))); } } return 0; } static void avro_resolved_record_reader_done(const avro_resolved_reader_t *iface, void *vself) { const avro_resolved_record_reader_t *riface = container_of(iface, avro_resolved_record_reader_t, parent); avro_resolved_record_value_t *self = (avro_resolved_record_value_t *) vself; /* Finalize each field */ size_t i; for (i = 0; i < riface->field_count; i++) { if (riface->field_resolvers[i] != NULL) { avro_resolved_reader_done (riface->field_resolvers[i], avro_resolved_record_field(riface, self, i)); } } } static int avro_resolved_record_reader_reset(const avro_resolved_reader_t *iface, void *vself) { int rval; const avro_resolved_record_reader_t *riface = container_of(iface, avro_resolved_record_reader_t, parent); avro_resolved_record_value_t *self = (avro_resolved_record_value_t *) vself; /* Reset each field */ size_t i; for (i = 0; i < riface->field_count; i++) { if (riface->field_resolvers[i] != NULL) { check(rval, avro_resolved_reader_reset_wrappers (riface->field_resolvers[i], avro_resolved_record_field(riface, self, i))); } } return 0; } static int avro_resolved_record_reader_get_size(const avro_value_iface_t *viface, const void *vself, size_t *size) { AVRO_UNUSED(vself); const avro_resolved_reader_t *iface = container_of(viface, avro_resolved_reader_t, parent); const avro_resolved_record_reader_t *riface = container_of(iface, avro_resolved_record_reader_t, parent); *size = riface->field_count; return 0; } static int avro_resolved_record_reader_get_by_index(const avro_value_iface_t *viface, const void *vself, size_t index, avro_value_t *child, const char **name) { const avro_resolved_reader_t *iface = container_of(viface, avro_resolved_reader_t, parent); const avro_resolved_record_reader_t *riface = container_of(iface, avro_resolved_record_reader_t, parent); const avro_resolved_record_value_t *self = (avro_resolved_record_value_t *) vself; AVRO_DEBUG("Getting reader field %" PRIsz " from record %p", index, self->wrapped.self); if (riface->field_resolvers[index] == NULL) { /* * TODO: Return the default value if the writer record * doesn't contain this field. */ AVRO_DEBUG("Writer doesn't have field"); avro_set_error("NIY: Default values"); return EINVAL; } size_t writer_index = riface->index_mapping[index]; AVRO_DEBUG(" Writer field is %" PRIsz, writer_index); child->iface = &riface->field_resolvers[index]->parent; child->self = avro_resolved_record_field(riface, self, index); return avro_value_get_by_index(&self->wrapped, writer_index, (avro_value_t *) child->self, name); } static int avro_resolved_record_reader_get_by_name(const avro_value_iface_t *viface, const void *vself, const char *name, avro_value_t *child, size_t *index) { const avro_resolved_reader_t *iface = container_of(viface, avro_resolved_reader_t, parent); int ri = avro_schema_record_field_get_index(iface->rschema, name); if (ri == -1) { avro_set_error("Record doesn't have field named %s", name); return EINVAL; } AVRO_DEBUG("Reader field %s is at index %d", name, ri); if (index != NULL) { *index = ri; } return avro_resolved_record_reader_get_by_index(viface, vself, ri, child, NULL); } static avro_resolved_record_reader_t * avro_resolved_record_reader_create(avro_schema_t wschema, avro_schema_t rschema) { avro_resolved_reader_t *self = (avro_resolved_reader_t *) avro_new(avro_resolved_record_reader_t); memset(self, 0, sizeof(avro_resolved_record_reader_t)); self->parent.incref_iface = avro_resolved_reader_incref_iface; self->parent.decref_iface = avro_resolved_reader_decref_iface; self->parent.incref = avro_resolved_reader_incref; self->parent.decref = avro_resolved_reader_decref; self->parent.reset = avro_resolved_reader_reset; self->parent.get_type = avro_resolved_reader_get_type; self->parent.get_schema = avro_resolved_reader_get_schema; self->parent.get_size = avro_resolved_record_reader_get_size; self->parent.get_by_index = avro_resolved_record_reader_get_by_index; self->parent.get_by_name = avro_resolved_record_reader_get_by_name; self->refcount = 1; self->wschema = avro_schema_incref(wschema); self->rschema = avro_schema_incref(rschema); self->calculate_size = avro_resolved_record_reader_calculate_size; self->free_iface = avro_resolved_record_reader_free_iface; self->init = avro_resolved_record_reader_init; self->done = avro_resolved_record_reader_done; self->reset_wrappers = avro_resolved_record_reader_reset; return container_of(self, avro_resolved_record_reader_t, parent); } static avro_resolved_reader_t * try_record(memoize_state_t *state, avro_schema_t wschema, avro_schema_t rschema) { /* * First verify that the writer is also a record, and has the * same name as the reader. */ if (!is_avro_record(wschema)) { return 0; } const char *wname = avro_schema_name(wschema); const char *rname = avro_schema_name(rschema); if (strcmp(wname, rname) != 0) { return 0; } /* * Categorize the fields in the record schemas. Fields that are * only in the writer are ignored. Fields that are only in the * reader raise a schema mismatch error, unless the field has a * default value. Fields that are in both are resolved * recursively. * * The field_resolvers array will contain an avro_value_iface_t * for each field in the reader schema. To build this array, we * loop through the fields of the reader schema. If that field * is also in the writer schema, we resolve them recursively, * and store the resolver into the array. If the field isn't in * the writer schema, we raise an error. (TODO: Eventually, * we'll handle default values here.) After this loop finishes, * any NULLs in the field_resolvers array will represent fields * in the writer but not the reader; these fields should be * skipped, and won't be accessible in the resolved reader. */ avro_resolved_record_reader_t *rself = avro_resolved_record_reader_create(wschema, rschema); avro_memoize_set(&state->mem, wschema, rschema, rself); size_t rfields = avro_schema_record_size(rschema); AVRO_DEBUG("Checking reader record schema %s", wname); avro_resolved_reader_t **field_resolvers = (avro_resolved_reader_t **) avro_calloc(rfields, sizeof(avro_resolved_reader_t *)); size_t *field_offsets = (size_t *) avro_calloc(rfields, sizeof(size_t)); size_t *index_mapping = (size_t *) avro_calloc(rfields, sizeof(size_t)); size_t ri; for (ri = 0; ri < rfields; ri++) { avro_schema_t rfield = avro_schema_record_field_get_by_index(rschema, ri); const char *field_name = avro_schema_record_field_name(rschema, ri); AVRO_DEBUG("Resolving reader record field %" PRIsz " (%s)", ri, field_name); /* * See if this field is also in the writer schema. */ int wi = avro_schema_record_field_get_index(wschema, field_name); if (wi == -1) { /* * This field isn't in the writer schema — * that's an error! TODO: Handle default * values! */ AVRO_DEBUG("Field %s isn't in writer", field_name); avro_set_error("Reader field %s doesn't appear in writer", field_name); goto error; } /* * Try to recursively resolve the schemas for this * field. If they're not compatible, that's an error. */ avro_schema_t wfield = avro_schema_record_field_get_by_index(wschema, wi); avro_resolved_reader_t *field_resolver = avro_resolved_reader_new_memoized(state, wfield, rfield); if (field_resolver == NULL) { avro_prefix_error("Field %s isn't compatible: ", field_name); goto error; } /* * Save the details for this field. */ AVRO_DEBUG("Found match for field %s (%" PRIsz " in reader, %d in writer)", field_name, ri, wi); field_resolvers[ri] = field_resolver; index_mapping[ri] = wi; } /* * We might not have found matches for all of the writer fields, * but that's okay — any extras will be ignored. */ rself->field_count = rfields; rself->field_offsets = field_offsets; rself->field_resolvers = field_resolvers; rself->index_mapping = index_mapping; return &rself->parent; error: /* * Clean up any resolver we might have already created. */ avro_memoize_delete(&state->mem, wschema, rschema); avro_value_iface_decref(&rself->parent.parent); { unsigned int i; for (i = 0; i < rfields; i++) { if (field_resolvers[i]) { avro_value_iface_decref(&field_resolvers[i]->parent); } } } avro_free(field_resolvers, rfields * sizeof(avro_resolved_reader_t *)); avro_free(field_offsets, rfields * sizeof(size_t)); avro_free(index_mapping, rfields * sizeof(size_t)); return NULL; } /*----------------------------------------------------------------------- * writer union */ /* * For writer unions, we maintain a list of resolvers for each branch of * the union. When we encounter a writer value, we see which branch it * is, and choose a reader resolver based on that. */ typedef struct avro_resolved_wunion_reader { avro_resolved_reader_t parent; /* The number of branches in the writer union */ size_t branch_count; /* A child resolver for each branch of the writer union. If any * of these are NULL, then we don't have anything on the reader * side that's compatible with that writer branch. */ avro_resolved_reader_t **branch_resolvers; } avro_resolved_wunion_reader_t; typedef struct avro_resolved_wunion_value { avro_value_t wrapped; /** The currently active branch of the union. -1 if no branch * is selected. */ int discriminant; /* The rest of the struct is taken up by the inline storage * needed for the active branch. */ } avro_resolved_wunion_value_t; /** Return a pointer to the active branch within a union struct. */ #define avro_resolved_wunion_branch(_wunion) \ (((char *) (_wunion)) + sizeof(avro_resolved_wunion_value_t)) static void avro_resolved_wunion_reader_calculate_size(avro_resolved_reader_t *iface) { avro_resolved_wunion_reader_t *uiface = container_of(iface, avro_resolved_wunion_reader_t, parent); /* Only calculate the size for any resolver once */ iface->calculate_size = NULL; AVRO_DEBUG("Calculating size for %s->%s", avro_schema_type_name((iface)->wschema), avro_schema_type_name((iface)->rschema)); size_t i; size_t max_branch_size = 0; for (i = 0; i < uiface->branch_count; i++) { if (uiface->branch_resolvers[i] == NULL) { AVRO_DEBUG("No match for writer union branch %" PRIsz, i); } else { avro_resolved_reader_calculate_size (uiface->branch_resolvers[i]); size_t branch_size = uiface->branch_resolvers[i]->instance_size; AVRO_DEBUG("Writer branch %" PRIsz " has size %" PRIsz, i, branch_size); if (branch_size > max_branch_size) { max_branch_size = branch_size; } } } AVRO_DEBUG("Maximum branch size is %" PRIsz, max_branch_size); iface->instance_size = sizeof(avro_resolved_wunion_value_t) + max_branch_size; AVRO_DEBUG("Total union size is %" PRIsz, iface->instance_size); } static void avro_resolved_wunion_reader_free_iface(avro_resolved_reader_t *iface, st_table *freeing) { avro_resolved_wunion_reader_t *uiface = container_of(iface, avro_resolved_wunion_reader_t, parent); if (uiface->branch_resolvers != NULL) { size_t i; for (i = 0; i < uiface->branch_count; i++) { if (uiface->branch_resolvers[i] != NULL) { free_resolver(uiface->branch_resolvers[i], freeing); } } avro_free(uiface->branch_resolvers, uiface->branch_count * sizeof(avro_resolved_reader_t *)); } avro_schema_decref(iface->wschema); avro_schema_decref(iface->rschema); avro_freet(avro_resolved_wunion_reader_t, iface); } static int avro_resolved_wunion_reader_init(const avro_resolved_reader_t *iface, void *vself) { AVRO_UNUSED(iface); avro_resolved_wunion_value_t *self = (avro_resolved_wunion_value_t *) vself; self->discriminant = -1; return 0; } static void avro_resolved_wunion_reader_done(const avro_resolved_reader_t *iface, void *vself) { const avro_resolved_wunion_reader_t *uiface = container_of(iface, avro_resolved_wunion_reader_t, parent); avro_resolved_wunion_value_t *self = (avro_resolved_wunion_value_t *) vself; if (self->discriminant >= 0) { avro_resolved_reader_done (uiface->branch_resolvers[self->discriminant], avro_resolved_wunion_branch(self)); self->discriminant = -1; } } static int avro_resolved_wunion_reader_reset(const avro_resolved_reader_t *iface, void *vself) { const avro_resolved_wunion_reader_t *uiface = container_of(iface, avro_resolved_wunion_reader_t, parent); avro_resolved_wunion_value_t *self = (avro_resolved_wunion_value_t *) vself; /* Keep the same branch selected, for the common case that we're * about to reuse it. */ if (self->discriminant >= 0) { return avro_resolved_reader_reset_wrappers (uiface->branch_resolvers[self->discriminant], avro_resolved_wunion_branch(self)); } return 0; } static int avro_resolved_wunion_get_real_src(const avro_value_iface_t *viface, const void *vself, avro_value_t *real_src) { int rval; const avro_resolved_reader_t *iface = container_of(viface, avro_resolved_reader_t, parent); const avro_resolved_wunion_reader_t *uiface = container_of(iface, avro_resolved_wunion_reader_t, parent); avro_resolved_wunion_value_t *self = (avro_resolved_wunion_value_t *) vself; int writer_disc; check(rval, avro_value_get_discriminant(&self->wrapped, &writer_disc)); AVRO_DEBUG("Writer is branch %d", writer_disc); if (uiface->branch_resolvers[writer_disc] == NULL) { avro_set_error("Reader isn't compatible with writer branch %d", writer_disc); return EINVAL; } if (self->discriminant == writer_disc) { AVRO_DEBUG("Writer branch %d already selected", writer_disc); } else { if (self->discriminant >= 0) { AVRO_DEBUG("Finalizing old writer branch %d", self->discriminant); avro_resolved_reader_done (uiface->branch_resolvers[self->discriminant], avro_resolved_wunion_branch(self)); } AVRO_DEBUG("Initializing writer branch %d", writer_disc); check(rval, avro_resolved_reader_init (uiface->branch_resolvers[writer_disc], avro_resolved_wunion_branch(self))); self->discriminant = writer_disc; } real_src->iface = &uiface->branch_resolvers[writer_disc]->parent; real_src->self = avro_resolved_wunion_branch(self); return avro_value_get_current_branch(&self->wrapped, (avro_value_t *) real_src->self); } static int avro_resolved_wunion_reader_get_boolean(const avro_value_iface_t *viface, const void *vself, int *out) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_get_boolean(&src, out); } static int avro_resolved_wunion_reader_get_bytes(const avro_value_iface_t *viface, const void *vself, const void **buf, size_t *size) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_get_bytes(&src, buf, size); } static int avro_resolved_wunion_reader_grab_bytes(const avro_value_iface_t *viface, const void *vself, avro_wrapped_buffer_t *dest) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_grab_bytes(&src, dest); } static int avro_resolved_wunion_reader_get_double(const avro_value_iface_t *viface, const void *vself, double *out) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_get_double(&src, out); } static int avro_resolved_wunion_reader_get_float(const avro_value_iface_t *viface, const void *vself, float *out) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_get_float(&src, out); } static int avro_resolved_wunion_reader_get_int(const avro_value_iface_t *viface, const void *vself, int32_t *out) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_get_int(&src, out); } static int avro_resolved_wunion_reader_get_long(const avro_value_iface_t *viface, const void *vself, int64_t *out) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_get_long(&src, out); } static int avro_resolved_wunion_reader_get_null(const avro_value_iface_t *viface, const void *vself) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_get_null(&src); } static int avro_resolved_wunion_reader_get_string(const avro_value_iface_t *viface, const void *vself, const char **str, size_t *size) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_get_string(&src, str, size); } static int avro_resolved_wunion_reader_grab_string(const avro_value_iface_t *viface, const void *vself, avro_wrapped_buffer_t *dest) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_grab_string(&src, dest); } static int avro_resolved_wunion_reader_get_enum(const avro_value_iface_t *viface, const void *vself, int *out) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_get_enum(&src, out); } static int avro_resolved_wunion_reader_get_fixed(const avro_value_iface_t *viface, const void *vself, const void **buf, size_t *size) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_get_fixed(&src, buf, size); } static int avro_resolved_wunion_reader_grab_fixed(const avro_value_iface_t *viface, const void *vself, avro_wrapped_buffer_t *dest) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_grab_fixed(&src, dest); } static int avro_resolved_wunion_reader_set_boolean(const avro_value_iface_t *viface, void *vself, int val) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_set_boolean(&src, val); } static int avro_resolved_wunion_reader_set_bytes(const avro_value_iface_t *viface, void *vself, void *buf, size_t size) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_set_bytes(&src, buf, size); } static int avro_resolved_wunion_reader_give_bytes(const avro_value_iface_t *viface, void *vself, avro_wrapped_buffer_t *buf) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_give_bytes(&src, buf); } static int avro_resolved_wunion_reader_set_double(const avro_value_iface_t *viface, void *vself, double val) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_set_double(&src, val); } static int avro_resolved_wunion_reader_set_float(const avro_value_iface_t *viface, void *vself, float val) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_set_float(&src, val); } static int avro_resolved_wunion_reader_set_int(const avro_value_iface_t *viface, void *vself, int32_t val) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_set_int(&src, val); } static int avro_resolved_wunion_reader_set_long(const avro_value_iface_t *viface, void *vself, int64_t val) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_set_long(&src, val); } static int avro_resolved_wunion_reader_set_null(const avro_value_iface_t *viface, void *vself) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_set_null(&src); } static int avro_resolved_wunion_reader_set_string(const avro_value_iface_t *viface, void *vself, const char *str) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_set_string(&src, str); } static int avro_resolved_wunion_reader_set_string_len(const avro_value_iface_t *viface, void *vself, const char *str, size_t size) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_set_string_len(&src, str, size); } static int avro_resolved_wunion_reader_give_string_len(const avro_value_iface_t *viface, void *vself, avro_wrapped_buffer_t *buf) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_give_string_len(&src, buf); } static int avro_resolved_wunion_reader_set_enum(const avro_value_iface_t *viface, void *vself, int val) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_set_enum(&src, val); } static int avro_resolved_wunion_reader_set_fixed(const avro_value_iface_t *viface, void *vself, void *buf, size_t size) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_set_fixed(&src, buf, size); } static int avro_resolved_wunion_reader_give_fixed(const avro_value_iface_t *viface, void *vself, avro_wrapped_buffer_t *dest) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_give_fixed(&src, dest); } static int avro_resolved_wunion_reader_get_size(const avro_value_iface_t *viface, const void *vself, size_t *size) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_get_size(&src, size); } static int avro_resolved_wunion_reader_get_by_index(const avro_value_iface_t *viface, const void *vself, size_t index, avro_value_t *child, const char **name) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_get_by_index(&src, index, child, name); } static int avro_resolved_wunion_reader_get_by_name(const avro_value_iface_t *viface, const void *vself, const char *name, avro_value_t *child, size_t *index) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_get_by_name(&src, name, child, index); } static int avro_resolved_wunion_reader_get_discriminant(const avro_value_iface_t *viface, const void *vself, int *out) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_get_discriminant(&src, out); } static int avro_resolved_wunion_reader_get_current_branch(const avro_value_iface_t *viface, const void *vself, avro_value_t *branch) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_get_current_branch(&src, branch); } static int avro_resolved_wunion_reader_append(const avro_value_iface_t *viface, void *vself, avro_value_t *child_out, size_t *new_index) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_append(&src, child_out, new_index); } static int avro_resolved_wunion_reader_add(const avro_value_iface_t *viface, void *vself, const char *key, avro_value_t *child, size_t *index, int *is_new) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_add(&src, key, child, index, is_new); } static int avro_resolved_wunion_reader_set_branch(const avro_value_iface_t *viface, void *vself, int discriminant, avro_value_t *branch) { int rval; avro_value_t src; check(rval, avro_resolved_wunion_get_real_src(viface, vself, &src)); return avro_value_set_branch(&src, discriminant, branch); } static avro_resolved_wunion_reader_t * avro_resolved_wunion_reader_create(avro_schema_t wschema, avro_schema_t rschema) { avro_resolved_reader_t *self = (avro_resolved_reader_t *) avro_new(avro_resolved_wunion_reader_t); memset(self, 0, sizeof(avro_resolved_wunion_reader_t)); self->parent.incref_iface = avro_resolved_reader_incref_iface; self->parent.decref_iface = avro_resolved_reader_decref_iface; self->parent.incref = avro_resolved_reader_incref; self->parent.decref = avro_resolved_reader_decref; self->parent.reset = avro_resolved_reader_reset; self->parent.get_type = avro_resolved_reader_get_type; self->parent.get_schema = avro_resolved_reader_get_schema; self->parent.get_boolean = avro_resolved_wunion_reader_get_boolean; self->parent.grab_bytes = avro_resolved_wunion_reader_grab_bytes; self->parent.get_bytes = avro_resolved_wunion_reader_get_bytes; self->parent.get_double = avro_resolved_wunion_reader_get_double; self->parent.get_float = avro_resolved_wunion_reader_get_float; self->parent.get_int = avro_resolved_wunion_reader_get_int; self->parent.get_long = avro_resolved_wunion_reader_get_long; self->parent.get_null = avro_resolved_wunion_reader_get_null; self->parent.get_string = avro_resolved_wunion_reader_get_string; self->parent.grab_string = avro_resolved_wunion_reader_grab_string; self->parent.get_enum = avro_resolved_wunion_reader_get_enum; self->parent.get_fixed = avro_resolved_wunion_reader_get_fixed; self->parent.grab_fixed = avro_resolved_wunion_reader_grab_fixed; self->parent.set_boolean = avro_resolved_wunion_reader_set_boolean; self->parent.set_bytes = avro_resolved_wunion_reader_set_bytes; self->parent.give_bytes = avro_resolved_wunion_reader_give_bytes; self->parent.set_double = avro_resolved_wunion_reader_set_double; self->parent.set_float = avro_resolved_wunion_reader_set_float; self->parent.set_int = avro_resolved_wunion_reader_set_int; self->parent.set_long = avro_resolved_wunion_reader_set_long; self->parent.set_null = avro_resolved_wunion_reader_set_null; self->parent.set_string = avro_resolved_wunion_reader_set_string; self->parent.set_string_len = avro_resolved_wunion_reader_set_string_len; self->parent.give_string_len = avro_resolved_wunion_reader_give_string_len; self->parent.set_enum = avro_resolved_wunion_reader_set_enum; self->parent.set_fixed = avro_resolved_wunion_reader_set_fixed; self->parent.give_fixed = avro_resolved_wunion_reader_give_fixed; self->parent.get_size = avro_resolved_wunion_reader_get_size; self->parent.get_by_index = avro_resolved_wunion_reader_get_by_index; self->parent.get_by_name = avro_resolved_wunion_reader_get_by_name; self->parent.get_discriminant = avro_resolved_wunion_reader_get_discriminant; self->parent.get_current_branch = avro_resolved_wunion_reader_get_current_branch; self->parent.append = avro_resolved_wunion_reader_append; self->parent.add = avro_resolved_wunion_reader_add; self->parent.set_branch = avro_resolved_wunion_reader_set_branch; self->refcount = 1; self->wschema = avro_schema_incref(wschema); self->rschema = avro_schema_incref(rschema); self->calculate_size = avro_resolved_wunion_reader_calculate_size; self->free_iface = avro_resolved_wunion_reader_free_iface; self->init = avro_resolved_wunion_reader_init; self->done = avro_resolved_wunion_reader_done; self->reset_wrappers = avro_resolved_wunion_reader_reset; return container_of(self, avro_resolved_wunion_reader_t, parent); } static avro_resolved_reader_t * try_writer_union(memoize_state_t *state, avro_schema_t wschema, avro_schema_t rschema) { /* * For a writer union, we check each branch of the union in turn * against the reader schema. For each one that is compatible, * we save the child resolver that can be used to process a * writer value of that branch. */ size_t branch_count = avro_schema_union_size(wschema); AVRO_DEBUG("Checking %" PRIsz "-branch writer union schema", branch_count); avro_resolved_wunion_reader_t *uself = avro_resolved_wunion_reader_create(wschema, rschema); avro_memoize_set(&state->mem, wschema, rschema, uself); avro_resolved_reader_t **branch_resolvers = (avro_resolved_reader_t **) avro_calloc(branch_count, sizeof(avro_resolved_reader_t *)); int some_branch_compatible = 0; size_t i; for (i = 0; i < branch_count; i++) { avro_schema_t branch_schema = avro_schema_union_branch(wschema, i); AVRO_DEBUG("Resolving writer union branch %" PRIsz " (%s)", i, avro_schema_type_name(branch_schema)); /* * Try to recursively resolve this branch of the writer * union against the reader schema. Don't raise * an error if this fails — we just need one of * the writer branches to be compatible. */ branch_resolvers[i] = avro_resolved_reader_new_memoized(state, branch_schema, rschema); if (branch_resolvers[i] == NULL) { AVRO_DEBUG("No match for writer union branch %" PRIsz, i); } else { AVRO_DEBUG("Found match for writer union branch %" PRIsz, i); some_branch_compatible = 1; } } /* * If we didn't find a match, that's an error. */ if (!some_branch_compatible) { AVRO_DEBUG("No writer union branches match"); avro_set_error("No branches in the writer are compatible " "with reader schema %s", avro_schema_type_name(rschema)); goto error; } uself->branch_count = branch_count; uself->branch_resolvers = branch_resolvers; return &uself->parent; error: /* * Clean up any resolver we might have already created. */ avro_memoize_delete(&state->mem, wschema, rschema); avro_value_iface_decref(&uself->parent.parent); { unsigned int i; for (i = 0; i < branch_count; i++) { if (branch_resolvers[i]) { avro_value_iface_decref(&branch_resolvers[i]->parent); } } } avro_free(branch_resolvers, branch_count * sizeof(avro_resolved_reader_t *)); return NULL; } /*----------------------------------------------------------------------- * reader union */ /* * For reader unions, we only resolve them against writers which aren't * unions. (We'll have already broken any writer union apart into its * separate branches.) We just have to record which branch of the * reader union the writer schema is compatible with. */ typedef struct avro_resolved_runion_reader { avro_resolved_reader_t parent; /* The reader union branch that's compatible with the writer * schema. */ size_t active_branch; /* A child resolver for the reader branch. */ avro_resolved_reader_t *branch_resolver; } avro_resolved_runion_reader_t; static void avro_resolved_runion_reader_calculate_size(avro_resolved_reader_t *iface) { avro_resolved_runion_reader_t *uiface = container_of(iface, avro_resolved_runion_reader_t, parent); /* Only calculate the size for any resolver once */ iface->calculate_size = NULL; AVRO_DEBUG("Calculating size for %s->%s", avro_schema_type_name((iface)->wschema), avro_schema_type_name((iface)->rschema)); avro_resolved_reader_calculate_size(uiface->branch_resolver); iface->instance_size = uiface->branch_resolver->instance_size; } static void avro_resolved_runion_reader_free_iface(avro_resolved_reader_t *iface, st_table *freeing) { avro_resolved_runion_reader_t *uiface = container_of(iface, avro_resolved_runion_reader_t, parent); if (uiface->branch_resolver != NULL) { free_resolver(uiface->branch_resolver, freeing); } avro_schema_decref(iface->wschema); avro_schema_decref(iface->rschema); avro_freet(avro_resolved_runion_reader_t, iface); } static int avro_resolved_runion_reader_init(const avro_resolved_reader_t *iface, void *vself) { avro_resolved_runion_reader_t *uiface = container_of(iface, avro_resolved_runion_reader_t, parent); return avro_resolved_reader_init(uiface->branch_resolver, vself); } static void avro_resolved_runion_reader_done(const avro_resolved_reader_t *iface, void *vself) { avro_resolved_runion_reader_t *uiface = container_of(iface, avro_resolved_runion_reader_t, parent); avro_resolved_reader_done(uiface->branch_resolver, vself); } static int avro_resolved_runion_reader_reset(const avro_resolved_reader_t *iface, void *vself) { avro_resolved_runion_reader_t *uiface = container_of(iface, avro_resolved_runion_reader_t, parent); return avro_resolved_reader_reset_wrappers(uiface->branch_resolver, vself); } static int avro_resolved_runion_reader_get_discriminant(const avro_value_iface_t *viface, const void *vself, int *out) { AVRO_UNUSED(vself); const avro_resolved_reader_t *iface = container_of(viface, avro_resolved_reader_t, parent); const avro_resolved_runion_reader_t *uiface = container_of(iface, avro_resolved_runion_reader_t, parent); AVRO_DEBUG("Reader union is branch %" PRIsz, uiface->active_branch); *out = uiface->active_branch; return 0; } static int avro_resolved_runion_reader_get_current_branch(const avro_value_iface_t *viface, const void *vself, avro_value_t *branch) { const avro_resolved_reader_t *iface = container_of(viface, avro_resolved_reader_t, parent); const avro_resolved_runion_reader_t *uiface = container_of(iface, avro_resolved_runion_reader_t, parent); AVRO_DEBUG("Getting reader branch %" PRIsz " for union %p", uiface->active_branch, vself); branch->iface = &uiface->branch_resolver->parent; branch->self = (void *) vself; return 0; } static avro_resolved_runion_reader_t * avro_resolved_runion_reader_create(avro_schema_t wschema, avro_schema_t rschema) { avro_resolved_reader_t *self = (avro_resolved_reader_t *) avro_new(avro_resolved_runion_reader_t); memset(self, 0, sizeof(avro_resolved_runion_reader_t)); self->parent.incref_iface = avro_resolved_reader_incref_iface; self->parent.decref_iface = avro_resolved_reader_decref_iface; self->parent.incref = avro_resolved_reader_incref; self->parent.decref = avro_resolved_reader_decref; self->parent.reset = avro_resolved_reader_reset; self->parent.get_type = avro_resolved_reader_get_type; self->parent.get_schema = avro_resolved_reader_get_schema; self->parent.get_discriminant = avro_resolved_runion_reader_get_discriminant; self->parent.get_current_branch = avro_resolved_runion_reader_get_current_branch; self->refcount = 1; self->wschema = avro_schema_incref(wschema); self->rschema = avro_schema_incref(rschema); self->calculate_size = avro_resolved_runion_reader_calculate_size; self->free_iface = avro_resolved_runion_reader_free_iface; self->init = avro_resolved_runion_reader_init; self->done = avro_resolved_runion_reader_done; self->reset_wrappers = avro_resolved_runion_reader_reset; return container_of(self, avro_resolved_runion_reader_t, parent); } static avro_resolved_reader_t * try_reader_union(memoize_state_t *state, avro_schema_t wschema, avro_schema_t rschema) { /* * For a reader union, we have to identify which branch * corresponds to the writer schema. (The writer won't be a * union, since we'll have already broken it into its branches.) */ size_t branch_count = avro_schema_union_size(rschema); AVRO_DEBUG("Checking %" PRIsz "-branch reader union schema", branch_count); avro_resolved_runion_reader_t *uself = avro_resolved_runion_reader_create(wschema, rschema); avro_memoize_set(&state->mem, wschema, rschema, uself); size_t i; for (i = 0; i < branch_count; i++) { avro_schema_t branch_schema = avro_schema_union_branch(rschema, i); AVRO_DEBUG("Resolving reader union branch %" PRIsz " (%s)", i, avro_schema_type_name(branch_schema)); /* * Try to recursively resolve this branch of the reader * union against the writer schema. Don't raise * an error if this fails — we just need one of * the reader branches to be compatible. */ uself->branch_resolver = avro_resolved_reader_new_memoized(state, wschema, branch_schema); if (uself->branch_resolver == NULL) { AVRO_DEBUG("No match for reader union branch %" PRIsz, i); } else { AVRO_DEBUG("Found match for reader union branch %" PRIsz, i); uself->active_branch = i; return &uself->parent; } } /* * If we didn't find a match, that's an error. */ AVRO_DEBUG("No reader union branches match"); avro_set_error("No branches in the reader are compatible " "with writer schema %s", avro_schema_type_name(wschema)); goto error; error: /* * Clean up any resolver we might have already created. */ avro_memoize_delete(&state->mem, wschema, rschema); avro_value_iface_decref(&uself->parent.parent); return NULL; } /*----------------------------------------------------------------------- * Schema type dispatcher */ static avro_resolved_reader_t * avro_resolved_reader_new_memoized(memoize_state_t *state, avro_schema_t wschema, avro_schema_t rschema) { check_param(NULL, is_avro_schema(wschema), "writer schema"); check_param(NULL, is_avro_schema(rschema), "reader schema"); /* * First see if we've already matched these two schemas. If so, * just return that resolver. */ avro_resolved_reader_t *saved = NULL; if (avro_memoize_get(&state->mem, wschema, rschema, (void **) &saved)) { AVRO_DEBUG("Already resolved %s%s%s->%s%s%s", is_avro_link(wschema)? "[": "", avro_schema_type_name(wschema), is_avro_link(wschema)? "]": "", is_avro_link(rschema)? "[": "", avro_schema_type_name(rschema), is_avro_link(rschema)? "]": ""); return saved; } else { AVRO_DEBUG("Resolving %s%s%s->%s%s%s", is_avro_link(wschema)? "[": "", avro_schema_type_name(wschema), is_avro_link(wschema)? "]": "", is_avro_link(rschema)? "[": "", avro_schema_type_name(rschema), is_avro_link(rschema)? "]": ""); } /* * Otherwise we have some work to do. First check if the writer * schema is a union. If so, break it apart. */ if (is_avro_union(wschema)) { return try_writer_union(state, wschema, rschema); } else if (is_avro_link(wschema)) { return try_wlink(state, wschema, rschema); } /* * If the writer isn't a union, than choose a resolver based on * the reader schema. */ switch (avro_typeof(rschema)) { case AVRO_BOOLEAN: return try_boolean(state, wschema, rschema); case AVRO_BYTES: return try_bytes(state, wschema, rschema); case AVRO_DOUBLE: return try_double(state, wschema, rschema); case AVRO_FLOAT: return try_float(state, wschema, rschema); case AVRO_INT32: return try_int(state, wschema, rschema); case AVRO_INT64: return try_long(state, wschema, rschema); case AVRO_NULL: return try_null(state, wschema, rschema); case AVRO_STRING: return try_string(state, wschema, rschema); case AVRO_ARRAY: return try_array(state, wschema, rschema); case AVRO_ENUM: return try_enum(state, wschema, rschema); case AVRO_FIXED: return try_fixed(state, wschema, rschema); case AVRO_MAP: return try_map(state, wschema, rschema); case AVRO_RECORD: return try_record(state, wschema, rschema); case AVRO_UNION: return try_reader_union(state, wschema, rschema); case AVRO_LINK: return try_rlink(state, wschema, rschema); default: avro_set_error("Unknown reader schema type"); return NULL; } return NULL; } avro_value_iface_t * avro_resolved_reader_new(avro_schema_t wschema, avro_schema_t rschema) { /* * Create a state to keep track of the value implementations * that we create for each subschema. */ memoize_state_t state; avro_memoize_init(&state.mem); state.links = NULL; /* * Create the value implementations. */ avro_resolved_reader_t *result = avro_resolved_reader_new_memoized(&state, wschema, rschema); if (result == NULL) { avro_memoize_done(&state.mem); return NULL; } /* * Fix up any link schemas so that their value implementations * point to their target schemas' implementations. */ avro_resolved_reader_calculate_size(result); while (state.links != NULL) { avro_resolved_link_reader_t *liface = state.links; avro_resolved_reader_calculate_size(liface->target_resolver); state.links = liface->next; liface->next = NULL; } /* * And now we can return. */ avro_memoize_done(&state.mem); return &result->parent; }
Java
\textbf{Входные параметры:} Отсутствуют. В переопределяемой функции также есть параметр: Type --- обозначение тестовой функции, которую вызываем. Смотреть виды в переменных перечисляемого типа в начале HarrixMathLibrary.h файла: TestFunction\_Ackley, TestFunction\_ParaboloidOfRevolution, TestFunction\_Rastrigin и др. Они совпадают с названиями одноименных тестовых функций, но без приставки \textbf{HML\_}. \textbf{Возвращаемое значение:} Точность вычислений. Итак, для обычного использования (без параметра Type) нужно вызвать функцию HML\_DefineTestFunction. Иначе использовать переопределенную функцию и самому указать тип тестовой функции.
Java
'use strict'; export interface IPrint extends ng.resource.IResource<IPrint> { printOptions: any; } export interface IPrintResource extends ng.resource.IResourceClass<IPrint> {} export class PrintResource { /* @ngInject */ public static Print($resource: ng.resource.IResourceService): IPrintResource { var url = '/api/print'; var resource = $resource(url, {}); return <IPrintResource> resource; } }
Java
--- layout: page title: Tough Dark Company Dinner date: 2016-05-24 author: Charles Terrell tags: weekly links, java status: published summary: Aliquam non vehicula metus. Curabitur at est. banner: images/banner/leisure-01.jpg booking: startDate: 04/03/2017 endDate: 04/08/2017 ctyhocn: PHXSRHX groupCode: TDCD published: true --- Praesent tincidunt eget eros et pharetra. Donec quis enim aliquam, rutrum odio elementum, gravida arcu. Cras lobortis gravida lectus, eu ullamcorper dolor rutrum vel. In sit amet ex sagittis, convallis velit id, egestas nibh. Praesent nisl dolor, laoreet ac sapien vel, lobortis vulputate lectus. Fusce placerat varius turpis sit amet dignissim. Nullam non felis in nisi varius sollicitudin vitae id justo. Donec commodo enim eget cursus ornare. Donec turpis nunc, sodales eget rhoncus ac, laoreet vitae ligula. Nulla venenatis scelerisque lacus vel consequat. Donec lobortis feugiat purus at pretium. Quisque consequat enim semper interdum placerat. Nunc consectetur, mauris a cursus placerat, sem quam ullamcorper sem, nec tincidunt augue nibh et orci. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Phasellus condimentum finibus ligula, sit amet interdum est elementum eu. Fusce id purus fermentum, scelerisque sem id, pulvinar dui. Pellentesque eget laoreet arcu, in posuere risus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Donec lobortis elementum diam, pretium auctor ante venenatis eu. Nulla facilisi. Duis eu eleifend sapien. * Morbi non dui non sem ornare porttitor eu in libero * Phasellus rhoncus orci a arcu mattis, id iaculis augue sagittis. Etiam sodales sem leo, vel porttitor mauris vulputate eu. Interdum et malesuada fames ac ante ipsum primis in faucibus. Integer volutpat, risus sit amet fringilla placerat, ante orci ornare nulla, nec ultricies sem arcu porttitor velit. Vivamus sagittis justo non nibh hendrerit, eu venenatis elit consequat. Praesent sagittis urna non erat luctus accumsan. Duis cursus massa vitae velit condimentum condimentum. Aliquam erat volutpat. Quisque sodales et turpis ut auctor. Mauris sit amet tempus sapien. Donec egestas arcu vitae risus congue, rhoncus finibus turpis sollicitudin. Aliquam accumsan tristique sagittis. Sed magna felis, mollis vitae vehicula vel, venenatis dapibus urna. Etiam faucibus tellus pharetra, tincidunt arcu non, pulvinar purus. Phasellus id magna dui. Integer fermentum mattis efficitur. Cras efficitur ex leo, id sodales libero posuere non.
Java
--- layout: page title: Diamond Forest Entertainment Show date: 2016-05-24 author: Nicholas Palmer tags: weekly links, java status: published summary: Pellentesque a dolor dictum, congue arcu. banner: images/banner/meeting-01.jpg booking: startDate: 09/27/2018 endDate: 09/30/2018 ctyhocn: MQBILHX groupCode: DFES published: true --- Ut non aliquet turpis. Phasellus a massa porta, facilisis augue id, rutrum sapien. Sed volutpat felis ex, vel ornare enim lacinia nec. Sed non sagittis purus. Nam placerat dui vel neque tristique sollicitudin. Cras aliquam sapien ex, non facilisis eros laoreet sit amet. Nulla eu dolor tincidunt, laoreet tellus ut, porta lacus. * Integer ut odio et lorem fermentum iaculis. Mauris id risus in lacus venenatis pellentesque non in diam. Fusce tempus sit amet sem sed suscipit. Aenean non sodales mi, eu blandit diam. Interdum et malesuada fames ac ante ipsum primis in faucibus. Suspendisse potenti. Donec quis turpis venenatis, rutrum elit id, imperdiet urna. Praesent arcu tortor, imperdiet egestas placerat id, ultrices ut quam. Aliquam varius accumsan placerat. Sed egestas et enim nec suscipit.
Java
<?php // :default:index.html.twig return array ( 'fe7793f' => array ( 0 => array ( 0 => '@bootstrap_css', 1 => '@fontawesome_css_be', 2 => '@YallaWebsiteBackendBundle/Resources/public/css/jquery-ui.css', 3 => '@YallaWebsiteBackendBundle/Resources/public/css/select2.min.css', 4 => '@YallaWebsiteBackendBundle/Resources/public/css/jquery.tagsinput.min.css', 5 => '@YallaWebsiteBackendBundle/Resources/public/css/image-picker.css', 6 => '@YallaWebsiteBackendBundle/Resources/public/css/style.css', ), 1 => array ( ), 2 => array ( 'output' => '_controller/css/fe7793f.css', 'name' => 'fe7793f', 'debug' => NULL, 'combine' => NULL, 'vars' => array ( ), ), ), 'a56fa94' => array ( 0 => array ( 0 => '@jquery', 1 => '@bootstrap_js', ), 1 => array ( ), 2 => array ( 'output' => '_controller/js/a56fa94.js', 'name' => 'a56fa94', 'debug' => NULL, 'combine' => NULL, 'vars' => array ( ), ), ), );
Java
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <time.h> #include "search.h" #include "marcov.h" #define ORDER 2 int main(int argc, char **argv) { int limit = 128; if(argc > 1) { limit = atoi(argv[1]); } void *strings = NULL; struct timespec t; clock_gettime(CLOCK_MONOTONIC, &t); srand(t.tv_nsec); marcov_t *m = NULL; marcov_load(&strings, &m, 0); char *nl = stringidx(&strings, "\n"); wordlist_t nlstart = (wordlist_t) {.num = 1, .w = &nl}; wordlist_t *wl = NULL; wl = marcov_randomstart(m, &nlstart); if(!wl) { wl = marcov_randomstart(m, NULL); } for(int i = 0; i < limit; i++) { char *line = marcov_getline(m); if(!line) { break; } printf("%s", line); free(line); } return 0; }
Java
/** * JRakLibPlus is not affiliated with Jenkins Software LLC or RakNet. * This software is an enhanced port of RakLib https://github.com/PocketMine/RakLib. * This file is part of JRakLibPlus. * * JRakLibPlus is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * JRakLibPlus is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with JRakLibPlus. If not, see <http://www.gnu.org/licenses/>. */ package io.github.jython234.jraklibplus.protocol.raknet; import static io.github.jython234.jraklibplus.JRakLibPlus.*; /** * Created by jython234 on 9/12/2015. * * @author RedstoneLamp Team */ public class NACKPacket extends AcknowledgePacket { @Override public byte getPID() { return NACK; } }
Java
# Simple.LocalDb Simple.LocalDb is a simple managed wrapper around the LocalDB API. This framework has no features. It does not have error checking. It does not do anything smart. It doesn't try to help you in any way. There are no unit tests. There are no integration tests. There are no interfaces, inheritance, coupling, or clever abstractions. If you're like me and you basically want to call 'CreateInstance' from your test code, this package is your friend. If you need to automagically deploy a dacpac to a dynamically created test instance, this is not your package. If you want a smart and robust LocalDb provider that can create different versions of instances, be localized, will clean up cruft localdb files from the filesystem, and will recover from failures, this is not your package. Try one of these instead: - [Nicholas Ham's LocalDb NuGet package](https://www.nuget.org/packages/SqlLocalDb.Dac/). - [Martin Costello's LocalDb NuGet package](https://www.nuget.org/packages/System.Data.SqlLocalDb/). To use this package: - You can create an instance of the managed interface, which hides some of the marshaling complexity from you (there's not much). - You can create an instance of the unmanaged interface and write your own better wrapper around it. - If you want to use it as a nuget package. Have at it. - If you want to include the project source in your project. Have at it. - If you want to copy paste parts of the code into yours. Have at it. - If you need to target the .Net 3.5 (neee 2.0) runtime and reference a signed assembly. Grab the source and have at it. - If you want to copy this code and publish a new nuget package from it with a different name and 0..n modifications. Have at it. Example Managed API usage: ``` //New up the API. var api = new ManagedLocalDbApi(); //Get all the instances as a list of strings. var instanceNames = api.GetInstanceNames().ToList(); //Create a new instance with a random name. var testInstanceName = Path.GetRandomFileName(); api.CreateInstance(testInstanceName); //Start the instance and get its connection string (named pipes). var connection = api.StartInstance(testInstanceName); //Get a bunch of fun details about the instance. var testInstance = api.GetInstance(testInstanceName); //Stop the instance. Timeout if it takes longer than 60 seconds. api.StopInstance(testInstanceName, TimeSpan.FromSeconds(60)); //Delete the instance. api.DeleteInstance(testInstanceName); ```
Java
#if UNITY_EDITOR using UnityEngine; using UnityEditor; using System.IO; public class CreateAssetbundle : MonoBehaviour { [MenuItem("Fineness/Build AssetBundle From Select Resource")] static void SelectResourceAndBuildAB() { UnityEngine.Object[] selecteds = Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.DeepAssets); var count = 0; var max = selecteds.Length; var fileNames = new string[max]; var assetBundle = new AssetBundleBuild(); Debug.Log("即将打包的文件路径队列:"); for (var i = 0; i < max; i++) { var target = selecteds[i]; string assetPath = AssetDatabase.GetAssetPath(target); var fileName = assetPath; assetPath = assetPath.Replace("Assets/", ""); var fileInfo = new FileInfo(assetPath); if ((fileName.IndexOf('.') != -1) && (fileInfo.Extension != "cs") && (fileInfo.Extension != "meta")) { fileNames[i] = fileName; count++; Debug.Log(i + " >> " + fileNames[i]); } } if (count > 0) { var activer = Selection.activeObject; if (activer == null) { Debug.Log(" ╮(╯▽╰)╭ 缺少被选中的激活物件,请选择后重试..."); return; } assetBundle.assetBundleName = activer.name; assetBundle.assetNames = fileNames; var outputFileName = Application.streamingAssetsPath + "/AB" + assetBundle.assetBundleName; if (!Directory.Exists(outputFileName)) Directory.CreateDirectory(outputFileName); var options = BuildAssetBundleOptions.None; var path = "Assets" + outputFileName.Replace(Application.dataPath, ""); BuildPipeline.BuildAssetBundles(path, new[] { assetBundle }, options, EditorUserBuildSettings.activeBuildTarget); AssetDatabase.Refresh(); Debug.Log(" ♪(^∇^*) 尊敬的主人,打包已完成,资源存放路径:" + path); } else Debug.Log("所选文件中没有可打包的资源"); } } //获取打包的平台 public class PlatformPath { /// <summary> /// 获取打包的平台,根据平台设置打包的文件夹名称 /// </summary> /// <param name="target"></param> /// <returns></returns> public static string GetPlatformFolder(BuildTarget target) { switch (target) { case BuildTarget.Android: return "Android"; case BuildTarget.iOS: return "IOS"; //case BuildTarget.WebPlayer: // return "WebPlayer"; case BuildTarget.StandaloneWindows: case BuildTarget.StandaloneWindows64: return "Windows"; case BuildTarget.StandaloneOSXIntel: case BuildTarget.StandaloneOSXIntel64: case BuildTarget.StandaloneOSXUniversal: return "OSX"; default: return null; } } } #endif
Java
import http from "http"; import express from "express"; import cors from "cors"; import morgan from "morgan"; import bodyParser from "body-parser"; import initializeDb from "./db"; import middleware from "./middleware"; import api from "./api"; import config from "config"; //we load the db location from the JSON files let app = express(); app.server = http.createServer(app); //don't show the log when it is test if (process.env.NODE_ENV !== "test") { // logger app.use(morgan("dev")); } // 3rd party middleware app.use( cors({ exposedHeaders: config.corsHeaders }) ); app.use( bodyParser.json({ limit: config.bodyLimit }) ); const dbOptions = { useMongoClient: true }; // connect to db initializeDb(config.dbURI, dbOptions, () => { // internal middleware app.use(middleware({ config })); // api router app.use("/api", api({ config })); app.server.listen(process.env.PORT || config.port, () => { console.log(`Started on port ${app.server.address().port}`); }); }); export default app;
Java
##Generators <div class="code-extra es6"> ```js // Define generators with '*' function *foo() { } // halt and output at 'yield' function *fibonacci() { let pre = 0, cur = 1; while(true) { [ pre, cur ] = [ cur, pre + cur ]; yield cur; } } let fibGen = fibonacci(); fibGen.next(); // { value: 1, done: false } fibGen.next(); // { value: 2, done: false } // Can use For..Of on generators for(let x of fibGen) { if (x > 1000) { break; } console.log(x); } // 1, 2, 3, 5, 8... ``` Note: - defined with 'star' - generators can be halted - yield outputs value - yield accepts value
Java
# Advanced 进阶 <p class="description">本节包含了 @material-ui/core/styles 的一些更多的进阶用法。</p> ## Theming 主题 若您想将主题传递到 React 组件树,请将添加 `ThemeProvider` 包装到应用程序的顶层。 然后,您可以在样式函数中访问主题对象。 > 此示例为自定义组件创建了一个主题对象(theme object)。 If you intend to use some of the Material-UI's components you need to provide a richer theme structure using the `createTheme()` method. 请前往 [theming 部分](/customization/theming/) 学习如何构建自己的 Material-UI 主题。 ```jsx import { ThemeProvider } from '@material-ui/core/styles'; import DeepChild from './my_components/DeepChild'; const theme = { background: 'linear-gradient(45deg, #FE6B8B 30%, #FF8E53 90%)', }; function Theming() { return ( <ThemeProvider theme={theme}> <DeepChild /> </ThemeProvider> ); } ``` {{"demo": "pages/styles/advanced/Theming.js"}} ### 访问一个组件中的主题 您可能需要访问 React 组件中的主题变量。 #### `useTheme` hook 在函数组件(function components)中的使用: ```jsx import { useTheme } from '@material-ui/core/styles'; function DeepChild() { const theme = useTheme(); return <span>{`spacing ${theme.spacing}`}</span>; } ``` {{"demo": "pages/styles/advanced/UseTheme.js"}} #### `withTheme` HOC 在类(class)或函数(function)组件中的使用: ```jsx import { withTheme } from '@material-ui/core/styles'; function DeepChildRaw(props) { return <span>{`spacing ${props.theme.spacing}`}</span>; } const DeepChild = withTheme(DeepChildRaw); ``` {{"demo": "pages/styles/advanced/WithTheme.js"}} ### 覆盖主题 您可以嵌套多个主题提供者。 当您在处理应用程序的不同区域时,若需要应用的不同外观,这个功能会让您得心应手。 ```jsx <ThemeProvider theme={outerTheme}> <Child1 /> <ThemeProvider theme={innerTheme}> <Child2 /> </ThemeProvider> </ThemeProvider> ``` {{"demo": "pages/styles/advanced/ThemeNesting.js"}} 内部主题将 **覆盖** 外部主题。 你可以提供一个函数来扩展外层主题: ```jsx <ThemeProvider theme={…} > <Child1 /> <ThemeProvider theme={outerTheme => ({ darkMode: true, ...outerTheme })}> <Child2 /> </ThemeProvider> </ThemeProvider> ``` ## 覆盖样式 — `classes` 属性 通过 `makeStyles` (hook generator) 和 `withStyles` (HOC) 这两个 API, 用户可以为每个样式表创建多种样式规则。 每个样式规则都有自己的类名。 组件的 `classes` 变量会提供类名(class names)。 这在设置组件中嵌套元素的样式时特别有用。 ```jsx // 样式表 const useStyles = makeStyles({ root: {}, // 样式规则 label: {}, // 嵌套的样式规则 }); function Nested(props) { const classes = useStyles(); return ( <button className={classes.root}> {/* 'jss1' */} <span className={classes.label}>{/* 'jss2' 嵌套规则 */}</span> </button> ); } function Parent() { return <Nested />; } ``` 但是,类名通常是不确定的。 父级组件如何覆盖嵌套元素的样式呢? ### `withStyles` 这是最简单的一种情况。 封装的组件接受 `classes` 属性, 它简单地合并了样式表提供的类名。 ```jsx const Nested = withStyles({ root: {}, // a style rule label: {}, // a nested style rule })(({ classes }) => ( <button className={classes.root}> <span className={classes.label}>{/* 'jss2 my-label' Nested*/}</span> </button> )); function Parent() { return <Nested classes={{ label: 'my-label' }} />; } ``` ### `makeStyles` 想使用 hook API 的话需要一些额外的工作。 你必须把父级属性作为第一个参数传递给 hook。 ```jsx const useStyles = makeStyles({ root: {}, // 样式规则 label: {}, // 嵌套的样式规则 }); function Nested(props) { const classes = useStyles(props); return ( <button className={classes.root}> <span className={classes.label}>{/* 'jss2 my-label' 嵌套规则 */}</span> </button> ); } function Parent() { return <Nested classes={{ label: 'my-label' }} />; } ``` ## JSS 插件 JSS 使用插件来扩展其核心,您可以挑选所需的功能,并且只需承担您正在使用的内容性能的开销。 默认情况下,不是所有 Material-UI 的插件都可以使用。 以下(一个 [jss-preset-default 的子集](https://cssinjs.org/jss-preset-default/)) 被包含在内: - [jss-plugin-rule-value-function](https://cssinjs.org/jss-plugin-rule-value-function/) - [jss-plugin-global](https://cssinjs.org/jss-plugin-global/) - [jss-plugin-nested](https://cssinjs.org/jss-plugin-nested/) - [jss-plugin-camel-case](https://cssinjs.org/jss-plugin-camel-case/) - [jss-plugin-default-unit](https://cssinjs.org/jss-plugin-default-unit/) - [jss-plugin-vendor-prefixer](https://cssinjs.org/jss-plugin-vendor-prefixer/) - [jss-plugin-props-sort](https://cssinjs.org/jss-plugin-props-sort/) 当然,你也可以随意使用额外的插件。 我们有一个使用 [jss-rtl](https://github.com/alitaheri/jss-rtl) 插件的例子。 ```jsx import { create } from 'jss'; import { StylesProvider, jssPreset } from '@material-ui/styles'; import rtl from 'jss-rtl'; const jss = create({ plugins: [...jssPreset().plugins, rtl()], }); export default function App() { return <StylesProvider jss={jss}>...</StylesProvider>; } ``` ## 字符串模板 如果相比 JSS 您更喜欢 CSS 的语法,则可以使用 [jss-plugin-template](https://cssinjs.org/jss-plugin-template/) 插件。 ```jsx const useStyles = makeStyles({ root: ` background: linear-gradient(45deg, #fe6b8b 30%, #ff8e53 90%); border-radius: 3px; font-size: 16px; border: 0; color: white; height: 48px; padding: 0 30px; box-shadow: 0 3px 5px 2px rgba(255, 105, 135, 0.3); `, }); ``` 请注意,此插件不支持选择器或嵌套规则。 {{"demo": "pages/styles/advanced/StringTemplates.js"}} ## CSS 注入顺序 > 了解浏览器如何计算 CSS 优先级是**非常重要的**,因为它是您在覆盖样式时需要了解的重点之一。 我们推荐您阅读 MDN 上的这段内容:[如何计算优先级?](https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity#How_is_specificity_calculated) 默认情况下,注入的style标签会被插入到页面`<head>`元素的最后。 它们的优先级高于您页面上的任何其他样式标签,如 CSS 模块、styled components。 ### injectFirst `StylesProvider`组件的属性 `injectFirst` 会把style标签注入到head的**前部**(意味着更低的权重)。 ```jsx import { StylesProvider } from '@material-ui/styles'; <StylesProvider injectFirst> {/* 你的组件树。 样式化组件可以覆盖 Material-UI 的样式。 */} </StylesProvider>; ``` ### `makeStyles` / `withStyles` / `styled` 使用 `makeStyles` / `withStyles` / `styled` 的注入顺序于调用顺序**相同**。 例如,在这种情况下,字体最终是红色: ```jsx import clsx from 'clsx'; import { makeStyles } from '@material-ui/styles'; const useStylesBase = makeStyles({ root: { color: 'blue', // 🔵 }, }); const useStyles = makeStyles({ root: { color: 'red', // 🔴 }, }); export default function MyComponent() { // Order doesn't matter const classes = useStyles(); const classesBase = useStylesBase(); // Order doesn't matter const className = clsx(classes.root, classesBase.root); // color: red 🔴 wins. return <div className={className} />; } ``` Hook 调用顺序和类名顺序**不影响**注入属性权重 。 ### insertionPoint JSS [提供了一种机制](https://github.com/cssinjs/jss/blob/master/docs/setup.md#specify-the-dom-insertion-point) 来控制这种情况。 通过在 HTML 中添加 `insertionPoint`,您就可以[控制](https://cssinjs.org/jss-api#attach-style-sheets-in-a-specific-order) CSS 规则应用到组件中的顺序。 #### HTML 注释 最简单的方法是在 `<head>` 中添加一个 HTML 注释,来决定 JSS 注入样式的位置: ```html <head> <!-- jss-insertion-point --> <link href="..." /> </head> ``` ```jsx import { create } from 'jss'; import { StylesProvider, jssPreset } from '@material-ui/styles'; const jss = create({ ...jssPreset(), // Define a custom insertion point that JSS will look for when injecting the styles into the DOM. insertionPoint: 'jss-insertion-point', }); export default function App() { return <StylesProvider jss={jss}>...</StylesProvider>; } ``` #### 其他 HTML 元素 在构建生产环境时,[Create React App](https://github.com/facebook/create-react-app) 会移除 HTML 注释。 为了解决这个问题,您可以提供一个 DOM 元素(而不是一条注释)作为 JSS 插入点 ,譬如一个 `<noscript>` 元素。 ```jsx <head> <noscript id="jss-insertion-point" /> <link href="..." /> </head> ``` ```jsx import { create } from 'jss'; import { StylesProvider, jssPreset } from '@material-ui/styles'; const jss = create({ ...jssPreset(), // Define a custom insertion point that JSS will look for when injecting the styles into the DOM. insertionPoint: document.getElementById('jss-insertion-point'), }); export default function App() { return <StylesProvider jss={jss}>...</StylesProvider>; } ``` #### JS createComment codesandbox.io 阻止访问 `<head>` 元素。 要解决这个问题,您可以使用 JavaScript 中的 `document.createComment()` API。 ```jsx import { create } from 'jss'; import { StylesProvider, jssPreset } from '@material-ui/styles'; const styleNode = document.createComment('jss-insertion-point'); document.head.insertBefore(styleNode, document.head.firstChild); const jss = create({ ...jssPreset(), // Define a custom insertion point that JSS will look for when injecting the styles into the DOM. insertionPoint: 'jss-insertion-point', }); export default function App() { return <StylesProvider jss={jss}>...</StylesProvider>; } ``` ## 服务端渲染 This example returns a string of HTML and inlines the critical CSS required, right before it's used: ```jsx import ReactDOMServer from 'react-dom/server'; import { ServerStyleSheets } from '@material-ui/styles'; function render() { const sheets = new ServerStyleSheets(); const html = ReactDOMServer.renderToString(sheets.collect(<App />)); const css = sheets.toString(); return ` <!DOCTYPE html> <html> <head> <style id="jss-server-side">${css}</style> </head> <body> <div id="root">${html}</div> </body> </html> `; } ``` 您可以[根据这篇服务端渲染指南](/guides/server-rendering/)来获取更多详细的例子,或者您也可以阅读 [`ServerStyleSheets` 的 API 文档](/styles/api/#serverstylesheets)。 ### Gatsby 这个 [官方的 Gatsby 插件](https://github.com/hupe1980/gatsby-plugin-material-ui),可以利用它来实现 `@material-ui/style` 的服务器端渲染。 请参考插件页面的设置和使用说明。 <!-- #default-branch-switch --> 请参考 [Gatsby 项目案例](https://github.com/mui-org/material-ui/blob/next/examples/gatsby) 以了解最新的使用方法。 ### Next.js 您需要有一个自定义的 `pages/_document.js`,然后复制 [此逻辑](https://github.com/mui-org/material-ui/blob/814fb60bbd8e500517b2307b6a297a638838ca89/examples/nextjs/pages/_document.js#L52-L59) 以注入服务器侧渲染的样式到 `<head>` 元素中。 请参考 [示例项目](https://github.com/mui-org/material-ui/blob/next/examples/nextjs) 以获取最新的使用方法。 ## 类名(Class names) 类名(class names)由 [类名生成器](/styles/api/#creategenerateclassname-options-class-name-generator) 生成。 ### 默认值 默认情况下,`@material-ui/core/styles` 生成的类名 **不是固定值**; 所以你不能指望它们保持不变。 让我们以下面的样式(style)作为示例: ```js const useStyles = makeStyles({ root: { opacity: 1, }, }); ``` 上述例子将生成一个类似于 `makeStyles-root-123` 这样的类名。 您必须使用组件的 `classes` 属性来覆盖样式。 类名的不确定性使样式隔离成为可能。 - 在**开发环境中**,类名为:`.makeStyles-root-123`,它遵循以下逻辑: ```js const sheetName = 'makeStyles'; const ruleName = 'root'; const identifier = 123; const className = `${sheetName}-${ruleName}-${identifier}`; ``` - 在**生产环境中**,类名为:`.jss123`,它遵循以下逻辑: ```js const productionPrefix = 'jss'; const identifier = 123; const className = `${productionPrefix}-${identifier}`; ``` ### 与 `@material-ui/core` 一起使用 `@material-ui/core` 组件生成的类名表现大相径庭。 当满足以下条件时,类名是 **确定的**: - 仅使用一个主题提供程序(**无主题嵌套**)。 - 样式表的名称以 `Mui` 开头(包含所有 Material-UI 组件)。 - [类名生成器](/styles/api/#creategenerateclassname-options-class-name-generator)的 `disableGlobal` 选项为 `false`(默认值)。 `@material-ui/core` 最常见的用例可以满足这些条件。 例如,在这个样式表中: ```jsx const useStyles = makeStyles( { root: { /* … */ }, label: { /* … */ }, outlined: { /* … */ '&$disabled': { /* … */ }, }, outlinedPrimary: { /* … */ '&:hover': { /* … */ }, }, disabled: {}, }, { name: 'MuiButton' }, ); ``` 这将生成以下您可以进行覆盖操作的类名: ```css .MuiButton-root { /* … */ } .MuiButton-label { /* … */ } .MuiButton-outlined { /* … */ } .MuiButton-outlined.Mui-disabled { /* … */ } .muibutton-outlinedprimary: { /* … */ } .MuiButton-outlinedPrimary:hover { /* … */ } ``` _这是对 `@material-ui/core/Button` 组件样式表的简化。_ 使用 [`classes` API](#overriding-styles-classes-prop) 来自定义 TextField 可能会很麻烦,所以你必须定义类属性(classes prop)。 如上文所述,使用默认值会比较容易。 例如: ```jsx import styled from 'styled-components'; import { TextField } from '@material-ui/core'; const StyledTextField = styled(TextField)` label.focused { color: green; 💚 } .MuiOutlinedInput-root { fieldset { border-color: red; 💔 } &:hover fieldset { border-color: yellow; 💛 } &.Mui-focused fieldset { border-color: green; 💚 } } `; ``` {{"demo": "pages/styles/advanced/GlobalClassName.js"}} ## 全局 CSS ### `jss-plugin-global` [`jss-plugin-global`](#jss-plugins) 插件安装在默认的预设中。 您可以使用它来定义全局类名称。 {{"demo": "pages/styles/advanced/GlobalCss.js"}} ### 混合 您也可以将 JSS 生成的类名称与全局名称结合起来。 {{"demo": "pages/styles/advanced/HybridGlobalCss.js"}} ## CSS 前缀(prefixes) JSS 使用特征探测来应用正确的前缀。 如果您看不到最新版本 Chrome 中显示一个特定前缀,[请不要感到惊讶](https://github.com/mui-org/material-ui/issues/9293)。 您的浏览器可能不需要它。
Java
'use strict'; var gulp = require('gulp'); var autoprefixer = require('jstransformer')(require('jstransformer-stylus')); var autoprefixer = require('autoprefixer-stylus'); var browserSync = require('browser-sync').create(); var changed = require('gulp-changed'); var concat = require('gulp-concat'); var cssbeautify = require('gulp-cssbeautify'); var csscomb = require('gulp-csscomb'); var csso = require('gulp-csso'); var data = require('gulp-data'); var del = require('del'); var filter = require('gulp-filter'); var flatten = require('gulp-flatten'); var gulpZip = require('gulp-zip'); var gulpif = require('gulp-if'); var gutil = require('gulp-util'); var htmlPrettify = require('gulp-prettify'); var imagemin = require('gulp-imagemin'); var imageminPngquant = require('imagemin-pngquant'); var imageminSvgo = require('imagemin-svgo'); var include = require('gulp-include'); var jade = require('gulp-jade'); var jadeInheritance = require('gulp-jade-inheritance'); var path = require('path'); var plumber = require('gulp-plumber'); var rename = require('gulp-rename'); var runSequence = require('run-sequence'); var rupture = require('rupture'); var stylus = require('gulp-stylus'); var svgSymbols = require('gulp-svg-symbols'); var uglify = require('gulp-uglify'); var watch = require('gulp-watch'); var gcmq = require('gulp-combine-mq'); // Error handler for gulp-plumber var errorHandler = function (err) { gutil.log([(err.name + ' in ' + err.plugin).bold.red, '', err.message, ''].join('\n')); if (gutil.env.beep) { gutil.beep(); } this.emit('end'); }; // Print object in console var debugObj = function (obj) { var util = require('util'); console.log(util.inspect(obj, {showHidden: false, depth: null})); }; // Read file and return object var getData = function getData (file) { var dataEntry; var data; var dataTmp; var fs = require('fs'); try { dataEntry = fs.readFileSync(file, 'utf8'); } catch (er) { dataEntry = false; } dataTmp = '{' + dataEntry + '}'; if (dataEntry) { // eval('data = {' + dataEntry + '}'); data = JSON.parse(dataTmp); } else { data = '{}'; } return data; }; var correctNumber = function correctNumber(number) { return number < 10 ? '0' + number : number; }; // Return timestamp var getDateTime = function getDateTime() { var now = new Date(); var year = now.getFullYear(); var month = correctNumber(now.getMonth() + 1); var day = correctNumber(now.getDate()); var hours = correctNumber(now.getHours()); var minutes = correctNumber(now.getMinutes()); return year + '-' + month + '-' + day + '-' + hours + minutes; }; // Plugins options var options = { del: [ 'dest', 'tmp' ], plumber: { errorHandler: errorHandler }, browserSync: { server: { baseDir: './dest' } }, stylus: { use: [ rupture(), autoprefixer({ browsers: ['last 2 version', '> 1%', 'safari 5', 'ie 8', 'ie 7', 'opera 12.1', 'ios 6', 'android 4'], cascade: false }) ] }, cssbeautify: { indent: '\t', autosemicolon: true }, jade: { pretty: '\t' }, htmlPrettify: { "unformatted": ["pre", "code"], "indent_with_tabs": true, "preserve_newlines": true, "brace_style": "expand", "end_with_newline": true }, svgSymbols: { title: false, id: '%f', className: '%f', templates: [ path.join(__dirname, 'source/static/styles/components/icons-template.styl'), 'default-svg' ] }, imagemin: { optimizationLevel: 3, progressive: true, interlaced: true, svgoPlugins: [{removeViewBox: false}], use: [ imageminPngquant(), imageminSvgo() ] } }; gulp.task('cleanup', function (cb) { return del(options.del, cb); }); gulp.task('browser-sync', function() { return browserSync.init(options.browserSync); }); gulp.task('bs-reload', function (cb) { browserSync.reload(); }); gulp.task('combine-modules-styles', function (cb) { return gulp.src(['**/*.styl', '!**/_*.styl'], {cwd: 'source/modules'}) .pipe(plumber(options.plumber)) .pipe(concat('modules.styl')) .pipe(gulp.dest('tmp')); }); gulp.task('compile-styles', function (cb) { return gulp.src(['*.styl', '!_*.styl'], {cwd: 'source/static/styles'}) .pipe(plumber(options.plumber)) .pipe(stylus(options.stylus)) .pipe(gcmq({beautify: false})) .pipe(cssbeautify(options.cssbeautify)) .pipe(csscomb()) .pipe(gulp.dest('dest/css')) .pipe(csso()) .pipe(rename({suffix: '.min'})) .pipe(gulp.dest('dest/css')) .pipe(browserSync.stream()); }); gulp.task('combine-modules-data', function (cb) { return gulp.src(['**/*.js', '!**/_*.js'], {cwd: 'source/modules/*/data'}) .pipe(plumber(options.plumber)) .pipe(concat('data.js', { newLine: ',\n\n' })) .pipe(gulp.dest('tmp')); }); gulp.task('compile-pages', function (cb) { return gulp.src(['**/*.jade', '!**/_*.jade'], {cwd: 'source/pages'}) .pipe(plumber(options.plumber)) .pipe(data(getData('tmp/data.js'))) .pipe(jade(options.jade)) .pipe(htmlPrettify(options.htmlPrettify)) .pipe(gulp.dest('dest')); }); gulp.task('copy-modules-img', function (cb) { return gulp.src('**/*.{jpg,gif,svg,png}', {cwd: 'source/modules/*/assets'}) .pipe(plumber(options.plumber)) .pipe(changed('dest/img')) .pipe(imagemin(options.imagemin)) .pipe(flatten()) .pipe(gulp.dest('dest/img')); }); gulp.task('combine-modules-scripts', function (cb) { return gulp.src(['*.js', '!_*.js'], {cwd: 'source/modules/*'}) .pipe(plumber(options.plumber)) .pipe(concat('modules.js', { newLine: '\n\n' })) .pipe(gulp.dest('tmp')); }); gulp.task('copy-assets', function (cb) { var imageFilter = filter('**/*.{jpg,gif,svg,png}', {restore: true}); var scriptsFilter = filter(['**/*.js', '!**/*.min.js'], {restore: true}); var stylesFilter = filter(['**/*.css', '!**/*.min.css'], {restore: true}); return gulp.src(['**/*.*', '!**/_*.*'], {cwd: 'source/static/assets'}) .pipe(plumber(options.plumber)) .pipe(changed('dest')) // Minify images .pipe(imageFilter) .pipe(changed('dest')) .pipe(imagemin(options.imagemin)) .pipe(imageFilter.restore) // Minify JavaScript files .pipe(scriptsFilter) .pipe(gulp.dest('dest')) .pipe(uglify()) .pipe(rename({suffix: '.min'})) .pipe(scriptsFilter.restore) // Minify css .pipe(stylesFilter) .pipe(csso()) .pipe(rename({suffix: '.min'})) .pipe(stylesFilter.restore) // Copy other files .pipe(gulp.dest('dest')); }); gulp.task('combine-scripts', function (cb) { return gulp.src(['*.js', '!_*.js'], {cwd: 'source/static/scripts'}) .pipe(plumber(options.plumber)) .pipe(include()) .pipe(gulp.dest('dest/js')) .pipe(uglify()) .pipe(rename({suffix: '.min'})) .pipe(gulp.dest('dest/js')); }); gulp.task('combine-svg-icons', function (cb) { return gulp.src(['**/*.svg', '!**/_*.svg'], {cwd: 'source/static/icons'}) .pipe(plumber(options.plumber)) .pipe(imagemin(options.imagemin)) .pipe(svgSymbols(options.svgSymbols)) .pipe(gulpif(/\.styl$/, gulp.dest('tmp'))) .pipe(gulpif(/\.svg$/, rename('icons.svg'))) .pipe(gulpif(/\.svg$/, gulp.dest('dest/img'))); }); gulp.task('build-zip', function() { var datetime = '-' + getDateTime(); var zipName = 'dist' + datetime + '.zip'; return gulp.src('dest/**/*') .pipe(gulpZip(zipName)) .pipe(gulp.dest('zip')); }); gulp.task('build-html', function (cb) { return runSequence( 'combine-modules-data', 'compile-pages', cb ); }); gulp.task('build-css', function (cb) { return runSequence( 'combine-modules-styles', 'compile-styles', cb ); }); gulp.task('build-js', function (cb) { return runSequence( 'combine-modules-scripts', 'combine-scripts', cb ); }); gulp.task('build', function (cb) { return runSequence( 'cleanup', 'combine-svg-icons', [ 'build-html', 'copy-modules-img', 'copy-assets', 'build-css', 'build-js' ], cb ); }); gulp.task('zip', function (cb) { return runSequence( 'build', 'build-zip', cb ); }); gulp.task('develop', function (cb) { return runSequence( 'build', 'browser-sync', cb ); }); gulp.task('dev', ['develop'], function (cb) { // Modules, pages watch('source/**/*.jade', function() { return runSequence('compile-pages', browserSync.reload); }); // Modules data watch('source/modules/*/data/*.js', function() { return runSequence('build-html', browserSync.reload); }); // Static styles watch('source/static/styles/**/*.styl', function() { // return runSequence('compile-styles'); gulp.start('compile-styles'); }); // Modules styles watch('source/modules/**/*.styl', function() { // return runSequence('build-css'); gulp.start('build-css'); }); // Static scripts watch('source/static/scripts/**/*.js', function() { return runSequence('combine-scripts', browserSync.reload); }); // Modules scripts watch('source/modules/*/*.js', function() { return runSequence('build-js', browserSync.reload); }); // Modules images watch('source/modules/*/assets/**/*.{jpg,gif,svg,png}', function() { return runSequence('copy-modules-img', browserSync.reload); }); // Static files watch('source/static/assets/**/*', function() { return runSequence('copy-assets', browserSync.reload); }); // Svg icons watch('source/static/icons/**/*.svg', function() { return runSequence('combine-svg-icons', browserSync.reload); }); });
Java
<?php namespace Lib\Router\Exception; class NotFoundException extends \Exception{}
Java
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2015 The Bitcoin developers // Copyright (c) 2015-2020 The Bitcoin Unlimited developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_POLICY_POLICY_H #define BITCOIN_POLICY_POLICY_H #include "consensus/consensus.h" #include "script/interpreter.h" #include "script/standard.h" #include <string> class CCoinsViewCache; /** Default for -blockmaxsize and -blockminsize, which control the range of sizes the mining code will create **/ // this is now set in chain params static const unsigned int DEFAULT_BLOCK_MAX_SIZE_REGTEST = 1000; static const unsigned int DEFAULT_BLOCK_MAX_SIZE = 8 * ONE_MEGABYTE; static const unsigned int DEFAULT_BLOCK_MAX_SIZE_TESTNET4 = 2 * ONE_MEGABYTE; static const unsigned int DEFAULT_BLOCK_MAX_SIZE_SCALENET = 256 * ONE_MEGABYTE; // Maximum number of mining candidates that this node will remember simultaneously static const unsigned int DEFAULT_MAX_MINING_CANDIDATES = 10; // Send an existing mining candidate if a request comes in within this many seconds of its construction static const unsigned int DEFAULT_MIN_CANDIDATE_INTERVAL = 30; /** Default for -blockprioritysize for priority or zero/low-fee transactions **/ static const unsigned int DEFAULT_BLOCK_PRIORITY_SIZE = 0; /** The maximum size for transactions we're willing to relay/mine */ static const unsigned int MAX_STANDARD_TX_SIZE = 100000; /** * Biggest 'standard' txin is a 15-of-15 P2SH multisig with compressed * keys (remember the 520 byte limit on redeemScript size). That works * out to a (15*(33+1))+3=513 byte redeemScript, 513+1+15*(73+1)+3=1627 * bytes of scriptSig, which we round off to 1650 bytes for some minor * future-proofing. That's also enough to spend a 20-of-20 CHECKMULTISIG * scriptPubKey, though such a scriptPubKey is not considered standard. */ static constexpr unsigned int MAX_TX_IN_SCRIPT_SIG_SIZE = 1650; /** Maximum number of signature check operations in an IsStandard() P2SH script */ static const unsigned int MAX_P2SH_SIGOPS = 15; /** The maximum number of sigops we're willing to relay/mine in a single tx */ static const unsigned int MAX_STANDARD_TX_SIGOPS = MAX_TX_SIGOPS_COUNT / 5; /** Default for -maxmempool, maximum megabytes of mempool memory usage */ static const unsigned int DEFAULT_MAX_MEMPOOL_SIZE = 300; /** Dust threshold in satoshis. Historically this value was calculated as * minRelayTxFee/1000 * 546. However now we just allow the operator to set * a simple dust threshold independant of any other value or relay fee. */ static const unsigned int DEFAULT_DUST_THRESHOLD = 546; /** * Standard script verification flags that standard transactions will comply * with. However scripts violating these flags may still be present in valid * blocks and we must accept those blocks. */ /* clang-format off */ static const unsigned int STANDARD_SCRIPT_VERIFY_FLAGS = MANDATORY_SCRIPT_VERIFY_FLAGS | SCRIPT_VERIFY_DERSIG | SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS | SCRIPT_VERIFY_CLEANSTACK | SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY | SCRIPT_VERIFY_CHECKSEQUENCEVERIFY | SCRIPT_VERIFY_SIGPUSHONLY | SCRIPT_ENABLE_CHECKDATASIG | SCRIPT_DISALLOW_SEGWIT_RECOVERY; /* clang-format on */ /** For convenience, standard but not mandatory verify flags. */ static const unsigned int STANDARD_NOT_MANDATORY_VERIFY_FLAGS = STANDARD_SCRIPT_VERIFY_FLAGS & ~MANDATORY_SCRIPT_VERIFY_FLAGS; /** Used as the flags parameter to sequence and nLocktime checks in non-consensus code. */ static const unsigned int STANDARD_LOCKTIME_VERIFY_FLAGS = LOCKTIME_VERIFY_SEQUENCE | LOCKTIME_MEDIAN_TIME_PAST; bool IsStandard(const CScript &scriptPubKey, txnouttype &whichType); /** * Check for standard transaction types * @return True if all outputs (scriptPubKeys) use only standard transaction forms */ bool IsStandardTx(const CTransactionRef tx, std::string &reason); /** * Check for standard transaction types * @param[in] mapInputs Map of previous transactions that have outputs we're spending * @return True if all inputs (scriptSigs) use only standard transaction forms */ bool AreInputsStandard(const CTransactionRef tx, const CCoinsViewCache &mapInputs, bool isMay2020Enabled); #endif // BITCOIN_POLICY_POLICY_H
Java
using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Threading.Tasks; namespace Lab2A.Models.AccountViewModels { public class LoginViewModel { [Required] [EmailAddress] public string Email { get; set; } [Required] [DataType(DataType.Password)] public string Password { get; set; } [Display(Name = "Remember me?")] public bool RememberMe { get; set; } } }
Java
######################################## # Automatically generated, do not edit. ######################################## from pyvisdk.thirdparty import Enum DatastoreSummaryMaintenanceModeState = Enum( 'enteringMaintenance', 'inMaintenance', 'normal', )
Java
import Ember from 'ember'; import PaginatedScrollViewMixin from 'kowa/mixins/paginated-scroll-view'; var PaginatedScrollBox = Ember.View.extend(PaginatedScrollViewMixin); export default PaginatedScrollBox;
Java