code
stringlengths
3
1.05M
repo_name
stringlengths
4
116
path
stringlengths
3
942
language
stringclasses
30 values
license
stringclasses
15 values
size
int32
3
1.05M
var searchData= [ ['a',['a',['../structRREP.html#abe45cd7d5c14dc356ecab531b2176242',1,'RREP']]], ['ack_5ftimer',['ack_timer',['../structrt__table.html#a4b5c6baab186ae8733b48cf2d5172852',1,'rt_table']]], ['active',['active',['../classNA__NesgLog.html#a0ce1b63fe991dc4304cb30d703aadcd6',1,'NA_NesgLog']]], ['active_5froute_5ftimeout',['active_route_timeout',['../classNA__AODVUU.html#ae7108fca58788a241d1319cde34a7dde',1,'NA_AODVUU::active_route_timeout()'],['../main_8c.html#a1b01d3369a884952b1b133647b6f8972',1,'active_route_timeout(): main.c'],['../NA__nl_8c.html#a1b01d3369a884952b1b133647b6f8972',1,'active_route_timeout(): main.c']]], ['aodvnl',['aodvnl',['../NA__nl_8c.html#a1932512e3a0f6559a876627efde22cff',1,'NA_nl.c']]], ['aodvrttablemap',['aodvRtTableMap',['../classNA__AODVUU.html#ae0d6f9d77438a52f9c571a77e2151a48',1,'NA_AODVUU']]], ['aodvtimermap',['aodvTimerMap',['../classNA__AODVUU.html#ab1245e4e87b93a0416f42606da162489',1,'NA_AODVUU']]], ['attacktype',['attackType',['../classNA__Attack.html#ac4cf8ddfd1c47f348f057f49382f5323',1,'NA_Attack']]], ['avhopcount',['avHopCount',['../classNA__UDPBasicBurst.html#a8c9180eebb4ba6a44ab2ca3bc5052426',1,'NA_UDPBasicBurst']]] ];
robertomagan/neta_v1
doc/doxy/search/variables_61.js
JavaScript
gpl-3.0
1,214
ο»Ώ/* This file is part of My Nes * * A Nintendo Entertainment System / Family Computer (Nes/Famicom) * Emulator written in C#. * * Copyright Β© Ala Ibrahim Hadid 2009 - 2014 * * 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 3 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, see <http://www.gnu.org/licenses/>. */ namespace MyNes.Core { class VRC6PulseSoundChannel { private int dutyForm; private int dutyStep; private bool enabled = true; private bool mode = false; public byte output; private byte volume; private int freqTimer; private int frequency; private int cycles; public void HardReset() { dutyForm = 0; dutyStep = 0xF; enabled = true; mode = false; output = 0; } public void Write0(ref byte data) { mode = (data & 0x80) == 0x80; dutyForm = ((data & 0x70) >> 4); volume = (byte)(data & 0xF); } public void Write1(ref byte data) { frequency = (frequency & 0x0F00) | data; } public void Write2(ref byte data) { frequency = (frequency & 0x00FF) | ((data & 0xF) << 8); enabled = (data & 0x80) == 0x80; } public void ClockSingle() { if (--cycles <= 0) { cycles = (frequency << 1) + 2; if (enabled) { if (mode) output = volume; else { dutyStep--; if (dutyStep < 0) dutyStep = 0xF; if (dutyStep <= dutyForm) output = volume; else output = 0; } } else output = 0; } } /// <summary> /// Save state /// </summary> /// <param name="stream">The stream that should be used to write data</param> public void SaveState(System.IO.BinaryWriter stream) { stream.Write(dutyForm); stream.Write(dutyStep); stream.Write(enabled); stream.Write(mode); stream.Write(output); stream.Write(volume); stream.Write(freqTimer); stream.Write(frequency); stream.Write(cycles); } /// <summary> /// Load state /// </summary> /// <param name="stream">The stream that should be used to read data</param> public void LoadState(System.IO.BinaryReader stream) { dutyForm = stream.ReadInt32(); dutyStep = stream.ReadInt32(); enabled = stream.ReadBoolean(); mode = stream.ReadBoolean(); output = stream.ReadByte(); volume = stream.ReadByte(); freqTimer = stream.ReadInt32(); frequency = stream.ReadInt32(); cycles = stream.ReadInt32(); } } }
MetaFight/Mayonnaise
Core/ExternalSoundChannels/VRC6PulseSoundChannel.cs
C#
gpl-3.0
3,837
# - Find the OpenGL Extension Wrangler Library (GLEW) # This module defines the following variables: # GLEW_INCLUDE_DIRS - include directories for GLEW # GLEW_LIBRARIES - libraries to link against GLEW # GLEW_FOUND - true if GLEW has been found and can be used #============================================================================= # Copyright 2012 Benjamin Eikel # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. # # This software is distributed WITHOUT ANY WARRANTY; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) find_path(GLEW_INCLUDE_DIR GL/glew.h) find_library(GLEW_LIBRARY NAMES GLEW glew32 glew glew32s PATH_SUFFIXES lib64) set(GLEW_INCLUDE_DIRS ${GLEW_INCLUDE_DIR}) set(GLEW_LIBRARIES ${GLEW_LIBRARY}) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(GLEW GLEW_INCLUDE_DIR GLEW_LIBRARY) mark_as_advanced(GLEW_INCLUDE_DIR GLEW_LIBRARY)
cchampet/TuttleOFX
cmake/FindGLEW.cmake
CMake
gpl-3.0
1,224
/* * Neon, a roguelike engine. * Copyright (C) 2017-2018 - Maarten Driesen * * 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 3 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, see <http://www.gnu.org/licenses/>. */ package neon.editor.ui; import java.io.IOException; import java.util.logging.Logger; import com.google.common.eventbus.EventBus; import com.google.common.eventbus.Subscribe; import javafx.fxml.FXMLLoader; import javafx.scene.Scene; import javafx.stage.Stage; import javafx.stage.Window; import neon.common.files.NeonFileSystem; import neon.common.resources.ResourceManager; import neon.editor.LoadEvent; import neon.editor.controllers.CreatureHandler; import neon.editor.controllers.ItemHandler; import neon.editor.controllers.MapHandler; import neon.editor.controllers.MenuHandler; import neon.editor.controllers.TerrainHandler; import neon.editor.resource.CEditor; /** * The {@code UserInterface} takes care of most ui-related editor functionality. * * @author mdriesen * */ public final class UserInterface { private static final Logger logger = Logger.getGlobal(); private final CreatureHandler creatureHandler; private final MapHandler mapHandler; private final MenuHandler menuHandler; private final ItemHandler itemHandler; private final TerrainHandler terrainHandler; private Stage stage; private Scene scene; /** * Initializes the {@code UserInterface}. * * @param files * @param resources * @param bus * @param config */ public UserInterface(NeonFileSystem files, ResourceManager resources, EventBus bus, CEditor config) { // separate handlers for all the different ui elements menuHandler = new MenuHandler(resources, bus, this); bus.register(menuHandler); mapHandler = new MapHandler(resources, bus, config); bus.register(mapHandler); creatureHandler = new CreatureHandler(resources, bus); bus.register(creatureHandler); itemHandler = new ItemHandler(resources, bus); bus.register(itemHandler); terrainHandler = new TerrainHandler(resources, bus); bus.register(terrainHandler); // load the user interface FXMLLoader loader = new FXMLLoader(getClass().getResource("Editor.fxml")); loader.setControllerFactory(this::getController); try { scene = new Scene(loader.load()); scene.getStylesheets().add(getClass().getResource("editor.css").toExternalForm()); } catch (IOException e) { logger.severe("failed to load editor ui: " + e.getMessage()); } } /** * Returns the correct controller for a JavaFX node. * * @param type * @return */ private Object getController(Class<?> type) { if(type.equals(MenuHandler.class)) { return menuHandler; } else if (type.equals(MapHandler.class)) { return mapHandler; } else if (type.equals(CreatureHandler.class)) { return creatureHandler; } else if (type.equals(ItemHandler.class)) { return itemHandler; } else if (type.equals(TerrainHandler.class)) { return terrainHandler; } else { throw new IllegalArgumentException("No controller found for class " + type + "!"); } } /** * * @return the main window of the editor */ public Window getWindow() { return stage; } /** * Shows the main window on screen. * * @param stage */ public void start(Stage stage) { this.stage = stage; stage.setTitle("The Neon Roguelike Editor"); stage.setScene(scene); stage.setWidth(1440); stage.setMinWidth(800); stage.setHeight(720); stage.setMinHeight(600); stage.show(); stage.centerOnScreen(); stage.setOnCloseRequest(event -> System.exit(0)); } /** * Sets the title of the main window. * * @param event */ @Subscribe private void onModuleLoad(LoadEvent event) { stage.setTitle("The Neon Roguelike Editor - " + event.id); } /** * Checks if any resources are still opened and should be saved. This * method should be called when saving a module or exiting the editor. */ public void saveResources() { // check if any maps are still opened mapHandler.saveMaps(); } }
kosmonet/neon
src/neon/editor/ui/UserInterface.java
Java
gpl-3.0
4,700
// This file has been generated by the GUI designer. Do not modify. public partial class WinCryptoSec2Config { private global::Gtk.VBox vbox2; private global::Gtk.Button btnDatabase; private global::Gtk.Button btnFtp; private global::Gtk.Button btnString; private global::Gtk.Button btnXml; private global::Gtk.Button btnCancel; protected virtual void Build () { global::Stetic.Gui.Initialize (this); // Widget WinCryptoSec2Config this.Name = "WinCryptoSec2Config"; this.Title = global::Mono.Unix.Catalog.GetString ("InCrtyptoSec2 Modes"); this.Icon = global::Gdk.Pixbuf.LoadFromResource ("InGtkCryptoSec2.icons.keys_16x16.png"); this.WindowPosition = ((global::Gtk.WindowPosition)(4)); this.Modal = true; // Internal child WinCryptoSec2Config.VBox global::Gtk.VBox w1 = this.VBox; w1.Name = "dialog1_VBox"; w1.BorderWidth = ((uint)(2)); // Container child dialog1_VBox.Gtk.Box+BoxChild this.vbox2 = new global::Gtk.VBox (); this.vbox2.Name = "vbox2"; this.vbox2.Spacing = 10; this.vbox2.BorderWidth = ((uint)(5)); // Container child vbox2.Gtk.Box+BoxChild this.btnDatabase = new global::Gtk.Button (); this.btnDatabase.TooltipMarkup = "InCryptoSec2 module for Database security."; this.btnDatabase.CanFocus = true; this.btnDatabase.Name = "btnDatabase"; this.btnDatabase.UseUnderline = true; this.btnDatabase.Label = global::Mono.Unix.Catalog.GetString ("Database"); global::Gtk.Image w2 = new global::Gtk.Image (); w2.Pixbuf = global::Gdk.Pixbuf.LoadFromResource ("InGtkCryptoSec2.icons.database1_32x32.png"); this.btnDatabase.Image = w2; this.vbox2.Add (this.btnDatabase); global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.btnDatabase])); w3.Position = 0; w3.Expand = false; w3.Fill = false; // Container child vbox2.Gtk.Box+BoxChild this.btnFtp = new global::Gtk.Button (); this.btnFtp.TooltipMarkup = "InCryptoSec2 module for FTP security."; this.btnFtp.CanFocus = true; this.btnFtp.Name = "btnFtp"; this.btnFtp.UseUnderline = true; this.btnFtp.Label = global::Mono.Unix.Catalog.GetString ("FTP"); global::Gtk.Image w4 = new global::Gtk.Image (); w4.Pixbuf = global::Gdk.Pixbuf.LoadFromResource ("InGtkCryptoSec2.icons.server_client_32x32.png"); this.btnFtp.Image = w4; this.vbox2.Add (this.btnFtp); global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.btnFtp])); w5.Position = 1; w5.Expand = false; w5.Fill = false; // Container child vbox2.Gtk.Box+BoxChild this.btnString = new global::Gtk.Button (); this.btnString.TooltipMarkup = "InCryptoSec2 module for String security."; this.btnString.CanFocus = true; this.btnString.Name = "btnString"; this.btnString.UseUnderline = true; this.btnString.Label = global::Mono.Unix.Catalog.GetString ("String"); global::Gtk.Image w6 = new global::Gtk.Image (); w6.Pixbuf = global::Gdk.Pixbuf.LoadFromResource ("InGtkCryptoSec2.icons.text_32x32.png"); this.btnString.Image = w6; this.vbox2.Add (this.btnString); global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.btnString])); w7.Position = 2; w7.Expand = false; w7.Fill = false; // Container child vbox2.Gtk.Box+BoxChild this.btnXml = new global::Gtk.Button (); this.btnXml.TooltipMarkup = "InCryptoSec2 module for XML security."; this.btnXml.CanFocus = true; this.btnXml.Name = "btnXml"; this.btnXml.UseUnderline = true; this.btnXml.Label = global::Mono.Unix.Catalog.GetString ("XML"); global::Gtk.Image w8 = new global::Gtk.Image (); w8.Pixbuf = global::Gdk.Pixbuf.LoadFromResource ("InGtkCryptoSec2.icons.text_tree_32x32.png"); this.btnXml.Image = w8; this.vbox2.Add (this.btnXml); global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.btnXml])); w9.Position = 3; w9.Expand = false; w9.Fill = false; w1.Add (this.vbox2); global::Gtk.Box.BoxChild w10 = ((global::Gtk.Box.BoxChild)(w1 [this.vbox2])); w10.Position = 0; w10.Expand = false; w10.Fill = false; // Internal child WinCryptoSec2Config.ActionArea global::Gtk.HButtonBox w11 = this.ActionArea; w11.Name = "dialog1_Action"; w11.Spacing = 10; w11.BorderWidth = ((uint)(5)); w11.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4)); // Container child dialog1_Action.Gtk.ButtonBox+ButtonBoxChild this.btnCancel = new global::Gtk.Button (); this.btnCancel.CanDefault = true; this.btnCancel.CanFocus = true; this.btnCancel.Name = "btnCancel"; this.btnCancel.UseStock = true; this.btnCancel.UseUnderline = true; this.btnCancel.Label = "gtk-cancel"; this.AddActionWidget (this.btnCancel, -6); global::Gtk.ButtonBox.ButtonBoxChild w12 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w11 [this.btnCancel])); w12.Expand = false; w12.Fill = false; if ((this.Child != null)) { this.Child.ShowAll (); } this.DefaultWidth = 246; this.DefaultHeight = 276; this.Show (); this.btnDatabase.Clicked += new global::System.EventHandler (this.btnDatabase_OnClick); this.btnFtp.Clicked += new global::System.EventHandler (this.btnFtp_OnClick); this.btnString.Clicked += new global::System.EventHandler (this.btnString_OnClick); this.btnXml.Clicked += new global::System.EventHandler (this.btnXml_OnClick); } }
toncis/InCryptoSec2
InGtkCryptoSec2/gtk-gui/WinCryptoSec2Config.cs
C#
gpl-3.0
5,393
<?php use HebrewParseTrainer\Root; use HebrewParseTrainer\Stem; use HebrewParseTrainer\Tense; ?> @extends('layouts.with_sidebar') @section('sidebar') <form id="hebrewparsetrainer-settings"> <input type="hidden" id="csrf" value="{{ csrf_token() }}"/> <div class="form-group"> <h3>Stems</h3> @foreach (Stem::all() as $stem) <div class="checkbox"> <label><input class="reload-verb" type="checkbox" name="stem" value="{{{ $stem->name }}}" checked="checked"/> {{{ $stem->name }}}</label> </div> @endforeach </div> <div class="form-group"> <h3>Tenses</h3> @foreach (Tense::all() as $tense) <div class="checkbox"> <label><input class="reload-verb" type="checkbox" name="tense" value="{{{ $tense->name }}}" checked="checked"/> {{{ $tense->name }}}</label> </div> @endforeach </div> <div class="form-group"> <h3>Roots</h3> <select name="root" class="reload-verb form-control hebrew ltr" multiple="multiple"> @foreach (Root::orderBy('root_kind_id')->orderBy('root')->get() as $root) @if ($root->verbs()->where('active', 1)->count() > 0) <option value="{{{ $root->root }}}" selected="selected">{{{ $root->root }}} ({{{ $root->kind->name }}})</option> @endif @endforeach </select> </div> <div class="form-group"> <h3>Settings</h3> <div class="checkbox"> <label><input type="checkbox" id="settings-audio" checked="checked"/> Audio</label> </div> </div> </form> @endsection @section('content') <div id="trainer"> <div id="trainer-input-container"> <p class="bg-danger" id="trainer-404">There are no verbs matching the criteria in our database.</p> <p class="lead"><span class="hebrew hebrew-large" id="trainer-verb"></span><span id="trainer-answer"></span></p> </div> <div id="trainer-input-fancy"></div> <div class="text-muted"> <div> <!-- id="trainer-input-help" --> <p>Parse the verb and enter the answer as described below or using the buttons. Press return. If your answer was correct and there are multiple possible parsings, an extra input field will appear. After the first incorrect answer or after entering all possible answers, you can continue to the next verb by pressing return once more.</p> <p> <strong>Stems</strong>: either use the full name or a significant beginning (i.e. <code>Q</code> for Qal and <code>N</code>, <code>Pi</code>, <code>Pu</code>, <code>Hit</code>, <code>Hip</code>, and <code>Hop</code> for the derived stems).<br/> <strong>Tenses</strong>: use the abbreviations <code>pf</code>, <code>ipf</code>, <code>coh</code>, <code>imp</code>, <code>jus</code>, <code>infcs</code>, <code>infabs</code>, <code>ptc</code> and <code>ptcp</code>.<br/> <strong>Person</strong>: <code>1</code>, <code>2</code>, <code>3</code> or none (infinitives and participles).<br/> <strong>Gender</strong>: <code>m</code>, <code>f</code> or none (infinitives).<br/> <strong>Number</strong>: <code>s</code>, <code>p</code> or none (infinitives). </p> <p>Examples: <code>Q pf 3ms</code>, <code>ni ptc fp</code>, <code>pi infabs</code>.</p> <h5>Notes:</h5> <ul> <li>There is no 'common' gender. Instead, enter the masculine and feminine forms separately. The <code>N/A</code> option is for infinitives.</li> <li>The <code>ptcp</code> option is only for the passive participle of the qal. All other participles should be entered with <code>ptc</code> (including participles of the passive stems).</li> </ul> </div> <button type="button" class="btn btn-default btn-xs" id="show-hide-help">Show help</button> </div> </div> <hr/> <div class="row"> <div class="col-md-12"> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title">About</h3> </div> <div class="panel-body"> <p>&copy; 2015&ndash;{!! date('y') !!} <a href="https://camilstaps.nl">Camil Staps</a>. Licensed under <a href="http://www.gnu.org/licenses/gpl-3.0.en.html">GPL 3.0</a>. Source is on <a href="https://github.com/HebrewTools/ParseTrainer">GitHub</a>.</p> <p>Please report any mistakes to <a href="mailto:[email protected]">[email protected]</a>.</p> </div> </div> </div> </div> <script type="text/javascript"> var reload_on_load = true; </script> @endsection
camilstaps/HebrewParseTrainer
resources/views/trainer.blade.php
PHP
gpl-3.0
4,228
package net.minecraft.server; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; // CraftBukkit start import org.bukkit.craftbukkit.event.CraftEventFactory; import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.SpawnerSpawnEvent; // CraftBukkit end public abstract class MobSpawnerAbstract { public int spawnDelay = 20; private String mobName = "Pig"; private List mobs; private TileEntityMobSpawnerData spawnData; public double c; public double d; private int minSpawnDelay = 200; private int maxSpawnDelay = 800; private int spawnCount = 4; private Entity j; private int maxNearbyEntities = 6; private int requiredPlayerRange = 16; private int spawnRange = 4; public MobSpawnerAbstract() {} public String getMobName() { if (this.i() == null) { if (this.mobName.equals("Minecart")) { this.mobName = "MinecartRideable"; } return this.mobName; } else { return this.i().c; } } public void setMobName(String s) { this.mobName = s; } public boolean f() { return this.a().findNearbyPlayer((double) this.b() + 0.5D, (double) this.c() + 0.5D, (double) this.d() + 0.5D, (double) this.requiredPlayerRange) != null; } public void g() { if (this.f()) { double d0; if (this.a().isStatic) { double d1 = (double) ((float) this.b() + this.a().random.nextFloat()); double d2 = (double) ((float) this.c() + this.a().random.nextFloat()); d0 = (double) ((float) this.d() + this.a().random.nextFloat()); this.a().addParticle("smoke", d1, d2, d0, 0.0D, 0.0D, 0.0D); this.a().addParticle("flame", d1, d2, d0, 0.0D, 0.0D, 0.0D); if (this.spawnDelay > 0) { --this.spawnDelay; } this.d = this.c; this.c = (this.c + (double) (1000.0F / ((float) this.spawnDelay + 200.0F))) % 360.0D; } else { if (this.spawnDelay == -1) { this.j(); } if (this.spawnDelay > 0) { --this.spawnDelay; return; } boolean flag = false; for (int i = 0; i < this.spawnCount; ++i) { Entity entity = EntityTypes.createEntityByName(this.getMobName(), this.a()); if (entity == null) { return; } int j = this.a().a(entity.getClass(), AxisAlignedBB.a((double) this.b(), (double) this.c(), (double) this.d(), (double) (this.b() + 1), (double) (this.c() + 1), (double) (this.d() + 1)).grow((double) (this.spawnRange * 2), 4.0D, (double) (this.spawnRange * 2))).size(); if (j >= this.maxNearbyEntities) { this.j(); return; } d0 = (double) this.b() + (this.a().random.nextDouble() - this.a().random.nextDouble()) * (double) this.spawnRange; double d3 = (double) (this.c() + this.a().random.nextInt(3) - 1); double d4 = (double) this.d() + (this.a().random.nextDouble() - this.a().random.nextDouble()) * (double) this.spawnRange; EntityInsentient entityinsentient = entity instanceof EntityInsentient ? (EntityInsentient) entity : null; entity.setPositionRotation(d0, d3, d4, this.a().random.nextFloat() * 360.0F, 0.0F); if (entityinsentient == null || entityinsentient.canSpawn()) { this.a(entity); this.a().triggerEffect(2004, this.b(), this.c(), this.d(), 0); if (entityinsentient != null) { entityinsentient.s(); } flag = true; } } if (flag) { this.j(); } } } } public Entity a(Entity entity) { if (this.i() != null) { NBTTagCompound nbttagcompound = new NBTTagCompound(); entity.d(nbttagcompound); Iterator iterator = this.i().b.c().iterator(); while (iterator.hasNext()) { String s = (String) iterator.next(); NBTBase nbtbase = this.i().b.get(s); nbttagcompound.set(s, nbtbase.clone()); } entity.f(nbttagcompound); if (entity.world != null) { // CraftBukkit start - call SpawnerSpawnEvent, abort if cancelled SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b(), this.c(), this.d()); if (!event.isCancelled()) { entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit // Spigot Start if ( entity.world.spigotConfig.nerfSpawnerMobs ) { entity.fromMobSpawner = true; } // Spigot End } // CraftBukkit end } NBTTagCompound nbttagcompound1; for (Entity entity1 = entity; nbttagcompound.hasKeyOfType("Riding", 10); nbttagcompound = nbttagcompound1) { nbttagcompound1 = nbttagcompound.getCompound("Riding"); Entity entity2 = EntityTypes.createEntityByName(nbttagcompound1.getString("id"), entity.world); if (entity2 != null) { NBTTagCompound nbttagcompound2 = new NBTTagCompound(); entity2.d(nbttagcompound2); Iterator iterator1 = nbttagcompound1.c().iterator(); while (iterator1.hasNext()) { String s1 = (String) iterator1.next(); NBTBase nbtbase1 = nbttagcompound1.get(s1); nbttagcompound2.set(s1, nbtbase1.clone()); } entity2.f(nbttagcompound2); entity2.setPositionRotation(entity1.locX, entity1.locY, entity1.locZ, entity1.yaw, entity1.pitch); // CraftBukkit start - call SpawnerSpawnEvent, skip if cancelled SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity2, this.b(), this.c(), this.d()); if (event.isCancelled()) { continue; } if (entity.world != null) { entity.world.addEntity(entity2, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit } entity1.mount(entity2); } entity1 = entity2; } } else if (entity instanceof EntityLiving && entity.world != null) { ((EntityInsentient) entity).prepare((GroupDataEntity) null); // Spigot start - call SpawnerSpawnEvent, abort if cancelled SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b(), this.c(), this.d()); if (!event.isCancelled()) { this.a().addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit // Spigot Start if ( entity.world.spigotConfig.nerfSpawnerMobs ) { entity.fromMobSpawner = true; } // Spigot End } // Spigot end } return entity; } private void j() { if (this.maxSpawnDelay <= this.minSpawnDelay) { this.spawnDelay = this.minSpawnDelay; } else { int i = this.maxSpawnDelay - this.minSpawnDelay; this.spawnDelay = this.minSpawnDelay + this.a().random.nextInt(i); } if (this.mobs != null && this.mobs.size() > 0) { this.a((TileEntityMobSpawnerData) WeightedRandom.a(this.a().random, (Collection) this.mobs)); } this.a(1); } public void a(NBTTagCompound nbttagcompound) { this.mobName = nbttagcompound.getString("EntityId"); this.spawnDelay = nbttagcompound.getShort("Delay"); if (nbttagcompound.hasKeyOfType("SpawnPotentials", 9)) { this.mobs = new ArrayList(); NBTTagList nbttaglist = nbttagcompound.getList("SpawnPotentials", 10); for (int i = 0; i < nbttaglist.size(); ++i) { this.mobs.add(new TileEntityMobSpawnerData(this, nbttaglist.get(i))); } } else { this.mobs = null; } if (nbttagcompound.hasKeyOfType("SpawnData", 10)) { this.a(new TileEntityMobSpawnerData(this, nbttagcompound.getCompound("SpawnData"), this.mobName)); } else { this.a((TileEntityMobSpawnerData) null); } if (nbttagcompound.hasKeyOfType("MinSpawnDelay", 99)) { this.minSpawnDelay = nbttagcompound.getShort("MinSpawnDelay"); this.maxSpawnDelay = nbttagcompound.getShort("MaxSpawnDelay"); this.spawnCount = nbttagcompound.getShort("SpawnCount"); } if (nbttagcompound.hasKeyOfType("MaxNearbyEntities", 99)) { this.maxNearbyEntities = nbttagcompound.getShort("MaxNearbyEntities"); this.requiredPlayerRange = nbttagcompound.getShort("RequiredPlayerRange"); } if (nbttagcompound.hasKeyOfType("SpawnRange", 99)) { this.spawnRange = nbttagcompound.getShort("SpawnRange"); } if (this.a() != null && this.a().isStatic) { this.j = null; } } public void b(NBTTagCompound nbttagcompound) { nbttagcompound.setString("EntityId", this.getMobName()); nbttagcompound.setShort("Delay", (short) this.spawnDelay); nbttagcompound.setShort("MinSpawnDelay", (short) this.minSpawnDelay); nbttagcompound.setShort("MaxSpawnDelay", (short) this.maxSpawnDelay); nbttagcompound.setShort("SpawnCount", (short) this.spawnCount); nbttagcompound.setShort("MaxNearbyEntities", (short) this.maxNearbyEntities); nbttagcompound.setShort("RequiredPlayerRange", (short) this.requiredPlayerRange); nbttagcompound.setShort("SpawnRange", (short) this.spawnRange); if (this.i() != null) { nbttagcompound.set("SpawnData", this.i().b.clone()); } if (this.i() != null || this.mobs != null && this.mobs.size() > 0) { NBTTagList nbttaglist = new NBTTagList(); if (this.mobs != null && this.mobs.size() > 0) { Iterator iterator = this.mobs.iterator(); while (iterator.hasNext()) { TileEntityMobSpawnerData tileentitymobspawnerdata = (TileEntityMobSpawnerData) iterator.next(); nbttaglist.add(tileentitymobspawnerdata.a()); } } else { nbttaglist.add(this.i().a()); } nbttagcompound.set("SpawnPotentials", nbttaglist); } } public boolean b(int i) { if (i == 1 && this.a().isStatic) { this.spawnDelay = this.minSpawnDelay; return true; } else { return false; } } public TileEntityMobSpawnerData i() { return this.spawnData; } public void a(TileEntityMobSpawnerData tileentitymobspawnerdata) { this.spawnData = tileentitymobspawnerdata; } public abstract void a(int i); public abstract World a(); public abstract int b(); public abstract int c(); public abstract int d(); }
pvginkel/Tweakkit-Server
src/main/java/net/minecraft/server/MobSpawnerAbstract.java
Java
gpl-3.0
11,945
/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2016-2021 hyStrath \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of hyStrath, a derivative work of OpenFOAM. OpenFOAM 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. OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class Foam::energyScalingFunction Description SourceFiles energyScalingFunction.C newEnergyScalingFunction.C \*---------------------------------------------------------------------------*/ #ifndef energyScalingFunction_H #define energyScalingFunction_H #include "IOdictionary.H" #include "typeInfo.H" #include "runTimeSelectionTables.H" #include "autoPtr.H" #include "pairPotentialModel.H" #include "reducedUnits.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { /*---------------------------------------------------------------------------*\ Class energyScalingFunction Declaration \*---------------------------------------------------------------------------*/ class energyScalingFunction { protected: // Protected data word name_; dictionary energyScalingFunctionProperties_; const pairPotentialModel& pairPot_; const reducedUnits& rU_; // Private Member Functions //- Disallow copy construct energyScalingFunction(const energyScalingFunction&); //- Disallow default bitwise assignment void operator=(const energyScalingFunction&); public: //- Runtime type information TypeName("energyScalingFunction"); // Declare run-time constructor selection table declareRunTimeSelectionTable ( autoPtr, energyScalingFunction, dictionary, ( const word& name, const dictionary& energyScalingFunctionProperties, const pairPotentialModel& pairPot, const reducedUnits& rU ), (name, energyScalingFunctionProperties, pairPot, rU) ); // Selectors //- Return a reference to the selected viscosity model static autoPtr<energyScalingFunction> New ( const word& name, const dictionary& energyScalingFunctionProperties, const pairPotentialModel& pairPot, const reducedUnits& rU ); // Constructors //- Construct from components energyScalingFunction ( const word& name, const dictionary& energyScalingFunctionProperties, const pairPotentialModel& pairPot, const reducedUnits& rU ); // Destructor virtual ~energyScalingFunction() {} // Member Functions virtual void scaleEnergy(scalar& e, const scalar r) const = 0; const dictionary& energyScalingFunctionProperties() const { return energyScalingFunctionProperties_; } //- Read energyScalingFunction dictionary virtual bool read ( const dictionary& energyScalingFunctionProperties ) = 0; }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif // ************************************************************************* //
vincentcasseau/hyStrath
src/lagrangian/molecularDynamics/polyCloud/potentials/energyScalingFunction/basic/energyScalingFunction.H
C++
gpl-3.0
4,236
#!/usr/bin/python3 ### rev: 5.0 ### author: <zhq> ### features: ### errors included ### up to 63 bases (2 to 64) ### caps recognition and same output format (deprecated) ### for the function parameters, `cur` represents the current (input) base, `res` represents the result (output) base, and `num` represents the current (input) number. def scale(cur, res, num): # int, int, str -> str # Default Settings num = str(num) iscaps = False positive = True # Input if cur == res: return num if num == "0": return "0" assert cur in range(2, 65) and res in range(2, 65), "Base not defined." if num[0] == "-": positive = False num = num[1:] result = 0 unit = 1 if cur != 10: for i in num[::-1]: value = ord(i) if value in range(48, 58): value -= 48 elif value in range(65, 92): value -= 55 elif value in range(97, 123): value -= 61 elif value == 64: value = 62 elif value == 95: value = 63 assert value <= cur, "Digit larger than original base. v:%d(%s) b:%d\nCall: scale(%d, %d, %s)" % (value, i, cur, cur, res, num) result += value * unit unit *= cur result = str(result) # Output if res != 10: num = int(result or num) result = "" while num > 0: num, value = divmod(num, res) if value < 10: digit = value + 48 elif value < 36: digit = value + 55 elif value < 62: digit = value + 61 elif value == 62: digit = 64 elif value == 63: digit = 95 result = chr(digit) + result if not positive: result = "-" + result return result
Irides-Chromium/cipher
scale_strict.py
Python
gpl-3.0
1,750
<?php /** * OpenEyes * * (C) Moorfields Eye Hospital NHS Foundation Trust, 2008-2011 * (C) OpenEyes Foundation, 2011-2012 * This file is part of OpenEyes. * OpenEyes 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. * OpenEyes 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 OpenEyes in a file titled COPYING. If not, see <http://www.gnu.org/licenses/>. * * @package OpenEyes * @link http://www.openeyes.org.uk * @author OpenEyes <[email protected]> * @copyright Copyright (c) 2008-2011, Moorfields Eye Hospital NHS Foundation Trust * @copyright Copyright (c) 2011-2012, OpenEyes Foundation * @license http://www.gnu.org/licenses/gpl-3.0.html The GNU General Public License V3.0 */ /** * This is the model class for table "family_history". * * The followings are the available columns in table 'family_history': * @property integer $id * @property string $name */ class FamilyHistory extends BaseActiveRecordVersioned { /** * Returns the static model of the specified AR class. * @return FamilyHistory the static model class */ public static function model($className=__CLASS__) { return parent::model($className); } /** * @return string the associated database table name */ public function tableName() { return 'family_history'; } /** * @return array validation rules for model attributes. */ public function rules() { // NOTE: you should only define rules for those attributes that // will receive user inputs. return array( array('patient_id, relative_id, side_id, condition_id, comments','safe'), array('patient_id, relative_id, side_id, condition_id','required'), // The following rule is used by search(). // Please remove those attributes that should not be searched. array('id, name', 'safe', 'on'=>'search'), ); } /** * @return array relational rules. */ public function relations() { // NOTE: you may need to adjust the relation name and the related // class name for the relations automatically generated below. return array( 'relative' => array(self::BELONGS_TO, 'FamilyHistoryRelative', 'relative_id'), 'side' => array(self::BELONGS_TO, 'FamilyHistorySide', 'side_id'), 'condition' => array(self::BELONGS_TO, 'FamilyHistoryCondition', 'condition_id'), ); } /** * @return array customized attribute labels (name=>label) */ public function attributeLabels() { return array( 'id' => 'ID', 'name' => 'Name', ); } /** * Retrieves a list of models based on the current search/filter conditions. * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions. */ public function search() { // Warning: Please modify the following code to remove attributes that // should not be searched. $criteria=new CDbCriteria; $criteria->compare('id',$this->id,true); $criteria->compare('name',$this->name,true); return new CActiveDataProvider(get_class($this), array( 'criteria'=>$criteria, )); } }
openeyeswales/OpenEyes
protected/models/FamilyHistory.php
PHP
gpl-3.0
3,430
ο»Ώusing UnityEngine; using System; using System.Collections; using System.Collections.Generic; // manager for the gondola spawning public class GondolaManager : MonoBehaviour { private static int N = 50; private static int DELAY = 4; private static float OFFSET = -1.8f; // the offet between the rope center and a gondola center private int count = 0; // the count of ropes in the scene private DateTime curr; // the current time for second counting use public GameObject rope; // the rope object public GameObject gondola;// the gondola object public GameObject currentRope; // the last rope spawned public Transform firstRope; // the first rope in the scene private static GondolaManager instance; // the instance of the GondolaManager public static GondolaManager Instance { get { // an instance getter if (instance == null) { instance = GameObject.FindObjectOfType<GondolaManager> (); } return instance; } } void Start () { curr = DateTime.Now; // the time now // initialization of ropes and gondolas for (int i = 0; i < N; i++) { count++; SpawnRope (); if (count % 3 == 0) { SpawnGondola (currentRope.transform); } } SpawnGondola (firstRope); } void FixedUpdate () { DateTime now = DateTime.Now; if ((now - curr).TotalSeconds >= DELAY) { // if the interval has passed SpawnGondola (firstRope); // spawn fondola in the first rope for (int i = 0; i < N / 10; i++) { // spawn N/10 ropes SpawnRope (); count++; } curr = now; } } // spawns a rope object in the scene private void SpawnRope() { GameObject tmp = Instantiate (rope); tmp.transform.position = currentRope.transform.GetChild (0).position; // creates the link between the current and new rope currentRope.GetComponent<Rope> ().next = tmp.transform; currentRope = tmp; currentRope.GetComponent<Rope> ().next = firstRope.transform; } private void SpawnGondola(Transform parent) { GameObject gon = Instantiate (gondola); // new location of the gondole minus the offset between its senter and location of the parent gon.transform.localPosition = new Vector3 (0,OFFSET,0) + parent.position; } }
sarasolano/ZooBreak
Assets/Scripts/GondolaManager.cs
C#
gpl-3.0
2,177
module BaseControllerHelper end
seekshiva/courses
app/helpers/base_controller_helper.rb
Ruby
gpl-3.0
32
import { Component } from '@angular/core'; import { NavController, ToastController } from 'ionic-angular'; import { Http } from '@angular/http'; import { ActionSheetController } from 'ionic-angular'; import { NotifikasiPage } from '../notifikasi/notifikasi'; import { ArtikelBacaPage } from '../artikel-baca/artikel-baca'; import { TulisArtikelPage } from '../tulis-artikel/tulis-artikel'; import { TulisDiskusiPage } from '../tulis-diskusi/tulis-diskusi'; import '../../providers/user-data'; /* Generated class for the Cari page. See http://ionicframework.com/docs/v2/components/#navigation for more info on Ionic pages and navigation. */ @Component({ selector: 'page-cari', templateUrl: 'cari.html' }) export class CariPage { public searchQuery = ""; public posts; public limit = 0; public httpErr = false; constructor(public navCtrl: NavController, public actionSheetCtrl: ActionSheetController, public http: Http, public toastCtrl: ToastController) { this.getData(); } ionViewDidLoad() { console.log('Hello CariPage Page'); } notif() { this.navCtrl.push(NotifikasiPage); } getData() { this.limit = 0; this.http.get('http://cybex.ipb.ac.id/api/search.php?search='+this.searchQuery+'&limit='+this.limit).subscribe(res => { this.posts = res.json(); console.log('dapet data'); this.httpErr = false; }, err => {this.showAlert(err.status)}); } getItems(searchbar){ this.getData(); } doInfinite(infiniteScroll) { console.log('Begin async operation'); setTimeout(() => { this.limit = this.limit+5; this.http.get('http://cybex.ipb.ac.id/api/search.php?search='+this.searchQuery+'&limit='+this.limit).subscribe(res => { this.posts = this.posts.concat(res.json()); }); console.log('Async operation has ended'); infiniteScroll.complete(); }, 2000); } baca(idArtikel){ this.navCtrl.push(ArtikelBacaPage, idArtikel); } presentActionSheet() { let actionSheet = this.actionSheetCtrl.create({ title: 'Pilihan', buttons: [ { text: 'Tulis Artikel', role: 'tulisArtikel', handler: () => { console.log('Tulis Artikel clicked'); this.navCtrl.push(TulisArtikelPage); } },{ text: 'Tanya/Diskusi', role: 'tulisDiskusi', handler: () => { console.log('Tulis Diskusi clicked'); this.navCtrl.push(TulisDiskusiPage); } },{ text: 'Batal', role: 'cancel', handler: () => { console.log('Cancel clicked'); } } ] }); actionSheet.present(); } showAlert(status){ if(status == 0){ let toast = this.toastCtrl.create({ message: 'Tidak ada koneksi. Cek kembali sambungan Internet perangkat Anda.', position: 'bottom', showCloseButton: true, closeButtonText: 'X' }); toast.present(); }else{ let toast = this.toastCtrl.create({ message: 'Tidak dapat menyambungkan ke server. Mohon muat kembali halaman ini.', position: 'bottom', showCloseButton: true, closeButtonText: 'X' }); toast.present(); } this.httpErr = true; } }
Rajamuda/cybex-mobile-ipb
src/pages/cari/cari.ts
TypeScript
gpl-3.0
3,304
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'events.ui' # # Created by: PyQt4 UI code generator 4.11.4 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui from collections import * from functools import * import os, glob import pandas as pd try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: def _fromUtf8(s): return s try: _encoding = QtGui.QApplication.UnicodeUTF8 def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, disambig, _encoding) except AttributeError: def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, disambig) class Ui_SamplesDialog(QtGui.QDialog): def __init__(self, parent=None, datafolder=None): """ Constructor """ QtGui.QDialog.__init__(self, parent) # self.filelist = filelist self.datafolder = datafolder # labels font self.font_labels = QtGui.QFont("Arial", 12, QtGui.QFont.Bold) self.font_edits = QtGui.QFont("Arial", 12) self.font_buttons = QtGui.QFont("Arial", 10, QtGui.QFont.Bold) self.setupUi(self) self.exec_() def setupUi(self, Dialog): Dialog.setObjectName(_fromUtf8("Dialog")) Dialog.resize(1000, 400) self.gridLayout = QtGui.QGridLayout(Dialog) self.gridLayout.setObjectName(_fromUtf8("gridLayout")) # list of Events self.prepare_form(Dialog) self.retranslateUi(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog) def load_data(self): print(self.datafolder) self.samplefile = glob.glob(os.path.join(self.datafolder, "*_SAMPLES.csv"))[0] if os.path.isfile(self.samplefile): self.samplesdf = pd.read_csv(self.samplefile, encoding='ISO-8859-1') else: print("File not found: ", self.samplefile) self.samplesdf = None self.combodefaults = {'cuvette': ['600', '2000', '4000']} def prepare_form(self, Dialog): # load or reload data self.load_data() # form dicts edit_list = ['date', 'time', 'samplename', 'filename', 'smoothing', 'cal32', 'cal44', 'cons32', 'cons44', 'zero44', 'zero45', 'zero46', 'zero47', 'zero49'] combo_list = ['user', 'membrane', 'cuvette'] self.labels = defaultdict(defaultdict) self.edits = defaultdict(defaultdict) self.radios = defaultdict(defaultdict) self.combobox = defaultdict(defaultdict) self.labs = defaultdict(defaultdict) self.labs = {"time": "Time", "date": "Date", "samplename": "Sample Name", "filename": "File Name", "smoothing": "Smoothing", "cuvette": "Cuvette", "user": "User", "membrane": "Membrane", "cal44": "Calibration 44", "cal32": "Calibration 32", "cons32": "Consumption 32", "cons44": "Consumption 44", "zero32": "Zero 32", "zero44": "Zero 44", "zero45": "Zero 45", "zero46": "Zero 46", "zero47": "Zero 47", "zero49": "Zero 49"} self.buttons = OrderedDict(sorted({'Apply': defaultdict(object), 'Delete': defaultdict(object)}.items())) xpos, ypos = 1, 0 for row in self.samplesdf.iterrows(): row_index = row[0] r = row[1] self.radios[row_index] = QtGui.QRadioButton(Dialog) self.radios[row_index].setObjectName(_fromUtf8("_".join(["radio", str(row_index)]))) self.gridLayout.addWidget(self.radios[row_index], ypos+1, 0, 1, 1) for k in ['samplename', 'date', 'time', 'cuvette']: # create labels if ypos == 0: self.labels[k] = QtGui.QLabel(Dialog) self.labels[k].setObjectName(_fromUtf8("_".join(["label", k]))) self.labels[k].setText(str(self.labs[k])) self.labels[k].setAlignment(QtCore.Qt.AlignCenter | QtCore.Qt.AlignVCenter) self.labels[k].setFont(self.font_labels) self.gridLayout.addWidget(self.labels[k], 0, xpos, 1, 1) if k in edit_list: self.edits[k][row_index] = QtGui.QLineEdit(Dialog) self.edits[k][row_index].setObjectName(_fromUtf8("_".join(["edit", k, str(row_index)]))) self.edits[k][row_index].setText(str(r[k])) self.edits[k][row_index].setFont(self.font_edits) if k in ['time', 'date']: self.edits[k][row_index].setFixedWidth(80) self.gridLayout.addWidget(self.edits[k][row_index], ypos+1, xpos, 1, 1) elif k in combo_list: self.combobox[k][row_index] = QtGui.QComboBox(Dialog) self.combobox[k][row_index].setObjectName(_fromUtf8("_".join(["combo", k, str(row_index)]))) self.combobox[k][row_index].addItems(self.combodefaults[k]) self.combobox[k][row_index].setCurrentIndex(self.combobox[k][row_index].findText(str(r[k]), QtCore.Qt.MatchFixedString)) self.combobox[k][row_index].setFont(self.font_edits) self.gridLayout.addWidget(self.combobox[k][row_index], ypos+1, xpos, 1, 1) xpos += 1 # create buttons for k in self.buttons.keys(): # if ypos > 0: self.buttons[k][row_index] = QtGui.QPushButton(Dialog) self.buttons[k][row_index].setObjectName(_fromUtf8("_".join(["event", k, "button", str(row_index)]))) self.buttons[k][row_index].setText(_translate("Dialog", k + str(row_index), None)) self.buttons[k][row_index].setFont(self.font_buttons) if k == 'Apply': self.buttons[k][row_index].clicked.connect(partial(self.ask_apply_changes, [row_index, Dialog])) self.buttons[k][row_index].setStyleSheet("background-color: #ffeedd") elif k == 'Delete': self.buttons[k][row_index].clicked.connect(partial(self.ask_delete_confirm1, [row_index, Dialog])) self.buttons[k][row_index].setStyleSheet("background-color: #ffcddd") self.gridLayout.addWidget(self.buttons[k][row_index], ypos+1, xpos, 1, 1) xpos += 1 # increments ypos += 1 xpos = 1 Dialog.resize(1000, 70 + (30 * ypos)) # self.add_row(Dialog) def ask_delete_confirm1(self, args): sid = args[0] Dialog = args[1] # check if radio button is checked. if self.radios[sid].isChecked(): msg = "Are you sure you want to delete the following sample : \n\n" details = "" for c in self.samplesdf.columns: details += str(c) + ": " + str(self.samplesdf.at[sid, c]) + "\n" reply = QtGui.QMessageBox.warning(self, 'Confirmation #1', msg + details, QtGui.QMessageBox.Yes, QtGui.QMessageBox.No) if reply == QtGui.QMessageBox.Yes: msg2 = "Are you sure REALLY REALLY sure you want to delete the following sample ? \n\n" + \ "This is the last confirmation message. After confirming, the files will be PERMANENTLY deleted and the data WILL be lost ! \n\n" msgbox = QtGui.QMessageBox.critical(self, 'Confirmation #2', msg2 + details, QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.No) reply2 = msgbox if reply2 == QtGui.QMessageBox.Yes: # deletion confirmed self.delete_confirmed(sid) self.update_form( Dialog) else: QtGui.QMessageBox.question(self, 'Error', 'Please select the sample you want to delete on the left', QtGui.QMessageBox.Ok) def delete_confirmed(self, sid): # sample file filename = self.samplesdf.loc[sid, 'filename'] # delete row in samplesdf self.samplesdf = self.samplesdf.drop(self.samplesdf.index[sid]) self.samplesdf.to_csv(self.samplefile, index=False, encoding='ISO-8859-1') # delete file in rawdata if os.path.isfile(os.path.join(self.datafolder, "rawdata", filename)): os.remove(os.path.join(self.datafolder, "rawdata", filename)) # print(" delete: ", os.path.join(self.datafolder, "rawdata", filename)) # delete file in data if os.path.isfile(os.path.join(self.datafolder, filename)): os.remove(os.path.join(self.datafolder, filename)) # print(" delete: ", os.path.join(self.datafolder, filename)) def ask_apply_changes(self, args): sid = args[0] Dialog = args[1] newdata=defaultdict(str) for k in self.edits.keys(): newdata[k] = self.edits[k][sid].text() for k in self.combobox.keys(): newdata[k] = self.combobox[k][sid].currentText() details = "" for k in newdata: details += str(self.samplesdf.at[sid, k]) + '\t --> \t' + str(newdata[k]) + "\n" msg = "Are you sure you want to apply the changes to sample " + str(self.samplesdf.at[sid, 'samplename']) + " ?\n\n" reply = QtGui.QMessageBox.question(self, 'Modify a sample', msg + details, QtGui.QMessageBox.Yes, QtGui.QMessageBox.No) if reply == QtGui.QMessageBox.Yes: self.apply_changes_confirmed(sid, newdata) self.update_form(Dialog) else: print('cancel modification') def apply_changes_confirmed(self, sid, newdata): # rename files newdata['filename'] = str(newdata['date']) + "_" + str(newdata['samplename']) + ".csv" os.rename(os.path.join(self.datafolder, str(self.samplesdf.at[sid, 'filename'])), os.path.join(self.datafolder, str(newdata['filename']))) os.rename(os.path.join(self.datafolder, "rawdata", str(self.samplesdf.at[sid, 'filename'])), os.path.join(self.datafolder, "rawdata", str(newdata['filename']))) for k in newdata.keys(): self.samplesdf.at[sid, k] = newdata[k] self.samplesdf.to_csv(self.samplefile, index=False, encoding='ISO-8859-1') def update_form(self, Dialog): # empty variables self.edits = None self.combobox = None self.buttons = None self.radios = None self.labs = None self.labels = None # empty layout for i in reversed(range(self.gridLayout.count())): self.gridLayout.itemAt(i).widget().setParent(None) self.prepare_form(Dialog) def retranslateUi(self, Dialog): Dialog.setWindowTitle(_translate("Dialog", "Samples Manager", None)) # self.label.setText(_translate("Dialog", "File", None))
vince8290/dana
ui_files/samples.py
Python
gpl-3.0
11,728
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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.16"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>linalg: linalg_immutable::eigen_results Type Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="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"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */ $(document).ready(initResizable); /* @license-end */</script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">linalg &#160;<span id="projectnumber">1.6.0</span> </div> <div id="projectbrief">A linear algebra library that provides a user-friendly interface to several BLAS and LAPACK routines.</div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.16 --> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */ var searchBox = new SearchBox("searchBox", "search",false,'Search'); /* @license-end */ </script> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */ $(function() { initMenu('',true,false,'search.php','Search'); $(document).ready(function() { init_search(); }); }); /* @license-end */</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"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */ $(document).ready(function(){initNavTree('structlinalg__immutable_1_1eigen__results.html','');}); /* @license-end */ </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="summary"> <a href="#pri-attribs">Private Attributes</a> &#124; <a href="structlinalg__immutable_1_1eigen__results-members.html">List of all members</a> </div> <div class="headertitle"> <div class="title">linalg_immutable::eigen_results Type Reference</div> </div> </div><!--header--> <div class="contents"> <p>Defines a container for the output of an Eigen analysis of a square matrix. <a href="structlinalg__immutable_1_1eigen__results.html#details">More...</a></p> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pri-attribs"></a> Private Attributes</h2></td></tr> <tr class="memitem:abb60901ab160c6fd232cfb46ed0bf3cc"><td class="memItemLeft" align="right" valign="top"><a id="abb60901ab160c6fd232cfb46ed0bf3cc"></a> complex(real64), dimension(:), allocatable&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structlinalg__immutable_1_1eigen__results.html#abb60901ab160c6fd232cfb46ed0bf3cc">values</a></td></tr> <tr class="memdesc:abb60901ab160c6fd232cfb46ed0bf3cc"><td class="mdescLeft">&#160;</td><td class="mdescRight">An N-element array containing the eigenvalues. <br /></td></tr> <tr class="separator:abb60901ab160c6fd232cfb46ed0bf3cc"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a982607b9c3ff93504bb4524dcd31a442"><td class="memItemLeft" align="right" valign="top"><a id="a982607b9c3ff93504bb4524dcd31a442"></a> complex(real64), dimension(:,:), allocatable&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structlinalg__immutable_1_1eigen__results.html#a982607b9c3ff93504bb4524dcd31a442">vectors</a></td></tr> <tr class="memdesc:a982607b9c3ff93504bb4524dcd31a442"><td class="mdescLeft">&#160;</td><td class="mdescRight">An N-by-N matrix containing the N right eigenvectors (one per column). <br /></td></tr> <tr class="separator:a982607b9c3ff93504bb4524dcd31a442"><td class="memSeparator" colspan="2">&#160;</td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <div class="textblock"><p>Defines a container for the output of an Eigen analysis of a square matrix. </p> <p class="definition">Definition at line <a class="el" href="linalg__immutable_8f90_source.html#l00187">187</a> of file <a class="el" href="linalg__immutable_8f90_source.html">linalg_immutable.f90</a>.</p> </div><hr/>The documentation for this type was generated from the following file:<ul> <li>C:/Users/jchri/Documents/github/linalg/src/<a class="el" href="linalg__immutable_8f90_source.html">linalg_immutable.f90</a></li> </ul> </div><!-- contents --> </div><!-- doc-content --> <!-- start footer part --> <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> <ul> <li class="navelem"><a class="el" href="namespacelinalg__immutable.html">linalg_immutable</a></li><li class="navelem"><a class="el" href="structlinalg__immutable_1_1eigen__results.html">eigen_results</a></li> <li class="footer">Generated by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.16 </li> </ul> </div> </body> </html>
jchristopherson/linalg
doc/html/structlinalg__immutable_1_1eigen__results.html
HTML
gpl-3.0
6,824
/* * Copyright (c) 2011 Sveriges Television AB <[email protected]> * * This file is part of CasparCG (www.casparcg.com). * * CasparCG 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. * * CasparCG 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 CasparCG. If not, see <http://www.gnu.org/licenses/>. * * Author: Helge Norberg, [email protected] */ #include "../../StdAfx.h" #include "synchronizing_consumer.h" #include <common/log/log.h> #include <common/diagnostics/graph.h> #include <common/concurrency/future_util.h> #include <core/video_format.h> #include <boost/range/adaptor/transformed.hpp> #include <boost/range/algorithm/min_element.hpp> #include <boost/range/algorithm/max_element.hpp> #include <boost/range/algorithm/for_each.hpp> #include <boost/range/algorithm/count_if.hpp> #include <boost/range/numeric.hpp> #include <boost/algorithm/string/join.hpp> #include <boost/thread/future.hpp> #include <functional> #include <vector> #include <queue> #include <utility> #include <tbb/atomic.h> namespace caspar { namespace core { using namespace boost::adaptors; class delegating_frame_consumer : public frame_consumer { safe_ptr<frame_consumer> consumer_; public: delegating_frame_consumer(const safe_ptr<frame_consumer>& consumer) : consumer_(consumer) { } frame_consumer& get_delegate() { return *consumer_; } const frame_consumer& get_delegate() const { return *consumer_; } virtual void initialize( const video_format_desc& format_desc, int channel_index) override { get_delegate().initialize(format_desc, channel_index); } virtual int64_t presentation_frame_age_millis() const { return get_delegate().presentation_frame_age_millis(); } virtual boost::unique_future<bool> send( const safe_ptr<read_frame>& frame) override { return get_delegate().send(frame); } virtual std::wstring print() const override { return get_delegate().print(); } virtual boost::property_tree::wptree info() const override { return get_delegate().info(); } virtual bool has_synchronization_clock() const override { return get_delegate().has_synchronization_clock(); } virtual size_t buffer_depth() const override { return get_delegate().buffer_depth(); } virtual int index() const override { return get_delegate().index(); } }; const std::vector<int>& diag_colors() { static std::vector<int> colors = boost::assign::list_of<int> (diagnostics::color(0.0f, 0.6f, 0.9f)) (diagnostics::color(0.6f, 0.3f, 0.3f)) (diagnostics::color(0.3f, 0.6f, 0.3f)) (diagnostics::color(0.4f, 0.3f, 0.8f)) (diagnostics::color(0.9f, 0.9f, 0.5f)) (diagnostics::color(0.2f, 0.9f, 0.9f)); return colors; } class buffering_consumer_adapter : public delegating_frame_consumer { std::queue<safe_ptr<read_frame>> buffer_; tbb::atomic<size_t> buffered_; tbb::atomic<int64_t> duplicate_next_; public: buffering_consumer_adapter(const safe_ptr<frame_consumer>& consumer) : delegating_frame_consumer(consumer) { buffered_ = 0; duplicate_next_ = 0; } boost::unique_future<bool> consume_one() { if (!buffer_.empty()) { buffer_.pop(); --buffered_; } return get_delegate().send(buffer_.front()); } virtual boost::unique_future<bool> send( const safe_ptr<read_frame>& frame) override { if (duplicate_next_) { --duplicate_next_; } else if (!buffer_.empty()) { buffer_.pop(); --buffered_; } buffer_.push(frame); ++buffered_; return get_delegate().send(buffer_.front()); } void duplicate_next(int64_t to_duplicate) { duplicate_next_ += to_duplicate; } size_t num_buffered() const { return buffered_ - 1; } virtual std::wstring print() const override { return L"buffering[" + get_delegate().print() + L"]"; } virtual boost::property_tree::wptree info() const override { boost::property_tree::wptree info; info.add(L"type", L"buffering-consumer-adapter"); info.add_child(L"consumer", get_delegate().info()); info.add(L"buffered-frames", num_buffered()); return info; } }; static const uint64_t MAX_BUFFERED_OUT_OF_MEMORY_GUARD = 5; struct synchronizing_consumer::implementation { private: std::vector<safe_ptr<buffering_consumer_adapter>> consumers_; size_t buffer_depth_; bool has_synchronization_clock_; std::vector<boost::unique_future<bool>> results_; boost::promise<bool> promise_; video_format_desc format_desc_; safe_ptr<diagnostics::graph> graph_; int64_t grace_period_; tbb::atomic<int64_t> current_diff_; public: implementation(const std::vector<safe_ptr<frame_consumer>>& consumers) : grace_period_(0) { BOOST_FOREACH(auto& consumer, consumers) consumers_.push_back(make_safe<buffering_consumer_adapter>(consumer)); current_diff_ = 0; auto buffer_depths = consumers | transformed(std::mem_fn(&frame_consumer::buffer_depth)); std::vector<size_t> depths(buffer_depths.begin(), buffer_depths.end()); buffer_depth_ = *boost::max_element(depths); has_synchronization_clock_ = boost::count_if(consumers, std::mem_fn(&frame_consumer::has_synchronization_clock)) > 0; diagnostics::register_graph(graph_); } boost::unique_future<bool> send(const safe_ptr<read_frame>& frame) { results_.clear(); BOOST_FOREACH(auto& consumer, consumers_) results_.push_back(consumer->send(frame)); promise_ = boost::promise<bool>(); promise_.set_wait_callback(std::function<void(boost::promise<bool>&)>([this](boost::promise<bool>& promise) { BOOST_FOREACH(auto& result, results_) { result.get(); } auto frame_ages = consumers_ | transformed(std::mem_fn(&frame_consumer::presentation_frame_age_millis)); std::vector<int64_t> ages(frame_ages.begin(), frame_ages.end()); auto max_age_iter = boost::max_element(ages); auto min_age_iter = boost::min_element(ages); int64_t min_age = *min_age_iter; if (min_age == 0) { // One of the consumers have yet no measurement, wait until next // frame until we make any assumptions. promise.set_value(true); return; } int64_t max_age = *max_age_iter; int64_t age_diff = max_age - min_age; current_diff_ = age_diff; for (unsigned i = 0; i < ages.size(); ++i) graph_->set_value( narrow(consumers_[i]->print()), static_cast<double>(ages[i]) / *max_age_iter); bool grace_period_over = grace_period_ == 1; if (grace_period_) --grace_period_; if (grace_period_ == 0) { int64_t frame_duration = static_cast<int64_t>(1000 / format_desc_.fps); if (age_diff >= frame_duration) { CASPAR_LOG(info) << print() << L" Consumers not in sync. min: " << min_age << L" max: " << max_age; auto index = min_age_iter - ages.begin(); auto to_duplicate = age_diff / frame_duration; auto& consumer = *consumers_.at(index); auto currently_buffered = consumer.num_buffered(); if (currently_buffered + to_duplicate > MAX_BUFFERED_OUT_OF_MEMORY_GUARD) { CASPAR_LOG(info) << print() << L" Protecting from out of memory. Duplicating less frames than calculated"; to_duplicate = MAX_BUFFERED_OUT_OF_MEMORY_GUARD - currently_buffered; } consumer.duplicate_next(to_duplicate); grace_period_ = 10 + to_duplicate + buffer_depth_; } else if (grace_period_over) { CASPAR_LOG(info) << print() << L" Consumers resynced. min: " << min_age << L" max: " << max_age; } } blocking_consume_unnecessarily_buffered(); promise.set_value(true); })); return promise_.get_future(); } void blocking_consume_unnecessarily_buffered() { auto buffered = consumers_ | transformed(std::mem_fn(&buffering_consumer_adapter::num_buffered)); std::vector<size_t> num_buffered(buffered.begin(), buffered.end()); auto min_buffered = *boost::min_element(num_buffered); if (min_buffered) CASPAR_LOG(info) << print() << L" " << min_buffered << L" frames unnecessarily buffered. Consuming and letting channel pause during that time."; while (min_buffered) { std::vector<boost::unique_future<bool>> results; BOOST_FOREACH(auto& consumer, consumers_) results.push_back(consumer->consume_one()); BOOST_FOREACH(auto& result, results) result.get(); --min_buffered; } } void initialize(const video_format_desc& format_desc, int channel_index) { for (size_t i = 0; i < consumers_.size(); ++i) { auto& consumer = consumers_.at(i); consumer->initialize(format_desc, channel_index); graph_->set_color( narrow(consumer->print()), diag_colors().at(i % diag_colors().size())); } graph_->set_text(print()); format_desc_ = format_desc; } int64_t presentation_frame_age_millis() const { int64_t result = 0; BOOST_FOREACH(auto& consumer, consumers_) result = std::max(result, consumer->presentation_frame_age_millis()); return result; } std::wstring print() const { return L"synchronized[" + boost::algorithm::join(consumers_ | transformed(std::mem_fn(&frame_consumer::print)), L"|") + L"]"; } boost::property_tree::wptree info() const { boost::property_tree::wptree info; info.add(L"type", L"synchronized-consumer"); BOOST_FOREACH(auto& consumer, consumers_) info.add_child(L"consumer", consumer->info()); info.add(L"age-diff", current_diff_); return info; } bool has_synchronization_clock() const { return has_synchronization_clock_; } size_t buffer_depth() const { return buffer_depth_; } int index() const { return boost::accumulate(consumers_ | transformed(std::mem_fn(&frame_consumer::index)), 10000); } }; synchronizing_consumer::synchronizing_consumer(const std::vector<safe_ptr<frame_consumer>>& consumers) : impl_(new implementation(consumers)) { } boost::unique_future<bool> synchronizing_consumer::send(const safe_ptr<read_frame>& frame) { return impl_->send(frame); } void synchronizing_consumer::initialize(const video_format_desc& format_desc, int channel_index) { impl_->initialize(format_desc, channel_index); } int64_t synchronizing_consumer::presentation_frame_age_millis() const { return impl_->presentation_frame_age_millis(); } std::wstring synchronizing_consumer::print() const { return impl_->print(); } boost::property_tree::wptree synchronizing_consumer::info() const { return impl_->info(); } bool synchronizing_consumer::has_synchronization_clock() const { return impl_->has_synchronization_clock(); } size_t synchronizing_consumer::buffer_depth() const { return impl_->buffer_depth(); } int synchronizing_consumer::index() const { return impl_->index(); } }}
gfto/Server
core/consumer/synchronizing/synchronizing_consumer.cpp
C++
gpl-3.0
11,040
package nest.util; import android.text.TextUtils; import java.util.regex.Matcher; import java.util.regex.Pattern; import timber.log.Timber; public class TraceTree extends Timber.HollowTree { private final DebugTree debugTree; public TraceTree(boolean useTraces) { debugTree = new DebugTree(useTraces); } @Override public void v(String message, Object... args) { debugTree.v(message, args); } @Override public void v(Throwable t, String message, Object... args) { debugTree.v(t, message, args); } @Override public void d(String message, Object... args) { debugTree.d(message, args); } @Override public void d(Throwable t, String message, Object... args) { debugTree.d(t, message, args); } @Override public void i(String message, Object... args) { debugTree.i(message, args); } @Override public void i(Throwable t, String message, Object... args) { debugTree.i(t, message, args); } @Override public void w(String message, Object... args) { debugTree.w(message, args); } @Override public void w(Throwable t, String message, Object... args) { debugTree.w(t, message, args); } @Override public void e(String message, Object... args) { debugTree.e(message, args); } @Override public void e(Throwable t, String message, Object... args) { debugTree.e(t, message, args); } private static class DebugTree extends Timber.DebugTree { private static final Pattern ANONYMOUS_CLASS = Pattern.compile("\\$\\d+$"); private static final int STACK_POSITION = 6; private final boolean useTraces; private StackTraceElement lastTrace; private DebugTree(boolean useTraces) { this.useTraces = useTraces; } @Override protected String createTag() { String tag; if (!useTraces) { tag = nextTag(); if (tag != null) { return tag; } } StackTraceElement[] stackTrace = new Throwable().getStackTrace(); if (stackTrace.length < STACK_POSITION) { return "---"; } if (useTraces) { lastTrace = stackTrace[STACK_POSITION]; } tag = stackTrace[STACK_POSITION].getClassName(); Matcher m = ANONYMOUS_CLASS.matcher(tag); if (m.find()) { tag = m.replaceAll(""); } return tag.substring(tag.lastIndexOf('.') + 1); } @Override protected void logMessage(int priority, String tag, String message) { if (lastTrace != null) { message = (TextUtils.isEmpty(message) ? "" : message +" ") + "at "+ lastTrace; lastTrace = null; } super.logMessage(priority, tag, message); } } }
withoutuniverse/nest_tt
appko_tt/app/src/main/java/nest/util/TraceTree.java
Java
gpl-3.0
3,022
/* * Copyright (C) 2012 Carl Green * * 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 3 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, see <http://www.gnu.org/licenses/>. */ package info.carlwithak.mpxg2.sysex.effects.algorithms; import info.carlwithak.mpxg2.model.effects.algorithms.DetuneStereo; /** * Class to parse parameter data for Detune (S) effect. * * @author Carl Green */ public class DetuneStereoParser { public static DetuneStereo parse(byte[] effectParameters) { DetuneStereo detuneStereo = new DetuneStereo(); int mix = effectParameters[0] + effectParameters[1] * 16; detuneStereo.mix.setValue(mix); int level = effectParameters[2] + effectParameters[3] * 16; detuneStereo.level.setValue(level); int tune = effectParameters[4] + effectParameters[5] * 16; detuneStereo.tune.setValue(tune); int optimize = effectParameters[6] + effectParameters[7] * 16; detuneStereo.optimize.setValue(optimize); int preDelay = effectParameters[8] + effectParameters[9] * 16; detuneStereo.preDelay.setValue(preDelay); return detuneStereo; } }
carlgreen/Lexicon-MPX-G2-Editor
mpxg2-sysex/src/main/java/info/carlwithak/mpxg2/sysex/effects/algorithms/DetuneStereoParser.java
Java
gpl-3.0
1,687
/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | foam-extend: Open Source CFD \\ / O peration | Version: 3.2 \\ / A nd | Web: http://www.foam-extend.org \\/ M anipulation | For copyright notice see file Copyright ------------------------------------------------------------------------------- License This file is part of foam-extend. foam-extend 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. foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>. \*---------------------------------------------------------------------------*/ #include "faceTriangulation.H" #include "plane.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // const Foam::scalar Foam::faceTriangulation::edgeRelTol = 1E-6; // Edge to the right of face vertex i Foam::label Foam::faceTriangulation::right(const label, label i) { return i; } // Edge to the left of face vertex i Foam::label Foam::faceTriangulation::left(const label size, label i) { return i ? i-1 : size-1; } // Calculate (normalized) edge vectors. // edges[i] gives edge between point i+1 and i. Foam::tmp<Foam::vectorField> Foam::faceTriangulation::calcEdges ( const face& f, const pointField& points ) { tmp<vectorField> tedges(new vectorField(f.size())); vectorField& edges = tedges(); forAll(f, i) { point thisPt = points[f[i]]; point nextPt = points[f[f.fcIndex(i)]]; vector vec(nextPt - thisPt); vec /= mag(vec) + VSMALL; edges[i] = vec; } return tedges; } // Calculates half angle components of angle from e0 to e1 void Foam::faceTriangulation::calcHalfAngle ( const vector& normal, const vector& e0, const vector& e1, scalar& cosHalfAngle, scalar& sinHalfAngle ) { // truncate cos to +-1 to prevent negative numbers scalar cos = max(-1, min(1, e0 & e1)); scalar sin = (e0 ^ e1) & normal; if (sin < -ROOTVSMALL) { // 3rd or 4th quadrant cosHalfAngle = - Foam::sqrt(0.5*(1 + cos)); sinHalfAngle = Foam::sqrt(0.5*(1 - cos)); } else { // 1st or 2nd quadrant cosHalfAngle = Foam::sqrt(0.5*(1 + cos)); sinHalfAngle = Foam::sqrt(0.5*(1 - cos)); } } // Calculate intersection point between edge p1-p2 and ray (in 2D). // Return true and intersection point if intersection between p1 and p2. Foam::pointHit Foam::faceTriangulation::rayEdgeIntersect ( const vector& normal, const point& rayOrigin, const vector& rayDir, const point& p1, const point& p2, scalar& posOnEdge ) { // Start off from miss pointHit result(p1); // Construct plane normal to rayDir and intersect const vector y = normal ^ rayDir; posOnEdge = plane(rayOrigin, y).normalIntersect(p1, (p2-p1)); // Check intersection to left of p1 or right of p2 if ((posOnEdge < 0) || (posOnEdge > 1)) { // Miss } else { // Check intersection behind rayOrigin point intersectPt = p1 + posOnEdge * (p2 - p1); if (((intersectPt - rayOrigin) & rayDir) < 0) { // Miss } else { // Hit result.setHit(); result.setPoint(intersectPt); result.setDistance(mag(intersectPt - rayOrigin)); } } return result; } // Return true if triangle given its three points (anticlockwise ordered) // contains point bool Foam::faceTriangulation::triangleContainsPoint ( const vector& n, const point& p0, const point& p1, const point& p2, const point& pt ) { scalar area01Pt = triPointRef(p0, p1, pt).normal() & n; scalar area12Pt = triPointRef(p1, p2, pt).normal() & n; scalar area20Pt = triPointRef(p2, p0, pt).normal() & n; if ((area01Pt > 0) && (area12Pt > 0) && (area20Pt > 0)) { return true; } else if ((area01Pt < 0) && (area12Pt < 0) && (area20Pt < 0)) { FatalErrorIn("triangleContainsPoint") << abort(FatalError); return false; } else { return false; } } // Starting from startIndex find diagonal. Return in index1, index2. // Index1 always startIndex except when convex polygon void Foam::faceTriangulation::findDiagonal ( const pointField& points, const face& f, const vectorField& edges, const vector& normal, const label startIndex, label& index1, label& index2 ) { const point& startPt = points[f[startIndex]]; // Calculate angle at startIndex const vector& rightE = edges[right(f.size(), startIndex)]; const vector leftE = -edges[left(f.size(), startIndex)]; // Construct ray which bisects angle scalar cosHalfAngle = GREAT; scalar sinHalfAngle = GREAT; calcHalfAngle(normal, rightE, leftE, cosHalfAngle, sinHalfAngle); vector rayDir ( cosHalfAngle*rightE + sinHalfAngle*(normal ^ rightE) ); // rayDir should be normalized already but is not due to rounding errors // so normalize. rayDir /= mag(rayDir) + VSMALL; // // Check all edges (apart from rightE and leftE) for nearest intersection // label faceVertI = f.fcIndex(startIndex); pointHit minInter(false, vector::zero, GREAT, true); label minIndex = -1; scalar minPosOnEdge = GREAT; for (label i = 0; i < f.size() - 2; i++) { scalar posOnEdge; pointHit inter = rayEdgeIntersect ( normal, startPt, rayDir, points[f[faceVertI]], points[f[f.fcIndex(faceVertI)]], posOnEdge ); if (inter.hit() && inter.distance() < minInter.distance()) { minInter = inter; minIndex = faceVertI; minPosOnEdge = posOnEdge; } faceVertI = f.fcIndex(faceVertI); } if (minIndex == -1) { //WarningIn("faceTriangulation::findDiagonal") // << "Could not find intersection starting from " << f[startIndex] // << " for face " << f << endl; index1 = -1; index2 = -1; return; } const label leftIndex = minIndex; const label rightIndex = f.fcIndex(minIndex); // Now ray intersects edge from leftIndex to rightIndex. // Check for intersection being one of the edge points. Make sure never // to return two consecutive points. if (mag(minPosOnEdge) < edgeRelTol && f.fcIndex(startIndex) != leftIndex) { index1 = startIndex; index2 = leftIndex; return; } if ( mag(minPosOnEdge - 1) < edgeRelTol && f.fcIndex(rightIndex) != startIndex ) { index1 = startIndex; index2 = rightIndex; return; } // Select visible vertex that minimizes // angle to bisection. Visibility checking by checking if inside triangle // formed by startIndex, leftIndex, rightIndex const point& leftPt = points[f[leftIndex]]; const point& rightPt = points[f[rightIndex]]; minIndex = -1; scalar maxCos = -GREAT; // all vertices except for startIndex and ones to left and right of it. faceVertI = f.fcIndex(f.fcIndex(startIndex)); for (label i = 0; i < f.size() - 3; i++) { const point& pt = points[f[faceVertI]]; if ( (faceVertI == leftIndex) || (faceVertI == rightIndex) || (triangleContainsPoint(normal, startPt, leftPt, rightPt, pt)) ) { // pt inside triangle (so perhaps visible) // Select based on minimal angle (so guaranteed visible). vector edgePt0 = pt - startPt; edgePt0 /= mag(edgePt0); scalar cos = rayDir & edgePt0; if (cos > maxCos) { maxCos = cos; minIndex = faceVertI; } } faceVertI = f.fcIndex(faceVertI); } if (minIndex == -1) { // no vertex found. Return startIndex and one of the intersected edge // endpoints. index1 = startIndex; if (f.fcIndex(startIndex) != leftIndex) { index2 = leftIndex; } else { index2 = rightIndex; } return; } index1 = startIndex; index2 = minIndex; } // Find label of vertex to start splitting from. Is: // 1] flattest concave angle // 2] flattest convex angle if no concave angles. Foam::label Foam::faceTriangulation::findStart ( const face& f, const vectorField& edges, const vector& normal ) { const label size = f.size(); scalar minCos = GREAT; label minIndex = -1; forAll(f, fp) { const vector& rightEdge = edges[right(size, fp)]; const vector leftEdge = -edges[left(size, fp)]; if (((rightEdge ^ leftEdge) & normal) < ROOTVSMALL) { scalar cos = rightEdge & leftEdge; if (cos < minCos) { minCos = cos; minIndex = fp; } } } if (minIndex == -1) { // No concave angle found. Get flattest convex angle minCos = GREAT; forAll(f, fp) { const vector& rightEdge = edges[right(size, fp)]; const vector leftEdge = -edges[left(size, fp)]; scalar cos = rightEdge & leftEdge; if (cos < minCos) { minCos = cos; minIndex = fp; } } } return minIndex; } // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // Split face f into triangles. Handles all simple (convex & concave) // polygons. bool Foam::faceTriangulation::split ( const bool fallBack, const pointField& points, const face& f, const vector& normal, label& triI ) { const label size = f.size(); if (size <= 2) { WarningIn ( "split(const bool, const pointField&, const face&" ", const vector&, label&)" ) << "Illegal face:" << f << " with points " << UIndirectList<point>(points, f)() << endl; return false; } else if (size == 3) { // Triangle. Just copy. triFace& tri = operator[](triI++); tri[0] = f[0]; tri[1] = f[1]; tri[2] = f[2]; return true; } else { // General case. Start splitting for -flattest concave angle // -or flattest convex angle if no concave angles. tmp<vectorField> tedges(calcEdges(f, points)); const vectorField& edges = tedges(); label startIndex = findStart(f, edges, normal); // Find diagonal to split face across label index1 = -1; label index2 = -1; for (label iter = 0; iter < f.size(); iter++) { findDiagonal ( points, f, edges, normal, startIndex, index1, index2 ); if (index1 != -1 && index2 != -1) { // Found correct diagonal break; } // Try splitting from next startingIndex. startIndex = f.fcIndex(startIndex); } if (index1 == -1 || index2 == -1) { if (fallBack) { // Do naive triangulation. Find smallest angle to start // triangulating from. label maxIndex = -1; scalar maxCos = -GREAT; forAll(f, fp) { const vector& rightEdge = edges[right(size, fp)]; const vector leftEdge = -edges[left(size, fp)]; scalar cos = rightEdge & leftEdge; if (cos > maxCos) { maxCos = cos; maxIndex = fp; } } WarningIn ( "split(const bool, const pointField&, const face&" ", const vector&, label&)" ) << "Cannot find valid diagonal on face " << f << " with points " << UIndirectList<point>(points, f)() << nl << "Returning naive triangulation starting from " << f[maxIndex] << " which might not be correct for a" << " concave or warped face" << endl; label fp = f.fcIndex(maxIndex); for (label i = 0; i < size-2; i++) { label nextFp = f.fcIndex(fp); triFace& tri = operator[](triI++); tri[0] = f[maxIndex]; tri[1] = f[fp]; tri[2] = f[nextFp]; fp = nextFp; } return true; } else { WarningIn ( "split(const bool, const pointField&, const face&" ", const vector&, label&)" ) << "Cannot find valid diagonal on face " << f << " with points " << UIndirectList<point>(points, f)() << nl << "Returning empty triFaceList" << endl; return false; } } // Split into two subshapes. // face1: index1 to index2 // face2: index2 to index1 // Get sizes of the two subshapes label diff = 0; if (index2 > index1) { diff = index2 - index1; } else { // folded round diff = index2 + size - index1; } label nPoints1 = diff + 1; label nPoints2 = size - diff + 1; if (nPoints1 == size || nPoints2 == size) { FatalErrorIn ( "split(const bool, const pointField&, const face&" ", const vector&, label&)" ) << "Illegal split of face:" << f << " with points " << UIndirectList<point>(points, f)() << " at indices " << index1 << " and " << index2 << abort(FatalError); } // Collect face1 points face face1(nPoints1); label faceVertI = index1; for (int i = 0; i < nPoints1; i++) { face1[i] = f[faceVertI]; faceVertI = f.fcIndex(faceVertI); } // Collect face2 points face face2(nPoints2); faceVertI = index2; for (int i = 0; i < nPoints2; i++) { face2[i] = f[faceVertI]; faceVertI = f.fcIndex(faceVertI); } // Decompose the split faces //Pout<< "Split face:" << f << " into " << face1 << " and " << face2 // << endl; //string oldPrefix(Pout.prefix()); //Pout.prefix() = " " + oldPrefix; bool splitOk = split(fallBack, points, face1, normal, triI) && split(fallBack, points, face2, normal, triI); //Pout.prefix() = oldPrefix; return splitOk; } } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // Null constructor Foam::faceTriangulation::faceTriangulation() : triFaceList() {} // Construct from components Foam::faceTriangulation::faceTriangulation ( const pointField& points, const face& f, const bool fallBack ) : triFaceList(f.size()-2) { vector avgNormal = f.normal(points); avgNormal /= mag(avgNormal) + VSMALL; label triI = 0; bool valid = split(fallBack, points, f, avgNormal, triI); if (!valid) { setSize(0); } } // Construct from components Foam::faceTriangulation::faceTriangulation ( const pointField& points, const face& f, const vector& n, const bool fallBack ) : triFaceList(f.size()-2) { label triI = 0; bool valid = split(fallBack, points, f, n, triI); if (!valid) { setSize(0); } } // Construct from Istream Foam::faceTriangulation::faceTriangulation(Istream& is) : triFaceList(is) {} // ************************************************************************* //
Unofficial-Extend-Project-Mirror/foam-extend-foam-extend-3.2
src/meshTools/triSurface/faceTriangulation/faceTriangulation.C
C++
gpl-3.0
17,132
<?php /* Smarty version Smarty-3.1.19, created on 2016-03-17 14:44:03 compiled from "/Users/Evergreen/Documents/workspace/licpresta/admin/themes/default/template/controllers/shop/helpers/list/list_action_delete.tpl" */ ?> <?php /*%%SmartyHeaderCode:154545909656eab4a3d7e136-98563971%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed'); $_valid = $_smarty_tpl->decodeProperties(array ( 'file_dependency' => array ( 'cbf2ed399b76a836e7562130658957cc92238d15' => array ( 0 => '/Users/Evergreen/Documents/workspace/licpresta/admin/themes/default/template/controllers/shop/helpers/list/list_action_delete.tpl', 1 => 1452095428, 2 => 'file', ), ), 'nocache_hash' => '154545909656eab4a3d7e136-98563971', 'function' => array ( ), 'variables' => array ( 'href' => 0, 'action' => 0, 'id_shop' => 0, 'shops_having_dependencies' => 0, 'confirm' => 0, ), 'has_nocache_code' => false, 'version' => 'Smarty-3.1.19', 'unifunc' => 'content_56eab4a3e7ff77_59198683', ),false); /*/%%SmartyHeaderCode%%*/?> <?php if ($_valid && !is_callable('content_56eab4a3e7ff77_59198683')) {function content_56eab4a3e7ff77_59198683($_smarty_tpl) {?> <a href="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['href']->value, ENT_QUOTES, 'UTF-8', true);?> " class="delete" title="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['action']->value, ENT_QUOTES, 'UTF-8', true);?> " <?php if (in_array($_smarty_tpl->tpl_vars['id_shop']->value,$_smarty_tpl->tpl_vars['shops_having_dependencies']->value)) {?> onclick="jAlert('<?php echo smartyTranslate(array('s'=>'You cannot delete this shop\'s (customer and/or order dependency)','js'=>1),$_smarty_tpl);?> '); return false;" <?php } elseif (isset($_smarty_tpl->tpl_vars['confirm']->value)) {?> onclick="if (confirm('<?php echo $_smarty_tpl->tpl_vars['confirm']->value;?> ')){return true;}else{event.stopPropagation(); event.preventDefault();};" <?php }?>> <i class="icon-trash"></i> <?php echo htmlspecialchars($_smarty_tpl->tpl_vars['action']->value, ENT_QUOTES, 'UTF-8', true);?> </a><?php }} ?>
ToxEn/LicPresta
cache/smarty/compile/cb/f2/ed/cbf2ed399b76a836e7562130658957cc92238d15.file.list_action_delete.tpl.php
PHP
gpl-3.0
2,123
<?php namespace UJM\ExoBundle\Installation; use Claroline\InstallationBundle\Additional\AdditionalInstaller as BaseInstaller; use UJM\ExoBundle\Installation\Updater\Updater060000; use UJM\ExoBundle\Installation\Updater\Updater060001; use UJM\ExoBundle\Installation\Updater\Updater060200; use UJM\ExoBundle\Installation\Updater\Updater070000; use UJM\ExoBundle\Installation\Updater\Updater090000; use UJM\ExoBundle\Installation\Updater\Updater090002; class AdditionalInstaller extends BaseInstaller { public function preUpdate($currentVersion, $targetVersion) { if (version_compare($currentVersion, '6.0.0', '<=')) { $updater = new Updater060000($this->container->get('doctrine.dbal.default_connection')); $updater->setLogger($this->logger); $updater->preUpdate(); } if (version_compare($currentVersion, '6.0.0', '=')) { $updater = new Updater060001($this->container->get('doctrine.dbal.default_connection')); $updater->setLogger($this->logger); $updater->preUpdate(); } if (version_compare($currentVersion, '6.2.0', '<')) { $updater = new Updater060200($this->container->get('doctrine.dbal.default_connection')); $updater->setLogger($this->logger); $updater->preUpdate(); } if (version_compare($currentVersion, '7.0.0', '<=')) { $updater = new Updater070000($this->container->get('doctrine.dbal.default_connection')); $updater->setLogger($this->logger); $updater->preUpdate(); } } public function postUpdate($currentVersion, $targetVersion) { if (version_compare($currentVersion, '6.0.0', '<=')) { $updater = new Updater060000($this->container->get('doctrine.dbal.default_connection')); $updater->setLogger($this->logger); $updater->postUpdate(); } if (version_compare($currentVersion, '6.2.0', '<')) { $updater = new Updater060200($this->container->get('doctrine.dbal.default_connection')); $updater->setLogger($this->logger); $updater->postUpdate(); } if (version_compare($currentVersion, '9.0.0', '<')) { $updater = new Updater090000( $this->container->get('doctrine.dbal.default_connection'), $this->container->get('claroline.persistence.object_manager'), $this->container->get('ujm_exo.serializer.exercise'), $this->container->get('ujm_exo.serializer.step'), $this->container->get('ujm_exo.serializer.item') ); $updater->setLogger($this->logger); $updater->postUpdate(); } if (version_compare($currentVersion, '9.0.2', '<')) { $updater = new Updater090002( $this->container->get('doctrine.dbal.default_connection') ); $updater->setLogger($this->logger); $updater->postUpdate(); } } }
remytms/Distribution
plugin/exo/Installation/AdditionalInstaller.php
PHP
gpl-3.0
3,059
/* * Copyright 2014 Erik Wilson <[email protected]> * * 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 3 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, see <http://www.gnu.org/licenses/>. */ package org.tritania.stables; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ShapedRecipe; import org.bukkit.Bukkit; import org.tritania.stables.Stables; import org.tritania.stables.util.Message; import org.tritania.stables.util.Log; public class RaceSystem { public Stables ht; public RaceSystem(Stables ht) { this.ht = ht; } }
tritania/Stables
src/main/java/org/tritania/stables/RaceSystem.java
Java
gpl-3.0
1,118
// This is a generated file. Not intended for manual editing. package org.modula.parsing.definition.psi.impl; import java.util.List; import org.jetbrains.annotations.*; import com.intellij.lang.ASTNode; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElementVisitor; import com.intellij.psi.util.PsiTreeUtil; import static org.modula.parsing.definition.psi.ModulaTypes.*; import com.intellij.extapi.psi.ASTWrapperPsiElement; import org.modula.parsing.definition.psi.*; public class DefinitionFormalParametersImpl extends ASTWrapperPsiElement implements DefinitionFormalParameters { public DefinitionFormalParametersImpl(ASTNode node) { super(node); } public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof DefinitionVisitor) ((DefinitionVisitor)visitor).visitFormalParameters(this); else super.accept(visitor); } @Override @NotNull public List<DefinitionFPSection> getFPSectionList() { return PsiTreeUtil.getChildrenOfTypeAsList(this, DefinitionFPSection.class); } @Override @Nullable public DefinitionQualident getQualident() { return findChildByClass(DefinitionQualident.class); } }
miracelwhipp/idea-modula-support
ims-plugin/gen/org/modula/parsing/definition/psi/impl/DefinitionFormalParametersImpl.java
Java
gpl-3.0
1,213
class MeetingQuery < Query self.queried_class = Meeting self.available_columns = [ QueryColumn.new(:subject, :sortable => "#{Meeting.table_name}.subject",:groupable => true), QueryColumn.new(:location_online, :sortable => "#{Meeting.table_name}.location_online",:groupable => true, caption: 'location'), QueryColumn.new(:date, :sortable => "#{Meeting.table_name}.date",:groupable => true), QueryColumn.new(:end_date, :sortable => "#{Meeting.table_name}.end_date",:groupable => true), QueryColumn.new(:start_time, :sortable => "#{Meeting.table_name}.start_time",:groupable => true), QueryColumn.new(:status, :sortable => "#{Meeting.table_name}.status",:groupable => true), ] def initialize(attributes=nil, *args) super attributes self.filters ||= {} add_filter('subject', '*') unless filters.present? end def initialize_available_filters add_available_filter "subject", :type => :string, :order => 0 add_available_filter "date", :type => :string, :order => 1 add_available_filter "end_date", :type => :string, :order => 1 add_available_filter "start_time", :type => :string, :order => 2 add_available_filter "location_online", :type => :string, :order => 3 add_available_filter "status", :type => :string, :order => 4 # add_custom_fields_filters(MeetingCustomField.where(:is_filter => true)) end def available_columns return @available_columns if @available_columns @available_columns = self.class.available_columns.dup # @available_columns += CustomField.where(:type => 'MeetingCustomField').all.map {|cf| QueryCustomFieldColumn.new(cf) } @available_columns end def default_columns_names @default_columns_names ||= [:subject, :date, :end_date, :start_time, :location_online, :status] end def results_scope(options={}) order_option = [group_by_sort_order, options[:order]].flatten.reject(&:blank?) Meeting.visible. where(statement).where(project_id: options[:project_id]). order(order_option). joins(joins_for_order_statement(order_option.join(','))) end def meetings end end
MicroHealthLLC/redmine_meeting
app/models/meeting_query.rb
Ruby
gpl-3.0
2,145
cd paperbak-1.10.src del PAPERBAK.RES del PaperBak.bpr ren paperbak.h paperback.h ren paperbak.mak paperback.mak cd .. patch -p0 -E -i PaperBack-1.20.RA0193.EN.patch
art-drobanov/PaperBack
PaperBack-1.20.RA0193(EN+RU).patch/forward_to_PaperBack-1.20.RA0193.EN.bat
Batchfile
gpl-3.0
171
/* This file is part of the OdinMS Maple Story Server Copyright (C) 2008 Patrick Huy <[email protected]> Matthias Butz <[email protected]> Jan Christian Meyer <[email protected]> This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation. You may not use, modify or distribute this program under any other version of the GNU Affero General Public License. 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 Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ /** -- Odin JavaScript -------------------------------------------------------------------------------- Konpei - Showa Town(801000000) -- By --------------------------------------------------------------------------------------------- Information -- Version Info ----------------------------------------------------------------------------------- 1.1 - Fixed by Moogra 1.0 - First Version by Information --------------------------------------------------------------------------------------------------- **/ function start() { cm.sendSimple ("What do you want from me?\r #L0##bGather up some information on the hideout.#l\r\n#L1#Take me to the hideout#l\r\n#L2#Nothing#l#k"); } function action(mode, type, selection) { if (mode < 1) { cm.dispose(); } else { status++; if (status == 1) { if (selection == 0) { cm.sendNext("I can take you to the hideout, but the place is infested with thugs looking for trouble. You'll need to be both incredibly strong and brave to enter the premise. At the hideaway, you'll find the Boss that controls all the other bosses around this area. It's easy to get to the hideout, but the room on the top floor of the place can only be entered ONCE a day. The Boss's Room is not a place to mess around. I suggest you don't stay there for too long; you'll need to swiftly take care of the business once inside. The boss himself is a difficult foe, but you'll run into some incredibly powerful enemies on you way to meeting the boss! It ain't going to be easy."); cm.dispose(); } else if (selection == 1) cm.sendNext("Oh, the brave one. I've been awaiting your arrival. If these\r\nthugs are left unchecked, there's no telling what going to\r\nhappen in this neighborhood. Before that happens, I hope\r\nyou take care of all them and beat the boss, who resides\r\non the 5th floor. You'll need to be on alert at all times, since\r\nthe boss is too tough for even wisemen to handle.\r\nLooking at your eyes, however, I can see that eye of the\r\ntiger, the eyes that tell me you can do this. Let's go!"); else { cm.sendOk("I'm a busy person! Leave me alone if that's all you need!"); cm.dispose(); } } else { cm.warp(801040000); cm.dispose(); } } }
NovaStory/AeroStory
scripts/npc/world0/9120015.js
JavaScript
gpl-3.0
3,358
{-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TypeFamilies #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-} -- Module : Network.AWS.CloudWatchLogs.PutLogEvents -- Copyright : (c) 2013-2014 Brendan Hay <[email protected]> -- License : This Source Code Form is subject to the terms of -- the Mozilla Public License, v. 2.0. -- A copy of the MPL can be found in the LICENSE file or -- you can obtain it at http://mozilla.org/MPL/2.0/. -- Maintainer : Brendan Hay <[email protected]> -- Stability : experimental -- Portability : non-portable (GHC extensions) -- -- Derived from AWS service descriptions, licensed under Apache 2.0. -- | Uploads a batch of log events to the specified log stream. -- -- Every PutLogEvents request must include the 'sequenceToken' obtained from the -- response of the previous request. An upload in a newly created log stream -- does not require a 'sequenceToken'. -- -- The batch of events must satisfy the following constraints: The maximum -- batch size is 32,768 bytes, and this size is calculated as the sum of all -- event messages in UTF-8, plus 26 bytes for each log event. None of the log -- events in the batch can be more than 2 hours in the future. None of the log -- events in the batch can be older than 14 days or the retention period of the -- log group. The log events in the batch must be in chronological ordered by -- their 'timestamp'. The maximum number of log events in a batch is 1,000. -- -- <http://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutLogEvents.html> module Network.AWS.CloudWatchLogs.PutLogEvents ( -- * Request PutLogEvents -- ** Request constructor , putLogEvents -- ** Request lenses , pleLogEvents , pleLogGroupName , pleLogStreamName , pleSequenceToken -- * Response , PutLogEventsResponse -- ** Response constructor , putLogEventsResponse -- ** Response lenses , plerNextSequenceToken ) where import Network.AWS.Prelude import Network.AWS.Request.JSON import Network.AWS.CloudWatchLogs.Types import qualified GHC.Exts data PutLogEvents = PutLogEvents { _pleLogEvents :: List1 "logEvents" InputLogEvent , _pleLogGroupName :: Text , _pleLogStreamName :: Text , _pleSequenceToken :: Maybe Text } deriving (Eq, Read, Show) -- | 'PutLogEvents' constructor. -- -- The fields accessible through corresponding lenses are: -- -- * 'pleLogEvents' @::@ 'NonEmpty' 'InputLogEvent' -- -- * 'pleLogGroupName' @::@ 'Text' -- -- * 'pleLogStreamName' @::@ 'Text' -- -- * 'pleSequenceToken' @::@ 'Maybe' 'Text' -- putLogEvents :: Text -- ^ 'pleLogGroupName' -> Text -- ^ 'pleLogStreamName' -> NonEmpty InputLogEvent -- ^ 'pleLogEvents' -> PutLogEvents putLogEvents p1 p2 p3 = PutLogEvents { _pleLogGroupName = p1 , _pleLogStreamName = p2 , _pleLogEvents = withIso _List1 (const id) p3 , _pleSequenceToken = Nothing } pleLogEvents :: Lens' PutLogEvents (NonEmpty InputLogEvent) pleLogEvents = lens _pleLogEvents (\s a -> s { _pleLogEvents = a }) . _List1 pleLogGroupName :: Lens' PutLogEvents Text pleLogGroupName = lens _pleLogGroupName (\s a -> s { _pleLogGroupName = a }) pleLogStreamName :: Lens' PutLogEvents Text pleLogStreamName = lens _pleLogStreamName (\s a -> s { _pleLogStreamName = a }) -- | A string token that must be obtained from the response of the previous 'PutLogEvents' request. pleSequenceToken :: Lens' PutLogEvents (Maybe Text) pleSequenceToken = lens _pleSequenceToken (\s a -> s { _pleSequenceToken = a }) newtype PutLogEventsResponse = PutLogEventsResponse { _plerNextSequenceToken :: Maybe Text } deriving (Eq, Ord, Read, Show, Monoid) -- | 'PutLogEventsResponse' constructor. -- -- The fields accessible through corresponding lenses are: -- -- * 'plerNextSequenceToken' @::@ 'Maybe' 'Text' -- putLogEventsResponse :: PutLogEventsResponse putLogEventsResponse = PutLogEventsResponse { _plerNextSequenceToken = Nothing } plerNextSequenceToken :: Lens' PutLogEventsResponse (Maybe Text) plerNextSequenceToken = lens _plerNextSequenceToken (\s a -> s { _plerNextSequenceToken = a }) instance ToPath PutLogEvents where toPath = const "/" instance ToQuery PutLogEvents where toQuery = const mempty instance ToHeaders PutLogEvents instance ToJSON PutLogEvents where toJSON PutLogEvents{..} = object [ "logGroupName" .= _pleLogGroupName , "logStreamName" .= _pleLogStreamName , "logEvents" .= _pleLogEvents , "sequenceToken" .= _pleSequenceToken ] instance AWSRequest PutLogEvents where type Sv PutLogEvents = CloudWatchLogs type Rs PutLogEvents = PutLogEventsResponse request = post "PutLogEvents" response = jsonResponse instance FromJSON PutLogEventsResponse where parseJSON = withObject "PutLogEventsResponse" $ \o -> PutLogEventsResponse <$> o .:? "nextSequenceToken"
dysinger/amazonka
amazonka-cloudwatch-logs/gen/Network/AWS/CloudWatchLogs/PutLogEvents.hs
Haskell
mpl-2.0
5,362
/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Copyright (c) 2015, Joyent, Inc. */ var test = require('./test-namer')('vm-to-zones'); var util = require('util'); var bunyan = require('bunyan'); var utils = require('../../lib/utils'); var buildZonesFromVm = require('../../lib/vm-to-zones'); var log = bunyan.createLogger({name: 'cns'}); test('basic single container', function (t) { var config = { forward_zones: { 'foo': {} }, reverse_zones: {} }; var vm = { uuid: 'abc123', services: [], listInstance: true, listServices: true, owner: { uuid: 'def432' }, nics: [ { ip: '1.2.3.4', zones: ['foo'] } ] }; var zones = buildZonesFromVm(vm, config, log); t.deepEqual(Object.keys(zones), ['foo', '3.2.1.in-addr.arpa']); t.deepEqual(Object.keys(zones['foo']), ['abc123.inst.def432']); t.deepEqual(Object.keys(zones['3.2.1.in-addr.arpa']), ['4']); var fwd = zones['foo']['abc123.inst.def432']; t.deepEqual(fwd, [ {constructor: 'A', args: ['1.2.3.4']}, {constructor: 'TXT', args: ['abc123']} ]); var rev = zones['3.2.1.in-addr.arpa']['4']; t.deepEqual(rev, [ {constructor: 'PTR', args: ['abc123.inst.def432.foo']} ]); t.end(); }); test('cloudapi instance', function (t) { var config = { forward_zones: { 'foo': {} }, reverse_zones: {} }; var vm = { uuid: 'abc123', services: [ { name: 'cloudapi', ports: [] } ], listInstance: true, listServices: true, owner: { uuid: 'def432', login: 'admin' }, nics: [ { ip: '1.2.3.4', zones: ['foo'] } ] }; var zones = buildZonesFromVm(vm, config, log); t.deepEqual(Object.keys(zones), ['foo', '3.2.1.in-addr.arpa']); t.deepEqual(Object.keys(zones['foo']), [ 'abc123.inst.def432', 'cloudapi.svc.def432', 'cloudapi']); t.deepEqual(Object.keys(zones['3.2.1.in-addr.arpa']), ['4']); var fwd = zones['foo']['cloudapi']; t.deepEqual(fwd, [ {constructor: 'A', args: ['1.2.3.4'], src: 'abc123'}, {constructor: 'TXT', args: ['abc123'], src: 'abc123'} ]); var rev = zones['3.2.1.in-addr.arpa']['4']; t.deepEqual(rev, [ {constructor: 'PTR', args: ['abc123.inst.def432.foo']} ]); t.end(); }); test('with use_alias', function (t) { var config = { use_alias: true, forward_zones: { 'foo': {} }, reverse_zones: {} }; var vm = { uuid: 'abc123', alias: 'test', services: [], listInstance: true, listServices: true, owner: { uuid: 'def432' }, nics: [ { ip: '1.2.3.4', zones: ['foo'] } ] }; var zones = buildZonesFromVm(vm, config, log); t.deepEqual(Object.keys(zones), ['foo', '3.2.1.in-addr.arpa']); t.deepEqual(Object.keys(zones['foo']), ['abc123.inst.def432', 'test.inst.def432']); t.deepEqual(Object.keys(zones['3.2.1.in-addr.arpa']), ['4']); var fwd = zones['foo']['test.inst.def432']; t.deepEqual(fwd, [ {constructor: 'A', args: ['1.2.3.4']}, {constructor: 'TXT', args: ['abc123']} ]); var rev = zones['3.2.1.in-addr.arpa']['4']; t.deepEqual(rev, [ {constructor: 'PTR', args: ['test.inst.def432.foo']} ]); t.end(); }); test('with use_login', function (t) { var config = { use_login: true, forward_zones: { 'foo': {} }, reverse_zones: {} }; var vm = { uuid: 'abc123', alias: 'test', services: [], listInstance: true, listServices: true, owner: { uuid: 'def432', login: 'bar' }, nics: [ { ip: '1.2.3.4', zones: ['foo'] } ] }; var zones = buildZonesFromVm(vm, config, log); t.deepEqual(Object.keys(zones), ['foo', '3.2.1.in-addr.arpa']); t.deepEqual(Object.keys(zones['foo']), ['abc123.inst.def432', 'abc123.inst.bar']); t.deepEqual(Object.keys(zones['3.2.1.in-addr.arpa']), ['4']); var fwd = zones['foo']['abc123.inst.bar']; t.deepEqual(fwd, [ {constructor: 'A', args: ['1.2.3.4']}, {constructor: 'TXT', args: ['abc123']} ]); var rev = zones['3.2.1.in-addr.arpa']['4']; t.deepEqual(rev, [ {constructor: 'PTR', args: ['abc123.inst.bar.foo']} ]); t.end(); }); test('with use_alias and use_login', function (t) { var config = { use_alias: true, use_login: true, forward_zones: { 'foo': {} }, reverse_zones: {} }; var vm = { uuid: 'abc123', alias: 'test', services: [], listInstance: true, listServices: true, owner: { uuid: 'def432', login: 'bar' }, nics: [ { ip: '1.2.3.4', zones: ['foo'] } ] }; var zones = buildZonesFromVm(vm, config, log); t.deepEqual(Object.keys(zones), ['foo', '3.2.1.in-addr.arpa']); t.deepEqual(Object.keys(zones['foo']), ['abc123.inst.def432', 'abc123.inst.bar', 'test.inst.def432', 'test.inst.bar']); t.deepEqual(Object.keys(zones['3.2.1.in-addr.arpa']), ['4']); var fwd = zones['foo']['test.inst.bar']; t.deepEqual(fwd, [ {constructor: 'A', args: ['1.2.3.4']}, {constructor: 'TXT', args: ['abc123']} ]); var rev = zones['3.2.1.in-addr.arpa']['4']; t.deepEqual(rev, [ {constructor: 'PTR', args: ['test.inst.bar.foo']} ]); t.end(); }); test('using a PTR name', function (t) { var config = { use_alias: true, use_login: true, forward_zones: { 'foo': {} }, reverse_zones: {} }; var vm = { uuid: 'abc123', alias: 'test', services: [], ptrname: 'test.something.com', listInstance: true, listServices: true, owner: { uuid: 'def432', login: 'bar' }, nics: [ { ip: '1.2.3.4', zones: ['foo'] } ] }; var zones = buildZonesFromVm(vm, config, log); t.deepEqual(Object.keys(zones), ['foo', '3.2.1.in-addr.arpa']); var rev = zones['3.2.1.in-addr.arpa']['4']; t.deepEqual(rev, [ {constructor: 'PTR', args: ['test.something.com']} ]); t.end(); }); test('multi-zone', function (t) { var config = { use_alias: true, use_login: true, forward_zones: { 'foo': {}, 'bar': {} }, reverse_zones: {} }; var vm = { uuid: 'abc123', alias: 'test', services: [], listInstance: true, listServices: true, owner: { uuid: 'def432', login: 'bar' }, nics: [ { ip: '1.2.3.4', zones: ['foo'] }, { ip: '3.2.1.4', zones: ['bar'] } ] }; var zones = buildZonesFromVm(vm, config, log); t.deepEqual(Object.keys(zones).sort(), ['1.2.3.in-addr.arpa', '3.2.1.in-addr.arpa', 'bar', 'foo']); t.deepEqual(Object.keys(zones['foo']).sort(), ['abc123.inst.bar', 'abc123.inst.def432', 'test.inst.bar', 'test.inst.def432']); t.deepEqual(Object.keys(zones['bar']).sort(), Object.keys(zones['foo']).sort()); t.deepEqual(Object.keys(zones['3.2.1.in-addr.arpa']), ['4']); t.deepEqual(Object.keys(zones['1.2.3.in-addr.arpa']), ['4']); var fwd = zones['foo']['test.inst.bar']; t.deepEqual(fwd, [ {constructor: 'A', args: ['1.2.3.4']}, {constructor: 'TXT', args: ['abc123']} ]); var rev = zones['3.2.1.in-addr.arpa']['4']; t.deepEqual(rev, [ {constructor: 'PTR', args: ['test.inst.bar.foo']} ]); var rev2 = zones['1.2.3.in-addr.arpa']['4']; t.deepEqual(rev2, [ {constructor: 'PTR', args: ['test.inst.bar.bar']} ]); t.end(); }); test('multi-zone, single PTRs', function (t) { var config = { use_alias: true, use_login: true, forward_zones: { 'foo': {}, 'bar': {}, 'baz': {} }, reverse_zones: {} }; var vm = { uuid: 'abc123', alias: 'test', services: [], listInstance: true, listServices: true, owner: { uuid: 'def432', login: 'bar' }, nics: [ { ip: '1.2.3.4', zones: ['foo', 'bar'] }, { ip: '3.2.1.4', zones: ['baz'] } ] }; var zones = buildZonesFromVm(vm, config, log); t.deepEqual(Object.keys(zones).sort(), ['1.2.3.in-addr.arpa', '3.2.1.in-addr.arpa', 'bar', 'baz', 'foo']); t.deepEqual(Object.keys(zones['foo']).sort(), ['abc123.inst.bar', 'abc123.inst.def432', 'test.inst.bar', 'test.inst.def432']); t.deepEqual(Object.keys(zones['bar']).sort(), Object.keys(zones['foo']).sort()); t.deepEqual(Object.keys(zones['3.2.1.in-addr.arpa']), ['4']); t.deepEqual(Object.keys(zones['1.2.3.in-addr.arpa']), ['4']); var fwd = zones['foo']['test.inst.bar']; t.deepEqual(fwd, [ {constructor: 'A', args: ['1.2.3.4']}, {constructor: 'TXT', args: ['abc123']} ]); var rev = zones['3.2.1.in-addr.arpa']['4']; t.deepEqual(rev, [ {constructor: 'PTR', args: ['test.inst.bar.foo']} ]); var rev2 = zones['1.2.3.in-addr.arpa']['4']; t.deepEqual(rev2, [ {constructor: 'PTR', args: ['test.inst.bar.baz']} ]); t.end(); }); test('multi-zone, shortest zone priority PTR', function (t) { var config = { use_alias: true, use_login: true, forward_zones: { 'foobarbaz': {}, 'foobar': {}, 'baz': {} }, reverse_zones: {} }; var vm = { uuid: 'abc123', alias: 'test', services: [], listInstance: true, listServices: true, owner: { uuid: 'def432', login: 'bar' }, nics: [ { ip: '1.2.3.4', zones: ['foobar', 'foobarbaz', 'baz'] } ] }; var zones = buildZonesFromVm(vm, config, log); var rev = zones['3.2.1.in-addr.arpa']['4']; t.deepEqual(rev, [ {constructor: 'PTR', args: ['test.inst.bar.baz']} ]); t.end(); }); test('service with srvs', function (t) { var config = { use_alias: true, forward_zones: { 'foo': {} }, reverse_zones: {} }; var vm = { uuid: 'abc123', alias: 'test', services: [ { name: 'svc1', ports: [1234, 1235] } ], listInstance: true, listServices: true, owner: { uuid: 'def432' }, nics: [ { ip: '1.2.3.4', zones: ['foo'] } ] }; var zones = buildZonesFromVm(vm, config, log); t.deepEqual(Object.keys(zones), ['foo', '3.2.1.in-addr.arpa']); t.deepEqual(Object.keys(zones['foo']), ['abc123.inst.def432', 'test.inst.def432', 'svc1.svc.def432']); var fwd = zones['foo']['test.inst.def432']; t.deepEqual(fwd, [ {constructor: 'A', args: ['1.2.3.4']}, {constructor: 'TXT', args: ['abc123']} ]); var svc = zones['foo']['svc1.svc.def432']; t.deepEqual(svc, [ {constructor: 'A', args: ['1.2.3.4'], src: 'abc123'}, {constructor: 'TXT', args: ['abc123'], src: 'abc123'}, {constructor: 'SRV', args: ['test.inst.def432.foo', 1234], src: 'abc123'}, {constructor: 'SRV', args: ['test.inst.def432.foo', 1235], src: 'abc123'} ]); t.end(); });
eait-itig/triton-cns
test/unit/vm-to-zones.test.js
JavaScript
mpl-2.0
10,814
from cProfile import Profile from optparse import make_option from django.conf import settings from django.core.management.base import (BaseCommand, CommandError) from treeherder.etl.buildapi import (Builds4hJobsProcess, PendingJobsProcess, RunningJobsProcess) from treeherder.etl.pushlog import HgPushlogProcess from treeherder.model.derived import RefDataManager class Command(BaseCommand): """Management command to ingest data from a single push.""" help = "Ingests a single push into treeherder" args = '<project> <changeset>' option_list = BaseCommand.option_list + ( make_option('--profile-file', action='store', dest='profile_file', default=None, help='Profile command and write result to profile file'), make_option('--filter-job-group', action='store', dest='filter_job_group', default=None, help="Only process jobs in specified group symbol " "(e.g. 'T')") ) def _handle(self, *args, **options): if len(args) != 2: raise CommandError("Need to specify (only) branch and changeset") (project, changeset) = args # get reference to repo rdm = RefDataManager() repos = filter(lambda x: x['name'] == project, rdm.get_all_repository_info()) if not repos: raise CommandError("No project found named '%s'" % project) repo = repos[0] # make sure all tasks are run synchronously / immediately settings.CELERY_ALWAYS_EAGER = True # get hg pushlog pushlog_url = '%s/json-pushes/?full=1&version=2' % repo['url'] # ingest this particular revision for this project process = HgPushlogProcess() # Use the actual push SHA, in case the changeset specified was a tag # or branch name (eg tip). HgPushlogProcess returns the full SHA, but # job ingestion expects the short version, so we truncate it. push_sha = process.run(pushlog_url, project, changeset=changeset)[0:12] Builds4hJobsProcess().run(filter_to_project=project, filter_to_revision=push_sha, filter_to_job_group=options['filter_job_group']) PendingJobsProcess().run(filter_to_project=project, filter_to_revision=push_sha, filter_to_job_group=options['filter_job_group']) RunningJobsProcess().run(filter_to_project=project, filter_to_revision=push_sha, filter_to_job_group=options['filter_job_group']) def handle(self, *args, **options): if options['profile_file']: profiler = Profile() profiler.runcall(self._handle, *args, **options) profiler.dump_stats(options['profile_file']) else: self._handle(*args, **options)
adusca/treeherder
treeherder/etl/management/commands/ingest_push.py
Python
mpl-2.0
3,195
<header class="navbar navbar-inverse navbar-fixed-top" role="navigation"> <div class="container"> <div class="container-fluid"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse" aria-expanded="false"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="#">Chamilo Messaging</a> </div> <div class="collapse navbar-collapse" id="navbar-collapse"> <ul class="nav navbar-nav navbar-right"> <li> <a href="#" id="messages-update"> <i class="glyphicon glyphicon-refresh"></i> Actualizar </a> </li> <li> <a href="#logout"> <i class="glyphicon glyphicon-log-out"></i> Cerrar sesiΓ³n </a> </li> </ul> </div> </div> </div> </header> <div class="container"> <div class="list-group" id="messages-list"></div> </div>
AngelFQC/fx-dev-edition
app/templates/inbox.html
HTML
mpl-2.0
1,387
<?php return function ($bh) { $bh->match('progressbar', function($ctx, $json) { $val = $json->val ?: 0; $ctx ->js([ 'val' => $val ]) ->content([ 'elem' => 'bar', 'attrs' => [ 'style' => 'width:' . $val . '%' ] ]); }); };
kompolom/bem-components-php
common.blocks/progressbar/progressbar.bh.php
PHP
mpl-2.0
314
// Copyright (c) 2016, 2018, 2021, Oracle and/or its affiliates. All rights reserved. // This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. // Code generated. DO NOT EDIT. // Management Agent API // // API for Management Agent Cloud Service // package managementagent // EditModesEnum Enum with underlying type: string type EditModesEnum string // Set of constants representing the allowable values for EditModesEnum const ( EditModesReadOnly EditModesEnum = "READ_ONLY" EditModesWritable EditModesEnum = "WRITABLE" EditModesExtensible EditModesEnum = "EXTENSIBLE" ) var mappingEditModes = map[string]EditModesEnum{ "READ_ONLY": EditModesReadOnly, "WRITABLE": EditModesWritable, "EXTENSIBLE": EditModesExtensible, } // GetEditModesEnumValues Enumerates the set of values for EditModesEnum func GetEditModesEnumValues() []EditModesEnum { values := make([]EditModesEnum, 0) for _, v := range mappingEditModes { values = append(values, v) } return values }
oracle/terraform-provider-baremetal
vendor/github.com/oracle/oci-go-sdk/v46/managementagent/edit_modes.go
GO
mpl-2.0
1,173
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "p12plcy.h" #include "secoid.h" #include "secport.h" #include "secpkcs5.h" #define PKCS12_NULL 0x0000 typedef struct pkcs12SuiteMapStr { SECOidTag algTag; unsigned int keyLengthBits; /* in bits */ unsigned long suite; PRBool allowed; PRBool preferred; } pkcs12SuiteMap; static pkcs12SuiteMap pkcs12SuiteMaps[] = { { SEC_OID_RC4, 40, PKCS12_RC4_40, PR_FALSE, PR_FALSE }, { SEC_OID_RC4, 128, PKCS12_RC4_128, PR_FALSE, PR_FALSE }, { SEC_OID_RC2_CBC, 40, PKCS12_RC2_CBC_40, PR_FALSE, PR_TRUE }, { SEC_OID_RC2_CBC, 128, PKCS12_RC2_CBC_128, PR_FALSE, PR_FALSE }, { SEC_OID_DES_CBC, 64, PKCS12_DES_56, PR_FALSE, PR_FALSE }, { SEC_OID_DES_EDE3_CBC, 192, PKCS12_DES_EDE3_168, PR_FALSE, PR_FALSE }, { SEC_OID_UNKNOWN, 0, PKCS12_NULL, PR_FALSE, PR_FALSE }, { SEC_OID_UNKNOWN, 0, 0L, PR_FALSE, PR_FALSE } }; /* determine if algid is an algorithm which is allowed */ PRBool SEC_PKCS12DecryptionAllowed(SECAlgorithmID *algid) { unsigned int keyLengthBits; SECOidTag algId; int i; algId = SEC_PKCS5GetCryptoAlgorithm(algid); if (algId == SEC_OID_UNKNOWN) { return PR_FALSE; } keyLengthBits = (unsigned int)(SEC_PKCS5GetKeyLength(algid) * 8); i = 0; while (pkcs12SuiteMaps[i].algTag != SEC_OID_UNKNOWN) { if ((pkcs12SuiteMaps[i].algTag == algId) && (pkcs12SuiteMaps[i].keyLengthBits == keyLengthBits)) { return pkcs12SuiteMaps[i].allowed; } i++; } return PR_FALSE; } /* is any encryption allowed? */ PRBool SEC_PKCS12IsEncryptionAllowed(void) { int i; i = 0; while (pkcs12SuiteMaps[i].algTag != SEC_OID_UNKNOWN) { if (pkcs12SuiteMaps[i].allowed == PR_TRUE) { return PR_TRUE; } i++; } return PR_FALSE; } SECStatus SEC_PKCS12EnableCipher(long which, int on) { int i; i = 0; while (pkcs12SuiteMaps[i].suite != 0L) { if (pkcs12SuiteMaps[i].suite == (unsigned long)which) { if (on) { pkcs12SuiteMaps[i].allowed = PR_TRUE; } else { pkcs12SuiteMaps[i].allowed = PR_FALSE; } return SECSuccess; } i++; } return SECFailure; } SECStatus SEC_PKCS12SetPreferredCipher(long which, int on) { int i; PRBool turnedOff = PR_FALSE; PRBool turnedOn = PR_FALSE; i = 0; while (pkcs12SuiteMaps[i].suite != 0L) { if (pkcs12SuiteMaps[i].preferred == PR_TRUE) { pkcs12SuiteMaps[i].preferred = PR_FALSE; turnedOff = PR_TRUE; } if (pkcs12SuiteMaps[i].suite == (unsigned long)which) { pkcs12SuiteMaps[i].preferred = PR_TRUE; turnedOn = PR_TRUE; } i++; } if ((turnedOn) && (turnedOff)) { return SECSuccess; } return SECFailure; }
Yukarumya/Yukarum-Redfoxes
security/nss/lib/pkcs12/p12plcy.c
C
mpl-2.0
3,082
//***************************************************************************** // // startup_gcc.c - Startup code for use with GNU tools. // // Copyright (c) 2012-2013 Texas Instruments Incorporated. All rights reserved. // Software License Agreement // // Texas Instruments (TI) is supplying this software for use solely and // exclusively on TI's microcontroller products. The software is owned by // TI and/or its suppliers, and is protected under applicable copyright // laws. You may not combine this software with "viral" open-source // software in order to form a larger program. // // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL // DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2.0.1.11577 of the EK-TM4C123GXL Firmware Package. // //***************************************************************************** #include <stdint.h> #include "inc/hw_nvic.h" #include "inc/hw_types.h" //***************************************************************************** // // Forward declaration of the default fault handlers. // //***************************************************************************** void ResetISR(void); static void NmiSR(void); static void FaultISR(void); static void IntDefaultHandler(void); //***************************************************************************** // // External declarations for the interrupt handlers used by the application. // //***************************************************************************** extern void SysTickIntHandler(void); extern void USBUARTIntHandler(void); extern void USB0DeviceIntHandler(void); //***************************************************************************** // // The entry point for the application. // //***************************************************************************** extern int main(void); //***************************************************************************** // // Reserve space for the system stack. // //***************************************************************************** static uint32_t pui32Stack[256]; //***************************************************************************** // // The vector table. Note that the proper constructs must be placed on this to // ensure that it ends up at physical address 0x0000.0000. // //***************************************************************************** __attribute__ ((section(".isr_vector"))) void (* const g_pfnVectors[])(void) = { (void (*)(void))((uint32_t)pui32Stack + sizeof(pui32Stack)), // The initial stack pointer ResetISR, // The reset handler NmiSR, // The NMI handler FaultISR, // The hard fault handler IntDefaultHandler, // The MPU fault handler IntDefaultHandler, // The bus fault handler IntDefaultHandler, // The usage fault handler 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved IntDefaultHandler, // SVCall handler IntDefaultHandler, // Debug monitor handler 0, // Reserved IntDefaultHandler, // The PendSV handler SysTickIntHandler, // The SysTick handler IntDefaultHandler, // GPIO Port A IntDefaultHandler, // GPIO Port B IntDefaultHandler, // GPIO Port C IntDefaultHandler, // GPIO Port D IntDefaultHandler, // GPIO Port E USBUARTIntHandler, // UART0 Rx and Tx IntDefaultHandler, // UART1 Rx and Tx IntDefaultHandler, // SSI0 Rx and Tx IntDefaultHandler, // I2C0 Master and Slave IntDefaultHandler, // PWM Fault IntDefaultHandler, // PWM Generator 0 IntDefaultHandler, // PWM Generator 1 IntDefaultHandler, // PWM Generator 2 IntDefaultHandler, // Quadrature Encoder 0 IntDefaultHandler, // ADC Sequence 0 IntDefaultHandler, // ADC Sequence 1 IntDefaultHandler, // ADC Sequence 2 IntDefaultHandler, // ADC Sequence 3 IntDefaultHandler, // Watchdog timer IntDefaultHandler, // Timer 0 subtimer A IntDefaultHandler, // Timer 0 subtimer B IntDefaultHandler, // Timer 1 subtimer A IntDefaultHandler, // Timer 1 subtimer B IntDefaultHandler, // Timer 2 subtimer A IntDefaultHandler, // Timer 2 subtimer B IntDefaultHandler, // Analog Comparator 0 IntDefaultHandler, // Analog Comparator 1 IntDefaultHandler, // Analog Comparator 2 IntDefaultHandler, // System Control (PLL, OSC, BO) IntDefaultHandler, // FLASH Control IntDefaultHandler, // GPIO Port F IntDefaultHandler, // GPIO Port G IntDefaultHandler, // GPIO Port H IntDefaultHandler, // UART2 Rx and Tx IntDefaultHandler, // SSI1 Rx and Tx IntDefaultHandler, // Timer 3 subtimer A IntDefaultHandler, // Timer 3 subtimer B IntDefaultHandler, // I2C1 Master and Slave IntDefaultHandler, // Quadrature Encoder 1 IntDefaultHandler, // CAN0 IntDefaultHandler, // CAN1 IntDefaultHandler, // CAN2 0, // Reserved IntDefaultHandler, // Hibernate USB0DeviceIntHandler, // USB0 IntDefaultHandler, // PWM Generator 3 IntDefaultHandler, // uDMA Software Transfer IntDefaultHandler, // uDMA Error IntDefaultHandler, // ADC1 Sequence 0 IntDefaultHandler, // ADC1 Sequence 1 IntDefaultHandler, // ADC1 Sequence 2 IntDefaultHandler, // ADC1 Sequence 3 0, // Reserved 0, // Reserved IntDefaultHandler, // GPIO Port J IntDefaultHandler, // GPIO Port K IntDefaultHandler, // GPIO Port L IntDefaultHandler, // SSI2 Rx and Tx IntDefaultHandler, // SSI3 Rx and Tx IntDefaultHandler, // UART3 Rx and Tx IntDefaultHandler, // UART4 Rx and Tx IntDefaultHandler, // UART5 Rx and Tx IntDefaultHandler, // UART6 Rx and Tx IntDefaultHandler, // UART7 Rx and Tx 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved IntDefaultHandler, // I2C2 Master and Slave IntDefaultHandler, // I2C3 Master and Slave IntDefaultHandler, // Timer 4 subtimer A IntDefaultHandler, // Timer 4 subtimer B 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved IntDefaultHandler, // Timer 5 subtimer A IntDefaultHandler, // Timer 5 subtimer B IntDefaultHandler, // Wide Timer 0 subtimer A IntDefaultHandler, // Wide Timer 0 subtimer B IntDefaultHandler, // Wide Timer 1 subtimer A IntDefaultHandler, // Wide Timer 1 subtimer B IntDefaultHandler, // Wide Timer 2 subtimer A IntDefaultHandler, // Wide Timer 2 subtimer B IntDefaultHandler, // Wide Timer 3 subtimer A IntDefaultHandler, // Wide Timer 3 subtimer B IntDefaultHandler, // Wide Timer 4 subtimer A IntDefaultHandler, // Wide Timer 4 subtimer B IntDefaultHandler, // Wide Timer 5 subtimer A IntDefaultHandler, // Wide Timer 5 subtimer B IntDefaultHandler, // FPU 0, // Reserved 0, // Reserved IntDefaultHandler, // I2C4 Master and Slave IntDefaultHandler, // I2C5 Master and Slave IntDefaultHandler, // GPIO Port M IntDefaultHandler, // GPIO Port N IntDefaultHandler, // Quadrature Encoder 2 0, // Reserved 0, // Reserved IntDefaultHandler, // GPIO Port P (Summary or P0) IntDefaultHandler, // GPIO Port P1 IntDefaultHandler, // GPIO Port P2 IntDefaultHandler, // GPIO Port P3 IntDefaultHandler, // GPIO Port P4 IntDefaultHandler, // GPIO Port P5 IntDefaultHandler, // GPIO Port P6 IntDefaultHandler, // GPIO Port P7 IntDefaultHandler, // GPIO Port Q (Summary or Q0) IntDefaultHandler, // GPIO Port Q1 IntDefaultHandler, // GPIO Port Q2 IntDefaultHandler, // GPIO Port Q3 IntDefaultHandler, // GPIO Port Q4 IntDefaultHandler, // GPIO Port Q5 IntDefaultHandler, // GPIO Port Q6 IntDefaultHandler, // GPIO Port Q7 IntDefaultHandler, // GPIO Port R IntDefaultHandler, // GPIO Port S IntDefaultHandler, // PWM 1 Generator 0 IntDefaultHandler, // PWM 1 Generator 1 IntDefaultHandler, // PWM 1 Generator 2 IntDefaultHandler, // PWM 1 Generator 3 IntDefaultHandler // PWM 1 Fault }; //***************************************************************************** // // The following are constructs created by the linker, indicating where the // the "data" and "bss" segments reside in memory. The initializers for the // for the "data" segment resides immediately following the "text" segment. // //***************************************************************************** extern uint32_t _etext; extern uint32_t _data; extern uint32_t _edata; extern uint32_t _bss; extern uint32_t _ebss; //***************************************************************************** // // This is the code that gets called when the processor first starts execution // following a reset event. Only the absolutely necessary set is performed, // after which the application supplied entry() routine is called. Any fancy // actions (such as making decisions based on the reset cause register, and // resetting the bits in that register) are left solely in the hands of the // application. // //***************************************************************************** void ResetISR(void) { uint32_t *pui32Src, *pui32Dest; // // Copy the data segment initializers from flash to SRAM. // pui32Src = &_etext; for(pui32Dest = &_data; pui32Dest < &_edata; ) { *pui32Dest++ = *pui32Src++; } // // Zero fill the bss segment. // __asm(" ldr r0, =_bss\n" " ldr r1, =_ebss\n" " mov r2, #0\n" " .thumb_func\n" "zero_loop:\n" " cmp r0, r1\n" " it lt\n" " strlt r2, [r0], #4\n" " blt zero_loop"); // // Enable the floating-point unit. This must be done here to handle the // case where main() uses floating-point and the function prologue saves // floating-point registers (which will fault if floating-point is not // enabled). Any configuration of the floating-point unit using DriverLib // APIs must be done here prior to the floating-point unit being enabled. // // Note that this does not use DriverLib since it might not be included in // this project. // HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); // // Call the application's entry point. // main(); } //***************************************************************************** // // This is the code that gets called when the processor receives a NMI. This // simply enters an infinite loop, preserving the system state for examination // by a debugger. // //***************************************************************************** static void NmiSR(void) { // // Enter an infinite loop. // while(1) { } } //***************************************************************************** // // This is the code that gets called when the processor receives a fault // interrupt. This simply enters an infinite loop, preserving the system state // for examination by a debugger. // //***************************************************************************** static void FaultISR(void) { // // Enter an infinite loop. // while(1) { } } //***************************************************************************** // // This is the code that gets called when the processor receives an unexpected // interrupt. This simply enters an infinite loop, preserving the system state // for examination by a debugger. // //***************************************************************************** static void IntDefaultHandler(void) { // // Go into an infinite loop. // while(1) { } }
trfiladelfo/unesp_mdt
boards/SW-TM4C-2.0.1.11577/examples/boards/ek-tm4c123gxl/usb_dev_serial/startup_gcc.c
C
mpl-2.0
16,631
package de.maxgb.vertretungsplan.manager; import android.content.Context; import android.os.AsyncTask; import de.maxgb.android.util.Logger; import de.maxgb.vertretungsplan.util.Constants; import de.maxgb.vertretungsplan.util.Stunde; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; public class StundenplanManager { public static final int BEGINN_NACHMITTAG = 8; public static final int ANZAHL_SAMSTAG = 4; public static final int ANZAHL_NACHMITTAG = 2; private static StundenplanManager instance; public static synchronized StundenplanManager getInstance(Context context) { if (instance == null) { instance = new StundenplanManager(context); } return instance; } private final String TAG = "StundenplanManager"; private int lastResult = 0; private ArrayList<Stunde[]> woche; private Context context; // Listener------------- private ArrayList<OnUpdateListener> listener = new ArrayList<OnUpdateListener>(); private StundenplanManager(Context context) { this.context = context; auswerten(); } public void asyncAuswerten() { AuswertenTask task = new AuswertenTask(); task.execute(); } public void auswerten() { lastResult = dateiAuswerten(); if (lastResult == -1) { } else { woche = null; } } public void auswertenWithNotify() { auswerten(); notifyListener(); } public ArrayList<Stunde[]> getClonedStundenplan() { if (woche == null) return null; ArrayList<Stunde[]> clone; try { clone = new ArrayList<Stunde[]>(woche.size()); for (Stunde[] item : woche) { Stunde[] clone2 = new Stunde[item.length]; for (int i = 0; i < item.length; i++) { clone2[i] = item[i].clone(); } clone.add(clone2); } return clone; } catch (NullPointerException e) { Logger.e(TAG, "Failed to clone stundenplan", e); return null; } } public String getLastResult() { switch (lastResult) { case -1: return "Erfolgreich ausgewertet"; case 1: return "Datei existiert nicht"; case 2: return "Kann Datei nicht lesen"; case 3: return "Zugriffsfehler"; case 4: return "Parsingfehler"; default: return "Noch nicht ausgewertet"; } } public ArrayList<Stunde[]> getStundenplan() { return woche; } public void notifyListener() { for (int i = 0; i < listener.size(); i++) { if (listener.get(i) != null) { listener.get(i).onStundenplanUpdate(); } } } public void registerOnUpdateListener(OnUpdateListener listener) { this.listener.add(listener); } public void unregisterOnUpdateListener(OnUpdateListener listener) { this.listener.remove(listener); } private Stunde[] convertJSONArrayToStundenArray(JSONArray tag) throws JSONException { Stunde[] result = new Stunde[BEGINN_NACHMITTAG - 1 + ANZAHL_NACHMITTAG]; for (int i = 0; i < BEGINN_NACHMITTAG - 1 + ANZAHL_NACHMITTAG; i++) { JSONArray stunde = tag.getJSONArray(i); if (i >= BEGINN_NACHMITTAG - 1) { result[i] = new Stunde(stunde.getString(0), stunde.getString(1), i + 1, stunde.getString(2)); } else { result[i] = new Stunde(stunde.getString(0), stunde.getString(1), i + 1); } } return result; } /** * Wertet die Stundenplandatei aus * * @return Fehlercode -1 bei Erfolg,1 Datei existiert nicht, 2 Datei kann nicht gelesen werden,3 Fehler beim Lesen,4 Fehler * beim Parsen * */ private int dateiAuswerten() { File loadoutFile = new File(context.getFilesDir(), Constants.SP_FILE_NAME); ArrayList<Stunde[]> w = new ArrayList<Stunde[]>(); if (!loadoutFile.exists()) { Logger.w(TAG, "Stundenplan file doesnΒ΄t exist"); return 1; } if (!loadoutFile.canRead()) { Logger.w(TAG, "CanΒ΄t read Stundenplan file"); return 2; } try { BufferedReader br = new BufferedReader(new FileReader(loadoutFile)); String line = br.readLine(); br.close(); JSONObject stundenplan = new JSONObject(line); JSONArray mo = stundenplan.getJSONArray("mo"); JSONArray di = stundenplan.getJSONArray("di"); JSONArray mi = stundenplan.getJSONArray("mi"); JSONArray d = stundenplan.getJSONArray("do"); JSONArray fr = stundenplan.getJSONArray("fr"); JSONObject sa = stundenplan.getJSONObject("sa"); // Samstag Stunde[] samstag = new Stunde[9]; JSONArray eins = sa.getJSONArray("0"); JSONArray zwei = sa.getJSONArray("1"); JSONArray drei = sa.getJSONArray("2"); JSONArray vier = sa.getJSONArray("3"); JSONArray acht = sa.getJSONArray("7"); JSONArray neun = sa.getJSONArray("8"); samstag[0] = new Stunde(eins.getString(0), eins.getString(1), 1); samstag[1] = new Stunde(zwei.getString(0), zwei.getString(1), 2); samstag[2] = new Stunde(drei.getString(0), drei.getString(1), 3); samstag[3] = new Stunde(vier.getString(0), vier.getString(1), 4); samstag[4] = new Stunde("", "", 5); samstag[5] = new Stunde("", "", 6); samstag[6] = new Stunde("", "", 7); samstag[7] = new Stunde(acht.getString(0), acht.getString(1), 8, acht.getString(2)); samstag[8] = new Stunde(neun.getString(0), neun.getString(1), 9, neun.getString(2)); w.add(convertJSONArrayToStundenArray(mo)); w.add(convertJSONArrayToStundenArray(di)); w.add(convertJSONArrayToStundenArray(mi)); w.add(convertJSONArrayToStundenArray(d)); w.add(convertJSONArrayToStundenArray(fr)); w.add(samstag); /* * for(int i=0;i<w.size();i++){ for(int j=0;j<w.get(i).length;j++){ System.out.println(w.get(i)[j].toString()); } } */ } catch (IOException e) { Logger.e(TAG, "Fehler beim Lesen der Datei", e); return 3; } catch (JSONException e) { Logger.e(TAG, "Fehler beim Parsen der Datei", e); return 4; } woche = w; return -1; } public interface OnUpdateListener { void onStundenplanUpdate(); } // ------------------------ private class AuswertenTask extends AsyncTask<Void, Void, Void> { @Override protected Void doInBackground(Void... params) { auswerten(); return null; } @Override protected void onPostExecute(Void v) { notifyListener(); } } }
maxanier/Vertretungsplan
app/src/main/java/de/maxgb/vertretungsplan/manager/StundenplanManager.java
Java
mpl-2.0
6,174
import tape from 'tape' import Common, { Chain, Hardfork } from '@ethereumjs/common' import { FeeMarketEIP1559Transaction } from '@ethereumjs/tx' import { Block } from '@ethereumjs/block' import { PeerPool } from '../../lib/net/peerpool' import { TxPool } from '../../lib/sync/txpool' import { Config } from '../../lib/config' tape('[TxPool]', async (t) => { const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.London }) const config = new Config({ transports: [] }) const A = { address: Buffer.from('0b90087d864e82a284dca15923f3776de6bb016f', 'hex'), privateKey: Buffer.from( '64bf9cc30328b0e42387b3c82c614e6386259136235e20c1357bd11cdee86993', 'hex' ), } const B = { address: Buffer.from('6f62d8382bf2587361db73ceca28be91b2acb6df', 'hex'), privateKey: Buffer.from( '2a6e9ad5a6a8e4f17149b8bc7128bf090566a11dbd63c30e5a0ee9f161309cd6', 'hex' ), } const createTx = (from = A, to = B, nonce = 0, value = 1) => { const txData = { nonce, maxFeePerGas: 1000000000, maxInclusionFeePerGas: 100000000, gasLimit: 100000, to: to.address, value, } const tx = FeeMarketEIP1559Transaction.fromTxData(txData, { common }) const signedTx = tx.sign(from.privateKey) return signedTx } const txA01 = createTx() // A -> B, nonce: 0, value: 1 const txA02 = createTx(A, B, 0, 2) // A -> B, nonce: 0, value: 2 (different hash) const txB01 = createTx(B, A) // B -> A, nonce: 0, value: 1 const txB02 = createTx(B, A, 1, 5) // B -> A, nonce: 1, value: 5 t.test('should initialize correctly', (t) => { const config = new Config({ transports: [] }) const pool = new TxPool({ config }) t.equal(pool.pool.size, 0, 'pool empty') t.notOk((pool as any).opened, 'pool not opened yet') pool.open() t.ok((pool as any).opened, 'pool opened') pool.start() t.ok((pool as any).running, 'pool running') pool.stop() t.notOk((pool as any).running, 'pool not running anymore') pool.close() t.notOk((pool as any).opened, 'pool not opened anymore') t.end() }) t.test('should open/close', async (t) => { t.plan(3) const config = new Config({ transports: [] }) const pool = new TxPool({ config }) pool.open() pool.start() t.ok((pool as any).opened, 'pool opened') t.equals(pool.open(), false, 'already opened') pool.stop() pool.close() t.notOk((pool as any).opened, 'closed') }) t.test('announcedTxHashes() -> add single tx / knownByPeer / getByHash()', async (t) => { // Safeguard that send() method from peer2 gets called t.plan(12) const pool = new TxPool({ config }) pool.open() pool.start() const peer: any = { id: '1', eth: { getPooledTransactions: () => { return [null, [txA01]] }, send: () => { t.fail('should not send to announcing peer') }, }, } let sentToPeer2 = 0 const peer2: any = { id: '2', eth: { send: () => { sentToPeer2++ t.equal(sentToPeer2, 1, 'should send once to non-announcing peer') }, }, } const peerPool = new PeerPool({ config }) peerPool.add(peer) peerPool.add(peer2) await pool.handleAnnouncedTxHashes([txA01.hash()], peer, peerPool) t.equal(pool.pool.size, 1, 'pool size 1') t.equal((pool as any).pending.length, 0, 'cleared pending txs') t.equal((pool as any).handled.size, 1, 'added to handled txs') t.equal((pool as any).knownByPeer.size, 2, 'known tx hashes size 2 (entries for both peers)') t.equal((pool as any).knownByPeer.get(peer.id).length, 1, 'one tx added for peer 1') t.equal( (pool as any).knownByPeer.get(peer.id)[0].hash, txA01.hash().toString('hex'), 'new known tx hashes entry for announcing peer' ) const txs = pool.getByHash([txA01.hash()]) t.equal(txs.length, 1, 'should get correct number of txs by hash') t.equal( txs[0].serialize().toString('hex'), txA01.serialize().toString('hex'), 'should get correct tx by hash' ) pool.pool.clear() await pool.handleAnnouncedTxHashes([txA01.hash()], peer, peerPool) t.equal(pool.pool.size, 0, 'should not add a once handled tx') t.equal( (pool as any).knownByPeer.get(peer.id).length, 1, 'should add tx only once to known tx hashes' ) t.equal((pool as any).knownByPeer.size, 2, 'known tx hashes size 2 (entries for both peers)') pool.stop() pool.close() }) t.test('announcedTxHashes() -> TX_RETRIEVAL_LIMIT', async (t) => { const pool = new TxPool({ config }) const TX_RETRIEVAL_LIMIT: number = (pool as any).TX_RETRIEVAL_LIMIT pool.open() pool.start() const peer = { eth: { getPooledTransactions: (res: any) => { t.equal(res['hashes'].length, TX_RETRIEVAL_LIMIT, 'should limit to TX_RETRIEVAL_LIMIT') return [null, []] }, }, } const peerPool = new PeerPool({ config }) const hashes = [] for (let i = 1; i <= TX_RETRIEVAL_LIMIT + 1; i++) { // One more than TX_RETRIEVAL_LIMIT hashes.push(Buffer.from(i.toString().padStart(64, '0'), 'hex')) // '0000000000000000000000000000000000000000000000000000000000000001',... } await pool.handleAnnouncedTxHashes(hashes, peer as any, peerPool) pool.stop() pool.close() }) t.test('announcedTxHashes() -> add two txs (different sender)', async (t) => { const pool = new TxPool({ config }) pool.open() pool.start() const peer: any = { eth: { getPooledTransactions: () => { return [null, [txA01, txB01]] }, }, } const peerPool = new PeerPool({ config }) await pool.handleAnnouncedTxHashes([txA01.hash(), txB01.hash()], peer, peerPool) t.equal(pool.pool.size, 2, 'pool size 2') pool.stop() pool.close() }) t.test('announcedTxHashes() -> add two txs (same sender and nonce)', async (t) => { const config = new Config({ transports: [] }) const pool = new TxPool({ config }) pool.open() pool.start() const peer: any = { eth: { getPooledTransactions: () => { return [null, [txA01, txA02]] }, }, } const peerPool = new PeerPool({ config }) await pool.handleAnnouncedTxHashes([txA01.hash(), txA02.hash()], peer, peerPool) t.equal(pool.pool.size, 1, 'pool size 1') const address = A.address.toString('hex') const poolContent = pool.pool.get(address)! t.equal(poolContent.length, 1, 'only one tx') t.deepEqual(poolContent[0].tx.hash(), txA02.hash(), 'only later-added tx') pool.stop() pool.close() }) t.test('announcedTxs()', async (t) => { const config = new Config({ transports: [] }) const pool = new TxPool({ config }) pool.open() pool.start() const peer: any = { eth: { send: () => {}, }, } const peerPool = new PeerPool({ config }) await pool.handleAnnouncedTxs([txA01], peer, peerPool) t.equal(pool.pool.size, 1, 'pool size 1') const address = A.address.toString('hex') const poolContent = pool.pool.get(address)! t.equal(poolContent.length, 1, 'one tx') t.deepEqual(poolContent[0].tx.hash(), txA01.hash(), 'correct tx') pool.stop() pool.close() }) t.test('newBlocks() -> should remove included txs', async (t) => { const config = new Config({ transports: [] }) const pool = new TxPool({ config }) pool.open() pool.start() let peer: any = { eth: { getPooledTransactions: () => { return [null, [txA01]] }, }, } const peerPool = new PeerPool({ config }) await pool.handleAnnouncedTxHashes([txA01.hash()], peer, peerPool) t.equal(pool.pool.size, 1, 'pool size 1') // Craft block with tx not in pool let block = Block.fromBlockData({ transactions: [txA02] }, { common }) pool.removeNewBlockTxs([block]) t.equal(pool.pool.size, 1, 'pool size 1') // Craft block with tx in pool block = Block.fromBlockData({ transactions: [txA01] }, { common }) pool.removeNewBlockTxs([block]) t.equal(pool.pool.size, 0, 'pool should be empty') peer = { eth: { getPooledTransactions: () => { return [null, [txB01, txB02]] }, }, } await pool.handleAnnouncedTxHashes([txB01.hash(), txB02.hash()], peer, peerPool) t.equal(pool.pool.size, 1, 'pool size 1') const address = B.address.toString('hex') let poolContent = pool.pool.get(address)! t.equal(poolContent.length, 2, 'two txs') // Craft block with tx not in pool block = Block.fromBlockData({ transactions: [txA02] }, { common }) pool.removeNewBlockTxs([block]) t.equal(pool.pool.size, 1, 'pool size 1') poolContent = pool.pool.get(address)! t.equal(poolContent.length, 2, 'two txs') // Craft block with tx in pool block = Block.fromBlockData({ transactions: [txB01] }, { common }) pool.removeNewBlockTxs([block]) poolContent = pool.pool.get(address)! t.equal(poolContent.length, 1, 'only one tx') // Craft block with tx in pool block = Block.fromBlockData({ transactions: [txB02] }, { common }) pool.removeNewBlockTxs([block]) t.equal(pool.pool.size, 0, 'pool size 0') pool.stop() pool.close() }) t.test('cleanup()', async (t) => { const pool = new TxPool({ config }) pool.open() pool.start() const peer: any = { eth: { getPooledTransactions: () => { return [null, [txA01, txB01]] }, }, send: () => {}, } const peerPool = new PeerPool({ config }) peerPool.add(peer) await pool.handleAnnouncedTxHashes([txA01.hash(), txB01.hash()], peer, peerPool) t.equal(pool.pool.size, 2, 'pool size 2') t.equal((pool as any).handled.size, 2, 'handled size 2') t.equal((pool as any).knownByPeer.size, 1, 'known by peer size 1') t.equal((pool as any).knownByPeer.get(peer.id).length, 2, '2 known txs') pool.cleanup() t.equal( pool.pool.size, 2, 'should not remove txs from pool (POOLED_STORAGE_TIME_LIMIT within range)' ) t.equal( (pool as any).knownByPeer.size, 1, 'should not remove txs from known by peer map (POOLED_STORAGE_TIME_LIMIT within range)' ) t.equal( (pool as any).handled.size, 2, 'should not remove txs from handled (HANDLED_CLEANUP_TIME_LIMIT within range)' ) const address = txB01.getSenderAddress().toString().slice(2) const poolObj = pool.pool.get(address)![0] poolObj.added = Date.now() - pool.POOLED_STORAGE_TIME_LIMIT * 60 - 1 pool.pool.set(address, [poolObj]) const knownByPeerObj1 = (pool as any).knownByPeer.get(peer.id)[0] const knownByPeerObj2 = (pool as any).knownByPeer.get(peer.id)[1] knownByPeerObj1.added = Date.now() - pool.POOLED_STORAGE_TIME_LIMIT * 60 - 1 ;(pool as any).knownByPeer.set(peer.id, [knownByPeerObj1, knownByPeerObj2]) const hash = txB01.hash().toString('hex') const handledObj = (pool as any).handled.get(hash) handledObj.added = Date.now() - pool.HANDLED_CLEANUP_TIME_LIMIT * 60 - 1 ;(pool as any).handled.set(hash, handledObj) pool.cleanup() t.equal( pool.pool.size, 1, 'should remove txs from pool (POOLED_STORAGE_TIME_LIMIT before range)' ) t.equal( (pool as any).knownByPeer.get(peer.id).length, 1, 'should remove one tx from known by peer map (POOLED_STORAGE_TIME_LIMIT before range)' ) t.equal( (pool as any).handled.size, 1, 'should remove txs from handled (HANDLED_CLEANUP_TIME_LIMIT before range)' ) pool.stop() pool.close() }) })
ethereumjs/ethereumjs-vm
packages/client/test/sync/txpool.spec.ts
TypeScript
mpl-2.0
11,829
{-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} {-# OPTIONS_GHC -fno-warn-duplicate-exports #-} {-# OPTIONS_GHC -fno-warn-unused-binds #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-} -- | -- Module : Network.Google.Resource.GamesConfiguration.AchievementConfigurations.Get -- Copyright : (c) 2015-2016 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay <[email protected]> -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Retrieves the metadata of the achievement configuration with the given -- ID. -- -- /See:/ <https://developers.google.com/games/ Google Play Game Services Publishing API Reference> for @gamesConfiguration.achievementConfigurations.get@. module Network.Google.Resource.GamesConfiguration.AchievementConfigurations.Get ( -- * REST Resource AchievementConfigurationsGetResource -- * Creating a Request , achievementConfigurationsGet , AchievementConfigurationsGet -- * Request Lenses , acgXgafv , acgUploadProtocol , acgAchievementId , acgAccessToken , acgUploadType , acgCallback ) where import Network.Google.GamesConfiguration.Types import Network.Google.Prelude -- | A resource alias for @gamesConfiguration.achievementConfigurations.get@ method which the -- 'AchievementConfigurationsGet' request conforms to. type AchievementConfigurationsGetResource = "games" :> "v1configuration" :> "achievements" :> Capture "achievementId" Text :> QueryParam "$.xgafv" Xgafv :> QueryParam "upload_protocol" Text :> QueryParam "access_token" Text :> QueryParam "uploadType" Text :> QueryParam "callback" Text :> QueryParam "alt" AltJSON :> Get '[JSON] AchievementConfiguration -- | Retrieves the metadata of the achievement configuration with the given -- ID. -- -- /See:/ 'achievementConfigurationsGet' smart constructor. data AchievementConfigurationsGet = AchievementConfigurationsGet' { _acgXgafv :: !(Maybe Xgafv) , _acgUploadProtocol :: !(Maybe Text) , _acgAchievementId :: !Text , _acgAccessToken :: !(Maybe Text) , _acgUploadType :: !(Maybe Text) , _acgCallback :: !(Maybe Text) } deriving (Eq, Show, Data, Typeable, Generic) -- | Creates a value of 'AchievementConfigurationsGet' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'acgXgafv' -- -- * 'acgUploadProtocol' -- -- * 'acgAchievementId' -- -- * 'acgAccessToken' -- -- * 'acgUploadType' -- -- * 'acgCallback' achievementConfigurationsGet :: Text -- ^ 'acgAchievementId' -> AchievementConfigurationsGet achievementConfigurationsGet pAcgAchievementId_ = AchievementConfigurationsGet' { _acgXgafv = Nothing , _acgUploadProtocol = Nothing , _acgAchievementId = pAcgAchievementId_ , _acgAccessToken = Nothing , _acgUploadType = Nothing , _acgCallback = Nothing } -- | V1 error format. acgXgafv :: Lens' AchievementConfigurationsGet (Maybe Xgafv) acgXgafv = lens _acgXgafv (\ s a -> s{_acgXgafv = a}) -- | Upload protocol for media (e.g. \"raw\", \"multipart\"). acgUploadProtocol :: Lens' AchievementConfigurationsGet (Maybe Text) acgUploadProtocol = lens _acgUploadProtocol (\ s a -> s{_acgUploadProtocol = a}) -- | The ID of the achievement used by this method. acgAchievementId :: Lens' AchievementConfigurationsGet Text acgAchievementId = lens _acgAchievementId (\ s a -> s{_acgAchievementId = a}) -- | OAuth access token. acgAccessToken :: Lens' AchievementConfigurationsGet (Maybe Text) acgAccessToken = lens _acgAccessToken (\ s a -> s{_acgAccessToken = a}) -- | Legacy upload protocol for media (e.g. \"media\", \"multipart\"). acgUploadType :: Lens' AchievementConfigurationsGet (Maybe Text) acgUploadType = lens _acgUploadType (\ s a -> s{_acgUploadType = a}) -- | JSONP acgCallback :: Lens' AchievementConfigurationsGet (Maybe Text) acgCallback = lens _acgCallback (\ s a -> s{_acgCallback = a}) instance GoogleRequest AchievementConfigurationsGet where type Rs AchievementConfigurationsGet = AchievementConfiguration type Scopes AchievementConfigurationsGet = '["https://www.googleapis.com/auth/androidpublisher"] requestClient AchievementConfigurationsGet'{..} = go _acgAchievementId _acgXgafv _acgUploadProtocol _acgAccessToken _acgUploadType _acgCallback (Just AltJSON) gamesConfigurationService where go = buildClient (Proxy :: Proxy AchievementConfigurationsGetResource) mempty
brendanhay/gogol
gogol-games-configuration/gen/Network/Google/Resource/GamesConfiguration/AchievementConfigurations/Get.hs
Haskell
mpl-2.0
5,179
SystemK Design Doc ================== # Introduction SystemK is a userspace process running with PID 0. It is the first process invocated by the kernel in userspace mode and its duty during its life-time is an infinite main-loop that spawns new userspace processes and manages their respective life-time. # Abstract Design Userspace process daemons are prone to failure in a great number of ways. To protect SystemK's critical data structures we model its behaviour and internal mechanism in a pure way and wrap this up by lifting its operational semantics into an IO () monad via IO () action primitives. These IO () action primitives serve as the SystemK API. A high-level view looks something like this: ''' +---------------------------------+ | IO Monad | | +---------------------------+ | | | KMonad = ReaderT + StateT | |<------* | | +-----------------+ | | \ | | | pure functional | | | ------>= Evil daemons | | | data structures | | | | | +-----------------+ | | | +---------------------------+ | +---------------------------------+ ''' # K Repository At the pure core of SystemK is the service configuration repository, which is cached in memory and stored on-disk in the form of JSON files. The repository provides a persistent way to toggle services, a consistent view of service states, and a unified interface to atomically manipulate service configuration properties. The repository is ACID compliant and so guarantees repository transactions are processed reliably and known good configurations are always accessible. Configuration repository transactions are mediated by the k.configd service via inter-process communication. # K Restarter Upon invocation, the SystemK main loop spawns a restart daemon thread called k.startd. The k.startd daemon queries the K repository to define the dependency chain of system services and invocate them in the appropriate order. Each chain is started asynchronously with respect to each entry-point service. In addition to spawning services, the k.startd service keeps track of state of services failures and dependency events. The k.startd service uses inter-process communication to interact with k.configd as to become stateful. It should be remarked here that the k.startd service itself is stateless, represented as the IO Monad. This allows SystemK to recover from service or service dependency failures, even critical failure in k.startd itself shall not bring down the system, however manual intervention would be required to restart it. NOTES: http://www.cns.nyu.edu/~fan/sun-docs/talks/practical-solaris10-security.pdf http://home.mit.bme.hu/~meszaros/edu/oprendszerek/segedlet/unix/5_solaris/Service%20Management%20Facility%20%28SMF%29%20in%20the%20Solaris%2010%20OS.pdf http://acid-state.seize.it/ http://acid-state.seize.it/safecopy https://www.usenix.org/legacy/event/lisa05/tech/full_papers/adams/adams.pdf
victoredwardocallaghan/systemk
documentation/design_doc.md
Markdown
mpl-2.0
2,965
package minejava.reg.util.concurrent; public interface RunnableFuture<V> extends Runnable, Future<V>{ @Override void run(); }
cFerg/MineJava
src/main/java/minejava/reg/util/concurrent/RunnableFuture.java
Java
mpl-2.0
135
<!DOCTYPE html> <meta charset="utf-8"> <title>CSS Color 4: predefined colorspaces, rec2020, percent values</title> <link rel="author" title="Chris Lilley" href="mailto:[email protected]"> <link rel="help" href="https://drafts.csswg.org/css-color-4/#predefined"> <link rel="match" href="greensquare-ref.html"> <meta name="assert" content="Color function with explicit rec2020 value as percent matches sRGB #009900"> <style> .test { background-color: red; width: 12em; height: 6em; margin-top:0} .ref { background-color: #009900; width: 12em; height: 6em; margin-bottom: 0} .test {background-color: color(rec2020 33.033% 55.976% 14.863%)} </style> <body> <p>Test passes if you see a green square, and no red.</p> <p class="ref"> </p> <p class="test"> </p> </body>
asajeffrey/servo
tests/wpt/web-platform-tests/css/css-color/predefined-012.html
HTML
mpl-2.0
780
ο»Ώ/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Editor configuration settings. * * Follow this link for more information: * http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Configuration/Configuration_Options */ FCKConfig.CustomConfigurationsPath = '' ; FCKConfig.EditorAreaCSS = FCKConfig.BasePath + 'css/fck_editorarea.css' ; FCKConfig.EditorAreaStyles = '' ; FCKConfig.ToolbarComboPreviewCSS = '' ; FCKConfig.DocType = '' ; FCKConfig.BaseHref = '' ; FCKConfig.FullPage = false ; // The following option determines whether the "Show Blocks" feature is enabled or not at startup. FCKConfig.StartupShowBlocks = false ; FCKConfig.Debug = false ; FCKConfig.AllowQueryStringDebug = true ; FCKConfig.SkinPath = FCKConfig.BasePath + 'skins/default/' ; FCKConfig.SkinEditorCSS = '' ; // FCKConfig.SkinPath + "|<minified css>" ; FCKConfig.SkinDialogCSS = '' ; // FCKConfig.SkinPath + "|<minified css>" ; FCKConfig.PreloadImages = [ FCKConfig.SkinPath + 'images/toolbar.start.gif', FCKConfig.SkinPath + 'images/toolbar.buttonarrow.gif' ] ; FCKConfig.PluginsPath = FCKConfig.BasePath + 'plugins/' ; // FCKConfig.Plugins.Add( 'autogrow' ) ; // FCKConfig.Plugins.Add( 'dragresizetable' ); FCKConfig.AutoGrowMax = 400 ; // FCKConfig.ProtectedSource.Add( /<%[\s\S]*?%>/g ) ; // ASP style server side code <%...%> // FCKConfig.ProtectedSource.Add( /<\?[\s\S]*?\?>/g ) ; // PHP style server side code // FCKConfig.ProtectedSource.Add( /(<asp:[^\>]+>[\s|\S]*?<\/asp:[^\>]+>)|(<asp:[^\>]+\/>)/gi ) ; // ASP.Net style tags <asp:control> FCKConfig.AutoDetectLanguage = true ; FCKConfig.DefaultLanguage = 'en' ; FCKConfig.ContentLangDirection = 'ltr' ; FCKConfig.ProcessHTMLEntities = true ; FCKConfig.IncludeLatinEntities = true ; FCKConfig.IncludeGreekEntities = true ; FCKConfig.ProcessNumericEntities = false ; FCKConfig.AdditionalNumericEntities = '' ; // Single Quote: "'" FCKConfig.FillEmptyBlocks = true ; FCKConfig.FormatSource = true ; FCKConfig.FormatOutput = true ; FCKConfig.FormatIndentator = ' ' ; FCKConfig.EMailProtection = 'encode' ; // none | encode | function FCKConfig.EMailProtectionFunction = 'mt(NAME,DOMAIN,SUBJECT,BODY)' ; FCKConfig.StartupFocus = false ; FCKConfig.ForcePasteAsPlainText = false ; FCKConfig.AutoDetectPasteFromWord = true ; // IE only. FCKConfig.ShowDropDialog = true ; FCKConfig.ForceSimpleAmpersand = false ; FCKConfig.TabSpaces = 0 ; FCKConfig.ShowBorders = true ; FCKConfig.SourcePopup = false ; FCKConfig.ToolbarStartExpanded = true ; FCKConfig.ToolbarCanCollapse = true ; FCKConfig.IgnoreEmptyParagraphValue = true ; FCKConfig.FloatingPanelsZIndex = 10000 ; FCKConfig.HtmlEncodeOutput = false ; FCKConfig.TemplateReplaceAll = true ; FCKConfig.TemplateReplaceCheckbox = true ; FCKConfig.ToolbarLocation = 'In' ; FCKConfig.ToolbarSets["Default"] = [ ['Source','DocProps','-','Save','NewPage','Preview','-','Templates'], ['Cut','Copy','Paste','PasteText','PasteWord','-','Print','SpellCheck'], ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'], ['Form','Checkbox','Radio','TextField','Textarea','Select','Button','ImageButton','HiddenField'], '/', ['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'], ['OrderedList','UnorderedList','-','Outdent','Indent','Blockquote','CreateDiv'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'], ['Link','Unlink','Anchor'], ['Image','Flash','Table','Rule','Smiley','SpecialChar','PageBreak'], '/', ['Style','FontFormat','FontName','FontSize'], ['TextColor','BGColor'], ['FitWindow','ShowBlocks','-','About'] // No comma for the last row. ] ; FCKConfig.ToolbarSets["Basic"] = [ ['Bold','Italic','-','OrderedList','UnorderedList','-','Link','Unlink','-','About'] ] ; FCKConfig.EnterMode = 'p' ; // p | div | br FCKConfig.ShiftEnterMode = 'br' ; // p | div | br FCKConfig.Keystrokes = [ [ CTRL + 65 /*A*/, true ], [ CTRL + 67 /*C*/, true ], [ CTRL + 70 /*F*/, true ], [ CTRL + 83 /*S*/, true ], [ CTRL + 84 /*T*/, true ], [ CTRL + 88 /*X*/, true ], [ CTRL + 86 /*V*/, 'Paste' ], [ CTRL + 45 /*INS*/, true ], [ SHIFT + 45 /*INS*/, 'Paste' ], [ CTRL + 88 /*X*/, 'Cut' ], [ SHIFT + 46 /*DEL*/, 'Cut' ], [ CTRL + 90 /*Z*/, 'Undo' ], [ CTRL + 89 /*Y*/, 'Redo' ], [ CTRL + SHIFT + 90 /*Z*/, 'Redo' ], [ CTRL + 76 /*L*/, 'Link' ], [ CTRL + 66 /*B*/, 'Bold' ], [ CTRL + 73 /*I*/, 'Italic' ], [ CTRL + 85 /*U*/, 'Underline' ], [ CTRL + SHIFT + 83 /*S*/, 'Save' ], [ CTRL + ALT + 13 /*ENTER*/, 'FitWindow' ], [ SHIFT + 32 /*SPACE*/, 'Nbsp' ] ] ; FCKConfig.ContextMenu = ['Generic','Link','Anchor','Image','Flash','Select','Textarea','Checkbox','Radio','TextField','HiddenField','ImageButton','Button','BulletedList','NumberedList','Table','Form','DivContainer'] ; FCKConfig.BrowserContextMenuOnCtrl = false ; FCKConfig.BrowserContextMenu = false ; FCKConfig.EnableMoreFontColors = true ; FCKConfig.FontColors = '000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,808080,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF' ; FCKConfig.FontFormats = 'p;h1;h2;h3;h4;h5;h6;pre;address;div' ; FCKConfig.FontNames = 'Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana' ; FCKConfig.FontSizes = 'smaller;larger;xx-small;x-small;small;medium;large;x-large;xx-large' ; FCKConfig.StylesXmlPath = FCKConfig.EditorPath + 'fckstyles.xml' ; FCKConfig.TemplatesXmlPath = FCKConfig.EditorPath + 'fcktemplates.xml' ; FCKConfig.SpellChecker = 'ieSpell' ; // 'ieSpell' | 'SpellerPages' FCKConfig.IeSpellDownloadUrl = 'http://www.iespell.com/download.php' ; FCKConfig.SpellerPagesServerScript = 'server-scripts/spellchecker.php' ; // Available extension: .php .cfm .pl FCKConfig.FirefoxSpellChecker = false ; FCKConfig.MaxUndoLevels = 15 ; FCKConfig.DisableObjectResizing = false ; FCKConfig.DisableFFTableHandles = true ; FCKConfig.LinkDlgHideTarget = false ; FCKConfig.LinkDlgHideAdvanced = false ; FCKConfig.ImageDlgHideLink = false ; FCKConfig.ImageDlgHideAdvanced = false ; FCKConfig.FlashDlgHideAdvanced = false ; FCKConfig.ProtectedTags = '' ; // This will be applied to the body element of the editor FCKConfig.BodyId = '' ; FCKConfig.BodyClass = '' ; FCKConfig.DefaultStyleLabel = '' ; FCKConfig.DefaultFontFormatLabel = '' ; FCKConfig.DefaultFontLabel = '' ; FCKConfig.DefaultFontSizeLabel = '' ; FCKConfig.DefaultLinkTarget = '' ; // The option switches between trying to keep the html structure or do the changes so the content looks like it was in Word FCKConfig.CleanWordKeepsStructure = false ; // Only inline elements are valid. FCKConfig.RemoveFormatTags = 'b,big,code,del,dfn,em,font,i,ins,kbd,q,samp,small,span,strike,strong,sub,sup,tt,u,var' ; // Attributes that will be removed FCKConfig.RemoveAttributes = 'class,style,lang,width,height,align,hspace,valign' ; FCKConfig.CustomStyles = { 'Red Title' : { Element : 'h3', Styles : { 'color' : 'Red' } } }; // Do not add, rename or remove styles here. Only apply definition changes. FCKConfig.CoreStyles = { // Basic Inline Styles. 'Bold' : { Element : 'strong', Overrides : 'b' }, 'Italic' : { Element : 'em', Overrides : 'i' }, 'Underline' : { Element : 'u' }, 'StrikeThrough' : { Element : 'strike' }, 'Subscript' : { Element : 'sub' }, 'Superscript' : { Element : 'sup' }, // Basic Block Styles (Font Format Combo). 'p' : { Element : 'p' }, 'div' : { Element : 'div' }, 'pre' : { Element : 'pre' }, 'address' : { Element : 'address' }, 'h1' : { Element : 'h1' }, 'h2' : { Element : 'h2' }, 'h3' : { Element : 'h3' }, 'h4' : { Element : 'h4' }, 'h5' : { Element : 'h5' }, 'h6' : { Element : 'h6' }, // Other formatting features. 'FontFace' : { Element : 'span', Styles : { 'font-family' : '#("Font")' }, Overrides : [ { Element : 'font', Attributes : { 'face' : null } } ] }, 'Size' : { Element : 'span', Styles : { 'font-size' : '#("Size","fontSize")' }, Overrides : [ { Element : 'font', Attributes : { 'size' : null } } ] }, 'Color' : { Element : 'span', Styles : { 'color' : '#("Color","color")' }, Overrides : [ { Element : 'font', Attributes : { 'color' : null } } ] }, 'BackColor' : { Element : 'span', Styles : { 'background-color' : '#("Color","color")' } }, 'SelectionHighlight' : { Element : 'span', Styles : { 'background-color' : 'navy', 'color' : 'white' } } }; // The distance of an indentation step. FCKConfig.IndentLength = 40 ; FCKConfig.IndentUnit = 'px' ; // Alternatively, FCKeditor allows the use of CSS classes for block indentation. // This overrides the IndentLength/IndentUnit settings. FCKConfig.IndentClasses = [] ; // [ Left, Center, Right, Justified ] FCKConfig.JustifyClasses = [] ; // The following value defines which File Browser connector and Quick Upload // "uploader" to use. It is valid for the default implementaion and it is here // just to make this configuration file cleaner. // It is not possible to change this value using an external file or even // inline when creating the editor instance. In that cases you must set the // values of LinkBrowserURL, ImageBrowserURL and so on. // Custom implementations should just ignore it. var _FileBrowserLanguage = 'aspx' ; // asp | aspx | cfm | lasso | perl | php | py var _QuickUploadLanguage = 'aspx' ; // asp | aspx | cfm | lasso | perl | php | py // Don't care about the following two lines. It just calculates the correct connector // extension to use for the default File Browser (Perl uses "cgi"). var _FileBrowserExtension = _FileBrowserLanguage == 'perl' ? 'cgi' : _FileBrowserLanguage ; var _QuickUploadExtension = _QuickUploadLanguage == 'perl' ? 'cgi' : _QuickUploadLanguage ; FCKConfig.LinkBrowser = true ; FCKConfig.LinkBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Connector=' + encodeURIComponent( FCKConfig.BasePath + 'filemanager/connectors/' + _FileBrowserLanguage + '/connector.' + _FileBrowserExtension ) ; FCKConfig.LinkBrowserWindowWidth = FCKConfig.ScreenWidth * 0.7 ; // 70% FCKConfig.LinkBrowserWindowHeight = FCKConfig.ScreenHeight * 0.7 ; // 70% FCKConfig.ImageBrowser = true ; FCKConfig.ImageBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Type=Image&Connector=' + encodeURIComponent( FCKConfig.BasePath + 'filemanager/connectors/' + _FileBrowserLanguage + '/connector.' + _FileBrowserExtension ) ; FCKConfig.ImageBrowserWindowWidth = FCKConfig.ScreenWidth * 0.7 ; // 70% ; FCKConfig.ImageBrowserWindowHeight = FCKConfig.ScreenHeight * 0.7 ; // 70% ; FCKConfig.FlashBrowser = true ; FCKConfig.FlashBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Type=Flash&Connector=' + encodeURIComponent( FCKConfig.BasePath + 'filemanager/connectors/' + _FileBrowserLanguage + '/connector.' + _FileBrowserExtension ) ; FCKConfig.FlashBrowserWindowWidth = FCKConfig.ScreenWidth * 0.7 ; //70% ; FCKConfig.FlashBrowserWindowHeight = FCKConfig.ScreenHeight * 0.7 ; //70% ; FCKConfig.LinkUpload = true ; FCKConfig.LinkUploadURL = FCKConfig.BasePath + 'filemanager/connectors/' + _QuickUploadLanguage + '/upload.' + _QuickUploadExtension ; FCKConfig.LinkUploadAllowedExtensions = ".(7z|aiff|asf|avi|bmp|csv|doc|fla|flv|gif|gz|gzip|jpeg|jpg|mid|mov|mp3|mp4|mpc|mpeg|mpg|ods|odt|pdf|png|ppt|pxd|qt|ram|rar|rm|rmi|rmvb|rtf|sdc|sitd|swf|sxc|sxw|tar|tgz|tif|tiff|txt|vsd|wav|wma|wmv|xls|xml|zip)$" ; // empty for all FCKConfig.LinkUploadDeniedExtensions = "" ; // empty for no one FCKConfig.ImageUpload = true ; FCKConfig.ImageUploadURL = FCKConfig.BasePath + 'filemanager/connectors/' + _QuickUploadLanguage + '/upload.' + _QuickUploadExtension + '?Type=Image' ; FCKConfig.ImageUploadAllowedExtensions = ".(jpg|gif|jpeg|png|bmp)$" ; // empty for all FCKConfig.ImageUploadDeniedExtensions = "" ; // empty for no one FCKConfig.FlashUpload = true ; FCKConfig.FlashUploadURL = FCKConfig.BasePath + 'filemanager/connectors/' + _QuickUploadLanguage + '/upload.' + _QuickUploadExtension + '?Type=Flash' ; FCKConfig.FlashUploadAllowedExtensions = ".(swf|flv)$" ; // empty for all FCKConfig.FlashUploadDeniedExtensions = "" ; // empty for no one FCKConfig.SmileyPath = FCKConfig.BasePath + 'images/smiley/msn/' ; FCKConfig.SmileyImages = ['regular_smile.gif','sad_smile.gif','wink_smile.gif','teeth_smile.gif','confused_smile.gif','tounge_smile.gif','embaressed_smile.gif','omg_smile.gif','whatchutalkingabout_smile.gif','angry_smile.gif','angel_smile.gif','shades_smile.gif','devil_smile.gif','cry_smile.gif','lightbulb.gif','thumbs_down.gif','thumbs_up.gif','heart.gif','broken_heart.gif','kiss.gif','envelope.gif'] ; FCKConfig.SmileyColumns = 8 ; FCKConfig.SmileyWindowWidth = 320 ; FCKConfig.SmileyWindowHeight = 210 ; FCKConfig.BackgroundBlockerColor = '#ffffff' ; FCKConfig.BackgroundBlockerOpacity = 0.50 ; FCKConfig.MsWebBrowserControlCompat = false ; FCKConfig.PreventSubmitHandler = false ;
anam/abs
V1/fckeditor/fckconfig.js
JavaScript
mpl-2.0
13,602
**Reminder - no plan survives breakfast.** [Episode guide](https://mikeconley.github.io/joy-of-coding-episode-guide/) - Feel free to send [pull requests](https://help.github.com/articles/about-pull-requests/)Β to the [repo](https://github.com/mikeconley/joy-of-coding-episode-guide)! - [Here’s a contributing guide!](https://github.com/mikeconley/joy-of-coding-episode-guide/blob/master/CONTRIBUTE.md) - [Here’s the guide for creating pull requests that smurfd used and recommends](https://akrabat.com/the-beginners-guide-to-contributing-to-a-github-project/%20)! **Today** - Taking a holiday break! Back on January 9th! - Things to look forward to in 2019 - Probably more Windows development! - Faster builds, because OBS will be running on a different machine - Renewed effort on auto-transcriptions - Self-check: is everything working? - promiseDocumentFlushed bug - Process Priority Manager investigation - **We'd love for other people in the Mozilla community to start livehacking! Come talk to mconley onΒ **[irc.mozilla.org](http://irc.mozilla.org/)**Β #livehacking.** **Rate this episode:Β **https://goo.gl/forms/Om3S7MidMokDnYBy1 **Chat** - [IRC](https://wiki.mozilla.org/IRC) - We're in [irc.mozilla.org](http://irc.mozilla.org/) in [#livehacking](http://client00.chat.mibbit.com/?channel=%23livehacking&server=irc.mozilla.org). - I’ve also got my IRC client signed into the Twitch chat - [This is a link to a web client that you can use to chat with me from your browser](https://client00.chat.mibbit.com/?channel=%23livehacking&server=irc.mozilla.org) **Links** - [The Joy of Coding: Community-RunΒ Episode guide](https://mikeconley.github.io/joy-of-coding-episode-guide/) - Feel free to send [pull requests](https://help.github.com/articles/about-pull-requests/)Β to the [repo](https://github.com/mikeconley/joy-of-coding-episode-guide)! - [Here’s the guide for creating pull requests that smurfd used and recommends](https://akrabat.com/the-beginners-guide-to-contributing-to-a-github-project/%20)! - [Check out my colleague Josh Marinacci](https://twitter.com/joshmarinacci)Β hacking on [Firefox Reality, our nascent VR browser](https://www.twitch.tv/joshmarinacci)! - [Les Orchard hacks on Firefox Color](https://www.twitch.tv/lmorchard/videos/all) - [Solving Bugs with Sean Prashad](https://www.youtube.com/channel/UCRxijHyajcDWdjRK_9jmLYw) - The Joy of Diagnosis!:Β https://www.youtube.com/watch?v=UL44ErfqJXs - [The Joy of Automation with Armen](https://www.youtube.com/channel/UCBgCmdvPaoYyha7JI33rfDQ) - [I've been mirroring the episodes to YouTube](https://www.youtube.com/playlist?list=PLmaFLMwlbk8wKMvfEEzp9Hfdlid8VYpL5) - [The Joy of Illustrating - Episode 1](https://www.youtube.com/watch?v=5g82nBPNVbc)Β - Watch @mart3ll blow your mind with designs from the Mozilla Creative team! - [Lost in Data](https://air.mozilla.org/lost-in-data-episode-1/) - sheriffing performance regressions in pushes for Firefox - [The Hour of Design](https://www.youtube.com/watch?v=8_Ld4hOU1QU) - watch one of our designers demystify the design process! - [Code Therapy with Danny O’Brien](https://www.youtube.com/channel/UCDShi-SQdFVRnQrMla9G_kQ) - Watch a developer put together a Windows game from scratch (no third-part engines) - really great explanations:Β https://handmadehero.org/ - [/r/WatchPeopleCode](https://www.reddit.com/r/WatchPeopleCode) for more livehacking! - [Watch @mrrrgn code to techno](https://www.youtube.com/channel/UC9ggHzjP5TepAxkrQyQCyJg) **Glossary** - BHR - β€œBackground Hang Reporter”, a thing that records information about when Firefox performs poorly and sends it over Telemetry - e10s ("ee ten ESS") - short for [Electrolysis, which is the multi-process Firefox project](https://wiki.mozilla.org/Electrolysis) - CPOW ("ka-POW" or sometimes "SEE-pow") = Cross-Process Object Wrapper. [See this blog post.](http://mikeconley.ca/blog/2015/02/17/on-unsafe-cpow-usage-in-firefox-desktop-and-why-is-my-nightly-so-sluggish-with-e10s-enabled/) - Deserialize - "turn a serialized object back into the complex object” - Serialize - "turn a complex object into something that can be represented as primitives, like strings, integers, etc - Regression - something that made behaviour worse rather than better. Regress means toΒ β€œgo backward”, more or less. **Feedback** - [@[email protected] on Mastodon](https://mastodon.social/@mconley) - [@mike_conley on Twitter](https://twitter.com/mike_conley) - mconley in IRC on [irc.mozilla.org](http://irc.mozilla.org/) - [mikeconley.ca/blog](http://mikeconley.ca/blog/)
mikeconley/joy-of-coding-episode-guide
_episodes/0160/agenda.md
Markdown
mpl-2.0
4,616
package testtravis; import static org.junit.Assert.*; import org.junit.Test; public class Operar_unit { @Test public void testSumar() { System.out.println("Sumar dos numeros"); int numero1 = 6; int numero2 = 6; Operaciones instance = new Operaciones(); int expResult = 12; int result = instance.sumar(numero1, numero2); assertEquals(expResult, result); } @Test public void testRestar() { System.out.println("Restar dos numeros"); int numero1 = 4; int numero2 = 2; Operaciones instance = new Operaciones(); int expResult = 2; int result = instance.restar(numero1, numero2); assertEquals(expResult, result); } @Test public void testMultiplicar() { System.out.println("Multiplicar dos numeros"); int numero1 = 3; int numero2 =3; Operaciones instance = new Operaciones(); int expResult = 9; int result = instance.multiplicar(numero1, numero2); assertEquals(expResult, result); } @Test public void testDividir() { System.out.println("Dividir Dos numeros"); int numero1 = 6; int numero2 = 3; Operaciones instance = new Operaciones(); int expResult = 2; int result = instance.dividir(numero1, numero2); assertEquals(expResult, result); } }
nricaurte/prueba_degit
src/testtravis/Operar_unit.java
Java
mpl-2.0
1,428
#ifndef METHOD_ARGUMENT_H_VCZAR2ZT #define METHOD_ARGUMENT_H_VCZAR2ZT #include "ast_node.h" #include "ast_node_visitor.h" #include <string> namespace fparser { namespace ast { class MethodArgument : public ast::ASTNode { public: virtual void accept(ASTNodeVisitor& visitor) override; public: MethodArgument(); virtual ~MethodArgument(); }; } // namespace ast } // namespace fparser #endif /* end of include guard: METHOD_ARGUMENT_H_VCZAR2ZT */
ingmarlehmann/frank
frank-parser/include/ast/method_argument.h
C
mpl-2.0
456
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef MOZILLA_MEDIASOURCEUTILS_H_ #define MOZILLA_MEDIASOURCEUTILS_H_ #include "nsString.h" #include "TimeUnits.h" namespace mozilla { nsCString DumpTimeRanges(const media::TimeIntervals& aRanges); } // namespace mozilla #endif /* MOZILLA_MEDIASOURCEUTILS_H_ */
Yukarumya/Yukarum-Redfoxes
dom/media/mediasource/MediaSourceUtils.h
C
mpl-2.0
596
//***************************************************************************** // // pushbutton.c - Various types of push buttons. // // Copyright (c) 2008-2013 Texas Instruments Incorporated. All rights reserved. // Software License Agreement // // Texas Instruments (TI) is supplying this software for use solely and // exclusively on TI's microcontroller products. The software is owned by // TI and/or its suppliers, and is protected under applicable copyright // laws. You may not combine this software with "viral" open-source // software in order to form a larger program. // // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL // DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2.0.1.11577 of the Tiva Graphics Library. // //***************************************************************************** #include <stdint.h> #include <stdbool.h> #include "driverlib/debug.h" #include "grlib/grlib.h" #include "grlib/widget.h" #include "grlib/pushbutton.h" //***************************************************************************** // //! \addtogroup pushbutton_api //! @{ // //***************************************************************************** //***************************************************************************** // //! Draws a rectangular push button. //! //! \param psWidget is a pointer to the push button widget to be drawn. //! //! This function draws a rectangular push button on the display. This is //! called in response to a \b #WIDGET_MSG_PAINT message. //! //! \return None. // //***************************************************************************** static void RectangularButtonPaint(tWidget *psWidget) { const uint8_t *pui8Image; tPushButtonWidget *pPush; tContext sCtx; int32_t i32X, i32Y; // // Check the arguments. // ASSERT(psWidget); // // Convert the generic widget pointer into a push button widget pointer. // pPush = (tPushButtonWidget *)psWidget; // // Initialize a drawing context. // GrContextInit(&sCtx, psWidget->psDisplay); // // Initialize the clipping region based on the extents of this rectangular // push button. // GrContextClipRegionSet(&sCtx, &(psWidget->sPosition)); // // See if the push button fill style is selected. // if(pPush->ui32Style & PB_STYLE_FILL) { // // Fill the push button with the fill color. // GrContextForegroundSet(&sCtx, ((pPush->ui32Style & PB_STYLE_PRESSED) ? pPush->ui32PressFillColor : pPush->ui32FillColor)); GrRectFill(&sCtx, &(psWidget->sPosition)); } // // See if the push button outline style is selected. // if(pPush->ui32Style & PB_STYLE_OUTLINE) { // // Outline the push button with the outline color. // GrContextForegroundSet(&sCtx, pPush->ui32OutlineColor); GrRectDraw(&sCtx, &(psWidget->sPosition)); } // // See if the push button text or image style is selected. // if(pPush->ui32Style & (PB_STYLE_TEXT | PB_STYLE_IMG)) { // // Compute the center of the push button. // i32X = (psWidget->sPosition.i16XMin + ((psWidget->sPosition.i16XMax - psWidget->sPosition.i16XMin + 1) / 2)); i32Y = (psWidget->sPosition.i16YMin + ((psWidget->sPosition.i16YMax - psWidget->sPosition.i16YMin + 1) / 2)); // // If the push button outline style is selected then shrink the // clipping region by one pixel on each side so that the outline is not // overwritten by the text or image. // if(pPush->ui32Style & PB_STYLE_OUTLINE) { sCtx.sClipRegion.i16XMin++; sCtx.sClipRegion.i16YMin++; sCtx.sClipRegion.i16XMax--; sCtx.sClipRegion.i16YMax--; } // // See if the push button image style is selected. // if(pPush->ui32Style & PB_STYLE_IMG) { // // Set the foreground and background colors to use for 1 BPP // images. // GrContextForegroundSet(&sCtx, pPush->ui32TextColor); GrContextBackgroundSet(&sCtx, ((pPush->ui32Style & PB_STYLE_PRESSED) ? pPush->ui32PressFillColor : pPush->ui32FillColor)); // // Get the image to be drawn. // pui8Image = (((pPush->ui32Style & PB_STYLE_PRESSED) && pPush->pui8PressImage) ? pPush->pui8PressImage : pPush->pui8Image); // // Draw the image centered in the push button. // GrImageDraw(&sCtx, pui8Image, i32X - (GrImageWidthGet(pui8Image) / 2), i32Y - (GrImageHeightGet(pui8Image) / 2)); } // // See if the push button text style is selected. // if(pPush->ui32Style & PB_STYLE_TEXT) { // // Draw the text centered in the middle of the push button. // GrContextFontSet(&sCtx, pPush->psFont); GrContextForegroundSet(&sCtx, pPush->ui32TextColor); GrContextBackgroundSet(&sCtx, ((pPush->ui32Style & PB_STYLE_PRESSED) ? pPush->ui32PressFillColor : pPush->ui32FillColor)); GrStringDrawCentered(&sCtx, pPush->pcText, -1, i32X, i32Y, pPush->ui32Style & PB_STYLE_TEXT_OPAQUE); } } } //***************************************************************************** // //! Handles pointer events for a rectangular push button. //! //! \param psWidget is a pointer to the push button widget. //! \param ui32Msg is the pointer event message. //! \param i32X is the X coordinate of the pointer event. //! \param i32Y is the Y coordinate of the pointer event. //! //! This function processes pointer event messages for a rectangular push //! button. This is called in response to a \b #WIDGET_MSG_PTR_DOWN, //! \b #WIDGET_MSG_PTR_MOVE, and \b #WIDGET_MSG_PTR_UP messages. //! //! If the \b #WIDGET_MSG_PTR_UP message is received with a position within the //! extents of the push button, the push button's OnClick callback function is //! called. //! //! \return Returns 1 if the coordinates are within the extents of the push //! button and 0 otherwise. // //***************************************************************************** static int32_t RectangularButtonClick(tWidget *psWidget, uint32_t ui32Msg, int32_t i32X, int32_t i32Y) { tPushButtonWidget *pPush; // // Check the arguments. // ASSERT(psWidget); // // Convert the generic widget pointer into a push button widget pointer. // pPush = (tPushButtonWidget *)psWidget; // // See if this is a pointer up message. // if(ui32Msg == WIDGET_MSG_PTR_UP) { // // Indicate that this push button is no longer pressed. // pPush->ui32Style &= ~(PB_STYLE_PRESSED); // // If filling is enabled for this push button, or if an image is being // used and a pressed button image is provided, then redraw the push // button to show it in its non-pressed state. // if((pPush->ui32Style & PB_STYLE_FILL) || ((pPush->ui32Style & PB_STYLE_IMG) && pPush->pui8PressImage)) { RectangularButtonPaint(psWidget); } // // If the pointer is still within the button bounds, and it is a // release notify button, call the notification function here. // if(GrRectContainsPoint(&psWidget->sPosition, i32X, i32Y) && (pPush->ui32Style & PB_STYLE_RELEASE_NOTIFY) && pPush->pfnOnClick) { pPush->pfnOnClick(psWidget); } } // // See if the given coordinates are within the extents of the push button. // if(GrRectContainsPoint(&psWidget->sPosition, i32X, i32Y)) { // // See if this is a pointer down message. // if(ui32Msg == WIDGET_MSG_PTR_DOWN) { // // Indicate that this push button is pressed. // pPush->ui32Style |= PB_STYLE_PRESSED; // // If filling is enabled for this push button, or if an image is // being used and a pressed button image is provided, then redraw // the push button to show it in its pressed state. // if((pPush->ui32Style & PB_STYLE_FILL) || ((pPush->ui32Style & PB_STYLE_IMG) && pPush->pui8PressImage)) { RectangularButtonPaint(psWidget); } } // // See if there is an OnClick callback for this widget. // if(pPush->pfnOnClick) { // // If the pointer was just pressed then call the callback. // if((ui32Msg == WIDGET_MSG_PTR_DOWN) && !(pPush->ui32Style & PB_STYLE_RELEASE_NOTIFY)) { pPush->pfnOnClick(psWidget); } // // See if auto-repeat is enabled for this widget. // if(pPush->ui32Style & PB_STYLE_AUTO_REPEAT) { // // If the pointer was just pressed, reset the auto-repeat // count. // if(ui32Msg == WIDGET_MSG_PTR_DOWN) { pPush->ui32AutoRepeatCount = 0; } // // See if the pointer was moved. // else if(ui32Msg == WIDGET_MSG_PTR_MOVE) { // // Increment the auto-repeat count. // pPush->ui32AutoRepeatCount++; // // If the auto-repeat count exceeds the auto-repeat delay, // and it is a multiple of the auto-repeat rate, then // call the callback. // if((pPush->ui32AutoRepeatCount >= pPush->ui16AutoRepeatDelay) && (((pPush->ui32AutoRepeatCount - pPush->ui16AutoRepeatDelay) % pPush->ui16AutoRepeatRate) == 0)) { pPush->pfnOnClick(psWidget); } } } } // // These coordinates are within the extents of the push button widget. // return(1); } // // These coordinates are not within the extents of the push button widget. // return(0); } //***************************************************************************** // //! Handles messages for a rectangular push button widget. //! //! \param psWidget is a pointer to the push button widget. //! \param ui32Msg is the message. //! \param ui32Param1 is the first parameter to the message. //! \param ui32Param2 is the second parameter to the message. //! //! This function receives messages intended for this push button widget and //! processes them accordingly. The processing of the message varies based on //! the message in question. //! //! Unrecognized messages are handled by calling WidgetDefaultMsgProc(). //! //! \return Returns a value appropriate to the supplied message. // //***************************************************************************** int32_t RectangularButtonMsgProc(tWidget *psWidget, uint32_t ui32Msg, uint32_t ui32Param1, uint32_t ui32Param2) { // // Check the arguments. // ASSERT(psWidget); // // Determine which message is being sent. // switch(ui32Msg) { // // The widget paint request has been sent. // case WIDGET_MSG_PAINT: { // // Handle the widget paint request. // RectangularButtonPaint(psWidget); // // Return one to indicate that the message was successfully // processed. // return(1); } // // One of the pointer requests has been sent. // case WIDGET_MSG_PTR_DOWN: case WIDGET_MSG_PTR_MOVE: case WIDGET_MSG_PTR_UP: { // // Handle the pointer request, returning the appropriate value. // return(RectangularButtonClick(psWidget, ui32Msg, ui32Param1, ui32Param2)); } // // An unknown request has been sent. // default: { // // Let the default message handler process this message. // return(WidgetDefaultMsgProc(psWidget, ui32Msg, ui32Param1, ui32Param2)); } } } //***************************************************************************** // //! Initializes a rectangular push button widget. //! //! \param psWidget is a pointer to the push button widget to initialize. //! \param psDisplay is a pointer to the display on which to draw the push //! button. //! \param i32X is the X coordinate of the upper left corner of the push //! button. //! \param i32Y is the Y coordinate of the upper left corner of the push //! button. //! \param i32Width is the width of the push button. //! \param i32Height is the height of the push button. //! //! This function initializes the provided push button widget so that it will //! be a rectangular push button. //! //! \return None. // //***************************************************************************** void RectangularButtonInit(tPushButtonWidget *psWidget, const tDisplay *psDisplay, int32_t i32X, int32_t i32Y, int32_t i32Width, int32_t i32Height) { uint32_t ui32Idx; // // Check the arguments. // ASSERT(psWidget); ASSERT(psDisplay); // // Clear out the widget structure. // for(ui32Idx = 0; ui32Idx < sizeof(tPushButtonWidget); ui32Idx += 4) { ((uint32_t *)psWidget)[ui32Idx / 4] = 0; } // // Set the size of the push button widget structure. // psWidget->sBase.i32Size = sizeof(tPushButtonWidget); // // Mark this widget as fully disconnected. // psWidget->sBase.psParent = 0; psWidget->sBase.psNext = 0; psWidget->sBase.psChild = 0; // // Save the display pointer. // psWidget->sBase.psDisplay = psDisplay; // // Set the extents of this rectangular push button. // psWidget->sBase.sPosition.i16XMin = i32X; psWidget->sBase.sPosition.i16YMin = i32Y; psWidget->sBase.sPosition.i16XMax = i32X + i32Width - 1; psWidget->sBase.sPosition.i16YMax = i32Y + i32Height - 1; // // Use the rectangular push button message handler to process messages to // this push button. // psWidget->sBase.pfnMsgProc = RectangularButtonMsgProc; } //***************************************************************************** // //! Draws a circular push button. //! //! \param psWidget is a pointer to the push button widget to be drawn. //! //! This function draws a circular push button on the display. This is called //! in response to a \b #WIDGET_MSG_PAINT message. //! //! \return None. // //***************************************************************************** static void CircularButtonPaint(tWidget *psWidget) { const uint8_t *pui8Image; tPushButtonWidget *pPush; tContext sCtx; int32_t i32X, i32Y, i32R; // // Check the arguments. // ASSERT(psWidget); // // Convert the generic widget pointer into a push button widget pointer. // pPush = (tPushButtonWidget *)psWidget; // // Initialize a drawing context. // GrContextInit(&sCtx, psWidget->psDisplay); // // Initialize the clipping region based on the extents of this circular // push button. // GrContextClipRegionSet(&sCtx, &(psWidget->sPosition)); // // Get the radius of the circular push button, along with the X and Y // coordinates for its center. // i32R = (psWidget->sPosition.i16XMax - psWidget->sPosition.i16XMin + 1) / 2; i32X = psWidget->sPosition.i16XMin + i32R; i32Y = psWidget->sPosition.i16YMin + i32R; // // See if the push button fill style is selected. // if(pPush->ui32Style & PB_STYLE_FILL) { // // Fill the push button with the fill color. // GrContextForegroundSet(&sCtx, ((pPush->ui32Style & PB_STYLE_PRESSED) ? pPush->ui32PressFillColor : pPush->ui32FillColor)); GrCircleFill(&sCtx, i32X, i32Y, i32R); } // // See if the push button outline style is selected. // if(pPush->ui32Style & PB_STYLE_OUTLINE) { // // Outline the push button with the outline color. // GrContextForegroundSet(&sCtx, pPush->ui32OutlineColor); GrCircleDraw(&sCtx, i32X, i32Y, i32R); } // // See if the push button text or image style is selected. // if(pPush->ui32Style & (PB_STYLE_TEXT | PB_STYLE_IMG)) { // // If the push button outline style is selected then shrink the // clipping region by one pixel on each side so that the outline is not // overwritten by the text or image. // if(pPush->ui32Style & PB_STYLE_OUTLINE) { sCtx.sClipRegion.i16XMin++; sCtx.sClipRegion.i16YMin++; sCtx.sClipRegion.i16XMax--; sCtx.sClipRegion.i16YMax--; } // // See if the push button image style is selected. // if(pPush->ui32Style & PB_STYLE_IMG) { // // Set the foreground and background colors to use for 1 BPP // images. // GrContextForegroundSet(&sCtx, pPush->ui32TextColor); GrContextBackgroundSet(&sCtx, ((pPush->ui32Style & PB_STYLE_PRESSED) ? pPush->ui32PressFillColor : pPush->ui32FillColor)); // // Get the image to be drawn. // pui8Image = (((pPush->ui32Style & PB_STYLE_PRESSED) && pPush->pui8PressImage) ? pPush->pui8PressImage : pPush->pui8Image); // // Draw the image centered in the push button. // GrImageDraw(&sCtx, pui8Image, i32X - (GrImageWidthGet(pui8Image) / 2), i32Y - (GrImageHeightGet(pui8Image) / 2)); } // // See if the push button text style is selected. // if(pPush->ui32Style & PB_STYLE_TEXT) { // // Draw the text centered in the middle of the push button. // GrContextFontSet(&sCtx, pPush->psFont); GrContextForegroundSet(&sCtx, pPush->ui32TextColor); GrContextBackgroundSet(&sCtx, ((pPush->ui32Style & PB_STYLE_PRESSED) ? pPush->ui32PressFillColor : pPush->ui32FillColor)); GrStringDrawCentered(&sCtx, pPush->pcText, -1, i32X, i32Y, pPush->ui32Style & PB_STYLE_TEXT_OPAQUE); } } } //***************************************************************************** // //! Handles pointer events for a circular push button. //! //! \param psWidget is a pointer to the push button widget. //! \param ui32Msg is the pointer event message. //! \param i32X is the X coordinate of the pointer event. //! \param i32Y is the Y coordinate of the pointer event. //! //! This function processes pointer event messages for a circular push button. //! This is called in response to a \b #WIDGET_MSG_PTR_DOWN, //! \b #WIDGET_MSG_PTR_MOVE, and \b #WIDGET_MSG_PTR_UP messages. //! //! If the \b #WIDGET_MSG_PTR_UP message is received with a position within the //! extents of the push button, the push button's OnClick callback function is //! called. //! //! \return Returns 1 if the coordinates are within the extents of the push //! button and 0 otherwise. // //***************************************************************************** static int32_t CircularButtonClick(tWidget *psWidget, uint32_t ui32Msg, int32_t i32X, int32_t i32Y) { tPushButtonWidget *pPush; int32_t i32Xc, i32Yc, i32R; // // Check the arguments. // ASSERT(psWidget); // // Convert the generic widget pointer into a push button widget pointer. // pPush = (tPushButtonWidget *)psWidget; // // See if this is a pointer up message. // if(ui32Msg == WIDGET_MSG_PTR_UP) { // // Indicate that this push button is no longer pressed. // pPush->ui32Style &= ~(PB_STYLE_PRESSED); // // If filling is enabled for this push button, or if an image is being // used and a pressed button image is provided, then redraw the push // button to show it in its non-pressed state. // if((pPush->ui32Style & PB_STYLE_FILL) || ((pPush->ui32Style & PB_STYLE_IMG) && pPush->pui8PressImage)) { CircularButtonPaint(psWidget); } } // // Get the radius of the circular push button, along with the X and Y // coordinates for its center. // i32R = (psWidget->sPosition.i16XMax - psWidget->sPosition.i16XMin + 1) / 2; i32Xc = psWidget->sPosition.i16XMin + i32R; i32Yc = psWidget->sPosition.i16YMin + i32R; // // See if the given coordinates are within the radius of the push button. // if((((i32X - i32Xc) * (i32X - i32Xc)) + ((i32Y - i32Yc) * (i32Y - i32Yc))) <= (i32R * i32R)) { // // See if this is a pointer down message. // if(ui32Msg == WIDGET_MSG_PTR_DOWN) { // // Indicate that this push button is pressed. // pPush->ui32Style |= PB_STYLE_PRESSED; // // If filling is enabled for this push button, or if an image is // being used and a pressed button image is provided, then redraw // the push button to show it in its pressed state. // if((pPush->ui32Style & PB_STYLE_FILL) || ((pPush->ui32Style & PB_STYLE_IMG) && pPush->pui8PressImage)) { CircularButtonPaint(psWidget); } } // // See if there is an OnClick callback for this widget. // if(pPush->pfnOnClick) { // // If the pointer was just pressed or if the pointer was released // and this button is set for release notification then call the // callback. // if(((ui32Msg == WIDGET_MSG_PTR_DOWN) && !(pPush->ui32Style & PB_STYLE_RELEASE_NOTIFY)) || ((ui32Msg == WIDGET_MSG_PTR_UP) && (pPush->ui32Style & PB_STYLE_RELEASE_NOTIFY))) { pPush->pfnOnClick(psWidget); } // // See if auto-repeat is enabled for this widget. // if(pPush->ui32Style & PB_STYLE_AUTO_REPEAT) { // // If the pointer was just pressed, reset the auto-repeat // count. // if(ui32Msg == WIDGET_MSG_PTR_DOWN) { pPush->ui32AutoRepeatCount = 0; } // // See if the pointer was moved. // else if(ui32Msg == WIDGET_MSG_PTR_MOVE) { // // Increment the auto-repeat count. // pPush->ui32AutoRepeatCount++; // // If the auto-repeat count exceeds the auto-repeat delay, // and it is a multiple of the auto-repeat rate, then // call the callback. // if((pPush->ui32AutoRepeatCount >= pPush->ui16AutoRepeatDelay) && (((pPush->ui32AutoRepeatCount - pPush->ui16AutoRepeatDelay) % pPush->ui16AutoRepeatRate) == 0)) { pPush->pfnOnClick(psWidget); } } } } // // These coordinates are within the extents of the push button widget. // return(1); } // // These coordinates are not within the extents of the push button widget. // return(0); } //***************************************************************************** // //! Handles messages for a circular push button widget. //! //! \param psWidget is a pointer to the push button widget. //! \param ui32Msg is the message. //! \param ui32Param1 is the first parameter to the message. //! \param ui32Param2 is the second parameter to the message. //! //! This function receives messages intended for this push button widget and //! processes them accordingly. The processing of the message varies based on //! the message in question. //! //! Unrecognized messages are handled by calling WidgetDefaultMsgProc(). //! //! \return Returns a value appropriate to the supplied message. // //***************************************************************************** int32_t CircularButtonMsgProc(tWidget *psWidget, uint32_t ui32Msg, uint32_t ui32Param1, uint32_t ui32Param2) { // // Check the arguments. // ASSERT(psWidget); // // Determine which message is being sent. // switch(ui32Msg) { // // The widget paint request has been sent. // case WIDGET_MSG_PAINT: { // // Handle the widget paint request. // CircularButtonPaint(psWidget); // // Return one to indicate that the message was successfully // processed. // return(1); } // // One of the pointer requests has been sent. // case WIDGET_MSG_PTR_DOWN: case WIDGET_MSG_PTR_MOVE: case WIDGET_MSG_PTR_UP: { // // Handle the pointer request, returning the appropriate value. // return(CircularButtonClick(psWidget, ui32Msg, ui32Param1, ui32Param2)); } // // An unknown request has been sent. // default: { // // Let the default message handler process this message. // return(WidgetDefaultMsgProc(psWidget, ui32Msg, ui32Param1, ui32Param2)); } } } //***************************************************************************** // //! Initializes a circular push button widget. //! //! \param psWidget is a pointer to the push button widget to initialize. //! \param psDisplay is a pointer to the display on which to draw the push //! button. //! \param i32X is the X coordinate of the upper left corner of the push //! button. //! \param i32Y is the Y coordinate of the upper left corner of the push //! button. //! \param i32R is the radius of the push button. //! //! This function initializes the provided push button widget so that it will //! be a circular push button. //! //! \return None. // //***************************************************************************** void CircularButtonInit(tPushButtonWidget *psWidget, const tDisplay *psDisplay, int32_t i32X, int32_t i32Y, int32_t i32R) { uint32_t ui32Idx; // // Check the arguments. // ASSERT(psWidget); ASSERT(psDisplay); // // Clear out the widget structure. // for(ui32Idx = 0; ui32Idx < sizeof(tPushButtonWidget); ui32Idx += 4) { ((uint32_t *)psWidget)[ui32Idx / 4] = 0; } // // Set the size of the push button widget structure. // psWidget->sBase.i32Size = sizeof(tPushButtonWidget); // // Mark this widget as fully disconnected. // psWidget->sBase.psParent = 0; psWidget->sBase.psNext = 0; psWidget->sBase.psChild = 0; // // Save the display pointer. // psWidget->sBase.psDisplay = psDisplay; // // Set the extents of this circular push button. // psWidget->sBase.sPosition.i16XMin = i32X - i32R; psWidget->sBase.sPosition.i16YMin = i32Y - i32R; psWidget->sBase.sPosition.i16XMax = i32X + i32R; psWidget->sBase.sPosition.i16YMax = i32Y + i32R; // // Use the circular push button message handler to processes messages to // this push button. // psWidget->sBase.pfnMsgProc = CircularButtonMsgProc; } //***************************************************************************** // // Close the Doxygen group. //! @} // //*****************************************************************************
trfiladelfo/unesp_mdt
boards/SW-TM4C-2.0.1.11577/grlib/pushbutton.c
C
mpl-2.0
31,307
SUBROUTINE PSGEQR2( M, N, A, IA, JA, DESCA, TAU, WORK, LWORK, $ INFO ) * * -- ScaLAPACK routine (version 1.7) -- * University of Tennessee, Knoxville, Oak Ridge National Laboratory, * and University of California, Berkeley. * May 25, 2001 * * .. Scalar Arguments .. INTEGER IA, INFO, JA, LWORK, M, N * .. * .. Array Arguments .. INTEGER DESCA( * ) REAL A( * ), TAU( * ), WORK( * ) * .. * * Purpose * ======= * * PSGEQR2 computes a QR factorization of a real distributed M-by-N * matrix sub( A ) = A(IA:IA+M-1,JA:JA+N-1) = Q * R. * * Notes * ===== * * Each global data object is described by an associated description * vector. This vector stores the information required to establish * the mapping between an object element and its corresponding process * and memory location. * * Let A be a generic term for any 2D block cyclicly distributed array. * Such a global array has an associated description vector DESCA. * In the following comments, the character _ should be read as * "of the global array". * * NOTATION STORED IN EXPLANATION * --------------- -------------- -------------------------------------- * DTYPE_A(global) DESCA( DTYPE_ )The descriptor type. In this case, * DTYPE_A = 1. * CTXT_A (global) DESCA( CTXT_ ) The BLACS context handle, indicating * the BLACS process grid A is distribu- * ted over. The context itself is glo- * bal, but the handle (the integer * value) may vary. * M_A (global) DESCA( M_ ) The number of rows in the global * array A. * N_A (global) DESCA( N_ ) The number of columns in the global * array A. * MB_A (global) DESCA( MB_ ) The blocking factor used to distribute * the rows of the array. * NB_A (global) DESCA( NB_ ) The blocking factor used to distribute * the columns of the array. * RSRC_A (global) DESCA( RSRC_ ) The process row over which the first * row of the array A is distributed. * CSRC_A (global) DESCA( CSRC_ ) The process column over which the * first column of the array A is * distributed. * LLD_A (local) DESCA( LLD_ ) The leading dimension of the local * array. LLD_A >= MAX(1,LOCr(M_A)). * * Let K be the number of rows or columns of a distributed matrix, * and assume that its process grid has dimension p x q. * LOCr( K ) denotes the number of elements of K that a process * would receive if K were distributed over the p processes of its * process column. * Similarly, LOCc( K ) denotes the number of elements of K that a * process would receive if K were distributed over the q processes of * its process row. * The values of LOCr() and LOCc() may be determined via a call to the * ScaLAPACK tool function, NUMROC: * LOCr( M ) = NUMROC( M, MB_A, MYROW, RSRC_A, NPROW ), * LOCc( N ) = NUMROC( N, NB_A, MYCOL, CSRC_A, NPCOL ). * An upper bound for these quantities may be computed by: * LOCr( M ) <= ceil( ceil(M/MB_A)/NPROW )*MB_A * LOCc( N ) <= ceil( ceil(N/NB_A)/NPCOL )*NB_A * * Arguments * ========= * * M (global input) INTEGER * The number of rows to be operated on, i.e. the number of rows * of the distributed submatrix sub( A ). M >= 0. * * N (global input) INTEGER * The number of columns to be operated on, i.e. the number of * columns of the distributed submatrix sub( A ). N >= 0. * * A (local input/local output) REAL pointer into the * local memory to an array of dimension (LLD_A, LOCc(JA+N-1)). * On entry, the local pieces of the M-by-N distributed matrix * sub( A ) which is to be factored. On exit, the elements on * and above the diagonal of sub( A ) contain the min(M,N) by N * upper trapezoidal matrix R (R is upper triangular if M >= N); * the elements below the diagonal, with the array TAU, * represent the orthogonal matrix Q as a product of elementary * reflectors (see Further Details). * * IA (global input) INTEGER * The row index in the global array A indicating the first * row of sub( A ). * * JA (global input) INTEGER * The column index in the global array A indicating the * first column of sub( A ). * * DESCA (global and local input) INTEGER array of dimension DLEN_. * The array descriptor for the distributed matrix A. * * TAU (local output) REAL, array, dimension * LOCc(JA+MIN(M,N)-1). This array contains the scalar factors * TAU of the elementary reflectors. TAU is tied to the * distributed matrix A. * * WORK (local workspace/local output) REAL array, * dimension (LWORK) * On exit, WORK(1) returns the minimal and optimal LWORK. * * LWORK (local or global input) INTEGER * The dimension of the array WORK. * LWORK is local input and must be at least * LWORK >= Mp0 + MAX( 1, Nq0 ), where * * IROFF = MOD( IA-1, MB_A ), ICOFF = MOD( JA-1, NB_A ), * IAROW = INDXG2P( IA, MB_A, MYROW, RSRC_A, NPROW ), * IACOL = INDXG2P( JA, NB_A, MYCOL, CSRC_A, NPCOL ), * Mp0 = NUMROC( M+IROFF, MB_A, MYROW, IAROW, NPROW ), * Nq0 = NUMROC( N+ICOFF, NB_A, MYCOL, IACOL, NPCOL ), * * and NUMROC, INDXG2P are ScaLAPACK tool functions; * MYROW, MYCOL, NPROW and NPCOL can be determined by calling * the subroutine BLACS_GRIDINFO. * * If LWORK = -1, then LWORK is global input and a workspace * query is assumed; the routine only calculates the minimum * and optimal size for all work arrays. Each of these * values is returned in the first entry of the corresponding * work array, and no error message is issued by PXERBLA. * * INFO (local output) INTEGER * = 0: successful exit * < 0: If the i-th argument is an array and the j-entry had * an illegal value, then INFO = -(i*100+j), if the i-th * argument is a scalar and had an illegal value, then * INFO = -i. * * Further Details * =============== * * The matrix Q is represented as a product of elementary reflectors * * Q = H(ja) H(ja+1) . . . H(ja+k-1), where k = min(m,n). * * Each H(i) has the form * * H(j) = I - tau * v * v' * * where tau is a real scalar, and v is a real vector with v(1:i-1) = 0 * and v(i) = 1; v(i+1:m) is stored on exit in A(ia+i:ia+m-1,ja+i-1), * and tau in TAU(ja+i-1). * * ===================================================================== * * .. Parameters .. INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_, $ LLD_, MB_, M_, NB_, N_, RSRC_ PARAMETER ( BLOCK_CYCLIC_2D = 1, DLEN_ = 9, DTYPE_ = 1, $ CTXT_ = 2, M_ = 3, N_ = 4, MB_ = 5, NB_ = 6, $ RSRC_ = 7, CSRC_ = 8, LLD_ = 9 ) REAL ONE PARAMETER ( ONE = 1.0E+0 ) * .. * .. Local Scalars .. LOGICAL LQUERY CHARACTER COLBTOP, ROWBTOP INTEGER I, II, IACOL, IAROW, ICTXT, J, JJ, K, LWMIN, $ MP, MYCOL, MYROW, NPCOL, NPROW, NQ REAL AJJ, ALPHA * .. * .. External Subroutines .. EXTERNAL BLACS_ABORT, BLACS_GRIDINFO, CHK1MAT, INFOG2L, $ PSELSET, PSLARF, PSLARFG, PB_TOPGET, $ PB_TOPSET, PXERBLA, SGEBR2D, SGEBS2D, $ SLARFG, SSCAL * .. * .. External Functions .. INTEGER INDXG2P, NUMROC EXTERNAL INDXG2P, NUMROC * .. * .. Intrinsic Functions .. INTRINSIC MAX, MIN, MOD, REAL * .. * .. Executable Statements .. * * Get grid parameters * ICTXT = DESCA( CTXT_ ) CALL BLACS_GRIDINFO( ICTXT, NPROW, NPCOL, MYROW, MYCOL ) * * Test the input parameters * INFO = 0 IF( NPROW.EQ.-1 ) THEN INFO = -(600+CTXT_) ELSE CALL CHK1MAT( M, 1, N, 2, IA, JA, DESCA, 6, INFO ) IF( INFO.EQ.0 ) THEN IAROW = INDXG2P( IA, DESCA( MB_ ), MYROW, DESCA( RSRC_ ), $ NPROW ) IACOL = INDXG2P( JA, DESCA( NB_ ), MYCOL, DESCA( CSRC_ ), $ NPCOL ) MP = NUMROC( M+MOD( IA-1, DESCA( MB_ ) ), DESCA( MB_ ), $ MYROW, IAROW, NPROW ) NQ = NUMROC( N+MOD( JA-1, DESCA( NB_ ) ), DESCA( NB_ ), $ MYCOL, IACOL, NPCOL ) LWMIN = MP + MAX( 1, NQ ) * WORK( 1 ) = REAL( LWMIN ) LQUERY = ( LWORK.EQ.-1 ) IF( LWORK.LT.LWMIN .AND. .NOT.LQUERY ) $ INFO = -9 END IF END IF * IF( INFO.NE.0 ) THEN CALL PXERBLA( ICTXT, 'PSGEQR2', -INFO ) CALL BLACS_ABORT( ICTXT, 1 ) RETURN ELSE IF( LQUERY ) THEN RETURN END IF * * Quick return if possible * IF( M.EQ.0 .OR. N.EQ.0 ) $ RETURN * CALL PB_TOPGET( ICTXT, 'Broadcast', 'Rowwise', ROWBTOP ) CALL PB_TOPGET( ICTXT, 'Broadcast', 'Columnwise', COLBTOP ) CALL PB_TOPSET( ICTXT, 'Broadcast', 'Rowwise', 'I-ring' ) CALL PB_TOPSET( ICTXT, 'Broadcast', 'Columnwise', ' ' ) * IF( DESCA( M_ ).EQ.1 ) THEN CALL INFOG2L( IA, JA, DESCA, NPROW, NPCOL, MYROW, MYCOL, II, $ JJ, IAROW, IACOL ) IF( MYROW.EQ.IAROW ) THEN NQ = NUMROC( JA+N-1, DESCA( NB_ ), MYCOL, DESCA( CSRC_ ), $ NPCOL ) I = II+(JJ-1)*DESCA( LLD_ ) IF( MYCOL.EQ.IACOL ) THEN AJJ = A( I ) CALL SLARFG( 1, AJJ, A( I ), 1, TAU( JJ ) ) IF( N.GT.1 ) THEN ALPHA = ONE - TAU( JJ ) CALL SGEBS2D( ICTXT, 'Rowwise', ' ', 1, 1, ALPHA, 1 ) CALL SSCAL( NQ-JJ, ALPHA, A( I+DESCA( LLD_ ) ), $ DESCA( LLD_ ) ) END IF CALL SGEBS2D( ICTXT, 'Columnwise', ' ', 1, 1, TAU( JJ ), $ 1 ) A( I ) = AJJ ELSE IF( N.GT.1 ) THEN CALL SGEBR2D( ICTXT, 'Rowwise', ' ', 1, 1, ALPHA, $ 1, IAROW, IACOL ) CALL SSCAL( NQ-JJ+1, ALPHA, A( I ), DESCA( LLD_ ) ) END IF END IF ELSE IF( MYCOL.EQ.IACOL ) THEN CALL SGEBR2D( ICTXT, 'Columnwise', ' ', 1, 1, TAU( JJ ), 1, $ IAROW, IACOL ) END IF * ELSE * K = MIN( M, N ) DO 10 J = JA, JA+K-1 I = IA + J - JA * * Generate elementary reflector H(j) to annihilate * A(i+1:ia+m-1,j) * CALL PSLARFG( M-J+JA, AJJ, I, J, A, MIN( I+1, IA+M-1 ), J, $ DESCA, 1, TAU ) IF( J.LT.JA+N-1 ) THEN * * Apply H(j)' to A(i:ia+m-1,j+1:ja+n-1) from the left * CALL PSELSET( A, I, J, DESCA, ONE ) * CALL PSLARF( 'Left', M-J+JA, N-J+JA-1, A, I, J, DESCA, 1, $ TAU, A, I, J+1, DESCA, WORK ) END IF CALL PSELSET( A, I, J, DESCA, AJJ ) * 10 CONTINUE * END IF * CALL PB_TOPSET( ICTXT, 'Broadcast', 'Rowwise', ROWBTOP ) CALL PB_TOPSET( ICTXT, 'Broadcast', 'Columnwise', COLBTOP ) * WORK( 1 ) = REAL( LWMIN ) * RETURN * * End of PSGEQR2 * END
wrathematics/pbdSLAP
src/ScaLAPACK/psgeqr2.f
FORTRAN
mpl-2.0
12,063
require 'test_helper' class CFRGCurvesTest < Minitest::Test def test_curve25519_eddsa_ed25519 vectors = [ [ # TEST 1 hexstr2bin( "9d61b19deffd5a60ba844af492ec2cc4"\ "4449c5697b326919703bac031cae7f60"), # SECRET KEY hexstr2bin( "d75a980182b10ab7d54bfed3c964073a"\ "0ee172f3daa62325af021a68f707511a"), # PUBLIC KEY "", # MESSAGE hexstr2bin( "e5564300c360ac729086e2cc806e828a"\ "84877f1eb8e5d974d873e06522490155"\ "5fb8821590a33bacc61e39701cf9b46b"\ "d25bf5f0595bbe24655141438e7a100b") # SIGNATURE ], [ # TEST 2 hexstr2bin( "4ccd089b28ff96da9db6c346ec114e0f"\ "5b8a319f35aba624da8cf6ed4fb8a6fb"), # SECRET KEY hexstr2bin( "3d4017c3e843895a92b70aa74d1b7ebc"\ "9c982ccf2ec4968cc0cd55f12af4660c"), # PUBLIC KEY hexstr2bin("72"), # MESSAGE hexstr2bin( "92a009a9f0d4cab8720e820b5f642540"\ "a2b27b5416503f8fb3762223ebdb69da"\ "085ac1e43e15996e458f3613d0f11d8c"\ "387b2eaeb4302aeeb00d291612bb0c00") # SIGNATURE ], [ # TEST 3 hexstr2bin( "c5aa8df43f9f837bedb7442f31dcb7b1"\ "66d38535076f094b85ce3a2e0b4458f7"), # SECRET KEY hexstr2bin( "fc51cd8e6218a1a38da47ed00230f058"\ "0816ed13ba3303ac5deb911548908025"), # PUBLIC KEY hexstr2bin("af82"), # MESSAGE hexstr2bin( "6291d657deec24024827e69c3abe01a3"\ "0ce548a284743a445e3680d7db5ac3ac"\ "18ff9b538d16f290ae67f760984dc659"\ "4a7c15e9716ed28dc027beceea1ec40a") # SIGNATURE ], [ # TEST 1024 hexstr2bin( "f5e5767cf153319517630f226876b86c"\ "8160cc583bc013744c6bf255f5cc0ee5"), # SECRET KEY hexstr2bin( "278117fc144c72340f67d0f2316e8386"\ "ceffbf2b2428c9c51fef7c597f1d426e"), # PUBLIC KEY hexstr2bin( "08b8b2b733424243760fe426a4b54908"\ "632110a66c2f6591eabd3345e3e4eb98"\ "fa6e264bf09efe12ee50f8f54e9f77b1"\ "e355f6c50544e23fb1433ddf73be84d8"\ "79de7c0046dc4996d9e773f4bc9efe57"\ "38829adb26c81b37c93a1b270b20329d"\ "658675fc6ea534e0810a4432826bf58c"\ "941efb65d57a338bbd2e26640f89ffbc"\ "1a858efcb8550ee3a5e1998bd177e93a"\ "7363c344fe6b199ee5d02e82d522c4fe"\ "ba15452f80288a821a579116ec6dad2b"\ "3b310da903401aa62100ab5d1a36553e"\ "06203b33890cc9b832f79ef80560ccb9"\ "a39ce767967ed628c6ad573cb116dbef"\ "efd75499da96bd68a8a97b928a8bbc10"\ "3b6621fcde2beca1231d206be6cd9ec7"\ "aff6f6c94fcd7204ed3455c68c83f4a4"\ "1da4af2b74ef5c53f1d8ac70bdcb7ed1"\ "85ce81bd84359d44254d95629e9855a9"\ "4a7c1958d1f8ada5d0532ed8a5aa3fb2"\ "d17ba70eb6248e594e1a2297acbbb39d"\ "502f1a8c6eb6f1ce22b3de1a1f40cc24"\ "554119a831a9aad6079cad88425de6bd"\ "e1a9187ebb6092cf67bf2b13fd65f270"\ "88d78b7e883c8759d2c4f5c65adb7553"\ "878ad575f9fad878e80a0c9ba63bcbcc"\ "2732e69485bbc9c90bfbd62481d9089b"\ "eccf80cfe2df16a2cf65bd92dd597b07"\ "07e0917af48bbb75fed413d238f5555a"\ "7a569d80c3414a8d0859dc65a46128ba"\ "b27af87a71314f318c782b23ebfe808b"\ "82b0ce26401d2e22f04d83d1255dc51a"\ "ddd3b75a2b1ae0784504df543af8969b"\ "e3ea7082ff7fc9888c144da2af58429e"\ "c96031dbcad3dad9af0dcbaaaf268cb8"\ "fcffead94f3c7ca495e056a9b47acdb7"\ "51fb73e666c6c655ade8297297d07ad1"\ "ba5e43f1bca32301651339e22904cc8c"\ "42f58c30c04aafdb038dda0847dd988d"\ "cda6f3bfd15c4b4c4525004aa06eeff8"\ "ca61783aacec57fb3d1f92b0fe2fd1a8"\ "5f6724517b65e614ad6808d6f6ee34df"\ "f7310fdc82aebfd904b01e1dc54b2927"\ "094b2db68d6f903b68401adebf5a7e08"\ "d78ff4ef5d63653a65040cf9bfd4aca7"\ "984a74d37145986780fc0b16ac451649"\ "de6188a7dbdf191f64b5fc5e2ab47b57"\ "f7f7276cd419c17a3ca8e1b939ae49e4"\ "88acba6b965610b5480109c8b17b80e1"\ "b7b750dfc7598d5d5011fd2dcc5600a3"\ "2ef5b52a1ecc820e308aa342721aac09"\ "43bf6686b64b2579376504ccc493d97e"\ "6aed3fb0f9cd71a43dd497f01f17c0e2"\ "cb3797aa2a2f256656168e6c496afc5f"\ "b93246f6b1116398a346f1a641f3b041"\ "e989f7914f90cc2c7fff357876e506b5"\ "0d334ba77c225bc307ba537152f3f161"\ "0e4eafe595f6d9d90d11faa933a15ef1"\ "369546868a7f3a45a96768d40fd9d034"\ "12c091c6315cf4fde7cb68606937380d"\ "b2eaaa707b4c4185c32eddcdd306705e"\ "4dc1ffc872eeee475a64dfac86aba41c"\ "0618983f8741c5ef68d3a101e8a3b8ca"\ "c60c905c15fc910840b94c00a0b9d0"), # MESSAGE hexstr2bin( "0aab4c900501b3e24d7cdf4663326a3a"\ "87df5e4843b2cbdb67cbf6e460fec350"\ "aa5371b1508f9f4528ecea23c436d94b"\ "5e8fcd4f681e30a6ac00a9704a188a03") # SIGNATURE ], [ # TEST SHA(abc) hexstr2bin( "833fe62409237b9d62ec77587520911e"\ "9a759cec1d19755b7da901b96dca3d42"), # SECRET KEY hexstr2bin( "ec172b93ad5e563bf4932c70e1245034"\ "c35467ef2efd4d64ebf819683467e2bf"), # PUBLIC KEY hexstr2bin( "ddaf35a193617abacc417349ae204131"\ "12e6fa4e89a97ea20a9eeee64b55d39a"\ "2192992a274fc1a836ba3c23a3feebbd"\ "454d4423643ce80e2a9ac94fa54ca49f"), # MESSAGE hexstr2bin( "dc2a4459e7369633a52b1bf277839a00"\ "201009a3efbf3ecb69bea2186c26b589"\ "09351fc9ac90b3ecfdfbc7c66431e030"\ "3dca179c138ac17ad9bef1177331a704") # SIGNATURE ] ] vectors.each do |(secret, pk, m, sig)| _pk, sk = JOSE::JWA::Ed25519.keypair(secret) assert_equal pk, _pk _sig = JOSE::JWA::Ed25519.sign(m, sk) assert_equal sig, _sig assert JOSE::JWA::Ed25519.verify(sig, m, pk) if JOSE::JWA::Curve25519_RbNaCl.__supported__? _pk, sk = JOSE::JWA::Ed25519_RbNaCl.keypair(secret) assert_equal pk, _pk _sig = JOSE::JWA::Ed25519_RbNaCl.sign(m, sk) assert_equal sig, _sig assert JOSE::JWA::Ed25519_RbNaCl.verify(sig, m, pk) end end end def test_curve25519_eddsa_ed25519ph vectors = [ [ # TEST abc hexstr2bin( "833fe62409237b9d62ec77587520911e"\ "9a759cec1d19755b7da901b96dca3d42"), # SECRET KEY hexstr2bin( "ec172b93ad5e563bf4932c70e1245034"\ "c35467ef2efd4d64ebf819683467e2bf"), # PUBLIC KEY hexstr2bin("616263"), # MESSAGE hexstr2bin( "dc2a4459e7369633a52b1bf277839a00"\ "201009a3efbf3ecb69bea2186c26b589"\ "09351fc9ac90b3ecfdfbc7c66431e030"\ "3dca179c138ac17ad9bef1177331a704") # SIGNATURE ] ] vectors.each do |(secret, pk, m, sig)| if JOSE::JWA::Curve25519_RbNaCl.__supported__? _pk, sk = JOSE::JWA::Ed25519_RbNaCl.keypair(secret) assert_equal pk, _pk _sig = JOSE::JWA::Ed25519_RbNaCl.sign_ph(m, sk) assert_equal sig, _sig assert JOSE::JWA::Ed25519_RbNaCl.verify_ph(sig, m, pk) end end end def test_curve25519_rfc7748_curve25519 vectors = [ [ 31029842492115040904895560451863089656472772604678260265531221036453811406496, # Input scalar 34426434033919594451155107781188821651316167215306631574996226621102155684838, # Input u-coordinate hexstr2lint("c3da55379de9c6908e94ea4df28d084f32eccf03491c71f754b4075577a28552") # Output u-coordinate ], [ 35156891815674817266734212754503633747128614016119564763269015315466259359304, # Input scalar 8883857351183929894090759386610649319417338800022198945255395922347792736741, # Input u-coordinate hexstr2lint("95cbde9476e8907d7aade45cb4b873f88b595a68799fa152e6f8f7647aac7957") # Output u-coordinate ] ] vectors.each do |(input_scalar, input_u_coordinate, output_u_coordinate)| input_scalar = JOSE::JWA::X25519.coerce_scalar_fe!(input_scalar) input_u_coordinate = JOSE::JWA::X25519.coerce_coordinate_fe!(input_u_coordinate) output_u_coordinate = JOSE::JWA::X25519.coerce_coordinate_fe!(output_u_coordinate) assert_equal output_u_coordinate, JOSE::JWA::X25519.curve25519(input_scalar, input_u_coordinate) if JOSE::JWA::Curve25519_RbNaCl.__supported__? assert_equal output_u_coordinate.to_bytes(256), JOSE::JWA::X25519_RbNaCl.curve25519(input_scalar, input_u_coordinate) end end end def test_curve25519_rfc7748_x25519 vectors = [ [ hexstr2bin("77076d0a7318a57d3c16c17251b26645df4c2f87ebc0992ab177fba51db92c2a"), # Alice's private key, f hexstr2bin("8520f0098930a754748b7ddcb43ef75a0dbf3a0d26381af4eba4a98eaa9b4e6a"), # Alice's public key, X25519(f, 9) hexstr2bin("5dab087e624a8a4b79e17f8b83800ee66f3bb1292618b6fd1c2f8b27ff88e0eb"), # Bob's private key, g hexstr2bin("de9edb7d7b7dc1b4d35b61c2ece435373f8343c85b78674dadfc7e146f882b4f"), # Bob's public key, X25519(g, 9) hexstr2bin("4a5d9d5ba4ce2de1728e3bf480350f25e07e21c947d19e3376f09b3c1e161742") # Their shared secret, K ] ] vectors.each do |(alice_sk, alice_pk, bob_sk, bob_pk, k)| assert_equal k, JOSE::JWA::X25519.shared_secret(alice_pk, bob_sk) assert_equal k, JOSE::JWA::X25519.shared_secret(bob_pk, alice_sk) if JOSE::JWA::Curve25519_RbNaCl.__supported__? assert_equal k, JOSE::JWA::X25519_RbNaCl.shared_secret(alice_pk, bob_sk) assert_equal k, JOSE::JWA::X25519_RbNaCl.shared_secret(bob_pk, alice_sk) end end end def test_curve448_eddsa_ed448 vectors = [ [ # Blank hexstr2bin( "6c82a562cb808d10d632be89c8513ebf"\ "6c929f34ddfa8c9f63c9960ef6e348a3"\ "528c8a3fcc2f044e39a3fc5b94492f8f"\ "032e7549a20098f95b"), # SECRET KEY hexstr2bin( "5fd7449b59b461fd2ce787ec616ad46a"\ "1da1342485a70e1f8a0ea75d80e96778"\ "edf124769b46c7061bd6783df1e50f6c"\ "d1fa1abeafe8256180"), # PUBLIC KEY "", # MESSAGE hexstr2bin( "533a37f6bbe457251f023c0d88f976ae"\ "2dfb504a843e34d2074fd823d41a591f"\ "2b233f034f628281f2fd7a22ddd47d78"\ "28c59bd0a21bfd3980ff0d2028d4b18a"\ "9df63e006c5d1c2d345b925d8dc00b41"\ "04852db99ac5c7cdda8530a113a0f4db"\ "b61149f05a7363268c71d95808ff2e65"\ "2600") # SIGNATURE ], [ # 1 octet hexstr2bin( "c4eab05d357007c632f3dbb48489924d"\ "552b08fe0c353a0d4a1f00acda2c463a"\ "fbea67c5e8d2877c5e3bc397a659949e"\ "f8021e954e0a12274e"), # SECRET KEY hexstr2bin( "43ba28f430cdff456ae531545f7ecd0a"\ "c834a55d9358c0372bfa0c6c6798c086"\ "6aea01eb00742802b8438ea4cb82169c"\ "235160627b4c3a9480"), # PUBLIC KEY hexstr2bin("03"), # MESSAGE hexstr2bin( "26b8f91727bd62897af15e41eb43c377"\ "efb9c610d48f2335cb0bd0087810f435"\ "2541b143c4b981b7e18f62de8ccdf633"\ "fc1bf037ab7cd779805e0dbcc0aae1cb"\ "cee1afb2e027df36bc04dcecbf154336"\ "c19f0af7e0a6472905e799f1953d2a0f"\ "f3348ab21aa4adafd1d234441cf807c0"\ "3a00") # SIGNATURE ], [ # 1 octet (with context) hexstr2bin( "c4eab05d357007c632f3dbb48489924d"\ "552b08fe0c353a0d4a1f00acda2c463a"\ "fbea67c5e8d2877c5e3bc397a659949e"\ "f8021e954e0a12274e"), # SECRET KEY hexstr2bin( "43ba28f430cdff456ae531545f7ecd0a"\ "c834a55d9358c0372bfa0c6c6798c086"\ "6aea01eb00742802b8438ea4cb82169c"\ "235160627b4c3a9480"), # PUBLIC KEY hexstr2bin("03"), # MESSAGE hexstr2bin("666f6f"), # CONTEXT hexstr2bin( "d4f8f6131770dd46f40867d6fd5d5055"\ "de43541f8c5e35abbcd001b32a89f7d2"\ "151f7647f11d8ca2ae279fb842d60721"\ "7fce6e042f6815ea000c85741de5c8da"\ "1144a6a1aba7f96de42505d7a7298524"\ "fda538fccbbb754f578c1cad10d54d0d"\ "5428407e85dcbc98a49155c13764e66c"\ "3c00") # SIGNATURE ], [ # 11 octets hexstr2bin( "cd23d24f714274e744343237b93290f5"\ "11f6425f98e64459ff203e8985083ffd"\ "f60500553abc0e05cd02184bdb89c4cc"\ "d67e187951267eb328"), # SECRET KEY hexstr2bin( "dcea9e78f35a1bf3499a831b10b86c90"\ "aac01cd84b67a0109b55a36e9328b1e3"\ "65fce161d71ce7131a543ea4cb5f7e9f"\ "1d8b00696447001400"), # PUBLIC KEY hexstr2bin("0c3e544074ec63b0265e0c"), # MESSAGE hexstr2bin( "1f0a8888ce25e8d458a21130879b840a"\ "9089d999aaba039eaf3e3afa090a09d3"\ "89dba82c4ff2ae8ac5cdfb7c55e94d5d"\ "961a29fe0109941e00b8dbdeea6d3b05"\ "1068df7254c0cdc129cbe62db2dc957d"\ "bb47b51fd3f213fb8698f064774250a5"\ "028961c9bf8ffd973fe5d5c206492b14"\ "0e00") # SIGNATURE ], [ # 12 octets hexstr2bin( "258cdd4ada32ed9c9ff54e63756ae582"\ "fb8fab2ac721f2c8e676a72768513d93"\ "9f63dddb55609133f29adf86ec9929dc"\ "cb52c1c5fd2ff7e21b"), # SECRET KEY hexstr2bin( "3ba16da0c6f2cc1f30187740756f5e79"\ "8d6bc5fc015d7c63cc9510ee3fd44adc"\ "24d8e968b6e46e6f94d19b945361726b"\ "d75e149ef09817f580"), # PUBLIC KEY hexstr2bin("64a65f3cdedcdd66811e2915"), # MESSAGE hexstr2bin( "7eeeab7c4e50fb799b418ee5e3197ff6"\ "bf15d43a14c34389b59dd1a7b1b85b4a"\ "e90438aca634bea45e3a2695f1270f07"\ "fdcdf7c62b8efeaf00b45c2c96ba457e"\ "b1a8bf075a3db28e5c24f6b923ed4ad7"\ "47c3c9e03c7079efb87cb110d3a99861"\ "e72003cbae6d6b8b827e4e6c143064ff"\ "3c00") # SIGNATURE ], [ # 13 octets hexstr2bin( "7ef4e84544236752fbb56b8f31a23a10"\ "e42814f5f55ca037cdcc11c64c9a3b29"\ "49c1bb60700314611732a6c2fea98eeb"\ "c0266a11a93970100e"), # SECRET KEY hexstr2bin( "b3da079b0aa493a5772029f0467baebe"\ "e5a8112d9d3a22532361da294f7bb381"\ "5c5dc59e176b4d9f381ca0938e13c6c0"\ "7b174be65dfa578e80"), # PUBLIC KEY hexstr2bin("64a65f3cdedcdd66811e2915e7"), # MESSAGE hexstr2bin( "6a12066f55331b6c22acd5d5bfc5d712"\ "28fbda80ae8dec26bdd306743c5027cb"\ "4890810c162c027468675ecf645a8317"\ "6c0d7323a2ccde2d80efe5a1268e8aca"\ "1d6fbc194d3f77c44986eb4ab4177919"\ "ad8bec33eb47bbb5fc6e28196fd1caf5"\ "6b4e7e0ba5519234d047155ac727a105"\ "3100") # SIGNATURE ], [ # 64 octets hexstr2bin( "d65df341ad13e008567688baedda8e9d"\ "cdc17dc024974ea5b4227b6530e339bf"\ "f21f99e68ca6968f3cca6dfe0fb9f4fa"\ "b4fa135d5542ea3f01"), # SECRET KEY hexstr2bin( "df9705f58edbab802c7f8363cfe5560a"\ "b1c6132c20a9f1dd163483a26f8ac53a"\ "39d6808bf4a1dfbd261b099bb03b3fb5"\ "0906cb28bd8a081f00"), # PUBLIC KEY hexstr2bin( "bd0f6a3747cd561bdddf4640a332461a"\ "4a30a12a434cd0bf40d766d9c6d458e5"\ "512204a30c17d1f50b5079631f64eb31"\ "12182da3005835461113718d1a5ef944"), # MESSAGE hexstr2bin( "554bc2480860b49eab8532d2a533b7d5"\ "78ef473eeb58c98bb2d0e1ce488a98b1"\ "8dfde9b9b90775e67f47d4a1c3482058"\ "efc9f40d2ca033a0801b63d45b3b722e"\ "f552bad3b4ccb667da350192b61c508c"\ "f7b6b5adadc2c8d9a446ef003fb05cba"\ "5f30e88e36ec2703b349ca229c267083"\ "3900") # SIGNATURE ], [ # 64 octets hexstr2bin( "d65df341ad13e008567688baedda8e9d"\ "cdc17dc024974ea5b4227b6530e339bf"\ "f21f99e68ca6968f3cca6dfe0fb9f4fa"\ "b4fa135d5542ea3f01"), # SECRET KEY hexstr2bin( "df9705f58edbab802c7f8363cfe5560a"\ "b1c6132c20a9f1dd163483a26f8ac53a"\ "39d6808bf4a1dfbd261b099bb03b3fb5"\ "0906cb28bd8a081f00"), # PUBLIC KEY hexstr2bin( "bd0f6a3747cd561bdddf4640a332461a"\ "4a30a12a434cd0bf40d766d9c6d458e5"\ "512204a30c17d1f50b5079631f64eb31"\ "12182da3005835461113718d1a5ef944"), # MESSAGE hexstr2bin( "554bc2480860b49eab8532d2a533b7d5"\ "78ef473eeb58c98bb2d0e1ce488a98b1"\ "8dfde9b9b90775e67f47d4a1c3482058"\ "efc9f40d2ca033a0801b63d45b3b722e"\ "f552bad3b4ccb667da350192b61c508c"\ "f7b6b5adadc2c8d9a446ef003fb05cba"\ "5f30e88e36ec2703b349ca229c267083"\ "3900") # SIGNATURE ], [ # 256 octets hexstr2bin( "2ec5fe3c17045abdb136a5e6a913e32a"\ "b75ae68b53d2fc149b77e504132d3756"\ "9b7e766ba74a19bd6162343a21c8590a"\ "a9cebca9014c636df5"), # SECRET KEY hexstr2bin( "79756f014dcfe2079f5dd9e718be4171"\ "e2ef2486a08f25186f6bff43a9936b9b"\ "fe12402b08ae65798a3d81e22e9ec80e"\ "7690862ef3d4ed3a00"), # PUBLIC KEY hexstr2bin( "15777532b0bdd0d1389f636c5f6b9ba7"\ "34c90af572877e2d272dd078aa1e567c"\ "fa80e12928bb542330e8409f31745041"\ "07ecd5efac61ae7504dabe2a602ede89"\ "e5cca6257a7c77e27a702b3ae39fc769"\ "fc54f2395ae6a1178cab4738e543072f"\ "c1c177fe71e92e25bf03e4ecb72f47b6"\ "4d0465aaea4c7fad372536c8ba516a60"\ "39c3c2a39f0e4d832be432dfa9a706a6"\ "e5c7e19f397964ca4258002f7c0541b5"\ "90316dbc5622b6b2a6fe7a4abffd9610"\ "5eca76ea7b98816af0748c10df048ce0"\ "12d901015a51f189f3888145c03650aa"\ "23ce894c3bd889e030d565071c59f409"\ "a9981b51878fd6fc110624dcbcde0bf7"\ "a69ccce38fabdf86f3bef6044819de11"), # MESSAGE hexstr2bin( "c650ddbb0601c19ca11439e1640dd931"\ "f43c518ea5bea70d3dcde5f4191fe53f"\ "00cf966546b72bcc7d58be2b9badef28"\ "743954e3a44a23f880e8d4f1cfce2d7a"\ "61452d26da05896f0a50da66a239a8a1"\ "88b6d825b3305ad77b73fbac0836ecc6"\ "0987fd08527c1a8e80d5823e65cafe2a"\ "3d00") # SIGNATURE ], [ # 1023 octets hexstr2bin( "872d093780f5d3730df7c212664b37b8"\ "a0f24f56810daa8382cd4fa3f77634ec"\ "44dc54f1c2ed9bea86fafb7632d8be19"\ "9ea165f5ad55dd9ce8"), # SECRET KEY hexstr2bin( "a81b2e8a70a5ac94ffdbcc9badfc3feb"\ "0801f258578bb114ad44ece1ec0e799d"\ "a08effb81c5d685c0c56f64eecaef8cd"\ "f11cc38737838cf400"), # PUBLIC KEY hexstr2bin( "6ddf802e1aae4986935f7f981ba3f035"\ "1d6273c0a0c22c9c0e8339168e675412"\ "a3debfaf435ed651558007db4384b650"\ "fcc07e3b586a27a4f7a00ac8a6fec2cd"\ "86ae4bf1570c41e6a40c931db27b2faa"\ "15a8cedd52cff7362c4e6e23daec0fbc"\ "3a79b6806e316efcc7b68119bf46bc76"\ "a26067a53f296dafdbdc11c77f7777e9"\ "72660cf4b6a9b369a6665f02e0cc9b6e"\ "dfad136b4fabe723d2813db3136cfde9"\ "b6d044322fee2947952e031b73ab5c60"\ "3349b307bdc27bc6cb8b8bbd7bd32321"\ "9b8033a581b59eadebb09b3c4f3d2277"\ "d4f0343624acc817804728b25ab79717"\ "2b4c5c21a22f9c7839d64300232eb66e"\ "53f31c723fa37fe387c7d3e50bdf9813"\ "a30e5bb12cf4cd930c40cfb4e1fc6225"\ "92a49588794494d56d24ea4b40c89fc0"\ "596cc9ebb961c8cb10adde976a5d602b"\ "1c3f85b9b9a001ed3c6a4d3b1437f520"\ "96cd1956d042a597d561a596ecd3d173"\ "5a8d570ea0ec27225a2c4aaff26306d1"\ "526c1af3ca6d9cf5a2c98f47e1c46db9"\ "a33234cfd4d81f2c98538a09ebe76998"\ "d0d8fd25997c7d255c6d66ece6fa56f1"\ "1144950f027795e653008f4bd7ca2dee"\ "85d8e90f3dc315130ce2a00375a318c7"\ "c3d97be2c8ce5b6db41a6254ff264fa6"\ "155baee3b0773c0f497c573f19bb4f42"\ "40281f0b1f4f7be857a4e59d416c06b4"\ "c50fa09e1810ddc6b1467baeac5a3668"\ "d11b6ecaa901440016f389f80acc4db9"\ "77025e7f5924388c7e340a732e554440"\ "e76570f8dd71b7d640b3450d1fd5f041"\ "0a18f9a3494f707c717b79b4bf75c984"\ "00b096b21653b5d217cf3565c9597456"\ "f70703497a078763829bc01bb1cbc8fa"\ "04eadc9a6e3f6699587a9e75c94e5bab"\ "0036e0b2e711392cff0047d0d6b05bd2"\ "a588bc109718954259f1d86678a579a3"\ "120f19cfb2963f177aeb70f2d4844826"\ "262e51b80271272068ef5b3856fa8535"\ "aa2a88b2d41f2a0e2fda7624c2850272"\ "ac4a2f561f8f2f7a318bfd5caf969614"\ "9e4ac824ad3460538fdc25421beec2cc"\ "6818162d06bbed0c40a387192349db67"\ "a118bada6cd5ab0140ee273204f628aa"\ "d1c135f770279a651e24d8c14d75a605"\ "9d76b96a6fd857def5e0b354b27ab937"\ "a5815d16b5fae407ff18222c6d1ed263"\ "be68c95f32d908bd895cd76207ae7264"\ "87567f9a67dad79abec316f683b17f2d"\ "02bf07e0ac8b5bc6162cf94697b3c27c"\ "d1fea49b27f23ba2901871962506520c"\ "392da8b6ad0d99f7013fbc06c2c17a56"\ "9500c8a7696481c1cd33e9b14e40b82e"\ "79a5f5db82571ba97bae3ad3e0479515"\ "bb0e2b0f3bfcd1fd33034efc6245eddd"\ "7ee2086ddae2600d8ca73e214e8c2b0b"\ "db2b047c6a464a562ed77b73d2d841c4"\ "b34973551257713b753632efba348169"\ "abc90a68f42611a40126d7cb21b58695"\ "568186f7e569d2ff0f9e745d0487dd2e"\ "b997cafc5abf9dd102e62ff66cba87"), # MESSAGE hexstr2bin( "e301345a41a39a4d72fff8df69c98075"\ "a0cc082b802fc9b2b6bc503f926b65bd"\ "df7f4c8f1cb49f6396afc8a70abe6d8a"\ "ef0db478d4c6b2970076c6a0484fe76d"\ "76b3a97625d79f1ce240e7c576750d29"\ "5528286f719b413de9ada3e8eb78ed57"\ "3603ce30d8bb761785dc30dbc320869e"\ "1a00") # SIGNATURE ] ] vectors.each do |vector| secret, pk, m, ctx, sig = vector if sig.nil? sig = ctx ctx = nil end _pk, sk = JOSE::JWA::Ed448.keypair(secret) assert_equal pk, _pk _sig = JOSE::JWA::Ed448.sign(m, sk, ctx) assert_equal sig, _sig assert JOSE::JWA::Ed448.verify(sig, m, pk, ctx) end end def test_curve448_eddsa_ed448ph vectors = [ [ # TEST abc hexstr2bin( "833fe62409237b9d62ec77587520911e"\ "9a759cec1d19755b7da901b96dca3d42"\ "ef7822e0d5104127dc05d6dbefde69e3"\ "ab2cec7c867c6e2c49"), # SECRET KEY hexstr2bin( "259b71c19f83ef77a7abd26524cbdb31"\ "61b590a48f7d17de3ee0ba9c52beb743"\ "c09428a131d6b1b57303d90d8132c276"\ "d5ed3d5d01c0f53880"), # PUBLIC KEY hexstr2bin("616263"), # MESSAGE hexstr2bin( "963cf799d20fdf51c460310c1cf65d0e"\ "83c4ef5aa73332ba5b4c1e7635ff9e9b"\ "6a12b16436fa3681b92575e7eba40ee2"\ "79c487ad724b6d1080e1860e63dbdd58"\ "9f5125505b4de024264625e61b097956"\ "8703f9d9e2bbf5523a1886ee6da1ecb2"\ "0552bb506eb35a042658ec534bfc1c2c"\ "1a00") # SIGNATURE ], [ # TEST abc (with context) hexstr2bin( "833fe62409237b9d62ec77587520911e"\ "9a759cec1d19755b7da901b96dca3d42"\ "ef7822e0d5104127dc05d6dbefde69e3"\ "ab2cec7c867c6e2c49"), # SECRET KEY hexstr2bin( "259b71c19f83ef77a7abd26524cbdb31"\ "61b590a48f7d17de3ee0ba9c52beb743"\ "c09428a131d6b1b57303d90d8132c276"\ "d5ed3d5d01c0f53880"), # PUBLIC KEY hexstr2bin("616263"), # MESSAGE hexstr2bin("666f6f"), # CONTEXT hexstr2bin( "86a6bf52f9e8f84f451b2f392a8d1c3a"\ "414425fac0068f74aeead53b0e6b53d4"\ "555cea1726da4a65202880d407267087"\ "9e8e6fa4d9694c060054f2065dc206a6"\ "e615d0d8c99b95209b696c8125c5fbb9"\ "bc82a0f7ed3d99c4c11c47798ef0f7eb"\ "97b3b72ab4ac86eaf8b43449e8ac30ff"\ "3f00") # SIGNATURE ] ] vectors.each do |vector| secret, pk, m, ctx, sig = vector if sig.nil? sig = ctx ctx = nil end _pk, sk = JOSE::JWA::Ed448.keypair(secret) assert_equal pk, _pk _sig = JOSE::JWA::Ed448.sign_ph(m, sk, ctx) assert_equal sig, _sig assert JOSE::JWA::Ed448.verify_ph(sig, m, pk, ctx) end end def test_curve448_rfc7748_curve448 vectors = [ [ 599189175373896402783756016145213256157230856085026129926891459468622403380588640249457727683869421921443004045221642549886377526240828, # Input scalar 382239910814107330116229961234899377031416365240571325148346555922438025162094455820962429142971339584360034337310079791515452463053830, # Input u-coordinate hexstr2lint("ce3e4ff95a60dc6697da1db1d85e6afbdf79b50a2412d7546d5f239fe14fbaadeb445fc66a01b0779d98223961111e21766282f73dd96b6f") # Output u-coordinate ], [ 633254335906970592779259481534862372382525155252028961056404001332122152890562527156973881968934311400345568203929409663925541994577184, # Input scalar 622761797758325444462922068431234180649590390024811299761625153767228042600197997696167956134770744996690267634159427999832340166786063, # Input u-coordinate hexstr2lint("884a02576239ff7a2f2f63b2db6a9ff37047ac13568e1e30fe63c4a7ad1b3ee3a5700df34321d62077e63633c575c1c954514e99da7c179d") # Output u-coordinate ] ] vectors.each do |(input_scalar, input_u_coordinate, output_u_coordinate)| input_scalar = JOSE::JWA::X448.coerce_scalar_fe!(input_scalar) input_u_coordinate = JOSE::JWA::X448.coerce_coordinate_fe!(input_u_coordinate) output_u_coordinate = JOSE::JWA::X448.coerce_coordinate_fe!(output_u_coordinate) assert_equal output_u_coordinate, JOSE::JWA::X448.curve448(input_scalar, input_u_coordinate) end end def test_curve448_rfc7748_x448 vectors = [ [ hexstr2bin("9a8f4925d1519f5775cf46b04b5800d4ee9ee8bae8bc5565d498c28dd9c9baf574a9419744897391006382a6f127ab1d9ac2d8c0a598726b"), # Alice's private key, f hexstr2bin("9b08f7cc31b7e3e67d22d5aea121074a273bd2b83de09c63faa73d2c22c5d9bbc836647241d953d40c5b12da88120d53177f80e532c41fa0"), # Alice's public key, X448(f, 9) hexstr2bin("1c306a7ac2a0e2e0990b294470cba339e6453772b075811d8fad0d1d6927c120bb5ee8972b0d3e21374c9c921b09d1b0366f10b65173992d"), # Bob's private key, g hexstr2bin("3eb7a829b0cd20f5bcfc0b599b6feccf6da4627107bdb0d4f345b43027d8b972fc3e34fb4232a13ca706dcb57aec3dae07bdc1c67bf33609"), # Bob's public key, X448(g, 9) hexstr2bin("07fff4181ac6cc95ec1c16a94a0f74d12da232ce40a77552281d282bb60c0b56fd2464c335543936521c24403085d59a449a5037514a879d") # Their shared secret, K ] ] vectors.each do |(alice_sk, alice_pk, bob_sk, bob_pk, k)| assert_equal k, JOSE::JWA::X448.shared_secret(alice_pk, bob_sk) assert_equal k, JOSE::JWA::X448.shared_secret(bob_pk, alice_sk) end end private def hexstr2bin(hexstr) return [hexstr].pack('H*') end def hexstr2lint(hexstr) return OpenSSL::BN.new(hexstr2bin(hexstr).reverse, 2).to_i end end
potatosalad/ruby-jose
test/cfrg_curves_test.rb
Ruby
mpl-2.0
27,819
"use strict"; add_task(setupPrefsAndRecentWindowBehavior); let testcases = [ /** * A portal is detected when there's no browser window, * then a browser window is opened, and the portal is logged into * and redirects to a different page. The portal tab should be added * and focused when the window is opened, and left open after login * since it redirected. */ function* test_detectedWithNoBrowserWindow_Redirect() { yield portalDetected(); let win = yield focusWindowAndWaitForPortalUI(); let browser = win.gBrowser.selectedTab.linkedBrowser; let loadPromise = BrowserTestUtils.browserLoaded(browser, false, CANONICAL_URL_REDIRECTED); BrowserTestUtils.loadURI(browser, CANONICAL_URL_REDIRECTED); yield loadPromise; yield freePortal(true); ensurePortalTab(win); ensureNoPortalNotification(win); yield closeWindowAndWaitForXulWindowVisible(win); }, /** * Test the various expected behaviors of the "Show Login Page" button * in the captive portal notification. The button should be visible for * all tabs except the captive portal tab, and when clicked, should * ensure a captive portal tab is open and select it. */ function* test_showLoginPageButton() { let win = yield openWindowAndWaitForFocus(); yield portalDetected(); let notification = ensurePortalNotification(win); testShowLoginPageButtonVisibility(notification, "visible"); function testPortalTabSelectedAndButtonNotVisible() { is(win.gBrowser.selectedTab, tab, "The captive portal tab should be selected."); testShowLoginPageButtonVisibility(notification, "hidden"); } let button = notification.querySelector("button.notification-button"); function* clickButtonAndExpectNewPortalTab() { let p = BrowserTestUtils.waitForNewTab(win.gBrowser, CANONICAL_URL); button.click(); let tab = yield p; is(win.gBrowser.selectedTab, tab, "The captive portal tab should be selected."); return tab; } // Simulate clicking the button. The portal tab should be opened and // selected and the button should hide. let tab = yield clickButtonAndExpectNewPortalTab(); testPortalTabSelectedAndButtonNotVisible(); // Close the tab. The button should become visible. yield BrowserTestUtils.removeTab(tab); ensureNoPortalTab(win); testShowLoginPageButtonVisibility(notification, "visible"); // When the button is clicked, a new portal tab should be opened and // selected. tab = yield clickButtonAndExpectNewPortalTab(); // Open another arbitrary tab. The button should become visible. When it's clicked, // the portal tab should be selected. let anotherTab = yield BrowserTestUtils.openNewForegroundTab(win.gBrowser); testShowLoginPageButtonVisibility(notification, "visible"); button.click(); is(win.gBrowser.selectedTab, tab, "The captive portal tab should be selected."); // Close the portal tab and select the arbitrary tab. The button should become // visible and when it's clicked, a new portal tab should be opened. yield BrowserTestUtils.removeTab(tab); win.gBrowser.selectedTab = anotherTab; testShowLoginPageButtonVisibility(notification, "visible"); tab = yield clickButtonAndExpectNewPortalTab(); yield BrowserTestUtils.removeTab(anotherTab); yield freePortal(true); ensureNoPortalTab(win); ensureNoPortalNotification(win); yield closeWindowAndWaitForXulWindowVisible(win); }, ]; for (let testcase of testcases) { add_task(testcase); }
Yukarumya/Yukarum-Redfoxes
browser/base/content/test/captivePortal/browser_CaptivePortalWatcher_1.js
JavaScript
mpl-2.0
3,581
/** * m59peacemaker's memoize * * See https://github.com/m59peacemaker/angular-pmkr-components/tree/master/src/memoize * Released under the MIT license */ angular.module('syncthing.core') .factory('pmkr.memoize', [ function() { function service() { return memoizeFactory.apply(this, arguments); } function memoizeFactory(fn) { var cache = {}; function memoized() { var args = [].slice.call(arguments); var key = JSON.stringify(args); if (cache.hasOwnProperty(key)) { return cache[key]; } cache[key] = fn.apply(this, arguments); return cache[key]; } return memoized; } return service; } ]);
atyenoria/syncthing
gui/syncthing/core/memoize.js
JavaScript
mpl-2.0
903
# # This is the configuration file for the RPi environd # ### Presentation - General # All datetime stamps use typical strftime codes: https://docs.python.org/2/library/datetime.html#strftime-strptime-behavior # The date/time stamp of the last (most current) reading. present_lastread_stamp = "%I:%M %p on %A, %b %d" # How many decimal places to round to when displaying temperatures. For # presentation only - does not impact reading precision in the database. present_temp_precision = 1 ### Presentation - Recent Graph # The date/time stamp on the x-axis present_graph_recent_x = "%I:%M %p" # How many data points to use. # This does _not_ reflect how many points will be drawn. Also consider how # often the readings are made - e.g., if a value is recorded every 15 minutes, # then a full day's worth of data requires 24x(60/15) = 96 points. present_recent_point_count = 720 # How much to reduce the specified number of data points. # This is how many points will be drawn. The value of # present_recent_point_count is divided in to this many chunks, and then time # stamp and value of each chunk is averaged. present_recent_reduce_to = 16 ### Presentation - All Time Graph # < tbd... not implemented yet > ### Files # The static html file that is output. Must be writable by the user running # environd. Presumably this is in the www directory of a web server. www_out = "/var/www/environd.html" # The template to use for generating static html. # Must be readable by the user running environd. html_template = "/opt/environd/template/environd.tpl" # The (flat text) database file. # Must be writable by the user running environd, and must exist, even if empty. database = "/opt/environd/database/temperature_readings.json" # The log file. Must be writable by the user running environd. log_file = "/var/log/environd.log" # Format of the timestamping used internally. # Does not impact presentation unless presented values are omitted. datetime_func_format = "%Y%m%dT%H%M%S" ### Tinker/Debug # Set to True to print all log messages to the terminal, or False to suppress # most output. terminal_verbosity = True # The size in mb after which the db file is rotated. # The entire db is loaded in to memory, but each reading is a mere 60-80 # bytes, so 100 megs is about 10 years of recording every 15 minutes. max_db_file_size = 100 # mb
modalexii/RPi-Environd
config.py
Python
mpl-2.0
2,371
/* Copyright (c) 2013-2015 Jeffrey Pfau * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef GBA_VIDEO_H #define GBA_VIDEO_H #include <mgba-util/common.h> CXX_GUARD_START #include <mgba/core/log.h> #include <mgba/core/timing.h> #include <mgba/gba/interface.h> mLOG_DECLARE_CATEGORY(GBA_VIDEO); enum { VIDEO_HBLANK_PIXELS = 68, VIDEO_HDRAW_LENGTH = 960, VIDEO_HBLANK_LENGTH = 272, VIDEO_HBLANK_FLIP = 46, VIDEO_HORIZONTAL_LENGTH = 1232, VIDEO_VBLANK_PIXELS = 68, VIDEO_VERTICAL_TOTAL_PIXELS = 228, VIDEO_TOTAL_LENGTH = 280896, OBJ_HBLANK_FREE_LENGTH = 954, OBJ_LENGTH = 1210, BASE_TILE = 0x00010000 }; enum GBAVideoObjMode { OBJ_MODE_NORMAL = 0, OBJ_MODE_SEMITRANSPARENT = 1, OBJ_MODE_OBJWIN = 2 }; enum GBAVideoObjShape { OBJ_SHAPE_SQUARE = 0, OBJ_SHAPE_HORIZONTAL = 1, OBJ_SHAPE_VERTICAL = 2 }; enum GBAVideoBlendEffect { BLEND_NONE = 0, BLEND_ALPHA = 1, BLEND_BRIGHTEN = 2, BLEND_DARKEN = 3 }; DECL_BITFIELD(GBAObjAttributesA, uint16_t); DECL_BITS(GBAObjAttributesA, Y, 0, 8); DECL_BIT(GBAObjAttributesA, Transformed, 8); DECL_BIT(GBAObjAttributesA, Disable, 9); DECL_BIT(GBAObjAttributesA, DoubleSize, 9); DECL_BITS(GBAObjAttributesA, Mode, 10, 2); DECL_BIT(GBAObjAttributesA, Mosaic, 12); DECL_BIT(GBAObjAttributesA, 256Color, 13); DECL_BITS(GBAObjAttributesA, Shape, 14, 2); DECL_BITFIELD(GBAObjAttributesB, uint16_t); DECL_BITS(GBAObjAttributesB, X, 0, 9); DECL_BITS(GBAObjAttributesB, MatIndex, 9, 5); DECL_BIT(GBAObjAttributesB, HFlip, 12); DECL_BIT(GBAObjAttributesB, VFlip, 13); DECL_BITS(GBAObjAttributesB, Size, 14, 2); DECL_BITFIELD(GBAObjAttributesC, uint16_t); DECL_BITS(GBAObjAttributesC, Tile, 0, 10); DECL_BITS(GBAObjAttributesC, Priority, 10, 2); DECL_BITS(GBAObjAttributesC, Palette, 12, 4); struct GBAObj { GBAObjAttributesA a; GBAObjAttributesB b; GBAObjAttributesC c; uint16_t d; }; struct GBAOAMMatrix { int16_t padding0[3]; int16_t a; int16_t padding1[3]; int16_t b; int16_t padding2[3]; int16_t c; int16_t padding3[3]; int16_t d; }; union GBAOAM { struct GBAObj obj[128]; struct GBAOAMMatrix mat[32]; uint16_t raw[512]; }; struct GBAVideoWindowRegion { uint8_t end; uint8_t start; }; #define GBA_TEXT_MAP_TILE(MAP) ((MAP) & 0x03FF) #define GBA_TEXT_MAP_HFLIP(MAP) ((MAP) & 0x0400) #define GBA_TEXT_MAP_VFLIP(MAP) ((MAP) & 0x0800) #define GBA_TEXT_MAP_PALETTE(MAP) (((MAP) & 0xF000) >> 12) DECL_BITFIELD(GBARegisterDISPCNT, uint16_t); DECL_BITS(GBARegisterDISPCNT, Mode, 0, 3); DECL_BIT(GBARegisterDISPCNT, Cgb, 3); DECL_BIT(GBARegisterDISPCNT, FrameSelect, 4); DECL_BIT(GBARegisterDISPCNT, HblankIntervalFree, 5); DECL_BIT(GBARegisterDISPCNT, ObjCharacterMapping, 6); DECL_BIT(GBARegisterDISPCNT, ForcedBlank, 7); DECL_BIT(GBARegisterDISPCNT, Bg0Enable, 8); DECL_BIT(GBARegisterDISPCNT, Bg1Enable, 9); DECL_BIT(GBARegisterDISPCNT, Bg2Enable, 10); DECL_BIT(GBARegisterDISPCNT, Bg3Enable, 11); DECL_BIT(GBARegisterDISPCNT, ObjEnable, 12); DECL_BIT(GBARegisterDISPCNT, Win0Enable, 13); DECL_BIT(GBARegisterDISPCNT, Win1Enable, 14); DECL_BIT(GBARegisterDISPCNT, ObjwinEnable, 15); DECL_BITFIELD(GBARegisterDISPSTAT, uint16_t); DECL_BIT(GBARegisterDISPSTAT, InVblank, 0); DECL_BIT(GBARegisterDISPSTAT, InHblank, 1); DECL_BIT(GBARegisterDISPSTAT, Vcounter, 2); DECL_BIT(GBARegisterDISPSTAT, VblankIRQ, 3); DECL_BIT(GBARegisterDISPSTAT, HblankIRQ, 4); DECL_BIT(GBARegisterDISPSTAT, VcounterIRQ, 5); DECL_BITS(GBARegisterDISPSTAT, VcountSetting, 8, 8); DECL_BITFIELD(GBARegisterBGCNT, uint16_t); DECL_BITS(GBARegisterBGCNT, Priority, 0, 2); DECL_BITS(GBARegisterBGCNT, CharBase, 2, 2); DECL_BIT(GBARegisterBGCNT, Mosaic, 6); DECL_BIT(GBARegisterBGCNT, 256Color, 7); DECL_BITS(GBARegisterBGCNT, ScreenBase, 8, 5); DECL_BIT(GBARegisterBGCNT, Overflow, 13); DECL_BITS(GBARegisterBGCNT, Size, 14, 2); DECL_BITFIELD(GBARegisterBLDCNT, uint16_t); DECL_BIT(GBARegisterBLDCNT, Target1Bg0, 0); DECL_BIT(GBARegisterBLDCNT, Target1Bg1, 1); DECL_BIT(GBARegisterBLDCNT, Target1Bg2, 2); DECL_BIT(GBARegisterBLDCNT, Target1Bg3, 3); DECL_BIT(GBARegisterBLDCNT, Target1Obj, 4); DECL_BIT(GBARegisterBLDCNT, Target1Bd, 5); DECL_BITS(GBARegisterBLDCNT, Effect, 6, 2); DECL_BIT(GBARegisterBLDCNT, Target2Bg0, 8); DECL_BIT(GBARegisterBLDCNT, Target2Bg1, 9); DECL_BIT(GBARegisterBLDCNT, Target2Bg2, 10); DECL_BIT(GBARegisterBLDCNT, Target2Bg3, 11); DECL_BIT(GBARegisterBLDCNT, Target2Obj, 12); DECL_BIT(GBARegisterBLDCNT, Target2Bd, 13); DECL_BITFIELD(GBAWindowControl, uint8_t); DECL_BIT(GBAWindowControl, Bg0Enable, 0); DECL_BIT(GBAWindowControl, Bg1Enable, 1); DECL_BIT(GBAWindowControl, Bg2Enable, 2); DECL_BIT(GBAWindowControl, Bg3Enable, 3); DECL_BIT(GBAWindowControl, ObjEnable, 4); DECL_BIT(GBAWindowControl, BlendEnable, 5); DECL_BITFIELD(GBAMosaicControl, uint16_t); DECL_BITS(GBAMosaicControl, BgH, 0, 4); DECL_BITS(GBAMosaicControl, BgV, 4, 4); DECL_BITS(GBAMosaicControl, ObjH, 8, 4); DECL_BITS(GBAMosaicControl, ObjV, 12, 4); struct GBAVideoRenderer { void (*init)(struct GBAVideoRenderer* renderer); void (*reset)(struct GBAVideoRenderer* renderer); void (*deinit)(struct GBAVideoRenderer* renderer); uint16_t (*writeVideoRegister)(struct GBAVideoRenderer* renderer, uint32_t address, uint16_t value); void (*writeVRAM)(struct GBAVideoRenderer* renderer, uint32_t address); void (*writePalette)(struct GBAVideoRenderer* renderer, uint32_t address, uint16_t value); void (*writeOAM)(struct GBAVideoRenderer* renderer, uint32_t oam); void (*drawScanline)(struct GBAVideoRenderer* renderer, int y); void (*finishFrame)(struct GBAVideoRenderer* renderer); void (*getPixels)(struct GBAVideoRenderer* renderer, size_t* stride, const void** pixels); void (*putPixels)(struct GBAVideoRenderer* renderer, size_t stride, const void* pixels); uint16_t* palette; uint16_t* vram; union GBAOAM* oam; struct mCacheSet* cache; bool disableBG[4]; bool disableOBJ; bool disableWIN[2]; bool disableOBJWIN; bool highlightBG[4]; bool highlightOBJ[128]; color_t highlightColor; uint8_t highlightAmount; }; struct GBAVideo { struct GBA* p; struct GBAVideoRenderer* renderer; struct mTimingEvent event; int vcount; int shouldStall; uint16_t palette[512]; uint16_t* vram; union GBAOAM oam; int32_t frameCounter; int frameskip; int frameskipCounter; }; void GBAVideoInit(struct GBAVideo* video); void GBAVideoReset(struct GBAVideo* video); void GBAVideoDeinit(struct GBAVideo* video); void GBAVideoDummyRendererCreate(struct GBAVideoRenderer*); void GBAVideoAssociateRenderer(struct GBAVideo* video, struct GBAVideoRenderer* renderer); void GBAVideoWriteDISPSTAT(struct GBAVideo* video, uint16_t value); struct GBASerializedState; void GBAVideoSerialize(const struct GBAVideo* video, struct GBASerializedState* state); void GBAVideoDeserialize(struct GBAVideo* video, const struct GBASerializedState* state); extern MGBA_EXPORT const int GBAVideoObjSizes[16][2]; CXX_GUARD_END #endif
libretro/mgba
include/mgba/internal/gba/video.h
C
mpl-2.0
7,046
/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Copyright 2008-2015 MonetDB B.V. */ /* This file provides interfaces to perform certain atomic operations * on variables. Atomic in this sense means that an operation * performed in one thread shows up in another thread either * completely or not at all. * * If the symbol ATOMIC_LOCK is defined, a variable of type MT_Lock * must be declared and initialized. The latter can be done using the * macro ATOMIC_INIT which expands to nothing if ATOMIC_LOCK is not * defined. * * The following operations are defined: * ATOMIC_GET -- return the value of a variable; * ATOMIC_SET -- set the value of a variable; * ATOMIC_ADD -- add a value to a variable, return original value; * ATOMIC_SUB -- subtract a value from a variable, return original value; * ATOMIC_INC -- increment a variable's value, return new value; * ATOMIC_DEC -- decrement a variable's value, return new value; * These interfaces work on variables of type ATOMIC_TYPE * (int or lng depending on architecture). * * In addition, the following operations are defined: * ATOMIC_TAS -- test-and-set: set variable to "true" and return old value * ATOMIC_CLEAR -- set variable to "false" * These two operations are only defined on variables of type * ATOMIC_FLAG, and the only values defined for such a variable are * "false" (zero) and "true" (non-zero). The variable can be statically * initialized using the ATOMIC_FLAG_INIT macro. */ #ifndef _GDK_ATOMIC_H_ #define _GDK_ATOMIC_H_ /* define this if you don't want to use atomic instructions */ /* #define NO_ATOMIC_INSTRUCTIONS */ #if defined(HAVE_LIBATOMIC_OPS) && !defined(NO_ATOMIC_INSTRUCTIONS) #include <atomic_ops.h> #define ATOMIC_TYPE AO_t #define ATOMIC_GET(var, lck) AO_load_full(&var) #define ATOMIC_SET(var, val, lck) AO_store_full(&var, (val)) #define ATOMIC_ADD(var, val, lck) AO_fetch_and_add(&var, (val)) #define ATOMIC_SUB(var, val, lck) AO_fetch_and_add(&var, -(val)) #define ATOMIC_INC(var, lck) (AO_fetch_and_add1(&var) + 1) #define ATOMIC_DEC(var, lck) (AO_fetch_and_sub1(&var) - 1) #define ATOMIC_INIT(lck) ((void) 0) #define ATOMIC_FLAG AO_TS_t #define ATOMIC_FLAG_INIT { AO_TS_INITIALIZER } #define ATOMIC_CLEAR(var, lck) AO_CLEAR(&var) #define ATOMIC_TAS(var, lck) (AO_test_and_set_full(&var) != AO_TS_CLEAR) #else #if defined(_MSC_VER) && !defined(__INTEL_COMPILER) && !defined(NO_ATOMIC_INSTRUCTIONS) #include <intrin.h> #if SIZEOF_SSIZE_T == SIZEOF_LNG #define ATOMIC_TYPE lng #define ATOMIC_GET(var, lck) var #define ATOMIC_SET(var, val, lck) _InterlockedExchange64(&var, (val)) #define ATOMIC_ADD(var, val, lck) _InterlockedExchangeAdd64(&var, val) #define ATOMIC_SUB(var, val, lck) _InterlockedExchangeAdd64(&var, -(val)) #define ATOMIC_INC(var, lck) _InterlockedIncrement64(&var) #define ATOMIC_DEC(var, lck) _InterlockedDecrement64(&var) #pragma intrinsic(_InterlockedExchange64) #pragma intrinsic(_InterlockedExchangeAdd64) #pragma intrinsic(_InterlockedIncrement64) #pragma intrinsic(_InterlockedDecrement64) #pragma intrinsic(_InterlockedCompareExchange64) #else #define ATOMIC_TYPE int #define ATOMIC_GET(var, lck) var #define ATOMIC_SET(var, val, lck) _InterlockedExchange(&var, (val)) #define ATOMIC_ADD(var, val, lck) _InterlockedExchangeAdd(&var, (val)) #define ATOMIC_SUB(var, val, lck) _InterlockedExchangeAdd(&var, -(val)) #define ATOMIC_INC(var, lck) _InterlockedIncrement(&var) #define ATOMIC_DEC(var, lck) _InterlockedDecrement(&var) #pragma intrinsic(_InterlockedExchange) #pragma intrinsic(_InterlockedExchangeAdd) #pragma intrinsic(_InterlockedIncrement) #pragma intrinsic(_InterlockedDecrement) #endif #define ATOMIC_INIT(lck) ((void) 0) #define ATOMIC_FLAG int #define ATOMIC_FLAG_INIT { 0 } #define ATOMIC_CLEAR(var, lck) _InterlockedExchange(&var, 0) #define ATOMIC_TAS(var, lck) _InterlockedCompareExchange(&var, 1, 0) #pragma intrinsic(_InterlockedCompareExchange) #elif (defined(__GNUC__) || defined(__INTEL_COMPILER)) && !(defined(__sun__) && SIZEOF_SIZE_T == SIZEOF_LNG) && !defined(_MSC_VER) && !defined(NO_ATOMIC_INSTRUCTIONS) #if SIZEOF_SSIZE_T == SIZEOF_LNG #define ATOMIC_TYPE lng #else #define ATOMIC_TYPE int #endif #ifdef __ATOMIC_SEQ_CST /* the new way of doing this according to GCC */ #define ATOMIC_GET(var, lck) __atomic_load_n(&var, __ATOMIC_SEQ_CST) #define ATOMIC_SET(var, val, lck) __atomic_store_n(&var, (val), __ATOMIC_SEQ_CST) #define ATOMIC_ADD(var, val, lck) __atomic_fetch_add(&var, (val), __ATOMIC_SEQ_CST) #define ATOMIC_SUB(var, val, lck) __atomic_fetch_sub(&var, (val), __ATOMIC_SEQ_CST) #define ATOMIC_INC(var, lck) __atomic_add_fetch(&var, 1, __ATOMIC_SEQ_CST) #define ATOMIC_DEC(var, lck) __atomic_sub_fetch(&var, 1, __ATOMIC_SEQ_CST) #define ATOMIC_FLAG char #define ATOMIC_FLAG_INIT { 0 } #define ATOMIC_CLEAR(var, lck) __atomic_clear(&var, __ATOMIC_SEQ_CST) #define ATOMIC_TAS(var, lck) __atomic_test_and_set(&var, __ATOMIC_SEQ_CST) #else /* the old way of doing this, (still?) needed for Intel compiler on Linux */ #define ATOMIC_GET(var, lck) var #define ATOMIC_SET(var, val, lck) (var = (val)) #define ATOMIC_ADD(var, val, lck) __sync_fetch_and_add(&var, (val)) #define ATOMIC_SUB(var, val, lck) __sync_fetch_and_sub(&var, (val)) #define ATOMIC_INC(var, lck) __sync_add_and_fetch(&var, 1) #define ATOMIC_DEC(var, lck) __sync_sub_and_fetch(&var, 1) #define ATOMIC_FLAG int #define ATOMIC_FLAG_INIT { 0 } #define ATOMIC_CLEAR(var, lck) __sync_lock_release(&var) #define ATOMIC_TAS(var, lck) __sync_lock_test_and_set(&var, 1) #endif #define ATOMIC_INIT(lck) ((void) 0) #else #if SIZEOF_SSIZE_T == SIZEOF_LNG #define ATOMIC_TYPE lng #else #define ATOMIC_TYPE int #endif static inline ATOMIC_TYPE __ATOMIC_GET(volatile ATOMIC_TYPE *var, pthread_mutex_t *lck) { ATOMIC_TYPE old; pthread_mutex_lock(lck); old = *var; pthread_mutex_unlock(lck); return old; } #define ATOMIC_GET(var, lck) __ATOMIC_GET(&var, &(lck).lock) static inline ATOMIC_TYPE __ATOMIC_SET(volatile ATOMIC_TYPE *var, ATOMIC_TYPE val, pthread_mutex_t *lck) { ATOMIC_TYPE new; pthread_mutex_lock(lck); *var = val; new = *var; pthread_mutex_unlock(lck); return new; } #define ATOMIC_SET(var, val, lck) __ATOMIC_SET(&var, (val), &(lck).lock) static inline ATOMIC_TYPE __ATOMIC_ADD(volatile ATOMIC_TYPE *var, ATOMIC_TYPE val, pthread_mutex_t *lck) { ATOMIC_TYPE old; pthread_mutex_lock(lck); old = *var; *var += val; pthread_mutex_unlock(lck); return old; } #define ATOMIC_ADD(var, val, lck) __ATOMIC_ADD(&var, (val), &(lck).lock) static inline ATOMIC_TYPE __ATOMIC_SUB(volatile ATOMIC_TYPE *var, ATOMIC_TYPE val, pthread_mutex_t *lck) { ATOMIC_TYPE old; pthread_mutex_lock(lck); old = *var; *var -= val; pthread_mutex_unlock(lck); return old; } #define ATOMIC_SUB(var, val, lck) __ATOMIC_SUB(&var, (val), &(lck).lock) static inline ATOMIC_TYPE __ATOMIC_INC(volatile ATOMIC_TYPE *var, pthread_mutex_t *lck) { ATOMIC_TYPE new; pthread_mutex_lock(lck); new = ++*var; pthread_mutex_unlock(lck); return new; } #define ATOMIC_INC(var, lck) __ATOMIC_INC(&var, &(lck).lock) static inline ATOMIC_TYPE __ATOMIC_DEC(volatile ATOMIC_TYPE *var, pthread_mutex_t *lck) { ATOMIC_TYPE new; pthread_mutex_lock(lck); new = --*var; pthread_mutex_unlock(lck); return new; } #define ATOMIC_DEC(var, lck) __ATOMIC_DEC(&var, &(lck).lock) #define USE_PTHREAD_LOCKS /* must use pthread locks */ #define ATOMIC_LOCK /* must use locks for atomic access */ #define ATOMIC_INIT(lck) MT_lock_init(&(lck), #lck) #define ATOMIC_FLAG int #define ATOMIC_FLAG_INIT {0} static inline ATOMIC_FLAG __ATOMIC_TAS(volatile ATOMIC_FLAG *var, pthread_mutex_t *lck) { ATOMIC_FLAG orig; pthread_mutex_lock(lck); if ((orig = *var) == 0) *var = 1; pthread_mutex_unlock(lck); return orig; } #define ATOMIC_TAS(var, lck) __ATOMIC_TAS(&var, &(lck).lock) static inline void __ATOMIC_CLEAR(volatile ATOMIC_FLAG *var, pthread_mutex_t *lck) { pthread_mutex_lock(lck); *var = 0; pthread_mutex_unlock(lck); } #define ATOMIC_CLEAR(var, lck) __ATOMIC_CLEAR(&var, &(lck).lock) #endif #endif /* LIBATOMIC_OPS */ #endif /* _GDK_ATOMIC_H_ */
zyzyis/monetdb
gdk/gdk_atomic.h
C
mpl-2.0
8,332
class VoidTile include IndefiniteArticle DEAD_COORDINATE = -9001 attr_reader :x attr_reader :y attr_reader :z attr_reader :plane def self.generate_hash(x, y, z) { x: x, y: y, z: z, name: '', description: '', colour: 'black', type: 'Void', occupants: 0} end class FakeArray < Array def <<(ignored) self end end @@fakearray = FakeArray.new def initialize(p, x, y, z) @x = x @y = y @z = z @plane = p end def colour 'black' end def type Entity::VoidTileType end def description '' end def name '' end def characters @@fakearray end def visible_character_count 0 end def occupants @@fakearray end def traversible? false end def portals_packets [] end def save end def statuses [] end def type_statuses [] end def to_h {name: self.name, type: self.type.name, type_id: self.type.id, description: self.description, x: self.x, y: self.y, z: self.z, plane: self.plane, occupants: self.visible_character_count} end def unserialise_statuses # do nothing end end
NexusClash/NexusClash
firmament/entities/void_tile.rb
Ruby
mpl-2.0
1,058
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="generator" content="rustdoc"> <meta name="description" content="API documentation for the Rust `CaptureIndex` type in crate `regex_syntax`."> <meta name="keywords" content="rust, rustlang, rust-lang, CaptureIndex"> <title>regex_syntax::CaptureIndex - Rust</title> <link rel="stylesheet" type="text/css" href="../rustdoc.css"> <link rel="stylesheet" type="text/css" href="../main.css"> </head> <body class="rustdoc"> <!--[if lte IE 8]> <div class="warning"> This old browser is unsupported and will most likely display funky things. </div> <![endif]--> <nav class="sidebar"> <p class='location'><a href='index.html'>regex_syntax</a></p><script>window.sidebarCurrent = {name: 'CaptureIndex', ty: 'type', relpath: ''};</script><script defer src="sidebar-items.js"></script> </nav> <nav class="sub"> <form class="search-form js-only"> <div class="search-container"> <input class="search-input" name="search" autocomplete="off" placeholder="Click or press β€˜S’ to search, β€˜?’ for more options…" type="search"> </div> </form> </nav> <section id='main' class="content type"> <h1 class='fqn'><span class='in-band'><a href='index.html'>regex_syntax</a>::<wbr><a class='type' href=''>CaptureIndex</a></span><span class='out-of-band'><span id='render-detail'> <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs"> [<span class='inner'>&#x2212;</span>] </a> </span><a id='src-1269' class='srclink' href='../src/regex_syntax/lib.rs.html#181' title='goto source code'>[src]</a></span></h1> <pre class='rust typedef'>type CaptureIndex = <a class='enum' href='../core/option/enum.Option.html' title='core::option::Option'>Option</a>&lt;<a class='primitive' href='../std/primitive.usize.html'>usize</a>&gt;;</pre></section> <section id='search' class="content hidden"></section> <section class="footer"></section> <aside id="help" class="hidden"> <div> <h1 class="hidden">Help</h1> <div class="shortcuts"> <h2>Keyboard Shortcuts</h2> <dl> <dt>?</dt> <dd>Show this help dialog</dd> <dt>S</dt> <dd>Focus the search field</dd> <dt>&larrb;</dt> <dd>Move up in search results</dd> <dt>&rarrb;</dt> <dd>Move down in search results</dd> <dt>&#9166;</dt> <dd>Go to active search result</dd> <dt>+</dt> <dd>Collapse/expand all sections</dd> </dl> </div> <div class="infos"> <h2>Search Tricks</h2> <p> Prefix searches with a type followed by a colon (e.g. <code>fn:</code>) to restrict the search to a given type. </p> <p> Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>. </p> <p> Search functions by type signature (e.g. <code>vec -> usize</code> or <code>* -> vec</code>) </p> </div> </div> </aside> <script> window.rootPath = "../"; window.currentCrate = "regex_syntax"; window.playgroundUrl = ""; </script> <script src="../jquery.js"></script> <script src="../main.js"></script> <script defer src="../search-index.js"></script> </body> </html>
servo/doc.servo.org
regex_syntax/type.CaptureIndex.html
HTML
mpl-2.0
4,172
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html data-context="About" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/> <title>Mozilla Public License Version 2.0 - Legato Docs</title> <meta content="legatoβ„’ is an open source Linux-based embedded platform designed to simplify connected IoT application development" name="description"/> <meta content="legato, iot" name="keywords"/> <meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport"/> <meta content="19.11.6" name="legato-version"/> <link href="resources/images/legato.ico" rel="shortcut icon"/> <link href="resources/images/legato.ico" rel="icon" type="image/x-icon"/> <link href="resources/images/legato.ico" rel="shortcut icon" type="image/x-icon"/> <link href="resources/images/legato.ico" rel="apple-touch-icon" type="image/x-icon"/> <link href="resources/css/style.css" media="screen" rel="stylesheet" type="text/css"/> <link href="resources/css/font-awesome.css" rel="stylesheet" type="text/css"/> <!--[if IE]> <script src="resources/js/html5shiv.js"></script> <script src="resources/js/respond.js"></script> <![endif]--> <script src="https://code.jquery.com/jquery-2.2.3.min.js"></script> <script src="resources/js/main.js"></script> <script src="tocs/About_Licenses.json"></script> </head> <body> <noscript> <input class="modal-closing-trick" id="modal-closing-trick" type="checkbox"/> <div id="nojs"> <label for="modal-closing-trick"> <span>You seem to not have Javascript <a href="http://enable-javascript.com">enabled</a>, so site functionality like the search and navigation tree won't work.</span> </label> </div> </noscript> <div class="wrapper"> <div class="fa fa-bars documentation" id="menu-trigger"></div> <div id="top"> <header> <nav> <a class="navlink" href="/">Introduction</a><a class="navlink" href="buildAppsMain.html">Build Apps</a><a class="navlink" href="buildPlatformMain.html">Build Platform</a><a class="navlink selected" href="aboutMain.html">About</a> </nav> </header> </div> <div class="white" id="menudocumentation"> <header> <a href="/"> <img alt="Back to Legato Homepage" id="logo" src="resources/images/legato_logo.png"/></a> <h2>/ About</h2> <nav class="secondary"> <a href="aboutLegato.html">Legato</a><a href="aboutReleaseNotes.html">Release Notes</a><a class="link-selected" href="aboutLicenses.html">Licenses</a><a href="aboutLegatoContributing.html">Contribute Code</a> </nav> <nav class="ui-front"> <i class="fa fa-search" id="search-icon"></i> <input id="searchbox" placeholder="Search"/> </nav> </header> </div> <div id="resizable"> <div id="left"> <div id="tree1"></div> </div> </div> <div class="content"> <div class="header"> <div class="headertitle"> <h1 class="title">Mozilla Public License Version 2.0 </h1> </div> </div><div class="contents"> <div class="textblock"><pre class="fragment">1. Definitions -------------- 1.1. "Contributor" means each individual or legal entity that creates, contributes to the creation of, or owns Covered Software. 1.2. "Contributor Version" means the combination of the Contributions of others (if any) used by a Contributor and that particular Contributor's Contribution. 1.3. "Contribution" means Covered Software of a particular Contributor. 1.4. "Covered Software" means Source Code Form to which the initial Contributor has attached the notice in Exhibit A, the Executable Form of such Source Code Form, and Modifications of such Source Code Form, in each case including portions thereof. 1.5. "Incompatible With Secondary Licenses" means (a) that the initial Contributor has attached the notice described in Exhibit B to the Covered Software; or (b) that the Covered Software was made available under the terms of version 1.1 or earlier of the License, but not also under the terms of a Secondary License. 1.6. "Executable Form" means any form of the work other than Source Code Form. 1.7. "Larger Work" means a work that combines Covered Software with other material, in a separate file or files, that is not Covered Software. 1.8. "License" means this document. 1.9. "Licensable" means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently, any and all of the rights conveyed by this License. 1.10. "Modifications" means any of the following: (a) any file in Source Code Form that results from an addition to, deletion from, or modification of the contents of Covered Software; or (b) any new file in Source Code Form that contains any Covered Software. 1.11. "Patent Claims" of a Contributor means any patent claim(s), including without limitation, method, process, and apparatus claims, in any patent Licensable by such Contributor that would be infringed, but for the grant of the License, by the making, using, selling, offering for sale, having made, import, or transfer of either its Contributions or its Contributor Version. 1.12. "Secondary License" means either the GNU General Public License, Version 2.0, the GNU Lesser General Public License, Version 2.1, the GNU Affero General Public License, Version 3.0, or any later versions of those licenses. 1.13. "Source Code Form" means the form of the work preferred for making modifications. 1.14. "You" (or "Your") means an individual or a legal entity exercising rights under this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with You. For purposes of this definition, "control" means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity. 2. License Grants and Conditions -------------------------------- 2.1. Grants Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license: (a) under intellectual property rights (other than patent or trademark) Licensable by such Contributor to use, reproduce, make available, modify, display, perform, distribute, and otherwise exploit its Contributions, either on an unmodified basis, with Modifications, or as part of a Larger Work; and (b) under Patent Claims of such Contributor to make, use, sell, offer for sale, have made, import, and otherwise transfer either its Contributions or its Contributor Version. 2.2. Effective Date The licenses granted in Section 2.1 with respect to any Contribution become effective for each Contribution on the date the Contributor first distributes such Contribution. 2.3. Limitations on Grant Scope The licenses granted in this Section 2 are the only rights granted under this License. No additional rights or licenses will be implied from the distribution or licensing of Covered Software under this License. Notwithstanding Section 2.1(b) above, no patent license is granted by a Contributor: (a) for any code that a Contributor has removed from Covered Software; or (b) for infringements caused by: (i) Your and any other third party's modifications of Covered Software, or (ii) the combination of its Contributions with other software (except as part of its Contributor Version); or (c) under Patent Claims infringed by Covered Software in the absence of its Contributions. This License does not grant any rights in the trademarks, service marks, or logos of any Contributor (except as may be necessary to comply with the notice requirements in Section 3.4). 2.4. Subsequent Licenses No Contributor makes additional grants as a result of Your choice to distribute the Covered Software under a subsequent version of this License (see Section 10.2) or under the terms of a Secondary License (if permitted under the terms of Section 3.3). 2.5. Representation Each Contributor represents that the Contributor believes its Contributions are its original creation(s) or it has sufficient rights to grant the rights to its Contributions conveyed by this License. 2.6. Fair Use This License is not intended to limit any rights You have under applicable copyright doctrines of fair use, fair dealing, or other equivalents. 2.7. Conditions Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in Section 2.1. 3. Responsibilities ------------------- 3.1. Distribution of Source Form All distribution of Covered Software in Source Code Form, including any Modifications that You create or to which You contribute, must be under the terms of this License. You must inform recipients that the Source Code Form of the Covered Software is governed by the terms of this License, and how they can obtain a copy of this License. You may not attempt to alter or restrict the recipients' rights in the Source Code Form. 3.2. Distribution of Executable Form If You distribute Covered Software in Executable Form then: (a) such Covered Software must also be made available in Source Code Form, as described in Section 3.1, and You must inform recipients of the Executable Form how they can obtain a copy of such Source Code Form by reasonable means in a timely manner, at a charge no more than the cost of distribution to the recipient; and (b) You may distribute such Executable Form under the terms of this License, or sublicense it under different terms, provided that the license for the Executable Form does not attempt to limit or alter the recipients' rights in the Source Code Form under this License. 3.3. Distribution of a Larger Work You may create and distribute a Larger Work under terms of Your choice, provided that You also comply with the requirements of this License for the Covered Software. If the Larger Work is a combination of Covered Software with a work governed by one or more Secondary Licenses, and the Covered Software is not Incompatible With Secondary Licenses, this License permits You to additionally distribute such Covered Software under the terms of such Secondary License(s), so that the recipient of the Larger Work may, at their option, further distribute the Covered Software under the terms of either this License or such Secondary License(s). 3.4. Notices You may not remove or alter the substance of any license notices (including copyright notices, patent notices, disclaimers of warranty, or limitations of liability) contained within the Source Code Form of the Covered Software, except that You may alter any license notices to the extent required to remedy known factual inaccuracies. 3.5. Application of Additional Terms You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, You may do so only on Your own behalf, and not on behalf of any Contributor. You must make it absolutely clear that any such warranty, support, indemnity, or liability obligation is offered by You alone, and You hereby agree to indemnify every Contributor for any liability incurred by such Contributor as a result of warranty, support, indemnity or liability terms You offer. You may include additional disclaimers of warranty and limitations of liability specific to any jurisdiction. 4. Inability to Comply Due to Statute or Regulation --------------------------------------------------- If it is impossible for You to comply with any of the terms of statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be placed in a text file included with all distributions of the Covered Software under this License. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it. 5. Termination -------------- 5.1. The rights granted under this License will terminate automatically if You fail to comply with any of its terms. However, if You become compliant, then the rights granted under this License from a particular Contributor are reinstated (a) provisionally, unless and until such Contributor explicitly and finally terminates Your grants, and (b) on an ongoing basis, if such Contributor fails to notify You of the non-compliance by some reasonable means prior to 60 days after You have come back into compliance. Moreover, Your grants from a particular Contributor are reinstated on an ongoing basis if such Contributor notifies You of the non-compliance by some reasonable means, this is the first time You have received notice of non-compliance with this License from such Contributor, and You become compliant prior to 30 days after Your receipt of the notice. 5.2. If You initiate litigation against any entity by asserting a patent infringement claim (excluding declaratory judgment actions, counter-claims, and cross-claims) alleging that a Contributor Version directly or indirectly infringes any patent, then the rights granted to You by any and all Contributors for the Covered Software under Section 2.1 of this License shall terminate. 5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or Your distributors under this License prior to termination shall survive termination. ************************************************************************ * * * 6. Disclaimer of Warranty * * ------------------------- * * * * Covered Software is provided under this License on an "as is" * * basis, without warranty of any kind, either expressed, implied, or * * statutory, including, without limitation, warranties that the * * Covered Software is free of defects, merchantable, fit for a * * particular purpose or non-infringing. The entire risk as to the * * quality and performance of the Covered Software is with You. * * Should any Covered Software prove defective in any respect, You * * (not any Contributor) assume the cost of any necessary servicing, * * repair, or correction. This disclaimer of warranty constitutes an * * essential part of this License. No use of any Covered Software is * * authorized under this License except under this disclaimer. * * * ************************************************************************ ************************************************************************ * * * 7. Limitation of Liability * * -------------------------- * * * * Under no circumstances and under no legal theory, whether tort * * (including negligence), contract, or otherwise, shall any * * Contributor, or anyone who distributes Covered Software as * * permitted above, be liable to You for any direct, indirect, * * special, incidental, or consequential damages of any character * * including, without limitation, damages for lost profits, loss of * * goodwill, work stoppage, computer failure or malfunction, or any * * and all other commercial damages or losses, even if such party * * shall have been informed of the possibility of such damages. This * * limitation of liability shall not apply to liability for death or * * personal injury resulting from such party's negligence to the * * extent applicable law prohibits such limitation. Some * * jurisdictions do not allow the exclusion or limitation of * * incidental or consequential damages, so this exclusion and * * limitation may not apply to You. * * * ************************************************************************ 8. Litigation ------------- Any litigation relating to this License may be brought only in the courts of a jurisdiction where the defendant maintains its principal place of business and such litigation shall be governed by laws of that jurisdiction, without reference to its conflict-of-law provisions. Nothing in this Section shall prevent a party's ability to bring cross-claims or counter-claims. 9. Miscellaneous ---------------- This License represents the complete agreement concerning the subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not be used to construe this License against a Contributor. 10. Versions of the License --------------------------- 10.1. New Versions Mozilla Foundation is the license steward. Except as provided in Section 10.3, no one other than the license steward has the right to modify or publish new versions of this License. Each version will be given a distinguishing version number. 10.2. Effect of New Versions You may distribute the Covered Software under the terms of the version of the License under which You originally received the Covered Software, or under the terms of any subsequent version published by the license steward. 10.3. Modified Versions If you create software not governed by this License, and you want to create a new license for such software, you may create and use a modified version of this License if you rename the license and remove any references to the name of the license steward (except to note that such modified license differs from this License). 10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses If You choose to distribute Source Code Form that is Incompatible With Secondary Licenses under the terms of this version of the License, the notice described in Exhibit B of this License must be attached. Exhibit A - Source Code Form License Notice ------------------------------------------- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. If it is not possible or desirable to put the notice in a particular file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice. You may add additional accurate notices of copyright ownership. Exhibit B - "Incompatible With Secondary Licenses" Notice --------------------------------------------------------- This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.</pre> </div></div> <br clear="left"/> </div> </div> <link href="resources/css/jqtree.css" rel="stylesheet" type="text/css"/> <script src="resources/js/tree.jquery.js" type="text/javascript"></script> <script src="resources/js/jquery.cookie.js"></script> <script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script> <link href="resources/css/perfect-scrollbar.min.css" rel="stylesheet"/> <script src="resources/js/perfect-scrollbar.jquery.min.js"></script> </body> </html>
legatoproject/legato-docs
19_11_6/aboutLicensesMPLv2.html
HTML
mpl-2.0
19,869
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="generator" content="rustdoc"> <meta name="description" content="API documentation for the Rust `AppendToAutoIdVector` fn in crate `js`."> <meta name="keywords" content="rust, rustlang, rust-lang, AppendToAutoIdVector"> <title>js::glue::AppendToAutoIdVector - Rust</title> <link rel="stylesheet" type="text/css" href="../../main.css"> </head> <body class="rustdoc"> <!--[if lte IE 8]> <div class="warning"> This old browser is unsupported and will most likely display funky things. </div> <![endif]--> <section class="sidebar"> <p class='location'><a href='../index.html'>js</a>::<wbr><a href='index.html'>glue</a></p><script>window.sidebarCurrent = {name: 'AppendToAutoIdVector', ty: 'fn', relpath: ''};</script><script defer src="sidebar-items.js"></script> </section> <nav class="sub"> <form class="search-form js-only"> <div class="search-container"> <input class="search-input" name="search" autocomplete="off" placeholder="Click or press β€˜S’ to search, β€˜?’ for more options…" type="search"> </div> </form> </nav> <section id='main' class="content fn"> <h1 class='fqn'><span class='in-band'><a href='../index.html'>js</a>::<wbr><a href='index.html'>glue</a>::<wbr><a class='fn' href=''>AppendToAutoIdVector</a></span><span class='out-of-band'><span id='render-detail'> <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs"> [<span class='inner'>&#x2212;</span>] </a> </span><a id='src-44187' class='srclink' href='../../src/js/glue.rs.html#228' title='goto source code'>[src]</a></span></h1> <pre class='rust fn'>pub unsafe extern fn AppendToAutoIdVector(v: <a href='../../std/primitive.pointer.html'>*mut <a class='struct' href='../../js/jsapi/struct.AutoIdVector.html' title='js::jsapi::AutoIdVector'>AutoIdVector</a></a>, id: <a class='struct' href='../../js/jsapi/struct.jsid.html' title='js::jsapi::jsid'>jsid</a>) -&gt; <a href='../../std/primitive.u8.html'>u8</a></pre></section> <section id='search' class="content hidden"></section> <section class="footer"></section> <div id="help" class="hidden"> <div> <div class="shortcuts"> <h1>Keyboard Shortcuts</h1> <dl> <dt>?</dt> <dd>Show this help dialog</dd> <dt>S</dt> <dd>Focus the search field</dd> <dt>&larrb;</dt> <dd>Move up in search results</dd> <dt>&rarrb;</dt> <dd>Move down in search results</dd> <dt>&#9166;</dt> <dd>Go to active search result</dd> </dl> </div> <div class="infos"> <h1>Search Tricks</h1> <p> Prefix searches with a type followed by a colon (e.g. <code>fn:</code>) to restrict the search to a given type. </p> <p> Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>. </p> <p> Search functions by type signature (e.g. <code>vec -> usize</code>) </p> </div> </div> </div> <script> window.rootPath = "../../"; window.currentCrate = "js"; window.playgroundUrl = ""; </script> <script src="../../jquery.js"></script> <script src="../../main.js"></script> <script async src="../../search-index.js"></script> </body> </html>
susaing/doc.servo.org
js/glue/fn.AppendToAutoIdVector.html
HTML
mpl-2.0
4,161
<!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 (version 1.7.0_45) on Fri Dec 27 12:52:45 CST 2013 --> <title>UnauthorizedException (apache-cassandra API)</title> <meta name="date" content="2013-12-27"> <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="UnauthorizedException (apache-cassandra API)"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/UnauthorizedException.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../org/apache/cassandra/exceptions/TruncateException.html" title="class in org.apache.cassandra.exceptions"><span class="strong">Prev Class</span></a></li> <li><a href="../../../../org/apache/cassandra/exceptions/UnavailableException.html" title="class in org.apache.cassandra.exceptions"><span class="strong">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?org/apache/cassandra/exceptions/UnauthorizedException.html" target="_top">Frames</a></li> <li><a href="UnauthorizedException.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../allclasses-noframe.html">All 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> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#methods_inherited_from_class_org.apache.cassandra.exceptions.CassandraException">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li> <li>Method</li> </ul> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <div class="subTitle">org.apache.cassandra.exceptions</div> <h2 title="Class UnauthorizedException" class="title">Class UnauthorizedException</h2> </div> <div class="contentContainer"> <ul class="inheritance"> <li>java.lang.Object</li> <li> <ul class="inheritance"> <li>java.lang.Throwable</li> <li> <ul class="inheritance"> <li>java.lang.Exception</li> <li> <ul class="inheritance"> <li><a href="../../../../org/apache/cassandra/exceptions/CassandraException.html" title="class in org.apache.cassandra.exceptions">org.apache.cassandra.exceptions.CassandraException</a></li> <li> <ul class="inheritance"> <li><a href="../../../../org/apache/cassandra/exceptions/RequestValidationException.html" title="class in org.apache.cassandra.exceptions">org.apache.cassandra.exceptions.RequestValidationException</a></li> <li> <ul class="inheritance"> <li>org.apache.cassandra.exceptions.UnauthorizedException</li> </ul> </li> </ul> </li> </ul> </li> </ul> </li> </ul> </li> </ul> <div class="description"> <ul class="blockList"> <li class="blockList"> <dl> <dt>All Implemented Interfaces:</dt> <dd>java.io.Serializable, <a href="../../../../org/apache/cassandra/exceptions/TransportException.html" title="interface in org.apache.cassandra.exceptions">TransportException</a></dd> </dl> <hr> <br> <pre>public class <span class="strong">UnauthorizedException</span> extends <a href="../../../../org/apache/cassandra/exceptions/RequestValidationException.html" title="class in org.apache.cassandra.exceptions">RequestValidationException</a></pre> <dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../serialized-form.html#org.apache.cassandra.exceptions.UnauthorizedException">Serialized Form</a></dd></dl> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor_summary"> <!-- --> </a> <h3>Constructor Summary</h3> <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> <caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colOne" scope="col">Constructor and Description</th> </tr> <tr class="altColor"> <td class="colOne"><code><strong><a href="../../../../org/apache/cassandra/exceptions/UnauthorizedException.html#UnauthorizedException(java.lang.String)">UnauthorizedException</a></strong>(java.lang.String&nbsp;msg)</code>&nbsp;</td> </tr> </table> </li> </ul> <!-- ========== METHOD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="method_summary"> <!-- --> </a> <h3>Method Summary</h3> <ul class="blockList"> <li class="blockList"><a name="methods_inherited_from_class_org.apache.cassandra.exceptions.CassandraException"> <!-- --> </a> <h3>Methods inherited from class&nbsp;org.apache.cassandra.exceptions.<a href="../../../../org/apache/cassandra/exceptions/CassandraException.html" title="class in org.apache.cassandra.exceptions">CassandraException</a></h3> <code><a href="../../../../org/apache/cassandra/exceptions/CassandraException.html#code()">code</a></code></li> </ul> <ul class="blockList"> <li class="blockList"><a name="methods_inherited_from_class_java.lang.Throwable"> <!-- --> </a> <h3>Methods inherited from class&nbsp;java.lang.Throwable</h3> <code>addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString</code></li> </ul> <ul class="blockList"> <li class="blockList"><a name="methods_inherited_from_class_java.lang.Object"> <!-- --> </a> <h3>Methods inherited from class&nbsp;java.lang.Object</h3> <code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</code></li> </ul> <ul class="blockList"> <li class="blockList"><a name="methods_inherited_from_class_org.apache.cassandra.exceptions.TransportException"> <!-- --> </a> <h3>Methods inherited from interface&nbsp;org.apache.cassandra.exceptions.<a href="../../../../org/apache/cassandra/exceptions/TransportException.html" title="interface in org.apache.cassandra.exceptions">TransportException</a></h3> <code><a href="../../../../org/apache/cassandra/exceptions/TransportException.html#getMessage()">getMessage</a></code></li> </ul> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <!-- ========= CONSTRUCTOR DETAIL ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor_detail"> <!-- --> </a> <h3>Constructor Detail</h3> <a name="UnauthorizedException(java.lang.String)"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>UnauthorizedException</h4> <pre>public&nbsp;UnauthorizedException(java.lang.String&nbsp;msg)</pre> </li> </ul> </li> </ul> </li> </ul> </div> </div> <!-- ========= END OF CLASS DATA ========= --> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/UnauthorizedException.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../org/apache/cassandra/exceptions/TruncateException.html" title="class in org.apache.cassandra.exceptions"><span class="strong">Prev Class</span></a></li> <li><a href="../../../../org/apache/cassandra/exceptions/UnavailableException.html" title="class in org.apache.cassandra.exceptions"><span class="strong">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?org/apache/cassandra/exceptions/UnauthorizedException.html" target="_top">Frames</a></li> <li><a href="UnauthorizedException.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../allclasses-noframe.html">All 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> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#methods_inherited_from_class_org.apache.cassandra.exceptions.CassandraException">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li> <li>Method</li> </ul> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright &copy; 2013 The Apache Software Foundation</small></p> </body> </html>
bkcloud/bkplatform
cassandra-scripts/javadoc/org/apache/cassandra/exceptions/UnauthorizedException.html
HTML
mpl-2.0
10,452
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="generator" content="rustdoc"> <meta name="description" content="API documentation for the Rust `NO_RESET_NOTIFICATION_KHR` constant in crate `glutin`."> <meta name="keywords" content="rust, rustlang, rust-lang, NO_RESET_NOTIFICATION_KHR"> <title>glutin::api::egl::ffi::egl::NO_RESET_NOTIFICATION_KHR - Rust</title> <link rel="stylesheet" type="text/css" href="../../../../../main.css"> </head> <body class="rustdoc"> <!--[if lte IE 8]> <div class="warning"> This old browser is unsupported and will most likely display funky things. </div> <![endif]--> <section class="sidebar"> <p class='location'><a href='../../../../index.html'>glutin</a>::<wbr><a href='../../../index.html'>api</a>::<wbr><a href='../../index.html'>egl</a>::<wbr><a href='../index.html'>ffi</a>::<wbr><a href='index.html'>egl</a></p><script>window.sidebarCurrent = {name: 'NO_RESET_NOTIFICATION_KHR', ty: 'constant', relpath: ''};</script><script defer src="sidebar-items.js"></script> </section> <nav class="sub"> <form class="search-form js-only"> <div class="search-container"> <input class="search-input" name="search" autocomplete="off" placeholder="Click or press β€˜S’ to search, β€˜?’ for more options…" type="search"> </div> </form> </nav> <section id='main' class="content constant"> <h1 class='fqn'><span class='in-band'><a href='../../../../index.html'>glutin</a>::<wbr><a href='../../../index.html'>api</a>::<wbr><a href='../../index.html'>egl</a>::<wbr><a href='../index.html'>ffi</a>::<wbr><a href='index.html'>egl</a>::<wbr><a class='constant' href=''>NO_RESET_NOTIFICATION_KHR</a></span><span class='out-of-band'><span id='render-detail'> <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs"> [<span class='inner'>&#x2212;</span>] </a> </span><a id='src-2662' class='srclink' href='../../../../../src/glutin///home/servo/buildbot/slave/doc/build/target/debug/build/glutin-3a49bc866bd01bfd/out/egl_bindings.rs.html#647' title='goto source code'>[src]</a></span></h1> <pre class='rust const'>pub const NO_RESET_NOTIFICATION_KHR: <a class='type' href='../../../../../glutin/api/egl/ffi/egl/types/type.GLenum.html' title='glutin::api::egl::ffi::egl::types::GLenum'>GLenum</a><code> = </code><code>0x31BE</code></pre></section> <section id='search' class="content hidden"></section> <section class="footer"></section> <div id="help" class="hidden"> <div> <div class="shortcuts"> <h1>Keyboard Shortcuts</h1> <dl> <dt>?</dt> <dd>Show this help dialog</dd> <dt>S</dt> <dd>Focus the search field</dd> <dt>&larrb;</dt> <dd>Move up in search results</dd> <dt>&rarrb;</dt> <dd>Move down in search results</dd> <dt>&#9166;</dt> <dd>Go to active search result</dd> </dl> </div> <div class="infos"> <h1>Search Tricks</h1> <p> Prefix searches with a type followed by a colon (e.g. <code>fn:</code>) to restrict the search to a given type. </p> <p> Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>. </p> <p> Search functions by type signature (e.g. <code>vec -> usize</code>) </p> </div> </div> </div> <script> window.rootPath = "../../../../../"; window.currentCrate = "glutin"; window.playgroundUrl = ""; </script> <script src="../../../../../jquery.js"></script> <script src="../../../../../main.js"></script> <script async src="../../../../../search-index.js"></script> </body> </html>
susaing/doc.servo.org
glutin/api/egl/ffi/egl/constant.NO_RESET_NOTIFICATION_KHR.html
HTML
mpl-2.0
4,518
<!-- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright (c) 2014 Mozilla Corporation --> <template name="alertdetails"> <div class="container"> <div class="row"> <div class="row"><button class="btn btn-sm btn-warning col-xs-2 makeinvestigation" data-alertid={{esmetadata.id}}>Escalate To Investigation</button></div> <div class="row"><button class="btn btn-sm btn-danger col-xs-2 makeincident" data-alertid={{esmetadata.id}}>Escalate To Incident</button></div> <div class="row" id="alert" > <table class="table table-reactive table-hover table-condensed" id="alert-table"> <thead> <tr> <td class="upperwhite">Timestamp</td> <td class="upperwhite">Links</td> <td class="upperwhite">Severity</td> <td class="upperwhite">Category</td> <td class="upperwhite">Summary</td> </tr> </thead> <tbody> <tr> <td>{{utctimestamp}}</td> <td> <a target="_blank" href="{{kibanaurl}}">open in kibana</a> {{#if url}} <br><a href="{{url}}" target ="_blank">docs</a> {{/if}} </td> <td>{{severity}}</td> <td>{{category}}</td> <td class="alertsummary">{{{ipDecorate summary}}}</td> </tr> </tbody> </table> </div> </div> <table class="table table-reactive table-hover table-condensed" id="alert-events-table"> <tbody class="table-striped"> {{#each this.events}} {{>alert_event}} {{/each}} </tbody> </table> </div> </template> <!--each individual event --> <template name="alert_event"> <tr> <td>{{documentindex}}</td> <td>{{documentid}}</td> <td>{{documenttype}}</td> <td>{{{ ipDecorate documentsource.summary}}}</td> <td>{{>eventdetails}}</td> </tr> </template>
gdestuynder/MozDef
meteor/client/alertdetails.html
HTML
mpl-2.0
2,428
ο»Ώusing System.Linq; using Xunit; namespace Kf.Core.Tests._extensions_.Collections { public class IEnumerableOfTExtensionsTests { [Fact] public void Index_Returns_Correct_Values_And_Index() { // Arrange var index = 0; var sut = Enumerable.Range(0, 500); // Act var foreachWithIndex = sut.Index(); // Assert foreach (var element in foreachWithIndex) { Assert.Equal(index, element.Index); Assert.Equal(index, element.Value); Assert.Equal(element.Value, element.Index); index++; } } [Fact] public void ForEachPerformsCorrectAlgorithm() { var sut = Enumerable.Range(0, 500); var result = sut.ForEach(i => { return 0; }); Assert.True(result.All(i => i == 0)); } [Fact] public void ForEachCanReturnDifferentType() { var sut = Enumerable.Range(0, 500); var result = sut.ForEach(i => { return i.ToString("000"); }); Assert.True(result.All(i => i.Length.Equals(3))); } [Fact] public void ForEachCanReturnAndCOntinueLinqStyle() { var sut = Enumerable.Range(0, 500); var result = sut.ForEach(i => { return i.ToString("000"); }); result = result.Where(x => x.Contains("449")); Assert.True(result.Count().Equals(1)); } } }
KodeFoxx/Kf.Core
Source/Kf.Core.Tests/(extensions)/Collections/IEnumerableOfTExtensionsTests.cs
C#
mpl-2.0
1,517
# coding=utf-8 ''' tagsPlorer package entry point (C) 2021-2021 Arne Bachmann https://github.com/ArneBachmann/tagsplorer ''' from tagsplorer import tp tp.Main().parse_and_run()
ArneBachmann/tagsplorer
tagsplorer/__main__.py
Python
mpl-2.0
183
/* * Copyright (c) 2014. The Trustees of Indiana University. * * This version of the code is licensed under the MPL 2.0 Open Source license with additional * healthcare disclaimer. If the user is an entity intending to commercialize any application * that uses this code in a for-profit venture, please contact the copyright holder. */ package com.muzima.api.model.algorithm; import com.muzima.api.model.PersonAttributeType; import com.muzima.search.api.model.object.Searchable; import com.muzima.util.JsonUtils; import net.minidev.json.JSONObject; import java.io.IOException; public class PersonAttributeTypeAlgorithm extends BaseOpenmrsAlgorithm { public static final String PERSON_ATTRIBUTE_TYPE_REPRESENTATION = "(uuid,name)"; private String uuid; /** * Implementation of this method will define how the object will be serialized from the String representation. * * @param serialized the string representation * @return the concrete object */ @Override public Searchable deserialize(final String serialized, final boolean isFullSerialization) throws IOException { PersonAttributeType attributeType = new PersonAttributeType(); attributeType.setUuid(JsonUtils.readAsString(serialized, "$['uuid']")); attributeType.setName(JsonUtils.readAsString(serialized, "$['name']")); return attributeType; } /** * Implementation of this method will define how the object will be de-serialized into the String representation. * * @param object the object * @return the string representation */ @Override public String serialize(final Searchable object, final boolean isFullSerialization) throws IOException { PersonAttributeType attributeType = (PersonAttributeType) object; JSONObject jsonObject = new JSONObject(); JsonUtils.writeAsString(jsonObject, "uuid", attributeType.getUuid()); JsonUtils.writeAsString(jsonObject, "name", attributeType.getName()); return jsonObject.toJSONString(); } }
sthaiya/muzima-api
src/main/java/com/muzima/api/model/algorithm/PersonAttributeTypeAlgorithm.java
Java
mpl-2.0
2,059
/** * Copyright 2017, Digi International Inc. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, you can obtain one at http://mozilla.org/MPL/2.0/. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ package com.digi.xbee.api.packet.thread; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsEqual.equalTo; import static org.hamcrest.core.IsNot.not; import static org.hamcrest.core.IsNull.nullValue; import static org.junit.Assert.*; import java.net.Inet6Address; import java.net.UnknownHostException; import java.util.Arrays; import java.util.LinkedHashMap; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.mockito.Mockito; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import com.digi.xbee.api.models.CoAPURI; import com.digi.xbee.api.models.HTTPMethodEnum; import com.digi.xbee.api.models.RemoteATCommandOptions; import com.digi.xbee.api.packet.APIFrameType; import com.digi.xbee.api.packet.thread.CoAPTxRequestPacket; import com.digi.xbee.api.utils.HexUtils; @PrepareForTest({Inet6Address.class, CoAPTxRequestPacket.class}) @RunWith(PowerMockRunner.class) public class CoAPTxRequestPacketTest { // Constants. private static final String IPV6_ADDRESS = "FDB3:0001:0002:0000:0004:0005:0006:0007"; // Variables. private int frameType = APIFrameType.COAP_TX_REQUEST.getValue(); private int frameID = 0x01; private int options = RemoteATCommandOptions.OPTION_NONE; private Inet6Address destAddress; private HTTPMethodEnum method = HTTPMethodEnum.GET; private String uriData = CoAPURI.URI_DATA_TRANSMISSION; private byte[] data = "Test".getBytes(); @Rule public ExpectedException exception = ExpectedException.none(); public CoAPTxRequestPacketTest() throws Exception { destAddress = (Inet6Address) Inet6Address.getByName(IPV6_ADDRESS); } /** * @throws java.lang.Exception */ @BeforeClass public static void setUpBeforeClass() throws Exception { } /** * @throws java.lang.Exception */ @AfterClass public static void tearDownAfterClass() throws Exception { } /** * @throws java.lang.Exception */ @Before public void setUp() throws Exception { } /** * @throws java.lang.Exception */ @After public void tearDown() throws Exception { } /** * Test method for {@link com.digi.xbee.api.packet.thread.CoAPTxRequestPacket#createPacket(byte[])}. * * <p>A {@code NullPointerException} exception must be thrown when parsing * a {@code null} byte array.</p> */ @Test public final void testCreatePacketNullPayload() { // Set up the resources for the test. byte[] payload = null; exception.expect(NullPointerException.class); exception.expectMessage(is(equalTo("CoAP Tx Request packet payload cannot be null."))); // Call the method under test that should throw a NullPointerException. CoAPTxRequestPacket.createPacket(payload); } /** * Test method for {@link com.digi.xbee.api.packet.thread.CoAPTxRequestPacket#createPacket(byte[])}. * * <p>An {@code IllegalArgumentException} exception must be thrown when * parsing an empty byte array.</p> */ @Test public final void testCreatePacketEmptyPayload() { // Set up the resources for the test. byte[] payload = new byte[0]; exception.expect(IllegalArgumentException.class); exception.expectMessage(is(equalTo("Incomplete CoAP Tx Request packet."))); // Call the method under test that should throw an IllegalArgumentException. CoAPTxRequestPacket.createPacket(payload); } /** * Test method for {@link com.digi.xbee.api.packet.thread.CoAPTxRequestPacket#createPacket(byte[])}. * * <p>An {@code IllegalArgumentException} exception must be thrown when * parsing a byte array shorter than the needed one is provided.</p> */ @Test public final void testCreatePacketPayloadShorterThanNeeded() { // Set up the resources for the test. byte[] payload = new byte[25]; payload[0] = (byte)frameType; payload[1] = (byte)frameID; payload[2] = (byte)options; payload[3] = (byte)method.getValue(); System.arraycopy(destAddress.getAddress(), 0, payload, 4, destAddress.getAddress().length); payload[20] = (byte)(uriData.length()); System.arraycopy(uriData.getBytes(), 0, payload, 21, uriData.getBytes().length - 1); exception.expect(IllegalArgumentException.class); exception.expectMessage(is(equalTo("Incomplete CoAP Tx Request packet."))); // Call the method under test that should throw an IllegalArgumentException. CoAPTxRequestPacket.createPacket(payload); } /** * Test method for {@link com.digi.xbee.api.packet.thread.CoAPTxRequestPacket#createPacket(byte[])}. * * <p>An {@code IllegalArgumentException} exception must be thrown when * parsing a byte array not including the Frame type.</p> */ @Test public final void testCreatePacketPayloadNotIncludingFrameType() { // Set up the resources for the test. byte[] payload = new byte[25 + data.length]; payload[0] = (byte)frameID; payload[1] = (byte)options; payload[2] = (byte)method.getValue(); System.arraycopy(destAddress.getAddress(), 0, payload, 3, destAddress.getAddress().length); payload[20] = (byte)(uriData.length()); System.arraycopy(uriData.getBytes(), 0, payload, 20, uriData.getBytes().length); System.arraycopy(data, 0, payload, 20 + uriData.getBytes().length, data.length); exception.expect(IllegalArgumentException.class); exception.expectMessage(is(equalTo("Payload is not a CoAP Tx Request packet."))); // Call the method under test that should throw an IllegalArgumentException. CoAPTxRequestPacket.createPacket(payload); } /** * Test method for {@link com.digi.xbee.api.packet.thread.CoAPTxRequestPacket#createPacket(byte[])}. * * <p>An {@code IllegalArgumentException} exception must be thrown when * parsing a byte array with an invalid IPv6 address.</p> */ @Test public final void testCreatePacketPayloadInvalidIP() throws Exception { // Set up the resources for the test. byte[] payload = new byte[26]; payload[0] = (byte)frameType; payload[1] = (byte)frameID; payload[2] = (byte)options; payload[3] = (byte)method.getValue(); System.arraycopy(destAddress.getAddress(), 0, payload, 4, destAddress.getAddress().length); payload[20] = (byte)(uriData.length()); System.arraycopy(uriData.getBytes(), 0, payload, 21, uriData.getBytes().length); PowerMockito.mockStatic(Inet6Address.class); PowerMockito.when(Inet6Address.getByAddress(Mockito.any(byte[].class))).thenThrow(new UnknownHostException()); exception.expect(IllegalArgumentException.class); // Call the method under test that should throw an IllegalArgumentException. CoAPTxRequestPacket.createPacket(payload); } /** * Test method for {@link com.digi.xbee.api.packet.thread.CoAPTxRequestPacket#createPacket(byte[])}. * * <p>A valid CoAP TX Request packet with the provided options and without * data is created.</p> */ @Test public final void testCreatePacketValidPayloadWithoutData() { // Set up the resources for the test. byte[] payload = new byte[26]; payload[0] = (byte)frameType; payload[1] = (byte)frameID; payload[2] = (byte)options; payload[3] = (byte)method.getValue(); System.arraycopy(destAddress.getAddress(), 0, payload, 4, destAddress.getAddress().length); payload[20] = (byte)(uriData.length()); System.arraycopy(uriData.getBytes(), 0, payload, 21, uriData.getBytes().length); // Call the method under test. CoAPTxRequestPacket packet = CoAPTxRequestPacket.createPacket(payload); // Verify the result. assertThat("Returned length is not the expected one", packet.getPacketLength(), is(equalTo(payload.length))); assertThat("Returned frame ID is not the expected one", packet.getFrameID(), is(equalTo(frameID))); assertThat("Returned options are not the expected ones", packet.getTransmitOptions(), is(equalTo(options))); assertThat("Returned RESTul method is not the expected one", packet.getMethod(), is(equalTo(method))); assertThat("Returned dest address is not the expected one", packet.getDestAddress(), is(equalTo(destAddress))); assertThat("Returned URI is not the expected one", packet.getURI(), is(equalTo(uriData))); assertThat("Returned data is not the expected one", packet.getPayload(), is(nullValue())); assertThat("Returned payload array is not the expected one", packet.getPacketData(), is(equalTo(payload))); } /** * Test method for {@link com.digi.xbee.api.packet.thread.CoAPTxRequestPacket#createPacket(byte[])}. * * <p>A valid CoAP TX Request packet with the provided options and data is * created.</p> */ @Test public final void testCreatePacketValidPayloadWithData() { // Set up the resources for the test. byte[] payload = new byte[26 + data.length]; payload[0] = (byte)frameType; payload[1] = (byte)frameID; payload[2] = (byte)options; payload[3] = (byte)method.getValue(); System.arraycopy(destAddress.getAddress(), 0, payload, 4, destAddress.getAddress().length); payload[20] = (byte)(uriData.length()); System.arraycopy(uriData.getBytes(), 0, payload, 21, uriData.getBytes().length); System.arraycopy(data, 0, payload, 21 + uriData.getBytes().length, data.length); // Call the method under test. CoAPTxRequestPacket packet = CoAPTxRequestPacket.createPacket(payload); // Verify the result. assertThat("Returned length is not the expected one", packet.getPacketLength(), is(equalTo(payload.length))); assertThat("Returned frame ID is not the expected one", packet.getFrameID(), is(equalTo(frameID))); assertThat("Returned options are not the expected ones", packet.getTransmitOptions(), is(equalTo(options))); assertThat("Returned RESTul method is not the expected one", packet.getMethod(), is(equalTo(method))); assertThat("Returned dest address is not the expected one", packet.getDestAddress(), is(equalTo(destAddress))); assertThat("Returned URI is not the expected one", packet.getURI(), is(equalTo(uriData))); assertThat("Returned data is not the expected one", packet.getPayload(), is(equalTo(data))); assertThat("Returned payload array is not the expected one", packet.getPacketData(), is(equalTo(payload))); } /** * Test method for {@link com.digi.xbee.api.packet.thread.CoAPTxRequestPacket#CoAPTxRequestPacket(int, int, HTTPMethodEnum, Inet6Address, String, byte[])}. * * <p>Construct a new CoAP TX Request packet with a frame ID bigger than * 255. This must throw an {@code IllegalArgumentException}.</p> */ @Test public final void testCreateCoAPTxRequestPacketFrameIDBiggerThan255() { // Set up the resources for the test. int frameID = 524; exception.expect(IllegalArgumentException.class); exception.expectMessage(is(equalTo("Frame ID must be between 0 and 255."))); // Call the method under test that should throw an IllegalArgumentException. new CoAPTxRequestPacket(frameID, options, method, destAddress, uriData, data); } /** * Test method for {@link com.digi.xbee.api.packet.thread.CoAPTxRequestPacket#CoAPTxRequestPacket(int, int, HTTPMethodEnum, Inet6Address, String, byte[])}. * * <p>Construct a new CoAP TX Request packet with a negative frame ID. This * must throw an {@code IllegalArgumentException}.</p> */ @Test public final void testCreateCoAPTxRequestPacketFrameIDNegative() { // Set up the resources for the test. int frameID = -6; exception.expect(IllegalArgumentException.class); exception.expectMessage(is(equalTo("Frame ID must be between 0 and 255."))); // Call the method under test that should throw an IllegalArgumentException. new CoAPTxRequestPacket(frameID, options, method, destAddress, uriData, data); } /** * Test method for {@link com.digi.xbee.api.packet.thread.CoAPTxRequestPacket#CoAPTxRequestPacket(int, int, HTTPMethodEnum, Inet6Address, String, byte[])}. * * <p>Construct a new CoAP TX Request packet with invalid transmit options. * This must throw a {@code IllegalArgumentException}.</p> */ @Test public final void testCreateCoAPTxRequestPacketTransmitOptionsInvalid() { // Set up the resources for the test. int options = -1; exception.expect(IllegalArgumentException.class); exception.expectMessage(is(equalTo("Transmit options can only be " + RemoteATCommandOptions.OPTION_NONE + " or " + RemoteATCommandOptions.OPTION_APPLY_CHANGES + "."))); // Call the method under test that should throw a NullPointerException. new CoAPTxRequestPacket(frameID, options, method, destAddress, uriData, data); } /** * Test method for {@link com.digi.xbee.api.packet.thread.CoAPTxRequestPacket#CoAPTxRequestPacket(int, int, HTTPMethodEnum, Inet6Address, String, byte[])}. * * <p>Construct a new CoAP TX Request packet with a null RESTful method. * This must throw a {@code NullPointerException}.</p> */ @Test public final void testCreateCoAPTxRequestPacketMethodNull() { // Set up the resources for the test. HTTPMethodEnum method = null; exception.expect(NullPointerException.class); exception.expectMessage(is(equalTo("HTTP Method cannot be null."))); // Call the method under test that should throw a NullPointerException. new CoAPTxRequestPacket(frameID, options, method, destAddress, uriData, data); } /** * Test method for {@link com.digi.xbee.api.packet.thread.CoAPTxRequestPacket#CoAPTxRequestPacket(int, int, HTTPMethodEnum, Inet6Address, String, byte[])}. * * <p>Construct a new CoAP TX Request packet with a null destination * address. This must throw a {@code NullPointerException}.</p> */ @Test public final void testCreateCoAPTxRequestPacketDestAddressNull() { // Set up the resources for the test. Inet6Address destAddress = null; exception.expect(NullPointerException.class); exception.expectMessage(is(equalTo("Destination address cannot be null."))); // Call the method under test that should throw a NullPointerException. new CoAPTxRequestPacket(frameID, options, method, destAddress, uriData, data); } /** * Test method for {@link com.digi.xbee.api.packet.thread.CoAPTxRequestPacket#CoAPTxRequestPacket(int, int, HTTPMethodEnum, Inet6Address, String, byte[])}. * * <p>Construct a new CoAP TX Request packet with a null URI. This must * throw a {@code NullPointerException}.</p> */ @Test public final void testCreateCoAPTxRequestPacketURINull() { // Set up the resources for the test. String uriData = null; exception.expect(NullPointerException.class); exception.expectMessage(is(equalTo("URI cannot be null."))); // Call the method under test that should throw a NullPointerException. new CoAPTxRequestPacket(frameID, options, method, destAddress, uriData, data); } /** * Test method for {@link com.digi.xbee.api.packet.thread.CoAPTxRequestPacket#CoAPTxRequestPacket(int, int, HTTPMethodEnum, Inet6Address, String, byte[])}. * * <p>Construct a new CoAP TX Request packet without data ({@code null}).</p> */ @Test public final void testCreateCoAPTxRequestPacketValidDataNull() { // Set up the resources for the test. data = null; int expectedLength = 26; // Call the method under test. CoAPTxRequestPacket packet = new CoAPTxRequestPacket(frameID, options, method, destAddress, uriData, data); // Verify the result. assertThat("Returned length is not the expected one", packet.getPacketLength(), is(equalTo(expectedLength))); assertThat("Returned frame ID is not the expected one", packet.getFrameID(), is(equalTo(frameID))); assertThat("Returned options are not the expected ones", packet.getTransmitOptions(), is(equalTo(options))); assertThat("Returned RESTul method is not the expected one", packet.getMethod(), is(equalTo(method))); assertThat("Returned dest address is not the expected one", packet.getDestAddress(), is(equalTo(destAddress))); assertThat("Returned URI is not the expected one", packet.getURI(), is(equalTo(uriData))); assertThat("Returned data is not the expected one", packet.getPayload(), is(nullValue())); assertThat("CoAP TX Request packet needs API Frame ID", packet.needsAPIFrameID(), is(equalTo(true))); } /** * Test method for {@link com.digi.xbee.api.packet.thread.CoAPTxRequestPacket#CoAPTxRequestPacket(int, int, HTTPMethodEnum, Inet6Address, String, byte[])}. * * <p>Construct a new CoAP TX Request packet with data.</p> */ @Test public final void testCreateCoAPTxRequestPacketValidDataNotNull() { // Set up the resources for the test. int expectedLength = 26 + data.length; // Call the method under test. CoAPTxRequestPacket packet = new CoAPTxRequestPacket(frameID, options, method, destAddress, uriData, data); // Verify the result. assertThat("Returned length is not the expected one", packet.getPacketLength(), is(equalTo(expectedLength))); assertThat("Returned frame ID is not the expected one", packet.getFrameID(), is(equalTo(frameID))); assertThat("Returned options are not the expected ones", packet.getTransmitOptions(), is(equalTo(options))); assertThat("Returned RESTul method is not the expected one", packet.getMethod(), is(equalTo(method))); assertThat("Returned dest address is not the expected one", packet.getDestAddress(), is(equalTo(destAddress))); assertThat("Returned URI is not the expected one", packet.getURI(), is(equalTo(uriData))); assertThat("Returned data is not the expected one", packet.getPayload(), is(data)); assertThat("CoAP TX Request packet needs API Frame ID", packet.needsAPIFrameID(), is(equalTo(true))); } /** * Test method for {@link com.digi.xbee.api.packet.thread.CoAPTxRequestPacket#getAPIData()}. * * <p>Test the get API parameters with a {@code null} received data.</p> */ @Test public final void testGetAPIDataReceivedDataNull() { // Set up the resources for the test. byte[] data = null; CoAPTxRequestPacket packet = new CoAPTxRequestPacket(frameID, options, method, destAddress, uriData, data); int expectedLength = 25; byte[] expectedData = new byte[expectedLength]; expectedData[0] = (byte)frameID; expectedData[1] = (byte)options; expectedData[2] = (byte)method.getValue(); System.arraycopy(destAddress.getAddress(), 0, expectedData, 3, destAddress.getAddress().length); expectedData[19] = (byte)(uriData.length()); System.arraycopy(uriData.getBytes(), 0, expectedData, 20, uriData.getBytes().length); // Call the method under test. byte[] apiData = packet.getAPIData(); // Verify the result. assertThat("API data is not the expected", apiData, is(equalTo(expectedData))); } /** * Test method for {@link com.digi.xbee.api.packet.thread.CoAPTxRequestPacket#getAPIData()}. * * <p>Test the get API parameters with a not-{@code null} received data.</p> */ @Test public final void testGetAPIDataReceivedDataNotNull() { // Set up the resources for the test. CoAPTxRequestPacket packet = new CoAPTxRequestPacket(frameID, options, method, destAddress, uriData, data); int expectedLength = 25 + data.length; byte[] expectedData = new byte[expectedLength]; expectedData[0] = (byte)frameID; expectedData[1] = (byte)options; expectedData[2] = (byte)method.getValue(); System.arraycopy(destAddress.getAddress(), 0, expectedData, 3, destAddress.getAddress().length); expectedData[19] = (byte)(uriData.length()); System.arraycopy(uriData.getBytes(), 0, expectedData, 20, uriData.getBytes().length); System.arraycopy(data, 0, expectedData, 20 + uriData.getBytes().length, data.length); // Call the method under test. byte[] apiData = packet.getAPIData(); // Verify the result. assertThat("API data is not the expected", apiData, is(equalTo(expectedData))); } /** * Test method for {@link com.digi.xbee.api.packet.thread.CoAPTxRequestPacket#getAPIPacketParameters()}. * * <p>Test the get API parameters with a {@code null} received data.</p> */ @Test public final void testGetAPIPacketParametersReceivedDataNull() { // Set up the resources for the test. byte[] data = null; CoAPTxRequestPacket packet = new CoAPTxRequestPacket(frameID, options, method, destAddress, uriData, data); // Call the method under test. LinkedHashMap<String, String> packetParams = packet.getAPIPacketParameters(); // Verify the result. assertThat("Packet parameters map size is not the expected one", packetParams.size(), is(equalTo(6))); assertThat("Returned transmit options are not the expected ones", packetParams.get("Options"), is(equalTo(HexUtils.prettyHexString(HexUtils.integerToHexString(options, 1))))); assertThat("Returned HTTP method is not the expected one", packetParams.get("Method"), is(equalTo(HexUtils.prettyHexString(HexUtils.integerToHexString(method.getValue(), 1)) + " (" + method.getName() + ")"))); assertThat("Returned dest address is not the expected one", packetParams.get("Destination address"), is(equalTo(HexUtils.prettyHexString(destAddress.getAddress()) + " (" + destAddress.getHostAddress() + ")"))); assertThat("Returned URI length is not the expected one", packetParams.get("URI length"), is(equalTo(HexUtils.prettyHexString(HexUtils.integerToHexString(uriData.length(), 1)) + " (" + uriData.length() + ")"))); assertThat("Returned URI is not the expected one", packetParams.get("URI"), is(equalTo(HexUtils.prettyHexString(HexUtils.byteArrayToHexString(uriData.getBytes())) + " (" + uriData + ")"))); assertThat("RF data is not the expected", packetParams.get("RF data"), is(nullValue(String.class))); } /** * Test method for {@link com.digi.xbee.api.packet.thread.CoAPTxRequestPacket#getAPIPacketParameters()}. * * <p>Test the get API parameters with a not-{@code null} received data.</p> */ @Test public final void testGetAPIPacketParametersReceivedDataNotNull() { // Set up the resources for the test. CoAPTxRequestPacket packet = new CoAPTxRequestPacket(frameID, options, method, destAddress, uriData, data); // Call the method under test. LinkedHashMap<String, String> packetParams = packet.getAPIPacketParameters(); // Verify the result. assertThat("Packet parameters map size is not the expected one", packetParams.size(), is(equalTo(7))); assertThat("Returned transmit options are not the expected ones", packetParams.get("Options"), is(equalTo(HexUtils.prettyHexString(HexUtils.integerToHexString(options, 1))))); assertThat("Returned HTTP method is not the expected one", packetParams.get("Method"), is(equalTo(HexUtils.prettyHexString(HexUtils.integerToHexString(method.getValue(), 1)) + " (" + method.getName() + ")"))); assertThat("Returned dest address is not the expected one", packetParams.get("Destination address"), is(equalTo(HexUtils.prettyHexString(destAddress.getAddress()) + " (" + destAddress.getHostAddress() + ")"))); assertThat("Returned URI length is not the expected one", packetParams.get("URI length"), is(equalTo(HexUtils.prettyHexString(HexUtils.integerToHexString(uriData.length(), 1)) + " (" + uriData.length() + ")"))); assertThat("Returned URI is not the expected one", packetParams.get("URI"), is(equalTo(HexUtils.prettyHexString(HexUtils.byteArrayToHexString(uriData.getBytes())) + " (" + uriData + ")"))); assertThat("RF data is not the expected", packetParams.get("Payload"), is(equalTo(HexUtils.prettyHexString(HexUtils.byteArrayToHexString(data))))); } /** * Test method for {@link com.digi.xbee.api.packet.thread.CoAPTxRequestPacket#setDestAddress(Inet6Address)}. */ @Test public final void testSetDestAddressNull() { // Set up the resources for the test. CoAPTxRequestPacket packet = new CoAPTxRequestPacket(frameID, options, method, destAddress, uriData, data); exception.expect(NullPointerException.class); exception.expectMessage(is(equalTo("Destination address cannot be null."))); // Call the method under test that should throw a NullPointerException. packet.setDestAddress(null); } /** * Test method for {@link com.digi.xbee.api.packet.thread.CoAPTxRequestPacket#setDestAddress(Inet6Address)}. * * @throws Exception */ @Test public final void testSetDestAddressNotNull() throws Exception { // Set up the resources for the test. CoAPTxRequestPacket packet = new CoAPTxRequestPacket(frameID, options, method, destAddress, uriData, data); Inet6Address newAddress = (Inet6Address) Inet6Address.getByName("fd8a:cb11:ad71:0000:7662:c401:5efe:dc41"); // Call the method under test. packet.setDestAddress(newAddress); // Verify the result. assertThat("Dest address is not the expected one", packet.getDestAddress(), is(equalTo(newAddress))); } /** * Test method for {@link com.digi.xbee.api.packet.thread.CoAPTxRequestPacket#setTransmitOptions(int)}. */ @Test public final void testSetTransmitOptionsATURIOptionsIllegal() { // Set up the resources for the test. CoAPTxRequestPacket packet = new CoAPTxRequestPacket(frameID, options, method, destAddress, CoAPURI.URI_AT_COMMAND, data); exception.expect(IllegalArgumentException.class); exception.expectMessage(is(equalTo("Transmit options can only be " + RemoteATCommandOptions.OPTION_NONE + " or " + RemoteATCommandOptions.OPTION_APPLY_CHANGES + "."))); // Call the method under test that should throw an IllegalArgumentException. packet.setTransmitOptions(0x03); } /** * Test method for {@link com.digi.xbee.api.packet.thread.CoAPTxRequestPacket#setTransmitOptions(int)}. */ @Test public final void testSetTransmitOptionsTXURIOptionsIllegal() { // Set up the resources for the test. CoAPTxRequestPacket packet = new CoAPTxRequestPacket(frameID, options, method, destAddress, CoAPURI.URI_DATA_TRANSMISSION, data); exception.expect(IllegalArgumentException.class); exception.expectMessage(is(equalTo("Transmit options can only be " + RemoteATCommandOptions.OPTION_NONE + " or " + RemoteATCommandOptions.OPTION_APPLY_CHANGES + "."))); // Call the method under test that should throw an IllegalArgumentException. packet.setTransmitOptions(0x02); } /** * Test method for {@link com.digi.xbee.api.packet.thread.CoAPTxRequestPacket#setTransmitOptions(int)}. */ @Test public final void testTransmitOptionsValid() { // Set up the resources for the test. CoAPTxRequestPacket packet = new CoAPTxRequestPacket(frameID, options, method, destAddress, uriData, data); int newOptions = 0x00; // Call the method under test. packet.setTransmitOptions(newOptions); // Verify the result. assertThat("Transmit options are not the expected ones", packet.getTransmitOptions(), is(equalTo(newOptions))); } /** * Test method for {@link com.digi.xbee.api.packet.thread.CoAPTxRequestPacket#setMethod(HTTPMethodEnum)}. */ @Test public final void testSetMEthodNull() { // Set up the resources for the test. CoAPTxRequestPacket packet = new CoAPTxRequestPacket(frameID, options, method, destAddress, uriData, data); exception.expect(NullPointerException.class); exception.expectMessage(is(equalTo("HTTP Method cannot be null."))); // Call the method under test that should throw a NullPointerException. packet.setMethod(null); } /** * Test method for {@link com.digi.xbee.api.packet.thread.CoAPTxRequestPacket#setMethod(HTTPMethodEnum)}. */ @Test public final void testSetMethodNotNull() { // Set up the resources for the test. CoAPTxRequestPacket packet = new CoAPTxRequestPacket(frameID, options, method, destAddress, uriData, data); HTTPMethodEnum newMethod = HTTPMethodEnum.PUT; // Call the method under test. packet.setMethod(newMethod); // Verify the result. assertThat("HTTP method is not the expected one", packet.getMethod(), is(equalTo(newMethod))); } /** * Test method for {@link com.digi.xbee.api.packet.thread.CoAPTxRequestPacket#getPayload()}. */ @Test public final void testGetDataNullData() { // Set up the resources for the test. byte[] data = null; CoAPTxRequestPacket packet = new CoAPTxRequestPacket(frameID, options, method, destAddress, uriData, data); // Call the method under test. byte[] result = packet.getPayload(); // Verify the result. assertThat("RF data must be the same", result, is(equalTo(data))); assertThat("RF data must be null", result, is(nullValue(byte[].class))); } /** * Test method for {@link com.digi.xbee.api.packet.thread.CoAPTxRequestPacket#getPayload()}. */ @Test public final void testGetDataValidData() { // Set up the resources for the test. CoAPTxRequestPacket packet = new CoAPTxRequestPacket(frameID, options, method, destAddress, uriData, data); // Call the method under test. byte[] result = packet.getPayload(); // Verify the result. assertThat("Data must be the same", result, is(equalTo(data))); assertThat("Data must not be the same object", result.hashCode(), is(not(equalTo(data.hashCode())))); } /** * Test method for {@link com.digi.xbee.api.packet.thread.CoAPTxRequestPacket#setPayload(byte[])}. */ @Test public final void testSetDataNullData() { // Set up the resources for the test. byte[] newData = null; CoAPTxRequestPacket packet = new CoAPTxRequestPacket(frameID, options, method, destAddress, uriData, data); // Call the method under test. packet.setPayload(newData); byte[] result = packet.getPayload(); // Verify the result. assertThat("Data must be the same", result, is(equalTo(newData))); assertThat("Data must be null", result, is(nullValue(byte[].class))); } /** * Test method for {@link com.digi.xbee.api.packet.thread.CoAPTxRequestPacket#setPayload(byte[])}. */ @Test public final void testSetDataValidData() { // Set up the resources for the test. byte[] newData = "New data".getBytes(); CoAPTxRequestPacket packet = new CoAPTxRequestPacket(frameID, options, method, destAddress, uriData, data); // Call the method under test. packet.setPayload(newData); byte[] result = packet.getPayload(); // Verify the result. assertThat("Data must be the same", result, is(equalTo(newData))); } /** * Test method for {@link com.digi.xbee.api.packet.thread.CoAPTxRequestPacket#setPayload(byte[])}. */ @Test public final void testSetDataAndModifyOriginal() { // Set up the resources for the test. byte[] newData = "New data".getBytes(); CoAPTxRequestPacket packet = new CoAPTxRequestPacket(frameID, options, method, destAddress, uriData, data); // Call the method under test. packet.setPayload(newData); byte[] backup = Arrays.copyOf(newData, newData.length); newData[0] = 0x00; byte[] result = packet.getPayload(); // Verify the result. assertThat("Data must be the same as the setted data", result, is(equalTo(backup))); assertThat("Data must not be the current value of received data", result, is(not(equalTo(data)))); assertThat("Data must not be the same object", result.hashCode(), is(not(equalTo(backup.hashCode())))); assertThat("Data must not be the same object", result.hashCode(), is(not(equalTo(data.hashCode())))); } }
digidotcom/XBeeJavaLibrary
library/src/test/java/com/digi/xbee/api/packet/thread/CoAPTxRequestPacketTest.java
Java
mpl-2.0
31,725
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="generator" content="rustdoc"> <meta name="description" content="API documentation for the Rust `GENERATE_MIPMAP` constant in crate `servo`."> <meta name="keywords" content="rust, rustlang, rust-lang, GENERATE_MIPMAP"> <title>servo::gl::GENERATE_MIPMAP - Rust</title> <link rel="stylesheet" type="text/css" href="../../main.css"> </head> <body class="rustdoc"> <!--[if lte IE 8]> <div class="warning"> This old browser is unsupported and will most likely display funky things. </div> <![endif]--> <section class="sidebar"> <p class='location'><a href='../index.html'>servo</a>::<wbr><a href='index.html'>gl</a></p><script>window.sidebarCurrent = {name: 'GENERATE_MIPMAP', ty: 'constant', relpath: ''};</script><script defer src="sidebar-items.js"></script> </section> <nav class="sub"> <form class="search-form js-only"> <div class="search-container"> <input class="search-input" name="search" autocomplete="off" placeholder="Click or press β€˜S’ to search, β€˜?’ for more options…" type="search"> </div> </form> </nav> <section id='main' class="content constant"> <h1 class='fqn'><span class='in-band'><a href='../index.html'>servo</a>::<wbr><a href='index.html'>gl</a>::<wbr><a class='constant' href=''>GENERATE_MIPMAP</a></span><span class='out-of-band'><span id='render-detail'> <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs"> [<span class='inner'>&#x2212;</span>] </a> </span><a id='src-3989' class='srclink' href='../../export/gleam/ffi/constant.GENERATE_MIPMAP.html?gotosrc=3989' title='goto source code'>[src]</a></span></h1> <pre class='rust const'>pub const GENERATE_MIPMAP: <a href='../../std/primitive.u32.html'>u32</a><code> = </code><code>33169</code></pre></section> <section id='search' class="content hidden"></section> <section class="footer"></section> <div id="help" class="hidden"> <div> <div class="shortcuts"> <h1>Keyboard Shortcuts</h1> <dl> <dt>?</dt> <dd>Show this help dialog</dd> <dt>S</dt> <dd>Focus the search field</dd> <dt>&larrb;</dt> <dd>Move up in search results</dd> <dt>&rarrb;</dt> <dd>Move down in search results</dd> <dt>&#9166;</dt> <dd>Go to active search result</dd> </dl> </div> <div class="infos"> <h1>Search Tricks</h1> <p> Prefix searches with a type followed by a colon (e.g. <code>fn:</code>) to restrict the search to a given type. </p> <p> Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>. </p> <p> Search functions by type signature (e.g. <code>vec -> usize</code>) </p> </div> </div> </div> <script> window.rootPath = "../../"; window.currentCrate = "servo"; window.playgroundUrl = ""; </script> <script src="../../jquery.js"></script> <script src="../../main.js"></script> <script async src="../../search-index.js"></script> </body> </html>
susaing/doc.servo.org
servo/gl/constant.GENERATE_MIPMAP.html
HTML
mpl-2.0
3,957
'use strict'; var LIVERELOAD_PORT = 35729; var lrSnippet = require('connect-livereload')({ port: LIVERELOAD_PORT }); var mountFolder = function (connect, dir) { return connect.static(require('path').resolve(dir)); }; var fs = require('fs'); var delayApiCalls = function (request, response, next) { if (request.url.indexOf('/api') !== -1) { setTimeout(function () { next(); }, 1000); } else { next(); } }; var httpMethods = function (request, response, next) { console.log("request method: " + JSON.stringify(request.method)); var rawpath = request.url.split('?')[0]; console.log("request url: " + JSON.stringify(request.url)); var path = require('path').resolve(__dirname, 'app/' + rawpath); console.log("request path : " + JSON.stringify(path)); console.log("request current dir : " + JSON.stringify(__dirname)); if ((request.method === 'PUT' || request.method === 'POST')) { console.log('inside put/post'); request.content = ''; request.addListener("data", function (chunk) { request.content += chunk; }); request.addListener("end", function () { console.log("request content: " + JSON.stringify(request.content)); if (fs.existsSync(path)) { if (request.method === 'POST') { response.statusCode = 403; response.end('Resource already exists.'); return; } fs.writeFile(path, request.content, function (err) { if (err) { response.statusCode(404); console.log('File not saved: ' + JSON.stringify(err)); response.end('Error writing to file.'); } else { console.log('File saved to: ' + path); response.end('File was saved.'); } }); return; } else { if (request.method === 'PUT') { response.statusCode = 404; response.end('Resource not found: ' + JSON.stringify(request.url)); return; } } if (request.url === '/log') { var filePath = 'server/log/server.log'; var logData = JSON.parse(request.content); fs.appendFile(filePath, logData.logUrl + '\n' + logData.logMessage + '\n', function (err) { if (err) { throw err; } console.log('log saved'); response.end('log was saved'); }); return; } }); return; } next(); }; // # Globbing // for performance reasons we're only matching one level down: // 'test/spec/{,*/}*.js' // use this if you want to recursively match all subfolders: // 'test/spec/**/*.js' module.exports = function (grunt) { require('load-grunt-tasks')(grunt); require('time-grunt')(grunt); // configurable paths var yeomanConfig = { app: 'app', dist: 'dist', doc: 'doc', test: 'test' }; try { yeomanConfig.app = require('./bower.json').appPath || yeomanConfig.app; } catch (e) {} grunt.initConfig({ yeoman: yeomanConfig, watch: { compass: { files: ['<%= yeoman.app %>/styles/**/*.{scss,sass}'], tasks: ['compass:server', 'autoprefixer:tmp'] }, styles: { files: ['<%= yeoman.app %>/styles/**/*.css'], tasks: ['autoprefixer:styles'] }, livereload: { options: { livereload: LIVERELOAD_PORT }, files: [ '<%= yeoman.app %>/**/*.html', '{.tmp,<%= yeoman.app %>}/styles/**/*.css', '{.tmp,<%= yeoman.app %>}/scripts/**/*.js', '{.tmp,<%= yeoman.app %>}/resources/**/*', '<%= yeoman.app %>/images/**/*.{png,jpg,jpeg,gif,webp,svg}' ] } // , // doc: { // files: ['{.tmp,<%= yeoman.app %>}/scripts/**/*.js'], // tasks: ['docular'] // } }, autoprefixer: { options: ['last 1 version'], tmp: { files: [{ expand: true, cwd: '.tmp/styles/', src: '**/*.css', dest: '.tmp/styles/' }] }, styles: { files: [{ expand: true, cwd: '<%= yeoman.app %>/styles/', src: '**/*.css', dest: '.tmp/styles/' }] } }, connect: { options: { protocol: 'http', port: 9000, // Change this to '0.0.0.0' to access the server from outside. hostname: 'localhost' }, livereload: { options: { middleware: function (connect) { return [ delayApiCalls, lrSnippet, mountFolder(connect, '.tmp'), mountFolder(connect, yeomanConfig.app), httpMethods ]; } } }, test: { options: { port: 9090, middleware: function (connect) { return [ mountFolder(connect, '.tmp'), mountFolder(connect, yeomanConfig.app), mountFolder(connect, '<%= yeoman.test %>'), httpMethods ]; } } }, dist: { options: { middleware: function (connect) { return [ delayApiCalls, mountFolder(connect, yeomanConfig.dist), httpMethods ]; } } }, doc: { options: { port: 3000, middleware: function (connect) { return [ mountFolder(connect, yeomanConfig.doc) ]; } } } }, open: { server: { url: '<%= connect.options.protocol %>://<%= connect.options.hostname %>:<%= connect.options.port %>' }, doc: { url: '<%= connect.options.protocol %>://<%= connect.options.hostname %>:9001' } }, clean: { dist: { files: [{ dot: true, src: [ '.tmp', '<%= yeoman.dist %>/*', '!<%= yeoman.dist %>/.git*' ] }] }, server: '.tmp' }, jshint: { options: { jshintrc: '.jshintrc' }, all: [ 'Gruntfile.js', '<%= yeoman.app %>/scripts/{,*/}*.js' ] }, compass: { options: { sassDir: '<%= yeoman.app %>/styles', cssDir: '.tmp/styles', generatedImagesDir: '.tmp/images/generated', imagesDir: '<%= yeoman.app %>/images', javascriptsDir: '<%= yeoman.app %>/scripts', fontsDir: '<%= yeoman.app %>/styles/fonts', importPath: '<%= yeoman.app %>/bower_components', httpImagesPath: '/images', httpGeneratedImagesPath: '/images/generated', httpFontsPath: '/styles/fonts', relativeAssets: false }, dist: { options: { debugInfo: false } }, server: { options: { debugInfo: true } } }, uglify: { dist: { files: { '<%= yeoman.dist %>/scripts/api/angular-jqm.js': ['<%= yeoman.app %>/scripts/api/angular-jqm.js'], '<%= yeoman.dist %>/bower_components/angular-animate/angular-animate.js': ['<%= yeoman.app %>/bower_components/angular-animate/angular-animate.js'], '<%= yeoman.dist %>/bower_components/angular-route/angular-route.js': ['<%= yeoman.app %>/bower_components/angular-route/angular-route.js'], '<%= yeoman.dist %>/bower_components/angular-touch/angular-touch.js': ['<%= yeoman.app %>/bower_components/angular-touch/angular-touch.js'] } } }, rev: { dist: { files: { src: [ '<%= yeoman.dist %>/scripts/*.js', '<%= yeoman.dist %>/styles/*.css', '<%= yeoman.dist %>/images/**/*.{png,jpg,jpeg,gif,webp,svg}', '!<%= yeoman.dist %>/images/glyphicons-*', '<%= yeoman.dist %>/styles/images/*.{gif,png}' ] } } }, useminPrepare: { html: '<%= yeoman.app %>/index.html', options: { dest: '<%= yeoman.dist %>' } }, usemin: { html: ['<%= yeoman.dist %>/*.html', '<%= yeoman.dist %>/views/**/*.html'], css: ['<%= yeoman.dist %>/styles/**/*.css'], options: { assetsDirs: ['<%= yeoman.dist %>/**'] } }, imagemin: { dist: { files: [{ expand: true, cwd: '<%= yeoman.app %>', src: [ 'styles/images/*.{jpg,jpeg,svg,gif}', 'images/*.{jpg,jpeg,svg,gif}' ], dest: '<%= yeoman.dist %>' }] } }, tinypng: { options: { apiKey: "l_QIDgceoKGF8PBNRr3cmYy_Nhfa9F1p", checkSigs: true, sigFile: '<%= yeoman.app %>/images/tinypng_sigs.json', summarize: true, showProgress: true, stopOnImageError: true }, dist: { expand: true, cwd: '<%= yeoman.app %>', src: 'images/**/*.png', dest: '<%= yeoman.app %>' } }, htmlmin: { dist: { options: { removeComments: true, removeCommentsFromCDATA: true, removeCDATASectionsFromCDATA: true, collapseWhitespace: true, // conservativeCollapse: true, collapseBooleanAttributes: true, removeAttributeQuotes: false, removeRedundantAttributes: true, useShortDoctype: true, removeEmptyAttributes: true, removeOptionalTags: true, keepClosingSlash: true, }, files: [{ expand: true, cwd: '<%= yeoman.dist %>', src: [ '*.html', 'views/**/*.html', 'template/**/*.html' ], dest: '<%= yeoman.dist %>' }] } }, // Put files not handled in other tasks here copy: { dist: { files: [{ expand: true, dot: true, cwd: '<%= yeoman.app %>', dest: '<%= yeoman.dist %>', src: [ '*.{ico,png,txt}', '.htaccess', 'api/**', 'images/{,*/}*.{gif,webp}', 'resources/**', 'styles/fonts/*', 'styles/images/*', '*.html', 'views/**/*.html', 'template/**/*.html' ] }, { expand: true, cwd: '.tmp/images', dest: '<%= yeoman.dist %>/images', src: [ 'generated/*' ] }, { expand: true, cwd: '<%= yeoman.app %>/bower_components/angular-i18n', dest: '<%= yeoman.dist %>/resources/i18n/angular', src: [ '*en-us.js', '*es-es.js', '*ja-jp.js', '*ar-eg.js' ] }] }, styles: { expand: true, cwd: '<%= yeoman.app %>/styles', dest: '.tmp/styles', src: '**/*.css' }, i18n: { expand: true, cwd: '<%= yeoman.app %>/bower_components/angular-i18n', dest: '.tmp/resources/i18n/angular', src: [ '*en-us.js', '*es-es.js', '*ja-jp.js', '*ar-eg.js' ] }, fonts: { expand: true, cwd: '<%= yeoman.app %>/bower_components/bootstrap-sass-official/assets/fonts', dest: '.tmp/fonts', src: '**/*' }, png: { expand: true, cwd: '<%= yeoman.app %>', dest: '<%= yeoman.dist %>', src: 'images/**/*.png' } }, concurrent: { server: [ 'compass:server', 'copy:i18n', 'copy:fonts' ], dist: [ 'compass:dist', 'imagemin' ] }, karma: { unit: { configFile: '<%= yeoman.test %>/karma-unit.conf.js', autoWatch: false, singleRun: true }, unit_auto: { configFile: '<%= yeoman.test %>/karma-unit.conf.js' }, midway: { configFile: '<%= yeoman.test %>/karma-midway.conf.js', autoWatch: false, singleRun: true }, midway_auto: { configFile: '<%= yeoman.test %>/karma-midway.conf.js' }, e2e: { configFile: '<%= yeoman.test %>/karma-e2e.conf.js', autoWatch: false, singleRun: true }, e2e_auto: { configFile: '<%= yeoman.test %>/karma-e2e.conf.js' } }, cdnify: { dist: { html: ['<%= yeoman.dist %>/*.html'] } }, ngAnnotate: { dist: { files: [{ expand: true, cwd: '.tmp/concat/scripts', src: '*.js', dest: '.tmp/concat/scripts' }] } }, docular: { showDocularDocs: false, showAngularDocs: true, docular_webapp_target: "doc", groups: [ { groupTitle: 'Appverse HTML5', groupId: 'appverse', groupIcon: 'icon-beer', sections: [ { id: "commonapi", title: "Common API", showSource: true, scripts: ["app/scripts/api/modules", "app/scripts/api/directives" ], docs: ["ngdocs/commonapi"], rank: {} } ] }, { groupTitle: 'Angular jQM', groupId: 'angular-jqm', groupIcon: 'icon-mobile-phone', sections: [ { id: "jqmapi", title: "API", showSource: true, scripts: ["app/scripts/api/angular-jqm.js" ], docs: ["ngdocs/jqmapi"], rank: {} } ] } ] } }); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-karma'); grunt.loadNpmTasks('grunt-docular'); grunt.registerTask('server', [ 'clean:server', 'concurrent:server', 'autoprefixer', 'connect:livereload', 'open:server', 'watch' ]); grunt.registerTask('testserver', [ 'clean:server', 'concurrent:server', 'autoprefixer', 'connect:test' ]); grunt.registerTask('test', [ 'karma:unit', 'testserver', 'karma:midway', 'karma:e2e' ]); grunt.registerTask('test:midway', [ 'testserver', 'karma:midway_auto' ]); grunt.registerTask('test:e2e', [ 'testserver', 'karma:e2e_auto' ]); grunt.registerTask('devmode', [ 'karma:unit_auto' ]); grunt.registerTask('doc', [ 'docular', 'connect:doc', 'open:doc', 'watch:doc' ]); grunt.registerTask('dist', [ 'clean:dist', 'useminPrepare', 'concurrent:dist', 'tinypng', 'copy:png', 'autoprefixer', 'concat', 'copy:dist', 'cdnify', 'ngAnnotate', 'cssmin', 'uglify', 'rev', 'usemin', 'htmlmin', 'connect:dist', // 'docular', // 'connect:doc', 'open:server', // 'open:doc', 'watch' ]); grunt.registerTask('default', [ 'server' ]); };
glarfs/training-unit-2
Gruntfile.js
JavaScript
mpl-2.0
19,182
#!/usr/bin/execlineb -P with-contenv s6-envuidgid www-data foreground { if { s6-test -n $WP_RESET } foreground { ln -s /resetter /public/resetter } foreground { chmod +x /public/resetter/*.sh } } # if [[ $(echo $ROOT_DOMAIN | grep "cyberspaced" | wc -c) > 0 ]]; then # cd /app/website/scripts/ # chmod +x *.sh # fi
TayloredTechnology/basal
wordpress/cont-init.d/05-cyberspacedtesting.sh
Shell
mpl-2.0
325
#include <stdio.h> int main(int argc, char const *argv[]) { //COQ=customer order quantity, COQV=COQ value, SV= Stock value int COQ,COQV,Credit,SV; if ((COQ<SV)&&(Credit>=COQV)) { printf("Supply successfull\n"); } else if ((COQ<SV)&&(Credit<COQV)) { /* code */ printf("Amount given is less than value of stock supplied."); } else if((COQ>SV)&&(Credit>=COQV)){ printf("Whatever in stock is given. Remaining balance would be returned in two days.\n"); } }
saarques/Cprogramming
company_policy.c
C
mpl-2.0
472
//Copyright (c) 2017 Finjin // //This file is part of Finjin Engine (finjin-engine). // //Finjin Engine 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. // //This Source Code Form is subject to the terms of the Mozilla Public //License, v. 2.0. If a copy of the MPL was not distributed with this //file, You can obtain one at http://mozilla.org/MPL/2.0/. #pragma once //Includes---------------------------------------------------------------------- #include "finjin/engine/GenericInputDevice.hpp" //Types------------------------------------------------------------------------- namespace Finjin { namespace Engine { using namespace Finjin::Common; class WindowsUWPInputContext; } }
finjin/finjin-engine
cpp/library/src/finjin/engine/internal/input/uwpinput/WindowsUWPInputDevice.hpp
C++
mpl-2.0
821
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla JavaScript Shell project. * * The Initial Developer of the Original Code is * Alex Fritze. * Portions created by the Initial Developer are Copyright (C) 2003 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Alex Fritze <[email protected]> * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef __NS_JSSHSERVER_H__ #define __NS_JSSHSERVER_H__ #include "nsIJSShServer.h" #include "nsCOMPtr.h" #include "nsIServerSocket.h" #include "nsStringAPI.h" class nsJSShServer : public nsIJSShServer { public: NS_DECL_ISUPPORTS NS_DECL_NSIJSSHSERVER nsJSShServer(); ~nsJSShServer(); private: nsCOMPtr<nsIServerSocket> mServerSocket; PRUint32 mServerPort; nsCString mServerStartupURI; PRBool mServerLoopbackOnly; }; #endif // __NS_JSSHSERVER_H__
tmhorne/celtx
extensions/jssh/nsJSShServer.h
C
mpl-2.0
2,276
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html data-context="Build Apps" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/> <title>legato - Legato Docs</title> <meta content="legatoβ„’ is an open source Linux-based embedded platform designed to simplify connected IoT application development" name="description"/> <meta content="legato, iot" name="keywords"/> <meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport"/> <meta content="19.11.6" name="legato-version"/> <link href="resources/images/legato.ico" rel="shortcut icon"/> <link href="resources/images/legato.ico" rel="icon" type="image/x-icon"/> <link href="resources/images/legato.ico" rel="shortcut icon" type="image/x-icon"/> <link href="resources/images/legato.ico" rel="apple-touch-icon" type="image/x-icon"/> <link href="resources/css/style.css" media="screen" rel="stylesheet" type="text/css"/> <link href="resources/css/font-awesome.css" rel="stylesheet" type="text/css"/> <!--[if IE]> <script src="resources/js/html5shiv.js"></script> <script src="resources/js/respond.js"></script> <![endif]--> <script src="https://code.jquery.com/jquery-2.2.3.min.js"></script> <script src="resources/js/main.js"></script> <script src="tocs/Build_Apps_Tools.json"></script> </head> <body> <noscript> <input class="modal-closing-trick" id="modal-closing-trick" type="checkbox"/> <div id="nojs"> <label for="modal-closing-trick"> <span>You seem to not have Javascript <a href="http://enable-javascript.com">enabled</a>, so site functionality like the search and navigation tree won't work.</span> </label> </div> </noscript> <div class="wrapper"> <div class="fa fa-bars documentation" id="menu-trigger"></div> <div id="top"> <header> <nav> <a class="navlink" href="/">Introduction</a><a class="navlink selected" href="buildAppsMain.html">Build Apps</a><a class="navlink" href="buildPlatformMain.html">Build Platform</a><a class="navlink" href="aboutMain.html">About</a> </nav> </header> </div> <div class="white" id="menudocumentation"> <header> <a href="/"> <img alt="Back to Legato Homepage" id="logo" src="resources/images/legato_logo.png"/></a> <h2>/ Build Apps</h2> <nav class="secondary"> <a href="getStarted.html">Get Started</a><a href="concepts.html">Concepts</a><a href="apiGuidesMain.html">API Guides</a><a class="link-selected" href="tools.html">Tools</a><a href="howToMain.html">How To</a><a href="experimentalMain.html">Experimental Features</a> </nav> <nav class="ui-front"> <i class="fa fa-search" id="search-icon"></i> <input id="searchbox" placeholder="Search"/> </nav> </header> </div> <div id="resizable"> <div id="left"> <div id="tree1"></div> </div> </div> <div class="content"> <div class="header"> <div class="headertitle"> <h1 class="title">legato </h1> </div> </div><div class="contents"> <div class="textblock"><p>Use the <code>legato</code> tool to control the Legato Application Framework.</p> <h1>Usage</h1> <p><b><code> legato [start|stop|restart|status|version|help]</code></b></p> <pre class="fragment">legato start </pre><blockquote class="doxtable"> <p>Starts the Legato Application Framework. </p> </blockquote> <pre class="fragment">legato stop </pre><blockquote class="doxtable"> <p>Stops the Legato Application Framework. </p> </blockquote> <pre class="fragment">legato restart </pre><blockquote class="doxtable"> <p>Restarts the Legato Application Framework. </p> </blockquote> <pre class="fragment">legato status </pre><blockquote class="doxtable"> <p>Displays the current running state (started, stopped), system state (good, bad, probation) and </p> </blockquote> <p>system index of Legato.</p> <pre class="fragment">legato version </pre><blockquote class="doxtable"> <p>Displays the current installed version. </p> </blockquote> <pre class="fragment">legato help </pre><blockquote class="doxtable"> <p>Displays usage help. </p> </blockquote> <hr/> <p class="copyright">Copyright (C) Sierra Wireless Inc. </p> </div></div> <br clear="left"/> </div> </div> <link href="resources/css/jqtree.css" rel="stylesheet" type="text/css"/> <script src="resources/js/tree.jquery.js" type="text/javascript"></script> <script src="resources/js/jquery.cookie.js"></script> <script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script> <link href="resources/css/perfect-scrollbar.min.css" rel="stylesheet"/> <script src="resources/js/perfect-scrollbar.jquery.min.js"></script> </body> </html>
legatoproject/legato-docs
19_11_6/toolsTarget_legato.html
HTML
mpl-2.0
4,608
# frozen_string_literal: true # Setup used to generate email message class ApplicationMailer < ActionMailer::Base default from: "[email protected]" layout "mailer" end
tjustino/smoothie_funds
app/mailers/application_mailer.rb
Ruby
mpl-2.0
181
{-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} {-# OPTIONS_GHC -fno-warn-duplicate-exports #-} {-# OPTIONS_GHC -fno-warn-unused-binds #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-} -- | -- Module : Network.Google.Resource.Storage.Objects.Update -- Copyright : (c) 2015-2016 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay <[email protected]> -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Updates an object\'s metadata. -- -- /See:/ <https://developers.google.com/storage/docs/json_api/ Cloud Storage JSON API Reference> for @storage.objects.update@. module Network.Google.Resource.Storage.Objects.Update ( -- * REST Resource ObjectsUpdateResource -- * Creating a Request , objectsUpdate , ObjectsUpdate -- * Request Lenses , ouIfMetagenerationMatch , ouIfGenerationNotMatch , ouIfGenerationMatch , ouPredefinedACL , ouBucket , ouPayload , ouUserProject , ouIfMetagenerationNotMatch , ouObject , ouProjection , ouProvisionalUserProject , ouGeneration ) where import Network.Google.Prelude import Network.Google.Storage.Types -- | A resource alias for @storage.objects.update@ method which the -- 'ObjectsUpdate' request conforms to. type ObjectsUpdateResource = "storage" :> "v1" :> "b" :> Capture "bucket" Text :> "o" :> Capture "object" Text :> QueryParam "ifMetagenerationMatch" (Textual Int64) :> QueryParam "ifGenerationNotMatch" (Textual Int64) :> QueryParam "ifGenerationMatch" (Textual Int64) :> QueryParam "predefinedAcl" ObjectsUpdatePredefinedACL :> QueryParam "userProject" Text :> QueryParam "ifMetagenerationNotMatch" (Textual Int64) :> QueryParam "projection" ObjectsUpdateProjection :> QueryParam "provisionalUserProject" Text :> QueryParam "generation" (Textual Int64) :> QueryParam "alt" AltJSON :> ReqBody '[JSON] Object :> Put '[JSON] Object -- | Updates an object\'s metadata. -- -- /See:/ 'objectsUpdate' smart constructor. data ObjectsUpdate = ObjectsUpdate' { _ouIfMetagenerationMatch :: !(Maybe (Textual Int64)) , _ouIfGenerationNotMatch :: !(Maybe (Textual Int64)) , _ouIfGenerationMatch :: !(Maybe (Textual Int64)) , _ouPredefinedACL :: !(Maybe ObjectsUpdatePredefinedACL) , _ouBucket :: !Text , _ouPayload :: !Object , _ouUserProject :: !(Maybe Text) , _ouIfMetagenerationNotMatch :: !(Maybe (Textual Int64)) , _ouObject :: !Text , _ouProjection :: !(Maybe ObjectsUpdateProjection) , _ouProvisionalUserProject :: !(Maybe Text) , _ouGeneration :: !(Maybe (Textual Int64)) } deriving (Eq, Show, Data, Typeable, Generic) -- | Creates a value of 'ObjectsUpdate' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'ouIfMetagenerationMatch' -- -- * 'ouIfGenerationNotMatch' -- -- * 'ouIfGenerationMatch' -- -- * 'ouPredefinedACL' -- -- * 'ouBucket' -- -- * 'ouPayload' -- -- * 'ouUserProject' -- -- * 'ouIfMetagenerationNotMatch' -- -- * 'ouObject' -- -- * 'ouProjection' -- -- * 'ouProvisionalUserProject' -- -- * 'ouGeneration' objectsUpdate :: Text -- ^ 'ouBucket' -> Object -- ^ 'ouPayload' -> Text -- ^ 'ouObject' -> ObjectsUpdate objectsUpdate pOuBucket_ pOuPayload_ pOuObject_ = ObjectsUpdate' { _ouIfMetagenerationMatch = Nothing , _ouIfGenerationNotMatch = Nothing , _ouIfGenerationMatch = Nothing , _ouPredefinedACL = Nothing , _ouBucket = pOuBucket_ , _ouPayload = pOuPayload_ , _ouUserProject = Nothing , _ouIfMetagenerationNotMatch = Nothing , _ouObject = pOuObject_ , _ouProjection = Nothing , _ouProvisionalUserProject = Nothing , _ouGeneration = Nothing } -- | Makes the operation conditional on whether the object\'s current -- metageneration matches the given value. ouIfMetagenerationMatch :: Lens' ObjectsUpdate (Maybe Int64) ouIfMetagenerationMatch = lens _ouIfMetagenerationMatch (\ s a -> s{_ouIfMetagenerationMatch = a}) . mapping _Coerce -- | Makes the operation conditional on whether the object\'s current -- generation does not match the given value. If no live object exists, the -- precondition fails. Setting to 0 makes the operation succeed only if -- there is a live version of the object. ouIfGenerationNotMatch :: Lens' ObjectsUpdate (Maybe Int64) ouIfGenerationNotMatch = lens _ouIfGenerationNotMatch (\ s a -> s{_ouIfGenerationNotMatch = a}) . mapping _Coerce -- | Makes the operation conditional on whether the object\'s current -- generation matches the given value. Setting to 0 makes the operation -- succeed only if there are no live versions of the object. ouIfGenerationMatch :: Lens' ObjectsUpdate (Maybe Int64) ouIfGenerationMatch = lens _ouIfGenerationMatch (\ s a -> s{_ouIfGenerationMatch = a}) . mapping _Coerce -- | Apply a predefined set of access controls to this object. ouPredefinedACL :: Lens' ObjectsUpdate (Maybe ObjectsUpdatePredefinedACL) ouPredefinedACL = lens _ouPredefinedACL (\ s a -> s{_ouPredefinedACL = a}) -- | Name of the bucket in which the object resides. ouBucket :: Lens' ObjectsUpdate Text ouBucket = lens _ouBucket (\ s a -> s{_ouBucket = a}) -- | Multipart request metadata. ouPayload :: Lens' ObjectsUpdate Object ouPayload = lens _ouPayload (\ s a -> s{_ouPayload = a}) -- | The project to be billed for this request. Required for Requester Pays -- buckets. ouUserProject :: Lens' ObjectsUpdate (Maybe Text) ouUserProject = lens _ouUserProject (\ s a -> s{_ouUserProject = a}) -- | Makes the operation conditional on whether the object\'s current -- metageneration does not match the given value. ouIfMetagenerationNotMatch :: Lens' ObjectsUpdate (Maybe Int64) ouIfMetagenerationNotMatch = lens _ouIfMetagenerationNotMatch (\ s a -> s{_ouIfMetagenerationNotMatch = a}) . mapping _Coerce -- | Name of the object. For information about how to URL encode object names -- to be path safe, see Encoding URI Path Parts. ouObject :: Lens' ObjectsUpdate Text ouObject = lens _ouObject (\ s a -> s{_ouObject = a}) -- | Set of properties to return. Defaults to full. ouProjection :: Lens' ObjectsUpdate (Maybe ObjectsUpdateProjection) ouProjection = lens _ouProjection (\ s a -> s{_ouProjection = a}) -- | The project to be billed for this request if the target bucket is -- requester-pays bucket. ouProvisionalUserProject :: Lens' ObjectsUpdate (Maybe Text) ouProvisionalUserProject = lens _ouProvisionalUserProject (\ s a -> s{_ouProvisionalUserProject = a}) -- | If present, selects a specific revision of this object (as opposed to -- the latest version, the default). ouGeneration :: Lens' ObjectsUpdate (Maybe Int64) ouGeneration = lens _ouGeneration (\ s a -> s{_ouGeneration = a}) . mapping _Coerce instance GoogleRequest ObjectsUpdate where type Rs ObjectsUpdate = Object type Scopes ObjectsUpdate = '["https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control"] requestClient ObjectsUpdate'{..} = go _ouBucket _ouObject _ouIfMetagenerationMatch _ouIfGenerationNotMatch _ouIfGenerationMatch _ouPredefinedACL _ouUserProject _ouIfMetagenerationNotMatch _ouProjection _ouProvisionalUserProject _ouGeneration (Just AltJSON) _ouPayload storageService where go = buildClient (Proxy :: Proxy ObjectsUpdateResource) mempty
brendanhay/gogol
gogol-storage/gen/Network/Google/Resource/Storage/Objects/Update.hs
Haskell
mpl-2.0
8,463
ο»Ώ/* Copyright (C) 2015 haha01haha01 * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace HaJS { public partial class MainForm : Form { public MainForm() { InitializeComponent(); } private void ofdBox_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog() { Filter = "XML Files|*.xml" }; if (ofd.ShowDialog() != System.Windows.Forms.DialogResult.OK) return; ((TextBox)sender).Text = ofd.FileName; } private void button1_Click(object sender, EventArgs e) { if (serverConfigPathBox.Text == "" || inputXmlBox.Text == "") return; HaJSCompiler jsc = new HaJSCompiler(serverConfigPathBox.Text); string outPath = Path.Combine(Path.GetDirectoryName(inputXmlBox.Text), Path.GetFileNameWithoutExtension(inputXmlBox.Text) + ".js"); #if !DEBUG try { #endif jsc.Compile(inputXmlBox.Text, outPath); MessageBox.Show("Finished compiling to " + outPath); #if !DEBUG } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } #endif } private void button2_Click(object sender, EventArgs e) { if (serverConfigPathBox.Text == "" || inputXmlBox.Text == "") return; HaJSCompiler jsc = new HaJSCompiler(serverConfigPathBox.Text); string folder = Path.GetDirectoryName(inputXmlBox.Text); foreach (FileInfo fi in new DirectoryInfo(folder).GetFiles()) { if (fi.Extension.ToLower() == ".xml") { #if !DEBUG try { #endif jsc.Compile(fi.FullName, Path.Combine(folder, Path.GetFileNameWithoutExtension(fi.FullName) + ".js")); #if !DEBUG } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); break; } #endif } } MessageBox.Show("Finished compiling " + folder); } } }
haha01haha01/HaJS
HaJS/MainForm.cs
C#
mpl-2.0
2,742
/* * Copyright Β© 2013-2019, The SeedStack authors <http://seedstack.org> * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ package org.seedstack.seed.core.internal.configuration.tool; import com.google.common.base.Strings; import java.io.PrintStream; import org.fusesource.jansi.Ansi; import org.seedstack.shed.text.TextWrapper; class DetailPrinter { private static final TextWrapper textWrapper = new TextWrapper(120); private final PropertyInfo propertyInfo; DetailPrinter(PropertyInfo propertyInfo) { this.propertyInfo = propertyInfo; } void printDetail(PrintStream stream) { Ansi ansi = Ansi.ansi(); String title = "Details of " + propertyInfo.getName(); ansi .a(title) .newline() .a(Strings.repeat("-", title.length())) .newline().newline(); printSummary(propertyInfo, ansi); printDeclaration(propertyInfo, ansi); printLongDescription(propertyInfo, ansi); printAdditionalInfo(propertyInfo, ansi); ansi.newline(); stream.print(ansi.toString()); } private Ansi printSummary(PropertyInfo propertyInfo, Ansi ansi) { return ansi.a(propertyInfo.getShortDescription()).newline(); } private void printDeclaration(PropertyInfo propertyInfo, Ansi ansi) { ansi .newline() .a(" ") .fgBright(Ansi.Color.MAGENTA) .a(propertyInfo.getType()) .reset() .a(" ") .fgBright(Ansi.Color.BLUE) .a(propertyInfo.getName()) .reset(); Object defaultValue = propertyInfo.getDefaultValue(); if (defaultValue != null) { ansi .a(" = ") .fgBright(Ansi.Color.GREEN) .a(String.valueOf(defaultValue)) .reset(); } ansi .a(";") .newline(); } private void printLongDescription(PropertyInfo propertyInfo, Ansi ansi) { String longDescription = propertyInfo.getLongDescription(); if (longDescription != null) { ansi.newline().a(textWrapper.wrap(longDescription)).newline(); } } private void printAdditionalInfo(PropertyInfo propertyInfo, Ansi ansi) { if (propertyInfo.isMandatory() || propertyInfo.isSingleValue()) { ansi.newline(); } if (propertyInfo.isMandatory()) { ansi.a("* This property is mandatory.").newline(); } if (propertyInfo.isSingleValue()) { ansi.a("* This property is the default property of its declaring object").newline(); } } }
Sherpard/seed
core/src/main/java/org/seedstack/seed/core/internal/configuration/tool/DetailPrinter.java
Java
mpl-2.0
2,925
--- layout: "cf" page_title: "Cloud Foundry: cf_service_access" sidebar_current: "docs-cf-resource-service-access" description: |- Provides a Cloud Foundry Service Access resource. --- # cf\_service\_access Provides a Cloud Foundry resource for managing [access](https://docs.cloudfoundry.org/services/access-control.html) to service plans published by Cloud Foundry [service brokers](https://docs.cloudfoundry.org/services/). ## Example Usage The following example enables access to a specific plan of a given service broker within an Org. ``` resource "cf_service_access" "org1-mysql-512mb" { plan = "${cf_service_broker.mysql.service_plans["p-mysql/512mb"]}" org = "${cf_org.org1.id}" } ``` ## Argument Reference The following arguments are supported: * `plan` - (Required) The ID of the service plan to grant access to * `org` - (Required) The ID of the Org which should have access to the plan
appbricks/ab-terraform-build
website/source/docs/providers/cf/r/service_access.html.markdown
Markdown
mpl-2.0
917
const html = require('choo/html'); module.exports = function(name, url) { const dialog = function(state, emit, close) { return html` <send-share-dialog class="flex flex-col items-center text-center p-4 max-w-sm m-auto" > <h1 class="text-3xl font-bold my-4"> ${state.translate('notifyUploadEncryptDone')} </h1> <p class="font-normal leading-normal text-grey-80 dark:text-grey-40"> ${state.translate('shareLinkDescription')}<br /> <span class="word-break-all">${name}</span> </p> <input type="text" id="share-url" class="w-full my-4 border rounded-lg leading-loose h-12 px-2 py-1 dark:bg-grey-80" value="${url}" readonly="true" /> <button class="btn rounded-lg w-full flex-shrink-0 focus:outline" onclick="${share}" title="${state.translate('shareLinkButton')}" > ${state.translate('shareLinkButton')} </button> <button class="link-blue my-4 font-medium cursor-pointer focus:outline" onclick="${close}" title="${state.translate('okButton')}" > ${state.translate('okButton')} </button> </send-share-dialog> `; async function share(event) { event.stopPropagation(); try { await navigator.share({ title: state.translate('-send-brand'), text: state.translate('shareMessage', { name }), url }); } catch (e) { if (e.code === e.ABORT_ERR) { return; } console.error(e); } close(); } }; dialog.type = 'share'; return dialog; };
mozilla/send
app/ui/shareDialog.js
JavaScript
mpl-2.0
1,735
#ifndef PLASTIQQACCESSIBLESTATECHANGEEVENT_H #define PLASTIQQACCESSIBLESTATECHANGEEVENT_H #include "plastiqobject.h" class PlastiQQAccessibleStateChangeEvent : public PlastiQObject { PLASTIQ_OBJECT(IsQEvent,QAccessibleStateChangeEvent,QAccessibleEvent) PLASTIQ_INHERITS(QAccessibleEvent) public: ~PlastiQQAccessibleStateChangeEvent(); }; #endif // PLASTIQQACCESSIBLESTATECHANGEEVENT_H
ArtMares/PQStudio
Builder/plastiq/include/gui/PlastiQQAccessibleStateChangeEvent/plastiqqaccessiblestatechangeevent.h
C
mpl-2.0
398
ο»Ώusing System; using System.Collections.Generic; using System.IO; using System.Windows.Input; using System.Threading; using System.Linq; using System.Text; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.GamerServices; namespace Sims2Online.UI.Elements { class UIButton : UIControl { MouseState oldMouseState; KeyboardState oldKBState; Vector2 selected; Texture2D backtex; public string text; public Color color = Color.White; public event EventHandler onClicked; public event EventHandler onHover; public event EventHandler onMouseLeft; public float scale; public override void Init(SpriteBatch spb) { selected = Vector2.Zero; using (var stream1 = new FileStream("./content/colour.png", FileMode.Open)) { backtex = Texture2D.FromStream(spb.GraphicsDevice, stream1); } } public override void Update(SpriteBatch spb, S2OGame game) { spb.Draw(backtex, rect, Color.Black * 0.25f); var currentMouseState = Mouse.GetState(); var currentKBState = Keyboard.GetState(); if (rect.Contains(new Point(currentMouseState.X, currentMouseState.Y)) && currentMouseState.LeftButton == ButtonState.Pressed) { this.onClicked?.Invoke(this, EventArgs.Empty); } else if (rect.Contains(new Point(currentMouseState.X, currentMouseState.Y))) { this.onHover?.Invoke(this, EventArgs.Empty); } else { this.onMouseLeft?.Invoke(this, EventArgs.Empty); } spb.DrawString(S2OGame.Font1, text, new Vector2(rect.X + ((rect.Width / 2) - ((S2OGame.Font1.MeasureString(text) * scale).X / 2)), rect.Y + ((rect.Height / 2) - ((S2OGame.Font1.MeasureString(text) * scale).Y / 2))), color, 0, Vector2.Zero, scale, SpriteEffects.None, 0.5f); oldMouseState = currentMouseState; oldKBState = currentKBState; } } }
LRB-Game-Tools/Sims2Online
Sims2Client/Sims2Online/UI/Elements/UIButton.cs
C#
mpl-2.0
2,235
billing ======= billing
daodzen/billing
README.md
Markdown
mpl-2.0
25
{-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} {-# OPTIONS_GHC -fno-warn-duplicate-exports #-} {-# OPTIONS_GHC -fno-warn-unused-binds #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-} -- | -- Module : Network.Google.Resource.Analytics.Management.WebProperties.Update -- Copyright : (c) 2015-2016 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay <[email protected]> -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Updates an existing web property. -- -- /See:/ <https://developers.google.com/analytics/ Google Analytics API Reference> for @analytics.management.webproperties.update@. module Network.Google.Resource.Analytics.Management.WebProperties.Update ( -- * REST Resource ManagementWebPropertiesUpdateResource -- * Creating a Request , managementWebPropertiesUpdate , ManagementWebPropertiesUpdate -- * Request Lenses , mwpuWebPropertyId , mwpuPayload , mwpuAccountId ) where import Network.Google.Analytics.Types import Network.Google.Prelude -- | A resource alias for @analytics.management.webproperties.update@ method which the -- 'ManagementWebPropertiesUpdate' request conforms to. type ManagementWebPropertiesUpdateResource = "analytics" :> "v3" :> "management" :> "accounts" :> Capture "accountId" Text :> "webproperties" :> Capture "webPropertyId" Text :> QueryParam "alt" AltJSON :> ReqBody '[JSON] WebProperty :> Put '[JSON] WebProperty -- | Updates an existing web property. -- -- /See:/ 'managementWebPropertiesUpdate' smart constructor. data ManagementWebPropertiesUpdate = ManagementWebPropertiesUpdate' { _mwpuWebPropertyId :: !Text , _mwpuPayload :: !WebProperty , _mwpuAccountId :: !Text } deriving (Eq,Show,Data,Typeable,Generic) -- | Creates a value of 'ManagementWebPropertiesUpdate' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'mwpuWebPropertyId' -- -- * 'mwpuPayload' -- -- * 'mwpuAccountId' managementWebPropertiesUpdate :: Text -- ^ 'mwpuWebPropertyId' -> WebProperty -- ^ 'mwpuPayload' -> Text -- ^ 'mwpuAccountId' -> ManagementWebPropertiesUpdate managementWebPropertiesUpdate pMwpuWebPropertyId_ pMwpuPayload_ pMwpuAccountId_ = ManagementWebPropertiesUpdate' { _mwpuWebPropertyId = pMwpuWebPropertyId_ , _mwpuPayload = pMwpuPayload_ , _mwpuAccountId = pMwpuAccountId_ } -- | Web property ID mwpuWebPropertyId :: Lens' ManagementWebPropertiesUpdate Text mwpuWebPropertyId = lens _mwpuWebPropertyId (\ s a -> s{_mwpuWebPropertyId = a}) -- | Multipart request metadata. mwpuPayload :: Lens' ManagementWebPropertiesUpdate WebProperty mwpuPayload = lens _mwpuPayload (\ s a -> s{_mwpuPayload = a}) -- | Account ID to which the web property belongs mwpuAccountId :: Lens' ManagementWebPropertiesUpdate Text mwpuAccountId = lens _mwpuAccountId (\ s a -> s{_mwpuAccountId = a}) instance GoogleRequest ManagementWebPropertiesUpdate where type Rs ManagementWebPropertiesUpdate = WebProperty type Scopes ManagementWebPropertiesUpdate = '["https://www.googleapis.com/auth/analytics.edit"] requestClient ManagementWebPropertiesUpdate'{..} = go _mwpuAccountId _mwpuWebPropertyId (Just AltJSON) _mwpuPayload analyticsService where go = buildClient (Proxy :: Proxy ManagementWebPropertiesUpdateResource) mempty
rueshyna/gogol
gogol-analytics/gen/Network/Google/Resource/Analytics/Management/WebProperties/Update.hs
Haskell
mpl-2.0
4,070
<?php namespace ide\formats\form\elements; use ide\editors\value\BooleanPropertyEditor; use ide\editors\value\ColorPropertyEditor; use ide\editors\value\FontPropertyEditor; use ide\editors\value\IntegerPropertyEditor; use ide\editors\value\PositionPropertyEditor; use ide\editors\value\SimpleTextPropertyEditor; use ide\editors\value\TextPropertyEditor; use ide\formats\form\AbstractFormElement; use php\gui\designer\UXDesignProperties; use php\gui\designer\UXDesignPropertyEditor; use php\gui\layout\UXAnchorPane; use php\gui\layout\UXHBox; use php\gui\layout\UXPanel; use php\gui\UXButton; use php\gui\UXNode; use php\gui\UXTableCell; use php\gui\UXTextField; use php\gui\UXTitledPane; /** * Class ButtonFormElement * @package ide\formats\form */ class PanelFormElement extends AbstractFormElement { public function getGroup() { return 'ПанСли'; } public function getElementClass() { return UXPanel::class; } public function getName() { return 'ПанСль'; } public function getIcon() { return 'icons/panel16.png'; } public function getIdPattern() { return "panel%s"; } public function isLayout() { return true; } public function addToLayout($self, $node, $screenX = null, $screenY = null) { /** @var UXPanel $self */ $node->position = $self->screenToLocal($screenX, $screenY); $self->add($node); } public function getLayoutChildren($layout) { $children = flow($layout->children) ->find(function (UXNode $it) { return !$it->classes->has('x-system-element'); }) ->toArray(); return $children; } /** * @return UXNode */ public function createElement() { $button = new UXPanel(); $button->backgroundColor = 'white'; return $button; } public function getDefaultSize() { return [150, 100]; } public function isOrigin($any) { return get_class($any) == UXPanel::class; } }
jphp-compiler/develnext
platforms/develnext-desktop-platform/src/ide/formats/form/elements/PanelFormElement.php
PHP
mpl-2.0
2,091
<HTML> <HEAD> <TITLE>HPL_ptimer_walltime HPL 2.1 Library Functions October 26, 2012</TITLE> </HEAD> <BODY BGCOLOR="WHITE" TEXT = "#000000" LINK = "#0000ff" VLINK = "#000099" ALINK = "#ffff00"> <H1>Name</H1> <B>HPL_ptimer_walltime</B> Return the elapsed (wall-clock) time. <H1>Synopsis</H1> <CODE>#include "hpl.h"</CODE><BR><BR> <CODE>double</CODE> <CODE>HPL_ptimer_walltime();</CODE> <H1>Description</H1> <B>HPL_ptimer_walltime</B> returns the elapsed (wall-clock) time. <H1>See Also</H1> <A HREF="HPL_ptimer_cputime.html">HPL_ptimer_cputime</A>, <A HREF="HPL_ptimer.html">HPL_ptimer</A>. </BODY> </HTML>
mtasende/BLAS_for_Parallella
hpl-2.1/www/HPL_ptimer_walltime.html
HTML
mpl-2.0
618
package com.storage.mywarehouse.Dao; import com.storage.mywarehouse.View.WarehouseProduct; import org.hibernate.Session; import org.hibernate.Transaction; import org.hibernate.criterion.Restrictions; import java.util.List; public class WarehouseProductDAO { @SuppressWarnings("unchecked") public static List<WarehouseProduct> findById(int id) { Session session = NewHibernateUtil.getSessionFactory().openSession(); Transaction tx = session.beginTransaction(); List products = session.createCriteria(WarehouseProduct.class) .add(Restrictions.eq("productId", id)) .list(); tx.commit(); session.close(); return products; } @SuppressWarnings("unchecked") public static List<WarehouseProduct> findByQuantity(int quantity) { Session session = NewHibernateUtil.getSessionFactory().openSession(); Transaction tx = session.beginTransaction(); List emptyWarehouseProduct = session.createCriteria(WarehouseProduct.class) .add(Restrictions.eq("quantity", quantity)) .list(); tx.commit(); session.close(); return emptyWarehouseProduct; } @SuppressWarnings("unchecked") public static List<WarehouseProduct> findByParam(String param, String value) { Session session = NewHibernateUtil.getSessionFactory().openSession(); Transaction tx = session.beginTransaction(); List products = session.createCriteria(WarehouseProduct.class) .add(Restrictions.eq(param.toLowerCase(), value)) .list(); tx.commit(); session.close(); return products; } @SuppressWarnings("unchecked") public static List<WarehouseProduct> findByParamContainingValue(String param, String value) { Session session = NewHibernateUtil.getSessionFactory().openSession(); Transaction tx = session.beginTransaction(); List products = session.createCriteria(WarehouseProduct.class) .add(Restrictions.like(param.toLowerCase(), "%" + value + "%")) .list(); tx.commit(); session.close(); return products; } }
patroklossam/WareHouse
src/main/java/com/storage/mywarehouse/Dao/WarehouseProductDAO.java
Java
mpl-2.0
2,222
![Sozi logo](sozi-logo-bg.png) This is the JavaScript API documentation for Sozi. Additional information about the Sozi project can be found at: * [The main web site for Sozi, with the user manual and tutorials](https://sozi.baierouge.fr) * [The source code repository at GitHub](https://github.com/sozi-projects/Sozi)
senshu/Sozi
README.jsdoc.md
Markdown
mpl-2.0
323
# gsd Getting stuff done - more vapourware, this time with shiny new tech ## TL;DR Playing around with shiny new tech by creating a web app for following the [Getting Things Done](https://hamberg.no/gtd/) organisational framework. ## What's this all about? I want to play with a whole bunch of shiny(ish), new(ish) tech and methodologies. I intend to do this by building a vapourware web app to help follow the [Getting Things Done](https://hamberg.no/gtd/) organisational framework. To this end this project will hopefully/kinda/sorta do some of the following: * Built using Clojure * Use BDD to specify the application using plain English * Cucumber * Property based testing * test.check * Use mobile first, responsive web design * Isomorphic web app using Om Next and the Nashorn javascript engine * Continuous deployment ## Contributing Should you ever find this project useful and feel the urge to contribute something back this project follows the [latest C4 process](http://rfc.zeromq.org/spec:42/C4/) for contributions. ## Style guide Code should be formatted as defaulted to by the [Cursive](https://cursive-ide.com/) Intellij plugin. ## License This project uses the [MPLv2](https://www.mozilla.org/en-US/MPL/2.0/).
HughPowell/gsd
README.md
Markdown
mpl-2.0
1,253
package iso import ( "fmt" "github.com/mitchellh/multistep" vmwcommon "github.com/mitchellh/packer/builder/vmware/common" "github.com/mitchellh/packer/packer" "log" ) // stepRemoteUpload uploads some thing from the state bag to a remote driver // (if it can) and stores that new remote path into the state bag. type stepRemoteUpload struct { Key string Message string } func (s *stepRemoteUpload) Run(state multistep.StateBag) multistep.StepAction { driver := state.Get("driver").(vmwcommon.Driver) ui := state.Get("ui").(packer.Ui) remote, ok := driver.(RemoteDriver) if !ok { return multistep.ActionContinue } path, ok := state.Get(s.Key).(string) if !ok { return multistep.ActionContinue } ui.Say(s.Message) log.Printf("Remote uploading: %s", path) newPath, err := remote.UploadISO(path) if err != nil { err := fmt.Errorf("Error uploading file: %s", err) state.Put("error", err) ui.Error(err.Error()) return multistep.ActionHalt } state.Put(s.Key, newPath) return multistep.ActionContinue } func (s *stepRemoteUpload) Cleanup(state multistep.StateBag) { }
jsoriano/packer
builder/vmware/iso/step_remote_upload.go
GO
mpl-2.0
1,105
package app.intelehealth.client.models.pushRequestApiCall; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import java.util.List; public class Person { @SerializedName("uuid") @Expose private String uuid; @SerializedName("gender") @Expose private String gender; @SerializedName("names") @Expose private List<Name> names = null; @SerializedName("birthdate") @Expose private String birthdate; @SerializedName("attributes") @Expose private List<Attribute> attributes = null; @SerializedName("addresses") @Expose private List<Address> addresses = null; public String getUuid() { return uuid; } public void setUuid(String uuid) { this.uuid = uuid; } public String getGender() { return gender; } public void setGender(String gender) { this.gender = gender; } public List<Name> getNames() { return names; } public void setNames(List<Name> names) { this.names = names; } public String getBirthdate() { return birthdate; } public void setBirthdate(String birthdate) { this.birthdate = birthdate; } public List<Attribute> getAttributes() { return attributes; } public void setAttributes(List<Attribute> attributes) { this.attributes = attributes; } public List<Address> getAddresses() { return addresses; } public void setAddresses(List<Address> addresses) { this.addresses = addresses; } }
Intelehealth/Android-Mobile-Client
app/src/main/java/app/intelehealth/client/models/pushRequestApiCall/Person.java
Java
mpl-2.0
1,609
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="generator" content="rustdoc"> <meta name="description" content="API documentation for the Rust `XK_F1` constant in crate `x11`."> <meta name="keywords" content="rust, rustlang, rust-lang, XK_F1"> <title>x11::keysym::XK_F1 - Rust</title> <link rel="stylesheet" type="text/css" href="../../main.css"> </head> <body class="rustdoc"> <!--[if lte IE 8]> <div class="warning"> This old browser is unsupported and will most likely display funky things. </div> <![endif]--> <section class="sidebar"> <p class='location'><a href='../index.html'>x11</a>::<wbr><a href='index.html'>keysym</a></p><script>window.sidebarCurrent = {name: 'XK_F1', ty: 'constant', relpath: ''};</script><script defer src="sidebar-items.js"></script> </section> <nav class="sub"> <form class="search-form js-only"> <div class="search-container"> <input class="search-input" name="search" autocomplete="off" placeholder="Click or press β€˜S’ to search, β€˜?’ for more options…" type="search"> </div> </form> </nav> <section id='main' class="content constant"> <h1 class='fqn'><span class='in-band'><a href='../index.html'>x11</a>::<wbr><a href='index.html'>keysym</a>::<wbr><a class='constant' href=''>XK_F1</a></span><span class='out-of-band'><span id='render-detail'> <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs"> [<span class='inner'>&#x2212;</span>] </a> </span><a id='src-1174' class='srclink' href='../../src/x11/keysym.rs.html#100' title='goto source code'>[src]</a></span></h1> <pre class='rust const'>pub const XK_F1: <a class='type' href='../../libc/types/os/arch/c95/type.c_uint.html' title='libc::types::os::arch::c95::c_uint'>c_uint</a><code> = </code><code>0xFFBE</code></pre></section> <section id='search' class="content hidden"></section> <section class="footer"></section> <div id="help" class="hidden"> <div> <div class="shortcuts"> <h1>Keyboard Shortcuts</h1> <dl> <dt>?</dt> <dd>Show this help dialog</dd> <dt>S</dt> <dd>Focus the search field</dd> <dt>&larrb;</dt> <dd>Move up in search results</dd> <dt>&rarrb;</dt> <dd>Move down in search results</dd> <dt>&#9166;</dt> <dd>Go to active search result</dd> </dl> </div> <div class="infos"> <h1>Search Tricks</h1> <p> Prefix searches with a type followed by a colon (e.g. <code>fn:</code>) to restrict the search to a given type. </p> <p> Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>. </p> <p> Search functions by type signature (e.g. <code>vec -> usize</code>) </p> </div> </div> </div> <script> window.rootPath = "../../"; window.currentCrate = "x11"; window.playgroundUrl = ""; </script> <script src="../../jquery.js"></script> <script src="../../main.js"></script> <script async src="../../search-index.js"></script> </body> </html>
susaing/doc.servo.org
x11/keysym/constant.XK_F1.html
HTML
mpl-2.0
3,943
{# This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. #} {% extends "firefox/base/base-protocol.html" %} {% from "macros-protocol.html" import split, card with context %} {% block page_title %}{{ ftl('firefox-products-are') }}{% endblock %} {% block page_desc %}{{ ftl('learn-more-about') }}{% endblock %} {% block page_css %} {{ css_bundle('more') }} {% endblock %} {% block content %} <main> {% call split( image_url='img/firefox/privacy/promise/privacy-hero.png', include_highres_image=True, block_class='page-hero mzp-l-split-hide-media-on-sm-md mzp-t-split-nospace', theme_class='mzp-t-dark', media_class='mzp-l-split-v-end' ) %} <h2>{{ ftl('learn-more-about-firefox', fallback='firefox-products-are') }}</h2> <p><a href="{{ url('firefox.faq') }}" class="mzp-c-button mzp-t-product">{{ ftl('learn-more-faq') }}</a></p> {% endcall %} <div class="mzp-l-content"> <div class="mzp-l-card-quarter"> {{ card( title=ftl('firefox-fights-for'), ga_title='Firefox Windows', image_url='img/firefox/more/firefox-windows.jpg', desc=ftl('easy-migration-of'), link_url=url('firefox.windows') )}} {{ card( title=ftl('firefox-respects-your'), ga_title='Firefox Mac', image_url='img/firefox/more/firefox-mac.jpg', desc=ftl('firefox-doesnt-spy'), link_url=url('firefox.mac') )}} {{ card( title=ftl('firefox-for-linux'), ga_title='Firefox Linux', image_url='img/firefox/more/firefox-linux.jpg', desc=ftl('new-school-meets'), link_url=url('firefox.linux') )}} {{ card( title=ftl('firefox-for-windows'), ga_title='Firefox Win 64', image_url='img/firefox/more/firefox-64-bit.jpg', desc=ftl('we-worry-about'), link_url=url('firefox.browsers.windows-64-bit') )}} </div> <div class="mzp-l-card-third"> {{ card( title=ftl('the-history-of'), ga_title='Browser History', image_url='img/firefox/more/browser-history.jpg', desc=ftl('firefox-has-been'), link_url=url('firefox.browsers.browser-history') )}} {{ card( title=ftl('what-is-a'), ga_title='What is a browser', image_url='img/firefox/more/what-is-a-browser.jpg', desc=ftl('a-web-browser'), link_url=url('firefox.browsers.what-is-a-browser') )}} {{ card( title=ftl('update-your-browser'), ga_title='Update Browser', image_url='img/firefox/more/update-browser.jpg', desc=ftl('the-firefox-browser'), link_url=url('firefox.browsers.update-browser') )}} </div> <div class="mzp-l-card-third"> {{ card( title=ftl('choose-which-firefox'), ga_title='Firefox All', image_url='img/firefox/more/firefox-all.jpg', desc=ftl('we-believe-everyone'), link_url=url('firefox.all') )}} {{ card( title=ftl('firefox-more-firefox-chromebook'), ga_title='Firefox Products', image_url='img/firefox/more/firefox-chromebook.jpg', desc=ftl('firefox-more-while-on-chromebook'), link_url=url('firefox.browsers.chromebook') )}} {{ card( title=ftl('firefox-more-firefox-quantum'), ga_title='Firefox Browsers', image_url='img/firefox/more/firefox-quantum.jpg', desc=ftl('firefox-more-quantum-was-revolution'), link_url=url('firefox.browsers.quantum') )}} </div> <div class="mzp-l-card-third"> {{ card( title=ftl('firefox-rebel-with'), ga_title="Independent", image_url='img/firefox/more/independent.jpg', desc= ftl('firefox-is-independent'), link_url=url('firefox.features.independent') )}} {{ card( title=ftl('firefox-more-little-book'), ga_title='Features Private Browsing', image_url='img/firefox/more/little-book-of-privacy.jpg', desc= ftl('firefox-more-you-can-reclaim'), link_url=url('firefox.privacy.book') )}} {{ card( title=ftl('incognito-browser-what'), ga_title='Features Private Browsing', image_url='img/firefox/more/incognito-browser.jpg', desc=ftl('firefox-calls-it'), link_url=url('firefox.browsers.incognito-browser') )}} </div> <div class="mzp-l-card-quarter"> {{ card( title=ftl('the-ad-blocker'), ga_title='Featires Adblocker', image_url='img/firefox/more/firefox-adblocker.jpg', desc=ftl('so-many-ads'), link_url=url('firefox.features.adblocker') )}} {{ card( title=ftl('firefox-more-protection'), ga_title='Features Private Browsing', image_url='img/firefox/more/private-browsing.jpg', desc=ftl('were-obsessed-with'), link_url=url('firefox.features.private-browsing') )}} {{ card( title=ftl('take-the-stress'), ga_title='Features Safe Browser', image_url='img/firefox/more/safe-browser.jpg', desc=ftl('building-a-safe'), link_url=url('firefox.features.safebrowser') )}} {{ card( title=ftl('firefox-more-firefox-sync'), ga_title='Features Safe Browser', image_url='img/firefox/more/firefox-sync.jpg', desc=ftl('firefox-more-access-your-sync'), link_url=url('firefox.sync') )}} </div> <div class="mzp-l-card-third"> {{ card( title=ftl('seven-of-the'), ga_title='Compare', image_url='img/firefox/more/compare-browsers.jpg', desc=ftl('we-compare-firefox'), link_url=url('firefox.browsers.compare.index') )}} {{ card( title=ftl('comparing-firefox-chrome'), ga_title='Compare Chrome', image_url='img/firefox/more/firefox-chrome.jpg', desc=ftl('big-isnt-always'), link_url=url('firefox.browsers.compare.chrome') )}} {{ card( title=ftl('comparing-firefox-brave'), ga_title='Compare Brave', image_url='img/firefox/more/firefox-brave.jpg', desc=ftl('be-bold-and'), link_url=url('firefox.browsers.compare.brave') )}} </div> <div class="mzp-l-card-quarter"> {{ card( title=ftl('comparing-firefox-edge'), ga_title='Compare Edge', image_url='img/firefox/more/firefox-edge.jpg', desc=ftl('youll-never-guess'), link_url=url('firefox.browsers.compare.edge') )}} {{ card( title=ftl('comparing-firefox-ie'), ga_title='Compare IE', image_url='img/firefox/more/firefox-ie.jpg', desc=ftl('old-habits-that'), link_url=url('firefox.browsers.compare.ie') )}} {{ card( title=ftl('comparing-firefox-safari'), ga_title='Compare Safari', desc=ftl('you-dont-have'), image_url='img/firefox/more/firefox-safari.jpg', link_url=url('firefox.browsers.compare.safari') )}} {{ card( title=ftl('comparing-firefox-opera'), ga_title='Compare Opera', image_url='img/firefox/more/firefox-opera.jpg', desc=ftl('be-free-to'), link_url=url('firefox.browsers.compare.opera') )}} </div> <div class="mzp-l-card-third"> {{ card( title=ftl('firefox-more-fingerprinter-blocking'), ga_title='Fingerprinter Blocking', image_url='img/firefox/more/fingerprint.png', desc=ftl('firefox-more-fingerprinting-is-a'), link_url=url('firefox.features.fingerprinting') )}} {{ card( title=ftl('firefox-more-translate-the-web'), ga_title='Translate', image_url='img/firefox/more/firefox-all.jpg', desc=ftl('firefox-more-translate-more-than'), link_url=url('firefox.features.translate') )}} {{ card( title=ftl('firefox-more-a-guide-to'), ga_title='Safe Passwords', desc=ftl('firefox-more-more-and-more'), image_url='img/firefox/more/passwords.png', link_url=url('firefox.privacy.passwords') )}} </div> <div class="mzp-l-card-quarter"> {{ card( title=ftl('firefox-more-avoid-misinformation-heading'), ga_title='Avoid Misinformation', image_url='img/firefox/more/avoid-misinformation.jpg', desc=ftl('firefox-more-avoid-misinformation-desc'), link_url=url('firefox.more.misinformation') )}} </div> </div> </main> {% endblock %}
sylvestre/bedrock
bedrock/firefox/templates/firefox/more.html
HTML
mpl-2.0
8,720
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="generator" content="rustdoc"> <meta name="description" content="API documentation for the Rust `MAX_VIEWPORT_DIMS` constant in crate `gleam`."> <meta name="keywords" content="rust, rustlang, rust-lang, MAX_VIEWPORT_DIMS"> <title>gleam::ffi::MAX_VIEWPORT_DIMS - Rust</title> <link rel="stylesheet" type="text/css" href="../../rustdoc.css"> <link rel="stylesheet" type="text/css" href="../../main.css"> </head> <body class="rustdoc"> <!--[if lte IE 8]> <div class="warning"> This old browser is unsupported and will most likely display funky things. </div> <![endif]--> <nav class="sidebar"> <p class='location'><a href='../index.html'>gleam</a>::<wbr><a href='index.html'>ffi</a></p><script>window.sidebarCurrent = {name: 'MAX_VIEWPORT_DIMS', ty: 'constant', relpath: ''};</script><script defer src="sidebar-items.js"></script> </nav> <nav class="sub"> <form class="search-form js-only"> <div class="search-container"> <input class="search-input" name="search" autocomplete="off" placeholder="Click or press β€˜S’ to search, β€˜?’ for more options…" type="search"> </div> </form> </nav> <section id='main' class="content constant"> <h1 class='fqn'><span class='in-band'><a href='../index.html'>gleam</a>::<wbr><a href='index.html'>ffi</a>::<wbr><a class='constant' href=''>MAX_VIEWPORT_DIMS</a></span><span class='out-of-band'><span id='render-detail'> <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs"> [<span class='inner'>&#x2212;</span>] </a> </span><a id='src-1365' class='srclink' href='../../src/gleam/home/servo/buildbot/slave/doc/build/target/debug/build/gleam-8cc6d4d4d5b87928/out/gl_bindings.rs.html#805' title='goto source code'>[src]</a></span></h1> <pre class='rust const'>pub const MAX_VIEWPORT_DIMS: <a class='type' href='../../gleam/gl/types/type.GLenum.html' title='gleam::gl::types::GLenum'>GLenum</a><code> = </code><code>3386</code></pre></section> <section id='search' class="content hidden"></section> <section class="footer"></section> <aside id="help" class="hidden"> <div> <h1 class="hidden">Help</h1> <div class="shortcuts"> <h2>Keyboard Shortcuts</h2> <dl> <dt>?</dt> <dd>Show this help dialog</dd> <dt>S</dt> <dd>Focus the search field</dd> <dt>&larrb;</dt> <dd>Move up in search results</dd> <dt>&rarrb;</dt> <dd>Move down in search results</dd> <dt>&#9166;</dt> <dd>Go to active search result</dd> <dt>+</dt> <dd>Collapse/expand all sections</dd> </dl> </div> <div class="infos"> <h2>Search Tricks</h2> <p> Prefix searches with a type followed by a colon (e.g. <code>fn:</code>) to restrict the search to a given type. </p> <p> Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>. </p> <p> Search functions by type signature (e.g. <code>vec -> usize</code> or <code>* -> vec</code>) </p> </div> </div> </aside> <script> window.rootPath = "../../"; window.currentCrate = "gleam"; window.playgroundUrl = ""; </script> <script src="../../jquery.js"></script> <script src="../../main.js"></script> <script defer src="../../search-index.js"></script> </body> </html>
servo/doc.servo.org
gleam/ffi/constant.MAX_VIEWPORT_DIMS.html
HTML
mpl-2.0
4,339
/* * This file is part of Espruino, a JavaScript interpreter for Microcontrollers * * Copyright (C) 2013 Gordon Williams <[email protected]> * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * ---------------------------------------------------------------------------- * Utilities and definitions for handling Pins * ---------------------------------------------------------------------------- */ #include "jspin.h" #include "jspininfo.h" // auto-generated #include "jsinteractive.h" #include "jshardware.h" #if defined(PICO) || defined(NUCLEOF401RE) || defined(NUCLEOF411RE) #define PIN_NAMES_DIRECT // work out pin names directly from port + pin in pinInfo #endif bool jshIsPinValid(Pin pin) { // Note, PIN_UNDEFINED is always > JSH_PIN_COUNT return pin < JSH_PIN_COUNT && pinInfo[pin].port!=JSH_PORT_NONE; } Pin jshGetPinFromString(const char *s) { // built in constants if (s[0]=='B' && s[1]=='T' && s[2]=='N') { #ifdef BTN1_PININDEX if (!s[3]) return BTN1_PININDEX; if (s[3]=='1' && !s[4]) return BTN1_PININDEX; #endif #ifdef BTN2_PININDEX if (s[3]=='2' && !s[4]) return BTN2_PININDEX; #endif #ifdef BTN3_PININDEX if (s[3]=='3' && !s[4]) return BTN3_PININDEX; #endif #ifdef BTN4_PININDEX if (s[3]=='4' && !s[4]) return BTN4_PININDEX; #endif } if (s[0]=='L' && s[1]=='E' && s[2]=='D') { #ifdef LED1_PININDEX if (!s[3]) return LED1_PININDEX; if (s[3]=='1' && !s[4]) return LED1_PININDEX; #endif #ifdef LED2_PININDEX if (s[3]=='2' && !s[4]) return LED2_PININDEX; #endif #ifdef LED3_PININDEX if (s[3]=='3' && !s[4]) return LED3_PININDEX; #endif #ifdef LED4_PININDEX if (s[3]=='4' && !s[4]) return LED4_PININDEX; #endif #ifdef LED5_PININDEX if (s[3]=='5' && !s[4]) return LED5_PININDEX; #endif #ifdef LED6_PININDEX if (s[3]=='6' && !s[4]) return LED6_PININDEX; #endif #ifdef LED7_PININDEX if (s[3]=='7' && !s[4]) return LED7_PININDEX; #endif #ifdef LED8_PININDEX if (s[3]=='8' && !s[4]) return LED8_PININDEX; #endif } if ((s[0]>='A' && s[0]<='H') && s[1]) { int port = JSH_PORTA+s[0]-'A'; int pin = -1; if (s[1]>='0' && s[1]<='9') { if (!s[2]) { // D0-D9 pin = (s[1]-'0'); } else if (s[2]>='0' && s[2]<='9') { if (!s[3]) { pin = ((s[1]-'0')*10 + (s[2]-'0')); } else if (!s[4] && s[3]>='0' && s[3]<='9') { pin = ((s[1]-'0')*100 + (s[2]-'0')*10 + (s[3]-'0')); } } } if (pin>=0) { #ifdef PIN_NAMES_DIRECT int i; for (i=0;i<JSH_PIN_COUNT;i++) if (pinInfo[i].port == port && pinInfo[i].pin==pin) return (Pin)i; #else if (port == JSH_PORTA) { if (pin<JSH_PORTA_COUNT) return (Pin)(JSH_PORTA_OFFSET + pin); } else if (port == JSH_PORTB) { if (pin<JSH_PORTB_COUNT) return (Pin)(JSH_PORTB_OFFSET + pin); } else if (port == JSH_PORTC) { if (pin<JSH_PORTC_COUNT) return (Pin)(JSH_PORTC_OFFSET + pin); } else if (port == JSH_PORTD) { if (pin<JSH_PORTD_COUNT) return (Pin)(JSH_PORTD_OFFSET + pin); #if JSH_PORTE_OFFSET!=-1 } else if (port == JSH_PORTE) { if (pin<JSH_PORTE_COUNT) return (Pin)(JSH_PORTE_OFFSET + pin); #endif #if JSH_PORTF_OFFSET!=-1 } else if (port == JSH_PORTF) { if (pin<JSH_PORTF_COUNT) return (Pin)(JSH_PORTF_OFFSET + pin); #endif #if JSH_PORTG_OFFSET!=-1 } else if (port == JSH_PORTG) { if (pin<JSH_PORTG_COUNT) return (Pin)(JSH_PORTG_OFFSET + pin); #endif #if JSH_PORTH_OFFSET!=-1 } else if (port == JSH_PORTH) { if (pin<JSH_PORTH_COUNT) return (Pin)(JSH_PORTH_OFFSET + pin); #endif } #endif } } return PIN_UNDEFINED; } /** Write the pin name to a string. String must have at least 8 characters (to be safe) */ void jshGetPinString(char *result, Pin pin) { result[0] = 0; // just in case #ifdef PIN_NAMES_DIRECT if (jshIsPinValid(pin)) { result[0] = (char)('A'+pinInfo[pin].port-JSH_PORTA); itostr(pinInfo[pin].pin-JSH_PIN0,&result[1],10); #else if ( #if JSH_PORTA_OFFSET!=0 pin>=JSH_PORTA_OFFSET && #endif pin<JSH_PORTA_OFFSET+JSH_PORTA_COUNT) { result[0]='A'; itostr(pin-JSH_PORTA_OFFSET,&result[1],10); } else if (pin>=JSH_PORTB_OFFSET && pin<JSH_PORTB_OFFSET+JSH_PORTB_COUNT) { result[0]='B'; itostr(pin-JSH_PORTB_OFFSET,&result[1],10); } else if (pin>=JSH_PORTC_OFFSET && pin<JSH_PORTC_OFFSET+JSH_PORTC_COUNT) { result[0]='C'; itostr(pin-JSH_PORTC_OFFSET,&result[1],10); } else if (pin>=JSH_PORTD_OFFSET && pin<JSH_PORTD_OFFSET+JSH_PORTD_COUNT) { result[0]='D'; itostr(pin-JSH_PORTD_OFFSET,&result[1],10); #if JSH_PORTE_OFFSET!=-1 } else if (pin>=JSH_PORTE_OFFSET && pin<JSH_PORTE_OFFSET+JSH_PORTE_COUNT) { result[0]='E'; itostr(pin-JSH_PORTE_OFFSET,&result[1],10); #endif #if JSH_PORTF_OFFSET!=-1 } else if (pin>=JSH_PORTF_OFFSET && pin<JSH_PORTF_OFFSET+JSH_PORTF_COUNT) { result[0]='F'; itostr(pin-JSH_PORTF_OFFSET,&result[1],10); #endif #if JSH_PORTG_OFFSET!=-1 } else if (pin>=JSH_PORTG_OFFSET && pin<JSH_PORTG_OFFSET+JSH_PORTG_COUNT) { result[0]='G'; itostr(pin-JSH_PORTG_OFFSET,&result[1],10); #endif #if JSH_PORTH_OFFSET!=-1 } else if (pin>=JSH_PORTH_OFFSET && pin<JSH_PORTH_OFFSET+JSH_PORTH_COUNT) { result[0]='H'; itostr(pin-JSH_PORTH_OFFSET,&result[1],10); #endif #endif } else { strncpy(result, "UNKNOWN", 8); } } /// Given a var, convert it to a pin ID (or -1 if it doesn't exist). safe for undefined! Pin jshGetPinFromVar(JsVar *pinv) { if (jsvIsString(pinv) && pinv->varData.str[5]==0/*should never be more than 4 chars!*/) { return jshGetPinFromString(&pinv->varData.str[0]); } else if (jsvIsInt(pinv) /* This also tests for the Pin datatype */) { return (Pin)jsvGetInteger(pinv); } else return PIN_UNDEFINED; } Pin jshGetPinFromVarAndUnLock(JsVar *pinv) { Pin pin = jshGetPinFromVar(pinv); jsvUnLock(pinv); return pin; } // ---------------------------------------------------------------------------- // Whether a pin's state has been set manually or not BITFIELD_DECL(jshPinStateIsManual, JSH_PIN_COUNT); // TODO: This should be set to all 0 bool jshGetPinStateIsManual(Pin pin) { return BITFIELD_GET(jshPinStateIsManual, pin); } void jshSetPinStateIsManual(Pin pin, bool manual) { BITFIELD_SET(jshPinStateIsManual, pin, manual); } // ---------------------------------------------------------------------------- bool jshPinInput(Pin pin) { bool value = false; if (jshIsPinValid(pin)) { if (!jshGetPinStateIsManual(pin)) jshPinSetState(pin, JSHPINSTATE_GPIO_IN); value = jshPinGetValue(pin); } else jsExceptionHere(JSET_ERROR, "Invalid pin!"); return value; } void jshPinOutput(Pin pin, bool value) { if (jshIsPinValid(pin)) { if (!jshGetPinStateIsManual(pin)) jshPinSetState(pin, JSHPINSTATE_GPIO_OUT); jshPinSetValue(pin, value); } else jsExceptionHere(JSET_ERROR, "Invalid pin!"); } // ---------------------------------------------------------------------------- // Convert an event type flag into a jshPinFunction for an actual hardware device JshPinFunction jshGetPinFunctionFromDevice(IOEventFlags device) { switch (device) { case EV_SERIAL1 : return JSH_USART1; case EV_SERIAL2 : return JSH_USART2; case EV_SERIAL3 : return JSH_USART3; case EV_SERIAL4 : return JSH_USART4; case EV_SERIAL5 : return JSH_USART5; case EV_SERIAL6 : return JSH_USART6; case EV_SPI1 : return JSH_SPI1; case EV_SPI2 : return JSH_SPI2; case EV_SPI3 : return JSH_SPI3; case EV_I2C1 : return JSH_I2C1; case EV_I2C2 : return JSH_I2C2; case EV_I2C3 : return JSH_I2C3; default: return 0; } } /** Try and find a specific type of function for the given pin. Can be given an invalid pin and will return 0. */ JshPinFunction NO_INLINE jshGetPinFunctionForPin(Pin pin, JshPinFunction functionType) { if (!jshIsPinValid(pin)) return 0; int i; for (i=0;i<JSH_PININFO_FUNCTIONS;i++) { if ((pinInfo[pin].functions[i]&JSH_MASK_TYPE) == functionType) return pinInfo[pin].functions[i]; } return 0; } /** Try and find the best pin suitable for the given function. Can return -1. */ Pin NO_INLINE jshFindPinForFunction(JshPinFunction functionType, JshPinFunction functionInfo) { #ifdef OLIMEXINO_STM32 /** Hack, as you can't mix AFs on the STM32F1, and Olimexino reordered the pins * such that D4(AF1) is before D11(AF0) - and there are no SCK/MISO for AF1! */ if (functionType == JSH_SPI1 && functionInfo==JSH_SPI_MOSI) return JSH_PORTD_OFFSET+11; #endif #ifdef PICO /* On the Pico, A9 is used for sensing when USB power is applied. Is someone types in * Serial1.setup(9600) it'll get chosen as it's the first pin, but setting it to an output * totally messes up the STM32 as it's fed with 5V. This ensures that it won't get chosen * UNLESS it is explicitly selected. * * TODO: better way of doing this? A JSH_DONT_DEFAULT flag for pin functions? */ if (functionType == JSH_USART1) { if (functionInfo==JSH_USART_TX) return JSH_PORTB_OFFSET+6; if (functionInfo==JSH_USART_RX) return JSH_PORTB_OFFSET+7; } #endif Pin i; int j; // first, try and find the pin with an AF of 0 - this is usually the 'default' for (i=0;i<JSH_PIN_COUNT;i++) for (j=0;j<JSH_PININFO_FUNCTIONS;j++) if ((pinInfo[i].functions[j]&JSH_MASK_AF) == JSH_AF0 && (pinInfo[i].functions[j]&JSH_MASK_TYPE) == functionType && (pinInfo[i].functions[j]&JSH_MASK_INFO) == functionInfo) return i; // otherwise just try and find anything for (i=0;i<JSH_PIN_COUNT;i++) for (j=0;j<JSH_PININFO_FUNCTIONS;j++) if ((pinInfo[i].functions[j]&JSH_MASK_TYPE) == functionType && (pinInfo[i].functions[j]&JSH_MASK_INFO) == functionInfo) return i; return PIN_UNDEFINED; } /// Given a full pin function, return a string describing it depending of what's in the flags enum void jshPinFunctionToString(JshPinFunction pinFunc, JshPinFunctionToStringFlags flags, char *buf, size_t bufSize) { const char *devStr = ""; JshPinFunction info = JSH_MASK_INFO & pinFunc; JshPinFunction firstDevice = 0; const char *infoStr = 0; buf[0]=0; if (JSH_PINFUNCTION_IS_USART(pinFunc)) { devStr="USART"; firstDevice=JSH_USART1; if (info==JSH_USART_RX) infoStr="RX"; else if (info==JSH_USART_TX) infoStr="TX"; else if (info==JSH_USART_CK) infoStr="CK"; } else if (JSH_PINFUNCTION_IS_SPI(pinFunc)) { devStr="SPI"; firstDevice=JSH_SPI1; if (info==JSH_SPI_MISO) infoStr="MISO"; else if (info==JSH_SPI_MOSI) infoStr="MOSI"; else if (info==JSH_SPI_SCK) infoStr="SCK"; } else if (JSH_PINFUNCTION_IS_I2C(pinFunc)) { devStr="I2C"; firstDevice=JSH_I2C1; if (info==JSH_I2C_SCL) infoStr="SCL"; else if (info==JSH_I2C_SDA) infoStr="SDA"; } else if (JSH_PINFUNCTION_IS_DAC(pinFunc)) { devStr="DAC"; firstDevice=JSH_DAC; if (info==JSH_DAC_CH1) infoStr="CH1"; else if (info==JSH_DAC_CH2) infoStr="CH2"; } else if (JSH_PINFUNCTION_IS_TIMER(pinFunc)) { devStr="TIM"; firstDevice=JSH_TIMER1; char infoStrBuf[5]; infoStr = &infoStrBuf[0]; infoStrBuf[0] = 'C'; infoStrBuf[1] = 'H'; infoStrBuf[2] = (char)('1' + ((info&JSH_MASK_TIMER_CH)>>JSH_SHIFT_INFO)); if (info & JSH_TIMER_NEGATED) { infoStrBuf[3]='N'; infoStrBuf[4] = 0; } else { infoStrBuf[3] = 0; } } int devIdx = 1 + ((((pinFunc&JSH_MASK_TYPE) - firstDevice) >> JSH_SHIFT_TYPE)); if (!devStr) { jsiConsolePrintf("Couldn't convert pin function %d\n", pinFunc); return; } if (flags & JSPFTS_DEVICE) strncat(buf, devStr, bufSize); if (flags & JSPFTS_DEVICE_NUMBER) itostr(devIdx, &buf[strlen(buf)], 10); if (flags & JSPFTS_SPACE) strncat(buf, " ", bufSize); if (infoStr && (flags & JSPFTS_TYPE)) strncat(buf, infoStr, bufSize); } /** Prints a list of capable pins, eg: jshPrintCapablePins(..., "PWM", JSH_TIMER1, JSH_TIMERMAX, 0,0, false) jshPrintCapablePins(..., "SPI", JSH_SPI1, JSH_SPIMAX, JSH_MASK_INFO,JSH_SPI_SCK, false) jshPrintCapablePins(..., "Analog Input", 0,0,0,0, true) - for analogs */ void NO_INLINE jshPrintCapablePins(Pin existingPin, const char *functionName, JshPinFunction typeMin, JshPinFunction typeMax, JshPinFunction pMask, JshPinFunction pData, bool printAnalogs) { if (functionName) { jsError("Pin %p is not capable of %s\nSuitable pins are:", existingPin, functionName); } Pin pin; int i,n=0; for (pin=0;pin<JSH_PIN_COUNT;pin++) { bool has = false; #ifdef STM32F1 int af = 0; #endif if (printAnalogs) { has = pinInfo[pin].analog!=JSH_ANALOG_NONE; } else { for (i=0;i<JSH_PININFO_FUNCTIONS;i++) { JshPinFunction type = pinInfo[pin].functions[i] & JSH_MASK_TYPE; if (type>=typeMin && type<=typeMax && ((pinInfo[pin].functions[i]&pMask)==pData)) { has = true; #ifdef STM32F1 af = pinInfo[pin].functions[i] & JSH_MASK_AF; #endif } } } if (has) { jsiConsolePrintf("%p",pin); #ifdef STM32F1 if (af!=JSH_AF0) jsiConsolePrint("(AF)"); #endif jsiConsolePrint(" "); if (n++==8) { n=0; jsiConsolePrint("\n"); } } } jsiConsolePrint("\n"); }
vshymanskyy/Espruino
src/jspin.c
C
mpl-2.0
13,871
ο»Ώusing Microsoft.EntityFrameworkCore; using Anabi.DataAccess.Ef.DbModels; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace Anabi.DataAccess.Ef.EntityConfigurators { public class AssetConfig : BaseEntityConfig<AssetDb> { public override void Configure(EntityTypeBuilder<AssetDb> builder) { builder.HasOne(a => a.Address) .WithMany(b => b.Assets) .HasForeignKey(k => k.AddressId) .OnDelete(DeleteBehavior.Restrict) .HasConstraintName("FK_Assets_Addresses"); builder.HasOne(k => k.Category) .WithMany(b => b.Assets) .HasForeignKey(k => k.CategoryId) .OnDelete(DeleteBehavior.Restrict) .HasConstraintName("FK_Assets_Categories") .IsRequired(); builder.HasOne(d => d.CurrentDecision) .WithMany(b => b.Assets) .HasForeignKey(k => k.DecisionId) .OnDelete(DeleteBehavior.Restrict) .HasConstraintName("FK_Assets_Decisions"); base.Configure(builder); } } }
code4romania/anabi-gestiune-api
Anabi.DataAccess.Ef/EntityConfigurators/AssetConfig.cs
C#
mpl-2.0
1,162
import { Mongo } from 'meteor/mongo'; const SurveyCaches = new Mongo.Collection('SurveyCaches'); SimpleSchema.debug = true; SurveyCaches.schema = new SimpleSchema({ title: { type: String, }, version: { type: Number, optional: true, autoValue() { return 2; }, }, createdAt: { type: Date, label: 'Created At', optional: true, autoValue() { let val; if (this.isInsert) { val = new Date(); } else if (this.isUpsert) { val = { $setOnInsert: new Date() }; } else { this.unset(); // Prevent user from supplying their own value } return val; }, }, updatedAt: { type: Date, label: 'Updated At', optional: true, autoValue() { let val; if (this.isUpdate) { val = new Date(); } return val; }, }, }); SurveyCaches.attachSchema(SurveyCaches.schema); export default SurveyCaches;
ctagroup/home-app
imports/api/surveys/surveyCaches.js
JavaScript
mpl-2.0
945
using Alex.Blocks.Materials; namespace Alex.Blocks.Minecraft { public class BlueOrchid : FlowerBase { public BlueOrchid() { Solid = false; Transparent = true; IsFullCube = false; BlockMaterial = Material.Plants; } } }
kennyvv/Alex
src/Alex/Blocks/Minecraft/BlueOrchid.cs
C#
mpl-2.0
241
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* Storage Host Tree */ #storage-tree { min-width: 220px; max-width: 500px; overflow: auto; } #storage-tree { background: var(--theme-sidebar-background); } #storage-tree .tree-widget-item[type="store"]:after { background-image: url(chrome://devtools/skin/images/tool-storage.svg); background-size: 18px 18px; background-position: -1px 0; } /* Columns with date should have a min width so that date is visible */ #expires, #lastAccessed, #creationTime { min-width: 150px; } /* Variables View Sidebar */ #storage-sidebar { max-width: 500px; min-width: 250px; } /* Responsive sidebar */ @media (max-width: 700px) { #storage-tree, #storage-sidebar { max-width: 100%; } #storage-table #path { display: none; } #storage-table .table-widget-cell { min-width: 100px; } }
Yukarumya/Yukarum-Redfoxes
devtools/client/themes/storage.css
CSS
mpl-2.0
1,025
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ export interface TimeZones { name: string; abbrev: string; offset: string; }
OpenEnergyDashboard/OED
src/client/app/types/timezone.ts
TypeScript
mpl-2.0
286
<!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 (version 1.7.0_45) on Fri Dec 27 12:52:52 CST 2013 --> <title>Cassandra.AsyncProcessor.describe_schema_versions (apache-cassandra API)</title> <meta name="date" content="2013-12-27"> <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Cassandra.AsyncProcessor.describe_schema_versions (apache-cassandra API)"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/Cassandra.AsyncProcessor.describe_schema_versions.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.describe_ring.html" title="class in org.apache.cassandra.thrift"><span class="strong">Prev Class</span></a></li> <li><a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.describe_snitch.html" title="class in org.apache.cassandra.thrift"><span class="strong">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?org/apache/cassandra/thrift/Cassandra.AsyncProcessor.describe_schema_versions.html" target="_top">Frames</a></li> <li><a href="Cassandra.AsyncProcessor.describe_schema_versions.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../allclasses-noframe.html">All 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> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method_summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method_detail">Method</a></li> </ul> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <div class="subTitle">org.apache.cassandra.thrift</div> <h2 title="Class Cassandra.AsyncProcessor.describe_schema_versions" class="title">Class Cassandra.AsyncProcessor.describe_schema_versions&lt;I extends <a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncIface.html" title="interface in org.apache.cassandra.thrift">Cassandra.AsyncIface</a>&gt;</h2> </div> <div class="contentContainer"> <ul class="inheritance"> <li>java.lang.Object</li> <li> <ul class="inheritance"> <li>org.apache.thrift.AsyncProcessFunction&lt;I,<a href="../../../../org/apache/cassandra/thrift/Cassandra.describe_schema_versions_args.html" title="class in org.apache.cassandra.thrift">Cassandra.describe_schema_versions_args</a>,java.util.Map&lt;java.lang.String,java.util.List&lt;java.lang.String&gt;&gt;&gt;</li> <li> <ul class="inheritance"> <li>org.apache.cassandra.thrift.Cassandra.AsyncProcessor.describe_schema_versions&lt;I&gt;</li> </ul> </li> </ul> </li> </ul> <div class="description"> <ul class="blockList"> <li class="blockList"> <dl> <dt>Enclosing class:</dt> <dd><a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.html" title="class in org.apache.cassandra.thrift">Cassandra.AsyncProcessor</a>&lt;<a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.html" title="type parameter in Cassandra.AsyncProcessor">I</a> extends <a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncIface.html" title="interface in org.apache.cassandra.thrift">Cassandra.AsyncIface</a>&gt;</dd> </dl> <hr> <br> <pre>public static class <span class="strong">Cassandra.AsyncProcessor.describe_schema_versions&lt;I extends <a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncIface.html" title="interface in org.apache.cassandra.thrift">Cassandra.AsyncIface</a>&gt;</span> extends org.apache.thrift.AsyncProcessFunction&lt;I,<a href="../../../../org/apache/cassandra/thrift/Cassandra.describe_schema_versions_args.html" title="class in org.apache.cassandra.thrift">Cassandra.describe_schema_versions_args</a>,java.util.Map&lt;java.lang.String,java.util.List&lt;java.lang.String&gt;&gt;&gt;</pre> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor_summary"> <!-- --> </a> <h3>Constructor Summary</h3> <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> <caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colOne" scope="col">Constructor and Description</th> </tr> <tr class="altColor"> <td class="colOne"><code><strong><a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.describe_schema_versions.html#Cassandra.AsyncProcessor.describe_schema_versions()">Cassandra.AsyncProcessor.describe_schema_versions</a></strong>()</code>&nbsp;</td> </tr> </table> </li> </ul> <!-- ========== METHOD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="method_summary"> <!-- --> </a> <h3>Method Summary</h3> <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span>Methods</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> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../org/apache/cassandra/thrift/Cassandra.describe_schema_versions_args.html" title="class in org.apache.cassandra.thrift">Cassandra.describe_schema_versions_args</a></code></td> <td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.describe_schema_versions.html#getEmptyArgsInstance()">getEmptyArgsInstance</a></strong>()</code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code>org.apache.thrift.async.AsyncMethodCallback&lt;java.util.Map&lt;java.lang.String,java.util.List&lt;java.lang.String&gt;&gt;&gt;</code></td> <td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.describe_schema_versions.html#getResultHandler(org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer, int)">getResultHandler</a></strong>(org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer&nbsp;fb, int&nbsp;seqid)</code>&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><code>protected boolean</code></td> <td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.describe_schema_versions.html#isOneway()">isOneway</a></strong>()</code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.describe_schema_versions.html#start(I, org.apache.cassandra.thrift.Cassandra.describe_schema_versions_args, org.apache.thrift.async.AsyncMethodCallback)">start</a></strong>(<a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.describe_schema_versions.html" title="type parameter in Cassandra.AsyncProcessor.describe_schema_versions">I</a>&nbsp;iface, <a href="../../../../org/apache/cassandra/thrift/Cassandra.describe_schema_versions_args.html" title="class in org.apache.cassandra.thrift">Cassandra.describe_schema_versions_args</a>&nbsp;args, org.apache.thrift.async.AsyncMethodCallback&lt;java.util.Map&lt;java.lang.String,java.util.List&lt;java.lang.String&gt;&gt;&gt;&nbsp;resultHandler)</code>&nbsp;</td> </tr> </table> <ul class="blockList"> <li class="blockList"><a name="methods_inherited_from_class_org.apache.thrift.AsyncProcessFunction"> <!-- --> </a> <h3>Methods inherited from class&nbsp;org.apache.thrift.AsyncProcessFunction</h3> <code>getMethodName, sendResponse</code></li> </ul> <ul class="blockList"> <li class="blockList"><a name="methods_inherited_from_class_java.lang.Object"> <!-- --> </a> <h3>Methods inherited from class&nbsp;java.lang.Object</h3> <code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li> </ul> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <!-- ========= CONSTRUCTOR DETAIL ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor_detail"> <!-- --> </a> <h3>Constructor Detail</h3> <a name="Cassandra.AsyncProcessor.describe_schema_versions()"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>Cassandra.AsyncProcessor.describe_schema_versions</h4> <pre>public&nbsp;Cassandra.AsyncProcessor.describe_schema_versions()</pre> </li> </ul> </li> </ul> <!-- ============ METHOD DETAIL ========== --> <ul class="blockList"> <li class="blockList"><a name="method_detail"> <!-- --> </a> <h3>Method Detail</h3> <a name="getEmptyArgsInstance()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getEmptyArgsInstance</h4> <pre>public&nbsp;<a href="../../../../org/apache/cassandra/thrift/Cassandra.describe_schema_versions_args.html" title="class in org.apache.cassandra.thrift">Cassandra.describe_schema_versions_args</a>&nbsp;getEmptyArgsInstance()</pre> <dl> <dt><strong>Specified by:</strong></dt> <dd><code>getEmptyArgsInstance</code>&nbsp;in class&nbsp;<code>org.apache.thrift.AsyncProcessFunction&lt;<a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.describe_schema_versions.html" title="type parameter in Cassandra.AsyncProcessor.describe_schema_versions">I</a> extends <a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncIface.html" title="interface in org.apache.cassandra.thrift">Cassandra.AsyncIface</a>,<a href="../../../../org/apache/cassandra/thrift/Cassandra.describe_schema_versions_args.html" title="class in org.apache.cassandra.thrift">Cassandra.describe_schema_versions_args</a>,java.util.Map&lt;java.lang.String,java.util.List&lt;java.lang.String&gt;&gt;&gt;</code></dd> </dl> </li> </ul> <a name="getResultHandler(org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer, int)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getResultHandler</h4> <pre>public&nbsp;org.apache.thrift.async.AsyncMethodCallback&lt;java.util.Map&lt;java.lang.String,java.util.List&lt;java.lang.String&gt;&gt;&gt;&nbsp;getResultHandler(org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer&nbsp;fb, int&nbsp;seqid)</pre> <dl> <dt><strong>Specified by:</strong></dt> <dd><code>getResultHandler</code>&nbsp;in class&nbsp;<code>org.apache.thrift.AsyncProcessFunction&lt;<a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.describe_schema_versions.html" title="type parameter in Cassandra.AsyncProcessor.describe_schema_versions">I</a> extends <a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncIface.html" title="interface in org.apache.cassandra.thrift">Cassandra.AsyncIface</a>,<a href="../../../../org/apache/cassandra/thrift/Cassandra.describe_schema_versions_args.html" title="class in org.apache.cassandra.thrift">Cassandra.describe_schema_versions_args</a>,java.util.Map&lt;java.lang.String,java.util.List&lt;java.lang.String&gt;&gt;&gt;</code></dd> </dl> </li> </ul> <a name="isOneway()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>isOneway</h4> <pre>protected&nbsp;boolean&nbsp;isOneway()</pre> <dl> <dt><strong>Specified by:</strong></dt> <dd><code>isOneway</code>&nbsp;in class&nbsp;<code>org.apache.thrift.AsyncProcessFunction&lt;<a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.describe_schema_versions.html" title="type parameter in Cassandra.AsyncProcessor.describe_schema_versions">I</a> extends <a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncIface.html" title="interface in org.apache.cassandra.thrift">Cassandra.AsyncIface</a>,<a href="../../../../org/apache/cassandra/thrift/Cassandra.describe_schema_versions_args.html" title="class in org.apache.cassandra.thrift">Cassandra.describe_schema_versions_args</a>,java.util.Map&lt;java.lang.String,java.util.List&lt;java.lang.String&gt;&gt;&gt;</code></dd> </dl> </li> </ul> <a name="start(org.apache.cassandra.thrift.Cassandra.AsyncIface,org.apache.cassandra.thrift.Cassandra.describe_schema_versions_args,org.apache.thrift.async.AsyncMethodCallback)"> <!-- --> </a><a name="start(I, org.apache.cassandra.thrift.Cassandra.describe_schema_versions_args, org.apache.thrift.async.AsyncMethodCallback)"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>start</h4> <pre>public&nbsp;void&nbsp;start(<a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.describe_schema_versions.html" title="type parameter in Cassandra.AsyncProcessor.describe_schema_versions">I</a>&nbsp;iface, <a href="../../../../org/apache/cassandra/thrift/Cassandra.describe_schema_versions_args.html" title="class in org.apache.cassandra.thrift">Cassandra.describe_schema_versions_args</a>&nbsp;args, org.apache.thrift.async.AsyncMethodCallback&lt;java.util.Map&lt;java.lang.String,java.util.List&lt;java.lang.String&gt;&gt;&gt;&nbsp;resultHandler) throws org.apache.thrift.TException</pre> <dl> <dt><strong>Specified by:</strong></dt> <dd><code>start</code>&nbsp;in class&nbsp;<code>org.apache.thrift.AsyncProcessFunction&lt;<a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.describe_schema_versions.html" title="type parameter in Cassandra.AsyncProcessor.describe_schema_versions">I</a> extends <a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncIface.html" title="interface in org.apache.cassandra.thrift">Cassandra.AsyncIface</a>,<a href="../../../../org/apache/cassandra/thrift/Cassandra.describe_schema_versions_args.html" title="class in org.apache.cassandra.thrift">Cassandra.describe_schema_versions_args</a>,java.util.Map&lt;java.lang.String,java.util.List&lt;java.lang.String&gt;&gt;&gt;</code></dd> <dt><span class="strong">Throws:</span></dt> <dd><code>org.apache.thrift.TException</code></dd></dl> </li> </ul> </li> </ul> </li> </ul> </div> </div> <!-- ========= END OF CLASS DATA ========= --> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/Cassandra.AsyncProcessor.describe_schema_versions.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.describe_ring.html" title="class in org.apache.cassandra.thrift"><span class="strong">Prev Class</span></a></li> <li><a href="../../../../org/apache/cassandra/thrift/Cassandra.AsyncProcessor.describe_snitch.html" title="class in org.apache.cassandra.thrift"><span class="strong">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?org/apache/cassandra/thrift/Cassandra.AsyncProcessor.describe_schema_versions.html" target="_top">Frames</a></li> <li><a href="Cassandra.AsyncProcessor.describe_schema_versions.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../allclasses-noframe.html">All 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> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method_summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method_detail">Method</a></li> </ul> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright &copy; 2013 The Apache Software Foundation</small></p> </body> </html>
bkcloud/bkplatform
cassandra-scripts/javadoc/org/apache/cassandra/thrift/Cassandra.AsyncProcessor.describe_schema_versions.html
HTML
mpl-2.0
18,166
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html data-context="Build Apps" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/> <title>Leaf Workspace Manager - Legato Docs</title> <meta content="legatoβ„’ is an open source Linux-based embedded platform designed to simplify connected IoT application development" name="description"/> <meta content="legato, iot" name="keywords"/> <meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport"/> <meta content="21.05.0" name="legato-version"/> <link href="resources/images/legato.ico" rel="shortcut icon"/> <link href="resources/images/legato.ico" rel="icon" type="image/x-icon"/> <link href="resources/images/legato.ico" rel="shortcut icon" type="image/x-icon"/> <link href="resources/images/legato.ico" rel="apple-touch-icon" type="image/x-icon"/> <link href="resources/css/style.css" media="screen" rel="stylesheet" type="text/css"/> <link href="resources/css/font-awesome.css" rel="stylesheet" type="text/css"/> <!--[if IE]> <script src="resources/js/html5shiv.js"></script> <script src="resources/js/respond.js"></script> <![endif]--> <script src="https://code.jquery.com/jquery-2.2.3.min.js"></script> <script src="resources/js/main.js"></script> <script src="tocs/Build_Apps_Get_Started.json"></script> </head> <body> <noscript> <input class="modal-closing-trick" id="modal-closing-trick" type="checkbox"/> <div id="nojs"> <label for="modal-closing-trick"> <span>You seem to not have Javascript <a href="http://enable-javascript.com">enabled</a>, so site functionality like the search and navigation tree won't work.</span> </label> </div> </noscript> <div class="wrapper"> <div class="fa fa-bars documentation" id="menu-trigger"></div> <div id="top"> <header> <nav> <a class="navlink" href="/">Introduction</a><a class="navlink selected" href="buildAppsMain.html">Build Apps</a><a class="navlink" href="buildPlatformMain.html">Build Platform</a><a class="navlink" href="aboutMain.html">About</a> </nav> </header> </div> <div class="white" id="menudocumentation"> <header> <a href="/"> <img alt="Back to Legato Homepage" id="logo" src="resources/images/legato_logo.png"/></a> <h2>/ Build Apps</h2> <nav class="secondary"> <a class="link-selected" href="getStarted.html">Get Started</a><a href="concepts.html">Concepts</a><a href="apiGuidesMain.html">API Guides</a><a href="tools.html">Tools</a><a href="howToMain.html">How To</a><a href="experimentalMain.html">Experimental Features</a><a href="migrationGuide.html">Linux 4.14 Migration Guide</a> </nav> <nav class="ui-front"> <i class="fa fa-search" id="search-icon"></i> <input id="searchbox" placeholder="Search"/> </nav> </header> </div> <div id="resizable"> <div id="left"> <div id="tree1"></div> </div> </div> <div class="content"> <div class="header"> <div class="headertitle"> <h1 class="title">Leaf Workspace Manager </h1> </div> </div><div class="contents"> <div class="textblock"><p>Leaf is a workspace manager that will download, install and configure the required software packages for a Legato development environment.</p> <p>This tutorial will walk you through how to:</p><ul> <li>Install Leaf</li> <li>Set up a remote to point to a package repository</li> <li>Search for a package to install</li> <li>Set up your development environment</li> <li>Use the built in shell to access the development tools</li> <li>Set up your workspace to start development</li> </ul> <p>The basic workflow that should be followed to download and set up a development environment for your target. These tutorials use the packages that have been created for the Legato project as examples.</p> <h1><a class="anchor" id="confLeafInstall"></a> Install Leaf</h1> <p>Leaf is hosted in the Sierra Wireless debian tools repository, and is provided as a <code></code>.deb package to be installed through <code>apt</code>. We have also provided <a class="el" href="confLeaf_Install.html">alternative install instructions</a> for older Ubuntu Distributions (14.04 and below) and instructions for manually installing from a tarball.</p> <p>Install leaf download and set up our debian package from the Sierra Wireless tools repository: </p><pre class="fragment">$ wget https://downloads.sierrawireless.com/tools/leaf/leaf_latest.deb -O /tmp/leaf_latest.deb &amp;&amp; sudo apt install /tmp/leaf_latest.deb </pre><p>Leaf installs tools, images and packages into the <code>~/</code>.leaf/ directory; all configuration is stored in <code>~/</code>.config/leaf/</p> <p>Before searching and installing your first SDK it is recommended to make a separate leaf workspace directory to store all of your custom Legato development. For this site and tutorials we will be setting up the leaf workspace in <code>$HOME/myWorkspace</code>.</p> <pre class="fragment">$ mkdir ~/myWorkspace; cd ~/myWorkspace </pre><h1><a class="anchor" id="confLeafsearch"></a> Search for Packages</h1> <p>Now that you have leaf installed, you can now search through a repository to find the packages to download, install and configure your Development Environment.</p> <dl class="section warning"><dt>Warning</dt><dd>You are able to search leaf from anywhere on your computer; running <code>leaf</code> <code>setup</code> will add config in the directory that you are currently in. It is recommended to create a workspace dir and set up leaf packages from within your workspace.</dd></dl> <p><b>leaf</b> <b>search</b> </p> <p>Using <code>leaf</code> <code>search</code> with no filters will list every package in any repository that you have enabled (it may be a huge list). It is better to search with filters that return a smaller list that is specific for your target.</p> <h2><a class="anchor" id="confLeafsearchTarget"></a> Search for a Target</h2> <pre class="fragment">$ leaf search -t &lt;target&gt; (i.e.; leaf search -t wp76xx will bring back all packages for the wp76 target) </pre><p>The search results will return a package identifier (the package name of the package to install), a high level description of what is in the package, and the tags of the package. You are also able to search filter the search results by tag using the -t flag. </p><pre class="fragment">$ leaf search -t latest (returns all the newest/latest published packages for all targets) $ leaf search -t wp76xx -t latest (returns the latest packages for the wp76 target) </pre><p>To see exactly what is contained in the package perform a search with a <code>-v</code> flag (verbose). This will list the details of what each package contains including the release date and the list of versions of all sub-packages listed as dependencies. </p><pre class="fragment">$ leaf search -t wp76xx -t latest -v (returns the details of the latest package for the wp76 target) </pre><p>For details on each of the components of the package visit the vendors page. Firmware Details (including Yocto distribution, toolchain and firmware): <a href="https://source.sierrawireless.com">source.sierrawireless.com</a> Legato Details: <a href="https://legato.io/releases">Releases</a></p> <h1><a class="anchor" id="confLeafSetup"></a> Set up Development Environment</h1> <p>Now that you know which package that you want to install on your development machine, the next step is to run <code>leaf</code> <code>setup</code>. The <code>setup</code> command will prepare your directory as a workspace and download, install and configure your workspace with a profile (settings specific to your target and version) preparing you to start developing for your target.</p> <pre class="fragment">$ leaf setup &lt;profile name&gt; -p &lt;package identifier&gt; $ leaf setup wp76stable -p swi-wp76_1.0.0 (downloads and installs the swi-wp76_1.0.0 package in the wp76stable profile) </pre><dl class="section note"><dt>Note</dt><dd>Downloading and installing the package may take a few minutes. Leaf configures everything that is needed for you to start developing for your target including the toolchain, Legato application framework and other development tools. It will also take care of installing any apt dependencies. The apt dependencies will require sudo and you will be prompted for your password for sudo privileges.</dd></dl> <p>After installation a new directory (<code>leaf-data</code>) and a new configuration file (<code>leaf-workspace.json</code>) will be created in your workspace directory. The directory contains symbolic links to all the resources needed for development and the leaf tools know how to find the resources for development.</p> <p>You will now be able to use leaf commands to view your environment and use the resources that you just downloaded and installed. For detailed help on the leaf sub-commands see <a class="el" href="toolsLeaf.html">Leaf</a>. </p><pre class="fragment">$ leaf status - displays the profile list and information about the profiles $ leaf select - lets you select different profiles (if you have more then one installed) $ leaf profile delete &lt;profile name&gt; $ leaf profile rename &lt;old name&gt; &lt;new name&gt; - renames your profile </pre><h1><a class="anchor" id="confLeafSetup2nd"></a> Set up a 2nd Profile</h1> <p>To set up a second profile (if you wish to use multiple targets, or multiple versions) run the <code>leaf</code> <code>setup</code> command again and choose a new profile name. </p><pre class="fragment">$ leaf setup &lt;2nd profile&gt; -p &lt;2nd package identifier&gt; $ leaf setup wp76dev -p swi-wp76_1.0.0 </pre><p>To see the two profiles set up use <code>leaf</code> <code>status</code> and <code>leaf</code> <code>select</code> to switch between profiles. </p><pre class="fragment">$ leaf status $ leaf select &lt;profile name&gt;. </pre><h1><a class="anchor" id="confLeafShell"></a> Leaf Shell</h1> <p><code>leaf</code> <code>shell</code> provides an interactive shell that is <b>profile</b> aware to run all of your tools for your development environment. If you need to switch to a different profile (different target or version of software) the shell environment will update all environment variables to point to the version that matches the profile that you are working with.</p> <dl class="section warning"><dt>Warning</dt><dd><code>shell</code> is $PWD dependant; if you switch to another directory outside of your workspace you will lose your <code>leaf</code> environment variables, and it will not be profile aware (automatically switch to the toolchain and tools that match the profile you are using).</dd></dl> <p>i.e.; Using <code>mksys</code> from within the leaf shell will use the version of the tool that is configured for that specific profile and will also build a Legato System with the correct toolchain. If you switch profiles and run <code>mksys</code> again it will use the version configured with the second profile and use the toolchain configured for the second profile environment.</p> <h1><a class="anchor" id="confLeafWorkspace"></a> Set up Workspace</h1> <p>Now that you have all your development environment set up and configured you are now able to start development.</p> <p>All leaf packages are downloaded to <code>$HOME/</code>.leaf by default (see <code>leaf</code> <code>config</code> to <code>update</code>) and are used as references to be included in to your workspace via environment variables.</p> <p>Any new environment variables that you would like added to your development environment can be added with <code>leaf</code> <code>env</code>. See <code>leaf</code> <code>help</code> <code>env</code> for details on adding new environment variables to either a profile or a workspace. </p><pre class="fragment">$ leaf env profile --set MYVAR=1 (sets the environment variable MYVAR to 1 for the current profile) </pre><h1><a class="anchor" id="confLeafDevelopment"></a> Legato Development</h1> <p>Leaf enables a new style of Legato development that allows you to create your component, apps and systems in your own workspace instead of working directly in the Legato directory. This will keep your custom code separate and still allow a full build of Legato Systems. Any changes that you do make directly to the Legato Application Framework will be reflected in your system when you run <code>mksys</code> from within the leaf shell in your workspace.</p> <p>If you do wish to use the Git tracked source code for Legato you are able to check-out the source code for Legato. This version requires you to have an account on GitHub. Use the command <a class="el" href="confLeafSrc.html">leaf getsrc legato</a> to checkout the version of Legato that matches your profile.</p> <h2><a class="anchor" id="confLeafDevelopmentLegato"></a> Legato Workflow Changes</h2> <ul> <li>The version of Legato that you install is pre-built for your module, meaning that there is no need to run make, or set-up the toolchain and other configuration tasks.</li> <li>You do not need to run <code>bin/legs</code> or source <code>bin/configlegatoenv</code> in your bash.rc file. The leaf shell makes sure that all environment variables are set up and are aware of the specific version of Legato that you are using within each profile.</li> <li>Do not add your apps and settings to default.sdef you are now able to <code>#include</code> <code>default.sdef</code> in an sdef in your workspace and build not only your settings but all the default legato apps and configuration.</li> </ul> <dl class="section note"><dt>Note</dt><dd>Because you are now working with a pre-built version of Legato, any changes that you do make to the Legato Application Framework are not tracked, if you wish to modify the framework and build from source code see <code>leaf</code> <code>help</code> <code>legato-source</code> to download and connect tracked Legato source code.</dd></dl> <h2><a class="anchor" id="confLeafDevelopmentSDEF"></a> Set-up SDEF</h2> <p>Using your own <code></code>.sdef file is easy to set up and maintain. Using this method leaves all the Legato configuration in <code>default.sdef</code> and allows you to quickly see and work with your customization to your Legato System.</p> <p>Create a new <code></code>.sdef file in your leaf workspace: </p><pre class="fragment">$ vim mySystem.sdef (or the editor of your choice) </pre><p>In <code>mySystem.sdef</code> use the following line to include all the default Legato settings: </p><pre class="fragment">#include $LEGATO_ROOT/default.sdef </pre><p>You are also able to include any other <code></code>.sdef files you wish using the same method.</p> <p>A couple of very useful environment variables that are set up in Legato:</p><ul> <li><code>$LEGATO_ROOT</code> - resolves to the location of the Legato Application Framework for your profile</li> <li><code>$CURDIR</code> - resolves to the directory where you run the mktools from (i.e.; add <code>$CURDIR/path/to/your/app</code> to the apps section of your .sdef and then run mksys from your workspace directory to build your apps into the update file)</li> </ul> <p>To build your system you no longer need to re-make the build. Run <code>mksys</code> and point it at your <code></code>.sdef. To build a Legato System using your custom sdef run: </p><pre class="fragment">$ mksys -t $LEGATO_TARGET &lt;sdef&gt; (i.e.; mksys -t wp76xx mySystem.sdef from your leaf workspace directory) </pre><h2><a class="anchor" id="confLeafDevelopmentWorkspace"></a> Workspace Layout</h2> <p>Because you are not working directly in the Legato directory anymore, we recommend setting up a directory structure that will be easy to use and organize your apps, kernel modules and other settings for the Legato Application Framework. Remember to use <code>$CURDIR</code> to reference the workspace folder in your .sdef.</p> <p>Example directory structure using the helloWorld app: </p><pre class="fragment"> . β”œβ”€β”€ apps β”‚Β Β  └── helloWorld β”‚Β Β  β”œβ”€β”€ CMakeLists.txt β”‚Β Β  β”œβ”€β”€ helloComponent β”‚Β Β  β”‚Β Β  β”œβ”€β”€ Component.cdef β”‚Β Β  β”‚Β Β  └── helloWorld.c β”‚Β Β  └── helloWorld.adef β”œβ”€β”€ components | └── ... (a directory for each component) β”œβ”€β”€ drivers | └── ... (a directory for each kernel module) β”œβ”€β”€ interfaces | └── ... (all apis that your apps export) β”œβ”€β”€ leaf-data β”‚Β Β  └── ... (leaf symbolic links, do not edit) β”œβ”€β”€ leaf-workspace.json └── mySystem.sdef </pre><p>This is just an example of how you could set up your directory structure, it is up to you and how you connect all of your components, apps and system in your workspace. Working out of the workspace directory lets you easily work with different profiles and switch to a new profile (target and/or version of Legato) and continue to use your same components, apps and/or system to build for your target devices.</p> <h2><a class="anchor" id="confLeafWorkflows"></a> Workflows</h2> <p>The Leaf workflow design includes a hierarchy and is set up with the first install of a leaf package:</p><ul> <li>USER (universal config for all workspace and profiles)</li> <li>WORKSPACE (the working directory for your code and your customization)</li> <li>PROFILE (target/version specific configuration and settings)</li> </ul> <p>See <a class="el" href="confLeafWS.html">leaf help legato-workflow</a> for more details on the relationship between profiles, workspaces and users.</p> <p class="copyright">Copyright (C) Sierra Wireless Inc. </p> </div></div> <br clear="left"/> </div> </div> <link href="resources/css/jqtree.css" rel="stylesheet" type="text/css"/> <script src="resources/js/tree.jquery.js" type="text/javascript"></script> <script src="resources/js/jquery.cookie.js"></script> <script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script> <link href="resources/css/perfect-scrollbar.min.css" rel="stylesheet"/> <script src="resources/js/perfect-scrollbar.jquery.min.js"></script> </body> </html>
legatoproject/legato-docs
21_05/confLeaf.html
HTML
mpl-2.0
18,099
package aws import ( "fmt" "testing" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" ) func TestAccDataSourceAWSLambdaLayerVersion_basic(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") dataSourceName := "data.aws_lambda_layer_version.test" resourceName := "aws_lambda_layer_version.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSLambdaLayerVersionConfigBasic(rName), Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, "layer_name", resourceName, "layer_name"), resource.TestCheckResourceAttrPair(dataSourceName, "version", resourceName, "version"), resource.TestCheckResourceAttrPair(dataSourceName, "compatible_runtimes.%", resourceName, "compatible_runtimes.%s"), resource.TestCheckResourceAttrPair(dataSourceName, "description", resourceName, "description"), resource.TestCheckResourceAttrPair(dataSourceName, "license_info", resourceName, "license_info"), resource.TestCheckResourceAttrPair(dataSourceName, "arn", resourceName, "arn"), resource.TestCheckResourceAttrPair(dataSourceName, "layer_arn", resourceName, "layer_arn"), resource.TestCheckResourceAttrPair(dataSourceName, "created_date", resourceName, "created_date"), resource.TestCheckResourceAttrPair(dataSourceName, "source_code_hash", resourceName, "source_code_hash"), resource.TestCheckResourceAttrPair(dataSourceName, "source_code_size", resourceName, "source_code_size"), ), }, }, }) } func TestAccDataSourceAWSLambdaLayerVersion_version(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") dataSourceName := "data.aws_lambda_layer_version.test" resourceName := "aws_lambda_layer_version.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSLambdaLayerVersionConfigVersion(rName), Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, "layer_name", resourceName, "layer_name"), resource.TestCheckResourceAttrPair(dataSourceName, "version", resourceName, "version"), ), }, }, }) } func TestAccDataSourceAWSLambdaLayerVersion_runtime(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") dataSourceName := "data.aws_lambda_layer_version.test" resourceName := "aws_lambda_layer_version.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSLambdaLayerVersionConfigRuntimes(rName), Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, "layer_name", resourceName, "layer_name"), resource.TestCheckResourceAttrPair(dataSourceName, "version", resourceName, "version"), ), }, }, }) } func testAccDataSourceAWSLambdaLayerVersionConfigBasic(rName string) string { return fmt.Sprintf(` resource "aws_lambda_layer_version" "test" { filename = "test-fixtures/lambdatest.zip" layer_name = %[1]q compatible_runtimes = ["nodejs8.10"] } data "aws_lambda_layer_version" "test" { layer_name = "${aws_lambda_layer_version.test.layer_name}" } `, rName) } func testAccDataSourceAWSLambdaLayerVersionConfigVersion(rName string) string { return fmt.Sprintf(` resource "aws_lambda_layer_version" "test" { filename = "test-fixtures/lambdatest.zip" layer_name = %[1]q compatible_runtimes = ["nodejs8.10"] } resource "aws_lambda_layer_version" "test_two" { filename = "test-fixtures/lambdatest_modified.zip" layer_name = %[1]q compatible_runtimes = ["nodejs8.10"] } data "aws_lambda_layer_version" "test" { layer_name = "${aws_lambda_layer_version.test_two.layer_name}" version = "${aws_lambda_layer_version.test.version}" } `, rName) } func testAccDataSourceAWSLambdaLayerVersionConfigRuntimes(rName string) string { return fmt.Sprintf(` resource "aws_lambda_layer_version" "test" { filename = "test-fixtures/lambdatest.zip" layer_name = %[1]q compatible_runtimes = ["go1.x"] } resource "aws_lambda_layer_version" "test_two" { filename = "test-fixtures/lambdatest_modified.zip" layer_name = "${aws_lambda_layer_version.test.layer_name}" compatible_runtimes = ["nodejs8.10"] } data "aws_lambda_layer_version" "test" { layer_name = "${aws_lambda_layer_version.test_two.layer_name}" compatible_runtime = "go1.x" } `, rName) }
Ninir/terraform-provider-aws
aws/data_source_aws_lambda_layer_version_test.go
GO
mpl-2.0
4,811