code
stringlengths
4
991k
repo_name
stringlengths
6
116
path
stringlengths
4
249
language
stringclasses
30 values
license
stringclasses
15 values
size
int64
4
991k
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
using System.Collections.Generic; using System.ComponentModel.DataAnnotations; namespace GRA.Domain.Model { public class DynamicAvatarLayer : Abstract.BaseDomainEntity { public int SiteId { get; set; } [Required] [MaxLength(255)] public string Name { get; set; } [Required] public int Position { get; set; } public bool CanBeEmpty { get; set; } public int GroupId { get; set; } public int SortOrder { get; set; } public bool DefaultLayer { get; set; } public bool ShowItemSelector { get; set; } public bool ShowColorSelector { get; set; } public int? SelectedItem { get; set; } public int? SelectedColor { get; set; } public string FilePath { get; set; } public ICollection<DynamicAvatarColor> DynamicAvatarColors { get; set; } public ICollection<DynamicAvatarItem> DynamicAvatarItems { get; set; } } }
iafb/gra4
src/GRA.Domain.Model/DynamicAvatarLayer.cs
C#
mit
958
[ 30522, 2478, 2291, 1012, 6407, 1012, 12391, 1025, 2478, 2291, 1012, 6922, 5302, 9247, 1012, 2951, 11639, 17287, 9285, 1025, 3415, 15327, 24665, 2050, 1012, 5884, 1012, 2944, 1063, 2270, 2465, 8790, 12462, 7559, 24314, 1024, 10061, 1012, 224...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!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.13"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>Neodroid: Member List</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="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript" src="navtreedata.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript"> $(document).ready(initResizable); </script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectlogo"><img alt="Logo" src="neodroidcropped124.png"/></td> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">Neodroid &#160;<span id="projectnumber">0.2.0</span> </div> <div id="projectbrief">Machine Learning Environment Prototyping Tool</div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.13 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> $(function() { initMenu('',true,false,'search.php','Search'); $(document).ready(function() { init_search(); }); }); </script> <div id="main-nav"></div> </div><!-- top --> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> <div id="nav-sync" class="sync"></div> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> $(document).ready(function(){initNavTree('classdroid_1_1_runtime_1_1_prototyping_1_1_sensors_1_1_transform_1_1_rotation_sensor.html','');}); </script> <div id="doc-content"> <!-- 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="header"> <div class="headertitle"> <div class="title">droid.Runtime.Prototyping.Sensors.Transform.RotationSensor Member List</div> </div> </div><!--header--> <div class="contents"> <p>This is the complete list of members for <a class="el" href="classdroid_1_1_runtime_1_1_prototyping_1_1_sensors_1_1_transform_1_1_rotation_sensor.html">droid.Runtime.Prototyping.Sensors.Transform.RotationSensor</a>, including all inherited members.</p> <table class="directory"> <tr class="even"><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_utilities_1_1_game_objects_1_1_prototyping_game_object.html#a44c13e1533869caebba884b955dacdc1">_Custom_Name</a></td><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_utilities_1_1_game_objects_1_1_prototyping_game_object.html">droid.Runtime.Utilities.GameObjects.PrototypingGameObject</a></td><td class="entry"><span class="mlabel">protected</span></td></tr> <tr><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_utilities_1_1_game_objects_1_1_prototyping_game_object.html#a6a496b0c040a1a7b3ffaabe7759cd9b7">Awake</a>()</td><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_utilities_1_1_game_objects_1_1_prototyping_game_object.html">droid.Runtime.Utilities.GameObjects.PrototypingGameObject</a></td><td class="entry"><span class="mlabel">protected</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_utilities_1_1_game_objects_1_1_prototyping_game_object.html#a2ef17a75fdee089a8210bc53dbcb97fd">Clear</a>()</td><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_utilities_1_1_game_objects_1_1_prototyping_game_object.html">droid.Runtime.Utilities.GameObjects.PrototypingGameObject</a></td><td class="entry"><span class="mlabel">protected</span><span class="mlabel">virtual</span></td></tr> <tr><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_prototyping_1_1_sensors_1_1_sensor.html#a3f2ee3644fd6f8178118e08c6628f5c6">EnvironmentReset</a>()</td><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_prototyping_1_1_sensors_1_1_sensor.html">droid.Runtime.Prototyping.Sensors.Sensor</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_prototyping_1_1_sensors_1_1_transform_1_1_rotation_sensor.html#ad6d98ff2417ced12597324d1ac1d1f82">FloatEnumerable</a></td><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_prototyping_1_1_sensors_1_1_transform_1_1_rotation_sensor.html">droid.Runtime.Prototyping.Sensors.Transform.RotationSensor</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_utilities_1_1_game_objects_1_1_prototyping_game_object.html#a957c322c80c1e0b489bd9f0ce5d8badc">Identifier</a></td><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_utilities_1_1_game_objects_1_1_prototyping_game_object.html">droid.Runtime.Utilities.GameObjects.PrototypingGameObject</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_prototyping_1_1_sensors_1_1_transform_1_1_rotation_sensor.html#a4155c07d1aaf56f98a8b3f30550014cd">ObservationValue</a></td><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_prototyping_1_1_sensors_1_1_transform_1_1_rotation_sensor.html">droid.Runtime.Prototyping.Sensors.Transform.RotationSensor</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_prototyping_1_1_sensors_1_1_sensor.html#a93b0d6725fc97e28831e0420f4b19610">ParentEnvironment</a></td><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_prototyping_1_1_sensors_1_1_sensor.html">droid.Runtime.Prototyping.Sensors.Sensor</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_prototyping_1_1_sensors_1_1_transform_1_1_rotation_sensor.html#a641434ca154a3e843e784328c2976fa2">PreSetup</a>()</td><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_prototyping_1_1_sensors_1_1_transform_1_1_rotation_sensor.html">droid.Runtime.Prototyping.Sensors.Transform.RotationSensor</a></td><td class="entry"><span class="mlabel">protected</span><span class="mlabel">virtual</span></td></tr> <tr><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_prototyping_1_1_sensors_1_1_transform_1_1_rotation_sensor.html#ae6fc8a0527b1e83ac365da819c4cd435">PrototypingTypeName</a></td><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_prototyping_1_1_sensors_1_1_transform_1_1_rotation_sensor.html">droid.Runtime.Prototyping.Sensors.Transform.RotationSensor</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_prototyping_1_1_sensors_1_1_transform_1_1_rotation_sensor.html#ae445c15be21fe292279c8b0dcf4f216c">QuadSpace</a></td><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_prototyping_1_1_sensors_1_1_transform_1_1_rotation_sensor.html">droid.Runtime.Prototyping.Sensors.Transform.RotationSensor</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_utilities_1_1_game_objects_1_1_prototyping_game_object.html#a22bacda56b91708e45bca46401d7c3e4">RefreshAwake</a>()</td><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_utilities_1_1_game_objects_1_1_prototyping_game_object.html">droid.Runtime.Utilities.GameObjects.PrototypingGameObject</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_utilities_1_1_game_objects_1_1_prototyping_game_object.html#a5c40d471089c5a4acf71244c62938b65">RefreshStart</a>()</td><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_utilities_1_1_game_objects_1_1_prototyping_game_object.html">droid.Runtime.Utilities.GameObjects.PrototypingGameObject</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_prototyping_1_1_sensors_1_1_sensor.html#a32c07acf1bf5c88c52b88ef8df1c149c">RegisterComponent</a>()</td><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_prototyping_1_1_sensors_1_1_sensor.html">droid.Runtime.Prototyping.Sensors.Sensor</a></td><td class="entry"><span class="mlabel">protected</span><span class="mlabel">virtual</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_prototyping_1_1_sensors_1_1_sensor.html#a500d2c6c69851b1d5157e527d4e7a174">Setup</a>()</td><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_prototyping_1_1_sensors_1_1_sensor.html">droid.Runtime.Prototyping.Sensors.Sensor</a></td><td class="entry"><span class="mlabel">protected</span><span class="mlabel">virtual</span></td></tr> <tr><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_prototyping_1_1_sensors_1_1_transform_1_1_rotation_sensor.html#a4bb64e6f27be407e8a2ed1b6e8e2428a">Space</a></td><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_prototyping_1_1_sensors_1_1_transform_1_1_rotation_sensor.html">droid.Runtime.Prototyping.Sensors.Transform.RotationSensor</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_utilities_1_1_game_objects_1_1_prototyping_game_object.html#a4cf26b33fb24c8311d75e0a4bbbae452">Start</a>()</td><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_utilities_1_1_game_objects_1_1_prototyping_game_object.html">droid.Runtime.Utilities.GameObjects.PrototypingGameObject</a></td><td class="entry"><span class="mlabel">protected</span></td></tr> <tr><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_prototyping_1_1_sensors_1_1_sensor.html#a09c940a37190b954338997d9bf664c04">ToString</a>()</td><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_prototyping_1_1_sensors_1_1_sensor.html">droid.Runtime.Prototyping.Sensors.Sensor</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_prototyping_1_1_sensors_1_1_sensor.html#ab3a807530651754925502af221c9b9b2">UnRegisterComponent</a>()</td><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_prototyping_1_1_sensors_1_1_sensor.html">droid.Runtime.Prototyping.Sensors.Sensor</a></td><td class="entry"><span class="mlabel">protected</span><span class="mlabel">virtual</span></td></tr> <tr><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_prototyping_1_1_sensors_1_1_sensor.html#a062c2b7dd454f261ad4c073a46131094">Update</a>()</td><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_prototyping_1_1_sensors_1_1_sensor.html">droid.Runtime.Prototyping.Sensors.Sensor</a></td><td class="entry"><span class="mlabel">protected</span><span class="mlabel">virtual</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_prototyping_1_1_sensors_1_1_transform_1_1_rotation_sensor.html#af37e30369bcdfeaf0ee34a5770756b84">UpdateObservation</a>()</td><td class="entry"><a class="el" href="classdroid_1_1_runtime_1_1_prototyping_1_1_sensors_1_1_transform_1_1_rotation_sensor.html">droid.Runtime.Prototyping.Sensors.Transform.RotationSensor</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> </table></div><!-- contents --> </div><!-- doc-content --> <!-- start footer part --> <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> <ul> <li class="footer">Generated by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li> </ul> </div> </body> </html>
sintefneodroid/droid
docs/cvs/classdroid_1_1_runtime_1_1_prototyping_1_1_sensors_1_1_transform_1_1_rotation_sensor-members.html
HTML
apache-2.0
12,972
[ 30522, 1026, 999, 9986, 13874, 16129, 2270, 1000, 1011, 1013, 1013, 1059, 2509, 2278, 1013, 1013, 26718, 2094, 1060, 11039, 19968, 1015, 1012, 1014, 17459, 1013, 1013, 4372, 1000, 1000, 8299, 1024, 1013, 1013, 7479, 1012, 1059, 2509, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package main import ( "fmt" "time" "net/http" "encoding/json" "io/ioutil" "github.com/gorilla/mux" ) type Play struct { Key string `json:"key" redis:"-"` SeasonKey string `json:"season_key" redis:"season_key"` QueenKey string `json:"queen_key" redis:"queen_key"` PlayTypeKey string `json:"play_type_key" redis:"play_type_key"` EpisodeKey string `json:"episode_key" redis:"episode_key"` Timestamp int64 `json:"timestamp" redis:"timestamp"` } func PostPlay(w http.ResponseWriter, r *http.Request) { fmt.Println("PostPlay") var new_play Play b, _ := ioutil.ReadAll(r.Body) fmt.Println(string(b)) json.Unmarshal(b, &new_play) season_key := mux.Vars(r)["season_id"] new_play.SeasonKey = season_key new_play.Timestamp = time.Now().Unix() _, success := AddObject("play", new_play) if success { fmt.Fprintf(w, "201 Created") } else { // TODO set the response code correct fmt.Fprintf(w, "ERR") } } func DeletePlay(w http.ResponseWriter, r *http.Request) { season_key := mux.Vars(r)["season_id"] play_key := mux.Vars(r)["play_key"] fmt.Println("DELTE play: ", play_key) var del_play Play del_play.Key = play_key success := GetObject(play_key, &del_play) fmt.Println("GOT QUEEN: ", del_play) if (season_key != del_play.SeasonKey) { fmt.Println("Hey, you are trying todelerte a play that doesn't belong here.") success = false } if (success) { success = DeleteObject("play", play_key, del_play) } if (success) { fmt.Fprintf(w, "200 OK (deleted)") } else { fmt.Fprintf(w, "KEY DOES NOT EXIST") } }
macrael/racetrack
play.go
GO
mit
1,787
[ 30522, 7427, 2364, 12324, 1006, 1000, 4718, 2102, 1000, 1000, 2051, 1000, 1000, 5658, 1013, 8299, 1000, 1000, 17181, 1013, 1046, 3385, 1000, 1000, 22834, 1013, 22834, 21823, 2140, 1000, 1000, 21025, 2705, 12083, 1012, 4012, 1013, 23526, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /** * @file * Defines the class for rules components (rule, ruleset, action). * Belongs to the "rules_component" operation type plugin. */ class ViewsBulkOperationsRulesComponent extends ViewsBulkOperationsBaseOperation { /** * Returns whether the provided account has access to execute the operation. * * @param $account */ public function access($account) { // The rules access() method returns FALSE for all non-admins, so this is // disabled until http://drupal.org/node/1217128 gets solved. //return rules_action('component_' . $this->operationInfo['key'])->access(); return TRUE; } /** * Returns the configuration form for the operation. * Only called if the operation is declared as configurable. * * @param $form * The views form. * @param $form_state * An array containing the current state of the form. * @param $context * An array of related data provided by the caller ("selection", for example). */ public function form($form, &$form_state, array $context) { $entity_key = $this->operationInfo['parameters']['entity_key']; // List types need to match the original, so passing list<node> instead of // list<entity> won't work. However, passing 'node' instead of 'entity' // will work, and is needed in order to get the right tokens. $list_type = 'list<' . $this->operationInfo['type'] . '>'; $entity_type = $this->aggregate() ? $list_type : $this->entityType; $info = entity_get_info($this->entityType); // The component is wrapped in an action set so that the configuration form // has access to the entity's tokens. $set = rules_action_set(array($entity_key => array('type' => $entity_type, 'label' => $info['label']))); $action = rules_action('component_' . $this->operationInfo['key'], array($entity_key . ':select' => $entity_key)); $set->action($action); $action->form($form, $form_state); // Remove the form element for the "entity" param. It will be passed in manually. unset($form['parameter'][$entity_key]); return $form; } /** * Validates the configuration form. * Only called if the operation is declared as configurable. * * @param $form * The views form. * @param $form_state * An array containing the current state of the form. */ public function formValidate($form, &$form_state) { rules_ui_form_rules_config_validate($form, $form_state); } /** * Stores the rules element added to the form state in form(), so that it * can be used in execute(). * Only called if the operation is declared as configurable. * * @param $form * The views form. * @param $form_state * An array containing the current state of the form. */ public function formSubmit($form, &$form_state) { $this->rulesElement = $form_state['rules_element']->root(); } /** * Executes the selected operation on the provided entity. * * @param $entity * The selected entity. * @param $context * An array of related data provided by the caller. */ public function execute($entity, array $context) { // If there was a config form, there's a rules_element. // If not, fallback to the component key. if ($this->configurable()) { $element = $this->rulesElement; } else { $element = rules_action('component_' . $this->operationInfo['parameters']['component_key']); } $element->execute($entity); } }
404pnf/d7sites
sites/fltrp.com/modules/standard/views_bulk_operations/plugins/operation_types/rules_component.class.php
PHP
gpl-2.0
3,488
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 1030, 5371, 1008, 11859, 1996, 2465, 2005, 3513, 6177, 1006, 3627, 1010, 3513, 3388, 1010, 2895, 1007, 1012, 1008, 7460, 2000, 1996, 1000, 3513, 1035, 6922, 1000, 3169, 2828, 13354, 2378, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
{% extends "base.html" %} {% block content %} <div class="row" ng-controller="HomepageController"> <div class="posts"> <ul> <div class="post" ng-repeat="post in posts"> <heading ng-bind="post.title"></heading> <content ng-bind="post.content"></content> </div> <div class="navbar-form"> <input type="text" ng-model="input_post.title"> <input type="text" ng-model="input_post.content"> <button ng-click="createPost(input_post.title, input_post.content)" type="submit" class="btn">Create Post</button> </div> </ul> </div> <aside class="subreddits"> <uib-tabset vertical="true" type="pills"> <uib-tab heading="global" select="refreshPosts('global')"></uib-tab> <uib-tab heading="{[{subreddit.title}]}" select="refreshPosts(subreddit.id)" ng-repeat="subreddit in subreddits">{[{ subreddit.description }]}</uib-tab> </uib-tabset> <div class="navbar-form"> <input type="text" ng-model="input_sub.title"> <input type="text" ng-model="input_sub.description"> <button ng-click="createSubreddit(input_sub.title, input_sub.description)" type="submit" class="btn">Create Subreddit</button> </div> </aside> </div> {% endblock content %}
agile-course/news_feed
news_feed/templates/pages/home.html
HTML
unlicense
1,377
[ 30522, 1063, 1003, 8908, 1000, 2918, 1012, 16129, 1000, 1003, 1065, 1063, 1003, 3796, 4180, 1003, 1065, 1026, 4487, 2615, 2465, 1027, 1000, 5216, 1000, 12835, 1011, 11486, 1027, 1000, 2188, 13704, 8663, 13181, 10820, 1000, 1028, 1026, 4487,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/** * DSS - Digital Signature Services * Copyright (C) 2015 European Commission, provided under the CEF programme * * This file is part of the "DSS - Digital Signature Services" project. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ package eu.europa.esig.dss.x509.ocsp; import java.util.Date; import java.util.List; import org.bouncycastle.cert.ocsp.BasicOCSPResp; import org.bouncycastle.cert.ocsp.CertificateID; import org.bouncycastle.cert.ocsp.SingleResp; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import eu.europa.esig.dss.DSSRevocationUtils; import eu.europa.esig.dss.utils.Utils; import eu.europa.esig.dss.x509.CertificateToken; import eu.europa.esig.dss.x509.RevocationOrigin; /** * Abstract class that helps to implement an OCSPSource with an already loaded list of BasicOCSPResp * */ @SuppressWarnings("serial") public abstract class OfflineOCSPSource implements OCSPSource { private static final Logger LOG = LoggerFactory.getLogger(OfflineOCSPSource.class); @Override public final OCSPToken getRevocationToken(CertificateToken certificateToken, CertificateToken issuerCertificateToken) { final List<BasicOCSPResp> containedOCSPResponses = getContainedOCSPResponses(); if (Utils.isCollectionEmpty(containedOCSPResponses)) { return null; } if (LOG.isTraceEnabled()) { final String dssIdAsString = certificateToken.getDSSIdAsString(); LOG.trace("--> OfflineOCSPSource queried for " + dssIdAsString + " contains: " + containedOCSPResponses.size() + " element(s)."); } Date bestUpdate = null; BasicOCSPResp bestBasicOCSPResp = null; final CertificateID certId = DSSRevocationUtils.getOCSPCertificateID(certificateToken, issuerCertificateToken); for (final BasicOCSPResp basicOCSPResp : containedOCSPResponses) { for (final SingleResp singleResp : basicOCSPResp.getResponses()) { if (DSSRevocationUtils.matches(certId, singleResp)) { final Date thisUpdate = singleResp.getThisUpdate(); if ((bestUpdate == null) || thisUpdate.after(bestUpdate)) { bestBasicOCSPResp = basicOCSPResp; bestUpdate = thisUpdate; } } } } if (bestBasicOCSPResp != null) { OCSPToken ocspToken = new OCSPToken(); ocspToken.setCertId(certId); ocspToken.setOrigin(RevocationOrigin.SIGNATURE); ocspToken.setBasicOCSPResp(bestBasicOCSPResp); return ocspToken; } return null; } /** * Retrieves the list of {@code BasicOCSPResp} contained in the source. * * @return {@code List} of {@code BasicOCSPResp}s */ public abstract List<BasicOCSPResp> getContainedOCSPResponses(); }
zsoltii/dss
dss-spi/src/main/java/eu/europa/esig/dss/x509/ocsp/OfflineOCSPSource.java
Java
lgpl-2.1
3,289
[ 30522, 1013, 1008, 1008, 1008, 16233, 2015, 1011, 3617, 8085, 2578, 1008, 9385, 1006, 1039, 1007, 2325, 2647, 3222, 1010, 3024, 2104, 1996, 8292, 2546, 4746, 1008, 1008, 2023, 5371, 2003, 2112, 1997, 1996, 1000, 16233, 2015, 1011, 3617, 8...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<table class="edit_form"> <tr> <td class="edit_form_header"> Change NPC Faction ID: </td> </tr> <tr> <td class="edit_form_content"> <form name="searchmethod" method="get" action="index.php"> <input type="hidden" name="editor" value="npc"> <input type="hidden" name="z" value="<?=$currzone?>"> <input type="hidden" name="zoneid" value="<?=$currzoneid?>"> <input type="hidden" name="npcid" value="<?=$npcid?>"> <input type="radio" name="action" value="6">Search for an NPC Faction ID by name<br> <input type="radio" name="action" value="38">Search for an NPC Faction ID by primary name<br> <input type="radio" name="action" value="4">Enter an existing NPC Faction ID<br> <input type="radio" name="action" value="8">Create a new NPC Faction ID<br><br> <center> <input type="submit" value="Continue"> </center> </form> </td> </tr> </table>
Akkadius/EQEmuEOC
modules/peqphpeditor/templates/npc/factionid.change.tmpl.php
PHP
gpl-3.0
1,112
[ 30522, 1026, 2795, 2465, 1027, 1000, 10086, 1035, 2433, 1000, 1028, 1026, 19817, 1028, 1026, 14595, 2465, 1027, 1000, 10086, 1035, 2433, 1035, 20346, 1000, 1028, 2689, 27937, 2278, 10233, 8909, 1024, 1026, 1013, 14595, 1028, 1026, 1013, 198...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
class Solution { public int solution(int[] A) { int[] temArray = new int[A.length + 2]; for (int i = 0; i < A.length; i++) { temArray[A[i]] = 1; } for (int i = 1; i < temArray.length + 1; i++) { if(temArray[i] == 0){ return i; } } return A[A.length - 1] + 1; } }
majusko/codility
PermMissingElem.java
Java
mit
392
[ 30522, 2465, 5576, 1063, 2270, 20014, 5576, 1006, 20014, 1031, 1033, 1037, 1007, 1063, 20014, 1031, 1033, 8915, 7849, 9447, 1027, 2047, 20014, 1031, 1037, 1012, 3091, 1009, 1016, 1033, 1025, 2005, 1006, 20014, 1045, 1027, 1014, 1025, 1045, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
"use strict" const should = require('should') const rewire = require('rewire') const IC = rewire('../commands/new.js') describe('New command',() => { let mockFS = { outputFile : (filename,content) => { console.log(`mock writing to ${filename}`); return { then : () => { return { catch : () => {} }} } } } let mockFindADRDir = ( callback,startFrom,notFoundHandler) => { callback('.') } let mockEditorCommand = "mockEditor" let mockPropUtil = { parse : (file,opts,cb) => { cb(undefined,{editor : mockEditorCommand}) } } let dummyLaunchEditor = _ => {} let commonMocks = { fs : mockFS , propUtil : mockPropUtil , launchEditorForADR : dummyLaunchEditor , writeADR : (adrFilename,newADR) => { console.log(`Pretending to write to ${adrFilename}`)} } function modifiedCommonMocks(specificMocks) { let copy = {} for (var k in commonMocks) copy[k] = commonMocks[k] for (var j in specificMocks) copy[j] = specificMocks[j] return copy; } it("Should fail if passed an invalid title - that can't be used as a filename", () => { let revert = IC.__set__({ findADRDir : (startFrom, callback,notFoundHandler) => { callback('.') } , withAllADRFiles : (callback) => { callback(['1-adr1.md','2-adr2.md'])} }) let block = () => {IC(["bla","###"])} block.should.throw() revert() }) it ("Should assign the next number for the new ADR - one higher than the last available ADR", () => { let testTitle = "test" let mocksWithHighestNumber = n => { return { findADRDir : mockFindADRDir , withAllADRFiles : callback => {callback(['1-adr1.md', n + '-adr2.md'])} , adrContent : (num,title,date) => { num.should.eql(n+1)} } } var revert = IC.__set__(modifiedCommonMocks(mocksWithHighestNumber(2))) IC([testTitle]) revert() revert = IC.__set__(modifiedCommonMocks(mocksWithHighestNumber(5))) IC(["test"]) revert(); }) it("Should use the title given as title parts when creating the new ADR content", () => { let testTitle = "test" var revert = IC.__set__(modifiedCommonMocks({ findADRDir : mockFindADRDir , withAllADRFiles : (callback) => { callback(['1-adr1.md'])} , adrContent : (num,title,date) => { title.should.eql(testTitle) } })) IC([testTitle]) revert(); let adrWithSeveralParts = ["adr","part","2"] revert = IC.__set__(modifiedCommonMocks({ findADRDir : mockFindADRDir , withAllADRFiles : (callback) => { callback(['1-adr1.md'])} , adrContent : (num,title,date) => { console.log(`Title mock got: ${title}`) title.should.eql(adrWithSeveralParts.join(' ')) } })) IC(adrWithSeveralParts) revert(); }) it("should attempt writing the content to a file", function() { let testTitle = "test" var revert = IC.__set__(modifiedCommonMocks({ findADRDir : mockFindADRDir , withAllADRFiles : (callback) => { callback(['1-adr1.md'])} , common : { writeTextFileAndNotifyUser : (filename, content, msg) => { filename.should.startWith('2') //default file name scheme starts with the expected ID content.should.match(new RegExp(testTitle)) //The title should be somewhere in the content msg.should.startWith('Writing') } } })) IC([testTitle]) revert() }) })
slior/adrflow
src/test/newTests.js
JavaScript
mit
3,468
[ 30522, 1000, 2224, 9384, 1000, 9530, 3367, 2323, 1027, 5478, 1006, 1005, 2323, 1005, 1007, 9530, 3367, 2128, 20357, 1027, 5478, 1006, 1005, 2128, 20357, 1005, 1007, 9530, 3367, 24582, 1027, 2128, 20357, 1006, 1005, 1012, 1012, 1013, 10954, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# Makefile TOP_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) REQUIREMENTS_FILE := requirements.txt ENVIRONMENT_FILE := conda_lock.yml third_party/make-env/conda.mk: git submodule init git submodule update --init --recursive include third_party/make-env/conda.mk ifeq ($(origin CMAKE_COMMAND),undefined) CMAKE_COMMAND := cmake else CMAKE_COMMAND := ${CMAKE_COMMAND} endif .PHONY: all env all: env cd build && $(MAKE) clean:: rm -rf build # Conda Lock contains all dependencies. PIP often fails if a package is both # specified to be installed directly and as a dependency of another package. env:: export PIP_NO_DEPS = true env:: | $(CONDA_ENV_PYTHON) git submodule init git submodule update --init --recursive @$(IN_CONDA_ENV) mkdir -p build && cd build && $(CMAKE_COMMAND) ${CMAKE_FLAGS} .. build/Makefile: make env .PHONY: Makefile #%: build/Makefile # @$(IN_CONDA_ENV) cd build && $(MAKE) $@
SymbiFlow/symbiflow-arch-defs
Makefile
Makefile
isc
922
[ 30522, 1001, 2191, 8873, 2571, 2327, 1035, 16101, 1024, 1027, 1002, 1006, 2613, 15069, 1002, 1006, 16101, 1002, 1006, 2197, 18351, 1002, 1006, 2191, 8873, 2571, 1035, 2862, 1007, 1007, 1007, 1007, 5918, 1035, 5371, 1024, 1027, 5918, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
module.exports = { stores: process.env.STORES ? process.env.STORES.split(',') : [ 'elasticsearch', 'postgresql', 'leveldb' ], postgresql: { host: process.env.POSTGRESQL_HOST || 'localhost', port: process.env.POSTGRESQL_PORT || '5432', username: process.env.POSTGRESQL_USER || 'postgres', password: process.env.POSTGRESQL_PASSWORD || 'postgres' }, elasticsearch: { hosts: [ process.env.ELASTICSEARCH_HOST || 'http://localhost:9200' ] }, level: { path: process.env.LEVEL_PATH || '/tmp/level' }, queue: { client: process.env.QUEUE_CLIENT || 'kue', kue: { port: process.env.QUEUE_KUE_PORT ? Number(process.env.QUEUE_KUE_PORT) : 3000 }, rabbitmq: { connectionString: process.env.QUEUE_RABBITMQ_CONNECTIONSTRING } }, project: { client: process.env.PROJECT_CLIENT || 'file', file: { path: process.env.PROJECT_FILE_PATH || '/tmp/dstore' } }, api: { port: (process.env.API_PORT ? Number(process.env.API_PORT) : (process.env.PORT ? process.env.PORT : 2020)) } };
trappsnl/dstore
config.js
JavaScript
mit
1,089
[ 30522, 11336, 1012, 14338, 1027, 1063, 5324, 1024, 2832, 1012, 4372, 2615, 1012, 5324, 1029, 2832, 1012, 4372, 2615, 1012, 5324, 1012, 3975, 1006, 1005, 1010, 1005, 1007, 1024, 1031, 1005, 21274, 17310, 11140, 1005, 1010, 1005, 2695, 17603,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
.jsdoc-githubify html { overflow: auto; background-color: #fff; } .jsdoc-githubify body { font: 14px "DejaVu Sans Condensed", "Liberation Sans", "Nimbus Sans L", Tahoma, Geneva, "Helvetica Neue", Helvetica, Arial, sans-serif; line-height: 130%; color: #000; background-color: #fff; } .jsdoc-githubify a { color: #444; } .jsdoc-githubify a:visited { color: #444; } .jsdoc-githubify a:active { color: #444; } .jsdoc-githubify header { display: block; padding: 6px 4px; } .jsdoc-githubify .class-description { font-style: italic; font-family: Palatino, 'Palatino Linotype', serif; font-size: 130%; line-height: 140%; margin-bottom: 1em; margin-top: 1em; } .jsdoc-githubify #main { float: left; width: 100%; } .jsdoc-githubify section { display: block; background-color: #fff; padding: 12px 24px; border-bottom: 1px solid #ccc; margin-right: 240px; } .jsdoc-githubify .variation { display: none; } .jsdoc-githubify .optional:after { content: "opt"; font-size: 60%; color: #aaa; font-style: italic; font-weight: lighter; } .jsdoc-githubify nav { display: block; float: left; margin-left: -230px; margin-top: 28px; width: 220px; border-left: 1px solid #ccc; padding-left: 9px; } .jsdoc-githubify nav ul { font-family: 'Lucida Grande', 'Lucida Sans Unicode', arial, sans-serif; font-size: 100%; line-height: 17px; padding: 0; margin: 0; list-style-type: none; } .jsdoc-githubify nav h2 a, .jsdoc-githubify nav h2 a:visited { color: #A35A00; text-decoration: none; } .jsdoc-githubify nav h3 { margin-top: 12px; } .jsdoc-githubify nav li { margin-top: 6px; } .jsdoc-githubify nav a { color: #5C5954; } .jsdoc-githubify nav a:visited { color: #5C5954; } .jsdoc-githubify nav a:active { color: #5C5954; } .jsdoc-githubify footer { display: block; padding: 6px; margin-top: 12px; font-style: italic; font-size: 90%; } .jsdoc-githubify h1 { font-size: 200%; font-weight: bold; letter-spacing: -0.01em; margin: 6px 0 9px 0; } .jsdoc-githubify h2 { font-size: 170%; font-weight: bold; letter-spacing: -0.01em; margin: 6px 0 3px 0; } .jsdoc-githubify h3 { font-size: 150%; font-weight: bold; letter-spacing: -0.01em; margin-top: 16px; margin: 6px 0 3px 0; } .jsdoc-githubify h4 { font-size: 130%; font-weight: bold; letter-spacing: -0.01em; margin-top: 16px; margin: 18px 0 3px 0; color: #A35A00; } .jsdoc-githubify h5, .jsdoc-githubify .container-overview .subsection-title { font-size: 120%; font-weight: bold; letter-spacing: -0.01em; margin: 8px 0 3px -16px; } .jsdoc-githubify h6 { font-size: 100%; letter-spacing: -0.01em; margin: 6px 0 3px 0; font-style: italic; } .jsdoc-githubify .ancestors { color: #999; } .jsdoc-githubify .ancestors a { color: #999 !important; text-decoration: none; } .jsdoc-githubify .important { font-weight: bold; color: #950B02; } .jsdoc-githubify .yes-def { text-indent: -1000px; } .jsdoc-githubify .type-signature { color: #aaa; } .jsdoc-githubify .name, .jsdoc-githubify .signature { font-family: Consolas, "Lucida Console", Monaco, monospace; } .jsdoc-githubify .details { margin-top: 14px; border-left: 2px solid #DDD; } .jsdoc-githubify .details dt { width: 100px; float: left; padding-left: 10px; padding-top: 6px; } .jsdoc-githubify .details dd { margin-left: 50px; } .jsdoc-githubify .details ul { margin: 0; } .jsdoc-githubify .details ul { list-style-type: none; } .jsdoc-githubify .details li { margin-left: 30px; padding-top: 6px; } .jsdoc-githubify .details pre.prettyprint { margin: 0; } .jsdoc-githubify .details .object-value { padding-top: 0; } .jsdoc-githubify .description { margin-bottom: 1em; margin-left: -16px; margin-top: 1em; } .jsdoc-githubify .code-caption { font-style: italic; font-family: Palatino, 'Palatino Linotype', serif; font-size: 107%; margin: 0; } .jsdoc-githubify .prettyprint { border: 1px solid #ddd; width: 80%; overflow: auto; } .jsdoc-githubify .prettyprint.source { width: inherit; } .jsdoc-githubify .prettyprint code { font-family: Consolas, 'Lucida Console', Monaco, monospace; font-size: 100%; line-height: 18px; display: block; padding: 4px 12px; margin: 0; background-color: #fff; color: #000; } .jsdoc-githubify .prettyprint code span.line { display: inline-block; } .jsdoc-githubify .prettyprint.linenums { padding-left: 70px; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .jsdoc-githubify .prettyprint.linenums ol { padding-left: 0; } .jsdoc-githubify .prettyprint.linenums li { border-left: 3px #ddd solid; } .jsdoc-githubify .prettyprint.linenums li.selected, .jsdoc-githubify .prettyprint.linenums li.selected * { background-color: lightyellow; } .jsdoc-githubify .prettyprint.linenums li * { -webkit-user-select: text; -moz-user-select: text; -ms-user-select: text; user-select: text; } .jsdoc-githubify .params, .jsdoc-githubify .props { border-spacing: 0; border: 0; border-collapse: collapse; } .jsdoc-githubify .params .name, .jsdoc-githubify .props .name, .jsdoc-githubify .name code { color: #A35A00; font-family: Consolas, 'Lucida Console', Monaco, monospace; font-size: 100%; } .jsdoc-githubify .params td, .jsdoc-githubify .params th, .jsdoc-githubify .props td, .jsdoc-githubify .props th { border: 1px solid #ddd; margin: 0px; text-align: left; vertical-align: top; padding: 4px 6px; display: table-cell; } .jsdoc-githubify .params thead tr, .jsdoc-githubify .props thead tr { background-color: #ddd; font-weight: bold; } .jsdoc-githubify .params .params thead tr, .jsdoc-githubify .props .props thead tr { background-color: #fff; font-weight: bold; } .jsdoc-githubify .params th, .jsdoc-githubify .props th { border-right: 1px solid #aaa; } .jsdoc-githubify .params thead .last, .jsdoc-githubify .props thead .last { border-right: 1px solid #ddd; } .jsdoc-githubify .disabled { color: #454545; }
thlorenz/jsdoc-githubify-inject
jsdoc-default.css
CSS
mit
6,100
[ 30522, 1012, 1046, 16150, 10085, 1011, 21025, 2705, 12083, 8757, 16129, 1063, 2058, 12314, 1024, 8285, 1025, 4281, 1011, 3609, 1024, 1001, 21461, 2546, 1025, 1065, 1012, 1046, 16150, 10085, 1011, 21025, 2705, 12083, 8757, 2303, 1063, 15489, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#!/usr/bin/python #CHANGE ONLY, IF YOU KNOW, WHAT YOU DO! #OPKMANAGER WILL CRASH IF YOUR OUTPUT IS INVALID! import subprocess import argparse import time import calendar import string import sys class RegisterAction(argparse.Action): def __call__(self, parser, namespace, values, option_string=None): print "Official Repository" # Name print "web" # Type (maybe web for web, or anything else for usb) print "http://www.gcw-zero.com/files/upload/opk/" #URL print "official.py --update" #Call for updating the list print "O" #letter to show class UpdateAction(argparse.Action): def __call__(self, parser, namespace, values, option_string=None): process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/gcw-repos/count.php',stdout=subprocess.PIPE,shell=True) process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://www.gcw-zero.com/downloads',stdout=subprocess.PIPE,shell=True) #process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/temp/test.htm',stdout=subprocess.PIPE,shell=True) #process = subprocess.Popen('cat downloads',stdout=subprocess.PIPE,shell=True) output = process.stdout.read().split('<div class="downloads_overview">') for output_part in output: part = output_part.split('\n') line_number = 0; not_found = 1; while (line_number < len(part)): if (part[line_number].strip().startswith('<span class="downloads_title">')): not_found = 0; break; line_number += 1; if not_found: continue; program_name_description = part[line_number]; name = program_name_description.split('>')[1].split('<')[0]; if (name == ""): continue line_number = 0; not_found = 1; while (line_number < len(part)): if (part[line_number].strip().startswith('<a class="downloads_link"')): not_found = 0; break; line_number += 1; if not_found: continue; filename = part[line_number].split('href="file.php?file=')[1].split('">')[0]; print "["+name+"]" description = program_name_description.split('>')[3]; print "description: "+description print "filename: " + filename l = len(part) found_version = 0 found_image = 0 found_long = 0; for i in range(0,l-1): if string.find(part[i],'Publication Date') != -1: version = part[i+1] version = version.split('>')[1] version = version.split('<')[0] t = time.strptime(version,"%A, %d %b %Y") print "version: " + str(calendar.timegm(t)) #NEEDED! found_version = 1 if string.find(part[i],'<div class="downloads_preview"') != -1: image = part[i]; image = image.split("background-image: url('")[1].split("');")[0]; print "image_url: http://www.gcw-zero.com/" + image if string.find(part[i],'<p class="more fade">') != -1: long_description = part[i]; long_description = long_description.split('<p class="more fade">')[1].split("</p>")[0]; long_description = long_description.replace('<br /> ','\\n') long_description = long_description.split('>') sys.stdout.write("long_description: ") for long_description_part in long_description: sys.stdout.write(long_description_part.split('<')[0]) sys.stdout.write('\n') found_long = 1 if (found_version and found_image and found_long): break print "" def main(): parser = argparse.ArgumentParser(description="Ziz's Repository script") parser.add_argument('--register', nargs=0, action=RegisterAction) parser.add_argument('--update', nargs=1, action=UpdateAction) args = parser.parse_args() if __name__ == "__main__": main()
theZiz/OPKManager
repositories/official.py
Python
gpl-2.0
3,617
[ 30522, 1001, 999, 1013, 2149, 2099, 1013, 8026, 1013, 18750, 1001, 2689, 2069, 1010, 2065, 2017, 2113, 1010, 2054, 2017, 2079, 999, 1001, 6728, 22287, 5162, 4590, 2097, 5823, 2065, 2115, 6434, 2003, 19528, 999, 12324, 4942, 21572, 9623, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/************************************************************************** * (c) Copyright 2012 Microsemi SoC Products Group. All rights reserved. * * Smartfusion2 system configuration. * - Automatically created by Microsemi Libero SoC Sun May 05 13:12:03 2013 * * Warning: Do not modify this file, it may lead to unexpected * functional failures in your Microcontroller Subsystem. */ #ifndef SYS_CONFIG_MSS_CLOCKS #define SYS_CONFIG_MSS_CLOCKS #define MSS_SYS_M3_CLK_FREQ 50000000u #define MSS_SYS_MDDR_CLK_FREQ 200000000u #define MSS_SYS_APB_0_CLK_FREQ 50000000u #define MSS_SYS_APB_1_CLK_FREQ 50000000u #define MSS_SYS_APB_2_CLK_FREQ 12500000u #define MSS_SYS_FIC_0_CLK_FREQ 50000000u #define MSS_SYS_FIC_1_CLK_FREQ 50000000u #define MSS_SYS_FIC64_CLK_FREQ 50000000u #endif /* SYS_CONFIG_MSS_CLOCKS */
RobsonRojas/frertos-udemy
Keil-FreeRTOS-Sample-Project/Keil-FreeRTOS/FreeRTOSv9.0.0/FreeRTOS/Demo/CORTEX_SmartFusion2_M2S050_SoftConsole/RTOSDemo_Hardware_Platform/drivers_config/sys_config/sys_config_mss_clocks_developoment_kit.h
C
gpl-3.0
906
[ 30522, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package com.github.aha.cert.exception; public class MyRuntimeException extends RuntimeException { private static final long serialVersionUID = 1L; public MyRuntimeException(String message) { super(message); } }
arnosthavelka/owcd-cert
src/main/java/com/github/aha/cert/exception/MyRuntimeException.java
Java
mit
220
[ 30522, 7427, 4012, 1012, 21025, 2705, 12083, 1012, 6289, 2050, 1012, 8292, 5339, 1012, 6453, 1025, 2270, 2465, 2026, 15532, 7292, 10288, 24422, 8908, 2448, 7292, 10288, 24422, 1063, 2797, 10763, 2345, 2146, 7642, 27774, 21272, 1027, 1015, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
{% extends 'layouts/default.html' %} {% block content %} That site was not found! {% endblock %}
andychase/codebook
topics/templates/topics/site_not_found.html
HTML
mit
101
[ 30522, 1063, 1003, 8908, 1005, 9621, 2015, 1013, 12398, 1012, 16129, 1005, 1003, 1065, 1063, 1003, 3796, 4180, 1003, 1065, 2008, 2609, 2001, 2025, 2179, 999, 1063, 1003, 2203, 23467, 1003, 1065, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/*- * Copyright (c) 2002 by Thomas Moestl <tmm@FreeBSD.org>. * All rights reserved. * * 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. */ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); #include <dev/ofw/openfirm.h> #include <dev/ofw/openfirmio.h> #include <err.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sysexits.h> #include <unistd.h> #include <vis.h> #include "ofw_util.h" /* Constants controlling the layout of the output. */ #define LVLINDENT 2 #define NAMEINDENT 2 #define DUMPINDENT 4 #define CHARSPERLINE 60 #define BYTESPERLINE (CHARSPERLINE / 3) static void usage(void); static void ofw_indent(int); static void ofw_dump_properties(int, phandle_t, int, int, int); static void ofw_dump_property(int fd, phandle_t n, int level, const char *prop, int raw, int str); static void ofw_dump(int, const char *, int, int, const char *, int, int); static void usage(void) { fprintf(stderr, "usage: ofwdump -a [-p | -P property] [-R | -S]\n" " ofwdump [-p | -P property] [-r] [-R | -S] [--] nodes\n"); exit(EX_USAGE); } int main(int argc, char *argv[]) { int opt, i, fd; int aflag, pflag, rflag, Rflag, Sflag; char *Parg; aflag = pflag = rflag = Rflag = Sflag = 0; Parg = NULL; while ((opt = getopt(argc, argv, "-aprP:RS")) != -1) { if (opt == '-') break; switch (opt) { case 'a': aflag = 1; rflag = 1; break; case 'p': if (Parg != NULL) usage(); pflag = 1; break; case 'r': rflag = 1; break; case 'P': if (pflag) usage(); pflag = 1; Parg = optarg; break; case 'R': if (Sflag) usage(); Rflag = 1; break; case 'S': if (Rflag) usage(); Sflag = 1; break; case '?': default: usage(); /* NOTREACHED */ } } argc -= optind; argv += optind; fd = ofw_open(O_RDONLY); if (aflag) { if (argc != 0) usage(); ofw_dump(fd, NULL, rflag, pflag, Parg, Rflag, Sflag); } else { /* * For the sake of scripts, usage() is not called here if * argc == 0. */ for (i = 0; i < argc; i++) ofw_dump(fd, argv[i], rflag, pflag, Parg, Rflag, Sflag); } ofw_close(fd); return (EX_OK); } static void ofw_indent(int level) { int i; for (i = 0; i < level; i++) putchar(' '); } static void ofw_dump_properties(int fd, phandle_t n, int level, int raw, int str) { int nlen; char prop[32]; for (nlen = ofw_firstprop(fd, n, prop, sizeof(prop)); nlen != 0; nlen = ofw_nextprop(fd, n, prop, prop, sizeof(prop))) ofw_dump_property(fd, n, level, prop, raw, str); } static void ofw_dump_property(int fd, phandle_t n, int level, const char *prop, int raw, int str) { static void *pbuf = NULL; static char *visbuf = NULL; static char printbuf[CHARSPERLINE + 1]; static int pblen = 0, vblen = 0; int len, i, j, max, vlen; len = ofw_getprop_alloc(fd, n, prop, &pbuf, &pblen, 1); if (len < 0) return; if (raw) write(STDOUT_FILENO, pbuf, len); else if (str) printf("%.*s\n", len, (char *)pbuf); else { ofw_indent(level * LVLINDENT + NAMEINDENT); printf("%s:\n", prop); /* Print in hex. */ for (i = 0; i < len; i += BYTESPERLINE) { max = len - i; max = max > BYTESPERLINE ? BYTESPERLINE : max; ofw_indent(level * LVLINDENT + DUMPINDENT); for (j = 0; j < max; j++) printf("%02x ", ((unsigned char *)pbuf)[i + j]); printf("\n"); } /* * strvis() and print if it looks like it is * zero-terminated. */ if (((char *)pbuf)[len - 1] == '\0' && strlen(pbuf) == (unsigned)len - 1) { if (vblen < (len - 1) * 4 + 1) { if (visbuf != NULL) free(visbuf); vblen = (OFIOCMAXVALUE + len) * 4 + 1; if ((visbuf = malloc(vblen)) == NULL) err(EX_OSERR, "malloc() failed"); } vlen = strvis(visbuf, pbuf, VIS_TAB | VIS_NL); for (i = 0; i < vlen; i += CHARSPERLINE) { ofw_indent(level * LVLINDENT + DUMPINDENT); strlcpy(printbuf, &visbuf[i], sizeof(printbuf)); printf("'%s'\n", printbuf); } } } } static void ofw_dump_node(int fd, phandle_t n, int level, int rec, int prop, const char *pmatch, int raw, int str) { static void *nbuf = NULL; static int nblen = 0; int plen; phandle_t c; if (!(raw || str)) { ofw_indent(level * LVLINDENT); printf("Node %#lx", (unsigned long)n); plen = ofw_getprop_alloc(fd, n, "name", &nbuf, &nblen, 1); if (plen > 0) printf(": %.*s\n", (int)plen, (char *)nbuf); else putchar('\n'); } if (prop) { if (pmatch) ofw_dump_property(fd, n, level, pmatch, raw, str); else ofw_dump_properties(fd, n, level, raw, str); } if (rec) { for (c = ofw_child(fd, n); c != 0; c = ofw_peer(fd, c)) { ofw_dump_node(fd, c, level + 1, rec, prop, pmatch, raw, str); } } } static void ofw_dump(int fd, const char *start, int rec, int prop, const char *pmatch, int raw, int str) { phandle_t n; n = start == NULL ? ofw_root(fd) : ofw_finddevice(fd, start); ofw_dump_node(fd, n, 0, rec, prop, pmatch, raw, str); }
TigerBSD/TigerBSD
FreeBSD/usr.sbin/ofwdump/ofwdump.c
C
isc
6,219
[ 30522, 1013, 1008, 1011, 1008, 9385, 1006, 1039, 1007, 2526, 2011, 2726, 22078, 3367, 2140, 1026, 1056, 7382, 1030, 2489, 5910, 2094, 1012, 8917, 1028, 1012, 1008, 2035, 2916, 9235, 1012, 1008, 1008, 25707, 1998, 2224, 1999, 3120, 1998, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* Copyright 2014 The Kubernetes Authors All rights reserved. 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 master import ( "bytes" "encoding/json" "errors" "fmt" "io/ioutil" "net" "net/http" "net/http/httptest" "os" "path/filepath" "reflect" "strings" "testing" "time" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/latest" "k8s.io/kubernetes/pkg/api/meta" "k8s.io/kubernetes/pkg/api/testapi" "k8s.io/kubernetes/pkg/api/unversioned" apiutil "k8s.io/kubernetes/pkg/api/util" "k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/apis/experimental" "k8s.io/kubernetes/pkg/apiserver" client "k8s.io/kubernetes/pkg/client/unversioned" "k8s.io/kubernetes/pkg/fields" "k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/registry/endpoint" "k8s.io/kubernetes/pkg/registry/namespace" "k8s.io/kubernetes/pkg/registry/registrytest" thirdpartyresourcedatastorage "k8s.io/kubernetes/pkg/registry/thirdpartyresourcedata/etcd" etcdstorage "k8s.io/kubernetes/pkg/storage/etcd" "k8s.io/kubernetes/pkg/tools" "k8s.io/kubernetes/pkg/tools/etcdtest" "k8s.io/kubernetes/pkg/util" "github.com/coreos/go-etcd/etcd" "github.com/emicklei/go-restful" "github.com/stretchr/testify/assert" ) // setUp is a convience function for setting up for (most) tests. func setUp(t *testing.T) (Master, Config, *assert.Assertions) { master := Master{} config := Config{} fakeClient := tools.NewFakeEtcdClient(t) fakeClient.Machines = []string{"http://machine1:4001", "http://machine2", "http://machine3:4003"} storageVersions := make(map[string]string) config.DatabaseStorage = etcdstorage.NewEtcdStorage(fakeClient, testapi.Default.Codec(), etcdtest.PathPrefix()) storageVersions[""] = testapi.Default.Version() config.ExpDatabaseStorage = etcdstorage.NewEtcdStorage(fakeClient, testapi.Experimental.Codec(), etcdtest.PathPrefix()) storageVersions["experimental"] = testapi.Experimental.GroupAndVersion() config.StorageVersions = storageVersions master.nodeRegistry = registrytest.NewNodeRegistry([]string{"node1", "node2"}, api.NodeResources{}) return master, config, assert.New(t) } // TestNew verifies that the New function returns a Master // using the configuration properly. func TestNew(t *testing.T) { _, config, assert := setUp(t) config.KubeletClient = client.FakeKubeletClient{} master := New(&config) // Verify many of the variables match their config counterparts assert.Equal(master.enableCoreControllers, config.EnableCoreControllers) assert.Equal(master.enableLogsSupport, config.EnableLogsSupport) assert.Equal(master.enableUISupport, config.EnableUISupport) assert.Equal(master.enableSwaggerSupport, config.EnableSwaggerSupport) assert.Equal(master.enableSwaggerSupport, config.EnableSwaggerSupport) assert.Equal(master.enableProfiling, config.EnableProfiling) assert.Equal(master.apiPrefix, config.APIPrefix) assert.Equal(master.apiGroupPrefix, config.APIGroupPrefix) assert.Equal(master.corsAllowedOriginList, config.CorsAllowedOriginList) assert.Equal(master.authenticator, config.Authenticator) assert.Equal(master.authorizer, config.Authorizer) assert.Equal(master.admissionControl, config.AdmissionControl) assert.Equal(master.v1, !config.DisableV1) assert.Equal(master.exp, config.EnableExp) assert.Equal(master.requestContextMapper, config.RequestContextMapper) assert.Equal(master.cacheTimeout, config.CacheTimeout) assert.Equal(master.masterCount, config.MasterCount) assert.Equal(master.externalHost, config.ExternalHost) assert.Equal(master.clusterIP, config.PublicAddress) assert.Equal(master.publicReadWritePort, config.ReadWritePort) assert.Equal(master.serviceReadWriteIP, config.ServiceReadWriteIP) assert.Equal(master.installSSHKey, config.InstallSSHKey) } // TestNewEtcdStorage verifies that the usage of NewEtcdStorage reacts properly when // the correct data is input func TestNewEtcdStorage(t *testing.T) { assert := assert.New(t) fakeClient := tools.NewFakeEtcdClient(t) // Pass case _, err := NewEtcdStorage(fakeClient, latest.GroupOrDie("").InterfacesFor, testapi.Default.Version(), etcdtest.PathPrefix()) assert.NoError(err, "Unable to create etcdstorage: %s", err) // Fail case errorFunc := func(apiVersion string) (*meta.VersionInterfaces, error) { return nil, errors.New("ERROR") } _, err = NewEtcdStorage(fakeClient, errorFunc, testapi.Default.Version(), etcdtest.PathPrefix()) assert.Error(err, "NewEtcdStorage should have failed") } // TestGetServersToValidate verifies the unexported getServersToValidate function func TestGetServersToValidate(t *testing.T) { master, config, assert := setUp(t) servers := master.getServersToValidate(&config) assert.Equal(5, len(servers), "unexpected server list: %#v", servers) for _, server := range []string{"scheduler", "controller-manager", "etcd-0", "etcd-1", "etcd-2"} { if _, ok := servers[server]; !ok { t.Errorf("server list missing: %s", server) } } } // TestFindExternalAddress verifies both pass and fail cases for the unexported // findExternalAddress function func TestFindExternalAddress(t *testing.T) { assert := assert.New(t) expectedIP := "172.0.0.1" nodes := []*api.Node{new(api.Node), new(api.Node), new(api.Node)} nodes[0].Status.Addresses = []api.NodeAddress{{"ExternalIP", expectedIP}} nodes[1].Status.Addresses = []api.NodeAddress{{"LegacyHostIP", expectedIP}} nodes[2].Status.Addresses = []api.NodeAddress{{"ExternalIP", expectedIP}, {"LegacyHostIP", "172.0.0.2"}} // Pass Case for _, node := range nodes { ip, err := findExternalAddress(node) assert.NoError(err, "error getting node external address") assert.Equal(expectedIP, ip, "expected ip to be %s, but was %s", expectedIP, ip) } // Fail case _, err := findExternalAddress(new(api.Node)) assert.Error(err, "expected findExternalAddress to fail on a node with missing ip information") } // TestApi_v1 verifies that the unexported api_v1 function does indeed // utilize the correct Version and Codec. func TestApi_v1(t *testing.T) { master, _, assert := setUp(t) version := master.api_v1() assert.Equal("v1", version.Version, "Version was not v1: %s", version.Version) assert.Equal(v1.Codec, version.Codec, "version.Codec was not for v1: %s", version.Codec) for k, v := range master.storage { assert.Contains(version.Storage, v, "Value %s not found (key: %s)", k, v) } } // TestNewBootstrapController verifies master fields are properly copied into controller func TestNewBootstrapController(t *testing.T) { // Tests a subset of inputs to ensure they are set properly in the controller master, _, assert := setUp(t) portRange := util.PortRange{Base: 10, Size: 10} master.namespaceRegistry = namespace.NewRegistry(nil) master.serviceRegistry = registrytest.NewServiceRegistry() master.endpointRegistry = endpoint.NewRegistry(nil) master.serviceNodePortRange = portRange master.masterCount = 1 master.serviceReadWritePort = 1000 master.publicReadWritePort = 1010 controller := master.NewBootstrapController() assert.Equal(controller.NamespaceRegistry, master.namespaceRegistry) assert.Equal(controller.EndpointRegistry, master.endpointRegistry) assert.Equal(controller.ServiceRegistry, master.serviceRegistry) assert.Equal(controller.ServiceNodePortRange, portRange) assert.Equal(controller.MasterCount, master.masterCount) assert.Equal(controller.ServicePort, master.serviceReadWritePort) assert.Equal(controller.PublicServicePort, master.publicReadWritePort) } // TestNewHandlerContainer verifies that NewHandlerContainer uses the // mux provided func TestNewHandlerContainer(t *testing.T) { assert := assert.New(t) mux := http.NewServeMux() container := NewHandlerContainer(mux) assert.Equal(mux, container.ServeMux, "ServerMux's do not match") } // TestHandleWithAuth verifies HandleWithAuth adds the path // to the muxHelper.RegisteredPaths. func TestHandleWithAuth(t *testing.T) { master, _, assert := setUp(t) mh := apiserver.MuxHelper{Mux: http.NewServeMux()} master.muxHelper = &mh handler := func(r http.ResponseWriter, w *http.Request) { w.Write(nil) } master.HandleWithAuth("/test", http.HandlerFunc(handler)) assert.Contains(master.muxHelper.RegisteredPaths, "/test", "Path not found in muxHelper") } // TestHandleFuncWithAuth verifies HandleFuncWithAuth adds the path // to the muxHelper.RegisteredPaths. func TestHandleFuncWithAuth(t *testing.T) { master, _, assert := setUp(t) mh := apiserver.MuxHelper{Mux: http.NewServeMux()} master.muxHelper = &mh handler := func(r http.ResponseWriter, w *http.Request) { w.Write(nil) } master.HandleFuncWithAuth("/test", handler) assert.Contains(master.muxHelper.RegisteredPaths, "/test", "Path not found in muxHelper") } // TestInstallSwaggerAPI verifies that the swagger api is added // at the proper endpoint. func TestInstallSwaggerAPI(t *testing.T) { master, _, assert := setUp(t) mux := http.NewServeMux() master.handlerContainer = NewHandlerContainer(mux) // Ensure swagger isn't installed without the call ws := master.handlerContainer.RegisteredWebServices() if !assert.Equal(len(ws), 0) { for x := range ws { assert.NotEqual("/swaggerapi", ws[x].RootPath(), "SwaggerAPI was installed without a call to InstallSwaggerAPI()") } } // Install swagger and test master.InstallSwaggerAPI() ws = master.handlerContainer.RegisteredWebServices() if assert.NotEqual(0, len(ws), "SwaggerAPI not installed.") { assert.Equal("/swaggerapi/", ws[0].RootPath(), "SwaggerAPI did not install to the proper path. %s != /swaggerapi", ws[0].RootPath()) } // Empty externalHost verification mux = http.NewServeMux() master.handlerContainer = NewHandlerContainer(mux) master.externalHost = "" master.clusterIP = net.IPv4(10, 10, 10, 10) master.publicReadWritePort = 1010 master.InstallSwaggerAPI() if assert.NotEqual(0, len(ws), "SwaggerAPI not installed.") { assert.Equal("/swaggerapi/", ws[0].RootPath(), "SwaggerAPI did not install to the proper path. %s != /swaggerapi", ws[0].RootPath()) } } // TestDefaultAPIGroupVersion verifies that the unexported defaultAPIGroupVersion // creates the expected APIGroupVersion based off of master. func TestDefaultAPIGroupVersion(t *testing.T) { master, _, assert := setUp(t) master.dialer = func(network, addr string) (net.Conn, error) { return nil, nil } apiGroup := master.defaultAPIGroupVersion() assert.Equal(apiGroup.Root, master.apiPrefix) assert.Equal(apiGroup.Admit, master.admissionControl) assert.Equal(apiGroup.Context, master.requestContextMapper) assert.Equal(apiGroup.MinRequestTimeout, master.minRequestTimeout) // These functions should be different instances of the same function groupDialerFunc := fmt.Sprintf("%+v", apiGroup.ProxyDialerFn) masterDialerFunc := fmt.Sprintf("%+v", master.dialer) assert.Equal(groupDialerFunc, masterDialerFunc) } // TestExpapi verifies that the unexported exapi creates // the an experimental api APIGroupVersion. func TestExpapi(t *testing.T) { master, config, assert := setUp(t) expAPIGroup := master.experimental(&config) assert.Equal(expAPIGroup.Root, master.apiGroupPrefix) assert.Equal(expAPIGroup.Mapper, latest.GroupOrDie("experimental").RESTMapper) assert.Equal(expAPIGroup.Codec, latest.GroupOrDie("experimental").Codec) assert.Equal(expAPIGroup.Linker, latest.GroupOrDie("experimental").SelfLinker) assert.Equal(expAPIGroup.Version, latest.GroupOrDie("experimental").GroupVersion) } // TestSecondsSinceSync verifies that proper results are returned // when checking the time between syncs func TestSecondsSinceSync(t *testing.T) { master, _, assert := setUp(t) master.lastSync = time.Date(2015, time.January, 1, 1, 1, 1, 1, time.UTC).Unix() // Nano Second. No difference. master.clock = &util.FakeClock{Time: time.Date(2015, time.January, 1, 1, 1, 1, 2, time.UTC)} assert.Equal(int64(0), master.secondsSinceSync()) // Second master.clock = &util.FakeClock{Time: time.Date(2015, time.January, 1, 1, 1, 2, 1, time.UTC)} assert.Equal(int64(1), master.secondsSinceSync()) // Minute master.clock = &util.FakeClock{Time: time.Date(2015, time.January, 1, 1, 2, 1, 1, time.UTC)} assert.Equal(int64(60), master.secondsSinceSync()) // Hour master.clock = &util.FakeClock{Time: time.Date(2015, time.January, 1, 2, 1, 1, 1, time.UTC)} assert.Equal(int64(3600), master.secondsSinceSync()) // Day master.clock = &util.FakeClock{Time: time.Date(2015, time.January, 2, 1, 1, 1, 1, time.UTC)} assert.Equal(int64(86400), master.secondsSinceSync()) // Month master.clock = &util.FakeClock{Time: time.Date(2015, time.February, 1, 1, 1, 1, 1, time.UTC)} assert.Equal(int64(2678400), master.secondsSinceSync()) // Future Month. Should be -Month. master.lastSync = time.Date(2015, time.February, 1, 1, 1, 1, 1, time.UTC).Unix() master.clock = &util.FakeClock{Time: time.Date(2015, time.January, 1, 1, 1, 1, 1, time.UTC)} assert.Equal(int64(-2678400), master.secondsSinceSync()) } // TestGetNodeAddresses verifies that proper results are returned // when requesting node addresses. func TestGetNodeAddresses(t *testing.T) { master, _, assert := setUp(t) // Fail case (no addresses associated with nodes) nodes, _ := master.nodeRegistry.ListNodes(api.NewDefaultContext(), labels.Everything(), fields.Everything()) addrs, err := master.getNodeAddresses() assert.Error(err, "getNodeAddresses should have caused an error as there are no addresses.") assert.Equal([]string(nil), addrs) // Pass case with External type IP nodes, _ = master.nodeRegistry.ListNodes(api.NewDefaultContext(), labels.Everything(), fields.Everything()) for index := range nodes.Items { nodes.Items[index].Status.Addresses = []api.NodeAddress{{Type: api.NodeExternalIP, Address: "127.0.0.1"}} } addrs, err = master.getNodeAddresses() assert.NoError(err, "getNodeAddresses should not have returned an error.") assert.Equal([]string{"127.0.0.1", "127.0.0.1"}, addrs) // Pass case with LegacyHost type IP nodes, _ = master.nodeRegistry.ListNodes(api.NewDefaultContext(), labels.Everything(), fields.Everything()) for index := range nodes.Items { nodes.Items[index].Status.Addresses = []api.NodeAddress{{Type: api.NodeLegacyHostIP, Address: "127.0.0.2"}} } addrs, err = master.getNodeAddresses() assert.NoError(err, "getNodeAddresses failback should not have returned an error.") assert.Equal([]string{"127.0.0.2", "127.0.0.2"}, addrs) } // TestRefreshTunnels verifies that the function errors when no addresses // are associated with nodes func TestRefreshTunnels(t *testing.T) { master, _, assert := setUp(t) // Fail case (no addresses associated with nodes) assert.Error(master.refreshTunnels("test", "/tmp/undefined")) // TODO: pass case without needing actual connections? } // TestIsTunnelSyncHealthy verifies that the 600 second lag test // is honored. func TestIsTunnelSyncHealthy(t *testing.T) { master, _, assert := setUp(t) // Pass case: 540 second lag master.lastSync = time.Date(2015, time.January, 1, 1, 1, 1, 1, time.UTC).Unix() master.clock = &util.FakeClock{Time: time.Date(2015, time.January, 1, 1, 9, 1, 1, time.UTC)} err := master.IsTunnelSyncHealthy(nil) assert.NoError(err, "IsTunnelSyncHealthy() should not have returned an error.") // Fail case: 720 second lag master.clock = &util.FakeClock{Time: time.Date(2015, time.January, 1, 1, 12, 1, 1, time.UTC)} err = master.IsTunnelSyncHealthy(nil) assert.Error(err, "IsTunnelSyncHealthy() should have returned an error.") } // generateTempFile creates a temporary file path func generateTempFilePath(prefix string) string { tmpPath, _ := filepath.Abs(fmt.Sprintf("%s/%s-%d", os.TempDir(), prefix, time.Now().Unix())) return tmpPath } // TestGenerateSSHKey verifies that SSH key generation does indeed // generate keys even with keys already exist. func TestGenerateSSHKey(t *testing.T) { master, _, assert := setUp(t) privateKey := generateTempFilePath("private") publicKey := generateTempFilePath("public") // Make sure we have no test keys laying around os.Remove(privateKey) os.Remove(publicKey) // Pass case: Sunny day case err := master.generateSSHKey("unused", privateKey, publicKey) assert.NoError(err, "generateSSHKey should not have retuend an error: %s", err) // Pass case: PrivateKey exists test case os.Remove(publicKey) err = master.generateSSHKey("unused", privateKey, publicKey) assert.NoError(err, "generateSSHKey should not have retuend an error: %s", err) // Pass case: PublicKey exists test case os.Remove(privateKey) err = master.generateSSHKey("unused", privateKey, publicKey) assert.NoError(err, "generateSSHKey should not have retuend an error: %s", err) // Make sure we have no test keys laying around os.Remove(privateKey) os.Remove(publicKey) // TODO: testing error cases where the file can not be removed? } func TestDiscoveryAtAPIS(t *testing.T) { master, config, assert := setUp(t) master.exp = true // ================= preparation for master.init() ====================== portRange := util.PortRange{Base: 10, Size: 10} master.serviceNodePortRange = portRange _, ipnet, err := net.ParseCIDR("192.168.1.1/24") if !assert.NoError(err) { t.Errorf("unexpected error: %v", err) } master.serviceClusterIPRange = ipnet mh := apiserver.MuxHelper{Mux: http.NewServeMux()} master.muxHelper = &mh master.rootWebService = new(restful.WebService) master.handlerContainer = restful.NewContainer() master.mux = http.NewServeMux() master.requestContextMapper = api.NewRequestContextMapper() // ======================= end of preparation =========================== master.init(&config) server := httptest.NewServer(master.handlerContainer.ServeMux) resp, err := http.Get(server.URL + "/apis") if !assert.NoError(err) { t.Errorf("unexpected error: %v", err) } assert.Equal(http.StatusOK, resp.StatusCode) groupList := api.APIGroupList{} assert.NoError(decodeResponse(resp, &groupList)) if err != nil { t.Fatalf("unexpected error: %v", err) } expectGroupName := "experimental" expectVersions := []api.GroupVersion{ { GroupVersion: testapi.Experimental.GroupAndVersion(), Version: testapi.Experimental.Version(), }, } expectPreferredVersion := api.GroupVersion{ GroupVersion: config.StorageVersions["experimental"], Version: apiutil.GetVersion(config.StorageVersions["experimental"]), } assert.Equal(expectGroupName, groupList.Groups[0].Name) assert.Equal(expectVersions, groupList.Groups[0].Versions) assert.Equal(expectPreferredVersion, groupList.Groups[0].PreferredVersion) } var versionsToTest = []string{"v1", "v3"} type Foo struct { unversioned.TypeMeta `json:",inline"` api.ObjectMeta `json:"metadata,omitempty" description:"standard object metadata"` SomeField string `json:"someField"` OtherField int `json:"otherField"` } type FooList struct { unversioned.TypeMeta `json:",inline"` unversioned.ListMeta `json:"metadata,omitempty" description:"standard list metadata; see http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata"` Items []Foo `json:"items"` } func initThirdParty(t *testing.T, version string) (*Master, *tools.FakeEtcdClient, *httptest.Server, *assert.Assertions) { master, _, assert := setUp(t) master.thirdPartyResources = map[string]*thirdpartyresourcedatastorage.REST{} api := &experimental.ThirdPartyResource{ ObjectMeta: api.ObjectMeta{ Name: "foo.company.com", }, Versions: []experimental.APIVersion{ { APIGroup: "group", Name: version, }, }, } master.handlerContainer = restful.NewContainer() fakeClient := tools.NewFakeEtcdClient(t) fakeClient.Machines = []string{"http://machine1:4001", "http://machine2", "http://machine3:4003"} master.thirdPartyStorage = etcdstorage.NewEtcdStorage(fakeClient, testapi.Experimental.Codec(), etcdtest.PathPrefix()) if !assert.NoError(master.InstallThirdPartyResource(api)) { t.FailNow() } server := httptest.NewServer(master.handlerContainer.ServeMux) return &master, fakeClient, server, assert } func TestInstallThirdPartyAPIList(t *testing.T) { for _, version := range versionsToTest { testInstallThirdPartyAPIListVersion(t, version) } } func testInstallThirdPartyAPIListVersion(t *testing.T, version string) { tests := []struct { items []Foo }{ {}, { items: []Foo{}, }, { items: []Foo{ { ObjectMeta: api.ObjectMeta{ Name: "test", }, TypeMeta: unversioned.TypeMeta{ Kind: "Foo", APIVersion: version, }, SomeField: "test field", OtherField: 10, }, { ObjectMeta: api.ObjectMeta{ Name: "bar", }, TypeMeta: unversioned.TypeMeta{ Kind: "Foo", APIVersion: version, }, SomeField: "test field another", OtherField: 20, }, }, }, } for _, test := range tests { _, fakeClient, server, assert := initThirdParty(t, version) defer server.Close() if test.items == nil { fakeClient.ExpectNotFoundGet(etcdtest.PathPrefix() + "/ThirdPartyResourceData/company.com/foos/default") } else { setupEtcdList(fakeClient, "/ThirdPartyResourceData/company.com/foos/default", test.items) } resp, err := http.Get(server.URL + "/apis/company.com/" + version + "/namespaces/default/foos") if !assert.NoError(err) { return } defer resp.Body.Close() assert.Equal(http.StatusOK, resp.StatusCode) data, err := ioutil.ReadAll(resp.Body) assert.NoError(err) list := FooList{} if err = json.Unmarshal(data, &list); err != nil { t.Errorf("unexpected error: %v", err) } if test.items == nil { if len(list.Items) != 0 { t.Errorf("expected no items, saw: %v", list.Items) } continue } if len(list.Items) != len(test.items) { t.Errorf("unexpected length: %d vs %d", len(list.Items), len(test.items)) continue } for ix := range list.Items { // Copy things that are set dynamically on the server expectedObj := test.items[ix] expectedObj.SelfLink = list.Items[ix].SelfLink expectedObj.Namespace = list.Items[ix].Namespace expectedObj.UID = list.Items[ix].UID expectedObj.CreationTimestamp = list.Items[ix].CreationTimestamp if !reflect.DeepEqual(list.Items[ix], expectedObj) { t.Errorf("expected:\n%#v\nsaw:\n%#v\n", expectedObj, list.Items[ix]) } } } } func encodeToThirdParty(name string, obj interface{}) ([]byte, error) { serial, err := json.Marshal(obj) if err != nil { return nil, err } thirdPartyData := experimental.ThirdPartyResourceData{ ObjectMeta: api.ObjectMeta{Name: name}, Data: serial, } return testapi.Experimental.Codec().Encode(&thirdPartyData) } func storeToEtcd(fakeClient *tools.FakeEtcdClient, path, name string, obj interface{}) error { data, err := encodeToThirdParty(name, obj) if err != nil { return err } _, err = fakeClient.Set(etcdtest.PathPrefix()+path, string(data), 0) return err } func setupEtcdList(fakeClient *tools.FakeEtcdClient, path string, list []Foo) error { resp := tools.EtcdResponseWithError{ R: &etcd.Response{ Node: &etcd.Node{}, }, } for _, obj := range list { data, err := encodeToThirdParty(obj.Name, obj) if err != nil { return err } resp.R.Node.Nodes = append(resp.R.Node.Nodes, &etcd.Node{Value: string(data)}) } fakeClient.Data[etcdtest.PathPrefix()+path] = resp return nil } func decodeResponse(resp *http.Response, obj interface{}) error { defer resp.Body.Close() data, err := ioutil.ReadAll(resp.Body) if err != nil { return err } if err := json.Unmarshal(data, obj); err != nil { return err } return nil } func TestInstallThirdPartyAPIGet(t *testing.T) { for _, version := range versionsToTest { testInstallThirdPartyAPIGetVersion(t, version) } } func testInstallThirdPartyAPIGetVersion(t *testing.T, version string) { _, fakeClient, server, assert := initThirdParty(t, version) defer server.Close() expectedObj := Foo{ ObjectMeta: api.ObjectMeta{ Name: "test", }, TypeMeta: unversioned.TypeMeta{ Kind: "Foo", APIVersion: version, }, SomeField: "test field", OtherField: 10, } if !assert.NoError(storeToEtcd(fakeClient, "/ThirdPartyResourceData/company.com/foos/default/test", "test", expectedObj)) { t.FailNow() return } resp, err := http.Get(server.URL + "/apis/company.com/" + version + "/namespaces/default/foos/test") if !assert.NoError(err) { return } assert.Equal(http.StatusOK, resp.StatusCode) item := Foo{} assert.NoError(decodeResponse(resp, &item)) if !assert.False(reflect.DeepEqual(item, expectedObj)) { t.Errorf("expected objects to not be equal:\n%v\nsaw:\n%v\n", expectedObj, item) } // Fill in data that the apiserver injects expectedObj.SelfLink = item.SelfLink if !assert.True(reflect.DeepEqual(item, expectedObj)) { t.Errorf("expected:\n%#v\nsaw:\n%#v\n", expectedObj, item) } } func TestInstallThirdPartyAPIPost(t *testing.T) { for _, version := range versionsToTest { testInstallThirdPartyAPIPostForVersion(t, version) } } func testInstallThirdPartyAPIPostForVersion(t *testing.T, version string) { _, fakeClient, server, assert := initThirdParty(t, version) defer server.Close() inputObj := Foo{ ObjectMeta: api.ObjectMeta{ Name: "test", }, TypeMeta: unversioned.TypeMeta{ Kind: "Foo", APIVersion: "company.com/" + version, }, SomeField: "test field", OtherField: 10, } data, err := json.Marshal(inputObj) if !assert.NoError(err) { return } resp, err := http.Post(server.URL+"/apis/company.com/"+version+"/namespaces/default/foos", "application/json", bytes.NewBuffer(data)) if !assert.NoError(err) { t.Errorf("unexpected error: %v", err) return } assert.Equal(http.StatusCreated, resp.StatusCode) item := Foo{} assert.NoError(decodeResponse(resp, &item)) // fill in fields set by the apiserver expectedObj := inputObj expectedObj.SelfLink = item.SelfLink expectedObj.Namespace = item.Namespace expectedObj.UID = item.UID expectedObj.CreationTimestamp = item.CreationTimestamp if !assert.True(reflect.DeepEqual(item, expectedObj)) { t.Errorf("expected:\n%v\nsaw:\n%v\n", expectedObj, item) } etcdResp, err := fakeClient.Get(etcdtest.PathPrefix()+"/ThirdPartyResourceData/company.com/foos/default/test", false, false) if !assert.NoError(err) { t.FailNow() } obj, err := testapi.Experimental.Codec().Decode([]byte(etcdResp.Node.Value)) if err != nil { t.Errorf("unexpected error: %v", err) } thirdPartyObj, ok := obj.(*experimental.ThirdPartyResourceData) if !ok { t.Errorf("unexpected object: %v", obj) } item = Foo{} assert.NoError(json.Unmarshal(thirdPartyObj.Data, &item)) if !assert.True(reflect.DeepEqual(item, inputObj)) { t.Errorf("expected:\n%v\nsaw:\n%v\n", inputObj, item) } } func TestInstallThirdPartyAPIDelete(t *testing.T) { for _, version := range versionsToTest { testInstallThirdPartyAPIDeleteVersion(t, version) } } func testInstallThirdPartyAPIDeleteVersion(t *testing.T, version string) { _, fakeClient, server, assert := initThirdParty(t, version) defer server.Close() expectedObj := Foo{ ObjectMeta: api.ObjectMeta{ Name: "test", Namespace: "default", }, TypeMeta: unversioned.TypeMeta{ Kind: "Foo", }, SomeField: "test field", OtherField: 10, } if !assert.NoError(storeToEtcd(fakeClient, "/ThirdPartyResourceData/company.com/foos/default/test", "test", expectedObj)) { t.FailNow() return } resp, err := http.Get(server.URL + "/apis/company.com/" + version + "/namespaces/default/foos/test") if !assert.NoError(err) { return } assert.Equal(http.StatusOK, resp.StatusCode) item := Foo{} assert.NoError(decodeResponse(resp, &item)) // Fill in fields set by the apiserver expectedObj.SelfLink = item.SelfLink expectedObj.Namespace = item.Namespace if !assert.True(reflect.DeepEqual(item, expectedObj)) { t.Errorf("expected:\n%v\nsaw:\n%v\n", expectedObj, item) } resp, err = httpDelete(server.URL + "/apis/company.com/" + version + "/namespaces/default/foos/test") if !assert.NoError(err) { return } assert.Equal(http.StatusOK, resp.StatusCode) resp, err = http.Get(server.URL + "/apis/company.com/" + version + "/namespaces/default/foos/test") if !assert.NoError(err) { return } assert.Equal(http.StatusNotFound, resp.StatusCode) expectDeletedKeys := []string{etcdtest.PathPrefix() + "/ThirdPartyResourceData/company.com/foos/default/test"} if !assert.True(reflect.DeepEqual(fakeClient.DeletedKeys, expectDeletedKeys)) { t.Errorf("unexpected deleted keys: %v", fakeClient.DeletedKeys) } } func httpDelete(url string) (*http.Response, error) { req, err := http.NewRequest("DELETE", url, nil) if err != nil { return nil, err } client := &http.Client{} return client.Do(req) } func TestInstallThirdPartyResourceRemove(t *testing.T) { for _, version := range versionsToTest { testInstallThirdPartyResourceRemove(t, version) } } func testInstallThirdPartyResourceRemove(t *testing.T, version string) { master, fakeClient, server, assert := initThirdParty(t, version) defer server.Close() expectedObj := Foo{ ObjectMeta: api.ObjectMeta{ Name: "test", }, TypeMeta: unversioned.TypeMeta{ Kind: "Foo", }, SomeField: "test field", OtherField: 10, } if !assert.NoError(storeToEtcd(fakeClient, "/ThirdPartyResourceData/company.com/foos/default/test", "test", expectedObj)) { t.FailNow() return } secondObj := expectedObj secondObj.Name = "bar" if !assert.NoError(storeToEtcd(fakeClient, "/ThirdPartyResourceData/company.com/foos/default/bar", "bar", secondObj)) { t.FailNow() return } setupEtcdList(fakeClient, "/ThirdPartyResourceData/company.com/foos/default", []Foo{expectedObj, secondObj}) resp, err := http.Get(server.URL + "/apis/company.com/" + version + "/namespaces/default/foos/test") if !assert.NoError(err) { t.FailNow() return } if resp.StatusCode != http.StatusOK { t.Errorf("unexpected status: %v", resp) } item := Foo{} if err := decodeResponse(resp, &item); err != nil { t.Errorf("unexpected error: %v", err) } // TODO: validate etcd set things here item.ObjectMeta = expectedObj.ObjectMeta if !assert.True(reflect.DeepEqual(item, expectedObj)) { t.Errorf("expected:\n%v\nsaw:\n%v\n", expectedObj, item) } path := makeThirdPartyPath("company.com") master.RemoveThirdPartyResource(path) resp, err = http.Get(server.URL + "/apis/company.com/" + version + "/namespaces/default/foos/test") if !assert.NoError(err) { return } if resp.StatusCode != http.StatusNotFound { t.Errorf("unexpected status: %v", resp) } expectDeletedKeys := []string{ etcdtest.PathPrefix() + "/ThirdPartyResourceData/company.com/foos/default/test", etcdtest.PathPrefix() + "/ThirdPartyResourceData/company.com/foos/default/bar", } if !assert.True(reflect.DeepEqual(fakeClient.DeletedKeys, expectDeletedKeys)) { t.Errorf("unexpected deleted keys: %v", fakeClient.DeletedKeys) } installed := master.ListThirdPartyResources() if len(installed) != 0 { t.Errorf("Resource(s) still installed: %v", installed) } services := master.handlerContainer.RegisteredWebServices() for ix := range services { if strings.HasPrefix(services[ix].RootPath(), "/apis/company.com") { t.Errorf("Web service still installed at %s: %#v", services[ix].RootPath(), services[ix]) } } }
chiefy/kubernetes
pkg/master/master_test.go
GO
apache-2.0
31,760
[ 30522, 1013, 1008, 9385, 2297, 1996, 13970, 5677, 7159, 2229, 6048, 2035, 2916, 9235, 1012, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 2017, 2089, 2025, 2224, 2023, 5371, 3272, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
require 'fileutils' require "bundler/setup" def run_guard Signal.trap("HUP") { exit } require 'guard' Guard.setup Guard::Dsl.evaluate_guardfile(:guardfile => 'Guardfile') Guard.start end guard_pid = fork { run_guard } sleep 2 Dir['{specs,source}/**/*'].each{ |f| FileUtils.touch(f) } sleep 2 Process.kill "HUP", guard_pid Process.wait( guard_pid ) `npm run-script minify`
moredip/snakes_in_a_browser
build.rb
Ruby
mit
391
[ 30522, 5478, 1005, 5371, 21823, 4877, 1005, 5478, 1000, 14012, 2099, 1013, 16437, 1000, 13366, 2448, 1035, 3457, 4742, 1012, 8132, 1006, 1000, 15876, 2361, 1000, 1007, 1063, 6164, 1065, 5478, 1005, 3457, 1005, 3457, 1012, 16437, 3457, 1024,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
'use strict'; angular.module('mean.settings').config(['$stateProvider', function($stateProvider) { var checkLoggedin = function($q, $timeout, $http, $location) { // Initialize a new promise var deferred = $q.defer(); // Make an AJAX call to check if the user is logged in $http.get('/loggedin').success(function(user) { // Authenticated if (user !== '0') $timeout(deferred.resolve); // Not Authenticated else { $timeout(deferred.reject); $location.url('/'); } }); return deferred.promise; }; $stateProvider.state('settings', { url: '/settings', templateUrl: 'settings/views/index.html', resolve: { loggedin: checkLoggedin } }); } ]);
indie-hackathon/dchat
packages/custom/settings/public/routes/settings.js
JavaScript
mit
787
[ 30522, 1005, 2224, 9384, 1005, 1025, 16108, 1012, 11336, 1006, 1005, 2812, 1012, 10906, 1005, 1007, 1012, 9530, 8873, 2290, 1006, 1031, 1005, 1002, 2110, 21572, 17258, 2121, 1005, 1010, 3853, 1006, 1002, 2110, 21572, 17258, 2121, 1007, 1063...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
use libc::size_t; // Helper struct that we'll use to give strings to C. #[repr(C)] pub struct RustByteSlice { pub bytes: *const u8, pub len: size_t, } impl<'a> From<&'a str> for RustByteSlice { fn from(s: &'a str) -> Self { RustByteSlice{ bytes: s.as_ptr(), len: s.len() as size_t, } } }
bignerdranch/rust-ios-app-part-3
rust/ownership_passing/src/strings.rs
Rust
mit
346
[ 30522, 2224, 5622, 9818, 1024, 1024, 2946, 1035, 1056, 1025, 1013, 1013, 2393, 2121, 2358, 6820, 6593, 2008, 2057, 1005, 2222, 2224, 2000, 2507, 7817, 2000, 1039, 1012, 1001, 1031, 16360, 2099, 1006, 1039, 1007, 1033, 9047, 2358, 6820, 65...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<md-content> <br> <md-toolbar> <div class="md-toolbar-tools"> <button md-button class="md-icon-button" aria-label="Settings" (click)="clicked('Menu')"> <i md-icon>menu</i> </button> <h2> <span>Toolbar with Icon Buttons</span> </h2> <span flex></span> <button md-button class="md-icon-button" aria-label="Favorite" (click)="clicked('Favorite')"> <i class="green" md-icon>favorite</i> </button> <button md-button class="md-icon-button" aria-label="More" (click)="clicked('Show More')"> <i md-icon>more_vert</i> </button> </div> </md-toolbar> <br> <md-toolbar> <div class="md-toolbar-tools"> <button md-button aria-label="Go Back"> Go Back </button> <h2> <span>Toolbar with Standard Buttons</span> </h2> <span flex></span> <button md-raised-button aria-label="Learn More" (click)="clicked('Learn More')"> Learn More </button> <button md-fab class="md-mini md-warn" aria-label="Favorite"> <i md-icon>favorite</i> </button> </div> </md-toolbar> <br> <md-toolbar class="md-tall md-accent"> <h2 class="md-toolbar-tools"> <span>Toolbar: tall (md-accent)</span> </h2> </md-toolbar> <br> <md-toolbar class="md-tall md-warn md-hue-3"> <span flex></span> <h2 class="md-toolbar-tools md-toolbar-tools-bottom"> <span class="md-flex">Toolbar: tall with actions pin to the bottom (md-warn md-hue-3)</span> </h2> </md-toolbar> </md-content>
adaojunior/md
example/toolbar/example.html
HTML
mit
1,811
[ 30522, 1026, 9108, 1011, 4180, 1028, 1026, 7987, 1028, 1026, 9108, 1011, 6994, 8237, 1028, 1026, 4487, 2615, 2465, 1027, 1000, 9108, 1011, 6994, 8237, 1011, 5906, 1000, 1028, 1026, 6462, 9108, 1011, 6462, 2465, 1027, 1000, 9108, 1011, 126...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
[?php $first = ($pager->getPage() * $pager->getMaxPerPage() - $pager->getMaxPerPage() + 1); $last = $first + $pager->getMaxPerPage() - 1; ?] <table id="sf_admin_pager"> <tbody> <tr> <td class="left"></td> <td class="center"> <table align="center" class="sf_admin_pagination"> <tbody> <tr> [?php if ($pager->haveToPaginate()): ?] <td class="button"> <a href="[?php echo url_for('@<?php echo $this->getUrlForAction('list') ?>?page=1') ?]"[?php if ($pager->getPage() == 1) echo ' class="ui-state-disabled"' ?]> <?php echo UIHelper::addIconByConf('first') ?> </a> </td> <td class="button"> <a href="[?php echo url_for('@<?php echo $this->getUrlForAction('list') ?>?page='.$pager->getPreviousPage()) ?]"[?php if ($pager->getPage() == 1) echo ' class="ui-state-disabled"' ?]> <?php echo UIHelper::addIconByConf('previous') ?> </a> </td> <td align="center"> [?php echo __('Page') ?] <form action="[?php echo url_for('@<?php echo $this->getUrlForAction('list') ?>') ?]" method="get"> <input type="text" name="page" value="[?php echo $pager->getPage() ?]" data-url="[?php echo url_for('@<?php echo $this->getUrlForAction('list') ?>') ?]" maxlength="7" size="2" /> </form> [?php echo __('of %1%', array('%1%' => $pager->getLastPage())) ?] </td> <td class="button"> <a href="[?php echo url_for('@<?php echo $this->getUrlForAction('list') ?>?page='.$pager->getNextPage()) ?]"[?php if ($pager->getPage() == $pager->getLastPage()) echo ' class="ui-state-disabled"' ?]> <?php echo UIHelper::addIconByConf('next') ?> </a> </td> <td class="button"> <a href="[?php echo url_for('@<?php echo $this->getUrlForAction('list') ?>?page='.$pager->getLastPage()) ?]"[?php if ($pager->getPage() == $pager->getLastPage()) echo ' class="ui-state-disabled"' ?]> <?php echo UIHelper::addIconByConf('last') ?> </a> </td> [?php endif; ?] </tr> </tbody> </table> </td> <td class="right"> [?php echo __('View %1% - %2% of %3%', array( '%1%' => $first, '%2%' => ($last > $pager->getNbResults()) ? $pager->getNbResults() : $last, '%3%' => $pager->getNbResults() ) ) ?] </td> </tr> </tbody> </table>
braindata/sfAdminThemejRollerPlugin
data/generator/sfDoctrineModule/jroller/template/templates/_pagination.php
PHP
mit
2,701
[ 30522, 1031, 1029, 25718, 1002, 2034, 1027, 1006, 1002, 3931, 2099, 1011, 1028, 2131, 13704, 1006, 1007, 1008, 1002, 3931, 2099, 1011, 1028, 30524, 17848, 4842, 13704, 1006, 1007, 1009, 1015, 1007, 1025, 1002, 2197, 1027, 1002, 2034, 1009, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#! python3 """ GUI for Ultrasonic Temperature Controller Copyright (c) 2015 by Stefan Lehmann """ import os import datetime import logging import json import serial from qtpy.QtWidgets import QAction, QDialog, QMainWindow, QMessageBox, \ QDockWidget, QLabel, QFileDialog, QApplication from qtpy.QtGui import QIcon from qtpy.QtCore import QSettings, QCoreApplication, Qt, QThread, \ Signal from serial.serialutil import SerialException from jsonwatch.jsonitem import JsonItem from jsonwatch.jsonnode import JsonNode from jsonwatchqt.logger import LoggingWidget from pyqtconfig.config import QSettingsManager from jsonwatchqt.plotsettings import PlotSettingsWidget from jsonwatchqt.objectexplorer import ObjectExplorer from jsonwatchqt.plotwidget import PlotWidget from jsonwatchqt.serialdialog import SerialDialog, PORT_SETTING, \ BAUDRATE_SETTING from jsonwatchqt.utilities import critical, pixmap from jsonwatchqt.recorder import RecordWidget from jsonwatchqt.csvsettings import CSVSettingsDialog, DECIMAL_SETTING, \ SEPARATOR_SETTING logger = logging.getLogger("jsonwatchqt.mainwindow") WINDOWSTATE_SETTING = "mainwindow/windowstate" GEOMETRY_SETTING = "mainwindow/geometry" FILENAME_SETTING = "mainwindow/filename" def strip(s): return s.strip() def utf8_to_bytearray(x): return bytearray(x, 'utf-8') def bytearray_to_utf8(x): return x.decode('utf-8') def set_default_settings(settings: QSettingsManager): settings.set_defaults({ DECIMAL_SETTING: ',', SEPARATOR_SETTING: ';' }) class SerialWorker(QThread): data_received = Signal(datetime.datetime, str) def __init__(self, ser: serial.Serial, parent=None): super().__init__(parent) self.serial = ser self._quit = False def run(self): while not self._quit: try: if self.serial.isOpen() and self.serial.inWaiting(): self.data_received.emit( datetime.datetime.now(), strip(bytearray_to_utf8(self.serial.readline())) ) except SerialException: pass def quit(self): self._quit = True class MainWindow(QMainWindow): def __init__(self, parent=None): super().__init__(parent) self.recording_enabled = False self.serial = serial.Serial() self.rootnode = JsonNode('') self._connected = False self._dirty = False self._filename = None # settings self.settings = QSettingsManager() set_default_settings(self.settings) # Controller Settings self.settingsDialog = None # object explorer self.objectexplorer = ObjectExplorer(self.rootnode, self) self.objectexplorer.nodevalue_changed.connect(self.send_serialdata) self.objectexplorer.nodeproperty_changed.connect(self.set_dirty) self.objectexplorerDockWidget = QDockWidget(self.tr("object explorer"), self) self.objectexplorerDockWidget.setObjectName( "objectexplorer_dockwidget") self.objectexplorerDockWidget.setWidget(self.objectexplorer) # plot widget self.plot = PlotWidget(self.rootnode, self.settings, self) # plot settings self.plotsettings = PlotSettingsWidget(self.settings, self.plot, self) self.plotsettingsDockWidget = QDockWidget(self.tr("plot settings"), self) self.plotsettingsDockWidget.setObjectName("plotsettings_dockwidget") self.plotsettingsDockWidget.setWidget(self.plotsettings) # log widget self.loggingWidget = LoggingWidget(self) self.loggingDockWidget = QDockWidget(self.tr("logger"), self) self.loggingDockWidget.setObjectName("logging_dockwidget") self.loggingDockWidget.setWidget(self.loggingWidget) # record widget self.recordWidget = RecordWidget(self.rootnode, self) self.recordDockWidget = QDockWidget(self.tr("data recording"), self) self.recordDockWidget.setObjectName("record_dockwidget") self.recordDockWidget.setWidget(self.recordWidget) # actions and menus self._init_actions() self._init_menus() # statusbar statusbar = self.statusBar() statusbar.setVisible(True) self.connectionstateLabel = QLabel(self.tr("Not connected")) statusbar.addPermanentWidget(self.connectionstateLabel) statusbar.showMessage(self.tr("Ready")) # layout self.setCentralWidget(self.plot) self.addDockWidget(Qt.LeftDockWidgetArea, self.objectexplorerDockWidget) self.addDockWidget(Qt.LeftDockWidgetArea, self.plotsettingsDockWidget) self.addDockWidget(Qt.BottomDockWidgetArea, self.loggingDockWidget) self.addDockWidget(Qt.BottomDockWidgetArea, self.recordDockWidget) self.load_settings() def _init_actions(self): # Serial Dialog self.serialdlgAction = QAction(self.tr("Serial Settings..."), self) self.serialdlgAction.setShortcut("F6") self.serialdlgAction.setIcon(QIcon(pixmap("configure.png"))) self.serialdlgAction.triggered.connect(self.show_serialdlg) # Connect self.connectAction = QAction(self.tr("Connect"), self) self.connectAction.setShortcut("F5") self.connectAction.setIcon(QIcon(pixmap("network-connect-3.png"))) self.connectAction.triggered.connect(self.toggle_connect) # Quit self.quitAction = QAction(self.tr("Quit"), self) self.quitAction.setShortcut("Alt+F4") self.quitAction.setIcon(QIcon(pixmap("window-close-3.png"))) self.quitAction.triggered.connect(self.close) # Save Config as self.saveasAction = QAction(self.tr("Save as..."), self) self.saveasAction.setShortcut("Ctrl+Shift+S") self.saveasAction.setIcon(QIcon(pixmap("document-save-as-5.png"))) self.saveasAction.triggered.connect(self.show_savecfg_dlg) # Save file self.saveAction = QAction(self.tr("Save"), self) self.saveAction.setShortcut("Ctrl+S") self.saveAction.setIcon(QIcon(pixmap("document-save-5.png"))) self.saveAction.triggered.connect(self.save_file) # Load file self.loadAction = QAction(self.tr("Open..."), self) self.loadAction.setShortcut("Ctrl+O") self.loadAction.setIcon(QIcon(pixmap("document-open-7.png"))) self.loadAction.triggered.connect(self.show_opencfg_dlg) # New self.newAction = QAction(self.tr("New"), self) self.newAction.setShortcut("Ctrl+N") self.newAction.setIcon(QIcon(pixmap("document-new-6.png"))) self.newAction.triggered.connect(self.new) # start recording self.startrecordingAction = QAction(self.tr("Start recording"), self) self.startrecordingAction.setShortcut("F9") self.startrecordingAction.setIcon(QIcon(pixmap("media-record-6.png"))) self.startrecordingAction.triggered.connect(self.start_recording) # stop recording self.stoprecordingAction = QAction(self.tr("Stop recording"), self) self.stoprecordingAction.setShortcut("F10") self.stoprecordingAction.setIcon(QIcon(pixmap("media-playback-stop-8.png"))) self.stoprecordingAction.setEnabled(False) self.stoprecordingAction.triggered.connect(self.stop_recording) # clear record self.clearrecordAction = QAction(self.tr("Clear"), self) self.clearrecordAction.setIcon(QIcon(pixmap("editclear.png"))) self.clearrecordAction.triggered.connect(self.clear_record) # export record self.exportcsvAction = QAction(self.tr("Export to csv..."), self) self.exportcsvAction.setIcon(QIcon(pixmap("text_csv.png"))) self.exportcsvAction.triggered.connect(self.export_csv) # show record settings self.recordsettingsAction = QAction(self.tr("Settings..."), self) self.recordsettingsAction.setIcon(QIcon(pixmap("configure.png"))) self.recordsettingsAction.triggered.connect(self.show_recordsettings) # Info self.infoAction = QAction(self.tr("Info"), self) self.infoAction.setShortcut("F1") self.infoAction.triggered.connect(self.show_info) def _init_menus(self): # file menu self.fileMenu = self.menuBar().addMenu(self.tr("File")) self.fileMenu.addAction(self.newAction) self.fileMenu.addAction(self.loadAction) self.fileMenu.addAction(self.saveAction) self.fileMenu.addAction(self.saveasAction) self.fileMenu.addSeparator() self.fileMenu.addAction(self.connectAction) self.fileMenu.addAction(self.serialdlgAction) self.fileMenu.addSeparator() self.fileMenu.addAction(self.quitAction) # view menu self.viewMenu = self.menuBar().addMenu(self.tr("View")) self.viewMenu.addAction( self.objectexplorerDockWidget.toggleViewAction()) self.viewMenu.addAction(self.plotsettingsDockWidget.toggleViewAction()) self.viewMenu.addAction(self.loggingDockWidget.toggleViewAction()) self.viewMenu.addAction(self.recordDockWidget.toggleViewAction()) # record menu self.recordMenu = self.menuBar().addMenu(self.tr("Record")) self.recordMenu.addAction(self.startrecordingAction) self.recordMenu.addAction(self.stoprecordingAction) self.recordMenu.addAction(self.exportcsvAction) self.recordMenu.addSeparator() self.recordMenu.addAction(self.clearrecordAction) self.recordMenu.addSeparator() self.recordMenu.addAction(self.recordsettingsAction) # info menu self.menuBar().addAction(self.infoAction) def show_info(self): QMessageBox.about( self, QApplication.applicationName(), "%s %s\n" "Copyright (c) by %s" % ( QCoreApplication.applicationName(), QCoreApplication.applicationVersion(), QCoreApplication.organizationName(), ) ) def load_file(self, filename): old_filename = self.filename if self.filename != filename else None self.filename = filename try: with open(filename, 'rb') as f: try: self.objectexplorer.model().beginResetModel() self.rootnode.load(bytearray_to_utf8(f.read())) self.objectexplorer.model().endResetModel() except ValueError as e: critical(self, "File '%s' is not a valid config file." % filename) logger.error(str(e)) if old_filename is not None: self.load_file(old_filename) else: self.filename = None except FileNotFoundError as e: logger.error(str(e)) self.filename = None self.objectexplorer.refresh() def load_settings(self): settings = QSettings() # window geometry try: self.restoreGeometry(settings.value(GEOMETRY_SETTING)) except: logger.debug("error restoring window geometry") # window state try: self.restoreState(settings.value(WINDOWSTATE_SETTING)) except: logger.debug("error restoring window state") # filename self.filename = settings.value(FILENAME_SETTING) if self.filename is not None: self.load_file(self.filename) def save_settings(self): settings = QSettings() settings.setValue(WINDOWSTATE_SETTING, self.saveState()) settings.setValue(GEOMETRY_SETTING, self.saveGeometry()) settings.setValue(FILENAME_SETTING, self.filename) def closeEvent(self, event): if self.dirty: res = QMessageBox.question( self, QCoreApplication.applicationName(), self.tr("Save changes to file '%s'?" % self.filename if self.filename is not None else "unknown"), QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel ) if res == QMessageBox.Cancel: event.ignore() return elif res == QMessageBox.Yes: self.save_file() self.save_settings() try: self.worker.quit() except AttributeError: pass try: self.serial.close() except (SerialException, AttributeError): pass def new(self): self.objectexplorer.model().beginResetModel() self.rootnode.clear() self.objectexplorer.model().endResetModel() def send_reset(self): jsonstring = json.dumps({"resetpid": 1}) self.serial.write(bytearray(jsonstring, 'utf-8')) def receive_serialdata(self, time, data): self.loggingWidget.log_input(data) try: self.rootnode.from_json(data) except ValueError as e: logger.error(str(e)) # refresh widgets self.objectexplorer.refresh() self.plot.refresh(time) if self.recording_enabled: self.recordWidget.add_data(time, self.rootnode) def send_serialdata(self, node): if isinstance(node, JsonItem): if self.serial.isOpen(): s = node.to_json() self.serial.write(utf8_to_bytearray(s + '\n')) self.loggingWidget.log_output(s.strip()) def show_serialdlg(self): dlg = SerialDialog(self.settings, self) dlg.exec_() def toggle_connect(self): if self.serial.isOpen(): self.disconnect() else: self.connect() def connect(self): # Load port setting port = self.settings.get(PORT_SETTING) baudrate = self.settings.get(BAUDRATE_SETTING) # If no port has been selected before show serial settings dialog if port is None: if self.show_serialdlg() == QDialog.Rejected: return port = self.settings.get(PORT_SETTING) baudrate = self.settings.get(BAUDRATE_SETTING) # Serial connection try: self.serial.port = port self.serial.baudrate = baudrate self.serial.open() except ValueError: QMessageBox.critical( self, QCoreApplication.applicationName(), self.tr("Serial parameters e.g. baudrate, databits are out " "of range.") ) except SerialException: QMessageBox.critical( self, QCoreApplication.applicationName(), self.tr("The device '%s' can not be found or can not be " "configured." % port) ) else: self.worker = SerialWorker(self.serial, self) self.worker.data_received.connect(self.receive_serialdata) self.worker.start() self.connectAction.setText(self.tr("Disconnect")) self.connectAction.setIcon(QIcon(pixmap("network-disconnect-3.png"))) self.serialdlgAction.setEnabled(False) self.connectionstateLabel.setText( self.tr("Connected to %s") % port) self._connected = True self.objectexplorer.refresh() def disconnect(self): self.worker.quit() self.serial.close() self.connectAction.setText(self.tr("Connect")) self.connectAction.setIcon(QIcon(pixmap("network-connect-3.png"))) self.serialdlgAction.setEnabled(True) self.connectionstateLabel.setText(self.tr("Not connected")) self._connected = False self.objectexplorer.refresh() def show_savecfg_dlg(self): filename, _ = QFileDialog.getSaveFileName( self, self.tr("Save configuration file..."), directory=os.path.expanduser("~"), filter="Json file (*.json)" ) if filename: self.filename = filename self.save_file() def save_file(self): if self.filename is not None: config_string = self.rootnode.dump() with open(self.filename, 'w') as f: f.write(config_string) self.dirty = False else: self.show_savecfg_dlg() def show_opencfg_dlg(self): # show file dialog filename, _ = QFileDialog.getOpenFileName( self, self.tr("Open configuration file..."), directory=os.path.expanduser("~"), filter=self.tr("Json file (*.json);;All files (*.*)") ) # load config file if filename: self.load_file(filename) def refresh_window_title(self): s = "%s %s" % (QCoreApplication.applicationName(), QCoreApplication.applicationVersion()) if self.filename is not None: s += " - " + self.filename if self.dirty: s += "*" self.setWindowTitle(s) def start_recording(self): self.recording_enabled = True self.startrecordingAction.setEnabled(False) self.stoprecordingAction.setEnabled(True) def stop_recording(self): self.recording_enabled = False self.startrecordingAction.setEnabled(True) self.stoprecordingAction.setEnabled(False) def export_csv(self): filename, _ = QFileDialog.getSaveFileName( self, QCoreApplication.applicationName(), filter="CSV files(*.csv);;All files (*.*)" ) if filename == "": return # get current dataframe and export to csv df = self.recordWidget.dataframe decimal = self.settings.get(DECIMAL_SETTING) df = df.applymap(lambda x: str(x).replace(".", decimal)) df.to_csv( filename, index_label="time", sep=self.settings.get(SEPARATOR_SETTING) ) def clear_record(self): self.recordWidget.clear() def show_recordsettings(self): dlg = CSVSettingsDialog(self) dlg.exec_() # filename property @property def filename(self): return self._filename @filename.setter def filename(self, value=""): self._filename = value self.refresh_window_title() # dirty property @property def dirty(self): return self._dirty @dirty.setter def dirty(self, value): self._dirty = value self.refresh_window_title() def set_dirty(self): self.dirty = True # connected property @property def connected(self): return self._connected
MrLeeh/jsonwatchqt
jsonwatchqt/mainwindow.py
Python
mit
19,071
[ 30522, 1001, 999, 18750, 2509, 1000, 1000, 1000, 26458, 2005, 11087, 18585, 4860, 11486, 9385, 1006, 1039, 1007, 2325, 2011, 8852, 28444, 2078, 1000, 1000, 1000, 12324, 9808, 12324, 3058, 7292, 12324, 15899, 12324, 1046, 3385, 12324, 7642, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* Copyright (c) 2012 Richard Klancer <rpk@pobox.com> 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. */ /*global $ console */ var x = 0, y = 0, intervalID, INTERVAL_LENGTH = 200; // ms // define console as a noop if not defined if (typeof console === 'undefined') console = { log: function() {} }; function postJoystickPosition() { $.post('/joystick', { x: x, y: y }); } function startSending() { intervalID = setInterval(postJoystickPosition, INTERVAL_LENGTH); } function stopSending() { // one last time postJoystickPosition(); clearInterval(intervalID); } // draws "joystick", updates x and y function joystickGo() { // Just do the dead simplest thing right now -- we have one draggable element, and no encapsulation var dragInfo = {}, centerX, centerY, radialLimit, radialLimitSquared; function updatePosition(_x, _y) { x = _x / radialLimit; y = - _y / radialLimit; console.log(x,y); } function centerKnob() { var $el = $(dragInfo.element), width = $('#background').width(); $el.animate({ left: width/2, top: width/2 }, 200); updatePosition(0, 0); } function dragStart(evt) { dragInfo.dragging = true; evt.preventDefault(); var $el = $(dragInfo.element), offset = $el.offset(), width = $el.width(), cx = offset.left + width/2 - centerX, cy = offset.top + width/2 - centerY; dragInfo.dx = evt.pageX - cx; dragInfo.dy = evt.pageY - cy; startSending(); } function drag(evt) { if ( ! dragInfo.dragging ) return; evt.preventDefault(); var $el = $(dragInfo.element), offset = $el.offset(), width = $el.width(), // find the current center of the element cx = offset.left + width/2 - centerX, cy = offset.top + width/2 - centerY, newcx = evt.pageX - dragInfo.dx, newcy = evt.pageY - dragInfo.dy, newRadiusSquared = newcx*newcx + newcy*newcy, scale; if (newRadiusSquared > radialLimitSquared) { scale = Math.sqrt( radialLimitSquared / newRadiusSquared ); newcx *= scale; newcy *= scale; } updatePosition(newcx, newcy); offset.left += (newcx - cx); offset.top += (newcy - cy); $(dragInfo.element).offset(offset); } function dragEnd() { dragInfo.dragging = false; centerKnob(); stopSending(); } function adjustDimensions() { var $background = $('#background'), $knob = $('#knob'), offset = $background.offset(), width = $background.width(); makeCircular($background); makeCircular($knob); centerX = width/2 + offset.left; centerY = width/2 + offset.top; radialLimit = (width - $knob.width()) / 2; radialLimitSquared = radialLimit * radialLimit; } function makeCircular($el) { var width = $el.width(); // Android 2 browser doesn't seem to understand percentage border-radius, so we need to set it // via an inline style once we know the width $el.css({ height: width, borderRadius: width/2 }); } function wrapForTouch(f) { return function(evt) { if (evt.originalEvent && evt.originalEvent.touches && evt.originalEvent.touches.length === 1) { evt.pageX = evt.originalEvent.touches[0].pageX; evt.pageY = evt.originalEvent.touches[0].pageY; } return f(evt); }; } $(function() { var $background = $('#background'), $knob = $('#knob'); adjustDimensions(); dragInfo.element = $knob[0]; $knob.bind('touchstart mousedown', wrapForTouch(dragStart)); $(document).bind('touchmove mousemove', wrapForTouch(drag)); $(document).bind('touchend mouseup', wrapForTouch(dragEnd)); $background.bind('mousedown', function() { return false; }); $(window).bind('resize', adjustDimensions); }); } // and...go: joystickGo();
rascalmicro/control-freak
public/static/js/joystick.js
JavaScript
gpl-3.0
4,902
[ 30522, 1013, 1008, 9385, 1006, 1039, 1007, 2262, 2957, 26613, 17119, 1026, 1054, 2361, 2243, 1030, 13433, 8758, 1012, 4012, 1028, 6656, 2003, 2182, 3762, 4379, 1010, 2489, 1997, 3715, 1010, 2000, 2151, 2711, 11381, 1037, 6100, 1997, 2023, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#!/usr/bin/env python # -*- coding: utf8 -*- # ***************************************************************** # ** PTS -- Python Toolkit for working with SKIRT ** # ** © Astronomical Observatory, Ghent University ** # ***************************************************************** ## \package pts.core.tools.special Special functions. # ----------------------------------------------------------------- # Ensure Python 3 compatibility from __future__ import absolute_import, division, print_function # Import standard modules import numpy as np # Import the relevant PTS classes and modules from ...magic.core.frame import Frame from ..basics.remote import Remote, connected_remotes from . import time from . import filesystem as fs from .logging import log # ----------------------------------------------------------------- def remote_convolution(image, kernel, host_id): """ This function ... :param image: :param kernel: :param host_id: """ # Check whether we are already connected to the specified remote host if host_id in connected_remotes and connected_remotes[host_id] is not None: remote = connected_remotes[host_id] else: # Debugging log.debug("Logging in to remote host ...") # Create a remote instance for the specified host ID remote = Remote() remote.setup(host_id) # Debugging log.debug("Creating temporary directory remotely ...") # Create a temporary directory to do the convolution remote_home_directory = remote.home_directory remote_temp_path = fs.join(remote_home_directory, time.unique_name("convolution")) remote.create_directory(remote_temp_path) # Debugging #log.debug("Uploading the kernel to the remote directory ...") # Upload the kernel FITS file to the remote directory #remote_kernel_path = fs.join(remote_temp_path, "kernel.fits") #remote.upload(kernel_path, remote_temp_path, new_name="kernel.fits", compress=True, show_output=True) # Debugging log.debug("Creating a local temporary directory ...") # Create a temporary directory locally to contain the frames local_temp_path = fs.join(fs.home(), time.unique_name("convolution")) fs.create_directory(local_temp_path) # Debugging log.debug("Saving the image frames to the temporary directory ...") # Save the frames local_frame_paths = [] constant_frames = [] for frame_name in image.frames: frame_path = fs.join(local_temp_path, frame_name + ".fits") # Only upload and convolve non-constant frames if not image.frames[frame_name].is_constant(): image.frames[frame_name].save(frame_path) local_frame_paths.append(frame_path) else: log.debug("The " + frame_name + " frame is constant, so this won't be uploaded and convolved") constant_frames.append(frame_name) # Debugging log.debug("Saving the kernel to the temporary directory ...") local_kernel_path = fs.join(local_temp_path, "kernel.fits") kernel.save(local_kernel_path) # Debugging log.debug("Uploading the image frames to the remote directory ...") # Upload the frames remote_frame_paths = [] for local_frame_path in local_frame_paths: # Determine the name of the local frame file frame_file_name = fs.name(local_frame_path) # Debugging log.debug("Uploading the " + fs.strip_extension(frame_file_name) + " frame ...") # Upload the frame file remote_frame_path = fs.join(remote_temp_path, frame_file_name) remote.upload(local_frame_path, remote_temp_path, new_name=frame_file_name, compress=True, show_output=True) remote_frame_paths.append(remote_frame_path) # Debugging log.debug("Uploading the kernel to the remote directory ...") # Upload the kernel remote_kernel_path = fs.join(remote_temp_path, "kernel.fits") remote.upload(local_kernel_path, remote_temp_path, new_name="kernel.fits", compress=True, show_output=True) # Debugging log.debug("Creating a python script to perform the convolution remotely ...") # Create a python script that does the convolution #script_file = tempfile.NamedTemporaryFile() #local_script_path = script_file.name local_script_path = fs.join(local_temp_path, "convolve.py") script_file = open(local_script_path, 'w') script_file.write("#!/usr/bin/env python\n") script_file.write("# -*- coding: utf8 -*-\n") script_file.write("\n") script_file.write("# Import astronomical modules\n") script_file.write("from astropy.units import Unit\n") script_file.write("\n") script_file.write("# Import the relevant PTS classes and modules\n") script_file.write("from pts.magic.core.frame import Frame\n") script_file.write("from pts.magic.core.image import Image\n") script_file.write("from pts.magic.core.kernel import ConvolutionKernel\n") script_file.write("from pts.core.tools.logging import log\n") script_file.write("\n") script_file.write("# Inform the user\n") script_file.write("log.info('Opening the kernel frame ...')\n") script_file.write("\n") script_file.write("# Open the kernel\n") script_file.write("kernel = ConvolutionKernel.from_file('" + remote_kernel_path + "')\n") script_file.write("\n") for remote_frame_path in remote_frame_paths: frame_name = fs.strip_extension(fs.name(remote_frame_path)) script_file.write("# Inform the user\n") script_file.write("log.info('Opening the " + frame_name + " frame ...')\n") script_file.write("\n") script_file.write("# Open the frame\n") script_file.write("frame = Frame.from_file('" + remote_frame_path + "')\n") script_file.write("\n") script_file.write("# Inform the user\n") script_file.write("log.info('Convolving the " + frame_name + " frame ...')\n") script_file.write("\n") script_file.write("# Do the convolution and save the result\n") script_file.write("frame.convolve(kernel, allow_huge=True)\n") script_file.write("frame.save('" + remote_frame_path + "')\n") # overwrite the frame script_file.write("\n") #script_file.write("# Save the image\n") #script_file.write("image.save(" + remote_image_path + ")\n") # Write to disk #script_file.flush() script_file.close() # Debugging log.debug("Uploading the python script ...") # Upload the script file remote_script_path = fs.join(remote_temp_path, "convolve.py") remote.upload(local_script_path, remote_temp_path, new_name="convolve.py", show_output=True) # Close the local script (it is automatically removed) #script_file.close() # Debugging log.debug("Executing the script remotely ...") # Execute the script file remotely remote.execute("python " + remote_script_path, output=False, show_output=True) # Debugging log.debug("Downloading the results ...") # Download the resulting FITS file (the convolved image) #local_result_path = self.full_output_path("convolved.fits") #remote.download(remote_image_path, fs.directory_of(local_result_path), new_name="convolved.fits", compress=True) for remote_frame_path in remote_frame_paths: # Determine the name of the local frame file frame_file_name = fs.name(remote_frame_path) # Debugging log.debug("Downloading the " + fs.strip_extension(frame_file_name) + " frame ...") # Download remote.download(remote_frame_path, local_temp_path, new_name=frame_file_name, compress=True, show_output=True) # Remove the temporary directory on the remote's filesystem remote.remove_directory(remote_temp_path) # Load the result #self.image = Image.from_file(local_result_path) for frame_name in image.frames.keys(): if frame_name in constant_frames: continue # Skip constant frames, these are not convolved local_frame_path = fs.join(local_temp_path, frame_name + ".fits") image.frames[frame_name] = Frame.from_file(local_frame_path) # Remove the local temporary directory fs.remove_directory(local_temp_path) # ----------------------------------------------------------------- def remote_convolution_frame(frame, kernel_path, host_id): """ This function ... :param frame: :param kernel_path: :param host_id: :return: """ # Check whether the frame is constant. If it is, we don't have to convolve! if frame.is_constant(): return frame.copy() # Check whether we are already connected to the specified remote host if host_id in connected_remotes and connected_remotes[host_id] is not None: remote = connected_remotes[host_id] else: # Debugging log.debug("Logging in to remote host ...") # Create a remote instance for the specified host ID remote = Remote() remote.setup(host_id) # Debugging log.debug("Creating temporary directory remotely ...") # Create a temporary directory to do the convolution remote_home_directory = remote.home_directory remote_temp_path = fs.join(remote_home_directory, time.unique_name("convolution")) remote.create_directory(remote_temp_path) # Debugging log.debug("Creating local temporary directory ...") # Create a temporary directory locally to contain the frames local_temp_path = fs.join(fs.home(), time.unique_name("convolution")) fs.create_directory(local_temp_path) # Debugging log.debug("Writing the frame to the temporary directory ...") # Write the frame local_frame_path = fs.join(local_temp_path, frame.name + ".fits") frame.save(local_frame_path) # Debugging #log.debug("Writing the kernel to the temporary directory ...") # Write the kernel #local_kernel_path = fs.join(local_temp_path, "kernel.fits") #kernel.save(local_kernel_path) # Debugging log.debug("Uploading the frame to the remote directory ...") # Upload the frame file remote_frame_path = fs.join(remote_temp_path, frame.name) remote.upload(local_frame_path, remote_temp_path, new_name=frame.name, compress=True, show_output=True) # Debugging #log.debug("Uploading the kernel to the remote directory ...") # Upload the kernel FITS file to the remote directory #remote_kernel_path = fs.join(remote_temp_path, "kernel.fits") #remote.upload(local_kernel_path, remote_temp_path, new_name="kernel.fits", compress=True, show_output=True) # Debugging log.debug("Uploading the kernel to the remote directory ...") # Upload the kernel FITS file to the remote directory remote_kernel_path = fs.join(remote_temp_path, "kernel.fits") remote.upload(kernel_path, remote_temp_path, new_name="kernel.fits", compress=True, show_output=True) # Debugging log.debug("Creating a python script to perform the convolution remotely ...") # Create the script local_script_path = fs.join(local_temp_path, "convolve.py") script_file = open(local_script_path, 'w') script_file.write("#!/usr/bin/env python\n") script_file.write("# -*- coding: utf8 -*-\n") script_file.write("\n") script_file.write("# Import the relevant PTS classes and modules\n") script_file.write("from pts.magic.core.frame import Frame\n") script_file.write("from pts.core.tools.logging import log\n") script_file.write("\n") script_file.write("# Inform the user\n") script_file.write("log.info('Opening the kernel frame ...')\n") script_file.write("\n") script_file.write("# Open the kernel frame\n") script_file.write("kernel = Frame.from_file('" + remote_kernel_path + "')\n") script_file.write("\n") script_file.write("# Inform the user\n") script_file.write("log.info('Opening the frame ...')\n") script_file.write("\n") script_file.write("# Open the frame\n") script_file.write("frame = Frame.from_file('" + remote_frame_path + "')\n") script_file.write("\n") script_file.write("# Inform the user\n") script_file.write("log.info('Convolving the frame ...')\n") script_file.write("\n") script_file.write("# Do the convolution and save the result\n") script_file.write("convolved = frame.convolved(kernel, allow_huge=True)\n") script_file.write("convolved.save('" + remote_frame_path + "')\n") # overwrite the frame # Write to disk script_file.close() # Debugging log.debug("Uploading the python script ...") # Upload the script file remote_script_path = fs.join(remote_temp_path, "convolve.py") remote.upload(local_script_path, remote_temp_path, new_name="convolve.py", show_output=True) # Debugging log.debug("Executing the script remotely ...") # Execute the script file remotely remote.execute("python " + remote_script_path, output=False, show_output=True) # Debugging log.debug("Downloading the result ...") # Determine the name of the local frame file frame_file_name = fs.name(remote_frame_path) # Debugging log.debug("Downloading the " + fs.strip_extension(frame_file_name) + " frame ...") # Download remote.download(remote_frame_path, local_temp_path, new_name=frame_file_name, compress=True, show_output=True) # Remove the temporary directory on the remote's filesystem remote.remove_directory(remote_temp_path) # Load the convolved frame convolved = Frame.from_file(local_frame_path) # Remove the local temporary directory fs.remove_directory(local_temp_path) # Return the convolved frame return convolved # ----------------------------------------------------------------- def remote_filter_convolution_no_pts(host_id, datacube_path, wavelengths, filters): """ This function ... :param host_id: :param datacube_path: :param wavelengths: :param filters: :return: """ # Check whether we are already connected to the specified remote host if host_id in connected_remotes and connected_remotes[host_id] is not None: remote = connected_remotes[host_id] else: # Debugging log.debug("Logging in to remote host ...") # Create a remote instance for the specified host ID remote = Remote() remote.setup(host_id) # Debugging log.debug("Creating temporary directory remotely ...") # Create a temporary directory to do the convolution remote_home_directory = remote.home_directory remote_temp_path = fs.join(remote_home_directory, time.unique_name("filter-convolution")) remote.create_directory(remote_temp_path) # Debugging log.debug("Creating local temporary directory ...") # Create a temporary directory locally to contain the frames local_temp_path = fs.join(fs.home(), time.unique_name("filter-convolution")) fs.create_directory(local_temp_path) integrated_transmissions = dict() # Loop over the filters for fltr in filters: # Get the transmission data fltr_wavelengths = fltr._Wavelengths fltr_transmission = fltr._Transmission fltr_integrated_transmission = fltr._IntegratedTransmission integrated_transmissions[fltr.name] = fltr_integrated_transmission # Save the transmission data path = fs.join(local_temp_path, "transmission__" + str(fltr) + ".dat") np.savetxt(path, (fltr_wavelengths, fltr_transmission)) #print(integrated_transmissions) #print(local_temp_path) integrated_path = fs.join(local_temp_path, "integrated_transmissions.txt") with open(integrated_path, 'w') as integrated_trans_file: for fltr_name in integrated_transmissions: integrated_trans_file.write(fltr_name + ": " + str(integrated_transmissions[fltr_name]) + "\n") # NOT FINISHED ... # ----------------------------------------------------------------- def remote_filter_convolution(host_id, datacube_path, wavelengths, filters, keep_output=False): """ This function ... :param host_id: :param datacube_path: :param wavelengths: :param filters: :param keep_output: :return: """ # Check whether we are already connected to the specified remote host if host_id in connected_remotes and connected_remotes[host_id] is not None: remote = connected_remotes[host_id] else: # Debugging log.debug("Logging in to remote host ...") # Create a remote instance for the specified host ID remote = Remote() remote.setup(host_id) # Debugging log.debug("Creating temporary directory remotely ...") # Create a temporary directory to do the convolution remote_home_directory = remote.home_directory remote_temp_path = fs.join(remote_home_directory, time.unique_name("filter-convolution")) remote.create_directory(remote_temp_path) # Debugging log.debug("Creating local temporary directory ...") # Create a temporary directory locally to contain the frames local_temp_path = fs.join(fs.home(), time.unique_name("filter-convolution")) fs.create_directory(local_temp_path) # Debugging log.debug("Uploading the datacube to the temporary remote directory ...") # Upload the frame file datacube_name = fs.name(datacube_path) remote_datacube_path = fs.join(remote_temp_path, datacube_name) remote.upload(datacube_path, remote_temp_path, compress=True, show_output=True) # Debugging log.debug("Writing the wavelengths to the temporary local directory ...") local_wavelengths_path = fs.join(local_temp_path, "wavelengths.txt") np.savetxt(local_wavelengths_path, wavelengths) # Debugging log.debug("Uploading the wavelengths file to the remote directory ...") # Upload the kernel FITS file to the remote directory remote_wavelengths_path = fs.join(remote_temp_path, "wavelengths.txt") remote.upload(local_wavelengths_path, remote_temp_path, compress=True, show_output=True) # Debugging log.debug("Creating a python script to perform the filter convolution remotely ...") # Create the script local_script_path = fs.join(local_temp_path, "make_images.py") script_file = open(local_script_path, 'w') script_file.write("#!/usr/bin/env python\n") script_file.write("# -*- coding: utf8 -*-\n") script_file.write("\n") script_file.write("# Import standard modules\n") script_file.write("import numpy as np\n") script_file.write("\n") script_file.write("# Import the relevant PTS classes and modules\n") script_file.write("from pts.magic.core.image import Image\n") script_file.write("from pts.magic.core.frame import Frame\n") script_file.write("from pts.core.basics.filter import Filter\n") script_file.write("from pts.core.tools.logging import log\n") script_file.write("from pts.core.tools import filesystem as fs\n") script_file.write("\n") script_file.write("# Inform the user\n") script_file.write("log.info('Loading the datacube ...')\n") script_file.write("\n") script_file.write("# Open the datacube as an Image\n") script_file.write("datacube = Image.from_file('" + remote_datacube_path + "', always_call_first_primary=False)\n") script_file.write("\n") script_file.write("# Inform the user\n") script_file.write("log.info('Loading the wavelengths ...')\n") script_file.write("\n") script_file.write("# Load the wavelengths from the text file\n") script_file.write("wavelengths = np.loadtxt('" + remote_wavelengths_path + "')\n") script_file.write("\n") script_file.write("# Convert the frames from neutral surface brightness to wavelength surface brightness\n") script_file.write("for l in range(len(wavelengths)):\n") script_file.write("\n") script_file.write(" # Get the wavelength\n") script_file.write(" wavelength = wavelengths[l]\n") script_file.write("\n") script_file.write(" # Determine the name of the frame in the datacube\n") script_file.write(" frame_name = 'frame' + str(l)\n") script_file.write("\n") script_file.write(" # Divide this frame by the wavelength in micron\n") script_file.write(" datacube.frames[frame_name] /= wavelength\n") script_file.write("\n") script_file.write(" # Set the new unit\n") script_file.write(" datacube.frames[frame_name].unit = 'W / (m2 * arcsec2 * micron)'\n") script_file.write("\n") script_file.write("# Convert the datacube to a numpy array where wavelength is the third dimension\n") script_file.write("fluxdensities = datacube.asarray()\n") script_file.write("\n") script_file.write("# Inform the user\n") script_file.write("log.info('Creating the filters ...')\n") script_file.write("\n") script_file.write("filters = dict()\n") script_file.write("\n") for filter_name in filters: fltr = filters[filter_name] script_file.write("# Inform the user\n") script_file.write("log.info('Creating the " + str(fltr) + " filter')\n") script_file.write("\n") script_file.write("fltr = Filter.from_string('" + str(fltr) + "')\n") script_file.write("filters['" + filter_name + "'] = fltr\n") script_file.write("\n") script_file.write("# Inform the user\n") script_file.write("log.info('Performing the filter convolutions ...')\n") script_file.write("\n") script_file.write("# Loop over the filters, perform the convolution\n") script_file.write("for filter_name in filters:\n") script_file.write("\n") script_file.write(" log.info('Making the observed image for the ' + str(fltr) + ' filter ...')\n") script_file.write(" fltr = filters[filter_name]\n") script_file.write(" data = fltr.convolve(wavelengths, fluxdensities)\n") script_file.write(" frame = Frame(data)\n") script_file.write(" frame.unit = 'W/(m2 * arcsec2 * micron)'\n") script_file.write(" path = fs.join('" + remote_temp_path + "', filter_name + '.fits')\n") script_file.write(" frame.save(path)\n") # Write to disk script_file.close() # Debugging log.debug("Uploading the python script ...") # Upload the script file remote_script_path = fs.join(remote_temp_path, "make_images.py") remote.upload(local_script_path, remote_temp_path, new_name="make_images.py", show_output=True) # Debugging log.debug("Executing the script remotely ...") # Execute the script file remotely remote.execute("python " + remote_script_path, output=False, show_output=True) # Remove the datacube in the remote directory remote.remove_file(remote_datacube_path) # Debugging log.debug("Downloading the convolved frames ...") # Download local_downloaded_temp_path = fs.join(fs.home(), fs.name(remote_temp_path)) fs.create_directory(local_downloaded_temp_path) remote.download(remote_temp_path, local_downloaded_temp_path, compress=True, show_output=True) # Remove the temporary directory on the remote's filesystem remote.remove_directory(remote_temp_path) # Remove the local temporary directory fs.remove_directory(local_temp_path) # Create a dictionary to contain the frames frames = dict() # Loop over the filters, load the frame for filter_name in filters: # Determine the path to the resulting FITS file path = fs.join(local_downloaded_temp_path, filter_name + ".fits") # Check whether the frame exists if not fs.is_file(path): raise RuntimeError("The image for filter " + str(filters[filter_name]) + " is missing") # Load the FITS file frame = Frame.from_file(path) # Add the frame to the dictionary frames[filter_name] = frame # Remove the downloaded temporary directory if not keep_output: fs.remove_directory(local_downloaded_temp_path) # Return the dictionary of frames return frames # -----------------------------------------------------------------
Stargrazer82301/CAAPR
CAAPR/CAAPR_AstroMagic/PTS/pts/core/tools/special.py
Python
mit
24,211
[ 30522, 1001, 999, 1013, 2149, 2099, 1013, 8026, 1013, 4372, 2615, 18750, 1001, 1011, 1008, 1011, 16861, 1024, 21183, 2546, 2620, 1011, 1008, 1011, 1001, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package Lacuna::DB::Result::Map::Body::Asteroid::A23; use Moose; use utf8; no warnings qw(uninitialized); extends 'Lacuna::DB::Result::Map::Body::Asteroid'; use constant image => 'a23'; use constant rutile => 1000; use constant chromite => 1000; use constant chalcopyrite => 1000; use constant galena => 1000; use constant gold => 1; use constant uraninite => 1; use constant bauxite => 1; use constant goethite => 1; use constant halite => 1; use constant gypsum => 1; use constant trona => 1; use constant sulfur => 1; use constant methane => 1; use constant kerogen => 1; use constant anthracite => 1; use constant magnetite => 1; use constant fluorite => 1000; use constant beryl => 1000; use constant zircon => 1000; use constant monazite => 1; no Moose; __PACKAGE__->meta->make_immutable(inline_constructor => 0);
Imzogelmo/Lacuna-Server-Open
lib/Lacuna/DB/Result/Map/Body/Asteroid/A23.pm
Perl
gpl-2.0
962
[ 30522, 7427, 18749, 9521, 1024, 1024, 16962, 1024, 1024, 2765, 1024, 1024, 4949, 1024, 1024, 2303, 1024, 1024, 12175, 1024, 1024, 22441, 2509, 1025, 2224, 17716, 1025, 2224, 21183, 2546, 2620, 1025, 2053, 16234, 1053, 2860, 1006, 4895, 5498...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_112) on Thu Jul 06 10:54:05 MST 2017 --> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Uses of Interface org.wildfly.swarm.config.undertow.configuration.mod_cluster.balancer.NodeSupplier (Public javadocs 2017.7.0 API)</title> <meta name="date" content="2017-07-06"> <link rel="stylesheet" type="text/css" href="../../../../../../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../../../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Interface org.wildfly.swarm.config.undertow.configuration.mod_cluster.balancer.NodeSupplier (Public javadocs 2017.7.0 API)"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../../../../org/wildfly/swarm/config/undertow/configuration/mod_cluster/balancer/NodeSupplier.html" title="interface in org.wildfly.swarm.config.undertow.configuration.mod_cluster.balancer">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../../../../../../../../../overview-tree.html">Tree</a></li> <li><a href="../../../../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../../../../index-all.html">Index</a></li> <li><a href="../../../../../../../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage">WildFly Swarm API, 2017.7.0</div> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../../../../index.html?org/wildfly/swarm/config/undertow/configuration/mod_cluster/balancer/class-use/NodeSupplier.html" target="_top">Frames</a></li> <li><a href="NodeSupplier.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Interface org.wildfly.swarm.config.undertow.configuration.mod_cluster.balancer.NodeSupplier" class="title">Uses of Interface<br>org.wildfly.swarm.config.undertow.configuration.mod_cluster.balancer.NodeSupplier</h2> </div> <div class="classUseContainer"> <ul class="blockList"> <li class="blockList"> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation"> <caption><span>Packages that use <a href="../../../../../../../../../org/wildfly/swarm/config/undertow/configuration/mod_cluster/balancer/NodeSupplier.html" title="interface in org.wildfly.swarm.config.undertow.configuration.mod_cluster.balancer">NodeSupplier</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Package</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="#org.wildfly.swarm.config.undertow.configuration.mod_cluster">org.wildfly.swarm.config.undertow.configuration.mod_cluster</a></td> <td class="colLast">&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="org.wildfly.swarm.config.undertow.configuration.mod_cluster"> <!-- --> </a> <h3>Uses of <a href="../../../../../../../../../org/wildfly/swarm/config/undertow/configuration/mod_cluster/balancer/NodeSupplier.html" title="interface in org.wildfly.swarm.config.undertow.configuration.mod_cluster.balancer">NodeSupplier</a> in <a href="../../../../../../../../../org/wildfly/swarm/config/undertow/configuration/mod_cluster/package-summary.html">org.wildfly.swarm.config.undertow.configuration.mod_cluster</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../../../../../org/wildfly/swarm/config/undertow/configuration/mod_cluster/package-summary.html">org.wildfly.swarm.config.undertow.configuration.mod_cluster</a> with parameters of type <a href="../../../../../../../../../org/wildfly/swarm/config/undertow/configuration/mod_cluster/balancer/NodeSupplier.html" title="interface in org.wildfly.swarm.config.undertow.configuration.mod_cluster.balancer">NodeSupplier</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../../../../../../org/wildfly/swarm/config/undertow/configuration/mod_cluster/Balancer.html" title="type parameter in Balancer">T</a></code></td> <td class="colLast"><span class="typeNameLabel">Balancer.</span><code><span class="memberNameLink"><a href="../../../../../../../../../org/wildfly/swarm/config/undertow/configuration/mod_cluster/Balancer.html#node-org.wildfly.swarm.config.undertow.configuration.mod_cluster.balancer.NodeSupplier-">node</a></span>(<a href="../../../../../../../../../org/wildfly/swarm/config/undertow/configuration/mod_cluster/balancer/NodeSupplier.html" title="interface in org.wildfly.swarm.config.undertow.configuration.mod_cluster.balancer">NodeSupplier</a>&nbsp;supplier)</code> <div class="block">Install a supplied Node object to the list of subresources</div> </td> </tr> </tbody> </table> </li> </ul> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../../../../org/wildfly/swarm/config/undertow/configuration/mod_cluster/balancer/NodeSupplier.html" title="interface in org.wildfly.swarm.config.undertow.configuration.mod_cluster.balancer">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../../../../../../../../../overview-tree.html">Tree</a></li> <li><a href="../../../../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../../../../index-all.html">Index</a></li> <li><a href="../../../../../../../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage">WildFly Swarm API, 2017.7.0</div> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../../../../index.html?org/wildfly/swarm/config/undertow/configuration/mod_cluster/balancer/class-use/NodeSupplier.html" target="_top">Frames</a></li> <li><a href="NodeSupplier.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright &#169; 2017 <a href="http://www.jboss.org">JBoss by Red Hat</a>. All rights reserved.</small></p> </body> </html>
wildfly-swarm/wildfly-swarm-javadocs
2017.7.0/apidocs/org/wildfly/swarm/config/undertow/configuration/mod_cluster/balancer/class-use/NodeSupplier.html
HTML
apache-2.0
8,544
[ 30522, 1026, 999, 9986, 13874, 16129, 2270, 1000, 1011, 1013, 1013, 1059, 2509, 2278, 1013, 1013, 26718, 2094, 16129, 1018, 1012, 5890, 17459, 1013, 1013, 4372, 1000, 1000, 8299, 1024, 1013, 1013, 7479, 1012, 1059, 2509, 1012, 8917, 1013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
--- layout: post title: "How AI has started to impact our work as designers" posturl: https://uxdesign.cc/how-ai-will-impact-your-routine-as-a-designer-2773a4b1728c tags: - Overview - Design tools --- {% include post_info_header.md %} Nice overview on the impact of AI tools on designers everyday life. The notion of AI tech doing much of the design legworks seems right - technology has been helping us for quite a while to focus on what matters and automatize everything else. <!--more--> {% include post_info_footer.md %}
polgarp/alg-exp
_posts/archive/33-20171114/2017-11-12-How-AI-has-started-to-impact-our-work-as-designers.md
Markdown
mit
528
[ 30522, 1011, 1011, 1011, 9621, 1024, 2695, 2516, 1024, 1000, 2129, 9932, 2038, 2318, 2000, 4254, 2256, 2147, 2004, 11216, 1000, 2695, 3126, 2140, 1024, 16770, 1024, 1013, 1013, 1057, 2595, 6155, 23773, 1012, 10507, 1013, 2129, 1011, 9932, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// This is a OpenGL ES 1.0 dynamic font rendering system. It loads actual font // files, generates a font map (texture) from them, and allows rendering of // text strings. // // NOTE: the rendering portions of this class uses a sprite batcher in order // provide decent speed rendering. Also, rendering assumes a BOTTOM-LEFT // origin, and the (x,y) positions are relative to that, as well as the // bottom-left of the string to render. package com.spiritgame; import javax.microedition.khronos.opengles.GL10; import android.content.res.AssetManager; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Typeface; import android.opengl.GLUtils; public class GLText { //--Constants--// public final static int CHAR_START = 32; // First Character (ASCII Code) public final static int CHAR_END = 126; // Last Character (ASCII Code) public final static int CHAR_CNT = (((CHAR_END - CHAR_START) + 1) + 1); // Character Count (Including Character to use for Unknown) public final static int CHAR_NONE = 32; // Character to Use for Unknown (ASCII Code) public final static int CHAR_UNKNOWN = (CHAR_CNT - 1); // Index of the Unknown Character public final static int FONT_SIZE_MIN = 6; // Minumum Font Size (Pixels) public final static int FONT_SIZE_MAX = 180; // Maximum Font Size (Pixels) public final static int CHAR_BATCH_SIZE = 100; // Number of Characters to Render Per Batch //--Members--// GL10 gl; // GL10 Instance AssetManager assets; // Asset Manager SpriteBatch batch; // Batch Renderer int fontPadX, fontPadY; // Font Padding (Pixels; On Each Side, ie. Doubled on Both X+Y Axis) float fontHeight; // Font Height (Actual; Pixels) float fontAscent; // Font Ascent (Above Baseline; Pixels) float fontDescent; // Font Descent (Below Baseline; Pixels) int textureId; // Font Texture ID [NOTE: Public for Testing Purposes Only!] int textureSize; // Texture Size for Font (Square) [NOTE: Public for Testing Purposes Only!] TextureRegion textureRgn; // Full Texture Region float charWidthMax; // Character Width (Maximum; Pixels) float charHeight; // Character Height (Maximum; Pixels) final float[] charWidths; // Width of Each Character (Actual; Pixels) TextureRegion[] charRgn; // Region of Each Character (Texture Coordinates) int cellWidth, cellHeight; // Character Cell Width/Height int rowCnt, colCnt; // Number of Rows/Columns float scaleX, scaleY; // Font Scale (X,Y Axis) float spaceX; // Additional (X,Y Axis) Spacing (Unscaled) //--Constructor--// // D: save GL instance + asset manager, create arrays, and initialize the members // A: gl - OpenGL ES 10 Instance public GLText(GL10 gl, AssetManager assets) { this.gl = gl; // Save the GL10 Instance this.assets = assets; // Save the Asset Manager Instance batch = new SpriteBatch(gl, CHAR_BATCH_SIZE); // Create Sprite Batch (with Defined Size) charWidths = new float[CHAR_CNT]; // Create the Array of Character Widths charRgn = new TextureRegion[CHAR_CNT]; // Create the Array of Character Regions // initialize remaining members fontPadX = 0; fontPadY = 0; fontHeight = 0.0f; fontAscent = 0.0f; fontDescent = 0.0f; textureId = -1; textureSize = 0; charWidthMax = 0; charHeight = 0; cellWidth = 0; cellHeight = 0; rowCnt = 0; colCnt = 0; scaleX = 1.0f; // Default Scale = 1 (Unscaled) scaleY = 1.0f; // Default Scale = 1 (Unscaled) spaceX = 0.0f; } public GLText(GL10 gl) { this.gl = gl; // Save the GL10 Instance batch = new SpriteBatch(gl, CHAR_BATCH_SIZE); // Create Sprite Batch (with Defined Size) charWidths = new float[CHAR_CNT]; // Create the Array of Character Widths charRgn = new TextureRegion[CHAR_CNT]; // Create the Array of Character Regions // initialize remaining members fontPadX = 0; fontPadY = 0; fontHeight = 0.0f; fontAscent = 0.0f; fontDescent = 0.0f; textureId = -1; textureSize = 0; charWidthMax = 0; charHeight = 0; cellWidth = 0; cellHeight = 0; rowCnt = 0; colCnt = 0; scaleX = 1.0f; // Default Scale = 1 (Unscaled) scaleY = 1.0f; // Default Scale = 1 (Unscaled) spaceX = 0.0f; } //--Load Font--// // description // this will load the specified font file, create a texture for the defined // character range, and setup all required values used to render with it. // arguments: // file - Filename of the font (.ttf, .otf) to use. In 'Assets' folder. // size - Requested pixel size of font (height) // padX, padY - Extra padding per character (X+Y Axis); to prevent overlapping characters. public boolean load(String file, int size, int padX, int padY) { // setup requested values fontPadX = padX; // Set Requested X Axis Padding fontPadY = padY; // Set Requested Y Axis Padding // load the font and setup paint instance for drawing Typeface tf = Typeface.createFromAsset(assets, file); // Create the Typeface from Font File Paint paint = new Paint(); // Create Android Paint Instance paint.setAntiAlias(true); // Enable Anti Alias paint.setTextSize(size); // Set Text Size paint.setColor(0xffffffff); // Set ARGB (White, Opaque) paint.setTypeface(tf); // Set Typeface // get font metrics Paint.FontMetrics fm = paint.getFontMetrics(); // Get Font Metrics fontHeight = (float) Math.ceil(Math.abs(fm.bottom) + Math.abs(fm.top)); // Calculate Font Height fontAscent = (float) Math.ceil(Math.abs(fm.ascent)); // Save Font Ascent fontDescent = (float) Math.ceil(Math.abs(fm.descent)); // Save Font Descent // determine the width of each character (including unknown character) // also determine the maximum character width char[] s = new char[2]; // Create Character Array charWidthMax = charHeight = 0; // Reset Character Width/Height Maximums float[] w = new float[2]; // Working Width Value int cnt = 0; // Array Counter for (char c = CHAR_START; c <= CHAR_END; c++) { // FOR Each Character s[0] = c; // Set Character paint.getTextWidths(s, 0, 1, w); // Get Character Bounds charWidths[cnt] = w[0]; // Get Width if (charWidths[cnt] > charWidthMax) // IF Width Larger Than Max Width charWidthMax = charWidths[cnt]; // Save New Max Width cnt++; // Advance Array Counter } s[0] = CHAR_NONE; // Set Unknown Character paint.getTextWidths(s, 0, 1, w); // Get Character Bounds charWidths[cnt] = w[0]; // Get Width if (charWidths[cnt] > charWidthMax) // IF Width Larger Than Max Width charWidthMax = charWidths[cnt]; // Save New Max Width cnt++; // Advance Array Counter // set character height to font height charHeight = fontHeight; // Set Character Height // find the maximum size, validate, and setup cell sizes cellWidth = (int) charWidthMax + (2 * fontPadX); // Set Cell Width cellHeight = (int) charHeight + (2 * fontPadY); // Set Cell Height int maxSize = cellWidth > cellHeight ? cellWidth : cellHeight; // Save Max Size (Width/Height) if (maxSize < FONT_SIZE_MIN || maxSize > FONT_SIZE_MAX) // IF Maximum Size Outside Valid Bounds return false; // Return Error // set texture size based on max font size (width or height) // NOTE: these values are fixed, based on the defined characters. when // changing start/end characters (CHAR_START/CHAR_END) this will need adjustment too! if (maxSize <= 24) // IF Max Size is 18 or Less textureSize = 256; // Set 256 Texture Size else if (maxSize <= 40) // ELSE IF Max Size is 40 or Less textureSize = 512; // Set 512 Texture Size else if (maxSize <= 80) // ELSE IF Max Size is 80 or Less textureSize = 1024; // Set 1024 Texture Size else // ELSE IF Max Size is Larger Than 80 (and Less than FONT_SIZE_MAX) textureSize = 2048; // Set 2048 Texture Size // create an empty bitmap (alpha only) Bitmap bitmap = Bitmap.createBitmap(textureSize, textureSize, Bitmap.Config.ALPHA_8); // Create Bitmap Canvas canvas = new Canvas(bitmap); // Create Canvas for Rendering to Bitmap bitmap.eraseColor(0x00000000); // Set Transparent Background (ARGB) // calculate rows/columns // NOTE: while not required for anything, these may be useful to have :) colCnt = textureSize / cellWidth; // Calculate Number of Columns rowCnt = (int) Math.ceil((float) CHAR_CNT / (float) colCnt); // Calculate Number of Rows // render each of the characters to the canvas (ie. build the font map) float x = fontPadX; // Set Start Position (X) float y = (cellHeight - 1) - fontDescent - fontPadY; // Set Start Position (Y) for (char c = CHAR_START; c <= CHAR_END; c++) { // FOR Each Character s[0] = c; // Set Character to Draw canvas.drawText(s, 0, 1, x, y, paint); // Draw Character x += cellWidth; // Move to Next Character if ((x + cellWidth - fontPadX) > textureSize) { // IF End of Line Reached x = fontPadX; // Set X for New Row y += cellHeight; // Move Down a Row } } s[0] = CHAR_NONE; // Set Character to Use for NONE canvas.drawText(s, 0, 1, x, y, paint); // Draw Character // generate a new texture int[] textureIds = new int[1]; // Array to Get Texture Id gl.glGenTextures(1, textureIds, 0); // Generate New Texture textureId = textureIds[0]; // Save Texture Id // setup filters for texture gl.glBindTexture(GL10.GL_TEXTURE_2D, textureId); // Bind Texture gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST); // Set Minification Filter gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR); // Set Magnification Filter gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE); // Set U Wrapping gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE); // Set V Wrapping // load the generated bitmap onto the texture GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0); // Load Bitmap to Texture gl.glBindTexture(GL10.GL_TEXTURE_2D, 0); // Unbind Texture // release the bitmap bitmap.recycle(); // Release the Bitmap // setup the array of character texture regions x = 0; // Initialize X y = 0; // Initialize Y for (int c = 0; c < CHAR_CNT; c++) { // FOR Each Character (On Texture) charRgn[c] = new TextureRegion(textureSize, textureSize, x, y, cellWidth - 1, cellHeight - 1); // Create Region for Character x += cellWidth; // Move to Next Char (Cell) if (x + cellWidth > textureSize) { x = 0; // Reset X Position to Start y += cellHeight; // Move to Next Row (Cell) } } // create full texture region textureRgn = new TextureRegion(textureSize, textureSize, 0, 0, textureSize, textureSize); // Create Full Texture Region // return success return true; // Return Success } public boolean load(Typeface tf, int size, int padX, int padY) { // setup requested values fontPadX = padX; // Set Requested X Axis Padding fontPadY = padY; // Set Requested Y Axis Padding // load the font and setup paint instance for drawing Paint paint = new Paint(); // Create Android Paint Instance paint.setAntiAlias(true); // Enable Anti Alias paint.setTextSize(size); // Set Text Size paint.setColor(0xffffffff); // Set ARGB (White, Opaque) paint.setTypeface(tf); // Set Typeface // get font metrics Paint.FontMetrics fm = paint.getFontMetrics(); // Get Font Metrics fontHeight = (float) Math.ceil(Math.abs(fm.bottom) + Math.abs(fm.top)); // Calculate Font Height fontAscent = (float) Math.ceil(Math.abs(fm.ascent)); // Save Font Ascent fontDescent = (float) Math.ceil(Math.abs(fm.descent)); // Save Font Descent // determine the width of each character (including unknown character) // also determine the maximum character width char[] s = new char[2]; // Create Character Array charWidthMax = charHeight = 0; // Reset Character Width/Height Maximums float[] w = new float[2]; // Working Width Value int cnt = 0; // Array Counter for (char c = CHAR_START; c <= CHAR_END; c++) { // FOR Each Character s[0] = c; // Set Character paint.getTextWidths(s, 0, 1, w); // Get Character Bounds charWidths[cnt] = w[0]; // Get Width if (charWidths[cnt] > charWidthMax) // IF Width Larger Than Max Width charWidthMax = charWidths[cnt]; // Save New Max Width cnt++; // Advance Array Counter } s[0] = CHAR_NONE; // Set Unknown Character paint.getTextWidths(s, 0, 1, w); // Get Character Bounds charWidths[cnt] = w[0]; // Get Width if (charWidths[cnt] > charWidthMax) // IF Width Larger Than Max Width charWidthMax = charWidths[cnt]; // Save New Max Width cnt++; // Advance Array Counter // set character height to font height charHeight = fontHeight; // Set Character Height // find the maximum size, validate, and setup cell sizes cellWidth = (int) charWidthMax + (2 * fontPadX); // Set Cell Width cellHeight = (int) charHeight + (2 * fontPadY); // Set Cell Height int maxSize = cellWidth > cellHeight ? cellWidth : cellHeight; // Save Max Size (Width/Height) if (maxSize < FONT_SIZE_MIN || maxSize > FONT_SIZE_MAX) // IF Maximum Size Outside Valid Bounds return false; // Return Error // set texture size based on max font size (width or height) // NOTE: these values are fixed, based on the defined characters. when // changing start/end characters (CHAR_START/CHAR_END) this will need adjustment too! if (maxSize <= 24) // IF Max Size is 18 or Less textureSize = 256; // Set 256 Texture Size else if (maxSize <= 40) // ELSE IF Max Size is 40 or Less textureSize = 512; // Set 512 Texture Size else if (maxSize <= 80) // ELSE IF Max Size is 80 or Less textureSize = 1024; // Set 1024 Texture Size else // ELSE IF Max Size is Larger Than 80 (and Less than FONT_SIZE_MAX) textureSize = 2048; // Set 2048 Texture Size // create an empty bitmap (alpha only) Bitmap bitmap = Bitmap.createBitmap(textureSize, textureSize, Bitmap.Config.ALPHA_8); // Create Bitmap Canvas canvas = new Canvas(bitmap); // Create Canvas for Rendering to Bitmap bitmap.eraseColor(0x00000000); // Set Transparent Background (ARGB) // calculate rows/columns // NOTE: while not required for anything, these may be useful to have :) colCnt = textureSize / cellWidth; // Calculate Number of Columns rowCnt = (int) Math.ceil((float) CHAR_CNT / (float) colCnt); // Calculate Number of Rows // render each of the characters to the canvas (ie. build the font map) float x = fontPadX; // Set Start Position (X) float y = (cellHeight - 1) - fontDescent - fontPadY; // Set Start Position (Y) for (char c = CHAR_START; c <= CHAR_END; c++) { // FOR Each Character s[0] = c; // Set Character to Draw canvas.drawText(s, 0, 1, x, y, paint); // Draw Character x += cellWidth; // Move to Next Character if ((x + cellWidth - fontPadX) > textureSize) { // IF End of Line Reached x = fontPadX; // Set X for New Row y += cellHeight; // Move Down a Row } } s[0] = CHAR_NONE; // Set Character to Use for NONE canvas.drawText(s, 0, 1, x, y, paint); // Draw Character // generate a new texture int[] textureIds = new int[1]; // Array to Get Texture Id gl.glGenTextures(1, textureIds, 0); // Generate New Texture textureId = textureIds[0]; // Save Texture Id // setup filters for texture gl.glBindTexture(GL10.GL_TEXTURE_2D, textureId); // Bind Texture gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST); // Set Minification Filter gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR); // Set Magnification Filter gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE); // Set U Wrapping gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE); // Set V Wrapping // load the generated bitmap onto the texture GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0); // Load Bitmap to Texture gl.glBindTexture(GL10.GL_TEXTURE_2D, 0); // Unbind Texture // release the bitmap bitmap.recycle(); // Release the Bitmap // setup the array of character texture regions x = 0; // Initialize X y = 0; // Initialize Y for (int c = 0; c < CHAR_CNT; c++) { // FOR Each Character (On Texture) charRgn[c] = new TextureRegion(textureSize, textureSize, x, y, cellWidth - 1, cellHeight - 1); // Create Region for Character x += cellWidth; // Move to Next Char (Cell) if (x + cellWidth > textureSize) { x = 0; // Reset X Position to Start y += cellHeight; // Move to Next Row (Cell) } } // create full texture region textureRgn = new TextureRegion(textureSize, textureSize, 0, 0, textureSize, textureSize); // Create Full Texture Region // return success return true; // Return Success } //--Begin/End Text Drawing--// // D: call these methods before/after (respectively all draw() calls using a text instance // NOTE: color is set on a per-batch basis, and fonts should be 8-bit alpha only!!! // A: red, green, blue - RGB values for font (default = 1.0) // alpha - optional alpha value for font (default = 1.0) // R: [none] public void begin() { begin(1.0f, 1.0f, 1.0f, 1.0f); // Begin with White Opaque } public void begin(float alpha) { begin(1.0f, 1.0f, 1.0f, alpha); // Begin with White (Explicit Alpha) } public void begin(float red, float green, float blue, float alpha) { gl.glColor4f(red, green, blue, alpha); // Set Color+Alpha gl.glBindTexture(GL10.GL_TEXTURE_2D, textureId); // Bind the Texture batch.beginBatch(); // Begin Batch } public void end() { batch.endBatch(); // End Batch gl.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); // Restore Default Color/Alpha } //--Draw Text--// // D: draw text at the specified x,y position // A: text - the string to draw // x, y - the x,y position to draw text at (bottom left of text; including descent) // R: [none] public void draw(String text, float x, float y) { float chrHeight = cellHeight * scaleY; // Calculate Scaled Character Height float chrWidth = cellWidth * scaleX; // Calculate Scaled Character Width int len = text.length(); // Get String Length x += (chrWidth / 2.0f) - (fontPadX * scaleX); // Adjust Start X y += (chrHeight / 2.0f) - (fontPadY * scaleY); // Adjust Start Y for (int i = 0; i < len; i++) { // FOR Each Character in String int c = (int) text.charAt(i) - CHAR_START; // Calculate Character Index (Offset by First Char in Font) if (c < 0 || c >= CHAR_CNT) // IF Character Not In Font c = CHAR_UNKNOWN; // Set to Unknown Character Index batch.drawSprite(x, y, chrWidth, chrHeight, charRgn[c]); // Draw the Character x += (charWidths[c] + spaceX) * scaleX; // Advance X Position by Scaled Character Width } } //--Draw Text Centered--// // D: draw text CENTERED at the specified x,y position // A: text - the string to draw // x, y - the x,y position to draw text at (bottom left of text) // R: the total width of the text that was drawn public float drawC(String text, float x, float y) { float len = getLength(text); // Get Text Length draw(text, x - (len / 2.0f), y - (getCharHeight() / 2.0f)); // Draw Text Centered return len; // Return Length } public float drawCX(String text, float x, float y) { float len = getLength(text); // Get Text Length draw(text, x - (len / 2.0f), y); // Draw Text Centered (X-Axis Only) return len; // Return Length } public void drawCY(String text, float x, float y) { draw(text, x, y - (getCharHeight() / 2.0f)); // Draw Text Centered (Y-Axis Only) } //--Set Scale--// // D: set the scaling to use for the font // A: scale - uniform scale for both x and y axis scaling // sx, sy - separate x and y axis scaling factors // R: [none] public void setScale(float scale) { scaleX = scaleY = scale; // Set Uniform Scale } public void setScale(float sx, float sy) { scaleX = sx; // Set X Scale scaleY = sy; // Set Y Scale } //--Get Scale--// // D: get the current scaling used for the font // A: [none] // R: the x/y scale currently used for scale public float getScaleX() { return scaleX; // Return X Scale } public float getScaleY() { return scaleY; // Return Y Scale } //--Set Space--// // D: set the spacing (unscaled; ie. pixel size) to use for the font // A: space - space for x axis spacing // R: [none] public void setSpace(float space) { spaceX = space; // Set Space } //--Get Space--// // D: get the current spacing used for the font // A: [none] // R: the x/y space currently used for scale public float getSpace() { return spaceX; // Return X Space } //--Get Length of a String--// // D: return the length of the specified string if rendered using current settings // A: text - the string to get length for // R: the length of the specified string (pixels) public float getLength(String text) { float len = 0.0f; // Working Length int strLen = text.length(); // Get String Length (Characters) for (int i = 0; i < strLen; i++) { // For Each Character in String (Except Last int c = (int) text.charAt(i) - CHAR_START; // Calculate Character Index (Offset by First Char in Font) len += (charWidths[c] * scaleX); // Add Scaled Character Width to Total Length } len += (strLen > 1 ? ((strLen - 1) * spaceX) * scaleX : 0); // Add Space Length return len; // Return Total Length } //--Get Width/Height of Character--// // D: return the scaled width/height of a character, or max character width // NOTE: since all characters are the same height, no character index is required! // NOTE: excludes spacing!! // A: chr - the character to get width for // R: the requested character size (scaled) public float getCharWidth(char chr) { int c = chr - CHAR_START; // Calculate Character Index (Offset by First Char in Font) return (charWidths[c] * scaleX); // Return Scaled Character Width } public float getCharWidthMax() { return (charWidthMax * scaleX); // Return Scaled Max Character Width } public float getCharHeight() { return (charHeight * scaleY); // Return Scaled Character Height } //--Get Font Metrics--// // D: return the specified (scaled) font metric // A: [none] // R: the requested font metric (scaled) public float getAscent() { return (fontAscent * scaleY); // Return Font Ascent } public float getDescent() { return (fontDescent * scaleY); // Return Font Descent } public float getHeight() { return (fontHeight * scaleY); // Return Font Height (Actual) } //--Draw Font Texture--// // D: draw the entire font texture (NOTE: for testing purposes only) // A: width, height - the width and height of the area to draw to. this is used // to draw the texture to the top-left corner. public void drawTexture(int width, int height) { batch.beginBatch(textureId); // Begin Batch (Bind Texture) batch.drawSprite(textureSize / 2, height - (textureSize / 2), textureSize, textureSize, textureRgn); // Draw batch.endBatch(); // End Batch } }
jamesw6811/SpiritGame
IntelliJ/SpiritAndroid/src/com/spiritgame/GLText.java
Java
mit
29,724
[ 30522, 1013, 1013, 2023, 2003, 1037, 2330, 23296, 9686, 1015, 1012, 1014, 8790, 15489, 14259, 2291, 1012, 2009, 15665, 5025, 15489, 1013, 1013, 6764, 1010, 19421, 1037, 15489, 4949, 1006, 14902, 1007, 2013, 2068, 1010, 1998, 4473, 14259, 19...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright 2003-2021 Dave Griffith, Bas Leijdekkers * * 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.intellij.codeInspection.ui; import com.intellij.codeInspection.InspectionProfileEntry; import com.intellij.openapi.util.NlsContexts; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; public class SingleCheckboxOptionsPanel extends InspectionOptionsPanel { public SingleCheckboxOptionsPanel(@NotNull @NlsContexts.Checkbox String label, @NotNull InspectionProfileEntry owner, @NonNls String property) { super(owner, label, property); } }
siosio/intellij-community
platform/lang-api/src/com/intellij/codeInspection/ui/SingleCheckboxOptionsPanel.java
Java
apache-2.0
1,190
[ 30522, 1013, 1008, 1008, 9385, 2494, 1011, 25682, 4913, 14135, 1010, 19021, 26947, 3501, 24463, 11451, 1008, 1008, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 1008, 2017, 2089, 2025...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#!/bin/sh ./test-_Exit${EXEEXT} test $? = 81
Distrotech/radius
gnulib/tests/test-_Exit.sh
Shell
gpl-3.0
46
[ 30522, 1001, 999, 1013, 8026, 1013, 14021, 1012, 1013, 3231, 1011, 1035, 6164, 1002, 1063, 4654, 4402, 18413, 1065, 3231, 1002, 1029, 1027, 6282, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
using FlatBuffers; using FlatBuffers.Schema; using Synchronica.Examples.Schema; using Synchronica.Replayers; using Synchronica.Schema; using System; using System.Collections.Generic; using System.IO; using System.Net.Sockets; using System.Threading; using UnityEngine; namespace Synchronica.Unity.Examples { class SimpleClient { private string name; private TcpClient tcpClient; private NetworkStream networkStream; private int objectId; private FlatBufferReplayer replayer = new FlatBufferReplayer(); private List<SynchronizeSceneData> sceneDataBuffer = new List<SynchronizeSceneData>(); private object sceneDataBufferLock = new object(); public SimpleClient(string name, string hostname, int port) { this.name = name; this.tcpClient = new TcpClient(); this.tcpClient.Connect(hostname, port); this.networkStream = this.tcpClient.GetStream(); Debug.Log(string.Format("Connected to {0}:{1}", hostname, port)); ThreadPool.QueueUserWorkItem(ReadThread); } public override string ToString() { return string.Format("{0}-{1}", GetType().Name, this.objectId); } private void ReadThread(object state) { var schema = new MessageSchema(); schema.Register(ServerMessageIds.LoginResponse, LoginResponse.GetRootAsLoginResponse); schema.Register(ServerMessageIds.SynchronizeSceneData, SynchronizeSceneData.GetRootAsSynchronizeSceneData); var processor = new MessageProcessor(schema); processor.Attach((int)ServerMessageIds.LoginResponse, OnLoginResponse); processor.Attach((int)ServerMessageIds.SynchronizeSceneData, OnSynchronizeSceneData); var buffer = new byte[this.tcpClient.ReceiveBufferSize]; while (this.networkStream.CanRead) { int readSize; try { readSize = this.networkStream.Read(buffer, 0, buffer.Length); } catch (IOException) { readSize = 0; } if (readSize == 0) { Debug.Log("Disconnected"); break; } var bytes = new byte[readSize]; Array.Copy(buffer, bytes, readSize); Debug.Log(string.Format("Received {0} bytes", readSize)); processor.Enqueue(bytes); processor.Process(); } } private void OnLoginResponse(Message msg) { var res = (LoginResponse)msg.Body; this.objectId = res.ObjectId; Debug.Log(string.Format("Login succeeded: {0}", this.objectId)); } private void OnSynchronizeSceneData(Message msg) { var data = (SynchronizeSceneData)msg.Body; lock (this.sceneDataBufferLock) { this.sceneDataBuffer.Add(data); } } public void Login() { var fbb = new FlatBufferBuilder(1024); var oName = fbb.CreateString(this.name); var oLogin = LoginRequest.CreateLoginRequest(fbb, oName); LoginRequest.FinishLoginRequestBuffer(fbb, oLogin); WriteBytes(FlatBufferExtensions.ToProtocolMessage(fbb, ClientMessageIds.LoginRequest)); Debug.Log("Login"); } public void Input(Command command) { var time = this.replayer.Scene.ElapsedTime; var fbb = new FlatBufferBuilder(1024); var oInput = InputRequest.CreateInputRequest(fbb, time, command); InputRequest.FinishInputRequestBuffer(fbb, oInput); WriteBytes(FlatBufferExtensions.ToProtocolMessage(fbb, ClientMessageIds.InputRequest)); Debug.Log(string.Format("Input {0} {1}ms", command, time)); } public void Update() { IEnumerable<SynchronizeSceneData> dataBuffer = null; lock (this.sceneDataBufferLock) { if (this.sceneDataBuffer.Count > 0) { dataBuffer = this.sceneDataBuffer; this.sceneDataBuffer = new List<SynchronizeSceneData>(); } } if (dataBuffer != null) { foreach (var data in dataBuffer) { //Debug.Log(string.Format("Replay: {0} -> {1}", data.StartTime, data.EndTime)); this.replayer.Replay(data.StartTime, data.EndTime, data); } } } private void WriteBytes(byte[] bytes) { Debug.Log(string.Format("Send {0} bytes", bytes.Length)); ThreadPool.QueueUserWorkItem(s => this.networkStream.Write(bytes, 0, bytes.Length)); } public FlatBufferReplayer Replayer { get { return this.replayer; } } } }
wuyuntao/Synchronica
SynchronicaUnityExamples/Assets/Scripts/SynchronicaUnityExamples/SimpleClient.cs
C#
mit
5,149
[ 30522, 2478, 4257, 8569, 12494, 2015, 1025, 2478, 4257, 8569, 12494, 2015, 1012, 8040, 28433, 1025, 2478, 26351, 8093, 12356, 2050, 1012, 4973, 1012, 8040, 28433, 1025, 2478, 26351, 8093, 12356, 2050, 1012, 15712, 2545, 1025, 2478, 26351, 8...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package ecologylab.serialization.deserializers.parsers.bibtex.entrytypes; import ecologylab.serialization.annotations.bibtex_tag; import ecologylab.serialization.annotations.bibtex_type; import ecologylab.serialization.annotations.simpl_inherit; import ecologylab.serialization.annotations.simpl_scalar; import ecologylab.serialization.annotations.simpl_tag; @simpl_inherit @simpl_tag("bibtex_techreport") @bibtex_type("techreport") public class BibTeXTechReport extends AbstractBibTeXEntry { // required fields @simpl_scalar @bibtex_tag("institution") private String institution; @simpl_scalar @bibtex_tag("type") private String type; @simpl_scalar @bibtex_tag("number") private long number; @simpl_scalar @bibtex_tag("address") private String address; public String getInstitution() { return institution; } public void setInstitution(String institution) { this.institution = institution; } public String getType() { return type; } public void setType(String type) { this.type = type; } public long getNumber() { return number; } public void setNumber(long number) { this.number = number; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } }
ecologylab/ecologylabFundamental
src/ecologylab/serialization/deserializers/parsers/bibtex/entrytypes/BibTeXTechReport.java
Java
lgpl-3.0
1,351
[ 30522, 7427, 13517, 20470, 1012, 7642, 3989, 1012, 4078, 11610, 28863, 2015, 1012, 11968, 8043, 2015, 1012, 12170, 19279, 10288, 1012, 4443, 13874, 2015, 1025, 12324, 13517, 20470, 1012, 7642, 3989, 1012, 5754, 17287, 9285, 1012, 12170, 19279...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# SortedArraySet SortedArraySet is a sorted collection of unique values, ordered by a comparator. The SortedArraySet in turn uses a SortedArray, but enforces uniqueness with its mutation methods. ``` npm install @collections/sorted-array-set ``` **Performance.** Owing to the compact allocation of arrays, a SortedArraySet will perform faster than a SortedSet for collections of less than about 500 values. **Configurability.** Provide an alternate `equals` and `compare` to alter the behavior of the set. The `equals` operator determines equivalence and `compare` determines order. The `compare` operator may return zero for both equivalent and incomparable values. **Observability.** Since the SortedArraySet inherits SortedArray, it mutates the underlying `array` property using observable methods. Observing range, map, and property changes on that array will work normally. ## Collections This package is part of the [collections][] project, one of many maintained in its shared repository. [collections]: https://github.com/kriskowal/collections ## License and Copyright Copyright (c) 2015 Kristopher Michael Kowal and contributors. All rights reserved. MIT License
kriskowal/collections
packages/sorted-array-set/README.md
Markdown
mit
1,182
[ 30522, 1001, 19616, 2906, 9447, 13462, 19616, 2906, 9447, 13462, 2003, 1037, 19616, 3074, 1997, 4310, 5300, 1010, 3641, 2011, 1037, 4012, 28689, 4263, 1012, 1996, 19616, 2906, 9447, 13462, 1999, 2735, 3594, 1037, 19616, 2906, 9447, 1010, 20...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package com.coverity.ws.v5; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for getCIDsForStreamsResponse complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="getCIDsForStreamsResponse"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="return" type="{http://www.w3.org/2001/XMLSchema}long" maxOccurs="unbounded" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "getCIDsForStreamsResponse", propOrder = { "_return" }) public class GetCIDsForStreamsResponse { @XmlElement(name = "return", type = Long.class) protected List<Long> _return; /** * Gets the value of the return property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the return property. * * <p> * For example, to add a new item, do as follows: * <pre> * getReturn().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link Long } * * */ public List<Long> getReturn() { if (_return == null) { _return = new ArrayList<Long>(); } return this._return; } }
hudson3-plugins/coverity-plugin
src/main/java/com/coverity/ws/v5/GetCIDsForStreamsResponse.java
Java
epl-1.0
1,883
[ 30522, 7427, 4012, 1012, 3104, 3012, 1012, 1059, 30524, 6305, 9623, 21756, 5051, 1025, 12324, 9262, 2595, 1012, 20950, 1012, 14187, 1012, 5754, 17287, 3508, 1012, 20950, 6305, 9623, 21748, 13874, 1025, 12324, 9262, 2595, 1012, 20950, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Expires" content="-1"> <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Cache-Control" content="no-cache"> <title>105年第十四任總統副總統及第九屆立法委員選舉</title> <link href="../css/style.css" rel="stylesheet" type="text/css"> <link href="../css/style2.css" rel="stylesheet" type="text/css"> <script type="text/javascript" src="../js/ftiens4.js"></script> <script type="text/javascript" src="../js/ua.js"></script> <script type="text/javascript" src="../js/func.js"></script> <script type="text/javascript" src="../js/treeP1.js"></script> <script type="text/javascript" src="../js/refresh.js"></script> </head> <body id="main-body"> <div id="main-header"> <div id="main-top"> <a class="main-top-logo" href="#">中央選舉委員會</a> <ul class="main-top-list"> <li class="main-top-item"><a class="main-top-link main-top-link-home" href="../index.html">回首頁</a></li> <li class="main-top-item"><a class="main-top-link main-top-link-cec" href="http://2016.cec.gov.tw">中選會網站</a></li> <li class="main-top-item"><a class="main-top-link main-top-link-english" href="../../en/index.html">English</a></li> </ul> </div> </div> <div id="main-wrap"> <div id="main-banner"> <div class="slideshow"> <img src="../img/main_bg_1.jpg" width="1024" height="300" alt="background" title="background"> </div> <div class="main-deco"></div> <div class="main-title"></div> <a class="main-pvpe main-pvpe-current" href="../IDX/indexP1.html">總統副總統選舉</a> <a class="main-le" href="../IDX/indexT.html">立法委員選舉</a> </div> <div id="main-container"> <div id="main-content"> <table width="1024" border="1" cellpadding="0" cellspacing="0"> <tr> <td width="180" valign="top"> <div id="divMenu"> <table border="0"> <tr> <td><a style="text-decoration:none;color:silver" href="http://www.treemenu.net/" target=_blank></a></td> </tr> </table> <span class="TreeviewSpanArea"> <script>initializeDocument()</script> <noscript>請開啟Javascript功能</noscript> </span> </div> </td> <td width="796" valign="top"> <div id="divContent"> <!-- 修改區塊 --> <table width="100%" border="0" cellpadding="0" cellspacing="4"> <tr> <td><img src="../images/search.png" alt="候選人得票數" title="候選人得票數">&nbsp;<b>總統副總統選舉&nbsp;候選人在 臺南市 歸仁區得票數&nbsp;</b></td> </tr> <tr valign="bottom"> <td> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr valign="bottom"> <td class="fontNumber">&nbsp;<img src="../images/nav.gif" alt="候選組數" title="候選組數">&nbsp;<img src="../images/nav.gif" alt="候選組數" title="候選組數">&nbsp;候選組數:3&nbsp;&nbsp;<img src="../images/nav.gif" alt="應選組數" title="應選組數">&nbsp;<img src="../images/nav.gif" alt="應選組數" title="應選組數">&nbsp;應選組數:1</td> <td align="right"> <select name="selector_order" class="selectC" tabindex="1" id="orderBy" onChange="changeOrder();"> <option value="n">依號次排序</option> <option value="s">依得票排序</option> </select> </td> </tr> </table> </td> </tr> <tr valign="top"> <td> <table width="100%" border="0" cellpadding="6" cellspacing="1" class="tableT"> <tr class="trHeaderT"> <td>註記</td> <td>號次</td> <td><table><tr><td>總統</td><td rowspan=2> 候選人姓名</td></tr><td>副總統</td></table></td> <td>性別</td> <td>得票數</td> <td>得票率%</td> <td>登記方式</td> </tr> <tr class="trT"> <td>&nbsp;</td> <td>1</td> <td>朱立倫<br>王如玄</td> <td>男<br>女</td> <td class="tdAlignRight">4,226</td> <td class="tdAlignRight">19.6348</td> <td>中國國民黨&nbsp; 推薦</td> </tr> <tr class="trT"> <td>&nbsp;</td> <td>2</td> <td>蔡英文<br>陳建仁</td> <td>女<br>男</td> <td class="tdAlignRight">15,404</td> <td class="tdAlignRight">71.5699</td> <td>民主進步黨&nbsp; 推薦</td> </tr> <tr class="trT"> <td>&nbsp;</td> <td>3</td> <td>宋楚瑜<br>徐欣瑩</td> <td>男<br>女</td> <td class="tdAlignRight">1,893</td> <td class="tdAlignRight">8.7952</td> <td>親民黨&nbsp; 推薦</td> </tr> <tr class="trFooterT"> <td colspan="7" align="right">投開票所數 已送/應送:&nbsp;29/45&nbsp;</td> </tr> </table> </td> </tr> <tr valign="top"> <td> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="10"></td> <td valign="top" class="fontNote"> <table> <tr> <td>註記說明:</td> <td align="center">◎</td> <td>自然當選</td> </tr> <tr> <td></td> <td align="center">?</td> <td>同票待抽籤</td> </tr> </table> </td> <td valign="top" class="fontTimer"><img src="../images/clock2.png" alt="Sat, 16 Jan 2016 18:45:11 +0800" title="Sat, 16 Jan 2016 18:45:11 +0800">&nbsp;資料更新時間:&nbsp;01/16&nbsp;18:45:06&nbsp;<br>(網頁每3分鐘自動更新一次)</td> </tr> <tr> <td colspan="3" class="fontNote"></td> </tr> </table> </td> </tr> </table> <!-- 修改區塊 --> </div> </td> </tr> </table> </div> <div class="main-footer"></div> <div id="divFooter" align=center>[中央選舉委員會] </div> <!--main-content--> </div><!--main-container--> </div><!--END main-wrap--> <script>setOrder();</script> <script>setMenuScrollPosY();</script> </body> </html>
gugod/vote-watch-2016
data/president/n500003500000000/20160116104603/page.html
HTML
cc0-1.0
6,577
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 2132, 1028, 1026, 18804, 8299, 1011, 1041, 15549, 2615, 1027, 1000, 4180, 1011, 2828, 1000, 4180, 1027, 1000, 3793, 1013, 16129, 1025, 25869, 13462, 1027, 21183, 2546, 1011, 1022, 1000, 1028...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <title>basic_seq_packet_socket::io_control (2 of 2 overloads)</title> <link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> <link rel="home" href="../../../../boost_asio.html" title="Boost.Asio"> <link rel="up" href="../io_control.html" title="basic_seq_packet_socket::io_control"> <link rel="prev" href="overload1.html" title="basic_seq_packet_socket::io_control (1 of 2 overloads)"> <link rel="next" href="../is_open.html" title="basic_seq_packet_socket::is_open"> </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="overload1.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../io_control.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../boost_asio.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../is_open.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> </div> <div class="section"> <div class="titlepage"><div><div><h5 class="title"> <a name="boost_asio.reference.basic_seq_packet_socket.io_control.overload2"></a><a class="link" href="overload2.html" title="basic_seq_packet_socket::io_control (2 of 2 overloads)">basic_seq_packet_socket::io_control (2 of 2 overloads)</a> </h5></div></div></div> <p> <span class="emphasis"><em>Inherited from basic_socket.</em></span> </p> <p> Perform an IO control command on the socket. </p> <pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span> <span class="keyword">typename</span> <a class="link" href="../../IoControlCommand.html" title="I/O control command requirements">IoControlCommand</a><span class="special">&gt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">system</span><span class="special">::</span><span class="identifier">error_code</span> <span class="identifier">io_control</span><span class="special">(</span> <span class="identifier">IoControlCommand</span> <span class="special">&amp;</span> <span class="identifier">command</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">system</span><span class="special">::</span><span class="identifier">error_code</span> <span class="special">&amp;</span> <span class="identifier">ec</span><span class="special">);</span> </pre> <p> This function is used to execute an IO control command on the socket. </p> <h6> <a name="boost_asio.reference.basic_seq_packet_socket.io_control.overload2.h0"></a> <span><a name="boost_asio.reference.basic_seq_packet_socket.io_control.overload2.parameters"></a></span><a class="link" href="overload2.html#boost_asio.reference.basic_seq_packet_socket.io_control.overload2.parameters">Parameters</a> </h6> <div class="variablelist"> <p class="title"><b></b></p> <dl> <dt><span class="term">command</span></dt> <dd><p> The IO control command to be performed on the socket. </p></dd> <dt><span class="term">ec</span></dt> <dd><p> Set to indicate what error occurred, if any. </p></dd> </dl> </div> <h6> <a name="boost_asio.reference.basic_seq_packet_socket.io_control.overload2.h1"></a> <span><a name="boost_asio.reference.basic_seq_packet_socket.io_control.overload2.example"></a></span><a class="link" href="overload2.html#boost_asio.reference.basic_seq_packet_socket.io_control.overload2.example">Example</a> </h6> <p> Getting the number of bytes ready to read: </p> <pre class="programlisting"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span> <span class="identifier">socket</span><span class="special">(</span><span class="identifier">io_service</span><span class="special">);</span> <span class="special">...</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span><span class="special">::</span><span class="identifier">bytes_readable</span> <span class="identifier">command</span><span class="special">;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">system</span><span class="special">::</span><span class="identifier">error_code</span> <span class="identifier">ec</span><span class="special">;</span> <span class="identifier">socket</span><span class="special">.</span><span class="identifier">io_control</span><span class="special">(</span><span class="identifier">command</span><span class="special">,</span> <span class="identifier">ec</span><span class="special">);</span> <span class="keyword">if</span> <span class="special">(</span><span class="identifier">ec</span><span class="special">)</span> <span class="special">{</span> <span class="comment">// An error occurred.</span> <span class="special">}</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">bytes_readable</span> <span class="special">=</span> <span class="identifier">command</span><span class="special">.</span><span class="identifier">get</span><span class="special">();</span> </pre> </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 &#169; 2003-2015 Christopher M. Kohlhoff<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="overload1.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../io_control.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../boost_asio.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../is_open.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> </div> </body> </html>
yinchunlong/abelkhan-1
ext/c++/thirdpart/c++/boost/libs/asio/doc/html/boost_asio/reference/basic_seq_packet_socket/io_control/overload2.html
HTML
mit
7,564
[ 30522, 1026, 16129, 1028, 1026, 2132, 1028, 1026, 18804, 8299, 1011, 1041, 15549, 2615, 1027, 1000, 4180, 1011, 2828, 1000, 4180, 1027, 1000, 3793, 1013, 16129, 1025, 25869, 13462, 1027, 2149, 1011, 2004, 6895, 2072, 1000, 1028, 1026, 2516,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package com.jy.controller.workflow.online.apply; import com.jy.common.ajax.AjaxRes; import com.jy.common.utils.DateUtils; import com.jy.common.utils.base.Const; import com.jy.common.utils.security.AccountShiroUtil; import com.jy.controller.base.BaseController; import com.jy.entity.attendance.WorkRecord; import com.jy.entity.oa.overtime.Overtime; import com.jy.entity.oa.patch.Patch; import com.jy.entity.oa.task.TaskInfo; import com.jy.service.oa.activiti.ActivitiDeployService; import com.jy.service.oa.overtime.OvertimeService; import com.jy.service.oa.patch.PatchService; import com.jy.service.oa.task.TaskInfoService; import org.activiti.engine.IdentityService; import org.activiti.engine.RuntimeService; import org.activiti.engine.TaskService; import org.activiti.engine.impl.persistence.entity.ExecutionEntity; import org.activiti.engine.runtime.ProcessInstance; import org.activiti.engine.task.Task; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; /** * 补卡页面 */ @Controller @RequestMapping(value = "/backstage/workflow/online/patch/") public class PatchController extends BaseController<Object> { private static final String SECURITY_URL = "/backstage/workflow/online/patch/index"; @Autowired private RuntimeService runtimeService; @Autowired private TaskService taskService; @Autowired private TaskInfoService taskInfoService; @Autowired private IdentityService identityService; @Autowired private PatchService patchService; @Autowired private ActivitiDeployService activitiDeployService; /** * 补卡列表 */ @RequestMapping(value = "index") public String index(org.springframework.ui.Model model) { if (doSecurityIntercept(Const.RESOURCES_TYPE_MENU)) { model.addAttribute("permitBtn", getPermitBtn(Const.RESOURCES_TYPE_FUNCTION)); return "/system/workflow/online/apply/patch"; } return Const.NO_AUTHORIZED_URL; } /** * 启动流程 */ @RequestMapping(value = "start", method = RequestMethod.POST) @ResponseBody public AjaxRes startWorkflow(Patch o) { AjaxRes ar = getAjaxRes(); if (ar.setNoAuth(doSecurityIntercept(Const.RESOURCES_TYPE_MENU, SECURITY_URL))) { try { String currentUserId = AccountShiroUtil.getCurrentUser().getAccountId(); String[] approvers = o.getApprover().split(","); Map<String, Object> variables = new HashMap<String, Object>(); for (int i = 0; i < approvers.length; i++) { variables.put("approver" + (i + 1), approvers[i]); } String workflowKey = "patch"; identityService.setAuthenticatedUserId(currentUserId); Date now = new Date(); ProcessInstance processInstance = runtimeService.startProcessInstanceByKeyAndTenantId(workflowKey, variables, getCompany()); String pId = processInstance.getId(); String leaveID = get32UUID(); o.setPid(pId); o.setAccountId(currentUserId); o.setCreatetime(now); o.setIsvalid(0); o.setName(AccountShiroUtil.getCurrentUser().getName()); o.setId(leaveID); patchService.insert(o); Task task = taskService.createTaskQuery().processInstanceId(pId).singleResult(); String processDefinitionName = ((ExecutionEntity) processInstance).getProcessInstance().getProcessDefinition().getName(); String subkect = processDefinitionName + "-" + AccountShiroUtil.getCurrentUser().getName() + "-" + DateUtils.formatDate(now, "yyyy-MM-dd HH:mm"); //开始流程 TaskInfo taskInfo = new TaskInfo(); taskInfo.setId(get32UUID()); taskInfo.setBusinesskey(leaveID); taskInfo.setCode("start"); taskInfo.setName("发起申请"); taskInfo.setStatus(0); taskInfo.setPresentationsubject(subkect); taskInfo.setAttr1(processDefinitionName); taskInfo.setCreatetime(DateUtils.addSeconds(now, -1)); taskInfo.setCompletetime(DateUtils.addSeconds(now, -1)); taskInfo.setCreator(currentUserId); taskInfo.setAssignee(currentUserId); taskInfo.setTaskid("0"); taskInfo.setPkey(workflowKey); taskInfo.setExecutionid("0"); taskInfo.setProcessinstanceid(processInstance.getId()); taskInfo.setProcessdefinitionid(processInstance.getProcessDefinitionId()); taskInfoService.insert(taskInfo); //第一级审批流程 taskInfo.setId(get32UUID()); taskInfo.setCode(processInstance.getActivityId()); taskInfo.setName(task.getName()); taskInfo.setStatus(1); taskInfo.setTaskid(task.getId()); taskInfo.setCreatetime(now); taskInfo.setCompletetime(null); taskInfo.setAssignee(approvers[0]); taskInfoService.insert(taskInfo); ar.setSucceedMsg("发起补卡申请成功!"); } catch (Exception e) { logger.error(e.toString(), e); ar.setFailMsg("启动流程失败"); } finally { identityService.setAuthenticatedUserId(null); } } return ar; } }
futureskywei/whale
src/main/java/com/jy/controller/workflow/online/apply/PatchController.java
Java
apache-2.0
5,402
[ 30522, 7427, 4012, 30524, 2691, 1012, 21183, 12146, 1012, 2918, 1012, 9530, 3367, 1025, 12324, 4012, 1012, 1046, 2100, 1012, 2691, 1012, 21183, 12146, 1012, 3036, 1012, 6115, 18334, 21823, 2140, 1025, 12324, 4012, 1012, 1046, 2100, 1012, 11...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package org.diorite.material.blocks; import org.diorite.BlockFace; /** * Representing fence gate blocks. */ public interface FenceGateMat extends DirectionalMat, OpenableMat { byte OPEN_FLAG = 0x4; /** * Returns one of gate sub-type based on facing direction and open state. * It will never return null. * * @param face facing direction of gate. * @param open if gate should be open. * * @return sub-type of gate */ FenceGateMat getType(BlockFace face, boolean open); static byte combine(final BlockFace face, final boolean open) { byte result = open ? OPEN_FLAG : 0x0; switch (face) { case WEST: result |= 0x1; break; case NORTH: result |= 0x2; break; case EAST: result |= 0x3; break; default: break; } return result; } }
joda17/Diorite-API
src/main/java/org/diorite/material/blocks/FenceGateMat.java
Java
mit
993
[ 30522, 7427, 8917, 1012, 4487, 10050, 2618, 1012, 3430, 1012, 5991, 1025, 12324, 8917, 1012, 4487, 10050, 2618, 1012, 3796, 12172, 1025, 1013, 1008, 1008, 1008, 5052, 8638, 4796, 5991, 1012, 1008, 1013, 2270, 8278, 8638, 5867, 18900, 8908, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
--- permalink: /articles/ layout: whitepage title: Blog thoughts etc page_class: blog description: Cubicflow retainers breakdown --- # Cubicflow Blog ## Heading 1 The web is a perpetually evolving platform. New devices, operating systems, and technologies get released on what seems like a daily basis. While it's certainly important to not let your investment stagnate or become incompatible as time marches on, it's equally important to take advantage of the opportunity to continuously enrich the user experience. We do these things to support, track, and grow&nbsp;your&nbsp;web&nbsp;presence. ### Heading 2 Websites made by Cubicflow use Google Analytics, the industry-standard for web traffic analysis. Our retainers include consulting meetings to examine the data gathered, where we draw conclusions on how to use this data effectively to improve&nbsp;your&nbsp;web&nbsp;presence. ### Modify We incorporate a bit of time each month to make incremental changes and requested edits, while&nbsp;also&nbsp;evaluating potential&nbsp;upgrades. ### Scale Your business expands, and you need to grow your project or kick off a new one. We consult on the possibilities and provide priority scheduling for starting&nbsp;a&nbsp;production&nbsp;sprint.
cubicflow/cubicflow
_pages/articles.md
Markdown
mit
1,253
[ 30522, 1011, 1011, 1011, 2566, 9067, 19839, 1024, 1013, 4790, 1013, 9621, 1024, 2317, 13704, 2516, 1024, 9927, 4301, 4385, 3931, 1035, 2465, 1024, 9927, 6412, 1024, 11919, 12314, 9279, 2545, 12554, 1011, 1011, 1011, 1001, 11919, 12314, 9927...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
//// config/database.js module.exports = { url: 'mongodb://gaurav:gaurav@dogen.mongohq.com:10056/cmpe275' };
gauravshiralkar/Freedoor
config/database.js
JavaScript
mit
114
[ 30522, 1013, 1013, 1013, 1013, 9530, 8873, 2290, 1013, 7809, 1012, 1046, 2015, 11336, 1012, 14338, 1027, 1063, 24471, 2140, 1024, 1005, 12256, 3995, 18939, 1024, 1013, 1013, 11721, 4648, 2615, 1024, 11721, 4648, 2615, 1030, 3899, 2368, 1012...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# MSH ## Beta Version ### Created by Ne02ptzero (Louis Solofrizzo), Fusiow (Ryad Kharif) and Ivory9334 (Aurelien Ardjoune) Stable version for **MacOSX** Work on **Linux**, but no manual completion (options & description of command) ## What's MSH ? Msh is a colorful shell to help beginners in learning Linux, but also to confirm that users desire to enjoy a visual comfort. ![alt text](screens/screen1.png) ____ ![alt text](screens/screen2.png) ____ ![alt text](screens/screen3.png) ____ ![alt text](screens/screen5.png) ____ #### Why? - The command is colored in blue if it exists, otherwise red. - When the command is good, all options for this command are posters suggestions. - In addition, there is an auto-completion on the options that allows to know the list of options for a command, and their utilites. - Autocompletion also on files as well as folders. #### Builtins: - Builtins environment (env, setenv and unsetenv) - Alias - Local Variables - Job Control - Configuration file - Advanced prompt ____ ![alt text](screens/screen4.png) For more information see the documentation (docs /). #### Installation: ##### -Compilation: git clone https://github.com/Ne02ptzero/msh.git && cd msh && make ##### -Installation: make install; (For 42 students) make install42; *(Copy the binary to ~/.brew/bin)* Launch with "msh" You don't want the amazing colored read ? Launch with -no-color options.
Ne02ptzero/msh
README.md
Markdown
gpl-2.0
1,435
[ 30522, 1001, 5796, 2232, 1001, 1001, 8247, 2544, 1001, 1001, 1001, 2580, 2011, 11265, 2692, 2475, 13876, 6290, 2080, 1006, 3434, 3948, 19699, 10993, 6844, 1007, 1010, 11865, 20763, 2860, 1006, 29431, 4215, 1047, 18428, 2546, 1007, 1998, 115...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php namespace SHC\Event; //Imports use RWF\Date\DateTime; use RWF\Util\StringUtils; use SHC\Condition\Condition; use SHC\Condition\ConditionEditor; use SHC\Core\SHC; use SHC\Switchable\Switchable; use SHC\Switchable\SwitchableEditor; /** * Ereignise Verwalten * * @author Oliver Kleditzsch * @copyright Copyright (c) 2014, Oliver Kleditzsch * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @since 2.0.0-0 * @version 2.0.0-0 */ class EventEditor { /** * Ereignis Luftfeuchte steigt * * @var Integer */ const EVENT_HUMIDITY_CLIMB = 1; /** * Ereignis Luftfeuchte faellt * * @var Integer */ const EVENT_HUMIDITY_FALLS = 2; /** * Ereignis Eingang wechselt von LOW auf HIGH * * @var Integer */ const EVENT_INPUT_HIGH = 4; /** * Ereignis EIngang wechselt von HIGH auf LOW * * @var Integer */ const EVENT_INPUT_LOW = 8; /** * Ereignis Lichtstaerke steigt * * @var Integer */ const EVENT_LIGHTINTENSITY_CLIMB = 16; /** * Ereignis Lichtsaerke faellt * * @var Integer */ const EVENT_LIGHTINTENSITY_FALLS = 32; /** * Ereignis Feuchtigkeit steigt * * @var Integer */ const EVENT_MOISTURE_CLIMB = 64; /** * Ereignis Feuchtigkeit steigt * * @var Integer */ const EVENT_MOISTURE_FALLS = 128; /** * Ereignis Temperatur steigt * * @var Integer */ const EVENT_TEMPERATURE_CLIMB = 256; /** * Ereignis Temperatur faellt * * @var Integer */ const EVENT_TEMPERATURE_FALLS = 512; /** * Ereignis Benutzer kommt nach Hause * * @var Integer */ const EVENT_USER_COMES_HOME = 1024; /** * Ereignis Benutzer verlaesst das Haus * * @var Integer */ const EVENT_USER_LEAVE_HOME = 2048; /** * Ereignis Sonnenaufgang * * @var Integer */ const EVENT_SUNRISE = 4096; /** * Ereignis Sonnenuntergang * * @var Integer */ const EVENT_SUNSET = 8192; /** * Ereignis Datei erstellt * * @var Integer */ const EVENT_FILE_CREATE = 16384; /** * Ereignis Datei geloescht * * @var Integer */ const EVENT_FILE_DELETE = 32768; /** * nach ID sortieren * * @var String */ const SORT_BY_ID = 'id'; /** * nach Namen sortieren * * @var String */ const SORT_BY_NAME = 'name'; /** * nicht sortieren * * @var String */ const SORT_NOTHING = 'unsorted'; /** * Ereignisse * * @var Array */ protected $events = array(); /** * Singleton Instanz * * @var \SHC\Event\EventEditor */ protected static $instance = null; /** * name der HashMap * * @var String */ protected static $tableName = 'shc:events'; protected function __construct() { $this->loadData(); } /** * laedt die Ereignisse aus den XML Daten und erzeugt die Objekte */ public function loadData() { //Daten Vorbereiten $oldEvents = $this->events; $this->events = array(); $events = SHC::getDatabase()->hGetAllArray(self::$tableName); //Daten einlesen foreach ($events as $event) { //Variablen Vorbereiten $class = (string) $event['class']; $data = array(); foreach ($event as $index => $value) { if (!in_array($index, array('id', 'name', 'class', 'enabled', 'conditions', 'lastExecute', 'switchable'))) { $data[$index] = $value; } } /* @var $eventObj \SHC\Event\Event */ $eventObj = new $class( (int) $event['id'], (string) $event['name'], $data, ((int) $event['enabled'] == true ? true : false), DateTime::createFromDatabaseDateTime((string) $event['lastExecute']) ); //Bedingungen anhaengen foreach ($event['conditions'] as $conditionId) { $condition = ConditionEditor::getInstance()->getConditionByID($conditionId); if ($condition instanceof Condition) { $eventObj->addCondition($condition); } } //schaltbare Elemente Hinzufuegen if(isset($event['switchable'])) { foreach ($event['switchable'] as $switchable) { $switchableObject = SwitchableEditor::getInstance()->getElementById((int) $switchable['id']); if ($switchableObject instanceof Switchable) { $eventObj->addSwitchable($switchableObject, (int) $switchable['command']); } } } //Objekt status vom alten Objekt ins neue übertragen if(isset($oldEvents[(int) $event['id']])) { /* @var $eventObj \SHC\Event\Event */ $eventObj->setState($oldEvents[(int) $event['id']]->getState()); if($oldEvents[(int) $event['id']]->getTime() instanceof DateTime) { $eventObj->setTime($oldEvents[(int) $event['id']]->getTime()); } } $this->events[(int) $event['id']] = $eventObj; } } /** * gibt das Ereignis mit der IOD zurueck * * @param int $id Ereignis ID * @return \SHC\Event\Event */ public function getEventById($id) { if (isset($this->events[$id])) { return $this->events[$id]; } return null; } /** * prueft ob der Name des Events schon verwendet wird * * @param String $name Name * @return Boolean */ public function isEventNameAvailable($name) { foreach ($this->events as $event) { /* @var $condition \SHC\Event\Event */ if (StringUtils::toLower($event->getName()) == StringUtils::toLower($name)) { return false; } } return true; } /** * gibt eine Liste mit allen Bedingungen zurueck * * @param String $orderBy Art der Sortierung ( * id => nach ID sorieren, * name => nach Namen sortieren, * unsorted => unsortiert * ) * @return Array */ public function listEvents($orderBy = 'id') { if ($orderBy == 'id') { //nach ID sortieren $events = $this->events; ksort($events, SORT_NUMERIC); return $events; } elseif ($orderBy == 'name') { //nach Namen sortieren $events = $this->events; //Sortierfunktion $orderFunction = function($a, $b) { if ($a->getName() == $b->getName()) { return 0; } if ($a->getName() < $b->getName()) { return -1; } return 1; }; usort($events, $orderFunction); return $events; } return $this->events; } /** * erstellt ein Event * * @param String $class Klassenname * @param String $name Name * @param Boolean $enabled Aktiv * @param Array $data Zusatzdaten * @param Array $conditions Liste der Bedingunen * @return Boolean * @throws \Exception */ protected function addEvent($class, $name, array $data = array(), $enabled = true, array $conditions) { //Ausnahme wenn Name des Events schon belegt if (!$this->isEventNameAvailable($name)) { throw new \Exception('Der Name des Events ist schon vergeben', 1502); } $db = SHC::getDatabase(); $index = $db->autoIncrement(self::$tableName); $newEvent = array( 'id' => $index, 'class' => $class, 'name' => $name, 'enabled' => ($enabled == true ? true : false), 'conditions' => $conditions, 'lastExecute' => '2000-01-01 00:00:00', 'switchable' => array() ); foreach ($data as $tag => $value) { if (!in_array($tag, array('id', 'name', 'class', 'enabled', 'conditions', 'lastExecute', 'switchable'))) { $newEvent[$tag] = $value; } } if($db->hSetNxArray(self::$tableName, $index, $newEvent) == 0) { return false; } return true; } /** * bearbeitet ein Event * * @param Integer $id ID * @param String $name Name * @param Array $data Zusatzdaten * @param Boolean $enabled Aktiv * @param Array $conditions Liste der Bedingunen * @return Boolean * @throws \Exception */ protected function editEvent($id, $name = null, array $data = null, $enabled = null, array $conditions = null) { $db = SHC::getDatabase(); //pruefen ob Datensatz existiert if($db->hExists(self::$tableName, $id)) { $event = $db->hGetArray(self::$tableName, $id); //Name if ($name !== null) { //Ausnahme wenn Name der Bedingung schon belegt if ((string) $event['name'] != $name && !$this->isEventNameAvailable($name)) { throw new \Exception('Der Name der Bedingung ist schon vergeben', 1502); } $event['name'] = $name; } //Aktiv if ($enabled !== null) { $event['enabled'] = ($enabled == true ? 1 : 0); } //Bedingungen if($conditions !== null) { $event['conditions'] = implode(',', $conditions); } //Zusatzdaten foreach($data as $tag => $value) { if (!in_array($tag, array('id', 'name', 'class', 'enabled', 'conditions', 'lastExecute', 'switchable'))) { if($value !== null) { $event[$tag] = $value; } } } if($db->hSetArray(self::$tableName, $id, $event) == 0) { return true; } } return false; } /** * Speichert den Zeitpunkt der letzten Ausfuehrung fuer ein Ereignis * * @param Integer $id Ereignis ID * @param \RWF\Date\DateTime $lastExecute letzte Ausfuehrung * @return Boolean */ public function updateLastExecute($id, DateTime $lastExecute) { $db = SHC::getDatabase(); //pruefen ob Datensatz existiert if($db->hExists(self::$tableName, $id)) { $event = $db->hGetArray(self::$tableName, $id); if(isset($event['id']) && $event['id'] == $id) { $event['lastExecute'] = $lastExecute->getDatabaseDateTime(); if($db->hSetArray(self::$tableName, $id, $event) == 0) { return true; } } else { //Datensatz nicht mehr vorhanden return false; } } return false; } /** * erstellt ein Luftfeuchte Event * * @param String $name Name * @param Boolean $enabled Aktiviert * @param Array $sensors Sensoren * @param Float $limit Grenzwert (Prozent) * @param Integer $interval Sperrzeit * @param Array $conditions Liste der Bedingunen * @return bool */ public function addHumidityClimbOverEvent($name, $enabled, array $sensors, $limit, $interval, array $conditions = array()) { //Daten vorbereiten $data = array( 'sensors' => implode(',', $sensors), 'limit' => $limit, 'interval' => $interval ); //Speichern return $this->addEvent('\SHC\Event\Events\HumidityClimbOver', $name, $data, $enabled, $conditions); } /** * bearbeitet ein Luftfeuchte Event * * @param Integer $id ID * @param String $name Name * @param Boolean $enabled Aktiviert * @param Array $sensors Sensoren * @param Float $limit Grenzwert (Prozent) * @param Integer $interval Sperrzeit * @param Array $conditions Liste der Bedingunen * @return bool */ public function editHumidityClimbOverEvent($id, $name = null, $enabled = null, array $sensors = null, $limit = null, $interval = null, array $conditions = null) { //Daten vorbereiten $data = array( 'sensors' => implode(',', $sensors), 'limit' => $limit, 'interval' => $interval ); //Speichern return $this->editEvent($id, $name, $data, $enabled, $conditions); } /** * erstellt ein Luftfeuchte Event * * @param String $name Name * @param Boolean $enabled Aktiviert * @param Array $sensors Sensoren * @param Float $limit Grenzwert (Prozent) * @param Integer $interval Sperrzeit * @param Array $conditions Liste der Bedingunen * @return bool */ public function addHumidityFallsBelowEvent($name, $enabled, array $sensors, $limit, $interval, array $conditions = array()) { //Daten vorbereiten $data = array( 'sensors' => implode(',', $sensors), 'limit' => $limit, 'interval' => $interval ); //Speichern return $this->addEvent('\SHC\Event\Events\HumidityFallsBelow', $name, $data, $enabled, $conditions); } /** * bearbeitet ein Luftfeuchte Event * * @param Integer $id ID * @param String $name Name * @param Boolean $enabled Aktiviert * @param Array $sensors Sensoren * @param Float $limit Grenzwert (Prozent) * @param Integer $interval Sperrzeit * @param Array $conditions Liste der Bedingunen * @return bool */ public function editHumidityFallsBelowEvent($id, $name = null, $enabled = null, array $sensors = null, $limit = null, $interval = null, array $conditions = null) { //Daten vorbereiten $data = array( 'sensors' => implode(',', $sensors), 'limit' => $limit, 'interval' => $interval ); //Speichern return $this->editEvent($id, $name, $data, $enabled, $conditions); } /** * erstellt ein Lichtstaerke Event * * @param String $name Name * @param Boolean $enabled Aktiviert * @param Array $sensors Sensoren * @param Float $limit Grenzwert (Prozent) * @param Integer $interval Sperrzeit * @param Array $conditions Liste der Bedingunen * @return bool */ public function addLightIntensityClimbOverEvent($name, $enabled, array $sensors, $limit, $interval, array $conditions = array()) { //Daten vorbereiten $data = array( 'sensors' => implode(',', $sensors), 'limit' => $limit, 'interval' => $interval ); //Speichern return $this->addEvent('\SHC\Event\Events\LightIntensityClimbOver', $name, $data, $enabled, $conditions); } /** * bearbeitet ein Lichtstaerke Event * * @param Integer $id ID * @param String $name Name * @param Boolean $enabled Aktiviert * @param Array $sensors Sensoren * @param Float $limit Grenzwert (Prozent) * @param Integer $interval Sperrzeit * @param Array $conditions Liste der Bedingunen * @return bool */ public function editLightIntensityClimbOverEvent($id, $name = null, $enabled = null, array $sensors = null, $limit = null, $interval = null, array $conditions = null) { //Daten vorbereiten $data = array( 'sensors' => implode(',', $sensors), 'limit' => $limit, 'interval' => $interval ); //Speichern return $this->editEvent($id, $name, $data, $enabled, $conditions); } /** * erstellt ein Lichtstaerke Event * * @param String $name Name * @param Boolean $enabled Aktiviert * @param Array $sensors Sensoren * @param Float $limit Grenzwert (Prozent) * @param Integer $interval Sperrzeit * @param Array $conditions Liste der Bedingunen * @return bool */ public function addLightIntensityFallsBelowEvent($name, $enabled, array $sensors, $limit, $interval, array $conditions = array()) { //Daten vorbereiten $data = array( 'sensors' => implode(',', $sensors), 'limit' => $limit, 'interval' => $interval ); //Speichern return $this->addEvent('\SHC\Event\Events\LightIntensityFallsBelow', $name, $data, $enabled, $conditions); } /** * bearbeitet ein Lichtstaerke Event * * @param Integer $id ID * @param String $name Name * @param Boolean $enabled Aktiviert * @param Array $sensors Sensoren * @param Float $limit Grenzwert (Prozent) * @param Integer $interval Sperrzeit * @param Array $conditions Liste der Bedingunen * @return bool */ public function editLightIntensityFallsBelowEvent($id, $name = null, $enabled = null, array $sensors = null, $limit = null, $interval = null, array $conditions = null) { //Daten vorbereiten $data = array( 'sensors' => implode(',', $sensors), 'limit' => $limit, 'interval' => $interval ); //Speichern return $this->editEvent($id, $name, $data, $enabled, $conditions); } /** * erstellt ein Feuchtigkeits Event * * @param String $name Name * @param Boolean $enabled Aktiviert * @param Array $sensors Sensoren * @param Float $limit Grenzwert (Prozent) * @param Integer $interval Sperrzeit * @param Array $conditions Liste der Bedingunen * @return bool */ public function addMoistureClimbOverEvent($name, $enabled, array $sensors, $limit, $interval, array $conditions = array()) { //Daten vorbereiten $data = array( 'sensors' => implode(',', $sensors), 'limit' => $limit, 'interval' => $interval ); //Speichern return $this->addEvent('\SHC\Event\Events\MoistureClimbOver', $name, $data, $enabled, $conditions); } /** * bearbeitet ein Feuchtigkeits Event * * @param Integer $id ID * @param String $name Name * @param Boolean $enabled Aktiviert * @param Array $sensors Sensoren * @param Float $limit Grenzwert (Prozent) * @param Integer $interval Sperrzeit * @param Array $conditions Liste der Bedingunen * @return bool */ public function editMoistureClimbOverEvent($id, $name = null, $enabled = null, array $sensors = null, $limit = null, $interval = null, array $conditions = null) { //Daten vorbereiten $data = array( 'sensors' => implode(',', $sensors), 'limit' => $limit, 'interval' => $interval ); //Speichern return $this->editEvent($id, $name, $data, $enabled, $conditions); } /** * erstellt ein Feuchtigkeits Event * * @param String $name Name * @param Boolean $enabled Aktiviert * @param Array $sensors Sensoren * @param Float $limit Grenzwert (Prozent) * @param Integer $interval Sperrzeit * @param Array $conditions Liste der Bedingunen * @return bool */ public function addMoistureFallsBelowEvent($name, $enabled, array $sensors, $limit, $interval, array $conditions = array()) { //Daten vorbereiten $data = array( 'sensors' => implode(',', $sensors), 'limit' => $limit, 'interval' => $interval ); //Speichern return $this->addEvent('\SHC\Event\Events\MoistureFallsBelow', $name, $data, $enabled, $conditions); } /** * bearbeitet ein Feuchtigkeits Event * * @param Integer $id ID * @param String $name Name * @param Boolean $enabled Aktiviert * @param Array $sensors Sensoren * @param Float $limit Grenzwert (Prozent) * @param Integer $interval Sperrzeit * @param Array $conditions Liste der Bedingunen * @return bool */ public function editMoistureFallsBelowEvent($id, $name = null, $enabled = null, array $sensors = null, $limit = null, $interval = null, array $conditions = null) { //Daten vorbereiten $data = array( 'sensors' => implode(',', $sensors), 'limit' => $limit, 'interval' => $interval ); //Speichern return $this->editEvent($id, $name, $data, $enabled, $conditions); } /** * erstellt ein Temperatur Event * * @param String $name Name * @param Boolean $enabled Aktiviert * @param Array $sensors Sensoren * @param Float $limit Grenzwert * @param Integer $interval Sperrzeit * @param Array $conditions Liste der Bedingunen * @return bool */ public function addTemperatureClimbOverEvent($name, $enabled, array $sensors, $limit, $interval, array $conditions = array()) { //Daten vorbereiten $data = array( 'sensors' => implode(',', $sensors), 'limit' => $limit, 'interval' => $interval ); //Speichern return $this->addEvent('\SHC\Event\Events\TemperatureClimbOver', $name, $data, $enabled, $conditions); } /** * bearbeitet ein Temperatur Event * * @param Integer $id ID * @param String $name Name * @param Boolean $enabled Aktiviert * @param Array $sensors Sensoren * @param Float $limit Grenzwert * @param Integer $interval Sperrzeit * @param Array $conditions Liste der Bedingunen * @return bool */ public function editTemperatureClimbOverEvent($id, $name = null, $enabled = null, array $sensors = null, $limit = null, $interval = null, array $conditions = null) { //Daten vorbereiten $data = array( 'sensors' => implode(',', $sensors), 'limit' => $limit, 'interval' => $interval ); //Speichern return $this->editEvent($id, $name, $data, $enabled, $conditions); } /** * erstellt ein Temperatur Event * * @param String $name Name * @param Boolean $enabled Aktiviert * @param Array $sensors Sensoren * @param Float $limit Grenzwert * @param Integer $interval Sperrzeit * @param Array $conditions Liste der Bedingunen * @return bool */ public function addTemperatureFallsBelowEvent($name, $enabled, array $sensors, $limit, $interval, array $conditions = array()) { //Daten vorbereiten $data = array( 'sensors' => implode(',', $sensors), 'limit' => $limit, 'interval' => $interval ); //Speichern return $this->addEvent('\SHC\Event\Events\TemperatureFallsBelow', $name, $data, $enabled, $conditions); } /** * bearbeitet ein Temperatur Event * * @param Integer $id ID * @param String $name Name * @param Boolean $enabled Aktiviert * @param Array $sensors Sensoren * @param Float $limit Grenzwert * @param Integer $interval Sperrzeit * @param Array $conditions Liste der Bedingunen * @return bool */ public function editTemperatureFallsBelowEvent($id, $name = null, $enabled = null, array $sensors = null, $limit = null, $interval = null, array $conditions = null) { //Daten vorbereiten $data = array( 'sensors' => implode(',', $sensors), 'limit' => $limit, 'interval' => $interval ); //Speichern return $this->editEvent($id, $name, $data, $enabled, $conditions); } /** * erstellt ein Eingangsevent * * @param String $name Name * @param Boolean $enabled Aktiviert * @param Array $inputs Eingaenge * @param Integer $interval Sperrzeit * @param Array $conditions Liste der Bedingunen * @return bool */ public function addInputHighEvent($name, $enabled, array $inputs, $interval, array $conditions = array()) { //Daten vorbereiten $data = array( 'inputs' => implode(',', $inputs), 'interval' => $interval ); //Speichern return $this->addEvent('\SHC\Event\Events\InputHigh', $name, $data, $enabled, $conditions); } /** * bearbeitet ein Eingangsevent * * @param Integer $id ID * @param String $name Name * @param Boolean $enabled Aktiviert * @param Array $inputs Eingaenge * @param Integer $interval Sperrzeit * @param Array $conditions Liste der Bedingunen * @return bool */ public function editInputHighEvent($id, $name = null, $enabled = null, array $inputs = null, $interval = null, array $conditions = null) { //Daten vorbereiten $data = array( 'inputs' => implode(',', $inputs), 'interval' => $interval ); //Speichern return $this->editEvent($id, $name, $data, $enabled, $conditions); } /** * erstellt ein Eingangsevent * * @param String $name Name * @param Boolean $enabled Aktiviert * @param Array $inputs Eingaenge * @param Integer $interval Sperrzeit * @param Array $conditions Liste der Bedingunen * @return bool */ public function addInputLowEvent($name, $enabled, array $inputs, $interval, array $conditions = array()) { //Daten vorbereiten $data = array( 'inputs' => implode(',', $inputs), 'interval' => $interval ); //Speichern return $this->addEvent('\SHC\Event\Events\InputLow', $name, $data, $enabled, $conditions); } /** * bearbeitet ein Eingangsevent * * @param Integer $id ID * @param String $name Name * @param Boolean $enabled Aktiviert * @param Array $inputs Eingaenge * @param Integer $interval Sperrzeit * @param Array $conditions Liste der Bedingunen * @return bool */ public function editInputLowEvent($id, $name = null, $enabled = null, array $inputs = null, $interval = null, array $conditions = null) { //Daten vorbereiten $data = array( 'inputs' => implode(',', $inputs), 'interval' => $interval ); //Speichern return $this->editEvent($id, $name, $data, $enabled, $conditions); } /** * erstellt ein Benutzerevent * * @param String $name Name * @param Boolean $enabled Aktiviert * @param Array $users benutzer zu Hause * @param Integer $interval Sperrzeit * @param Array $conditions Liste der Bedingunen * @return bool */ public function addUserComesHomeEvent($name, $enabled, array $users, $interval, array $conditions = array()) { //Daten vorbereiten $data = array( 'users' => implode(',', $users), 'interval' => $interval ); //Speichern return $this->addEvent('\SHC\Event\Events\UserComesHome', $name, $data, $enabled, $conditions); } /** * bearbeitet ein Benutzerevent * * @param Integer $id ID * @param String $name Name * @param Boolean $enabled Aktiviert * @param Array $users benutzer zu Hause * @param Integer $interval Sperrzeit * @param Array $conditions Liste der Bedingunen * @return bool */ public function editUserComesHomeEvent($id, $name = null, $enabled = null, array $users = null, $interval = null, array $conditions = null) { //Daten vorbereiten $data = array( 'users' => implode(',', $users), 'interval' => $interval ); //Speichern return $this->editEvent($id, $name, $data, $enabled, $conditions); } /** * erstellt ein Benutzerevent * * @param String $name Name * @param Boolean $enabled Aktiviert * @param Array $users benutzer zu Hause * @param Integer $interval Sperrzeit * @param Array $conditions Liste der Bedingunen * @return bool */ public function addUserLeavesHomeEvent($name, $enabled, array $users, $interval, array $conditions = array()) { //Daten vorbereiten $data = array( 'users' => implode(',', $users), 'interval' => $interval ); //Speichern return $this->addEvent('\SHC\Event\Events\UserLeavesHome', $name, $data, $enabled, $conditions); } /** * bearbeitet ein Benutzerevent * * @param Integer $id ID * @param String $name Name * @param Boolean $enabled Aktiviert * @param Array $users benutzer zu Hause * @param Integer $interval Sperrzeit * @param Array $conditions Liste der Bedingunen * @return bool */ public function editUserLeavesHomeEvent($id, $name = null, $enabled = null, array $users = null, $interval = null, array $conditions = null) { //Daten vorbereiten $data = array( 'users' => implode(',', $users), 'interval' => $interval ); //Speichern return $this->editEvent($id, $name, $data, $enabled, $conditions); } /** * erstellt ein neuen Event Sonnenaufgang * * @param String $name Name * @param Boolean $enabled Aktiviert * @param Array $conditions Liste der Bedingunen */ public function addSunriseEvent($name, $enabled, array $conditions = null) { //Speichern return $this->addEvent('\SHC\Event\Events\Sunrise', $name, array(), $enabled, $conditions); } /** * bearbeitet ein Event Sonnenaufgang * * @param Integer $id ID * @param String $name Name * @param Boolean $enabled Aktiviert * @param Array $conditions Liste der Bedingunen */ public function editSunriseEvent($id, $name = null, $enabled = null, array $conditions = null) { //Speichern return $this->editEvent($id, $name, array(), $enabled, $conditions); } /** * erstellt ein neuen Event Sonnenuntergang * * @param String $name Name * @param Boolean $enabled Aktiviert * @param Array $conditions Liste der Bedingunen */ public function addSunsetEvent($name, $enabled, array $conditions = null) { //Speichern return $this->addEvent('\SHC\Event\Events\Sunset', $name, array(), $enabled, $conditions); } /** * bearbeitet ein Event Sonnenuntergang * * @param Integer $id ID * @param String $name Name * @param Boolean $enabled Aktiviert * @param Array $conditions Liste der Bedingunen */ public function editSunsetEvent($id, $name = null, $enabled = null, array $conditions = null) { //Speichern return $this->editEvent($id, $name, array(), $enabled, $conditions); } /** * erstellt ein Datei erstellt Event * * @param String $name Name * @param Boolean $enabled Aktiviert * @param String $file Datei * @param Integer $interval Sperrzeit * @param Array $conditions Liste der Bedingunen * @return bool */ public function addFileCreateEvent($name, $enabled, $file, $interval, array $conditions = array()) { //Daten vorbereiten $data = array( 'file' => $file, 'interval' => $interval ); //Speichern return $this->addEvent('\SHC\Event\Events\FileCreate', $name, $data, $enabled, $conditions); } /** * bearbeitet ein Datei erstellt Event * * @param Integer $id ID * @param String $name Name * @param Boolean $enabled Aktiviert * @param String $file Datei * @param Integer $interval Sperrzeit * @param Array $conditions Liste der Bedingunen * @return bool */ public function editFileCreateEvent($id, $name = null, $enabled = null, $file = null, $interval = null, array $conditions = null) { //Daten vorbereiten $data = array( 'file' => $file, 'interval' => $interval ); //Speichern return $this->editEvent($id, $name, $data, $enabled, $conditions); } /** * erstellt ein Datei geloescht Event * * @param String $name Name * @param Boolean $enabled Aktiviert * @param String $file Datei * @param Integer $interval Sperrzeit * @param Array $conditions Liste der Bedingunen * @return bool */ public function addFileDeleteEvent($name, $enabled, $file, $interval, array $conditions = array()) { //Daten vorbereiten $data = array( 'file' => $file, 'interval' => $interval ); //Speichern return $this->addEvent('\SHC\Event\Events\FileDelete', $name, $data, $enabled, $conditions); } /** * bearbeitet ein Datei geloescht Event * * @param Integer $id ID * @param String $name Name * @param Boolean $enabled Aktiviert * @param String $file Datei * @param Integer $interval Sperrzeit * @param Array $conditions Liste der Bedingunen * @return bool */ public function editFileDeleteEvent($id, $name = null, $enabled = null, $file = null, $interval = null, array $conditions = null) { //Daten vorbereiten $data = array( 'file' => $file, 'interval' => $interval ); //Speichern return $this->editEvent($id, $name, $data, $enabled, $conditions); } /** * loascht ein Event * * @param Integer $id ID * @return Boolean */ public function removeEvent($id) { $db = SHC::getDatabase(); //pruefen ob Datensatz existiert if($db->hExists(self::$tableName, $id)) { if($db->hDel(self::$tableName, $id)) { return true; } } return false; } /** * fuegt einem Event eine Bedingung hinzu * * @param Integer $eventId ID des Events * @param Integer $conditionId ID der Bedingung * @return Boolean */ public function addConditionToEvent($eventId, $conditionId) { $db = SHC::getDatabase(); //pruefen ob Datensatz existiert if($db->hExists(self::$tableName, $eventId)) { $event = $db->hGetArray(self::$tableName, $eventId); $event['conditions'][] = $conditionId; if($db->hSetArray(self::$tableName, $eventId, $event) == 0) { return true; } } return false; } /** * entfernt eine Bedingung aus einem Event * * @param Integer $eventId ID des Events * @param Integer $conditionId ID der Bedingung * @return Boolean */ public function removeConditionFromEvent($eventId, $conditionId) { $db = SHC::getDatabase(); //pruefen ob Datensatz existiert if($db->hExists(self::$tableName, $eventId)) { $event = $db->hGetArray(self::$tableName, $eventId); $event['conditions'] = array_diff($event['conditions'], array($conditionId)); if($db->hSetArray(self::$tableName, $eventId, $event) == 0) { return true; } } return false; } /** * fuegt einem Event ein Schaltbares Element hinzu * * @param Integer $eventId ID des Events * @param Integer $switchableId ID des Schaltbaren Elements * @param Integer $command Befehl * @return Boolean */ public function addSwitchableToEvent($eventId, $switchableId, $command) { $db = SHC::getDatabase(); //pruefen ob Datensatz existiert if($db->hExists(self::$tableName, $eventId)) { $event = $db->hGetArray(self::$tableName, $eventId); $event['switchable'][] = array('id' => $switchableId, 'command' => $command); if($db->hSetArray(self::$tableName, $eventId, $event) == 0) { return true; } } return false; } /** * setzt den Befehl eines Schaltbaren Elements in einem Event * * @param Integer $eventId ID des Events * @param Integer $switchableId ID des Schaltbaren Elements * @param Integer $command Befehl * @return Boolean */ public function setEventSwitchableCommand($eventId, $switchableId, $command) { $db = SHC::getDatabase(); //pruefen ob Datensatz existiert if($db->hExists(self::$tableName, $eventId)) { $event = $db->hGetArray(self::$tableName, $eventId); foreach($event['switchable'] as $index => $switchable) { if($switchable['id'] == $switchableId) { $event['switchable'][$index]['command'] = $command; break; } } if($db->hSetArray(self::$tableName, $eventId, $event) == 0) { return true; } } return false; } /** * entfernt ein Schaltbares Element von einem Event * * @param Integer $eventId ID des Events * @param Integer $switchableId ID des Schaltbaren Elements * @return Boolean */ public function removeSwitchableFromEvent($eventId, $switchableId) { $db = SHC::getDatabase(); //pruefen ob Datensatz existiert if($db->hExists(self::$tableName, $eventId)) { $event = $db->hGetArray(self::$tableName, $eventId); foreach($event['switchable'] as $index => $switchable) { if($switchable['id'] == $switchableId) { unset($event['switchable'][$index]); break; } } if($db->hSetArray(self::$tableName, $eventId, $event) == 0) { return true; } } return false; } /** * geschuetzt wegen Singleton */ private function __clone() { } /** * gibt den Ereignis Editor Editor zurueck * * @return \SHC\Event\EventEditor */ public static function getInstance() { if (self::$instance === null) { self::$instance = new EventEditor(); } return self::$instance; } }
agent4788/SHC_Framework
shc/lib/event/eventeditor.class.php
PHP
gpl-3.0
39,876
[ 30522, 1026, 1029, 25718, 3415, 15327, 14021, 2278, 1032, 2724, 1025, 1013, 1013, 17589, 2224, 1054, 2860, 2546, 1032, 3058, 1032, 3058, 7292, 1025, 2224, 1054, 2860, 2546, 1032, 21183, 4014, 1032, 5164, 21823, 4877, 1025, 2224, 14021, 2278...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
import logging from mimeprovider.documenttype import get_default_document_types from mimeprovider.client import get_default_client from mimeprovider.exceptions import MimeException from mimeprovider.exceptions import MimeBadRequest from mimeprovider.mimerenderer import MimeRenderer from mimeprovider.validators import get_default_validator __all__ = ["MimeProvider"] __version__ = "0.1.5" log = logging.getLogger(__name__) def build_json_ref(request): def json_ref(route, document=None, **kw): ref = dict() ref["$ref"] = request.route_path(route, **kw) rel_default = None if document: rel_default = getattr(document, "object_type", document.__class__.__name__) else: rel_default = route ref["rel"] = kw.pop("rel_", rel_default) return ref return json_ref class MimeProvider(object): def __init__(self, documents=[], **kw): self.renderer_name = kw.get("renderer_name", "mime") self.attribute_name = kw.get("attribute_name", "mime_body") self.error_handler = kw.get("error_handler", None) self.set_default_renderer = kw.get("set_default_renderer", False) self.validator = kw.get("validator") if self.validator is None: self.validator = get_default_validator() types = kw.get("types") if types is None: types = get_default_document_types() if not types: raise ValueError("No document types specified") self.client = kw.get("client") if self.client is None: self.client = get_default_client() self.type_instances = [t() for t in types] self.mimeobjects = dict() self.mimetypes = dict(self._generate_base_mimetypes()) self.error_document_type = kw.get( "error_document_type", self.type_instances[0]) self.register(*documents) def _validate(self, document): if not hasattr(document, "object_type"): raise ValueError( ("Object does not have required 'object_type' " "attribute {0!r}").format(document)) def _generate_base_mimetypes(self): """ Generate the base mimetypes as described by non customized document types. """ for t in self.type_instances: if t.custom_mime: continue yield t.mime, (t, None, None) def _generate_document_mimetypes(self, documents): for t in self.type_instances: if not t.custom_mime: continue for o in documents: mimetype = t.mime.format(o=o) validator = None if hasattr(o, "schema"): validator = self.validator(o.schema) m_value = (mimetype, (t, o, validator)) o_value = (o, (t, mimetype, validator)) yield m_value, o_value def register(self, *documents): documents = list(documents) for document in documents: self._validate(document) generator = self._generate_document_mimetypes(documents) for (m, m_value), (o, o_value) in generator: self.mimeobjects.setdefault(o, []).append(o_value) if m not in self.mimetypes: self.mimetypes[m] = m_value continue _, cls, validator = self.mimetypes[m] _, new_cls, validator = m_value raise ValueError( "Conflicting handler for {0}, {1} and {2}".format( m, cls, new_cls)) def get_client(self, *args, **kw): return self.client(self.mimetypes, self.mimeobjects, *args, **kw) def get_mime_body(self, request): if not request.body or not request.content_type: return None result = self.mimetypes.get(request.content_type) if result is None: raise MimeBadRequest( "Unsupported Content-Type: " + request.content_type) document_type, cls, validator = result # the specific document does not support deserialization. if not hasattr(cls, "from_data"): raise MimeBadRequest( "Unsupported Content-Type: " + request.content_type) return document_type.parse(validator, cls, request.body) @property def renderer(self): if self.error_handler is None: raise ValueError("No 'error_handler' available") def setup_renderer(helper): return MimeRenderer(self.mimetypes, self.error_document_type, self.error_handler, validator=self.validator) return setup_renderer def add_config(self, config): config.add_renderer(self.renderer_name, self.renderer) if self.set_default_renderer: config.add_renderer(None, self.renderer) config.set_request_property(self.get_mime_body, self.attribute_name, reify=True) config.set_request_property(build_json_ref, "json_ref", reify=True) config.add_view(self.error_handler, context=MimeException, renderer=self.renderer_name)
udoprog/mimeprovider
mimeprovider/__init__.py
Python
gpl-3.0
5,322
[ 30522, 12324, 15899, 2013, 2771, 4168, 21572, 17258, 2121, 1012, 6254, 13874, 12324, 2131, 1035, 12398, 1035, 6254, 1035, 4127, 2013, 2771, 4168, 21572, 17258, 2121, 1012, 7396, 12324, 2131, 1035, 12398, 1035, 7396, 2013, 2771, 4168, 21572, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
'use strict'; var _ = require('lodash'), jsonFormat = require('json-format'), grunt = require('grunt'); var util = require('../util/util'); module.exports = { json: function(data, options, generatedContent, callback){ if(_.isString(options.dest)){ grunt.file.write(options.dest + '/json/' + generatedContent.task + '.json', jsonFormat(generatedContent)); grunt.file.write(options.dest + '/json/content/' + data.uuid + '.json', jsonFormat(data)); } callback(generatedContent); } }; //
lwhiteley/grunt-pagespeed-report
tasks/config/reporters/json.js
JavaScript
mit
523
[ 30522, 1005, 2224, 9384, 1005, 1025, 13075, 1035, 1027, 5478, 1006, 1005, 8840, 8883, 2232, 1005, 1007, 1010, 1046, 3385, 14192, 4017, 1027, 5478, 1006, 1005, 1046, 3385, 1011, 4289, 1005, 1007, 1010, 20696, 1027, 5478, 1006, 1005, 20696, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#--------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. #--------------------------------------------------------------------------------------------- import unittest try: from unittest.mock import MagicMock except ImportError: from mock import MagicMock # pylint: disable=line-too-long from azure.cli.command_modules.resource._validators import (validate_resource_type, validate_parent, _resolve_api_version as resolve_api_version) class TestApiCheck(unittest.TestCase): @classmethod def setUpClass(cls): pass @classmethod def tearDownClass(cls): pass def setUp(self): pass def tearDown(self): pass def test_resolve_api_provider_backup(self): """ Verifies provider is used as backup if api-version not specified. """ resource_type = validate_resource_type('Mock/test') self.assertEqual(resolve_api_version(self._get_mock_client(), resource_type), "2016-01-01") def test_resolve_api_provider_with_parent_backup(self): """ Verifies provider (with parent) is used as backup if api-version not specified. """ resource_type = validate_resource_type('Mock/bar') parent = validate_parent('foo/testfoo123') self.assertEqual( resolve_api_version(self._get_mock_client(), resource_type, parent), "1999-01-01" ) def test_resolve_api_all_previews(self): """ Verifies most recent preview version returned only if there are no non-preview versions. """ resource_type = validate_resource_type('Mock/preview') self.assertEqual( resolve_api_version(self._get_mock_client(), resource_type), "2005-01-01-preview" ) def _get_mock_client(self): client = MagicMock() provider = MagicMock() provider.resource_types = [ self._get_mock_resource_type('skip', ['2000-01-01-preview', '2000-01-01']), self._get_mock_resource_type('test', ['2016-01-01-preview', '2016-01-01']), self._get_mock_resource_type('foo/bar', ['1999-01-01-preview', '1999-01-01']), self._get_mock_resource_type('preview', ['2005-01-01-preview', '2004-01-01-preview']) ] client.providers.get.return_value = provider return client def _get_mock_resource_type(self, name, api_versions): #pylint: disable=no-self-use rt = MagicMock() rt.resource_type = name rt.api_versions = api_versions return rt if __name__ == '__main__': unittest.main()
BurtBiel/azure-cli
src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/tests/test_api_check.py
Python
mit
2,871
[ 30522, 1001, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
--- title: While We're At It category: The Guts of FP order: 1 --- You won't get very far in most imperative languages without the humble `while` loop or one of it's variants such as `for`. Even though for loops are more commonly used, they are just syntactic sugar on while, so let's start there: {% highlight javascript %} let i = 0; while (i < someEndValue) { // do something interesting here i++; } {% endhighlight %} While it's possible for `someEndValue` to be anything it's extremely common for it to be the length of a collection. {% highlight javascript %} let i = 0; while (i < someCollection.length) { // do something with someCollection[i] here i++; } {% endhighlight %} This immediately brings up a problem, if we want to avoid mutating state, what useful thing could we do in the body of the while loop? While is not an expression, so we can't be returning a value. While demands that we mutate something inside the body, even if we are creating a new value each loop we're still rebinding the variable to a new value. This is as close to no-mutation as we can accomplish with while, but we're still clobbering that outer variable each time. {% highlight javascript %} let numbers = []; let i = 0; while (i < 5) { numbers.push(i); i++; } {% endhighlight %} Furthermore, since `while` is not an expression, there is no way to really combine it with anything else. This is a concept known as composition and we'll return to it later. Fortunately there's another construct that can be used to accomplish a looping structure but allows you to return a value at the end and doesn't need to mutate anything or reassign variables. This means you can use `const someValue = doTheThing(...)` or even `const someValue = doTheThing(...).andThen(...)`. You may have never thought about `recursion` this way, but it's true! > Recursion is the ability of a function to be applied to an argument inside itself. If done wrong this leads to an infinite chain of application in much the same way that forgetting the `i++` at the end of a `while` is an infinite loop. {% highlight javascript %} const populateArray = (numbers, i, endValue) => i < endValue ? populateArray([...numbers, i], i + 1, endValue) : numbers; const result = populateArray([], 0, 5); {% endhighlight %} The process of running this function would look like this. {% highlight javascript %} numbers i | | v v populateArray([], 0, 5) numbers i | | v v populateArray([0], 1, 5) numbers i | | v v populateArray([0, 1], 2, 5) numbers i | | v v populateArray([0, 1, 2], 3, 5) numbers i | | v v populateArray([0, 1, 2, 3], 4, 5) numbers i | | v v populateArray([0, 1, 2, 3, 4], 5, 5) {% endhighlight %} When we run `populateArray`, 0 is less than 5, so we recursively call `populateArray` again, but this time with `[0]` and `1` for the `numbers` and `i` arguments. This continues down until `i` is 5 at which point we return the current value of numbers which is `[0, 1, 2, 3, 4]`. This value is in turn returned by each prior `populateArray` and the final result is thus `[0, 1, 2, 3, 4]`. This may look more complex than the `while` example if you're not used to thinking recursively and using it in this manner. Hopefully though you see much of the operations we're performing are the same. - `i < 5` is the same as `i < endValue` - `numbers.push(i)` and `[...numbers, i]` are both adding an element to the array - `i++` and `i + 1` both move the counter up one Everything we could express in a while loop we can do via recursion and not need to mutate an outer variable along the way. With that said though, you probably don't write many while loops given there are constructs that more directly do what you want such as for. Let's look at a few common cases. #### Filter: reject unwanted values {% highlight javascript %} const itemsToKeep = []; for (var i = 0; i < collection.length; i++) { if (someCriteria(collection[i])) { itemsToKeep.push(collection[i]); } } {% endhighlight %} #### Map: transform values {% highlight javascript %} const newCollection = []; for (var i = 0; i < collection.length; i++) { newCollection.push( someOperation(collection[i]) ); } {% endhighlight %} If your language supports a `foreach` style iteration (`for x of y` in ES6) where the value itself is bound to a local variable instead of using an index, these could both be re-written using that. Both these cases have a striking amount of similarity. Hopefully you've noticed this at some point as well. In fact, almost every line of each of these two cases are the same - `const itemsToKeep = []` is `const newCollection = []` - `for (var i = 0; i < collection.length; i++) {` is identical for both - `itemsToKeep.push` is `newCollection.push` The only difference is that in the first case the item is conditionally added, and in the second, the item is processed before being added. This is the fundamental difference between the two operations, one filters out elements, the other maps one value to another. **_If the "when and what to insert" decision could be parameterized, then the rest of the code could be written once and not every time we need this construct._** ### Higher Order Functions To accomplish this feat we would need a function that could be parameterized by another function. {% highlight javascript %} const doThing = (someFunction, someValue) => someFunction(someValue); {% endhighlight %} What are `someFunction` and `someValue`? No idea! Here's a function that receives _another_ function as an argument and can use it to produce a return value. We can go in the opposite direction as well. {% highlight javascript %} const makeFunction = () => (someNumber) => someNumber + 1; const newFunction = makeFunction(); newFunction(5); // 6 {% endhighlight %} This is not particularly interesting, in fact a function written like this could be converted back to a constant like you're used to. {% highlight javascript %} const newFunction = (someNumber) => someNumber + 1; {% endhighlight %} The interesting part is simply that functions are just values and can be returned like any other value, although this is not particularly common in JavaScript. The first function does not need to have zero arguments, in fact it's often useful for it to have arguments since the function that is returned can see and reference those variables. {% highlight javascript %} const makeGreeting = (message) => (name) => message + " " + name; const jolly = makeGreeting("Hello there"); const grouchy = makeGreeting("Get off my lawn!"); jolly("Tina"); // "Hello there Tina" grouchy("Max"); // "Get off my lawn! Max" // we don't need to create an intermediate function makeGreeting("Look ma, no funtion, right")("Sam"); // "Look ma, no funtion, right Sam" {% endhighlight %} The inner returned functions can also be written on a single line {% highlight javascript %} const makeGreeting = (message) => (name) => message + " " + name; {% endhighlight %} > A function that receives another function as an argument, or returns a new function as a return value is known as a **higher order function**. This may not seem very useful at first, but let's apply the idea to the problem from before and see how this both helps eliminates the need for mutation of a variable, and solves a broad class of problems, all at once. ### Fold and Friends For any while loop of the shape with the form: - Initialize a new collection - Iterate over existing collection - Insert values into new collection there is a generalized solution known commonly as `fold`, `reduce`, or `aggregate`. general shape of: {% highlight javascript %} const newValue = fold(thingToDoWithEachNewElement, initialNewValue, collectionToIterateOver); {% endhighlight %} The `thingToDoWithEachNewElement` is a function that takes the working `initialNewValue` and combines it with an element from `collectionToIterateOver`. This might be done by doing a if check in the case of a filter type operation, or by running the element through a function first as in the case of the map type operation. Or it might be something unrelated to collections in the case of a sum type operation. #### Filter type operation {% highlight javascript %} const filterFn = (element, collection) => someCondition(element) ? [...collection, element] : collection; const someCondition = (x) => x > 5; filterFn(7, [4, 5]) // [4, 5, 7] filterFn(4, [4, 5]) // [4, 5] {% endhighlight %} #### Map type operation {% highlight javascript %} const mapFn = (element, collection) => [...collection, someOperation(element)]; const someOperation = (str) => str + "!"; mapFn("hi", []) // ["hi!"] mapFn("excited", ["I", "am"]) // ["I", "am", "excited!"] {% endhighlight %} And we could use these functions with `fold` in a more concrete setting: {% highlight javascript %} const filteredValues = fold(filterFn, [], [3, 4, 5, 6]); const transformedValues = fold(mapFn, [], ["programming", "is", "fun"]); {% endhighlight %} > This is generally the point where people's eyes glaze over as we begin to get a bit more abstract. From here on out, we will be working with concepts you likely have never encountered. This is genuinely hard to get at first, but the "different paradigm" type of understanding is on the other side, so hang in there! ### Exercise Ready for a challenge? Open `exercises/fold.js` in your editor and implement the `fold` function that can operate on arrays. Do this either using a for loop or using recursion (or try both). It matters much less how something like `fold` is implemented "under the hood" as long as the interface is pure. To test your changes, run `npm run -s fold` from the `exercises` directory. > Ask questions! ## [Next](/3-guts-of-fp/type-it-out)
wayfinderio/intro-to-fp
_docs/3-guts-of-fp/while-we-are-at-it.md
Markdown
mit
10,427
[ 30522, 1011, 1011, 1011, 2516, 1024, 2096, 2057, 1005, 2128, 2012, 2009, 4696, 1024, 1996, 18453, 1997, 1042, 2361, 2344, 1024, 1015, 1011, 1011, 1011, 2017, 2180, 1005, 1056, 2131, 2200, 2521, 1999, 2087, 23934, 4155, 2302, 1996, 15716, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# # Copyright (C) 2010 ARM Limited. All rights reserved. # # This program is free software and is provided to you under the terms of the GNU General Public License version 2 # as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence. # # A copy of the licence is included with the program, and can also be obtained from Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # ifeq ($(CONFIG_UMP_DED_ONLY),y) UMP_MEM_SIZE= $(CONFIG_UMP_MEM_SIZE) USING_MEMORY=0 endif ifeq ($(CONFIG_UMP_OSMEM_ONLY),y) UMP_MEM_SIZE= $(CONFIG_UMP_MEM_SIZE) USING_MEMORY=1 endif ifeq ($(CONFIG_UMP_VCM_ONLY),y) UMP_MEM_SIZE= $(CONFIG_UMP_MEM_SIZE) USING_MEMORY=2 endif # For UMP Debug ifeq ($(CONFIG_VIDEO_MALI400MP_UMP_DEBUG),y) DEFINES += -DDEBUG endif # Set up our defines, which will be passed to gcc DEFINES += -DKERNEL_BUILTIN=1 DEFINES += -DMALI_USE_UNIFIED_MEMORY_PROVIDER DEFINES += -DUSING_MEMORY=$(USING_MEMORY) DEFINES += -DUMP_MEM_SIZE=$(UMP_MEM_SIZE) DEFINES += -DMALI_STATE_TRACKING=1 UDD_FILE_PREFIX := drivers/media/video/samsung/ump/ KBUILDROOT = # linux build system integration obj-$(CONFIG_VIDEO_MALI400MP_UMP) += ump.o # For customer releases the Linux Device Drivers will be provided as ARM proprietary and GPL releases: # The ARM proprietary product will only include the license/proprietary directory # The GPL product will only include the license/gpl directory INCLUDES += \ -I$(UDD_FILE_PREFIX)\ -I$(UDD_FILE_PREFIX)common\ -I$(UDD_FILE_PREFIX)linux\ -I$(UDD_FILE_PREFIX)include\ -I$(UDD_FILE_PREFIX)linux/license/gpl/\ -I$(UDD_FILE_PREFIX)../mali/common\ -I$(UDD_FILE_PREFIX)../mali/linux OSKFILES+=\ $(KBUILDROOT)../mali/linux/mali_osk_atomics.o \ $(KBUILDROOT)../mali/linux/mali_osk_locks.o \ $(KBUILDROOT)../mali/linux/mali_osk_math.o \ $(KBUILDROOT)../mali/linux/mali_osk_memory.o \ $(KBUILDROOT)../mali/linux/mali_osk_misc.o ump-y := \ $(KBUILDROOT)linux/ump_kernel_linux.o \ $(KBUILDROOT)linux/ump_kernel_memory_backend_os.o \ $(KBUILDROOT)linux/ump_kernel_memory_backend_dedicated.o \ $(KBUILDROOT)linux/ump_memory_backend.o \ $(KBUILDROOT)linux/ump_ukk_wrappers.o \ $(KBUILDROOT)linux/ump_ukk_ref_wrappers.o \ $(KBUILDROOT)linux/ump_osk_atomics.o \ $(KBUILDROOT)linux/ump_osk_low_level_mem.o \ $(KBUILDROOT)linux/ump_osk_misc.o \ $(KBUILDROOT)common/ump_kernel_common.o \ $(KBUILDROOT)common/ump_kernel_descriptor_mapping.o \ $(KBUILDROOT)common/ump_kernel_api.o \ $(KBUILDROOT)common/ump_kernel_ref_drv.o\ $(OSKFILES) ump-$(CONFIG_UMP_VCM_ALLOC) += \ $(KBUILDROOT)linux/ump_kernel_memory_backend_vcm.o \ EXTRA_CFLAGS += $(INCLUDES) \ $(DEFINES) # Get subversion revision number, fall back to 0000 if no svn info is available SVN_REV:=$(shell ((svnversion | grep -qv exported && echo -n 'Revision: ' && svnversion) || git svn info | sed -e 's/$$$$/M/' | grep '^Revision: ' || echo ${MALI_RELEASE_NAME}) 2>/dev/null | sed -e 's/^Revision: //') EXTRA_CFLAGS += -DSVN_REV='"$(SVN_REV)"' EXTRA_CFLAGS += -DSVN_REV_STRING='"$(SVN_REV)"'
master-j/e210s_cam
drivers/media/video/samsung/ump/Makefile
Makefile
gpl-2.0
3,161
[ 30522, 1001, 1001, 9385, 1006, 1039, 1007, 2230, 2849, 3132, 1012, 2035, 2916, 9235, 1012, 1001, 1001, 2023, 2565, 2003, 2489, 4007, 1998, 2003, 3024, 2000, 2017, 2104, 1996, 3408, 1997, 1996, 27004, 2236, 2270, 6105, 2544, 1016, 1001, 20...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/******************************************************************************* * Copyright 2018 Tremolo Security, Inc. * * 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. *******************************************************************************/ // Copyright 2014 Google Inc. All rights reserved. // // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd package com.google.u2f.key; public interface UserPresenceVerifier { public static final byte USER_PRESENT_FLAG = (byte) 0x01; byte verifyUserPresence(); }
TremoloSecurity/OpenUnison
unison/unison-auth-u2f/src/main/java/com/google/u2f/key/UserPresenceVerifier.java
Java
apache-2.0
1,144
[ 30522, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
% Date Picker ## About A Date Picker is a control used for selecting a date. ## API Reference [moon.DatePicker]($api/#/kind/moon.DatePicker) ## Behavior When closed, the first title line should inform the user of the picker's function. The second line of text shows the currently selected value. When the picker is open, all content below is pushed downwards to make room for the entire height of the picker control in its open state. After selections have been made, pressing Enter/OK on the picker title will close the control. Once the picker is closed, the selected value(s) appear beneath the title. ### States * **Closed** * **Focused (hover)** * **Open** ### Sizing The width of the control will automatically scale to fit the area containing the control. ## Illustration ### Closed and Open ![](../../assets/dg-controls-date-picker.png)
enyojs/enyo-docs
developer-guide/design/controls/date-picker.md
Markdown
apache-2.0
865
[ 30522, 1003, 3058, 4060, 2121, 1001, 1001, 2055, 1037, 3058, 4060, 2121, 2003, 1037, 2491, 2109, 2005, 17739, 1037, 3058, 1012, 1001, 1001, 17928, 4431, 1031, 4231, 1012, 3058, 24330, 5484, 1033, 1006, 1002, 17928, 1013, 1001, 1013, 2785, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
require 'asciidoctor/extensions' Asciidoctor::Extensions.register do treeprocessor do process do |doc| doc end end end
feelpp/www.feelpp.org
_plugins/asciidoctor-extensions.rb
Ruby
mit
138
[ 30522, 5478, 1005, 2004, 6895, 13820, 16761, 1013, 14305, 1005, 2004, 6895, 13820, 16761, 1024, 1024, 14305, 1012, 4236, 2079, 3392, 21572, 9623, 21748, 2079, 2832, 2079, 1064, 9986, 1064, 9986, 2203, 2203, 2203, 102, 0, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php namespace Oro\Bundle\WorkflowBundle\Tests\Unit\Model; use Doctrine\Common\Collections\ArrayCollection; use Oro\Bundle\WorkflowBundle\Model\Step; use Oro\Bundle\WorkflowBundle\Model\StepManager; use Oro\Component\Testing\Unit\EntityTrait; class StepManagerTest extends \PHPUnit_Framework_TestCase { use EntityTrait; public function testGetOrderedSteps() { $defaultStartStep = $this->getStep(StepManager::DEFAULT_START_STEP_NAME, -1); $stepOne = $this->getStep('step1', 1); $stepTwo = $this->getStep('step2', 2); $stepThree = $this->getStep('step3', 3); $stepManager = new StepManager(new ArrayCollection([$stepTwo, $stepOne, $stepThree, $defaultStartStep])); $ordered = $stepManager->getOrderedSteps(); $this->assertInstanceOf(ArrayCollection::class, $ordered); $this->assertCount(4, $ordered); $this->assertSame($defaultStartStep, $ordered->get(0), 'Steps are not in correct order'); $this->assertSame($stepOne, $ordered->get(1), 'Steps are not in correct order'); $this->assertSame($stepTwo, $ordered->get(2), 'Steps are not in correct order'); $this->assertSame($stepThree, $ordered->get(3), 'Steps are not in correct order'); $ordered = $stepManager->getOrderedSteps(true); $this->assertCount(3, $ordered); $this->assertFalse($ordered->contains($defaultStartStep)); } public function testGetStepsEmpty() { $stepManager = new StepManager(); $this->assertInstanceOf('Doctrine\Common\Collections\ArrayCollection', $stepManager->getSteps()); } public function testSetSteps() { $stepOne = $this->getStep('step1'); $stepTwo = $this->getStep('step2'); $stepManager = new StepManager(); $stepManager->setSteps([$stepOne, $stepTwo]); $steps = $stepManager->getSteps(); $this->assertInstanceOf('Doctrine\Common\Collections\ArrayCollection', $steps); $expected = ['step1' => $stepOne, 'step2' => $stepTwo]; $this->assertEquals($expected, $steps->toArray()); $stepsCollection = new ArrayCollection(['step1' => $stepOne, 'step2' => $stepTwo]); $stepManager->setSteps($stepsCollection); $steps = $stepManager->getSteps(); $this->assertInstanceOf('Doctrine\Common\Collections\ArrayCollection', $steps); $expected = ['step1' => $stepOne, 'step2' => $stepTwo]; $this->assertEquals($expected, $steps->toArray()); } public function testGetStep() { $step1 = $this->getStep('step1'); $step2 = $this->getStep('step2'); $steps = new ArrayCollection([$step1, $step2]); $stepManager = new StepManager($steps); $this->assertEquals($step1, $stepManager->getStep('step1')); $this->assertEquals($step2, $stepManager->getStep('step2')); } /** * @param string $name * @param null|int $order * @return Step */ protected function getStep($name, $order = null) { return $this->getEntity(Step::class, ['name' => $name, 'order' => $order]); } public function testStartStep() { $testStartStep = 'start_step'; $startStep = new Step(); $startStep->setName($testStartStep); $stepManager = new StepManager([$startStep]); $this->assertNull($stepManager->getStartStep()); $this->assertFalse($stepManager->hasStartStep()); $stepManager->setStartStepName($testStartStep); $this->assertEquals($startStep, $stepManager->getStartStep()); $this->assertTrue($stepManager->hasStartStep()); } public function testGetRelatedTransitionSteps() { $step1 = new Step(); $step1->setName('step1'); $step1->setAllowedTransitions(['transitionA']); $step2 = new Step(); $step2->setName('step2'); $step2->setAllowedTransitions(['transitionC', 'transitionA']); $step3 = new Step(); $step3->setName('step3'); $step3->setAllowedTransitions(['transitionC']); $stepManager = new StepManager([$step1, $step2, $step3]); $steps = $stepManager->getRelatedTransitionSteps('transitionA'); $this->assertEquals([$step1, $step2], $steps->getValues()); } public function testGetDefaultStartTransition() { $stepManager = new StepManager(); $this->assertNull($stepManager->getDefaultStartStep()); $step = $this->getStep(StepManager::DEFAULT_START_STEP_NAME); $stepManager->setSteps([$step]); $this->assertEquals($step, $stepManager->getDefaultStartStep()); } }
Djamy/platform
src/Oro/Bundle/WorkflowBundle/Tests/Unit/Model/StepManagerTest.php
PHP
mit
4,655
[ 30522, 1026, 1029, 25718, 3415, 15327, 20298, 1032, 14012, 1032, 2147, 12314, 27265, 2571, 1032, 5852, 1032, 3131, 1032, 2944, 1025, 2224, 8998, 1032, 2691, 1032, 6407, 1032, 30524, 27265, 2571, 1032, 2944, 1032, 3357, 1025, 2224, 20298, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Library functions for WIRIS plugin for Atto. * * @package tinymce * @subpackage tiny_mce_wiris * @copyright Maths for More S.L. <info@wiris.com> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); class tinymce_tiny_mce_wiris extends editor_tinymce_plugin { protected $buttons = array('tiny_mce_wiris_formulaEditor', 'tiny_mce_wiris_CAS'); protected function update_init_params(array &$params, context $context, array $options = null) { global $PAGE, $CFG; $PAGE->requires->js('/lib/editor/tinymce/plugins/tiny_mce_wiris/baseURL.js', false); // Add button after emoticon button in advancedbuttons3. $added = $this->add_button_after($params, 3, 'tiny_mce_wiris_formulaEditor', '', false); $added = $this->add_button_after($params, 3, 'tiny_mce_wiris_formulaEditorChemistry', '', false); $added = $this->add_button_after($params, 3, 'tiny_mce_wiris_CAS', '', false); // Add JS file, which uses default name. $this->add_js_plugin($params); $filterwiris = $CFG->dirroot . '/filter/wiris/filter.php'; if (!file_exists($filterwiris)) { $PAGE->requires->js('/lib/editor/tinymce/plugins/tiny_mce_wiris/js/message.js', false); } } }
nitro2010/moodle
lib/editor/tinymce/plugins/tiny_mce_wiris/lib.php
PHP
gpl-3.0
2,050
[ 30522, 1026, 1029, 25718, 1013, 1013, 2023, 5371, 2003, 2112, 1997, 6888, 2571, 1011, 8299, 1024, 1013, 1013, 6888, 2571, 1012, 8917, 1013, 1013, 1013, 1013, 1013, 6888, 2571, 2003, 2489, 4007, 1024, 2017, 2064, 2417, 2923, 3089, 8569, 26...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<<<<<<< HEAD <p>The <strong>view type</strong> describes how this view is stored; Views is capable of having Views entirely in code that are not in the database. This allows modules to easily ship with Views built in, and it allows you to create a module to store your views for easy deployment between development and production servers.</p> <dl> <dt><strong>Normal</strong></dt> <dd>Normal views are stored in your database and are completely local to your system.</dd> <dt><strong>Default</strong></dt> <dd>Default views are stored only in code and are not anywhere in your database. They may be <strong>enabled</strong> or <strong>disabled</strong> but you may not completely remove them from your system. You can <strong>override</strong> the view which will create a local copy of your view. If you do this, future updates to the version in code will not affect your view.</dd> <dt><strong>Overridden</strong></dt> <dd>Overridden views are stored both in code and in the database; while overridden, the version that is in code is completely dormant. If you <strong>revert</strong> the view, the version in the database will be deleted, and the version that is in code will once again be used.</dd> </dl> You may store your views in code with the following procedure: <ol> <li> Create a module to store the views. </li> <li> Add the function <em>MODULENAME_views_default_views()</em> to this module. </li> <li> Export the view you wish to store in your module in code. Cut and paste that into the abovenamed function. Make sure the last line of the view is: <em>$views[$view-&gt;name] = $view;</em></li> <li> Make sure the last line of the function is <em>return $views;</em></li> <li> After you make any changes, be sure to <strong>clear the Views' cache</strong>. You may do this from the <strong>Tools</strong> menu.</li> </ol> ======= <p>The <strong>view type</strong> describes how this view is stored; Views is capable of having Views entirely in code that are not in the database. This allows modules to easily ship with Views built in, and it allows you to create a module to store your views for easy deployment between development and production servers.</p> <dl> <dt><strong>Normal</strong></dt> <dd>Normal views are stored in your database and are completely local to your system.</dd> <dt><strong>Default</strong></dt> <dd>Default views are stored only in code and are not anywhere in your database. They may be <strong>enabled</strong> or <strong>disabled</strong> but you may not completely remove them from your system. You can <strong>override</strong> the view which will create a local copy of your view. If you do this, future updates to the version in code will not affect your view.</dd> <dt><strong>Overridden</strong></dt> <dd>Overridden views are stored both in code and in the database; while overridden, the version that is in code is completely dormant. If you <strong>revert</strong> the view, the version in the database will be deleted, and the version that is in code will once again be used.</dd> </dl> You may store your views in code with the following procedure: <ol> <li> Create a module to store the views. </li> <li> Add the function <em>MODULENAME_views_default_views()</em> to this module. </li> <li> Export the view you wish to store in your module in code. Cut and paste that into the abovenamed function. Make sure the last line of the view is: <em>$views[$view-&gt;name] = $view;</em></li> <li> Make sure the last line of the function is <em>return $views;</em></li> <li> After you make any changes, be sure to <strong>clear the Views' cache</strong>. You may do this from the <strong>Tools</strong> menu.</li> </ol> >>>>>>> 6d2bfc44ff0188b46711530fc6441339db8d58cc
AbeerKhakwani/friday_asses_book_store
modules/views/help/view-type.html
HTML
gpl-2.0
3,724
[ 30522, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 2132, 1026, 1052, 1028, 1996, 1026, 2844, 1028, 3193, 2828, 1026, 1013, 30524, 5328, 4498, 1999, 3642, 2008, 2024, 2025, 1999, 1996, 7809, 1012, 2023, 4473, 14184, 2000, 4089, 2911, 2007, 5...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
var mongoose = require('mongoose'); var TreatmentPrescription = mongoose.model('TreatmentPrescription', require('../models/TreatmentPrescription').TreatmentPrescriptionSchema); function list(response, params){ TreatmentPrescription.find(params) .sort('created_at') .exec(function(error, prescriptions){ if(error){ console.log(error); prescriptions = []; } response.json(prescriptions); }); } function create_from_body(request){ return { doctor: request.user._id, treatment: request.param('treatment'), items: request.body.items }; } exports.list = function(request, response){ var params = { treatment: request.param('treatment') }; list(response, params); }; exports.single = function(request, response){ if(request.param('prescription') === 'new') { response.json(new TreatmentPrescription({ treatment: request.param('treatment') })); return; } var params = { _id: request.param('prescription'), treatment: request.param('treatment') }; TreatmentPrescription.findOne(params, function(error, prescription){ if(error){ console.log(error); prescription = null; } response.json(prescription); }); }; exports.create = function(request, response){ var values = create_from_body(request); var treatment = new TreatmentPrescription(values); treatment.save(function(error, document){ if(error || !document){ response.json({ error: error }); } else { response.json(document); } }); }; exports.edit = function(request, response){ var values = create_from_body(request); TreatmentPrescription.findByIdAndUpdate(request.body._id, values, function(error, document){ if(error){ response.json({ error: error }); return; } response.json(document); }); }; exports.remove = function(request, response){ if(request.user.type === 'doctor'){ TreatmentPrescription.findByIdAndRemove(request.param('prescription'), function(error){ if(error){ console.log(error); response.send(400); return; } response.send(200) }); } else { response.send(200) } };
megawebmaster/care-center
routes/treatment_prescription.js
JavaScript
mit
2,054
[ 30522, 13075, 12256, 3995, 9232, 1027, 5478, 1006, 1005, 12256, 3995, 9232, 1005, 1007, 1025, 13075, 3949, 28994, 23235, 3258, 1027, 12256, 3995, 9232, 1012, 2944, 1006, 1005, 3949, 28994, 23235, 3258, 1005, 1010, 5478, 1006, 1005, 1012, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php namespace Oro\Component\ChainProcessor\Tests\Unit; use Oro\Component\ChainProcessor\ChainProcessorFactory; class ChainProcessorFactoryTest extends \PHPUnit_Framework_TestCase { public function testFactory() { $processor1 = $this->createMock('Oro\Component\ChainProcessor\ProcessorInterface'); $processor2 = $this->createMock('Oro\Component\ChainProcessor\ProcessorInterface'); $factory1 = $this->createMock('Oro\Component\ChainProcessor\ProcessorFactoryInterface'); $factory2 = $this->createMock('Oro\Component\ChainProcessor\ProcessorFactoryInterface'); $chainFactory = new ChainProcessorFactory(); $chainFactory->addFactory($factory2); $chainFactory->addFactory($factory1, 10); $factory1->expects($this->exactly(3)) ->method('getProcessor') ->willReturnMap( [ ['processor1', $processor1] ] ); $factory2->expects($this->exactly(2)) ->method('getProcessor') ->willReturnMap( [ ['processor2', $processor2] ] ); $this->assertSame($processor1, $chainFactory->getProcessor('processor1')); $this->assertSame($processor2, $chainFactory->getProcessor('processor2')); $this->assertNull($chainFactory->getProcessor('unknown_processor')); } }
Djamy/platform
src/Oro/Component/ChainProcessor/Tests/Unit/ChainProcessorFactoryTest.php
PHP
mit
1,430
[ 30522, 1026, 1029, 25718, 3415, 15327, 20298, 1032, 6922, 1032, 4677, 21572, 9623, 21748, 1032, 5852, 1032, 3131, 1025, 2224, 20298, 1032, 6922, 1032, 4677, 21572, 9623, 21748, 30524, 9623, 21748, 21450, 22199, 8908, 1032, 25718, 19496, 2102,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# Mikrotik scripts Here are specific instruction to scripts created for RouterOS platform and were tested across two sites, both running RouterOS of the same version. ## Prerequisites - Configure site-to-site IPsec tunnel across both sites. Public IP is a must for both endpoints. This [webpage](http://wiki.mikrotik.com/wiki/Manual:IP/IPsec) is a good place to start. I've been using IPsec in ESP tunnel mode, but other modes should in theory work just fine. - Set up account on dynamic DNS service provider. The scripts use [freedns.afraid.org](http://freedns.afraid.org/), but other services should work as well. You will just need to modify the scripts to work with different DNS service (make sure they have public API available). ## Description of scripts The scripts want to access specified interfaces or rules directly on the router. Interfaces are matched using _interface-name_, but rules are represented on router just as entries with number. To identify the specific rule with highest confidence, script finds the match using comment on the rule. Therefore make sure the rules and interfaces have proper comment and put this exact comment into scripts. ### mikrotik_dns_update.script This script tracks assigned IP address on WAN interface of the router. It assumes that the interface has assigned public IP address directly from your ISP. If the ISP assigns new IP address, on next scheduled run will the script update the dynamic DNS service. This script makes the assigned IP available as a global variable available to the whole system and other scripts. ### mikrotik_ipsec_update.script This script tracks for changes of locally asigned IP address as well as IP change on remote IPsec endpoint. In either cases it will update IPsec policies, peer information and firewall rules. ### mikrotik_ovpn_update.script This script is not needed in pure IPsec setup. However it may be useful in cases, where there is another VPN on endpoint with dynamic IP. It is running on a client router and is tracking for endpoint IP changes. ## Setup - Before you import the scripts, you should review them and modify to suit your needs. Albeit they are quite generic, some information should be updated. Put there your credentials to dynamic DNS service, domain names and DNS entry name for your sites. You should also configure, which router rules should be updated. You can find commented examples in the scripts. - Import the scripts and configure Scheduler to run them periodically. Alternative is to set up a trigger which tracks reachability of given IP.
vladimir-zahradnik/dynamic-ipsec-scripts
mikrotik/README.md
Markdown
gpl-2.0
2,574
[ 30522, 1001, 2771, 21638, 4140, 5480, 14546, 2182, 2024, 3563, 7899, 2000, 14546, 2580, 2005, 2799, 7352, 4132, 1998, 2020, 7718, 2408, 2048, 4573, 1010, 2119, 2770, 2799, 7352, 1997, 1996, 2168, 2544, 1012, 1001, 1001, 3653, 2890, 24871, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# Cannon ### Importing ```zenscript import mods.appliedenergistics2.Cannon; ``` ### Adding Adds ammo types for the matter cannon. Weight refers to (roughly) the atomic weight of the material. ```zenscript Cannon.registerAmmo(IItemStack ammo, double weight); Cannon.registerAmmo(<minecraft:bone>, 40.07); ```
jaredlll08/CraftTweaker-Documentation
docs/Mods/Applied_Energistics_2/Cannon.md
Markdown
mit
312
[ 30522, 1001, 8854, 1001, 1001, 1001, 12324, 2075, 1036, 1036, 1036, 16729, 22483, 12324, 16913, 2015, 1012, 4162, 24454, 24063, 6558, 2475, 1012, 8854, 1025, 1036, 1036, 1036, 1001, 1001, 1001, 5815, 9909, 2572, 5302, 4127, 2005, 1996, 3043...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/** * This is a very small example that shows how to use * protothreads. The program consists of two protothreads that wait * for each other to toggle a variable. */ /* We must always include pt.h in our protothreads code. */ #include "pt.h" #include <stdio.h> /* For printf(). */ /* Two flags that the two protothread functions use. */ static int protothread1_flag, protothread2_flag; /** * The first protothread function. A protothread function must always * return an integer, but must never explicitly return - returning is * performed inside the protothread statements. * * The protothread function is driven by the main loop further down in * the code. */ static int protothread1(struct pt *pt) { /* A protothread function must begin with PT_BEGIN() which takes a pointer to a struct pt. */ PT_BEGIN(pt); /* We loop forever here. */ while(1) { /* Wait until the other protothread has set its flag. */ PT_WAIT_UNTIL(pt, protothread2_flag != 0); printf("Protothread 1 running\n"); /* We then reset the other protothread's flag, and set our own flag so that the other protothread can run. */ protothread2_flag = 0; protothread1_flag = 1; /* And we loop. */ } /* All protothread functions must end with PT_END() which takes a pointer to a struct pt. */ PT_END(pt); } /** * The second protothread function. This is almost the same as the * first one. */ static int protothread2(struct pt *pt) { PT_BEGIN(pt); while(1) { /* Let the other protothread run. */ protothread2_flag = 1; /* Wait until the other protothread has set its flag. */ PT_WAIT_UNTIL(pt, protothread1_flag != 0); printf("Protothread 2 running\n"); /* We then reset the other protothread's flag. */ protothread1_flag = 0; /* And we loop. */ } PT_END(pt); } /** * Finally, we have the main loop. Here is where the protothreads are * initialized and scheduled. First, however, we define the * protothread state variables pt1 and pt2, which hold the state of * the two protothreads. */ static struct pt pt1, pt2; int main(void) { /* Initialize the protothread state variables with PT_INIT(). */ PT_INIT(&pt1); PT_INIT(&pt2); /* * Then we schedule the two protothreads by repeatedly calling their * protothread functions and passing a pointer to the protothread * state variables as arguments. */ while(1) { protothread1(&pt1); protothread2(&pt2); } }
jgoppert/autopilotone
thirdParty/pt-1.4/example-small.c
C
gpl-3.0
2,486
[ 30522, 1013, 1008, 1008, 1008, 2023, 2003, 1037, 2200, 2235, 2742, 2008, 3065, 2129, 2000, 2224, 1008, 15053, 2705, 16416, 5104, 1012, 1996, 2565, 3774, 1997, 2048, 15053, 2705, 16416, 5104, 2008, 3524, 1008, 2005, 2169, 2060, 2000, 2000, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
if [ -z `which mcookie` ] || [ -z `which rm` ] || [ -z `which cat` ] || [ -z `which chmod` ] || [ -z `which ln` ] || [ -z `which grep` ] || [ -z `which mkdir` ] || [ ! -x ${ROOTFS}/bin/readlink ]; then exit 125; fi ###################################################################### TMP1=/tmp/$(mcookie) TMP2=/tmp/$(mcookie) TMP3=/tmp/$(mcookie) TMP4=/tmp/$(mcookie) rm -fr ${TMP1} ${TMP2} ${TMP3} ${TMP4} ###################################################################### cat > ${TMP1} <<'EOF' #!/bin/sh echo $0 EOF chmod +x ${TMP1} ln -s ${TMP1} ${TMP2} ${PROOT} ${TMP2} | grep -v ${TMP1} ${PROOT} ${TMP2} | grep ${TMP2} ###################################################################### mkdir -p ${TMP3} cd ${TMP3} ln -s $(which true) false ! ${PROOT} false echo "#!$(which false)" > true chmod a-x true ${PROOT} true ###################################################################### ln -s ${ROOTFS}/bin/readlink ${TMP4} TEST1=$(${PROOT} ${ROOTFS}/bin/readlink /proc/self/exe) TEST2=$(${PROOT} ${TMP4} /proc/self/exe) test "${TEST1}" = "${TEST2}" ###################################################################### cd / rm -fr ${TMP1} ${TMP2} ${TMP3} ${TMP4}
solderzzc/PRoot
tests/test-713b6910.sh
Shell
gpl-2.0
1,203
[ 30522, 2065, 1031, 1011, 1062, 1036, 2029, 11338, 14659, 2666, 1036, 1033, 1064, 1064, 1031, 1011, 1062, 1036, 2029, 28549, 1036, 1033, 1064, 1064, 1031, 1011, 1062, 1036, 2029, 4937, 1036, 1033, 1064, 1064, 1031, 1011, 1062, 1036, 2029, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright 2018-2019 B2i Healthcare Pte Ltd, http://b2i.sg * * 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.b2international.snowowl.snomed.reasoner.converter; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.stream.Collectors; import com.b2international.commons.http.ExtendedLocale; import com.b2international.commons.options.Options; import com.b2international.snowowl.core.domain.BranchContext; import com.b2international.snowowl.core.domain.CollectionResource; import com.b2international.snowowl.core.domain.RepositoryContext; import com.b2international.snowowl.core.events.Request; import com.b2international.snowowl.core.request.SearchResourceRequestBuilder; import com.b2international.snowowl.core.terminology.ComponentCategory; import com.b2international.snowowl.datastore.converter.BaseResourceConverter; import com.b2international.snowowl.datastore.request.BranchRequest; import com.b2international.snowowl.datastore.request.RevisionIndexReadRequest; import com.b2international.snowowl.snomed.common.SnomedRf2Headers; import com.b2international.snowowl.snomed.core.domain.SnomedCoreComponent; import com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMember; import com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMembers; import com.b2international.snowowl.snomed.datastore.id.SnomedIdentifiers; import com.b2international.snowowl.snomed.datastore.request.SnomedRequests; import com.b2international.snowowl.snomed.reasoner.domain.ChangeNature; import com.b2international.snowowl.snomed.reasoner.domain.ClassificationTask; import com.b2international.snowowl.snomed.reasoner.domain.ConcreteDomainChange; import com.b2international.snowowl.snomed.reasoner.domain.ConcreteDomainChanges; import com.b2international.snowowl.snomed.reasoner.domain.ReasonerConcreteDomainMember; import com.b2international.snowowl.snomed.reasoner.index.ConcreteDomainChangeDocument; import com.b2international.snowowl.snomed.reasoner.request.ClassificationRequests; import com.google.common.collect.Maps; import com.google.common.collect.Multimap; import com.google.common.collect.Multimaps; /** * @since 6.11 (originally introduced on 7.0) */ public final class ConcreteDomainChangeConverter extends BaseResourceConverter<ConcreteDomainChangeDocument, ConcreteDomainChange, ConcreteDomainChanges> { // TODO: this constant is moved to SnomedReferenceSetMember.Expand on 7.x private static final String REFERENCED_COMPONENT = "referencedComponent"; public ConcreteDomainChangeConverter(final RepositoryContext context, final Options expand, final List<ExtendedLocale> locales) { super(context, expand, locales); } @Override protected ConcreteDomainChanges createCollectionResource(final List<ConcreteDomainChange> results, final String scrollId, final String searchAfter, final int limit, final int total) { return new ConcreteDomainChanges(results, scrollId, searchAfter, limit, total); } @Override protected ConcreteDomainChange toResource(final ConcreteDomainChangeDocument entry) { final ConcreteDomainChange resource = new ConcreteDomainChange(); resource.setClassificationId(entry.getClassificationId()); resource.setChangeNature(entry.getNature()); /* * New members: ID refers to the "origin" member ID * Updated members: ID refers to the member that should be updated in place * Redundant members: ID refers to the member that should be removed or deactivated */ final ReasonerConcreteDomainMember concreteDomainMember = new ReasonerConcreteDomainMember(entry.getMemberId()); // Released flag is the "origin" member's released state for updated and redundant members, false for new members concreteDomainMember.setReleased(entry.isReleased()); concreteDomainMember.setReferencedComponentId(entry.getReferencedComponentId()); switch (entry.getNature()) { case INFERRED: /* * New members are referring to: * - a different component * - in another relationship group * - with a potentially different characteristic type */ concreteDomainMember.setGroup(entry.getGroup()); concreteDomainMember.setCharacteristicTypeId(entry.getCharacteristicTypeId()); break; case UPDATED: // Updates change the serialized value on an existing member concreteDomainMember.setSerializedValue(entry.getSerializedValue()); break; case REDUNDANT: // Redundant CD members only need the UUID and released flag populated to do the delete/inactivation break; default: throw new IllegalStateException(String.format("Unexpected CD member change '%s' found with UUID '%s'.", entry.getNature(), entry.getMemberId())); } resource.setConcreteDomainMember(concreteDomainMember); return resource; } @Override protected void expand(final List<ConcreteDomainChange> results) { if (!expand().containsKey(ConcreteDomainChange.Expand.CONCRETE_DOMAIN_MEMBER)) { return; } /* * Depending on the CD member change search request, we might need to issue * SNOMED CT searches against multiple branches; find out which ones we have. */ final Multimap<String, ConcreteDomainChange> itemsByBranch = getItemsByBranch(results); // Check if we only need to load inferred CD members in their entirety final Options expandOptions = expand().getOptions(ConcreteDomainChange.Expand.CONCRETE_DOMAIN_MEMBER); final boolean inferredOnly = expandOptions.getBoolean("inferredOnly"); final Options cdMemberExpandOptions = expandOptions.getOptions("expand"); final Options referencedComponentOptions = cdMemberExpandOptions.getOptions(REFERENCED_COMPONENT); /* * Remove this option from the member expand options map, so that member search * does not expand the referenced component again */ final boolean needsReferencedComponent = cdMemberExpandOptions.keySet().remove(REFERENCED_COMPONENT); for (final String branch : itemsByBranch.keySet()) { final Collection<ConcreteDomainChange> itemsForCurrentBranch = itemsByBranch.get(branch); /* * Expand referenced component on members via a separate search request, as they * can be different from the referenced component on the "origin" member */ if (needsReferencedComponent) { final List<ReasonerConcreteDomainMember> blankMembers = itemsForCurrentBranch.stream() .filter(c -> !inferredOnly || ChangeNature.INFERRED.equals(c.getChangeNature())) .map(ConcreteDomainChange::getConcreteDomainMember) .collect(Collectors.toList()); final Multimap<String, ReasonerConcreteDomainMember> membersByReferencedComponent = Multimaps.index(blankMembers, ReasonerConcreteDomainMember::getReferencedComponentId); final Multimap<ComponentCategory, String> referencedComponentsByCategory = Multimaps.index(membersByReferencedComponent.keySet(), SnomedIdentifiers::getComponentCategory); for (final Entry<ComponentCategory, Collection<String>> categoryEntry : referencedComponentsByCategory.asMap().entrySet()) { expandComponentCategory(branch, categoryEntry.getKey(), categoryEntry.getValue(), referencedComponentOptions, membersByReferencedComponent); } } /* * Then fetch all the required members (these will have a referenced component * ID that should no longer be copied on inferred members). Note that the same "origin" * member might be used for multiple eg. "new" counterparts. */ final Set<String> cdMemberUuids = itemsForCurrentBranch.stream() .filter(c -> !inferredOnly || ChangeNature.INFERRED.equals(c.getChangeNature())) .map(c -> c.getConcreteDomainMember().getOriginMemberId()) .collect(Collectors.toSet()); final Request<BranchContext, SnomedReferenceSetMembers> cdMemberSearchRequest = SnomedRequests.prepareSearchMember() .filterByIds(cdMemberUuids) .setLimit(cdMemberUuids.size()) .setExpand(cdMemberExpandOptions) .setLocales(locales()) .build(); final SnomedReferenceSetMembers cdMembers = new BranchRequest<>(branch, new RevisionIndexReadRequest<>(cdMemberSearchRequest)) .execute(context()); final Map<String, SnomedReferenceSetMember> cdMembersByUuid = Maps.uniqueIndex(cdMembers, SnomedReferenceSetMember::getId); /* * Finally, set the member on the change item, but preserve the properties that * were already set in "toResource" */ for (final ConcreteDomainChange item : itemsForCurrentBranch) { final ReasonerConcreteDomainMember reasonerMember = item.getConcreteDomainMember(); final String memberUuid = reasonerMember.getOriginMemberId(); switch (item.getChangeNature()) { case INFERRED: { final SnomedReferenceSetMember expandedMember = cdMembersByUuid.get(memberUuid); final Map<String, Object> expandedProperties = expandedMember.getProperties(); // reasonerMember.setCharacteristicTypeId(...) is already set // reasonerMember.setGroup(...) is already set // reasonerMember.setReferencedComponent(...) is already set (or expanded) reasonerMember.setReferenceSetId(expandedMember.getReferenceSetId()); // reasonerMember.setReleased(...) is already set reasonerMember.setSerializedValue((String) expandedProperties.get(SnomedRf2Headers.FIELD_VALUE)); reasonerMember.setTypeId((String) expandedProperties.get(SnomedRf2Headers.FIELD_TYPE_ID)); } break; case UPDATED: if (!inferredOnly) { final SnomedReferenceSetMember expandedMember = cdMembersByUuid.get(memberUuid); final Map<String, Object> expandedProperties = expandedMember.getProperties(); reasonerMember.setCharacteristicTypeId((String) expandedProperties.get(SnomedRf2Headers.FIELD_CHARACTERISTIC_TYPE_ID)); reasonerMember.setGroup((Integer) expandedProperties.get(SnomedRf2Headers.FIELD_RELATIONSHIP_GROUP)); // reasonerMember.setReferencedComponent(...) is already set (or expanded) reasonerMember.setReferenceSetId(expandedMember.getReferenceSetId()); // reasonerMember.setReleased(...) is already set // reasonerMember.setSerializedValue(...) is already set reasonerMember.setTypeId((String) expandedProperties.get(SnomedRf2Headers.FIELD_TYPE_ID)); } break; case REDUNDANT: if (!inferredOnly) { final SnomedReferenceSetMember expandedMember = cdMembersByUuid.get(memberUuid); final Map<String, Object> expandedProperties = expandedMember.getProperties(); reasonerMember.setCharacteristicTypeId((String) expandedProperties.get(SnomedRf2Headers.FIELD_CHARACTERISTIC_TYPE_ID)); reasonerMember.setGroup((Integer) expandedProperties.get(SnomedRf2Headers.FIELD_RELATIONSHIP_GROUP)); // reasonerMember.setReferencedComponent(...) is already set (or expanded) reasonerMember.setReferenceSetId(expandedMember.getReferenceSetId()); // reasonerMember.setReleased(...) is already set reasonerMember.setSerializedValue((String) expandedProperties.get(SnomedRf2Headers.FIELD_VALUE)); reasonerMember.setTypeId((String) expandedProperties.get(SnomedRf2Headers.FIELD_TYPE_ID)); } break; default: throw new IllegalStateException(String.format("Unexpected CD member change '%s' found with UUID '%s'.", item.getChangeNature(), item.getConcreteDomainMember().getOriginMemberId())); } } } } private Multimap<String, ConcreteDomainChange> getItemsByBranch(final List<ConcreteDomainChange> results) { final Set<String> classificationTaskIds = results.stream() .map(ConcreteDomainChange::getClassificationId) .collect(Collectors.toSet()); final Map<String, String> branchesByClassificationIdMap = ClassificationRequests.prepareSearchClassification() .filterByIds(classificationTaskIds) .setLimit(classificationTaskIds.size()) .build() .execute(context()) .stream() .collect(Collectors.toMap( ClassificationTask::getId, ClassificationTask::getBranch)); final Multimap<String, ConcreteDomainChange> itemsByBranch = Multimaps.index(results, r -> branchesByClassificationIdMap.get(r.getClassificationId())); return itemsByBranch; } // Copied from SnomedReferenceSetMemberConverter private void expandComponentCategory(final String branch, final ComponentCategory category, final Collection<String> componentIds, final Options componentOptions, final Multimap<String, ReasonerConcreteDomainMember> membersByReferencedComponent) { final SearchResourceRequestBuilder<?, BranchContext, ? extends CollectionResource<? extends SnomedCoreComponent>> searchRequestBuilder = createSearchRequestBuilder(category); searchRequestBuilder.filterByIds(componentIds) .setLimit(componentIds.size()) .setLocales(locales()) .setExpand(componentOptions.get("expand", Options.class)); final CollectionResource<? extends SnomedCoreComponent> referencedComponents = new BranchRequest<>(branch, new RevisionIndexReadRequest<>(searchRequestBuilder.build())) .execute(context()); for (final SnomedCoreComponent referencedComponent : referencedComponents) { for (final ReasonerConcreteDomainMember member : membersByReferencedComponent.get(referencedComponent.getId())) { member.setReferencedComponent(referencedComponent); } } } private SearchResourceRequestBuilder<?, BranchContext, ? extends CollectionResource<? extends SnomedCoreComponent>> createSearchRequestBuilder(final ComponentCategory category) { switch (category) { case CONCEPT: return SnomedRequests.prepareSearchConcept(); case DESCRIPTION: return SnomedRequests.prepareSearchDescription(); case RELATIONSHIP: return SnomedRequests.prepareSearchRelationship(); default: throw new UnsupportedOperationException("Category '" + category + "' is not supported in referenced component expansion."); } } }
IHTSDO/snow-owl
snomed/com.b2international.snowowl.snomed.reasoner/src/com/b2international/snowowl/snomed/reasoner/converter/ConcreteDomainChangeConverter.java
Java
apache-2.0
14,609
[ 30522, 1013, 1008, 1008, 9385, 2760, 1011, 10476, 1038, 2475, 2072, 9871, 13866, 2063, 5183, 1010, 8299, 1024, 1013, 1013, 1038, 2475, 2072, 1012, 22214, 1008, 1008, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.beam.sdk.testing; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertThat; import static org.junit.Assert.fail; import com.google.common.base.Strings; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import org.apache.beam.sdk.coders.AtomicCoder; import org.apache.beam.sdk.coders.Coder.Context; import org.apache.beam.sdk.coders.CoderException; import org.apache.beam.sdk.coders.CustomCoder; import org.apache.beam.sdk.coders.StringUtf8Coder; import org.hamcrest.CoreMatchers; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; /** Unit tests for {@link CoderProperties}. */ @RunWith(JUnit4.class) public class CoderPropertiesTest { @Rule public ExpectedException expectedException = ExpectedException.none(); @Test public void testGoodCoderIsDeterministic() throws Exception { CoderProperties.coderDeterministic(StringUtf8Coder.of(), "TestData", "TestData"); } /** A coder that says it is not deterministic but actually is. */ public static class NonDeterministicCoder extends AtomicCoder<String> { @Override public void encode(String value, OutputStream outStream) throws CoderException, IOException { StringUtf8Coder.of().encode(value, outStream); } @Override public String decode(InputStream inStream) throws CoderException, IOException { return StringUtf8Coder.of().decode(inStream); } @Override public void verifyDeterministic() throws NonDeterministicException { throw new NonDeterministicException(this, "Not Deterministic"); } } @Test public void testNonDeterministicCoder() throws Exception { try { CoderProperties.coderDeterministic(new NonDeterministicCoder(), "TestData", "TestData"); } catch (AssertionError error) { assertThat( error.getMessage(), CoreMatchers.containsString("Expected that the coder is deterministic")); // success! return; } fail("Expected AssertionError"); } @Test public void testPassingInNonEqualValuesWithDeterministicCoder() throws Exception { AssertionError error = null; try { CoderProperties.coderDeterministic(StringUtf8Coder.of(), "AAA", "BBB"); } catch (AssertionError e) { error = e; } assertNotNull("Expected AssertionError", error); assertThat( error.getMessage(), CoreMatchers.containsString("Expected that the passed in values")); } /** A coder that is non-deterministic because it adds a string to the value. */ private static class BadDeterminsticCoder extends AtomicCoder<String> { public BadDeterminsticCoder() {} @Override public void encode(String value, OutputStream outStream) throws IOException, CoderException { StringUtf8Coder.of().encode(value + System.nanoTime(), outStream); } @Override public String decode(InputStream inStream) throws CoderException, IOException { return StringUtf8Coder.of().decode(inStream); } @Override public void verifyDeterministic() throws NonDeterministicException {} } @Test public void testBadCoderIsNotDeterministic() throws Exception { AssertionError error = null; try { CoderProperties.coderDeterministic(new BadDeterminsticCoder(), "TestData", "TestData"); } catch (AssertionError e) { error = e; } assertNotNull("Expected AssertionError", error); assertThat(error.getMessage(), CoreMatchers.containsString("<84>, <101>, <115>, <116>, <68>")); } @Test public void testGoodCoderEncodesEqualValues() throws Exception { CoderProperties.coderDecodeEncodeEqual(StringUtf8Coder.of(), "TestData"); } /** This coder changes state during encoding/decoding. */ private static class StateChangingSerializingCoder extends CustomCoder<String> { private int changedState; public StateChangingSerializingCoder() { changedState = 10; } @Override public void encode(String value, OutputStream outStream) throws CoderException, IOException { changedState += 1; StringUtf8Coder.of().encode(value + Strings.repeat("A", changedState), outStream); } @Override public String decode(InputStream inStream) throws CoderException, IOException { String decodedValue = StringUtf8Coder.of().decode(inStream); return decodedValue.substring(0, decodedValue.length() - changedState); } @Override public boolean equals(Object other) { return other instanceof StateChangingSerializingCoder && ((StateChangingSerializingCoder) other).changedState == this.changedState; } @Override public int hashCode() { return changedState; } } @Test public void testBadCoderThatDependsOnChangingState() throws Exception { AssertionError error = null; try { CoderProperties.coderDecodeEncodeEqual(new StateChangingSerializingCoder(), "TestData"); } catch (AssertionError e) { error = e; } assertNotNull("Expected AssertionError", error); assertThat(error.getMessage(), CoreMatchers.containsString("TestData")); } /** This coder loses information critical to its operation. */ private static class ForgetfulSerializingCoder extends CustomCoder<String> { private transient int lostState; public ForgetfulSerializingCoder(int lostState) { this.lostState = lostState; } @Override public void encode(String value, OutputStream outStream) throws CoderException, IOException { if (lostState == 0) { throw new RuntimeException("I forgot something..."); } StringUtf8Coder.of().encode(value, outStream); } @Override public String decode(InputStream inStream) throws CoderException, IOException { return StringUtf8Coder.of().decode(inStream); } @Override public boolean equals(Object other) { return (other instanceof ForgetfulSerializingCoder) && ((ForgetfulSerializingCoder) other).lostState == lostState; } @Override public int hashCode() { return lostState; } } @Test public void testBadCoderThatDependsOnStateThatIsLost() throws Exception { expectedException.expect(RuntimeException.class); expectedException.expectMessage("I forgot something..."); CoderProperties.coderDecodeEncodeEqual(new ForgetfulSerializingCoder(1), "TestData"); } /** A coder which closes the underlying stream during encoding and decoding. */ public static class ClosingCoder extends AtomicCoder<String> { @Override public void encode(String value, OutputStream outStream) throws IOException { outStream.close(); } @Override public String decode(InputStream inStream) throws IOException { inStream.close(); return null; } } @Test public void testClosingCoderFailsWhenDecoding() throws Exception { expectedException.expect(UnsupportedOperationException.class); expectedException.expectMessage("Caller does not own the underlying"); CoderProperties.decode(new ClosingCoder(), Context.NESTED, new byte[0]); } @Test public void testClosingCoderFailsWhenEncoding() throws Exception { expectedException.expect(UnsupportedOperationException.class); expectedException.expectMessage("Caller does not own the underlying"); CoderProperties.encode(new ClosingCoder(), Context.NESTED, "test-value"); } /** Coder that consumes more bytes while decoding than required. */ public static class BadCoderThatConsumesMoreBytes extends NonDeterministicCoder { @Override public String decode(InputStream inStream, Context context) throws IOException { String value = super.decode(inStream, context); inStream.read(); return value; } } @Test public void testCoderWhichConsumesMoreBytesThanItProducesFail() throws IOException { AssertionError error = null; try { BadCoderThatConsumesMoreBytes coder = new BadCoderThatConsumesMoreBytes(); byte[] bytes = CoderProperties.encode(coder, Context.NESTED, "TestData"); CoderProperties.decode(coder, Context.NESTED, bytes); } catch (AssertionError e) { error = e; } assertNotNull("Expected Assertion Error", error); assertThat( error.getMessage(), CoreMatchers.containsString("consumed bytes equal to encoded bytes")); } }
rangadi/beam
sdks/java/core/src/test/java/org/apache/beam/sdk/testing/CoderPropertiesTest.java
Java
apache-2.0
9,270
[ 30522, 1013, 1008, 1008, 7000, 2000, 1996, 15895, 4007, 3192, 1006, 2004, 2546, 1007, 2104, 2028, 1008, 2030, 2062, 12130, 6105, 10540, 1012, 2156, 1996, 5060, 5371, 1008, 5500, 2007, 2023, 2147, 2005, 3176, 2592, 1008, 4953, 9385, 6095, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/********************************************************************* * * Filename: af_irda.c * Version: 0.9 * Description: IrDA sockets implementation * Status: Stable * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Sun May 31 10:12:43 1998 * Modified at: Sat Dec 25 21:10:23 1999 * Modified by: Dag Brattli <dag@brattli.net> * Sources: af_netroom.c, af_ax25.c, af_rose.c, af_x25.c etc. * * Copyright (c) 1999 Dag Brattli <dagb@cs.uit.no> * Copyright (c) 1999-2003 Jean Tourrilhes <jt@hpl.hp.com> * All Rights Reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * * Linux-IrDA now supports four different types of IrDA sockets: * * o SOCK_STREAM: TinyTP connections with SAR disabled. The * max SDU size is 0 for conn. of this type * o SOCK_SEQPACKET: TinyTP connections with SAR enabled. TTP may * fragment the messages, but will preserve * the message boundaries * o SOCK_DGRAM: IRDAPROTO_UNITDATA: TinyTP connections with Unitdata * (unreliable) transfers * IRDAPROTO_ULTRA: Connectionless and unreliable data * ********************************************************************/ #include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/socket.h> #include <linux/sockios.h> #include <linux/init.h> #include <linux/net.h> #include <linux/irda.h> #include <linux/poll.h> #include <asm/ioctls.h> /* TIOCOUTQ, TIOCINQ */ #include <asm/uaccess.h> #include <net/sock.h> #include <net/tcp.h> #include <net/irda/af_irda.h> static int irda_create(struct socket *sock, int protocol); static struct proto_ops irda_stream_ops; static struct proto_ops irda_seqpacket_ops; static struct proto_ops irda_dgram_ops; #ifdef CONFIG_IRDA_ULTRA static struct proto_ops irda_ultra_ops; #define ULTRA_MAX_DATA 382 #endif /* CONFIG_IRDA_ULTRA */ #define IRDA_MAX_HEADER (TTP_MAX_HEADER) /* * Function irda_data_indication (instance, sap, skb) * * Received some data from TinyTP. Just queue it on the receive queue * */ static int irda_data_indication(void *instance, void *sap, struct sk_buff *skb) { struct irda_sock *self; struct sock *sk; int err; IRDA_DEBUG(3, "%s()\n", __FUNCTION__); self = (struct irda_sock *) instance; ASSERT(self != NULL, return -1;); sk = self->sk; ASSERT(sk != NULL, return -1;); err = sock_queue_rcv_skb(sk, skb); if (err) { IRDA_DEBUG(1, "%s(), error: no more mem!\n", __FUNCTION__); self->rx_flow = FLOW_STOP; /* When we return error, TTP will need to requeue the skb */ return err; } return 0; } /* * Function irda_disconnect_indication (instance, sap, reason, skb) * * Connection has been closed. Check reason to find out why * */ static void irda_disconnect_indication(void *instance, void *sap, LM_REASON reason, struct sk_buff *skb) { struct irda_sock *self; struct sock *sk; self = (struct irda_sock *) instance; IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self); /* Don't care about it, but let's not leak it */ if(skb) dev_kfree_skb(skb); sk = self->sk; if (sk == NULL) { IRDA_DEBUG(0, "%s(%p) : BUG : sk is NULL\n", __FUNCTION__, self); return; } /* Prevent race conditions with irda_release() and irda_shutdown() */ if (!sock_flag(sk, SOCK_DEAD) && sk->sk_state != TCP_CLOSE) { sk->sk_state = TCP_CLOSE; sk->sk_err = ECONNRESET; sk->sk_shutdown |= SEND_SHUTDOWN; sk->sk_state_change(sk); /* Uh-oh... Should use sock_orphan ? */ sock_set_flag(sk, SOCK_DEAD); /* Close our TSAP. * If we leave it open, IrLMP put it back into the list of * unconnected LSAPs. The problem is that any incoming request * can then be matched to this socket (and it will be, because * it is at the head of the list). This would prevent any * listening socket waiting on the same TSAP to get those * requests. Some apps forget to close sockets, or hang to it * a bit too long, so we may stay in this dead state long * enough to be noticed... * Note : all socket function do check sk->sk_state, so we are * safe... * Jean II */ if (self->tsap) { irttp_close_tsap(self->tsap); self->tsap = NULL; } } /* Note : once we are there, there is not much you want to do * with the socket anymore, apart from closing it. * For example, bind() and connect() won't reset sk->sk_err, * sk->sk_shutdown and sk->sk_flags to valid values... * Jean II */ } /* * Function irda_connect_confirm (instance, sap, qos, max_sdu_size, skb) * * Connections has been confirmed by the remote device * */ static void irda_connect_confirm(void *instance, void *sap, struct qos_info *qos, __u32 max_sdu_size, __u8 max_header_size, struct sk_buff *skb) { struct irda_sock *self; struct sock *sk; self = (struct irda_sock *) instance; IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self); sk = self->sk; if (sk == NULL) { dev_kfree_skb(skb); return; } dev_kfree_skb(skb); // Should be ??? skb_queue_tail(&sk->sk_receive_queue, skb); /* How much header space do we need to reserve */ self->max_header_size = max_header_size; /* IrTTP max SDU size in transmit direction */ self->max_sdu_size_tx = max_sdu_size; /* Find out what the largest chunk of data that we can transmit is */ switch (sk->sk_type) { case SOCK_STREAM: if (max_sdu_size != 0) { ERROR("%s: max_sdu_size must be 0\n", __FUNCTION__); return; } self->max_data_size = irttp_get_max_seg_size(self->tsap); break; case SOCK_SEQPACKET: if (max_sdu_size == 0) { ERROR("%s: max_sdu_size cannot be 0\n", __FUNCTION__); return; } self->max_data_size = max_sdu_size; break; default: self->max_data_size = irttp_get_max_seg_size(self->tsap); }; IRDA_DEBUG(2, "%s(), max_data_size=%d\n", __FUNCTION__, self->max_data_size); memcpy(&self->qos_tx, qos, sizeof(struct qos_info)); /* We are now connected! */ sk->sk_state = TCP_ESTABLISHED; sk->sk_state_change(sk); } /* * Function irda_connect_indication(instance, sap, qos, max_sdu_size, userdata) * * Incoming connection * */ static void irda_connect_indication(void *instance, void *sap, struct qos_info *qos, __u32 max_sdu_size, __u8 max_header_size, struct sk_buff *skb) { struct irda_sock *self; struct sock *sk; self = (struct irda_sock *) instance; IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self); sk = self->sk; if (sk == NULL) { dev_kfree_skb(skb); return; } /* How much header space do we need to reserve */ self->max_header_size = max_header_size; /* IrTTP max SDU size in transmit direction */ self->max_sdu_size_tx = max_sdu_size; /* Find out what the largest chunk of data that we can transmit is */ switch (sk->sk_type) { case SOCK_STREAM: if (max_sdu_size != 0) { ERROR("%s: max_sdu_size must be 0\n", __FUNCTION__); kfree_skb(skb); return; } self->max_data_size = irttp_get_max_seg_size(self->tsap); break; case SOCK_SEQPACKET: if (max_sdu_size == 0) { ERROR("%s: max_sdu_size cannot be 0\n", __FUNCTION__); kfree_skb(skb); return; } self->max_data_size = max_sdu_size; break; default: self->max_data_size = irttp_get_max_seg_size(self->tsap); }; IRDA_DEBUG(2, "%s(), max_data_size=%d\n", __FUNCTION__, self->max_data_size); memcpy(&self->qos_tx, qos, sizeof(struct qos_info)); skb_queue_tail(&sk->sk_receive_queue, skb); sk->sk_state_change(sk); } /* * Function irda_connect_response (handle) * * Accept incoming connection * */ void irda_connect_response(struct irda_sock *self) { struct sk_buff *skb; IRDA_DEBUG(2, "%s()\n", __FUNCTION__); ASSERT(self != NULL, return;); skb = dev_alloc_skb(64); if (skb == NULL) { IRDA_DEBUG(0, "%s() Unable to allocate sk_buff!\n", __FUNCTION__); return; } /* Reserve space for MUX_CONTROL and LAP header */ skb_reserve(skb, IRDA_MAX_HEADER); irttp_connect_response(self->tsap, self->max_sdu_size_rx, skb); } /* * Function irda_flow_indication (instance, sap, flow) * * Used by TinyTP to tell us if it can accept more data or not * */ static void irda_flow_indication(void *instance, void *sap, LOCAL_FLOW flow) { struct irda_sock *self; struct sock *sk; IRDA_DEBUG(2, "%s()\n", __FUNCTION__); self = (struct irda_sock *) instance; ASSERT(self != NULL, return;); sk = self->sk; ASSERT(sk != NULL, return;); switch (flow) { case FLOW_STOP: IRDA_DEBUG(1, "%s(), IrTTP wants us to slow down\n", __FUNCTION__); self->tx_flow = flow; break; case FLOW_START: self->tx_flow = flow; IRDA_DEBUG(1, "%s(), IrTTP wants us to start again\n", __FUNCTION__); wake_up_interruptible(sk->sk_sleep); break; default: IRDA_DEBUG(0, "%s(), Unknown flow command!\n", __FUNCTION__); /* Unknown flow command, better stop */ self->tx_flow = flow; break; } } /* * Function irda_getvalue_confirm (obj_id, value, priv) * * Got answer from remote LM-IAS, just pass object to requester... * * Note : duplicate from above, but we need our own version that * doesn't touch the dtsap_sel and save the full value structure... */ static void irda_getvalue_confirm(int result, __u16 obj_id, struct ias_value *value, void *priv) { struct irda_sock *self; self = (struct irda_sock *) priv; if (!self) { WARNING("%s: lost myself!\n", __FUNCTION__); return; } IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self); /* We probably don't need to make any more queries */ iriap_close(self->iriap); self->iriap = NULL; /* Check if request succeeded */ if (result != IAS_SUCCESS) { IRDA_DEBUG(1, "%s(), IAS query failed! (%d)\n", __FUNCTION__, result); self->errno = result; /* We really need it later */ /* Wake up any processes waiting for result */ wake_up_interruptible(&self->query_wait); return; } /* Pass the object to the caller (so the caller must delete it) */ self->ias_result = value; self->errno = 0; /* Wake up any processes waiting for result */ wake_up_interruptible(&self->query_wait); } /* * Function irda_selective_discovery_indication (discovery) * * Got a selective discovery indication from IrLMP. * * IrLMP is telling us that this node is new and matching our hint bit * filter. Wake up any process waiting for answer... */ static void irda_selective_discovery_indication(discinfo_t *discovery, DISCOVERY_MODE mode, void *priv) { struct irda_sock *self; IRDA_DEBUG(2, "%s()\n", __FUNCTION__); self = (struct irda_sock *) priv; if (!self) { WARNING("%s: lost myself!\n", __FUNCTION__); return; } /* Pass parameter to the caller */ self->cachedaddr = discovery->daddr; /* Wake up process if its waiting for device to be discovered */ wake_up_interruptible(&self->query_wait); } /* * Function irda_discovery_timeout (priv) * * Timeout in the selective discovery process * * We were waiting for a node to be discovered, but nothing has come up * so far. Wake up the user and tell him that we failed... */ static void irda_discovery_timeout(u_long priv) { struct irda_sock *self; IRDA_DEBUG(2, "%s()\n", __FUNCTION__); self = (struct irda_sock *) priv; ASSERT(self != NULL, return;); /* Nothing for the caller */ self->cachelog = NULL; self->cachedaddr = 0; self->errno = -ETIME; /* Wake up process if its still waiting... */ wake_up_interruptible(&self->query_wait); } /* * Function irda_open_tsap (self) * * Open local Transport Service Access Point (TSAP) * */ static int irda_open_tsap(struct irda_sock *self, __u8 tsap_sel, char *name) { notify_t notify; if (self->tsap) { WARNING("%s: busy!\n", __FUNCTION__); return -EBUSY; } /* Initialize callbacks to be used by the IrDA stack */ irda_notify_init(&notify); notify.connect_confirm = irda_connect_confirm; notify.connect_indication = irda_connect_indication; notify.disconnect_indication = irda_disconnect_indication; notify.data_indication = irda_data_indication; notify.udata_indication = irda_data_indication; notify.flow_indication = irda_flow_indication; notify.instance = self; strncpy(notify.name, name, NOTIFY_MAX_NAME); self->tsap = irttp_open_tsap(tsap_sel, DEFAULT_INITIAL_CREDIT, &notify); if (self->tsap == NULL) { IRDA_DEBUG(0, "%s(), Unable to allocate TSAP!\n", __FUNCTION__); return -ENOMEM; } /* Remember which TSAP selector we actually got */ self->stsap_sel = self->tsap->stsap_sel; return 0; } /* * Function irda_open_lsap (self) * * Open local Link Service Access Point (LSAP). Used for opening Ultra * sockets */ #ifdef CONFIG_IRDA_ULTRA static int irda_open_lsap(struct irda_sock *self, int pid) { notify_t notify; if (self->lsap) { WARNING("%s(), busy!\n", __FUNCTION__); return -EBUSY; } /* Initialize callbacks to be used by the IrDA stack */ irda_notify_init(&notify); notify.udata_indication = irda_data_indication; notify.instance = self; strncpy(notify.name, "Ultra", NOTIFY_MAX_NAME); self->lsap = irlmp_open_lsap(LSAP_CONNLESS, &notify, pid); if (self->lsap == NULL) { IRDA_DEBUG( 0, "%s(), Unable to allocate LSAP!\n", __FUNCTION__); return -ENOMEM; } return 0; } #endif /* CONFIG_IRDA_ULTRA */ /* * Function irda_find_lsap_sel (self, name) * * Try to lookup LSAP selector in remote LM-IAS * * Basically, we start a IAP query, and then go to sleep. When the query * return, irda_getvalue_confirm will wake us up, and we can examine the * result of the query... * Note that in some case, the query fail even before we go to sleep, * creating some races... */ static int irda_find_lsap_sel(struct irda_sock *self, char *name) { IRDA_DEBUG(2, "%s(%p, %s)\n", __FUNCTION__, self, name); ASSERT(self != NULL, return -1;); if (self->iriap) { WARNING("%s(): busy with a previous query\n", __FUNCTION__); return -EBUSY; } self->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self, irda_getvalue_confirm); if(self->iriap == NULL) return -ENOMEM; /* Treat unexpected wakeup as disconnect */ self->errno = -EHOSTUNREACH; /* Query remote LM-IAS */ iriap_getvaluebyclass_request(self->iriap, self->saddr, self->daddr, name, "IrDA:TinyTP:LsapSel"); /* Wait for answer, if not yet finished (or failed) */ if (wait_event_interruptible(self->query_wait, (self->iriap==NULL))) /* Treat signals as disconnect */ return -EHOSTUNREACH; /* Check what happened */ if (self->errno) { /* Requested object/attribute doesn't exist */ if((self->errno == IAS_CLASS_UNKNOWN) || (self->errno == IAS_ATTRIB_UNKNOWN)) return (-EADDRNOTAVAIL); else return (-EHOSTUNREACH); } /* Get the remote TSAP selector */ switch (self->ias_result->type) { case IAS_INTEGER: IRDA_DEBUG(4, "%s() int=%d\n", __FUNCTION__, self->ias_result->t.integer); if (self->ias_result->t.integer != -1) self->dtsap_sel = self->ias_result->t.integer; else self->dtsap_sel = 0; break; default: self->dtsap_sel = 0; IRDA_DEBUG(0, "%s(), bad type!\n", __FUNCTION__); break; } if (self->ias_result) irias_delete_value(self->ias_result); if (self->dtsap_sel) return 0; return -EADDRNOTAVAIL; } /* * Function irda_discover_daddr_and_lsap_sel (self, name) * * This try to find a device with the requested service. * * It basically look into the discovery log. For each address in the list, * it queries the LM-IAS of the device to find if this device offer * the requested service. * If there is more than one node supporting the service, we complain * to the user (it should move devices around). * The, we set both the destination address and the lsap selector to point * on the service on the unique device we have found. * * Note : this function fails if there is more than one device in range, * because IrLMP doesn't disconnect the LAP when the last LSAP is closed. * Moreover, we would need to wait the LAP disconnection... */ static int irda_discover_daddr_and_lsap_sel(struct irda_sock *self, char *name) { discinfo_t *discoveries; /* Copy of the discovery log */ int number; /* Number of nodes in the log */ int i; int err = -ENETUNREACH; __u32 daddr = DEV_ADDR_ANY; /* Address we found the service on */ __u8 dtsap_sel = 0x0; /* TSAP associated with it */ IRDA_DEBUG(2, "%s(), name=%s\n", __FUNCTION__, name); ASSERT(self != NULL, return -1;); /* Ask lmp for the current discovery log * Note : we have to use irlmp_get_discoveries(), as opposed * to play with the cachelog directly, because while we are * making our ias query, le log might change... */ discoveries = irlmp_get_discoveries(&number, self->mask.word, self->nslots); /* Check if the we got some results */ if (discoveries == NULL) return -ENETUNREACH; /* No nodes discovered */ /* * Now, check all discovered devices (if any), and connect * client only about the services that the client is * interested in... */ for(i = 0; i < number; i++) { /* Try the address in the log */ self->daddr = discoveries[i].daddr; self->saddr = 0x0; IRDA_DEBUG(1, "%s(), trying daddr = %08x\n", __FUNCTION__, self->daddr); /* Query remote LM-IAS for this service */ err = irda_find_lsap_sel(self, name); switch (err) { case 0: /* We found the requested service */ if(daddr != DEV_ADDR_ANY) { IRDA_DEBUG(1, "%s(), discovered service ''%s'' in two different devices !!!\n", __FUNCTION__, name); self->daddr = DEV_ADDR_ANY; kfree(discoveries); return(-ENOTUNIQ); } /* First time we found that one, save it ! */ daddr = self->daddr; dtsap_sel = self->dtsap_sel; break; case -EADDRNOTAVAIL: /* Requested service simply doesn't exist on this node */ break; default: /* Something bad did happen :-( */ IRDA_DEBUG(0, "%s(), unexpected IAS query failure\n", __FUNCTION__); self->daddr = DEV_ADDR_ANY; kfree(discoveries); return(-EHOSTUNREACH); break; } } /* Cleanup our copy of the discovery log */ kfree(discoveries); /* Check out what we found */ if(daddr == DEV_ADDR_ANY) { IRDA_DEBUG(1, "%s(), cannot discover service ''%s'' in any device !!!\n", __FUNCTION__, name); self->daddr = DEV_ADDR_ANY; return(-EADDRNOTAVAIL); } /* Revert back to discovered device & service */ self->daddr = daddr; self->saddr = 0x0; self->dtsap_sel = dtsap_sel; IRDA_DEBUG(1, "%s(), discovered requested service ''%s'' at address %08x\n", __FUNCTION__, name, self->daddr); return 0; } /* * Function irda_getname (sock, uaddr, uaddr_len, peer) * * Return the our own, or peers socket address (sockaddr_irda) * */ static int irda_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len, int peer) { struct sockaddr_irda saddr; struct sock *sk = sock->sk; struct irda_sock *self = irda_sk(sk); if (peer) { if (sk->sk_state != TCP_ESTABLISHED) return -ENOTCONN; saddr.sir_family = AF_IRDA; saddr.sir_lsap_sel = self->dtsap_sel; saddr.sir_addr = self->daddr; } else { saddr.sir_family = AF_IRDA; saddr.sir_lsap_sel = self->stsap_sel; saddr.sir_addr = self->saddr; } IRDA_DEBUG(1, "%s(), tsap_sel = %#x\n", __FUNCTION__, saddr.sir_lsap_sel); IRDA_DEBUG(1, "%s(), addr = %08x\n", __FUNCTION__, saddr.sir_addr); /* uaddr_len come to us uninitialised */ *uaddr_len = sizeof (struct sockaddr_irda); memcpy(uaddr, &saddr, *uaddr_len); return 0; } /* * Function irda_listen (sock, backlog) * * Just move to the listen state * */ static int irda_listen(struct socket *sock, int backlog) { struct sock *sk = sock->sk; IRDA_DEBUG(2, "%s()\n", __FUNCTION__); if ((sk->sk_type != SOCK_STREAM) && (sk->sk_type != SOCK_SEQPACKET) && (sk->sk_type != SOCK_DGRAM)) return -EOPNOTSUPP; if (sk->sk_state != TCP_LISTEN) { sk->sk_max_ack_backlog = backlog; sk->sk_state = TCP_LISTEN; return 0; } return -EOPNOTSUPP; } /* * Function irda_bind (sock, uaddr, addr_len) * * Used by servers to register their well known TSAP * */ static int irda_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) { struct sock *sk = sock->sk; struct sockaddr_irda *addr = (struct sockaddr_irda *) uaddr; struct irda_sock *self = irda_sk(sk); int err; ASSERT(self != NULL, return -1;); IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self); if (addr_len != sizeof(struct sockaddr_irda)) return -EINVAL; #ifdef CONFIG_IRDA_ULTRA /* Special care for Ultra sockets */ if ((sk->sk_type == SOCK_DGRAM) && (sk->sk_protocol == IRDAPROTO_ULTRA)) { self->pid = addr->sir_lsap_sel; if (self->pid & 0x80) { IRDA_DEBUG(0, "%s(), extension in PID not supp!\n", __FUNCTION__); return -EOPNOTSUPP; } err = irda_open_lsap(self, self->pid); if (err < 0) return err; /* Pretend we are connected */ sock->state = SS_CONNECTED; sk->sk_state = TCP_ESTABLISHED; return 0; } #endif /* CONFIG_IRDA_ULTRA */ err = irda_open_tsap(self, addr->sir_lsap_sel, addr->sir_name); if (err < 0) return err; /* Register with LM-IAS */ self->ias_obj = irias_new_object(addr->sir_name, jiffies); irias_add_integer_attrib(self->ias_obj, "IrDA:TinyTP:LsapSel", self->stsap_sel, IAS_KERNEL_ATTR); irias_insert_object(self->ias_obj); return 0; } /* * Function irda_accept (sock, newsock, flags) * * Wait for incoming connection * */ static int irda_accept(struct socket *sock, struct socket *newsock, int flags) { struct sock *sk = sock->sk; struct irda_sock *new, *self = irda_sk(sk); struct sock *newsk; struct sk_buff *skb; int err; IRDA_DEBUG(2, "%s()\n", __FUNCTION__); ASSERT(self != NULL, return -1;); err = irda_create(newsock, sk->sk_protocol); if (err) return err; if (sock->state != SS_UNCONNECTED) return -EINVAL; if ((sk = sock->sk) == NULL) return -EINVAL; if ((sk->sk_type != SOCK_STREAM) && (sk->sk_type != SOCK_SEQPACKET) && (sk->sk_type != SOCK_DGRAM)) return -EOPNOTSUPP; if (sk->sk_state != TCP_LISTEN) return -EINVAL; /* * The read queue this time is holding sockets ready to use * hooked into the SABM we saved */ /* * We can perform the accept only if there is incoming data * on the listening socket. * So, we will block the caller until we receive any data. * If the caller was waiting on select() or poll() before * calling us, the data is waiting for us ;-) * Jean II */ skb = skb_dequeue(&sk->sk_receive_queue); if (skb == NULL) { int ret = 0; DECLARE_WAITQUEUE(waitq, current); /* Non blocking operation */ if (flags & O_NONBLOCK) return -EWOULDBLOCK; /* The following code is a cut'n'paste of the * wait_event_interruptible() macro. * We don't us the macro because the condition has * side effects : we want to make sure that only one * skb get dequeued - Jean II */ add_wait_queue(sk->sk_sleep, &waitq); for (;;) { set_current_state(TASK_INTERRUPTIBLE); skb = skb_dequeue(&sk->sk_receive_queue); if (skb != NULL) break; if (!signal_pending(current)) { schedule(); continue; } ret = -ERESTARTSYS; break; } current->state = TASK_RUNNING; remove_wait_queue(sk->sk_sleep, &waitq); if(ret) return -ERESTARTSYS; } newsk = newsock->sk; newsk->sk_state = TCP_ESTABLISHED; new = irda_sk(newsk); ASSERT(new != NULL, return -1;); /* Now attach up the new socket */ new->tsap = irttp_dup(self->tsap, new); if (!new->tsap) { IRDA_DEBUG(0, "%s(), dup failed!\n", __FUNCTION__); kfree_skb(skb); return -1; } new->stsap_sel = new->tsap->stsap_sel; new->dtsap_sel = new->tsap->dtsap_sel; new->saddr = irttp_get_saddr(new->tsap); new->daddr = irttp_get_daddr(new->tsap); new->max_sdu_size_tx = self->max_sdu_size_tx; new->max_sdu_size_rx = self->max_sdu_size_rx; new->max_data_size = self->max_data_size; new->max_header_size = self->max_header_size; memcpy(&new->qos_tx, &self->qos_tx, sizeof(struct qos_info)); /* Clean up the original one to keep it in listen state */ irttp_listen(self->tsap); /* Wow ! What is that ? Jean II */ skb->sk = NULL; skb->destructor = NULL; kfree_skb(skb); sk->sk_ack_backlog--; newsock->state = SS_CONNECTED; irda_connect_response(new); return 0; } /* * Function irda_connect (sock, uaddr, addr_len, flags) * * Connect to a IrDA device * * The main difference with a "standard" connect is that with IrDA we need * to resolve the service name into a TSAP selector (in TCP, port number * doesn't have to be resolved). * Because of this service name resoltion, we can offer "auto-connect", * where we connect to a service without specifying a destination address. * * Note : by consulting "errno", the user space caller may learn the cause * of the failure. Most of them are visible in the function, others may come * from subroutines called and are listed here : * o EBUSY : already processing a connect * o EHOSTUNREACH : bad addr->sir_addr argument * o EADDRNOTAVAIL : bad addr->sir_name argument * o ENOTUNIQ : more than one node has addr->sir_name (auto-connect) * o ENETUNREACH : no node found on the network (auto-connect) */ static int irda_connect(struct socket *sock, struct sockaddr *uaddr, int addr_len, int flags) { struct sock *sk = sock->sk; struct sockaddr_irda *addr = (struct sockaddr_irda *) uaddr; struct irda_sock *self = irda_sk(sk); int err; IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self); /* Don't allow connect for Ultra sockets */ if ((sk->sk_type == SOCK_DGRAM) && (sk->sk_protocol == IRDAPROTO_ULTRA)) return -ESOCKTNOSUPPORT; if (sk->sk_state == TCP_ESTABLISHED && sock->state == SS_CONNECTING) { sock->state = SS_CONNECTED; return 0; /* Connect completed during a ERESTARTSYS event */ } if (sk->sk_state == TCP_CLOSE && sock->state == SS_CONNECTING) { sock->state = SS_UNCONNECTED; return -ECONNREFUSED; } if (sk->sk_state == TCP_ESTABLISHED) return -EISCONN; /* No reconnect on a seqpacket socket */ sk->sk_state = TCP_CLOSE; sock->state = SS_UNCONNECTED; if (addr_len != sizeof(struct sockaddr_irda)) return -EINVAL; /* Check if user supplied any destination device address */ if ((!addr->sir_addr) || (addr->sir_addr == DEV_ADDR_ANY)) { /* Try to find one suitable */ err = irda_discover_daddr_and_lsap_sel(self, addr->sir_name); if (err) { IRDA_DEBUG(0, "%s(), auto-connect failed!\n", __FUNCTION__); return err; } } else { /* Use the one provided by the user */ self->daddr = addr->sir_addr; IRDA_DEBUG(1, "%s(), daddr = %08x\n", __FUNCTION__, self->daddr); /* Query remote LM-IAS */ err = irda_find_lsap_sel(self, addr->sir_name); if (err) { IRDA_DEBUG(0, "%s(), connect failed!\n", __FUNCTION__); return err; } } /* Check if we have opened a local TSAP */ if (!self->tsap) irda_open_tsap(self, LSAP_ANY, addr->sir_name); /* Move to connecting socket, start sending Connect Requests */ sock->state = SS_CONNECTING; sk->sk_state = TCP_SYN_SENT; /* Connect to remote device */ err = irttp_connect_request(self->tsap, self->dtsap_sel, self->saddr, self->daddr, NULL, self->max_sdu_size_rx, NULL); if (err) { IRDA_DEBUG(0, "%s(), connect failed!\n", __FUNCTION__); return err; } /* Now the loop */ if (sk->sk_state != TCP_ESTABLISHED && (flags & O_NONBLOCK)) return -EINPROGRESS; if (wait_event_interruptible(*(sk->sk_sleep), (sk->sk_state != TCP_SYN_SENT))) return -ERESTARTSYS; if (sk->sk_state != TCP_ESTABLISHED) { sock->state = SS_UNCONNECTED; return sock_error(sk); /* Always set at this point */ } sock->state = SS_CONNECTED; /* At this point, IrLMP has assigned our source address */ self->saddr = irttp_get_saddr(self->tsap); return 0; } /* * Function irda_create (sock, protocol) * * Create IrDA socket * */ static int irda_create(struct socket *sock, int protocol) { struct sock *sk; struct irda_sock *self; IRDA_DEBUG(2, "%s()\n", __FUNCTION__); /* Check for valid socket type */ switch (sock->type) { case SOCK_STREAM: /* For TTP connections with SAR disabled */ case SOCK_SEQPACKET: /* For TTP connections with SAR enabled */ case SOCK_DGRAM: /* For TTP Unitdata or LMP Ultra transfers */ break; default: return -ESOCKTNOSUPPORT; } /* Allocate networking socket */ if ((sk = sk_alloc(PF_IRDA, GFP_ATOMIC, 1, NULL)) == NULL) return -ENOMEM; /* Allocate IrDA socket */ self = sk->sk_protinfo = kmalloc(sizeof(struct irda_sock), GFP_ATOMIC); if (self == NULL) { sk_free(sk); return -ENOMEM; } memset(self, 0, sizeof(struct irda_sock)); IRDA_DEBUG(2, "%s() : self is %p\n", __FUNCTION__, self); init_waitqueue_head(&self->query_wait); /* Initialise networking socket struct */ sock_init_data(sock, sk); /* Note : set sk->sk_refcnt to 1 */ sk_set_owner(sk, THIS_MODULE); sk->sk_family = PF_IRDA; sk->sk_protocol = protocol; /* Link networking socket and IrDA socket structs together */ self->sk = sk; switch (sock->type) { case SOCK_STREAM: sock->ops = &irda_stream_ops; self->max_sdu_size_rx = TTP_SAR_DISABLE; break; case SOCK_SEQPACKET: sock->ops = &irda_seqpacket_ops; self->max_sdu_size_rx = TTP_SAR_UNBOUND; break; case SOCK_DGRAM: switch (protocol) { #ifdef CONFIG_IRDA_ULTRA case IRDAPROTO_ULTRA: sock->ops = &irda_ultra_ops; /* Initialise now, because we may send on unbound * sockets. Jean II */ self->max_data_size = ULTRA_MAX_DATA - LMP_PID_HEADER; self->max_header_size = IRDA_MAX_HEADER + LMP_PID_HEADER; break; #endif /* CONFIG_IRDA_ULTRA */ case IRDAPROTO_UNITDATA: sock->ops = &irda_dgram_ops; /* We let Unitdata conn. be like seqpack conn. */ self->max_sdu_size_rx = TTP_SAR_UNBOUND; break; default: ERROR("%s: protocol not supported!\n", __FUNCTION__); return -ESOCKTNOSUPPORT; } break; default: return -ESOCKTNOSUPPORT; } /* Register as a client with IrLMP */ self->ckey = irlmp_register_client(0, NULL, NULL, NULL); self->mask.word = 0xffff; self->rx_flow = self->tx_flow = FLOW_START; self->nslots = DISCOVERY_DEFAULT_SLOTS; self->daddr = DEV_ADDR_ANY; /* Until we get connected */ self->saddr = 0x0; /* so IrLMP assign us any link */ return 0; } /* * Function irda_destroy_socket (self) * * Destroy socket * */ void irda_destroy_socket(struct irda_sock *self) { IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self); ASSERT(self != NULL, return;); /* Unregister with IrLMP */ irlmp_unregister_client(self->ckey); irlmp_unregister_service(self->skey); /* Unregister with LM-IAS */ if (self->ias_obj) { irias_delete_object(self->ias_obj); self->ias_obj = NULL; } if (self->iriap) { iriap_close(self->iriap); self->iriap = NULL; } if (self->tsap) { irttp_disconnect_request(self->tsap, NULL, P_NORMAL); irttp_close_tsap(self->tsap); self->tsap = NULL; } #ifdef CONFIG_IRDA_ULTRA if (self->lsap) { irlmp_close_lsap(self->lsap); self->lsap = NULL; } #endif /* CONFIG_IRDA_ULTRA */ kfree(self); } /* * Function irda_release (sock) */ static int irda_release(struct socket *sock) { struct sock *sk = sock->sk; IRDA_DEBUG(2, "%s()\n", __FUNCTION__); if (sk == NULL) return 0; sk->sk_state = TCP_CLOSE; sk->sk_shutdown |= SEND_SHUTDOWN; sk->sk_state_change(sk); /* Destroy IrDA socket */ irda_destroy_socket(irda_sk(sk)); /* Prevent sock_def_destruct() to create havoc */ sk->sk_protinfo = NULL; sock_orphan(sk); sock->sk = NULL; /* Purge queues (see sock_init_data()) */ skb_queue_purge(&sk->sk_receive_queue); /* Destroy networking socket if we are the last reference on it, * i.e. if(sk->sk_refcnt == 0) -> sk_free(sk) */ sock_put(sk); /* Notes on socket locking and deallocation... - Jean II * In theory we should put pairs of sock_hold() / sock_put() to * prevent the socket to be destroyed whenever there is an * outstanding request or outstanding incoming packet or event. * * 1) This may include IAS request, both in connect and getsockopt. * Unfortunately, the situation is a bit more messy than it looks, * because we close iriap and kfree(self) above. * * 2) This may include selective discovery in getsockopt. * Same stuff as above, irlmp registration and self are gone. * * Probably 1 and 2 may not matter, because it's all triggered * by a process and the socket layer already prevent the * socket to go away while a process is holding it, through * sockfd_put() and fput()... * * 3) This may include deferred TSAP closure. In particular, * we may receive a late irda_disconnect_indication() * Fortunately, (tsap_cb *)->close_pend should protect us * from that. * * I did some testing on SMP, and it looks solid. And the socket * memory leak is now gone... - Jean II */ return 0; } /* * Function irda_sendmsg (iocb, sock, msg, len) * * Send message down to TinyTP. This function is used for both STREAM and * SEQPACK services. This is possible since it forces the client to * fragment the message if necessary */ static int irda_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len) { struct sock *sk = sock->sk; struct irda_sock *self; struct sk_buff *skb; unsigned char *asmptr; int err; IRDA_DEBUG(4, "%s(), len=%zd\n", __FUNCTION__, len); /* Note : socket.c set MSG_EOR on SEQPACKET sockets */ if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_CMSG_COMPAT)) return -EINVAL; if (sk->sk_shutdown & SEND_SHUTDOWN) { send_sig(SIGPIPE, current, 0); return -EPIPE; } if (sk->sk_state != TCP_ESTABLISHED) return -ENOTCONN; self = irda_sk(sk); ASSERT(self != NULL, return -1;); /* Check if IrTTP is wants us to slow down */ if (wait_event_interruptible(*(sk->sk_sleep), (self->tx_flow != FLOW_STOP || sk->sk_state != TCP_ESTABLISHED))) return -ERESTARTSYS; /* Check if we are still connected */ if (sk->sk_state != TCP_ESTABLISHED) return -ENOTCONN; /* Check that we don't send out to big frames */ if (len > self->max_data_size) { IRDA_DEBUG(2, "%s(), Chopping frame from %zd to %d bytes!\n", __FUNCTION__, len, self->max_data_size); len = self->max_data_size; } skb = sock_alloc_send_skb(sk, len + self->max_header_size + 16, msg->msg_flags & MSG_DONTWAIT, &err); if (!skb) return -ENOBUFS; skb_reserve(skb, self->max_header_size + 16); asmptr = skb->h.raw = skb_put(skb, len); err = memcpy_fromiovec(asmptr, msg->msg_iov, len); if (err) { kfree_skb(skb); return err; } /* * Just send the message to TinyTP, and let it deal with possible * errors. No need to duplicate all that here */ err = irttp_data_request(self->tsap, skb); if (err) { IRDA_DEBUG(0, "%s(), err=%d\n", __FUNCTION__, err); return err; } /* Tell client how much data we actually sent */ return len; } /* * Function irda_recvmsg_dgram (iocb, sock, msg, size, flags) * * Try to receive message and copy it to user. The frame is discarded * after being read, regardless of how much the user actually read */ static int irda_recvmsg_dgram(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t size, int flags) { struct sock *sk = sock->sk; struct irda_sock *self = irda_sk(sk); struct sk_buff *skb; size_t copied; int err; IRDA_DEBUG(4, "%s()\n", __FUNCTION__); ASSERT(self != NULL, return -1;); skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, flags & MSG_DONTWAIT, &err); if (!skb) return err; skb->h.raw = skb->data; copied = skb->len; if (copied > size) { IRDA_DEBUG(2, "%s(), Received truncated frame (%zd < %zd)!\n", __FUNCTION__, copied, size); copied = size; msg->msg_flags |= MSG_TRUNC; } skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied); skb_free_datagram(sk, skb); /* * Check if we have previously stopped IrTTP and we know * have more free space in our rx_queue. If so tell IrTTP * to start delivering frames again before our rx_queue gets * empty */ if (self->rx_flow == FLOW_STOP) { if ((atomic_read(&sk->sk_rmem_alloc) << 2) <= sk->sk_rcvbuf) { IRDA_DEBUG(2, "%s(), Starting IrTTP\n", __FUNCTION__); self->rx_flow = FLOW_START; irttp_flow_request(self->tsap, FLOW_START); } } return copied; } /* * Function irda_recvmsg_stream (iocb, sock, msg, size, flags) */ static int irda_recvmsg_stream(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t size, int flags) { struct sock *sk = sock->sk; struct irda_sock *self = irda_sk(sk); int noblock = flags & MSG_DONTWAIT; size_t copied = 0; int target = 1; DECLARE_WAITQUEUE(waitq, current); IRDA_DEBUG(3, "%s()\n", __FUNCTION__); ASSERT(self != NULL, return -1;); if (sock->flags & __SO_ACCEPTCON) return(-EINVAL); if (flags & MSG_OOB) return -EOPNOTSUPP; if (flags & MSG_WAITALL) target = size; msg->msg_namelen = 0; do { int chunk; struct sk_buff *skb = skb_dequeue(&sk->sk_receive_queue); if (skb==NULL) { int ret = 0; if (copied >= target) break; /* The following code is a cut'n'paste of the * wait_event_interruptible() macro. * We don't us the macro because the test condition * is messy. - Jean II */ set_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags); add_wait_queue(sk->sk_sleep, &waitq); set_current_state(TASK_INTERRUPTIBLE); /* * POSIX 1003.1g mandates this order. */ if (sk->sk_err) ret = sock_error(sk); else if (sk->sk_shutdown & RCV_SHUTDOWN) ; else if (noblock) ret = -EAGAIN; else if (signal_pending(current)) ret = -ERESTARTSYS; else if (skb_peek(&sk->sk_receive_queue) == NULL) /* Wait process until data arrives */ schedule(); current->state = TASK_RUNNING; remove_wait_queue(sk->sk_sleep, &waitq); clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags); if(ret) return(ret); if (sk->sk_shutdown & RCV_SHUTDOWN) break; continue; } chunk = min_t(unsigned int, skb->len, size); if (memcpy_toiovec(msg->msg_iov, skb->data, chunk)) { skb_queue_head(&sk->sk_receive_queue, skb); if (copied == 0) copied = -EFAULT; break; } copied += chunk; size -= chunk; /* Mark read part of skb as used */ if (!(flags & MSG_PEEK)) { skb_pull(skb, chunk); /* put the skb back if we didn't use it up.. */ if (skb->len) { IRDA_DEBUG(1, "%s(), back on q!\n", __FUNCTION__); skb_queue_head(&sk->sk_receive_queue, skb); break; } kfree_skb(skb); } else { IRDA_DEBUG(0, "%s() questionable!?\n", __FUNCTION__); /* put message back and return */ skb_queue_head(&sk->sk_receive_queue, skb); break; } } while (size); /* * Check if we have previously stopped IrTTP and we know * have more free space in our rx_queue. If so tell IrTTP * to start delivering frames again before our rx_queue gets * empty */ if (self->rx_flow == FLOW_STOP) { if ((atomic_read(&sk->sk_rmem_alloc) << 2) <= sk->sk_rcvbuf) { IRDA_DEBUG(2, "%s(), Starting IrTTP\n", __FUNCTION__); self->rx_flow = FLOW_START; irttp_flow_request(self->tsap, FLOW_START); } } return copied; } /* * Function irda_sendmsg_dgram (iocb, sock, msg, len) * * Send message down to TinyTP for the unreliable sequenced * packet service... * */ static int irda_sendmsg_dgram(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len) { struct sock *sk = sock->sk; struct irda_sock *self; struct sk_buff *skb; unsigned char *asmptr; int err; IRDA_DEBUG(4, "%s(), len=%zd\n", __FUNCTION__, len); if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT)) return -EINVAL; if (sk->sk_shutdown & SEND_SHUTDOWN) { send_sig(SIGPIPE, current, 0); return -EPIPE; } if (sk->sk_state != TCP_ESTABLISHED) return -ENOTCONN; self = irda_sk(sk); ASSERT(self != NULL, return -1;); /* * Check that we don't send out to big frames. This is an unreliable * service, so we have no fragmentation and no coalescence */ if (len > self->max_data_size) { IRDA_DEBUG(0, "%s(), Warning to much data! " "Chopping frame from %zd to %d bytes!\n", __FUNCTION__, len, self->max_data_size); len = self->max_data_size; } skb = sock_alloc_send_skb(sk, len + self->max_header_size, msg->msg_flags & MSG_DONTWAIT, &err); if (!skb) return -ENOBUFS; skb_reserve(skb, self->max_header_size); IRDA_DEBUG(4, "%s(), appending user data\n", __FUNCTION__); asmptr = skb->h.raw = skb_put(skb, len); err = memcpy_fromiovec(asmptr, msg->msg_iov, len); if (err) { kfree_skb(skb); return err; } /* * Just send the message to TinyTP, and let it deal with possible * errors. No need to duplicate all that here */ err = irttp_udata_request(self->tsap, skb); if (err) { IRDA_DEBUG(0, "%s(), err=%d\n", __FUNCTION__, err); return err; } return len; } /* * Function irda_sendmsg_ultra (iocb, sock, msg, len) * * Send message down to IrLMP for the unreliable Ultra * packet service... */ #ifdef CONFIG_IRDA_ULTRA static int irda_sendmsg_ultra(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len) { struct sock *sk = sock->sk; struct irda_sock *self; __u8 pid = 0; int bound = 0; struct sk_buff *skb; unsigned char *asmptr; int err; IRDA_DEBUG(4, "%s(), len=%zd\n", __FUNCTION__, len); if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT)) return -EINVAL; if (sk->sk_shutdown & SEND_SHUTDOWN) { send_sig(SIGPIPE, current, 0); return -EPIPE; } self = irda_sk(sk); ASSERT(self != NULL, return -1;); /* Check if an address was specified with sendto. Jean II */ if (msg->msg_name) { struct sockaddr_irda *addr = (struct sockaddr_irda *) msg->msg_name; /* Check address, extract pid. Jean II */ if (msg->msg_namelen < sizeof(*addr)) return -EINVAL; if (addr->sir_family != AF_IRDA) return -EINVAL; pid = addr->sir_lsap_sel; if (pid & 0x80) { IRDA_DEBUG(0, "%s(), extension in PID not supp!\n", __FUNCTION__); return -EOPNOTSUPP; } } else { /* Check that the socket is properly bound to an Ultra * port. Jean II */ if ((self->lsap == NULL) || (sk->sk_state != TCP_ESTABLISHED)) { IRDA_DEBUG(0, "%s(), socket not bound to Ultra PID.\n", __FUNCTION__); return -ENOTCONN; } /* Use PID from socket */ bound = 1; } /* * Check that we don't send out to big frames. This is an unreliable * service, so we have no fragmentation and no coalescence */ if (len > self->max_data_size) { IRDA_DEBUG(0, "%s(), Warning to much data! " "Chopping frame from %zd to %d bytes!\n", __FUNCTION__, len, self->max_data_size); len = self->max_data_size; } skb = sock_alloc_send_skb(sk, len + self->max_header_size, msg->msg_flags & MSG_DONTWAIT, &err); if (!skb) return -ENOBUFS; skb_reserve(skb, self->max_header_size); IRDA_DEBUG(4, "%s(), appending user data\n", __FUNCTION__); asmptr = skb->h.raw = skb_put(skb, len); err = memcpy_fromiovec(asmptr, msg->msg_iov, len); if (err) { kfree_skb(skb); return err; } err = irlmp_connless_data_request((bound ? self->lsap : NULL), skb, pid); if (err) { IRDA_DEBUG(0, "%s(), err=%d\n", __FUNCTION__, err); return err; } return len; } #endif /* CONFIG_IRDA_ULTRA */ /* * Function irda_shutdown (sk, how) */ static int irda_shutdown(struct socket *sock, int how) { struct sock *sk = sock->sk; struct irda_sock *self = irda_sk(sk); ASSERT(self != NULL, return -1;); IRDA_DEBUG(1, "%s(%p)\n", __FUNCTION__, self); sk->sk_state = TCP_CLOSE; sk->sk_shutdown |= SEND_SHUTDOWN; sk->sk_state_change(sk); if (self->iriap) { iriap_close(self->iriap); self->iriap = NULL; } if (self->tsap) { irttp_disconnect_request(self->tsap, NULL, P_NORMAL); irttp_close_tsap(self->tsap); self->tsap = NULL; } /* A few cleanup so the socket look as good as new... */ self->rx_flow = self->tx_flow = FLOW_START; /* needed ??? */ self->daddr = DEV_ADDR_ANY; /* Until we get re-connected */ self->saddr = 0x0; /* so IrLMP assign us any link */ return 0; } /* * Function irda_poll (file, sock, wait) */ static unsigned int irda_poll(struct file * file, struct socket *sock, poll_table *wait) { struct sock *sk = sock->sk; struct irda_sock *self = irda_sk(sk); unsigned int mask; IRDA_DEBUG(4, "%s()\n", __FUNCTION__); poll_wait(file, sk->sk_sleep, wait); mask = 0; /* Exceptional events? */ if (sk->sk_err) mask |= POLLERR; if (sk->sk_shutdown & RCV_SHUTDOWN) { IRDA_DEBUG(0, "%s(), POLLHUP\n", __FUNCTION__); mask |= POLLHUP; } /* Readable? */ if (!skb_queue_empty(&sk->sk_receive_queue)) { IRDA_DEBUG(4, "Socket is readable\n"); mask |= POLLIN | POLLRDNORM; } /* Connection-based need to check for termination and startup */ switch (sk->sk_type) { case SOCK_STREAM: if (sk->sk_state == TCP_CLOSE) { IRDA_DEBUG(0, "%s(), POLLHUP\n", __FUNCTION__); mask |= POLLHUP; } if (sk->sk_state == TCP_ESTABLISHED) { if ((self->tx_flow == FLOW_START) && sock_writeable(sk)) { mask |= POLLOUT | POLLWRNORM | POLLWRBAND; } } break; case SOCK_SEQPACKET: if ((self->tx_flow == FLOW_START) && sock_writeable(sk)) { mask |= POLLOUT | POLLWRNORM | POLLWRBAND; } break; case SOCK_DGRAM: if (sock_writeable(sk)) mask |= POLLOUT | POLLWRNORM | POLLWRBAND; break; default: break; } return mask; } /* * Function irda_ioctl (sock, cmd, arg) */ static int irda_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) { struct sock *sk = sock->sk; IRDA_DEBUG(4, "%s(), cmd=%#x\n", __FUNCTION__, cmd); switch (cmd) { case TIOCOUTQ: { long amount; amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc); if (amount < 0) amount = 0; if (put_user(amount, (unsigned int __user *)arg)) return -EFAULT; return 0; } case TIOCINQ: { struct sk_buff *skb; long amount = 0L; /* These two are safe on a single CPU system as only user tasks fiddle here */ if ((skb = skb_peek(&sk->sk_receive_queue)) != NULL) amount = skb->len; if (put_user(amount, (unsigned int __user *)arg)) return -EFAULT; return 0; } case SIOCGSTAMP: if (sk != NULL) return sock_get_timestamp(sk, (struct timeval __user *)arg); return -EINVAL; case SIOCGIFADDR: case SIOCSIFADDR: case SIOCGIFDSTADDR: case SIOCSIFDSTADDR: case SIOCGIFBRDADDR: case SIOCSIFBRDADDR: case SIOCGIFNETMASK: case SIOCSIFNETMASK: case SIOCGIFMETRIC: case SIOCSIFMETRIC: return -EINVAL; default: IRDA_DEBUG(1, "%s(), doing device ioctl!\n", __FUNCTION__); return dev_ioctl(cmd, (void __user *) arg); } /*NOTREACHED*/ return 0; } /* * Function irda_setsockopt (sock, level, optname, optval, optlen) * * Set some options for the socket * */ static int irda_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen) { struct sock *sk = sock->sk; struct irda_sock *self = irda_sk(sk); struct irda_ias_set *ias_opt; struct ias_object *ias_obj; struct ias_attrib * ias_attr; /* Attribute in IAS object */ int opt; ASSERT(self != NULL, return -1;); IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self); if (level != SOL_IRLMP) return -ENOPROTOOPT; switch (optname) { case IRLMP_IAS_SET: /* The user want to add an attribute to an existing IAS object * (in the IAS database) or to create a new object with this * attribute. * We first query IAS to know if the object exist, and then * create the right attribute... */ if (optlen != sizeof(struct irda_ias_set)) return -EINVAL; ias_opt = kmalloc(sizeof(struct irda_ias_set), GFP_ATOMIC); if (ias_opt == NULL) return -ENOMEM; /* Copy query to the driver. */ if (copy_from_user(ias_opt, optval, optlen)) { kfree(ias_opt); return -EFAULT; } /* Find the object we target. * If the user gives us an empty string, we use the object * associated with this socket. This will workaround * duplicated class name - Jean II */ if(ias_opt->irda_class_name[0] == '\0') { if(self->ias_obj == NULL) { kfree(ias_opt); return -EINVAL; } ias_obj = self->ias_obj; } else ias_obj = irias_find_object(ias_opt->irda_class_name); /* Only ROOT can mess with the global IAS database. * Users can only add attributes to the object associated * with the socket they own - Jean II */ if((!capable(CAP_NET_ADMIN)) && ((ias_obj == NULL) || (ias_obj != self->ias_obj))) { kfree(ias_opt); return -EPERM; } /* If the object doesn't exist, create it */ if(ias_obj == (struct ias_object *) NULL) { /* Create a new object */ ias_obj = irias_new_object(ias_opt->irda_class_name, jiffies); } /* Do we have the attribute already ? */ if(irias_find_attrib(ias_obj, ias_opt->irda_attrib_name)) { kfree(ias_opt); return -EINVAL; } /* Look at the type */ switch(ias_opt->irda_attrib_type) { case IAS_INTEGER: /* Add an integer attribute */ irias_add_integer_attrib( ias_obj, ias_opt->irda_attrib_name, ias_opt->attribute.irda_attrib_int, IAS_USER_ATTR); break; case IAS_OCT_SEQ: /* Check length */ if(ias_opt->attribute.irda_attrib_octet_seq.len > IAS_MAX_OCTET_STRING) { kfree(ias_opt); return -EINVAL; } /* Add an octet sequence attribute */ irias_add_octseq_attrib( ias_obj, ias_opt->irda_attrib_name, ias_opt->attribute.irda_attrib_octet_seq.octet_seq, ias_opt->attribute.irda_attrib_octet_seq.len, IAS_USER_ATTR); break; case IAS_STRING: /* Should check charset & co */ /* Check length */ /* The length is encoded in a __u8, and * IAS_MAX_STRING == 256, so there is no way * userspace can pass us a string too large. * Jean II */ /* NULL terminate the string (avoid troubles) */ ias_opt->attribute.irda_attrib_string.string[ias_opt->attribute.irda_attrib_string.len] = '\0'; /* Add a string attribute */ irias_add_string_attrib( ias_obj, ias_opt->irda_attrib_name, ias_opt->attribute.irda_attrib_string.string, IAS_USER_ATTR); break; default : kfree(ias_opt); return -EINVAL; } irias_insert_object(ias_obj); kfree(ias_opt); break; case IRLMP_IAS_DEL: /* The user want to delete an object from our local IAS * database. We just need to query the IAS, check is the * object is not owned by the kernel and delete it. */ if (optlen != sizeof(struct irda_ias_set)) return -EINVAL; ias_opt = kmalloc(sizeof(struct irda_ias_set), GFP_ATOMIC); if (ias_opt == NULL) return -ENOMEM; /* Copy query to the driver. */ if (copy_from_user(ias_opt, optval, optlen)) { kfree(ias_opt); return -EFAULT; } /* Find the object we target. * If the user gives us an empty string, we use the object * associated with this socket. This will workaround * duplicated class name - Jean II */ if(ias_opt->irda_class_name[0] == '\0') ias_obj = self->ias_obj; else ias_obj = irias_find_object(ias_opt->irda_class_name); if(ias_obj == (struct ias_object *) NULL) { kfree(ias_opt); return -EINVAL; } /* Only ROOT can mess with the global IAS database. * Users can only del attributes from the object associated * with the socket they own - Jean II */ if((!capable(CAP_NET_ADMIN)) && ((ias_obj == NULL) || (ias_obj != self->ias_obj))) { kfree(ias_opt); return -EPERM; } /* Find the attribute (in the object) we target */ ias_attr = irias_find_attrib(ias_obj, ias_opt->irda_attrib_name); if(ias_attr == (struct ias_attrib *) NULL) { kfree(ias_opt); return -EINVAL; } /* Check is the user space own the object */ if(ias_attr->value->owner != IAS_USER_ATTR) { IRDA_DEBUG(1, "%s(), attempting to delete a kernel attribute\n", __FUNCTION__); kfree(ias_opt); return -EPERM; } /* Remove the attribute (and maybe the object) */ irias_delete_attrib(ias_obj, ias_attr, 1); kfree(ias_opt); break; case IRLMP_MAX_SDU_SIZE: if (optlen < sizeof(int)) return -EINVAL; if (get_user(opt, (int __user *)optval)) return -EFAULT; /* Only possible for a seqpacket service (TTP with SAR) */ if (sk->sk_type != SOCK_SEQPACKET) { IRDA_DEBUG(2, "%s(), setting max_sdu_size = %d\n", __FUNCTION__, opt); self->max_sdu_size_rx = opt; } else { WARNING("%s: not allowed to set MAXSDUSIZE for this socket type!\n", __FUNCTION__); return -ENOPROTOOPT; } break; case IRLMP_HINTS_SET: if (optlen < sizeof(int)) return -EINVAL; /* The input is really a (__u8 hints[2]), easier as an int */ if (get_user(opt, (int __user *)optval)) return -EFAULT; /* Unregister any old registration */ if (self->skey) irlmp_unregister_service(self->skey); self->skey = irlmp_register_service((__u16) opt); break; case IRLMP_HINT_MASK_SET: /* As opposed to the previous case which set the hint bits * that we advertise, this one set the filter we use when * making a discovery (nodes which don't match any hint * bit in the mask are not reported). */ if (optlen < sizeof(int)) return -EINVAL; /* The input is really a (__u8 hints[2]), easier as an int */ if (get_user(opt, (int __user *)optval)) return -EFAULT; /* Set the new hint mask */ self->mask.word = (__u16) opt; /* Mask out extension bits */ self->mask.word &= 0x7f7f; /* Check if no bits */ if(!self->mask.word) self->mask.word = 0xFFFF; break; default: return -ENOPROTOOPT; } return 0; } /* * Function irda_extract_ias_value(ias_opt, ias_value) * * Translate internal IAS value structure to the user space representation * * The external representation of IAS values, as we exchange them with * user space program is quite different from the internal representation, * as stored in the IAS database (because we need a flat structure for * crossing kernel boundary). * This function transform the former in the latter. We also check * that the value type is valid. */ static int irda_extract_ias_value(struct irda_ias_set *ias_opt, struct ias_value *ias_value) { /* Look at the type */ switch (ias_value->type) { case IAS_INTEGER: /* Copy the integer */ ias_opt->attribute.irda_attrib_int = ias_value->t.integer; break; case IAS_OCT_SEQ: /* Set length */ ias_opt->attribute.irda_attrib_octet_seq.len = ias_value->len; /* Copy over */ memcpy(ias_opt->attribute.irda_attrib_octet_seq.octet_seq, ias_value->t.oct_seq, ias_value->len); break; case IAS_STRING: /* Set length */ ias_opt->attribute.irda_attrib_string.len = ias_value->len; ias_opt->attribute.irda_attrib_string.charset = ias_value->charset; /* Copy over */ memcpy(ias_opt->attribute.irda_attrib_string.string, ias_value->t.string, ias_value->len); /* NULL terminate the string (avoid troubles) */ ias_opt->attribute.irda_attrib_string.string[ias_value->len] = '\0'; break; case IAS_MISSING: default : return -EINVAL; } /* Copy type over */ ias_opt->irda_attrib_type = ias_value->type; return 0; } /* * Function irda_getsockopt (sock, level, optname, optval, optlen) */ static int irda_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen) { struct sock *sk = sock->sk; struct irda_sock *self = irda_sk(sk); struct irda_device_list list; struct irda_device_info *discoveries; struct irda_ias_set * ias_opt; /* IAS get/query params */ struct ias_object * ias_obj; /* Object in IAS */ struct ias_attrib * ias_attr; /* Attribute in IAS object */ int daddr = DEV_ADDR_ANY; /* Dest address for IAS queries */ int val = 0; int len = 0; int err; int offset, total; IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self); if (level != SOL_IRLMP) return -ENOPROTOOPT; if (get_user(len, optlen)) return -EFAULT; if(len < 0) return -EINVAL; switch (optname) { case IRLMP_ENUMDEVICES: /* Ask lmp for the current discovery log */ discoveries = irlmp_get_discoveries(&list.len, self->mask.word, self->nslots); /* Check if the we got some results */ if (discoveries == NULL) return -EAGAIN; /* Didn't find any devices */ err = 0; /* Write total list length back to client */ if (copy_to_user(optval, &list, sizeof(struct irda_device_list) - sizeof(struct irda_device_info))) err = -EFAULT; /* Offset to first device entry */ offset = sizeof(struct irda_device_list) - sizeof(struct irda_device_info); /* Copy the list itself - watch for overflow */ if(list.len > 2048) { err = -EINVAL; goto bed; } total = offset + (list.len * sizeof(struct irda_device_info)); if (total > len) total = len; if (copy_to_user(optval+offset, discoveries, total - offset)) err = -EFAULT; /* Write total number of bytes used back to client */ if (put_user(total, optlen)) err = -EFAULT; bed: /* Free up our buffer */ kfree(discoveries); if (err) return err; break; case IRLMP_MAX_SDU_SIZE: val = self->max_data_size; len = sizeof(int); if (put_user(len, optlen)) return -EFAULT; if (copy_to_user(optval, &val, len)) return -EFAULT; break; case IRLMP_IAS_GET: /* The user want an object from our local IAS database. * We just need to query the IAS and return the value * that we found */ /* Check that the user has allocated the right space for us */ if (len != sizeof(struct irda_ias_set)) return -EINVAL; ias_opt = kmalloc(sizeof(struct irda_ias_set), GFP_ATOMIC); if (ias_opt == NULL) return -ENOMEM; /* Copy query to the driver. */ if (copy_from_user(ias_opt, optval, len)) { kfree(ias_opt); return -EFAULT; } /* Find the object we target. * If the user gives us an empty string, we use the object * associated with this socket. This will workaround * duplicated class name - Jean II */ if(ias_opt->irda_class_name[0] == '\0') ias_obj = self->ias_obj; else ias_obj = irias_find_object(ias_opt->irda_class_name); if(ias_obj == (struct ias_object *) NULL) { kfree(ias_opt); return -EINVAL; } /* Find the attribute (in the object) we target */ ias_attr = irias_find_attrib(ias_obj, ias_opt->irda_attrib_name); if(ias_attr == (struct ias_attrib *) NULL) { kfree(ias_opt); return -EINVAL; } /* Translate from internal to user structure */ err = irda_extract_ias_value(ias_opt, ias_attr->value); if(err) { kfree(ias_opt); return err; } /* Copy reply to the user */ if (copy_to_user(optval, ias_opt, sizeof(struct irda_ias_set))) { kfree(ias_opt); return -EFAULT; } /* Note : don't need to put optlen, we checked it */ kfree(ias_opt); break; case IRLMP_IAS_QUERY: /* The user want an object from a remote IAS database. * We need to use IAP to query the remote database and * then wait for the answer to come back. */ /* Check that the user has allocated the right space for us */ if (len != sizeof(struct irda_ias_set)) return -EINVAL; ias_opt = kmalloc(sizeof(struct irda_ias_set), GFP_ATOMIC); if (ias_opt == NULL) return -ENOMEM; /* Copy query to the driver. */ if (copy_from_user(ias_opt, optval, len)) { kfree(ias_opt); return -EFAULT; } /* At this point, there are two cases... * 1) the socket is connected - that's the easy case, we * just query the device we are connected to... * 2) the socket is not connected - the user doesn't want * to connect and/or may not have a valid service name * (so can't create a fake connection). In this case, * we assume that the user pass us a valid destination * address in the requesting structure... */ if(self->daddr != DEV_ADDR_ANY) { /* We are connected - reuse known daddr */ daddr = self->daddr; } else { /* We are not connected, we must specify a valid * destination address */ daddr = ias_opt->daddr; if((!daddr) || (daddr == DEV_ADDR_ANY)) { kfree(ias_opt); return -EINVAL; } } /* Check that we can proceed with IAP */ if (self->iriap) { WARNING("%s: busy with a previous query\n", __FUNCTION__); kfree(ias_opt); return -EBUSY; } self->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self, irda_getvalue_confirm); if (self->iriap == NULL) { kfree(ias_opt); return -ENOMEM; } /* Treat unexpected wakeup as disconnect */ self->errno = -EHOSTUNREACH; /* Query remote LM-IAS */ iriap_getvaluebyclass_request(self->iriap, self->saddr, daddr, ias_opt->irda_class_name, ias_opt->irda_attrib_name); /* Wait for answer, if not yet finished (or failed) */ if (wait_event_interruptible(self->query_wait, (self->iriap == NULL))) { /* pending request uses copy of ias_opt-content * we can free it regardless! */ kfree(ias_opt); /* Treat signals as disconnect */ return -EHOSTUNREACH; } /* Check what happened */ if (self->errno) { kfree(ias_opt); /* Requested object/attribute doesn't exist */ if((self->errno == IAS_CLASS_UNKNOWN) || (self->errno == IAS_ATTRIB_UNKNOWN)) return (-EADDRNOTAVAIL); else return (-EHOSTUNREACH); } /* Translate from internal to user structure */ err = irda_extract_ias_value(ias_opt, self->ias_result); if (self->ias_result) irias_delete_value(self->ias_result); if (err) { kfree(ias_opt); return err; } /* Copy reply to the user */ if (copy_to_user(optval, ias_opt, sizeof(struct irda_ias_set))) { kfree(ias_opt); return -EFAULT; } /* Note : don't need to put optlen, we checked it */ kfree(ias_opt); break; case IRLMP_WAITDEVICE: /* This function is just another way of seeing life ;-) * IRLMP_ENUMDEVICES assumes that you have a static network, * and that you just want to pick one of the devices present. * On the other hand, in here we assume that no device is * present and that at some point in the future a device will * come into range. When this device arrive, we just wake * up the caller, so that he has time to connect to it before * the device goes away... * Note : once the node has been discovered for more than a * few second, it won't trigger this function, unless it * goes away and come back changes its hint bits (so we * might call it IRLMP_WAITNEWDEVICE). */ /* Check that the user is passing us an int */ if (len != sizeof(int)) return -EINVAL; /* Get timeout in ms (max time we block the caller) */ if (get_user(val, (int __user *)optval)) return -EFAULT; /* Tell IrLMP we want to be notified */ irlmp_update_client(self->ckey, self->mask.word, irda_selective_discovery_indication, NULL, (void *) self); /* Do some discovery (and also return cached results) */ irlmp_discovery_request(self->nslots); /* Wait until a node is discovered */ if (!self->cachedaddr) { int ret = 0; IRDA_DEBUG(1, "%s(), nothing discovered yet, going to sleep...\n", __FUNCTION__); /* Set watchdog timer to expire in <val> ms. */ self->errno = 0; init_timer(&self->watchdog); self->watchdog.function = irda_discovery_timeout; self->watchdog.data = (unsigned long) self; self->watchdog.expires = jiffies + (val * HZ/1000); add_timer(&(self->watchdog)); /* Wait for IR-LMP to call us back */ __wait_event_interruptible(self->query_wait, (self->cachedaddr != 0 || self->errno == -ETIME), ret); /* If watchdog is still activated, kill it! */ if(timer_pending(&(self->watchdog))) del_timer(&(self->watchdog)); IRDA_DEBUG(1, "%s(), ...waking up !\n", __FUNCTION__); if (ret != 0) return ret; } else IRDA_DEBUG(1, "%s(), found immediately !\n", __FUNCTION__); /* Tell IrLMP that we have been notified */ irlmp_update_client(self->ckey, self->mask.word, NULL, NULL, NULL); /* Check if the we got some results */ if (!self->cachedaddr) return -EAGAIN; /* Didn't find any devices */ daddr = self->cachedaddr; /* Cleanup */ self->cachedaddr = 0; /* We return the daddr of the device that trigger the * wakeup. As irlmp pass us only the new devices, we * are sure that it's not an old device. * If the user want more details, he should query * the whole discovery log and pick one device... */ if (put_user(daddr, (int __user *)optval)) return -EFAULT; break; default: return -ENOPROTOOPT; } return 0; } static struct net_proto_family irda_family_ops = { .family = PF_IRDA, .create = irda_create, .owner = THIS_MODULE, }; static struct proto_ops SOCKOPS_WRAPPED(irda_stream_ops) = { .family = PF_IRDA, .owner = THIS_MODULE, .release = irda_release, .bind = irda_bind, .connect = irda_connect, .socketpair = sock_no_socketpair, .accept = irda_accept, .getname = irda_getname, .poll = irda_poll, .ioctl = irda_ioctl, .listen = irda_listen, .shutdown = irda_shutdown, .setsockopt = irda_setsockopt, .getsockopt = irda_getsockopt, .sendmsg = irda_sendmsg, .recvmsg = irda_recvmsg_stream, .mmap = sock_no_mmap, .sendpage = sock_no_sendpage, }; static struct proto_ops SOCKOPS_WRAPPED(irda_seqpacket_ops) = { .family = PF_IRDA, .owner = THIS_MODULE, .release = irda_release, .bind = irda_bind, .connect = irda_connect, .socketpair = sock_no_socketpair, .accept = irda_accept, .getname = irda_getname, .poll = datagram_poll, .ioctl = irda_ioctl, .listen = irda_listen, .shutdown = irda_shutdown, .setsockopt = irda_setsockopt, .getsockopt = irda_getsockopt, .sendmsg = irda_sendmsg, .recvmsg = irda_recvmsg_dgram, .mmap = sock_no_mmap, .sendpage = sock_no_sendpage, }; static struct proto_ops SOCKOPS_WRAPPED(irda_dgram_ops) = { .family = PF_IRDA, .owner = THIS_MODULE, .release = irda_release, .bind = irda_bind, .connect = irda_connect, .socketpair = sock_no_socketpair, .accept = irda_accept, .getname = irda_getname, .poll = datagram_poll, .ioctl = irda_ioctl, .listen = irda_listen, .shutdown = irda_shutdown, .setsockopt = irda_setsockopt, .getsockopt = irda_getsockopt, .sendmsg = irda_sendmsg_dgram, .recvmsg = irda_recvmsg_dgram, .mmap = sock_no_mmap, .sendpage = sock_no_sendpage, }; #ifdef CONFIG_IRDA_ULTRA static struct proto_ops SOCKOPS_WRAPPED(irda_ultra_ops) = { .family = PF_IRDA, .owner = THIS_MODULE, .release = irda_release, .bind = irda_bind, .connect = sock_no_connect, .socketpair = sock_no_socketpair, .accept = sock_no_accept, .getname = irda_getname, .poll = datagram_poll, .ioctl = irda_ioctl, .listen = sock_no_listen, .shutdown = irda_shutdown, .setsockopt = irda_setsockopt, .getsockopt = irda_getsockopt, .sendmsg = irda_sendmsg_ultra, .recvmsg = irda_recvmsg_dgram, .mmap = sock_no_mmap, .sendpage = sock_no_sendpage, }; #endif /* CONFIG_IRDA_ULTRA */ #include <linux/smp_lock.h> SOCKOPS_WRAP(irda_stream, PF_IRDA); SOCKOPS_WRAP(irda_seqpacket, PF_IRDA); SOCKOPS_WRAP(irda_dgram, PF_IRDA); #ifdef CONFIG_IRDA_ULTRA SOCKOPS_WRAP(irda_ultra, PF_IRDA); #endif /* CONFIG_IRDA_ULTRA */ /* * Function irsock_init (pro) * * Initialize IrDA protocol * */ int __init irsock_init(void) { sock_register(&irda_family_ops); return 0; } /* * Function irsock_cleanup (void) * * Remove IrDA protocol * */ void __exit irsock_cleanup(void) { sock_unregister(PF_IRDA); return; }
marcelo-duffles/linux-rat-2.6.10
net/irda/af_irda.c
C
gpl-2.0
68,168
[ 30522, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
var foo = createReactClass({}); var bar = React.createClass({});
hulkish/babel
packages/babel-plugin-transform-react-display-name/test/fixtures/display-name/variable-declarator/input.js
JavaScript
mit
64
[ 30522, 13075, 29379, 1027, 3443, 16416, 6593, 26266, 1006, 1063, 1065, 1007, 1025, 13075, 3347, 1027, 10509, 1012, 3443, 26266, 1006, 1063, 1065, 1007, 1025, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package com.oracle.graal.lir.sparc; import static com.oracle.graal.api.code.ValueUtil.*; import static com.oracle.graal.asm.sparc.SPARCAssembler.*; import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*; import static com.oracle.graal.sparc.SPARC.*; import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.asm.sparc.*; import com.oracle.graal.compiler.common.*; import com.oracle.graal.lir.*; import com.oracle.graal.lir.asm.*; import com.oracle.graal.lir.gen.*; public final class SPARCBitManipulationOp extends SPARCLIRInstruction { public static final LIRInstructionClass<SPARCBitManipulationOp> TYPE = LIRInstructionClass.create(SPARCBitManipulationOp.class); public enum IntrinsicOpcode { IPOPCNT, LPOPCNT, IBSR, LBSR, BSF; } @Opcode private final IntrinsicOpcode opcode; @Def protected AllocatableValue result; @Alive({REG}) protected AllocatableValue input; @Temp({REG}) protected Value scratch; public SPARCBitManipulationOp(IntrinsicOpcode opcode, AllocatableValue result, AllocatableValue input, LIRGeneratorTool gen) { super(TYPE); this.opcode = opcode; this.result = result; this.input = input; scratch = gen.newVariable(LIRKind.derive(input)); } @Override public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) { Register dst = asIntReg(result); if (isRegister(input)) { Register src = asRegister(input); switch (opcode) { case IPOPCNT: // clear upper word for 64 bit POPC masm.srl(src, g0, dst); masm.popc(dst, dst); break; case LPOPCNT: masm.popc(src, dst); break; case BSF: Kind tkind = input.getKind(); if (tkind == Kind.Int) { masm.sub(src, 1, dst); masm.andn(dst, src, dst); masm.srl(dst, g0, dst); masm.popc(dst, dst); } else if (tkind == Kind.Long) { masm.sub(src, 1, dst); masm.andn(dst, src, dst); masm.popc(dst, dst); } else { throw GraalInternalError.shouldNotReachHere("missing: " + tkind); } break; case IBSR: { Kind ikind = input.getKind(); assert ikind == Kind.Int; Register tmp = asRegister(scratch); assert !tmp.equals(dst); masm.srl(src, 1, tmp); masm.srl(src, 0, dst); masm.or(dst, tmp, dst); masm.srl(dst, 2, tmp); masm.or(dst, tmp, dst); masm.srl(dst, 4, tmp); masm.or(dst, tmp, dst); masm.srl(dst, 8, tmp); masm.or(dst, tmp, dst); masm.srl(dst, 16, tmp); masm.or(dst, tmp, dst); masm.popc(dst, dst); masm.sub(dst, 1, dst); break; } case LBSR: { Kind lkind = input.getKind(); assert lkind == Kind.Long; Register tmp = asRegister(scratch); assert !tmp.equals(dst); masm.srlx(src, 1, tmp); masm.or(src, tmp, dst); masm.srlx(dst, 2, tmp); masm.or(dst, tmp, dst); masm.srlx(dst, 4, tmp); masm.or(dst, tmp, dst); masm.srlx(dst, 8, tmp); masm.or(dst, tmp, dst); masm.srlx(dst, 16, tmp); masm.or(dst, tmp, dst); masm.srlx(dst, 32, tmp); masm.or(dst, tmp, dst); masm.popc(dst, dst); masm.sub(dst, 1, dst); // This is required to fit the given structure. break; } default: throw GraalInternalError.shouldNotReachHere(); } } else if (isConstant(input) && isSimm13(crb.asIntConst(input))) { switch (opcode) { case IPOPCNT: masm.popc(crb.asIntConst(input), dst); break; case LPOPCNT: masm.popc(crb.asIntConst(input), dst); break; default: throw GraalInternalError.shouldNotReachHere(); } } else { throw GraalInternalError.shouldNotReachHere(); } } }
BunnyWei/truffle-llvmir
graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCBitManipulationOp.java
Java
gpl-2.0
6,018
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2262, 1010, 2297, 1010, 14721, 1998, 1013, 2030, 2049, 18460, 1012, 2035, 2916, 9235, 1012, 1008, 2079, 2025, 11477, 2030, 6366, 9385, 14444, 2030, 2023, 5371, 20346, 1012, 1008, 1008, 2023, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright 2013 Real Logic Ltd. * * 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 uk.co.real_logic.agrona; import java.util.Map; /** * Various verification checks to be applied in code. */ public class Verify { /** * Verify that a reference is not null. * * @param ref to be verified not null. * @param name of the reference to be verified. */ public static void notNull(final Object ref, final String name) { if (null == ref) { throw new NullPointerException(name + " must not be null"); } } /** * Verify that a map contains and entry for a given key. * * @param map to be checked. * @param key to get by. * @param name of entry. * @throws NullPointerException if map or key is null * @throws IllegalStateException if the entry does not exist. */ public static void present(final Map<?, ?> map, final Object key, final String name) { if (null == map.get(key)) { throw new IllegalStateException(name + " not found in map for key: " + key); } } }
ligzy/Agrona
src/main/java/uk/co/real_logic/agrona/Verify.java
Java
apache-2.0
1,641
[ 30522, 1013, 1008, 1008, 9385, 2286, 2613, 7961, 5183, 1012, 1008, 1008, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 1008, 2017, 2089, 2025, 2224, 2023, 5371, 3272, 1999, 12646, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// Copyright (C) 2014-2015 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the // terms of the GNU General Public License as published by the // Free Software Foundation; either version 3, or (at your option) // any later version. // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. #include <regex> #include <testsuite_performance.h> using namespace __gnu_test; int main() { time_counter time; resource_counter resource; start_counters(time, resource); // this should get compiled to just L"[abcd]" auto re = std::wregex(L'[' + std::wstring(300, L'a') + L"bc" + std::wstring(1000, 'a') + L"d]"); bool ok = true; for (int i = 0; i < 100000; ++i) ok = ok && (std::regex_match(L"b", re) && std::regex_match(L"d", re)); stop_counters(time, resource); report_performance(__FILE__, "", time, resource); return ok ? 0 : 1; }
evaautomation/gcc-linaro
libstdc++-v3/testsuite/performance/28_regex/range.cc
C++
gpl-2.0
1,354
[ 30522, 1013, 1013, 9385, 1006, 1039, 1007, 2297, 1011, 2325, 2489, 4007, 3192, 1010, 4297, 1012, 1013, 1013, 1013, 1013, 2023, 5371, 2003, 2112, 1997, 1996, 27004, 11163, 1039, 1009, 1009, 3075, 1012, 2023, 3075, 2003, 2489, 1013, 1013, 4...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
.pinboard-open-btn { margin-top: -1px; background-color: #e6eef5 !important; color: #252c33 !important; } #pinboard-panel { background-color: #e6eef5; color: #252c33; flex: auto; -webkit-flex: auto; display: flex; display: -webkit-flex; flex-flow: row; -webkit-flex-flow: row; } #pinboard-panel .header { padding-left: 2px; height: 18px; } /* * Pinned jobs container */ #pinned-job-list { position: relative; flex: auto; -webkit-flex: auto; margin: 7px 7px 10px; } #pinned-job-list .content { position: absolute; width: 100%; height: 100%; padding: 2px; overflow: auto; background-color: #FFFFFF; } .pinned-job { margin-bottom: 2px; padding: 1px 2px; width: 3.5em; } .pinned-job-close-btn { padding: 1px 2px 1px 2px; border-color: #fafafa #fafafa #fafafa transparent; } .pinboard-preload-txt { color: #bfbfbf; } /* * Related bugs container */ #pinboard-related-bugs { position: relative; width: 200px; flex: none; -webkit-flex: none; margin: 7px 7px 10px; } #pinboard-related-bugs .content { position: absolute; height: 100%; width: 200px; padding: 2px; overflow-x: hidden; color: black; background-color: #FFFFFF; } .add-related-bugs-icon { margin-right: 2px; font-size: 17px; color: #98c3da; } .add-related-bugs-form { position: relative; top: -18px; left: 20px; } .add-related-bugs-input { width: 12em; } .pinboard-related-bug-preload-txt { vertical-align: top; } .pinboard-related-bugs-btn { margin-bottom: -1px; } .pinboard-related-bugs-btn:hover > .related-bugs-link { color: #2a6496; text-decoration: underline; } /* Spin button suppression on chrome (bug 1045611) */ #pinboard-related-bugs form input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; } /* Spin button suppression on firefox (bug 1045611) */ #pinboard-related-bugs form input[type=number] { -moz-appearance: textfield; } /* * Classification container */ #pinboard-classification { flex: none; -webkit-flex: none; width: 185px; padding: 5px; } .pinboard-label { color: #777; } #pinboard-classification-content { color: black; } #pinboard-classification select { width: 177px; } .add-classification-input { width: 177px; height: 20px; padding: 0 0 0 3px; border-radius: 0; font-size: 12px; } /* * Save container and dropdown menu controls */ #pinboard-controls { flex: none; -webkit-flex: none; height: 43px; margin: 20px; } #pinboard-controls .dropdown-menu { z-index: 2000; } #pinboard-controls .save-btn-dropdown { margin-left: -1px; padding-top: 1px; display: inline; width: 24px; float: right; } #pinboard-controls .save-btn { float: left; display: inline; width: 70px; } .save-btn { width: 81px; } .save-btn-dropdown { width: 18px; } .btn-group + .btn + .save-btn-dropdown { margin-left: -5px; }
glenn124f/treeherder
ui/css/treeherder-pinboard.css
CSS
mpl-2.0
2,910
[ 30522, 1012, 9231, 6277, 1011, 2330, 1011, 18411, 2078, 1063, 7785, 1011, 2327, 1024, 1011, 1015, 2361, 2595, 1025, 4281, 1011, 3609, 1024, 1001, 1041, 2575, 4402, 2546, 2629, 999, 2590, 1025, 3609, 1024, 1001, 22898, 2278, 22394, 999, 25...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* $Id: isdnloop.c,v 1.9 1999/09/06 07:29:36 fritz Exp $ * ISDN low-level module implementing a dummy loop driver. * * Copyright 1997 by Fritz Elfert (fritz@isdn4linux.de) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log: isdnloop.c,v $ * Revision 1.9 1999/09/06 07:29:36 fritz * Changed my mail-address. * * Revision 1.8 1998/11/18 18:59:43 armin * changes for 2.1.127 * * Revision 1.7 1998/10/30 18:58:03 he * typecast to suppress a compiler warning * * Revision 1.6 1998/06/17 19:51:37 he * merged with 2.1.10[34] (cosmetics and udelay() -> mdelay()) * brute force fix to avoid Ugh's in isdn_tty_write() * cleaned up some dead code * * Revision 1.5 1998/04/14 20:59:32 he * merged 2.1.94 changes * * Revision 1.4 1998/02/24 21:39:05 he * L2_PROT_X25DTE / DCE * additional state 17 and new internal signal messages "BCON_I" * (for reliable connect confirmation primitive as needed by x.25 upper layer) * Changes for new LL-HL interface * * Revision 1.3 1998/02/20 17:33:30 fritz * Changes for recent kernels. * * Revision 1.2 1997/10/01 09:22:03 fritz * Removed old compatibility stuff for 2.0.X kernels. * From now on, this code is for 2.1.X ONLY! * Old stuff is still in the separate branch. * * Revision 1.1 1997/03/24 23:02:04 fritz * Added isdnloop driver. * */ #include <linux/config.h> #include "isdnloop.h" static char *revision = "$Revision: 1.9 $"; static int isdnloop_addcard(char *); /* * Free queue completely. * * Parameter: * card = pointer to card struct * channel = channel number */ static void isdnloop_free_queue(isdnloop_card * card, int channel) { struct sk_buff_head *queue = &card->bqueue[channel]; struct sk_buff *skb; while ((skb = skb_dequeue(queue))) dev_kfree_skb(skb); card->sndcount[channel] = 0; } /* * Send B-Channel data to another virtual card. * This routine is called via timer-callback from isdnloop_pollbchan(). * * Parameter: * card = pointer to card struct. * ch = channel number (0-based) */ static void isdnloop_bchan_send(isdnloop_card * card, int ch) { isdnloop_card *rcard = card->rcard[ch]; int rch = card->rch[ch], len, ack; struct sk_buff *skb; isdn_ctrl cmd; while (card->sndcount[ch]) { if ((skb = skb_dequeue(&card->bqueue[ch]))) { len = skb->len; card->sndcount[ch] -= len; ack = *(skb->head); /* used as scratch area */ cmd.driver = card->myid; cmd.arg = ch; if (rcard){ rcard->interface.rcvcallb_skb(rcard->myid, rch, skb); } else { printk(KERN_WARNING "isdnloop: no rcard, skb dropped\n"); dev_kfree_skb(skb); cmd.command = ISDN_STAT_L1ERR; cmd.parm.errcode = ISDN_STAT_L1ERR_SEND; card->interface.statcallb(&cmd); }; cmd.command = ISDN_STAT_BSENT; cmd.parm.length = len; if ( ack ) card->interface.statcallb(&cmd); } else card->sndcount[ch] = 0; } } /* * Send/Receive Data to/from the B-Channel. * This routine is called via timer-callback. * It schedules itself while any B-Channel is open. * * Parameter: * data = pointer to card struct, set by kernel timer.data */ static void isdnloop_pollbchan(unsigned long data) { isdnloop_card *card = (isdnloop_card *) data; unsigned long flags; if (card->flags & ISDNLOOP_FLAGS_B1ACTIVE) isdnloop_bchan_send(card, 0); if (card->flags & ISDNLOOP_FLAGS_B2ACTIVE) isdnloop_bchan_send(card, 1); if (card->flags & (ISDNLOOP_FLAGS_B1ACTIVE | ISDNLOOP_FLAGS_B2ACTIVE)) { /* schedule b-channel polling again */ save_flags(flags); cli(); card->rb_timer.expires = jiffies + ISDNLOOP_TIMER_BCREAD; add_timer(&card->rb_timer); card->flags |= ISDNLOOP_FLAGS_RBTIMER; restore_flags(flags); } else card->flags &= ~ISDNLOOP_FLAGS_RBTIMER; } /* * Parse ICN-type setup string and fill fields of setup-struct * with parsed data. * * Parameter: * setup = setup string, format: [caller-id],si1,si2,[called-id] * cmd = pointer to struct to be filled. */ static void isdnloop_parse_setup(char *setup, isdn_ctrl * cmd) { char *t = setup; char *s = strpbrk(t, ","); *s++ = '\0'; strncpy(cmd->parm.setup.phone, t, sizeof(cmd->parm.setup.phone)); s = strpbrk(t = s, ","); *s++ = '\0'; if (!strlen(t)) cmd->parm.setup.si1 = 0; else cmd->parm.setup.si1 = simple_strtoul(t, NULL, 10); s = strpbrk(t = s, ","); *s++ = '\0'; if (!strlen(t)) cmd->parm.setup.si2 = 0; else cmd->parm.setup.si2 = simple_strtoul(t, NULL, 10); strncpy(cmd->parm.setup.eazmsn, s, sizeof(cmd->parm.setup.eazmsn)); cmd->parm.setup.plan = 0; cmd->parm.setup.screen = 0; } typedef struct isdnloop_stat { char *statstr; int command; int action; } isdnloop_stat; /* *INDENT-OFF* */ static isdnloop_stat isdnloop_stat_table[] = { {"BCON_", ISDN_STAT_BCONN, 1}, /* B-Channel connected */ {"BDIS_", ISDN_STAT_BHUP, 2}, /* B-Channel disconnected */ {"DCON_", ISDN_STAT_DCONN, 0}, /* D-Channel connected */ {"DDIS_", ISDN_STAT_DHUP, 0}, /* D-Channel disconnected */ {"DCAL_I", ISDN_STAT_ICALL, 3}, /* Incoming call dialup-line */ {"DSCA_I", ISDN_STAT_ICALL, 3}, /* Incoming call 1TR6-SPV */ {"FCALL", ISDN_STAT_ICALL, 4}, /* Leased line connection up */ {"CIF", ISDN_STAT_CINF, 5}, /* Charge-info, 1TR6-type */ {"AOC", ISDN_STAT_CINF, 6}, /* Charge-info, DSS1-type */ {"CAU", ISDN_STAT_CAUSE, 7}, /* Cause code */ {"TEI OK", ISDN_STAT_RUN, 0}, /* Card connected to wallplug */ {"NO D-CHAN", ISDN_STAT_NODCH, 0}, /* No D-channel available */ {"E_L1: ACT FAIL", ISDN_STAT_BHUP, 8}, /* Layer-1 activation failed */ {"E_L2: DATA LIN", ISDN_STAT_BHUP, 8}, /* Layer-2 data link lost */ {"E_L1: ACTIVATION FAILED", ISDN_STAT_BHUP, 8}, /* Layer-1 activation failed */ {NULL, 0, -1} }; /* *INDENT-ON* */ /* * Parse Status message-strings from virtual card. * Depending on status, call statcallb for sending messages to upper * levels. Also set/reset B-Channel active-flags. * * Parameter: * status = status string to parse. * channel = channel where message comes from. * card = card where message comes from. */ static void isdnloop_parse_status(u_char * status, int channel, isdnloop_card * card) { isdnloop_stat *s = isdnloop_stat_table; int action = -1; isdn_ctrl cmd; while (s->statstr) { if (!strncmp(status, s->statstr, strlen(s->statstr))) { cmd.command = s->command; action = s->action; break; } s++; } if (action == -1) return; cmd.driver = card->myid; cmd.arg = channel; switch (action) { case 1: /* BCON_x */ card->flags |= (channel) ? ISDNLOOP_FLAGS_B2ACTIVE : ISDNLOOP_FLAGS_B1ACTIVE; break; case 2: /* BDIS_x */ card->flags &= ~((channel) ? ISDNLOOP_FLAGS_B2ACTIVE : ISDNLOOP_FLAGS_B1ACTIVE); isdnloop_free_queue(card, channel); break; case 3: /* DCAL_I and DSCA_I */ isdnloop_parse_setup(status + 6, &cmd); break; case 4: /* FCALL */ sprintf(cmd.parm.setup.phone, "LEASED%d", card->myid); sprintf(cmd.parm.setup.eazmsn, "%d", channel + 1); cmd.parm.setup.si1 = 7; cmd.parm.setup.si2 = 0; cmd.parm.setup.plan = 0; cmd.parm.setup.screen = 0; break; case 5: /* CIF */ strncpy(cmd.parm.num, status + 3, sizeof(cmd.parm.num) - 1); break; case 6: /* AOC */ sprintf(cmd.parm.num, "%d", (int) simple_strtoul(status + 7, NULL, 16)); break; case 7: /* CAU */ status += 3; if (strlen(status) == 4) sprintf(cmd.parm.num, "%s%c%c", status + 2, *status, *(status + 1)); else strncpy(cmd.parm.num, status + 1, sizeof(cmd.parm.num) - 1); break; case 8: /* Misc Errors on L1 and L2 */ card->flags &= ~ISDNLOOP_FLAGS_B1ACTIVE; isdnloop_free_queue(card, 0); cmd.arg = 0; cmd.driver = card->myid; card->interface.statcallb(&cmd); cmd.command = ISDN_STAT_DHUP; cmd.arg = 0; cmd.driver = card->myid; card->interface.statcallb(&cmd); cmd.command = ISDN_STAT_BHUP; card->flags &= ~ISDNLOOP_FLAGS_B2ACTIVE; isdnloop_free_queue(card, 1); cmd.arg = 1; cmd.driver = card->myid; card->interface.statcallb(&cmd); cmd.command = ISDN_STAT_DHUP; cmd.arg = 1; cmd.driver = card->myid; break; } card->interface.statcallb(&cmd); } /* * Store a cwcharacter into ringbuffer for reading from /dev/isdnctrl * * Parameter: * card = pointer to card struct. * c = char to store. */ static void isdnloop_putmsg(isdnloop_card * card, unsigned char c) { ulong flags; save_flags(flags); cli(); *card->msg_buf_write++ = (c == 0xff) ? '\n' : c; if (card->msg_buf_write == card->msg_buf_read) { if (++card->msg_buf_read > card->msg_buf_end) card->msg_buf_read = card->msg_buf; } if (card->msg_buf_write > card->msg_buf_end) card->msg_buf_write = card->msg_buf; restore_flags(flags); } /* * Poll a virtual cards message queue. * If there are new status-replies from the card, copy them to * ringbuffer for reading on /dev/isdnctrl and call * isdnloop_parse_status() for processing them. Watch for special * Firmware bootmessage and parse it, to get the D-Channel protocol. * If there are B-Channels open, initiate a timer-callback to * isdnloop_pollbchan(). * This routine is called periodically via timer interrupt. * * Parameter: * data = pointer to card struct */ static void isdnloop_polldchan(unsigned long data) { isdnloop_card *card = (isdnloop_card *) data; struct sk_buff *skb; int avail; int left; u_char c; int ch; int flags; u_char *p; isdn_ctrl cmd; if ((skb = skb_dequeue(&card->dqueue))) avail = skb->len; else avail = 0; for (left = avail; left > 0; left--) { c = *skb->data; skb_pull(skb, 1); isdnloop_putmsg(card, c); card->imsg[card->iptr] = c; if (card->iptr < 59) card->iptr++; if (!skb->len) { avail++; isdnloop_putmsg(card, '\n'); card->imsg[card->iptr] = 0; card->iptr = 0; if (card->imsg[0] == '0' && card->imsg[1] >= '0' && card->imsg[1] <= '2' && card->imsg[2] == ';') { ch = (card->imsg[1] - '0') - 1; p = &card->imsg[3]; isdnloop_parse_status(p, ch, card); } else { p = card->imsg; if (!strncmp(p, "DRV1.", 5)) { printk(KERN_INFO "isdnloop: (%s) %s\n", CID, p); if (!strncmp(p + 7, "TC", 2)) { card->ptype = ISDN_PTYPE_1TR6; card->interface.features |= ISDN_FEATURE_P_1TR6; printk(KERN_INFO "isdnloop: (%s) 1TR6-Protocol loaded and running\n", CID); } if (!strncmp(p + 7, "EC", 2)) { card->ptype = ISDN_PTYPE_EURO; card->interface.features |= ISDN_FEATURE_P_EURO; printk(KERN_INFO "isdnloop: (%s) Euro-Protocol loaded and running\n", CID); } continue; } } } } if (avail) { cmd.command = ISDN_STAT_STAVAIL; cmd.driver = card->myid; cmd.arg = avail; card->interface.statcallb(&cmd); } if (card->flags & (ISDNLOOP_FLAGS_B1ACTIVE | ISDNLOOP_FLAGS_B2ACTIVE)) if (!(card->flags & ISDNLOOP_FLAGS_RBTIMER)) { /* schedule b-channel polling */ card->flags |= ISDNLOOP_FLAGS_RBTIMER; save_flags(flags); cli(); del_timer(&card->rb_timer); card->rb_timer.function = isdnloop_pollbchan; card->rb_timer.data = (unsigned long) card; card->rb_timer.expires = jiffies + ISDNLOOP_TIMER_BCREAD; add_timer(&card->rb_timer); restore_flags(flags); } /* schedule again */ save_flags(flags); cli(); card->st_timer.expires = jiffies + ISDNLOOP_TIMER_DCREAD; add_timer(&card->st_timer); restore_flags(flags); } /* * Append a packet to the transmit buffer-queue. * * Parameter: * channel = Number of B-channel * skb = packet to send. * card = pointer to card-struct * Return: * Number of bytes transferred, -E??? on error */ static int isdnloop_sendbuf(int channel, struct sk_buff *skb, isdnloop_card * card) { int len = skb->len; unsigned long flags; struct sk_buff *nskb; if (len > 4000) { printk(KERN_WARNING "isdnloop: Send packet too large\n"); return -EINVAL; } if (len) { if (!(card->flags & (channel) ? ISDNLOOP_FLAGS_B2ACTIVE : ISDNLOOP_FLAGS_B1ACTIVE)) return 0; if (card->sndcount[channel] > ISDNLOOP_MAX_SQUEUE) return 0; save_flags(flags); cli(); nskb = skb_clone(skb, GFP_ATOMIC); if (nskb) { skb_queue_tail(&card->bqueue[channel], nskb); dev_kfree_skb(skb); } else len = 0; card->sndcount[channel] += len; restore_flags(flags); } return len; } /* * Read the messages from the card's ringbuffer * * Parameter: * buf = pointer to buffer. * len = number of bytes to read. * user = flag, 1: called from userlevel 0: called from kernel. * card = pointer to card struct. * Return: * number of bytes actually transferred. */ static int isdnloop_readstatus(u_char * buf, int len, int user, isdnloop_card * card) { int count; u_char *p; for (p = buf, count = 0; count < len; p++, count++) { if (card->msg_buf_read == card->msg_buf_write) return count; if (user) put_user(*card->msg_buf_read++, p); else *p = *card->msg_buf_read++; if (card->msg_buf_read > card->msg_buf_end) card->msg_buf_read = card->msg_buf; } return count; } /* * Simulate a card's response by appending it to the cards * message queue. * * Parameter: * card = pointer to card struct. * s = pointer to message-string. * ch = channel: 0 = generic messages, 1 and 2 = D-channel messages. * Return: * 0 on success, 1 on memory squeeze. */ static int isdnloop_fake(isdnloop_card * card, char *s, int ch) { struct sk_buff *skb; int len = strlen(s) + ((ch >= 0) ? 3 : 0); if (!(skb = dev_alloc_skb(len))) { printk(KERN_WARNING "isdnloop: Out of memory in isdnloop_fake\n"); return 1; } if (ch >= 0) sprintf(skb_put(skb, 3), "%02d;", ch); memcpy(skb_put(skb, strlen(s)), s, strlen(s)); skb_queue_tail(&card->dqueue, skb); return 0; } /* *INDENT-OFF* */ static isdnloop_stat isdnloop_cmd_table[] = { {"BCON_R", 0, 1}, /* B-Channel connect */ {"BCON_I", 0, 17}, /* B-Channel connect ind */ {"BDIS_R", 0, 2}, /* B-Channel disconnect */ {"DDIS_R", 0, 3}, /* D-Channel disconnect */ {"DCON_R", 0, 16}, /* D-Channel connect */ {"DSCA_R", 0, 4}, /* Dial 1TR6-SPV */ {"DCAL_R", 0, 5}, /* Dial */ {"EAZC", 0, 6}, /* Clear EAZ listener */ {"EAZ", 0, 7}, /* Set EAZ listener */ {"SEEAZ", 0, 8}, /* Get EAZ listener */ {"MSN", 0, 9}, /* Set/Clear MSN listener */ {"MSALL", 0, 10}, /* Set multi MSN listeners */ {"SETSIL", 0, 11}, /* Set SI list */ {"SEESIL", 0, 12}, /* Get SI list */ {"SILC", 0, 13}, /* Clear SI list */ {"LOCK", 0, -1}, /* LOCK channel */ {"UNLOCK", 0, -1}, /* UNLOCK channel */ {"FV2ON", 1, 14}, /* Leased mode on */ {"FV2OFF", 1, 15}, /* Leased mode off */ {NULL, 0, -1} }; /* *INDENT-ON* */ /* * Simulate an error-response from a card. * * Parameter: * card = pointer to card struct. */ static void isdnloop_fake_err(isdnloop_card * card) { char buf[60]; sprintf(buf, "E%s", card->omsg); isdnloop_fake(card, buf, -1); isdnloop_fake(card, "NAK", -1); } static u_char ctable_eu[] = {0x00, 0x11, 0x01, 0x12}; static u_char ctable_1t[] = {0x00, 0x3b, 0x01, 0x3a}; /* * Assemble a simplified cause message depending on the * D-channel protocol used. * * Parameter: * card = pointer to card struct. * loc = location: 0 = local, 1 = remote. * cau = cause: 1 = busy, 2 = nonexistent callerid, 3 = no user responding. * Return: * Pointer to buffer containing the assembled message. */ static char * isdnloop_unicause(isdnloop_card * card, int loc, int cau) { static char buf[6]; switch (card->ptype) { case ISDN_PTYPE_EURO: sprintf(buf, "E%02X%02X", (loc) ? 4 : 2, ctable_eu[cau]); break; case ISDN_PTYPE_1TR6: sprintf(buf, "%02X44", ctable_1t[cau]); break; default: return ("0000"); } return (buf); } /* * Release a virtual connection. Called from timer interrupt, when * called party did not respond. * * Parameter: * card = pointer to card struct. * ch = channel (0-based) */ static void isdnloop_atimeout(isdnloop_card * card, int ch) { unsigned long flags; char buf[60]; save_flags(flags); cli(); if (card->rcard) { isdnloop_fake(card->rcard[ch], "DDIS_I", card->rch[ch] + 1); card->rcard[ch]->rcard[card->rch[ch]] = NULL; card->rcard[ch] = NULL; } isdnloop_fake(card, "DDIS_I", ch + 1); /* No user responding */ sprintf(buf, "CAU%s", isdnloop_unicause(card, 1, 3)); isdnloop_fake(card, buf, ch + 1); restore_flags(flags); } /* * Wrapper for isdnloop_atimeout(). */ static void isdnloop_atimeout0(unsigned long data) { isdnloop_card *card = (isdnloop_card *) data; isdnloop_atimeout(card, 0); } /* * Wrapper for isdnloop_atimeout(). */ static void isdnloop_atimeout1(unsigned long data) { isdnloop_card *card = (isdnloop_card *) data; isdnloop_atimeout(card, 1); } /* * Install a watchdog for a user, not responding. * * Parameter: * card = pointer to card struct. * ch = channel to watch for. */ static void isdnloop_start_ctimer(isdnloop_card * card, int ch) { unsigned long flags; save_flags(flags); cli(); init_timer(&card->c_timer[ch]); card->c_timer[ch].expires = jiffies + ISDNLOOP_TIMER_ALERTWAIT; if (ch) card->c_timer[ch].function = isdnloop_atimeout1; else card->c_timer[ch].function = isdnloop_atimeout0; card->c_timer[ch].data = (unsigned long) card; add_timer(&card->c_timer[ch]); restore_flags(flags); } /* * Kill a pending channel watchdog. * * Parameter: * card = pointer to card struct. * ch = channel (0-based). */ static void isdnloop_kill_ctimer(isdnloop_card * card, int ch) { unsigned long flags; save_flags(flags); cli(); del_timer(&card->c_timer[ch]); restore_flags(flags); } static u_char si2bit[] = {0, 1, 0, 0, 0, 2, 0, 4, 0, 0}; static u_char bit2si[] = {1, 5, 7}; /* * Try finding a listener for an outgoing call. * * Parameter: * card = pointer to calling card. * p = pointer to ICN-type setup-string. * lch = channel of calling card. * cmd = pointer to struct to be filled when parsing setup. * Return: * 0 = found match, alerting should happen. * 1 = found matching number but it is busy. * 2 = no matching listener. * 3 = found matching number but SI does not match. */ static int isdnloop_try_call(isdnloop_card * card, char *p, int lch, isdn_ctrl * cmd) { isdnloop_card *cc = cards; unsigned long flags; int ch; int num_match; int i; char *e; char nbuf[32]; isdnloop_parse_setup(p, cmd); while (cc) { for (ch = 0; ch < 2; ch++) { /* Exclude ourself */ if ((cc == card) && (ch == lch)) continue; num_match = 0; switch (cc->ptype) { case ISDN_PTYPE_EURO: for (i = 0; i < 3; i++) if (!(strcmp(cc->s0num[i], cmd->parm.setup.phone))) num_match = 1; break; case ISDN_PTYPE_1TR6: e = cc->eazlist[ch]; while (*e) { sprintf(nbuf, "%s%c", cc->s0num[0], *e); if (!(strcmp(nbuf, cmd->parm.setup.phone))) num_match = 1; e++; } } if (num_match) { save_flags(flags); cli(); /* channel idle? */ if (!(cc->rcard[ch])) { /* Check SI */ if (!(si2bit[cmd->parm.setup.si1] & cc->sil[ch])) { restore_flags(flags); return 3; } /* ch is idle, si and number matches */ cc->rcard[ch] = card; cc->rch[ch] = lch; card->rcard[lch] = cc; card->rch[lch] = ch; restore_flags(flags); return 0; } else { restore_flags(flags); /* num matches, but busy */ if (ch == 1) return 1; } } } cc = cc->next; } return 2; } /* * Depending on D-channel protocol and caller/called, modify * phone number. * * Parameter: * card = pointer to card struct. * phone = pointer phone number. * caller = flag: 1 = caller, 0 = called. * Return: * pointer to new phone number. */ static char * isdnloop_vstphone(isdnloop_card * card, char *phone, int caller) { int i; static char nphone[30]; switch (card->ptype) { case ISDN_PTYPE_EURO: if (caller) { for (i = 0; i < 2; i++) if (!(strcmp(card->s0num[i], phone))) return (phone); return (card->s0num[0]); } return (phone); break; case ISDN_PTYPE_1TR6: if (caller) { sprintf(nphone, "%s%c", card->s0num[0], phone[0]); return (nphone); } else return (&phone[strlen(phone) - 1]); break; } return ("\0"); } /* * Parse an ICN-type command string sent to the 'card'. * Perform misc. actions depending on the command. * * Parameter: * card = pointer to card struct. */ static void isdnloop_parse_cmd(isdnloop_card * card) { char *p = card->omsg; isdn_ctrl cmd; char buf[60]; isdnloop_stat *s = isdnloop_cmd_table; int action = -1; int i; int ch; if ((card->omsg[0] != '0') && (card->omsg[2] != ';')) { isdnloop_fake_err(card); return; } ch = card->omsg[1] - '0'; if ((ch < 0) || (ch > 2)) { isdnloop_fake_err(card); return; } p += 3; while (s->statstr) { if (!strncmp(p, s->statstr, strlen(s->statstr))) { action = s->action; if (s->command && (ch != 0)) { isdnloop_fake_err(card); return; } break; } s++; } if (action == -1) return; switch (action) { case 1: /* 0x;BCON_R */ if (card->rcard[ch - 1]) { isdnloop_fake(card->rcard[ch - 1], "BCON_I", card->rch[ch - 1] + 1); } break; case 17: /* 0x;BCON_I */ if (card->rcard[ch - 1]) { isdnloop_fake(card->rcard[ch - 1], "BCON_C", card->rch[ch - 1] + 1); } break; case 2: /* 0x;BDIS_R */ isdnloop_fake(card, "BDIS_C", ch); if (card->rcard[ch - 1]) { isdnloop_fake(card->rcard[ch - 1], "BDIS_I", card->rch[ch - 1] + 1); } break; case 16: /* 0x;DCON_R */ isdnloop_kill_ctimer(card, ch - 1); if (card->rcard[ch - 1]) { isdnloop_kill_ctimer(card->rcard[ch - 1], card->rch[ch - 1]); isdnloop_fake(card->rcard[ch - 1], "DCON_C", card->rch[ch - 1] + 1); isdnloop_fake(card, "DCON_C", ch); } break; case 3: /* 0x;DDIS_R */ isdnloop_kill_ctimer(card, ch - 1); if (card->rcard[ch - 1]) { isdnloop_kill_ctimer(card->rcard[ch - 1], card->rch[ch - 1]); isdnloop_fake(card->rcard[ch - 1], "DDIS_I", card->rch[ch - 1] + 1); card->rcard[ch - 1] = NULL; } isdnloop_fake(card, "DDIS_C", ch); break; case 4: /* 0x;DSCA_Rdd,yy,zz,oo */ if (card->ptype != ISDN_PTYPE_1TR6) { isdnloop_fake_err(card); return; } /* Fall through */ case 5: /* 0x;DCAL_Rdd,yy,zz,oo */ p += 6; switch (isdnloop_try_call(card, p, ch - 1, &cmd)) { case 0: /* Alerting */ sprintf(buf, "D%s_I%s,%02d,%02d,%s", (action == 4) ? "SCA" : "CAL", isdnloop_vstphone(card, cmd.parm.setup.eazmsn, 1), cmd.parm.setup.si1, cmd.parm.setup.si2, isdnloop_vstphone(card->rcard[ch], cmd.parm.setup.phone, 0)); isdnloop_fake(card->rcard[ch - 1], buf, card->rch[ch - 1] + 1); /* Fall through */ case 3: /* si1 does not match, don't alert but start timer */ isdnloop_start_ctimer(card, ch - 1); break; case 1: /* Remote busy */ isdnloop_fake(card, "DDIS_I", ch); sprintf(buf, "CAU%s", isdnloop_unicause(card, 1, 1)); isdnloop_fake(card, buf, ch); break; case 2: /* No such user */ isdnloop_fake(card, "DDIS_I", ch); sprintf(buf, "CAU%s", isdnloop_unicause(card, 1, 2)); isdnloop_fake(card, buf, ch); break; } break; case 6: /* 0x;EAZC */ card->eazlist[ch - 1][0] = '\0'; break; case 7: /* 0x;EAZ */ p += 3; strcpy(card->eazlist[ch - 1], p); break; case 8: /* 0x;SEEAZ */ sprintf(buf, "EAZ-LIST: %s", card->eazlist[ch - 1]); isdnloop_fake(card, buf, ch + 1); break; case 9: /* 0x;MSN */ break; case 10: /* 0x;MSNALL */ break; case 11: /* 0x;SETSIL */ p += 6; i = 0; while (strchr("0157", *p)) { if (i) card->sil[ch - 1] |= si2bit[*p - '0']; i = (*p++ == '0'); } if (*p) isdnloop_fake_err(card); break; case 12: /* 0x;SEESIL */ sprintf(buf, "SIN-LIST: "); p = buf + 10; for (i = 0; i < 3; i++) if (card->sil[ch - 1] & (1 << i)) p += sprintf(p, "%02d", bit2si[i]); isdnloop_fake(card, buf, ch + 1); break; case 13: /* 0x;SILC */ card->sil[ch - 1] = 0; break; case 14: /* 00;FV2ON */ break; case 15: /* 00;FV2OFF */ break; } } /* * Put command-strings into the of the 'card'. In reality, execute them * right in place by calling isdnloop_parse_cmd(). Also copy every * command to the read message ringbuffer, preceeding it with a '>'. * These mesagges can be read at /dev/isdnctrl. * * Parameter: * buf = pointer to command buffer. * len = length of buffer data. * user = flag: 1 = called form userlevel, 0 called from kernel. * card = pointer to card struct. * Return: * number of bytes transfered (currently always equals len). */ static int isdnloop_writecmd(const u_char * buf, int len, int user, isdnloop_card * card) { int xcount = 0; int ocount = 1; isdn_ctrl cmd; while (len) { int count = MIN(255, len); u_char *p; u_char msg[0x100]; if (user) copy_from_user(msg, buf, count); else memcpy(msg, buf, count); isdnloop_putmsg(card, '>'); for (p = msg; count > 0; count--, p++) { len--; xcount++; isdnloop_putmsg(card, *p); card->omsg[card->optr] = *p; if (*p == '\n') { card->omsg[card->optr] = '\0'; card->optr = 0; isdnloop_parse_cmd(card); if (len) { isdnloop_putmsg(card, '>'); ocount++; } } else { if (card->optr < 59) card->optr++; } ocount++; } } cmd.command = ISDN_STAT_STAVAIL; cmd.driver = card->myid; cmd.arg = ocount; card->interface.statcallb(&cmd); return xcount; } /* * Delete card's pending timers, send STOP to linklevel */ static void isdnloop_stopcard(isdnloop_card * card) { unsigned long flags; isdn_ctrl cmd; save_flags(flags); cli(); if (card->flags & ISDNLOOP_FLAGS_RUNNING) { card->flags &= ~ISDNLOOP_FLAGS_RUNNING; del_timer(&card->st_timer); del_timer(&card->rb_timer); del_timer(&card->c_timer[0]); del_timer(&card->c_timer[1]); cmd.command = ISDN_STAT_STOP; cmd.driver = card->myid; card->interface.statcallb(&cmd); } restore_flags(flags); } /* * Stop all cards before unload. */ static void isdnloop_stopallcards(void) { isdnloop_card *p = cards; while (p) { isdnloop_stopcard(p); p = p->next; } } /* * Start a 'card'. Simulate card's boot message and set the phone * number(s) of the virtual 'S0-Interface'. Install D-channel * poll timer. * * Parameter: * card = pointer to card struct. * sdefp = pointer to struct holding ioctl parameters. * Return: * 0 on success, -E??? otherwise. */ static int isdnloop_start(isdnloop_card * card, isdnloop_sdef * sdefp) { unsigned long flags; isdnloop_sdef sdef; int i; if (card->flags & ISDNLOOP_FLAGS_RUNNING) return -EBUSY; copy_from_user((char *) &sdef, (char *) sdefp, sizeof(sdef)); save_flags(flags); cli(); switch (sdef.ptype) { case ISDN_PTYPE_EURO: if (isdnloop_fake(card, "DRV1.23EC-Q.931-CAPI-CNS-BASIS-20.02.96", -1)) { restore_flags(flags); return -ENOMEM; } card->sil[0] = card->sil[1] = 4; if (isdnloop_fake(card, "TEI OK", 0)) { restore_flags(flags); return -ENOMEM; } for (i = 0; i < 3; i++) strcpy(card->s0num[i], sdef.num[i]); break; case ISDN_PTYPE_1TR6: if (isdnloop_fake(card, "DRV1.04TC-1TR6-CAPI-CNS-BASIS-29.11.95", -1)) { restore_flags(flags); return -ENOMEM; } card->sil[0] = card->sil[1] = 4; if (isdnloop_fake(card, "TEI OK", 0)) { restore_flags(flags); return -ENOMEM; } strcpy(card->s0num[0], sdef.num[0]); card->s0num[1][0] = '\0'; card->s0num[2][0] = '\0'; break; default: restore_flags(flags); printk(KERN_WARNING "isdnloop: Illegal D-channel protocol %d\n", sdef.ptype); return -EINVAL; } init_timer(&card->st_timer); card->st_timer.expires = jiffies + ISDNLOOP_TIMER_DCREAD; card->st_timer.function = isdnloop_polldchan; card->st_timer.data = (unsigned long) card; add_timer(&card->st_timer); card->flags |= ISDNLOOP_FLAGS_RUNNING; restore_flags(flags); return 0; } /* * Main handler for commands sent by linklevel. */ static int isdnloop_command(isdn_ctrl * c, isdnloop_card * card) { ulong a; int i; char cbuf[60]; isdn_ctrl cmd; isdnloop_cdef cdef; switch (c->command) { case ISDN_CMD_IOCTL: memcpy(&a, c->parm.num, sizeof(ulong)); switch (c->arg) { case ISDNLOOP_IOCTL_DEBUGVAR: return (ulong) card; case ISDNLOOP_IOCTL_STARTUP: if ((i = verify_area(VERIFY_READ, (void *) a, sizeof(isdnloop_sdef)))) return i; return (isdnloop_start(card, (isdnloop_sdef *) a)); break; case ISDNLOOP_IOCTL_ADDCARD: if ((i = verify_area(VERIFY_READ, (void *) a, sizeof(isdnloop_cdef)))) return i; copy_from_user((char *) &cdef, (char *) a, sizeof(cdef)); return (isdnloop_addcard(cdef.id1)); break; case ISDNLOOP_IOCTL_LEASEDCFG: if (a) { if (!card->leased) { card->leased = 1; while (card->ptype == ISDN_PTYPE_UNKNOWN) { schedule_timeout(10); } schedule_timeout(10); sprintf(cbuf, "00;FV2ON\n01;EAZ1\n02;EAZ2\n"); i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); printk(KERN_INFO "isdnloop: (%s) Leased-line mode enabled\n", CID); cmd.command = ISDN_STAT_RUN; cmd.driver = card->myid; cmd.arg = 0; card->interface.statcallb(&cmd); } } else { if (card->leased) { card->leased = 0; sprintf(cbuf, "00;FV2OFF\n"); i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); printk(KERN_INFO "isdnloop: (%s) Leased-line mode disabled\n", CID); cmd.command = ISDN_STAT_RUN; cmd.driver = card->myid; cmd.arg = 0; card->interface.statcallb(&cmd); } } return 0; default: return -EINVAL; } break; case ISDN_CMD_DIAL: if (!card->flags & ISDNLOOP_FLAGS_RUNNING) return -ENODEV; if (card->leased) break; if ((c->arg & 255) < ISDNLOOP_BCH) { char *p; char dial[50]; char dcode[4]; a = c->arg; p = c->parm.setup.phone; if (*p == 's' || *p == 'S') { /* Dial for SPV */ p++; strcpy(dcode, "SCA"); } else /* Normal Dial */ strcpy(dcode, "CAL"); strcpy(dial, p); sprintf(cbuf, "%02d;D%s_R%s,%02d,%02d,%s\n", (int) (a + 1), dcode, dial, c->parm.setup.si1, c->parm.setup.si2, c->parm.setup.eazmsn); i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); } break; case ISDN_CMD_ACCEPTD: if (!card->flags & ISDNLOOP_FLAGS_RUNNING) return -ENODEV; if (c->arg < ISDNLOOP_BCH) { a = c->arg + 1; cbuf[0] = 0; switch (card->l2_proto[a - 1]) { case ISDN_PROTO_L2_X75I: sprintf(cbuf, "%02d;BX75\n", (int) a); break; #ifdef CONFIG_ISDN_X25 case ISDN_PROTO_L2_X25DTE: sprintf(cbuf, "%02d;BX2T\n", (int) a); break; case ISDN_PROTO_L2_X25DCE: sprintf(cbuf, "%02d;BX2C\n", (int) a); break; #endif case ISDN_PROTO_L2_HDLC: sprintf(cbuf, "%02d;BTRA\n", (int) a); break; } if (strlen(cbuf)) i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); sprintf(cbuf, "%02d;DCON_R\n", (int) a); i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); } break; case ISDN_CMD_ACCEPTB: if (!card->flags & ISDNLOOP_FLAGS_RUNNING) return -ENODEV; if (c->arg < ISDNLOOP_BCH) { a = c->arg + 1; switch (card->l2_proto[a - 1]) { case ISDN_PROTO_L2_X75I: sprintf(cbuf, "%02d;BCON_R,BX75\n", (int) a); break; #ifdef CONFIG_ISDN_X25 case ISDN_PROTO_L2_X25DTE: sprintf(cbuf, "%02d;BCON_R,BX2T\n", (int) a); break; case ISDN_PROTO_L2_X25DCE: sprintf(cbuf, "%02d;BCON_R,BX2C\n", (int) a); break; #endif case ISDN_PROTO_L2_HDLC: sprintf(cbuf, "%02d;BCON_R,BTRA\n", (int) a); break; default: sprintf(cbuf, "%02d;BCON_R\n", (int) a); } printk(KERN_DEBUG "isdnloop writecmd '%s'\n", cbuf); i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); break; case ISDN_CMD_HANGUP: if (!card->flags & ISDNLOOP_FLAGS_RUNNING) return -ENODEV; if (c->arg < ISDNLOOP_BCH) { a = c->arg + 1; sprintf(cbuf, "%02d;BDIS_R\n%02d;DDIS_R\n", (int) a, (int) a); i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); } break; case ISDN_CMD_SETEAZ: if (!card->flags & ISDNLOOP_FLAGS_RUNNING) return -ENODEV; if (card->leased) break; if (c->arg < ISDNLOOP_BCH) { a = c->arg + 1; if (card->ptype == ISDN_PTYPE_EURO) { sprintf(cbuf, "%02d;MS%s%s\n", (int) a, c->parm.num[0] ? "N" : "ALL", c->parm.num); } else sprintf(cbuf, "%02d;EAZ%s\n", (int) a, c->parm.num[0] ? c->parm.num : (u_char *) "0123456789"); i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); } break; case ISDN_CMD_CLREAZ: if (!card->flags & ISDNLOOP_FLAGS_RUNNING) return -ENODEV; if (card->leased) break; if (c->arg < ISDNLOOP_BCH) { a = c->arg + 1; if (card->ptype == ISDN_PTYPE_EURO) sprintf(cbuf, "%02d;MSNC\n", (int) a); else sprintf(cbuf, "%02d;EAZC\n", (int) a); i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); } break; case ISDN_CMD_SETL2: if (!card->flags & ISDNLOOP_FLAGS_RUNNING) return -ENODEV; if ((c->arg & 255) < ISDNLOOP_BCH) { a = c->arg; switch (a >> 8) { case ISDN_PROTO_L2_X75I: sprintf(cbuf, "%02d;BX75\n", (int) (a & 255) + 1); break; #ifdef CONFIG_ISDN_X25 case ISDN_PROTO_L2_X25DTE: sprintf(cbuf, "%02d;BX2T\n", (int) (a & 255) + 1); break; case ISDN_PROTO_L2_X25DCE: sprintf(cbuf, "%02d;BX2C\n", (int) (a & 255) + 1); break; #endif case ISDN_PROTO_L2_HDLC: sprintf(cbuf, "%02d;BTRA\n", (int) (a & 255) + 1); break; default: return -EINVAL; } i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); card->l2_proto[a & 255] = (a >> 8); } break; case ISDN_CMD_GETL2: if (!card->flags & ISDNLOOP_FLAGS_RUNNING) return -ENODEV; if ((c->arg & 255) < ISDNLOOP_BCH) return card->l2_proto[c->arg & 255]; else return -ENODEV; case ISDN_CMD_SETL3: if (!card->flags & ISDNLOOP_FLAGS_RUNNING) return -ENODEV; return 0; case ISDN_CMD_GETL3: if (!card->flags & ISDNLOOP_FLAGS_RUNNING) return -ENODEV; if ((c->arg & 255) < ISDNLOOP_BCH) return ISDN_PROTO_L3_TRANS; else return -ENODEV; case ISDN_CMD_GETEAZ: if (!card->flags & ISDNLOOP_FLAGS_RUNNING) return -ENODEV; break; case ISDN_CMD_SETSIL: if (!card->flags & ISDNLOOP_FLAGS_RUNNING) return -ENODEV; break; case ISDN_CMD_GETSIL: if (!card->flags & ISDNLOOP_FLAGS_RUNNING) return -ENODEV; break; case ISDN_CMD_LOCK: MOD_INC_USE_COUNT; break; case ISDN_CMD_UNLOCK: MOD_DEC_USE_COUNT; break; default: return -EINVAL; } } return 0; } /* * Find card with given driverId */ static inline isdnloop_card * isdnloop_findcard(int driverid) { isdnloop_card *p = cards; while (p) { if (p->myid == driverid) return p; p = p->next; } return (isdnloop_card *) 0; } /* * Wrapper functions for interface to linklevel */ static int if_command(isdn_ctrl * c) { isdnloop_card *card = isdnloop_findcard(c->driver); if (card) return (isdnloop_command(c, card)); printk(KERN_ERR "isdnloop: if_command called with invalid driverId!\n"); return -ENODEV; } static int if_writecmd(const u_char * buf, int len, int user, int id, int channel) { isdnloop_card *card = isdnloop_findcard(id); if (card) { if (!card->flags & ISDNLOOP_FLAGS_RUNNING) return -ENODEV; return (isdnloop_writecmd(buf, len, user, card)); } printk(KERN_ERR "isdnloop: if_writecmd called with invalid driverId!\n"); return -ENODEV; } static int if_readstatus(u_char * buf, int len, int user, int id, int channel) { isdnloop_card *card = isdnloop_findcard(id); if (card) { if (!card->flags & ISDNLOOP_FLAGS_RUNNING) return -ENODEV; return (isdnloop_readstatus(buf, len, user, card)); } printk(KERN_ERR "isdnloop: if_readstatus called with invalid driverId!\n"); return -ENODEV; } static int if_sendbuf(int id, int channel, int ack, struct sk_buff *skb) { isdnloop_card *card = isdnloop_findcard(id); if (card) { if (!card->flags & ISDNLOOP_FLAGS_RUNNING) return -ENODEV; /* ack request stored in skb scratch area */ *(skb->head) = ack; return (isdnloop_sendbuf(channel, skb, card)); } printk(KERN_ERR "isdnloop: if_sendbuf called with invalid driverId!\n"); return -ENODEV; } /* * Allocate a new card-struct, initialize it * link it into cards-list and register it at linklevel. */ static isdnloop_card * isdnloop_initcard(char *id) { isdnloop_card *card; int i; if (!(card = (isdnloop_card *) kmalloc(sizeof(isdnloop_card), GFP_KERNEL))) { printk(KERN_WARNING "isdnloop: (%s) Could not allocate card-struct.\n", id); return (isdnloop_card *) 0; } memset((char *) card, 0, sizeof(isdnloop_card)); card->interface.channels = ISDNLOOP_BCH; card->interface.hl_hdrlen = 1; /* scratch area for storing ack flag*/ card->interface.maxbufsize = 4000; card->interface.command = if_command; card->interface.writebuf_skb = if_sendbuf; card->interface.writecmd = if_writecmd; card->interface.readstat = if_readstatus; card->interface.features = ISDN_FEATURE_L2_X75I | #ifdef CONFIG_ISDN_X25 ISDN_FEATURE_L2_X25DTE | ISDN_FEATURE_L2_X25DCE | #endif ISDN_FEATURE_L2_HDLC | ISDN_FEATURE_L3_TRANS | ISDN_FEATURE_P_UNKNOWN; card->ptype = ISDN_PTYPE_UNKNOWN; strncpy(card->interface.id, id, sizeof(card->interface.id) - 1); card->msg_buf_write = card->msg_buf; card->msg_buf_read = card->msg_buf; card->msg_buf_end = &card->msg_buf[sizeof(card->msg_buf) - 1]; for (i = 0; i < ISDNLOOP_BCH; i++) { card->l2_proto[i] = ISDN_PROTO_L2_X75I; skb_queue_head_init(&card->bqueue[i]); } skb_queue_head_init(&card->dqueue); card->next = cards; cards = card; if (!register_isdn(&card->interface)) { cards = cards->next; printk(KERN_WARNING "isdnloop: Unable to register %s\n", id); kfree(card); return (isdnloop_card *) 0; } card->myid = card->interface.channels; return card; } static int isdnloop_addcard(char *id1) { ulong flags; isdnloop_card *card; save_flags(flags); cli(); if (!(card = isdnloop_initcard(id1))) { restore_flags(flags); return -EIO; } restore_flags(flags); printk(KERN_INFO "isdnloop: (%s) virtual card added\n", card->interface.id); return 0; } #ifdef MODULE #define isdnloop_init init_module #else void isdnloop_setup(char *str, int *ints) { static char sid[20]; if (strlen(str)) { strcpy(sid, str); isdnloop_id = sid; } } #endif int isdnloop_init(void) { char *p; char rev[10]; /* No symbols to export, hide all symbols */ EXPORT_NO_SYMBOLS; if ((p = strchr(revision, ':'))) { strcpy(rev, p + 1); p = strchr(rev, '$'); *p = 0; } else strcpy(rev, " ??? "); printk(KERN_NOTICE "isdnloop-ISDN-driver Rev%s\n", rev); return (isdnloop_addcard(isdnloop_id)); } #ifdef MODULE void cleanup_module(void) { isdn_ctrl cmd; isdnloop_card *card = cards; isdnloop_card *last; int i; isdnloop_stopallcards(); while (card) { cmd.command = ISDN_STAT_UNLOAD; cmd.driver = card->myid; card->interface.statcallb(&cmd); for (i = 0; i < ISDNLOOP_BCH; i++) isdnloop_free_queue(card, i); card = card->next; } card = cards; while (card) { struct sk_buff *skb; last = card; while ((skb = skb_dequeue(&card->dqueue))) dev_kfree_skb(skb); card = card->next; kfree(last); } printk(KERN_NOTICE "isdnloop-ISDN-driver unloaded\n"); } #endif
empeg/empeg-hijack
drivers/isdn/isdnloop/isdnloop.c
C
gpl-2.0
41,124
[ 30522, 1013, 1008, 1002, 8909, 1024, 2003, 2094, 20554, 18589, 1012, 1039, 1010, 1058, 1015, 1012, 1023, 2639, 1013, 5641, 1013, 5757, 5718, 1024, 2756, 1024, 4029, 12880, 4654, 2361, 1002, 1008, 2003, 2094, 2078, 2659, 1011, 2504, 11336, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# Bousigonia tonkinensis Eberhardt SPECIES #### Status ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
mdoering/backbone
life/Plantae/Magnoliophyta/Magnoliopsida/Gentianales/Apocynaceae/Bousigonia/Bousigonia tonkinensis/README.md
Markdown
apache-2.0
182
[ 30522, 1001, 8945, 2271, 14031, 6200, 10228, 4939, 9911, 1041, 5677, 13778, 2427, 1001, 1001, 1001, 1001, 3570, 3970, 1001, 1001, 1001, 1001, 2429, 2000, 2248, 3269, 3415, 5950, 1001, 1001, 1001, 1001, 2405, 1999, 19701, 1001, 1001, 1001, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 2 of the License, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package proguard.io; import proguard.classfile.ClassConstants; import java.io.*; /** * This DataEntryWriter writes data entries to individual files in a given * directory. * * @author Eric Lafortune */ public class DirectoryWriter implements DataEntryWriter { private final File baseFile; private final boolean isFile; private File currentFile; private OutputStream currentOutputStream; private Finisher currentFinisher; /** * Creates a new DirectoryWriter. * @param baseFile the base directory to which all files will be written. */ public DirectoryWriter(File baseFile, boolean isFile) { this.baseFile = baseFile; this.isFile = isFile; } // Implementations for DataEntryWriter. public boolean createDirectory(DataEntry dataEntry) throws IOException { // Should we close the current file? if (!isFile && currentFile != null) { closeEntry(); } File directory = getFile(dataEntry); if (!directory.exists() && !directory.mkdirs()) { throw new IOException("Can't create directory [" + directory.getPath() + "]"); } return true; } public OutputStream getOutputStream(DataEntry dataEntry) throws IOException { return getOutputStream(dataEntry, null); } public OutputStream getOutputStream(DataEntry dataEntry, Finisher finisher) throws IOException { File file = getFile(dataEntry); // Should we close the current file? if (!isFile && currentFile != null && !currentFile.equals(file)) { closeEntry(); } // Do we need a new stream? if (currentOutputStream == null) { // Make sure the parent directories exist. File parentDirectory = file.getParentFile(); if (parentDirectory != null && !parentDirectory.exists() && !parentDirectory.mkdirs()) { throw new IOException("Can't create directory [" + parentDirectory.getPath() + "]"); } // Open a new output stream for writing to the file. currentOutputStream = new BufferedOutputStream( new FileOutputStream(file)); currentFinisher = finisher; currentFile = file; } return currentOutputStream; } public void close() throws IOException { // Close the file stream, if any. closeEntry(); } // Small utility methods. /** * Returns the file for the given data entry. */ private File getFile(DataEntry dataEntry) { // Use the specified file, or construct a new file. return isFile ? baseFile : new File(baseFile, dataEntry.getName().replace(ClassConstants.PACKAGE_SEPARATOR, File.separatorChar)); } /** * Closes the previous file, if any. */ private void closeEntry() throws IOException { // Close the file stream, if any. if (currentOutputStream != null) { // Let any finisher finish up first. if (currentFinisher != null) { currentFinisher.finish(); currentFinisher = null; } currentOutputStream.close(); currentOutputStream = null; currentFile = null; } } }
oneliang/third-party-lib
proguard/proguard/io/DirectoryWriter.java
Java
apache-2.0
4,622
[ 30522, 1013, 1008, 1008, 4013, 18405, 1011, 1011, 28375, 1010, 20600, 1010, 27885, 25608, 10719, 1010, 1998, 3653, 6299, 9031, 1008, 1997, 9262, 24880, 16044, 1012, 1008, 1008, 9385, 1006, 1039, 1007, 2526, 1011, 2297, 4388, 2474, 13028, 98...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#include "tcenterlinevectP.h" //========================================================================== //************************ //* Polygonization * //************************ //-------------------------------------------------------------------------- //=============================== // Raw Borders Extraction //=============================== // Raw contour class definition class RawBorderPoint { TPoint m_position; int m_ambiguousTurn; // used to remember cases of multiple turning directions // in a RawBorder extraction. public: RawBorderPoint() : m_ambiguousTurn(0) {} RawBorderPoint(int i, int j) : m_position(i, j), m_ambiguousTurn(0) {} inline TPoint pos() const { return m_position; } inline int x() const { return m_position.x; } inline int y() const { return m_position.y; } enum { left = 1, right = 2 }; // Direction taken at ambiguous turning point inline int getAmbiguous() const { return m_ambiguousTurn; } inline void setAmbiguous(int direction) { m_ambiguousTurn = direction; } }; //-------------------------------------------------------------------------- class RawBorder final : public std::vector<RawBorderPoint> { int m_xExternal; // x coordinate of a specific vertex in the outer // RawBorder which contains this inner one. TPointD *m_coordinateSums; TPointD *m_coordinateSquareSums; double *m_coordinateMixedSums; public: RawBorder() {} ~RawBorder() {} void setXExternalPixel(int a) { m_xExternal = a; } int xExternalPixel() { return m_xExternal; } TPointD *&sums() { return m_coordinateSums; } TPointD *&sums2() { return m_coordinateSquareSums; } double *&sumsMix() { return m_coordinateMixedSums; } }; //-------------------------------------------------------------------------- // Of course we don't want RawBorders to be entirely copied whenever STL // requires to resize a BorderFamily... typedef std::vector<RawBorder *> BorderFamily; typedef std::vector<BorderFamily> BorderList; //-------------------------------------------------------------------------- //========================================================================== //============================ // Polygonizer Locals //============================ namespace { // Const names enum { white = 0, black = 1 }; enum { inner = 0, outer = 1, none = 2, invalid = 3 }; } //======================================================================================= //------------------------------- // Raster Data Functions //------------------------------- // NOTA: Il tono di un TPixelCM32 rappresenta la transizione tra colore ink e // colore paint. // di solito, se il tono e' basso abbiamo un colore ink - che puo' anche // essere bianco, // in teoria... // Sarebbe opportuno che il vettorizzatore riconoscesse - per colormap - il // colore // delle strokes. // Approcci: a) la Signaturemap diventa *piu'* di una bitmap e si seguono // le outline // dei singoli colori. // => Sconnessioni tra i colori adiacenti. Bisogna introdurre la // distanza tra // colori per seguire l'outline (ossia, i pixel tenuti a dx // della outline // devono essere simili). // // b) Una volta vettorizzato tutto, si sceglie il colore della // stroke. // E' possibile controllare il colore sui vertici delle // sequenze semplificate // e fare una media. // NOTE: Transparency makes colors fade to white. Full transparent black pixels // are considered white. //-------------------------------------------------------------------------- template <typename T> class PixelEvaluator { TRasterPT<T> m_ras; int m_threshold; public: PixelEvaluator(const TRasterPT<T> &ras, int threshold) : m_ras(ras), m_threshold(threshold) {} inline unsigned char getBlackOrWhite(int x, int y); }; //-------------------------------------------------------------------------- template <> inline unsigned char PixelEvaluator<TPixel32>::getBlackOrWhite(int x, int y) { // return ras->pixels(y)[x].r + 2 * ras->pixels(y)[x].g + ras->pixels(y)[x].b // < // threshold * (ras->pixels(y)[x].m / 255.0); // NOTE: Green is considered twice brighter than red or blue channel. // Using Value of HSV color model return std::max(m_ras->pixels(y)[x].r, std::max(m_ras->pixels(y)[x].g, m_ras->pixels(y)[x].b)) < m_threshold * (m_ras->pixels(y)[x].m / 255.0); // Using Lightness of HSV color model // return (max(ras->pixels(y)[x].r, max(ras->pixels(y)[x].g, // ras->pixels(y)[x].b)) + // min(ras->pixels(y)[x].r, min(ras->pixels(y)[x].g, // ras->pixels(y)[x].b))) / 2.0 < // threshold * (ras->pixels(y)[x].m / 255.0); // Using (relative) Luminance // return 0.2126 * ras->pixels(y)[x].r + 0.7152 * ras->pixels(y)[x].g + 0.0722 // * ras->pixels(y)[x].b < // threshold * (ras->pixels(y)[x].m / 255.0); } template <> inline unsigned char PixelEvaluator<TPixelGR8>::getBlackOrWhite(int x, int y) { return m_ras->pixels(y)[x].value < m_threshold; } template <> inline unsigned char PixelEvaluator<TPixelCM32>::getBlackOrWhite(int x, int y) { return m_ras->pixels(y)[x].getTone() < m_threshold; } //-------------------------------------------------------------------------- // Signaturemap format: // stores a map of bytes, whose first bit represents the color (black/white) of // corresponding pixel, and // the rest its 'signature', used as an int to store information. // NOTE: given a TRaster32, the corresponding Signaturemap constructed is // intended 0(white)-padded class Signaturemap { std::unique_ptr<unsigned char[]> m_array; int m_rowSize; int m_colSize; public: Signaturemap(const TRasterP &ras, int threshold); template <typename T> void readRasterData(const TRasterPT<T> &ras, int threshold); inline int getRowSize() const { return m_rowSize; } inline int getColSize() const { return m_colSize; } unsigned char *pixelByte(int x, int y) { return &m_array[(y + 1) * m_rowSize + x + 1]; } bool getBitmapColor(int x, int y) const { return m_array[(y + 1) * m_rowSize + x + 1] & 1; } inline unsigned char getSignature(int x, int y) const { return m_array[(y + 1) * m_rowSize + x + 1] >> 1; } void setSignature(int x, int y, int val) { unsigned char *pixel = pixelByte(x, y); *pixel &= 1; *pixel |= (val << 1); // Si puo' fare meglio?? } }; //-------------------------------------------------------------------------- Signaturemap::Signaturemap(const TRasterP &ras, int threshold) { // Extrapolate raster type TRaster32P rr = (TRaster32P)ras; TRasterGR8P rgr = (TRasterGR8P)ras; TRasterCM32P rt = (TRasterCM32P)ras; assert(rr || rgr || rt); // Read raster data if (rr) { rr->lock(); readRasterData(rr, threshold); rr->unlock(); } else if (rgr) { rgr->lock(); readRasterData(rgr, threshold); rgr->unlock(); } else { rt->lock(); readRasterData(rt, threshold); rt->unlock(); } } //-------------------------------------------------------------------------- template <typename T> void Signaturemap::readRasterData(const TRasterPT<T> &ras, int threshold) { unsigned char *currByte; int x, y; PixelEvaluator<T> evaluator(ras, threshold); m_rowSize = ras->getLx() + 2; m_colSize = ras->getLy() + 2; m_array.reset(new unsigned char[m_rowSize * m_colSize]); memset(m_array.get(), none << 1, m_rowSize); currByte = m_array.get() + m_rowSize; for (y = 0; y < ras->getLy(); ++y) { *currByte = none << 1; currByte++; for (x = 0; x < ras->getLx(); ++x, ++currByte) *currByte = evaluator.getBlackOrWhite(x, y) | (none << 1); *currByte = none << 1; currByte++; } memset(currByte, none << 1, m_rowSize); } //-------------------------------------------------------------------------- // Minority check for amiguous turning directions inline bool getMinorityCheck(const Signaturemap &ras, int x, int y) { // Assumes (x,y) is ambiguous case: 2 immediate surrounding pixels are white // and 2 black return (ras.getBitmapColor(x + 1, y) + ras.getBitmapColor(x + 1, y - 1) + ras.getBitmapColor(x - 2, y) + ras.getBitmapColor(x - 2, y - 1) + ras.getBitmapColor(x - 1, y + 1) + ras.getBitmapColor(x - 1, y - 2) + ras.getBitmapColor(x, y + 1) + ras.getBitmapColor(x, y - 2)) > 4; } //-------------------------------------------------------------------------- // Sets signature of a given border inline void setSignature(Signaturemap &ras, const RawBorder &border, int val) { unsigned int j; int yOld; // Set border's alpha channel yOld = border.back().y(); for (j = 0; j < border.size(); ++j) { if (border[j].y() < yOld) { ras.setSignature(border[j].x(), border[j].y(), val); } else if (border[j].y() > yOld) { ras.setSignature(border[j].x(), yOld, val); } yOld = border[j].y(); } } //========================================================================== //------------------------------- // Raw Borders Extraction //------------------------------- // RawBorderPoints correspond to lower-left pixel corners. // EXAMPLE: (0,0) is the lower-left *corner* of the image, whereas (0,0) also // represents coordinates of the lower-left *pixel*. // NOTE: 'Ambiguous turning' vertices are those of kind: // // B|W W|B // -x- -or- -x- // W|B B|W // // Keeping B on the right of our path-seeking direction, we may either turn // left or right at these points. static RawBorder *extractPath(Signaturemap &ras, int x0, int y0, int pathType, int xOuterPixel, int despeckling) { RawBorder *path = new RawBorder; int x, y; short dirX, dirY; long int area = 0; bool nextLeftPixel, nextRightPixel; if (pathType == outer) { dirX = 0; dirY = 1; } else { dirX = 1; dirY = 0; area += y0; path->setXExternalPixel(xOuterPixel); } path->push_back(RawBorderPoint(x0, y0)); // Check here if (x0, y0) is an ambiguous-direction point nextLeftPixel = ras.getBitmapColor(x0 + (dirY - dirX - 1) / 2, y0 + (-dirY - dirX - 1) / 2); nextRightPixel = ras.getBitmapColor(x0 + (-dirX - dirY - 1) / 2, y0 + (dirX - dirY - 1) / 2); if ((nextRightPixel == black) && (nextLeftPixel == white)) path->back().setAmbiguous(dirX ? RawBorderPoint::left : RawBorderPoint::right); // Begin path extraction for (x = x0 + dirX, y = y0 + dirY; !(x == x0 && y == y0); x += dirX, y += dirY) { path->push_back(RawBorderPoint(x, y)); // Calculate next direction nextLeftPixel = ras.getBitmapColor(x + (dirX - dirY - 1) / 2, y + (dirY + dirX - 1) / 2); nextRightPixel = ras.getBitmapColor(x + (dirX + dirY - 1) / 2, y + (dirY - dirX - 1) / 2); if ((nextRightPixel == black) && (nextLeftPixel == black)) { // Left Turn std::swap(dirY, dirX); dirX = -dirX; } else if ((nextRightPixel == white) && (nextLeftPixel == white)) { // Right Turn std::swap(dirY, dirX); dirY = -dirY; } else if ((nextRightPixel == white) && (nextLeftPixel == black)) { // path->back().setAmbiguous(); // Do a surrounding check and connect minority color if (getMinorityCheck(ras, x, y) == black) { std::swap(dirY, dirX); dirY = -dirY; path->back().setAmbiguous(RawBorderPoint::right); } // right turn else { std::swap(dirY, dirX); dirX = -dirX; path->back().setAmbiguous(RawBorderPoint::left); } // left turn } // Also calculate border area area += y * dirX; // And sign treated pixel if (dirY != 0) ras.setSignature(x, y + (dirY - 1) / 2, pathType); } // If the inner region's overall area is under a given threshold, // then erase it (intended as image noise). if (abs(area) < despeckling) { setSignature(ras, *path, invalid); delete path; path = 0; } return path; } //-------------------------------------------------------------------------- static BorderList *extractBorders(const TRasterP &ras, int threshold, int despeckling) { Signaturemap byteImage(ras, threshold); BorderList *borderHierarchy = new BorderList; std::vector<RawBorder *> outerBorders; std::list<RawBorder *> innerBorders; RawBorder *foundPath; int x, y; bool Color, oldColor; int xOuterPixel = 0; bool enteredRegionType; unsigned char signature; // Traverse image to extract raw borders for (y = 0; y < ras->getLy(); ++y) { oldColor = white; enteredRegionType = outer; for (x = 0; x < ras->getLx(); ++x) { if (oldColor ^ (Color = byteImage.getBitmapColor(x, y))) { // Region type changes enteredRegionType = !enteredRegionType; if ((signature = byteImage.getSignature(x, y)) == none) { // We've found a border if ((foundPath = extractPath(byteImage, x, y, !enteredRegionType, xOuterPixel, despeckling))) if (enteredRegionType == outer) innerBorders.push_back(foundPath); else outerBorders.push_back(foundPath); } // If leaving a white region, remember it - in order to establish // border hierarchy in the future if (enteredRegionType == inner && signature != invalid) xOuterPixel = x; // Invalid pixels got signed by a cut-out path, due to insufficient area if (signature == invalid) byteImage.setSignature(x, y, none); // Restore them now oldColor = Color; } } } // Now, we have all borders found, but no hierarchy between them. unsigned int i; std::list<RawBorder *>::iterator l; // Build hierarchy innerBorders.push_front(0); // Just to keep a fixed list head for (i = 0; i < outerBorders.size(); ++i) { // Initialize a border family borderHierarchy->push_back(BorderFamily()); borderHierarchy->back().push_back(outerBorders[i]); // Reset outerBorders[i]'s signature setSignature(byteImage, *outerBorders[i], none); // Now check inner borders for insideness - check if the outerPixel // remembered in path extraction has been cleared for (l = innerBorders.begin(), ++l; l != innerBorders.end(); ++l) { if (byteImage.getSignature((*l)->xExternalPixel(), (**l)[0].y()) == none) { borderHierarchy->back().push_back(*l); setSignature(byteImage, **l, none); l = innerBorders.erase(l); --l; } } } return borderHierarchy; } //-------------------------------------------------------------------------- //================================== // Calculate optimal polygons //================================== // The optimal polygon for a given original border is found like: // 1) Find couples (i,k(i)), so that k(i) be the largest k: // d(j,ik) <= 1; for *all* i<j<k. (d is infinite-norm distance) // It can be shown that such a condition is equivalent to: // exists line l : d(l,j)<=1/2, for all i<=j<=k(i). // 2) Clean the above couples - find couples (i,l(i)): // l(i)=min{k(j)}, j=i..n. // 3) Calculate clipped couples (i',l'); where i'=i+1, l'=l(i)-1. // 4) Calculate sums for path penalties. // 5) Apply optimality algorithm. // NOTE: Weak simpleness reads like: a set of polygons is weak-simple if no edge // *crosses* another edge. Superposition and collision of edges with // vertices // are still admitted. // => It can be shown that due to 1) and special conditions on ambiguous // turnings applied in both 1) and 3), weak simpleness is insured in // our polygonization. //-------------------------------------------------------------------------- // Helper functions/classes: circular-indexed vectors // returns 1 whenever the triple (a,b,c) is 'circular' mod n. // NOTE: We'll find useful taking (i,i,j) as 1 and (i,j,j) as 0. inline bool isCircular(int a, int b, int c) { return a <= c ? a <= b && b < c : c > b || b >= a; } //-------------------------------------------------------------------------- // Extracts a 'next corner' array - helps improving overall speed inline std::unique_ptr<int[]> findNextCorners(RawBorder &path) { std::unique_ptr<int[]> corners(new int[path.size()]); // NOTE: 0 is a corner, due to the path extraction procedure. int currentCorner = 0; for (int i = path.size() - 1; i >= 0; --i) { if (path[currentCorner].x() != path[i].x() && path[currentCorner].y() != path[i].y()) currentCorner = i + 1; corners[i] = currentCorner; } return corners; } //-------------------------------------------------------------------------- // Calculate furthest k satisfying 1) for all fixed i. inline std::unique_ptr<int[]> furthestKs(RawBorder &path, std::unique_ptr<int[]> &nextCorners) { int n = path.size(); std::unique_ptr<int[]> kVector(new int[n]); enum { left, up, right, down }; int directionsOccurred[4]; nextCorners = findNextCorners(path); int i, j, k; TPoint shift; TPoint leftConstraint, rightConstraint, violatedConstraint; TPoint newLeftConstraint, newRightConstraint; TPoint jPoint, jNextPoint, iPoint, direction; int directionSignature; for (i = 0; i < n; ++i) { // Initialize search leftConstraint = rightConstraint = TPoint(); directionsOccurred[0] = directionsOccurred[1] = directionsOccurred[2] = directionsOccurred[3] = 0; j = i; jNextPoint = iPoint = path[i].pos(); // Search for k(i) while (1) { // NOTE: Here using TPoint::operator= is less effective than setting // its x and y components directly... jPoint = jNextPoint; jNextPoint = path[nextCorners[j]].pos(); // Update directions count directionSignature = jNextPoint.x > jPoint.x ? right : jNextPoint.x < jPoint.x ? left : jNextPoint.y > jPoint.y ? up : down; directionsOccurred[directionSignature] = 1; // If all 4 axis directions occurred, quit if (directionsOccurred[left] && directionsOccurred[right] && directionsOccurred[up] && directionsOccurred[down]) { k = j; goto foundK; } // Update displacement from i shift = jNextPoint - iPoint; // Test j against constraints // if(cross(shift, leftConstraint)<0 || cross(shift, rightConstraint)>0) if (cross(shift, leftConstraint) < 0) { violatedConstraint = leftConstraint; break; } if (cross(shift, rightConstraint) > 0) { violatedConstraint = rightConstraint; break; } // Update constraints if (abs(shift.x) > 1 || abs(shift.y) > 1) { newLeftConstraint.x = shift.x + (shift.y < 0 || (shift.y == 0 && shift.x < 0) ? 1 : -1); newLeftConstraint.y = shift.y + (shift.x > 0 || (shift.x == 0 && shift.y < 0) ? 1 : -1); if (cross(newLeftConstraint, leftConstraint) >= 0) leftConstraint = newLeftConstraint; newRightConstraint.x = shift.x + (shift.y > 0 || (shift.y == 0 && shift.x < 0) ? 1 : -1); newRightConstraint.y = shift.y + (shift.x < 0 || (shift.x == 0 && shift.y < 0) ? 1 : -1); if (cross(newRightConstraint, rightConstraint) <= 0) rightConstraint = newRightConstraint; } // Imposing strict constraint for ambiguous turnings, to ensure polygons' // weak simpleness. // Has to be defined *outside* abs checks. if (path[nextCorners[j]].getAmbiguous()) { if (path[nextCorners[j]].getAmbiguous() == RawBorderPoint::left) rightConstraint = shift; else leftConstraint = shift; } j = nextCorners[j]; } // At this point, constraints are violated by the next corner. // Then, search for the last k between j and corners[j] not violating them. direction = convert(normalize(convert(jNextPoint - jPoint))); k = (j + cross(jPoint - iPoint, violatedConstraint) / cross(violatedConstraint, direction)) % n; foundK: kVector[i] = k; } return kVector; } //-------------------------------------------------------------------------- // Now find the effective intervals inside which we can define possible // arcs approximating the given raw border: // for every a in [i,res[i]], the arc connecting border[i] and // border[a] will be a possible one. inline std::unique_ptr<int[]> calculateForwardArcs(RawBorder &border, bool ambiguitiesCheck) { int const n = (int)border.size(); std::unique_ptr<int[]> nextCorners; std::unique_ptr<int[]> k = furthestKs(border, nextCorners); std::unique_ptr<int[]> K(new int[n]); std::unique_ptr<int[]> res(new int[n]); // find K[i]= min {k[j]}, j=i..n-1. for (int i = 0; i < n; ++i) { int j; for (j = i, K[i] = k[i]; isCircular(i, j, K[i]); j = (j + 1) % n) if (isCircular(j, k[j], K[i])) K[i] = k[j]; } // Finally, we perform the following clean-up operations: // first, extremities of [i,K[i]] are clipped away, to obtain a // smoother optimal polygon (and deal with cases like the unitary // square); // second, arcs of the kind [i,j] with j<i, become [i,n]. for (int i = n - 1, j = 0; j < n; i = j, ++j) { res[j] = K[i] < j ? (K[i] == 0 ? n - 1 : n) : K[i] - 1; } // Amibiguities check for vertex and edge superpositions. Prevent problems in // the forecoming // straight-skeleton thinning process. if (ambiguitiesCheck) { for (int i = 1; nextCorners[i] > 0; i = nextCorners[i]) { if (border[i].getAmbiguous() == RawBorderPoint::right) { // Check vertices from i (excluded) to res[res[i]]; if in it there // exists vertex k so that pos(k)==pos(i)... // This prevents the existence of 0 degree angles in the optimal // polygon. int rrPlus1 = (res[res[i] % n] + 1) % n; for (int j = nextCorners[i]; isCircular(i, j, rrPlus1) && j != i; // remember that isCircular(a,a,b) == 1 ... j = nextCorners[j]) { if (border[j].getAmbiguous() && (border[j].pos() == border[i].pos())) { res[res[i] % n] = j - 1; assert((res[i] % n) != j - 1); // Further, ensure res is increasing for (int k = res[i] % n; res[k] >= j - 1 && k >= 0; --k) { res[k] = j - 1; assert(k != j - 1); } break; } } } } } return res; } //-------------------------------------------------------------------------- // Let sum[i] and sum2[i] be respectively the sums of vertex coordinates // from 0 to i, and the sums of their squares; sumsMix contain sums of // xy terms. inline void calculateSums(RawBorder &path) { unsigned int i, n = path.size(); TPointD currentRelativePos; path.sums() = new TPointD[n + 1]; path.sums2() = new TPointD[n + 1]; path.sumsMix() = new double[n + 1]; path.sums()[0].x = path.sums()[0].y = path.sums2()[0].x = path.sums2()[0].y = 0; for (i = 1; i < path.size(); ++i) { currentRelativePos = convert(path[i].pos() - path[0].pos()); path.sums()[i] = path.sums()[i - 1] + currentRelativePos; path.sums2()[i].x = path.sums2()[i - 1].x + currentRelativePos.x * currentRelativePos.x; path.sums2()[i].y = path.sums2()[i - 1].y + currentRelativePos.y * currentRelativePos.y; path.sumsMix()[i] = path.sumsMix()[i - 1] + currentRelativePos.x * currentRelativePos.y; } // path[n] is virtually intended as path[0], but we prefer to introduce // it in the optimality algorithm's count path.sums()[n].x = path.sums()[n].y = path.sums2()[n].x = path.sums2()[n].y = 0; } //-------------------------------------------------------------------------- // Let a,b the index-extremities of an arc of this path. // Then return its penalty. inline double penalty(RawBorder &path, int a, int b) { int n = b - a + 1; TPointD v = convert(rotate90(path[b == path.size() ? 0 : b].pos() - path[a].pos())); TPointD sum = path.sums()[b] - path.sums()[a]; TPointD sum2 = path.sums2()[b] - path.sums2()[a]; double sumMix = path.sumsMix()[b] - path.sumsMix()[a]; double F1 = sum2.x - 2 * sum.x * path[a].x() + n * path[a].x() * path[a].x(); double F2 = sum2.y - 2 * sum.y * path[a].y() + n * path[a].y() * path[a].y(); double F3 = sumMix - sum.x * path[a].y() - sum.y * path[a].x() + n * path[a].x() * path[a].y(); return sqrt((v.y * v.y * F1 + v.x * v.x * F2 - 2 * v.x * v.y * F3) / n); } //-------------------------------------------------------------------------- // NOTA: Il seguente algoritmo di riduzione assicura la semplicita' (debole) dei // poligoni prodotti. // inline void reduceBorder(RawBorder &border, Contour &res, bool ambiguitiesCheck) { int n = border.size(); int minPenaltyNext; std::unique_ptr<int[]> minPenaltyNextArray(new int[n]); // Calculate preliminary infos std::unique_ptr<int[]> longestArcFrom = calculateForwardArcs(border, ambiguitiesCheck); calculateSums(border); std::unique_ptr<double[]> penaltyToEnd(new double[n + 1]); // EXPLANATION: // The fastest way to extract the optimal reduced border is based on the // weakly monotonic property of longestArc[]. // The minimal number of its vertices 'm' is easily found by // traversing the path with the longest step allowed. Let b[] be that // succession; then, given res[i], it has to be reached by a vertex in // the interval: {a[i-1], .. , b[i-1]}, where longestArc[a[i-1]]=a[i], // longestArc[a[i-1]-1]<a[i], and a[m]=n. // Calculate m int m = 0; for (int i = 0; i < n; i = longestArcFrom[i]) ++m; // Calculate b[] std::unique_ptr<int[]> b(new int[m + 1]); b[m] = n; for (int i = 0, j = 0; j < m; i = longestArcFrom[i], ++j) b[j] = i; // NOTE: a[] need not be completely found - we just remember the // a=a[j+1] currently needed. // Now, build the optimal polygon for (int j = m - 1, a = n; j >= 0; --j) { int k; for (k = b[j]; k >= 0 && longestArcFrom[k] >= a; --k) { penaltyToEnd[k] = infinity; for (int i = a; i <= longestArcFrom[k]; ++i) { double newPenalty = penaltyToEnd[i] + penalty(border, k, i); if (newPenalty < penaltyToEnd[k]) penaltyToEnd[k] = newPenalty; minPenaltyNext = i; } minPenaltyNextArray[k] = minPenaltyNext; } a = k + 1; } // Finally, read off the optimal polygon res.resize(m); for (int i = 0, j = 0; i < n; i = minPenaltyNextArray[i], ++j) { res[j] = ContourNode(border[i].x(), border[i].y()); // Ambiguities are still remembered in the output polygon. if (border[i].getAmbiguous() == RawBorderPoint::left) res[j].setAttribute(ContourNode::AMBIGUOUS_LEFT); if (border[i].getAmbiguous() == RawBorderPoint::right) res[j].setAttribute(ContourNode::AMBIGUOUS_RIGHT); } delete[] border.sums(); delete[] border.sums2(); delete[] border.sumsMix(); } //-------------------------------------------------------------------------- // Reduction caller and list copier. inline void reduceBorders(BorderList &borders, Contours &result, bool ambiguitiesCheck) { unsigned int i, j; // Initialize output container result.resize(borders.size()); // Copy results for (i = 0; i < borders.size(); ++i) { result[i].resize(borders[i].size()); for (j = 0; j < borders[i].size(); ++j) { reduceBorder(*borders[i][j], result[i][j], ambiguitiesCheck); delete borders[i][j]; } } } //-------------------------------------------------------------------------- //=========================== // Polygonization Main //=========================== // Extracts a polygonal, minimal yet faithful representation of image contours // Contours* polygonize(const TRasterP &ras){ void polygonize(const TRasterP &ras, Contours &polygons, VectorizerCoreGlobals &g) { BorderList *borders; borders = extractBorders(ras, g.currConfig->m_threshold, g.currConfig->m_despeckling); reduceBorders(*borders, polygons, g.currConfig->m_maxThickness > 0.0); }
tomosu/opentoonz
toonz/sources/toonzlib/tcenterlinepolygonizer.cpp
C++
bsd-3-clause
29,088
[ 30522, 1001, 2421, 1000, 22975, 29110, 4179, 3726, 6593, 2361, 1012, 1044, 1000, 1013, 1013, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/*COULEUR PRINCIPALE THEME*/ @media screen and (min-width: 768px) { .pageContainer nav { background-color: #466FC1; } .pageContainer nav .navbarBody { background-color: #466FC1; } } @media screen and (max-width: 767px) { .pageContainer nav .navbarBody a.icon { color: #466FC1; } } .pageContainer aside .panel ul li.active { border-left-color: #466FC1; border-radius: 0; } .pageContainer nav .navbarHeader { background-color: #466FC1; } .pageContainer aside .panel ul li a:hover, .pageContainer aside .panel ul li a:active, .pageContainer aside .panel ul li a:focus, .pageContainer aside .panel ul li.active a { background-color: transparent; color: #466FC1; outline: none; }
Milkyway2605/EasyStage_Symfony
web/bundles/malrauxbethuneeasystage/css/Base/maintain.css
CSS
mit
768
[ 30522, 1013, 1008, 2522, 9307, 3126, 4054, 2063, 4323, 1008, 30524, 1011, 3609, 1024, 1001, 4805, 2575, 11329, 2487, 1025, 1065, 1012, 3931, 8663, 18249, 2121, 6583, 2615, 1012, 6583, 26493, 2906, 23684, 1063, 4281, 1011, 3609, 1024, 1001, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html> <head> <title>PHPXRef 0.7.1 : Unnamed Project : Class Reference: ci_db_pdo_driver</title> <link rel="stylesheet" href="../sample.css" type="text/css"> <link rel="stylesheet" href="../sample-print.css" type="text/css" media="print"> <style id="hilight" type="text/css"></style> <meta http-equiv="content-type" content="text/html;charset=iso-8859-1"> </head> <body bgcolor="#ffffff" text="#000000" link="#801800" vlink="#300540" alink="#ffffff"> <table class="pagetitle" width="100%"> <tr> <td valign="top" class="pagetitle"> [ <a href="../index.html">Index</a> ] </td> <td align="right" class="pagetitle"> <h2 style="margin-bottom: 0px">PHP Cross Reference of Unnamed Project</h2> </td> </tr> </table> <!-- Generated by PHPXref 0.7.1 at Thu Oct 23 19:31:09 2014 --> <!-- PHPXref (c) 2000-2010 Gareth Watts - gareth@omnipotent.net --> <!-- http://phpxref.sourceforge.net/ --> <script src="../phpxref.js" type="text/javascript"></script> <script language="JavaScript" type="text/javascript"> <!-- ext='.html'; relbase='../'; subdir='_classes'; filename='index.html'; cookiekey='phpxref'; handleNavFrame(relbase, subdir, filename); logClass('ci_db_pdo_driver'); // --> </script> <script language="JavaScript" type="text/javascript"> if (gwGetCookie('xrefnav')=='off') document.write('<p class="navlinks">[ <a href="javascript:navOn()">Show Explorer<\/a> ]<\/p>'); else document.write('<p class="navlinks">[ <a href="javascript:navOff()">Hide Explorer<\/a> ]<\/p>'); </script> <noscript> <p class="navlinks"> [ <a href="../nav.html" target="_top">Show Explorer</a> ] [ <a href="index.html" target="_top">Hide Navbar</a> ] </p> </noscript> [<a href="../index.html">Top level directory</a>]<br> <script language="JavaScript" type="text/javascript"> <!-- document.writeln('<table align="right" class="searchbox-link"><tr><td><a class="searchbox-link" href="javascript:void(0)" onMouseOver="showSearchBox()">Search</a><br>'); document.writeln('<table border="0" cellspacing="0" cellpadding="0" class="searchbox" id="searchbox">'); document.writeln('<tr><td class="searchbox-title">'); document.writeln('<a class="searchbox-title" href="javascript:showSearchPopup()">Search History +</a>'); document.writeln('<\/td><\/tr>'); document.writeln('<tr><td class="searchbox-body" id="searchbox-body">'); document.writeln('<form name="search" style="margin:0px; padding:0px" onSubmit=\'return jump()\'>'); document.writeln('<a class="searchbox-body" href="../_classes/index.html">Class<\/a>: '); document.writeln('<input type="text" size=10 value="" name="classname"><br>'); document.writeln('<a id="funcsearchlink" class="searchbox-body" href="../_functions/index.html">Function<\/a>: '); document.writeln('<input type="text" size=10 value="" name="funcname"><br>'); document.writeln('<a class="searchbox-body" href="../_variables/index.html">Variable<\/a>: '); document.writeln('<input type="text" size=10 value="" name="varname"><br>'); document.writeln('<a class="searchbox-body" href="../_constants/index.html">Constant<\/a>: '); document.writeln('<input type="text" size=10 value="" name="constname"><br>'); document.writeln('<a class="searchbox-body" href="../_tables/index.html">Table<\/a>: '); document.writeln('<input type="text" size=10 value="" name="tablename"><br>'); document.writeln('<input type="submit" class="searchbox-button" value="Search">'); document.writeln('<\/form>'); document.writeln('<\/td><\/tr><\/table>'); document.writeln('<\/td><\/tr><\/table>'); // --> </script> <div id="search-popup" class="searchpopup"><p id="searchpopup-title" class="searchpopup-title">title</p><div id="searchpopup-body" class="searchpopup-body">Body</div><p class="searchpopup-close"><a href="javascript:gwCloseActive()">[close]</a></p></div> <h3>Class Cross Reference</h3> <h2><a href="index.html#ci_db_pdo_driver">ci_db_pdo_driver</a></h2> <b>Defined at:</b><ul> <li><a href="../system/database/drivers/pdo/pdo_driver.php.html#ci_db_pdo_driver">/system/database/drivers/pdo/pdo_driver.php</a> -> <a onClick="logClass('ci_db_pdo_driver', '/system/database/drivers/pdo/pdo_driver.php.source.html#l18')" href="../system/database/drivers/pdo/pdo_driver.php.source.html#l18"> line 18</a></li> </ul> <br><b>No references found.</b><br><br> </ul> <!-- A link to the phpxref site in your customized footer file is appreciated ;-) --> <br><hr> <table width="100%"> <tr><td>Generated: Thu Oct 23 19:31:09 2014</td> <td align="right"><i>Cross-referenced by <a href="http://phpxref.sourceforge.net/">PHPXref 0.7.1</a></i></td> </tr> </table> </body></html>
inputx/code-ref-doc
codeigniter/_classes/ci_db_pdo_driver.html
HTML
apache-2.0
4,739
[ 30522, 1026, 999, 9986, 13874, 16129, 2270, 1000, 1011, 1013, 1013, 1059, 2509, 2278, 1013, 1013, 26718, 2094, 16129, 1018, 1012, 1014, 17459, 1013, 1013, 4372, 1000, 1000, 8299, 1024, 1013, 1013, 7479, 1012, 1059, 2509, 1012, 8917, 1013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /** * Custom template tags for this theme * * Eventually, some of the functionality here could be replaced by core features. * * @package UnlockingSilentHistories */ if ( ! function_exists( 'unlockingsilenthistories_posted_on' ) ) : /** * Prints HTML with meta information for the current post-date/time and author. */ function unlockingsilenthistories_posted_on() { $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>'; if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>'; } $time_string = sprintf( $time_string, esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ), esc_attr( get_the_modified_date( 'c' ) ), esc_html( get_the_modified_date() ) ); $posted_on = sprintf( /* translators: %s: post date. */ esc_html_x( 'Posted on %s', 'post date', 'unlockingsilenthistories' ), '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>' ); $byline = sprintf( /* translators: %s: post author. */ esc_html_x( 'by %s', 'post author', 'unlockingsilenthistories' ), '<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>' ); echo '<span class="posted-on">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span>'; // WPCS: XSS OK. } endif; if ( ! function_exists( 'unlockingsilenthistories_entry_footer' ) ) : /** * Prints HTML with meta information for the categories, tags and comments. */ function unlockingsilenthistories_entry_footer() { // Hide category and tag text for pages. if ( 'post' === get_post_type() ) { /* translators: used between list items, there is a space after the comma */ $categories_list = get_the_category_list( esc_html__( ', ', 'unlockingsilenthistories' ) ); if ( $categories_list ) { /* translators: 1: list of categories. */ printf( '<span class="cat-links">' . esc_html__( 'Posted in %1$s', 'unlockingsilenthistories' ) . '</span>', $categories_list ); // WPCS: XSS OK. } /* translators: used between list items, there is a space after the comma */ $tags_list = get_the_tag_list( '', esc_html_x( ', ', 'list item separator', 'unlockingsilenthistories' ) ); if ( $tags_list ) { /* translators: 1: list of tags. */ printf( '<span class="tags-links">' . esc_html__( 'Tagged %1$s', 'unlockingsilenthistories' ) . '</span>', $tags_list ); // WPCS: XSS OK. } } if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo '<span class="comments-link">'; comments_popup_link( sprintf( wp_kses( /* translators: %s: post title */ __( 'Leave a Comment<span class="screen-reader-text"> on %s</span>', 'unlockingsilenthistories' ), array( 'span' => array( 'class' => array(), ), ) ), get_the_title() ) ); echo '</span>'; } edit_post_link( sprintf( wp_kses( /* translators: %s: Name of current post. Only visible to screen readers */ __( 'Edit <span class="screen-reader-text">%s</span>', 'unlockingsilenthistories' ), array( 'span' => array( 'class' => array(), ), ) ), get_the_title() ), '<span class="edit-link">', '</span>' ); } endif;
jhyun94/WP-USH
inc/template-tags.php
PHP
gpl-2.0
3,526
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 7661, 23561, 22073, 2005, 2023, 4323, 1008, 1008, 2776, 1010, 2070, 1997, 1996, 15380, 2182, 2071, 2022, 2999, 2011, 4563, 2838, 1012, 1008, 1008, 1030, 7427, 19829, 8613, 9463, 3372, 24158,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /* * This file is part of SwiftMailer. * (c) 2004-2009 Chris Corbyn * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ /** * Sends Messages over SMTP with ESMTP support. * @package Swift * @subpackage Transport * @author Chris Corbyn */ class Swift_SmtpTransport extends Swift_Transport_EsmtpTransport { /** * Create a new SmtpTransport, optionally with $host, $port and $security. * @param string $host * @param int $port * @param string $security */ public function __construct($host = 'localhost', $port = 25, $security = null) { call_user_func_array( array($this, 'Swift_Transport_EsmtpTransport::__construct'), Swift_DependencyContainer::getInstance() ->createDependenciesFor('transport.smtp') ); $this->setHost($host); $this->setPort($port); $this->setEncryption($security); } /** * Create a new SmtpTransport instance. * @param string $host * @param int $port * @param string $security * @return Swift_SmtpTransport */ public static function newInstance($host = 'localhost', $port = 25, $security = null) { return new self($host, $port, $security); } }
thekingtork/cloudSchool
web/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SmtpTransport.php
PHP
mit
1,387
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 2023, 5371, 2003, 2112, 1997, 9170, 21397, 2121, 1012, 1008, 1006, 1039, 1007, 2432, 1011, 2268, 3782, 2522, 15185, 6038, 1008, 1008, 2005, 1996, 2440, 9385, 1998, 6105, 2592, 1010, 3531, 3193, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# # Module manifest for module 'Git.PS' # # Generated by: andre # # Generated on: 12/28/2015 # @{ # Script module or binary module file associated with this manifest. RootModule = 'GitPS.psm1' # Version number of this module. ModuleVersion = '0.1' # ID used to uniquely identify this module GUID = '5280b029-14ed-42f8-af27-2b3ca5175dae' # Author of this module Author = 'Andrew Gaspar' # Company or vendor of this module # CompanyName = 'Unknown' # Copyright statement for this module Copyright = '(c) 2015 Andrew Gaspar. See LICENSE' # Description of the functionality provided by this module Description = 'Provides PowerShell level abstractions over git.' # Minimum version of the Windows PowerShell engine required by this module # PowerShellVersion = '' # Name of the Windows PowerShell host required by this module # PowerShellHostName = '' # Minimum version of the Windows PowerShell host required by this module # PowerShellHostVersion = '' # Minimum version of Microsoft .NET Framework required by this module # DotNetFrameworkVersion = '' # Minimum version of the common language runtime (CLR) required by this module # CLRVersion = '' # Processor architecture (None, X86, Amd64) required by this module # ProcessorArchitecture = '' # Modules that must be imported into the global environment prior to importing this module # RequiredModules = @() # Assemblies that must be loaded prior to importing this module # RequiredAssemblies = @() # Script files (.ps1) that are run in the caller's environment prior to importing this module. # ScriptsToProcess = @() # Type files (.ps1xml) to be loaded when importing this module # TypesToProcess = @() # Format files (.ps1xml) to be loaded when importing this module # FormatsToProcess = @() # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess # NestedModules = @() # Functions to export from this module FunctionsToExport = @("Get-Git*", "Get-GitCommand*", "Get-GitSubCommand*", "GitCompletion_*") # Cmdlets to export from this module # CmdletsToExport = '*' # Variables to export from this module # VariablesToExport = '*' # Aliases to export from this module AliasesToExport = @("gith") # DSC resources to export from this module # DscResourcesToExport = @() # List of all modules packaged with this module # ModuleList = @() # List of all files packaged with this module # FileList = @() # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. PrivateData = @{ PSData = @{ # Tags applied to this module. These help with module discovery in online galleries. # Tags = @() # A URL to the license for this module. # LicenseUri = '' # A URL to the main website for this project. # ProjectUri = '' # A URL to an icon representing this module. # IconUri = '' # ReleaseNotes of this module # ReleaseNotes = '' } # End of PSData hashtable } # End of PrivateData hashtable # HelpInfo URI of this module # HelpInfoURI = '' # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. # DefaultCommandPrefix = '' }
AndrewGaspar/Git.PS
GitPS/GitPS.psd1
PowerShell
mit
3,297
[ 30522, 1001, 1001, 11336, 19676, 2005, 11336, 1005, 21025, 2102, 1012, 8827, 1005, 1001, 1001, 7013, 2011, 1024, 7213, 1001, 1001, 7013, 2006, 1024, 2260, 1013, 2654, 1013, 2325, 1001, 1030, 1063, 1001, 5896, 11336, 2030, 12441, 11336, 5371...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* jshint -W117 */ /* Copyright 2016 Herko ter Horst __________________________________________________________________________ Filename: _videoplayerApp.js __________________________________________________________________________ */ log.addSrcFile("_videoplayerApp.js", "_videoplayer"); function _videoplayerApp(uiaId) { log.debug("Constructor called."); // Base application functionality is provided in a common location via this call to baseApp.init(). // See framework/js/BaseApp.js for details. baseApp.init(this, uiaId); } // load jQuery Globally (if needed) if (!window.jQuery) { utility.loadScript("addon-common/jquery.min.js"); } /********************************* * App Init is standard function * * called by framework * *********************************/ /* * Called just after the app is instantiated by framework. * All variables local to this app should be declared in this function */ _videoplayerApp.prototype.appInit = function() { log.debug("_videoplayerApp appInit called..."); // These values need to persist through videoplayer instances this.hold = false; this.resumePlay = 0; this.musicIsPaused = false; this.savedVideoList = null; this.resumeVideo = JSON.parse(localStorage.getItem('videoplayer.resumevideo')) || true; // resume is now checked by default this.currentVideoTrack = JSON.parse(localStorage.getItem('videoplayer.currentvideo')) || null; //this.resumePlay = JSON.parse(localStorage.getItem('videoplayer.resume')) || 0; //Context table //@formatter:off this._contextTable = { "Start": { // initial context must be called "Start" "sbName": "Video Player", "template": "VideoPlayerTmplt", "templatePath": "apps/_videoplayer/templates/VideoPlayer", //only needed for app-specific templates "readyFunction": this._StartContextReady.bind(this), "contextOutFunction": this._StartContextOut.bind(this), "noLongerDisplayedFunction": this._noLongerDisplayed.bind(this) } // end of "VideoPlayer" }; // end of this.contextTable object //@formatter:on //@formatter:off this._messageTable = { // haven't yet been able to receive messages from MMUI }; //@formatter:on framework.transitionsObj._genObj._TEMPLATE_CATEGORIES_TABLE.VideoPlayerTmplt = "Detail with UMP"; }; /** * ========================= * CONTEXT CALLBACKS * ========================= */ _videoplayerApp.prototype._StartContextReady = function() { framework.common.setSbDomainIcon("apps/_videoplayer/templates/VideoPlayer/images/icon.png"); }; _videoplayerApp.prototype._StartContextOut = function() { CloseVideoFrame(); framework.common.setSbName(''); }; _videoplayerApp.prototype._noLongerDisplayed = function() { // Stop and close video frame CloseVideoFrame(); // If we are in reverse then save CurrentVideoPlayTime to resume the video where we left of if (framework.getCurrentApp() === 'backupparking'|| framework.getCurrentApp() === 'phone' || (ResumePlay && CurrentVideoPlayTime !== null)) { this.resumePlay = this.resumePlay || CurrentVideoPlayTime; CurrentVideoPlayTime = 0; //localStorage.setItem('videoplayer.resume', JSON.stringify(CurrentVideoPlayTime)); } // If we press the 'Entertainment' button we will be running this in the 'usbaudio' context if (!this.musicIsPaused) { setTimeout(function() { if (framework.getCurrentApp() === 'usbaudio') { framework.sendEventToMmui('Common', 'Global.Pause'); framework.sendEventToMmui('Common', 'Global.GoBack'); this.musicIsPaused = true; // Only run this once } }, 100); } }; /** * ========================= * Framework register * Tell framework this .js file has finished loading * ========================= */ framework.registerAppLoaded("_videoplayer", null, false);
Trevelopment/MZD-AIO-TI-X
app/files/tweaks/config/videoplayer/jci/gui/apps/_videoplayer/js/_videoplayerApp.js
JavaScript
gpl-3.0
3,832
[ 30522, 1013, 1008, 1046, 17426, 2102, 1011, 1059, 14526, 2581, 1008, 1013, 1013, 1008, 9385, 2355, 2014, 3683, 28774, 28565, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
//Pathway model var FormModel = function () { var self = this; self.id = undefined; self.name = undefined; self.dataElements = [] ko.track(self); self.previewForm = function(){ console.log('need to add form preview here') window.location = '../../formDesign/show/' + self.id } }
amilward/MDR
web-app/js/pathways/model/FormModel.js
JavaScript
mit
415
[ 30522, 1013, 1013, 12732, 2944, 13075, 2433, 5302, 9247, 1027, 3853, 1006, 1007, 1063, 13075, 2969, 1027, 2023, 1025, 2969, 1012, 8909, 1027, 6151, 28344, 1025, 2969, 1012, 2171, 1027, 6151, 28344, 1025, 2969, 1012, 2951, 12260, 8163, 1027,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
require 'front_end_tasks/documents/base_document' module FrontEndTasks module Documents class AssetDocument < BaseDocument def compile(opts = {}) { @compiled_path => @content } end end end end
enriquez/front_end_tasks
lib/front_end_tasks/documents/asset_document.rb
Ruby
mit
246
[ 30522, 5478, 1005, 2392, 1035, 2203, 1035, 8518, 1013, 5491, 1013, 2918, 1035, 6254, 1005, 11336, 2392, 10497, 10230, 5705, 11336, 5491, 2465, 11412, 3527, 24894, 4765, 1026, 2241, 10085, 27417, 2102, 13366, 4012, 22090, 1006, 23569, 2015, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/****************************************************************************** QtAV: Multimedia framework based on Qt and FFmpeg Copyright (C) 2012-2016 Wang Bin <wbsecg1@gmail.com> * This file is part of QtAV (from 2013) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ******************************************************************************/ #ifndef QTAV_AUDIORESAMPLER_H #define QTAV_AUDIORESAMPLER_H #include <QtAV/QtAV_Global.h> namespace QtAV { typedef int AudioResamplerId; class AudioFormat; class AudioResamplerPrivate; class Q_AV_EXPORT AudioResampler //export is required for users who want add their own subclass outside QtAV { DPTR_DECLARE_PRIVATE(AudioResampler) public: virtual ~AudioResampler(); // if QtAV is static linked (ios for example), components may be not automatically registered. Add registerAll() to workaround static void registerAll(); template<class C> static bool Register(AudioResamplerId id, const char* name) { return Register(id, create<C>, name);} static AudioResampler* create(AudioResamplerId id); /*! * \brief create * Create resampler from name * \param name can be "FFmpeg", "Libav" */ static AudioResampler* create(const char* name); /*! * \brief next * \param id NULL to get the first id address * \return address of id or NULL if not found/end */ static AudioResamplerId* next(AudioResamplerId* id = 0); static const char* name(AudioResamplerId id); static AudioResamplerId id(const char* name); QByteArray outData() const; /* check whether the parameters are supported. If not, you should use ff*/ /*! * \brief prepare * Check whether the parameters are supported and setup the resampler * setIn/OutXXX will call prepare() if format is changed */ virtual bool prepare(); virtual bool convert(const quint8** data); //speed: >0, default is 1 void setSpeed(qreal speed); //out_sample_rate = out_sample_rate/speed qreal speed() const; void setInAudioFormat(const AudioFormat& format); AudioFormat& inAudioFormat(); const AudioFormat& inAudioFormat() const; void setOutAudioFormat(const AudioFormat& format); AudioFormat& outAudioFormat(); const AudioFormat& outAudioFormat() const; //decoded frame's samples/channel void setInSampesPerChannel(int samples); // > 0 valid after resample done int outSamplesPerChannel() const; //channel count can be computed by av_get_channel_layout_nb_channels(chl) void setInSampleRate(int isr); void setOutSampleRate(int osr); //default is in //TODO: enum void setInSampleFormat(int isf); //FFmpeg sample format void setOutSampleFormat(int osf); //FFmpeg sample format. set by user. default is in //TODO: enum. layout will be set to the default layout of the channels if not defined void setInChannelLayout(qint64 icl); void setOutChannelLayout(qint64 ocl); //default is in void setInChannels(int channels); void setOutChannels(int channels); //Are getter functions required? private: AudioResampler(); template<class C> static AudioResampler* create() { return new C(); } typedef AudioResampler* (*AudioResamplerCreator)(); static bool Register(AudioResamplerId id, AudioResamplerCreator, const char *name); protected: AudioResampler(AudioResamplerPrivate& d); DPTR_DECLARE(AudioResampler) }; extern Q_AV_EXPORT AudioResamplerId AudioResamplerId_FF; extern Q_AV_EXPORT AudioResamplerId AudioResamplerId_Libav; } //namespace QtAV #endif // QTAV_AUDIORESAMPLER_H
MBach/Miam-Player
src/core/3rdparty/QtAV/AudioResampler.h
C
gpl-3.0
4,340
[ 30522, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html> <html> <head> <title>Type Magic</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <style type="text/css"> body { font-family: 'Palatino'; line-height: 2.5em; } h1, h2, h3 { font-family: 'Palatino'; font-weight: normal; } img { height: 400px; } li, p { font-size: 26px; } code { font-size: 24px; line-height: 1.2em; } em { color: #630; } a { color: #360; } .remark-inline-code { color: #036; } .remark-code, .remark-inline-code { font-family: 'Inconsolata LGC'; } .remark-slide-number { display: none; } td { border: 1px solid #999; padding: 0.5em 1em; } table { border-collapse: collapse; } blockquote { background: #eee; } </style> </head> <body onload="var slideshow = remark.create();"> <textarea id="source">
phadej/helhug-types
header.html
HTML
mit
881
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 1028, 1026, 2132, 1028, 1026, 2516, 1028, 2828, 3894, 1026, 1013, 2516, 1028, 1026, 18804, 8299, 1011, 1041, 15549, 2615, 1027, 1000, 4180, 1011, 2828, 1000, 4180, 1027, 1000, 3793, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#!/usr/bin/env python import xml.etree.ElementTree as ET class brocade_ip_access_list(object): """Auto generated class. """ def __init__(self, **kwargs): self._callback = kwargs.pop('callback') def ip_acl_ip_access_list_standard_name(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") standard = ET.SubElement(access_list, "standard") name = ET.SubElement(standard, "name") name.text = kwargs.pop('name') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_standard_hide_ip_acl_std_seq_seq_id(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") standard = ET.SubElement(access_list, "standard") name_key = ET.SubElement(standard, "name") name_key.text = kwargs.pop('name') hide_ip_acl_std = ET.SubElement(standard, "hide-ip-acl-std") seq = ET.SubElement(hide_ip_acl_std, "seq") seq_id = ET.SubElement(seq, "seq-id") seq_id.text = kwargs.pop('seq_id') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_standard_hide_ip_acl_std_seq_action(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") standard = ET.SubElement(access_list, "standard") name_key = ET.SubElement(standard, "name") name_key.text = kwargs.pop('name') hide_ip_acl_std = ET.SubElement(standard, "hide-ip-acl-std") seq = ET.SubElement(hide_ip_acl_std, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') action = ET.SubElement(seq, "action") action.text = kwargs.pop('action') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_standard_hide_ip_acl_std_seq_src_host_any_sip(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") standard = ET.SubElement(access_list, "standard") name_key = ET.SubElement(standard, "name") name_key.text = kwargs.pop('name') hide_ip_acl_std = ET.SubElement(standard, "hide-ip-acl-std") seq = ET.SubElement(hide_ip_acl_std, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') src_host_any_sip = ET.SubElement(seq, "src-host-any-sip") src_host_any_sip.text = kwargs.pop('src_host_any_sip') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_standard_hide_ip_acl_std_seq_src_host_ip(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") standard = ET.SubElement(access_list, "standard") name_key = ET.SubElement(standard, "name") name_key.text = kwargs.pop('name') hide_ip_acl_std = ET.SubElement(standard, "hide-ip-acl-std") seq = ET.SubElement(hide_ip_acl_std, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') src_host_ip = ET.SubElement(seq, "src-host-ip") src_host_ip.text = kwargs.pop('src_host_ip') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_standard_hide_ip_acl_std_seq_src_mask(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") standard = ET.SubElement(access_list, "standard") name_key = ET.SubElement(standard, "name") name_key.text = kwargs.pop('name') hide_ip_acl_std = ET.SubElement(standard, "hide-ip-acl-std") seq = ET.SubElement(hide_ip_acl_std, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') src_mask = ET.SubElement(seq, "src-mask") src_mask.text = kwargs.pop('src_mask') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_standard_hide_ip_acl_std_seq_count(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") standard = ET.SubElement(access_list, "standard") name_key = ET.SubElement(standard, "name") name_key.text = kwargs.pop('name') hide_ip_acl_std = ET.SubElement(standard, "hide-ip-acl-std") seq = ET.SubElement(hide_ip_acl_std, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') count = ET.SubElement(seq, "count") callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_standard_hide_ip_acl_std_seq_log(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") standard = ET.SubElement(access_list, "standard") name_key = ET.SubElement(standard, "name") name_key.text = kwargs.pop('name') hide_ip_acl_std = ET.SubElement(standard, "hide-ip-acl-std") seq = ET.SubElement(hide_ip_acl_std, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') log = ET.SubElement(seq, "log") callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_name(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name = ET.SubElement(extended, "name") name.text = kwargs.pop('name') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_seq_id(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id = ET.SubElement(seq, "seq-id") seq_id.text = kwargs.pop('seq_id') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_action(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') action = ET.SubElement(seq, "action") action.text = kwargs.pop('action') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_protocol_type(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') protocol_type = ET.SubElement(seq, "protocol-type") protocol_type.text = kwargs.pop('protocol_type') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_src_host_any_sip(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') src_host_any_sip = ET.SubElement(seq, "src-host-any-sip") src_host_any_sip.text = kwargs.pop('src_host_any_sip') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_src_host_ip(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') src_host_ip = ET.SubElement(seq, "src-host-ip") src_host_ip.text = kwargs.pop('src_host_ip') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_src_mask(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') src_mask = ET.SubElement(seq, "src-mask") src_mask.text = kwargs.pop('src_mask') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_sport(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') sport = ET.SubElement(seq, "sport") sport.text = kwargs.pop('sport') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_sport_number_eq_neq_tcp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') sport_number_eq_neq_tcp = ET.SubElement(seq, "sport-number-eq-neq-tcp") sport_number_eq_neq_tcp.text = kwargs.pop('sport_number_eq_neq_tcp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_sport_number_lt_tcp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') sport_number_lt_tcp = ET.SubElement(seq, "sport-number-lt-tcp") sport_number_lt_tcp.text = kwargs.pop('sport_number_lt_tcp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_sport_number_gt_tcp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') sport_number_gt_tcp = ET.SubElement(seq, "sport-number-gt-tcp") sport_number_gt_tcp.text = kwargs.pop('sport_number_gt_tcp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_sport_number_eq_neq_udp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') sport_number_eq_neq_udp = ET.SubElement(seq, "sport-number-eq-neq-udp") sport_number_eq_neq_udp.text = kwargs.pop('sport_number_eq_neq_udp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_sport_number_lt_udp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') sport_number_lt_udp = ET.SubElement(seq, "sport-number-lt-udp") sport_number_lt_udp.text = kwargs.pop('sport_number_lt_udp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_sport_number_gt_udp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') sport_number_gt_udp = ET.SubElement(seq, "sport-number-gt-udp") sport_number_gt_udp.text = kwargs.pop('sport_number_gt_udp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_sport_number_range_lower_tcp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') sport_number_range_lower_tcp = ET.SubElement(seq, "sport-number-range-lower-tcp") sport_number_range_lower_tcp.text = kwargs.pop('sport_number_range_lower_tcp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_sport_number_range_lower_udp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') sport_number_range_lower_udp = ET.SubElement(seq, "sport-number-range-lower-udp") sport_number_range_lower_udp.text = kwargs.pop('sport_number_range_lower_udp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_sport_number_range_higher_tcp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') sport_number_range_higher_tcp = ET.SubElement(seq, "sport-number-range-higher-tcp") sport_number_range_higher_tcp.text = kwargs.pop('sport_number_range_higher_tcp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_sport_number_range_higher_udp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') sport_number_range_higher_udp = ET.SubElement(seq, "sport-number-range-higher-udp") sport_number_range_higher_udp.text = kwargs.pop('sport_number_range_higher_udp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_dst_host_any_dip(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') dst_host_any_dip = ET.SubElement(seq, "dst-host-any-dip") dst_host_any_dip.text = kwargs.pop('dst_host_any_dip') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_dst_host_ip(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') dst_host_ip = ET.SubElement(seq, "dst-host-ip") dst_host_ip.text = kwargs.pop('dst_host_ip') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_dst_mask(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') dst_mask = ET.SubElement(seq, "dst-mask") dst_mask.text = kwargs.pop('dst_mask') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_dport(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') dport = ET.SubElement(seq, "dport") dport.text = kwargs.pop('dport') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_dport_number_eq_neq_tcp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') dport_number_eq_neq_tcp = ET.SubElement(seq, "dport-number-eq-neq-tcp") dport_number_eq_neq_tcp.text = kwargs.pop('dport_number_eq_neq_tcp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_dport_number_lt_tcp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') dport_number_lt_tcp = ET.SubElement(seq, "dport-number-lt-tcp") dport_number_lt_tcp.text = kwargs.pop('dport_number_lt_tcp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_dport_number_gt_tcp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') dport_number_gt_tcp = ET.SubElement(seq, "dport-number-gt-tcp") dport_number_gt_tcp.text = kwargs.pop('dport_number_gt_tcp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_dport_number_eq_neq_udp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') dport_number_eq_neq_udp = ET.SubElement(seq, "dport-number-eq-neq-udp") dport_number_eq_neq_udp.text = kwargs.pop('dport_number_eq_neq_udp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_dport_number_lt_udp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') dport_number_lt_udp = ET.SubElement(seq, "dport-number-lt-udp") dport_number_lt_udp.text = kwargs.pop('dport_number_lt_udp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_dport_number_gt_udp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') dport_number_gt_udp = ET.SubElement(seq, "dport-number-gt-udp") dport_number_gt_udp.text = kwargs.pop('dport_number_gt_udp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_dport_number_range_lower_tcp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') dport_number_range_lower_tcp = ET.SubElement(seq, "dport-number-range-lower-tcp") dport_number_range_lower_tcp.text = kwargs.pop('dport_number_range_lower_tcp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_dport_number_range_lower_udp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') dport_number_range_lower_udp = ET.SubElement(seq, "dport-number-range-lower-udp") dport_number_range_lower_udp.text = kwargs.pop('dport_number_range_lower_udp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_dport_number_range_higher_tcp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') dport_number_range_higher_tcp = ET.SubElement(seq, "dport-number-range-higher-tcp") dport_number_range_higher_tcp.text = kwargs.pop('dport_number_range_higher_tcp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_dport_number_range_higher_udp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') dport_number_range_higher_udp = ET.SubElement(seq, "dport-number-range-higher-udp") dport_number_range_higher_udp.text = kwargs.pop('dport_number_range_higher_udp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_dscp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') dscp = ET.SubElement(seq, "dscp") dscp.text = kwargs.pop('dscp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_urg(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') urg = ET.SubElement(seq, "urg") callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_ack(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') ack = ET.SubElement(seq, "ack") callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_push(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') push = ET.SubElement(seq, "push") callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_fin(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') fin = ET.SubElement(seq, "fin") callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_rst(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') rst = ET.SubElement(seq, "rst") callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_sync(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') sync = ET.SubElement(seq, "sync") callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_vlan(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') vlan = ET.SubElement(seq, "vlan") vlan.text = kwargs.pop('vlan') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_count(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') count = ET.SubElement(seq, "count") callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_log(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') log = ET.SubElement(seq, "log") callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_standard_name(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") standard = ET.SubElement(access_list, "standard") name = ET.SubElement(standard, "name") name.text = kwargs.pop('name') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_standard_hide_ip_acl_std_seq_seq_id(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") standard = ET.SubElement(access_list, "standard") name_key = ET.SubElement(standard, "name") name_key.text = kwargs.pop('name') hide_ip_acl_std = ET.SubElement(standard, "hide-ip-acl-std") seq = ET.SubElement(hide_ip_acl_std, "seq") seq_id = ET.SubElement(seq, "seq-id") seq_id.text = kwargs.pop('seq_id') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_standard_hide_ip_acl_std_seq_action(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") standard = ET.SubElement(access_list, "standard") name_key = ET.SubElement(standard, "name") name_key.text = kwargs.pop('name') hide_ip_acl_std = ET.SubElement(standard, "hide-ip-acl-std") seq = ET.SubElement(hide_ip_acl_std, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') action = ET.SubElement(seq, "action") action.text = kwargs.pop('action') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_standard_hide_ip_acl_std_seq_src_host_any_sip(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") standard = ET.SubElement(access_list, "standard") name_key = ET.SubElement(standard, "name") name_key.text = kwargs.pop('name') hide_ip_acl_std = ET.SubElement(standard, "hide-ip-acl-std") seq = ET.SubElement(hide_ip_acl_std, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') src_host_any_sip = ET.SubElement(seq, "src-host-any-sip") src_host_any_sip.text = kwargs.pop('src_host_any_sip') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_standard_hide_ip_acl_std_seq_src_host_ip(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") standard = ET.SubElement(access_list, "standard") name_key = ET.SubElement(standard, "name") name_key.text = kwargs.pop('name') hide_ip_acl_std = ET.SubElement(standard, "hide-ip-acl-std") seq = ET.SubElement(hide_ip_acl_std, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') src_host_ip = ET.SubElement(seq, "src-host-ip") src_host_ip.text = kwargs.pop('src_host_ip') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_standard_hide_ip_acl_std_seq_src_mask(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") standard = ET.SubElement(access_list, "standard") name_key = ET.SubElement(standard, "name") name_key.text = kwargs.pop('name') hide_ip_acl_std = ET.SubElement(standard, "hide-ip-acl-std") seq = ET.SubElement(hide_ip_acl_std, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') src_mask = ET.SubElement(seq, "src-mask") src_mask.text = kwargs.pop('src_mask') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_standard_hide_ip_acl_std_seq_count(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") standard = ET.SubElement(access_list, "standard") name_key = ET.SubElement(standard, "name") name_key.text = kwargs.pop('name') hide_ip_acl_std = ET.SubElement(standard, "hide-ip-acl-std") seq = ET.SubElement(hide_ip_acl_std, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') count = ET.SubElement(seq, "count") callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_standard_hide_ip_acl_std_seq_log(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") standard = ET.SubElement(access_list, "standard") name_key = ET.SubElement(standard, "name") name_key.text = kwargs.pop('name') hide_ip_acl_std = ET.SubElement(standard, "hide-ip-acl-std") seq = ET.SubElement(hide_ip_acl_std, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') log = ET.SubElement(seq, "log") callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_name(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name = ET.SubElement(extended, "name") name.text = kwargs.pop('name') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_seq_id(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id = ET.SubElement(seq, "seq-id") seq_id.text = kwargs.pop('seq_id') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_action(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') action = ET.SubElement(seq, "action") action.text = kwargs.pop('action') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_protocol_type(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') protocol_type = ET.SubElement(seq, "protocol-type") protocol_type.text = kwargs.pop('protocol_type') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_src_host_any_sip(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') src_host_any_sip = ET.SubElement(seq, "src-host-any-sip") src_host_any_sip.text = kwargs.pop('src_host_any_sip') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_src_host_ip(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') src_host_ip = ET.SubElement(seq, "src-host-ip") src_host_ip.text = kwargs.pop('src_host_ip') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_src_mask(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') src_mask = ET.SubElement(seq, "src-mask") src_mask.text = kwargs.pop('src_mask') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_sport(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') sport = ET.SubElement(seq, "sport") sport.text = kwargs.pop('sport') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_sport_number_eq_neq_tcp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') sport_number_eq_neq_tcp = ET.SubElement(seq, "sport-number-eq-neq-tcp") sport_number_eq_neq_tcp.text = kwargs.pop('sport_number_eq_neq_tcp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_sport_number_lt_tcp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') sport_number_lt_tcp = ET.SubElement(seq, "sport-number-lt-tcp") sport_number_lt_tcp.text = kwargs.pop('sport_number_lt_tcp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_sport_number_gt_tcp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') sport_number_gt_tcp = ET.SubElement(seq, "sport-number-gt-tcp") sport_number_gt_tcp.text = kwargs.pop('sport_number_gt_tcp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_sport_number_eq_neq_udp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') sport_number_eq_neq_udp = ET.SubElement(seq, "sport-number-eq-neq-udp") sport_number_eq_neq_udp.text = kwargs.pop('sport_number_eq_neq_udp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_sport_number_lt_udp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') sport_number_lt_udp = ET.SubElement(seq, "sport-number-lt-udp") sport_number_lt_udp.text = kwargs.pop('sport_number_lt_udp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_sport_number_gt_udp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') sport_number_gt_udp = ET.SubElement(seq, "sport-number-gt-udp") sport_number_gt_udp.text = kwargs.pop('sport_number_gt_udp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_sport_number_range_lower_tcp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') sport_number_range_lower_tcp = ET.SubElement(seq, "sport-number-range-lower-tcp") sport_number_range_lower_tcp.text = kwargs.pop('sport_number_range_lower_tcp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_sport_number_range_lower_udp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') sport_number_range_lower_udp = ET.SubElement(seq, "sport-number-range-lower-udp") sport_number_range_lower_udp.text = kwargs.pop('sport_number_range_lower_udp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_sport_number_range_higher_tcp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') sport_number_range_higher_tcp = ET.SubElement(seq, "sport-number-range-higher-tcp") sport_number_range_higher_tcp.text = kwargs.pop('sport_number_range_higher_tcp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_sport_number_range_higher_udp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') sport_number_range_higher_udp = ET.SubElement(seq, "sport-number-range-higher-udp") sport_number_range_higher_udp.text = kwargs.pop('sport_number_range_higher_udp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_dst_host_any_dip(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') dst_host_any_dip = ET.SubElement(seq, "dst-host-any-dip") dst_host_any_dip.text = kwargs.pop('dst_host_any_dip') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_dst_host_ip(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') dst_host_ip = ET.SubElement(seq, "dst-host-ip") dst_host_ip.text = kwargs.pop('dst_host_ip') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_dst_mask(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') dst_mask = ET.SubElement(seq, "dst-mask") dst_mask.text = kwargs.pop('dst_mask') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_dport(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') dport = ET.SubElement(seq, "dport") dport.text = kwargs.pop('dport') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_dport_number_eq_neq_tcp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') dport_number_eq_neq_tcp = ET.SubElement(seq, "dport-number-eq-neq-tcp") dport_number_eq_neq_tcp.text = kwargs.pop('dport_number_eq_neq_tcp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_dport_number_lt_tcp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') dport_number_lt_tcp = ET.SubElement(seq, "dport-number-lt-tcp") dport_number_lt_tcp.text = kwargs.pop('dport_number_lt_tcp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_dport_number_gt_tcp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') dport_number_gt_tcp = ET.SubElement(seq, "dport-number-gt-tcp") dport_number_gt_tcp.text = kwargs.pop('dport_number_gt_tcp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_dport_number_eq_neq_udp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') dport_number_eq_neq_udp = ET.SubElement(seq, "dport-number-eq-neq-udp") dport_number_eq_neq_udp.text = kwargs.pop('dport_number_eq_neq_udp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_dport_number_lt_udp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') dport_number_lt_udp = ET.SubElement(seq, "dport-number-lt-udp") dport_number_lt_udp.text = kwargs.pop('dport_number_lt_udp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_dport_number_gt_udp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') dport_number_gt_udp = ET.SubElement(seq, "dport-number-gt-udp") dport_number_gt_udp.text = kwargs.pop('dport_number_gt_udp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_dport_number_range_lower_tcp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') dport_number_range_lower_tcp = ET.SubElement(seq, "dport-number-range-lower-tcp") dport_number_range_lower_tcp.text = kwargs.pop('dport_number_range_lower_tcp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_dport_number_range_lower_udp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') dport_number_range_lower_udp = ET.SubElement(seq, "dport-number-range-lower-udp") dport_number_range_lower_udp.text = kwargs.pop('dport_number_range_lower_udp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_dport_number_range_higher_tcp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') dport_number_range_higher_tcp = ET.SubElement(seq, "dport-number-range-higher-tcp") dport_number_range_higher_tcp.text = kwargs.pop('dport_number_range_higher_tcp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_dport_number_range_higher_udp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') dport_number_range_higher_udp = ET.SubElement(seq, "dport-number-range-higher-udp") dport_number_range_higher_udp.text = kwargs.pop('dport_number_range_higher_udp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_dscp(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') dscp = ET.SubElement(seq, "dscp") dscp.text = kwargs.pop('dscp') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_urg(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') urg = ET.SubElement(seq, "urg") callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_ack(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') ack = ET.SubElement(seq, "ack") callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_push(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') push = ET.SubElement(seq, "push") callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_fin(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') fin = ET.SubElement(seq, "fin") callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_rst(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') rst = ET.SubElement(seq, "rst") callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_sync(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') sync = ET.SubElement(seq, "sync") callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_vlan(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') vlan = ET.SubElement(seq, "vlan") vlan.text = kwargs.pop('vlan') callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_count(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') count = ET.SubElement(seq, "count") callback = kwargs.pop('callback', self._callback) return callback(config) def ip_acl_ip_access_list_extended_hide_ip_acl_ext_seq_log(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ip_acl = ET.SubElement(config, "ip-acl", xmlns="urn:brocade.com:mgmt:brocade-ip-access-list") ip = ET.SubElement(ip_acl, "ip") access_list = ET.SubElement(ip, "access-list") extended = ET.SubElement(access_list, "extended") name_key = ET.SubElement(extended, "name") name_key.text = kwargs.pop('name') hide_ip_acl_ext = ET.SubElement(extended, "hide-ip-acl-ext") seq = ET.SubElement(hide_ip_acl_ext, "seq") seq_id_key = ET.SubElement(seq, "seq-id") seq_id_key.text = kwargs.pop('seq_id') log = ET.SubElement(seq, "log") callback = kwargs.pop('callback', self._callback) return callback(config)
BRCDcomm/pynos
pynos/versions/ver_7/ver_7_1_0/yang/brocade_ip_access_list.py
Python
apache-2.0
93,629
[ 30522, 1001, 999, 1013, 2149, 2099, 1013, 8026, 1013, 4372, 2615, 18750, 12324, 20950, 1012, 3802, 9910, 1012, 5783, 13334, 2004, 3802, 2465, 22953, 21869, 1035, 12997, 1035, 3229, 1035, 2862, 1006, 4874, 1007, 1024, 1000, 1000, 1000, 8285,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// node/this-3.js var object = { id: "xyz", printId: function() { console.log('The id is '+ this.id + ' ' + this.toString()); } }; // setTimeout(object.printId, 100); var callback = object.printId; callback();
sistemas-web/nodejs-exemplos
node/this-3.js
JavaScript
lgpl-3.0
238
[ 30522, 1013, 1013, 13045, 1013, 2023, 1011, 1017, 1012, 1046, 2015, 13075, 4874, 1027, 1063, 8909, 1024, 1000, 1060, 2100, 2480, 1000, 1010, 6140, 3593, 1024, 3853, 1006, 1007, 1063, 10122, 1012, 8833, 1006, 1005, 1996, 8909, 2003, 1005, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'Product.date_added' db.add_column(u'clone_product', 'date_added', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, default=datetime.datetime(2014, 8, 3, 0, 0), blank=True), keep_default=False) def backwards(self, orm): # Deleting field 'Product.date_added' db.delete_column(u'clone_product', 'date_added') models = { u'auth.group': { 'Meta': {'object_name': 'Group'}, u'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': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) }, u'auth.permission': { 'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'}, 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) }, u'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', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Group']"}), u'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', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Permission']"}), 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) }, u'clone.product': { 'Meta': {'object_name': 'Product'}, 'base_price': ('django.db.models.fields.FloatField', [], {}), 'currency': ('django.db.models.fields.CharField', [], {'max_length': '20'}), 'date_added': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), 'description': ('django.db.models.fields.TextField', [], {}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'title': ('django.db.models.fields.CharField', [], {'max_length': '200'}), 'username': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']"}) }, u'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'}), u'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'}) } } complete_apps = ['clone']
indradhanush/Instamojo-Clone
clone/migrations/0002_auto__add_field_product_date_added.py
Python
gpl-3.0
4,593
[ 30522, 1001, 1011, 1008, 1011, 16861, 1024, 21183, 2546, 1011, 1022, 1011, 1008, 1011, 2013, 2148, 1012, 21183, 12146, 12324, 3058, 7292, 1035, 21183, 12146, 2004, 3058, 7292, 2013, 2148, 1012, 16962, 12324, 16962, 2013, 2148, 1012, 1058, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package com.dubture.twig.core.model; public interface IFunction extends ITwigCallable { }
gencer/Twig-Eclipse-Plugin
com.dubture.twig.core/src/com/dubture/twig/core/model/IFunction.java
Java
mit
91
[ 30522, 7427, 4012, 1012, 12931, 11244, 1012, 1056, 16279, 1012, 4563, 1012, 2944, 1025, 2270, 8278, 2065, 4609, 7542, 8908, 2009, 16279, 9289, 20470, 2571, 1063, 1065, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package com.xcuber.dao; import com.xcuber.model.Student; public interface StudentDao { Student findById(Long id); }
glomie/xcuber-boot
src/main/java/com/xcuber/dao/StudentDao.java
Java
apache-2.0
123
[ 30522, 7427, 4012, 1012, 1060, 10841, 5677, 1012, 4830, 2080, 1025, 12324, 4012, 1012, 1060, 10841, 5677, 1012, 2944, 1012, 3076, 1025, 2270, 8278, 3076, 2850, 2080, 1063, 3076, 2424, 3762, 3593, 1006, 2146, 8909, 1007, 1025, 1065, 102, 0...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
import _curry2 from "./_curry2"; /** * Accepts an object and build a function expecting a key to create a "pair" with the key * and its value. * @private * @function * @param {Object} obj * @returns {Function} */ var _keyToPairIn = _curry2(function (obj, key) { return [key, obj[key]]; }); export default _keyToPairIn;
ascartabelli/lamb
src/privates/_keyToPairIn.js
JavaScript
mit
332
[ 30522, 12324, 1035, 15478, 2475, 2013, 1000, 1012, 1013, 1035, 15478, 2475, 1000, 1025, 1013, 1008, 1008, 1008, 13385, 2019, 4874, 1998, 3857, 1037, 3853, 8074, 1037, 3145, 2000, 3443, 1037, 1000, 3940, 1000, 2007, 1996, 3145, 1008, 1998, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* Nihonium Engine This file is licensed under the terms of the MIT License. See LICENCE.txt for the full licence. */ #include "../common/object.h" #include "../common/screen.h" #include "../windows/windows_filesystem.h" #include "../windows/windows_input.h" #include "../windows/windows_audio.h" int main(int argc, char** argv) { filesystem::instance = new filesystem::WindowsFilesystem(); input::instance = new input::WindowsInput(); audio::instance = new audio::WindowsAudio(); audio::instance->init(nullptr); audio::BaseMusic* music = audio::instance->new_music("resources/music/music.ogg"); // TODO: This is a temporary testing feature. audio::instance->play_music(music); screen::init(); object::load_scene("resources/scenes/main.lua"); while (!screen::should_close) { double frame_time = screen::get_frame_time(); object::update(frame_time, object::root); screen::end_frame(); } screen::uninit(); return 0; }
IDidMakeThat/gameengine-temp
source/windows/main.cpp
C++
mit
960
[ 30522, 1013, 1008, 9152, 8747, 5007, 3194, 2023, 5371, 2003, 7000, 2104, 1996, 3408, 1997, 1996, 10210, 6105, 1012, 2156, 11172, 1012, 19067, 2102, 2005, 1996, 2440, 11172, 1012, 1008, 1013, 1001, 2421, 1000, 1012, 1012, 1013, 2691, 1013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_NETWORK_HINTS_RENDERER_WEB_PRESCIENT_NETWORKING_IMPL_H_ #define COMPONENTS_NETWORK_HINTS_RENDERER_WEB_PRESCIENT_NETWORKING_IMPL_H_ #include "base/macros.h" #include "components/network_hints/common/network_hints.mojom.h" #include "components/network_hints/renderer/renderer_dns_prefetch.h" #include "mojo/public/cpp/bindings/remote.h" #include "third_party/blink/public/platform/web_prescient_networking.h" namespace content { class RenderFrame; } namespace network_hints { // The main entry point from blink for sending DNS prefetch requests to the // network stack. class WebPrescientNetworkingImpl : public blink::WebPrescientNetworking { public: explicit WebPrescientNetworkingImpl(content::RenderFrame* render_frame); ~WebPrescientNetworkingImpl() override; // blink::WebPrescientNetworking methods: void PrefetchDNS(const blink::WebString& hostname) override; void Preconnect(const blink::WebURL& url, bool allow_credentials) override; private: mojo::Remote<mojom::NetworkHintsHandler> handler_; RendererDnsPrefetch dns_prefetch_; DISALLOW_COPY_AND_ASSIGN(WebPrescientNetworkingImpl); }; } // namespace network_hints #endif // COMPONENTS_NETWORK_HINTS_RENDERER_WEB_PRESCIENT_NETWORKING_IMPL_H_
endlessm/chromium-browser
components/network_hints/renderer/web_prescient_networking_impl.h
C
bsd-3-clause
1,414
[ 30522, 1013, 1013, 9385, 2297, 1996, 10381, 21716, 5007, 6048, 1012, 2035, 2916, 9235, 1012, 1013, 1013, 2224, 1997, 2023, 3120, 3642, 2003, 9950, 2011, 1037, 18667, 2094, 1011, 2806, 6105, 2008, 2064, 2022, 1013, 1013, 2179, 1999, 1996, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
require 'active_support/inflector' shared_context "module" do let(:mixin) { self.described_class } let(:instance) { klass.new } let(:klass) { Class.new(Object) do; end } before { klass.send(:include, mixin) } end
adamstrickland/cottontail
spec/support/shared_contexts.rb
Ruby
mit
230
[ 30522, 5478, 1005, 3161, 1035, 2490, 1013, 1999, 21031, 16761, 1005, 4207, 1035, 6123, 1000, 11336, 1000, 2079, 2292, 1006, 1024, 4666, 2378, 1007, 1063, 2969, 1012, 2649, 1035, 2465, 1065, 2292, 1006, 1024, 6013, 1007, 1063, 1047, 27102, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
[![Deploy to now](https://deploy.now.sh/static/button.svg)](https://deploy.now.sh/?repo=https://github.com/zeit/next.js/tree/master/examples/with-jsx) # JSX Next.js example This is a really simple project that show the usage of Next.js with JSX. ## How to use it? ``` npm install # to install dependencies npm run dev # to run next.js ```
nelak/next.js
examples/with-jsx/README.md
Markdown
mit
349
[ 30522, 1031, 999, 1031, 21296, 2000, 2085, 1033, 1006, 16770, 1024, 1013, 1013, 21296, 1012, 2085, 1012, 14021, 1013, 10763, 1013, 6462, 1012, 17917, 2290, 1007, 1033, 1006, 16770, 1024, 1013, 1013, 21296, 1012, 2085, 1012, 14021, 1013, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html lang="en-GB" xml:lang="en-GB" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>xcomp:subj</title> <link rel="root" href=""/> <!-- for JS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css"> <link rel="stylesheet" type="text/css" href="../../css/jquery-ui-redmond.css"/> <link rel="stylesheet" type="text/css" href="../../css/style.css"/> <link rel="stylesheet" type="text/css" href="../../css/style-vis.css"/> <link rel="stylesheet" type="text/css" href="../../css/hint.css"/> <script type="text/javascript" src="../../lib/ext/head.load.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/3.2.2/anchor.min.js"></script> <script>document.addEventListener("DOMContentLoaded", function(event) {anchors.add();});</script> <!-- Set up this custom Google search at https://cse.google.com/cse/business/settings?cx=001145188882102106025:dl1mehhcgbo --> <!-- DZ 2021-01-22: I am temporarily hiding the search field to find out whether it slows down loading of the title page. <script> (function() { var cx = '001145188882102106025:dl1mehhcgbo'; var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true; gcse.src = 'https://cse.google.com/cse.js?cx=' + cx; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s); })(); </script> --> <!-- <link rel="shortcut icon" href="favicon.ico"/> --> </head> <body> <div id="main" class="center"> <div id="hp-header"> <table width="100%"><tr><td width="50%"> <span class="header-text"><a href="http://universaldependencies.org/#language-pl">home</a></span> <span class="header-text"><a href="https://github.com/universaldependencies/docs/edit/pages-source/_pl/dep/xcomp-subj.md" target="#">edit page</a></span> <span class="header-text"><a href="https://github.com/universaldependencies/docs/issues">issue tracker</a></span> </td><td> <gcse:search></gcse:search> </td></tr></table> </div> <hr/> <div class="v2complete"> This page pertains to UD version 2. </div> <div id="content"> <noscript> <div id="noscript"> It appears that you have Javascript disabled. Please consider enabling Javascript for this page to see the visualizations. </div> </noscript> <!-- The content may include scripts and styles, hence we must load the shared libraries before the content. --> <script type="text/javascript"> console.time('loading libraries'); var root = '../../'; // filled in by jekyll head.js( // External libraries // DZ: Copied from embedding.html. I don't know which one is needed for what, so I'm currently keeping them all. root + 'lib/ext/jquery.min.js', root + 'lib/ext/jquery.svg.min.js', root + 'lib/ext/jquery.svgdom.min.js', root + 'lib/ext/jquery.timeago.js', root + 'lib/ext/jquery-ui.min.js', root + 'lib/ext/waypoints.min.js', root + 'lib/ext/jquery.address.min.js' ); </script> <h2><code>xcomp:subj</code>: infinitival and adverbial subjects</h2> <p>The <code class="language-plaintext highlighter-rouge">xcomp:subj</code> relation is used in the Polish <a href="http://universaldependencies.org/treebanks/pl_pdb/index.html">PDB-UD</a> and <a href="http://universaldependencies.org/treebanks/pl_pud/index.html">PUD</a> treebanks for a subject realised as an infinitival or adverbial phrase.</p> <pre><code class="language-conllu"># visual-style 10 2 xcomp:subj color:blue 1 Czy czy PART part PartType=Int 10 advmod _ _ 2 korzystać korzystać VERB inf:imperf Aspect=Imp|VerbForm=Inf|Voice=Act 10 xcomp:subj _ _ 3 z z ADP prep:gen:nwok AdpType=Prep|Variant=Short 5 case _ Case=Gen 4 takiego taki DET adj:sg:gen:m3:pos Animacy=Inan|Case=Gen|Gender=Masc|Number=Sing|PronType=Dem 5 det _ _ 5 podręcznika podręcznik NOUN subst:sg:gen:m3 Animacy=Inan|Case=Gen|Gender=Masc|Number=Sing 2 obl:arg _ _ 6 jest być AUX fin:sg:ter:imperf Aspect=Imp|Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin|Voice=Act 10 cop _ _ 7 może może PART part PartType=Mod 9 advmod:emph _ _ 8 dla dla ADP prep:gen AdpType=Prep 9 case _ Case=Gen 9 kogoś ktoś PRON subst:sg:gen:m1 Animacy=Hum|Case=Gen|Gender=Masc|Number=Sing|PronType=Ind 10 nmod _ _ 10 uchybieniem uchybienie NOUN subst:sg:inst:n:ncol Case=Ins|Gender=Neut|Number=Sing 0 root _ SpaceAfter=No 11 ? ? PUNCT interp PunctType=Qest 10 punct _ _ </code></pre> <pre><code class="language-conllu">1 Is _ _ _ _ _ _ _ _ 2 using _ _ _ _ _ _ _ _ 3 such _ _ _ _ _ _ _ _ 4 a _ _ _ _ _ _ _ _ 5 handbook _ _ _ _ _ _ _ _ 6 a _ _ _ _ _ _ _ _ 7 fault _ _ _ _ _ _ _ _ 8 for _ _ _ _ _ _ _ _ 9 someone _ _ _ _ _ _ _ _ 10 ? _ _ _ _ _ _ _ _ </code></pre> <pre><code class="language-conllu"># visual-style 4 2 xcomp:subj color:blue 1 - - PUNCT interp PunctType=Hyph 7 punct _ _ 2 Rzadko rzadko ADV adv:pos Degree=Pos 4 xcomp:subj _ _ 3 nie nie PART part Polarity=Neg 4 advmod:neg _ _ 4 znaczy znaczyć VERB fin:sg:ter:imperf Aspect=Imp|Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin|Voice=Act 7 parataxis:obj _ _ 5 wcale wcale ADV adv _ 4 advmod:arg _ _ 6 - - PUNCT interp PunctType=Hyph 7 punct _ _ 7 ripostowali ripostować VERB praet:pl:m1:imperf Animacy=Hum|Aspect=Imp|Gender=Masc|Mood=Ind|Number=Plur|Tense=Past|VerbForm=Fin|Voice=Act 0 root _ _ 8 sędziowie sędzia NOUN subst:pl:nom:m1 Animacy=Hum|Case=Nom|Gender=Masc|Number=Plur 7 nsubj _ SpaceAfter=No 9 . . PUNCT interp PunctType=Peri 7 punct _ _ </code></pre> <pre><code class="language-conllu">1 - _ _ _ _ _ _ _ _ 2 Rarely _ _ _ _ _ _ _ _ 3 does _ _ _ _ _ _ _ _ 4 not _ _ _ _ _ _ _ _ 5 mean _ _ _ _ _ _ _ _ 6 at _ _ _ _ _ _ _ _ 7 all _ _ _ _ _ _ _ _ 8 - _ _ _ _ _ _ _ _ 9 the _ _ _ _ _ _ _ _ 10 judges _ _ _ _ _ _ _ _ 11 retorted _ _ _ _ _ _ _ _ 12 . _ _ _ _ _ _ _ _ </code></pre> <!-- Interlanguage links updated St lis 3 20:59:12 CET 2021 --> <!-- "in other languages" links --> <hr/> xcomp:subj in other languages: [<a href="../../pl/dep/xcomp-subj.html">pl</a>] </div> <!-- support for embedded visualizations --> <script type="text/javascript"> var root = '../../'; // filled in by jekyll head.js( // We assume that external libraries such as jquery.min.js have already been loaded outside! // (See _layouts/base.html.) // brat helper modules root + 'lib/brat/configuration.js', root + 'lib/brat/util.js', root + 'lib/brat/annotation_log.js', root + 'lib/ext/webfont.js', // brat modules root + 'lib/brat/dispatcher.js', root + 'lib/brat/url_monitor.js', root + 'lib/brat/visualizer.js', // embedding configuration root + 'lib/local/config.js', // project-specific collection data root + 'lib/local/collections.js', // Annodoc root + 'lib/annodoc/annodoc.js', // NOTE: non-local libraries 'https://spyysalo.github.io/conllu.js/conllu.js' ); var webFontURLs = [ // root + 'static/fonts/Astloch-Bold.ttf', root + 'static/fonts/PT_Sans-Caption-Web-Regular.ttf', root + 'static/fonts/Liberation_Sans-Regular.ttf' ]; var setupTimeago = function() { jQuery("time.timeago").timeago(); }; head.ready(function() { setupTimeago(); // mark current collection (filled in by Jekyll) Collections.listing['_current'] = 'pl'; // perform all embedding and support functions Annodoc.activate(Config.bratCollData, Collections.listing); }); </script> <!-- google analytics --> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-55233688-1', 'auto'); ga('send', 'pageview'); </script> <div id="footer"> <p class="footer-text">&copy; 2014–2021 <a href="http://universaldependencies.org/introduction.html#contributors" style="color:gray">Universal Dependencies contributors</a>. Site powered by <a href="http://spyysalo.github.io/annodoc" style="color:gray">Annodoc</a> and <a href="http://brat.nlplab.org/" style="color:gray">brat</a></p>. </div> </div> </body> </html>
UniversalDependencies/universaldependencies.github.io
pl/dep/xcomp-subj.html
HTML
apache-2.0
9,025
[ 30522, 1026, 999, 9986, 13874, 16129, 2270, 1000, 1011, 1013, 1013, 1059, 2509, 2278, 1013, 1013, 26718, 2094, 1060, 11039, 19968, 1015, 1012, 1014, 17459, 1013, 1013, 4372, 1000, 1000, 8299, 1024, 1013, 1013, 7479, 1012, 1059, 2509, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
from fruits import validate_fruit fruits = ["banana", "lemon", "apple", "orange", "batman"] print fruits def list_fruits(fruits, byName=True): if byName: # WARNING: this won't make a copy of the list and return it. It will change the list FOREVER fruits.sort() for index, fruit in enumerate(fruits): if validate_fruit(fruit): print "Fruit nr %d is %s" % (index, fruit) else: print "This %s is no fruit!" % (fruit) list_fruits(fruits) print fruits
Painatalman/python101
sources/101_test.py
Python
apache-2.0
519
[ 30522, 2013, 10962, 12324, 9398, 3686, 1035, 5909, 10962, 1027, 1031, 1000, 15212, 1000, 1010, 1000, 14380, 1000, 1010, 1000, 6207, 1000, 1010, 1000, 4589, 1000, 1010, 1000, 8942, 1000, 1033, 6140, 10962, 13366, 2862, 1035, 10962, 1006, 109...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/******************************************************************************* * Copyright (c) 2014 BSI Business Systems Integration AG. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * BSI Business Systems Integration AG - initial API and implementation ******************************************************************************/ package org.eclipsescout.rt.ui.fx.basic.chart.factory; import java.util.Collection; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.geometry.HPos; import javafx.geometry.Orientation; import javafx.geometry.Pos; import javafx.geometry.Side; import javafx.scene.Node; import javafx.scene.chart.Chart; import javafx.scene.control.CheckBox; import javafx.scene.control.ChoiceBox; import javafx.scene.control.Label; import javafx.scene.control.Separator; import javafx.scene.control.TextField; import javafx.scene.layout.ColumnConstraints; import javafx.scene.layout.GridPane; import javafx.scene.layout.HBox; import javafx.scene.layout.Pane; import javafx.scene.layout.Priority; import org.eclipse.scout.rt.shared.TEXTS; import org.eclipsescout.rt.ui.fx.FxStyleUtility; import org.eclipsescout.rt.ui.fx.IFxEnvironment; import org.eclipsescout.rt.ui.fx.basic.chart.FxScoutChartRowData; /** * */ public abstract class AbstractFxScoutChartFactory implements IFxScoutChartFactory { private Chart m_chart; private GridPane m_controlPanel; private int m_controlRowCount; private ObservableList<FxScoutChartRowData> m_data; private ObservableList<String> m_columnTitles; private ObservableList<String> m_categoryTitles; private IFxEnvironment m_fxEnvironment; private ChartProperties m_chartProperties; private boolean m_isInverse = false; public AbstractFxScoutChartFactory(ObservableList<FxScoutChartRowData> data, Collection<String> columns, ChartProperties chartProperties, IFxEnvironment fxEnvironment) { m_controlPanel = new GridPane(); m_data = FXCollections.observableArrayList(); m_data.addAll(data); m_columnTitles = FXCollections.observableArrayList(columns); m_categoryTitles = FXCollections.observableArrayList(); for (FxScoutChartRowData row : data) { m_categoryTitles.add(row.getRowName()); } m_chartProperties = chartProperties; m_fxEnvironment = fxEnvironment; } @Override public Chart getChart() { return m_chart; } public void setChart(Chart chart) { m_chart = chart; } @Override public Pane getControlPanel() { return m_controlPanel; } public ObservableList<FxScoutChartRowData> getData() { return m_data; } public ObservableList<String> getColumnTitles() { return m_columnTitles; } public ObservableList<String> getCategoryTitles() { return m_categoryTitles; } /** * Should be implemented by overwritten charts to build the appropriate chart. */ protected abstract void buildChart(); protected abstract void buildData(); @Override public void rebuildFromData(ObservableList<FxScoutChartRowData> data, Collection<String> columnTitles) { m_columnTitles.setAll(columnTitles); m_data.setAll(data); m_categoryTitles.clear(); for (FxScoutChartRowData row : data) { m_categoryTitles.add(row.getRowName()); } buildData(); } /** * Should be overwritten if additional functionality will be provided. A super call as the first operation is * mandatory. */ protected void buildControlPanel() { m_controlPanel = new GridPane(); m_controlPanel.setHgap(10); m_controlPanel.setVgap(5); FxStyleUtility.setPadding(m_controlPanel, 5); ColumnConstraints c1 = new ColumnConstraints(); c1.setHalignment(HPos.RIGHT); ColumnConstraints c2 = new ColumnConstraints(); c2.setHalignment(HPos.LEFT); m_controlPanel.getColumnConstraints().addAll(c1, c2); m_controlRowCount = 0; addSeparatorElement(TEXTS.get("GeneralControls")); // legend side ObservableList<Side> side = FXCollections.observableArrayList(Side.values()); ChoiceBox<Side> legendSide = new ChoiceBox<Side>(side); // legend visible CheckBox legendVisible = new CheckBox(); // title TextField title = new TextField(getChart().getTitle()); title.setPromptText("title"); // title side ChoiceBox<Side> titleSide = new ChoiceBox<Side>(side); if (getChartProperties() != null) { getChartProperties().bindToSettings(getChartProperties().legendSideProperty, getChart().legendSideProperty(), legendSide.valueProperty()); getChartProperties().bindToSettings(getChartProperties().legendVisibleProperty, getChart().legendVisibleProperty(), legendVisible.selectedProperty()); getChartProperties().bindToSettings(getChartProperties().titleSideProperty, getChart().titleSideProperty(), titleSide.valueProperty()); getChartProperties().bindToSettings(getChartProperties().titleProperty, getChart().titleProperty(), title.textProperty()); } else { legendSide.setValue(getChart().getLegendSide()); getChart().legendSideProperty().bind(legendSide.valueProperty()); legendVisible.setSelected(getChart().isLegendVisible()); getChart().legendVisibleProperty().bind(legendVisible.selectedProperty()); titleSide.setValue(getChart().getTitleSide()); getChart().titleSideProperty().bind(titleSide.valueProperty()); title.setText(getChart().getTitle()); getChart().titleProperty().bind(title.textProperty()); } addControlElement(new Label(TEXTS.get("LegendSide")), legendSide); addControlElement(new Label(TEXTS.get("LegendVisible")), legendVisible); addControlElement(new Label(TEXTS.get("Title")), title); addControlElement(new Label(TEXTS.get("TitleSide")), titleSide); } protected void addControlElement(Node... n) { m_controlPanel.addRow(m_controlRowCount++, n); } protected void addSeparatorElement(String name) { Label label = new Label(" " + name + " "); Separator left = new Separator(Orientation.HORIZONTAL); HBox.setHgrow(left, Priority.ALWAYS); Separator right = new Separator(Orientation.HORIZONTAL); HBox.setHgrow(right, Priority.ALWAYS); HBox separator = new HBox(left, label, right); separator.setAlignment(Pos.CENTER); m_controlPanel.add(separator, 0, m_controlRowCount++, 3, 1); } @Override public ChartProperties getChartProperties() { return m_chartProperties; } public void inverseChart() { m_isInverse = !m_isInverse; } public boolean isInverse() { return m_isInverse; } }
jmini/org.eclipsescout.rt.ui.fx
org.eclipsescout.rt.ui.fx/src/org/eclipsescout/rt/ui/fx/basic/chart/factory/AbstractFxScoutChartFactory.java
Java
epl-1.0
6,789
[ 30522, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#!/usr/local/bin/dumb-init /bin/bash set -euo pipefail [ 'true' = "${DEBUG:-}" ] && set -x base=$PWD VERSION=$(cat "$base"/version/number) if [ -z "${VERSION:-}" ]; then echo "missing version number" exit 1 fi cp "$base"/on-demand-service-broker-release/on-demand-service-broker-*.tgz "$base"/mongodb-on-demand-release/tile/resources cp "$base"/syslog-migration-release/syslog-migration-*.tgz "$base"/mongodb-on-demand-release/tile/resources cp "$base"/pcf-mongodb-helpers/pcf-mongodb-helpers-*.tgz "$base"/mongodb-on-demand-release/tile/resources cp "$base"/bpm-release/bpm-release-*.tgz "$base"/mongodb-on-demand-release/tile/resources ( cd mongodb-on-demand-release tarball_path="$base/mongodb-on-demand-release/tile/resources/mongodb-${VERSION}.tgz" mkdir -p "$(dirname "$tarball_path")" bosh -n create-release --sha2 --tarball="$tarball_path" --version="${VERSION}" ) ( cd mongodb-on-demand-release/tile yq w -i tile.yml packages.[4].path "$(ls resources/mongodb-*.tgz)" yq w -i tile.yml packages.[4].jobs[0].properties.service_deployment.releases[0].version "${VERSION}" yq w -i tile.yml runtime_configs[0].runtime_config.releases[0].version "${VERSION}" tile build "${VERSION}" ) cp "$base"/mongodb-on-demand-release/tile/product/mongodb-on-demand-*.pivotal "$base"/release TILE_FILE=`cd release; ls *-${VERSION}.pivotal` if [ -z "${TILE_FILE}" ]; then echo "No files matching release/*.pivotal" ls -lR release exit 1 fi SHA256=$(sha256sum release/"$TILE_FILE" | cut -d ' ' -f 1) cat > "$base"/release/notification <<EOF <!here> New build v${VERSION} released! You can download build at https://s3.amazonaws.com/${RELEASE_BUCKET_NAME}/${TILE_FILE} Build SHA256: ${SHA256} EOF
Altoros/mongodb-on-demand-release
ci/tasks/shipit/run.sh
Shell
apache-2.0
1,699
[ 30522, 1001, 999, 1013, 2149, 2099, 1013, 2334, 1013, 8026, 1013, 12873, 1011, 1999, 4183, 1013, 8026, 1013, 24234, 2275, 1011, 7327, 2080, 8667, 7011, 4014, 1031, 1005, 2995, 1005, 1027, 1000, 1002, 1063, 2139, 8569, 2290, 1024, 1011, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
############################## Handle IRQ ############################# HAVE_UART = y ############################## TOOLS ############################# CROSS_COMPILE ?=mips-linux-gnu- CC = $(CROSS_COMPILE)gcc LD = $(CROSS_COMPILE)ld OBJCOPY = $(CROSS_COMPILE)objcopy drop-sections := .reginfo .mdebug .oomment .note .pdr .options .MIPS.options strip-flags := $(addprefix --remove-section=,$(drop-sections)) HEX_CFLAGS += -Iinclude HEX_CFLAGS += -nostdinc -Wall -Wundef -Werror-implicit-function-declaration \ -fno-common -EL -Os -march=mips32 -mabi=32 -G 0 -mno-abicalls -fno-pic HEX_CFLAGS += -DINTERFACE_NEMC HEX_LDFLAGS := -nostdlib -EL -T target.ld HEX_OBJCOPY_ARGS := -O elf32-tradlittlemips HEX_NAME := firmware_uart.hex OBJS := src/start.o \ src/delay.o \ src/main.o \ src/mcu_ops.o \ src/gpio.o \ ifeq ($(HAVE_UART), y) OBJS += src/uart.o HEX_CFLAGS += -DHANDLE_UART endif all: firmware.bin @hexdump -v -e '"0x" 1/4 "%08x" "," "\n"' $< > $(HEX_NAME) firmware.bin:firmware.o @$(LD) -nostdlib -EL -T target.ld $(OBJS) -Map tmp.map -o tmp.elf @$(OBJCOPY) $(strip-flags) $(HEX_OBJCOPY_ARGS) -O binary tmp.elf $@ firmware.o : $(OBJS) %.o:%.c $(CC) $(HEX_CFLAGS) -o $@ -c $^ %.o:%.S $(CC) $(HEX_CFLAGS) -o $@ -c $^ clean: @find . -name "*.o" | xargs rm -vf @find . -name "*.o.cmd" | xargs rm -vf @find . -name "*.hex" | xargs rm -vf @find . -name "*.bin" | xargs rm -vf @rm -vf tmp.map tmp.elf
IngenicSemiconductor/kernel-inwatch
drivers/dma/jzdma/common_firmware/Makefile
Makefile
gpl-2.0
1,443
[ 30522, 1001, 1001, 1001, 1001, 1001, 1001, 1001, 1001, 1001, 1001, 1001, 1001, 1001, 1001, 1001, 1001, 1001, 1001, 1001, 1001, 1001, 1001, 1001, 1001, 1001, 1001, 1001, 1001, 1001, 1001, 5047, 20868, 4160, 1001, 1001, 1001, 1001, 1001, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2013, André Paramés <git@andreparames.com> # Based on the Git module by Michael DeHaan <michael.dehaan@gmail.com> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ansible is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Ansible. If not, see <http://www.gnu.org/licenses/>. ANSIBLE_METADATA = {'status': ['preview'], 'supported_by': 'community', 'version': '1.0'} DOCUMENTATION = u''' --- module: bzr author: "André Paramés (@andreparames)" version_added: "1.1" short_description: Deploy software (or files) from bzr branches description: - Manage I(bzr) branches to deploy files or software. options: name: required: true aliases: [ 'parent' ] description: - SSH or HTTP protocol address of the parent branch. dest: required: true description: - Absolute path of where the branch should be cloned to. version: required: false default: "head" description: - What version of the branch to clone. This can be the bzr revno or revid. force: required: false default: "no" choices: [ 'yes', 'no' ] description: - If C(yes), any modified files in the working tree will be discarded. Before 1.9 the default value was "yes". executable: required: false default: null version_added: "1.4" description: - Path to bzr executable to use. If not supplied, the normal mechanism for resolving binary paths will be used. ''' EXAMPLES = ''' # Example bzr checkout from Ansible Playbooks - bzr: name: 'bzr+ssh://foosball.example.org/path/to/branch' dest: /srv/checkout version: 22 ''' import re class Bzr(object): def __init__(self, module, parent, dest, version, bzr_path): self.module = module self.parent = parent self.dest = dest self.version = version self.bzr_path = bzr_path def _command(self, args_list, cwd=None, **kwargs): (rc, out, err) = self.module.run_command([self.bzr_path] + args_list, cwd=cwd, **kwargs) return (rc, out, err) def get_version(self): '''samples the version of the bzr branch''' cmd = "%s revno" % self.bzr_path rc, stdout, stderr = self.module.run_command(cmd, cwd=self.dest) revno = stdout.strip() return revno def clone(self): '''makes a new bzr branch if it does not already exist''' dest_dirname = os.path.dirname(self.dest) try: os.makedirs(dest_dirname) except: pass if self.version.lower() != 'head': args_list = ["branch", "-r", self.version, self.parent, self.dest] else: args_list = ["branch", self.parent, self.dest] return self._command(args_list, check_rc=True, cwd=dest_dirname) def has_local_mods(self): cmd = "%s status -S" % self.bzr_path rc, stdout, stderr = self.module.run_command(cmd, cwd=self.dest) lines = stdout.splitlines() lines = filter(lambda c: not re.search('^\\?\\?.*$', c), lines) return len(lines) > 0 def reset(self, force): ''' Resets the index and working tree to head. Discards any changes to tracked files in the working tree since that commit. ''' if not force and self.has_local_mods(): self.module.fail_json(msg="Local modifications exist in branch (force=no).") return self._command(["revert"], check_rc=True, cwd=self.dest) def fetch(self): '''updates branch from remote sources''' if self.version.lower() != 'head': (rc, out, err) = self._command(["pull", "-r", self.version], cwd=self.dest) else: (rc, out, err) = self._command(["pull"], cwd=self.dest) if rc != 0: self.module.fail_json(msg="Failed to pull") return (rc, out, err) def switch_version(self): '''once pulled, switch to a particular revno or revid''' if self.version.lower() != 'head': args_list = ["revert", "-r", self.version] else: args_list = ["revert"] return self._command(args_list, check_rc=True, cwd=self.dest) # =========================================== def main(): module = AnsibleModule( argument_spec = dict( dest=dict(required=True, type='path'), name=dict(required=True, aliases=['parent']), version=dict(default='head'), force=dict(default='no', type='bool'), executable=dict(default=None), ) ) dest = module.params['dest'] parent = module.params['name'] version = module.params['version'] force = module.params['force'] bzr_path = module.params['executable'] or module.get_bin_path('bzr', True) bzrconfig = os.path.join(dest, '.bzr', 'branch', 'branch.conf') rc, out, err, status = (0, None, None, None) bzr = Bzr(module, parent, dest, version, bzr_path) # if there is no bzr configuration, do a branch operation # else pull and switch the version before = None local_mods = False if not os.path.exists(bzrconfig): (rc, out, err) = bzr.clone() else: # else do a pull local_mods = bzr.has_local_mods() before = bzr.get_version() (rc, out, err) = bzr.reset(force) if rc != 0: module.fail_json(msg=err) (rc, out, err) = bzr.fetch() if rc != 0: module.fail_json(msg=err) # switch to version specified regardless of whether # we cloned or pulled (rc, out, err) = bzr.switch_version() # determine if we changed anything after = bzr.get_version() changed = False if before != after or local_mods: changed = True module.exit_json(changed=changed, before=before, after=after) # import module snippets from ansible.module_utils.basic import * if __name__ == '__main__': main()
Rajeshkumar90/ansible-modules-extras
source_control/bzr.py
Python
gpl-3.0
6,658
[ 30522, 1001, 999, 1013, 2149, 2099, 1013, 8026, 1013, 18750, 1001, 1011, 1008, 1011, 16861, 1024, 21183, 2546, 1011, 1022, 1011, 1008, 1011, 1001, 1006, 1039, 1007, 2286, 1010, 7213, 11498, 7834, 1026, 21025, 2102, 1030, 7213, 28689, 7834, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/******************************************************************************* * This file is part of OpenNMS(R). * * Copyright (C) 2017-2017 The OpenNMS Group, Inc. * OpenNMS(R) is Copyright (C) 1999-2017 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * * OpenNMS(R) is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, * or (at your option) any later version. * * OpenNMS(R) is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with OpenNMS(R). If not, see: * http://www.gnu.org/licenses/ * * For more information contact: * OpenNMS(R) Licensing <license@opennms.org> * http://www.opennms.org/ * http://www.opennms.com/ *******************************************************************************/ package org.opennms.reporting.availability; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlValue; /** * Class Created. * * @version $Revision$ $Date$ */ @XmlRootElement(name = "created") @XmlAccessorType(XmlAccessType.FIELD) public class Created implements java.io.Serializable { private static final long serialVersionUID = 1L; /** * internal content storage */ @XmlValue private java.math.BigDecimal _content; @XmlAttribute(name = "year", required = true) private Integer year; @XmlAttribute(name = "month", required = true) private String month; @XmlAttribute(name = "day", required = true) private Integer day; @XmlAttribute(name = "hour", required = true) private Integer hour; @XmlAttribute(name = "min", required = true) private Integer min; @XmlAttribute(name = "sec", required = true) private Integer sec; @XmlAttribute(name = "period", required = true) private String period; public Created() { } /** */ public void deleteDay() { this.day= null; } /** */ public void deleteHour() { this.hour= null; } /** */ public void deleteMin() { this.min= null; } /** */ public void deleteSec() { this.sec= null; } /** */ public void deleteYear() { this.year= null; } /** * Returns the value of field 'content'. The field 'content' has the following * description: internal content storage * * @return the value of field 'Content'. */ public java.math.BigDecimal getContent() { return this._content; } /** * Returns the value of field 'day'. * * @return the value of field 'Day'. */ public Integer getDay() { return this.day; } /** * Returns the value of field 'hour'. * * @return the value of field 'Hour'. */ public Integer getHour() { return this.hour; } /** * Returns the value of field 'min'. * * @return the value of field 'Min'. */ public Integer getMin() { return this.min; } /** * Returns the value of field 'month'. * * @return the value of field 'Month'. */ public String getMonth() { return this.month; } /** * Returns the value of field 'period'. * * @return the value of field 'Period'. */ public String getPeriod() { return this.period; } /** * Returns the value of field 'sec'. * * @return the value of field 'Sec'. */ public Integer getSec() { return this.sec; } /** * Returns the value of field 'year'. * * @return the value of field 'Year'. */ public Integer getYear() { return this.year; } /** * Method hasDay. * * @return true if at least one Day has been added */ public boolean hasDay() { return this.day != null; } /** * Method hasHour. * * @return true if at least one Hour has been added */ public boolean hasHour() { return this.hour != null; } /** * Method hasMin. * * @return true if at least one Min has been added */ public boolean hasMin() { return this.min != null; } /** * Method hasSec. * * @return true if at least one Sec has been added */ public boolean hasSec() { return this.sec != null; } /** * Method hasYear. * * @return true if at least one Year has been added */ public boolean hasYear() { return this.year != null; } /** * Sets the value of field 'content'. The field 'content' has the following * description: internal content storage * * @param content the value of field 'content'. */ public void setContent(final java.math.BigDecimal content) { this._content = content; } /** * Sets the value of field 'day'. * * @param day the value of field 'day'. */ public void setDay(final Integer day) { this.day = day; } /** * Sets the value of field 'hour'. * * @param hour the value of field 'hour'. */ public void setHour(final Integer hour) { this.hour = hour; } /** * Sets the value of field 'min'. * * @param min the value of field 'min'. */ public void setMin(final Integer min) { this.min = min; } /** * Sets the value of field 'month'. * * @param month the value of field 'month'. */ public void setMonth(final String month) { this.month = month; } /** * Sets the value of field 'period'. * * @param period the value of field 'period'. */ public void setPeriod(final String period) { this.period = period; } /** * Sets the value of field 'sec'. * * @param sec the value of field 'sec'. */ public void setSec(final Integer sec) { this.sec = sec; } /** * Sets the value of field 'year'. * * @param year the value of field 'year'. */ public void setYear(final Integer year) { this.year = year; } }
jeffgdotorg/opennms
features/reporting/availability/src/main/java/org/opennms/reporting/availability/Created.java
Java
gpl-2.0
6,768
[ 30522, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...