answer
stringlengths
15
1.25M
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="robots" content="index, follow, all" /> <title>Valit\Logic\BaseLogic | Valit API</title> <link rel="stylesheet" type="text/css" href="../../css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="../../css/bootstrap-theme.min.css"> <link rel="stylesheet" type="text/css" href="../../css/sami.css"> <script src="../../js/jquery-1.11.1.min.js"></script> <script src="../../js/bootstrap.min.js"></script> <script src="../../js/typeahead.min.js"></script> <script src="../../sami.js"></script> <meta name="MobileOptimized" content="width"> <meta name="HandheldFriendly" content="true"> <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1"> </head> <body id="class" data-name="class:<API key>" data-root-path="../../"> <div id="content"> <div id="left-column"> <div id="control-panel"> <form action="#" method="GET"> <select id="version-switcher" name="version"> <option value="../../../2.0.0-alpha/index.html" data-version="2.0.0-alpha">2.0.0-alpha</option> <option value="../../../2.0.0/index.html" data-version="2.0.0">2.0.0</option> <option value="../../../2.0.1/index.html" data-version="2.0.1">2.0.1</option> <option value="../../../1.0.0/index.html" data-version="1.0.0">1.0.0</option> <option value="../../../1.0.1/index.html" data-version="1.0.1">1.0.1</option> <option value="../../../1.0.2/index.html" data-version="1.0.2">1.0.2</option> <option value="../../../0.8.0/index.html" data-version="0.8.0">0.8.0</option> <option value="../../../0.8.1/index.html" data-version="0.8.1">0.8.1</option> <option value="../../../master/index.html" data-version="master">master dev branch</option> </select> </form> <script> $('option[data-version="'+window.projectVersion+'"]').prop('selected', true); </script> <form id="search-form" action="../../search.html" method="GET"> <span class="glyphicon glyphicon-search"></span> <input name="search" class="typeahead form-control" type="search" placeholder="Search"> </form> </div> <div id="api-tree"></div> </div> <div id="right-column"> <nav id="site-nav" class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-elements"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="../../index.html">Valit API</a> </div> <div class="collapse navbar-collapse" id="navbar-elements"> <ul class="nav navbar-nav"> <li><a href="../../classes.html">Classes</a></li> <li><a href="../../namespaces.html">Namespaces</a></li> <li><a href="../../interfaces.html">Interfaces</a></li> <li><a href="../../traits.html">Traits</a></li> <li><a href="../../doc-index.html">Index</a></li> <li><a href="../../search.html">Search</a></li> </ul> </div> </div> </nav> <div class="<API key>"> <ol class="breadcrumb"> <li><span class="label label-default">class</span></li> <li><a href="../../Valit.html">Valit</a></li><li class="backslash">\</li><li><a href="../../Valit/Logic.html">Logic</a></li><li class="backslash">\</li><li>BaseLogic</li> </ol> </div> <div id="page-content"> <div class="page-header"> <h1> BaseLogic </h1> </div> <p>abstract class <strong>BaseLogic</strong> implements <a href="../../Valit/Contracts/Logic.html"><abbr title="Valit\Contracts\Logic">Logic</abbr></a>, <a href="../../Valit/Contracts/Result.html"><abbr title="Valit\Contracts\Result">Result</abbr></a> (<a href="https://github.com/moccalotto/valit/blob/2.0.1/Volumes/Macintosh HD/Code/github.com/moccalotto/valit/Logic/BaseLogic.php">View source</a>) </p> <h2>Properties</h2> <table class="table table-condensed"> <tr> <td class="type" id="property_executor"> <a href="../../Valit/Logic/Executor.html"><abbr title="Valit\Logic\Executor">Executor</abbr></a> </td> <td>$executor</td> <td class="last">Internal.</td> <td></td> </tr> <tr> <td class="type" id="<API key>"> <a href="../../Valit/Result/AssertionResult.html"><abbr title="Valit\Result\AssertionResult">AssertionResult</abbr></a>|null </td> <td>$cachedResult</td> <td class="last">Intenral: The result generated when execute() was called last.</td> <td></td> </tr> <tr> <td class="type" id="property_hasValue"> bool </td> <td>$hasValue</td> <td class="last">Internal: The $hasValue when execute() was called last.</td> <td></td> </tr> <tr> <td class="type" id="property_value"> mixed </td> <td>$value</td> <td class="last">The $value when execute() was called last.</td> <td></td> </tr> </table> <h2>Methods</h2> <div class="container-fluid underlined"> <div class="row"> <div class="col-md-2 type"> </div> <div class="col-md-8 type"> <a href=" <p>Constructor.</p> </div> <div class="col-md-2"></div> </div> <div class="row"> <div class="col-md-2 type"> string </div> <div class="col-md-8 type"> <a href="#method_requires">requires</a>() <p>The requirements of this logic.</p> </div> <div class="col-md-2"></div> </div> <div class="row"> <div class="col-md-2 type"> <a href="../../Valit/Result/AssertionResult.html"><abbr title="Valit\Result\AssertionResult">AssertionResult</abbr></a> </div> <div class="col-md-8 type"> <a href="#method_execute">execute</a>(bool $hasValue = false, mixed $value = null) <p>Execute the logic.</p> </div> <div class="col-md-2"></div> </div> <div class="row"> <div class="col-md-2 type"> bool </div> <div class="col-md-8 type"> <a href="#method_success">success</a>() <p>Did the validations succeed?</p> </div> <div class="col-md-2"></div> </div> <div class="row"> <div class="col-md-2 type"> <a href="../../Valit/Result/AssertionResult.html"><abbr title="Valit\Result\AssertionResult">AssertionResult</abbr></a> </div> <div class="col-md-8 type"> <a href="#method_withValue">withValue</a>(mixed $value) <p>Execute the logic with a given value.</p> </div> <div class="col-md-2"></div> </div> <div class="row"> <div class="col-md-2 type"> <a href="../../Valit/Result/AssertionResult.html"><abbr title="Valit\Result\AssertionResult">AssertionResult</abbr></a> </div> <div class="col-md-8 type"> <a href="#method_whereValueIs">whereValueIs</a>(mixed $value) <p>Alias of withValue.</p> </div> <div class="col-md-2"></div> </div> <div class="row"> <div class="col-md-2 type"> <a href="../../Valit/Result/AssertionResult.html"><abbr title="Valit\Result\AssertionResult">AssertionResult</abbr></a> </div> <div class="col-md-8 type"> <a href="#method_withoutValue">withoutValue</a>() <p>Execute the logic without a value.</p> </div> <div class="col-md-2"></div> </div> <div class="row"> <div class="col-md-2 type"> array </div> <div class="col-md-8 type"> <a href=" <p>Clear debug info.</p> </div> <div class="col-md-2"></div> </div> <div class="row"> <div class="col-md-2 type"> <a href="../../Valit/Result/AssertionResult.html"><abbr title="Valit\Result\AssertionResult">AssertionResult</abbr></a> </div> <div class="col-md-8 type"> <a href="#method_makeResult">makeResult</a>() <p>Internal: create the result.</p> </div> <div class="col-md-2"></div> </div> </div> <h2>Details</h2> <div id="method-details"> <div class="method-item"> <h3 id="method___construct"> <div class="location">at <a href="https://github.com/moccalotto/valit/blob/2.0.1/Volumes/Macintosh HD/Code/github.com/moccalotto/valit/Logic/BaseLogic.php#L50">line 50</a></div> <code> <strong>__construct</strong>(<a href="../../Valit/Manager.html"><abbr title="Valit\Manager">Manager</abbr></a> $manager, <a target="_blank" href="http://php.net/Traversable">Traversable</a>|array $scenarios) </code> </h3> <div class="details"> <div class="method-description"> <p>Constructor.</p> </div> <div class="tags"> <h4>Parameters</h4> <table class="table table-condensed"> <tr> <td><a href="../../Valit/Manager.html"><abbr title="Valit\Manager">Manager</abbr></a></td> <td>$manager</td> <td></td> </tr> <tr> <td><a target="_blank" href="http://php.net/Traversable">Traversable</a>|array</td> <td>$scenarios</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_requires"> <div class="location">at <a href="https://github.com/moccalotto/valit/blob/2.0.1/Volumes/Macintosh HD/Code/github.com/moccalotto/valit/Logic/BaseLogic.php#L62">line 62</a></div> <code> string <strong>requires</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p>The requirements of this logic.</p> <p>It can be 'none', 'simple value' or 'container'</p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>string</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_execute"> <div class="location">at <a href="https://github.com/moccalotto/valit/blob/2.0.1/Volumes/Macintosh HD/Code/github.com/moccalotto/valit/Logic/BaseLogic.php#L75">line 75</a></div> <code> <a href="../../Valit/Result/AssertionResult.html"><abbr title="Valit\Result\AssertionResult">AssertionResult</abbr></a> <strong>execute</strong>(bool $hasValue = false, mixed $value = null) </code> </h3> <div class="details"> <div class="method-description"> <p>Execute the logic.</p> </div> <div class="tags"> <h4>Parameters</h4> <table class="table table-condensed"> <tr> <td>bool</td> <td>$hasValue</td> <td></td> </tr> <tr> <td>mixed</td> <td>$value</td> <td></td> </tr> </table> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td><a href="../../Valit/Result/AssertionResult.html"><abbr title="Valit\Result\AssertionResult">AssertionResult</abbr></a></td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_success"> <div class="location">at <a href="https://github.com/moccalotto/valit/blob/2.0.1/Volumes/Macintosh HD/Code/github.com/moccalotto/valit/Logic/BaseLogic.php#L101">line 101</a></div> <code> bool <strong>success</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p>Did the validations succeed?</p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>bool</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_withValue"> <div class="location">at <a href="https://github.com/moccalotto/valit/blob/2.0.1/Volumes/Macintosh HD/Code/github.com/moccalotto/valit/Logic/BaseLogic.php#L117">line 117</a></div> <code> <a href="../../Valit/Result/AssertionResult.html"><abbr title="Valit\Result\AssertionResult">AssertionResult</abbr></a> <strong>withValue</strong>(mixed $value) </code> </h3> <div class="details"> <div class="method-description"> <p>Execute the logic with a given value.</p> </div> <div class="tags"> <h4>Parameters</h4> <table class="table table-condensed"> <tr> <td>mixed</td> <td>$value</td> <td></td> </tr> </table> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td><a href="../../Valit/Result/AssertionResult.html"><abbr title="Valit\Result\AssertionResult">AssertionResult</abbr></a></td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_whereValueIs"> <div class="location">at <a href="https://github.com/moccalotto/valit/blob/2.0.1/Volumes/Macintosh HD/Code/github.com/moccalotto/valit/Logic/BaseLogic.php#L129">line 129</a></div> <code> <a href="../../Valit/Result/AssertionResult.html"><abbr title="Valit\Result\AssertionResult">AssertionResult</abbr></a> <strong>whereValueIs</strong>(mixed $value) </code> </h3> <div class="details"> <div class="method-description"> <p>Alias of withValue.</p> </div> <div class="tags"> <h4>Parameters</h4> <table class="table table-condensed"> <tr> <td>mixed</td> <td>$value</td> <td></td> </tr> </table> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td><a href="../../Valit/Result/AssertionResult.html"><abbr title="Valit\Result\AssertionResult">AssertionResult</abbr></a></td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_withoutValue"> <div class="location">at <a href="https://github.com/moccalotto/valit/blob/2.0.1/Volumes/Macintosh HD/Code/github.com/moccalotto/valit/Logic/BaseLogic.php#L139">line 139</a></div> <code> <a href="../../Valit/Result/AssertionResult.html"><abbr title="Valit\Result\AssertionResult">AssertionResult</abbr></a> <strong>withoutValue</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p>Execute the logic without a value.</p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td><a href="../../Valit/Result/AssertionResult.html"><abbr title="Valit\Result\AssertionResult">AssertionResult</abbr></a></td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method___debugInfo"> <div class="location">at <a href="https://github.com/moccalotto/valit/blob/2.0.1/Volumes/Macintosh HD/Code/github.com/moccalotto/valit/Logic/BaseLogic.php#L149">line 149</a></div> <code> array <strong>__debugInfo</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p>Clear debug info.</p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td>array</td> <td></td> </tr> </table> </div> </div> </div> <div class="method-item"> <h3 id="method_makeResult"> <div class="location">at <a href="https://github.com/moccalotto/valit/blob/2.0.1/Volumes/Macintosh HD/Code/github.com/moccalotto/valit/Logic/BaseLogic.php#L166">line 166</a></div> <code> abstract <a href="../../Valit/Result/AssertionResult.html"><abbr title="Valit\Result\AssertionResult">AssertionResult</abbr></a> <strong>makeResult</strong>() </code> </h3> <div class="details"> <div class="method-description"> <p>Internal: create the result.</p> </div> <div class="tags"> <h4>Return Value</h4> <table class="table table-condensed"> <tr> <td><a href="../../Valit/Result/AssertionResult.html"><abbr title="Valit\Result\AssertionResult">AssertionResult</abbr></a></td> <td></td> </tr> </table> </div> </div> </div> </div> </div> <div id="footer"> Generated by <a href="http://sami.sensiolabs.org/">Sami, the API Documentation Generator</a>. </div> </div> </div> </body> </html>
namespace <API key> { public class Book { public Book(string title, string publisher) { Title = title; Publisher = publisher; } public string Title { get; } public string Publisher { get; } public override string ToString() => Title; } }
layout: post title: "Kurtosis" date: 2016-03-28 22:44:01 categories: statistics fourth momentum of returns: $$ t = x - mean(x) $$ $$ m = mean(t ^ 4) $$ $$ s = mean(t ^ 2) $$ $$ kurtosis = \frac{m}{s^2} $$ A normal distribution has a kurtosis of 3. If kurtosis < 3 then the distribution is `platykurtic` (looks flatter than normal distr., more mass in the centre, has smaller tails), if kurtosis > 3 then the disitribution is said to be `leptokurtic` (more peaked than normal distr. and larger tails!).
<?php namespace App\Http\Requests; use App\Models\User; use Despark\Cms\Http\Requests\AdminFormRequest; class <API key> extends AdminFormRequest { public function __construct() { $this->model = new User(); } /** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { return true; } /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { return User::$rulesProfileEdit; } }
import Test.HUnit import Q11 import Q12 assertEqualIntList :: String -> [Int] -> [Int] -> Assertion assertEqualIntList = assertEqual test1 = TestCase (assertEqualIntList "decodeModified [] should be [] ." ([] ) (decodeModified [] )) test2 = TestCase (assertEqualIntList "decodeModified [(Single 1)] should be [1] ." ([1] ) (decodeModified [(Single 1)] )) test3 = TestCase (assertEqualIntList "decodeModified [(Single 1),(Single 2)] should be [1,2] ." ([1,2] ) (decodeModified [(Single 1),(Single 2)] )) test4 = TestCase (assertEqualIntList "decodeModified [(Single 1),(Single 2),(Single 1)] should be [1,2,1]." ([1,2,1]) (decodeModified [(Single 1),(Single 2),(Single 1)])) test5 = TestCase (assertEqualIntList "decodeModified [(Multiple 2 1),(Single 2)] should be [1,1,2]." ([1,1,2]) (decodeModified [(Multiple 2 1),(Single 2)] )) test6 = TestCase (assertEqualIntList "decodeModified [(Single 1),(Multiple 2 2)] should be [1,2,2]." ([1,2,2]) (decodeModified [(Single 1),(Multiple 2 2)] )) main = runTestTT $ TestList [test1,test2,test3,test4,test5,test6]
# Infoblox IPAM plugin changelog ## v1.0 - Support for the record:host object type.
using System; using MongoDB.Bson; namespace SeekU.MongoDB { public class SnapshotDetail { public ObjectId Id { get; set; } public Guid AggregateRootId { get; set; } public long Version { get; set; } public object SnapshotData { get; set; } } }
using System; using System.Collections.Generic; using System.Windows.Forms; namespace Idea { static class Program { <summary> </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.<API key>(false); Application.Run(new IdeaForm()); } } }
// CastleDeepEvent.cpp: implementation of the CCastleDeepEvent class. // GS-CS 1.00.18 JPN 0x00593630 - Completed #include "stdafx.h" #include "CastleSiege.h" #include "user.h" #include "TLog.h" #include "CastleDeepEvent.h" #include "configread.h" #include "GameMain.h" using namespace std; CCastleDeepEvent g_CastleDeepEvent; CCastleDeepEvent::CCastleDeepEvent() { this->m_bDoEvent = FALSE; this->m_bHasData = FALSE; srand(time(NULL)); <API key>(&this->m_critEventData); } CCastleDeepEvent::~CCastleDeepEvent() { <API key>(&this->m_critEventData); } void CCastleDeepEvent::StartEvent() { if (m_vtAssultType.size() <= 0) { g_Log.Add("[CastleDeep Event] Start Fail - No Assult Data"); SetState(CD_STATE_NONE); return; } int iCheckCount = 100; int iASSULT_RATE = 0; int bDoStart = FALSE; while (iCheckCount int iRndIndex = rand() % m_vtAssultType.size(); this->m_iCUR_ASSULT_TYPE = m_vtAssultType[iRndIndex]; iASSULT_RATE = m_vtAssultTypeRate[iRndIndex]; if (rand() % 100 < iASSULT_RATE) { bDoStart = TRUE; break; } } if (bDoStart == FALSE) { g_Log.Add("[CastleDeep Event] Start Fail - bDoStart == FALSE"); SetState(CD_STATE_NONE); return; } this->m_iCUR_SPAWN_STEP = 0; std::map < int, std::vector < <API key> > > ::iterator it = m_mapSpawnTime.find(m_iCUR_ASSULT_TYPE); if (it == m_mapSpawnTime.end()) { SetState(CD_STATE_NONE); return; } m_mapRunCheck.clear(); for (std::vector<<API key>>::iterator it2 = it->second.begin(); it2 != it->second.end(); it2++) { std::vector<<API key>>::iterator stSpawnTime = it2; m_mapRunCheck.insert(pair<int, int>(stSpawnTime->m_iMonsterGroup, stSpawnTime-><API key>)); } } void CCastleDeepEvent::StopEvent() { } void CCastleDeepEvent::Init() { if (g_ConfigRead.server.<API key>(g_ConfigRead.server.GetServerType(), EV_TABLE_DEEP) == false) { this->SetEventEnable(false); } if (this->m_bDoEvent != 0) { this->SetState(CD_STATE_CLOSED); } else { this->SetState(CD_STATE_NONE); } } int CCastleDeepEvent::Load(char *lpszFileName) { pugi::xml_document file; pugi::xml_parse_result res = file.load_file(lpszFileName); if (res.status != pugi::status_ok) { g_Log.MsgBox("[CastleDeep Event] Info file Load Fail [%s] [%s]", lpszFileName, res.description()); return false; } <API key>(&this->m_critEventData); this->m_vtAssultType.clear(); this->m_vtAssultTypeRate.clear(); this->m_mapSpawnTime.clear(); this->m_mapMonsterInfo.clear(); this->m_vtEventTime.clear(); this->m_mapRunCheck.clear(); <API key>(&this->m_critEventData); this->m_bHasData = FALSE; pugi::xml_node main = file.child("LorenDeepEvent"); this->m_bDoEvent = g_ConfigRead.server.<API key>(g_ConfigRead.server.GetServerType(), EV_TABLE_DEEP) == true ? main.attribute("Enable").as_int() : false; pugi::xml_node schedule = main.child("Schedule"); for (pugi::xml_node start = schedule.child("Start"); start; start = start.next_sibling()) { <API key> pRET; pRET.m_iHour = start.attribute("Hour").as_int(); pRET.m_iMinute = start.attribute("Minute").as_int(); this->m_vtEventTime.push_back(pRET); } pugi::xml_node assaulttype = main.child("AssaultTypeSettings"); for (pugi::xml_node assault = assaulttype.child("Assault"); assault; assault = assault.next_sibling()) { vector <<API key>> vtTempMonsterInfo; vector <<API key>> vtTempSpawnTime; int iAssultType; int iAssultRate; iAssultType = assault.attribute("Type").as_int(); iAssultRate = assault.attribute("AppearanceRate").as_int(); this->m_mapMonsterInfo.insert(pair < int, vector < <API key> > > (iAssultType, vtTempMonsterInfo)); this->m_mapSpawnTime.insert(pair < int, vector < <API key> > > (iAssultType, vtTempSpawnTime)); this->m_vtAssultType.push_back(iAssultType); this->m_vtAssultTypeRate.push_back(iAssultRate); } pugi::xml_node assaultgroup = main.child("<API key>"); for (pugi::xml_node assault = assaultgroup.child("Assault"); assault; assault = assault.next_sibling()) { <API key> stSpawnTime; int iAssultType; iAssultType = assault.attribute("Type").as_int(); stSpawnTime.m_iMonsterGroup = assault.attribute("MonsterGroup").as_int(); stSpawnTime.<API key> = assault.attribute("SpawnTime").as_int(); <API key>(&this->m_critEventData); map < int, vector < <API key> >, less < int > > ::iterator it = this->m_mapSpawnTime.find(iAssultType); if (it != this->m_mapSpawnTime.end()) { it->second.push_back(stSpawnTime); } <API key>(&this->m_critEventData); } pugi::xml_node assaultmember = main.child("AssaultGroupMember"); for (pugi::xml_node assault = assaultmember.child("Assault"); assault; assault = assault.next_sibling()) { <API key> stMonsterInfo; int iAssultType; iAssultType = assault.attribute("Type").as_int(); stMonsterInfo.m_iMonsterGroup = assault.attribute("MonsterGroup").as_int(); stMonsterInfo.m_iMonsterType = assault.attribute("MonsterIndex").as_int(); stMonsterInfo.m_iMonsterNumber = assault.attribute("MonsterCount").as_int(); stMonsterInfo.m_iSX = assault.attribute("StartX").as_int(); stMonsterInfo.m_iSY = assault.attribute("StartY").as_int(); stMonsterInfo.m_iDX = assault.attribute("EndX").as_int(); stMonsterInfo.m_iDY = assault.attribute("EndY").as_int(); <API key>(&this->m_critEventData); map < int, vector < <API key> >, less < int > > ::iterator it = this->m_mapMonsterInfo.find(iAssultType); if (it != this->m_mapMonsterInfo.end()) { it->second.push_back(stMonsterInfo); } <API key>(&this->m_critEventData); } g_Log.Add("%s file load!", lpszFileName); this->m_bHasData = TRUE; return true; } void CCastleDeepEvent::CheckSync() { if (this->m_vtEventTime.empty()) { g_Log.AddC(TColor::Red, "[CastleDeep Event] No Schedule Time Data"); this->SetState(CD_STATE_NONE); return; } _SYSTEMTIME sysTime; GetLocalTime(&sysTime); int iMIN_HOUR = 24; int iMIN_MINUTE = 60; int bTIME_CHANGED = 0; std::vector<<API key>>::iterator it; for (it = this->m_vtEventTime.begin(); it != this->m_vtEventTime.end(); it++) { std::vector<<API key>>::iterator pRET = it; if ((sysTime.wHour * 60 + sysTime.wMinute) < (pRET->m_iHour * 60 + pRET->m_iMinute)) { if ((iMIN_HOUR * 60 + iMIN_MINUTE) > (pRET->m_iHour * 60 + pRET->m_iMinute)) { bTIME_CHANGED = 1; iMIN_HOUR = pRET->m_iHour; iMIN_MINUTE = pRET->m_iMinute; } } } if (bTIME_CHANGED == 0) { for (it = this->m_vtEventTime.begin(), iMIN_HOUR = 24, iMIN_MINUTE = 60; it != this->m_vtEventTime.end(); it++) { std::vector<<API key>>::iterator pRET = it; if ((iMIN_HOUR * 60 + iMIN_MINUTE) > (pRET->m_iHour * 60 + pRET->m_iMinute)) { bTIME_CHANGED = 2; iMIN_HOUR = pRET->m_iHour; iMIN_MINUTE = pRET->m_iMinute; } } } switch (bTIME_CHANGED) { case 1: this->m_iTIME_MSEC_REMAIN = (((iMIN_HOUR * 60) * 60 + iMIN_MINUTE * 60) - ((sysTime.wHour * 60) * 60 + sysTime.wMinute * 60 + sysTime.wSecond)) * 1000; break; case 2: this->m_iTIME_MSEC_REMAIN = ((((iMIN_HOUR + 24) * 60) * 60 + iMIN_MINUTE * 60) - ((sysTime.wHour * 60) * 60 + sysTime.wMinute * 60 + sysTime.wSecond)) * 1000; break; default: g_Log.AddC(TColor::Red, "[CastleDeep Event] No Schedule Time Data"); this->SetState(CD_STATE_NONE); return; } this->m_iTIME_TICK_COUNT = GetTickCount(); g_Log.Add("[CastleDeep Event] Sync Start Time. [%d] min remain (START HOUR:%d, MIN:%d)", this->m_iTIME_MSEC_REMAIN / 60000, iMIN_HOUR, iMIN_MINUTE); this-><API key> = 5; } void CCastleDeepEvent::SetState(int iSTATE) { if (m_iEVENT_STATE < 0 || m_iEVENT_STATE > 2) return; m_iEVENT_STATE = iSTATE; switch (m_iEVENT_STATE) { case 0: SetState_None(); break; case 1: SetState_Closed(); break; case 2: SetState_Playing(); break; } } void CCastleDeepEvent::SetState_None() { this->StopEvent(); } void CCastleDeepEvent::SetState_Closed() { StopEvent(); if (m_bDoEvent != 0) { CheckSync(); } else { SetState(CD_STATE_NONE); } } void CCastleDeepEvent::SetState_Playing() { m_iTIME_MSEC_REMAIN = 0; m_bCheckEnd = 0; m_uCheckEndTick = 0; ClearMonster(); StartEvent(); } void CCastleDeepEvent::Run() { if (m_bDoEvent) { switch (m_iEVENT_STATE) { case 0: ProcState_None(); break; case 1: ProcState_Closed(); break; case 2: ProcState_Playing(); break; } } } void CCastleDeepEvent::ProcState_Closed() { int iTICK_MSEC = GetTickCount() - m_iTIME_TICK_COUNT; if (iTICK_MSEC >= 1000) { m_iTIME_MSEC_REMAIN -= iTICK_MSEC; m_iTIME_TICK_COUNT = GetTickCount(); if (m_bDoEvent != 0) { if (m_iTIME_MSEC_REMAIN <= 300000 && m_iTIME_MSEC_REMAIN > 0 && m_iTIME_MSEC_REMAIN / 60000 != <API key>) { <API key> = m_iTIME_MSEC_REMAIN / 60000; if (<API key> + 1 == 5) { char szTemp[256]; wsprintf(szTemp, Lang.GetText(0, 213)); g_CastleSiege.<API key>(szTemp); } } } g_Log.AddC(TColor::Green, " [CastleDeep Event] ProcState_Closed() LEFT-MIN:%d", m_iTIME_MSEC_REMAIN / 60000); } if (m_iTIME_MSEC_REMAIN <= 0) { char szTemp[256]; wsprintf(szTemp, Lang.GetText(0, 214)); g_CastleSiege.<API key>(szTemp); if (m_bDoEvent != 0) { SetState(CD_STATE_PLAYING); } else { SetState(CD_STATE_NONE); } g_Log.Add("[CastleDeep Event] - Event Started"); } } void CCastleDeepEvent::ProcState_Playing() { using namespace std; int iTICK_MSEC = GetTickCount() - m_iTIME_TICK_COUNT; if (iTICK_MSEC >= 1000) { m_iTIME_MSEC_REMAIN += iTICK_MSEC; m_iTIME_TICK_COUNT = GetTickCount(); for (map<int, int>::iterator it = m_mapRunCheck.begin(); it != m_mapRunCheck.end(); it++) { int iSpawnMin = it->second; if (iSpawnMin == m_iTIME_MSEC_REMAIN / 60000) { AddMonster(m_iCUR_ASSULT_TYPE, it->first); m_mapRunCheck.erase(it); break; } } g_Log.AddC(TColor::Green, "[CastleDeep Event] ProcState_Playing() LEFT-MSEC:%d", m_iTIME_MSEC_REMAIN / 60000); } if (m_mapRunCheck.size() <= 0) { if (m_bCheckEnd == 0) { m_bCheckEnd = 1; m_uCheckEndTick = GetTickCount(); } else { if (m_uCheckEndTick + 600000 < GetTickCount()) { char szTemp[256]; wsprintf(szTemp, Lang.GetText(0, 215)); GSProtocol.AllSendServerMsg(szTemp); if (m_bDoEvent != 0) { SetState(CD_STATE_CLOSED); } else { SetState(CD_STATE_NONE); } } } g_Log.Add("[CastleDeep Event] - Event Ended"); } } void CCastleDeepEvent::ClearMonster() { for (int iIndex = 0; iIndex < g_ConfigRead.server.GetObjectMaxMonster(); iIndex++) { if (gObjIsConnected(iIndex) && gObj[iIndex].m_Attribute == 62) { gObjDel(iIndex); } } } void CCastleDeepEvent::AddMonster(int iAssultType, int iGroup) { map < int, vector < <API key> >, less < int > > ::iterator it = this->m_mapMonsterInfo.find(iAssultType); if (it == this->m_mapMonsterInfo.end()) { return; } std::vector<<API key>>::iterator it2; for (it2 = it->second.begin(); it2 != it->second.end(); it2++) { std::vector<<API key>>::iterator stMonsterInfo = it2; if (stMonsterInfo->m_iMonsterGroup != iGroup) continue; BYTE cSX; BYTE cSY; for (int iMonCount = 0; iMonCount < stMonsterInfo->m_iMonsterNumber; iMonCount++) { if (<API key>(<API key>, (BYTE &) cSX, (BYTE &) cSY, stMonsterInfo->m_iSX, stMonsterInfo->m_iSY, stMonsterInfo->m_iDX, stMonsterInfo->m_iDY, 30) == TRUE) { int result = gObjAddMonster(<API key>); if (result >= 0) { gObj[result].m_PosNum = -1; gObj[result].X = cSX; gObj[result].Y = cSY; gObj[result].MapNumber = <API key>; gObj[result].TX = gObj[result].X; gObj[result].TY = gObj[result].Y; gObj[result].m_OldX = gObj[result].X; gObj[result].m_OldY = gObj[result].Y; gObj[result].Dir = 1; gObj[result].StartX = gObj[result].X; gObj[result].StartY = gObj[result].Y; gObjSetMonster(result, stMonsterInfo->m_iMonsterType); gObj[result].m_Attribute = 62; gObj[result].MaxRegenTime = 0; gObj[result].Dir = rand() % 8; gObj[result].DieRegen = 0; gObj[result].RegenTime = 1; gObj[result].MaxRegenTime = 1000; gObj[result].m_dwLastCheckTick = GetTickCount(); } } } } }
package br.com.cwi.exerciciosdia04; import java.util.List; /** * * @author Michel */ public class MaterialRepositorio implements IRepositorio<Material>{ @Override public void insert(Material material) { ManagerUtils.session.persist(material); } @Override public void update(Material material) { ManagerUtils.session.merge(material); } @Override public void delete(Material material) { ManagerUtils.session.delete(material); } @Override public List<Material> listAll() { return ManagerUtils.session.createCriteria(Material.class).list(); } }
#include <cstdlib> #include <vector> #include <fstream> #include <sstream> #include <experimental/optional> #include "windows.h" #include "Objbase.h" #include "Shlobj.h" using namespace std; using namespace std::experimental; TCHAR <API key>[MAX_PATH]; // TODO: A lot of error detection and handling is missing. class COM { public: COM() { if (CoInitializeEx(nullptr, <API key>) != S_OK) throw runtime_error("Failed to initialize COM."); } ~COM() { CoUninitialize(); } }; class file_search { public: WIN32_FIND_DATA find_data; HANDLE handle; file_search(string search_path) : find_data({}) { handle = FindFirstFile(search_path.c_str(), &find_data); } ~file_search() { if (handle != nullptr) FindClose(handle); } bool find_next() { return FindNextFile(handle, &find_data); } inline const char* found_filename() { return find_data.cFileName; }; }; optional<string> select_directory() { BROWSEINFO browseinfo {}; browseinfo.pszDisplayName = <API key>; browseinfo.lpszTitle = "Please select directory containing the bin files."; browseinfo.ulFlags = <API key> | BIF_NEWDIALOGSTYLE | <API key>; PIDLIST_ABSOLUTE idlist = SHBrowseForFolder(&browseinfo); if (idlist == nullptr) { return {}; } else { if (!SHGetPathFromIDList(idlist, <API key>)) { CoTaskMemFree(idlist); throw runtime_error("SHGetPathFromIDList failed."); }; CoTaskMemFree(idlist); return string(<API key>); } } vector<string> find_bin_files(string directory) { vector<string> result; file_search fs(directory + "\\*.bin"); if (GetLastError() != <API key>) { result.emplace_back(fs.found_filename()); while (fs.find_next()) { result.emplace_back(fs.found_filename()); } } return result; } string generate_cuesheet(vector<string> files) { stringstream ss; if (files.size() > 0) { ss << "FILE \"" << files.at(0) << "\" BINARY\n"; ss << " TRACK 01 MODE2/2352\n"; ss << " INDEX 01 00:00:00\n"; for(size_t track = 1; track < files.size(); ++track) { ss << "FILE \"" << files.at(track) << "\" BINARY\n"; ss << " TRACK "; size_t track2 = track + 1; if (track2 < 10) ss << '0'; ss << track2 << " AUDIO\n"; ss << " INDEX 00 00:00:00\n"; ss << " INDEX 01 00:02:00\n"; }; } return ss.str(); } optional<string> <API key>(string directory, vector<string> files) { TCHAR filename[MAX_PATH]; filename[0] = 0; OPENFILENAME save_dialog {}; save_dialog.lStructSize = sizeof(save_dialog); save_dialog.lpstrFilter = "Cuesheet files (*.cue)\0*.cue\0All files\0*"; save_dialog.lpstrDefExt = "cue"; save_dialog.lpstrFile = filename; save_dialog.lpstrInitialDir = directory.c_str(); save_dialog.nMaxFile = MAX_PATH; save_dialog.Flags = OFN_DONTADDTORECENT | OFN_ENABLESIZING | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST; save_dialog.FlagsEx = OFN_EX_NOPLACESBAR; if (GetSaveFileName(&save_dialog)) { return string(filename); } else { return {}; } } bool file_exists(string filename) { file_search fs(filename); auto error_code = GetLastError(); if (error_code == <API key>) return false; if (error_code == ERROR_NO_MORE_FILES) return true; throw error_code; } int main(int argc, const char* argv[]) { try { COM com; auto dir = select_directory(); if (dir) { auto files = find_bin_files(*dir); if (files.empty()) throw runtime_error("No bin files found in the selected directory."); auto cuesheet = generate_cuesheet(files); auto filename = <API key>(*dir, files); if (filename) { ofstream file(filename->c_str(), ios::out); file << cuesheet.c_str(); } } } catch (const exception& e) { MessageBox(nullptr, e.what(), "Error", MB_OK | MB_ICONERROR); return EXIT_FAILURE; } catch (DWORD error_code) { LPSTR buffer = nullptr; FormatMessage(<API key> | <API key> | <API key>, nullptr, error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), reinterpret_cast<LPSTR>(&buffer), 0, nullptr); MessageBox(nullptr, buffer, "Error", MB_OK | MB_ICONERROR); LocalFree(buffer); return EXIT_FAILURE; } return EXIT_SUCCESS; }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title></title> <!-- jquery --> <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script> <! div#manage-nav div#manage-container <style> *{ padding: 0px; margin: 0px; text-decoration: none; } html,body{ height: 100%; width: 100%; font-family: ''; font-size: 16px; } h3{ width: 100%; height: 40px; line-height: 40px; font-size: 1.3em; letter-spacing: 0.15em; color:#fff; background: rgba(66,79,99,0.4); text-align: center; cursor: pointer; } .page{ width: 96%; padding: 0px 2%; } b.display{ display: none; } #manage-nav{ width: 18%; height: 100%; float: left; background-color: rgba(66,79,99,0.8); color: white; position: fixed; padding: 1%; } #manage-nav h2{ font-size: 26px; text-align: center; margin-top: 30px; } #nav{ list-style: none; margin-top: 3.5em; padding: 0em 2em; } #nav li{ text-align: center; list-style: none; } #nav li:hover>a{ color: #65CEA7; } #nav li a{ display: block; height: 2.5em; width: 100%; color: white; text-align: center; line-height: 2.5em; <API key>: none; } #nav li.hover>a{ background-color:rgba(66,79,99,1); color: #65CEA7; } #manage-container{ width: 80%; height: 100%; float: right; } #img{ text-align: center; } #img ul{ list-style: none; float: left; } #img ul li{ width: 30%; float: left; margin: 66px 5px; position: relative; } img{ width: 100%; height: 200px; } .upfile{ width: 100%; height: 100%; opacity: 0; position: absolute; left: 0; bottom: 0; cursor: pointer; text-align: center; } img:hover{ cursor: pointer; } #new{ display: block; margin: 100px auto; } #new input,.news_product input { width: 88%; height: 48px; line-height: 48px; display: block; border-radius: 4px; border: 1px solid #e8e8e8; padding: 0 20px; font-size: 16px; color: #73787c; margin: 28px auto; outline: none; } #new input:last-child,.news_product input:last-child{ cursor:pointer; background: #38adff; color: white; } #editor{ width: 93%; margin:20px auto; } </style> </head> <body> <div id="manage-nav"> <h2></h2> <ul id="nav"> <li class="hover"><a href="javascript:0;"></a></li> <li><a href="javascript:0;"></a></li> <li><a href="javascript:0;"></a></li> <li><a href="javascript:0;"></a></li> <li><a href="javascript:0;"></a></li> <li><a href="javascript:0;"></a></li> <li><a href="javascript:0;"></a></li> </ul> </div> <div id="manage-container"> </div> <script> (function(){ // ajax load var $contain = $('#manage-container'); var $li = $('#nav li'); var index = 0; var arr=['replaceImg/img.php','news/news.php','news/list.php','product/product.php','product/list.php','message/message.php','password/password.php',] $contain.load('replaceImg/img.php'); $li.click(function(){ index = $(this).index(); $contain.load(arr[index]); $(this).addClass('hover').siblings().removeClass('hover'); }); }()); </script> </body> </html>
# coding: UTF-8 require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper') include RDGC::Map include RDGC::Maker describe RDGC::Maker::TempBlock, 'is temp Block for Dungeon make' do it "create_whole_block will create from width/height" do tb = TempBlock.create_whole_block(20, 30) tb.should be_an_instance_of(TempBlock) tb.width.should == 20 tb.height.should == 30 tb.top.should == 0 tb.bottom.should == 29 tb.left.should == 0 tb.right.should == 19 end it "#create_pure_block provides a pure Block instance from self" do tb = TempBlock.create(0, 20, 0, 20) room = Room.create(5, 15, 5, 15) road1 = Road.create(0, 4, 10, 10) road2 = Road.create(16, 20, 12, 12) tb.room = room tb.roads << road1 tb.roads << road2 b = tb.create_pure_block b.should be_an_instance_of(Block) b.should_not be_an_instance_of(TempBlock) b.room.should == room b.roads.should be_include(road1) b.roads.should be_include(road2) end it "#create_pure_block will return nil, if has no room and no road" do tb = TempBlock.create_whole_block(20, 20) tb.should be_an_instance_of(TempBlock) tb.create_pure_block.should be_nil end end
import localforage from 'localforage'; import { LOAD_THEME, } from '../constants'; /* * Loads theme from local storage */ export function loadTheme() { return { type: LOAD_THEME, payload: { promise: localforage.getItem('theme').then(JSON.parse), }, }; } /* * Saves the current theme (mapping from module code to color index * to local storage. */ export function saveTheme() { return (dispatch, getState) => { const theme = getState().theme; return dispatch({ type: 'SAVE_COLORS', payload: { promise: localforage.setItem( 'theme', JSON.stringify({ savedAt: Date.now(), theme, })), }, }); }; }
using Newtonsoft.Json; using NUnit.Framework; using RiotNet.Converters; using RiotNet.Models; using System.Collections.Generic; namespace RiotNet.Tests.Converters { [TestFixture] public class RangeConverterTests { private static <API key> jsonSettings = new <API key> { Converters = new List<JsonConverter> { new RangeConverter() }, }; [Test] public void <API key>() { var value = JsonConvert.DeserializeObject<ListOfInt>("[1,2,5.6]", jsonSettings); Assert.That(value.Count, Is.EqualTo(3)); Assert.That(value[0], Is.EqualTo(1)); Assert.That(value[1], Is.EqualTo(2)); Assert.That(value[2], Is.EqualTo(6)); } [Test] public void <API key>() { var value = JsonConvert.DeserializeObject<ListOfInt>("\"self\"", jsonSettings); Assert.That(value.Count, Is.EqualTo(1)); Assert.That(value[0], Is.EqualTo(0)); } [Test] public void <API key>() { var value = JsonConvert.SerializeObject(new ListOfInt { 2, 11, 3 }, jsonSettings); Assert.That(value, Is.EqualTo("[2,11,3]")); } [Test] public void ShouldSerializeSelf() { var value = JsonConvert.SerializeObject(new ListOfInt { 0 }, jsonSettings); Assert.That(value, Is.EqualTo("\"self\"")); } } }
<?php if($_SESSION["verify"] != "FileManager4TinyMCE") die('forbiden'); function deleteDir($dir) { if (!file_exists($dir)) return true; if (!is_dir($dir)) return unlink($dir); foreach (scandir($dir) as $item) { if ($item == '.' || $item == '..') continue; if (!deleteDir($dir.DIRECTORY_SEPARATOR.$item)) return false; } return rmdir($dir); } function create_img_gd($imgfile, $imgthumb, $newwidth, $newheight="") { require_once('php_image_magician.php'); $magicianObj = new imageLib($imgfile); $magicianObj -> resizeImage($newwidth, $newheight, 'crop'); $magicianObj -> saveImage($imgthumb); } function makeSize($size) { $units = array('B','KB','MB','GB','TB'); $u = 0; while ( (round($size / 1024) > 0) && ($u < 4) ) { $size = $size / 1024; $u++; } return (number_format($size, 1, ',', '') . " " . $units[$u]); } function create_folder($path=false,$path_thumbs=false){ var_dump($path); var_dump($path_thumbs); $oldumask = umask(0); if ($path && !file_exists($path)) mkdir($path, 0777); // or even 01777 so you get the sticky bit set if($path_thumbs && !file_exists($path_thumbs)) mkdir($path_thumbs, 0777); // or even 01777 so you get the sticky bit set umask($oldumask); } ?>
# cMfI dI vwr <> vwihgurU jI kI Pqh ] sRI BgauqI jI shwie ] vwr sRI BgauqI jI kI ] pwqswhI 10 ] ipRQm BgyMqI ismir kY guru nwnk leIN iDAwie ] iPr AMgd gur qy Amrdwsu rwmdwsY hoeIN shwie ] Arjn hirgoibMd no ismryM sRI hirrwie ] sRI hir ikRSn iDAweIAY ijs if~Ty siB duiK jwie ] qyg bhwdr ismirAY Gr nau iniD AwvY Dwie ] sB QweIN hoie shwie ] 1] ## pauVI ] KMfw ipRQmY swj kY ijn sB sYswru aupwieAw ] bRhmw ibsnu mhys swij kudriq dw Kylu rcwie bxwieAw ] isMD prbq mydnI ibnu QMmHw ggin rhwieAw ] isrjy dwno dyvqy iqn AMdir bwdu rcwieAw ] qY hI durgw swij kY dYqw dw nwsu krwieAw ] qYQoN hI blu rwm lY nwl bwxw dhisru GwieAw ] qYQoN hI blu ikRsn lY kMsu kysI pkiV igrwieAw ] bfy bfy muin dyvqy keI jug iqnI qnu qwieAw ] iknI qyrw AMqu n pwieAw ] 2] swDU sqjugu bIiqAw AD sIlI qyRqw AwieAw ] n~cI kl srosrI kl nwrd faurU vwieAw ] AiBmwnu auqwrn dyviqAW mihKwsur sMuB aupwieAw ] jIiq ley iqn dyvqy iqh lokI rwju kmwieAw ] v~fw bIru AKwie kY isr aupr CqRu iPrwieAw ] id~qw ieMdRu inkwl kY iqn igr kYlwsu qkwieAw ] fir kY h\`Qy dwnvI idl AMdir qRwsu vDwieAw ] pws durgw dy ieMdRu AwieAw ] 3] ## pauVI ] iek idhwVy nwvx AweI durgswh ] ieMdR ibrQw suxweI Apxy hwl dI ] CIn leI TkurweI swqy dwnvI ] lokI iqhI iPrweI dohI AwpxI ] bYTy vwie vDweI qy AmrwvqI ] id\`qy dyv BjweI sBnw rwksW ] iknY n ij~qw jweI mh\`Ky dYq nUM ] qyrI swm qkweI dyvI durgswh ] 4] ## pauVI ] durgw bYx suxMdI h~sI hVhVwie ] EhI sIhu mMgwieAw rwks B~Kxw ] icMqw krhu n kweI dyvw nUM AwiKAw ] roh hoeI mhw mweI rwkis mwrxy ] 5] ## dohrw ] rwkis Awey rohly Kyq iBVn ky cwie ] lskn qygW brCIAW sUrju ndir n pwie ] 6] ## pauVI ] duhW kMDwrw muih juVy Fol sMK ngwry b~jy ] rwkis Awey rohly qrvwrI bKqr s~jy ] ju\`ty sauhy ju~D nUM iek jwq n jwxn B\`jy ] Kyq AMdir joDy g\`jy ] 7] ## pauVI ] jMg muswPw b~ijAw rx Gury ngwry cwvly ] JUlx nyjy bYrkw nIswx lsin ilswvly ] Fol ngwry paux dy aUNGn jwx jtwvly ] durgw dwno fhy rx nwd v~jn Kyqu BIhwvly ] bIr proqy brCIeyN jx fwl cmu~ty Awvly ] iek v~Fy qygI qVPIAn md pIqy lotin bwvly ] iek cux cux JwVau kFIAn ryq iv~coN suienw fwvly ] gdw iqRsUlW brCIAW qIr v~gn Kry auqwvly ] jx fsy BujMgm swvly ] mr jwvn bIr ruhwvly ] 8] ## pauVI ] dyKn cMf pRcMf nUM rx Gury ngwry ] Dwey rwkis rohly cauigrdo Bwry ] h~QIN qygW pkiV kY rx iBVy krwry ] kdy n n\`Ty ju~D qy joDy juJwry ] idl ivc roh bFwie kY mwir mwir pukwry ] mwry cMf pRcMf nY bIr Kyq auqwry ] mwry jwpn ibjulI isr Bwr munwry ] 9] ## pauVI ] cot peI dmwmy dlW mukwblw ] dyvI dsq ncweI sIhx swr dI ] pyt mlMdy lweI mhKy dYq nUM ] gurdy AWdw KweI nwly r~ukVy ] jyhI idl ivc AweI khI suxwie kY ] cotI jwx idKweI qwry DUmkyq ] 10] ## pauVI ] cotW pvn ngwry AxIAW ju~tIAW ] DUh leIAW qrvwrI dyvW dwnvI ] vwhn vwro vwrI sUry sMGry ] vgY r~qu JulwrI ijau gyrU bwbqRw ] dyKn bYT AtwrI nwrI rwksW ] pweI DUm svwrI durgw dwnvI ] 11] ## pauVI ] l~K ngwry v~jn AwmoH swmHxy ] rwks rxo n B~jn rohy rohly ] sIhW vWgU g~jn s~By sUrmy ] qix qix kYbr C~fn durgw swmxy ] 12] ## pauVI ] Gury ngwry dohry rx sMglIAwly ] DUiV lpyty DUhry isrdwr jtwly ] auKlIAW nwsw ijnw muih jwpn Awly ] Dwey dyvI swmHxy bIr mu~ClIAwly ] surpq jyhy lV hty bIr tly n twly ] g~jy durgw Gyir kY jxu GxIAr kwly ] 13] ## pauVI ] cot peI KrcwmI dlW mukwblw ] Gyr leI virAwmI durgw Awie kY ] rwks vfy AlwmI B~j n jwxdy ] AMq hoey surgwmI mwry dyvqw ] 14] ## pauVI ] Agxq Gury ngwry dlW iBVMidAW ] pwey mhKl Bwry dyvW dwnvW ] vwhn P~t krwry rwkis rohly ] jwpn qygI Awry imAwno DUhIAW ] joDy vfy munwry jwpn Kyq ivic ] dyvI Awp svwry p~bw jvyhxy ] kdy n AwKn hwry Dwvn swhmxy ] durgw sB sMGwry rwkis KVg lY ] 15] ## pauyVI ] auml l\`Qy joDy mwrU b~ijAw ] b~dl ijau mihKwsur rx ivic g~ijAW ] ieMdRw jyhw joDw mYQau B\`ijAw ] kauxu ivcwrI durgw ijn rxu s~ijAw ] 16] ## pauVI ] v~jy Fol ngwry dlW mukwblw ] qIr iPrY rYbwry AwmoH swmHxy ] Agxq bIr sMGwry lgdI kYbrI ] if~gy jwix munwry mwry ib~ju dy ] Ku~lI vwlIN dYq AhwVy sBy sUrmy ] su\`qy jwix jtwly BMgW Kwie kY ] 17] ## pauVI ] duhW kMDwrW muih juVy nwil Dausw BwrI ] kVk au~iTAw Pauj qy vfw AhMkwrI ] lY kY cilAw sUrmy nwil vfy hjwrI ] imAwno KMfw DUihAw mhKwsur BwrI ] au~ml l\`Qy sUrmy mwr mcI krwrI ] jwpy c~ly r~q dy slly jtDwrI ] 18] ## pauVI ] s~t peI jmDwxI dlW mukwblw ] DUih leI ikRpwxI durgw imAwn qy ] cMfI rwkis KwxI vwhI dYq nUM ] kopr cUr cvwxI l~QI krg lY ] pwKr qurw plwxI rVkI Drq jwie ] lYdI AGw isDwxI isMgW Daul idAW ] kUrm isr lihlwxI dusmn mwir kY ] v\`Fy gn iqKwxI mUey Kyq ivc ] rx ivc G~qI GwxI lohU im~J dI ] cwry jug khwxI c~lg qyg dI ] ibDx Kyq ivhwxI mhKy dYq nUM ] 19] ieqI mhKwsur dYq mwry durgw AwieAw ] caudh lokW rwxI isMG ncwieAw ] mwry bIr jtwxI dl ivc Agly ] mMgn nwhI pwxI dlI hMkwr kY ] jx krI smwie pTwxI suix kY rwg nUM ] r~qU dy hVvwxI cly bIr Kyq ] pIqw Pu~lu ieAwxI Gu~mn sUrmy ] 20] hoeI Alop BvwnI dyvW nUM rwju dy ] eIsr dI brdwnI hoeI ij~q idn ] sMuB insMuB gumwnI jnmy sUrmy ] ieMdR dI rjDwnI q~kI ij~qnI ] 21] ieMdRprI qy Dwvxw vf joDI mqw pkwieAw ] sMj ptylw pwKrw ByV sMdw swju bxwieAw ] jMmy ktk ACUhxI Asmwnu grdI CwieAw ] roh sMuB insMuB isDwieAw ] 22] ## pauVI ] sMuB insMuB AlwieAw vf joDI sMGru vwey ] roh idKwlI id~qIAw virAwmI qury ncwey ] Gury dmwmy dohry jm bwhx ijau ArVwey ] dyau dwno lu~Jx Awey ] 23] ## pauVI ] dwno dyau AnwgI sMGru ricAw ] Pu~l iKVy jx bwgIN bwxy joiDAW ] BUqW ie~lW kwgIN gosq BiKAw ] hMumV DMumV jwgI G~qI sUirAW ] 24] s~t peI ngwry dlW mukwblw ] idqy dyau BjweI imil kY rwksIN ] lokI iqhI iPrweI dohI AwpxI ] durgw dI swm qkweI dyvW fridAW ] AWdI cMif cVweI auqy rwksW ] 25] ## pauVI ] AweI Pyr BvwnI KbrI pweIAW ] dYq vfy AiBmwnI hoey eykTy ] locn DUm gumwnI rwie bulwieAw ] jg ivc vfw dwno Awp khwieAw ] s~t peI KrcwmI durgw ilAwvxI ] 26] ## pauVI ] kVk auTI rx cMfI PaujW dyK kY ] DUih imAwno KMfw hoeI swhmxy ] sBy bIr sMGwry DUmrnYx dy ] jx lY kty Awry drKq bwFIAW ] 27] ## pauVI ] cobIN DauNs bjweI dlW mukwblw ] roh BvwnI AweI auqy rwksW ] K~bY dsq ncweI sIhx swr dI ] bhuiqAW dy qn lweI kIqI rMgulI ] BweIAW mwrn BweI durgw jwix kY ] roh hoie clweI rwkis rwie nUM ] jm pur dIAw pTweI locn DUm nUM ] jwpy id~qI sweI mwrn sMuB dI ] 28] ## pauVI ] BMny dYq pukwry rwjy sMuB QY ] locn DUm sMGwry sxy ispwhIAW ] cuix cuix joDy mwry AMdr Kyq dY ] jwpn AMbir qwry if~gin sUrmy ] igry prbq Bwry mwry ib~ju dy ] dYqW dy dl hwry dhsq Kwie kY ] bcy su mwry mwry rhdy rwie QY ] 29] ## pauVI ] roh hoie bulwey rwkis rwie ny ] bYTy mqw pkweI durgw ilAwvxI ] cMf Ar muMf pTwey bhuqw ktku dY ] jwpy C~pr Cwey bxIAw kyjmw ] jyqy rwie bulwey c~ly ju~D no ] jx jm pur prV clwey sBy mwrny ] 30] ## pauVI ] Fol ngwry vwey dlW mukwblw ] roh ruhyly Awey auqy rwksW ] sBnI qury ncwey brCy pkiV kY ] bhuqy mwr igrwey AMdr Kyq dY ] qIrI Chbr lweI bu~TI dyvqw ] 31] ByrI sMK vjwey sMGir r~icAw ] qix qix qIr clwey durgw DnK lY ] ijnI dsq auTwey rhy n jIvdy ] cMf Ar mMuf Kpwey dono dyvqw ] 32] sMuB insMuB irswey mwry dYq sux ] joDy sB bulwey Awpxy mjlsI ] ijnI dyau Bjwey ieMdR jyhvy ] qyeI mwr igrwey pl ivc dyvqw ] EnI dsqI dsiq vjwey iqnw icq kir ] iPr sRxvq bIj clwey bIVy rwie dy ] sMj ptolw pwey iclkq topIAW ] lu~Jx no ArVwey rwks rohly ] kdy n ikny htwey ju~D mcwie kY ] iml qyeI dwno Awey hux sMGir dyKxw ] 33] ## pauVI ] dYqI fMf auBwrI nyVY Awie kY ] isMG krI AsvwrI durgw sor sux ] K~bY dsq auBwrI gdw iPrwie kY ] sYnw sB sMGwrI sRxvq bIj dI ] jx md Kwie mdwrI GUmn sUrmy ] Agxq pwau pswrI ruly AhwV ivic ] jwpy Kyf iKfwrI su~qy Pwg nUM ] 34] ## pauVI ] sRxvq_bIj hkwry rhdy sUrmy ] joDy jyfu munwry id~sn Kyq ivic ] sBnI dsq auBwry qygW DUih kY ] mwro mwr pukwry Awey swmHxy] sMjw qy Tixkwry qygIN au~bry ] Gwt GVin TiTAwry jwix bxwie kY ] 35] s~t peI jmDwxI dlW mukwblw ] GUmr brg sqwxI dl ivic G~qIE ] sxy qurw plwxI if~gx sUrmy ] auiT auiT mMgix pwxI Gwiel GUmdy ] eyvfu mwir ivhwxI aupr rwksW ] ib~jl ijau JrlwxI au~TI dyvqw ] 36] ## pauVI ] cobI Daus auBwrI dlW mukwblw ] sBo sYnw mwrI pl ivic dwnvI ] durgw dwno mwry roh bFwie kY ] isr ivc qyg vgweI sRxvq_bIj dy ] 37] Agxq dwno Bwry hoey lohUAw ] joDy jyf munwry AMdir Kyq dY ] durgw no llkwry Awvx swmxy] durgw sB sMGwry rwks AWvdy ] rqU dy prnwly iqn qy Buie pey ] au~Ty kwrixAwry rwks hVhVwie ] 38] Dgw sMglIAwlI sMGr vwieAw ] brCI bMblIAwlI sUry sMGry ] ByiV micAw bIrwlI durgw dwnvIN ] mwr mcI muhrwlI AMdir Kyq dY ] jx nt l~Qy CwlI Foil bjwie kY ] lohU PwQI jwlI loQI jmDVI ] Gx ivic ijau CMCwlI qygW h~sIAW ] Gu~mrAwir isAwlI bxIAW kyjmW ] 39] Dgw sUlI bjweIAW dlW mukwblw ] DUih imAwno leIAW juAwnI sUrmI ] sRxvq_bIj bDweIAW Agxq sUrqW ] durgw sauhyN AweIAW roh bFwie kY ] sBnI Awx vgweIAW qygW DUih kY ] durgw sB bcweIAW Fwl sMBwl kY ] dyvI Awp clweIAW qik qik dwnvI ] lohU nwil fubweIAW qygW nMgIAW ] swrsuqI jxu nweIAW iml kY dyvIAW ] sBy mwr igrweIAW AMdir Kyq dY ] iq~dMU Pyir svweIAW hoeIAW sUrqW ] 40] ## pauVI ] sUrI sMGir ricAw Fol sMK ngwry vwie kY ] cMf icqwrI kwlkw mn bwhlw ros bFwie kY ] inklI m~Qw PoiV kY jxu Pqy nIswx bjwie kY ] jwg su jMmI ju~D nUM jrvwxw jx mrVwie kY ] dl ivic Gyrw G~iqAw jx sINh quirAw gixxwie kY ] Awp ivsUlw hoieAw iqhu lokW qy Kunswie kY ] roh isDweIAW ckR_pwn kr inMdw KVg auTwie kY ] AgY rwks bYTy rohly qIrI qygI Chbir lwie kY ] pkV pCwVy rwksW dl dYqW AMdir jwie kY ] bhu kysI pkiV pCwiVAin iqn AMdir DUm rcwie kY ] bfy bfy cux sUrmy gih kotI dey clwie kY ] rx kwlI gu~sw Kwie kY ] 41] ## pauVI ] duhw kMDwrw muih juVy AxIAw rwcoeIAW ] DUih ikrpwxW iq~KIAW nwl lohU DoeIAW ] hUrW sRxvq_bIj nUUM Giq Gyir KloeIAW ] lwVw dyKn lwVIAW cauigrdy hoeIAW ] 42] cobI Dausw pweIAW dlW mukwblw ] dsqI DUh ncweIAW qygW nMgIAW ] sUirAW dy qn lweIAW gosq ig\`DIAW] ib\`Dx rwqI AweIAW mrdW GoiVAW ] jogxIAW imil DweIAW lohU B~Kxw ] PaujW mwr htweIAW dyvW dwnvW ] BjdI kQw suxweIAW rwjy sMuB QY ] BueIN n pauxY pweIAW bMUdw rkq dIAW ] kwlI Kyq KpweIAW sBy sUrqW ] bhuqI isrI ibhweIAW GVIAW kwl kIAW ] jwix n jwey mweIAW jUJy sUrmy ] 43] sMuB suxI krhwlI sRxvq bIj dI ] rx ivic iknY n JwlI durgw AWvdI ] bhuqy bIr jtwlI auTy AwK kY ] cotw pwn qbwlI jwsn ju~D nUM ] Qir Qir ipRQmI cwlI dlW cVMidAW ] nwau ijvy hY hwlI shu drIAwau ivic ] DUiV auqwhW GwlI CVI qurMgmW ] jwix pukwrU cwlI DrqI ieMdR QY ] 44] ## pauVI ] Awhir imilAw AwhrIAW sYx sUirAW swjI ] c~ly sauhy durgswh jx kwbY hwjI ] qIrI qygI jmDVI rx vMfI BwjI ] iek Gwiel GUmn sUrmy jx mkqb kwjI ] iek bIr proqy brCIey ijau Juk paun invwjI ] iek durgw sauhy Kuns kY Kunswien qwjI ] iek Dwvn durgw swmHxy ijau BuiKAwey pwjI ] kdy n r~jy juJ qy rj hoey rwjI ] 45] b~jy sMglIAwly sMGr fohry ] fhy ju Kyq jtwly hwTW joiV kY ] nyjy bMblIAwly id~sn ErVy ] c~ly jwx jtwly nwvn gMg nUM ] 46] ## pauVI ] durgw AqY dwnvI sUl hoeIAW kMgW ] vwCV G~qI sUirAW ivc Kyq KqMgW ] DUih ikRpwxw iqKIAW bF lwhin AMgW ] phlw dlW imlMidAW ByV pieAw inhMgW ] 47] ## pauVI ] ErV PaujW AweIAW bIr cVy kMDwrI ] sVk imAwno kFIAW iq~KIAW qrvwrI ] kVk auTy rx m~icAw v~fy hMkwrI ] isr DV bwhW gnly Pul jyhY bwVI ] jwpy kty bwFIAW ruK cMdn AwrI ] 48] duhW kMDwrW muih juVy jw s~t peI Krvwr kau ] qk qk kYbir durgswh qk mwry Bly juJwr kau ] pYdl mwry hwQIAW sMig rQ igry Asvwr kau ] sohn sMjw bwgVw jxu l~gy Pu~l Anwr kau ] gu~sy AweI kwlkw hiQ s~jy lY qlvwr kau ] eydU pwrau Eq pwr hrnwkis keI hjwr kau ] ijx ie~kw rhI kMDwr kau ] sd rhmq qyry vwr kau ] 49] ## pauVI ] duhW kMDwrW muih juVy s~t peI jmDwx kau ] qd iKMg nsMuB ncwieAw fwl aupir brgsqwx kau ] PVI iblMd mgwieaus Purmwies kir mulqwn kau ] gu~sy AweI swmHxy rx AMdir G~qx Gwx kau ] AgY qyg vgweI durgswh bF sMuBn bhI plwx kau ] rVkI jwie kY Drq kau b~F pwKr b~F ikkwx kau ] bIr plwxo if~igAw kir isjdw sMuB sujwx kau ] swbws sloxy Kwx kau ] sdw swbws qyry qwx kau ] qwrIPW pwn cbwn kau ] sd rhmq kYPW Kwn kau ] sd rhmq qury ncwx_k~au ] 50] ## pauVI ] durgw AqY dwnvI gh sMGir k~Qy ] ErV au~Ty sUrmy Aw fwhy m~Qy ] k~t quPMgI kYbrI dl gwih ink~Qy ] dyKin jMg Prysqy Asmwno l~Qy ] 51] ## pauVI ] duhW kMDwrW muh juVy dl Gury ngwry ] ErV Awey sUrmy isrdwr rixAwry ] lY ky qygW brCIAW hiQAwr auBwry ] top ptylw pwKrW gil sMj svwry ] lY ky brCI durgswh bhu dwnv mwry ] cVy rQI gj GoiVeI mwr Buie qy fwry ] jwx hlvweI sIK nwl ivMnH vVy auqwry ] 52] ## pauVI ] duhW kMDwrW muih juVy nwl Dausw BwrI ] leI BgauqI durgswh vr jwgn BwrI ] lweI rwjy sMuB no rqu pIAY ipAwrI ] sMuB plwxo if~igAw aupmw bIcwrI ] fub rqU nwlhu inklI brCI duDwrI ] jwx rjwdI auqrI pYn sUhI swrI ] 53] ## pauVI ] durgw AqY dwnvI ByV pieAw sbwhIN ] ssqR pjUqy durgswh gh sBnIN bwhIN ] sMuB insMuB sMGwirAw vQ jyhy swhIN ] PaujW rwkisAwrIAW dyiK rovin DwhIN ] muih kuVUcy Gwh dy C~f GoVy rwhIN ] Bjdy hoey mwrIAn muV Jwkn nwhIN ] 54] ## pauVI ] sMuB insMuB pTwieAw jm dy Dwm no ] ieMdR s~d bulwieAw rwj AiBKyK_no ] isr pr CqR iPrwieAw rwjy ieMdR dY ] caudh lokW CwieAw jsu jg_mwq dw ] durgw pwT bxwieAw sBy pauVIAW ] Pyr n jUnI AwieAw ijn ieh gwieAw ] 55]
export { viewLenses, setStore, lensReducer } from './main'; export { default as LensGroup } from './LensGroup'; export { default as connectLenses, bindLenses, <API key> } from './connect';
module IceCube module Validations::DayOfYear def day_of_year(*days) days.each do |day| validations_for(:day_of_year) << Validation.new(day) end <API key>(:month, :day, :wday) self end class Validation attr_reader :day StringBuilder.register_formatter(:day_of_year) do |entries| str = "on the #{StringBuilder.sentence(entries)} " str << (entries.size == 1 ? 'day of the year' : 'days of the year') str end def initialize(day) @day = day end def type :day end def build_s(builder) builder.piece(:day_of_year) << StringBuilder.nice_number(day) end def build_hash(builder) builder.validations_array(:day_of_year) << day end def build_ical(builder) builder['BYYEARDAY'] << day end def validate(time, schedule) days_in_year = TimeUtil.days_in_year(time) the_day = day < 0 ? day + days_in_year : day # compute the diff diff = the_day - time.yday diff >= 0 ? diff : diff + days_in_year end end end end
export { default as Employment } from './employment.container'; export { default as employmentReducer } from './employment.reducer';
// AppDelegate.h #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <<API key>> @property (strong, nonatomic) UIWindow *window; @end
# -*- coding: utf-8 -*- # Generated by Django 1.10 on 2016-08-26 04:44 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.<API key>(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name='Genre', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=50)), ('slug', models.SlugField(blank=True, unique=True)), ('draft', models.BooleanField(default=False)), ('publish', models.DateField(blank=True)), ('created', models.DateTimeField(auto_now_add=True)), ('updated', models.DateTimeField(auto_now=True)), ('user', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], ), ]
/*! ** @file AD2.c ** @version 01.00 ** @brief ** This device "ADC" implements an A/D converter, ** its control methods and interrupt/event handling procedure. */ /*! ** @addtogroup AD2_module AD2 module documentation ** @{ */ /* MODULE AD2. */ #include "Events.h" #include "AD2.h" #ifdef __cplusplus extern "C" { #endif #define STOP 0x00U /* STOP state */ #define MEASURE 0x01U /* MESURE state */ #define CONTINUOUS 0x02U /* CONTINUOUS state */ #define SINGLE 0x03U /* SINGLE state */ #define CALIBRATING 0x04U /* CALIBRATING state */ static volatile byte SumChan; /* Counter of measured channels */ static volatile byte ModeFlg; /* Current state of device */ LDD_TDeviceData *<API key>; /* Device data pointer */ /* Sample group configuration */ static LDD_ADC_TSample SampleGroup[<API key>]; /* Measure multiple channels flags */ /* Temporary buffer for converting results */ volatile word AD2_OutV[<API key>]; /* Sum of measured values */ /* Calibration in progress flag */ static volatile bool OutFlg; /* Measurement finish flag */ static void ClrSumV(void) { AD2_OutV[0] = 0U; /* Set variable for storing measured values to 0 */ AD2_OutV[1] = 0U; /* Set variable for storing measured values to 0 */ AD2_OutV[2] = 0U; /* Set variable for storing measured values to 0 */ } void AD2_HWEnDi(void) { if (ModeFlg) { /* Start or stop measurement? */ OutFlg = FALSE; /* Output values aren't available */ SumChan = 0U; /* Set the counter of measured channels to 0 */ ClrSumV(); /* Clear measured values */ SampleGroup[0].ChannelIdx = 0U; (void)<API key>(<API key>, (LDD_ADC_TSample *)SampleGroup, 1U); /* Configure sample group */ (void)<API key>(<API key>); } } /*! ** @brief ** This method performs one measurement on all channels that ** are set in the component inspector. (Note: If the [number of ** conversions] is more than one the conversion of A/D channels ** is performed specified number of times.) ** @param ** WaitForResult - Wait for a result of a ** conversion. If [interrupt service] is ** disabled, A/D peripheral doesn't support ** measuring all channels at once or Autoscan ** mode property isn't enabled and at the same ** time the [number of channels] is greater ** than 1, then the WaitForResult parameter is ** ignored and the method waits for each ** result every time. If the [interrupt ** service] is disabled and a [number of ** conversions] is greater than 1, the ** parameter is ignored and the method also ** waits for each result every time. ** @return ** - Error code, possible codes: ** ERR_OK - OK ** ERR_SPEED - This device does not work in ** the active speed mode ** ERR_DISABLED - Device is disabled ** ERR_BUSY - A conversion is already running */ byte AD2_Measure(bool WaitForResult) { if (ModeFlg != STOP) { /* Is the device in different mode than "stop"? */ return ERR_BUSY; /* If yes then error */ } ModeFlg = MEASURE; /* Set state of device to the measure mode */ AD2_HWEnDi(); /* Enable the device */ if (WaitForResult) { /* Is WaitForResult TRUE? */ while (ModeFlg == MEASURE) {} /* If yes then wait for end of measurement */ } return ERR_OK; } /*! ** @brief ** This method returns the last measured values of all channels. ** Compared with [GetValue] method this method returns more ** accurate result if the [number of conversions] is greater ** than 1 and [AD resolution] is less than 16 bits. In addition, ** the user code dependency on [AD resolution] is eliminated. ** @param ** Values - Pointer to the array that contains ** the measured data. ** @return ** - Error code, possible codes: ** ERR_OK - OK ** ERR_SPEED - This device does not work in ** the active speed mode ** ERR_NOTAVAIL - Requested value not ** available ** ERR_OVERRUN - External trigger overrun flag ** was detected after the last value(s) was ** obtained (for example by GetValue). This ** error may not be supported on some CPUs ** (see generated code). */ byte AD2_GetValue16(word *Values) { if (!OutFlg) { /* Is output flag set? */ return ERR_NOTAVAIL; /* If no then error */ } Values[0] = (word)((AD2_OutV[0]) << 4U); /* Save measured values to the output buffer */ Values[1] = (word)((AD2_OutV[1]) << 4U); /* Save measured values to the output buffer */ Values[2] = (word)((AD2_OutV[2]) << 4U); /* Save measured values to the output buffer */ return ERR_OK; } byte AD2_Calibrate(bool WaitForResult) { if (ModeFlg != STOP) { /* Is the device in different mode than "stop"? */ return ERR_BUSY; /* If yes then error */ } ModeFlg = CALIBRATING; /* Set state of device to the calibration mode */ (void)<API key>(<API key>); /* Clear measurement complete status */ (void)<API key>(<API key>); /* Start calibration */ if (!WaitForResult) { /* If doesn't wait for result */ return ERR_OK; /* then return ERR_OK, but user have to check the result of calibration e.g. by <API key> method */ } while (!<API key>(<API key>)) {}; /* Wait until calibration ends */ if (<API key>(<API key>) != ERR_OK) { /* If calibration failed flag is set */ ModeFlg = STOP; /* Set the device to the stop mode */ return ERR_FAILED; /* Return ERR_FAILED error code */ } return ERR_OK; /* ADC device is now calibrated */ } void <API key>(LDD_TUserData *UserDataPtr) { (void)UserDataPtr; /* Parameter is not used, suppress unused argument warning */ if (ModeFlg == CALIBRATING) { /* If the driver is in CALIBRATING mode */ (void)<API key>(<API key>); ModeFlg = STOP; /* Set the device to the stop mode */ <API key>(); /* If yes then invoke user event */ return; /* Return from interrupt */ } <API key>(<API key>, (LDD_TData *)&AD2_OutV[SumChan]); SumChan++; /* Increase counter of measured channels*/ if (SumChan == 3U) { /* Is number of measured channels equal to the number of channels used in the component? */ SumChan = 0U; /* If yes then set the counter of measured channels to 0 */ OutFlg = TRUE; /* Measured values are available */ AD2_OnEnd(); /* If yes then invoke user event */ ModeFlg = STOP; /* Set the device to the stop mode */ return; /* Return from interrupt */ } SampleGroup[0].ChannelIdx = SumChan; /* Start measurement of next channel */ (void)<API key>(<API key>, (LDD_ADC_TSample *)SampleGroup, 1U); /* Configure sample group */ (void)<API key>(<API key>); } void AD2_Init(void) { OutFlg = FALSE; /* No measured value */ ModeFlg = STOP; /* Device isn't running */ <API key> = AdcLdd1_Init(NULL); /* Calling init method of the inherited component */ } /* END AD2. */ #ifdef __cplusplus } /* extern "C" */ #endif
package ch.obermuhlner.math.big.internal; import java.math.BigDecimal; import java.math.MathContext; import ch.obermuhlner.math.big.BigRational; public class CoshCalculator extends SeriesCalculator { public static final CoshCalculator INSTANCE = new CoshCalculator(); private int n = 0; private BigRational factorial2n = BigRational.ONE; private CoshCalculator() { super(true); } @Override protected BigRational getCurrentFactor() { return factorial2n.reciprocal(); } @Override protected void calculateNextFactor() { n++; factorial2n = factorial2n.multiply(2 * n - 1).multiply(2 * n); } @Override protected PowerIterator createPowerIterator(BigDecimal x, MathContext mathContext) { return new PowerTwoNIterator(x, mathContext); } }
using System; using System.Linq; using System.Threading.Tasks; using Abp.Authorization; using QuickDevelop.Authorization.Roles; using QuickDevelop.Roles.Dto; namespace QuickDevelop.Roles { /* THIS IS JUST A SAMPLE. */ public class RoleAppService : <API key>,IRoleAppService { private readonly RoleManager _roleManager; private readonly IPermissionManager _permissionManager; public RoleAppService(RoleManager roleManager, IPermissionManager permissionManager) { _roleManager = roleManager; _permissionManager = permissionManager; } public async Task <API key>(<API key> input) { var role = await _roleManager.GetRoleByIdAsync(input.RoleId); var grantedPermissions = _permissionManager .GetAllPermissions() .Where(p => input.<API key>.Contains(p.Name)) .ToList(); await _roleManager.<API key>(role, grantedPermissions); } } }
/* OpenNN: Open Neural Networks Library */ /* D A T A S E T C L A S S */ /* Roberto Lopez */ /* International Center for Numerical Methods in Engineering (CIMNE) */ /* Technical University of Catalonia (UPC) */ /* Barcelona, Spain */ /* E-mail: rlopez@cimne.upc.edu */ // System includes #include <iostream> #include <fstream> #include <string> #include <sstream> #include <cmath> #include <algorithm> #include <cstdlib> #include <stdexcept> #include <ctime> #include <exception> // OpenNN includes #include "data_set.h" // TinyXml includes #include "../../parsers/tinyxml/tinyxml.h" namespace OpenNN { // DEFAULT CONSTRUCTOR Default constructor. It creates a data set object with zero instances and zero inputs and target variables. It also initializes the rest of class members to their default values. DataSet::DataSet(void) { set(); set_default(); } // GENERAL CONSTRUCTOR Instances and variables number constructor. It creates a data set object with given instances and variables numbers. All the variables are set as inputs. It also initializes the rest of class members to their default values. @param <API key> Number of instances in the data set. @param <API key> Number of variables. DataSet::DataSet(const unsigned int& <API key>, const unsigned int& <API key>) { set(<API key>, <API key>); set_default(); } // INSTANCES, INPUTS AND TARGETS NUMBERS CONSTRUCTORS Instances number, input variables number and target variables number constructor. It creates a data set object with given instances and inputs and target variables numbers. It also initializes the rest of class members to their default values. @param <API key> Number of instances in the data set. @param new_inputs_number Number of input variables. @param new_targets_number Number of target variables. DataSet::DataSet(const unsigned int& <API key>, const unsigned int& new_inputs_number, const unsigned int& new_targets_number) { set(<API key>, new_inputs_number, new_targets_number); set_default(); } // XML CONSTRUCTOR This method sets the data set members from a XML element. @param data_set_element Pointer to a Tiny XML element containing the member data. DataSet::DataSet(TiXmlElement* data_set_element) { set_default(); from_XML(data_set_element); } // FILE CONSTRUCTOR File constructor. It creates a data set object by loading the object members from a XML-type file. Please mind about the file format. This is specified in the User's Guide. @param filename Data set file name. DataSet::DataSet(const std::string& filename) { set(); set_default(); load(filename); } // COPY CONSTRUCTOR Copy constructor. It creates a copy of an existing inputs targets data set object. @param other_data_set Data set object to be copied. DataSet::DataSet(const DataSet& other_data_set) { set_default(); set(other_data_set); } // DESTRUCTOR Destructor. DataSet::~DataSet(void) { } // ASSIGNMENT OPERATOR Assignment operator. It assigns to the current object the members of an existing data set object. @param other_data_set Data set object to be assigned. DataSet& DataSet::operator = (const DataSet& other_data_set) { if(this != &other_data_set) { data_filename = other_data_set.data_filename; // Data matrix data = other_data_set.data; // Variables information <API key> = other_data_set.<API key>; // Instances information <API key> = other_data_set.<API key>; // Utilities display = other_data_set.display; } return(*this); } // EQUAL TO OPERATOR // bool operator == (const DataSet&) const method Equal to operator. It compares this object with another object of the same class. It returns true if the members of the two objects have the same values, and false otherwise. @ param other_data_set Data set object to be compared with. bool DataSet::operator == (const DataSet& other_data_set) const { if(data_filename == other_data_set.data_filename && data == other_data_set.data && <API key> == other_data_set.<API key> && <API key> == other_data_set.<API key> && display == other_data_set.display) { return(true); } else { return(false); } } // METHODS // const <API key>& <API key>(void) const This method returns a constant reference to the variables information object composing this data set object. const <API key>& DataSet::<API key>(void) const { return(<API key>); } // <API key>* <API key>(void) const This method returns a pointer to the variables information object composing this data set object. <API key>* DataSet::<API key>(void) { return(&<API key>); } // const <API key>& <API key>(void) const This method returns a constant reference to the instances information object composing this data set object. const <API key>& DataSet::<API key>(void) const { return(<API key>); } // <API key>* <API key>(void) This method returns a pointer to the variables information object composing this data set object. <API key>* DataSet::<API key>(void) { return(&<API key>); } // const <API key>& <API key>(void) const method This method returns the method used for scaling and unscaling the data. const DataSet::<API key>& DataSet::<API key>(void) const { return(<API key>); } // std::string <API key>(void) const method This method returns a string with the name of the method used for scaling and unscaling the data. std::string DataSet::<API key>(void) const { if(<API key> == MinimumMaximum) { return("MinimumMaximum"); } else if(<API key> == <API key>) { return("<API key>"); } else { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "std::string <API key>(void) const method.\n" << "Unknown scaling and unscaling method.\n"; throw std::logic_error(buffer.str()); } } // const bool& get_display(void) const method This method returns true if messages from this class can be displayed on the screen, or false if messages from this class can't be displayed on the screen. const bool& DataSet::get_display(void) const { return(display); } // const Matrix<double>& get_data(void) const method This method returns a reference to the data matrix in the data set. The number of rows is equal to the number of instances. The number of columns is equal to the number of variables. const Matrix<double>& DataSet::get_data(void) const { return(data); } // const std::string& get_data_filename(void) const method This method returns the name of the data file. const std::string& DataSet::get_data_filename(void) const { return(data_filename); } // Matrix<double> <API key>(void) const method This method returns a matrix with the training instances in the data set. The number of rows is the number of training instances. The number of columns is the number of variables. Matrix<double> DataSet::<API key>(void) const { const unsigned int variables_number = <API key>(); Vector<unsigned int> variables_indices(0, 1, variables_number-1); const Vector<unsigned int>& training_indices = <API key>.<API key>(); return(data.arrange_submatrix(training_indices, variables_indices)); } // Matrix<double> <API key>(void) const method This method returns a matrix with the generalization instances in the data set. The number of rows is the number of generalization instances. The number of columns is the number of variables. Matrix<double> DataSet::<API key>(void) const { const unsigned int variables_number = <API key>(); const Vector<unsigned int>& <API key> = <API key>.<API key>(); Vector<unsigned int> variables_indices(0, 1, variables_number-1); return(data.arrange_submatrix(<API key>, variables_indices)); } // Matrix<double> <API key>(void) const method This method returns a matrix with the testing instances in the data set. The number of rows is the number of testing instances. The number of columns is the number of variables. Matrix<double> DataSet::<API key>(void) const { const unsigned int variables_number = <API key>(); Vector<unsigned int> variables_indices(0, 1, variables_number-1); const Vector<unsigned int>& testing_indices = <API key>.get_testing_indices(); return(data.arrange_submatrix(testing_indices, variables_indices)); } // Matrix<double> arrange_input_data(void) const method This method returns a matrix with the input variables in the data set. The number of rows is the number of instances. The number of columns is the number of input variables. Matrix<double> DataSet::arrange_input_data(void) const { const unsigned int instances_number = <API key>(); Vector<unsigned int> instances_indices(0, 1, instances_number-1); const Vector<unsigned int>& inputs_indices = <API key>.get_inputs_indices(); return(data.arrange_submatrix(instances_indices, inputs_indices)); } // Matrix<double> arrange_target_data(void) const method This method returns a matrix with the target variables in the data set. The number of rows is the number of instances. The number of columns is the number of target variables. Matrix<double> DataSet::arrange_target_data(void) const { const unsigned int instances_number = <API key>(); Vector<unsigned int> instances_indices(0, 1, instances_number-1); const Vector<unsigned int>& targets_indices = <API key>.get_targets_indices(); return(data.arrange_submatrix(instances_indices, targets_indices)); } // Matrix<double> <API key>(void) const method This method returns a matrix with training instances and input variables. The number of rows is the number of training instances. The number of columns is the number of input variables. Matrix<double> DataSet::<API key>(void) const { const Vector<unsigned int>& inputs_indices = <API key>.get_inputs_indices(); const Vector<unsigned int>& training_indices = <API key>.<API key>(); return(data.arrange_submatrix(training_indices, inputs_indices)); } // Matrix<double> <API key>(void) const method This method returns a matrix with training instances and target variables. The number of rows is the number of training instances. The number of columns is the number of target variables. Matrix<double> DataSet::<API key>(void) const { const Vector<unsigned int>& training_indices = <API key>.<API key>(); const Vector<unsigned int>& targets_indices = <API key>.get_targets_indices(); return(data.arrange_submatrix(training_indices, targets_indices)); } // Matrix<double> <API key>(void) const method This method returns a matrix with generalization instances and input variables. The number of rows is the number of generalization instances. The number of columns is the number of input variables. Matrix<double> DataSet::<API key>(void) const { const Vector<unsigned int>& <API key> = <API key>.<API key>(); const Vector<unsigned int>& inputs_indices = <API key>.get_inputs_indices(); return(data.arrange_submatrix(<API key>, inputs_indices)); } // Matrix<double> <API key>(void) const method This method returns a matrix with generalization instances and target variables. The number of rows is the number of generalization instances. The number of columns is the number of target variables. Matrix<double> DataSet::<API key>(void) const { const Vector<unsigned int>& <API key> = <API key>.<API key>(); const Vector<unsigned int>& targets_indices = <API key>.get_targets_indices(); return(data.arrange_submatrix(<API key>, targets_indices)); } // Matrix<double> <API key>(void) const method This method returns a matrix with testing instances and input variables. The number of rows is the number of testing instances. The number of columns is the number of input variables. Matrix<double> DataSet::<API key>(void) const { const Vector<unsigned int>& inputs_indices = <API key>.get_inputs_indices(); const Vector<unsigned int>& testing_indices = <API key>.get_testing_indices(); return(data.arrange_submatrix(testing_indices, inputs_indices)); } // Matrix<double> <API key>(void) const method This method returns a matrix with testing instances and target variables. The number of rows is the number of testing instances. The number of columns is the number of target variables. Matrix<double> DataSet::<API key>(void) const { const Vector<unsigned int>& targets_indices = <API key>.get_targets_indices(); const Vector<unsigned int>& testing_indices = <API key>.get_testing_indices(); return(data.arrange_submatrix(testing_indices, targets_indices)); } // Vector<double> get_instance(const unsigned int&) const method This method returns the inputs and target values of a single instance in the data set. @param i Index of the instance. Vector<double> DataSet::get_instance(const unsigned int& i) const { // Control sentence (if debug) #ifdef _DEBUG unsigned int instances_number = <API key>(); if(i >= instances_number) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "Vector<double> get_instance(const unsigned int&) const method.\n" << "Index of instance must be less than number of instances.\n"; throw std::logic_error(buffer.str()); } #endif // Get instance return(data.arrange_row(i)); } // Vector<double> <API key>(const unsigned int&) const method This method returns the inputs and target values of a single training instance in the data set. @param <API key> Index of the training instance. Vector<double> DataSet::<API key>(const unsigned int& <API key>) const { // Control sentence (if debug) #ifdef _DEBUG const unsigned int <API key> = <API key>.<API key>(); if(<API key> >= <API key>) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "Vector<double> <API key>(const unsigned int&) const method.\n" << "Index of training instance must be less than number of training instances.\n"; throw std::logic_error(buffer.str()); } #endif const Vector<unsigned int>& training_indices = <API key>.<API key>(); return(data.arrange_row(training_indices[<API key>])); } // Vector<double> <API key>(const unsigned int&) const method This method returns the inputs and target values of a single generalization instance in the data set. @param <API key> Index of the generalization instance. Vector<double> DataSet::<API key>(const unsigned int& <API key>) const { // Control sentence (if debug) #ifdef _DEBUG const unsigned int <API key> = <API key>.<API key>(); if(<API key> >= <API key>) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "Vector<double> <API key>(const unsigned int&) const method.\n" << "Index of generalization instance must be less than number of generalization instances.\n"; throw std::logic_error(buffer.str()); } #endif const Vector<unsigned int>& <API key> = <API key>.<API key>(); return(data.arrange_row(<API key>[<API key>])); } // Vector<double> <API key>(const unsigned int&) const method This method returns the inputs and target values of a single testing instance in the data set. @param <API key> Index of the testing instance. Vector<double> DataSet::<API key>(const unsigned int& <API key>) const { // Control sentence (if debug) #ifdef _DEBUG const unsigned int <API key> = <API key>.<API key>(); if(<API key> >= <API key>) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "Vector<double> <API key>(const unsigned int&) const method.\n" << "Index of testing instance must be less than number of testing instances.\n"; throw std::logic_error(buffer.str()); } #endif const Vector<unsigned int>& testing_indices = <API key>.get_testing_indices(); return(data.arrange_row(testing_indices[<API key>])); } // Vector<double> get_input_instance(const unsigned int&) const method This method returns a vector with the input values of a single instance in the data set. @param instance_index Index of the instance. Vector<double> DataSet::get_input_instance(const unsigned int& instance_index) const { // Control sentence (if debug) #ifdef _DEBUG unsigned int instances_number = <API key>(); if(instance_index >= instances_number) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "Vector<double> get_input_instance(const unsigned int&) const method.\n" << "Index of instance must be less than number of instances.\n"; throw std::logic_error(buffer.str()); } #endif const Vector<unsigned int>& inputs_indices = <API key>.get_inputs_indices(); return(data.arrange_row(instance_index, inputs_indices)); } // Vector<double> get_target_instance(const unsigned int&) const method This method returns a vector with the target values of a single instance in the data set. @param instance_index Index of the instance. Vector<double> DataSet::get_target_instance(const unsigned int& instance_index) const { // Control sentence (if debug) #ifdef _DEBUG unsigned int instances_number = <API key>(); if(instance_index >= instances_number) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "Vector<double> get_target_instance(const unsigned int&) const method.\n" << "Index of instance must be less than number of instances.\n"; throw std::logic_error(buffer.str()); } #endif const Vector<unsigned int>& targets_indices = <API key>.get_targets_indices(); return(data.arrange_row(instance_index, targets_indices)); } // Vector<double> <API key>(const unsigned int&) const method This method returns the input values of a given training instance. @param <API key> Index of training instance. Vector<double> DataSet::<API key>(const unsigned int& <API key>) const { // Control sentence (if debug) #ifdef _DEBUG unsigned int <API key> = <API key>.<API key>(); if(<API key> >= <API key>) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "Vector<double> <API key>(const unsigned int&) const method.\n" << "Index of training instance (" << <API key> << ") must be less than number of training instances (" << <API key> << ").\n"; throw std::logic_error(buffer.str()); } #endif const Vector<unsigned int>& inputs_indices = <API key>.get_inputs_indices(); const Vector<unsigned int>& training_indices = <API key>.<API key>(); return(data.arrange_row(training_indices[<API key>], inputs_indices)); } // Vector<double> <API key>(const unsigned int&) const method This method returns the input values of a given generalization instance. @param <API key> Index of generalization instance. Vector<double> DataSet::<API key>(const unsigned int& <API key>) const { // Control sentence (if debug) #ifdef _DEBUG const unsigned int <API key> = <API key>.<API key>(); if(<API key> >= <API key>) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "Vector<double> <API key>(const unsigned int&) const method.\n" << "Index of generalization instance must be less than number of generalization instances.\n"; throw std::logic_error(buffer.str()); } #endif const Vector<unsigned int>& inputs_indices = <API key>.get_inputs_indices(); const Vector<unsigned int>& <API key> = <API key>.<API key>(); return(data.arrange_row(<API key>[<API key>], inputs_indices)); } // Vector<double> <API key>(const unsigned int&) const method This method returns the input values of a given testing instance. @param <API key> Index of testing instance. Vector<double> DataSet::<API key>(const unsigned int& <API key>) const { // Control sentence (if debug) #ifdef _DEBUG const unsigned int <API key> = <API key>.<API key>(); if(<API key> >= <API key>) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "Vector<double> <API key>(const unsigned int&) const method.\n" << "Index of testing instance must be less than number of testing instances.\n"; throw std::logic_error(buffer.str()); } #endif const Vector<unsigned int>& testing_indices = <API key>.get_testing_indices(); const Vector<unsigned int>& inputs_indices = <API key>.get_inputs_indices(); return(data.arrange_row(testing_indices[<API key>], inputs_indices)); } // Vector<double> <API key>(const unsigned int&) const method This method returns the target values of a given training instance. @param <API key> Index of training instance. Vector<double> DataSet::<API key>(const unsigned int& <API key>) const { // Control sentence (if debug) #ifdef _DEBUG unsigned int <API key> = <API key>.<API key>(); if(<API key> >= <API key>) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "Vector<double> <API key>(const unsigned int&) const method.\n" << "Index of training instance must be less than number of training instances.\n"; throw std::logic_error(buffer.str()); } #endif const Vector<unsigned int>& targets_indices = <API key>.get_targets_indices(); const Vector<unsigned int>& training_indices = <API key>.<API key>(); return(data.arrange_row(training_indices[<API key>], targets_indices)); } // Vector<double> <API key>(const unsigned int&) const method This method returns the target values of a given generalization instance. @param <API key> Index of generalization instance. Vector<double> DataSet::<API key>(const unsigned int& <API key>) const { // Control sentence (if debug) #ifdef _DEBUG const unsigned int <API key> = <API key>.<API key>(); if(<API key> >= <API key>) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "Vector<double> <API key>(const unsigned int&) const method.\n" << "Index of generalization instance must be less than number of generalization instances.\n"; throw std::logic_error(buffer.str()); } #endif const Vector<unsigned int>& targets_indices = <API key>.get_targets_indices(); const Vector<unsigned int>& <API key> = <API key>.<API key>(); return(data.arrange_row(<API key>[<API key>], targets_indices)); } // Vector<double> <API key>(const unsigned int&) const method This method returns the target values of a given testing instance. @param <API key> Index of testing instance. Vector<double> DataSet::<API key>(const unsigned int& <API key>) const { // Control sentence (if debug) #ifdef _DEBUG const unsigned int <API key> = <API key>.<API key>(); if(<API key> >= <API key>) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "Vector<double> <API key>(const unsigned int&) const method.\n" << "Index of testing instance must be less than number of testing instances.\n"; throw std::logic_error(buffer.str()); } #endif const Vector<unsigned int>& targets_indices = <API key>.get_targets_indices(); const Vector<unsigned int>& testing_indices = <API key>.get_testing_indices(); return(data.arrange_row(testing_indices[<API key>], targets_indices)); } // Vector<double> get_variable(const unsigned int&) const method This method returns all the instances of a single variable in the data set. @param i Index of the variable. Vector<double> DataSet::get_variable(const unsigned int& i) const { // Control sentence (if debug) #ifdef _DEBUG unsigned int variables_number = <API key>(); if(i >= variables_number) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "Vector<double> get_variable(const unsigned int&) const method.\n" << "Index of variable must be less than number of instances.\n"; throw std::logic_error(buffer.str()); } #endif // Get variable return(data.arrange_column(i)); } // void set(void) method This method sets zero instances and zero variables in the data set. void DataSet::set(void) { data_filename = ""; data.set(); <API key>.set(); <API key>.set(); display = true; } // void set(const unsigned int&, const unsigned int&) method This method sets new numbers of instances and variables in the inputs targets data set. All the instances are set for training. All the variables are set as inputs. @param <API key> Number of instances. @param <API key> Number of variables. void DataSet::set(const unsigned int& <API key>, const unsigned int& <API key>) { data_filename = ""; data.set(<API key>, <API key>); <API key>.set(<API key>); <API key>.set(<API key>); display = true; } // void set(const unsigned int&, const unsigned int&, const unsigned int&) method This method sets new numbers of instances and inputs and target variables in the data set. All the instances are set for training. The variables in the data set are the number of inputs plus the number of targets. The first variables in the data matrix correspond to the input variables. The last variables in the data matrix correspond to the target variables. @param <API key> Number of instances. @param new_inputs_number Number of input variables. @param new_targets_number Number of target variables. void DataSet::set(const unsigned int& <API key>, const unsigned int& new_inputs_number, const unsigned int& new_targets_number) { data_filename = ""; const unsigned int <API key> = new_inputs_number + new_targets_number; data.set(<API key>, <API key>); <API key>.set(<API key>); <API key>.set(new_inputs_number, new_targets_number); display = true; } // void set(const DataSet& other_data_set) This method sets the members of this data set object with those from another data set object. @param other_data_set Data set object to be copied. void DataSet::set(const DataSet& other_data_set) { data_filename = other_data_set.data_filename; data = other_data_set.data; <API key> = other_data_set.<API key>; <API key> = other_data_set.<API key>; display = other_data_set.display; } // void set(TiXmlElement*) method This method sets the data set members from a XML element. @param data_set_element Pointer to a Tiny XML element containing the member data. void DataSet::set(TiXmlElement* data_set_element) { from_XML(data_set_element); } // void set(const std::string&) method This method sets the data set members by loading them from a XML file. @param filename Data set XML filename. void DataSet::set(const std::string& filename) { load(filename); } // void <API key>(const <API key>&) method This method sets the method for scaling and uscaling the data. @param <API key> Scaling and unscaling method. void DataSet::<API key>(const <API key>& <API key>) { <API key> = <API key>; } // void <API key>(const std::string&) method This method sets the method for scaling and uscaling the data from a string containing the name of the method. @param <API key> Scaling and unscaling method. void DataSet::<API key>(const std::string& <API key>) { if(<API key> == "MinimumMaximum") { <API key>(MinimumMaximum); } else if(<API key> == "<API key>") { <API key>(MinimumMaximum); } else { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "void <API key>(const std::string&) method.\n" << "Unknown scaling and unscaling method: " << <API key> << ".\n"; throw std::logic_error(buffer.str()); } } // void set_display(const bool&) method This method sets a new display value. If it is set to true messages from this class are to be displayed on the screen; if it is set to false messages from this class are not to be displayed on the screen. @param new_display Display value. void DataSet::set_display(const bool& new_display) { display = new_display; } // void set_default(void) method This method sets the default member values: <ul> <li> Scaling and uscaling method: Minimum and maximum. <li> Display: True. </ul> void DataSet::set_default(void) { <API key> = MinimumMaximum; display = true; } // void set_data(const Matrix<double>&) method This method sets a new data matrix. The number of rows must be equal to the number of instances. The number of columns must be equal to the number of variables. Indices of all training, generalization and testing instances and inputs and target variables do not change. @param new_data Data matrix. void DataSet::set_data(const Matrix<double>& new_data) { // Control sentence (if debug) #ifdef _DEBUG const unsigned int rows_number = new_data.get_rows_number(); const unsigned int instances_number = <API key>(); if(rows_number != instances_number) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "void set_data(const Matrix<double>&) method.\n" << "Number of rows must be equal to number of instances.\n"; throw std::logic_error(buffer.str()); } const unsigned int columns_number = new_data.get_columns_number(); const unsigned int variables_number = <API key>(); if(columns_number != variables_number) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "void set_data(const Matrix<double>&) method.\n" << "Number of columns must be equal to number of variables.\n"; throw std::logic_error(buffer.str()); } #endif // Set data data = new_data; } // void set_data_filename(const std::string&) method This method sets the name of the data file. It also loads the data from that file. Moreover, it sets the variables and instances information objects. @param new_data_filename Name of the file containing the data. void DataSet::set_data_filename(const std::string& new_data_filename) { data_filename = new_data_filename; try { data.load(data_filename); const unsigned int variables_number = <API key>(); const unsigned int instances_number = <API key>(); <API key>.set(variables_number); <API key>.set(instances_number); } catch(std::exception& e) { std::cout << e.what() << std::endl; } } // void <API key>(unsigned int) method This method sets a new number of instances in the data set. All instances are also set for training. The indices of the inputs and target variables do not change. @param <API key> Number of instances. void DataSet::<API key>(const unsigned int& <API key>) { const unsigned int variables_number = <API key>(); data.set(<API key>, variables_number); <API key>.set(<API key>); } // void <API key>(unsigned int) method This method sets a new number of input variables in the data set. The indices of the training, generalization and testing instances do not change. All variables are set as inputs. @param <API key> Number of variables. void DataSet::<API key>(const unsigned int& <API key>) { const unsigned int instances_number = <API key>(); data.set(instances_number, <API key>); <API key>.set(<API key>); } // void set_instance(const unsigned int&, const Vector<double>&) This method sets new inputs and target values of a single instance in the data set. @param instance_index Index of the instance. @param instance New inputs and target values of the instance. void DataSet::set_instance(const unsigned int& instance_index, const Vector<double>& instance) { // Control sentence (if debug) #ifdef _DEBUG const unsigned int instances_number = <API key>(); if(instance_index >= instances_number) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "void set_instance(const unsigned int&, const Vector<double>&) method.\n" << "Index of instance must be less than number of instances.\n"; throw std::logic_error(buffer.str()); } const unsigned int size = instance.size(); const unsigned int variables_number = <API key>(); if(size != variables_number) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "void set_instance(const unsigned int&, const Vector<double>&) method.\n" << "Size (" << size << ") must be equal to number of variables (" << variables_number << ").\n"; throw std::logic_error(buffer.str()); } #endif // Set instance data.set_row(instance_index, instance); } // void <API key>(const unsigned int&, const Vector<double>&) method This method sets new inputs and target values of a single training instance in the data set. @param i Index of the training instance. @param <API key> New inputs and target values of the training instance. void DataSet::<API key>(const unsigned int& i, const Vector<double>& <API key>) { // Control sentence (if debug) #ifdef _DEBUG const unsigned int <API key> = <API key>.<API key>(); if(i >= <API key>) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "void <API key>(const unsigned int&, const Vector<double>&) method.\n" << "Training instance index must be less than number of training instances.\n"; throw std::logic_error(buffer.str()); } #endif const Vector<unsigned int>& training_indices = <API key>.<API key>(); const unsigned int index = training_indices[i]; set_instance(index, <API key>); } // void <API key>(const unsigned int&, const Vector<double>&) method This method sets new inputs and target values of a single generalization instance in the data set. @param i Index of the generalization instance. @param <API key> New inputs and target values of the generalization instance. void DataSet::<API key>(const unsigned int& i, const Vector<double>& <API key>) { // Control sentence (if debug) #ifdef _DEBUG const unsigned int <API key> = <API key>.<API key>(); if(i >= <API key>) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "void <API key>(const unsigned int&, const Vector<double>&) method.\n" << "Generalization instance index must be less than number of generalization instances.\n"; throw std::logic_error(buffer.str()); } #endif const Vector<unsigned int>& <API key> = <API key>.<API key>(); const unsigned int index = <API key>[i]; set_instance(index, <API key>); } // void <API key>(const unsigned int&, const Vector<double>&) method This method sets new inputs and target values of a single testing instance in the data set. @param i Index of the testing instance. @param <API key> New inputs and target values of the testing instance. void DataSet::<API key>(const unsigned int& i, const Vector<double>& <API key>) { // Control sentence (if debug) #ifdef _DEBUG const unsigned int <API key> = <API key>.<API key>(); if(i >= <API key>) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "void <API key>(const unsigned int&, const Vector<double>&) method.\n" << "Testing instance index must be less than number of testing instances.\n"; throw std::logic_error(buffer.str()); } #endif const Vector<unsigned int>& testing_indices = <API key>.get_testing_indices(); const unsigned int index = testing_indices[i]; set_instance(index, <API key>); } // void set_input_instance(const unsigned int&, const Vector<double>&) method This method sets new input values of a single instance in the data set. @param instance_index Index of the instance. @param input_instance New input values of the instance. void DataSet::set_input_instance(const unsigned int& instance_index, const Vector<double>& input_instance) { // Control sentence (if debug) #ifdef _DEBUG const unsigned int instances_number = <API key>(); if(instance_index >= instances_number) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "void set_input_instance(const unsigned int&, const Vector<double>&) method.\n" << "Index of instance must be less than number of instances.\n"; throw std::logic_error(buffer.str()); } #endif const unsigned int inputs_number = <API key>.count_inputs_number(); #ifdef _DEBUG const unsigned int size = input_instance.size(); if(size != inputs_number) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "void set_input_instance(const unsigned int&, const Vector<double>&) method.\n" << "Size of inputs instance must be equal to number of input variables.\n"; throw std::logic_error(buffer.str()); } #endif const Vector<unsigned int>& inputs_indices = <API key>.get_inputs_indices(); unsigned int <API key>; for(unsigned int i = 0; i < inputs_number; i++) { <API key> = inputs_indices[i]; data[instance_index][<API key>] = input_instance[i]; } } // void set_target_instance(const unsigned int&, const Vector<double>&) method This method sets new target values of a single instance in the data set. @param instance_index Index of the instance. @param target_instance New target values of the instance. void DataSet::set_target_instance(const unsigned int& instance_index, const Vector<double>& target_instance) { // Control sentence (if debug) #ifdef _DEBUG const unsigned int instances_number = <API key>(); if(instance_index >= instances_number) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "void set_target_instance(const unsigned int&, const Vector<double>&) method.\n" << "Index of instance must be less than number of instances.\n"; throw std::logic_error(buffer.str()); } #endif const unsigned int targets_number = <API key>.<API key>(); #ifdef _DEBUG const unsigned int size = target_instance.size(); if(size != targets_number) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "void set_target_instance(const unsigned int&, const Vector<double>&) method.\n" << "Size of targets instance must be equal to number of target variables.\n"; throw std::logic_error(buffer.str()); } #endif const Vector<unsigned int>& targets_indices = <API key>.get_targets_indices(); unsigned int <API key>; for(unsigned int i = 0; i < targets_number; i++) { <API key> = targets_indices[i]; data[instance_index][<API key>] = target_instance[i]; } } // void <API key>(const unsigned int&, const Vector<double>&) method This method sets new input values of a single training instance in the data set. @param i Index of the training instance. @param <API key> New input values of that instance. void DataSet::<API key>(const unsigned int& i, const Vector<double>& <API key>) { // Control sentence (if debug) #ifdef _DEBUG const unsigned int <API key> = <API key>.<API key>(); if(i >= <API key>) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "void <API key>(const unsigned int&, const Vector<double>&) method.\n" << "Training instance index must be less than number of training instances.\n"; throw std::logic_error(buffer.str()); } #endif const Vector<unsigned int>& training_indices = <API key>.<API key>(); const unsigned int index = training_indices[i]; set_input_instance(index, <API key>); } // void <API key>(const unsigned int&, const Vector<double>&) method This method sets new input values of a single generalization instance in the data set. @param i Index of the generalization instance. @param <API key> New input values of that instance. void DataSet::<API key>(const unsigned int& i, const Vector<double>& <API key>) { // Control sentence (if debug) #ifdef _DEBUG const unsigned int <API key> = <API key>.<API key>(); if(i >= <API key>) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "void <API key>(const unsigned int&, const Vector<double>&) method.\n" << "Generalization instance index must be less than number of generalization instances.\n"; throw std::logic_error(buffer.str()); } #endif const Vector<unsigned int>& <API key> = <API key>.<API key>(); const unsigned int index = <API key>[i]; set_input_instance(index, <API key>); } // void <API key>(const unsigned int&, const Vector<double>&) method This method sets new input values of a single testing instance in the data set. @param i Index of the testing instance. @param <API key> New input values of that instance. void DataSet::<API key>(const unsigned int& i, const Vector<double>& <API key>) { // Control sentence (if debug) #ifdef _DEBUG const unsigned int <API key> = <API key>.<API key>(); if(i >= <API key>) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "void <API key>(const unsigned int&, const Vector<double>&) method.\n" << "Testing instance index must be less than number of testing instances.\n"; throw std::logic_error(buffer.str()); } #endif const Vector<unsigned int>& testing_indices = <API key>.get_testing_indices(); const unsigned int index = testing_indices[i]; set_input_instance(index, <API key>); } // void <API key>(const unsigned int&, const Vector<double>&) method This method sets new target values of a single training instance in the data set. @param i Index of the training instance. @param <API key> New target values of that instance. void DataSet::<API key>(const unsigned int& i, const Vector<double>& <API key>) { // Control sentence (if debug) #ifdef _DEBUG const unsigned int <API key> = <API key>.<API key>(); if(i >= <API key>) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "void <API key>(const unsigned int&, const Vector<double>&) method.\n" << "Training instance index must be less than number of training instances.\n"; throw std::logic_error(buffer.str()); } #endif const Vector<unsigned int>& training_indices = <API key>.<API key>(); const unsigned int index = training_indices[i]; set_target_instance(index, <API key>); } // void <API key>(const unsigned int&, const Vector<double>&) method This method sets new target values of a single generalization instance in the data set. @param i Index of the generalization instance. @param <API key> New target values of that instance. void DataSet::<API key>(const unsigned int& i, const Vector<double>& <API key>) { // Control sentence (if debug) #ifdef _DEBUG const unsigned int <API key> = <API key>.<API key>(); if(i >= <API key>) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "void <API key>(const unsigned int&, const Vector<double>&) method.\n" << "Generalization instance index must be less than number of generalization instances.\n"; throw std::logic_error(buffer.str()); } #endif const Vector<unsigned int>& <API key> = <API key>.<API key>(); const unsigned int index = <API key>[i]; set_target_instance(index, <API key>); } // void <API key>(const unsigned int&, const Vector<double>&) method This method sets new target values of a single testing instance in the data set. @param i Index of the testing instance. @param <API key> New target values of that instance. void DataSet::<API key>(const unsigned int& i, const Vector<double>& <API key>) { // Control sentence (if debug) #ifdef _DEBUG const unsigned int <API key> = <API key>.<API key>(); if(i >= <API key>) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "void <API key>(const unsigned int&, const Vector<double>&) method.\n" << "Testing instance index must be less than number of testing instances.\n"; throw std::logic_error(buffer.str()); } #endif const Vector<unsigned int>& testing_indices = <API key>.get_testing_indices(); const unsigned int index = testing_indices[i]; set_target_instance(index, <API key>); } // void add_instance(const Vector<double>&) method This method adds a new instance to the data matrix from a vector of real numbers. The size of that vector must be equal to the number of variables. Note that resizing is here necessary and therefore computationally expensive. All instances are also set for training. @param instance Input and target values of the instance to be added. void DataSet::add_instance(const Vector<double>& instance) { // Control sentence (if debug) #ifdef _DEBUG const unsigned int size = instance.size(); const unsigned int variables_number = <API key>(); if(size != variables_number) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "void add_instance(const Vector<double>&) method.\n" << "Size of instance must be equal to number of variables.\n"; throw std::logic_error(buffer.str()); } #endif data.append_row(instance); <API key>.set_training(); } // void subtract_instance(unsigned int) method This method substract the inputs-targets instance with a given index from the data set. All instances are also set for training. Note that resizing is here necessary and therefore computationally expensive. @param instance_index Index of instance to be removed. void DataSet::subtract_instance(const unsigned int& instance_index) { // Control sentence (if debug) #ifdef _DEBUG const unsigned int instances_number = <API key>(); if(instance_index >= instances_number) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "void subtract_instance(unsigned int) method.\n" << "Index of instance must be less than number of instances.\n"; throw std::logic_error(buffer.str()); } #endif data.subtract_row(instance_index); <API key>.set_training(); } // void append_variable(const Vector<double>&) method This method appends a variable with given values to the data matrix. @param variable Vector of values. The size must be equal to the number of instances. void DataSet::append_variable(const Vector<double>& variable) { // Control sentence (if debug) #ifdef _DEBUG const unsigned int size = variable.size(); const unsigned int instances_number = <API key>(); if(size != instances_number) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "void append_variable(const Vector<double>&) method.\n" << "Size of variable must be equal to number of instances.\n"; throw std::logic_error(buffer.str()); } #endif const unsigned int variables_number = <API key>(); data.append_column(variable); Matrix<double> new_data(data); const unsigned int <API key> = variables_number + 1; <API key>(<API key>); set_data(new_data); } // void subtract_variable(unsigned int) method This method removes a variable with given index from the data matrix. @param variable_index Index of variable to be subtracted. void DataSet::subtract_variable(const unsigned int& variable_index) { const unsigned int variables_number = <API key>(); // Control sentence (if debug) #ifdef _DEBUG if(variable_index >= variables_number) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "void subtract_variable(unsigned int) method.\n" << "Index of variable must be less than number of variables.\n"; throw std::logic_error(buffer.str()); } #endif data.subtract_column(variable_index); Matrix<double> new_data(data); const unsigned int <API key> = variables_number - 1; <API key>(<API key>); set_data(new_data); } // void <API key>(void) method @todo void DataSet::<API key>(void) { } // void <API key>(void) method @todo void DataSet::<API key>(void) { } // Vector< Vector< Vector<double> > > <API key>(const unsigned int&) const method This method returns a histogram for each variable with a given number of bins. The format is a vector of subvectors of subsubvectors. The size of the vector is the number of variables. @param bins_number Number of bins. Vector< Vector< Vector<double> > > DataSet::<API key>(const unsigned int& bins_number) const { return(data.calculate_histogram(bins_number)); } // Vector< Vector< Vector<double> > > <API key>(void) const method This method returns a histogram for each variable with a default number of bins. The format is a vector of subvectors of subsubvectors. The size of the vector is the number of variables. Vector< Vector< Vector<double> > > DataSet::<API key>(void) const { return(data.calculate_histogram()); } // Vector< Vector<double> > <API key>(void) const method This method returns a vector of vectors containing some basic statistics of all the variables in the data set. The size of this vector is four. The subvectors are: <ul> <li> Minimum. <li> Maximum. <li> Mean. <li> Standard deviation. </ul> Vector< Vector<double> > DataSet::<API key>(void) const { Vector< Vector<double> > minimum_maximum = data.<API key>(); Vector< Vector<double> > <API key> = data.<API key>(); Vector< Vector<double> > statistics(4); statistics[0] = minimum_maximum[0]; statistics[1] = minimum_maximum[1]; statistics[2] = <API key>[0]; statistics[3] = <API key>[1]; return(statistics); } // Vector< Vector<double> > <API key>(void) const method This method returns a vector of vectors containing some basic statistics of all variables on the training instances. The size of this vector is four. The subvectors are: <ul> <li> Training data mean. <li> Training data standard deviation. <li> Training data minimum. <li> Training data maximum. </ul> Vector< Vector<double> > DataSet::<API key>(void) const { const unsigned int variables_number = <API key>(); const Vector<unsigned int> variables_indices(0, 1, variables_number-1); const Vector<unsigned int>& training_indices = <API key>.<API key>(); const Vector< Vector<double> > <API key> = data.<API key>(training_indices, variables_indices); const Vector< Vector<double> > minimum_maximum = data.<API key>(training_indices, variables_indices); Vector< Vector<double> > statistics(4); statistics[0] = <API key>[0]; statistics[1] = <API key>[1]; statistics[2] = minimum_maximum[0]; statistics[3] = minimum_maximum[1]; return(statistics); } // Vector< Vector<double> > <API key>(void) const method This method returns a vector of vectors containing some basic statistics of all variables on the generalization instances. The size of this vector is four. The subvectors are: <ul> <li> Generalization data mean. <li> Generalization data standard deviation. <li> Generalization data minimum. <li> Generalization data maximum. </ul> Vector< Vector<double> > DataSet::<API key>(void) const { const unsigned int variables_number = <API key>(); const Vector<unsigned int> variables_indices(0, 1, variables_number-1); const Vector<unsigned int>& <API key> = <API key>.<API key>(); const Vector< Vector<double> > <API key> = data.<API key>(<API key>, variables_indices); const Vector< Vector<double> > minimum_maximum = data.<API key>(<API key>, variables_indices); Vector< Vector<double> > statistics(4); statistics[0] = <API key>[0]; statistics[1] = <API key>[1]; statistics[2] = minimum_maximum[0]; statistics[3] = minimum_maximum[1]; return(statistics); } // Vector< Vector<double> > <API key>(void) const method This method returns a vector of vectors containing some basic statistics of all variables on the testing instances. The size of this vector is four. The subvectors are: <ul> <li> Testing data mean. <li> Testing data standard deviation. <li> Testing data minimum. <li> Testing data maximum. </ul> Vector< Vector<double> > DataSet::<API key>(void) const { const unsigned int variables_number = <API key>(); const Vector<unsigned int> variables_indices(0, 1, variables_number-1); const Vector<unsigned int>& testing_indices = <API key>.get_testing_indices(); const Vector< Vector<double> > <API key> = data.<API key>(testing_indices, variables_indices); const Vector< Vector<double> > minimum_maximum = data.<API key>(testing_indices, variables_indices); Vector< Vector<double> > statistics(4); statistics[0] = <API key>[0]; statistics[1] = <API key>[1]; statistics[2] = minimum_maximum[0]; statistics[3] = minimum_maximum[1]; return(statistics); } // Vector< Vector<double> > <API key>(void) const method This method returns a vector of vectors containing some basic statistics of all variables on all data, training, generalization and testing instances. The size of this vector is twelve. The subvectors are: <ul> <li> Data mean. <li> Data standard deviation. <li> Data minimum. <li> Data maximum. <li> Training instances mean. <li> Training instances standard deviation. <li> Training instances minimum. <li> Training instances maximum. <li> Generalization instances mean. <li> Generalization instances standard deviation. <li> Generalization instances minimum. <li> Generalization instances maximum. <li> Testing instances mean. <li> Testing instances standard deviation. <li> Testing instances minimum. <li> Testing instances maximum. </ul> Vector< Vector<double> > DataSet::<API key>(void) const { Vector< Vector<double> > data_statistics = <API key>(); Vector< Vector<double> > <API key> = <API key>(); Vector< Vector<double> > <API key> = <API key>(); Vector< Vector<double> > <API key> = <API key>(); return(data_statistics.get_assembly(<API key>).get_assembly(<API key>).get_assembly(<API key>)); } // Vector< Vector<double> > <API key>(void) const method This method returns a vector of vectors with some basic statistics of the input variables on all instances. The size of this vector is four. The subvectors are: <ul> <li> Input variables mean. <li> Input variables standard deviation. <li> Input variables minimum. <li> Input variables maximum. </ul> Vector< Vector<double> > DataSet::<API key>(void) const { const Vector<unsigned int>& inputs_indices = <API key>.get_inputs_indices(); const Vector< Vector<double> > <API key> = data.<API key>(inputs_indices); const Vector< Vector<double> > minimum_maximum = data.<API key>(inputs_indices); Vector< Vector<double> > statistics(4); statistics[0] = <API key>[0]; statistics[1] = <API key>[1]; statistics[2] = minimum_maximum[0]; statistics[3] = minimum_maximum[1]; return(statistics); } // Vector< Vector<double> > <API key>(void) const method This method returns a vector of vectors with some basic statistics of the target variables on all instances. The size of this vector is four. The subvectors are: <ul> <li> Target variables mean. <li> Target variables standard deviation. <li> Target variables minimum. <li> Target variables maximum. </ul> Vector< Vector<double> > DataSet::<API key>(void) const { const Vector<unsigned int>& targets_indices = <API key>.get_targets_indices(); const Vector< Vector<double> > <API key> = data.<API key>(targets_indices); const Vector< Vector<double> > minimum_maximum = data.<API key>(targets_indices); Vector< Vector<double> > statistics(4); statistics[0] = <API key>[0]; statistics[1] = <API key>[1]; statistics[2] = minimum_maximum[0]; statistics[3] = minimum_maximum[1]; return(statistics); } // Vector< Vector<double> > <API key>(void) const method This method returns a vector of vectors with some the minimum and maximum values of the inputs and target variables on all instances. The size of this vector is four. The subvectors are: <ul> <li> Input variables minimum. <li> Input variables maximum. <li> Target variables minimum. <li> Target variables maximum. </ul> Vector< Vector<double> > DataSet::<API key>(void) const { const Vector<unsigned int>& inputs_indices = <API key>.get_inputs_indices(); const Vector<unsigned int>& targets_indices = <API key>.get_targets_indices(); const Vector< Vector<double> > <API key> = data.<API key>(inputs_indices); const Vector< Vector<double> > <API key> = data.<API key>(targets_indices); return(<API key>.get_assembly(<API key>)); } // Vector< Vector<double> > <API key>(void) const method This method returns a vector of vectors with the mean and standard deviation values of the inputs and target variables on all instances. The size of this vector is four. The subvectors are: <ul> <li> Input variables mean. <li> Input variables standard deviation. <li> Target variables mean. <li> Target variables standard deviation. </ul> Vector< Vector<double> > DataSet::<API key>(void) const { const Vector<unsigned int>& inputs_indices = <API key>.get_inputs_indices(); const Vector<unsigned int>& targets_indices = <API key>.get_targets_indices(); const Vector< Vector<double> > <API key> = data.<API key>(inputs_indices); const Vector< Vector<double> > <API key> = data.<API key>(targets_indices); return(<API key>.get_assembly(<API key>)); } // Vector< Vector<double> > <API key>(void) const method This method returns a vector of vectors with some basic statistics of the inputs and target variables on all instances. The size of this vector is eight. The subvectors are: <ul> <li> Input variables mean. <li> Input variables standard deviation. <li> Input variables minimum. <li> Input variables maximum. <li> Target variables mean. <li> Target variables standard deviation. <li> Target variables minimum. <li> Target variables maximum. </ul> Vector< Vector<double> > DataSet::<API key>(void) const { const Vector<unsigned int>& inputs_indices = <API key>.get_inputs_indices(); const Vector<unsigned int>& targets_indices = <API key>.get_targets_indices(); Vector< Vector<double> > statistics(8); // Input const Vector< Vector<double> > <API key> = data.<API key>(inputs_indices); const Vector< Vector<double> > <API key> = data.<API key>(inputs_indices); statistics[0] = <API key>[0]; statistics[1] = <API key>[1]; statistics[2] = <API key>[0]; statistics[3] = <API key>[1]; // Target const Vector< Vector<double> > <API key> = data.<API key>(targets_indices); const Vector< Vector<double> > <API key> = data.<API key>(targets_indices); statistics[4] = <API key>[0]; statistics[5] = <API key>[1]; statistics[6] = <API key>[0]; statistics[7] = <API key>[1]; return(statistics); } // Vector<double> <API key>(void) const method This method returns the mean values of the target variables on the training instances. Vector<double> DataSet::<API key>(void) const { const Vector<unsigned int>& targets_indices = <API key>.get_targets_indices(); const Vector<unsigned int>& training_indices = <API key>.<API key>(); return(data.calculate_mean(training_indices, targets_indices)); } // Vector<double> <API key>(void) const method This method returns the mean values of the target variables on the generalization instances. Vector<double> DataSet::<API key>(void) const { const Vector<unsigned int>& targets_indices = <API key>.get_targets_indices(); const Vector<unsigned int>& <API key> = <API key>.<API key>(); return(data.calculate_mean(<API key>, targets_indices)); } // Vector<double> <API key>(void) const method This method returns the mean values of the target variables on the testing instances. Vector<double> DataSet::<API key>(void) const { const Vector<unsigned int>& testing_indices = <API key>.get_testing_indices(); const Vector<unsigned int>& targets_indices = <API key>.get_targets_indices(); return(data.calculate_mean(testing_indices, targets_indices)); } // Matrix<double> <API key>(void) const method @todo Matrix<double> DataSet::<API key>(void) const { Matrix<double> <API key>; return(<API key>); } // void <API key>(const Vector<double>&, const Vector<double>&) const method This method scales the data matrix with given mean and standard deviation values. It updates the data matrix. @param means Mean of columns. @param standard_deviations Standard deviation of columns. void DataSet::<API key>(const Vector<double>& means, const Vector<double>& standard_deviations) { // Control sentence (if debug) #ifdef _DEBUG std::ostringstream buffer; const unsigned int columns_number = data.get_columns_number(); const unsigned int means_size = means.size(); const unsigned int <API key> = standard_deviations.size(); if(means_size != columns_number) { buffer << "OpenNN Exception: DataSet class.\n" << "void <API key>(const Vector<double>&, const Vector<double>&) method.\n" << "Size of means must be equal to number of columns.\n"; throw std::logic_error(buffer.str()); } if(<API key> != columns_number) { buffer << "OpenNN Exception: DataSet class.\n" << "void <API key>(const Vector<double>&, const Vector<double>&) method.\n" << "Size of standard deviations must be equal to number of columns.\n"; throw std::logic_error(buffer.str()); } #endif data.<API key>(means, standard_deviations); } // void <API key>(const Vector<double>&, const Vector<double>&) method This method scales the data matrix with given minimum and maximum values. It updates the data matrix. @param minimums Minimum values for all variables. @param maximums Maximum values for all variables. void DataSet::<API key>(const Vector<double>& minimums, const Vector<double>& maximums) { // Control sentence (if debug) #ifdef _DEBUG std::ostringstream buffer; const unsigned int columns_number = data.get_columns_number(); const unsigned int minimums_size = minimums.size(); const unsigned int maximums_size = maximums.size(); if(minimums_size != columns_number) { buffer << "OpenNN Exception: DataSet class.\n" << "void <API key>(const Vector<double>&, const Vector<double>&) method.\n" << "Size of minimums must be equal to number of columns.\n"; throw std::logic_error(buffer.str()); } if(maximums_size != columns_number) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "void <API key>(const Vector<double>&, const Vector<double>&) method.\n" << "Size of maximums must be equal to number of columns.\n"; throw std::logic_error(buffer.str()); } #endif data.<API key>(minimums, maximums); } // void scale_data(const Vector< Vector<double> >&) method This method scales the data matrix. The method to be used is that in the scaling and unscaling method variable. @param statistics Vector of vectors with the basic statistics. void DataSet::scale_data(const Vector< Vector<double> >& statistics) { const Vector<double>& minimums = statistics[0]; const Vector<double>& maximums = statistics[0]; const Vector<double>& means = statistics[0]; const Vector<double>& standard_deviations = statistics[0]; switch(<API key>) { case MinimumMaximum: { <API key>(minimums, maximums); } break; case <API key>: { <API key>(means, standard_deviations); } break; default: { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class\n" << "void scale_data(const Vector< Vector<double> >&) method.\n" << "Unknown scaling and unscaling method.\n"; throw std::logic_error(buffer.str()); } break; } } // Vector< Vector<double> > scale_data(void) method This method calculates the data statistics, scales the data with that values and returns the statistics. The method to be used is that in the scaling and unscaling method variable. Vector< Vector<double> > DataSet::scale_data(void) { const Vector< Vector<double> >& statistics = data.<API key>(); const Vector<double>& minimums = statistics[0]; const Vector<double>& maximums = statistics[0]; const Vector<double>& means = statistics[0]; const Vector<double>& standard_deviations = statistics[0]; switch(<API key>) { case MinimumMaximum: { <API key>(minimums, maximums); } break; case <API key>: { <API key>(means, standard_deviations); } break; default: { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class\n" << "const Vector< Vector<double> > scale_data(void) method.\n" << "Unknown scaling and unscaling method.\n"; throw std::logic_error(buffer.str()); } break; } return(statistics); } // void <API key>(const Vector<double>&, const Vector<double>&) method This method scales the input variables with given mean and standard deviation values. It updates the input variables of the data matrix. @param inputs_mean Mean values for the input variables to be used for scaling. @param <API key> Standard deviation values for the input variables to be used for scaling. void DataSet::<API key>(const Vector<double>& inputs_mean, const Vector<double>& <API key>) { const unsigned int inputs_number = <API key>.count_inputs_number(); // Control sentence (if debug) #ifdef _DEBUG const unsigned int inputs_mean_size = inputs_mean.size(); const unsigned int <API key> = <API key>.size(); if(inputs_mean_size != inputs_number) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "void <API key>(const Vector<double>&, const Vector<double>&) method.\n" << "Size of input variables mean must be equal to number of input variables.\n"; throw std::logic_error(buffer.str()); return; } if(<API key> != inputs_number) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "void <API key>(const Vector<double>&, const Vector<double>&) method.\n" << "Size of input variables standard deviation must be equal to number of input variables.\n"; throw std::logic_error(buffer.str()); return; } #endif const Vector<unsigned int>& inputs_indices = <API key>.get_inputs_indices(); const unsigned int instances_number = <API key>(); unsigned int variable_index; // Rescale inputs data for(unsigned int j = 0; j < inputs_number; j++) { variable_index = inputs_indices[j]; if(<API key>[j] < 1e-99) { if(display) { std::cout << "OpenNN Warning: DataSet class.\n" << "void <API key>(const Vector<double>&, const Vector<double>&) method.\n" << "Standard deviation of input variable " << j << " is zero.\n" << "Those inputs won't be scaled.\n"; } // Do nothing } else { for(unsigned int i = 0; i < instances_number; i++) { data[i][variable_index] = (data[i][variable_index] - inputs_mean[j])/<API key>[j]; } } } } // Vector< Vector<double> > <API key>(void) method This method scales the input variables with the calculated mean and standard deviation values from the data matrix. It updates the input variables of the data matrix. It also returns a vector of vectors with the variables statistics. Vector< Vector<double> > DataSet::<API key>(void) { const Vector< Vector<double> > <API key> = <API key>(); const Vector<double>& inputs_means = <API key>[2]; const Vector<double>& <API key> = <API key>[3]; <API key>(inputs_means, <API key>); return(<API key>); } // void <API key>(const Vector<double>&, const Vector<double>&) method This method scales the input variables with given minimum and maximum values. It updates the input variables of the data matrix. @param inputs_minimum Minimum values for the input variables to be used for scaling. @param inputs_maximum Maximum values for the input variables to be used for scaling. void DataSet::<API key>(const Vector<double>& inputs_minimum, const Vector<double>& inputs_maximum) { const Vector<unsigned int>& inputs_indices = <API key>.get_inputs_indices(); const unsigned int instances_number = <API key>(); const unsigned int inputs_number = <API key>.count_inputs_number(); unsigned int variable_index; for(unsigned int j = 0; j < inputs_number; j++) { variable_index = inputs_indices[j]; if(inputs_maximum[j] - inputs_minimum[j] < 1e-99) { if(display) { std::cout << "OpenNN Warning: DataSet class.\n" << "void <API key>(const Vector<double>&, const Vector<double>&) method.\n" << "Minimum and maximum values of input variable " << j << " are equal. " << "Those inputs won't be scaled.\n"; } // Do nothing } else { for(unsigned int i = 0; i < instances_number; i++) { data[i][variable_index] = 2.0*(data[i][variable_index] - inputs_minimum[j])/(inputs_maximum[j]-inputs_minimum[j])-1.0; } } } } // Vector< Vector<double> > <API key>(void) method This method scales the input variables with the calculated minimum and maximum values from the data matrix. It updates the input variables of the data matrix. It also returns a vector of vectors with the minimum and maximum values of the input variables. Vector< Vector<double> > DataSet::<API key>(void) { const Vector< Vector<double> > <API key> = <API key>(); const Vector<double> & inputs_minimums = <API key>[0]; const Vector<double> & inputs_maximums = <API key>[1]; <API key>(inputs_minimums, inputs_maximums); return(<API key>); } // Vector< Vector<double> > scale_inputs(void) method This method calculates the input and target variables statistics. Then it scales the input variables with that values. The method to be used is that in the scaling and unscaling method variable. Finally, it returns the statistics. Vector< Vector<double> > DataSet::scale_inputs(void) { switch(<API key>) { case MinimumMaximum: { return(<API key>()); } break; case <API key>: { return(<API key>()); } break; default: { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class\n" << "Vector< Vector<double> > scale_inputs(void) method.\n" << "Unknown scaling and unscaling method.\n"; throw std::logic_error(buffer.str()); } break; } } // void <API key>(const Vector<double>&, const Vector<double>&) This method scales the target variables with given mean and standard deviation values. It updates the target variables of the data matrix. @param targets_mean Mean values for the target variables to be used for scaling. @param <API key> Standard deviation values for the target variables to be used for scaling. void DataSet::<API key>(const Vector<double>& targets_mean, const Vector<double>& <API key>) { const unsigned int targets_number = <API key>.<API key>(); // Control sentence (if debug) #ifdef _DEBUG const unsigned int targets_mean_size = targets_mean.size(); const unsigned int <API key> = <API key>.size(); if(targets_mean_size != targets_number) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "void <API key>(const Vector<double>&, const Vector<double>&) method.\n" << "Size of target variables mean must be equal to number of target variables.\n"; throw std::logic_error(buffer.str()); } if(<API key> != targets_number) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "void <API key>(const Vector<double>&, const Vector<double>&) method.\n" << "Size of target variables standard deviation must be equal to number of target variables.\n"; throw std::logic_error(buffer.str()); } #endif const Vector<unsigned int>& targets_indices = <API key>.get_targets_indices(); const unsigned int instances_number = <API key>(); unsigned int variable_index; // Rescale targets data for(unsigned int j = 0; j < targets_number; j++) { variable_index = targets_indices[j]; if(<API key>[j] < 1e-99) { if(display) { std::cout << "OpenNN Warning: DataSet class.\n" << "void <API key>(const Vector<double>&, const Vector<double>&) method.\n" << "Standard deviation of target variable " << j << " is zero.\n" << "Those targets won't be scaled.\n"; } // Do nothing } else { for(unsigned int i = 0; i < instances_number; i++) { data[i][variable_index] = (data[i][variable_index] - targets_mean[j])/<API key>[j]; } } } } // Vector< Vector<double> > <API key>(void) method This method scales the target variables with the calculated mean and standard deviation values from the data matrix. It updates the target variables of the data matrix. It also returns a vector of vectors with the basic statistics of the inputs and target variables. <ul> <li> Input data mean. <li> Input data standard deviation. <li> Input data minimum. <li> Input data maximum. <li> Target data mean. <li> Target data standard deviation. <li> Target data minimum. <li> Target data maximum. </ul> Vector< Vector<double> > DataSet::<API key>(void) { Vector< Vector<double> > <API key> = <API key>(); const Vector<double>& targets_means = <API key>[4]; const Vector<double>& <API key> = <API key>[5]; <API key>(targets_means, <API key>); return(<API key>); } // void <API key>(const Vector<double>&, const Vector<double>&) method This method scales the target variables with given minimum and maximum values. It updates the target variables of the data matrix. @param targets_minimum Minimum values for the target variables to be used for scaling. @param targets_maximum Maximum values for the target variables to be used for scaling. void DataSet::<API key>(const Vector<double>& targets_minimum, const Vector<double>& targets_maximum) { const unsigned int instances_number = <API key>(); const unsigned int targets_number = <API key>.<API key>(); const Vector<unsigned int>& targets_indices = <API key>.get_targets_indices(); unsigned int variable_index; // Rescale targets data for(unsigned int j = 0; j < targets_number; j++) { variable_index = targets_indices[j]; if(targets_maximum[j] - targets_minimum[j] < 1e-99) { if(display) { std::cout << "OpenNN Warning: DataSet class.\n" << "void <API key>(const Vector<double>&, const Vector<double>&) method.\n" << "Minimum and maximum values of target variable " << j << " are equal. " << "Those targets won't be scaled.\n" << "Minimum: " << targets_minimum[j] << "\n" << "Maximum: " << targets_maximum[j] << std::endl; } // Do nothing } else { for(unsigned int i = 0; i < instances_number; i++) { data[i][variable_index] = 2.0*(data[i][variable_index] - targets_minimum[j])/(targets_maximum[j]-targets_minimum[j]) - 1.0; } } } } // Vector< Vector<double> > <API key>(void) method This method scales the target variables with the calculated minimum and maximum values from the data matrix. It updates the target variables of the data matrix. It also returns a vector of vectors with the statistics of the input target variables. Vector< Vector<double> > DataSet::<API key>(void) { const Vector< Vector<double> > <API key> = <API key>(); const Vector<double>& targets_minimums = <API key>[4]; const Vector<double>& targets_maximums = <API key>[5]; <API key>(targets_minimums, targets_maximums); return(<API key>); } // Vector< Vector<double> > scale_targets(void) method This method calculates the input and target variables statistics. Then it scales the target variables with that values. The method to be used is that in the scaling and unscaling method variable. Finally, it returns the statistics. Vector< Vector<double> > DataSet::scale_targets(void) { switch(<API key>) { case MinimumMaximum: { return(<API key>()); } break; case <API key>: { return(<API key>()); } break; default: { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class\n" << "Vector< Vector<double> > scale_targets(void) method.\n" << "Unknown scaling and unscaling method.\n"; throw std::logic_error(buffer.str()); } break; } } // void <API key>(const Vector<double>&, const Vector<double>&, const Vector<double>&, const Vector<double>&) method This method scales the inputs and the target variables with given mean and standard deviation values. Please note that it takes as argument a vector of vectors of all basic statistics, with size eight. It updates the inputs and the target variables of the data matrix. @param inputs_means Mean values used for scaling the input variables. @param <API key> Standard deviation values used for scaling the input variables. @param targets_means Mean values used for scaling the target variables. @param <API key> Standard deviation values used for scaling the target variables. void DataSet::<API key>(const Vector<double>& inputs_means, const Vector<double>& <API key>, const Vector<double>& targets_means, const Vector<double>& <API key>) { <API key>(inputs_means, <API key>); <API key>(targets_means, <API key>); } // Vector< Vector<double> > <API key>(void) method This method scales the inputs and the target variables with the mean and standard deviation values calculated from the data matrix. It updates the inputs and target variables of the data. It also returns the vector of vectors containing the computed statistics of the data set: <ul> <li> Input variables mean. <li> Input variables standard deviation. <li> Input variables minimum. <li> Input variables maximum. <li> Target variables mean. <li> Target variables standard deviation. <li> Target variables minimum. <li> Target variables maximum. </ul> Vector< Vector<double> > DataSet::<API key>(void) { const Vector< Vector<double> > <API key> = <API key>(); const Vector<double>& inputs_means = <API key>[2]; const Vector<double>& <API key> = <API key>[3]; const Vector<double>& targets_means = <API key>[6]; const Vector<double>& <API key> = <API key>[7]; <API key>(inputs_means, <API key>, targets_means, <API key>); return(<API key>); } // void <API key>(const Vector<double>&, const Vector<double>&, const Vector<double>&, const Vector<double>&) method This method scales the inputs and the target variables with given minimum and maximum values. Please note that it takes as argument a vector of vectors of all basic statistics, with size eight. It updates the inputs and the target variables of the data matrix. @param inputs_minimums Minimum values used for scaling the input variables. @param inputs_maximums Maximums values used for scaling the input variables. @param targets_minimums Minimum values used for scaling the target variables. @param targets_maximums Maximum values used for scaling the target variables. void DataSet::<API key>(const Vector<double>& inputs_minimums, const Vector<double>& inputs_maximums, const Vector<double>& targets_minimums, const Vector<double>& targets_maximums) { <API key>(inputs_minimums, inputs_maximums); <API key>(targets_minimums, targets_maximums); } // Vector< Vector<double> > <API key>(void) method This method scales the input and the target variables with the minumum and maximum values calculated from the data matrix. It updates the inputs and target variables of the data. It also returns the vector of vectors containing the computed statistics of the data set: <ul> <li> Input variables mean. <li> Input variables standard deviation. <li> Input variables minimum. <li> Input variables maximum. <li> Target variables mean. <li> Target variables standard deviation. <li> Target variables minimum. <li> Target variables maximum. </ul> Vector< Vector<double> > DataSet::<API key>(void) { const Vector< Vector<double> > <API key> = <API key>(); const Vector<double> inputs_minimums = <API key>[0]; const Vector<double> inputs_maximums = <API key>[1]; const Vector<double> targets_minimums = <API key>[4]; const Vector<double> targets_maximums = <API key>[5]; <API key>(inputs_minimums, inputs_maximums, targets_minimums, targets_maximums); return(<API key>); } // Vector< Vector<double> > <API key>(void) method This method calculates the input and target variables statistics. Then it scales the data with that values. The method to be used is that in the scaling and unscaling method variable. Finally, it returns the statistics. Vector< Vector<double> > DataSet::<API key>(void) { switch(<API key>) { case MinimumMaximum: { return(<API key>()); } break; case <API key>: { return(<API key>()); } break; default: { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class\n" << "Vector< Vector<double> > <API key>(void) method.\n" << "Unknown scaling and unscaling method.\n"; throw std::logic_error(buffer.str()); } break; } } // void <API key>(const Vector<double>&, const Vector<double>&) method This method unscales the data matrix with given mean and standard deviation values. It updates the data matrix. @param mean Mean of variables. @param standard_deviation Standard deviation of variables. void DataSet::<API key>(const Vector<double>& mean, const Vector<double>& standard_deviation) { data.<API key>(mean, standard_deviation); } // void <API key>(const Vector<double>&, const Vector<double>&) method This method unscales the data matrix with given minimum and maximum values. It updates the data matrix. @param minimum Minimum of variables. @param maximum Maximum of variables. void DataSet::<API key>(const Vector<double>& minimum, const Vector<double>& maximum) { data.<API key>(minimum, maximum); } // void <API key>(const Vector<double>&, const Vector<double>&) method This method unscales the input variables with given mean and standard deviation values. It updates the input variables of the data matrix. @param inputs_mean Mean values for the input variables to be used for unscaling. @param <API key> Standard deviation values for the input variables to be used for unscaling. void DataSet::<API key>(const Vector<double>& inputs_mean, const Vector<double>& <API key>) { const unsigned int instances_number = <API key>(); const unsigned int inputs_number = <API key>.count_inputs_number(); // Postprocess inputs data for(unsigned int j = 0; j < inputs_number; j++) { if(<API key>[j] < 1e-99) { if(display) { std::cout << "OpenNN Warning: DataSet class.\n" << "void <API key>(const Vector<double>&, const Vector<double>&) method.\n" << "Standard deviation of input variable " << j << " is zero.\n" << "Those inputs won't be scaled.\n"; } // Do nothing } else { for(unsigned int i = 0; i < instances_number; i++) { data[i][j] = data[i][j]*<API key>[j] + inputs_mean[j]; } } } } // void <API key>(const Vector<double>&, const Vector<double>&) method This method unscales the input variables with given minimum and maximum values. It updates the input variables of the data matrix. @param inputs_minimum Minimum values for the input variables to be used for unscaling. @param inputs_maximum Maximum values for the input variables to be used for unscaling. void DataSet::<API key>(const Vector<double>& inputs_minimum, const Vector<double>& inputs_maximum) { const unsigned int instances_number = <API key>(); const unsigned int inputs_number = <API key>.count_inputs_number(); // Postprocess inputs data for(unsigned int j = 0; j < inputs_number; j++) { if(inputs_maximum[j] - inputs_minimum[j] < 1e-99) { if(display) { std::cout << "OpenNN Warning: DataSet class.\n" << "void <API key>(const Vector<double>&, const Vector<double>&) method.\n" << "Minimum and maximum values of input variable " << j << " are equal.\n" << "Those inputs won't be unscaled.\n"; } // Do nothing } else { for(unsigned int i = 0; i < instances_number; i++) { data[i][j] = 0.5*(data[i][j] + 1.0)*(inputs_maximum[j]-inputs_minimum[j]) + inputs_minimum[j]; } } } } // void <API key>(const Vector<double>&, const Vector<double>&) method This method unscales the target variables with given mean and standard deviation values. It updates the target variables of the data matrix. @param targets_mean Mean values for the target variables to be used for unscaling. @param <API key> Standard deviation values for the target variables to be used for unscaling. void DataSet::<API key>(const Vector<double>& targets_mean, const Vector<double>& <API key>) { const unsigned int instances_number = <API key>(); const unsigned int targets_number = <API key>.<API key>(); // Rescale targets data for(unsigned int j = 0; j < targets_number; j++) { if(<API key>[j] < 1e-99) { if(display) { std::cout << "OpenNN Warning: DataSet class.\n" << "void <API key>(const Vector<double>&) method.\n" << "Standard deviation of target variable " << j << " is zero.\n" << "Those targets won't be scaled.\n"; } // Do nothing } else { for(unsigned int i = 0; i < instances_number; i++) { data[i][j] = data[i][j]*<API key>[j] + targets_mean[j]; } } } } // void <API key>(const Vector<double>&, const Vector<double>&) method This method unscales the target variables with given minimum and maximum values. It updates the target variables of the data matrix. @param targets_minimum Minimum values for the target variables to be used for unscaling. @param targets_maximum Maximum values for the target variables to be used for unscaling. void DataSet::<API key>(const Vector<double>& targets_minimum, const Vector<double>& targets_maximum) { unsigned int instances_number = <API key>(); unsigned int targets_number = <API key>.<API key>(); // Postprocess targets data for(unsigned int j = 0; j < targets_number; j++) { if(targets_maximum[j] - targets_minimum[j] < 1e-99) { if(display) { std::cout << "OpenNN Warning: DataSet class.\n" << "void <API key>(const Vector<double>&, const Vector<double>&) method.\n" << "Minimum and maximum values of target variable " << j << " are equal.\n" << "Those targets won't be unscaled.\n"; } // Do nothing } else { for(unsigned int i = 0; i < instances_number; i++) { data[i][j] = 0.5*(data[i][j] + 1.0)*(targets_maximum[j]-targets_minimum[j]) + targets_minimum[j]; } } } } // void <API key>(const Vector< Vector<double> >&) method This method unscales the inputs and the target variables with given mean and standard deviation values. Please note that it takes as argument a vector of vectors of all basic statistics, with size eight. It updates the inputs and the target variables of the data matrix. @param <API key> Statistics for the inputs and target variables to be used for unscaling. void DataSet::<API key>(const Vector< Vector<double> >& <API key>) { // Control sentence (if debug) #ifdef _DEBUG unsigned int size = <API key>.size(); if(size != 8) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "void <API key>(const Vector< Vector<double> >&) method.\n" << "Size of statistics must be 8.\n"; throw std::logic_error(buffer.str()); } for(unsigned int i = 0; i < 8; i++) { size = <API key>[i].size(); if(size != 8) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "void <API key>(const Vector< Vector<double> >&) method.\n" << "Size of statistics element " << i << " must be equal to number of variables.\n"; throw std::logic_error(buffer.str()); } } #endif <API key>(<API key>[2], <API key>[3]); <API key>(<API key>[6], <API key>[7]); } // void <API key>(const Vector< Vector<double> >&) method This method unscales the inputs and the target variables with given minimum and maximum values. Please note that it takes as argument a vector of vectors of all basic statistics, with size eight. It updates the inputs and the target variables of the data matrix. @param <API key> Statistics for the inputs and target variables to be used for unscaling. void DataSet::<API key>(const Vector< Vector<double> >& <API key>) { // Control sentence (if debug) #ifdef _DEBUG unsigned int size = <API key>.size(); if(size != 8) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "void <API key>(const Vector< Vector<double> >&) method.\n" << "Size of statistics must be 8.\n"; throw std::logic_error(buffer.str()); } #endif <API key>(<API key>[0], <API key>[1]); <API key>(<API key>[4], <API key>[5]); } // void initialize_data(const double& value) method This methods initializes the data matrix with a given value. @param new_value Initialization value. void DataSet::initialize_data(const double& new_value) { data.initialize(new_value); } // void <API key>(void) method This methods initializes the data matrix with random given values chosen from a normal distribution with mean 0 and standard deviation 1. void DataSet::<API key>(void) { data.initialize_normal(); } // TiXmlElement* to_XML(void) const method This method serializes the data set object into a XML element of the TinyXML library. TiXmlElement* DataSet::to_XML(void) const { std::ostringstream buffer; // Data set TiXmlElement* data_set_element = new TiXmlElement("DataSet"); data_set_element->SetAttribute("Version", 4); // Data filename if(!data_filename.empty()) { TiXmlElement* <API key> = new TiXmlElement("DataFilename"); data_set_element->LinkEndChild(<API key>); TiXmlText* data_filename_text = new TiXmlText(data_filename.c_str()); <API key>->LinkEndChild(data_filename_text); } // Variables information TiXmlElement* <API key> = <API key>.to_XML(); data_set_element->LinkEndChild(<API key>); // Instances information TiXmlElement* <API key> = <API key>.to_XML(); data_set_element->LinkEndChild(<API key>); return(data_set_element); } // void from_XML(TiXmlElement*) method This method deserializes a TinyXML element into this data set object. @param data_set_element Pointer to a XML element containing the member data. void DataSet::from_XML(TiXmlElement* data_set_element) { if(!data_set_element) { return; } // Data filename TiXmlElement* <API key> = data_set_element->FirstChildElement("DataFilename"); if(<API key>) { std::string new_data_filename = <API key>->GetText(); try { set_data_filename(new_data_filename); load_data(new_data_filename); } catch(std::exception& e) { std::cout << e.what() << std::endl; } } // Variables information TiXmlElement* <API key> = data_set_element->FirstChildElement("<API key>"); if(<API key>) { <API key>.from_XML(<API key>); } // Instances information TiXmlElement* <API key> = data_set_element->FirstChildElement("<API key>"); if(<API key>) { <API key>.from_XML(<API key>); } } // std::string to_string(void) const method This method returns a string representation of the current data set object. std::string DataSet::to_string(void) const { std::ostringstream buffer; buffer << "Data filename: " << data_filename << "\n" << <API key>.to_string() << <API key>.to_string() << "Display: " << display << "\n" << "Data:\n" << data; return(buffer.str()); } // void print(void) const method This method prints to the screen in a XML-type format the members of the data set object. void DataSet::print(void) const { if(display) { std::cout << to_string(); } } // void save(const std::string&) const method This method saves the members of a data set object to a XML-type file in an XML-type format. @param filename Name of data set XML-type file. void DataSet::save(const std::string& filename) const { TiXmlDocument document; TiXmlDeclaration* declaration = new TiXmlDeclaration("1.0", "", ""); document.LinkEndChild(declaration); TiXmlElement* data_set_element = to_XML(); document.LinkEndChild(data_set_element); document.SaveFile(filename.c_str()); } // void load(const std::string&) method This method loads the members of a data set object from a XML-type file: <ul> <li> Instances number. <li> Training instances number. <li> Training instances indices. <li> Generalization instances number. <li> Generalization instances indices. <li> Testing instances number. <li> Testing instances indices. <li> Input variables number. <li> Input variables indices. <li> Target variables number. <li> Target variables indices. <li> Input variables name. <li> Target variables name. <li> Input variables description. <li> Target variables description. <li> Display. <li> Data. </ul> Please mind about the file format. This is specified in the User's Guide. @param filename Name of data set XML-type file. void DataSet::load(const std::string& filename) { std::ostringstream buffer; TiXmlDocument document(filename.c_str()); if(!document.LoadFile()) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "void load(const std::string&) method.\n" << "Cannot load XML file " << filename << ".\n"; throw std::logic_error(buffer.str()); } // Root TiXmlElement* data_set_element = document.FirstChildElement("DataSet"); if(!data_set_element) { buffer << "OpenNN Exception: DataSet class.\n" << "void load(const std::string&) method.\n" << "File " << filename << " is not a valid data set file.\n"; throw std::logic_error(buffer.str()); } from_XML(data_set_element); } // void print_data(void) const method This method prints to the sceen the values of the data matrix. void DataSet::print_data(void) const { if(display) { std::cout << data; } } // void save_data(const std::string&) const method This method saves to a file the values of the data matrix. @param filename Name of data file. void DataSet::save_data(const std::string& filename) const { std::ofstream file(filename.c_str()); if(!file.is_open()) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "void save_data(const std::string&) const method.\n" << "Cannot open data file.\n"; throw std::logic_error(buffer.str().c_str()); } // Write data file << data; // Close file file.close(); } // void load_data(const std::string& filename) This method loads from a file the values of the data matrix. The number of rows must be equal to the number of instances. The number of columns must be equal to the number of variables. void DataSet::load_data(const std::string& new_data_filename) { data_filename = new_data_filename; data.load(data_filename); unsigned int variables_number = data.get_columns_number(); <API key>.set(variables_number); unsigned int instances_number = data.get_rows_number(); <API key>.set(instances_number); } // Vector<int> <API key>(void) const method This method returns a vector containing the number of instances of each class in the data set. If the number of target variables is one then the number of classes is two. If the number of target variables is greater than one then the number of classes is equal to the number of target variables. Vector<unsigned int> DataSet::<API key>(void) const { // Control sentence (if debug) const unsigned int instances_number = <API key>(); const unsigned int targets_number = <API key>.<API key>(); const Vector<unsigned int>& targets_indices = <API key>.get_targets_indices(); Vector<unsigned int> class_distribution; if(targets_number == 1) // Two classes { class_distribution.set(2, 0); int target_index = targets_indices[0]; for(unsigned int instance_index = 0; instance_index < instances_number; instance_index++) { if(data[instance_index][target_index] < 0.5) { class_distribution[0]++; } else { class_distribution[1]++; } } } else // More than two classes { class_distribution.set(targets_number, 0); for(unsigned int i = 0; i < instances_number; i++) { for(unsigned int j = 0; j < targets_number; j++) { if(data[i][targets_indices[j]] > 0.5) { class_distribution[j]++; } } } } // Check data consistency if(class_distribution.calculate_sum() != instances_number) { std::ostringstream buffer; buffer << "OpenNN Exception: DataSet class.\n" << "Vector<int> <API key>(void) const method.\n" << "Sum of class distributions is not equal to number of instances.\n" << "Class distribution: " << class_distribution << std::endl; throw std::logic_error(buffer.str().c_str()); } return(class_distribution); } // TiXmlElement* <API key>(void) const method //TiXmlElement* DataSet::<API key>(void) const // return(NULL); // TiXmlElement* <API key>(void) const method //TiXmlElement* DataSet::<API key>(void) const // return(NULL); // TiXmlElement* report_data_XML(void) const method //TiXmlElement* DataSet::report_data_XML(void) const // TiXmlElement* report_data_element = new TiXmlElement("ReportData"); // TiXmlElement* data_element = new TiXmlElement("Data"); // report_data_element->LinkEndChild(data_element); // std::string data_string;// = data.to_string(); // TiXmlText* data_text = new TiXmlText(data_string.c_str()); // data_element->LinkEndChild(data_text); // return(report_data_element); // TiXmlElement* <API key>(void) const method This method returns a HTML formated string with the basic statistics of the data matrix. //TiXmlElement* DataSet::<API key>(void) const // const Vector< Vector<double> > data_statistics = <API key>(); // const Vector<std::string> <API key> = <API key>.get_default_names(); // TiXmlElement* <API key> = new TiXmlElement("<API key>"); // Variables name // TiXmlElement* <API key> = new TiXmlElement("VariablesName"); // <API key>->LinkEndChild(<API key>); // TiXmlText* variables_name_text = new TiXmlText("data_string"); // <API key>->LinkEndChild(variables_name_text); // Variables minimum // TiXmlElement* <API key> = new TiXmlElement("VariablesMinimum"); // <API key>->LinkEndChild(<API key>); // TiXmlText* <API key> = new TiXmlText("variables_minimum"); // <API key>->LinkEndChild(<API key>); // Variables maximum // TiXmlElement* <API key> = new TiXmlElement("VariablesMaximum"); // <API key>->LinkEndChild(<API key>); // TiXmlText* <API key> = new TiXmlText("variables_maximum"); // <API key>->LinkEndChild(<API key>); // Variables mean // TiXmlElement* <API key> = new TiXmlElement("VariablesMean"); // <API key>->LinkEndChild(<API key>); // TiXmlText* variables_mean_text = new TiXmlText("variables_mean"); // <API key>->LinkEndChild(variables_mean_text); // Variables standard deviation // TiXmlElement* <API key> = new TiXmlElement("<API key>"); // <API key>->LinkEndChild(<API key>); // TiXmlText* <API key> = new TiXmlText("<API key>"); // <API key>->LinkEndChild(<API key>); // return(<API key>); // TiXmlElement* <API key>(void) const method This method returns a HTML formated string with the histogram of the data matrix. //TiXmlElement* DataSet::<API key>(void) const // const Vector< Vector< Vector<double> > > data_histogram = <API key>(); // const Vector<std::string> <API key> = <API key>.get_default_names(); // TiXmlElement* <API key> = new TiXmlElement("<API key>"); // Variables name // TiXmlElement* <API key> = new TiXmlElement("VariablesName"); // <API key>->LinkEndChild(<API key>); // TiXmlText* variables_name_text = new TiXmlText("data_string"); // <API key>->LinkEndChild(variables_name_text); // return(<API key>); // TiXmlElement* split_instances_XML(void) const method //TiXmlElement* DataSet::split_instances_XML(void) const // return(NULL); // TiXmlElement* <API key>(void) const method This method returns a HTML string with a table about the ditribution of the target variables classes. //TiXmlElement* DataSet::<API key>(void) const // const Vector<unsigned int> <API key> = <API key>(); // const Vector<std::string> <API key> = <API key>.get_default_names(); // TiXmlElement* <API key> = new TiXmlElement("<API key>"); // Variables name // TiXmlElement* <API key> = new TiXmlElement("VariablesName"); // <API key>->LinkEndChild(<API key>); // TiXmlText* variables_name_text = new TiXmlText("data_string"); // <API key>->LinkEndChild(variables_name_text); // return(<API key>); } // OpenNN: Open Neural Networks Library. // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // This library is distributed in the hope that it will be useful, // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // You should have received a copy of the GNU Lesser General Public // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# Indus-Valley A library for converting between units of measurement, written in Swift. Has support for localization and blind allocation of objects if you don't know what type they are prior to creation. ## Usage # Creating objects swift let mass = Mass(quantity: 1, unit: .Gram) let volume = Volume(quantity: 3, unit: .Liter) let anotherMass = Mass(quantity: 4, unit: "gram") // quanity: 4, unit: .Gram # Blind creation swift let aMass = Measurement.<API key>("kilogram", quantity: 3) // class: Mass, quantity: 3, unit: .Kilo let anotherMass = Measurement.<API key>("pizza", quantity: 3) // nil let aVolume = Measurement.<API key>("l", quantity: 3) // class: Volume, quantity: 3, unit: .Liter # Converting From Gram to Kilogram swift let grams = Mass(quantity: 1000, unit: MassUnit.Gram) let convertedToKilo = grams.convert(toUnit: MassUnit.Kilo) // creates object with quantity:1, unit: .Kilo # Adding swift let singleGram = Mass(quantity: 1, unit: .Gram) let lotsOfGrams = Mass(quantity: 99, unit: .Gram) let result = singleGram + lotsOfGrams // result is Mass with quantity: 100, unit: .Gram #Under construction # TODO: - Subtraction - 100 % working Volume - Localization - More different units
<!DOCTYPE html PUBLIC "- <html xmlns="http: <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.12"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>TFKaldi: processing.ark.ArkWriter Class Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">TFKaldi </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.12 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> $(function() { initMenu('',true,false,'search.php','Search'); $(document).ready(function() { init_search(); }); }); </script> <div id="main-nav"></div> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="<API key>"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="namespaceprocessing.html">processing</a></li><li class="navelem"><b>ark</b></li><li class="navelem"><a class="el" href="<API key>.html">ArkWriter</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#pub-methods">Public Member Functions</a> &#124; <a href="#pub-attribs">Public Attributes</a> &#124; <a href="<API key>.html">List of all members</a> </div> <div class="headertitle"> <div class="title">processing.ark.ArkWriter Class Reference</div> </div> </div><!--header <div class="contents"> <div class="dynheader"> Inheritance diagram for processing.ark.ArkWriter:</div> <div class="dyncontent"> <div class="center"> <img src="<API key>.png" usemap="#processing.ark.ArkWriter_map" alt=""/> <map id="processing.ark.ArkWriter_map" name="processing.ark.ArkWriter_map"> </map> </div></div> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a> Public Member Functions</h2></td></tr> <tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top">def&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">__init__</a> (self, scp_path, default_ark)</td></tr> <tr class="memdesc:<API key>"><td class="mdescLeft">&#160;</td><td class="mdescRight">Arkwriter constructor. <a href="#<API key>">More...</a><br /></td></tr> <tr class="separator:<API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top">def&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">write_next_utt</a> (self, utt_id, utt_mat, ark_path=None)</td></tr> <tr class="memdesc:<API key>"><td class="mdescLeft">&#160;</td><td class="mdescRight">read an utterance to the archive <a href="#<API key>">More...</a><br /></td></tr> <tr class="separator:<API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top"><a id="<API key>"></a> def&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">close</a> (self)</td></tr> <tr class="memdesc:<API key>"><td class="mdescLeft">&#160;</td><td class="mdescRight">close the ark write <br /></td></tr> <tr class="separator:<API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a> Public Attributes</h2></td></tr> <tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top"><a id="<API key>"></a> &#160;</td><td class="memItemRight" valign="bottom"><b>scp_path</b></td></tr> <tr class="separator:<API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top"><a id="<API key>"></a> &#160;</td><td class="memItemRight" valign="bottom"><b>scp_file_write</b></td></tr> <tr class="separator:<API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top"><a id="<API key>"></a> &#160;</td><td class="memItemRight" valign="bottom"><b>default_ark</b></td></tr> <tr class="separator:<API key>"><td class="memSeparator" colspan="2">&#160;</td></tr> </table> <h2 class="groupheader">Constructor &amp; Destructor Documentation</h2> <a id="<API key>"></a> <h2 class="memtitle"><span class="permalink"><a href="#<API key>">&sect;&nbsp;</a></span>__init__()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">def processing.ark.ArkWriter.__init__ </td> <td>(</td> <td class="paramtype">&#160;</td> <td class="paramname"><em>self</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname"><em>scp_path</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname"><em>default_ark</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Arkwriter constructor. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">scp_path</td><td>path to the .scp file that will be written </td></tr> <tr><td class="paramname">default_ark</td><td>the name of the default ark file (used when not specified) </td></tr> </table> </dd> </dl> </div> </div> <h2 class="groupheader">Member Function Documentation</h2> <a id="<API key>"></a> <h2 class="memtitle"><span class="permalink"><a href="#<API key>">&sect;&nbsp;</a></span>write_next_utt()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">def processing.ark.ArkWriter.write_next_utt </td> <td>(</td> <td class="paramtype">&#160;</td> <td class="paramname"><em>self</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname"><em>utt_id</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname"><em>utt_mat</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname"><em>ark_path</em> = <code>None</code>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>read an utterance to the archive </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">ark_path</td><td>path to the .ark file that will be used for writing </td></tr> <tr><td class="paramname">utt_id</td><td>the utterance ID </td></tr> <tr><td class="paramname">utt_mat</td><td>a numpy array containing the utterance data </td></tr> </table> </dd> </dl> </div> </div> <hr/>The documentation for this class was generated from the following file:<ul> <li>ark.py</li> </ul> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated by & <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.12 </small></address> </body> </html>
export default { path: 'CBAforum', getComponents(location, cb) { require.ensure([], function(require) { cb(null, require('pages/community/section/CBAforum/CBAForum.js').default) }) } }
using System.Collections.Generic; using System.IO; using System.Linq; using HardwareMonitor.Model; namespace HardwareMonitor.Monitor { public class DriveMonitor : IMonitor { public IEnumerable<IComponent> GetComponents() { return DriveInfo.GetDrives() .Where(d => d.TotalSize > 0 && d.TotalFreeSpace > 0) .Select(GetDriveComponent); } private DriveComponent GetDriveComponent(DriveInfo drive) { var component = new DriveComponent() { Id = drive.Name, Name = drive.Name, Sensors = new[] { new DataSensor() { Id = "TotalSize", Name = "TotalSize", Value = drive.TotalSize }, new DataSensor() { Id = "TotalFreeSpace", Name = "TotalFreeSpace", Value = drive.TotalFreeSpace } } }; return component; } } }
JSON in JavaScript and HTML5 ========================= ## Description As a Developer or Architect, you're familiar with the basics of the JSON data interchange format, and in this talk we'll begin to develop applications with JSON, JavaScript, and HTML5. ## Abstract Since JSON began as a subset of JavaScript, this is where our real journey begins. In our examples, we'll leverage Node.js, scaffold a web application with Yeoman, and invoke a stub RESTful API that contains sample data. That's a lot of moving pieces and parts, so we'll iteratively build on each concept. Here's what we'll cover: * JavaScript Serialization/De-serialization with `JSON.stringify()` and `JSON.parse()`. * JavaScript Objects and JSON. * HTML5 Local/Session Storage and JSON. * Building a small JSON-based web application. ## What Do I Get Out of It? This session will show practical JSON-based development workflows, tools, and techniques to improve overall application design. ## Prerequisites Prior knowledge of JavaScript and familiarity with JSON and Node.js. ## Required Installs Before coming to this session, please install the following: * [Node.js](https://github.com/tmarrs/<API key>/blob/master/appendix-a/Appendix-A-README.md#installing-nodejs) * [Yeoman](https://github.com/tmarrs/<API key>/blob/master/appendix-a/Appendix-A-README.md#installing-yeoman) * [Yeoman `webapp` generator](https://github.com/tmarrs/<API key>/blob/master/appendix-a/Appendix-A-README.md#<API key>) ## Session Length 60 minutes
'use strict'; var fontAttrs = require('../font_attributes'); var colorAttrs = require('../../components/color/attributes'); var dash = require('../../components/drawing/attributes').dash; var extendFlat = require('../../lib/extend').extendFlat; var templatedArray = require('../../plot_api/plot_template').templatedArray; var FORMAT_LINK = require('../../constants/docs').FORMAT_LINK; var DATE_FORMAT_LINK = require('../../constants/docs').DATE_FORMAT_LINK; var ONEDAY = require('../../constants/numerical').ONEDAY; var constants = require('./constants'); var HOUR = constants.HOUR_PATTERN; var DAY_OF_WEEK = constants.WEEKDAY_PATTERN; module.exports = { visible: { valType: 'boolean', role: 'info', editType: 'plot', description: [ 'A single toggle to hide the axis while preserving interaction like dragging.', 'Default is true when a cheater plot is present on the axis, otherwise', 'false' ].join(' ') }, color: { valType: 'color', dflt: colorAttrs.defaultLine, role: 'style', editType: 'ticks', description: [ 'Sets default for all colors associated with this axis', 'all at once: line, font, tick, and grid colors.', 'Grid color is lightened by blending this with the plot background', 'Individual pieces can override this.' ].join(' ') }, title: { text: { valType: 'string', role: 'info', editType: 'ticks', description: [ 'Sets the title of this axis.', 'Note that before the existence of `title.text`, the title\'s', 'contents used to be defined as the `title` attribute itself.', 'This behavior has been deprecated.' ].join(' ') }, font: fontAttrs({ editType: 'ticks', description: [ 'Sets this axis\' title font.', 'Note that the title\'s font used to be customized', 'by the now deprecated `titlefont` attribute.' ].join(' ') }), standoff: { valType: 'number', role: 'info', min: 0, editType: 'ticks', description: [ 'Sets the standoff distance (in px) between the axis labels and the title text', 'The default value is a function of the axis tick labels, the title `font.size`', 'and the axis `linewidth`.', 'Note that the axis title position is always constrained within the margins,', 'so the actual standoff distance is always less than the set or default value.', 'By setting `standoff` and turning on `automargin`, plotly.js will push the', 'margins to fit the axis title at given standoff distance.' ].join(' ') }, editType: 'ticks' }, type: { valType: 'enumerated', // '-' means we haven't yet run autotype or couldn't find any data // it gets turned into linear in gd._fullLayout but not copied back // to gd.data like the others are. values: ['-', 'linear', 'log', 'date', 'category', 'multicategory'], dflt: '-', role: 'info', editType: 'calc', // we forget when an axis has been autotyped, just writing the auto // value back to the input - so it doesn't make sense to template this. // Note: we do NOT prohibit this in `coerce`, so if someone enters a // type in the template explicitly it will be honored as the default. _noTemplating: true, description: [ 'Sets the axis type.', 'By default, plotly attempts to determined the axis type', 'by looking into the data of the traces that referenced', 'the axis in question.' ].join(' ') }, autorange: { valType: 'enumerated', values: [true, false, 'reversed'], dflt: true, role: 'info', editType: 'axrange', impliedEdits: {'range[0]': undefined, 'range[1]': undefined}, description: [ 'Determines whether or not the range of this axis is', 'computed in relation to the input data.', 'See `rangemode` for more info.', 'If `range` is provided, then `autorange` is set to *false*.' ].join(' ') }, rangemode: { valType: 'enumerated', values: ['normal', 'tozero', 'nonnegative'], dflt: 'normal', role: 'info', editType: 'plot', description: [ 'If *normal*, the range is computed in relation to the extrema', 'of the input data.', 'If *tozero*`, the range extends to 0,', 'regardless of the input data', 'If *nonnegative*, the range is non-negative,', 'regardless of the input data.', 'Applies only to linear axes.' ].join(' ') }, range: { valType: 'info_array', role: 'info', items: [ {valType: 'any', editType: 'axrange', impliedEdits: {'^autorange': false}, anim: true}, {valType: 'any', editType: 'axrange', impliedEdits: {'^autorange': false}, anim: true} ], editType: 'axrange', impliedEdits: {'autorange': false}, anim: true, description: [ 'Sets the range of this axis.', 'If the axis `type` is *log*, then you must take the log of your', 'desired range (e.g. to set the range from 1 to 100,', 'set the range from 0 to 2).', 'If the axis `type` is *date*, it should be date strings,', 'like date data, though Date objects and unix milliseconds', 'will be accepted and converted to strings.', 'If the axis `type` is *category*, it should be numbers,', 'using the scale where each category is assigned a serial', 'number from zero in the order it appears.' ].join(' ') }, fixedrange: { valType: 'boolean', dflt: false, role: 'info', editType: 'calc', description: [ 'Determines whether or not this axis is zoom-able.', 'If true, then zoom is disabled.' ].join(' ') }, // scaleanchor: not used directly, just put here for reference // values are any opposite-letter axis id scaleanchor: { valType: 'enumerated', values: [ constants.idRegex.x.toString(), constants.idRegex.y.toString() ], role: 'info', editType: 'plot', description: [ 'If set to another axis id (e.g. `x2`, `y`), the range of this axis', 'changes together with the range of the corresponding axis', 'such that the scale of pixels per unit is in a constant ratio.', 'Both axes are still zoomable, but when you zoom one, the other will', 'zoom the same amount, keeping a fixed midpoint.', '`constrain` and `constraintoward` determine how we enforce the constraint.', 'You can chain these, ie `yaxis: {scaleanchor: *x*}, xaxis2: {scaleanchor: *y*}`', 'but you can only link axes of the same `type`.', 'The linked axis can have the opposite letter (to constrain the aspect ratio)', 'or the same letter (to match scales across subplots).', 'Loops (`yaxis: {scaleanchor: *x*}, xaxis: {scaleanchor: *y*}` or longer) are redundant', 'and the last constraint encountered will be ignored to avoid possible', 'inconsistent constraints via `scaleratio`.', 'Note that setting axes simultaneously in both a `scaleanchor` and a `matches` constraint', 'is currently forbidden.' ].join(' ') }, scaleratio: { valType: 'number', min: 0, dflt: 1, role: 'info', editType: 'plot', description: [ 'If this axis is linked to another by `scaleanchor`, this determines the pixel', 'to unit scale ratio. For example, if this value is 10, then every unit on', 'this axis spans 10 times the number of pixels as a unit on the linked axis.', 'Use this for example to create an elevation profile where the vertical scale', 'is exaggerated a fixed amount with respect to the horizontal.' ].join(' ') }, constrain: { valType: 'enumerated', values: ['range', 'domain'], dflt: 'range', role: 'info', editType: 'plot', description: [ 'If this axis needs to be compressed (either due to its own `scaleanchor` and', '`scaleratio` or those of the other axis), determines how that happens:', 'by increasing the *range* (default), or by decreasing the *domain*.' ].join(' ') }, // constraintoward: not used directly, just put here for reference constraintoward: { valType: 'enumerated', values: ['left', 'center', 'right', 'top', 'middle', 'bottom'], role: 'info', editType: 'plot', description: [ 'If this axis needs to be compressed (either due to its own `scaleanchor` and', '`scaleratio` or those of the other axis), determines which direction we push', 'the originally specified plot area. Options are *left*, *center* (default),', 'and *right* for x axes, and *top*, *middle* (default), and *bottom* for y axes.' ].join(' ') }, matches: { valType: 'enumerated', values: [ constants.idRegex.x.toString(), constants.idRegex.y.toString() ], role: 'info', editType: 'calc', description: [ 'If set to another axis id (e.g. `x2`, `y`), the range of this axis', 'will match the range of the corresponding axis in data-coordinates space.', 'Moreover, matching axes share auto-range values, category lists and', 'histogram auto-bins.', 'Note that setting axes simultaneously in both a `scaleanchor` and a `matches` constraint', 'is currently forbidden.', 'Moreover, note that matching axes must have the same `type`.' ].join(' ') }, rangebreaks: templatedArray('rangebreak', { enabled: { valType: 'boolean', role: 'info', dflt: true, editType: 'calc', description: [ 'Determines whether this axis rangebreak is enabled or disabled.', 'Please note that `rangebreaks` only work for *date* axis type.' ].join(' ') }, bounds: { valType: 'info_array', role: 'info', items: [ {valType: 'any', editType: 'calc'}, {valType: 'any', editType: 'calc'} ], editType: 'calc', description: [ 'Sets the lower and upper bounds of this axis rangebreak.', 'Can be used with `pattern`.' ].join(' ') }, pattern: { valType: 'enumerated', values: [DAY_OF_WEEK, HOUR, ''], role: 'info', editType: 'calc', description: [ 'Determines a pattern on the time line that generates breaks.', 'If *' + DAY_OF_WEEK + '* - days of the week in English e.g. \'Sunday\' or `\sun\`', '(matching is case-insensitive and considers only the first three characters),', 'as well as Sunday-based integers between 0 and 6.', 'If *' + HOUR + '* - hour (24-hour clock) as decimal numbers between 0 and 24.', 'for more info.', 'Examples:', '- { pattern: \'' + DAY_OF_WEEK + '\', bounds: [6, 1] }', ' or simply { bounds: [\'sat\', \'mon\'] }', ' breaks from Saturday to Monday (i.e. skips the weekends).', '- { pattern: \'' + HOUR + '\', bounds: [17, 8] }', ' breaks from 5pm to 8am (i.e. skips non-work hours).' ].join(' ') }, values: { valType: 'info_array', freeLength: true, role: 'info', editType: 'calc', items: { valType: 'any', editType: 'calc' }, description: [ 'Sets the coordinate values corresponding to the rangebreaks.', 'An alternative to `bounds`.', 'Use `dvalue` to set the size of the values along the axis.' ].join(' ') }, dvalue: { // TODO could become 'any' to add support for 'months', 'years' valType: 'number', role: 'info', editType: 'calc', min: 0, dflt: ONEDAY, description: [ 'Sets the size of each `values` item.', 'The default is one day in milliseconds.' ].join(' ') }, /* gap: { valType: 'number', min: 0, dflt: 0, // for *date* axes, maybe something else for *linear* editType: 'calc', role: 'info', description: [ 'Sets the gap distance between the start and the end of this rangebreak.', 'Use with `gapmode` to set the unit of measurement.' ].join(' ') }, gapmode: { valType: 'enumerated', values: ['pixels', 'fraction'], dflt: 'pixels', editType: 'calc', role: 'info', description: [ 'Determines if the `gap` value corresponds to a pixel length', 'or a fraction of the plot area.' ].join(' ') }, */ // we additionally need `gap` and make this work on *linear*, and // possibly all other cartesian axis types. We possibly would also need // some style attributes controlling the zig-zag on the corresponding // axis. editType: 'calc' }), // ticks tickmode: { valType: 'enumerated', values: ['auto', 'linear', 'array'], role: 'info', editType: 'ticks', impliedEdits: {tick0: undefined, dtick: undefined}, description: [ 'Sets the tick mode for this axis.', 'If *auto*, the number of ticks is set via `nticks`.', 'If *linear*, the placement of the ticks is determined by', 'a starting position `tick0` and a tick step `dtick`', '(*linear* is the default value if `tick0` and `dtick` are provided).', 'If *array*, the placement of the ticks is set via `tickvals`', 'and the tick text is `ticktext`.', '(*array* is the default value if `tickvals` is provided).' ].join(' ') }, nticks: { valType: 'integer', min: 0, dflt: 0, role: 'style', editType: 'ticks', description: [ 'Specifies the maximum number of ticks for the particular axis.', 'The actual number of ticks will be chosen automatically to be', 'less than or equal to `nticks`.', 'Has an effect only if `tickmode` is set to *auto*.' ].join(' ') }, tick0: { valType: 'any', role: 'style', editType: 'ticks', impliedEdits: {tickmode: 'linear'}, description: [ 'Sets the placement of the first tick on this axis.', 'Use with `dtick`.', 'If the axis `type` is *log*, then you must take the log of your starting tick', '(e.g. to set the starting tick to 100, set the `tick0` to 2)', 'except when `dtick`=*L<f>* (see `dtick` for more info).', 'If the axis `type` is *date*, it should be a date string, like date data.', 'If the axis `type` is *category*, it should be a number, using the scale where', 'each category is assigned a serial number from zero in the order it appears.' ].join(' ') }, dtick: { valType: 'any', role: 'style', editType: 'ticks', impliedEdits: {tickmode: 'linear'}, description: [ 'Sets the step in-between ticks on this axis. Use with `tick0`.', 'Must be a positive number, or special strings available to *log* and *date* axes.', 'If the axis `type` is *log*, then ticks are set every 10^(n*dtick) where n', 'is the tick number. For example,', 'to set a tick mark at 1, 10, 100, 1000, ... set dtick to 1.', 'To set tick marks at 1, 100, 10000, ... set dtick to 2.', 'To set tick marks at 1, 5, 25, 125, 625, 3125, ... set dtick to log_10(5), or 0.69897000433.', '*log* has several special values; *L<f>*, where `f` is a positive number,', 'gives ticks linearly spaced in value (but not position).', 'For example `tick0` = 0.1, `dtick` = *L0.5* will put ticks at 0.1, 0.6, 1.1, 1.6 etc.', 'To show powers of 10 plus small digits between, use *D1* (all digits) or *D2* (only 2 and 5).', '`tick0` is ignored for *D1* and *D2*.', 'If the axis `type` is *date*, then you must convert the time to milliseconds.', 'For example, to set the interval between ticks to one day,', 'set `dtick` to 86400000.0.', '*date* also has special values *M<n>* gives ticks spaced by a number of months.', '`n` must be a positive integer.', 'To set ticks on the 15th of every third month, set `tick0` to *2000-01-15* and `dtick` to *M3*.', 'To set ticks every 4 years, set `dtick` to *M48*' ].join(' ') }, tickvals: { valType: 'data_array', editType: 'ticks', description: [ 'Sets the values at which ticks on this axis appear.', 'Only has an effect if `tickmode` is set to *array*.', 'Used with `ticktext`.' ].join(' ') }, ticktext: { valType: 'data_array', editType: 'ticks', description: [ 'Sets the text displayed at the ticks position via `tickvals`.', 'Only has an effect if `tickmode` is set to *array*.', 'Used with `tickvals`.' ].join(' ') }, ticks: { valType: 'enumerated', values: ['outside', 'inside', ''], role: 'style', editType: 'ticks', description: [ 'Determines whether ticks are drawn or not.', 'If **, this axis\' ticks are not drawn.', 'If *outside* (*inside*), this axis\' are drawn outside (inside)', 'the axis lines.' ].join(' ') }, tickson: { valType: 'enumerated', values: ['labels', 'boundaries'], role: 'info', dflt: 'labels', editType: 'ticks', description: [ 'Determines where ticks and grid lines are drawn with respect to their', 'corresponding tick labels.', 'Only has an effect for axes of `type` *category* or *multicategory*.', 'When set to *boundaries*, ticks and grid lines are drawn half a category', 'to the left/bottom of labels.' ].join(' ') }, ticklabelmode: { valType: 'enumerated', values: ['instant', 'period'], dflt: 'instant', role: 'info', editType: 'ticks', description: [ 'Determines where tick labels are drawn with respect to their', 'corresponding ticks and grid lines.', 'Only has an effect for axes of `type` *date*', 'When set to *period*, tick labels are drawn in the middle of the period', 'between ticks.' ].join(' ') }, mirror: { valType: 'enumerated', values: [true, 'ticks', false, 'all', 'allticks'], dflt: false, role: 'style', editType: 'ticks+layoutstyle', description: [ 'Determines if the axis lines or/and ticks are mirrored to', 'the opposite side of the plotting area.', 'If *true*, the axis lines are mirrored.', 'If *ticks*, the axis lines and ticks are mirrored.', 'If *false*, mirroring is disable.', 'If *all*, axis lines are mirrored on all shared-axes subplots.', 'If *allticks*, axis lines and ticks are mirrored', 'on all shared-axes subplots.' ].join(' ') }, ticklen: { valType: 'number', min: 0, dflt: 5, role: 'style', editType: 'ticks', description: 'Sets the tick length (in px).' }, tickwidth: { valType: 'number', min: 0, dflt: 1, role: 'style', editType: 'ticks', description: 'Sets the tick width (in px).' }, tickcolor: { valType: 'color', dflt: colorAttrs.defaultLine, role: 'style', editType: 'ticks', description: 'Sets the tick color.' }, showticklabels: { valType: 'boolean', dflt: true, role: 'style', editType: 'ticks', description: 'Determines whether or not the tick labels are drawn.' }, automargin: { valType: 'boolean', dflt: false, role: 'style', editType: 'ticks', description: [ 'Determines whether long tick labels automatically grow the figure', 'margins.' ].join(' ') }, showspikes: { valType: 'boolean', dflt: false, role: 'style', editType: 'modebar', description: [ 'Determines whether or not spikes (aka droplines) are drawn for this axis.', 'Note: This only takes affect when hovermode = closest' ].join(' ') }, spikecolor: { valType: 'color', dflt: null, role: 'style', editType: 'none', description: 'Sets the spike color. If undefined, will use the series color' }, spikethickness: { valType: 'number', dflt: 3, role: 'style', editType: 'none', description: 'Sets the width (in px) of the zero line.' }, spikedash: extendFlat({}, dash, {dflt: 'dash', editType: 'none'}), spikemode: { valType: 'flaglist', flags: ['toaxis', 'across', 'marker'], role: 'style', dflt: 'toaxis', editType: 'none', description: [ 'Determines the drawing mode for the spike line', 'If *toaxis*, the line is drawn from the data point to the axis the ', 'series is plotted on.', 'If *across*, the line is drawn across the entire plot area, and', 'supercedes *toaxis*.', 'If *marker*, then a marker dot is drawn on the axis the series is', 'plotted on' ].join(' ') }, spikesnap: { valType: 'enumerated', values: ['data', 'cursor', 'hovered data'], dflt: 'data', role: 'style', editType: 'none', description: 'Determines whether spikelines are stuck to the cursor or to the closest datapoints.' }, tickfont: fontAttrs({ editType: 'ticks', description: 'Sets the tick font.' }), tickangle: { valType: 'angle', dflt: 'auto', role: 'style', editType: 'ticks', description: [ 'Sets the angle of the tick labels with respect to the horizontal.', 'For example, a `tickangle` of -90 draws the tick labels', 'vertically.' ].join(' ') }, tickprefix: { valType: 'string', dflt: '', role: 'style', editType: 'ticks', description: 'Sets a tick label prefix.' }, showtickprefix: { valType: 'enumerated', values: ['all', 'first', 'last', 'none'], dflt: 'all', role: 'style', editType: 'ticks', description: [ 'If *all*, all tick labels are displayed with a prefix.', 'If *first*, only the first tick is displayed with a prefix.', 'If *last*, only the last tick is displayed with a suffix.', 'If *none*, tick prefixes are hidden.' ].join(' ') }, ticksuffix: { valType: 'string', dflt: '', role: 'style', editType: 'ticks', description: 'Sets a tick label suffix.' }, showticksuffix: { valType: 'enumerated', values: ['all', 'first', 'last', 'none'], dflt: 'all', role: 'style', editType: 'ticks', description: 'Same as `showtickprefix` but for tick suffixes.' }, showexponent: { valType: 'enumerated', values: ['all', 'first', 'last', 'none'], dflt: 'all', role: 'style', editType: 'ticks', description: [ 'If *all*, all exponents are shown besides their significands.', 'If *first*, only the exponent of the first tick is shown.', 'If *last*, only the exponent of the last tick is shown.', 'If *none*, no exponents appear.' ].join(' ') }, exponentformat: { valType: 'enumerated', values: ['none', 'e', 'E', 'power', 'SI', 'B'], dflt: 'B', role: 'style', editType: 'ticks', description: [ 'Determines a formatting rule for the tick exponents.', 'For example, consider the number 1,000,000,000.', 'If *none*, it appears as 1,000,000,000.', 'If *e*, 1e+9.', 'If *E*, 1E+9.', 'If *power*, 1x10^9 (with 9 in a super script).', 'If *SI*, 1G.', 'If *B*, 1B.' ].join(' ') }, minexponent: { valType: 'number', dflt: 3, min: 0, role: 'style', editType: 'ticks', description: [ 'Hide SI prefix for 10^n if |n| is below this number.', 'This only has an effect when `tickformat` is *SI* or *B*.' ].join(' ') }, separatethousands: { valType: 'boolean', dflt: false, role: 'style', editType: 'ticks', description: [ 'If "true", even 4-digit integers are separated' ].join(' ') }, tickformat: { valType: 'any', dflt: '', role: 'style', editType: 'ticks', description: [ 'Sets the tick label formatting rule using d3 formatting mini-languages', 'which are very similar to those in Python. For numbers, see:', FORMAT_LINK, 'And for dates see:', DATE_FORMAT_LINK, 'We add one item to d3\'s date formatter: *%{n}f* for fractional seconds', 'with n digits. For example, *2016-10-13 09:15:23.456* with tickformat', '*%H~%M~%S.%2f* would display *09~15~23.46*' ].join(' ') }, tickformatstops: templatedArray('tickformatstop', { enabled: { valType: 'boolean', role: 'info', dflt: true, editType: 'ticks', description: [ 'Determines whether or not this stop is used.', 'If `false`, this stop is ignored even within its `dtickrange`.' ].join(' ') }, dtickrange: { valType: 'info_array', role: 'info', items: [ {valType: 'any', editType: 'ticks'}, {valType: 'any', editType: 'ticks'} ], editType: 'ticks', description: [ 'range [*min*, *max*], where *min*, *max* - dtick values', 'which describe some zoom level, it is possible to omit *min*', 'or *max* value by passing *null*' ].join(' ') }, value: { valType: 'string', dflt: '', role: 'style', editType: 'ticks', description: [ 'string - dtickformat for described zoom level, the same as *tickformat*' ].join(' ') }, editType: 'ticks' }), hoverformat: { valType: 'string', dflt: '', role: 'style', editType: 'none', description: [ 'Sets the hover text formatting rule using d3 formatting mini-languages', 'which are very similar to those in Python. For numbers, see:', FORMAT_LINK, 'And for dates see:', DATE_FORMAT_LINK, 'We add one item to d3\'s date formatter: *%{n}f* for fractional seconds', 'with n digits. For example, *2016-10-13 09:15:23.456* with tickformat', '*%H~%M~%S.%2f* would display *09~15~23.46*' ].join(' ') }, // lines and grids showline: { valType: 'boolean', dflt: false, role: 'style', editType: 'ticks+layoutstyle', description: [ 'Determines whether or not a line bounding this axis is drawn.' ].join(' ') }, linecolor: { valType: 'color', dflt: colorAttrs.defaultLine, role: 'style', editType: 'layoutstyle', description: 'Sets the axis line color.' }, linewidth: { valType: 'number', min: 0, dflt: 1, role: 'style', editType: 'ticks+layoutstyle', description: 'Sets the width (in px) of the axis line.' }, showgrid: { valType: 'boolean', role: 'style', editType: 'ticks', description: [ 'Determines whether or not grid lines are drawn.', 'If *true*, the grid lines are drawn at every tick mark.' ].join(' ') }, gridcolor: { valType: 'color', dflt: colorAttrs.lightLine, role: 'style', editType: 'ticks', description: 'Sets the color of the grid lines.' }, gridwidth: { valType: 'number', min: 0, dflt: 1, role: 'style', editType: 'ticks', description: 'Sets the width (in px) of the grid lines.' }, zeroline: { valType: 'boolean', role: 'style', editType: 'ticks', description: [ 'Determines whether or not a line is drawn at along the 0 value', 'of this axis.', 'If *true*, the zero line is drawn on top of the grid lines.' ].join(' ') }, zerolinecolor: { valType: 'color', dflt: colorAttrs.defaultLine, role: 'style', editType: 'ticks', description: 'Sets the line color of the zero line.' }, zerolinewidth: { valType: 'number', dflt: 1, role: 'style', editType: 'ticks', description: 'Sets the width (in px) of the zero line.' }, showdividers: { valType: 'boolean', dflt: true, role: 'style', editType: 'ticks', description: [ 'Determines whether or not a dividers are drawn', 'between the category levels of this axis.', 'Only has an effect on *multicategory* axes.' ].join(' ') }, dividercolor: { valType: 'color', dflt: colorAttrs.defaultLine, role: 'style', editType: 'ticks', description: [ 'Sets the color of the dividers', 'Only has an effect on *multicategory* axes.' ].join(' ') }, dividerwidth: { valType: 'number', dflt: 1, role: 'style', editType: 'ticks', description: [ 'Sets the width (in px) of the dividers', 'Only has an effect on *multicategory* axes.' ].join(' ') }, // TODO dividerlen: that would override "to label base" length? // positioning attributes // anchor: not used directly, just put here for reference // values are any opposite-letter axis id anchor: { valType: 'enumerated', values: [ 'free', constants.idRegex.x.toString(), constants.idRegex.y.toString() ], role: 'info', editType: 'plot', description: [ 'If set to an opposite-letter axis id (e.g. `x2`, `y`), this axis is bound to', 'the corresponding opposite-letter axis.', 'If set to *free*, this axis\' position is determined by `position`.' ].join(' ') }, // side: not used directly, as values depend on direction // values are top, bottom for x axes, and left, right for y side: { valType: 'enumerated', values: ['top', 'bottom', 'left', 'right'], role: 'info', editType: 'plot', description: [ 'Determines whether a x (y) axis is positioned', 'at the *bottom* (*left*) or *top* (*right*)', 'of the plotting area.' ].join(' ') }, // overlaying: not used directly, just put here for reference // values are false and any other same-letter axis id that's not // itself overlaying anything overlaying: { valType: 'enumerated', values: [ 'free', constants.idRegex.x.toString(), constants.idRegex.y.toString() ], role: 'info', editType: 'plot', description: [ 'If set a same-letter axis id, this axis is overlaid on top of', 'the corresponding same-letter axis, with traces and axes visible for both', 'axes.', 'If *false*, this axis does not overlay any same-letter axes.', 'In this case, for axes with overlapping domains only the highest-numbered', 'axis will be visible.' ].join(' ') }, layer: { valType: 'enumerated', values: ['above traces', 'below traces'], dflt: 'above traces', role: 'info', editType: 'plot', description: [ 'Sets the layer on which this axis is displayed.', 'If *above traces*, this axis is displayed above all the subplot\'s traces', 'If *below traces*, this axis is displayed below all the subplot\'s traces,', 'but above the grid lines.', 'Useful when used together with scatter-like traces with `cliponaxis`', 'set to *false* to show markers and/or text nodes above this axis.' ].join(' ') }, domain: { valType: 'info_array', role: 'info', items: [ {valType: 'number', min: 0, max: 1, editType: 'plot'}, {valType: 'number', min: 0, max: 1, editType: 'plot'} ], dflt: [0, 1], editType: 'plot', description: [ 'Sets the domain of this axis (in plot fraction).' ].join(' ') }, position: { valType: 'number', min: 0, max: 1, dflt: 0, role: 'style', editType: 'plot', description: [ 'Sets the position of this axis in the plotting space', '(in normalized coordinates).', 'Only has an effect if `anchor` is set to *free*.' ].join(' ') }, categoryorder: { valType: 'enumerated', values: [ 'trace', 'category ascending', 'category descending', 'array', 'total ascending', 'total descending', 'min ascending', 'min descending', 'max ascending', 'max descending', 'sum ascending', 'sum descending', 'mean ascending', 'mean descending', 'median ascending', 'median descending' ], dflt: 'trace', role: 'info', editType: 'calc', description: [ 'Specifies the ordering logic for the case of categorical variables.', 'By default, plotly uses *trace*, which specifies the order that is present in the data supplied.', 'Set `categoryorder` to *category ascending* or *category descending* if order should be determined by', 'the alphanumerical order of the category names.', 'Set `categoryorder` to *array* to derive the ordering from the attribute `categoryarray`. If a category', 'is not found in the `categoryarray` array, the sorting behavior for that attribute will be identical to', 'the *trace* mode. The unspecified categories will follow the categories in `categoryarray`.', 'Set `categoryorder` to *total ascending* or *total descending* if order should be determined by the', 'numerical order of the values.', 'Similarly, the order can be determined by the min, max, sum, mean or median of all the values.' ].join(' ') }, categoryarray: { valType: 'data_array', role: 'info', editType: 'calc', description: [ 'Sets the order in which categories on this axis appear.', 'Only has an effect if `categoryorder` is set to *array*.', 'Used with `categoryorder`.' ].join(' ') }, uirevision: { valType: 'any', role: 'info', editType: 'none', description: [ 'Controls persistence of user-driven changes in axis `range`,', '`autorange`, and `title` if in `editable: true` configuration.', 'Defaults to `layout.uirevision`.' ].join(' ') }, editType: 'calc', _deprecated: { autotick: { valType: 'boolean', role: 'info', editType: 'ticks', description: [ 'Obsolete.', 'Set `tickmode` to *auto* for old `autotick` *true* behavior.', 'Set `tickmode` to *linear* for `autotick` *false*.' ].join(' ') }, title: { valType: 'string', role: 'info', editType: 'ticks', description: [ 'Value of `title` is no longer a simple *string* but a set of sub-attributes.', 'To set the axis\' title, please use `title.text` now.' ].join(' ') }, titlefont: fontAttrs({ editType: 'ticks', description: [ 'Former `titlefont` is now the sub-attribute `font` of `title`.', 'To customize title font properties, please use `title.font` now.' ].join(' ') }) } };
# Leap Years # I worked on this challenge [by myself, with: ]. # Your Solution Below def leap_year?(year) if year % 400 != 0 && year % 100 == 0 p false elsif year % 4 == 0 p true else p false end end
// Generated by class-dump 3.5 (64 bit). #import "MMObject.h" #import "PBCoding.h" @class NSString; @interface <API key> : MMObject <PBCoding> { _Bool needCrown; unsigned int positionId; NSString *moduleTitle; NSString *title; NSString *desc; NSString *picUrl; unsigned long long picType; NSString *jumpUrl; NSString *externInfo; NSString *coverPicUrl; } + (void)initialize; @property(retain, nonatomic) NSString *coverPicUrl; // @synthesize coverPicUrl; @property(retain, nonatomic) NSString *externInfo; // @synthesize externInfo; @property(nonatomic) unsigned int positionId; // @synthesize positionId; @property(retain, nonatomic) NSString *jumpUrl; // @synthesize jumpUrl; @property(nonatomic) _Bool needCrown; // @synthesize needCrown; @property(nonatomic) unsigned long long picType; // @synthesize picType; @property(retain, nonatomic) NSString *picUrl; // @synthesize picUrl; @property(retain, nonatomic) NSString *desc; // @synthesize desc; @property(retain, nonatomic) NSString *title; // @synthesize title; @property(retain, nonatomic) NSString *moduleTitle; // @synthesize moduleTitle; - (void).cxx_destruct; - (void)parse:(id)arg1; - (const map_0e718273 *)getValueTagIndexMap; - (id)getValueTypeTable; // Remaining properties @property(readonly, copy) NSString *debugDescription; @property(readonly, copy) NSString *description; @property(readonly) unsigned long long hash; @property(readonly) Class superclass; @end
#include <iostream> #include "DTGraph.h" template<class NodeTy,class EdgeTy> const char * DTGraph<NodeTy,EdgeTy>::getNodeName(NodeID id) { return nullptr; } template <class NodeTy,class EdgeTy> std::vector< std::pair<NodeID,NodeID> > DTGraph<NodeTy,EdgeTy>::getEdgeIDs(void) { std::vector< std::pair<NodeID,NodeID> > edgePairs; // for each node create the edge... and return the pair. return edgePairs; }
// Type: FezEngine.Readers.SkyReader // Assembly: FezEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null // MVID: <API key> // Assembly location: F:\Program Files (x86)\FEZ\FezEngine.dll using FezEngine.Structure; using Microsoft.Xna.Framework.Content; using System.Collections.Generic; namespace FezEngine.Readers { public class SkyReader : ContentTypeReader<Sky> { protected override Sky Read(ContentReader input, Sky existingInstance) { if (existingInstance == null) existingInstance = new Sky(); existingInstance.Name = input.ReadString(); existingInstance.Background = input.ReadString(); existingInstance.WindSpeed = input.ReadSingle(); existingInstance.Density = input.ReadSingle(); existingInstance.FogDensity = input.ReadSingle(); existingInstance.Layers = input.ReadObject<List<SkyLayer>>(existingInstance.Layers); existingInstance.Clouds = input.ReadObject<List<string>>(existingInstance.Clouds); existingInstance.Shadows = input.ReadObject<string>(); existingInstance.Stars = input.ReadObject<string>(); existingInstance.CloudTint = input.ReadObject<string>(); existingInstance.VerticalTiling = input.ReadBoolean(); existingInstance.HorizontalScrolling = input.ReadBoolean(); existingInstance.LayerBaseHeight = input.ReadSingle(); existingInstance.<API key> = input.ReadSingle(); existingInstance.<API key> = input.ReadSingle(); existingInstance.HorizontalDistance = input.ReadSingle(); existingInstance.VerticalDistance = input.ReadSingle(); existingInstance.LayerBaseSpacing = input.ReadSingle(); existingInstance.WindParallax = input.ReadSingle(); existingInstance.WindDistance = input.ReadSingle(); existingInstance.CloudsParallax = input.ReadSingle(); existingInstance.ShadowOpacity = input.ReadSingle(); existingInstance.FoliageShadows = input.ReadBoolean(); existingInstance.<API key> = input.ReadBoolean(); existingInstance.LayerBaseXOffset = input.ReadSingle(); return existingInstance; } } }
require('should'); var map = require('../src/esnext/map'); var take = require('../src/esnext/take'); var scanl1 = require('../src/esnext/scanl1'); var repeat = require('../src/esnext/repeat'); var iterate = require('../src/esnext/iterate'); describe('lazit#scanl1', function() { it('normal operation check', function() { var res; res = [...scanl1((acc, el) => acc + el, [0,1,2,3,4])]; res.should.eql([0,1,3,6,10]); res = [...scanl1((acc, el) => acc + el, map(v => ++v, take(5, iterate(v => v*v, 2))))]; res.should.eql([3,8,25,282,65819]); }); it('auto-curry check', function() { var res; var m = scanl1((a,b) => a+b); // auto-curry check var n = scanl1((a,b) => 0); // auto-curry check res = [...m(take(5, repeat(1)))]; res.should.eql([1,2,3,4,5]); res = [...n([1,2,3,4])]; res.should.eql([1,0,0,0,]); }); it('custom iterator check', function() { var res; var acc = []; function* customIterator(){ yield acc; yield 'a'; yield 'b'; yield 'c'; } res = [...scanl1((a,b) => { if ('string' === typeof b) { a.unshift(b); } return a; }, customIterator())]; res.should.eql([[],['a'],['b','a'],['c','b','a']]); acc.should.eql([]); }); it('empty list check', function() { var res; res = [...scanl1((a,b) => a+b, [])]; res.should.eql([]); }); });
<?php // Core functions, classes and interfaces require ('core/core.php'); // Baseweb configuration require ('settings/config.php'); // Baseweb autowired modules require ('modules/modules.php');
use gfx; use gfx::traits::FactoryExt; use vecmath::{self, Matrix4}; static VERTEX: &[u8] = b" #version 150 core uniform mat4 u_projection, u_view; in vec2 at_tex_coord; in vec3 at_color, at_position; out vec2 v_tex_coord; out vec3 v_color; void main() { v_tex_coord = at_tex_coord; v_color = at_color; gl_Position = u_projection * u_view * vec4(at_position, 1.0); } "; static FRAGMENT: &[u8] = b" #version 150 core out vec4 out_color; uniform sampler2D s_texture; in vec2 v_tex_coord; in vec3 v_color; void main() { vec4 tex_color = texture(s_texture, v_tex_coord); if(tex_color.a == 0.0) // Discard transparent pixels. discard; out_color = tex_color * vec4(v_color, 1.0); } "; gfx_pipeline!( pipe { vbuf: gfx::VertexBuffer<Vertex> = (), transform: gfx::Global<[[f32; 4]; 4]> = "u_projection", view: gfx::Global<[[f32; 4]; 4]> = "u_view", color: gfx::TextureSampler<[f32; 4]> = "s_texture", out_color: gfx::RenderTarget<gfx::format::Srgba8> = "out_color", out_depth: gfx::DepthTarget<gfx::format::DepthStencil> = gfx::preset::depth::LESS_EQUAL_WRITE, }); gfx_vertex_struct!(Vertex { xyz: [f32; 3] = "at_position", uv: [f32; 2] = "at_tex_coord", rgb: [f32; 3] = "at_color", }); pub struct Renderer<R: gfx::Resources, F: gfx::Factory<R>, C: gfx::CommandBuffer<R>> { factory: F, pub pipe: gfx::PipelineState<R, pipe::Meta>, data: pipe::Data<R>, encoder: gfx::Encoder<R, C>, clear_color: [f32; 4], clear_depth: f32, clear_stencil: u8, slice: gfx::Slice<R>, } impl<R: gfx::Resources, F: gfx::Factory<R>, C: gfx::CommandBuffer<R>> Renderer<R, F, C> { pub fn new( mut factory: F, encoder: gfx::Encoder<R, C>, target: gfx::handle::RenderTargetView<R, gfx::format::Srgba8>, depth: gfx::handle::DepthStencilView<R, (gfx::format::D24_S8, gfx::format::Unorm)>, tex: gfx::handle::Texture<R, gfx::format::R8_G8_B8_A8>, ) -> Renderer<R, F, C> { let sampler = factory.create_sampler(gfx::texture::SamplerInfo::new( gfx::texture::FilterMethod::Scale, gfx::texture::WrapMode::Tile, )); let texture_view = factory .<API key>::<gfx::format::Rgba8>( &tex, (0, 0), gfx::format::Swizzle::new(), ) .unwrap(); let prog = factory.link_program(VERTEX, FRAGMENT).unwrap(); let mut rasterizer = gfx::state::Rasterizer::new_fill(); rasterizer.front_face = gfx::state::FrontFace::Clockwise; let pipe = factory .<API key>( &prog, gfx::Primitive::TriangleList, rasterizer, pipe::new(), ) .unwrap(); let vbuf = factory.<API key>(&[]); let slice = gfx::Slice::<API key>(&vbuf); let data = pipe::Data { vbuf, transform: vecmath::mat4_id(), view: vecmath::mat4_id(), color: (texture_view, sampler), out_color: target, out_depth: depth, }; Renderer { factory, pipe, data, encoder, clear_color: [0.81, 0.8, 1.0, 1.0], clear_depth: 1.0, clear_stencil: 0, slice, } } pub fn set_projection(&mut self, proj_mat: Matrix4<f32>) { self.data.transform = proj_mat; } pub fn set_view(&mut self, view_mat: Matrix4<f32>) { self.data.view = view_mat; } pub fn clear(&mut self) { self.encoder.clear(&self.data.out_color, self.clear_color); self.encoder .clear_depth(&self.data.out_depth, self.clear_depth); self.encoder .clear_stencil(&self.data.out_depth, self.clear_stencil); } pub fn flush<D: gfx::Device<Resources = R, CommandBuffer = C> + Sized>( &mut self, device: &mut D, ) { self.encoder.flush(device); } pub fn create_buffer(&mut self, data: &[Vertex]) -> gfx::handle::Buffer<R, Vertex> { let vbuf = self.factory.<API key>(data); self.slice = gfx::Slice::<API key>(&vbuf); vbuf } pub fn render(&mut self, buffer: &mut gfx::handle::Buffer<R, Vertex>) { self.data.vbuf = buffer.clone(); self.slice.end = buffer.len() as u32; self.encoder.draw(&self.slice, &self.pipe, &self.data); } }
using System.ComponentModel.Composition; using System.Globalization; using System.Windows; using System.Windows.Markup; using Waf.FileHashGenerator.Applications.Services; namespace Waf.FileHashGenerator.Presentation.Services { [Export(typeof(<API key>))] internal class PresentationService : <API key> { public void Initialize() { FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new <API key>( XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag))); } } }
package com.cjpowered.learn.inventory; import java.time.LocalDate; import java.util.HashMap; import java.util.Map; import java.util.Optional; import com.cjpowered.learn.marketing.MarketingInfo; public class StockedItem implements Item { private final HashMap<Warehouse, Integer> warehouseWantOnHand; private final boolean isRestricted; private final int bulkAmt; public StockedItem(final int wantOnHand, final boolean isRestricted, final int bulkAmt){ HashMap<Warehouse, Integer> defaultWantOnHand = new HashMap<Warehouse, Integer>(); defaultWantOnHand.put(Warehouse.home(), wantOnHand); this.warehouseWantOnHand = defaultWantOnHand; this.isRestricted = isRestricted; this.bulkAmt = bulkAmt; } public StockedItem(final HashMap warehouseWantOnHand, final boolean isRestricted, final int bulkAmt){ this.warehouseWantOnHand = warehouseWantOnHand; this.isRestricted = isRestricted; this.bulkAmt = bulkAmt; // int a = 1; // Integer x = new Integer(a); // int z = x.intValue(); } @Override public Order createOrder(final LocalDate when, final InventoryDatabase db, final MarketingInfo marketInfo) { int wantOnHand = 0; for (Map.Entry<Warehouse, Integer> next : warehouseWantOnHand.entrySet()){ wantOnHand = next.getValue(); } // for(Warehouse warehouse : warehouseWantOnHand.keySet()){ // Integer onHand = warehouseWantOnHand.get(warehouse); final Order maybeOrder; final int onHand = db.onHand(this); final boolean onSale = marketInfo.onSale(this); final int onOrder = db.onOrder(this); final int increasedStock = (int) (Math.ceil(wantOnHand * 1.10)); int deficit = 0; int toOrder = 0; if (onHand == 0){ db.setRequiredOnHand(this, increasedStock); } if (isRestricted){ if(when.getDayOfMonth() != 1){ return new Order(this, 0); } } if (onSale){ deficit = wantOnHand + 20 - onHand - onOrder; } else { deficit = wantOnHand - onHand - onOrder; } if (onHand + onOrder <= (deficit + onHand + onOrder) * 0.8 ){ while(toOrder < deficit && toOrder + bulkAmt <= deficit){ toOrder += bulkAmt; } } maybeOrder = new Order(this, toOrder); return maybeOrder; } }
/* eslint-env mocha */ var bracketData = require('../lib/index') var assert = require('assert') describe('Bracket Data', function () { it('should have correct data for ncaam', function () { var b = bracketData({ year: '2013', sport: 'ncaam' }) assert.strictEqual(b.constants.REGION_COUNT, 4) assert.strictEqual(b.constants.FINAL_ID, 'FF') assert.strictEqual(b.constants.ALL_IDS.join(' '), 'MW W S E FF') assert.strictEqual(b.constants.FINAL_NAME, 'Final Four') assert.strictEqual(b.constants.FINAL_FULLNAME, 'Final Four') assert.strictEqual(b.constants.<API key>, 'National Championship') assert.strictEqual(b.constants.UNPICKED_MATCH, 'X') assert.strictEqual(b.constants.TEAMS_PER_REGION, 16) assert.strictEqual(b.constants.BEST_OF, 1) }) })
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.<API key>(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var core_1 = require('@angular/core'); var AppComponent = (function () { function AppComponent() { } AppComponent = __decorate([ core_1.Component({ selector: 'yw-app', template: "\n <div class=\"container-fluid\">\n <h1>Younderwater Portal</h1>\n <yw-planner></yw-planner>\n </div>\n " }), __metadata('design:paramtypes', []) ], AppComponent); return AppComponent; }()); exports.AppComponent = AppComponent; //# sourceMappingURL=app.component.js.map
require 'spec_helper' describe Spree::ShippingMethod do context "public instance methods" do describe ".fedex?" do it "should be true if the downcased name includes 'fedex'" do subject.stub(:name).and_return('123123fedex324') subject.fedex?.should be_true subject.stub(:name).and_return('FEDEX!!') subject.fedex?.should be_true end it "should not be true if the downcased name doesn't include 'fedex'" do subject.stub(:name).and_return('123123f') subject.fedex?.should be_false subject.stub(:name).and_return(nil) subject.fedex?.should be_false end end end end
#ifndef STREAMREADER_H #define STREAMREADER_H #include <string> #include <memory> namespace jsonrpc { class StreamReader { public: StreamReader(size_t buffersize); virtual ~StreamReader(); bool Read(std::string &target, int fd, char delimiter); private: size_t buffersize; char* buffer; }; } #endif // STREAMREADER_H
import { ColumnState } from './../../../column-state.class'; import { TableModule } from './../../../table.module'; import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { ObjectCellComponent } from './object-cell.component'; describe('ObjectCellComponent', () => { let component: ObjectCellComponent; let fixture: ComponentFixture<ObjectCellComponent>; beforeEach(async(() => { TestBed.<API key>({ imports: [ TableModule ] }) .compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(ObjectCellComponent); component = fixture.componentInstance; component.row = {a: {}}; component.column = new ColumnState({id: 'a'}); fixture.detectChanges(); }); it('should create', () => { expect(component).toBeTruthy(); }); });
/*jslint node: true */ "use strict"; exports.real3x3 = [ 0.9178107380867004, -0.04468444734811783, -0.3944951295852661, 0.1306413114070892, 0.9723015427589417, 0.1938103586435318, 0.3749079704284668, -0.2294186502695084, 0.8982265591621399 ]; exports.real4x4 = [ 0.9178107380867004, -0.04468444734811783, -0.3944951295852661, 0, 0.1306413114070892, 0.9723015427589417, 0.1938103586435318, 0, 0.3749079704284668, -0.2294186502695084, 0.8982265591621399, 0, 0, 0, 0, 1 ]; exports.zeroes3x3 = [ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; exports.zeroes4x4 = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 ]; exports.maxDifference = 0.000001; // These rotations adapted from: exports.zeroRotation = { w: 1, x: 0, y: 0, z: 0 }; exports.zRotation90 = { w: 1, x: 0, y: 0, z: 1 }; exports.zRotation180 = { w: 0, x: 0, y: 0, z: 1 }; exports.zRotation270 = { w: 1, x: 0, y: 0, z: -1 }; exports.realUser = require("./sample-user");
package com.johnson.<API key>.service.impl; import com.johnson.<API key>.mappers.UserMapper; import com.johnson.<API key>.model.chart.ChartData; import com.johnson.<API key>.model.chart.ChartDataSet; import com.johnson.<API key>.model.chart.PieChartData; import com.johnson.<API key>.model.chart.PieChartDataSet; import com.johnson.<API key>.model.compontent.University; import com.johnson.<API key>.model.user.User; import com.johnson.<API key>.model.wechat.WechatUser; import com.johnson.<API key>.service.UniversityService; import com.johnson.<API key>.service.UserService; import com.johnson.<API key>.utils.UuidUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.text.SimpleDateFormat; import java.util.*; @Service public class UserServiceImpl implements UserService { @Autowired UserMapper userMapper; @Autowired UniversityService universityService; public int total() throws Exception { return userMapper.total(); } public List<User> list() throws Exception { List<User> userList = userMapper.list(); for (User user : userList) { user.setUniversityObj(universityService.get(user.getUniversityId())); user.<API key>(<API key>(user)); } return userList; } public User get(String uuid) throws Exception { User user = userMapper.get(uuid); user.setUniversityObj(universityService.get(user.getUniversityId())); user.<API key>(<API key>(user)); return user; } public User checkAndSave(WechatUser wechatUser) throws Exception { User user = userMapper.getByOpenID(wechatUser.getOpenid()); if (user != null) { return user; } user = new User(wechatUser); user.setUuid(UuidUtil.getUUID()); user.setAddedTime(System.currentTimeMillis()); userMapper.save(user); return user; } public void update(User user) throws Exception { userMapper.update(user); } public int todayNew() throws Exception { Calendar c = Calendar.getInstance(); Date dateNow = new Date(); c.setTime(new Date(dateNow.getYear(), dateNow.getMonth(), dateNow.getDate())); long time = c.getTimeInMillis(); Calendar cEnd = Calendar.getInstance(); cEnd.setTime(new Date(dateNow.getYear(), dateNow.getMonth(), dateNow.getDate() + 1)); long timeEnd = cEnd.getTimeInMillis(); return userMapper.todayNew(time, timeEnd); } /** * * * @return * @throws Exception */ public ChartData recentIncreaseUser() throws Exception { ChartData chartData = new ChartData(); List<ChartDataSet> chartDataSets = new ArrayList<ChartDataSet>(); ChartDataSet chartDataSet = new ChartDataSet(); List<String> labels = new ArrayList<String>(); List<Integer> dataList = new ArrayList<Integer>(); getUserIncreaseData(getSpecificDate(6), labels, dataList); getUserIncreaseData(getSpecificDate(5), labels, dataList); getUserIncreaseData(getSpecificDate(4), labels, dataList); getUserIncreaseData(getSpecificDate(3), labels, dataList); getUserIncreaseData(getSpecificDate(2), labels, dataList); getUserIncreaseData(getSpecificDate(1), labels, dataList); getUserIncreaseData(getSpecificDate(0), labels, dataList); chartDataSet.setLabel(""); chartDataSet.setData(dataList); chartDataSet.setBackgroundColor("#f1c40f"); chartDataSets.add(chartDataSet); chartData.setLabels(labels); chartData.setDatasets(chartDataSets); return chartData; } /** * N * * @param dayAgo * @return */ private Date getSpecificDate(int dayAgo) { Date dateNow = new Date(); return new Date(dateNow.getYear(), dateNow.getMonth(), dateNow.getDate() - dayAgo); } /** * * * @param dateNow * @param labels * @param dataList * @throws Exception */ private void getUserIncreaseData(Date dateNow, List<String> labels, List<Integer> dataList) throws Exception { Calendar c = Calendar.getInstance(); c.setTime(new Date(dateNow.getYear(), dateNow.getMonth(), dateNow.getDate())); long time = c.getTimeInMillis(); Calendar cEnd = Calendar.getInstance(); cEnd.setTime(new Date(dateNow.getYear(), dateNow.getMonth(), dateNow.getDate() + 1)); long timeEnd = cEnd.getTimeInMillis(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); labels.add(sdf.format(dateNow)); dataList.add(userMapper.todayNew(time, timeEnd)); } /** * * * @return * @throws Exception */ public ChartData usersOfUniversity() throws Exception { ChartData chartData = new ChartData(); List<ChartDataSet> chartDataSets = new ArrayList<ChartDataSet>(); List<String> labels = new ArrayList<String>(); List<Integer> dataList = new ArrayList<Integer>(); ChartDataSet chartDataSet = new ChartDataSet(); List<University> universities = universityService.list(); for (University university : universities) { labels.add(university.getName()); dataList.add(userMapper.schoolUserNumber(university.getId())); } chartDataSet.setLabel(""); chartDataSet.setData(dataList); chartDataSet.setBackgroundColor("#3498db"); chartDataSets.add(chartDataSet); chartData.setDatasets(chartDataSets); chartData.setLabels(labels); return chartData; } /** * * * @return * @throws Exception */ public PieChartData genderChart() throws Exception { PieChartData pieChartData = new PieChartData(); List<PieChartDataSet> pieChartDataSetList = new ArrayList<PieChartDataSet>(); List<String> labels = new ArrayList<String>(); PieChartDataSet pieChartDataSet = new PieChartDataSet(); List<String> backgroundList = new ArrayList<String>(); List<Integer> dataList = new ArrayList<Integer>(); labels.add(""); dataList.add(userMapper.genderNumber(1)); backgroundList.add("#9b59b6"); labels.add(""); dataList.add(userMapper.genderNumber(2)); backgroundList.add("#f1c40f"); labels.add(""); dataList.add(userMapper.genderNumber(0)); backgroundList.add("#e74c3c"); pieChartDataSet.setBackgroundColor(backgroundList); pieChartDataSet.setData(dataList); pieChartDataSetList.add(pieChartDataSet); pieChartData.setLabels(labels); pieChartData.setDatasets(pieChartDataSetList); return pieChartData; } private List<Integer> <API key>(User user) { String str = user.<API key>(); if (str == null || str.trim().equals("")) { return null; } String[] strList = str.split(","); List<Integer> idList = new ArrayList<Integer>(); for (int i = 0; i < strList.length; i++) { String item = strList[i]; if (item.trim().equals("")) { continue; } idList.add(Integer.valueOf(item)); } return idList; } }
u8R""__RAW_STRING__( local U = require "togo.utility" local M = U.module(...) return M )"__RAW_STRING__"
import { hbs } from 'ember-cli-htmlbars'; import { htmlSafe } from '@ember/string'; import { module, test, skip } from 'qunit'; import { setupRenderingTest } from 'ember-qunit'; import { render, click } from '@ember/test-helpers'; module('Integration | Component | line clamp', function(hooks) { setupRenderingTest(hooks); test('inline form works as expected', async function(assert) { await render(hbs`<div style="width: 300px; font-size: 16px; font-family: sans-serif;"> {{line-clamp text="helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld" }} </div>`); const element = this.element; const lines = Array.from(element.querySelectorAll('.lt-line-clamp__line')); const lastLine = lines[lines.length - 1]; const lastLineChildren = lastLine.children; const ellipsisElement = lastLineChildren[0]; const seeMoreButton = ellipsisElement.children[1]; const dummyEllipsis = element.querySelectorAll('.<API key>'); assert.ok( element, 'line clamp target exists' ); assert.equal( lines.length, 3, 'text is clamped at 3 lines (default)' ); // This test a bit flaky, depends on the width of div and knowing 'helloworld helloworld' will be a line // assert.ok( // lines.slice(0,2) // 'first lines contain expected text' // This is a better test since we know the truncation will push 'helloworld' to a new line if it does not fit assert.ok( lines.slice(0,2) .every((line) => line.innerText.trim().split(' ')[0] === 'helloworld'), 'first lines contain expected text' ); assert.ok( lastLine.classList.contains('<API key>'), '<API key> is applied to last line' ); assert.equal( lastLineChildren.length, 1, 'last line contains 1 child' ); assert.ok( ellipsisElement, 'last line child is the ellipsis element and it exists' ); assert.ok( ellipsisElement.classList.contains('<API key>'), 'ellipsis element contains right CSS class' ); assert.dom(ellipsisElement).hasText('... See More', 'Ellipsis element contains expetend ellipsis and see more text'); assert.ok( seeMoreButton, 'see more button exists' ); assert.ok( seeMoreButton.classList.contains('lt-line-clamp__more'), 'see more button contains right CSS class' ); assert.equal( seeMoreButton.innerText, 'See More', 'see more button contains expected text' ); assert.ok( dummyEllipsis, 'dummy ellipsis element exists' ); assert.dom(element).containsText('... See More'); await click(seeMoreButton); const seeLessButton = element.querySelectorAll('.lt-line-clamp__less')[0]; assert.ok( seeLessButton, 'see less button exists' ); assert.dom(element).containsText('See Less'); }); test('lines attribute works as expected', async function(assert) { // Render component await render(hbs`<div style="width: 300px; font-size: 16px; font-family: sans-serif;"> {{line-clamp text="helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld" lines=2 }} </div>`); const element = this.element; const lines = Array.from(element.querySelectorAll('.lt-line-clamp__line')); const lastLine = lines[lines.length - 1]; assert.ok( element, 'line clamp target exists' ); assert.equal( lines.length, 2, 'text is clamped at 2 lines specified by user' ); assert.ok( lines.slice(0,1) .every((line) => line.innerText.trim().split(' ')[0] === 'helloworld'), 'first lines contain expected text' ); assert.ok( lastLine.classList.contains('<API key>'), '<API key> is applied to last line' ); assert.dom(element).containsText('... See More'); }); test('ellipsis attribute works as expected', async function(assert) { // Render component await render(hbs`<div style="width: 300px; font-size: 16px; font-family: sans-serif;"> {{line-clamp text="helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld" ellipsis="-" }} </div>`); const element = this.element; const lines = Array.from(element.querySelectorAll('.lt-line-clamp__line')); const lastLine = lines[lines.length - 1]; const lastLineChildren = lastLine.children; const ellipsisElement = lastLineChildren[0]; assert.ok( element, 'line clamp target exists' ); assert.dom(ellipsisElement).hasText('- See More'); assert.dom(element).containsText('- See More'); }); test('interactive=false hides see more button', async function(assert) { // Render component await render(hbs`<div style="width: 300px; font-size: 16px; font-family: sans-serif;"> {{line-clamp text="helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld" interactive=false }} </div>`); // We are running in headless chrome - it supports -webkit-line-clamp const element = this.element; const lineClampElement = element.querySelectorAll('.lt-line-clamp'); const lines = Array.from(element.querySelectorAll('.lt-line-clamp__line')); assert.ok( element, 'line clamp target exists' ); assert.equal( lineClampElement.length, 1, 'element fallbacks to -webkit-line-clamp' ); assert.equal( lines.length, 0, 'No truncation happen, we use -webkit-line-clamp' ); assert.equal( element.innerText.trim(), 'helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld' ); }); test('useJsOnly=true disables native CSS solution', async function(assert) { // Render component await render(hbs`<div style="width: 300px; font-size: 16px; font-family: sans-serif;"> {{line-clamp text="helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld" interactive=false useJsOnly=true }} </div>`); // We are running in headless chrome - it supports -webkit-line-clamp const element = this.element; const lineClampElement = element.querySelectorAll('.lt-line-clamp'); const lines = Array.from(element.querySelectorAll('.lt-line-clamp__line')); assert.ok( element, 'line clamp target exists' ); assert.equal( lineClampElement.length, 0, 'element fallbacks to -webkit-line-clamp' ); assert.equal( lines.length, 3, 'No truncation happen, we use -webkit-line-clamp' ); assert.dom(element).containsText('...'); }); test('showMoreButton=false hides see more button', async function(assert) { // Render component await render(hbs`<div style="width: 300px; font-size: 16px; font-family: sans-serif;"> {{line-clamp text="helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld" showMoreButton=false }} </div>`); // We are running in headless chrome - it supports -webkit-line-clamp const element = this.element; const lineClampElement = element.querySelectorAll('.lt-line-clamp'); const lines = Array.from(element.querySelectorAll('.lt-line-clamp__line')); assert.ok( element, 'line clamp target exists' ); assert.equal( lines.length, 0, 'No truncation happen, we use -webkit-line-clamp' ); assert.equal( lineClampElement.length, 1, 'element fallbacks to -webkit-line-clamp' ); assert.equal( element.innerText.trim(), 'helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld' ); }); test('showLessButton=false hides see less button', async function(assert) { // Render component await render(hbs`<div style="width: 300px; font-size: 16px; font-family: sans-serif;"> {{line-clamp text="helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld" showLessButton=false }} </div>`); const element = this.element; const lines = Array.from(element.querySelectorAll('.lt-line-clamp__line')); const lastLine = lines[lines.length - 1]; const lastLineChildren = lastLine.children; const ellipsisElement = lastLineChildren[0]; const seeMoreButton = ellipsisElement.children[1]; assert.ok( element, 'line clamp target exists' ); assert.ok( seeMoreButton, 'see more button exists' ); await click(seeMoreButton); const seeLessButton = element.querySelectorAll('.lt-line-clamp__less'); assert.equal( seeLessButton.length, 0, 'see less button does not exist' ); assert.equal( element.innerText.trim(), 'helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld' ); }); test('seeMoreText and seeLessText attributes work as expected', async function(assert) { await render(hbs`<div style="width: 300px; font-size: 16px; font-family: sans-serif;"> {{line-clamp text="helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld" seeMoreText="Read More" seeLessText="Read Less" }} </div>`); const element = this.element; const lines = Array.from(element.querySelectorAll('.lt-line-clamp__line')); const lastLine = lines[lines.length - 1]; const lastLineChildren = lastLine.children; const ellipsisElement = lastLineChildren[0]; const seeMoreButton = ellipsisElement.children[1]; assert.ok( element, 'line clamp target exists' ); assert.ok( ellipsisElement, 'last line child is the ellipsis element and it exists' ); assert.ok( seeMoreButton, 'see more button exists' ); assert.equal( seeMoreButton.innerText, 'Read More', 'see more button contains expected text' ); assert.dom(seeMoreButton).<API key>('aria-label', 'see more button does not set aria-label by default'); assert.dom(element).containsText('... Read More'); await click(seeMoreButton); const seeLessButton = element.querySelectorAll('.lt-line-clamp__less')[0]; assert.ok( seeLessButton, 'see less button exists' ); assert.equal( seeLessButton.innerText, 'Read Less', 'see less button contains expected text' ); assert.dom(seeLessButton).<API key>('aria-label', 'see less button does not set aria-label by default'); assert.equal( element.innerText.trim(), 'helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld Read Less' ); }); test('seeMoreA11yText and seeLessA11yText attributes work as expected', async function(assert) { await render(hbs`<div style="width: 300px; font-size: 16px; font-family: sans-serif;"> {{line-clamp text="helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld" seeMoreText="Read More" seeMoreA11yText="A button which expands the content of this text" seeLessText="Read Less" seeLessA11yText="A button which unexpands the content of this text" }} </div>`); const element = this.element; const lines = Array.from(element.querySelectorAll('.lt-line-clamp__line')); const lastLine = lines[lines.length - 1]; const lastLineChildren = lastLine.children; const ellipsisElement = lastLineChildren[0]; const seeMoreButton = ellipsisElement.children[1]; assert.ok( element, 'line clamp target exists' ); assert.ok( ellipsisElement, 'last line child is the ellipsis element and it exists' ); assert.ok( seeMoreButton, 'see more button exists' ); assert.equal( seeMoreButton.innerText, 'Read More', 'see more button contains expected text' ); assert.dom(seeMoreButton).hasAttribute('aria-label', 'A button which expands the content of this text', 'see more button sets aria-label if provided'); assert.dom(element).containsText('... Read More'); await click(seeMoreButton); const seeLessButton = element.querySelectorAll('.lt-line-clamp__less')[0]; assert.ok( seeLessButton, 'see less button exists' ); assert.equal( seeLessButton.innerText, 'Read Less', 'see less button contains expected text' ); assert.dom(seeLessButton).hasAttribute('aria-label', 'A button which unexpands the content of this text', 'see less button sets aria-label if provided'); assert.equal( element.innerText.trim(), 'helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld Read Less' ); }); test('see more button is hidden if text is not long enough to truncate', async function(assert) { // Render component await render(hbs`<div style="width: 300px; font-size: 16px; font-family: sans-serif;"> {{line-clamp text="helloworld helloworld" }} </div>`); const element = this.element; const seeMoreButton = element.querySelectorAll('.lt-line-clamp__line .lt-line-clamp__more'); assert.ok( element, 'line clamp target exists' ); assert.equal( seeMoreButton.length, 0, 'see more button is not needed' ); assert.equal( element.innerText.trim(), 'helloworld helloworld' ); }); test('clicking see more button toggles full text', async function(assert) { await render(hbs`<div style="width: 300px; font-size: 16px; font-family: sans-serif;"> {{line-clamp text="helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld" }} </div>`); const element = this.element; const lines = Array.from(element.querySelectorAll('.lt-line-clamp__line')); const lastLine = lines[lines.length - 1]; const lastLineChildren = lastLine.children; const ellipsisElement = lastLineChildren[0]; const seeMoreButton = ellipsisElement.children[1]; assert.ok( element, 'line clamp target exists' ); assert.ok( seeMoreButton, 'see more button exists' ); assert.dom(element).containsText('... See More'); await click(seeMoreButton); assert.dom(element).containsText('helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld See Less'); }); skip('resizing triggers component to re-truncate', async function(assert) { assert.expect(4); const done = assert.async(); await render(hbs`<div id="test-conatiner" style="width: 300px; font-size: 16px; font-family: sans-serif;"> {{line-clamp text="helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld" }} </div>`); const element = this.element; const <API key> = element.querySelectorAll('.lt-line-clamp__line .lt-line-clamp__more'); assert.ok( element, 'line clamp target exists' ); assert.equal( <API key>.length, 1, 'see more button exists' ); assert.dom(element).containsText('... See More') // Mimic window resize element.querySelector('#test-conatiner').style.width = '960px'; window.dispatchEvent(new CustomEvent('resize')); setTimeout(() => { const <API key> = element.querySelectorAll('.lt-line-clamp__line .lt-line-clamp__more'); assert.equal( <API key>.length, 0, 'see more button does not exist' ); done(); }, 10); // const <API key> = element.querySelectorAll('.lt-line-clamp__line .lt-line-clamp__more'); // assert.equal( // <API key>.length, // 'see more button does not exist' // assert.equal( // element.innerText.trim(), // 'helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld' }); test('clicking see more/see less button fires user defined action', async function(assert) { assert.expect(5); this.set('assertOnExpand', () => assert.ok(true, 'onExpand action triggered')); this.set('assertOnCollapse', () => assert.ok(true, 'onCollapse action triggered')); await render(hbs`<div id="test-conatiner" style="width: 300px; font-size: 16px; font-family: sans-serif;"> {{line-clamp text="helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld" onExpand=(action assertOnExpand) onCollapse=assertOnCollapse }} </div>`); const element = this.element; const seeMoreButton = element.querySelectorAll('.lt-line-clamp__line .lt-line-clamp__more'); assert.ok( element, 'line clamp target exists' ); assert.equal( seeMoreButton.length, 1, 'see more button exists' ); seeMoreButton[0].click(); const seeLessButton = element.querySelectorAll('.lt-line-clamp__less')[0]; assert.ok( seeLessButton, 'see less button exists' ); await click(seeLessButton); }); test('clicking see more/see less buttons should not bubble event', async function(assert) { assert.expect(3); this.set('<API key>', () => assert.ok(true, 'parent action should not be triggered')); this.set('assertOnParentClick', () => assert.ok(true, 'parent click action should not be triggered')); await render(hbs` <div id="test-conatiner" style="width: 300px; font-size: 16px; font-family: sans-serif;" {{action <API key>}} onclick={{action assertOnParentClick}} > {{line-clamp text="helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld" }} </div> `); const element = this.element; const seeMoreButton = element.querySelectorAll('.lt-line-clamp__line .lt-line-clamp__more'); assert.ok( element, 'line clamp target exists' ); assert.equal( seeMoreButton.length, 1, 'see more button exists' ); seeMoreButton[0].click(); const seeLessButton = element.querySelectorAll('.lt-line-clamp__less')[0]; assert.ok( seeLessButton, 'see less button exists' ); await click(seeLessButton); }); test('changing the component\'s text changes the component', async function(assert) { assert.expect(2); this.set('textToTruncate', 'helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld'); await render(hbs`<div id="test-conatiner" style="width: 300px; font-size: 16px; font-family: sans-serif;"> {{line-clamp text=textToTruncate }} </div>`); const element = this.element; assert.dom(element).containsText('... See More'); this.set('textToTruncate', 'helloworld helloworld helloworld helloworld'); assert.dom(element).containsText('helloworld helloworld helloworld helloworld'); }); test('changing the component\'s lines changes the component', async function(assert) { assert.expect(3); this.set('textToTruncate', 'helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld'); this.set('linesToTruncate', 3); await render(hbs`<div id="test-conatiner" style="width: 300px; font-size: 16px; font-family: sans-serif;"> {{line-clamp text=textToTruncate lines=linesToTruncate }} </div>`); const element = this.element; const length = element.innerText.trim().length; assert.dom(element).containsText('... See More'); this.set('linesToTruncate', 2); const newLength = element.innerText.trim().length; assert.ok(newLength < length); assert.dom(element).containsText('... See More'); }); test('truncation can be controlled via the truncate attribute', async function(assert) { assert.expect(3); this.set('textToTruncate', 'helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld'); this.set('truncate', true); await render(hbs`<div id="test-conatiner" style="width: 300px; font-size: 16px; font-family: sans-serif;"> {{line-clamp text=textToTruncate truncate=truncate }} </div>`); const element = this.element; assert.dom(element).containsText('... See More'); this.set('truncate', false); assert.equal( element.innerText.trim(), 'helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld See Less' ); this.set('truncate', true); assert.dom(element).containsText('... See More'); }); test('initial truncation can be controlled via the truncate attribute (false case)', async function (assert) { assert.expect(3); this.set('textToTruncate', 'helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld'); this.set('truncate', false); await render(hbs`<div id="test-conatiner" style="width: 300px; font-size: 16px; font-family: sans-serif;"> {{line-clamp text=textToTruncate truncate=truncate }} </div>`); const element = this.element; assert.dom(element).containsText('helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld See Less'); this.set('truncate', false); assert.dom(element).containsText('helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld See Less'); this.set('truncate', true); assert.dom(element).containsText('... See More'); }); test('stripText correctly strips <br> tags', async function(assert) { assert.expect(2); this.set('textToTruncate', htmlSafe('helloworld<br />helloworld<br />helloworld<br />helloworld')); this.set('truncate', true); this.set('stripText', true); await render(hbs`<div id="test-conatiner" style="width: 300px; font-size: 16px; font-family: sans-serif;"> {{line-clamp truncate=truncate text=textToTruncate stripText=stripText }} </div>`); const element = this.element; assert.equal( element.innerText.trim(), 'helloworld helloworld helloworld helloworld' ); this.set('truncate', false); assert.equal( element.innerText.trim(), `helloworld\nhelloworld\nhelloworld\nhelloworld See Less` ); }); test('stripText correctly strips preserves newlines when stripText is false', async function(assert) { assert.expect(2); this.set('textToTruncate', htmlSafe('helloworld<br />helloworld<br />helloworld<br />helloworld')); this.set('truncate', true); this.set('stripText', false); await render(hbs`<div id="test-conatiner" style="width: 300px; font-size: 16px; font-family: sans-serif;"> {{line-clamp truncate=truncate text=textToTruncate stripText=stripText }} </div>`); const element = this.element; assert.dom(element).containsText('... See More'); this.set('truncate', false); assert.equal(element.innerText.trim(), 'helloworld\nhelloworld\nhelloworld\nhelloworld See Less') }); test('null/undefined text handled correctly', async function(assert) { assert.expect(2); this.set('textToTruncate', null); this.set('truncate', true); await render(hbs` {{line-clamp truncate=truncate text=textToTruncate }}`); const element = this.element; assert.equal( element.innerText.trim(), '' ); this.set('textToTruncate', undefined); assert.equal( element.innerText.trim(), '' ); }); test('[A11y] aria-expanded is correct', async function(assert) { assert.expect(3); await render(hbs` <div style="width: 300px; font-size: 16px; font-family: sans-serif;"> {{line-clamp text="helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld" lines=1 }} </div>` ); assert.dom('[<API key>]').hasAttribute('aria-expanded', "false"); await click('[<API key>]'); assert.dom('[<API key>]').hasAttribute('aria-expanded', "true"); await click('[<API key>]'); assert.dom('[<API key>]').hasAttribute('aria-expanded', "false"); }); test('[A11y] button is correctly focused after expanding/collapsing', async function(assert) { assert.expect(2); await render(hbs` <div style="width: 300px; font-size: 16px; font-family: sans-serif;"> {{line-clamp text="helloworld helloworld helloworld helloworld helloworld helloworld helloworld helloworld" lines=1 }} </div>` ); await click('[<API key>]'); assert.dom('[<API key>]').isFocused('show less button is focused'); await click('[<API key>]'); assert.dom('[<API key>]').isFocused('show more button is focused'); }); })
<?php namespace Higidi\T3ExtCli\Test\Console; use Higidi\T3ExtCli\Console\<API key>; class <API key> extends \<API key> { /** * @var <API key> */ protected $application; protected function setUp() { $this->application = new <API key>(); } public function <API key>() { $this->assertInstanceOf('Higidi\T3ExtCli\Command\Er\ListCommand', $this->application->get('er:list')); } public function <API key>() { $this->assertInstanceOf('Higidi\T3ExtCli\Command\Er\ShowCommand', $this->application->get('er:show')); } public function <API key>() { $this->assertInstanceOf('Higidi\T3ExtCli\Command\Er\DownloadCommand', $this->application->get('er:download')); } public function <API key>() { $this->assertInstanceOf('Higidi\T3ExtCli\Command\Er\UploadCommand', $this->application->get('er:upload')); } public function <API key>() { $this->assertTrue($this->application->getDefinition()->hasOption('config-file')); } }
# cfval: The CloudFormation template validator [![Build Status](https: > Have you ever waited 15 minutes for CloudFormation to let you know that you forgot to set the Type of a DNS record? Yeah, and that's on a *good day*. Try 45 minutes for your CloudFront Distribution to fail... `cfval` is a small tool which validates a CloudFormation JSON template and notifies you of any issues it can find. Missing required properties, properties which conflict with others, `Ref`s to parameters which don't exist or incompatible properties of resources, and much more. ## Usage $ cfval validate my-template.json Resources.<API key>.UserData.Ref ... Ref 'CloudInitScript' is not a resource or parameter Fail: 1 failure, 0 warnings ## Installation For the latest stable release on OSX (still pre-release): brew install jagregory/tools/cfval Or to update: brew update && brew upgrade cfval For other operating systems and/or to use the absoltue latest, cfval is installable from source via `go get`. go get -v github.com/jagregory/cfval ## Features `cfval` aims to identify as many possible issues with your CloudFormation templates *before* you try to run them. Issues are categorised as either: * **Failure**: things which are definitely wrong, such as a `Ref` pointing to something which doesn't exist, an unexpected resource property, or a unmistakably wrong value assigned to a property (`"hello world"` to a list property or an EC2 Instance ID). * **Warning:** things which are likely wrong, but we aren't certain. These are nearly always type coercion issues (a `String` being assigned to a more specific type like an `VpcID`) or unfortunate AWS documentation issues (a resource returning an ID when the docs suggest a Name). Please report any warnings which seem incorrect. The main high-level features are: * Resource type checks (valid Type attribute) * Property validations * Unexpected properties * Required properties * Grouped required properties (e.g. must specify X when Y is specified) * Alternate required properties (e.g. must specify X when Y isn't specified) * Conflicting properties (e.g. can't specify X when Y is specified) * Required when certain property values are specified (e.g. must specify X when Y is hello) * `Ref` validations * Target exists and is a Resource/Parameter/Pseudo-parameter * Target actually is usable in a Ref * Value from a Ref is compatible with the property it is being assigned to * `GetAtt` validations * Target resource exists * Attribute is available on target resource * Attribute type is compatible with the property it is being assigned to * Pseudo-parameter validations (type checking) * Various type validations * IP addresses * CIDR ranges * Availability zone names * etc... ## Known issues Most of the major/common AWS resources are now supported by `cfval`; however, there are still quite a few outstanding. Watch this space. Contributors *very welcome*. See [AWS Resource support](https://github.com/jagregory/cfval/issues/3) for the current status of Resources. ## Contributing I need help in two ways: 1. Implementing more resources Take a look at the `resources/` directory to see existing examples and go nuts. If there's anything complicated or unusual, write a test. 2. Testing I only have limited CloudFormation templates available to test `cfval` against. The more weird and wonderful templates I have the more accurate I can make `cfval`. The easiest thing you can do is run `cfval` against your weird and wonderful template and tell me what happens. Raise an issue. Alternatively, [email me (james@jagregory.com)](mailto:james@jagregory.com) your templates! Sanitise/obfuscate them if necessary.
# Model The model trained from scratch can be downloaded from our server using the following command: make wget http://learn.perception.cs.cmu.edu/GitHub/PixelNet/scratch/<API key>/c12345.tar.gz./ tar -xvzf c12345.tar.gz ./
using System; using System.Diagnostics; using Microsoft.AspNet.SignalR.Client; using System.Collections.Generic; using Microsoft.AspNet.SignalR.Client.Transports; using SharpGL.SceneGraph.Primitives; using SharpGL.SceneGraph.Quadrics; using WaveDev.ModelR.Shared.Models; using System.Globalization; using WaveDev.ModelR.ViewModels; using Xceed.Wpf.Toolkit; using WaveDev.ModelR.Shared; using System.IO; using System.Threading.Tasks; using System.Net; namespace WaveDev.ModelR.Communication { internal class <API key> : IDisposable { #region Private Fields private static <API key> s_instance; private HubConnection _connection; private IHubProxy _proxy; private IEnumerable<SceneInfoModel> _cachedScenes; private Guid _sceneId; #endregion #region Delegates public delegate void <API key>(<API key> infoModel); public delegate void <API key>(<API key> infoModel); public delegate void <API key>(UserInfoModel infoModel); public delegate void <API key>(UserInfoModel infoModel); #endregion #region Events public event <API key> SceneObjectCreated; public event <API key> <API key>; public event <API key> UserJoined; public event <API key> UserLoggedOff; #endregion #region Static Members <summary> This method returns an instance of this proxy class that can be used by clients to communicate with the server. </summary> <param name="url">The url of the SignalR server.</param> <param name="createIfNotExist"> Per default: if no instance exists, a new instance is created, cached and returned. That can be omitted, if parameter createIfNotExist is set to false. In that case, null is returned if not instance exists. Can be used to check for instance. </param> <returns>Returns an instance of this proxy class.</returns> public static <API key> GetInstance(string url = Constants.ModelRServerUrl, bool createIfNotExist = true) { var urlChanged = s_instance != null && String.Compare(s_instance.ServerUrl, url, StringComparison.Ordinal) != 0; if ((s_instance == null || urlChanged) && createIfNotExist) s_instance = new <API key>(url); return s_instance; } #endregion #region Construction private <API key>(string url) { ServerUrl = url; ConnectToServer(); } #endregion #region IDisposable public void Dispose() { if (_connection != null) { _connection.Dispose(); _connection = null; } _proxy = null; } #endregion #region Public Members public string LoggedInUserName { get; set; } public string ServerUrl { get; set; } public void Login(string user, string password, Guid sceneId) { try { _connection.Stop(); _connection.Credentials = new NetworkCredential(user, password); // [RS] The authentication token(s) should be encrypted. Sending the user name and the password in clear text here // is just for demonatration how authorization can be implemented. _connection.Headers.Add("<API key>", user); _connection.Headers.Add("ModelR<API key>, password); _connection.Start().Wait(); // [RS] Don't do it async, because we have to wait if user is authorized to join the scene. If not, // the <API key> will be thrown. The client code has to shutdown the application. var userModel = _proxy.Invoke<UserInfoModel>("Login", sceneId).Result; _sceneId = sceneId; LoggedInUserName = user; } catch { throw new <API key>(string.Format(CultureInfo.CurrentUICulture, "The user '{0}' is not authorized or known in the system.", user), user); } } public void Logoff() { if (_connection != null) { // Logoff at server. if (_proxy != null) _proxy.Invoke("Logoff"); _connection.Stop(); // Windows Authentication _connection.Credentials = null; // Header Authentication _connection.Headers.Remove("<API key>"); _connection.Headers.Remove("ModelR<API key>); // Cookie Authentication _connection.CookieContainer = null; } LoggedInUserName = string.Empty; } public IEnumerable<SceneInfoModel> Scenes { get { if (_cachedScenes == null) _cachedScenes = _proxy.Invoke<IEnumerable<SceneInfoModel>>("GetAvailableScenes").Result; return _cachedScenes; } } public async Task CreateSceneObject(SceneObjectModel sceneObject) { var type = SceneObjectType.Light; if (sceneObject.SceneElement is Teapot) type = SceneObjectType.Teapot; else if (sceneObject.SceneElement is Cube) type = SceneObjectType.Cube; else if (sceneObject.SceneElement is Cylinder) type = SceneObjectType.Cylinder; else if (sceneObject.SceneElement is Disk) type = SceneObjectType.Disk; else if (sceneObject.SceneElement is Sphere) type = SceneObjectType.Sphere; var infoModel = new <API key>(sceneObject.Id, _sceneId) { SceneObjectType = type }; try { await _proxy.Invoke("CreateSceneObject", infoModel); } catch (<API key>) { throw new <API key>(string.Format(CultureInfo.CurrentUICulture, "The user '{0}' is not authorized or known in the system.", LoggedInUserName), LoggedInUserName); } } public async Task <API key>(SceneObjectModel sceneObject) { var infoModel = new <API key>(sceneObject.Id, _sceneId); infoModel.Transformation = new <API key>() { TranslateX = sceneObject.Transformation.TranslateX, TranslateY = sceneObject.Transformation.TranslateY, TranslateZ = sceneObject.Transformation.TranslateZ, RotateX = sceneObject.Transformation.RotateX, RotateY = sceneObject.Transformation.RotateY, RotateZ = sceneObject.Transformation.RotateZ, ScaleX = sceneObject.Transformation.ScaleX, ScaleY = sceneObject.Transformation.ScaleY, ScaleZ = sceneObject.Transformation.ScaleZ }; try { await _proxy.Invoke("<API key>", infoModel); } catch (<API key>) { throw new <API key>(string.Format(CultureInfo.CurrentUICulture, "The user '{0}' is not authorized or known in the system.", LoggedInUserName), LoggedInUserName); } } public async Task<IEnumerable<UserInfoModel>> GetUsers() { try { return await _proxy.Invoke<IEnumerable<UserInfoModel>>("GetUsers"); } catch (<API key>) { throw new <API key>(string.Format(CultureInfo.CurrentUICulture, "The user '{0}' is not authorized or known in the system.", LoggedInUserName), LoggedInUserName); } } public async Task<IEnumerable<<API key>>> GetSceneObjects(Guid sceneId) { try { return await _proxy.Invoke<IEnumerable<<API key>>>("GetSceneObjects", sceneId); } catch (<API key>) { throw new <API key>(string.Format(CultureInfo.CurrentUICulture, "The user '{0}' is not authorized or known in the system.", LoggedInUserName), LoggedInUserName); } } #endregion #region Private Methods private void ConnectToServer() { try { var logWriter = new StreamWriter(@"..\..\..\Logs\ModelR.Client." + Guid.NewGuid().ToString() + ".log") { AutoFlush = true }; _connection = new HubConnection(ServerUrl) { TraceLevel = TraceLevels.All, TraceWriter = logWriter }; _proxy = _connection.CreateHubProxy(Constants.ModelRHubName); _proxy.On<<API key>>("SceneObjectCreated", infoModel => <API key>(infoModel)); _proxy.On<<API key>>("<API key>", infoModel => <API key>(infoModel)); _proxy.On<UserInfoModel>("UserJoined", infoModel => OnUserJoined(infoModel)); _proxy.On<UserInfoModel>("UserLoggedOf", infoModel => OnUserLoggedOff(infoModel)); // TODO: [RS] Method cannot be async here, because it is called from the construtor. _connection.Start().Wait(); } catch (AggregateException exception) { Exception nextException; var error = exception.Message; foreach (var innerException in exception.InnerExceptions) { nextException = innerException; while (nextException != null) { error = string.Format(CultureInfo.CurrentUICulture, "{0}{1}{2}", error, Environment.NewLine, nextException.Message); nextException = nextException.InnerException; } } throw new <API key>(error, exception); } } #region Event Raise Helper for SignalR Client Method Calls private void OnUserJoined(UserInfoModel infoModel) { if (UserJoined != null) UserJoined(infoModel); } private void OnUserLoggedOff(UserInfoModel infoModel) { if (UserLoggedOff != null) UserLoggedOff(infoModel); } private void <API key>(<API key> infoModel) { if (<API key> != null) <API key>(infoModel); } private void <API key>(<API key> infoModel) { if (SceneObjectCreated != null) SceneObjectCreated(infoModel); } #endregion #endregion } }
package org.iotashan.TiTouchImageView; import java.io.IOException; import java.util.HashMap; import org.appcelerator.kroll.KrollDict; import org.appcelerator.kroll.KrollProxy; import org.appcelerator.kroll.annotations.Kroll; import org.appcelerator.kroll.common.AsyncResult; import org.appcelerator.kroll.common.Log; import org.appcelerator.kroll.common.TiConfig; import org.appcelerator.kroll.common.TiMessenger; import org.appcelerator.titanium.TiApplication; import org.appcelerator.titanium.TiBlob; import org.appcelerator.titanium.util.TiConvert; import org.appcelerator.titanium.util.TiUIHelper; import org.appcelerator.titanium.io.TiBaseFile; import org.appcelerator.titanium.io.TiFileFactory; import org.appcelerator.titanium.proxy.TiViewProxy; import org.appcelerator.titanium.view.TiDrawableReference; import org.appcelerator.titanium.view.TiUIView; import com.ortiz.touch.TouchImageView; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.graphics.PointF; import android.os.Message; @Kroll.proxy(creatableInModule=<API key>.class, propertyAccessors = { "zoom", "image", "maxZoom", "minZoom" }) public class ViewProxy extends TiViewProxy { // Standard Debugging variables private static final String LCAT = "TiTouchImageView"; private static final boolean DBG = TiConfig.LOGD; private static final int MSG_FIRST_ID = TiViewProxy.MSG_LAST_ID + 1; public static final int MSG_RESET_ZOOM = MSG_FIRST_ID + 101; public static final int MSG_SCROLL_TO = MSG_FIRST_ID + 102; private class TiTouchImageView extends TiUIView { TouchImageView tiv; public TiTouchImageView(final TiViewProxy proxy) { super(proxy); tiv = new TouchImageView(proxy.getActivity()); getLayoutParams().autoFillsHeight = true; getLayoutParams().autoFillsWidth = true; setNativeView(tiv); } @Override public void processProperties(KrollDict props) { super.processProperties(props); if (props.containsKey("zoom")) { tiv.setZoom(TiConvert.toFloat(proxy.getProperty("zoom"))); } if (props.containsKey("image")) { handleImage(proxy.getProperty("image")); } if (props.containsKey("maxZoom")) { tiv.setMaxZoom(TiConvert.toFloat(proxy.getProperty("maxZoom"))); } if (props.containsKey("minZoom")) { tiv.setMinZoom(TiConvert.toFloat(proxy.getProperty("minZoom"))); } } @Override public void propertyChanged(String key, Object oldValue, Object newValue, KrollProxy proxy) { if (key.equals("zoom")) { tiv.setZoom(TiConvert.toFloat(newValue)); } if (key.equals("image")) { handleImage(newValue); } if (key.equals("maxZoom")) { tiv.setMaxZoom(TiConvert.toFloat(newValue)); } if (key.equals("minZoom")) { tiv.setMinZoom(TiConvert.toFloat(newValue)); } } public void setScrollPosition(int x, int y) { tiv.setScrollPosition(x,y); } public void resetZoom() { tiv.resetZoom(); } public float getCurrentZoom() { return tiv.getCurrentZoom(); } public PointF getScrollPosition() { return tiv.getScrollPosition(); } private Bitmap <API key>(String imageName) { Bitmap result = null; try { // Load the image from the application assets String url = <API key>(imageName); TiBaseFile file = TiFileFactory.createTitaniumFile(new String[] { url }, false); result = TiUIHelper.createBitmap(file.getInputStream()); } catch (IOException e) { Log.e(LCAT, " TiTouchImageView only supports local image files"); } return result; } private void handleImage(Object val) { if (val instanceof TiBlob) { // this is a blob, parse accordingly TiBlob imgBlob = (TiBlob)val; TiDrawableReference ref = TiDrawableReference.fromBlob(proxy.getActivity(), imgBlob); tiv.setImageBitmap(ref.getBitmap()); } else { String imgValue = (String)val; tiv.setImageBitmap(<API key>(imgValue)); } } private String <API key>(String assetName) { // path with the proxy context. This locates a resource relative to the // application resources folder String result = resolveUrl(null, assetName); return result; } public void recycleBitmap () { ((BitmapDrawable)tiv.getDrawable()).getBitmap().recycle(); } } // Constructor public ViewProxy() { super(); } @Override public TiUIView createView(Activity activity) { return new TiTouchImageView(this); } protected TiTouchImageView getView() { return (TiTouchImageView) getOrCreateView(); } public boolean handleMessage(Message msg) { boolean handled = false; switch(msg.what) { case MSG_RESET_ZOOM: getView().resetZoom(); handled = true; break; case MSG_SCROLL_TO: handleScrollTo(msg.arg1, msg.arg2); AsyncResult result = (AsyncResult) msg.obj; result.setResult(null); // signal scrolled handled = true; break; default: handled = super.handleMessage(msg); } return handled; } // Methods @Kroll.method public void resetZoom() { getMainHandler().removeMessages(MSG_RESET_ZOOM); getMainHandler().sendEmptyMessage(MSG_RESET_ZOOM); } @Kroll.method public void scrollTo(int x, int y) { if (!TiApplication.isUIThread()) { TiMessenger.<API key>(getMainHandler().obtainMessage(MSG_SCROLL_TO, x, y), getActivity()); } else { handleScrollTo(x,y); } } private void handleScrollTo(int x, int y) { getView().setScrollPosition(x,y); } @Kroll.method public float getCurrentZoom() { return getView().getCurrentZoom(); } @Kroll.method public HashMap getScrollPosition() { PointF point = getView().getScrollPosition(); HashMap result = new HashMap(); result.put("x", point.x); result.put("y", point.y); return result; } @Kroll.method public void recycleBitmap() { getView().recycleBitmap (); } }
{% extends 'main/base.html' %} {%load mytags%} {% block title %}Edit {{event.name.value}}{% endblock title %} {% block content %} <h2>Edit {{event.name.value}}</h2><br> {% if errors %} <div style="background-color:#f2dede;border-radius:5px;"> <h4 style="margin-left:10px">Oh noes!</h4> <ul> {% for field, error in errors.items %} <li>{{field}}- {{error}}</li> {% endfor %} </ul> </div> {% endif %} <form action="#" method="post" id="event-form"> {% csrf_token %} <div class="form-group"> <label for="name-field">Name</label> <input type="text" class="form-control" id="name-field" name="name" value="{{event.name.value}}" required> </div> <div class="form-group"> <label for="description-field">Description</label> <textarea class="form-control" id="description-field" rows="3" name="description" required>{{event.description.value}}</textarea> </div> <div class="form-group"> <label for="date-start-field">Start date/time</label> <input type="text" class="form-control" id="date-start-field" name="date_start" value="{{event.date_start.value|date_value}}" placeholder="MM/DD/YY HH:MM AM/PM" required> </div> <div class="form-group"> <label for="date-end-field">End date/time</label> <input type="text" class="form-control" id="date-end-field" name="date_end" value="{{event.date_end.value|date_value}}" placeholder="MM/DD/YY HH:MM AM/PM" required> </div> <div class="form-group"> <label for="location-field">Location</label> <input type="text" class="form-control" id="location-field" name="location" value="{{event.location.value}}" required> </div> <input type="hidden" id="lat-field" name="geo_lat" value="{{event.geo_lat.value}}"> <input type="hidden" id="lon-field" name="geo_lon" value="{{event.geo_lon.value}}"> </form> <div class="pull-right"><a id="lookup-address" class="btn btn-primary">Lookup location</a></div><br> <div id="map" style="margin-top:40px"></div> <input type="submit" form="event-form" class="btn btn-success pull-right" id="submit-button" value="Save" style="margin-top:10px"> {% endblock content %} {%block scripts%} <script src='https://maps.googleapis.com/maps/api/js?sensor=false'></script> <script src='//cdnjs.cloudflare.com/ajax/libs/gmaps.js/0.4.4/gmaps.min.js'></script> <script> $(document).ready(function(){ map = new GMaps({ div: '#map', {% if event.geo_lat.value %} lat: {{event.geo_lat.value}}, lng: {{event.geo_lon.value}}, zoom: 10, {% else %} lat: 39.828, lng: -98.57, zoom: 4, {% endif %} }) {% if event.geo_lat.value %} map.addMarker({ lat: {{event.geo_lat.value}}, lng: {{event.geo_lon.value}} }) {% endif %} $('#lookup-address').on('click', function(){ GMaps.geocode({ address: $('#location-field').val(), callback: function(results, status) { if (status === 'OK') { var latlng = results[0].geometry.location map.setCenter(latlng.lat(), latlng.lng()) map.setZoom(10) map.removeMarkers() map.addMarker({ lat: latlng.lat(), lng: latlng.lng() }) $('#lat-field').val(latlng.lat()) $('#lon-field').val(latlng.lng()) } } }) }) }) </script> {%endblock%}
import { Component, OnInit, ElementRef, Renderer, ViewEncapsulation } from '@angular/core'; @Component({ selector: 'row', template: ` <ng-content></ng-content> `, styles: [` .row { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; -webkit-flex-wrap: wrap; -ms-flex-wrap: wrap; flex-wrap: wrap; margin-right: -15px; margin-left: -15px; } @media (min-width: 576px) { .row { margin-right: -15px; margin-left: -15px; } } @media (min-width: 768px) { .row { margin-right: -15px; margin-left: -15px; } } @media (min-width: 992px) { .row { margin-right: -15px; margin-left: -15px; } } @media (min-width: 1200px) { .row { margin-right: -15px; margin-left: -15px; } } `], encapsulation: ViewEncapsulation.None }) export class RowComponent implements OnInit { constructor(private element: ElementRef, private renderer: Renderer) { this.renderer.setElementClass(element.nativeElement, 'row', true); } ngOnInit() { } }
using System.Collections.Generic; namespace WikidataNet.Entity { public class RawEntities { public class RawEntity { public class RawClaim { /* "mainsnak": { "snaktype": "value", "property": "P1368", "datavalue": { "value": "000057405", "type": "string" }, "datatype": "string" }, */ public class RawSnak { public class DataValue { public dynamic value { get; set; } public string type { get; set; } } public string snaktype { get; set; } public string property { get; set; } public string datatype { get; set; } public DataValue datavalue { get; set; } } public string type { get; set; } public string id { get; set; } public string rank { get; set; } public RawSnak mainsnak { get; set; } } public int pageid { get; set; } public string title { get; set; } public long lastrevid { get; set; } public string id { get; set; } public string type { get; set; } public Dictionary<string, List<RawClaim>> claims { get; set; } } public Dictionary<string, RawEntity> entities { get; set; } public int success { get; set; } } }
namespace HotelSystem.Web.ViewModels.Manage { using System.Collections.Generic; using Microsoft.AspNet.Identity; using Microsoft.Owin.Security; public class <API key> { public IList<UserLoginInfo> CurrentLogins { get; set; } public IList<<API key>> OtherLogins { get; set; } } }
#include "stdafx.h" #include "Renderer.h" #include "../base/DxInit.h" #include "resourcemanager.h" using namespace graphic; void graphic::ReleaseRenderer() { cResourceManager::Release(); cMainCamera::Release(); cLightManager::Release(); cFontManager::Release(); cPickManager::Release(); } // Renderer cRenderer::cRenderer() : m_pDevice(NULL) , m_elapseTime(0) , m_fps(0) , m_isDbgRender(false) , m_dbgRenderStyle(0) { } cRenderer::~cRenderer() { m_textMgr.Clear(); for (auto &p : m_alphaSpace) delete p; m_alphaSpace.clear(); for (auto &p : m_alphaSpaceBuffer) delete p; m_alphaSpaceBuffer.clear(); SAFE_RELEASE(m_pDevice); // Shutdown GDI+ Gdiplus::GdiplusShutdown(gdiplusToken); } bool cRenderer::CreateDirectX(HWND hWnd, const int width, const int height, const UINT adapter) // D3DADAPTER_DEFAULT { if (!InitDirectX(hWnd, width, height, adapter, m_params, m_pDevice)) return false; using namespace Gdiplus; // Initialize GDI+ GdiplusStartupInput gdiplusStartupInput; GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); m_viewPort.Create(0, 0, width, height); m_textMgr.Create(256); m_textFps.Create(*this); m_textFps.SetPos(0, 0); //m_textFps.SetColor(D3DXCOLOR(0,0,0,1)); m_textFps.SetColor(D3DXCOLOR(255, 255, 255, 1)); m_dbgBox.SetBox(*this, Vector3(1, 1, 1)*-0.2f, Vector3(1, 1, 1)*0.2f); m_dbgBox.SetColor(D3DCOLOR_XRGB(255, 0, 0)); m_dbgArrow.Create(*this, Vector3(0, 0, 0), Vector3(1, 1, 1)); m_dbgSphere.Create(*this, 1, 10, 10); m_dbgAxis.Create(*this); m_hWnd = hWnd; return true; } void cRenderer::RenderAxis() { RET(!m_pDevice); if (m_axis.empty()) MakeAxis(500.f, D3DXCOLOR(1,0,0,0), D3DXCOLOR(0,1,0,0), D3DXCOLOR(0,0,1,0), m_axis); //m_pDevice->SetRenderState(D3DRS_ZENABLE, 0); DWORD lighting; m_pDevice->GetRenderState( D3DRS_LIGHTING, &lighting ); m_pDevice->SetRenderState( D3DRS_LIGHTING, FALSE ); m_pDevice->SetTexture(0, NULL); Matrix44 identity; m_pDevice->SetTransform( D3DTS_WORLD, (D3DXMATRIX*)&identity ); m_pDevice->SetFVF( sVertexDiffuse::FVF ); m_pDevice->DrawPrimitiveUP( D3DPT_LINELIST, 3, &m_axis[0], sizeof(sVertexDiffuse) ); m_pDevice->SetRenderState( D3DRS_LIGHTING, lighting ); //m_pDevice->SetRenderState(D3DRS_ZENABLE, 1); } void cRenderer::RenderFPS() { m_textFps.Render(); } void cRenderer::RenderGrid() { static int gridSize = 0; if (m_grid.empty()) { MakeGrid(10, 64, D3DXCOLOR(0.8f,0.8f,0.8f,1), m_grid); gridSize = m_grid.size() / 2; } if (gridSize > 0) { m_pDevice->SetRenderState(D3DRS_ZENABLE, 0); DWORD lighting; m_pDevice->GetRenderState( D3DRS_LIGHTING, &lighting ); m_pDevice->SetRenderState( D3DRS_LIGHTING, FALSE ); m_pDevice->SetTexture(0, NULL); Matrix44 identity; m_pDevice->SetTransform( D3DTS_WORLD, (D3DXMATRIX*)&identity ); m_pDevice->SetFVF( sVertexDiffuse::FVF ); m_pDevice->DrawPrimitiveUP( D3DPT_LINELIST, gridSize, &m_grid[0], sizeof(sVertexDiffuse) ); m_pDevice->SetRenderState( D3DRS_LIGHTING, lighting); m_pDevice->SetRenderState(D3DRS_ZENABLE, 1); } } void cRenderer::Update(const float elapseT) { ++m_fps; m_elapseTime += elapseT; if( 1.f <= m_elapseTime ) { m_textFps.SetText(format("fps: %d", m_fps)); m_fps = 0; m_elapseTime = 0; } } void cRenderer::MakeGrid( const float width, const int count, DWORD color, vector<sVertexDiffuse> &out ) { if (out.empty()) { out.reserve(count * 4); const Vector3 start(count/2 * -width, 0, count/2 * width); for (int i=0; i < count+1; ++i) { sVertexDiffuse vtx; vtx.p = start; vtx.p.x += (i * width); vtx.c = color; out.push_back(vtx); vtx.p += Vector3(0, 0.001f,-width*count); out.push_back(vtx); } for (int i=0; i < count+1; ++i) { sVertexDiffuse vtx; vtx.p = start; vtx.p.z -= (i * width); vtx.c = color; out.push_back(vtx); vtx.p += Vector3(width*count, 0.001f, 0); out.push_back(vtx); } } } void cRenderer::MakeAxis( const float length, DWORD xcolor, DWORD ycolor, DWORD zcolor, vector<sVertexDiffuse> &out ) { RET(!out.empty()); out.reserve(6); sVertexDiffuse v; // x axis v.p = Vector3( 0.f, 0.001f, 0.f ); v.c = xcolor; out.push_back(v); v.p = Vector3( length, 0.001f, 0.f ); v.c = xcolor; out.push_back(v); // y axis v.p = Vector3( 0.f, 0.001f, 0.f ); v.c = ycolor; out.push_back(v); v.p = Vector3( 0.f, length, 0.f ); v.c = ycolor; out.push_back(v); // z axis v.p = Vector3( 0.f, 0.001f, 0.f ); v.c = zcolor; out.push_back(v); v.p = Vector3( 0.f, 0.001f, length ); v.c = zcolor; out.push_back(v); } bool cRenderer::ClearScene() { HRESULT hr = GetDevice()-><API key>(); if (hr == D3DERR_DEVICELOST) return false; else if (hr == <API key>) return false; if (SUCCEEDED(GetDevice()->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER | D3DCLEAR_STENCIL, //D3DCOLOR_XRGB(150, 150, 150), //D3DCOLOR_ARGB(255, 66, 75, 121), // Blue //D3DCOLOR_ARGB(255, 216, 233, 240), // Sky Blue D3DCOLOR_ARGB(255, 50, 50, 50), // UI Gray 1.0f, 0))) { return true; } return false; } void cRenderer::BeginScene() { GetDevice()->BeginScene(); AddAlphaBlendSpace(cBoundingBox()); } void cRenderer::Present() { GetDevice()->Present(NULL, NULL, NULL, NULL); } void cRenderer::EndScene() { // Text Render m_textMgr.Render(*this); cCamera *cam = GetMainCamera(); Vector3 camOrig, camDir; cam->GetRay(camOrig, camDir); // AlphaBlending Render, Sorting Camera Position // Descent Distance from Camera for (auto &space : m_alphaSpace) { std::sort(space->renders.begin(), space->renders.end(), [&](const sRenderObj &a, const sRenderObj &b) { const Vector3 c1 = a.p->m_boundingBox.Center() * a.tm; const Vector3 c2 = b.p->m_boundingBox.Center() * b.tm; const Plane plane1(a.normal, c1); const Plane plane2(b.normal, c2); const Vector3 dir1 = (c1 - camOrig).Normal(); const Vector3 dir2 = (c2 - camOrig).Normal(); Vector3 p1 = plane1.Pick(camOrig, dir2); if (a.p->m_boundingSphere.m_radius*2 < (p1 - c1).Length()) p1 = plane1.Pick(camOrig, dir1); Vector3 p2 = plane2.Pick(camOrig, dir1); if (b.p->m_boundingSphere.m_radius*2 < (p2 - c2).Length()) p2 = plane2.Pick(camOrig, dir2); const float l1 = p1.LengthRoughly(camOrig); const float l2 = p2.LengthRoughly(camOrig); return l1 > l2; } ); } for (auto &p : m_alphaSpace) for (auto &data : p->renders) data.p->Render(*this, data.tm, -1); for (auto &p : m_alphaSpace) { p->renders.clear(); m_alphaSpaceBuffer.push_back(p); } m_alphaSpace.clear(); GetDevice()->EndScene(); } bool cRenderer::CheckResetDevice(const int width, const int height) // width=0 // height=0 { int w, h; if ((width == 0) || (height == 0)) { sRecti cr; GetClientRect(m_hWnd, (RECT*)&cr); w = cr.Width(); h = cr.Height(); } else { w = width; h = height; } if ((m_params.BackBufferWidth == w) && (m_params.BackBufferHeight == h)) return false; return true; } bool cRenderer::ResetDevice( const int width , const int height , const bool forceReset //=false , const bool resetResource //= true ) { int w, h; if ((width == 0) || (height == 0)) { sRecti cr; GetClientRect(m_hWnd, (RECT*)&cr); w = cr.Width(); h = cr.Height(); } else { w = width; h = height; } if (!forceReset && !CheckResetDevice(w, h)) return false; if (resetResource) cResourceManager::Get()->LostDevice(); m_textFps.LostDevice(); m_viewPort.m_vp.Width = w; m_viewPort.m_vp.Height = h; m_params.BackBufferWidth = w; m_params.BackBufferHeight = h; HRESULT hr = GetDevice()->Reset(&m_params); if (FAILED(hr)) { switch (hr) { case D3DERR_DEVICELOST: OutputDebugStringA("OnResetDevice ÀåÄ¡¸¦ ¼Õ½ÇÇßÁö¸¸ ¸®¼ÂÇÏÁö ¸øÇß°í ±×·¡¼­ ·£´õ¸µ ºÒ°¡ \n"); break; case <API key>: OutputDebugStringA("OnResetDevice µå¶óÀ̹ö ³»ºÎ ¿¡·¯,¾îÇø®ÄÉÀ̼ÇÀº ÀÌ ¸Þ¼¼Áö À϶§ ÀϹÝÀûÀ¸·Î ¼Ë´Ù¿îµÈ´Ù."); break; case D3DERR_INVALIDCALL: OutputDebugStringA("OnResetDevice ºÎÀûÀýÇÑ È£Ãâ. ÆÄ¶ó¸ÞÅͰ¡ À߸øµÈ°æ¿ì.. "); break; case <API key>: OutputDebugStringA("OnResetDevice µð½ºÇ÷¹ÀÌ ¸Þ¸ð¸®°¡ ÃæºÐÇÏÁö ¾ÊÀ½ \n"); break; case E_OUTOFMEMORY: OutputDebugStringA("OnResetDevice Direct3D°¡ ÀÌÈ£Ãâ¿¡ ´ëÇÑ ¸Þ¸ð¸® È®º¸¸¦ ¸øÇÞ´Ù. \n"); break; } Sleep(10); return false; } const Vector3 lookAt = GetMainCamera()->GetLookAt(); const Vector3 eyePos = GetMainCamera()->GetEyePos(); GetMainCamera()->SetCamera(eyePos, lookAt, Vector3(0, 1, 0)); GetMainCamera()->SetViewPort(w, h); if (resetResource) cResourceManager::Get()->ResetDevice(*this); return true; } void cRenderer::AddRenderAlpha(cNode2 *node , const Vector3 &normal //= Vector3(0, 0, 1), , const Matrix44 &tm // = Matrix44::Identity , const int opt ) { assert(!m_alphaSpace.empty()); m_alphaSpace.back()->renders.push_back({ opt, normal ,tm, node }); } void cRenderer::AddRenderAlpha(sAlphaBlendSpace *space , cNode2 *node , const Vector3 &normal //= Vector3(0, 0, 1), , const Matrix44 &tm // = Matrix44::Identity , const int opt ) { space->renders.push_back({ opt, normal ,tm, node }); } void cRenderer::AddAlphaBlendSpace(const cBoundingBox &bbox) { if (m_alphaSpaceBuffer.empty()) { sAlphaBlendSpace *pNew = new sAlphaBlendSpace; pNew->renders.reserve(256); m_alphaSpaceBuffer.push_back(pNew); } sAlphaBlendSpace *p = m_alphaSpaceBuffer.back(); p->renders.clear(); m_alphaSpaceBuffer.pop_back(); p->bbox = bbox; m_alphaSpace.push_back(p); } sAlphaBlendSpace* cRenderer::<API key>() { assert(!m_alphaSpace.empty()); return m_alphaSpace.back(); } void cRenderer::SetLightEnable(const int light, const bool enable) { GetDevice()->LightEnable(light, enable); } void cRenderer::SetCullMode(const D3DCULL cull) { GetDevice()->SetRenderState(D3DRS_CULLMODE, cull); } void cRenderer::SetFillMode(const D3DFILLMODE mode) { GetDevice()->SetRenderState(D3DRS_FILLMODE, mode); } void cRenderer::SetNormalizeNormals(const bool value) { GetDevice()->SetRenderState(<API key>, value? TRUE : FALSE); } void cRenderer::SetAlphaBlend(const bool value) { GetDevice()->SetRenderState(<API key>, value ? TRUE : FALSE); } void cRenderer::SetZEnable(const bool value) { GetDevice()->SetRenderState(D3DRS_ZENABLE, value ? TRUE : FALSE); } void cRenderer::SetZFunc(const D3DCMPFUNC value) { GetDevice()->SetRenderState(D3DRS_ZFUNC, value); } D3DFILLMODE cRenderer::GetFillMode() { DWORD value; GetDevice()->GetRenderState(D3DRS_FILLMODE, &value); return (D3DFILLMODE)value; } D3DCULL cRenderer::GetCullMode() { DWORD value; GetDevice()->GetRenderState(D3DRS_CULLMODE, &value); return (D3DCULL)value; }
var services = { circle : require('./services/circle'), codeship : require('./services/codeship'), drone : require('./services/drone'), jenkins : require('./services/jenkins'), semaphore : require('./services/semaphore'), travis : require('./services/travis'), wercker : require('./services/wercker') }; var localGit = require('./services/localGit'); module.exports = function(cb){ for(var name in services){ var service = services[name]; if (service.detect()){ return cb(null, service.configuration()); } } localGit.detect(function(err, isLocalGit){ if (err){ return cb(err); } if (!isLocalGit){ return cb(new Error('configuration could not be determined')); } localGit.configuration(function(err, config){ return cb(err, config); }); }); };
# IBlockAccess BlockAccess objects are a group of blocks accessible via coordinates. They mainly serves as superinterface to [IWorld](/Vanilla/World/IWorld/), that means all these functions are also available to all [IWorld](/Vanilla/World/IWorld/) objects. It might be required to [import](/AdvancedFunctions/Import/) the class to avoid errors. `import crafttweaker.world.IBlockAccess` ## ZenMethods Get or Set a blockState at a specific Position Use an [IBlockPos](/Vanilla/World/IBlockPos/) Object and an [IBlockState](/Vanilla/Blocks/IBlockState/) Object. Returns an [IBlockState](/Vanilla/Blocks/IBlockState/). zenscript accObj.getBlockState(IBlockPos pos); Check if a block is an air block. Use an [IBlockPos](/Vanilla/World/IBlockPos/) object. Returns a bool. zenscript accObj.isAirBlock(IBlockPos pos); Get strong Power at a block's side Use an [IBlockPos](/Vanilla/World/IBlockPos/) object and an [IFacing](/Vanilla/World/IFacing/) object. Returns an int. zenscript accObj.getStrongPower(BlockPos var1, EnumFacing var2);
#include <rpc/server.h> #include <fs.h> #include <key_io.h> #include <random.h> #include <rpc/util.h> #include <shutdown.h> #include <sync.h> #include <ui_interface.h> #include <util/strencodings.h> #include <util/system.h> #include <boost/signals2/signal.hpp> #include <boost/algorithm/string/classification.hpp> #include <boost/algorithm/string/split.hpp> #include <memory> // for unique_ptr #include <unordered_map> static CCriticalSection cs_rpcWarmup; static std::atomic<bool> g_rpc_running{false}; static bool fRPCInWarmup GUARDED_BY(cs_rpcWarmup) = true; static std::string rpcWarmupStatus GUARDED_BY(cs_rpcWarmup) = "RPC server started"; /* Timer-creating functions */ static RPCTimerInterface* timerInterface = nullptr; /* Map of name to timer. */ static std::map<std::string, std::unique_ptr<RPCTimerBase> > deadlineTimers; struct <API key> { std::string method; int64_t start; }; struct RPCServerInfo { Mutex mutex; std::list<<API key>> active_commands GUARDED_BY(mutex); }; static RPCServerInfo g_rpc_server_info; struct RPCCommandExecution { std::list<<API key>>::iterator it; explicit RPCCommandExecution(const std::string& method) { LOCK(g_rpc_server_info.mutex); it = g_rpc_server_info.active_commands.insert(g_rpc_server_info.active_commands.end(), {method, GetTimeMicros()}); } ~RPCCommandExecution() { LOCK(g_rpc_server_info.mutex); g_rpc_server_info.active_commands.erase(it); } }; static struct CRPCSignals { boost::signals2::signal<void ()> Started; boost::signals2::signal<void ()> Stopped; } g_rpcSignals; void RPCServer::OnStarted(std::function<void ()> slot) { g_rpcSignals.Started.connect(slot); } void RPCServer::OnStopped(std::function<void ()> slot) { g_rpcSignals.Stopped.connect(slot); } void RPCTypeCheck(const UniValue& params, const std::list<UniValueType>& typesExpected, bool fAllowNull) { unsigned int i = 0; for (const UniValueType& t : typesExpected) { if (params.size() <= i) break; const UniValue& v = params[i]; if (!(fAllowNull && v.isNull())) { <API key>(v, t); } i++; } } void <API key>(const UniValue& value, const UniValueType& typeExpected) { if (!typeExpected.typeAny && value.type() != typeExpected.type) { throw JSONRPCError(RPC_TYPE_ERROR, strprintf("Expected type %s, got %s", uvTypeName(typeExpected.type), uvTypeName(value.type()))); } } void RPCTypeCheckObj(const UniValue& o, const std::map<std::string, UniValueType>& typesExpected, bool fAllowNull, bool fStrict) { for (const auto& t : typesExpected) { const UniValue& v = find_value(o, t.first); if (!fAllowNull && v.isNull()) throw JSONRPCError(RPC_TYPE_ERROR, strprintf("Missing %s", t.first)); if (!(t.second.typeAny || v.type() == t.second.type || (fAllowNull && v.isNull()))) { std::string err = strprintf("Expected type %s for %s, got %s", uvTypeName(t.second.type), t.first, uvTypeName(v.type())); throw JSONRPCError(RPC_TYPE_ERROR, err); } } if (fStrict) { for (const std::string& k : o.getKeys()) { if (typesExpected.count(k) == 0) { std::string err = strprintf("Unexpected key %s", k); throw JSONRPCError(RPC_TYPE_ERROR, err); } } } } CAmount AmountFromValue(const UniValue& value) { if (!value.isNum() && !value.isStr()) throw JSONRPCError(RPC_TYPE_ERROR, "Amount is not a number or string"); CAmount amount; if (!ParseFixedPoint(value.getValStr(), 8, &amount)) throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount"); if (!MoneyRange(amount)) throw JSONRPCError(RPC_TYPE_ERROR, "Amount out of range"); return amount; } uint256 ParseHashV(const UniValue& v, std::string strName) { std::string strHex(v.get_str()); if (64 != strHex.length()) throw JSONRPCError(<API key>, strprintf("%s must be of length %d (not %d, for '%s')", strName, 64, strHex.length(), strHex)); if (!IsHex(strHex)) // Note: IsHex("") is false throw JSONRPCError(<API key>, strName+" must be hexadecimal string (not '"+strHex+"')"); return uint256S(strHex); } uint256 ParseHashO(const UniValue& o, std::string strKey) { return ParseHashV(find_value(o, strKey), strKey); } std::vector<unsigned char> ParseHexV(const UniValue& v, std::string strName) { std::string strHex; if (v.isStr()) strHex = v.get_str(); if (!IsHex(strHex)) throw JSONRPCError(<API key>, strName+" must be hexadecimal string (not '"+strHex+"')"); return ParseHex(strHex); } std::vector<unsigned char> ParseHexO(const UniValue& o, std::string strKey) { return ParseHexV(find_value(o, strKey), strKey); } std::string CRPCTable::help(const std::string& strCommand, const JSONRPCRequest& helpreq) const { std::string strRet; std::string category; std::set<rpcfn_type> setDone; std::vector<std::pair<std::string, const CRPCCommand*> > vCommands; for (const auto& entry : mapCommands) vCommands.push_back(make_pair(entry.second->category + entry.first, entry.second)); sort(vCommands.begin(), vCommands.end()); JSONRPCRequest jreq(helpreq); jreq.fHelp = true; jreq.params = UniValue(); for (const std::pair<std::string, const CRPCCommand*>& command : vCommands) { const CRPCCommand *pcmd = command.second; std::string strMethod = pcmd->name; if ((strCommand != "" || pcmd->category == "hidden") && strMethod != strCommand) continue; jreq.strMethod = strMethod; try { rpcfn_type pfn = pcmd->actor; if (setDone.insert(pfn).second) (*pfn)(jreq); } catch (const std::exception& e) { // Help text is returned in an exception std::string strHelp = std::string(e.what()); if (strCommand == "") { if (strHelp.find('\n') != std::string::npos) strHelp = strHelp.substr(0, strHelp.find('\n')); if (category != pcmd->category) { if (!category.empty()) strRet += "\n"; category = pcmd->category; strRet += "== " + Capitalize(category) + " ==\n"; } } strRet += strHelp + "\n"; } } if (strRet == "") strRet = strprintf("help: unknown command: %s\n", strCommand); strRet = strRet.substr(0,strRet.size()-1); return strRet; } UniValue help(const JSONRPCRequest& jsonRequest) { if (jsonRequest.fHelp || jsonRequest.params.size() > 1) throw std::runtime_error( RPCHelpMan{"help", "\nList all commands, or get help for a specified command.\n", { {"command", RPCArg::Type::STR, /* default */ "all commands", "The command to get help on"}, }, RPCResult{ "\"text\" (string) The help text\n" }, RPCExamples{""}, }.ToString() ); std::string strCommand; if (jsonRequest.params.size() > 0) strCommand = jsonRequest.params[0].get_str(); return tableRPC.help(strCommand, jsonRequest); } UniValue stop(const JSONRPCRequest& jsonRequest) { // Accept the deprecated and ignored 'detach' boolean argument // Also accept the hidden 'wait' integer argument (milliseconds) // For instance, 'stop 1000' makes the call wait 1 second before returning // to the client (intended for testing) if (jsonRequest.fHelp || jsonRequest.params.size() > 1) throw std::runtime_error( RPCHelpMan{"stop", "\nStop Bitcoin server.", {}, RPCResults{}, RPCExamples{""}, }.ToString()); // Event loop will exit after current HTTP requests have been handled, so // this reply will get back to the client. StartShutdown(); if (jsonRequest.params[0].isNum()) { MilliSleep(jsonRequest.params[0].get_int()); } return "Bitcoin server stopping"; } static UniValue uptime(const JSONRPCRequest& jsonRequest) { if (jsonRequest.fHelp || jsonRequest.params.size() > 0) throw std::runtime_error( RPCHelpMan{"uptime", "\nReturns the total uptime of the server.\n", {}, RPCResult{ "ttt (numeric) The number of seconds that the server has been running\n" }, RPCExamples{ HelpExampleCli("uptime", "") + HelpExampleRpc("uptime", "") }, }.ToString()); return GetTime() - GetStartupTime(); } static UniValue getrpcinfo(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() > 0) { throw std::runtime_error( RPCHelpMan{"getrpcinfo", "\nReturns details of the RPC server.\n", {}, RPCResults{}, RPCExamples{""}, }.ToString() ); } LOCK(g_rpc_server_info.mutex); UniValue active_commands(UniValue::VARR); for (const <API key>& info : g_rpc_server_info.active_commands) { UniValue entry(UniValue::VOBJ); entry.pushKV("method", info.method); entry.pushKV("duration", GetTimeMicros() - info.start); active_commands.push_back(entry); } UniValue result(UniValue::VOBJ); result.pushKV("active_commands", active_commands); return result; } // clang-format off static const CRPCCommand vRPCCommands[] = { // category name actor (function) argNames /* Overall control/query calls */ { "control", "getrpcinfo", &getrpcinfo, {} }, { "control", "help", &help, {"command"} }, { "control", "stop", &stop, {"wait"} }, { "control", "uptime", &uptime, {} }, }; // clang-format on CRPCTable::CRPCTable() { unsigned int vcidx; for (vcidx = 0; vcidx < (sizeof(vRPCCommands) / sizeof(vRPCCommands[0])); vcidx++) { const CRPCCommand *pcmd; pcmd = &vRPCCommands[vcidx]; mapCommands[pcmd->name] = pcmd; } } const CRPCCommand *CRPCTable::operator[](const std::string &name) const { std::map<std::string, const CRPCCommand*>::const_iterator it = mapCommands.find(name); if (it == mapCommands.end()) return nullptr; return (*it).second; } bool CRPCTable::appendCommand(const std::string& name, const CRPCCommand* pcmd) { if (IsRPCRunning()) return false; // don't allow overwriting for now std::map<std::string, const CRPCCommand*>::const_iterator it = mapCommands.find(name); if (it != mapCommands.end()) return false; mapCommands[name] = pcmd; return true; } void StartRPC() { LogPrint(BCLog::RPC, "Starting RPC\n"); g_rpc_running = true; g_rpcSignals.Started(); } void InterruptRPC() { LogPrint(BCLog::RPC, "Interrupting RPC\n"); // Interrupt e.g. running longpolls g_rpc_running = false; } void StopRPC() { LogPrint(BCLog::RPC, "Stopping RPC\n"); deadlineTimers.clear(); DeleteAuthCookie(); g_rpcSignals.Stopped(); } bool IsRPCRunning() { return g_rpc_running; } void SetRPCWarmupStatus(const std::string& newStatus) { LOCK(cs_rpcWarmup); rpcWarmupStatus = newStatus; } void <API key>() { LOCK(cs_rpcWarmup); assert(fRPCInWarmup); fRPCInWarmup = false; } bool RPCIsInWarmup(std::string *outStatus) { LOCK(cs_rpcWarmup); if (outStatus) *outStatus = rpcWarmupStatus; return fRPCInWarmup; } void JSONRPCRequest::parse(const UniValue& valRequest) { // Parse request if (!valRequest.isObject()) throw JSONRPCError(RPC_INVALID_REQUEST, "Invalid Request object"); const UniValue& request = valRequest.get_obj(); // Parse id now so errors from here on will have the id id = find_value(request, "id"); // Parse method UniValue valMethod = find_value(request, "method"); if (valMethod.isNull()) throw JSONRPCError(RPC_INVALID_REQUEST, "Missing method"); if (!valMethod.isStr()) throw JSONRPCError(RPC_INVALID_REQUEST, "Method must be a string"); strMethod = valMethod.get_str(); if (fLogIPs) LogPrint(BCLog::RPC, "ThreadRPCServer method=%s user=%s peeraddr=%s\n", SanitizeString(strMethod), this->authUser, this->peerAddr); else LogPrint(BCLog::RPC, "ThreadRPCServer method=%s user=%s\n", SanitizeString(strMethod), this->authUser); // Parse params UniValue valParams = find_value(request, "params"); if (valParams.isArray() || valParams.isObject()) params = valParams; else if (valParams.isNull()) params = UniValue(UniValue::VARR); else throw JSONRPCError(RPC_INVALID_REQUEST, "Params must be an array or object"); } bool <API key>(const std::string& method) { const std::vector<std::string> enabled_methods = gArgs.GetArgs("-deprecatedrpc"); return find(enabled_methods.begin(), enabled_methods.end(), method) != enabled_methods.end(); } static UniValue JSONRPCExecOne(JSONRPCRequest jreq, const UniValue& req) { UniValue rpc_result(UniValue::VOBJ); try { jreq.parse(req); UniValue result = tableRPC.execute(jreq); rpc_result = JSONRPCReplyObj(result, NullUniValue, jreq.id); } catch (const UniValue& objError) { rpc_result = JSONRPCReplyObj(NullUniValue, objError, jreq.id); } catch (const std::exception& e) { rpc_result = JSONRPCReplyObj(NullUniValue, JSONRPCError(RPC_PARSE_ERROR, e.what()), jreq.id); } return rpc_result; } std::string JSONRPCExecBatch(const JSONRPCRequest& jreq, const UniValue& vReq) { UniValue ret(UniValue::VARR); for (unsigned int reqIdx = 0; reqIdx < vReq.size(); reqIdx++) ret.push_back(JSONRPCExecOne(jreq, vReq[reqIdx])); return ret.write() + "\n"; } /** * Process named arguments into a vector of positional arguments, based on the * passed-in specification for the RPC call's arguments. */ static inline JSONRPCRequest <API key>(const JSONRPCRequest& in, const std::vector<std::string>& argNames) { JSONRPCRequest out = in; out.params = UniValue(UniValue::VARR); // Build a map of parameters, and remove ones that have been processed, so that we can throw a focused error if // there is an unknown one. const std::vector<std::string>& keys = in.params.getKeys(); const std::vector<UniValue>& values = in.params.getValues(); std::unordered_map<std::string, const UniValue*> argsIn; for (size_t i=0; i<keys.size(); ++i) { argsIn[keys[i]] = &values[i]; } // Process expected parameters. int hole = 0; for (const std::string &argNamePattern: argNames) { std::vector<std::string> vargNames; boost::algorithm::split(vargNames, argNamePattern, boost::algorithm::is_any_of("|")); auto fr = argsIn.end(); for (const std::string & argName : vargNames) { fr = argsIn.find(argName); if (fr != argsIn.end()) { break; } } if (fr != argsIn.end()) { for (int i = 0; i < hole; ++i) { // Fill hole between specified parameters with JSON nulls, // but not at the end (for backwards compatibility with calls // that act based on number of specified parameters). out.params.push_back(UniValue()); } hole = 0; out.params.push_back(*fr->second); argsIn.erase(fr); } else { hole += 1; } } // If there are still arguments in the argsIn map, this is an error. if (!argsIn.empty()) { throw JSONRPCError(<API key>, "Unknown named parameter " + argsIn.begin()->first); } // Return request with named arguments transformed to positional arguments return out; } UniValue CRPCTable::execute(const JSONRPCRequest &request) const { // Return immediately if in warmup { LOCK(cs_rpcWarmup); if (fRPCInWarmup) throw JSONRPCError(RPC_IN_WARMUP, rpcWarmupStatus); } // Find method const CRPCCommand *pcmd = tableRPC[request.strMethod]; if (!pcmd) throw JSONRPCError(<API key>, "Method not found"); try { RPCCommandExecution execution(request.strMethod); // Execute, convert arguments to array if necessary if (request.params.isObject()) { return pcmd->actor(<API key>(request, pcmd->argNames)); } else { return pcmd->actor(request); } } catch (const std::exception& e) { throw JSONRPCError(RPC_MISC_ERROR, e.what()); } } std::vector<std::string> CRPCTable::listCommands() const { std::vector<std::string> commandList; for (const auto& i : mapCommands) commandList.emplace_back(i.first); return commandList; } std::string HelpExampleCli(const std::string& methodname, const std::string& args) { return "> bitcoin-cli " + methodname + " " + args + "\n"; } std::string HelpExampleRpc(const std::string& methodname, const std::string& args) { return "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", " "\"method\": \"" + methodname + "\", \"params\": [" + args + "] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/\n"; } void <API key>(RPCTimerInterface *iface) { if (!timerInterface) timerInterface = iface; } void <API key>(RPCTimerInterface *iface) { timerInterface = iface; } void <API key>(RPCTimerInterface *iface) { if (timerInterface == iface) timerInterface = nullptr; } void RPCRunLater(const std::string& name, std::function<void()> func, int64_t nSeconds) { if (!timerInterface) throw JSONRPCError(RPC_INTERNAL_ERROR, "No timer handler registered for RPC"); deadlineTimers.erase(name); LogPrint(BCLog::RPC, "queue run of timer %s in %i seconds (using %s)\n", name, nSeconds, timerInterface->Name()); deadlineTimers.emplace(name, std::unique_ptr<RPCTimerBase>(timerInterface->NewTimer(func, nSeconds*1000))); } int <API key>() { int flag = 0; if (gArgs.GetArg("-rpcserialversion", <API key>) == 0) flag |= <API key>; return flag; } CRPCTable tableRPC;
#include "actor.hpp" #pragma once #include <string> #include <ncurses.h> class Player:public Actor{ public: Player(int x, int y, WINDOW * text); //using Actor::Actor; Player(int hp, int attack, int defense, int experience, int exp_worth, int speed, int speed_c ); virtual void move(int x, int y) override; virtual void heal (int amount)override; virtual bool damage(int amount)override; bool has_won(); private: int _max_hp = 1; };
<?php namespace Mystique\PHP\Parser; class PhpParserTest extends \MystiqueTest\PHP\Parser\<API key> { protected $isFullParser = true; function getParser() { return new PhpParser(); } }
<?php namespace Blogger\AdminBundle; use Symfony\Component\HttpKernel\Bundle\Bundle; class BloggerAdminBundle extends Bundle { }
package org.testah.runner.performance; import com.fasterxml.jackson.databind.ObjectMapper; import org.testah.TS; import org.testah.driver.http.response.ResponseDto; import org.testah.framework.report.performance.dto.ChunkStats; import org.testah.runner.http.load.HttpAkkaStats; import org.testah.runner.performance.dto.LoadTestSequenceDto; import java.util.List; public class <API key> implements <API key> { /** * Write stats to log. * * @see org.testah.runner.performance.<API key>#push(java.util.List) */ @Override public void push(List<ResponseDto> responses) throws Exception { HttpAkkaStats stats = new HttpAkkaStats(responses); ChunkStats chunkStats = new ChunkStats(stats); // no pretty print to save space in log file TS.log().info(new ObjectMapper().writeValueAsString(chunkStats)); } @Override public void cleanup() { // no post processing required } @Override public void <API key>(LoadTestSequenceDto step) { // no post processing required } @Override public void <API key>(LoadTestSequenceDto step) { // no post processing required } }
<!-- IF S_DISPLAY_JUMPBOX --> <form method="get" name="jumpbox" action="{S_JUMPBOX_ACTION}" onsubmit="if(document.jumpbox.f.value == -1){return false;}"> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td nowrap="nowrap">{<API key>}<span class="gensmall"><!-- IF S_IN_MCP and S_MERGE_SELECT -->{<API key>}<!-- ELSEIF S_IN_MCP -->{L_MODERATE_FORUM}<!-- ELSE -->{L_JUMP_TO}<!-- ENDIF -->{L_COLON}</span>&nbsp;<select name="f" onchange="if(this.options[this.selectedIndex].value != -1){ document.forms['jumpbox'].submit() }"> <!-- BEGIN jumpbox_forums --> <! <option value="{jumpbox_forums.FORUM_ID}"{jumpbox_forums.SELECTED}><!-- BEGIN level -->&nbsp; &nbsp;<!-- END level -->{jumpbox_forums.FORUM_NAME}</option> <!-- END jumpbox_forums --> </select>&nbsp;<input class="btnlite" type="submit" value="{L_GO}" /></td> </tr> </table> </form> <!-- ENDIF -->
package com.wenshao.dal.bean; import com.wenshao.dal.thriftgen.ClientSide; import com.wenshao.dal.thriftgen.Query; import com.wenshao.dal.thriftgen.Version; import java.sql.Timestamp; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; public class ClientBean extends ClientSide{ private Timestamp create_time_bean; private Timestamp update_time_bean; private QueryBean queryBean; private Set<String> tables = new HashSet<String>(); private List<VersionBean> versionBeans; public static final String TABLE_PREFIX = "client_"; public ClientBean() { super(); } public ClientBean(ClientSide client) { super(); this.id = client.id; this.setCreate_time(client.create_time); this.setUpdate_time(client.update_time); this.name = client.name; this.package_name = client.package_name; } public Timestamp getCreate_time_bean() { return create_time_bean; } public void setCreate_time_bean(Timestamp create_time_bean) { this.create_time = String.valueOf(create_time_bean.getTime()); this.create_time_bean = create_time_bean; } public Timestamp getUpdate_time_bean() { return update_time_bean; } public void setUpdate_time_bean(Timestamp update_time_bean) { this.update_time = String.valueOf(update_time_bean.getTime()); this.update_time_bean = update_time_bean; } @Override public ClientSide setCreate_time(String create_time) { if (create_time!=null)this.create_time_bean = new Timestamp(Long.parseLong(create_time)); return super.setCreate_time(create_time); } @Override public ClientSide setUpdate_time(String update_time) { if (update_time!=null)this.update_time_bean = new Timestamp(Long.parseLong(create_time)); return super.setUpdate_time(update_time); } public QueryBean getQueryBean() { return queryBean; } public void setQueryBean(QueryBean queryBean) { this.queryBean = queryBean; } public List<VersionBean> getVersionBeans() { return versionBeans; } public void setVersionBeans(List<VersionBean> versionBeans) { this.versionBeans = versionBeans; } public Set<String> getTables() { return tables; } public void setTables(Set<String> tables) { this.tables = tables; } }
<?php namespace Pay\AliPay\Modules; class <API key> extends AliPayRequest { const METHOD = 'alipay.trade.close'; /** * * @var string */ private $notifyUrl = ''; /** * * @var string */ private $outTradeNo = ''; /** * * @var string */ private $appAuthToken = ''; /** * 64 * @var string */ private $tradeNo = ''; /** * ID * @var string */ private $operatorId = ''; /** * @return string */ public function getMethod() { return self::METHOD; } public function getBizContent() { $data = []; if ('' != $this->getTradeNo()) { $data['trade_no'] = $this->getTradeNo(); } if ('' != $this->getOutTradeNo()) { $data['out_trade_no'] = $this->getOutTradeNo(); } if ('' != $this->getOperatorId()) { $data['operator_id'] = $this->getOperatorId(); } return json_encode($data); } /** * @return string */ public function getNotifyUrl() { return $this->notifyUrl; } /** * @param string $notifyUrl */ public function setNotifyUrl($notifyUrl) { $this->notifyUrl = $notifyUrl; } /** * @return string */ public function getOutTradeNo() { return $this->outTradeNo; } /** * @param string $outTradeNo */ public function setOutTradeNo($outTradeNo) { $this->outTradeNo = $outTradeNo; } /** * @return string */ public function getAppAuthToken() { return $this->appAuthToken; } /** * @param string $appAuthToken */ public function setAppAuthToken($appAuthToken) { $this->appAuthToken = $appAuthToken; } /** * @return string */ public function getTradeNo() { return $this->tradeNo; } /** * @param string $tradeNo */ public function setTradeNo($tradeNo) { $this->tradeNo = $tradeNo; } /** * @return string */ public function getOperatorId() { return $this->operatorId; } /** * @param string $operatorId */ public function setOperatorId($operatorId) { $this->operatorId = $operatorId; } }
<div class="loginView"> <img src="assets/backgrounds/grimmLogo.png" alt="Grimm Logo" class="grimmLogo"> <form> <h3>Sign In or Register!</h3> <div class="form-group"> <label for="email">Email:</label> <input class="form-control" type="email" name="email" ng-model="userEmail" placeholder="Grimm@isamazing.com"> </div> <div class="form-group"> <label for="password">Password:</label> <input class="form-control" type="password" name="password" ng-model="userPassword" placeholder="******"> </div> <div> <button class="btn btn-success whiteButton" type="button" ng-click="login.loginUser(userEmail, userPassword)">Log In</button> <button class="btn btn-warning greyButton" type="button" ng-click="login.registerUser(userEmail, userPassword)">Register</button> </div> </form> </div> <!-- login.loginUser(userEmail, userPassword) -->
#include "CCS811.h" #include "stdint.h" #include <Arduino.h> #include "Wire.h" #include <math.h> CCS811Core::CCS811Core( uint8_t inputArg ) : I2CAddress(inputArg) { } CCS811Core::status CCS811Core::beginCore(void) { CCS811Core::status returnError = SENSOR_SUCCESS; Wire.begin(); #ifdef __AVR__ #else #endif #ifdef __MK20DX256__ #else #endif #ifdef ARDUINO_ARCH_ESP32 #else #endif volatile uint8_t temp = 0; for( uint16_t i = 0; i < 10000; i++ ) { temp++; } while ( Wire.available() ) { Wire.read(); } uint8_t readCheck; readCheck = 0; returnError = readRegister(CSS811_HW_ID, &readCheck); if( returnError != SENSOR_SUCCESS ) return returnError; if( readCheck != 0x81 ) { returnError = SENSOR_ID_ERROR; } return returnError; } CCS811Core::status CCS811Core::readRegister(uint8_t offset, uint8_t* outputPointer) { uint8_t result; uint8_t numBytes = 1; CCS811Core::status returnError = SENSOR_SUCCESS; Wire.beginTransmission(I2CAddress); Wire.write(offset); if( Wire.endTransmission() != 0 ) { returnError = SENSOR_I2C_ERROR; } Wire.requestFrom(I2CAddress, numBytes); while ( Wire.available() ) { result = Wire.read(); } *outputPointer = result; return returnError; } CCS811Core::status CCS811Core::multiReadRegister(uint8_t offset, uint8_t *outputPointer, uint8_t length) { CCS811Core::status returnError = SENSOR_SUCCESS; uint8_t i = 0; uint8_t c = 0; Wire.beginTransmission(I2CAddress); Wire.write(offset); if( Wire.endTransmission() != 0 ) { returnError = SENSOR_I2C_ERROR; } else { Wire.requestFrom(I2CAddress, length); while ( (Wire.available()) && (i < length)) { c = Wire.read(); *outputPointer = c; outputPointer++; i++; } while(Wire.available()) { Wire.read(); } } return returnError; } CCS811Core::status CCS811Core::writeRegister(uint8_t offset, uint8_t dataToWrite) { CCS811Core::status returnError = SENSOR_SUCCESS; Wire.beginTransmission(I2CAddress); Wire.write(offset); Wire.write(dataToWrite); if( Wire.endTransmission() != 0 ) { returnError = SENSOR_I2C_ERROR; } return returnError; } CCS811Core::status CCS811Core::multiWriteRegister(uint8_t offset, uint8_t *inputPointer, uint8_t length) { CCS811Core::status returnError = SENSOR_SUCCESS; //define pointer that will point to the external space uint8_t i = 0; //Set the address Wire.beginTransmission(I2CAddress); Wire.write(offset); while ( i < length ) // send data bytes { Wire.write(*inputPointer); // receive a byte as character inputPointer++; i++; } if( Wire.endTransmission() != 0 ) { returnError = SENSOR_I2C_ERROR; } return returnError; } CCS811::CCS811( uint8_t inputArg ) : CCS811Core( inputArg ) { refResistance = 10000; resistance = 0; temperature = 0; tVOC = 0; CO2 = 0; } CCS811Core::status CCS811::begin( void ) { uint8_t data[4] = {0x11,0xE5,0x72,0x8A}; //Reset key CCS811Core::status returnError = SENSOR_SUCCESS; //Default error state //restart the core returnError = beginCore(); if( returnError != SENSOR_SUCCESS ) return returnError; //Reset the device multiWriteRegister(CSS811_SW_RESET, data, 4); //Tclk = 1/16MHz = 0x0000000625 //0.001 s / tclk = 16000 counts volatile uint8_t temp = 0; #ifdef ARDUINO_ARCH_ESP32 for( uint32_t i = 0; i < 80000; i++ ) //This waits > 1ms @ 80MHz clock { temp++; } #elif __AVR__ for( uint16_t i = 0; i < 16000; i++ ) //This waits > 1ms @ 16MHz clock { temp++; } #else for( uint32_t i = 0; i < 200000; i++ ) //Spin for a good while { temp++; } #endif if( checkForStatusError() == true ) return <API key>; if( appValid() == false ) return <API key>; //Write 0 bytes to this register to start app Wire.beginTransmission(I2CAddress); Wire.write(CSS811_APP_START); if( Wire.endTransmission() != 0 ) { return SENSOR_I2C_ERROR; } returnError = setDriveMode(1); //Read every second return returnError; } CCS811Core::status CCS811::<API key>( void ) { uint8_t data[4]; CCS811Core::status returnError = multiReadRegister(<API key>, data, 4); if( returnError != SENSOR_SUCCESS ) return returnError; // Data ordered: // co2MSB, co2LSB, tvocMSB, tvocLSB CO2 = ((uint16_t)data[0] << 8) | data[1]; tVOC = ((uint16_t)data[2] << 8) | data[3]; return SENSOR_SUCCESS; } //Checks to see if error bit is set bool CCS811::checkForStatusError( void ) { uint8_t value; //return the status bit readRegister( CSS811_STATUS, &value ); return (value & 1 << 0); } //Checks to see if DATA_READ flag is set in the status register bool CCS811::dataAvailable( void ) { uint8_t value; CCS811Core::status returnError = readRegister( CSS811_STATUS, &value ); if( returnError != SENSOR_SUCCESS ) { return 0; } else { return (value & 1 << 3); } } bool CCS811::appValid( void ) { uint8_t value; CCS811Core::status returnError = readRegister( CSS811_STATUS, &value ); if( returnError != SENSOR_SUCCESS ) { return 0; } else { return (value & 1 << 4); } } uint8_t CCS811::getErrorRegister( void ) { uint8_t value; CCS811Core::status returnError = readRegister( CSS811_ERROR_ID, &value ); if( returnError != SENSOR_SUCCESS ) { return 0xFF; } else { return value; //Send all errors in the event of communication error } } uint16_t CCS811::getBaseline( void ) { uint8_t data[2]; CCS811Core::status returnError = multiReadRegister(CSS811_BASELINE, data, 2); unsigned int baseline = ((uint16_t)data[0] << 8) | data[1]; if( returnError != SENSOR_SUCCESS ) { return 0; } else { return (baseline); } } CCS811Core::status CCS811::setBaseline( uint16_t input ) { uint8_t data[2]; data[0] = (input >> 8) & 0x00FF; data[1] = input & 0x00FF; CCS811Core::status returnError = multiWriteRegister(CSS811_BASELINE, data, 2); return returnError; } //Enable the nINT signal CCS811Core::status CCS811::enableInterrupts( void ) { uint8_t value; CCS811Core::status returnError = readRegister( CSS811_MEAS_MODE, &value ); //Read what's currently there if(returnError != SENSOR_SUCCESS) return returnError; Serial.println(value, HEX); value |= (1 << 3); //Set INTERRUPT bit writeRegister(CSS811_MEAS_MODE, value); Serial.println(value, HEX); return returnError; } CCS811Core::status CCS811::disableInterrupts( void ) { uint8_t value; CCS811Core::status returnError = readRegister( CSS811_MEAS_MODE, &value ); //Read what's currently there if( returnError != SENSOR_SUCCESS ) return returnError; value &= ~(1 << 3); //Clear INTERRUPT bit returnError = writeRegister(CSS811_MEAS_MODE, value); return returnError; } CCS811Core::status CCS811::setDriveMode( uint8_t mode ) { if (mode > 4) mode = 4; //sanitize input uint8_t value; CCS811Core::status returnError = readRegister( CSS811_MEAS_MODE, &value ); //Read what's currently there if( returnError != SENSOR_SUCCESS ) return returnError; value &= ~(0b00000111 << 4); //Clear DRIVE_MODE bits value |= (mode << 4); //Mask in mode returnError = writeRegister(CSS811_MEAS_MODE, value); return returnError; } CCS811Core::status CCS811::<API key>( float relativeHumidity, float temperature ) { //Check for invalid temperatures if((temperature < -25)||(temperature > 50)) return <API key>; //Check for invalid humidity if((relativeHumidity < 0)||(relativeHumidity > 100)) return <API key>; uint32_t rH = relativeHumidity * 1000; //42.348 becomes 42348 uint32_t temp = temperature * 1000; //23.2 becomes 23200 byte envData[4]; //Split value into 7-bit integer and 9-bit fractional envData[0] = ((rH % 1000) / 100) > 7 ? (rH / 1000 + 1) << 1 : (rH / 1000) << 1; envData[1] = 0; //CCS811 only supports increments of 0.5 so bits 7-0 will always be zero if (((rH % 1000) / 100) > 2 && (((rH % 1000) / 100) < 8)) { envData[0] |= 1; //Set 9th bit of fractional to indicate 0.5% } temp += 25000; //Add the 25C offset //Split value into 7-bit integer and 9-bit fractional envData[2] = ((temp % 1000) / 100) > 7 ? (temp / 1000 + 1) << 1 : (temp / 1000) << 1; envData[3] = 0; if (((temp % 1000) / 100) > 2 && (((temp % 1000) / 100) < 8)) { envData[2] |= 1; //Set 9th bit of fractional to indicate 0.5C } CCS811Core::status returnError = multiWriteRegister(CSS811_ENV_DATA, envData, 4); return returnError; } void CCS811::setRefResistance( float input ) { refResistance = input; } CCS811Core::status CCS811::readNTC( void ) { uint8_t data[4]; CCS811Core::status returnError = multiReadRegister(CSS811_NTC, data, 4); vrefCounts = ((uint16_t)data[0] << 8) | data[1]; //Serial.print("vrefCounts: "); //Serial.println(vrefCounts); ntcCounts = ((uint16_t)data[2] << 8) | data[3]; //Serial.print("ntcCounts: "); //Serial.println(ntcCounts); //Serial.print("sum: "); //Serial.println(ntcCounts + vrefCounts); resistance = ((float)ntcCounts * refResistance / (float)vrefCounts); //Code from Milan Malesevic and Zoran Stupic, 2011, temperature = log((long)resistance); temperature = 1 / (0.001129148 + (0.000234125 * temperature) + (0.0000000876741 * temperature * temperature * temperature)); temperature = temperature - 273.15; // Convert Kelvin to Celsius return returnError; } uint16_t CCS811::getTVOC( void ) { return tVOC; } uint16_t CCS811::getCO2( void ) { return CO2; } float CCS811::getResistance( void ) { return resistance; } float CCS811::getTemperature( void ) { return temperature; }
using System; using Slot.Editor.ObjectModel; namespace Slot.Editor.Styling { public sealed class <API key> : EventArgs { internal <API key>(Range range) { Range = range; } public Range Range { get; } } }
<?php namespace Gino; Loader::import('class/fields', '\Gino\Field'); class <API key> extends Field { protected $_controller, $_m2m, $_m2m_controller, $_remove_fields; function __construct($options) { $this->_default_widget = 'unit'; parent::__construct($options); $this->_controller = $options['controller']; $this->_m2m = $options['m2m']; $this->_m2m_controller = array_key_exists('m2m_controller', $options) ? $options['m2m_controller'] : null; $this->_remove_fields = array_key_exists('remove_fields', $options) ? $options['remove_fields'] : array(); } /** * @see Gino.Field::getProperties() */ public function getProperties() { $prop = parent::getProperties(); $prop['controller'] = $this->_controller; $prop['m2m'] = $this->_m2m; $prop['m2m_controller'] = $this->_m2m_controller; $prop['remove_fields'] = $this->_remove_fields; return $prop; } public function getRemoveFields() { return $this->_remove_fields; } /** * @see Gino.Field::valueFromDb() * @param integer $value valore id del record * @return null or array (valori id dei record di associazione) */ public function valueFromDb($value) { if(is_null($value)) { return null; } elseif(is_array($value)) { return $value; } else { throw new \Exception(sprintf(_("Valore non valido del campo \"%s\""), $this->_name)); } } }
require 'spec_helper' describe VotesController, type: :controller do render_views let(:votable_owner) { FactoryGirl.create(:user) } let(:votable) { FactoryGirl.create(:event, user: votable_owner) } context "authenticated" do let(:user) { FactoryGirl.create(:user) } let(:my_votable) { FactoryGirl.create(:event, user: user) } before(:each) do request.env["devise.mapping"] = Devise.mappings[:user] sign_in user end describe "#create" do it "upvotes item the current user cannot edit" do expect(user.voted_up_on?(votable)).to eq(false) post :create, votable_type: votable.class.name, votable_id: votable.id expect(response).to have_http_status(:ok) expect(user.voted_up_on?(votable)).to eq(true) end it "does not upvote item the current user can edit" do expect(user.voted_up_on?(my_votable)).to eq(false) post :create, votable_type: my_votable.class.name, votable_id: my_votable.id expect(response).to have_http_status(:forbidden) expect(user.voted_up_on?(my_votable)).to eq(false) end it "404s when invalid votable type is given" do post :create, votable_type: user.class.name, votable_id: user.id expect(response).to have_http_status(:not_found) end it "404s when invalid votable ID is given" do post :create, votable_type: votable.class.name, votable_id: votable.id + 100 expect(response).to have_http_status(:not_found) end end describe "#destroy" do it "removes an upvote" do votable.liked_by user expect(user.voted_for?(votable)).to eq(true) delete :destroy, votable_type: votable.class.name, votable_id: votable.id expect(response).to have_http_status(:ok) expect(user.voted_for?(votable)).to eq(false) end end end context "unauthenticated" do describe "#create" do it "redirects" do post :create, votable_type: votable.class.name, votable_id: votable.id expect(response).to have_http_status(:redirect) end end describe "#destroy" do it "redirects" do delete :destroy, votable_type: votable.class.name, votable_id: votable.id expect(response).to have_http_status(:redirect) end end end end
import { Rule } from '../types' export default { id: 'href-abs-or-rel', description: 'An href attribute must be either absolute or relative.', init(parser, reporter, options) { const hrefMode = options === 'abs' ? 'absolute' : 'relative' parser.addListener('tagstart', (event) => { const attrs = event.attrs let attr const col = event.col + event.tagName.length + 1 for (let i = 0, l = attrs.length; i < l; i++) { attr = attrs[i] if (attr.name === 'href') { if ( (hrefMode === 'absolute' && /^\w+?:/.test(attr.value) === false) || (hrefMode === 'relative' && /^https?:\/\ ) { reporter.warn( `The value of the href attribute [ ${attr.value} ] must be ${hrefMode}.`, event.line, col + attr.index, this, attr.raw ) } break } } }) }, } as Rule
<?php namespace Application\Sonata\SuperMarketBundle\Admin; use Sonata\AdminBundle\Admin\Admin; use Sonata\AdminBundle\Datagrid\DatagridMapper; use Sonata\AdminBundle\Datagrid\ListMapper; use Sonata\AdminBundle\Form\FormMapper; use Sonata\AdminBundle\Show\ShowMapper; class CategoryAdmin extends Admin { /** * @param DatagridMapper $datagridMapper */ protected function <API key>(DatagridMapper $datagridMapper) { $datagridMapper ->add('id') ->add('name') ->add('slug') ; } /** * @param ListMapper $listMapper */ protected function configureListFields(ListMapper $listMapper) { $listMapper ->add('id') ->add('name') ->add('slug') ->add('_action', 'actions', array( 'actions' => array( 'show' => array(), 'edit' => array(), 'delete' => array(), ) )) ; } /** * @param FormMapper $formMapper */ protected function configureFormFields(FormMapper $formMapper) { $formMapper ->add('name') ->add('slug') ; } /** * @param ShowMapper $showMapper */ protected function configureShowFields(ShowMapper $showMapper) { $showMapper ->add('id') ->add('name') ->add('slug') ; } }
<?php namespace Elastification\Client\Request\V2x\Cat; use Elastification\Client\Request\Shared\Cat\<API key>; use Elastification\Client\Response\Response; use Elastification\Client\Serializer\SerializerInterface; /** * Class PluginsCatRequest * @package Elastification\Client\Request\V2x\Cat */ class PluginsCatRequest extends <API key> { /** * @param string $rawData * @param \Elastification\Client\Serializer\SerializerInterface $serializer * @param array $serializerParams * * @return Response * @author Daniel Wendlandt */ public function createResponse( $rawData, SerializerInterface $serializer, array $serializerParams = array() ) { return new Response($rawData, $serializer, $serializerParams); } /** * gets a response class name that is supported by this class * * @return string * @author Daniel Wendlandt */ public function getSupportedClass() { return 'Elastification\Client\Response\Response'; } }
#!/bin/sh set -e docprefix=/packages/${PKG_NAME}-doc/${PKG_VERSION} binprefix=/packages/${PKG_NAME}-bin/${PKG_VERSION} mkdir build && cd build ../${PKG_NAME}-*/configure --prefix="${PKG_DIR}" \ --oldincludedir=${PKG_DIR}/include --localedir=${PKG_DIR}/locale \ --bindir=${binprefix}/bin \ --infodir=${docprefix}/info --mandir=${docprefix}/man \ --docdir=${docprefix}/doc \ --disable-werror --disable-shared make $MAKE_JOBS make $MAKE_JOBS install DESTDIR="${PKG_INSTDIR}" # not sure why the build system makes such a mess of this docdir="${PKG_INSTDIR}/$docprefix" mkdir -p ${docdir}/doc/ mv ${PKG_INSTDIR}/${PKG_DIR}/share/doc/libxml2*/* "${docdir}/doc/"
FullCalendar.globalLocales.push(function(){"use strict";return{code:"en-gb",week:{dow:1,doy:4},buttonHints:{prev:"Previous $0",next:"Next $0",today:"This $0"},viewHint:"$0 view",navLinkHint:"Go to $0",moreLinkHint:e=>`Show ${e} more event${1===e?"":"s"}`}}());
/** * <API key>.java * <p> * This file was auto-generated from WSDL * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter. */ package com.microsoft.bingads.v10.datacontracts; public class <API key> implements java.io.Serializable { // Type metadata private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(<API key>.class, true); static { typeDesc.setXmlType(new javax.xml.namespace.QName("http://schemas.datacontract.org/2004/07/Microsoft.AdCenter.Advertiser.CampaignManagement.Api.DataContracts.V10", "<API key>")); org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc(); elemField.setFieldName("entityId"); elemField.setXmlName(new javax.xml.namespace.QName("http://schemas.datacontract.org/2004/07/Microsoft.AdCenter.Advertiser.CampaignManagement.Api.DataContracts.V10", "EntityId")); elemField.setXmlType(new javax.xml.namespace.QName("http: elemField.setMinOccurs(0); elemField.setNillable(false); typeDesc.addFieldDesc(elemField); elemField = new org.apache.axis.description.ElementDesc(); elemField.setFieldName("parentId"); elemField.setXmlName(new javax.xml.namespace.QName("http://schemas.datacontract.org/2004/07/Microsoft.AdCenter.Advertiser.CampaignManagement.Api.DataContracts.V10", "ParentId")); elemField.setXmlType(new javax.xml.namespace.QName("http: elemField.setMinOccurs(0); elemField.setNillable(false); typeDesc.addFieldDesc(elemField); } private java.lang.Long entityId; private java.lang.Long parentId; private java.lang.Object __equalsCalc = null; private boolean __hashCodeCalc = false; public <API key>() { } public <API key>( java.lang.Long entityId, java.lang.Long parentId) { this.entityId = entityId; this.parentId = parentId; } /** * Return type metadata object */ public static org.apache.axis.description.TypeDesc getTypeDesc() { return typeDesc; } /** * Get Custom Serializer */ public static org.apache.axis.encoding.Serializer getSerializer( java.lang.String mechType, java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { return new org.apache.axis.encoding.ser.BeanSerializer( _javaType, _xmlType, typeDesc); } /** * Get Custom Deserializer */ public static org.apache.axis.encoding.Deserializer getDeserializer( java.lang.String mechType, java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { return new org.apache.axis.encoding.ser.BeanDeserializer( _javaType, _xmlType, typeDesc); } /** * Gets the entityId value for this <API key>. * * @return entityId */ public java.lang.Long getEntityId() { return entityId; } /** * Sets the entityId value for this <API key>. * * @param entityId */ public void setEntityId(java.lang.Long entityId) { this.entityId = entityId; } /** * Gets the parentId value for this <API key>. * * @return parentId */ public java.lang.Long getParentId() { return parentId; } /** * Sets the parentId value for this <API key>. * * @param parentId */ public void setParentId(java.lang.Long parentId) { this.parentId = parentId; } public synchronized boolean equals(java.lang.Object obj) { if (!(obj instanceof <API key>)) return false; <API key> other = (<API key>) obj; if (obj == null) return false; if (this == obj) return true; if (__equalsCalc != null) { return (__equalsCalc == obj); } __equalsCalc = obj; boolean _equals; _equals = true && ((this.entityId == null && other.getEntityId() == null) || (this.entityId != null && this.entityId.equals(other.getEntityId()))) && ((this.parentId == null && other.getParentId() == null) || (this.parentId != null && this.parentId.equals(other.getParentId()))); __equalsCalc = null; return _equals; } public synchronized int hashCode() { if (__hashCodeCalc) { return 0; } __hashCodeCalc = true; int _hashCode = 1; if (getEntityId() != null) { _hashCode += getEntityId().hashCode(); } if (getParentId() != null) { _hashCode += getParentId().hashCode(); } __hashCodeCalc = false; return _hashCode; } }
export interface IncomingDefault { ID: string; Email?: string; Domain?: string; Location: number; Type: number; Time: number; }
#ifndef SCENE_H #define SCENE_H class Scene { static enum Type { TITLE = 0, LEVEL = 1, MESSAGE, OVER, END }; public: void AddSprite(Sprite sprite); void RemoveSprite(int id); private: }; #endif
#ifndef <API key> #define <API key> // $Id: replace_if.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ // $Revision: 49267 $ #include <boost/mpl/transform.hpp> #include <boost/mpl/apply.hpp> #include <boost/mpl/if.hpp> #include <boost/mpl/aux_/inserter_algorithm.hpp> #include <boost/mpl/aux_/config/forwarding.hpp> namespace boost { namespace mpl { namespace aux { template< typename Predicate, typename T > struct replace_if_op { template< typename U > struct apply #if !defined(<API key>) : if_< typename apply1<Predicate,U>::type , T , U > { #else { typedef typename if_< typename apply1<Predicate,U>::type , T , U >::type type; #endif }; }; template< typename Sequence , typename Predicate , typename T , typename Inserter > struct replace_if_impl : transform1_impl< Sequence , protect< aux::replace_if_op<Predicate,T> > , Inserter > { }; template< typename Sequence , typename Predicate , typename T , typename Inserter > struct <API key> : <API key>< Sequence , protect< aux::replace_if_op<Predicate,T> > , Inserter > { }; } // namespace aux <API key>(4, replace_if) }} #endif // <API key>
@import '~app/styles/variables.css'; .root h3 { margin: 5px 0 25px; } .fileForm { margin-top: 15px; } .search { display: flex; } .root select { font-size: 100%; font-family: proxima-nova, 'Helvetica Neue', Arial, sans-serif; cursor: pointer; transition: color 0.2s; text-indent: 1px; text-overflow: ''; background-color: inherit; border: none; outline: none; &:hover { color: var(--<API key>); cursor: pointer; } &:focus { border: none; outline: none; } &::-ms-expand { display: none; } } .companyList table { border-collapse: collapse; } .rightSection a { display: block; } .companyList table a { display: block; color: var(--color-black); } .companyList th { padding: 5px 0; border-top: 1px solid var(--color-mono-gray-1); border-bottom: 1px solid var(--color-mono-gray-1) !important; } .companyList th, .companyList td { padding-left: 7px; width: 140px; border-bottom: 1px dashed var(--color-mono-gray-1); text-align: left; display: table-cell; &:first-child { width: 180px; } &:nth-child(5) { width: 190px; } &:nth-child(6) { width: 180px; } } .yearNavigator { margin-bottom: -5px; transition: color 0.3s ease; color: var(--lego-text-color); &:hover { cursor: pointer; color: var(--lego-link-color); } &:focus { background: none; } &::selection { background: none; } } .adminComment { padding: 5px 0; line-height: 17px; } .categoryHeader { font-weight: bold; background-color: var(--color-mono-gray-5); } .title { float: left; width: 80%; } .companyPresentation { background-color: #3fff3f; } .lunchPresentation { background-color: #84ff84; } .course { background-color: #9fff3f; } .interested { background-color: #f5f5d5; } .notInterested { background-color: #f00; } .contacted { background-color: #ffff7f; } .notContacted { background-color: var(--color-mono-gray-3); } .bedex { background-color: #00fff6; } .files { margin-top: 20px; } .info h3, .info i { margin: 0 auto; } .editInfo > label { display: flex; } .editInfo i { width: 30px; } .deleteFile { display: flex; justify-content: space-between; align-items: center; & i:hover { cursor: pointer; } & div { display: inline; } & span { max-width: 200px; } } .deleteIcon { color: #d13c32; &:hover { cursor: pointer; } } .showAscending .upArrow, .showDescending .downArrow { display: block !important; float: right; width: 10%; padding-right: 20px; color: var(--<API key>); } .hidden, .showAscending .downArrow, .showDescending .upArrow { display: none !important; } .dropDownItem { font-size: 12px; justify-content: space-between; width: 100%; } .lazyCircle { width: 20px; height: 20px; border-radius: 10px; } /* Semesters in detailroute */ .detailTable thead th:nth-child(1), .detailTable tbody td:nth-child(1) { width: 120px; } .detailTable thead th:nth-child(2), .detailTable tbody td:nth-child(2) { width: 210px; } .detailTable thead th:nth-child(3), .detailTable tbody td:nth-child(3), .detailTable thead th:nth-child(4), .detailTable tbody td:nth-child(4), .detailTable thead th:nth-child(5), .detailTable tbody td:nth-child(5) { max-width: 220px; min-width: 220px; width: 220px; word-wrap: break-word; } .detailTable tbody td:nth-child(3), .detailTable tbody td:nth-child(4), .detailTable tbody td:nth-child(5) { line-height: 15px; font-size: 13px; padding: 5px; & a { color: var(--lego-link-color); transition: color 0.3s; } & a:hover { color: var(--color-red-1); } } .detailTable thead th:nth-child(6), .detailTable tbody td:nth-child(6) { width: 30px; } /* company contact in detailroute */ .contactTable thead th:nth-child(1), .contactTable tbody td:nth-child(1) { width: 250px; } .contactTable thead th:nth-child(2), .contactTable tbody td:nth-child(2) { width: 270px; } .contactTable thead th:nth-child(3), .contactTable tbody td:nth-child(3) { width: 330px; } .contactTable thead th:nth-child(4), .contactTable tbody td:nth-child(4) { width: 180px; } /* Events in company detailroute */ .eventsTable thead th:nth-child(1), .eventsTable tbody td:nth-child(1) { width: 350px; } .eventsTable thead th:nth-child(2), .eventsTable tbody td:nth-child(2) { width: 180px; } .eventsTable thead th:nth-child(3), .eventsTable tbody td:nth-child(3) { width: 100px; } .eventsTable thead th:nth-child(4), .eventsTable tbody td:nth-child(4) { width: 200px; line-height: 20px; padding: 5px; } .eventsTable thead th:nth-child(5), .eventsTable tbody td:nth-child(5) { width: 300px; line-height: 20px; padding: 5px; } .description { margin: 0 0 35px; line-height: 24px; border-left: 4px solid var(--<API key>); padding-left: 20px; max-width: 90%; @media (--small-viewport) { max-width: 100%; } } .description textarea { min-height: 100px; } .infoBubbles { display: flex; text-align: center; flex-wrap: wrap; justify-content: space-between; @media (--mobile-device) { justify-content: space-around; align-items: center; } } .infoBubbles > div { margin: 30px 0; @media (--mobile-device) { margin-right: 20px; } } .editBubbles { line-height: 0 !important; } .adminNote { margin: 30px 0; width: 400px; } .invisRow { background-color: var(--color-white); } .rightArrow { text-align: right !important; } .detail { display: flex; width: 100%; padding-bottom: 50px; flex-direction: column; } .submit { padding: 10px 20px; font-size: 14px; margin: 10px 0 50px; &:disabled { color: var(--color-mono-gray-3); } } .checkBox { display: block; margin: 10px 0; } .clear { clear: both; } option { border: none; outline: none; } .detail h3 { margin-bottom: 2px; } .info { margin: 30px 0; display: flex; justify-content: space-between; } .info > div { display: flex; flex-direction: column; justify-content: center; } .editTitle { width: 250px; font-size: 30px; margin: 0 0 10px; } .editBubble { text-align: center; margin-bottom: 0 !important; font-size: 25px; } .choices { margin: 20px 0; } .choices h3 { margin: 0 0 7px; } .yearForm { width: 100px; display: block; } .semesterStatusForm { width: 300px; margin: 15px 0; padding: 5px; &:hover { cursor: pointer; } } .search h2 { display: inline; margin-right: 20px; padding-top: 3px; } .search input { width: 200px; height: 45px; } .info .fa { padding-left: 30px; } .info h3 { margin-bottom: 15px; } .uploadButton { height: 30px; font-size: 12px; padding: 0 10px; margin: 5px 0; } .contactedStatusForm { width: 240px; } .surveyIcon { color: var(--lego-link-color); } .surveyContainer { display: flex; justify-content: center; }
<!DOCTYPE html> <HTML><HEAD><TITLE>Man page of POSTGRES</TITLE> <meta charset="utf-8"> <link rel="stylesheet" href="/css/main.css" type="text/css"> </head> <body> <header class="site-header"> <div class="wrap"> <div class="site-title"><a href="/manpages-zh/index.html">linux manpages </a></div> <div class="site-description">{"type":"documentation"}</div> </div> </header> <div class="page-content"><div class="wrap"> <H1>POSTGRES</H1> Section: PostgreSQL Server Applications (1)<BR>Updated: 2003-11-02<BR><A HREF="#index">Index</A> <A HREF="/manpages-zh/index.html">Return to Main Contents</A><HR> <A NAME="lbAB">&nbsp;</A> <H2>NAME</H2> postgres - PostgreSQL <P> <A NAME="lbAC">&nbsp;</A> <H2>SYNOPSIS</H2> <P> <B>postgres</B> [ <B>-A </B><B> 0</B> | <B>1</B><B> </B>] [ <B>-B </B><I>nbuffers</I><B> </B>] [ <B>-c </B><I>name</I><B>=</B><I>value</I><B> </B>] [ <B>-d </B><I>debug-level</I><B> </B>] [ <B>--describe-config </B>] [ <B>-D </B><I>datadir</I><B> </B>] [ <B>-e </B>] [ <B>-E </B>] [ <B>-f </B><B> s</B> | <B>i</B> | <B>t</B> | <B>n</B> | <B>m</B> | <B>h</B><B> </B>] [ <B>-F </B>] [ <B>-N </B>] [ <B>-o </B><I>filename</I><B> </B>] [ <B>-O </B>] [ <B>-P </B>] [ <B>-s</B> | <B>-t </B><B> pa</B> | <B>pl</B> | <B>ex</B><B></B> ] [ <B>-S </B><I>sort-mem</I><B> </B>] [ <B>-W </B><I>seconds</I><B> </B>] [ <B>--</B><I>name</I><B>=</B><I>value</I><B> </B>] <B></B><I>database</I><B></B> <P> <B>postgres</B> [ <B>-A </B><B> 0</B> | <B>1</B><B> </B>] [ <B>-B </B><I>nbuffers</I><B> </B>] [ <B>-c </B><I>name</I><B>=</B><I>value</I><B> </B>] [ <B>-d </B><I>debug-level</I><B> </B>] [ <B>-D </B><I>datadir</I><B> </B>] [ <B>-e </B>] [ <B>-f </B><B> s</B> | <B>i</B> | <B>t</B> | <B>n</B> | <B>m</B> | <B>h</B><B> </B>] [ <B>-F </B>] [ <B>-o </B><I>filename</I><B> </B>] [ <B>-O </B>] [ <B>-p </B><I>database</I><B> </B>] [ <B>-P </B>] [ <B>-s</B> | <B>-t </B><B> pa</B> | <B>pl</B> | <B>ex</B><B></B> ] [ <B>-S </B><I>sort-mem</I><B> </B>] [ <B>-v </B><I>protocol</I><B> </B>] [ <B>-W </B><I>seconds</I><B> </B>] [ <B>--</B><I>name</I><B>=</B><I>value</I><B> </B>] <A NAME="lbAD">&nbsp;</A> <H2>DESCRIPTION </H2> <P> <B>postgres</B> PostgreSQL postmaster <P> <BR>&nbsp;&nbsp;<B><A HREF="/manpages-zh/index.html?1+postmaster">postmaster</A></B>(1)&nbsp;&nbsp;postgres&nbsp;&nbsp;&nbsp;postmaster&nbsp;&nbsp;&nbsp;postgres&nbsp;&nbsp;&nbsp;&nbsp;initdb&nbsp;&nbsp; <P> <BR>&nbsp;&nbsp;shell&nbsp;&nbsp;&nbsp;&nbsp; <P> <BR>&nbsp;&nbsp;ID&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;ID&nbsp;&nbsp;1&nbsp; <A NAME="lbAE">&nbsp;</A> <H2>OPTIONS </H2> <P> <BR>&nbsp;&nbsp;<B>postgres</B>&nbsp;&nbsp;<B><A HREF="/manpages-zh/index.html?1+postmaster">postmaster</A></B>(1)&nbsp;&nbsp;&nbsp;<B>postgres</B>&nbsp;&nbsp;-o&nbsp;&nbsp;<B><A HREF="/cgi-bin/man/man2html?1+postmaster">postmaster</A></B>(1)&nbsp; <P> <BR>&nbsp;&nbsp;Section&nbsp;16.4&nbsp;&nbsp;&nbsp;&nbsp;<B>PGOPTIONS</B>&nbsp;&nbsp;&nbsp;libpq&nbsp;&nbsp;&nbsp;postgres&nbsp; <A NAME="lbAF">&nbsp;</A> <H3>GENERAL PURPOSE </H3> <P> <B>-A</B>, <B>-B</B>, <B>-c</B>, <B>-d</B>, <B>-D</B>, <B>-F</B>, <B>--</B><I>name</I><B></B> <B><A HREF="/manpages-zh/index.html?1+postmaster">postmaster</A></B>(1) -d 0 <B><A HREF="/cgi-bin/man/man2html?1+postmaster">postmaster</A></B>(1) postgres <DL COMPACT> <DT><B>-e</B><DD> <BR>&nbsp;&nbsp;&quot;European&quot;&quot;DMY&quot;&nbsp;&nbsp;&nbsp;Section&nbsp;8.5&nbsp;``Date/Time&nbsp;Types''&nbsp; <DT><B>-o </B><I>filename</I><B></B><DD> <BR>&nbsp;&nbsp;filename&nbsp;&nbsp;postmaster&nbsp;&nbsp;postmaster&nbsp;stderr <DT><B>-P</B><DD> <BR>&nbsp;//&nbsp;REINDEX&nbsp; <DT><B>-s</B><DD> <BR>&nbsp;&nbsp; <DT><B>-S </B><I>sort-mem</I><B></B><DD> <BR>&nbsp;&nbsp;&nbsp;KB&nbsp;&nbsp;1024&nbsp;KB&nbsp;/&nbsp;&nbsp;<I>sort-mem</I>&nbsp;&nbsp;KB </DL> <A NAME="lbAG">&nbsp;</A> <H3>OPTIONS FOR STAND-ALONE MODE </H3> <DL COMPACT> <DT><B></B><I>database</I><B></B><DD> <BR>&nbsp; <DT><B>-E</B><DD> <BR>&nbsp; <DT><B>-N</B><DD> <BR>&nbsp; </DL> <A NAME="lbAH">&nbsp;</A> <H3>SEMI-INTERNAL OPTIONS </H3> <P> <BR>&nbsp;&nbsp;&nbsp;PostgreSQL&nbsp;&nbsp;&nbsp; <DL COMPACT> <DT><B>-f { s | i | m | n | h }</B><DD> <BR>&nbsp;&nbsp;s&nbsp;&nbsp;i&nbsp;&nbsp;&nbsp;nm&nbsp;h&nbsp;&nbsp;merge <P> <DL COMPACT><DT><DD> <B>Note:</B> : -fs -fn </DL> <P> <DT><B>-O</B><DD> <BR>&nbsp;&nbsp;<B>initdb</B> <DT><B>-p </B><I>database</I><B></B><DD> <BR>&nbsp;&nbsp;postmaster&nbsp; <DT><B>-t pa[rser] | pl[anner] | e[xecutor]</B><DD> <BR>&nbsp;&nbsp;&nbsp;-s <DT><B>-v </B><I>protocol</I><B></B><DD> <BR>&nbsp;/ <DT><B>-W </B><I>seconds</I><B></B><DD> <BR>&nbsp;&nbsp; <DT><B>--describe-config</B><DD> <BR>&nbsp;&nbsp;tab&nbsp;&nbsp;COPY&nbsp;&nbsp; </DL> <A NAME="lbAI">&nbsp;</A> <H2>ENVIRONMENT </H2> <DL COMPACT> <DT><B>PGDATA</B><DD> <BR>&nbsp; </DL> <P> <BR>&nbsp;&nbsp;<B><A HREF="/manpages-zh/index.html?1+postmaster">postmaster</A></B>(1). <P> <A NAME="lbAJ">&nbsp;</A> <H2>NOTES </H2> <P> <BR>&nbsp;&nbsp;SIGINT&nbsp;&nbsp;postgres&nbsp; <P> <BR>&nbsp;&nbsp;postgres&nbsp;&nbsp;&nbsp;SIGHUP&nbsp;&nbsp;&nbsp;postmaster&nbsp;&nbsp;SIGHUP&nbsp;postmaster&nbsp;&nbsp;SIGHUP&nbsp;&nbsp;&nbsp;postgres&nbsp; <P> <B>postmaster</B> SIGTERM postgres SIGQUIT postgres SIGKILL : postmaster postgres postgres <A NAME="lbAK">&nbsp;</A> <H2>USAGE </H2> <P> <BR>&nbsp; <P> <PRE> <B>postgres -D /usr/local/pgsql/data </B><I>other-options</I><B> my_database</B> </PRE> <BR>&nbsp;&nbsp;-D&nbsp;&nbsp;&nbsp;PGDATA&nbsp;&nbsp; <P> <BR>&nbsp;&nbsp;&nbsp;<B><A HREF="/manpages-zh/index.html?1+psql">psql</A></B>(1)&nbsp;&nbsp; <P> <BR>&nbsp;&nbsp;-N&nbsp;&nbsp;EOF&nbsp;- <P> <BR>&nbsp;EOF&nbsp;(&nbsp;<B>Control</B>+<B>D</B>)&nbsp;&nbsp;-NEOF <P> <BR>&nbsp; <A NAME="lbAL">&nbsp;</A> <H2>SEE ALSO </H2> <P> <B><A HREF="/manpages-zh/index.html?1+initdb">initdb</A></B>(1), <B><A HREF="/manpages-zh/index.html?1+ipcclean">ipcclean</A></B>(1), <B><A HREF="/manpages-zh/index.html?1+postmaster">postmaster</A></B>(1) <A NAME="lbAM">&nbsp;</A> <H2></H2> <B>Postgresql </B> <B> &lt;<A HREF="mailto:laser@pgsqldb.org">laser@pgsqldb.org</A>&gt;</B> <P> <HR> <A NAME="index">&nbsp;</A><H2>Index</H2> <DL> <DT><A HREF="#lbAB">NAME</A><DD> <DT><A HREF="#lbAC">SYNOPSIS</A><DD> <DT><A HREF="#lbAD">DESCRIPTION </A><DD> <DT><A HREF="#lbAE">OPTIONS </A><DD> <DL> <DT><A HREF="#lbAF">GENERAL PURPOSE </A><DD> <DT><A HREF="#lbAG">OPTIONS FOR STAND-ALONE MODE </A><DD> <DT><A HREF="#lbAH">SEMI-INTERNAL OPTIONS </A><DD> </DL> <DT><A HREF="#lbAI">ENVIRONMENT </A><DD> <DT><A HREF="#lbAJ">NOTES </A><DD> <DT><A HREF="#lbAK">USAGE </A><DD> <DT><A HREF="#lbAL">SEE ALSO </A><DD> <DT><A HREF="#lbAM"></A><DD> </DL> <HR> This document was created by <A HREF="/manpages-zh/index.html">man2html</A>, using the manual pages.<BR> Time: 13:12:03 GMT, December 24, 2015 </div></div> </body> </HTML>
Source Directory Layout ==================== - `common` - Modules that are used in both the main process and the renderer process. - `main` - Modules that are only used in the main process (AKA the browser process). - `renderer` - Modules that are only used in the renderer process.
/** * This is a script for testing the performance of the NLI iiif server. * Just add http addresses to the `testImages` variable and it will test * the response and provide timing info in the output. */ 'use strict' const assert = require('assert') const url = require('url') const http = require('http') const https = require('https') const <API key> = 30 * 1000 const NS_PER_SEC = 1e9 const MS_PER_NS = 1e6 /** * Creates a request and collects HTTP timings * @function request * @param {Object} options * @param {String} [options.method='GET'] * @param {String} options.protocol * @param {String} options.hostname * @param {Number} [options.port] * @param {String} [options.path] * @param {Object} [options.headers={}] * @param {String} [options.body] * @param {Function} callback */ function request ({ method = 'GET', protocol, hostname, port, path, headers = {}, body } = {}, callback) { // Validation assert(protocol, 'options.protocol is required') assert(['http:', 'https:'].includes(protocol), 'options.protocol must be one of: "http:", "https:"') assert(hostname, 'options.hostname is required') assert(callback, 'callback is required') // Initialization const eventTimes = { // use process.hrtime() as it's not a subject of clock drift startAt: process.hrtime(), dnsLookupAt: undefined, tcpConnectionAt: undefined, tlsHandshakeAt: undefined, firstByteAt: undefined, endAt: undefined } // Making request const req = (protocol.startsWith('https') ? https : http).request({ protocol, method, hostname, port, path, headers }, (res) => { let responseBody = '' req.setTimeout(<API key>) // Response events res.once('readable', () => { eventTimes.firstByteAt = process.hrtime() }) res.on('data', (chunk) => { responseBody += chunk }) // End event is not emitted when stream is not consumed fully // in our case we consume it see: res.on('data') res.on('end', () => { eventTimes.endAt = process.hrtime() callback(null, { headers: res.headers, timings: getTimings(eventTimes), body: responseBody }) }) }) // Request events req.on('socket', (socket) => { socket.on('lookup', () => { eventTimes.dnsLookupAt = process.hrtime() }) socket.on('connect', () => { eventTimes.tcpConnectionAt = process.hrtime() }) socket.on('secureConnect', () => { eventTimes.tlsHandshakeAt = process.hrtime() }) socket.on('timeout', () => { req.abort() const err = new Error('ETIMEDOUT') err.code = 'ETIMEDOUT' callback(err) }) }) req.on('error', callback) // Sending body if (body) { req.write(body) } req.end() } /** * Calculates HTTP timings * @function getTimings * @param {Object} eventTimes * @param {Number} eventTimes.startAt * @param {Number|undefined} eventTimes.dnsLookupAt * @param {Number} eventTimes.tcpConnectionAt * @param {Number|undefined} eventTimes.tlsHandshakeAt * @param {Number} eventTimes.firstByteAt * @param {Number} eventTimes.endAt * @return {Object} timings - { dnsLookup, tcpConnection, tlsHandshake, firstByte, contentTransfer, total } */ function getTimings (eventTimes) { return { // There is no DNS lookup with IP address dnsLookup: eventTimes.dnsLookupAt !== undefined ? <API key>(eventTimes.startAt, eventTimes.dnsLookupAt) : undefined, tcpConnection: <API key>(eventTimes.dnsLookupAt || eventTimes.startAt, eventTimes.tcpConnectionAt), // There is no TLS handshake without https tlsHandshake: eventTimes.tlsHandshakeAt !== undefined ? (<API key>(eventTimes.tcpConnectionAt, eventTimes.tlsHandshakeAt)) : undefined, firstByte: <API key>((eventTimes.tlsHandshakeAt || eventTimes.tcpConnectionAt), eventTimes.firstByteAt), contentTransfer: <API key>(eventTimes.firstByteAt, eventTimes.endAt), total: <API key>(eventTimes.startAt, eventTimes.endAt) } } /** * Get duration in milliseconds from process.hrtime() * @function <API key> * @param {Array} startTime - [seconds, nanoseconds] * @param {Array} endTime - [seconds, nanoseconds] * @return {Number} durationInMs */ function <API key> (startTime, endTime) { const secondDiff = endTime[0] - startTime[0] const nanoSecondDiff = endTime[1] - startTime[1] const diffInNanoSecond = secondDiff * NS_PER_SEC + nanoSecondDiff return diffInNanoSecond / MS_PER_NS } const testImages = [ 'http://192.114.7.208:8182/iiif/2/<API key>%<API key>.tif/full/size/0/default.jpg', ] const sizes = [ '150:', 'pct:25', 'pct:50', 'pct:100' ] // Getting timings for (const address of testImages) { for (const size of sizes) { const formattedURL = address.replace('size', size) request( Object.assign( url.parse(formattedURL), { headers: { 'User-Agent': 'Example' } } ), (err, res) => { console.log(formattedURL) console.log(err || res.timings) } ) } }
id: 140 title: HP estrena nueva tablet de 7,8 pulgadas date: 2014-03-08T06:00:00+00:00 author: ovalenzuela layout: post guid: https://ovalenzueladotcom.wordpress.com/2014/03/08/<API key> permalink: /2014/03/<API key>.html blogger_blog: - www.ovalenzuela.com blogger_author: - Andrés Barrera <API key>: - 5385094478840699438 categories: - Noticias Destacadas Constantemente vemos la llegada de nuevas tablets al mercado, aunque la mayoría de ellas pertenecen al sector de gama media, y un ejemplo perfecto de esto es la más reciente tableta de HP. La compañía no solamente estrenó los nuevos phablets Slate 6 y Slate 7 hace poco, sino que ahora ha lanzado una tablet& <div> <a href="http: </div> <img src="http://feeds.feedburner.com/~r/tecnomag/~4/tkIVmNTyPb4" height="1" width="1" />
import React from 'react'; import Icon from '../Icon'; export default class Crop54Icon extends Icon { getSVG(){return <svg xmlns="http: };
fn main() { // special case: sometimes the OpenCL library is squirreled away in C:\Windows\system32 if cfg!(windows) { println!("cargo:rustc-link-search=C:\\Windows\\system32") } }
goog.require('ngeo.filters'); describe('ngeo.Filters', () => { let $filter; beforeEach(inject((_$filter_) => { $filter = _$filter_; })); it('Ngeo Scalify', () => { const ngeoScalify = $filter('ngeoScalify'); expect(ngeoScalify(25000)).toBe('1\u00a0:\u00a025,000'); }); it('Ngeo Number format', () => { const number = $filter('ngeoNumber'); expect(number(0)).toBe('0'); expect(number(Infinity)).toBe('\u221e'); expect(number(-Infinity)).toBe('-\u221e'); expect(number(.1234)).toBe('0.123'); expect(number(1.234)).toBe('1.23'); expect(number(-1.234)).toBe('-1.23'); expect(number(12.34)).toBe('12.3'); expect(number(123.4)).toBe('123'); expect(number(1234)).toBe('1,230'); expect(number(12340)).toBe('12,300'); expect(number(.1)).toBe('0.1'); expect(number(.01)).toBe('0.01'); expect(number(1.23456789, 4)).toBe('1.235'); expect(number(1.23456789, 6)).toBe('1.23457'); }); it('Ngeo Unit Prefix', () => { const unitPrefix = $filter('ngeoUnitPrefix'); expect(unitPrefix(10)).toBe('10'); expect(unitPrefix(10, 'm')).toBe('10\u00a0m'); expect(unitPrefix(1000)).toBe('1\u00a0k'); expect(unitPrefix(1000, 'm')).toBe('1\u00a0km'); expect(unitPrefix(1000, 'm2', 'square')).toBe('1,000\u00a0m2'); expect(unitPrefix(1000000, 'm2', 'square')).toBe('1\u00a0km2'); expect(unitPrefix(1e+19, 'm')).toBe('10,000\u00a0Pm'); expect(unitPrefix(8192, 'o', 'binary')).toBe('8\u00a0Kio'); expect(unitPrefix(1123.132, 'm')).toBe('1.12\u00a0km'); expect(unitPrefix(1123.132, 'm', 'unit', 6)).toBe('1.12313\u00a0km'); }); it('Ngeo Number coordinates', () => { const <API key> = $filter('<API key>'); let co = [7.1234, 46.9876]; expect(<API key>(co)).toBe('7 47'); expect(<API key>(co, 2, 'co {x} E; {y} N')).toBe( 'co 7.12 E; 46.99 N'); co = [2600000, 1600000]; expect(<API key>(co, 0, '{x}, {y}')).toBe( '2,600,000, 1,600,000'); }); it('Ngeo DMS coordinates', () => { const ngeoDMSCoordinates = $filter('ngeoDMSCoordinates'); const co = [7.1234, 46.9876]; expect(ngeoDMSCoordinates(co)).toBe( '7\u00b0 07\u2032 24\u2033 E 46\u00b0 59\u2032 15\u2033 N'); expect(ngeoDMSCoordinates(co, 2, '[{y}; {x}]')).toBe( '[46\u00b0 59\u2032 15.36\u2033 N; 7\u00b0 07\u2032 24.24\u2033 E]'); }); });
<?php namespace AMNL\Mollie\IDeal; use AMNL\Mollie\TransactionStatus; /** * * * @author Arno Moonen <info@arnom.nl> */ class <API key> extends TransactionStatus { /** * @var \AMNL\Mollie\IDeal\Consumer */ protected $consumer; /** * * @param int $amount * @param boolean $paid * @param string $transaction_id * @param Consumer $consumer * @param string $status */ public function __construct($amount, $paid, $transaction_id, $consumer, $status) { parent::__construct($amount, $paid, $transaction_id, $status); $this->consumer = $consumer; } /** * @return Consumer */ public function getConsumer() { return $this->consumer; } }
# akka-argonaut [![Build Status](https: [![Coverage Status](https: [![Download](https: Argonaut Json `{,un}marshallers` for `akka-{stream, http}`. Also see [hseeberger/akka-http-json](https://github.com/hseeberger/akka-http-json).
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.EntityFrameworkCore; namespace NldbIdentity.Models { // Add profile data for application users by adding properties to the ApplicationUser class public class ApplicationUser : IdentityUser { } }
local mod = DBM:NewMod("Gnoll", "DBM-DMF") local L = mod:GetLocalizedStrings() mod:SetRevision(("$Revision: 17247 $"):sub(12, -3)) mod:SetZone() mod:RegisterEvents( "SPELL_AURA_APPLIED 101612", "SPELL_AURA_REMOVED 101612", "<API key> player", "UNIT_POWER_FREQUENT player" ) mod.noStatistics = true local warnGameOverQuest = mod:NewAnnounce("warnGameOverQuest", 2, 101612, nil, false) local warnGameOverNoQuest = mod:NewAnnounce("warnGameOverNoQuest", 2, 101612, nil, false) mod:AddBoolOption("warnGameOver", true, "announce") local warnGnoll = mod:NewAnnounce("warnGnoll", 2, nil, false) local specWarnHogger = mod:NewSpecialWarning("specWarnHogger") local timerGame = mod:NewBuffActiveTimer(60, 101612, nil, nil, nil, 6) local countdownGame = mod:NewCountdownFades(60, 101612) local gameEarnedPoints = 0 local gameMaxPoints = 0 function mod:SPELL_AURA_APPLIED(args) if args.spellId == 101612 and args:IsPlayer() then gameEarnedPoints = 0 gameMaxPoints = 0 timerGame:Start() countdownGame:Start(60) end end function mod:SPELL_AURA_REMOVED(args) if args.spellId == 101612 and args:IsPlayer() then timerGame:Cancel() countdownGame:Cancel() if self.Options.warnGameOver then if gameEarnedPoints > 0 then warnGameOverQuest:Show(gameEarnedPoints, gameMaxPoints) else warnGameOverNoQuest:Show(gameMaxPoints) end end end end function mod:<API key>(uId, _, _, _, spellID) if spellID == 102044 then--Hogger gameMaxPoints = gameMaxPoints + 3 if self:AntiSpam(2, 1) then specWarnHogger:Show() end elseif spellID == 102036 then--Gnoll gameMaxPoints = gameMaxPoints + 1 warnGnoll:Show() end end function mod:UNIT_POWER_FREQUENT(uId, type) if type == "ALTERNATE" then local playerPower = UnitPower("player", 10) if playerPower > gameEarnedPoints then gameEarnedPoints = playerPower end end end
body{ margin: 0; } a img{ boarder: 0px; } ::-moz-selection { background-color: #6ab344; color: #fff; } ::selection { background-color: #6ab344; color: #fff; } .bscore-mobile-title { display: none !important; } /* Site Header && Navigation */ .bscore-header .mdl-menu__container{ z-index: 50; margin: 0; } .bscore-header{ overflow: visible; background-color: black; } .bscore-header .material-icons{ color: #767777 } .bscore-header .<API key>{ color: #FFF; font-weight: 700; font-size: 14px; } .<API key> { direction: rtl; order: 1; width: 500px; transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), width 0.2s cubic-bezier(0.4, 0, 0.2, 1); } .bscore-nav { direction: ltr; justify-content: flex-end; width: 800px; } .bscore-nav .<API key> { display: inline-block; height: 60px; line-height: 68px; background-color: transparent !important; border-bottom: 4px solid transparent; } .<API key> .<API key>:hover{ border-bottom: 4px solid #FFC200; } /* Logo */ .logo-image { height: 28px; width: 140px; } .logo-font { font-family: 'Roboto', 'Helvetica', 'Arial', sans-serif; line-height: 1; color: #FFFF; text-align: center; font-weight: 500; } /* Site Content - Splash Page */ .tagline-section { position: relative; height: 800px; width: auto; background-color: #f3f3f3; background: url('images/test3.jpg') center no-repeat; background-size: cover; } .slogan { font-size: 60px; padding-top: 220px; } .sub-slogan { font-size: 21px; padding-top: 24px; } /* Card (About Us) */ .card-container { } .card-container .mdl-card__media { overflow: hidden; background: transparent; } .card-container .mdl-card__media img { width: 100%; } .card-container .mdl-card__title { background: transparent; height: auto; } .card-container .<API key> { color: black; height: auto; } .card-container .<API key> { height: auto; color: black; padding-bottom: 56px; } /* Mobile layout */ @media (max-width: 900px) { .<API key>{ display: none; } .bscore-title { display: none !important; } .bscore-mobile-title { display: block !important; position: absolute; left: calc(50% - 70px); top: 12px; transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1); }
var util = require("util"); var sst = require("sst"); var namedRegexp = require('named-regexp').named; module.exports = AdverbSM = function(){ if (!(this instanceof AdverbSM)) return new AdverbSM(); sst.call(this); }; util.inherits(AdverbSM,sst); AdverbSM.prototype.destem = function(info){ this.processDefaults(info); info.results.comparative = info.results.stem + "ius"; info.results.superlative = info.results.stem + "issime"; } AdverbSM.prototype.states = { "start" : { "next" : ["word","inflections"] }, "word-b" : { // {{la-adv|pius|pius|magis pius|piisimus|piisimus}} "type" : "word", "test" : namedRegexp(/\{\{la-adv\|[^|}\n]+\|(:<comparative>[^|}\n]+)\|(:<comparative_>[^|}\n]+)\|(:<superlative>[^|}\n]+)\|(:<superlative_>[^|}\n]+)\}\}[ \t]*(\n\s*|$)/), "defaults" : { "type" : "word", "pos" : "adverb", "comparative" : "", "superlative" : "" }, "next" : ["inflection","definition","word"] }, "word-c" : { // {{la-adv|lent||e}} "type" : "word", "test" : namedRegexp(/\{\{la-adv\|(:<stem>[^|}\n]+)\|(:<stem_>[^|}\n]*)\|(:<ending>(?:e|ē|ie|iē|er|ter|iter|im|-))\}\}[ \t]*(\n\s*|$)/), "defaults" : { "type" : "word", "pos" : "adverb", "stem" : "", "ending" : "" }, "preprocess" : AdverbSM.prototype.destem, "next" : ["inflection","definition","word"] }, "word-d" : { // {{head|la|adverb}} "type" : "word", "test" : namedRegexp(/\{\{head\|la\|adverb\}\}[ \t]*(\n\s*|$)/), "defaults" : { "type" : "word", "pos" : "adverb" }, "next" : ["inflection","definition","word"] }, "word-e" : { "type" : "word", "test" : namedRegexp(/\{\{head\|la\|adverb\|head=[^|}\n]+\}\}[ \t]*(\n\s*|$)/), "defaults" : { "type" : "word", "pos" : "adverb" }, "next" : ["inflection","definition","word"] }, "word-f" : { // '''nove''' "type" : "word", "test" : namedRegexp(/(^|\n)'''(:<word_>[^'\n]+)'''[ \t]*(\n\s*|$)/), "defaults" : { "type" : "word", "pos" : "adverb" }, "next" : ["inflection","definition","word"] }, "word-g" : { "type" : "word", "test" : namedRegexp(/\{\{la-adv\|\|(:<stem>[^|}\n]+)\|(:<ending>(?:e|ē|ie|iē|er|ter|iter|im|-))\}\}[ \t]*(\n\s*|$)/), "defaults" : { "type" : "word", "pos" : "adverb", "stem" : "", "ending" : "" }, "preprocess" : AdverbSM.prototype.destem, "next" : ["inflection","definition","word"] }, "word-h" : { "type" : "word", "test" : namedRegexp(/\{\{la-adv\|(:<word_>[^|}\n]+)\|(:<comparative>[^|}\n]+)\|\|(:<superlative>[^|}\n]+)\|(:<superlative_>[^|}\n]+)\}\}[ \t]*(\n\s*|$)/), "defaults" : { "type" : "word", "pos" : "adverb", "comparative" : "", "superlative" : "" }, "next" : ["inflection","definition","word"] }, "word-i" : { "type" : "word", "test" : namedRegexp(/\{\{la-adv\|(:<word_>[^|}\n]+)\|(:<comparative>[^|}\n]+)\|(:<comparative_>[^|}\n]+)\|(:<ending>(?:e|ē|ie|iē|er|ter|iter|im|o|ō|-))\}\}[ \t]*(\n\s*|$)/), "defaults" : { "type" : "word", "pos" : "adverb", "comparative" : "", "superlative" : "" }, "next" : ["inflection","definition","word"] }, "word-j" : { "type" : "word", "test" : namedRegexp(/\{\{head\|la\|adverb\|head=[^|}\n]+\}\} \(''Superlative'': (?:\[\[)?(:<superlative>[^\]'\)\n]+)(?:\]\])?\)[ \t]*(\n\s*|$)/), "defaults" : { "type" : "word", "pos" : "adverb", "superlative" : "" }, "next" : ["inflection","definition","word"] }, "word-k" : { // {{la-adv|cit||o}} "type" : "word", "test" : namedRegexp(/\{\{la-adv\|(:<stem>[^|}\n]+)\|(:<stem_>[^|}\n]*)\|(:<ending>(?:e|ē|ie|iē|er|ter|iter|im|o|ō|-))\}\}[ \t]*(\n\s*|$)/), "defaults" : { "type" : "word", "pos" : "adverb", "stem" : "", "ending" : "" }, "next" : ["inflection","definition","word"] }, "word-l" : { // '''quidem''' {{qualifier|postpositive}} "type" : "word", "test" : namedRegexp(/(?:^|\n)[ \t]+\{\{qualifier\|(:<qualifier>(?:postpositive))\}\}[ \t]*(\n\s*|$)/), "defaults" : { "type" : "word", "pos" : "adverb", "qualifier" : "" }, "next" : ["inflection","definition","word"] }, "word-m" : { "type" : "word", "test" : namedRegexp(/\{\{la-adv\|(:<stem>[^|}\n]+)\|(:<stem_>[^|}\n]+)\|(:<ending>(?:e|ē|ie|iē|er|ter|iter|im|o|ō|-))\}\}/), "defaults" : { "type" : "word", "pos" : "adverb", "stem" : "", "ending" : "" }, "preprocess" : AdverbSM.prototype.destem, "next" : ["inflection","definition","word"] }, "word-n" : { // {{head|la}} "type" : "word", "test" : namedRegexp(/\{\{head\|la\}\}[ \t]*(\n\s*|$)/), "defaults" : { "type" : "word", "pos" : "adverb" }, "next" : ["inflection","definition","word"] }, "word-o" : { // {{head|la|adverb|comparative|minus|superlative|minime}} "type" : "word", "test" : namedRegexp(/\{\{head\|la\|adverb\|comparative\|(:<comparative>[^|}\n]+)\|superlative\|(:<superlative>[^|}\n]+)\}\}[ \t]*(\n\s*|$)/), "defaults" : { "type" : "word", "pos" : "adverb", "comparative" : "", "superlative" : "" }, "next" : ["inflection","definition","word"] }, "word-p" : { // {{la-adv|prope|propius||proximus}} "type" : "word", "test" : namedRegexp(/\{\{la-adv\|(:<word_>[^|}\n]+)\|(:<comparative>[^|}\n]+)\|\|(:<superlative>[^|}\n]+)\}\}[ \t]*(\n\s*|$)/), "defaults" : { "type" : "word", "pos" : "adverb", "comparative" : "", "superlative" : "" }, "next" : ["inflection","definition","word"] }, "word-q" : { // '''[[quid#Latin|quid]][[ni#Latin|ni]]'''? "type" : "word", "test" : namedRegexp(/(?:^|\n)'''\[\[(:<derivedfrom>[^|}\n#]+)(?:#[^|}\n]+)?\|[^|}\n]+\]\]\[\[(:<derivedfrom2>[^|}\n#]+)(?:#[^|}\n]+)?\|[^|}\n]+\]\]'''\?[ \t]*(\n\s*|$)/), "default" : { "type" : "word", "pos" : "adverb" }, "next" : ["inflection","definition","word"] }, "inflections-a" : { // {{head|la|adverb|superlative}} "type" : "inflections", "test" : namedRegexp(/\{\{head\|la\|adverb\|(?:superlative)\}\}[ \t]*(\n\s*|$)/), "next" : ["inflection"] }, "inflection-a" : { // # {{superlative of|belle|POS=adverb|lang=la}} "type" : "inflection", "test" : namedRegexp(/^# \{\{(:<form>(?:sup))(?:erlative) of\|(:<inflectionof>[^|}\n]+)\|POS=adverb\|lang=la\}\}[ \t]*(\n\s*|$)/), "defaults" : { "type" : "inflection", "pos" : "adverb", "inflectionof" : "", "form" : "" }, "next" : ["inflection","definition","word","inflections"] }, "inflection-b" : { // # {{superlative of|prope|lang=la}} "type" : "inflection", "test" : namedRegexp(/^# \{\{(:<form>(?:sup))(?:erlative) of\|(:<inflectionof>[^|}\n]+)\|lang=la\}\}[ \t]*(\n\s*|$)/), "defaults" : { "type" : "inflection", "pos" : "adverb", "inflectionof" : "", "form" : "" }, "next" : ["inflection","definition","word","inflections"] }, "definition" : { // definition "test" : namedRegexp(/^ "next" : ["definition","word"], "preprocess" : require("./definition") } }; AdverbSM.prototype.startState = "start";
'use strict'; module.exports = function(context) { var types = Object.create(null); function markUsedIfType(ident) { if (types[ident.name]) { context.markVariableAsUsed(ident.name); types[ident.name] = null; } } function markTypeAsUsed(node) { context.markVariableAsUsed(node.id.name); } return { DeclareClass: markTypeAsUsed, DeclareModule: markTypeAsUsed, DeclareFunction: markTypeAsUsed, DeclareVariable: markTypeAsUsed, ImportDeclaration: function(node) { if (node.importKind === 'type') { for (var i = 0; i < node.specifiers.length; i++) { var specifier = node.specifiers[i]; types[specifier.local.name] = true; } } }, TypeAlias: function(node) { types[node.id.name] = true; }, <API key>: function(node) { if (node.id.type === 'Identifier') { markUsedIfType(node.id); } else if (node.id.type === '<API key>') { markUsedIfType(node.id.qualification); } } }; }; module.exports.schema = [];
The MIT License (MIT) Copyright (c) 2014 Joshua Bainbridge 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.