answer
stringlengths
15
1.25M
class <API key> < ActiveRecord::Migration[4.2] def self.up add_column :plaques, :inscription, :string end def self.down remove_column :plaques, :inscription end end
using System.Collections; using UnityEngine; public class PlusOneBallAnimator : MonoBehaviour { public float maxVisibleTime = 1.2f; public float stationaryTime = 0.5f; public float risingSpeedIncrease = 0.2f; public float alphaDecreaseSpeed = 0.05f; public UILabel label; public string textToAppend; public float scale; void Start () { if (scale > 0) { transform.localScale.Set(scale, scale, 1); } label.text += textToAppend; StartCoroutine(FloatUp()); } IEnumerator FloatUp() { float timer = 0; float risingSpeed = 0; float alpha = 1; while (timer < maxVisibleTime) { if (timer > stationaryTime) { risingSpeed += risingSpeedIncrease; alpha -= alphaDecreaseSpeed; label.color = new Color(label.color.r, label.color.g, label.color.b, alpha); } transform.Translate(0, risingSpeed * Time.deltaTime, 0); timer += Time.deltaTime; yield return null; } Destroy(gameObject); } }
# -*- coding: utf-8 -*- from .common import * class AssignmentTest(TestCase): def test_assignment(self): context = Context() root = Node.add_root() var_def = VariableDefinition(name='K1') root.add_child(content_object=var_def) root = Node.objects.get(id=root.id) assignment_node = root.add_child(content_object=Assignment()) var = Variable(definition=var_def) var_node = assignment_node.add_child(content_object=var) tree_1plus2mul3(parent=assignment_node) root = Node.objects.get(id=root.id) result = root.interpret(context) var_value = context.get_variable(var_def) self.assertEqual(7, var_value) def test_var_assignment(self): context = Context() root = Node.add_root() var_def1 = VariableDefinition(name='K1') root.add_child(content_object=var_def1) root = Node.objects.get(id=root.id) var_def2 = VariableDefinition(name='K2') root.add_child(content_object=var_def2) root = Node.objects.get(id=root.id) assignment_node = root.add_child(content_object=Assignment()) var1 = Variable(definition=var_def1) var_node = assignment_node.add_child(content_object=var1) tree_1plus2mul3(parent=assignment_node) root = Node.objects.get(id=root.id) assignment_node = root.add_child(content_object=Assignment()) var2 = Variable(definition=var_def2) var_node = assignment_node.add_child(content_object=var2) var_node = assignment_node.add_child(content_object=var1) root = Node.objects.get(id=root.id) result = root.interpret(context) var_value = context.get_variable(var_def2) self.assertEqual(7, var_value)
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" /> <meta charset="UTF-8"> <title>WebSocket</title> <script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script> <script type="text/javascript" src="client.js"></script> <script type="text/javascript"> var logcss = ["info", "warn", "debug", "error", "default"]; jQuery(function(){ var log = new LogManager('ws://127.0.0.1:1688/log', onmessage); document.title = title; }); function onmessage(obj) { if(obj.level == 0) { $("#status").css("display","none"); $("#status").text(""); }else if(obj.level == -1) { $("#status").css("display","block"); $("#status").text(obj.msg); } else { var msg = new Date(obj.time*1000).toLocaleString() + " " + obj.msg; $("#logview").append("<p><span class='"+logcss[obj.level]+"'>"+msg+"</span></p>"); $(window).scrollTop( $('#logview')[0].scrollHeight); } } </script> <style type="text/css"> body { font: normal 11px auto "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; color: #4f6b72; background: black; margin: 0px; } a { color: #c75f3e; } #mytable { width: 100%; padding: 0; margin: 0; } caption { padding: 0 0 5px 0; width: 100%; font: italic 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; text-align: right; } th { font: bold 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; color: #4f6b72; border-right: 1px solid #C1DAD7; border-bottom: 1px solid #C1DAD7; border-top: 1px solid #C1DAD7; letter-spacing: 2px; text-transform: uppercase; text-align: left; padding: 6px 6px 6px 12px; background: #CAE8EA no-repeat; } th.nobg { border-top: 0; border-left: 0; border-right: 1px solid #C1DAD7; background: none; } td { border-right: 1px solid #C1DAD7; border-bottom: 1px solid #C1DAD7; background: #fff; font-size: 11px; padding: 6px 6px 6px 12px; color: #4f6b72; } td.alt { background: #F5FAFA; color: #797268; } th.spec { border-left: 1px solid #C1DAD7; border-top: 0; background: #fff no-repeat; font: bold 10px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; } th.specalt { border-left: 1px solid #C1DAD7; border-top: 0; background: #f5fafa no-repeat; font: bold 10px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; color: #797268; } .info { color: rgba(85,85,75,1.00); } .warn { color: rgba(198,125,72, 1); } .debug { color: rgba(120,109,196,1.00); } .error { color: rgba(224,21,25,1.00); } .default { color: rgba(255,255,255,1); } </style> </head> <body> <div id="p" style="display: none;"> <textarea id="sql" rows="10" style="width:95%;">select id,datetime(time,'unixepoch','localtime') as time,sql from CallLog</textarea> <button onclick="sendMessage()" style="width: 68px;height: 36px;"></button> </div> <div id="result"> <table id="rstable" cellspacing="0"> </table> </div> <div id="status" style="background-color: #f1f1f1;width: 100%;padding: 6px 10px;color:#3eaaaf;position: fixed;bottom: 0px;"></div> <div id="logview" style="height: 100%;height: 100%;margin-left: 10px;margin-bottom: 33px;"> </div> </body> </html>
<?php namespace Oro\Bundle\ConfigBundle\Provider; use Oro\Bundle\ConfigBundle\Config\ConfigBag; use Oro\Bundle\ConfigBundle\Exception\<API key>; use Symfony\Contracts\Translation\TranslatorInterface; class GroupSearchProvider implements <API key> { /** @var ConfigBag */ private $configBag; /** @var TranslatorInterface */ private $translator; /** * @param ConfigBag $configBag * @param TranslatorInterface $translator */ public function __construct(ConfigBag $configBag, TranslatorInterface $translator) { $this->configBag = $configBag; $this->translator = $translator; } /** * {@inheritdoc} */ public function supports($name) { return $this->configBag->getGroupsNode($name) !== false; } /** * {@inheritdoc} */ public function getData($name) { $group = $this->configBag->getGroupsNode($name); if ($group === false) { throw new <API key>(sprintf('Group "%s" is not defined.', $name)); } $searchData = []; if (isset($group['title'])) { $searchData[] = $this->translator->trans($group['title']); } return $searchData; } }
#!/bin/sh # Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the # CREATE block and create them in separate commands _after_ all the INSERTs. # Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk. # The mysqldump file is traversed only once. # Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite # Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite # Thanks to and @artemyk and @gkuenning for their nice tweaks. mysqldump --compatible=ansi --<API key> --compact "$@" | \ awk ' BEGIN { FS=",$" print "PRAGMA synchronous = OFF;" print "PRAGMA journal_mode = MEMORY;" print "BEGIN TRANSACTION;" } # CREATE TRIGGER statements have funny commenting. Remember we are in trigger. /^\/\*.*CREATE.*TRIGGER/ { gsub( /^.*TRIGGER/, "CREATE TRIGGER" ) print inTrigger = 1 next } # The end of CREATE TRIGGER has a stray comment terminator /END \*\/;;/ { gsub( /\*\//, "" ); print; inTrigger = 0; next } # The rest of triggers just get passed through inTrigger != 0 { print; next } # Skip other comments /^\/\*/ { next } # Print all `INSERT` lines. The single quotes are protected by another single quote. /INSERT/ { gsub( /\\\047/, "\047\047" ) gsub(/\\n/, "\n") gsub(/\\r/, "\r") gsub(/\\"/, "\"") gsub(/\\\\/, "\\") gsub(/\\\032/, "\032") print next } # Print the `CREATE` line as is and capture the table name. /^CREATE/ { print if ( match( $0, /\"[^\"]+/ ) ) tableName = substr( $0, RSTART+1, RLENGTH-1 ) } # Replace `FULLTEXT KEY` or any other `XXXXX KEY` except PRIMARY by `KEY` /^ [^"]+KEY/ && !/^ PRIMARY KEY/ { gsub( /.+KEY/, " KEY" ) } # Get rid of field lengths in KEY lines / KEY/ { gsub(/\([0-9]+\)/, "") } # Print all fields definition lines except the `KEY` lines. /^ / && !/^( KEY|\);)/ { gsub( /AUTO_INCREMENT|auto_increment/, "" ) gsub( /(CHARACTER SET|character set) [^ ]+ /, "" ) gsub( /DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP|default current_timestamp on update current_timestamp/, "" ) gsub( /(COLLATE|collate) [^ ]+ /, "" ) gsub(/(ENUM|enum)[^)]+\)/, "text ") gsub(/(SET|set)\([^)]+\)/, "text ") gsub(/UNSIGNED|unsigned/, "") if (prev) print prev "," prev = $1 } # `KEY` lines are extracted from the `CREATE` block and stored in array for later print # in a separate `CREATE KEY` command. The index name is prefixed by the table name to # avoid a sqlite error for duplicate index name. /^( KEY|\);)/ { if (prev) print prev prev="" if ($0 == ");"){ print } else { if ( match( $0, /\"[^"]+/ ) ) indexName = substr( $0, RSTART+1, RLENGTH-1 ) if ( match( $0, /\([^()]+/ ) ) indexKey = substr( $0, RSTART+1, RLENGTH-1 ) key[tableName]=key[tableName] "CREATE INDEX \"" tableName "_" indexName "\" ON \"" tableName "\" (" indexKey ");\n" } } # Print all `KEY` creation lines. END { for (table in key) printf key[table] print "END TRANSACTION;" } ' exit 0
'use strict'; angular .module('alterbooks.filters') // V/X check marks .filter('checkmark', function () { return function (input) { return input ? '\u2713' : '\u2718'; }; }) ;
<?php namespace TreeSoft\Specifications\Transforming\Transformers\SimpleType\Casters; /** * @author Sergei Melnikov <me@rnr.name> */ abstract class AbstractCaster { /** * @var string */ private $fromType; /** * @param mixed $value * * @return mixed */ abstract public function cast($value); /** * @return string */ public function getFromType(): string { return $this->fromType; } /** * @param string $fromType * * @return $this */ public function setFromType(string $fromType) { $this->fromType = $fromType; return $this; } }
import { browser, element, by } from 'protractor/globals'; export class QueueTicketWebPage { navigateTo() { return browser.get('/'); } getHeaderText() { return element(by.css('app-root h1')).getText(); } }
using System; using System.Collections.Generic; using System.Linq; namespace VioletGrass.ProjectModel.ChangeOrders { <summary> Change Order to delete an organization member. </summary> public class <API key> : ChangeOrderBase<Owner> { private string _personName; private bool <API key>; <summary> Creates a new change order. </summary> <param name="personName">The name of the person.</param> <param name="<API key>">Indicator if the person should maintain his access rights in the projects.</param> <param name="userName">The name of the person who issued this change</param> public <API key>(string personName, bool <API key>, string userName) : base(userName) { _personName = personName; <API key> = <API key>; } <summary> Apply Method. </summary> <param name="original">The original owner.</param> <returns>The modified owner.</returns> public override Owner Apply(Owner original) { var organization = original as Organization; if (organization == null) { throw new ArgumentException("original cannot be null or a non-organization"); } if (!<API key>.IsUser<API key>(UserName, organization)) { throw new <API key>("UserName is not authorized on owner to add organization member."); } var <API key> = organization.Members.RemoveAll(m => m.PersonName == _personName); IEnumerable<Project> newProjects = organization.Projects; if (!<API key>) { newProjects = newProjects.Select(p => p.WithCollaborators(p.Collaborators.RemoveAll(m => m.PersonName == _personName))); } return organization .WithMembers(<API key>) .WithProjects(newProjects); } } }
# -*- coding: utf-8 -*- from . import exceptions from clare import common from clare.common import messaging from clare.common import retry class NopHandler(messaging.consumer.interfaces.IHandler): def handle(self, record): pass def __repr__(self): repr_ = '{}()' return repr_.format(self.__class__.__name__) class <API key>(messaging.consumer.interfaces.IHandler): def __init__(self, handler, logger): self._handler = handler self._logger = logger def handle(self, record): try: self._handler.handle(record=record) except (exceptions.RoomExpired, retry.exceptions.MaximumRetry) as e: message = common.logging.utilities.format_exception(e=e) self._logger.debug(msg=message) def __repr__(self): repr_ = '{}(handler={}, logger={})' return repr_.format(self.__class__.__name__, self._handler, self._logger)
<!DOCTYPE HTML PUBLIC "- <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.6.0_27) on Thu Jan 23 20:12:12 EST 2014 --> <meta http-equiv="Content-Type" content="text/html" charset="utf-8"> <title>Uses of Class org.apache.lucene.analysis.core.StopAnalyzer (Lucene 4.6.1 API)</title> <meta name="date" content="2014-01-23"> <link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><! if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class org.apache.lucene.analysis.core.StopAnalyzer (Lucene 4.6.1 API)"; } </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <div class="topNav"><a name="navbar_top"> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../org/apache/lucene/analysis/core/StopAnalyzer.html" title="class in org.apache.lucene.analysis.core">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>PREV</li> <li>NEXT</li> </ul> <ul class="navList"> <li><a href="../../../../../../index.html?org/apache/lucene/analysis/core//<API key>.html" target="_top">FRAMES</a></li> <li><a href="StopAnalyzer.html" target="_top">NO FRAMES</a></li> </ul> <ul class="navList" id="<API key>"> <li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><! allClassesLink = document.getElementById("<API key>"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } </script> </div> <a name="skip-navbar_top"> </a></div> <div class="header"> <h2 title="Uses of Class org.apache.lucene.analysis.core.StopAnalyzer" class="title">Uses of Class<br>org.apache.lucene.analysis.core.StopAnalyzer</h2> </div> <div class="classUseContainer">No usage of org.apache.lucene.analysis.core.StopAnalyzer</div> <div class="bottomNav"><a name="navbar_bottom"> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="<API key>"> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../org/apache/lucene/analysis/core/StopAnalyzer.html" title="class in org.apache.lucene.analysis.core">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>PREV</li> <li>NEXT</li> </ul> <ul class="navList"> <li><a href="../../../../../../index.html?org/apache/lucene/analysis/core//<API key>.html" target="_top">FRAMES</a></li> <li><a href="StopAnalyzer.html" target="_top">NO FRAMES</a></li> </ul> <ul class="navList" id="<API key>"> <li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><! allClassesLink = document.getElementById("<API key>"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } </script> </div> <a name="skip-navbar_bottom"> </a></div> <p class="legalCopy"><small> <i>Copyright &copy; 2000-2014 Apache Software Foundation. All Rights Reserved.</i> <script src='../../../../../../prettify.js' type='text/javascript'></script> <script type='text/javascript'> (function(){ var oldonload = window.onload; if (typeof oldonload != 'function') { window.onload = prettyPrint; } else { window.onload = function() { oldonload(); prettyPrint(); } } })(); </script> </small></p> </body> </html>
import <API key> from '../../src/utils/<API key>'; import { JA_PUNC, EN_PUNC } from '../helpers/conversionTables'; describe('<API key>', () => { it('sane defaults', () => { expect(<API key>()).toBe(false); expect(<API key>('')).toBe(false); }); it('passes parameter tests', () => { expect(EN_PUNC.every((char) => <API key>(char))).toBe(true); expect(JA_PUNC.every((char) => <API key>(char))).toBe(false); expect(<API key>(' ')).toBe(true); expect(<API key>('a')).toBe(false); expect(<API key>('')).toBe(false); expect(<API key>('')).toBe(false); }); });
var tape = require('../'); var tap = require('tap'); tap.test('only twice error', function (assert) { var test = tape.createHarness({ exit: false }); test.only("first only", function (t) { t.end(); }); assert.throws(function () { test.only('second only', function (t) { t.end(); }); }, { name: 'Error', message: 'there can only be one only test' }); assert.end(); });
export { default } from 'ember-semantic-ui/components/ui-form-input';
"""Convenient parallelization of higher order functions. This module provides two helper functions, with appropriate fallbacks on Python 2 and on systems lacking support for synchronization mechanisms: - map_multiprocess - map_multithread These helpers work like Python 3's map, with two differences: - They don't guarantee the order of processing of the elements of the iterable. - The underlying process/thread pools chop the iterable into a number of chunks, so that for very long iterables using a large value for chunksize can make the job complete much faster than using the default value of 1. """ __all__ = ['map_multiprocess', 'map_multithread'] from contextlib import contextmanager from multiprocessing import Pool as ProcessPool from multiprocessing.dummy import Pool as ThreadPool from pip._vendor.requests.adapters import DEFAULT_POOLSIZE from pip._internal.utils.typing import MYPY_CHECK_RUNNING if MYPY_CHECK_RUNNING: from multiprocessing import pool from typing import Callable, Iterable, Iterator, TypeVar, Union Pool = Union[pool.Pool, pool.ThreadPool] S = TypeVar('S') T = TypeVar('T') # On platforms without sem_open, multiprocessing[.dummy] Pool # cannot be created. try: import multiprocessing.synchronize # noqa except ImportError: LACK_SEM_OPEN = True else: LACK_SEM_OPEN = False # Incredibly large timeout to work around bpo-8296 on Python 2. TIMEOUT = 2000000 @contextmanager def closing(pool): # type: (Pool) -> Iterator[Pool] """Return a context manager making sure the pool closes properly.""" try: yield pool finally: # For Pool.imap*, close and join are needed # for the returned iterator to begin yielding. pool.close() pool.join() pool.terminate() def _map_fallback(func, iterable, chunksize=1): # type: (Callable[[S], T], Iterable[S], int) -> Iterator[T] """Make an iterator applying func to each element in iterable. This function is the sequential fallback either on Python 2 where Pool.imap* doesn't react to KeyboardInterrupt or when sem_open is unavailable. """ return map(func, iterable) def _map_multiprocess(func, iterable, chunksize=1): # type: (Callable[[S], T], Iterable[S], int) -> Iterator[T] """Chop iterable into chunks and submit them to a process pool. For very long iterables using a large value for chunksize can make the job complete much faster than using the default value of 1. Return an unordered iterator of the results. """ with closing(ProcessPool()) as pool: return pool.imap_unordered(func, iterable, chunksize) def _map_multithread(func, iterable, chunksize=1): # type: (Callable[[S], T], Iterable[S], int) -> Iterator[T] """Chop iterable into chunks and submit them to a thread pool. For very long iterables using a large value for chunksize can make the job complete much faster than using the default value of 1. Return an unordered iterator of the results. """ with closing(ThreadPool(DEFAULT_POOLSIZE)) as pool: return pool.imap_unordered(func, iterable, chunksize) if LACK_SEM_OPEN: map_multiprocess = map_multithread = _map_fallback else: map_multiprocess = _map_multiprocess map_multithread = _map_multithread
<div class="post-header"> <div id="post-meta"> <h2>{{post.title}}</h2> <div class="second-row"> {% if post.tags|not-empty %} <div id="post-tags"> {% for tag in post.tags %} <a class="tag" href="{{tag.uri}}">{{tag.name}}</a> {% endfor %} </div> {% endif %} <div class="date">{{post.date|date:longDate}}</div> </div> </div> </div> {% if post.toc %}<div class="toc">{{post.toc|safe}}{% endif %}</div> <article>{{post.content|safe}}</article>
<?php defined('BASEPATH') OR exit('No direct script access allowed'); class User_model extends CI_Model { private $passed_data_key = array( 'username', 'first_name', 'last_name', 'address', ); public function update_userdata() { $new_user_data = array(); // Na podstaiwe tablicy passed_data_key pobieramy te dane z tablicy POST // i wstawiamy do naszej tablicy foreach ($this->passed_data_key as $key) { if ($this->input->post($key) != NULL) { $new_user_data[$key] = $this->input->post($key); } } if ($this->input->post('password') != NULL) { $new_user_data['password'] = md5($this->input->post('password')); } // Uaktualniamy dane w bazie danych na podstawie user_id z sesji $this->db->where('user_id', $this->session_get_user_id()); $result = $this->db->update('users', $new_user_data); if ($result) { $result = $result && $this->session_update(); } return $result; } public function get_userdata() { $user_id = $this->session_get_user_id(); if (isset($user_id)) { $query = $this->db->get_where('users', array('user_id' => $user_id)); if ($query->num_rows() > 0) { // Zwracamy obiekt z danymi: return $query->row(); } else { return NULL; } } return NULL; } public function delete_user() { $result = $this->db->delete('users', array('user_id' => $this->session_get_user_id())); if ($result) { $this->session_log_out(); } return $result; } public function look_for_the_same($data, $type) { $query = $this->db->get_where('users', array($type => $data)); if ($query->num_rows() > 0) { return TRUE; } else { return FALSE; } } public function create_user() { // Tablica z danymi przekazanymi przez formularz $new_user_data = array( 'username' => $this->input->post('username'), 'first_name' => $this->input->post('first_name'), 'last_name' => $this->input->post('last_name'), 'address' => $this->input->post('address'), 'password' => md5($this->input->post('password')), ); $query = $this->db->insert('users', $new_user_data); return $query; } public function check_password($password = '', $user_id = '', $username = '') { if ($password === '') { $password = $this->input->post('password'); } if ($user_id === '' && $username === '') { $user_id = $this->session_get_user_id(); $query = $this->db->get_where('users', array('user_id' => $user_id, 'password' => md5($password))); } else { if ($user_id !== '') { $query = $this->db->get_where('users', array('user_id' => $user_id, 'password' => md5($password))); } else { $query = $this->db->get_where('users', array('username' => $username, 'password' => md5($password))); } } if ($query->num_rows() > 0) { return TRUE; } else { return FALSE; } } public function log_in() { // Pobieramy potrzebne dane $user_data = array( 'username' => $this->input->post('username'), 'password' => md5($this->input->post('password')), ); // Pobieramy dane $query = $this->db->get_where('users', $user_data); if ($query->num_rows() > 0) { $row = $query->row(); $this->session_log_in($row->user_id, $row->username); return TRUE; } else { return FALSE; } } private function session_log_in($user_id, $username) { // Ustawiamy zmienne sesji $_SESSION['user_id'] = $user_id; $_SESSION['username'] = $username; $_SESSION['is_logged_in'] = 1; } /* * Wylogowywanie; usuwa odpowiednie dane z sesji */ public function session_log_out() { if (isset($_SESSION['user_id'])) { unset($_SESSION['user_id']); } if (isset($_SESSION['username'])) { unset($_SESSION['username']); } if (isset($_SESSION['is_logged_in'])) { $_SESSION['is_logged_in'] = 0; } } public function session_is_logged() { if (isset($_SESSION['is_logged_in'])) { if ($_SESSION['is_logged_in'] == 1) { return TRUE; } } return FALSE; } public function <API key>() { if (isset($_SESSION['is_logged_in']) && isset($_SESSION['username'])) { return $_SESSION['username']; } return NULL; } public function session_get_user_id() { if (isset($_SESSION['is_logged_in']) && isset($_SESSION['user_id'])) { return $_SESSION['user_id']; } return NULL; } public function session_update() { if ( ! $this->session_is_logged()) { return FALSE; } $query = $this->db->get_where('users', array('user_id' => $this->session_get_user_id())); if ($query->num_rows() > 0) { $row = $query->row(); // Uaktualniamy odpowiednie dane $_SESSION['username'] = $row->username; return TRUE; } else { return FALSE; } } }
#import <ForgeCore/ForgeCore.h> @interface <API key> : ForgeEventListener // You should not need to edit this file. @end
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Home</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif] <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Home</h1> <h3>penguinator 3.8.1</h3> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AnnHelper.html">AnnHelper</a></li><li><a href="Annotator.html">Annotator</a></li><li><a href="AnnTool.html">AnnTool</a></li><li><a href="CanvasHelper.html">CanvasHelper</a></li><li><a href="EditTool.html">EditTool</a></li><li><a href="Feature.html">Feature</a></li><li><a href="LineAnn.html">LineAnn</a></li><li><a href="PanTool.html">PanTool</a></li><li><a href="PointAnn.html">PointAnn</a></li><li><a href="PolyAnn.html">PolyAnn</a></li><li><a href="RectAnn.html">RectAnn</a></li><li><a href="SuperShape.html">SuperShape</a></li><li><a href="SuperTool.html">SuperTool</a></li></ul><h3>Global</h3><ul><li><a href="global.html#annotator">annotator</a></li><li><a href="global.html#createAnnotation">createAnnotation</a></li><li><a href="global.html#Initializer">Initializer</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Tue May 09 2017 13:21:01 GMT+0200 (Romance Daylight Time) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>
<?php namespace jdavidbakr\ProfitStars; class WSAccount { public $CustomerNumber; public $AccountType = 'Checking'; public $NameOnAccount; public $AccountName; public $AccountNumber; public $RoutingNumber; public $BillAddress1 = null; public $BillAddress2 = null; public $BillCity = null; public $BillStateRegion = null; public $BillPostalCode = null; public $BillCountry = null; public $AccountReferenceID; }
<?php class Little implements ArrayAccess { /** * The container's bindings. * * @var array */ protected $bindings = []; /** * The container's shared instances. * * @var array */ protected $instances = []; /** * Resolve the given type from the container. * * @param string $abstract * @return mixed */ public function make($abstract) { if (isset ($this->instances[$abstract])) { return $this->instances[$abstract]; } $instance = $this->build($this->getConcrete($abstract)); if ($this->isShared($abstract)) { $this->instances[$abstract] = $instance; } return $instance; } /** * Bind a type into the container. * * @param string $abstract * @param string|Closure $concrete * @param boolean $shared * @return void */ public function bind($abstract, $concrete, $shared = false) { unset ($this->instances[$abstract]); if ( ! $concrete instanceof Closure) { $concrete = function($container) use($concrete) { return $container->make($concrete); }; } $this->bindings[$abstract] = compact('concrete', 'shared'); } /** * Bind a shared type into the container. * * @param string $abstract * @param string|Closure $concrete * @return void */ public function singleton($abstract, $concrete) { $this->bind($abstract, $concrete, true); } /** * Bind an existing instance into the container. * * @param string $abstract * @param mixed $instance * @return void */ public function instance($abstract, $instance) { $this->instances[$abstract] = $instance; } /** * Wrap a closure so it is shared. * * @param Closure $closure * @return Closure */ public function share(Closure $closure) { return function($app) use($closure) { static $instance; if (is_null($instance)) { $instance = $closure($app); } return $instance; }; } /** * Determine if the given abstract type has been bound. * * @param string $abstract * @return boolean */ public function bound($abstract) { return isset ($this->bindings[$abstract]) or isset ($this->instances[$abstract]); } /** * Determine whether a given abstract type is shared. * * @param string $abstract * @return boolean */ protected function isShared($abstract) { return isset ($this->bindings[$abstract]) and ($this->bindings[$abstract]['shared'] == true); } /** * Get the concrete type for a given abstract type. * * @param string $abstract * @return mixed */ protected function getConcrete($abstract) { if (isset ($this->bindings[$abstract])) { return $this->bindings[$abstract]['concrete']; } return $abstract; } /** * Instantiate a concrete instance of the given type. * * @param string $concrete * @return mixed */ protected function build($concrete) { if ($concrete instanceof Closure) { return $concrete($this); } try { $reflector = new ReflectionClass($concrete); } catch (ReflectionException $exception) { throw new LittleException($exception->getMessage()); } if ( ! $reflector->isInstantiable()) { throw new LittleException("{$concrete} is not instantiable."); } if (is_null($constructor = $reflector->getConstructor())) { return new $concrete; } $parameters = $constructor->getParameters(); return $reflector->newInstanceArgs($this->getDependencies($parameters)); } /** * Resolve all of the given dependencies. * * @param array $parameters * @return array */ protected function getDependencies(array $parameters) { $dependencies = []; foreach ($parameters as $parameter) { // $parameter is an instance of \ReflectionParameter $dependency = $parameter->getClass(); if ($dependency instanceof ReflectionClass) { $dependencies[] = $this->make($dependency->name); continue; } $dependencies[] = $this->resolvePrimitive($parameter); } return $dependencies; } /** * Resolve a dependency of a primitive type. * * @param ReflectionParameter $parameter * @return mixed */ protected function resolvePrimitive(ReflectionParameter $parameter) { if ($parameter-><API key>()) { return $parameter->getDefaultValue(); } throw new LittleException("Unresolvable dependency {$parameter}."); } /** * Get an offset. * * @param mixed $offset * @return mixed */ public function offsetGet($offset) { return $this->make($offset); } /** * Set an offset. * * @param mixed $offset * @param mixed $value * @return void */ public function offsetSet($offset, $value) { return $this->bind($offset, $value); } /** * Determine whether an offset exists. * * @param mixed $offset * @return boolean */ public function offsetExists($offset) { return $this->bound($offset); } /** * Unset an offset. * * @param mixed $offset * @return void */ public function offsetUnset($offset) { unset ($this->instances[$offset], $this->bindings[$offset]); } } class LittleException extends Exception {}
require 'spec_helper' describe Ethon::Easy::Http do let(:easy) { Ethon::Easy.new } describe "#http_request" do let(:url) { "http://localhost:3001/" } let(:action_name) { :get } let(:options) { {} } let(:get) { double(:setup) } let(:get_class) { Ethon::Easy::Http::Get } it "instanciates action" do get.should_receive(:setup) get_class.should_receive(:new).and_return(get) easy.http_request(url, action_name, options) end context "when requesting" do [ :get, :post, :put, :delete, :head, :patch, :options ].map do |action| it "returns ok" do easy.http_request(url, action, options) easy.perform expect(easy.return_code).to be(:ok) end unless action == :head it "makes a #{action.to_s.upcase} request" do easy.http_request(url, action, options) easy.perform expect(easy.response_body).to include("\"REQUEST_METHOD\":\"#{action.to_s.upcase}\"") end end end it "makes requests with custom HTTP verbs" do easy.http_request(url, :purge, options) easy.perform expect(easy.response_body).to include(%{"REQUEST_METHOD":"PURGE"}) end end end end
<div class="td-search-box"> <button mat-icon-button type="button" class="td-search-icon" (click)="searchClicked()"> <mat-icon *ngIf="searchVisible && !alwaysVisible">{{ backIcon }}</mat-icon> <mat-icon *ngIf="!searchVisible || alwaysVisible">{{ searchIcon }}</mat-icon> </button> <td-search-input #searchInput [@inputState]="alwaysVisible || searchVisible" [debounce]="debounce" [(ngModel)]="value" [showUnderline]="showUnderline" [placeholder]="placeholder" [clearIcon]="clearIcon" (searchDebounce)="<API key>($event)" (search)="handleSearch($event)" (clear)="handleClear(); toggleVisibility()" (blur)="handleBlur()" ></td-search-input> </div>
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; namespace <API key>.Controllers { public class ValuesController : ApiController { // GET api/values public IEnumerable<string> Get() { return new string[] { "value1", "value2" }; } // GET api/values/5 public string Get(int id) { return "value"; } // POST api/values public void Post([FromBody]string value) { } // PUT api/values/5 public void Put(int id, [FromBody]string value) { } // DELETE api/values/5 public void Delete(int id) { } } }
function SlidesBox(boxNr, boxConf, parentGrid) { //Methods this.init = function () { this.jQueryElement = this.parentGrid.add_widget('<div class="displayBox ' + this.state + '" boxNr="' + this.boxNr + '">' + this.config.content + '</div>', this.positioning.sizeX, this.positioning.sizeY, this.positioning.col, this.positioning.row); } this.update = function () { var thisObj = this; this.currentSlide = this.currentSlide + 1; if (this.currentSlide >= this.slides.length) { this.currentSlide = 0; } if (this.slides[this.currentSlide].hasOwnProperty('updateFreq')) { this.updateFreq = this.slides[this.currentSlide].updateFreq; } else { this.updateFreq = config.defaults.updateFreq; } var updatedInfo = this.slides[this.currentSlide].update(); this.content = updatedInfo[0]; this.state = config.states[updatedInfo[1]]; this.jQueryElement.html(this.content); //update State config.states.map(function (state) { thisObj.jQueryElement.removeClass(state); }); this.jQueryElement.addClass(this.state); console.log('Box ' + this.boxNr + '(slides) Has been updated(slideNr:' + this.currentSlide + ')!'); } //Constructor DisplayBox.call(this, boxNr, boxConf, parentGrid); this.currentSlide = 0; this.slides = this.config.slides; this.content = this.config.content; this.type = 'slides'; }
<!DOCTYPE HTML> <html> <head> <meta charset="UTF-8"> <title>Hanoi</title> <link rel="icon" href="favicon.ico" /> <link rel="stylesheet" href="hanoi.css"> </head> <body> <div id="content"> <canvas id="canvas" width="600" height="400">Your browser does not support Canvas.</canvas> <fieldset> <label>Select Disks: </label> <select id="level"> <option value="3"> 3 </option> <option value="4" selected="selected"> 4 </option> <option value="5"> 5 </option> <option value="6"> 6 </option> <option value="7"> 7 </option> <option value="8"> 8 </option> <option value="9"> 9 </option> </select> <input id="play-button" type="button" value="Play"> <input id="watch-button" type="button" value="Watch"> </fieldset> </div> <script src="hanoi.js"> </script> </body> </html>
import { enableProdMode } from '@angular/core'; import { <API key> } from '@angular/<API key>'; import { AppModule } from './app/app.module'; import { environment } from '../environments/environment'; import 'bootstrap'; if (environment.production) { enableProdMode(); } <API key>().bootstrapModule(AppModule);
<?php include 'langsettings.php'; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http: <html> <head> <meta name="author" content="Kai Oswald Seidler, Kay Vogelgesang, Carsten Wiedmann"> <link href="xampp.css" rel="stylesheet" type="text/css"> <title> <?php echo trim(@file_get_contents('../../install/xampp_modell.txt')); ?> <?php echo trim(@file_get_contents('../../install/xampp_version.txt')); ?> </title> </head> <body> <br><h1> <?php echo trim(@file_get_contents('../../install/xampp_modell.txt')); ?> <?php echo trim(@file_get_contents('../../install/xampp_version.txt')); ?>! </h1> <b><?php echo $TEXT['start-subhead']; ?></b> <p><?php echo $TEXT['start-text1']; ?></p> <p><?php echo $TEXT['start-text2']; ?></p> <p><?php echo $TEXT['start-text3']; ?></p> <p><?php echo $TEXT['start-text4']; ?></p> <p><?php echo $TEXT['start-text5']; ?></p> <p><?php echo $TEXT['start-text6']; ?></p> </body> </html>
package twitter4jads.models.ads.sort; public enum <API key> implements SortBy { // Ascending CREATED_AT_ASC("created_at-asc"), UPDATED_AT_ASC("updated_at-asc"), DELETED_ASC("deleteda-asc"), <API key>("<API key>"), START_TIME_ASC("start_time-asc"), END_TIME_ASC("end_time-asc"), // Descending CREATED_AT_DESC("created_at-desc"), UPDATED_AT_DESC("updated_at-desc"), DELETED_DESC("deleted-desc"), <API key>("<API key>"), START_TIME_DESC("start_time-desc"), END_TIME_DESC("end_time-desc"); private final String field; <API key>(String field) { this.field = field; } @Override public String getField() { return field; } }
var sls = require('./sls'); var projectName = "project_name1"; var listLogStores = function(fn) { sls.listLogStores({ projectName: projectName }, function (err, data) { console.log(' if(err) console.error('error:',err); else{ console.log(data); fn(data); } }); }; var putLogs = function(logStoreName,fn){ var logGroup = { logs : [{ time: Math.floor(new Date().getTime()/1000), contents: [{ key: 'a', value: '1' },{ key: 'a', value: '2' },{ key: 'a', value: '3' }] }], topic: 'vv', source: '127.0.0.1' }; sls.putLogs({ projectName: projectName, logStoreName: logStoreName, logGroup: logGroup }, function (err, data) { console.log(' if(err) console.error('error:',err); else{ console.log(data); fn(data); } }); }; var listTopics = function(logStoreName, fn) { sls.listTopics({ projectName: projectName, logStoreName: logStoreName, line: 10 }, function (err, data) { console.log(' if(err) console.error('error:',err); else{ console.log(data); fn(data); } }); }; var getHistograms = function(logStoreName, topic, fn){ sls.getHistograms({ projectName: projectName, logStoreName: logStoreName, topic: topic, from: from, to: to }, function (err, data) { console.log(' if(err) console.error('error:',err); else{ console.log(data); fn(data); } }); }; var getLogs = function(logStoreName, topic, fn){ sls.getLogs({ projectName: projectName, logStoreName: logStoreName, topic: topic, from: from, to: to }, function (err, data) { console.log(' if(err) console.error('error:',err); else{ console.log(data); fn(data); } }); }; var to = Math.floor(new Date().getTime()/1000)+10; var from = to-3600; listLogStores(function(result1){ var logStoreName = result1.logstores[0]; putLogs(logStoreName, function(result2){ listTopics(logStoreName,function(result3){ var topic = result3.topics[0]; getHistograms(logStoreName,topic, function(result4){ getLogs(logStoreName,topic, function(result5){ }); }); }); }); });
article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block;} audio,canvas,video{display:inline-block;} audio:not([controls]){display:none;height:0;} [hidden]{display:none;} html{font-family:sans-serif;-<API key>:100%;-ms-text-size-adjust:100%;} body{margin:0;} a:focus{outline:thin dotted;} a:active,a:hover{outline:0;} h1{font-size:2em;margin:0.67em 0;} abbr[title]{border-bottom:1px dotted;} b,strong{font-weight:bold;} dfn{font-style:italic;} hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0;} mark{background:#ff0;color:#000;} code,kbd,pre,samp{font-family:monospace, serif;font-size:1em;} pre{white-space:pre-wrap;} q{quotes:"\201C" "\201D" "\2018" "\2019";} small{font-size:80%;} sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline;} sup{top:-0.5em;} sub{bottom:-0.25em;} img{border:0;} svg:not(:root){overflow:hidden;} figure{margin:0;} fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em;} legend{border:0;padding:0;} button,input,select,textarea{font-family:inherit;font-size:100%;margin:0;} button,input{line-height:normal;} button,select{text-transform:none;} button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer;} button[disabled],html input[disabled]{cursor:default;} input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0;} input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;} input[type="search"]::-<API key>,input[type="search"]::-<API key>{-webkit-appearance:none;} button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0;} textarea{overflow:auto;vertical-align:top;} table{border-collapse:collapse;border-spacing:0;} *,*:before,*:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;} html{font-size:62.5%;-<API key>:rgba(0, 0, 0, 0);} body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.428571429;color:#333333;background-color:#ffffff;} input,button,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit;} button,input,select[multiple],textarea{background-image:none;} a{color:#428bca;text-decoration:none;}a:hover,a:focus{color:#2a6496;text-decoration:underline;} a:focus{outline:thin dotted #333;outline:5px auto -<API key>;outline-offset:-2px;} img{vertical-align:middle;} .img-responsive{display:block;max-width:100%;height:auto;} .img-rounded{border-radius:6px;} .img-thumbnail{padding:4px;line-height:1.428571429;background-color:#ffffff;border:1px solid #dddddd;border-radius:4px;-webkit-transition:all 0.2s ease-in-out;transition:all 0.2s ease-in-out;display:inline-block;max-width:100%;height:auto;} .img-circle{border-radius:50%;} hr{margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eeeeee;} .sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0;} p{margin:0 0 10px;} .lead{margin-bottom:20px;font-size:16.099999999999998px;font-weight:200;line-height:1.4;}@media (min-width:768px){.lead{font-size:21px;}} small{font-size:85%;} cite{font-style:normal;} .text-muted{color:#999999;} .text-primary{color:#428bca;} .text-warning{color:#c09853;} .text-danger{color:#b94a48;} .text-success{color:#468847;} .text-info{color:#3a87ad;} .text-left{text-align:left;} .text-right{text-align:right;} .text-center{text-align:center;} h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:500;line-height:1.1;}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small,.h1 small,.h2 small,.h3 small,.h4 small,.h5 small,.h6 small{font-weight:normal;line-height:1;color:#999999;} h1,h2,h3{margin-top:20px;margin-bottom:10px;} h4,h5,h6{margin-top:10px;margin-bottom:10px;} h1,.h1{font-size:36px;} h2,.h2{font-size:30px;} h3,.h3{font-size:24px;} h4,.h4{font-size:18px;} h5,.h5{font-size:14px;} h6,.h6{font-size:12px;} h1 small,.h1 small{font-size:24px;} h2 small,.h2 small{font-size:18px;} h3 small,.h3 small,h4 small,.h4 small{font-size:14px;} .page-header{padding-bottom:9px;margin:40px 0 20px;border-bottom:1px solid #eeeeee;} ul,ol{margin-top:0;margin-bottom:10px;}ul ul,ol ul,ul ol,ol ol{margin-bottom:0;} .list-unstyled{padding-left:0;list-style:none;} .list-inline{padding-left:0;list-style:none;}.list-inline>li{display:inline-block;padding-left:5px;padding-right:5px;} dl{margin-bottom:20px;} dt,dd{line-height:1.428571429;} dt{font-weight:bold;} dd{margin-left:0;} @media (min-width:768px){.dl-horizontal dt{float:left;width:160px;clear:left;text-align:right;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;} .dl-horizontal dd{margin-left:180px;}.dl-horizontal dd:before,.dl-horizontal dd:after{content:" ";display:table;} .dl-horizontal dd:after{clear:both;} .dl-horizontal dd:before,.dl-horizontal dd:after{content:" ";display:table;} .dl-horizontal dd:after{clear:both;}}abbr[title],abbr[data-original-title]{cursor:help;border-bottom:1px dotted #999999;} abbr.initialism{font-size:90%;text-transform:uppercase;} blockquote{padding:10px 20px;margin:0 0 20px;border-left:5px solid #eeeeee;}blockquote p{font-size:17.5px;font-weight:300;line-height:1.25;} blockquote p:last-child{margin-bottom:0;} blockquote small{display:block;line-height:1.428571429;color:#999999;}blockquote small:before{content:'\2014 \00A0';} blockquote.pull-right{padding-right:15px;padding-left:0;border-right:5px solid #eeeeee;border-left:0;}blockquote.pull-right p,blockquote.pull-right small{text-align:right;} blockquote.pull-right small:before{content:'';} blockquote.pull-right small:after{content:'\00A0 \2014';} q:before,q:after,blockquote:before,blockquote:after{content:"";} address{display:block;margin-bottom:20px;font-style:normal;line-height:1.428571429;} fieldset{padding:0;margin:0;border:0;} legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:inherit;color:#333333;border:0;border-bottom:1px solid #e5e5e5;} label{display:inline-block;margin-bottom:5px;font-weight:bold;} input[type="search"]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;} input[type="radio"],input[type="checkbox"]{margin:4px 0 0;margin-top:1px \9;line-height:normal;} input[type="file"]{display:block;} select[multiple],select[size]{height:auto;} select optgroup{font-size:inherit;font-style:inherit;font-family:inherit;} input[type="file"]:focus,input[type="radio"]:focus,input[type="checkbox"]:focus{outline:thin dotted #333;outline:5px auto -<API key>;outline-offset:-2px;} input[type="number"]::-<API key>,input[type="number"]::-<API key>{height:auto;} .form-control:-moz-placeholder{color:#999999;} .form-control::-moz-placeholder{color:#999999;} .form-control:-<API key>{color:#999999;} .form-control::-<API key>{color:#999999;} .form-control{display:block;width:100%;height:34px;padding:6px 12px;font-size:14px;line-height:1.428571429;color:#555555;vertical-align:middle;background-color:#ffffff;border:1px solid #cccccc;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);-webkit-transition:border-color ease-in-out .15s, box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s, box-shadow ease-in-out .15s;}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6);} .form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{cursor:not-allowed;background-color:#eeeeee;} textarea.form-control{height:auto;} .form-group{margin-bottom:15px;} .radio,.checkbox{display:block;min-height:20px;margin-top:10px;margin-bottom:10px;padding-left:20px;vertical-align:middle;}.radio label,.checkbox label{display:inline;margin-bottom:0;font-weight:normal;cursor:pointer;} .radio input[type="radio"],.radio-inline input[type="radio"],.checkbox input[type="checkbox"],.checkbox-inline input[type="checkbox"]{float:left;margin-left:-20px;} .radio+.radio,.checkbox+.checkbox{margin-top:-5px;} .radio-inline,.checkbox-inline{display:inline-block;padding-left:20px;margin-bottom:0;vertical-align:middle;font-weight:normal;cursor:pointer;} .radio-inline+.radio-inline,.checkbox-inline+.checkbox-inline{margin-top:0;margin-left:10px;} input[type="radio"][disabled],input[type="checkbox"][disabled],.radio[disabled],.radio-inline[disabled],.checkbox[disabled],.checkbox-inline[disabled],fieldset[disabled] input[type="radio"],fieldset[disabled] input[type="checkbox"],fieldset[disabled] .radio,fieldset[disabled] .radio-inline,fieldset[disabled] .checkbox,fieldset[disabled] .checkbox-inline{cursor:not-allowed;} .input-sm{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px;}select.input-sm{height:30px;line-height:30px;} textarea.input-sm{height:auto;} .input-lg{height:45px;padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px;}select.input-lg{height:45px;line-height:45px;} textarea.input-lg{height:auto;} .has-warning .help-block,.has-warning .control-label{color:#c09853;} .has-warning .form-control{border-color:#c09853;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);}.has-warning .form-control:focus{border-color:#a47e3c;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #dbc59e;box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #dbc59e;} .has-warning .input-group-addon{color:#c09853;border-color:#c09853;background-color:#fcf8e3;} .has-error .help-block,.has-error .control-label{color:#b94a48;} .has-error .form-control{border-color:#b94a48;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);}.has-error .form-control:focus{border-color:#953b39;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #d59392;box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #d59392;} .has-error .input-group-addon{color:#b94a48;border-color:#b94a48;background-color:#f2dede;} .has-success .help-block,.has-success .control-label{color:#468847;} .has-success .form-control{border-color:#468847;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);}.has-success .form-control:focus{border-color:#356635;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #7aba7b;box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075),0 0 6px #7aba7b;} .has-success .input-group-addon{color:#468847;border-color:#468847;background-color:#dff0d8;} .form-control-static{margin-bottom:0;padding-top:7px;} .help-block{display:block;margin-top:5px;margin-bottom:10px;color:#737373;} @media (min-width:768px){.form-inline .form-group{display:inline-block;margin-bottom:0;vertical-align:middle;} .form-inline .form-control{display:inline-block;} .form-inline .radio,.form-inline .checkbox{display:inline-block;margin-top:0;margin-bottom:0;padding-left:0;} .form-inline .radio input[type="radio"],.form-inline .checkbox input[type="checkbox"]{float:none;margin-left:0;}} .form-horizontal .control-label,.form-horizontal .radio,.form-horizontal .checkbox,.form-horizontal .radio-inline,.form-horizontal .checkbox-inline{margin-top:0;margin-bottom:0;padding-top:7px;} .form-horizontal .form-group{margin-left:-15px;margin-right:-15px;}.form-horizontal .form-group:before,.form-horizontal .form-group:after{content:" ";display:table;} .form-horizontal .form-group:after{clear:both;} .form-horizontal .form-group:before,.form-horizontal .form-group:after{content:" ";display:table;} .form-horizontal .form-group:after{clear:both;} @media (min-width:768px){.form-horizontal .control-label{text-align:right;}} .btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:normal;line-height:1.428571429;text-align:center;vertical-align:middle;cursor:pointer;border:1px solid transparent;border-radius:4px;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;}.btn:focus{outline:thin dotted #333;outline:5px auto -<API key>;outline-offset:-2px;} .btn:hover,.btn:focus{color:#333333;text-decoration:none;} .btn:active,.btn.active{outline:0;background-image:none;-webkit-box-shadow:inset 0 3px 5px rgba(0, 0, 0, 0.125);box-shadow:inset 0 3px 5px rgba(0, 0, 0, 0.125);} .btn.disabled,.btn[disabled],fieldset[disabled] .btn{cursor:not-allowed;pointer-events:none;opacity:0.65;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none;} .btn-default{color:#333333;background-color:#ffffff;border-color:#cccccc;}.btn-default:hover,.btn-default:focus,.btn-default:active,.btn-default.active,.open .dropdown-toggle.btn-default{color:#333333;background-color:#ebebeb;border-color:#adadad;} .btn-default:active,.btn-default.active,.open .dropdown-toggle.btn-default{background-image:none;} .btn-default.disabled,.btn-default[disabled],fieldset[disabled] .btn-default,.btn-default.disabled:hover,.btn-default[disabled]:hover,fieldset[disabled] .btn-default:hover,.btn-default.disabled:focus,.btn-default[disabled]:focus,fieldset[disabled] .btn-default:focus,.btn-default.disabled:active,.btn-default[disabled]:active,fieldset[disabled] .btn-default:active,.btn-default.disabled.active,.btn-default[disabled].active,fieldset[disabled] .btn-default.active{background-color:#ffffff;border-color:#cccccc;} .btn-primary{color:#ffffff;background-color:#428bca;border-color:#357ebd;}.btn-primary:hover,.btn-primary:focus,.btn-primary:active,.btn-primary.active,.open .dropdown-toggle.btn-primary{color:#ffffff;background-color:#3276b1;border-color:#285e8e;} .btn-primary:active,.btn-primary.active,.open .dropdown-toggle.btn-primary{background-image:none;} .btn-primary.disabled,.btn-primary[disabled],fieldset[disabled] .btn-primary,.btn-primary.disabled:hover,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary:hover,.btn-primary.disabled:focus,.btn-primary[disabled]:focus,fieldset[disabled] .btn-primary:focus,.btn-primary.disabled:active,.btn-primary[disabled]:active,fieldset[disabled] .btn-primary:active,.btn-primary.disabled.active,.btn-primary[disabled].active,fieldset[disabled] .btn-primary.active{background-color:#428bca;border-color:#357ebd;} .btn-warning{color:#ffffff;background-color:#f0ad4e;border-color:#eea236;}.btn-warning:hover,.btn-warning:focus,.btn-warning:active,.btn-warning.active,.open .dropdown-toggle.btn-warning{color:#ffffff;background-color:#ed9c28;border-color:#d58512;} .btn-warning:active,.btn-warning.active,.open .dropdown-toggle.btn-warning{background-image:none;} .btn-warning.disabled,.btn-warning[disabled],fieldset[disabled] .btn-warning,.btn-warning.disabled:hover,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning:hover,.btn-warning.disabled:focus,.btn-warning[disabled]:focus,fieldset[disabled] .btn-warning:focus,.btn-warning.disabled:active,.btn-warning[disabled]:active,fieldset[disabled] .btn-warning:active,.btn-warning.disabled.active,.btn-warning[disabled].active,fieldset[disabled] .btn-warning.active{background-color:#f0ad4e;border-color:#eea236;} .btn-danger{color:#ffffff;background-color:#d9534f;border-color:#d43f3a;}.btn-danger:hover,.btn-danger:focus,.btn-danger:active,.btn-danger.active,.open .dropdown-toggle.btn-danger{color:#ffffff;background-color:#d2322d;border-color:#ac2925;} .btn-danger:active,.btn-danger.active,.open .dropdown-toggle.btn-danger{background-image:none;} .btn-danger.disabled,.btn-danger[disabled],fieldset[disabled] .btn-danger,.btn-danger.disabled:hover,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger:hover,.btn-danger.disabled:focus,.btn-danger[disabled]:focus,fieldset[disabled] .btn-danger:focus,.btn-danger.disabled:active,.btn-danger[disabled]:active,fieldset[disabled] .btn-danger:active,.btn-danger.disabled.active,.btn-danger[disabled].active,fieldset[disabled] .btn-danger.active{background-color:#d9534f;border-color:#d43f3a;} .btn-success{color:#ffffff;background-color:#5cb85c;border-color:#4cae4c;}.btn-success:hover,.btn-success:focus,.btn-success:active,.btn-success.active,.open .dropdown-toggle.btn-success{color:#ffffff;background-color:#47a447;border-color:#398439;} .btn-success:active,.btn-success.active,.open .dropdown-toggle.btn-success{background-image:none;} .btn-success.disabled,.btn-success[disabled],fieldset[disabled] .btn-success,.btn-success.disabled:hover,.btn-success[disabled]:hover,fieldset[disabled] .btn-success:hover,.btn-success.disabled:focus,.btn-success[disabled]:focus,fieldset[disabled] .btn-success:focus,.btn-success.disabled:active,.btn-success[disabled]:active,fieldset[disabled] .btn-success:active,.btn-success.disabled.active,.btn-success[disabled].active,fieldset[disabled] .btn-success.active{background-color:#5cb85c;border-color:#4cae4c;} .btn-info{color:#ffffff;background-color:#5bc0de;border-color:#46b8da;}.btn-info:hover,.btn-info:focus,.btn-info:active,.btn-info.active,.open .dropdown-toggle.btn-info{color:#ffffff;background-color:#39b3d7;border-color:#269abc;} .btn-info:active,.btn-info.active,.open .dropdown-toggle.btn-info{background-image:none;} .btn-info.disabled,.btn-info[disabled],fieldset[disabled] .btn-info,.btn-info.disabled:hover,.btn-info[disabled]:hover,fieldset[disabled] .btn-info:hover,.btn-info.disabled:focus,.btn-info[disabled]:focus,fieldset[disabled] .btn-info:focus,.btn-info.disabled:active,.btn-info[disabled]:active,fieldset[disabled] .btn-info:active,.btn-info.disabled.active,.btn-info[disabled].active,fieldset[disabled] .btn-info.active{background-color:#5bc0de;border-color:#46b8da;} .btn-link{color:#428bca;font-weight:normal;cursor:pointer;border-radius:0;}.btn-link,.btn-link:active,.btn-link[disabled],fieldset[disabled] .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none;} .btn-link,.btn-link:hover,.btn-link:focus,.btn-link:active{border-color:transparent;} .btn-link:hover,.btn-link:focus{color:#2a6496;text-decoration:underline;background-color:transparent;} .btn-link[disabled]:hover,fieldset[disabled] .btn-link:hover,.btn-link[disabled]:focus,fieldset[disabled] .btn-link:focus{color:#999999;text-decoration:none;} .btn-lg{padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px;} .btn-sm,.btn-xs{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px;} .btn-xs{padding:1px 5px;} .btn-block{display:block;width:100%;padding-left:0;padding-right:0;} .btn-block+.btn-block{margin-top:5px;} input[type="submit"].btn-block,input[type="reset"].btn-block,input[type="button"].btn-block{width:100%;} .btn-default .caret{border-top-color:#333333;} .btn-primary .caret,.btn-success .caret,.btn-warning .caret,.btn-danger .caret,.btn-info .caret{border-top-color:#fff;} .dropup .btn-default .caret{border-bottom-color:#333333;} .dropup .btn-primary .caret,.dropup .btn-success .caret,.dropup .btn-warning .caret,.dropup .btn-danger .caret,.dropup .btn-info .caret{border-bottom-color:#fff;} .btn-group,.btn-group-vertical{position:relative;display:inline-block;vertical-align:middle;}.btn-group>.btn,.btn-group-vertical>.btn{position:relative;float:left;}.btn-group>.btn:hover,.btn-group-vertical>.btn:hover,.btn-group>.btn:focus,.btn-group-vertical>.btn:focus,.btn-group>.btn:active,.btn-group-vertical>.btn:active,.btn-group>.btn.active,.btn-group-vertical>.btn.active{z-index:2;} .btn-group>.btn:focus,.btn-group-vertical>.btn:focus{outline:none;} .btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group{margin-left:-1px;} .btn-toolbar:before,.btn-toolbar:after{content:" ";display:table;} .btn-toolbar:after{clear:both;} .btn-toolbar:before,.btn-toolbar:after{content:" ";display:table;} .btn-toolbar:after{clear:both;} .btn-toolbar .btn-group{float:left;} .btn-toolbar>.btn+.btn,.btn-toolbar>.btn-group+.btn,.btn-toolbar>.btn+.btn-group,.btn-toolbar>.btn-group+.btn-group{margin-left:5px;} .btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0;} .btn-group>.btn:first-child{margin-left:0;}.btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){<API key>:0;<API key>:0;} .btn-group>.btn:last-child:not(:first-child),.btn-group>.dropdown-toggle:not(:first-child){<API key>:0;<API key>:0;} .btn-group>.btn-group{float:left;} .btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0;} .btn-group>.btn-group:first-child>.btn:last-child,.btn-group>.btn-group:first-child>.dropdown-toggle{<API key>:0;<API key>:0;} .btn-group>.btn-group:last-child>.btn:first-child{<API key>:0;<API key>:0;} .btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0;} .btn-group-xs>.btn{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px;padding:1px 5px;} .btn-group-sm>.btn{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px;} .btn-group-lg>.btn{padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px;} .btn-group>.btn+.dropdown-toggle{padding-left:8px;padding-right:8px;} .btn-group>.btn-lg+.dropdown-toggle{padding-left:12px;padding-right:12px;} .btn-group.open .dropdown-toggle{-webkit-box-shadow:inset 0 3px 5px rgba(0, 0, 0, 0.125);box-shadow:inset 0 3px 5px rgba(0, 0, 0, 0.125);} .btn .caret{margin-left:0;} .btn-lg .caret{border-width:5px 5px 0;border-bottom-width:0;} .dropup .btn-lg .caret{border-width:0 5px 5px;} .btn-group-vertical>.btn,.btn-group-vertical>.btn-group{display:block;float:none;width:100%;max-width:100%;} .btn-group-vertical>.btn-group:before,.btn-group-vertical>.btn-group:after{content:" ";display:table;} .btn-group-vertical>.btn-group:after{clear:both;} .btn-group-vertical>.btn-group:before,.btn-group-vertical>.btn-group:after{content:" ";display:table;} .btn-group-vertical>.btn-group:after{clear:both;} .btn-group-vertical>.btn-group>.btn{float:none;} .btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0;} .btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0;} .btn-group-vertical>.btn:first-child:not(:last-child){<API key>:4px;<API key>:0;<API key>:0;} .btn-group-vertical>.btn:last-child:not(:first-child){<API key>:4px;<API key>:0;<API key>:0;} .btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0;} .btn-group-vertical>.btn-group:first-child>.btn:last-child,.btn-group-vertical>.btn-group:first-child>.dropdown-toggle{<API key>:0;<API key>:0;} .btn-group-vertical>.btn-group:last-child>.btn:first-child{<API key>:0;<API key>:0;} .btn-group-justified{display:table;width:100%;table-layout:fixed;border-collapse:separate;}.btn-group-justified .btn{float:none;display:table-cell;width:1%;} [data-toggle="buttons"]>.btn>input[type="radio"],[data-toggle="buttons"]>.btn>input[type="checkbox"]{display:none;} .input-group{position:relative;display:table;border-collapse:separate;}.input-group.col{float:none;padding-left:0;padding-right:0;} .input-group .form-control{width:100%;margin-bottom:0;} .input-group-lg>.form-control,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.btn{height:45px;padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px;}select.input-group-lg>.form-control,select.input-group-lg>.input-group-addon,select.input-group-lg>.input-group-btn>.btn{height:45px;line-height:45px;} textarea.input-group-lg>.form-control,textarea.input-group-lg>.input-group-addon,textarea.input-group-lg>.input-group-btn>.btn{height:auto;} .input-group-sm>.form-control,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.btn{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px;}select.input-group-sm>.form-control,select.input-group-sm>.input-group-addon,select.input-group-sm>.input-group-btn>.btn{height:30px;line-height:30px;} textarea.input-group-sm>.form-control,textarea.input-group-sm>.input-group-addon,textarea.input-group-sm>.input-group-btn>.btn{height:auto;} .input-group-addon,.input-group-btn,.input-group .form-control{display:table-cell;}.input-group-addon:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child),.input-group .form-control:not(:first-child):not(:last-child){border-radius:0;} .input-group-addon,.input-group-btn{width:1%;white-space:nowrap;vertical-align:middle;} .input-group-addon{padding:6px 12px;font-size:14px;font-weight:normal;line-height:1;text-align:center;background-color:#eeeeee;border:1px solid #cccccc;border-radius:4px;}.input-group-addon.input-sm{padding:5px 10px;font-size:12px;border-radius:3px;} .input-group-addon.input-lg{padding:10px 16px;font-size:18px;border-radius:6px;} .input-group-addon input[type="radio"],.input-group-addon input[type="checkbox"]{margin-top:0;} .input-group .form-control:first-child,.input-group-addon:first-child,.input-group-btn:first-child>.btn,.input-group-btn:first-child>.dropdown-toggle,.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle){<API key>:0;<API key>:0;} .input-group-addon:first-child{border-right:0;} .input-group .form-control:last-child,.input-group-addon:last-child,.input-group-btn:last-child>.btn,.input-group-btn:last-child>.dropdown-toggle,.input-group-btn:first-child>.btn:not(:first-child){<API key>:0;<API key>:0;} .input-group-addon:last-child{border-left:0;} .input-group-btn{position:relative;white-space:nowrap;} .input-group-btn>.btn{position:relative;}.input-group-btn>.btn+.btn{margin-left:-4px;} .input-group-btn>.btn:hover,.input-group-btn>.btn:active{z-index:2;} .modal-open{overflow:hidden;}body.modal-open,.modal-open .navbar-fixed-top,.modal-open .navbar-fixed-bottom{margin-right:15px;} .modal{display:none;overflow:auto;overflow-y:scroll;position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;}.modal.fade .modal-dialog{-webkit-transform:translate(0, -25%);-ms-transform:translate(0, -25%);transform:translate(0, -25%);-webkit-transition:-webkit-transform 0.3s ease-out;-moz-transition:-moz-transform 0.3s ease-out;-o-transition:-o-transform 0.3s ease-out;transition:transform 0.3s ease-out;} .modal.in .modal-dialog{-webkit-transform:translate(0, 0);-ms-transform:translate(0, 0);transform:translate(0, 0);} .modal-dialog{margin-left:auto;margin-right:auto;width:auto;padding:10px;z-index:1050;} .modal-content{position:relative;background-color:#ffffff;border:1px solid #999999;border:1px solid rgba(0, 0, 0, 0.2);border-radius:6px;-webkit-box-shadow:0 3px 9px rgba(0, 0, 0, 0.5);box-shadow:0 3px 9px rgba(0, 0, 0, 0.5);background-clip:padding-box;outline:none;} .modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1030;background-color:#000000;}.modal-backdrop.fade{opacity:0;filter:alpha(opacity=0);} .modal-backdrop.in{opacity:0.5;filter:alpha(opacity=50);} .modal-header{padding:15px;border-bottom:1px solid #e5e5e5;min-height:16.428571429px;} .modal-header .close{margin-top:-2px;} .modal-title{margin:0;line-height:1.428571429;} .modal-body{position:relative;padding:20px;} .modal-footer{margin-top:15px;padding:19px 20px 20px;text-align:right;border-top:1px solid #e5e5e5;}.modal-footer:before,.modal-footer:after{content:" ";display:table;} .modal-footer:after{clear:both;} .modal-footer:before,.modal-footer:after{content:" ";display:table;} .modal-footer:after{clear:both;} .modal-footer .btn+.btn{margin-left:5px;margin-bottom:0;} .modal-footer .btn-group .btn+.btn{margin-left:-1px;} .modal-footer .btn-block+.btn-block{margin-left:0;} @media screen and (min-width:768px){.modal-dialog{left:50%;right:auto;width:600px;padding-top:30px;padding-bottom:30px;} .modal-content{-webkit-box-shadow:0 5px 15px rgba(0, 0, 0, 0.5);box-shadow:0 5px 15px rgba(0, 0, 0, 0.5);}}.clearfix:before,.clearfix:after{content:" ";display:table;} .clearfix:after{clear:both;} .pull-right{float:right !important;} .pull-left{float:left !important;} .hide{display:none !important;} .show{display:block !important;} .invisible{visibility:hidden;} .text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0;} .affix{position:fixed;} @-ms-viewport{width:device-width;}@media screen and (max-width:400px){@-ms-viewport{width:320px;}}.hidden{display:none !important;visibility:hidden !important;} .visible-xs{display:none !important;}tr.visible-xs{display:none !important;} th.visible-xs,td.visible-xs{display:none !important;} @media (max-width:767px){.visible-xs{display:block !important;}tr.visible-xs{display:table-row !important;} th.visible-xs,td.visible-xs{display:table-cell !important;}}@media (min-width:768px) and (max-width:991px){.visible-xs.visible-sm{display:block !important;}tr.visible-xs.visible-sm{display:table-row !important;} th.visible-xs.visible-sm,td.visible-xs.visible-sm{display:table-cell !important;}} @media (min-width:992px) and (max-width:1199px){.visible-xs.visible-md{display:block !important;}tr.visible-xs.visible-md{display:table-row !important;} th.visible-xs.visible-md,td.visible-xs.visible-md{display:table-cell !important;}} @media (min-width:1200px){.visible-xs.visible-lg{display:block !important;}tr.visible-xs.visible-lg{display:table-row !important;} th.visible-xs.visible-lg,td.visible-xs.visible-lg{display:table-cell !important;}} .visible-sm{display:none !important;}tr.visible-sm{display:none !important;} th.visible-sm,td.visible-sm{display:none !important;} @media (max-width:767px){.visible-sm.visible-xs{display:block !important;}tr.visible-sm.visible-xs{display:table-row !important;} th.visible-sm.visible-xs,td.visible-sm.visible-xs{display:table-cell !important;}} @media (min-width:768px) and (max-width:991px){.visible-sm{display:block !important;}tr.visible-sm{display:table-row !important;} th.visible-sm,td.visible-sm{display:table-cell !important;}}@media (min-width:992px) and (max-width:1199px){.visible-sm.visible-md{display:block !important;}tr.visible-sm.visible-md{display:table-row !important;} th.visible-sm.visible-md,td.visible-sm.visible-md{display:table-cell !important;}} @media (min-width:1200px){.visible-sm.visible-lg{display:block !important;}tr.visible-sm.visible-lg{display:table-row !important;} th.visible-sm.visible-lg,td.visible-sm.visible-lg{display:table-cell !important;}} .visible-md{display:none !important;}tr.visible-md{display:none !important;} th.visible-md,td.visible-md{display:none !important;} @media (max-width:767px){.visible-md.visible-xs{display:block !important;}tr.visible-md.visible-xs{display:table-row !important;} th.visible-md.visible-xs,td.visible-md.visible-xs{display:table-cell !important;}} @media (min-width:768px) and (max-width:991px){.visible-md.visible-sm{display:block !important;}tr.visible-md.visible-sm{display:table-row !important;} th.visible-md.visible-sm,td.visible-md.visible-sm{display:table-cell !important;}} @media (min-width:992px) and (max-width:1199px){.visible-md{display:block !important;}tr.visible-md{display:table-row !important;} th.visible-md,td.visible-md{display:table-cell !important;}}@media (min-width:1200px){.visible-md.visible-lg{display:block !important;}tr.visible-md.visible-lg{display:table-row !important;} th.visible-md.visible-lg,td.visible-md.visible-lg{display:table-cell !important;}} .visible-lg{display:none !important;}tr.visible-lg{display:none !important;} th.visible-lg,td.visible-lg{display:none !important;} @media (max-width:767px){.visible-lg.visible-xs{display:block !important;}tr.visible-lg.visible-xs{display:table-row !important;} th.visible-lg.visible-xs,td.visible-lg.visible-xs{display:table-cell !important;}} @media (min-width:768px) and (max-width:991px){.visible-lg.visible-sm{display:block !important;}tr.visible-lg.visible-sm{display:table-row !important;} th.visible-lg.visible-sm,td.visible-lg.visible-sm{display:table-cell !important;}} @media (min-width:992px) and (max-width:1199px){.visible-lg.visible-md{display:block !important;}tr.visible-lg.visible-md{display:table-row !important;} th.visible-lg.visible-md,td.visible-lg.visible-md{display:table-cell !important;}} @media (min-width:1200px){.visible-lg{display:block !important;}tr.visible-lg{display:table-row !important;} th.visible-lg,td.visible-lg{display:table-cell !important;}} .hidden-xs{display:block !important;}tr.hidden-xs{display:table-row !important;} th.hidden-xs,td.hidden-xs{display:table-cell !important;} @media (max-width:767px){.hidden-xs{display:none !important;}tr.hidden-xs{display:none !important;} th.hidden-xs,td.hidden-xs{display:none !important;}}@media (min-width:768px) and (max-width:991px){.hidden-xs.hidden-sm{display:none !important;}tr.hidden-xs.hidden-sm{display:none !important;} th.hidden-xs.hidden-sm,td.hidden-xs.hidden-sm{display:none !important;}} @media (min-width:992px) and (max-width:1199px){.hidden-xs.hidden-md{display:none !important;}tr.hidden-xs.hidden-md{display:none !important;} th.hidden-xs.hidden-md,td.hidden-xs.hidden-md{display:none !important;}} @media (min-width:1200px){.hidden-xs.hidden-lg{display:none !important;}tr.hidden-xs.hidden-lg{display:none !important;} th.hidden-xs.hidden-lg,td.hidden-xs.hidden-lg{display:none !important;}} .hidden-sm{display:block !important;}tr.hidden-sm{display:table-row !important;} th.hidden-sm,td.hidden-sm{display:table-cell !important;} @media (max-width:767px){.hidden-sm.hidden-xs{display:none !important;}tr.hidden-sm.hidden-xs{display:none !important;} th.hidden-sm.hidden-xs,td.hidden-sm.hidden-xs{display:none !important;}} @media (min-width:768px) and (max-width:991px){.hidden-sm{display:none !important;}tr.hidden-sm{display:none !important;} th.hidden-sm,td.hidden-sm{display:none !important;}}@media (min-width:992px) and (max-width:1199px){.hidden-sm.hidden-md{display:none !important;}tr.hidden-sm.hidden-md{display:none !important;} th.hidden-sm.hidden-md,td.hidden-sm.hidden-md{display:none !important;}} @media (min-width:1200px){.hidden-sm.hidden-lg{display:none !important;}tr.hidden-sm.hidden-lg{display:none !important;} th.hidden-sm.hidden-lg,td.hidden-sm.hidden-lg{display:none !important;}} .hidden-md{display:block !important;}tr.hidden-md{display:table-row !important;} th.hidden-md,td.hidden-md{display:table-cell !important;} @media (max-width:767px){.hidden-md.hidden-xs{display:none !important;}tr.hidden-md.hidden-xs{display:none !important;} th.hidden-md.hidden-xs,td.hidden-md.hidden-xs{display:none !important;}} @media (min-width:768px) and (max-width:991px){.hidden-md.hidden-sm{display:none !important;}tr.hidden-md.hidden-sm{display:none !important;} th.hidden-md.hidden-sm,td.hidden-md.hidden-sm{display:none !important;}} @media (min-width:992px) and (max-width:1199px){.hidden-md{display:none !important;}tr.hidden-md{display:none !important;} th.hidden-md,td.hidden-md{display:none !important;}}@media (min-width:1200px){.hidden-md.hidden-lg{display:none !important;}tr.hidden-md.hidden-lg{display:none !important;} th.hidden-md.hidden-lg,td.hidden-md.hidden-lg{display:none !important;}} .hidden-lg{display:block !important;}tr.hidden-lg{display:table-row !important;} th.hidden-lg,td.hidden-lg{display:table-cell !important;} @media (max-width:767px){.hidden-lg.hidden-xs{display:none !important;}tr.hidden-lg.hidden-xs{display:none !important;} th.hidden-lg.hidden-xs,td.hidden-lg.hidden-xs{display:none !important;}} @media (min-width:768px) and (max-width:991px){.hidden-lg.hidden-sm{display:none !important;}tr.hidden-lg.hidden-sm{display:none !important;} th.hidden-lg.hidden-sm,td.hidden-lg.hidden-sm{display:none !important;}} @media (min-width:992px) and (max-width:1199px){.hidden-lg.hidden-md{display:none !important;}tr.hidden-lg.hidden-md{display:none !important;} th.hidden-lg.hidden-md,td.hidden-lg.hidden-md{display:none !important;}} @media (min-width:1200px){.hidden-lg{display:none !important;}tr.hidden-lg{display:none !important;} th.hidden-lg,td.hidden-lg{display:none !important;}} .visible-print{display:none !important;}tr.visible-print{display:none !important;} th.visible-print,td.visible-print{display:none !important;} @media print{.visible-print{display:block !important;}tr.visible-print{display:table-row !important;} th.visible-print,td.visible-print{display:table-cell !important;} .hidden-print{display:none !important;}tr.hidden-print{display:none !important;} th.hidden-print,td.hidden-print{display:none !important;}}.fade{opacity:0;-webkit-transition:opacity 0.15s linear;transition:opacity 0.15s linear;}.fade.in{opacity:1;} .collapse{display:none;}.collapse.in{display:block;} .collapsing{position:relative;height:0;overflow:hidden;-webkit-transition:height 0.35s ease;transition:height 0.35s ease;}
require 'spec_helper' describe LinkShrink::JSONParser do include_examples 'shared_examples' describe '.parse_json' do it 'delegates to the JSON parser' do expect(link_shrink.parse_json(json_response)) .to eq(parsed_json) end end describe '.cleanup_json' do let(:json) { "{\n \"kind\": \"urlshortener it 'cleans JSON response' do expect(link_shrink.cleanup_json(json)) .to eq('{"kind":"urlshortener end end describe '.included' do it 'extends self' do dummy_class = Class.new do include LinkShrink::JSONParser end expect(dummy_class.included_modules).to include(LinkShrink::JSONParser) end end end
/* * lourland * texture.c */ #include <GL/gl.h> #include <string.h> #include <stdlib.h> #include <stdio.h> #include "texture.h" static void textureBind(unsigned int); void textureDraw(unsigned int id, int tw, int th, // Width & height of the texture int x, int y, // Position in the image to draw int w, int h, // Width & height of the image to draw float sx, float sy) // Screen position to draw at { float rx = (float)x / (float)tw, ry = (float)y / (float)th; float rw = (float)w / (float)tw, rh = (float)h / (float)th; glBindTexture(GL_TEXTURE_2D, id); glBegin(GL_QUADS); glTexCoord2f(rx, ry); glVertex2f(sx, sy); glTexCoord2f(rx + rw, ry); glVertex2f(sx + w, sy); glTexCoord2f(rx + rw, ry + rh); glVertex2f(sx + w, sy + h); glTexCoord2f(rx, ry + rh); glVertex2f(sx, sy + h); glEnd(); } unsigned int textureGen(int w, int h, unsigned int *data) { GLuint id; glGenTextures(1, &id); glBindTexture(GL_TEXTURE_2D, id); /* Don't interpolate when resizing */ glTexParameteri(GL_TEXTURE_2D, <API key>, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, <API key>, GL_NEAREST); /* Repeat texture */ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); /* Replace what was previously on screen */ glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)w, (GLsizei)h, 0, GL_RGBA, GL_UNSIGNED_BYTE, data); return id; }
Phoenix [![Build Status](https: ================================= A high-level build system with refreshingly straightforward syntax, designed for flexibility and portability. Simple example Assuming the `src` directory contains the source code for a C++ "Hello, world!" program, the following `Phoenixfile.phnx` will tell Phoenix how to compile it: bash $$Phoenix.checkVersion(minimum: "0.0.1"); $helloworld = CreateTarget("hello", language: "C++"); $helloworld.addSourceDirectory("src"); ## Getting started Installing Phoenix requires a limited subset of C++11, but will compile with GCC 4.6 or better. On all systems where this dependency is met, Phoenix should build and run out of the box, but it might require tweaking for OS-specific paths and locations. One-liner templates to compile Phoenix: * Any UNIX shell: `g++ $(find src -name "*.cpp") -Isrc -o <API key> -std=c++0x -O2` * Windows GCC/PowerShell: `g++ $((Get-ChildItem src -Filter *.cpp -Recurse | % { $_.FullName } | Resolve-Path -Relative) -replace '\s+', ' ').split() -Isrc -o <API key> -std=c++0x -O2` Documentation Currently, the only documentation is the [Complete Syntax and Function Reference](https://github.com/phoenix-build/phoenix/wiki/<API key>).
<title>header</title> <html> <body> <h5 style="background-color: #333;margin:0"><br></h5> <h1 style="Color:white; background-color: #333; text-align: center;margin:0"> Full Phonegap Computer Programming Course By Riley </h1> <html> <head> <style> ul { list-style-type: none; margin: 0; padding: 0; overflow: hidden; background-color: #333; } li { float: left; } li a, .dropbtn { display: inline-block; color: white; text-align: center; padding: 14px 16px; text-decoration: none; } li a:hover, .dropdown:hover .dropbtn { background-color: red; } li.dropdown { display: inline-block; } .dropdown-content { display: none; position: absolute; background-color: #f9f9f9; min-width: 160px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); z-index: 1; } .dropdown-content a { color: black; padding: 12px 16px; text-decoration: none; display: block; text-align: left; } .dropdown-content a:hover {background-color: #f1f1f1} .dropdown:hover .dropdown-content { display: block; } </style> </head> <body> <ul> <li><a href="https: <li class="dropdown"> <a href="index.html" class="dropbtn">My GitHub & C9</a> <div class="dropdown-content"> <a href="https://riley1student.github.io/pgb-cloud9/www/index.html">GitHub Website</a> <a href="https://github.com/Riley1student/pgb-cloud9">GitHub Repository</a> <a href="https://<API key>.c9users.io">Cloud 9 Home Page</a> <a href="https://ide.c9.io/riley1student/c9-kli-2017">Cloud 9 Workspace</a> <a href="https://drive.google.com/open?id=<API key>">My Notes</a> </div> </li> <li class="dropdown"> <a href="#" class="dropbtn">Term 3 Assignments</a> <div class="dropdown-content"> <a href="T3A01-Web-Riley.html">Assignment 01 - Web</a> <a href="<API key>.html">Assignment 02 - Webadvanced</a> <a href="<API key>.html">Assignment 03 - Javascript</a> <a href="T3A04-Loops-riley.html">Assignment 04 - Loops</a> <a href="T3A05-if-loop-Riley.html">Assignment 05 - if loop</a> <a href="T3A06-easy-Riley.html">Assignment 06 - Easy</a> <a href="T3A07-move-Riley.html">Assignment 07 - Move</a> <a href="<API key>.html">Assignment 08 - Javascript Research</a> <a href="T3A09-Arrays-Riley.html">Assignment 09 - Arrays</a> <a href="<API key>.html">Assignment 10 - Functions</a> <a href="T3A11-objects-Riley.html">Assignment 11 - Objects</a> <a href="<API key>.html">Assignment 12 - HackBrowser</a> <a href="#">Assignment 13 - <font color=red>Coming Soon</font></a> <!--<a href="#">Link 6</a> <a href="#">Link 7</a> <a href="#">Link 8</a> <a href="#">Link 9</a> <a href="#">Link 10</a>--> </div> </li> <li class="dropdown"> <a href="#" class="dropbtn">Term 4 Assignments</a> <div class="dropdown-content"> <a href="#"><font color=green>Term 4 Starts April 18</font></a> <!--<a href="#">Link 1</a> <a href="#">Link 2</a> <a href="#">Link 3</a> <a href="#">Link 4</a> <a href="#">Link 5</a> <a href="#">Link 6</a> <a href="#">Link 7</a> <a href="#">Link 8</a> <a href="#">Link 9</a> <a href="#">Link 10</a>--> </div> </li> <li class="dropdown"> <a href="#" class="dropbtn">Javascript Help Links</a> <div class="dropdown-content"> <a href="x03-javascript/<API key>.html">2D array* </a> <a href="x03-javascript/<API key>.html">Arrays* </a> <a href="x03-javascript/<API key>.html">Errors* </a> <a href="x03-javascript/<API key>.html">Choose adventure* </a> <a href="x03-javascript/<API key>.html">Events* </a> <a href="x03-javascript/x03-javascript-flip.html">Flip </a> <a href="x03-javascript/<API key>.html">For if else statements* </a> <a href="x03-javascript/<API key>.html">Functions * </a> <a href="x03-javascript/<API key>.html">Hack browser* </a> <a href="x03-javascript/<API key>.html">Localstorage* </a> <a href="x03-javascript/<API key>.html">Objects* </a> <a href="x03-javascript/<API key>.html">Random* </a> <a href="x03-javascript/x03-javascript-spy.html">Spy* </a> <a href="x03-javascript/<API key>.html">Strings </a> </div> </li> <li class="dropdown"> <a href="#" class="dropbtn">Help Links</a> <div class="dropdown-content"> <a href="x01-web-basics/x01-web-basics.html">x01 web basics*</a> <a href="x01-web-basics/x01-tables-lists.html">x01 tables lists*</a> <a href="x01-web-basics/x01-forms.html">x01 forms*</a> <a href="x04-css/x04-css.html"> x04 css</a> <a href="x20-animations-css/x20-animations-css.html">x20 animations css* </a> <a href="x20-animations-css/x20-advancedCSS.html">x20 advancedCSS* </a> <a href="x22-animations-SVG/x22-animations-SVG.html">x22 animations SVG* </a> <a href="x25-animations-game/x25-animations-game.html"> x25 animations game*</a> <a href="x30-3D-images/x30-3D-images.html">x30 3D images* </a> <a href="<API key>/<API key>.html">x31 3D images advanced* </a> <a href="x50-ajax-server-php/x50-ajax-server-php.html">x50 ajax server php </a> <a href="<API key>/<API key>.html ">x51 robotics spark core photon* </a> <a href="x70-phonegap-build/x70-phonegap-build.html">x70 phonegap build </a> <a href="x80-phonegap-client/x80-phonegap-client.html"> x80 phonegap client</a> <a href="x90-publishing/x90-publishing.html">x90 publishing** </a> </div> </li> <li class="dropdown"> <a href="#" class="dropbtn">Mobile Only Plugin Links</a> <div class="dropdown-content"> <a href="<API key>/<API key>.html">x02 accelerometer*</a> <a href="x10-plugin-basics/x10-plugin-basics.html"> x10 basics</a> <a href="<API key>/<API key>.html">x61 advanced file </a> <a href="<API key>/<API key>.html"> x61 advanced file NoJQuery</a> <a href="<API key>/<API key>.html">x62 advanced camera</a> <a href="<API key>/<API key>.html">x63 advanced accel </a> <a href="<API key>/<API key>.html"> x64 advanced sound*</a> <a href="<API key>/<API key>.html">x64 advanced sound poly* </a> <a href="<API key>/<API key>.html">x65 advanced splashscreen* </a> <a href="<API key>/<API key>.html">x66 advanced geolocation* </a> <a href="<API key>/<API key>.html"> x67 advanced inappbrowser*</a> </div> </li> </ul> </body> </html> <h5 style="Color:white; background-color: #333; text-align: center;margin:0"> Please note: <br>If a link has a * at the end of it, it means that the Page is working but information is in progress & is NOT ready to be marked<br> and if a link has a ** at the end of it, it means that the Page is Not Yet Working.</h5> <h5 style="background-color: #333;margin:0"><br></h5>
<?php namespace Enjoy\TaskBundle\DependencyInjection; use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\<API key>; class Configuration implements <API key> { /** * {@inheritDoc} */ public function <API key>() { $treeBuilder = new TreeBuilder(); $rootNode = $treeBuilder->root('enjoy_task'); // Here you should define the parameters that are allowed to // configure your bundle. See the documentation linked above for // more information on that topic. return $treeBuilder; } }
# -*- coding: utf-8 -*- # Purpose: Xing(pystock 0.0.4a code list import sqlite3 from pystock_xingAPI import * import pandas as pd from datetime import datetime import time from time import gmtime, strftime xing = Xing() if xing.open("demo.ebestsec.co.kr", 20001, 1, 1, "insuyu", "demo00", "") == False: print ('Connection Error! Exit') sys.exit(0) t1305Column = ['volume', 'value', 'sojinrate', 'high', 'covolume', 'l_change', 'o_diff', 'marketcap', 'low', 'h_sign', 'chdegree', 'shcode', 'o_change', 'l_diff', 'diff', 'date', 'open', 'sign', 'h_diff', 'h_change', 'ppvolume', 'l_sign', 'changerate', 'fpvolume', 'o_sign', 'change', 'close', 'diff_vol'] #conn = sqlite3.connect("XingDB.db") t8430 = conn.cursor().execute("SELECT shcode, hname, gubun, etfgubun from CODE_TB").fetchall() print ('number of codes from t8430.db : %d' % len(t8430) ) startIndex = 0 endIndex = len(t8430) for index in range(startIndex, endIndex): shcode = t8430[index][0] #shcode hname = t8430[index][1] #hname gubun = t8430[index][2] etfgubun = t8430[index][3] table_name = 'A'+shcode DBUtil.<API key>(conn.cursor(), table_name, 't1305', 't1305OutBlock1', ['date']) conn.commit() inblock_query_t1305 = { 't1305InBlock' : { 'shcode' : shcode, 'dwmcode' : 1, 'date' : None, 'idx' : None, 'cnt' : 9999 } } DB = [] count = 1 while True: t1305 = xing.query('xing.t1305', inblock_query_t1305) #DBUtil.insert_for_outblock(conn.cursor(), table_name, t1305['t1305OutBlock1'], place_flag = False) for row in t1305['t1305OutBlock1']: #print(str(count) + '. ' + str(row['date'])) DB.append([ row['volume'], row['value'], row['sojinrate'], row['high'], row['covolume'], row['l_change'], row['o_diff'], row['marketcap'], row['low'], row['h_sign'], row['chdegree'], row['shcode'], row['o_change'], row['l_diff'], row['diff'], row['date'], row['open'], row['sign'], row['h_diff'], row['h_change'], row['ppvolume'], row['l_sign'], row['changerate'], row['fpvolume'], row['o_sign'], row['change'], row['close'], row['diff_vol'] ]) count += 1 if t1305['t1305OutBlock']['idx'].strip() == '0': DB = pd.DataFrame(DB, columns=t1305Column) DB.to_csv(shcode + '.csv') print ('%s %4d %06s(%4d) - %s %s %s done' % (strftime("%H:%M:%S", time.localtime()), index, shcode, count, hname, gubun, etfgubun)) break else: inblock_query_t1305['t1305InBlock']['idx'] = t1305['t1305OutBlock']['idx'] inblock_query_t1305['continue_query'] = Trues
class User < ActiveRecord::Base devise :<API key>, :registerable, :recoverable, :rememberable, :trackable, :validatable, :omniauthable, :omniauth_providers => [:facebook] has_many :playlists belongs_to :current_playlist, :class_name => "Playlist" def <API key> new_playlist = playlists.create() self.current_playlist_id = new_playlist.id save end def remove_cart self.current_playlist_id = nil save end def self.from_omniauth(auth) where(provider: auth.provider, uid: auth.uid).first_or_create do |user| user.email = auth.info.email user.password = Devise.friendly_token[0,20] user.name = auth.info.name end end def self.new_with_session(params, session) super.tap do |user| if data = session["devise.facebook_data"] && session["devise.facebook_data"]["extra"]["raw_info"] user.email = data["email"] if user.email.blank? end end end end
<nav> <div class="main-nav"> <a href="/exercise/"><i style="display:inline;" class="material-icons md-dark">arrow_back</i></a> <h1>{{ page.title }}</h1> </div> <!-- Assign active class accordingly --> <ul class="tabs"> <li {%if page.permalink == '/exercise/walking/' %} class="active" {% endif %} ><a href="/exercise/walking/">Walking</a></li> <li {%if page.permalink == '/exercise/cardio/' %} class="active" {% endif %} ><a href="/exercise/cardio/">Cardio</a></li> <li {%if page.permalink == '/exercise/strength/' %} class="active" {% endif %} ><a href="/exercise/strength/">Strength</a></li> </ul> </nav>
package iso20022 // Choice of format for the rejection reason. type <API key> struct { // Specifies the reason why the instruction/request has a repair or rejection status. Code *<API key> `xml:"Cd"` // Specifies the reason why the instruction/request has a repair or rejection status. Proprietary *<API key> `xml:"Prtry"` } func (r *<API key>) SetCode(value string) { r.Code = (*<API key>)(&value) } func (r *<API key>) AddProprietary() *<API key> { r.Proprietary = new(<API key>) return r.Proprietary }
<?php use Kirby\Toolkit\I18n; return [ 'extends' => 'text', 'props' => [ /** * Unset inherited props */ 'converter' => null, 'counter' => null, 'spellcheck' => null, /** * Sets the HTML5 autocomplete attribute */ 'autocomplete' => function (string $autocomplete = 'url') { return $autocomplete; }, /** * Changes the link icon */ 'icon' => function (string $icon = 'url') { return $icon; }, /** * Sets custom placeholder text, when the field is empty */ 'placeholder' => function ($value = null) { return I18n::translate($value, $value) ?? 'https://example.com'; } ], 'validations' => [ 'minlength', 'maxlength', 'url' ], ];
package com.miraclewong.mwzhihudaily.view.ui.activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.widget.Button; import android.widget.LinearLayout; import com.miraclewong.mwzhihudaily.R; import butterknife.Bind; import butterknife.ButterKnife; import butterknife.OnClick; public class ShareActivity extends ActionBarActivity { @Bind(R.id.email) Button email; @Bind(R.id.sms) Button sms; @Bind(R.id.container) LinearLayout container; @OnClick(R.id.sms) public void shareWithSMS() { sendSMS("lalalal"); } @OnClick(R.id.email) public void shareWithEmail() { sendMail("lalalal"); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout_test); ButterKnife.bind(this); } public void showShareDialog(){ AlertDialog.Builder builder = new AlertDialog.Builder(ShareActivity.this); builder.setTitle(""); builder.setItems(new String[]{"","",""}, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub dialog.dismiss(); switch (which) { case 0: sendMail("http: break; case 1: sendSMS("http: break; case 3: Intent intent=new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT,""); intent.putExtra(Intent.EXTRA_TEXT, ",,~ :"+"http: intent.setFlags(Intent.<API key>); startActivity(Intent.createChooser(intent, "share")); break; default: break; } } }); builder.setNegativeButton( "" , new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.create().show(); } public void sendMail(String emailUrl){ Intent email = new Intent(android.content.Intent.ACTION_SEND); email.setType("plain/text"); String emailBody = ",,~ :" + emailUrl; email.putExtra(android.content.Intent.EXTRA_SUBJECT, ""); email.putExtra(android.content.Intent.EXTRA_TEXT, emailBody); <API key>(Intent.createChooser(email, ""), 1001); } public void sendSMS(String webUrl){ String smsBody = ",,~ :" + webUrl; Uri smsToUri = Uri.parse( "smsto:" ); Intent sendIntent = new Intent(Intent.ACTION_VIEW, smsToUri); sendIntent.putExtra("sms_body", smsBody); sendIntent.setType("vnd.android-dir/mms-sms"); <API key>(sendIntent, 1002); } }
<!DOCTYPE HTML> <html> <head> <title>Traveler - Rentals search results 4</title> <meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta name="keywords" content="Template, html, premium, themeforest" /> <meta name="description" content="Traveler - Premium template for travel companies"> <meta name="author" content="Tsoy"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- GOOGLE FONTS --> <link href='http://fonts.googleapis.com/css?family=Roboto:400,300,100,500,700' rel='stylesheet' type='text/css'> <link href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,400,300,600' rel='stylesheet' type='text/css'> <!-- /GOOGLE FONTS --> <link rel="stylesheet" href="css/bootstrap.css"> <link rel="stylesheet" href="css/font-awesome.css"> <link rel="stylesheet" href="css/icomoon.css"> <link rel="stylesheet" href="css/styles.css"> <link rel="stylesheet" href="css/mystyles.css"> <script src="js/modernizr.js"></script> </head> <body> <!-- FACEBOOK WIDGET --> <div id="fb-root"></div> <script> (function(d, s, id) { var js, fjs = d.<API key>(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script> <!-- /FACEBOOK WIDGET --> <div class="global-wrap"> <header id="main-header"> <div class="header-top"> <div class="container"> <div class="row"> <div class="col-md-3"> <a class="logo" href="index.html"> <img src="img/logo-invert.png" alt="Image Alternative text" title="Image Title" /> </a> </div> <div class="col-md-3 col-md-offset-2"> <form class="main-header-search"> <div class="form-group <API key>"> <i class="fa fa-search input-icon"></i> <input type="text" class="form-control"> </div> </form> </div> <div class="col-md-4"> <div class="top-user-area clearfix"> <ul class="top-user-area-list list list-horizontal list-border"> <li class="<API key>"> <a href="user-profile.html"> <img class="origin round" src="img/40x40.png" alt="Image Alternative text" title="AMaze" />Hi, John</a> </li> <li><a href="#">Sign Out</a> </li> <li class="nav-drop"><a href="#">USD $<i class="fa fa-angle-down"></i><i class="fa fa-angle-up"></i></a> <ul class="list nav-drop-menu"> <li><a href=" </li> <li><a href=" </li> <li><a href="#">JPY<span class="right"></span></a> </li> <li><a href="#">CAD<span class="right">$</span></a> </li> <li><a href="#">AUD<span class="right">A$</span></a> </li> </ul> </li> <li class="top-user-area-lang nav-drop"> <a href=" <img src="img/flags/32/uk.png" alt="Image Alternative text" title="Image Title" />ENG<i class="fa fa-angle-down"></i><i class="fa fa-angle-up"></i> </a> <ul class="list nav-drop-menu"> <li> <a title="German" href=" <img src="img/flags/32/de.png" alt="Image Alternative text" title="Image Title" /><span class="right">GER</span> </a> </li> <li> <a title="Japanise" href=" <img src="img/flags/32/jp.png" alt="Image Alternative text" title="Image Title" /><span class="right">JAP</span> </a> </li> <li> <a title="Italian" href=" <img src="img/flags/32/it.png" alt="Image Alternative text" title="Image Title" /><span class="right">ITA</span> </a> </li> <li> <a title="French" href=" <img src="img/flags/32/fr.png" alt="Image Alternative text" title="Image Title" /><span class="right">FRE</span> </a> </li> <li> <a title="Russian" href=" <img src="img/flags/32/ru.png" alt="Image Alternative text" title="Image Title" /><span class="right">RUS</span> </a> </li> <li> <a title="Korean" href=" <img src="img/flags/32/kr.png" alt="Image Alternative text" title="Image Title" /><span class="right">KOR</span> </a> </li> </ul> </li> </ul> </div> </div> </div> </div> </div> <div class="container"> <div class="nav"> <ul class="slimmenu" id="slimmenu"> <li><a href="index.html">Home</a> <ul> <li><a href="index.html">Default</a> </li> <li><a href="index-1.html">Layout 1</a> </li> <li><a href="index-2.html">Layout 2</a> </li> <li><a href="index-3.html">Layout 3</a> </li> <li><a href="index-4.html">Layout 4</a> </li> <li><a href="index-5.html">Layout 5</a> </li> <li><a href="index-6.html">Layout 6</a> </li> <li><a href="index-7.html">Layout 7</a> </li> </ul> </li> <li><a href="success-payment.html">Pages</a> <ul> <li><a href="success-payment.html">Success Payment</a> </li> <li><a href="user-profile.html">User Profile</a> <ul> <li><a href="user-profile.html">Overview</a> </li> <li><a href="<API key>.html">Settings</a> </li> <li><a href="user-profile-photos.html">Photos</a> </li> <li><a href="<API key>.html">Booking History</a> </li> <li><a href="user-profile-cards.html">Cards</a> </li> <li><a href="<API key>.html">Wishlist</a> </li> </ul> </li> <li><a href="blog.html">Blog</a> <ul> <li><a href="blog.html">Sidebar Right</a> </li> <li><a href="blog-sidebar-left.html">Sidebar Left</a> </li> <li><a href="blog-full-width.html">Full Width</a> </li> <li><a href="blog-post.html">Post</a> <ul> <li><a href="blog-post.html">Sidebar Right</a> </li> <li><a href="<API key>.html">Sidebar Left</a> </li> <li><a href="<API key>.html">Full Width</a> </li> </ul> </li> </ul> </li> <li><a href="404.html">404 page</a> </li> <li><a href="contact-us.html">Contact Us</a> </li> <li><a href="about.html">About</a> </li> <li><a href="login-register.html">Login/Register</a> <ul> <li><a href="login-register.html">Full Page</a> </li> <li><a href="<API key>.html">Normal</a> </li> </ul> </li> <li><a href="loading.html">Loading</a> </li> <li><a href="comming-soon.html">Comming Soon</a> </li> <li><a href="gallery.html">Gallery</a> <ul> <li><a href="gallery.html">4 Columns</a> </li> <li><a href="gallery-3-col.html">3 columns</a> </li> <li><a href="gallery-2-col.html">2 columns</a> </li> </ul> </li> <li><a href="page-full-width.html">Full Width</a> </li> <li><a href="page-sidebar-right.html">Sidebar Right</a> </li> <li><a href="page-sidebar-left.html">Sidebar Left</a> </li> </ul> </li> <li><a href="feature-typography.html">Features</a> <ul> <li><a href="feature-typography.html">Typography</a> </li> <li><a href="feature-icons.html">Icons</a> </li> <li><a href="feature-forms.html">Forms</a> </li> <li><a href="<API key>.html">Icon Effects</a> </li> <li><a href="feature-elements.html">Elements</a> </li> <li><a href="feature-grid.html">Grid</a> </li> <li><a href="feature-hovers.html">Hover effects</a> </li> <li><a href="feature-lightbox.html">Lightbox</a> </li> <li><a href="feature-media.html">Media</a> </li> </ul> </li> <li><a href="hotels.html">Hotels</a> <ul> <li><a href="hotel-details.html">Details</a> <ul> <li><a href="hotel-details.html">Layout 1</a> </li> <li><a href="hotel-details-2.html">Layout 2</a> </li> <li><a href="hotel-details-3.html">Layout 3</a> </li> <li><a href="hotel-details-4.html">Layout 4</a> </li> </ul> </li> <li><a href="hotel-payment.html">Payment</a> <ul> <li><a href="hotel-payment.html">Registered</a> </li> <li><a href="<API key>.html">Existed Cards</a> </li> <li><a href="<API key>.html">Unregistered</a> </li> </ul> </li> <li><a href="hotel-search.html">Search</a> <ul> <li><a href="hotel-search.html">Layout 1</a> </li> <li><a href="hotel-search-2.html">Layout 2</a> </li> </ul> </li> <li><a href="hotels.html">Results</a> <ul> <li><a href="hotels.html">Layout 1</a> </li> <li><a href="<API key>.html">Layout 2</a> </li> <li><a href="<API key>.html">Layout 3</a> </li> <li><a href="<API key>.html">Layout 4</a> </li> <li><a href="<API key>.html">Layout 5</a> </li> </ul> </li> </ul> </li> <li><a href="flights.html">Flights</a> <ul> <li><a href="flight-payment.html">Payment</a> <ul> <li><a href="flight-payment.html">Registered</a> </li> <li><a href="<API key>.html">Existed Cards</a> </li> <li><a href="<API key>.html">Unregistered</a> </li> </ul> </li> <li><a href="flight-search.html">Search</a> <ul> <li><a href="flight-search.html">Layout 1</a> </li> <li><a href="flight-search-2.html">Layout 2</a> </li> </ul> </li> <li><a href="flights.html">List</a> <ul> <li><a href="flights.html">Layout 1</a> </li> <li><a href="<API key>.html">Layout 2</a> </li> <li><a href="<API key>.html">Layout 3</a> </li> <li><a href="<API key>.html">Layout 4</a> </li> </ul> </li> </ul> </li> <li class="active"><a href="rentals.html">Rentals</a> <ul> <li><a href="rentals-details.html">Details</a> <ul> <li><a href="rentals-details.html">Layout 1</a> </li> <li><a href="rentals-details-2.html">Layout 2</a> </li> <li><a href="rentals-details-3.html">Layout 3</a> </li> </ul> </li> <li><a href="rental-payment.html">Payment</a> <ul> <li><a href="rental-payment.html">Registered</a> </li> <li><a href="<API key>.html">Existed Cards</a> </li> <li><a href="<API key>.html">Unregistered</a> </li> </ul> </li> <li><a href="rentals-search.html">Search</a> <ul> <li><a href="rentals-search.html">Layout 1</a> </li> <li><a href="rentals-search-2.html">Layout 2</a> </li> </ul> </li> <li class="active"><a href="rentals.html">Results</a> <ul> <li><a href="rentals.html">Layout 1</a> </li> <li><a href="<API key>.html">Layout 2</a> </li> <li><a href="<API key>.html">Layout 3</a> </li> <li class="active"><a href="<API key>.html">Layout 4</a> </li> <li><a href="<API key>.html">Layout 5</a> </li> </ul> </li> </ul> </li> <li><a href="cars.html">Cars</a> <ul> <li><a href="car-details.html">Details</a> </li> <li><a href="car-payment.html">Payment</a> <ul> <li><a href="car-payment.html">Registered</a> </li> <li><a href="<API key>.html">Existed Cards</a> </li> <li><a href="<API key>.html">Unregistered</a> </li> </ul> </li> <li><a href="car-search.html">Search</a> <ul> <li><a href="car-search.html">Layout 1</a> </li> <li><a href="car-search-2.html">Layout 2</a> </li> </ul> </li> <li><a href="cars.html">Results</a> <ul> <li><a href="cars.html">Layout 1</a> </li> <li><a href="cars-results-2.html">Layout 2</a> </li> <li><a href="cars-results-3.html">Layout 3</a> </li> <li><a href="cars-results-4.html">Layout 4</a> </li> <li><a href="cars-results-5.html">Layout 5</a> </li> </ul> </li> </ul> </li> <li><a href="activities.html">Activities</a> <ul> <li><a href="activitiy-details.html">Details</a> <ul> <li><a href="activitiy-details.html">Layout 1</a> </li> <li><a href="activitiy-details-2.html">Layout 2</a> </li> <li><a href="activitiy-details-3.html">Layout 3</a> </li> </ul> </li> <li><a href="activity-search.html">Search</a> <ul> <li><a href="activity-search.html">Layout 1</a> </li> <li><a href="activity-search-2.html">Layout 2</a> </li> </ul> </li> <li><a href="activitiy-payment.html">Payment</a> <ul> <li><a href="activitiy-payment.html">Registered</a> </li> <li><a href="<API key>.html">Existed Cards</a> </li> <li><a href="<API key>.html">Unregistered</a> </li> </ul> </li> <li><a href="activities.html">Results</a> <ul> <li><a href="activities.html">Layout 1</a> </li> <li><a href="<API key>.html">Layout 2</a> </li> <li><a href="<API key>.html">Layout 3</a> </li> <li><a href="<API key>.html">Layout 4</a> </li> <li><a href="<API key>.html">Layout 5</a> </li> </ul> </li> </ul> </li> </ul> </div> </div> </header> <div class="container"> <ul class="breadcrumb"> <li><a href="index.html">Home</a> </li> <li><a href="#">United States</a> </li> <li><a href="#">New York (NY)</a> </li> <li><a href="#">New York City</a> </li> <li class="active">New York City Vacation Rentals</li> </ul> <div class="mfp-with-anim mfp-hide mfp-dialog mfp-search-dialog" id="search-dialog"> <h3>Search for Vacation Rentals</h3> <form> <div class="form-group form-group-lg <API key>"><i class="fa fa-map-marker input-icon <API key>"></i> <label>Where are you going?</label> <input class="typeahead form-control" placeholder="City, Airport, Point of Interest, Hotel Name or U.S. Zip Code" type="text" /> </div> <div class="input-daterange" data-date-format="M d, D"> <div class="row"> <div class="col-md-3"> <div class="form-group form-group-lg <API key>"><i class="fa fa-calendar input-icon <API key>"></i> <label>Check-in</label> <input class="form-control" name="start" type="text" /> </div> </div> <div class="col-md-3"> <div class="form-group form-group-lg <API key>"><i class="fa fa-calendar input-icon <API key>"></i> <label>Check-out</label> <input class="form-control" name="end" type="text" /> </div> </div> <div class="col-md-3"> <div class="form-group form-group-lg <API key>"> <label>Rooms</label> <div class="btn-group <API key>" data-toggle="buttons"> <label class="btn btn-primary active"> <input type="radio" name="options" />1</label> <label class="btn btn-primary"> <input type="radio" name="options" />2</label> <label class="btn btn-primary"> <input type="radio" name="options" />3</label> <label class="btn btn-primary"> <input type="radio" name="options" />3+</label> </div> <select class="form-control hidden"> <option>1</option> <option>2</option> <option>3</option> <option selected="selected">4</option> <option>5</option> <option>6</option> <option>7</option> <option>8</option> <option>9</option> <option>10</option> <option>11</option> <option>12</option> <option>13</option> <option>14</option> </select> </div> </div> <div class="col-md-3"> <div class="form-group form-group-lg <API key>"> <label>Gutests</label> <div class="btn-group <API key>" data-toggle="buttons"> <label class="btn btn-primary"> <input type="radio" name="options" />1</label> <label class="btn btn-primary active"> <input type="radio" name="options" />2</label> <label class="btn btn-primary"> <input type="radio" name="options" />3</label> <label class="btn btn-primary"> <input type="radio" name="options" />3+</label> </div> <select class="form-control hidden"> <option>1</option> <option>2</option> <option>3</option> <option selected="selected">4</option> <option>5</option> <option>6</option> <option>7</option> <option>8</option> <option>9</option> <option>10</option> <option>11</option> <option>12</option> <option>13</option> <option>14</option> </select> </div> </div> </div> </div> <button class="btn btn-primary btn-lg" type="submit">Search for Hotels</button> </form> </div> <h3 class="booking-title">320 vacation rentals in New York on Mar 22 - Apr 17 <small><a class="popup-text" href="#search-dialog" data-effect="mfp-zoom-out">Change search</a></small></h3> <div class="row"> <div class="col-md-3"> <aside class="booking-filters <API key>"> <h3>Filter By:</h3> <ul class="list <API key>"> <li> <h5 class="<API key>">Price</h5> <input type="text" id="price-slider"> </li> <li> <h5 class="<API key>">Star Rating</h5> <div class="checkbox"> <label> <input class="i-check" type="checkbox" />5 star (220)</label> </div> <div class="checkbox"> <label> <input class="i-check" type="checkbox" />4 star (112)</label> </div> <div class="checkbox"> <label> <input class="i-check" type="checkbox" />3 star (75)</label> </div> <div class="checkbox"> <label> <input class="i-check" type="checkbox" />2 star (60)</label> </div> <div class="checkbox"> <label> <input class="i-check" type="checkbox" />1 star (20)</label> </div> </li> <li> <h5 class="<API key>">Bedrooms</h5> <div class="checkbox"> <label> <input class="i-check" type="checkbox" />1 Bedroom (100)</label> </div> <div class="checkbox"> <label> <input class="i-check" type="checkbox" />2 Bedrooms (112)</label> </div> <div class="checkbox"> <label> <input class="i-check" type="checkbox" />2+ Bedrooms (75)</label> </div> </li> <li> <h5 class="<API key>">Suitability</h5> <div class="checkbox"> <label> <input class="i-check" type="checkbox" />Wheelchair Access (65)</label> </div> <div class="checkbox"> <label> <input class="i-check" type="checkbox" />Elder Access (215)</label> </div> <div class="checkbox"> <label> <input class="i-check" type="checkbox" />Suitable for Children (295)</label> </div> <div class="checkbox"> <label> <input class="i-check" type="checkbox" />Pet Friendly (20)</label> </div> <div class="checkbox"> <label> <input class="i-check" type="checkbox" />Smoking Allowed (35)</label> </div> </li> <li> <h5 class="<API key>">Amenities</h5> <div class="checkbox"> <label> <input class="i-check" type="checkbox" />Air Conditioning (300)</label> </div> <div class="checkbox"> <label> <input class="i-check" type="checkbox" />Wi-Fi (320)</label> </div> <div class="checkbox"> <label> <input class="i-check" type="checkbox" />Internet (257)</label> </div> <div class="checkbox"> <label> <input class="i-check" type="checkbox" />High Definition TV (185)</label> </div> <div class="checkbox"> <label> <input class="i-check" type="checkbox" />Washer/Dryer (156)</label> </div> <div class="checkbox"> <label> <input class="i-check" type="checkbox" />Other Outdoor Space (86)</label> </div> <div class="checkbox"> <label> <input class="i-check" type="checkbox" />Grill (61)</label> </div> <div class="checkbox"> <label> <input class="i-check" type="checkbox" />Parking (33)</label> </div> </li> </ul> </aside> </div> <div class="col-md-9"> <div class="nav-drop booking-sort"> <h5 class="booking-sort-title"><a href="#">Sort: Price (low to high)<i class="fa fa-angle-down"></i><i class="fa fa-angle-up"></i></a></h5> <ul class="nav-drop-menu"> <li><a href="#">Price (hight to low)</a> </li> <li><a href="#">Ranking</a> </li> <li><a href="#">Bedrooms (Most to Least)</a> </li> <li><a href="#">Bedrooms (Least to Most)</a> </li> <li><a href="#">Number of Reviews</a> </li> <li><a href="#">Number of Photos</a> </li> <li><a href="#">Just Added</a> </li> </ul> </div> <ul class="booking-list"> <li> <a class="booking-item" href=" <div class="row"> <div class="col-md-3"> <div class="<API key>"> <img src="img/800x600.png" alt="Image Alternative text" title="LHOTEL PORTO BAY SAO PAULO suite lhotel living room" /> <div class="<API key>"><i class="fa fa-picture-o"></i>8</div> </div> </div> <div class="col-md-6"> <div class="booking-item-rating"> <ul class="icon-group <API key>"> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star-half-empty"></i> </li> </ul><span class="<API key>"><b >4.2</b> of 5</span><small>(265 reviews)</small> </div> <h5 class="booking-item-title">Cozy Apartment Manhattan East 20s</h5> <p class="<API key>"><i class="fa fa-map-marker"></i> Flushing, NY (LaGuardia Airport (LGA))</p> <ul class="<API key> <API key> <API key>"> <li rel="tooltip" data-placement="top" title="Sleeps"><i class="fa fa-male"></i><span class="<API key>">x 3</span> </li> <li rel="tooltip" data-placement="top" title="Bedrooms"><i class="im im-bed"></i><span class="<API key>">x 3</span> </li> <li rel="tooltip" data-placement="top" title="Bathrooms"><i class="im im-shower"></i><span class="<API key>">x 2</span> </li> </ul> </div> <div class="col-md-3"><span class="booking-item-price">$389</span><span>/night</span><span class="btn btn-primary">Book Now</span> </div> </div> </a> </li> <li> <a class="booking-item" href=" <div class="row"> <div class="col-md-3"> <div class="<API key>"> <img src="img/800x600.png" alt="Image Alternative text" title="hotel 1" /> <div class="<API key>"><i class="fa fa-picture-o"></i>15</div> </div> </div> <div class="col-md-6"> <div class="booking-item-rating"> <ul class="icon-group <API key>"> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> </ul><span class="<API key>"><b >4.9</b> of 5</span><small>(862 reviews)</small> </div> <h5 class="booking-item-title">Times Square 50th Gem</h5> <p class="<API key>"><i class="fa fa-map-marker"></i> New York, NY (Times Square)</p> <ul class="<API key> <API key> <API key>"> <li rel="tooltip" data-placement="top" title="Sleeps"><i class="fa fa-male"></i><span class="<API key>">x 5</span> </li> <li rel="tooltip" data-placement="top" title="Bedrooms"><i class="im im-bed"></i><span class="<API key>">x 2</span> </li> <li rel="tooltip" data-placement="top" title="Bathrooms"><i class="im im-shower"></i><span class="<API key>">x 2</span> </li> </ul> </div> <div class="col-md-3"><span class="booking-item-price">$298</span><span>/night</span><span class="btn btn-primary">Book Now</span> </div> </div> </a> </li> <li> <a class="booking-item" href=" <div class="row"> <div class="col-md-3"> <div class="<API key>"> <img src="img/800x600.png" alt="Image Alternative text" title="LHOTEL PORTO BAY SAO PAULO luxury suite" /> <div class="<API key>"><i class="fa fa-picture-o"></i>10</div> </div> </div> <div class="col-md-6"> <div class="booking-item-rating"> <ul class="icon-group <API key>"> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star-half-empty"></i> </li> <li><i class="fa fa-star-o"></i> </li> </ul><span class="<API key>"><b >3.5</b> of 5</span><small>(1097 reviews)</small> </div> <h5 class="booking-item-title">NyCityStay Greenwich Village</h5> <p class="<API key>"><i class="fa fa-map-marker"></i> Brooklyn, NY (Brooklyn)</p> <ul class="<API key> <API key> <API key>"> <li rel="tooltip" data-placement="top" title="Sleeps"><i class="fa fa-male"></i><span class="<API key>">x 6</span> </li> <li rel="tooltip" data-placement="top" title="Bedrooms"><i class="im im-bed"></i><span class="<API key>">x 3</span> </li> <li rel="tooltip" data-placement="top" title="Bathrooms"><i class="im im-shower"></i><span class="<API key>">x 1</span> </li> </ul> </div> <div class="col-md-3"><span class="booking-item-price">$493</span><span>/night</span><span class="btn btn-primary">Book Now</span> </div> </div> </a> </li> <li> <a class="booking-item" href=" <div class="row"> <div class="col-md-3"> <div class="<API key>"> <img src="img/800x600.png" alt="Image Alternative text" title="LHOTEL PORTO BAY SAO PAULO lobby" /> <div class="<API key>"><i class="fa fa-picture-o"></i>25</div> </div> </div> <div class="col-md-6"> <div class="booking-item-rating"> <ul class="icon-group <API key>"> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star-half-empty"></i> </li> </ul><span class="<API key>"><b >4.5</b> of 5</span><small>(901 reviews)</small> </div> <h5 class="booking-item-title">East Village Apartment</h5> <p class="<API key>"><i class="fa fa-map-marker"></i> Queens (LaGuardia Airport (LGA))</p> <ul class="<API key> <API key> <API key>"> <li rel="tooltip" data-placement="top" title="Sleeps"><i class="fa fa-male"></i><span class="<API key>">x 3</span> </li> <li rel="tooltip" data-placement="top" title="Bedrooms"><i class="im im-bed"></i><span class="<API key>">x 1</span> </li> <li rel="tooltip" data-placement="top" title="Bathrooms"><i class="im im-shower"></i><span class="<API key>">x 1</span> </li> </ul> </div> <div class="col-md-3"><span class="booking-item-price">$389</span><span>/night</span><span class="btn btn-primary">Book Now</span> </div> </div> </a> </li> <li> <a class="booking-item" href=" <div class="row"> <div class="col-md-3"> <div class="<API key>"> <img src="img/800x600.png" alt="Image Alternative text" title="hotel PORTO BAY LIBERDADE" /> <div class="<API key>"><i class="fa fa-picture-o"></i>22</div> </div> </div> <div class="col-md-6"> <div class="booking-item-rating"> <ul class="icon-group <API key>"> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star-half-empty"></i> </li> </ul><span class="<API key>"><b >4.5</b> of 5</span><small>(313 reviews)</small> </div> <h5 class="booking-item-title">Midtown Manhattan Oversized</h5> <p class="<API key>"><i class="fa fa-map-marker"></i> New York, NY (Upper West Side)</p> <ul class="<API key> <API key> <API key>"> <li rel="tooltip" data-placement="top" title="Sleeps"><i class="fa fa-male"></i><span class="<API key>">x 4</span> </li> <li rel="tooltip" data-placement="top" title="Bedrooms"><i class="im im-bed"></i><span class="<API key>">x 1</span> </li> <li rel="tooltip" data-placement="top" title="Bathrooms"><i class="im im-shower"></i><span class="<API key>">x 1</span> </li> </ul> </div> <div class="col-md-3"><span class="booking-item-price">$379</span><span>/night</span><span class="btn btn-primary">Book Now</span> </div> </div> </a> </li> <li> <a class="booking-item" href=" <div class="row"> <div class="col-md-3"> <div class="<API key>"> <img src="img/800x600.png" alt="Image Alternative text" title="hotel PORTO BAY SERRA GOLF suite2" /> <div class="<API key>"><i class="fa fa-picture-o"></i>10</div> </div> </div> <div class="col-md-6"> <div class="booking-item-rating"> <ul class="icon-group <API key>"> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star-half-empty"></i> </li> </ul><span class="<API key>"><b >4.1</b> of 5</span><small>(934 reviews)</small> </div> <h5 class="booking-item-title">Luxury Studio in Manhattan NYC</h5> <p class="<API key>"><i class="fa fa-map-marker"></i> East Elmhurst, NY (LaGuardia Airport (LGA))</p> <ul class="<API key> <API key> <API key>"> <li rel="tooltip" data-placement="top" title="Sleeps"><i class="fa fa-male"></i><span class="<API key>">x 6</span> </li> <li rel="tooltip" data-placement="top" title="Bedrooms"><i class="im im-bed"></i><span class="<API key>">x 2</span> </li> <li rel="tooltip" data-placement="top" title="Bathrooms"><i class="im im-shower"></i><span class="<API key>">x 2</span> </li> </ul> </div> <div class="col-md-3"><span class="booking-item-price">$442</span><span>/night</span><span class="btn btn-primary">Book Now</span> </div> </div> </a> </li> <li> <a class="booking-item" href=" <div class="row"> <div class="col-md-3"> <div class="<API key>"> <img src="img/800x600.png" alt="Image Alternative text" title="hotel PORTO BAY SERRA GOLF suite" /> <div class="<API key>"><i class="fa fa-picture-o"></i>7</div> </div> </div> <div class="col-md-6"> <div class="booking-item-rating"> <ul class="icon-group <API key>"> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star-o"></i> </li> </ul><span class="<API key>"><b >3.6</b> of 5</span><small>(1480 reviews)</small> </div> <h5 class="booking-item-title">Soho Art Gallery Massive Luxurious Loft</h5> <p class="<API key>"><i class="fa fa-map-marker"></i> Flushing, NY (LaGuardia Airport (LGA))</p> <ul class="<API key> <API key> <API key>"> <li rel="tooltip" data-placement="top" title="Sleeps"><i class="fa fa-male"></i><span class="<API key>">x 5</span> </li> <li rel="tooltip" data-placement="top" title="Bedrooms"><i class="im im-bed"></i><span class="<API key>">x 1</span> </li> <li rel="tooltip" data-placement="top" title="Bathrooms"><i class="im im-shower"></i><span class="<API key>">x 2</span> </li> </ul> </div> <div class="col-md-3"><span class="booking-item-price">$288</span><span>/night</span><span class="btn btn-primary">Book Now</span> </div> </div> </a> </li> <li> <a class="booking-item" href=" <div class="row"> <div class="col-md-3"> <div class="<API key>"> <img src="img/800x600.png" alt="Image Alternative text" title="hotel PORTO BAY SERRA GOLF living room" /> <div class="<API key>"><i class="fa fa-picture-o"></i>19</div> </div> </div> <div class="col-md-6"> <div class="booking-item-rating"> <ul class="icon-group <API key>"> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star-o"></i> </li> </ul><span class="<API key>"><b >3.7</b> of 5</span><small>(663 reviews)</small> </div> <h5 class="booking-item-title">NYC One Badroom in Midtown East</h5> <p class="<API key>"><i class="fa fa-map-marker"></i> New York, NY (Downtown - Wall Street)</p> <ul class="<API key> <API key> <API key>"> <li rel="tooltip" data-placement="top" title="Sleeps"><i class="fa fa-male"></i><span class="<API key>">x 2</span> </li> <li rel="tooltip" data-placement="top" title="Bedrooms"><i class="im im-bed"></i><span class="<API key>">x 3</span> </li> <li rel="tooltip" data-placement="top" title="Bathrooms"><i class="im im-shower"></i><span class="<API key>">x 1</span> </li> </ul> </div> <div class="col-md-3"><span class="booking-item-price">$167</span><span>/night</span><span class="btn btn-primary">Book Now</span> </div> </div> </a> </li> <li> <a class="booking-item" href=" <div class="row"> <div class="col-md-3"> <div class="<API key>"> <img src="img/800x600.png" alt="Image Alternative text" title="hotel PORTO BAY RIO INTERNACIONAL de luxe" /> <div class="<API key>"><i class="fa fa-picture-o"></i>6</div> </div> </div> <div class="col-md-6"> <div class="booking-item-rating"> <ul class="icon-group <API key>"> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> </ul><span class="<API key>"><b >4.9</b> of 5</span><small>(597 reviews)</small> </div> <h5 class="booking-item-title">Manhattan Beautiful Loft Excellent Loc</h5> <p class="<API key>"><i class="fa fa-map-marker"></i> Long Island City, NY (Long Island City - Astoria)</p> <ul class="<API key> <API key> <API key>"> <li rel="tooltip" data-placement="top" title="Sleeps"><i class="fa fa-male"></i><span class="<API key>">x 2</span> </li> <li rel="tooltip" data-placement="top" title="Bedrooms"><i class="im im-bed"></i><span class="<API key>">x 1</span> </li> <li rel="tooltip" data-placement="top" title="Bathrooms"><i class="im im-shower"></i><span class="<API key>">x 2</span> </li> </ul> </div> <div class="col-md-3"><span class="booking-item-price">$472</span><span>/night</span><span class="btn btn-primary">Book Now</span> </div> </div> </a> </li> <li> <a class="booking-item" href=" <div class="row"> <div class="col-md-3"> <div class="<API key>"> <img src="img/800x600.png" alt="Image Alternative text" title="The pool" /> <div class="<API key>"><i class="fa fa-picture-o"></i>27</div> </div> </div> <div class="col-md-6"> <div class="booking-item-rating"> <ul class="icon-group <API key>"> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star-half-empty"></i> </li> <li><i class="fa fa-star-o"></i> </li> </ul><span class="<API key>"><b >3.5</b> of 5</span><small>(1171 reviews)</small> </div> <h5 class="booking-item-title">The Meatpacking Suites - Luxury Lofts, Hot Location</h5> <p class="<API key>"><i class="fa fa-map-marker"></i> New York, NY (Times Square)</p> <ul class="<API key> <API key> <API key>"> <li rel="tooltip" data-placement="top" title="Sleeps"><i class="fa fa-male"></i><span class="<API key>">x 5</span> </li> <li rel="tooltip" data-placement="top" title="Bedrooms"><i class="im im-bed"></i><span class="<API key>">x 2</span> </li> <li rel="tooltip" data-placement="top" title="Bathrooms"><i class="im im-shower"></i><span class="<API key>">x 1</span> </li> </ul> </div> <div class="col-md-3"><span class="booking-item-price">$225</span><span>/night</span><span class="btn btn-primary">Book Now</span> </div> </div> </a> </li> <li> <a class="booking-item" href=" <div class="row"> <div class="col-md-3"> <div class="<API key>"> <img src="img/800x600.png" alt="Image Alternative text" title="hotel THE CLIFF BAY spa suite" /> <div class="<API key>"><i class="fa fa-picture-o"></i>8</div> </div> </div> <div class="col-md-6"> <div class="booking-item-rating"> <ul class="icon-group <API key>"> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star-half-empty"></i> </li> </ul><span class="<API key>"><b >4.6</b> of 5</span><small>(773 reviews)</small> </div> <h5 class="booking-item-title">Elegance & Style Near the Empire State Building</h5> <p class="<API key>"><i class="fa fa-map-marker"></i> East Elmhurst, NY (LaGuardia Airport (LGA))</p> <ul class="<API key> <API key> <API key>"> <li rel="tooltip" data-placement="top" title="Sleeps"><i class="fa fa-male"></i><span class="<API key>">x 3</span> </li> <li rel="tooltip" data-placement="top" title="Bedrooms"><i class="im im-bed"></i><span class="<API key>">x 2</span> </li> <li rel="tooltip" data-placement="top" title="Bathrooms"><i class="im im-shower"></i><span class="<API key>">x 2</span> </li> </ul> </div> <div class="col-md-3"><span class="booking-item-price">$433</span><span>/night</span><span class="btn btn-primary">Book Now</span> </div> </div> </a> </li> <li> <a class="booking-item" href=" <div class="row"> <div class="col-md-3"> <div class="<API key>"> <img src="img/800x600.png" alt="Image Alternative text" title="hotel PORTO BAY RIO INTERNACIONAL rooftop pool" /> <div class="<API key>"><i class="fa fa-picture-o"></i>7</div> </div> </div> <div class="col-md-6"> <div class="booking-item-rating"> <ul class="icon-group <API key>"> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> </ul><span class="<API key>"><b >5</b> of 5</span><small>(573 reviews)</small> </div> <h5 class="booking-item-title">Styish, Chic, Best of West Village</h5> <p class="<API key>"><i class="fa fa-map-marker"></i> Jamaica, NY (Kennedy Airport (JFK))</p> <ul class="<API key> <API key> <API key>"> <li rel="tooltip" data-placement="top" title="Sleeps"><i class="fa fa-male"></i><span class="<API key>">x 5</span> </li> <li rel="tooltip" data-placement="top" title="Bedrooms"><i class="im im-bed"></i><span class="<API key>">x 3</span> </li> <li rel="tooltip" data-placement="top" title="Bathrooms"><i class="im im-shower"></i><span class="<API key>">x 1</span> </li> </ul> </div> <div class="col-md-3"><span class="booking-item-price">$165</span><span>/night</span><span class="btn btn-primary">Book Now</span> </div> </div> </a> </li> <li> <a class="booking-item" href=" <div class="row"> <div class="col-md-3"> <div class="<API key>"> <img src="img/800x600.png" alt="Image Alternative text" title="hotel 2" /> <div class="<API key>"><i class="fa fa-picture-o"></i>18</div> </div> </div> <div class="col-md-6"> <div class="booking-item-rating"> <ul class="icon-group <API key>"> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star-o"></i> </li> </ul><span class="<API key>"><b >3.6</b> of 5</span><small>(1247 reviews)</small> </div> <h5 class="booking-item-title">Duplex Greenwich</h5> <p class="<API key>"><i class="fa fa-map-marker"></i> New York, NY (Downtown - Wall Street)</p> <ul class="<API key> <API key> <API key>"> <li rel="tooltip" data-placement="top" title="Sleeps"><i class="fa fa-male"></i><span class="<API key>">x 2</span> </li> <li rel="tooltip" data-placement="top" title="Bedrooms"><i class="im im-bed"></i><span class="<API key>">x 3</span> </li> <li rel="tooltip" data-placement="top" title="Bathrooms"><i class="im im-shower"></i><span class="<API key>">x 1</span> </li> </ul> </div> <div class="col-md-3"><span class="booking-item-price">$383</span><span>/night</span><span class="btn btn-primary">Book Now</span> </div> </div> </a> </li> <li> <a class="booking-item" href=" <div class="row"> <div class="col-md-3"> <div class="<API key>"> <img src="img/800x600.png" alt="Image Alternative text" title="hotel EDEN MAR suite" /> <div class="<API key>"><i class="fa fa-picture-o"></i>21</div> </div> </div> <div class="col-md-6"> <div class="booking-item-rating"> <ul class="icon-group <API key>"> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star-half-empty"></i> </li> </ul><span class="<API key>"><b >4.5</b> of 5</span><small>(616 reviews)</small> </div> <h5 class="booking-item-title">Luxury Apartment Theatre District</h5> <p class="<API key>"><i class="fa fa-map-marker"></i> Brooklyn, NY (Brooklyn)</p> <ul class="<API key> <API key> <API key>"> <li rel="tooltip" data-placement="top" title="Sleeps"><i class="fa fa-male"></i><span class="<API key>">x 5</span> </li> <li rel="tooltip" data-placement="top" title="Bedrooms"><i class="im im-bed"></i><span class="<API key>">x 2</span> </li> <li rel="tooltip" data-placement="top" title="Bathrooms"><i class="im im-shower"></i><span class="<API key>">x 1</span> </li> </ul> </div> <div class="col-md-3"><span class="booking-item-price">$500</span><span>/night</span><span class="btn btn-primary">Book Now</span> </div> </div> </a> </li> <li> <a class="booking-item" href=" <div class="row"> <div class="col-md-3"> <div class="<API key>"> <img src="img/800x600.png" alt="Image Alternative text" title="hotel PORTO BAY SERRA GOLF library" /> <div class="<API key>"><i class="fa fa-picture-o"></i>12</div> </div> </div> <div class="col-md-6"> <div class="booking-item-rating"> <ul class="icon-group <API key>"> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> <li><i class="fa fa-star"></i> </li> </ul><span class="<API key>"><b >4.9</b> of 5</span><small>(611 reviews)</small> </div> <h5 class="booking-item-title">NYC Waterfront Artist Studio</h5> <p class="<API key>"><i class="fa fa-map-marker"></i> New York, NY (Times Square)</p> <ul class="<API key> <API key> <API key>"> <li rel="tooltip" data-placement="top" title="Sleeps"><i class="fa fa-male"></i><span class="<API key>">x 6</span> </li> <li rel="tooltip" data-placement="top" title="Bedrooms"><i class="im im-bed"></i><span class="<API key>">x 1</span> </li> <li rel="tooltip" data-placement="top" title="Bathrooms"><i class="im im-shower"></i><span class="<API key>">x 1</span> </li> </ul> </div> <div class="col-md-3"><span class="booking-item-price">$259</span><span>/night</span><span class="btn btn-primary">Book Now</span> </div> </div> </a> </li> </ul> <div class="row"> <div class="col-md-6"> <p><small>320 vacation rentals found in New York. &nbsp;&nbsp;Showing 1 – 15</small> </p> <ul class="pagination"> <li class="active"><a href=" </li> <li><a href=" </li> <li><a href=" </li> <li><a href=" </li> <li><a href=" </li> <li><a href=" </li> <li><a href=" </li> <li class="dots">...</li> <li><a href="#">43</a> </li> <li class="next"><a href="#">Next Page</a> </li> </ul> </div> <div class="col-md-6 text-right"> <p>Not what you're looking for? <a class="popup-text" href="#search-dialog" data-effect="mfp-zoom-out">Try your search again</a> </p> </div> </div> </div> </div> <div class="gap"></div> </div> <footer id="main-footer"> <div class="container"> <div class="row row-wrap"> <div class="col-md-3"> <a class="logo" href="index.html"> <img src="img/logo-invert.png" alt="Image Alternative text" title="Image Title" /> </a> <p class="mb20">Booking, reviews and advices on hotels, resorts, flights, vacation rentals, travel packages, and lots more!</p> <ul class="list list-horizontal list-space"> <li> <a class="fa fa-facebook box-icon-normal round <API key>" href=" </li> <li> <a class="fa fa-<TwitterConsumerkey> round <API key>" href=" </li> <li> <a class="fa fa-google-plus box-icon-normal round <API key>" href=" </li> <li> <a class="fa fa-linkedin box-icon-normal round <API key>" href=" </li> <li> <a class="fa fa-pinterest box-icon-normal round <API key>" href=" </li> </ul> </div> <div class="col-md-3"> <h4>Newsletter</h4> <form> <label>Enter your E-mail Address</label> <input type="text" class="form-control"> <p class="mt5"><small>*We Never Send Spam</small> </p> <input type="submit" class="btn btn-primary" value="Subscribe"> </form> </div> <div class="col-md-2"> <ul class="list list-footer"> <li><a href="#">About US</a> </li> <li><a href="#">Press Centre</a> </li> <li><a href="#">Best Price Guarantee</a> </li> <li><a href="#">Travel News</a> </li> <li><a href="#">Jobs</a> </li> <li><a href="#">Privacy Policy</a> </li> <li><a href="#">Terms of Use</a> </li> <li><a href="#">Feedback</a> </li> </ul> </div> <div class="col-md-4"> <h4>Have Questions?</h4> <h4 class="text-color">+1-202-555-0173</h4> <h4><a href="#" class="text-color">support@traveler.com</a></h4> <p>24/7 Dedicated Customer Support</p> </div> </div> </div> </footer> <script src="js/jquery.js"></script> <script src="js/bootstrap.js"></script> <script src="js/slimmenu.js"></script> <script src="js/<API key>.js"></script> <script src="js/<API key>.js"></script> <script src="js/nicescroll.js"></script> <script src="js/dropit.js"></script> <script src="js/ionrangeslider.js"></script> <script src="js/icheck.js"></script> <script src="js/fotorama.js"></script> <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script> <script src="js/typeahead.js"></script> <script src="js/card-payment.js"></script> <script src="js/magnific.js"></script> <script src="js/owl-carousel.js"></script> <script src="js/fitvids.js"></script> <script src="js/tweet.js"></script> <script src="js/countdown.js"></script> <script src="js/gridrotator.js"></script> <script src="js/custom.js"></script> </div> </body> </html>
ld.service('TownApi', ['$resource', function($resource) { var TownApi = {}, api_home = "/api/town", artist_params, artist_url; artist_params = {artist_name: '@artist_name'}; artist_url = [api_home, 'artists/:artist_name/:fn'].join('/'); TownApi.Artist = $resource(artist_url, artist_params, { events: { method: 'GET', params: { fn: 'events' }, isArray: true } }); return TownApi; }]);
#!/usr/bin/env python def get_db(db_name): from pymongo import MongoClient client = MongoClient('localhost:27017') db = client[db_name] return db def make_pipeline(): # complete the aggregation pipeline match = {"$match": {"created": {"$exists": 1}}} group = {"$group": {"_id": "$created.user", "total": {"$sum": 1}}} sort = {"$sort": {"total": -1}} limit = {"$limit": 5} pipeline = [match, group, sort, limit] return pipeline def aggregate(db, pipeline): return [doc for doc in db.openStreetDataMap.aggregate(pipeline)] if __name__ == '__main__': db = get_db('udacity') pipeline = make_pipeline() result = aggregate(db, pipeline) # print(type(result)) # assert len(result) == 1 import pprint pprint.pprint(result)
from gensim import corpora, models, similarities import json import os # from cpython cimport PyCObject_AsVoidPtr # from scipy.linalg.blas import cblasfrom scipy.linalg.blas import cblas # ctypedef void (*saxpy_ptr) (const int *N, const float *alpha, const float *X, const int *incX, float *Y, const int *incY) nogil # cdef saxpy_ptr saxpy=<saxpy_ptr>PyCObject_AsVoidPtr(cblas.saxpy._cpointer) jsonfile = open('./data/example.json', 'r') json_data=jsonfile.read() jsondata=json.loads(json_data) json_imgs=jsondata['images'] sentences=[] for i,jsonimg in enumerate(json_imgs): concatpara="" for sentence in jsonimg['sentences']: ensent=sentence['raw'].encode('ascii','ignore') if ensent not in concatpara: concatpara+=ensent key=str(i) sentences.append(models.doc2vec.TaggedDocument(concatpara.split(), [key])) model = models.Doc2Vec(size=300,alpha=0.025, min_alpha=0.025,window=8, min_count=5, seed=1,sample=1e-5, workers=4) # use fixed learning rate model.build_vocab(sentences) for epoch in range(100): print epoch model.train(sentences) model.alpha -= 0.0001 # decrease the learning rate model.min_alpha = model.alpha # if epoch%200==0 and epoch!=0: # print "save check point" # accuracy_list=model.accuracy('./model/questions-words.txt') # error=0 # correct=0 # for accuracy in accuracy_list: # error=error+len(accuracy['incorrect']) # correct=correct+len(accuracy['correct']) # print "accuracy :", correct*1.0/(correct+error) # model.save('./model/disney_model.doc2vec') #model.init_sims(replace=True) model.save('./model/example.doc2vec')
'use strict'; var mocha = require('mocha'); var chakram = require('chakram'); var request = chakram.request; var expect = chakram.expect; describe('tests for /v2.0/data/publications/{publicationid}', function () { describe('tests for get', function () { it('should respond 200 for "A list of publications."', function () { var response = request('get', 'http://localhost:3005/v2.0/data/publications/{publicationid}', { 'qs': { 'publicationid': 4543 }, 'time': true }); expect(response).to.have.status(200); return chakram.wait(); }); }); });
""" Find the value function associated with a policy. Based on Sutton & Barto, 1998. Matthew Alger, 2015 matthew.alger@anu.edu.au """ import numpy as np def value(policy, n_states, <API key>, reward, discount, threshold=1e-2): """ Find the value function associated with a policy. policy: List of action ints for each state. n_states: Number of states. int. <API key>: Function taking (state, action, state) to transition probabilities. reward: Vector of rewards for each state. discount: MDP discount factor. float. threshold: Convergence threshold, default 1e-2. float. -> Array of values for each state """ v = np.zeros(n_states) diff = float("inf") while diff > threshold: diff = 0 for s in range(n_states): vs = v[s] a = policy[s] v[s] = sum(<API key>[s, a, k] * (reward[k] + discount * v[k]) for k in range(n_states)) diff = max(diff, abs(vs - v[s])) return v def optimal_value(n_states, n_actions, <API key>, reward, discount, threshold=1e-2): """ Find the optimal value function. n_states: Number of states. int. n_actions: Number of actions. int. <API key>: Function taking (state, action, state) to transition probabilities. reward: Vector of rewards for each state. discount: MDP discount factor. float. threshold: Convergence threshold, default 1e-2. float. -> Array of values for each state """ v = np.zeros(n_states) diff = float("inf") while diff > threshold: diff = 0 for s in range(n_states): max_v = float("-inf") for a in range(n_actions): tp = <API key>[s, a, :] max_v = max(max_v, np.dot(tp, reward + discount*v)) new_diff = abs(v[s] - max_v) if new_diff > diff: diff = new_diff v[s] = max_v return v def find_policy(n_states, n_actions, <API key>, reward, discount, threshold=1e-2, v=None, stochastic=True): """ Find the optimal policy. n_states: Number of states. int. n_actions: Number of actions. int. <API key>: Function taking (state, action, state) to transition probabilities. reward: Vector of rewards for each state. discount: MDP discount factor. float. threshold: Convergence threshold, default 1e-2. float. v: Value function (if known). Default None. stochastic: Whether the policy should be stochastic. Default True. -> Action probabilities for each state or action int for each state (depending on stochasticity). """ if v is None: v = optimal_value(n_states, n_actions, <API key>, reward, discount, threshold) if stochastic: # Get Q using equation 9.2 from Ziebart's thesis. Q = np.zeros((n_states, n_actions)) for i in range(n_states): for j in range(n_actions): p = <API key>[i, j, :] Q[i, j] = p.dot(reward + discount*v) Q -= Q.max(axis=1).reshape((n_states, 1)) # For numerical stability. Q = np.exp(Q)/np.exp(Q).sum(axis=1).reshape((n_states, 1)) return Q def _policy(s): return max(range(n_actions), key=lambda a: sum(<API key>[s, a, k] * (reward[k] + discount * v[k]) for k in range(n_states))) policy = np.array([_policy(s) for s in range(n_states)]) return policy if __name__ == '__main__': # Quick unit test using gridworld. import mdp.gridworld as gridworld gw = gridworld.Gridworld(3, 0.3, 0.9) v = value([gw.<API key>(s) for s in range(gw.n_states)], gw.n_states, gw.<API key>, [gw.reward(s) for s in range(gw.n_states)], gw.discount) assert np.isclose(v, [5.7194282, 6.46706692, 6.42589811, 6.46706692, 7.47058224, 7.96505174, 6.42589811, 7.96505174, 8.19268666], 1).all() opt_v = optimal_value(gw.n_states, gw.n_actions, gw.<API key>, [gw.reward(s) for s in range(gw.n_states)], gw.discount) assert np.isclose(v, opt_v).all()
require 'spec_helper' require 'concerns/voteable_examples' describe Answer, type: :model do <API key> 'voteable' describe 'associations' do it { is_expected.to have_many(:comments) } it { is_expected.to belong_to(:question) } it { is_expected.to have_many(:timeline_events) } it { is_expected.to belong_to(:user) } end describe 'validations' do [:question_id, :user_id].each do |attr| it { is_expected.to <API key>(attr) } end it { is_expected.to ensure_length_of(:body).is_at_least(10).is_at_most(30000) } end describe '#<API key>' do let(:question) { FactoryGirl.create(:question, accepted_answer_id: nil) } let(:a1) { FactoryGirl.create(:answer, question: question) } let(:a2) { FactoryGirl.create(:answer, question: question) } before do # create an upvote on a2 VoteCreator.new(FactoryGirl.create(:user), post_id: a2.id, post_type: 'Answer', vote_type: 'upvote').create end it 'orders by vote as per usual if there is no accepted answer' do expect(question.answers.<API key>(question)).to eq([a2, a1]) end it 'pulls out the accepted answer first if there is an accept answer' do question.accepted_answer_id = a1.id question.save expect(question.answers.<API key>(question)).to eq([a1, a2]) end end end
const EventEmitter = require('events').EventEmitter; const request = require('request'); const https = require('https'); const http = require('http'); const utils = require('./utils'); const url = require('url'); const oldRequestGet = request.get; const oldRequestPost = request.post; const oldHttpsRequest = https.request; const oldHttpRequest = http.request; function createException() { const error = new Error(`connect ECONNREFUSED`); error.code = 'ECONNREFUSED'; error.errno = 'ECONNREFUSED'; error.syscall = 'connect'; return error; } function httpModuleRequest(uri, callback, fakewebOptions) { const thisRequest = new EventEmitter(); const writeBuffers = []; thisRequest.setEncoding = () => {}; thisRequest.setHeader = () => {}; thisRequest.getHeader = () => {}; thisRequest.setNoDelay = () => {}; thisRequest.setSocketKeepAlive = () => {}; thisRequest.end = () => { const requestBuffer = writeBuffers.length > 0 ? Buffer.concat(writeBuffers) : new Buffer(0); const requestBody = requestBuffer.toString('utf8'); const thisResponse = new EventEmitter(); // Request module checks against the connection object event emitter thisResponse.connection = thisResponse; thisResponse.pause = thisResponse.resume = () => {}; thisResponse.setEncoding = () => {}; thisResponse.pipe = (outputStream) => { outputStream.write(fakewebOptions.response(requestBody)); outputStream.end(); return outputStream; // support chaining }; thisResponse.statusCode = utils.getStatusCode(fakewebOptions); thisResponse.headers = fakewebOptions.headers; if (fakewebOptions.contentType) { thisResponse.headers['content-type'] = fakewebOptions.contentType; } thisRequest.emit('response', thisResponse); if (callback) { callback(thisResponse); } if (fakewebOptions.exception) { const error = createException(); thisResponse.emit('error', error); thisResponse.emit('end'); thisResponse.emit('close'); return; } fakewebOptions.spy.body = requestBody; thisResponse.emit('data', fakewebOptions.response(requestBody)); thisResponse.emit('end'); thisResponse.emit('close'); }; thisRequest.write = function requestWrite(buffer, encoding, cb) { if (buffer) { if (!Buffer.isBuffer(buffer)) { buffer = new Buffer(buffer, encoding); } writeBuffers.push(buffer); } if (cb) { cb(); } }; return thisRequest; } function requestGet(options, callback) { if (typeof options === 'string') { options = { uri: options }; } const uri = options.uri || options.url; const followRedirect = options.followRedirect !== undefined ? options.followRedirect : true; if (this.interceptable(uri)) { const fakewebOptions = this.fakewebMatch(uri, 'GET'); fakewebOptions.spy.used = true; fakewebOptions.spy.useCount += 1; if (fakewebOptions.exception) { throw createException(fakewebOptions); } const statusCode = utils.getStatusCode(fakewebOptions); if (statusCode >= 300 && statusCode < 400 && fakewebOptions.headers.Location && followRedirect) { const redirectTo = url.resolve(uri, fakewebOptions.headers.Location); return request.get({ uri: redirectTo }, callback); } const resp = { statusCode }; resp.headers = fakewebOptions.headers; if (fakewebOptions.contentType) { resp.headers['content-type'] = fakewebOptions.contentType; } const body = options.json ? JSON.parse(fakewebOptions.response()) : fakewebOptions.response(); return callback(null, resp, body); } return oldRequestGet.call(request, options, callback); } function requestPost(options, callback) { if (typeof options === 'string') { options = { uri: options }; } const uri = options.uri || options.url; if (this.interceptable(uri, 'POST')) { const fakewebOptions = this.fakewebMatch(uri, 'POST'); fakewebOptions.spy.used = true; fakewebOptions.spy.useCount += 1; fakewebOptions.spy.body = options.body; fakewebOptions.spy.form = options.form; if (fakewebOptions.exception) { throw createException(fakewebOptions); } const resp = { statusCode: utils.getStatusCode(fakewebOptions) }; resp.headers = fakewebOptions.headers; if (fakewebOptions.contentType) { resp.headers['content-type'] = fakewebOptions.contentType; } const body = options.json ? JSON.parse(fakewebOptions.response(options.form)) : fakewebOptions.response(options.form); return callback(null, resp, body); } return oldRequestPost.call(request, options, callback); } function httpsRequest(options, callback) { let uri = options; if (options.port) { uri = `https://${(options.hostname || options.host)}:${options.port}${options.path}`; } else if (options.path) { uri = `https://${(options.hostname || options.host)}${options.path}`; } if (this.interceptable(uri, options.method)) { const fakewebOptions = this.fakewebMatch(uri, options.method); fakewebOptions.spy.used = true; fakewebOptions.spy.useCount += 1; return httpModuleRequest.call(this, uri, callback, fakewebOptions); } return oldHttpsRequest.call(https, options, callback); } function httpRequest(options, callback) { let uri = options; if (options.port) { uri = `http://${(options.hostname || options.host)}:${options.port}${options.path}`; } else if (options.path) { uri = `http://${(options.hostname || options.host)}${options.path}`; } if (this.interceptable(uri, options.method)) { const fakewebOptions = this.fakewebMatch(uri, options.method); fakewebOptions.spy.used = true; fakewebOptions.spy.useCount += 1; return httpModuleRequest.call(this, uri, callback, fakewebOptions); } return oldHttpRequest.call(http, options, callback); } module.exports.httpRequest = httpRequest; module.exports.httpsRequest = httpsRequest; module.exports.requestGet = requestGet; module.exports.requestPost = requestPost;
using NUnit.Framework; [TestFixture] public class BinarySearchTest { [Test] public void <API key>() { var input = new int[0]; Assert.That(BinarySearch.Search(input, 6), Is.EqualTo(-1)); } [Test] public void <API key>() { var input = new[] { 6 }; Assert.That(BinarySearch.Search(input, 6), Is.EqualTo(0)); } [Test] public void Should_return_minus_one_if_a_value_is_less_than_the_element_in_a_single_element_array() { var input = new[] { 94 }; Assert.That(BinarySearch.Search(input, 6), Is.EqualTo(-1)); } [Test] public void Should_return_minus_one_if_a_value_is_greater_than_the_element_in_a_single_element_array() { var input = new[] { 94 }; Assert.That(BinarySearch.Search(input, 602), Is.EqualTo(-1)); } [Test] public void <API key>() { var input = new[] { 6, 67, 123, 345, 456, 457, 490, 2002, 54321, 54322 }; Assert.That(BinarySearch.Search(input, 2002), Is.EqualTo(7)); } [Test] public void <API key>() { var input = new[] { 6, 67, 123, 345, 456, 457, 490, 2002, 54321, 54322 }; Assert.That(BinarySearch.Search(input, 6), Is.EqualTo(0)); } [Test] public void <API key>() { var input = new[] { 6, 67, 123, 345, 456, 457, 490, 2002, 54321, 54322 }; Assert.That(BinarySearch.Search(input, 54322), Is.EqualTo(9)); } [Test] public void <API key>() { var input = new[] { 6, 67, 123, 345, 456, 457, 490, 2002, 54321, 54322 }; Assert.That(BinarySearch.Search(input, 2), Is.EqualTo(-1)); } [Test] public void <API key>() { var input = new[] { 6, 67, 123, 345, 456, 457, 490, 2002, 54321, 54322 }; Assert.That(BinarySearch.Search(input, 54323), Is.EqualTo(-1)); } }
package com.ocdsoft.bacta.engine.service.scheduler; import com.google.inject.Inject; import com.google.inject.Singleton; import com.ocdsoft.bacta.engine.conf.BactaConfiguration; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.<API key>; import java.util.concurrent.TimeUnit; @Singleton public class <API key> implements SchedulerService { private final <API key> executor; @Inject public <API key>(BactaConfiguration configuration) { //TODO: What should the default really be? executor = Executors.<API key>(configuration.getIntWithDefault("Bacta/Services/Scheduler", "ThreadCount", 4)); } @Override public void execute(Task task) { executor.execute(task); } @Override public void schedule(Task task, long delay, TimeUnit unit) { Future<?> future = executor.schedule(task, delay, unit); task.setFuture(future); } @Override public void scheduleAtFixedRate(Task task, int initialDelay, int period, TimeUnit unit) { Future<?> future = executor.scheduleAtFixedRate(task, initialDelay, period, unit); task.setFuture(future); } }
namespace ProjectWithSecurity.Areas.HelpPage.ModelDescriptions { public class <API key> { public string Documentation { get; set; } public string Name { get; set; } public string Value { get; set; } } }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="/css/main.css"> <link rel="stylesheet" href="/font-awesome/css/font-awesome.min.css"> <title>Benjamin T. Skinner | University of Florida</title> </head> <body> <main> <header class="site-header"> <h1 class="site-title"><a href="/">Benjamin T. Skinner</a></h1> <h6 class="site-subtitle"><a href="/">Assistant Professor of Higher Education and Policy | University of Florida</a></h6> <nav class="site-nav"> <a href="/publications/" class="">Publications</a> <a href="/presentations/" class="">Presentations</a> <a href="/working/" class="">Working</a> <a href="/media/" class="active">Media</a> <a href="/teaching/" class="">Teaching</a> <a href="/code/" class="">Code</a> <a href="/data/" class="">Data</a> <a href="/visualizations/" class="">Visualizations</a> <a href="/repository/skinnercv.pdf">CV</a> <a href="https://github.com/btskinner"><i class="fa fa-github fa-2x"></i></a> <a href="https://twitter.com/btskinner"><i class="fa fa-twitter fa-2x"></i></a> <a href="mailto:btskinner@coe.ufl.edu"><i class="fa fa-envelope-o fa-2x"></i></a> </nav> </header> <article class="post"> <br> <h2 class="post-header"></h2> <h2 id="media">Media</h2> <ol class="bibliography"><li><span id="salman2021holc">Salman, J. (2021). Racial segregation is one reason some families have internet access and others don’t, new research finds. <i>Hechinger Report</i>.</span>&nbsp;&nbsp; <!-- Shields --> <!-- Published paper icon --> <!-- Images (poster / slides) icon --> <!-- Working paper icon --> <!-- Supplemental materials icon --> <!-- Replication code icon --> <!-- Offical software (PyPi / CRAN) icon --> <!-- GitHub repo icon --> <!-- Software manual (vignette) icon --> </li></ol> </article> <br> </main> <main> <div class="footer"> <p class="foot">& </div> </main> <script> (function(i,s,o,g,r,a,m){i['<API key>']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.<API key>(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script',' ga('create', 'UA-63981025-1', 'auto'); ga('send', 'pageview'); </script> </body> </html>
using ArtOfTest.WebAii.Controls.HtmlControls; using QA.UI.TestingFramework.Core; namespace QA.TelerikAcademy.Core.Base { public class <API key> : BaseElementMap { public readonly string UserNameExpression = "username".Class(); public HtmlSpan UserName { get { return this.Find.ByExpression<HtmlSpan>(UserNameExpression); } } public HtmlAnchor Logout { get { return this.Find.ById<HtmlAnchor>("ExitMI"); } } } }
Copyright (c) 2016 Dropbox, Inc. All rights reserved. Auto-generated by Stone, do not modify. #import <Foundation/Foundation.h> #import "<API key>.h" @class DBTEAMUserAddResult; @class <API key>; @class <API key>; <API key> #pragma mark - API Object The `UserAddResult` union. Result of trying to add secondary emails to a user. 'success' is the only value indicating that a user was successfully retrieved for adding secondary emails. The other values explain the type of error that occurred, and include the user for which the error occurred. This class implements the `DBSerializable` protocol (serialize and deserialize instance methods), which is required for all Obj-C SDK API route objects. @interface DBTEAMUserAddResult : NSObject <DBSerializable, NSCopying> #pragma mark - Instance fields The `<API key>` enum type represents the possible tag states with which the `DBTEAMUserAddResult` union can exist. typedef NS_CLOSED_ENUM(NSInteger, <API key>){ Describes a user and the results for each attempt to add a secondary email. <API key>, Specified user is not a valid target for adding secondary emails. <API key>, Secondary emails can only be added to verified users. <API key>, Secondary emails cannot be added to placeholder users. <API key>, (no description). <API key>, }; Represents the union's current tag state. @property (nonatomic, readonly) <API key> tag; Describes a user and the results for each attempt to add a secondary email. @note Ensure the `isSuccess` method returns true before accessing, otherwise a runtime exception will be raised. @property (nonatomic, readonly) <API key> *success; Specified user is not a valid target for adding secondary emails. @note Ensure the `isInvalidUser` method returns true before accessing, otherwise a runtime exception will be raised. @property (nonatomic, readonly) <API key> *invalidUser; Secondary emails can only be added to verified users. @note Ensure the `isUnverified` method returns true before accessing, otherwise a runtime exception will be raised. @property (nonatomic, readonly) <API key> *unverified; Secondary emails cannot be added to placeholder users. @note Ensure the `isPlaceholderUser` method returns true before accessing, otherwise a runtime exception will be raised. @property (nonatomic, readonly) <API key> *placeholderUser; #pragma mark - Constructors Initializes union class with tag state of "success". Description of the "success" tag state: Describes a user and the results for each attempt to add a secondary email. @param success Describes a user and the results for each attempt to add a secondary email. @return An initialized instance. - (instancetype)initWithSuccess:(<API key> *)success; Initializes union class with tag state of "invalid_user". Description of the "invalid_user" tag state: Specified user is not a valid target for adding secondary emails. @param invalidUser Specified user is not a valid target for adding secondary emails. @return An initialized instance. - (instancetype)initWithInvalidUser:(<API key> *)invalidUser; Initializes union class with tag state of "unverified". Description of the "unverified" tag state: Secondary emails can only be added to verified users. @param unverified Secondary emails can only be added to verified users. @return An initialized instance. - (instancetype)initWithUnverified:(<API key> *)unverified; Initializes union class with tag state of "placeholder_user". Description of the "placeholder_user" tag state: Secondary emails cannot be added to placeholder users. @param placeholderUser Secondary emails cannot be added to placeholder users. @return An initialized instance. - (instancetype)<API key>:(<API key> *)placeholderUser; Initializes union class with tag state of "other". @return An initialized instance. - (instancetype)initWithOther; - (instancetype)init NS_UNAVAILABLE; #pragma mark - Tag state methods Retrieves whether the union's current tag state has value "success". @note Call this method and ensure it returns true before accessing the `success` property, otherwise a runtime exception will be thrown. @return Whether the union's current tag state has value "success". - (BOOL)isSuccess; Retrieves whether the union's current tag state has value "invalid_user". @note Call this method and ensure it returns true before accessing the `invalidUser` property, otherwise a runtime exception will be thrown. @return Whether the union's current tag state has value "invalid_user". - (BOOL)isInvalidUser; Retrieves whether the union's current tag state has value "unverified". @note Call this method and ensure it returns true before accessing the `unverified` property, otherwise a runtime exception will be thrown. @return Whether the union's current tag state has value "unverified". - (BOOL)isUnverified; Retrieves whether the union's current tag state has value "placeholder_user". @note Call this method and ensure it returns true before accessing the `placeholderUser` property, otherwise a runtime exception will be thrown. @return Whether the union's current tag state has value "placeholder_user". - (BOOL)isPlaceholderUser; Retrieves whether the union's current tag state has value "other". @return Whether the union's current tag state has value "other". - (BOOL)isOther; Retrieves string value of union's current tag state. @return A human-readable string representing the union's current tag state. - (NSString *)tagName; @end #pragma mark - Serializer Object The serialization class for the `DBTEAMUserAddResult` union. @interface <API key> : NSObject Serializes `DBTEAMUserAddResult` instances. @param instance An instance of the `DBTEAMUserAddResult` API object. @return A json-compatible dictionary representation of the `DBTEAMUserAddResult` API object. + (nullable NSDictionary<NSString *, id> *)serialize:(DBTEAMUserAddResult *)instance; Deserializes `DBTEAMUserAddResult` instances. @param dict A json-compatible dictionary representation of the `DBTEAMUserAddResult` API object. @return An instantiation of the `DBTEAMUserAddResult` object. + (DBTEAMUserAddResult *)deserialize:(NSDictionary<NSString *, id> *)dict; @end <API key>
export const barChart2 = {"viewBox":"0 0 24 24","children":[{"name":"line","attribs":{"x1":"18","y1":"20","x2":"18","y2":"10"},"children":[]},{"name":"line","attribs":{"x1":"12","y1":"20","x2":"12","y2":"4"},"children":[]},{"name":"line","attribs":{"x1":"6","y1":"20","x2":"6","y2":"14"},"children":[]}],"attribs":{"fill":"none","stroke":"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}};
layout: post title: "Cloud Native Camel riding With JBoss Fuse and OpenShift" modified: categories: comments: true tags: [apache, camel, activemq, microservices, docker, kubernetes, openshift, cloud] image: feature: date: 2016-02-02T08:52:57-07:00 Red Hat [recently released a Microservices integration toolkit](https: ![openshift](/images/ose.png) ## What is Fuse Integration Services (FIS) for OpenShift? FIS is a set of developer tools and Docker images from the [fabric8.io][fabric8] upstream community for packaging and deploying our applications that fit a model following a microservices architecture *and* opinionated best practices around application deployment, versioning, and lifecycle management. FIS is a Red Hat supported option for Fuse on OpenShift. ![openshift](/images/fabric8-logo.png) The two main ways of deploying Fuse Integration Services is via the Karaf, OSGI-based approach that Fuse has traditionally used, as well as a simpler, flat-class loader option that boots Camel from a plain old java main. Both options are packaged and shipped as Docker containers. Both are good options depending on what you're doing, so let's take a look. Camel Boot [Camel Boot][camel-boot] is a JVM bootstrap option that allows us to package our application using the same classpath that our maven project uses and boot our Apache Camel integrations using a Plain Old Java Main. This approach has a number of advantages that simplify building, assembling, distributing, and running our microservices. Foremost, we don't have to guess what our application behavior is based on hierarchies or graphs of complicated classloaders and whether we've included the correct metadata and dependencies so that classes may or may not resolve/collide/override/dynamically load/etc. We can simplify the model by just using a single, flat classloader to make it easier to reason about apps not only in Dev but throughout the application lifecycle (eg, in IST, UAT, PM, PROD, etc,etc). ![openshift](/images/camel-boot.png) Since this option is *not* meant to be deployed in any app-server (Java EE app server, Servlet container, OSGI container, etc), we will rely on our app to provide "just enough" functionality that you'd otherwise expect in a app-server -- stuff like HTTP, JMS, persistence, etc. So you can embed a Jetty or Undertow server inside our app to get HTTP services for REST or SOAP endpoints and can embed JMS clients like Spring-JMS and ActiveMQ libs to get messaging clients. This also makes it easier to unit test our app since all of those dependencies are included as part of the app and can be started, stopped, redeployed, etc independent of any app server. I would suggest this [Camel Boot][camel-boot] option for most use cases where you've decomposed and modularized your applications and need to run, tune, scale, and reason about them individually. However, there are cases where co-locating services together is necessary and so-long as the application classpath isn't getting too complicated (ie conflicting dependencies), Camel Boot should be a good option. If you're microservice is getting complicated because of cohesive, co-located services, consider the next option with Apache Karaf that allows you to finely control the classloader behavior and isolate modules and APIs within a single app/JVM process. "immutable" Apache Karaf Fuse Integration Services also offers an option for deploying to Apache Karaf based JVMs, although the model is slightly different because we follow the Docker model of "immutable" deployments. It can get quite difficult to reason about the state of a JVM after hot-deploying/re-deploying applications into/out of a running JVM. In fact, you can [experience nasty, difficult to identify JVM leaks][leaks] as a result of this "dynamic" mutability of the JVM at runtime (especially a bad idea in production). The model encouraged by FIS is one of "shoot the old one and replace it" with a new version (and rely on the cluster manager to orchestrate this for you via [rolling upgrades or blue-green deloyments][rolling-upgrades], etc) What does this mean for Apache Karaf for FIS? Dynamic loading and unloading of bundles or altering configuration values at runtime to mutate application state is discouraged. Instead we encourage predictable startup ordering, understood configuration values, and pre-baked applications into the JVM. If things need to change, then you go through the application delivery pipeline to change/build/test/deploy a new version (via your CI/CD process ideally) just like you would for the above Camel-Boot option as well. So for Karaf for FIS, your app and all its dependencies get packaged, installed, resolved, and built at build-time into a [Karaf assembly][karaf-assembly] which is a custom distribution of Karaf with your app baked into it. No more guessing about OSGI metadata and class resolution at deploy time; it's all pre-calculated and fails-fast at build time if things don't resolve. You can be much more confident in your OSGI app if things build successfully. Although the Camel Boot option is recommended for most use cases, for existing JBoss Fuse deployments outside of OpenShift/Kubernetes/Docker this Karaf-based option may be your best option for migrating existing Fuse workloads to this model (and take advantage of CI/CD, service discovery, cluster management, etc -- already built into OpenShift). Also if you're co-locating many services that end up polluting a flat-classpath the immutable Karaf option is great for providing more granular classpath isolation and API/modularity modeling. ## Deploying to Kubernetes/OpenShift To deploy to OpenShift, we need to do the following: * Package our JVM (either camel-boot or immutable karaf) * Build our Docker containers * Generate and apply our OpenShift/Kubernetes config Packaging Camel Boot apps To package our Camel Boot apps, all we need to do is include a maven `<build/>` plugin that handles all of it for us. {% highlight xml %} <plugin> <groupId>io.fabric8</groupId> <artifactId><API key></artifactId> <version>${fabric8.version}</version> <executions> <execution> <id>hawt-app</id> <goals> <goal>build</goal> </goals> <configuration> <javaMainClass>org.apache.camel.spring.Main</javaMainClass> </configuration> </execution> </executions> </plugin> {% endhighlight %} In the above configuration for the `<API key>` we can see that we just specify a plain old Java Main which will boot camel into the dependency injection context or your choice (Spring, CDI, etc) and discover all of your Spring/CDI resources as well as discover and start your Camel routes. The different types of Main.java files you can use are:
module Workers class SetDefault include SideJob::Worker register( description: 'Sets the default value to the last value received or input default value', icon: 'clipboard', inports: { in: { type: 'all', description: 'Input data' }, }, outports: { out: { type: 'all', description: 'Output data' }, }, ) def perform entries = input(:in).entries if input(:in).default? output(:out).default = input(:in).default elsif entries.length > 0 output(:out).default = entries.last end end end end
<footer class="space"><span>@2015 - {{ site.name}}</span></footer>
#pragma once class SyntaxTreeNode; class TokenStream; class SyntaxTree{ SyntaxTreeNode *rootNode; void expandEquivalence(SyntaxTreeNode &); void expandImplication(SyntaxTreeNode &); void resolveNegation(SyntaxTreeNode &); void <API key>(SyntaxTreeNode &); void expandEquivalences(); void expandImplications(); void resolveNegations(); bool <API key>(); public: class LevelIterator; class InOrderIterator; LevelIterator begin(); LevelIterator end(); InOrderIterator beginInOrder(); InOrderIterator endInOrder(); SyntaxTree(TokenStream&); ~SyntaxTree(); void generateKNF(); void print(); };
require 'minitest_helper' describe AmazonMercantile::Request do before :all do stub_request(:any, /^https:\/\/mws\.amazonservices\.com/) end after :all do WebMock.reset! end let(:request) { AmazonMercantile::Request.new(:post, '/', action: :submit_feed, body: 'test') } describe '.new' do it { lambda{ AmazonMercantile::Request.new() }.must_raise ArgumentError } it { lambda{ AmazonMercantile::Request.new(:post) }.must_raise ArgumentError } it { lambda{ AmazonMercantile::Request.new(:post, '/') }.must_raise ArgumentError } end describe '#submit' do before :each do request.submit end it { request.timestamp.wont_be_nil } it { request.signature.wont_be_nil } end describe '#response' do before :each do request.submit end it { request.response.must_be_instance_of AmazonMercantile::Response } end end
/** * @file RoundRect2.hpp * @brief RoundRect2 class prototype. * @author zer0 * @date 2020-01-19 */ #ifndef <API key> #define <API key> // MS compatible compilers support #pragma once #if defined(_MSC_VER) && (_MSC_VER >= 1020) #pragma once #endif #include <libtbag/config.h> #include <libtbag/predef.hpp> #include <libtbag/geometry/Point2.hpp> #include <cstdint> #include <algorithm> #include <sstream> #include <ostream> #include <string> <API key> namespace geometry { /** * 2-dimensions RoundRect template class. * * @author zer0 * @date 2020-01-19 */ template <typename BaseType> struct BaseRoundRect2 { using Type = BaseType; Type x, y; Type width, height; Type rx, ry; BaseRoundRect2() : x(), y(), width(), height(), rx(), ry() { /* EMPTY. */ } BaseRoundRect2(Type const & x_, Type const & y_, Type const & w_, Type const & h_, Type const & rx_, Type const & ry_) : x(x_), y(y_), width(w_), height(h_), rx(rx_), ry(ry_) { /* EMPTY. */ } template <typename T> BaseRoundRect2(BasePoint2<T> const & p, BaseSize2<T> const & s, BasePoint2<T> const & r) : x(p.x), y(p.y), width(s.width), height(s.height), rx(r.x), ry(r.y) { /* EMPTY. */ } template <typename T> BaseRoundRect2(BasePoint2<T> const & lt, BasePoint2<T> const & rb, BasePoint2<T> const & r) : x(lt.x), y(lt.y), width(rb.x - lt.x), height(rb.y - lt.y), rx(r.x), ry(r.y) { /* EMPTY. */ } template <typename T> BaseRoundRect2(BaseRoundRect2<T> const & obj) : x(obj.x), y(obj.y), width(obj.width), height(obj.height), rx(obj.rx), ry(obj.ry) { /* EMPTY. */ } ~BaseRoundRect2() { /* EMPTY. */ } inline BasePoint2<Type> point () const { return BasePoint2<Type>(x, y); } inline BasePoint2<Type> point1() const { return point(); } inline BasePoint2<Type> point2() const { return BasePoint2<Type>(x + width, y + height); } inline BasePoint2<Type> center() const { return BasePoint2<Type>(x + (width * 0.5), y + (height * 0.5)); } inline BasePoint2<Type> round () const { return BasePoint2<Type>(rx, ry); } inline BaseSize2<Type> size() const { return BaseSize2<Type>(width, height); } inline BaseSize2<Type> half() const { return BaseSize2<Type>(width * 0.5, height * 0.5); } inline Type area() const { return width * height; } inline bool empty() const { return width <= 0 || height <= 0; } template <typename T> BaseRoundRect2 & operator =(BaseRoundRect2<T> const & obj) { if (this != &obj) { x = obj.x; y = obj.y; width = obj.width; height = obj.height; rx = obj.rx; ry = obj.ry; } return *this; } void swap(BaseRoundRect2 & obj) { if (this != &obj) { std::swap(x, obj.x); std::swap(y, obj.y); std::swap(width, obj.width); std::swap(height, obj.height); std::swap(rx, obj.rx); std::swap(ry, obj.ry); } } friend void swap(BaseRoundRect2 & lh, BaseRoundRect2 & rh) { lh.swap(rh); } template <typename T> operator BaseRoundRect2<T>() const { return BaseRoundRect2<T>(static_cast<T>(x), static_cast<T>(y), static_cast<T>(width), static_cast<T>(height), static_cast<T>(rx), static_cast<T>(ry)); } template <typename T> bool operator ==(BaseRoundRect2<T> const & obj) const { return x == obj.x && y == obj.y && width == obj.width && height == obj.height && rx == obj.rx && ry == obj.ry; } template <typename T> bool operator !=(BaseRoundRect2<T> const & obj) const { return !((*this) == obj); } TBAG_CONSTEXPR static char const DEFAULT_DELIMITER1 = 'x'; TBAG_CONSTEXPR static char const DEFAULT_DELIMITER2 = '/'; std::string toString() const { std::stringstream ss; ss << x << DEFAULT_DELIMITER1 << y << DEFAULT_DELIMITER1 << width << DEFAULT_DELIMITER1 << height << DEFAULT_DELIMITER2 << rx << DEFAULT_DELIMITER1 << ry; return ss.str(); } template <typename OtherType> OtherType toOther() const { return OtherType{x, y, width, height, rx, ry}; } template <class CharT, class TraitsT> friend std::basic_ostream<CharT, TraitsT> & operator<<(std::basic_ostream<CharT, TraitsT> & os, BaseRoundRect2 const & p) { os << p.toString(); return os; } }; // Pre-defined. using RoundRect2b = BaseRoundRect2<bool>; using RoundRect2c = BaseRoundRect2<char>; using RoundRect2s = BaseRoundRect2<short>; using RoundRect2i = BaseRoundRect2<int>; using RoundRect2u = BaseRoundRect2<unsigned>; using RoundRect2l = BaseRoundRect2<long>; using RoundRect2ll = BaseRoundRect2<int64_t>; using RoundRect2f = BaseRoundRect2<float>; using RoundRect2d = BaseRoundRect2<double>; using RoundRect2 = RoundRect2i; } // namespace geometry <API key> #endif // <API key>
require 'open-uri' require 'net/http' require 'nokogiri' module CanHazPoster class PosterGrabber SERVICE_HOST = "http: SEARCH_PATH = "/search/?query=%{query}" MOVIE_PATH = "/movie/%{id}" def grab_poster(title, year) movie_url = parse_movie_url(<API key>(title), year) parse_poster_url(fetch_movie_page(movie_url)) end def grab_poster_by_imdb(imdb_id) movie_url = SERVICE_HOST + MOVIE_PATH % {id: imdb_id} parse_poster_url(fetch_movie_page(movie_url)) end private def <API key>(title) open(SERVICE_HOST + SEARCH_PATH % {query: URI.<API key>(title)}) end def fetch_movie_page(url) open(url) end def parse_movie_url(page, year) doc = Nokogiri::HTML(page) cell = doc.css('.content td:nth-child(2)').find do |cell| year_node = cell.at_css('span b') year_node && year_node.content == year.to_s end raise MovieNotFoundError if cell.nil? SERVICE_HOST + cell.at_css('a')['href'] end def parse_poster_url(page) doc = Nokogiri::HTML(page) doc.at_css('.poster a > img')['data-original'] end end end
import datetime import patroni.zookeeper import psycopg2 import subprocess import sys import time import unittest import yaml from mock import Mock, patch from patroni.api import RestApiServer from patroni.dcs import Cluster, Member, Leader from patroni.etcd import Etcd from patroni.exceptions import DCSError, PostgresException from patroni import Patroni, main from patroni.zookeeper import ZooKeeper from six.moves import BaseHTTPServer from test_api import <API key> from test_etcd import Client, etcd_read, etcd_write from test_ha import true, false from test_postgresql import Postgresql, subprocess_call, psycopg2_connect from test_zookeeper import MockKazooClient def nop(*args, **kwargs): pass class SleepException(Exception): pass def time_sleep(*args): raise SleepException() def keyboard_interrupt(*args): raise KeyboardInterrupt class <API key>: def wait(self): pass def set(self): pass def clear(self): pass def get_cluster(initialize, leader): return Cluster(initialize, leader, None, None) def <API key>(): return get_cluster(None, None) def <API key>(): return get_cluster(True, None) def <API key>(): return get_cluster(False, Leader(0, 0, 0, Member(0, 'leader', 'postgres://replicator:rep-pass@127.0.0.1:5435/postgres', None, None, 28))) def <API key>(): return get_cluster(True, Leader(0, 0, 0, Member(0, 'leader', 'postgres://replicator:rep-pass@127.0.0.1:5435/postgres', None, None, 28))) def <API key>(): raise DCSError('') class TestPatroni(unittest.TestCase): def __init__(self, method_name='runTest'): self.setUp = self.set_up self.tearDown = self.tear_down super(TestPatroni, self).__init__(method_name) def set_up(self): self.touched = False self.init_cancelled = False subprocess.call = subprocess_call psycopg2.connect = psycopg2_connect self.time_sleep = time.sleep time.sleep = nop self.write_pg_hba = Postgresql.write_pg_hba self.write_recovery_conf = Postgresql.write_recovery_conf Postgresql.write_pg_hba = nop Postgresql.write_recovery_conf = nop BaseHTTPServer.HTTPServer.__init__ = nop RestApiServer.<API key> = <API key>() RestApiServer.<API key> = True RestApiServer.socket = 0 with open('postgres0.yml', 'r') as f: config = yaml.load(f) with patch.object(Client, 'machines') as mock_machines: mock_machines.__get__ = Mock(return_value=['http://remotehost:2379']) self.p = Patroni(config) def tear_down(self): time.sleep = self.time_sleep Postgresql.write_pg_hba = self.write_pg_hba Postgresql.write_recovery_conf = self.write_recovery_conf def test_get_dcs(self): patroni.zookeeper.KazooClient = MockKazooClient self.assertIsInstance(self.p.get_dcs('', {'zookeeper': {'scope': '', 'hosts': ''}}), ZooKeeper) self.assertRaises(Exception, self.p.get_dcs, '', {}) def test_patroni_main(self): main() sys.argv = ['patroni.py', 'postgres0.yml'] time.sleep = time_sleep with patch.object(Client, 'machines') as mock_machines: mock_machines.__get__ = Mock(return_value=['http://remotehost:2379']) Patroni.initialize = nop touch_member = Patroni.touch_member run = Patroni.run Patroni.touch_member = self.touch_member Patroni.run = time_sleep Etcd.delete_leader = nop self.assertRaises(SleepException, main) Patroni.run = keyboard_interrupt main() Patroni.run = run Patroni.touch_member = touch_member def test_patroni_run(self): time.sleep = time_sleep self.p.touch_member = self.touch_member self.p.ha.state_handler.<API key> = time_sleep self.p.ha.dcs.client.read = etcd_read self.p.ha.dcs.watch = time_sleep self.assertRaises(SleepException, self.p.run) self.p.ha.state_handler.is_leader = false self.p.api.start = nop self.assertRaises(SleepException, self.p.run) def touch_member(self, ttl=None): if not self.touched: self.touched = True return False return True def test_touch_member(self): self.p.ha.dcs.client.write = etcd_write self.p.touch_member() now = datetime.datetime.utcnow() member = Member(0, self.p.postgresql.name, 'b', 'c', (now + datetime.timedelta( seconds=self.p.shutdown_member_ttl + 10)).strftime('%Y-%m-%dT%H:%M:%S.%fZ'), None) self.p.ha.cluster = Cluster(True, member, 0, [member]) self.p.touch_member() def <API key>(self): self.p.ha.dcs.client.write = etcd_write self.p.ha.dcs.client.read = etcd_read self.p.touch_member = self.touch_member self.p.postgresql.<API key> = true self.p.ha.dcs.initialize = true self.p.postgresql.initialize = true self.p.postgresql.start = true self.p.ha.dcs.get_cluster = <API key> self.p.initialize() self.p.ha.dcs.initialize = false self.p.ha.dcs.get_cluster = <API key> time.sleep = time_sleep self.p.ha.dcs.client.read = etcd_read self.p.initialize() self.p.ha.dcs.get_cluster = <API key> self.assertRaises(SleepException, self.p.initialize) self.p.postgresql.<API key> = false self.p.initialize() self.p.ha.dcs.get_cluster = <API key> self.p.postgresql.<API key> = true self.p.initialize() self.p.ha.dcs.get_cluster = <API key> self.assertRaises(SleepException, self.p.initialize) def <API key>(self): self.p.ha.dcs.watch = lambda e: True self.p.schedule_next_run() self.p.next_run = time.time() - self.p.nap_time - 1 self.p.schedule_next_run() def <API key>(self): self.init_cancelled = True def <API key>(self): self.p.ha.dcs.client.write = etcd_write self.p.ha.dcs.client.read = etcd_read self.p.ha.dcs.get_cluster = <API key> self.p.touch_member = self.touch_member self.p.postgresql.<API key> = true self.p.ha.dcs.initialize = true self.p.postgresql.initialize = true self.p.postgresql.start = false self.p.ha.dcs.<API key> = self.<API key> self.assertRaises(PostgresException, self.p.initialize) self.assertTrue(self.init_cancelled)
CREATE PROCEDURE [dbo].[<API key>] ( @pRowCnt INT = 10, @pHTML NVARCHAR(MAX) OUTPUT ) AS BEGIN SET NOCOUNT ON; DECLARE @tOutput TABLE ( [SP Name] NVARCHAR(128), [Avg IO] BIGINT, [Execution Count] BIGINT, [Query Text] NVARCHAR(MAX) ); -- Lists the top statements by average input/output usage for the current database INSERT INTO [dbo].[<API key>] ( [ReportDate], [SP Name], [Avg IO], [Execution Count], [Query Text] ) OUTPUT inserted.[SP Name], inserted.[Avg IO], inserted.[Execution Count], inserted.[Query Text] INTO @tOutput SELECT TOP(@pRowCnt) GETDATE() AS [ReportDate], p.name AS [SP Name], (qs.total_logical_reads + qs.<API key>) / qs.execution_count AS [Avg IO], qs.execution_count AS [Execution Count], SUBSTRING(qt.[text], qs.<API key>/2,8000) AS [Query Text] FROM [$(TargetDBName)].sys.dm_exec_query_stats AS qs WITH (NOLOCK) CROSS APPLY [$(TargetDBName)].sys.dm_exec_sql_text(qs.sql_handle) AS qt JOIN [$(TargetDBName)].sys.procedures AS p WITH (NOLOCK) ON p.object_id = qt.objectid WHERE qt.[dbid] = DB_ID('$(TargetDBName)') AND NOT EXISTS (SELECT 1 FROM dbo._Exception AS e WHERE e.ObjectName = p.name) ORDER BY [Avg IO] DESC OPTION (RECOMPILE); -- Helps you find the most expensive statements for I/O by SP SET @pHTML = N' <div class="header" id="1-header">Cached Queries By IO Cost</div><div class="content" id="1-content"><div class="text">' + ISNULL(N'<table>' + N'<tr>'+ N'<th style="width: 10%;">SP Name</th>' + N'<th style="width: 3%;">Avg IO</th>' + N'<th style="width: 2%;">Execution Count</th>' + N'<th style="width: 85%;">Query Text</th>' + N'</tr>' + CAST ( ( SELECT td=REPLACE(ISNULL([SP Name],''),'"',''),'', td=REPLACE(ISNULL(CAST([Avg IO] AS NVARCHAR(MAX)),''),'"',''),'', td=REPLACE(ISNULL(CAST([Execution Count] AS NVARCHAR(MAX)),''),'"',''),'', td=REPLACE(ISNULL([Query Text],''),'"','') FROM @tOutput FOR XML PATH('tr'), TYPE ) AS NVARCHAR(MAX) ) + N'</table>','NO DATA') + N'</div></div>' ; SET @pHTML = REPLACE(@pHTML,'&#x0D;',''); END
package com.blackcrowsys.canvas; public class CanvasFactory { /** * Creates a new Canvas object. Only console canvas supported. * * @param width the width of the canvas * @param height the height of the canvas * @return the instance of canvas */ public Canvas create(int width, int height) { return new ConsoleCanvas(width, height); } }
// <auto-generated> // This code was generated by CSGenerator. // </auto-generated> using UnityEngine; using System; using System.Collections; using System.Collections.Generic; using System.Reflection; using DG.Tweening; using jsval = JSApi.jsval; public class <API key> { /////////////////// TweenParams /////////////////////////////////////// // constructors static bool <API key>(JSVCall vc, int argc) { int _this = JSApi.getObject((int)JSApi.GetType.Arg); JSApi.<API key>(_this); --argc; int len = argc; if (len == 0) { JSMgr.addJSCSRel(_this, new DG.Tweening.TweenParams()); } return true; } // fields static void TweenParams_Params(JSVCall vc) { var result = DG.Tweening.TweenParams.Params; JSMgr.datax.setObject((int)JSApi.SetType.Rval, result); } // properties // methods static bool TweenParams_Clear(JSVCall vc, int argc) { int len = argc; if (len == 0) { JSMgr.datax.setObject((int)JSApi.SetType.Rval, ((DG.Tweening.TweenParams)vc.csObj).Clear()); } return true; } public static DG.Tweening.TweenCallback <API key>(CSRepresentedObject objFunction) { if (objFunction == null || objFunction.jsObjID == 0) { return null; } var action = JSMgr.<API key><DG.Tweening.TweenCallback>(objFunction.jsObjID); if (action == null) { action = () => { JSMgr.vCall.CallJSFunctionValue(0, objFunction.jsObjID); }; JSMgr.<API key>(objFunction.jsObjID, action); } return action; } static bool <API key>(JSVCall vc, int argc) { int len = argc; if (len == 1) { DG.Tweening.TweenCallback arg0 = JSDataExchangeMgr.GetJSArg<DG.Tweening.TweenCallback>(()=> { if (JSApi.isFunctionS((int)JSApi.GetType.Arg)) return <API key>(JSApi.getFunctionS((int)JSApi.GetType.Arg)); else return (DG.Tweening.TweenCallback)JSMgr.datax.getObject((int)JSApi.GetType.Arg); }); JSMgr.datax.setObject((int)JSApi.SetType.Rval, ((DG.Tweening.TweenParams)vc.csObj).OnComplete(arg0)); } return true; } public static DG.Tweening.TweenCallback <API key>(CSRepresentedObject objFunction) { if (objFunction == null || objFunction.jsObjID == 0) { return null; } var action = JSMgr.<API key><DG.Tweening.TweenCallback>(objFunction.jsObjID); if (action == null) { action = () => { JSMgr.vCall.CallJSFunctionValue(0, objFunction.jsObjID); }; JSMgr.<API key>(objFunction.jsObjID, action); } return action; } static bool <API key>(JSVCall vc, int argc) { int len = argc; if (len == 1) { DG.Tweening.TweenCallback arg0 = JSDataExchangeMgr.GetJSArg<DG.Tweening.TweenCallback>(()=> { if (JSApi.isFunctionS((int)JSApi.GetType.Arg)) return <API key>(JSApi.getFunctionS((int)JSApi.GetType.Arg)); else return (DG.Tweening.TweenCallback)JSMgr.datax.getObject((int)JSApi.GetType.Arg); }); JSMgr.datax.setObject((int)JSApi.SetType.Rval, ((DG.Tweening.TweenParams)vc.csObj).OnKill(arg0)); } return true; } public static DG.Tweening.TweenCallback <API key>(CSRepresentedObject objFunction) { if (objFunction == null || objFunction.jsObjID == 0) { return null; } var action = JSMgr.<API key><DG.Tweening.TweenCallback>(objFunction.jsObjID); if (action == null) { action = () => { JSMgr.vCall.CallJSFunctionValue(0, objFunction.jsObjID); }; JSMgr.<API key>(objFunction.jsObjID, action); } return action; } static bool <API key>(JSVCall vc, int argc) { int len = argc; if (len == 1) { DG.Tweening.TweenCallback arg0 = JSDataExchangeMgr.GetJSArg<DG.Tweening.TweenCallback>(()=> { if (JSApi.isFunctionS((int)JSApi.GetType.Arg)) return <API key>(JSApi.getFunctionS((int)JSApi.GetType.Arg)); else return (DG.Tweening.TweenCallback)JSMgr.datax.getObject((int)JSApi.GetType.Arg); }); JSMgr.datax.setObject((int)JSApi.SetType.Rval, ((DG.Tweening.TweenParams)vc.csObj).OnPlay(arg0)); } return true; } public static DG.Tweening.TweenCallback <API key>(CSRepresentedObject objFunction) { if (objFunction == null || objFunction.jsObjID == 0) { return null; } var action = JSMgr.<API key><DG.Tweening.TweenCallback>(objFunction.jsObjID); if (action == null) { action = () => { JSMgr.vCall.CallJSFunctionValue(0, objFunction.jsObjID); }; JSMgr.<API key>(objFunction.jsObjID, action); } return action; } static bool <API key>(JSVCall vc, int argc) { int len = argc; if (len == 1) { DG.Tweening.TweenCallback arg0 = JSDataExchangeMgr.GetJSArg<DG.Tweening.TweenCallback>(()=> { if (JSApi.isFunctionS((int)JSApi.GetType.Arg)) return <API key>(JSApi.getFunctionS((int)JSApi.GetType.Arg)); else return (DG.Tweening.TweenCallback)JSMgr.datax.getObject((int)JSApi.GetType.Arg); }); JSMgr.datax.setObject((int)JSApi.SetType.Rval, ((DG.Tweening.TweenParams)vc.csObj).OnRewind(arg0)); } return true; } public static DG.Tweening.TweenCallback <API key>(CSRepresentedObject objFunction) { if (objFunction == null || objFunction.jsObjID == 0) { return null; } var action = JSMgr.<API key><DG.Tweening.TweenCallback>(objFunction.jsObjID); if (action == null) { action = () => { JSMgr.vCall.CallJSFunctionValue(0, objFunction.jsObjID); }; JSMgr.<API key>(objFunction.jsObjID, action); } return action; } static bool <API key>(JSVCall vc, int argc) { int len = argc; if (len == 1) { DG.Tweening.TweenCallback arg0 = JSDataExchangeMgr.GetJSArg<DG.Tweening.TweenCallback>(()=> { if (JSApi.isFunctionS((int)JSApi.GetType.Arg)) return <API key>(JSApi.getFunctionS((int)JSApi.GetType.Arg)); else return (DG.Tweening.TweenCallback)JSMgr.datax.getObject((int)JSApi.GetType.Arg); }); JSMgr.datax.setObject((int)JSApi.SetType.Rval, ((DG.Tweening.TweenParams)vc.csObj).OnStart(arg0)); } return true; } public static DG.Tweening.TweenCallback <API key>(CSRepresentedObject objFunction) { if (objFunction == null || objFunction.jsObjID == 0) { return null; } var action = JSMgr.<API key><DG.Tweening.TweenCallback>(objFunction.jsObjID); if (action == null) { action = () => { JSMgr.vCall.CallJSFunctionValue(0, objFunction.jsObjID); }; JSMgr.<API key>(objFunction.jsObjID, action); } return action; } static bool <API key>(JSVCall vc, int argc) { int len = argc; if (len == 1) { DG.Tweening.TweenCallback arg0 = JSDataExchangeMgr.GetJSArg<DG.Tweening.TweenCallback>(()=> { if (JSApi.isFunctionS((int)JSApi.GetType.Arg)) return <API key>(JSApi.getFunctionS((int)JSApi.GetType.Arg)); else return (DG.Tweening.TweenCallback)JSMgr.datax.getObject((int)JSApi.GetType.Arg); }); JSMgr.datax.setObject((int)JSApi.SetType.Rval, ((DG.Tweening.TweenParams)vc.csObj).OnStepComplete(arg0)); } return true; } public static DG.Tweening.TweenCallback <API key>(CSRepresentedObject objFunction) { if (objFunction == null || objFunction.jsObjID == 0) { return null; } var action = JSMgr.<API key><DG.Tweening.TweenCallback>(objFunction.jsObjID); if (action == null) { action = () => { JSMgr.vCall.CallJSFunctionValue(0, objFunction.jsObjID); }; JSMgr.<API key>(objFunction.jsObjID, action); } return action; } static bool <API key>(JSVCall vc, int argc) { int len = argc; if (len == 1) { DG.Tweening.TweenCallback arg0 = JSDataExchangeMgr.GetJSArg<DG.Tweening.TweenCallback>(()=> { if (JSApi.isFunctionS((int)JSApi.GetType.Arg)) return <API key>(JSApi.getFunctionS((int)JSApi.GetType.Arg)); else return (DG.Tweening.TweenCallback)JSMgr.datax.getObject((int)JSApi.GetType.Arg); }); JSMgr.datax.setObject((int)JSApi.SetType.Rval, ((DG.Tweening.TweenParams)vc.csObj).OnUpdate(arg0)); } return true; } public static TweenCallback<System.Int32> <API key>(CSRepresentedObject objFunction) { if (objFunction == null || objFunction.jsObjID == 0) { return null; } var action = JSMgr.<API key><TweenCallback<System.Int32>>(objFunction.jsObjID); if (action == null) { action = (value) => { JSMgr.vCall.CallJSFunctionValue(0, objFunction.jsObjID, value); }; JSMgr.<API key>(objFunction.jsObjID, action); } return action; } static bool <API key>(JSVCall vc, int argc) { int len = argc; if (len == 1) { TweenCallback<System.Int32> arg0 = JSDataExchangeMgr.GetJSArg<TweenCallback<System.Int32>>(()=> { if (JSApi.isFunctionS((int)JSApi.GetType.Arg)) return <API key>(JSApi.getFunctionS((int)JSApi.GetType.Arg)); else return (TweenCallback<System.Int32>)JSMgr.datax.getObject((int)JSApi.GetType.Arg); }); JSMgr.datax.setObject((int)JSApi.SetType.Rval, ((DG.Tweening.TweenParams)vc.csObj).OnWaypointChange(arg0)); } return true; } static bool <API key>(JSVCall vc, int argc) { int len = argc; if (len == 0) { JSMgr.datax.setObject((int)JSApi.SetType.Rval, ((DG.Tweening.TweenParams)vc.csObj).SetAutoKill()); } else if (len == 1) { System.Boolean arg0 = (System.Boolean)JSApi.getBooleanS((int)JSApi.GetType.Arg); JSMgr.datax.setObject((int)JSApi.SetType.Rval, ((DG.Tweening.TweenParams)vc.csObj).SetAutoKill(arg0)); } return true; } static bool <API key>(JSVCall vc, int argc) { int len = argc; if (len == 1) { System.Single arg0 = (System.Single)JSApi.getSingle((int)JSApi.GetType.Arg); JSMgr.datax.setObject((int)JSApi.SetType.Rval, ((DG.Tweening.TweenParams)vc.csObj).SetDelay(arg0)); } return true; } static bool <API key>(JSVCall vc, int argc) { int len = argc; if (len == 1) { DG.Tweening.Ease arg0 = (DG.Tweening.Ease)JSApi.getEnum((int)JSApi.GetType.Arg); JSMgr.datax.setObject((int)JSApi.SetType.Rval, ((DG.Tweening.TweenParams)vc.csObj).SetEase(arg0)); } else if (len == 2) { DG.Tweening.Ease arg0 = (DG.Tweening.Ease)JSApi.getEnum((int)JSApi.GetType.Arg); Nullable<System.Single> arg1 = (Nullable<System.Single>)JSMgr.datax.getObject((int)JSApi.GetType.Arg); JSMgr.datax.setObject((int)JSApi.SetType.Rval, ((DG.Tweening.TweenParams)vc.csObj).SetEase(arg0, arg1)); } else if (len == 3) { DG.Tweening.Ease arg0 = (DG.Tweening.Ease)JSApi.getEnum((int)JSApi.GetType.Arg); Nullable<System.Single> arg1 = (Nullable<System.Single>)JSMgr.datax.getObject((int)JSApi.GetType.Arg); Nullable<System.Single> arg2 = (Nullable<System.Single>)JSMgr.datax.getObject((int)JSApi.GetType.Arg); JSMgr.datax.setObject((int)JSApi.SetType.Rval, ((DG.Tweening.TweenParams)vc.csObj).SetEase(arg0, arg1, arg2)); } return true; } static bool <API key>(JSVCall vc, int argc) { int len = argc; if (len == 1) { UnityEngine.AnimationCurve arg0 = (UnityEngine.AnimationCurve)JSMgr.datax.getObject((int)JSApi.GetType.Arg); JSMgr.datax.setObject((int)JSApi.SetType.Rval, ((DG.Tweening.TweenParams)vc.csObj).SetEase(arg0)); } return true; } public static DG.Tweening.EaseFunction <API key>(CSRepresentedObject objFunction) { if (objFunction == null || objFunction.jsObjID == 0) { return null; } var action = JSMgr.<API key><DG.Tweening.EaseFunction>(objFunction.jsObjID); if (action == null) { action = (time, duration, <API key>, period) => { JSMgr.vCall.CallJSFunctionValue(0, objFunction.jsObjID, time, duration, <API key>, period); return (System.Single)JSApi.getSingle((int)JSApi.GetType.JSFunRet); }; JSMgr.<API key>(objFunction.jsObjID, action); } return action; } static bool <API key>(JSVCall vc, int argc) { int len = argc; if (len == 1) { DG.Tweening.EaseFunction arg0 = JSDataExchangeMgr.GetJSArg<DG.Tweening.EaseFunction>(()=> { if (JSApi.isFunctionS((int)JSApi.GetType.Arg)) return <API key>(JSApi.getFunctionS((int)JSApi.GetType.Arg)); else return (DG.Tweening.EaseFunction)JSMgr.datax.getObject((int)JSApi.GetType.Arg); }); JSMgr.datax.setObject((int)JSApi.SetType.Rval, ((DG.Tweening.TweenParams)vc.csObj).SetEase(arg0)); } return true; } static bool <API key>(JSVCall vc, int argc) { int len = argc; if (len == 1) { System.Object arg0 = (System.Object)JSMgr.datax.getWhatever((int)JSApi.GetType.Arg); JSMgr.datax.setObject((int)JSApi.SetType.Rval, ((DG.Tweening.TweenParams)vc.csObj).SetId(arg0)); } return true; } static bool <API key>(JSVCall vc, int argc) { int len = argc; if (len == 1) { System.Int32 arg0 = (System.Int32)JSApi.getInt32((int)JSApi.GetType.Arg); JSMgr.datax.setObject((int)JSApi.SetType.Rval, ((DG.Tweening.TweenParams)vc.csObj).SetLoops(arg0)); } else if (len == 2) { System.Int32 arg0 = (System.Int32)JSApi.getInt32((int)JSApi.GetType.Arg); Nullable<DG.Tweening.LoopType> arg1 = (Nullable<DG.Tweening.LoopType>)JSMgr.datax.getObject((int)JSApi.GetType.Arg); JSMgr.datax.setObject((int)JSApi.SetType.Rval, ((DG.Tweening.TweenParams)vc.csObj).SetLoops(arg0, arg1)); } return true; } static bool <API key>(JSVCall vc, int argc) { int len = argc; if (len == 0) { JSMgr.datax.setObject((int)JSApi.SetType.Rval, ((DG.Tweening.TweenParams)vc.csObj).SetRecyclable()); } else if (len == 1) { System.Boolean arg0 = (System.Boolean)JSApi.getBooleanS((int)JSApi.GetType.Arg); JSMgr.datax.setObject((int)JSApi.SetType.Rval, ((DG.Tweening.TweenParams)vc.csObj).SetRecyclable(arg0)); } return true; } static bool <API key>(JSVCall vc, int argc) { int len = argc; if (len == 0) { JSMgr.datax.setObject((int)JSApi.SetType.Rval, ((DG.Tweening.TweenParams)vc.csObj).SetRelative()); } else if (len == 1) { System.Boolean arg0 = (System.Boolean)JSApi.getBooleanS((int)JSApi.GetType.Arg); JSMgr.datax.setObject((int)JSApi.SetType.Rval, ((DG.Tweening.TweenParams)vc.csObj).SetRelative(arg0)); } return true; } static bool <API key>(JSVCall vc, int argc) { int len = argc; if (len == 0) { JSMgr.datax.setObject((int)JSApi.SetType.Rval, ((DG.Tweening.TweenParams)vc.csObj).SetSpeedBased()); } else if (len == 1) { System.Boolean arg0 = (System.Boolean)JSApi.getBooleanS((int)JSApi.GetType.Arg); JSMgr.datax.setObject((int)JSApi.SetType.Rval, ((DG.Tweening.TweenParams)vc.csObj).SetSpeedBased(arg0)); } return true; } static bool <API key>(JSVCall vc, int argc) { int len = argc; if (len == 1) { System.Object arg0 = (System.Object)JSMgr.datax.getWhatever((int)JSApi.GetType.Arg); JSMgr.datax.setObject((int)JSApi.SetType.Rval, ((DG.Tweening.TweenParams)vc.csObj).SetTarget(arg0)); } return true; } static bool <API key>(JSVCall vc, int argc) { int len = argc; if (len == 1) { System.Boolean arg0 = (System.Boolean)JSApi.getBooleanS((int)JSApi.GetType.Arg); JSMgr.datax.setObject((int)JSApi.SetType.Rval, ((DG.Tweening.TweenParams)vc.csObj).SetUpdate(arg0)); } return true; } static bool <API key>(JSVCall vc, int argc) { int len = argc; if (len == 1) { DG.Tweening.UpdateType arg0 = (DG.Tweening.UpdateType)JSApi.getEnum((int)JSApi.GetType.Arg); JSMgr.datax.setObject((int)JSApi.SetType.Rval, ((DG.Tweening.TweenParams)vc.csObj).SetUpdate(arg0)); } else if (len == 2) { DG.Tweening.UpdateType arg0 = (DG.Tweening.UpdateType)JSApi.getEnum((int)JSApi.GetType.Arg); System.Boolean arg1 = (System.Boolean)JSApi.getBooleanS((int)JSApi.GetType.Arg); JSMgr.datax.setObject((int)JSApi.SetType.Rval, ((DG.Tweening.TweenParams)vc.csObj).SetUpdate(arg0, arg1)); } return true; } //register public static void __Register() { JSMgr.CallbackInfo ci = new JSMgr.CallbackInfo(); ci.type = typeof(DG.Tweening.TweenParams); ci.fields = new JSMgr.CSCallbackField[] { TweenParams_Params, }; ci.properties = new JSMgr.CSCallbackProperty[] { }; ci.constructors = new JSMgr.MethodCallBackInfo[] { new JSMgr.MethodCallBackInfo(<API key>, ".ctor"), }; ci.methods = new JSMgr.MethodCallBackInfo[] { new JSMgr.MethodCallBackInfo(TweenParams_Clear, "Clear"), new JSMgr.MethodCallBackInfo(<API key>, "OnComplete"), new JSMgr.MethodCallBackInfo(<API key>, "OnKill"), new JSMgr.MethodCallBackInfo(<API key>, "OnPlay"), new JSMgr.MethodCallBackInfo(<API key>, "OnRewind"), new JSMgr.MethodCallBackInfo(<API key>, "OnStart"), new JSMgr.MethodCallBackInfo(<API key>, "OnStepComplete"), new JSMgr.MethodCallBackInfo(<API key>, "OnUpdate"), new JSMgr.MethodCallBackInfo(<API key>, "OnWaypointChange"), new JSMgr.MethodCallBackInfo(<API key>, "SetAutoKill"), new JSMgr.MethodCallBackInfo(<API key>, "SetDelay"), new JSMgr.MethodCallBackInfo(<API key>, "SetEase"), new JSMgr.MethodCallBackInfo(<API key>, "SetEase"), new JSMgr.MethodCallBackInfo(<API key>, "SetEase"), new JSMgr.MethodCallBackInfo(<API key>, "SetId"), new JSMgr.MethodCallBackInfo(<API key>, "SetLoops"), new JSMgr.MethodCallBackInfo(<API key>, "SetRecyclable"), new JSMgr.MethodCallBackInfo(<API key>, "SetRelative"), new JSMgr.MethodCallBackInfo(<API key>, "SetSpeedBased"), new JSMgr.MethodCallBackInfo(<API key>, "SetTarget"), new JSMgr.MethodCallBackInfo(<API key>, "SetUpdate"), new JSMgr.MethodCallBackInfo(<API key>, "SetUpdate"), }; JSMgr.allCallbackInfo.Add(ci); } }
"use strict"; class gsuiTimeline extends HTMLElement { #status = "" #step = 1 #offset = null #scrollingAncestor = null #mousedownLoop = "" #onlyBigMeasures = false #mousedownDate = 0 #mousemoveBeat = 0 #mousedownBeat = 0 #mousedownLoopA = 0 #mousedownLoopB = 0 #dispatch = GSUI.dispatchEvent.bind( null, this, "gsuiTimeline" ) #onscrollBind = this.#onscroll.bind( this ) #onresizeBind = this.#onresize.bind( this ) #onmouseupBind = this.#onmouseup.bind( this ) #onmousemoveBind = this.#onmousemove.bind( this ) #children = GSUI.getTemplate( "gsui-timeline" ) #elements = GSUI.findElements( this.#children, { steps: ".gsuiTimeline-steps", beats: ".gsuiTimeline-beats", measures: ".<API key>", loop: ".gsuiTimeline-loop", timeLine: ".<API key>", cursor: ".gsuiTimeline-cursor", cursorPreview: ".<API key>", } ) constructor() { super(); this.beatsPerMeasure = 4; this.stepsPerBeat = 4; this.pxPerBeat = 10; this.pxPerMeasure = this.beatsPerMeasure * this.pxPerBeat; this.loopA = this.loopB = 0; this.looping = false; Object.seal( this ); this.#elements.cursorPreview.remove(); this.onmousedown = this.#onmousedown.bind( this ); } static numbering( from ) { document.body.style.setProperty( "--<API key>", +from ); } connectedCallback() { if ( !this.firstChild ) { this.append( ...this.#children ); this.#children = null; if ( !this.hasAttribute( "step" ) ) { GSUI.setAttribute( this, "step", 1 ); } } this.#scrollingAncestor = this.#<API key>( this.parentNode ); this.#scrollingAncestor.addEventListener( "scroll", this.#onscrollBind ); GSUI.observeSizeOf( this.#scrollingAncestor, this.#onresizeBind ); this.#updateOffset(); this.#<API key>(); this.#updateMeasures(); } <API key>() { this.#scrollingAncestor.removeEventListener( "scroll", this.#onscrollBind ); GSUI.unobserveSizeOf( this.#scrollingAncestor, this.#onresizeBind ); } static get observedAttributes() { return [ "step", "timedivision", "pxperbeat", "loop", "currenttime", "currenttime-preview" ]; } <API key>( prop, prev, val ) { if ( prev !== val ) { switch ( prop ) { case "step": this.#step = +val; break; case "loop": this.#changeLoop( val ); break; case "pxperbeat": this.#changePxPerBeat( +val ); break; case "currenttime": this.#changeCurrentTime( +val ); break; case "timedivision": this.#changeTimedivision( val ); break; case "currenttime-preview": this.#<API key>( val ); break; } } } previewCurrentTime( b ) { // to remove... const ret = b !== false ? this.beatRound( b ) : +this.getAttribute( "currenttime-preview" ) || +this.getAttribute( "currenttime" ) || 0; GSUI.setAttribute( this, "currenttime-preview", b !== false ? ret : null ); return ret; } #changePxPerBeat( ppb ) { const stepsOpa = Math.max( 0, Math.min( ( ppb - 32 ) / 256, .5 ) ), beatsOpa = Math.max( 0, Math.min( ( ppb - 20 ) / 40, .6 ) ), measuresOpa = Math.max( 0, Math.min( ( ppb - 6 ) / 20, .7 ) ); this.pxPerBeat = ppb; this.pxPerMeasure = this.beatsPerMeasure * ppb; this.#onlyBigMeasures = ppb < 6; this.style.fontSize = `${ ppb }px`; this.style.setProperty( "--<API key>", this.#onlyBigMeasures ? this.beatsPerMeasure : 1 ); this.style.setProperty( "--<API key>", measuresOpa ); this.#elements.steps.style.opacity = stepsOpa; this.#elements.beats.style.opacity = beatsOpa; if ( this.#scrollingAncestor ) { this.#updateOffset(); this.#<API key>(); this.#updateMeasures(); } } #changeTimedivision( val ) { const ts = val.split( "/" ); this.beatsPerMeasure = +ts[ 0 ]; this.stepsPerBeat = +ts[ 1 ]; this.pxPerMeasure = this.beatsPerMeasure * this.pxPerBeat; this.style.setProperty( "--<API key>", this.beatsPerMeasure ); this.#updateStepsBg(); if ( this.#scrollingAncestor ) { this.#<API key>(); this.#updateMeasures(); } } #changeLoop( val ) { const [ a, b ] = ( val || "0-0" ).split( "-" ); this.looping = !!val; this.loopA = +a; this.loopB = +b; this.#updateLoop(); } #changeCurrentTime( t ) { this.#elements.cursor.style.left = `${ t }em`; } #<API key>( t ) { if ( !t ) { this.#elements.cursorPreview.remove(); } else { this.#elements.cursorPreview.style.left = `${ t }em`; if ( !this.#elements.cursorPreview.parentNode ) { this.#elements.timeLine.append( this.#elements.cursorPreview ); } } } beatCeil( beat ) { return this.#beatCalc( Math.ceil, beat ); } beatRound( beat ) { return this.#beatCalc( Math.round, beat ); } beatFloor( beat ) { return this.#beatCalc( Math.floor, beat ); } #beatCalc( mathFn, beat ) { const mod = 1 / this.stepsPerBeat * this.#step; return mathFn( beat / mod ) * mod; } #<API key>( el ) { const ov = getComputedStyle( el ).overflowX; return ov === "auto" || ov === "scroll" || el === document.body ? el : this.#<API key>( el.parentNode ); } #setStatus( st ) { this.classList.remove( `gsuiTimeline-${ this.#status }` ); this.classList.toggle( `gsuiTimeline-${ st }`, !!st ); this.#status = st; } #getBeatByPageX( pageX ) { const bcrX = this.#elements.timeLine.<API key>().x; return Math.max( 0, this.beatRound( ( pageX - bcrX ) / this.pxPerBeat ) ); } #updateStepsBg() { const sPB = this.stepsPerBeat, dots = []; for ( let i = 1; i < sPB; ++i ) { dots.push( `transparent calc( ${ i / sPB }em - 1px )`, `currentColor calc( ${ i / sPB }em - 1px )`, `currentColor calc( ${ i / sPB }em + 1px )`, `transparent calc( ${ i / sPB }em + 1px )` ); } this.#elements.steps.style.backgroundImage = ` <API key>(90deg, transparent 0em, ${ dots.join( "," ) }, transparent calc( ${ 1 }em ) ) `; } #updateOffset() { const offBeats = Math.floor( this.#scrollingAncestor.scrollLeft / this.pxPerMeasure ), off = this.#onlyBigMeasures ? Math.floor( offBeats / this.beatsPerMeasure ) * this.beatsPerMeasure : offBeats, diff = off !== this.#offset; if ( diff ) { this.#offset = off; this.style.setProperty( "--<API key>", off ); } return diff; } #<API key>() { const elMeasures = this.#elements.measures, px = this.pxPerMeasure * ( this.#onlyBigMeasures ? this.beatsPerMeasure : 1 ), nb = Math.ceil( this.#scrollingAncestor.clientWidth / px ) + 1; if ( nb < 0 || nb > 500 ) { return console.warn( "gsuiTimeline: anormal number of nodes to create", nb ); } else if ( elMeasures.children.length > nb ) { while ( elMeasures.children.length > nb ) { elMeasures.lastChild.remove(); } } else { while ( elMeasures.children.length < nb ) { elMeasures.append( GSUI.createElement( "span", { class: "<API key>" } ) ); } } } #updateMeasures() { Array.prototype.forEach.call( this.#elements.measures.children, ( el, i ) => { el.classList.toggle( "<API key>", this. } ); } #updateLoop() { this.classList.toggle( "<API key>", this.looping ); if ( this.looping ) { this.#elements.loop.style.left = `${ this.loopA }em`; this.#elements.loop.style.width = `${ this.loopB - this.loopA }em`; } } #onscroll() { if ( this.#updateOffset() && !this.#onlyBigMeasures ) { this.#updateMeasures(); } } #onresize() { this.#<API key>(); this.#updateMeasures(); } #onmousedown( e ) { const loopLine = e.target.classList.contains( "<API key>" ); if ( loopLine && Date.now() - this.#mousedownDate > 500 ) { this.#mousedownDate = Date.now(); } else { this.#setStatus( e.target === this.#elements.cursor.parentNode ? "draggingTime" : e.target.classList.contains( "<API key>" ) ? "draggingLoopBody" : e.target.classList.contains( "<API key>" ) ? "draggingLoopHandleA" : e.target.classList.contains( "<API key>" ) || loopLine ? "draggingLoopHandleB" : "" ); if ( this.#status ) { this.#mousemoveBeat = null; this.#mousedownBeat = this.#getBeatByPageX( e.pageX ); if ( loopLine ) { this.loopA = this.loopB = this.#mousedownBeat; this.#dispatch( "inputLoopStart" ); } else { this.#dispatch( "<API key>" ); } this.#mousedownLoop = this.getAttribute( "loop" ); this.#mousedownLoopA = this.loopA; this.#mousedownLoopB = this.loopB; document.addEventListener( "mousemove", this.#onmousemoveBind ); document.addEventListener( "mouseup", this.#onmouseupBind ); GSUI.unselectText(); this.#onmousemove( e ); } } } #onmousemove( e ) { const beat = this.#getBeatByPageX( e.pageX ), beatRel = beat - this.#mousedownBeat; if ( beatRel !== this.#mousemoveBeat ) { this.#mousemoveBeat = beatRel; switch ( this.#status ) { case "draggingTime": GSUI.setAttribute( this, "currenttime-preview", beat ); this.#dispatch( "inputCurrentTime", beat ); break; case "draggingLoopBody": { const rel = Math.max( -this.#mousedownLoopA, beatRel ), a = this.#mousedownLoopA + rel, b = this.#mousedownLoopB + rel, loop = `${ a }-${ b }`; if ( loop !== this.getAttribute( "loop" ) ) { GSUI.setAttribute( this, "loop", loop ); this.#dispatch( "inputLoop", a, b ); } } break; case "draggingLoopHandleA": case "draggingLoopHandleB": { const handA = this. rel = handA ? Math.max( -this.#mousedownLoopA, beatRel ) : beatRel, a = this.#mousedownLoopA + ( handA ? rel : 0 ), b = this.#mousedownLoopB + ( handA ? 0 : rel ), aa = Math.min( a, b ), bb = Math.max( a, b ), loop = `${ aa }-${ bb }`; if ( a > b ) { if ( handA ) { this.#setStatus( "draggingLoopHandleB" ); this.#mousedownLoopA = this.#mousedownLoopB; } else { this.#setStatus( "draggingLoopHandleA" ); this.#mousedownLoopB = this.#mousedownLoopA; } this.#mousedownBeat = this.#mousedownLoopA; } if ( loop !== this.getAttribute( "loop" ) ) { if ( aa !== bb ) { GSUI.setAttribute( this, "loop", loop ); this.#dispatch( "inputLoop", aa, bb ); } else if ( this.hasAttribute( "loop" ) ) { this.removeAttribute( "loop" ); this.#dispatch( "inputLoop", false ); } } } break; } } } #onmouseup() { document.removeEventListener( "mousemove", this.#onmousemoveBind ); document.removeEventListener( "mouseup", this.#onmouseupBind ); switch ( this.#status ) { case "draggingTime": { const beat = this.getAttribute( "currenttime-preview" ); this.removeAttribute( "currenttime-preview" ); this.#dispatch( "inputCurrentTimeEnd" ); if ( beat !== this.getAttribute( "currenttime" ) ) { GSUI.setAttribute( this, "currenttime", beat ); this.#dispatch( "changeCurrentTime", +beat ); } } break; case "draggingLoopBody": case "draggingLoopHandleA": case "draggingLoopHandleB": this.#dispatch( "inputLoopEnd" ); if ( this.getAttribute( "loop" ) !== this.#mousedownLoop ) { if ( this.loopA !== this.loopB ) { this.#dispatch( "changeLoop", this.loopA, this.loopB ); } else { this.removeAttribute( "loop" ); this.#dispatch( "changeLoop", false ); } } break; } this.#setStatus( "" ); } } Object.freeze( gsuiTimeline ); customElements.define( "gsui-timeline", gsuiTimeline );
#PiOT 101: Introductory Workshop for the Raspberry Pi + Internet of Things This is a hub for the 101 tutuorial on learning how to get going on a Raspberry Pi and getting it connected to the Internet of Things. Here you will find code materials for the workshop sectioned in folders inside this repository. You will also find the tutorials [in the wiki](https://github.com/InitialState/piot-101/wiki) of this repo.
package com.data2semantics.yasgui.client.helpers; import java.io.IOException; import com.data2semantics.yasgui.client.View; import com.data2semantics.yasgui.client.settings.Settings; public class HistoryHelper { private View view; private String <API key> = ""; private boolean historyEnabled = false; public HistoryHelper(View view) { this.historyEnabled = JsMethods.historyApiSupported(); this.view = view; if (historyEnabled) { JsMethods.<API key>(); } } /** * Set history checkpoint, normally called -after- executing a change / operation (e.g. after adding a new tab) */ public void <API key>() { if (historyEnabled) { String <API key> = view.getSettings().toString(); if (<API key>.equals(<API key>) == false) { //only add new checkpoint when the settings are different than the last one <API key> = <API key>; JsMethods.pushHistoryState(<API key>, view.getSettings().getBrowserTitle(), ""); } } } /** * Set history checkpoint, normally called -after- executing a change / operation (e.g. after adding a new tab) */ public void replaceHistoryState() { if (historyEnabled) { String <API key> = view.getSettings().toString(); <API key> = <API key>; JsMethods.replaceHistoryState(<API key>, view.getSettings().getBrowserTitle(), ""); } } public void <API key>() { try { updateView(JsMethods.getHistoryState().getData()); } catch (Exception e) { view.getElements().onError(e); } } private void updateView(String settingsString) throws IOException { //for backwards compatability, retrieve default methods again //(olders cached versions of the settings did not store these defaults) Settings settings = new Settings(JsMethods.getDefaultSettings()); settings.addToSettings(settingsString); //check whether the tab settings stayed the same. if they did, don't redraw the tabs, only the selected tab setting boolean tabSetChanged = !settings.getTabArrayAsJson().toString().equals(view.getSettings().getTabArrayAsJson().toString()); view.setSettings(settings); LocalStorageHelper.<API key>(view.getSettings()); if (tabSetChanged) { view.getTabs().redrawTabs(); } else { view.getTabs().selectTab(view.getSettings().<API key>()); } } }
<!DOCTYPE html> <html> <head> <title id="name1">Series Name</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script> <script src="../../static/js/data.js"></script> <script src="../../static/js/entities.js"></script> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="<API key>+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <!-- Optional theme --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="<API key>/Sp" crossorigin="anonymous"> <!-- Latest compiled and minified JavaScript --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="<API key>" crossorigin="anonymous"></script> <link rel="stylesheet" href="../../static/css/index.css"> </head> <body> <div class="buffer col-md-2"></div> <div class="content col-md-8"> <!-- Start Header --> <h1>Epigen</h1> <h3>What episode should you watch?</h3> <nav class="navbar navbar-light bg-faded"> <a class="navbar-brand" href=" <ul class="nav navbar-nav"> <li class="nav-item active"> <a class="nav-link" href=index.html>Home<span class="sr-only">(current)</span></a> </li> <li class="nav-item"> <a class="nav-link" href=about.html>About</a> </li> <li class="nav-item"> <a class="nav-link" href=Episode.html>Episodes</a> </li> <li class="nav-item"> <a class="nav-link" href=Platform.html>Platforms</a> </li> <li class="nav-item"> <a class="nav-link" href=Series.html>Series</a> </li> </ul> </nav> <!-- End Header --> <!-- Show Name and Image --> <div class="content colmd-8"></div> <h1 id="name">Name</h1> <div class="series-container col-md-4"> <a href=""> <img id="series-img" class="series-img center-block" width="100%" src=""> <br> </a> <p class="text-center"> Airdate: </p> <p class="text-center" id="yearsActive"></p> <p class="text-center"> Runtime: </p> <p class="text-center" id="runtime"></p> </div> <!-- Info On Show w/ External Links --> <div class="series-container col-md-4"> <h4 class="text-center">Description: </h4><br> <p class="series-title text-center" id="description"></p><br> <h4 class="text-center">Genre: </h4><br> <p class="series-title text-center" id="genre"></p><br> <h4 class="text-center">Platform: </h4><br> <p class="series-title text-center" id="platforms"></p><br> <h4 class="text-center">Episodes: </h4><br> <a href="" id="episode-link"><p class="series-title text-center" id="episodes">info3</p></a><br> </div> </div> </body> <script type="text/javascript"> var str = '{{string}}'; var series = str.replace("%20", " "); getdataSeries(series) </script> </html>
package org.vizzini.illyriad.robot.inventory; import java.io.File; import org.vizzini.illyriad.FileUtilities; /** * Provides location constants. */ public final class Locations { /** User directory. */ static final File USER_DIR; static { final FileUtilities fileUtils = new FileUtilities(); final String userDir = fileUtils.getUserDir(); USER_DIR = new File(userDir); System.out.println("USER_DIR = [" + USER_DIR + "]"); } /** Trained neural network filename. */ private static final String <API key> = "<API key>.txt"; /** Inventory data trained neural network input directory. */ private static final File <API key> = new File(USER_DIR, "illyriad/src/main/resources/inventoryData"); /** Inventory data trained neural network input filepath. */ static final File <API key> = new File(<API key>, <API key>); /** Inventory data directory. */ static final File INVENTORY_DATA_DIR = new File(USER_DIR, "inventoryData"); /** Captured images directory. */ static final File CAPTURED_IMAGES_DIR = new File(INVENTORY_DATA_DIR, "capturedImages"); /** Count image rows directory. */ static final File ROWS_DIR = new File(INVENTORY_DATA_DIR, "rows"); /** Inventory data count images directory. */ static final File COUNTS_DIR = new File(INVENTORY_DATA_DIR, "counts"); /** Digit images directory. */ static final File DIGITS_DIR = new File(INVENTORY_DATA_DIR, "digits"); /** Trained neural network output directory. */ private static final File <API key> = INVENTORY_DATA_DIR; /** Trained neural network output filepath. */ static final File <API key> = new File(<API key>, <API key>); /** Inventory data filepath. */ static final File <API key> = new File(INVENTORY_DATA_DIR, "inventory.txt"); }
import JsFile from 'JsFile'; import <API key> from './<API key>'; import <API key> from './<API key>'; const {Document} = JsFile; const {normalizeColorValue, errors: {invalidReadFile}} = JsFile.Engine; /** * @description Parsing content of document * @param params * @return {Object} * @private */ export default function <API key> (params) { return new Promise((resolve, reject) => { const {xml, documentData = {}, fileName = ''} = params; let node = xml && xml.querySelector('parsererror'); if (node) { return reject(new Error(invalidReadFile)); } const result = { meta: { name: fileName, wordsCount: (documentData.applicationInfo && documentData.applicationInfo.wordsCount) || null, zoom: (documentData.settings && documentData.settings.zoom) || 100 }, content: [], styles: documentData.styles.computed }; const pagePrototype = {}; node = xml && xml.querySelector('background'); if (node) { const attrValue = node.attributes['w:color'] && node.attributes['w:color'].value; if (attrValue) { pagePrototype.style = pagePrototype.style || {}; pagePrototype.style.backgroundColor = normalizeColorValue(attrValue); } // TODO: parse themeColor, themeShade, themeTint attributes } node = xml && xml.querySelector('body'); if (node) { const nodes = [].slice.call(node.childNodes || [], 0); const lastNode = nodes[nodes.length - 1]; if (lastNode.localName === 'sectPr') { /** * @description remove last item - sectionProperties */ nodes.pop(); documentData.styles.defaults.sectionProperties = <API key>(lastNode, documentData); } return <API key>({ nodes, documentData }).then((elements) => { const page = Document.elementPrototype; page.children.push.apply(page.children, elements); page.style = documentData.styles.defaults.sectionProperties && documentData.styles.defaults.sectionProperties.style || {}; // TODO: add page break, because now it's only 1 page for all content if (page.style.height) { page.style.minHeight = page.style.height; delete page.style.height; } result.content.push(page); resolve(new Document(result)); }, reject); } return resolve(new Document(result)); }); }
'use strict'; var ReactMdLite = { Badge: require('./components/Badge'), Button: require('./components/Button'), Card: require('./components/Card'), Grid: require('./components/Grid'), Icon: require('./components/Icon'), Menu: require('./components/Menu'), Progress: require('./components/Progress'), Slider: require('./components/Slider'), Spinner: require('./components/Spinner'), Switch: require('./components/Switch'), Table: require('./components/Table'), Tabs: require('./components/Tabs'), Textfield: require('./components/Textfield'), Toggle: require('./components/Toggle'), Tooltip: require('./components/Tooltip') }; module.exports = ReactMdLite;
<?php namespace Tebru\Retrofit\Cache; use Symfony\Component\Filesystem\Filesystem; use Tebru\Retrofit\Provider\<API key>; /** * Class CacheWriter * * @author Nate Brunette <n@tebru.net> */ class CacheWriter { /** * Retrofit cache directory name */ const RETROFIT_CACHE_DIR = 'retrofit'; /** * Cache directory * * @var string $cacheDir */ private $cacheDir; /** * Filesystem object to manipulate filesystem * * @var Filesystem $filesystem */ private $filesystem; /** * Constructor * * @param string $cacheDir */ public function __construct($cacheDir = null) { if (null === $cacheDir) { $cacheDir = sys_get_temp_dir(); } $this->filesystem = new Filesystem(); $this->cacheDir = $cacheDir . DIRECTORY_SEPARATOR . self::RETROFIT_CACHE_DIR; $this->filesystem->mkdir($this->cacheDir); } /** * Write to retrofit cache * * @param <API key> $<API key> * @param string $contents */ public function write(<API key> $<API key>, $contents) { $contents = "<?php\n" . $contents; $path = $this->cacheDir . $<API key>->getFilePath(); $filename = $path . DIRECTORY_SEPARATOR . $<API key>->getFilenameShort(); $this->filesystem->mkdir($path); $this->filesystem->dumpFile($filename, $contents); } }
#ifndef _PHGT_H #define _PHGT_H #include "sim.h" /* * Function updates horizontal gene transfer probability in t step of given * bacterium * * Arguments: pointer to node struct to be modified * pointer to sim struct to access constants * * Returns: void * * Errors: -- */ void updatePHGT(nodeBac *node, simBac *sim); #endif
#include <limits> #include <stdexcept> #include <string> #include <iostream> #include <algorithm> #include <sstream> #include <fstream> #include "plot.h" #include "trashproblem.h" // TODO: sweepAssignment and initial construction routine // need to deal with TW violations and DONT YET // compute the distance between two nodes // this currently computes Euclidean distances // but this could be changes to call OSRM // and/or save and fetch the distance from a matrix double TrashProblem::distance(int n1, int n2) const { return datanodes[n1].distance(datanodes[n2]); } // utility frunction to convert a selector bit array to // human readable text for debug output std::string selectorAsTxt(int s) { /* std::string str = ""; if (s & ANY) str += (str.length()?"|":"") + std::string("ANY"); if (s & UNASSIGNED) str += (str.length()?"|":"") + std::string("UNASSIGNED"); if (s & CLUSTER1) str += (str.length()?"|":"") + std::string("CLUSTER1"); if (s & CLUSTER2) str += (str.length()?"|":"") + std::string("CLUSTER2"); if (s & LIMITDEMAND) str += (str.length()?"|":"") + std::string("LIMITDEMAND"); if (s & PICKUP) str += (str.length()?"|":"") + std::string("PICKUP"); if (s & DEPOT) str += (str.length()?"|":"") + std::string("DEPOT"); if (s & DUMP) str += (str.length()?"|":"") + std::string("DUMP"); if (s & RATIO) str += (str.length()?"|":"") + std::string("RATIO"); return str; */ } // search for node methods // selector is a bit mask // selector: 0 - any ANY // 1 - must be unassigned UNASSIGNED // 2 - in nid's cluster1 CLUSTER1 // 4 - in nid's cluster2 CLUSTER2 // 8 - with demand <= demandLimit LIMITDEMAND // 16 - must be pickup nodes PICKUP // 32 - must be depot nodes DEPOT // 64 - must be dump nodes DUMP // 128 - must have RATIO<ratio RATIO // return true to exclude the node // tn - a depot node // i - a datanodes index being filtered or not // selector - see above // demandLimit - capacity left available on the vehicle bool TrashProblem::filterNode(const Trashnode &tn, int i, int selector, int demandLimit) { /* Trashnode& tn2 = datanodes[i]; bool select = true; // filter out nodes where the demand > demandLimit if (selector & LIMITDEMAND and tn2.getdemand() > demandLimit) return true; // if select any if (!selector) return false; // is pickup node if (selector & PICKUP and tn2.ispickup()) select = false; // is depot node else if (selector & DEPOT and tn2.isdepot()) select = false; // is dump node else if (selector & DUMP and tn2.isdump()) select = false; if (select and ((PICKUP|DEPOT|DUMP) & selector)) return true; select = true; // belongs to cluster1 if (selector & CLUSTER1 and tn.getdepotnid() == tn2.getdepotnid() ) { // select the node, it is in CLUSTER1 select = false; double r = tn2.getdepotdist()<tn2.getdepotdist2() ? tn2.getdepotdist()/tn2.getdepotdist2() : tn2.getdepotdist2()/tn2.getdepotdist(); // unselect it if r > ratio if (selector & RATIO and r > ratio) select = true; } // belongs to cluster2 else if (selector & CLUSTER2 and tn.getdepotnid() == tn2.getdepotnid2() ) { // select the node, it is in CLUSTER2 select = false; double r = tn2.getdepotdist()<tn2.getdepotdist2() ? tn2.getdepotdist()/tn2.getdepotdist2() : tn2.getdepotdist2()/tn2.getdepotdist(); // unselect it if r > ratio if (selector & RATIO and r > ratio) select = true; } // only checking RATIO else if (!(selector & (CLUSTER1|CLUSTER2)) and (selector & RATIO)) { double r = tn2.getdepotdist()<tn2.getdepotdist2() ? tn2.getdepotdist()/tn2.getdepotdist2() : tn2.getdepotdist2()/tn2.getdepotdist(); if (r <= ratio) select = false; } if (select and ((CLUSTER1|CLUSTER2|RATIO) & selector)) return true; // is unassigned node if (selector & UNASSIGNED and ! unassigned[i]) return true; return false; */ } int TrashProblem::findNearestNodeTo(int nid, int selector, int demandLimit) { assert (" twc.findBestTravelTime(UID from, const Bucket &nodes) "=="" and " twc.findBestTravelTime(const Bucket &nodes, UID to) "==""); /* Trashnode &tn(datanodes[nid]); int nn = -1; // init to not found double dist = -1; // dist to nn for (int i=0; i<datanodes.size(); i++) { if (filterNode(tn, i, selector, demandLimit)) continue; double d = dMatrix[tn.getnid()][i]; if (nn == -1 or d < dist) { dist = d; nn = i; } } //std::cout << "TrashProblem::findNearestNodeTo(" << nid << ", " << selector << ") = " << nn << " at dist = " << dist << std::endl; return nn; */ } int TrashProblem::findNearestNodeTo(Vehicle &v, int selector, int demandLimit, int& pos) { Trashnode depot(v.getdepot()); Trashnode dump(v.getdumpSite()); int nn = -1; // init to not found int loc = 0; // position in path to insert double dist = -1; // dist to nn double qx, qy; //std::cout << "TrashProblem::findNearestNodeTo(V" << depot.getnid() << ", " << selector << ")\n"; for (int i=0; i<datanodes.size(); i++) { if (filterNode(depot, i, selector, demandLimit)) { // std::cout << "FILTERED: "; // datanodes[i].dump(); continue; } double d; // DO NOT make this a reference|pointer or it will mess things up Trashnode last = depot; for (int j=0; j<v.size(); j++) { // d = <API key>( // last.getx(), last.gety(), v[j].getx(), v[j].gety(), // datanodes[i].getx(), datanodes[i].gety(), &qx, &qy); d = datanodes[i].distanceToSegment(last,v[j]); if (nn == -1 or d < dist) { dist = d; loc = j; nn = i; } last = v[j]; } // d = <API key>( // last.getx(), last.gety(), dump.getx(), dump.gety(), // datanodes[i].getx(), datanodes[i].gety(), &qx, &qy); d = datanodes[i].distanceToSegment(last,dump); if (nn == -1 or d < dist) { dist = d; loc = v.size(); nn = i; } } //std::cout << "TrashProblem::findNearestNodeTo(V" << depot.getnid() << ", " << selector << ") = " << nn << " at dist = " << dist << " at pos = " << loc << std::endl; pos = loc; return nn; } // create a CSV string that represents the solution // this is a list of the node ids representing a vehicle route and // each vehicle is separated with a -1 std::string TrashProblem::solutionAsText() const { std::stringstream ss;; const std::vector<int> s = solutionAsVector(); for (int i=0; i<s.size(); i++) { if (i) ss << ","; ss << s[i]; } return ss.str(); } // create a vector of node ids representing a solution // this can be used to save a compute solution while other changes // are being tried on that solution and can be used with // <API key>() to reconstruct the solution std::vector<int> TrashProblem::solutionAsVector() const { std::vector<int> s; for (int i=0; i<fleet.size(); i++) { if (fleet[i].size() == 0) continue; for (int j=0; j<fleet[i].size(); j++) { s.push_back(fleet[i][j].getnid()); } s.push_back(fleet[i].getdumpSite().getnid()); s.push_back(fleet[i].getdepot().getnid()); s.push_back(-1); } return s; } // reconstruct the fleet from a solution vector obtained from // solutionAsVector(). This does some minimal checking that depot, dump // and pickup nodes are in the correct positions // this can also be used to construct specific solutions for testing // algorithms bool TrashProblem::<API key>(std::vector<int> solution) { /* unassigned = std::vector<int>(datanodes.size(), 1); std::vector<int>::iterator it; std::vector<int>::iterator it2; std::vector<int>::iterator start = solution.begin(); clearFleet(); int vid = 0; while ((it = std::find(start, solution.end(), -1)) != solution.end()) { if (*start != *(it-1) or !datanodes[*start].isdepot()) { // error first and last nodes must be the same depot std::cout << "ERROR: truck[" << vid << "]: first and last nodes must be the same depot!" << std::endl; return false; } if (!datanodes[*(it-2)].isdump()) { // error path[size-2] must be a dumpsite std::cout << "ERROR: truck[" << vid << "]: path[size-2] must be a dumpsite node!" << std::endl; return false; } Trashnode& depot(datanodes[*start]); Trashnode& dump(datanodes[*(it-2)]); unassigned[dump.getnid()] = 0; Vehicle truck(depot, dump); for (it2=start+1; it2<it-2; it2++) { if (*it2 < 0 or *it2 > datanodes.size()) { std::cout << "ERROR: truck[" << vid << "]: node: " << *it2 << " is NOT in range of the input problem nodes!" << std::endl; return false; } if (datanodes[*it2].ispickup()) { if (unassigned[*it2] == 0) { std::cout << "ERROR: truck[" << vid << "]: node: " << *it2 << " has already been assigned to another Truck!" << std::endl; return false; } unassigned[*it2] = 0; truck.push_back(datanodes[*it2]); } else { std::cout << "ERROR: truck[" << vid << "]: node: " << *it2 << " is not a pickup node!" << std::endl; return false; } } //truck.dump(); fleet.push_back(truck); start = it+1; vid++; } return true; */ } // NOTE: findBestFit() does check for feasibility so time windows // and capacity are not violated. bool TrashProblem::findVehicleBestFit(int nid, int& vid, int& pos) { // track the best result found int vbest = -1; int vpos; double vcost; for (int i=0; i<fleet.size(); i++) { if ( fleet[i].getcargo() + datanodes[nid].getdemand() > fleet[i].getmaxcapacity() ) continue; int tpos; double cost; Trashnode tn = datanodes[nid]; if (fleet[i].findBestFit(tn, &tpos, &cost)) { //std::cout << "findVehicleBestFit: nid: "<<nid<<", i: "<<i<<", tpos: "<<tpos<<", cost: "<<cost<<std::endl; if (vbest == -1 or cost < vcost) { vbest = i; vpos = tpos; vcost = cost; } } } if (vbest > -1) { vid = vbest; pos = vpos; return true; } return false; } // WARNING: this does NOT check for Time Window Feasibility !!!!!!!!! // Initial construction of a problem solution based on nearestNeighbor // algorithm. For each vehicle(depot) find the nearest neighbor path until // the vehicle reaches capacity. void TrashProblem::nearestNeighbor() { } // Add all nodes to a single vehicle. Don't check for TWV or CV // This was for testing only, not useful in real world applications void TrashProblem::dumbConstruction() { /* clearFleet(); Trashnode& depot(datanodes[depots[0]]); int dnid = depot.getdumpnid(); Trashnode& dump(datanodes[dnid]); Vehicle truck(depot, dump); for (int i=0; i<pickups.size(); i++) { truck.push_back(datanodes[pickups[i]]); } fleet.push_back(truck); */ } // WARNING: this does NOT check for Time Window Feasibility !!!!!!!!! // TrashProblem::assignmentSweep // This implements Assignment Sweep construction algorithm with the // twist that I cluster first and identify the nearest depot (CLUSTER1) // and the second nearest depot (CLUSTER2) to all nodes. When nodes // are selected for insertions we pull from both CLUSTER1 and CLUSTER2 // set of nodes. This might mean that the route can wander into CLUSTER2 // territory to fill up a vehicle but it is a simple algorithm. void TrashProblem::assignmentSweep() { } // WARNING: this does NOT check for Time Window Feasibility !!!!!!!!! // TrashProblem::assignmentSweep2 // This implements Assignment Sweep construction algorithm with the // twist that I cluster first and identify the nearest depot (CLUSTER1) // and the second nearest depot (CLUSTER2) to all nodes. The construction // algorithm follows this pseudo code: // 1. build routes based on only CLUSTER1 nodes // 2. add unassigned nodes to vehicles with capacity based on CLUSTER2 // 3. add unassigned nodes to any vehicles with capacity void TrashProblem::assignmentSweep2() { } // WARNING: this does NOT check for Time Window Feasibility !!!!!!!!! // TrashProblem::assignmentSweep3 // This implements Assignment Sweep construction algorithm with the // twist that I cluster first and identify the nearest depot (CLUSTER1) // and the second nearest depot (CLUSTER2) to all nodes. The construction // algorithm follows this pseudo code: // 1. build routes based on only CLUSTER1 nodes within RATIO // 2. add unassigned nodes based on the lowest cost to insert them void TrashProblem::assignmentSweep3() { // create a list of all pickup nodes and make them unassigned //unassigned = std::vector<int>(datanodes.size(), 1); Bucket unassigned = pickups; Bucket problematic; Bucket assigned; std::deque<Vehicle> unusedTrucks = trucks; std::deque<Vehicle> usedTrucks = trucks; Vehicle truck; clearFleet(); for (int i=0; i<trucks.size(); i++) { // add this depot as the vehicles home location // and the associated dump //Trashnode& depot(datanodes[depots[i]]); //Trashnode& dump(datanodes[depot.getdumpnid()]); // create a vehicle and attach the depot and dump to it truck=unusedTrucks[0]; unusedTrucks.erase(unusedTrucks.begin()); usedTrucks.push_back(truck); //std::cout << "EMPTY TRUCK: "; truck.dump(); int pos; int nid = findNearestNodeTo(truck, UNASSIGNED|PICKUP|CLUSTER1|RATIO, 0, pos); if (nid == -1) { std::cout << "TrashProblem::assignmentSweep3 failed to find an initial node for truck: \n"; truck.tau(); continue; } truck.push_back(datanodes[nid]); unassigned.erase(datanodes[nid]); assigned.push_back(datanodes[nid]); //unassigned[nid] = 0; int cnt = 1; // char buffer[100]; // sprintf(buffer, "out/p%02d-%03d.png", i, cnt); // std::string str(buffer); // plot(str, str, truck.getpath()); while (truck.getcargo() <= truck.getmaxcapacity()) { // std::cout << "assignmentSweep2[" << i << ',' << cnt << "] "; // truck.dumppath(); int pos; int nnid = findNearestNodeTo(truck, UNASSIGNED|PICKUP|CLUSTER1|LIMITDEMAND|RATIO, truck.getmaxcapacity() - truck.getcargo(), pos); // if we did not find a node we can break if (nnid == -1) break; // TODO we need to check tw feasibility and mark the node as such // so findNearestNodeTo() above does not return it again // add node to route //unassigned[nnid] = 0; truck.insert(datanodes[nnid], pos); assigned.push_back(datanodes[nnid]); unassigned.erase(datanodes[nnid]); cnt++; // sprintf(buffer, "out/p%02d-%03d.png", i, cnt); // std::string str(buffer); // plot(str, str, truck.getpath()); } fleet.push_back(truck); } std::cout << " // check for unassigned nodes /*int ucnt = 0; for (int i=0; i<pickups.size(); i++) if (unassigned[pickups[i]]) { ucnt++; datanodes[pickups[i]].dump(); } if (ucnt == 0) return; // return if nothing left to do */ if (unassigned.size() == 0) return; // return if nothing left to do std::cout << unassigned.size() << " unassigned orders after CLUSTER1|RATIO assignment" << std::endl; // assign remaining order based on lowest cost to insert // findVehicleBestFit() checks feasible() //for (int i=0; i<pickups.size(); i++) { // if (! unassigned[pickups[i]]) continue; for (int i=0; unassigned.size(); i++) { int vid; int pos; if (! findVehicleBestFit(unassigned[0].getnid(), vid, pos)) { // could not find a valid insertion point std::cout << "assignmentSweep3: could not find a valid insertion point for node: " << unassigned[0].getnid() << std::endl; problematic.push_back(unassigned[0]); unassigned.erase(0); continue; } //unassigned[unassigned[i]] = 0; //Vehicle& truck = fleet[vid]; fleet[vid].insert(unassigned[0], pos); unassigned.erase(0); } // check for unassigned nodes //ucnt = 0; //for (int i=0; i<pickups.size(); i++) // if (unassigned[pickups[i]]) ucnt++; if (problematic.size() == 0) return; // return if nothing left to do std::cout << problematic.size() << " unassigned orders after best fit assignment" << std::endl; problematic.dump("problematic"); } // Perform local (intra-route) optimizations on each vehicle in the fleet // opt2opt appears to perform the best // repeat 2-opt modifications until there is no more improvement void TrashProblem::opt_2opt() { for (int i=0; i<fleet.size(); i++) { fleet[i].pathTwoOpt(); } } // repeat 3-opt modifications until there is no more improvement void TrashProblem::opt_3opt() { for (int i=0; i<fleet.size(); i++) { fleet[i].pathThreeOpt(); } } // repeat Or-opt modifications until there is no more improvements void TrashProblem::opt_or_opt() { for (int i=0; i<fleet.size(); i++) { fleet[i].pathOrOpt(); } } // repeats various path manipulations trying to optimize the path // 1. move nodes forward // 2. move nodes backwards // 3. exchange nodes // 4. invert seq void TrashProblem::optimize() { for (int i=0; i<fleet.size(); i++) { fleet[i].pathOptimize(); } } // print each vehicle in the fleet. // This includes its stats and its path. //BELONGS TO SOLUTION void TrashProblem::dumpFleet() const { } // get the total duration of the solution, this includes wait time // if early arrivel at a node double TrashProblem::getduration() const { } // get the total cost of the solution // cost = w1 * getduration() + w2 * getTWV() + w3 * getCV() double TrashProblem::getcost() const { } // get the total number of TWV in the dolution int TrashProblem::getTWV() const { } // get the total number of CV in the solution int TrashProblem::getCV() const { } // dump the problem and the solution void TrashProblem::dump() const { } // dump summary of the solution void TrashProblem::dumpSummary() const { } // create a png image of the solution and save it in "file" // also highlight a path given as nids in vector highlight void TrashProblem::plot( std::string file, std::string title, std::string font, std::deque<int> highlight ) { /* Plot<Trashnode> plot( datanodes ); plot.setFile( file ); plot.setTitle( title ); plot.setFont( font ); plot.drawInit(); plot.drawPath(highlight, 0xffff00, 5, false); for (int i=0; i<fleet.size(); i++) { plot.drawPath(fleet[i].getpath(), plot.makeColor(i*5), 1, false); // printf("COLOR: %3d - 0x%06x\n", i, plot.makeColor(i)); } plot.drawPoints(depots, 0xff0000, 9, true); plot.drawPoints(dumps, 0x00ff00, 7, true); plot.drawPoints(pickups, 0x0000ff, 5, true); plot.save(); */ } // create a png image of the solution and save it in "file" void TrashProblem::plot( std::string file, std::string title, std::string font ) { /* Plot<Trashnode> plot( datanodes ); plot.setFile( file ); plot.setTitle( title ); plot.setFont( font ); plot.drawInit(); for (int i=0; i<fleet.size(); i++) { plot.drawPath(fleet[i].getpath(), plot.makeColor(i*5), 1, false); // printf("COLOR: %3d - 0x%06x\n", i, plot.makeColor(i)); } plot.drawPoints(depots, 0xff0000, 9, true); plot.drawPoints(dumps, 0x00ff00, 7, true); plot.drawPoints(pickups, 0x0000ff, 5, true); plot.save(); */ }
[MyDeas](http://mydeas.co) was a project for Startup Weekend Thunder Bay 2015. It's built on Meteor. This repo was hosted on Meteor's free hosting, which unfortunately no longer exists, and a result, neither does this project.
// <API key>.h // StacMan #import <Foundation/Foundation.h> #import "StacManClient.h" #import "StacManResponse.h" #import "StacManDelegate.h" @class StacManClient; @interface <API key> : NSObject -(id)initWithClient:(StacManClient*)client; //getAll(String site, String filter, Integer page, Integer pagesize, Date fromdate, Date todate, AnswerSort sort, Date mindate, Date maxdate, Integer min, Integer max, Order order) -(StacManResponse*)getAllOnSite:(NSString*)site filter:(NSString*)filter page:(int)page pageSize:(int)pageSize fromDate:(NSDate*)fromDate toDate:(NSDate*)toDate sort:(NSString*)sort minDate:(NSDate*)minDate maxDate:(NSDate*)maxDate min:(NSNumber*)min max:(NSNumber*)max order:(NSString*)order delegate:(NSObject<StacManDelegate>*)del; //getByIds(String site, Integer[] ids, String filter, Integer page, Integer pagesize, Date fromdate, Date todate, AnswerSort sort, Date mindate, Date maxdate, Integer min, Integer max, Order order) -(StacManResponse*)getByIdsOnSite:(NSString*)site ids:(NSArray*)ids filter:(NSString*)filter page:(int)page pageSize:(int)pageSize fromDate:(NSDate*)fromDate toDate:(NSDate*)toDate sort:(NSString*)sort minDate:(NSDate*)minDate maxDate:(NSDate*)maxDate min:(NSNumber*)min max:(NSNumber*)max order:(NSString*)order delegate:(NSObject<StacManDelegate>*)del; //getComments(String site, Integer[] ids, String filter, Integer page, Integer pagesize, Date fromdate, Date todate, CommentSort sort, Date mindate, Date maxdate, Integer min, Integer max, Order order) -(StacManResponse*)getCommentsOnSite:(NSString*)site ids:(NSArray*)ids filter:(NSString*)filter page:(int)page pageSize:(int)pageSize fromDate:(NSDate*)fromDate toDate:(NSDate*)toDate sort:(NSString*)sort minDate:(NSDate*)minDate maxDate:(NSDate*)maxDate min:(NSNumber*)min max:(NSNumber*)max order:(NSString*)order delegate:(NSObject<StacManDelegate>*)del; @end
#! /bin/bash export BASEDIR=$PWD MODULE_TARGET=( \ asrdemo \ asrdemo_with_abnf \ iatdemo \ <API key> \ ttsdemo \ ttsdemo_with_number \ <API key>) for target in ${MODULE_TARGET[*]} do cd $BASEDIR/../Examples/$target make done
<!doctype html> <html> <head> <title>terminal.js tests</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="stylesheet" href="../node_modules/mocha/mocha.css" media="all"> <script src="../dist/terminal.dbg.js"></script> <script src="../node_modules/mocha/mocha.js"></script> <script src="../node_modules/expect.js/index.js"></script> <script> mocha.setup('bdd'); </script> <!-- tests --> <script src="handler_sgi.js"></script> <script src="term_state.js"></script> <script src="term_diff.js"></script> <script src="ansi_output.js"></script> <script src="plain_output.js"></script> <script src="html_output.js"></script> <script src="terminal.js"></script> </head> <body> <div id="mocha"></div> <script> // mocha.globals(['Terminal']); mocha.run(); </script> </body> </html>
<?php $this->view('partials/head'); ?> <?php //Initialize models needed for the table new Machine_model; new Reportdata_model; ?> <div class="container"> <div class="row"> <div class="col-lg-12"> <h3><span data-i18n="machine.hardware_report"></span> <span id="total-count" class='label label-primary'>…</span></h3> <table class="table table-striped table-condensed table-bordered"> <thead> <tr> <th data-i18n="listing.computername" data-colname='machine.computer_name'></th> <th data-i18n="serial" data-colname='reportdata.serial_number'></th> <th data-i18n="username" data-colname='reportdata.long_username'></th> <th data-i18n="machine.model" data-colname='machine.machine_model'></th> <th data-i18n="description" data-colname='machine.machine_desc'></th> <th data-i18n="memory" data-colname='machine.physical_memory'></th> <th data-i18n="machine.cores" data-colname='machine.number_processors'></th> <th data-i18n="machine.arch" data-colname='machine.cpu_arch'></th> <th data-i18n="machine.cpu_speed" data-colname='machine.<API key>'></th> <th data-i18n="machine.rom_version" data-colname='machine.boot_rom_version'></th> </tr> </thead> <tbody> <tr> <td data-i18n="listing.loading" colspan="10" class="dataTables_empty"></td> </tr> </tbody> </table> </div> <!-- /span 12 --> </div> <!-- /row --> </div> <!-- /container --> <script type="text/javascript"> $(document).on('appUpdate', function(e){ var oTable = $('.table').DataTable(); oTable.ajax.reload(); return; }); $(document).on('appReady', function(e, lang) { // Get column names from data attribute var columnDefs = [], col = 0; // Column counter $('.table th').map(function(){ columnDefs.push({name: $(this).data('colname'), targets: col}); col++; }); oTable = $('.table').dataTable( { columnDefs: columnDefs, ajax: { url: appUrl + '/datatables/data', type: "POST", data: function(d){ // Look for 'between' statement todo: make generic if(d.search.value.match(/^\d+GB memory \d+GB$/)) { // Add column specific search d.columns[5].search.value = d.search.value.replace(/(\d+GB) memory (\d+GB)/, function(m, from, to){return ' BETWEEN ' + parseInt(from) + ' AND ' + parseInt(to)}); // Clear global search d.search.value = ''; } // Look for a bigger/smaller/equal statement if(d.search.value.match(/^memory [<>=] \d+GB$/)) { // Add column specific search d.columns[5].search.value = d.search.value.replace(/.*([<>=] )(\d+GB)$/, function(m, o, content){return o + parseInt(content)}); // Clear global search d.search.value = ''; //dumpj(out) } } }, dom: mr.dt.buttonDom, buttons: mr.dt.buttons, createdRow: function( nRow, aData, iDataIndex ) { // Update name in first column to link var name=$('td:eq(0)', nRow).html(); if(name == ''){name = "No Name"}; var sn=$('td:eq(1)', nRow).html(); var link = mr.getClientDetailLink(name, sn); $('td:eq(0)', nRow).html(link); var mem=$('td:eq(5)', nRow).html(); $('td:eq(5)', nRow).html(parseInt(mem) + ' GB'); } }); }); </script> <?php $this->view('partials/foot'); ?>
#!/usr/bin/env ruby require 'triez' require 'fiber' class MarkovModel < Fiber def initialize(order) @order = order @model = Hash.new {|h, k| h[k] = Array.new } super() do loop do if (syllable = @model[@state.hash].sample) Fiber.yield syllable @state << syllable end @state.shift # randomize? end end end def train(ary) # train ary.each_cons(@order + 1) do |*key, n| while !key.empty? @model[key.hash] << n key.shift end end # when the state is empty, pick anything @model[Array.new.hash] = ary # start with any single element @state = [ary.sample] while @state.size < @order if (syllable = @model[@state.hash].sample) @state << syllable else @state.shift end end end end class SourceText TOKEN = %r{ ( [:\d\.]+ | [\p{Alpha}\'\-]+ | [\.,\p{P}] \s? | \s ) }x def initialize(filename) @text = File.read(filename).gsub(/\s+/, " ").chomp << " " end def words @words ||= @text.scan(TOKEN).flatten end def syllables(*dicts) words.flat_map do |word| if word.index(/\w/) dicts.each {|dict| result = dict.hyphenate(word) break result if result } or [word] else [word] end end end end class DictHyph SEP = "\xA5".b def initialize(filename) @trie = Triez.new(value_type: :object) File.open(filename, 'rb') do |mhyph| mhyph.each do |line| line.chomp! @trie[line.delete(SEP).downcase] = line.split(SEP) end end end def hyphenate(word) @trie[word.downcase] end end class MyspellHyph def initialize(filename) @trie = Triez.new(value_type: :object) File.open(filename, "r") do |f| f.set_encoding(f.gets.chomp) f.each do |line| line.chomp! hyphens = line.scan(/([0-9])?([^0-9\.]|$)/).map do |n, _| (n || 0).to_i end @trie[line.delete('0-9')] = hyphens end end end def hyphenate(word) levels = Array.new(word.size, 0) w = "#{ word }." word.size.times do |n| (1 .. w.size - n).each do |len| if (points = @trie[w[n, len]]) levels[n, points.size] = levels[n, points.size].zip(points).map(&:max) end end end levels.map(&:odd?).zip(word.chars).flatten(1).select {|o| o }. # 'a', true, 'b', 'c' chunk {|o| o != true }.select(&:first). # [true, 'a'], [true, 'b', 'c'] map {|o| o.last.join } # 'a', 'bc' end end src = SourceText.new('data/eugene.txt') word_list = DictHyph.new('data/mhyph.txt') myspell_dict = MyspellHyph.new('/usr/share/myspell/dicts/hyph_en_US.dic') order = 2 model = MarkovModel.new(order) model.train(src.syllables(word_list, myspell_dict)) chain = 100000.times.map do model.resume end File.open("data/chain-#{ order }.txt", ?w) {|f| f.write chain.join.gsub(/(?<=\.)\s+(.)/) {|m| "\s#{ m[1].upcase }" } }
// VST Plug-Ins SDK // VSTGUI: Graphical User Interface Framework for VST plugins // Version 4.2 // are permitted provided that the following conditions are met: // and/or other materials provided with the distribution. // * Neither the name of the Steinberg Media Technologies nor the names of its // contributors may be used to endorse or promote products derived from this // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE // OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED // OF THE POSSIBILITY OF SUCH DAMAGE. #include "win32dragcontainer.h" #if WINDOWS #include <shlobj.h> #include <shellapi.h> #include "win32support.h" namespace VSTGUI { FORMATETC WinDragContainer::formatTEXTDrop = {CF_UNICODETEXT,0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL}; FORMATETC WinDragContainer::formatHDrop = {CF_HDROP, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL}; FORMATETC WinDragContainer::formatBinaryDrop = {CF_PRIVATEFIRST, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL}; WinDragContainer::WinDragContainer (IDataObject* platformDrag) : platformDrag (platformDrag) , nbItems (0) , stringsAreFiles (false) , data (0) , dataSize (0) { if (!platformDrag) return; STGMEDIUM medium = {0}; HRESULT hr = platformDrag->QueryGetData (&formatTEXTDrop); if (hr == S_OK) // text { hr = platformDrag->GetData (&formatTEXTDrop, &medium); if (hr == S_OK) { void* data = GlobalLock (medium.hGlobal); int32_t dataSize = (int32_t)GlobalSize (medium.hGlobal); if (data && dataSize) { UTF8StringHelper wideString ((const WCHAR*)data); strings.push_back (std::string (wideString)); nbItems = 1; } GlobalUnlock (medium.hGlobal); if (medium.pUnkForRelease) medium.pUnkForRelease->Release (); else GlobalFree (medium.hGlobal); } } else if (hr != S_OK) { hr = platformDrag->QueryGetData (&formatHDrop); if (hr == S_OK) { hr = platformDrag->GetData (&formatHDrop, &medium); if (hr == S_OK) { nbItems = (int32_t)DragQueryFile ((HDROP)medium.hGlobal, 0xFFFFFFFFL, 0, 0); stringsAreFiles = true; TCHAR fileDropped[1024]; for (int32_t index = 0; index < nbItems; index++) { if (DragQueryFile ((HDROP)medium.hGlobal, index, fileDropped, sizeof (fileDropped))) { // resolve link checkResolveLink (fileDropped, fileDropped); UTF8StringHelper path (fileDropped); strings.push_back (std::string (path)); } } } } else if (platformDrag->QueryGetData (&formatBinaryDrop) == S_OK) { if (platformDrag->GetData (&formatBinaryDrop, &medium) == S_OK) { void* data = GlobalLock (medium.hGlobal); dataSize = (int32_t)GlobalSize (medium.hGlobal); if (data && dataSize) { data = malloc (dataSize); memcpy (data, data, dataSize); nbItems = 1; } GlobalUnlock (medium.hGlobal); if (medium.pUnkForRelease) medium.pUnkForRelease->Release (); else GlobalFree (medium.hGlobal); } } } } WinDragContainer::~WinDragContainer () { if (data) { free (data); } } int32_t WinDragContainer::getCount () { return nbItems; } int32_t WinDragContainer::getDataSize (int32_t index) { if (index < nbItems) { if (data) return dataSize; return (int32_t)strings[index].length (); } return 0; } WinDragContainer::Type WinDragContainer::getDataType (int32_t index) { if (index < nbItems) { if (data) return kBinary; if (stringsAreFiles) return kFilePath; return kText; } return kError; } int32_t WinDragContainer::getData (int32_t index, const void*& buffer, Type& type) { if (index < nbItems) { if (data) { buffer = data; type = kBinary; return dataSize; } buffer = strings[index].c_str (); type = stringsAreFiles ? kFilePath : kText; return (int32_t)strings[index].length (); } return 0; } bool WinDragContainer::checkResolveLink (const TCHAR* nativePath, TCHAR* resolved) { const TCHAR* ext = VSTGUI_STRRCHR (nativePath, '.'); if (ext && VSTGUI_STRICMP (ext, TEXT(".lnk")) == NULL) { IShellLink* psl; IPersistFile* ppf; WIN32_FIND_DATA wfd; HRESULT hres; WORD wsz[2048]; // Get a pointer to the IShellLink interface. hres = CoCreateInstance (CLSID_ShellLink, NULL, <API key>, IID_IShellLink, (void**)&psl); if (SUCCEEDED (hres)) { // Get a pointer to the IPersistFile interface. hres = psl->QueryInterface (IID_IPersistFile, (void**)&ppf); if (SUCCEEDED (hres)) { // Load the shell link. hres = ppf->Load ((LPWSTR)wsz, STGM_READ); if (SUCCEEDED (hres)) { hres = psl->Resolve (0, MAKELONG (SLR_ANY_MATCH | SLR_NO_UI, 500)); if (SUCCEEDED (hres)) { // Get the path to the link target. hres = psl->GetPath (resolved, 2048, &wfd, SLGP_SHORTPATH); } } // Release pointer to IPersistFile interface. ppf->Release (); } // Release pointer to IShellLink interface. psl->Release (); } return SUCCEEDED(hres); } return false; } } // namespace #endif // WINDOWS
#include <iostream> #include <stdio.h> #include <vector> //using namespace std; int main() { char ch; int counter = 0; int max = 0; std::vector<char> inputtext; std::cout << "Enter text including '.' at the end of the text" << std::endl; int i = 0; do { ch = getchar(); inputtext.push_back(ch); do { ch = getchar(); inputtext.push_back(ch); counter++; } while (ch != '.' && ch != ' ' && ch != '\n'); if (counter > max) { max = counter; } counter = 0; } while (ch != '.'); std::cout << max << std::endl; return 0; }
package org.georgie.web.error; public final class <API key> extends RuntimeException { public <API key>() { super(); } public <API key>(final String message, final Throwable cause) { super(message, cause); } public <API key>(final String message) { super(message); } public <API key>(final Throwable cause) { super(cause); } private static final long serialVersionUID = <API key>; }
using System; using System.Collections.Generic; public static class AdventureDeck { public static List<Card> DeckOpponent; public static List<Card> DeckPlayer; public static List<Card> CollectionPlayer; static AdventureDeck() { DeckOpponent = new List<Card>(); DeckPlayer = new List<Card>(); CollectionPlayer = new List<Card>(); DebugAddCardsToDeck(); //TODO: Load from PlayerCards deck } public static void DebugAddCardsToDeck() { while (DeckPlayer.Count < 20) { DeckPlayer.Add(Repository.<API key>().GetRandomCard()); } } [Serializable] public class PlayerCards { public List<Card> Deck; public List<Card> Collection; } }
'use strict'; import sharp from 'sharp'; import extend from 'xtend'; export let inputs = ['jpg', 'jpeg', 'png', 'webp', 'tif', 'tiff']; export let outputs = ['jpg', 'png', 'webp']; let options = { w: null, h: null, q: 80, // default `libvips` value fit: 'max', fm: 'jpg' }; function optimise(filename, opts) { opts = opts || {}; opts = extend(options, opts); // convert to `jpeg` which is what `libvips` uses // and default to `jpeg` if `fm` is not supported if ('jpg' === opts.fm || !~outputs.indexOf(opts.fm)) opts.fm = 'jpeg'; let q = Math.min(getNumber('q', opts), 100); let w = getNumber('w', opts); let h = getNumber('h', opts); let fit = opts.fit; let fm = opts.fm; let transforms = sharp(filename) .progressive() .rotate() .withoutEnlargement() .quality(parseInt(q)) .compressionLevel(9) .sequentialRead() .resize(parseInt(w), parseInt(h)); if (fit !== 'crop') { transforms.max(); } transforms.toFormat(fm); return { transforms, fm }; } export default optimise; function getNumber(key, obj) { let ret = Number(obj[key]); return Number.isNaN(ret) ? options[key] : ret; }
var CitationEditor = { addCitationTpl: function (params) { $("#citationContainer").append(Mustache.render($("#step3_tpl").html(), params)); }, newCitationField: function (raw) { var $tpl = $.parseHTML($("#step3_tpl").html().trim()); if (typeof raw !== "undefined") { $("input[name=raw]", $tpl).attr("value", raw); } $($tpl).removeClass("hide"); $("#citationContainer").append($tpl); this.<API key>(); }, parseAndAppend: function (txt, elem) { OjsCommon.waitModal(); $(".<API key>").val(""); $("#citationPasteField").slideUp(); $.post(OjsCommon.api.urls.citeParser, {"citations": txt, "apikey": OjsCommon.api.userApikey}, function (res) { if (typeof res === "object") { for (i in res) { citationItem = res[i]; var $tpl = $.parseHTML($("#step3_tpl").html().trim()); $($tpl).removeClass("hide"); var $mustFields = $($("option[value=" + citationItem.type + "]", $tpl)).data("must"); var $shouldFields = $($("option[value=" + citationItem.type + "]", $tpl)).data("should"); var fields = $mustFields.concat($shouldFields); $(".<API key>", $tpl).html(""); $('.citation_type option[value=' + citationItem.type + ']', $tpl).prop('selected', true); var $citeItemMustTpl = $("#<API key>").html(); var $citeItemShouldTpl = $("#<API key>").html(); for (var i in $mustFields) { renderedTpl = Mustache.render($citeItemMustTpl, {'field': $mustFields[i], 'value': ''}); $(".<API key>", $tpl).append(renderedTpl); } for (var i in $shouldFields) { renderedTpl = Mustache.render($citeItemShouldTpl, {'field': $shouldFields[i], 'value': ''}); $(".<API key>", $tpl).append(renderedTpl); } $("input[name=raw]", $tpl).attr("value", citationItem.raw); $.each(citationItem, function (k, v) { if ($.inArray(k, fields) > -1) { $('.<API key> input[name=' + k + ']', $tpl).attr('value', v); } }); if (typeof elem === "undefined") { $("#citationContainer").append($tpl); } else { elem.after($tpl); elem.remove(); } } } }) .done(function () { CitationEditor.<API key>(); OjsCommon.hideallModals(); }) .error(function () { OjsCommon.errorModal("We can't parse your citation for now. Please add your citation details below."); CitationEditor.<API key>(txt); }); }, <API key>: function (txt) { items = txt.split("\n"); for (i in items) { if (items[i].length > 0) { CitationEditor.newCitationField(items[i]); } } }, <API key>: function () { $("#citationContainer input[name='orderNum']").each(function (index) { $(this).attr("value", index + 1); }); }, <API key>: function ($el) { var $mustFields = $($("option:selected", $el)).data("must"); var $shouldFields = $($("option:selected", $el)).data("should"); var $targetElm = $('.<API key>', $el.parent().parent()); $targetElm.html(""); for (var i in $mustFields) { $targetElm.append( '<input type="text" class="form-control input-sm has-warning" placeholder="' + $mustFields[i] + ' *" name="' + $mustFields[i] + '" /> '); } for (var i in $shouldFields) { $targetElm.append( '<input type="text" class="form-control input-sm " placeholder="' + $shouldFields[i] + '" name="' + $shouldFields[i] + '" /> '); } } }; $(document).ready(function () { $("#citationContainer").on("change", ".citationDetails select", function () { }); $("#<API key>").click(function (e) { e.preventDefault(); CitationEditor.newCitationField(); }); $("#clearAllCitations").click(function (e) { e.preventDefault(); $(".cite-item").slideUp(); $(".cite-item").remove(); CitationEditor.<API key>(); }); $("body").on("click", "a.<API key>", function (e) { e.preventDefault(); $(this).parents().closest(".cite-item").slideUp(); $(this).parents().closest(".cite-item").remove(); CitationEditor.<API key>(); }); $("body").on("click", "a.<API key>", function (e) { e.preventDefault(); $citeItem = $(this).parents().closest(".cite-item"); $citeText = $('input[name=raw]', $citeItem).val(); CitationEditor.parseAndAppend($citeText, $citeItem); }); $("body").on("click", ".addCitationDetails", function (e) { e.preventDefault(); $(this).parent().parent().next(".citationDetails").slideToggle("fast"); }); $("body").on("click", "#<API key>", function (e) { e.preventDefault(); $("#citationPasteField").slideToggle(); }); $("body").on("paste", '.<API key>', function () { var element = this; setTimeout(function () { var txt = $(element).val(); CitationEditor.parseAndAppend(txt); }, 100); }); $("body").on("click", '.<API key>', function () { var element = $('.<API key>'); setTimeout(function () { var txt = $(element).val(); CitationEditor.parseAndAppend(txt); }, 100); }); var citeDetails = []; $("#saveArticleCitation").on("click", function () { $(".cite-item").each(function () { if ($("select[name='type']", $(this)).val().length !== 0) { var details = {}; details.type = $("select[name='type']", $(this)).val(); details.orderNum = $("input[name=orderNum]", $(this)).val(); details.raw = $("input[name=raw]", $(this)).val(); details.settings = {}; $(".<API key> input", $(this)).each(function () { details['settings'][$(this).attr('name')] = $(this).val(); }); citeDetails.push(details); } }); $.post(REST_API_BASEURL + "articles/" + articleId + "/bulkcitations", {cites: JSON.stringify(citeDetails)}, function (resp) { window.location.href = "/manager/article/" + articleId + "/show"; }); }); });
var http = require('http'); var bl = require('bl'); var url = process.argv[2]; http.get(url, function(request) { request.pipe(bl(function(err, data) { if (err) { return console.error(data); } data = data.toString(); console.log(data.length); console.log(data); })); });
#ifndef _FFCONF #define _FFCONF 4004 /* Revision ID */ #define _FS_TINY 0 /* 0:Normal or 1:Tiny */ /* When _FS_TINY is set to 1, FatFs uses the sector buffer in the file system / object instead of the sector buffer in the individual file object for file / data transfer. This reduces memory consumption 512 bytes each file object. */ #define _FS_READONLY 0 /* 0:Read/Write or 1:Read only */ /* Setting _FS_READONLY to 1 defines read only configuration. This removes / writing functions, f_write, f_sync, f_unlink, f_mkdir, f_chmod, f_rename, / f_truncate and useless f_getfree. */ #define _FS_MINIMIZE 0 /* 0 to 3 */ /* The _FS_MINIMIZE option defines minimization level to remove some functions. / / 0: Full function. / 1: f_stat, f_getfree, f_unlink, f_mkdir, f_chmod, f_truncate and f_rename / are removed. / 2: f_opendir and f_readdir are removed in addition to 1. / 3: f_lseek is removed in addition to 2. */ #define _USE_STRFUNC 0 /* 0:Disable or 1-2:Enable */ /* To enable string functions, set _USE_STRFUNC to 1 or 2. */ #define _USE_MKFS 0 /* 0:Disable or 1:Enable */ /* To enable f_mkfs function, set _USE_MKFS to 1 and set _FS_READONLY to 0 */ #define _USE_FORWARD 0 /* 0:Disable or 1:Enable */ /* To enable f_forward function, set _USE_FORWARD to 1 and set _FS_TINY to 1. */ #define _USE_FASTSEEK 0 /* 0:Disable or 1:Enable */ /* To enable fast seek feature, set _USE_FASTSEEK to 1. */ #define _CODE_PAGE 437 /* The _CODE_PAGE specifies the OEM code page to be used on the target system. / Incorrect setting of the code page can cause a file open failure. / / 932 - Japanese Shift-JIS (DBCS, OEM, Windows) / 936 - Simplified Chinese GBK (DBCS, OEM, Windows) / 949 - Korean (DBCS, OEM, Windows) / 950 - Traditional Chinese Big5 (DBCS, OEM, Windows) / 1250 - Central Europe (Windows) / 1251 - Cyrillic (Windows) / 1252 - Latin 1 (Windows) / 1253 - Greek (Windows) / 1254 - Turkish (Windows) / 1255 - Hebrew (Windows) / 1256 - Arabic (Windows) / 1257 - Baltic (Windows) / 1258 - Vietnam (OEM, Windows) / 437 - U.S. (OEM) / 720 - Arabic (OEM) / 737 - Greek (OEM) / 775 - Baltic (OEM) / 850 - Multilingual Latin 1 (OEM) / 858 - Multilingual Latin 1 + Euro (OEM) / 852 - Latin 2 (OEM) / 855 - Cyrillic (OEM) / 866 - Russian (OEM) / 857 - Turkish (OEM) / 862 - Hebrew (OEM) / 874 - Thai (OEM, Windows) / 1 - ASCII only (Valid for non LFN cfg.) */ #define _USE_LFN 2 /* 0 to 3 */ #define _MAX_LFN 255 /* Maximum LFN length to handle (12 to 255) */ /* The _USE_LFN option switches the LFN support. / / 0: Disable LFN feature. _MAX_LFN and _LFN_UNICODE have no effect. / 1: Enable LFN with static working buffer on the BSS. Always NOT reentrant. / 2: Enable LFN with dynamic working buffer on the STACK. / 3: Enable LFN with dynamic working buffer on the HEAP. / / The LFN working buffer occupies (_MAX_LFN + 1) * 2 bytes. To enable LFN, / Unicode handling functions ff_convert() and ff_wtoupper() must be added / to the project. When enable to use heap, memory control functions / ff_memalloc() and ff_memfree() must be added to the project. */ #define _LFN_UNICODE 0 /* 0:ANSI/OEM or 1:Unicode */ /* To switch the character code set on FatFs API to Unicode, / enable LFN feature and set _LFN_UNICODE to 1. */ #define _FS_RPATH 0 /* 0 to 2 */ /* The _FS_RPATH option configures relative path feature. / / 0: Disable relative path feature and remove related functions. / 1: Enable relative path. f_chdrive() and f_chdir() are available. / 2: f_getcwd() is available in addition to 1. / / Note that output of the f_readdir fnction is affected by this option. */ #define _VOLUMES 3 /* Number of volumes (logical drives) to be used. */ #define _MAX_SS 512 /* 512, 1024, 2048 or 4096 */ /* Maximum sector size to be handled. / Always set 512 for memory card and hard disk but a larger value may be / required for on-board flash memory, floppy disk and optical disk. / When _MAX_SS is larger than 512, it configures FatFs to variable sector size / and GET_SECTOR_SIZE command must be implememted to the disk_ioctl function. */ #define _MULTI_PARTITION 0 /* 0:Single partition, 1/2:Enable multiple partition */ /* When set to 0, each volume is bound to the same physical drive number and / it can mount only first primaly partition. When it is set to 1, each volume / is tied to the partitions listed in VolToPart[]. */ #define _USE_ERASE 0 /* 0:Disable or 1:Enable */ /* To enable sector erase feature, set _USE_ERASE to 1. CTRL_ERASE_SECTOR command / should be added to the disk_ioctl functio. */ #define _WORD_ACCESS 0 /* 0 or 1 */ /* Set 0 first and it is always compatible with all platforms. The _WORD_ACCESS / option defines which access method is used to the word data on the FAT volume. / / 0: Byte-by-byte access. / 1: Word access. Do not choose this unless following condition is met. / / When the byte order on the memory is big-endian or address miss-aligned word / access results incorrect behavior, the _WORD_ACCESS must be set to 0. / If it is not the case, the value can also be set to 1 to improve the / performance and code size. */ /* A header file that defines sync object types on the O/S, such as / windows.h, ucos_ii.h and semphr.h, must be included prior to ff.h. */ #define _FS_REENTRANT 0 /* 0:Disable or 1:Enable */ #define _FS_TIMEOUT 1000 /* Timeout period in unit of time ticks */ #define _SYNC_t HANDLE /* O/S dependent type of sync object. e.g. HANDLE, OS_EVENT*, ID and etc.. */ /* The _FS_REENTRANT option switches the reentrancy (thread safe) of the FatFs module. / / 0: Disable reentrancy. _SYNC_t and _FS_TIMEOUT have no effect. / 1: Enable reentrancy. Also user provided synchronization handlers, / ff_req_grant, ff_rel_grant, ff_del_syncobj and ff_cre_syncobj / function must be added to the project. */ #define _FS_LOCK 0 /* 0:Disable or >=1:Enable */ /* To enable file lock control feature, set _FS_LOCK to 1 or greater. The value defines how many files can be opened simultaneously. */ #endif /* _FFCONFIG */
msos.provide("msos.intl.az.latn.az"); msos.intl.az.latn.az = { name: "az-Latn-AZ", englishName: "Azeri (Latin, Azerbaijan)", nativeName: "Azərbaycan­ılı (Azərbaycan)", language: "az-Latn", numberFormat: { ",": " ", ".": ",", percent: { pattern: ["-n%","n%"], ",": " ", ".": "," }, currency: { pattern: ["-n $","n $"], ",": " ", ".": ",", symbol: "man." } }, calendars: { standard: { "/": ".", firstDay: 1, days: { names: ["Bazar","Bazar ertəsi","Çərşənbə axşamı","Çərşənbə","Cümə axşamı","Cümə","Şənbə"], namesAbbr: ["B","Be","Ça","Ç","Ca","C","Ş"], namesShort: ["B","Be","Ça","Ç","Ca","C","Ş"] }, months: { names: ["Yanvar","Fevral","Mart","Aprel","May","İyun","İyul","Avgust","Sentyabr","Oktyabr","Noyabr","Dekabr",""], namesAbbr: ["Yan","Fev","Mar","Apr","May","İyun","İyul","Avg","Sen","Okt","Noy","Dek",""] }, monthsGenitive: { names: ["yanvar","fevral","mart","aprel","may","iyun","iyul","avgust","sentyabr","oktyabr","noyabr","dekabr",""], namesAbbr: ["Yan","Fev","Mar","Apr","May","İyun","İyul","Avg","Sen","Okt","Noy","Dek",""] }, AM: null, PM: null, patterns: { d: "dd.MM.yyyy", D: "d MMMM yyyy", t: "H:mm", T: "H:mm:ss", f: "d MMMM yyyy H:mm", F: "d MMMM yyyy H:mm:ss", M: "d MMMM", Y: "MMMM yyyy" } } } };
<?php return [ 's3' => [ 'cdn' => [ 'url' => 'https://cdn.kennyl.download', 'logo' => [ 'svg' => '/logos/logo.svg', '256' => '/logos/256x256.png', '58' => '/logos/58x58.png' ] ] ], ];
/** * @module dom * @author lifesinger@gmail.com */ KISSY.add('dom', function(S, undefined) { S.DOM = { /** * element node */ _isElementNode: function(elem) { return nodeTypeIs(elem, 1); }, /** * KISSY.Node */ _isKSNode: function(elem) { return S.Node && nodeTypeIs(elem, S.Node.TYPE); }, /** * elem window * elem document window * elem undefined window * false */ _getWin: function(elem) { return (elem && ('scrollTo' in elem) && elem['document']) ? elem : nodeTypeIs(elem, 9) ? elem.defaultView || elem.parentWindow : elem === undefined ? window : false; }, _nodeTypeIs: nodeTypeIs }; function nodeTypeIs(node, val) { return node && node.nodeType === val; } }); /** * @module selector * @author lifesinger@gmail.com */ KISSY.add('selector', function(S, undefined) { var doc = document, DOM = S.DOM, SPACE = ' ', ANY = '*', GET_DOM_NODE = 'getDOMNode', GET_DOM_NODES = GET_DOM_NODE + 's', REG_ID = /^ REG_QUERY = /^(?:#([\w-]+))?\s*([\w-]+|\*)?\.?([\w-]+)?$/; /** * Retrieves an Array of HTMLElement based on the given CSS selector. * @param {string} selector * @param {string|HTMLElement} context An #id string or a HTMLElement used as context * @return {Array} The array of found HTMLElement */ function query(selector, context) { var match, t, ret = [], id, tag, cls; context = tuneContext(context); // // tag // .cls // #id tag // #id .cls // tag.cls // #id tag.cls // 1REG_QUERY #id.cls // 2tag * // selector if (S.isString(selector)) { selector = S.trim(selector); // selector if (REG_ID.test(selector)) { t = getElementById(selector.slice(1), context); if (t) ret = [t]; // } // selector 6 else if ((match = REG_QUERY.exec(selector))) { id = match[1]; tag = match[2]; cls = match[3]; if ((context = id ? getElementById(id, context) : context)) { // #id .cls | #id tag.cls | .cls | tag.cls if (cls) { if (!id || selector.indexOf(SPACE) !== -1) { // #id.cls ret = <API key>(cls, tag, context); } // #id.cls else { t = getElementById(id, context); if(t && DOM.hasClass(t, cls)) { ret = [t]; } } } // #id tag | tag else if (tag) { ret = <API key>(tag, context); } } } else if(S.ExternalSelector) { return S.ExternalSelector(selector, context); } else { error(selector); } } // selector KISSY.Node/NodeList. DOM Node else if(selector && (selector[GET_DOM_NODE] || selector[GET_DOM_NODES])) { ret = selector[GET_DOM_NODE] ? [selector[GET_DOM_NODE]()] : selector[GET_DOM_NODES](); } // selector NodeList Array else if (selector && (S.isArray(selector) || isNodeList(selector))) { ret = selector; } // selector Node else if (selector) { ret = [selector]; } // selector // NodeList if(isNodeList(ret)) { ret = S.makeArray(ret); } // attach each method ret.each = function(fn, context) { return S.each(ret, fn, context); }; return ret; } function isNodeList(o) { // 1ie window.item, typeof node.item ie // 2select item, !node.nodeType // 3 namedItem // 4<API key> querySelectorAll return o && !o.nodeType && o.item && (o != window); } // context function tuneContext(context) { // 1). context undefined if (context === undefined) { context = doc; } // 2). context else if (S.isString(context) && REG_ID.test(context)) { context = getElementById(context.slice(1), doc); // #id context null } // 3). context HTMLElement, // 4). 1 - 3, context HTMLElement, null else if (context && context.nodeType !== 1 && context.nodeType !== 9) { context = null; } return context; } // query function getElementById(id, context) { if(context.nodeType !== 9) { context = context.ownerDocument; } return context.getElementById(id); } // query tag function <API key>(tag, context) { return context.<API key>(tag); } (function() { // Check to see if the browser returns only elements // when doing <API key>('*') // Create a fake element var div = doc.createElement('div'); div.appendChild(doc.createComment('')); // Make sure no comments are found if (div.<API key>(ANY).length > 0) { <API key> = function(tag, context) { var ret = context.<API key>(tag); if (tag === ANY) { var t = [], i = 0, j = 0, node; while ((node = ret[i++])) { // Filter out possible comments if (node.nodeType === 1) { t[j++] = node; } } ret = t; } return ret; }; } })(); // query .cls function <API key>(cls, tag, context) { var els = context.<API key>(cls), ret = els, i = 0, j = 0, len = els.length, el; if (tag && tag !== ANY) { ret = []; tag = tag.toUpperCase(); for (; i < len; ++i) { el = els[i]; if (el.tagName === tag) { ret[j++] = el; } } } return ret; } if (!doc.<API key>) { // querySelectorAll if (doc.querySelectorAll) { <API key> = function(cls, tag, context) { return context.querySelectorAll((tag ? tag : '') + '.' + cls); } } else { <API key> = function(cls, tag, context) { var els = context.<API key>(tag || ANY), ret = [], i = 0, j = 0, len = els.length, el, t; cls = SPACE + cls + SPACE; for (; i < len; ++i) { el = els[i]; t = el.className; if (t && (SPACE + t + SPACE).indexOf(cls) > -1) { ret[j++] = el; } } return ret; } } } // throw exception function error(msg) { S.error('Unsupported selector: ' + msg); } // public api S.query = query; S.get = function(selector, context) { return query(selector, context)[0] || null; }; S.mix(DOM, { query: query, get: S.get, /** * Filters an array of elements to only include matches of a filter. * @param filter selector or fn */ filter: function(selector, filter) { var elems = query(selector), match, tag, cls, ret = []; // tag.cls if (S.isString(filter) && (match = REG_QUERY.exec(filter)) && !match[1]) { tag = match[2]; cls = match[3]; filter = function(elem) { return !((tag && elem.tagName !== tag.toUpperCase()) || (cls && !DOM.hasClass(elem, cls))); } } if (S.isFunction(filter)) { ret = S.filter(elems, filter); } // filter, else if (filter && S.ExternalSelector) { ret = S.ExternalSelector._filter(selector, filter + ''); } // filter selector else { error(filter); } return ret; }, /** * Returns true if the passed element(s) match the passed filter */ test: function(selector, filter) { var elems = query(selector); return elems.length && (DOM.filter(elems, filter).length === elems.length); } }); }); /** * @module dom-data * @author lifesinger@gmail.com */ KISSY.add('dom-data', function(S, undefined) { var win = window, DOM = S.DOM, expando = '_ks_data_' + S.now(), // kissy expando dataCache = { }, // node data winDataCache = { }, // The following elements throw uncatchable exceptions if you // attempt to add expando properties to them. noData = { EMBED: 1, OBJECT: 1, APPLET: 1 }; S.mix(DOM, { /** * Store arbitrary data associated with the matched elements. */ data: function(selector, name, data) { // suports hash if (S.isPlainObject(name)) { for (var k in name) { DOM.data(selector, k, name[k]); } return; } // getter if (data === undefined) { var elem = S.get(selector), isNode, cache, key, thisCache; if (!elem || noData[elem.nodeName]) return; if (elem == win) elem = winDataCache; isNode = checkIsNode(elem); cache = isNode ? dataCache : elem; key = isNode ? elem[expando] : expando; thisCache = cache[key]; if(S.isString(name) && thisCache) { return thisCache[name]; } return thisCache; } // setter else { S.query(selector).each(function(elem) { if (!elem || noData[elem.nodeName]) return; if (elem == win) elem = winDataCache; var cache = dataCache, key; if (!checkIsNode(elem)) { key = expando; cache = elem; } else if (!(key = elem[expando])) { key = elem[expando] = S.guid(); } if (name && data !== undefined) { if (!cache[key]) cache[key] = { }; cache[key][name] = data; } }); } }, /** * Remove a previously-stored piece of data. */ removeData: function(selector, name) { S.query(selector).each(function(elem) { if (!elem) return; if (elem == win) elem = winDataCache; var key, cache = dataCache, thisCache, isNode = checkIsNode(elem); if (!isNode) { cache = elem; key = expando; } else { key = elem[expando]; } if (!key) return; thisCache = cache[key]; // If we want to remove a specific section of the element's data if (name) { if (thisCache) { delete thisCache[name]; // If we've removed all the data, remove the element's cache if (S.isEmptyObject(thisCache)) { DOM.removeData(elem); } } } // Otherwise, we want to remove all of the element's data else { if (!isNode) { try { delete elem[expando]; } catch(ex) { } } else if (elem.removeAttribute) { elem.removeAttribute(expando); } // Completely remove the data cache if (isNode) { delete cache[key]; } } }); } }); function checkIsNode(elem) { return elem && elem.nodeType; } }); /** * @module dom-class * @author lifesinger@gmail.com */ KISSY.add('dom-class', function(S, undefined) { var SPACE = ' ', DOM = S.DOM, REG_SPLIT = /[\.\s]\s*\.?/, REG_CLASS = /[\n\t]/g; S.mix(DOM, { /** * Determine whether any of the matched elements are assigned the given class. */ hasClass: function(selector, value) { return batch(selector, value, function(elem, classNames, cl) { var elemClass = elem.className; if (elemClass) { var className = SPACE + elemClass + SPACE, j = 0, ret = true; for (; j < cl; j++) { if (className.indexOf(SPACE + classNames[j] + SPACE) < 0) { ret = false; break; } } if (ret) return true; } }, true); }, /** * Adds the specified class(es) to each of the set of matched elements. */ addClass: function(selector, value) { batch(selector, value, function(elem, classNames, cl) { var elemClass = elem.className; if (!elemClass) { elem.className = value; } else { var className = SPACE + elemClass + SPACE, setClass = elemClass, j = 0; for (; j < cl; j++) { if (className.indexOf(SPACE + classNames[j] + SPACE) < 0) { setClass += SPACE + classNames[j]; } } elem.className = S.trim(setClass); } }); }, /** * Remove a single class, multiple classes, or all classes from each element in the set of matched elements. */ removeClass: function(selector, value) { batch(selector, value, function(elem, classNames, cl) { var elemClass = elem.className; if (elemClass) { if (!cl) { elem.className = ''; } else { var className = (SPACE + elemClass + SPACE).replace(REG_CLASS, SPACE), j = 0, needle; for (; j < cl; j++) { needle = SPACE + classNames[j] + SPACE; // cls 'link link2 link link3 link' while (className.indexOf(needle) >= 0) { className = className.replace(needle, SPACE); } } elem.className = S.trim(className); } } }); }, /** * Replace a class with another class for matched elements. * If no oldClassName is present, the newClassName is simply added. */ replaceClass: function(selector, oldClassName, newClassName) { DOM.removeClass(selector, oldClassName); DOM.addClass(selector, newClassName); }, /** * Add or remove one or more classes from each element in the set of * matched elements, depending on either the class's presence or the * value of the switch argument. * @param state {Boolean} optional boolean to indicate whether class * should be added or removed regardless of current state. */ toggleClass: function(selector, value, state) { var isBool = S.isBoolean(state), has; batch(selector, value, function(elem, classNames, cl) { var j = 0, className; for (; j < cl; j++) { className = classNames[j]; has = isBool ? !state : DOM.hasClass(elem, className); DOM[has ? 'removeClass' : 'addClass'](elem, className); } }); } }); function batch(selector, value, fn, resultIsBool) { if (!(value = S.trim(value))) return resultIsBool ? false : undefined; var elems = S.query(selector), i = 0, len = elems.length, classNames = value.split(REG_SPLIT), elem, ret; for (; i < len; i++) { elem = elems[i]; if (DOM._isElementNode(elem)) { ret = fn(elem, classNames, classNames.length); if (ret !== undefined) return ret; } } if (resultIsBool) return false; } }); /** * NOTES: * - hasClass/addClass/removeClass jQuery * - toggleClass value undefined jQuery */ /** * @module dom-attr * @author lifesinger@gmail.com */ KISSY.add('dom-attr', function(S, undefined) { var UA = S.UA, doc = document, docElement = doc.documentElement, oldIE = !docElement.hasAttribute, TEXT = docElement.textContent !== undefined ? 'textContent' : 'innerText', SELECT = 'select', EMPTY = '', CHECKED = 'checked', STYLE = 'style', DOM = S.DOM, isElementNode = DOM._isElementNode, isTextNode = function(elem) { return DOM._nodeTypeIs(elem, 3); }, RE_SPECIAL_ATTRS = /^(?:href|src|style)/, RE_NORMALIZED_ATTRS = /^(?:href|src|colspan|rowspan)/, RE_RETURN = /\r/g, RE_RADIO_CHECK = /^(?:radio|checkbox)/, CUSTOM_ATTRS = { readonly: 'readOnly' }, attrFn = { val: 1, css: 1, html: 1, text: 1, data: 1, width: 1, height: 1, offset: 1 }; if (oldIE) { S.mix(CUSTOM_ATTRS, { 'for': 'htmlFor', 'class': 'className' }); } S.mix(DOM, { /** * Gets the value of an attribute for the first element in the set of matched elements or * Sets an attribute for the set of matched elements. */ attr: function(selector, name, val, pass) { // suports hash if (S.isPlainObject(name)) { pass = val; for (var k in name) { DOM.attr(selector, k, name[k], pass); } return; } if (!(name = S.trim(name))) return; name = name.toLowerCase(); // attr functions if (pass && attrFn[name]) { return DOM[name](selector, val); } // custom attrs name = CUSTOM_ATTRS[name] || name; // getter if (val === undefined) { // supports css selector/Node/NodeList var el = S.get(selector); // only get attributes on element nodes if (!isElementNode(el)) { return undefined; } var ret; // el[name] mapping // - readonly, checked, selected mapping // - getAttribute tabindex // - href, src normalized // - style getAttribute if (!RE_SPECIAL_ATTRS.test(name)) { ret = el[name]; } // getAttribute mapping href/src/style if (ret === undefined) { ret = el.getAttribute(name); } // fix ie bugs if (oldIE) { // href, src, rowspan mapping 2 if (RE_NORMALIZED_ATTRS.test(name)) { ret = el.getAttribute(name, 2); } // getAttribute style // IE7- cssText else if (name === STYLE) { ret = el[STYLE].cssText; } } // undefined return ret === null ? undefined : ret; } // setter S.each(S.query(selector), function(el) { // only set attributes on element nodes if (!isElementNode(el)) { return; } // oldIE IE8 IE7 if (name === STYLE) { el[STYLE].cssText = val; } else { // checked if(name === CHECKED) { el[name] = !!val; } // convert the value to a string (all browsers do this but IE) el.setAttribute(name, EMPTY + val); } }); }, /** * Removes the attribute of the matched elements. */ removeAttr: function(selector, name) { S.each(S.query(selector), function(el) { if (isElementNode(el)) { DOM.attr(el, name, EMPTY); el.removeAttribute(name); } }); }, /** * Gets the current value of the first element in the set of matched or * Sets the value of each element in the set of matched elements. */ val: function(selector, value) { // getter if (value === undefined) { // supports css selector/Node/NodeList var el = S.get(selector); // only gets value on element nodes if (!isElementNode(el)) { return undefined; } if (nodeNameIs('option', el)) { return (el.attributes.value || {}).specified ? el.value : el.text; } // select, multiple type, if (nodeNameIs(SELECT, el)) { var index = el.selectedIndex, options = el.options; if (index < 0) { return null; } else if (el.type === 'select-one') { return DOM.val(options[index]); } // Loop through all the selected options var ret = [], i = 0, len = options.length; for (; i < len; ++i) { if (options[i].selected) { ret.push(DOM.val(options[i])); } } // Multi-Selects return an array return ret; } // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified if (UA.webkit && RE_RADIO_CHECK.test(el.type)) { return el.getAttribute('value') === null ? 'on' : el.value; } // value, \r return (el.value || EMPTY).replace(RE_RETURN, EMPTY); } // setter S.each(S.query(selector), function(el) { if (nodeNameIs(SELECT, el)) { // inArray if (S.isNumber(value)) { value += EMPTY; } var vals = S.makeArray(value), opts = el.options, opt; for (i = 0,len = opts.length; i < len; ++i) { opt = opts[i]; opt.selected = S.inArray(DOM.val(opt), vals); } if (!vals.length) { el.selectedIndex = -1; } } else if (isElementNode(el)) { el.value = value; } }); }, /** * Gets the text context of the first element in the set of matched elements or * Sets the text content of the matched elements. */ text: function(selector, val) { // getter if (val === undefined) { // supports css selector/Node/NodeList var el = S.get(selector); // only gets value on supported nodes if (isElementNode(el)) { return el[TEXT] || EMPTY; } else if (isTextNode(el)) { return el.nodeValue; } } // setter else { S.each(S.query(selector), function(el) { if (isElementNode(el)) { el[TEXT] = val; } else if (isTextNode(el)) { el.nodeValue = val; } }); } } }); // el nodeName function nodeNameIs(val, el) { return el && el.nodeName.toUpperCase() === val.toUpperCase(); } }); /** * NOTES: * * 2010.03 * - jquery/support.js special attrs maxlength, cellspacing, * rowspan, colspan, useap, frameboder, Grade-A * * - colspan/rowspan ie7- href * 2 jQuery bug. * - jQuery tabindex kissy * - jquery/attributes.js: Safari mis-reports the default selected * property of an option Safari 4 * */ /** * @module dom * @author lifesinger@gmail.com */ KISSY.add('dom-style', function(S, undefined) { var DOM = S.DOM, UA = S.UA, doc = document, docElem = doc.documentElement, STYLE = 'style', FLOAT = 'float', CSS_FLOAT = 'cssFloat', STYLE_FLOAT = 'styleFloat', WIDTH = 'width', HEIGHT = 'height', AUTO = 'auto', DISPLAY = 'display', NONE = 'none', PARSEINT = parseInt, RE_LT = /^(?:left|top)/, RE_NEED_UNIT = /^(?:width|height|top|left|right|bottom|margin|padding)/i, RE_DASH = /-([a-z])/ig, CAMELCASE_FN = function(all, letter) { return letter.toUpperCase(); }, EMPTY = '', DEFAULT_UNIT = 'px', CUSTOM_STYLES = { }, defaultDisplay = { }; S.mix(DOM, { _CUSTOM_STYLES: CUSTOM_STYLES, _getComputedStyle: function(elem, name) { var val = '', d = elem.ownerDocument; if (elem[STYLE]) { val = d.defaultView.getComputedStyle(elem, null)[name]; } return val; }, /** * Gets or sets styles on the matches elements. */ css: function(selector, name, val) { // suports hash if (S.isPlainObject(name)) { for (var k in name) { DOM.css(selector, k, name[k]); } return; } if (name.indexOf('-') > 0) { // webkit camel-case, cameCase name = name.replace(RE_DASH, CAMELCASE_FN); } name = CUSTOM_STYLES[name] || name; // getter if (val === undefined) { // supports css selector/Node/NodeList var elem = S.get(selector), ret = ''; if (elem && elem[STYLE]) { ret = name.get ? name.get(elem) : elem[STYLE][name]; // get if (ret === '' && !name.get) { ret = fixComputedStyle(elem, name, DOM._getComputedStyle(elem, name)); } } return ret === undefined ? '' : ret; } // setter else { // normalize unsetting if (val === null || val === EMPTY) { val = EMPTY; } // number values may need a unit else if (!isNaN(new Number(val)) && RE_NEED_UNIT.test(name)) { val += DEFAULT_UNIT; } // ignore negative width and height values if ((name === WIDTH || name === HEIGHT) && parseFloat(val) < 0) { return; } S.each(S.query(selector), function(elem) { if (elem && elem[STYLE]) { name.set ? name.set(elem, val) : (elem[STYLE][name] = val); if (val === EMPTY) { if (!elem[STYLE].cssText) elem.removeAttribute(STYLE); } } }); } }, /** * Get the current computed width for the first element in the set of matched elements or * set the CSS width of each element in the set of matched elements. */ width: function(selector, value) { // getter if (value === undefined) { return getWH(selector, WIDTH); } // setter else { DOM.css(selector, WIDTH, value); } }, /** * Get the current computed height for the first element in the set of matched elements or * set the CSS height of each element in the set of matched elements. */ height: function(selector, value) { // getter if (value === undefined) { return getWH(selector, HEIGHT); } // setter else { DOM.css(selector, HEIGHT, value); } }, /** * Show the matched elements. */ show: function(selector) { S.query(selector).each(function(elem) { if (!elem) return; elem.style[DISPLAY] = DOM.data(elem, DISPLAY) || EMPTY; // css display: none if (DOM.css(elem, DISPLAY) === NONE) { var tagName = elem.tagName, old = defaultDisplay[tagName], tmp; if (!old) { tmp = doc.createElement(tagName); doc.body.appendChild(tmp); old = DOM.css(tmp, DISPLAY); DOM.remove(tmp); defaultDisplay[tagName] = old; } DOM.data(elem, DISPLAY, old); elem.style[DISPLAY] = old; } }); }, /** * Hide the matched elements. */ hide: function(selector) { S.query(selector).each(function(elem) { if (!elem) return; var style = elem.style, old = style[DISPLAY]; if (old !== NONE) { if (old) { DOM.data(elem, DISPLAY, old); } style[DISPLAY] = NONE; } }); }, /** * Display or hide the matched elements. */ toggle: function(selector) { S.query(selector).each(function(elem) { if (elem) { if (elem.style[DISPLAY] === NONE) { DOM.show(elem); } else { DOM.hide(elem); } } }); }, /** * Creates a stylesheet from a text blob of rules. * These rules will be wrapped in a STYLE tag and appended to the HEAD of the document. * @param {String} cssText The text containing the css rules * @param {String} id An id to add to the stylesheet for later removal */ addStyleSheet: function(cssText, id) { var elem; if (id && (id = id.replace('#', EMPTY))) elem = S.get('#' + id); if (elem) return; elem = DOM.create('<style>', { id: id }); // DOM cssText css hack S.get('head').appendChild(elem); if (elem.styleSheet) { elem.styleSheet.cssText = cssText; } else { // W3C elem.appendChild(doc.createTextNode(cssText)); } } }); // normalize reserved word float alternatives ("cssFloat" or "styleFloat") if (docElem[STYLE][CSS_FLOAT] !== undefined) { CUSTOM_STYLES[FLOAT] = CSS_FLOAT; } else if (docElem[STYLE][STYLE_FLOAT] !== undefined) { CUSTOM_STYLES[FLOAT] = STYLE_FLOAT; } function getWH(selector, name) { var elem = S.get(selector), which = name === WIDTH ? ['Left', 'Right'] : ['Top', 'Bottom'], val = name === WIDTH ? elem.offsetWidth : elem.offsetHeight; S.each(which, function(direction) { val -= parseFloat(DOM._getComputedStyle(elem, 'padding' + direction)) || 0; val -= parseFloat(DOM._getComputedStyle(elem, 'border' + direction + 'Width')) || 0; }); return val; } // getComputedStyle function fixComputedStyle(elem, name, val) { var offset, ret = val; // 1. style.left getComputedStyle // firefox 0, webkit/ie auto // 2. style.left // relative 0. absolute offsetLeft - marginLeft if (val === AUTO && RE_LT.test(name)) { ret = 0; if (S.inArray(DOM.css(elem, 'position'), ['absolute','fixed'])) { offset = elem[name === 'left' ? 'offsetLeft' : 'offsetTop']; // ie8 elem.offsetLeft offsetParent border // TODO: if (UA.ie === 8 || UA.opera) { offset -= PARSEINT(DOM.css(elem.offsetParent, 'border-' + name + '-width')) || 0; } ret = offset - (PARSEINT(DOM.css(elem, 'margin-' + name)) || 0); } } return ret; } }); /** * @module dom * @author lifesinger@gmail.com */ KISSY.add('dom-style-ie', function(S, undefined) { // only for ie if (!S.UA.ie) return; var DOM = S.DOM, doc = document, docElem = doc.documentElement, OPACITY = 'opacity', FILTER = 'filter', FILTERS = 'filters', CURRENT_STYLE = 'currentStyle', RUNTIME_STYLE = 'runtimeStyle', LEFT = 'left', PX = 'px', CUSTOM_STYLES = DOM._CUSTOM_STYLES, RE_NUMPX = /^-?\d+(?:px)?$/i, RE_NUM = /^-?\d/, RE_WH = /^(?:width|height)$/; // use alpha filter for IE opacity try { if (docElem.style[OPACITY] === undefined && docElem[FILTERS]) { CUSTOM_STYLES[OPACITY] = { get: function(elem) { var val = 100; try { // will error if no DXImageTransform val = elem[FILTERS]['DXImageTransform.Microsoft.Alpha'][OPACITY]; } catch(e) { try { val = elem[FILTERS]('alpha')[OPACITY]; } catch(ex) { // opacity 1 } } return val / 100 + ''; }, set: function(elem, val) { var style = elem.style, currentFilter = (elem.currentStyle || 0).filter || ''; // IE has trouble with opacity if it does not have layout // Force it by setting the zoom level style.zoom = 1; // keep existed filters, and remove opacity filter if(currentFilter) { currentFilter = currentFilter.replace(/alpha\(opacity=.+\)/ig, ''); if(currentFilter) currentFilter += ', '; } // Set the alpha filter to set the opacity style[FILTER] = currentFilter + 'alpha(' + OPACITY + '=' + val * 100 + ')'; } }; } } catch(ex) { S.log('IE filters ActiveX is disabled. ex = ' + ex); } // getComputedStyle for IE if (!(doc.defaultView || { }).getComputedStyle && docElem[CURRENT_STYLE]) { DOM._getComputedStyle = function(elem, name) { var style = elem.style, ret = elem[CURRENT_STYLE][name]; // width/height pixelLeft width/height // ie offset // borderWidth borderWidth if(RE_WH.test(name)) { ret = DOM[name](elem) + PX; } // From the awesome hack by Dean Edwards // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 // If we're not dealing with a regular pixel number // but a number that has a weird ending, we need to convert it to pixels else if ((!RE_NUMPX.test(ret) && RE_NUM.test(ret))) { // Remember the original values var left = style[LEFT], rsLeft = elem[RUNTIME_STYLE][LEFT]; // Put in the new values to get a computed value out elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT]; style[LEFT] = name === 'fontSize' ? '1em' : (ret || 0); ret = style['pixelLeft'] + PX; // Revert the changed values style[LEFT] = left; elem[RUNTIME_STYLE][LEFT] = rsLeft; } return ret; } } }); /** * NOTES: * * - opacity progid:DXImageTransform.Microsoft.BasicImage(opacity=.2) * DXImageTransform.Microsoft.Alpha kissy * Alpha */ /** * @module dom-offset * @author lifesinger@gmail.com */ KISSY.add('dom-offset', function(S, undefined) { var DOM = S.DOM, UA = S.UA, win = window, doc = document, isElementNode = DOM._isElementNode, nodeTypeIs = DOM._nodeTypeIs, getWin = DOM._getWin, isStrict = doc.compatMode === 'CSS1Compat', MAX = Math.max, PARSEINT = parseInt, POSITION = 'position', RELATIVE = 'relative', DOCUMENT = 'document', BODY = 'body', DOC_ELEMENT = 'documentElement', OWNER_DOCUMENT = 'ownerDocument', VIEWPORT = 'viewport', SCROLL = 'scroll', CLIENT = 'client', LEFT = 'left', TOP = 'top', SCROLL_TO = 'scrollTo', SCROLL_LEFT = SCROLL + 'Left', SCROLL_TOP = SCROLL + 'Top', <API key> = '<API key>'; S.mix(DOM, { /** * Gets the current coordinates of the element, relative to the document. */ offset: function(elem, val) { // ownerDocument elem document fragment if (!(elem = S.get(elem)) || !elem[OWNER_DOCUMENT]) return null; // getter if (val === undefined) { return getOffset(elem); } // setter setOffset(elem, val); }, scrollIntoView: function(elem, container, top, hscroll) { if (!(elem = S.get(elem)) || !elem[OWNER_DOCUMENT]) return; hscroll = hscroll === undefined ? true : !!hscroll; top = top === undefined ? true : !!top; // default current window, use native for scrollIntoView(elem, top) if (!container || container === win) { // 1. Opera top // 2. container return elem.scrollIntoView(top); } container = S.get(container); // document window if (nodeTypeIs(container, 9)) { container = getWin(container); } var isWin = container && (SCROLL_TO in container) && container[DOCUMENT], elemOffset = DOM.offset(elem), containerOffset = isWin ? { left: DOM.scrollLeft(container), top: DOM.scrollTop(container) } : DOM.offset(container), // elem container diff = { left: elemOffset[LEFT] - containerOffset[LEFT], top: elemOffset[TOP] - containerOffset[TOP] }, // container ch = isWin ? DOM['viewportHeight'](container) : container.clientHeight, cw = isWin ? DOM['viewportWidth'](container) : container.clientWidth, // container container cl = DOM[SCROLL_LEFT](container), ct = DOM[SCROLL_TOP](container), cr = cl + cw, cb = ct + ch, // elem eh = elem.offsetHeight, ew = elem.offsetWidth, // elem container // diff.left border, cl border, l = diff.left + cl - (PARSEINT(DOM.css(container, 'borderLeftWidth')) || 0), t = diff.top + ct - (PARSEINT(DOM.css(container, 'borderTopWidth')) || 0), r = l + ew, b = t + eh, t2, l2; // elem container // 1. eh > ch elem // 2. t < ct elem container // 3. b > cb elem container // 4. elem container if (eh > ch || t < ct || top) { t2 = t; } else if (b > cb) { t2 = b - ch; } if (hscroll) { if (ew > cw || l < cl || top) { l2 = l; } else if (r > cr) { l2 = r - cw; } } if (isWin) { if (t2 !== undefined || l2 !== undefined) { container[SCROLL_TO](l2, t2); } } else { if (t2 !== undefined) { container[SCROLL_TOP] = t2; } if (l2 !== undefined) { container[SCROLL_LEFT] = l2; } } } }); // add ScrollLeft/ScrollTop getter methods S.each(['Left', 'Top'], function(name, i) { var method = SCROLL + name; DOM[method] = function(elem) { var ret = 0, w = getWin(elem), d; if (w && (d = w[DOCUMENT])) { ret = w[i ? 'pageYOffset' : 'pageXOffset'] || d[DOC_ELEMENT][method] || d[BODY][method] } else if (isElementNode((elem = S.get(elem)))) { ret = elem[method]; } return ret; } }); // add docWidth/Height, viewportWidth/Height getter methods S.each(['Width', 'Height'], function(name) { DOM['doc' + name] = function(refDoc) { var d = refDoc || doc; return MAX(isStrict ? d[DOC_ELEMENT][SCROLL + name] : d[BODY][SCROLL + name], DOM[VIEWPORT + name](d)); }; DOM[VIEWPORT + name] = function(refWin) { var prop = 'inner' + name, w = getWin(refWin), d = w[DOCUMENT]; return (prop in w) ? w[prop] : (isStrict ? d[DOC_ELEMENT][CLIENT + name] : d[BODY][CLIENT + name]); } }); // elem elem.ownerDocument function getOffset(elem) { var box, x = 0, y = 0, w = getWin(elem[OWNER_DOCUMENT]); // GBS A-Grade Browsers <API key> if (elem[<API key>]) { box = elem[<API key>](); // jQuery docElem.clientLeft/clientTop // html body / // ie6 html margin html margin x = box[LEFT]; y = box[TOP]; // iphone/ipad/itouch Safari <API key> scrollTop if (UA.mobile !== 'apple') { x += DOM[SCROLL_LEFT](w); y += DOM[SCROLL_TOP](w); } } return { left: x, top: y }; } // elem elem.ownerDocument function setOffset(elem, offset) { // set position first, in-case top/left are set even on static elem if (DOM.css(elem, POSITION) === 'static') { elem.style[POSITION] = RELATIVE; } var old = getOffset(elem), ret = { }, current, key; for (key in offset) { current = PARSEINT(DOM.css(elem, key), 10) || 0; ret[key] = current + offset[key] - old[key]; } DOM.css(elem, ret); } }); /** * TODO: * - jQuery position, offsetParent * - position fixed */ /** * @module dom-traversal * @author lifesinger@gmail.com */ KISSY.add('dom-traversal', function(S, undefined) { var DOM = S.DOM, isElementNode = DOM._isElementNode; S.mix(DOM, { /** * Gets the parent node of the first matched element. */ parent: function(selector, filter) { return nth(selector, filter, 'parentNode', function(elem) { return elem.nodeType != 11; }); }, /** * Gets the following sibling of the first matched element. */ next: function(selector, filter) { return nth(selector, filter, 'nextSibling'); }, /** * Gets the preceding sibling of the first matched element. */ prev: function(selector, filter) { return nth(selector, filter, 'previousSibling'); }, /** * Gets the siblings of the first matched element. */ siblings: function(selector, filter) { return getSiblings(selector, filter, true); }, /** * Gets the children of the first matched element. */ children: function(selector, filter) { return getSiblings(selector, filter); }, /** * Check to see if a DOM node is within another DOM node. */ contains: function(container, contained) { var ret = false; if ((container = S.get(container)) && (contained = S.get(contained))) { if (container.contains) { if (contained.nodeType === 3) { contained = contained.parentNode; if (contained === container) return true; } if (contained) { return container.contains(contained); } } else if (container.<API key>) { return !!(container.<API key>(contained) & 16); } else { while (!ret && (contained = contained.parentNode)) { ret = contained == container; } } } return ret; } }); // elem direction filter // filter number, selector, fn // direction parentNode, nextSibling, previousSibling function nth(elem, filter, direction, extraFilter) { if (!(elem = S.get(elem))) return null; if (filter === undefined) filter = 1; var ret = null, fi, flen; if (S.isNumber(filter) && filter >= 0) { if (filter === 0) return elem; fi = 0; flen = filter; filter = function() { return ++fi === flen; }; } while ((elem = elem[direction])) { if (isElementNode(elem) && (!filter || DOM.test(elem, filter)) && (!extraFilter || extraFilter(elem))) { ret = elem; break; } } return ret; } // elem siblings, function getSiblings(selector, filter, parent) { var ret = [], elem = S.get(selector), j, parentNode = elem, next; if (elem && parent) parentNode = elem.parentNode; if (parentNode) { for (j = 0,next = parentNode.firstChild; next; next = next.nextSibling) { if (isElementNode(next) && next !== elem && (!filter || DOM.test(next, filter))) { ret[j++] = next; } } } return ret; } }); /** * NOTES: * * - api jQuery. api first-all * 8/2 * */ /** * @module dom-create * @author lifesinger@gmail.com */ KISSY.add('dom-create', function(S, undefined) { var doc = document, DOM = S.DOM, UA = S.UA, ie = UA.ie, nodeTypeIs = DOM._nodeTypeIs, isElementNode = DOM._isElementNode, isKSNode = DOM._isKSNode, DIV = 'div', PARENT_NODE = 'parentNode', DEFAULT_DIV = doc.createElement(DIV), RE_TAG = /<(\w+)/, // Ref: http://jmrware.com/articles/2010/jqueryregex/jQueryRegexes.html#note_05 RE_SCRIPT = /<script([^>]*)>([^<]*(?:(?!<\/script>)<[^<]*)*)<\/script>/ig, RE_SIMPLE_TAG = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, RE_SCRIPT_SRC = /\ssrc=(['"])(.*?)\1/i, RE_SCRIPT_CHARSET = /\scharset=(['"])(.*?)\1/i; S.mix(DOM, { /** * Creates a new HTMLElement using the provided html string. */ create: function(html, props, ownerDoc) { if (nodeTypeIs(html, 1) || nodeTypeIs(html, 3)) return cloneNode(html); if (isKSNode(html)) return cloneNode(html[0]); if (!(html = S.trim(html))) return null; var ret = null, creators = DOM._creators, m, tag = DIV, k, nodes; // tag, DOM.create('<p>') if ((m = RE_SIMPLE_TAG.exec(html))) { ret = (ownerDoc || doc).createElement(m[1]); } // DOM.create('<img src="sprite.png" />') else { if ((m = RE_TAG.exec(html)) && (k = m[1]) && S.isFunction(creators[(k = k.toLowerCase())])) { tag = k; } nodes = creators[tag](html, ownerDoc).childNodes; if (nodes.length === 1) { // return single node, breaking parentNode ref from "fragment" ret = nodes[0][PARENT_NODE].removeChild(nodes[0]); } else { // return multiple nodes as a fragment ret = nl2frag(nodes, ownerDoc || doc); } } return attachProps(ret, props); }, _creators: { div: function(html, ownerDoc) { var frag = ownerDoc ? ownerDoc.createElement(DIV) : DEFAULT_DIV; frag.innerHTML = html; return frag; } }, /** * Gets/Sets the HTML contents of the HTMLElement. * @param {Boolean} loadScripts (optional) True to look for and process scripts (defaults to false). * @param {Function} callback (optional) For async script loading you can be notified when the update completes. */ html: function(selector, val, loadScripts, callback) { // getter if (val === undefined) { // supports css selector/Node/NodeList var el = S.get(selector); // only gets value on element nodes if (isElementNode(el)) { return el.innerHTML; } } // setter else { S.each(S.query(selector), function(elem) { if (isElementNode(elem)) { setHTML(elem, val, loadScripts, callback); } }); } }, /** * Remove the set of matched elements from the DOM. */ remove: function(selector) { S.each(S.query(selector), function(el) { if (isElementNode(el) && el.parentNode) { el.parentNode.removeChild(el); } }); } }); function attachProps(elem, props) { if (isElementNode(elem) && S.isPlainObject(props)) { DOM.attr(elem, props, true); } return elem; } // nodeList fragment function nl2frag(nodes, ownerDoc) { var ret = null, i, len; if (nodes && (nodes.push || nodes.item) && nodes[0]) { ownerDoc = ownerDoc || nodes[0].ownerDocument; ret = ownerDoc.<API key>(); if (nodes.item) { // convert live list to static array nodes = S.makeArray(nodes); } for (i = 0,len = nodes.length; i < len; i++) { ret.appendChild(nodes[i]); } } else { S.log('Unable to convert ' + nodes + ' to fragment.'); } return ret; } function cloneNode(elem) { var ret = elem.cloneNode(true); /** * if this is MSIE 6/7, then we need to copy the innerHTML to * fix a bug related to some form field elements */ if (UA.ie < 8) ret.innerHTML = elem.innerHTML; return ret; } function setHTML(elem, html, loadScripts, callback) { if (!loadScripts) { setHTMLSimple(elem, html); S.isFunction(callback) && callback(); return; } var id = S.guid('ks-tmp-'), re_script = new RegExp(RE_SCRIPT); html += '<span id="' + id + '"></span>'; // DOM S.available(id, function() { var hd = S.get('head'), match, attrs, srcMatch, charsetMatch, t, s, text; re_script.lastIndex = 0; while ((match = re_script.exec(html))) { attrs = match[1]; srcMatch = attrs ? attrs.match(RE_SCRIPT_SRC) : false; // script via src if (srcMatch && srcMatch[2]) { s = doc.createElement('script'); s.src = srcMatch[2]; // set charset if ((charsetMatch = attrs.match(RE_SCRIPT_CHARSET)) && charsetMatch[2]) { s.charset = charsetMatch[2]; } s.async = true; // make sure async in gecko hd.appendChild(s); } // inline script else if ((text = match[2]) && text.length > 0) { S.globalEval(text); } } (t = doc.getElementById(id)) && DOM.remove(t); S.isFunction(callback) && callback(); }); setHTMLSimple(elem, html); } // innerHTML html function setHTMLSimple(elem, html) { html = (html + '').replace(RE_SCRIPT, ''); // script try { //if(UA.ie) { elem.innerHTML = html; //} else { // Ref: //var tEl = elem.cloneNode(false); //tEl.innerHTML = html; //elem.parentNode.replaceChild(elem, tEl); // elem } // table.innerHTML = html will throw error in ie. catch(ex) { // remove any remaining nodes while (elem.firstChild) { elem.removeChild(elem.firstChild); } // html == '' appendChild if (html) elem.appendChild(DOM.create(html)); } } // only for gecko and ie // 2010-10-22: chrome gecko if (ie || UA.gecko || UA.webkit) { // creators, var creators = DOM._creators, create = DOM.create, TABLE_OPEN = '<table>', TABLE_CLOSE = '</table>', RE_TBODY = /(?:\/(?:thead|tfoot|caption|col|colgroup)>)+\s*<tbody/, creatorsMap = { option: 'select', td: 'tr', tr: 'tbody', tbody: 'table', col: 'colgroup', legend: 'fieldset' // ie gecko }; for (var p in creatorsMap) { (function(tag) { creators[p] = function(html, ownerDoc) { return create('<' + tag + '>' + html + '</' + tag + '>', null, ownerDoc); } })(creatorsMap[p]); } if (ie) { // IE script creators.script = function(html, ownerDoc) { var frag = ownerDoc ? ownerDoc.createElement(DIV) : DEFAULT_DIV; frag.innerHTML = '-' + html; frag.removeChild(frag.firstChild); return frag; }; // IE7- adds TBODY when creating thead/tfoot/caption/col/colgroup elements if (ie < 8) { creators.tbody = function(html, ownerDoc) { var frag = create(TABLE_OPEN + html + TABLE_CLOSE, null, ownerDoc), tbody = frag.children['tags']('tbody')[0]; if (frag.children.length > 1 && tbody && !RE_TBODY.test(html)) { tbody[PARENT_NODE].removeChild(tbody); // strip extraneous tbody } return frag; }; } } S.mix(creators, { optgroup: creators.option, // gecko ie th: creators.td, thead: creators.tbody, tfoot: creators.tbody, caption: creators.tbody, colgroup: creators.tbody }); } }); /** * TODO: * - jQuery buildFragment clean * - cache, test cases * - props * - remove */ /** * @module dom-insertion * @author lifesinger@gmail.com */ KISSY.add('dom-insertion', function(S) { var DOM = S.DOM, PARENT_NODE = 'parentNode', NEXT_SIBLING = 'nextSibling'; S.mix(DOM, { /** * Inserts the new node as the previous sibling of the reference node. * @return {HTMLElement} The node that was inserted (or null if insert fails) */ insertBefore: function(newNode, refNode) { if ((newNode = S.get(newNode)) && (refNode = S.get(refNode)) && refNode[PARENT_NODE]) { refNode[PARENT_NODE].insertBefore(newNode, refNode); } return newNode; }, /** * Inserts the new node as the next sibling of the reference node. * @return {HTMLElement} The node that was inserted (or null if insert fails) */ insertAfter: function(newNode, refNode) { if ((newNode = S.get(newNode)) && (refNode = S.get(refNode)) && refNode[PARENT_NODE]) { if (refNode[NEXT_SIBLING]) { refNode[PARENT_NODE].insertBefore(newNode, refNode[NEXT_SIBLING]); } else { refNode[PARENT_NODE].appendChild(newNode); } } return newNode; }, /** * Inserts the new node as the last child. */ append: function(node, parent) { if ((node = S.get(node)) && (parent = S.get(parent))) { if (parent.appendChild) { parent.appendChild(node); } } }, /** * Inserts the new node as the first child. */ prepend: function(node, parent) { if ((node = S.get(node)) && (parent = S.get(parent))) { if (parent.firstChild) { DOM.insertBefore(node, parent.firstChild); } else { parent.appendChild(node); } } } }); }); /** * NOTES: * - appendChild/removeChild/replaceChild * - append/appendTo, prepend/prependTo, wrap/unwrap Node * */
<div class='section'><div class='row'><div class='col-md-12'><a name='<API key>'></a><h3>function onClosed ()</h3></div><div class='col-md-12'>doc...</div></div></div><div class='section'><div class='row'><div class='col-md-12'><a name='<API key>'></a><h3>function createMainWindow ()</h3></div><div class='col-md-12'>doc...</div></div></div>
var through2 = require('through2') var syntaxError = require('syntax-error') var transform = require('./transform') var concatStream = require('concat-stream') var getCssyConfig = require('./utils').getCssyConfig module.exports = function (b, config) { if (Object.prototype.toString.call(config) !== '[object Object]') { config = getCssyConfig() // Default is the cwd package.json } if (!config.basedir) { config.basedir = process.cwd() } var match = config.match || ['\\.(css|sass|scss|less|styl)$', 'i'] if (!(match instanceof RegExp)) { match = RegExp.apply(null, Array.isArray(match) ? match : [match]) } match = RegExp.apply(null, match) b.transform({global: true}, function (filename) { if (!match.test(filename)) { return through2() } var code = '' return through2( function (chunk, encoding, next) { code += chunk.toString() next() }, function (done) { var self = this if (/^module\.exports\s?=/.test(code) || !syntaxError(code, filename)) { self.push(code) done() } else { var readable = through2() readable.pipe(transform(filename, config)) .pipe(concatStream(function (result) { self.push(result) done() })) readable.push(code) readable.end() } } ) }) }
import _plotly_utils.basevalidators class <API key>(_plotly_utils.basevalidators.DataArrayValidator): def __init__(self, plotly_name="surfacecolor", parent_name="surface", **kwargs): super(<API key>, self).__init__( plotly_name=plotly_name, parent_name=parent_name, edit_type=kwargs.pop("edit_type", "calc"), role=kwargs.pop("role", "data"), **kwargs )
// Generated by CoffeeScript 1.6.3 var _this = this; if (typeof define !== 'function' || !define.amd) { this.define = function(factory) { return _this.ribcage.utils.LocalStorage = factory(); }; } define(function() { var LocalStorage; return LocalStorage = (function() { function LocalStorage(debug) { this.debug = debug != null ? debug : false; this.hasNative = 'localStorage' in window; if (this.hasNative) { this.localStorage = window.localStorage; } else { this.localStorage = (function() { var store; store = {}; return { getItem: function(key) { return store[key]; }, setItem: function(key, value) { return store[key] = value; }, removeItem: function(key) { if (store[key] != null) { return del(store[key]); } } }; })(); } } LocalStorage.prototype.getItem = function(key, raw) { var e, val; if (raw == null) { raw = false; } val = this.localStorage.getItem(key); if (raw) { return val; } try { return JSON.parse(val); } catch (_error) { e = _error; return null; } }; LocalStorage.prototype.setItem = function(key, val, raw) { if (raw == null) { raw = false; } val = raw ? val : JSON.stringify(val); return this.localStorage.setItem(key, val); }; LocalStorage.prototype.removeItem = function(key) { this.localStorage.removeItem(key); return true; }; return LocalStorage; })(); });