code
stringlengths
3
1.01M
repo_name
stringlengths
5
116
path
stringlengths
3
311
language
stringclasses
30 values
license
stringclasses
15 values
size
int64
3
1.01M
<?php return array ( 'id' => 'lava_iris_x8_ver1', 'fallback' => 'generic_android_ver4_4', 'capabilities' => array ( 'model_name' => 'Iris X8', 'brand_name' => 'Lava', 'release_date' => '2015_february', 'physical_screen_height' => '111', 'physical_screen_width' => '63', 'resolution_width' => '720', 'resolution_height' => '1280', ), );
cuckata23/wurfl-data
data/lava_iris_x8_ver1.php
PHP
mit
375
package org.uma.jmetal.problem.multiobjective.lz09; import org.uma.jmetal.problem.doubleproblem.impl.AbstractDoubleProblem; import org.uma.jmetal.solution.doublesolution.DoubleSolution; import org.uma.jmetal.util.JMetalException; import java.util.ArrayList; import java.util.List; /** * Class representing problem LZ09F3 */ @SuppressWarnings("serial") public class LZ09F3 extends AbstractDoubleProblem { private LZ09 lz09; /** * Creates a default LZ09F3 problem (30 variables and 2 objectives) **/ public LZ09F3() { this(21, 1, 23); } /** * Creates a LZ09F3 problem instance */ public LZ09F3(Integer ptype, Integer dtype, Integer ltype) throws JMetalException { setNumberOfVariables(30); setNumberOfObjectives(2); setNumberOfConstraints(0); setName("LZ09F3"); lz09 = new LZ09(getNumberOfVariables(), getNumberOfObjectives(), ptype, dtype, ltype); List<Double> lowerLimit = new ArrayList<>(getNumberOfVariables()) ; List<Double> upperLimit = new ArrayList<>(getNumberOfVariables()) ; for (int i = 0; i < getNumberOfVariables(); i++) { lowerLimit.add(0.0); upperLimit.add(1.0); } setVariableBounds(lowerLimit, upperLimit); } /** Evaluate() method */ public void evaluate(DoubleSolution solution) { List<Double> x = new ArrayList<Double>(getNumberOfVariables()); List<Double> y = new ArrayList<Double>(getNumberOfObjectives()); for (int i = 0; i < getNumberOfVariables(); i++) { x.add(solution.getVariable(i)); y.add(0.0); } lz09.objective(x, y); for (int i = 0; i < getNumberOfObjectives(); i++) { solution.setObjective(i, y.get(i)); } } }
matthieu-vergne/jMetal
jmetal-problem/src/main/java/org/uma/jmetal/problem/multiobjective/lz09/LZ09F3.java
Java
mit
1,770
<?php /* AbloqovVisioplusBundle:Marque:show.html.twig */ class __TwigTemplate_489be9dd92acc7c975fd79e19aaf02ff4d6fc066cff9abcafbea41bffc1cc834 extends Twig_Template { public function __construct(Twig_Environment $env) { parent::__construct($env); // line 1 try { $this->parent = $this->env->loadTemplate("AbloqovVisioplusBundle::layout.html.twig"); } catch (Twig_Error_Loader $e) { $e->setTemplateFile($this->getTemplateName()); $e->setTemplateLine(1); throw $e; } $this->blocks = array( 'styleCSS' => array($this, 'block_styleCSS'), 'javascript' => array($this, 'block_javascript'), 'content' => array($this, 'block_content'), ); } protected function doGetParent(array $context) { return "AbloqovVisioplusBundle::layout.html.twig"; } protected function doDisplay(array $context, array $blocks = array()) { $this->parent->display($context, array_merge($this->blocks, $blocks)); } // line 3 public function block_styleCSS($context, array $blocks = array()) { // line 4 echo " "; $this->displayParentBlock("styleCSS", $context, $blocks); echo " <link rel=\"stylesheet\" type=\"text/css\" href=\""; // line 5 echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/abloqovvisioplus/css/reset.css"), "html", null, true); echo "\" media=\"screen\" /> <link rel=\"stylesheet\" type=\"text/css\" href=\""; // line 6 echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/abloqovvisioplus/css/text.css"), "html", null, true); echo "\" media=\"screen\" /> <link rel=\"stylesheet\" type=\"text/css\" href=\""; // line 7 echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/abloqovvisioplus/css/grid.css"), "html", null, true); echo "\" media=\"screen\" /> <link rel=\"stylesheet\" type=\"text/css\" href=\""; // line 8 echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/abloqovvisioplus/css/layout.css"), "html", null, true); echo "\" media=\"screen\" /> <link rel=\"stylesheet\" type=\"text/css\" href=\""; // line 9 echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/abloqovvisioplus/css/nav.css"), "html", null, true); echo "\" media=\"screen\" /> <!--[if IE 6]><link rel=\"stylesheet\" type=\"text/css\" href=\""; // line 10 echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/abloqovvisioplus/css/ie6.css"), "html", null, true); echo "\" media=\"screen\" /><![endif]--> <!--[if IE 7]><link rel=\"stylesheet\" type=\"text/css\" href=\""; // line 11 echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/abloqovvisioplus/css/ie.css"), "html", null, true); echo "\" media=\"screen\" /><![endif]--> <link href=\""; // line 12 echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/abloqovvisioplus/css/table/demo_page.css"), "html", null, true); echo "\" rel=\"stylesheet\" type=\"text/css\" /> "; } // line 15 public function block_javascript($context, array $blocks = array()) { // line 16 echo " "; $this->displayParentBlock("javascript", $context, $blocks); echo " <!-- BEGIN: load jquery --> <script src=\""; // line 18 echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/abloqovvisioplus/js/jquery-1.6.4.min.js"), "html", null, true); echo "\" type=\"text/javascript\"></script> <script type=\"text/javascript\" src=\""; // line 19 echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/abloqovvisioplus/js/jquery-ui/jquery.ui.core.min.js"), "html", null, true); echo "\"></script> <script src=\""; // line 20 echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/abloqovvisioplus/js/jquery-ui/jquery.ui.widget.min.js"), "html", null, true); echo "\" type=\"text/javascript\"></script> <script src=\""; // line 21 echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/abloqovvisioplus/js/jquery-ui/jquery.ui.accordion.min.js"), "html", null, true); echo "\" type=\"text/javascript\"></script> <script src=\""; // line 22 echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/abloqovvisioplus/js/jquery-ui/jquery.effects.core.min.js"), "html", null, true); echo "\" type=\"text/javascript\"></script> <script src=\""; // line 23 echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/abloqovvisioplus/js/jquery-ui/jquery.effects.slide.min.js "), "html", null, true); echo "\" type=\"text/javascript\"></script> <script src=\""; // line 24 echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/abloqovvisioplus/js/jquery-ui/jquery.ui.mouse.min.js"), "html", null, true); echo "\" type=\"text/javascript\"></script> <script src=\""; // line 25 echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/abloqovvisioplus/js/jquery-ui/jquery.ui.sortable.min.js"), "html", null, true); echo "\" type=\"text/javascript\"></script> <script src=\""; // line 26 echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/abloqovvisioplus/js/table/jquery.dataTables.min.js"), "html", null, true); echo "\" type=\"text/javascript\"></script> <!-- END: load jquery --> <script type=\"text/javascript\" src=\""; // line 28 echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/abloqovvisioplus/js/table/table.js"), "html", null, true); echo "\"></script> <script src=\""; // line 29 echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/abloqovvisioplus/js/setup.js"), "html", null, true); echo "\" type=\"text/javascript\"></script> <script type=\"text/javascript\"> \$(document).ready(function () { setupLeftMenu(); \$('.datatable').dataTable(); \t\t\tsetSidebarHeight(); }); </script> "; } // line 43 public function block_content($context, array $blocks = array()) { // line 44 echo " <div class=\"grid_10\"> <div class=\"box round\"> \t<h2>Statistiques</h2> <div class=\"stat-col\"> <span>Marques</span> <p class=\"green\"> "; // line 53 echo twig_escape_filter($this->env, (isset($context["nbmarques"]) ? $context["nbmarques"] : $this->getContext($context, "nbmarques")), "html", null, true); echo "</p> </div> <div class=\"block\"> <div class=\"clear\"></div> </div> </div> <div class=\"clear\"></div> <!-- / ZONE STATISTIQUES --> </div> <div class=\"grid_10\"> <!-- TABLEAU D'ENREGISTREMENT --> <div class=\"box round\"> \t<!--<h2>ENREGISTREMENT MONTURES </h2>--> <div class=\"block\"> <h1>GESTION DES MARQUES DE MONTURES</h1> <table border=\"1\" class=\"marque-consultation\"> \t<tr> <td class=\"libelle\"> Marque </td> <td class=\"seperateur1\"> : </td> <td class=\"text-input\"> "; // line 78 echo twig_escape_filter($this->env, $this->getAttribute((isset($context["marque"]) ? $context["marque"] : $this->getContext($context, "marque")), "libelle", array()), "html", null, true); echo " </td> <td class=\"bouton-validation\" colspan=\"1\"> "; // line 81 echo $this->env->getExtension('form')->renderer->renderBlock((isset($context["delete_form"]) ? $context["delete_form"] : $this->getContext($context, "delete_form")), 'form'); echo " </td> <td></td> </tr> <tr class=\"seperateurV\"></tr> <tr class=\"seperateurV\"></tr> <tr> <td colspan=\"7\" class=\"retour-page\"> <a href=\""; // line 89 echo $this->env->getExtension('routing')->getPath("marque"); echo "\"><i class=\"icon-undo\"></i> Retour à la liste des marques</a> </td> </tr> </table> <div class=\"clear\"></div> "; // line 95 echo $this->env->getExtension('http_kernel')->renderFragment($this->env->getExtension('http_kernel')->controller("AbloqovVisioplusBundle:Monture:liste", array("id" => $this->getAttribute((isset($context["marque"]) ? $context["marque"] : $this->getContext($context, "marque")), "id", array())))); echo " </div> </div> </div> "; } public function getTemplateName() { return "AbloqovVisioplusBundle:Marque:show.html.twig"; } public function isTraitable() { return false; } public function getDebugInfo() { return array ( 215 => 95, 206 => 89, 195 => 81, 189 => 78, 161 => 53, 150 => 44, 147 => 43, 130 => 29, 126 => 28, 121 => 26, 117 => 25, 113 => 24, 109 => 23, 105 => 22, 101 => 21, 97 => 20, 93 => 19, 89 => 18, 83 => 16, 80 => 15, 74 => 12, 70 => 11, 66 => 10, 62 => 9, 58 => 8, 54 => 7, 50 => 6, 46 => 5, 41 => 4, 38 => 3, 11 => 1,); } }
delrodie/VisioPlus
app/cache/dev/twig/48/9b/e9dd92acc7c975fd79e19aaf02ff4d6fc066cff9abcafbea41bffc1cc834.php
PHP
mit
10,853
export const TYPE = { PUBLIC: 'public', LINK: 'link', USER: 'user', PRIVATE: 'private', }; export const SHARE_TYPE = { PUBLIC: 'public', LINK: 'link', USER: 'user', PRIVATE: 'private', };
ardaogulcan-ci/TweetBoard-API
src/v1/helpers/enums.js
JavaScript
mit
205
from .logic import LogicAdapter from chatterbot.conversation import Statement from chatterbot.utils.pos_tagger import POSTagger import re import forecastio class WeatherLogicAdapter(LogicAdapter): """ A logic adapter that returns information regarding the weather and the forecast for a specific location. Currently, only basic information is returned, but additional features are planned in the future. """ def __init__(self, **kwargs): super(WeatherLogicAdapter, self).__init__(**kwargs) self.tagger = POSTagger() self.forecastio_api_key = kwargs.get("forecastio_api_key") def process(self, statement): """ Returns the forecast for a location (using latitude and longitude). """ user_input = statement.text.lower() if "weather" not in user_input: return 0, Statement("") latitude = self.get_latitude(user_input) longitude = self.get_longitude(user_input) if latitude is not "" and longitude is not "": # @TODO: Add more options for getting weather. This could include # the current temperature, the current cloud cover, etc. This # might require removing the forecastio library (which is # probably a good idea). return 1, Statement("The forecast for tomorrow is: " + self.get_weather(latitude, longitude)) return 0, Statement("") def get_latitude(self, user_input): """ Returns the latitude extracted from the input. """ for token in self.tagger.tokenize(user_input): if "latitude=" in token: return re.sub("latitude=", "", token) return "" def get_longitude(self, user_input): """ Returns the longitude extracted from the input. """ for token in self.tagger.tokenize(user_input): if "longitude=" in token: return re.sub("longitude=", "", token) return "" def get_weather(self, latitude, longitude): """ Returns the weather for a given latitude and longitude. """ # @TODO: Find some way to suppress the warnings generated by this. forecast = forecastio.load_forecast(self.forecastio_api_key, latitude, longitude) return forecast.hourly().summary
imminent-tuba/thesis
server/chatterbot/chatterbot/adapters/logic/weather.py
Python
mit
2,362
# Events ## Methods - [loadEvents](#loadEvents) - [createEvent](#createEvent) - [saveEvent](#saveEvent) - [deleteEvent](#deleteEvent) - [sendAvailabilityReminders](#sendAvailabilityReminders) - [getEventSort](#getEventSort) - [bulkCreateEvents](#bulkCreateEvents) --- <a id="loadEvents"></a> ## `loadEvents(params, callback)` Loads items from the `events` collection based on given params. ### Params * `params`: [int, object] - can be either a `teamId` or an object with query parameters. * `callback`: [function] - callback to be executed when the operation completes. To see a list of all available search params you can run: `teamsnap.collections.events.queries.search.params` ### Examples ```javascript // ~~~~~ // Loads all events for `teamId: 1`. teamsnap.loadEvents(1); // ~~~~~ // Loads all events for `contactId: 1`. teamsnap.loadEvents({contactId: 1}); ``` --- <a id="createEvent"></a> ## `createEvent(data)` Creates a new `event` item. ### Params * `data`: [object, null] - data object to apply to the newly created object. ### Examples ```javascript // ~~~~~ // Creates a new event item. var event = teamsnap.createEvent(); // ~~~~~ // Creates a new event item with `isGame: true`. var event = teamsnap.createEvent({isGame: true}); ``` --- <a id="saveEvent"></a> ## `saveEvent(event, callback)` Saves an `event` item. ### Params * `event`: [object] - event item to be saved. * `callback`: [function] - callback to be executed when the operation completes. ### Examples ```javascript // ~~~~~ // Saves event item. teamsnap.saveEvent(event); // ~~~~~ // Creates a new event then saves it. var event = teamsnap.createEvent({ teamId: 1, locationId: 1, opponentId: 1 isGame: true, startDate: new Date() }); teamsnap.saveEvent(event); ``` --- <a id="deleteEvent"></a> ## `deleteEvent(event, include, notify, notifyAs, callback)` Deletes an `event` item or items based on given params. ### Params * `event`: [object] - an item to be deleted. * `include`: [string, null] - additional events to delete related to `event`. Possible values are in `teamsnap.EVENTS` * `notify`: [bool, null] - notify team of event(s) deletion. * `notifyAs`: [int, null] - memberId of member notifying team. Required if `notify` is `true` * `callback`: [function] - callback to be executed when the operation completes. ### Examples ```javascript // ~~~~~ // Deletes a event item. teamsnap.deleteEvent(event); // ~~~~~ // Creates a new event, saves, then deletes it. var event = teamsnap.createEvent({ teamId: 1, locationId: 1, opponentId: 1 isGame: true, startDate: new Date() }); teamsnap.saveEvent(event).then(function(){ // Save complete, now delete. teamsnap.deleteEvent(event).then(function(){ // Poof! It's gone! }); }); ``` --- <a id="sendAvailabilityReminders"></a> ## `sendAvailabilityReminders(eventId, sendingMemberId, include)` Sends availability reminders to given members of a team. ### Params * `eventId`: [int, object] - eventId or event item to send availability reminders for. * `sendingMemberId`: [int, object] - memberId or member item of member sending reminders. * `include`: [array] - memberId array to whom the reminders will be sent. ### Examples ```javascript // ~~~~~ // Sends an availability reminder. teamsnap.sendAvailabilityReminders(1, 1, [2,3,4]); ``` --- <a id="getEventSort"></a> ## `getEventSort()` Sorts an array of events. ### Params _none_ ### Examples ```javascript // ~~~~~ // Sorts events by date. eventArray.sort(teamsnap.getEventSort()); ``` --- <a id="bulkCreateEvents"></a> ## `bulkCreateEvents(params, callback)` Creates multiple events. ### Params * `params`: [object] - Object that contains additional data: * `teamId`: [int] - Id of Team the events are for * `events`: [array] - Array of event objects to create * `sendingMemberId`: [int] - Id of member that notify email will come from (optional). * `notifyTeam` - [bool] - Flag indictating if notify email should be sent to team. * `callback`: [function] - callback to be executed when the operation completes. ### Examples ```javascript // ~~~~~ // Creates multiple events for `teamId: 1` and sends a notify email to team. teamsnap.bulkCreateEvents({ teamId: 1, events: [{ teamId: 1, locationId: 1, opponentId: 1 isGame: true, startDate: new Date() }, sendingMemberId: 1, notifyTeam: true }); ``` ---
teamsnap/teamsnap-javascript-sdk
docs/collections/events.md
Markdown
mit
4,405
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Changing field 'Alarm.last_checked' db.alter_column(u'ddsc_core_alarm', 'last_checked', self.gf('django.db.models.fields.DateTimeField')(null=True)) def backwards(self, orm): # Changing field 'Alarm.last_checked' db.alter_column(u'ddsc_core_alarm', 'last_checked', self.gf('django.db.models.fields.DateTimeField')()) models = { 'auth.group': { 'Meta': {'object_name': 'Group'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) }, 'auth.permission': { 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) }, 'auth.user': { 'Meta': {'object_name': 'User'}, 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) }, 'contenttypes.contenttype': { 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) }, u'ddsc_core.alarm': { 'Meta': {'object_name': 'Alarm'}, 'active_status': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'date_cr': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'description': ('django.db.models.fields.TextField', [], {'default': "u''", 'null': 'True', 'blank': 'True'}), 'first_born': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'frequency': ('django.db.models.fields.IntegerField', [], {'default': '5'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'last_checked': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), 'logical_check': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), 'message_type': ('django.db.models.fields.IntegerField', [], {'default': '4'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '80'}), 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}), 'previous_alarm': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['ddsc_core.Alarm']", 'null': 'True', 'blank': 'True'}), 'single_or_group': ('django.db.models.fields.related.ForeignKey', [], {'default': '1', 'to': "orm['contenttypes.ContentType']"}), 'template': ('django.db.models.fields.TextField', [], {'default': "u'this is a alarm message template'"}), 'urgency': ('django.db.models.fields.IntegerField', [], {'default': '2'}) }, u'ddsc_core.alarm_active': { 'Meta': {'object_name': 'Alarm_Active'}, 'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'alarm': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['ddsc_core.Alarm']"}), 'deactivated_on': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(1900, 1, 1, 0, 0)'}), 'first_triggered_on': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(1900, 1, 1, 0, 0)'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'message': ('django.db.models.fields.TextField', [], {}) }, u'ddsc_core.alarm_item': { 'Meta': {'object_name': 'Alarm_Item'}, 'alarm': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['ddsc_core.Alarm']"}), 'alarm_type': ('django.db.models.fields.related.ForeignKey', [], {'default': '1', 'to': "orm['contenttypes.ContentType']"}), 'comparision': ('django.db.models.fields.SmallIntegerField', [], {'default': '1'}), 'first_born': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'logical_check': ('django.db.models.fields.SmallIntegerField', [], {'default': '0'}), 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}), 'value_bool': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), 'value_double': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}), 'value_int': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), 'value_text': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'}), 'value_type': ('django.db.models.fields.IntegerField', [], {'default': '1'}) }, u'ddsc_core.compartment': { 'Meta': {'ordering': "[u'description']", 'object_name': 'Compartment'}, 'begin_date': ('django.db.models.fields.DateField', [], {}), 'code': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '12'}), 'description': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '60'}), 'end_date': ('django.db.models.fields.DateField', [], {}), 'group': ('django.db.models.fields.CharField', [], {'max_length': '60', 'null': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'numeric_code': ('django.db.models.fields.CharField', [], {'max_length': '12', 'null': 'True'}), 'source': ('django.db.models.fields.CharField', [], {'max_length': '12', 'null': 'True'}), 'visible': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) }, u'ddsc_core.folder': { 'Meta': {'object_name': 'Folder'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'path': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64'}), 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) }, u'ddsc_core.idmapping': { 'Meta': {'object_name': 'IdMapping'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'remote_id': ('django.db.models.fields.CharField', [], {'max_length': '64'}), 'timeseries': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['ddsc_core.Timeseries']"}), 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) }, u'ddsc_core.ipaddress': { 'Meta': {'object_name': 'IPAddress'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'label': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39'}), 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) }, u'ddsc_core.location': { 'Meta': {'object_name': 'Location'}, 'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 5, 14, 0, 0)'}), 'depth': ('django.db.models.fields.PositiveIntegerField', [], {}), 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), 'geometry_precision': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '80', 'db_index': 'True'}), 'numchild': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), 'path': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), 'point_geometry': ('django.contrib.gis.db.models.fields.PointField', [], {'srid': '4258', 'null': 'True', 'blank': 'True'}), 'real_geometry': ('django.contrib.gis.db.models.fields.GeometryField', [], {'srid': '4258', 'null': 'True', 'blank': 'True'}), 'relative_location': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), 'show_on_map': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'uuid': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '36', 'blank': 'True'}) }, u'ddsc_core.locationtype': { 'Meta': {'object_name': 'LocationType'}, 'code': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '3'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'locations': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'location_types'", 'blank': 'True', 'to': u"orm['ddsc_core.Location']"}), 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}) }, u'ddsc_core.logicalgroup': { 'Meta': {'ordering': "[u'owner', u'name']", 'unique_together': "((u'owner', u'name'),)", 'object_name': 'LogicalGroup'}, 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}), 'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['lizard_security.DataOwner']"}), 'timeseries': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'logical_groups'", 'blank': 'True', 'to': u"orm['ddsc_core.Timeseries']"}) }, u'ddsc_core.logicalgroupedge': { 'Meta': {'unique_together': "((u'child', u'parent'),)", 'object_name': 'LogicalGroupEdge'}, 'child': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'parents'", 'to': u"orm['ddsc_core.LogicalGroup']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'parent': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "u'childs'", 'to': u"orm['ddsc_core.LogicalGroup']"}) }, u'ddsc_core.logrecord': { 'Meta': {'object_name': 'LogRecord'}, 'host': ('django.db.models.fields.CharField', [], {'max_length': '64', 'db_index': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'level': ('django.db.models.fields.CharField', [], {'max_length': '8', 'db_index': 'True'}), 'line': ('django.db.models.fields.SmallIntegerField', [], {}), 'message': ('django.db.models.fields.TextField', [], {}), 'source': ('django.db.models.fields.CharField', [], {'max_length': '256'}), 'time': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}) }, u'ddsc_core.manufacturer': { 'Meta': {'object_name': 'Manufacturer'}, 'code': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '3'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64'}) }, u'ddsc_core.measuringdevice': { 'Meta': {'ordering': "[u'description']", 'object_name': 'MeasuringDevice'}, 'begin_date': ('django.db.models.fields.DateField', [], {}), 'code': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '12'}), 'description': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '60'}), 'end_date': ('django.db.models.fields.DateField', [], {}), 'group': ('django.db.models.fields.CharField', [], {'max_length': '60', 'null': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'visible': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) }, u'ddsc_core.measuringmethod': { 'Meta': {'ordering': "[u'description']", 'object_name': 'MeasuringMethod'}, 'begin_date': ('django.db.models.fields.DateField', [], {}), 'code': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '12'}), 'description': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '60'}), 'end_date': ('django.db.models.fields.DateField', [], {}), 'group': ('django.db.models.fields.CharField', [], {'max_length': '60', 'null': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'titel': ('django.db.models.fields.CharField', [], {'max_length': '600', 'null': 'True'}), 'visible': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) }, u'ddsc_core.parameter': { 'Meta': {'ordering': "[u'description']", 'object_name': 'Parameter'}, 'begin_date': ('django.db.models.fields.DateField', [], {}), 'cas_number': ('django.db.models.fields.CharField', [], {'max_length': '12', 'null': 'True'}), 'code': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '12'}), 'description': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '60'}), 'end_date': ('django.db.models.fields.DateField', [], {}), 'group': ('django.db.models.fields.CharField', [], {'max_length': '60', 'null': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'sikb_id': ('django.db.models.fields.IntegerField', [], {'unique': 'True', 'null': 'True'}), 'source': ('django.db.models.fields.CharField', [], {'max_length': '12', 'null': 'True'}), 'visible': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) }, u'ddsc_core.processingmethod': { 'Meta': {'ordering': "[u'description']", 'object_name': 'ProcessingMethod'}, 'begin_date': ('django.db.models.fields.DateField', [], {}), 'code': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '12'}), 'description': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '60'}), 'end_date': ('django.db.models.fields.DateField', [], {}), 'group': ('django.db.models.fields.CharField', [], {'max_length': '60', 'null': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'visible': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) }, u'ddsc_core.referenceframe': { 'Meta': {'ordering': "[u'description']", 'object_name': 'ReferenceFrame'}, 'begin_date': ('django.db.models.fields.DateField', [], {}), 'code': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '12'}), 'description': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '60'}), 'end_date': ('django.db.models.fields.DateField', [], {}), 'group': ('django.db.models.fields.CharField', [], {'max_length': '60', 'null': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'visible': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) }, u'ddsc_core.source': { 'Meta': {'object_name': 'Source'}, 'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 5, 14, 0, 0)'}), 'details': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), 'frequency': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'manufacturer': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['ddsc_core.Manufacturer']"}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '64', 'db_index': 'True'}), 'source_type': ('django.db.models.fields.SmallIntegerField', [], {'default': '1'}), 'timeout': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), 'uuid': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '36', 'blank': 'True'}) }, u'ddsc_core.sourcegroup': { 'Meta': {'object_name': 'SourceGroup'}, 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64'}), 'sources': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['ddsc_core.Source']", 'symmetrical': 'False'}) }, u'ddsc_core.statuscache': { 'Meta': {'object_name': 'StatusCache'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'max_val': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}), 'mean_val': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}), 'min_val': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}), 'modify_timestamp': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(1900, 1, 1, 0, 0)'}), 'nr_of_measurements_doubtful': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), 'nr_of_measurements_reliable': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), 'nr_of_measurements_total': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), 'nr_of_measurements_unreliable': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), 'status_date': ('django.db.models.fields.CharField', [], {'max_length': '20'}), 'std_val': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}), 'timeseries': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['ddsc_core.Timeseries']"}) }, u'ddsc_core.timeseries': { 'Meta': {'object_name': 'Timeseries'}, 'compartment': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['ddsc_core.Compartment']", 'null': 'True', 'blank': 'True'}), 'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 5, 14, 0, 0)'}), 'data_set': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'timeseries'", 'blank': 'True', 'to': "orm['lizard_security.DataSet']"}), 'description': ('django.db.models.fields.TextField', [], {'default': "u''", 'blank': 'True'}), 'first_value_timestamp': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'latest_value_number': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}), 'latest_value_text': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), 'latest_value_timestamp': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), 'location': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "u'timeseries'", 'null': 'True', 'to': u"orm['ddsc_core.Location']"}), 'measuring_device': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['ddsc_core.MeasuringDevice']", 'null': 'True', 'blank': 'True'}), 'measuring_method': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['ddsc_core.MeasuringMethod']", 'null': 'True', 'blank': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '64', 'null': 'True', 'blank': 'True'}), 'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['lizard_security.DataOwner']", 'null': 'True', 'blank': 'True'}), 'parameter': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['ddsc_core.Parameter']"}), 'processing_method': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['ddsc_core.ProcessingMethod']", 'null': 'True', 'blank': 'True'}), 'reference_frame': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['ddsc_core.ReferenceFrame']", 'null': 'True', 'blank': 'True'}), 'source': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['ddsc_core.Source']", 'null': 'True', 'blank': 'True'}), 'supplying_systems': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.User']", 'symmetrical': 'False', 'through': u"orm['ddsc_core.IdMapping']", 'blank': 'True'}), 'unit': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['ddsc_core.Unit']"}), 'uuid': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '36', 'blank': 'True'}), 'validate_diff_hard': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}), 'validate_diff_soft': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}), 'validate_max_hard': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}), 'validate_max_soft': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}), 'validate_min_hard': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}), 'validate_min_soft': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}), 'value_type': ('django.db.models.fields.SmallIntegerField', [], {'default': '1'}) }, u'ddsc_core.timeseriesgroup': { 'Meta': {'object_name': 'TimeseriesGroup'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64'}), 'parameters': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['ddsc_core.Parameter']", 'symmetrical': 'False'}), 'sources': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['ddsc_core.Source']", 'symmetrical': 'False'}) }, u'ddsc_core.timeseriesselectionrule': { 'Meta': {'ordering': "[u'pk']", 'object_name': 'TimeseriesSelectionRule'}, 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), 'criterion': ('django.db.models.fields.CharField', [], {'max_length': '128'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}), 'operator': ('django.db.models.fields.CharField', [], {'max_length': '1', 'null': 'True', 'blank': 'True'}) }, u'ddsc_core.unit': { 'Meta': {'ordering': "[u'description']", 'object_name': 'Unit'}, 'begin_date': ('django.db.models.fields.DateField', [], {}), 'code': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '12'}), 'conversion_factor': ('django.db.models.fields.CharField', [], {'max_length': '12', 'null': 'True'}), 'description': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '60'}), 'dimension': ('django.db.models.fields.CharField', [], {'max_length': '12', 'null': 'True'}), 'end_date': ('django.db.models.fields.DateField', [], {}), 'group': ('django.db.models.fields.CharField', [], {'max_length': '60', 'null': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'source': ('django.db.models.fields.CharField', [], {'max_length': '12', 'null': 'True'}), 'visible': ('django.db.models.fields.BooleanField', [], {'default': 'False'}) }, 'lizard_security.dataowner': { 'Meta': {'ordering': "['name']", 'object_name': 'DataOwner'}, 'data_managers': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.User']", 'symmetrical': 'False', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '256'}), 'remarks': ('django.db.models.fields.TextField', [], {'blank': 'True'}) }, 'lizard_security.dataset': { 'Meta': {'ordering': "['owner', 'name']", 'unique_together': "(('owner', 'name'),)", 'object_name': 'DataSet'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '80'}), 'owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['lizard_security.DataOwner']", 'null': 'True', 'blank': 'True'}) } } complete_apps = ['ddsc_core']
ddsc/ddsc-core
ddsc_core/migrations/0078_auto__chg_field_alarm_last_checked.py
Python
mit
28,517
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as nls from 'vs/nls'; import { STATUS_BAR_HOST_NAME_BACKGROUND, STATUS_BAR_HOST_NAME_FOREGROUND } from 'vs/workbench/common/theme'; import { themeColorFromId } from 'vs/platform/theme/common/themeService'; import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService'; import { Disposable, dispose } from 'vs/base/common/lifecycle'; import { MenuId, IMenuService, MenuItemAction, MenuRegistry, registerAction2, Action2, SubmenuItemAction } from 'vs/platform/actions/common/actions'; import { IWorkbenchContribution } from 'vs/workbench/common/contributions'; import { StatusbarAlignment, IStatusbarService, IStatusbarEntryAccessor, IStatusbarEntry } from 'vs/workbench/services/statusbar/browser/statusbar'; import { ILabelService } from 'vs/platform/label/common/label'; import { ContextKeyExpr, IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey'; import { ICommandService } from 'vs/platform/commands/common/commands'; import { Schemas } from 'vs/base/common/network'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; import { IQuickInputService, IQuickPickItem, IQuickPickSeparator } from 'vs/platform/quickinput/common/quickInput'; import { IBrowserWorkbenchEnvironmentService } from 'vs/workbench/services/environment/browser/environmentService'; import { PersistentConnectionEventType } from 'vs/platform/remote/common/remoteAgentConnection'; import { IRemoteAuthorityResolverService } from 'vs/platform/remote/common/remoteAuthorityResolver'; import { IHostService } from 'vs/workbench/services/host/browser/host'; import { isWeb } from 'vs/base/common/platform'; import { once } from 'vs/base/common/functional'; import { truncate } from 'vs/base/common/strings'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; import { getRemoteName } from 'vs/platform/remote/common/remoteHosts'; import { getVirtualWorkspaceLocation } from 'vs/platform/workspace/common/virtualWorkspace'; import { getCodiconAriaLabel } from 'vs/base/common/codicons'; import { ILogService } from 'vs/platform/log/common/log'; import { ReloadWindowAction } from 'vs/workbench/browser/actions/windowActions'; import { IExtensionGalleryService } from 'vs/platform/extensionManagement/common/extensionManagement'; import { IExtensionsViewPaneContainer, LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID, VIEWLET_ID } from 'vs/workbench/contrib/extensions/common/extensions'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { IMarkdownString, MarkdownString } from 'vs/base/common/htmlContent'; import { RemoteNameContext, VirtualWorkspaceContext } from 'vs/workbench/common/contextkeys'; import { IPaneCompositePartService } from 'vs/workbench/services/panecomposite/browser/panecomposite'; import { ViewContainerLocation } from 'vs/workbench/common/views'; type ActionGroup = [string, Array<MenuItemAction | SubmenuItemAction>]; export class RemoteStatusIndicator extends Disposable implements IWorkbenchContribution { private static readonly REMOTE_ACTIONS_COMMAND_ID = 'workbench.action.remote.showMenu'; private static readonly CLOSE_REMOTE_COMMAND_ID = 'workbench.action.remote.close'; private static readonly SHOW_CLOSE_REMOTE_COMMAND_ID = !isWeb; // web does not have a "Close Remote" command private static readonly INSTALL_REMOTE_EXTENSIONS_ID = 'workbench.action.remote.extensions'; private static readonly REMOTE_STATUS_LABEL_MAX_LENGTH = 40; private remoteStatusEntry: IStatusbarEntryAccessor | undefined; private readonly legacyIndicatorMenu = this._register(this.menuService.createMenu(MenuId.StatusBarWindowIndicatorMenu, this.contextKeyService)); // to be removed once migration completed private readonly remoteIndicatorMenu = this._register(this.menuService.createMenu(MenuId.StatusBarRemoteIndicatorMenu, this.contextKeyService)); private remoteMenuActionsGroups: ActionGroup[] | undefined; private readonly remoteAuthority = this.environmentService.remoteAuthority; private virtualWorkspaceLocation: { scheme: string; authority: string } | undefined = undefined; private connectionState: 'initializing' | 'connected' | 'reconnecting' | 'disconnected' | undefined = undefined; private readonly connectionStateContextKey = new RawContextKey<'' | 'initializing' | 'disconnected' | 'connected'>('remoteConnectionState', '').bindTo(this.contextKeyService); private loggedInvalidGroupNames: { [group: string]: boolean } = Object.create(null); constructor( @IStatusbarService private readonly statusbarService: IStatusbarService, @IBrowserWorkbenchEnvironmentService private readonly environmentService: IBrowserWorkbenchEnvironmentService, @ILabelService private readonly labelService: ILabelService, @IContextKeyService private contextKeyService: IContextKeyService, @IMenuService private menuService: IMenuService, @IQuickInputService private readonly quickInputService: IQuickInputService, @ICommandService private readonly commandService: ICommandService, @IExtensionService private readonly extensionService: IExtensionService, @IRemoteAgentService private readonly remoteAgentService: IRemoteAgentService, @IRemoteAuthorityResolverService private readonly remoteAuthorityResolverService: IRemoteAuthorityResolverService, @IHostService private readonly hostService: IHostService, @IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService, @ILogService private readonly logService: ILogService, @IExtensionGalleryService private readonly extensionGalleryService: IExtensionGalleryService ) { super(); // Set initial connection state if (this.remoteAuthority) { this.connectionState = 'initializing'; this.connectionStateContextKey.set(this.connectionState); } else { this.updateVirtualWorkspaceLocation(); } this.registerActions(); this.registerListeners(); this.updateWhenInstalledExtensionsRegistered(); this.updateRemoteStatusIndicator(); } private registerActions(): void { const category = { value: nls.localize('remote.category', "Remote"), original: 'Remote' }; // Show Remote Menu const that = this; registerAction2(class extends Action2 { constructor() { super({ id: RemoteStatusIndicator.REMOTE_ACTIONS_COMMAND_ID, category, title: { value: nls.localize('remote.showMenu', "Show Remote Menu"), original: 'Show Remote Menu' }, f1: true, }); } run = () => that.showRemoteMenu(); }); // Close Remote Connection if (RemoteStatusIndicator.SHOW_CLOSE_REMOTE_COMMAND_ID) { registerAction2(class extends Action2 { constructor() { super({ id: RemoteStatusIndicator.CLOSE_REMOTE_COMMAND_ID, category, title: { value: nls.localize('remote.close', "Close Remote Connection"), original: 'Close Remote Connection' }, f1: true, precondition: ContextKeyExpr.or(RemoteNameContext, VirtualWorkspaceContext) }); } run = () => that.hostService.openWindow({ forceReuseWindow: true, remoteAuthority: null }); }); if (this.remoteAuthority) { MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, { group: '6_close', command: { id: RemoteStatusIndicator.CLOSE_REMOTE_COMMAND_ID, title: nls.localize({ key: 'miCloseRemote', comment: ['&& denotes a mnemonic'] }, "Close Re&&mote Connection") }, order: 3.5 }); } } if (this.extensionGalleryService.isEnabled()) { registerAction2(class extends Action2 { constructor() { super({ id: RemoteStatusIndicator.INSTALL_REMOTE_EXTENSIONS_ID, category, title: { value: nls.localize('remote.install', "Install Remote Development Extensions"), original: 'Install Remote Development Extensions' }, f1: true }); } run = (accessor: ServicesAccessor, input: string) => { const paneCompositeService = accessor.get(IPaneCompositePartService); return paneCompositeService.openPaneComposite(VIEWLET_ID, ViewContainerLocation.Sidebar, true).then(viewlet => { if (viewlet) { (viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer).search(`tag:"remote-menu"`); viewlet.focus(); } }); }; }); } } private registerListeners(): void { // Menu changes const updateRemoteActions = () => { this.remoteMenuActionsGroups = undefined; this.updateRemoteStatusIndicator(); }; this._register(this.legacyIndicatorMenu.onDidChange(updateRemoteActions)); this._register(this.remoteIndicatorMenu.onDidChange(updateRemoteActions)); // Update indicator when formatter changes as it may have an impact on the remote label this._register(this.labelService.onDidChangeFormatters(() => this.updateRemoteStatusIndicator())); // Update based on remote indicator changes if any const remoteIndicator = this.environmentService.options?.windowIndicator; if (remoteIndicator && remoteIndicator.onDidChange) { this._register(remoteIndicator.onDidChange(() => this.updateRemoteStatusIndicator())); } // Listen to changes of the connection if (this.remoteAuthority) { const connection = this.remoteAgentService.getConnection(); if (connection) { this._register(connection.onDidStateChange((e) => { switch (e.type) { case PersistentConnectionEventType.ConnectionLost: case PersistentConnectionEventType.ReconnectionRunning: case PersistentConnectionEventType.ReconnectionWait: this.setState('reconnecting'); break; case PersistentConnectionEventType.ReconnectionPermanentFailure: this.setState('disconnected'); break; case PersistentConnectionEventType.ConnectionGain: this.setState('connected'); break; } })); } } else { this._register(this.workspaceContextService.onDidChangeWorkbenchState(() => { this.updateVirtualWorkspaceLocation(); this.updateRemoteStatusIndicator(); })); } } private updateVirtualWorkspaceLocation() { this.virtualWorkspaceLocation = getVirtualWorkspaceLocation(this.workspaceContextService.getWorkspace()); } private async updateWhenInstalledExtensionsRegistered(): Promise<void> { await this.extensionService.whenInstalledExtensionsRegistered(); const remoteAuthority = this.remoteAuthority; if (remoteAuthority) { // Try to resolve the authority to figure out connection state (async () => { try { await this.remoteAuthorityResolverService.resolveAuthority(remoteAuthority); this.setState('connected'); } catch (error) { this.setState('disconnected'); } })(); } this.updateRemoteStatusIndicator(); } private setState(newState: 'disconnected' | 'connected' | 'reconnecting'): void { if (this.connectionState !== newState) { this.connectionState = newState; // simplify context key which doesn't support `connecting` if (this.connectionState === 'reconnecting') { this.connectionStateContextKey.set('disconnected'); } else { this.connectionStateContextKey.set(this.connectionState); } this.updateRemoteStatusIndicator(); } } private validatedGroup(group: string) { if (!group.match(/^(remote|virtualfs)_(\d\d)_(([a-z][a-z0-9+.-]*)_(.*))$/)) { if (!this.loggedInvalidGroupNames[group]) { this.loggedInvalidGroupNames[group] = true; this.logService.warn(`Invalid group name used in "statusBar/remoteIndicator" menu contribution: ${group}. Entries ignored. Expected format: 'remote_$ORDER_$REMOTENAME_$GROUPING or 'virtualfs_$ORDER_$FILESCHEME_$GROUPING.`); } return false; } return true; } private getRemoteMenuActions(doNotUseCache?: boolean): ActionGroup[] { if (!this.remoteMenuActionsGroups || doNotUseCache) { this.remoteMenuActionsGroups = this.remoteIndicatorMenu.getActions().filter(a => this.validatedGroup(a[0])).concat(this.legacyIndicatorMenu.getActions()); } return this.remoteMenuActionsGroups; } private updateRemoteStatusIndicator(): void { // Remote Indicator: show if provided via options, e.g. by the web embedder API const remoteIndicator = this.environmentService.options?.windowIndicator; if (remoteIndicator) { this.renderRemoteStatusIndicator(truncate(remoteIndicator.label, RemoteStatusIndicator.REMOTE_STATUS_LABEL_MAX_LENGTH), remoteIndicator.tooltip, remoteIndicator.command); return; } // Show for remote windows on the desktop, but not when in code server web if (this.remoteAuthority && !isWeb) { const hostLabel = this.labelService.getHostLabel(Schemas.vscodeRemote, this.remoteAuthority) || this.remoteAuthority; switch (this.connectionState) { case 'initializing': this.renderRemoteStatusIndicator(nls.localize('host.open', "Opening Remote..."), nls.localize('host.open', "Opening Remote..."), undefined, true /* progress */); break; case 'reconnecting': this.renderRemoteStatusIndicator(`${nls.localize('host.reconnecting', "Reconnecting to {0}...", truncate(hostLabel, RemoteStatusIndicator.REMOTE_STATUS_LABEL_MAX_LENGTH))}`, undefined, undefined, true); break; case 'disconnected': this.renderRemoteStatusIndicator(`$(alert) ${nls.localize('disconnectedFrom', "Disconnected from {0}", truncate(hostLabel, RemoteStatusIndicator.REMOTE_STATUS_LABEL_MAX_LENGTH))}`); break; default: { const tooltip = new MarkdownString('', { isTrusted: true, supportThemeIcons: true }); const hostNameTooltip = this.labelService.getHostTooltip(Schemas.vscodeRemote, this.remoteAuthority); if (hostNameTooltip) { tooltip.appendMarkdown(hostNameTooltip); } else { tooltip.appendText(nls.localize({ key: 'host.tooltip', comment: ['{0} is a remote host name, e.g. Dev Container'] }, "Editing on {0}", hostLabel)); } this.renderRemoteStatusIndicator(`$(remote) ${truncate(hostLabel, RemoteStatusIndicator.REMOTE_STATUS_LABEL_MAX_LENGTH)}`, tooltip); } } return; } // show when in a virtual workspace if (this.virtualWorkspaceLocation) { // Workspace with label: indicate editing source const workspaceLabel = this.labelService.getHostLabel(this.virtualWorkspaceLocation.scheme, this.virtualWorkspaceLocation.authority); if (workspaceLabel) { const tooltip = new MarkdownString('', { isTrusted: true, supportThemeIcons: true }); const hostNameTooltip = this.labelService.getHostTooltip(this.virtualWorkspaceLocation.scheme, this.virtualWorkspaceLocation.authority); if (hostNameTooltip) { tooltip.appendMarkdown(hostNameTooltip); } else { tooltip.appendText(nls.localize({ key: 'workspace.tooltip', comment: ['{0} is a remote workspace name, e.g. GitHub'] }, "Editing on {0}", workspaceLabel)); } if (!isWeb || this.remoteAuthority) { tooltip.appendMarkdown('\n\n'); tooltip.appendMarkdown(nls.localize( { key: 'workspace.tooltip2', comment: ['[features are not available]({1}) is a link. Only translate `features are not available`. Do not change brackets and parentheses or {0}'] }, "Some [features are not available]({0}) for resources located on a virtual file system.", `command:${LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID}` )); } this.renderRemoteStatusIndicator(`$(remote) ${truncate(workspaceLabel, RemoteStatusIndicator.REMOTE_STATUS_LABEL_MAX_LENGTH)}`, tooltip); return; } } // Remote actions: offer menu if (this.getRemoteMenuActions().length > 0) { this.renderRemoteStatusIndicator(`$(remote)`, nls.localize('noHost.tooltip', "Open a Remote Window")); return; } // No Remote Extensions: hide status indicator dispose(this.remoteStatusEntry); this.remoteStatusEntry = undefined; } private renderRemoteStatusIndicator(text: string, tooltip?: string | IMarkdownString, command?: string, showProgress?: boolean): void { const name = nls.localize('remoteHost', "Remote Host"); if (typeof command !== 'string' && this.getRemoteMenuActions().length > 0) { command = RemoteStatusIndicator.REMOTE_ACTIONS_COMMAND_ID; } const ariaLabel = getCodiconAriaLabel(text); const properties: IStatusbarEntry = { name, backgroundColor: themeColorFromId(STATUS_BAR_HOST_NAME_BACKGROUND), color: themeColorFromId(STATUS_BAR_HOST_NAME_FOREGROUND), ariaLabel, text, showProgress, tooltip, command }; if (this.remoteStatusEntry) { this.remoteStatusEntry.update(properties); } else { this.remoteStatusEntry = this.statusbarService.addEntry(properties, 'status.host', StatusbarAlignment.LEFT, Number.MAX_VALUE /* first entry */); } } private showRemoteMenu() { const getCategoryLabel = (action: MenuItemAction) => { if (action.item.category) { return typeof action.item.category === 'string' ? action.item.category : action.item.category.value; } return undefined; }; const matchCurrentRemote = () => { if (this.remoteAuthority) { return new RegExp(`^remote_\\d\\d_${getRemoteName(this.remoteAuthority)}_`); } else if (this.virtualWorkspaceLocation) { return new RegExp(`^virtualfs_\\d\\d_${this.virtualWorkspaceLocation.scheme}_`); } return undefined; }; const computeItems = () => { let actionGroups = this.getRemoteMenuActions(true); const items: (IQuickPickItem | IQuickPickSeparator)[] = []; const currentRemoteMatcher = matchCurrentRemote(); if (currentRemoteMatcher) { // commands for the current remote go first actionGroups = actionGroups.sort((g1, g2) => { const isCurrentRemote1 = currentRemoteMatcher.test(g1[0]); const isCurrentRemote2 = currentRemoteMatcher.test(g2[0]); if (isCurrentRemote1 !== isCurrentRemote2) { return isCurrentRemote1 ? -1 : 1; } return g1[0].localeCompare(g2[0]); }); } let lastCategoryName: string | undefined = undefined; for (let actionGroup of actionGroups) { let hasGroupCategory = false; for (let action of actionGroup[1]) { if (action instanceof MenuItemAction) { if (!hasGroupCategory) { const category = getCategoryLabel(action); if (category !== lastCategoryName) { items.push({ type: 'separator', label: category }); lastCategoryName = category; } hasGroupCategory = true; } let label = typeof action.item.title === 'string' ? action.item.title : action.item.title.value; items.push({ type: 'item', id: action.item.id, label }); } } } items.push({ type: 'separator' }); let entriesBeforeConfig = items.length; if (RemoteStatusIndicator.SHOW_CLOSE_REMOTE_COMMAND_ID) { if (this.remoteAuthority) { items.push({ type: 'item', id: RemoteStatusIndicator.CLOSE_REMOTE_COMMAND_ID, label: nls.localize('closeRemoteConnection.title', 'Close Remote Connection') }); if (this.connectionState === 'disconnected') { items.push({ type: 'item', id: ReloadWindowAction.ID, label: nls.localize('reloadWindow', 'Reload Window') }); } } else if (this.virtualWorkspaceLocation) { items.push({ type: 'item', id: RemoteStatusIndicator.CLOSE_REMOTE_COMMAND_ID, label: nls.localize('closeVirtualWorkspace.title', 'Close Remote Workspace') }); } } if (!this.remoteAuthority && !this.virtualWorkspaceLocation && this.extensionGalleryService.isEnabled()) { items.push({ id: RemoteStatusIndicator.INSTALL_REMOTE_EXTENSIONS_ID, label: nls.localize('installRemotes', "Install Additional Remote Extensions..."), alwaysShow: true }); } if (items.length === entriesBeforeConfig) { items.pop(); // remove the separator again } return items; }; const quickPick = this.quickInputService.createQuickPick(); quickPick.items = computeItems(); quickPick.sortByLabel = false; quickPick.canSelectMany = false; once(quickPick.onDidAccept)((_ => { const selectedItems = quickPick.selectedItems; if (selectedItems.length === 1) { this.commandService.executeCommand(selectedItems[0].id!); } quickPick.hide(); })); // refresh the items when actions change const legacyItemUpdater = this.legacyIndicatorMenu.onDidChange(() => quickPick.items = computeItems()); quickPick.onDidHide(legacyItemUpdater.dispose); const itemUpdater = this.remoteIndicatorMenu.onDidChange(() => quickPick.items = computeItems()); quickPick.onDidHide(itemUpdater.dispose); quickPick.show(); } }
microsoft/vscode
src/vs/workbench/contrib/remote/browser/remoteIndicator.ts
TypeScript
mit
20,862
#!/usr/bin/env python print " Formated number:", "{:,}".format(102403)
daltonmenezes/learning-C
src/Python/format/thousands_separator.py
Python
mit
72
namespace DALs.Model.Interfaces { using Microsoft.WindowsAzure.Storage.Queue; using System; using System.Collections.Generic; using System.Threading.Tasks; /// <summary> /// Interface IQueueClient /// </summary> public interface IQueueClient { /// <summary> /// Peeks the asynchronous. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="queueName">Name of the queue.</param> /// <param name="loader">The loader.</param> /// <param name="top">The top.</param> /// <returns>Task&lt;IEnumerable&lt;T&gt;&gt;.</returns> Task<IEnumerable<T>> PeekAsync<T>(string queueName, Func<CloudQueueMessage, T> loader, int top = 32); /// <summary> /// Gets the information asynchronous. /// </summary> /// <param name="queueName">Name of the queue.</param> /// <returns>Task&lt;CloudQueue&gt;.</returns> Task<CloudQueue> GetInfoAsync(string queueName); } }
TianyuanC/dals
DALs.Model/Interfaces/IQueueClient.cs
C#
mit
1,032
/* * Critical styles and above-the-fold CSS defined here. * Author: Brian Quach */ /* Default variables */ /* Mixins */ header { text-align: center; padding: 25px 0; background-color: #f95036; } .health-tracker { font-family: Helvetica, sans-serif; font-size: 18px; color: #282828; background-color: #333333; } .health-tracker h1, .health-tracker h2, .health-tracker h3, .health-tracker h4, .health-tracker h5, .health-tracker h6 { font-weight: 900; } .health-tracker h1 { margin: 0; font-size: 4rem; } .health-tracker h2 { font-size: 3.2rem; } .health-tracker__summary { background-color: #f3f3f3; padding: 20px 0; } .health-tracker__summary label { display: block; font-weight: bold; margin: 0; } .health-tracker__summary .summary__stats { margin-bottom: 10px; } .health-tracker__search { border-top: #f0f0f0; background-color: #e5e5e5; padding: 20px 0; } .health-tracker__search .search__search-input { width: 100%; border: 1px solid #333; padding: 5px; -webkit-border-radius: 3px; -moz-border-radius: 3px; -ms-border-radius: 3px; border-radius: 3px; } .health-tracker__food-list { border-top: #eeeeee; padding: 20px 0; background-color: #a88d61; }
brianquach/health-tracker
src/css/above-the-fold.css
CSS
mit
1,271
double aligndistance (double * dists, double * distsA, double * distsB, double * x, double * y, int ats) { int i,j, k, dind = 0; for (i = 0; i < ats; i++) { for (j = 0; j < ats; j++) { dists[dind] = (x[3 * i] - y[3 * j]) * (x[3 * i] - y[3 * j]) + (x[3 * i + 1] - y[3 * j + 1]) * (x[3 * i + 1] - y[3 * j + 1]) + (x[3 * i + 2] - y[3 * j + 2]) * (x[3 * i + 2] - y[3 * j + 2]); distsA[dind] = i; distsB[dind] = j; dind++; } } double mind = 10000.0; int mindi, mindj; for (k = 0; k < ats * ats; k++) { if (dists[k] < mind){ mind = dists[k]; mindi = distsA[k]; mindj = distsB[k]; } } double mind2 = 10000.0; int mind2i, mind2j; for (k = 0; k < ats * ats; k++){ if ((dists[k] < mind2) && (distsA[k] != mindi) && (distsB[k] != mindj)) { mind2 = dists[k]; mind2i = distsA[k]; mind2j = distsB[k]; } } double mind3 = 10000.0; for (k = 0; k < ats * ats; k++){ if ((dists[k] < mind3) && (distsA[k] != mindi) && (distsB[k] != mindj) && (distsA[k] != mind2i) && (distsB[k] != mind2j)){ mind3 = dists[k]; } } return mind3; }
ramansbach/cluster_analysis
aligndistance.c
C
mit
1,351
/**************************************************************************** Copyright (c) 2013 cocos2d-x.org http://www.cocos2d-x.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ #include "UITextField.h" NS_CC_EXT_BEGIN UICCTextField::UICCTextField() : m_bMaxLengthEnabled(false) , m_nMaxLength(0) , m_bPasswordEnabled(false) , m_strPasswordStyleText("*") , m_bAttachWithIME(false) , m_bDetachWithIME(false) , m_bInsertText(false) , m_bDeleteBackward(false) { } UICCTextField::~UICCTextField() { } UICCTextField * UICCTextField::create(const char *placeholder, const char *fontName, float fontSize) { UICCTextField *pRet = new UICCTextField(); if(pRet && pRet->initWithString("", fontName, fontSize)) { pRet->autorelease(); if (placeholder) { pRet->setPlaceHolder(placeholder); } return pRet; } CC_SAFE_DELETE(pRet); return NULL; } void UICCTextField::onEnter() { CCTextFieldTTF::setDelegate(this); } bool UICCTextField::onTextFieldAttachWithIME(TextFieldTTF *pSender) { setAttachWithIME(true); return false; } bool UICCTextField::onTextFieldInsertText(TextFieldTTF *pSender, const char *text, int nLen) { if (nLen == 1 && strcmp(text, "\n") == 0) { return false; } setInsertText(true); if (m_bMaxLengthEnabled) { if (CCTextFieldTTF::getCharCount() >= m_nMaxLength) { return true; } } return false; } bool UICCTextField::onTextFieldDeleteBackward(TextFieldTTF *pSender, const char *delText, int nLen) { setDeleteBackward(true); return false; } bool UICCTextField::onTextFieldDetachWithIME(TextFieldTTF *pSender) { setDetachWithIME(true); return false; } void UICCTextField::insertText(const char * text, int len) { std::string str_text = text; int str_len = strlen(CCTextFieldTTF::getString()); if (strcmp(text, "\n") != 0) { if (m_bMaxLengthEnabled) { int multiple = 1; char value = text[0]; if (value < 0 || value > 127) { multiple = 3; } if (str_len + len > m_nMaxLength * multiple) { str_text = str_text.substr(0, m_nMaxLength * multiple); len = m_nMaxLength * multiple; /* int mod = str_len % 3; int offset = (mod == 0) ? 0 : (3 - mod); int amount = str_len + offset; str_text = str_text.substr(0, m_nMaxLength - amount); // CCLOG("str_test = %s", str_text.c_str()); */ } } } CCTextFieldTTF::insertText(str_text.c_str(), len); // password if (m_bPasswordEnabled) { if (CCTextFieldTTF::getCharCount() > 0) { setPasswordText(_inputText->c_str()); } } } void UICCTextField::deleteBackward() { CCTextFieldTTF::deleteBackward(); if (CCTextFieldTTF::getCharCount() > 0) { // password if (m_bPasswordEnabled) { setPasswordText(_inputText->c_str()); } } } void UICCTextField::openIME() { CCTextFieldTTF::attachWithIME(); } void UICCTextField::closeIME() { CCTextFieldTTF::detachWithIME(); } void UICCTextField::setMaxLengthEnabled(bool enable) { m_bMaxLengthEnabled = enable; } bool UICCTextField::isMaxLengthEnabled() { return m_bMaxLengthEnabled; } void UICCTextField::setMaxLength(int length) { m_nMaxLength = length; } int UICCTextField::getMaxLength() { return m_nMaxLength; } int UICCTextField::getCharCount() { return CCTextFieldTTF::getCharCount(); } void UICCTextField::setPasswordEnabled(bool enable) { m_bPasswordEnabled = enable; } bool UICCTextField::isPasswordEnabled() { return m_bPasswordEnabled; } void UICCTextField::setPasswordStyleText(const char* styleText) { if (strlen(styleText) > 1) { return; } char value = styleText[0]; if (value < 33 || value > 126) { return; } m_strPasswordStyleText = styleText; } void UICCTextField::setPasswordText(const char *text) { std::string tempStr; for (size_t i = 0; i < strlen(text); ++i) { tempStr.append(m_strPasswordStyleText); } CCLabelTTF::setString(tempStr.c_str()); } void UICCTextField::setAttachWithIME(bool attach) { m_bAttachWithIME = attach; } bool UICCTextField::getAttachWithIME() { return m_bAttachWithIME; } void UICCTextField::setDetachWithIME(bool detach) { m_bDetachWithIME = detach; } bool UICCTextField::getDetachWithIME() { return m_bDetachWithIME; } void UICCTextField::setInsertText(bool insert) { m_bInsertText = insert; } bool UICCTextField::getInsertText() { return m_bInsertText; } void UICCTextField::setDeleteBackward(bool deleteBackward) { m_bDeleteBackward = deleteBackward; } bool UICCTextField::getDeleteBackward() { return m_bDeleteBackward; } UITextField::UITextField(): _textFieldRenderer(NULL), _touchWidth(0.0f), _touchHeight(0.0f), _useTouchArea(false), _eventListener(NULL), _eventSelector(NULL) { } UITextField::~UITextField() { } UITextField* UITextField::create() { UITextField* widget = new UITextField(); if (widget && widget->init()) { widget->autorelease(); return widget; } CC_SAFE_DELETE(widget); return NULL; } bool UITextField::init() { if (UIWidget::init()) { setUpdateEnabled(true); return true; } return false; } void UITextField::initRenderer() { UIWidget::initRenderer(); _textFieldRenderer = UICCTextField::create("input words here", "Thonburi", 20); _renderer->addChild(_textFieldRenderer); } void UITextField::setTouchSize(const Size &size) { _useTouchArea = true; _touchWidth = size.width; _touchHeight = size.height; } void UITextField::setText(const char* text) { if (!text) { return; } std::string strText(text); _textFieldRenderer->setString(strText.c_str()); textfieldRendererScaleChangedWithSize(); } void UITextField::setPlaceHolder(const char *value) { _textFieldRenderer->setPlaceHolder(value); textfieldRendererScaleChangedWithSize(); } void UITextField::setFontSize(int size) { _textFieldRenderer->setFontSize(size); textfieldRendererScaleChangedWithSize(); } void UITextField::setFontName(const char *name) { _textFieldRenderer->setFontName(name); textfieldRendererScaleChangedWithSize(); } void UITextField::didNotSelectSelf() { _textFieldRenderer->detachWithIME(); } const char* UITextField::getStringValue() { return _textFieldRenderer->getString(); } bool UITextField::onTouchBegan(const Point &touchPoint) { bool pass = UIWidget::onTouchBegan(touchPoint); _textFieldRenderer->attachWithIME(); return pass; } void UITextField::setMaxLengthEnabled(bool enable) { _textFieldRenderer->setMaxLengthEnabled(enable); } bool UITextField::isMaxLengthEnabled() { return _textFieldRenderer->isMaxLengthEnabled(); } void UITextField::setMaxLength(int length) { _textFieldRenderer->setMaxLength(length); } int UITextField::getMaxLength() { return _textFieldRenderer->getMaxLength(); } void UITextField::setPasswordEnabled(bool enable) { _textFieldRenderer->setPasswordEnabled(enable); } bool UITextField::isPasswordEnabled() { return _textFieldRenderer->isPasswordEnabled(); } void UITextField::setPasswordStyleText(const char *styleText) { _textFieldRenderer->setPasswordStyleText(styleText); } void UITextField::update(float dt) { if (getAttachWithIME()) { attachWithIMEEvent(); setAttachWithIME(false); } if (getDetachWithIME()) { detachWithIMEEvent(); setDetachWithIME(false); } if (getInsertText()) { insertTextEvent(); setInsertText(false); textfieldRendererScaleChangedWithSize(); } if (getDeleteBackward()) { deleteBackwardEvent(); setDeleteBackward(false); } } bool UITextField::getAttachWithIME() { return _textFieldRenderer->getAttachWithIME(); } void UITextField::setAttachWithIME(bool attach) { _textFieldRenderer->setAttachWithIME(attach); } bool UITextField::getDetachWithIME() { return _textFieldRenderer->getDetachWithIME(); } void UITextField::setDetachWithIME(bool detach) { _textFieldRenderer->setDetachWithIME(detach); } bool UITextField::getInsertText() { return _textFieldRenderer->getInsertText(); } void UITextField::setInsertText(bool insertText) { _textFieldRenderer->setInsertText(insertText); } bool UITextField::getDeleteBackward() { return _textFieldRenderer->getDeleteBackward(); } void UITextField::setDeleteBackward(bool deleteBackward) { _textFieldRenderer->setDeleteBackward(deleteBackward); } void UITextField::attachWithIMEEvent() { if (_eventListener && _eventSelector) { (_eventListener->*_eventSelector)(this, TEXTFIELD_EVENT_ATTACH_WITH_IME); } } void UITextField::detachWithIMEEvent() { if (_eventListener && _eventSelector) { (_eventListener->*_eventSelector)(this, TEXTFIELD_EVENT_DETACH_WITH_IME); } } void UITextField::insertTextEvent() { if (_eventListener && _eventSelector) { (_eventListener->*_eventSelector)(this, TEXTFIELD_EVENT_INDERT_TEXT); } } void UITextField::deleteBackwardEvent() { if (_eventListener && _eventSelector) { (_eventListener->*_eventSelector)(this, TEXTFIELD_EVENT_DELETE_BACKWARD); } } void UITextField::addEventListener(Object *target, SEL_TextFieldEvent selecor) { _eventListener = target; _eventSelector = selecor; } void UITextField::setAnchorPoint(const Point &pt) { UIWidget::setAnchorPoint(pt); _textFieldRenderer->setAnchorPoint(pt); } void UITextField::setColor(const Color3B &color) { UIWidget::setColor(color); _textFieldRenderer->setColor(color); } void UITextField::setOpacity(int opacity) { UIWidget::setOpacity(opacity); _textFieldRenderer->setOpacity(opacity); } void UITextField::onSizeChanged() { textfieldRendererScaleChangedWithSize(); } void UITextField::textfieldRendererScaleChangedWithSize() { if (_ignoreSize) { _textFieldRenderer->setScale(1.0f); _size = getContentSize(); } else { Size textureSize = getContentSize(); if (textureSize.width <= 0.0f || textureSize.height <= 0.0f) { _textFieldRenderer->setScale(1.0f); return; } float scaleX = _size.width / textureSize.width; float scaleY = _size.height / textureSize.height; _textFieldRenderer->setScaleX(scaleX); _textFieldRenderer->setScaleY(scaleY); } } const Size& UITextField::getContentSize() const { return _textFieldRenderer->getContentSize(); } Node* UITextField::getVirtualRenderer() { return _textFieldRenderer; } const char* UITextField::getDescription() const { return "TextField"; } NS_CC_EXT_END
gibtang/CCNSCoding
extensions/CocoStudio/GUI/UIWidgets/UITextField.cpp
C++
mit
12,251
/** ****************************************************************************** * @file stm32f7xx_hal_dma_ex.h * @author MCD Application Team * @version V1.0.3 * @date 13-November-2015 * @brief Header file of DMA HAL extension module. ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F7xx_HAL_DMA_EX_H #define __STM32F7xx_HAL_DMA_EX_H #ifdef __cplusplus extern "C" { #endif /* Includes ------------------------------------------------------------------*/ #include "stm32f7xx_hal_def.h" /** @addtogroup STM32F7xx_HAL_Driver * @{ */ /** @addtogroup DMAEx * @{ */ /* Exported types ------------------------------------------------------------*/ /** @defgroup DMAEx_Exported_Types DMAEx Exported Types * @brief DMAEx Exported types * @{ */ /** * @brief HAL DMA Memory definition */ typedef enum { MEMORY0 = 0x00, /*!< Memory 0 */ MEMORY1 = 0x01, /*!< Memory 1 */ }HAL_DMA_MemoryTypeDef; /** * @} */ /* Exported functions --------------------------------------------------------*/ /** @defgroup DMAEx_Exported_Functions DMAEx Exported Functions * @brief DMAEx Exported functions * @{ */ /** @defgroup DMAEx_Exported_Functions_Group1 Extended features functions * @brief Extended features functions * @{ */ /* IO operation functions *******************************************************/ HAL_StatusTypeDef HAL_DMAEx_MultiBufferStart(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t SecondMemAddress, uint32_t DataLength); HAL_StatusTypeDef HAL_DMAEx_MultiBufferStart_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t SecondMemAddress, uint32_t DataLength); HAL_StatusTypeDef HAL_DMAEx_ChangeMemory(DMA_HandleTypeDef *hdma, uint32_t Address, HAL_DMA_MemoryTypeDef memory); /** * @} */ /** * @} */ /* Private functions ---------------------------------------------------------*/ /** @defgroup DMAEx_Private_Functions DMAEx Private Functions * @brief DMAEx Private functions * @{ */ /** * @} */ /** * @} */ /** * @} */ #ifdef __cplusplus } #endif #endif /* __STM32F7xx_HAL_DMA_H */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
hengdong/POSIX-RTOS
bsp/arch/ARM/Cortex-M/M7/chip/ST/STM32F7/STM32F7xx_HAL_Driver/include/stm32f7xx_hal_dma_ex.h
C
mit
4,118
using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; namespace beRemote.Core.Exceptions { public class ExceptionInvalidConfiguration : beRemoteException { public ExceptionInvalidConfiguration(beRemoteExInfoPackage infoPackage, String message) : base(infoPackage, message) { } public ExceptionInvalidConfiguration(beRemoteExInfoPackage infoPackage, String message, Exception innerEx) : base(infoPackage, message, innerEx) { } public override int EventId { get { return 101; } } } }
Hunv/beRemote
Core/Exceptions/beRemote.Core.Exceptions/ExceptionInvalidConfiguration.cs
C#
mit
653
--- layout: post date: '2015-06-18' title: "Weddington Way Alfred Angelo 7293L Sleeveless Sweep/Brush Train Mermaid/Trumpet" category: Weddington Way tags: [Weddington Way,Mermaid/Trumpet,Sweetheart,Sweep/Brush Train,Sleeveless] --- ### Weddington Way Alfred Angelo 7293L Just **$179.99** ### Sleeveless Sweep/Brush Train Mermaid/Trumpet <table><tr><td>BRANDS</td><td>Weddington Way</td></tr><tr><td>Silhouette</td><td>Mermaid/Trumpet</td></tr><tr><td>Neckline</td><td>Sweetheart</td></tr><tr><td>Hemline/Train</td><td>Sweep/Brush Train</td></tr><tr><td>Sleeve</td><td>Sleeveless</td></tr></table> <a href="https://www.readybrides.com/en/weddington-way/15927-weddington-way-alfred-angelo-7293l.html"><img src="//static.msromantic.com/36032/weddington-way-alfred-angelo-7293l.jpg" alt="Weddington Way Alfred Angelo 7293L" style="width:100%;" /></a> <!-- break --><a href="https://www.readybrides.com/en/weddington-way/15927-weddington-way-alfred-angelo-7293l.html"><img src="//static.msromantic.com/36031/weddington-way-alfred-angelo-7293l.jpg" alt="Weddington Way Alfred Angelo 7293L" style="width:100%;" /></a> Buy it: [https://www.readybrides.com/en/weddington-way/15927-weddington-way-alfred-angelo-7293l.html](https://www.readybrides.com/en/weddington-way/15927-weddington-way-alfred-angelo-7293l.html)
variousweddingdress/variousweddingdress.github.io
_posts/2015-06-18-Weddington-Way-Alfred-Angelo-7293L-Sleeveless-SweepBrush-Train-MermaidTrumpet.md
Markdown
mit
1,311
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.11"/> <title>V8 API Reference Guide for node.js v7.2.1: Class Members</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <script type="text/javascript"> $(document).ready(function() { init_search(); }); </script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">V8 API Reference Guide for node.js v7.2.1 </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.11 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li><a href="examples.html"><span>Examples</span></a></li> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <span class="left"> <img id="MSearchSelect" src="search/mag_sel.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> </span><span class="right"> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </span> </div> </li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="annotated.html"><span>Class&#160;List</span></a></li> <li><a href="classes.html"><span>Class&#160;Index</span></a></li> <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li> <li class="current"><a href="functions.html"><span>Class&#160;Members</span></a></li> </ul> </div> <div id="navrow3" class="tabs2"> <ul class="tablist"> <li class="current"><a href="functions.html"><span>All</span></a></li> <li><a href="functions_func.html"><span>Functions</span></a></li> <li><a href="functions_vars.html"><span>Variables</span></a></li> <li><a href="functions_type.html"><span>Typedefs</span></a></li> <li><a href="functions_enum.html"><span>Enumerations</span></a></li> </ul> </div> <div id="navrow4" class="tabs3"> <ul class="tablist"> <li><a href="functions.html#index_a"><span>a</span></a></li> <li><a href="functions_b.html#index_b"><span>b</span></a></li> <li><a href="functions_c.html#index_c"><span>c</span></a></li> <li><a href="functions_d.html#index_d"><span>d</span></a></li> <li><a href="functions_e.html#index_e"><span>e</span></a></li> <li><a href="functions_f.html#index_f"><span>f</span></a></li> <li><a href="functions_g.html#index_g"><span>g</span></a></li> <li><a href="functions_h.html#index_h"><span>h</span></a></li> <li><a href="functions_i.html#index_i"><span>i</span></a></li> <li><a href="functions_j.html#index_j"><span>j</span></a></li> <li><a href="functions_k.html#index_k"><span>k</span></a></li> <li><a href="functions_l.html#index_l"><span>l</span></a></li> <li><a href="functions_m.html#index_m"><span>m</span></a></li> <li><a href="functions_n.html#index_n"><span>n</span></a></li> <li><a href="functions_o.html#index_o"><span>o</span></a></li> <li><a href="functions_p.html#index_p"><span>p</span></a></li> <li class="current"><a href="functions_r.html#index_r"><span>r</span></a></li> <li><a href="functions_s.html#index_s"><span>s</span></a></li> <li><a href="functions_t.html#index_t"><span>t</span></a></li> <li><a href="functions_u.html#index_u"><span>u</span></a></li> <li><a href="functions_v.html#index_v"><span>v</span></a></li> <li><a href="functions_w.html#index_w"><span>w</span></a></li> <li><a href="functions_0x7e.html#index_0x7e"><span>~</span></a></li> </ul> </div> </div><!-- top --> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div class="contents"> <div class="textblock">Here is a list of all documented class members with links to the class documentation for each member:</div> <h3><a class="anchor" id="index_r"></a>- r -</h3><ul> <li>ReadOnlyPrototype() : <a class="el" href="classv8_1_1FunctionTemplate.html#a91d2e0643e8c5a53ab1d75f7766c2422">v8::FunctionTemplate</a> </li> <li>RegisterExternallyReferencedObject() : <a class="el" href="classv8_1_1PersistentValueMapBase.html#a7d1cd63172b997dfaac9d0f009edd709">v8::PersistentValueMapBase&lt; K, V, Traits &gt;</a> </li> <li>RegisterExternalReference() : <a class="el" href="classv8_1_1PersistentBase.html#a14c051e0080bbe7fbe02be35865b9923">v8::PersistentBase&lt; T &gt;</a> </li> <li>RegisterV8References() : <a class="el" href="classv8_1_1EmbedderHeapTracer.html#afa88b641b32638f798017b29755a88b3">v8::EmbedderHeapTracer</a> </li> <li>Release() : <a class="el" href="classv8_1_1PersistentValueMapBase.html#a9ffa7a4e0c59121c0471d71c04112966">v8::PersistentValueMapBase&lt; K, V, Traits &gt;</a> </li> <li>Remove() : <a class="el" href="classv8_1_1PersistentValueMapBase.html#abd75a4c050416712167ba0bb9eace097">v8::PersistentValueMapBase&lt; K, V, Traits &gt;</a> </li> <li>RemoveBeforeCallEnteredCallback() : <a class="el" href="classv8_1_1Isolate.html#a92be6cf5ce1e7360843794cc1528369f">v8::Isolate</a> </li> <li>RemoveCallCompletedCallback() : <a class="el" href="classv8_1_1Isolate.html#a46f0a5d35f8b29030922bdb433c0dc4f">v8::Isolate</a> </li> <li>RemoveGCEpilogueCallback() : <a class="el" href="classv8_1_1Isolate.html#a059d51bc45cdd5f4821233170863a9ff">v8::Isolate</a> </li> <li>RemoveGCPrologueCallback() : <a class="el" href="classv8_1_1Isolate.html#a7c424950b2bc9589fc676a9b38b27d63">v8::Isolate</a> </li> <li>RemoveMessageListeners() : <a class="el" href="classv8_1_1Isolate.html#a0319e55b26ba3ac51d867b37b917a21f">v8::Isolate</a> </li> <li>RemoveMicrotasksCompletedCallback() : <a class="el" href="classv8_1_1Isolate.html#a0fdc58db0d44c5a8f427d809e1c0b604">v8::Isolate</a> </li> <li>RemovePrototype() : <a class="el" href="classv8_1_1FunctionTemplate.html#a4a184aca244174c7fe52d58871d3129e">v8::FunctionTemplate</a> </li> <li>ReportProgressValue() : <a class="el" href="classv8_1_1ActivityControl.html#a1300f10611306a3e8f79239e057eb0bf">v8::ActivityControl</a> </li> <li>RequestGarbageCollectionForTesting() : <a class="el" href="classv8_1_1Isolate.html#a59fe893ed7e9df52cef2d59b2d98ab23">v8::Isolate</a> </li> <li>RequestInterrupt() : <a class="el" href="classv8_1_1Isolate.html#a971b6094ecc6c7f55eb6f58a71a8afd3">v8::Isolate</a> </li> <li>ReserveCapacity() : <a class="el" href="classv8_1_1PersistentValueVector.html#ad4cccfee3a275986578276efe0c78510">v8::PersistentValueVector&lt; V, Traits &gt;</a> </li> <li>Reset() : <a class="el" href="classv8_1_1PersistentBase.html#a174bb1e45b18fd4eeaee033622825bb8">v8::PersistentBase&lt; T &gt;</a> , <a class="el" href="classv8_1_1TryCatch.html#a3aae8acab4c99b374b7d782763d4c8e1">v8::TryCatch</a> </li> <li>ResetToBookmark() : <a class="el" href="classv8_1_1ScriptCompiler_1_1ExternalSourceStream.html#a425cf1ba265eeca194b805fe5c52bc19">v8::ScriptCompiler::ExternalSourceStream</a> </li> <li>ReThrow() : <a class="el" href="classv8_1_1TryCatch.html#ab8c3a1dbb38e6fd00e37436034daf707">v8::TryCatch</a> </li> <li>RunMicrotasks() : <a class="el" href="classv8_1_1Isolate.html#ac3cbe2a1632eb863912640dcfc98b6c8">v8::Isolate</a> </li> </ul> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.11 </small></address> </body> </html>
v8-dox/v8-dox.github.io
03b1c31/html/functions_r.html
HTML
mit
9,409
--- layout: post title: How to learn Ruby - Tales in Rubyland part 1. permalink: /posts/tales_in_rubyland_part1 --- Following the concept of learning a new programming language whenever I can as well as being curious about what changed in Ruby since I used it last time in 2003 as well as meeting <a href="http://twitter.com/#!/andypearson">Andy</a>, I decided to go for it. ## Preparation Because <a href="http://www.codinghorror.com/blog/2005/04/you-can-write-fortran-in-any-language.html" target="_blank">you can write Fortran in any language</a>, I first wanted to begin with engaging with the language's mentality, it's design. Because Ruby is being compared and sometimes competing with Python, I started with checking the web front and try to see how rails is designed VS django. A friend supplied me with the following old, but still great video: <a href="http://video.google.com/videoplay?docid=2939556954580527226">Snakes and Rubies (full)</a> <object id="VideoPlayback" style="width: 400px; height: 326px;" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="100" height="100" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://video.google.com/googleplayer.swf?docid=2939556954580527226&amp;hl=en&amp;fs=true" /><param name="allowfullscreen" value="true" /><embed id="VideoPlayback" style="width: 400px; height: 326px;" type="application/x-shockwave-flash" width="100" height="100" src="http://video.google.com/googleplayer.swf?docid=2939556954580527226&amp;hl=en&amp;fs=true" allowfullscreen="true"></embed></object> Also this <a href="http://www.wikivs.com/wiki/Python_vs_Ruby">vswiki</a> entry somehow popped up. ## First Steps Thinking with my "old" brain, my first inclination was to buy a book, which I did, but while waiting for the book to arrive on my doorstep, I started realising that the whole ecosystem provided new innovative ways of learning. ### Ruby Games Say hi to <a href="railsforzombies.org" target="_blank">Rails for Zombies</a>. Rails for zombies is an interactive course where you learn how to program on Rails, by developing a twitter-like application for zombies :-). The game is arranged in levels and some additional goodies are available upon completion. It took about two days to finish it, by using only a modern browser. In order to support them the development team encourages the newcomer to buy a rails for zombies <a href="http://www.rubyrags.com/products/12" target="_blank">t-shirt</a>. Would definitely buy something like a mug or stationary. ### The book In the mean time the book arrived: <a href="http://headfirstlabs.com/books/hfrails/" target="_blank">Head First Rails</a> by being a long-term fan of the series. Armed though with the knowledge of having finished the game, the exercises got finished fast. What was tough was to do them o Rails3 which is not there by default nor in ubuntu or in os-x. In order to do so: * Ubuntu: <a href="http://ascarter.net/2010/05/10/rails-development-on-ubuntu-10.04.html" target="_blank">Rails Development on Ubuntu 10.04</a> * <a href="http://ascarter.net/2010/05/10/rails-development-on-ubuntu-10.04.html" target="_blank"></a>and OS-X: <a href="http://www.bawdo.com/posts/42" target="_blank">ruby 1.9 and rails 3 on mac osx 10.5</a> Having to fix something broken apart from the initial frustration is an experience that exposes the internals of the system under repair. This time it got used as an introduction to gems, the Rails command line and other details and idiosyncrasies of the community and the languages approach. ## Going Deeper ### Koans After the first experiences the opportunity to dwell more into programming in the "Ruby Way" came with exposure to the <a href="http://rubykoans.com/" target="_blank">Koans</a>, quoting: > The Koans walk you along the path to enlightenment in order to learn Ruby. The goal is to learn the Ruby language, syntax, structure, and some common functions and libraries. We also teach you culture. Testing is not just something we pay lip service to, but something we live. It is essential in your quest to learn and do great things in the language. Koans are essentially a list of tests that are designed to fail. The practitioner has to fill the gaps or write small chunks of code so that the tests will "pass". Evaluation is being achieved by a simple: <pre lang="ruby"> rake</pre> while at the same time the 263 tests are a tour de force of all language's features, conventions etc. At the end of the "challenge" you are being rewarded by a text adventure like screen (spoiler alert): <p style="text-align: center;"><img class="aligncenter" title="Koans end screen" src="http://dl.dropbox.com/u/1995706/cdn/blog/koans_end.png" alt="" width="376" height="329" /></p> The experience and the layout of the tests was great. I only found the last one being a little bit more difficult than the usual case, which made me <a href="www.johnlmiller.com/archives/2009/04/14/exploring-the-ruby-koans-building-an-object-proxy/" target="_blank">cheat a bit</a> in order to solve it. The most surprising fact is that whenever I did not know which method to use, the most reasonable english word, did the trick. ### Other Resources Many and different and common. It seems that ruby programmers know them "by default". I spent much time watching the <a href="http://railscasts.com/" target="_blank">rail casts</a>, listening to the <a href="http://5by5.tv/rubyshow" target="_blank">Ruby show</a>. On the cheat sheet front, dzone's <a href="http://refcardz.dzone.com/refcardz/essential-ruby" target="_blank">reference card</a> was great as well as envy labs rails3 <a href="http://blog.envylabs.com/2010/12/rails-3-cheat-sheets/" target="_blank">cheat sheet</a>, which makes most of the cheat sheets I've printed to look oh-so poor. ## Conclusion Great mentality, great language (I knew it would happen when I decided to write my dissertation on Ruby back in 2003, but would never expect it to be so big... never). Also great community. People are eager to accomodate the newcomer and teach the various ruby-isms which make things so great but overwhelmingly different. Also having many issues solved because of the languages design and frameworks on top of it, code maintainers are investing huge amounts of time on code readability and maintainability. Finally although Ruby is far more than that, most attention is on it's web framework, Rails. So it is natural for most people to be a "web" language or a "php-killer". I do not know if this limits languages reachability or if it is irrelevant. ## Further steps I suppose I will use it for a mini personal project that I can implement in any language that I want. Also I will do a Rails project whenever I have the chance. In part 2 the journey continues with Ruby's scripting capabilities: <a title="Tales in Rubyland part 2 – “You can write elegant shell scripts and unit test them too”" href="/posts/tales_in_rubyland_part2">Tales in Rubyland part 2</a>.
dimitrismistriotis/dimitrismistriotis.github.com
_posts/2011-01-01-tales_in_rubyland_part1.md
Markdown
mit
7,071
/* * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #include "third_party/winuwp_h264/H264Decoder/H264Decoder.h" #include <Windows.h> #include <codecapi.h> #include <mfapi.h> #include <mfidl.h> #include <mfreadwrite.h> #include <ppltasks.h> #include <robuffer.h> #include <wrl.h> #include <wrl\implements.h> #include <iomanip> #include "../Utils/Utils.h" #include "common_video/include/video_frame_buffer.h" #include "libyuv/convert.h" #include "modules/video_coding/include/video_codec_interface.h" #include "rtc_base/checks.h" #include "rtc_base/logging.h" #pragma comment(lib, "mfreadwrite") #pragma comment(lib, "mfplat") #pragma comment(lib, "mfuuid.lib") namespace webrtc { ////////////////////////////////////////// // H264 WinUWP Decoder Implementation ////////////////////////////////////////// WinUWPH264DecoderImpl::WinUWPH264DecoderImpl() : buffer_pool_(false, 300), /* max_number_of_buffers*/ width_(absl::nullopt), height_(absl::nullopt), decode_complete_callback_(nullptr){} WinUWPH264DecoderImpl::~WinUWPH264DecoderImpl() { OutputDebugString(L"WinUWPH264DecoderImpl::~WinUWPH264DecoderImpl()\n"); Release(); } HRESULT ConfigureOutputMediaType(ComPtr<IMFTransform> decoder, GUID media_type, bool* type_found) { HRESULT hr = S_OK; *type_found = false; int type = 0; while (true) { ComPtr<IMFMediaType> output_media; ON_SUCCEEDED(decoder->GetOutputAvailableType(0, type, &output_media)); if (hr == MF_E_NO_MORE_TYPES) return S_OK; GUID cur_type; ON_SUCCEEDED(output_media->GetGUID(MF_MT_SUBTYPE, &cur_type)); if (FAILED(hr)) return hr; if (cur_type == media_type) { hr = decoder->SetOutputType(0, output_media.Get(), 0); ON_SUCCEEDED(*type_found = true); return hr; } type++; } } HRESULT CreateInputMediaType(IMFMediaType** pp_input_media, absl::optional<UINT32> img_width, absl::optional<UINT32> img_height, absl::optional<UINT32> frame_rate) { HRESULT hr = MFCreateMediaType(pp_input_media); IMFMediaType* input_media = *pp_input_media; ON_SUCCEEDED(input_media->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video)); ON_SUCCEEDED(input_media->SetGUID(MF_MT_SUBTYPE, MFVideoFormat_H264)); ON_SUCCEEDED( MFSetAttributeRatio(input_media, MF_MT_PIXEL_ASPECT_RATIO, 1, 1)); ON_SUCCEEDED(input_media->SetUINT32( MF_MT_INTERLACE_MODE, MFVideoInterlace_MixedInterlaceOrProgressive)); if (frame_rate.has_value()) { ON_SUCCEEDED(MFSetAttributeRatio(input_media, MF_MT_FRAME_RATE, frame_rate.value(), 1)); } if (img_width.has_value() && img_height.has_value()) { ON_SUCCEEDED(MFSetAttributeSize(input_media, MF_MT_FRAME_SIZE, img_width.value(), img_height.value())); } return hr; } int WinUWPH264DecoderImpl::InitDecode(const VideoCodec* codec_settings, int number_of_cores) { RTC_LOG(LS_INFO) << "WinUWPH264DecoderImpl::InitDecode()\n"; width_ = codec_settings->width > 0 ? absl::optional<UINT32>(codec_settings->width) : absl::nullopt; height_ = codec_settings->height > 0 ? absl::optional<UINT32>(codec_settings->height) : absl::nullopt; HRESULT hr = S_OK; ON_SUCCEEDED(CoInitializeEx(0, COINIT_APARTMENTTHREADED)); ON_SUCCEEDED(MFStartup(MF_VERSION, 0)); ON_SUCCEEDED(CoCreateInstance(CLSID_MSH264DecoderMFT, nullptr, CLSCTX_INPROC_SERVER, IID_IUnknown, (void**)&decoder_)); if (FAILED(hr)) { RTC_LOG(LS_ERROR) << "Init failure: could not create Media Foundation H264 " "decoder instance."; return WEBRTC_VIDEO_CODEC_ERROR; } // Try set decoder attributes ComPtr<IMFAttributes> decoder_attrs; ON_SUCCEEDED(decoder_->GetAttributes(decoder_attrs.GetAddressOf())); if (SUCCEEDED(hr)) { ON_SUCCEEDED(decoder_attrs->SetUINT32(CODECAPI_AVLowLatencyMode, TRUE)); if (FAILED(hr)) { RTC_LOG(LS_WARNING) << "Init warning: failed to set low latency in H264 decoder."; hr = S_OK; } ON_SUCCEEDED( decoder_attrs->SetUINT32(CODECAPI_AVDecVideoAcceleration_H264, TRUE)); if (FAILED(hr)) { RTC_LOG(LS_WARNING) << "Init warning: failed to set HW accel in H264 decoder."; } } // Clear any error from try set attributes hr = S_OK; ComPtr<IMFMediaType> input_media; ON_SUCCEEDED(CreateInputMediaType( input_media.GetAddressOf(), width_, height_, codec_settings->maxFramerate > 0 ? absl::optional<UINT32>(codec_settings->maxFramerate) : absl::nullopt)); if (FAILED(hr)) { RTC_LOG(LS_ERROR) << "Init failure: could not create input media type."; return WEBRTC_VIDEO_CODEC_ERROR; } // Register the input type with the decoder ON_SUCCEEDED(decoder_->SetInputType(0, input_media.Get(), 0)); if (FAILED(hr)) { RTC_LOG(LS_ERROR) << "Init failure: failed to set input media type on decoder."; return WEBRTC_VIDEO_CODEC_ERROR; } // Assert MF supports NV12 output bool suitable_type_found; ON_SUCCEEDED(ConfigureOutputMediaType(decoder_, MFVideoFormat_NV12, &suitable_type_found)); if (FAILED(hr) || !suitable_type_found) { RTC_LOG(LS_ERROR) << "Init failure: failed to find a valid output media " "type for decoding."; return WEBRTC_VIDEO_CODEC_ERROR; } DWORD status; ON_SUCCEEDED(decoder_->GetInputStatus(0, &status)); // Validate that decoder is up and running if (SUCCEEDED(hr)) { if (MFT_INPUT_STATUS_ACCEPT_DATA != status) // H.264 decoder MFT is not accepting data return WEBRTC_VIDEO_CODEC_ERROR; } ON_SUCCEEDED(decoder_->ProcessMessage(MFT_MESSAGE_COMMAND_FLUSH, NULL)); ON_SUCCEEDED( decoder_->ProcessMessage(MFT_MESSAGE_NOTIFY_BEGIN_STREAMING, NULL)); ON_SUCCEEDED( decoder_->ProcessMessage(MFT_MESSAGE_NOTIFY_START_OF_STREAM, NULL)); inited_ = true; return SUCCEEDED(hr) ? WEBRTC_VIDEO_CODEC_OK : WEBRTC_VIDEO_CODEC_ERROR; } /** * Workaround [MF H264 bug: Output status is never set, even when ready] * => For now, always mark "ready" (results in extra buffer alloc/dealloc). */ HRESULT GetOutputStatus(ComPtr<IMFTransform> decoder, DWORD* output_status) { HRESULT hr = decoder->GetOutputStatus(output_status); // Don't MFT trust output status for now. *output_status = MFT_OUTPUT_STATUS_SAMPLE_READY; return hr; } /** * Note: expected to return MF_E_TRANSFORM_NEED_MORE_INPUT and * MF_E_TRANSFORM_STREAM_CHANGE which must be handled by caller. */ HRESULT WinUWPH264DecoderImpl::FlushFrames(uint32_t rtp_timestamp, uint64_t ntp_time_ms) { HRESULT hr; DWORD output_status; while (SUCCEEDED(hr = GetOutputStatus(decoder_, &output_status)) && output_status == MFT_OUTPUT_STATUS_SAMPLE_READY) { // Get needed size of our output buffer MFT_OUTPUT_STREAM_INFO strm_info; ON_SUCCEEDED(decoder_->GetOutputStreamInfo(0, &strm_info)); if (FAILED(hr)) { RTC_LOG(LS_ERROR) << "Decode failure: failed to get output stream info."; return hr; } // Create output sample ComPtr<IMFMediaBuffer> out_buffer; ON_SUCCEEDED(MFCreateMemoryBuffer(strm_info.cbSize, &out_buffer)); if (FAILED(hr)) { RTC_LOG(LS_ERROR) << "Decode failure: output image memory buffer creation failed."; return hr; } ComPtr<IMFSample> out_sample; ON_SUCCEEDED(MFCreateSample(&out_sample)); if (FAILED(hr)) { RTC_LOG(LS_ERROR) << "Decode failure: output in_sample creation failed."; return hr; } ON_SUCCEEDED(out_sample->AddBuffer(out_buffer.Get())); if (FAILED(hr)) { RTC_LOG(LS_ERROR) << "Decode failure: failed to add buffer to output in_sample."; return hr; } // Create output buffer description MFT_OUTPUT_DATA_BUFFER output_data_buffer; output_data_buffer.dwStatus = 0; output_data_buffer.dwStreamID = 0; output_data_buffer.pEvents = nullptr; output_data_buffer.pSample = out_sample.Get(); // Invoke the Media Foundation decoder // Note: we don't use ON_SUCCEEDED here since ProcessOutput returns // MF_E_TRANSFORM_NEED_MORE_INPUT often (too many log messages). DWORD status; hr = decoder_->ProcessOutput(0, 1, &output_data_buffer, &status); if (FAILED(hr)) return hr; /* can return MF_E_TRANSFORM_NEED_MORE_INPUT or MF_E_TRANSFORM_STREAM_CHANGE (entirely acceptable) */ // Copy raw output sample data to video frame buffer. ComPtr<IMFMediaBuffer> src_buffer; ON_SUCCEEDED(out_sample->ConvertToContiguousBuffer(&src_buffer)); if (FAILED(hr)) { RTC_LOG(LS_ERROR) << "Decode failure: failed to get contiguous buffer."; return hr; } uint32_t width, height; if (width_.has_value() && height_.has_value()) { width = width_.value(); height = height_.value(); } else { // Query the size from MF output media type ComPtr<IMFMediaType> output_type; ON_SUCCEEDED( decoder_->GetOutputCurrentType(0, output_type.GetAddressOf())); ON_SUCCEEDED(MFGetAttributeSize(output_type.Get(), MF_MT_FRAME_SIZE, &width, &height)); if (FAILED(hr)) { RTC_LOG(LS_ERROR) << "Decode failure: could not read image dimensions " "from Media Foundation, so the video frame buffer " "size can not be determined."; return hr; } // Update members to avoid querying unnecessarily width_.emplace(width); height_.emplace(height); } rtc::scoped_refptr<I420Buffer> buffer = buffer_pool_.CreateBuffer(width, height); if (!buffer.get()) { // Pool has too many pending frames. RTC_LOG(LS_WARNING) << "Decode warning: too many frames. Dropping frame."; return WEBRTC_VIDEO_CODEC_NO_OUTPUT; } DWORD cur_length; ON_SUCCEEDED(src_buffer->GetCurrentLength(&cur_length)); if (FAILED(hr)) { RTC_LOG(LS_ERROR) << "Decode failure: could not get buffer length."; return hr; } if (cur_length > 0) { BYTE* src_data; DWORD max_len, cur_len; ON_SUCCEEDED(src_buffer->Lock(&src_data, &max_len, &cur_len)); if (FAILED(hr)) { RTC_LOG(LS_ERROR) << "Decode failure: could lock buffer for copying."; return hr; } // Convert NV12 to I420. Y and UV sections have same stride in NV12 // (width). The size of the Y section is the size of the frame, since Y // luminance values are 8-bits each. libyuv::NV12ToI420(src_data, width, src_data + (width * height), width, buffer->MutableDataY(), buffer->StrideY(), buffer->MutableDataU(), buffer->StrideU(), buffer->MutableDataV(), buffer->StrideV(), width, height); ON_SUCCEEDED(src_buffer->Unlock()); if (FAILED(hr)) return hr; } // LONGLONG sample_time; /* unused */ // ON_SUCCEEDED(spOutSample->GetSampleTime(&sample_time)); // TODO: Ideally, we should convert sample_time (above) back to 90khz + base // and use it in place of rtp_timestamp, since MF may interpolate it. // Instead, we ignore the MFT sample time out, using rtp from in frame that // triggered this decoded frame. VideoFrame decoded_frame(buffer, rtp_timestamp, 0, kVideoRotation_0); // Use ntp time from the earliest frame decoded_frame.set_ntp_time_ms(ntp_time_ms); // Emit image to downstream if (decode_complete_callback_ != nullptr) { decode_complete_callback_->Decoded(decoded_frame, absl::nullopt, absl::nullopt); } } return hr; } /** * Note: acceptable to return MF_E_NOTACCEPTING (though it shouldn't since * last loop should've flushed) */ HRESULT WinUWPH264DecoderImpl::EnqueueFrame(const EncodedImage& input_image, bool missing_frames) { HRESULT hr = S_OK; // Create a MF buffer from our data ComPtr<IMFMediaBuffer> in_buffer; ON_SUCCEEDED(MFCreateMemoryBuffer(input_image._length, &in_buffer)); if (FAILED(hr)) { RTC_LOG(LS_ERROR) << "Decode failure: input image memory buffer creation failed."; return hr; } DWORD max_len, cur_len; BYTE* data; ON_SUCCEEDED(in_buffer->Lock(&data, &max_len, &cur_len)); if (FAILED(hr)) return hr; memcpy(data, input_image._buffer, input_image._length); ON_SUCCEEDED(in_buffer->Unlock()); if (FAILED(hr)) return hr; ON_SUCCEEDED(in_buffer->SetCurrentLength(input_image._length)); if (FAILED(hr)) return hr; // Create a sample from media buffer ComPtr<IMFSample> in_sample; ON_SUCCEEDED(MFCreateSample(&in_sample)); if (FAILED(hr)) { RTC_LOG(LS_ERROR) << "Decode failure: input in_sample creation failed."; return hr; } ON_SUCCEEDED(in_sample->AddBuffer(in_buffer.Get())); if (FAILED(hr)) { RTC_LOG(LS_ERROR) << "Decode failure: failed to add buffer to input in_sample."; return hr; } int64_t sample_time_ms; if (first_frame_rtp_ == 0) { first_frame_rtp_ = input_image.Timestamp(); sample_time_ms = 0; } else { // Convert from 90 khz, rounding to nearest ms. sample_time_ms = (static_cast<uint64_t>(input_image.Timestamp()) - first_frame_rtp_) / 90.0 + 0.5f; } ON_SUCCEEDED(in_sample->SetSampleTime( sample_time_ms * 10000 /* convert milliseconds to 100-nanosecond unit */)); if (FAILED(hr)) { RTC_LOG(LS_ERROR) << "Decode failure: failed to set in_sample time on input in_sample."; return hr; } // Set sample attributes ComPtr<IMFAttributes> sample_attrs; ON_SUCCEEDED(in_sample.As(&sample_attrs)); if (FAILED(hr)) { RTC_LOG(LS_ERROR) << "Decode warning: failed to set image attributes for frame."; hr = S_OK; } else { if (input_image._frameType == kVideoFrameKey && input_image._completeFrame) { ON_SUCCEEDED(sample_attrs->SetUINT32(MFSampleExtension_CleanPoint, TRUE)); hr = S_OK; } if (missing_frames) { ON_SUCCEEDED( sample_attrs->SetUINT32(MFSampleExtension_Discontinuity, TRUE)); hr = S_OK; } } // Enqueue sample with Media Foundation ON_SUCCEEDED(decoder_->ProcessInput(0, in_sample.Get(), 0)); return hr; } int WinUWPH264DecoderImpl::Decode(const EncodedImage& input_image, bool missing_frames, const CodecSpecificInfo* codec_specific_info, int64_t render_time_ms) { HRESULT hr = S_OK; if (!inited_) { return WEBRTC_VIDEO_CODEC_UNINITIALIZED; } if (decode_complete_callback_ == NULL) { return WEBRTC_VIDEO_CODEC_UNINITIALIZED; } if (input_image._buffer == NULL && input_image._length > 0) { return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; } // Discard until keyframe. if (require_keyframe_) { if (input_image._frameType != kVideoFrameKey || !input_image._completeFrame) { return WEBRTC_VIDEO_CODEC_ERROR; } else { require_keyframe_ = false; } } // Enqueue the new frame with Media Foundation ON_SUCCEEDED(EnqueueFrame(input_image, missing_frames)); if (hr == MF_E_NOTACCEPTING) { // For robustness (shouldn't happen). Flush any old MF data blocking the // new frames. hr = decoder_->ProcessMessage(MFT_MESSAGE_COMMAND_FLUSH, NULL); if (input_image._frameType == kVideoFrameKey) { ON_SUCCEEDED(EnqueueFrame(input_image, missing_frames)); } else { require_keyframe_ = true; return WEBRTC_VIDEO_CODEC_ERROR; } } if (FAILED(hr)) return WEBRTC_VIDEO_CODEC_ERROR; // Flush any decoded samples resulting from new frame, invoking callback hr = FlushFrames(input_image.Timestamp(), input_image.ntp_time_ms_); if (hr == MF_E_TRANSFORM_STREAM_CHANGE) { // Output media type is no longer suitable. Reconfigure and retry. bool suitable_type_found; hr = ConfigureOutputMediaType(decoder_, MFVideoFormat_NV12, &suitable_type_found); if (FAILED(hr) || !suitable_type_found) return WEBRTC_VIDEO_CODEC_ERROR; // Reset width and height in case output media size has changed (though it // seems that would be unexpected, given that the input media would need to // be manually changed too). width_.reset(); height_.reset(); hr = FlushFrames(input_image.Timestamp(), input_image.ntp_time_ms_); } if (SUCCEEDED(hr) || hr == MF_E_TRANSFORM_NEED_MORE_INPUT) { return WEBRTC_VIDEO_CODEC_OK; } return WEBRTC_VIDEO_CODEC_ERROR; } int WinUWPH264DecoderImpl::RegisterDecodeCompleteCallback( DecodedImageCallback* callback) { rtc::CritScope lock(&crit_); decode_complete_callback_ = callback; return WEBRTC_VIDEO_CODEC_OK; } int WinUWPH264DecoderImpl::Release() { OutputDebugString(L"WinUWPH264DecoderImpl::Release()\n"); HRESULT hr = S_OK; inited_ = false; // Release I420 frame buffer pool buffer_pool_.Release(); if (decoder_ != NULL) { // Follow shutdown procedure gracefully. On fail, continue anyway. ON_SUCCEEDED(decoder_->ProcessMessage(MFT_MESSAGE_NOTIFY_END_OF_STREAM, 0)); ON_SUCCEEDED(decoder_->ProcessMessage(MFT_MESSAGE_COMMAND_DRAIN, NULL)); ON_SUCCEEDED(decoder_->ProcessMessage(MFT_MESSAGE_COMMAND_FLUSH, NULL)); decoder_ = nullptr; } MFShutdown(); CoUninitialize(); return WEBRTC_VIDEO_CODEC_OK; } const char* WinUWPH264DecoderImpl::ImplementationName() const { return "H264_MediaFoundation"; } } // namespace webrtc
webrtc-uwp/webrtc-windows
third_party/winuwp_h264/H264Decoder/H264Decoder.cc
C++
mit
18,462
using System.Text; using Hie.Core.Mocks; using Hie.Core.Model; using Hie.Core.Modules.JavaScript; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Hie.Core { [TestClass] public class HieEngineTest { [TestMethod] public void BasicRoutingFilteringTransformationTest() { // A new application Application application = new Application(); // Ports Port receivePort = new Port(); IEndpoint endpoint = new EndpointMock(); receivePort.Endpoint = endpoint; { IEncoder encoder = new PipelineComponentMock(); receivePort.Encoders.Add(encoder); IDisassembler disassembler = new PipelineComponentMock(); receivePort.Assembers.Add(disassembler); } application.Ports.Add(receivePort); Port sendPort = new Port(); IEndpoint sendEndpoint = new EndpointMock(); sendPort.Endpoint = sendEndpoint; { IEncoder encoder = new PipelineComponentMock(); sendPort.Encoders.Add(encoder); IDisassembler disassembler = new PipelineComponentMock(); sendPort.Assembers.Add(disassembler); } application.Ports.Add(sendPort); // Add a channel Channel channel = new Channel(); application.Channels.Add(channel); // Source setup Source source = new Source(); channel.Source = source; source.Filters.Add(new DelegateFilter((src, message) => true)); source.Filters.Add(new JavaScriptFilter { Script = "true" }); source.Transformers.Add(new DelegateTransformer()); source.Transformers.Add(new DelegateTransformer((src, message) => { })); source.Transformers.Add(new DelegateTransformer((src, message) => message.SetValueFrom(message.GetString()))); { Destination destination = new Destination(); destination.Target = sendEndpoint; destination.Filters.Add(new DelegateFilter((src, message) => true)); destination.Filters.Add(new JavaScriptFilter { Script = "true" }); destination.Transformers.Add(new DelegateTransformer((src, message) => { })); destination.Transformers.Add(new DelegateTransformer((src, message) => message.SetValueFrom(message.GetString()))); channel.Destinations.Add(destination); } { // This destination will filter out the message Destination destination = new Destination(); destination.Target = sendEndpoint; destination.Filters.Add(new DelegateFilter((src, message) => false)); channel.Destinations.Add(destination); } { // This destination will transform the message Destination destination = new Destination(); destination.Target = sendEndpoint; destination.Filters.Add(new DelegateFilter((src, message) => true)); destination.Transformers.Add(new DelegateTransformer((src, message) => message.SetValueFrom(message.GetString() + "test"))); channel.Destinations.Add(destination); } // Host ApplicationHost applicationHost = new ApplicationHost(); Assert.IsNotNull(applicationHost.Applications); applicationHost.Deploy(application); // Start the processing Message testMessage = new Message("text/json"); testMessage.SetValueFrom("AAAA"); // Mock method for sending a test message ((EndpointMock) endpoint).SendTestMessage(testMessage); // Check that endpoint received the message EndpointMock endpointMock = sendEndpoint as EndpointMock; Assert.IsNotNull(endpointMock); Assert.IsNotNull(endpointMock.Messages); Assert.AreEqual(2, endpointMock.Messages.Count); foreach (byte[] data in endpointMock.Messages) { string actual = Encoding.UTF8.GetString(data); if (actual.EndsWith("test")) { Assert.AreEqual(testMessage.GetString() + "test", actual); } else { Assert.AreEqual(testMessage.GetString(), actual); } } } } }
NiclasOlofsson/HIE
Hie/Hie.Core.Test/HieEngineTest.cs
C#
mit
3,727
using Microsoft.SqlServer.TransactSql.ScriptDom; using System; using System.IO; using System.Linq; using Xunit; using FluentAssertions; namespace Prequel.Tests { internal static class TestData { } public class ArgumentsTests { [Fact] public void NoArgumentsRaisesUsageException() { Action act = () => new Arguments(new string[] { }); act.ShouldThrow<ProgramTerminatingException>(); } [Fact] public void NoArgumentsSetsFailedExitCode() { Action act = () => new Arguments(new string[] { }); act.ShouldThrow<ProgramTerminatingException>().And.ExitCode.Should().Be(ExitReason.GeneralFailure); } [Fact] public void ArgsButNoFileRaisesUsageException() { Action act = () => new Arguments("/v:2008"); act.ShouldThrow<ProgramTerminatingException>(); } [Fact] public void ArgumentsHasUsageDescription() { Arguments.UsageDescription.Should().NotBeNullOrWhiteSpace(); } [InlineData("/help")] [InlineData("-?")] [InlineData("/?")] [Theory] public void UsageRequestUsageExceptionWithSuccessExitCode(string flag) { Action act = () => new Arguments(flag); act.ShouldThrow<ProgramTerminatingException>().And.ExitCode.Should().Be(ExitReason.Success); } [Fact] public void FileNameIsRecorded() { var a = new Arguments("foo.sql"); a.Inputs.Select(x => x.Path).Should().Equal(new string[] { "foo.sql" }); } [Fact] public void SqlVersionFlagIsRecorded() { var a = new Arguments("/v:2008", "foo.sql"); a.SqlParserType.Should().Be(typeof(TSql100Parser)); } [InlineData("/v:", "")] [InlineData("/v:x", "x")] [InlineData("/v:8.4", "8.4")] [Theory] public void InvalidVersionStringIsReported(string version, string versionToComplainAbout) { Action act = () => new Arguments("foo.sql", version); act.ShouldThrow<ProgramTerminatingException>().WithMessage($"Unknown SQL version '{versionToComplainAbout}'*"); } [Fact] public void InlineSqlReadIntoStream() { var a = new Arguments("/i:foo bar"); TextReader reader = new StreamReader(a.Inputs[0].Stream); string contents = reader.ReadToEnd(); contents.Should().Be("foo bar"); } [Fact] public void DefaultIsToDisplayLogo() { var a = new Arguments("foo.sql"); a.DisplayLogo.Should().BeTrue(); } [Fact] public void NoLogoSuppressesLogo() { var a = new Arguments("foo.sql", "/nologo"); a.DisplayLogo.Should().BeFalse(); } [Fact] public void DefaultWarningLevelIsSerious() { var a = new Arguments("foo.sql"); a.WarningLevel.Should().Be(WarningLevel.Serious); } [Fact] public void WarningLevelCanBeSet() { var a = new Arguments("foo.sql", "/warn:1"); a.WarningLevel.Should().Be((WarningLevel)1); } [InlineData("-1")] [InlineData("5")] [InlineData("")] [InlineData("foo")] [Theory] public void CrazyWarningLevelCausesError(string weirdLevel) { Action act = () => new Arguments("foo.sql", "/warn:" + weirdLevel); act.ShouldThrow<ProgramTerminatingException>().WithMessage($"Invalid Warning Level '{weirdLevel}'*"); } [Fact] public void UnknownFlagRaisesError() { Action act = () => new Arguments("foo.sql", "/z"); act.ShouldThrow<ProgramTerminatingException>().WithMessage("Unknown flag '/z'"); } } }
edyoung/prequel
Prequel.Tests/ArgumentsTests.cs
C#
mit
4,083
# Name: Seline, Li, Taylor, Son # Leap Motion project import matplotlib as mpl from mpl_toolkits.mplot3d import Axes3D import numpy as np import matplotlib.pyplot as plt import time mpl.rcParams['legend.fontsize'] = 10 fig = plt.figure() ax = Axes3D(fig) theta = np.linspace(-4 * np.pi, 4 * np.pi, 100) z = np.linspace(-2, 2, 100) r = z**2 + 1 x = r * np.sin(theta) y = r * np.cos(theta) ax.plot(x, y, z, label='parametric curve') ax.legend() plt.ion() plt.show() for ii in xrange(0,360,1): ax.view_init(elev=10, azim=ii) plt.draw() print "drawn? " + str(ii) time.sleep(0.01)
BoolLi/LeapMotionDesignChallenge
Plotting.py
Python
mit
602
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <link rel="stylesheet" href="style.css" /> <link rel="stylesheet" href="../node_modules/leaflet/dist/leaflet.css" /> <link rel="stylesheet" href="../src/L.Control.Zoomslider.css" /> </head> <body> <div id="map"></div> <script src="../node_modules/leaflet/dist/leaflet-src.js"></script> <script src="../src/L.Control.Zoomslider.js" ></script> <script> /* 1. Test that the zoomslider works even if we have no tilelayer 2. Test that it also works fine when we later add it */ var map = L.map('map', { zoomControl: false, zoomsliderControl: true, layers: [], maxZoom: undefined, minZoom: undefined }).setView([57.7, 11.9], 8); setTimeout(function(){ map.addLayer(L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors' })); }, 4000); </script> </body> </html>
martinrh83/Tarea-3_Curso-Web
Leaflet.zoomslider-master/examples/test4.html
HTML
mit
1,072
package data_struct.in_class.d11_20.interfaces; /** Class Invariant: All objects have a name string, hire date, nonnegative wage rate, and nonnegative number of hours worked. A name string of "No name" indicates no real name specified yet. A hire date of Jan 1, 1000 indicates no real hire date specified yet. */ public class HourlyEmployee extends Employee { private double wageRate; private double hours; //for the month public HourlyEmployee( ) { super( ); wageRate = 0; hours = 0; } /** Precondition: Neither theName nor theDate is null; theWageRate and theHours are nonnegative. */ public HourlyEmployee(String theName, Date theDate, double theWageRate, double theHours) { super(theName, theDate); if ((theWageRate >= 0) && (theHours >= 0)) { wageRate = theWageRate; hours = theHours; } else { System.out.println( "Fatal Error: creating an illegal hourly employee."); System.exit(0); } } public HourlyEmployee(HourlyEmployee originalObject) { super(originalObject); wageRate = originalObject.wageRate; hours = originalObject.hours; } public double getRate( ) { return wageRate; } public double getHours( ) { return hours; } /** Returns the pay for the month. */ public double getPay( ) { return wageRate*hours; } /** Precondition: hoursWorked is nonnegative. */ public void setHours(double hoursWorked) { if (hoursWorked >= 0) hours = hoursWorked; else { System.out.println("Fatal Error: Negative hours worked."); System.exit(0); } } /** Precondition: newWageRate is nonnegative. */ public void setRate(double newWageRate) { if (newWageRate >= 0) wageRate = newWageRate; else { System.out.println("Fatal Error: Negative wage rate."); System.exit(0); } } public String toString( ) { return (getName( ) + " " + getHireDate( ).toString( ) + "\n$" + wageRate + " per hour for " + hours + " hours"); } public boolean equals(HourlyEmployee other) { return (getName( ).equals(other.getName( )) && getHireDate( ).equals(other.getHireDate( )) && wageRate == other.wageRate && hours == other.hours); } }
pegurnee/2013-03-211
complete/src/data_struct/in_class/d11_20/interfaces/HourlyEmployee.java
Java
mit
2,782
import java.util.HashSet; import java.util.Set; public class Main { public static void main(String[] args) { Resolver res = new Resolver(args[0]); String[] clauses = args[1].split(";"); Set<Clause> alpha = new HashSet<Clause>(); for(String s: clauses) alpha.add(new Clause(s)); System.out.println(res.isInconsistent(alpha)); } }
firerain42/ai-lecture
Ex-5.2/src/Main.java
Java
mit
347
Boom.SecretTrigger = function( params ){ this.type = params.type || Boom.Assets.world.ENTITY.MISSING; this.position = params.position; this.interactable = params.interactable || false; this.triggered = false; Boom.Entity.call(this, {name: 'TRIGGER_SECRET', }); }; Boom.SecretTrigger.prototype = Boom.inherit(Boom.Entity, { constructor: Boom.SecretTrigger, init: function() { //Call super Boom.Entity.prototype.init.call(this); this.load(); }, load: function(){ //Call super Boom.Entity.prototype.load.call(this); }, update: function(){ console.log("updating and stuff"); //Call super Boom.Entity.prototype.update.call(this); }, dispose: function(){ //Call super Boom.Entity.prototype.dispose.call(this); }, trigger: function(){ if(!this.triggered){ this.triggered = true; this.process(); $(Boom.Constants.UI.ELEMENT.SECRET).show(200); $(Boom.Constants.UI.ELEMENT.SECRET).hide(5000); //Check if any entities are on this position - and trigger it if exists Boom.GameGrid.triggerEntity( this.triggered, this.position, { open: true } ); } }, //Registers the entity as a player-used entity process: function(){ Boom.Constants.UI.PLAYER.STATS.SECRETS++; //Call super Boom.Entity.prototype.process.call(this); }, //Adds entity to world-total in statistics register: function(){ Boom.Constants.World.STATS.SECRETS++; //Call super Boom.Entity.prototype.register.call(this); }, });
sivertsenstian/boom
source/code/boom/entity/triggers/secret_trigger.js
JavaScript
mit
1,562
import { Chart } from '../../src'; import { createDiv, removeDom } from '../util/dom'; describe('#3160', () => { const div = createDiv(); const chart = new Chart({ container: div, // 指定图表容器 ID height: 300, // 指定图表高度 autoFit: true, }); chart.coordinate('theta'); const data = [ { type: '1', item: 1, value: 0.1 }, { type: '2', item: 4, value: 0.4 }, { type: '1.3', item: 2, value: 0.2 }, { type: '2.5', item: 3, value: 0.3 }, ]; chart.data(data); chart .interval() .position('value') .color('type') .label('type', { layout: { type: 'pie-spider' } }) .adjust('stack'); chart.render(); it('mapping color to linear scale, label render normal', () => { const labels = chart.geometries[0].labelsContainer.getChildren(); expect(labels.length).toBe(4); }); it('spider label, render normal', () => { chart.clear(); chart .interval() .position('value') .color('type') .label('type', { layout: { type: 'pie-spider' } }) .adjust('stack'); chart.render(); const labels = chart.geometries[0].labelsContainer.getChildren(); const label1 = labels.find((l) => l.get('id') === `1-${data[0].type}`); const label2 = labels.find((l) => l.get('id') === `1-${data[1].type}`); const label3 = labels.find((l) => l.get('id') === `1-${data[2].type}`); const label4 = labels.find((l) => l.get('id') === `1-${data[3].type}`); // @ts-ignore expect(label1.getChildren()[0].getCanvasBBox().minX).toEqual(label2.getChildren()[0].getCanvasBBox().minX); // @ts-ignore expect(label3.getChildren()[0].getCanvasBBox().maxX).toEqual(label4.getChildren()[0].getCanvasBBox().maxX); }); afterAll(() => { chart.destroy(); removeDom(div); }); });
antvis/g2
tests/bugs/3160-spec.ts
TypeScript
mit
1,809
package cz.muni.fi.pa165.mushrooms.mvc; import javax.servlet.http.HttpServletRequest; import cz.muni.fi.pa165.mushrooms.dto.MushroomHunterDTO; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import org.springframework.web.util.UriComponentsBuilder; public class Tools { public static String redirectNonAdmin(HttpServletRequest request, UriComponentsBuilder builder, RedirectAttributes redirectAttributes) { MushroomHunterDTO user = (MushroomHunterDTO) request.getSession().getAttribute("user"); if(user == null || !user.isAdmin()){ redirectAttributes.addFlashAttribute("alert_warning", "You are not authorized!"); return "redirect:" + builder.path("/").build().toUriString(); } return null; } }
PA165-MushroomHunter/MushroomHunter
mvc/src/main/java/cz/muni/fi/pa165/mushrooms/mvc/Tools.java
Java
mit
785
/* * fingerprintJS 0.5.4 - Fast browser fingerprint library * https://github.com/Valve/fingerprintjs * Copyright (c) 2013 Valentin Vasilyev (valentin.vasilyev@outlook.com) * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ ;(function (name, context, definition) { if (typeof module !== 'undefined' && module.exports) { module.exports = definition(); } else if (typeof define === 'function' && define.amd) { define(definition); } else { context[name] = definition(); } })('Fingerprint', this, function () { 'use strict'; var Fingerprint = function (options) { var nativeForEach, nativeMap; nativeForEach = Array.prototype.forEach; nativeMap = Array.prototype.map; this.each = function (obj, iterator, context) { if (obj === null) { return; } if (nativeForEach && obj.forEach === nativeForEach) { obj.forEach(iterator, context); } else if (obj.length === +obj.length) { for (var i = 0, l = obj.length; i < l; i++) { if (iterator.call(context, obj[i], i, obj) === {}) return; } } else { for (var key in obj) { if (obj.hasOwnProperty(key)) { if (iterator.call(context, obj[key], key, obj) === {}) return; } } } }; this.map = function(obj, iterator, context) { var results = []; // Not using strict equality so that this acts as a // shortcut to checking for `null` and `undefined`. if (obj == null) return results; if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context); this.each(obj, function(value, index, list) { results[results.length] = iterator.call(context, value, index, list); }); return results; }; if (typeof options == 'object'){ this.hasher = options.hasher; this.screen_resolution = options.screen_resolution; this.screen_orientation = options.screen_orientation; this.canvas = options.canvas; this.ie_activex = options.ie_activex; } else if(typeof options == 'function'){ this.hasher = options; } }; Fingerprint.prototype = { get: function(){ var keys = []; keys.push(navigator.userAgent); keys.push(navigator.language); keys.push(screen.colorDepth); if (this.screen_resolution) { var resolution = this.getScreenResolution(); if (typeof resolution !== 'undefined'){ // headless browsers, such as phantomjs keys.push(resolution.join('x')); } } keys.push(new Date().getTimezoneOffset()); keys.push(this.hasSessionStorage()); keys.push(this.hasLocalStorage()); keys.push(!!window.indexedDB); //body might not be defined at this point or removed programmatically if(document.body){ keys.push(typeof(document.body.addBehavior)); } else { keys.push(typeof undefined); } keys.push(typeof(window.openDatabase)); keys.push(navigator.cpuClass); keys.push(navigator.platform); keys.push(navigator.doNotTrack); keys.push(this.getPluginsString()); if(this.canvas && this.isCanvasSupported()){ keys.push(this.getCanvasFingerprint()); } if(this.hasher){ return this.hasher(keys.join('###'), 31); } else { return this.murmurhash3_32_gc(keys.join('###'), 31); } }, /** * JS Implementation of MurmurHash3 (r136) (as of May 20, 2011) * * @author <a href="mailto:gary.court@gmail.com">Gary Court</a> * @see http://github.com/garycourt/murmurhash-js * @author <a href="mailto:aappleby@gmail.com">Austin Appleby</a> * @see http://sites.google.com/site/murmurhash/ * * @param {string} key ASCII only * @param {number} seed Positive integer only * @return {number} 32-bit positive integer hash */ murmurhash3_32_gc: function(key, seed) { var remainder, bytes, h1, h1b, c1, c2, k1, i; remainder = key.length & 3; // key.length % 4 bytes = key.length - remainder; h1 = seed; c1 = 0xcc9e2d51; c2 = 0x1b873593; i = 0; while (i < bytes) { k1 = ((key.charCodeAt(i) & 0xff)) | ((key.charCodeAt(++i) & 0xff) << 8) | ((key.charCodeAt(++i) & 0xff) << 16) | ((key.charCodeAt(++i) & 0xff) << 24); ++i; k1 = ((((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16))) & 0xffffffff; k1 = (k1 << 15) | (k1 >>> 17); k1 = ((((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16))) & 0xffffffff; h1 ^= k1; h1 = (h1 << 13) | (h1 >>> 19); h1b = ((((h1 & 0xffff) * 5) + ((((h1 >>> 16) * 5) & 0xffff) << 16))) & 0xffffffff; h1 = (((h1b & 0xffff) + 0x6b64) + ((((h1b >>> 16) + 0xe654) & 0xffff) << 16)); } k1 = 0; switch (remainder) { case 3: k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16; case 2: k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8; case 1: k1 ^= (key.charCodeAt(i) & 0xff); k1 = (((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16)) & 0xffffffff; k1 = (k1 << 15) | (k1 >>> 17); k1 = (((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16)) & 0xffffffff; h1 ^= k1; } h1 ^= key.length; h1 ^= h1 >>> 16; h1 = (((h1 & 0xffff) * 0x85ebca6b) + ((((h1 >>> 16) * 0x85ebca6b) & 0xffff) << 16)) & 0xffffffff; h1 ^= h1 >>> 13; h1 = ((((h1 & 0xffff) * 0xc2b2ae35) + ((((h1 >>> 16) * 0xc2b2ae35) & 0xffff) << 16))) & 0xffffffff; h1 ^= h1 >>> 16; return h1 >>> 0; }, // https://bugzilla.mozilla.org/show_bug.cgi?id=781447 hasLocalStorage: function () { try{ return !!window.localStorage; } catch(e) { return true; // SecurityError when referencing it means it exists } }, hasSessionStorage: function () { try{ return !!window.sessionStorage; } catch(e) { return true; // SecurityError when referencing it means it exists } }, isCanvasSupported: function () { var elem = document.createElement('canvas'); return !!(elem.getContext && elem.getContext('2d')); }, isIE: function () { if(navigator.appName === 'Microsoft Internet Explorer') { return true; } else if(navigator.appName === 'Netscape' && /Trident/.test(navigator.userAgent)){// IE 11 return true; } return false; }, getPluginsString: function () { if(this.isIE() && this.ie_activex){ return this.getIEPluginsString(); } else { return this.getRegularPluginsString(); } }, getRegularPluginsString: function () { return this.map(navigator.plugins, function (p) { var mimeTypes = this.map(p, function(mt){ return [mt.type, mt.suffixes].join('~'); }).join(','); return [p.name, p.description, mimeTypes].join('::'); }, this).join(';'); }, getIEPluginsString: function () { if(window.ActiveXObject){ var names = ['ShockwaveFlash.ShockwaveFlash',//flash plugin 'AcroPDF.PDF', // Adobe PDF reader 7+ 'PDF.PdfCtrl', // Adobe PDF reader 6 and earlier, brrr 'QuickTime.QuickTime', // QuickTime // 5 versions of real players 'rmocx.RealPlayer G2 Control', 'rmocx.RealPlayer G2 Control.1', 'RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)', 'RealVideo.RealVideo(tm) ActiveX Control (32-bit)', 'RealPlayer', 'SWCtl.SWCtl', // ShockWave player 'WMPlayer.OCX', // Windows media player 'AgControl.AgControl', // Silverlight 'Skype.Detection']; // starting to detect plugins in IE return this.map(names, function(name){ try{ new ActiveXObject(name); return name; } catch(e){ return null; } }).join(';'); } else { return ""; // behavior prior version 0.5.0, not breaking backwards compat. } }, getScreenResolution: function () { var resolution; if(this.screen_orientation){ resolution = (screen.height > screen.width) ? [screen.height, screen.width] : [screen.width, screen.height]; }else{ resolution = [screen.height, screen.width]; } return resolution; }, getCanvasFingerprint: function () { var canvas = document.createElement('canvas'); var ctx = canvas.getContext('2d'); // https://www.browserleaks.com/canvas#how-does-it-work var txt = 'http://valve.github.io'; ctx.textBaseline = "top"; ctx.font = "14px 'Arial'"; ctx.textBaseline = "alphabetic"; ctx.fillStyle = "#f60"; ctx.fillRect(125,1,62,20); ctx.fillStyle = "#069"; ctx.fillText(txt, 2, 15); ctx.fillStyle = "rgba(102, 204, 0, 0.7)"; ctx.fillText(txt, 4, 17); return canvas.toDataURL(); } }; return Fingerprint; });
kanagawa41/chat-api
chat-html/assets/js/fingerprint/fingerprint.js
JavaScript
mit
9,884
require "rails_helper" RSpec.describe Review, type: :model do it "has a valid factory" do expect(build(:review)).to be_valid end describe "validations" do it { should validate_presence_of :rating } it { should validate_numericality_of(:rating).is_greater_than_or_equal_to(1).is_less_than_or_equal_to(5) } it { should validate_length_of(:comment).is_at_most(100) } end describe "associations" do it { should belong_to :user } it { should belong_to :recipe } end end
Haradd/Looks-Tasty
spec/models/review_spec.rb
Ruby
mit
503
import React from 'react'; import { expect } from 'chai'; import { shallow } from 'enzyme'; import H1, { styles } from './index'; describe('<H1 />', () => { it('should correctly render children, when text', () => { const wrapper = shallow(<H1>Title</H1>); expect(wrapper.text()).to.equal('Title'); }); it('should append a className to the default, if provided', () => { const wrapper = shallow(<H1 className="test-class">Title H1</H1>); expect(wrapper.prop('className')).to.equal(`test-class ${styles.h1}`); }); it('should use the default className from the stylesheet, if not provided', () => { const wrapper = shallow(<H1>Title H1</H1>); expect(wrapper.prop('className')).to.equal(styles.h1); }); });
movio/movio-react-components
src/components/H1/h1.spec.js
JavaScript
mit
743
<?php namespace Proxies; /** * THIS CLASS WAS GENERATED BY THE DOCTRINE ORM. DO NOT EDIT THIS FILE. */ class Taller2012BaseBundleEntityCursaProxy extends \Taller2012\BaseBundle\Entity\Cursa implements \Doctrine\ORM\Proxy\Proxy { private $_entityPersister; private $_identifier; public $__isInitialized__ = false; public function __construct($entityPersister, $identifier) { $this->_entityPersister = $entityPersister; $this->_identifier = $identifier; } /** @private */ public function __load() { if (!$this->__isInitialized__ && $this->_entityPersister) { $this->__isInitialized__ = true; if (method_exists($this, "__wakeup")) { // call this after __isInitialized__to avoid infinite recursion // but before loading to emulate what ClassMetadata::newInstance() // provides. $this->__wakeup(); } if ($this->_entityPersister->load($this->_identifier, $this) === null) { throw new \Doctrine\ORM\EntityNotFoundException(); } unset($this->_entityPersister, $this->_identifier); } } public function setNotafinal($notafinal) { $this->__load(); return parent::setNotafinal($notafinal); } public function getNotafinal() { $this->__load(); return parent::getNotafinal(); } public function setRegularidad($regularidad) { $this->__load(); return parent::setRegularidad($regularidad); } public function getRegularidad() { $this->__load(); return parent::getRegularidad(); } public function getId() { $this->__load(); return parent::getId(); } public function setIdinstancia(\Taller2012\BaseBundle\Entity\Instancia $idinstancia) { $this->__load(); return parent::setIdinstancia($idinstancia); } public function getIdinstancia() { $this->__load(); return parent::getIdinstancia(); } public function setIdpersona(\Taller2012\BaseBundle\Entity\Persona $idpersona) { $this->__load(); return parent::setIdpersona($idpersona); } public function getIdpersona() { $this->__load(); return parent::getIdpersona(); } public function __sleep() { return array('__isInitialized__', 'notafinal', 'regularidad', 'id', 'idinstancia', 'idpersona'); } public function __clone() { if (!$this->__isInitialized__ && $this->_entityPersister) { $this->__isInitialized__ = true; $class = $this->_entityPersister->getClassMetadata(); $original = $this->_entityPersister->load($this->_identifier); if ($original === null) { throw new \Doctrine\ORM\EntityNotFoundException(); } foreach ($class->reflFields AS $field => $reflProperty) { $reflProperty->setValue($this, $reflProperty->getValue($original)); } unset($this->_entityPersister, $this->_identifier); } } }
kiuli19/GitTaller
app/cache/prod/doctrine/orm/Proxies/Taller2012BaseBundleEntityCursaProxy.php
PHP
mit
3,209
require "rails_helper" RSpec.describe "Admin shipments API", type: :request do before do prepare_api_website end describe "POST create" do let(:order) { FactoryBot.create(:order) } let(:courier) { FactoryBot.create(:courier) } let(:order_id) { order.id } # Attributes let(:courier_id) { courier.id } let(:number_of_parcels) { 2 } let(:picked_by) { "Jo Picker" } let(:shipped_at) { Time.zone.now } let(:total_weight) { 1 } let(:consignment_number) { "123" } let(:tracking_url) { "http://trackyourorder.url/123" } before do post "/api/admin/shipments", params: { shipment: { consignment_number: consignment_number, courier_id: courier_id, order_id: order_id, partial: [true, false].sample, picked_by: picked_by, total_weight: total_weight, tracking_url: tracking_url } } end context "with invalid order" do let(:order_id) { order.id + 1 } it "responds 422" do expect(response.status).to eq 422 end it "includes an error message in JSON" do expect(JSON.parse(response.body)).to eq ["Order does not exist."] end end context "with valid attributes" do let(:shipment) { order.reload.shipments.first } it "creates a shipment with supplied attributes" do expect(shipment).to be expect(shipment.consignment_number).to eq consignment_number expect(shipment.courier_id).to eq courier_id expect(shipment.order_id).to eq order_id expect(shipment.picked_by).to eq picked_by expect(shipment.tracking_url).to eq tracking_url end it "responds 200" do expect(response.status).to eq 200 end context "JSON response" do subject { JSON.parse(response.body) } it "includes the id and href of the newly created resource" do expect(subject["shipment"]["id"]).to eq shipment.id expect(subject["shipment"]["href"]).to eq api_admin_shipment_url(shipment) end end end end end
ianfleeton/zmey
spec/requests/api/admin/shipments_spec.rb
Ruby
mit
2,126
'use strict'; var elements = require('../elements'); /** * Show the element (remove the class .hidden) * * @name Element#show * @method * */ /** * Show the elements (remove the class .hidden) * * @name ElementsArray#show * @method */ elements.addMethodWithoutArgumentsReturnThis('show'); /** * Hide the element (add the class .hidden) * * @name Element#hide * @method * */ /** * Hide the elements (add the class .hidden) * * @name ElementsArray#hide * @method */ elements.addMethodWithoutArgumentsReturnThis('hide'); /** * Toggle an element's visibility using the hidden class * * @name Element#toggle * @method * */ /** * Toggle an element's visibility using the hidden class * * @name ElementsArray#toggle * @method */ elements.addMethodWithoutArgumentsReturnThis('toggle'); /** * Return if an element's visibility * * @name Element#isVisible * @method * */ /** * Return a map of element's visibility * * @name ElementsArray#isVisible * @method */ elements.addMethodWithoutArgumentsReturnResult('isVisible'); //# sourceMappingURL=visibility.js.map
christophehurpeau/springbokjs-dom
lib/prototypes/visibility.js
JavaScript
mit
1,102
module FlipTheSwitch module Generator class Base def initialize(output, features) @output = output @features = features end protected attr_reader :output, :features def all_features features.flat_map { |feature| feature_and_sub_features(feature) } end private def feature_and_sub_features(feature) [feature] + feature.sub_features.flat_map { |sub_feature| feature_and_sub_features(sub_feature) } end end end end
michaelengland/FlipTheSwitch
lib/flip_the_switch/generator/base.rb
Ruby
mit
549
// Copyright StrongLoop 2014 Arc.controller('ArcMainController', [ '$scope', 'ArcUserService', '$log', '$rootScope', 'LandingService', function($scope, ArcUserService, $log, $rootScope, LandingService){ $scope.suiteIA = { apps: [] }; //set help id for app modules $scope.$watch('suiteIA.appId', function(newVal){ if ( !newVal ) return; $rootScope.helpId = newVal; }); $scope.isAuthUser = function(){ return ArcUserService.isAuthUser(); }; $scope.pageClick = function($event){ $rootScope.$broadcast('pageClick', $event); }; $scope.supportAppController = false; LandingService.getApps().$promise .then(function(response) { var buildApp = response.results.filter(function(d) { return d.id === 'build-deploy'; }); if (buildApp.length) { $scope.supportAppController = buildApp[0].supportsCurrentProject; } }); }]); Arc.controller('HomeMainController',[ '$scope', '$location', function($scope, $location){ var viewModel = {}; viewModel.message = 'StrongLoop Arc'; $scope.viewModel = viewModel; } ]); /* * * */ Arc.controller('GlobalNavController',[ '$scope', 'ArcUserService', '$location', function($scope, ArcUserService, $location) { $scope.isAuthUser = function(){ return ArcUserService.getCurrentUserId(); }; } ]);
tsiry95/openshift-strongloop-cartridge
strongloop/node_modules/strong-arc/client/www/scripts/modules/arc/arc.controllers.js
JavaScript
mit
1,418
<!DOCTYPE html> <!--[if lt IE 9]><html class="no-js lt-ie9" lang="en" dir="ltr"><![endif]--> <!--[if gt IE 8]><!--> <html class="no-js" lang="en" dir="ltr"> <!--<![endif]--> <!-- Usage: /eic/site/ccc-rec.nsf/tpl-eng/template-1col.html?Open&id=3 (optional: ?Open&page=filename.html&id=x) --> <!-- Created: ; Product Code: 536; Server: stratnotes2.ic.gc.ca --> <head> <!-- Title begins / Début du titre --> <title> Pakmark Ltd. - Complete profile - Canadian Company Capabilities - Industries and Business - Industry Canada </title> <!-- Title ends / Fin du titre --> <!-- Meta-data begins / Début des métadonnées --> <meta charset="utf-8" /> <meta name="dcterms.language" title="ISO639-2" content="eng" /> <meta name="dcterms.title" content="" /> <meta name="description" content="" /> <meta name="dcterms.description" content="" /> <meta name="dcterms.type" content="report, data set" /> <meta name="dcterms.subject" content="businesses, industry" /> <meta name="dcterms.subject" content="businesses, industry" /> <meta name="dcterms.issued" title="W3CDTF" content="" /> <meta name="dcterms.modified" title="W3CDTF" content="" /> <meta name="keywords" content="" /> <meta name="dcterms.creator" content="" /> <meta name="author" content="" /> <meta name="dcterms.created" title="W3CDTF" content="" /> <meta name="dcterms.publisher" content="" /> <meta name="dcterms.audience" title="icaudience" content="" /> <meta name="dcterms.spatial" title="ISO3166-1" content="" /> <meta name="dcterms.spatial" title="gcgeonames" content="" /> <meta name="dcterms.format" content="HTML" /> <meta name="dcterms.identifier" title="ICsiteProduct" content="536" /> <!-- EPI-11240 --> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- MCG-202 --> <meta content="width=device-width,initial-scale=1" name="viewport"> <!-- EPI-11567 --> <meta name = "format-detection" content = "telephone=no"> <!-- EPI-12603 --> <meta name="robots" content="noarchive"> <!-- EPI-11190 - Webtrends --> <script> var startTime = new Date(); startTime = startTime.getTime(); </script> <!--[if gte IE 9 | !IE ]><!--> <link href="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/assets/favicon.ico" rel="icon" type="image/x-icon"> <link rel="stylesheet" href="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/css/wet-boew.min.css"> <!--<![endif]--> <link rel="stylesheet" href="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/css/theme.min.css"> <!--[if lt IE 9]> <link href="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/assets/favicon.ico" rel="shortcut icon" /> <link rel="stylesheet" href="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/css/ie8-wet-boew.min.css" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/js/ie8-wet-boew.min.js"></script> <![endif]--> <!--[if lte IE 9]> <![endif]--> <noscript><link rel="stylesheet" href="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/css/noscript.min.css" /></noscript> <!-- Google Tag Manager DO NOT REMOVE OR MODIFY - NE PAS SUPPRIMER OU MODIFIER --> <script>dataLayer1 = [];</script> <!-- End Google Tag Manager --> <!-- EPI-11235 --> <link rel="stylesheet" href="/eic/home.nsf/css/add_WET_4-0_Canada_Apps.css"> <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> <link href="/app/ccc/srch/css/print.css" media="print" rel="stylesheet" type="text/css" /> </head> <body class="home" vocab="http://schema.org/" typeof="WebPage"> <!-- EPIC HEADER BEGIN --> <!-- Google Tag Manager DO NOT REMOVE OR MODIFY - NE PAS SUPPRIMER OU MODIFIER --> <noscript><iframe title="Google Tag Manager" src="//www.googletagmanager.com/ns.html?id=GTM-TLGQ9K" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer1'?'&l='+l:'';j.async=true;j.src='//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer1','GTM-TLGQ9K');</script> <!-- End Google Tag Manager --> <!-- EPI-12801 --> <span typeof="Organization"><meta property="legalName" content="Department_of_Industry"></span> <ul id="wb-tphp"> <li class="wb-slc"> <a class="wb-sl" href="#wb-cont">Skip to main content</a> </li> <li class="wb-slc visible-sm visible-md visible-lg"> <a class="wb-sl" href="#wb-info">Skip to "About this site"</a> </li> </ul> <header role="banner"> <div id="wb-bnr" class="container"> <section id="wb-lng" class="visible-md visible-lg text-right"> <h2 class="wb-inv">Language selection</h2> <div class="row"> <div class="col-md-12"> <ul class="list-inline mrgn-bttm-0"> <li><a href="nvgt.do?V_TOKEN=1492234264980&V_SEARCH.docsCount=3&V_DOCUMENT.docRank=34483&V_SEARCH.docsStart=34482&V_SEARCH.command=navigate&V_SEARCH.resultsJSP=/prfl.do&lang=fra&redirectUrl=/app/scr/imbs/ccc/rgstrtn/?_flId?_flxKy=e1s1&amp;estblmntNo=234567041301&amp;profileId=61&amp;_evId=bck&amp;lang=eng&amp;V_SEARCH.showStricts=false&amp;prtl=1&amp;_flId?_flId?_flxKy=e1s1" title="Français" lang="fr">Français</a></li> </ul> </div> </div> </section> <div class="row"> <div class="brand col-xs-8 col-sm-9 col-md-6"> <a href="http://www.canada.ca/en/index.html"><object type="image/svg+xml" tabindex="-1" data="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/assets/sig-blk-en.svg"></object><span class="wb-inv"> Government of Canada</span></a> </div> <section class="wb-mb-links col-xs-4 col-sm-3 visible-sm visible-xs" id="wb-glb-mn"> <h2>Search and menus</h2> <ul class="list-inline text-right chvrn"> <li><a href="#mb-pnl" title="Search and menus" aria-controls="mb-pnl" class="overlay-lnk" role="button"><span class="glyphicon glyphicon-search"><span class="glyphicon glyphicon-th-list"><span class="wb-inv">Search and menus</span></span></span></a></li> </ul> <div id="mb-pnl"></div> </section> <!-- Site Search Removed --> </div> </div> <nav role="navigation" id="wb-sm" class="wb-menu visible-md visible-lg" data-trgt="mb-pnl" data-ajax-fetch="//cdn.canada.ca/gcweb-cdn-dev/sitemenu/sitemenu-en.html" typeof="SiteNavigationElement"> <h2 class="wb-inv">Topics menu</h2> <div class="container nvbar"> <div class="row"> <ul class="list-inline menu"> <li><a href="https://www.canada.ca/en/services/jobs.html">Jobs</a></li> <li><a href="http://www.cic.gc.ca/english/index.asp">Immigration</a></li> <li><a href="https://travel.gc.ca/">Travel</a></li> <li><a href="https://www.canada.ca/en/services/business.html">Business</a></li> <li><a href="https://www.canada.ca/en/services/benefits.html">Benefits</a></li> <li><a href="http://healthycanadians.gc.ca/index-eng.php">Health</a></li> <li><a href="https://www.canada.ca/en/services/taxes.html">Taxes</a></li> <li><a href="https://www.canada.ca/en/services.html">More services</a></li> </ul> </div> </div> </nav> <!-- EPIC BODY BEGIN --> <nav role="navigation" id="wb-bc" class="" property="breadcrumb"> <h2 class="wb-inv">You are here:</h2> <div class="container"> <div class="row"> <ol class="breadcrumb"> <li><a href="/eic/site/icgc.nsf/eng/home" title="Home">Home</a></li> <li><a href="/eic/site/icgc.nsf/eng/h_07063.html" title="Industries and Business">Industries and Business</a></li> <li><a href="/eic/site/ccc-rec.nsf/tpl-eng/../eng/home" >Canadian Company Capabilities</a></li> </ol> </div> </div> </nav> </header> <main id="wb-cont" role="main" property="mainContentOfPage" class="container"> <!-- End Header --> <!-- Begin Body --> <!-- Begin Body Title --> <!-- End Body Title --> <!-- Begin Body Head --> <!-- End Body Head --> <!-- Begin Body Content --> <br> <!-- Complete Profile --> <!-- Company Information above tabbed area--> <input id="showMore" type="hidden" value='more'/> <input id="showLess" type="hidden" value='less'/> <h1 id="wb-cont"> Company profile - Canadian Company Capabilities </h1> <div class="profileInfo hidden-print"> <ul class="list-inline"> <li><a href="cccSrch.do?lang=eng&profileId=&prtl=1&key.hitsPerPage=25&searchPage=%252Fapp%252Fccc%252Fsrch%252FcccBscSrch.do%253Flang%253Deng%2526amp%253Bprtl%253D1%2526amp%253Btagid%253D&V_SEARCH.scopeCategory=CCC.Root&V_SEARCH.depth=1&V_SEARCH.showStricts=false&V_SEARCH.sortSpec=title+asc&amp;rstBtn.x=" class="btn btn-link">New Search</a>&nbsp;|</li> <li><form name="searchForm" method="post" action="/app/ccc/srch/bscSrch.do"> <input type="hidden" name="lang" value="eng" /> <input type="hidden" name="profileId" value="" /> <input type="hidden" name="prtl" value="1" /> <input type="hidden" name="searchPage" value="%2Fapp%2Fccc%2Fsrch%2FcccBscSrch.do%3Flang%3Deng%26amp%3Bprtl%3D1%26amp%3Btagid%3D" /> <input type="hidden" name="V_SEARCH.scopeCategory" value="CCC.Root" /> <input type="hidden" name="V_SEARCH.depth" value="1" /> <input type="hidden" name="V_SEARCH.showStricts" value="false" /> <input id="repeatSearchBtn" class="btn btn-link" type="submit" value="Return to search results" /> </form></li> <li>|&nbsp;<a href="nvgt.do?V_SEARCH.docsStart=34481&amp;V_DOCUMENT.docRank=34482&amp;V_SEARCH.docsCount=3&amp;lang=eng&amp;prtl=1&amp;sbPrtl=&amp;profile=cmpltPrfl&amp;V_TOKEN=1492234270063&amp;V_SEARCH.command=navigate&amp;V_SEARCH.resultsJSP=%2fprfl.do&amp;estblmntNo=234567163773&amp;profileId=&amp;key.newSearchLabel=">Previous Company</a></li> <li>|&nbsp;<a href="nvgt.do?V_SEARCH.docsStart=34483&amp;V_DOCUMENT.docRank=34484&amp;V_SEARCH.docsCount=3&amp;lang=eng&amp;prtl=1&amp;sbPrtl=&amp;profile=cmpltPrfl&amp;V_TOKEN=1492234270063&amp;V_SEARCH.command=navigate&amp;V_SEARCH.resultsJSP=%2fprfl.do&amp;estblmntNo=234567164988&amp;profileId=&amp;key.newSearchLabel=">Next Company</a></li> </ul> </div> <details> <summary>Third-Party Information Liability Disclaimer</summary> <p>Some of the information on this Web page has been provided by external sources. The Government of Canada is not responsible for the accuracy, reliability or currency of the information supplied by external sources. Users wishing to rely upon this information should consult directly with the source of the information. Content provided by external sources is not subject to official languages, privacy and accessibility requirements.</p> </details> <h2> Pakmark Ltd. </h2> <div class="row"> <div class="col-md-5"> <h2 class="h5 mrgn-bttm-0">Legal/Operating Name:</h2> <p>Pakmark Ltd.</p> <div class="mrgn-tp-md"></div> <p class="mrgn-bttm-0" ><a href="http://www.pakmarkltd.com" target="_blank" title="Website URL">http://www.pakmarkltd.com</a></p> <p><a href="mailto:info@pakmarkltd.com" title="info@pakmarkltd.com">info@pakmarkltd.com</a></p> </div> <div class="col-md-4 mrgn-sm-sm"> <h2 class="h5 mrgn-bttm-0">Mailing Address:</h2> <address class="mrgn-bttm-md"> 8-199 Omands Creek Blvd.<br/> WINNIPEG, Manitoba<br/> R2R 1V9 <br/> </address> <h2 class="h5 mrgn-bttm-0">Location Address:</h2> <address class="mrgn-bttm-md"> 8-199 Omands Creek Blvd.<br/> WINNIPEG, Manitoba<br/> R2R 1V9 <br/> </address> <p class="mrgn-bttm-0"><abbr title="Telephone">Tel.</abbr>: (204) 632-0575 </p> <p class="mrgn-bttm-0"><abbr title="Telephone">Tel.</abbr>: (800) 779-6886</p> <p class="mrgn-bttm-lg"><abbr title="Facsimile">Fax</abbr>: (204) 694-5007</p> </div> <div class="col-md-3 mrgn-tp-md"> </div> </div> <div class="row mrgn-tp-md mrgn-bttm-md"> <div class="col-md-12"> </div> </div> <!-- <div class="wb-tabs ignore-session update-hash wb-eqht-off print-active"> --> <div class="wb-tabs ignore-session"> <div class="tabpanels"> <details id="details-panel1"> <summary> Full profile </summary> <!-- Tab 1 --> <h2 class="wb-invisible"> Full profile </h2> <!-- Contact Information --> <h3 class="page-header"> Contact information </h3> <section class="container-fluid"> <div class="row mrgn-tp-lg"> <div class="col-md-3"> <strong> Wilf Hiscox </strong></div> </div> <div class="row mrgn-lft-md"> <div class="col-md-5"> <strong> Title: </strong> </div> <div class="col-md-7"> <!--if client gender is not null or empty we use gender based job title--> Chief Executive Officer </div> </div> <div class="row mrgn-lft-md"> <div class="col-md-5"> <strong> Area of Responsibility: </strong> </div> <div class="col-md-7"> Management Executive. </div> </div> <div class="row mrgn-lft-md"> <div class="col-md-5"> <strong> Telephone: </strong> </div> <div class="col-md-7"> (204) 632-0575 </div> </div> <div class="row mrgn-lft-md"> <div class="col-md-5"> <strong> Facsimile: </strong> </div> <div class="col-md-7"> (204) 694-5007 </div> </div> <div class="row mrgn-tp-lg"> <div class="col-md-3"> <strong> Rob Baker </strong></div> </div> <div class="row mrgn-lft-md"> <div class="col-md-5"> <strong> Title: </strong> </div> <div class="col-md-7"> Vice President <br> </div> </div> <div class="row mrgn-lft-md"> <div class="col-md-5"> <strong> Telephone: </strong> </div> <div class="col-md-7"> (204) 632-0575 </div> </div> <div class="row mrgn-lft-md"> <div class="col-md-5"> <strong> Facsimile: </strong> </div> <div class="col-md-7"> (204) 694-5007 </div> </div> </section> <p class="mrgn-tp-lg text-right small hidden-print"> <a href="#wb-cont">top of page</a> </p> <!-- Company Description --> <h3 class="page-header"> Company description </h3> <section class="container-fluid"> <div class="row"> <div class="col-md-5"> <strong> Country of Ownership: </strong> </div> <div class="col-md-7"> Canada &nbsp; </div> </div> <div class="row"> <div class="col-md-5"> <strong> Year Established: </strong> </div> <div class="col-md-7"> 1982 </div> </div> <div class="row"> <div class="col-md-5"> <strong> Exporting: </strong> </div> <div class="col-md-7"> Yes &nbsp; </div> </div> <div class="row"> <div class="col-md-5"> <strong> Primary Industry (NAICS): </strong> </div> <div class="col-md-7"> 418220 - Other Paper and Disposable Plastic Product Wholesaler-Distributors </div> </div> <div class="row"> <div class="col-md-5"> <strong> Primary Business Activity: </strong> </div> <div class="col-md-7"> Trading House / Wholesaler / Agent and Distributor &nbsp; </div> </div> <div class="row"> <div class="col-md-5"> <strong> Total Sales ($CDN): </strong> </div> <div class="col-md-7"> $500,000 to $999,999&nbsp; </div> </div> <div class="row"> <div class="col-md-5"> <strong> Number of Employees: </strong> </div> <div class="col-md-7"> 17&nbsp; </div> </div> </section> <!-- Products / Services / Licensing --> <h3 class="page-header"> Product / Service / Licensing </h3> <section class="container-fluid"> <div class="row mrgn-bttm-md"> <div class="col-md-3"> <strong> Product Name: </strong> </div> <div class="col-md-9"> TAPE, PLASTIC LABELS PVD/POLYMER <br> </div> </div> </section> <p class="mrgn-tp-lg text-right small hidden-print"> <a href="#wb-cont">top of page</a> </p> <!-- Technology Profile --> <!-- Market Profile --> <h3 class="page-header"> Market profile </h3> <section class="container-fluid"> <h4> Geographic markets: </h4> <h5> Export experience: </h5> <ul> <li>United States</li> <li>North Dakota</li> </ul> <h5> Actively pursuing: </h5> <ul> <li>Illinois</li> <li>Michigan</li> <li>Minnesota</li> <li>Nebraska</li> <li>New York</li> <li>South Dakota</li> <li>Wisconsin</li> </ul> </section> <p class="mrgn-tp-lg text-right small hidden-print"> <a href="#wb-cont">top of page</a> </p> <!-- Sector Information --> <details class="mrgn-tp-md mrgn-bttm-md"> <summary> Third-Party Information Liability Disclaimer </summary> <p> Some of the information on this Web page has been provided by external sources. The Government of Canada is not responsible for the accuracy, reliability or currency of the information supplied by external sources. Users wishing to rely upon this information should consult directly with the source of the information. Content provided by external sources is not subject to official languages, privacy and accessibility requirements. </p> </details> </details> <details id="details-panel2"> <summary> Contacts </summary> <h2 class="wb-invisible"> Contact information </h2> <!-- Contact Information --> <section class="container-fluid"> <div class="row mrgn-tp-lg"> <div class="col-md-3"> <strong> Wilf Hiscox </strong></div> </div> <div class="row mrgn-lft-md"> <div class="col-md-5"> <strong> Title: </strong> </div> <div class="col-md-7"> <!--if client gender is not null or empty we use gender based job title--> Chief Executive Officer </div> </div> <div class="row mrgn-lft-md"> <div class="col-md-5"> <strong> Area of Responsibility: </strong> </div> <div class="col-md-7"> Management Executive. </div> </div> <div class="row mrgn-lft-md"> <div class="col-md-5"> <strong> Telephone: </strong> </div> <div class="col-md-7"> (204) 632-0575 </div> </div> <div class="row mrgn-lft-md"> <div class="col-md-5"> <strong> Facsimile: </strong> </div> <div class="col-md-7"> (204) 694-5007 </div> </div> <div class="row mrgn-tp-lg"> <div class="col-md-3"> <strong> Rob Baker </strong></div> </div> <div class="row mrgn-lft-md"> <div class="col-md-5"> <strong> Title: </strong> </div> <div class="col-md-7"> Vice President <br> </div> </div> <div class="row mrgn-lft-md"> <div class="col-md-5"> <strong> Telephone: </strong> </div> <div class="col-md-7"> (204) 632-0575 </div> </div> <div class="row mrgn-lft-md"> <div class="col-md-5"> <strong> Facsimile: </strong> </div> <div class="col-md-7"> (204) 694-5007 </div> </div> </section> </details> <details id="details-panel3"> <summary> Description </summary> <h2 class="wb-invisible"> Company description </h2> <section class="container-fluid"> <div class="row"> <div class="col-md-5"> <strong> Country of Ownership: </strong> </div> <div class="col-md-7"> Canada &nbsp; </div> </div> <div class="row"> <div class="col-md-5"> <strong> Year Established: </strong> </div> <div class="col-md-7"> 1982 </div> </div> <div class="row"> <div class="col-md-5"> <strong> Exporting: </strong> </div> <div class="col-md-7"> Yes &nbsp; </div> </div> <div class="row"> <div class="col-md-5"> <strong> Primary Industry (NAICS): </strong> </div> <div class="col-md-7"> 418220 - Other Paper and Disposable Plastic Product Wholesaler-Distributors </div> </div> <div class="row"> <div class="col-md-5"> <strong> Primary Business Activity: </strong> </div> <div class="col-md-7"> Trading House / Wholesaler / Agent and Distributor &nbsp; </div> </div> <div class="row"> <div class="col-md-5"> <strong> Total Sales ($CDN): </strong> </div> <div class="col-md-7"> $500,000 to $999,999&nbsp; </div> </div> <div class="row"> <div class="col-md-5"> <strong> Number of Employees: </strong> </div> <div class="col-md-7"> 17&nbsp; </div> </div> </section> </details> <details id="details-panel4"> <summary> Products, services and licensing </summary> <h2 class="wb-invisible"> Product / Service / Licensing </h2> <section class="container-fluid"> <div class="row mrgn-bttm-md"> <div class="col-md-3"> <strong> Product Name: </strong> </div> <div class="col-md-9"> TAPE, PLASTIC LABELS PVD/POLYMER <br> </div> </div> </section> </details> <details id="details-panel6"> <summary> Market </summary> <h2 class="wb-invisible"> Market profile </h2> <section class="container-fluid"> <h4> Geographic markets: </h4> <h5> Export experience: </h5> <ul> <li>United States</li> <li>North Dakota</li> </ul> <h5> Actively pursuing: </h5> <ul> <li>Illinois</li> <li>Michigan</li> <li>Minnesota</li> <li>Nebraska</li> <li>New York</li> <li>South Dakota</li> <li>Wisconsin</li> </ul> </section> </details> </div> </div> <div class="row"> <div class="col-md-12 text-right"> Last Update Date 2015-04-02 </div> </div> <!-- - Artifact ID: CBW - IMBS - CCC Search WAR - Group ID: ca.gc.ic.strategis.imbs.ccc.search - Version: 3.26 - Built-By: bamboo - Build Timestamp: 2017-03-02T21:29:28Z --> <!-- End Body Content --> <!-- Begin Body Foot --> <!-- End Body Foot --> <!-- END MAIN TABLE --> <!-- End body --> <!-- Begin footer --> <div class="row pagedetails"> <div class="col-sm-5 col-xs-12 datemod"> <dl id="wb-dtmd"> <dt class=" hidden-print">Date Modified:</dt> <dd class=" hidden-print"> <span><time>2017-03-02</time></span> </dd> </dl> </div> <div class="clear visible-xs"></div> <div class="col-sm-4 col-xs-6"> </div> <div class="col-sm-3 col-xs-6 text-right"> </div> <div class="clear visible-xs"></div> </div> </main> <footer role="contentinfo" id="wb-info"> <nav role="navigation" class="container wb-navcurr"> <h2 class="wb-inv">About government</h2> <!-- EPIC FOOTER BEGIN --> <!-- EPI-11638 Contact us --> <ul class="list-unstyled colcount-sm-2 colcount-md-3"> <li><a href="http://www.ic.gc.ca/eic/site/icgc.nsf/eng/h_07026.html#pageid=E048-H00000&amp;from=Industries">Contact us</a></li> <li><a href="https://www.canada.ca/en/government/dept.html">Departments and agencies</a></li> <li><a href="https://www.canada.ca/en/government/publicservice.html">Public service and military</a></li> <li><a href="https://www.canada.ca/en/news.html">News</a></li> <li><a href="https://www.canada.ca/en/government/system/laws.html">Treaties, laws and regulations</a></li> <li><a href="https://www.canada.ca/en/transparency/reporting.html">Government-wide reporting</a></li> <li><a href="http://pm.gc.ca/eng">Prime Minister</a></li> <li><a href="https://www.canada.ca/en/government/system.html">How government works</a></li> <li><a href="http://open.canada.ca/en/">Open government</a></li> </ul> </nav> <div class="brand"> <div class="container"> <div class="row"> <nav class="col-md-10 ftr-urlt-lnk"> <h2 class="wb-inv">About this site</h2> <ul> <li><a href="https://www.canada.ca/en/social.html">Social media</a></li> <li><a href="https://www.canada.ca/en/mobile.html">Mobile applications</a></li> <li><a href="http://www1.canada.ca/en/newsite.html">About Canada.ca</a></li> <li><a href="http://www.ic.gc.ca/eic/site/icgc.nsf/eng/h_07033.html">Terms and conditions</a></li> <li><a href="http://www.ic.gc.ca/eic/site/icgc.nsf/eng/h_07033.html#p1">Privacy</a></li> </ul> </nav> <div class="col-xs-6 visible-sm visible-xs tofpg"> <a href="#wb-cont">Top of Page <span class="glyphicon glyphicon-chevron-up"></span></a> </div> <div class="col-xs-6 col-md-2 text-right"> <object type="image/svg+xml" tabindex="-1" role="img" data="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/assets/wmms-blk.svg" aria-label="Symbol of the Government of Canada"></object> </div> </div> </div> </div> </footer> <!--[if gte IE 9 | !IE ]><!--> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/js/wet-boew.min.js"></script> <!--<![endif]--> <!--[if lt IE 9]> <script src="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/js/ie8-wet-boew2.min.js"></script> <![endif]--> <script src="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/js/theme.min.js"></script> <!-- EPI-10519 --> <span class="wb-sessto" data-wb-sessto='{"inactivity": 1800000, "reactionTime": 180000, "sessionalive": 1800000, "logouturl": "/app/ccc/srch/cccSrch.do?lang=eng&prtl=1"}'></span> <script src="/eic/home.nsf/js/jQuery.externalOpensInNewWindow.js"></script> <!-- EPI-11190 - Webtrends --> <script src="/eic/home.nsf/js/webtrends.js"></script> <script>var endTime = new Date();</script> <noscript> <div><img alt="" id="DCSIMG" width="1" height="1" src="//wt-sdc.ic.gc.ca/dcs6v67hwe0ei7wsv8g9fv50d_3k6i/njs.gif?dcsuri=/nojavascript&amp;WT.js=No&amp;WT.tv=9.4.0&amp;dcssip=www.ic.gc.ca"/></div> </noscript> <!-- /Webtrends --> <!-- JS deps --> <script src="/eic/home.nsf/js/jquery.imagesloaded.js"></script> <!-- EPI-11262 - Util JS --> <script src="/eic/home.nsf/js/_WET_4-0_utils_canada.min.js"></script> <!-- EPI-11383 --> <script src="/eic/home.nsf/js/jQuery.icValidationErrors.js"></script> <span style="display:none;" id='app-info' data-project-groupid='' data-project-artifactid='' data-project-version='' data-project-build-timestamp='' data-issue-tracking='' data-scm-sha1='' data-scm-sha1-abbrev='' data-scm-branch='' data-scm-commit-date=''></span> </body></html> <!-- End Footer --> <!-- - Artifact ID: CBW - IMBS - CCC Search WAR - Group ID: ca.gc.ic.strategis.imbs.ccc.search - Version: 3.26 - Built-By: bamboo - Build Timestamp: 2017-03-02T21:29:28Z -->
GoC-Spending/data-corporations
html/123456102319.html
HTML
mit
41,403
Template.modalEditLanguages.events({ "submit form": function (event) { event.preventDefault(); var name = event.target["language-name"].value.trim(), project = event.target["project-id"].value; if (name) { Meteor.call('addLanguage', project, name, function (error, res) { if (error) Materialize.toast(error.reason, 5000); else { event.target["language-name"].value = ""; $('#modal-edit-languages').closeModal(); } }); } }, 'click [data-action="remove-language"]': function (event) { event.preventDefault(); var $el = $(event.currentTarget), project = $el.data('project'), language = $el.text(); Meteor.call('removeLanguage', project, language, function (error, res) { if (error) Materialize.toast(error.reason, 5000); //else $el.remove(); }); } });
AlexBeauchemin/deckdeck
meteor-app/client/templates/components/modal-edit-languages.js
JavaScript
mit
1,004
{% if site.twitter_username %} <a class="social-icon" href="https://twitter.com/{{ site.twitter_username }}" target="_blank"> <i class="fa fa-twitter"></i> </a> {% endif %} {% if site.github_username %} <a class="social-icon" href="https://github.com/{{ site.github_username }}" target="_blank"> <i class="fa fa-github"></i> </a> {% endif %} <a class="social-icon" href="/atom.xml" target="_blank"> <i class="fa fa-rss"></i> </a>
researchapps/researchapps.github.io
_includes/social_media.html
HTML
mit
473
use std::collections::hashmap::{Occupied, Vacant, HashMap}; use std::io::BufferedReader; use std::io::File; use std::os; use std::str::StrSlice; fn main() { let args = os::args(); let path = Path::new(args[1].as_slice()); let mut file = BufferedReader::new(File::open(&path)); let mut counter: HashMap<String, uint> = HashMap::new(); for line_opt in file.lines() { let line = line_opt.ok().expect("Could not read line"); for word in line.as_slice().split(' ') { let key = word.to_string(); // Update count match counter.entry(key) { Vacant(entry) => { let _ = entry.set(1u); }, Occupied(mut entry) => { *entry.get_mut() += 1; } }; } } println!("{}", counter.len()); }
alexalemi/textbench
vocab.rs
Rust
mit
852
var EventEmitter = require('events').EventEmitter; var util = require('util'); var MongoClient = require('mongodb').MongoClient; var Channel = require('./channel'); /** * Connection constructor. * * @param {String|Db} uri string or Db instance * @param {Object} mongo driver options * @api public */ function Connection(uri, options) { var self = this; options || (options = {}); options.autoReconnect != null || (options.autoReconnect = true); // It's a Db instance. if (uri.collection) { this.db = uri; } else { MongoClient.connect(uri, options, function (err, db) { if (err) return self.emit('error', err); self.db = db; self.emit('connect', db); db.on('error', function (err) { self.emit('error', err); }); }); } this.destroyed = false; this.channels = {}; } module.exports = Connection; util.inherits(Connection, EventEmitter); /** * Current connection state. * * @type {String} * @api public */ Object.defineProperty(Connection.prototype, 'state', { enumerable: true, get: function () { var state; // Using 'destroyed' to be compatible with the driver. if (this.destroyed) { state = 'destroyed'; } else if (this.db) { state = this.db.serverConfig.isConnected() ? 'connected' : 'disconnected'; } else { state = 'connecting'; } return state; } }); /** * Creates or returns a channel with the passed name. * * @see Channel * @return {Channel} * @api public */ Connection.prototype.channel = function (name, options) { if (typeof name === 'object') { options = name; name = 'mubsub'; } if (!this.channels[name] || this.channels[name].closed) { this.channels[name] = new Channel(this, name, options); } return this.channels[name]; }; /** * Close connection. * * @param {Function} [callback] * @return {Connection} this * @api public */ Connection.prototype.close = function (callback) { this.destroyed = true; this.emit('close'); this.db.close(callback); return this; };
Faleij/mubsub
lib/connection.js
JavaScript
mit
2,233
#pragma once #include "IMessageLoop.h" #include "MessageHandlerRegister.h" #include "QueueConnector.h" class MessageLoop : public IMessageLoop { private: std::atomic_bool m_running; ConnectorPtr m_inQueue; MessageHandlerRegisterPtr m_handlers; bool CallHandlerForMessage(const MessagePtr& pMsg); public: MessageLoop(const ConnectorPtr& connector, MessageHandlerRegisterPtr handlers); virtual ~MessageLoop(); virtual bool ProcessMessageLoop() override; virtual void Execute() override; virtual void Shutdown() override; };
Agent57/PubSub
Framework/MessageLoop.h
C
mit
545
<?php class UserHistoric{ private $id_; private $firstname_; private $lastname_; private $archiving_date_; private $login_; private $password_; private $phone_; private $mail_; private $emergencyMail_; private $comments_; private $applicationFee_; private $userId_; public function __construct($id, $firstname, $lastname, $archivingDate, $login, $password, $phone, $mail, $emergencyMail, $comments, $applicationFee, $userId){ $this->id_ = $id; $this->firstname_ = $firstname; $this->lastname_ = $lastname; $this->archivingDate_ = $archivingDate; $this->login_ = $login; $this->password_ = $password; $this->phone_ = $phone; $this->mail_ = $mail; $this->emergencyMail_ = $emergencyMail; $this->comments_ = $comments; $this->applicationFee_ = $applicationFee; $this->userId_ = $userId; } public function getId(){ return $this->id_; } public function setId($id){ $this->id_ = $id; } public function getFirstname(){ return $this->firstname_; } public function setFirstname($firstnme){ $this->firstname_ = $firstname; } public function getLastname(){ return $this->lastname_; } public function setLastname($lastname){ $this->lastname_ = $lastname; } public function getArchivingDate(){ return $this->archiving_date_; } public function setArchivingDate($archivingDate){ $this->archivingDate_ = $archivingDate; } public function getLogin(){ return $this->login_; } public function setLogin($login){ $this->login_ = $login; } public function getPassword(){ return $this->password_; } public function setPassword($password){ $this->password_ = $password; } public function getPhone(){ return $this->phone_; } public function setPhone($phone){ $this->phone_ = $phone; } public function getMail(){ return $this->mail_; } public function setMail($mail){ $this->mail_ = $mail; } public function getEmergencyMail(){ return $this->emergencyMail_; } public function setEmergencyMail($emergencyMail){ $this->emergencyMail_ = $emergencyMail; } public function getComments(){ return $this->comments_; } public function setComments($comments){ $this->comments_ = $comments; } public function getApplicationFee(){ return $this->applicationFee_; } public function setApplicationFee($applicationFee){ $this->applicationFee_ = $applicationFee; } public function getUserId(){ return $this->userId_; } public function setUserId($userId){ $this->userId_ = $userId; } } ?>
lukile/projetAnnuel
class/UserHistoric.php
PHP
mit
3,293
/* jshint node: true */ 'use strict'; var DeployPluginBase = require('ember-cli-deploy-plugin'); var S3Client = require('./lib/aws-s3'); var CodeDeployClient = require('./lib/aws-codedeploy'); var path = require('path'); var minmatch = require('minimatch'); var Promise = require('ember-cli/lib/ext/promise'); module.exports = { name: 'ember-cli-deploy-aws-codedeploy', createDeployPlugin: function(options) { var DeployPlugin = DeployPluginBase.extend({ name: options.name, defaultConfig: { filePattern: '**/*.{js,css,png,gif,ico,jpg,map,xml,txt,svg,swf,eot,ttf,woff,woff2,yml,html,htm}', basePackageName: this.project.pkg.name + '-' + this.project.pkg.version, archiveType: 'zip', archiveTempDirectory: 'tmp', distDir: function(context) { return context.distDir; }, distFiles: function(context) { return context.distFiles || []; }, manifestPath: function(context) { return context.manifestPath; // e.g. from ember-cli-deploy-manifest }, revisionKey: function(context) { var revisionData = context.revisionData; return revisionData.revisionKey + '-' + revisionData.timestamp; }, }, ensureConfigPropertySet: function(propertyName) { if (!this.propertyByString(this.pluginConfig, propertyName)) { var message = 'Missing required config: `' + propertyName + '`'; this.log(message, { color: 'red' }); throw new Error(message); } }, propertyByString: function(object, property) { var properties = property.replace(/\[(\w+)\]/g, '.$1'); properties = properties.replace(/^\./, ''); var a = properties.split('.'); for (var i = 0, n = a.length; i < n; ++i) { var k = a[i]; if (k in object) { object = object[k]; } else { return; } } return object; }, requiredConfig: ['accessKeyId', 'secretAccessKey', 'region', 'archiveType', 'awsDeploymentOptions.applicationName', 'awsDeploymentOptions.revision.revisionType'], prepare: function(context) { /** * We have two use cases here: * 1. User wants to use S3 and Code Deploy * 2. User does not want to use S3, only code deploy. */ this.awsCodeDeployServiceOptions = this.awsCodeDeployServiceOptions || {}; var awsDeploymentOptions = this.readConfig('awsDeploymentOptions'); if (awsDeploymentOptions.revision.revisionType === 'S3') { this.awsS3ServiceOptions = this.awsS3ServiceOptions || {}; if (!this.awsS3ServiceOptions['accessKeyId']) this.awsS3ServiceOptions['accessKeyId'] = this.readConfig('accessKeyId'); if (!this.awsS3ServiceOptions['secretAccessKey']) this.awsS3ServiceOptions['secretAccessKey'] = this.readConfig('secretAccessKey'); if (!this.awsS3ServiceOptions['region']) this.awsS3ServiceOptions['region'] = this.readConfig('region'); this._awsS3Client = new S3Client({ parentPlugin: this, awsS3ServiceOptions: this.awsS3ServiceOptions, distDir: this.readConfig('distDir'), revisionKey: this.readConfig('basePackageName') + '-' + this.readConfig('revisionKey'), manifestPath: this.readConfig('manifestPath'), archiveType: this.readConfig('archiveType'), archiveTempDirectory: this.readConfig('archiveTempDirectory'), }, this); } if (!this.awsCodeDeployServiceOptions['accessKeyId']) this.awsCodeDeployServiceOptions['accessKeyId'] = this.readConfig('accessKeyId'); if (!this.awsCodeDeployServiceOptions['secretAccessKey']) this.awsCodeDeployServiceOptions['secretAccessKey'] = this.readConfig('secretAccessKey'); if (!this.awsCodeDeployServiceOptions['region']) this.awsCodeDeployServiceOptions['region'] = this.readConfig('region'); if (!awsDeploymentOptions) awsDeploymentOptions = {}; if (!awsDeploymentOptions.applicationName) awsDeploymentOptions.applicationName = this.readConfig('basePackageName'); this._awsCodeDeployClient = new CodeDeployClient({ log: this.log, awsCodeDeployServiceOptions: this.awsCodeDeployServiceOptions, awsDeploymentOptions: awsDeploymentOptions }); }, upload: function(context) { var distributionFiles = this.readConfig('distFiles'); var filePattern = this.readConfig('filePattern'); var revisionType = this.readConfig('revisionType'); var awsDeploymentOptions = this.readConfig('awsDeploymentOptions'); var filesToUpload = distributionFiles.filter(minmatch.filter(filePattern, { matchBase: true })); this.log('Checking context', { color: 'yellow' }); var uploadPromise = (awsDeploymentOptions.revision.revisionType === 'S3') ? this._awsS3Client.upload(filesToUpload, this.readConfig('s3UploadOptions'), this.readConfig('manifestPath')) : new Promise().resolve(); return uploadPromise.then((result) => { return this._awsCodeDeployClient.createDeployment(result) }); } }); return new DeployPlugin(); } };
MojoJojo/ember-cli-deploy-aws-codedeploy
index.js
JavaScript
mit
6,335
/* * Copyright 1999-2101 Alibaba Group. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.alibaba.fastjson.serializer; import java.io.IOException; import java.lang.reflect.Type; import java.math.BigDecimal; import com.alibaba.fastjson.parser.DefaultJSONParser; import com.alibaba.fastjson.parser.JSONLexer; import com.alibaba.fastjson.parser.JSONToken; import com.alibaba.fastjson.parser.deserializer.ObjectDeserializer; import com.alibaba.fastjson.util.TypeUtils; /** * @author wenshao<szujobs@hotmail.com> */ public class BigDecimalCodec implements ObjectSerializer, ObjectDeserializer { public final static BigDecimalCodec instance = new BigDecimalCodec(); public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType) throws IOException { SerializeWriter out = serializer.getWriter(); if (object == null) { if (out.isEnabled(SerializerFeature.WriteNullNumberAsZero)) { out.write('0'); } else { out.writeNull(); } return; } BigDecimal val = (BigDecimal) object; out.write(val.toString()); if (out.isEnabled(SerializerFeature.WriteClassName) && fieldType != BigDecimal.class && val.scale() == 0) { out.write('.'); } } @SuppressWarnings("unchecked") public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) { return (T) deserialze(parser); } @SuppressWarnings("unchecked") public static <T> T deserialze(DefaultJSONParser parser) { final JSONLexer lexer = parser.getLexer(); if (lexer.token() == JSONToken.LITERAL_INT) { long val = lexer.longValue(); lexer.nextToken(JSONToken.COMMA); return (T) new BigDecimal(val); } if (lexer.token() == JSONToken.LITERAL_FLOAT) { BigDecimal val = lexer.decimalValue(); lexer.nextToken(JSONToken.COMMA); return (T) val; } Object value = parser.parse(); if (value == null) { return null; } return (T) TypeUtils.castToBigDecimal(value); } public int getFastMatchToken() { return JSONToken.LITERAL_INT; } }
liufeiit/itmarry
source/geek.android/geek/src/com/alibaba/fastjson/serializer/BigDecimalCodec.java
Java
mit
2,890
# Abnormal rise in exception volume (preview) ### Intro Application Insights automatically analyzes the exceptions thrown in your application, and can warn you about unusual patterns in your exception telemetry. This feature requires no special setup, other than [configuring exception reporting](https://docs.microsoft.com/azure/application-insights/app-insights-asp-net-exceptions#set-up-exception-reporting) for your app. It is active when your app generates enough exception telemetry. ### When would I get this type of smart detection notification? You might get this type of notification if your app is exhibiting an abnormal rise in the number of exceptions of a specific type during a day, compared to a baseline calculated over the previous 7 days. Machine learning algorithms are being used for detecting the rise in exception count, while taking into account a natural growth in your application usage. ### Does my app definitely have a problem? No, a notification doesn't mean that your app definitely has a problem. Although an excessive number of exceptions usually indicates an application issue, these exceptions might be benign and handled correctly by your application. ### How do I fix it? The notifications include diagnostic information to support in the diagnostics process: 1. **Triage.** The notification shows you how many users or how many requests are affected. This can help you assign a priority to the problem. 2. **Scope.** Is the problem affecting all traffic, or just some operation? This information can be obtained from the notification. 3. **Diagnose.** The detection contains information about the method from which the exception was thrown, as well as the exception type. You can also use the related items and reports linking to supporting information, to help you further diagnose the issue.
SoubhagyaDash/ApplicationInsights-Home
SmartDetection/abnormal-rise-in-exception-volume.md
Markdown
mit
1,839
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>additions: Not compatible 👼</title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.7.1 / additions - 8.9.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> additions <small> 8.9.0 <span class="label label-info">Not compatible 👼</span> </small> </h1> <p>📅 <em><script>document.write(moment("2021-12-05 19:37:45 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2021-12-05 19:37:45 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-num base Num library distributed with the OCaml compiler base-threads base base-unix base camlp5 7.14 Preprocessor-pretty-printer of OCaml conf-findutils 1 Virtual package relying on findutils conf-perl 1 Virtual package relying on perl coq 8.7.1 Formal proof management system num 0 The Num library for arbitrary-precision integer and rational arithmetic ocaml 4.03.0 The OCaml compiler (virtual package) ocaml-base-compiler 4.03.0 Official 4.03.0 release ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.1 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;Hugo.Herbelin@inria.fr&quot; homepage: &quot;https://github.com/coq-contribs/additions&quot; license: &quot;LGPL 2.1&quot; build: [make &quot;-j%{jobs}%&quot;] install: [make &quot;install&quot;] remove: [&quot;rm&quot; &quot;-R&quot; &quot;%{lib}%/coq/user-contrib/Additions&quot;] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.9&quot; &amp; &lt; &quot;8.10~&quot;} ] tags: [ &quot;keyword: addition chains&quot; &quot;category: Computer Science/Decision Procedures and Certified Algorithms/Correctness proofs of algorithms&quot; &quot;category: Miscellaneous/Extracted Programs/Arithmetic&quot; ] authors: [ &quot;Pierre Castéran&quot; ] bug-reports: &quot;https://github.com/coq-contribs/additions/issues&quot; dev-repo: &quot;git+https://github.com/coq-contribs/additions.git&quot; synopsis: &quot;Addition Chains&quot; flags: light-uninstall url { src: &quot;https://github.com/coq-contribs/additions/archive/v8.9.0.tar.gz&quot; checksum: &quot;md5=7761e5c6040050ef3b626176c028b612&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install 🏜️</h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-additions.8.9.0 coq.8.7.1</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.7.1). The following dependencies couldn&#39;t be met: - coq-additions -&gt; coq &gt;= 8.9 -&gt; ocaml &gt;= 4.05.0 base of this switch (use `--unlock-base&#39; to force) Your request can&#39;t be satisfied: - No available version of coq satisfies the constraints No solution found, exiting </pre></dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-additions.8.9.0</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install 🚀</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall 🧹</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣 </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
coq-bench/coq-bench.github.io
clean/Linux-x86_64-4.03.0-2.0.5/released/8.7.1/additions/8.9.0.html
HTML
mit
6,934
/* ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /** * @file osal.h * @brief OSAL module header. * * @addtogroup OSAL * @{ */ #ifndef _OSAL_H_ #define _OSAL_H_ #include <stddef.h> #include <stdint.h> #include <stdbool.h> #include "ch.h" /*===========================================================================*/ /* Module constants. */ /*===========================================================================*/ /** * @name Common constants * @{ */ #if !defined(FALSE) || defined(__DOXYGEN__) #define FALSE 0 #endif #if !defined(TRUE) || defined(__DOXYGEN__) #define TRUE (!FALSE) #endif #define OSAL_SUCCESS FALSE #define OSAL_FAILED TRUE /** @} */ #if 0 /** * @name Messages * @{ */ #define MSG_OK RDY_OK #define MSG_RESET RDY_RESET #define MSG_TIMEOUT RDY_TIMEOUT /** @} */ #endif #if 0 /** * @name Special time constants * @{ */ #define TIME_IMMEDIATE ((systime_t)0) #define TIME_INFINITE ((systime_t)-1) /** @} */ #endif /** * @name Systick modes. * @{ */ #define OSAL_ST_MODE_NONE 0 #define OSAL_ST_MODE_PERIODIC 1 #define OSAL_ST_MODE_FREERUNNING 2 /** @} */ /** * @name Systick parameters. * @{ */ /** * @brief Size in bits of the @p systick_t type. */ #define OSAL_ST_RESOLUTION CH_CFG_ST_RESOLUTION /** * @brief Required systick frequency or resolution. */ #define OSAL_ST_FREQUENCY CH_CFG_ST_FREQUENCY /** * @brief Systick mode required by the underlying OS. */ #if (CH_CFG_ST_TIMEDELTA == 0) || defined(__DOXYGEN__) #define OSAL_ST_MODE OSAL_ST_MODE_PERIODIC #else #define OSAL_ST_MODE OSAL_ST_MODE_FREERUNNING #endif /** @} */ /*===========================================================================*/ /* Module pre-compile time settings. */ /*===========================================================================*/ /*===========================================================================*/ /* Derived constants and error checks. */ /*===========================================================================*/ #if !(OSAL_ST_MODE == OSAL_ST_MODE_NONE) && \ !(OSAL_ST_MODE == OSAL_ST_MODE_PERIODIC) && \ !(OSAL_ST_MODE == OSAL_ST_MODE_FREERUNNING) #error "invalid OSAL_ST_MODE setting in osal.h" #endif #if (OSAL_ST_RESOLUTION != 16) && (OSAL_ST_RESOLUTION != 32) #error "invalid OSAL_ST_RESOLUTION, must be 16 or 32" #endif /*===========================================================================*/ /* Module data structures and types. */ /*===========================================================================*/ #if 0 /** * @brief Type of a system status word. */ typedef uint32_t syssts_t; #endif #if 0 /** * @brief Type of a message. */ typedef int32_t msg_t; #endif #if 0 /** * @brief Type of system time counter. */ typedef uint32_t systime_t; #endif #if 0 /** * @brief Type of realtime counter. */ typedef uint32_t rtcnt_t; #endif #if 0 /** * @brief Type of a thread reference. */ typedef thread_t * thread_reference_t; #endif #if 0 /** * @brief Type of an event flags mask. */ typedef uint32_t eventflags_t; #endif #if !CH_CFG_USE_EVENTS /** * @brief Type of an event flags object. * @note The content of this structure is not part of the API and should * not be relied upon. Implementers may define this structure in * an entirely different way. * @note Retrieval and clearing of the flags are not defined in this * API and are implementation-dependent. */ typedef struct { volatile eventflags_t flags; /**< @brief Flags stored into the object. */ } event_source_t; #endif /** * @brief Type of a mutex. * @note If the OS does not support mutexes or there is no OS then them * mechanism can be simulated. */ #if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__) #elif CH_CFG_USE_SEMAPHORES typedef semaphore_t mutex_t; #else typedef uint32_t mutex_t; #endif #if 0 /** * @brief Type of a thread queue. * @details A thread queue is a queue of sleeping threads, queued threads * can be dequeued one at time or all together. * @note In this implementation it is implemented as a single reference * because there are no real threads. */ typedef struct { thread_reference_t tr; } threads_queue_t; #endif /*===========================================================================*/ /* Module macros. */ /*===========================================================================*/ /* Temporary names provided for ChibiOS 2.x compatibility.*/ #define osalQueueInit osalThreadQueueObjectInit #define osalQueueWakeupAllI osalThreadDequeueAllI #define osalQueueWakeupOneI osalThreadDequeueNextI #define osalQueueGoSleepTimeoutS osalThreadEnqueueTimeoutS #define osalEventInit osalEventObjectInit /** * @name Debug related macros * @{ */ /** * @brief Condition assertion. * @details If the condition check fails then the OSAL panics with a * message and halts. * @note The condition is tested only if the @p OSAL_ENABLE_ASSERTIONS * switch is enabled. * @note The remark string is not currently used except for putting a * comment in the code about the assertion. * * @param[in] c the condition to be verified to be true * @param[in] remark a remark string * * @api */ #define osalDbgAssert(c, remark) chDbgAssert(c, remark) /** * @brief Function parameters check. * @details If the condition check fails then the OSAL panics and halts. * @note The condition is tested only if the @p OSAL_ENABLE_CHECKS switch * is enabled. * * @param[in] c the condition to be verified to be true * * @api */ #define osalDbgCheck(c) chDbgCheck(c) /** * @brief I-Class state check. * @note Not implemented in this simplified OSAL. */ #define osalDbgCheckClassI() chDbgCheckClassI() /** * @brief S-Class state check. * @note Not implemented in this simplified OSAL. */ #define osalDbgCheckClassS() chDbgCheckClassS() /** @} */ /** * @name IRQ service routines wrappers * @{ */ /** * @brief Priority level verification macro. */ #define OSAL_IRQ_IS_VALID_PRIORITY(n) CH_IRQ_IS_VALID_KERNEL_PRIORITY(n) /** * @brief IRQ prologue code. * @details This macro must be inserted at the start of all IRQ handlers. */ #define OSAL_IRQ_PROLOGUE() CH_IRQ_PROLOGUE() /** * @brief IRQ epilogue code. * @details This macro must be inserted at the end of all IRQ handlers. */ #define OSAL_IRQ_EPILOGUE() CH_IRQ_EPILOGUE() /** * @brief IRQ handler function declaration. * @details This macro hides the details of an ISR function declaration. * * @param[in] id a vector name as defined in @p vectors.s */ #define OSAL_IRQ_HANDLER(id) CH_IRQ_HANDLER(id) /** @} */ /** * @name Time conversion utilities * @{ */ /** * @brief Seconds to system ticks. * @details Converts from seconds to system ticks number. * @note The result is rounded upward to the next tick boundary. * * @param[in] sec number of seconds * @return The number of ticks. * * @api */ #define OSAL_S2ST(sec) S2ST(sec) /** * @brief Milliseconds to system ticks. * @details Converts from milliseconds to system ticks number. * @note The result is rounded upward to the next tick boundary. * * @param[in] msec number of milliseconds * @return The number of ticks. * * @api */ #define OSAL_MS2ST(msec) MS2ST(msec) /** * @brief Microseconds to system ticks. * @details Converts from microseconds to system ticks number. * @note The result is rounded upward to the next tick boundary. * * @param[in] usec number of microseconds * @return The number of ticks. * * @api */ #define OSAL_US2ST(usec) US2ST(usec) /** @} */ /** * @name Sleep macros using absolute time * @{ */ /** * @brief Delays the invoking thread for the specified number of seconds. * @note The specified time is rounded up to a value allowed by the real * system tick clock. * @note The maximum specifiable value is implementation dependent. * * @param[in] sec time in seconds, must be different from zero * * @api */ #define osalThreadSleepSeconds(sec) osalThreadSleep(OSAL_S2ST(sec)) /** * @brief Delays the invoking thread for the specified number of * milliseconds. * @note The specified time is rounded up to a value allowed by the real * system tick clock. * @note The maximum specifiable value is implementation dependent. * * @param[in] msec time in milliseconds, must be different from zero * * @api */ #define osalThreadSleepMilliseconds(msec) osalThreadSleep(OSAL_MS2ST(msec)) /** * @brief Delays the invoking thread for the specified number of * microseconds. * @note The specified time is rounded up to a value allowed by the real * system tick clock. * @note The maximum specifiable value is implementation dependent. * * @param[in] usec time in microseconds, must be different from zero * * @api */ #define osalThreadSleepMicroseconds(usec) osalThreadSleep(OSAL_US2ST(usec)) /** @} */ /*===========================================================================*/ /* External declarations. */ /*===========================================================================*/ #ifdef __cplusplus extern "C" { #endif #ifdef __cplusplus } #endif /*===========================================================================*/ /* Module inline functions. */ /*===========================================================================*/ /** * @brief OSAL module initialization. * * @api */ static inline void osalInit(void) { } /** * @brief System halt with error message. * * @param[in] reason the halt message pointer * * @api */ static inline void osalSysHalt(const char *reason) { chSysHalt(reason); } /** * @brief Disables interrupts globally. * * @special */ static inline void osalSysDisable(void) { chSysDisable(); } /** * @brief Enables interrupts globally. * * @special */ static inline void osalSysEnable(void) { chSysEnable(); } /** * @brief Enters a critical zone from thread context. * @note This function cannot be used for reentrant critical zones. * * @special */ static inline void osalSysLock(void) { chSysLock(); } /** * @brief Leaves a critical zone from thread context. * @note This function cannot be used for reentrant critical zones. * * @special */ static inline void osalSysUnlock(void) { chSysUnlock(); } /** * @brief Enters a critical zone from ISR context. * @note This function cannot be used for reentrant critical zones. * * @special */ static inline void osalSysLockFromISR(void) { chSysLockFromISR(); } /** * @brief Leaves a critical zone from ISR context. * @note This function cannot be used for reentrant critical zones. * * @special */ static inline void osalSysUnlockFromISR(void) { chSysUnlockFromISR(); } /** * @brief Returns the execution status and enters a critical zone. * @details This functions enters into a critical zone and can be called * from any context. Because its flexibility it is less efficient * than @p chSysLock() which is preferable when the calling context * is known. * @post The system is in a critical zone. * * @return The previous system status, the encoding of this * status word is architecture-dependent and opaque. * * @xclass */ static inline syssts_t osalSysGetStatusAndLockX(void) { return chSysGetStatusAndLockX(); } /** * @brief Restores the specified execution status and leaves a critical zone. * @note A call to @p chSchRescheduleS() is automatically performed * if exiting the critical zone and if not in ISR context. * * @param[in] sts the system status to be restored. * * @xclass */ static inline void osalSysRestoreStatusX(syssts_t sts) { chSysRestoreStatusX(sts); } /** * @brief Polled delay. * @note The real delay is always few cycles in excess of the specified * value. * * @param[in] cycles number of cycles * * @xclass */ #if PORT_SUPPORTS_RT || defined(__DOXYGEN__) static inline void osalSysPolledDelayX(rtcnt_t cycles) { chSysPolledDelayX(cycles); } #endif /** * @brief Systick callback for the underlying OS. * @note This callback is only defined if the OSAL requires such a * service from the HAL. */ #if (OSAL_ST_MODE != OSAL_ST_MODE_NONE) || defined(__DOXYGEN__) static inline void osalOsTimerHandlerI(void) { chSysTimerHandlerI(); } #endif /** * @brief Checks if a reschedule is required and performs it. * @note I-Class functions invoked from thread context must not reschedule * by themselves, an explicit reschedule using this function is * required in this scenario. * @note Not implemented in this simplified OSAL. * * @sclass */ static inline void osalOsRescheduleS(void) { chSchRescheduleS(); } /** * @brief Current system time. * @details Returns the number of system ticks since the @p osalInit() * invocation. * @note The counter can reach its maximum and then restart from zero. * @note This function can be called from any context but its atomicity * is not guaranteed on architectures whose word size is less than * @p systime_t size. * * @return The system time in ticks. * * @xclass */ static inline systime_t osalOsGetSystemTimeX(void) { return chVTGetSystemTimeX(); } /** * @brief Checks if the specified time is within the specified time window. * @note When start==end then the function returns always true because the * whole time range is specified. * @note This function can be called from any context. * * @param[in] time the time to be verified * @param[in] start the start of the time window (inclusive) * @param[in] end the end of the time window (non inclusive) * @retval true current time within the specified time window. * @retval false current time not within the specified time window. * * @xclass */ static inline bool osalOsIsTimeWithinX(systime_t time, systime_t start, systime_t end) { return chVTIsTimeWithinX(time, start, end); } /** * @brief Suspends the invoking thread for the specified time. * * @param[in] time the delay in system ticks, the special values are * handled as follow: * - @a TIME_INFINITE is allowed but interpreted as a * normal time specification. * - @a TIME_IMMEDIATE this value is not allowed. * . * * @sclass */ static inline void osalThreadSleepS(systime_t time) { chThdSleepS(time); } /** * @brief Suspends the invoking thread for the specified time. * * @param[in] time the delay in system ticks, the special values are * handled as follow: * - @a TIME_INFINITE is allowed but interpreted as a * normal time specification. * - @a TIME_IMMEDIATE this value is not allowed. * . * * @api */ static inline void osalThreadSleep(systime_t time) { chThdSleep(time); } /** * @brief Sends the current thread sleeping and sets a reference variable. * @note This function must reschedule, it can only be called from thread * context. * * @param[in] trp a pointer to a thread reference object * @return The wake up message. * * @sclass */ static inline msg_t osalThreadSuspendS(thread_reference_t *trp) { return chThdSuspendS(trp); } /** * @brief Sends the current thread sleeping and sets a reference variable. * @note This function must reschedule, it can only be called from thread * context. * * @param[in] trp a pointer to a thread reference object * @param[in] timeout the timeout in system ticks, the special values are * handled as follow: * - @a TIME_INFINITE the thread enters an infinite sleep * state. * - @a TIME_IMMEDIATE the thread is not enqueued and * the function returns @p MSG_TIMEOUT as if a timeout * occurred. * . * @return The wake up message. * @retval MSG_TIMEOUT if the operation timed out. * * @sclass */ static inline msg_t osalThreadSuspendTimeoutS(thread_reference_t *trp, systime_t timeout) { return chThdSuspendTimeoutS(trp, timeout); } /** * @brief Wakes up a thread waiting on a thread reference object. * @note This function must not reschedule because it can be called from * ISR context. * * @param[in] trp a pointer to a thread reference object * @param[in] msg the message code * * @iclass */ static inline void osalThreadResumeI(thread_reference_t *trp, msg_t msg) { chThdResumeI(trp, msg); } /** * @brief Wakes up a thread waiting on a thread reference object. * @note This function must reschedule, it can only be called from thread * context. * * @param[in] trp a pointer to a thread reference object * @param[in] msg the message code * * @iclass */ static inline void osalThreadResumeS(thread_reference_t *trp, msg_t msg) { chThdResumeS(trp, msg); } /** * @brief Initializes a threads queue object. * * @param[out] tqp pointer to the threads queue object * * @init */ static inline void osalThreadQueueObjectInit(threads_queue_t *tqp) { chThdQueueObjectInit(tqp); } /** * @brief Enqueues the caller thread. * @details The caller thread is enqueued and put to sleep until it is * dequeued or the specified timeouts expires. * * @param[in] tqp pointer to the threads queue object * @param[in] time the timeout in system ticks, the special values are * handled as follow: * - @a TIME_INFINITE the thread enters an infinite sleep * state. * - @a TIME_IMMEDIATE the thread is not enqueued and * the function returns @p MSG_TIMEOUT as if a timeout * occurred. * . * @return The message from @p osalQueueWakeupOneI() or * @p osalQueueWakeupAllI() functions. * @retval MSG_TIMEOUT if the thread has not been dequeued within the * specified timeout or if the function has been * invoked with @p TIME_IMMEDIATE as timeout * specification. * * @sclass */ static inline msg_t osalThreadEnqueueTimeoutS(threads_queue_t *tqp, systime_t time) { return chThdEnqueueTimeoutS(tqp, time); } /** * @brief Dequeues and wakes up one thread from the queue, if any. * * @param[in] tqp pointer to the threads queue object * @param[in] msg the message code * * @iclass */ static inline void osalThreadDequeueNextI(threads_queue_t *tqp, msg_t msg) { chThdDequeueNextI(tqp, msg); } /** * @brief Dequeues and wakes up all threads from the queue. * * @param[in] tqp pointer to the threads queue object * @param[in] msg the message code * * @iclass */ static inline void osalThreadDequeueAllI(threads_queue_t *tqp, msg_t msg) { chThdDequeueAllI(tqp, msg); } #if CH_CFG_USE_EVENTS || defined(__DOXYGEN__) /** * @brief Initializes an event flags object. * * @param[out] esp pointer to the event flags object * * @init */ static inline void osalEventObjectInit(event_source_t *esp) { chEvtObjectInit(esp); } #else static inline void osalEventObjectInit(event_source_t *esp) { esp->flags = 0; } #endif #if CH_CFG_USE_EVENTS || defined(__DOXYGEN__) /** * @brief Add flags to an event source object. * * @param[in] esp pointer to the event flags object * @param[in] flags flags to be ORed to the flags mask * * @iclass */ static inline void osalEventBroadcastFlagsI(event_source_t *esp, eventflags_t flags) { chEvtBroadcastFlagsI(esp, flags); } #else static inline void osalEventBroadcastFlagsI(event_source_t *esp, eventflags_t flags) { esp->flags |= flags; } #endif #if CH_CFG_USE_EVENTS || defined(__DOXYGEN__) /** * @brief Add flags to an event source object. * * @param[in] esp pointer to the event flags object * @param[in] flags flags to be ORed to the flags mask * * @iclass */ static inline void osalEventBroadcastFlags(event_source_t *esp, eventflags_t flags) { chEvtBroadcastFlags(esp, flags); } #else static inline void osalEventBroadcastFlags(event_source_t *esp, eventflags_t flags) { osalSysLock(); esp->flags |= flags; osalSysUnlock(); } #endif /** * @brief Initializes s @p mutex_t object. * * @param[out] mp pointer to the @p mutex_t object * * @init */ static inline void osalMutexObjectInit(mutex_t *mp) { #if CH_CFG_USE_MUTEXES chMtxObjectInit(mp); #elif CH_CFG_USE_SEMAPHORES chSemObjectInit((semaphore_t *)mp, 1); #else *mp = 0; #endif } /** * @brief Locks the specified mutex. * @post The mutex is locked and inserted in the per-thread stack of owned * mutexes. * * @param[in,out] mp pointer to the @p mutex_t object * * @api */ static inline void osalMutexLock(mutex_t *mp) { #if CH_CFG_USE_MUTEXES chMtxLock(mp); #elif CH_CFG_USE_SEMAPHORES chSemWait((semaphore_t *)mp); #else *mp = 1; #endif } /** * @brief Unlocks the specified mutex. * @note The HAL guarantees to release mutex in reverse lock order. The * mutex being unlocked is guaranteed to be the last locked mutex * by the invoking thread. * The implementation can rely on this behavior and eventually * ignore the @p mp parameter which is supplied in order to support * those OSes not supporting a stack of the owned mutexes. * * @param[in,out] mp pointer to the @p mutex_t object * * @api */ static inline void osalMutexUnlock(mutex_t *mp) { #if CH_CFG_USE_MUTEXES chMtxUnlock(mp); #elif CH_CFG_USE_SEMAPHORES chSemSignal((semaphore_t *)mp); #else *mp = 0; #endif } #endif /* _OSAL_H_ */ /** @} */
timothydgreer/turing_machine
firmware/ChibiOS_3.0.1/os/hal/osal/rt/osal.h
C
mit
24,121
# prepack generic data compression filters Prepack uses multiple resampling techniques to optimize files prior to compression. It's well suited for raw image file-types and raw audio such as WAV. If the file's structure cannot be detected or optimized it is stored as-is.
loxxous/prepack
README.md
Markdown
mit
273
/* Copyright (c) 2020 Simon Schmidt Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package fasthttpradix import ( "github.com/valyala/fasthttp" rr "github.com/byte-mug/golibs/radixroute" "strings" ) func NormPath(str string) string { return "/"+strings.Trim(str,"/")+"/" } func InvalidPath(ctx *fasthttp.RequestCtx) { ctx.SetBody([]byte("404 Not Found\n")) ctx.SetStatusCode(fasthttp.StatusNotFound) } type handling struct{ handle fasthttp.RequestHandler } type Router struct{ routes map[string]*rr.Tree } func (r *Router) getOrCreate(m string) *rr.Tree { t := r.routes[m] if t!=nil { return t } if r.routes==nil { r.routes = make(map[string]*rr.Tree) } r.routes[m] = rr.New() return r.routes[m] } func (r *Router) Handle(method string,path string,handler fasthttp.RequestHandler) { if handler==nil { panic("handler must not be nil") } h := &handling{handler} cpath := []byte(NormPath(path)) bpath := cpath[:len(cpath)-1] if method=="" { method = "DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT" } for _,m := range strings.Split(method,",") { rrt := r.getOrCreate(m) rrt.InsertRoute(bpath,h) rrt.InsertRoute(cpath,h) } } func (r *Router) RequestHandler(ctx *fasthttp.RequestCtx) { t := r.routes[string(ctx.Method())] if t==nil { InvalidPath(ctx) return } i,_ := t.Get(ctx.Path(),ctx.SetUserValue) h,ok := i.(*handling) if !ok { InvalidPath(ctx) return } h.handle(ctx) }
byte-mug/golibs
radixroute/fasthttpradix/radix.go
GO
mit
2,398
# Javascript filter - 1 ## Description While developing a website, you detect that some of the members have troubles logging in. Searching through the code you find that all logins ending with a "_" make problems. So you want to write a function that takes an array of pairs of login-names and e-mails, and outputs an array of all login-name, e-mails-pairs from the login-names that end with "_". If you have the input-array: ``` [ [ "foo", "foo@foo.com" ], [ "bar_", "bar@bar.com" ] ] it should output [ [ "bar_", "bar@bar.com" ] ] ``` You *have to* use the filter-method of Javascript, which returns each element of the array for which the filter-method returns true. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter
MForever78/Codewars
Javascript/Javascript_filter_-_1/README.md
Markdown
mit
772
@-ms-viewport{ width: device-width; } #landing-grid { text-align: center; } /* Logo */ #logo{ margin: 1em; height: auto; position: relative; } /* Grid Components */ .ch-item { position: relative; cursor: default; -webkit-transition: all 0.4s ease-in-out; -moz-transition: all 0.4s ease-in-out; -o-transition: all 0.4s ease-in-out; -ms-transition: all 0.4s ease-in-out; transition: all 0.4s ease-in-out; } .my-ch-item { width: 100%; height: 100%; } /* Grid Images */ .ch-img-1 { background-image: url(/img/month1.jpg); background-size: cover; } .ch-img-2 { background-image: url(/img/month2.jpg); background-size: cover; } .ch-img-3 { background-image: url(/img/month3.jpg); background-size: cover; } .ch-img-4{ background-image: url(/img/month4.jpg); background-size: cover; } .ch-img-5{ background-image: url(/img/month5.jpg); background-size: cover; } .ch-img-6{ background-image: url(/img/month6.jpg); background-size: cover; } .ch-img-7{ background-image: url(/img/month7.jpg); background-size: cover; } .ch-img-8{ background-image: url(/img/month8.jpg); background-size: cover; } .ch-img-9{ background-image: url(/img/month9.jpg); background-size: cover; } /* Grid Layout */ .main{ margin: 0 auto; } .ch-grid { margin: 0px 0, 0, 0; list-style: none; display: inline-block; text-align: center; } .ch-grid:after, .ch-item:before { content: ''; display: table; text-align: center } .ch-grid:after { clear: both; } .ch-grid li { display:inline-block; float: left; } @media only screen and (max-width : 420px){ #logo { width: 60%; margin-top: 1em; } .main { position: fixed; bottom: 0; height: 100vw; } .ch-item, .ch-grid li { width: calc(100vw/3); height: calc(100vw/3); } .content-container { margin-top: 0; } .status-imgs { width: 49px; margin-top: -53px; margin-bottom: 0; } #left-col .panel-heading { padding: 2px 14px !important; } #left-col .panel-group { /*margin: 0;*/ } .dropdown-menu li a { padding: 0.27em !important; } #left-col h1 { margin: 0.2em; } #divider { margin: 0; color: white; font-size: 50px; } #food-list { flex-wrap: wrap; justify-content: center; } #food-list li { width: 32%; } } @media only screen and (min-width : 430px){ #logo { max-width: 300px; } .main { position: relative; width: 495px; } .ch-item, .ch-grid li { width: 165px; height: 165px; } .status-imgs { width: 160px; } #left-col .panel-heading { padding: 10px 14px !important; } #divider { display: none; } .content-container { width: 90%; padding: 0; } .ch-info h3 { padding: 75px 0 0 0; } #food-list li { width: 80%; } } /*@media (min-width: @screen-lg-min){ .main { position: relative; width: 495px; } }*/ /* Hover Text */ .ch-item:hover .ch-info { -webkit-transform: scale(1); -moz-transform: scale(1); -o-transform: scale(1); -ms-transform: scale(1); transform: scale(1); color: white !important; } .ch-info { position: absolute; text-align: center; width: inherit; height: inherit; opacity: 1; -webkit-transition: all 0.4s ease-in-out; -moz-transition: all 0.4s ease-in-out; -o-transition: all 0.4s ease-in-out; -ms-transition: all 0.4s ease-in-out; transition: all 0.4s ease-in-out; -webkit-transform: scale(0); -moz-transform: scale(0); -o-transform: scale(0); -ms-transform: scale(0); transform: scale(0); -webkit-backface-visibility: hidden; } .ch-info h3 { text-transform: uppercase; letter-spacing: 1px; font-size: 20px; padding: 50px 0 0 0; height: 140px; font-family: Arial, sans-serif; } h3 { margin:0; padding:0; font-size:100%; font-weight:normal; text-align: center; }
ivanshen/babybuddy.github.io
css/front_page_style.css
CSS
mit
3,866
--- title: Back Dating Posts author: Andy Choens layout: post category: trip reports excerpt: I have been sloppy keeping this up to date. --- I have been sloppy keeping this up to date. I managed to post quite a few ski pics here and mentionned my bike, but I have failed to post any pictures of my bike in cool places. This is a shame, because my bike has managed to go to some pretty cool places this spring. Since most of these adventures were documented by my Android phone, I know the date of each adventure. This weekend, I am going to go through these pics and post a few back-dated posts to document some of my recent adventures. Update: 2014-06-24: I'm done. I managed to add a number of things I had wanted to put up here. In the future, I'll try to not get behind. I think I need a current events category too. I'll work on that.
Choens/choens.github.io
_posts/2015-06-19-backdating-posts.md
Markdown
mit
845
#!/usr/bin/env python3 # imports go here import sched import time # # Free Coding session for 2015-05-04 # Written by Matt Warren # scheduler = sched.scheduler(time.time, time.sleep) def print_time(): print(time.time()) return True scheduler.enter(3, 1, print_time) scheduler.enter(5, 1, print_time) print(scheduler.queue) scheduler.run() # blocking until all scheduled things finish print("done")
mfwarren/FreeCoding
2015/05/fc_2015_05_04.py
Python
mit
412
<?php namespace Hedronium\SeedCascade; class Inheriter extends MagicResolver { public function get($property) { if ($this->offset === 0) { return null; } else { return $this->seeder->resolveValue( $this->i, $property, $this->offset-1, $this->blocks ); } } public function inherit() { return $this->get($this->property); } public function __invoke() { return $this->inherit(); } public function __toString() { return $this->inherit(); } }
Hedronium/SeedCascade
src/Inheriter.php
PHP
mit
638
--- layout: default title: Sinfonia Transactions tags: - Computer Science --- ###Sinfonia Ideas to think about: 1. Is NFS a good application for Gigapaxos. 2. Did it work for sinfonia because of node locality. 3. If we can use node locality to increase throughput, we can use reconfigurability of gigapaxos to have an evolving database, whose performances gets better with time. Key Term: Distributed Infrastructure Application: Application used to build other application. Features of the system: 1. Provides a paradigm for distributed systems without worrying about message passing protocols.(Instead of system design, design datastructures within sinfonia) 2. Access Data on the system, through a linear address space exported. 3. Minitransaction primitive to handle transactions. System Design: 1) Consists of memory nodes and application nodes. 2) Application nodes contain user library which manipulates memory node 3) Memory nodes keep uninterpreted bytes and exports address space <memory node id, node locality> 4) Minitransactions: Application nodes play the role of co-ordinators 5) Minitransaction class: cmp(memid,addr,len,data),read(memid,addr,len,buf),write(memid,addr,len,data) IMPORTANT:: Mintransaction is structured in a way that for a single memid The projection of the transaction on this memid can be executed in the first phase and then based on a vote.It is committed or rejected This is from the principle of reduce coupling 6) If all compare operations succeed read from location and write to locations 7) Can build more complicated feateures such as swap, atomic reads .. 8) Applications can build their own cache handling management. Data accessed through sinfonia is always current. 9) Fault tolerance through : disk image: written asynchronously Append log: written synchronously Primary Copy replication 10) Load balancing:Application choose where to place data on memory node. Applications get memory load information to perform balancing. Implementation and ALgorithms 1. Modified 2 Phase Commit. ~~~~ Co-ordinator: Init: generate tid Collasce operations per memory node q q_read,q_write,q_compare: D be all memory nodes being involved For all q (paralley) send_prepare(tid,q_read,q_write,q_compare) recv_all_votes: if all vote ok: send_commit else abort Participant q: recv_prepare(D,tid,q_read,q_write,q_compare): Put tid in in_doubt acquire all locks if q_compare success Perform q_read,q_write return vote_ok else: return vote fail recv_accept(tid): if tid not in_doubt: \\recovery co-ordinator fixed it. abort if commit: apply write release locks else: abort ~~~~ 2.Participants acquire locks without blocking . If a transaction fails due to lock acquire failure, it reboots after a random time out. 3.Co-ordinator has no log. Can get away with this because, block on participant failure not on co-ordinator failure. Can resume the transaction by getting back all the votes from all participants. A periodic probe checks for tid in doubt, from this participant get the memory nodes across which the transaction is spread and resumes it. 4.Indoubt log: contains tid after prepare phase of transaction Decided_log: After state is decided Abort_log: After aborted 5.Log garbage collection: A committed tid can be cleaned after it is committed by ever other memory node involved in the transaction. Memory Node periodically sends status information to all other nodes involved in the transaction.Forced aborts are removed after 2 epochs 6. If a transaction can be done using just one memory node, then can be committed in one message. This node locality increases throughput. Can we do this ???? Ask Arun 7. A primary-copy replication, relies on synchrony so can lead to false fail overs. Solution: use lights out management to kill the primary. 8. Applications refer to memory nodes with logical memory id. This is remapped to physical memory at the sinfonia directory server. Application 1. Cluster File System: Application nodes act as cluster nodes. Beating Berkley DB, as it locks per page while sinfonia does it at the granualarity of a memory location. Beating Linux FileSystem, because of sequential write ahead logging. 2. Group Communication: All Process in the group receive, broadcasts in the same order. Implemented by having a tail queue and updating using transactions. - Threaded queue to decrease duration of the transaction. Interesting notes: 1. Key to aceiving scalability is to decouple operations executed by hosts. This is done as sinfonia,provides fine grained address space without imposing structure. 2. Node locality is the opposite of data striping. It seems useless, if there is replication But in this model of master slave, node locality is present at the slave also 3. Batching commit of a transaction with perpare of the next transaction saves round trip time [This mini transaction primitive seems important] 4. Transactions can be tagged to perform, load analysis. 5. By finding the correct application for a defined abstraction. 6. Across transactions,spread load ; within a transaction focus load. Doubts. 1. Because of limited scope, Sinfonia claims to happen in 2 network round trips while database transactions take more than 2(2 to just commit and a start and execute) 2. Is node locality useless, if there is replication. 3. look at the use cases to see number of application nodes vs data nodes 4. What is the advantage of having the co-ordinator not have a log Reading Continuiation: 1) VoltDb 2) Percolator (I have no idea, where I got these but made a note of them) 3)
sandeep06011991/sandeep06011991.github.io
_papers/2017-11-27-Sinfonia.md
Markdown
mit
6,112
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>simple-io: 26 s 🏆</title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.11.1 / simple-io - 1.7.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> simple-io <small> 1.7.0 <span class="label label-success">26 s 🏆</span> </small> </h1> <p>📅 <em><script>document.write(moment("2022-02-26 16:52:27 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-02-26 16:52:27 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-threads base base-unix base conf-findutils 1 Virtual package relying on findutils coq 8.11.1 Formal proof management system num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic ocaml 4.10.2 The OCaml compiler (virtual package) ocaml-base-compiler 4.10.2 Official release 4.10.2 ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.3 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;Li-yao Xia &lt;lysxia@gmail.com&gt;&quot; authors: [ &quot;Li-yao Xia&quot; &quot;Yishuai Li&quot; ] homepage: &quot;https://github.com/Lysxia/coq-simple-io&quot; bug-reports: &quot;https://github.com/Lysxia/coq-simple-io/issues&quot; license: &quot;MIT&quot; dev-repo: &quot;git+https://github.com/Lysxia/coq-simple-io.git&quot; build: [make &quot;build&quot;] run-test: [make &quot;test&quot;] install: [make &quot;install&quot;] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.11&quot; &amp; &lt; &quot;8.16~&quot;} &quot;coq-ext-lib&quot; {&gt;= &quot;0.10.0&quot;} &quot;ocamlbuild&quot; {with-test &amp; &gt;= &quot;0.9.0&quot;} &quot;cppo&quot; {build &amp; &gt;= &quot;1.6.8&quot;} ] tags: [ &quot;date:2022-02-13&quot; &quot;logpath:SimpleIO&quot; &quot;keyword:extraction&quot; &quot;keyword:effects&quot; ] synopsis: &quot;IO monad for Coq&quot; description: &quot;&quot;&quot; This library provides tools to implement IO programs directly in Coq, in a similar style to Haskell. Facilities for formal verification are not included. IO is defined as a parameter with a purely functional interface in Coq, to be extracted to OCaml. Some wrappers for the basic types and functions in the OCaml Pervasives module are provided. Users are free to define their own APIs on top of this IO type.&quot;&quot;&quot; url { src: &quot;https://github.com/Lysxia/coq-simple-io/archive/1.7.0.tar.gz&quot; checksum: &quot;sha512=7c7ba52efb870763b02c1f6e25b703307463698631acba2449de05e66a9f9b4738bc852c3b3e95178752036e1c1da5339beaa5ecb669047b0f10a04737c6cfee&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install 🏜️</h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-simple-io.1.7.0 coq.8.11.1</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam list; echo; ulimit -Sv 4000000; timeout 4h opam install -y --deps-only coq-simple-io.1.7.0 coq.8.11.1</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>2 m 59 s</dd> </dl> <h2>Install 🚀</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam list; echo; ulimit -Sv 16000000; timeout 4h opam install -y -v coq-simple-io.1.7.0 coq.8.11.1</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>26 s</dd> </dl> <h2>Installation size</h2> <p>Total: 605 K</p> <ul> <li>75 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/coqsimpleio_plugin.cmxs</code></li> <li>59 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_Unix.vo</code></li> <li>45 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_Stdlib.vo</code></li> <li>28 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_Float.vo</code></li> <li>28 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_UnsafeNat.vo</code></li> <li>28 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_RawChar.vo</code></li> <li>28 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_String.vo</code></li> <li>26 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_Bytes.vo</code></li> <li>26 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_Unsafe.vo</code></li> <li>26 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_Sys.vo</code></li> <li>25 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_Random.vo</code></li> <li>25 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/SimpleIO.vo</code></li> <li>25 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_StdlibAxioms.vo</code></li> <li>20 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_Unix.glob</code></li> <li>18 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_Stdlib.glob</code></li> <li>17 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_Unix.v</code></li> <li>13 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_Monad.vo</code></li> <li>13 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_Stdlib.v</code></li> <li>10 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_Monad.glob</code></li> <li>8 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/coqsimpleio_plugin.cmx</code></li> <li>7 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/coqsimpleio_plugin.cmxa</code></li> <li>5 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_Exceptions.vo</code></li> <li>4 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_UnsafeNat.glob</code></li> <li>4 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_Monad.v</code></li> <li>4 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_String.glob</code></li> <li>3 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_Float.glob</code></li> <li>3 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_RawChar.glob</code></li> <li>3 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_Float.v</code></li> <li>3 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_String.v</code></li> <li>3 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_MonadFix.vo</code></li> <li>2 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_RawChar.v</code></li> <li>2 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_Bytes.glob</code></li> <li>2 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_Sys.v</code></li> <li>2 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_Unsafe.glob</code></li> <li>2 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_Bytes.v</code></li> <li>2 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_Exceptions.glob</code></li> <li>2 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_Unsafe.v</code></li> <li>2 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_Exceptions.v</code></li> <li>1 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_UnsafeNat.v</code></li> <li>1 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_Random.v</code></li> <li>1 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_Sys.glob</code></li> <li>1 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_Random.glob</code></li> <li>1 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_StdlibAxioms.glob</code></li> <li>1 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_MonadFix.glob</code></li> <li>1 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/SimpleIO.glob</code></li> <li>1 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_MonadFix.v</code></li> <li>1 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/SimpleIO.v</code></li> <li>1 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/coqsimpleio_plugin.cmi</code></li> <li>1 K <code>../ocaml-base-compiler.4.10.2/lib/coq/user-contrib/SimpleIO/IO_StdlibAxioms.v</code></li> </ul> <h2>Uninstall 🧹</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq-simple-io.1.7.0</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣 </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
coq-bench/coq-bench.github.io
clean/Linux-x86_64-4.10.2-2.0.6/released/8.11.1/simple-io/1.7.0.html
HTML
mit
12,661
<?php declare(strict_types=1); namespace EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Command; use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Tools\Console\MetadataFilter; use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Generator\RelationsGenerator; use EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\NamespaceHelper; use EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException; use Exception; use Symfony\Component\Console\Helper\ProgressBar; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class GenerateRelationsCommand extends AbstractCommand { public const OPT_FILTER = 'filter'; public const OPT_FILTER_SHORT = 'f'; /** * @var RelationsGenerator */ protected $relationsGenerator; /** * GenerateRelationsCommand constructor. * * @param RelationsGenerator $relationsGenerator * @param null|string $name * * @throws DoctrineStaticMetaException */ public function __construct( RelationsGenerator $relationsGenerator, ?string $name = null ) { parent::__construct($name); $this->relationsGenerator = $relationsGenerator; } /** * @throws DoctrineStaticMetaException */ protected function configure(): void { try { $this ->setName(AbstractCommand::COMMAND_PREFIX . 'generate:relations') ->setDefinition( [ new InputOption( self::OPT_FILTER, self::OPT_FILTER_SHORT, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'A string pattern used to match entities that should be processed.' ), $this->getProjectRootPathOption(), $this->getProjectRootNamespaceOption(), $this->getSrcSubfolderOption(), ] )->setDescription( 'Generate relations traits for your entities. ' . 'Optionally filter down the list of entities to generate relationship traits for' ); } catch (Exception $e) { throw new DoctrineStaticMetaException( 'Exception in ' . __METHOD__ . ': ' . $e->getMessage(), $e->getCode(), $e ); } } /** * @param InputInterface $input * @param OutputInterface $output * * @return void * @throws DoctrineStaticMetaException * @SuppressWarnings(PHPMD) */ protected function execute(InputInterface $input, OutputInterface $output): void { try { $this->checkOptions($input); $entityManager = $this->getEntityManager(); /** * @var ClassMetadata[] $metadatas */ $metadatas = $entityManager->getMetadataFactory()->getAllMetadata(); $metadatas = MetadataFilter::filter($metadatas, $input->getOption('filter')); $this->relationsGenerator ->setPathToProjectRoot($input->getOption(AbstractCommand::OPT_PROJECT_ROOT_PATH)) ->setProjectRootNamespace($input->getOption(AbstractCommand::OPT_PROJECT_ROOT_NAMESPACE)); $output->writeln( '<comment>Starting relations generation for ' . implode( ' ', $input->getOption('filter') ) . '</comment>' ); $progress = new ProgressBar($output, count($metadatas)); $progress::setFormatDefinition('custom', ' %current%/%max% -- %message%'); $progress->start(); foreach ($metadatas as $metadata) { $progress->setMessage('<comment>Generating for ' . $metadata->getName() . '</comment>'); $this->relationsGenerator->generateRelationCodeForEntity($metadata->getName()); $progress->setMessage('<info>done</info>'); $progress->advance(); } $progress->finish(); $output->writeln('completed'); } catch (Exception $e) { throw new DoctrineStaticMetaException( 'Exception in ' . __METHOD__ . ': ' . $e->getMessage(), $e->getCode(), $e ); } } }
edmondscommerce/doctrine-static-meta
src/CodeGeneration/Command/GenerateRelationsCommand.php
PHP
mit
4,586
<?php class Teammember extends AppModel { public $name = 'Teammember'; // public $displayField = 'name'; // public $order = array('teampriority'); public $belongsTo = array('Team', 'Member'); public $hasMany = array('Trainingsteammember', 'Gamesteammember'); public function beforeFind($queryData) { parent::beforeFind($queryData); $defaultConditions = array('Teammember.season' => Configure::read('Clubman.currentseason')); $queryData['conditions'] = is_array($queryData['conditions']) ? array_merge($queryData['conditions'], $defaultConditions) : $defaultConditions; return $queryData; } }
tribbie/clubman
Model/Teammember.php
PHP
mit
609
<?php // TODO: afterdelete // TODO: processing images /** * This is the model class for table "galleries". * * The followings are the available columns in table 'galleries': * @property string $GalleryId * @property string $ArticleId * @property string $GalleryOrder * * The followings are the available model relations: * @property Articles $article * @property Images[] $images */ class Galleries extends CActiveRecord { /** * Returns the static model of the specified AR class. * @param string $className active record class name. * @return Galleries the static model class */ public static function model($className=__CLASS__) { return parent::model($className); } /** * @return string the associated database table name */ public function tableName() { return 'galleries'; } /** * @return array validation rules for model attributes. */ public function rules() { // NOTE: you should only define rules for those attributes that // will receive user inputs. return array( array('ArticleId, GalleryOrder', 'required'), array('ArticleId, GalleryOrder', 'length', 'max'=>10), // The following rule is used by search(). // Please remove those attributes that should not be searched. array('GalleryId, ArticleId, GalleryOrder', 'safe', 'on'=>'search'), ); } /** * @return array relational rules. */ public function relations() { // NOTE: you may need to adjust the relation name and the related // class name for the relations automatically generated below. return array( 'article' => array(self::BELONGS_TO, 'Articles', 'ArticleId'), 'images' => array(self::HAS_MANY, 'Images', 'GalleryId'), ); } /** * @return array customized attribute labels (name=>label) */ public function attributeLabels() { return array( 'GalleryId' => '', 'ArticleId' => 'ArticleId', 'GalleryOrder' => '#', ); } /** * Retrieves a list of models based on the current search/filter conditions. * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions. */ /** * Retrieves a list of models based on the current search/filter conditions. * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions. */ public function search() { // Warning: Please modify the following code to remove attributes that // should not be searched. $criteria=new CDbCriteria; $criteria->with = array('article'); $criteria->compare('GalleryId',$this->GalleryId,false); $criteria->compare('ArticleId',$this->ArticleId,false); $criteria->compare('article.LangId',Yii::app()->language,false); return new CActiveDataProvider($this, array( 'criteria'=>$criteria, 'sort'=> array( 'defaultOrder'=>array( 'GalleryOrder' => CSort::SORT_DESC, ), 'attributes'=>array(), ), 'pagination'=>false, )); } public function afterSave() { $dir = realpath('./').'/galleries/'.$this->GalleryId; @mkdir($dir); @mkdir($dir.'/tmb'); return parent::afterSave(); } protected function beforeDelete() { Images::model()->deleteAll('GalleryId = '.$this->GalleryId); return parent::beforeDelete(); } protected function afterDelete() { Articles::model()->deleteAll('ArticleId = '.$this->ArticleId); $dir = realpath('./').'/galleries/'.$this->GalleryId; $d = glob($dir.'/tmb/*'); foreach($d as $file) unlink($file); // array_walk($d, 'unlink'); rmdir($dir.'/tmb'); $d = glob($dir.'/*'); foreach($d as $file) unlink($file); // array_walk($d, 'unlink'); rmdir($dir); return parent::afterDelete(); } }
NikolaiJeliazkov/cms1
www/www/protected/app/modules/admin/models/Galleries.php
PHP
mit
3,674
{% extends "base.html" %} {% from "macros.html" import render_flashed_messages %} {% from "macros_forms.html" import render_form %} {% block content %} {{ render_flashed_messages() }} <div class="container"> <h5><small>Editing character</small></h5><h3> {{ character.name }}</h3> {{ render_form(form, class_='inline-form', enctype_='multipart/form-data') }} </div> {% endblock %} {% block bodyscripts %} {{ pagedown.include_pagedown() }} {% endblock %}
Ryu-CZ/flask-dnd
dnd/templates/character_edit.html
HTML
mit
458
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.deploymentmanager.models; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; /** Defines values for RestAuthLocation. */ public enum RestAuthLocation { /** Enum value Query. */ QUERY("Query"), /** Enum value Header. */ HEADER("Header"); /** The actual serialized value for a RestAuthLocation instance. */ private final String value; RestAuthLocation(String value) { this.value = value; } /** * Parses a serialized value to a RestAuthLocation instance. * * @param value the serialized value to parse. * @return the parsed RestAuthLocation object, or null if unable to parse. */ @JsonCreator public static RestAuthLocation fromString(String value) { RestAuthLocation[] items = RestAuthLocation.values(); for (RestAuthLocation item : items) { if (item.toString().equalsIgnoreCase(value)) { return item; } } return null; } @JsonValue @Override public String toString() { return this.value; } }
Azure/azure-sdk-for-java
sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RestAuthLocation.java
Java
mit
1,318
To setup the documentation in the first place we followed: https://samnicholls.net/2016/06/15/how-to-sphinx-readthedocs/ which includes running ```bash cd docs/ sphinx-apidoc -o source/ --ext-autodoc ../src/CompartmentalSystems ``` to create the ```*.rst``` files of the modules in doc/source. This step has to be repeated after new models (or other modules) have been added. At the moment the CARDAMON model is excluded since sphinx cannot import it. To update the documentation run ```bash sphinx-build -b html source/ build/ ``` here.
MPIBGC-TEE/CompartmentalSystems
build_docs/README.md
Markdown
mit
542
<?php namespace Tecnotek\Bundle\AsiloBundle\DataFixtures\ORM; use Doctrine\Common\DataFixtures\Doctrine; use Doctrine\Common\DataFixtures\FixtureInterface; use Doctrine\Common\Persistence\ObjectManager; use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Tecnotek\Bundle\AsiloBundle\Entity\User; class LoadUserData implements FixtureInterface, ContainerAwareInterface { /** * @var ContainerInterface */ private $container; /** * {@inheritDoc} */ public function setContainer(ContainerInterface $container = null) { $this->container = $container; } /** * Load data fixtures with the passed EntityManager */ public function load(ObjectManager $manager) { //Create Roles $roleAdmin = new \Tecnotek\Bundle\AsiloBundle\Entity\Role(); $roleAdmin->setName("Administrator"); $roleAdmin->setRole("ROLE_ADMIN"); $manager->persist($roleAdmin); $roleEmployee = new \Tecnotek\Bundle\AsiloBundle\Entity\Role(); $roleEmployee->setName("Employee"); $roleEmployee->setRole("ROLE_EMPLOYEE"); $manager->persist($roleEmployee); $roleUser = new \Tecnotek\Bundle\AsiloBundle\Entity\Role(); $roleUser->setName("User"); $roleUser->setRole("ROLE_USER"); $manager->persist($roleUser); /*** Create Users ***/ $admin = new User(); $encoder = $this->container ->get('security.encoder_factory') ->getEncoder($admin); $admin->setUsername('administrador')->setEmail('admin@tecnotek.com') ->setPassword($encoder->encodePassword('p1l4rg4mb04', $admin->getSalt())) ->setName("Administrator")->setLastname("Site")->setCellPhone(""); $admin->getUserRoles()->add($roleAdmin); $manager->persist($admin); /*** Create Marital Status ***/ $this->createMaritalStatus($manager); /*** Create Nutritional Status ***/ $this->createNutriotionalStatus($manager); /*** Create Scholarities ***/ $this->createScholarities($manager); /*** Create Pentions ***/ $this->createPentions($manager); /*** Create all the general Cataloges ***/ $this->createCatalogs($manager); $manager->flush(); } // End of method: load public function createMaritalStatus(ObjectManager $manager){ $viudo = new \Tecnotek\Bundle\AsiloBundle\Entity\MaritalStatus(); $viudo->setName("Viudo(a)"); $manager->persist($viudo); $soltero = new \Tecnotek\Bundle\AsiloBundle\Entity\MaritalStatus(); $soltero->setName("Soltero(a)"); $manager->persist($soltero); $separado = new \Tecnotek\Bundle\AsiloBundle\Entity\MaritalStatus(); $separado->setName("Separado(a)"); $manager->persist($separado); $divorciado = new \Tecnotek\Bundle\AsiloBundle\Entity\MaritalStatus(); $divorciado->setName("Divorciado(a)"); $manager->persist($divorciado); $casado = new \Tecnotek\Bundle\AsiloBundle\Entity\MaritalStatus(); $casado->setName("Casado(a)"); $manager->persist($casado); } public function createNutriotionalStatus(ObjectManager $manager){ $normal = new \Tecnotek\Bundle\AsiloBundle\Entity\NutritionalStatus(); $normal->setName("Normal"); $manager->persist($normal); $desnutricion = new \Tecnotek\Bundle\AsiloBundle\Entity\NutritionalStatus(); $desnutricion->setName("Desnutrición"); $manager->persist($desnutricion); $sobrepeso = new \Tecnotek\Bundle\AsiloBundle\Entity\NutritionalStatus(); $sobrepeso->setName("Sobrepeso"); $manager->persist($sobrepeso); $obesidad = new \Tecnotek\Bundle\AsiloBundle\Entity\NutritionalStatus(); $obesidad->setName("Obesidad"); $manager->persist($obesidad); } public function createScholarities(ObjectManager $manager){ $primariaIncompleta = new \Tecnotek\Bundle\AsiloBundle\Entity\Scholarity(); $primariaIncompleta->setName("Primaria incompleta"); $manager->persist($primariaIncompleta); $primariaCompleta = new \Tecnotek\Bundle\AsiloBundle\Entity\Scholarity(); $primariaCompleta->setName("Primaria completa"); $manager->persist($primariaCompleta); $secundariaIncompleta = new \Tecnotek\Bundle\AsiloBundle\Entity\Scholarity(); $secundariaIncompleta->setName("Secundaria incompleta"); $manager->persist($secundariaIncompleta); $secundariaCompleta = new \Tecnotek\Bundle\AsiloBundle\Entity\Scholarity(); $secundariaCompleta->setName("Secundaria Completa"); $manager->persist($secundariaCompleta); $univsersitariaIncompleta = new \Tecnotek\Bundle\AsiloBundle\Entity\Scholarity(); $univsersitariaIncompleta->setName("Universitaria incompleta"); $manager->persist($univsersitariaIncompleta); $univsersitariaCompleta = new \Tecnotek\Bundle\AsiloBundle\Entity\Scholarity(); $univsersitariaCompleta->setName("Universitaria Completa"); $manager->persist($univsersitariaCompleta); } public function createPentions(ObjectManager $manager) { $pention = new \Tecnotek\Bundle\AsiloBundle\Entity\Pention(); $pention->setName("OTRA"); $manager->persist($pention); $pention = new \Tecnotek\Bundle\AsiloBundle\Entity\Pention(); $pention->setName("CCSS IVM"); $manager->persist($pention); $pention = new \Tecnotek\Bundle\AsiloBundle\Entity\Pention(); $pention->setName("CCSS MUERTE"); $manager->persist($pention); $pention = new \Tecnotek\Bundle\AsiloBundle\Entity\Pention(); $pention->setName("CCSS RNC"); $manager->persist($pention); $pention = new \Tecnotek\Bundle\AsiloBundle\Entity\Pention(); $pention->setName("CCSS VEJEZ"); $manager->persist($pention); $pention = new \Tecnotek\Bundle\AsiloBundle\Entity\Pention(); $pention->setName("HACIENDA"); $manager->persist($pention); $pention = new \Tecnotek\Bundle\AsiloBundle\Entity\Pention(); $pention->setName("MAGISTERIO"); $manager->persist($pention); $pention = new \Tecnotek\Bundle\AsiloBundle\Entity\Pention(); $pention->setName("MTSS"); $manager->persist($pention); } public function createCatalogs(ObjectManager $manager) { $walk = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Sport(); $walk->setName("Caminata"); $manager->persist($walk); $swing = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Sport(); $swing->setName("Natación"); $manager->persist($swing); $relaxingExexcices = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Sport(); $relaxingExexcices->setName("Ejercicios de Relajación"); $manager->persist($relaxingExexcices); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Reading(); $entity->setName("La Biblia"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Reading(); $entity->setName("Periódico"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Reading(); $entity->setName("Revistas"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Writing(); $entity->setName("Vivencias"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Writing(); $entity->setName("Oraciones"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Manuality(); $entity->setName("Pintar"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Manuality(); $entity->setName("Dibujar"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Music(); $entity->setName("Popular"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Music(); $entity->setName("Bolero"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Music(); $entity->setName("70's"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Music(); $entity->setName("80's"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Music(); $entity->setName("Romántica"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Music(); $entity->setName("Cristiana"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Instrument(); $entity->setName("Guitarra"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Instrument(); $entity->setName("Pianola"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Instrument(); $entity->setName("Maracas"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\EntertainmentActivity(); $entity->setName("Charlas"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\EntertainmentActivity(); $entity->setName("Fiestas"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\EntertainmentActivity(); $entity->setName("Cine Forum"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\EntertainmentActivity(); $entity->setName("Talleres"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\RoomGame(); $entity->setName("Papi Futbol"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\RoomGame(); $entity->setName("Ajedrez"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\RoomGame(); $entity->setName("Cartas"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\RoomGame(); $entity->setName("Bingo"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Dance(); $entity->setName("Bolero"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Dance(); $entity->setName("Merengue"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Religion(); $entity->setName("Católica"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Religion(); $entity->setName("Evangélica"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Religion(); $entity->setName("Protestante"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\SpiritualActivity(); $entity->setName("Ayudar a los demás"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\SpiritualActivity(); $entity->setName("Rezar el rosario"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\SpiritualActivity(); $entity->setName("Enseñar la Biblia"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\SpiritualActivity(); $entity->setName("Encomendarce al Señor"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\SpiritualActivity(); $entity->setName("Culto"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\SpiritualActivity(); $entity->setName("Hora Santa"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\SpiritualActivity(); $entity->setName("Santa Misa"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\SleepHabit(); $entity->setName("Suele levantarse"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\SleepHabit(); $entity->setName("Necesita ir al baño varias veces"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\SleepHabit(); $entity->setName("Durante el día duerme mucho"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\SleepHabit(); $entity->setName("Necesita dormir con la luz encendida"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Disease(); $entity->setName("Alcoholismo"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Disease(); $entity->setName("Cáncer"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Disease(); $entity->setName("Cardiopatía"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Disease(); $entity->setName("Cirrosis"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Disease(); $entity->setName("Cáncer de Seno"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Disease(); $entity->setName("Accidente Vascular Periférico"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Disease(); $entity->setName("Alzheimer"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Disease(); $entity->setName("Enfermedad Renal"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Disease(); $entity->setName("Sarampión"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Disease(); $entity->setName("Paperas"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Disease(); $entity->setName("Diabetes Mellitus"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Disease(); $entity->setName("Hipotiroidismo"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Disease(); $entity->setName("Hipertensión Arterial"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Disease(); $entity->setName("Diverticulitis"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Disease(); $entity->setName("Ulcera gastrica"); $manager->persist($entity); $entity = new \Tecnotek\Bundle\AsiloBundle\Entity\Catalog\Disease(); $entity->setName("Cáncer de Próstata"); $manager->persist($entity); } } // End of Class
selimcr/centroancianos
src/Tecnotek/Bundle/AsiloBundle/DataFixtures/ORM/LoadUserData.php
PHP
mit
15,922
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Data; namespace IISLogParser { // My best guess, parse each line to a dictionary, since all the log files could have different columns public class LogParser { private List<Dictionary<string, string>> _logFile; private List<string> _fieldNames; public DataTable GridList { get { DataTable table = new DataTable(); foreach (string field in _fieldNames) table.Columns.Add(field); foreach (Dictionary<string, string> line in _logFile) { DataRow row = table.NewRow(); foreach (string field in _fieldNames) { row[field] = line[field]; } table.Rows.Add(row); } return table; } } public List<string> FieldNames { get { return _fieldNames; } } public void ParseLog(string fileName) { ParseLog(fileName, null); } public void ParseLog(string fileName, LogParserProgress progress) { _fieldNames = new List<string>(); _logFile = new List<Dictionary<string, string>>(); IEnumerable<string> lines = File.ReadLines(fileName); var total = lines.Count(); var position = 0; foreach (string line in lines) { if (progress != null) { progress(this, position, total); position++; } // Check for the IIS header in the log file if (line.StartsWith("#Fields")) _fieldNames = ParseFieldNames(line, _fieldNames); if (!line.StartsWith("#") && _fieldNames.Count > 0) { _logFile.Add(ParseLine(line, _fieldNames)); } } } public List<string> Distinct(string field) { List<string> ret = new List<string>(); foreach (Dictionary<string, string> row in _logFile) { ret.Add(row[field]); } return ret.Distinct().ToList(); } public DictionaryCount DistinctCount(string field) { DictionaryCount ret = new DictionaryCount(); foreach (Dictionary<string, string> row in _logFile) { ret.Add(row[field]); } return ret; } private Dictionary<string, string> ParseLine(string line, List<string> fieldNames) { Dictionary<string, string> ret = new Dictionary<string, string>(); string[] fields = line.Split(' '); if (fields.Count() == fieldNames.Count) { for (int i = 0; i < fieldNames.Count; i++) { ret[fieldNames[i]] = fields[i]; } } return ret; } private List<string> ParseFieldNames(string line, List<string> compare) { List<string> ret = new List<string>(); string names = line.Split(':')[1]; string[] fields = names.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); ret = fields.ToList<string>(); if (!CompareFieldNames(ret, compare)) throw new Exception("FieldNames are different!"); return ret; } private bool CompareFieldNames(List<string> newList, List<string> oldList) { bool ret = true; try { for (int i = 0; i < oldList.Count; i++) { if (newList[i] != oldList[i]) { ret = false; break; } } } catch { // We would get here if one list is larger than the other ret = false; } if (oldList.Count != newList.Count) ret = false; if (oldList.Count == 0) ret = true; return ret; } } }
kenwilcox/IISLogViewer
IISLogParser/LogParser.cs
C#
mit
3,702
<template> <ai-dialog style="width:700px"> <ai-dialog-header> <h2>${title}</h2> </ai-dialog-header> <ai-dialog-body> <form class="form-horizontal"> <div class="form-group"> <label for="txtJbLetter" class="col-sm-2 control-label">JbLetter</label> <div class="col-sm-10"> <input type="text" id="txtJbLetter" class="form-control" value.bind="jbselection.JbLetter"> </div> </div> <div class="form-group"> <label for="txtJbNumberA" class="col-sm-2 control-label">JbNumberA</label> <div class="col-sm-10"> <input type="text" id="txtJbNumberA" class="form-control" value.bind="jbselection.JbNumberA"> </div> </div> <div class="form-group"> <label for="txtJbNumberB" class="col-sm-2 control-label">JbNumberB</label> <div class="col-sm-10"> <input type="text" id="txtJbNumberB" class="form-control" value.bind="jbselection.JbNumberB"> </div> </div> <div class="form-group"> <label for="txtJbNumeric" class="col-sm-2 control-label">JbNumeric</label> <div class="col-sm-10"> <input type="text" id="txtJbNumeric" class="form-control" value.bind="jbselection.JbNumeric"> </div> </div> <div class="form-group"> <label for="txtA1Song" class="col-sm-2 control-label">A1Song</label> <div class="col-sm-10"> <input type="text" id="txtA1Song" class="form-control" value.bind="jbselection.A1Song"> </div> </div> <div class="form-group"> <label for="txtA2Song" class="col-sm-2 control-label">A2Song</label> <div class="col-sm-10"> <input type="text" id="txtA2Song" class="form-control" value.bind="jbselection.A2Song"> </div> </div> <div class="form-group"> <label for="txtB1Song" class="col-sm-2 control-label">B1Song</label> <div class="col-sm-10"> <input type="text" id="txtB1Song" class="form-control" value.bind="jbselection.B1Song"> </div> </div> <div class="form-group"> <label for="txtB2Song" class="col-sm-2 control-label">B2Song</label> <div class="col-sm-10"> <input type="text" id="txtB2Song" class="form-control" value.bind="jbselection.B2Song"> </div> </div> <div class="form-group"> <label for="txtArtist1" class="col-sm-2 control-label">Artist1</label> <div class="col-sm-10"> <input type="text" id="txtArtist1" class="form-control" value.bind="jbselection.Artist1"> </div> </div> <div class="form-group"> <label for="txtArtist2" class="col-sm-2 control-label">Artist2</label> <div class="col-sm-10"> <input type="text" id="txtArtist2" class="form-control" value.bind="jbselection.Artist2"> </div> </div> <div class="form-group"> <label for="txtDiscogsLink" class="col-sm-2 control-label">DiscogsLink</label> <div class="col-sm-10"> <input type="text" id="txtDiscogsLink" class="form-control" value.bind="jbselection.DiscogsLink"> </div> </div> <div class="form-group"> <label for="txtSpotifyLink" class="col-sm-2 control-label">SpotifyLink</label> <div class="col-sm-10"> <input type="text" id="txtSpotifyLink" class="form-control" value.bind="jbselection.SpotifyUri"> </div> </div> <div class="form-group"> <label for="txtImageStripTemplate" class="col-sm-2 control-label">ImageStripTemplate</label> <div class="col-sm-10"> <input type="text" id="txtImageStripTemplate" class="form-control" value.bind="jbselection.ImageStripTemplate"> </div> </div> <div class="form-group"> <label for="txtMusicCategory" class="col-sm-2 control-label">MusicCategory</label> <div class="col-sm-10"> <input type="text" id="txtMusicCategory" class="form-control" value.bind="jbselection.MusicCategory"> </div> </div> </form> </ai-dialog-body> <ai-dialog-footer> <button click.trigger="controller.cancel()" class="btn btn-default">Cancel</button> <button click.trigger="controller.ok(jbselection)" class="btn btn-primary">Save</button> </ai-dialog-footer> </ai-dialog> <style> ai-dialog-overlay.active { background-color: black; opacity: .5; } </style> </template>
larssima/AmiJukeBoxRemote
AmiJukeBoxRemote/gui/src/Views/edit-selections-dlg.html
HTML
mit
5,534
require(['common', 'jquery.metisMenu', 'layui', 'layers',"tools","ajaxurl", 'text!/assets/popup/del-news.html', 'text!/assets/popup/clear-news.html','text!/assets/popup/shield-news.html'], function (common, undefined, layui, layers,tool,ajaxurl,delNews, clearNews, shieldNews) { var main = { /** * [admin description] 获取用户信息 * @return {[type]} [description] */ admin:function(){ var userinfo = common.getUserInfo(); if(userinfo){ vm.userinfo = userinfo; } }, /** * 树形菜单 */ sideMenu: function () { Vue.nextTick(function () { $('#side-menu').metisMenu(); }) }, /** * 清空未读信息 */ DelNoread:function(type,sontype,callback){ tool.ajax({ url: ajaxurl.sms.delUnread, type: 'get', data:{ employee_id:vm.userinfo.id, type:type, sontype:sontype, }, success: function (result) { if (result.code == 1) { // 渲染到vue数据层 typeof callback === 'function' && callback.call(this); } } }); }, /** * 获取树形菜单数据 */ getNavData: function (type,sontype,callback) { tool.ajax({ url: ajaxurl.sms.big, type: 'get', data:{employee_id:vm.userinfo.id,}, success: function (result) { if (result.code == 1) { main.clickTypeCss(type); // 渲染到vue数据层 if(type !=null ){ vm.navData = result.data; main.getTypeData(type); main.getNewsData(type,sontype); // vm.allnewsNum = 888; for(var i=0,len=result.data.length;i<len;i++){ if(result.data[i].id == type){ if(result.data[i].noread != 0){ vm.allnewsNum = result.data[i].noread; }else{ vm.allnewsNum = ''; } } } typeof callback === 'function' && callback.call(this); }else{ vm.TypeId = result.data[0].id; main.DelNoread(result.data[0].id,'',function(){ main.getTypeData(result.data[0].id); main.getNewsData(result.data[0].id); vm.navData = result.data; // console.log(result.data[0].noread); }); vm.title = result.data[0].name; } } else { layers.toast(result.message); } } }); }, /** * 获取分类菜单数据 */ getTypeData: function (id) { tool.ajax({ url: ajaxurl.sms.small, type: 'get', data: {employee_id:vm.userinfo.id,type:id}, success: function (result) { if (result.code == 1) { // 渲染到vue数据层 main.clickSontypeCss(id); vm.TypeData = result.data; // main.getNewsData(id); } else { layers.toast(result.message); } } }); }, /** * 消息列表数据 */ getNewsData:function(id,sontype, callback){ layers.load(function (indexs) { vm.isLoadingIndex = indexs; }); tool.ajax({ url: ajaxurl.sms.List, type: 'get', data: { employee_id:vm.userinfo.id, type:id, sontype:sontype, page:vm.newsInfo.curpage, pagesize:vm.newsInfo.pagesize }, success: function (result) { if (result.code == 1) { // 渲染到vue数据层 vm.newsData = result.data; if(vm.newsData[0]){ vm.count=vm.newsData[0].count; }else{ vm.count=0; } main.followPage(); setTimeout(function(){ main.clickTypeCss(id); main.clickSontypeCss(sontype); }, 0); typeof callback === 'function' && callback.call(this); layers.closed(vm.isLoadingIndex); } else { layers.toast(result.message); } } }); /* 渲染到vue数据层 */ // vm.tableList = newsList; /* 实例化日期,表格 */ layui.use(['element', 'laypage', 'layer'], function(){ var $ = layui.jquery, laypage = layui.laypage, layer = layui.layer, element = layui.element; //Tab的切换功能,切换事件监听等,需要依赖element模块 /*分页器*/ laypage.render({ elem: 'demo8' ,count: 1000 ,layout: ['limit', 'prev', 'page', 'next'] }); //触发事件 var active = { tabAdd: function(){ //新增一个Tab项 element.tabAdd('demo', { title: '新选项'+ (Math.random()*1000|0) //用于演示 ,content: '内容'+ (Math.random()*1000|0) ,id: new Date().getTime() //实际使用一般是规定好的id,这里以时间戳模拟下 }) } ,tabDelete: function(othis){ //删除指定Tab项 element.tabDelete('demo', '44'); //删除:“商品管理” othis.addClass('layui-btn-disabled'); } ,tabChange: function(){ //切换到指定Tab项 element.tabChange('demo', '22'); //切换到:用户管理 } }; $('.site-demo-active').on('click', function(){ var othis = $(this), type = othis.data('type'); active[type] ? active[type].call(this, othis) : ''; }); //Hash地址的定位 var layid = location.hash.replace(/^#test=/, ''); element.tabChange('test', layid); element.on('tab(test)', function(elem){ location.hash = 'test='+ $(this).attr('lay-id'); }); }); }, /** * 清除分组下消息 */ delGroup:function(type,sontype,smsId){ tool.ajax({ url: ajaxurl.sms.delGroup, type: 'get', data:{ employee_id:vm.userinfo.id, type:type, sontype:sontype, sms_id:smsId, }, success: function (result) { if (result.code == 1) { layers.toast('消息已清理'); } else { layers.toast(result.message); } } }); }, /** * 删除消息询问框 */ delNews: function (type,sontype,smsId) { layers.confirm({ title: '提示', content: delNews, btn2: function(index, layero){ // btn 1 确定回调 main.delGroup(type,sontype,smsId); main.getNewsData(type,sontype); } }); }, /** * 清理消息询问框 */ clearNews: function (type,sontype) { layers.confirm({ title: '提示', content: clearNews, btn2: function(index, layero){ // btn 1 确定回调 main.delGroup(type,sontype); main.getNewsData(type,sontype); } }); }, /** 屏蔽系统消息 */ shieldNews: function () { layers.confirm({ title: '提示', content: shieldNews, btn2: function (index, layero) { // 确认的回调 } }); }, /** 大分组样式 */ clickTypeCss:function(id){ $('li[data-type="'+id+'"]').siblings().removeClass('active'); $('li[data-type="'+id+'"]').addClass('active'); // $(event.currentTarget).addClass('active'); }, /** 小分组样式 */ clickSontypeCss:function(id){ $('li[data-type="'+id+'"]').siblings().removeClass('sm-active'); $('li[data-type="'+id+'"]').addClass('sm-active'); }, /** 页面url获取到的收据加载 */ GainUrlData:function(){ // 获取路由参数id的值 var urls = tool.getUrlArgs(); if(urls.has){ vm.TypeId = urls.data.type; vm.SonTypeId = urls.data.sontype; // main.DelNoread(vm.TypeId,vm.SonTypeId); main.getNavData(vm.TypeId,vm.SonTypeId); main.getNewsData(vm.TypeId,vm.SonTypeId,function(){ main.clickTypeCss(vm.TypeId); main.clickSontypeCss(vm.SonTypeId); }) }else{ main.DelNoread(1,'',function(){ main.getNavData(); }) } }, /** 分页 */ followPage: function () { layui.use(['laypage'], function () { var laypage = layui.laypage; laypage.render({ elem: 'follow-page', count: vm.count //数据总数, ,limit: vm.newsInfo.pagesize //每页显示条数, ,curr: vm.newsInfo.curpage //当前页数 , ,jump: function (obj, first) { if (!first) { vm.newsInfo.curpage = obj.curr; main.getNewsData(vm.TypeId,vm.SonTypeId); } } }); }); }, }; /** * 实例化 ViewModel */ var vm = new Vue({ el: '#app', data: { list:'',// 侧栏树形菜单 navData:'',// 侧栏树形菜单 newsData:'', noMassage: '', TypeData:'', TypeId:'',//大分类ID SonTypeId:'',//小分类ID newsInfo:{pagesize:10,curpage:1},//初始化分页信息 urlType:'', urlsonType:'', count:'', allnewsNum:'', userinfo:'', title:'',//header 标题 }, methods: { clearNews: function () { main.clearNews(that); }, shieldNews: function () { main.shieldNews(that); }, /** * 点击事件 */ getType:function(id,tit){ vm.newsInfo.pagesize = 10; vm.newsInfo.curpage = 1; $('.site-page a').eq(0).siblings().removeClass('active') $('.site-page a').eq(0).addClass('active') main.clickSontypeCss(00); vm.TypeId = id; vm.SonTypeId =''; vm.title = tit; // main.getTypeData(id); main.DelNoread(id,'',function(){ main.getNavData(id); }); }, getSontype:function(id){ vm.newsInfo.pagesize = 10; vm.newsInfo.curpage = 1; $('.site-page a').eq(0).siblings().removeClass('active') $('.site-page a').eq(0).addClass('active') vm.SonTypeId = id; main.DelNoread(vm.TypeId,id,function(){ main.getNavData(vm.TypeId,id); }); // main.getNewsData(vm.TypeId,id); }, delOneNews:function(smsId){ main.delNews(vm.TypeId,vm.SonTypeId,smsId); }, clearallNews:function(){ if(vm.SonTypeId != ''){ main.delNews(vm.TypeId,vm.SonTypeId); }else{ main.delNews(vm.TypeId); } }, /** * 设置每页展示条数 */ onpageSize: function (event,i) { //设置每页展示条数 this.newsInfo.pagesize = i; this.newsInfo.curpage = 1; $(event.target).siblings().removeClass('active'); $(event.target).addClass('active'); main.getNewsData(vm.TypeId,vm.SonTypeId); }, } }); /** * 初始化 * @private */ var _init = function () { common.getTabLink(); main.GainUrlData(); main.admin(); }; _init(); });
ifyour/Mr.Stock.CRM
js/app/message.js
JavaScript
mit
14,886
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Class template bs_set</title> <link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> <link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset"> <link rel="up" href="../../intrusive/reference.html#header.boost.intrusive.bs_set_hpp" title="Header &lt;boost/intrusive/bs_set.hpp&gt;"> <link rel="prev" href="bs_multiset.html" title="Class template bs_multiset"> <link rel="next" href="make_bs_multiset.html" title="Struct template make_bs_multiset"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table cellpadding="2" width="100%"><tr> <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td> <td align="center"><a href="../../../../index.html">Home</a></td> <td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td> <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> <td align="center"><a href="../../../../more/index.htm">More</a></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="bs_multiset.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../intrusive/reference.html#header.boost.intrusive.bs_set_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="make_bs_multiset.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a> </div> <div class="refentry"> <a name="boost.intrusive.bs_set"></a><div class="titlepage"></div> <div class="refnamediv"> <h2><span class="refentrytitle">Class template bs_set</span></h2> <p>boost::intrusive::bs_set</p> </div> <h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2> <div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../intrusive/reference.html#header.boost.intrusive.bs_set_hpp" title="Header &lt;boost/intrusive/bs_set.hpp&gt;">boost/intrusive/bs_set.hpp</a>&gt; </span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">,</span> <span class="keyword">class</span> <span class="special">...</span> Options<span class="special">&gt;</span> <span class="keyword">class</span> <a class="link" href="bs_set.html" title="Class template bs_set">bs_set</a> <span class="special">{</span> <span class="keyword">public</span><span class="special">:</span> <span class="comment">// types</span> <span class="keyword">typedef</span> <span class="identifier">implementation_defined</span><span class="special">::</span><span class="identifier">value_type</span> <a name="boost.intrusive.bs_set.value_type"></a><span class="identifier">value_type</span><span class="special">;</span> <span class="keyword">typedef</span> <span class="identifier">implementation_defined</span><span class="special">::</span><span class="identifier">key_type</span> <a name="boost.intrusive.bs_set.key_type"></a><span class="identifier">key_type</span><span class="special">;</span> <span class="keyword">typedef</span> <span class="identifier">implementation_defined</span><span class="special">::</span><span class="identifier">value_traits</span> <a name="boost.intrusive.bs_set.value_traits"></a><span class="identifier">value_traits</span><span class="special">;</span> <span class="keyword">typedef</span> <span class="identifier">implementation_defined</span><span class="special">::</span><span class="identifier">pointer</span> <a name="boost.intrusive.bs_set.pointer"></a><span class="identifier">pointer</span><span class="special">;</span> <span class="keyword">typedef</span> <span class="identifier">implementation_defined</span><span class="special">::</span><span class="identifier">const_pointer</span> <a name="boost.intrusive.bs_set.const_pointer"></a><span class="identifier">const_pointer</span><span class="special">;</span> <span class="keyword">typedef</span> <span class="identifier">implementation_defined</span><span class="special">::</span><span class="identifier">reference</span> <a name="boost.intrusive.bs_set.reference"></a><span class="identifier">reference</span><span class="special">;</span> <span class="keyword">typedef</span> <span class="identifier">implementation_defined</span><span class="special">::</span><span class="identifier">const_reference</span> <a name="boost.intrusive.bs_set.const_reference"></a><span class="identifier">const_reference</span><span class="special">;</span> <span class="keyword">typedef</span> <span class="identifier">implementation_defined</span><span class="special">::</span><span class="identifier">difference_type</span> <a name="boost.intrusive.bs_set.difference_type"></a><span class="identifier">difference_type</span><span class="special">;</span> <span class="keyword">typedef</span> <span class="identifier">implementation_defined</span><span class="special">::</span><span class="identifier">size_type</span> <a name="boost.intrusive.bs_set.size_type"></a><span class="identifier">size_type</span><span class="special">;</span> <span class="keyword">typedef</span> <span class="identifier">implementation_defined</span><span class="special">::</span><span class="identifier">value_compare</span> <a name="boost.intrusive.bs_set.value_compare"></a><span class="identifier">value_compare</span><span class="special">;</span> <span class="keyword">typedef</span> <span class="identifier">implementation_defined</span><span class="special">::</span><span class="identifier">key_compare</span> <a name="boost.intrusive.bs_set.key_compare"></a><span class="identifier">key_compare</span><span class="special">;</span> <span class="keyword">typedef</span> <span class="identifier">implementation_defined</span><span class="special">::</span><span class="identifier">iterator</span> <a name="boost.intrusive.bs_set.iterator"></a><span class="identifier">iterator</span><span class="special">;</span> <span class="keyword">typedef</span> <span class="identifier">implementation_defined</span><span class="special">::</span><span class="identifier">const_iterator</span> <a name="boost.intrusive.bs_set.const_iterator"></a><span class="identifier">const_iterator</span><span class="special">;</span> <span class="keyword">typedef</span> <span class="identifier">implementation_defined</span><span class="special">::</span><span class="identifier">reverse_iterator</span> <a name="boost.intrusive.bs_set.reverse_iterator"></a><span class="identifier">reverse_iterator</span><span class="special">;</span> <span class="keyword">typedef</span> <span class="identifier">implementation_defined</span><span class="special">::</span><span class="identifier">const_reverse_iterator</span> <a name="boost.intrusive.bs_set.const_reverse_iterator"></a><span class="identifier">const_reverse_iterator</span><span class="special">;</span> <span class="keyword">typedef</span> <span class="identifier">implementation_defined</span><span class="special">::</span><span class="identifier">insert_commit_data</span> <a name="boost.intrusive.bs_set.insert_commit_data"></a><span class="identifier">insert_commit_data</span><span class="special">;</span> <span class="keyword">typedef</span> <span class="identifier">implementation_defined</span><span class="special">::</span><span class="identifier">node_traits</span> <a name="boost.intrusive.bs_set.node_traits"></a><span class="identifier">node_traits</span><span class="special">;</span> <span class="keyword">typedef</span> <span class="identifier">implementation_defined</span><span class="special">::</span><span class="identifier">node</span> <a name="boost.intrusive.bs_set.node"></a><span class="identifier">node</span><span class="special">;</span> <span class="keyword">typedef</span> <span class="identifier">implementation_defined</span><span class="special">::</span><span class="identifier">node_ptr</span> <a name="boost.intrusive.bs_set.node_ptr"></a><span class="identifier">node_ptr</span><span class="special">;</span> <span class="keyword">typedef</span> <span class="identifier">implementation_defined</span><span class="special">::</span><span class="identifier">const_node_ptr</span> <a name="boost.intrusive.bs_set.const_node_ptr"></a><span class="identifier">const_node_ptr</span><span class="special">;</span> <span class="keyword">typedef</span> <span class="identifier">implementation_defined</span><span class="special">::</span><span class="identifier">node_algorithms</span> <a name="boost.intrusive.bs_set.node_algorithms"></a><span class="identifier">node_algorithms</span><span class="special">;</span> <span class="comment">// <a class="link" href="bs_set.html#boost.intrusive.bs_setconstruct-copy-destruct">construct/copy/destruct</a></span> <a class="link" href="bs_set.html#idm45971717154192-bb"><span class="identifier">bs_set</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span> <span class="keyword">explicit</span> <a class="link" href="bs_set.html#idm45971717151040-bb"><span class="identifier">bs_set</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">key_compare</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">value_traits</span> <span class="special">&amp;</span> <span class="special">=</span> <span class="identifier">value_traits</span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Iterator<span class="special">&gt;</span> <a class="link" href="bs_set.html#idm45971717145920-bb"><span class="identifier">bs_set</span></a><span class="special">(</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">Iterator</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">key_compare</span> <span class="special">&amp;</span> <span class="special">=</span> <span class="identifier">key_compare</span><span class="special">(</span><span class="special">)</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">value_traits</span> <span class="special">&amp;</span> <span class="special">=</span> <span class="identifier">value_traits</span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span> <a class="link" href="bs_set.html#idm45971717137456-bb"><span class="identifier">bs_set</span></a><span class="special">(</span><a class="link" href="bs_set.html" title="Class template bs_set">bs_set</a> <span class="special">&amp;&amp;</span><span class="special">)</span><span class="special">;</span> <a class="link" href="bs_set.html" title="Class template bs_set">bs_set</a> <span class="special">&amp;</span> <a class="link" href="bs_set.html#idm45971717133152-bb"><span class="keyword">operator</span><span class="special">=</span></a><span class="special">(</span><a class="link" href="bs_set.html" title="Class template bs_set">bs_set</a> <span class="special">&amp;&amp;</span><span class="special">)</span><span class="special">;</span> <a class="link" href="bs_set.html#idm45971717130336-bb"><span class="special">~</span><span class="identifier">bs_set</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span> <span class="comment">// <a class="link" href="bs_set.html#idm45971717638928-bb">public member functions</a></span> <span class="identifier">iterator</span> <a class="link" href="bs_set.html#idm45971717638368-bb"><span class="identifier">begin</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="identifier">const_iterator</span> <a class="link" href="bs_set.html#idm45971717634528-bb"><span class="identifier">begin</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="identifier">const_iterator</span> <a class="link" href="bs_set.html#idm45971717630688-bb"><span class="identifier">cbegin</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="identifier">iterator</span> <a class="link" href="bs_set.html#idm45971717626848-bb"><span class="identifier">end</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="identifier">const_iterator</span> <a class="link" href="bs_set.html#idm45971717623008-bb"><span class="identifier">end</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="identifier">const_iterator</span> <a class="link" href="bs_set.html#idm45971717619168-bb"><span class="identifier">cend</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="identifier">reverse_iterator</span> <a class="link" href="bs_set.html#idm45971717615328-bb"><span class="identifier">rbegin</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="identifier">const_reverse_iterator</span> <a class="link" href="bs_set.html#idm45971717611472-bb"><span class="identifier">rbegin</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="identifier">const_reverse_iterator</span> <a class="link" href="bs_set.html#idm45971717607616-bb"><span class="identifier">crbegin</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="identifier">reverse_iterator</span> <a class="link" href="bs_set.html#idm45971717603760-bb"><span class="identifier">rend</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="identifier">const_reverse_iterator</span> <a class="link" href="bs_set.html#idm45971717599904-bb"><span class="identifier">rend</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="identifier">const_reverse_iterator</span> <a class="link" href="bs_set.html#idm45971717596048-bb"><span class="identifier">crend</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="identifier">iterator</span> <a class="link" href="bs_set.html#idm45971717592192-bb"><span class="identifier">root</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="identifier">const_iterator</span> <a class="link" href="bs_set.html#idm45971717588320-bb"><span class="identifier">root</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="identifier">const_iterator</span> <a class="link" href="bs_set.html#idm45971717584448-bb"><span class="identifier">croot</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="identifier">key_compare</span> <a class="link" href="bs_set.html#idm45971717580576-bb"><span class="identifier">key_comp</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="identifier">value_compare</span> <a class="link" href="bs_set.html#idm45971717576720-bb"><span class="identifier">value_comp</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="keyword">bool</span> <a class="link" href="bs_set.html#idm45971717572848-bb"><span class="identifier">empty</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="identifier">size_type</span> <a class="link" href="bs_set.html#idm45971717569024-bb"><span class="identifier">size</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="keyword">void</span> <a class="link" href="bs_set.html#idm45971717565088-bb"><span class="identifier">swap</span></a><span class="special">(</span><a class="link" href="bs_set.html" title="Class template bs_set">bs_set</a> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Cloner<span class="special">,</span> <span class="keyword">typename</span> Disposer<span class="special">&gt;</span> <span class="keyword">void</span> <a class="link" href="bs_set.html#idm45971717560544-bb"><span class="identifier">clone_from</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="bs_set.html" title="Class template bs_set">bs_set</a> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">Cloner</span><span class="special">,</span> <span class="identifier">Disposer</span><span class="special">)</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Cloner<span class="special">,</span> <span class="keyword">typename</span> Disposer<span class="special">&gt;</span> <span class="keyword">void</span> <a class="link" href="bs_set.html#idm45971717551488-bb"><span class="identifier">clone_from</span></a><span class="special">(</span><a class="link" href="bs_set.html" title="Class template bs_set">bs_set</a> <span class="special">&amp;&amp;</span><span class="special">,</span> <span class="identifier">Cloner</span><span class="special">,</span> <span class="identifier">Disposer</span><span class="special">)</span><span class="special">;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span> <span class="identifier">iterator</span><span class="special">,</span> <span class="keyword">bool</span> <span class="special">&gt;</span> <a class="link" href="bs_set.html#idm45971717541680-bb"><span class="identifier">insert</span></a><span class="special">(</span><span class="identifier">reference</span><span class="special">)</span><span class="special">;</span> <span class="identifier">iterator</span> <a class="link" href="bs_set.html#idm45971717535536-bb"><span class="identifier">insert</span></a><span class="special">(</span><span class="identifier">const_iterator</span><span class="special">,</span> <span class="identifier">reference</span><span class="special">)</span><span class="special">;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span> <span class="identifier">iterator</span><span class="special">,</span> <span class="keyword">bool</span> <span class="special">&gt;</span> <a class="link" href="bs_set.html#idm45971717528576-bb"><span class="identifier">insert_check</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">insert_commit_data</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span> <span class="identifier">iterator</span><span class="special">,</span> <span class="keyword">bool</span> <span class="special">&gt;</span> <a class="link" href="bs_set.html#idm45971717522384-bb"><span class="identifier">insert_check</span></a><span class="special">(</span><span class="identifier">const_iterator</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">insert_commit_data</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> KeyType<span class="special">,</span> <span class="keyword">typename</span> KeyTypeKeyCompare<span class="special">&gt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span> <span class="identifier">iterator</span><span class="special">,</span> <span class="keyword">bool</span> <span class="special">&gt;</span> <a class="link" href="bs_set.html#idm45971717515408-bb"><span class="identifier">insert_check</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">KeyTypeKeyCompare</span><span class="special">,</span> <span class="identifier">insert_commit_data</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> KeyType<span class="special">,</span> <span class="keyword">typename</span> KeyTypeKeyCompare<span class="special">&gt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span> <span class="identifier">iterator</span><span class="special">,</span> <span class="keyword">bool</span> <span class="special">&gt;</span> <a class="link" href="bs_set.html#idm45971717504000-bb"><span class="identifier">insert_check</span></a><span class="special">(</span><span class="identifier">const_iterator</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">KeyTypeKeyCompare</span><span class="special">,</span> <span class="identifier">insert_commit_data</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Iterator<span class="special">&gt;</span> <span class="keyword">void</span> <a class="link" href="bs_set.html#idm45971717491808-bb"><span class="identifier">insert</span></a><span class="special">(</span><span class="identifier">Iterator</span><span class="special">,</span> <span class="identifier">Iterator</span><span class="special">)</span><span class="special">;</span> <span class="identifier">iterator</span> <a class="link" href="bs_set.html#idm45971717484016-bb"><span class="identifier">insert_commit</span></a><span class="special">(</span><span class="identifier">reference</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">insert_commit_data</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="identifier">iterator</span> <a class="link" href="bs_set.html#idm45971717475712-bb"><span class="identifier">insert_before</span></a><span class="special">(</span><span class="identifier">const_iterator</span><span class="special">,</span> <span class="identifier">reference</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="keyword">void</span> <a class="link" href="bs_set.html#idm45971717468480-bb"><span class="identifier">push_back</span></a><span class="special">(</span><span class="identifier">reference</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="keyword">void</span> <a class="link" href="bs_set.html#idm45971717461920-bb"><span class="identifier">push_front</span></a><span class="special">(</span><span class="identifier">reference</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="identifier">iterator</span> <a class="link" href="bs_set.html#idm45971717455360-bb"><span class="identifier">erase</span></a><span class="special">(</span><span class="identifier">const_iterator</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="identifier">iterator</span> <a class="link" href="bs_set.html#idm45971717449872-bb"><span class="identifier">erase</span></a><span class="special">(</span><span class="identifier">const_iterator</span><span class="special">,</span> <span class="identifier">const_iterator</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="identifier">size_type</span> <a class="link" href="bs_set.html#idm45971717443632-bb"><span class="identifier">erase</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> KeyType<span class="special">,</span> <span class="keyword">typename</span> KeyTypeKeyCompare<span class="special">&gt;</span> <span class="identifier">size_type</span> <a class="link" href="bs_set.html#idm45971717437584-bb"><span class="identifier">erase</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">KeyTypeKeyCompare</span><span class="special">)</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Disposer<span class="special">&gt;</span> <span class="identifier">iterator</span> <a class="link" href="bs_set.html#idm45971717427488-bb"><span class="identifier">erase_and_dispose</span></a><span class="special">(</span><span class="identifier">const_iterator</span><span class="special">,</span> <span class="identifier">Disposer</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Disposer<span class="special">&gt;</span> <span class="identifier">iterator</span> <a class="link" href="bs_set.html#idm45971717419584-bb"><span class="identifier">erase_and_dispose</span></a><span class="special">(</span><span class="identifier">const_iterator</span><span class="special">,</span> <span class="identifier">const_iterator</span><span class="special">,</span> <span class="identifier">Disposer</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Disposer<span class="special">&gt;</span> <span class="identifier">size_type</span> <a class="link" href="bs_set.html#idm45971717410928-bb"><span class="identifier">erase_and_dispose</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">Disposer</span><span class="special">)</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> KeyType<span class="special">,</span> <span class="keyword">typename</span> KeyTypeKeyCompare<span class="special">,</span> <span class="keyword">typename</span> Disposer<span class="special">&gt;</span> <span class="identifier">size_type</span> <a class="link" href="bs_set.html#idm45971717402400-bb"><span class="identifier">erase_and_dispose</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">KeyTypeKeyCompare</span><span class="special">,</span> <span class="identifier">Disposer</span><span class="special">)</span><span class="special">;</span> <span class="keyword">void</span> <a class="link" href="bs_set.html#idm45971717390176-bb"><span class="identifier">clear</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Disposer<span class="special">&gt;</span> <span class="keyword">void</span> <a class="link" href="bs_set.html#idm45971717385312-bb"><span class="identifier">clear_and_dispose</span></a><span class="special">(</span><span class="identifier">Disposer</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="identifier">size_type</span> <a class="link" href="bs_set.html#idm45971717379008-bb"><span class="identifier">count</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> KeyType<span class="special">,</span> <span class="keyword">typename</span> KeyTypeKeyCompare<span class="special">&gt;</span> <span class="identifier">size_type</span> <a class="link" href="bs_set.html#idm45971717373936-bb"><span class="identifier">count</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">KeyTypeKeyCompare</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="identifier">iterator</span> <a class="link" href="bs_set.html#idm45971717364880-bb"><span class="identifier">lower_bound</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> KeyType<span class="special">,</span> <span class="keyword">typename</span> KeyTypeKeyCompare<span class="special">&gt;</span> <span class="identifier">iterator</span> <a class="link" href="bs_set.html#idm45971717360128-bb"><span class="identifier">lower_bound</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">KeyTypeKeyCompare</span><span class="special">)</span><span class="special">;</span> <span class="identifier">const_iterator</span> <a class="link" href="bs_set.html#idm45971717353280-bb"><span class="identifier">lower_bound</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> KeyType<span class="special">,</span> <span class="keyword">typename</span> KeyTypeKeyCompare<span class="special">&gt;</span> <span class="identifier">const_iterator</span> <a class="link" href="bs_set.html#idm45971717348256-bb"><span class="identifier">lower_bound</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">KeyTypeKeyCompare</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="identifier">iterator</span> <a class="link" href="bs_set.html#idm45971717341136-bb"><span class="identifier">upper_bound</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> KeyType<span class="special">,</span> <span class="keyword">typename</span> KeyTypeKeyCompare<span class="special">&gt;</span> <span class="identifier">iterator</span> <a class="link" href="bs_set.html#idm45971717336384-bb"><span class="identifier">upper_bound</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">KeyTypeKeyCompare</span><span class="special">)</span><span class="special">;</span> <span class="identifier">const_iterator</span> <a class="link" href="bs_set.html#idm45971717327680-bb"><span class="identifier">upper_bound</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> KeyType<span class="special">,</span> <span class="keyword">typename</span> KeyTypeKeyCompare<span class="special">&gt;</span> <span class="identifier">const_iterator</span> <a class="link" href="bs_set.html#idm45971717322656-bb"><span class="identifier">upper_bound</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">KeyTypeKeyCompare</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="identifier">iterator</span> <a class="link" href="bs_set.html#idm45971717313680-bb"><span class="identifier">find</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> KeyType<span class="special">,</span> <span class="keyword">typename</span> KeyTypeKeyCompare<span class="special">&gt;</span> <span class="identifier">iterator</span> <a class="link" href="bs_set.html#idm45971717308944-bb"><span class="identifier">find</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">KeyTypeKeyCompare</span><span class="special">)</span><span class="special">;</span> <span class="identifier">const_iterator</span> <a class="link" href="bs_set.html#idm45971717300208-bb"><span class="identifier">find</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> KeyType<span class="special">,</span> <span class="keyword">typename</span> KeyTypeKeyCompare<span class="special">&gt;</span> <span class="identifier">const_iterator</span> <a class="link" href="bs_set.html#idm45971717295200-bb"><span class="identifier">find</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">KeyTypeKeyCompare</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span> <span class="identifier">iterator</span><span class="special">,</span> <span class="identifier">iterator</span> <span class="special">&gt;</span> <a class="link" href="bs_set.html#idm45971717286192-bb"><span class="identifier">equal_range</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> KeyType<span class="special">,</span> <span class="keyword">typename</span> KeyTypeKeyCompare<span class="special">&gt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span> <span class="identifier">iterator</span><span class="special">,</span> <span class="identifier">iterator</span> <span class="special">&gt;</span> <a class="link" href="bs_set.html#idm45971717281360-bb"><span class="identifier">equal_range</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">KeyTypeKeyCompare</span><span class="special">)</span><span class="special">;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span> <span class="identifier">const_iterator</span><span class="special">,</span> <span class="identifier">const_iterator</span> <span class="special">&gt;</span> <a class="link" href="bs_set.html#idm45971717272528-bb"><span class="identifier">equal_range</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> KeyType<span class="special">,</span> <span class="keyword">typename</span> KeyTypeKeyCompare<span class="special">&gt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span> <span class="identifier">const_iterator</span><span class="special">,</span> <span class="identifier">const_iterator</span> <span class="special">&gt;</span> <a class="link" href="bs_set.html#idm45971717267408-bb"><span class="identifier">equal_range</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">KeyTypeKeyCompare</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span> <span class="identifier">iterator</span><span class="special">,</span> <span class="identifier">iterator</span> <span class="special">&gt;</span> <a class="link" href="bs_set.html#idm45971717258288-bb"><span class="identifier">bounded_range</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">bool</span><span class="special">,</span> <span class="keyword">bool</span><span class="special">)</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> KeyType<span class="special">,</span> <span class="keyword">typename</span> KeyTypeKeyCompare<span class="special">&gt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span> <span class="identifier">iterator</span><span class="special">,</span> <span class="identifier">iterator</span> <span class="special">&gt;</span> <a class="link" href="bs_set.html#idm45971717245856-bb"><span class="identifier">bounded_range</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">KeyTypeKeyCompare</span><span class="special">,</span> <span class="keyword">bool</span><span class="special">,</span> <span class="keyword">bool</span><span class="special">)</span><span class="special">;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span> <span class="identifier">const_iterator</span><span class="special">,</span> <span class="identifier">const_iterator</span> <span class="special">&gt;</span> <a class="link" href="bs_set.html#idm45971717229056-bb"><span class="identifier">bounded_range</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">bool</span><span class="special">,</span> <span class="keyword">bool</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> KeyType<span class="special">,</span> <span class="keyword">typename</span> KeyTypeKeyCompare<span class="special">&gt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span> <span class="identifier">const_iterator</span><span class="special">,</span> <span class="identifier">const_iterator</span> <span class="special">&gt;</span> <a class="link" href="bs_set.html#idm45971717216336-bb"><span class="identifier">bounded_range</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">KeyTypeKeyCompare</span><span class="special">,</span> <span class="keyword">bool</span><span class="special">,</span> <span class="keyword">bool</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="identifier">iterator</span> <a class="link" href="bs_set.html#idm45971717199248-bb"><span class="identifier">iterator_to</span></a><span class="special">(</span><span class="identifier">reference</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="identifier">const_iterator</span> <a class="link" href="bs_set.html#idm45971717193760-bb"><span class="identifier">iterator_to</span></a><span class="special">(</span><span class="identifier">const_reference</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="identifier">pointer</span> <a class="link" href="bs_set.html#idm45971717188272-bb"><span class="identifier">unlink_leftmost_without_rebalance</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="keyword">void</span> <a class="link" href="bs_set.html#idm45971717183360-bb"><span class="identifier">replace_node</span></a><span class="special">(</span><span class="identifier">iterator</span><span class="special">,</span> <span class="identifier">reference</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="keyword">void</span> <a class="link" href="bs_set.html#idm45971717176096-bb"><span class="identifier">remove_node</span></a><span class="special">(</span><span class="identifier">reference</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="special">...</span> Options2<span class="special">&gt;</span> <span class="keyword">void</span> <a class="link" href="bs_set.html#idm45971717170256-bb"><span class="identifier">merge</span></a><span class="special">(</span><a class="link" href="bs_set.html" title="Class template bs_set">bs_set</a><span class="special">&lt;</span> <span class="identifier">T</span><span class="special">,</span> <span class="identifier">Options2</span><span class="special">...</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="special">...</span> Options2<span class="special">&gt;</span> <span class="keyword">void</span> <a class="link" href="bs_set.html#idm45971717162304-bb"><span class="identifier">merge</span></a><span class="special">(</span><a class="link" href="bs_multiset.html" title="Class template bs_multiset">bs_multiset</a><span class="special">&lt;</span> <span class="identifier">T</span><span class="special">,</span> <span class="identifier">Options2</span><span class="special">...</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span> <span class="comment">// <a class="link" href="bs_set.html#idm45971717126432-bb">public static functions</a></span> <span class="keyword">static</span> <a class="link" href="bs_set.html" title="Class template bs_set">bs_set</a> <span class="special">&amp;</span> <a class="link" href="bs_set.html#idm45971717125872-bb"><span class="identifier">container_from_end_iterator</span></a><span class="special">(</span><span class="identifier">iterator</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="keyword">static</span> <span class="keyword">const</span> <a class="link" href="bs_set.html" title="Class template bs_set">bs_set</a> <span class="special">&amp;</span> <a class="link" href="bs_set.html#idm45971717119856-bb"><span class="identifier">container_from_end_iterator</span></a><span class="special">(</span><span class="identifier">const_iterator</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="keyword">static</span> <a class="link" href="bs_set.html" title="Class template bs_set">bs_set</a> <span class="special">&amp;</span> <a class="link" href="bs_set.html#idm45971717113680-bb"><span class="identifier">container_from_iterator</span></a><span class="special">(</span><span class="identifier">iterator</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="keyword">static</span> <span class="keyword">const</span> <a class="link" href="bs_set.html" title="Class template bs_set">bs_set</a> <span class="special">&amp;</span> <a class="link" href="bs_set.html#idm45971717107712-bb"><span class="identifier">container_from_iterator</span></a><span class="special">(</span><span class="identifier">const_iterator</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="keyword">static</span> <span class="identifier">iterator</span> <a class="link" href="bs_set.html#idm45971717101584-bb"><span class="identifier">s_iterator_to</span></a><span class="special">(</span><span class="identifier">reference</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="keyword">static</span> <span class="identifier">const_iterator</span> <a class="link" href="bs_set.html#idm45971717094496-bb"><span class="identifier">s_iterator_to</span></a><span class="special">(</span><span class="identifier">const_reference</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="keyword">static</span> <span class="keyword">void</span> <a class="link" href="bs_set.html#idm45971717087408-bb"><span class="identifier">init_node</span></a><span class="special">(</span><span class="identifier">reference</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span> <span class="comment">// public data members</span> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keyword">bool</span> <span class="identifier">constant_time_size</span><span class="special">;</span> <span class="special">}</span><span class="special">;</span></pre></div> <div class="refsect1"> <a name="id-1.3.20.42.7.4.4"></a><h2>Description</h2> <p>The class template <a class="link" href="bs_set.html" title="Class template bs_set">bs_set</a> is an intrusive container, that mimics most of the interface of std::set as described in the C++ standard.</p> <p>The template parameter <code class="computeroutput">T</code> is the type to be managed by the container. The user can specify additional options and if no options are provided default options are used.</p> <p>The container supports the following options: <code class="computeroutput">base_hook&lt;&gt;/member_hook&lt;&gt;/value_traits&lt;&gt;</code>, <code class="computeroutput">constant_time_size&lt;&gt;</code>, <code class="computeroutput">size_type&lt;&gt;</code> and <code class="computeroutput">compare&lt;&gt;</code>. </p> <div class="refsect2"> <a name="id-1.3.20.42.7.4.4.5"></a><h3> <a name="boost.intrusive.bs_setconstruct-copy-destruct"></a><code class="computeroutput">bs_set</code> public construct/copy/destruct</h3> <div class="orderedlist"><ol class="orderedlist" type="1"> <li class="listitem"> <pre class="literallayout"><a name="idm45971717154192-bb"></a><span class="identifier">bs_set</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Constructs an empty container.</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant.</p> <p><span class="bold"><strong>Throws</strong></span>: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the key_compare object throws. Basic guarantee. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">explicit</span> <a name="idm45971717151040-bb"></a><span class="identifier">bs_set</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">key_compare</span> <span class="special">&amp;</span> cmp<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">value_traits</span> <span class="special">&amp;</span> v_traits <span class="special">=</span> <span class="identifier">value_traits</span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Constructs an empty container with given comparison and traits.</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant.</p> <p><span class="bold"><strong>Throws</strong></span>: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the key_compare object throws. Basic guarantee. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Iterator<span class="special">&gt;</span> <a name="idm45971717145920-bb"></a><span class="identifier">bs_set</span><span class="special">(</span><span class="identifier">Iterator</span> b<span class="special">,</span> <span class="identifier">Iterator</span> e<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">key_compare</span> <span class="special">&amp;</span> cmp <span class="special">=</span> <span class="identifier">key_compare</span><span class="special">(</span><span class="special">)</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">value_traits</span> <span class="special">&amp;</span> v_traits <span class="special">=</span> <span class="identifier">value_traits</span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: Dereferencing iterator must yield an lvalue of type value_type. cmp must be a comparison function that induces a strict weak ordering.</p> <p><span class="bold"><strong>Effects</strong></span>: Constructs an empty container and inserts elements from [b, e).</p> <p><span class="bold"><strong>Complexity</strong></span>: Linear in N if [b, e) is already sorted using comp and otherwise N * log N, where N is the distance between first and last.</p> <p><span class="bold"><strong>Throws</strong></span>: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor/operator() of the key_compare object throws. Basic guarantee. </p> </li> <li class="listitem"> <pre class="literallayout"><a name="idm45971717137456-bb"></a><span class="identifier">bs_set</span><span class="special">(</span><a class="link" href="bs_set.html" title="Class template bs_set">bs_set</a> <span class="special">&amp;&amp;</span> x<span class="special">)</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Constructs a container moving resources from another container. Internal comparison object and value traits are move constructed and nodes belonging to x (except the node representing the "end") are linked to *this.</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant.</p> <p><span class="bold"><strong>Throws</strong></span>: If value_traits::node_traits::node's move constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the move constructor of the comparison objet throws. </p> </li> <li class="listitem"> <pre class="literallayout"><a class="link" href="bs_set.html" title="Class template bs_set">bs_set</a> <span class="special">&amp;</span> <a name="idm45971717133152-bb"></a><span class="keyword">operator</span><span class="special">=</span><span class="special">(</span><a class="link" href="bs_set.html" title="Class template bs_set">bs_set</a> <span class="special">&amp;&amp;</span> x<span class="special">)</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Equivalent to swap </p> </li> <li class="listitem"> <pre class="literallayout"><a name="idm45971717130336-bb"></a><span class="special">~</span><span class="identifier">bs_set</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Detaches all elements from this. The objects in the set are not deleted (i.e. no destructors are called), but the nodes according to the <code class="computeroutput"><a class="link" href="value_traits.html" title="Struct template value_traits">value_traits</a></code> template parameter are reinitialized and thus can be reused.</p> <p><span class="bold"><strong>Complexity</strong></span>: Linear to elements contained in *this.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing. </p> </li> </ol></div> </div> <div class="refsect2"> <a name="id-1.3.20.42.7.4.4.6"></a><h3> <a name="idm45971717638928-bb"></a><code class="computeroutput">bs_set</code> public member functions</h3> <div class="orderedlist"><ol class="orderedlist" type="1"> <li class="listitem"> <pre class="literallayout"><span class="identifier">iterator</span> <a name="idm45971717638368-bb"></a><span class="identifier">begin</span><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Returns an iterator pointing to the beginning of the container.</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">const_iterator</span> <a name="idm45971717634528-bb"></a><span class="identifier">begin</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Returns a const_iterator pointing to the beginning of the container.</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">const_iterator</span> <a name="idm45971717630688-bb"></a><span class="identifier">cbegin</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Returns a const_iterator pointing to the beginning of the container.</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">iterator</span> <a name="idm45971717626848-bb"></a><span class="identifier">end</span><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Returns an iterator pointing to the end of the container.</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">const_iterator</span> <a name="idm45971717623008-bb"></a><span class="identifier">end</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Returns a const_iterator pointing to the end of the container.</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">const_iterator</span> <a name="idm45971717619168-bb"></a><span class="identifier">cend</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Returns a const_iterator pointing to the end of the container.</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">reverse_iterator</span> <a name="idm45971717615328-bb"></a><span class="identifier">rbegin</span><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Returns a reverse_iterator pointing to the beginning of the reversed container.</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">const_reverse_iterator</span> <a name="idm45971717611472-bb"></a><span class="identifier">rbegin</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Returns a const_reverse_iterator pointing to the beginning of the reversed container.</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">const_reverse_iterator</span> <a name="idm45971717607616-bb"></a><span class="identifier">crbegin</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Returns a const_reverse_iterator pointing to the beginning of the reversed container.</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">reverse_iterator</span> <a name="idm45971717603760-bb"></a><span class="identifier">rend</span><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Returns a reverse_iterator pointing to the end of the reversed container.</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">const_reverse_iterator</span> <a name="idm45971717599904-bb"></a><span class="identifier">rend</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Returns a const_reverse_iterator pointing to the end of the reversed container.</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">const_reverse_iterator</span> <a name="idm45971717596048-bb"></a><span class="identifier">crend</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Returns a const_reverse_iterator pointing to the end of the reversed container.</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">iterator</span> <a name="idm45971717592192-bb"></a><span class="identifier">root</span><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Returns a iterator pointing to the root node of the container or end() if not present.</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">const_iterator</span> <a name="idm45971717588320-bb"></a><span class="identifier">root</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Returns a const_iterator pointing to the root node of the container or cend() if not present.</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">const_iterator</span> <a name="idm45971717584448-bb"></a><span class="identifier">croot</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Returns a const_iterator pointing to the root node of the container or cend() if not present.</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">key_compare</span> <a name="idm45971717580576-bb"></a><span class="identifier">key_comp</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Returns the key_compare object used by the container.</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant.</p> <p><span class="bold"><strong>Throws</strong></span>: If key_compare copy-constructor throws. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">value_compare</span> <a name="idm45971717576720-bb"></a><span class="identifier">value_comp</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Returns the value_compare object used by the container.</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant.</p> <p><span class="bold"><strong>Throws</strong></span>: If value_compare copy-constructor throws. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">bool</span> <a name="idm45971717572848-bb"></a><span class="identifier">empty</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Returns true if the container is empty.</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">size_type</span> <a name="idm45971717569024-bb"></a><span class="identifier">size</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Returns the number of elements stored in the container.</p> <p><span class="bold"><strong>Complexity</strong></span>: Linear to elements contained in *this if constant-time size option is disabled. Constant time otherwise.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">void</span> <a name="idm45971717565088-bb"></a><span class="identifier">swap</span><span class="special">(</span><a class="link" href="bs_set.html" title="Class template bs_set">bs_set</a> <span class="special">&amp;</span> other<span class="special">)</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Swaps the contents of two containers.</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant.</p> <p><span class="bold"><strong>Throws</strong></span>: If the comparison functor's swap call throws. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Cloner<span class="special">,</span> <span class="keyword">typename</span> Disposer<span class="special">&gt;</span> <span class="keyword">void</span> <a name="idm45971717560544-bb"></a><span class="identifier">clone_from</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="bs_set.html" title="Class template bs_set">bs_set</a> <span class="special">&amp;</span> src<span class="special">,</span> <span class="identifier">Cloner</span> cloner<span class="special">,</span> <span class="identifier">Disposer</span> disposer<span class="special">)</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.</p> <p><span class="bold"><strong>Effects</strong></span>: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(const_reference ) and inserts them on *this. Copies the predicate from the source container.</p> <p>If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).</p> <p><span class="bold"><strong>Complexity</strong></span>: Linear to erased plus inserted elements.</p> <p><span class="bold"><strong>Throws</strong></span>: If cloner throws or predicate copy assignment throws. Basic guarantee. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Cloner<span class="special">,</span> <span class="keyword">typename</span> Disposer<span class="special">&gt;</span> <span class="keyword">void</span> <a name="idm45971717551488-bb"></a><span class="identifier">clone_from</span><span class="special">(</span><a class="link" href="bs_set.html" title="Class template bs_set">bs_set</a> <span class="special">&amp;&amp;</span> src<span class="special">,</span> <span class="identifier">Cloner</span> cloner<span class="special">,</span> <span class="identifier">Disposer</span> disposer<span class="special">)</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.</p> <p><span class="bold"><strong>Effects</strong></span>: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(reference) and inserts them on *this. Copies the predicate from the source container.</p> <p>If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).</p> <p><span class="bold"><strong>Complexity</strong></span>: Linear to erased plus inserted elements.</p> <p><span class="bold"><strong>Throws</strong></span>: If cloner throws or predicate copy assignment throws. Basic guarantee.</p> <p><span class="bold"><strong>Note</strong></span>: This version can modify the source container, useful to implement move semantics. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span> <span class="identifier">iterator</span><span class="special">,</span> <span class="keyword">bool</span> <span class="special">&gt;</span> <a name="idm45971717541680-bb"></a><span class="identifier">insert</span><span class="special">(</span><span class="identifier">reference</span> value<span class="special">)</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: value must be an lvalue</p> <p><span class="bold"><strong>Effects</strong></span>: Inserts value into the container if the value is not already present.</p> <p><span class="bold"><strong>Complexity</strong></span>: Average complexity for insert element is at most logarithmic.</p> <p><span class="bold"><strong>Throws</strong></span>: If the comparison functor call throws.</p> <p><span class="bold"><strong>Note</strong></span>: Does not affect the validity of iterators and references. No copy-constructors are called. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">iterator</span> <a name="idm45971717535536-bb"></a><span class="identifier">insert</span><span class="special">(</span><span class="identifier">const_iterator</span> hint<span class="special">,</span> <span class="identifier">reference</span> value<span class="special">)</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: value must be an lvalue, and "hint" must be a valid iterator</p> <p><span class="bold"><strong>Effects</strong></span>: Tries to insert x into the container, using "hint" as a hint to where it will be inserted.</p> <p><span class="bold"><strong>Complexity</strong></span>: Logarithmic in general, but it is amortized constant time (two comparisons in the worst case) if t is inserted immediately before hint.</p> <p><span class="bold"><strong>Throws</strong></span>: If the comparison functor call throws.</p> <p><span class="bold"><strong>Note</strong></span>: Does not affect the validity of iterators and references. No copy-constructors are called. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span> <span class="identifier">iterator</span><span class="special">,</span> <span class="keyword">bool</span> <span class="special">&gt;</span> <a name="idm45971717528576-bb"></a><span class="identifier">insert_check</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span> key<span class="special">,</span> <span class="identifier">insert_commit_data</span> <span class="special">&amp;</span> commit_data<span class="special">)</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Checks if a value can be inserted in the container, using a user provided key instead of the value itself.</p> <p><span class="bold"><strong>Returns</strong></span>: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.</p> <p><span class="bold"><strong>Complexity</strong></span>: Average complexity is at most logarithmic.</p> <p><span class="bold"><strong>Throws</strong></span>: If the comp ordering function throws. Strong guarantee. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span> <span class="identifier">iterator</span><span class="special">,</span> <span class="keyword">bool</span> <span class="special">&gt;</span> <a name="idm45971717522384-bb"></a><span class="identifier">insert_check</span><span class="special">(</span><span class="identifier">const_iterator</span> hint<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span> key<span class="special">,</span> <span class="identifier">insert_commit_data</span> <span class="special">&amp;</span> commit_data<span class="special">)</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Checks if a value can be inserted in the container, using a user provided key instead of the value itself, using "hint" as a hint to where it will be inserted.</p> <p><span class="bold"><strong>Returns</strong></span>: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.</p> <p><span class="bold"><strong>Complexity</strong></span>: Logarithmic in general, but it's amortized constant time if t is inserted immediately before hint.</p> <p><span class="bold"><strong>Throws</strong></span>: If the comp ordering function throws. Strong guarantee. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> KeyType<span class="special">,</span> <span class="keyword">typename</span> KeyTypeKeyCompare<span class="special">&gt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span> <span class="identifier">iterator</span><span class="special">,</span> <span class="keyword">bool</span> <span class="special">&gt;</span> <a name="idm45971717515408-bb"></a><span class="identifier">insert_check</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span> key<span class="special">,</span> <span class="identifier">KeyTypeKeyCompare</span> comp<span class="special">,</span> <span class="identifier">insert_commit_data</span> <span class="special">&amp;</span> commit_data<span class="special">)</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: comp must be a comparison function that induces the same strict weak ordering as key_compare. The difference is that comp compares an arbitrary key with the contained values.</p> <p><span class="bold"><strong>Effects</strong></span>: Checks if a value can be inserted in the container, using a user provided key instead of the value itself.</p> <p><span class="bold"><strong>Returns</strong></span>: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.</p> <p><span class="bold"><strong>Complexity</strong></span>: Average complexity is at most logarithmic.</p> <p><span class="bold"><strong>Throws</strong></span>: If the comp ordering function throws. Strong guarantee.</p> <p><span class="bold"><strong>Notes</strong></span>: This function is used to improve performance when constructing a value_type is expensive: if there is an equivalent value the constructed object must be discarded. Many times, the part of the node that is used to impose the order is much cheaper to construct than the value_type and this function offers the possibility to use that part to check if the insertion will be successful.</p> <p>If the check is successful, the user can construct the value_type and use "insert_commit" to insert the object in constant-time. This gives a total logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)).</p> <p>"commit_data" remains valid for a subsequent "insert_commit" only if no more objects are inserted or erased from the container. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> KeyType<span class="special">,</span> <span class="keyword">typename</span> KeyTypeKeyCompare<span class="special">&gt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span> <span class="identifier">iterator</span><span class="special">,</span> <span class="keyword">bool</span> <span class="special">&gt;</span> <a name="idm45971717504000-bb"></a><span class="identifier">insert_check</span><span class="special">(</span><span class="identifier">const_iterator</span> hint<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span> key<span class="special">,</span> <span class="identifier">KeyTypeKeyCompare</span> comp<span class="special">,</span> <span class="identifier">insert_commit_data</span> <span class="special">&amp;</span> commit_data<span class="special">)</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: comp must be a comparison function that induces the same strict weak ordering as key_compare. The difference is that comp compares an arbitrary key with the contained values.</p> <p><span class="bold"><strong>Effects</strong></span>: Checks if a value can be inserted in the container, using a user provided key instead of the value itself, using "hint" as a hint to where it will be inserted.</p> <p><span class="bold"><strong>Returns</strong></span>: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.</p> <p><span class="bold"><strong>Complexity</strong></span>: Logarithmic in general, but it's amortized constant time if t is inserted immediately before hint.</p> <p><span class="bold"><strong>Throws</strong></span>: If the comp ordering function throws. Strong guarantee.</p> <p><span class="bold"><strong>Notes</strong></span>: This function is used to improve performance when constructing a value_type is expensive: if there is an equivalent value the constructed object must be discarded. Many times, the part of the constructing that is used to impose the order is much cheaper to construct than the value_type and this function offers the possibility to use that key to check if the insertion will be successful.</p> <p>If the check is successful, the user can construct the value_type and use "insert_commit" to insert the object in constant-time. This can give a total constant-time complexity to the insertion: check(O(1)) + commit(O(1)).</p> <p>"commit_data" remains valid for a subsequent "insert_commit" only if no more objects are inserted or erased from the container. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Iterator<span class="special">&gt;</span> <span class="keyword">void</span> <a name="idm45971717491808-bb"></a><span class="identifier">insert</span><span class="special">(</span><span class="identifier">Iterator</span> b<span class="special">,</span> <span class="identifier">Iterator</span> e<span class="special">)</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: Dereferencing iterator must yield an lvalue of type value_type.</p> <p><span class="bold"><strong>Effects</strong></span>: Tries to insert each element of a range into the container.</p> <p><span class="bold"><strong>Complexity</strong></span>: Insert range is in general O(N * log(N)), where N is the size of the range. However, it is linear in N if the range is already sorted by value_comp().</p> <p><span class="bold"><strong>Throws</strong></span>: If the comparison functor call throws.</p> <p><span class="bold"><strong>Note</strong></span>: Does not affect the validity of iterators and references. No copy-constructors are called. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">iterator</span> <a name="idm45971717484016-bb"></a><span class="identifier">insert_commit</span><span class="special">(</span><span class="identifier">reference</span> value<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">insert_commit_data</span> <span class="special">&amp;</span> commit_data<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: value must be an lvalue of type value_type. commit_data must have been obtained from a previous call to "insert_check". No objects should have been inserted or erased from the container between the "insert_check" that filled "commit_data" and the call to "insert_commit".</p> <p><span class="bold"><strong>Effects</strong></span>: Inserts the value in the container using the information obtained from the "commit_data" that a previous "insert_check" filled.</p> <p><span class="bold"><strong>Returns</strong></span>: An iterator to the newly inserted object.</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant time.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing.</p> <p><span class="bold"><strong>Notes</strong></span>: This function has only sense if a "insert_check" has been previously executed to fill "commit_data". No value should be inserted or erased between the "insert_check" and "insert_commit" calls. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">iterator</span> <a name="idm45971717475712-bb"></a><span class="identifier">insert_before</span><span class="special">(</span><span class="identifier">const_iterator</span> pos<span class="special">,</span> <span class="identifier">reference</span> value<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: value must be an lvalue, "pos" must be a valid iterator (or end) and must be the succesor of value once inserted according to the predicate</p> <p><span class="bold"><strong>Effects</strong></span>: Inserts x into the container before "pos".</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant time.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing.</p> <p><span class="bold"><strong>Note</strong></span>: This function does not check preconditions so if "pos" is not the successor of "value" container ordering invariant will be broken. This is a low-level function to be used only for performance reasons by advanced users. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">void</span> <a name="idm45971717468480-bb"></a><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">reference</span> value<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: value must be an lvalue, and it must be no less than the greatest inserted key</p> <p><span class="bold"><strong>Effects</strong></span>: Inserts x into the container in the last position.</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant time.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing.</p> <p><span class="bold"><strong>Note</strong></span>: This function does not check preconditions so if value is less than the greatest inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">void</span> <a name="idm45971717461920-bb"></a><span class="identifier">push_front</span><span class="special">(</span><span class="identifier">reference</span> value<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: value must be an lvalue, and it must be no greater than the minimum inserted key</p> <p><span class="bold"><strong>Effects</strong></span>: Inserts x into the container in the first position.</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant time.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing.</p> <p><span class="bold"><strong>Note</strong></span>: This function does not check preconditions so if value is greater than the minimum inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">iterator</span> <a name="idm45971717455360-bb"></a><span class="identifier">erase</span><span class="special">(</span><span class="identifier">const_iterator</span> i<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Erases the element pointed to by i.</p> <p><span class="bold"><strong>Complexity</strong></span>: Average complexity for erase element is constant time.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing.</p> <p><span class="bold"><strong>Note</strong></span>: Invalidates the iterators (but not the references) to the erased elements. No destructors are called. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">iterator</span> <a name="idm45971717449872-bb"></a><span class="identifier">erase</span><span class="special">(</span><span class="identifier">const_iterator</span> b<span class="special">,</span> <span class="identifier">const_iterator</span> e<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Erases the range pointed to by b end e.</p> <p><span class="bold"><strong>Complexity</strong></span>: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing.</p> <p><span class="bold"><strong>Note</strong></span>: Invalidates the iterators (but not the references) to the erased elements. No destructors are called. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">size_type</span> <a name="idm45971717443632-bb"></a><span class="identifier">erase</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span> key<span class="special">)</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Erases all the elements with the given value.</p> <p><span class="bold"><strong>Returns</strong></span>: The number of erased elements.</p> <p><span class="bold"><strong>Complexity</strong></span>: O(log(size() + N).</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing.</p> <p><span class="bold"><strong>Note</strong></span>: Invalidates the iterators (but not the references) to the erased elements. No destructors are called. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> KeyType<span class="special">,</span> <span class="keyword">typename</span> KeyTypeKeyCompare<span class="special">&gt;</span> <span class="identifier">size_type</span> <a name="idm45971717437584-bb"></a><span class="identifier">erase</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span> key<span class="special">,</span> <span class="identifier">KeyTypeKeyCompare</span> comp<span class="special">)</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: key is a value such that <code class="computeroutput">*this</code> is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into <code class="computeroutput">*this</code>.</p> <p><span class="bold"><strong>Effects</strong></span>: Erases all the elements with the given key. according to the comparison functor "comp".</p> <p><span class="bold"><strong>Returns</strong></span>: The number of erased elements.</p> <p><span class="bold"><strong>Complexity</strong></span>: O(log(size() + N).</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing.</p> <p><span class="bold"><strong>Note</strong></span>: Invalidates the iterators (but not the references) to the erased elements. No destructors are called. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Disposer<span class="special">&gt;</span> <span class="identifier">iterator</span> <a name="idm45971717427488-bb"></a><span class="identifier">erase_and_dispose</span><span class="special">(</span><span class="identifier">const_iterator</span> i<span class="special">,</span> <span class="identifier">Disposer</span> disposer<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: Disposer::operator()(pointer) shouldn't throw.</p> <p><span class="bold"><strong>Effects</strong></span>: Erases the element pointed to by i. Disposer::operator()(pointer) is called for the removed element.</p> <p><span class="bold"><strong>Complexity</strong></span>: Average complexity for erase element is constant time.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing.</p> <p><span class="bold"><strong>Note</strong></span>: Invalidates the iterators to the erased elements. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Disposer<span class="special">&gt;</span> <span class="identifier">iterator</span> <a name="idm45971717419584-bb"></a><span class="identifier">erase_and_dispose</span><span class="special">(</span><span class="identifier">const_iterator</span> b<span class="special">,</span> <span class="identifier">const_iterator</span> e<span class="special">,</span> <span class="identifier">Disposer</span> disposer<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: Disposer::operator()(pointer) shouldn't throw.</p> <p><span class="bold"><strong>Effects</strong></span>: Erases the range pointed to by b end e. Disposer::operator()(pointer) is called for the removed elements.</p> <p><span class="bold"><strong>Complexity</strong></span>: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing.</p> <p><span class="bold"><strong>Note</strong></span>: Invalidates the iterators to the erased elements. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Disposer<span class="special">&gt;</span> <span class="identifier">size_type</span> <a name="idm45971717410928-bb"></a><span class="identifier">erase_and_dispose</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span> key<span class="special">,</span> <span class="identifier">Disposer</span> disposer<span class="special">)</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: Disposer::operator()(pointer) shouldn't throw.</p> <p><span class="bold"><strong>Effects</strong></span>: Erases all the elements with the given value. Disposer::operator()(pointer) is called for the removed elements.</p> <p><span class="bold"><strong>Returns</strong></span>: The number of erased elements.</p> <p><span class="bold"><strong>Complexity</strong></span>: O(log(size() + N).</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing.</p> <p><span class="bold"><strong>Note</strong></span>: Invalidates the iterators (but not the references) to the erased elements. No destructors are called. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> KeyType<span class="special">,</span> <span class="keyword">typename</span> KeyTypeKeyCompare<span class="special">,</span> <span class="keyword">typename</span> Disposer<span class="special">&gt;</span> <span class="identifier">size_type</span> <a name="idm45971717402400-bb"></a><span class="identifier">erase_and_dispose</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span> key<span class="special">,</span> <span class="identifier">KeyTypeKeyCompare</span> comp<span class="special">,</span> <span class="identifier">Disposer</span> disposer<span class="special">)</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: key is a value such that <code class="computeroutput">*this</code> is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk) and nk the key_type of a value_type inserted into <code class="computeroutput">*this</code>.</p> <p><span class="bold"><strong>Requires</strong></span>: Disposer::operator()(pointer) shouldn't throw.</p> <p><span class="bold"><strong>Effects</strong></span>: Erases all the elements with the given key. according to the comparison functor "comp". Disposer::operator()(pointer) is called for the removed elements.</p> <p><span class="bold"><strong>Returns</strong></span>: The number of erased elements.</p> <p><span class="bold"><strong>Complexity</strong></span>: O(log(size() + N).</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing.</p> <p><span class="bold"><strong>Note</strong></span>: Invalidates the iterators to the erased elements. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">void</span> <a name="idm45971717390176-bb"></a><span class="identifier">clear</span><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Erases all of the elements.</p> <p><span class="bold"><strong>Complexity</strong></span>: Linear to the number of elements on the container. if it's a safe-mode or auto-unlink value_type. Constant time otherwise.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing.</p> <p><span class="bold"><strong>Note</strong></span>: Invalidates the iterators (but not the references) to the erased elements. No destructors are called. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Disposer<span class="special">&gt;</span> <span class="keyword">void</span> <a name="idm45971717385312-bb"></a><span class="identifier">clear_and_dispose</span><span class="special">(</span><span class="identifier">Disposer</span> disposer<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Erases all of the elements calling disposer(p) for each node to be erased. <span class="bold"><strong>Complexity</strong></span>: Average complexity for is at most O(log(size() + N)), where N is the number of elements in the container.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing.</p> <p><span class="bold"><strong>Note</strong></span>: Invalidates the iterators (but not the references) to the erased elements. Calls N times to disposer functor. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">size_type</span> <a name="idm45971717379008-bb"></a><span class="identifier">count</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span> key<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Returns the number of contained elements with the given value</p> <p><span class="bold"><strong>Complexity</strong></span>: Logarithmic to the number of elements contained plus lineal to number of objects with the given value.</p> <p><span class="bold"><strong>Throws</strong></span>: If <code class="computeroutput">key_compare</code> throws. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> KeyType<span class="special">,</span> <span class="keyword">typename</span> KeyTypeKeyCompare<span class="special">&gt;</span> <span class="identifier">size_type</span> <a name="idm45971717373936-bb"></a><span class="identifier">count</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span> key<span class="special">,</span> <span class="identifier">KeyTypeKeyCompare</span> comp<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: key is a value such that <code class="computeroutput">*this</code> is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into <code class="computeroutput">*this</code>.</p> <p><span class="bold"><strong>Effects</strong></span>: Returns the number of contained elements with the given key</p> <p><span class="bold"><strong>Complexity</strong></span>: Logarithmic to the number of elements contained plus lineal to number of objects with the given key.</p> <p><span class="bold"><strong>Throws</strong></span>: If <code class="computeroutput">comp</code> throws. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">iterator</span> <a name="idm45971717364880-bb"></a><span class="identifier">lower_bound</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.</p> <p><span class="bold"><strong>Complexity</strong></span>: Logarithmic.</p> <p><span class="bold"><strong>Throws</strong></span>: If <code class="computeroutput">key_compare</code> throws. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> KeyType<span class="special">,</span> <span class="keyword">typename</span> KeyTypeKeyCompare<span class="special">&gt;</span> <span class="identifier">iterator</span> <a name="idm45971717360128-bb"></a><span class="identifier">lower_bound</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span> key<span class="special">,</span> <span class="identifier">KeyTypeKeyCompare</span> comp<span class="special">)</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.</p> <p><span class="bold"><strong>Complexity</strong></span>: Logarithmic.</p> <p><span class="bold"><strong>Throws</strong></span>: If <code class="computeroutput">key_compare</code> throws. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">const_iterator</span> <a name="idm45971717353280-bb"></a><span class="identifier">lower_bound</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span> key<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.</p> <p><span class="bold"><strong>Complexity</strong></span>: Logarithmic.</p> <p><span class="bold"><strong>Throws</strong></span>: If <code class="computeroutput">key_compare</code> throws. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> KeyType<span class="special">,</span> <span class="keyword">typename</span> KeyTypeKeyCompare<span class="special">&gt;</span> <span class="identifier">const_iterator</span> <a name="idm45971717348256-bb"></a><span class="identifier">lower_bound</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span> key<span class="special">,</span> <span class="identifier">KeyTypeKeyCompare</span> comp<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.</p> <p><span class="bold"><strong>Complexity</strong></span>: Logarithmic.</p> <p><span class="bold"><strong>Throws</strong></span>: If <code class="computeroutput">key_compare</code> throws. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">iterator</span> <a name="idm45971717341136-bb"></a><span class="identifier">upper_bound</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span> key<span class="special">)</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.</p> <p><span class="bold"><strong>Complexity</strong></span>: Logarithmic.</p> <p><span class="bold"><strong>Throws</strong></span>: If <code class="computeroutput">key_compare</code> throws. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> KeyType<span class="special">,</span> <span class="keyword">typename</span> KeyTypeKeyCompare<span class="special">&gt;</span> <span class="identifier">iterator</span> <a name="idm45971717336384-bb"></a><span class="identifier">upper_bound</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span> key<span class="special">,</span> <span class="identifier">KeyTypeKeyCompare</span> comp<span class="special">)</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: key is a value such that <code class="computeroutput">*this</code> is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into <code class="computeroutput">*this</code>.</p> <p><span class="bold"><strong>Effects</strong></span>: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.</p> <p><span class="bold"><strong>Complexity</strong></span>: Logarithmic.</p> <p><span class="bold"><strong>Throws</strong></span>: If <code class="computeroutput">comp</code> throws. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">const_iterator</span> <a name="idm45971717327680-bb"></a><span class="identifier">upper_bound</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span> key<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.</p> <p><span class="bold"><strong>Complexity</strong></span>: Logarithmic.</p> <p><span class="bold"><strong>Throws</strong></span>: If <code class="computeroutput">key_compare</code> throws. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> KeyType<span class="special">,</span> <span class="keyword">typename</span> KeyTypeKeyCompare<span class="special">&gt;</span> <span class="identifier">const_iterator</span> <a name="idm45971717322656-bb"></a><span class="identifier">upper_bound</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span> key<span class="special">,</span> <span class="identifier">KeyTypeKeyCompare</span> comp<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: key is a value such that <code class="computeroutput">*this</code> is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into <code class="computeroutput">*this</code>.</p> <p><span class="bold"><strong>Effects</strong></span>: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.</p> <p><span class="bold"><strong>Complexity</strong></span>: Logarithmic.</p> <p><span class="bold"><strong>Throws</strong></span>: If <code class="computeroutput">comp</code> throws. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">iterator</span> <a name="idm45971717313680-bb"></a><span class="identifier">find</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span> key<span class="special">)</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Finds an iterator to the first element whose key is k or end() if that element does not exist.</p> <p><span class="bold"><strong>Complexity</strong></span>: Logarithmic.</p> <p><span class="bold"><strong>Throws</strong></span>: If <code class="computeroutput">key_compare</code> throws. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> KeyType<span class="special">,</span> <span class="keyword">typename</span> KeyTypeKeyCompare<span class="special">&gt;</span> <span class="identifier">iterator</span> <a name="idm45971717308944-bb"></a><span class="identifier">find</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span> key<span class="special">,</span> <span class="identifier">KeyTypeKeyCompare</span> comp<span class="special">)</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: key is a value such that <code class="computeroutput">*this</code> is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into <code class="computeroutput">*this</code>.</p> <p><span class="bold"><strong>Effects</strong></span>: Finds an iterator to the first element whose key is k or end() if that element does not exist.</p> <p><span class="bold"><strong>Complexity</strong></span>: Logarithmic.</p> <p><span class="bold"><strong>Throws</strong></span>: If <code class="computeroutput">comp</code> throws. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">const_iterator</span> <a name="idm45971717300208-bb"></a><span class="identifier">find</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span> key<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Finds an iterator to the first element whose key is k or end() if that element does not exist.</p> <p><span class="bold"><strong>Complexity</strong></span>: Logarithmic.</p> <p><span class="bold"><strong>Throws</strong></span>: If <code class="computeroutput">key_compare</code> throws. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> KeyType<span class="special">,</span> <span class="keyword">typename</span> KeyTypeKeyCompare<span class="special">&gt;</span> <span class="identifier">const_iterator</span> <a name="idm45971717295200-bb"></a><span class="identifier">find</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span> key<span class="special">,</span> <span class="identifier">KeyTypeKeyCompare</span> comp<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: key is a value such that <code class="computeroutput">*this</code> is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into <code class="computeroutput">*this</code>.</p> <p><span class="bold"><strong>Effects</strong></span>: Finds an iterator to the first element whose key is k or end() if that element does not exist.</p> <p><span class="bold"><strong>Complexity</strong></span>: Logarithmic.</p> <p><span class="bold"><strong>Throws</strong></span>: If <code class="computeroutput">comp</code> throws. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span> <span class="identifier">iterator</span><span class="special">,</span> <span class="identifier">iterator</span> <span class="special">&gt;</span> <a name="idm45971717286192-bb"></a><span class="identifier">equal_range</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span> key<span class="special">)</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.</p> <p><span class="bold"><strong>Complexity</strong></span>: Logarithmic.</p> <p><span class="bold"><strong>Throws</strong></span>: If <code class="computeroutput">key_compare</code> throws. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> KeyType<span class="special">,</span> <span class="keyword">typename</span> KeyTypeKeyCompare<span class="special">&gt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span> <span class="identifier">iterator</span><span class="special">,</span> <span class="identifier">iterator</span> <span class="special">&gt;</span> <a name="idm45971717281360-bb"></a><span class="identifier">equal_range</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span> key<span class="special">,</span> <span class="identifier">KeyTypeKeyCompare</span> comp<span class="special">)</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: key is a value such that <code class="computeroutput">*this</code> is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into <code class="computeroutput">*this</code>.</p> <p><span class="bold"><strong>Effects</strong></span>: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.</p> <p><span class="bold"><strong>Complexity</strong></span>: Logarithmic.</p> <p><span class="bold"><strong>Throws</strong></span>: If <code class="computeroutput">comp</code> throws. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span> <span class="identifier">const_iterator</span><span class="special">,</span> <span class="identifier">const_iterator</span> <span class="special">&gt;</span> <a name="idm45971717272528-bb"></a><span class="identifier">equal_range</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span> key<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.</p> <p><span class="bold"><strong>Complexity</strong></span>: Logarithmic.</p> <p><span class="bold"><strong>Throws</strong></span>: If <code class="computeroutput">key_compare</code> throws. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> KeyType<span class="special">,</span> <span class="keyword">typename</span> KeyTypeKeyCompare<span class="special">&gt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span> <span class="identifier">const_iterator</span><span class="special">,</span> <span class="identifier">const_iterator</span> <span class="special">&gt;</span> <a name="idm45971717267408-bb"></a><span class="identifier">equal_range</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span> key<span class="special">,</span> <span class="identifier">KeyTypeKeyCompare</span> comp<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: key is a value such that <code class="computeroutput">*this</code> is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into <code class="computeroutput">*this</code>.</p> <p><span class="bold"><strong>Effects</strong></span>: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.</p> <p><span class="bold"><strong>Complexity</strong></span>: Logarithmic.</p> <p><span class="bold"><strong>Throws</strong></span>: If <code class="computeroutput">comp</code> throws. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span> <span class="identifier">iterator</span><span class="special">,</span> <span class="identifier">iterator</span> <span class="special">&gt;</span> <a name="idm45971717258288-bb"></a><span class="identifier">bounded_range</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span> lower_key<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span> upper_key<span class="special">,</span> <span class="keyword">bool</span> left_closed<span class="special">,</span> <span class="keyword">bool</span> right_closed<span class="special">)</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: <code class="computeroutput">upper_key</code> shall not precede <code class="computeroutput">lower_key</code> according to key_compare. [key_comp()(upper_key, lower_key) shall be false]</p> <p>If <code class="computeroutput">lower_key</code> is equivalent to <code class="computeroutput">upper_key</code> [!key_comp()(upper_key, lower_key) &amp;&amp; !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.</p> <p><span class="bold"><strong>Effects</strong></span>: Returns an a pair with the following criteria:</p> <p>first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise</p> <p>second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise</p> <p><span class="bold"><strong>Complexity</strong></span>: Logarithmic.</p> <p><span class="bold"><strong>Throws</strong></span>: If <code class="computeroutput">key_compare</code> throws.</p> <p><span class="bold"><strong>Note</strong></span>: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.</p> <p><span class="bold"><strong>Note</strong></span>: Experimental function, the interface might change in future releases. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> KeyType<span class="special">,</span> <span class="keyword">typename</span> KeyTypeKeyCompare<span class="special">&gt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span> <span class="identifier">iterator</span><span class="special">,</span> <span class="identifier">iterator</span> <span class="special">&gt;</span> <a name="idm45971717245856-bb"></a><span class="identifier">bounded_range</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span> lower_key<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span> upper_key<span class="special">,</span> <span class="identifier">KeyTypeKeyCompare</span> comp<span class="special">,</span> <span class="keyword">bool</span> left_closed<span class="special">,</span> <span class="keyword">bool</span> right_closed<span class="special">)</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: <code class="computeroutput">lower_key</code> is a value such that <code class="computeroutput">*this</code> is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.</p> <p><code class="computeroutput">upper_key</code> is a value such that <code class="computeroutput">*this</code> is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.</p> <p><code class="computeroutput">upper_key</code> shall not precede <code class="computeroutput">lower_key</code> according to comp [comp(upper_key, lower_key) shall be false]</p> <p>If <code class="computeroutput">lower_key</code> is equivalent to <code class="computeroutput">upper_key</code> [!comp(upper_key, lower_key) &amp;&amp; !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.</p> <p><span class="bold"><strong>Effects</strong></span>: Returns an a pair with the following criteria:</p> <p>first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise</p> <p>second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise</p> <p><span class="bold"><strong>Complexity</strong></span>: Logarithmic.</p> <p><span class="bold"><strong>Throws</strong></span>: If <code class="computeroutput">comp</code> throws.</p> <p><span class="bold"><strong>Note</strong></span>: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.</p> <p><span class="bold"><strong>Note</strong></span>: Experimental function, the interface might change in future releases. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span> <span class="identifier">const_iterator</span><span class="special">,</span> <span class="identifier">const_iterator</span> <span class="special">&gt;</span> <a name="idm45971717229056-bb"></a><span class="identifier">bounded_range</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span> lower_key<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">key_type</span> <span class="special">&amp;</span> upper_key<span class="special">,</span> <span class="keyword">bool</span> left_closed<span class="special">,</span> <span class="keyword">bool</span> right_closed<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: <code class="computeroutput">upper_key</code> shall not precede <code class="computeroutput">lower_key</code> according to key_compare. [key_comp()(upper_key, lower_key) shall be false]</p> <p>If <code class="computeroutput">lower_key</code> is equivalent to <code class="computeroutput">upper_key</code> [!key_comp()(upper_key, lower_key) &amp;&amp; !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.</p> <p><span class="bold"><strong>Effects</strong></span>: Returns an a pair with the following criteria:</p> <p>first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise</p> <p>second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise</p> <p><span class="bold"><strong>Complexity</strong></span>: Logarithmic.</p> <p><span class="bold"><strong>Throws</strong></span>: If <code class="computeroutput">key_compare</code> throws.</p> <p><span class="bold"><strong>Note</strong></span>: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.</p> <p><span class="bold"><strong>Note</strong></span>: Experimental function, the interface might change in future releases. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> KeyType<span class="special">,</span> <span class="keyword">typename</span> KeyTypeKeyCompare<span class="special">&gt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span> <span class="identifier">const_iterator</span><span class="special">,</span> <span class="identifier">const_iterator</span> <span class="special">&gt;</span> <a name="idm45971717216336-bb"></a><span class="identifier">bounded_range</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span> lower_key<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">KeyType</span> <span class="special">&amp;</span> upper_key<span class="special">,</span> <span class="identifier">KeyTypeKeyCompare</span> comp<span class="special">,</span> <span class="keyword">bool</span> left_closed<span class="special">,</span> <span class="keyword">bool</span> right_closed<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: <code class="computeroutput">lower_key</code> is a value such that <code class="computeroutput">*this</code> is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.</p> <p><code class="computeroutput">upper_key</code> is a value such that <code class="computeroutput">*this</code> is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.</p> <p><code class="computeroutput">upper_key</code> shall not precede <code class="computeroutput">lower_key</code> according to comp [comp(upper_key, lower_key) shall be false]</p> <p>If <code class="computeroutput">lower_key</code> is equivalent to <code class="computeroutput">upper_key</code> [!comp(upper_key, lower_key) &amp;&amp; !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.</p> <p><span class="bold"><strong>Effects</strong></span>: Returns an a pair with the following criteria:</p> <p>first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise</p> <p>second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise</p> <p><span class="bold"><strong>Complexity</strong></span>: Logarithmic.</p> <p><span class="bold"><strong>Throws</strong></span>: If <code class="computeroutput">comp</code> throws.</p> <p><span class="bold"><strong>Note</strong></span>: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.</p> <p><span class="bold"><strong>Note</strong></span>: Experimental function, the interface might change in future releases. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">iterator</span> <a name="idm45971717199248-bb"></a><span class="identifier">iterator_to</span><span class="special">(</span><span class="identifier">reference</span> value<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.</p> <p><span class="bold"><strong>Effects</strong></span>: Returns: a valid iterator i belonging to the set that points to the value</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">const_iterator</span> <a name="idm45971717193760-bb"></a><span class="identifier">iterator_to</span><span class="special">(</span><span class="identifier">const_reference</span> value<span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.</p> <p><span class="bold"><strong>Effects</strong></span>: Returns: a valid const_iterator i belonging to the set that points to the value</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="identifier">pointer</span> <a name="idm45971717188272-bb"></a><span class="identifier">unlink_leftmost_without_rebalance</span><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: Unlinks the leftmost node from the container.</p> <p><span class="bold"><strong>Complexity</strong></span>: Average complexity is constant time.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing.</p> <p><span class="bold"><strong>Notes</strong></span>: This function breaks the container and the container can only be used for more unlink_leftmost_without_rebalance calls. This function is normally used to achieve a step by step controlled destruction of the container. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">void</span> <a name="idm45971717183360-bb"></a><span class="identifier">replace_node</span><span class="special">(</span><span class="identifier">iterator</span> replace_this<span class="special">,</span> <span class="identifier">reference</span> with_this<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: replace_this must be a valid iterator of *this and with_this must not be inserted in any container.</p> <p><span class="bold"><strong>Effects</strong></span>: Replaces replace_this in its position in the container with with_this. The container does not need to be rebalanced.</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing.</p> <p><span class="bold"><strong>Note</strong></span>: This function will break container ordering invariants if with_this is not equivalent to *replace_this according to the ordering rules. This function is faster than erasing and inserting the node, since no rebalancing or comparison is needed. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">void</span> <a name="idm45971717176096-bb"></a><span class="identifier">remove_node</span><span class="special">(</span><span class="identifier">reference</span> value<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Effects</strong></span>: removes "value" from the container.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing.</p> <p><span class="bold"><strong>Complexity</strong></span>: Logarithmic time.</p> <p><span class="bold"><strong>Note</strong></span>: This static function is only usable with non-constant time size containers that have stateless comparison functors.</p> <p>If the user calls this function with a constant time size container or stateful comparison functor a compilation error will be issued. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="special">...</span> Options2<span class="special">&gt;</span> <span class="keyword">void</span> <a name="idm45971717170256-bb"></a><span class="identifier">merge</span><span class="special">(</span><a class="link" href="bs_set.html" title="Class template bs_set">bs_set</a><span class="special">&lt;</span> <span class="identifier">T</span><span class="special">,</span> <span class="identifier">Options2</span><span class="special">...</span> <span class="special">&gt;</span> <span class="special">&amp;</span> source<span class="special">)</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: "source" container's Options can only can differ in the comparison function from *this.</p> <p><span class="bold"><strong>Effects</strong></span>: Attempts to extract each element in source and insert it into a using the comparison object of *this. If there is an element in a with key equivalent to the key of an element from source, then that element is not extracted from source.</p> <p><span class="bold"><strong>Postcondition</strong></span>: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing unless the comparison object throws.</p> <p><span class="bold"><strong>Complexity</strong></span>: N log(a.size() + N) (N has the value source.size()) </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="special">...</span> Options2<span class="special">&gt;</span> <span class="keyword">void</span> <a name="idm45971717162304-bb"></a><span class="identifier">merge</span><span class="special">(</span><a class="link" href="bs_multiset.html" title="Class template bs_multiset">bs_multiset</a><span class="special">&lt;</span> <span class="identifier">T</span><span class="special">,</span> <span class="identifier">Options2</span><span class="special">...</span> <span class="special">&gt;</span> <span class="special">&amp;</span> source<span class="special">)</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: "source" container's Options can only can differ in the comparison function from *this.</p> <p><span class="bold"><strong>Effects</strong></span>: Attempts to extract each element in source and insert it into a using the comparison object of *this. If there is an element in a with key equivalent to the key of an element from source, then that element is not extracted from source.</p> <p><span class="bold"><strong>Postcondition</strong></span>: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing unless the comparison object throws.</p> <p><span class="bold"><strong>Complexity</strong></span>: N log(a.size() + N) (N has the value source.size()) </p> </li> </ol></div> </div> <div class="refsect2"> <a name="id-1.3.20.42.7.4.4.7"></a><h3> <a name="idm45971717126432-bb"></a><code class="computeroutput">bs_set</code> public static functions</h3> <div class="orderedlist"><ol class="orderedlist" type="1"> <li class="listitem"> <pre class="literallayout"><span class="keyword">static</span> <a class="link" href="bs_set.html" title="Class template bs_set">bs_set</a> <span class="special">&amp;</span> <a name="idm45971717125872-bb"></a><span class="identifier">container_from_end_iterator</span><span class="special">(</span><span class="identifier">iterator</span> end_iterator<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Precondition</strong></span>: end_iterator must be a valid end iterator of the container.</p> <p><span class="bold"><strong>Effects</strong></span>: Returns a const reference to the container associated to the end iterator</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing.</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">static</span> <span class="keyword">const</span> <a class="link" href="bs_set.html" title="Class template bs_set">bs_set</a> <span class="special">&amp;</span> <a name="idm45971717119856-bb"></a><span class="identifier">container_from_end_iterator</span><span class="special">(</span><span class="identifier">const_iterator</span> end_iterator<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Precondition</strong></span>: end_iterator must be a valid end iterator of the container.</p> <p><span class="bold"><strong>Effects</strong></span>: Returns a const reference to the container associated to the end iterator</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing.</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">static</span> <a class="link" href="bs_set.html" title="Class template bs_set">bs_set</a> <span class="special">&amp;</span> <a name="idm45971717113680-bb"></a><span class="identifier">container_from_iterator</span><span class="special">(</span><span class="identifier">iterator</span> it<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Precondition</strong></span>: it must be a valid iterator of the container.</p> <p><span class="bold"><strong>Effects</strong></span>: Returns a const reference to the container associated to the iterator</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing.</p> <p><span class="bold"><strong>Complexity</strong></span>: Logarithmic. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">static</span> <span class="keyword">const</span> <a class="link" href="bs_set.html" title="Class template bs_set">bs_set</a> <span class="special">&amp;</span> <a name="idm45971717107712-bb"></a><span class="identifier">container_from_iterator</span><span class="special">(</span><span class="identifier">const_iterator</span> it<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Precondition</strong></span>: it must be a valid iterator of the container.</p> <p><span class="bold"><strong>Effects</strong></span>: Returns a const reference to the container associated to the iterator</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing.</p> <p><span class="bold"><strong>Complexity</strong></span>: Logarithmic. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">static</span> <span class="identifier">iterator</span> <a name="idm45971717101584-bb"></a><span class="identifier">s_iterator_to</span><span class="special">(</span><span class="identifier">reference</span> value<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.</p> <p><span class="bold"><strong>Effects</strong></span>: Returns: a valid iterator i belonging to the set that points to the value</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing.</p> <p><span class="bold"><strong>Note</strong></span>: This static function is available only if the <span class="emphasis"><em>value traits</em></span> is stateless. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">static</span> <span class="identifier">const_iterator</span> <a name="idm45971717094496-bb"></a><span class="identifier">s_iterator_to</span><span class="special">(</span><span class="identifier">const_reference</span> value<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.</p> <p><span class="bold"><strong>Effects</strong></span>: Returns: a valid iterator i belonging to the set that points to the value</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing.</p> <p><span class="bold"><strong>Note</strong></span>: This static function is available only if the <span class="emphasis"><em>value traits</em></span> is stateless. </p> </li> <li class="listitem"> <pre class="literallayout"><span class="keyword">static</span> <span class="keyword">void</span> <a name="idm45971717087408-bb"></a><span class="identifier">init_node</span><span class="special">(</span><span class="identifier">reference</span> value<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre> <p><span class="bold"><strong>Requires</strong></span>: value shall not be in a container.</p> <p><span class="bold"><strong>Effects</strong></span>: init_node puts the hook of a value in a well-known default state.</p> <p><span class="bold"><strong>Throws</strong></span>: Nothing.</p> <p><span class="bold"><strong>Complexity</strong></span>: Constant time.</p> <p><span class="bold"><strong>Note</strong></span>: This function puts the hook in the well-known default state used by auto_unlink and safe hooks. </p> </li> </ol></div> </div> </div> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> <td align="right"><div class="copyright-footer">Copyright © 2005 Olaf Krzikalla<br>Copyright © 2006-2015 Ion Gaztanaga<p> Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) </p> </div></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="bs_multiset.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../intrusive/reference.html#header.boost.intrusive.bs_set_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="make_bs_multiset.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a> </div> </body> </html>
davehorton/drachtio-server
deps/boost_1_77_0/doc/html/boost/intrusive/bs_set.html
HTML
mit
151,183
# -*- coding: utf-8 -*- # pylint: disable=C0302,fixme, protected-access """ The core module contains the SoCo class that implements the main entry to the SoCo functionality """ from __future__ import unicode_literals import socket import logging import re import requests from .services import DeviceProperties, ContentDirectory from .services import RenderingControl, AVTransport, ZoneGroupTopology from .services import AlarmClock from .groups import ZoneGroup from .exceptions import DIDLMetadataError, SoCoUPnPException from .data_structures import DidlPlaylistContainer,\ SearchResult, Queue, DidlObject, DidlMusicAlbum,\ from_didl_string, to_didl_string, DidlResource from .utils import really_utf8, camel_to_underscore, really_unicode,\ url_escape_path from .xml import XML from soco import config _LOG = logging.getLogger(__name__) class _ArgsSingleton(type): """ A metaclass which permits only a single instance of each derived class sharing the same `_class_group` class attribute to exist for any given set of positional arguments. Attempts to instantiate a second instance of a derived class, or another class with the same `_class_group`, with the same args will return the existing instance. For example: >>> class ArgsSingletonBase(object): ... __metaclass__ = _ArgsSingleton ... >>> class First(ArgsSingletonBase): ... _class_group = "greeting" ... def __init__(self, param): ... pass ... >>> class Second(ArgsSingletonBase): ... _class_group = "greeting" ... def __init__(self, param): ... pass >>> assert First('hi') is First('hi') >>> assert First('hi') is First('bye') AssertionError >>> assert First('hi') is Second('hi') """ _instances = {} def __call__(cls, *args, **kwargs): key = cls._class_group if hasattr(cls, '_class_group') else cls if key not in cls._instances: cls._instances[key] = {} if args not in cls._instances[key]: cls._instances[key][args] = super(_ArgsSingleton, cls).__call__( *args, **kwargs) return cls._instances[key][args] class _SocoSingletonBase( # pylint: disable=too-few-public-methods,no-init _ArgsSingleton(str('ArgsSingletonMeta'), (object,), {})): """ The base class for the SoCo class. Uses a Python 2 and 3 compatible method of declaring a metaclass. See, eg, here: http://www.artima.com/weblogs/viewpost.jsp?thread=236234 and here: http://mikewatkins.ca/2008/11/29/python-2-and-3-metaclasses/ """ pass # pylint: disable=R0904,too-many-instance-attributes class SoCo(_SocoSingletonBase): """A simple class for controlling a Sonos speaker. For any given set of arguments to __init__, only one instance of this class may be created. Subsequent attempts to create an instance with the same arguments will return the previously created instance. This means that all SoCo instances created with the same ip address are in fact the *same* SoCo instance, reflecting the real world position. Public functions:: play -- Plays the current item. play_uri -- Plays a track or a music stream by URI. play_from_queue -- Plays an item in the queue. pause -- Pause the currently playing track. stop -- Stop the currently playing track. seek -- Move the currently playing track a given elapsed time. next -- Go to the next track. previous -- Go back to the previous track. switch_to_line_in -- Switch the speaker's input to line-in. switch_to_tv -- Switch the speaker's input to TV. get_current_track_info -- Get information about the currently playing track. get_speaker_info -- Get information about the Sonos speaker. partymode -- Put all the speakers in the network in the same group. join -- Join this speaker to another "master" speaker. unjoin -- Remove this speaker from a group. get_queue -- Get information about the queue. get_artists -- Get artists from the music library get_album_artists -- Get album artists from the music library get_albums -- Get albums from the music library get_genres -- Get genres from the music library get_composers -- Get composers from the music library get_tracks -- Get tracks from the music library get_playlists -- Get playlists from the music library get_music_library_information -- Get information from the music library get_current_transport_info -- get speakers playing state browse_by_idstring -- Browse (get sub-elements) a given type add_uri_to_queue -- Adds an URI to the queue add_to_queue -- Add a track to the end of the queue remove_from_queue -- Remove a track from the queue clear_queue -- Remove all tracks from queue get_favorite_radio_shows -- Get favorite radio shows from Sonos' Radio app. get_favorite_radio_stations -- Get favorite radio stations. create_sonos_playlist -- Create a new empty Sonos playlist create_sonos_playlist_from_queue -- Create a new Sonos playlist from the current queue. add_item_to_sonos_playlist -- Adds a queueable item to a Sonos' playlist get_item_album_art_uri -- Get an item's Album Art absolute URI. search_track -- Search for an artist, artist's albums, or track. get_albums_for_artist -- Get albums for an artist. get_tracks_for_album -- Get tracks for an artist's album. start_library_update -- Trigger an update of the music library. Properties:: uid -- The speaker's unique identifier mute -- The speaker's mute status. volume -- The speaker's volume. bass -- The speaker's bass EQ. treble -- The speaker's treble EQ. loudness -- The status of the speaker's loudness compensation. cross_fade -- The status of the speaker's crossfade. status_light -- The state of the Sonos status light. player_name -- The speaker's name. play_mode -- The queue's repeat/shuffle settings. queue_size -- Get size of queue. library_updating -- Whether music library update is in progress. album_artist_display_option -- album artist display option .. warning:: These properties are not cached and will obtain information over the network, so may take longer than expected to set or return a value. It may be a good idea for you to cache the value in your own code. """ _class_group = 'SoCo' # Key words used when performing searches SEARCH_TRANSLATION = {'artists': 'A:ARTIST', 'album_artists': 'A:ALBUMARTIST', 'albums': 'A:ALBUM', 'genres': 'A:GENRE', 'composers': 'A:COMPOSER', 'tracks': 'A:TRACKS', 'playlists': 'A:PLAYLISTS', 'share': 'S:', 'sonos_playlists': 'SQ:', 'categories': 'A:'} # pylint: disable=super-on-old-class def __init__(self, ip_address): # Note: Creation of a SoCo instance should be as cheap and quick as # possible. Do not make any network calls here super(SoCo, self).__init__() # Check if ip_address is a valid IPv4 representation. # Sonos does not (yet) support IPv6 try: socket.inet_aton(ip_address) except socket.error: raise ValueError("Not a valid IP address string") #: The speaker's ip address self.ip_address = ip_address self.speaker_info = {} # Stores information about the current speaker # The services which we use # pylint: disable=invalid-name self.avTransport = AVTransport(self) self.contentDirectory = ContentDirectory(self) self.deviceProperties = DeviceProperties(self) self.renderingControl = RenderingControl(self) self.zoneGroupTopology = ZoneGroupTopology(self) self.alarmClock = AlarmClock(self) # Some private attributes self._all_zones = set() self._groups = set() self._is_bridge = None self._is_coordinator = False self._player_name = None self._uid = None self._visible_zones = set() self._zgs_cache = None _LOG.debug("Created SoCo instance for ip: %s", ip_address) def __str__(self): return "<{0} object at ip {1}>".format( self.__class__.__name__, self.ip_address) def __repr__(self): return '{0}("{1}")'.format(self.__class__.__name__, self.ip_address) @property def player_name(self): """ The speaker's name. A string. """ # We could get the name like this: # result = self.deviceProperties.GetZoneAttributes() # return result["CurrentZoneName"] # but it is probably quicker to get it from the group topology # and take advantage of any caching self._parse_zone_group_state() return self._player_name @player_name.setter def player_name(self, playername): """ Set the speaker's name """ self.deviceProperties.SetZoneAttributes([ ('DesiredZoneName', playername), ('DesiredIcon', ''), ('DesiredConfiguration', '') ]) @property def uid(self): """ A unique identifier. Looks like: RINCON_000XXXXXXXXXX1400 """ # Since this does not change over time (?) check whether we already # know the answer. If so, there is no need to go further if self._uid is not None: return self._uid # if not, we have to get it from the zone topology, which # is probably quicker than any alternative, since the zgt is probably # cached. This will set self._uid for us for next time, so we won't # have to do this again self._parse_zone_group_state() return self._uid # An alternative way of getting the uid is as follows: # self.device_description_url = \ # 'http://{0}:1400/xml/device_description.xml'.format( # self.ip_address) # response = requests.get(self.device_description_url).text # tree = XML.fromstring(response.encode('utf-8')) # udn = tree.findtext('.//{urn:schemas-upnp-org:device-1-0}UDN') # # the udn has a "uuid:" prefix before the uid, so we need to strip it # self._uid = uid = udn[5:] # return uid @property def is_visible(self): """ Is this zone visible? A zone might be invisible if, for example it is a bridge, or the slave part of stereo pair. return True or False """ # We could do this: # invisible = self.deviceProperties.GetInvisible()['CurrentInvisible'] # but it is better to do it in the following way, which uses the # zone group topology, to capitalise on any caching. return self in self.visible_zones @property def is_bridge(self): """ Is this zone a bridge? """ # Since this does not change over time (?) check whether we already # know the answer. If so, there is no need to go further if self._is_bridge is not None: return self._is_bridge # if not, we have to get it from the zone topology. This will set # self._is_bridge for us for next time, so we won't have to do this # again self._parse_zone_group_state() return self._is_bridge @property def is_coordinator(self): """ Return True if this zone is a group coordinator, otherwise False. return True or False """ # We could do this: # invisible = self.deviceProperties.GetInvisible()['CurrentInvisible'] # but it is better to do it in the following way, which uses the # zone group topology, to capitalise on any caching. self._parse_zone_group_state() return self._is_coordinator @property def play_mode(self): """ The queue's play mode. Case-insensitive options are: NORMAL -- Turns off shuffle and repeat. REPEAT_ALL -- Turns on repeat and turns off shuffle. SHUFFLE -- Turns on shuffle *and* repeat. (It's strange, I know.) SHUFFLE_NOREPEAT -- Turns on shuffle and turns off repeat. """ result = self.avTransport.GetTransportSettings([ ('InstanceID', 0), ]) return result['PlayMode'] @play_mode.setter def play_mode(self, playmode): """ Set the speaker's mode """ playmode = playmode.upper() if playmode not in PLAY_MODES: raise KeyError("'%s' is not a valid play mode" % playmode) self.avTransport.SetPlayMode([ ('InstanceID', 0), ('NewPlayMode', playmode) ]) @property def cross_fade(self): """ The speaker's cross fade state. True if enabled, False otherwise """ response = self.avTransport.GetCrossfadeMode([ ('InstanceID', 0), ]) cross_fade_state = response['CrossfadeMode'] return True if int(cross_fade_state) else False @cross_fade.setter def cross_fade(self, crossfade): """ Set the speaker's cross fade state. """ crossfade_value = '1' if crossfade else '0' self.avTransport.SetCrossfadeMode([ ('InstanceID', 0), ('CrossfadeMode', crossfade_value) ]) def play_from_queue(self, index, start=True): """ Play a track from the queue by index. The index number is required as an argument, where the first index is 0. index: the index of the track to play; first item in the queue is 0 start: If the item that has been set should start playing Returns: True if the Sonos speaker successfully started playing the track. False if the track did not start (this may be because it was not requested to start because "start=False") Raises SoCoException (or a subclass) upon errors. """ # Grab the speaker's information if we haven't already since we'll need # it in the next step. if not self.speaker_info: self.get_speaker_info() # first, set the queue itself as the source URI uri = 'x-rincon-queue:{0}#0'.format(self.uid) self.avTransport.SetAVTransportURI([ ('InstanceID', 0), ('CurrentURI', uri), ('CurrentURIMetaData', '') ]) # second, set the track number with a seek command self.avTransport.Seek([ ('InstanceID', 0), ('Unit', 'TRACK_NR'), ('Target', index + 1) ]) # finally, just play what's set if needed if start: return self.play() return False def play(self): """Play the currently selected track. Returns: True if the Sonos speaker successfully started playing the track. Raises SoCoException (or a subclass) upon errors. """ self.avTransport.Play([ ('InstanceID', 0), ('Speed', 1) ]) def play_uri(self, uri='', meta='', title='', start=True): """ Play a given stream. Pauses the queue. If there is no metadata passed in and there is a title set then a metadata object will be created. This is often the case if you have a custom stream, it will need at least the title in the metadata in order to play. Arguments: uri -- URI of a stream to be played. meta -- The track metadata to show in the player, DIDL format. title -- The track title to show in the player start -- If the URI that has been set should start playing Returns: True if the Sonos speaker successfully started playing the track. False if the track did not start (this may be because it was not requested to start because "start=False") Raises SoCoException (or a subclass) upon errors. """ if meta == '' and title != '': meta_template = '<DIDL-Lite xmlns:dc="http://purl.org/dc/elements'\ '/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" '\ 'xmlns:r="urn:schemas-rinconnetworks-com:metadata-1-0/" '\ 'xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/">'\ '<item id="R:0/0/0" parentID="R:0/0" restricted="true">'\ '<dc:title>{title}</dc:title><upnp:class>'\ 'object.item.audioItem.audioBroadcast</upnp:class><desc '\ 'id="cdudn" nameSpace="urn:schemas-rinconnetworks-com:'\ 'metadata-1-0/">{service}</desc></item></DIDL-Lite>' tunein_service = 'SA_RINCON65031_' # Radio stations need to have at least a title to play meta = meta_template.format(title=title, service=tunein_service) self.avTransport.SetAVTransportURI([ ('InstanceID', 0), ('CurrentURI', uri), ('CurrentURIMetaData', meta) ]) # The track is enqueued, now play it if needed if start: return self.play() return False def pause(self): """ Pause the currently playing track. Returns: True if the Sonos speaker successfully paused the track. Raises SoCoException (or a subclass) upon errors. """ self.avTransport.Pause([ ('InstanceID', 0), ('Speed', 1) ]) def stop(self): """ Stop the currently playing track. Returns: True if the Sonos speaker successfully stopped the playing track. Raises SoCoException (or a subclass) upon errors. """ self.avTransport.Stop([ ('InstanceID', 0), ('Speed', 1) ]) def seek(self, timestamp): """ Seeks to a given timestamp in the current track, specified in the format of HH:MM:SS or H:MM:SS. Returns: True if the Sonos speaker successfully seeked to the timecode. Raises SoCoException (or a subclass) upon errors. """ if not re.match(r'^[0-9][0-9]?:[0-9][0-9]:[0-9][0-9]$', timestamp): raise ValueError('invalid timestamp, use HH:MM:SS format') self.avTransport.Seek([ ('InstanceID', 0), ('Unit', 'REL_TIME'), ('Target', timestamp) ]) def next(self): """ Go to the next track. Returns: True if the Sonos speaker successfully skipped to the next track. Raises SoCoException (or a subclass) upon errors. Keep in mind that next() can return errors for a variety of reasons. For example, if the Sonos is streaming Pandora and you call next() several times in quick succession an error code will likely be returned (since Pandora has limits on how many songs can be skipped). """ self.avTransport.Next([ ('InstanceID', 0), ('Speed', 1) ]) def previous(self): """ Go back to the previously played track. Returns: True if the Sonos speaker successfully went to the previous track. Raises SoCoException (or a subclass) upon errors. Keep in mind that previous() can return errors for a variety of reasons. For example, previous() will return an error code (error code 701) if the Sonos is streaming Pandora since you can't go back on tracks. """ self.avTransport.Previous([ ('InstanceID', 0), ('Speed', 1) ]) @property def mute(self): """ The speaker's mute state. True if muted, False otherwise """ response = self.renderingControl.GetMute([ ('InstanceID', 0), ('Channel', 'Master') ]) mute_state = response['CurrentMute'] return True if int(mute_state) else False @mute.setter def mute(self, mute): """ Mute (or unmute) the speaker """ mute_value = '1' if mute else '0' self.renderingControl.SetMute([ ('InstanceID', 0), ('Channel', 'Master'), ('DesiredMute', mute_value) ]) @property def volume(self): """ The speaker's volume. An integer between 0 and 100. """ response = self.renderingControl.GetVolume([ ('InstanceID', 0), ('Channel', 'Master'), ]) volume = response['CurrentVolume'] return int(volume) @volume.setter def volume(self, volume): """ Set the speaker's volume """ volume = int(volume) volume = max(0, min(volume, 100)) # Coerce in range self.renderingControl.SetVolume([ ('InstanceID', 0), ('Channel', 'Master'), ('DesiredVolume', volume) ]) @property def bass(self): """ The speaker's bass EQ. An integer between -10 and 10. """ response = self.renderingControl.GetBass([ ('InstanceID', 0), ('Channel', 'Master'), ]) bass = response['CurrentBass'] return int(bass) @bass.setter def bass(self, bass): """ Set the speaker's bass """ bass = int(bass) bass = max(-10, min(bass, 10)) # Coerce in range self.renderingControl.SetBass([ ('InstanceID', 0), ('DesiredBass', bass) ]) @property def treble(self): """ The speaker's treble EQ. An integer between -10 and 10. """ response = self.renderingControl.GetTreble([ ('InstanceID', 0), ('Channel', 'Master'), ]) treble = response['CurrentTreble'] return int(treble) @treble.setter def treble(self, treble): """ Set the speaker's treble """ treble = int(treble) treble = max(-10, min(treble, 10)) # Coerce in range self.renderingControl.SetTreble([ ('InstanceID', 0), ('DesiredTreble', treble) ]) @property def loudness(self): """ The Sonos speaker's loudness compensation. True if on, otherwise False. Loudness is a complicated topic. You can find a nice summary about this feature here: http://forums.sonos.com/showthread.php?p=4698#post4698 """ response = self.renderingControl.GetLoudness([ ('InstanceID', 0), ('Channel', 'Master'), ]) loudness = response["CurrentLoudness"] return True if int(loudness) else False @loudness.setter def loudness(self, loudness): """ Switch on/off the speaker's loudness compensation """ loudness_value = '1' if loudness else '0' self.renderingControl.SetLoudness([ ('InstanceID', 0), ('Channel', 'Master'), ('DesiredLoudness', loudness_value) ]) def _parse_zone_group_state(self): """ The Zone Group State contains a lot of useful information. Retrieve and parse it, and populate the relevant properties. """ # zoneGroupTopology.GetZoneGroupState()['ZoneGroupState'] returns XML like # this: # # <ZoneGroups> # <ZoneGroup Coordinator="RINCON_000XXX1400" ID="RINCON_000XXXX1400:0"> # <ZoneGroupMember # BootSeq="33" # Configuration="1" # Icon="x-rincon-roomicon:zoneextender" # Invisible="1" # IsZoneBridge="1" # Location="http://192.168.1.100:1400/xml/device_description.xml" # MinCompatibleVersion="22.0-00000" # SoftwareVersion="24.1-74200" # UUID="RINCON_000ZZZ1400" # ZoneName="BRIDGE"/> # </ZoneGroup> # <ZoneGroup Coordinator="RINCON_000XXX1400" ID="RINCON_000XXX1400:46"> # <ZoneGroupMember # BootSeq="44" # Configuration="1" # Icon="x-rincon-roomicon:living" # Location="http://192.168.1.101:1400/xml/device_description.xml" # MinCompatibleVersion="22.0-00000" # SoftwareVersion="24.1-74200" # UUID="RINCON_000XXX1400" # ZoneName="Living Room"/> # <ZoneGroupMember # BootSeq="52" # Configuration="1" # Icon="x-rincon-roomicon:kitchen" # Location="http://192.168.1.102:1400/xml/device_description.xml" # MinCompatibleVersion="22.0-00000" # SoftwareVersion="24.1-74200" # UUID="RINCON_000YYY1400" # ZoneName="Kitchen"/> # </ZoneGroup> # </ZoneGroups> # def parse_zone_group_member(member_element): """ Parse a ZoneGroupMember or Satellite element from Zone Group State, create a SoCo instance for the member, set basic attributes and return it. """ # Create a SoCo instance for each member. Because SoCo # instances are singletons, this is cheap if they have already # been created, and useful if they haven't. We can then # update various properties for that instance. member_attribs = member_element.attrib ip_addr = member_attribs['Location'].\ split('//')[1].split(':')[0] zone = config.SOCO_CLASS(ip_addr) # uid doesn't change, but it's not harmful to (re)set it, in case # the zone is as yet unseen. zone._uid = member_attribs['UUID'] zone._player_name = member_attribs['ZoneName'] # add the zone to the set of all members, and to the set # of visible members if appropriate is_visible = False if member_attribs.get( 'Invisible') == '1' else True if is_visible: self._visible_zones.add(zone) self._all_zones.add(zone) return zone # This is called quite frequently, so it is worth optimising it. # Maintain a private cache. If the zgt has not changed, there is no # need to repeat all the XML parsing. In addition, switch on network # caching for a short interval (5 secs). zgs = self.zoneGroupTopology.GetZoneGroupState( cache_timeout=5)['ZoneGroupState'] if zgs == self._zgs_cache: return self._zgs_cache = zgs tree = XML.fromstring(zgs.encode('utf-8')) # Empty the set of all zone_groups self._groups.clear() # and the set of all members self._all_zones.clear() self._visible_zones.clear() # Loop over each ZoneGroup Element for group_element in tree.findall('ZoneGroup'): coordinator_uid = group_element.attrib['Coordinator'] group_uid = group_element.attrib['ID'] group_coordinator = None members = set() for member_element in group_element.findall('ZoneGroupMember'): zone = parse_zone_group_member(member_element) # Perform extra processing relevant to direct zone group # members # # If this element has the same UUID as the coordinator, it is # the coordinator if zone._uid == coordinator_uid: group_coordinator = zone zone._is_coordinator = True else: zone._is_coordinator = False # is_bridge doesn't change, but it does no real harm to # set/reset it here, just in case the zone has not been seen # before zone._is_bridge = True if member_element.attrib.get( 'IsZoneBridge') == '1' else False # add the zone to the members for this group members.add(zone) # Loop over Satellite elements if present, and process as for # ZoneGroup elements for satellite_element in member_element.findall('Satellite'): zone = parse_zone_group_member(satellite_element) # Assume a satellite can't be a bridge or coordinator, so # no need to check. # # Add the zone to the members for this group. members.add(zone) # Now create a ZoneGroup with this info and add it to the list # of groups self._groups.add(ZoneGroup(group_uid, group_coordinator, members)) @property def all_groups(self): """ Return a set of all the available groups""" self._parse_zone_group_state() return self._groups @property def group(self): """The Zone Group of which this device is a member. group will be None if this zone is a slave in a stereo pair.""" for group in self.all_groups: if self in group: return group return None # To get the group directly from the network, try the code below # though it is probably slower than that above # current_group_id = self.zoneGroupTopology.GetZoneGroupAttributes()[ # 'CurrentZoneGroupID'] # if current_group_id: # for group in self.all_groups: # if group.uid == current_group_id: # return group # else: # return None @property def all_zones(self): """ Return a set of all the available zones""" self._parse_zone_group_state() return self._all_zones @property def visible_zones(self): """ Return an set of all visible zones""" self._parse_zone_group_state() return self._visible_zones def partymode(self): """ Put all the speakers in the network in the same group, a.k.a Party Mode. This blog shows the initial research responsible for this: http://blog.travelmarx.com/2010/06/exploring-sonos-via-upnp.html The trick seems to be (only tested on a two-speaker setup) to tell each speaker which to join. There's probably a bit more to it if multiple groups have been defined. """ # Tell every other visible zone to join this one # pylint: disable = expression-not-assigned [zone.join(self) for zone in self.visible_zones if zone is not self] def join(self, master): """ Join this speaker to another "master" speaker. .. note:: The signature of this method has changed in 0.8. It now requires a SoCo instance to be passed as `master`, not an IP address """ self.avTransport.SetAVTransportURI([ ('InstanceID', 0), ('CurrentURI', 'x-rincon:{0}'.format(master.uid)), ('CurrentURIMetaData', '') ]) def unjoin(self): """ Remove this speaker from a group. Seems to work ok even if you remove what was previously the group master from it's own group. If the speaker was not in a group also returns ok. Returns: True if this speaker has left the group. Raises SoCoException (or a subclass) upon errors. """ self.avTransport.BecomeCoordinatorOfStandaloneGroup([ ('InstanceID', 0) ]) def switch_to_line_in(self): """ Switch the speaker's input to line-in. Returns: True if the Sonos speaker successfully switched to line-in. If an error occurs, we'll attempt to parse the error and return a UPnP error code. If that fails, the raw response sent back from the Sonos speaker will be returned. Raises SoCoException (or a subclass) upon errors. """ self.avTransport.SetAVTransportURI([ ('InstanceID', 0), ('CurrentURI', 'x-rincon-stream:{0}'.format(self.uid)), ('CurrentURIMetaData', '') ]) def switch_to_tv(self): """ Switch the speaker's input to TV. Returns: True if the Sonos speaker successfully switched to TV. If an error occurs, we'll attempt to parse the error and return a UPnP error code. If that fails, the raw response sent back from the Sonos speaker will be returned. Raises SoCoException (or a subclass) upon errors. """ self.avTransport.SetAVTransportURI([ ('InstanceID', 0), ('CurrentURI', 'x-sonos-htastream:{0}:spdif'.format(self.uid)), ('CurrentURIMetaData', '') ]) @property def status_light(self): """ The white Sonos status light between the mute button and the volume up button on the speaker. True if on, otherwise False. """ result = self.deviceProperties.GetLEDState() LEDState = result["CurrentLEDState"] # pylint: disable=invalid-name return True if LEDState == "On" else False @status_light.setter def status_light(self, led_on): """ Switch on/off the speaker's status light """ led_state = 'On' if led_on else 'Off' self.deviceProperties.SetLEDState([ ('DesiredLEDState', led_state), ]) def _build_album_art_full_uri(self, url): """ Ensure an Album Art URI is an absolute URI :param url: The album art URI """ # Add on the full album art link, as the URI version # does not include the ipaddress if not url.startswith(('http:', 'https:')): url = 'http://' + self.ip_address + ':1400' + url return url def get_current_track_info(self): """ Get information about the currently playing track. Returns: A dictionary containing the following information about the currently playing track: playlist_position, duration, title, artist, album, position and a link to the album art. If we're unable to return data for a field, we'll return an empty string. This can happen for all kinds of reasons so be sure to check values. For example, a track may not have complete metadata and be missing an album name. In this case track['album'] will be an empty string. """ response = self.avTransport.GetPositionInfo([ ('InstanceID', 0), ('Channel', 'Master') ]) track = {'title': '', 'artist': '', 'album': '', 'album_art': '', 'position': ''} track['playlist_position'] = response['Track'] track['duration'] = response['TrackDuration'] track['uri'] = response['TrackURI'] track['position'] = response['RelTime'] metadata = response['TrackMetaData'] # Store the entire Metadata entry in the track, this can then be # used if needed by the client to restart a given URI track['metadata'] = metadata # Duration seems to be '0:00:00' when listening to radio if metadata != '' and track['duration'] == '0:00:00': metadata = XML.fromstring(really_utf8(metadata)) # Try parse trackinfo trackinfo = metadata.findtext('.//{urn:schemas-rinconnetworks-com:' 'metadata-1-0/}streamContent') index = trackinfo.find(' - ') if index > -1: track['artist'] = trackinfo[:index] track['title'] = trackinfo[index + 3:] else: # Might find some kind of title anyway in metadata track['title'] = metadata.findtext('.//{http://purl.org/dc/' 'elements/1.1/}title') if not track['title']: _LOG.warning('Could not handle track info: "%s"', trackinfo) track['title'] = trackinfo # If the speaker is playing from the line-in source, querying for track # metadata will return "NOT_IMPLEMENTED". elif metadata not in ('', 'NOT_IMPLEMENTED', None): # Track metadata is returned in DIDL-Lite format metadata = XML.fromstring(really_utf8(metadata)) md_title = metadata.findtext( './/{http://purl.org/dc/elements/1.1/}title') md_artist = metadata.findtext( './/{http://purl.org/dc/elements/1.1/}creator') md_album = metadata.findtext( './/{urn:schemas-upnp-org:metadata-1-0/upnp/}album') track['title'] = "" if md_title: track['title'] = md_title track['artist'] = "" if md_artist: track['artist'] = md_artist track['album'] = "" if md_album: track['album'] = md_album album_art_url = metadata.findtext( './/{urn:schemas-upnp-org:metadata-1-0/upnp/}albumArtURI') if album_art_url is not None: track['album_art'] = self._build_album_art_full_uri( album_art_url) return track def get_speaker_info(self, refresh=False, timeout=(3, 5)): """ Get information about the Sonos speaker. Arguments: refresh -- Refresh the speaker info cache. timeout -- How long to wait for the server to send data before giving up, as a float, or a (`connect timeout, read timeout`_) tuple. If not specified a default (3, 5) timeout will be used, to disable it at all set explicitly to None. Returns: Information about the Sonos speaker, such as the UID, MAC Address, and Zone Name. """ if self.speaker_info and refresh is False: return self.speaker_info else: response = requests.get('http://' + self.ip_address + ':1400/status/zp', timeout=timeout) dom = XML.fromstring(response.content) if dom.findtext('.//ZoneName') is not None: self.speaker_info['zone_name'] = \ dom.findtext('.//ZoneName') self.speaker_info['zone_icon'] = dom.findtext('.//ZoneIcon') self.speaker_info['uid'] = self.uid self.speaker_info['serial_number'] = \ dom.findtext('.//SerialNumber') self.speaker_info['software_version'] = \ dom.findtext('.//SoftwareVersion') self.speaker_info['hardware_version'] = \ dom.findtext('.//HardwareVersion') self.speaker_info['mac_address'] = dom.findtext('.//MACAddress') return self.speaker_info def get_current_transport_info(self): """ Get the current playback state Returns: A dictionary containing the following information about the speakers playing state current_transport_state (PLAYING, PAUSED_PLAYBACK, STOPPED), current_trasnport_status (OK, ?), current_speed(1,?) This allows us to know if speaker is playing or not. Don't know other states of CurrentTransportStatus and CurrentSpeed. """ response = self.avTransport.GetTransportInfo([ ('InstanceID', 0), ]) playstate = { 'current_transport_status': '', 'current_transport_state': '', 'current_transport_speed': '' } playstate['current_transport_state'] = \ response['CurrentTransportState'] playstate['current_transport_status'] = \ response['CurrentTransportStatus'] playstate['current_transport_speed'] = response['CurrentSpeed'] return playstate def get_queue(self, start=0, max_items=100, full_album_art_uri=False): """ Get information about the queue :param start: Starting number of returned matches :param max_items: Maximum number of returned matches :param full_album_art_uri: If the album art URI should include the IP address :returns: A :py:class:`~.soco.data_structures.Queue` object This method is heavly based on Sam Soffes (aka soffes) ruby implementation """ queue = [] response = self.contentDirectory.Browse([ ('ObjectID', 'Q:0'), ('BrowseFlag', 'BrowseDirectChildren'), ('Filter', '*'), ('StartingIndex', start), ('RequestedCount', max_items), ('SortCriteria', '') ]) result = response['Result'] metadata = {} for tag in ['NumberReturned', 'TotalMatches', 'UpdateID']: metadata[camel_to_underscore(tag)] = int(response[tag]) # I'm not sure this necessary (any more). Even with an empty queue, # there is still a result object. This shoud be investigated. if not result: # pylint: disable=star-args return Queue(queue, **metadata) items = from_didl_string(result) for item in items: # Check if the album art URI should be fully qualified if full_album_art_uri: self._update_album_art_to_full_uri(item) queue.append(item) # pylint: disable=star-args return Queue(queue, **metadata) @property def queue_size(self): """ Get size of queue """ response = self.contentDirectory.Browse([ ('ObjectID', 'Q:0'), ('BrowseFlag', 'BrowseMetadata'), ('Filter', '*'), ('StartingIndex', 0), ('RequestedCount', 1), ('SortCriteria', '') ]) dom = XML.fromstring(really_utf8(response['Result'])) queue_size = None container = dom.find( '{urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/}container') if container is not None: child_count = container.get('childCount') if child_count is not None: queue_size = int(child_count) return queue_size def get_sonos_playlists(self, *args, **kwargs): """ Convenience method for: get_music_library_information('sonos_playlists') Refer to the docstring for that method """ args = tuple(['sonos_playlists'] + list(args)) return self.get_music_library_information(*args, **kwargs) def get_artists(self, *args, **kwargs): """ Convenience method for :py:meth:`get_music_library_information` with `search_type='artists'`. For details on remaining arguments refer to the docstring for that method. """ args = tuple(['artists'] + list(args)) return self.get_music_library_information(*args, **kwargs) def get_album_artists(self, *args, **kwargs): """ Convenience method for :py:meth:`get_music_library_information` with `search_type='album_artists'`. For details on remaining arguments refer to the docstring for that method. """ args = tuple(['album_artists'] + list(args)) return self.get_music_library_information(*args, **kwargs) def get_albums(self, *args, **kwargs): """ Convenience method for :py:meth:`get_music_library_information` with `search_type='albums'`. For details on remaining arguments refer to the docstring for that method. """ args = tuple(['albums'] + list(args)) return self.get_music_library_information(*args, **kwargs) def get_genres(self, *args, **kwargs): """ Convenience method for :py:meth:`get_music_library_information` with `search_type='genres'`. For details on remaining arguments refer to the docstring for that method. """ args = tuple(['genres'] + list(args)) return self.get_music_library_information(*args, **kwargs) def get_composers(self, *args, **kwargs): """ Convenience method for :py:meth:`get_music_library_information` with `search_type='composers'`. For details on remaining arguments refer to the docstring for that method. """ args = tuple(['composers'] + list(args)) return self.get_music_library_information(*args, **kwargs) def get_tracks(self, *args, **kwargs): """ Convenience method for :py:meth:`get_music_library_information` with `search_type='tracks'`. For details on remaining arguments refer to the docstring for that method. """ args = tuple(['tracks'] + list(args)) return self.get_music_library_information(*args, **kwargs) def get_playlists(self, *args, **kwargs): """ Convenience method for :py:meth:`get_music_library_information` with `search_type='playlists'`. For details on remaining arguments refer to the docstring for that method. NOTE: The playlists that are referred to here are the playlist (files) imported from the music library, they are not the Sonos playlists. """ args = tuple(['playlists'] + list(args)) return self.get_music_library_information(*args, **kwargs) # pylint: disable=too-many-locals, too-many-arguments, too-many-branches def get_music_library_information(self, search_type, start=0, max_items=100, full_album_art_uri=False, search_term=None, subcategories=None, complete_result=False): """ Retrieve music information objects from the music library This method is the main method to get music information items, like e.g. tracks, albums etc., from the music library with. It can be used in a few different ways: The **search_term** argument performs a fuzzy search on that string in the results, so e.g calling:: get_music_library_items('artist', search_term='Metallica') will perform a fuzzy search for the term 'Metallica' among all the artists. Using the **subcategories** argument, will jump directly into that subcategory of the search and return results from there. So. e.g knowing that among the artist is one called 'Metallica', calling:: get_music_library_items('artist', subcategories=['Metallica']) will jump directly into the 'Metallica' sub category and return the albums associated with Metallica and:: get_music_library_items('artist', subcategories=['Metallica', 'Black']) will return the tracks of the album 'Black' by the artist 'Metallica'. The order of sub category types is: Genres->Artists->Albums->Tracks. It is also possible to combine the two, to perform a fuzzy search in a sub category. The **start**, **max_items** and **complete_result** arguments all has to do with paging of the results. Per default, the searches are always paged, because there is a limit to how many items we can get at a time. This paging is exposed to the user with the start and max_items arguments. So calling:: get_music_library_items('artists', start=0, max_items=100) get_music_library_items('artists', start=100, max_items=100) will get the first and next 100 items, respectively. It is also possible to ask for all the elements at once:: get_music_library_items('artists', complete_result=True) This will perform the paging internally and simply return all the items. :param search_type: The kind of information to retrieve. Can be one of: 'artists', 'album_artists', 'albums', 'genres', 'composers', 'tracks', 'share', 'sonos_playlists', and 'playlists', where playlists are the imported file based playlists from the music library :param start: Starting number of returned matches (zero based). :param max_items: Maximum number of returned matches. NOTE: The maximum may be restricted by the unit, presumably due to transfer size consideration, so check the returned number against the requested. :param full_album_art_uri: If the album art URI should include the IP address :param search_term: A string that will be used to perform a fuzzy search among the search results. If used in combination with subcategories, the fuzzy search will be performed in the subcategory :param subcategories: A list of strings that indicate one or more subcategories to dive into :param complete_result: Will disable paging (ignore start and max_items) and return all results for the search. WARNING! Getting e.g. all the tracks in a large collection might take some time. :returns: A :py:class:`~.soco.data_structures.SearchResult` object :raises: :py:class:`SoCoException` upon errors NOTE: The playlists that are returned with the 'playlists' search, are the playlists imported from (files in) the music library, they are not the Sonos playlists. The information about the which searches can be performed and the form of the query has been gathered from the Janos project: http://sourceforge.net/projects/janos/ Props to the authors of that project. """ search = self.SEARCH_TRANSLATION[search_type] # Add sub categories if subcategories is not None: for category in subcategories: search += '/' + url_escape_path(really_unicode(category)) # Add fuzzy search if search_term is not None: search += ':' + url_escape_path(really_unicode(search_term)) item_list = [] metadata = {'total_matches': 100000} while len(item_list) < metadata['total_matches']: # Change start and max for complete searches if complete_result: start, max_items = len(item_list), 100000 # Try and get this batch of results try: response, metadata =\ self._music_lib_search(search, start, max_items) except SoCoUPnPException as exception: # 'No such object' UPnP errors if exception.error_code == '701': return SearchResult([], search_type, 0, 0, None) else: raise exception # Parse the results items = from_didl_string(response['Result']) for item in items: # Check if the album art URI should be fully qualified if full_album_art_uri: self._update_album_art_to_full_uri(item) # Append the item to the list item_list.append(item) # If we are not after the complete results, the stop after 1 # iteration if not complete_result: break metadata['search_type'] = search_type if complete_result: metadata['number_returned'] = len(item_list) # pylint: disable=star-args return SearchResult(item_list, **metadata) def browse(self, ml_item=None, start=0, max_items=100, full_album_art_uri=False, search_term=None, subcategories=None): """Browse (get sub-elements) a music library item :param ml_item: The MusicLibraryItem to browse, if left out or passed None, the items at the base level will be returned :type ml_item: MusicLibraryItem :param start: The starting index of the results :type start: int :param max_items: The maximum number of items to return :type max_items: int :param full_album_art_uri: If the album art URI should include the IP address :type full_album_art_uri: bool :param search_term: A string that will be used to perform a fuzzy search among the search results. If used in combination with subcategories, the fuzzy search will be performed on the subcategory. NOTE: Searching will not work if ml_item is None. :type search_term: str :param subcategories: A list of strings that indicate one or more subcategories to dive into. NOTE: Providing sub categories will not work if ml_item is None. :type subcategories: list :returns: A :py:class:`~.soco.data_structures.SearchResult` object :rtype: :py:class:`~.soco.data_structures.SearchResult` :raises: AttributeError: If ``ml_item`` has no ``item_id`` attribute SoCoUPnPException: With ``error_code='701'`` if the item cannot be browsed """ if ml_item is None: search = 'A:' else: search = ml_item.item_id # Add sub categories if subcategories is not None: for category in subcategories: search += '/' + url_escape_path(really_unicode(category)) # Add fuzzy search if search_term is not None: search += ':' + url_escape_path(really_unicode(search_term)) try: response, metadata =\ self._music_lib_search(search, start, max_items) except SoCoUPnPException as exception: # 'No such object' UPnP errors if exception.error_code == '701': return SearchResult([], 'browse', 0, 0, None) else: raise exception metadata['search_type'] = 'browse' # Parse the results containers = from_didl_string(response['Result']) item_list = [] for container in containers: # Check if the album art URI should be fully qualified if full_album_art_uri: self._update_album_art_to_full_uri(container) item_list.append(container) # pylint: disable=star-args return SearchResult(item_list, **metadata) # pylint: disable=too-many-arguments def browse_by_idstring(self, search_type, idstring, start=0, max_items=100, full_album_art_uri=False): """Browse (get sub-elements) a given type :param search_type: The kind of information to retrieve. Can be one of: 'artists', 'album_artists', 'albums', 'genres', 'composers', 'tracks', 'share', 'sonos_playlists', and 'playlists', where playlists are the imported file based playlists from the music library :param idstring: String ID to search for :param start: Starting number of returned matches :param max_items: Maximum number of returned matches. NOTE: The maximum may be restricted by the unit, presumably due to transfer size consideration, so check the returned number against the requested. :param full_album_art_uri: If the album art URI should include the IP address :returns: A dictionary with metadata for the search, with the keys 'number_returned', 'update_id', 'total_matches' and an 'item_list' list with the search results. """ search = self.SEARCH_TRANSLATION[search_type] # Check if the string ID already has the type, if so we do not want to # add one also Imported playlist have a full path to them, so they do # not require the A:PLAYLISTS part first if idstring.startswith(search) or (search_type == 'playlists'): search = "" search_item_id = search + idstring search_uri = "#" + search_item_id # Not sure about the res protocol. But this seems to work res = [DidlResource( uri=search_uri, protocol_info="x-rincon-playlist:*:*:*")] search_item = DidlObject( resources=res, title='', parent_id='', item_id=search_item_id) # Call the base version return self.browse(search_item, start, max_items, full_album_art_uri) def _music_lib_search(self, search, start, max_items): """Perform a music library search and extract search numbers You can get an overview of all the relevant search prefixes (like 'A:') and their meaning with the request: .. code :: response = device.contentDirectory.Browse([ ('ObjectID', '0'), ('BrowseFlag', 'BrowseDirectChildren'), ('Filter', '*'), ('StartingIndex', 0), ('RequestedCount', 100), ('SortCriteria', '') ]) Args: search (str): The ID to search start: The index of the forst item to return max_items: The maximum number of items to return Returns: tuple: (response, metadata) where response is the returned metadata and metadata is a dict with the 'number_returned', 'total_matches' and 'update_id' integers """ response = self.contentDirectory.Browse([ ('ObjectID', search), ('BrowseFlag', 'BrowseDirectChildren'), ('Filter', '*'), ('StartingIndex', start), ('RequestedCount', max_items), ('SortCriteria', '') ]) # Get result information metadata = {} for tag in ['NumberReturned', 'TotalMatches', 'UpdateID']: metadata[camel_to_underscore(tag)] = int(response[tag]) return response, metadata def add_uri_to_queue(self, uri): """Adds the URI to the queue :param uri: The URI to be added to the queue :type uri: str """ # FIXME: The res.protocol_info should probably represent the mime type # etc of the uri. But this seems OK. res = [DidlResource(uri=uri, protocol_info="x-rincon-playlist:*:*:*")] item = DidlObject(resources=res, title='', parent_id='', item_id='') return self.add_to_queue(item) def add_to_queue(self, queueable_item): """ Adds a queueable item to the queue """ metadata = to_didl_string(queueable_item) metadata.encode('utf-8') response = self.avTransport.AddURIToQueue([ ('InstanceID', 0), ('EnqueuedURI', queueable_item.resources[0].uri), ('EnqueuedURIMetaData', metadata), ('DesiredFirstTrackNumberEnqueued', 0), ('EnqueueAsNext', 1) ]) qnumber = response['FirstTrackNumberEnqueued'] return int(qnumber) def remove_from_queue(self, index): """ Remove a track from the queue by index. The index number is required as an argument, where the first index is 0. index: the index of the track to remove; first item in the queue is 0 Returns: True if the Sonos speaker successfully removed the track Raises SoCoException (or a subclass) upon errors. """ # TODO: what do these parameters actually do? updid = '0' objid = 'Q:0/' + str(index + 1) self.avTransport.RemoveTrackFromQueue([ ('InstanceID', 0), ('ObjectID', objid), ('UpdateID', updid), ]) def clear_queue(self): """ Removes all tracks from the queue. Returns: True if the Sonos speaker cleared the queue. Raises SoCoException (or a subclass) upon errors. """ self.avTransport.RemoveAllTracksFromQueue([ ('InstanceID', 0), ]) def get_favorite_radio_shows(self, start=0, max_items=100): """ Get favorite radio shows from Sonos' Radio app. Returns: A list containing the total number of favorites, the number of favorites returned, and the actual list of favorite radio shows, represented as a dictionary with `title` and `uri` keys. Depending on what you're building, you'll want to check to see if the total number of favorites is greater than the amount you requested (`max_items`), if it is, use `start` to page through and get the entire list of favorites. """ return self.__get_radio_favorites(RADIO_SHOWS, start, max_items) def get_favorite_radio_stations(self, start=0, max_items=100): """ Get favorite radio stations from Sonos' Radio app. Returns: A list containing the total number of favorites, the number of favorites returned, and the actual list of favorite radio stations, represented as a dictionary with `title` and `uri` keys. Depending on what you're building, you'll want to check to see if the total number of favorites is greater than the amount you requested (`max_items`), if it is, use `start` to page through and get the entire list of favorites. """ return self.__get_radio_favorites(RADIO_STATIONS, start, max_items) def __get_radio_favorites(self, favorite_type, start=0, max_items=100): """ Helper method for `get_favorite_radio_*` methods. Arguments: favorite_type -- Specify either `RADIO_STATIONS` or `RADIO_SHOWS`. start -- Which number to start the retrieval from. Used for paging. max_items -- The total number of results to return. """ if favorite_type != RADIO_SHOWS or RADIO_STATIONS: favorite_type = RADIO_STATIONS response = self.contentDirectory.Browse([ ('ObjectID', 'R:0/{0}'.format(favorite_type)), ('BrowseFlag', 'BrowseDirectChildren'), ('Filter', '*'), ('StartingIndex', start), ('RequestedCount', max_items), ('SortCriteria', '') ]) result = {} favorites = [] results_xml = response['Result'] if results_xml != '': # Favorites are returned in DIDL-Lite format metadata = XML.fromstring(really_utf8(results_xml)) for item in metadata.findall( '{urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/}item'): favorite = {} favorite['title'] = item.findtext( '{http://purl.org/dc/elements/1.1/}title') favorite['uri'] = item.findtext( '{urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/}res') favorites.append(favorite) result['total'] = response['TotalMatches'] result['returned'] = len(favorites) result['favorites'] = favorites return result def _update_album_art_to_full_uri(self, item): """Update an item's Album Art URI to be an absolute URI :param item: The item to update the URI for """ if getattr(item, 'album_art_uri', False): item.album_art_uri = self._build_album_art_full_uri( item.album_art_uri) def create_sonos_playlist(self, title): """ Create a new empty Sonos playlist. :params title: Name of the playlist :returns: An instance of :py:class:`~.soco.data_structures.DidlPlaylistContainer` """ response = self.avTransport.CreateSavedQueue([ ('InstanceID', 0), ('Title', title), ('EnqueuedURI', ''), ('EnqueuedURIMetaData', ''), ]) item_id = response['AssignedObjectID'] obj_id = item_id.split(':', 2)[1] uri = "file:///jffs/settings/savedqueues.rsq#{0}".format(obj_id) res = [DidlResource(uri=uri, protocol_info="x-rincon-playlist:*:*:*")] return DidlPlaylistContainer( resources=res, title=title, parent_id='SQ:', item_id=item_id) # pylint: disable=invalid-name def create_sonos_playlist_from_queue(self, title): """ Create a new Sonos playlist from the current queue. :params title: Name of the playlist :returns: An instance of :py:class:`~.soco.data_structures.DidlPlaylistContainer` """ # Note: probably same as Queue service method SaveAsSonosPlaylist # but this has not been tested. This method is what the # controller uses. response = self.avTransport.SaveQueue([ ('InstanceID', 0), ('Title', title), ('ObjectID', '') ]) item_id = response['AssignedObjectID'] obj_id = item_id.split(':', 2)[1] uri = "file:///jffs/settings/savedqueues.rsq#{0}".format(obj_id) res = [DidlResource(uri=uri, protocol_info="x-rincon-playlist:*:*:*")] return DidlPlaylistContainer( resources=res, title=title, parent_id='SQ:', item_id=item_id) def add_item_to_sonos_playlist(self, queueable_item, sonos_playlist): """ Adds a queueable item to a Sonos' playlist :param queueable_item: the item to add to the Sonos' playlist :param sonos_playlist: the Sonos' playlist to which the item should be added """ # Check if the required attributes are there for attribute in ['didl_metadata', 'uri']: if not hasattr(queueable_item, attribute): message = 'queueable_item has no attribute {0}'.\ format(attribute) raise AttributeError(message) # Get the metadata try: metadata = XML.tostring(queueable_item.didl_metadata) except DIDLMetadataError as exception: message = ('The queueable item could not be enqueued, because it ' 'raised a DIDLMetadataError exception with the ' 'following message:\n{0}').format(str(exception)) raise ValueError(message) if isinstance(metadata, str): metadata = metadata.encode('utf-8') response, _ = self._music_lib_search(sonos_playlist.item_id, 0, 1) update_id = response['UpdateID'] self.avTransport.AddURIToSavedQueue([ ('InstanceID', 0), ('UpdateID', update_id), ('ObjectID', sonos_playlist.item_id), ('EnqueuedURI', queueable_item.uri), ('EnqueuedURIMetaData', metadata), ('AddAtIndex', 4294967295) # this field has always this value, we # do not known the meaning of this # "magic" number. ]) def get_item_album_art_uri(self, item): """ Get an item's Album Art absolute URI. """ if getattr(item, 'album_art_uri', False): return self._build_album_art_full_uri(item.album_art_uri) else: return None # pylint: disable=too-many-locals def search_track(self, artist, album=None, track=None, full_album_art_uri=False): """Search for an artist, artist's albums, or specific track. :param artist: Artist name :type artist: str :param album: Album name :type album: str :param track: Track name :type track: str :param full_album_art_uri: If the album art URI should include the IP address :type full_album_art_uri: bool :returns: A :py:class:`~.soco.data_structures.SearchResult` object. :rtype: :py:class:`~.soco.data_structures.SearchResult` """ subcategories = [artist] subcategories.append(album or '') # Perform the search result = self.get_album_artists( full_album_art_uri=full_album_art_uri, subcategories=subcategories, search_term=track, complete_result=True) result._metadata['search_type'] = 'search_track' return result def get_albums_for_artist(self, artist, full_album_art_uri=False): """Get albums for an artist. :param artist: Artist name :type artist: str :param full_album_art_uri: If the album art URI should include the IP address :type full_album_art_uri: bool :returns: A :py:class:`~.soco.data_structures.SearchResult` object. :rtype: :py:class:`~.soco.data_structures.SearchResult` """ subcategories = [artist] result = self.get_album_artists( full_album_art_uri=full_album_art_uri, subcategories=subcategories, complete_result=True) reduced = [item for item in result if item.__class__ == DidlMusicAlbum] # It is necessary to update the list of items in two places, due to # a bug in SearchResult result[:] = reduced result._metadata.update({ 'item_list': reduced, 'search_type': 'albums_for_artist', 'number_returned': len(reduced), 'total_matches': len(reduced) }) return result def get_tracks_for_album(self, artist, album, full_album_art_uri=False): """Get tracks for an artist's album. :param artist: Artist name :type artist: str :param album: Album name :type album: str :param full_album_art_uri: If the album art URI should include the IP address :type full_album_art_uri: bool :returns: A :py:class:`~.soco.data_structures.SearchResult` object. :rtype: :py:class:`~.soco.data_structures.SearchResult` """ subcategories = [artist, album] result = self.get_album_artists( full_album_art_uri=full_album_art_uri, subcategories=subcategories, complete_result=True) result._metadata['search_type'] = 'tracks_for_album' return result @property def library_updating(self): """True if the music library is in the process of being updated :returns: True if the music library is in the process of being updated :rtype: bool """ result = self.contentDirectory.GetShareIndexInProgress() return result['IsIndexing'] != '0' def start_library_update(self, album_artist_display_option=''): """Start an update of the music library. If specified, album_artist_display_option changes the album artist compilation setting (see also album_artist_display_option). """ return self.contentDirectory.RefreshShareIndex([ ('AlbumArtistDisplayOption', album_artist_display_option), ]) @property def album_artist_display_option(self): """Return the current value of the album artist compilation setting (see http://www.sonos.com/support/help/3.4/en/sonos_user_guide/ Chap07_new/Compilation_albums.htm) This is a string. Possible values: * "WMP" - Use Album Artists * "ITUNES" - Use iTunes® Compilations * "NONE" - Do not group compilations To change the current setting, call `start_library_update` and pass the new setting. """ result = self.contentDirectory.GetAlbumArtistDisplayOption() return result['AlbumArtistDisplayOption'] # definition section RADIO_STATIONS = 0 RADIO_SHOWS = 1 NS = {'dc': '{http://purl.org/dc/elements/1.1/}', 'upnp': '{urn:schemas-upnp-org:metadata-1-0/upnp/}', '': '{urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/}'} # Valid play modes PLAY_MODES = ('NORMAL', 'SHUFFLE_NOREPEAT', 'SHUFFLE', 'REPEAT_ALL') if config.SOCO_CLASS is None: config.SOCO_CLASS = SoCo
xxdede/SoCo
soco/core.py
Python
mit
72,281
class CommentSerializer < ApplicationSerializer cache key: 'comments', expires_in: 3.hours attributes :id, :content belongs_to :post, serializer: PostTinySerializer belongs_to :user, serializer: UserTinySerializer end
merqlove/mysterious_api
app/serializers/comment_serializer.rb
Ruby
mit
227
.App-footer { position: absolute; bottom: 0; background-color: #3e3e3e; text-align: center; color: #FFF; left: 0; right: 0; }
rudrakshpathak/react-app-boilerplate
src/Components/Footer/Footer.css
CSS
mit
161
# coding=UTF-8 ''' Created on 24.09.2017 @author: sysoev ''' from google.appengine.ext import db from google.appengine.api import users import datetime import time import logging from myusers import MyUser def force_unicode(string): if type(string) == unicode: return string return string.decode('utf-8') class Project(db.Model): name = db.StringProperty(multiline=False) def getProjectsList(user): return None def updateProject(key, name): p = Project.get(key) if not p: return p.name = name p.put() def addProject(name): p = Project() p.name = name p.put() return p.key() class UserProject(db.Model): user_key = db.ReferenceProperty(MyUser) project_key = db.ReferenceProperty(Project) number = 0 def addUserProject(user_name, project_key_str): user_query = MyUser.all() user = user_query.filter('username = ', user_name).get() if user is None: return None true_project_key = Project.get(project_key_str).key() if check_user_have_project(user, true_project_key): return False up = UserProject() up.user_key = user.key() up.project_key = true_project_key up.put() return True def check_user_have_project(user, true_project_key): user_project_keys = [user_proj.project_key.key() for user_proj in UserProject.all().filter('user_key = ', user.key()).fetch(None)] return true_project_key in user_project_keys def deleteUserProject(user_key, project_key): query = UserProject.all() query.filter('user_key = ', MyUser.get(user_key)).filter('project_key = ', Project.get(project_key)) user_project = query.get() if user_project is None: return None # project.key().delete() db.delete(user_project.key()) return True def getUserProjects(user): if user is None: return [] query = UserProject.all().filter('user_key = ', user.key()) return [user_project.project_key for user_project in query] # return [Project.get(user_project.project_key) for user_project in query] class Request(db.Model): number = int name = db.StringProperty() description = db.StringProperty(multiline=True) state = int perfomer = db.ReferenceProperty() #??? def addRequests(project_key, name, description): print("log") req = Request(parent=project_key) req.name = name req.description = description req.perfomer = "" req.state = 1 req.number = Request(ancestor = project_key).all().length + 1 req.put() Project.set(project_key).number += 1 return True def getRequests(project_key): if project_key is None: return [] query = Request(ancestor = project_key).all() return query
sysoevss/WebApps17
data.py
Python
mit
2,774
package main import ( "encoding/json" "fmt" "net/url" "os" "time" "github.com/Sirupsen/logrus" "github.com/codegangsta/cli" "github.com/gin-gonic/gin" "github.com/gorilla/schema" "github.com/itsjamie/gin-cors" "github.com/moul/as-a-service" ) func main() { app := cli.NewApp() app.Name = "moul-as-a-service" app.Usage = "moul, but as a service" app.Commands = []cli.Command{} for action := range moul.Actions() { command := cli.Command{ Name: action, Action: CliActionCallback, } app.Commands = append(app.Commands, command) } app.Commands = append(app.Commands, cli.Command{ Name: "server", Description: "Run as a webserver", Action: Daemon, }) app.Run(os.Args) } func CliActionCallback(c *cli.Context) { action := c.Command.Name ret, err := moul.Actions()[action](c.Args()) if err != nil { logrus.Fatalf("Failed to execute %q: %v", action, err) } out, err := json.MarshalIndent(ret, "", " ") if err != nil { logrus.Fatalf("Failed to marshal json: %v", err) } fmt.Printf("%s\n", out) } func Daemon(c *cli.Context) { r := gin.Default() r.Use(cors.Middleware(cors.Config{ Origins: "*", Methods: "GET", RequestHeaders: "Origin, Authorization, Content-Type", ExposedHeaders: "", MaxAge: 50 * time.Second, Credentials: true, ValidateHeaders: false, })) // Register index r.GET("/", func(c *gin.Context) { services := []string{} for action := range moul.Actions() { services = append(services, fmt.Sprintf("/%s", action)) } c.JSON(200, gin.H{ "services": services, }) }) // Register actions for action, fn := range moul.Actions() { fmt.Println(action, fn) func(action string, fn moul.Action) { callback := func(c *gin.Context) { u, err := url.Parse(c.Request.URL.String()) if err != nil { c.String(500, fmt.Sprintf("failed to poarse url %q: %v", c.Request.URL.String(), err)) } ret, err := fn(nil) // ret, err :- fn(u.RawQuery, c.Request.Body) if err != nil { c.JSON(500, gin.H{ "err": err, }) return } // FIXME: handle content-types m, err := url.ParseQuery(u.RawQuery) if err != nil { c.JSON(500, gin.H{ "err": err, }) return } var opts struct { Callback string `schema:"callback"` } if len(m) > 0 { decoder := schema.NewDecoder() if err := decoder.Decode(&opts, m); err != nil { c.JSON(500, gin.H{ "err": err, }) return } } if opts.Callback != "" { // JSONP jsonBytes, err := json.Marshal(ret) if err != nil { c.JSON(500, gin.H{ "err": err, }) return } jsonp := fmt.Sprintf("%s(%s)", opts.Callback, string(jsonBytes)) c.String(200, jsonp) } else { // Standard JSON c.JSON(200, ret) } } r.GET(fmt.Sprintf("/%s", action), callback) // POST }(action, fn) } // Start server port := "8080" if os.Getenv("PORT") != "" { port = os.Getenv("PORT") } r.Run(fmt.Sprintf(":%s", port)) }
moul/as-a-service
cmd/moul-as-a-service/main.go
GO
mit
3,077
import $ from 'jquery'; import ChromeExtensionMessageService from '../../../reuse/messageServiceDefinition'; /** * * @param {*} $scope * @param {*} $document * @param {*} $location * @param {ChromeExtensionMessageService} messageService * @param {*} analyticsService */ function MenuController($scope, $document, $location, messageService, analyticsService) { $scope.importOpml = function() { $('#opmlUploader').trigger('click'); }; $scope.togglePlaylistVisibility = togglePlaylistVisibility; $scope.exportOpml = exportOpml; // ng-change is not supported for input type='file' $document[0].getElementById('opmlUploader').addEventListener('change', fileNameChanged); function fileNameChanged(event) { var file = event.currentTarget.files[0]; // clear so that selecting the same file twice will call it again. // not really necessary in real world use cases. $document[0].getElementById('opmlUploader').value = ''; var reader = new FileReader; reader.onload = function(e) { var jqParsed = $(e.currentTarget.result); var podcasts = []; var rssFeeds = jqParsed.find('outline[type="rss"]'); rssFeeds.each(function(index, value) { var feedURL = $(value).attr('xmlUrl'); if(feedURL) { podcasts.push(feedURL); } }); if(podcasts.length) { $location.path('/Podcasts'); analyticsService.trackEvent('feed', 'add_by_opml_file', undefined, podcasts.length); messageService.for('podcastManager').sendMessage('addPodcasts', { podcasts: podcasts}); } }; reader.readAsText(file); } function togglePlaylistVisibility() { messageService.for('playlist').sendMessage('toggleVisibility'); } function exportOpml() { messageService.for('podcastManager').sendMessage('getOpml', null, response => { download(response); }); } function download(text) { var element = $document[0].createElement('a'); element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); element.setAttribute('download', 'podStation.opml'); element.style.display = 'none'; $document[0].body.appendChild(element); element.click(); $document[0].body.removeChild(element); } } export default MenuController;
podStation/podStation
src/ui/ng/controllers/menuController.js
JavaScript
mit
2,217
import * as actions from '../UserActions'; it('should setup loggingIn', () => { const action = actions.loggingIn(); const expected = { type: 'LOGGING_IN' }; expect(action).toEqual(expected); }); it('should setup loggedInSuccess', () => { const user = 'janesmith'; const action = actions.loggedInSuccess(user); const expected = { type: 'LOGGED_IN_SUCCESS', payload: user }; expect(action).toEqual(expected); }); it('should setup loggedInError', () => { const err = 'something went wrong'; const action = actions.loggedInError(err); const expected = { type: 'LOGGED_IN_ERROR', error: err }; expect(action).toEqual(expected); }); it('should setup logoutSuccess', () => { const action = actions.logoutSuccess(); const expected = { type: 'LOGGED_OUT_SUCCESS' }; expect(action).toEqual(expected); });
fusionalliance/autorenter-react
src/actions/__test__/UserActions.test.js
JavaScript
mit
859
<?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateTableProjeto extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('projetos', function (Blueprint $table) { $table->increments('id'); $table->string('descricao', 100); $table->boolean('apagado'); $table->boolean('cancelado'); $table->timestamps(); $table->softDeletes(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::drop('projetos'); } }
albertosveloso/rtlaravel
database/migrations/2015_09_19_151134_create_table_projeto.php
PHP
mit
710
var page; var healthStore; var weightType; function pageLoaded(args) { page = args.object; weightType = HKObjectType.quantityTypeForIdentifier(HKQuantityTypeIdentifierBodyMass); healthStore = HKHealthStore.new(); requestPermissions(healthStore, [weightType], [weightType]); } exports.pageLoaded = pageLoaded; function getWeightButtonTap(args) { hideKeyboard(); getHealthKitValue(healthStore, weightType, function (weight) { alert("Your weight is " + weight.doubleValueForUnit(HKUnit.poundUnit()) + " pounds"); }); } exports.getWeightButtonTap = getWeightButtonTap; function setWeightButtonTap(args) { hideKeyboard(); var textField = page.getViewById("weightTextView"); var weight = parseFloat(textField.text); setHalthKitValue(healthStore, weightType, HKQuantity.quantityWithUnitDoubleValue(HKUnit.poundUnit(), weight)); } exports.setWeightButtonTap = setWeightButtonTap; function hideKeyboard() { var textField = page.getViewById("weightTextView"); textField.ios.resignFirstResponder(); } function requestPermissions(healthStore, writeTypes, readTypes) { var writeDataTypes = NSSet.setWithArray(writeTypes); var readDataTypes = NSSet.setWithArray(readTypes); healthStore.requestAuthorizationToShareTypesReadTypesCompletion(writeDataTypes, readDataTypes, function (success, error) { if (!success) { } }); } function getHealthKitValue(healthStore, quantityType, callback) { var endDateSortDescriptor = NSSortDescriptor.alloc().initWithKeyAscending(HKSampleSortIdentifierEndDate, false); var query = HKSampleQuery.alloc().initWithSampleTypePredicateLimitSortDescriptorsResultsHandler(quantityType, null, 1, [endDateSortDescriptor], function (query, results, error) { if (results) { var quantitySample = results.firstObject; if (quantitySample) { callback(quantitySample.quantity); } else { alert("Error!"); } } else { alert("Error!"); } }); healthStore.executeQuery(query); } function setHalthKitValue(healthStore, quantityType, quantity) { var now = NSDate.new(); var sample = HKQuantitySample.quantitySampleWithTypeQuantityStartDateEndDate(quantityType, quantity, now, now); healthStore.saveObjectWithCompletion(sample, function (success, error) { if (success) { alert("Done!"); } else { alert("Error!"); } }); }
danik121/HAN-MAD-DT-NATIVESCRIPT
app/views/healthkit/healthkit.js
JavaScript
mit
2,528
<?php /* * This file is part of the reditype package. * * (c) 2009-2010 digital Wranglers <info@wranglers.com.au> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ require_once(dirname(__FILE__).'/../lib/BasertShopVoucherAdminComponents.class.php'); /** * rtShopVoucherComponents * * @package rtShopPlugin * @subpackage modules * @author Piers Warmers <piers@wranglers.com.au> * @author Konny Zurcher <konny@wranglers.com.au> */ class rtShopVoucherAdminComponents extends BasertShopVoucherAdminComponents { }
pierswarmers/rtShopPlugin
modules/rtShopVoucherAdmin/actions/components.class.php
PHP
mit
619
FROM python:3.8-alpine # update apk repo RUN echo "http://dl-4.alpinelinux.org/alpine/v3.14/main" >> /etc/apk/repositories && \ echo "http://dl-4.alpinelinux.org/alpine/v3.14/community" >> /etc/apk/repositories # install chromedriver RUN apk update RUN apk add chromium chromium-chromedriver
joyzoursky/docker-python-chromedriver
py-alpine/3.8-alpine/Dockerfile
Dockerfile
mit
298
<?php // ini_set('display_startup_errors', 'On'); // ini_set('error_reporting' , 'E_ALL | E_STRICT'); // ini_set('track_errors' , 'On'); // ini_set('display_errors' , 1); // error_reporting(E_ALL); require_once('cronjob_log.php'); require_once('backup.php'); class cronjob { public function run() { $dir = __DIR__. '/masterurl.me.txt'; if(is_file($dir)) { $this->_curl(file_get_contents($dir)); } $dir = __DIR__. '/masterurl2.me.txt'; if(is_file($dir)) { $this->_curl(file_get_contents($dir)); } // $dir = str_replace('dash/lib/engine/cronjob', '', $dir); // $dir .= 'cronjob.php'; // // cronjob_log::save($dir); // if(is_file($dir)) // { // cronjob_log::save(date("Y-m-d H:i:s"). ' --- Try to php '. $dir. ' ...'); // exec("php $dir"); // } } public function _curl($_masterurl) { $token = time(). '_Ermile_cronjob_'. (string) rand() . (string) rand(); $token = md5($token); $token_json['token'] = $token; $token_json['date'] = date("Y-m-d H:i:s"); file_put_contents(__DIR__. '/token.me.json', json_encode($token_json, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT)); if(!function_exists('curl_init')) { echo "curl_init is not exist!"; return false; } $handle = curl_init(); curl_setopt($handle, CURLOPT_URL, $_masterurl); // curl_setopt($handle, CURLOPT_HTTPHEADER, json_encode($_requests['header'], JSON_UNESCAPED_UNICODE)); curl_setopt($handle, CURLOPT_RETURNTRANSFER, true); curl_setopt($handle, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($handle, CURLOPT_POST, true); curl_setopt($handle, CURLOPT_POSTFIELDS, http_build_query($token_json)); curl_setopt($handle, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($handle, CURLOPT_TIMEOUT, 10); if(defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')) { curl_setopt($handle, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); } $response = curl_exec($handle); $mycode = curl_getinfo($handle, CURLINFO_HTTP_CODE); $curl_error = curl_error($handle); curl_close ($handle); echo $_masterurl; echo '|'; echo $mycode; // var_dump($curl_error, $response, $mycode, $_masterurl); } } (new cronjob)->run(); (new backup)->run(); ?>
Ermile/dash
lib/engine/cronjob/cronjob.php
PHP
mit
2,288
#ifndef CLIENTMODEL_H #define CLIENTMODEL_H #include <QObject> class OptionsModel; class AddressTableModel; class TransactionTableModel; class CWallet; QT_BEGIN_NAMESPACE class QDateTime; class QTimer; QT_END_NAMESPACE /** Model for Bitcoin network client. */ class ClientModel : public QObject { Q_OBJECT public: explicit ClientModel(OptionsModel *optionsModel, QObject *parent = 0); ~ClientModel(); enum MiningType { SoloMining, PoolMining }; OptionsModel *getOptionsModel(); int getNumConnections() const; int getNumBlocks() const; int getNumBlocksAtStartup(); MiningType getMiningType() const; int getMiningThreads() const; bool getMiningStarted() const; bool getMiningDebug() const; void setMiningDebug(bool debug); int getMiningScanTime() const; void setMiningScanTime(int scantime); QString getMiningServer() const; void setMiningServer(QString server); QString getMiningPort() const; void setMiningPort(QString port); QString getMiningUsername() const; void setMiningUsername(QString username); QString getMiningPassword() const; void setMiningPassword(QString password); int getHashrate() const; double GetDifficulty() const; QDateTime getLastBlockDate() const; //! Return true if client connected to testnet bool isTestNet() const; //! Return true if core is doing initial block download bool inInitialBlockDownload() const; //! Return conservative estimate of total number of blocks, or 0 if unknown int getNumBlocksOfPeers() const; //! Return warnings to be displayed in status EXC QString getStatusEXCWarnings() const; void setMining(MiningType type, bool mining, int threads, int hashrate); QString formatFullVersion() const; QString formatBuildDate() const; QString clientName() const; QString formatClientStartupTime() const; private: OptionsModel *optionsModel; int cachedNumBlocks; int cachedNumBlocksOfPeers; int cachedHashrate; MiningType miningType; int miningThreads; bool miningStarted; bool miningDebug; int miningScanTime; QString miningServer; QString miningPort; QString miningUsername; QString miningPassword; int numBlocksAtStartup; QTimer *pollTimer; void subscribeToCoreSignals(); void unsubscribeFromCoreSignals(); signals: void numConnectionsChanged(int count); void numBlocksChanged(int count, int countOfPeers); void miningChanged(bool mining, int count); //! Asynchronous error notification void error(const QString &title, const QString &message, bool modal); public slots: void updateTimer(); void updateNumConnections(int numConnections); void updateAlert(const QString &hash, int status); }; #endif // CLIENTMODEL_H
ExoCoin/exocoin
src/qt/clientmodel.h
C
mit
2,858
/** * NoStorageModifier.hpp - * @author: Jonathan Beard * @version: Thu Apr 3 08:51:05 2014 */ #ifndef _NOSTORAGEMODIFIER_HPP_ #define _NOSTORAGEMODIFIER_HPP_ 1 #include "StorageModifier.hpp" namespace Node{ class NoStorageModifier : public StorageModifier { public: NoStorageModifier(); virtual ~NoStorageModifier() = default; }; } #endif /* END _NOSTORAGEMODIFIER_HPP_ */
jonathan-beard/Raft
ASTNodes/NoStorageModifier.hpp
C++
mit
388
using System; using System.Collections.Generic; using System.Text; using _03BarracksFactory.Contracts; using _03BarracksFactory.CustomAttributes; namespace _03BarracksFactory.Core.Commands { public class AddCommand : Command { [Inject] private IRepository repository; [Inject] private IUnitFactory unitFactory; public IUnitFactory UnitFactory { get { return unitFactory; } set { unitFactory = value; } } public IRepository Repository { get { return repository; } set { repository = value; } } public AddCommand(string[] data) : base(data) { } public override string Execute() { string unitType = this.Data[1]; IUnit unitToAdd = this.UnitFactory.CreateUnit(unitType); this.Repository.AddUnit(unitToAdd); string output = unitType + " added!"; return output; } } }
YaniLozanov/Software-University
C#/03. C# OOP/03. C# OOP Advanced/04. Reflection and Attributes Exercises/05. BarracksWars - Return of the Dependencies/Core/Commands/AddCommand.cs
C#
mit
1,032
<?php /** * Locale data for 'rwk_TZ'. * * This file is automatically generated by yiic cldr command. * * Copyright © 1991-2007 Unicode, Inc. All rights reserved. * Distributed under the Terms of Use in http://www.unicode.org/copyright.html. * * @copyright 2008-2013 Yii Software LLC (http://www.yiiframework.com/license/) */ return array( 'version' => '5798', 'numberSymbols' => array( 'alias' => '', 'decimal' => '.', 'group' => ',', 'list' => ';', 'percentSign' => '%', 'plusSign' => '+', 'minusSign' => '-', 'exponential' => 'E', 'perMille' => '‰', 'infinity' => '∞', 'nan' => 'NaN', ), 'decimalFormat' => '#,##0.###', 'scientificFormat' => '#E0', 'percentFormat' => '#,##0%', 'currencyFormat' => '#,##0.00¤', 'currencySymbols' => array( 'AUD' => 'AU$', 'BRL' => 'R$', 'CAD' => 'CA$', 'CNY' => 'CN¥', 'EUR' => '€', 'GBP' => '£', 'HKD' => 'HK$', 'ILS' => '₪', 'INR' => '₹', 'JPY' => 'JP¥', 'KRW' => '₩', 'MXN' => 'MX$', 'NZD' => 'NZ$', 'THB' => '฿', 'TWD' => 'NT$', 'USD' => 'US$', 'VND' => '₫', 'XAF' => 'FCFA', 'XCD' => 'EC$', 'XOF' => 'CFA', 'XPF' => 'CFPF', 'TZS' => 'TSh', ), 'monthNames' => array( 'wide' => array( 1 => 'Januari', 2 => 'Februari', 3 => 'Machi', 4 => 'Aprilyi', 5 => 'Mei', 6 => 'Junyi', 7 => 'Julyai', 8 => 'Agusti', 9 => 'Septemba', 10 => 'Oktoba', 11 => 'Novemba', 12 => 'Desemba', ), 'abbreviated' => array( 1 => 'Jan', 2 => 'Feb', 3 => 'Mac', 4 => 'Apr', 5 => 'Mei', 6 => 'Jun', 7 => 'Jul', 8 => 'Ago', 9 => 'Sep', 10 => 'Okt', 11 => 'Nov', 12 => 'Des', ), ), 'monthNamesSA' => array( 'narrow' => array( 1 => 'J', 2 => 'F', 3 => 'M', 4 => 'A', 5 => 'M', 6 => 'J', 7 => 'J', 8 => 'A', 9 => 'S', 10 => 'O', 11 => 'N', 12 => 'D', ), ), 'weekDayNames' => array( 'wide' => array( 0 => 'Jumapilyi', 1 => 'Jumatatuu', 2 => 'Jumanne', 3 => 'Jumatanu', 4 => 'Alhamisi', 5 => 'Ijumaa', 6 => 'Jumamosi', ), 'abbreviated' => array( 0 => 'Jpi', 1 => 'Jtt', 2 => 'Jnn', 3 => 'Jtn', 4 => 'Alh', 5 => 'Iju', 6 => 'Jmo', ), ), 'weekDayNamesSA' => array( 'narrow' => array( 0 => 'J', 1 => 'J', 2 => 'J', 3 => 'J', 4 => 'A', 5 => 'I', 6 => 'J', ), ), 'eraNames' => array( 'abbreviated' => array( 0 => 'KK', 1 => 'BK', ), 'wide' => array( 0 => 'Kabla ya Kristu', 1 => 'Baada ya Kristu', ), 'narrow' => array( 0 => 'KK', 1 => 'BK', ), ), 'dateFormats' => array( 'full' => 'EEEE, d MMMM y', 'long' => 'd MMMM y', 'medium' => 'd MMM y', 'short' => 'dd/MM/yyyy', ), 'timeFormats' => array( 'full' => 'h:mm:ss a zzzz', 'long' => 'h:mm:ss a z', 'medium' => 'h:mm:ss a', 'short' => 'h:mm a', ), 'dateTimeFormat' => '{1} {0}', 'amName' => 'utuko', 'pmName' => 'kyiukonyi', 'orientation' => 'ltr', 'languages' => array( 'ak' => 'Kiakanyi', 'am' => 'Kiamharyi', 'ar' => 'Kyiarabu', 'be' => 'Kyibelarusi', 'bg' => 'Kyibulgaryia', 'bn' => 'Kyibangla', 'cs' => 'Kyichecki', 'de' => 'Kyijerumani', 'el' => 'Kyigiriki', 'en' => 'Kyingereza', 'es' => 'Kyihispania', 'fa' => 'Kyiajemi', 'fr' => 'Kyifaransa', 'ha' => 'Kyihausa', 'hi' => 'Kyihindi', 'hu' => 'Kyihungari', 'id' => 'Kyiindonesia', 'ig' => 'Kyiigbo', 'it' => 'Kyiitaliano', 'ja' => 'Kyijapani', 'jv' => 'Kyijava', 'km' => 'Kyikambodia', 'ko' => 'Kyikorea', 'ms' => 'Kyimalesia', 'my' => 'Kyiburma', 'ne' => 'Kyinepali', 'nl' => 'Kyiholanzi', 'pa' => 'Kyipunjabi', 'pl' => 'Kyipolandi', 'pt' => 'Kyireno', 'ro' => 'Kyiromania', 'ru' => 'Kyirusi', 'rw' => 'Kyinyarwanda', 'rwk' => 'Kiruwa', 'so' => 'Kyisomalyi', 'sv' => 'Kyiswidi', 'ta' => 'Kyitamil', 'th' => 'Kyitailandi', 'tr' => 'Kyiturukyi', 'uk' => 'Kyiukrania', 'ur' => 'Kyiurdu', 'vi' => 'Kyivietinamu', 'yo' => 'Kyiyoruba', 'zh' => 'Kyichina', 'zu' => 'Kyizulu', ), 'territories' => array( 'ad' => 'Andora', 'ae' => 'Falme za Kiarabu', 'af' => 'Afuganistani', 'ag' => 'Antigua na Barbuda', 'ai' => 'Anguilla', 'al' => 'Albania', 'am' => 'Armenia', 'an' => 'Antili za Uholanzi', 'ao' => 'Angola', 'ar' => 'Ajentina', 'as' => 'Samoa ya Marekani', 'at' => 'Austria', 'au' => 'Australia', 'aw' => 'Aruba', 'az' => 'Azabajani', 'ba' => 'Bosnia na Hezegovina', 'bb' => 'Babadosi', 'bd' => 'Bangladeshi', 'be' => 'Ubelgiji', 'bf' => 'Bukinafaso', 'bg' => 'Bulgaria', 'bh' => 'Bahareni', 'bi' => 'Burundi', 'bj' => 'Benini', 'bm' => 'Bermuda', 'bn' => 'Brunei', 'bo' => 'Bolivia', 'br' => 'Brazili', 'bs' => 'Bahama', 'bt' => 'Butani', 'bw' => 'Botswana', 'by' => 'Belarusi', 'bz' => 'Belize', 'ca' => 'Kanada', 'cd' => 'Jamhuri ya Kidemokrasia ya Kongo', 'cf' => 'Jamhuri ya Afrika ya Kati', 'cg' => 'Kongo', 'ch' => 'Uswisi', 'ci' => 'Kodivaa', 'ck' => 'Visiwa vya Cook', 'cl' => 'Chile', 'cm' => 'Kameruni', 'cn' => 'China', 'co' => 'Kolombia', 'cr' => 'Kostarika', 'cs' => 'Serbia na Montenegro', 'cu' => 'Kuba', 'cv' => 'Kepuvede', 'cy' => 'Kuprosi', 'cz' => 'Jamhuri ya Cheki', 'de' => 'Ujerumani', 'dj' => 'Jibuti', 'dk' => 'Denmaki', 'dm' => 'Dominika', 'do' => 'Jamhuri ya Dominika', 'dz' => 'Aljeria', 'ec' => 'Ekwado', 'ee' => 'Estonia', 'eg' => 'Misri', 'er' => 'Eritrea', 'es' => 'Hispania', 'et' => 'Uhabeshi', 'fi' => 'Ufini', 'fj' => 'Fiji', 'fk' => 'Visiwa vya Falkland', 'fm' => 'Mikronesia', 'fr' => 'Ufaransa', 'ga' => 'Gaboni', 'gb' => 'Uingereza', 'gd' => 'Grenada', 'ge' => 'Jojia', 'gf' => 'Gwiyana ya Ufaransa', 'gh' => 'Ghana', 'gi' => 'Jibralta', 'gl' => 'Grinlandi', 'gm' => 'Gambia', 'gn' => 'Gine', 'gp' => 'Gwadelupe', 'gq' => 'Ginekweta', 'gr' => 'Ugiriki', 'gt' => 'Gwatemala', 'gu' => 'Gwam', 'gw' => 'Ginebisau', 'gy' => 'Guyana', 'hn' => 'Hondurasi', 'hr' => 'Korasia', 'ht' => 'Haiti', 'hu' => 'Hungaria', 'id' => 'Indonesia', 'ie' => 'Ayalandi', 'il' => 'Israeli', 'in' => 'India', 'io' => 'Eneo la Uingereza katika Bahari Hindi', 'iq' => 'Iraki', 'ir' => 'Uajemi', 'is' => 'Aislandi', 'it' => 'Italia', 'jm' => 'Jamaika', 'jo' => 'Yordani', 'jp' => 'Japani', 'ke' => 'Kenya', 'kg' => 'Kirigizistani', 'kh' => 'Kambodia', 'ki' => 'Kiribati', 'km' => 'Komoro', 'kn' => 'Santakitzi na Nevis', 'kp' => 'Korea Kaskazini', 'kr' => 'Korea Kusini', 'kw' => 'Kuwaiti', 'ky' => 'Visiwa vya Kayman', 'kz' => 'Kazakistani', 'la' => 'Laosi', 'lb' => 'Lebanoni', 'lc' => 'Santalusia', 'li' => 'Lishenteni', 'lk' => 'Sirilanka', 'lr' => 'Liberia', 'ls' => 'Lesoto', 'lt' => 'Litwania', 'lu' => 'Lasembagi', 'lv' => 'Lativia', 'ly' => 'Libya', 'ma' => 'Moroko', 'mc' => 'Monako', 'md' => 'Moldova', 'mg' => 'Bukini', 'mh' => 'Visiwa vya Marshal', 'mk' => 'Masedonia', 'ml' => 'Mali', 'mm' => 'Myama', 'mn' => 'Mongolia', 'mp' => 'Visiwa vya Mariana vya Kaskazini', 'mq' => 'Martiniki', 'mr' => 'Moritania', 'ms' => 'Montserrati', 'mt' => 'Malta', 'mu' => 'Morisi', 'mv' => 'Modivu', 'mw' => 'Malawi', 'mx' => 'Meksiko', 'my' => 'Malesia', 'mz' => 'Msumbiji', 'na' => 'Namibia', 'nc' => 'Nyukaledonia', 'ne' => 'Nijeri', 'nf' => 'Kisiwa cha Norfok', 'ng' => 'Nijeria', 'ni' => 'Nikaragwa', 'nl' => 'Uholanzi', 'no' => 'Norwe', 'np' => 'Nepali', 'nr' => 'Nauru', 'nu' => 'Niue', 'nz' => 'Nyuzilandi', 'om' => 'Omani', 'pa' => 'Panama', 'pe' => 'Peru', 'pf' => 'Polinesia ya Ufaransa', 'pg' => 'Papua', 'ph' => 'Filipino', 'pk' => 'Pakistani', 'pl' => 'Polandi', 'pm' => 'Santapieri na Mikeloni', 'pn' => 'Pitkairni', 'pr' => 'Pwetoriko', 'ps' => 'Ukingo wa Magharibi na Ukanda wa Gaza wa Palestina', 'pt' => 'Ureno', 'pw' => 'Palau', 'py' => 'Paragwai', 'qa' => 'Katari', 're' => 'Riyunioni', 'ro' => 'Romania', 'ru' => 'Urusi', 'rw' => 'Rwanda', 'sa' => 'Saudi', 'sb' => 'Visiwa vya Solomon', 'sc' => 'Shelisheli', 'sd' => 'Sudani', 'se' => 'Uswidi', 'sg' => 'Singapoo', 'sh' => 'Santahelena', 'si' => 'Slovenia', 'sk' => 'Slovakia', 'sl' => 'Siera Leoni', 'sm' => 'Samarino', 'sn' => 'Senegali', 'so' => 'Somalia', 'sr' => 'Surinamu', 'st' => 'Sao Tome na Principe', 'sv' => 'Elsavado', 'sy' => 'Siria', 'sz' => 'Uswazi', 'tc' => 'Visiwa vya Turki na Kaiko', 'td' => 'Chadi', 'tg' => 'Togo', 'th' => 'Tailandi', 'tj' => 'Tajikistani', 'tk' => 'Tokelau', 'tl' => 'Timori ya Mashariki', 'tm' => 'Turukimenistani', 'tn' => 'Tunisia', 'to' => 'Tonga', 'tr' => 'Uturuki', 'tt' => 'Trinidad na Tobago', 'tv' => 'Tuvalu', 'tw' => 'Taiwani', 'tz' => 'Tanzania', 'ua' => 'Ukraini', 'ug' => 'Uganda', 'us' => 'Marekani', 'uy' => 'Urugwai', 'uz' => 'Uzibekistani', 'va' => 'Vatikani', 'vc' => 'Santavisenti na Grenadini', 've' => 'Venezuela', 'vg' => 'Visiwa vya Virgin vya Uingereza', 'vi' => 'Visiwa vya Virgin vya Marekani', 'vn' => 'Vietinamu', 'vu' => 'Vanuatu', 'wf' => 'Walis na Futuna', 'ws' => 'Samoa', 'ye' => 'Yemeni', 'yt' => 'Mayotte', 'za' => 'Afrika Kusini', 'zm' => 'Zambia', 'zw' => 'Zimbabwe', ), 'pluralRules' => array( 0 => 'n==1', 1 => 'true', ), );
neowutran/Nuitinfo
nuitinfo/protected/common/lib/vendor/yiisoft/yii/framework/i18n/data/rwk_tz.php
PHP
mit
14,466
from fooster.web import web import pytest test_key = 'Magical' test_value = 'header' test_header = test_key + ': ' + test_value + '\r\n' poor_key = 'not' poor_value = 'good' poor_header = poor_key + ':' + poor_value + '\r\n' good_header = poor_key + ': ' + poor_value + '\r\n' case_key = 'wEIrd' case_key_title = case_key.title() case_value = 'cAse' case_header = case_key + ': ' + case_value + '\r\n' case_header_test = case_key + ': ' + test_value + '\r\n' nonstr_key = 6 nonstr_value = None def test_add_get(): headers = web.HTTPHeaders() headers.add(test_header) assert headers.get(test_key) == test_value def test_add_getlist(): headers = web.HTTPHeaders() headers.add(test_header) assert headers.getlist(test_key) == [test_value] def test_add_getitem(): headers = web.HTTPHeaders() headers.add(test_header) assert headers[test_key] == test_value def test_getitem_empty(): headers = web.HTTPHeaders() with pytest.raises(KeyError): headers[test_key] def test_getlist_empty(): headers = web.HTTPHeaders() with pytest.raises(KeyError): headers.getlist(test_key) def test_getlist_default(): headers = web.HTTPHeaders() assert headers.getlist(test_key, []) == [] def test_set_remove(): headers = web.HTTPHeaders() headers.set(test_key, test_value) assert headers.get(test_key) == test_value headers.remove(test_key) def test_set_multiple(): headers = web.HTTPHeaders() headers.set(test_key, test_value) headers.set(test_key, test_value) assert headers.get(test_key) == test_value assert headers.getlist(test_key) == [test_value] * 2 def test_set_overwrite(): headers = web.HTTPHeaders() headers.set(test_key, test_value, True) headers.set(test_key, test_value, True) assert headers.get(test_key) == test_value assert headers.getlist(test_key) == [test_value] def test_setitem_delitem(): headers = web.HTTPHeaders() headers[test_key] = test_value assert headers[test_key] == test_value del headers[test_key] def test_remove_empty(): headers = web.HTTPHeaders() with pytest.raises(KeyError): headers.remove(test_key) def test_delitem_empty(): headers = web.HTTPHeaders() with pytest.raises(KeyError): del headers[test_key] def test_retrieve(): headers = web.HTTPHeaders() headers.set(test_key, test_value) assert headers.retrieve(test_key) == test_header def test_len(): headers = web.HTTPHeaders() headers.set(test_key, test_value) assert len(headers) == 1 headers.set(poor_key, poor_value) assert len(headers) == 2 def test_multiple_add_get_len_retrieve(): headers = web.HTTPHeaders() headers.add(case_header) assert len(headers) == 1 assert headers.get(case_key) == case_value assert headers.getlist(case_key) == [case_value] assert headers.retrieve(case_key) == case_header headers.add(case_header) assert len(headers) == 1 assert headers.get(case_key) == case_value assert headers.getlist(case_key) == [case_value] * 2 assert headers.retrieve(case_key) == case_header + case_header headers.add(case_header_test) assert len(headers) == 1 assert headers.get(case_key) == test_value assert headers.getlist(case_key) == [case_value] * 2 + [test_value] assert headers.retrieve(case_key) == case_header + case_header + case_header_test def test_multiple_set_get_len_retrieve(): headers = web.HTTPHeaders() headers.set(case_key, case_value) assert len(headers) == 1 assert headers.get(case_key) == case_value assert headers.getlist(case_key) == [case_value] assert headers.retrieve(case_key) == case_header headers.set(case_key, case_value) assert len(headers) == 1 assert headers.get(case_key) == case_value assert headers.getlist(case_key) == [case_value] * 2 assert headers.retrieve(case_key) == case_header + case_header headers.set(case_key, test_value) assert len(headers) == 1 assert headers.get(case_key) == test_value assert headers.getlist(case_key) == [case_value] * 2 + [test_value] assert headers.retrieve(case_key) == case_header + case_header + case_header_test def test_clear(): headers = web.HTTPHeaders() headers.set(test_key, test_value) headers.set(poor_key, poor_value) headers.clear() assert len(headers) == 0 def test_case(): headers = web.HTTPHeaders() headers.set(case_key, case_value) assert headers.get(case_key_title) == case_value assert headers.retrieve(case_key_title) == case_header def test_iter(): headers = web.HTTPHeaders() headers.set(test_key, test_value) headers.set(poor_key, poor_value) headers.set(case_key, case_value) header_list = [] for header in headers: header_list.append(header) assert test_header in header_list assert good_header in header_list assert case_header in header_list def test_contains(): headers = web.HTTPHeaders() headers.set(test_key, test_value) headers.set(poor_key, poor_value) headers.set(case_key, case_value) assert test_key in headers assert poor_key in headers assert case_key in headers assert test_key.upper() in headers assert poor_key.upper() in headers assert case_key.upper() in headers assert test_key.lower() in headers assert poor_key.lower() in headers assert case_key.lower() in headers def test_poor_header(): headers = web.HTTPHeaders() headers.add(poor_header) assert headers.get(poor_key) == poor_value def test_set_key_nonstr(): headers = web.HTTPHeaders() with pytest.raises(TypeError): headers.set(nonstr_key, test_value) def test_set_value_nonstr(): headers = web.HTTPHeaders() with pytest.raises(TypeError): headers.set(test_key, nonstr_value)
fkmclane/web.py
tests/test_header.py
Python
mit
5,961
from {{appname}}.handlers.powhandler import PowHandler from {{appname}}.conf.config import myapp from {{appname}}.lib.application import app import simplejson as json import tornado.web from tornado import gen from {{appname}}.pow_dash import dispatcher # Please import your model here. (from yourapp.models.dbtype) @app.add_route("/dash.*", dispatch={"get" :"dash"}) @app.add_route("/_dash.*", dispatch={"get" :"dash_ajax_json", "post": "dash_ajax_json"}) class Dash(PowHandler): # # Sample dash handler to embedd dash into PythonOnWheels # def dash(self, **kwargs): """ This is the place where dash is called. dispatcher returns the HMTL including title, css, scripts and config via => dash.Dash.index() (See: in pow_dash.py => myDash.index) You can then insert the returned HTML into your template. I do this below in the self.render/self.success call => see base_dash.bs4 template (mustache like syntax) """ print("processing dash method") #external_stylesheets = see config.py dash section retval = dispatcher(self.request, username="fake", session_id=1234, index=True ) # # this is the render template call which embeds the dash code (dash_block=retval) # from dispatcher (see above) self.set_header('Content-Type', "text/html") self.render("dash_index.tmpl", dash_block=retval) # self.success(template="index.tmpl", dash_block=retval, data=res ) def dash_ajax_json(self): """ respond to the dash ajax json / react request's """ print(" processing dash_ajax method") # # now hand over to the dispatcher # retval = dispatcher(self.request, index=False, username="fake", session_id=1234, powapp=self.application) #self.set_header('Content-Type', 'application/json') self.write(retval) # def dash_ajax_assets(self): # """ # respond to the dash ajax assets/ react request's # """ # print(" processing dash_ajax_assets method") # # # # now hand over to the dispatcher # # # """Handle Dash requests and guess the mimetype. Needed for static files.""" # url = request.path.split('?')[0] # content_type, _encoding = mimetypes.guess_type(url) # retval = dispatcher(self.request, index=False, username="fake", session_id=1234, powapp=self.application) # self.set_header('Content-Type', content_type) # self.write(retval)
pythononwheels/pow_devel
pythononwheels/start/stubs/dash_handler_template.py
Python
mit
2,667
-- phpMyAdmin SQL Dump -- version 4.3.11 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: Feb 29, 2016 at 11:57 AM -- Server version: 5.6.24 -- PHP Version: 5.6.8 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Database: `smamardi_sia` -- -- -------------------------------------------------------- -- -- Table structure for table `tbl_admin` -- CREATE TABLE IF NOT EXISTS `tbl_admin` ( `idAdmin` int(11) NOT NULL, `username` varchar(64) NOT NULL, `password` varchar(128) NOT NULL, `email` varchar(64) NOT NULL, `fullname` varchar(64) NOT NULL, `lastLogin` datetime DEFAULT NULL, `lastIp` varchar(16) DEFAULT NULL ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; -- -- Dumping data for table `tbl_admin` -- INSERT INTO `tbl_admin` (`idAdmin`, `username`, `password`, `email`, `fullname`, `lastLogin`, `lastIp`) VALUES (1, 'administrator', '$2a$10$J.heQw8H7uFc0yPpBTs9C.TMh17IlQaewJWq3cCFcIEKOzYcFPsZ6', 'admin@sipuas.com', 'Administrator', '2016-02-29 11:39:13', '::1'); -- -------------------------------------------------------- -- -- Table structure for table `tbl_kuisioner` -- CREATE TABLE IF NOT EXISTS `tbl_kuisioner` ( `nomer` varchar(8) NOT NULL, `umur` int(11) NOT NULL, `jenkel` enum('Laki-Laki','Perempuan') NOT NULL, `pendidikan` enum('SD Kebawah','SMP','SMA','Diploma','S1','S2 Keatas') NOT NULL, `pekerjaan` enum('PNS/TNI/Polri','Pegawai Swasta','Wiraswasta','Pelajar/Mahasiswa','Lainnya') NOT NULL, `prosedur` smallint(6) NOT NULL, `persyaratan` smallint(6) NOT NULL, `kejelasan` smallint(6) NOT NULL, `kedisiplinan` smallint(6) NOT NULL, `tanggungjawab` smallint(6) NOT NULL, `kemampuan` smallint(6) NOT NULL, `kecepatan` smallint(6) NOT NULL, `keadilan` smallint(6) NOT NULL, `kesopanan` smallint(6) NOT NULL, `kewajaranBiaya` smallint(6) NOT NULL, `kepastianBiaya` smallint(6) NOT NULL, `kepastianJadwal` smallint(6) NOT NULL, `kenyamanan` smallint(6) NOT NULL, `keamanan` smallint(6) NOT NULL, `waktu_pengisian` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `tbl_kuisioner` -- INSERT INTO `tbl_kuisioner` (`nomer`, `umur`, `jenkel`, `pendidikan`, `pekerjaan`, `prosedur`, `persyaratan`, `kejelasan`, `kedisiplinan`, `tanggungjawab`, `kemampuan`, `kecepatan`, `keadilan`, `kesopanan`, `kewajaranBiaya`, `kepastianBiaya`, `kepastianJadwal`, `kenyamanan`, `keamanan`, `waktu_pengisian`) VALUES ('RSP-0001', 21, 'Laki-Laki', 'S1', 'Wiraswasta', 1, 2, 2, 4, 2, 1, 2, 3, 1, 3, 1, 4, 3, 3, '2016-02-29 10:27:53'), ('RSP-0002', 21, 'Laki-Laki', 'Diploma', 'Pegawai Swasta', 1, 2, 1, 2, 1, 2, 1, 1, 3, 3, 3, 3, 3, 4, '2016-02-29 10:36:27'), ('RSP-0003', 21, 'Laki-Laki', 'Diploma', 'Pelajar/Mahasiswa', 1, 2, 3, 2, 2, 2, 2, 3, 3, 1, 3, 3, 3, 1, '2016-02-29 11:48:04'), ('RSP-0004', 21, 'Laki-Laki', 'S2 Keatas', 'Pegawai Swasta', 1, 2, 2, 1, 4, 2, 3, 3, 3, 3, 1, 3, 3, 2, '2016-02-29 11:53:18'); -- -- Indexes for dumped tables -- -- -- Indexes for table `tbl_admin` -- ALTER TABLE `tbl_admin` ADD PRIMARY KEY (`idAdmin`); -- -- Indexes for table `tbl_kuisioner` -- ALTER TABLE `tbl_kuisioner` ADD PRIMARY KEY (`nomer`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `tbl_admin` -- ALTER TABLE `tbl_admin` MODIFY `idAdmin` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
sisinduku/SiPuas
db_sipuas.sql
SQL
mit
3,807
/* * Copyright 2004-2014 H2 Group. Multiple-Licensed under the MPL 2.0, * and the EPL 1.0 (http://h2database.com/html/license.html). * Initial Developer: H2 Group */ package org.h2.store; import java.io.IOException; import java.io.InputStream; import java.io.Reader; import java.util.ArrayList; import java.util.Arrays; import java.util.Map.Entry; import org.h2.api.ErrorCode; import org.h2.engine.Constants; import org.h2.engine.Database; import org.h2.message.DbException; import org.h2.mvstore.MVMap; import org.h2.mvstore.MVStore; import org.h2.mvstore.StreamStore; import org.h2.mvstore.db.MVTableEngine.Store; import org.h2.util.IOUtils; import org.h2.util.New; import org.h2.util.StringUtils; import org.h2.value.Value; import org.h2.value.ValueLobDb; /** * This class stores LOB objects in the database, in maps. This is the back-end * i.e. the server side of the LOB storage. */ public class LobStorageMap implements LobStorageInterface { private static final boolean TRACE = false; private final Database database; private boolean init; private Object nextLobIdSync = new Object(); private long nextLobId; /** * The lob metadata map. It contains the mapping from the lob id * (which is a long) to the stream store id (which is a byte array). * * Key: lobId (long) * Value: { streamStoreId (byte[]), tableId (int), * byteCount (long), hash (long) }. */ private MVMap<Long, Object[]> lobMap; /** * The reference map. It is used to remove data from the stream store: if no * more entries for the given streamStoreId exist, the data is removed from * the stream store. * * Key: { streamStoreId (byte[]), lobId (long) }. * Value: true (boolean). */ private MVMap<Object[], Boolean> refMap; /** * The stream store data map. * * Key: stream store block id (long). * Value: data (byte[]). */ private MVMap<Long, byte[]> dataMap; private StreamStore streamStore; public LobStorageMap(Database database) { this.database = database; } @Override public void init() { if (init) { return; } init = true; Store s = database.getMvStore(); MVStore mvStore; if (s == null) { // in-memory database mvStore = MVStore.open(null); } else { mvStore = s.getStore(); } lobMap = mvStore.openMap("lobMap"); refMap = mvStore.openMap("lobRef"); dataMap = mvStore.openMap("lobData"); streamStore = new StreamStore(dataMap); // garbage collection of the last blocks if (database.isReadOnly()) { return; } if (dataMap.isEmpty()) { return; } // search for the last block // (in theory, only the latest lob can have unreferenced blocks, // but the latest lob could be a copy of another one, and // we don't know that, so we iterate over all lobs) long lastUsedKey = -1; for (Entry<Long, Object[]> e : lobMap.entrySet()) { long lobId = e.getKey(); Object[] v = e.getValue(); byte[] id = (byte[]) v[0]; long max = streamStore.getMaxBlockKey(id); // a lob may not have a referenced blocks if data is kept inline if (max != -1 && max > lastUsedKey) { lastUsedKey = max; if (TRACE) { trace("lob " + lobId + " lastUsedKey=" + lastUsedKey); } } } if (TRACE) { trace("lastUsedKey=" + lastUsedKey); } // delete all blocks that are newer while (true) { Long last = dataMap.lastKey(); if (last == null || last <= lastUsedKey) { break; } if (TRACE) { trace("gc " + last); } dataMap.remove(last); } // don't re-use block ids, except at the very end Long last = dataMap.lastKey(); if (last != null) { streamStore.setNextKey(last + 1); } } @Override public Value createBlob(InputStream in, long maxLength) { init(); int type = Value.BLOB; try { if (maxLength != -1 && maxLength <= database.getMaxLengthInplaceLob()) { byte[] small = new byte[(int) maxLength]; int len = IOUtils.readFully(in, small, (int) maxLength); if (len > maxLength) { throw new IllegalStateException( "len > blobLength, " + len + " > " + maxLength); } if (len < small.length) { small = Arrays.copyOf(small, len); } return ValueLobDb.createSmallLob(type, small); } if (maxLength != -1) { in = new LimitInputStream(in, maxLength); } return createLob(in, type); } catch (IllegalStateException e) { throw DbException.get(ErrorCode.OBJECT_CLOSED, e); } catch (IOException e) { throw DbException.convertIOException(e, null); } } @Override public Value createClob(Reader reader, long maxLength) { init(); int type = Value.CLOB; try { // we multiple by 3 here to get the worst-case size in bytes if (maxLength != -1 && maxLength * 3 <= database.getMaxLengthInplaceLob()) { char[] small = new char[(int) maxLength]; int len = IOUtils.readFully(reader, small, (int) maxLength); if (len > maxLength) { throw new IllegalStateException( "len > blobLength, " + len + " > " + maxLength); } byte[] utf8 = new String(small, 0, len) .getBytes(Constants.UTF8); if (utf8.length > database.getMaxLengthInplaceLob()) { throw new IllegalStateException( "len > maxinplace, " + utf8.length + " > " + database.getMaxLengthInplaceLob()); } return ValueLobDb.createSmallLob(type, utf8); } if (maxLength < 0) { maxLength = Long.MAX_VALUE; } CountingReaderInputStream in = new CountingReaderInputStream(reader, maxLength); ValueLobDb lob = createLob(in, type); // the length is not correct lob = ValueLobDb.create(type, database, lob.getTableId(), lob.getLobId(), null, in.getLength()); return lob; } catch (IllegalStateException e) { throw DbException.get(ErrorCode.OBJECT_CLOSED, e); } catch (IOException e) { throw DbException.convertIOException(e, null); } } private ValueLobDb createLob(InputStream in, int type) throws IOException { byte[] streamStoreId; try { streamStoreId = streamStore.put(in); } catch (Exception e) { throw DbException.convertToIOException(e); } long lobId = generateLobId(); long length = streamStore.length(streamStoreId); int tableId = LobStorageFrontend.TABLE_TEMP; Object[] value = new Object[] { streamStoreId, tableId, length, 0 }; lobMap.put(lobId, value); Object[] key = new Object[] { streamStoreId, lobId }; refMap.put(key, Boolean.TRUE); ValueLobDb lob = ValueLobDb.create( type, database, tableId, lobId, null, length); if (TRACE) { trace("create " + tableId + "/" + lobId); } return lob; } private long generateLobId() { synchronized (nextLobIdSync) { if (nextLobId == 0) { Long id = lobMap.lastKey(); nextLobId = id == null ? 1 : id + 1; } return nextLobId++; } } @Override public boolean isReadOnly() { return database.isReadOnly(); } @Override public ValueLobDb copyLob(ValueLobDb old, int tableId, long length) { init(); int type = old.getType(); long oldLobId = old.getLobId(); long oldLength = old.getPrecision(); if (oldLength != length) { throw DbException.throwInternalError("Length is different"); } Object[] value = lobMap.get(oldLobId); value = value.clone(); byte[] streamStoreId = (byte[]) value[0]; long lobId = generateLobId(); value[1] = tableId; lobMap.put(lobId, value); Object[] key = new Object[] { streamStoreId, lobId }; refMap.put(key, Boolean.TRUE); ValueLobDb lob = ValueLobDb.create( type, database, tableId, lobId, null, length); if (TRACE) { trace("copy " + old.getTableId() + "/" + old.getLobId() + " > " + tableId + "/" + lobId); } return lob; } @Override public InputStream getInputStream(ValueLobDb lob, byte[] hmac, long byteCount) throws IOException { init(); Object[] value = lobMap.get(lob.getLobId()); if (value == null) { if (lob.getTableId() == LobStorageFrontend.TABLE_RESULT || lob.getTableId() == LobStorageFrontend.TABLE_ID_SESSION_VARIABLE) { throw DbException.get( ErrorCode.LOB_CLOSED_ON_TIMEOUT_1, "" + lob.getLobId() + "/" + lob.getTableId()); } throw DbException.throwInternalError("Lob not found: " + lob.getLobId() + "/" + lob.getTableId()); } byte[] streamStoreId = (byte[]) value[0]; return streamStore.get(streamStoreId); } @Override public void setTable(ValueLobDb lob, int tableId) { init(); long lobId = lob.getLobId(); Object[] value = lobMap.remove(lobId); if (TRACE) { trace("move " + lob.getTableId() + "/" + lob.getLobId() + " > " + tableId + "/" + lobId); } value[1] = tableId; lobMap.put(lobId, value); } @Override public void removeAllForTable(int tableId) { init(); if (database.getMvStore().getStore().isClosed()) { return; } // this might not be very efficient - // to speed it up, we would need yet another map ArrayList<Long> list = New.arrayList(); for (Entry<Long, Object[]> e : lobMap.entrySet()) { Object[] value = e.getValue(); int t = (Integer) value[1]; if (t == tableId) { list.add(e.getKey()); } } for (long lobId : list) { removeLob(tableId, lobId); } if (tableId == LobStorageFrontend.TABLE_ID_SESSION_VARIABLE) { removeAllForTable(LobStorageFrontend.TABLE_TEMP); removeAllForTable(LobStorageFrontend.TABLE_RESULT); } } @Override public void removeLob(ValueLobDb lob) { init(); int tableId = lob.getTableId(); long lobId = lob.getLobId(); removeLob(tableId, lobId); } private void removeLob(int tableId, long lobId) { if (TRACE) { trace("remove " + tableId + "/" + lobId); } Object[] value = lobMap.remove(lobId); if (value == null) { // already removed return; } byte[] streamStoreId = (byte[]) value[0]; Object[] key = new Object[] {streamStoreId, lobId }; refMap.remove(key); // check if there are more entries for this streamStoreId key = new Object[] {streamStoreId, 0L }; value = refMap.ceilingKey(key); boolean hasMoreEntries = false; if (value != null) { byte[] s2 = (byte[]) value[0]; if (Arrays.equals(streamStoreId, s2)) { if (TRACE) { trace(" stream still needed in lob " + value[1]); } hasMoreEntries = true; } } if (!hasMoreEntries) { if (TRACE) { trace(" remove stream " + StringUtils.convertBytesToHex(streamStoreId)); } streamStore.remove(streamStoreId); } } private static void trace(String op) { System.out.println("[" + Thread.currentThread().getName() + "] LOB " + op); } }
wizardofos/Protozoo
extra/h2/src/main/java/org/h2/store/LobStorageMap.java
Java
mit
12,802
# frozen_string_literal: true require "drip/resource" module Drip class Tag < Resource def self.resource_name "tag" end def initialize(raw_data = {}) @raw_attributes = raw_data.dup.freeze @attributes = @raw_attributes end end end
DripEmail/drip-ruby
lib/drip/resources/tag.rb
Ruby
mit
271
/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @flow * @format */ 'use strict'; const visit = require('graphql').visit; import type { Argument, Condition, Directive, Fragment, FragmentSpread, InlineFragment, LinkedField, Literal, LocalArgumentDefinition, MatchField, MatchBranch, Request, Root, RootArgumentDefinition, ScalarField, SplitOperation, Variable, } from './GraphQLIR'; const NodeKeys = { Argument: ['value'], Condition: ['condition', 'selections'], Directive: ['args'], Fragment: ['argumentDefinitions', 'directives', 'selections'], FragmentSpread: ['args', 'directives'], InlineFragment: ['directives', 'selections'], LinkedField: ['args', 'directives', 'selections'], Literal: [], LocalArgumentDefinition: [], MatchField: ['args', 'directives', 'selections'], MatchBranch: ['selections'], Request: ['fragment', 'root'], Root: ['argumentDefinitions', 'directives', 'selections'], RootArgumentDefinition: [], ScalarField: ['args', 'directives'], SplitOperation: ['selections'], Variable: [], }; export type VisitNode = | Argument | Condition | Directive | Fragment | FragmentSpread | InlineFragment | LinkedField | Literal | LocalArgumentDefinition | MatchField | Request | Root | RootArgumentDefinition | ScalarField | SplitOperation | Variable; export type VisitFn<T: VisitNode> = ( node: T, // node we're visiting key?: any, // index/key to node from parent array/object parent?: ?(VisitNode | Array<VisitNode>), // Object immediately above node path?: Array<any>, // keys to get from root: [keyForChild, ..., keyForParent] ancestors?: Array<VisitNode | Array<VisitNode>>, // [root, child1, ..., grandparent] // Note: ancestors includes arrays which contain the visited node // These correspond to array indices in `path`. ) => any; export type NodeVisitorObject<T: VisitNode> = | {enter?: VisitFn<T>, leave?: VisitFn<T>} | VisitFn<T>; export type NodeVisitor = | NodeVisitorObject<VisitNode> | { Argument?: NodeVisitorObject<Argument>, Condition?: NodeVisitorObject<Condition>, Directive?: NodeVisitorObject<Directive>, Fragment?: NodeVisitorObject<Fragment>, FragmentSpread?: NodeVisitorObject<FragmentSpread>, InlineFragment?: NodeVisitorObject<InlineFragment>, LinkedField?: NodeVisitorObject<LinkedField>, MatchField?: NodeVisitorObject<MatchField>, MatchBranch?: NodeVisitorObject<MatchBranch>, Literal?: NodeVisitorObject<Literal>, LocalArgumentDefinition?: NodeVisitorObject<LocalArgumentDefinition>, Request?: NodeVisitorObject<Request>, Root?: NodeVisitorObject<Root>, RootArgumentDefinition?: NodeVisitorObject<RootArgumentDefinition>, ScalarField?: NodeVisitorObject<ScalarField>, Variable?: NodeVisitorObject<Variable>, }; function visitIR(root: VisitNode, visitor: NodeVisitor) { return (visit: $FlowFixMe)(root, visitor, NodeKeys); } module.exports = {visit: visitIR};
dbslone/relay
packages/relay-compiler/core/GraphQLIRVisitor.js
JavaScript
mit
3,178
var ip = require('ip'); var azure = require('azure-storage'); var osenv = require('osenv'); var Guid = require('guid'); //console.log(process.env.AZURE_STORAGE_ACCOUNT); //console.log(process.env.AZURE_STORAGE_ACCESS_KEY); // Some things are not reliably in the env, and have a fallback command: var h = osenv.hostname(function (er, hostname) { h = hostname }); var localIpAddress = ip.address(); var tableSvc = azure.createTableService(); osenv.hostname(function (error, hostname) { if (!error) { var localIp = { PartitionKey: {'_':'localIp'}, RowKey: {'_': '' + Guid.create()}, ip: {'_': localIpAddress}, hostName: {'_': hostname} }; tableSvc.createTableIfNotExists('deviceip', function(error, result, response){ if(!error){ tableSvc.insertEntity('deviceip',localIp, function (error, result, response) { if(!error){ console.log('IP address: ' + JSON.stringify(localIp) + 'saved to Azure'); } else { console.log(error); } }); } else { console.log(error); } }); } else { console.log(error); } });
aichi/IP-address-collector
index.js
JavaScript
mit
1,304
body{ box-sizing: border-box; } .bg-inverse{ background-color: #17882c !important; } @media (min-width: 992px){ #mainNav .navbar-collapse .navbar-nav.sidebar-nav { background: #17882c !important; } #mainNav .navbar-collapse .navbar-nav.sidebar-nav li.active a{ background-color: #00420c !important; } } .panel-default { border-color: #ddd; } .panel { margin-bottom: 20px; background-color: #fff; border: 1px solid transparent; border-radius: 4px; -webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05); box-shadow: 0 1px 1px rgba(0,0,0,.05); } .panel-heading { padding: 10px 15px; border-bottom: 1px solid transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; } .panel-title { margin-top: 0; margin-bottom: 0; font-size: 16px; color: inherit; } .panel-body { padding: 15px; }
RogerioLucio/emprestimo_equipamentos
assets/css/style.css
CSS
mit
868
export const ic_format_paint_outline = {"viewBox":"0 0 24 24","children":[{"name":"path","attribs":{"d":"M0 0h24v24H0V0z","fill":"none"},"children":[]},{"name":"path","attribs":{"d":"M18 4V3c0-.55-.45-1-1-1H5c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h12c.55 0 1-.45 1-1V6h1v4H9v11c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-9h8V4h-3zm-2 2H6V4h10v2z"},"children":[]}]};
wmira/react-icons-kit
src/md/ic_format_paint_outline.js
JavaScript
mit
351
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2012.06.29 at 09:03:32 AM BST // package org.xcri.profiles._1_2.catalog.terms; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; import org.purl.dc.elements._1.DescriptionDType; /** * Description refinement typically used to specify the style of contact that a learner would receive on a course of study * * <p>Java class for contactPattern complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="contactPattern"> * &lt;complexContent> * &lt;restriction base="{http://purl.org/dc/elements/1.1/}descriptionDType"> * &lt;sequence> * &lt;element ref="{http://www.w3.org/1999/xhtml}div" minOccurs="0"/> * &lt;/sequence> * &lt;attribute ref="{http://www.w3.org/XML/1998/namespace}lang"/> * &lt;attribute name="href" type="{http://www.w3.org/2001/XMLSchema}anyURI" /> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "contactPattern") public class ContactPattern extends DescriptionDType { }
sussexcoursedata/course_data_project
src/main/java/org/xcri/profiles/_1_2/catalog/terms/ContactPattern.java
Java
mit
1,546
<HTML> <Header> <Title>per_fenacimiento - Column</Title> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> <Link href="../css/doc.css" rel="stylesheet" type="text/css"> </Header> <Body> <table class="logo"> <tr> <td class="logo">merclinica [BDClinica.xml]</td> </tr> </table> <table class="horzMenu"> <tr> <td class="horzMenu"><a class="horzMenu" href="../index.html"> Home</a></td><td class="horzMenu">|</td><td class="horzMenu"><a class="horzMenu" href="../tables/index.html">Tables</a></td><td class="horzMenu">|</td><td class="horzMenu"><a class="horzMenu" href="../schemas/index.html">Schemas</a></td><td class="horzMenu">|</td><td class="horzMenu"><a class="horzMenu" href="../diagrams/index.html">Diagrams</a></td><td class="horzMenu">|</td><td class="horzMenu"><a class="horzMenu" href="../foreignKeys/index.html">Foreign Keys</a></td><td class="horzMenu">|</td><td class="horzMenu"><a class="horzMenu" href="../indexes/index.html">Indexes</a></td><td class="horzMenuFiller"></td> </tr> </table> <hr> <table class="flat"> <tr class="banner"> <td class="title_nm">per_fenacimiento</td><td class="watermark_right">(Column)</td> </tr> <tr> <td class="key">Name</td><td class="value">per_fenacimiento</td> </tr> <tr> <td class="key">Comment</td><td class="value">Fecha de Nacimiento de la Persona</td> </tr> <tr> <td class="key">Data Type</td><td class="value">Date</td> </tr> <tr> <td class="key">Primary Key</td><td class="value"> </td> </tr> <tr> <td class="key">Nulls</td><td class="value"> </td> </tr> <tr> <td class="key">Auto Num.</td><td class="value"> </td> </tr> <tr> <td class="key">Default</td><td class="value"> </td> </tr> <tr> <td class="key">FK</td><td class="value"> </td> </tr> </table> </Body> </HTML>
Duvan07/Imperium
Documentacion/01. Requisitos/0.5 Diccionario de Datos/columns/public_mer_persona_per_fenacimiento.html
HTML
mit
1,792
package com.piratkopia13.pixelplanet.states; import com.piratkopia13.pixelplanet.Bullet; import com.piratkopia13.pixelplanet.GameMap; import com.piratkopia13.pixelplanet.GameVar; import com.piratkopia13.pixelplanet.Player; import com.piratkopia13.pixelplanet.engine.core.*; import com.piratkopia13.pixelplanet.engine.physics.particle.ParticleEmitter; import com.piratkopia13.pixelplanet.engine.rendering.*; import com.piratkopia13.pixelplanet.shaders.BasicShader; import org.lwjgl.input.Keyboard; import org.newdawn.slick.Color; import java.awt.*; import java.util.*; import java.util.List; import static org.lwjgl.opengl.GL11.*; public class Play implements GameState { private Player player; private Shader shader; private Camera camera; private GameMap map; private GameFont font; private List<Bullet> bullets; private float movementSpeed = 10f; public static Map<Integer, Player> otherPlayers; private static List<Integer> joiningPlayers = new ArrayList<>(); @Override public void init() { camera = new Camera(0, 0); // camera.setScale(0.5f); Game.setGameCamera(camera); otherPlayers = new HashMap<>(); player = new Player(); player.setShipIcon("axiom.png"); player.setPosition(275, 175); player.setSpeed(movementSpeed); player.follow(camera); player.pointTowardsMouse(true); font = new GameFont("Arial", 20, Font.PLAIN, true); map = GameMap.getTestMap(50); // Initiate a new testmap with 50x50px as blocksize player.setMap(map); GameVar.setMap(map); GameVar.setPlayer(player); bullets = new ArrayList<>(); shader = BasicShader.getInstance(); } @Override public void update(){ for (int pid : joiningPlayers){ System.out.println("added player"); otherPlayers.put(pid, new Player()); } joiningPlayers.clear(); System.out.println(otherPlayers.size()); GameVar.setMap(map); } @Override public void input(){ player.updateFromInput(); while (Keyboard.next()){ if (Keyboard.isKeyDown(Keyboard.KEY_SPACE)){ bullets.add(new Bullet(player.getCenterPosition(), player.getRotation(), 20f, player.getVelocity())); } } } @Override public void render(){ RenderUtil.clearScreen(); // glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); // wireframe mode shader.bind(); glPushMatrix(); camera.applyTransform(); // shader.unBind(); map.draw(); // shader.bind(); // Drawing the bullets before the map to remove any overlays Iterator<Bullet> iterator = bullets.iterator(); while (iterator.hasNext()) { Bullet bullet = iterator.next(); if (bullet.isDead()){ bullet.destroy(); iterator.remove(); }else bullet.draw(); } // glPointSize(5); // BasicShader.setColor(1, 0, 0, 1); // glBegin(GL_POINTS); // glVertex2f(GameVar.bltCol.x, GameVar.bltCol.y); // glEnd(); // BasicShader.resetColor(); // Render all enemies for (Player p : otherPlayers.values()) p.draw(); player.draw(); ParticleEmitter.updateAndRenderSmallExplosions(); glPopMatrix(); // HUD shader.unBind(); font.draw(Game.getFPS()+"", 0, 0, Color.white); } public void cleanUp(){ shader.dispose(); map.dispose(); } public static void spawnPlayer(int id){ joiningPlayers.add(id); } @Override public State getState() { return State.PLAY; } }
Piratkopia13/Pixel-Planet
Uncomplete_lwjgl_rewrite/src/com/piratkopia13/pixelplanet/states/Play.java
Java
mit
3,806
package com.InfinityRaider.AgriCraft.utility; import com.InfinityRaider.AgriCraft.handler.ConfigurationHandler; import com.InfinityRaider.AgriCraft.reference.Reference; import cpw.mods.fml.common.FMLLog; import org.apache.logging.log4j.Level; /** * A class to assist in the logging of the mod. * * Credits to Pahimar for this LogHelper class. */ public abstract class LogHelper { /** * Logs an object (normally a string), to the {@link FMLLog}. * * Please use {@link #debug(Object)} for logs of {@link Level#DEBUG}. * * @param logLevel the level at which to log the object, for filtering purposes. * @param object the object to be logged (interpreted into a string). */ public static void log(Level logLevel, Object object) { FMLLog.log(Reference.MOD_NAME, logLevel, String.valueOf(object)); } /** * Logs an object to the {@link FMLLog} at the level {@link Level#ALL}. * * @param object the object to be logged (interpreted into a string). */ public static void all(Object object) { log(Level.ALL, object); } /** * Logs an object to the {@link FMLLog} at the level {@link Level#ALL}. * * @param object the object to be logged (interpreted into a string). */ public static void debug(Object object) { if(ConfigurationHandler.debug) { log(Level.INFO, "[AGRI-DEBUG] "+object); } } /** * Logs an object to the {@link FMLLog} at the level {@link Level#ERROR}. * * @param object the object to be logged (interpreted into a string). */ public static void error(Object object) { log(Level.ERROR, object); } /** * Logs an object to the {@link FMLLog} at the level {@link Level#FATAL}. * * @param object the object to be logged (interpreted into a string). */ public static void fatal(Object object) { log(Level.FATAL, object); } /** * Logs an object to the {@link FMLLog} at the level {@link Level#INFO}. * * @param object the object to be logged (interpreted into a string). */ public static void info(Object object) { log(Level.INFO, object); } /** * Logs an object to the {@link FMLLog} at the level {@link Level#OFF}. * * @param object the object to be logged (interpreted into a string). */ public static void off(Object object) { log(Level.OFF, object); } /** * Logs an object to the {@link FMLLog} at the level {@link Level#TRACE}. * * @param object the object to be logged (interpreted into a string). */ public static void trace(Object object) { log(Level.TRACE, object); } /** * Logs an object to the {@link FMLLog} at the level {@link Level#WARN}. * * @param object the object to be logged (interpreted into a string). */ public static void warn(Object object) { log(Level.WARN, object); } /** * Logs an exception via {@link Exception#printStackTrace()} if debug mode is turned on in the configuration. * * @param e an exception to log. */ public static void printStackTrace(Exception e) { if(ConfigurationHandler.debug) { e.printStackTrace(); } } }
HenryLoenwind/AgriCraft
src/main/java/com/InfinityRaider/AgriCraft/utility/LogHelper.java
Java
mit
3,373
package nl.soccar.ui.fx.controller; import javafx.beans.property.SimpleIntegerProperty; import javafx.beans.property.SimpleStringProperty; /** * A table-item represents one single row inside a (JavaFX) TableView. * * @author PTS34A */ public class ResultTableItem { private final SimpleStringProperty username; private final SimpleIntegerProperty goalsScored; /** * Initiates a new ResultTableItem using the given results. * * @param username The username of the player the goals belong to. * @param goalsScored The amount of goals scored by the specific user. */ public ResultTableItem(String username, Integer goalsScored) { this.username = new SimpleStringProperty(username); this.goalsScored = new SimpleIntegerProperty(goalsScored); } /** * Gets the username that the result belongs to. * * @return String, the username. */ public String getUsername() { return username.get(); } /** * Gets the total of goals scored by the player * * @return int, the total of goals scored by a player. */ public Integer getGoalsScored() { return goalsScored.get(); } }
PTS3-S34A/User-Interface
Soccar [UI]/src/nl/soccar/ui/fx/controller/ResultTableItem.java
Java
mit
1,267
using System; using System.Collections.Generic; using System.IO; namespace LuminoBuild.Tasks { class BuildEngine_Emscripten : BuildTask { public override string CommandName => "BuildEngine_Emscripten"; //public override List<string> Dependencies => new List<string>() { "BuildExternalProjects" }; public override void Build(Builder builder) { var buildArchDir = "Emscripten"; var buildDir = Path.Combine(builder.LuminoBuildDir, buildArchDir); var installDir = Path.Combine(builder.LuminoBuildDir, buildArchDir, BuildEnvironment.EngineInstallDirName); var cmakeSourceDir = builder.LuminoRootDir; var dependenciesRoot = Path.Combine(EmscriptenBuildEnv.EmscriptenSysRootLocal, "ExternalInstall"); Directory.CreateDirectory(buildDir); var script = Path.Combine(buildDir, "build.bat"); using (var f = new StreamWriter(script)) { f.WriteLine($"cd /d \"{EmscriptenBuildEnv.EmsdkDir}\""); f.WriteLine($"call emsdk activate {EmscriptenBuildEnv.emsdkVer}"); f.WriteLine($"call emsdk_env.bat"); f.WriteLine($"cd /d \"{Utils.ToWin32Path(buildDir)}\""); f.WriteLine($"call emcmake cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX={installDir} -DLN_DEPENDENCIES_ROOT={dependenciesRoot} -DLN_BUILD_TESTS=OFF -DLN_BUILD_TOOLS=OFF -G \"MinGW Makefiles\" {cmakeSourceDir}"); //f.WriteLine($"call emcmake cmake -DCMAKE_BUILD_TYPE=Release -DLN_BUILD_TESTS=OFF -DLN_BUILD_TOOLS=OFF -G \"MinGW Makefiles\" {cmakeSourceDir}"); f.WriteLine($"call cmake --build . -j8"); f.WriteLine($"call cmake --build . --target install"); } Utils.CallProcess(script); // bat の中でエラーが発生すれば、例外に乗って出てくる // Path.Combine(EmscriptenBuildEnv.EmscriptenSysRootLocal, "Lumino");// // emcmake で find_library などを行う場合、Emscripten のシステムフォルダ以外は検索しないようにツールチェインファイルで封印されている。 // Lumino 本体のビルド時にライブラリを探すことができるようにするため、システムフォルダに一式コピーしておく。 //Utils.CopyDirectory(installDir, Path.Combine(BuildEnvironment.EmscriptenDir, "system")); //string emRootDir = BuildEnvironment.EmscriptenDir; //string emInstallDir = BuildEnvironment.EmscriptenDir; //string bundlePythonDir = Path.Combine(emInstallDir, "python", "2.7.5.3_64bit"); //string cmakeOutputDir = Path.Combine(builder.LuminoBuildDir, BuildEnvironment.CMakeTargetInstallDir, "Emscripten"); //string path = Environment.GetEnvironmentVariable("PATH"); //path = bundlePythonDir + ";" + path; //var environmentVariables = new Dictionary<string, string>() //{ // { "PATH", path } //}; //string buildDir = Path.Combine(builder.LuminoBuildDir, "Emscripten"); //Directory.CreateDirectory(buildDir); //Directory.SetCurrentDirectory(buildDir); //Utils.CallProcess(BuildEnvironment.emcmake, $"cmake {builder.LuminoRootDir} -DCMAKE_INSTALL_PREFIX={cmakeOutputDir} -G \"MinGW Makefiles\"", environmentVariables); //Utils.CallProcess("cmake", $"--build {buildDir}", environmentVariables); //Utils.CallProcess("cmake", $"--build {buildDir} --target install", environmentVariables); } } }
lriki/Lumino
tools/LuminoBuild/Tasks/BuildEngine_Emscripten.cs
C#
mit
3,758
'use strict'; /** * @ngdoc function * @name gccdApp.controller:AboutCtrl * @description * # AboutCtrl * Controller of the itisforgirls */ angular.module('itisforgirls') .controller('AboutCtrl', function ($scope) { $scope.awesomeThings = [ 'HTML5 Boilerplate', 'AngularJS', 'Karma' ]; });
lfgcodeLinc/Gecko-Commando-Squad
itisforgirls/app/scripts/controllers/about.js
JavaScript
mit
325