code
stringlengths
3
1.01M
repo_name
stringlengths
5
116
path
stringlengths
3
311
language
stringclasses
30 values
license
stringclasses
15 values
size
int64
3
1.01M
# flake8: noqa # -*- coding: utf-8 -*- ############################################### # Geosite local settings ############################################### import os # Outside URL SITEURL = 'http://$DOMAIN' OGC_SERVER['default']['LOCATION'] = os.path.join(GEOSERVER_URL, 'geoserver/') OGC_SERVER['default']['PUBLIC_LOCATION'] = os.path.join(SITEURL, 'geoserver/') # databases unique to site if not defined in site settings """ SITE_DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(PROJECT_ROOT, '../development.db'), }, } """
simonemurzilli/geonode
geonode/contrib/geosites/site_template/local_settings_template.py
Python
gpl-3.0
597
%This section should contain a little about everything. Introduction should be an overview of the contents of your thesis. The introduction should contain: \section*{Introduction} \label{sec:introduction} \markboth{INTRODUCTION}{} \addcontentsline{toc}{section}{Introduction} % 1) Information/introduction about the topic of your research (e.g. what you will talk about in your thesis – Compilers, CPUs, optimizations etc.) % 2) The practical and theoretical value of the topic (how and why this topic is important) The field of artificial neural networks (ANN) gets lots of attention nowadays. ANNs are interesting for both psychologists and computer scientists. For psychologists they provide a simulation environment of the human brain which could be used to prove their hypotheses. For computer scientists ANNs are a general model which could be used to solve a broad range of practical problems. % ==================== 10. Motivation (or Problem Definition and Proposed Solution) ===== % In this chapter you have to concisely explain the problem that you want to solve and the goal of your solution. % 3) The motivation for your thesis (State with at least one sentence the problem you attack in your research work, why did you choose this problem and how it is interesting. State with at least one sentence your solution for the problem). % 4) If you are basing your work on currently existing work, mention it here. % ==================== 10. Motivation (or tProblem Definition and Proposed Solution) ===== %In this chapter you have to concisely explain the problem that you want to solve and the goal of your solution. This part should contain: % 1) Detailed analysis of the problem and its limitations (e.g. what is the bottleneck and difficulties). %\subsection*{Motivation} \label{sec:motivation} % 1) Detailed analysis of the problem and its limitations (e.g. what is the bottleneck and difficulties). We choose to analyse the Bidirectional Activation-based Learning algorithm (BAL) recently introduced by~\citet{farkas2013bal}. The main reasons why we have chosen BAL over standard models are its simplicity, \emph{bidirectionality} and \emph{biological plausibility}. The term biological plausibility is stated by six principles by~\citet{hinton1988learning}. One of these principles is the \emph{bidirectional activation propagation} is achieved in BAL by using backward representations for learning the forward representations and vice versa. % motivation.3) You should clearly state and explain your goal and objectives. You should provide analytical study (mathematical model) of your solution (What is the upper and lower bound of your performance or improvements). You should also mention about the qualitative benefit of your solution such as easy programming etc.. % 5) Mention the limitations of your solution (design and implementation – e.g. applies for real time systems, has error factor 25%) % 6) Include information about your key results – e.g. we improve the performance with 70% in the general keys. %\subsection*{Goals and Results} Although BAL performs well on high dimensional tasks, it has problems to learn low dimensional tasks with 100\% reliability, while BP is able to learn them. Therefore, our primary goal was to find reasons for this performance gap and use them to derive a modification of BAL which will perform comparably to BP. In our work, we were able to follow this process and find reasons which were then used for deriving the Two learning rate model (TLR). TLR uses different learning rates for different weight matrices and shows some counter intuitive behaviour. It performs comparable to BP if it is initialized correctly. % 7) Finish the chapter with an overview about the contents of your thesis.la, ktory temu trocha chape, zavedenie zakladnej notacie %\subsection*{Overview of contents} Our work starts with an overview of ANNs in Chapter~\ref{sec:overview} which consists of necessary preliminaries and related models. In Chapter~\ref{sec:simulations} we describe our simulations, experiments and datasets used through our work. We finish our work with Chapter~\ref{sec:results} which contains simulation results aimed at TLR, which proved to be the most successful modification of BAL. Finally we conclude our results and outline future experiments in Section~\ref{sec:conclusion}. %\begin{itemize} %\item co je problem %\item preco zaujimave, %\item co je zname, %\item my sme urobili toto %\end{itemize}
Petrzlen/master_thesis
text/introduction.tex
TeX
gpl-3.0
4,520
package br.com.simpleblog.util; import java.io.File; import java.io.FileFilter; import java.util.HashMap; import java.util.Map; import javax.servlet.ServletContext; public class ContainerBlog { private Map<String, Blog> blogMap; public ContainerBlog(ServletContext context) { this.blogMap = new HashMap<String, Blog>(); String realPath = context.getRealPath("/"); File file = new File(realPath); File[] blogArray = file.listFiles(new FileFilter() { @Override public boolean accept(File file) { return file.isDirectory() && !file.getName().equals("META-INF") && !file.getName().equals("WEB-INF") && !file.getName().equals("default"); } }); for (File blog : blogArray) { this.blogMap.put(blog.getName(), new Blog(blog.getName())); } } public Blog get(String name) { return this.blogMap.get(name); } }
cristovao/simpleblog
impl/src/br/com/simpleblog/util/ContainerBlog.java
Java
gpl-3.0
860
package com.mdsgpp.cidadedemocratica.persistence; import android.test.AndroidTestCase; import com.mdsgpp.cidadedemocratica.model.Proposal; import com.mdsgpp.cidadedemocratica.model.Tag; import com.mdsgpp.cidadedemocratica.model.User; import org.junit.Test; import java.util.ArrayList; /** * Created by andreanmasiro on 9/13/16. */ public class DataContainerTest extends AndroidTestCase { protected DataContainer dataContainer; @Override protected void setUp() { this.dataContainer = DataContainer.getInstance(); } @Test public void testAddTag() { Tag tag = newTag(); dataContainer.addTag(tag); assertTrue(DataContainer.getInstance().getTags().contains(tag)); ArrayList<Tag> tags = new ArrayList<Tag>(); for (int i = 0; i < 10; i++) { Tag tagn = newTag(); tags.add(tagn); } dataContainer.addTags(tags); assertTrue(DataContainer.getInstance().getTags().containsAll(tags)); } @Test public void testAddProposal() { Proposal proposal = newProposal(); dataContainer.addProposal(proposal); assertTrue(DataContainer.getInstance().getProposals().contains(proposal)); ArrayList<Proposal> proposals = new ArrayList<Proposal>(); for (int i = 0; i < 10; i++) { Proposal propn = newProposal(); proposals.add(propn); } dataContainer.addProposals(proposals); assertTrue(DataContainer.getInstance().getProposals().containsAll(proposals)); } @Test public void testAddUser() { User user = newUser(); dataContainer.addUser(user); assertTrue(DataContainer.getInstance().getUsers().contains(user)); ArrayList<User> users = new ArrayList<User>(); for (int i = 0; i < 10; i++) { User usern = newUser(); users.add(usern); } dataContainer.addUsers(users); assertTrue(DataContainer.getInstance().getUsers().containsAll(users)); } @Test public void testSetTags() { ArrayList<Tag> tags = new ArrayList<Tag>(); tags.add(newTag()); tags.add(newTag()); tags.add(newTag()); dataContainer.setTags(tags); assertEquals(tags, dataContainer.getTags()); } @Test public void testSetProposals() { ArrayList<Proposal> proposals = new ArrayList<Proposal>(); proposals.add(newProposal()); proposals.add(newProposal()); proposals.add(newProposal()); dataContainer.setProposals(proposals); assertEquals(proposals, dataContainer.getProposals()); } @Test public void testSetUsers() { ArrayList<User> users = new ArrayList<User>(); users.add(newUser()); users.add(newUser()); users.add(newUser()); dataContainer.setUsers(users); assertEquals(users, dataContainer.getUsers()); } @Test public void testClearTags() { ArrayList<Tag> tags = new ArrayList<Tag>(); tags.add(newTag()); tags.add(newTag()); tags.add(newTag()); dataContainer.setTags(tags); assertEquals(tags, dataContainer.getTags()); dataContainer.clearTags(); assertEquals(dataContainer.getTags().size(), 0); } @Test public void testClearProposals() { ArrayList<Proposal> proposals = new ArrayList<Proposal>(); proposals.add(newProposal()); proposals.add(newProposal()); proposals.add(newProposal()); dataContainer.setProposals(proposals); assertEquals(proposals, dataContainer.getProposals()); dataContainer.clearProposals(); assertEquals(dataContainer.getProposals().size(), 0); } @Test public void testClearUsers() { ArrayList<User> users = new ArrayList<User>(); users.add(newUser()); users.add(newUser()); users.add(newUser()); dataContainer.setUsers(users); assertEquals(users, dataContainer.getUsers()); dataContainer.clearUsers(); assertEquals(dataContainer.getUsers().size(), 0); } @Test public void testGetTagForId() { this.dataContainer.addTag(newTag(1)); this.dataContainer.addTag(newTag(2)); this.dataContainer.addTag(newTag(3)); this.dataContainer.addTag(newTag(4)); assertNull(this.dataContainer.getTagForId(99)); this.dataContainer.addTag(newTag(99)); assertNotNull(this.dataContainer.getTagForId(99)); } public void testGetProposalForId() { this.dataContainer.addProposal(newProposal(1)); this.dataContainer.addProposal(newProposal(2)); this.dataContainer.addProposal(newProposal(3)); this.dataContainer.addProposal(newProposal(4)); assertNull(this.dataContainer.getProposalForId(100)); this.dataContainer.addProposal(newProposal(100)); assertNotNull(this.dataContainer.getProposalForId(100)); } public void testGetUserForId() { this.dataContainer.addUser(newUser(1)); this.dataContainer.addUser(newUser(2)); this.dataContainer.addUser(newUser(3)); this.dataContainer.addUser(newUser(4)); this.dataContainer.addUser(newUser(5)); assertNull(this.dataContainer.getUserForId(100)); this.dataContainer.addUser(newUser(100)); assertNotNull(this.dataContainer.getUserForId(100)); } private Tag newTag() { return new Tag(0, "name", 0, 0); } private Tag newTag(long id) { return new Tag(id, "name", 0, 0); } private Proposal newProposal() { return new Proposal(0, "title", "content", 0, 0); } private Proposal newProposal(long id) { return new Proposal(id, "title", "content", 0,0); } private User newUser() { return new User("Name", 0, 0 ,0); } private User newUser(long id) { return new User("Name", 0, id, 0); } }
GPP-MDS-2016/2016.2-Time08-CidadeDemocratica
app/src/test/java/com/mdsgpp/cidadedemocratica/persistence/DataContainerTest.java
Java
gpl-3.0
6,053
#include <stdio.h> void sayHelloTo( char who[] ) { printf( "Hello, %s!", who ); }
YoshikuniJujo/hake_haskell
web_page/samples/use_delRules/sayHelloTo.c
C
gpl-3.0
86
<?php /** * PHPUnit * * Copyright (c) 2002-2009, Sebastian Bergmann <sb@sebastian-bergmann.de>. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of Sebastian Bergmann nor the names of his * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * @category Testing * @package PHPUnit * @author Sebastian Bergmann <sb@sebastian-bergmann.de> * @copyright 2002-2009 Sebastian Bergmann <sb@sebastian-bergmann.de> * @license http://www.opensource.org/licenses/bsd-license.php BSD License * @version SVN: $Id: ExcessiveParameterList.php 4403 2008-12-31 09:26:51Z sb $ * @link http://www.phpunit.de/ * @since File available since Release 3.2.0 */ require_once 'PHPUnit/Util/Log/PMD/Rule/Function.php'; require_once 'PHPUnit/Util/Filter.php'; PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT'); /** * * * @category Testing * @package PHPUnit * @author Sebastian Bergmann <sb@sebastian-bergmann.de> * @copyright 2002-2009 Sebastian Bergmann <sb@sebastian-bergmann.de> * @license http://www.opensource.org/licenses/bsd-license.php BSD License * @version Release: 3.4.0beta1 * @link http://www.phpunit.de/ * @since Class available since Release 3.2.0 */ class PHPUnit_Util_Log_PMD_Rule_Function_ExcessiveParameterList extends PHPUnit_Util_Log_PMD_Rule_Function { public function __construct($threshold = 10, $priority = 1) { parent::__construct($threshold, $priority); } public function apply(PHPUnit_Util_Metrics $metrics) { $parameters = $metrics->getParameters(); if ($parameters >= $this->threshold) { return sprintf( "Function or method has %d parameters.\n" . 'Long parameter lists can indicate that a new object should be ' . 'created to wrap the numerous parameters. Basically, try to '. 'group the parameters together.', $parameters ); } } } ?>
manusis/dblite
test/lib/phpunit/PHPUnit/Util/Log/PMD/Rule/Function/ExcessiveParameterList.php
PHP
gpl-3.0
3,483
//////////////////////////////////////////////////////////////////////////////////////////////////// // PlotSquared - A plot manager and world generator for the Bukkit API / // Copyright (c) 2014 IntellectualSites/IntellectualCrafters / // / // 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, write to the Free Software Foundation, / // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA / // / // You can contact us via: support@intellectualsites.com / //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotArea; import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MathMan; import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.WorldUtil; import com.plotsquared.general.commands.CommandDeclaration; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; @CommandDeclaration(command = "condense", permission = "plots.admin", description = "Condense a plotworld", category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.CONSOLE) public class Condense extends SubCommand { public static boolean TASK = false; @Override public boolean onCommand(final PlotPlayer plr, final String... args) { if ((args.length != 2) && (args.length != 3)) { MainUtil.sendMessage(plr, "/plot condense <area> <start|stop|info> [radius]"); return false; } PlotArea area = PS.get().getPlotAreaByString(args[0]); if (area == null || !WorldUtil.IMP.isWorld(area.worldname)) { MainUtil.sendMessage(plr, "INVALID AREA"); return false; } switch (args[1].toLowerCase()) { case "start": { if (args.length == 2) { MainUtil.sendMessage(plr, "/plot condense " + area.toString() + " start <radius>"); return false; } if (TASK) { MainUtil.sendMessage(plr, "TASK ALREADY STARTED"); return false; } if (args.length == 2) { MainUtil.sendMessage(plr, "/plot condense " + area.toString() + " start <radius>"); return false; } if (!MathMan.isInteger(args[2])) { MainUtil.sendMessage(plr, "INVALID RADIUS"); return false; } final int radius = Integer.parseInt(args[2]); ArrayList<Plot> plots = new ArrayList<>(PS.get().getPlots(area)); // remove non base plots Iterator<Plot> iter = plots.iterator(); int maxSize = 0; ArrayList<Integer> sizes = new ArrayList<>(); while (iter.hasNext()) { Plot plot = iter.next(); if (!plot.isBasePlot()) { iter.remove(); continue; } int size = plot.getConnectedPlots().size(); if (size > maxSize) { maxSize = size; } sizes.add(size - 1); } // Sort plots by size (buckets?)] ArrayList<Plot>[] buckets = new ArrayList[maxSize]; for (int i = 0; i < plots.size(); i++) { Plot plot = plots.get(i); int size = sizes.get(i); ArrayList<Plot> array = buckets[size]; if (array == null) { array = new ArrayList<Plot>(); buckets[size] = array; } array.add(plot); } final ArrayList<Plot> allPlots = new ArrayList<Plot>(plots.size()); for (int i = buckets.length - 1; i >= 0; i--) { ArrayList<Plot> array = buckets[i]; if (array != null) { allPlots.addAll(array); } } final int size = allPlots.size(); final int minimum_radius = (int) Math.ceil((Math.sqrt(size) / 2) + 1); if (radius < minimum_radius) { MainUtil.sendMessage(plr, "RADIUS TOO SMALL"); return false; } final List<PlotId> to_move = new ArrayList<>(getPlots(allPlots, radius)); final List<PlotId> free = new ArrayList<>(); PlotId start = new PlotId(0, 0); while ((start.x <= minimum_radius) && (start.y <= minimum_radius)) { Plot plot = area.getPlotAbs(start); if (plot != null && !plot.hasOwner()) { free.add(plot.getId()); } start = Auto.getNextPlotId(start, 1); } if ((free.isEmpty()) || (to_move.isEmpty())) { MainUtil.sendMessage(plr, "NO FREE PLOTS FOUND"); return false; } MainUtil.sendMessage(plr, "TASK STARTED..."); Runnable run = new Runnable() { @Override public void run() { if (!TASK) { MainUtil.sendMessage(plr, "TASK CANCELLED."); } if (allPlots.isEmpty()) { TASK = false; MainUtil.sendMessage(plr, "TASK COMPLETE. PLEASE VERIFY THAT NO NEW PLOTS HAVE BEEN CLAIMED DURING TASK."); return; } final Runnable task = this; final Plot origin = allPlots.remove(0); int i = 0; while (free.size() > i) { final Plot possible = origin.getArea().getPlotAbs(free.get(i)); if (possible.hasOwner()) { free.remove(i); continue; } i++; final AtomicBoolean result = new AtomicBoolean(false); result.set(origin.move(possible, new Runnable() { @Override public void run() { if (result.get()) { MainUtil.sendMessage(plr, "Moving: " + origin + " -> " + possible); TaskManager.runTaskLater(task, 1); } } }, false)); if (result.get()) { break; } } if (free.isEmpty()) { TASK = false; MainUtil.sendMessage(plr, "TASK FAILED. NO FREE PLOTS FOUND!"); return; } if (i >= free.size()) { MainUtil.sendMessage(plr, "SKIPPING COMPLEX PLOT: " + origin); } } }; TASK = true; TaskManager.runTaskAsync(run); return true; } case "stop": { if (!TASK) { MainUtil.sendMessage(plr, "TASK ALREADY STOPPED"); return false; } TASK = false; MainUtil.sendMessage(plr, "TASK STOPPED"); return true; } case "info": { if (args.length == 2) { MainUtil.sendMessage(plr, "/plot condense " + area.toString() + " info <radius>"); return false; } if (!MathMan.isInteger(args[2])) { MainUtil.sendMessage(plr, "INVALID RADIUS"); return false; } final int radius = Integer.parseInt(args[2]); final Collection<Plot> plots = area.getPlots(); final int size = plots.size(); final int minimum_radius = (int) Math.ceil((Math.sqrt(size) / 2) + 1); if (radius < minimum_radius) { MainUtil.sendMessage(plr, "RADIUS TOO SMALL"); return false; } final int max_move = getPlots(plots, minimum_radius).size(); final int user_move = getPlots(plots, radius).size(); MainUtil.sendMessage(plr, "=== DEFAULT EVAL ==="); MainUtil.sendMessage(plr, "MINIMUM RADIUS: " + minimum_radius); MainUtil.sendMessage(plr, "MAXIMUM MOVES: " + max_move); MainUtil.sendMessage(plr, "=== INPUT EVAL ==="); MainUtil.sendMessage(plr, "INPUT RADIUS: " + radius); MainUtil.sendMessage(plr, "ESTIMATED MOVES: " + user_move); MainUtil.sendMessage(plr, "ESTIMATED TIME: " + "No idea, times will drastically change based on the system performance and load"); MainUtil.sendMessage(plr, "&e - Radius is measured in plot width"); return true; } } MainUtil.sendMessage(plr, "/plot condense " + area.worldname + " <start|stop|info> [radius]"); return false; } public Set<PlotId> getPlots(final Collection<Plot> plots, final int radius) { final HashSet<PlotId> outside = new HashSet<>(); for (final Plot plot : plots) { if ((plot.getId().x > radius) || (plot.getId().x < -radius) || (plot.getId().y > radius) || (plot.getId().y < -radius)) { outside.add(plot.getId()); } } return outside; } }
SilverCory/PlotSquared
Core/src/main/java/com/intellectualcrafters/plot/commands/Condense.java
Java
gpl-3.0
12,021
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_11) on Tue Feb 24 14:31:54 EST 2015 --> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Uses of Class com.ni.vision.NIVision.ContourOverlaySettings (wpilibJavaFinal 0.1.0-SNAPSHOT API)</title> <meta name="date" content="2015-02-24"> <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class com.ni.vision.NIVision.ContourOverlaySettings (wpilibJavaFinal 0.1.0-SNAPSHOT API)"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../com/ni/vision/NIVision.ContourOverlaySettings.html" title="class in com.ni.vision">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../index.html?com/ni/vision/class-use/NIVision.ContourOverlaySettings.html" target="_top">Frames</a></li> <li><a href="NIVision.ContourOverlaySettings.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Class com.ni.vision.NIVision.ContourOverlaySettings" class="title">Uses of Class<br>com.ni.vision.NIVision.ContourOverlaySettings</h2> </div> <div class="classUseContainer"> <ul class="blockList"> <li class="blockList"> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation"> <caption><span>Packages that use <a href="../../../../com/ni/vision/NIVision.ContourOverlaySettings.html" title="class in com.ni.vision">NIVision.ContourOverlaySettings</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Package</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="#com.ni.vision">com.ni.vision</a></td> <td class="colLast">&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="com.ni.vision"> <!-- --> </a> <h3>Uses of <a href="../../../../com/ni/vision/NIVision.ContourOverlaySettings.html" title="class in com.ni.vision">NIVision.ContourOverlaySettings</a> in <a href="../../../../com/ni/vision/package-summary.html">com.ni.vision</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../com/ni/vision/package-summary.html">com.ni.vision</a> with parameters of type <a href="../../../../com/ni/vision/NIVision.ContourOverlaySettings.html" title="class in com.ni.vision">NIVision.ContourOverlaySettings</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><span class="typeNameLabel">NIVision.</span><code><span class="memberNameLink"><a href="../../../../com/ni/vision/NIVision.html#imaqContourOverlay-com.ni.vision.NIVision.Image-com.ni.vision.NIVision.Image-com.ni.vision.NIVision.ContourOverlaySettings-com.ni.vision.NIVision.ContourOverlaySettings-java.lang.String-">imaqContourOverlay</a></span>(<a href="../../../../com/ni/vision/NIVision.Image.html" title="class in com.ni.vision">NIVision.Image</a>&nbsp;image, <a href="../../../../com/ni/vision/NIVision.Image.html" title="class in com.ni.vision">NIVision.Image</a>&nbsp;contourImage, <a href="../../../../com/ni/vision/NIVision.ContourOverlaySettings.html" title="class in com.ni.vision">NIVision.ContourOverlaySettings</a>&nbsp;pointsSettings, <a href="../../../../com/ni/vision/NIVision.ContourOverlaySettings.html" title="class in com.ni.vision">NIVision.ContourOverlaySettings</a>&nbsp;eqnSettings, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;groupName)</code>&nbsp;</td> </tr> </tbody> </table> </li> </ul> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../com/ni/vision/NIVision.ContourOverlaySettings.html" title="class in com.ni.vision">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../index.html?com/ni/vision/class-use/NIVision.ContourOverlaySettings.html" target="_top">Frames</a></li> <li><a href="NIVision.ContourOverlaySettings.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright &#169; 2015. All rights reserved.</small></p> </body> </html>
LSRobotics/2016Robot
wpilib/java/current/javadoc/com/ni/vision/class-use/NIVision.ContourOverlaySettings.html
HTML
gpl-3.0
7,460
/* * Beautiful Capi generates beautiful C API wrappers for your C++ classes * Copyright (C) 2015 Petr Petrovich Petrov * * This file is part of Beautiful Capi. * * Beautiful Capi 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. * * Beautiful Capi 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 Beautiful Capi. If not, see <http://www.gnu.org/licenses/>. * */ /* * WARNING: This file was automatically generated by Beautiful Capi! * Do not edit this file! Please edit the source API description. */ #ifndef UNITTEST_NAME_DEFINITION_INCLUDED #define UNITTEST_NAME_DEFINITION_INCLUDED #include "UnitTest/NameDecl.h" #ifdef __cplusplus inline UnitTest::Name::Name(const char* FirstName, const char* MiddleName, const char* LastName) { SetObject(unit_test_name_full_name(FirstName, MiddleName, LastName)); } inline const char* UnitTest::Name::GetFullName() { return unit_test_name_get_full_name(GetRawPointer()); } inline const char* UnitTest::Name::GetFirstName() const { return unit_test_name_get_first_name_const(GetRawPointer()); } inline void UnitTest::Name::SetFirstName(const char* first_name) { unit_test_name_set_first_name(GetRawPointer(), first_name); } inline const char* UnitTest::Name::GetMiddleName() const { return unit_test_name_get_middle_name_const(GetRawPointer()); } inline void UnitTest::Name::SetMiddleName(const char* middle_name) { unit_test_name_set_middle_name(GetRawPointer(), middle_name); } inline const char* UnitTest::Name::GetLastName() const { return unit_test_name_get_last_name_const(GetRawPointer()); } inline void UnitTest::Name::SetLastName(const char* last_name) { unit_test_name_set_last_name(GetRawPointer(), last_name); } inline UnitTest::Name::Name(const Name& other) { if (other.GetRawPointer()) { SetObject(unit_test_name_copy(other.GetRawPointer())); } else { SetObject(0); } } #ifdef UNITTEST_CPP_COMPILER_HAS_RVALUE_REFERENCES inline UnitTest::Name::Name(Name&& other) { mObject = other.mObject; other.mObject = 0; } #endif /* UNITTEST_CPP_COMPILER_HAS_RVALUE_REFERENCES */ inline UnitTest::Name::Name(UnitTest::Name::ECreateFromRawPointer, void *object_pointer, bool copy_object) { if (object_pointer && copy_object) { SetObject(unit_test_name_copy(object_pointer)); } else { SetObject(object_pointer); } } inline UnitTest::Name::~Name() { if (GetRawPointer()) { unit_test_name_delete(GetRawPointer()); SetObject(0); } } inline UnitTest::Name& UnitTest::Name::operator=(const UnitTest::Name& other) { if (this != &other) { if (GetRawPointer()) { unit_test_name_delete(GetRawPointer()); SetObject(0); } if (other.GetRawPointer()) { SetObject(unit_test_name_copy(other.mObject)); } else { SetObject(0); } } return *this; } #ifdef UNITTEST_CPP_COMPILER_HAS_RVALUE_REFERENCES inline UnitTest::Name& UnitTest::Name::operator=(UnitTest::Name&& other) { if (this != &other) { if (GetRawPointer()) { unit_test_name_delete(GetRawPointer()); SetObject(0); } mObject = other.mObject; other.mObject = 0; } return *this; } #endif /* UNITTEST_CPP_COMPILER_HAS_RVALUE_REFERENCES */ inline UnitTest::Name UnitTest::Name::Null() { return UnitTest::Name(UnitTest::Name::force_creating_from_raw_pointer, 0, false); } inline bool UnitTest::Name::IsNull() const { return !GetRawPointer(); } inline bool UnitTest::Name::IsNotNull() const { return GetRawPointer() != 0; } inline bool UnitTest::Name::operator!() const { return !GetRawPointer(); } inline void* UnitTest::Name::Detach() { void* result = GetRawPointer(); SetObject(0); return result; } inline void* UnitTest::Name::GetRawPointer() const { return UnitTest::Name::mObject ? mObject: 0; } inline void UnitTest::Name::SetObject(void* object_pointer) { mObject = object_pointer; } #endif /* __cplusplus */ #endif /* UNITTEST_NAME_DEFINITION_INCLUDED */
PetrPPetrov/beautiful-capi
tests/current_backuped_results/unit_test/include/UnitTest/Name.h
C
gpl-3.0
4,632
package nofist.api.config; import java.io.File; import java.util.ArrayList; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.fml.common.FMLLog; import nofist.api.config.property.*; import org.apache.logging.log4j.Level; public abstract class Config { protected ArrayList<ConfigProperty> properties = new ArrayList<ConfigProperty>(); private Configuration config; public ArrayList<ConfigProperty> getProperties() { return this.properties; } protected void addProp(ConfigProperty property) { for (ConfigProperty prop : this.properties) { if (prop.name.contentEquals(property.name)) { removeProp(property.name); break; } } this.properties.add(property); } protected void removeProp(String name) { for (int i = 0; i < this.properties.size(); i++) { if (this.properties.get(i).name.contentEquals(name)) { this.properties.remove(i); return; } } } public ConfigPropertyBoolean addProperty(ConfigPropertyBoolean property) { this.addProp(property); return property; } public ConfigPropertyFloat addProperty(ConfigPropertyFloat property) { this.addProp(property); return property; } public ConfigPropertyInt addProperty(ConfigPropertyInt property) { this.addProp(property); return property; } public ConfigPropertyString addProperty(ConfigPropertyString property) { this.addProp(property); return property; } public ConfigPropertyStringArray addProperty(ConfigPropertyStringArray property) { this.addProp(property); return property; } public void load(String configFile) { config = new Configuration(new File(configFile)); try { config.load(); ArrayList<ConfigProperty> properties = this.getProperties(); for (ConfigProperty prop : properties) { switch (prop.type) { case INTEGER: ConfigPropertyInt propInt = (ConfigPropertyInt) prop; propInt.set(config.getInt( propInt.name, propInt.category, propInt.valueInt, propInt.minValueInt, propInt.maxValueInt, prop.description )); break; case FLOAT: ConfigPropertyFloat propFloat = (ConfigPropertyFloat) prop; propFloat.set(config.getFloat( propFloat.name, propFloat.category, propFloat.valueFloat, propFloat.minValueFloat, propFloat.maxValueFloat, propFloat.description )); break; case BOOLEAN: ConfigPropertyBoolean propBool = (ConfigPropertyBoolean) prop; propBool.set(config.getBoolean( propBool.name, propBool.category, propBool.valueBoolean, propBool.description )); break; case STRING: ConfigPropertyString propString = (ConfigPropertyString) prop; propString.set(config.getString( propString.name, propString.category, propString.valueString, propString.description )); break; case STRING_ARRAY: ConfigPropertyStringArray propStringArray = (ConfigPropertyStringArray) prop; propStringArray.set(config.getStringList( propStringArray.name, propStringArray.category, propStringArray.valueStringArray, propStringArray.description )); break; default: throw new RuntimeException("ConfigProperty type not supported."); } } } catch (Exception e) { FMLLog.log(Level.ERROR, "[NoFist-ERROR] NoFist had a problem loading config: %s", configFile); } finally { if (config.hasChanged()) { config.save(); } } } public Configuration getConfig() { return config; } }
whichonespink44/NoFist
src/main/java/nofist/api/config/Config.java
Java
gpl-3.0
4,993
//---------------------------------------------------------------------- // This file is part of PARSEC (http://physik.rwth-aachen.de/parsec) // a parametrized simulation engine for cosmic rays. // // Copyright (C) 2011 Martin Erdmann, Peter Schiffer, Tobias Winchen // RWTH Aachen University, Germany // Contact: winchen@physik.rwth-aachen.de // // This program is free software: you can redistribute it and/or // modify it under the terms of the GNU General Public License as // published by the Free Software Foundation, either version 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/>. //---------------------------------------------------------------------- #ifndef MAGNETICLENS_HH #define MAGNETICLENS_HH #include "crpropa/magneticLens/ModelMatrix.h" #include "crpropa/magneticLens/Pixelization.h" #include "crpropa/Units.h" #include "crpropa/Vector3.h" #include <vector> #include <string> #include <stdexcept> #include <fstream> #include <sstream> #include <iostream> #include <stdint.h> namespace crpropa { /// Holds one matrix for the lens and information about the rigidity range class LensPart { string _filename; double _rigidityMin; double _rigidityMax; ModelMatrixType M; double _maximumSumOfColumns; bool _maximumSumOfColumns_calculated; public: LensPart() { } /// File containing the matrix to be used in the range rigidityMin, /// rigidityMax in Joule LensPart(const std::string &filename, double rigidityMin, double rigidityMax) : _filename(filename), _rigidityMin(rigidityMin), _rigidityMax(rigidityMax), _maximumSumOfColumns_calculated( false), _maximumSumOfColumns(0) { } ~LensPart() { } /// Loads the matrix from file void loadMatrixFromFile() { deserialize(_filename, M); } /// Returns the filename of the matrix const std::string& getFilename() { return _filename; } /// Calculates the maximum of the sums of columns for the matrix double getMaximumOfSumsOfColumns() { if (!_maximumSumOfColumns_calculated) { // lazy calculation of maximum _maximumSumOfColumns = maximumOfSumsOfColumns(M); _maximumSumOfColumns_calculated = true; } return _maximumSumOfColumns; } /// Returns the minimum of the rigidity range for the lenspart in eV double getMinimumRigidity() { return _rigidityMin / eV; } /// Returns the maximum of the rigidity range for the lenspart in eV double getMaximumRigidity() { return _rigidityMax / eV; } /// Returns the modelmatrix ModelMatrixType& getMatrix() { return M; } /// Sets the modelmatrix void setMatrix(const ModelMatrixType& m) { M = m; } }; /// Function to calculate the mean deflection [rad] of the matrix M, given a pixelization //double calculateMeanDeflection(const ModelMatrix &M, // const Pixelization &pixelization) //{ // double totalDeflection = 0; // double weightSum = 0; // for (const_i2_t it1 = M.begin2(); it1 != (M.end2()); it1++) // { // for (const_i1_t it2 = it1.begin(); it2 != it1.end(); it2++) // { // totalDeflection+= pixelization.angularDistance(it2.index1(), // it2.index2()) * (*it2) ; // weightSum+= (*it2); // } // } // return totalDeflection / weightSum; //} typedef std::vector<LensPart*>::iterator LensPartIter; typedef std::vector<LensPart*>::const_iterator const_LensPartIter; /// The lens for the galactic magnetic field. /// Note that the energies refer to protons (Z=1). To be used with other particles with a different charge number please select the rigidity accordingly. class MagneticLens { void updateRigidityBounds(double rigidityMin, double rigidityMax); /// Loads part of a lens (one matrix) from file to use it in given rigidity range. void loadLensPart(const string &filename, double rigidityMin, double rigidityMax); // Stores the individual lenses std::vector<LensPart*> _lensParts; Pixelization* _pixelization; // Checks Matrix, raises Errors if not ok - also generate // _pixelization if called first time void _checkMatrix(const ModelMatrixType &M); // minimum / maximum rigidity that is covered by the lens [Joule] double _minimumRigidity; double _maximumRigidity; static bool _randomSeeded; double _norm; public: /// Default constructor MagneticLens() : _pixelization(NULL), _minimumRigidity(DBL_MAX), _maximumRigidity(DBL_MIN), _norm(1) { } /// Constructs lens with predefined healpix order MagneticLens(uint8_t healpixorder) : _pixelization(NULL), _minimumRigidity(DBL_MAX), _maximumRigidity(DBL_MIN) { _pixelization = new Pixelization(healpixorder); } /// Construct lens and load lens from file MagneticLens(const string &filename) : _pixelization(NULL), _minimumRigidity(DBL_MAX), _maximumRigidity(DBL_MIN) { loadLens(filename); } /// Returns the pixelization used const Pixelization& getPixelization() const { return (*_pixelization); } /// Default destructor ~MagneticLens() { if (_pixelization) delete _pixelization; for (std::vector<LensPart*>::iterator iter = _lensParts.begin(); iter != _lensParts.end(); iter++) { delete (*iter); } _lensParts.clear(); } /// Try to transform the comsic ray to a new direction. /// Returns false and does not change phi and theta if the cosmic ray is /// lost due to conservation of cosmic ray flux. /// Rigidity is given in Joule, phi and theta in rad bool transformCosmicRay(double rigidity, double& phi, double& theta); /// Tries transform a cosmic ray with momentum vector p bool transformCosmicRay(double rigidity, Vector3d &p); /// transforms the model array assuming that model points to an array of the /// correct size. Rigidity is given in Joule void transformModelVector(double* model, double rigidity) const; /// Loads M as part of a lens and use it in given rigidity range with /// rigidities given in Joule void setLensPart(const ModelMatrixType &M, double rigidityMin, double rigidityMax); /// Loads a lens from a given file, containing lines like /// lensefile.MLDAT rigidityMin rigidityMax /// rigidities are given in logarithmic units [log10(E / eV)] void loadLens(const string &filename); /// Normalizes the lens parts to the maximum of sums of columns of /// every lenspart. By doing this, the lens won't distort the spectrum void normalizeLens(); /// Normalizes the lens parts individually. Normalized this way, the /// lens generally distorts the spectrum of the sources, but deflects /// the UHECR more efficiently. void normalizeLensparts(); /// Checks if rigidity [Joule] is covered by lens bool rigidityCovered(double rigidity) const; /// Normalizes all matrix columns - the lens will then create fake /// anisotropies, but won't drop particles void normalizeMatrixColumns(); /// Returns minimum rigidity covered by lens, in eV double getMinimumRigidity() const { return _minimumRigidity / eV; } /// Returns maximum rigidity covered by lens, in eV double getMaximumRigidity() const { return _maximumRigidity / eV; } // returns the norm used for the lenses double getNorm() { return _norm; } /// Returns iterator to the lens part with rigidity Joule LensPart* getLensPart(double rigidity) const; /// Returns all lens parts const std::vector<LensPart*>& getLensParts() const { return _lensParts; } }; } // namespace #endif // MAGNETICLENS_HH
cheiter/CRPropa3
include/crpropa/magneticLens/MagneticLens.h
C
gpl-3.0
7,704
<?xml version="1.0" encoding="ascii"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>CNBMMGreeting</title> <link rel="stylesheet" href="epydoc.css" type="text/css" /> <script type="text/javascript" src="epydoc.js"></script> </head> <body bgcolor="white" text="black" link="blue" vlink="#204080" alink="#204080"> <h1 class="toc">Module CNBMMGreeting</h1> <hr /> <h2 class="toc">Classes</h2> <a target="mainFrame" href="cnb.modAvailable.CNBMMGreeting.CNBMMGreeting-class.html" >CNBMMGreeting</a><br /> <h2 class="toc">Variables</h2> <a target="mainFrame" href="cnb.modAvailable.CNBMMGreeting-module.html#__package__" >__package__</a><br /><hr /> <span class="options">[<a href="javascript:void(0);" class="privatelink" onclick="toggle_private();">hide&nbsp;private</a>]</span> <script type="text/javascript"> <!-- // Private objects are initially displayed (because if // javascript is turned off then we want them to be // visible); but by default, we want to hide them. So hide // them unless we have a cookie that says to show them. checkCookie(); // --> </script> </body> </html>
hackfestca/cnb
docs/toc-cnb.modAvailable.CNBMMGreeting-module.html
HTML
gpl-3.0
1,276
package com.temoa.androidui; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.support.v4.app.ActivityCompat; import android.support.v4.app.ActivityOptionsCompat; import android.support.v7.app.AppCompatActivity; import android.transition.Transition; import android.transition.TransitionInflater; import android.view.View; import android.view.Window; import android.widget.ImageView; import android.widget.TextView; import com.temoa.androidui.other.ToTransitionActivity; public class TransitionActivity extends AppCompatActivity implements View.OnClickListener { private ImageView iv; private String update = "Update:\n" + "在res目录中添加transition目录,在其中添加动画xml\n" + "<slide\n" + " xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" + " android:interpolator=\"@android:interpolator/decelerate_cubic\"\n" + " android:slideEdge=\"bottom\">\n" + " <!--状态栏和导航栏不执行动画-->\n" + " <targets>\n" + " <target android:excludeId=\"@android:id/navigationBarBackground\"/>\n" + " <target android:excludeId=\"@android:id/statusBarBackground\"/>\n" + " </targets>\n" + "</slide>\n\n" + "然后在代码中" + "Transition explode = TransitionInflater.from(this).inflateTransition(R.transition.explode);" + "getWindow().setExitTransition(explode);\n" + "getWindow().setEnterTransition(explode);\n\n"; private String code = "Java Code\n" + "// 在setContentView()方法前设置.调用和被调用的Activity都要设置\n" + "if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {\n" + " getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);\n" + " getWindow().requestFeature(Window.FEATURE_ACTIVITY_TRANSITIONS);\n" + " // 这里除了Explode,还有Slide和Fade" + " getWindow().setExitTransition(new Explode());\n" + " getWindow().setEnterTransition(new Explode());\n" + "}\n" + "Intent intent = new Intent(this, ToTransitionActivity.class);\n" + " intent.putExtra(\"type\", type);\n" + " ActivityOptionsCompat options = ActivityOptionsCompat\n" + " .makeSceneTransitionAnimation(this, iv, \"hello\");\n" + " ActivityCompat.startActivity(this, intent, options.toBundle());\n\n"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); getWindow().requestFeature(Window.FEATURE_ACTIVITY_TRANSITIONS); } setContentView(R.layout.activity_transition); iv = (ImageView) findViewById(R.id.image); findViewById(R.id.btn1).setOnClickListener(this); findViewById(R.id.btn2).setOnClickListener(this); findViewById(R.id.btn3).setOnClickListener(this); TextView tv = (TextView) findViewById(R.id.tv); tv.setText(update + code); } @Override public void onClick(View view) { int id = view.getId(); switch (id) { case R.id.btn1: // 分解 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Transition explode = TransitionInflater.from(this).inflateTransition(R.transition.explode); getWindow().setExitTransition(explode); getWindow().setEnterTransition(explode); // getWindow().setExitTransition(new Explode()); // getWindow().setEnterTransition(new Explode()); } createIntent(1); break; case R.id.btn2: // 滑动 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Transition slide = TransitionInflater.from(this).inflateTransition(R.transition.slide); getWindow().setEnterTransition(slide); getWindow().setExitTransition(slide); // getWindow().setExitTransition(new Slide()); // getWindow().setEnterTransition(new Slide()); } createIntent(2); break; case R.id.btn3: // 淡入淡出 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Transition fade = TransitionInflater.from(this).inflateTransition(R.transition.fade); getWindow().setExitTransition(fade); getWindow().setEnterTransition(fade); } createIntent(3); break; } } private void createIntent(int type) { Intent intent = new Intent(this, ToTransitionActivity.class); intent.putExtra("type", type); ActivityOptionsCompat options = ActivityOptionsCompat .makeSceneTransitionAnimation(this, iv, "hello"); ActivityCompat.startActivity(this, intent, options.toBundle()); } }
Temoa/AndroidUI
app/src/main/java/com/temoa/androidui/TransitionActivity.java
Java
gpl-3.0
5,526
/* Copyright 2016 David Wong This file is part of uEVA. https://github.com/DaveSketchySpeedway/uEVA uEVA 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 any later version. uEVA 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 uEva. If not, see <http://www.gnu.org/licenses/> */ #include "display.h" Display::Display(QWidget *parent) : QWidget(parent) { setMouseTracking(true); leftPressed = false; lastLeftPressed = false; mousePosition = QPoint(0, 0); lastMousePosition = QPoint(0, 0); lineStartPosition = QPoint(0, 0); lineEndPosition = QPoint(0, 0); leftPressPosition = QPoint(0, 0); rightPressPosition = QPoint(0, 0); connect(this, SIGNAL(sendMouseLine(QLine)), parent, SLOT(receiveMouseLine(QLine))); QLine line = QLine(lineStartPosition, lineEndPosition); emit sendMouseLine(line); } Display::~Display() { } //// REGULAR CALLS void Display::setImage(const QImage &i) { image = i; } QPoint Display::getMousePosition() { return mousePosition; } QPoint Display::getLeftPress() { QPoint lpp = leftPressPosition; leftPressPosition = QPoint(0, 0); return lpp; } QPoint Display::getRightPress() { QPoint rpp = rightPressPosition; rightPressPosition = QPoint(0, 0); return rpp; } QLine Display::getLeftPressMovement() { QLine movement = QLine(0, 0, 0, 0); if (leftPressed && lastLeftPressed) { movement = QLine(lastMousePosition, mousePosition); } lastMousePosition = mousePosition; lastLeftPressed = leftPressed; return movement; } //// EVENTS void Display::mousePressEvent(QMouseEvent *event) { mousePosition = event->pos(); leftPressed = false; if (event->button() & Qt::LeftButton) { leftPressed = true; lineStartPosition = event->pos(); leftPressPosition = event->pos(); } if (event->button() & Qt::RightButton) { rightPressPosition = event->pos(); } update(); } void Display::mouseMoveEvent(QMouseEvent *event) { mousePosition = event->pos(); leftPressed = false; if (event->buttons() & Qt::LeftButton) // must use buttons() instead of button() { leftPressed = true; lineEndPosition = event->pos(); } //update(); // cost up to 50ms in GUI when moving mouse // jam up gui so much that timer event will be delayed // engine duty cycle will appear to spike, but not actually when timed inside thread // relies on gui timer (10hz default) to update mouse movement } void Display::mouseReleaseEvent(QMouseEvent *event) { mousePosition = event->pos(); leftPressed = false; if (event->button() & Qt::LeftButton) { leftPressed = false; lineEndPosition = event->pos(); QLine line = QLine(lineStartPosition, lineEndPosition); emit sendMouseLine(line); } update(); } void Display::paintEvent(QPaintEvent *event) { QPainter painter(this); painter.drawImage(0, 0, image); painter.setPen(QPen(Qt::red, 3)); painter.drawLine(lineStartPosition, lineEndPosition); }
DaveSketchySpeedway/uEVA
RoboDrop01/ueva/display.cpp
C++
gpl-3.0
3,256
# Aplicación bares ## Autor: Pablo Martín-Moreno Ruiz [![Build Status](https://travis-ci.org/pmmre/Bares.svg?branch=master)](https://travis-ci.org/pmmre/Bares) [![Build Status](https://snap-ci.com/pmmre/Bares/branch/master/build_image)](https://snap-ci.com/pmmre/Bares/branch/master) ## Descripción de la aplicación ### Supuesta aplicación final La aplicación gestiona diversos bares y las tapas que tiene cada uno. En la información de cada bar podemos ver una descripción del local y su localización en un mapa. Cada tapa permite se votada y también se propociona una gráfica de los bares más visitados. ### Infraestructura - Framework de alto nivel Django - Como soporte persistente de los datos Sqlite3 y PostgreSQL - Testeo de la aplicación con Travis. - Integración continua con Snap-ci (junto a Travis) - Heroku como PaaS - Docker como entorno de desarrollo - Azure como IaaS ### Integración continua: Primero paso el testeo (Travis) Para comprobar que nuestro código funciona perfectamente lo primero tenemos que generar unos test en el lenguaje que desarrollemos. En este casa he usado el testeo desarrollado por Django. Esto consiste en unos test almacenados en el archivo tests.py de nuestro proyecto que se ejecutan con python manage.py test. Esto no sólo sirve para testear nuestro código sino que también podemos combinarlo con Travis para que cada vez que hagamos un push a nuestro repositorio nos ejecute los test para ello ejecuta el siguiente archivo [.travis.yml](https://github.com/pmmre/Bares/blob/master/.travis.yml). Gracias a esta posibilidad si varios programadores o incluso uno mismo comete un error evita que pueda llevarse a producción siendo detectado previamente. ## Despliegue de la aplicación en el PaaS Heroku Ahora toca desplegar de una forma sencilla en un PaaS cómo Heroku, éste ha sido mi elección a que es fácil desplegarlo combinándolo con github . [Podemos ver funcionando esta aplicación en heroku](http://infinite-sierra-84562.herokuapp.com/) Aquí se explicará un breve resumen de cómo se hizo un despliegue en el PaaS Heroku: La primera parte es la instalación de los paquetes necesarios y registrarse y darse de alta en heroku. - Lo primero que hay que hacer es crearse una cuenta en heroku. - Una vez hecho esto hay que descargarse la herramientas de heroku introduciendo lo siguiente: wget -O- https://toolbelt.heroku.com/install-ubuntu.sh | sh - Hay que tener en cuenta que hacen falta más herramiento que ya instalaremos cómo son foreman y ruby. En mi caso tuve un error bastante grave con la instalación de las versiones de ruby al final instale apt-get install ruby1.9.1-full - Una vez realizadas todas las intalaciones nos loguemaos en heroku introduciendo heroku login y dándole los datos que nos pidan. Hay que modificar 3 archivos en el proyecto para que funcione correctamente: - Procfile hay que introducirlo y ponerle la siguiente línea: ``` web: gunicorn bares.wsgi --log-file - . ``` - Dentro de la carpeta de configuraciones en el archivo de wsgi hay que introducir lo siguiente: ``` os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bares.settings") from django.core.wsgi import get_wsgi_application from dj_static import Cling application = Cling(get_wsgi_application()) ``` En el caso de no usar Cling no nos funcionarán los CSS. setting hay que configurarlo introduciendo los siguientes parámetros: ![configurando_setting](http://i393.photobucket.com/albums/pp14/pmmre/Practica3IV/Seleccioacuten_011_zpsgh5dqrko.png) static_root nos hace falta para los fichero estaticos que se se crean al usar python manage.py collectstatic que usa heroku para ejecutarlo localmente. Cómo estoy usando base de datos base de datos modifico la configuración del settings para la base de datos por la siguiente: ``` ON_HEROKU = os.environ.get('ON_HEROKU') if ON_HEROKU: DATABASES = {'default' : dj_database_url.config() } else: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } ``` Con esto lo que hago es que si esto en un entorno que no sea heroku ejecuto sqlite3 pero si estoy en heroku utilizo postgressql cómo él me indica. Y cómo nota importante en los requirements.txt hay que eliminar distributive porque heroku ya lo tiene instalado y si se intenta volver a instalar falla. Y otro fallo que me costó ver es no ejecutar python manage.py collectstatic antes de enviarlo pués también le hace falta para mostrar al web. ### Despliege a Travis y encauzado a heroku con snap-ci Nuestra apliación ya tiene test controlado por Travis y también hemos diseñado un despliegue con Heroku pero ahora lo que hacemos en primero comprobar los test con Travis y después desplegarlo con Heroku, todo esto controlado con snap-ci Introduciendonos en Snap-ci podemos ver la lista de nuestros proyectos a los que queremos hacerle cauces (pipelines). En este caso se ha diseñado para que el código una vez introducido en github y pasado travis nos lo mande a heroku. Introducimos el repositorio que queramos en el pipeline, seleccionamos heroku de entre los Deploy y una vez hecho esto lo configuramos cómo se muestra en la siguiente imagen: ![configuracion_snap-ci](http://i393.photobucket.com/albums/pp14/pmmre/IVEjercicios5y6/IVEjercicios6/IVEjercicios6/Seleccioacuten_072_zpsmtkwktnk.png) ### Dockerhub Lo primero es registrarse en Dockerhub: ![registro_docker-hub](http://i393.photobucket.com/albums/pp14/pmmre/Practica3IV/Practica4IV/Practica4IV-2/Seleccioacuten_032_zpst9gcibfi.png) Una vez hecho eso enlazamos con github: ![enlazar1](http://i393.photobucket.com/albums/pp14/pmmre/Practica3IV/Practica4IV/Practica4IV-2/Seleccioacuten_033_zpsylhpjhfg.png) ![enlazar2](http://i393.photobucket.com/albums/pp14/pmmre/Practica3IV/Practica4IV/Practica4IV-2/Seleccioacuten_034_zpsvklblc3e.png) ![enlazar3](http://i393.photobucket.com/albums/pp14/pmmre/Practica3IV/Practica4IV/Practica4IV-2/Seleccioacuten_035_zps45kkipb8.png) Una vez hecho lo esto, selecionamos los repositorios en los que queremos que funcione docker, en este caso Bares y obtendremos su panel para controlarlo: ![seleccion](http://i393.photobucket.com/albums/pp14/pmmre/PracticaFinal/Seleccioacuten_073_zps3lxm4f7l.png) Ahora lo que hay que hacer es un archivo Dockerfile el directorio de nuestra aplicación, simplemente con esto instalamos todo lo necesario para que funcion: ![Dockerfile_bares](http://i393.photobucket.com/albums/pp14/pmmre/PracticaFinal/Seleccioacuten_080_zpsjc80rbi6.png) ### Ansible Ansible es un aprovisionador muy útil y que he selecionado porque en un solo archivo bien configurado tenemos todo lo necesario para que la aplicación funciona en una nueva máquina. Ansible funciona a través de ssh y para que lo haga correctemente debemos de darle la llave pública de la máquina desde la que queremos provisionar a la máquina a la que provisionaremos. Si no tenemos generadas las llaves las generamos con ```ssh-keygen -t dsa ``` y las enviamos a la máquina con la siguiente orden: ``` ssh-copy-id -i .ssh/id_dsa.pub UsuarioMaquinarRemota@maquinaRemota(DNS o IPI) ``` Copiarmos la dirección de la máquina en el siguiente archivo: ![ansible_hosts](http://i393.photobucket.com/albums/pp14/pmmre/PracticaFinal/Seleccioacuten_076_zpsm1m1myyh.png) Instroducimos todo lo que se necesita instalar en un archivo .yml ![yml](http://i393.photobucket.com/albums/pp14/pmmre/PracticaFinal/Seleccioacuten_077_zpseallz1cg.png) Y lo ejecutamos con la siguiente orden ```ansible-playbook -u pablo calificaciones.yml ``` y ya tenemos todo listo para ejecutar. En este caso tenemos que enviar nuestra llave pública a la máquina destino pero con vagrant lo gestionamos con certificados. ### Vagrant Vagrant sirve para crear máquinas virtuales nuevas remotamente (o localmente) y también para provisonar una máquina pero aqui se combina vagrant con ansible como provionador. El primer paso es instalar el provisionador de azure para vagrant: ![Aprovisonador](http://i393.photobucket.com/albums/pp14/pmmre/IVEjercicios5y6/IVEjercicios6/IVEjercicios6/Seleccioacuten_050_zpsvxmtdchd.png) El siguiente paso es loguearme y una vez hecho obtener mis credenciales de Azure: ![obtenerCredenciales](http://i393.photobucket.com/albums/pp14/pmmre/IVEjercicios5y6/IVEjercicios6/IVEjercicios6/Seleccioacuten_051_zpspqzjlxbr.png) Acto seguido importo a mi CLI de Azure mis credenciales: ![importAzure](http://i393.photobucket.com/albums/pp14/pmmre/IVEjercicios5y6/IVEjercicios6/IVEjercicios6/Seleccioacuten_053_zpssp9u9uua.png) El siguiente paso es generar los certificados que se van a subir a Azure y que nos permitan interaccionar con él. ``` openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout azurevagrant.key -out azurevagrant.key chmod 600 ~/.ssh/azurevagrant.key openssl x509 -inform pem -in azurevagrant.key -outform der -out azurevagrant.cer ``` ![GenerarCertificado](http://i393.photobucket.com/albums/pp14/pmmre/IVEjercicios5y6/IVEjercicios6/IVEjercicios6/Seleccioacuten_055_zpszkwntudy.png) Introducir el certificado en Azure: ![IntroducirCertificado](http://i393.photobucket.com/albums/pp14/pmmre/IVEjercicios5y6/IVEjercicios6/IVEjercicios6/Seleccioacuten_058_zpsvyodbees.png) Para poder autenticar Azure desde Vagrantfile es necesario crear un archivo .pem y concatenarle el archivo .key, para ello: ``` openssl req -x509 -key ~/.ssh/id_rsa -nodes -days 365 -newkey rsa:2048 -out azurevagrant.pem cat azurevagrant.key > azurevagrant.pem ``` Lo siguiente es obtener el box de azure: ![BoxAzure](http://i393.photobucket.com/albums/pp14/pmmre/IVEjercicios5y6/IVEjercicios6/IVEjercicios6/Seleccioacuten_059_zpstadryvbc.png) Ejecutar ```vagrant init azure```: ![Init](http://i393.photobucket.com/albums/pp14/pmmre/IVEjercicios5y6/IVEjercicios6/IVEjercicios6/Seleccioacuten_060_zpsqppxlfyo.png) Lo siguiente que hay que hacer es configurar Vagrantfile cómo se muestra en la siguiente imagen.Hay que destacar que de los 3 bloques el primero sive para configurar la red de la máquina, el segundo para configurar la instalación del sistema operativo y el tercero para provisonarlo con ansible: ![Vagrantfile](http://i393.photobucket.com/albums/pp14/pmmre/PracticaFinal/Seleccioacuten_078_zpsuali3gws.png) En ansible incluimos todo lo necesario para que funcione nuestro programa: ![ansible](http://i393.photobucket.com/albums/pp14/pmmre/PracticaFinal/Seleccioacuten_077_zpseallz1cg.png) Y con el siguiente comando nos disponemos a lanzar ansible para que cre la maquina y por último que nos ejecute ansible (provisionar) para que funcione todo: ![Lanzar](http://i393.photobucket.com/albums/pp14/pmmre/IVEjercicios5y6/IVEjercicios6/IVEjercicios6/Seleccioacuten_062_zpsi1tkujtp.png) En el enlace es el siguiente: http://bares-service-fqked.cloudapp.net/ [Podemos ver funcionando esta aplicación en Azure](http://bares-service-fqked.cloudapp.net/) ![PERFECT](http://i393.photobucket.com/albums/pp14/pmmre/PracticaFinal/Seleccioacuten_079_zpsjgjy7uvy.png) Podemos ejecutar algunos comando de vagrant útiles: ```vagrant up``` Sólo crear la máquina. ```vagrant provision``` Sólo provisionarla ```vagrant suspend``` Apagarla ### Fabric Fabric es una biblioteca de Python para automatizar tareas de administración haciendo uso de SSH, con ella se puede crear un entorno de pruebas en una máquina virtual de Azure. [fabfile.py](https://github.com/pmmre/Bares/blob/master/fabfile.py)
pmmre/Bares
README.md
Markdown
gpl-3.0
11,569
/** * @package Woodkit * @author Sébastien Chandonay www.seb-c.com License: GPL2 Text Domain: woodurls * * Copyright 2016 Sébastien Chandonay (email : please contact me from my website) * * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 * USA */ (function($) { $.seourlsmanager = function(element, urls) { var plugin = this; var settings = null; var $seourlsmanager = element; var $seourlsmanager_container = null; var $seourlsmanager_container_add = null; /** * init/update urls */ plugin.urls = function(urls) { settings = $.extend({ label_add_item : "Add sitemap rule", label_confirm_remove_item : "Do you realy want remove this url ?", label_url : "url", label_url_exclude : "exclude", label_action_add : "add", label_action_exclude_if_equals : "exclude if equals", label_action_exclude_if_contains : "exclude if contains", label_action_exclude_if_regexp : "exclude if matches regexp", }, urls); } /** * initialization */ plugin.init = function() { plugin.urls(urls); /** * Html structure */ $seourlsmanager_container = $('<div class="multiple-items-manager seourlsmanager-container"></div>').appendTo($seourlsmanager); $seourlsmanager_container_add = $('<div class="add-url wk-btn light small"><span>' + settings['label_add_item'] + '</span></div>').appendTo( $seourlsmanager); /** * Listener */ $seourlsmanager_container_add.on('click', function(e) { plugin.add_url(1, "", "add"); }); $seourlsmanager_container.on('click', '.delete-url', function(e) { plugin.remove_url($(this).data('id')); }); }; /** * initialization */ plugin.reinit = function(urls) { plugin.urls(urls); }; /** * Set data (urls) - passed parameter must be an object */ plugin.set_data = function(data) { for ( var k in data) { if (data.hasOwnProperty(k)) { var obj = data[k]; plugin.add_url(obj.id, obj.url, obj.action); } } } /** * Add url html container */ plugin.add_url = function(id, url, action) { var url_id = plugin.get_unique_id("sitemap-url-id-", id); var html = ''; html += '<div class="url item" id="sitemap-url-id-' + url_id + '" data-id="' + url_id + '">'; html += '<span class="delete delete-url" data-id="sitemap-url-id-' + url_id + '">[DEL]</span>'; html += '<select name="sitemap-url-action-' + url_id + '">'; var action_checked = ""; if (empty(action) || action == 'add') action_checked = ' selected="selected"'; html += '<option value="add"'+action_checked+'>'+settings['label_action_add']+'</option>'; action_checked = ""; if (!empty(action) && action == 'exclude_if_equals') action_checked = ' selected="selected"'; html += '<option value="exclude_if_equals"'+action_checked+'>'+settings['label_action_exclude_if_equals']+'</option>'; action_checked = ""; if (!empty(action) && action == 'exclude_if_contains') action_checked = ' selected="selected"'; html += '<option value="exclude_if_contains"'+action_checked+'>'+settings['label_action_exclude_if_contains']+'</option>'; action_checked = ""; if (!empty(action) && action == 'exclude_if_regexp') action_checked = ' selected="selected"'; html += '<option value="exclude_if_regexp"'+action_checked+'>'+settings['label_action_exclude_if_regexp']+'</option>'; html += '</select>'; html += '<input type="text" class="large" name="sitemap-url-' + url_id + '" value="'+url+'" placeholder="' + settings['label_url'] + '" />'; html += '<input type="hidden" name="sitemap-url-id-' + url_id + '" value="' + url_id + '" />'; html += '</div>'; var $url_container = $(html).appendTo($seourlsmanager_container); return $url_container; } /** * Remove url */ plugin.remove_url = function($url_id) { if ($("#" + $url_id).length > 0 && confirm(settings['label_confirm_remove_item'])) { $("#" + $url_id).remove(); } } /** * get unique url ID */ plugin.get_unique_id = function(prefix, id) { if (id < 1 || $seourlsmanager_container.find("#" + prefix + id).length > 0) { id++; return plugin.get_unique_id(prefix, id); } else { return id; } } plugin.init(); return plugin; }; $.fn.seourlsmanager = function(options) { var seourlsmanager = $(this).data('seourlsmanager'); if (empty(seourlsmanager)) { seourlsmanager = new $.seourlsmanager($(this), options); $(this).data('seourlsmanager', seourlsmanager); } else { seourlsmanager.reinit(options); } return seourlsmanager; }; })(jQuery);
studio-montana/woodkit
src/tools/seo/js-seourlsmanager/js/admin-seourlsmanager.js
JavaScript
gpl-3.0
5,199
package main; import database.DbCapos; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.*; import javafx.scene.control.cell.PropertyValueFactory; import java.net.URL; import java.util.ResourceBundle; public class inventarioController extends ControlledScreen implements Initializable { ScreensController myController; /** * Initializes the controller class. */ @Override public void initialize(URL url, ResourceBundle rb) { // TODO colNombre.setCellValueFactory( new PropertyValueFactory<lProducto, String>("nombre")); colPrecio.setCellValueFactory( new PropertyValueFactory<lProducto, Float>("precio")); colCodigo.setCellValueFactory( new PropertyValueFactory<lProducto, String>("codigo")); colCantidad.setCellValueFactory( new PropertyValueFactory<lProducto, String>("cantidad")); lRegLab.setText(""); lEdtLab.setText(""); clear(); } public void clear(){ data.removeAll(data); int[] num = DbCapos.numProductos(); for (int x=0; x<num.length; x++) { String[] valores = DbCapos.selectProduct(num[x]); //System.out.println(valores[0]+valores[1]+valores[2]+valores[3]); data.add(new lProducto(valores[0], valores[2], valores[1], valores[3])); } proTable.setItems(data); } public void setScreenParent(ScreensController screenParent){ myController = screenParent; } @FXML private TextField tRegCod; @FXML private TextField tRegNom; @FXML private TextField tRegPre; @FXML private TextField tRegCan; @FXML private TextField tEdtCod; @FXML private TextField tEdtNom; @FXML private TextField tEdtPre; @FXML private TextField tEdtCan; @FXML private Label lRegLab; @FXML private Label lEdtLab; @FXML private TableView<lProducto> proTable; @FXML private TableColumn colNombre; @FXML private TableColumn colCodigo; @FXML private TableColumn colPrecio; @FXML private TableColumn colCantidad; private final ObservableList<lProducto> data = FXCollections.observableArrayList(); @FXML private void goToMain(ActionEvent event){ myController.setScreen(Main.screenMain); tRegCod.setText(""); tRegNom.setText(""); tRegCan.setText(""); tRegPre.setText(""); lRegLab.setText(""); tEdtCod.setText(""); tEdtNom.setText(""); tEdtCan.setText(""); tEdtPre.setText(""); lEdtLab.setText(""); System.out.println("Go to Caja Screen"); } @FXML private void goToLogin(ActionEvent event){ myController.setScreen(Main.screenLogin); System.out.println("Go to Login Screen"); } @FXML private void bBorrar(ActionEvent event){ if(!DbCapos.existeProducto(tEdtCod.getText())==false && !tEdtCod.getText().equals("Ya Existe!") && !tEdtCod.getText().equals("")){ DbCapos.deleteProducto(tEdtCod.getText()); tEdtCod.setText(""); tEdtNom.setText(""); tEdtCan.setText(""); tEdtPre.setText(""); lEdtLab.setText(""); clear(); } else { lEdtLab.setText("No Existe o Error"); } } @FXML private void bBuscar(ActionEvent event){ clear(); tEdtCod.setText(tEdtCod.getText().trim()); if(!DbCapos.existeProducto(tEdtCod.getText())==false && !tEdtCod.getText().equals("Ya Existe!") && !tEdtCod.getText().equals("")){ String[] valores = DbCapos.selectProduct(tEdtCod.getText()); tEdtNom.setText(valores[0]);//Imprime el nombre en el textbox tEdtPre.setText(valores[2]);//Imprime el precio en el textbox tEdtCan.setText(valores[3]);//Imprime la cantidad en el textbox } else { lEdtLab.setText("No Existe o Error"); } } @FXML private void bEditar(ActionEvent event){ tEdtCod.setText(tEdtCod.getText().trim()); tEdtNom.setText(tEdtNom.getText().trim()); tEdtCan.setText(tEdtCan.getText().trim()); tEdtPre.setText(tEdtPre.getText().trim()); if(!DbCapos.existeProducto(tEdtCod.getText())==false && !tEdtCod.getText().equals("Ya Existe!") && !tEdtCod.getText().equals("")){ try { DbCapos.updateProducto(tEdtCod.getText(), tEdtNom.getText(), Float.parseFloat(tEdtPre.getText()), Integer.parseInt(tEdtCan.getText())); lEdtLab.setText(""); tEdtCan.setStyle("-fx-background-color: white;"); tEdtPre.setStyle("-fx-background-color: white;"); clear(); } catch (Exception e) { System.out.println("Error, solo se pueden numeros."); tEdtPre.setStyle("-fx-background-color: red;"); tEdtCan.setStyle("-fx-background-color: red;"); lEdtLab.setText("Numeros Invalidos"); } } } @FXML private void bRegistrar(ActionEvent event){ tRegCod.setText(tRegCod.getText().trim()); tRegNom.setText(tRegNom.getText().trim()); tRegCan.setText(tRegCan.getText().trim()); tRegPre.setText(tRegPre.getText().trim()); try { if (tRegCod.getText().length()>10 || tRegNom.getText().length()>10){ throw new Exception("Tamano de Caracteres"); } if(DbCapos.existeProducto(tRegCod.getText())==false && !tRegCod.getText().equals("Ya Existe!") && !tRegCod.getText().equals("")){ DbCapos.insertProducto(tRegCod.getText(), tRegNom.getText(), Float.parseFloat(tRegPre.getText()), Integer.parseInt(tRegCan.getText())); tRegPre.setStyle("-fx-background-color: white;"); tRegCan.setStyle("-fx-background-color: white;"); tRegCod.setText(""); tRegNom.setText(""); tRegCan.setText(""); tRegPre.setText(""); lRegLab.setText(""); clear(); } else { lRegLab.setText("Ya Existe o Error"); } } catch (NumberFormatException e){ System.out.println("Error, solo se pueden numeros. Codigo y nombre solo puede hasta 10 caracteres."); lRegLab.setText("Error: Numberos Invalidos"); tRegPre.setStyle("-fx-background-color: red;"); tRegCan.setStyle("-fx-background-color: red;"); } catch (Exception e) { System.out.println("Error, solo se pueden numeros. Codigo y nombre solo puede hasta 10 caracteres."); lRegLab.setText("Error: Codigo y/o Nombre Tamano de Caracteres Invalido"); } } }
antoniotorres/CAPOS
src/main/inventarioController.java
Java
gpl-3.0
6,990
/* * Copyright 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * */ #ifndef _CGS_COMMON_H #define _CGS_COMMON_H #include "amd_shared.h" struct cgs_device; /** * enum cgs_gpu_mem_type - GPU memory types */ enum cgs_gpu_mem_type { CGS_GPU_MEM_TYPE__VISIBLE_FB, CGS_GPU_MEM_TYPE__INVISIBLE_FB, CGS_GPU_MEM_TYPE__VISIBLE_CONTIG_FB, CGS_GPU_MEM_TYPE__INVISIBLE_CONTIG_FB, CGS_GPU_MEM_TYPE__GART_CACHEABLE, CGS_GPU_MEM_TYPE__GART_WRITECOMBINE }; /** * enum cgs_ind_reg - Indirect register spaces */ enum cgs_ind_reg { CGS_IND_REG__MMIO, CGS_IND_REG__PCIE, CGS_IND_REG__SMC, CGS_IND_REG__UVD_CTX, CGS_IND_REG__DIDT, CGS_IND_REG_GC_CAC, CGS_IND_REG__AUDIO_ENDPT }; /** * enum cgs_clock - Clocks controlled by the SMU */ enum cgs_clock { CGS_CLOCK__SCLK, CGS_CLOCK__MCLK, CGS_CLOCK__VCLK, CGS_CLOCK__DCLK, CGS_CLOCK__ECLK, CGS_CLOCK__ACLK, CGS_CLOCK__ICLK, /* ... */ }; /** * enum cgs_engine - Engines that can be statically power-gated */ enum cgs_engine { CGS_ENGINE__UVD, CGS_ENGINE__VCE, CGS_ENGINE__VP8, CGS_ENGINE__ACP_DMA, CGS_ENGINE__ACP_DSP0, CGS_ENGINE__ACP_DSP1, CGS_ENGINE__ISP, /* ... */ }; /** * enum cgs_voltage_planes - Voltage planes for external camera HW */ enum cgs_voltage_planes { CGS_VOLTAGE_PLANE__SENSOR0, CGS_VOLTAGE_PLANE__SENSOR1, /* ... */ }; /* * enum cgs_ucode_id - Firmware types for different IPs */ enum cgs_ucode_id { CGS_UCODE_ID_SMU = 0, CGS_UCODE_ID_SMU_SK, CGS_UCODE_ID_SDMA0, CGS_UCODE_ID_SDMA1, CGS_UCODE_ID_CP_CE, CGS_UCODE_ID_CP_PFP, CGS_UCODE_ID_CP_ME, CGS_UCODE_ID_CP_MEC, CGS_UCODE_ID_CP_MEC_JT1, CGS_UCODE_ID_CP_MEC_JT2, CGS_UCODE_ID_GMCON_RENG, CGS_UCODE_ID_RLC_G, CGS_UCODE_ID_MAXIMUM, }; enum cgs_system_info_id { CGS_SYSTEM_INFO_ADAPTER_BDF_ID = 1, CGS_SYSTEM_INFO_PCIE_GEN_INFO, CGS_SYSTEM_INFO_PCIE_MLW, CGS_SYSTEM_INFO_PCIE_DEV, CGS_SYSTEM_INFO_PCIE_REV, CGS_SYSTEM_INFO_CG_FLAGS, CGS_SYSTEM_INFO_PG_FLAGS, CGS_SYSTEM_INFO_GFX_CU_INFO, CGS_SYSTEM_INFO_GFX_SE_INFO, CGS_SYSTEM_INFO_PCIE_SUB_SYS_ID, CGS_SYSTEM_INFO_PCIE_SUB_SYS_VENDOR_ID, CGS_SYSTEM_INFO_ID_MAXIMUM, }; struct cgs_system_info { uint64_t size; enum cgs_system_info_id info_id; union { void *ptr; uint64_t value; }; uint64_t padding[13]; }; /* * enum cgs_resource_type - GPU resource type */ enum cgs_resource_type { CGS_RESOURCE_TYPE_MMIO = 0, CGS_RESOURCE_TYPE_FB, CGS_RESOURCE_TYPE_IO, CGS_RESOURCE_TYPE_DOORBELL, CGS_RESOURCE_TYPE_ROM, }; /** * struct cgs_clock_limits - Clock limits * * Clocks are specified in 10KHz units. */ struct cgs_clock_limits { unsigned min; /**< Minimum supported frequency */ unsigned max; /**< Maxumim supported frequency */ unsigned sustainable; /**< Thermally sustainable frequency */ }; /** * struct cgs_firmware_info - Firmware information */ struct cgs_firmware_info { uint16_t version; uint16_t fw_version; uint16_t feature_version; uint32_t image_size; uint64_t mc_addr; /* only for smc firmware */ uint32_t ucode_start_address; void *kptr; }; struct cgs_mode_info { uint32_t refresh_rate; uint32_t ref_clock; uint32_t vblank_time_us; }; struct cgs_display_info { uint32_t display_count; uint32_t active_display_mask; struct cgs_mode_info *mode_info; }; typedef unsigned long cgs_handle_t; #define CGS_ACPI_METHOD_ATCS 0x53435441 #define CGS_ACPI_METHOD_ATIF 0x46495441 #define CGS_ACPI_METHOD_ATPX 0x58505441 #define CGS_ACPI_FIELD_METHOD_NAME 0x00000001 #define CGS_ACPI_FIELD_INPUT_ARGUMENT_COUNT 0x00000002 #define CGS_ACPI_MAX_BUFFER_SIZE 256 #define CGS_ACPI_TYPE_ANY 0x00 #define CGS_ACPI_TYPE_INTEGER 0x01 #define CGS_ACPI_TYPE_STRING 0x02 #define CGS_ACPI_TYPE_BUFFER 0x03 #define CGS_ACPI_TYPE_PACKAGE 0x04 struct cgs_acpi_method_argument { uint32_t type; uint32_t data_length; union { uint32_t value; void *pointer; }; }; struct cgs_acpi_method_info { uint32_t size; uint32_t field; uint32_t input_count; uint32_t name; struct cgs_acpi_method_argument *pinput_argument; uint32_t output_count; struct cgs_acpi_method_argument *poutput_argument; uint32_t padding[9]; }; /** * cgs_gpu_mem_info() - Return information about memory heaps * @cgs_device: opaque device handle * @type: memory type * @mc_start: Start MC address of the heap (output) * @mc_size: MC address space size (output) * @mem_size: maximum amount of memory available for allocation (output) * * This function returns information about memory heaps. The type * parameter is used to select the memory heap. The mc_start and * mc_size for GART heaps may be bigger than the memory available for * allocation. * * mc_start and mc_size are undefined for non-contiguous FB memory * types, since buffers allocated with these types may or may not be * GART mapped. * * Return: 0 on success, -errno otherwise */ typedef int (*cgs_gpu_mem_info_t)(struct cgs_device *cgs_device, enum cgs_gpu_mem_type type, uint64_t *mc_start, uint64_t *mc_size, uint64_t *mem_size); /** * cgs_gmap_kmem() - map kernel memory to GART aperture * @cgs_device: opaque device handle * @kmem: pointer to kernel memory * @size: size to map * @min_offset: minimum offset from start of GART aperture * @max_offset: maximum offset from start of GART aperture * @kmem_handle: kernel memory handle (output) * @mcaddr: MC address (output) * * Return: 0 on success, -errno otherwise */ typedef int (*cgs_gmap_kmem_t)(struct cgs_device *cgs_device, void *kmem, uint64_t size, uint64_t min_offset, uint64_t max_offset, cgs_handle_t *kmem_handle, uint64_t *mcaddr); /** * cgs_gunmap_kmem() - unmap kernel memory * @cgs_device: opaque device handle * @kmem_handle: kernel memory handle returned by gmap_kmem * * Return: 0 on success, -errno otherwise */ typedef int (*cgs_gunmap_kmem_t)(struct cgs_device *cgs_device, cgs_handle_t kmem_handle); /** * cgs_alloc_gpu_mem() - Allocate GPU memory * @cgs_device: opaque device handle * @type: memory type * @size: size in bytes * @align: alignment in bytes * @min_offset: minimum offset from start of heap * @max_offset: maximum offset from start of heap * @handle: memory handle (output) * * The memory types CGS_GPU_MEM_TYPE_*_CONTIG_FB force contiguous * memory allocation. This guarantees that the MC address returned by * cgs_gmap_gpu_mem is not mapped through the GART. The non-contiguous * FB memory types may be GART mapped depending on memory * fragmentation and memory allocator policies. * * If min/max_offset are non-0, the allocation will be forced to * reside between these offsets in its respective memory heap. The * base address that the offset relates to, depends on the memory * type. * * - CGS_GPU_MEM_TYPE__*_CONTIG_FB: FB MC base address * - CGS_GPU_MEM_TYPE__GART_*: GART aperture base address * - others: undefined, don't use with max_offset * * Return: 0 on success, -errno otherwise */ typedef int (*cgs_alloc_gpu_mem_t)(struct cgs_device *cgs_device, enum cgs_gpu_mem_type type, uint64_t size, uint64_t align, uint64_t min_offset, uint64_t max_offset, cgs_handle_t *handle); /** * cgs_free_gpu_mem() - Free GPU memory * @cgs_device: opaque device handle * @handle: memory handle returned by alloc or import * * Return: 0 on success, -errno otherwise */ typedef int (*cgs_free_gpu_mem_t)(struct cgs_device *cgs_device, cgs_handle_t handle); /** * cgs_gmap_gpu_mem() - GPU-map GPU memory * @cgs_device: opaque device handle * @handle: memory handle returned by alloc or import * @mcaddr: MC address (output) * * Ensures that a buffer is GPU accessible and returns its MC address. * * Return: 0 on success, -errno otherwise */ typedef int (*cgs_gmap_gpu_mem_t)(struct cgs_device *cgs_device, cgs_handle_t handle, uint64_t *mcaddr); /** * cgs_gunmap_gpu_mem() - GPU-unmap GPU memory * @cgs_device: opaque device handle * @handle: memory handle returned by alloc or import * * Allows the buffer to be migrated while it's not used by the GPU. * * Return: 0 on success, -errno otherwise */ typedef int (*cgs_gunmap_gpu_mem_t)(struct cgs_device *cgs_device, cgs_handle_t handle); /** * cgs_kmap_gpu_mem() - Kernel-map GPU memory * * @cgs_device: opaque device handle * @handle: memory handle returned by alloc or import * @map: Kernel virtual address the memory was mapped to (output) * * Return: 0 on success, -errno otherwise */ typedef int (*cgs_kmap_gpu_mem_t)(struct cgs_device *cgs_device, cgs_handle_t handle, void **map); /** * cgs_kunmap_gpu_mem() - Kernel-unmap GPU memory * @cgs_device: opaque device handle * @handle: memory handle returned by alloc or import * * Return: 0 on success, -errno otherwise */ typedef int (*cgs_kunmap_gpu_mem_t)(struct cgs_device *cgs_device, cgs_handle_t handle); /** * cgs_read_register() - Read an MMIO register * @cgs_device: opaque device handle * @offset: register offset * * Return: register value */ typedef uint32_t (*cgs_read_register_t)(struct cgs_device *cgs_device, unsigned offset); /** * cgs_write_register() - Write an MMIO register * @cgs_device: opaque device handle * @offset: register offset * @value: register value */ typedef void (*cgs_write_register_t)(struct cgs_device *cgs_device, unsigned offset, uint32_t value); /** * cgs_read_ind_register() - Read an indirect register * @cgs_device: opaque device handle * @offset: register offset * * Return: register value */ typedef uint32_t (*cgs_read_ind_register_t)(struct cgs_device *cgs_device, enum cgs_ind_reg space, unsigned index); /** * cgs_write_ind_register() - Write an indirect register * @cgs_device: opaque device handle * @offset: register offset * @value: register value */ typedef void (*cgs_write_ind_register_t)(struct cgs_device *cgs_device, enum cgs_ind_reg space, unsigned index, uint32_t value); /** * cgs_read_pci_config_byte() - Read byte from PCI configuration space * @cgs_device: opaque device handle * @addr: address * * Return: Value read */ typedef uint8_t (*cgs_read_pci_config_byte_t)(struct cgs_device *cgs_device, unsigned addr); /** * cgs_read_pci_config_word() - Read word from PCI configuration space * @cgs_device: opaque device handle * @addr: address, must be word-aligned * * Return: Value read */ typedef uint16_t (*cgs_read_pci_config_word_t)(struct cgs_device *cgs_device, unsigned addr); /** * cgs_read_pci_config_dword() - Read dword from PCI configuration space * @cgs_device: opaque device handle * @addr: address, must be dword-aligned * * Return: Value read */ typedef uint32_t (*cgs_read_pci_config_dword_t)(struct cgs_device *cgs_device, unsigned addr); /** * cgs_write_pci_config_byte() - Write byte to PCI configuration space * @cgs_device: opaque device handle * @addr: address * @value: value to write */ typedef void (*cgs_write_pci_config_byte_t)(struct cgs_device *cgs_device, unsigned addr, uint8_t value); /** * cgs_write_pci_config_word() - Write byte to PCI configuration space * @cgs_device: opaque device handle * @addr: address, must be word-aligned * @value: value to write */ typedef void (*cgs_write_pci_config_word_t)(struct cgs_device *cgs_device, unsigned addr, uint16_t value); /** * cgs_write_pci_config_dword() - Write byte to PCI configuration space * @cgs_device: opaque device handle * @addr: address, must be dword-aligned * @value: value to write */ typedef void (*cgs_write_pci_config_dword_t)(struct cgs_device *cgs_device, unsigned addr, uint32_t value); /** * cgs_get_pci_resource() - provide access to a device resource (PCI BAR) * @cgs_device: opaque device handle * @resource_type: Type of Resource (MMIO, IO, ROM, FB, DOORBELL) * @size: size of the region * @offset: offset from the start of the region * @resource_base: base address (not including offset) returned * * Return: 0 on success, -errno otherwise */ typedef int (*cgs_get_pci_resource_t)(struct cgs_device *cgs_device, enum cgs_resource_type resource_type, uint64_t size, uint64_t offset, uint64_t *resource_base); /** * cgs_atom_get_data_table() - Get a pointer to an ATOM BIOS data table * @cgs_device: opaque device handle * @table: data table index * @size: size of the table (output, may be NULL) * @frev: table format revision (output, may be NULL) * @crev: table content revision (output, may be NULL) * * Return: Pointer to start of the table, or NULL on failure */ typedef const void *(*cgs_atom_get_data_table_t)( struct cgs_device *cgs_device, unsigned table, uint16_t *size, uint8_t *frev, uint8_t *crev); /** * cgs_atom_get_cmd_table_revs() - Get ATOM BIOS command table revisions * @cgs_device: opaque device handle * @table: data table index * @frev: table format revision (output, may be NULL) * @crev: table content revision (output, may be NULL) * * Return: 0 on success, -errno otherwise */ typedef int (*cgs_atom_get_cmd_table_revs_t)(struct cgs_device *cgs_device, unsigned table, uint8_t *frev, uint8_t *crev); /** * cgs_atom_exec_cmd_table() - Execute an ATOM BIOS command table * @cgs_device: opaque device handle * @table: command table index * @args: arguments * * Return: 0 on success, -errno otherwise */ typedef int (*cgs_atom_exec_cmd_table_t)(struct cgs_device *cgs_device, unsigned table, void *args); /** * cgs_create_pm_request() - Create a power management request * @cgs_device: opaque device handle * @request: handle of created PM request (output) * * Return: 0 on success, -errno otherwise */ typedef int (*cgs_create_pm_request_t)(struct cgs_device *cgs_device, cgs_handle_t *request); /** * cgs_destroy_pm_request() - Destroy a power management request * @cgs_device: opaque device handle * @request: handle of created PM request * * Return: 0 on success, -errno otherwise */ typedef int (*cgs_destroy_pm_request_t)(struct cgs_device *cgs_device, cgs_handle_t request); /** * cgs_set_pm_request() - Activate or deactiveate a PM request * @cgs_device: opaque device handle * @request: PM request handle * @active: 0 = deactivate, non-0 = activate * * While a PM request is active, its minimum clock requests are taken * into account as the requested engines are powered up. When the * request is inactive, the engines may be powered down and clocks may * be lower, depending on other PM requests by other driver * components. * * Return: 0 on success, -errno otherwise */ typedef int (*cgs_set_pm_request_t)(struct cgs_device *cgs_device, cgs_handle_t request, int active); /** * cgs_pm_request_clock() - Request a minimum frequency for a specific clock * @cgs_device: opaque device handle * @request: PM request handle * @clock: which clock? * @freq: requested min. frequency in 10KHz units (0 to clear request) * * Return: 0 on success, -errno otherwise */ typedef int (*cgs_pm_request_clock_t)(struct cgs_device *cgs_device, cgs_handle_t request, enum cgs_clock clock, unsigned freq); /** * cgs_pm_request_engine() - Request an engine to be powered up * @cgs_device: opaque device handle * @request: PM request handle * @engine: which engine? * @powered: 0 = powered down, non-0 = powered up * * Return: 0 on success, -errno otherwise */ typedef int (*cgs_pm_request_engine_t)(struct cgs_device *cgs_device, cgs_handle_t request, enum cgs_engine engine, int powered); /** * cgs_pm_query_clock_limits() - Query clock frequency limits * @cgs_device: opaque device handle * @clock: which clock? * @limits: clock limits * * Return: 0 on success, -errno otherwise */ typedef int (*cgs_pm_query_clock_limits_t)(struct cgs_device *cgs_device, enum cgs_clock clock, struct cgs_clock_limits *limits); /** * cgs_set_camera_voltages() - Apply specific voltages to PMIC voltage planes * @cgs_device: opaque device handle * @mask: bitmask of voltages to change (1<<CGS_VOLTAGE_PLANE__xyz|...) * @voltages: pointer to array of voltage values in 1mV units * * Return: 0 on success, -errno otherwise */ typedef int (*cgs_set_camera_voltages_t)(struct cgs_device *cgs_device, uint32_t mask, const uint32_t *voltages); /** * cgs_get_firmware_info - Get the firmware information from core driver * @cgs_device: opaque device handle * @type: the firmware type * @info: returend firmware information * * Return: 0 on success, -errno otherwise */ typedef int (*cgs_get_firmware_info)(struct cgs_device *cgs_device, enum cgs_ucode_id type, struct cgs_firmware_info *info); typedef int (*cgs_rel_firmware)(struct cgs_device *cgs_device, enum cgs_ucode_id type); typedef int(*cgs_set_powergating_state)(struct cgs_device *cgs_device, enum amd_ip_block_type block_type, enum amd_powergating_state state); typedef int(*cgs_set_clockgating_state)(struct cgs_device *cgs_device, enum amd_ip_block_type block_type, enum amd_clockgating_state state); typedef int(*cgs_get_active_displays_info)( struct cgs_device *cgs_device, struct cgs_display_info *info); typedef int (*cgs_notify_dpm_enabled)(struct cgs_device *cgs_device, bool enabled); typedef int (*cgs_call_acpi_method)(struct cgs_device *cgs_device, uint32_t acpi_method, uint32_t acpi_function, void *pinput, void *poutput, uint32_t output_count, uint32_t input_size, uint32_t output_size); typedef int (*cgs_query_system_info)(struct cgs_device *cgs_device, struct cgs_system_info *sys_info); struct cgs_ops { /* memory management calls (similar to KFD interface) */ cgs_gpu_mem_info_t gpu_mem_info; cgs_gmap_kmem_t gmap_kmem; cgs_gunmap_kmem_t gunmap_kmem; cgs_alloc_gpu_mem_t alloc_gpu_mem; cgs_free_gpu_mem_t free_gpu_mem; cgs_gmap_gpu_mem_t gmap_gpu_mem; cgs_gunmap_gpu_mem_t gunmap_gpu_mem; cgs_kmap_gpu_mem_t kmap_gpu_mem; cgs_kunmap_gpu_mem_t kunmap_gpu_mem; /* MMIO access */ cgs_read_register_t read_register; cgs_write_register_t write_register; cgs_read_ind_register_t read_ind_register; cgs_write_ind_register_t write_ind_register; /* PCI configuration space access */ cgs_read_pci_config_byte_t read_pci_config_byte; cgs_read_pci_config_word_t read_pci_config_word; cgs_read_pci_config_dword_t read_pci_config_dword; cgs_write_pci_config_byte_t write_pci_config_byte; cgs_write_pci_config_word_t write_pci_config_word; cgs_write_pci_config_dword_t write_pci_config_dword; /* PCI resources */ cgs_get_pci_resource_t get_pci_resource; /* ATOM BIOS */ cgs_atom_get_data_table_t atom_get_data_table; cgs_atom_get_cmd_table_revs_t atom_get_cmd_table_revs; cgs_atom_exec_cmd_table_t atom_exec_cmd_table; /* Power management */ cgs_create_pm_request_t create_pm_request; cgs_destroy_pm_request_t destroy_pm_request; cgs_set_pm_request_t set_pm_request; cgs_pm_request_clock_t pm_request_clock; cgs_pm_request_engine_t pm_request_engine; cgs_pm_query_clock_limits_t pm_query_clock_limits; cgs_set_camera_voltages_t set_camera_voltages; /* Firmware Info */ cgs_get_firmware_info get_firmware_info; cgs_rel_firmware rel_firmware; /* cg pg interface*/ cgs_set_powergating_state set_powergating_state; cgs_set_clockgating_state set_clockgating_state; /* display manager */ cgs_get_active_displays_info get_active_displays_info; /* notify dpm enabled */ cgs_notify_dpm_enabled notify_dpm_enabled; /* ACPI */ cgs_call_acpi_method call_acpi_method; /* get system info */ cgs_query_system_info query_system_info; }; struct cgs_os_ops; /* To be define in OS-specific CGS header */ struct cgs_device { const struct cgs_ops *ops; const struct cgs_os_ops *os_ops; /* to be embedded at the start of driver private structure */ }; /* Convenience macros that make CGS indirect function calls look like * normal function calls */ #define CGS_CALL(func,dev,...) \ (((struct cgs_device *)dev)->ops->func(dev, ##__VA_ARGS__)) #define CGS_OS_CALL(func,dev,...) \ (((struct cgs_device *)dev)->os_ops->func(dev, ##__VA_ARGS__)) #define cgs_gpu_mem_info(dev,type,mc_start,mc_size,mem_size) \ CGS_CALL(gpu_mem_info,dev,type,mc_start,mc_size,mem_size) #define cgs_gmap_kmem(dev,kmem,size,min_off,max_off,kmem_handle,mcaddr) \ CGS_CALL(gmap_kmem,dev,kmem,size,min_off,max_off,kmem_handle,mcaddr) #define cgs_gunmap_kmem(dev,kmem_handle) \ CGS_CALL(gunmap_kmem,dev,keme_handle) #define cgs_alloc_gpu_mem(dev,type,size,align,min_off,max_off,handle) \ CGS_CALL(alloc_gpu_mem,dev,type,size,align,min_off,max_off,handle) #define cgs_free_gpu_mem(dev,handle) \ CGS_CALL(free_gpu_mem,dev,handle) #define cgs_gmap_gpu_mem(dev,handle,mcaddr) \ CGS_CALL(gmap_gpu_mem,dev,handle,mcaddr) #define cgs_gunmap_gpu_mem(dev,handle) \ CGS_CALL(gunmap_gpu_mem,dev,handle) #define cgs_kmap_gpu_mem(dev,handle,map) \ CGS_CALL(kmap_gpu_mem,dev,handle,map) #define cgs_kunmap_gpu_mem(dev,handle) \ CGS_CALL(kunmap_gpu_mem,dev,handle) #define cgs_read_register(dev,offset) \ CGS_CALL(read_register,dev,offset) #define cgs_write_register(dev,offset,value) \ CGS_CALL(write_register,dev,offset,value) #define cgs_read_ind_register(dev,space,index) \ CGS_CALL(read_ind_register,dev,space,index) #define cgs_write_ind_register(dev,space,index,value) \ CGS_CALL(write_ind_register,dev,space,index,value) #define cgs_read_pci_config_byte(dev,addr) \ CGS_CALL(read_pci_config_byte,dev,addr) #define cgs_read_pci_config_word(dev,addr) \ CGS_CALL(read_pci_config_word,dev,addr) #define cgs_read_pci_config_dword(dev,addr) \ CGS_CALL(read_pci_config_dword,dev,addr) #define cgs_write_pci_config_byte(dev,addr,value) \ CGS_CALL(write_pci_config_byte,dev,addr,value) #define cgs_write_pci_config_word(dev,addr,value) \ CGS_CALL(write_pci_config_word,dev,addr,value) #define cgs_write_pci_config_dword(dev,addr,value) \ CGS_CALL(write_pci_config_dword,dev,addr,value) #define cgs_atom_get_data_table(dev,table,size,frev,crev) \ CGS_CALL(atom_get_data_table,dev,table,size,frev,crev) #define cgs_atom_get_cmd_table_revs(dev,table,frev,crev) \ CGS_CALL(atom_get_cmd_table_revs,dev,table,frev,crev) #define cgs_atom_exec_cmd_table(dev,table,args) \ CGS_CALL(atom_exec_cmd_table,dev,table,args) #define cgs_create_pm_request(dev,request) \ CGS_CALL(create_pm_request,dev,request) #define cgs_destroy_pm_request(dev,request) \ CGS_CALL(destroy_pm_request,dev,request) #define cgs_set_pm_request(dev,request,active) \ CGS_CALL(set_pm_request,dev,request,active) #define cgs_pm_request_clock(dev,request,clock,freq) \ CGS_CALL(pm_request_clock,dev,request,clock,freq) #define cgs_pm_request_engine(dev,request,engine,powered) \ CGS_CALL(pm_request_engine,dev,request,engine,powered) #define cgs_pm_query_clock_limits(dev,clock,limits) \ CGS_CALL(pm_query_clock_limits,dev,clock,limits) #define cgs_set_camera_voltages(dev,mask,voltages) \ CGS_CALL(set_camera_voltages,dev,mask,voltages) #define cgs_get_firmware_info(dev, type, info) \ CGS_CALL(get_firmware_info, dev, type, info) #define cgs_rel_firmware(dev, type) \ CGS_CALL(rel_firmware, dev, type) #define cgs_set_powergating_state(dev, block_type, state) \ CGS_CALL(set_powergating_state, dev, block_type, state) #define cgs_set_clockgating_state(dev, block_type, state) \ CGS_CALL(set_clockgating_state, dev, block_type, state) #define cgs_notify_dpm_enabled(dev, enabled) \ CGS_CALL(notify_dpm_enabled, dev, enabled) #define cgs_get_active_displays_info(dev, info) \ CGS_CALL(get_active_displays_info, dev, info) #define cgs_call_acpi_method(dev, acpi_method, acpi_function, pintput, poutput, output_count, input_size, output_size) \ CGS_CALL(call_acpi_method, dev, acpi_method, acpi_function, pintput, poutput, output_count, input_size, output_size) #define cgs_query_system_info(dev, sys_info) \ CGS_CALL(query_system_info, dev, sys_info) #define cgs_get_pci_resource(cgs_device, resource_type, size, offset, \ resource_base) \ CGS_CALL(get_pci_resource, cgs_device, resource_type, size, offset, \ resource_base) #endif /* _CGS_COMMON_H */
williamfdevine/PrettyLinux
drivers/gpu/drm/amd/include/cgs_common.h
C
gpl-3.0
25,282
/** * Copyright (C) 2001-2016 by RapidMiner and the contributors * * Complete list of developers available at our web site: * * http://rapidminer.com * * This program is free software: you can redistribute it and/or modify it under the terms of the * GNU Affero General Public License as published by the Free Software Foundation, either version 3 * of the License, or (at your option) any later version. * * 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/. */ package com.rapidminer.operator; import com.rapidminer.operator.meta.FeatureIterator; import com.rapidminer.operator.ports.DummyPortPairExtender; import com.rapidminer.operator.ports.PortPairExtender; import com.rapidminer.parameter.ParameterType; import com.rapidminer.parameter.ParameterTypeString; import com.rapidminer.parameter.UndefinedParameterError; import java.util.List; /** * <p> * (Re-)Define macros for the current process. Macros will be replaced in the value strings of * parameters by the macro values defined as a parameter of this operator. In contrast to the usual * MacroDefinitionOperator, this operator only supports the definition of a single macro and can * hence be used inside of parameter iterations. * </p> * * <p> * You have to define the macro name (without the enclosing brackets) and the macro value. The * defined macro can then be used in all succeeding operators as parameter value. A macro must then * be enclosed by &quot;MACRO_START&quot; and &quot;MACRO_END&quot;. * </p> * * <p> * There are several predefined macros: * </p> * <ul> * <li>MACRO_STARTprocess_nameMACRO_END: will be replaced by the name of the process (without path * and extension)</li> * <li>MACRO_STARTprocess_fileMACRO_END: will be replaced by the file name of the process (with * extension)</li> * <li>MACRO_STARTprocess_pathMACRO_END: will be replaced by the complete absolute path of the * process file</li> * </ul> * * <p> * In addition to those the user might define arbitrary other macros which will be replaced by * arbitrary strings during the process run. Please note also that several other short macros exist, * e.g. MACRO_STARTaMACRO_END for the number of times the current operator was applied. Please refer * to the section about macros in the RapidMiner tutorial. Please note also that other operators * like the {@link FeatureIterator} also add specific macros. * </p> * * @author Ingo Mierswa */ public class SingleMacroDefinitionOperator extends Operator { /** The parameter name for &quot;The values of the user defined macros.&quot; */ public static final String PARAMETER_MACRO = "macro"; public static final String PARAMETER_VALUE = "value"; private PortPairExtender dummyPorts = new DummyPortPairExtender("through", getInputPorts(), getOutputPorts()); public SingleMacroDefinitionOperator(OperatorDescription description) { super(description); dummyPorts.start(); getTransformer().addRule(dummyPorts.makePassThroughRule()); addValue(new ValueString("macro_name", "The name of the macro.") { @Override public String getStringValue() { try { return getParameterAsString(PARAMETER_MACRO); } catch (UndefinedParameterError e) { return null; } } }); addValue(new ValueString("macro_value", "The value of the macro.") { @Override public String getStringValue() { try { return getParameterAsString(PARAMETER_VALUE); } catch (UndefinedParameterError e) { return null; } } }); } @Override public void doWork() throws OperatorException { String macro = getParameterAsString(PARAMETER_MACRO); String value = getParameterAsString(PARAMETER_VALUE); if (value == null) { value = ""; } getProcess().getMacroHandler().addMacro(macro, value); dummyPorts.passDataThrough(); } @Override public List<ParameterType> getParameterTypes() { List<ParameterType> types = super.getParameterTypes(); types.add(new ParameterTypeString(PARAMETER_MACRO, "The macro name defined by the user.", false, false)); types.add(new ParameterTypeString(PARAMETER_VALUE, "The macro value defined by the user.", true, false)); return types; } }
transwarpio/rapidminer
rapidMiner/rapidminer-studio-core/src/main/java/com/rapidminer/operator/SingleMacroDefinitionOperator.java
Java
gpl-3.0
4,644
/* Authors: Pavel Březina <pbrezina@redhat.com> Copyright (C) 2013 Red Hat 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/>. */ #include <tevent.h> #include <talloc.h> #include <time.h> #include <string.h> #include "util/util.h" #include "providers/dp_backend.h" #include "providers/dp_ptask_private.h" #include "providers/dp_ptask.h" #define backoff_allowed(ptask) (ptask->max_backoff != 0) enum be_ptask_schedule { BE_PTASK_SCHEDULE_FROM_NOW, BE_PTASK_SCHEDULE_FROM_LAST }; enum be_ptask_delay { BE_PTASK_FIRST_DELAY, BE_PTASK_ENABLED_DELAY, BE_PTASK_PERIOD }; static void be_ptask_schedule(struct be_ptask *task, enum be_ptask_delay delay_type, enum be_ptask_schedule from); static int be_ptask_destructor(void *pvt) { struct be_ptask *task; task = talloc_get_type(pvt, struct be_ptask); if (task == NULL) { DEBUG(SSSDBG_FATAL_FAILURE, "BUG: task is NULL\n"); return 0; } DEBUG(SSSDBG_TRACE_FUNC, "Terminating periodic task [%s]\n", task->name); return 0; } static void be_ptask_online_cb(void *pvt) { struct be_ptask *task = NULL; task = talloc_get_type(pvt, struct be_ptask); if (task == NULL) { DEBUG(SSSDBG_FATAL_FAILURE, "BUG: task is NULL\n"); return; } DEBUG(SSSDBG_TRACE_FUNC, "Back end is online\n"); be_ptask_enable(task); } static void be_ptask_offline_cb(void *pvt) { struct be_ptask *task = NULL; task = talloc_get_type(pvt, struct be_ptask); DEBUG(SSSDBG_TRACE_FUNC, "Back end is offline\n"); be_ptask_disable(task); } static void be_ptask_timeout(struct tevent_context *ev, struct tevent_timer *tt, struct timeval tv, void *pvt) { struct be_ptask *task = NULL; task = talloc_get_type(pvt, struct be_ptask); DEBUG(SSSDBG_OP_FAILURE, "Task [%s]: timed out\n", task->name); talloc_zfree(task->req); be_ptask_schedule(task, BE_PTASK_PERIOD, BE_PTASK_SCHEDULE_FROM_NOW); } static void be_ptask_done(struct tevent_req *req); static void be_ptask_execute(struct tevent_context *ev, struct tevent_timer *tt, struct timeval tv, void *pvt) { struct be_ptask *task = NULL; struct tevent_timer *timeout = NULL; task = talloc_get_type(pvt, struct be_ptask); task->timer = NULL; /* timer is freed by tevent */ if (be_is_offline(task->be_ctx)) { DEBUG(SSSDBG_TRACE_FUNC, "Back end is offline\n"); switch (task->offline) { case BE_PTASK_OFFLINE_SKIP: be_ptask_schedule(task, BE_PTASK_PERIOD, BE_PTASK_SCHEDULE_FROM_NOW); return; case BE_PTASK_OFFLINE_DISABLE: /* This case is normally handled by offline callback but we * should handle it here as well since we can get here in some * special cases for example unit tests or tevent events order. */ be_ptask_disable(task); return; case BE_PTASK_OFFLINE_EXECUTE: /* continue */ break; } } DEBUG(SSSDBG_TRACE_FUNC, "Task [%s]: executing task, timeout %lu " "seconds\n", task->name, task->timeout); task->last_execution = tv.tv_sec; task->req = task->send_fn(task, task->ev, task->be_ctx, task, task->pvt); if (task->req == NULL) { /* skip this iteration and try again later */ DEBUG(SSSDBG_OP_FAILURE, "Task [%s]: failed to execute task, " "will try again later\n", task->name); be_ptask_schedule(task, BE_PTASK_PERIOD, BE_PTASK_SCHEDULE_FROM_NOW); return; } tevent_req_set_callback(task->req, be_ptask_done, task); /* schedule timeout */ if (task->timeout > 0) { tv = tevent_timeval_current_ofs(task->timeout, 0); timeout = tevent_add_timer(task->ev, task->req, tv, be_ptask_timeout, task); if (timeout == NULL) { /* If we can't guarantee a timeout, * we need to cancel the request. */ talloc_zfree(task->req); DEBUG(SSSDBG_OP_FAILURE, "Task [%s]: failed to set timeout, " "the task will be rescheduled\n", task->name); be_ptask_schedule(task, BE_PTASK_PERIOD, BE_PTASK_SCHEDULE_FROM_NOW); } } return; } static void be_ptask_done(struct tevent_req *req) { struct be_ptask *task = NULL; errno_t ret; task = tevent_req_callback_data(req, struct be_ptask); ret = task->recv_fn(req); talloc_zfree(req); task->req = NULL; switch (ret) { case EOK: DEBUG(SSSDBG_TRACE_FUNC, "Task [%s]: finished successfully\n", task->name); be_ptask_schedule(task, BE_PTASK_PERIOD, BE_PTASK_SCHEDULE_FROM_LAST); break; default: DEBUG(SSSDBG_OP_FAILURE, "Task [%s]: failed with [%d]: %s\n", task->name, ret, sss_strerror(ret)); be_ptask_schedule(task, BE_PTASK_PERIOD, BE_PTASK_SCHEDULE_FROM_NOW); break; } } static void be_ptask_schedule(struct be_ptask *task, enum be_ptask_delay delay_type, enum be_ptask_schedule from) { struct timeval tv; time_t delay = 0; if (!task->enabled) { DEBUG(SSSDBG_TRACE_FUNC, "Task [%s]: disabled\n", task->name); return; } switch (delay_type) { case BE_PTASK_FIRST_DELAY: delay = task->first_delay; break; case BE_PTASK_ENABLED_DELAY: delay = task->enabled_delay; break; case BE_PTASK_PERIOD: delay = task->period; if (backoff_allowed(task) && task->period * 2 <= task->max_backoff) { /* double the period for the next execution */ task->period *= 2; } break; } /* add random offset */ if (task->random_offset != 0) { delay = delay + (rand_r(&task->ro_seed) % task->random_offset); } switch (from) { case BE_PTASK_SCHEDULE_FROM_NOW: tv = tevent_timeval_current_ofs(delay, 0); DEBUG(SSSDBG_TRACE_FUNC, "Task [%s]: scheduling task %lu seconds " "from now [%lu]\n", task->name, delay, tv.tv_sec); break; case BE_PTASK_SCHEDULE_FROM_LAST: tv = tevent_timeval_set(task->last_execution + delay, 0); DEBUG(SSSDBG_TRACE_FUNC, "Task [%s]: scheduling task %lu seconds " "from last execution time [%lu]\n", task->name, delay, tv.tv_sec); break; } if (task->timer != NULL) { DEBUG(SSSDBG_MINOR_FAILURE, "Task [%s]: another timer is already " "active?\n", task->name); talloc_zfree(task->timer); } task->timer = tevent_add_timer(task->ev, task, tv, be_ptask_execute, task); if (task->timer == NULL) { /* nothing we can do about it */ DEBUG(SSSDBG_CRIT_FAILURE, "FATAL: Unable to schedule task [%s]\n", task->name); be_ptask_disable(task); } task->next_execution = tv.tv_sec; } errno_t be_ptask_create(TALLOC_CTX *mem_ctx, struct be_ctx *be_ctx, time_t period, time_t first_delay, time_t enabled_delay, time_t random_offset, time_t timeout, enum be_ptask_offline offline, time_t max_backoff, be_ptask_send_t send_fn, be_ptask_recv_t recv_fn, void *pvt, const char *name, struct be_ptask **_task) { struct be_ptask *task = NULL; errno_t ret; if (be_ctx == NULL || period == 0 || send_fn == NULL || recv_fn == NULL || name == NULL) { return EINVAL; } task = talloc_zero(mem_ctx, struct be_ptask); if (task == NULL) { ret = ENOMEM; goto done; } task->ev = be_ctx->ev; task->be_ctx = be_ctx; task->period = period; task->orig_period = period; task->first_delay = first_delay; task->enabled_delay = enabled_delay; task->random_offset = random_offset; task->ro_seed = time(NULL) * getpid(); task->max_backoff = max_backoff; task->timeout = timeout; task->offline = offline; task->send_fn = send_fn; task->recv_fn = recv_fn; task->pvt = pvt; task->name = talloc_strdup(task, name); if (task->name == NULL) { ret = ENOMEM; goto done; } task->enabled = true; talloc_set_destructor((TALLOC_CTX*)task, be_ptask_destructor); if (offline == BE_PTASK_OFFLINE_DISABLE) { /* install offline and online callbacks */ ret = be_add_online_cb(task, be_ctx, be_ptask_online_cb, task, NULL); if (ret != EOK) { DEBUG(SSSDBG_OP_FAILURE, "Unable to install online callback [%d]: %s\n", ret, sss_strerror(ret)); goto done; } ret = be_add_offline_cb(task, be_ctx, be_ptask_offline_cb, task, NULL); if (ret != EOK) { DEBUG(SSSDBG_OP_FAILURE, "Unable to install offline callback [%d]: %s\n", ret, sss_strerror(ret)); goto done; } } DEBUG(SSSDBG_TRACE_FUNC, "Periodic task [%s] was created\n", task->name); be_ptask_schedule(task, BE_PTASK_FIRST_DELAY, BE_PTASK_SCHEDULE_FROM_NOW); if (_task != NULL) { *_task = task; } ret = EOK; done: if (ret != EOK) { talloc_free(task); } return ret; } void be_ptask_enable(struct be_ptask *task) { if (task->enabled) { DEBUG(SSSDBG_MINOR_FAILURE, "Task [%s]: already enabled\n", task->name); return; } DEBUG(SSSDBG_TRACE_FUNC, "Task [%s]: enabling task\n", task->name); task->enabled = true; be_ptask_schedule(task, BE_PTASK_ENABLED_DELAY, BE_PTASK_SCHEDULE_FROM_NOW); } /* Disable the task, but if a request already in progress, let it finish. */ void be_ptask_disable(struct be_ptask *task) { DEBUG(SSSDBG_TRACE_FUNC, "Task [%s]: disabling task\n", task->name); talloc_zfree(task->timer); task->enabled = false; task->period = task->orig_period; } void be_ptask_destroy(struct be_ptask **task) { talloc_zfree(*task); } time_t be_ptask_get_period(struct be_ptask *task) { return task->period; } struct be_ptask_sync_ctx { be_ptask_sync_t fn; void *pvt; }; struct be_ptask_sync_state { int dummy; }; /* This is not an asynchronous request so there is not any _done function. */ static struct tevent_req * be_ptask_sync_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct be_ctx *be_ctx, struct be_ptask *be_ptask, void *pvt) { struct be_ptask_sync_ctx *ctx = NULL; struct be_ptask_sync_state *state = NULL; struct tevent_req *req = NULL; errno_t ret; req = tevent_req_create(mem_ctx, &state, struct be_ptask_sync_state); if (req == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, "tevent_req_create() failed\n"); return NULL; } ctx = talloc_get_type(pvt, struct be_ptask_sync_ctx); ret = ctx->fn(mem_ctx, ev, be_ctx, be_ptask, ctx->pvt); if (ret == EOK) { tevent_req_done(req); } else { tevent_req_error(req, ret); } tevent_req_post(req, ev); return req; } static errno_t be_ptask_sync_recv(struct tevent_req *req) { TEVENT_REQ_RETURN_ON_ERROR(req); return EOK; } errno_t be_ptask_create_sync(TALLOC_CTX *mem_ctx, struct be_ctx *be_ctx, time_t period, time_t first_delay, time_t enabled_delay, time_t random_offset, time_t timeout, enum be_ptask_offline offline, time_t max_backoff, be_ptask_sync_t fn, void *pvt, const char *name, struct be_ptask **_task) { errno_t ret; struct be_ptask_sync_ctx *ctx = NULL; ctx = talloc_zero(mem_ctx, struct be_ptask_sync_ctx); if (ctx == NULL) { ret = ENOMEM; goto done; } ctx->fn = fn; ctx->pvt = pvt; ret = be_ptask_create(mem_ctx, be_ctx, period, first_delay, enabled_delay, random_offset, timeout, offline, max_backoff, be_ptask_sync_send, be_ptask_sync_recv, ctx, name, _task); if (ret != EOK) { goto done; } ret = EOK; done: if (ret != EOK) { talloc_free(ctx); } return ret; }
spbnick/sssd
src/providers/dp_ptask.c
C
gpl-3.0
13,897
#!/usr/bin/env ruby # This file is part of Openplacos. # # Openplacos 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. # # Openplacos 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 Openplacos. If not, see <http://www.gnu.org/licenses/>. # # # HIH3610 humidity sensor component require File.dirname(__FILE__) << "/LibComponent.rb" component = LibComponent::Component.new(ARGV) do |c| c.description "HIH3610 humidity sensor" c.version "0.1" c.default_name "hih3610" c.option :valim , "the sensor alimentation voltage" , :default => 5.0 end component << Raw = LibComponent::Output.new("/raw","analog","r") component << Temperature = LibComponent::Output.new("/temperature","analog.sensor.temperature.celcuis","r") component << Humidity = LibComponent::Input.new("/humidity","analog.sensor.humidity.rh") Humidity.on_read do |*args| temperature = Temperature.read({}) valim = component.options[:valim] sensorRH = (Raw.read({})/valim-0.16)/0.0062 trueRH = (sensorRH)/(1.0546-0.00216*temperature) return trueRH end component.run
openplacos/openplacos
components/hih3610.rb
Ruby
gpl-3.0
1,532
/** * @file dll/fsop.c * * @copyright 2015-2017 Bill Zissimopoulos */ /* * This file is part of WinFsp. * * You can redistribute it and/or modify it under the terms of the GNU * General Public License version 3 as published by the Free Software * Foundation. * * Licensees holding a valid commercial license may use this file in * accordance with the commercial license agreement provided with the * software. */ #include <dll/library.h> #define AddrOfFileContext(s) \ ( \ (PVOID)&(((PUINT64)&(s).UserContext)[FileSystem->UmFileContextIsUserContext2])\ ) #define ValOfFileContext(s) \ ( \ FileSystem->UmFileContextIsFullContext ?\ (PVOID)(&(s)) : \ (PVOID)(((PUINT64)&(s).UserContext)[FileSystem->UmFileContextIsUserContext2])\ ) #define SetFileContext(t, s) \ ( \ FileSystem->UmFileContextIsFullContext ?\ (VOID)( \ (t).UserContext = (s).UserContext,\ (t).UserContext2 = (s).UserContext2\ ) : \ (VOID)( \ ((PUINT64)&(t).UserContext)[FileSystem->UmFileContextIsUserContext2] =\ ((PUINT64)&(s).UserContext)[FileSystem->UmFileContextIsUserContext2]\ ) \ ) FSP_API NTSTATUS FspFileSystemOpEnter(FSP_FILE_SYSTEM *FileSystem, FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response) { switch (FileSystem->OpGuardStrategy) { case FSP_FILE_SYSTEM_OPERATION_GUARD_STRATEGY_FINE: if ((FspFsctlTransactCreateKind == Request->Kind && FILE_OPEN != ((Request->Req.Create.CreateOptions >> 24) & 0xff)) || FspFsctlTransactOverwriteKind == Request->Kind || (FspFsctlTransactCleanupKind == Request->Kind && Request->Req.Cleanup.Delete) || (FspFsctlTransactSetInformationKind == Request->Kind && 10/*FileRenameInformation*/ == Request->Req.SetInformation.FileInformationClass) || FspFsctlTransactSetVolumeInformationKind == Request->Kind || (FspFsctlTransactFlushBuffersKind == Request->Kind && 0 == Request->Req.FlushBuffers.UserContext && 0 == Request->Req.FlushBuffers.UserContext2)) { AcquireSRWLockExclusive(&FileSystem->OpGuardLock); } else if (FspFsctlTransactCreateKind == Request->Kind || (FspFsctlTransactSetInformationKind == Request->Kind && 13/*FileDispositionInformation*/ == Request->Req.SetInformation.FileInformationClass) || FspFsctlTransactQueryDirectoryKind == Request->Kind || FspFsctlTransactQueryVolumeInformationKind == Request->Kind) { AcquireSRWLockShared(&FileSystem->OpGuardLock); } break; case FSP_FILE_SYSTEM_OPERATION_GUARD_STRATEGY_COARSE: AcquireSRWLockExclusive(&FileSystem->OpGuardLock); break; } return STATUS_SUCCESS; } FSP_API NTSTATUS FspFileSystemOpLeave(FSP_FILE_SYSTEM *FileSystem, FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response) { switch (FileSystem->OpGuardStrategy) { case FSP_FILE_SYSTEM_OPERATION_GUARD_STRATEGY_FINE: if ((FspFsctlTransactCreateKind == Request->Kind && FILE_OPEN != ((Request->Req.Create.CreateOptions >> 24) & 0xff)) || FspFsctlTransactOverwriteKind == Request->Kind || (FspFsctlTransactCleanupKind == Request->Kind && Request->Req.Cleanup.Delete) || (FspFsctlTransactSetInformationKind == Request->Kind && 10/*FileRenameInformation*/ == Request->Req.SetInformation.FileInformationClass) || FspFsctlTransactSetVolumeInformationKind == Request->Kind || (FspFsctlTransactFlushBuffersKind == Request->Kind && 0 == Request->Req.FlushBuffers.UserContext && 0 == Request->Req.FlushBuffers.UserContext2)) { ReleaseSRWLockExclusive(&FileSystem->OpGuardLock); } else if (FspFsctlTransactCreateKind == Request->Kind || (FspFsctlTransactSetInformationKind == Request->Kind && 13/*FileDispositionInformation*/ == Request->Req.SetInformation.FileInformationClass) || FspFsctlTransactQueryDirectoryKind == Request->Kind || FspFsctlTransactQueryVolumeInformationKind == Request->Kind) { ReleaseSRWLockShared(&FileSystem->OpGuardLock); } break; case FSP_FILE_SYSTEM_OPERATION_GUARD_STRATEGY_COARSE: ReleaseSRWLockExclusive(&FileSystem->OpGuardLock); break; } return STATUS_SUCCESS; } static inline NTSTATUS FspFileSystemCallResolveReparsePoints(FSP_FILE_SYSTEM *FileSystem, FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response, UINT32 ReparsePointIndex) { NTSTATUS Result = STATUS_INVALID_DEVICE_REQUEST; IO_STATUS_BLOCK IoStatus; SIZE_T Size; if (0 != FileSystem->Interface->ResolveReparsePoints) { memset(&IoStatus, 0, sizeof IoStatus); Size = FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX; Result = FileSystem->Interface->ResolveReparsePoints(FileSystem, (PWSTR)Request->Buffer, ReparsePointIndex, !(Request->Req.Create.CreateOptions & FILE_OPEN_REPARSE_POINT), &IoStatus, Response->Buffer, &Size); if (NT_SUCCESS(Result)) { Result = STATUS_REPARSE; Response->IoStatus.Information = (UINT32)IoStatus.Information; Response->Size = (UINT16)(sizeof *Response + Size); Response->Rsp.Create.Reparse.Buffer.Offset = 0; Response->Rsp.Create.Reparse.Buffer.Size = (UINT16)Size; } } return Result; } static inline NTSTATUS FspFileSystemCreateCheck(FSP_FILE_SYSTEM *FileSystem, FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response, BOOLEAN AllowTraverseCheck, PUINT32 PGrantedAccess, PSECURITY_DESCRIPTOR *PSecurityDescriptor) { NTSTATUS Result; UINT32 ParentDesiredAccess, GrantedAccess; /* * CreateCheck does different checks depending on whether we are * creating a new file/directory or a new stream. * * - CreateCheck for a new file consists of checking the parent directory * for the FILE_ADD_SUBDIRECTORY or FILE_ADD_FILE rights (depending on * whether we are creating a file or directory). * * If the access check succeeds and MAXIMUM_ALLOWED has been requested * then we go ahead and grant all access to the creator. * * - CreateCheck for a new stream consists of checking the main file for * FILE_WRITE_DATA access, unless FILE_DELETE_ON_CLOSE is requested in * which case we also check for DELETE access. * * If the access check succeeds and MAXIMUM_ALLOWED was not requested * then we reset the DELETE and FILE_WRITE_DATA accesses based on whether * they were actually requested in DesiredAccess. */ if (!Request->Req.Create.NamedStream) { if (Request->Req.Create.HasRestorePrivilege) ParentDesiredAccess = 0; else if (Request->Req.Create.CreateOptions & FILE_DIRECTORY_FILE) ParentDesiredAccess = FILE_ADD_SUBDIRECTORY; else ParentDesiredAccess = FILE_ADD_FILE; if (Request->Req.Create.HasTrailingBackslash && !(Request->Req.Create.CreateOptions & FILE_DIRECTORY_FILE)) Result = STATUS_OBJECT_NAME_INVALID; else if ((Request->Req.Create.FileAttributes & FILE_ATTRIBUTE_READONLY) && (Request->Req.Create.CreateOptions & FILE_DELETE_ON_CLOSE)) Result = STATUS_CANNOT_DELETE; else Result = FspAccessCheckEx(FileSystem, Request, TRUE, AllowTraverseCheck, ParentDesiredAccess, &GrantedAccess, PSecurityDescriptor); if (STATUS_REPARSE == Result) Result = FspFileSystemCallResolveReparsePoints(FileSystem, Request, Response, GrantedAccess); else if (NT_SUCCESS(Result)) { *PGrantedAccess = (MAXIMUM_ALLOWED & Request->Req.Create.DesiredAccess) ? FspGetFileGenericMapping()->GenericAll : Request->Req.Create.DesiredAccess; *PGrantedAccess |= Request->Req.Create.GrantedAccess; } } else { *PSecurityDescriptor = 0; if (Request->Req.Create.HasTrailingBackslash) Result = STATUS_OBJECT_NAME_INVALID; else Result = FspAccessCheckEx(FileSystem, Request, TRUE, AllowTraverseCheck, Request->Req.Create.DesiredAccess | FILE_WRITE_DATA | ((Request->Req.Create.CreateOptions & FILE_DELETE_ON_CLOSE) ? DELETE : 0), &GrantedAccess, 0); if (STATUS_REPARSE == Result) Result = FspFileSystemCallResolveReparsePoints(FileSystem, Request, Response, GrantedAccess); else if (NT_SUCCESS(Result)) { *PGrantedAccess = GrantedAccess; if (0 == (Request->Req.Create.DesiredAccess & MAXIMUM_ALLOWED)) *PGrantedAccess &= ~(DELETE | FILE_WRITE_DATA) | (Request->Req.Create.DesiredAccess & (DELETE | FILE_WRITE_DATA)); *PGrantedAccess |= Request->Req.Create.GrantedAccess; } } return Result; } static inline NTSTATUS FspFileSystemOpenCheck(FSP_FILE_SYSTEM *FileSystem, FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response, BOOLEAN AllowTraverseCheck, PUINT32 PGrantedAccess) { NTSTATUS Result; UINT32 GrantedAccess; /* * OpenCheck consists of checking the file for the desired access, * unless FILE_DELETE_ON_CLOSE is requested in which case we also * check for DELETE access. * * If the access check succeeds and MAXIMUM_ALLOWED was not requested * then we reset the DELETE access based on whether it was actually * requested in DesiredAccess. */ Result = FspAccessCheck(FileSystem, Request, FALSE, AllowTraverseCheck, Request->Req.Create.DesiredAccess | ((Request->Req.Create.CreateOptions & FILE_DELETE_ON_CLOSE) ? DELETE : 0), &GrantedAccess); if (STATUS_REPARSE == Result) Result = FspFileSystemCallResolveReparsePoints(FileSystem, Request, Response, GrantedAccess); else if (NT_SUCCESS(Result)) { *PGrantedAccess = GrantedAccess; if (0 == (Request->Req.Create.DesiredAccess & MAXIMUM_ALLOWED)) *PGrantedAccess &= ~DELETE | (Request->Req.Create.DesiredAccess & DELETE); *PGrantedAccess |= Request->Req.Create.GrantedAccess; } return Result; } static inline NTSTATUS FspFileSystemOverwriteCheck(FSP_FILE_SYSTEM *FileSystem, FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response, BOOLEAN AllowTraverseCheck, PUINT32 PGrantedAccess) { NTSTATUS Result; UINT32 GrantedAccess; BOOLEAN Supersede = FILE_SUPERSEDE == ((Request->Req.Create.CreateOptions >> 24) & 0xff); /* * OverwriteCheck consists of checking the file for the desired access, * unless FILE_DELETE_ON_CLOSE is requested in which case we also * check for DELETE access. Furthermore we grant DELETE or FILE_WRITE_DATA * access based on whether this is a Supersede or Overwrite operation. * * If the access check succeeds and MAXIMUM_ALLOWED was not requested * then we reset the DELETE and FILE_WRITE_DATA accesses based on whether * they were actually requested in DesiredAccess. */ Result = FspAccessCheck(FileSystem, Request, FALSE, AllowTraverseCheck, Request->Req.Create.DesiredAccess | (Supersede ? DELETE : FILE_WRITE_DATA) | ((Request->Req.Create.CreateOptions & FILE_DELETE_ON_CLOSE) ? DELETE : 0), &GrantedAccess); if (STATUS_REPARSE == Result) Result = FspFileSystemCallResolveReparsePoints(FileSystem, Request, Response, GrantedAccess); else if (NT_SUCCESS(Result)) { *PGrantedAccess = GrantedAccess; if (0 == (Request->Req.Create.DesiredAccess & MAXIMUM_ALLOWED)) *PGrantedAccess &= ~(DELETE | FILE_WRITE_DATA) | (Request->Req.Create.DesiredAccess & (DELETE | FILE_WRITE_DATA)); *PGrantedAccess |= Request->Req.Create.GrantedAccess; } return Result; } static inline NTSTATUS FspFileSystemOpenTargetDirectoryCheck(FSP_FILE_SYSTEM *FileSystem, FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response, PUINT32 PGrantedAccess) { NTSTATUS Result; UINT32 GrantedAccess; /* * OpenTargetDirectoryCheck consists of checking the parent directory * for the desired access. */ Result = FspAccessCheck(FileSystem, Request, TRUE, TRUE, Request->Req.Create.DesiredAccess, &GrantedAccess); if (STATUS_REPARSE == Result) Result = FspFileSystemCallResolveReparsePoints(FileSystem, Request, Response, GrantedAccess); else if (NT_SUCCESS(Result)) *PGrantedAccess = GrantedAccess | Request->Req.Create.GrantedAccess; return Result; } static inline NTSTATUS FspFileSystemRenameCheck(FSP_FILE_SYSTEM *FileSystem, FSP_FSCTL_TRANSACT_REQ *Request) { NTSTATUS Result; FSP_FSCTL_TRANSACT_REQ *CreateRequest = 0; UINT32 GrantedAccess; /* * RenameCheck consists of checking the new file name for DELETE access. * * The following assumptions are being made here for a file that is going * to be replaced: * - The new file is in the same directory as the old one. In that case * there is no need for traverse access checks as they have been already * performed (if necessary) when opening the file under the existing file * name. * - The new file is in a different directory than the old one. In that case * NTOS called us with SL_OPEN_TARGET_DIRECTORY and we performed any * necessary traverse access checks at that time. * * FspAccessCheckEx only works on Create requests, so we have to build * a fake one just for that purpose. Sigh! */ CreateRequest = MemAlloc(sizeof *CreateRequest + Request->Req.SetInformation.Info.Rename.NewFileName.Size); if (0 == CreateRequest) return STATUS_INSUFFICIENT_RESOURCES; memset(CreateRequest, 0, sizeof *CreateRequest); CreateRequest->Size = sizeof CreateRequest + Request->Req.SetInformation.Info.Rename.NewFileName.Size; CreateRequest->Kind = FspFsctlTransactCreateKind; CreateRequest->Req.Create.CreateOptions = FILE_DELETE_ON_CLOSE | /* force read-only check! */ FILE_OPEN_REPARSE_POINT; /* allow rename over reparse point */ CreateRequest->Req.Create.AccessToken = Request->Req.SetInformation.Info.Rename.AccessToken; CreateRequest->Req.Create.UserMode = TRUE; CreateRequest->FileName.Offset = 0; CreateRequest->FileName.Size = Request->Req.SetInformation.Info.Rename.NewFileName.Size; memcpy(CreateRequest->Buffer, Request->Buffer + Request->Req.SetInformation.Info.Rename.NewFileName.Offset, Request->Req.SetInformation.Info.Rename.NewFileName.Size); Result = FspAccessCheck(FileSystem, CreateRequest, FALSE, FALSE, DELETE, &GrantedAccess); MemFree(CreateRequest); if (STATUS_REPARSE == Result) Result = STATUS_SUCCESS; /* file system should not return STATUS_REPARSE during rename */ return Result; } static NTSTATUS FspFileSystemOpCreate_FileCreate(FSP_FILE_SYSTEM *FileSystem, FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response) { NTSTATUS Result; UINT32 GrantedAccess; PSECURITY_DESCRIPTOR ParentDescriptor, ObjectDescriptor; FSP_FSCTL_TRANSACT_FULL_CONTEXT FullContext; FSP_FSCTL_OPEN_FILE_INFO OpenFileInfo; Result = FspFileSystemCreateCheck(FileSystem, Request, Response, TRUE, &GrantedAccess, &ParentDescriptor); if (!NT_SUCCESS(Result) || STATUS_REPARSE == Result) return Result; Result = FspCreateSecurityDescriptor(FileSystem, Request, ParentDescriptor, &ObjectDescriptor); FspDeleteSecurityDescriptor(ParentDescriptor, FspAccessCheckEx); if (!NT_SUCCESS(Result)) return Result; FullContext.UserContext = 0; FullContext.UserContext2 = 0; memset(&OpenFileInfo, 0, sizeof OpenFileInfo); OpenFileInfo.NormalizedName = (PVOID)Response->Buffer; OpenFileInfo.NormalizedNameSize = FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX; Result = FileSystem->Interface->Create(FileSystem, (PWSTR)Request->Buffer, Request->Req.Create.CreateOptions, GrantedAccess, Request->Req.Create.FileAttributes, ObjectDescriptor, Request->Req.Create.AllocationSize, AddrOfFileContext(FullContext), &OpenFileInfo.FileInfo); FspDeleteSecurityDescriptor(ObjectDescriptor, FspCreateSecurityDescriptor); if (!NT_SUCCESS(Result)) return Result; if (FSP_FSCTL_TRANSACT_PATH_SIZEMAX >= OpenFileInfo.NormalizedNameSize) { Response->Size = (UINT16)(sizeof *Response + OpenFileInfo.NormalizedNameSize); Response->Rsp.Create.Opened.FileName.Offset = 0; Response->Rsp.Create.Opened.FileName.Size = (UINT16)OpenFileInfo.NormalizedNameSize; } Response->IoStatus.Information = FILE_CREATED; SetFileContext(Response->Rsp.Create.Opened, FullContext); Response->Rsp.Create.Opened.GrantedAccess = GrantedAccess; memcpy(&Response->Rsp.Create.Opened.FileInfo, &OpenFileInfo.FileInfo, sizeof OpenFileInfo.FileInfo); return STATUS_SUCCESS; } static NTSTATUS FspFileSystemOpCreate_FileOpen(FSP_FILE_SYSTEM *FileSystem, FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response) { NTSTATUS Result; UINT32 GrantedAccess; FSP_FSCTL_TRANSACT_FULL_CONTEXT FullContext; FSP_FSCTL_OPEN_FILE_INFO OpenFileInfo; Result = FspFileSystemOpenCheck(FileSystem, Request, Response, TRUE, &GrantedAccess); if (!NT_SUCCESS(Result) || STATUS_REPARSE == Result) return Result; FullContext.UserContext = 0; FullContext.UserContext2 = 0; memset(&OpenFileInfo, 0, sizeof OpenFileInfo); OpenFileInfo.NormalizedName = (PVOID)Response->Buffer; OpenFileInfo.NormalizedNameSize = FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX; Result = FileSystem->Interface->Open(FileSystem, (PWSTR)Request->Buffer, Request->Req.Create.CreateOptions, GrantedAccess, AddrOfFileContext(FullContext), &OpenFileInfo.FileInfo); if (!NT_SUCCESS(Result)) return Result; if (FSP_FSCTL_TRANSACT_PATH_SIZEMAX >= OpenFileInfo.NormalizedNameSize) { Response->Size = (UINT16)(sizeof *Response + OpenFileInfo.NormalizedNameSize); Response->Rsp.Create.Opened.FileName.Offset = 0; Response->Rsp.Create.Opened.FileName.Size = (UINT16)OpenFileInfo.NormalizedNameSize; } Response->IoStatus.Information = FILE_OPENED; SetFileContext(Response->Rsp.Create.Opened, FullContext); Response->Rsp.Create.Opened.GrantedAccess = GrantedAccess; memcpy(&Response->Rsp.Create.Opened.FileInfo, &OpenFileInfo.FileInfo, sizeof OpenFileInfo.FileInfo); return STATUS_SUCCESS; } static NTSTATUS FspFileSystemOpCreate_FileOpenIf(FSP_FILE_SYSTEM *FileSystem, FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response) { NTSTATUS Result; UINT32 GrantedAccess; PSECURITY_DESCRIPTOR ParentDescriptor, ObjectDescriptor; FSP_FSCTL_TRANSACT_FULL_CONTEXT FullContext; FSP_FSCTL_OPEN_FILE_INFO OpenFileInfo; BOOLEAN Create = FALSE; Result = FspFileSystemOpenCheck(FileSystem, Request, Response, TRUE, &GrantedAccess); if (!NT_SUCCESS(Result) || STATUS_REPARSE == Result) { if (STATUS_OBJECT_NAME_NOT_FOUND != Result) return Result; Create = TRUE; } if (!Create) { FullContext.UserContext = 0; FullContext.UserContext2 = 0; memset(&OpenFileInfo, 0, sizeof OpenFileInfo); OpenFileInfo.NormalizedName = (PVOID)Response->Buffer; OpenFileInfo.NormalizedNameSize = FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX; Result = FileSystem->Interface->Open(FileSystem, (PWSTR)Request->Buffer, Request->Req.Create.CreateOptions, GrantedAccess, AddrOfFileContext(FullContext), &OpenFileInfo.FileInfo); if (!NT_SUCCESS(Result)) { if (STATUS_OBJECT_NAME_NOT_FOUND != Result) return Result; Create = TRUE; } } if (Create) { Result = FspFileSystemCreateCheck(FileSystem, Request, Response, FALSE, &GrantedAccess, &ParentDescriptor); if (!NT_SUCCESS(Result) || STATUS_REPARSE == Result) return Result; Result = FspCreateSecurityDescriptor(FileSystem, Request, ParentDescriptor, &ObjectDescriptor); FspDeleteSecurityDescriptor(ParentDescriptor, FspAccessCheckEx); if (!NT_SUCCESS(Result)) return Result; FullContext.UserContext = 0; FullContext.UserContext2 = 0; memset(&OpenFileInfo, 0, sizeof OpenFileInfo); OpenFileInfo.NormalizedName = (PVOID)Response->Buffer; OpenFileInfo.NormalizedNameSize = FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX; Result = FileSystem->Interface->Create(FileSystem, (PWSTR)Request->Buffer, Request->Req.Create.CreateOptions, GrantedAccess, Request->Req.Create.FileAttributes, ObjectDescriptor, Request->Req.Create.AllocationSize, AddrOfFileContext(FullContext), &OpenFileInfo.FileInfo); FspDeleteSecurityDescriptor(ObjectDescriptor, FspCreateSecurityDescriptor); if (!NT_SUCCESS(Result)) return Result; } if (FSP_FSCTL_TRANSACT_PATH_SIZEMAX >= OpenFileInfo.NormalizedNameSize) { Response->Size = (UINT16)(sizeof *Response + OpenFileInfo.NormalizedNameSize); Response->Rsp.Create.Opened.FileName.Offset = 0; Response->Rsp.Create.Opened.FileName.Size = (UINT16)OpenFileInfo.NormalizedNameSize; } Response->IoStatus.Information = Create ? FILE_CREATED : FILE_OPENED; SetFileContext(Response->Rsp.Create.Opened, FullContext); Response->Rsp.Create.Opened.GrantedAccess = GrantedAccess; memcpy(&Response->Rsp.Create.Opened.FileInfo, &OpenFileInfo.FileInfo, sizeof OpenFileInfo.FileInfo); return STATUS_SUCCESS; } static NTSTATUS FspFileSystemOpCreate_FileOverwrite(FSP_FILE_SYSTEM *FileSystem, FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response) { NTSTATUS Result; UINT32 GrantedAccess; FSP_FSCTL_TRANSACT_FULL_CONTEXT FullContext; FSP_FSCTL_OPEN_FILE_INFO OpenFileInfo; Result = FspFileSystemOverwriteCheck(FileSystem, Request, Response, TRUE, &GrantedAccess); if (!NT_SUCCESS(Result) || STATUS_REPARSE == Result) return Result; FullContext.UserContext = 0; FullContext.UserContext2 = 0; memset(&OpenFileInfo, 0, sizeof OpenFileInfo); OpenFileInfo.NormalizedName = (PVOID)Response->Buffer; OpenFileInfo.NormalizedNameSize = FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX; Result = FileSystem->Interface->Open(FileSystem, (PWSTR)Request->Buffer, Request->Req.Create.CreateOptions, GrantedAccess, AddrOfFileContext(FullContext), &OpenFileInfo.FileInfo); if (!NT_SUCCESS(Result)) return Result; if (FSP_FSCTL_TRANSACT_PATH_SIZEMAX >= OpenFileInfo.NormalizedNameSize) { Response->Size = (UINT16)(sizeof *Response + OpenFileInfo.NormalizedNameSize); Response->Rsp.Create.Opened.FileName.Offset = 0; Response->Rsp.Create.Opened.FileName.Size = (UINT16)OpenFileInfo.NormalizedNameSize; } Response->IoStatus.Information = FILE_OVERWRITTEN; SetFileContext(Response->Rsp.Create.Opened, FullContext); Response->Rsp.Create.Opened.GrantedAccess = GrantedAccess; memcpy(&Response->Rsp.Create.Opened.FileInfo, &OpenFileInfo.FileInfo, sizeof OpenFileInfo.FileInfo); return STATUS_SUCCESS; } static NTSTATUS FspFileSystemOpCreate_FileOverwriteIf(FSP_FILE_SYSTEM *FileSystem, FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response) { NTSTATUS Result; UINT32 GrantedAccess; PSECURITY_DESCRIPTOR ParentDescriptor, ObjectDescriptor; FSP_FSCTL_TRANSACT_FULL_CONTEXT FullContext; FSP_FSCTL_OPEN_FILE_INFO OpenFileInfo; BOOLEAN Supersede = FILE_SUPERSEDE == ((Request->Req.Create.CreateOptions >> 24) & 0xff); BOOLEAN Create = FALSE; Result = FspFileSystemOverwriteCheck(FileSystem, Request, Response, TRUE, &GrantedAccess); if (!NT_SUCCESS(Result) || STATUS_REPARSE == Result) { if (STATUS_OBJECT_NAME_NOT_FOUND != Result) return Result; Create = TRUE; } if (!Create) { FullContext.UserContext = 0; FullContext.UserContext2 = 0; memset(&OpenFileInfo, 0, sizeof OpenFileInfo); OpenFileInfo.NormalizedName = (PVOID)Response->Buffer; OpenFileInfo.NormalizedNameSize = FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX; Result = FileSystem->Interface->Open(FileSystem, (PWSTR)Request->Buffer, Request->Req.Create.CreateOptions, GrantedAccess, AddrOfFileContext(FullContext), &OpenFileInfo.FileInfo); if (!NT_SUCCESS(Result)) { if (STATUS_OBJECT_NAME_NOT_FOUND != Result) return Result; Create = TRUE; } } if (Create) { Result = FspFileSystemCreateCheck(FileSystem, Request, Response, FALSE, &GrantedAccess, &ParentDescriptor); if (!NT_SUCCESS(Result) || STATUS_REPARSE == Result) return Result; Result = FspCreateSecurityDescriptor(FileSystem, Request, ParentDescriptor, &ObjectDescriptor); FspDeleteSecurityDescriptor(ParentDescriptor, FspAccessCheckEx); if (!NT_SUCCESS(Result)) return Result; FullContext.UserContext = 0; FullContext.UserContext2 = 0; memset(&OpenFileInfo, 0, sizeof OpenFileInfo); OpenFileInfo.NormalizedName = (PVOID)Response->Buffer; OpenFileInfo.NormalizedNameSize = FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX; Result = FileSystem->Interface->Create(FileSystem, (PWSTR)Request->Buffer, Request->Req.Create.CreateOptions, GrantedAccess, Request->Req.Create.FileAttributes, ObjectDescriptor, Request->Req.Create.AllocationSize, AddrOfFileContext(FullContext), &OpenFileInfo.FileInfo); FspDeleteSecurityDescriptor(ObjectDescriptor, FspCreateSecurityDescriptor); if (!NT_SUCCESS(Result)) return Result; } if (FSP_FSCTL_TRANSACT_PATH_SIZEMAX >= OpenFileInfo.NormalizedNameSize) { Response->Size = (UINT16)(sizeof *Response + OpenFileInfo.NormalizedNameSize); Response->Rsp.Create.Opened.FileName.Offset = 0; Response->Rsp.Create.Opened.FileName.Size = (UINT16)OpenFileInfo.NormalizedNameSize; } Response->IoStatus.Information = Create ? FILE_CREATED : (Supersede ? FILE_SUPERSEDED : FILE_OVERWRITTEN); SetFileContext(Response->Rsp.Create.Opened, FullContext); Response->Rsp.Create.Opened.GrantedAccess = GrantedAccess; memcpy(&Response->Rsp.Create.Opened.FileInfo, &OpenFileInfo.FileInfo, sizeof OpenFileInfo.FileInfo); return STATUS_SUCCESS; } static NTSTATUS FspFileSystemOpCreate_FileOpenTargetDirectory(FSP_FILE_SYSTEM *FileSystem, FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response) { NTSTATUS Result; WCHAR Root[2] = L"\\"; PWSTR Parent, Suffix; UINT32 GrantedAccess; FSP_FSCTL_TRANSACT_FULL_CONTEXT FullContext; FSP_FSCTL_OPEN_FILE_INFO OpenFileInfo; UINT32 Information; Result = FspFileSystemOpenTargetDirectoryCheck(FileSystem, Request, Response, &GrantedAccess); if (!NT_SUCCESS(Result) || STATUS_REPARSE == Result) return Result; FullContext.UserContext = 0; FullContext.UserContext2 = 0; memset(&OpenFileInfo, 0, sizeof OpenFileInfo); OpenFileInfo.NormalizedName = (PVOID)Response->Buffer; OpenFileInfo.NormalizedNameSize = FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX; FspPathSuffix((PWSTR)Request->Buffer, &Parent, &Suffix, Root); Result = FileSystem->Interface->Open(FileSystem, Parent, Request->Req.Create.CreateOptions, GrantedAccess, AddrOfFileContext(FullContext), &OpenFileInfo.FileInfo); FspPathCombine((PWSTR)Request->Buffer, Suffix); if (!NT_SUCCESS(Result)) return Result; Information = FILE_OPENED; if (0 != FileSystem->Interface->GetSecurityByName) { Result = FileSystem->Interface->GetSecurityByName(FileSystem, (PWSTR)Request->Buffer, 0, 0, 0); Information = NT_SUCCESS(Result) ? FILE_EXISTS : FILE_DOES_NOT_EXIST; } if (FSP_FSCTL_TRANSACT_PATH_SIZEMAX >= OpenFileInfo.NormalizedNameSize) { Response->Size = (UINT16)(sizeof *Response + OpenFileInfo.NormalizedNameSize); Response->Rsp.Create.Opened.FileName.Offset = 0; Response->Rsp.Create.Opened.FileName.Size = (UINT16)OpenFileInfo.NormalizedNameSize; } Response->IoStatus.Information = Information; SetFileContext(Response->Rsp.Create.Opened, FullContext); Response->Rsp.Create.Opened.GrantedAccess = GrantedAccess; memcpy(&Response->Rsp.Create.Opened.FileInfo, &OpenFileInfo.FileInfo, sizeof OpenFileInfo.FileInfo); return STATUS_SUCCESS; } static NTSTATUS FspFileSystemOpCreate_NotFoundCheck(FSP_FILE_SYSTEM *FileSystem, FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response) { /* * This handles an Open of a named stream done via a symlink. The file system * has returned STATUS_OBJECT_NAME_NOT_FOUND, but we check to see if the main * file is a reparse point that can be resolved. */ NTSTATUS Result; UINT32 FileAttributes; if (0 == FileSystem->Interface->GetSecurityByName || 0 == FileSystem->Interface->ResolveReparsePoints) return STATUS_OBJECT_NAME_NOT_FOUND; if (!Request->Req.Create.NamedStream || (Request->Req.Create.CreateOptions & FILE_OPEN_REPARSE_POINT)) return STATUS_OBJECT_NAME_NOT_FOUND; ((PWSTR)Request->Buffer)[Request->Req.Create.NamedStream / sizeof(WCHAR)] = L'\0'; Result = FileSystem->Interface->GetSecurityByName( FileSystem, (PWSTR)Request->Buffer, &FileAttributes, 0, 0); ((PWSTR)Request->Buffer)[Request->Req.Create.NamedStream / sizeof(WCHAR)] = L':'; if (STATUS_SUCCESS != Result) return STATUS_OBJECT_NAME_NOT_FOUND; if (0 == (FileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)) return STATUS_OBJECT_NAME_NOT_FOUND; FileAttributes = FspPathSuffixIndex((PWSTR)Request->Buffer); Result = FspFileSystemCallResolveReparsePoints( FileSystem, Request, Response, FileAttributes); if (STATUS_REPARSE != Result) return STATUS_OBJECT_NAME_NOT_FOUND; return STATUS_REPARSE; } static NTSTATUS FspFileSystemOpCreate_CollisionCheck(FSP_FILE_SYSTEM *FileSystem, FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response) { /* * This handles a Create that resulted in STATUS_OBJECT_NAME_COLLISION. We * handle two separate cases: * * 1) A Create colliding with a directory and the FILE_NON_DIRECTORY_FILE * flag set. We then change the result code to STATUS_FILE_IS_A_DIRECTORY. * * 2) A Create colliding with a symlink (reparse point) that can be resolved. * In this case we resolve the reparse point and return STATUS_REPARSE. */ NTSTATUS Result; UINT32 FileAttributes; if (0 == FileSystem->Interface->GetSecurityByName) return STATUS_OBJECT_NAME_COLLISION; Result = FileSystem->Interface->GetSecurityByName( FileSystem, (PWSTR)Request->Buffer, &FileAttributes, 0, 0); if (STATUS_SUCCESS != Result) return STATUS_OBJECT_NAME_COLLISION; if ((Request->Req.Create.CreateOptions & FILE_NON_DIRECTORY_FILE) && (FileAttributes & FILE_ATTRIBUTE_DIRECTORY)) return STATUS_FILE_IS_A_DIRECTORY; if (0 == FileSystem->Interface->ResolveReparsePoints) return STATUS_OBJECT_NAME_COLLISION; if (Request->Req.Create.CreateOptions & FILE_OPEN_REPARSE_POINT) return STATUS_OBJECT_NAME_COLLISION; if (0 == (FileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)) return STATUS_OBJECT_NAME_COLLISION; FileAttributes = FspPathSuffixIndex((PWSTR)Request->Buffer); Result = FspFileSystemCallResolveReparsePoints( FileSystem, Request, Response, FileAttributes); if (STATUS_REPARSE != Result) return STATUS_OBJECT_NAME_COLLISION; return STATUS_REPARSE; } FSP_API NTSTATUS FspFileSystemOpCreate(FSP_FILE_SYSTEM *FileSystem, FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response) { NTSTATUS Result; if (0 == FileSystem->Interface->Create || 0 == FileSystem->Interface->Open || 0 == FileSystem->Interface->Overwrite) return STATUS_INVALID_DEVICE_REQUEST; if (Request->Req.Create.OpenTargetDirectory) return FspFileSystemOpCreate_FileOpenTargetDirectory(FileSystem, Request, Response); switch ((Request->Req.Create.CreateOptions >> 24) & 0xff) { case FILE_CREATE: Result = FspFileSystemOpCreate_FileCreate(FileSystem, Request, Response); break; case FILE_OPEN: Result = FspFileSystemOpCreate_FileOpen(FileSystem, Request, Response); break; case FILE_OPEN_IF: Result = FspFileSystemOpCreate_FileOpenIf(FileSystem, Request, Response); break; case FILE_OVERWRITE: Result = FspFileSystemOpCreate_FileOverwrite(FileSystem, Request, Response); break; case FILE_OVERWRITE_IF: case FILE_SUPERSEDE: Result = FspFileSystemOpCreate_FileOverwriteIf(FileSystem, Request, Response); break; default: Result = STATUS_INVALID_PARAMETER; break; } if (STATUS_OBJECT_NAME_NOT_FOUND == Result) Result = FspFileSystemOpCreate_NotFoundCheck(FileSystem, Request, Response); else if (STATUS_OBJECT_NAME_COLLISION == Result) Result = FspFileSystemOpCreate_CollisionCheck(FileSystem, Request, Response); return Result; } FSP_API NTSTATUS FspFileSystemOpOverwrite(FSP_FILE_SYSTEM *FileSystem, FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response) { NTSTATUS Result; FSP_FSCTL_FILE_INFO FileInfo; if (0 == FileSystem->Interface->Overwrite) return STATUS_INVALID_DEVICE_REQUEST; memset(&FileInfo, 0, sizeof FileInfo); Result = FileSystem->Interface->Overwrite(FileSystem, (PVOID)ValOfFileContext(Request->Req.Overwrite), Request->Req.Overwrite.FileAttributes, Request->Req.Overwrite.Supersede, Request->Req.Overwrite.AllocationSize, &FileInfo); if (!NT_SUCCESS(Result)) { if (0 != FileSystem->Interface->Close) FileSystem->Interface->Close(FileSystem, (PVOID)ValOfFileContext(Request->Req.Overwrite)); return Result; } memcpy(&Response->Rsp.Overwrite.FileInfo, &FileInfo, sizeof FileInfo); return STATUS_SUCCESS; } FSP_API NTSTATUS FspFileSystemOpCleanup(FSP_FILE_SYSTEM *FileSystem, FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response) { if (0 != FileSystem->Interface->Cleanup) FileSystem->Interface->Cleanup(FileSystem, (PVOID)ValOfFileContext(Request->Req.Cleanup), 0 != Request->FileName.Size ? (PWSTR)Request->Buffer : 0, (0 != Request->Req.Cleanup.Delete ? FspCleanupDelete : 0) | (0 != Request->Req.Cleanup.SetAllocationSize ? FspCleanupSetAllocationSize : 0) | (0 != Request->Req.Cleanup.SetArchiveBit ? FspCleanupSetArchiveBit : 0) | (0 != Request->Req.Cleanup.SetLastAccessTime ? FspCleanupSetLastAccessTime : 0) | (0 != Request->Req.Cleanup.SetLastWriteTime ? FspCleanupSetLastWriteTime : 0) | (0 != Request->Req.Cleanup.SetChangeTime ? FspCleanupSetChangeTime : 0)); return STATUS_SUCCESS; } FSP_API NTSTATUS FspFileSystemOpClose(FSP_FILE_SYSTEM *FileSystem, FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response) { if (0 != FileSystem->Interface->Close) FileSystem->Interface->Close(FileSystem, (PVOID)ValOfFileContext(Request->Req.Close)); return STATUS_SUCCESS; } FSP_API NTSTATUS FspFileSystemOpRead(FSP_FILE_SYSTEM *FileSystem, FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response) { NTSTATUS Result; ULONG BytesTransferred; if (0 == FileSystem->Interface->Read) return STATUS_INVALID_DEVICE_REQUEST; BytesTransferred = 0; Result = FileSystem->Interface->Read(FileSystem, (PVOID)ValOfFileContext(Request->Req.Read), (PVOID)Request->Req.Read.Address, Request->Req.Read.Offset, Request->Req.Read.Length, &BytesTransferred); if (!NT_SUCCESS(Result)) return Result; if (STATUS_PENDING != Result) Response->IoStatus.Information = BytesTransferred; return Result; } FSP_API NTSTATUS FspFileSystemOpWrite(FSP_FILE_SYSTEM *FileSystem, FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response) { NTSTATUS Result; ULONG BytesTransferred; FSP_FSCTL_FILE_INFO FileInfo; if (0 == FileSystem->Interface->Write) return STATUS_INVALID_DEVICE_REQUEST; BytesTransferred = 0; Result = FileSystem->Interface->Write(FileSystem, (PVOID)ValOfFileContext(Request->Req.Write), (PVOID)Request->Req.Write.Address, Request->Req.Write.Offset, Request->Req.Write.Length, (UINT64)-1LL == Request->Req.Write.Offset, 0 != Request->Req.Write.ConstrainedIo, &BytesTransferred, &FileInfo); if (!NT_SUCCESS(Result)) return Result; if (STATUS_PENDING != Result) { Response->IoStatus.Information = BytesTransferred; memcpy(&Response->Rsp.Write.FileInfo, &FileInfo, sizeof FileInfo); } return Result; } FSP_API NTSTATUS FspFileSystemOpFlushBuffers(FSP_FILE_SYSTEM *FileSystem, FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response) { NTSTATUS Result; FSP_FSCTL_FILE_INFO FileInfo; memset(&FileInfo, 0, sizeof FileInfo); if (0 == FileSystem->Interface->Flush) Result = FileSystem->Interface->GetFileInfo(FileSystem, (PVOID)ValOfFileContext(Request->Req.FlushBuffers), &FileInfo); else Result = FileSystem->Interface->Flush(FileSystem, (PVOID)ValOfFileContext(Request->Req.FlushBuffers), &FileInfo); if (!NT_SUCCESS(Result)) return Result; memcpy(&Response->Rsp.FlushBuffers.FileInfo, &FileInfo, sizeof FileInfo); return STATUS_SUCCESS; } FSP_API NTSTATUS FspFileSystemOpQueryInformation(FSP_FILE_SYSTEM *FileSystem, FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response) { NTSTATUS Result; FSP_FSCTL_FILE_INFO FileInfo; if (0 == FileSystem->Interface->GetFileInfo) return STATUS_INVALID_DEVICE_REQUEST; memset(&FileInfo, 0, sizeof FileInfo); Result = FileSystem->Interface->GetFileInfo(FileSystem, (PVOID)ValOfFileContext(Request->Req.QueryInformation), &FileInfo); if (!NT_SUCCESS(Result)) return Result; memcpy(&Response->Rsp.QueryInformation.FileInfo, &FileInfo, sizeof FileInfo); return STATUS_SUCCESS; } FSP_API NTSTATUS FspFileSystemOpSetInformation(FSP_FILE_SYSTEM *FileSystem, FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response) { NTSTATUS Result; FSP_FSCTL_FILE_INFO FileInfo; Result = STATUS_INVALID_DEVICE_REQUEST; memset(&FileInfo, 0, sizeof FileInfo); switch (Request->Req.SetInformation.FileInformationClass) { case 4/*FileBasicInformation*/: if (0 != FileSystem->Interface->SetBasicInfo) Result = FileSystem->Interface->SetBasicInfo(FileSystem, (PVOID)ValOfFileContext(Request->Req.SetInformation), Request->Req.SetInformation.Info.Basic.FileAttributes, Request->Req.SetInformation.Info.Basic.CreationTime, Request->Req.SetInformation.Info.Basic.LastAccessTime, Request->Req.SetInformation.Info.Basic.LastWriteTime, Request->Req.SetInformation.Info.Basic.ChangeTime, &FileInfo); break; case 19/*FileAllocationInformation*/: if (0 != FileSystem->Interface->SetFileSize) Result = FileSystem->Interface->SetFileSize(FileSystem, (PVOID)ValOfFileContext(Request->Req.SetInformation), Request->Req.SetInformation.Info.Allocation.AllocationSize, TRUE, &FileInfo); break; case 20/*FileEndOfFileInformation*/: if (0 != FileSystem->Interface->SetFileSize) Result = FileSystem->Interface->SetFileSize(FileSystem, (PVOID)ValOfFileContext(Request->Req.SetInformation), Request->Req.SetInformation.Info.EndOfFile.FileSize, FALSE, &FileInfo); break; case 13/*FileDispositionInformation*/: if (0 != FileSystem->Interface->GetFileInfo) { Result = FileSystem->Interface->GetFileInfo(FileSystem, (PVOID)ValOfFileContext(Request->Req.SetInformation), &FileInfo); if (NT_SUCCESS(Result) && 0 != (FileInfo.FileAttributes & FILE_ATTRIBUTE_READONLY)) { Result = STATUS_CANNOT_DELETE; break; } } if (0 != FileSystem->Interface->CanDelete) if (Request->Req.SetInformation.Info.Disposition.Delete) Result = FileSystem->Interface->CanDelete(FileSystem, (PVOID)ValOfFileContext(Request->Req.SetInformation), (PWSTR)Request->Buffer); else Result = STATUS_SUCCESS; break; case 10/*FileRenameInformation*/: if (0 != FileSystem->Interface->Rename) { if (0 != Request->Req.SetInformation.Info.Rename.AccessToken) { Result = FspFileSystemRenameCheck(FileSystem, Request); if (!NT_SUCCESS(Result) && STATUS_OBJECT_PATH_NOT_FOUND != Result && STATUS_OBJECT_NAME_NOT_FOUND != Result) break; } Result = FileSystem->Interface->Rename(FileSystem, (PVOID)ValOfFileContext(Request->Req.SetInformation), (PWSTR)Request->Buffer, (PWSTR)(Request->Buffer + Request->Req.SetInformation.Info.Rename.NewFileName.Offset), 0 != Request->Req.SetInformation.Info.Rename.AccessToken); } break; } if (!NT_SUCCESS(Result)) return Result; memcpy(&Response->Rsp.SetInformation.FileInfo, &FileInfo, sizeof FileInfo); return STATUS_SUCCESS; } FSP_API NTSTATUS FspFileSystemOpQueryVolumeInformation(FSP_FILE_SYSTEM *FileSystem, FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response) { NTSTATUS Result; FSP_FSCTL_VOLUME_INFO VolumeInfo; if (0 == FileSystem->Interface->GetVolumeInfo) return STATUS_INVALID_DEVICE_REQUEST; memset(&VolumeInfo, 0, sizeof VolumeInfo); Result = FileSystem->Interface->GetVolumeInfo(FileSystem, &VolumeInfo); if (!NT_SUCCESS(Result)) return Result; memcpy(&Response->Rsp.QueryVolumeInformation.VolumeInfo, &VolumeInfo, sizeof VolumeInfo); return STATUS_SUCCESS; } FSP_API NTSTATUS FspFileSystemOpSetVolumeInformation(FSP_FILE_SYSTEM *FileSystem, FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response) { NTSTATUS Result; FSP_FSCTL_VOLUME_INFO VolumeInfo; Result = STATUS_INVALID_DEVICE_REQUEST; memset(&VolumeInfo, 0, sizeof VolumeInfo); switch (Request->Req.SetVolumeInformation.FsInformationClass) { case 2/*FileFsLabelInformation*/: if (0 != FileSystem->Interface->SetVolumeLabel) Result = FileSystem->Interface->SetVolumeLabel(FileSystem, (PWSTR)Request->Buffer, &VolumeInfo); break; } if (!NT_SUCCESS(Result)) return Result; memcpy(&Response->Rsp.SetVolumeInformation.VolumeInfo, &VolumeInfo, sizeof VolumeInfo); return STATUS_SUCCESS; } FSP_API NTSTATUS FspFileSystemOpQueryDirectory(FSP_FILE_SYSTEM *FileSystem, FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response) { NTSTATUS Result; ULONG BytesTransferred; if (0 == FileSystem->Interface->ReadDirectory) return STATUS_INVALID_DEVICE_REQUEST; BytesTransferred = 0; Result = FileSystem->Interface->ReadDirectory(FileSystem, (PVOID)ValOfFileContext(Request->Req.QueryDirectory), 0 != Request->Req.QueryDirectory.Pattern.Size ? (PWSTR)(Request->Buffer + Request->Req.QueryDirectory.Pattern.Offset) : 0, 0 != Request->Req.QueryDirectory.Marker.Size ? (PWSTR)(Request->Buffer + Request->Req.QueryDirectory.Marker.Offset) : 0, (PVOID)Request->Req.QueryDirectory.Address, Request->Req.QueryDirectory.Length, &BytesTransferred); if (!NT_SUCCESS(Result)) return Result; if (STATUS_PENDING != Result) Response->IoStatus.Information = BytesTransferred; return Result; } FSP_API NTSTATUS FspFileSystemOpFileSystemControl(FSP_FILE_SYSTEM *FileSystem, FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response) { NTSTATUS Result; PREPARSE_DATA_BUFFER ReparseData; SIZE_T Size; Result = STATUS_INVALID_DEVICE_REQUEST; switch (Request->Req.FileSystemControl.FsControlCode) { case FSCTL_GET_REPARSE_POINT: if (0 != FileSystem->Interface->GetReparsePoint) { ReparseData = (PREPARSE_DATA_BUFFER)Response->Buffer; memset(ReparseData, 0, sizeof *ReparseData); Size = FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX; Result = FileSystem->Interface->GetReparsePoint(FileSystem, (PVOID)ValOfFileContext(Request->Req.FileSystemControl), (PWSTR)Request->Buffer, ReparseData, &Size); if (NT_SUCCESS(Result)) { Response->Size = (UINT16)(sizeof *Response + Size); Response->Rsp.FileSystemControl.Buffer.Offset = 0; Response->Rsp.FileSystemControl.Buffer.Size = (UINT16)Size; } } break; case FSCTL_SET_REPARSE_POINT: if (0 != FileSystem->Interface->SetReparsePoint) { ReparseData = (PREPARSE_DATA_BUFFER) (Request->Buffer + Request->Req.FileSystemControl.Buffer.Offset); Result = FileSystem->Interface->SetReparsePoint(FileSystem, (PVOID)ValOfFileContext(Request->Req.FileSystemControl), (PWSTR)Request->Buffer, ReparseData, Request->Req.FileSystemControl.Buffer.Size); } break; case FSCTL_DELETE_REPARSE_POINT: if (0 != FileSystem->Interface->DeleteReparsePoint) { ReparseData = (PREPARSE_DATA_BUFFER) (Request->Buffer + Request->Req.FileSystemControl.Buffer.Offset); Result = FileSystem->Interface->DeleteReparsePoint(FileSystem, (PVOID)ValOfFileContext(Request->Req.FileSystemControl), (PWSTR)Request->Buffer, ReparseData, Request->Req.FileSystemControl.Buffer.Size); } break; } return Result; } FSP_API NTSTATUS FspFileSystemOpQuerySecurity(FSP_FILE_SYSTEM *FileSystem, FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response) { NTSTATUS Result; SIZE_T SecurityDescriptorSize; if (0 == FileSystem->Interface->GetSecurity) return STATUS_INVALID_DEVICE_REQUEST; SecurityDescriptorSize = FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX; Result = FileSystem->Interface->GetSecurity(FileSystem, (PVOID)ValOfFileContext(Request->Req.QuerySecurity), Response->Buffer, &SecurityDescriptorSize); if (!NT_SUCCESS(Result)) return STATUS_BUFFER_OVERFLOW != Result ? Result : STATUS_INVALID_SECURITY_DESCR; Response->Size = (UINT16)(sizeof *Response + SecurityDescriptorSize); Response->Rsp.QuerySecurity.SecurityDescriptor.Offset = 0; Response->Rsp.QuerySecurity.SecurityDescriptor.Size = (UINT16)SecurityDescriptorSize; return STATUS_SUCCESS; } FSP_API NTSTATUS FspFileSystemOpSetSecurity(FSP_FILE_SYSTEM *FileSystem, FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response) { if (0 == FileSystem->Interface->SetSecurity) return STATUS_INVALID_DEVICE_REQUEST; return FileSystem->Interface->SetSecurity(FileSystem, (PVOID)ValOfFileContext(Request->Req.SetSecurity), Request->Req.SetSecurity.SecurityInformation, (PSECURITY_DESCRIPTOR)Request->Buffer); } FSP_API NTSTATUS FspFileSystemOpQueryStreamInformation(FSP_FILE_SYSTEM *FileSystem, FSP_FSCTL_TRANSACT_REQ *Request, FSP_FSCTL_TRANSACT_RSP *Response) { NTSTATUS Result; ULONG BytesTransferred; if (0 == FileSystem->Interface->GetStreamInfo) return STATUS_INVALID_DEVICE_REQUEST; BytesTransferred = 0; Result = FileSystem->Interface->GetStreamInfo(FileSystem, (PVOID)ValOfFileContext(Request->Req.QueryStreamInformation), Response->Buffer, FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX, &BytesTransferred); if (!NT_SUCCESS(Result)) return Result; Response->Size = (UINT16)(sizeof *Response + BytesTransferred); Response->Rsp.QueryStreamInformation.Buffer.Offset = 0; Response->Rsp.QueryStreamInformation.Buffer.Size = (UINT16)BytesTransferred; return STATUS_SUCCESS; } FSP_FSCTL_STATIC_ASSERT( sizeof(UINT16) == sizeof ((FSP_FSCTL_DIR_INFO *)0)->Size && sizeof(UINT16) == sizeof ((FSP_FSCTL_STREAM_INFO *)0)->Size, "FSP_FSCTL_DIR_INFO::Size and FSP_FSCTL_STREAM_INFO::Size: sizeof must be 2."); static BOOLEAN FspFileSystemAddXxxInfo(PVOID Info, PVOID Buffer, ULONG Length, PULONG PBytesTransferred) { static UINT8 Zero[sizeof(UINT16)] = { 0 }; PVOID BufferEnd = (PUINT8)Buffer + Length; PVOID SrcBuffer; ULONG SrcLength, DstLength; if (0 != Info) { SrcBuffer = Info; SrcLength = *(PUINT16)Info; DstLength = FSP_FSCTL_DEFAULT_ALIGN_UP(SrcLength); } else { SrcBuffer = &Zero; SrcLength = sizeof Zero; DstLength = SrcLength; } Buffer = (PVOID)((PUINT8)Buffer + *PBytesTransferred); if ((PUINT8)Buffer + DstLength > (PUINT8)BufferEnd) return FALSE; memcpy(Buffer, SrcBuffer, SrcLength); *PBytesTransferred += DstLength; return TRUE; } FSP_API BOOLEAN FspFileSystemAddDirInfo(FSP_FSCTL_DIR_INFO *DirInfo, PVOID Buffer, ULONG Length, PULONG PBytesTransferred) { return FspFileSystemAddXxxInfo(DirInfo, Buffer, Length, PBytesTransferred); } FSP_API BOOLEAN FspFileSystemFindReparsePoint(FSP_FILE_SYSTEM *FileSystem, NTSTATUS (*GetReparsePointByName)( FSP_FILE_SYSTEM *FileSystem, PVOID Context, PWSTR FileName, BOOLEAN IsDirectory, PVOID Buffer, PSIZE_T PSize), PVOID Context, PWSTR FileName, PUINT32 PReparsePointIndex) { PWSTR RemainderPath, LastPathComponent; NTSTATUS Result; RemainderPath = FileName; for (;;) { while (L'\\' == *RemainderPath) RemainderPath++; LastPathComponent = RemainderPath; while (L'\\' != *RemainderPath) { if (L'\0' == *RemainderPath || L':' == *RemainderPath) return FALSE; RemainderPath++; } *RemainderPath = L'\0'; Result = GetReparsePointByName(FileSystem, Context, FileName, TRUE, 0, 0); *RemainderPath = L'\\'; if (STATUS_NOT_A_REPARSE_POINT == Result) /* it was not a reparse point; continue */ continue; else if (!NT_SUCCESS(Result)) return FALSE; /* * Found a reparse point! */ if (0 != PReparsePointIndex) *PReparsePointIndex = (ULONG)(LastPathComponent - FileName); return TRUE; } return FALSE; } static NTSTATUS FspFileSystemResolveReparsePointsInternal(FSP_FILE_SYSTEM *FileSystem, NTSTATUS (*GetReparsePointByName)( FSP_FILE_SYSTEM *FileSystem, PVOID Context, PWSTR FileName, BOOLEAN IsDirectory, PVOID Buffer, PSIZE_T PSize), PVOID Context, PREPARSE_DATA_BUFFER ReparseData, SIZE_T ReparseDataSize0, PWSTR FileName, UINT32 ReparsePointIndex, BOOLEAN ResolveLastPathComponent0, PIO_STATUS_BLOCK PIoStatus, PVOID Buffer, PSIZE_T PSize) { PREPARSE_DATA_BUFFER OutputReparseData; PWSTR TargetPath, RemainderPath, LastPathComponent, NewRemainderPath, ReparseTargetPath; WCHAR RemainderChar; SIZE_T ReparseDataSize, RemainderPathSize, ReparseTargetPathLength; BOOLEAN ResolveLastPathComponent; ULONG MaxTries = 32; NTSTATUS Result; RemainderPathSize = (lstrlenW(FileName) + 1) * sizeof(WCHAR); if (FIELD_OFFSET(REPARSE_DATA_BUFFER, SymbolicLinkReparseBuffer.PathBuffer) + RemainderPathSize > *PSize) return STATUS_REPARSE_POINT_NOT_RESOLVED; OutputReparseData = Buffer; memset(OutputReparseData, 0, FIELD_OFFSET(REPARSE_DATA_BUFFER, SymbolicLinkReparseBuffer.PathBuffer)); OutputReparseData->ReparseTag = IO_REPARSE_TAG_SYMLINK; OutputReparseData->SymbolicLinkReparseBuffer.Flags = SYMLINK_FLAG_RELATIVE; TargetPath = OutputReparseData->SymbolicLinkReparseBuffer.PathBuffer; memcpy(TargetPath, FileName, RemainderPathSize); ResolveLastPathComponent = ResolveLastPathComponent0; RemainderPath = TargetPath + ReparsePointIndex; for (;;) { while (L'\\' == *RemainderPath) RemainderPath++; LastPathComponent = RemainderPath; while (L'\\' != *RemainderPath) { if (L'\0' == *RemainderPath || L':' == *RemainderPath) { if (!ResolveLastPathComponent) goto symlink_exit; ResolveLastPathComponent = FALSE; break; } RemainderPath++; } /* handle dot and dotdot! */ if (L'.' == LastPathComponent[0]) { if (RemainderPath == LastPathComponent + 1) { /* dot */ ReparseTargetPath = 0; ReparseTargetPathLength = 0; NewRemainderPath = LastPathComponent; while (TargetPath < NewRemainderPath) { NewRemainderPath--; if (L'\\' == *NewRemainderPath) break; } goto reparse; } if (L'.' == LastPathComponent[1] && RemainderPath == LastPathComponent + 2) { /* dotdot */ ReparseTargetPath = 0; ReparseTargetPathLength = 0; NewRemainderPath = LastPathComponent; while (TargetPath < NewRemainderPath) { NewRemainderPath--; if (L'\\' != *NewRemainderPath) break; } while (TargetPath < NewRemainderPath) { NewRemainderPath--; if (L'\\' == *NewRemainderPath) break; } goto reparse; } } RemainderChar = *RemainderPath; *RemainderPath = L'\0'; ReparseDataSize = ReparseDataSize0; Result = GetReparsePointByName(FileSystem, Context, TargetPath, L'\\' == RemainderChar, ReparseData, &ReparseDataSize); *RemainderPath = RemainderChar; if (STATUS_NOT_A_REPARSE_POINT == Result) /* it was not a reparse point; continue */ continue; else if (STATUS_OBJECT_NAME_NOT_FOUND == Result && L'\\' != RemainderChar) goto symlink_exit; else if (!NT_SUCCESS(Result)) { if (STATUS_OBJECT_NAME_NOT_FOUND != Result) Result = STATUS_OBJECT_PATH_NOT_FOUND; return Result; } /* * Found a reparse point! */ /* if not a symlink return the full reparse point */ if (IO_REPARSE_TAG_SYMLINK != ReparseData->ReparseTag) goto reparse_data_exit; if (0 == --MaxTries) return STATUS_REPARSE_POINT_NOT_RESOLVED; ReparseTargetPath = ReparseData->SymbolicLinkReparseBuffer.PathBuffer + ReparseData->SymbolicLinkReparseBuffer.SubstituteNameOffset / sizeof(WCHAR); ReparseTargetPathLength = ReparseData->SymbolicLinkReparseBuffer.SubstituteNameLength; /* if device relative symlink replace whole path; else replace last path component */ NewRemainderPath = ReparseTargetPathLength >= sizeof(WCHAR) && L'\\' == ReparseTargetPath[0] ? TargetPath : LastPathComponent; reparse: RemainderPathSize = (lstrlenW(RemainderPath) + 1) * sizeof(WCHAR); if ((PUINT8)NewRemainderPath + ReparseTargetPathLength + RemainderPathSize > (PUINT8)Buffer + *PSize) return STATUS_REPARSE_POINT_NOT_RESOLVED; /* move remainder path to its new position */ memmove((PUINT8)NewRemainderPath + ReparseTargetPathLength, RemainderPath, RemainderPathSize); /* copy symlink target */ memcpy(NewRemainderPath, ReparseTargetPath, ReparseTargetPathLength); /* if an absolute (in the NT namespace) symlink exit now */ if (0 != ReparseTargetPath /* ensure we are not doing dot handling */ && 0 == (ReparseData->SymbolicLinkReparseBuffer.Flags & SYMLINK_FLAG_RELATIVE) && ReparseTargetPathLength >= sizeof(WCHAR) && L'\\' == ReparseTargetPath[0]) { OutputReparseData->SymbolicLinkReparseBuffer.Flags = 0; goto symlink_exit; } ResolveLastPathComponent = ResolveLastPathComponent0; RemainderPath = NewRemainderPath; } symlink_exit: OutputReparseData->SymbolicLinkReparseBuffer.SubstituteNameLength = OutputReparseData->SymbolicLinkReparseBuffer.PrintNameLength = (USHORT)lstrlenW(OutputReparseData->SymbolicLinkReparseBuffer.PathBuffer) * sizeof(WCHAR); OutputReparseData->ReparseDataLength = FIELD_OFFSET(REPARSE_DATA_BUFFER, SymbolicLinkReparseBuffer.PathBuffer) - FIELD_OFFSET(REPARSE_DATA_BUFFER, SymbolicLinkReparseBuffer) + OutputReparseData->SymbolicLinkReparseBuffer.SubstituteNameLength; *PSize = FIELD_OFFSET(REPARSE_DATA_BUFFER, SymbolicLinkReparseBuffer) + OutputReparseData->ReparseDataLength; PIoStatus->Status = STATUS_REPARSE; PIoStatus->Information = ReparseData->ReparseTag; return STATUS_REPARSE; reparse_data_exit: if (ReparseDataSize > *PSize) return IO_REPARSE_TAG_SYMLINK != ReparseData->ReparseTag ? STATUS_IO_REPARSE_DATA_INVALID : STATUS_REPARSE_POINT_NOT_RESOLVED; *PSize = ReparseDataSize; memcpy(Buffer, ReparseData, ReparseDataSize); PIoStatus->Status = STATUS_REPARSE; PIoStatus->Information = ReparseData->ReparseTag; return STATUS_REPARSE; } FSP_API NTSTATUS FspFileSystemResolveReparsePoints(FSP_FILE_SYSTEM *FileSystem, NTSTATUS (*GetReparsePointByName)( FSP_FILE_SYSTEM *FileSystem, PVOID Context, PWSTR FileName, BOOLEAN IsDirectory, PVOID Buffer, PSIZE_T PSize), PVOID Context, PWSTR FileName, UINT32 ReparsePointIndex, BOOLEAN ResolveLastPathComponent, PIO_STATUS_BLOCK PIoStatus, PVOID Buffer, PSIZE_T PSize) { PREPARSE_DATA_BUFFER ReparseData; NTSTATUS Result; ReparseData = MemAlloc(FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX); if (0 == ReparseData) return STATUS_INSUFFICIENT_RESOURCES; Result = FspFileSystemResolveReparsePointsInternal(FileSystem, GetReparsePointByName, Context, ReparseData, FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX, FileName, ReparsePointIndex, ResolveLastPathComponent, PIoStatus, Buffer, PSize); MemFree(ReparseData); return Result; } FSP_API NTSTATUS FspFileSystemCanReplaceReparsePoint( PVOID CurrentReparseData, SIZE_T CurrentReparseDataSize, PVOID ReplaceReparseData, SIZE_T ReplaceReparseDataSize) { if (sizeof(ULONG) > CurrentReparseDataSize || sizeof(ULONG) > ReplaceReparseDataSize) return STATUS_IO_REPARSE_DATA_INVALID; /* should not happen! */ else if (*(PULONG)CurrentReparseData != *(PULONG)ReplaceReparseData) return STATUS_IO_REPARSE_TAG_MISMATCH; else if (!IsReparseTagMicrosoft(*(PULONG)CurrentReparseData) && ( (SIZE_T)REPARSE_GUID_DATA_BUFFER_HEADER_SIZE > CurrentReparseDataSize || (SIZE_T)REPARSE_GUID_DATA_BUFFER_HEADER_SIZE > ReplaceReparseDataSize || *(PUINT32)&((PREPARSE_GUID_DATA_BUFFER)CurrentReparseData)->ReparseGuid.Data1 != *(PUINT32)&((PREPARSE_GUID_DATA_BUFFER)ReplaceReparseData)->ReparseGuid.Data1 || *(PUINT32)&((PREPARSE_GUID_DATA_BUFFER)CurrentReparseData)->ReparseGuid.Data2 != *(PUINT32)&((PREPARSE_GUID_DATA_BUFFER)ReplaceReparseData)->ReparseGuid.Data2 || *(PUINT32)&((PREPARSE_GUID_DATA_BUFFER)CurrentReparseData)->ReparseGuid.Data4[0] != *(PUINT32)&((PREPARSE_GUID_DATA_BUFFER)ReplaceReparseData)->ReparseGuid.Data4[0] || *(PUINT32)&((PREPARSE_GUID_DATA_BUFFER)CurrentReparseData)->ReparseGuid.Data4[4] != *(PUINT32)&((PREPARSE_GUID_DATA_BUFFER)ReplaceReparseData)->ReparseGuid.Data4[4])) return STATUS_REPARSE_ATTRIBUTE_CONFLICT; else return STATUS_SUCCESS; } FSP_API BOOLEAN FspFileSystemAddStreamInfo(FSP_FSCTL_STREAM_INFO *StreamInfo, PVOID Buffer, ULONG Length, PULONG PBytesTransferred) { return FspFileSystemAddXxxInfo(StreamInfo, Buffer, Length, PBytesTransferred); }
yogendersolanki91/winfsp
src/dll/fsop.c
C
gpl-3.0
62,778
<?php /** * @file * Definition of DeimsContentDataSetMigration. */ class EmlDatasetMigration extends XMLMigration { protected $dependencies = array('EmlDataFile'); public function __construct(array $arguments) { parent::__construct($arguments); $this->description = t('EML migration of the main data set body'); // all fields that come from EML an map to the Person Content Type $fields = array( 'alternateIdentifier' => t('The dataset abbreviation, a short name'), 'title' => t('The dataset title'), 'abstract' => t('The dataset abstract'), 'purpose' => t('The dataset purpose'), 'methods' => t('The dataset methods'), 'additionalInfo' =>('The dataset additional information'), 'instrumentation' =>('The dataset instrumentation'), 'qualityControl' =>('The dataset quality assurance'), 'geoRef' => ('A geographical reference'), 'temporal' => ('The time when the data set was collected'), 'creatorRef' => ('A dataset pi or owner(s) reference'), 'contactRef' => ('A dataset contact reference'), 'metadataProviderRef' => ('A dataset metadata provider reference'), 'publisherRef' => ('A dataset publisher reference'), 'pubdate' => t('The dataset publication date'), 'beginDate' => t('The dataset start date'), 'endDate' => t ('The last date of the dataset record'), 'language' => t('The dataset language'), // 'associatedparties' => t('The dataset associated roles'), 'keywordRef' => t('The keywords tagging this dataset'), 'customKeywordRef' => t('The pi-assigned keywords tagging this dataset'), 'coreArea' => t('A core area term. Extends EML'), 'maintenance' => t('The dataset maintenance'), 'dataRasterRef' => t('The data sources associated with this dataset'), 'datasetid' => t('The dataset id'), 'revisionid' => t('The dataset EML revision id'), ); // The source ID here is the one retrieved from the XML listing file, // index.xml, whose element root is docid. it is // used to identify the specific item's file (anole, el verde, etc) $this->map = new MigrateSQLMap($this->machineName, array( 'sourceid' => array( 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'description' => 'PackageId', ) ), MigrateDestinationNode::getKeySchema() ); ///////////////////////////////////////////////////// ///CHANGE EDIT EML FILE HERE or use sh script.. ////////////////////////////////////////////////////// // This can also be an URL instead of a local file path. $xml_folder = DRUPAL_ROOT . '/' . drupal_get_path('module', 'eml_2_deims') . '/xml/unh-river-network/'; $items_url = $xml_folder . 'oldemlfilename.xml'; // the xpath $item_xpath = '/eml:eml'; // relative to document $item_ID_xpath = '@packageId'; // relative to item_xpath $this->source = new MigrateSourceXML($items_url, $item_xpath, $item_ID_xpath, $fields); $this->destination = new MigrateDestinationNode('data_set'); $this->addFieldMapping('title','title') ->xpath('dataset/title'); $this->addFieldMapping('field_short_name', 'alternateIdentifier') ->xpath('dataset/alternateIdentifier'); $this->addFieldMapping('field_abstract','abstract') ->xpath('dataset/abstract/section/para'); $this->addFieldMapping('field_section:ignore_case')->defaultValue(TRUE); $this->addFieldMapping('field_section')->defaultValue('River Network'); //@todo here again, it is a complex element // This content type does not have a body field. $this->addFieldMapping('field_data_set_id', 'datasetid') ->description('dataset id may come from packageId in prepareRow'); $this->addFieldMapping('field_eml_revision_id','revisionid') ->description('Extract revision in prepareRow'); // this is not part of EML -- Added to make the migration effective $this->addFieldMapping('field_core_areas', 'coreArea') ->xpath('dataset/coreArea'); $this->addFieldMapping('field_core_areas:ignore_case')->defaultValue(TRUE); //$this->addFieldMapping('field_keywords', '9'); $this->addFieldMapping('field_station_keywords_ref:source_type')->defaultValue('tid'); $this->addFieldMapping('field_station_keywords_ref', 'customKeywordRef') ->description('Tweak in prepareRow'); $this->addFieldMapping('field_station_keywords_ref:ignore_case') ->defaultValue(TRUE); $this->addFieldMapping('field_section:ignore_case')->defaultValue(TRUE); $this->addFieldMapping('field_section')->defaultValue('Belowground'); $this->addFieldMapping('field_purpose', 'purpose') ->xpath('dataset/purpose/section/para/literalLayout'); //@todo another text type for parsing $this->addFieldMapping('field_additional_information', 'additionalInfo') ->xpath('dataset/additionalInfo/para/literalLayout'); $this->addFieldMapping('field_maintenance', 'maintenance') ->xpath('dataset/maintenance/description/section/para/literalLayout'); //@todo another text type for parsing $this->addFieldMapping('field_data_sources', 'dataRasterRef') ->description('In preparerow'); $this->addFieldMapping('field_methods', 'methods') ->description('in prepareRow'); // ->xpath('dataset/methods/methodStep/description'); //@todo another text type for parsing $this->addFieldMapping('field_instrumentation', 'instrumentation') ->xpath('dataset/methods/methodStep/instrumentation'); $this->addFieldMapping('field_quality_assurance', 'qualityControl') ->xpath('dataset/methods/qualityControl/description/para/literalLayout'); //@todo dates may come in other flavors, such as singleDateTime, repeated $this->addFieldMapping('field_date_range', 'beginDate') ->xpath('dataset/coverage/temporalCoverage/rangeOfDates/beginDate/calendarDate') ->description('date str to time in prepareRow'); $this->addFieldMapping('field_date_range:to', 'endDate') ->xpath('dataset/coverage/temporalCoverage/rangeOfDates/endDate/calendarDate') ->description('date str to time in prepareRow'); $this->addFieldMapping('field_publication_date', 'pubdate') ->xpath('dataset/pubDate') ->description('date str to time in prepareRow'); $this->addFieldMapping('field_person_creator', 'creatorRef') ->xpath('dataset/creator/individualName/surName') ->description('lookup creator in prepareRow'); $this->addFieldMapping('field_person_contact', 'contactRef') ->defaultValue(2226); $this->addFieldMapping('field_person_metadata_provider', 'metadataProviderRef') ->defaultValue(2226); $this->addFieldMapping('field_person_publisher', 'publisherRef') ->defaultValue(2226); $this->addFieldMapping('uid')->defaultValue(1); // $this->addUnmigratedSources(array( // 'associatedparties', // Handled in prepare() // )); $this->addUnmigratedDestinations(array( 'field_data_set_id:language', 'field_abstract:language', 'field_short_name:language', 'field_purpose:language', 'field_additional_information:language', 'field_related_links:language', 'field_maintenance:language', 'field_methods:language', 'field_instrumentation:language', 'field_quality_assurance:language', 'field_doi', 'field_doi:language', 'field_eml_hash', 'field_eml_hash:language', 'field_eml_link', 'field_eml_valid', 'created', 'changed', 'status', // Published 'promote', // Promoted to front page 'sticky', // Sticky at top of lists 'revision', // Create new revision 'log', // Revision Log message 'language', // Language (fr, en, ...) 'tnid', // The translation set id for this node 'translate', // A boolean indicating whether this translation page needs to be updated 'revision_uid', )); } public function prepareRow($row) { parent::prepareRow($row); //dataset id $pa = $row->xml->attributes(); $val=$pa['packageId']; list($scope, $identifier, $revision)= explode('.', $val, 3); $row->datasetid = $identifier; $row->revisionid= $revision; //dataset shortname if(!isset($row->xml->dataset->alternateIdentifier)){ $row->xml->dataset->alternateIdentifier = 'No short name assigned'; } //pubdate if (preg_match('/(\d+)/',$row->xml->dataset->pubDate, $found)){ $mydate = date('Y-m-d H:i:s',strtotime("$found[1]-01-01 00:00:00")); $row->xml->dataset->pubDate = $mydate; } // begin date if ( preg_match('/(\d+)-(\d+)-(\d+)/',$row->xml->dataset->coverage->temporalCoverage->rangeOfDates->beginDate->calendarDate, $found)){ $mydate = date('Y-m-d H:i:s',strtotime("$found[1]-$found[2]-$found[3] 00:00:00")); $row->xml->dataset->coverage->temporalCoverage->rangeOfDates->beginDate->calendarDate = $mydate; } else if ( preg_match('/(\d+)/',$row->xml->dataset->coverage->temporalCoverage->rangeOfDates->beginDate->calendarDate, $found)){ $mydate = date('Y-m-d H:i:s',strtotime("$found[1]-01-01 00:00:00")); $row->xml->dataset->coverage->temporalCoverage->rangeOfDates->beginDate->calendarDate = $mydate; } // end date if ( preg_match('/(\d+)-(\d+)-(\d+)/',$row->xml->dataset->coverage->temporalCoverage->rangeOfDates->endDate->calendarDate, $found)){ $mydate = date('Y-m-d H:i:s',strtotime("$found[1]-$found[2]-$found[3] 00:00:00")); $row->xml->dataset->coverage->temporalCoverage->rangeOfDates->endDate->calendarDate = $mydate; } else if ( preg_match('/(\d+)/',$row->xml->dataset->coverage->temporalCoverage->rangeOfDates->endDate->calendarDate, $found)){ $mydate = date('Y-m-d H:i:s',strtotime("$found[1]-12-31 00:00:00")); $row->xml->dataset->coverage->temporalCoverage->rangeOfDates->endDate->calendarDate = $mydate; } // creator last name $surnameid = $this->getPerson($row); $row->xml->dataset->creator->individualName->surName = $surnameid; // Datasource $row->dataRasterRef = $this->getDataSource($row); // pi-assigned keywords in <keywordSet> construct $row->customKeywordRef = $this->getKeywords($row); // EML Methods: $methods_values = ''; foreach($row->xml->dataset->methods->methodStep->description->para->ulink as $parael){ $methods_values .= 'For additional methods and metadata, see: '. (string)$parael; } $row->methods = $methods_values; } public function getPerson($row) { // query database here, match with $row element, return nid for this person, otherwise false. // Search for an already migrated person entity with the same title // (title is "givenName" "surName") if (!empty($row->xml->dataset->creator->individualName->surName)) { $query = new EntityFieldQuery(); $query->entityCondition('entity_type', 'node'); $query->entityCondition('bundle', 'person'); $query->propertyCondition('title', $row->xml->dataset->creator->individualName->surName, 'CONTAINS'); $results = $query->execute(); if (!empty($results['node'])) { $nid = reset($results['node'])->nid; // watchdog('EML2DEIMS:', "Ds-Person query matches: $nid"); }else{ $strquery = print_r($query); // watchdog('EML2DEIMS:', "Ds-Person query yield no matches $strquery "); } } return $nid; } public function getDataSource($row) { $field_values = array(); foreach($row->xml->dataset->spatialRaster as $xmldatasource) { $source_id = $xmldatasource->physical->objectName; $field_values[] = $this->handleSourceMigration('EmlDataFile', $source_id); } return $field_values; } public function getKeywords($row) { $field_values = array(); foreach($row->xml->dataset->keywordSet->keyword as $xmlkeyword) { $keym = (string)$xmlkeyword; $keys = $pieces = explode(" ", $keym); foreach ($keys as $keywd) { if ($value = $this->handleSourceMigration('EmlKeywords', $keywd) ) { $field_values[] = $value; } } } return $field_values; } }
lter/deims-pie-custom
modules/eml_2_deims/premigration/unh-river-network/EmlDatasetMigration.php
PHP
gpl-3.0
12,441
/* * Unfuddle Tracker is a time tracking tool for Unfuddle service. * Copyright (C) 2012 Vadim Zakondyrin <thekondr@crystalnix.com> * * This file is part of Unfuddle Tracker. * * Unfuddle Tracker 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. * * Unfuddle Tracker 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 Unfuddle Tracker. If not, see <http://www.gnu.org/licenses/>. */ #ifndef WINAUTORUN_H #define WINAUTORUN_H #include "autorunimp.h" #include <QSettings> #include <QCoreApplication> class WinAutoRun : public AutoRunImp { public: WinAutoRun(); virtual ~WinAutoRun(); virtual bool autoRunOn(); virtual bool autoRunOff(); virtual bool isAutoRunning() const; private: QSettings loginsettings; QString getRunString() const; }; const QString loginSettingsPath = "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run"; #endif // WINAUTORUN_H
Crystalnix/Unfuddle-tracker
src/autorun/winautorun.h
C
gpl-3.0
1,385
""" WSGI config for model_advanced project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETTINGS_MODULE", "model_advanced.settings") application = get_wsgi_application()
mjiang-27/django_learn
model_advanced/model_advanced/wsgi.py
Python
gpl-3.0
406
\hypertarget{classrender}{}\section{render Class Reference} \label{classrender}\index{render@{render}} \subsection*{Public Member Functions} \begin{DoxyCompactItemize} \item \mbox{\Hypertarget{classrender_a57f6475d3e11334afcec4b724b3a746a}\label{classrender_a57f6475d3e11334afcec4b724b3a746a}} void {\bfseries set\+\_\+render\+\_\+mode} (int) \item \mbox{\Hypertarget{classrender_ae8aaaf8468b231a1a80eb9c5f36426cd}\label{classrender_ae8aaaf8468b231a1a80eb9c5f36426cd}} int {\bfseries get\+\_\+render\+\_\+mode} (void) \item \mbox{\Hypertarget{classrender_af54c64b6812b29be0d7110a971b13fb1}\label{classrender_af54c64b6812b29be0d7110a971b13fb1}} void {\bfseries set\+\_\+render\+\_\+frames} (int) \item \mbox{\Hypertarget{classrender_a3bf3a1d51acfd38ada4ae8c4acae05e5}\label{classrender_a3bf3a1d51acfd38ada4ae8c4acae05e5}} int {\bfseries get\+\_\+render\+\_\+frames} (void) \item \mbox{\Hypertarget{classrender_a7469c8caa957bcf3dca4eec96c1bcb7c}\label{classrender_a7469c8caa957bcf3dca4eec96c1bcb7c}} void {\bfseries run\+\_\+render} (void) \end{DoxyCompactItemize} The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize} \item include/render.\+h\item src/render.\+cpp\end{DoxyCompactItemize}
DMJC/mg2modeller-
doc/latex/classrender.tex
TeX
gpl-3.0
1,249
package br.com.sistemapetshop.model; /** * * @author Jonathan Romualdo */ public enum StatusConsulta { MARCADA, CONSULTADA, CONCLUIDA; }
Allansantosdefreitas/Projeto-software-corporativo
Projeto/SoftCorpPet/SoftCorpPet/src/main/java/br/com/sistemapetshop/model/StatusConsulta.java
Java
gpl-3.0
151
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.11"/> <title>vcvj: Member List</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <script type="text/javascript"> $(document).ready(function() { init_search(); }); </script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">vcvj &#160;<span id="projectnumber">0.1.0</span> </div> <div id="projectbrief">A C# class library for lexical parsing and transformation of GIF images</div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.11 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <span class="left"> <img id="MSearchSelect" src="search/mag_sel.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> </span><span class="right"> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </span> </div> </li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="annotated.html"><span>Class&#160;List</span></a></li> <li><a href="classes.html"><span>Class&#160;Index</span></a></li> <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li> <li><a href="functions.html"><span>Class&#160;Members</span></a></li> </ul> </div> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="namespacevcvj.html">vcvj</a></li><li class="navelem"><a class="el" href="namespacevcvj_1_1_models.html">Models</a></li><li class="navelem"><a class="el" href="namespacevcvj_1_1_models_1_1_grammatical___subcomponents.html">Grammatical_Subcomponents</a></li><li class="navelem"><a class="el" href="classvcvj_1_1_models_1_1_grammatical___subcomponents_1_1_color_table.html">ColorTable</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="headertitle"> <div class="title">vcvj.Models.Grammatical_Subcomponents.ColorTable Member List</div> </div> </div><!--header--> <div class="contents"> <p>This is the complete list of members for <a class="el" href="classvcvj_1_1_models_1_1_grammatical___subcomponents_1_1_color_table.html">vcvj.Models.Grammatical_Subcomponents.ColorTable</a>, including all inherited members.</p> <table class="directory"> <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>Bytes</b> (defined in <a class="el" href="classvcvj_1_1_models_1_1_grammatical___subcomponents_1_1_color_table.html">vcvj.Models.Grammatical_Subcomponents.ColorTable</a>)</td><td class="entry"><a class="el" href="classvcvj_1_1_models_1_1_grammatical___subcomponents_1_1_color_table.html">vcvj.Models.Grammatical_Subcomponents.ColorTable</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="classvcvj_1_1_models_1_1_grammatical___subcomponents_1_1_color_table.html#acdf650955484bc8e7b75518c5369939e">DistinctColorCount</a></td><td class="entry"><a class="el" href="classvcvj_1_1_models_1_1_grammatical___subcomponents_1_1_color_table.html">vcvj.Models.Grammatical_Subcomponents.ColorTable</a></td><td class="entry"></td></tr> <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>IsGlobal</b> (defined in <a class="el" href="classvcvj_1_1_models_1_1_grammatical___subcomponents_1_1_color_table.html">vcvj.Models.Grammatical_Subcomponents.ColorTable</a>)</td><td class="entry"><a class="el" href="classvcvj_1_1_models_1_1_grammatical___subcomponents_1_1_color_table.html">vcvj.Models.Grammatical_Subcomponents.ColorTable</a></td><td class="entry"></td></tr> <tr bgcolor="#f0f0f0"><td class="entry"><b>Randomize</b>() (defined in <a class="el" href="classvcvj_1_1_models_1_1_grammatical___subcomponents_1_1_color_table.html">vcvj.Models.Grammatical_Subcomponents.ColorTable</a>)</td><td class="entry"><a class="el" href="classvcvj_1_1_models_1_1_grammatical___subcomponents_1_1_color_table.html">vcvj.Models.Grammatical_Subcomponents.ColorTable</a></td><td class="entry"><span class="mlabel">inline</span></td></tr> <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>RandomizeHalf</b>() (defined in <a class="el" href="classvcvj_1_1_models_1_1_grammatical___subcomponents_1_1_color_table.html">vcvj.Models.Grammatical_Subcomponents.ColorTable</a>)</td><td class="entry"><a class="el" href="classvcvj_1_1_models_1_1_grammatical___subcomponents_1_1_color_table.html">vcvj.Models.Grammatical_Subcomponents.ColorTable</a></td><td class="entry"><span class="mlabel">inline</span></td></tr> <tr bgcolor="#f0f0f0"><td class="entry"><b>TotalBlockLength</b> (defined in <a class="el" href="classvcvj_1_1_models_1_1_grammatical___subcomponents_1_1_color_table.html">vcvj.Models.Grammatical_Subcomponents.ColorTable</a>)</td><td class="entry"><a class="el" href="classvcvj_1_1_models_1_1_grammatical___subcomponents_1_1_color_table.html">vcvj.Models.Grammatical_Subcomponents.ColorTable</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="classvcvj_1_1_models_1_1_grammatical___subcomponents_1_1_color_table.html#a724c64bb00cb26222ea6c753970c9df2">XOR</a>(byte b)</td><td class="entry"><a class="el" href="classvcvj_1_1_models_1_1_grammatical___subcomponents_1_1_color_table.html">vcvj.Models.Grammatical_Subcomponents.ColorTable</a></td><td class="entry"><span class="mlabel">inline</span></td></tr> </table></div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.11 </small></address> </body> </html>
alexqfredrickson/vcvj
docs/html/classvcvj_1_1_models_1_1_grammatical___subcomponents_1_1_color_table-members.html
HTML
gpl-3.0
7,760
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import <Foundation/Foundation.h> @class NSDictionary; __attribute__((visibility("hidden"))) @interface WAPhoneNumberGeocoder : NSObject { NSDictionary *_maps; } + (id)sharedGeocoder; - (void)collectAvailableMaps; - (void)renameGeocodingFiles; - (id)locationTextForPhoneNumber:(id)arg1; - (id)init; @end
iMokhles/WAEnhancer
WAHeaders/WAPhoneNumberGeocoder.h
C
gpl-3.0
453
<div class="row"> <div class="col-lg-12"> <div class="jumbotron"> <h1>Bootstrap Tutorial</h1> <p>Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive, mobile-first projects on the web.</p> </div> </div> </div> <div class="row"> <div class="col-lg-12 textrow"> <div class="page-header"> <h1>Example Page Header</h1> </div> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> <div class="jumbotron"> <h1>Bootstrap Tutorial</h1> <p>Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive, mobile-first projects on the web.</p> </div> <h1>Blockquotes</h1> <p>The blockquote element is used to present content from another source:</p> <blockquote> <p>For 50 years, WWF has been protecting the future of nature. The world's leading conservation organization, WWF works in 100 countries and is supported1.2 million members in the United States and close to 5 million globally.</p> <footer>From WWF's website</footer> </blockquote> <a href="#"><img class="img-fluid" src="http://placehold.it/700x400" alt="logo"></a> </div> <hr> <div class="row full-images"> <div class="col-lg-12"> <a href="project1.php"><img class="img-fluid" src="img/poster.jpg" alt="Poster Noord Hollands Jeugd Orkest, program march 2015"></a> <a href="project2.php"><img class="img-fluid" src="img/bitcare.jpg" alt="Mockup bitcare for parents ios application"></a> <a href="project3.php"><img class="img-fluid" src="img/letters.jpg" alt="Project 3"></a> </div> </div>
thijsvandiessen/portfolio
elements/example2.php
PHP
gpl-3.0
1,961
#!/usr/bin/env bash set -o errexit #abort if any command fails # cloned from https://github.com/X1011/git-directory-deploy # CONFIG: # GIT_DEPLOY_DIR: root of the tree of files to deploy # GIT_DEPLOY_BRANCH: branch to commit files to and push to origin # GIT_DEPLOY_USERNAME, GIT_DEPLOY_EMAIL: identity to use for git commits if none is set already. Useful for CI servers. # GIT_DEPLOY_REPO: repository to deploy to. Must be readable and writable. The default of "origin" will # not work on Travis CI, since it uses the read-only git protocol. In that case, it is recommended to store a GitHub # token in a secure environment variable and use it in an HTTPS URL # like this: repo=https://$GITHUB_TOKEN@github.com/user/repo.git main() { deploy_directory=${GIT_DEPLOY_DIR:-dist} deploy_branch=${GIT_DEPLOY_BRANCH:-gh-pages} #if no user identity is already set in the current git environment, use this: default_username=${GIT_DEPLOY_USERNAME:-deploy.sh} default_email=${GIT_DEPLOY_EMAIL:-} #repository to deploy to. must be readable and writable. repo=${GIT_DEPLOY_REPO:-origin} #append commit hash to the end of message by default append_hash=true # Parse arg flags while : ; do if [[ $1 = "-v" || $1 = "--verbose" ]]; then verbose=true shift elif [[ $1 = "-e" || $1 = "--allow-empty" ]]; then allow_empty=true shift elif [[ ( $1 = "-m" || $1 = "--message" ) && -n $2 ]]; then commit_message=$2 shift 2 elif [[ $1 = "-n" || $1 = "--no-hash" ]]; then append_hash=false shift else break fi done enable_expanded_output if ! git diff --exit-code --quiet --cached; then echo Aborting due to uncommitted changes in the index >&2 return 1 fi commit_title=`git log -n 1 --format="%s" HEAD` commit_hash=` git log -n 1 --format="%H" HEAD` #default commit message uses last title if a custom one is not supplied if [[ -z $commit_message ]]; then commit_message="publish: $commit_title" fi #append hash to commit message unless no hash flag was found if [ $append_hash = true ]; then commit_message="$commit_message"$'\n\n'"generated from commit $commit_hash" fi previous_branch=`git rev-parse --abbrev-ref HEAD` if [ ! -d "$deploy_directory" ]; then echo "Deploy directory '$deploy_directory' does not exist. Aborting." >&2 return 1 fi # must use short form of flag in ls for compatibility with OS X and BSD if [[ -z `ls -A "$deploy_directory" 2> /dev/null` && -z $allow_empty ]]; then echo "Deploy directory '$deploy_directory' is empty. Aborting. If you're sure you want to deploy an empty tree, use the --allow-empty / -e flag." >&2 return 1 fi if git ls-remote --exit-code $repo "refs/heads/$deploy_branch" ; then # deploy_branch exists in $repo; make sure we have the latest version disable_expanded_output git fetch --force $repo $deploy_branch:$deploy_branch enable_expanded_output fi # check if deploy_branch exists locally if git show-ref --verify --quiet "refs/heads/$deploy_branch" then incremental_deploy else initial_deploy fi restore_head } initial_deploy() { git --work-tree "$deploy_directory" checkout --orphan $deploy_branch git --work-tree "$deploy_directory" add --all commit+push } incremental_deploy() { #make deploy_branch the current branch git symbolic-ref HEAD refs/heads/$deploy_branch #put the previously committed contents of deploy_branch into the index git --work-tree "$deploy_directory" reset --mixed --quiet git --work-tree "$deploy_directory" add --all set +o errexit diff=$(git --work-tree "$deploy_directory" diff --exit-code --quiet HEAD --)$? set -o errexit case $diff in 0) echo No changes to files in $deploy_directory. Skipping commit.;; 1) commit+push;; *) echo git diff exited with code $diff. Aborting. Staying on branch $deploy_branch so you can debug. To switch back to master, use: git symbolic-ref HEAD refs/heads/master && git reset --mixed >&2 return $diff ;; esac } commit+push() { set_user_id git --work-tree "$deploy_directory" commit -m "$commit_message" disable_expanded_output #--quiet is important here to avoid outputting the repo URL, which may contain a secret token git push --quiet $repo $deploy_branch enable_expanded_output } #echo expanded commands as they are executed (for debugging) enable_expanded_output() { if [ $verbose ]; then set -o xtrace set +o verbose fi } #this is used to avoid outputting the repo URL, which may contain a secret token disable_expanded_output() { if [ $verbose ]; then set +o xtrace set -o verbose fi } set_user_id() { if [[ -z `git config user.name` ]]; then git config user.name "$default_username" fi if [[ -z `git config user.email` ]]; then git config user.email "$default_email" fi } restore_head() { if [[ $previous_branch = "HEAD" ]]; then #we weren't on any branch before, so just set HEAD back to the commit it was on git update-ref --no-deref HEAD $commit_hash $deploy_branch else git symbolic-ref HEAD refs/heads/$previous_branch fi git reset --mixed } filter() { sed -e "s|$repo|\$repo|g" } sanitize() { "$@" 2> >(filter 1>&2) | filter } [[ $1 = --source-only ]] || main "$@"
ivarprudnikov/android_sensors
website/deploy_to_github.sh
Shell
gpl-3.0
5,170
#!/usr/bin/env python # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai __license__ = 'GPL v3' __copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>' __docformat__ = 'restructuredtext en' import os, subprocess, hashlib, shutil, glob, stat, sys, time from subprocess import check_call from tempfile import NamedTemporaryFile, mkdtemp from zipfile import ZipFile if __name__ == '__main__': d = os.path.dirname sys.path.insert(0, d(d(os.path.abspath(__file__)))) from setup import Command, __version__, installer_name, __appname__ PREFIX = "/var/www/calibre-ebook.com" DOWNLOADS = PREFIX+"/htdocs/downloads" BETAS = DOWNLOADS +'/betas' USER_MANUAL = '/var/www/localhost/htdocs/' HTML2LRF = "calibre/ebooks/lrf/html/demo" TXT2LRF = "src/calibre/ebooks/lrf/txt/demo" STAGING_HOST = '67.207.135.179' STAGING_USER = 'root' STAGING_DIR = '/root/staging' def installers(): installers = list(map(installer_name, ('dmg', 'msi', 'tar.bz2'))) installers.append(installer_name('tar.bz2', is64bit=True)) installers.insert(0, 'dist/%s-%s.tar.xz'%(__appname__, __version__)) installers.append('dist/%s-portable-%s.zip'%(__appname__, __version__)) return installers def installer_description(fname): if fname.endswith('.tar.xz'): return 'Source code' if fname.endswith('.tar.bz2'): bits = '32' if 'i686' in fname else '64' return bits + 'bit Linux binary' if fname.endswith('.msi'): return 'Windows installer' if fname.endswith('.dmg'): return 'OS X dmg' if fname.endswith('.zip'): return 'Calibre Portable' return 'Unknown file' class ReUpload(Command): # {{{ description = 'Re-uplaod any installers present in dist/' sub_commands = ['upload_installers'] def pre_sub_commands(self, opts): opts.replace = True def run(self, opts): for x in installers(): if os.path.exists(x): os.remove(x) # }}} # Data {{{ def get_google_data(): with open(os.path.expanduser('~/work/kde/conf/googlecodecalibre'), 'rb') as f: gc_password, ga_un, pw = f.read().strip().split('|') return { 'username':ga_un, 'password':pw, 'gc_password':gc_password, 'path_map_server':'root@kovidgoyal.net', 'path_map_location':'/var/www/status.calibre-ebook.com/googlepaths', # If you change this remember to change it in the # status.calibre-ebook.com server as well 'project':'calibre-ebook' } def get_sourceforge_data(): return {'username':'kovidgoyal', 'project':'calibre'} def send_data(loc): subprocess.check_call(['rsync', '--inplace', '--delete', '-r', '-z', '-h', '--progress', '-e', 'ssh -x', loc+'/', '%s@%s:%s'%(STAGING_USER, STAGING_HOST, STAGING_DIR)]) def gc_cmdline(ver, gdata): return [__appname__, ver, 'fmap', 'googlecode', gdata['project'], gdata['username'], gdata['password'], gdata['gc_password'], '--path-map-server', gdata['path_map_server'], '--path-map-location', gdata['path_map_location']] def sf_cmdline(ver, sdata): return [__appname__, ver, 'fmap', 'sourceforge', sdata['project'], sdata['username']] def run_remote_upload(args): print 'Running remotely:', ' '.join(args) subprocess.check_call(['ssh', '-x', '%s@%s'%(STAGING_USER, STAGING_HOST), 'cd', STAGING_DIR, '&&', 'python', 'hosting.py']+args) # }}} class UploadInstallers(Command): # {{{ def add_options(self, parser): parser.add_option('--replace', default=False, action='store_true', help= 'Replace existing installers, when uploading to google') def run(self, opts): all_possible = set(installers()) available = set(glob.glob('dist/*')) files = {x:installer_description(x) for x in all_possible.intersection(available)} tdir = mkdtemp() try: self.upload_to_staging(tdir, files) self.upload_to_sourceforge() self.upload_to_google(opts.replace) finally: shutil.rmtree(tdir, ignore_errors=True) def upload_to_staging(self, tdir, files): os.mkdir(tdir+'/dist') hosting = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'hosting.py') shutil.copyfile(hosting, os.path.join(tdir, 'hosting.py')) for f in files: shutil.copyfile(f, os.path.join(tdir, f)) with open(os.path.join(tdir, 'fmap'), 'wb') as fo: for f, desc in files.iteritems(): fo.write('%s: %s\n'%(f, desc)) while True: try: send_data(tdir) except: print('\nUpload to staging failed, retrying in a minute') time.sleep(60) else: break def upload_to_google(self, replace): gdata = get_google_data() args = gc_cmdline(__version__, gdata) if replace: args = ['--replace'] + args run_remote_upload(args) def upload_to_sourceforge(self): sdata = get_sourceforge_data() args = sf_cmdline(__version__, sdata) run_remote_upload(args) # }}} class UploadUserManual(Command): # {{{ description = 'Build and upload the User Manual' sub_commands = ['manual'] def build_plugin_example(self, path): from calibre import CurrentDir with NamedTemporaryFile(suffix='.zip') as f: os.fchmod(f.fileno(), stat.S_IRUSR|stat.S_IRGRP|stat.S_IROTH|stat.S_IWRITE) with CurrentDir(path): with ZipFile(f, 'w') as zf: for x in os.listdir('.'): if x.endswith('.swp'): continue zf.write(x) if os.path.isdir(x): for y in os.listdir(x): zf.write(os.path.join(x, y)) bname = self.b(path) + '_plugin.zip' dest = '%s/%s'%(DOWNLOADS, bname) subprocess.check_call(['scp', f.name, 'divok:'+dest]) def run(self, opts): path = self.j(self.SRC, '..', 'manual', 'plugin_examples') for x in glob.glob(self.j(path, '*')): self.build_plugin_example(x) check_call(' '.join(['rsync', '-z', '-r', '--progress', 'manual/.build/html/', 'bugs:%s'%USER_MANUAL]), shell=True) # }}} class UploadDemo(Command): # {{{ description = 'Rebuild and upload various demos' def run(self, opts): check_call( '''ebook-convert %s/demo.html /tmp/html2lrf.lrf ''' '''--title='Demonstration of html2lrf' --authors='Kovid Goyal' ''' '''--header ''' '''--serif-family "/usr/share/fonts/corefonts, Times New Roman" ''' '''--mono-family "/usr/share/fonts/corefonts, Andale Mono" ''' ''''''%self.j(self.SRC, HTML2LRF), shell=True) check_call( 'cd src/calibre/ebooks/lrf/html/demo/ && ' 'zip -j /tmp/html-demo.zip * /tmp/html2lrf.lrf', shell=True) check_call('scp /tmp/html-demo.zip divok:%s/'%(DOWNLOADS,), shell=True) # }}} class UploadToServer(Command): # {{{ description = 'Upload miscellaneous data to calibre server' def run(self, opts): check_call('ssh divok rm -f %s/calibre-\*.tar.xz'%DOWNLOADS, shell=True) #check_call('scp dist/calibre-*.tar.xz divok:%s/'%DOWNLOADS, shell=True) check_call('gpg --armor --detach-sign dist/calibre-*.tar.xz', shell=True) check_call('scp dist/calibre-*.tar.xz.asc divok:%s/signatures/'%DOWNLOADS, shell=True) check_call('ssh divok bzr update /usr/local/calibre', shell=True) check_call('''ssh divok echo %s \\> %s/latest_version'''\ %(__version__, DOWNLOADS), shell=True) check_call('ssh divok /etc/init.d/apache2 graceful', shell=True) tdir = mkdtemp() for installer in installers(): if not os.path.exists(installer): continue with open(installer, 'rb') as f: raw = f.read() fingerprint = hashlib.sha512(raw).hexdigest() fname = os.path.basename(installer+'.sha512') with open(os.path.join(tdir, fname), 'wb') as f: f.write(fingerprint) check_call('scp %s/*.sha512 divok:%s/signatures/' % (tdir, DOWNLOADS), shell=True) shutil.rmtree(tdir) # }}} # Testing {{{ def write_files(fmap): for f in fmap: with open(f, 'wb') as f: f.write(os.urandom(100)) f.write(b'a'*1000000) with open('fmap', 'wb') as fo: for f, desc in fmap.iteritems(): fo.write('%s: %s\n'%(f, desc)) def setup_installers(): ver = '0.0.1' files = {x.replace(__version__, ver):installer_description(x) for x in installers()} tdir = mkdtemp() os.chdir(tdir) return tdir, files, ver def test_google_uploader(): gdata = get_google_data() gdata['project'] = 'calibre-hosting-uploader' gdata['path_map_location'] += '-test' hosting = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'hosting.py') tdir, files, ver = setup_installers() try: os.mkdir('dist') write_files(files) shutil.copyfile(hosting, 'hosting.py') send_data(tdir) args = gc_cmdline(ver, gdata) print ('Doing initial upload') run_remote_upload(args) raw_input('Press Enter to proceed:') print ('\nDoing re-upload') run_remote_upload(['--replace']+args) raw_input('Press Enter to proceed:') nv = ver + '.1' files = {x.replace(__version__, nv):installer_description(x) for x in installers()} write_files(files) send_data(tdir) args[1] = nv print ('\nDoing update upload') run_remote_upload(args) print ('\nDont forget to delete any remaining files in the %s project'% gdata['project']) finally: shutil.rmtree(tdir) # }}} if __name__ == '__main__': test_google_uploader()
Eksmo/calibre
setup/upload.py
Python
gpl-3.0
10,267
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package development.downright.cucumberbeans.integration.hints; import java.awt.Dimension; import java.awt.Toolkit; import javax.swing.text.Document; import development.downright.cucumberbeans.integration.palette.dialogues.TitleDialog; import org.netbeans.spi.editor.hints.ChangeInfo; import org.netbeans.spi.editor.hints.Fix; /** * * @author sessonad */ public class ExpectingTitleFix implements Fix{ Document document; int offset; public ExpectingTitleFix(Document document, int offset) { this.document=document; this.offset = offset; } @Override public String getText() { return "Add a title ..." ; } @Override public ChangeInfo implement() throws Exception { ChangeInfo changes = new ChangeInfo(); String body = createBody(); if(body!=null){ document.insertString(offset, body, null); } return changes; } public String createBody() { try { TitleDialog dialogue = new TitleDialog(null, true,"Title:"); //center on screen final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); final int x = (screenSize.width - dialogue.getWidth()) / 2; final int y = (screenSize.height - dialogue.getHeight()) / 2; dialogue.setLocation(x, y); dialogue.setVisible(true); String userCommand = dialogue.getDescription(); if(userCommand==null || userCommand.isEmpty()){ return null; }else{ return userCommand ; } } catch (Exception e) { return null; } } }
dzsessona/Cetriolo
src/main/java/development/downright/cucumberbeans/integration/hints/ExpectingTitleFix.java
Java
gpl-3.0
1,875
'use strict'; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); const os = require("os"); const fs = require("fs"); const path = require("path"); const request = require("request"); const sax = require("sax"); function checkExistence(command) { let isWin = process.platform === 'win32'; if (!command) { return true; } for (let dir of process.env.PATH.split(isWin ? ';' : ':')) { for (let extension of [''].concat(isWin ? ['.exe', '.bat', '.cmd'] : [])) { try { fs.accessSync(path.join(dir, command + extension), fs.constants.X_OK); return true; } catch (e) { } } } return false; } exports.checkExistence = checkExistence; function getInfo(packageInfo) { let platformInfo = packageInfo[process.platform]; let info = (typeof platformInfo !== 'string') ? platformInfo || {} : { source: platformInfo }; return Object.assign({}, packageInfo, info); } exports.getInfo = getInfo; function retrieveLatestVersion(version, outputListener) { return __awaiter(this, void 0, void 0, function* () { if (outputListener) { outputListener('Fetching version number...' + os.EOL); } try { const feed = yield new Promise((resolve) => { request.get(version.feed, (err, message, body) => resolve(body.toString())); }); let parser = sax.parser(false, null); return new Promise((resolve) => { let matches = []; parser.ontext = (text) => { let match = text.match(typeof version.regexp !== 'string' ? version.regexp : new RegExp(version.regexp)); if (match) { matches.push(match[1]); } }; parser.onend = () => { resolve(matches.reduce((previous, current) => previous > current ? previous : current)); }; parser.write(feed).end(); }); } catch (err) { return ''; } }); } exports.retrieveLatestVersion = retrieveLatestVersion; //# sourceMappingURL=util.js.map
LaurentTreguier/node-meta-pkg
out/source/util.js
JavaScript
gpl-3.0
2,876
# Use this hook to configure devise mailer, warden hooks and so forth. # Many of these configuration options can be set straight in your model. Devise.setup do |config| # ==> LDAP Configuration config.ldap_logger = Rails.env.downcase == 'development' ? true : false config.ldap_create_user = true config.ldap_update_password = false config.ldap_config = "#{Rails.root}/config/ldap.yml" config.ldap_check_group_membership = true #config.ldap_check_group_membership_without_admin = false config.ldap_check_attributes = true config.ldap_use_admin_to_bind = Rails.env.downcase == 'development' ? true : false config.ldap_ad_group_check = Rails.env.downcase == 'development' ? false : true # ==> Advanced LDAP Configuration # config.ldap_auth_username_builder = Proc.new() {|attribute, login, ldap| "#{attribute}=#{login},#{ldap.base}" } # The secret key used by Devise. Devise uses this key to generate # random tokens. Changing this key will render invalid all existing # confirmation, reset password and unlock tokens in the database. # Devise will use the `secret_key_base` as its `secret_key` # by default. You can change it below and use your own secret key. # config.secret_key = 'accfe34f52963decdcea7e968298a00d288f01603e42fb4cf09bb0b3b9d58b270b4e7938937059960a2ffb938bc9b3c4261d4c40663b78dd6227b1471871a7fd' # ==> Mailer Configuration # Configure the e-mail address which will be shown in Devise::Mailer, # note that it will be overwritten if you use your own mailer class # with default "from" parameter. config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com' # Configure the class responsible to send e-mails. # config.mailer = 'Devise::Mailer' # Configure the parent class responsible to send e-mails. # config.parent_mailer = 'ActionMailer::Base' # ==> ORM configuration # Load and configure the ORM. Supports :active_record (default) and # :mongoid (bson_ext recommended) by default. Other ORMs may be # available as additional gems. require 'devise/orm/active_record' # ==> Configuration for any authentication mechanism # Configure which keys are used when authenticating a user. The default is # just :email. You can configure it to use [:username, :subdomain], so for # authenticating a user, both parameters are required. Remember that those # parameters are used only when authenticating and not when retrieving from # session. If you need permissions, you should implement that in a before filter. # You can also supply a hash where the value is a boolean determining whether # or not authentication should be aborted when the value is not present. config.authentication_keys = [:username] # Configure parameters from the request object used for authentication. Each entry # given should be a request method and it will automatically be passed to the # find_for_authentication method and considered in your model lookup. For instance, # if you set :request_keys to [:subdomain], :subdomain will be used on authentication. # The same considerations mentioned for authentication_keys also apply to request_keys. # config.request_keys = [] # Configure which authentication keys should be case-insensitive. # These keys will be downcased upon creating or modifying a user and when used # to authenticate or find a user. Default is :email. config.case_insensitive_keys = [:email,:username] # Configure which authentication keys should have whitespace stripped. # These keys will have whitespace before and after removed upon creating or # modifying a user and when used to authenticate or find a user. Default is :email. config.strip_whitespace_keys = [:email] # Tell if authentication through request.params is enabled. True by default. # It can be set to an array that will enable params authentication only for the # given strategies, for example, `config.params_authenticatable = [:database]` will # enable it only for database (email + password) authentication. # config.params_authenticatable = true # Tell if authentication through HTTP Auth is enabled. False by default. # It can be set to an array that will enable http authentication only for the # given strategies, for example, `config.http_authenticatable = [:database]` will # enable it only for database authentication. The supported strategies are: # :database = Support basic authentication with authentication key + password # config.http_authenticatable = false # If 401 status code should be returned for AJAX requests. True by default. # config.http_authenticatable_on_xhr = true # The realm used in Http Basic Authentication. 'Application' by default. # config.http_authentication_realm = 'Application' # It will change confirmation, password recovery and other workflows # to behave the same regardless if the e-mail provided was right or wrong. # Does not affect registerable. # config.paranoid = true # By default Devise will store the user in session. You can skip storage for # particular strategies by setting this option. # Notice that if you are skipping storage for all authentication paths, you # may want to disable generating routes to Devise's sessions controller by # passing skip: :sessions to `devise_for` in your config/routes.rb config.skip_session_storage = [:http_auth] # By default, Devise cleans up the CSRF token on authentication to # avoid CSRF token fixation attacks. This means that, when using AJAX # requests for sign in and sign up, you need to get a new CSRF token # from the server. You can disable this option at your own risk. # config.clean_up_csrf_token_on_authentication = true # ==> Configuration for :database_authenticatable # For bcrypt, this is the cost for hashing the password and defaults to 11. If # using other algorithms, it sets how many times you want the password to be hashed. # # Limiting the stretches to just one in testing will increase the performance of # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use # a value less than 10 in other environments. Note that, for bcrypt (the default # algorithm), the cost increases exponentially with the number of stretches (e.g. # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation). config.stretches = Rails.env.test? ? 1 : 11 # Set up a pepper to generate the hashed password. # config.pepper = '62efa159484427e734273f88ad221e53bfea35aa6a110698d9f9b02a5b9e13a26f7eaa6e3206abfd8eb8701d32b7b1fd38fd6a797e95e0bf118c5a5c1486dfa0' # Send a notification email when the user's password is changed # config.send_password_change_notification = false # ==> Configuration for :confirmable # A period that the user is allowed to access the website even without # confirming their account. For instance, if set to 2.days, the user will be # able to access the website for two days without confirming their account, # access will be blocked just in the third day. Default is 0.days, meaning # the user cannot access the website without confirming their account. # config.allow_unconfirmed_access_for = 2.days # A period that the user is allowed to confirm their account before their # token becomes invalid. For example, if set to 3.days, the user can confirm # their account within 3 days after the mail was sent, but on the fourth day # their account can't be confirmed with the token any more. # Default is nil, meaning there is no restriction on how long a user can take # before confirming their account. # config.confirm_within = 3.days # If true, requires any email changes to be confirmed (exactly the same way as # initial account confirmation) to be applied. Requires additional unconfirmed_email # db field (see migrations). Until confirmed, new email is stored in # unconfirmed_email column, and copied to email column on successful confirmation. config.reconfirmable = false # Defines which key will be used when confirming an account # config.confirmation_keys = [:email] # ==> Configuration for :rememberable # The time the user will be remembered without asking for credentials again. # config.remember_for = 2.weeks # Invalidates all the remember me tokens when the user signs out. config.expire_all_remember_me_on_sign_out = true # If true, extends the user's remember period when remembered via cookie. # config.extend_remember_period = false # Options to be passed to the created cookie. For instance, you can set # secure: true in order to force SSL only cookies. # config.rememberable_options = {} # ==> Configuration for :validatable # Range for password length. config.password_length = 8..128 # Email regex used to validate email formats. It simply asserts that # one (and only one) @ exists in the given string. This is mainly # to give user feedback and not to assert the e-mail validity. config.email_regexp = /\A[^@\s]+@[^@\s]+\z/ # ==> Configuration for :timeoutable # The time you want to timeout the user session without activity. After this # time the user will be asked for credentials again. Default is 30 minutes. # config.timeout_in = 30.minutes # ==> Configuration for :lockable # Defines which strategy will be used to lock an account. # :failed_attempts = Locks an account after a number of failed attempts to sign in. # :none = No lock strategy. You should handle locking by yourself. # config.lock_strategy = :failed_attempts # Defines which key will be used when locking and unlocking an account # config.unlock_keys = [:email] # Defines which strategy will be used to unlock an account. # :email = Sends an unlock link to the user email # :time = Re-enables login after a certain amount of time (see :unlock_in below) # :both = Enables both strategies # :none = No unlock strategy. You should handle unlocking by yourself. # config.unlock_strategy = :both # Number of authentication tries before locking an account if lock_strategy # is failed attempts. # config.maximum_attempts = 20 # Time interval to unlock the account if :time is enabled as unlock_strategy. # config.unlock_in = 1.hour # Warn on the last attempt before the account is locked. # config.last_attempt_warning = true # ==> Configuration for :recoverable # # Defines which key will be used when recovering the password for an account # config.reset_password_keys = [:email] # Time interval you can reset your password with a reset password key. # Don't put a too small interval or your users won't have the time to # change their passwords. config.reset_password_within = 6.hours # When set to false, does not sign a user in automatically after their password is # reset. Defaults to true, so a user is signed in automatically after a reset. # config.sign_in_after_reset_password = true # ==> Configuration for :encryptable # Allow you to use another hashing or encryption algorithm besides bcrypt (default). # You can use :sha1, :sha512 or algorithms from others authentication tools as # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20 # for default behavior) and :restful_authentication_sha1 (then you should set # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper). # # Require the `devise-encryptable` gem when using anything other than bcrypt # config.encryptor = :sha512 # ==> Scopes configuration # Turn scoped views on. Before rendering "sessions/new", it will first check for # "users/sessions/new". It's turned off by default because it's slower if you # are using only default views. # config.scoped_views = false # Configure the default scope given to Warden. By default it's the first # devise role declared in your routes (usually :user). # config.default_scope = :user # Set this configuration to false if you want /users/sign_out to sign out # only the current scope. By default, Devise signs out all scopes. # config.sign_out_all_scopes = true # ==> Navigation configuration # Lists the formats that should be treated as navigational. Formats like # :html, should redirect to the sign in page when the user does not have # access, but formats like :xml or :json, should return 401. # # If you have any extra navigational formats, like :iphone or :mobile, you # should add them to the navigational formats lists. # # The "*/*" below is required to match Internet Explorer requests. # config.navigational_formats = ['*/*', :html] # The default HTTP method used to sign out a resource. Default is :delete. config.sign_out_via = :delete # ==> OmniAuth # Add a new OmniAuth provider. Check the wiki for more information on setting # up on your models and hooks. # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo' # ==> Warden configuration # If you want to use other strategies, that are not supported by Devise, or # change the failure app, you can configure them inside the config.warden block. # # config.warden do |manager| # manager.intercept_401 = false # manager.default_strategies(scope: :user).unshift :some_external_strategy # end # ==> Mountable engine configurations # When using Devise inside an engine, let's call it `MyEngine`, and this engine # is mountable, there are some extra configurations to be taken into account. # The following options are available, assuming the engine is mounted as: # # mount MyEngine, at: '/my_engine' # # The router that invoked `devise_for`, in the example above, would be: # config.router_name = :my_engine # # When using OmniAuth, Devise cannot automatically set OmniAuth path, # so you need to do it manually. For the users scope, it would be: # config.omniauth_path_prefix = '/my_engine/users/auth' end
bananabr/RSRS
app/config/initializers/devise.rb
Ruby
gpl-3.0
13,928
<?php /* * This file is part of the Level 7 Systems Ltd. platform. * * (c) Kamil Adryjanek <kamil@level7systems.co.uk> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ class L7P_Install { public function __construct() { add_filter( 'plugin_action_links_' . L7P_PLUGIN_BASENAME, array( $this, 'add_action_links' ) ); register_activation_hook(L7P_PLUGIN_FILE, array($this, 'install')); register_deactivation_hook(L7P_PLUGIN_FILE, array($this, 'uninstall')); } // action links public function add_action_links($links) { $action_links = array( 'settings' => sprintf('<a href="%s" title="%s">%s</a>', admin_url('admin.php?page=l7-settings'), esc_attr(__( 'View Level7 platform settings', 'level7platform')), __('Settings', 'level7platform') ) ); return array_merge($action_links, $links); } public function install() { // enable XmlRpc update_option('enable_xmlrpc', '1'); // create roles and capabilities $this->create_roles(); // create pages $this->create_pages(); // rewrite rules L7P()->query->add_rewrite_rules(); // flush rules after install flush_rewrite_rules(); } public function uninstall() { global $wpdb; // delete created pages or wp_trash_post wp_delete_post(l7p_get_option('pricing_page_id')); wp_delete_post(l7p_get_option('rates_page_id')); wp_delete_post(l7p_get_option('telephone_numbers_page_id')); wp_delete_post(l7p_get_option('hardware_page_id')); wp_delete_post(l7p_get_option('support_page_id')); wp_delete_post(l7p_get_option('login_page_id')); wp_delete_post(l7p_get_option('one_time_login_page_id')); wp_delete_post(l7p_get_option('recover_page_id')); wp_delete_post(l7p_get_option('subscription_page_id')); wp_delete_post(l7p_get_option('register_page_id')); wp_delete_post(l7p_get_option('affiliate_page_id')); wp_delete_post(l7p_get_option('manual_search_page_id')); // delete options $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE 'l7p_%';"); // delete posts + data $wpdb->query( "DELETE FROM {$wpdb->posts} WHERE post_type IN ('level7_page', 'l7p_page');" ); $wpdb->query( "DELETE FROM {$wpdb->postmeta} meta LEFT JOIN {$wpdb->posts} posts ON posts.ID = meta.post_id WHERE wp.ID IS NULL;" ); } // add roles and capabilities private function create_roles() { global $wp_roles; // TODO: add capabilities: } private function create_pages() { global $wpdb; $pages_contents = $this->get_pages_contents(); // 5 standard pages $pages = array( 'pricing' => array( 'slug' => 'pricing', 'title' => 'Plans', 'content' => $pages_contents['pricing'], 'post_type' => 'page', ), 'rates' => array( 'slug' => 'rates', 'title' => 'Call Rates', 'content' => $pages_contents['rates'], 'post_type' => 'page', ), 'telephone_numbers' => array( 'slug' => 'telephone-numbers', 'title' => 'Telephone Numbers', 'content' => $pages_contents['telephone_numbers'], 'post_type' => 'page', ), 'hardware' => array( 'slug' => 'hardware', 'title' => 'Hardware', 'content' => $pages_contents['hardware'], 'post_type' => 'page', ), 'support' => array( 'slug' => 'support', 'title' => 'Support', 'content' => $pages_contents['support'], 'post_type' => 'page', ), 'login' => array( 'slug' => 'login', 'title' => 'Login', 'content' => $pages_contents['login'], 'post_type' => 'page', ), 'one_time_login' => array( 'slug' => 'one-time-login', 'title' => 'One time login', 'content' => $pages_contents['one_time_login'], 'post_type' => 'page', ), 'recover' => array( 'slug' => 'recover-password', 'title' => 'Recover password', 'content' => $pages_contents['recover'], 'post_type' => 'page', ), 'subscription' => array( 'slug' => 'subscription', 'title' => 'Email subscription', 'content' => $pages_contents['subscription'], 'post_type' => 'page', ), 'register' => array( 'slug' => 'register', 'title' => 'Registration', 'content' => $pages_contents['register'], 'post_type' => 'page', ), 'affiliate' => array( 'slug' => 'affiliate', 'title' => 'Become Our Agent', 'content' => $pages_contents['affiliate'], 'post_type' => 'page', ), // templates for dynamic pages 'rates_country' => array( 'slug' => 'country-rates', 'title' => 'Country call rates', 'content' => $pages_contents['rates_country'], 'post_type' => 'l7p_page', ), 'telephone_numbers_country' => array( 'slug' => 'country-telephone-numbers', 'title' => 'Country telephone numbers', 'content' => $pages_contents['telephone_numbers_country'], 'post_type' => 'l7p_page', ), 'telephone_numbers_state' => array( 'slug' => 'state-telephone-numbers', 'title' => 'State telephone numbers', 'content' => $pages_contents['telephone_numbers_state'], 'post_type' => 'l7p_page', ), 'hardware_group' => array( 'slug' => 'hardware-group', 'title' => 'Hardware group', 'content' => $pages_contents['hardware_group'], 'post_type' => 'l7p_page', ), 'hardware_model' => array( 'slug' => 'hardware-model', 'title' => 'Hardware phone details', 'content' => $pages_contents['hardware_model'], 'post_type' => 'l7p_page', ), 'manual_chapter' => array( 'slug' => 'manual-chapter', 'title' => 'Manual chapter', 'content' => $pages_contents['manual_chapter'], 'post_type' => 'l7p_page', ), 'manual_search' => array( 'slug' => 'manual-search', 'title' => 'Manual search', 'content' => $pages_contents['manual_search'], 'post_type' => 'l7p_page', ), ); // pages that support currency redirects $pages_with_currency_redirect_ids = array(); foreach ($pages as $key => $page_data) { $page_id = $this->create_page( $key, $page_data['slug'], $page_data['title'], $page_data['content'], $page_data['post_type'] ); if (in_array($key, ['pricing', 'rates', 'telephone_numbers', 'hardware'])) { $pages_with_currency_redirect_ids[] = $page_id; } } l7p_update_option('currency_redirect_ids', $pages_with_currency_redirect_ids); } private function create_page($page_name, $page_slug, $page_title, $page_content, $post_type = 'page') { global $wpdb; $page_data = array( 'post_status' => 'publish', 'post_type' => $post_type, 'post_author' => 1, // slug 'post_name' => sanitize_title($page_slug), 'post_title' => $page_title, 'post_content' => $page_content, 'post_parent' => 0, 'comment_status' => 'closed' ); $page_id = null; if (strlen( $page_content ) > 0) { // search for an existing page with the specified page content (typically a shortcode) $page_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " . $wpdb->posts . " WHERE post_type='page' AND post_content LIKE %s LIMIT 1;", "%{$page_content}%")); } else { // search for an existing page with the specified page name $page_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM " . $wpdb->posts . " WHERE post_type='page' AND post_name = %s LIMIT 1;", sanitize_title($page_name))); } if (!$page_id) { $page_id = wp_insert_post($page_data); } l7p_update_option(sprintf("%s_page_id", $page_name), $page_id); return $page_id; } private function get_pages_contents() { return array( 'pricing' => <<<CONTENT <div> <h1>Choose a plan that fits you the most</h1> [block currency_form] </div> <div> <div> <h2>Pay As You Go</h2> <div> <ul> <li><span>[USER_CHARGE]</span><br>per user monthly</li> <li>Free setup</li> <li>24/7 Technical Support</li> <li>All <a href="/features">features</a> included</li> <li>Free inbound calls</li> <li>Free inbound numbers: 0845/0560 and <a href="http://www.inum.net">iNum</a></li> </ul> <a href="/en/register#P">Free Trial</a> </div> </div> <div> <h2>Unlimited Domestic</h2> <div> <ul> <li><span>[USER_UNLIMITED]</span><br>per user monthly</li> <li>Free setup</li> <li>24/7 Technical Support</li> <li>All <a href="/features">features</a> included</li> <li>Free inbound calls</li> <li>Free inbound numbers: 0845/0560 and <a href="http://www.inum.net">iNum</a></li> <li>Inclusive <a href="/telephone-numbers">geographical number</a> for each user</li> <li>Free outbound calls to fixed lines in one <a title="Argentina, Australia, Austria, Belgium, Brazil São Paulo, Canada, Chile, China, Croatia, Czech Republic, Denmark, FranceGermany, Greece, Guam, Hong Kong S.A.R., China, Hungary, Ireland, Israel, Italy, Luxembourg, Malaysia, Netherlands, New Zealand, Norway, Peru, Poland, Portugal, Puerto Rico, Russia, Singapore, South Korea, Spain, Sweden, Switzerland, Taiwan, Turkey, U.S. Virgin Islands, United Kingdom, United States, Vatican, Venezuela">chosen country</a></li> </ul> <a href="/en/register#S" >Free Trial</a> </div> </div> <div> <h2>Unlimited International</h2> <div> <ul> <li><span>[USER_UNLIMITED_INT]</span><br>per user monthly</li> <li>Free setup</li> <li>24/7 Technical Support</li> <li>All <a href="/features">features</a> included</li> <li>Free inbound calls</li> <li>Free inbound numbers: 0845/0560 and <a href="http://www.inum.net">iNum</a></li> <li>Inclusive <a href="/telephone-numbers">geographical number</a> for each user</li> <li>Free outbound calls to fixed lines in all <a title="Argentina, Australia, Austria, Belgium, Brazil São Paulo, Canada, Chile, China, Croatia, Czech Republic, Denmark, FranceGermany, Greece, Guam, Hong Kong S.A.R., China, Hungary, Ireland, Israel, Italy, Luxembourg, Malaysia, Netherlands, New Zealand, Norway, Peru, Poland, Portugal, Puerto Rico, Russia, Singapore, South Korea, Spain, Sweden, Switzerland, Taiwan, Turkey, U.S. Virgin Islands, United Kingdom, United States, Vatican, Venezuela">listed countries </a> and to mobile phones in <a title="Canada, China, Hong Kong S.A.R., China, Puerto Rico, United States">these countries</a></li> </ul> <a href="/register#A">Free Trial</a> </div> </div> </div> <div> <h3>Start 30 days free trial</h3> <div> <div> <div><span>How does the 30-days free trial work?</span></div> <p>Sign up for a trial account and enjoy 30 days of full access to all of our virtual PBX options and features without any obligations. If you decide that you don't want to continue using our virtual PBX service after the trial period you don't have to do anything. Your trial will end automatically and no monthly fees will be applied.</p> </div> <div> <div><span>Do I need a credit card?</span></div> <p>A credit card is not required, you can start using your VoIPstudio IP phone System right away. Sign up now and we will top up your account with 100 free minutes or call credits* which you can use to make calls to any landline or mobile number.* If you need more minutes simply charge your account using a credit card.<br> <span>* - Not available in all countries. You may have to provide a valid telephone number to activate your trial</span></p> </div> <div> <div><span>Can i cancel trial at any time?</span></div> <p>If for whatever reason you are not completely satisfied with your VoIPstudio hosted phone system you can cancel your subscription at any time. There is no contract or minimum notice period.</p> </div> </div> <a href="/register">Take a Free Trial</a> </div> CONTENT ,'rates' => <<<CONTENT <div> <h1>Business VoIP - Call Rates</h1> <p><span>Check</span><span>the costs of calls</span> to landlines and mobiles</p> [block currency_form] </div> <div> <div> <table> <thead> <tr> <td colspan="2"><h2>VoIP Calls</h2></td> </tr> <tr> <td><strong>Destination</strong></td> <td><strong>Per minute rate</strong></td> </tr> </thead> <tbody> <tr> <td>VoIPstudio network</td> <td>Free</td> </tr> </tbody> <tbody> <tr> <td>Other VoIP networks: <a href="http://www.sipbroker.com/sipbroker/action/providerWhitePages" target="_blank">list</a></td> <td>Free</td> </tr> </tbody> </table> </div> <div> [if term_has_local] <table> <thead> <tr> <td colspan="3"><h2>Domestic calls ([COUNTRY_NAME])</h2></td> </tr> <tr> <td><strong>Destination</strong></td> [if term_unlimited_local] <td><strong>Unlimited Plan</strong><br>(Per minute rate)</td> <td><strong>Pay As You Go</strong><br>(Per minute rate)</td> [else] <td><strong>Per minute rate</strong></td> [/if] </tr> </thead> <tbody> <tr> <td>Calls to Landlines</td> [if term_unlimited_local] <td>[if term_local_fixed_free]Free[else][TERM_LOCAL_FIXED][/if]</td> <td>[TERM_LOCAL_FIXED]</td> [else] <td>[TERM_LOCAL_FIXED]</td> [/if] </tr> </tbody> <tbody> <tr> <td>Calls to Mobiles</td> [if term_unlimited_local] <td>[if term_local_mobile_free]Free[else][TERM_LOCAL_MOBILE][/if]</td> <td>[TERM_LOCAL_MOBILE]</td> [else] <td>[TERM_LOCAL_MOBILE]</td> [/if] </tr> </tbody> </table> [/if] </div> </div> <table> <thead> <tr> <td colspan="4"><h2>International calls</h2> <ul> <li><a href="#A">A</a></li><li><a href="#B">B</a></li><li><a href="#C">C</a></li><li><a href="#D">D</a></li><li><a href="#E">E</a></li><li><a href="#F">F</a></li><li><a href="#G">G</a></li><li><a href="#H">H</a></li><li><a href="#I">I</a></li><li><a href="#J">J</a></li><li><a href="#K">K</a></li><li><a href="#L">L</a></li><li><a href="#M">M</a></li><li><a href="#N">N</a></li><li><a href="#O">O</a></li><li><a href="#P">P</a></li><li><a href="#Q">Q</a></li><li><a href="#R">R</a></li><li><a href="#S">S</a></li><li><a href="#T">T</a></li><li><a href="#U">U</a></li><li><a href="#V">V</a></li><li><a href="#W">W</a></li><li><a href="#Y">Y</a></li><li><a href="#Z">Z</a></li> </ul> </td> </tr> <tr> <td><strong>Destination</strong><br>(Click for details)</td> <td><strong>Unlimited Plan</strong></td> <td><strong>Landline</strong><br>(Per minute rate)</td> <td><strong>Mobile</strong><br>(Per minute rate)</td> </tr> </thead> [foreach term_letters] <tbody> <tr id="[TERM_LETTER]"><td colspan="4">[TERM_LETTER]</td></tr> [foreach term_countries] <tr> <td><a href="[TERM_ROUTE_URL]">[TERM_ROUTE_COUNTRY]</a></td> <td>[if term_is_unlimited]Free[/if]</td> <td>[TERM_FIXED]</td> <td>[TERM_MOBILE]</td> </tr> [/foreach] </tbody> [/foreach] </table> <div> <h3>Extra features <span>never end</span></h3> <div> <div> <div><span>Free Internet Call</span></div> <p>We will always try to route your call to any telephone number free of charge over the Internet. We use ENUM external link technology to find alternative connection to dialled number. However if we need to deliver your call over traditional telephone network following principles apply:<br> Calls are billed per second<br> Minimum call charge is [TERM_MIN_CHARGE]<br> Prices exclude VAT<br> <span>20% VAT applies to Customers based in United Kingdom and EU customers without a VAT number.</span></p> </div> <div> <div><span>SMS - Text Messages</span></div> <p>You can send text messages from our website after creating account with us. It cost only [SMS_CHARGE] per message.</p> </div> <div> <div><span>Web Calls</span></div> <p>If you have access to the internet, you can use any telephone anywhere to make a call and have the call charged at very low internet rate. VoIPstudio calls the phone you’re making the call from, then makes another call to the person you want to call; then connects both together. So you will be charged for two calls. But because our prices are so low, even with two calls, this is still a more economical way of making a call than, say, from your mobile. If you are travelling abroad you can avoid roaming charges by using web calls.</p> </div> </div> </div> CONTENT ,'rates_country' => <<<CONTENT <div> <h1>[TERM_ROUTE_COUNTRY] - Call Rates</h1> <p><span>Check</span> <span>the costs of calls</span> to landlines and mobiles</p> [block currency_form] </div> <table> <thead> <tr> <td colspan="3"> <a href="/rates">Go back to full list</a> </td> </tr> <tr> <td><strong>Type of band</strong><br></td> <td><strong>Dialing codes</strong></td> <td><strong>Per minute rate</strong></td> </tr> </thead> [foreach term_routes] <tbody> <tr> <td>[TERM_ROUTE_NAME]</td> <td>[TERM_ROUTE_PREFIXES]</td> <td>[TERM_ROUTE_RATE] [if term_route_unlimited] (Free*)</td> [/if] [if term_route_conn_fee] Connection fee: [TERM_ROUTE_CONN_FEE] [/if] </tr> </tbody> [/foreach] <tfoot> <tr> <td colspan="3">*-Free with Unlimited Plan</td> </tr> </tfoot> </table> <div> <h3>Extra features <span>never end</span></h3> <div> <div> <div><span>Free Internet Call</span></div> <p>We will always try to route your call to any telephone number free of charge over the Internet. We use ENUM external link technology to find alternative connection to dialled number. However if we need to deliver your call over traditional telephone network following principles apply:<br> Calls are billed per second<br> Minimum call charge is [TERM_MIN_CHARGE]<br> Prices exclude VAT<br> <span>20% VAT applies to Customers based in United Kingdom and EU customers without a VAT number.</span></p> </div> <div> <div><span>SMS - Text Messages</span></div> <p>You can send text messages from our website after creating account with us. It cost only [SMS_CHARGE] per message.</p> </div> <div> <div><span>Web Calls</span></div> <p>If you have access to the internet, you can use any telephone anywhere to make a call and have the call charged at very low internet rate. VoIPstudio calls the phone you’re making the call from, then makes another call to the person you want to call; then connects both together. So you will be charged for two calls. But because our prices are so low, even with two calls, this is still a more economical way of making a call than, say, from your mobile. If you are travelling abroad you can avoid roaming charges by using web calls.</p> </div> </div> </div> CONTENT ,'telephone_numbers' => <<<CONTENT <div> <h1>Virtual Telephone Numbers</h1> <p><span>Check</span> <span>prices for</span> setup and monthly rental</p> [block currency_form] </div> <div> <p style="margin-bottom: 60px;"><span>VoIPstudio <span>provides</span> a phone line</span><br> to each of listed countries in <span>a few seconds!</span></p> </div> <table> <thead> <tr> <td colspan="4"> <h2>Virtual Phone Numbers for VoIP PBX</h2> <p>Signup with VoIPstudio and get a real telephone number for free.</p><p></p> </td> </tr> <tr> <td><strong>Destination</strong></td> <td><strong>Number</strong></td> <td><strong>Setup Fee</strong></td> <td><strong>Monthly Rental</strong></td> </tr> </thead> <tbody> <tr> <td>United Kingdom</td> <td>+44 845 National</td> <td>Free</td> <td>Free</td> </tr> </tbody> <tbody> <tr> <td>United Kingdom</td> <td>+44 560 National</td> <td>Free</td> <td>Free</td> </tr> </tbody> <tbody> <tr> <td><a href="http://www.inum.net/" target="_blank">iNum</a></td> <td>+883 5100 iNum</td> <td>Free</td> <td>Free</td> </tr> </tbody> <tfoot> <tr> <td colspan="4"></td> </tr> </tfoot> </table> <table> <thead> <tr> <td colspan="4"> <p>You can subscribe to incoming VoIP numbers in more than 4000 cities around the World. <br>Check your coutry of choice below.</p><p></p> </td> </tr> <tr> <td><strong>Destination</strong><br>(Click for details)</td> <td><strong>Unlimited Plan</strong></td> <td><strong>Setup Fee</strong></td> <td><strong>Monthly Rental</strong></td> </tr> </thead> [foreach ddi_paid] <tbody> <tr> <td><a href="[DDI_COUNTRY_URL]">[DDI_COUNTRY_NAME]</a></td> <td>[if ddi_is_unlimited]Free[/if]</td> <td>[DDI_SETUP_FEE]</td> <td>[DDI_MONTHLY_FEE]</td> </tr> </tbody> [/foreach] <tfoot> <tr> <td colspan="4"></td> </tr> </tfoot> </table> <div> <h2>Truly <span>Dependable</span></h2> <p>VoIPstudio provides a comprehensive range of virtual numbers for businesses looking to expand their reach. We are a widely trusted call forwarding service provider, enabling our subscribers to forward their calls to any carrier in the world.</p> <a href="/features">Read more</a> </div> <div> <h3>Buy a <span>Virtual</span> number</h3> <p>and start<span> taking calls!</span></p> <p>You can also start our <a href="/register">30-day free trial</a>.<br>In case you need any further information, please feel free to call<br> +1 310 870 9750 (US), +44 203 432 9230 (UK).</p> </div> CONTENT ,'telephone_numbers_country' => <<<CONTENT <div> <h1>Business Telephone Numbers<br><span><span>in</span> <span>[DDI_COUNTRY_NAME]</span></span> </h1> [block currency_form] </div> <div> <a href="/telephone-numbers">Go back to full list</a> <p>Country phone code: <strong>+[DDI_COUNTRY_TEL_CODE]</strong></p><br><br> </div> [if ddi_national] <table> <thead> <tr> <td><strong>Available National Numbers</strong></td> <td><strong>Area Code</strong></td> <td><strong>Setup Fee</strong></td> <td><strong>Monthly Rental</strong></td> <td></td> </tr> </thead> <tbody> [foreach ddi_national] <tr> <td>National</td> <td>([DDI_AREA_CODE])</td> <td>[DDI_SETUP_FEE]</td> <td>[DDI_MONTHLY_FEE]</td> <td><a href="[DDI_BUY_URL]" title="">Buy</a></td> </tr> [/foreach] </tbody> </table> [/if] [if ddi_ddi_city] <table> <thead> <tr> <td colspan="5"></td> </tr> <tr> <td><strong>Available City</strong></td> <td><strong>Area Code</strong></td> <td><strong>Setup Fee</strong></td> <td><strong>Monthly Rental</strong></td> <td></td> </tr> </thead> [foreach ddi_city] <tbody> <tr> <td>[DDI_CITY_NAME]</td> <td> [if ddi_has_area_code] [DDI_AREA_CODE] [/if] </td> <td>[DDI_SETUP_FEE]</td> <td>[DDI_MONTHLY_FEE]</td> <td><a href="[DDI_BUY_URL]" title="">Buy</a></td> </tr> </tbody> [/foreach] <tfoot> <tr> <td colspan="5"></td> </tr> </tfoot> </table> [/if] [if ddi_ddi_toll_free] <table> <thead> <tr> <td colspan="6"></td> </tr> <tr> <td><strong>Toll Free</strong></td> <td><strong>Area Code</strong></td> <td><strong>Setup Fee</strong></td> <td><strong>Monthly Rental</strong></td> <td><strong>Usage Fee</strong></td> <td></td> </tr> </thead> [foreach ddi_toll_free] <tbody> <tr> <td>Toll Free</td> <td> [if ddi_has_area_code] [DDI_AREA_CODE] [/if] </td> <td>[DDI_SETUP_FEE]</td> <td>[DDI_MONTHLY_FEE]</td> <td>[DDI_MIN_RATE]</td> <td><a href="[DDI_TOLL_FREE_BUY_URL]" title="">Buy</a></td> </tr> </tbody> [/foreach] </table> [/if] <div> <h3>Buy a <span>Virtual</span> number</h3> <p>and connect with our <span> telephone system </span> instantly!</p> <p>You can also start our <a href="/register">30-day free trial</a>.<br>In case you need any further information, please feel free to call<br> +1 310 870 9750 (US), +44 203 432 9230 (UK).</p> </div> CONTENT ,'telephone_numbers_state' => <<<CONTENT <div> <h1>Virtual Telephone Numbers<br><span><span>in</span> <span>United States</span></span> </h1> [block currency_form] </div> <div> <a href="/telephone-numbers">Go back to full list</a> <p>Select a State</p> <ul> [if ddi_states] [foreach ddi_states] <li><a href="[DDI_STATE_URL]">[DDI_STATE_NAME]</a></li> [/foreach] [/if] </ul> </div> [if ddi_ddi_toll_free] <table> <thead> <tr> </tr> <tr> <td><strong>Toll Free</strong></td> <td><strong>Area Code</strong></td> <td><strong>Setup Fee</strong></td> <td><strong>Monthly Rental</strong></td> <td><strong>Usage Fee</strong></td> <td></td> </tr> </thead> <tbody> [foreach ddi_toll_free] <tr> <td>Toll Free</td> <td>([DDI_AREA_CODE])</td> <td>[DDI_SETUP_FEE]</td> <td>[DDI_MONTHLY_FEE]</td> <td>[DDI_MIN_RATE]</td> <td><a href="[DDI_TOLL_FREE_BUY_URL]">Buy</a></td> </tr> [/foreach] </tbody> </table> [/if] <div> <h3>Buy a <span>Virtual</span> number</h3> <p>and start<span> taking calls!</span></p> <p>You can also start our <a href="/register">30-day free trial</a>.<br>In case you need any further information, please feel free to call<br> +1 310 870 9750 (US), +44 203 432 9230 (UK).</p> </div> CONTENT ,'hardware' => <<<CONTENT <div> <h1>The range of available hardware</h1> <p><span>that will </span> <span>improve the functionality</span> of VoIP Calls</p> </div> <div> <div> <figure><img class src="https://static.ssl7.net/images/1/vs/desk-phones.jpg" alt="Desk Phones"></figure> </div> <div> <h2>Desk Phones</h2> <a href="[PHONE_DESK_URL]">Browse All</a> <p>A range of specialist, multi-featured Business VoIP desk phones that connect to your LAN or Broadband (ADSL) router. Each phone offers a range of innovative options, with prices starting from just [PHONE_DESK_MIN_PRICE].</p> </div> </div> <div> <div> <figure><img class src="https://static.ssl7.net/images/1/vs/dect-phones.jpg" alt="DECT Phones"></figure> </div> <div> <h2>DECT Phones</h2> <a href="[PHONE_DECT_URL]">Browse All</a> <p>A selection of high quality, cordless VoIP phones designed to give you complete freedom of movement, by enabling multiple VoIP phones to operate from just one base. Prices starting from just [PHONE_DECT_MIN_PRICE].</p> </div> </div> <div> <div> <figure><img class src="https://static.ssl7.net/images/1/vs/conf-phones.jpg" alt="Conference Phones"></figure> </div> <div> <h2>Conference Phones</h2> <a href="[PHONE_CONF_URL]">Browse All</a> <p>Highly advanced conference phones, offering crystal clear hosted PBX conversations between groups of all sizes, from 4 to 40 people, across all distances.</p> </div> </div> <div> <div> <figure> <img class src="https://static.ssl7.net/images/1/vs/adaptors.jpg" alt="VoIP Adapters"> </figure> </div> <div> <h2>VoIP Adapters</h2> <a href="[PHONE_ADAPTOR_URL]">Browse All</a> <p>VoIP adapters allow you to easily connect an ordinary analogue telephone to a VoIP Phone Adapter. This enables anyone to benefit from a VoIP telephone system without the need for a specialist VoIP phone or PC.</p> </div> </div> <div> <div> <figure> <img class src="https://static.ssl7.net/images/1/vs/accesories.jpg" alt="Accessories"> </figure> </div> <div> <h2>Accesories</h2> <a href="[PHONE_ACCESSORY_URL]">Browse All</a> <p>A range of accessories designed to improve you VoIP business phone system experience. From hands free microphone ear piece sets to expansion modules to specialist Klarvoice handsets.</p> </div> </div> <div> <h3>Not sure which VoIPstudio Plan</h3> <p><span>is most suitable</span> for your Company?</p> <a href="/pricing">Check Our Pricing</a> </div> CONTENT ,'hardware_group' => <<<CONTENT <div> <h1>The range of available Desk Phones</h1> <p><span>that will </span> <span>improve the functionality</span> of VoIP Calls</p> [block currency_form] </div> <div> <ul> <li><a href="[PHONE_DESK_URL]">Desk Phones</a></li> <li><a href="[PHONE_DECT_URL]">DECT Phones</a></li> <li><a href="[PHONE_CONF_URL]">Conference Phones</a></li> <li><a href="[PHONE_ADAPTOR_URL]">VoIP Adapters</a></li> <li><a href="[PHONE_ACCESSORY_URL]">Accesories</a></li> </ul> <ul> [if phones] [foreach phones] <li> <div> <h2><a href="[PHONE_URL]">[PHONE_MANUFACTURER] [PHONE_MODEL]</a></h2> <span>[PHONE_PRICE]</span> <a href="[PHONE_URL]"> <figure> <img src="[PHONE_THUMB_IMG]"> </figure> </a> </div> <div> <p>[PHONE_SHORT_DESCRIPTION]... <a href="[PHONE_URL]">Read more.</a></p> <p> [if phone_in_stock] <span>[PHONE_STOCK] in stock</span> <a href="[PHONE_BUY_URL]" title="">Buy</a> [else] <span>Out of stock</span> [/if] </div> </li> [/foreach] [else] <li>No phones are available at the moment.</li> [/if] </ul> </div> <div> <h3>Not sure which VoIPstudio Plan</h3> <p><span>is most suitable</span> for your Company?</p> <a href="/pricing">Check Our Pricing</a> </div> CONTENT ,'hardware_model' => <<<CONTENT <div> <h1>[PHONE_GROUP_NAME] - [PHONE_MANUFACTURER] [PHONE_MODEL]</h1> <p><span>see </span> <span>the detailed specification</span> of this hardware</p> [block currency_form] </div> <div> <ul> <li><a href="[PHONE_DESK_URL]">Desk Phones</a></li> <li><a href="[PHONE_DECT_URL]">DECT Phones</a></li> <li><a href="[PHONE_CONF_URL]">Conference Phones</a></li> <li><a href="[PHONE_ADAPTOR_URL]">VoIP Adapters</a></li> <li><a href="[PHONE_ACCESSORY_URL]">Accesories</a></li> </ul> <div> <div> <h2>[PHONE_MANUFACTURER] [PHONE_MODEL]</h2> <span>[PHONE_PRICE]</span> <figure> <img src="[PHONE_IMG]"> </figure> [if phone_in_stock] <a href="[PHONE_BUY_URL]" title="">Buy This</a> <p>[PHONE_STOCK] in stock</p> [else] <p>Out of stock</p> [/if] </div> <div> [PHONE_SHORT_DESCRIPTION] </div> </div> </div> <div> <h3>Not sure which VoIPstudio Plan</h3> <p><span>is most suitable</span> for your Company?</p> <a href="/pricing">Check Our Pricing</a> </div> CONTENT ,'support' => <<<CONTENT <div> <h1>`VoIPstudio <span>Support</span></h1> <p>`All <span>information </span> can be found in our user <span>manuals</span></p> </div> <div> <div> <div> <h3>`User Manual`</h3> <a href="{MANUAL}?chapter=User_Introduction">`Read online`</a> <a title="Download PDF" href="http://repo.ssl7.net/downloads/manuals/VoIPStudio-User.pdf"></a> </div> <div> <h3>`Receptionist Manual`</h3> <a href="{MANUAL}?chapter=Reception_Introduction">`Read online`</a> <a title="Download PDF" href="http://repo.ssl7.net/downloads/manuals/VoIPStudio-Reception.pdf"></a> </div> <div> <h3>`Administrator Manual`</h3> <a href="{MANUAL}?chapter=Admin_Introduction">`Read online`</a> <a title="Download PDF" href="http://repo.ssl7.net/downloads/manuals/VoIPStudio-Admin.pdf"></a> </div> </div> </div> <div> <h3><span>`Support</span> Centre`</h3> <p>`Access to the VoIPstudio Support Center is only granted to our customers.<br> Please login to Customer Portal to open a new support ticket.`</p> <a>`Login`</a> </div> CONTENT ,'login' => <<<CONTENT <div id="l7p-login"> [block login_form] </div> CONTENT ,'one_time_login' => <<<CONTENT <div id="l7p-new-password"> [block new_password_form] </div> CONTENT ,'recover' => <<<CONTENT <div id="l7p-password-recover"> [block password_recover_form] </div> CONTENT ,'subscription' => <<<CONTENT <div id="l7p-subscription"> [block subscription_form] </div> CONTENT ,'register' => <<<CONTENT <div> [block register_form] </div> CONTENT ,'affiliate' => <<<CONTENT <div> [block register_agent_form] </div> CONTENT , 'manual_chapter' => <<<CONTENT <div> <h1>[MANUAL_NAME]<span><span>[MANUAL_CHAPTER]</span></span></h1> </div> <div> <div> <div> <h3>`Choose a chapter`</h3> <div> [MANUAL_TOC] </div> </div> <div> [MANUAL_CONTENT] </div> </div> </div> <div> <h3><span>`Support</span> Center`</h3> <p>`Access to the VoIP Studio Support Center is only granted to our customers.<br> Please login into Customer Portal to open a new Support Ticket.`</p> <a href="/login">`Login`</a> </div> CONTENT , 'manual_search' => <<<CONTENT <div> <h1>[MANUAL_NAME]<span><span>[MANUAL_CHAPTER]</span></span></h1> </div> <div> </div> <div> <h3><span>`Support</span> Center`</h3> <p>`Access to the VoIP Studio Support Center is only granted to our customers.<br> Please login into Customer Portal to open a new Support Ticket.`</p> <a href="/login">`Login`</a> </div> CONTENT ); } } return new L7P_Install();
level7systems/wp-l7plugin
includes/L7P_Install.php
PHP
gpl-3.0
40,853
<html dir="ltr"> <head> <meta name="author" content="github.com/miguel456"></meta> <!-- Warning: Low quality HTML. Please customise this page as instructed in readme.md! --> </head> <body dir="ltr"> <div align="center"> <h1>401 Несанкционированное</h1> <h4>Запрещено</h4> <br><p>Мы сожалеем, но у вас нет доступа к этой странице. Пожалуйста, войдите, чтобы завершить этот запрос. Если вы хотите зарегистрироваться, пожалуйста, посетите ссылку главной страницы.</p> <img src="https://http.cat/401" alt="Запрещено"> </div> </body> </html>
miguel456/php-ip-address-logger
statusPages/ru/401.html
HTML
gpl-3.0
822
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <title>GNU Radio 7f75d35b C++ API: Class Members - Functions</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css" /> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript"> $(document).ready(initResizable); </script> </head> <body> <div id="top"><!-- do not remove this div! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">GNU Radio 7f75d35b C++ API </div> </td> </tr> </tbody> </table> </div> <!-- Generated by Doxygen 1.7.6.1 --> </div> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> initNavTree('functions_func_0x61.html',''); </script> <div id="doc-content"> <div class="contents"> &#160; <h3><a class="anchor" id="index_a"></a>- a -</h3><ul> <li>Aadvark() : <a class="el" href="classAadvark.html#adf1a4b97a641411a74a04ab312484462">Aadvark</a> </li> <li>abort() : <a class="el" href="classcircular__buffer.html#a1da17d5f94fe3ca1ffca42a5d307f4f5">circular_buffer&lt; T &gt;</a> </li> <li>accrue_stats() : <a class="el" href="classgr__bin__statistics__f.html#a13ed697688288f0f00511e4a81554941">gr_bin_statistics_f</a> </li> <li>accum_decay() : <a class="el" href="classvocoder__cvsd__decode__bs.html#acf7e802879e7eeb8eefdc3cf547c2d17">vocoder_cvsd_decode_bs</a> , <a class="el" href="classvocoder__cvsd__encode__sb.html#a16e66b2f18d893c8c5341b4389d0067f">vocoder_cvsd_encode_sb</a> </li> <li>add_handler() : <a class="el" href="classgr__dispatcher.html#a761602cfdc4515148d2b2e911e87a33d">gr_dispatcher</a> </li> <li>add_item_tag() : <a class="el" href="classgr__block.html#a7578dece9d597abe61db91aae8a0df83">gr_block</a> , <a class="el" href="classgr__block__detail.html#a4f62ffcded12fc1bda98b2cba9d81493">gr_block_detail</a> , <a class="el" href="classgr__buffer.html#a616aa3e09d83804ea3d6045e4f7f5153">gr_buffer</a> </li> <li>add_thread() : <a class="el" href="classgruel_1_1thread__group.html#a8bb35726ea6c93c186628b902e131069">gruel::thread_group</a> </li> <li>adjust_freq() : <a class="el" href="classgr__fxpt__nco.html#ae0b360fc3c7c90594065c196d091a632">gr_fxpt_nco</a> , <a class="el" href="classgr__nco.html#aaaefdc0f44d2d0a75078ccecaa5cf0a0">gr_nco&lt; o_type, i_type &gt;</a> </li> <li>adjust_phase() : <a class="el" href="classgr__fxpt__vco.html#aacf093027fc95da11b86802e409ef3cf">gr_fxpt_vco</a> , <a class="el" href="classgr__nco.html#adebaf4df7e9d941bef8d15785dfff6cd">gr_nco&lt; o_type, i_type &gt;</a> , <a class="el" href="classgr__vco.html#a9369c68b68aa73498cd23d74cdfc5f99">gr_vco&lt; o_type, i_type &gt;</a> , <a class="el" href="classgr__fxpt__nco.html#a10dbfd4b18e7a071d0fc605f2865c0b5">gr_fxpt_nco</a> </li> <li>advance_loop() : <a class="el" href="classgri__control__loop.html#a28d9553fbb472f7d061fd6d25392ac63">gri_control_loop</a> </li> <li>alignment() : <a class="el" href="classgr__block.html#a0ac966add9d0c994aa06c61d30ef8335">gr_block</a> </li> <li>all_factories() : <a class="el" href="classgr__vmcircbuf__sysconfig.html#ae6b153e2b6b8599cee6fcb65ad62fc48">gr_vmcircbuf_sysconfig</a> </li> <li>alpha() : <a class="el" href="classgr__peak__detector2__fb.html#a3a7e28f5cc25d8a5977b37f83e00129e">gr_peak_detector2_fb</a> , <a class="el" href="classdigital__impl__mpsk__snr__est.html#a5da4c3d305c742ccf1f6d7f8f716fb49">digital_impl_mpsk_snr_est</a> , <a class="el" href="classdigital__mpsk__snr__est__cc.html#aae641ea42023a25abd970172d9110278">digital_mpsk_snr_est_cc</a> , <a class="el" href="classdigital__probe__mpsk__snr__est__c.html#ac3ec88dfad49c85b12e2f63a9be38f89">digital_probe_mpsk_snr_est_c</a> </li> <li>apply_pre_diff_code() : <a class="el" href="classdigital__constellation.html#a03ec7ff36b47e7a08944dace5492406c">digital_constellation</a> </li> <li>arg1() : <a class="el" href="classgr__message.html#a34f11c43ca1e2412b1404a14178d3ccb">gr_message</a> </li> <li>arg2() : <a class="el" href="classgr__message.html#a03f6058e5f412cabd793117b5bbf093f">gr_message</a> </li> <li>arity() : <a class="el" href="classdigital__constellation.html#add4790d1220a4497549f8490706f0444">digital_constellation</a> </li> <li>atsc_root_raised_cosine_bandpass() : <a class="el" href="classatsc__root__raised__cosine__bandpass.html#ad2679456f966c68cae94e455522164cf">atsc_root_raised_cosine_bandpass</a> </li> <li>atsci_basic_trellis_encoder() : <a class="el" href="classatsci__basic__trellis__encoder.html#ac90e2213b87748bcb6b19582068c0808">atsci_basic_trellis_encoder</a> </li> <li>atsci_data_deinterleaver() : <a class="el" href="classatsci__data__deinterleaver.html#a8a86d3ad79012b2080d8609e265bed8d">atsci_data_deinterleaver</a> </li> <li>atsci_data_interleaver() : <a class="el" href="classatsci__data__interleaver.html#a785aa6bf56cf4d1fe8babe004093ef0d">atsci_data_interleaver</a> </li> <li>atsci_equalizer() : <a class="el" href="classatsci__equalizer.html#ac0a5af23fc9f5fb75f75da695b085003">atsci_equalizer</a> </li> <li>atsci_equalizer_lms() : <a class="el" href="classatsci__equalizer__lms.html#a3f8c96e777f330523325486b8d9f63d5">atsci_equalizer_lms</a> </li> <li>atsci_equalizer_lms2() : <a class="el" href="classatsci__equalizer__lms2.html#aae34925a1a6313624727d2cd4eb6e9bd">atsci_equalizer_lms2</a> </li> <li>atsci_equalizer_nop() : <a class="el" href="classatsci__equalizer__nop.html#adc29c7152a9e4ac568fc626b2da00ee7">atsci_equalizer_nop</a> </li> <li>atsci_fake_single_viterbi() : <a class="el" href="classatsci__fake__single__viterbi.html#a9c1b92168236f33bfbabb538cde43005">atsci_fake_single_viterbi</a> </li> <li>atsci_fs_checker() : <a class="el" href="classatsci__fs__checker.html#af6dc8b2ac60bfa16b7c0a76cf850d032">atsci_fs_checker</a> </li> <li>atsci_fs_checker_naive() : <a class="el" href="classatsci__fs__checker__naive.html#a70440dc1f399385579a877f9d5c14b24">atsci_fs_checker_naive</a> </li> <li>atsci_fs_correlator() : <a class="el" href="classatsci__fs__correlator.html#a33c5cb24fb7c06edf4a2d8118ed4eaf6">atsci_fs_correlator</a> </li> <li>atsci_fs_correlator_naive() : <a class="el" href="classatsci__fs__correlator__naive.html#a65234eac85d7029e1c1608237f14e974">atsci_fs_correlator_naive</a> </li> <li>atsci_interpolator() : <a class="el" href="classatsci__interpolator.html#adb04217aa29140bc6e294647edd332a5">atsci_interpolator</a> </li> <li>atsci_randomizer() : <a class="el" href="classatsci__randomizer.html#ada8bf463b636b8e8bd845c8556381333">atsci_randomizer</a> </li> <li>atsci_reed_solomon() : <a class="el" href="classatsci__reed__solomon.html#a8e203e07cc3df727db4b310ef61fee06">atsci_reed_solomon</a> </li> <li>atsci_single_viterbi() : <a class="el" href="classatsci__single__viterbi.html#a3c497eb8e41e424c58f016db1e577280">atsci_single_viterbi</a> </li> <li>atsci_slicer_agc() : <a class="el" href="classatsci__slicer__agc.html#ad39823f47cff87e98a626937f228e5eb">atsci_slicer_agc</a> </li> <li>atsci_sliding_correlator() : <a class="el" href="classatsci__sliding__correlator.html#aa2074605b86f8c6b88cfda8d0a9ad56f">atsci_sliding_correlator</a> </li> <li>atsci_sssr() : <a class="el" href="classatsci__sssr.html#a5d4a085ba7b9bafe9095292b032d01c1">atsci_sssr</a> </li> <li>atsci_trellis_encoder() : <a class="el" href="classatsci__trellis__encoder.html#adcf15e465af8f6f43ad997caa772417b">atsci_trellis_encoder</a> </li> <li>atsci_viterbi_decoder() : <a class="el" href="classatsci__viterbi__decoder.html#a962f29bb74ff6b2548a7a6b674fdca4f">atsci_viterbi_decoder</a> </li> <li>attack_rate() : <a class="el" href="classgri__agc2__cc.html#a4996c777b5d4f7df997046e48228710c">gri_agc2_cc</a> , <a class="el" href="classgri__agc2__ff.html#ab71f2b30849017047dd8a5195b545139">gri_agc2_ff</a> </li> <li>audio_alsa_sink() : <a class="el" href="classaudio__alsa__sink.html#a211ce746804f2008b50468a22fbba6e0">audio_alsa_sink</a> </li> <li>audio_alsa_source() : <a class="el" href="classaudio__alsa__source.html#a649dab0633499841e120b5613cc8d594">audio_alsa_source</a> </li> <li>audio_jack_sink() : <a class="el" href="classaudio__jack__sink.html#ae72a07079c4c1d11025cad4295ac463f">audio_jack_sink</a> </li> <li>audio_jack_source() : <a class="el" href="classaudio__jack__source.html#a86156240c4a59adc7c2f78fde79f4c78">audio_jack_source</a> </li> <li>audio_oss_sink() : <a class="el" href="classaudio__oss__sink.html#ad701e9d0dead2e00ef430805b796bc5c">audio_oss_sink</a> </li> <li>audio_oss_source() : <a class="el" href="classaudio__oss__source.html#a48c771fb669aa62dc9f2a49cdd79da6f">audio_oss_source</a> </li> <li>audio_osx_sink() : <a class="el" href="classaudio__osx__sink.html#abb21a07565b78ce7a861d3c8ee4c4db0">audio_osx_sink</a> </li> <li>audio_osx_source() : <a class="el" href="classaudio__osx__source.html#ad1999c15b0c96b1746ff25bdc2da97a5">audio_osx_source</a> </li> <li>audio_portaudio_sink() : <a class="el" href="classaudio__portaudio__sink.html#a387f47e510264f54f764e9bc5a734148">audio_portaudio_sink</a> </li> <li>audio_portaudio_source() : <a class="el" href="classaudio__portaudio__source.html#a2247be046f79490e383d766d4884702d">audio_portaudio_source</a> </li> <li>audio_windows_sink() : <a class="el" href="classaudio__windows__sink.html#ad858fd06a4c1a2a8f96042e6c387ab56">audio_windows_sink</a> </li> <li>audio_windows_source() : <a class="el" href="classaudio__windows__source.html#a1cb2574c00b7b6c3a6a704e3d96bbc7e">audio_windows_source</a> </li> </ul> </div><!-- contents --> </div> <div id="nav-path" class="navpath"> <ul> <li class="footer">Generated on Thu Sep 27 2012 10:49:55 for GNU Radio 7f75d35b C++ API by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.6.1 </li> </ul> </div> </body> </html>
katsikas/gnuradio
build/docs/doxygen/html/functions_func_0x61.html
HTML
gpl-3.0
10,415
<?php if (isset($msg)) echo $msg; ?> <?php if ( !isset($evento) && isset($_SESSION['Cliente'])) { ?> <div class="container-fluid"> <div class="row"> <div class="col-md-1"></div> <div class="col-md-10 "> <div class="panel panel-primary"> <div class="panel-heading"><strong><?php echo '<strong>' . $_SESSION['Cliente']['NomeCliente'] . '</strong> - <small>Id.: ' . $_SESSION['Cliente']['idApp_Cliente'] . '</small>' ?></strong></div> <div class="panel-body"> <div class="form-group"> <div class="row"> <div class="col-md-2 "></div> <div class="col-md-8 col-lg-8"> <div class="col-md-4 text-left"> <label for="">Cliente & Contatos:</label> <div class="form-group"> <div class="row"> <a <?php if (preg_match("/prontuario\b/", $_SERVER['REQUEST_URI'])) echo 'class=active'; //(.)+\/prontuario/ ?>> <a class="btn btn-md btn-success" href="<?php echo base_url() . 'cliente/prontuario/' . $_SESSION['Cliente']['idApp_Cliente']; ?>"> <span class="glyphicon glyphicon-file"> </span> Ver <span class="sr-only">(current)</span> </a> </a> <a <?php if (preg_match("/cliente\/alterar\b/", $_SERVER['REQUEST_URI'])) echo 'class=active'; ///(.)+\/alterar/ ?>> <a class="btn btn-md btn-warning" href="<?php echo base_url() . 'cliente/alterar/' . $_SESSION['Cliente']['idApp_Cliente']; ?>"> <span class="glyphicon glyphicon-edit"></span> Edit. </a> </a> </div> </div> </div> <div class="col-md-4 text-center"> <label for="">Agendamentos:</label> <div class="form-group"> <div class="row"> <a <?php if (preg_match("/consulta\/listar\b/", $_SERVER['REQUEST_URI'])) echo 'class=active'; ?>> <a class="btn btn-md btn-success" href="<?php echo base_url() . 'consulta/listar/' . $_SESSION['Cliente']['idApp_Cliente']; ?>"> <span class="glyphicon glyphicon-calendar"></span> List. </a> </a> <a <?php if (preg_match("/consulta\/(cadastrar|alterar)\b/", $_SERVER['REQUEST_URI'])) echo 'class=active'; ?>> <a class="btn btn-md btn-warning" href="<?php echo base_url() . 'consulta/cadastrar/' . $_SESSION['Cliente']['idApp_Cliente']; ?>"> <span class="glyphicon glyphicon-plus"></span> Cad. </a> </a> </div> </div> </div> <div class="col-md-4 text-right"> <label for="">Orçamentos:</label> <div class="form-group "> <div class="row"> <a <?php if (preg_match("/orcatrata\/listar\b/", $_SERVER['REQUEST_URI'])) echo 'class=active'; ?>> <a class="btn btn-md btn-success" href="<?php echo base_url() . 'orcatrata/listar/' . $_SESSION['Cliente']['idApp_Cliente']; ?>"> <span class="glyphicon glyphicon-usd"></span> List. </a> </a> <a <?php if (preg_match("/orcatrata\/cadastrar\b/", $_SERVER['REQUEST_URI'])) echo 'class=active'; ?>> <a class="btn btn-md btn-warning" href="<?php echo base_url() . 'orcatrata/cadastrar/' . $_SESSION['Cliente']['idApp_Cliente']; ?>"> <span class="glyphicon glyphicon-plus"></span> Cad. </a> </a> </div> </div> </div> </div> <div class="col-md-2 "></div> </div> </div> <!-- <div class="form-group"> <div class="row"> <div class="text-center t"> <h3><?php echo '<strong>' . $_SESSION['Cliente']['NomeCliente'] . '</strong> - <small>Id.: ' . $_SESSION['Cliente']['idApp_Cliente'] . '</small>' ?></h3> </div> </div> </div> --> <?php } ?> <div class="row"> <div class="col-md-12 col-lg-12"> <?php echo validation_errors(); ?> <div class="panel panel-<?php echo $panel; ?>"> <div class="panel-heading"><strong>Orçamentos</strong></div> <div class="panel-body"> <?php echo form_open_multipart($form_open_path); ?> <!-- <div class="text-left t"> <h4><?php echo '<strong>Prof.: ' . $_SESSION['log']['Nome'] . '</strong>' ?></h4> </div> --> <!--App_OrcaTrata--> <!-- <div class="form-group"> <div class="panel panel-info"> <div class="panel-heading"> <div class="row"> <div class="col-md-3"> <label for="DataOrca">Data do Orçamento:</label> <div class="input-group <?php echo $datepicker; ?>"> <input type="text" class="form-control Date" <?php echo $readonly; ?> maxlength="10" placeholder="DD/MM/AAAA" name="DataOrca" value="<?php echo $orcatrata['DataOrca']; ?>"> <span class="input-group-addon" disabled> <span class="glyphicon glyphicon-calendar"></span> </span> </div> </div> <div class="col-md-3"> <label for="DataEntradaOrca">Validade do Orç.:</label> <div class="input-group <?php echo $datepicker; ?>"> <input type="text" class="form-control Date" <?php echo $readonly; ?> maxlength="10" placeholder="DD/MM/AAAA" name="DataEntradaOrca" value="<?php echo $orcatrata['DataEntradaOrca']; ?>"> <span class="input-group-addon" disabled> <span class="glyphicon glyphicon-calendar"></span> </span> </div> </div> <div class="col-md-3"> <label for="DataPrazo">Prazo de Entrega:</label> <div class="input-group <?php echo $datepicker; ?>"> <input type="text" class="form-control Date" <?php echo $readonly; ?> maxlength="10" placeholder="DD/MM/AAAA" autofocus name="DataPrazo" value="<?php echo $orcatrata['DataPrazo']; ?>"> <span class="input-group-addon" disabled> <span class="glyphicon glyphicon-calendar"></span> </span> </div> </div> </div> </div> </div> </div> <hr> --> <div class="panel-group" id="accordion1" role="tablist" aria-multiselectable="true"> <div class="panel panel-primary"> <div class="panel-heading collapsed" role="tab" id="heading1" data-toggle="collapse" data-parent="#accordion1" data-target="#collapse1" aria-expanded="false"> <h4 class="panel-title"> <a class="accordion-toggle"> <span class="glyphicon glyphicon-chevron-down" aria-hidden="true"></span> Orçamento, Serviços & Produtos </a> </h4> </div> <div id="collapse1" class="panel-collapse collapsed collapse" role="tabpanel" aria-labelledby="heading1" aria-expanded="false" style="height: 0px;"> <div class="panel-body"> <!--#######################################--> <input type="hidden" name="SCount" id="SCount" value="<?php echo $count['SCount']; ?>"/> <div class="input_fields_wrap"> <?php for ($i=1; $i <= $count['SCount']; $i++) { ?> <?php if ($metodo > 1) { ?> <input type="hidden" name="idApp_ServicoVenda<?php echo $i ?>" value="<?php echo $servico[$i]['idApp_ServicoVenda']; ?>"/> <?php } ?> <div class="form-group" id="1div<?php echo $i ?>"> <div class="panel panel-info"> <div class="panel-heading"> <div class="row"> <div class="col-md-1"> <label for="QtdVendaServico">Qtd:</label> <input type="text" class="form-control Numero" maxlength="3" id="QtdVendaServico<?php echo $i ?>" placeholder="0" onkeyup="calculaSubtotal(this.value,this.name,'<?php echo $i ?>','QTD','Servico')" autofocus name="QtdVendaServico<?php echo $i ?>" value="<?php echo $servico[$i]['QtdVendaServico'] ?>"> </div> <div class="col-md-6"> <label for="idTab_Servico">Serviço:</label> <?php if ($i == 1) { ?> <!--<a class="btn btn-xs btn-info" href="<?php echo base_url() ?>servico/cadastrar/servico" role="button"> <span class="glyphicon glyphicon-plus"></span> <b>Novo Serviço</b> </a>--> <?php } ?> <select data-placeholder="Selecione uma opção..." class="form-control" onchange="buscaValor(this.value,this.name,'Servico',<?php echo $i ?>)" <?php echo $readonly; ?> id="lista" name="idTab_Servico<?php echo $i ?>"> <option value="">-- Selecione uma opção --</option> <?php foreach ($select['Servico'] as $key => $row) { if ($servico[$i]['idTab_Servico'] == $key) { echo '<option value="' . $key . '" selected="selected">' . $row . '</option>'; } else { echo '<option value="' . $key . '">' . $row . '</option>'; } } ?> </select> </div> <div class="col-md-2"> <label for="ValorVendaServico">Valor do Serviço:</label> <div class="input-group" id="txtHint"> <span class="input-group-addon" id="basic-addon1">R$</span> <input type="text" class="form-control Valor" id="idTab_Servico<?php echo $i ?>" maxlength="10" placeholder="0,00" onkeyup="calculaSubtotal(this.value,this.name,'<?php echo $i ?>','VP','Servico')" name="ValorVendaServico<?php echo $i ?>" value="<?php echo $servico[$i]['ValorVendaServico'] ?>"> </div> </div> <div class="col-md-2"> <label for="SubtotalServico">Subtotal:</label> <div class="input-group"> <span class="input-group-addon" id="basic-addon1">R$</span> <input type="text" class="form-control Valor" maxlength="10" placeholder="0,00" readonly="" id="SubtotalServico<?php echo $i ?>" name="SubtotalServico<?php echo $i ?>" value="<?php echo $servico[$i]['SubtotalServico'] ?>"> </div> </div> </div> <div class="row"> <div class="col-md-6"> <label for="ObsServico<?php echo $i ?>">Obs:</label><br> <input type="text" class="form-control" id="ObsServico<?php echo $i ?>" maxlength="250" name="ObsServico<?php echo $i ?>" value="<?php echo $servico[$i]['ObsServico'] ?>"> </div> <div class="col-md-3"> <label for="ConcluidoServico">Concluído? </label><br> <div class="form-group"> <div class="btn-group" data-toggle="buttons"> <?php foreach ($select['ConcluidoServico'] as $key => $row) { (!$servico[$i]['ConcluidoServico']) ? $servico[$i]['ConcluidoServico'] = 'N' : FALSE; if ($servico[$i]['ConcluidoServico'] == $key) { echo '' . '<label class="btn btn-warning active" name="radiobutton_ConcluidoServico' . $i . '" id="radiobutton_ConcluidoServico' . $i . $key . '">' . '<input type="radio" name="ConcluidoServico' . $i . '" id="radiobuttondinamico" ' . 'autocomplete="off" value="' . $key . '" checked>' . $row . '</label>' ; } else { echo '' . '<label class="btn btn-default" name="radiobutton_ConcluidoServico' . $i . '" id="radiobutton_ConcluidoServico' . $i . $key . '">' . '<input type="radio" name="ConcluidoServico' . $i . '" id="radiobuttondinamico" ' . 'autocomplete="off" value="' . $key . '" >' . $row . '</label>' ; } } ?> </div> </div> </div> <div class="col-md-2"> <label><br></label><br> <button type="button" id="<?php echo $i ?>" class="remove_field btn btn-danger"> <span class="glyphicon glyphicon-trash"></span> </button> </div> </div> </div> </div> </div> <?php } ?> </div> <!-- <div class="form-group"> <div class="row"> <div class="col-md-3"></div> <div class="col-md-3 text-left"> <a class="btn btn-md btn-danger" onclick="adicionaServico()"> <span class="glyphicon glyphicon-plus"></span> Serviços </a> </div> </div> </div> <hr> --> <input type="hidden" name="PCount" id="PCount" value="<?php echo $count['PCount']; ?>"/> <div class="input_fields_wrap2"> <?php for ($i=1; $i <= $count['PCount']; $i++) { ?> <?php if ($metodo > 1) { ?> <input type="hidden" name="idApp_ProdutoVenda<?php echo $i ?>" value="<?php echo $produto[$i]['idApp_ProdutoVenda']; ?>"/> <?php } ?> <div class="form-group" id="2div<?php echo $i ?>"> <div class="panel panel-info"> <div class="panel-heading"> <div class="row"> <div class="col-md-1"> <label for="QtdVendaProduto">Qtd<?php echo $i ?>:</label> <input type="text" class="form-control Numero" maxlength="3" id="QtdVendaProduto<?php echo $i ?>" placeholder="0" onkeyup="calculaSubtotal(this.value,this.name,'<?php echo $i ?>','QTD','Produto')" autofocus name="QtdVendaProduto<?php echo $i ?>" value="<?php echo $produto[$i]['QtdVendaProduto'] ?>"> </div> <div class="col-md-7"> <label for="idTab_Produto">Produto:</label> <?php if ($i == 1) { ?> <!--<a class="btn btn-xs btn-info" href="<?php echo base_url() ?>produto/cadastrar/produto" role="button"> <span class="glyphicon glyphicon-plus"></span> <b>Novo Produto</b> </a>--> <?php } ?> <select data-placeholder="Selecione uma opção..." class="form-control Chosen" onchange="buscaValor2Tabelas(this.value,this.name,'Valor',<?php echo $i ?>,'Produto')" <?php echo $readonly; ?> id="listadinamicab<?php echo $i ?>" name="idTab_Produto<?php echo $i ?>"> <option value="">-- Selecione uma opção --</option> <?php foreach ($select['Produto'] as $key => $row) { if ($produto[$i]['idTab_Produto'] == $key) { echo '<option value="' . $key . '" selected="selected">' . $row . '</option>'; } else { echo '<option value="' . $key . '">' . $row . '</option>'; } } ?> </select> </div> <div class="col-md-2"> <label for="ValorVendaProduto">Valor do Produto:</label> <div class="input-group"> <span class="input-group-addon" id="basic-addon1">R$</span> <input type="text" class="form-control Valor" id="idTab_Produto<?php echo $i ?>" maxlength="10" placeholder="0,00" onkeyup="calculaSubtotal(this.value,this.name,'<?php echo $i ?>','VP','Produto')" name="ValorVendaProduto<?php echo $i ?>" value="<?php echo $produto[$i]['ValorVendaProduto'] ?>"> </div> </div> <div class="col-md-2"> <label for="SubtotalProduto">Subtotal:</label> <div class="input-group"> <span class="input-group-addon" id="basic-addon1">R$</span> <input type="text" class="form-control Valor" maxlength="10" placeholder="0,00" readonly="" id="SubtotalProduto<?php echo $i ?>" name="SubtotalProduto<?php echo $i ?>" value="<?php echo $produto[$i]['SubtotalProduto'] ?>"> </div> </div> </div> <div class="row"> <div class="col-md-1"></div> <div class="col-md-7"> <label for="ObsProduto<?php echo $i ?>">Obs:</label><br> <input type="text" class="form-control" id="ObsProduto<?php echo $i ?>" maxlength="250" name="ObsProduto<?php echo $i ?>" value="<?php echo $produto[$i]['ObsProduto'] ?>"> </div> <div class="col-md-2"> <label for="DataValidadeProduto<?php echo $i ?>">Val. do Produto:</label> <div class="input-group <?php echo $datepicker; ?>"> <input type="text" class="form-control Date" <?php echo $readonly; ?> maxlength="10" placeholder="DD/MM/AAAA" name="DataValidadeProduto<?php echo $i ?>" value="<?php echo $produto[$i]['DataValidadeProduto']; ?>"> <span class="input-group-addon" disabled> <span class="glyphicon glyphicon-calendar"></span> </span> </div> </div> <div class="col-md-1"> <label><br></label><br> <button type="button" id="<?php echo $i ?>" class="remove_field2 btn btn-danger"> <span class="glyphicon glyphicon-trash"></span> </button> </div> </div> </div> </div> </div> <?php } ?> </div> <div class="form-group"> <div class="row"> <div class="col-md-3"> <a class="add_field_button2 btn btn-xs btn-danger"> <span class="glyphicon glyphicon-plus"></span> Adic. Produtos ou Serviços </a> </div> </div> </div> </div> <div class="panel-body"> <div class="form-group"> <div class="panel panel-info"> <div class="panel-heading"> <div class="row"> <div class="col-md-3"> <label for="ValorOrca">Orçamento:</label><br> <div class="input-group" id="txtHint"> <span class="input-group-addon" id="basic-addon1">R$</span> <input type="text" class="form-control Valor" id="ValorOrca" maxlength="10" placeholder="0,00" name="ValorOrca" value="<?php echo $orcatrata['ValorOrca'] ?>"> </div> </div> <div class="col-md-3"> <label for="ValorEntradaOrca">Desconto</label><br> <div class="input-group" id="txtHint"> <span class="input-group-addon" id="basic-addon1">R$</span> <input type="text" class="form-control Valor" id="ValorEntradaOrca" maxlength="10" placeholder="0,00" onkeyup="calculaResta(this.value)" name="ValorEntradaOrca" value="<?php echo $orcatrata['ValorEntradaOrca'] ?>"> </div> </div> <div class="col-md-3"> <label for="ValorRestanteOrca">Resta Pagar:</label><br> <div class="input-group" id="txtHint"> <span class="input-group-addon" id="basic-addon1">R$</span> <input type="text" class="form-control Valor" id="ValorRestanteOrca" maxlength="10" placeholder="0,00" readonly="" name="ValorRestanteOrca" value="<?php echo $orcatrata['ValorRestanteOrca'] ?>"> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> <!--#######################################--> <hr> <div class="panel-group" id="accordion2" role="tablist" aria-multiselectable="true"> <div class="panel panel-primary"> <div class="panel-heading" role="tab" id="heading2" data-toggle="collapse" data-parent="#accordion2" data-target="#collapse2"> <h4 class="panel-title"> <a class="accordion-toggle"> <span class="glyphicon glyphicon-chevron-down" aria-hidden="true"></span> Forma de Pagamento & Parcelas </a> </h4> </div> <div id="collapse2" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading2" aria-expanded="false" style="height: 0px;"> <div class="panel-body"> <div class="form-group"> <div class="panel panel-info"> <div class="panel-heading"> <div class="row"> <div class="col-md-2"> <label for="QtdParcelasOrca">Qtd. Parc.:</label><br> <input type="text" class="form-control Numero" id="QtdParcelasOrca" maxlength="3" placeholder="0" name="QtdParcelasOrca" value="<?php echo $orcatrata['QtdParcelasOrca'] ?>"> </div> <div class="col-md-3"> <label for="FormaPagamento">Forma de Pagam.:</label> <select data-placeholder="Selecione uma opção..." class="form-control" <?php echo $readonly; ?> id="FormaPagamento" name="FormaPagamento"> <option value="">-- Selecione uma opção --</option> <?php foreach ($select['FormaPagamento'] as $key => $row) { if ($orcatrata['FormaPagamento'] == $key) { echo '<option value="' . $key . '" selected="selected">' . $row . '</option>'; } else { echo '<option value="' . $key . '">' . $row . '</option>'; } } ?> </select> </div> <div class="col-md-3"> <label for="DataVencimentoOrca">1º Venc.</label> <div class="input-group <?php echo $datepicker; ?>"> <input type="text" class="form-control Date" id="DataVencimentoOrca" <?php echo $readonly; ?> maxlength="10" placeholder="DD/MM/AAAA" name="DataVencimentoOrca" value="<?php echo $orcatrata['DataVencimentoOrca']; ?>"> <span class="input-group-addon" disabled> <span class="glyphicon glyphicon-calendar"></span> </span> </div> </div> <br> <div class="form-group"> <div class="col-md-3 text-left"> <button class="btn btn-danger" type="button" data-toggle="collapse" onclick="calculaParcelas()" data-target="#Parcelas" aria-expanded="false" aria-controls="Parcelas"> <span class="glyphicon glyphicon-menu-down"></span> Gerar Parcelas </button> </div> </div> </div> </div> </div> </div> </div> <div class="panel-body"> <!--App_parcelasRec--> <div class="input_fields_parcelas"> <?php for ($i=1; $i <= $orcatrata['QtdParcelasOrca']; $i++) { ?> <?php if ($metodo > 1) { ?> <input type="hidden" name="idApp_ParcelasRecebiveis<?php echo $i ?>" value="<?php echo $parcelasrec[$i]['idApp_ParcelasRecebiveis']; ?>"/> <?php } ?> <div class="form-group"> <div class="panel panel-info"> <div class="panel-heading"> <div class="row"> <div class="col-md-2"> <label for="ParcelaRecebiveis">Parcela:</label><br> <input type="text" class="form-control" maxlength="6" readonly="" name="ParcelaRecebiveis<?php echo $i ?>" value="<?php echo $parcelasrec[$i]['ParcelaRecebiveis'] ?>"> </div> <div class="col-md-3"> <label for="ValorParcelaRecebiveis">Valor Parcela:</label><br> <div class="input-group" id="txtHint"> <span class="input-group-addon" id="basic-addon1">R$</span> <input type="text" class="form-control Valor" maxlength="10" placeholder="0,00" id="ValorParcelaRecebiveis<?php echo $i ?>" name="ValorParcelaRecebiveis<?php echo $i ?>" value="<?php echo $parcelasrec[$i]['ValorParcelaRecebiveis'] ?>"> </div> </div> <div class="col-md-3"> <label for="DataVencimentoRecebiveis">Data Venc. Parc.</label> <div class="input-group DatePicker"> <input type="text" class="form-control Date" id="DataVencimentoRecebiveis<?php echo $i ?>" maxlength="10" placeholder="DD/MM/AAAA" name="DataVencimentoRecebiveis<?php echo $i ?>" value="<?php echo $parcelasrec[$i]['DataVencimentoRecebiveis'] ?>"> <span class="input-group-addon" disabled> <span class="glyphicon glyphicon-calendar"></span> </span> </div> </div> </div> <div class="col-md-2"></div> <div class="row"> <div class="col-md-3"> <label for="ValorPagoRecebiveis">Valor Pago:</label><br> <div class="input-group" id="txtHint"> <span class="input-group-addon" id="basic-addon1">R$</span> <input type="text" class="form-control Valor" maxlength="10" placeholder="0,00" id="ValorPagoRecebiveis<?php echo $i ?>" name="ValorPagoRecebiveis<?php echo $i ?>" value="<?php echo $parcelasrec[$i]['ValorPagoRecebiveis'] ?>"> </div> </div> <div class="col-md-3"> <label for="DataPagoRecebiveis">Data Pag.</label> <div class="input-group DatePicker"> <input type="text" class="form-control Date" id="DataPagoRecebiveis<?php echo $i ?>" maxlength="10" placeholder="DD/MM/AAAA" name="DataPagoRecebiveis<?php echo $i ?>" value="<?php echo $parcelasrec[$i]['DataPagoRecebiveis'] ?>"> <span class="input-group-addon" disabled> <span class="glyphicon glyphicon-calendar"></span> </span> </div> </div> <div class="col-md-3"> <label for="QuitadoRecebiveis">Quitado????</label><br> <div class="form-group"> <div class="btn-group" data-toggle="buttons"> <?php foreach ($select['QuitadoRecebiveis'] as $key => $row) { (!$parcelasrec[$i]['QuitadoRecebiveis']) ? $parcelasrec[$i]['QuitadoRecebiveis'] = 'N' : FALSE; if ($parcelasrec[$i]['QuitadoRecebiveis'] == $key) { echo '' . '<label class="btn btn-warning active" name="radiobutton_QuitadoRecebiveis' . $i . '" id="radiobutton_QuitadoRecebiveis' . $i . $key . '">' . '<input type="radio" name="QuitadoRecebiveis' . $i . '" id="radiobuttondinamico" ' . 'onchange="carregaQuitado(this.value,this.name,'.$i.')" ' . 'autocomplete="off" value="' . $key . '" checked>' . $row . '</label>' ; } else { echo '' . '<label class="btn btn-default" name="radiobutton_QuitadoRecebiveis' . $i . '" id="radiobutton_QuitadoRecebiveis' . $i . $key . '">' . '<input type="radio" name="QuitadoRecebiveis' . $i . '" id="radiobuttondinamico" ' . 'onchange="carregaQuitado(this.value,this.name,'.$i.')" ' . 'autocomplete="off" value="' . $key . '" >' . $row . '</label>' ; } } ?> </div> </div> </div> </div> </div> </div> </div> <?php } ?> </div> </div> </div> </div> </div> <hr> <div class="panel-group" id="accordion3" role="tablist" aria-multiselectable="true"> <div class="panel panel-primary"> <div class="panel-heading" role="tab" id="heading3" data-toggle="collapse" data-parent="#accordion3" data-target="#collapse3"> <h4 class="panel-title"> <a class="accordion-toggle"> <span class="glyphicon glyphicon-chevron-down" aria-hidden="true"></span> Procedimentos </a> </h4> </div> <div id="collapse3" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading3" aria-expanded="false" style="height: 0px;"> <div class="panel-body"> <input type="hidden" name="PMCount" id="PMCount" value="<?php echo $count['PMCount']; ?>"/> <div class="input_fields_wrap3"> <?php for ($i=1; $i <= $count['PMCount']; $i++) { ?> <?php if ($metodo > 1) { ?> <input type="hidden" name="idApp_Procedimento<?php echo $i ?>" value="<?php echo $procedimento[$i]['idApp_Procedimento']; ?>"/> <?php } ?> <div class="form-group" id="3div<?php echo $i ?>"> <div class="panel panel-info"> <div class="panel-heading"> <div class="row"> <!-- <div class="col-md-3"> <label for="Profissional<?php echo $i ?>">Profissional:</label> <?php if ($i == 1) { ?> <?php } ?> <select data-placeholder="Selecione uma opção..." class="form-control" id="listadinamicac<?php echo $i ?>" name="Profissional<?php echo $i ?>"> <option value="">-- Selecione uma opção --</option> <?php foreach ($select['Profissional'] as $key => $row) { if ($procedimento[$i]['Profissional'] == $key) { echo '<option value="' . $key . '" selected="selected">' . $row . '</option>'; } else { echo '<option value="' . $key . '">' . $row . '</option>'; } } ?> </select> </div> --> <div class="col-md-4"> <label for="Procedimento<?php echo $i ?>">Procedimento:</label> <textarea class="form-control" id="Procedimento<?php echo $i ?>" <?php echo $readonly; ?> name="Procedimento<?php echo $i ?>"><?php echo $procedimento[$i]['Procedimento']; ?></textarea> </div> <div class="col-md-3"> <label for="DataProcedimento<?php echo $i ?>">Data do Proced.:</label> <div class="input-group <?php echo $datepicker; ?>"> <input type="text" class="form-control Date" <?php echo $readonly; ?> maxlength="10" placeholder="DD/MM/AAAA" name="DataProcedimento<?php echo $i ?>" value="<?php echo $procedimento[$i]['DataProcedimento']; ?>"> <span class="input-group-addon" disabled> <span class="glyphicon glyphicon-calendar"></span> </span> </div> </div> <div class="col-md-3"> <label for="ConcluidoProcedimento">Proc. Concl.? </label><br> <div class="form-group"> <div class="btn-group" data-toggle="buttons"> <?php foreach ($select['ConcluidoProcedimento'] as $key => $row) { (!$procedimento[$i]['ConcluidoProcedimento']) ? $procedimento[$i]['ConcluidoProcedimento'] = 'N' : FALSE; if ($procedimento[$i]['ConcluidoProcedimento'] == $key) { echo '' . '<label class="btn btn-warning active" name="radiobutton_ConcluidoProcedimento' . $i . '" id="radiobutton_ConcluidoProcedimento' . $i . $key . '">' . '<input type="radio" name="ConcluidoProcedimento' . $i . '" id="radiobuttondinamico" ' . 'autocomplete="off" value="' . $key . '" checked>' . $row . '</label>' ; } else { echo '' . '<label class="btn btn-default" name="radiobutton_ConcluidoProcedimento' . $i . '" id="radiobutton_ConcluidoProcedimento' . $i . $key . '">' . '<input type="radio" name="ConcluidoProcedimento' . $i . '" id="radiobuttondinamico" ' . 'autocomplete="off" value="' . $key . '" >' . $row . '</label>' ; } } ?> </div> </div> </div> <div class="col-md-2"> <label><br></label><br> <button type="button" id="<?php echo $i ?>" class="remove_field3 btn btn-danger"> <span class="glyphicon glyphicon-trash"></span> </button> </div> </div> </div> </div> </div> <?php } ?> </div> <div class="form-group"> <div class="row"> <div class="col-md-4"> <a class="add_field_button3 btn btn-xs btn-warning" onclick="adicionaProcedimento()"> <span class="glyphicon glyphicon-plus"></span> Adicionar Procedimento </a> </div> </div> </div> </div> </div> </div> </div> <hr> <!-- <div class="form-group"> <div class="row"> <div class="col-md-3"> <label for="DataOrca">Data do Orçamento:</label> <div class="input-group <?php echo $datepicker; ?>"> <input type="text" class="form-control Date" <?php echo $readonly; ?> maxlength="10" placeholder="DD/MM/AAAA" name="DataOrca" value="<?php echo $orcatrata['DataOrca']; ?>"> <span class="input-group-addon" disabled> <span class="glyphicon glyphicon-calendar"></span> </span> </div> </div> <div class="col-md-3"> <label for="DataRetorno">Data do Retorno:</label> <div class="input-group <?php echo $datepicker; ?>"> <input type="text" class="form-control Date" <?php echo $readonly; ?> maxlength="10" placeholder="DD/MM/AAAA" autofocus name="DataRetorno" value="<?php echo $orcatrata['DataRetorno']; ?>"> <span class="input-group-addon" disabled> <span class="glyphicon glyphicon-calendar"></span> </span> </div> </div> <div class="col-md-3"> <label for="DataEntradaOrca">Validade do Orç.:</label> <div class="input-group <?php echo $datepicker; ?>"> <input type="text" class="form-control Date" <?php echo $readonly; ?> maxlength="10" placeholder="DD/MM/AAAA" name="DataEntradaOrca" value="<?php echo $orcatrata['DataEntradaOrca']; ?>"> <span class="input-group-addon" disabled> <span class="glyphicon glyphicon-calendar"></span> </span> </div> </div> <div class="col-md-3"> <label for="DataPrazo">Prazo de Entrega:</label> <div class="input-group <?php echo $datepicker; ?>"> <input type="text" class="form-control Date" <?php echo $readonly; ?> maxlength="10" placeholder="DD/MM/AAAA" name="DataPrazo" value="<?php echo $orcatrata['DataPrazo']; ?>"> <span class="input-group-addon" disabled> <span class="glyphicon glyphicon-calendar"></span> </span> </div> </div> </div> </div> <hr> --> <div class="col-md-1"></div> <div class="form-group text-center"> <div class="row"> <div class="col-md-3 form-inline"> <label for="AprovadoOrca">Orçam. Aprovado?</label><br> <div class="form-group"> <div class="btn-group" data-toggle="buttons"> <?php foreach ($select['AprovadoOrca'] as $key => $row) { if (!$orcatrata['AprovadoOrca']) $orcatrata['AprovadoOrca'] = 'N'; ($key == 'S') ? $hideshow = 'showradio' : $hideshow = 'hideradio'; if ($orcatrata['AprovadoOrca'] == $key) { echo '' . '<label class="btn btn-warning active" name="AprovadoOrca_' . $hideshow . '">' . '<input type="radio" name="AprovadoOrca" id="' . $hideshow . '" ' . 'autocomplete="off" value="' . $key . '" checked>' . $row . '</label>' ; } else { echo '' . '<label class="btn btn-default" name="AprovadoOrca_' . $hideshow . '">' . '<input type="radio" name="AprovadoOrca" id="' . $hideshow . '" ' . 'autocomplete="off" value="' . $key . '" >' . $row . '</label>' ; } } ?> </div> </div> </div> <div class="col-md-3 form-inline"> <label for="QuitadoOrca">Orçam. Quitado?</label><br> <div class="form-group"> <div class="btn-group" data-toggle="buttons"> <?php foreach ($select['QuitadoOrca'] as $key => $row) { (!$orcatrata['QuitadoOrca']) ? $orcatrata['QuitadoOrca'] = 'N' : FALSE; if ($orcatrata['QuitadoOrca'] == $key) { echo '' . '<label class="btn btn-warning active" name="radiobutton_QuitadoOrca" id="radiobutton_QuitadoOrca' . $key . '">' . '<input type="radio" name="QuitadoOrca" id="radiobutton" ' . 'autocomplete="off" value="' . $key . '" checked>' . $row . '</label>' ; } else { echo '' . '<label class="btn btn-default" name="radiobutton_QuitadoOrca" id="radiobutton_QuitadoOrca' . $key . '">' . '<input type="radio" name="QuitadoOrca" id="radiobutton" ' . 'autocomplete="off" value="' . $key . '" >' . $row . '</label>' ; } } ?> </div> </div> </div> <div class="col-md-3 form-inline"> <label for="ServicoConcluido">Srv/Prd Entregue?</label><br> <div class="form-group"> <div class="btn-group" data-toggle="buttons"> <?php foreach ($select['ServicoConcluido'] as $key => $row) { (!$orcatrata['ServicoConcluido']) ? $orcatrata['ServicoConcluido'] = 'N' : FALSE; if ($orcatrata['ServicoConcluido'] == $key) { echo '' . '<label class="btn btn-warning active" name="radiobutton_ServicoConcluido" id="radiobutton_ServicoConcluido' . $key . '">' . '<input type="radio" name="ServicoConcluido" id="radiobutton" ' . 'autocomplete="off" value="' . $key . '" checked>' . $row . '</label>' ; } else { echo '' . '<label class="btn btn-default" name="radiobutton_ServicoConcluido" id="radiobutton_ServicoConcluido' . $key . '">' . '<input type="radio" name="ServicoConcluido" id="radiobutton" ' . 'autocomplete="off" value="' . $key . '" >' . $row . '</label>' ; } } ?> </div> </div> </div> </div> </div> <div class="col-md-1"></div> <div class="form-group text-center"> <div class="row"> <div class="col-md-3"> <label for="DataOrca">Data do Orçamento:</label> <div class="input-group <?php echo $datepicker; ?>"> <input type="text" class="form-control Date" <?php echo $readonly; ?> maxlength="10" placeholder="DD/MM/AAAA" name="DataOrca" value="<?php echo $orcatrata['DataOrca']; ?>"> <span class="input-group-addon" disabled> <span class="glyphicon glyphicon-calendar"></span> </span> </div> </div> <div class="col-md-3"> <label for="DataConclusao">Data da Entrega:</label> <div class="input-group <?php echo $datepicker; ?>"> <input type="text" class="form-control Date" <?php echo $readonly; ?> maxlength="10" placeholder="DD/MM/AAAA" name="DataConclusao" value="<?php echo $orcatrata['DataConclusao']; ?>"> <span class="input-group-addon" disabled> <span class="glyphicon glyphicon-calendar"></span> </span> </div> </div> <div class="col-md-3"> <label for="DataRetorno">Data do Retorno:</label> <div class="input-group <?php echo $datepicker; ?>"> <input type="text" class="form-control Date" <?php echo $readonly; ?> maxlength="10" placeholder="DD/MM/AAAA" name="DataRetorno" value="<?php echo $orcatrata['DataRetorno']; ?>"> <span class="input-group-addon" disabled> <span class="glyphicon glyphicon-calendar"></span> </span> </div> </div> <!-- <div class="form-group text-center"> <div id="AprovadoOrca" <?php echo $div['AprovadoOrca']; ?>> <div class="col-md-3 form-inline"> <label for="QuitadoOrca">Orçam. Quitado?</label><br> <div class="form-group"> <div class="btn-group" data-toggle="buttons"> <?php foreach ($select['QuitadoOrca'] as $key => $row) { (!$orcatrata['QuitadoOrca']) ? $orcatrata['QuitadoOrca'] = 'N' : FALSE; if ($orcatrata['QuitadoOrca'] == $key) { echo '' . '<label class="btn btn-warning active" name="radiobutton_QuitadoOrca" id="radiobutton_QuitadoOrca' . $key . '">' . '<input type="radio" name="QuitadoOrca" id="radiobutton" ' . 'autocomplete="off" value="' . $key . '" checked>' . $row . '</label>' ; } else { echo '' . '<label class="btn btn-default" name="radiobutton_QuitadoOrca" id="radiobutton_QuitadoOrca' . $key . '">' . '<input type="radio" name="QuitadoOrca" id="radiobutton" ' . 'autocomplete="off" value="' . $key . '" >' . $row . '</label>' ; } } ?> </div> </div> </div> <div class="col-md-3 form-inline"> <label for="ServicoConcluido">Srv/Prd Entregue?</label><br> <div class="form-group"> <div class="btn-group" data-toggle="buttons"> <?php foreach ($select['ServicoConcluido'] as $key => $row) { (!$orcatrata['ServicoConcluido']) ? $orcatrata['ServicoConcluido'] = 'N' : FALSE; if ($orcatrata['ServicoConcluido'] == $key) { echo '' . '<label class="btn btn-warning active" name="radiobutton_ServicoConcluido" id="radiobutton_ServicoConcluido' . $key . '">' . '<input type="radio" name="ServicoConcluido" id="radiobutton" ' . 'autocomplete="off" value="' . $key . '" checked>' . $row . '</label>' ; } else { echo '' . '<label class="btn btn-default" name="radiobutton_ServicoConcluido" id="radiobutton_ServicoConcluido' . $key . '">' . '<input type="radio" name="ServicoConcluido" id="radiobutton" ' . 'autocomplete="off" value="' . $key . '" >' . $row . '</label>' ; } } ?> </div> </div> </div> <div class="col-md-3"> <label for="DataConclusao">Data da Entrega:</label> <div class="input-group <?php echo $datepicker; ?>"> <input type="text" class="form-control Date" <?php echo $readonly; ?> maxlength="10" placeholder="DD/MM/AAAA" name="DataConclusao" value="<?php echo $orcatrata['DataConclusao']; ?>"> <span class="input-group-addon" disabled> <span class="glyphicon glyphicon-calendar"></span> </span> </div> </div> </div> </div> --> </div> </div> <div class="col-md-1"></div> <div class="form-group text-center"> <div class="row"> <div class="col-md-9"> <label for="ObsOrca">OBS:</label> <textarea class="form-control" id="ObsOrca" <?php echo $readonly; ?> name="ObsOrca"><?php echo $orcatrata['ObsOrca']; ?></textarea> </div> </div> </div> <hr> <div class="form-group"> <div class="row"> <input type="hidden" name="idApp_Cliente" value="<?php echo $_SESSION['Cliente']['idApp_Cliente']; ?>"> <input type="hidden" name="idApp_OrcaTrata" value="<?php echo $orcatrata['idApp_OrcaTrata']; ?>"> <?php if ($metodo > 1) { ?> <!--<input type="hidden" name="idApp_Procedimento" value="<?php echo $procedimento['idApp_Procedimento']; ?>"> <input type="hidden" name="idApp_ParcelasRec" value="<?php echo $parcelasrec['idApp_ParcelasRec']; ?>">--> <?php } ?> <?php if ($metodo == 2) { ?> <!-- <div class="col-md-12 text-center"> <button class="btn btn-lg btn-danger" id="inputDb" data-loading-text="Aguarde..." name="submit" value="1" type="submit"> <span class="glyphicon glyphicon-trash"></span> Excluir </button> <button class="btn btn-lg btn-warning" id="inputDb" onClick="history.go(-1); return true;"> <span class="glyphicon glyphicon-ban-circle"></span> Cancelar </button> </div> <button type="button" class="btn btn-danger"> <span class="glyphicon glyphicon-trash"></span> Confirmar Exclusão </button> --> <div class="col-md-6"> <button class="btn btn-lg btn-primary" id="inputDb" data-loading-text="Aguarde..." type="submit"> <span class="glyphicon glyphicon-save"></span> Salvar </button> </div> <div class="col-md-6 text-right"> <button type="button" class="btn btn-lg btn-danger" data-toggle="modal" data-loading-text="Aguarde..." data-target=".bs-excluir-modal-sm"> <span class="glyphicon glyphicon-trash"></span> Excluir </button> </div> <div class="modal fade bs-excluir-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header bg-danger"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title">Tem certeza que deseja excluir?</h4> </div> <div class="modal-body"> <p>Ao confirmar esta operação todos os dados serão excluídos permanentemente do sistema. Esta operação é irreversível.</p> </div> <div class="modal-footer"> <div class="col-md-6 text-left"> <button type="button" class="btn btn-warning" data-dismiss="modal"> <span class="glyphicon glyphicon-ban-circle"></span> Cancelar </button> </div> <div class="col-md-6 text-right"> <a class="btn btn-danger" href="<?php echo base_url() . 'orcatrata/excluir/' . $orcatrata['idApp_OrcaTrata'] ?>" role="button"> <span class="glyphicon glyphicon-trash"></span> Confirmar Exclusão </a> </div> </div> </div> </div> </div> <?php } else { ?> <div class="col-md-6"> <button class="btn btn-lg btn-primary" id="inputDb" data-loading-text="Aguarde..." type="submit"> <span class="glyphicon glyphicon-save"></span> Salvar </button> </div> <?php } ?> </div> </div> </form> </div> </div> </div> </div> </div> </div> </div> <div class="col-md-1"></div> </div> </div>
ktracaengemark/sistema2
application/views/orcatrata/form_orcatrata.php
PHP
gpl-3.0
52,660
#!/usr/bin/perl =head1 Description This pipeline is to use kgf to fill gaps. kgf is a new gap filling program, based on PE reads and gap edge related reads. All the reads assembled by overlap method. This pipeline contains collecting gap related reads, reads filter, gap filling gap analysis, filling gaps and filling result analysis. To get gap related reads, there are two choise. You can use krs to map sequencing reads to raw scaffold sequences, or use SOAPdenovo reads mapping result. It is suggested to use the reads abtained from SOAPdenovo map step. =cut =head1 Contact and Version Contact: Assemble Development Team(ADT). Version: 1.19 =cut =head1 Usage perl krskgf.pl [options] basical argument : --scaf <str> set scaffold sequence. step 1 must. --lib <str> set library file. step 1 must. --contig <str> set contig sequence. step 2. --gapread <str> set gap reads. step 2. --outdir <str> set the output directory , no default --match <float> set the match ratio of reads to contig , default=0.98 --step <int> set steps. 1: get reads using krs. 2: contig gap filling 3: fill result analysis. default=123. --kmer <int> set the kmer-size when krs map . --thread <int> set thread number for kgf gap filling, default =8. --cpu <int> set scaffolds cut number for kgf gapfilling step, default=4. qsub argument : --P <str> set the qsub -P , must be set if qsub the work script , No default(user can custom by modifying the variant $P ) . --queue <str> set the qsub queue , no default . --vf <str> set vf for kgf.sh. --noqsub <...> set when user need to run the scripts local ,default qsub . no frequent set argument: --maxreadlen <int> set the longest read length for kgf , default 100. --contiglen <int> set contig length cutoff, when contig length is less than it, the contig will be masked into gap region , default 70. --debug <...> set for advantage debug , output more information , default No-debug. --verbose output verbose information to screen --help output help information to screen =cut =head1 Description: this pipeline is divided into 3 steps , user will see directory "step_1/step_2/step_3" for each steps , each step directory contains the files generated by this step . follow lists the file of each step : step_1: map.sh map.log gapread.fa gapread.fa.ER.lst gapread.fa.gapread.depth gapread.fa.stat step_2: F*/ kgf.sh *.fill *.fill.scaftig *.CONTIG N50.txt gapSeq.fa step_3: canfill.stat canfullfill.lst cover.lst blank.lst ER.lst TR.lst see the manaul for more information . =cut =head1 examples perl krskgf.pl --scaf /path/*.scafSeq --lib /path/*.cfg(lib) --outdir /path/dir_to_output_result --kmer kmer_size --thread thread_num --cpu file_cuted_num --P Project_Name --queue qsub_queue --step 1/12/123 >fill.log perl krskgf.pl --contig /path/*.SCAF.contig --gapread /path/gapread.fa --outdir /path/dir_to_output_result --thread thread_num --cpu file_cuted_num --P Project_Name --queue qsub_queue --step 2 >fill.log perl krskgf.pl --outdir /path/dir_to_output_result --step 3 >fill.log (note: this step depends to step_1 and step_2 , please ensure current directory can find them!) =cut use strict; use Getopt::Long; use File::Basename; use Data::Dumper; use FindBin qw($Bin); my ($path,$krs,$kgf2) = ("$Bin/stat2","$Bin/krs","$Bin/kgf1.19"); my ($scaffold_file,$lib_file,$contig_file,$gapread_file,$dir,$prefix,$debug,$noqsub,$kmer,$readlength , $queue); my ($cpu,$step, $Help, $Outdir, $Verbose, $thread, $startid,$scafnum, $kvf, $len, $vf, $longread, $kmer, $contigcutoff , $P , $match_ratio); GetOptions( "scaf:s"=>\$scaffold_file, "lib:s"=>\$lib_file, "dir:s"=>\$dir, "prefix:s"=>\$prefix, "contig:s"=>\$contig_file, "gapread:s"=>\$gapread_file, "maxreadlen:i"=>\$readlength , "contiglen:i"=>\$contigcutoff, "cpu:i"=>\$cpu, "match:f"=>\$match_ratio , "queue:s"=>\$queue , "kmer:i"=>\$kmer, "vf:s"=>\$kvf, "P:s"=>\$P, "step:i"=>\$step, "thread:i"=>\$thread, "lrs:i"=>\$longread, "outdir:s"=>\$Outdir, "debug!"=>\$debug, "noqsub!"=>\$noqsub, "verbose"=>\$Verbose, "help"=>\$Help ); #$Outdir ||= "."; #12-4-24 $cpu ||= 4; $step ||=123; $thread ||=4; $startid ||=0; $kvf ||="0G"; $scafnum ||=0; $match_ratio ||=0.98 ; $longread ||=0; $kmer ||=31; $readlength ||= 100 ; $contigcutoff ||= 100 - 31; #$IsGz ||= 0 ; my ($scaf,$scafSeq,$reads,$PEreads,$Rlongread,$totalread,$scafcontig); die `pod2text $0` if ($Help); die `pod2text $0` unless (-d $Outdir) ; #sub abs_path ############# #2011-5-26 #sub abs_path #{ # chomp(my $tem_dir = `pwd`); # foreach(@_){ # $_ || next ; # /^\// && next ; # $_ =~ s/^\.//g if(/^\./) ; # $_ = "$tem_dir/$_"; # s/\/+$//g; # } #} sub abs_path { chomp(my $tem_dir = `pwd`) ; foreach(@_) { $_ || next ; /^\// && next ; my ($f,$d,$s) = fileparse($_); $d =~ s/\/$// ; $_ = "$tem_dir/$d/$f"; $_ =~ s/\/+$//g ; } } ############# abs_path($Outdir,$lib_file,$scaffold_file,$contig_file,$gapread_file); mkdir $Outdir unless (-d $Outdir); my $size=0; print "Starting kgf gap filling , with step: $step\n"; #sub get_mem ############ #2011-5-26 sub get_mem { chomp(my $user = `whoami`); chomp(my @Qlst = `qstat -g c -U $user | awk '{x++}(x>2){print \$1}'`); foreach(@Qlst){ /mem\.q/ && return(" --queue $_"); } 0; } ########### #my $able_mem = get_mem(); if($scaffold_file) { my @names=split (/\//,$scaffold_file); my $name = $names[@names -1]; my $file = "$Outdir/$name"; if(-e $file) { $scaffold_file = $file; }else{ print "link scafSeq to outdir!\n"; `ln -s $scaffold_file $Outdir/$name`; $scaffold_file = $file; } } my $doc_step1 = "step_1"; my $doc_step2 = "step_2"; my $doc_step3 = "step_3"; if($step =~ /1/){ unless(-d "$Outdir/$doc_step1") { `mkdir $Outdir/$doc_step1` ;} print "Step one: get reads using krs!\n"; die `pod2text $0` if(!$scaffold_file || !$lib_file); my $line= `perl $path/splitscaf.pl $scaffold_file `; $scafcontig = "$scaffold_file.SCAF.contig" ; `perl $path/get_scafcontig.pl $scaffold_file.SCAF >$scafcontig` ; `rm $scaffold_file.SCAF` ; ($scafnum,$len) = split /\t/,$line; $vf = int(int($len *4 /3 *24)/1000000000) + 1; my $break=0; if($vf > 20) {$break =1;} $vf=$vf."G"; print "vf: $vf\n"; $size = int($len*4/3) + 1; open WR,">$Outdir/$doc_step1/map.sh"; print WR "$krs -c $scafcontig -l $lib_file -M $match_ratio -k $kmer -o $Outdir/$doc_step1/gapread.fa -m $size -t $thread -r $readlength -L $contigcutoff 2>$Outdir/$doc_step1/map.log\n"; if($noqsub){ `sh $Outdir/$doc_step1/map.sh`; }else{ `nohup $path/qsub-sge.pl --resource="vf=$vf -P $P -q $queue" --maxjob 1 --jobprefix map --convert no $Outdir/$doc_step1/map.sh`; } close WR; $contig_file="$scaffold_file.SCAF.contig"; $gapread_file="$Outdir/$doc_step1/gapread.fa"; `perl $path/readstat2.pl $gapread_file >$Outdir/$doc_step1/gapread.fa.stat`; print "Step one finished!\n"; } if($step=~/2/ && $cpu > 1) { unless (-d "$Outdir/$doc_step2"){`mkdir $Outdir/$doc_step2`;} my $nowname ; print "Cut the files and kgf gap filling!"; if(!$contig_file) { $scaffold_file =~ s/\.SCAF$//g; $contig_file = "$scaffold_file.SCAF.contig"; $nowname = basename($contig_file); $nowname =~ s/\.SCAF\.contig//g; `mv $contig_file $Outdir/$doc_step2` ; $contig_file = "$Outdir/$doc_step2/$nowname" ; unless (-e $contig_file) { print "please make sure the progrom can find the file $scaffold_file.SCAF.contig in this work directory!\n"; } }else{ $scaffold_file =$contig_file; $nowname = basename($contig_file) ; $nowname =~ s/\.SCAF\.contig//g; $scaffold_file =~ s/\.SCAF\.contig//g; } #$gapread_file="$Outdir/gapread.fa" if(!$gapread_file); $gapread_file="$Outdir/$doc_step1/gapread.fa" if(!$gapread_file); if(-e $gapread_file && -e $contig_file) { print "Load gap file: $gapread_file.\nLoad contig file: $contig_file.\n"; }else{ print "Please input or check $gapread_file or $contig_file!\n"; } `perl $path/Cut2.pl $gapread_file $contig_file $cpu $Outdir/$doc_step2`; `perl $path/Creatkgf.pl $kgf2 $Outdir/$doc_step2 $cpu $thread >$Outdir/$doc_step2/kgf.sh`; if($kvf eq '0G') { $kvf=$thread*2 + int($len/1000000000/$cpu); $kvf=$kvf."G"; } print "kvf: $kvf\n"; if($noqsub){ `sh $Outdir/$doc_step2/kgf.sh`; }else{ `nohup $path/qsub-sge.pl --resource="vf=$kvf -P $P -q $queue" --maxjob $cpu --jobprefix map --convert no $Outdir/$doc_step2/kgf.sh`; #6-22 } `mv $scaffold_file.CONTIG $Outdir/$doc_step2/` ; my $scaffname = $nowname ; `cat $Outdir/$doc_step2/F*/FilledScaf/seq.thread* $Outdir/$doc_step2/$scaffname.CONTIG >$Outdir/$doc_step2/$scaffname.fill`; my $seq = "$Outdir/$doc_step2/gapSeq.fa"; `cat $Outdir/$doc_step2/F*/gapSeq.fa > $seq`; `perl $path/get_scaftig.pl $Outdir/$doc_step2/$scaffname.fill >$Outdir/$doc_step2/$scaffname.fill.scaftig`; `perl $path/seq_n50 $Outdir/$doc_step2/$scaffname.fill.scaftig >$Outdir/$doc_step2/N50.txt`; my $fill = `perl $path/gapfillratio2.pl $Outdir/$doc_step2 $cpu`; if($fill=~ /Error/) { print "\n\n$fill\n\n"; exit(1); } print $fill; print "Gap filling finished! \n"; }else{ print STDERR "set --cpu larger than 1 , or kgf will cost more memory and time !\n" ; } if($step =~ /3/) { unless(-d "$Outdir/$doc_step3") {`mkdir $Outdir/$doc_step3`;} print "Step Three: analysis the fill result!\n"; my $depth ; $gapread_file = "$Outdir/$doc_step1/gapread.fa"; $depth = "$Outdir/$doc_step1/gapread.fa.gapread.depth"; unless(-e $depth){ `perl $path/readstat2.pl $gapread_file >$Outdir/$doc_step3/gapread.fa.stat`; } my $seq = "$Outdir/$doc_step2/gapSeq.fa"; my $Log = "$Outdir/$doc_step3/fill.Log" ; `cat $Outdir/$doc_step2/F*/Log/log.thread* >$Log` ; if(!$depth || !$seq || !$Log) { print "please check file: $depth and $seq \n"; exit(1); } `grep 'TRGAP' $Log >$Outdir/$doc_step3/TR.lst`; `grep 'ERGAP' $Log >$Outdir/$doc_step3/ER.lst`; `rm $Log` ; `perl $path/blank.pl $depth $seq >$Outdir/$doc_step3/blank.lst`; `perl $path/covercheck.pl $Outdir/$doc_step3/blank.lst >$Outdir/$doc_step3/cover.lst`; #`more $Outdir/cover.lst |awk '$3 < 1 {print $_}' >$Outdir/uncover.lst`; `perl $path/gether.pl $Outdir/$doc_step3/cover.lst $Outdir/$doc_step3/TR.lst $depth $Outdir/$doc_step3/ER.lst >$Outdir/$doc_step3/canfill.stat`; `mv $Outdir/canfullfill.lst $Outdir/$doc_step3` ; print "Fill analysis finished! Please read file: canfill.stat \n"; } print "All Pipeline finished!";
gigascience/paper-zhang2014
Genome_assembly/GapCloser/krskgf/krskgf.pl
Perl
gpl-3.0
10,558
package com.chandilsachin.diettracker.io; import android.content.res.AssetManager; import android.util.Log; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.StringWriter; import java.io.Writer; public class JSONReader { /** * <h1>public JSONObject readExternalJsonFileToObject(String filePath)</h1> * <p>Returns JSON object reading file at a given path.</p> * * @param filePath - path of JSON file on SD card. * @throws IOException * @throws JSONException */ public static JSONObject readExternalJsonFileToObject(String filePath) throws IOException, JSONException { String jsonStr = convertStreamToString(new FileInputStream(filePath)); JSONObject json = new JSONObject(jsonStr); return json; } /** * <h1>public JSONArray readExternalJsonFileToArray(String filePath)</h1> * <p>Returns JSON object reading file at a given path.</p> * * @param filePath - path of JSON file on SD card. * @throws IOException * @throws JSONException */ public static JSONArray readExternalJsonFileToArray(String filePath) throws IOException, JSONException { String jsonStr = convertStreamToString(new FileInputStream(filePath)); JSONArray json = new JSONArray(jsonStr); return json; } /** * <h1>public JSONObject readInternalJsonFileToObject(String filePath)</h1> * <p>Returns JSON object reading file at a given path.</p> * * @param filePath - path of JSON file on Internal Storage. * @throws IOException * @throws JSONException */ public static JSONObject readInternalJsonFileToObject(String filePath) throws IOException, JSONException { String jsonStr = convertStreamToString(new FileInputStream(filePath)); JSONObject json = new JSONObject(jsonStr); return json; } /** * <h1>public JSONArray readInternalJsonFileToArray(String filePath)</h1> * <p>Returns JSON object reading file at a given path.</p> * * @param filePath - path of JSON file on Internal Storage. * @throws IOException * @throws JSONException */ public static JSONArray readInternalJsonFileToArray(String filePath) throws IOException, JSONException { String jsonStr = convertStreamToString(new FileInputStream(filePath)); JSONArray json = new JSONArray(jsonStr); return json; } /** * <h1>public JSONObject readJsonFileToObject(String filePath)</h1> * <p>Returns JSON object reading file at a given path.</p> * * @param filePath - path of JSON file. * @throws IOException * @throws JSONException */ public static JSONObject readJsonFileToObject(String filePath) throws IOException, JSONException { JSONObject json = null; try { String jsonStr = convertStreamToString(new FileInputStream(filePath)); json = new JSONObject(jsonStr); }catch (FileNotFoundException e) { e.printStackTrace(); } return json; } /** * <h1>public JSONObject readJsonFileToObject(String filePath)</h1> * <p>Returns JSON object reading file at a given path.</p> * * @param filePath - path of JSON file. * @throws IOException * @throws JSONException */ public static JSONObject readJsonFileToObjectFromAssets(AssetManager assetsManager, String filePath) throws IOException, JSONException { JSONObject json = null; try { String jsonStr = convertStreamToString(assetsManager.open(filePath)); json = new JSONObject(jsonStr); }catch (FileNotFoundException e) { e.printStackTrace(); } return json; } public static JSONArray readJsonFileToArrayFromAssets(AssetManager assetsManager, String filePath) throws IOException, JSONException { JSONArray json = null; try { String jsonStr = convertStreamToString(assetsManager.open(filePath)); json = new JSONArray(jsonStr); }catch (FileNotFoundException e) { e.printStackTrace(); } return json; } /** * <h1>public JSONObject readJsonFileToObject(File file)</h1> * <p>Returns JSON object reading file at a given path.</p> * * @param file - path of JSON file. * @throws IOException * @throws JSONException */ public static JSONObject readJsonFileToObject(File file) throws IOException, JSONException { String jsonStr = convertStreamToString(new FileInputStream(file)); JSONObject json = new JSONObject(jsonStr); return json; } /** * <h1>public JSONObject readJsonStreamToObject(InputStream stream)</h1> * <p>Returns JSON Object from given stream.</p> * * @param stream * @throws IOException * @throws JSONException */ public static JSONObject readJsonStreamToObject(InputStream stream) throws IOException, JSONException { String jsonStr = convertStreamToString(stream); JSONObject json = new JSONObject(jsonStr); return json; } /** * <h1>public JSONArray readJsonStreamToArray(InputStream stream)</h1> * <p>Returns JSON array from given stream.</p> * * @param stream * @throws IOException * @throws JSONException */ public static JSONArray readJsonStreamToArray(InputStream stream) throws IOException, JSONException { String jsonStr = convertStreamToString(stream); JSONArray json = new JSONArray(jsonStr); return json; } /** * <h1>public JSONArray readJsonFileToArray(String filePath)</h1> * <p>Returns JSON object reading file at a given path.</p> * * @param filePath - path of JSON file. * @throws IOException * @throws JSONException */ public static JSONArray readJsonFileToArray(String filePath) throws IOException, JSONException { if (new File(filePath).exists()) { String jsonStr = convertStreamToString(new FileInputStream(filePath)); JSONArray json = new JSONArray(jsonStr); return json; } return null; } /** * <h1>public JSONArray readJsonFileToArray(File file)</h1> * <p>Returns JSON object reading file at a given path.</p> * * @param file - path of JSON file. * @throws IOException * @throws JSONException */ public static JSONArray readJsonFileToArray(File file) throws IOException, JSONException { String jsonStr = convertStreamToString(new FileInputStream(file)); JSONArray json = new JSONArray(jsonStr); return json; } /** * <h1>private String convertStreamToString(InputStream is)</h1> * <p>Converts input inputStream to String.</p> * * @param is - InputStream containing data. * @return String containing converted text. * @throws IOException */ public static String convertStreamToString(InputStream is) throws IOException { if (is != null) { Writer writer = new StringWriter(); char[] buffer = new char[1024]; try { Reader reader = new BufferedReader(new InputStreamReader(is, "UTF-8")); int n; while ((n = reader.read(buffer)) != -1) { writer.write(buffer, 0, n); } } finally { is.close(); } return writer.toString(); } else { return ""; } } /** * path to the json file on SDCard * * @return jsonString. */ public String getJsonString(File file) { String jsonString2 = null; try { BufferedReader reader = new BufferedReader(new FileReader(file), 8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } jsonString2 = sb.toString(); reader.close(); } catch (Exception e) { Log.e("Buffer Error", "Error converting result " + e.toString()); } return jsonString2; } }
chandilsachin/DietTracker
app/src/main/java/com/chandilsachin/diettracker/io/JSONReader.java
Java
gpl-3.0
9,078
package org.asamk.signal.manager.api; public class StickerPackInvalidException extends Exception { public StickerPackInvalidException(String message) { super(message); } }
AsamK/signal-cli
lib/src/main/java/org/asamk/signal/manager/api/StickerPackInvalidException.java
Java
gpl-3.0
190
<!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.18"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>Sequoia: sequoia::maths::graph_impl::edge_init_type_generator&lt; Edge, graph_flavour::directed, edge_flavour::partial &gt; Struct Template Reference</title> <link href="../../tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="../../jquery.js"></script> <script type="text/javascript" src="../../dynsections.js"></script> <link href="../../search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="../../search/searchdata.js"></script> <script type="text/javascript" src="../../search/search.js"></script> <link href="../../doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">Sequoia </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.18 --> <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> <!-- 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 id="nav-path" class="navpath"> <ul> <li class="navelem"><b>sequoia</b></li><li class="navelem"><b>maths</b></li><li class="navelem"><b>graph_impl</b></li><li class="navelem"><a class="el" href="../../d6/dd7/structsequoia_1_1maths_1_1graph__impl_1_1edge__init__type__generator_3_01Edge_00_01graph__flavou7f6f94d18bc9e3c3baf07b80d940b4cc.html">edge_init_type_generator&lt; Edge, graph_flavour::directed, edge_flavour::partial &gt;</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#pub-types">Public Types</a> &#124; <a href="#pub-static-attribs">Static Public Attributes</a> &#124; <a href="../../de/da0/structsequoia_1_1maths_1_1graph__impl_1_1edge__init__type__generator_3_01Edge_00_01graph__flavou638c6b2cc6eb1d06a9a49883c2ca5b34.html">List of all members</a> </div> <div class="headertitle"> <div class="title">sequoia::maths::graph_impl::edge_init_type_generator&lt; Edge, graph_flavour::directed, edge_flavour::partial &gt; Struct Template Reference</div> </div> </div><!--header--> <div class="contents"> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a> Public Types</h2></td></tr> <tr class="memitem:a9a855eeda4dfbb73b5aa0953a5114007"><td class="memItemLeft" align="right" valign="top"><a id="a9a855eeda4dfbb73b5aa0953a5114007"></a> using&#160;</td><td class="memItemRight" valign="bottom"><b>weight_type</b> = typename Edge::weight_type</td></tr> <tr class="separator:a9a855eeda4dfbb73b5aa0953a5114007"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:affdcee177eb49195d766ae4fb3462952"><td class="memItemLeft" align="right" valign="top"><a id="affdcee177eb49195d766ae4fb3462952"></a> using&#160;</td><td class="memItemRight" valign="bottom"><b>edge_init_type</b> = <a class="el" href="../../da/d14/classsequoia_1_1maths_1_1partial__edge.html">partial_edge</a>&lt; weight_type, <a class="el" href="../../de/d10/structsequoia_1_1maths_1_1graph__impl_1_1sharing__v__to__type.html">sharing_v_to_type</a>&lt; false &gt;::template policy, <a class="el" href="../../da/def/classsequoia_1_1utilities_1_1protective__wrapper.html">utilities::protective_wrapper</a>&lt; weight_type &gt;, typename Edge::index_type &gt;</td></tr> <tr class="separator:affdcee177eb49195d766ae4fb3462952"><td class="memSeparator" colspan="2">&#160;</td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-attribs"></a> Static Public Attributes</h2></td></tr> <tr class="memitem:a39f9bf037daffad90438b66b381aed71"><td class="memItemLeft" align="right" valign="top"><a id="a39f9bf037daffad90438b66b381aed71"></a> constexpr static bool&#160;</td><td class="memItemRight" valign="bottom"><b>complementary_data_v</b> {false}</td></tr> <tr class="separator:a39f9bf037daffad90438b66b381aed71"><td class="memSeparator" colspan="2">&#160;</td></tr> </table> <hr/>The documentation for this struct was generated from the following file:<ul> <li>/Users/Claire/Dropbox/Sequoia/Source/Maths/Graph/<a class="el" href="../../d3/d76/GraphDetails_8hpp_source.html">GraphDetails.hpp</a></li> </ul> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="../../doxygen.png" alt="doxygen"/> </a> 1.8.18 </small></address> </body> </html>
ojrosten/sequoia
docs/html/d6/dd7/structsequoia_1_1maths_1_1graph__impl_1_1edge__init__type__generator_3_01Edge_00_01graph__flavou7f6f94d18bc9e3c3baf07b80d940b4cc.html
HTML
gpl-3.0
6,035
// -------------------------------------------------------------------------------------------------------------------- // <copyright company="MirGames" file="TopicCreatedEvent.cs"> // Copyright 2014 Bulat Aykaev // This file is part of MirGames. // MirGames 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. // MirGames 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 MirGames. If not, see http://www.gnu.org/licenses/. // </copyright> // -------------------------------------------------------------------------------------------------------------------- namespace MirGames.Domain.Topics.Events { using MirGames.Infrastructure.Events; /// <summary> /// The topic created event. /// </summary> public class TopicCreatedEvent : Event { /// <summary> /// Gets or sets the topic unique identifier. /// </summary> public int TopicId { get; set; } /// <summary> /// Gets or sets the blog identifier. /// </summary> public int? BlogId { get; set; } /// <summary> /// Gets or sets the topic title. /// </summary> public string Title { get; set; } /// <summary> /// Gets or sets the tags. /// </summary> public string Tags { get; set; } /// <summary> /// Gets or sets the author unique identifier. /// </summary> public int AuthorId { get; set; } /// <summary> /// Gets or sets the text. /// </summary> public string Text { get; set; } /// <inheritdoc /> protected override string EventType { get { return "Topics.TopicCreated"; } } } }
mefcorvi/mirgames
MirGames.Domain.Topics.Public/Events/TopicCreatedEvent.cs
C#
gpl-3.0
2,130
/* Copyright (C) 2012-2014 de4dot@gmail.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ using System; namespace dnlib.DotNet.MD { /// <summary> /// See COMIMAGE_FLAGS_XXX in CorHdr.h in the Windows SDK /// </summary> [Flags] public enum ComImageFlags : uint { /// <summary> /// See COMIMAGE_FLAGS_ILONLY in the Windows SDK /// </summary> ILOnly = 1, /// <summary> /// See COMIMAGE_FLAGS_32BITREQUIRED in the Windows SDK /// </summary> _32BitRequired = 2, /// <summary> /// Set if a native header exists (COMIMAGE_FLAGS_IL_LIBRARY) /// </summary> ILLibrary = 4, /// <summary> /// See COMIMAGE_FLAGS_STRONGNAMESIGNED in the Windows SDK /// </summary> StrongNameSigned = 8, /// <summary> /// See COMIMAGE_FLAGS_NATIVE_ENTRYPOINT in the Windows SDK /// </summary> NativeEntryPoint = 0x10, /// <summary> /// See COMIMAGE_FLAGS_TRACKDEBUGDATA in the Windows SDK /// </summary> TrackDebugData = 0x10000, /// <summary> /// See COMIMAGE_FLAGS_32BITPREFERRED in the Windows SDK /// </summary> _32BitPreferred = 0x20000, } }
telerik/justdecompile-plugins
De4dot.JustDecompile/De4dot/sources/dnlib/src/DotNet/MD/ComImageFlags.cs
C#
gpl-3.0
2,138
/* File: draaugmentrequest.c Project: dragonfly Author: Douwe Vos Date: Dec 27, 2016 e-mail: dmvos2000(at)yahoo.com Copyright (C) 2016 Douwe Vos. 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/>. */ #include "draaugmentrequest.h" #include <logging/catlogdefs.h> #define CAT_LOG_LEVEL CAT_LOG_WARN #define CAT_LOG_CLAZZ "DraAugmentRequest" #include <logging/catlog.h> struct _DraAugmentRequestPrivate { ChaDocument *document; ChaRevisionWo *a_revision; CatStringWo *slot_key; DraSpellHelper *spell_helper; }; static void l_stringable_iface_init(CatIStringableInterface *iface); G_DEFINE_TYPE_WITH_CODE(DraAugmentRequest, dra_augment_request, WOR_TYPE_REQUEST, G_ADD_PRIVATE(DraAugmentRequest) G_IMPLEMENT_INTERFACE(CAT_TYPE_ISTRINGABLE, l_stringable_iface_init) ); static void l_dispose(GObject *object); static void l_finalize(GObject *object); static void l_run_request(WorRequest *request); static void dra_augment_request_class_init(DraAugmentRequestClass *clazz) { GObjectClass *object_class = G_OBJECT_CLASS(clazz); object_class->dispose = l_dispose; object_class->finalize = l_finalize; WorRequestClass *wor_class = WOR_REQUEST_CLASS(clazz); wor_class->runRequest = l_run_request; } static void dra_augment_request_init(DraAugmentRequest *instance) { } static void l_dispose(GObject *object) { cat_log_detail("dispose:%p", object); DraAugmentRequest *instance = DRA_AUGMENT_REQUEST(object); DraAugmentRequestPrivate *priv = dra_augment_request_get_instance_private(instance); cat_unref_ptr(priv->a_revision); cat_unref_ptr(priv->document); cat_unref_ptr(priv->slot_key); cat_unref_ptr(priv->spell_helper); G_OBJECT_CLASS(dra_augment_request_parent_class)->dispose(object); cat_log_detail("disposed:%p", object); } static void l_finalize(GObject *object) { cat_log_detail("finalize:%p", object); cat_ref_denounce(object); G_OBJECT_CLASS(dra_augment_request_parent_class)->finalize(object); cat_log_detail("finalized:%p", object); } void dra_augment_request_construct(DraAugmentRequest *request, ChaDocument *document, ChaRevisionWo *a_revision, CatStringWo *slot_key) { DraAugmentRequestPrivate *priv = dra_augment_request_get_instance_private(request); priv->document = cat_ref_ptr(document); priv->a_revision = cat_ref_ptr(a_revision); priv->slot_key = cat_ref_ptr(slot_key); priv->spell_helper = NULL; wor_request_construct((WorRequest *) request); wor_request_set_time_out((WorRequest *) request, cat_date_current_time()+120); } CatStringWo *dra_augment_request_get_slot_key(DraAugmentRequest *request) { DraAugmentRequestPrivate *priv = dra_augment_request_get_instance_private(request); return priv->slot_key; } void dra_augment_request_set_spell_helper(DraAugmentRequest *request, DraSpellHelper *spell_helper) { DraAugmentRequestPrivate *priv = dra_augment_request_get_instance_private(request); cat_ref_swap(priv->spell_helper, spell_helper); } DraSpellHelper *dra_augment_request_get_spell_helper(DraAugmentRequest *request) { DraAugmentRequestPrivate *priv = dra_augment_request_get_instance_private(request); return priv->spell_helper; } static gboolean l_idle_cb(DraAugmentRequest *request) { DraAugmentRequestPrivate *priv = dra_augment_request_get_instance_private(request); cha_document_post_enrichment_slot_notify(priv->document, priv->a_revision, (GObject *) priv->slot_key, NULL); cat_unref_ptr(request); return FALSE; } static void l_run_request(WorRequest *request) { DraAugmentRequest *augment_request = DRA_AUGMENT_REQUEST(request); DraAugmentRequestPrivate *priv = dra_augment_request_get_instance_private(augment_request); ChaRevisionWo *cur_revision = cha_document_get_current_revision_ref(priv->document); int cur_pl_version = cha_revision_wo_get_page_list_version(cur_revision); cat_unref_ptr(cur_revision); int rev_pl_version = cha_revision_wo_get_page_list_version(priv->a_revision); if (rev_pl_version<cur_pl_version) { return; } int slot_key_index = cha_revision_wo_get_slot_index(priv->a_revision, (GObject *) priv->slot_key, -1); if (slot_key_index<0) { return; } augment_request->slot_index = slot_key_index; DraKeywordPrinter *keyword_printer = dra_keyword_printer_new(priv->a_revision, priv->slot_key, slot_key_index); DraKeywordPrinter *line_tag_printer = dra_keyword_printer_new(priv->a_revision, priv->slot_key, slot_key_index); DraAugmentRequestClass *aug_class = DRA_AUGMENT_REQUEST_GET_CLASS(request); gboolean do_notify = aug_class->runAugment((DraAugmentRequest *) request, priv->a_revision, keyword_printer, line_tag_printer); dra_keyword_printer_flush_line_tags(line_tag_printer); dra_keyword_printer_flush(keyword_printer); cat_unref_ptr(line_tag_printer); cat_unref_ptr(keyword_printer); if (do_notify) { cat_ref_ptr(request); g_idle_add((GSourceFunc) l_idle_cb, request); } } /********************* start CatIStringable implementation *********************/ static void l_stringable_print(CatIStringable *self, struct _CatStringWo *append_to) { const char *iname = g_type_name_from_instance((GTypeInstance *) self); cat_string_wo_format(append_to, "%s[%p]", iname, self); } static void l_stringable_iface_init(CatIStringableInterface *iface) { iface->print = l_stringable_print; } /********************* end CatIStringable implementation *********************/
douwevos/natpad
dragonfly/src/document/draaugmentrequest.c
C
gpl-3.0
5,958
package org.matheclipse.io.system; public class ProductTest extends AbstractTestCase { public ProductTest(String name) { super(name); } public void testProduct001() { // Config.MAX_BIT_LENGTH = Integer.MAX_VALUE; // check("AbsoluteTiming(Product(i,{i,1,10^6});)", // // ""); // message Product: Argument {} at position 2 does not have the correct form for an iterator. check("Product(-3/2,\"\",{-1/2,-2,3},-1+I,{0,0,0,0})", // "Product(-3/2,,{-1/2,-2,3},-1+I,{0,0,0,0})"); check("Product(i^2,x)", // "(i^2)^(-1+x)"); check("Product(i^2,Indeterminate)", // "Product(i^2,Indeterminate)"); check("Product(f(x), {k,n, n-1})", // "1"); check("Product(f(x), {k,3, 1/2})", // "1"); // prints RecursionLimitExeceeded check("Product(f(x), {x, x, x+1})", // "Product(f(x),{x,x,x+1})"); check("Product(f(x), {x, x, x})", // "f(x)"); check("Product(f(x), {x, a, a+1})", // "f(a)*f(1+a)"); } public void testProduct002() { check("Product(k^3, {k, 1, n})", // "(n!)^3"); } public void testProduct003() { check("Product(0, {k, a, Infinity})", // "0"); check("Product(1, {k, a, Infinity})", // "1"); check("Product(42, {k, a, Infinity})", // "Infinity"); // {k,a,n} assumes a<=k<=n check("Product(2, {k, a, n})", // "2^(1-a+n)"); } public void testProduct004() { // {k,1,n} assumes 1<=k<=n check("Product(k^3, {k, 1, n})", // "(n!)^3"); check("Product(i^2, {i,11,2})", // "1"); check("Product(i^2, {i,11,2,-1})", // "1593350922240000"); check("Product(i^2, {i,2,11})", // "1593350922240000"); check("Product(i^2, {i,m,n})", // "Pochhammer(m,1-m+n)^2"); check("Product(i^2, {i,k,k+j})", // "Pochhammer(k,1+j)^2"); check("Product(a, {a, 1, 5})", // "120"); check("Product(f(a), {a, 1, 5})", // "f(1)*f(2)*f(3)*f(4)*f(5)"); check("Product(a^2, {a, 4})", // "576"); check("Product(a + b, {a, 1, 2}, {b, 1, 3})", // "1440"); } public void testProduct005() { check("Product(k, {k, 1, 10})", // "3628800"); check("10!", // "3628800"); check("Product(x^k, {k, 2, 20, 2})", // "x^110"); check("Product(2 ^ i, {i, 1, n})", // "2^(1/2*n*(1+n))"); check("Product(k, {k, 3, n})", // "n!/2"); check("Product(k, {k, 10, n})", // "n!/362880"); check("primorial(0) = 1", // "1"); check("primorial(n_Integer) := Product(Prime(k), {k, 1, n})", // ""); check("primorial(12)", // "7420738134810"); } public void testProduct006() { check("Product(i^2 - i + 10 ,{i,1,10})", // "1426481971200000"); check("Product(a^i, {i, n})", // "a^(1/2*n*(1+n))"); check("Product(c, {j, 2}, {i, 1, j})", // "c^3"); check("Product(c, {i, 1, j}, {j, 2})", // "c^(2*j)"); check("Product(c, {i, 1, j}, {j, 1, 2})", // "c^(2*j)"); check("Product(c, {i, 1, n})", // "c^n"); check("Product(c+n, {i, 1, n})", // "(c+n)^n"); check("Product(c+n, {i, 0, n})", // "(c+n)^(1+n)"); check("n!", // "n!"); check("$prod(x_,{x_,1,m_}) := m!; $prod(i0, {i0, 1, n0})", // "n0!"); check("Product(i0, {i0, 1, n0})", // "n0!"); check("Product(i^2, {i, 1, n})", // "(n!)^2"); check("Product(i0^2, {i0, 0, n0})", // "0"); check("Product(4*i0^2, {i0, 0, n0})", // "0"); check("Product(i0^3, {i0, 1, n0})", // "(n0!)^3"); check("Product(i0^3+p^2, {i0, 1, n0})", // "Product(i0^3+p^2,{i0,1,n0})"); check("Product(p, {i0, 1, n0})", // "p^n0"); check("Product(p+q, {i0, 1, n0})", // "(p+q)^n0"); check("Product(p, {i0, 0, n0})", // "p^(1+n0)"); check("Product(4, {i0, 0, n0})", // "4^(1+n0)"); } public void testProduct007() { check("Product(c, {i, 1, n}, {j, 1, n})", // "(c^n)^n"); check("Product(c, {j, 1, n}, {i, 1, j})", // "c^(1/2*n*(1+n))"); check("Product(f(i, j), {i, 1, 3}, {j, 1, 3})", // "f(1,1)*f(1,2)*f(1,3)*f(2,1)*f(2,2)*f(2,3)*f(3,1)*f(3,2)*f(3,3)"); check("Product(f(i, j), {i, 1, 3, 2}, {j, 1, 3, 1/2})", // "f(1,1)*f(1,3/2)*f(1,2)*f(1,5/2)*f(1,3)*f(3,1)*f(3,3/2)*f(3,2)*f(3,5/2)*f(3,3)"); // check("Product(2^(j + i0), {i0, 1, p}, {j, 1, i0})", ""); } public void testProduct008() { check("Product(x,{x,10})", // "3628800"); check("Product(x,{x,0,1})", // "0"); check("Product(x,{x,0,10,2})", // "0"); check("Product(x,{x,1,1})", // "1"); check("Product(x,{x,1,5})", // "120"); check("Product(x,{x,3,2,-1})", // "6"); check("Product(x,{x,10,3,-4})", // "60"); // use default value "1" for iterator with invalid range check("Product(x,{x,1,0})", // "1"); check("Product(x,{x,2,3,-1})", // "1"); } public void testProduct009() { check("Product(x,{x,0,-1,2})", // "1"); } public void testProduct010() { check("Product(x,{a,10,z})", // "x^(-9+z)"); check("Product(x,{a,b,c})", // "x^(1-b+c)"); } public void testProduct011() { check("Product(i^(x),{i,1,n})", // "(n!)^x"); } }
axkr/symja_android_library
symja_android_library/matheclipse-io/src/test/java/org/matheclipse/io/system/ProductTest.java
Java
gpl-3.0
5,446
/* Copyright (c) 2007-2011 iMatix Corporation Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file This file is part of 0MQ. 0MQ is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. 0MQ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef __ZMQ_ROUTER_HPP_INCLUDED__ #define __ZMQ_ROUTER_HPP_INCLUDED__ #include <map> #include <vector> #include "socket_base.hpp" #include "blob.hpp" #include "msg.hpp" namespace zmq { // TODO: This class uses O(n) scheduling. Rewrite it to use O(1) algorithm. class router_t : public socket_base_t { public: router_t (class ctx_t *parent_, uint32_t tid_); ~router_t (); // Overloads of functions from socket_base_t. void xattach_pipe (class pipe_t *pipe_, const blob_t &peer_identity_); int xsend (class msg_t *msg_, int flags_); int xrecv (class msg_t *msg_, int flags_); bool xhas_in (); bool xhas_out (); void xread_activated (class pipe_t *pipe_); void xwrite_activated (class pipe_t *pipe_); void xterminated (class pipe_t *pipe_); protected: // Rollback any message parts that were sent but not yet flushed. int rollback (); private: struct inpipe_t { class pipe_t *pipe; blob_t identity; bool active; }; // Inbound pipes with the names of corresponging peers. typedef std::vector <inpipe_t> inpipes_t; inpipes_t inpipes; // The pipe we are currently reading from. inpipes_t::size_type current_in; // Have we prefetched a message. bool prefetched; // Holds the prefetched message. msg_t prefetched_msg; // If true, more incoming message parts are expected. bool more_in; struct outpipe_t { class pipe_t *pipe; bool active; }; // Outbound pipes indexed by the peer names. typedef std::map <blob_t, outpipe_t> outpipes_t; outpipes_t outpipes; // The pipe we are currently writing to. class pipe_t *current_out; // If true, more outgoing message parts are expected. bool more_out; router_t (const router_t&); const router_t &operator = (const router_t&); }; } #endif
cwt137/zeromq3-0
src/router.hpp
C++
gpl-3.0
2,931
/* * pata_opti.c - ATI PATA for new ATA layer * (C) 2005 Red Hat Inc * * Based on * linux/drivers/ide/pci/opti621.c Version 0.7 Sept 10, 2002 * * Copyright (C) 1996-1998 Linus Torvalds & authors (see below) * * Authors: * Jaromir Koutek <miri@punknet.cz>, * Jan Harkes <jaharkes@cwi.nl>, * Mark Lord <mlord@pobox.com> * Some parts of code are from ali14xx.c and from rz1000.c. * * Also consulted the FreeBSD prototype driver by Kevin Day to try * and resolve some confusions. Further documentation can be found in * Ralf Brown's interrupt list * * If you have other variants of the Opti range (Viper/Vendetta) please * try this driver with those PCI idents and report back. For the later * chips see the pata_optidma driver * */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/pci.h> #include <linux/init.h> #include <linux/blkdev.h> #include <linux/delay.h> #include <scsi/scsi_host.h> #include <linux/libata.h> #define DRV_NAME "pata_opti" #define DRV_VERSION "0.2.9" enum { READ_REG = 0, /* index of Read cycle timing register */ WRITE_REG = 1, /* index of Write cycle timing register */ CNTRL_REG = 3, /* index of Control register */ STRAP_REG = 5, /* index of Strap register */ MISC_REG = 6 /* index of Miscellaneous register */ }; /** * opti_pre_reset - probe begin * @link: ATA link * @deadline: deadline jiffies for the operation * * Set up cable type and use generic probe init */ static int opti_pre_reset(struct ata_link *link, unsigned long deadline) { struct ata_port *ap = link->ap; struct pci_dev *pdev = to_pci_dev(ap->host->dev); static const struct pci_bits opti_enable_bits[] = { { 0x45, 1, 0x80, 0x00 }, { 0x40, 1, 0x08, 0x00 } }; if (!pci_test_config_bits(pdev, &opti_enable_bits[ap->port_no])) return -ENOENT; return ata_sff_prereset(link, deadline); } /** * opti_write_reg - control register setup * @ap: ATA port * @value: value * @reg: control register number * * The Opti uses magic 'trapdoor' register accesses to do configuration * rather than using PCI space as other controllers do. The double inw * on the error register activates configuration mode. We can then write * the control register */ static void opti_write_reg(struct ata_port *ap, u8 val, int reg) { void __iomem *regio = ap->ioaddr.cmd_addr; /* These 3 unlock the control register access */ ioread16(regio + 1); ioread16(regio + 1); iowrite8(3, regio + 2); /* Do the I/O */ iowrite8(val, regio + reg); /* Relock */ iowrite8(0x83, regio + 2); } /** * opti_set_piomode - set initial PIO mode data * @ap: ATA interface * @adev: ATA device * * Called to do the PIO mode setup. Timing numbers are taken from * the FreeBSD driver then pre computed to keep the code clean. There * are two tables depending on the hardware clock speed. */ static void opti_set_piomode(struct ata_port *ap, struct ata_device *adev) { struct ata_device *pair = ata_dev_pair(adev); int clock; int pio = adev->pio_mode - XFER_PIO_0; void __iomem *regio = ap->ioaddr.cmd_addr; u8 addr; /* Address table precomputed with prefetch off and a DCLK of 2 */ static const u8 addr_timing[2][5] = { { 0x30, 0x20, 0x20, 0x10, 0x10 }, { 0x20, 0x20, 0x10, 0x10, 0x10 } }; static const u8 data_rec_timing[2][5] = { { 0x6B, 0x56, 0x42, 0x32, 0x31 }, { 0x58, 0x44, 0x32, 0x22, 0x21 } }; iowrite8(0xff, regio + 5); clock = ioread16(regio + 5) & 1; /* * As with many controllers the address setup time is shared * and must suit both devices if present. */ addr = addr_timing[clock][pio]; if (pair) { /* Hardware constraint */ u8 pair_addr = addr_timing[clock][pair->pio_mode - XFER_PIO_0]; if (pair_addr > addr) addr = pair_addr; } /* Commence primary programming sequence */ opti_write_reg(ap, adev->devno, MISC_REG); opti_write_reg(ap, data_rec_timing[clock][pio], READ_REG); opti_write_reg(ap, data_rec_timing[clock][pio], WRITE_REG); opti_write_reg(ap, addr, MISC_REG); /* Programming sequence complete, override strapping */ opti_write_reg(ap, 0x85, CNTRL_REG); } static struct scsi_host_template opti_sht = { ATA_PIO_SHT(DRV_NAME), }; static const struct ata_port_operations opti_port_ops = { .inherits = &ata_sff_port_ops, .cable_detect = ata_cable_40wire, .set_piomode = opti_set_piomode, .prereset = opti_pre_reset, }; static int opti_init_one(struct pci_dev *dev, const struct pci_device_id *id) { static const struct ata_port_info info = { .flags = ATA_FLAG_SLAVE_POSS, .pio_mask = ATA_PIO4, .port_ops = &opti_port_ops }; const struct ata_port_info *ppi[] = { &info, NULL }; static int printed_version; if (!printed_version++) dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n"); return ata_pci_sff_init_one(dev, ppi, &opti_sht, NULL); } static const struct pci_device_id opti[] = { { PCI_VDEVICE(OPTI, PCI_DEVICE_ID_OPTI_82C621), 0 }, { PCI_VDEVICE(OPTI, PCI_DEVICE_ID_OPTI_82C825), 1 }, { }, }; static struct pci_driver opti_pci_driver = { .name = DRV_NAME, .id_table = opti, .probe = opti_init_one, .remove = ata_pci_remove_one, #ifdef CONFIG_PM .suspend = ata_pci_device_suspend, .resume = ata_pci_device_resume, #endif }; static int __init opti_init(void) { return pci_register_driver(&opti_pci_driver); } static void __exit opti_exit(void) { pci_unregister_driver(&opti_pci_driver); } MODULE_AUTHOR("Alan Cox"); MODULE_DESCRIPTION("low-level driver for Opti 621/621X"); MODULE_LICENSE("GPL"); MODULE_DEVICE_TABLE(pci, opti); MODULE_VERSION(DRV_VERSION); module_init(opti_init); module_exit(opti_exit);
Siosm/contextd-capture
linux-2.6.32-hardened-r22/drivers/ata/pata_opti.c
C
gpl-3.0
5,602
/**************************************************************************** ** ** This file is part of LAN Messenger. ** ** Copyright (c) 2010 - 2012 Qualia Digital Solutions. ** ** Contact: qualiatech@gmail.com ** ** LAN Messenger 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. ** ** LAN Messenger 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 LAN Messenger. If not, see <http://www.gnu.org/licenses/>. ** ****************************************************************************/ #include <QMessageBox> #include "broadcastwindow.h" // constructor lmcBroadcastWindow::lmcBroadcastWindow(QWidget *parent) : QWidget(parent) { ui.setupUi(this); // Destroy the window when it closes setAttribute(Qt::WA_DeleteOnClose, true); // set up the initial default size of splitter panels // left panel takes up 60% of total width, right panel the rest QList<int> sizes; sizes.append(width() * 0.6); sizes.append(width() - width() * 0.6 - ui.splitter->handleWidth()); ui.splitter->setSizes(sizes); connect(ui.btnSelectAll, SIGNAL(clicked()), this, SLOT(btnSelectAll_clicked())); connect(ui.btnSelectNone, SIGNAL(clicked()), this, SLOT(btnSelectNone_clicked())); connect(ui.tvUserList, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(tvUserList_itemChanged(QTreeWidgetItem*, int))); connect(ui.btnSend, SIGNAL(clicked()), this, SLOT(btnSend_clicked())); // event filters for handling keyboard input ui.txtMessage->installEventFilter(this); ui.tvUserList->installEventFilter(this); ui.btnSend->installEventFilter(this); ui.btnCancel->installEventFilter(this); ui.btnSelectAll->installEventFilter(this); ui.btnSelectNone->installEventFilter(this); ui.lblInfo->setVisible(false); infoFlag = IT_Ok; parentToggling = false; childToggling = false; } lmcBroadcastWindow::~lmcBroadcastWindow() { } void lmcBroadcastWindow::init(bool connected) { createToolBar(); setWindowIcon(QIcon(IDR_APPICON)); ui.splitter->setStyleSheet("QSplitter::handle { image: url("IDR_HGRIP"); }"); ui.tvUserList->setIconSize(QSize(16, 16)); ui.tvUserList->header()->setMovable(false); ui.tvUserList->header()->setStretchLastSection(false); ui.tvUserList->header()->setResizeMode(0, QHeaderView::Stretch); ui.tvUserList->setCheckable(true); // load settings pSettings = new lmcSettings(); restoreGeometry(pSettings->value(IDS_WINDOWBROADCAST).toByteArray()); ui.splitter->restoreState(pSettings->value(IDS_SPLITTERBROADCAST).toByteArray()); showSmiley = pSettings->value(IDS_EMOTICON, IDS_EMOTICON_VAL).toBool(); sendKeyMod = pSettings->value(IDS_SENDKEYMOD, IDS_SENDKEYMOD_VAL).toBool(); fontSizeVal = pSettings->value(IDS_FONTSIZE, IDS_FONTSIZE_VAL).toInt(); pFontGroup->actions()[fontSizeVal]->setChecked(true); int viewType = pSettings->value(IDS_USERLISTVIEW, IDS_USERLISTVIEW_VAL).toInt(); ui.tvUserList->setView((UserListView)viewType); // show a message if not connected bConnected = connected; ui.btnSend->setEnabled(bConnected); if(!bConnected) showStatus(IT_Disconnected, true); setUIText(); ui.txtMessage->setStyleSheet("QTextEdit { " + fontStyle[fontSizeVal] + " }"); ui.txtMessage->setFocus(); } void lmcBroadcastWindow::stop(void) { // save window geometry and splitter panel sizes pSettings->setValue(IDS_WINDOWBROADCAST, saveGeometry()); pSettings->setValue(IDS_SPLITTERBROADCAST, ui.splitter->saveState()); } void lmcBroadcastWindow::show(QList<QTreeWidgetItem*>* pGroupList) { QWidget::show(); if(!pGroupList) return; // populate the user tree ui.tvUserList->clear(); for(int index = 0; index < pGroupList->count(); index++) { QTreeWidgetItem* pItem = pGroupList->value(index); pItem->setCheckState(0, Qt::Unchecked); for(int childIndex = 0; childIndex < pItem->childCount(); childIndex++) pItem->child(childIndex)->setCheckState(0, Qt::Unchecked); ui.tvUserList->addTopLevelItem(pItem); } ui.tvUserList->expandAll(); btnSelectAll_clicked(); } void lmcBroadcastWindow::connectionStateChanged(bool connected) { bConnected = connected; ui.btnSend->setEnabled(bConnected); bConnected ? showStatus(IT_Disconnected, false) : showStatus(IT_Disconnected, true); } void lmcBroadcastWindow::settingsChanged(void) { showSmiley = pSettings->value(IDS_EMOTICON, IDS_EMOTICON_VAL).toBool(); sendKeyMod = pSettings->value(IDS_SENDKEYMOD, IDS_SENDKEYMOD_VAL).toBool(); int viewType = pSettings->value(IDS_USERLISTVIEW, IDS_USERLISTVIEW_VAL).toInt(); ui.tvUserList->setView((UserListView)viewType); } // this method receives keyboard events and check if Enter key or Escape key were pressed // if so, corresponding functions are called bool lmcBroadcastWindow::eventFilter(QObject* pObject, QEvent* pEvent) { if(pEvent->type() == QEvent::KeyPress) { QKeyEvent* pKeyEvent = static_cast<QKeyEvent*>(pEvent); if(pKeyEvent->key() == Qt::Key_Escape) { close(); return true; } else if((pKeyEvent->key() == Qt::Key_Return || pKeyEvent->key() == Qt::Key_Enter) && pObject == ui.txtMessage) { bool keyMod = ((pKeyEvent->modifiers() & Qt::ControlModifier) == Qt::ControlModifier); if(keyMod == sendKeyMod) { sendMessage(); return true; } // The TextEdit widget does not insert new line when Ctrl+Enter is pressed // So we insert a new line manually if(keyMod) ui.txtMessage->insertPlainText("\n"); } } return false; } void lmcBroadcastWindow::changeEvent(QEvent* pEvent) { switch(pEvent->type()) { case QEvent::LanguageChange: setUIText(); break; default: break; } QWidget::changeEvent(pEvent); } void lmcBroadcastWindow::closeEvent(QCloseEvent* pEvent) { ui.txtMessage->clear(); btnSelectNone_clicked(); QWidget::closeEvent(pEvent); } // change the font size of the text box with toolbar button void lmcBroadcastWindow::btnFontSize_clicked(void) { fontSizeVal = (fontSizeVal == FS_COUNT - 1) ? 0 : fontSizeVal + 1; pFontGroup->actions()[fontSizeVal]->setChecked(true); pbtnFontSize->setText(lmcStrings::fontSize()[fontSizeVal]); ui.txtMessage->setStyleSheet("QTextEdit { " + fontStyle[fontSizeVal] + " }"); } // change the font size of text box through menu void lmcBroadcastWindow::fontAction_triggered(QAction* action) { fontSizeVal = action->data().toInt(); pbtnFontSize->setText(lmcStrings::fontSize()[fontSizeVal]); ui.txtMessage->setStyleSheet("QTextEdit { " + fontStyle[fontSizeVal] + " }"); } // insert a smiley into the text box void lmcBroadcastWindow::smileyAction_triggered(void) { // if smileys are enabled, insert an image else insert a text smiley // nSmiley contains index of smiley if(showSmiley) { QString htmlPic("<html><head></head><body><img src='" + smileyPic[nSmiley] + "' /></body></html>"); ui.txtMessage->insertHtml(htmlPic); } else ui.txtMessage->insertPlainText(smileyCode[nSmiley]); } // select all users in the user tree void lmcBroadcastWindow::btnSelectAll_clicked(void) { for(int index = 0; index < ui.tvUserList->topLevelItemCount(); index++) ui.tvUserList->topLevelItem(index)->setCheckState(0, Qt::Checked); } // deselect all users in the user tree void lmcBroadcastWindow::btnSelectNone_clicked(void) { for(int index = 0; index < ui.tvUserList->topLevelItemCount(); index++) ui.tvUserList->topLevelItem(index)->setCheckState(0, Qt::Unchecked); } // event called when the user checks/unchecks a tree item void lmcBroadcastWindow::tvUserList_itemChanged(QTreeWidgetItem* item, int column) { Q_UNUSED(column); // if parent tree item was toggled, update all its children to the same state // if a child tree item was toggled, two cases arise: // if all its siblings and it are checked, update its parent to checked // if all its siblings and it are not checked, update its parent to unchecked if(item->data(0, TypeRole).toString().compare("Group") == 0 && !childToggling) { parentToggling = true; for(int index = 0; index < item->childCount(); index++) item->child(index)->setCheckState(0, item->checkState(0)); parentToggling = false; } else if(item->data(0, TypeRole).toString().compare("User") == 0 && !parentToggling) { childToggling = true; int nChecked = 0; QTreeWidgetItem* parent = item->parent(); for(int index = 0; index < parent->childCount(); index++) if(parent->child(index)->checkState(0)) nChecked++; Qt::CheckState check = (nChecked == parent->childCount()) ? Qt::Checked : Qt::Unchecked; parent->setCheckState(0, check); childToggling = false; } } void lmcBroadcastWindow::btnSend_clicked(void) { sendMessage(); } // create toolbar and add buttons void lmcBroadcastWindow::createToolBar(void) { // create the toolbar pToolBar = new QToolBar(ui.toolBarWidget); pToolBar->setStyleSheet("QToolBar { border: 0px }"); pToolBar->setIconSize(QSize(16, 16)); ui.toolBarLayout->addWidget(pToolBar); // create the font menu QMenu* pFontMenu = new QMenu(this); pFontGroup = new QActionGroup(this); connect(pFontGroup, SIGNAL(triggered(QAction*)), this, SLOT(fontAction_triggered(QAction*))); for(int index = 0; index < FS_COUNT; index++) { QAction* pAction = new QAction(lmcStrings::fontSize()[index], this); pAction->setCheckable(true); pAction->setData(index); pFontGroup->addAction(pAction); pFontMenu->addAction(pAction); } // create the font tool button pbtnFontSize = new QToolButton(pToolBar); pbtnFontSize->setToolButtonStyle(Qt::ToolButtonTextOnly); pbtnFontSize->setPopupMode(QToolButton::MenuButtonPopup); pbtnFontSize->setMenu(pFontMenu); connect(pbtnFontSize, SIGNAL(clicked()), this, SLOT(btnFontSize_clicked())); pToolBar->addWidget(pbtnFontSize); // create the smiley menu lmcImagePickerAction* pSmileyAction = new lmcImagePickerAction(this, smileyPic, SM_COUNT, 19, 10, &nSmiley); connect(pSmileyAction, SIGNAL(triggered()), this, SLOT(smileyAction_triggered())); QMenu* pSmileyMenu = new QMenu(this); pSmileyMenu->addAction(pSmileyAction); // create the smiley tool button pbtnSmiley = new lmcToolButton(pToolBar); pbtnSmiley->setIcon(QIcon(QPixmap(IDR_SMILEY, "PNG"))); pbtnSmiley->setPopupMode(QToolButton::InstantPopup); pbtnSmiley->setMenu(pSmileyMenu); pToolBar->addWidget(pbtnSmiley); } void lmcBroadcastWindow::setUIText(void) { ui.retranslateUi(this); setWindowTitle(tr("Send Broadcast Message")); pbtnFontSize->setText(lmcStrings::fontSize()[fontSizeVal]); pbtnFontSize->setToolTip(tr("Change Font Size")); pbtnSmiley->setToolTip(tr("Insert Smiley")); for(int index = 0; index < pFontGroup->actions().count(); index++) pFontGroup->actions()[index]->setText(lmcStrings::fontSize()[index]); } // send the broadcast message to all selected users void lmcBroadcastWindow::sendMessage(void) { // return if text box is empty if(ui.txtMessage->document()->isEmpty()) return; // send only if connected if(bConnected) { QString szHtmlMessage(ui.txtMessage->toHtml()); encodeMessage(&szHtmlMessage); QTextDocument docMessage; docMessage.setHtml(szHtmlMessage); QString szMessage(docMessage.toPlainText()); // send broadcast int sendCount = 0; XmlMessage xmlMessage; xmlMessage.addData(XN_BROADCAST, szMessage); for(int index = 0; index < ui.tvUserList->topLevelItemCount(); index++) { for(int childIndex = 0; childIndex < ui.tvUserList->topLevelItem(index)->childCount(); childIndex++) { QTreeWidgetItem* item = ui.tvUserList->topLevelItem(index)->child(childIndex); if(item->checkState(0) == Qt::Checked) { QString szUserId = item->data(0, IdRole).toString(); emit messageSent(MT_Broadcast, &szUserId, &xmlMessage); sendCount++; } } } if(sendCount == 0) { QMessageBox::warning(this, tr("No recipient selected"), tr("Please select at least one recipient to send a broadcast.")); return; } ui.txtMessage->clear(); close(); } } // Called before sending message void lmcBroadcastWindow::encodeMessage(QString* lpszMessage) { // replace all emoticon images with corresponding text code ChatHelper::encodeSmileys(lpszMessage); } // show a message depending on the connection state void lmcBroadcastWindow::showStatus(int flag, bool add) { infoFlag = add ? infoFlag | flag : infoFlag & ~flag; ui.lblInfo->setStyleSheet("QLabel { background-color:white;font-size:9pt; }"); if(infoFlag & IT_Disconnected) { ui.lblInfo->setText("<span style='color:rgb(192, 0, 0);'>" + tr("You are no longer connected. Broadcast message cannot be sent.") + "</span>"); ui.lblInfo->setVisible(true); } else { ui.lblInfo->setText(QString::null); ui.lblInfo->setVisible(false); } }
dilipvinu/lanmsngr
lmc/src/broadcastwindow.cpp
C++
gpl-3.0
13,360
#!/usr/bin/env python # -*- coding: utf-8 -*- # TODO: PORASQUI: BUG: Cerrar la ventana no detiene el GMapCatcher y se queda # como un proceso de fondo en espera bloqueante... Ni atiende al Ctrl+C # siquiera. import sys, os.path dirfichero = os.path.realpath(os.path.dirname(__file__)) if os.path.realpath(os.path.curdir) == dirfichero: os.chdir("..") if ("utils" in os.listdir(os.path.curdir) and os.path.abspath(os.path.curdir) not in sys.path): sys.path.insert(0, ".") from utils.googlemaps import GoogleMaps, GoogleMapsError try: # XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX # raise ImportError # XXX: Solo para probar... BORRAR DESPUÉS # XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX import osmgpsmap # Third dependency. No está en el árbol local. from utils.mapviewer import DummyLayer, imdir OSMGPSMAP = True except ImportError, msg: OSMGPSMAP = False os.chdir(os.path.abspath( os.path.join(dirfichero, "..", "utils", "gmapcatcher"))) import maps as gmc os.chdir(os.path.join(dirfichero, "..")) import gtk APIFILENAME = "gg_api_key.txt" class Mapa(): def __init__(self, apifile = None): if not apifile: mydir = os.path.dirname(os.path.abspath(__file__)) apifile = os.path.join(mydir, APIFILENAME) fapi = open(apifile) self.__ggapi = fapi.read() fapi.close() self.ggmap = GoogleMaps(self.__ggapi) self.init_mapa() def init_mapa(self): if OSMGPSMAP: self.osm = osmgpsmap.GpsMap() self.osm.layer_add(osmgpsmap.GpsMapOsd(show_dpad = True, show_zoom = True)) self.osm.layer_add( DummyLayer()) self.osm.connect('button_release_event', self.map_clicked) self.osm.set_zoom(13) # Zoom por defecto else: logging_path = conf_path = None # Es la conf. por defecto. Ver # utils/gmapatcher/map.py para más detalles. gmc.mapLogging.init_logging(logging_path) gmc.log.info("Starting %s version %s." % (gmc.NAME, gmc.VERSION)) self.gmcw = gmc.MainWindow(config_path = conf_path) self.gmcw.do_zoom(4) # Zoom por defecto. # TODO: PORASQUI: Hacer un traslado de escala entre el zoom de # GMC que va -creo- desde -2 (cerca) a más de 10 (lejos) al de # OSM, que va al contrario y 13 es cerca. Ver las "constantes" # definidas en cada caso (MAX_ZOOM_no_sé_qué en GMC). self.osm = self.gmcw.container def map_clicked(self, osm, event): if OSMGPSMAP: lat, lon = self.osm.get_event_location(event).get_degrees() else: lat, lon = 0, 0 # PORASQUI if event.button == 1: #self.latlon_entry.set_text( # 'Map Centre: latitude %s longitude %s' % ( # self.osm.props.latitude, # self.osm.props.longitude # ) #) pass elif event.button == 2: if OSMGPSMAP: self.osm.gps_add(lat, lon, heading = osmgpsmap.INVALID); else: pass # PORASQUI elif event.button == 3: if OSMGPSMAP: pb = gtk.gdk.pixbuf_new_from_file_at_size( os.path.join(imdir, "poi.png"), 24,24) self.osm.image_add(lat,lon,pb) else: pass # PORASQUI def centrar_mapa(self, lat, lon, zoom = None, track = True, flag = False): """ @param track Indica si se debe marcar el punto con un círculo y el "track" de recorrido. @param flag Indica si se debe marcar con una bandera el punto. """ if lat == None: raise ValueError, "Mapa.centrar_mapa -> Latitud incorrecta" if lon == None: raise ValueError, "Mapa.centrar_mapa -> Longitud incorrecta" if zoom is None: if OSMGPSMAP: self.osm.set_center(lat, lon) else: self.gmcw.confirm_clicked(None, None, lat, lon) else: if OSMGPSMAP: self.osm.set_center_and_zoom(lat, lon, zoom) else: self.gmcw.confirm_clicked(None, None, lat, lon) self.gmcw.do_zoom(zoom) if track: if OSMGPSMAP: self.osm.gps_add(lat, lon, heading = osmgpsmap.INVALID); else: self.gmcw.confirm_clicked(None, None, lat, lon) # PORASQUI: No support for the moment... if flag: if OSMGPSMAP: pb = gtk.gdk.pixbuf_new_from_file_at_size( os.path.join(imdir, "poi.png"), 24, 24) self.osm.image_add(lat, lon, pb) else: self.gmcw.confirm_clicked(None, None, lat, lon) # PORASQUI: No support for the moment... def put_mapa(self, container): #m = self.wids['mapa_container'] m = container m.add(self.osm) m.show_all() if not OSMGPSMAP: # Hay que ocultar algunas cosillas... for w in (self.gmcw.export_panel, self.gmcw.top_panel, self.gmcw.status_bar): try: w.set_visible(False) except AttributeError: w.set_property("visible", False) @property def zoom(self): """Nivel actual de zoom en el mapa.""" if OSMGPSMAP: return self.osm.props.zoom else: return self.gmcw.get_zoom() def get_latlon(self, direccion): """ Devuelve la latitud y longitud como flotantes correspondiente a la dirección recibida. Si no se encuentra en Google Maps, devuelve (None, None). """ try: res = self.ggmap.address_to_latlng(direccion) except GoogleMapsError: res = (None, None) return res def test(): w = gtk.Window() m = Mapa() m.put_mapa(w) #w.show_all() w.connect("destroy", lambda *a, **kw: gtk.main_quit()) gtk.main() if __name__ == "__main__": test()
pacoqueen/cican
utils/mapa.py
Python
gpl-3.0
6,423
local PLUGIN = Plugin("Helpmenu") function PLUGIN:OnEnable() util.AddNetworkString("SAHelpMenu") hook.Add("ShowHelp", "SAHelpMenu", function(ply) net.Start("SAHelpMenu") net.Send(ply) return true end) end function PLUGIN:OnDisable() hook.Remove("ShowHelp", "SAHelpMenu") end SA:RegisterPlugin(PLUGIN)
SimonSchick/sa2
gamemode/plugins/server/helpmenu.lua
Lua
gpl-3.0
313
#significant input and copied functions from T. Morton's VESPA code (all mistakes are my own) #coords -- RA and DEC of target in degrees. Needed for GAIA querying. # Degrees, 0-360 and -90 to +90. List format [RA,DEC]. import numpy as np import pandas as pd from scipy.integrate import quad from scipy import stats import astropy.constants as const import astropy.units as u from astropy.coordinates import SkyCoord import subprocess as sp import os, re import time AU = const.au.cgs.value RSUN = const.R_sun.cgs.value REARTH = const.R_earth.cgs.value MSUN = const.M_sun.cgs.value DAY = 86400 #seconds G = const.G.cgs.value import logging def semimajor(P,mtotal=1.): """ Returns semimajor axis in AU given P in days, total mass in solar masses. """ return ((P*DAY/2/np.pi)**2*G*mtotal*MSUN)**(1./3)/AU def eclipse_probability(R1, R2, P, M1, M2): return (R1 + R2) *RSUN / (semimajor(P , M1 + M2)*AU) def centroid_PDF_source(pos,centroiddat): cent_x, cent_y = centroiddat[0], centroiddat[1] sig_x, sig_y = centroiddat[2], centroiddat[3] return stats.multivariate_normal.pdf([pos[0],pos[1]],mean=[cent_x,cent_y], cov=[[sig_x**(1/2.),0],[0,sig_y**(1/2.)]]) def bgeb_prior(centroid_val, star_density, skyarea, P, r1=1.0, r2=1.0, m1=1.0, m2=1.0, f_binary=0.3, f_close=0.12): ''' Centroid val is value at source (no integration over area). This allows comparison to planet_prior without having two planet_prior functions. ''' return centroid_val * skyarea * star_density * f_binary * f_close * eclipse_probability(r1, r2, P, m1, m2) def bgtp_prior(centroid_val, star_density, skyarea, P, r1=1.0, rp=1.0, m1=1.0, mp=0.0, f_planet=0.2): ''' Centroid val is value at source (no integration over area). This allows comparison to planet_prior without having two planet_prior functions. ''' return centroid_val * skyarea * star_density * f_planet * eclipse_probability(r1, rp*REARTH/RSUN, P, m1, mp) def eb_prior(centroid_val, P, r1=1.0, r2=1.0, m1=1.0, m2=1.0, f_binary=0.3, f_close=0.027): ''' centroid pdf at source location f_binary = 0.3 (moe + di stefano 2017) - valid for 0.8-1.2 Msun! could improve to be average over all types? f_close = 0.027 (moe + di stefano 2017) fraction of binaries with P between 3.2-32d eclipse prob works for defined source EBs too, just use appropriate centroid pdf value. ''' return centroid_val * f_binary * f_close * eclipse_probability(r1, r2, P, m1, m2) def heb_prior(centroid_val, P, r1=1.0, r2=1.0, m1=1.0, m2=1.0, f_triple=0.1, f_close=1.0): ''' centroid pdf at source location f_triple = 0.1 (moe + di stefano 2017) - valid for 0.8-1.2 Msun! could improve to be average over all types? f_close = 1.0 implies all triples have a close binary. May be over-generous eclipse prob ''' return centroid_val * f_triple * f_close * eclipse_probability(r1, r2, P, m1, m2) def planet_prior(centroid_val, P, r1=1.0, rp=1.0, m1=1.0, mp=0.0, f_planet=0.2957): ''' centroid pdf at source location planet occurrence (fressin, any planet<29d) eclipse prob works for defined source planets too, just use appropriate centroid pdf value. possibly needs a more general f_planet - as classifier will be using a range of planets. should prior then be the prior of being in the whole training set, rather than the specific depth seen? if so, need to change to 'fraction of ALL stars with planets' (i.e. including EBs etc). Also look into default radii and masses. Precalculate mean eclipse probability for training set? ''' return centroid_val * f_planet * eclipse_probability(r1, rp*REARTH/RSUN, P, m1, mp) def fp_fressin(rp,dr=None): if dr is None: dr = rp*0.3 fp = quad(fressin_occurrence,rp-dr,rp+dr)[0] return max(fp, 0.001) #to avoid zero def fressin_occurrence(rp): """ Occurrence rates per bin from Fressin+ (2013) """ rp = np.atleast_1d(rp) sq2 = np.sqrt(2) bins = np.array([1/sq2,1,sq2,2,2*sq2, 4,4*sq2,8,8*sq2, 16,16*sq2]) rates = np.array([0,0.155,0.155,0.165,0.17,0.065,0.02,0.01,0.012,0.01,0.002,0]) return rates[np.digitize(rp,bins)] def trilegal_density(ra,dec,kind='target',maglim=21.75,area=1.0,mapfile=None): if kind=='interp' and mapfile is None: print('HEALPIX map file must be passed') return 0 if kind not in ['target','interp']: print('kind not recognised. Setting kind=target') kind = 'target' if kind=='target': basefilename = 'trilegal_'+str(ra)+'_'+str(dec) h5filename = basefilename + '.h5' if not os.path.exists(h5filename): get_trilegal(basefilename,ra,dec,maglim=maglim,area=area) else: print('Using cached trilegal file. Sky area may be different.') if os.path.exists(h5filename): stars = pd.read_hdf(h5filename,'df') with pd.HDFStore(h5filename) as store: trilegal_args = store.get_storer('df').attrs.trilegal_args if trilegal_args['maglim'] < maglim: print('Re-calling trilegal with extended magnitude range') get_trilegal(basefilename,ra,dec,maglim=maglim,area=area) stars = pd.read_hdf(h5filename,'df') stars = stars[stars['TESS_mag'] < maglim] #in case reading from file #c = SkyCoord(trilegal_args['l'],trilegal_args['b'], # unit='deg',frame='galactic') #self.coords = c.icrs area = trilegal_args['area']*(u.deg)**2 density = len(stars)/area return density.value else: return 0 else: import healpy as hp #interpolate pre-calculated densities coord = SkyCoord(ra,dec,unit='deg') if np.abs(coord.galactic.b.value)<5: print('Near galactic plane, Trilegal density may be inaccurate.') #Density map will set mag limits densitymap = hp.read_map(mapfile) density = hp.get_interp_val(densitymap,ra,dec,lonlat=True) return density #maglim of 21 used following sullivan 2015 def get_trilegal(filename,ra,dec,folder='.', galactic=False, filterset='TESS_2mass_kepler',area=1,maglim=21,binaries=False, trilegal_version='1.6',sigma_AV=0.1,convert_h5=True): """Runs get_trilegal perl script; optionally saves output into .h5 file Depends on a perl script provided by L. Girardi; calls the web form simulation, downloads the file, and (optionally) converts to HDF format. Uses A_V at infinity from :func:`utils.get_AV_infinity`. .. note:: Would be desirable to re-write the get_trilegal script all in python. :param filename: Desired output filename. If extension not provided, it will be added. :param ra,dec: Coordinates (ecliptic) for line-of-sight simulation. :param folder: (optional) Folder to which to save file. *Acknowledged, file control in this function is a bit wonky.* :param filterset: (optional) Filter set for which to call TRILEGAL. :param area: (optional) Area of TRILEGAL simulation [sq. deg] :param maglim: (optional) Limiting magnitude in first mag (by default will be Kepler band) If want to limit in different band, then you have to got directly to the ``get_trilegal`` perl script. :param binaries: (optional) Whether to have TRILEGAL include binary stars. Default ``False``. :param trilegal_version: (optional) Default ``'1.6'``. :param sigma_AV: (optional) Fractional spread in A_V along the line of sight. :param convert_h5: (optional) If true, text file downloaded from TRILEGAL will be converted into a ``pandas.DataFrame`` stored in an HDF file, with ``'df'`` path. """ if galactic: l, b = ra, dec else: try: c = SkyCoord(ra,dec) except: c = SkyCoord(ra,dec,unit='deg') l,b = (c.galactic.l.value,c.galactic.b.value) if os.path.isabs(filename): folder = '' if not re.search('\.dat$',filename): outfile = '{}/{}.dat'.format(folder,filename) else: outfile = '{}/{}'.format(folder,filename) NONMAG_COLS = ['Gc','logAge', '[M/H]', 'm_ini', 'logL', 'logTe', 'logg', 'm-M0', 'Av', 'm2/m1', 'mbol', 'Mact'] #all the rest are mags AV = get_AV_infinity(l,b,frame='galactic') print(AV) if AV is not None: if AV<=1.5: trilegal_webcall(trilegal_version,l,b,area,binaries,AV,sigma_AV,filterset,maglim,outfile) #cmd = './get_trilegal %s %f %f %f %i %.3f %.2f %s 1 %.1f %s' % (trilegal_version,l,b, # area,binaries,AV,sigma_AV, # filterset,maglim,outfile) #sp.Popen(cmd,shell=True).wait() if convert_h5: df = pd.read_table(outfile, sep='\s+', skipfooter=1, engine='python') df = df.rename(columns={'#Gc':'Gc'}) for col in df.columns: if col not in NONMAG_COLS: df.rename(columns={col:'{}_mag'.format(col)},inplace=True) if not re.search('\.h5$', filename): h5file = '{}/{}.h5'.format(folder,filename) else: h5file = '{}/{}'.format(folder,filename) df.to_hdf(h5file,'df') with pd.HDFStore(h5file) as store: attrs = store.get_storer('df').attrs attrs.trilegal_args = {'version':trilegal_version, 'ra':ra, 'dec':dec, 'l':l,'b':b,'area':area, 'AV':AV, 'sigma_AV':sigma_AV, 'filterset':filterset, 'maglim':maglim, 'binaries':binaries} os.remove(outfile) else: print('Skipping, AV > 10 or not found') def trilegal_webcall(trilegal_version,l,b,area,binaries,AV,sigma_AV,filterset,maglim, outfile): """Calls TRILEGAL webserver and downloads results file. :param trilegal_version: Version of trilegal (only tested on 1.6). :param l,b: Coordinates (galactic) for line-of-sight simulation. :param area: Area of TRILEGAL simulation [sq. deg] :param binaries: Whether to have TRILEGAL include binary stars. Default ``False``. :param AV: Extinction along the line of sight. :param sigma_AV: Fractional spread in A_V along the line of sight. :param filterset: (optional) Filter set for which to call TRILEGAL. :param maglim: Limiting magnitude in mag (by default will be 1st band of filterset) If want to limit in different band, then you have to change function directly. :param outfile: Desired output filename. """ webserver = 'http://stev.oapd.inaf.it' args = [l,b,area,AV,sigma_AV,filterset,maglim,1,binaries] mainparams = ('imf_file=tab_imf%2Fimf_chabrier_lognormal.dat&binary_frac=0.3&' 'binary_mrinf=0.7&binary_mrsup=1&extinction_h_r=100000&extinction_h_z=' '110&extinction_kind=2&extinction_rho_sun=0.00015&extinction_infty={}&' 'extinction_sigma={}&r_sun=8700&z_sun=24.2&thindisk_h_r=2800&' 'thindisk_r_min=0&thindisk_r_max=15000&thindisk_kind=3&thindisk_h_z0=' '95&thindisk_hz_tau0=4400000000&thindisk_hz_alpha=1.6666&' 'thindisk_rho_sun=59&thindisk_file=tab_sfr%2Ffile_sfr_thindisk_mod.dat&' 'thindisk_a=0.8&thindisk_b=0&thickdisk_kind=0&thickdisk_h_r=2800&' 'thickdisk_r_min=0&thickdisk_r_max=15000&thickdisk_h_z=800&' 'thickdisk_rho_sun=0.0015&thickdisk_file=tab_sfr%2Ffile_sfr_thickdisk.dat&' 'thickdisk_a=1&thickdisk_b=0&halo_kind=2&halo_r_eff=2800&halo_q=0.65&' 'halo_rho_sun=0.00015&halo_file=tab_sfr%2Ffile_sfr_halo.dat&halo_a=1&' 'halo_b=0&bulge_kind=2&bulge_am=2500&bulge_a0=95&bulge_eta=0.68&' 'bulge_csi=0.31&bulge_phi0=15&bulge_rho_central=406.0&' 'bulge_cutoffmass=0.01&bulge_file=tab_sfr%2Ffile_sfr_bulge_zoccali_p03.dat&' 'bulge_a=1&bulge_b=-2.0e9&object_kind=0&object_mass=1280&object_dist=1658&' 'object_av=1.504&object_avkind=1&object_cutoffmass=0.8&' 'object_file=tab_sfr%2Ffile_sfr_m4.dat&object_a=1&object_b=0&' 'output_kind=1').format(AV,sigma_AV) cmdargs = [trilegal_version,l,b,area,filterset,1,maglim,binaries,mainparams, webserver,trilegal_version] cmd = ("wget -o lixo -Otmpfile --post-data='submit_form=Submit&trilegal_version={}" "&gal_coord=1&gc_l={}&gc_b={}&eq_alpha=0&eq_delta=0&field={}&photsys_file=" "tab_mag_odfnew%2Ftab_mag_{}.dat&icm_lim={}&mag_lim={}&mag_res=0.1&" "binary_kind={}&{}' {}/cgi-bin/trilegal_{}").format(*cmdargs) complete = False while not complete: notconnected = True busy = True print("TRILEGAL is being called with \n l={} deg, b={} deg, area={} sqrdeg\n " "Av={} with {} fractional r.m.s. spread \n in the {} system, complete down to " "mag={} in its {}th filter, use_binaries set to {}.".format(*args)) sp.Popen(cmd,shell=True).wait() if os.path.exists('tmpfile') and os.path.getsize('tmpfile')>0: notconnected = False else: print("No communication with {}, will retry in 2 min".format(webserver)) time.sleep(120) if not notconnected: with open('tmpfile','r') as f: lines = f.readlines() for line in lines: if 'The results will be available after about 2 minutes' in line: busy = False break sp.Popen('rm -f lixo tmpfile',shell=True) if not busy: filenameidx = line.find('<a href=../tmp/') +15 fileendidx = line[filenameidx:].find('.dat') filename = line[filenameidx:filenameidx+fileendidx+4] print("retrieving data from {} ...".format(filename)) while not complete: time.sleep(120) modcmd = 'wget -o lixo -O{} {}/tmp/{}'.format(filename,webserver,filename) modcall = sp.Popen(modcmd,shell=True).wait() if os.path.getsize(filename)>0: with open(filename,'r') as f: lastline = f.readlines()[-1] if 'normally' in lastline: complete = True print('model downloaded!..') if not complete: print('still running...') else: print('Server busy, trying again in 2 minutes') time.sleep(120) sp.Popen('mv {} {}'.format(filename,outfile),shell=True).wait() print('results copied to {}'.format(outfile)) def get_AV_infinity(ra,dec,frame='icrs'): """ Gets the A_V exctinction at infinity for a given line of sight. Queries the NED database using ``curl``. .. note:: It would be desirable to rewrite this to avoid dependence on ``curl``. :param ra,dec: Desired coordinates, in degrees. :param frame: (optional) Frame of input coordinates (e.g., ``'icrs', 'galactic'``) """ coords = SkyCoord(ra,dec,unit='deg',frame=frame).transform_to('icrs') rah,ram,ras = coords.ra.hms decd,decm,decs = coords.dec.dms if decd > 0: decsign = '%2B' else: decsign = '%2D' url = 'http://ned.ipac.caltech.edu/cgi-bin/nph-calc?in_csys=Equatorial&in_equinox=J2000.0&obs_epoch=2010&lon='+'%i' % rah + \ '%3A'+'%i' % ram + '%3A' + '%05.2f' % ras + '&lat=%s' % decsign + '%i' % abs(decd) + '%3A' + '%i' % abs(decm) + '%3A' + '%05.2f' % abs(decs) + \ '&pa=0.0&out_csys=Equatorial&out_equinox=J2000.0' tmpfile = '/tmp/nedsearch%s%s.html' % (ra,dec) cmd = 'curl -s \'%s\' -o %s' % (url,tmpfile) sp.Popen(cmd,shell=True).wait() AV = None try: with open(tmpfile, 'r') as f: for line in f: m = re.search('V \(0.54\)\s+(\S+)',line) if m: AV = float(m.group(1)) os.remove(tmpfile) except: logging.warning('Error accessing NED, url={}'.format(url)) return AV
DJArmstrong/autovet
FPPcalc/priorutils.py
Python
gpl-3.0
16,928
#include "stitchimportdialog.h" #include "ui_stitchimportdialog.h" #include <Data/Import/binaryimport.h> #include "Data/Import/textimport.h" StitchImportDialog::StitchImportDialog(QWidget *parent, QSharedPointer<VespucciWorkspace> ws) : QDialog(parent), ui(new Ui::StitchImportDialog) { ui->setupUi(this); workspace_ = ws; } StitchImportDialog::~StitchImportDialog() { delete ui; } void StitchImportDialog::on_browsePushButton_clicked() { QString filename = QFileDialog::getOpenFileName(this, "Select Instruction File", workspace_->directory(), "Instruction File (*.csv)"); ui->filenameLineEdit->setText(filename); } bool StitchImportDialog::LoadDatasets(field<string> filenames, mat &spectra, vec &x, vec &y, vec &abscissa, bool swap_spatial, QString type) { //follows the vespuccci binary field format: field<field<mat> > datasets(filenames.n_rows, filenames.n_cols); mat current_spectra; vec current_x, current_y, current_abscissa; bool ok; bool two_dim = datasets.n_rows > 1 && datasets.n_cols > 1; for (uword j = 0; j < filenames.n_cols; ++j){ for (uword i = 0; i < filenames.n_rows; ++i){ QString filename; if (two_dim) filename = path_ + "/" + QString::fromStdString(filenames(i, j)); else filename = path_ + "/" + QString::fromStdString(filenames(i)); if (type == "Vespucci Dataset"){ ok = BinaryImport::ImportVespucciBinary(filename.toStdString(), current_spectra, current_abscissa, current_x, current_y); } else if (type == "Wide Text" || type == "Wide CSV"){ ok = TextImport::ImportWideText(filename.toStdString(), current_spectra, current_abscissa, current_x, current_y, swap_spatial); } else if (type == "Long Text" || "Long CSV"){ ok = TextImport::ImportLongText(filename.toStdString(), current_spectra, current_abscissa, current_x, current_y, swap_spatial); } else{ cout << "Improper!\n"; return false; } if (ok){ field<mat> dataset(4); dataset(0) = current_spectra; dataset(1) = current_abscissa; dataset(2) = current_x; dataset(3) = current_y; datasets(i, j) = dataset; } } } try{ ok = Vespucci::StitchDatasets(datasets, spectra, x, y, abscissa); }catch(exception e){ workspace_->main_window()->DisplayExceptionWarning("Vespucci::StitchDatasets", e); ok = false; } return ok; } void StitchImportDialog::on_buttonBox_accepted() { QString filename = ui->filenameLineEdit->text(); path_ = QFileInfo(filename).absolutePath(); QString data_format = ui->formatComboBox->currentText(); bool swap_spatial = ui->swapSpatialCheckBox->isChecked(); bool ok; mat spectra; vec x, y, abscissa; field<string> instruction; ok = instruction.load(filename.toStdString()); if (!ok){ QMessageBox::warning(this, "Failed to Load Instructions", "The instruction file could not be loaded"); } try{ ok = LoadDatasets(instruction, spectra, x, y, abscissa, swap_spatial, data_format); }catch (exception e){ workspace_->main_window()->DisplayExceptionWarning(e); ok = false; } if (!ok){ QMessageBox::warning(this, "Failed to Load Dataset", "One or more datasets could not be loaded, or " "datasets of incompatible spatial coordinates."); } else{ QString x_description = ui->xLineEdit->text(); QString x_units = ui->xUnitsLineEdit->text(); QString y_description = ui->yLineEdit->text(); QString y_units = ui->yUnitsLineEdit->text(); QString name = ui->nameLineEdit->text(); QSharedPointer<VespucciDataset> dataset(new VespucciDataset(name, workspace_->main_window(), workspace_)); dataset->SetData(spectra, abscissa, x, y); dataset->SetXDescription(x_description + " (" + x_units + ")"); dataset->SetYDescription(y_description + " (" + y_units + ")"); workspace_->AddDataset(dataset); } }
VespucciProject/Vespucci
Vespucci/GUI/Processing/stitchimportdialog.cpp
C++
gpl-3.0
5,403
/* * This file is part of the continuous space language and translation model toolkit * for statistical machine translation and large vocabulary speech recognition. * * Copyright 2015, Holger Schwenk, LIUM, University of Le Mans, France * * The CSLM toolkit is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * * * * softmax machine: a_i = exp(a_i) / sum_k a_k * The stable version remove the max of a_i to all a_i before exp. * This lower numerical precision problem * with a_k is the kth output of a linear machine */ #ifndef _MachSoftmaxStable_h #define _MachSoftmaxStable_h #include "MachLin.h" #undef BLAS_CUDA_NPPS_SUM // thsi should be faster, but I can't get it working class MachSoftmaxStable : public MachLin { private: Timer tmn; // cumulated time used for softmax normalization #if defined(BLAS_CUDA) && defined(BLAS_CUDA_NPPS_SUM) Npp8u *gpu_sum_buf; // temporary buffer for fast sum with nppsSum_32f() #endif protected: MachSoftmaxStable(const MachSoftmaxStable &); // create a copy of the machine public: MachSoftmaxStable(const int=0, const int=0, const int=128, const ulong=0, const ulong=0, const int shareid=-1, const bool xdata=false); virtual ~MachSoftmaxStable(); virtual MachSoftmaxStable *Clone() {return new MachSoftmaxStable(*this);} // create a copy of the machine virtual int GetMType() {return file_header_mtype_softmax_stable;}; // get type of machine virtual void Info(bool=false, char *txt=(char*)""); // display (detailed) information on machine virtual void Forw(int=0, bool=false); // calculate outputs for current inputs // backprop gradients from output to input and update all weights virtual void Backw (const float lrate, const float wdecay, int=0); }; #endif
hschwenk/cslm-toolkit
MachSoftmaxStable.h
C
gpl-3.0
2,360
""" /* * Custom handlers for the BBB * */ """ import Adafruit_BBIO.GPIO as GPIO GPIO.setup("P9_12", GPIO.OUT) def alexaHandler(client, userdata, message): print "Received payload: " + str(message.payload.decode()) # Assume only 1 and 0 are send here. if message.payload == "1": GPIO.output("P9_12", GPIO.HIGH) print "Turned christmas tree On" elif message.payload == "0": GPIO.output("P9_12", GPIO.LOW) print "Turned christmas tree Off" def cleanUp(): GPIO.cleanup()
Metonimie/Beaglebone
alexa-amazon/basicServer/gpio_handlers.py
Python
gpl-3.0
525
SUB_PROJ=openmp.mk mpi_static.mk mpi_dyn.mk mpi_dyn_omp.mk .PHONY: all all: build .PHONY: build build: $(SUB_PROJ:=.build) .PHONY: %.build %.build: % $(MAKE) -f $^ build .PHONY: rebuild rebuild: | clean build .PHONY: clean clean: $(SUB_PROJ:=.clean) .PHONY: %.clean %.clean: % $(MAKE) -f $^ clean .PHONY: archive VER:=$(shell git rev-parse --verify --short HEAD 2>/dev/null) archive: git archive --prefix='rsock-g$(VER)/' HEAD > rsock-g$(VER).tar
jmesmon/trifles
brot/Makefile
Makefile
gpl-3.0
459
// This code is automatically generated #include <boost/python.hpp> #include <boost/cstdint.hpp> #include <boost/python/def.hpp> #include <boost/python/args.hpp> #include <boost/python/overloads.hpp> using namespace boost::python; #include <spuc/bpsk_dd_phase.h> #include <spuc/bpsk_quadricorrelator.h> #include <spuc/cp_afc.h> #include <spuc/dd_symbol.h> #include <spuc/nda_symbol.h> #include <spuc/qpsk_dd_phase.h> #include <spuc/qpsk_quadricorrelator.h> #include <spuc/qpsk_rcfd.h> #include <spuc/real_quantize.h> #include <spuc/real_round.h> #include <spuc/real_saturate.h> BOOST_PYTHON_MODULE(real_template_functions_float) { def("bpsk_dd_phase_float",&SPUC::bpsk_dd_phase<float >); def("bpsk_quadricorrelator_float",&SPUC::bpsk_quadricorrelator<float >); def("cp_afc_float",&SPUC::cp_afc<float >); def("dd_symbol_float",&SPUC::dd_symbol<float >); def("nda_symbol_float",&SPUC::nda_symbol<float >); def("qpsk_dd_phase_float",&SPUC::qpsk_dd_phase<float >); def("qpsk_quadricorrelator_float",&SPUC::qpsk_quadricorrelator<float >); def("qpsk_rcfd_float",&SPUC::qpsk_rcfd<float >); def("real_quantize_float",&SPUC::real_quantize<float >); def("real_round_float",&SPUC::real_round<float >); def("real_saturate_float",&SPUC::real_saturate<float >); }
sav6622/spuc
pyste/real_template_functions_float.cpp
C++
gpl-3.0
1,254
<!DOCTYPE html> <!-- Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license --> <html> <head> <title>Using DevTools Plugin &mdash; CKEditor Sample</title> <meta charset="utf-8"> <script src="../ckeditor.js"></script> <link rel="stylesheet" href="sample.css"> </head> <body> <h1 class="samples"> <a href="index.html">CKEditor Samples</a> &raquo; Using the Developer Tools Plugin </h1> <div class="description"> <p> This sample shows how to configure CKEditor instances to use the <strong>Developer Tools</strong> (<code>devtools</code>) plugin that displays information about dialog window elements, including the name of the dialog window, tab, and UI element. Please note that the tooltip also contains a link to the <a href="http://nightly-v4.ckeditor.com/ckeditor_api/">CKEditor JavaScript API</a> documentation for each of the selected elements. </p> <p> This plugin is aimed at developers who would like to customize their CKEditor instances and create their own plugins. By default it is turned off; it is usually useful to only turn it on in the development phase. Note that it works with all CKEditor dialog windows, including the ones that were created by custom plugins. </p> <p> To add a CKEditor instance using the <strong>devtools</strong> plugin, insert the following JavaScript call into your code: </p> <pre class="samples"> CKEDITOR.replace( '<em>textarea_id</em>', { <strong>extraPlugins: 'devtools'</strong> });</pre> <p> Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of the <code>&lt;textarea&gt;</code> element to be replaced with CKEditor. </p> </div> <form action="sample_posteddata.php" method="post"> <p> <label for="editor1"> Editor 1: </label> <textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea> <script> // This call can be placed at any point after the // <textarea>, or inside a <head><script> in a // window.onload event handler. // Replace the <textarea id="editor"> with an CKEditor // instance, using default configurations. CKEDITOR.replace( 'editor1', { extraPlugins: 'devtools' }); </script> </p> <p> <input type="submit" value="Submit"> </p> </form> <div id="footer"> <hr> <p> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> </p> <p id="copy"> Copyright &copy; 2003-2012, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved. </p> </div> </body> </html>
tsmaryka/hitc
public/javascripts/ckeditor/samples/devtools.html
HTML
gpl-3.0
2,862
<?php /* This is a media database to mange your Games. Copyright (C) 2013 Nick Tranholm Asselberghs 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/>. */ ?> <?php echo 'Velkommen til min spil database.<br />'; echo 'Der kan s&#248;ges og hele listen kan ses uden login.<br />'; echo 'Derp&#229; kan jeg s&#229; kontaktes hvis du &#248;nsker at l&#229;ne en given titel.<br />'; echo 'Databasen er nu i sin anden version, den vil snart blive udgivet som kildekode og lagt p&#229; min hjemmeside.<br />'; echo 'Jeg skal nok vedl&#230;gge en "ops&#230;tnings fil" der skal lave tabellerne og felterne som de skal v&#230;re i hvert sit projekt s&#229; det bliver rimelig let at s&#230;tte op.<br />'; echo 'N&#229;r jeg udgiver kildekoderne til mine projekter vil jeg fjerne alt design relateret og blot lade siden holde sin nuv&#230;rende form men med sort baggrund helt uden grafik.<br />'; echo '<br><br>'; echo 'Vh<br />'; echo '<br><br>'; echo 'Nick Asselberghs<br>'; echo 'Admin p&#229; Asselberghs.dk<br />'; ?>
Asselberghs/Game-Project
intro.php
PHP
gpl-3.0
1,629
// Copyright (c) The University of Dundee 2018-2019 // This file is part of the Research Data Management Platform (RDMP). // RDMP 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. // RDMP 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 RDMP. If not, see <https://www.gnu.org/licenses/>. using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; using FAnsi.Discovery; using MapsDirectlyToDatabaseTable; using Rdmp.Core.CohortCommitting.Pipeline; using Rdmp.Core.CommandExecution; using Rdmp.Core.CommandLine.Interactive.Picking; using Rdmp.Core.Curation.Data; using Rdmp.Core.Curation.Data.Aggregation; using Rdmp.Core.Curation.Data.DataLoad; using Rdmp.Core.DataExport.Data; using Rdmp.Core.DataExport.DataExtraction; using Rdmp.Core.DataViewing; using Rdmp.Core.Logging; using Rdmp.Core.Repositories; using Rdmp.Core.Startup; using ReusableLibraryCode; using ReusableLibraryCode.Checks; using ReusableLibraryCode.DataAccess; namespace Rdmp.Core.CommandLine.Interactive { /// <summary> /// Implementation of <see cref="IBasicActivateItems"/> that handles object selection and message notification but is <see cref="IsInteractive"/>=false and throws <see cref="InputDisallowedException"/> on any attempt to illicit user feedback /// </summary> public class ConsoleInputManager : BasicActivateItems { /// <inheritdoc/> public override bool IsInteractive => !DisallowInput; /// <summary> /// Set to true to throw on any blocking input methods (e.g. <see cref="TypeText"/>) /// </summary> public bool DisallowInput { get; set; } /// <summary> /// Creates a new instance connected to the provided RDMP platform databases /// </summary> /// <param name="repositoryLocator">The databases to connect to</param> /// <param name="globalErrorCheckNotifier">The global error provider for non fatal issues</param> public ConsoleInputManager(IRDMPPlatformRepositoryServiceLocator repositoryLocator, ICheckNotifier globalErrorCheckNotifier):base(repositoryLocator,globalErrorCheckNotifier) { } public override void Show(string title,string message) { Console.WriteLine(message); } public override bool TypeText(DialogArgs args, int maxLength, string initialText, out string text, bool requireSaneHeaderText) { WritePromptFor(args); text = ReadLineWithAuto(); return !string.IsNullOrWhiteSpace(text); } public override DiscoveredDatabase SelectDatabase(bool allowDatabaseCreation, string taskDescription) { if (DisallowInput) throw new InputDisallowedException($"Value required for '{taskDescription}'"); Console.WriteLine(taskDescription); var value = ReadLineWithAuto(new PickDatabase()); return value.Database; } public override DiscoveredTable SelectTable(bool allowDatabaseCreation, string taskDescription) { if (DisallowInput) throw new InputDisallowedException($"Value required for '{taskDescription}'"); Console.WriteLine(taskDescription); var value = ReadLineWithAuto(new PickTable()); return value.Table; } public override void ShowException(string errorText, Exception exception) { throw exception ?? new Exception(errorText); } public override bool SelectEnum(DialogArgs args, Type enumType, out Enum chosen) { if (DisallowInput) throw new InputDisallowedException($"Value required for '{args}'"); string chosenStr = GetString(args, Enum.GetNames(enumType).ToList()); try { chosen = (Enum)Enum.Parse(enumType, chosenStr); } catch (Exception) { Console.WriteLine($"Could not parse value. Valid Enum values are:{Environment.NewLine}{string.Join(Environment.NewLine,Enum.GetNames(enumType))}" ); throw; } return true; } public override bool SelectType(DialogArgs args, Type[] available,out Type chosen) { if (DisallowInput) throw new InputDisallowedException($"Value required for '{args}'"); string chosenStr = GetString(args, available.Select(t=>t.Name).ToList()); if (string.IsNullOrWhiteSpace(chosenStr)) { chosen = null; return false; } chosen = available.SingleOrDefault(t => t.Name.Equals(chosenStr)); if(chosen == null) throw new Exception($"Unknown or incompatible Type '{chosen}'"); return true; } public override IMapsDirectlyToDatabaseTable[] SelectMany(DialogArgs args, Type arrayElementType, IMapsDirectlyToDatabaseTable[] availableObjects) { WritePromptFor(args); var value = ReadLineWithAuto(new PickObjectBase[] {new PickObjectByID(this), new PickObjectByName(this)}, availableObjects.Select(t=>t.GetType().Name).Distinct()); var unavailable = value.DatabaseEntities.Except(availableObjects).ToArray(); if(unavailable.Any()) throw new Exception("The following objects were not among the listed available objects " + string.Join(",",unavailable.Select(o=>o.ToString()))); return value.DatabaseEntities.ToArray(); } /// <summary> /// Displays the text described in the prompt theming <paramref name="args"/> /// </summary> /// <param name="args"></param> /// <param name="entryLabel"></param> /// <exception cref="InputDisallowedException">Thrown if <see cref="DisallowInput"/> is true</exception> private void WritePromptFor(DialogArgs args, bool entryLabel = true) { if (DisallowInput) throw new InputDisallowedException($"Value required for '{args}'"); if (!string.IsNullOrWhiteSpace(args.WindowTitle)) { Console.WriteLine(args.WindowTitle); } if (!string.IsNullOrWhiteSpace(args.TaskDescription)) { Console.WriteLine(args.TaskDescription); } if (entryLabel && !string.IsNullOrWhiteSpace(args.EntryLabel)) { Console.Write(args.EntryLabel); } } public override IMapsDirectlyToDatabaseTable SelectOne(DialogArgs args, IMapsDirectlyToDatabaseTable[] availableObjects) { if (DisallowInput) throw new InputDisallowedException($"Value required for '{args}'"); if (availableObjects.Length == 0) throw new Exception("No available objects found"); //handle auto selection when there is one object if (availableObjects.Length == 1 && args.AllowAutoSelect) return availableObjects[0]; Console.WriteLine(args.WindowTitle); Console.Write(args.EntryLabel); var value = ReadLineWithAuto(new PickObjectBase[] {new PickObjectByID(this), new PickObjectByName(this)}, availableObjects.Select(t=>t.GetType().Name).Distinct()); var chosen = value.DatabaseEntities?.SingleOrDefault(); if (chosen == null) return null; if(!availableObjects.Contains(chosen)) throw new Exception("Picked object was not one of the listed available objects"); return chosen; } public override bool SelectObject<T>(DialogArgs args, T[] available, out T selected) { for(int i=0;i<available.Length;i++) { Console.WriteLine(i + ":" + available[i]); } Console.Write(args.EntryLabel); var result = Console.ReadLine(); if(int.TryParse(result, out int idx)) { if(idx >= 0 && idx < available.Length) { selected = available[idx]; return true; } } selected = default(T); return false; } private string ReadLineWithAuto(IEnumerable<string> autoComplete = null) { if (DisallowInput) throw new InputDisallowedException("Value required"); ReadLine.AutoCompletionHandler = new AutoComplete(autoComplete); return ReadLine.Read(); } private CommandLineObjectPickerArgumentValue ReadLineWithAuto(PickObjectBase picker) { if (DisallowInput) throw new InputDisallowedException("Value required"); string line = ReadLineWithAuto(picker.GetAutoCompleteIfAny()); return picker.Parse(line, 0); } private CommandLineObjectPickerArgumentValue ReadLineWithAuto(PickObjectBase[] pickers,IEnumerable<string> autoComplete) { if (DisallowInput) throw new InputDisallowedException("Value required"); string line = ReadLineWithAuto(autoComplete); var picker = new CommandLineObjectPicker(new[]{line},RepositoryLocator,pickers); return picker[0]; } public override DirectoryInfo SelectDirectory(string prompt) { if (DisallowInput) throw new InputDisallowedException($"Value required for '{prompt}'"); Console.WriteLine(prompt); return new DirectoryInfo(Console.ReadLine()); } public override FileInfo SelectFile(string prompt) { if (DisallowInput) throw new InputDisallowedException($"Value required for '{prompt}'"); return SelectFile(prompt, null, null); } public override FileInfo SelectFile(string prompt, string patternDescription, string pattern) { if (DisallowInput) throw new InputDisallowedException($"Value required for '{prompt}'"); Console.WriteLine(prompt); var file = Console.ReadLine(); if(file != null) return new FileInfo(file); return null; } public override FileInfo[] SelectFiles(string prompt, string patternDescription, string pattern) { if (DisallowInput) throw new InputDisallowedException($"Value required for '{prompt}'"); Console.WriteLine(prompt); Console.WriteLine(@"Enter path with optional wildcards (e.g. c:\*.csv):"); var file = Console.ReadLine(); if (file == null) return null; var asteriskIdx = file.IndexOf('*'); if(asteriskIdx != -1) { int idxLastSlash = file.LastIndexOfAny(new []{ Path.DirectorySeparatorChar,Path.AltDirectorySeparatorChar }); if(idxLastSlash == -1 || asteriskIdx < idxLastSlash) throw new Exception("Wildcards are only supported at the file level"); var searchPattern = file.Substring(idxLastSlash+1); var dirStr = file.Substring(0,idxLastSlash); var dir = new DirectoryInfo(dirStr); if(!dir.Exists) throw new DirectoryNotFoundException("Could not find directory:" + dirStr); return dir.GetFiles(searchPattern).ToArray(); } else { return new[]{ new FileInfo(file) }; } } protected override bool SelectValueTypeImpl(DialogArgs args, Type paramType, object initialValue,out object chosen) { WritePromptFor(args); chosen = UsefulStuff.ChangeType(ReadLineWithAuto(), paramType); return true; } public override bool YesNo(DialogArgs args, out bool chosen) { WritePromptFor(args, false); Console.WriteLine(args.EntryLabel + "(Y/n)"); //if user picks no then it's false otherwise true chosen = !string.Equals(Console.ReadLine()?.Trim(), "n", StringComparison.CurrentCultureIgnoreCase); //user made a conscious decision return true; } public string GetString(DialogArgs args, List<string> options) { WritePromptFor(args); ReadLine.AutoCompletionHandler = new AutoComplete(options); return ReadLine.Read(); } public override void ShowData(IViewSQLAndResultsCollection collection) { var point = collection.GetDataAccessPoint(); var db = DataAccessPortal.GetInstance().ExpectDatabase(point,DataAccessContext.InternalDataProcessing); var toRun = new ExtractTableVerbatim(db.Server,collection.GetSql(),Console.OpenStandardOutput(),",",null); toRun.DoExtraction(); } public override void ShowLogs(ILoggedActivityRootObject rootObject) { foreach(var load in base.GetLogs(rootObject).OrderByDescending(l=>l.StartTime)) { Console.WriteLine(load.Description); Console.WriteLine(load.StartTime); Console.WriteLine("Errors:" + load.Errors.Count); foreach(var error in load.Errors) { error.GetSummary(out string title, out string body, out _, out CheckResult _); Console.WriteLine($"\t{title}"); Console.WriteLine($"\t{body}"); } Console.WriteLine("Tables Loaded:"); foreach(var t in load.TableLoadInfos) { Console.WriteLine($"\t{t}: I={t.Inserts:N0} U={t.Updates:N0} D={t.Deletes:N0}"); foreach(var source in t.DataSources) Console.WriteLine($"\t\tSource:{source.Source}"); } Console.WriteLine("Progress:"); foreach(var p in load.Progress) { Console.WriteLine($"\t{p.Date} {p.Description}"); } } } public override void ShowGraph(AggregateConfiguration aggregate) { ShowData(new ViewAggregateExtractUICollection(aggregate)); } public override bool SelectObjects<T>(DialogArgs args, T[] available, out T[] selected) { if(available.Length == 0) { selected = new T[0]; return true; } for(int i=0;i < available.Length; i++) { Console.WriteLine($"{i}:{available[i]}"); } var result = Console.ReadLine(); if (string.IsNullOrWhiteSpace(result)) { // selecting none is a valid user selection selected = new T[0]; return true; } var selectIdx = result.Split(",",StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray(); selected = available.Where((e, idx) => selectIdx.Contains(idx)).ToArray(); return true; } } }
HicServices/RDMP
Rdmp.Core/CommandLine/Interactive/ConsoleInputManager.cs
C#
gpl-3.0
16,346
#!/usr/bin/python # Copyright (C) 2013 rapidhere # # Author: rapidhere <rapidhere@gmail.com> # Maintainer: rapidhere <rapidhere@gmail.com> # # 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 # 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/>. import skapp from optparse import OptionParser import sys parser = OptionParser( usage = "%prog [options]", description = """A simple snake game.Suggest that resize your terminal window at a property size befor playing!""", epilog = "rapidhere@gmail.com", version = "0.1" ) parser.add_option( "","--key-help", action = "store_true",default = False, help = "show game keys" ) opts,args = parser.parse_args() parser.destroy() if opts.key_help: print "'w' or 'W' or UP-Arrow up" print "'a' or 'A' or LF-Arrow left" print "'s' or 'S' or DW-Arrow down" print "'d' or 'D' or RG-Arrpw right" print "'q' or 'Q' quit" sys.exit(0) else: app = skapp.SKApp() app.run()
rapidhere/snake_game
snake_game.py
Python
gpl-3.0
1,496
/** * */ Ext.define('Healthsurvey.view.searchengine.search.DouMeanView', { extend : 'Ext.form.Label', xtype : 'DouMeanView', //margin : '1 1 1 1', bodyStyle : 'background:#D8D8D8', border : 1, requires : [ 'Healthsurvey.view.searchengine.search.DouMeanController' ], controller : 'DouMeanController', initComponent : function() { this.listeners = { scope : 'controller', afterrender : 'onAfterrender', /*render: function(c){ c.getEl().on('click', searchIt); }*/ }, this.callParent(); }, onRender : function() { this.callParent(arguments); this.getEl().on('click', this.onClick, this); }, onClick : function(e, t) { debugger; mainView = this.up().up().up().up().up().up(); mainViewContoller = mainView.controller; searchTextbox = mainView.down("#searchs"); searchTextbox.setValue(this.newSearchString); mainViewContoller.onSolrSearchClick(); } });
applifireAlgo/appApplifire
healthsurvey/src/main/webapp/app/view/searchengine/search/DouMeanView.js
JavaScript
gpl-3.0
913
# -*- coding: utf-8 -*- from __future__ import absolute_import import re try: import regex _regex_available = True except ImportError: _regex_available = False import phonenumbers from six.moves import zip from language_utilities.constant import ENGLISH_LANG from ner_v2.detectors.base_detector import BaseDetector from ner_v2.detectors.numeral.number.number_detection import NumberDetector class PhoneDetector(BaseDetector): """ This method is used to detect phone numbers present in text. The phone detector takes into consideration domestic as well as international phone numbers. Attributes: text(str): string provided to extract phone numbers detection phone (list): list of detected entity values original_phone_text (list): list to store substrings of the text detected as phone numbers """ def __init__(self, entity_name, language=ENGLISH_LANG, locale=None): """ Args: entity_name (str): A string by which the detected numbers would be replaced with on calling detect_entity() language (str, optional): language code of number text, defaults to 'en' locale(str, optional): locale of the country from which you are dialing. Ex: 'en-IN' """ self._supported_languages = NumberDetector.get_supported_languages() super(PhoneDetector, self).__init__(language, locale) self.language = language self.locale = locale or 'en-IN' if _regex_available: # This will replace all types of dashes(em or en) by hyphen. self.locale = regex.sub('\\p{Pd}', '-', self.locale) self.text = '' self.phone, self.original_phone_text = [], [] self.country_code = self.get_country_code_from_locale() self.entity_name = entity_name self.tag = '__' + self.entity_name + '__' @property def supported_languages(self): """ This method returns the list of languages supported by entity detectors Return: list: List of ISO 639 codes of languages supported by subclass/detector """ return self._supported_languages def get_country_code_from_locale(self): """ This method sets self.country_code from given locale """ regex_pattern = re.compile('[-_](.*$)', re.U) match = regex_pattern.findall(self.locale) if match: return match[0].upper() else: return 'IN' def detect_entity(self, text, **kwargs): """Detects phone numbers in the text string Args: text: string to extract entities from **kwargs: it can be used to send specific arguments in future. Returns: self.phone (list): list consisting the detected phone numbers and their country calling codes self.original_phone_text (list): list containing their corresponding substrings in the original message. Examples: text = 'call +1 (408) 912-6172' p = PhoneDetector(entity_name='phone_number', language='en', locale='en-US') p.detect_entity(text=text) ([{'country_calling_code':'1', value':'4089126172'} ], [u'+1 (408) 912-6172']) text = '+९१ ९८१९९८३१३२ पर कॉल करें और संदेश ९८२०३३४४१६ पर कॉल करें' p = PhoneDetector(entity_name='phone_number', language='hi', locale='en-IN') p.detect_entity(text=text) ([{'country_calling_code':'91', value':'9819983132'} ,{ 'country_calling_code':'91', value:'9820334416'} ], [u'+९१ ९८१९९८३१३२', u'+९१ ९८१९९८३१३२']) """ self.text = " " + text.lower().strip() + " " self.phone, self.original_phone_text = [], [] for match in phonenumbers.PhoneNumberMatcher(self.text, self.country_code, leniency=0): if match.number.country_code == phonenumbers.country_code_for_region(self.country_code): self.phone.append(self.check_for_country_code(str(match.number.national_number))) self.original_phone_text.append(self.text[match.start:match.end]) else: # This means our detector has detected some other country code. self.phone.append({"country_calling_code": str(match.number.country_code), "value": str(match.number.national_number)}) self.original_phone_text.append(self.text[match.start:match.end]) self.phone, self.original_phone_text = self.check_for_alphas() return self.phone, self.original_phone_text def check_for_alphas(self): """ checks if any leading or trailing alphabets in the detected phone numbers and removes those numbers """ validated_phone = [] validated_original_text = [] for phone, original in zip(self.phone, self.original_phone_text): if re.search(r'\W' + re.escape(original) + r'\W', self.text, re.UNICODE): validated_phone.append(phone) validated_original_text.append(original) return validated_phone, validated_original_text def check_for_country_code(self, phone_num): """ :param phone_num: the number which is to be checked for country code :return: dict with country_code if it's in phone_num or phone_number with current country code Examples: phone_num = '919123456789' countryCallingCode = 'IN' {countryCallingCode:"91",value:"9123456789"} """ phone_dict = {} if len(phone_num) > 10: check_country_regex = re.compile(r'^({country_code})\d{length}$'. format(country_code='911|1|011 91|91', length='{10}'), re.U) p = check_country_regex.findall(phone_num) if len(p) == 1: phone_dict['country_calling_code'] = p[0] country_code_sub_regex = re.compile(r'^{detected_code}'.format(detected_code=p[0])) phone_dict['value'] = country_code_sub_regex.sub(string=phone_num, repl='') else: phone_dict['country_calling_code'] = str(phonenumbers.country_code_for_region(self.country_code)) phone_dict['value'] = phone_num else: phone_dict['country_calling_code'] = str(phonenumbers.country_code_for_region(self.country_code)) phone_dict['value'] = phone_num return phone_dict
hellohaptik/chatbot_ner
ner_v2/detectors/pattern/phone_number/phone_number_detection.py
Python
gpl-3.0
6,667
# See bottom of file for license and copyright information package Foswiki::Contrib::DBIStoreContrib::LinkHandler; # Links table -> subset of Topic_History use strict; use warnings; use Assert; use IO::File (); use DBI (); use File::Copy (); use File::Spec (); use File::Path (); use Fcntl qw( :DEFAULT :flock SEEK_SET ); use DBI (); use DBD::Pg (); use Data::UUID (); use Digest::SHA1 qw(sha1 sha1_hex sha1_base64); use File::Slurp qw(write_file); use DBI qw(:sql_types); use File::Basename (); use Foswiki::Func (); use base ("Foswiki::Contrib::DBIStoreContrib::TopicHandler"); # (Handler object) -> LinkHandler Object sub init { # TODO:check that the argument is a handler object First! # blah........ my $class = shift; my $this = shift; return bless($this,$class); } my %SourceToMetaHash = ( 'saveTopic' => { ### - Start #################################### ### @vars=($topicObject, $cUID,\%th_row_ref) 'TOPICINFO' => sub { return undef; }, 'TOPICMOVED'=> sub { return undef; }, 'TOPICPARENT'=> sub { # nothing needs to be done because the parent data was already written to the LINK meta data in the $topicObject return undef; }, 'FILEATTACHMENT'=> sub { return undef; }, 'FORM'=> sub { return undef; }, 'FIELD'=> sub { return undef; }, 'PREFERENCE'=> sub { return undef; } , 'LINKS'=> sub { my ($this,$topicObject, $cUID,$th_row_ref) = @_; # (require => [ 'link_type' ], allow => [ 'dest_t', 'dest_th', 'dest_a', 'dest_ah', 'blob_key' ]) my @ListOfDests = ('link_type','dest_t','dest_th','dest_a','dest_ah','blob_key'); my @links = $topicObject->find( 'LINK' ); my %alreadyDone; my @linksGuid; my @parent_counter; foreach my $link (@links){ # insert the link my %link_hash; my @alreadyDoneTemp; push(@alreadyDoneTemp, $th_row_ref->{key}); $link_hash{topic_history_key} = $th_row_ref->{key}; foreach my $destKey (@ListOfDests) { $link_hash{$destKey} = $link->{$destKey}; push(@alreadyDoneTemp,$link_hash{$destKey}); } my ($thlink,$linktype, $dest_t) =($link_hash{topic_history_key},$link_hash{link_type},$link_hash{dest_t}); push(@linksGuid,$link_hash{link_type}.'@'.$link_hash{dest_t}); # make sure we are not double counting $this->insert_link(\%link_hash);# unless $alreadyDone{join(',',@alreadyDoneTemp)}; $alreadyDone{join(',',@alreadyDoneTemp)} = 1; if($link_hash{link_type} eq 'PARENT'){ my $crap = $link_hash{dest_t}; push(@parent_counter,$crap); } } return 1; } }, #### saveTopic - Finished 'convertForSaveTopic' => { ### - Start #################################### ### @vars=($topicObject,$cUID,$options) 'TOPICINFO' => sub { return undef; }, 'TOPICMOVED'=> sub { return undef; }, 'TOPICPARENT'=> sub { my ($this,$topicObject,$cUID,$options) = @_; # clean up the parent link my $parent_name = $topicObject->getParent(); # TODO: change WebHome to match the offical webhome in Webs $parent_name = 'WebHome' unless $parent_name; # (web.topic)-> topic_key); my ($web,$topic) = Foswiki::Func::normalizeWebTopicName($topicObject->web, $parent_name); my $parent_key = $this->fetchTopicKeyByWT($web,$topic); unless($parent_key){ $this->LoadTHRow($web,$topic,''); $parent_key = $this->fetchTopicKeyByWT($web,$topic); return 0 unless $parent_key; } # replace the TOPICPARENT meta in the $topicObject # type -> (LINK, IMAGE, INCLUDE, PARENT) # -note- not using putKeyed instead of put b/c we want to add not replace this row my %linkRef; $linkRef{link_type} = 'PARENT'; $linkRef{dest_t} = $parent_key; $this->putMetaLink($topicObject,\%linkRef); # $topicObject->put( 'LINK',\%linkRef ) # finished- return 1; }, 'FILEATTACHMENT'=> sub { return undef; }, 'FORM'=> sub { ###### This is to make sure that the dataform definition is properly linked ##### my ($this,$topicObject,$cUID,$options) = @_; ## Get FORM (web,topic) my $form_ref = $topicObject->get('FORM'); return undef unless $form_ref; my ($formWeb,$formTopic) = Foswiki::Func::normalizeWebTopicName($topicObject->web,$form_ref->{name}); ## Need to get the namekey my $th_key = $this->fetchTHKeyByWTR($formWeb,$formTopic); unless($th_key){ # do a SELECT to get the th_key my $throwRef = $this->LoadTHRow($formWeb,$formTopic); $th_key = $throwRef->{key}; } # put the Form name key # type -> (LINK, IMAGE, INCLUDE, PARENT) # (require => [ 'link_type' ], allow => [ 'dest_t', 'dest_th', 'dest_a', 'dest_ah', 'blob_key' ]) my %linkRef; $linkRef{link_type} = 'LINK'; $linkRef{dest_th} = $th_key; $this->putMetaLink($topicObject,\%linkRef); # $topicObject->put( 'LINK',\%linkRef ) return 1; }, 'FIELD'=> sub { return undef; }, 'PREFERENCE'=> sub { return undef; } , 'LINKS'=> sub { # (require => [ 'link_type' ], allow => [ 'dest_t', 'dest_th', 'dest_a', 'dest_ah', 'blob_key' ]) my ($this,$topicObject,$cUID,$options) = @_; my @link_hash; my $text = $topicObject->text; #### do a search #### my @links_match = ($text =~ m/\[+(\[(\/?[^(\[|\])]+)\])?(\[(\/?[^(\[|\])]+)\])\]/g); # [[web.topic][original text]] -> $2 web.topic $4 original text or $4 web.topic my $scalarB = scalar(@links_match); my $i = 0; my @b_return; my %lhash; while($i < $scalarB){ my ($linkWT,$origText); ($linkWT,$origText) = ($links_match[$i+1],$links_match[$i+3]) if $links_match[$i]; ($linkWT,$origText) = ($links_match[$i+3],'') unless $links_match[$i]; my ($link_web,$link_topic) = Foswiki::Func::normalizeWebTopicName($topicObject->web,$linkWT); ## Need to get the namekey my $throwRef = $this->LoadTHRow($link_web,$link_topic); my $link_topic_key = $this->fetchTopicKeyByWT($link_web,$link_topic); $lhash{$linkWT} = $link_topic_key; ### replace ### if($lhash{$linkWT}){ bless $this, *Foswiki::Contrib::DBIStoreContrib::LinkHandler; $this->putMetaLink($topicObject,{name => join('&',$link_topic_key,'LINK'), dest_t => $link_topic_key, link_type => 'LINK'}); my $replace_text; $replace_text = '[['.$lhash{$linkWT}.']['.$origText.']]' if $origText ; $replace_text = '[['.$lhash{$linkWT}.']]' unless $origText; #$replace_text = _escapebad($replace_text); # (\[\[$linkWT\]\]) $text =~ s/(\[\[$linkWT\]\[$origText\]\])/$replace_text/g if $origText; $text =~ s/(\[\[$linkWT\]\])/$replace_text/g unless $origText; } # increment by 4 $i += 4; } $topicObject->text($text); return 1; } }, #### convertForSaveTopic - Finished 'readTopic' => { ### - Start ############ $topicObject,$topic_row ################## 'TOPICINFO' => sub { return undef; }, 'TOPICMOVED'=> sub { return undef; }, 'TOPICPARENT'=> sub { my $this = shift; my ($topicObject,$topic_row) = @_; my $arrayRef = $this->LoadLHRow($topic_row->{key}); foreach my $rowref (@$arrayRef) { if($rowref->{link_type} eq 'PARENT'){ my $topic_key = $rowref->{dest_t}; #die "Parent: $topic_key\n"; my ($web_name,$topic_name) = $this->LoadWTFromTopicKey($topic_key); $topicObject->putKeyed( 'TOPICPARENT', { name => "$web_name.$topic_name" } ); return "$web_name.$topic_name"; } } return undef; }, 'FILEATTACHMENT'=> sub { return undef; }, 'FORM'=> sub { return undef; }, 'FIELD'=> sub { return undef; }, 'PREFERENCE'=> sub { return undef; }, 'LINKS'=> sub { # (require => [ 'link_type' ], allow => [ 'dest_t', 'dest_th', 'dest_a', 'dest_ah', 'blob_key' ]) my $this = shift; my ($topicObject,$topic_row) = @_; my $text = $topicObject->text; ### Load the topicObject ### my $arrayRef = $this->LoadLHRow($topic_row->{key}); my @toasty; foreach my $link_ref (@$arrayRef){ $this->putMetaLink($topicObject,$link_ref); if($link_ref->{link_type} eq 'LINK'){ my $dest_t_key = $link_ref->{dest_t}; my $temp_dest_t_key = quotemeta($dest_t_key); my @links_match_a = ($text =~ m/(\[+(\[($temp_dest_t_key)\])?(\[(\/?[^(\[|\]|$temp_dest_t_key)]+)\])\])/g); # [[web.topic][original text]] -> $3 guid $5 original text my @links_match_b = ($text =~ m/(\[+(\[($temp_dest_t_key)\])\])/g); # [[web.topic]] -> $3 guid my @links_match = ($text =~ m/(\[\[($temp_dest_t_key)\]\]|\[\[($temp_dest_t_key)\]\[(.*)\]\])/g); my $scalarA = scalar(@links_match_a); my $scalarB = scalar(@links_match_b); my $scalarTotal = scalar(@links_match); my $i = 0; my ($linkWTkey,$origText); my $replace_text; my $linkWT; while( $i < $scalarTotal ){ my $halfNotFull = 0; $halfNotFull = 1 if $links_match[$i+1]; ($linkWTkey,$origText) = ($links_match[$i+2],$links_match[$i+3]) unless $halfNotFull; # [[guid][blah]] -> $3 guid, $4 blah ($linkWTkey,$origText) = ($links_match[$i+1],'') if $halfNotFull; # [[guid]] -> $2 guid # (\[\[$linkWT\]\]) $linkWT = $link_ref->{'dest_t_webname'}.'.'.$link_ref->{'dest_t_topicname'}; $linkWT = $link_ref->{'dest_t_topicname'} if $link_ref->{'dest_t_webname'} eq $topicObject->web; $replace_text = '[['.$linkWT.']['.$origText.']]' unless $halfNotFull; $replace_text = '[['.$linkWT.']]' if $halfNotFull; my $old_text; $old_text = "[[$linkWTkey][$origText]]" unless $halfNotFull; $old_text = "[[$linkWTkey]]" if $halfNotFull; $old_text = quotemeta($old_text); $text =~ s/($old_text)/$replace_text/g; # increment by 4 $i += 4; } } } $topicObject->text($text); return undef; } }, #### readTopic - Finished 'moveTopic' => { ### - Start ########## $throw_key ################## 'TOPICMOVED' => sub { my ($this,$oldthkey,$newthkey) = @_; $this->move_link($oldthkey,$newthkey); return undef; } } #### moveTopic - Finished ); ############################################################################################ ######################## Listener Call Distributor ############################# ############################################################################################ sub listener { my $site_handler = shift; my $sourcefunc = shift; my @vars = @_; # will need this after calling listeners in order to set the site_handler back to what it was before my $currentClass = ref($site_handler); # need to initialize the object my $this = Foswiki::Contrib::DBIStoreContrib::LinkHandler->init($site_handler); # these are pieces of the Meta topicObject my @MetaHashObjects = ('TOPICINFO','TOPICMOVED','TOPICPARENT','FILEATTACHMENT','FORM','FIELD','PREFERENCE','CONTENT','LINKS'); my $sourcFuncRef = $SourceToMetaHash{$sourcefunc}; foreach my $MetaHash (@MetaHashObjects) { $SourceToMetaHash{$sourcefunc}{$MetaHash}->($this,@vars) if exists($SourceToMetaHash{$sourcefunc}{$MetaHash}); } # return handler to previous state bless $this, $currentClass; } ############################ General Purpose Link Move ################################# # move Link sub move_link { my ($this,$oldthkey,$newthkey) = @_; my $Links = $this->getTableName('Links'); # sha1( 1-source, 2-destination_topic, 3-destination_attachment, 4-destination_topic_history, 5-destination_attachment_history, 6-link_type, 7-blob_key) # foswiki.sha1_uuid(foswiki.text2bytea(?||df1.definition_key)||df1."values") my $byteaGen = qq/foswiki.text2bytea(array_to_string(array[?::text,l1.destination_topic::text,l1.destination_attachment::text,l1.destination_topic_history::text, l1.destination_attachment_history::text,l1.link_type::text,l1.blob_key::text],'')::text)/; # 1-$newthkey my $insertStatement = qq/INSERT INTO $Links ("key", topic_history_key, destination_topic, destination_attachment, destination_topic_history,destination_attachment_history, link_type, blob_key, original_text) SELECT foswiki.sha1_uuid($byteaGen), ?, l1.destination_topic, l1.destination_attachment, l1.destination_topic_history, l1.destination_attachment_history, l1.link_type, l1.blob_key, l1.original_text FROM $Links l1 WHERE l1.topic_history_key = ?/; # 1-$newthkey, 2-$newthkey, 3-$oldthkey my $insertHandler = $this->database_connection()->prepare($insertStatement); $insertHandler->execute($newthkey,$newthkey,$oldthkey); # nothing to return return 0; } ############################ General Purpose Link Insert ################################# # insert Link sub insert_link { my ($this,$link_hash) = @_; my $Links = $this->getTableName('Links'); # Link-Key: sha1( 1-source, 2-destination_topic, 3-destination_attachment, 4-destination_topic_history, 5-destination_attachment_history, 6-link_type, 7-blob_key) $link_hash->{'key'} = substr(sha1_hex($link_hash->{'topic_history_key'},$link_hash->{'dest_t'},$link_hash->{'dest_a'},$link_hash->{'dest_th'},$link_hash->{'dest_ah'},$link_hash->{'link_type'},$link_hash->{'blob_key'}),0,-8); my $parentname = $link_hash->{'parent_name'}; # make sure we are not inserting a null row die "Null Parent\n" unless( $link_hash->{'dest_t'} || $link_hash->{'dest_a'} || $link_hash->{'dest_th'} || $link_hash->{'dest_ah'}); #return undef unless( $link_hash->{'dest_t'} || $link_hash->{'dest_a'} || $link_hash->{'dest_th'} || $link_hash->{'dest_ah'}); # (require => [ 'link_type' ], allow => [ 'dest_t', 'dest_th', 'dest_a', 'dest_ah', 'blob_key' ]) my $insertStatement = qq/INSERT INTO $Links ("key", topic_history_key, destination_topic, destination_attachment, destination_topic_history,destination_attachment_history, blob_key, link_type, original_text) SELECT ?,?,?,?,?,?,?,?,? WHERE NOT EXISTS (SELECT 1 FROM $Links l1 WHERE l1."key" = ? );/; # this loop is needed b/c Postgres considers '' and undef to be different foreach my $undefCol ('dest_t','dest_a','dest_th','dest_ah'){ delete $link_hash->{$undefCol} unless length($link_hash->{$undefCol}) > 2; # <-- 2 is just a random number, we need to test for UUIDs } my $insertHandler = $this->database_connection()->prepare($insertStatement); $insertHandler->bind_param( 1, $link_hash->{'key'}); $insertHandler->bind_param( 2, $link_hash->{'topic_history_key'}); $insertHandler->bind_param( 3, $link_hash->{'dest_t'}); # destination_topic $insertHandler->bind_param( 4, $link_hash->{'dest_a'}); # destination_attachment $insertHandler->bind_param( 5, $link_hash->{'dest_th'}); # destination_topic_history $insertHandler->bind_param( 6, $link_hash->{'dest_ah'}); # destination_attachment_history $insertHandler->bind_param( 7, $link_hash->{'blob_key'},{ pg_type => DBD::Pg::PG_BYTEA }); # blob_key $insertHandler->bind_param( 8, $link_hash->{'link_type'}); $insertHandler->bind_param( 9, $link_hash->{'original_text'}); $insertHandler->bind_param( 10, $link_hash->{'key'}); $insertHandler->execute; return $link_hash->{'key'}; } # ($th_key)-> enough columns to do Meta Put sub LoadLHRow { my $this = shift; my $th_key = shift; return undef unless $th_key; # may be we already looked it up my @arrayReturn; return $this->fetchLinks($th_key) if $this->fetchLinks($th_key); my $Links = $this->getTableName('Links'); my $Topics = $this->getTableName('Topics'); my $selectStatement = qq/ SELECT l1."key", l1.topic_history_key, l1.destination_topic, l1.link_type, l1.destination_topic_history, l1.destination_attachment_history, l1.destination_attachment, dest_t.current_web_key AS dest_t_web, dest_t_tname."value" AS dest_t_topic FROM foswiki."Links" l1 LEFT JOIN (foswiki."Topics" dest_t INNER JOIN foswiki."Blob_Store" dest_t_tname ON dest_t.current_topic_name = dest_t_tname."key") ON l1.destination_topic = dest_t."key" LEFT JOIN (foswiki."Topic_History" dest_th INNER JOIN foswiki."Blob_Store" dest_th_tname ON dest_th.topic_name = dest_th_tname."key") ON l1.destination_topic_history = dest_th."key" WHERE l1.topic_history_key = ? ;/; # 1-th_key my $selectHandler = $this->database_connection()->prepare($selectStatement); $selectHandler->execute($th_key); while(my $rowref = $selectHandler->fetchrow_arrayref){ # 0-lh_key, 1-thkey, 2-destination_topic, 3-link_type, 4-destination_topic_history, 5-destination_attachment_history, 6-destination_attachment, # 7-dest_t_web, 8-dest_t_topic # (require => [ 'link_type' ], allow => [ 'dest_t', 'dest_th', 'dest_a', 'dest_ah', 'blob_key' ]) my $SinRow = {'link_type'=> $rowref->[3]}; $SinRow->{'dest_t'} = $rowref->[2]; $this->LoadWTFromTopicKey($SinRow->{'dest_t'}) if $SinRow->{'dest_t'}; $SinRow->{'dest_th'} = $rowref->[4]; $SinRow->{'dest_a'} = $rowref->[5]; $SinRow->{'dest_ah'} = $rowref->[6]; $SinRow->{'dest_t_web'} = $rowref->[7]; $SinRow->{'dest_t_topicname'} = $rowref->[8]; if($SinRow->{'dest_t'}){ my $web_name_dest_t = $this->getWebName($SinRow->{'dest_t_web'}); $SinRow->{'dest_t_webname'} = $web_name_dest_t; $this->putTopicKeyByWT($web_name_dest_t,$SinRow->{'dest_t_topicname'},$SinRow->{'dest_t'}); } push(@arrayReturn,$SinRow); } $this->putLinks($th_key,\@arrayReturn); return \@arrayReturn; } #### Fetchers #### # ($th_key)-> \@links sub fetchLinks { my $this = shift; my $th_key = shift; my $array_of_links = $this->{link_cache}->{$th_key}; return $array_of_links if $array_of_links; # if not in local cache, check memcached return $this->fetchMemcached('link_cache',$th_key); } sub putLinks { my $this = shift; my $th_key = shift; my $array_of_links = shift; $this->{link_cache}->{$th_key} = $array_of_links; # put this in Memcache $this->putMemcached('link_cache',$th_key,$array_of_links); return $array_of_links; } # since LINKS are keyed, we need a creative way to make an index sub putMetaLink { my $this = shift; my ($topicObject,$linkref) = @_; # (require => [ 'link_type' ], allow => [ 'dest_t', 'dest_th', 'dest_a', 'dest_ah', 'blob_key' ]) my @cols10 = ('link_type','dest_t','dest_th','dest_a','dest_ah','blob_key'); my @nameAssembly; foreach my $c1001 (@cols10){ push(@nameAssembly,$linkref->{$c1001}); } # change name if this is a parent link (should only be 1 parent) $linkref->{name} = 'PARENT' if $linkref->{link_type} eq 'PARENT'; # make sure that there is a name for each link if(!$linkref->{name} && scalar(@nameAssembly) > 0){ # this part is to get rid of some annoying warnings, but not errors $linkref->{name} = $nameAssembly[0]; for (my $count33855 = 1; $count33855 < scalar(@nameAssembly); $count33855++) { $linkref->{name} .= ','.$nameAssembly[$count33855] if $nameAssembly[$count33855]; } } #die "Assembly: @nameAssembly" if $linkref->{link_type} eq 'LINK'; $topicObject->putKeyed( 'LINK',$linkref ); } # 4 inputs, 1 output sub _link_subber { my $lhash = shift; my @ar = @_; # $2 web.topic, $4 orig text OR $4 web.topic my $return_text; return '[['.$lhash->{$ar[3]}.']]' unless $ar[0]; return '[['.$lhash->{$ar[1]}.']['.$ar[3].']]' if $ar[0]; } # allows us to do search and replace sub _escapebad { my $string = shift; my $newstring =~ /\Q$string\E/; #bad chars turned good return $newstring; } 1; __END__ SELECT w1.current_web_name as web, tname."value" as topic, l1.link_type || '->' ||l1.destination_topic as links FROM foswiki."Topic_History" th1 INNER JOIN foswiki."Topics" t1 ON t1.link_to_latest = th1."key" INNER JOIN foswiki."Blob_Store" tname ON tname."key" = th1.topic_name INNER JOIN foswiki."Webs" w1 ON w1."key" = th1.web_key INNER JOIN foswiki."Links" l1 ON l1.topic_history_key = th1."key", foswiki."Sites" s1 WHERE s1."key" = w1.site_key AND s1.current_site_name = 'tokyo.e-flamingo.net' AND w1.current_web_name = 'Corporate' AND tname."value" = 'WebHome';
favioflamingo/wiki
perl/lib/Foswiki/Contrib/DBIStoreContrib/LinkHandler.pm
Perl
gpl-3.0
19,449
# Webtris A simple Tetris clone written in JavaScript, meant to teach beginner programmers how to design games To see a demo of the game, <a href="http://originalgrego.github.io/Webtris/Webtris_final/Webtris.html" target="_blank">click here</a>
originalgrego/Webtris
README.md
Markdown
gpl-3.0
246
/* * Decompiled with CFR 0_115. * * Could not load the following classes: * android.graphics.drawable.Drawable * android.widget.CompoundButton */ package android.support.v4.widget; import android.graphics.drawable.Drawable; import android.widget.CompoundButton; class CompoundButtonCompatApi23 { CompoundButtonCompatApi23() { } static Drawable getButtonDrawable(CompoundButton compoundButton) { return compoundButton.getButtonDrawable(); } }
SPACEDAC7/TrabajoFinalGrado
uploads/34f7f021ecaf167f6e9669e45c4483ec/java_source/android/support/v4/widget/CompoundButtonCompatApi23.java
Java
gpl-3.0
479
package com.john.kalimeris.notes; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; /** * Created by John on 02/10/16. */ public class DatabaseHandler extends SQLiteOpenHelper { private static final String DATABASE_NAME = "notes.db"; private static final int DATABASE_VERSION = 3; public static final String TABLE = "notes"; public static final String COLUMN_ID = "id"; public static final String COLUMN_TITLE= "title"; public static final String COLUMN_DESCRIPTION = "description"; public static final String COLUMN_DATE= "date"; public static final String COLUMN_COLOR= "color"; public static final String COLUMN_EVENT_ID= "eventId"; public static final String COLUMN_CHECK= "check_note"; // Database creation sql statement private static final String DATABASE_CREATE = "create table " + TABLE + "( " + COLUMN_ID + " integer primary key autoincrement, " + COLUMN_TITLE + " text not null, " + COLUMN_DESCRIPTION + " text, " + COLUMN_DATE + " text, " + COLUMN_COLOR + " text, " + COLUMN_EVENT_ID + " INTEGER DEFAULT -1, " + COLUMN_CHECK + " INTEGER DEFAULT 0);"; public DatabaseHandler(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase database) { database.execSQL(DATABASE_CREATE); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { Log.w(DatabaseHandler.class.getName(), "Upgrading database from version " + oldVersion + " to " + newVersion + ", which will destroy all old data"); db.execSQL("DROP TABLE IF EXISTS " + TABLE); onCreate(db); } }
JohnKal/Notes
app/src/main/java/com/john/kalimeris/notes/DatabaseHandler.java
Java
gpl-3.0
1,924
/* * This is small example how to use libZPlay library to play files. * This example is using OpenFile functions to open disk files and play. * */ #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <olectl.h> #include <ole2.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <conio.h> #include <dos.h> #include <conio.h> #include "../include/libzplay.h" using namespace libZPlay; ZPlay* player; int __stdcall CallbackFunc(void* instance, void *user_data, TCallbackMessage message, unsigned int param1, unsigned int param2); int main(int argc, char **argv) { // clear screen system("CLS"); // create class instance player = CreateZPlay(); // chek if we have class instance if(player == 0) { printf("Error: Can't create class instance !\nPress key to exit.\n"); getch(); return 0; } // get library version int ver = player->GetVersion(); // check if we have version 2.00 and above if(ver < 200) { printf("Error: Need library version 2.00 and above !\nPress key to exit.\r\n"); getch(); player->Release(); return 0; } // display version info printf("libZPlay v.%i.%02i\r\n\r\n", ver / 100, ver % 100); if(argc > 1) { TID3InfoEx id3_info; if(player->LoadFileID3Ex(argv[1], sfAutodetect, &id3_info, 1)) // loading ID3v2 { printf("Title: %s\r\n", id3_info.Title); printf("Artist: %s\r\n", id3_info.Artist); printf("Album: %s\r\n", id3_info.Album); printf("Year: %s\r\n", id3_info.Year); printf("Comment: %s\r\n", id3_info.Comment); printf("Genre: %s\r\n", id3_info.Genre); printf("Track: %s\r\n\r\n", id3_info.TrackNum); printf("Artist1 : %s\r\n", id3_info.AlbumArtist ); printf("Composer: %s\r\n", id3_info.Composer ); printf("Original: %s\r\n", id3_info.OriginalArtist ); printf("Copyright: %s\r\n", id3_info.Copyright ); printf("URL: %s\r\n", id3_info.URL ); printf("Encoder: %s\r\n", id3_info.Encoder ); printf("Publisher: %s\r\n", id3_info.Publisher ); printf("BPM: %u\r\n", id3_info.BPM); printf("MIME: %s\r\n", id3_info.Picture.MIMEType); printf("TYPE: %u\r\n", id3_info.Picture.PictureType); printf("Desc: %s\r\n", id3_info.Picture.Description); printf("Size: %u\r\n", id3_info.Picture.PictureDataSize); // draw picture on desktop window player->DrawBitmapToHWND(NULL, 0, 0, 0, 0, id3_info.Picture.hBitmap); } else { printf("No ID3 data\r\n\r\n"); } } else { // no filename in argument player->Release(); // delete ZPlay class char *end = strrchr(argv[0], '\\'); if(end && *(end + 1) != 0) end++; else end = argv[0]; printf("Usage: %s filename\r\n\r\nPress key to exit\r\n", end); getch(); return 0; } getch(); }
hbuexinxin/AirZPlayer
Code/libzplay-2.02-sdk/C++/example/display_id3.cpp
C++
gpl-3.0
2,995
puppetHPCC ========== dd A puppet module for easy deletion of directories and their contained files through the use of glob like expressions. example, can easily remove all files with the appendix -rc1 etc. hosts A puppet module using templates to create the /etc/hosts file on our agent machines. pconf A puppet module using templates to create the /etc/puppet/puppet.conf file on all our deployed machines.
Michael-Gardner/modules
README.md
Markdown
gpl-3.0
432
#!/bin/sh #----------------------------------------------------------------------------- # # This is an especially complex case of the coastline looping back on # itself. # #----------------------------------------------------------------------------- # shellcheck source=test/init.sh . "$1/test/init.sh" set -x #----------------------------------------------------------------------------- cat <<'OSM' >"$INPUT" n100 v1 dV c0 t i0 u T x1.00 y1.07 n101 v1 dV c0 t i0 u T x1.00 y1.06 n102 v1 dV c0 t i0 u T x1.00 y1.03 n103 v1 dV c0 t i0 u T x1.00 y1.02 n104 v1 dV c0 t i0 u T x1.00 y1.05 n105 v1 dV c0 t i0 u T x1.00 y1.04 w200 v1 dV c0 t i0 u Tnatural=coastline Nn101,n100 w201 v1 dV c0 t i0 u Tnatural=coastline Nn100,n101,n104 w202 v1 dV c0 t i0 u Tnatural=coastline Nn103,n102,n105 w203 v1 dV c0 t i0 u Tnatural=coastline Nn105,n104 w204 v1 dV c0 t i0 u Tnatural=coastline Nn104,n105 w205 v1 dV c0 t i0 u Tnatural=coastline Nn104,n101 OSM #----------------------------------------------------------------------------- "$OSMC" --verbose --overwrite --srs="$SRID" --output-database="$DB" "$INPUT" >"$LOG" 2>&1 RC=$? set -e test $RC -eq 2 grep '^There were 3 warnings.$' "$LOG" grep '^There were 2 errors.$' "$LOG" check_count land_polygons 0; check_count error_points 2; check_count error_lines 4; #-----------------------------------------------------------------------------
osmcode/osmcoastline
test/t/invalid-complex-overlap.sh
Shell
gpl-3.0
1,391
/* * This file is part of MinecartRevolutionTags. * Copyright (c) 2013 QuarterCode <http://www.quartercode.com/> * * MinecartRevolutionTags 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. * * MinecartRevolutionTags 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 MinecartRevolutionTags. If not, see <http://www.gnu.org/licenses/>. */ package com.quartercode.minecartrevolutiontags; import java.util.Arrays; import org.bukkit.block.Sign; import org.bukkit.entity.Minecart; import com.quartercode.minecartrevolution.core.control.sign.ControlSign; import com.quartercode.minecartrevolution.core.control.sign.ControlSignInfo; public class TagSign extends ControlSign { public TagSign() { } @Override protected ControlSignInfo createInfo() { return new ControlSignInfo("Tag", "Adds or removes minecart tags", "tag.place", "tag.destroy", "tag"); } @Override public void execute(Minecart minecart, String label, Sign sign) { for (String line : Arrays.copyOfRange(sign.getLines(), 1, sign.getLines().length)) { if (!line.isEmpty()) { executeExpression(minecart, "tag " + line); } } } }
QuarterCode/MinecartRevolutionTags
src/main/java/com/quartercode/minecartrevolutiontags/TagSign.java
Java
gpl-3.0
1,695
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) 2011 Yann GUIBET <yannguibet@gmail.com> # See LICENSE for details. import sys, os from gevent import select, monkey, spawn, Greenlet, GreenletExit, sleep, socket from base64 import b64encode from hashlib import md5 from struct import pack, unpack from zlib import adler32 from Proto import Proto from Index import Index from Config import * class Client(Proto): def __init__(self, vpn): self.vpn = vpn def close(self): try: self.sock.close() except: pass def error(self, exp): self.close() def connect(self, host, port, pubkey): try: self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.connect((host, port)) self.handshake(pubkey) except Exception as e: self.error(e) raise def handshake(self, pubkey): self.send_id() myiv = self.send_iv() iv = self.get_iv(pubkey) self.init_cipher(pubkey, myiv, iv) def recv_file(self): if self.srecvall(1) != "\x01": self.ssend("\xFF") raise Exception, "Bad Flags (0x01 expected)" size = self.srecvall(4) checksum = self.srecvall(4) if adler32(size) != unpack('!I',checksum)[0]: self.ssend("\xFF") raise Exception, "Bad checksum" size = unpack('!I', size)[0] buffer = self.srecvall(size) hash = self.srecvall(16) if md5(buffer).digest() != hash: self.ssend("\xFF") raise Exception, "Bad md5 ..." return buffer def get_file(self, id, name): path = os.path.join(inbox, name) while os.path.exists(path): name = "_"+name path = os.path.join(inbox, name) #raise Exception, "%s already exist ..." % path self.ssend("\x02"+pack('!I',id)) buff = self.recv_file() with open(path, "wb") as f: f.write(buff) def get_index(self, id): index = Index(id) buffer = index.get_xml().encode('utf-8') hash = md5(buffer).digest() self.ssend('\x03'+hash) flag = self.srecvall(1) if flag == "\x04": buffer = self.recv_file() index.set_xml(buffer) elif flag == "\x05": pass else: raise Exception, "Protocol Error"
yann2192/vpyn
Client.py
Python
gpl-3.0
2,459
/* * Copyright (C) 2015 Uhlig e Korovsky Tecnologia Ltda - ME * * 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 br.com.uktech.bmt.bacula.bean; import java.io.Serializable; import java.util.Date; import java.util.Objects; /** * * @author Carlos Alberto Cipriano Korovsky <carlos.korovsky@uktech.com.br> */ // public class BaculaVersion implements Serializable { private Integer major; private Integer minor; private Integer revision; private Date release; private String uname; public Integer getMajor() { return major; } public void setMajor(Integer major) { this.major = major; } public Integer getMinor() { return minor; } public void setMinor(Integer minor) { this.minor = minor; } public Integer getRevision() { return revision; } public void setRevision(Integer revision) { this.revision = revision; } public Date getRelease() { return release; } public void setRelease(Date release) { this.release = release; } public String getUname() { return uname; } public void setUname(String uname) { this.uname = uname; } @Override public int hashCode() { int hash = 5; hash = 11 * hash + Objects.hashCode(this.major); hash = 11 * hash + Objects.hashCode(this.minor); hash = 11 * hash + Objects.hashCode(this.revision); hash = 11 * hash + Objects.hashCode(this.release); hash = 11 * hash + Objects.hashCode(this.uname); return hash; } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final BaculaVersion other = (BaculaVersion) obj; if (!Objects.equals(this.major, other.major)) { return false; } if (!Objects.equals(this.minor, other.minor)) { return false; } if (!Objects.equals(this.revision, other.revision)) { return false; } if (!Objects.equals(this.release, other.release)) { return false; } if (!Objects.equals(this.uname, other.uname)) { return false; } return true; } @Override public String toString() { return "Bacula Version: " + major + "." + minor + "." + revision + " (" + release + ") " + uname; } }
uktechbr/bmt
src/main/java/br/com/uktech/bmt/bacula/bean/BaculaVersion.java
Java
gpl-3.0
3,131
/* =========================================================================== Copyright (c) 2010-2012 Darkstar Dev Teams 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/ This file is part of DarkStar-server source code. =========================================================================== */ #ifndef _CFISHINGPACKET_H #define _CFISHINGPACKET_H #include "../../common/cbasetypes.h" #include "basic.h" /************************************************************************ * * * * * * ************************************************************************/ class CFishingPacket : public CBasicPacket { public: CFishingPacket(); }; #endif
Laterus/Darkstar-Linux-Fork
src/map/packets/fishing.h
C
gpl-3.0
1,340
- [ ] Issue #: (Replace text with #<issue_number>) - [ ] Have you listed any changes to install or build dependencies? - [ ] Have you updated the [CHANGELOG](CHANGELOG.md) with details of changes to the codebase, this includes new functionality, deprecated features, or any other material changes. - [ ] If necessary, have you bumped the version number? We will usually do this for you. - [ ] Have you included py.test tests with your pull request. (Not yet necessary) - [ ] Ensured your code is as close to PEP 8 compliant as possible? If you haven't completed the above items, please wait to create a PR until you have done so. We will try to review and reply to PRs as quickly as possible. Once your PR is approved by a maintainer, we will either merge it into next-release or do a release with you or for you. Thanks for contributing!
mattgwwalker/msg-extractor
.github/PULL_REQUEST_TEMPLATE.md
Markdown
gpl-3.0
842
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.11"/> <title>Melee Modding Library: Logic Struct Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <script type="text/javascript"> $(document).ready(function() { init_search(); }); </script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">Melee Modding Library &#160;<span id="projectnumber">1.0.0</span> </div> <div id="projectbrief">A C library for modding Super Smash Bros Melee</div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.11 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li class="current"><a href="annotated.html"><span>Data&#160;Structures</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <span class="left"> <img id="MSearchSelect" src="search/mag_sel.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> </span><span class="right"> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </span> </div> </li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li> <li><a href="classes.html"><span>Data&#160;Structure&#160;Index</span></a></li> <li><a href="functions.html"><span>Data&#160;Fields</span></a></li> </ul> </div> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#pub-attribs">Data Fields</a> </div> <div class="headertitle"> <div class="title">Logic Struct Reference</div> </div> </div><!--header--> <div class="contents"> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a> Data Fields</h2></td></tr> <tr class="memitem:ac2e94a0f750da5165457334adb68ca8f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac2e94a0f750da5165457334adb68ca8f"></a> <a class="el" href="struct_function.html">Function</a>&#160;</td><td class="memItemRight" valign="bottom"><b>condition</b></td></tr> <tr class="separator:ac2e94a0f750da5165457334adb68ca8f"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aae42c3dd5e236228bb8a32565b4c6a9c"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aae42c3dd5e236228bb8a32565b4c6a9c"></a> <a class="el" href="struct_function.html">Function</a>&#160;</td><td class="memItemRight" valign="bottom"><b>action</b></td></tr> <tr class="separator:aae42c3dd5e236228bb8a32565b4c6a9c"><td class="memSeparator" colspan="2">&#160;</td></tr> </table> <hr/>The documentation for this struct was generated from the following file:<ul> <li>src/<a class="el" href="logic_8h_source.html">logic.h</a></li> </ul> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.11 </small></address> </body> </html>
sherman5/MeleeModdingLibrary
docs/struct_logic.html
HTML
gpl-3.0
5,095
/* * This file is part of the Yices SMT Solver. * Copyright (C) 2017 SRI International. * * Yices 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. * * Yices 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 Yices. If not, see <http://www.gnu.org/licenses/>. */ /* * INCREMENTAL FORM OF THE FLOYD-WARSHALL ALGORITHM */ /* * We assume that -d-1 gives the right value for any 32bit signed * integer d, including when d is (-2^31) = INT32_MIN. This is true * if signed integer operations are done modulo 2^32. The C standard * does not require this, but this can be considered safe (see the * autoconf documentation). */ #include <stdint.h> #include <stdbool.h> #include <assert.h> #include "solvers/floyd_warshall/idl_floyd_warshall.h" #include "utils/hash_functions.h" #include "utils/memalloc.h" #define TRACE 0 #if TRACE || !defined(NDEBUG) #include <stdio.h> #include <inttypes.h> #include "solvers/floyd_warshall/idl_fw_printer.h" #endif /**************** * EDGE STACK * ***************/ /* * Initialize the stack * - n = initial size */ static void init_edge_stack(edge_stack_t *stack, uint32_t n) { assert(n < MAX_IDL_EDGE_STACK_SIZE); stack->data = (idl_edge_t *) safe_malloc(n * sizeof(idl_edge_t)); stack->lit = (literal_t *) safe_malloc(n * sizeof(literal_t)); stack->size = n; stack->top = 0; } /* * Make the stack 50% larger */ static void extend_edge_stack(edge_stack_t *stack) { uint32_t n; n = stack->size + 1; n += n>>1; if (n >= MAX_IDL_EDGE_STACK_SIZE) { out_of_memory(); } stack->data = (idl_edge_t *) safe_realloc(stack->data, n * sizeof(idl_edge_t)); stack->lit = (literal_t *) safe_realloc(stack->lit, n * sizeof(literal_t)); stack->size = n; } /* * Add an edge to the stack * - x = source, y = target, c = cost, l = literal attached */ static void push_edge(edge_stack_t *stack, int32_t x, int32_t y, int32_t c, literal_t l) { uint32_t i; i = stack->top; if (i == stack->size) { extend_edge_stack(stack); } assert(i < stack->size); stack->data[i].source = x; stack->data[i].target = y; #ifndef NDEBUG stack->data[i].cost = c; #endif stack->lit[i] = l; stack->top = i+1; } /* * Empty the stack */ static inline void reset_edge_stack(edge_stack_t *stack) { stack->top = 0; } /* * Delete the stack */ static inline void delete_edge_stack(edge_stack_t *stack) { safe_free(stack->data); safe_free(stack->lit); stack->data = NULL; stack->lit = NULL; } /************ * MATRIX * ***********/ /* * Initialize the matrix: size is 0 */ static void init_idl_matrix(idl_matrix_t *matrix) { matrix->size = 0; matrix->dim = 0; matrix->data = NULL; } /* * Resize to an (n * n) matrix * - if n > matrix->dim then new cells are initialized as follows: * - for new x, M[x, x].id = 0, M[x, x].dist = 0 * for new x and y with x != y, M[x, y].id = null_idl_edge * If n < matrix->dim, then some cells are lost */ static void resize_idl_matrix(idl_matrix_t *matrix, uint32_t n) { uint64_t new_size; uint32_t i, j, d; idl_cell_t *src, *dst; // d = current dimension, n = new dimension d = matrix->dim; matrix->dim = n; if (d == n) return; // extend the data array if it's too small if (n > matrix->size) { new_size = ((uint64_t) n * n) * sizeof(idl_cell_t); if (n >= MAX_IDL_MATRIX_DIMENSION || new_size >= SIZE_MAX) { out_of_memory(); } matrix->data = (idl_cell_t *) safe_realloc(matrix->data, new_size); matrix->size = n; } if (d < n) { // move existing cells i = d; while (i > 0) { i --; src = matrix->data + d * i; // start of current row i dst = matrix->data + n * i; // start of new row i j = d; while (j > 0) { j --; dst[j] = src[j]; } } // initialize cells [d ... n-1] in rows 0 to d-1 dst = matrix->data; for (i=0; i<d; i++) { for (j=d; j<n; j++) { dst[j].id = null_idl_edge; } dst += n; } // initialize cells [0 ... n-1] in rows d to n-1 while (i<n) { for (j=0; j<n; j++) { dst[j].id = null_idl_edge; } i ++; dst += n; } // initialize diagonal: cell i of row i, for i=d to n-1 for (i=d; i<n; i++) { dst = matrix->data + n * i + i; dst->id = 0; dst->dist = 0; } } else { assert(n < d); // move existing cells for (i=0; i<n; i++) { src = matrix->data + d * i; dst = matrix->data + n * i; for (j=0; j<n; j++) { dst[j] = src[j]; } } } } /* * Reset to the empty matrix */ static inline void reset_idl_matrix(idl_matrix_t *matrix) { matrix->dim = 0; } /* * Delete the matrix */ static inline void delete_idl_matrix(idl_matrix_t *matrix) { safe_free(matrix->data); matrix->data = NULL; } /* * Pointer to cell x, y */ static inline idl_cell_t *idl_cell(idl_matrix_t *m, uint32_t x, uint32_t y) { assert(0 <= x && x < m->dim && 0 <= y && y < m->dim); return m->data + x * m->dim + y; } /* * Pointer to the start of row x */ static inline idl_cell_t *idl_row(idl_matrix_t *m, uint32_t x) { assert(0 <= x && x < m->dim); return m->data + x * m->dim; } /* * Distance from x to y */ #ifndef NDEBUG static inline int32_t idl_dist(idl_matrix_t *m, uint32_t x, uint32_t y) { return idl_cell(m, x, y)->dist; } #endif /* * Edge id for path from x to y */ static inline int32_t idl_edge_id(idl_matrix_t *m, uint32_t x, uint32_t y) { return idl_cell(m, x, y)->id; } /***************** * SAVED CELLS * ****************/ /* * Initialize the stack * - n = initial size */ static void init_cell_stack(cell_stack_t *stack, uint32_t n) { assert(n < MAX_IDL_CELL_STACK_SIZE); stack->data = (saved_cell_t *) safe_malloc(n * sizeof(saved_cell_t)); stack->size = n; stack->top = 0; } /* * Make the stack 50% larger */ static void extend_cell_stack(cell_stack_t *stack) { uint32_t n; n = stack->size + 1; n += n>>1; if (n >= MAX_IDL_CELL_STACK_SIZE) { out_of_memory(); } stack->data = (saved_cell_t *) safe_realloc(stack->data, n * sizeof(saved_cell_t)); stack->size = n; } /* * Save cell c on top of the stack * - k = index of c in the matrix */ static void save_cell(cell_stack_t *stack, uint32_t k, idl_cell_t *c) { uint32_t i; i = stack->top; if (i == stack->size) { extend_cell_stack(stack); } assert(i < stack->size); stack->data[i].index = k; stack->data[i].saved = *c; stack->top = i+1; } /* * Empty the stack */ static inline void reset_cell_stack(cell_stack_t *stack) { stack->top = 0; } /* * Delete the stack */ static inline void delete_cell_stack(cell_stack_t *stack) { safe_free(stack->data); stack->data = NULL; } /*********** * GRAPH * **********/ /* * Initialize graph: use default sizes * - store edge 0 (used as a marker for path from x to x) */ static void init_idl_graph(idl_graph_t *graph) { init_idl_matrix(&graph->matrix); init_edge_stack(&graph->edges, DEFAULT_IDL_EDGE_STACK_SIZE); init_cell_stack(&graph->cstack, DEFAULT_IDL_CELL_STACK_SIZE); init_ivector(&graph->buffer, DEFAULT_IDL_BUFFER_SIZE); push_edge(&graph->edges, null_idl_vertex, null_idl_vertex, 0, true_literal); } /* * Delete all */ static void delete_idl_graph(idl_graph_t *graph) { delete_cell_stack(&graph->cstack); delete_edge_stack(&graph->edges); delete_idl_matrix(&graph->matrix); delete_ivector(&graph->buffer); } /* * Reset: empty graph */ static void reset_idl_graph(idl_graph_t *graph) { reset_idl_matrix(&graph->matrix); reset_edge_stack(&graph->edges); reset_cell_stack(&graph->cstack); ivector_reset(&graph->buffer); push_edge(&graph->edges, null_idl_vertex, null_idl_vertex, 0, true_literal); } /* * Resize: n = number of vertices * - extend and initialize the matrix appropriately */ static inline void resize_idl_graph(idl_graph_t *graph, uint32_t n) { resize_idl_matrix(&graph->matrix, n); } /* * Get number of edges and saved cells */ static inline uint32_t idl_graph_num_edges(idl_graph_t *graph) { return graph->edges.top; } static inline uint32_t idl_graph_num_cells(idl_graph_t *graph) { return graph->cstack.top; } /* * Auxiliary function: save cell r onto the saved cell stack */ static inline void idl_graph_save_cell(idl_graph_t *graph, idl_cell_t *r) { save_cell(&graph->cstack, r - graph->matrix.data, r); } /* * Add new edge to the graph and update the matrix * Save any modified cell onto the saved-cell stack * - x = source vertex * - y = target vertex * - c = cost * - l = literal for explanations * - k = limit on edge ids: if a cell is modified, it is saved for backtracking * only if its edge index is less than k. * Preconditions: * - x and y must be valid vertices, and x must be different from y * - the new edge must not introduce a negative circuit */ static void idl_graph_add_edge(idl_graph_t *graph, int32_t x, int32_t y, int32_t c, literal_t l, int32_t k) { int32_t id, z, w, d; idl_cell_t *r, *s; ivector_t *v; idl_matrix_t *m; int32_t *aux; uint32_t i, n; #if TRACE printf("---> IDL: adding edge: "); print_idl_vertex(stdout, x); printf(" ---> "); print_idl_vertex(stdout, y); printf(" cost: %"PRId32"\n", c); #endif m = &graph->matrix; assert(0 <= x && x < m->dim && 0 <= y && y < m->dim && x != y); id = graph->edges.top; // index of the new edge push_edge(&graph->edges, x, y, c, l); /* * collect relevant vertices in vector v: * vertex z is relevant if there's a path from y to z and * c + dist(y, z) < dist(x, z) * if z is not relevant then, for any vertex w, the new edge * cannot reduce dist(w, z) */ v = &graph->buffer; ivector_reset(v); r = idl_row(m, y); // start of row y s = idl_row(m, x); // start of row x for (z=0; z<m->dim; z++, r++, s++) { // r --> cell[y, z] and s --> cell[x, z] if (r->id >= 0 && (s->id < 0 || c + r->dist < s->dist)) { ivector_push(v, z); } } n = v->size; aux = v->data; /* * Scan relevant vertices with respect to x: * vertex w is relevant if there's a path from w to x and * dist(w, x) + c < dist(w, y) */ r = idl_row(m, 0); for (w=0; w<m->dim; w++, r += m->dim) { // r[x] == cell[w, x] and r[y] == cell[w, y] if (r[x].id >= 0 && (r[y].id < 0 || c + r[x].dist < r[y].dist)) { // w is relevant: check D[w, z] for all z in vector v for (i=0; i<n; i++) { z = aux[i]; if (w != z) { // r[z] == cell[w, z] and s --> cell[y, z] s = idl_cell(m, y, z); d = r[x].dist + c + s->dist; // distance w ---> x -> y ---> z if (r[z].id < 0 || d < r[z].dist) { // save then update cell[w, z] if (r[z].id < k) { idl_graph_save_cell(graph, r + z); } r[z].id = id; r[z].dist = d; } } } } } } /* * Backtrack: remove edges and restore the matrix * - e = first edge to remove (edges of index i ... top-1) are removed * - c = pointer into the saved cell stack */ static void idl_graph_remove_edges(idl_graph_t *graph, int32_t e, uint32_t c) { saved_cell_t *saved; idl_cell_t *m; uint32_t i, k; // restore the edge stack assert(e > 0); graph->edges.top = e; // restore the matrix: copy saved cells back i = graph->cstack.top; saved = graph->cstack.data; m = graph->matrix.data; while (i > c) { i --; k = saved[i].index; m[k] = saved[i].saved; } graph->cstack.top = c; } /* * Build explanation: get all literals appearing along the shortest path from x to y * - the literals are stored in vector v */ static void idl_graph_explain_path(idl_graph_t *graph, int32_t x, int32_t y, ivector_t *v) { int32_t i; literal_t l; if (x != y) { i = idl_edge_id(&graph->matrix, x, y); assert(1 <= i && i < graph->edges.top); /* * The shortest path from x to y is x ---> s -> t ---> y * where s = source of edge i and t = target of edge i. */ idl_graph_explain_path(graph, x, graph->edges.data[i].source, v); l = graph->edges.lit[i]; if (l != true_literal) { ivector_push(v, l); } idl_graph_explain_path(graph, graph->edges.data[i].target, y, v); } } #ifndef NDEBUG /* * For debugging: check consistency of the matrix * - cell[x, x].id must be zero and cell[x, x].val must be 0 * For all x != y: * - cell[x, y].id must be -1 or between 1 and number of edges -1 * - if cell[x, y].id == i and i != 1 then * let u = source of edge i and v = target of edge i * we must have * cell[x, u].id != 1 and cell[x, u].id < i * cell[v, y].id != 1 and cell[v, y].id < i * cell[x, y].dist = cell[x, u].dist + cost of edge i + cell[v, y].dist */ static bool valid_idl_graph(idl_graph_t *graph) { idl_matrix_t *m; idl_edge_t *e; int32_t x, y, i; int32_t u, v; m = &graph->matrix; for (x=0; x<m->dim; x++) { for (y=0; y<m->dim; y++) { i = idl_edge_id(m, x, y); if (i == null_idl_edge) { if (x == y) return false; } else if (i == 0) { if (x != y || idl_dist(m, x, y) != 0) return false; } else { if (x == y || i >= idl_graph_num_edges(graph)) return false; e = graph->edges.data + i; u = e->source; v = e->target; if (idl_edge_id(m, x, u) == null_idl_edge || idl_edge_id(m, x, u) >= i || idl_edge_id(m, v, y) == null_idl_edge || idl_edge_id(m, v, y) >= i || idl_dist(m, x, y) != idl_dist(m, x, u) + e->cost + idl_dist(m, v, y)) { return false; } } } } return true; } #endif /**************** * ATOM TABLE * ***************/ /* * Initialize the table * - n = initial size */ static void init_idl_atbl(idl_atbl_t *table, uint32_t n) { idl_listelem_t *tmp; assert(n < MAX_IDL_ATBL_SIZE); table->size = n; table->natoms = 0; table->atoms = (idl_atom_t *) safe_malloc(n * sizeof(idl_atom_t)); table->mark = allocate_bitvector(n); // table->free_list[-1] is the list header // the list is initially empty tmp = (idl_listelem_t *) safe_malloc((n+1) * sizeof(idl_listelem_t)); tmp[0].pre = -1; tmp[0].next = -1; table->free_list = tmp + 1; } /* * Make the table 50% larger */ static void extend_idl_atbl(idl_atbl_t *table) { uint32_t n; idl_listelem_t *tmp; n = table->size + 1; n += n>>1; if (n >= MAX_IDL_ATBL_SIZE) { out_of_memory(); } table->size = n; table->atoms = (idl_atom_t *) safe_realloc(table->atoms, n * sizeof(idl_atom_t)); table->mark = extend_bitvector(table->mark, n); tmp = (idl_listelem_t *) safe_realloc(table->free_list - 1, (n+1) * sizeof(idl_listelem_t)); table->free_list = tmp + 1; } /* * Add element i last into the free list */ static inline void idlatom_add_last(idl_listelem_t *list, int32_t i) { int32_t k; k = list[-1].pre; // last element list[k].next = i; list[i].pre = k; list[i].next = -1; list[-1].pre = i; } /* * Remove element i from the free list * - keep list[i].next and list[i].pre unchanged so that i can be put back */ static inline void idlatom_remove(idl_listelem_t *list, int32_t i) { int32_t j, k; j = list[i].next; k = list[i].pre; assert(list[j].pre == i && list[k].next == i); list[j].pre = k; list[k].next = j; } /* * Put element i back into the list */ static inline void idlatom_putback(idl_listelem_t *list, int32_t i) { int32_t j, k; j = list[i].next; k = list[i].pre; assert(list[j].pre == k && list[k].next == j); list[j].pre = i; list[k].next = i; } /* * Empty the list */ static inline void reset_idlatom_list(idl_listelem_t *list) { list[-1].next = -1; list[-1].pre = -1; } /* * First element of the list (-1 if the list is empty) */ static inline int32_t first_in_list(idl_listelem_t *list) { return list[-1].next; } /* * Successor of i in the list (-1 if i is the last element) */ static inline int32_t next_in_list(idl_listelem_t *list, int32_t i) { return list[i].next; } /* * Create a new atom: (x - y <= c) * returned value = the atom id * boolvar is initialized to null_bvar * the mark is cleared and the atom id is added to the free list */ static int32_t new_idl_atom(idl_atbl_t *table, int32_t x, int32_t y, int32_t c) { uint32_t i; i = table->natoms; if (i == table->size) { extend_idl_atbl(table); } assert(i < table->size); table->atoms[i].source = x; table->atoms[i].target = y; table->atoms[i].cost = c; table->atoms[i].boolvar = null_bvar; clr_bit(table->mark, i); idlatom_add_last(table->free_list, i); table->natoms ++; return i; } /* * Get atom descriptor for atom i */ static inline idl_atom_t *get_idl_atom(idl_atbl_t *table, int32_t i) { assert(0 <= i && i < table->natoms); return table->atoms + i; } /* * Check whether atom i is assigned (i.e., marked) */ static inline bool idl_atom_is_assigned(idl_atbl_t *table, int32_t i) { assert(0 <= i && i < table->natoms); return tst_bit(table->mark, i); } /* * Record that atom i is assigned: mark it, remove it from the free list * - i must not be marked */ static void mark_atom_assigned(idl_atbl_t *table, int32_t i) { assert(0 <= i && i < table->natoms && ! tst_bit(table->mark, i)); set_bit(table->mark, i); idlatom_remove(table->free_list, i); } /* * Record that atom i is no longer assigned: clear its mark, * put it back into the free list */ static void mark_atom_unassigned(idl_atbl_t *table, int32_t i) { assert(0 <= i && i < table->natoms && tst_bit(table->mark, i)); clr_bit(table->mark, i); idlatom_putback(table->free_list, i); } /* * Get the index of the first unassigned atom (-1 if all atoms are assigned) */ static inline int32_t first_unassigned_atom(idl_atbl_t *table) { return first_in_list(table->free_list); } /* * Next unassigned atom (-1 if i has no successor) * * Removing i from the list does not change its successor, * so we can do things like * mark_atom_assigned(table, i); // remove i from the list * i = next_unassigned_atom(table, i); // still fine. */ static inline int32_t next_unassigned_atom(idl_atbl_t *table, int32_t i) { return next_in_list(table->free_list, i); } /* * Remove all atoms of index >= n */ static void restore_idl_atbl(idl_atbl_t *table, uint32_t n) { uint32_t i; assert(n <= table->natoms); // remove atoms from the free list for (i=n; i<table->natoms; i++) { if (! tst_bit(table->mark, i)) { idlatom_remove(table->free_list, i); } } table->natoms = n; } /* * Empty the table */ static inline void reset_idl_atbl(idl_atbl_t *table) { table->natoms = 0; reset_idlatom_list(table->free_list); } /* * Delete the table */ static inline void delete_idl_atbl(idl_atbl_t *table) { safe_free(table->atoms); safe_free(table->free_list - 1); delete_bitvector(table->mark); table->atoms = NULL; table->free_list = NULL; table->mark = NULL; } /********************************** * ATOM STACK/PROPAGATION QUEUE * *********************************/ /* * Initialize: n = initial size */ static void init_idl_astack(idl_astack_t *stack, uint32_t n) { assert(n < MAX_IDL_ASTACK_SIZE); stack->size = n; stack->top = 0; stack->prop_ptr = 0; stack->data = (int32_t *) safe_malloc(n * sizeof(int32_t)); } /* * Make the stack 50% larger */ static void extend_idl_astack(idl_astack_t *stack) { uint32_t n; n = stack->size + 1; n += n>>1; if (n >= MAX_IDL_ASTACK_SIZE) { out_of_memory(); } stack->data = (int32_t *) safe_realloc(stack->data, n * sizeof(int32_t)); stack->size = n; } /* * Usual encoding: atom id + sign bit are packed into a 32 bit integer index * - the sign is 0 for positive, 1 for negative * - pos_index(i) in the queue means that atom i is true * - neg_index(i) in the queue means that atom i is false */ static inline int32_t pos_index(int32_t id) { return id << 1; } static inline int32_t neg_index(int32_t id) { return (id<<1) | 1; } static inline int32_t mk_index(int32_t id, uint32_t sign) { assert(sign == 0 || sign == 1); return (id<<1) | sign; } static inline int32_t atom_of_index(int32_t idx) { return idx>>1; } static inline uint32_t sign_of_index(int32_t idx) { return ((uint32_t) idx) & 1; } static inline bool is_pos_index(int32_t idx) { return sign_of_index(idx) == 0; } /* * Push atom index k on top of the stack */ static void push_atom_index(idl_astack_t *stack, int32_t k) { uint32_t i; i = stack->top; if (i == stack->size) { extend_idl_astack(stack); } assert(i < stack->size); stack->data[i] = k; stack->top = i+1; } /* * Empty the stack */ static inline void reset_idl_astack(idl_astack_t *stack) { stack->top = 0; stack->prop_ptr = 0; } /* * Delete the stack */ static inline void delete_idl_astack(idl_astack_t *stack) { safe_free(stack->data); stack->data = NULL; } /**************** * UNDO STACK * ***************/ /* * There's an undo record for each decision level. The record stores * - edge_id = first edge created at the decision level * - nsaved = number of saved cells in the graph when the decision * level was entered * - natoms = number of atoms in the propagation queue when the * decision level was entered. * * The records are stored in stack->data[0 ... top-1] so top should * always be equal to decision_level + 1. * * The initial record for decision level 0 must be initialized with * - number of edges = -1 * - number of saved cells = 0 * - number of atoms = 0 */ /* * Initialize: n = size */ static void init_idl_undo_stack(idl_undo_stack_t *stack, uint32_t n) { assert(n < MAX_IDL_UNDO_STACK_SIZE); stack->size = n; stack->top = 0; stack->data = (idl_undo_record_t *) safe_malloc(n * sizeof(idl_undo_record_t)); } /* * Extend the stack: make it 50% larger */ static void extend_idl_undo_stack(idl_undo_stack_t *stack) { uint32_t n; n = stack->size + 1; n += n>>1; if (n >= MAX_IDL_UNDO_STACK_SIZE) { out_of_memory(); } stack->size = n; stack->data = (idl_undo_record_t *) safe_realloc(stack->data, n * sizeof(idl_undo_record_t)); } /* * Push record (e, c, a) on top of the stack * - e = top edge id * - c = top of the saved cell stack * - a = top of the atom stack */ static void push_undo_record(idl_undo_stack_t *stack, int32_t e, uint32_t c, uint32_t a) { uint32_t i; i = stack->top; if (i == stack->size) { extend_idl_undo_stack(stack); } assert(i < stack->size); stack->data[i].edge_id = e; stack->data[i].nsaved = c; stack->data[i].natoms = a; stack->top = i+1; } /* * Get the top record */ static inline idl_undo_record_t *idl_undo_stack_top(idl_undo_stack_t *stack) { assert(stack->top > 0); return stack->data + (stack->top - 1); } /* * Empty the stack */ static inline void reset_idl_undo_stack(idl_undo_stack_t *stack) { stack->top = 0; } /* * Delete the stack */ static inline void delete_idl_undo_stack(idl_undo_stack_t *stack) { safe_free(stack->data); stack->data = NULL; } /******************** * PUSH/POP STACK * *******************/ /* * Initialize: size = 0; */ static void init_idl_trail_stack(idl_trail_stack_t *stack) { stack->size = 0; stack->top = 0; stack->data = NULL; } /* * Save data for the current base_level: * - nv = number of vertices * - na = number of atoms */ static void idl_trail_stack_save(idl_trail_stack_t *stack, uint32_t nv, uint32_t na) { uint32_t i, n; i = stack->top; n = stack->size; if (i == n) { if (n == 0) { n = DEFAULT_IDL_TRAIL_SIZE; } else { n += n>>1; // 50% larger if (n >= MAX_IDL_TRAIL_SIZE) { out_of_memory(); } } stack->data = (idl_trail_t *) safe_realloc(stack->data, n * sizeof(idl_trail_t)); stack->size = n; } assert(i < n); stack->data[i].nvertices = nv; stack->data[i].natoms = na; stack->top = i+1; } /* * Get the top record */ static inline idl_trail_t *idl_trail_stack_top(idl_trail_stack_t *stack) { assert(stack->top > 0); return stack->data + (stack->top - 1); } /* * Remove the top record */ static inline void idl_trail_stack_pop(idl_trail_stack_t *stack) { assert(stack->top > 0); stack->top --; } /* * Empty the stack */ static inline void reset_idl_trail_stack(idl_trail_stack_t *stack) { stack->top = 0; } /* * Delete the stack */ static inline void delete_idl_trail_stack(idl_trail_stack_t *stack) { safe_free(stack->data); stack->data = NULL; } /********************* * VERTEX CREATION * ********************/ /* * Create a new vertex and return its index */ int32_t idl_new_vertex(idl_solver_t *solver) { uint32_t n; n = solver->nvertices; if (n >= MAX_IDL_VERTICES) { return null_idl_vertex; } solver->nvertices = n + 1; return n; } /* * Get the zero vertex (create a new vertex if needed) */ int32_t idl_zero_vertex(idl_solver_t *solver) { int32_t z; z = solver->zero_vertex; if (z == null_idl_vertex) { z = idl_new_vertex(solver); solver->zero_vertex = z; } return z; } /*************************** * HASH-CONSING OF ATOMS * **************************/ /* * Hash code for atom (x - y <= d) */ static inline uint32_t hash_idl_atom(int32_t x, int32_t y, int32_t d) { return jenkins_hash_triple(x, y, d, 0xa27def15); } /* * Hash consing object for interfacing with int_hash_table */ typedef struct idlatom_hobj_s { int_hobj_t m; // methods idl_atbl_t *atbl; // atom table int32_t source, target, cost; // atom components } idlatom_hobj_t; /* * Functions for int_hash_table */ static uint32_t hash_atom(idlatom_hobj_t *p) { return hash_idl_atom(p->source, p->target, p->cost); } static bool equal_atom(idlatom_hobj_t *p, int32_t id) { idl_atom_t *atm; atm = get_idl_atom(p->atbl, id); return atm->source == p->source && atm->target == p->target && atm->cost == p->cost; } static int32_t build_atom(idlatom_hobj_t *p) { return new_idl_atom(p->atbl, p->source, p->target, p->cost); } /* * Hobject */ static idlatom_hobj_t atom_hobj = { { (hobj_hash_t) hash_atom, (hobj_eq_t) equal_atom, (hobj_build_t) build_atom }, NULL, 0, 0, 0, }; /* * Atom constructor: use hash consing * - if the atom is new, create a fresh boolean variable v * and the atom index to v in the core */ static bvar_t bvar_for_atom(idl_solver_t *solver, int32_t x, int32_t y, int32_t d) { int32_t id; idl_atom_t *atm; bvar_t v; atom_hobj.atbl = &solver->atoms; atom_hobj.source = x; atom_hobj.target = y; atom_hobj.cost = d; id = int_htbl_get_obj(&solver->htbl, (int_hobj_t *) &atom_hobj); atm = get_idl_atom(&solver->atoms, id); v = atm->boolvar; if (v == null_bvar) { v = create_boolean_variable(solver->core); atm->boolvar = v; attach_atom_to_bvar(solver->core, v, index2atom(id)); } return v; } /* * Get literal for atom (x - y <= d): simplify and normalize first */ literal_t idl_make_atom(idl_solver_t *solver, int32_t x, int32_t y, int32_t d) { assert(0 <= x && x < solver->nvertices && 0 <= y && y < solver->nvertices); #if TRACE printf("---> IDL: creating atom: "); print_idl_vertex(stdout, x); printf(" - "); print_idl_vertex(stdout, y); printf(" <= %"PRId32"\n", d); if (x == y) { if (d >= 0) { printf("---> true atom\n"); } else { printf("---> false atom\n"); } } #endif if (x == y) { return (d >= 0) ? true_literal : false_literal; } // EXPERIMENTAL if (solver->base_level == solver->decision_level && x < solver->graph.matrix.dim && y < solver->graph.matrix.dim) { idl_cell_t *cell; cell = idl_cell(&solver->graph.matrix, x, y); if (cell->id >= 0 && cell->dist <= d) { #if TRACE printf("---> true atom: dist["); print_idl_vertex(stdout, x); printf(", "); print_idl_vertex(stdout, y); printf("] = %"PRId32"\n", cell->dist); #endif return true_literal; } cell = idl_cell(&solver->graph.matrix, y, x); if (cell->id >= 0 && cell->dist < -d) { #if TRACE printf("---> false atom: dist["); print_idl_vertex(stdout, y); printf(", "); print_idl_vertex(stdout, x); printf("] = %"PRId32"\n", cell->dist); #endif return false_literal; } } return pos_lit(bvar_for_atom(solver, x, y, d)); #if 0 if (x < y) { return pos_lit(bvar_for_atom(solver, x, y, d)); } else { // (x - y <= d) <==> (not [y - x <= -d-1]) return neg_lit(bvar_for_atom(solver, y, x, - d - 1)); } #endif } /**************** * ASSERTIONS * ***************/ /* * Assert (x - y <= d) as an axiom: * - attach true_literal to the edge */ void idl_add_axiom_edge(idl_solver_t *solver, int32_t x, int32_t y, int32_t d) { idl_cell_t *cell; int32_t k; assert(0 <= x && x < solver->nvertices && 0 <= y && y < solver->nvertices); assert(solver->decision_level == solver->base_level); // do nothing if the solver is already in an inconsistent state if (solver->unsat_before_search) return; resize_idl_graph(&solver->graph, solver->nvertices); // check whether adding the edge x--->y forms a negative circuit cell = idl_cell(&solver->graph.matrix, y, x); if (cell->id >= 0 && cell->dist + d < 0) { solver->unsat_before_search = true; return; } // check whether the new axiom is redundant cell = idl_cell(&solver->graph.matrix, x, y); if (cell->id >= 0 && cell->dist <= d) { return; } /* * save limit for add_edge: * k = top edge id stored in the top record of the undo stack * if base level == 0, k = -1, so nothing will be saved */ assert(solver->stack.top == solver->decision_level + 1); k = idl_undo_stack_top(&solver->stack)->edge_id; // add the edge idl_graph_add_edge(&solver->graph, x, y, d, true_literal, k); } /* * Assert (x - y == d) as an axiom: (x - y <= d && y - x <= -d) */ void idl_add_axiom_eq(idl_solver_t *solver, int32_t x, int32_t y, int32_t d) { idl_add_axiom_edge(solver, x, y, d); idl_add_axiom_edge(solver, y, x, -d); } /* * Try to assert (x - y <= d) with explanation l * - if that causes a conflict, generate the conflict explanation and return false * - return true if the edge does not cause a conflict * The graph matrix must have dimension == solver->nvertices */ static bool idl_add_edge(idl_solver_t *solver, int32_t x, int32_t y, int32_t d, literal_t l) { idl_cell_t *cell; int32_t k; uint32_t i, n; ivector_t *v; assert(0 <= x && x < solver->nvertices && 0 <= y && y < solver->nvertices); // check whether the new edge causes a negative circuit cell = idl_cell(&solver->graph.matrix, y, x); if (cell->id >= 0 && cell->dist + d < 0) { v = &solver->expl_buffer; ivector_reset(v); idl_graph_explain_path(&solver->graph, y, x, v); ivector_push(v, l); /* * the conflict is not (v[0] ... v[n-1]) * we need to convert it to a clause and add the end marker */ n = v->size; for (i=0; i<n; i++) { v->data[i] = not(v->data[i]); } ivector_push(v, null_literal); // end marker record_theory_conflict(solver->core, v->data); return false; } cell = idl_cell(&solver->graph.matrix, x, y); if (cell->id < 0 || cell->dist > d) { /* * The edge is not redundant: add it to the graph * backtrack point = number of edges on entry to the current decision level * that's stored in the top element in the undo stack */ assert(solver->stack.top == solver->decision_level + 1); k = idl_undo_stack_top(&solver->stack)->edge_id; idl_graph_add_edge(&solver->graph, x, y, d, l, k); } return true; } /************************** * THEORY PROPAGATION * *************************/ /* * Generate a propagation antecedent using the path x --> y * - return a pointer to a literal array, terminated by null_literal */ static literal_t *gen_idl_prop_antecedent(idl_solver_t *solver, int32_t x, int32_t y) { ivector_t *v; literal_t *expl; uint32_t i, n; v = &solver->expl_buffer; ivector_reset(v); idl_graph_explain_path(&solver->graph, x, y, v); // copy v + end marker into the arena n = v->size; expl = (literal_t *) arena_alloc(&solver->arena, (n + 1) * sizeof(int32_t)); for (i=0; i<n; i++) { expl[i] = v->data[i]; } expl[i] = null_literal; return expl; } /* * Check whether atom i (or its negation) is implied by the graph * - if so, propagate the literal to the core * - add the atom index to the propagation queue * (this is required for backtracking) */ static void check_atom_for_propagation(idl_solver_t *solver, int32_t i) { idl_atom_t *a; int32_t x, y, d; idl_cell_t *cell; literal_t *expl; assert(! idl_atom_is_assigned(&solver->atoms, i)); a = get_idl_atom(&solver->atoms, i); x = a->source; y = a->target; d = a->cost; cell = idl_cell(&solver->graph.matrix, x, y); if (cell->id >= 0 && cell->dist <= d) { // d[x, y] <= d so x - y <= d is implied expl = gen_idl_prop_antecedent(solver, x, y); mark_atom_assigned(&solver->atoms, i); push_atom_index(&solver->astack, pos_index(i)); propagate_literal(solver->core, pos_lit(a->boolvar), expl); #if TRACE printf("---> IDL propagation: "); print_idl_atom(stdout, a); printf(" is true: dist["); print_idl_vertex(stdout, x); printf(", "); print_idl_vertex(stdout, y); printf("] = %"PRId32"\n", cell->dist); #endif return; } cell = idl_cell(&solver->graph.matrix, y, x); if (cell->id >= 0 && cell->dist < -d) { // we have y - x <= d[y, x] < -d so x - y > d is implied expl = gen_idl_prop_antecedent(solver, y, x); mark_atom_assigned(&solver->atoms, i); push_atom_index(&solver->astack, neg_index(i)); propagate_literal(solver->core, neg_lit(a->boolvar), expl); #if TRACE printf("---> IDL propagation: "); print_idl_atom(stdout, a); printf(" is false: dist["); print_idl_vertex(stdout, y); printf(", "); print_idl_vertex(stdout, x); printf("] = %"PRId32"\n", cell->dist); #endif } } /* * Scan all unassigned atoms and check propagation * - must be called after all atoms in the queue have been processed */ static void idl_atom_propagation(idl_solver_t *solver) { idl_atbl_t *tbl; int32_t i; assert(solver->astack.top == solver->astack.prop_ptr); tbl = &solver->atoms; for (i=first_unassigned_atom(tbl); i >= 0; i = next_unassigned_atom(tbl, i)) { check_atom_for_propagation(solver, i); } // update prop_ptr to skip all implied atoms in the next // call to idl_propagate. solver->astack.prop_ptr = solver->astack.top; } /******************** * SMT OPERATIONS * *******************/ /* * Start internalization: do nothing */ void idl_start_internalization(idl_solver_t *solver) { } /* * Start search: if unsat flag is true, force a conflict in the core. * Otherwise, do nothing. */ void idl_start_search(idl_solver_t *solver) { if (solver->unsat_before_search) { record_empty_theory_conflict(solver->core); } } /* * Start a new decision level: * - save the current number of edges and saved cells, * and the size of the atom queue */ void idl_increase_decision_level(idl_solver_t *solver) { uint32_t e, c, a; assert(! solver->unsat_before_search); assert(solver->astack.top == solver->astack.prop_ptr); e = idl_graph_num_edges(&solver->graph); c = idl_graph_num_cells(&solver->graph); a = solver->astack.top; push_undo_record(&solver->stack, e, c, a); solver->decision_level ++; // open new scope in the arena (for storing propagation antecedents) arena_push(&solver->arena); } /* * Assert atom: * - a stores the index of an atom attached to a boolean variable v * - l is either pos_lit(v) or neg_lit(v) * - pos_lit means assert atom (x - y <= c) * - neg_lit means assert its negation (y - x <= -c-1) * We just push the corresponding atom index onto the propagation queue */ bool idl_assert_atom(idl_solver_t *solver, void *a, literal_t l) { int32_t k; k = atom2index(a); assert(var_of(l) == get_idl_atom(&solver->atoms, k)->boolvar); if (! idl_atom_is_assigned(&solver->atoms, k)) { mark_atom_assigned(&solver->atoms, k); push_atom_index(&solver->astack, mk_index(k, sign_of_lit(l))); } return true; } /* * Process all asserted atoms then propagate implied atoms to the core */ bool idl_propagate(idl_solver_t *solver) { uint32_t i, n; int32_t k, *a; int32_t x, y, d; literal_t l; idl_atom_t *atom; resize_idl_graph(&solver->graph, solver->nvertices); a = solver->astack.data; n = solver->astack.top; for (i=solver->astack.prop_ptr; i<n; i++) { k = a[i]; atom = get_idl_atom(&solver->atoms, atom_of_index(k)); // turn atom or its negation into (x - y <= d) if (is_pos_index(k)) { x = atom->source; y = atom->target; d = atom->cost; l = pos_lit(atom->boolvar); } else { x = atom->target; y = atom->source; d = - atom->cost - 1; l = neg_lit(atom->boolvar); } if (! idl_add_edge(solver, x, y, d, l)) return false; // conflict } solver->astack.prop_ptr = n; assert(valid_idl_graph(&solver->graph)); // theory propagation idl_atom_propagation(solver); return true; } /* * Final check: do nothing and return SAT */ fcheck_code_t idl_final_check(idl_solver_t *solver) { return FCHECK_SAT; } /* * Clear: do nothing */ void idl_clear(idl_solver_t *solver) { } /* * Expand explanation for literal l * - l was implied with expl as antecedent * - expl is a null-terminated array of literals stored in the arena. * - v = vector where the explanation is to be added */ void idl_expand_explanation(idl_solver_t *solver, literal_t l, literal_t *expl, ivector_t *v) { literal_t x; for (;;) { x = *expl ++; if (x == null_literal) break; ivector_push(v, x); } } /* * Backtrack to back_level */ void idl_backtrack(idl_solver_t *solver, uint32_t back_level) { idl_undo_record_t *undo; uint32_t i, n; int32_t k, *a; assert(solver->base_level <= back_level && back_level < solver->decision_level); /* * stack->data[back_level+1] = undo record created on entry to back_level + 1 */ assert(back_level + 1 < solver->stack.top); undo = solver->stack.data + back_level + 1; // remove all edges of level >= back_level + 1 idl_graph_remove_edges(&solver->graph, undo->edge_id, undo->nsaved); /* * all atoms assigned at levels > back_level must be put back into the free list * this must be done in reverse order of atom processing */ n = undo->natoms; i = solver->astack.top; a = solver->astack.data; while (i > n) { i --; k = atom_of_index(a[i]); mark_atom_unassigned(&solver->atoms, k); } solver->astack.top = n; solver->astack.prop_ptr = n; /* * Delete all temporary data in the arena */ i = solver->decision_level; do { arena_pop(&solver->arena); i --; } while (i > back_level); /* * Restore the undo stack and decision_level */ solver->stack.top = back_level + 1; solver->decision_level = back_level; assert(valid_idl_graph(&solver->graph)); } /* * Push: * - store current number of vertices and atoms on the trail_stack * - increment both decision level and base level */ void idl_push(idl_solver_t *solver) { assert(solver->base_level == solver->decision_level); dl_vartable_push(&solver->vtbl); idl_trail_stack_save(&solver->trail_stack, solver->nvertices, solver->atoms.natoms); solver->base_level ++; idl_increase_decision_level(solver); assert(solver->decision_level == solver->base_level); } /* * Pop: remove vertices and atoms created at the current base-level */ void idl_pop(idl_solver_t *solver) { idl_trail_t *top; uint32_t i, h, n, p; idl_atom_t *a; assert(solver->base_level > 0 && solver->base_level == solver->decision_level); top = idl_trail_stack_top(&solver->trail_stack); // remove variables dl_vartable_pop(&solver->vtbl); // remove atoms from the hash table p = top->natoms; n = solver->atoms.natoms; for (i = p; i<n; i++) { a = get_idl_atom(&solver->atoms, i); h = hash_idl_atom(a->source, a->target, a->cost); int_htbl_erase_record(&solver->htbl, h, i); } // remove atoms from the atom table restore_idl_atbl(&solver->atoms, n); // restore vertice count solver->nvertices = top->nvertices; resize_idl_matrix(&solver->graph.matrix, top->nvertices); // decrement base_level solver->base_level --; idl_trail_stack_pop(&solver->trail_stack); // backtrack to base_level idl_backtrack(solver, solver->base_level); assert(valid_idl_graph(&solver->graph)); } /* * Reset */ void idl_reset(idl_solver_t *solver) { solver->base_level = 0; solver->decision_level = 0; solver->unsat_before_search = false; reset_dl_vartable(&solver->vtbl); solver->nvertices = 0; solver->zero_vertex = null_idl_vertex; reset_idl_graph(&solver->graph); reset_idl_atbl(&solver->atoms); reset_idl_astack(&solver->astack); reset_idl_undo_stack(&solver->stack); reset_idl_trail_stack(&solver->trail_stack); reset_int_htbl(&solver->htbl); arena_reset(&solver->arena); ivector_reset(&solver->expl_buffer); ivector_reset(&solver->aux_vector); solver->triple.target = nil_vertex; solver->triple.source = nil_vertex; q_clear(&solver->triple.constant); reset_poly_buffer(&solver->buffer); if (solver->value != NULL) { safe_free(solver->value); solver->value = NULL; } // undo record for level 0 push_undo_record(&solver->stack, -1, 0, 0); } /* * THEORY-BRANCHING */ /* * We compute a variable assignment using vertex 0 as a reference * using val[x] = - d[0, x]. * To decide whether to case-split (x - y <= b) = true or false * we check whether val[x] - val[y] <= b. */ literal_t idl_select_polarity(idl_solver_t *solver, void *a, literal_t l) { bvar_t v; int32_t id; idl_atom_t *atom; int32_t x, y; idl_cell_t *cell_x, *cell_y; v = var_of(l); id = atom2index(a); atom = get_idl_atom(&solver->atoms, id); assert(atom->boolvar == v); x = atom->source; y = atom->target; cell_x = idl_cell(&solver->graph.matrix, 0, x); cell_y = idl_cell(&solver->graph.matrix, 0, y); if (cell_x->id >= 0 && cell_y->id >= 0) { /* * d[0, x] and d[0, y] are defined: * val[x] - val[y] <= b iff d[0, y] - d[0, x] <= b */ if (cell_y->dist - cell_x->dist <= atom->cost) { return pos_lit(v); } else { return neg_lit(v); } } else { return l; } } /********************** * INTERNALIZATION * *********************/ /* * Raise exception or abort */ static __attribute__ ((noreturn)) void idl_exception(idl_solver_t *solver, int code) { if (solver->env != NULL) { longjmp(*solver->env, code); } abort(); } /* * Store a triple (x, y, c) into the internal triple * create/get the corresponding variable from vtbl. * - x = target vertex * - y = source vertex * - c = constant * This returns a variable id whose descriptor is (x - y + c). */ static thvar_t idl_var_for_triple(idl_solver_t *solver, int32_t x, int32_t y, int32_t c) { dl_triple_t *triple; triple = &solver->triple; triple->target = x; triple->source = y; q_set32(&triple->constant, c); return get_dl_var(&solver->vtbl, triple); } /* * Apply renaming and substitution to polynomial p * - map is a variable renaming: if p is a_0 t_0 + ... + a_n t_n * then map[i] is the theory variable x_i that replaces t_i. * - so the function construct p = a_0 x_0 + ... + a_n x_n * The result is stored into solver->buffer. */ static void idl_rename_poly(idl_solver_t *solver, polynomial_t *p, thvar_t *map) { poly_buffer_t *b; monomial_t *mono; uint32_t i, n; b = &solver->buffer; reset_poly_buffer(b); n = p->nterms; mono = p->mono; // deal with p's constant term if any if (map[0] == null_thvar) { assert(mono[0].var == const_idx); poly_buffer_add_const(b, &mono[0].coeff); n --; map ++; mono ++; } for (i=0; i<n; i++) { assert(mono[i].var != const_idx); addmul_dl_var_to_buffer(&solver->vtbl, b, map[i], &mono[i].coeff); } normalize_poly_buffer(b); } /* * Create the zero_vertex but raise an exception if that fails. */ static int32_t idl_get_zero_vertex(idl_solver_t *solver) { int32_t z; z = idl_zero_vertex(solver); if (z < 0) { idl_exception(solver, TOO_MANY_ARITH_VARS); } return z; } /* * Create the atom (x - y + c) == 0 for d = (x - y + c) */ static literal_t idl_eq_from_triple(idl_solver_t *solver, dl_triple_t *d) { literal_t l1, l2; int32_t c, x, y; x = d->target; y = d->source; /* * Check for trivial equality: we do this before attempting * to convert the constant to int32. */ if (x == y) { if (q_is_zero(&d->constant)) { return true_literal; } else { return false_literal; } } if (! q_get32(&d->constant, &c)) { idl_exception(solver, ARITHSOLVER_EXCEPTION); } /* * d is (x - y + c) */ // a nil_vertex in triples denote 'zero' if (x < 0) { x = idl_get_zero_vertex(solver); } else if (y < 0) { y = idl_get_zero_vertex(solver); } // v == 0 is the conjunction of (y - x <= c) and (x - y <= -c) if (c == INT32_MIN) { // we can't represent -c idl_exception(solver, ARITHSOLVER_EXCEPTION); } l1 = idl_make_atom(solver, y, x, c); // atom (y - x <= c) l2 = idl_make_atom(solver, x, y, -c); // atom (x - y <= -c) return mk_and_gate2(solver->gate_manager, l1, l2); } /* * Create the atom (x - y + c) >= 0 for d = (x - y + c) */ static literal_t idl_ge_from_triple(idl_solver_t *solver, dl_triple_t *d) { int32_t c, x, y; x = d->target; y = d->source; /* * Trivial case: don't convert the constant to int32 */ if (x == y) { if (q_is_nonneg(&d->constant)) { return true_literal; } else { return false_literal; } } if (! q_get32(&d->constant, &c)) { idl_exception(solver, ARITHSOLVER_EXCEPTION); } if (x < 0) { x = idl_get_zero_vertex(solver); } else if (y < 0) { y = idl_get_zero_vertex(solver); } // (x - y + c >= 0) is (y - x <= c) return idl_make_atom(solver, y, x, c); } /* * Assert (x - y + c) == 0 or (x - y + c) != 0, given a triple d = x - y + c * - tt true: assert the equality * - tt false: assert the disequality */ static void idl_assert_triple_eq(idl_solver_t *solver, dl_triple_t *d, bool tt) { int32_t x, y, c; literal_t l1, l2; x = d->target; y = d->source; if (x == y) { // trivial case if (q_is_zero(&d->constant) != tt) { solver->unsat_before_search = true; } return; } if (! q_get32(&d->constant, &c)) { idl_exception(solver, ARITHSOLVER_EXCEPTION); } // d is (x - y + c) if (x < 0) { x = idl_get_zero_vertex(solver); } else if (y < 0) { y = idl_get_zero_vertex(solver); } if (tt) { // (x - y + c) == 0 is equivalent to y - x == c idl_add_axiom_eq(solver, y, x, c); } else { // (x - y + c) != 0 is equivalent to // (not (y - x <= c)) or (not (x - y <= -c)) if (c == INT32_MIN) { idl_exception(solver, ARITHSOLVER_EXCEPTION); } l1 = idl_make_atom(solver, y, x, c); // atom (y - x <= c) l2 = idl_make_atom(solver, x, y, -c); // atom (x - y <= -c) add_binary_clause(solver->core, not(l1), not(l2)); } } /* * Assert (x - y + c) >= 0 or (x - y + c) < 0, given a triple d = x - y + c * - tt true: assert (x - y + c) >= 0 * - tt false: assert (x - y + c) < 0 */ static void idl_assert_triple_ge(idl_solver_t *solver, dl_triple_t *d, bool tt) { int32_t x, y, c; x = d->target; y = d->source; if (x == y) { // trivial case if (q_is_nonneg(&d->constant) != tt) { solver->unsat_before_search = true; } return; } if (! q_get32(&d->constant, &c)) { idl_exception(solver, ARITHSOLVER_EXCEPTION); } // d is (x - y + c) if (x < 0) { x = idl_get_zero_vertex(solver); } else if (y < 0) { y = idl_get_zero_vertex(solver); } if (tt) { // (x - y + c) >= 0 is equivalent to (y - x <= c) idl_add_axiom_edge(solver, y, x, c); } else { // (x - y + c) < 0 is equivalent to (x - y <= -c-1) // Note: (-c)-1 gives the right result even if c is INT32_MIN idl_add_axiom_edge(solver, x, y, -c-1); } } /* * TERM CONSTRUCTORS */ /* * Create a new theory variable * - is_int indicates whether the variable should be an integer, * so it should always be true for this solver. * - raise exception NOT_IDL if is_int is false * - raise exception TOO_MANY_VARS if we can't create a new vertex * for that variable */ thvar_t idl_create_var(idl_solver_t *solver, bool is_int) { int32_t v; if (! is_int) { idl_exception(solver, FORMULA_NOT_IDL); } v = idl_new_vertex(solver); if (v < 0) { idl_exception(solver, TOO_MANY_ARITH_VARS); } return idl_var_for_triple(solver, v, nil_vertex, 0); } /* * Create a variable that represents the constant q * - fails if q is not an integer */ thvar_t idl_create_const(idl_solver_t *solver, rational_t *q) { int32_t c; if (! q_get32(q, &c)) { /* * We could do a more precise diagnosis here: * There are two possibilities: * q is not an integer * q is an integer but it doesn't fit in 32bits */ idl_exception(solver, ARITHSOLVER_EXCEPTION); } return idl_var_for_triple(solver, nil_vertex, nil_vertex, c); } /* * Create a variable for a polynomial p, with variables defined by map: * - p is of the form a_0 t_0 + ... + a_n t_n where t_0, ..., t_n * are arithmetic terms. * - map[i] is the theory variable x_i for t_i * (with map[0] = null_thvar if t_0 is const_idx) * - the function constructs a variable equal to a_0 x_0 + ... + a_n x_n * * - fails if a_0 x_0 + ... + a_n x_n is not an IDL polynomial * (i.e., not of the form x - y + c) */ thvar_t idl_create_poly(idl_solver_t *solver, polynomial_t *p, thvar_t *map) { poly_buffer_t *b; dl_triple_t *triple; // apply renaming and substitutions idl_rename_poly(solver, p, map); b = &solver->buffer; // b contains a_0 x_0 + ... + a_n x_n triple = &solver->triple; if (! convert_poly_buffer_to_dl_triple(b, triple) || ! q_is_int32(&triple->constant)) { /* * Exception here: either b is not of the right form * or the constant is not an integer * or the constant is an integer but it doesn't fit in 32bits */ idl_exception(solver, ARITHSOLVER_EXCEPTION); } return get_dl_var(&solver->vtbl, triple); } /* * Internalization for a product: always fails with NOT_IDL exception */ thvar_t idl_create_pprod(idl_solver_t *solver, pprod_t *p, thvar_t *map) { idl_exception(solver, FORMULA_NOT_IDL); } /* * ATOM CONSTRUCTORS */ /* * Create the atom v = 0 */ literal_t idl_create_eq_atom(idl_solver_t *solver, thvar_t v) { return idl_eq_from_triple(solver, dl_var_triple(&solver->vtbl, v)); } /* * Create the atom v >= 0 */ literal_t idl_create_ge_atom(idl_solver_t *solver, thvar_t v) { return idl_ge_from_triple(solver, dl_var_triple(&solver->vtbl, v)); } /* * Create the atom (v = w) */ literal_t idl_create_vareq_atom(idl_solver_t *solver, thvar_t v, thvar_t w) { dl_triple_t *triple; triple = &solver->triple; if (! diff_dl_vars(&solver->vtbl, v, w, triple)) { // v - w is not expressible as (target - source + c) idl_exception(solver, FORMULA_NOT_IDL); } return idl_eq_from_triple(solver, triple); } /* * Create the atom (p = 0) * - map = variable renaming (as in create_poly) */ literal_t idl_create_poly_eq_atom(idl_solver_t *solver, polynomial_t *p, thvar_t *map) { poly_buffer_t *b; dl_triple_t *triple; // apply renaming and substitutions idl_rename_poly(solver, p, map); b = &solver->buffer; triple = &solver->triple; if (! rescale_poly_buffer_to_dl_triple(b, triple)) { // exception: p is not convertible to an IDL polynomial idl_exception(solver, ARITHSOLVER_EXCEPTION); } return idl_eq_from_triple(solver, triple); } /* * Create the atom (p >= 0) * - map = variable renaming (as in create_poly) */ literal_t idl_create_poly_ge_atom(idl_solver_t *solver, polynomial_t *p, thvar_t *map) { poly_buffer_t *b; dl_triple_t *triple; // apply renaming and substitutions idl_rename_poly(solver, p, map); b = &solver->buffer; triple = &solver->triple; if (! rescale_poly_buffer_to_dl_triple(b, triple)) { // exception: either p is not convertible to an IDL polynomial idl_exception(solver, ARITHSOLVER_EXCEPTION); } return idl_ge_from_triple(solver, triple); } /* * TOP-LEVEL ASSERTIONS */ /* * Assert the top-level constraint (v == 0) or (v != 0) * - if tt is true: assert v == 0 * - if tt is false: assert v != 0 */ void idl_assert_eq_axiom(idl_solver_t *solver, thvar_t v, bool tt) { idl_assert_triple_eq(solver, dl_var_triple(&solver->vtbl, v), tt); } /* * Assert the top-level constraint (v >= 0) or (v < 0) * - if tt is true: assert (v >= 0) * - if tt is false: assert (v < 0) */ void idl_assert_ge_axiom(idl_solver_t *solver, thvar_t v, bool tt) { idl_assert_triple_ge(solver, dl_var_triple(&solver->vtbl, v), tt); } /* * Assert (p == 0) or (p != 0) depending on tt */ void idl_assert_poly_eq_axiom(idl_solver_t *solver, polynomial_t *p, thvar_t *map, bool tt) { poly_buffer_t *b; dl_triple_t *triple; // apply renaming and substitutions idl_rename_poly(solver, p, map); b = &solver->buffer; triple = &solver->triple; if (! rescale_poly_buffer_to_dl_triple(b, triple)) { // exception: p is not convertible to an IDL polynomial idl_exception(solver, ARITHSOLVER_EXCEPTION); } idl_assert_triple_eq(solver, triple, tt); } /* * Assert (p >= 0) or (p < 0) depending on tt */ void idl_assert_poly_ge_axiom(idl_solver_t *solver, polynomial_t *p, thvar_t *map, bool tt) { poly_buffer_t *b; dl_triple_t *triple; // apply renaming and substitutions idl_rename_poly(solver, p, map); b = &solver->buffer; triple = &solver->triple; if (! rescale_poly_buffer_to_dl_triple(b, triple)) { // exception: p is not convertible to an IDL polynomial idl_exception(solver, ARITHSOLVER_EXCEPTION); } idl_assert_triple_ge(solver, triple, tt); } /* * Assert (v == w) or (v != w) * - if tt is true: assert (v == w) * - if tt is false: assert (v != w) */ void idl_assert_vareq_axiom(idl_solver_t *solver, thvar_t v, thvar_t w, bool tt) { dl_triple_t *triple; triple = &solver->triple; if (! diff_dl_vars(&solver->vtbl, v, w, triple)) { idl_exception(solver, FORMULA_NOT_IDL); } idl_assert_triple_eq(solver, triple, tt); } /* * Assert (c ==> v == w) */ void idl_assert_cond_vareq_axiom(idl_solver_t *solver, literal_t c, thvar_t v, thvar_t w) { dl_triple_t *triple; int32_t x, y, d; literal_t l1, l2; triple = &solver->triple; if (! diff_dl_vars(&solver->vtbl, v, w, triple)) { idl_exception(solver, FORMULA_NOT_IDL); } x = triple->target; y = triple->source; // v == w is equivalent to (x - y + triple.constant) == 0 if (x == y) { if (q_is_nonzero(&triple->constant)) { // (x - y + constant) == 0 is false add_unit_clause(solver->core, not(c)); } return; } // convert the constant to int32_t d: if (! q_get32(&triple->constant, &d)) { idl_exception(solver, ARITHSOLVER_EXCEPTION); } if (x < 0) { x = idl_get_zero_vertex(solver); } else if (y < 0) { y = idl_get_zero_vertex(solver); } /* * Assert (c ==> (x - y + d) == 0) as two clauses: * c ==> (y - x <= d) * c ==> (x - y <= -d) */ if (d == INT32_MIN) { idl_exception(solver, ARITHSOLVER_EXCEPTION); } l1 = idl_make_atom(solver, y, x, d); // (y - x <= d) l2 = idl_make_atom(solver, x, y, -d); // (x - y <= -d) add_binary_clause(solver->core, not(c), l1); add_binary_clause(solver->core, not(c), l2); } /* * Assert (c[0] \/ .... \/ c[n-1] \/ v == w) */ void idl_assert_clause_vareq_axiom(idl_solver_t *solver, uint32_t n, literal_t *c, thvar_t v, thvar_t w) { dl_triple_t *triple; ivector_t *aux; int32_t x, y, d; literal_t l1, l2; triple = &solver->triple; if (! diff_dl_vars(&solver->vtbl, v, w, triple)) { idl_exception(solver, FORMULA_NOT_IDL); } x = triple->target; y = triple->source; // v == w is equivalent to (x - y + constant) == 0 if (x == y) { if (q_is_nonzero(&triple->constant)) { // (x - y + d) == 0 is false add_clause(solver->core, n, c); } return; } // convert constant to a 32bit integer if (! q_get32(&triple->constant, &d)) { idl_exception(solver, ARITHSOLVER_EXCEPTION); } if (x < 0) { x = idl_get_zero_vertex(solver); } else if (y < 0) { y = idl_get_zero_vertex(solver); } /* * Assert two clauses: * c[0] \/ ... \/ c[n-1] \/ (y - x <= d) * c[0] \/ ... \/ c[n-1] \/ (x - y <= -d) */ if (d == INT32_MIN) { idl_exception(solver, ARITHSOLVER_EXCEPTION); } l1 = idl_make_atom(solver, y, x, d); // (y - x <= d) l2 = idl_make_atom(solver, x, y, -d); // (x - y <= -d) aux = &solver->aux_vector; assert(aux->size == 0); ivector_copy(aux, c, n); assert(aux->size == n); ivector_push(aux, l1); add_clause(solver->core, n+1, aux->data); aux->data[n] = l2; add_clause(solver->core, n+1, aux->data); ivector_reset(aux); } /************************ * MODEL CONSTRUCTION * ***********************/ /* * Set val[x] to vx then extend the model to predecessors of x that are * not marked: if y is not marked and there's a path from y to x, set * val[y] := vx + d[y, x] and mark y. */ static void set_reference_point(idl_solver_t *solver, int32_t x, int32_t vx, byte_t *mark) { idl_matrix_t *m; idl_cell_t *cell; int32_t y, n; assert(solver->value != NULL && 0 <= x && x < solver->nvertices && ! tst_bit(mark, x)); solver->value[x] = vx; set_bit(mark, x); m = &solver->graph.matrix; n = solver->nvertices; for (y=0; y<n; y++) { cell = idl_cell(m, y, x); if (cell->id > 0 && ! tst_bit(mark, y)) { set_bit(mark, y); solver->value[y] = vx + cell->dist; } } } /* * Compute val[x] for a vertex x in a new strongly connected component. * - i.e., there's no path from x to any existing marked vertex y * - we can set val[x] to anything larger than v[y] - d[y, x] where y is marked * and a predecessor of x */ static int32_t value_of_new_vertex(idl_solver_t *solver, int32_t x, byte_t *mark) { idl_matrix_t *m; idl_cell_t *cell; int32_t y, n, vx, aux; vx = 0; // any default will do m = &solver->graph.matrix; n = solver->nvertices; for (y=0; y<n; y++) { cell = idl_cell(m, y, x); if (cell->id > 0 && tst_bit(mark, y)) { aux = solver->value[y] - cell->dist; if (aux > vx) { vx = aux; } } } return vx; } #ifndef NDEBUG /* * For debugging: check whether the model is good */ static bool good_model(idl_solver_t *solver) { idl_matrix_t *m; idl_cell_t *cell; int32_t *val; uint32_t n; int32_t x, y; m = &solver->graph.matrix; val = solver->value; n = solver->nvertices; for (x=0; x<n; x++) { for (y=0; y<n; y++) { cell = idl_cell(m, x, y); if (cell->id >= 0 && val[x] - val[y] > cell->dist) { printf("---> BUG: invalid IDL model\n"); printf(" val["); print_idl_vertex(stdout, x); printf("] = %"PRId32"\n", val[x]); printf(" val["); print_idl_vertex(stdout, y); printf("] = %"PRId32"\n", val[y]); printf(" dist["); print_idl_vertex(stdout, x); printf(", "); print_idl_vertex(stdout, y); printf("] = %"PRId32"\n", cell->dist); fflush(stdout); return false; } } } return true; } #endif /* * Build a mapping from vertices to integers */ void idl_build_model(idl_solver_t *solver) { byte_t *mark; uint32_t nvars; int32_t x, vx; assert(solver->value == NULL); nvars = solver->nvertices; solver->value = (int32_t *) safe_malloc(nvars * sizeof(int32_t)); mark = allocate_bitvector0(nvars); // mark[x] = 0 for every vertex x // make sure the zero vertex has value 0 x = solver->zero_vertex; if (x >= 0) { set_reference_point(solver, x, 0, mark); } // extend the model (for vertices not connected to x) for (x=0; x<nvars; x++) { if (! tst_bit(mark, x)) { vx = value_of_new_vertex(solver, x, mark); set_reference_point(solver, x, vx, mark); } } delete_bitvector(mark); assert(good_model(solver)); } /* * Free the model */ void idl_free_model(idl_solver_t *solver) { assert(solver->value != NULL); safe_free(solver->value); solver->value = NULL; } /* * Value of variable x in the model * - copy the value in v and return true */ bool idl_value_in_model(idl_solver_t *solver, thvar_t x, rational_t *v) { dl_triple_t *d; int32_t aux; assert(solver->value != NULL && 0 <= x && x < solver->vtbl.nvars); d = dl_var_triple(&solver->vtbl, x); // d is of the form (target - source + constant) aux = 0; if (d->target >= 0) { aux = idl_vertex_value(solver, d->target); } if (d->source >= 0) { aux -= idl_vertex_value(solver, d->source); } q_set32(v, aux); // aux is the value of (target - source) in the model q_add(v, &d->constant); return true; } /* * Interface function: check whether x is an integer variable. */ bool idl_var_is_integer(idl_solver_t *solver, thvar_t x) { assert(0 <= x && x < solver->vtbl.nvars); return true; } /*************************** * INTERFACE DESCRIPTORS * **************************/ /* * Control interface */ static th_ctrl_interface_t idl_control = { (start_intern_fun_t) idl_start_internalization, (start_fun_t) idl_start_search, (propagate_fun_t) idl_propagate, (final_check_fun_t) idl_final_check, (increase_level_fun_t) idl_increase_decision_level, (backtrack_fun_t) idl_backtrack, (push_fun_t) idl_push, (pop_fun_t) idl_pop, (reset_fun_t) idl_reset, (clear_fun_t) idl_clear, }; /* * SMT interface: delete_atom and end_atom_deletion are not supported. */ static th_smt_interface_t idl_smt = { (assert_fun_t) idl_assert_atom, (expand_expl_fun_t) idl_expand_explanation, (select_pol_fun_t) idl_select_polarity, NULL, NULL, }; /* * Internalization interface */ static arith_interface_t idl_intern = { (create_arith_var_fun_t) idl_create_var, (create_arith_const_fun_t) idl_create_const, (create_arith_poly_fun_t) idl_create_poly, (create_arith_pprod_fun_t) idl_create_pprod, (create_arith_atom_fun_t) idl_create_eq_atom, (create_arith_atom_fun_t) idl_create_ge_atom, (create_arith_patom_fun_t) idl_create_poly_eq_atom, (create_arith_patom_fun_t) idl_create_poly_ge_atom, (create_arith_vareq_atom_fun_t) idl_create_vareq_atom, (assert_arith_axiom_fun_t) idl_assert_eq_axiom, (assert_arith_axiom_fun_t) idl_assert_ge_axiom, (assert_arith_paxiom_fun_t) idl_assert_poly_eq_axiom, (assert_arith_paxiom_fun_t) idl_assert_poly_ge_axiom, (assert_arith_vareq_axiom_fun_t) idl_assert_vareq_axiom, (assert_arith_cond_vareq_axiom_fun_t) idl_assert_cond_vareq_axiom, (assert_arith_clause_vareq_axiom_fun_t) idl_assert_clause_vareq_axiom, NULL, // attach_eterm is not supported NULL, // eterm of var is not supported (build_model_fun_t) idl_build_model, (free_model_fun_t) idl_free_model, (arith_val_in_model_fun_t) idl_value_in_model, (arith_var_is_int_fun_t) idl_var_is_integer, }; /***************** * FULL SOLVER * ****************/ /* * Initialze solver: * - core = attached smt_core solver * - gates = the attached gate manager */ void init_idl_solver(idl_solver_t *solver, smt_core_t *core, gate_manager_t *gates) { solver->core = core; solver->gate_manager = gates; solver->base_level = 0; solver->decision_level = 0; solver->unsat_before_search = false; init_dl_vartable(&solver->vtbl); solver->nvertices = 0; solver->zero_vertex = null_idl_vertex; init_idl_graph(&solver->graph); init_idl_atbl(&solver->atoms, DEFAULT_IDL_ATBL_SIZE); init_idl_astack(&solver->astack, DEFAULT_IDL_ASTACK_SIZE); init_idl_undo_stack(&solver->stack, DEFAULT_IDL_UNDO_STACK_SIZE); init_idl_trail_stack(&solver->trail_stack); init_int_htbl(&solver->htbl, 0); init_arena(&solver->arena); init_ivector(&solver->expl_buffer, DEFAULT_IDL_BUFFER_SIZE); init_ivector(&solver->aux_vector, DEFAULT_IDL_BUFFER_SIZE); // initialize the internal triple + buffer solver->triple.target = nil_vertex; solver->triple.source = nil_vertex; q_init(&solver->triple.constant); init_poly_buffer(&solver->buffer); // this gets allocated in create_model solver->value = NULL; // no jump buffer yet solver->env = NULL; // undo record for level 0 push_undo_record(&solver->stack, -1, 0, 0); assert(valid_idl_graph(&solver->graph)); } /* * Delete solver */ void delete_idl_solver(idl_solver_t *solver) { delete_dl_vartable(&solver->vtbl); delete_idl_graph(&solver->graph); delete_idl_atbl(&solver->atoms); delete_idl_astack(&solver->astack); delete_idl_undo_stack(&solver->stack); delete_idl_trail_stack(&solver->trail_stack); delete_int_htbl(&solver->htbl); delete_arena(&solver->arena); delete_ivector(&solver->expl_buffer); delete_ivector(&solver->aux_vector); q_clear(&solver->triple.constant); delete_poly_buffer(&solver->buffer); if (solver->value != NULL) { safe_free(solver->value); solver->value = NULL; } } /* * Attach a jump buffer */ void idl_solver_init_jmpbuf(idl_solver_t *solver, jmp_buf *buffer) { solver->env = buffer; } /* * Get the control and smt interfaces */ th_ctrl_interface_t *idl_ctrl_interface(idl_solver_t *solver) { return &idl_control; } th_smt_interface_t *idl_smt_interface(idl_solver_t *solver) { return &idl_smt; } /* * Get the internalization interface */ arith_interface_t *idl_arith_interface(idl_solver_t *solver) { return &idl_intern; }
ianamason/yices2
src/solvers/floyd_warshall/idl_floyd_warshall.c
C
gpl-3.0
66,769
#ifndef RUN_HPP #define RUN_HPP #include <QWidget> #include "game/loop.hpp" #include "game/network/api.hpp" namespace Game { extern Game::Loop *gameloop; extern Game::Network::Api *api; void start(QWidget* widget); void upload(QString name, int score); void updateHighscore(QWidget* widget); } // namespace Game #endif // RUN_HPP
Madh93/simon-says-pi
include/game/run.hpp
C++
gpl-3.0
357
### [autofig](autofig.md).[call](autofig.call.md).[Plot](autofig.call.Plot.md).get_cmap (function) ```py def get_cmap(self, cmapcycler=None) ```
kecnry/autofig
docs/api/autofig.call.Plot.get_cmap.md
Markdown
gpl-3.0
151
/** * Created by root on 9/15/16. */ $(function (home) { $('#home').ready(function (event) { var url = $(location).attr('pathname'); var tok = $('input[name=csrfmiddlewaretoken]').val(); var delete_route_form = 'delete_route_form'; var submit_delete = 'submit_delete'; var data = {csrfmiddlewaretoken: tok}; $.ajax({ type: "POST", url: url, data: data, success: function (data) { console.log('sucssesfull'); //$("#from_box input[name='10.0.25.0 255.255.255.0 10.0.10.1:t']").prop("checked", true); for (var key in data) { //console.log(data[key],data[key][0]); var values = data[key]; for (var i = 0; i < values.length; i++) { //console.log(values[i]+":"+key); var changer = values[i] + ":" + key; //console.log(changer); $("#from_box input[value='" + changer + "']").prop("checked", true); } } } }); }); }); $(function (menu4) { $('#menu4').ready(function (event) { var url = $(location).attr('pathname'); var tok = $('input[name=csrfmiddlewaretoken]').val(); var delete_route_form = 'delete_route_form'; var get_group = 'get_group'; var data = {csrfmiddlewaretoken: tok, get_group: get_group}; $.ajax({ type: "POST", url: url, data: data, success: function (data) { console.log('sucssesfull group', data); for (var key in data) { var values = data[key]; for (var i = 0; i < values.length; i++) { var changer = values[i] + ":" + key; $("#group_manage_users input[value='" + changer + "']").prop("checked", true); } } } }); }); }); $(function (delete_route) { $('#delete_route input[name="select_all_route"]').click(function (event) { var get_value = $(this).attr('value'); if ($('#delete_route input[value="' + get_value + '"]').is(':checked')) { $('#delete_route input[type=checkbox]').prop("checked", true); } else { $('#delete_route input[type=checkbox]').prop("checked", false); } }); }); $(function (delete_group) { $('#delete_group input[name="select_all_group"]').click(function (event) { var get_value = $(this).attr('value'); if ($('#delete_group input[value="' + get_value + '"]').is(':checked')) { $('#delete_group input[type=checkbox]').prop("checked", true); } else { $('#delete_group input[type=checkbox]').prop("checked", false); } }); }); $(function(id_select_group){ $('#id_select_group').click(function(event) { event.preventDefault(); var id_select_user = $("#id_select_group").val(); var url = $(location).attr('pathname'); var tok = $('input[name=csrfmiddlewaretoken]').val(); var select_group = 'select_group'; var delete_route_form = 'delete_route_form'; var data = {csrfmiddlewaretoken:tok,select_group:select_group, id_select_user:id_select_user,delete_route_form:delete_route_form}; $('#group_manage input[name="group_vpn"]').prop("checked", false); $.ajax({ type: "POST", url: url, data: data, success: function (data) {console.log('sucssesfull group acl',data); $.each(data, function(val,text){ console.log(text); for (var key in data) { console.log(data[key],data[key][0]); var values = data[key]; for (var i=0; i< values.length; i++){ var changer = values[i]; console.log(changer); $("#group_manage input[value='" + changer + "']").prop("checked", true); } } }); } }); }); });
Oleh-Hrebchuk/OpenVPN-TryFalse
static/js/acl_settings.js
JavaScript
gpl-3.0
4,372
#ifndef __BIR_EXT_H__ #define __BIR_EXT_H__ /* * DO NOT MODIFY. This file is automatically generated by scripts/apigen.py, * based on the <plugin>_int.h file in your plugin directory. */ #include <dlfcn.h> #include "panda_plugin.h" typedef void(*index_this_passage_c_t)(void *vpindc, void *vpindex, uint8_t *binary_passage, uint32_t len, uint32_t passage_ind); static index_this_passage_c_t __index_this_passage_c = NULL; static inline void index_this_passage_c(void *vpindc, void *vpindex, uint8_t *binary_passage, uint32_t len, uint32_t passage_ind); static inline void index_this_passage_c(void *vpindc, void *vpindex, uint8_t *binary_passage, uint32_t len, uint32_t passage_ind){ assert(__index_this_passage_c); return __index_this_passage_c(vpindc,vpindex,binary_passage,len,passage_ind); } typedef void *(*invert_c_t)(void *vpindc, void *vpindex); static invert_c_t __invert_c = NULL; static inline void * invert_c(void *vpindc, void *vpindex); static inline void * invert_c(void *vpindc, void *vpindex){ assert(__invert_c); return __invert_c(vpindc,vpindex); } typedef void(*marshall_index_common_c_t)(void *vpindc); static marshall_index_common_c_t __marshall_index_common_c = NULL; static inline void marshall_index_common_c(void *vpindc); static inline void marshall_index_common_c(void *vpindc){ assert(__marshall_index_common_c); return __marshall_index_common_c(vpindc); } typedef void(*marshall_index_c_t)(void *vpindc, void *vpindex, char *file_pfx); static marshall_index_c_t __marshall_index_c = NULL; static inline void marshall_index_c(void *vpindc, void *vpindex, char *file_pfx); static inline void marshall_index_c(void *vpindc, void *vpindex, char *file_pfx){ assert(__marshall_index_c); return __marshall_index_c(vpindc,vpindex,file_pfx); } typedef void(*marshall_invindex_c_t)(void *vpindc, void *vpinv, char *file_pfx); static marshall_invindex_c_t __marshall_invindex_c = NULL; static inline void marshall_invindex_c(void *vpindc, void *vpinv, char *file_pfx); static inline void marshall_invindex_c(void *vpindc, void *vpinv, char *file_pfx){ assert(__marshall_invindex_c); return __marshall_invindex_c(vpindc,vpinv,file_pfx); } typedef void *(*unmarshall_preprocessed_scores_c_t)(char *filename_pfx); static unmarshall_preprocessed_scores_c_t __unmarshall_preprocessed_scores_c = NULL; static inline void * unmarshall_preprocessed_scores_c(char *filename_pfx); static inline void * unmarshall_preprocessed_scores_c(char *filename_pfx){ assert(__unmarshall_preprocessed_scores_c); return __unmarshall_preprocessed_scores_c(filename_pfx); } typedef void(*query_with_passage_c_t)(void *vpindc, void *vppassage, void *vppps, uint32_t *ind, double *score); static query_with_passage_c_t __query_with_passage_c = NULL; static inline void query_with_passage_c(void *vpindc, void *vppassage, void *vppps, uint32_t *ind, double *score); static inline void query_with_passage_c(void *vpindc, void *vppassage, void *vppps, uint32_t *ind, double *score){ assert(__query_with_passage_c); return __query_with_passage_c(vpindc,vppassage,vppps,ind,score); } typedef void *(*new_index_common_c_t)(char *filename_prefix, uint32_t min_n_gram, uint32_t max_n_gram, uint32_t passage_len_bytes); static new_index_common_c_t __new_index_common_c = NULL; static inline void * new_index_common_c(char *filename_prefix, uint32_t min_n_gram, uint32_t max_n_gram, uint32_t passage_len_bytes); static inline void * new_index_common_c(char *filename_prefix, uint32_t min_n_gram, uint32_t max_n_gram, uint32_t passage_len_bytes){ assert(__new_index_common_c); return __new_index_common_c(filename_prefix,min_n_gram,max_n_gram,passage_len_bytes); } typedef void *(*new_index_c_t)(void); static new_index_c_t __new_index_c = NULL; static inline void * new_index_c(void); static inline void * new_index_c(void){ assert(__new_index_c); return __new_index_c(); } typedef void(*index_common_set_passage_len_bytes_c_t)(void *vpindc, uint32_t passage_len_bytes); static index_common_set_passage_len_bytes_c_t __index_common_set_passage_len_bytes_c = NULL; static inline void index_common_set_passage_len_bytes_c(void *vpindc, uint32_t passage_len_bytes); static inline void index_common_set_passage_len_bytes_c(void *vpindc, uint32_t passage_len_bytes){ assert(__index_common_set_passage_len_bytes_c); return __index_common_set_passage_len_bytes_c(vpindc,passage_len_bytes); } #define API_PLUGIN_NAME "bir" #define IMPORT_PPP(module, func_name) { \ __##func_name = (func_name##_t) dlsym(module, #func_name); \ char *err = dlerror(); \ if (err) { \ printf("Couldn't find %s function in library %s.\n", #func_name, API_PLUGIN_NAME); \ printf("Error: %s\n", err); \ return false; \ } \ } static inline bool init_bir_api(void);static inline bool init_bir_api(void){ void *module = panda_get_plugin_by_name("panda_" API_PLUGIN_NAME ".so"); if (!module) { printf("In trying to add plugin, couldn't load %s plugin\n", API_PLUGIN_NAME); return false; } dlerror(); IMPORT_PPP(module, index_this_passage_c) IMPORT_PPP(module, invert_c) IMPORT_PPP(module, marshall_index_common_c) IMPORT_PPP(module, marshall_index_c) IMPORT_PPP(module, marshall_invindex_c) IMPORT_PPP(module, unmarshall_preprocessed_scores_c) IMPORT_PPP(module, query_with_passage_c) IMPORT_PPP(module, new_index_common_c) IMPORT_PPP(module, new_index_c) IMPORT_PPP(module, index_common_set_passage_len_bytes_c) return true; } #undef API_PLUGIN_NAME #undef IMPORT_PPP #endif
KernelAnalysisPlatform/kvalgrind
qemu/panda_plugins/bir/bir_ext.h
C
gpl-3.0
5,558
<div class="post"> <div class="alert"> <strong>Psst. Your database is showing.</strong> <a href="about/configure" class="go">Fix the configuration</a> </div> </div>
yolesaber/altermet
app/views/_server_config.php
PHP
gpl-3.0
177
# Fiches de Travaux Pratiques Ce répertoire contient un ensemble de fiches pédagogiques destinées à l'enseignement du HTML, du CSS, le JavaScript (et pourquoi pas plus). [Voir l'ensemble des fiches →](http://traindrop.github.io/fiches/) ## Contribuer une nouvelle fiche Pour commencer une nouvelle fiche, vous devez passer par GitHub. Si vous êtes novice, une [petite lecture](http://articles.nissone.com/2014/11/gitpourlanulle/ "GitPourLaNulle sur le blog de Nissone") peut vous aider. Voici les étapes à suivre : * réaliser un *fork* de ce dépôt sur votre compte GitHub ; * cloner ce dépôt en local sur votre poste : ``` https://github.com/{votre pseudo}/fiches.git ``` * Au sein de votre dépôt GitHub local, travailler dans la branche ```master``` * Soit via votre gestionnaire graphique * Soit en ligne de commande : ```CLIPS git checkout master ``` * au sein du dossier ```_posts```, ajoutez votre nouvelle fiche. Vous pouvez éventuellement copier/coller une fiche existante pour avoir un modèle. Deux formats sont possibles : HTML ou Markdown. Une fois votre fiche écrite, vous pouvez la contribuer en faisant une *Pull Request*. L'équipe de TrainDrop s'occupera de l'intégrer au bon endroit. N'oubliez pas de bien renseigner le titre de votre fiche et les metadonnées "Principes abordés" et "Niveau requis", c'est ce qui servira aux lecteurs à la retrouver dans l'[index](http://traindrop.github.io/fiches/). Evidemment, si vous avez des idées pour améliorer ce processus de contribution, n'hésitez pas à nous en faire part [dans le ticket dédié](https://github.com/TrainDrop/fiches/issues/1). ## Bonnes pratiques de mise en forme Pour aider les développeurs et contributeurs à définir et maintenir des styles de codage cohérents en dépit de leurs différents éditeurs de texte ou IDE, TrainDrop utilise [EditorConfig](http://editorconfig.org/). Le fichier de configuration, situé à la racine du projet, définit quelques règles qui seront automatiquement appliquées par votre outil si vous l'équipez du plugin adapté. Des plugins existent pour pour de nombreux outils, n'hésitez pas à [télécharger et installer celui ou ceux qu'il vous faut](http://editorconfig.org/#download "Télécharger un plugin EditorConfig").
TrainDrop/traindrop.github.io
README.md
Markdown
gpl-3.0
2,283
/* This file is part of Sensorium2 <http://code.google.com/p/sensorium> * * Copyright (C) 2009-2010 Aaron Maslen * 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/> */ using System; using System.Collections.Generic; using System.ComponentModel; using System.Runtime.InteropServices; using System.Threading; using log4net.Appender; using Sensorium.Core.Plugins; namespace Sensorium.Core { public class AppData : IAppInterface { private List<Sensor> _sensors; public List<Sensor> Sensors { get { return new List<Sensor>(_sensors); } set { _sensors = value; } } public Dictionary<string, IPluginInterface> Plugins { get; set; } public SettingsPlugin EnabledSettingsPlugin { get; set; } public string Version { get; set; } public string FileVersion { get; set; } public string FriendlyName { get; set; } public string HostId { get { return '{' + HostGuid + '}' + FriendlyName; } } public string Copyright { get; set; } public string Description { get; set; } private readonly string _hostGuid = Guid.NewGuid().ToString(); public string HostGuid { get { return _hostGuid; } } public MemoryAppender Log { get; set; } public delegate string GetSettingDelegate(string key); public delegate void SetSettingDelegate(string key, string value); public event EventHandler<CancelEventArgs> HideConsoleEventHandler; public GetSettingDelegate GetSetting { get; set; } public SetSettingDelegate SetSetting { get; set; } public void OnHideConsole() { EventHandler<CancelEventArgs> handler = HideConsoleEventHandler; CancelEventArgs e = new CancelEventArgs(false); if (handler != null) handler(this, e); if(e.Cancel) return; Console.Title = _hostGuid; //Wait for the new title to be applied to the window Thread.Sleep(200); IntPtr hWnd = FindWindow(null, Console.Title); if (hWnd != IntPtr.Zero) //Hide the window ShowWindow(hWnd, 0); // 0 = SW_HIDE } [DllImport("user32.dll")] private static extern IntPtr FindWindow(string lpClassName, string lpWindowName); [DllImport("user32.dll")] private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); } }
lukgad/sensorium
Sensorium2/Core/AppData.cs
C#
gpl-3.0
2,863
* This file contains the following subroutines, related to reading the * extraterrestrial spectral irradiances: * rdetfl * read1 * read2 *=============================================================================* SUBROUTINE rdetfl(nw,wl,f) *-----------------------------------------------------------------------------* *= PURPOSE: =* *= Read and re-grid extra-terrestrial flux data. =* *-----------------------------------------------------------------------------* *= PARAMETERS: =* *= NW - INTEGER, number of specified intervals + 1 in working (I)=* *= wavelength grid =* *= WL - REAL, vector of lower limits of wavelength intervals in (I)=* *= working wavelength grid =* *= F - REAL, spectral irradiance at the top of the atmosphere at (O)=* *= each specified wavelength =* *-----------------------------------------------------------------------------* *-----------------------------------------------------------------------------* *= This program is free software; you can redistribute it and/or modify =* *= it under the terms of the GNU General Public License as published by the =* *= Free Software Foundation; either version 2 of the license, or (at your =* *= option) any later version. =* *= The TUV package is distributed in the hope that it will be useful, but =* *= WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBI- =* *= LITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public =* *= License for more details. =* *= To obtain a copy of the GNU General Public License, write to: =* *= Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. =* *-----------------------------------------------------------------------------* *= To contact the authors, please mail to: =* *= Sasha Madronich, NCAR/ACD, P.O.Box 3000, Boulder, CO, 80307-3000, USA or =* *= send email to: sasha@ucar.edu =* *-----------------------------------------------------------------------------* IMPLICIT NONE INCLUDE '../params' integer kdata parameter(kdata=900000) * input: (wavelength grid) INTEGER nw REAL wl(kw) INTEGER iw * output: (extra terrestrial solar flux) REAL f(kw) * INTERNAL: * work arrays for input data files: CHARACTER*40 fil REAL x1(kdata) REAL y1(kdata) INTEGER nhead, n, i, ierr REAL dum * data gridded onto wl(kw) grid: REAL yg1(kw) REAL yg2(kw) REAL yg3(kw) REAL yg4(kw) INTEGER msun *_______________________________________________________________________ * select desired extra-terrestrial solar irradiance, using msun: * 1 = extsol.flx: De Luisi, JGR 80, 345-354, 1975 * 280-400 nm, 1 nm steps. * 2 = lowsun3.flx: Lowtran (John Bahr, priv. comm.) * 173.974-500000 nm, ca. 0.1 nm steps in UV-B * 3 = modtran1.flx: Modtran (Gail Anderson, priv. comm.) * 200.55-949.40, 0.05 nm steps * 4 = nicolarv.flx: wvl<300 nm from Nicolet, Plan. Sp. Sci., 29, 951-974, 1981. * wvl>300 nm supplied by Thekaekera, Arvesen Applied Optics 8, * 11, 2215-2232, 1969 (also see Thekaekera, Applied Optics, 13, * 3, 518, 1974) but with corrections recommended by: * Nicolet, Plan. Sp. Sci., 37, 1249-1289, 1989. * 270.0-299.0 nm in 0.5 nm steps * 299.6-340.0 nm in ca. 0.4 nm steps * 340.0-380.0 nm in ca. 0.2 nm steps * 380.0-470.0 nm in ca. 0.1 nm steps * 5 = solstice.flx: From: MX%"ROTTMAN@virgo.hao.ucar.edu" 12-OCT-1994 13:03:01.62 * Original data gave Wavelength in vacuum * (Converted to wavelength in air using Pendorf, 1967, J. Opt. Soc. Am.) * 279.5 to 420 nm, 0.24 nm spectral resolution, approx 0.07 nm steps * 6 = suntoms.flx: (from TOMS CD-ROM). 280-340 nm, 0.05 nm steps. * 7 = neckel.flx: H.Neckel and D.Labs, "The Solar Radiation Between 3300 and 12500 A", * Solar Physics v.90, pp.205-258 (1984). * 1 nm between 330.5 and 529.5 nm * 2 nm between 631.0 and 709.0 nm * 5 nm between 872.5 and 1247.4 nm * Units: must convert to W m-2 nm-1 from photons cm-2 s-1 nm-1 * 8 = atlas3.flx: ATLAS3-SUSIM 13 Nov 94 high resolution (0.15 nm FWHM) * available by ftp from susim.nrl.navy.mil * atlas3_1994_317_a.dat, downloaded 30 Sept 98. * 150-407.95 nm, in 0.05 nm steps * (old version from Dianne Prinz through Jim Slusser) * orig wavelengths in vac, correct here to air. * 9 = solstice.flx: solstice 1991-1996, average * 119.5-420.5 nm in 1 nm steps * 10 = susim_hi.flx: SUSIM SL2 high resolution * 120.5-400.0 in 0.05 nm intervals (0.15 nm resolution) * 11 = wmo85.flx: from WMO 1985 Atmospheric Ozone (report no. 16) * on variable-size bins. Original values are per bin, not * per nm. * 12 = combine susim_hi.flx for .lt. 350 nm, neckel.flx for .gt. 350 nm. * * 13 = combine * for wl(iw) .lt. 150.01 susim_hi.flx * for wl(iw) .ge. 150.01 and wl(iw) .le. 400 atlas3.flx * for wl(iw) .gt. 400 Neckel & Labs * * 14 = combine * for wl(iw) .le. 350 susim_hi.flx * for wl(iw) .gt. 350 Neckel & Labs * * 15 = combine * for wl(iw) .lt. 150.01 susim_hi.flx * for wl(iw) .ge. 150.01 .and. wl(iw) .lt. 200.07 atlas3.flx * for wl(iw) .ge. 200.07 .and. wl(iw) .le. 1000.99 Chance and Kurucz 2010 * for wl(iw) .gt. 1000.99 Neckel & Labs msun = 15 * simple files are read and interpolated here in-line. Reading of * more complex files may be done with longer code in a read#.f subroutine. IF (msun .EQ. 1) THEN fil = 'DATAE1/SUN/extsol.flx' write(kout,*) fil OPEN(UNIT=kin,FILE=fil,STATUS='old') nhead = 3 n =121 DO i = 1, nhead READ(kin,*) ENDDO DO i = 1, n READ(kin,*) x1(i), y1(i) ENDDO CLOSE (kin) CALL addpnt(x1,y1,kdata,n,x1(1)*(1.-deltax),0.) CALL addpnt(x1,y1,kdata,n, 0.,0.) CALL addpnt(x1,y1,kdata,n,x1(n)*(1.+deltax),0.) CALL addpnt(x1,y1,kdata,n, 1.e+38,0.) CALL inter2(nw,wl,yg1,n,x1,y1,ierr) IF (ierr .NE. 0) THEN WRITE(*,*) ierr, fil STOP ENDIF DO iw = 1, nw-1 f(iw) = yg1(iw) ENDDO ELSEIF (msun .EQ. 2) THEN fil = 'DATAE1/SUN/lowsun3.flx' write(kout,*) fil OPEN(UNIT=kin,FILE=fil,STATUS='old') nhead = 3 n = 4327 DO i = 1, nhead READ(kin,*) ENDDO DO i = 1, n READ(kin,*) x1(i), y1(i) ENDDO CLOSE (kin) CALL addpnt(x1,y1,kdata,n,x1(1)*(1.-deltax),0.) CALL addpnt(x1,y1,kdata,n, 0.,0.) CALL addpnt(x1,y1,kdata,n,x1(n)*(1.+deltax),0.) CALL addpnt(x1,y1,kdata,n, 1.e+38,0.) CALL inter2(nw,wl,yg1,n,x1,y1,ierr) IF (ierr .NE. 0) THEN WRITE(*,*) ierr, fil STOP ENDIF DO iw = 1, nw-1 f(iw) = yg1(iw) ENDDO ELSEIF (msun .EQ. 3) THEN fil = 'DATAE1/SUN/modtran1.flx' write(kout,*) fil OPEN(UNIT=kin,FILE=fil,STATUS='old') nhead = 6 n = 14980 DO i = 1, nhead READ(kin,*) ENDDO DO i = 1, n READ(kin,*) x1(i), y1(i) ENDDO CLOSE (kin) CALL addpnt(x1,y1,kdata,n,x1(1)*(1.-deltax),0.) CALL addpnt(x1,y1,kdata,n, 0.,0.) CALL addpnt(x1,y1,kdata,n,x1(n)*(1.+deltax),0.) CALL addpnt(x1,y1,kdata,n, 1.e+38,0.) CALL inter2(nw,wl,yg1,n,x1,y1,ierr) IF (ierr .NE. 0) THEN WRITE(*,*) ierr, fil STOP ENDIF DO iw = 1, nw-1 f(iw) = yg1(iw) ENDDO ELSEIF (msun .EQ. 4) THEN fil = 'DATAE1/SUN/nicolarv.flx' write(kout,*) fil OPEN(UNIT=kin,FILE=fil,STATUS='old') nhead = 8 n = 1260 DO i = 1, nhead READ(kin,*) ENDDO DO i = 1, n READ(kin,*) x1(i), y1(i) ENDDO CLOSE (kin) CALL addpnt(x1,y1,kdata,n,x1(1)*(1.-deltax),0.) CALL addpnt(x1,y1,kdata,n, 0.,0.) CALL addpnt(x1,y1,kdata,n,x1(n)*(1.+deltax),0.) CALL addpnt(x1,y1,kdata,n, 1.e+38,0.) CALL inter2(nw,wl,yg1,n,x1,y1,ierr) IF (ierr .NE. 0) THEN WRITE(*,*) ierr, fil STOP ENDIF DO iw = 1, nw-1 f(iw) = yg1(iw) ENDDO ELSEIF (msun .EQ. 5) THEN * unofficial - do not use fil = 'DATAE2/SUN/solstice.flx' write(kout,*) fil OPEN(UNIT=kin,FILE=fil,STATUS='old') nhead = 11 n = 2047 DO i = 1, nhead READ(kin,*) ENDDO DO i = 1, n READ(kin,*) x1(i), y1(i) ENDDO CLOSE (kin) CALL addpnt(x1,y1,kdata,n,x1(1)*(1.-deltax),0.) CALL addpnt(x1,y1,kdata,n, 0.,0.) CALL addpnt(x1,y1,kdata,n,x1(n)*(1.+deltax),0.) CALL addpnt(x1,y1,kdata,n, 1.e+38,0.) CALL inter2(nw,wl,yg1,n,x1,y1,ierr) IF (ierr .NE. 0) THEN WRITE(*,*) ierr, fil STOP ENDIF DO iw = 1, nw-1 f(iw) = yg1(iw) ENDDO ELSEIF (msun .EQ. 6) THEN * unofficial - do not use fil = 'DATAE2/SUN/suntoms.flx' write(kout,*) fil OPEN(UNIT=kin,FILE=fil,STATUS='old') nhead = 3 n = 1200 DO i = 1, nhead READ(kin,*) ENDDO DO i = 1, n READ(kin,*) x1(i), y1(i) y1(i) = y1(i)* 1.e-3 ENDDO CLOSE (kin) CALL addpnt(x1,y1,kdata,n,x1(1)*(1.-deltax),0.) CALL addpnt(x1,y1,kdata,n, 0.,0.) CALL addpnt(x1,y1,kdata,n,x1(n)*(1.+deltax),0.) CALL addpnt(x1,y1,kdata,n, 1.e+38,0.) CALL inter2(nw,wl,yg1,n,x1,y1,ierr) IF (ierr .NE. 0) THEN WRITE(*,*) ierr, fil STOP ENDIF DO iw = 1, nw-1 f(iw) = yg1(iw) ENDDO ELSEIF (msun .EQ. 7) THEN fil = 'DATAE1/SUN/neckel.flx' write(kout,*) fil OPEN(UNIT=kin,FILE=fil,STATUS='old') nhead = 11 n = 496 DO i = 1, nhead READ(kin,*) ENDDO DO i = 1, n READ(kin,*) dum, y1(i) if (dum .lt. 630.0) x1(i) = dum - 0.5 if (dum .gt. 630.0 .and. dum .lt. 870.0) x1(i) = dum - 1.0 if (dum .gt. 870.0) x1(i) = dum - 2.5 y1(i) = y1(i) * 1.E4 * hc / (dum * 1.E-9) ENDDO CLOSE (kin) x1(n+1) = x1(n) + 2.5 do i = 1, n y1(i) = y1(i) * (x1(i+1)-x1(i)) enddo call inter3(nw,wl,yg2,n+1,x1,y1,0) do iw = 1, nw-1 yg1(iw) = yg1(iw) / (wl(iw+1)-wl(iw)) enddo DO iw = 1, nw-1 f(iw) = yg1(iw) ENDDO ELSEIF (msun .EQ. 8) THEN nhead = 5 fil = 'DATAE1/SUN/atlas3_1994_317_a.dat' write(kout,*) fil OPEN(UNIT=kin,FILE=fil,STATUS='old') nhead = 13 n = 5160 DO i = 1, nhead READ(kin,*) ENDDO DO i = 1, n READ(kin,*) x1(i), y1(i) y1(i) = y1(i) * 1.E-3 ENDDO CLOSE (kin) CALL addpnt(x1,y1,kdata,n,x1(1)*(1.-deltax),0.) CALL addpnt(x1,y1,kdata,n, 0.,0.) CALL addpnt(x1,y1,kdata,n,x1(n)*(1.+deltax),0.) CALL addpnt(x1,y1,kdata,n, 1.e+38,0.) CALL inter2(nw,wl,yg1,n,x1,y1,ierr) IF (ierr .NE. 0) THEN WRITE(*,*) ierr, fil STOP ENDIF DO iw = 1, nw-1 f(iw) = yg1(iw) ENDDO ELSEIF (msun .EQ. 9) THEN fil = 'DATAE1/SUN/solstice.flx' write(kout,*) fil OPEN(UNIT=kin,FILE=fil,STATUS='old') nhead = 2 n = 302 DO i = 1, nhead READ(kin,*) ENDDO DO i = 1, n READ(kin,*) x1(i), y1(i) ENDDO CLOSE (kin) CALL addpnt(x1,y1,kdata,n,x1(1)*(1.-deltax),0.) CALL addpnt(x1,y1,kdata,n, 0.,0.) CALL addpnt(x1,y1,kdata,n,x1(n)*(1.+deltax),0.) CALL addpnt(x1,y1,kdata,n, 1.e+38,0.) CALL inter2(nw,wl,yg1,n,x1,y1,ierr) IF (ierr .NE. 0) THEN WRITE(*,*) ierr, fil STOP ENDIF DO iw = 1, nw-1 f(iw) = yg1(iw) ENDDO ELSEIF (msun .EQ. 10) THEN WRITE(kout,*) 'DATAE1/SUN/susim_hi.flx' CALL read1(nw,wl,yg1) DO iw = 1, nw-1 f(iw) = yg1(iw) ENDDO ELSEIF (msun .EQ. 11) THEN WRITE(kout,*) 'DATAE1/SUN/wmo85.flx' CALL read2(nw,wl,yg1) DO iw = 1, nw-1 f(iw) = yg1(iw) ENDDO ELSEIF (msun .EQ. 12) THEN WRITE(kout,*) 'DATAE1/SUN/susim_hi.flx' CALL read1(nw,wl,yg1) fil = 'DATAE1/SUN/neckel.flx' write(kout,*) fil OPEN(UNIT=kin,FILE=fil,STATUS='old') nhead = 11 n = 496 DO i = 1, nhead READ(kin,*) ENDDO DO i = 1, n READ(kin,*) dum, y1(i) if (dum .lt. 630.0) x1(i) = dum - 0.5 if (dum .gt. 630.0 .and. dum .lt. 870.0) x1(i) = dum - 1.0 if (dum .gt. 870.0) x1(i) = dum - 2.5 y1(i) = y1(i) * 1.E4 * hc / (dum * 1.E-9) ENDDO CLOSE (kin) x1(n+1) = x1(n) + 2.5 do i = 1, n y1(i) = y1(i) * (x1(i+1)-x1(i)) enddo call inter3(nw,wl,yg2,n+1,x1,y1,0) do iw = 1, nw-1 yg2(iw) = yg2(iw) / (wl(iw+1)-wl(iw)) enddo DO iw = 1, nw-1 IF (wl(iw) .GT. 350.) THEN f(iw) = yg2(iw) ELSE f(iw) = yg1(iw) ENDIF ENDDO ELSEIF (msun .EQ. 13) THEN WRITE(kout,*) 'DATAE1/SUN/susim_hi.flx' CALL read1(nw,wl,yg1) nhead = 5 fil = 'DATAE1/SUN/atlas3_1994_317_a.dat' write(kout,*) fil OPEN(UNIT=kin,FILE=fil,STATUS='old') n = 5160 DO i = 1, nhead READ(kin,*) ENDDO DO i = 1, n READ(kin,*) x1(i), y1(i) y1(i) = y1(i) * 1.E-3 ENDDO CLOSE (kin) CALL addpnt(x1,y1,kdata,n,x1(1)*(1.-deltax),0.) CALL addpnt(x1,y1,kdata,n, 0.,0.) CALL addpnt(x1,y1,kdata,n,x1(n)*(1.+deltax),0.) CALL addpnt(x1,y1,kdata,n, 1.e+38,0.) CALL inter2(nw,wl,yg2,n,x1,y1,ierr) IF (ierr .NE. 0) THEN WRITE(*,*) ierr, fil STOP ENDIF fil = 'DATAE1/SUN/neckel.flx' write(kout,*) fil OPEN(UNIT=kin,FILE=fil,STATUS='old') nhead = 11 n = 496 DO i = 1, nhead READ(kin,*) ENDDO DO i = 1, n READ(kin,*) dum, y1(i) if (dum .lt. 630.0) x1(i) = dum - 0.5 if (dum .gt. 630.0 .and. dum .lt. 870.0) x1(i) = dum - 1.0 if (dum .gt. 870.0) x1(i) = dum - 2.5 y1(i) = y1(i) * 1.E4 * hc / (dum * 1.E-9) ENDDO CLOSE (kin) x1(n+1) = x1(n) + 2.5 call inter4(nw,wl,yg3,n+1,x1,y1,0) DO iw = 1, nw-1 IF (wl(iw) .LT. 150.01) THEN f(iw) = yg1(iw) ELSE IF ((wl(iw) .GE. 150.01) .AND. wl(iw) .LE. 400.) THEN f(iw) = yg2(iw) ELSE IF (wl(iw) .GT. 400.) THEN f(iw) = yg3(iw) ENDIF ENDDO ELSEIF (msun .EQ. 14) THEN WRITE(kout,*) 'DATAE1/SUN/susim_hi.flx' CALL read1(nw,wl,yg1) fil = 'DATAE1/SUN/neckel.flx' write(kout,*) fil OPEN(UNIT=kin,FILE=fil,STATUS='old') nhead = 11 n = 496 DO i = 1, nhead READ(kin,*) ENDDO DO i = 1, n READ(kin,*) dum, y1(i) if (dum .lt. 630.0) x1(i) = dum - 0.5 if (dum .gt. 630.0 .and. dum .lt. 870.0) x1(i) = dum - 1.0 if (dum .gt. 870.0) x1(i) = dum - 2.5 y1(i) = y1(i) * 1.E4 * hc / (dum * 1.E-9) ENDDO CLOSE (kin) x1(n+1) = x1(n) + 2.5 call inter4(nw,wl,yg3,n+1,x1,y1,0) DO iw = 1, nw-1 IF (wl(iw) .LE. 350.) THEN f(iw) = yg1(iw) ELSE f(iw) = yg3(iw) ENDIF ENDDO ELSEIF (msun .EQ. 15) THEN WRITE(kout,*) 'DATAE1/SUN/susim_hi.flx' CALL read1(nw,wl,yg1) nhead = 5 fil = 'DATAE1/SUN/atlas3_1994_317_a.dat' write(kout,*) fil OPEN(UNIT=kin,FILE=fil,STATUS='old') n = 5160 DO i = 1, nhead READ(kin,*) ENDDO DO i = 1, n READ(kin,*) x1(i), y1(i) y1(i) = y1(i) * 1.E-3 ENDDO CLOSE (kin) CALL addpnt(x1,y1,kdata,n,x1(1)*(1.-deltax),0.) CALL addpnt(x1,y1,kdata,n, 0.,0.) CALL addpnt(x1,y1,kdata,n,x1(n)*(1.+deltax),0.) CALL addpnt(x1,y1,kdata,n, 1.e+38,0.) CALL inter2(nw,wl,yg2,n,x1,y1,ierr) IF (ierr .NE. 0) THEN WRITE(*,*) ierr, fil STOP ENDIF fil = 'DATAE1/SUN/neckel.flx' write(kout,*) fil OPEN(UNIT=kin,FILE=fil,STATUS='old') nhead = 11 n = 496 DO i = 1, nhead READ(kin,*) ENDDO DO i = 1, n READ(kin,*) dum, y1(i) if (dum .lt. 630.0) x1(i) = dum - 0.5 if (dum .gt. 630.0 .and. dum .lt. 870.0) x1(i) = dum - 1.0 if (dum .gt. 870.0) x1(i) = dum - 2.5 y1(i) = y1(i) * 1.E4 * hc / (dum * 1.E-9) ENDDO CLOSE (kin) x1(n+1) = x1(n) + 2.5 call inter4(nw,wl,yg3,n+1,x1,y1,0) nhead = 8 fil = 'DATAE1/SUN/sao2010.solref.converted' write(kout,*) fil OPEN(UNIT=kin,FILE=fil,STATUS='old') n = 80099 - nhead DO i = 1, nhead READ(kin,*) ENDDO DO i = 1, n READ(kin,*) x1(i), dum, y1(i), dum c y1(i) = y1(i) * 1.E4 * hc / (x1(i) * 1.E-9) ENDDO CLOSE (kin) CALL addpnt(x1,y1,kdata,n,x1(1)*(1.-deltax),0.) CALL addpnt(x1,y1,kdata,n, 0.,0.) CALL addpnt(x1,y1,kdata,n,x1(n)*(1.+deltax),0.) CALL addpnt(x1,y1,kdata,n, 1.e+38,0.) CALL inter2(nw,wl,yg4,n,x1,y1,ierr) IF (ierr .NE. 0) THEN WRITE(*,*) ierr, fil STOP ENDIF * for wl(iw) .lt. 150.01 susim_hi.flx * for wl(iw) .ge. 150.01 .and. wl(iw) .lt. 200.07 atlas3.flx * for wl(iw) .ge. 200.07 .and. wl(iw) .le. 1000.99 Chance and Kurucz 2010 * for wl(iw) .gt. 1000.99 Neckel & Labs DO iw = 1, nw-1 IF (wl(iw) .LT. 150.01) THEN f(iw) = yg1(iw) ELSE IF ((wl(iw) .GE. 150.01) .AND. wl(iw) .LT. 200.07) THEN f(iw) = yg2(iw) ELSE IF ((wl(iw) .GE. 200.07) .AND. wl(iw) .LT. 1000.99)THEN f(iw) = yg4(iw) ELSE IF (wl(iw) .GT. 1000.99) THEN f(iw) = yg3(iw) ENDIF ENDDO ENDIF RETURN END *=============================================================================* SUBROUTINE read1(nw,wl,f) *-----------------------------------------------------------------------------* *= PURPOSE: =* *= Read extra-terrestrial flux data. Re-grid data to match specified =* *= working wavelength grid. =* *-----------------------------------------------------------------------------* *= PARAMETERS: =* *= NW - INTEGER, number of specified intervals + 1 in working (I)=* *= wavelength grid =* *= WL - REAL, vector of lower limits of wavelength intervals in (I)=* *= working wavelength grid =* *= F - REAL, spectral irradiance at the top of the atmosphere at (O)=* *= each specified wavelength =* *-----------------------------------------------------------------------------* IMPLICIT NONE INCLUDE '../params' * input: (wavelength grid) INTEGER nw REAL wl(kw) * output: (extra terrestrial solar flux) REAL f(kw) * local: REAL lambda_hi(10000),irrad_hi(10000) REAL lambda INTEGER ierr INTEGER i, j, n CHARACTER*40 FIL *_______________________________________________________________________ ******* SUSIM irradiance *_______________________________________________________________________ * VanHoosier, M. E., J.-D. F. Bartoe, G. E. Brueckner, and * D. K. Prinz, Absolute solar spectral irradiance 120 nm - * 400 nm (Results from the Solar Ultraviolet Spectral Irradiance * Monitor - SUSIM- Experiment on board Spacelab 2), * Astro. Lett. and Communications, 1988, vol. 27, pp. 163-168. * SUSIM SL2 high resolution (0.15nm) Solar Irridance data. * Irradiance values are given in milliwatts/m^2/nanomenters * and are listed at 0.05nm intervals. The wavelength given is * the center wavelength of the 0.15nm triangular bandpass. * Normalized to 1 astronomical unit. * DATA for wavelengths > 350 nm are unreliable * (Van Hoosier, personal communication, 1994). *_______________________________________________________________________ ** high resolution fil = 'DATAE1/SUN/susim_hi.flx' OPEN(UNIT=kin,FILE=fil,STATUS='old') DO 11, i = 1, 7 READ(kin,*) 11 CONTINUE DO 12, i = 1, 559 READ(kin,*)lambda,(irrad_hi(10*(i-1)+j), j=1, 10) 12 CONTINUE CLOSE (kin) * compute wavelengths, convert from mW to W n = 559*10 DO 13, i = 1, n lambda_hi(i)=120.5 + FLOAT(i-1)*.05 irrad_hi(i) = irrad_hi(i) / 1000. 13 CONTINUE *_______________________________________________________________________ CALL addpnt(lambda_hi,irrad_hi,10000,n, > lambda_hi(1)*(1.-deltax),0.) CALL addpnt(lambda_hi,irrad_hi,10000,n, 0.,0.) CALL addpnt(lambda_hi,irrad_hi,10000,n, > lambda_hi(n)*(1.+deltax),0.) CALL addpnt(lambda_hi,irrad_hi,10000,n, 1.e38,0.) CALL inter2(nw,wl,f,n,lambda_hi,irrad_hi,ierr) IF (ierr .NE. 0) THEN WRITE(*,*) ierr, fil STOP ENDIF RETURN END *=============================================================================* SUBROUTINE read2(nw,wl,f) *-----------------------------------------------------------------------------* *= PURPOSE: =* *= Read extra-terrestrial flux data. Re-grid data to match specified =* *= working wavelength grid. =* *-----------------------------------------------------------------------------* *= PARAMETERS: =* *= NW - INTEGER, number of specified intervals + 1 in working (I)=* *= wavelength grid =* *= WL - REAL, vector of lower limits of wavelength intervals in (I)=* *= working wavelength grid =* *= F - REAL, spectral irradiance at the top of the atmosphere at (O)=* *= each specified wavelength =* *-----------------------------------------------------------------------------* IMPLICIT NONE INCLUDE '../params' * input: (wavelength grid) INTEGER nw REAL wl(kw) REAL yg(kw) * INTEGER iw * output: (extra terrestrial solar flux) REAL f(kw) * local: REAL x1(1000), y1(1000) REAL x2(1000) REAL x3(1000) INTEGER i, n REAL DUM INTEGER IDUM *_______________________________________________________________________ *********WMO 85 irradiance OPEN(UNIT=kin,FILE='DATAE1/SUN/wmo85.flx',STATUS='old') DO 11, i = 1, 3 READ(kin,*) 11 CONTINUE n = 158 DO 12, i = 1, n READ(kin,*) idum, x1(i),x2(i),y1(i), dum, dum, dum x3(i) = 0.5 * (x1(i) + x2(i)) C average value needs to be calculated only if inter2 is C used to interpolate onto wavelength grid (see below) C y1(i) = y1(i) / (x2(i) - x1(i)) 12 CONTINUE CLOSE (kin) x1(n+1) = x2(n) C inter2: INPUT : average value in each bin C OUTPUT: average value in each bin C inter3: INPUT : total area in each bin C OUTPUT: total area in each bin CALL inter3(nw,wl,yg, n+1,x1,y1,0) C CALL inter2(nw,wl,yg,n,x3,y1,ierr) DO 10, iw = 1, nw-1 * from quanta s-1 cm-2 bin-1 to watts m-2 nm-1 * 1.e4 * ([hc =] 6.62E-34 * 2.998E8)/(wc*1e-9) C the scaling by bin width needs to be done only if C inter3 is used for interpolation yg(iw) = yg(iw) / (wl(iw+1)-wl(iw)) f(iw) = yg(iw) * 1.e4 * (6.62E-34 * 2.998E8) / $ ( 0.5 * (wl(iw+1)+wl(iw)) * 1.e-9) 10 CONTINUE RETURN END
pb866/TUV_DSMACC
SRC/rdetfl.f
FORTRAN
gpl-3.0
27,020
/********************************************************** *Author: wangjiaying *Date: 2016.8.11 *Func: **********************************************************/ using UnityEngine; using UnityEditor; using CryDialog.Runtime; namespace CryDialog.Editor { public class DialogEditorWindow : EditorWindow { public static DialogEditorWindow DialogWindow; [MenuItem("Dialog System/Open Dialog Editor")] public static void Open() { if (DialogWindow != null) { DialogWindow.Show(); return; } DialogWindow = EditorWindow.GetWindow<DialogEditorWindow>(); DialogWindow.titleContent = new GUIContent("Dialog Editor"); //float h = Screen.height * 0.7f; //float w = Screen.width * 0.7f; //DialogWindow.position = new Rect(Screen.width - w, Screen.height - h, w, h); //DialogWindow.position=new DialogWindow.Show(); } private DialogObject _lastDialogObject; public DialogObject _dialogObject; public Dialog _Dialog { get { return _dialogObject.Dialog; } } public Vector2 CurrentContentCenter { get { return _Dialog.graphCenter; } set { _Dialog.graphCenter = value; } } public Rect _windowRect; public Rect _contentRect; public float _leftWidth = 230f; public float _topHeight = 60f; public float _titleHeight = 35f; public float _selectionGridHeight { get { return _titleHeight + 5; } } public const float _zoomMin = 0.4f; public const float _zoomMax = 2f; public float Zoom { get { if (_dialogObject) return _dialogObject._zoom; return 1; } set { if (_dialogObject) _dialogObject._zoom = value; } } void OnEnable() { DialogWindow = this; Repaint(); } void Update() { Repaint(); DialogWindow = this; } void OnGUI() { _windowRect = new Rect(0, 0, position.width, position.height); _contentRect = new Rect(_leftWidth, _topHeight, position.width, position.height); //========Story Editor ============== if (MainPageEditor.GetInstance.OnGUI(this)) { return; } if (_lastDialogObject != _dialogObject) { _lastDialogObject = _dialogObject; DialogEditor.GetInstance.Reset(); } //Show Pages MainPage(); //========Top Button ============== ShowTitle(); //========Version ============== ShowVersion(); } private void MainPage() { EditorGUI.DrawTextureTransparent(_contentRect, ResourcesManager.GetInstance.texBackground); //发现Dialog可不一定一定是使用的DialogObject的引用,所以有问题 //暂时没时间管了 if (Application.isPlaying) return; //DialogEditorRuntime.GetInstance.OnGUI(this, _Dialog.Nodes); else DialogEditor.GetInstance.OnGUI(this, _Dialog.Nodes); //处理缩放 if (UnityEngine.Event.current != null) { if (UnityEngine.Event.current.type == EventType.ScrollWheel) { _dialogObject._zoom -= UnityEngine.Event.current.delta.y * 0.01f; _dialogObject._zoom = Mathf.Clamp(_dialogObject._zoom, _zoomMin, _zoomMax); //Debug.Log(_zoom); } } } private void ShowVersion() { GUI.Label(new Rect(_windowRect.xMax - 120, _windowRect.yMax - 40, 120, 20), new GUIContent("Made By CWHISME")); GUI.Label(new Rect(_windowRect.xMax - 90, _windowRect.yMax - 20, 100, 20), new GUIContent(Version.FullVersion)); } private void ShowTitle() { EditorGUI.DrawTextureTransparent(new Rect(0, 0, position.width, _topHeight), ResourcesManager.GetInstance.texBackground); GUIStyle style = ResourcesManager.GetInstance.skin.GetStyle("Title"); float btnW = 0; EditorGUI.LabelField(new Rect(btnW, 0, _windowRect.xMax, _titleHeight), new GUIContent(" Dialog Editor" + "->" + _dialogObject.name), style); GUIStyle buttonStyle = new GUIStyle(ResourcesManager.GetInstance.skin.button); if (GUI.Button(new Rect(_contentRect.width - 180, 3, 80, _titleHeight - 3), "Values", buttonStyle)) { ValueManagerWindow.Open(); } if (GUI.Button(new Rect(_contentRect.width - 90, 3, 80, _titleHeight - 3), "About", buttonStyle)) { About.ShowAbout(); } _dialogObject._debugMode = EditorGUI.ToggleLeft(new Rect(10f, _titleHeight, _windowRect.xMax, _titleHeight), "Debug Mode", _dialogObject._debugMode); //分割线 Handles.DrawLine(new Vector3(_windowRect.xMin, _windowRect.yMin + _topHeight - 2, 0), new Vector3(_windowRect.xMax, _windowRect.yMin + _topHeight - 2)); Handles.DrawLine(new Vector3(_windowRect.xMin, _windowRect.yMin + _topHeight, 0), new Vector3(_windowRect.xMax, _windowRect.yMin + _topHeight)); //运行时不允许存储加载 if (Application.isPlaying) return; buttonStyle.normal.textColor = new Color32(255, 64, 180, 255); if (GUI.Button(new Rect(_contentRect.width - 270, 3, 80, _titleHeight - 3), "Reload", buttonStyle)) { _dialogObject.Load(); } buttonStyle.normal.textColor = new Color32(0, 255, 0, 255); if (GUI.Button(new Rect(_contentRect.width - 360, 3, 80, _titleHeight - 3), "Save Dialog", buttonStyle)) _dialogObject.Save(); } } }
CWHISME/CryDialogSystem
DialogSystem/Assets/DialogSystem/System/Editor/DialogEditorWindow.cs
C#
gpl-3.0
6,211
### Gamemode: Toy Of Wars ![Toy Of Wars v3e1](https://github.com/Logofero/ToyOfWars/blob/master/screens/TW%20v3%20%282%29.jpg) #### Server: sa-mp 0.3.7 R1 #### Mode: TDM #### Status: Complited #### Map: Custom locations #### Release: v1, 8 aug 2015 #### Update: v3e1, 2 nov 2015 #### Contributors: [VanillaRain](http://forum.sa-mp.com/member.php?u=162468), [Nero_3D](http://forum.sa-mp.com/member.php?u=9765), [Logofero aka fERO](http://forum.sa-mp.com/member.php?u=242947) #### Credits: #### SA-MP Multyplayer [SA-MP Team](http://forum.sa-mp.com/forumdisplay.php?f=74) #### Zamaroht's TextDraw Editor [Zamaroht](http://forum.sa-mp.com/member.php?u=5955) #### Streamer [Incognito](http://forum.sa-mp.com/showthread.php?t=102865) #### ColAndreas [[uL]Slice, [uL]Chris420, [uL]Pottus, uint32, Crayder](http://forum.sa-mp.com/showthread.php?t=586068) #### General tread: [[GameMode] Toy Of Wars](http://forum.sa-mp.com/showthread.php?t=584939) #### Description: _You have to fight on a toy cars against other teams._ #### History changes: _Look in the file [CHANGES](https://github.com/Logofero/ToyOfWars/blob/master/CHANGES)_ __[Screenshots](https://github.com/Logofero/ToyOfWars/blob/master/screens)__ ###[Downloads](https://github.com/Logofero/ToyOfWars/releases)
Logofero/ToyOfWars
README.md
Markdown
gpl-3.0
1,316
PORT="8085" LOGGING="--accessLoggerClassName=winstone.accesslog.SimpleAccessLogger" java -jar ./winstone-0.9.10.jar ../../build --directoryListings=false ${LOGGING} --httpPort=${PORT}
hrj/tdash
framework/winstone/runWebServer.sh
Shell
gpl-3.0
186
var fs = require('fs'); var https = require('https'); var readline = require('readline'); var google = require('googleapis'); var googleAuth = require('google-auth-library'); var SCOPES = ['https://www.googleapis.com/auth/drive.metadata.readonly']; // TOKEN_DIR is where the access token is stored AFTER you get it var TOKEN_DIR = (process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE) + '/.credentials/'; var TOKEN_PATH = TOKEN_DIR + 'drive-nodejs-quickstart.json'; var filelist; // load client-secret from localfile fs.readFile('client_secret.json', function processClientSecret (err, content) { if (err) { console.log('err... ERR: ' + err); return; } authorize(JSON.parse(content), getHomeDirectory); }); // the problem with this is that it uses google-auth-library to do something that googleapis can do on its own, which makes things more complicated than necessary function authorize(credentials, callback) { var clientSecret = credentials.web.client_secret; var clientId = credentials.web.client_id; var redirectUrl = credentials.web.redirect_uris[0]; var auth = new googleAuth(); var oauth2Client = new auth.OAuth2(clientId, clientSecret, redirectUrl); fs.readFile(TOKEN_PATH, function (err, token) { if (err) { getNewToken(oauth2Client, callback); } else { oauth2Client.credentials = JSON.parse(token); callback(oauth2Client); } }); } // this is the code I have to modify function getNewToken (oauth2Client, callback) { var authUrl = oauth2Client.generateAuthUrl({ access_type: 'offline', scopes: SCOPES }) console.log('Authorize this app by visiting this url: ', authUrl); var rl = readline.createInterface({ input: process.stdin, output: process.stdout }) rl.question('Enter the code from the page here: ', function (code) { rl.close(); oauth2Client.getToken(code, function () { if (err) { console.log('ERR while retrieving access token', err); } oauth2Client.credentials = token; storeToken(token); callback(oauth2Client); }); }); } ////////////////////////////////////////// function storeToken (token) { try { fs.mkdirSync(TOKEN_DIR); } catch (err) { if (err.code != 'EEXIST') { throw err; }} fs.writeFile(TOKEN_PATH, JSON.stringify(token)); console.log('Token stored to ' + TOKEN_PATH); } // API call: function getHomeDirectory(auth) { // this is the beginning of the API request var service = google.drive('v3'); console.log('got to line 74'); service.files.list({ auth: auth, fields: "files(id, names)" }, function (err, response) { if (err) { console.log('API did not like your call, so ERRRRRRRR: ' + err); return; } var files = response.files; filelist = response.files; // debuggery console.log(response.files); if (files.length == 0) { console.log('Files not found'); } else { console.log('Files: '); var app = require('express')(); var options = { key : fs.readFileSync('server.enc.key'), cert : fs.readFileSync('server.crt') }; https.createServer(options, app).listen(443, function () { console.log('Started!'); }); app.get('/', function (req, res) { for (var i = 0; i < filelist.length; i++) { var file = files[i]; console.log('%s (%s)', file.name, file.id); res.send(filelist[i] + "<br />"); } }) } }) }
cjohnson6382/herms
old/nodejs.js
JavaScript
gpl-3.0
3,512
/* * JasperReports - Free Java Reporting Library. * Copyright (C) 2001 - 2016 TIBCO Software Inc. All rights reserved. * http://www.jaspersoft.com * * Unless you have purchased a commercial license agreement from Jaspersoft, * the following license terms apply: * * This program is part of JasperReports. * * JasperReports is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * JasperReports is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with JasperReports. If not, see <http://www.gnu.org/licenses/>. */ package net.sf.jasperreports.engine.xml; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import org.apache.commons.digester.SetNestedPropertiesRule; import org.apache.commons.digester.SetPropertiesRule; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import net.sf.jasperreports.engine.DefaultJasperReportsContext; import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JRFont; import net.sf.jasperreports.engine.JROrigin; import net.sf.jasperreports.engine.JRPrintElement; import net.sf.jasperreports.engine.JRPrintHyperlinkParameter; import net.sf.jasperreports.engine.JRPrintPage; import net.sf.jasperreports.engine.JRPropertiesUtil; import net.sf.jasperreports.engine.JRStyle; import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.JasperReportsContext; import net.sf.jasperreports.engine.PrintBookmark; import net.sf.jasperreports.engine.TabStop; import net.sf.jasperreports.engine.util.CompositeClassloader; /** * Utility class that helps reconverting XML documents into * {@link net.sf.jasperreports.engine.JasperPrint} objects. * <p> * Generated documents can be stored in XML format if they are exported using the * {@link net.sf.jasperreports.engine.export.JRXmlExporter}. After they're exported, * one can parse them back into {@link net.sf.jasperreports.engine.JasperPrint} objects * by using this class. * </p> * @author Teodor Danciu (teodord@users.sourceforge.net) */ public class JRPrintXmlLoader implements ErrorHandler { private static final Log log = LogFactory.getLog(JRPrintXmlLoader.class); /** * */ private final JasperReportsContext jasperReportsContext; private JasperPrint jasperPrint; private List<Exception> errors = new ArrayList<Exception>(); /** * */ protected JRPrintXmlLoader(JasperReportsContext jasperReportsContext) { this.jasperReportsContext = jasperReportsContext; } /** * */ public JasperReportsContext getJasperReportsContext() { return jasperReportsContext; } /** * */ public void setJasperPrint(JasperPrint jasperPrint) { this.jasperPrint = jasperPrint; } /** * */ public static JasperPrint loadFromFile(JasperReportsContext jasperReportsContext, String sourceFileName) throws JRException { JasperPrint jasperPrint = null; FileInputStream fis = null; try { fis = new FileInputStream(sourceFileName); JRPrintXmlLoader printXmlLoader = new JRPrintXmlLoader(jasperReportsContext); jasperPrint = printXmlLoader.loadXML(fis); } catch(IOException e) { throw new JRException(e); } finally { if (fis != null) { try { fis.close(); } catch(IOException e) { } } } return jasperPrint; } /** * @see #loadFromFile(JasperReportsContext, String) */ public static JasperPrint loadFromFile(String sourceFileName) throws JRException { return loadFromFile(DefaultJasperReportsContext.getInstance(), sourceFileName); } /** * @see #loadFromFile(String) */ public static JasperPrint load(String sourceFileName) throws JRException { return loadFromFile(sourceFileName); } /** * */ public static JasperPrint load(JasperReportsContext jasperReportsContext, InputStream is) throws JRException { JasperPrint jasperPrint = null; JRPrintXmlLoader printXmlLoader = new JRPrintXmlLoader(jasperReportsContext); jasperPrint = printXmlLoader.loadXML(is); return jasperPrint; } /** * @see #load(JasperReportsContext, InputStream) */ public static JasperPrint load(InputStream is) throws JRException { return load(DefaultJasperReportsContext.getInstance(), is); } /** * */ private JasperPrint loadXML(InputStream is) throws JRException { try { JRXmlDigester digester = prepareDigester(); /* */ digester.parse(is); } catch(ParserConfigurationException e) { throw new JRException(e); } catch(SAXException e) { throw new JRException(e); } catch(IOException e) { throw new JRException(e); } if (errors.size() > 0) { Exception e = errors.get(0); if (e instanceof JRException) { throw (JRException)e; } throw new JRException(e); } return this.jasperPrint; } /** * */ protected JRXmlDigester prepareDigester() throws ParserConfigurationException, SAXException { JRXmlDigester digester = new JRXmlDigester(createParser()); // use a classloader that resolves both JR classes and classes from the context classloader CompositeClassloader digesterClassLoader = new CompositeClassloader( JRPrintXmlLoader.class.getClassLoader(), Thread.currentThread().getContextClassLoader()); digester.setClassLoader(digesterClassLoader); digester.setNamespaceAware(true); digester.setRuleNamespaceURI(JRXmlConstants.JASPERPRINT_NAMESPACE); digester.push(this); //digester.setDebug(3); digester.setErrorHandler(this); digester.setValidating(true); /* */ digester.addFactoryCreate("jasperPrint", JasperPrintFactory.class.getName()); digester.addSetNext("jasperPrint", "setJasperPrint", JasperPrint.class.getName()); /* */ digester.addRule("*/property", new JRPropertyDigesterRule()); /* */ digester.addFactoryCreate("jasperPrint/origin", JROriginFactory.class.getName()); digester.addSetNext("jasperPrint/origin", "addOrigin", JROrigin.class.getName()); /* */ digester.addFactoryCreate("jasperPrint/reportFont", JRStyleFactory.class.getName()); digester.addSetNext("jasperPrint/reportFont", "addStyle", JRStyle.class.getName()); /* */ digester.addFactoryCreate("jasperPrint/style", JRPrintStyleFactory.class.getName()); digester.addSetNext("jasperPrint/style", "addStyle", JRStyle.class.getName()); /* */ digester.addFactoryCreate("*/style/pen", JRPenFactory.Style.class.getName()); /* */ digester.addFactoryCreate("*/bookmark", PrintBookmarkFactory.class.getName()); digester.addSetNext("*/bookmark", "addBookmark", PrintBookmark.class.getName()); /* */ digester.addFactoryCreate("jasperPrint/part", PrintPartFactory.class.getName()); /* */ digester.addFactoryCreate("jasperPrint/page", JRPrintPageFactory.class.getName()); digester.addSetNext("jasperPrint/page", "addPage", JRPrintPage.class.getName()); /* */ digester.addFactoryCreate("*/line", JRPrintLineFactory.class.getName()); digester.addSetNext("*/line", "addElement", JRPrintElement.class.getName()); /* */ digester.addFactoryCreate("*/reportElement", JRPrintElementFactory.class.getName()); /* */ digester.addFactoryCreate("*/graphicElement", JRPrintGraphicElementFactory.class.getName()); /* */ digester.addFactoryCreate("*/pen", JRPenFactory.class.getName()); /* */ digester.addFactoryCreate("*/rectangle", JRPrintRectangleFactory.class.getName()); digester.addSetNext("*/rectangle", "addElement", JRPrintElement.class.getName()); /* */ digester.addFactoryCreate("*/ellipse", JRPrintEllipseFactory.class.getName()); digester.addSetNext("*/ellipse", "addElement", JRPrintElement.class.getName()); /* */ digester.addFactoryCreate("*/image", JRPrintImageFactory.class.getName()); digester.addSetNext("*/image", "addElement", JRPrintElement.class.getName()); /* */ digester.addFactoryCreate("*/box", JRBoxFactory.class.getName()); /* */ digester.addFactoryCreate("*/box/pen", JRPenFactory.Box.class.getName()); digester.addFactoryCreate("*/box/topPen", JRPenFactory.Top.class.getName()); digester.addFactoryCreate("*/box/leftPen", JRPenFactory.Left.class.getName()); digester.addFactoryCreate("*/box/bottomPen", JRPenFactory.Bottom.class.getName()); digester.addFactoryCreate("*/box/rightPen", JRPenFactory.Right.class.getName()); /* */ digester.addFactoryCreate("*/paragraph", JRParagraphFactory.class.getName()); digester.addFactoryCreate("*/paragraph/tabStop", TabStopFactory.class.getName()); digester.addSetNext("*/paragraph/tabStop", "addTabStop", TabStop.class.getName()); /* */ digester.addFactoryCreate("*/image/imageSource", JRPrintImageSourceFactory.class.getName()); digester.addCallMethod("*/image/imageSource", "setImageSource", 0); /* */ digester.addFactoryCreate("*/text", JRPrintTextFactory.class.getName()); digester.addSetNext("*/text", "addElement", JRPrintElement.class.getName()); SetNestedPropertiesRule textRule = new SetNestedPropertiesRule( new String[]{"textContent", "textTruncateSuffix", "reportElement", "box", "font", JRXmlConstants.ELEMENT_lineBreakOffsets}, new String[]{"text", "textTruncateSuffix"}); textRule.setTrimData(false); textRule.setAllowUnknownChildElements(true); digester.addRule("*/text", textRule); digester.addRule("*/text/textContent", new SetPropertiesRule(JRXmlConstants.ATTRIBUTE_truncateIndex, "textTruncateIndex")); /* */ digester.addFactoryCreate("*/text/font", JRPrintFontFactory.class.getName()); digester.addSetNext("*/text/font", "setFont", JRFont.class.getName()); digester.addRule("*/text/" + JRXmlConstants.ELEMENT_lineBreakOffsets, new TextLineBreakOffsetsRule()); addFrameRules(digester); addHyperlinkParameterRules(digester); addGenericElementRules(digester); return digester; } protected SAXParser createParser() { String parserFactoryClass = JRPropertiesUtil.getInstance(jasperReportsContext).getProperty( JRSaxParserFactory.PROPERTY_PRINT_PARSER_FACTORY); if (log.isDebugEnabled()) { log.debug("Using SAX parser factory class " + parserFactoryClass); } JRSaxParserFactory factory = BaseSaxParserFactory.getFactory(jasperReportsContext, parserFactoryClass); return factory.createParser(); } private void addFrameRules(JRXmlDigester digester) { digester.addFactoryCreate("*/frame", JRPrintFrameFactory.class.getName()); digester.addSetNext("*/frame", "addElement", JRPrintElement.class.getName()); } protected void addHyperlinkParameterRules(JRXmlDigester digester) { String parameterPattern = "*/" + JRXmlConstants.ELEMENT_hyperlinkParameter; digester.addFactoryCreate(parameterPattern, JRPrintHyperlinkParameterFactory.class); digester.addSetNext(parameterPattern, "addHyperlinkParameter", JRPrintHyperlinkParameter.class.getName()); String parameterValuePattern = parameterPattern + "/" + JRXmlConstants.ELEMENT_hyperlinkParameterValue; digester.addFactoryCreate(parameterValuePattern, JRPrintHyperlinkParameterValueFactory.class); digester.addCallMethod(parameterValuePattern, "setData", 0); } protected void addGenericElementRules(JRXmlDigester digester) { String elementPattern = "*/" + JRXmlConstants.ELEMENT_genericElement; digester.addFactoryCreate(elementPattern, JRGenericPrintElementFactory.class); digester.addSetNext(elementPattern, "addElement", JRPrintElement.class.getName()); String elementTypePattern = elementPattern + "/" + JRXmlConstants.ELEMENT_genericElementType; digester.addFactoryCreate(elementTypePattern, JRGenericElementTypeFactory.class); digester.addSetNext(elementTypePattern, "setGenericType"); String elementParameterPattern = elementPattern + "/" + JRXmlConstants.ELEMENT_genericElementParameter; digester.addFactoryCreate(elementParameterPattern, JRGenericPrintElementParameterFactory.class); digester.addCallMethod(elementParameterPattern, "addParameter"); digester.addRule(elementParameterPattern, new JRGenericPrintElementParameterFactory.ArbitraryValueSetter()); String elementParameterValuePattern = elementParameterPattern + "/" + JRXmlConstants.ELEMENT_genericElementParameterValue; digester.addFactoryCreate(elementParameterValuePattern, JRGenericPrintElementParameterFactory.ParameterValueFactory.class); digester.addCallMethod(elementParameterValuePattern, "setData", 0); addValueHandlerRules(digester, elementParameterPattern); } protected void addValueHandlerRules(JRXmlDigester digester, String elementParameterPattern) { List<XmlValueHandler> handlers = XmlValueHandlerUtils.instance().getHandlers(); for (XmlValueHandler handler : handlers) { XmlHandlerNamespace namespace = handler.getNamespace(); if (namespace != null) { String namespaceURI = namespace.getNamespaceURI(); if (log.isDebugEnabled()) { log.debug("Configuring the digester for handler " + handler + " and namespace " + namespaceURI); } digester.setRuleNamespaceURI(namespaceURI); handler.configureDigester(digester); String schemaResource = namespace.getInternalSchemaResource(); digester.addInternalEntityResource(namespace.getPublicSchemaLocation(), schemaResource); } } digester.setRuleNamespaceURI(JRXmlConstants.JASPERPRINT_NAMESPACE); } /** * */ public void addError(Exception e) { this.errors.add(e); } @Override public void error(SAXParseException e) { this.errors.add(e); } @Override public void fatalError(SAXParseException e) { this.errors.add(e); } @Override public void warning(SAXParseException e) { this.errors.add(e); } }
MHTaleb/Encologim
lib/JasperReport/src/net/sf/jasperreports/engine/xml/JRPrintXmlLoader.java
Java
gpl-3.0
14,406
namespace S2Forms { partial class MainWindow { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainWindow)); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.frequency1 = new System.Windows.Forms.ToolStripStatusLabel(); this.frequency2 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripProgressBar1 = new System.Windows.Forms.ToolStripProgressBar(); this.pulseMonitor = new System.ComponentModel.BackgroundWorker(); this.treeView = new System.Windows.Forms.TreeView(); this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.hardwareToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.scanForHardwareChangesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.generatorControlToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.addSimulatedPulseToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.addSimulatedGeneratorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.biofeedbackToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.programsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.runnableMenu = new System.Windows.Forms.ContextMenuStrip(this.components); this.runToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.starToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.biofeedbackMenu = new System.Windows.Forms.ContextMenuStrip(this.components); this.newToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.statusStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout(); this.runnableMenu.SuspendLayout(); this.biofeedbackMenu.SuspendLayout(); this.SuspendLayout(); // // statusStrip1 // this.statusStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripStatusLabel1, this.frequency1, this.frequency2, this.toolStripProgressBar1}); this.statusStrip1.Location = new System.Drawing.Point(0, 304); this.statusStrip1.Name = "statusStrip1"; this.statusStrip1.Size = new System.Drawing.Size(883, 26); this.statusStrip1.TabIndex = 2; this.statusStrip1.Text = "statusStrip1"; // // toolStripStatusLabel1 // this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; this.toolStripStatusLabel1.Size = new System.Drawing.Size(52, 20); this.toolStripStatusLabel1.Text = "0 bpm"; this.toolStripStatusLabel1.Click += new System.EventHandler(this.ToolStripStatusLabel1_Click); // // frequency1 // this.frequency1.Name = "frequency1"; this.frequency1.Size = new System.Drawing.Size(30, 20); this.frequency1.Text = "Off"; // // frequency2 // this.frequency2.Name = "frequency2"; this.frequency2.Size = new System.Drawing.Size(30, 20); this.frequency2.Text = "Off"; // // toolStripProgressBar1 // this.toolStripProgressBar1.Name = "toolStripProgressBar1"; this.toolStripProgressBar1.Size = new System.Drawing.Size(100, 18); // // treeView // this.treeView.Location = new System.Drawing.Point(12, 31); this.treeView.Name = "treeView"; this.treeView.Size = new System.Drawing.Size(224, 270); this.treeView.TabIndex = 5; this.treeView.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.TreeView_BeforeExpand); this.treeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.TreeView_AfterSelect); this.treeView.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.TreeView_NodeMouseClick); // // menuStrip1 // this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.fileToolStripMenuItem, this.hardwareToolStripMenuItem, this.biofeedbackToolStripMenuItem, this.programsToolStripMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; this.menuStrip1.Size = new System.Drawing.Size(883, 28); this.menuStrip1.TabIndex = 6; this.menuStrip1.Text = "menuStrip1"; // // fileToolStripMenuItem // this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.newToolStripMenuItem, this.openToolStripMenuItem, this.exitToolStripMenuItem}); this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; this.fileToolStripMenuItem.Size = new System.Drawing.Size(46, 24); this.fileToolStripMenuItem.Text = "File"; // // newToolStripMenuItem // this.newToolStripMenuItem.Name = "newToolStripMenuItem"; this.newToolStripMenuItem.Size = new System.Drawing.Size(137, 26); this.newToolStripMenuItem.Text = "New..."; // // openToolStripMenuItem // this.openToolStripMenuItem.Name = "openToolStripMenuItem"; this.openToolStripMenuItem.Size = new System.Drawing.Size(137, 26); this.openToolStripMenuItem.Text = "Open..."; this.openToolStripMenuItem.Click += new System.EventHandler(this.OpenToolStripMenuItem_Click); // // exitToolStripMenuItem // this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; this.exitToolStripMenuItem.Size = new System.Drawing.Size(137, 26); this.exitToolStripMenuItem.Text = "Exit"; // // hardwareToolStripMenuItem // this.hardwareToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.scanForHardwareChangesToolStripMenuItem, this.generatorControlToolStripMenuItem, this.addSimulatedPulseToolStripMenuItem, this.addSimulatedGeneratorToolStripMenuItem}); this.hardwareToolStripMenuItem.Name = "hardwareToolStripMenuItem"; this.hardwareToolStripMenuItem.Size = new System.Drawing.Size(88, 24); this.hardwareToolStripMenuItem.Text = "Hardware"; // // scanForHardwareChangesToolStripMenuItem // this.scanForHardwareChangesToolStripMenuItem.Name = "scanForHardwareChangesToolStripMenuItem"; this.scanForHardwareChangesToolStripMenuItem.Size = new System.Drawing.Size(270, 26); this.scanForHardwareChangesToolStripMenuItem.Text = "Scan for hardware changes"; // // generatorControlToolStripMenuItem // this.generatorControlToolStripMenuItem.Name = "generatorControlToolStripMenuItem"; this.generatorControlToolStripMenuItem.Size = new System.Drawing.Size(270, 26); this.generatorControlToolStripMenuItem.Text = "Generator control..."; // // addSimulatedPulseToolStripMenuItem // this.addSimulatedPulseToolStripMenuItem.Name = "addSimulatedPulseToolStripMenuItem"; this.addSimulatedPulseToolStripMenuItem.Size = new System.Drawing.Size(270, 26); this.addSimulatedPulseToolStripMenuItem.Text = "Add simulated pulse"; this.addSimulatedPulseToolStripMenuItem.Click += new System.EventHandler(this.AddSimulatedPulseToolStripMenuItem_Click); // // addSimulatedGeneratorToolStripMenuItem // this.addSimulatedGeneratorToolStripMenuItem.Name = "addSimulatedGeneratorToolStripMenuItem"; this.addSimulatedGeneratorToolStripMenuItem.Size = new System.Drawing.Size(270, 26); this.addSimulatedGeneratorToolStripMenuItem.Text = "Add simulated generator"; this.addSimulatedGeneratorToolStripMenuItem.Click += new System.EventHandler(this.AddSimulatedGeneratorToolStripMenuItem_Click); // // biofeedbackToolStripMenuItem // this.biofeedbackToolStripMenuItem.Name = "biofeedbackToolStripMenuItem"; this.biofeedbackToolStripMenuItem.Size = new System.Drawing.Size(106, 24); this.biofeedbackToolStripMenuItem.Text = "Biofeedback"; // // programsToolStripMenuItem // this.programsToolStripMenuItem.Name = "programsToolStripMenuItem"; this.programsToolStripMenuItem.Size = new System.Drawing.Size(86, 24); this.programsToolStripMenuItem.Text = "Programs"; // // runnableMenu // this.runnableMenu.ImageScalingSize = new System.Drawing.Size(20, 20); this.runnableMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.runToolStripMenuItem, this.starToolStripMenuItem1, this.copyToolStripMenuItem, this.removeToolStripMenuItem}); this.runnableMenu.Name = "runnableMenu"; this.runnableMenu.Size = new System.Drawing.Size(164, 100); this.runnableMenu.Opening += new System.ComponentModel.CancelEventHandler(this.RunnableMenu_Opening); // // runToolStripMenuItem // this.runToolStripMenuItem.Name = "runToolStripMenuItem"; this.runToolStripMenuItem.Size = new System.Drawing.Size(163, 24); this.runToolStripMenuItem.Text = "Run on"; // // starToolStripMenuItem1 // this.starToolStripMenuItem1.Name = "starToolStripMenuItem1"; this.starToolStripMenuItem1.Size = new System.Drawing.Size(163, 24); this.starToolStripMenuItem1.Text = "Bookmark"; // // copyToolStripMenuItem // this.copyToolStripMenuItem.Name = "copyToolStripMenuItem"; this.copyToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+C"; this.copyToolStripMenuItem.Size = new System.Drawing.Size(163, 24); this.copyToolStripMenuItem.Text = "Copy"; this.copyToolStripMenuItem.Click += new System.EventHandler(this.CopyToolStripMenuItem_Click); // // removeToolStripMenuItem // this.removeToolStripMenuItem.Name = "removeToolStripMenuItem"; this.removeToolStripMenuItem.Size = new System.Drawing.Size(163, 24); this.removeToolStripMenuItem.Text = "Remove"; // // biofeedbackMenu // this.biofeedbackMenu.ImageScalingSize = new System.Drawing.Size(20, 20); this.biofeedbackMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.newToolStripMenuItem1}); this.biofeedbackMenu.Name = "biofeedbackMenu"; this.biofeedbackMenu.Size = new System.Drawing.Size(109, 28); // // newToolStripMenuItem1 // this.newToolStripMenuItem1.Name = "newToolStripMenuItem1"; this.newToolStripMenuItem1.Size = new System.Drawing.Size(108, 24); this.newToolStripMenuItem1.Text = "New"; this.newToolStripMenuItem1.Click += new System.EventHandler(this.NewToolStripMenuItem1_Click); // // MainWindow // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(883, 330); this.Controls.Add(this.treeView); this.Controls.Add(this.statusStrip1); this.Controls.Add(this.menuStrip1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MainMenuStrip = this.menuStrip1; this.Name = "MainWindow"; this.Text = "OpenSpooky"; this.statusStrip1.ResumeLayout(false); this.statusStrip1.PerformLayout(); this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); this.runnableMenu.ResumeLayout(false); this.biofeedbackMenu.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.StatusStrip statusStrip1; private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; private System.ComponentModel.BackgroundWorker pulseMonitor; private System.Windows.Forms.TreeView treeView; private System.Windows.Forms.MenuStrip menuStrip1; private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem biofeedbackToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem programsToolStripMenuItem; private System.Windows.Forms.ToolStripStatusLabel frequency1; private System.Windows.Forms.ToolStripStatusLabel frequency2; private System.Windows.Forms.ToolStripProgressBar toolStripProgressBar1; private System.Windows.Forms.ToolStripMenuItem hardwareToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem scanForHardwareChangesToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem generatorControlToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem addSimulatedPulseToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem addSimulatedGeneratorToolStripMenuItem; private System.Windows.Forms.ContextMenuStrip runnableMenu; private System.Windows.Forms.ToolStripMenuItem runToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem starToolStripMenuItem1; private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem removeToolStripMenuItem; private System.Windows.Forms.ContextMenuStrip biofeedbackMenu; private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItem1; } }
calum74/s2
csharp/S2Forms/MainWindow.Designer.cs
C#
gpl-3.0
17,154
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_11) on Mon Jun 16 17:35:26 PDT 2014 --> <title>NameCallback (Java Platform SE 8 )</title> <meta name="date" content="2014-06-16"> <meta name="keywords" content="javax.security.auth.callback.NameCallback class"> <meta name="keywords" content="getPrompt()"> <meta name="keywords" content="getDefaultName()"> <meta name="keywords" content="setName()"> <meta name="keywords" content="getName()"> <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="NameCallback (Java Platform SE 8 )"; } } catch(err) { } //--> var methods = {"i0":10,"i1":10,"i2":10,"i3":10}; var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; var altColor = "altColor"; var rowColor = "rowColor"; var tableTab = "tableTab"; var activeTableTab = "activeTableTab"; </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/NameCallback.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-files/index-1.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage"><strong>Java&trade;&nbsp;Platform<br>Standard&nbsp;Ed.&nbsp;8</strong></div> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../javax/security/auth/callback/LanguageCallback.html" title="class in javax.security.auth.callback"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li><a href="../../../../javax/security/auth/callback/PasswordCallback.html" title="class in javax.security.auth.callback"><span class="typeNameLink">Next&nbsp;Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?javax/security/auth/callback/NameCallback.html" target="_top">Frames</a></li> <li><a href="NameCallback.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <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">compact1, compact2, compact3</div> <div class="subTitle">javax.security.auth.callback</div> <h2 title="Class NameCallback" class="title">Class NameCallback</h2> </div> <div class="contentContainer"> <ul class="inheritance"> <li><a href="../../../../java/lang/Object.html" title="class in java.lang">java.lang.Object</a></li> <li> <ul class="inheritance"> <li>javax.security.auth.callback.NameCallback</li> </ul> </li> </ul> <div class="description"> <ul class="blockList"> <li class="blockList"> <dl> <dt>All Implemented Interfaces:</dt> <dd><a href="../../../../java/io/Serializable.html" title="interface in java.io">Serializable</a>, <a href="../../../../javax/security/auth/callback/Callback.html" title="interface in javax.security.auth.callback">Callback</a></dd> </dl> <hr> <br> <pre>public class <span class="typeNameLabel">NameCallback</span> extends <a href="../../../../java/lang/Object.html" title="class in java.lang">Object</a> implements <a href="../../../../javax/security/auth/callback/Callback.html" title="interface in javax.security.auth.callback">Callback</a>, <a href="../../../../java/io/Serializable.html" title="interface in java.io">Serializable</a></pre> <div class="block"><p> Underlying security services instantiate and pass a <code>NameCallback</code> to the <code>handle</code> method of a <code>CallbackHandler</code> to retrieve name information.</div> <dl> <dt><span class="seeLabel">See Also:</span></dt> <dd><a href="../../../../javax/security/auth/callback/CallbackHandler.html" title="interface in javax.security.auth.callback"><code>CallbackHandler</code></a>, <a href="../../../../serialized-form.html#javax.security.auth.callback.NameCallback">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="memberSummary" 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><span class="memberNameLink"><a href="../../../../javax/security/auth/callback/NameCallback.html#NameCallback-java.lang.String-">NameCallback</a></span>(<a href="../../../../java/lang/String.html" title="class in java.lang">String</a>&nbsp;prompt)</code> <div class="block">Construct a <code>NameCallback</code> with a prompt.</div> </td> </tr> <tr class="rowColor"> <td class="colOne"><code><span class="memberNameLink"><a href="../../../../javax/security/auth/callback/NameCallback.html#NameCallback-java.lang.String-java.lang.String-">NameCallback</a></span>(<a href="../../../../java/lang/String.html" title="class in java.lang">String</a>&nbsp;prompt, <a href="../../../../java/lang/String.html" title="class in java.lang">String</a>&nbsp;defaultName)</code> <div class="block">Construct a <code>NameCallback</code> with a prompt and default name.</div> </td> </tr> </table> </li> </ul> <!-- ========== METHOD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="method.summary"> <!-- --> </a> <h3>Method Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tr id="i0" class="altColor"> <td class="colFirst"><code><a href="../../../../java/lang/String.html" title="class in java.lang">String</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../javax/security/auth/callback/NameCallback.html#getDefaultName--">getDefaultName</a></span>()</code> <div class="block">Get the default name.</div> </td> </tr> <tr id="i1" class="rowColor"> <td class="colFirst"><code><a href="../../../../java/lang/String.html" title="class in java.lang">String</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../javax/security/auth/callback/NameCallback.html#getName--">getName</a></span>()</code> <div class="block">Get the retrieved name.</div> </td> </tr> <tr id="i2" class="altColor"> <td class="colFirst"><code><a href="../../../../java/lang/String.html" title="class in java.lang">String</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../javax/security/auth/callback/NameCallback.html#getPrompt--">getPrompt</a></span>()</code> <div class="block">Get the prompt.</div> </td> </tr> <tr id="i3" class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../javax/security/auth/callback/NameCallback.html#setName-java.lang.String-">setName</a></span>(<a href="../../../../java/lang/String.html" title="class in java.lang">String</a>&nbsp;name)</code> <div class="block">Set the retrieved name.</div> </td> </tr> </table> <ul class="blockList"> <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> <!-- --> </a> <h3>Methods inherited from class&nbsp;java.lang.<a href="../../../../java/lang/Object.html" title="class in java.lang">Object</a></h3> <code><a href="../../../../java/lang/Object.html#clone--">clone</a>, <a href="../../../../java/lang/Object.html#equals-java.lang.Object-">equals</a>, <a href="../../../../java/lang/Object.html#finalize--">finalize</a>, <a href="../../../../java/lang/Object.html#getClass--">getClass</a>, <a href="../../../../java/lang/Object.html#hashCode--">hashCode</a>, <a href="../../../../java/lang/Object.html#notify--">notify</a>, <a href="../../../../java/lang/Object.html#notifyAll--">notifyAll</a>, <a href="../../../../java/lang/Object.html#toString--">toString</a>, <a href="../../../../java/lang/Object.html#wait--">wait</a>, <a href="../../../../java/lang/Object.html#wait-long-">wait</a>, <a href="../../../../java/lang/Object.html#wait-long-int-">wait</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="NameCallback-java.lang.String-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>NameCallback</h4> <pre>public&nbsp;NameCallback(<a href="../../../../java/lang/String.html" title="class in java.lang">String</a>&nbsp;prompt)</pre> <div class="block">Construct a <code>NameCallback</code> with a prompt. <p></div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>prompt</code> - the prompt used to request the name.</dd> <dt><span class="throwsLabel">Throws:</span></dt> <dd><code><a href="../../../../java/lang/IllegalArgumentException.html" title="class in java.lang">IllegalArgumentException</a></code> - if <code>prompt</code> is null or if <code>prompt</code> has a length of 0.</dd> </dl> </li> </ul> <a name="NameCallback-java.lang.String-java.lang.String-"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>NameCallback</h4> <pre>public&nbsp;NameCallback(<a href="../../../../java/lang/String.html" title="class in java.lang">String</a>&nbsp;prompt, <a href="../../../../java/lang/String.html" title="class in java.lang">String</a>&nbsp;defaultName)</pre> <div class="block">Construct a <code>NameCallback</code> with a prompt and default name. <p></div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>prompt</code> - the prompt used to request the information. <p></dd> <dd><code>defaultName</code> - the name to be used as the default name displayed with the prompt.</dd> <dt><span class="throwsLabel">Throws:</span></dt> <dd><code><a href="../../../../java/lang/IllegalArgumentException.html" title="class in java.lang">IllegalArgumentException</a></code> - if <code>prompt</code> is null, if <code>prompt</code> has a length of 0, if <code>defaultName</code> is null, or if <code>defaultName</code> has a length of 0.</dd> </dl> </li> </ul> </li> </ul> <!-- ============ METHOD DETAIL ========== --> <ul class="blockList"> <li class="blockList"><a name="method.detail"> <!-- --> </a> <h3>Method Detail</h3> <a name="getPrompt--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getPrompt</h4> <pre>public&nbsp;<a href="../../../../java/lang/String.html" title="class in java.lang">String</a>&nbsp;getPrompt()</pre> <div class="block">Get the prompt. <p></div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>the prompt.</dd> </dl> </li> </ul> <a name="getDefaultName--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getDefaultName</h4> <pre>public&nbsp;<a href="../../../../java/lang/String.html" title="class in java.lang">String</a>&nbsp;getDefaultName()</pre> <div class="block">Get the default name. <p></div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>the default name, or null if this <code>NameCallback</code> was not instantiated with a <code>defaultName</code>.</dd> </dl> </li> </ul> <a name="setName-java.lang.String-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setName</h4> <pre>public&nbsp;void&nbsp;setName(<a href="../../../../java/lang/String.html" title="class in java.lang">String</a>&nbsp;name)</pre> <div class="block">Set the retrieved name. <p></div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>name</code> - the retrieved name (which may be null).</dd> <dt><span class="seeLabel">See Also:</span></dt> <dd><a href="../../../../javax/security/auth/callback/NameCallback.html#getName--"><code>getName()</code></a></dd> </dl> </li> </ul> <a name="getName--"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>getName</h4> <pre>public&nbsp;<a href="../../../../java/lang/String.html" title="class in java.lang">String</a>&nbsp;getName()</pre> <div class="block">Get the retrieved name. <p></div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>the retrieved name (which may be null)</dd> <dt><span class="seeLabel">See Also:</span></dt> <dd><a href="../../../../javax/security/auth/callback/NameCallback.html#setName-java.lang.String-"><code>setName(java.lang.String)</code></a></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> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/NameCallback.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-files/index-1.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage"><strong>Java&trade;&nbsp;Platform<br>Standard&nbsp;Ed.&nbsp;8</strong></div> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../javax/security/auth/callback/LanguageCallback.html" title="class in javax.security.auth.callback"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li><a href="../../../../javax/security/auth/callback/PasswordCallback.html" title="class in javax.security.auth.callback"><span class="typeNameLink">Next&nbsp;Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?javax/security/auth/callback/NameCallback.html" target="_top">Frames</a></li> <li><a href="NameCallback.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <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><font size="-1"> <a href="http://bugreport.sun.com/bugreport/">Submit a bug or feature</a> <br>For further API reference and developer documentation, see <a href="http://download.oracle.com/javase/8/docs/index.html" target="_blank">Java SE Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.<br> Copyright &#x00a9; 1993, 2014, Oracle and/or its affiliates. All rights reserved. </font></small></p> </body> </html>
DeanAaron/jdk8
jdk8en_us/docs/api/javax/security/auth/callback/NameCallback.html
HTML
gpl-3.0
17,965
/********************************************************************* Fits - View and manipulate FITS extensions and/or headers. Fits is part of GNU Astronomy Utilities (Gnuastro) package. Original author: Mohammad Akhlaghi <akhlaghi@gnu.org> Contributing author(s): Copyright (C) 2017, Free Software Foundation, Inc. Gnuastro 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. Gnuastro 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 Gnuastro. If not, see <http://www.gnu.org/licenses/>. **********************************************************************/ #ifndef EXTENSION_H #define EXTENSION_H int extension(struct fitsparams *p); #endif
VladimirMarkelov/gnuastro-vvm
bin/fits/extension.h
C
gpl-3.0
1,083
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_11) on Mon Jun 16 17:36:03 PDT 2014 --> <title>Uses of Class java.awt.image.BufferedImage (Java Platform SE 8 )</title> <meta name="date" content="2014-06-16"> <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class java.awt.image.BufferedImage (Java Platform SE 8 )"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-files/index-1.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage"><strong>Java&trade;&nbsp;Platform<br>Standard&nbsp;Ed.&nbsp;8</strong></div> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../index.html?java/awt/image/class-use/BufferedImage.html" target="_top">Frames</a></li> <li><a href="BufferedImage.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Class java.awt.image.BufferedImage" class="title">Uses of Class<br>java.awt.image.BufferedImage</h2> </div> <div class="classUseContainer"> <ul class="blockList"> <li class="blockList"> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation"> <caption><span>Packages that use <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Package</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="#java.awt">java.awt</a></td> <td class="colLast"> <div class="block">Contains all of the classes for creating user interfaces and for painting graphics and images.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="#java.awt.image">java.awt.image</a></td> <td class="colLast"> <div class="block">Provides classes for creating and modifying images.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><a href="#javax.imageio">javax.imageio</a></td> <td class="colLast"> <div class="block">The main package of the Java Image I/O API.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="#javax.imageio.event">javax.imageio.event</a></td> <td class="colLast"> <div class="block">A package of the Java Image I/O API dealing with synchronous notification of events during the reading and writing of images.</div> </td> </tr> </tbody> </table> </li> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="java.awt"> <!-- --> </a> <h3>Uses of <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a> in <a href="../../../../java/awt/package-summary.html">java.awt</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../java/awt/package-summary.html">java.awt</a> that return <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">GraphicsConfiguration.</span><code><span class="memberNameLink"><a href="../../../../java/awt/GraphicsConfiguration.html#createCompatibleImage-int-int-">createCompatibleImage</a></span>(int&nbsp;width, int&nbsp;height)</code> <div class="block">Returns a <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image"><code>BufferedImage</code></a> with a data layout and color model compatible with this <code>GraphicsConfiguration</code>.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">GraphicsConfiguration.</span><code><span class="memberNameLink"><a href="../../../../java/awt/GraphicsConfiguration.html#createCompatibleImage-int-int-int-">createCompatibleImage</a></span>(int&nbsp;width, int&nbsp;height, int&nbsp;transparency)</code> <div class="block">Returns a <code>BufferedImage</code> that supports the specified transparency and has a data layout and color model compatible with this <code>GraphicsConfiguration</code>.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">Robot.</span><code><span class="memberNameLink"><a href="../../../../java/awt/Robot.html#createScreenCapture-java.awt.Rectangle-">createScreenCapture</a></span>(<a href="../../../../java/awt/Rectangle.html" title="class in java.awt">Rectangle</a>&nbsp;screenRect)</code> <div class="block">Creates an image containing pixels read from the screen.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">TexturePaint.</span><code><span class="memberNameLink"><a href="../../../../java/awt/TexturePaint.html#getImage--">getImage</a></span>()</code> <div class="block">Returns the <code>BufferedImage</code> texture used to fill the shapes.</div> </td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../java/awt/package-summary.html">java.awt</a> with parameters of type <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>abstract <a href="../../../../java/awt/Graphics2D.html" title="class in java.awt">Graphics2D</a></code></td> <td class="colLast"><span class="typeNameLabel">GraphicsEnvironment.</span><code><span class="memberNameLink"><a href="../../../../java/awt/GraphicsEnvironment.html#createGraphics-java.awt.image.BufferedImage-">createGraphics</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;img)</code> <div class="block">Returns a <code>Graphics2D</code> object for rendering into the specified <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image"><code>BufferedImage</code></a>.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>abstract void</code></td> <td class="colLast"><span class="typeNameLabel">Graphics2D.</span><code><span class="memberNameLink"><a href="../../../../java/awt/Graphics2D.html#drawImage-java.awt.image.BufferedImage-java.awt.image.BufferedImageOp-int-int-">drawImage</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;img, <a href="../../../../java/awt/image/BufferedImageOp.html" title="interface in java.awt.image">BufferedImageOp</a>&nbsp;op, int&nbsp;x, int&nbsp;y)</code> <div class="block">Renders a <code>BufferedImage</code> that is filtered with a <a href="../../../../java/awt/image/BufferedImageOp.html" title="interface in java.awt.image"><code>BufferedImageOp</code></a>.</div> </td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing constructors, and an explanation"> <caption><span>Constructors in <a href="../../../../java/awt/package-summary.html">java.awt</a> with parameters of type <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colOne" scope="col">Constructor and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../java/awt/TexturePaint.html#TexturePaint-java.awt.image.BufferedImage-java.awt.geom.Rectangle2D-">TexturePaint</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;txtr, <a href="../../../../java/awt/geom/Rectangle2D.html" title="class in java.awt.geom">Rectangle2D</a>&nbsp;anchor)</code> <div class="block">Constructs a <code>TexturePaint</code> object.</div> </td> </tr> </tbody> </table> </li> <li class="blockList"><a name="java.awt.image"> <!-- --> </a> <h3>Uses of <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a> in <a href="../../../../java/awt/image/package-summary.html">java.awt.image</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../java/awt/image/package-summary.html">java.awt.image</a> that return <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">IndexColorModel.</span><code><span class="memberNameLink"><a href="../../../../java/awt/image/IndexColorModel.html#convertToIntDiscrete-java.awt.image.Raster-boolean-">convertToIntDiscrete</a></span>(<a href="../../../../java/awt/image/Raster.html" title="class in java.awt.image">Raster</a>&nbsp;raster, boolean&nbsp;forceARGB)</code> <div class="block">Returns a new <code>BufferedImage</code> of TYPE_INT_ARGB or TYPE_INT_RGB that has a <code>Raster</code> with pixel data computed by expanding the indices in the source <code>Raster</code> using the color/alpha component arrays of this <code>ColorModel</code>.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">BufferedImageOp.</span><code><span class="memberNameLink"><a href="../../../../java/awt/image/BufferedImageOp.html#createCompatibleDestImage-java.awt.image.BufferedImage-java.awt.image.ColorModel-">createCompatibleDestImage</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;src, <a href="../../../../java/awt/image/ColorModel.html" title="class in java.awt.image">ColorModel</a>&nbsp;destCM)</code> <div class="block">Creates a zeroed destination image with the correct size and number of bands.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">AffineTransformOp.</span><code><span class="memberNameLink"><a href="../../../../java/awt/image/AffineTransformOp.html#createCompatibleDestImage-java.awt.image.BufferedImage-java.awt.image.ColorModel-">createCompatibleDestImage</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;src, <a href="../../../../java/awt/image/ColorModel.html" title="class in java.awt.image">ColorModel</a>&nbsp;destCM)</code> <div class="block">Creates a zeroed destination image with the correct size and number of bands.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">ConvolveOp.</span><code><span class="memberNameLink"><a href="../../../../java/awt/image/ConvolveOp.html#createCompatibleDestImage-java.awt.image.BufferedImage-java.awt.image.ColorModel-">createCompatibleDestImage</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;src, <a href="../../../../java/awt/image/ColorModel.html" title="class in java.awt.image">ColorModel</a>&nbsp;destCM)</code> <div class="block">Creates a zeroed destination image with the correct size and number of bands.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">ColorConvertOp.</span><code><span class="memberNameLink"><a href="../../../../java/awt/image/ColorConvertOp.html#createCompatibleDestImage-java.awt.image.BufferedImage-java.awt.image.ColorModel-">createCompatibleDestImage</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;src, <a href="../../../../java/awt/image/ColorModel.html" title="class in java.awt.image">ColorModel</a>&nbsp;destCM)</code> <div class="block">Creates a zeroed destination image with the correct size and number of bands, given this source.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">LookupOp.</span><code><span class="memberNameLink"><a href="../../../../java/awt/image/LookupOp.html#createCompatibleDestImage-java.awt.image.BufferedImage-java.awt.image.ColorModel-">createCompatibleDestImage</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;src, <a href="../../../../java/awt/image/ColorModel.html" title="class in java.awt.image">ColorModel</a>&nbsp;destCM)</code> <div class="block">Creates a zeroed destination image with the correct size and number of bands.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">RescaleOp.</span><code><span class="memberNameLink"><a href="../../../../java/awt/image/RescaleOp.html#createCompatibleDestImage-java.awt.image.BufferedImage-java.awt.image.ColorModel-">createCompatibleDestImage</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;src, <a href="../../../../java/awt/image/ColorModel.html" title="class in java.awt.image">ColorModel</a>&nbsp;destCM)</code> <div class="block">Creates a zeroed destination image with the correct size and number of bands.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">BufferedImageOp.</span><code><span class="memberNameLink"><a href="../../../../java/awt/image/BufferedImageOp.html#filter-java.awt.image.BufferedImage-java.awt.image.BufferedImage-">filter</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;src, <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;dest)</code> <div class="block">Performs a single-input/single-output operation on a <CODE>BufferedImage</CODE>.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">AffineTransformOp.</span><code><span class="memberNameLink"><a href="../../../../java/awt/image/AffineTransformOp.html#filter-java.awt.image.BufferedImage-java.awt.image.BufferedImage-">filter</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;src, <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;dst)</code> <div class="block">Transforms the source <CODE>BufferedImage</CODE> and stores the results in the destination <CODE>BufferedImage</CODE>.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">ConvolveOp.</span><code><span class="memberNameLink"><a href="../../../../java/awt/image/ConvolveOp.html#filter-java.awt.image.BufferedImage-java.awt.image.BufferedImage-">filter</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;src, <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;dst)</code> <div class="block">Performs a convolution on BufferedImages.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">ColorConvertOp.</span><code><span class="memberNameLink"><a href="../../../../java/awt/image/ColorConvertOp.html#filter-java.awt.image.BufferedImage-java.awt.image.BufferedImage-">filter</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;src, <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;dest)</code> <div class="block">ColorConverts the source BufferedImage.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">LookupOp.</span><code><span class="memberNameLink"><a href="../../../../java/awt/image/LookupOp.html#filter-java.awt.image.BufferedImage-java.awt.image.BufferedImage-">filter</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;src, <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;dst)</code> <div class="block">Performs a lookup operation on a <code>BufferedImage</code>.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">RescaleOp.</span><code><span class="memberNameLink"><a href="../../../../java/awt/image/RescaleOp.html#filter-java.awt.image.BufferedImage-java.awt.image.BufferedImage-">filter</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;src, <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;dst)</code> <div class="block">Rescales the source BufferedImage.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>abstract <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">VolatileImage.</span><code><span class="memberNameLink"><a href="../../../../java/awt/image/VolatileImage.html#getSnapshot--">getSnapshot</a></span>()</code> <div class="block">Returns a static snapshot image of this object.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">BufferedImage.</span><code><span class="memberNameLink"><a href="../../../../java/awt/image/BufferedImage.html#getSubimage-int-int-int-int-">getSubimage</a></span>(int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h)</code> <div class="block">Returns a subimage defined by a specified rectangular region.</div> </td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../java/awt/image/package-summary.html">java.awt.image</a> with parameters of type <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">BufferedImageOp.</span><code><span class="memberNameLink"><a href="../../../../java/awt/image/BufferedImageOp.html#createCompatibleDestImage-java.awt.image.BufferedImage-java.awt.image.ColorModel-">createCompatibleDestImage</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;src, <a href="../../../../java/awt/image/ColorModel.html" title="class in java.awt.image">ColorModel</a>&nbsp;destCM)</code> <div class="block">Creates a zeroed destination image with the correct size and number of bands.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">AffineTransformOp.</span><code><span class="memberNameLink"><a href="../../../../java/awt/image/AffineTransformOp.html#createCompatibleDestImage-java.awt.image.BufferedImage-java.awt.image.ColorModel-">createCompatibleDestImage</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;src, <a href="../../../../java/awt/image/ColorModel.html" title="class in java.awt.image">ColorModel</a>&nbsp;destCM)</code> <div class="block">Creates a zeroed destination image with the correct size and number of bands.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">ConvolveOp.</span><code><span class="memberNameLink"><a href="../../../../java/awt/image/ConvolveOp.html#createCompatibleDestImage-java.awt.image.BufferedImage-java.awt.image.ColorModel-">createCompatibleDestImage</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;src, <a href="../../../../java/awt/image/ColorModel.html" title="class in java.awt.image">ColorModel</a>&nbsp;destCM)</code> <div class="block">Creates a zeroed destination image with the correct size and number of bands.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">ColorConvertOp.</span><code><span class="memberNameLink"><a href="../../../../java/awt/image/ColorConvertOp.html#createCompatibleDestImage-java.awt.image.BufferedImage-java.awt.image.ColorModel-">createCompatibleDestImage</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;src, <a href="../../../../java/awt/image/ColorModel.html" title="class in java.awt.image">ColorModel</a>&nbsp;destCM)</code> <div class="block">Creates a zeroed destination image with the correct size and number of bands, given this source.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">LookupOp.</span><code><span class="memberNameLink"><a href="../../../../java/awt/image/LookupOp.html#createCompatibleDestImage-java.awt.image.BufferedImage-java.awt.image.ColorModel-">createCompatibleDestImage</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;src, <a href="../../../../java/awt/image/ColorModel.html" title="class in java.awt.image">ColorModel</a>&nbsp;destCM)</code> <div class="block">Creates a zeroed destination image with the correct size and number of bands.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">RescaleOp.</span><code><span class="memberNameLink"><a href="../../../../java/awt/image/RescaleOp.html#createCompatibleDestImage-java.awt.image.BufferedImage-java.awt.image.ColorModel-">createCompatibleDestImage</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;src, <a href="../../../../java/awt/image/ColorModel.html" title="class in java.awt.image">ColorModel</a>&nbsp;destCM)</code> <div class="block">Creates a zeroed destination image with the correct size and number of bands.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">BufferedImageOp.</span><code><span class="memberNameLink"><a href="../../../../java/awt/image/BufferedImageOp.html#filter-java.awt.image.BufferedImage-java.awt.image.BufferedImage-">filter</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;src, <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;dest)</code> <div class="block">Performs a single-input/single-output operation on a <CODE>BufferedImage</CODE>.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">AffineTransformOp.</span><code><span class="memberNameLink"><a href="../../../../java/awt/image/AffineTransformOp.html#filter-java.awt.image.BufferedImage-java.awt.image.BufferedImage-">filter</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;src, <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;dst)</code> <div class="block">Transforms the source <CODE>BufferedImage</CODE> and stores the results in the destination <CODE>BufferedImage</CODE>.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">ConvolveOp.</span><code><span class="memberNameLink"><a href="../../../../java/awt/image/ConvolveOp.html#filter-java.awt.image.BufferedImage-java.awt.image.BufferedImage-">filter</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;src, <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;dst)</code> <div class="block">Performs a convolution on BufferedImages.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">ColorConvertOp.</span><code><span class="memberNameLink"><a href="../../../../java/awt/image/ColorConvertOp.html#filter-java.awt.image.BufferedImage-java.awt.image.BufferedImage-">filter</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;src, <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;dest)</code> <div class="block">ColorConverts the source BufferedImage.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">LookupOp.</span><code><span class="memberNameLink"><a href="../../../../java/awt/image/LookupOp.html#filter-java.awt.image.BufferedImage-java.awt.image.BufferedImage-">filter</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;src, <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;dst)</code> <div class="block">Performs a lookup operation on a <code>BufferedImage</code>.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">RescaleOp.</span><code><span class="memberNameLink"><a href="../../../../java/awt/image/RescaleOp.html#filter-java.awt.image.BufferedImage-java.awt.image.BufferedImage-">filter</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;src, <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;dst)</code> <div class="block">Rescales the source BufferedImage.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../java/awt/geom/Rectangle2D.html" title="class in java.awt.geom">Rectangle2D</a></code></td> <td class="colLast"><span class="typeNameLabel">BufferedImageOp.</span><code><span class="memberNameLink"><a href="../../../../java/awt/image/BufferedImageOp.html#getBounds2D-java.awt.image.BufferedImage-">getBounds2D</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;src)</code> <div class="block">Returns the bounding box of the filtered destination image.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../java/awt/geom/Rectangle2D.html" title="class in java.awt.geom">Rectangle2D</a></code></td> <td class="colLast"><span class="typeNameLabel">AffineTransformOp.</span><code><span class="memberNameLink"><a href="../../../../java/awt/image/AffineTransformOp.html#getBounds2D-java.awt.image.BufferedImage-">getBounds2D</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;src)</code> <div class="block">Returns the bounding box of the transformed destination.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../java/awt/geom/Rectangle2D.html" title="class in java.awt.geom">Rectangle2D</a></code></td> <td class="colLast"><span class="typeNameLabel">ConvolveOp.</span><code><span class="memberNameLink"><a href="../../../../java/awt/image/ConvolveOp.html#getBounds2D-java.awt.image.BufferedImage-">getBounds2D</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;src)</code> <div class="block">Returns the bounding box of the filtered destination image.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../java/awt/geom/Rectangle2D.html" title="class in java.awt.geom">Rectangle2D</a></code></td> <td class="colLast"><span class="typeNameLabel">ColorConvertOp.</span><code><span class="memberNameLink"><a href="../../../../java/awt/image/ColorConvertOp.html#getBounds2D-java.awt.image.BufferedImage-">getBounds2D</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;src)</code> <div class="block">Returns the bounding box of the destination, given this source.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../java/awt/geom/Rectangle2D.html" title="class in java.awt.geom">Rectangle2D</a></code></td> <td class="colLast"><span class="typeNameLabel">LookupOp.</span><code><span class="memberNameLink"><a href="../../../../java/awt/image/LookupOp.html#getBounds2D-java.awt.image.BufferedImage-">getBounds2D</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;src)</code> <div class="block">Returns the bounding box of the filtered destination image.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../java/awt/geom/Rectangle2D.html" title="class in java.awt.geom">Rectangle2D</a></code></td> <td class="colLast"><span class="typeNameLabel">RescaleOp.</span><code><span class="memberNameLink"><a href="../../../../java/awt/image/RescaleOp.html#getBounds2D-java.awt.image.BufferedImage-">getBounds2D</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;src)</code> <div class="block">Returns the bounding box of the rescaled destination image.</div> </td> </tr> </tbody> </table> </li> <li class="blockList"><a name="javax.imageio"> <!-- --> </a> <h3>Uses of <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a> in <a href="../../../../javax/imageio/package-summary.html">javax.imageio</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing fields, and an explanation"> <caption><span>Fields in <a href="../../../../javax/imageio/package-summary.html">javax.imageio</a> declared as <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Field and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>protected <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">ImageReadParam.</span><code><span class="memberNameLink"><a href="../../../../javax/imageio/ImageReadParam.html#destination">destination</a></span></code> <div class="block">The current destination <code>BufferedImage</code>, or <code>null</code> if none has been set.</div> </td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing fields, and an explanation"> <caption><span>Fields in <a href="../../../../javax/imageio/package-summary.html">javax.imageio</a> with type parameters of type <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Field and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>protected <a href="../../../../java/util/List.html" title="interface in java.util">List</a>&lt;? extends <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&gt;</code></td> <td class="colLast"><span class="typeNameLabel">IIOImage.</span><code><span class="memberNameLink"><a href="../../../../javax/imageio/IIOImage.html#thumbnails">thumbnails</a></span></code> <div class="block">A <code>List</code> of <code>BufferedImage</code> thumbnails, or <code>null</code>.</div> </td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../javax/imageio/package-summary.html">javax.imageio</a> that return <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">ImageTypeSpecifier.</span><code><span class="memberNameLink"><a href="../../../../javax/imageio/ImageTypeSpecifier.html#createBufferedImage-int-int-">createBufferedImage</a></span>(int&nbsp;width, int&nbsp;height)</code> <div class="block">Creates a <code>BufferedImage</code> with a given width and height according to the specification embodied in this object.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">ImageReadParam.</span><code><span class="memberNameLink"><a href="../../../../javax/imageio/ImageReadParam.html#getDestination--">getDestination</a></span>()</code> <div class="block">Returns the <code>BufferedImage</code> currently set by the <code>setDestination</code> method, or <code>null</code> if none is set.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>protected static <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">ImageReader.</span><code><span class="memberNameLink"><a href="../../../../javax/imageio/ImageReader.html#getDestination-javax.imageio.ImageReadParam-java.util.Iterator-int-int-">getDestination</a></span>(<a href="../../../../javax/imageio/ImageReadParam.html" title="class in javax.imageio">ImageReadParam</a>&nbsp;param, <a href="../../../../java/util/Iterator.html" title="interface in java.util">Iterator</a>&lt;<a href="../../../../javax/imageio/ImageTypeSpecifier.html" title="class in javax.imageio">ImageTypeSpecifier</a>&gt;&nbsp;imageTypes, int&nbsp;width, int&nbsp;height)</code> <div class="block">Returns the <code>BufferedImage</code> to which decoded pixel data should be written.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">IIOImage.</span><code><span class="memberNameLink"><a href="../../../../javax/imageio/IIOImage.html#getThumbnail-int-">getThumbnail</a></span>(int&nbsp;index)</code> <div class="block">Returns a thumbnail associated with the main image.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>static <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">ImageIO.</span><code><span class="memberNameLink"><a href="../../../../javax/imageio/ImageIO.html#read-java.io.File-">read</a></span>(<a href="../../../../java/io/File.html" title="class in java.io">File</a>&nbsp;input)</code> <div class="block">Returns a <code>BufferedImage</code> as the result of decoding a supplied <code>File</code> with an <code>ImageReader</code> chosen automatically from among those currently registered.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>static <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">ImageIO.</span><code><span class="memberNameLink"><a href="../../../../javax/imageio/ImageIO.html#read-javax.imageio.stream.ImageInputStream-">read</a></span>(<a href="../../../../javax/imageio/stream/ImageInputStream.html" title="interface in javax.imageio.stream">ImageInputStream</a>&nbsp;stream)</code> <div class="block">Returns a <code>BufferedImage</code> as the result of decoding a supplied <code>ImageInputStream</code> with an <code>ImageReader</code> chosen automatically from among those currently registered.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>static <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">ImageIO.</span><code><span class="memberNameLink"><a href="../../../../javax/imageio/ImageIO.html#read-java.io.InputStream-">read</a></span>(<a href="../../../../java/io/InputStream.html" title="class in java.io">InputStream</a>&nbsp;input)</code> <div class="block">Returns a <code>BufferedImage</code> as the result of decoding a supplied <code>InputStream</code> with an <code>ImageReader</code> chosen automatically from among those currently registered.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">ImageReader.</span><code><span class="memberNameLink"><a href="../../../../javax/imageio/ImageReader.html#read-int-">read</a></span>(int&nbsp;imageIndex)</code> <div class="block">Reads the image indexed by <code>imageIndex</code> and returns it as a complete <code>BufferedImage</code>, using a default <code>ImageReadParam</code>.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>abstract <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">ImageReader.</span><code><span class="memberNameLink"><a href="../../../../javax/imageio/ImageReader.html#read-int-javax.imageio.ImageReadParam-">read</a></span>(int&nbsp;imageIndex, <a href="../../../../javax/imageio/ImageReadParam.html" title="class in javax.imageio">ImageReadParam</a>&nbsp;param)</code> <div class="block">Reads the image indexed by <code>imageIndex</code> and returns it as a complete <code>BufferedImage</code>, using a supplied <code>ImageReadParam</code>.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>static <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">ImageIO.</span><code><span class="memberNameLink"><a href="../../../../javax/imageio/ImageIO.html#read-java.net.URL-">read</a></span>(<a href="../../../../java/net/URL.html" title="class in java.net">URL</a>&nbsp;input)</code> <div class="block">Returns a <code>BufferedImage</code> as the result of decoding a supplied <code>URL</code> with an <code>ImageReader</code> chosen automatically from among those currently registered.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">ImageReader.</span><code><span class="memberNameLink"><a href="../../../../javax/imageio/ImageReader.html#readThumbnail-int-int-">readThumbnail</a></span>(int&nbsp;imageIndex, int&nbsp;thumbnailIndex)</code> <div class="block">Returns the thumbnail preview image indexed by <code>thumbnailIndex</code>, associated with the image indexed by <code>ImageIndex</code> as a <code>BufferedImage</code>.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></code></td> <td class="colLast"><span class="typeNameLabel">ImageReader.</span><code><span class="memberNameLink"><a href="../../../../javax/imageio/ImageReader.html#readTile-int-int-int-">readTile</a></span>(int&nbsp;imageIndex, int&nbsp;tileX, int&nbsp;tileY)</code> <div class="block">Reads the tile indicated by the <code>tileX</code> and <code>tileY</code> arguments, returning it as a <code>BufferedImage</code>.</div> </td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../javax/imageio/package-summary.html">javax.imageio</a> that return types with arguments of type <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../java/util/List.html" title="interface in java.util">List</a>&lt;? extends <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&gt;</code></td> <td class="colLast"><span class="typeNameLabel">IIOImage.</span><code><span class="memberNameLink"><a href="../../../../javax/imageio/IIOImage.html#getThumbnails--">getThumbnails</a></span>()</code> <div class="block">Returns the current <code>List</code> of thumbnail <code>BufferedImage</code>s, or <code>null</code> if none is set.</div> </td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../javax/imageio/package-summary.html">javax.imageio</a> with parameters of type <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>protected static void</code></td> <td class="colLast"><span class="typeNameLabel">ImageReader.</span><code><span class="memberNameLink"><a href="../../../../javax/imageio/ImageReader.html#computeRegions-javax.imageio.ImageReadParam-int-int-java.awt.image.BufferedImage-java.awt.Rectangle-java.awt.Rectangle-">computeRegions</a></span>(<a href="../../../../javax/imageio/ImageReadParam.html" title="class in javax.imageio">ImageReadParam</a>&nbsp;param, int&nbsp;srcWidth, int&nbsp;srcHeight, <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;image, <a href="../../../../java/awt/Rectangle.html" title="class in java.awt">Rectangle</a>&nbsp;srcRegion, <a href="../../../../java/awt/Rectangle.html" title="class in java.awt">Rectangle</a>&nbsp;destRegion)</code> <div class="block">Computes the source region of interest and the destination region of interest, taking the width and height of the source image, an optional destination image, and an optional <code>ImageReadParam</code> into account.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>protected void</code></td> <td class="colLast"><span class="typeNameLabel">ImageReader.</span><code><span class="memberNameLink"><a href="../../../../javax/imageio/ImageReader.html#processImageUpdate-java.awt.image.BufferedImage-int-int-int-int-int-int-int:A-">processImageUpdate</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;theImage, int&nbsp;minX, int&nbsp;minY, int&nbsp;width, int&nbsp;height, int&nbsp;periodX, int&nbsp;periodY, int[]&nbsp;bands)</code> <div class="block">Broadcasts the update of a set of samples to all registered <code>IIOReadUpdateListener</code>s by calling their <code>imageUpdate</code> method.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>protected void</code></td> <td class="colLast"><span class="typeNameLabel">ImageReader.</span><code><span class="memberNameLink"><a href="../../../../javax/imageio/ImageReader.html#processPassComplete-java.awt.image.BufferedImage-">processPassComplete</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;theImage)</code> <div class="block">Broadcasts the end of a progressive pass to all registered <code>IIOReadUpdateListener</code>s by calling their <code>passComplete</code> method.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>protected void</code></td> <td class="colLast"><span class="typeNameLabel">ImageReader.</span><code><span class="memberNameLink"><a href="../../../../javax/imageio/ImageReader.html#processPassStarted-java.awt.image.BufferedImage-int-int-int-int-int-int-int-int:A-">processPassStarted</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;theImage, int&nbsp;pass, int&nbsp;minPass, int&nbsp;maxPass, int&nbsp;minX, int&nbsp;minY, int&nbsp;periodX, int&nbsp;periodY, int[]&nbsp;bands)</code> <div class="block">Broadcasts the beginning of a progressive pass to all registered <code>IIOReadUpdateListener</code>s by calling their <code>passStarted</code> method.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>protected void</code></td> <td class="colLast"><span class="typeNameLabel">ImageReader.</span><code><span class="memberNameLink"><a href="../../../../javax/imageio/ImageReader.html#processThumbnailPassComplete-java.awt.image.BufferedImage-">processThumbnailPassComplete</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;theThumbnail)</code> <div class="block">Broadcasts the end of a thumbnail progressive pass to all registered <code>IIOReadUpdateListener</code>s by calling their <code>thumbnailPassComplete</code> method.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>protected void</code></td> <td class="colLast"><span class="typeNameLabel">ImageReader.</span><code><span class="memberNameLink"><a href="../../../../javax/imageio/ImageReader.html#processThumbnailPassStarted-java.awt.image.BufferedImage-int-int-int-int-int-int-int-int:A-">processThumbnailPassStarted</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;theThumbnail, int&nbsp;pass, int&nbsp;minPass, int&nbsp;maxPass, int&nbsp;minX, int&nbsp;minY, int&nbsp;periodX, int&nbsp;periodY, int[]&nbsp;bands)</code> <div class="block">Broadcasts the beginning of a thumbnail progressive pass to all registered <code>IIOReadUpdateListener</code>s by calling their <code>thumbnailPassStarted</code> method.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>protected void</code></td> <td class="colLast"><span class="typeNameLabel">ImageReader.</span><code><span class="memberNameLink"><a href="../../../../javax/imageio/ImageReader.html#processThumbnailUpdate-java.awt.image.BufferedImage-int-int-int-int-int-int-int:A-">processThumbnailUpdate</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;theThumbnail, int&nbsp;minX, int&nbsp;minY, int&nbsp;width, int&nbsp;height, int&nbsp;periodX, int&nbsp;periodY, int[]&nbsp;bands)</code> <div class="block">Broadcasts the update of a set of samples in a thumbnail image to all registered <code>IIOReadUpdateListener</code>s by calling their <code>thumbnailUpdate</code> method.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><span class="typeNameLabel">ImageReadParam.</span><code><span class="memberNameLink"><a href="../../../../javax/imageio/ImageReadParam.html#setDestination-java.awt.image.BufferedImage-">setDestination</a></span>(<a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;destination)</code> <div class="block">Supplies a <code>BufferedImage</code> to be used as the destination for decoded pixel data.</div> </td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Method parameters in <a href="../../../../javax/imageio/package-summary.html">javax.imageio</a> with type arguments of type <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><span class="typeNameLabel">ImageWriter.</span><code><span class="memberNameLink"><a href="../../../../javax/imageio/ImageWriter.html#prepareInsertEmpty-int-javax.imageio.ImageTypeSpecifier-int-int-javax.imageio.metadata.IIOMetadata-java.util.List-javax.imageio.ImageWriteParam-">prepareInsertEmpty</a></span>(int&nbsp;imageIndex, <a href="../../../../javax/imageio/ImageTypeSpecifier.html" title="class in javax.imageio">ImageTypeSpecifier</a>&nbsp;imageType, int&nbsp;width, int&nbsp;height, <a href="../../../../javax/imageio/metadata/IIOMetadata.html" title="class in javax.imageio.metadata">IIOMetadata</a>&nbsp;imageMetadata, <a href="../../../../java/util/List.html" title="interface in java.util">List</a>&lt;? extends <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&gt;&nbsp;thumbnails, <a href="../../../../javax/imageio/ImageWriteParam.html" title="class in javax.imageio">ImageWriteParam</a>&nbsp;param)</code> <div class="block">Begins the insertion of a new image with undefined pixel values into an existing image stream.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><span class="typeNameLabel">ImageWriter.</span><code><span class="memberNameLink"><a href="../../../../javax/imageio/ImageWriter.html#prepareWriteEmpty-javax.imageio.metadata.IIOMetadata-javax.imageio.ImageTypeSpecifier-int-int-javax.imageio.metadata.IIOMetadata-java.util.List-javax.imageio.ImageWriteParam-">prepareWriteEmpty</a></span>(<a href="../../../../javax/imageio/metadata/IIOMetadata.html" title="class in javax.imageio.metadata">IIOMetadata</a>&nbsp;streamMetadata, <a href="../../../../javax/imageio/ImageTypeSpecifier.html" title="class in javax.imageio">ImageTypeSpecifier</a>&nbsp;imageType, int&nbsp;width, int&nbsp;height, <a href="../../../../javax/imageio/metadata/IIOMetadata.html" title="class in javax.imageio.metadata">IIOMetadata</a>&nbsp;imageMetadata, <a href="../../../../java/util/List.html" title="interface in java.util">List</a>&lt;? extends <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&gt;&nbsp;thumbnails, <a href="../../../../javax/imageio/ImageWriteParam.html" title="class in javax.imageio">ImageWriteParam</a>&nbsp;param)</code> <div class="block">Begins the writing of a complete image stream, consisting of a single image with undefined pixel values and associated metadata and thumbnails, to the output.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><span class="typeNameLabel">IIOImage.</span><code><span class="memberNameLink"><a href="../../../../javax/imageio/IIOImage.html#setThumbnails-java.util.List-">setThumbnails</a></span>(<a href="../../../../java/util/List.html" title="interface in java.util">List</a>&lt;? extends <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&gt;&nbsp;thumbnails)</code> <div class="block">Sets the list of thumbnails to a new <code>List</code> of <code>BufferedImage</code>s, or to <code>null</code>.</div> </td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing constructors, and an explanation"> <caption><span>Constructor parameters in <a href="../../../../javax/imageio/package-summary.html">javax.imageio</a> with type arguments of type <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colOne" scope="col">Constructor and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../javax/imageio/IIOImage.html#IIOImage-java.awt.image.Raster-java.util.List-javax.imageio.metadata.IIOMetadata-">IIOImage</a></span>(<a href="../../../../java/awt/image/Raster.html" title="class in java.awt.image">Raster</a>&nbsp;raster, <a href="../../../../java/util/List.html" title="interface in java.util">List</a>&lt;? extends <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&gt;&nbsp;thumbnails, <a href="../../../../javax/imageio/metadata/IIOMetadata.html" title="class in javax.imageio.metadata">IIOMetadata</a>&nbsp;metadata)</code> <div class="block">Constructs an <code>IIOImage</code> containing a <code>Raster</code>, and thumbnails and metadata associated with it.</div> </td> </tr> <tr class="rowColor"> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../javax/imageio/IIOImage.html#IIOImage-java.awt.image.RenderedImage-java.util.List-javax.imageio.metadata.IIOMetadata-">IIOImage</a></span>(<a href="../../../../java/awt/image/RenderedImage.html" title="interface in java.awt.image">RenderedImage</a>&nbsp;image, <a href="../../../../java/util/List.html" title="interface in java.util">List</a>&lt;? extends <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&gt;&nbsp;thumbnails, <a href="../../../../javax/imageio/metadata/IIOMetadata.html" title="class in javax.imageio.metadata">IIOMetadata</a>&nbsp;metadata)</code> <div class="block">Constructs an <code>IIOImage</code> containing a <code>RenderedImage</code>, and thumbnails and metadata associated with it.</div> </td> </tr> </tbody> </table> </li> <li class="blockList"><a name="javax.imageio.event"> <!-- --> </a> <h3>Uses of <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a> in <a href="../../../../javax/imageio/event/package-summary.html">javax.imageio.event</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../javax/imageio/event/package-summary.html">javax.imageio.event</a> with parameters of type <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><span class="typeNameLabel">IIOReadUpdateListener.</span><code><span class="memberNameLink"><a href="../../../../javax/imageio/event/IIOReadUpdateListener.html#imageUpdate-javax.imageio.ImageReader-java.awt.image.BufferedImage-int-int-int-int-int-int-int:A-">imageUpdate</a></span>(<a href="../../../../javax/imageio/ImageReader.html" title="class in javax.imageio">ImageReader</a>&nbsp;source, <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;theImage, int&nbsp;minX, int&nbsp;minY, int&nbsp;width, int&nbsp;height, int&nbsp;periodX, int&nbsp;periodY, int[]&nbsp;bands)</code> <div class="block">Reports that a given region of the image has been updated.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><span class="typeNameLabel">IIOReadUpdateListener.</span><code><span class="memberNameLink"><a href="../../../../javax/imageio/event/IIOReadUpdateListener.html#passComplete-javax.imageio.ImageReader-java.awt.image.BufferedImage-">passComplete</a></span>(<a href="../../../../javax/imageio/ImageReader.html" title="class in javax.imageio">ImageReader</a>&nbsp;source, <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;theImage)</code> <div class="block">Reports that the current read operation has completed a progressive pass.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><span class="typeNameLabel">IIOReadUpdateListener.</span><code><span class="memberNameLink"><a href="../../../../javax/imageio/event/IIOReadUpdateListener.html#passStarted-javax.imageio.ImageReader-java.awt.image.BufferedImage-int-int-int-int-int-int-int-int:A-">passStarted</a></span>(<a href="../../../../javax/imageio/ImageReader.html" title="class in javax.imageio">ImageReader</a>&nbsp;source, <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;theImage, int&nbsp;pass, int&nbsp;minPass, int&nbsp;maxPass, int&nbsp;minX, int&nbsp;minY, int&nbsp;periodX, int&nbsp;periodY, int[]&nbsp;bands)</code> <div class="block">Reports that the current read operation is about to begin a progressive pass.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><span class="typeNameLabel">IIOReadUpdateListener.</span><code><span class="memberNameLink"><a href="../../../../javax/imageio/event/IIOReadUpdateListener.html#thumbnailPassComplete-javax.imageio.ImageReader-java.awt.image.BufferedImage-">thumbnailPassComplete</a></span>(<a href="../../../../javax/imageio/ImageReader.html" title="class in javax.imageio">ImageReader</a>&nbsp;source, <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;theThumbnail)</code> <div class="block">Reports that the current thumbnail read operation has completed a progressive pass.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><span class="typeNameLabel">IIOReadUpdateListener.</span><code><span class="memberNameLink"><a href="../../../../javax/imageio/event/IIOReadUpdateListener.html#thumbnailPassStarted-javax.imageio.ImageReader-java.awt.image.BufferedImage-int-int-int-int-int-int-int-int:A-">thumbnailPassStarted</a></span>(<a href="../../../../javax/imageio/ImageReader.html" title="class in javax.imageio">ImageReader</a>&nbsp;source, <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;theThumbnail, int&nbsp;pass, int&nbsp;minPass, int&nbsp;maxPass, int&nbsp;minX, int&nbsp;minY, int&nbsp;periodX, int&nbsp;periodY, int[]&nbsp;bands)</code> <div class="block">Reports that the current thumbnail read operation is about to begin a progressive pass.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><span class="typeNameLabel">IIOReadUpdateListener.</span><code><span class="memberNameLink"><a href="../../../../javax/imageio/event/IIOReadUpdateListener.html#thumbnailUpdate-javax.imageio.ImageReader-java.awt.image.BufferedImage-int-int-int-int-int-int-int:A-">thumbnailUpdate</a></span>(<a href="../../../../javax/imageio/ImageReader.html" title="class in javax.imageio">ImageReader</a>&nbsp;source, <a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">BufferedImage</a>&nbsp;theThumbnail, int&nbsp;minX, int&nbsp;minY, int&nbsp;width, int&nbsp;height, int&nbsp;periodX, int&nbsp;periodY, int[]&nbsp;bands)</code> <div class="block">Reports that a given region of a thumbnail image has been updated.</div> </td> </tr> </tbody> </table> </li> </ul> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../java/awt/image/BufferedImage.html" title="class in java.awt.image">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-files/index-1.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage"><strong>Java&trade;&nbsp;Platform<br>Standard&nbsp;Ed.&nbsp;8</strong></div> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../index.html?java/awt/image/class-use/BufferedImage.html" target="_top">Frames</a></li> <li><a href="BufferedImage.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small><font size="-1"> <a href="http://bugreport.sun.com/bugreport/">Submit a bug or feature</a> <br>For further API reference and developer documentation, see <a href="http://download.oracle.com/javase/8/docs/index.html" target="_blank">Java SE Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.<br> Copyright &#x00a9; 1993, 2014, Oracle and/or its affiliates. All rights reserved. </font></small></p> </body> </html>
DeanAaron/jdk8
jdk8en_us/docs/api/java/awt/image/class-use/BufferedImage.html
HTML
gpl-3.0
71,127
/* Copyright 2009, 2015 Red Hat, Inc. * * Portions adapted from Mx's data/style/default.css * Copyright 2009 Intel Corporation * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU Lesser General Public License, * version 2.1, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. */ stage { font-family: Futura Bk bt, Cantarell, Sans-Serif; font-size: 9pt; color: #D3DAE3; } .app-well-menu, .run-dialog-error-label, .dash-label, .window-caption, .switcher-list, .app-well-app > .overview-icon, .grid-search-result .overview-icon { font-size: 1em; font-weight: normal; } .app-well-app.running > .overview-icon, .app-well-app.running:hover > .overview-icon, .app-well-app.running:active > .overview-icon, .app-well-app.running:checked > .overview-icon { background-color: transparent !important; background-gradient-direction: none !important; border: none !important; border-radius: 0 !important; } .popup-menu .modal-dialog-button { font-size: 1em; min-height: 20px; padding: 5px 32px; transition-duration: 0; border-radius: 2px; background-gradient-direction: none !important; text-shadow: 0 1px rgba(64, 69, 82, 0); color: #D3DAE3; background-color: #444a58; border: 1px solid #2b2e39; box-shadow: inset 0 2px 4px rgba(68, 74, 88, 0.05); } .popup-menu .modal-dialog-button:focus { text-shadow: 0 1px rgba(64, 69, 82, 0); color: #D3DAE3; background-color: #444a58; border: 1px solid #eb9605; box-shadow: inset 0 2px 4px rgba(68, 74, 88, 0.05); } .popup-menu .modal-dialog-button:hover { text-shadow: 0 1px rgba(64, 69, 82, 0); color: #D3DAE3; background-color: #505666; border: 1px solid #2b2e39; box-shadow: inset 0 2px 4px rgba(80, 86, 102, 0.05); } .popup-menu .modal-dialog-button:hover:focus { text-shadow: 0 1px rgba(64, 69, 82, 0); color: #D3DAE3; background-color: #444a58; border: 1px solid #eb9605; box-shadow: inset 0 2px 4px rgba(68, 74, 88, 0.05); } .popup-menu .modal-dialog-button:active, .popup-menu .modal-dialog-button:active:focus { text-shadow: 0 1px rgba(64, 69, 82, 0); color: #ffffff; background-color: #eb9605; border: 1px solid #eb9605; box-shadow: inset 0 1px rgba(82, 148, 226, 0.05); } .popup-menu .modal-dialog-button:insensitive { text-shadow: 0 1px rgba(64, 69, 82, 0); color: rgba(211, 218, 227, 0.45); border: 1px solid rgba(43, 46, 57, 0.55); background-color: rgba(68, 74, 88, 0.55); box-shadow: inset 0 2px 4px rgba(68, 74, 88, 0.05); } .candidate-page-button, .hotplug-notification-item, .hotplug-resident-eject-button, .modal-dialog-button { background-gradient-direction: none !important; } .candidate-page-button, .hotplug-notification-item, .hotplug-resident-eject-button, .modal-dialog-button, .modal-dialog-button-box .button, .notification-button, .notification-icon-button, .hotplug-resident-mount { font-size: 1em; min-height: 20px; padding: 5px 32px; transition-duration: 0; border-radius: 2px; text-shadow: 0 1px rgba(64, 69, 82, 0); color: #BAC3CF; border: 1px solid rgba(0, 0, 0, 0.35); background-color: rgba(102, 109, 132, 0.35); } .candidate-page-button:hover, .hotplug-notification-item:hover, .hotplug-resident-eject-button:hover, .modal-dialog-button:hover, .modal-dialog-button-box .button:hover, .notification-button:hover, .notification-icon-button:hover, .hotplug-resident-mount:hover { text-shadow: 0 1px rgba(64, 69, 82, 0); color: #BAC3CF; border: 1px solid rgba(0, 0, 0, 0.35); background-color: rgba(119, 127, 151, 0.45); } .candidate-page-button:focus, .hotplug-notification-item:focus, .hotplug-resident-eject-button:focus, .modal-dialog-button:focus, .modal-dialog-button-box .button:focus, .notification-button:focus, .notification-icon-button:focus, .hotplug-resident-mount:focus { color: #eb9605; } .candidate-page-button:active, .hotplug-notification-item:active, .hotplug-resident-eject-button:active, .modal-dialog-button:active, .modal-dialog-button-box .button:active, .notification-button:active, .notification-icon-button:active, .hotplug-resident-mount:active { text-shadow: 0 1px rgba(64, 69, 82, 0); color: #ffffff; border: 1px solid #eb9605; background-color: #eb9605; } .candidate-page-button:insensitive, .hotplug-notification-item:insensitive, .hotplug-resident-eject-button:insensitive, .modal-dialog-button:insensitive, .modal-dialog-button-box .button:insensitive, .notification-button:insensitive, .notification-icon-button:insensitive, .hotplug-resident-mount:insensitive { text-shadow: 0 1px rgba(64, 69, 82, 0); color: #5d626e; border: 1px solid rgba(0, 0, 0, 0.35); background-color: rgba(102, 109, 132, 0.2); } StEntry { font-size: 1em; padding: 7px; caret-size: 1px; selection-background-color: #eb9605; selected-color: #ffffff; transition-duration: 300ms; border-radius: 3px; background-gradient-direction: none !important; color: #D3DAE3; background-color: #404552; border: 1px solid #2b2e39; box-shadow: inset 0 2px 4px rgba(64, 69, 82, 0.05); } StEntry:focus, StEntry:hover { color: #D3DAE3; background-color: #404552; border: 1px solid #eb9605; box-shadow: inset 0 2px 4px rgba(64, 69, 82, 0.05); } StEntry:insensitive { color: rgba(211, 218, 227, 0.45); background-color: #3c414e; border-color: 1px solid #313440; box-shadow: inset 0 2px 4px rgba(60, 65, 78, 0.05); } StEntry StIcon.capslock-warning { icon-size: 16px; warning-color: #F27835; padding: 0 4px; } StScrollView.vfade { -st-vfade-offset: 0px; } StScrollView.hfade { -st-hfade-offset: 0px; } StScrollBar { padding: 8px; } StScrollView StScrollBar { min-width: 5px; min-height: 5px; } StScrollBar StBin#trough { background-color: rgba(64, 69, 82, 0.1); border-radius: 8px; } StScrollBar StButton#vhandle, StScrollBar StButton#hhandle { border-radius: 4px; background-color: #767b87; border: 0px solid; margin: 0px; } StScrollBar StButton#vhandle:hover, StScrollBar StButton#hhandle:hover { background-color: #676b78; } StScrollBar StButton#vhandle:active, StScrollBar StButton#hhandle:active { background-color: #eb9605; } .slider { -slider-height: 4px; -slider-background-color: #2b2e39 !important; -slider-border-color: transparent !important; -slider-active-background-color: #eb9605 !important; -slider-active-border-color: transparent !important; -slider-border-width: 0; -slider-handle-radius: 4px; -slider-handle-border-color: transparent !important; -slider-handle-border-width: 0 !important; height: 18px; border: 0 solid transparent; border-right-width: 1px; border-left-width: 5px; color: transparent; } .check-box StBoxLayout { spacing: .8em; } .check-box StBin { width: 16px; height: 16px; background-image: url("dark-assets/checkbox/checkbox-unchecked.svg"); } .check-box:focus StBin { background-image: url("dark-assets/checkbox/checkbox-unchecked-focused.svg"); } .check-box:checked StBin { background-image: url("dark-assets/checkbox/checkbox-checked.svg"); } .check-box:focus:checked StBin { background-image: url("dark-assets/checkbox/checkbox-checked-focused.svg"); } .toggle-switch { width: 50px; height: 20px; background-size: contain; } .toggle-switch-us, .toggle-switch-intl { background-image: url("dark-assets/switch/switch-off.svg"); } .toggle-switch-us:checked, .toggle-switch-intl:checked { background-image: url("dark-assets/switch/switch-on.svg"); } .shell-link { color: #a9caf1; } .shell-link:hover { color: #d5e5f8; } .headline { font-size: 110%; } .lightbox { background-color: black; } .flashspot { background-color: white; } .modal-dialog { color: #D3DAE3; background-color: rgba(56, 60, 74, 0); border: none; border-image: url("dark-assets/misc/modal.svg") 9 9 9 67; padding: 0 5px 6px 5px; } .modal-dialog > StBoxLayout:first-child { padding: 20px 10px 10px 10px; } .modal-dialog-button-box { spacing: 10px; margin: 0px; padding: 14px 10px; background: none; border: none; border-image: url("dark-assets/misc/button-box.svg") 9 9 9 9; } .modal-dialog-button-box .button { padding-top: 0; padding-bottom: 0; height: 30px; } .modal-dialog .run-dialog-entry { width: 21em; caret-color: #D3DAE3; } .modal-dialog .run-dialog-error-box { padding-top: 5px; spacing: 5px; } .modal-dialog .run-dialog-label { font-size: 0; } .show-processes-dialog-subject, .mount-question-dialog-subject, .end-session-dialog-subject { font-size: 11pt; font-weight: bold; color: #D3DAE3; } .end-session-dialog { spacing: 42px; } .end-session-dialog-list { padding-top: 20px; } .end-session-dialog-layout { padding-left: 17px; } .end-session-dialog-layout:rtl { padding-right: 17px; } .end-session-dialog-description { width: 28em; padding-bottom: 10px; } .end-session-dialog-description:rtl { text-align: right; } .end-session-dialog-warning { width: 28em; color: #F27835; padding-top: 6px; } .end-session-dialog-warning:rtl { text-align: right; } .end-session-dialog-logout-icon { border: 0px solid transparent; border-radius: 2px; width: 48px; height: 48px; background-size: contain; } .end-session-dialog-shutdown-icon { color: #D3DAE3; width: 48px; height: 48px; } .end-session-dialog-inhibitor-layout { spacing: 16px; max-height: 200px; padding-right: 10px; padding-left: 10px; } .end-session-dialog-session-list, .end-session-dialog-app-list { spacing: 1em; } .end-session-dialog-list-header { font-weight: bold; } .end-session-dialog-list-header:rtl { text-align: right; } .end-session-dialog-app-list-item, .end-session-dialog-session-list-item { spacing: 1em; } .end-session-dialog-app-list-item-name, .end-session-dialog-session-list-item-name { font-weight: bold; } .end-session-dialog-app-list-item-description { color: #e3e7ed; font-size: 8pt; } .end-session-dialog .modal-dialog-button:last-child { color: #ffffff; background-color: #F04A50; border-color: #F04A50; } .end-session-dialog .modal-dialog-button:last-child:hover { color: #ffffff; background-color: #f47479; border-color: #f47479; } .end-session-dialog .modal-dialog-button:last-child:active { color: #ffffff; background-color: #ee3239; border-color: #ee3239; } .shell-mount-operation-icon { icon-size: 48px; } .show-processes-dialog, .mount-question-dialog { spacing: 24px; } .show-processes-dialog-subject, .mount-question-dialog-subject { padding-top: 10px; padding-left: 17px; padding-bottom: 6px; } .show-processes-dialog-subject:rtl, .mount-question-dialog-subject:rtl { padding-left: 0px; padding-right: 17px; } .mount-question-dialog-subject { max-width: 500px; } .show-processes-dialog-description, .mount-question-dialog-description { padding-left: 17px; width: 28em; } .show-processes-dialog-description:rtl, .mount-question-dialog-description:rtl { padding-right: 17px; } .show-processes-dialog-app-list { font-size: 10pt; max-height: 200px; padding-top: 24px; padding-left: 49px; padding-right: 32px; } .show-processes-dialog-app-list:rtl { padding-right: 49px; padding-left: 32px; } .show-processes-dialog-app-list-item { color: #b4c0cf; } .show-processes-dialog-app-list-item:hover { color: #D3DAE3; } .show-processes-dialog-app-list-item:ltr { padding-right: 1em; } .show-processes-dialog-app-list-item:rtl { padding-left: 1em; } .show-processes-dialog-app-list-item-icon:ltr { padding-right: 17px; } .show-processes-dialog-app-list-item-icon:rtl { padding-left: 17px; } .show-processes-dialog-app-list-item-name { font-size: 10pt; } .prompt-dialog { width: 500px; } .prompt-dialog-main-layout { spacing: 24px; padding: 10px; } .prompt-dialog-message-layout { spacing: 16px; } .prompt-dialog-headline { font-size: 12pt; font-weight: bold; color: #D3DAE3; } .prompt-dialog-descritption:rtl { text-align: right; } .prompt-dialog-password-box { spacing: 1em; padding-bottom: 1em; } .prompt-dialog-error-label { font-size: 9pt; color: #FC4138; padding-bottom: 8px; } .prompt-dialog-info-label { font-size: 9pt; padding-bottom: 8px; } .prompt-dialog-null-label { font-size: 9pt; padding-bottom: 8px; } .hidden { color: transparent; } .polkit-dialog-user-layout { padding-left: 10px; spacing: 10px; } .polkit-dialog-user-layout:rtl { padding-left: 0px; padding-right: 10px; } .polkit-dialog-user-root-label { color: #F27835; } .polkit-dialog-user-user-icon { border-radius: 2px; background-size: contain; width: 48px; height: 48px; } .network-dialog-secret-table { spacing-rows: 15px; spacing-columns: 1em; } .keyring-dialog-control-table { spacing-rows: 15px; spacing-columns: 1em; } .popup-menu { min-width: 200px; color: #D3DAE3; border-image: url("dark-assets/menu/menu.svg") 9 9 9 9; } .popup-menu .popup-sub-menu { background: none; box-shadow: none; background-gradient-direction: none !important; border-image: url("dark-assets/menu/submenu.svg") 9 9 9 9; } .popup-menu .popup-submenu-menu-item:open { color: #D3DAE3 !important; background: none !important; box-shadow: none; border-image: url("dark-assets/menu/submenu-open.svg") 9 9 9 9; } .popup-menu .popup-menu-content { padding: 1em 0em 1em 0em; } .popup-menu .popup-menu-item { spacing: 12px; } .popup-menu .popup-menu-item:ltr { padding: .4em 3em .4em 0em; } .popup-menu .popup-menu-item:rtl { padding: .4em 0em .4em 3em; } .popup-menu .popup-menu-item:active, .popup-menu .popup-menu-item.selected { color: #D3DAE3 !important; background-color: transparent; border-image: url("dark-assets/menu/menu-hover.svg") 9 9 1 1; } .popup-menu .popup-menu-item:insensitive { color: rgba(211, 218, 227, 0.5) !important; background: none; } .popup-menu .popup-inactive-menu-item { color: #D3DAE3; } .popup-menu .popup-inactive-menu-item:insensitive { color: rgba(211, 218, 227, 0.45); } .popup-menu .popup-status-menu-item, .popup-menu .popup-subtitle-menu-item { color: #D3DAE3 !important; } .popup-menu.panel-menu { -boxpointer-gap: 0px; margin-bottom: 1.75em; } .popup-menu-ornament { text-align: right; margin-left: 10px; width: 16px; } .popup-menu-boxpointer { -arrow-border-radius: 2px !important; -arrow-background-color: transparent !important; -arrow-border-width: 1px !important; -arrow-border-color: transparent !important; -arrow-base: 0 !important; -arrow-rise: 0 !important; color: #D3DAE3 !important; } .candidate-popup-boxpointer { -arrow-border-radius: 2px; -arrow-background-color: rgba(53, 57, 69, 0.95); -arrow-border-width: 1px; -arrow-border-color: rgba(0, 0, 0, 0.4); -arrow-base: 5; -arrow-rise: 5; } .popup-separator-menu-item { -gradient-height: 0px; height: 2px; margin: 10px 0px; background-color: transparent; background-gradient-direction: none !important; border: none; border-image: url("common-assets/menu/menu-separator.svg") 1 1 1 1; } .background-menu { -boxpointer-gap: 4px; -arrow-rise: 0px; } .osd-window { text-align: center; font-weight: bold; spacing: 1em; padding: 20px; margin: 32px; min-width: 64px; min-height: 64px; color: #ffffff; background: none; border: none; border-radius: 5px; border-image: url("common-assets/misc/osd.svg") 9 9 9 9; } .osd-window .osd-monitor-label { font-size: 3em; } .osd-window .level { padding: 0; height: 4px; background-color: rgba(0, 0, 0, 0.5); border-radius: 2px; color: #eb9605; } .resize-popup { color: #BAC3CF; background: none; border: none; border-radius: 5px; border-image: url("common-assets/misc/osd.svg") 9 9 9 9; padding: 12px; } .switcher-popup { padding: 8px; spacing: 16px; } .switcher-list { color: #BAC3CF; background: none; border: none; border-image: url("common-assets/misc/bg.svg") 9 9 9 9; border-radius: 3px; padding: 20px; } .switcher-list-item-container { spacing: 8px; } .switcher-list .item-box { padding: 8px; border-radius: 2px; } .switcher-list .item-box:outlined { padding: 8px; border: 1px solid #eb9605; } .switcher-list .item-box:selected { color: #ffffff; background-color: #eb9605; border: 1px solid #eb9605; } .switcher-list .thumbnail-box { padding: 2px; spacing: 4px; } .switcher-list .thumbnail { width: 256px; } .switcher-list .separator { width: 1px; background: rgba(211, 218, 227, 0.33); } .switcher-arrow { border-color: transparent; color: #BAC3CF; } .switcher-arrow:highlighted { color: #ffffff; } .input-source-switcher-symbol { font-size: 34pt; width: 96px; height: 96px; } .workspace-switcher { background: transparent; border: 0px; border-radius: 0px; padding: 0px; spacing: 8px; } .workspace-switcher-group { padding: 12px; } .workspace-switcher-container { border-image: url("common-assets/misc/bg.svg") 9 9 9 9; border-radius: 3px; padding: 20px; padding-bottom: 24px; } .ws-switcher-active-up, .ws-switcher-active-down { height: 30px; background-color: #eb9605; background-size: 96px; border-radius: 2px; border: 1px solid #eb9605; } .ws-switcher-active-up { background-image: url("common-assets/misc/ws-switch-arrow-up.png"); } .ws-switcher-active-down { background-image: url("common-assets/misc/ws-switch-arrow-down.png"); } .ws-switcher-box { height: 96px; background: rgba(0, 0, 0, 0.33); border: 1px solid rgba(0, 0, 0, 0.33); border-radius: 2px; } .tile-preview { background-color: rgba(82, 148, 226, 0.35); border: 1px solid #eb9605; } .tile-preview-left.on-primary { border-radius: 0px 0 0 0; } .tile-preview-right.on-primary { border-radius: 0 0px 0 0; } .tile-preview-left.tile-preview-right.on-primary { border-radius: 0px 0px 0 0; } #panel { font-weight: bold; height: 2.1em; min-height: 27px; background-color: transparent !important; background-gradient-direction: none !important; border-bottom: 0px !important; border-image: url("common-assets/panel/panel.svg") 1 1 1 1 !important; } #panel.dynamic-top-bar-white-btn { border-image: none; } #panel.unlock-screen, #panel.login-screen, #panel.lock-screen { background-color: transparent; border-image: none; } #panel:overview { border-image: url("common-assets/panel/panel-overview.svg") 1 1 1 1; } #panel #panelLeft, #panel #panelCenter { spacing: 8px; } #panel .panel-corner { -panel-corner-radius: 0px; -panel-corner-background-color: transparent; -panel-corner-border-width: 0px; -panel-corner-border-color: black; } #panel .panel-corner:active, #panel .panel-corner:overview, #panel .panel-corner:focus { -panel-corner-border-color: black; } #panel .panel-corner.lock-screen, #panel .panel-corner.login-screen, #panel .panel-cornerunlock-screen { -panel-corner-radius: 0; -panel-corner-background-color: transparent; -panel-corner-border-color: transparent; } #panel .panel-button { -natural-hpadding: 10px !important; -minimum-hpadding: 6px !important; font-weight: bold; color: #ffffff !important; transition-duration: 100ms; border-bottom-width: 1px; border-color: transparent; } #panel .panel-button #appMenuIcon { width: 0; height: 0; margin-left: 0px; margin-right: 0px; } #panel .panel-button:hover { color: #ffffff !important; background-color: rgba(0, 0, 0, 0.17); border-bottom-width: 1px; border-color: transparent; text-shadow: 0 0 transparent; } #panel .panel-button:active, #panel .panel-button:overview, #panel .panel-button:focus, #panel .panel-button:checked { color: #ffffff !important; background: #eb9605, url("common-assets/misc/null.svg"); border-image: none; box-shadow: none; border-bottom-width: 1px !important; border-color: black; text-shadow: 0 0 transparent; } #panel .panel-button:active > .system-status-icon, #panel .panel-button:overview > .system-status-icon, #panel .panel-button:focus > .system-status-icon, #panel .panel-button:checked > .system-status-icon { icon-shadow: none; } #panel .panel-button .system-status-icon { icon-size: 16px; padding: 0 4px; } .unlock-screen #panel .panel-button, .login-screen #panel .panel-button, .lock-screen #panel .panel-button { color: #f2f4f7; } .unlock-screen #panel .panel-button:focus, .unlock-screen #panel .panel-button:hover, .unlock-screen #panel .panel-button:active, .login-screen #panel .panel-button:focus, .login-screen #panel .panel-button:hover, .login-screen #panel .panel-button:active, .lock-screen #panel .panel-button:focus, .lock-screen #panel .panel-button:hover, .lock-screen #panel .panel-button:active { color: #f2f4f7; } #panel #panelActivities.panel-button { -natural-hpadding: 12px; } #panel .panel-status-indicators-box, #panel .panel-status-menu-box { spacing: 2px; } #panel .screencast-indicator { color: #FC4138; } #panel .clock-display > * > *:last-child { color: #eb9605; margin-left: .3em; } #panel .popup-menu-arrow { width: 0; } #panel #panelActivities.panel-button > * { background-image: url("common-assets/panel/activities.svg"); background-position: center top; width: 24px; height: 24px; background-color: transparent !important; background-gradient-direction: none !important; border: 0 solid transparent !important; text-shadow: 0 0 transparent !important; transition-duration: 0ms !important; box-shadow: none !important; color: transparent; } #panel #panelActivities.panel-button:active, #panel #panelActivities.panel-button:overview, #panel #panelActivities.panel-button:focus, #panel #panelActivities.panel-button:checked { background-color: transparent; box-shadow: none; border-bottom-width: 1px; border-color: transparent; } #panel #panelActivities.panel-button:active > *, #panel #panelActivities.panel-button:overview > *, #panel #panelActivities.panel-button:focus > *, #panel #panelActivities.panel-button:checked > * { background-image: url("common-assets/panel/activities-active.svg"); } .system-switch-user-submenu-icon { icon-size: 24px; border: 1px solid rgba(211, 218, 227, 0.4); } #appMenu { spinner-image: url("common-assets/misc/process-working.svg"); spacing: 4px; padding: 0 8px; } #appMenu .label-shadow { color: transparent !important; } .aggregate-menu { width: 360px; } .aggregate-menu .popup-menu-icon { padding: 0 4px; color: #D3DAE3 !important; } .system-menu-action { padding: 13px; color: #D3DAE3 !important; border-radius: 32px; /* wish we could do 50% */ border: 1px solid transparent !important; } .system-menu-action:hover, .system-menu-action:focus { transition-duration: 100ms; padding: 13px; color: #D3DAE3 !important; background-color: transparent !important; border: 1px solid #eb9605 !important; } .system-menu-action:active { color: #ffffff !important; background-color: #eb9605 !important; border: 1px solid #eb9605 !important; } .system-menu-action > StIcon { icon-size: 16px; } .calendar-vertical-separator { -stipple-width: 1px; -stipple-color: rgba(211, 218, 227, 0.4); width: 0.3em; } .calendar { padding: .4em 1.75em .8em 2.5em; } .calendar-month-label { color: #D3DAE3 !important; font-weight: bold; padding: 8px 0; } .calendar-change-month-back:hover, .calendar-change-month-back:focus, .calendar-change-month-back:active, .calendar-change-month-forward:hover, .calendar-change-month-forward:focus, .calendar-change-month-forward:active { background-color: transparent; } .calendar-change-month-back, .calendar-change-month-forward { width: 18px; height: 12px; border-radius: 4px; } .calendar-change-month-back { background-image: url("dark-assets/misc/calendar-arrow-left.svg"); } .calendar-change-month-back:focus, .calendar-change-month-back:hover { background-image: url("dark-assets/misc/calendar-arrow-left-hover.svg"); } .calendar-change-month-back:active { background-image: url("dark-assets/misc/calendar-arrow-left.svg"); } .calendar-change-month-back:rtl { background-image: url("dark-assets/misc/calendar-arrow-right.svg"); } .calendar-change-month-back:rtl:focus, .calendar-change-month-back:rtl:hover { background-image: url("dark-assets/misc/calendar-arrow-right-hover.svg"); } .calendar-change-month-back:rtl:active { background-image: url("dark-assets/misc/calendar-arrow-right.svg"); } .calendar-change-month-forward { background-image: url("dark-assets/misc/calendar-arrow-right.svg"); } .calendar-change-month-forward:focus, .calendar-change-month-forward:hover { background-image: url("dark-assets/misc/calendar-arrow-right-hover.svg"); } .calendar-change-month-forward:active { background-image: url("dark-assets/misc/calendar-arrow-right.svg"); } .calendar-change-month-forward:rtl { background-image: url("dark-assets/misc/calendar-arrow-left.svg"); } .calendar-change-month-forward:rtl:focus, .calendar-change-month-forward:rtl:hover { background-image: url("dark-assets/misc/calendar-arrow-left-hover.svg"); } .calendar-change-month-forward:rtl:active { background-image: url("dark-assets/misc/calendar-arrow-left.svg"); } .datemenu-date-label { padding: .4em 1.7em; font-weight: bold; text-align: center; color: #D3DAE3 !important; border-radius: 4px; } .calendar-day-base { font-size: 80%; text-align: center; width: 25px; height: 25px; padding: 0.1em; margin: 2px; border-radius: 12.5px; color: #D3DAE3 !important; } .calendar-day-base:hover, .calendar-day-base:focus { background-color: rgba(0, 0, 0, 0.1) !important; color: #D3DAE3 !important; } .calendar-day-base:active { color: #D3DAE3 !important; background-color: rgba(0, 0, 0, 0.15) !important; border-width: 0; } .calendar-day-base.calendar-day-heading { color: rgba(211, 218, 227, 0.85); margin-top: 1em; font-size: 70%; } .calendar-week-number { color: rgba(211, 218, 227, 0.5); font-weight: normal; } .calendar-day { border-width: 0; color: rgba(211, 218, 227, 0.8); } .calendar-day-top { border-top-width: 0; } .calendar-day-left { border-left-width: 0; } .calendar-nonwork-day { background-color: transparent; color: #D3DAE3 !important; font-weight: bold; } .calendar-today, .calendar-today:active, .calendar-today:focus, .calendar-today:hover { font-weight: bold; color: #ffffff !important; background: #eb9605, url("common-assets/misc/null.svg") !important; border-width: 0; } .calendar-day-with-events { color: #eb9605; font-weight: bold; } .calendar-today.calendar-day-with-events { color: #ffffff; } .calendar-other-month-day { color: rgba(211, 218, 227, 0.3); opacity: 1; } .events-table { width: 320px; spacing-columns: 6pt; padding: 0 1.4em; } .events-table:ltr { padding-right: 1.9em; } .events-table:rtl { padding-left: 1.9em; } .events-day-header { font-weight: bold; color: rgba(211, 218, 227, 0.8) !important; padding-left: 0.4em; padding-top: 1.2em; } .events-day-header:first-child { padding-top: 0; } .events-day-header:rtl { padding-left: 0; padding-right: 0.4em; } .events-day-dayname { color: rgba(211, 218, 227, 0.5) !important; text-align: left; min-width: 20px; } .events-day-dayname:rtl { text-align: right; } .events-day-time { color: rgba(211, 218, 227, 0.4) !important; text-align: right; } .events-day-time:rtl { text-align: left; } .events-day-task { color: #D3DAE3; padding-left: 8pt; } .events-day-task:rtl { padding-left: 0px; padding-right: 8pt; } .ripple-box { width: 52px; height: 52px; background-image: url("common-assets/misc/corner-ripple-ltr.svg"); background-size: contain; } .ripple-box:rtl { background-image: url("common-assets/misc/corner-ripple-rtl.svg"); } .popup-menu-arrow { width: 16px; height: 16px; } .popup-menu-icon { icon-size: 16px; } .window-close, .notification-close { background-image: url("common-assets/misc/close.svg"); background-size: 26px; height: 26px; width: 26px; } .window-close:hover, .notification-close:hover { background-image: url("common-assets/misc/close-hover.svg"); background-size: 26px; height: 26px; width: 26px; } .window-close:active, .notification-close:active { background-image: url("common-assets/misc/close-active.svg"); background-size: 26px; height: 26px; width: 26px; } .window-close { -shell-close-overlap: 11px; } .notification-close { -shell-close-overlap-x: 8px; -shell-close-overlap-y: -8px; } .notification-close:rtl { -shell-close-overlap-x: -8px; } .nm-dialog { max-height: 500px; min-height: 450px; min-width: 470px; } .nm-dialog-content { spacing: 20px; } .nm-dialog-header-hbox { spacing: 10px; } .nm-dialog-airplane-box { spacing: 12px; } .nm-dialog-airplane-headline { font-size: 1.1em; font-weight: bold; text-align: center; } .nm-dialog-airplane-text { color: #D3DAE3; } .nm-dialog-header-icon { icon-size: 32px; } .nm-dialog-scroll-view { border: 1px solid #2b2e39; border-radius: 2px; background-color: #404552; } .nm-dialog-header { font-weight: bold; font-size: 1.2em; } .nm-dialog-item { font-size: 1em; border-bottom: 0px solid; padding: 12px; spacing: 0px; } .nm-dialog-item:selected { background-color: #eb9605; color: #ffffff; } .nm-dialog-icons { spacing: .5em; } .nm-dialog-icon { icon-size: 16px; } .no-networks-label { color: rgba(211, 218, 227, 0.45); } .no-networks-box { spacing: 12px; } #overview { spacing: 24px; } .overview-controls { padding-bottom: 32px; } .window-picker { -horizontal-spacing: 32px; -vertical-spacing: 32px; padding-left: 32px; padding-right: 32px; padding-bottom: 48px; } .window-picker.external-monitor { padding: 32px; } .window-clone-border { border: 3px solid rgba(82, 148, 226, 0.8); border-radius: 4px; box-shadow: inset 0px 0px 0px 1px rgba(82, 148, 226, 0); } .window-caption, .window-caption:hover { spacing: 25px; color: #BAC3CF; background-color: rgba(0, 0, 0, 0.7); border-radius: 2px; padding: 4px 12px; -shell-caption-spacing: 12px; } .search-entry { width: 320px; padding: 7px 9px; border-radius: 20px; border: 1px solid rgba(0, 0, 0, 0.25); background-color: rgba(64, 69, 82, 0.9); } .search-entry:focus { padding: 7px 9px; } .search-entry .search-entry-icon { icon-size: 16px; padding: 0 4px; color: #D3DAE3; } .search-entry:hover, .search-entry:focus { color: #ffffff; caret-color: #ffffff; background-color: #eb9605; selection-background-color: #ffffff; selected-color: #eb9605; } .search-entry:hover .search-entry-icon, .search-entry:focus .search-entry-icon { color: #ffffff; } #searchResultsBin { max-width: 1000px; } #searchResultsContent { padding-left: 20px; padding-right: 20px; spacing: 16px; } .search-section { spacing: 16px; } .search-section-content { spacing: 32px; } .list-search-results { spacing: 3px; } .search-section-separator { background-color: rgba(255, 255, 255, 0.2); -margin-horizontal: 1.5em; height: 1px; } .list-search-result-content { spacing: 12px; padding: 12px; } .list-search-result-title { font-size: 1.5em; color: #ffffff; } .list-search-result-description { color: #cccccc; } .search-provider-icon { padding: 15px; } .search-provider-icon-more { width: 16px; height: 16px; background-image: url("common-assets/misc/more-results.svg"); } #dash { font-size: 1em; color: #BAC3CF; background-color: rgba(53, 57, 69, 0.95); border-color: rgba(0, 0, 0, 0.4); padding: 3px 0px 3px 0px; border-radius: 0 3px 3px 0; } #dash:rtl { border-radius: 3px 0 0 3px; } .right #dash, #dash:rtl { padding: 3px 0px 3px 0px; } .bottom #dash { padding: 0px 3px 0px 3px; } .top #dash { padding: 0px 3px 0px 3px; } #dash .placeholder { background-image: url("common-assets/dash/dash-placeholder.svg"); background-size: contain; height: 24px; } #dash .empty-dash-drop-target { width: 24px; height: 24px; } .dash-item-container > StWidget { padding: 2px 5px 2px 3px; } .right .dash-item-container > StWidget, .dash-item-container > StWidget:rtl { padding: 2px 3px 2px 5px; } .bottom .dash-item-container > StWidget { padding: 5px 2px 3px 2px; } .top .dash-item-container > StWidget { padding: 3px 2px 5px 2px; } .dash-label { border-radius: 3px; padding: 4px 12px; color: #ffffff; background-color: rgba(0, 0, 0, 0.7); text-align: center; -x-offset: 3px; } .bottom .dash-label, .top .dash-label { -y-offset: 3px; -x-offset: 0; } .dash-item-container > .app-well-app.running > .overview-icon, .dash-item-container > .app-well-app.running:hover > .overview-icon, .dash-item-container > .app-well-app.running:active > .overview-icon, .dash-item-container > .app-well-app > .overview-icon, .dash-item-container > .app-well-app:hover > .overview-icon, .dash-item-container > .app-well-app:active > .overview-icon { background-color: transparent !important; background-gradient-direction: none !important; border: none !important; border-radius: 0 !important; background: none !important; } #dash .app-well-app .overview-icon { padding: 10px; padding-left: 13px; } .right #dash .app-well-app .overview-icon, #dash:rtl .app-well-app .overview-icon { padding: 10px; padding-right: 13px; } .bottom #dash .app-well-app .overview-icon { padding: 10px; padding-bottom: 13px; } .top #dash .app-well-app .overview-icon { padding: 10px; padding-top: 13px; } #dash .app-well-app:hover .overview-icon { border-image: url("common-assets/dash/button-hover.svg") 5 5 5 5; } #dash .app-well-app:active .overview-icon { border-image: url("common-assets/dash/button-active.svg") 5 5 5 5; } #dash .app-well-app.running .overview-icon { border-image: url("common-assets/dash/button-running.svg") 5 5 5 5; } #dash .app-well-app.running:hover .overview-icon { border-image: url("common-assets/dash/button-running-hover.svg") 5 5 5 5; } #dash .app-well-app.running:active > .overview-icon { border-image: url("common-assets/dash/button-running-active.svg") 5 5 5 5; } .right #dash .app-well-app:hover .overview-icon, #dash:rtl .app-well-app:hover .overview-icon { border-image: url("common-assets/dash/button-hover-right.svg") 5 5 5 5; } .right #dash .app-well-app:active .overview-icon, #dash:rtl .app-well-app:active .overview-icon { border-image: url("common-assets/dash/button-active-right.svg") 5 5 5 5; } .right #dash .app-well-app.running .overview-icon, #dash:rtl .app-well-app.running .overview-icon { border-image: url("common-assets/dash/button-running-right.svg") 5 5 5 5; } .right #dash .app-well-app.running:hover .overview-icon, #dash:rtl .app-well-app.running:hover .overview-icon { border-image: url("common-assets/dash/button-running-hover-right.svg") 5 5 5 5; } .right #dash .app-well-app.running:active > .overview-icon, #dash:rtl .app-well-app.running:active > .overview-icon { border-image: url("common-assets/dash/button-running-active-right.svg") 5 5 5 5; } .bottom #dash .app-well-app:hover .overview-icon { border-image: url("common-assets/dash/button-hover-bottom.svg") 5 5 5 5; } .bottom #dash .app-well-app:active .overview-icon { border-image: url("common-assets/dash/button-active-bottom.svg") 5 5 5 5; } .bottom #dash .app-well-app.running .overview-icon { border-image: url("common-assets/dash/button-running-bottom.svg") 5 5 5 5; } .bottom #dash .app-well-app.running:hover .overview-icon { border-image: url("common-assets/dash/button-running-hover-bottom.svg") 5 5 5 5; } .bottom #dash .app-well-app.running:active > .overview-icon { border-image: url("common-assets/dash/button-running-active-bottom.svg") 5 5 5 5; } .top #dash .app-well-app:hover .overview-icon { border-image: url("common-assets/dash/button-hover-top.svg") 5 5 5 5; } .top #dash .app-well-app:active .overview-icon { border-image: url("common-assets/dash/button-active-top.svg") 5 5 5 5; } .top #dash .app-well-app.running .overview-icon { border-image: url("common-assets/dash/button-running-top.svg") 5 5 5 5; } .top #dash .app-well-app.running:hover .overview-icon { border-image: url("common-assets/dash/button-running-hover-top.svg") 5 5 5 5; } .top #dash .app-well-app.running:active > .overview-icon { border-image: url("common-assets/dash/button-running-active-top.svg") 5 5 5 5; } .show-apps .overview-icon { background-gradient-direction: none !important; padding: 11px; background-color: rgba(0, 0, 0, 0.5); border-radius: 2px; border: 0px solid; } .show-apps:hover .overview-icon { background-gradient-direction: none !important; background-color: rgba(0, 0, 0, 0.7); color: #eb9605; } .show-apps:active .overview-icon, .show-apps:active .show-apps-icon, .show-apps:checked .overview-icon, .show-apps:checked .show-apps-icon { background-gradient-direction: none !important; color: #ffffff; background-color: #eb9605; box-shadow: none; transition-duration: 0ms; } .icon-grid { spacing: 30px; -shell-grid-horizontal-item-size: 136px; -shell-grid-vertical-item-size: 136px; } .icon-grid .overview-icon { icon-size: 96px; } .app-view-controls { padding-bottom: 32px; } .app-view-control { padding: 4px 32px; background-gradient-direction: none; text-shadow: 0 1px rgba(64, 69, 82, 0); color: #BAC3CF; border: 1px solid rgba(0, 0, 0, 0.35); background-color: rgba(102, 109, 132, 0.35); } .app-view-control:hover { text-shadow: 0 1px rgba(64, 69, 82, 0); color: #BAC3CF; border: 1px solid rgba(0, 0, 0, 0.35); background-color: rgba(119, 127, 151, 0.45); } .app-view-control:checked { color: #ffffff; background-color: #eb9605; border-color: #eb9605; } .app-view-control:first-child:ltr, .app-view-control:last-child:rtl { border-radius: 2px 0 0 2px; border-right-width: 0; } .app-view-control:last-child:ltr, .app-view-control:first-child:rtl { border-radius: 0 2px 2px 0; border-left-width: 0; } .search-provider-icon:active, .search-provider-icon:checked, .list-search-result:active, .list-search-result:checked { background-color: rgba(31, 33, 40, 0.85); } .search-provider-icon:focus, .search-provider-icon:selected, .search-provider-icon:hover, .list-search-result:focus, .list-search-result:selected, .list-search-result:hover { background-color: rgba(186, 195, 207, 0.4); transition-duration: 200ms; } .app-well-app:active .overview-icon, .app-well-app:checked .overview-icon, .app-well-app.app-folder:active .overview-icon, .app-well-app.app-folder:checked .overview-icon, .grid-search-result:active .overview-icon, .grid-search-result:checked .overview-icon { background-color: rgba(31, 33, 40, 0.85); box-shadow: inset 0 0 #eb9605; } .app-well-app:hover .overview-icon, .app-well-app:focus .overview-icon, .app-well-app:selected .overview-icon, .app-well-app.app-folder:hover .overview-icon, .app-well-app.app-folder:focus .overview-icon, .app-well-app.app-folder:selected .overview-icon, .grid-search-result:hover .overview-icon, .grid-search-result:focus .overview-icon, .grid-search-result:selected .overview-icon { background-color: rgba(186, 195, 207, 0.4); transition-duration: 0ms; border-image: none; background-image: none; } .app-well-app.running > .overview-icon { background: none !important; text-shadow: black 0px 0px; border-image: url("common-assets/dash/button-running-bottom.svg") 5 5 5 5; } .app-well-app.running:hover > .overview-icon { border-image: url("common-assets/dash/button-running-hover-bottom.svg") 5 5 5 5; } .app-well-app.running:active > .overview-icon, .app-well-app.running:checked > .overview-icon { border-image: url("common-assets/dash/button-running-active-bottom.svg") 5 5 5 5; } .search-provider-icon, .list-search-result, .app-well-app .overview-icon, .app-well-app.app-folder .overview-icon, .grid-search-result .overview-icon { color: #ffffff; border-radius: 2px; padding: 6px; border: 1px solid transparent; transition-duration: 0ms; text-align: center; } .app-well-app.app-folder > .overview-icon { background-color: rgba(35, 38, 46, 0.95); border: 1px solid rgba(0, 0, 0, 0.45); } .app-well-app.app-folder:hover > .overview-icon { background-color: rgba(60, 64, 78, 0.95); } .app-well-app.app-folder:active > .overview-icon, .app-well-app.app-folder:checked > .overview-icon { background-color: #eb9605; box-shadow: none; } .app-well-app.app-folder:focus > .overview-icon { background-color: #eb9605; } .app-folder-popup { -arrow-border-radius: 2px; -arrow-background-color: rgba(35, 38, 46, 0.95); -arrow-border-color: rgba(0, 0, 0, 0.45); -arrow-border-width: 1px; -arrow-base: 5; -arrow-rise: 5; } .app-folder-popup-bin { padding: 5px; } .app-folder-icon { padding: 5px; spacing-rows: 5px; spacing-columns: 5px; } .page-indicator { padding: 15px 20px; } .page-indicator .page-indicator-icon { width: 18px; height: 18px; background-image: url(common-assets/misc/page-indicator-inactive.svg); } .page-indicator:hover .page-indicator-icon { background-image: url(common-assets/misc/page-indicator-hover.svg); } .page-indicator:active .page-indicator-icon { background-image: url(common-assets/misc/page-indicator-active.svg); } .page-indicator:checked .page-indicator-icon, .page-indicator:checked:active { background-image: url(common-assets/misc/page-indicator-checked.svg); } .app-well-app > .overview-icon.overview-icon-with-label, .grid-search-result .overview-icon.overview-icon-with-label { padding: 10px 8px 5px 8px; spacing: 4px; } .workspace-thumbnails { visible-width: 40px; spacing: 11px; padding: 12px; padding-right: 7px; border-image: url("common-assets/dash/dash-right.svg") 9 9 9 9; } .workspace-thumbnails:rtl { padding: 12px; padding-left: 7px; border-image: url("common-assets/dash/dash-left.svg") 9 9 9 9; } .workspace-thumbnail-indicator { border: 4px solid rgba(82, 148, 226, 0.8); border-radius: 1px; padding: 1px; } .search-display > StBoxLayout, .all-apps, .frequent-apps > StBoxLayout { padding: 0px 88px 10px 88px; } .search-statustext, .no-frequent-applications-label { font-size: 2em; font-weight: bold; color: #D3DAE3; } #message-tray { background: #353945; background-repeat: repeat; height: 72px; border: solid rgba(0, 0, 0, 0.6); border-width: 0; border-top-width: 1px; } .message-tray-summary { height: 72px; } .message-tray-menu-button StIcon { padding: 0 20px; color: rgba(186, 195, 207, 0.6); icon-size: 24px; } .message-tray-menu-button:hover StIcon, .message-tray-menu-button:active StIcon, .message-tray-menu-button:focus StIcon { color: #BAC3CF; } .no-messages-label { color: rgba(186, 195, 207, 0.5); } .summary-boxpointer { -arrow-border-radius: 3px; -arrow-background-color: transparent; -arrow-base: 0; -arrow-rise: 0; -boxpointer-gap: 0; color: #D3DAE3; border-image: url("common-assets/misc/bg.svg") 9 9 9 9; padding: 7px; } .summary-boxpointer .notification { border-radius: 3px; background: none !important; border-image: none; padding-bottom: 12px; } .summary-boxpointer #summary-right-click-menu { color: #BAC3CF; padding-top: 12px; padding-bottom: 12px; } .summary-boxpointer #summary-right-click-menu .popup-menu-item:active { color: #ffffff; background-color: #eb9605; } .summary-boxpointer-stack-scrollview { max-height: 18em; padding-top: 8px; padding-bottom: 8px; } .summary-boxpointer-stack-scrollview:ltr { padding-right: 8px; } .summary-boxpointer-stack-scrollview:rtl { padding-left: 8px; } .summary-source { border-radius: 4px; padding: 0 6px 0 6px; transition-duration: 100ms; } .summary-source-counter { background-image: url("common-assets/misc/summary-counter.svg"); background-size: 26px; color: #ffffff; font-size: 10pt; font-weight: bold; height: 2.4em; width: 2.4em; -shell-counter-overlap-x: 8px; -shell-counter-overlap-y: 8px; } .summary-source-button { border-radius: 2px; padding: 6px 3px 6px 3px; } .summary-source-button:last-child:ltr { padding-right: 6px; } .summary-source-button:last-child:rtl { padding-left: 6px; } .summary-source-button .summary-source { text-shadow: 0 1px rgba(64, 69, 82, 0); color: #BAC3CF; border: 1px solid rgba(0, 0, 0, 0.35); background-color: rgba(102, 109, 132, 0.35); } .summary-source-button:hover .summary-source { text-shadow: 0 1px rgba(64, 69, 82, 0); color: #BAC3CF; border: 1px solid rgba(0, 0, 0, 0.35); background-color: rgba(119, 127, 151, 0.45); } .summary-source-button:focus .summary-source, .summary-source-button:selected .summary-source { text-shadow: 0 1px rgba(64, 69, 82, 0); color: #ffffff; border: 1px solid #eb9605; background-color: #eb9605; } .url-highlighter { link-color: #a9caf1; } .notification, #notification-container { width: 34em; } .notification { font-size: 1em; color: #BAC3CF; padding: 12px 12px 12px 12px; spacing-rows: 4px; spacing-columns: 10px; border-image: url("common-assets/misc/notification.svg") 9 9 9 9; } .notification.multi-line-notification { padding-bottom: 12px; } .notification-unexpanded { min-height: 40px; height: 40px; } .notification-with-image { min-height: 159px; } .notification-scrollview { max-height: 10em; -st-vfade-offset: 0px; } .notification-scrollview:ltr > StScrollBar { padding-left: 6px; } .notification-scrollview:rtl > StScrollBar { padding-right: 6px; } .notification-body { spacing: 5px; } .notification-actions { padding-top: 12px; spacing: 10px; } .notification-button { -st-natural-width: 140px; padding: 4px 4px 5px; background-gradient-direction: none; } .notification-button:focus { -st-natural-width: 140px; padding: 4px 4px 5px; } .notification-icon-button { border-radius: 5px; padding: 5px; background-gradient-direction: none; } .notification-icon-button:focus { padding: 5px; } .notification-icon-button > StIcon { icon-size: 16px; padding: 8px; } .notification StEntry { padding: 7px; caret-color: #BAC3CF; color: #BAC3CF; background-color: rgba(102, 109, 132, 0.35); border: 1px solid rgba(26, 28, 34, 0.35); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05); } .notification StEntry:focus { color: #ffffff; background-color: #eb9605; border: 1px solid #eb9605; box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05); } .secondary-icon { icon-size: 1.09em; } .chat-body { spacing: 5px; } .chat-response { margin: 5px; } .chat-log-message { color: #BAC3CF; } .chat-new-group { padding-top: 1em; } .chat-received { padding-left: 4px; } .chat-received:rtl { padding-left: 0px; padding-right: 4px; } StEntry.chat-response { padding: 7px; color: #BAC3CF; background-color: rgba(102, 109, 132, 0.35); border: 1px solid rgba(26, 28, 34, 0.35); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05); } StEntry.chat-response:focus { color: #ffffff; background-color: #eb9605; border: 1px solid #eb9605; box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05); } .chat-sent { padding-left: 18pt; color: #eb9605; } .chat-sent:rtl { padding-left: 0; padding-right: 18pt; } .chat-meta-message { padding-left: 4px; font-size: 9pt; font-weight: bold; color: rgba(186, 195, 207, 0.6); } .chat-meta-message:rtl { padding-left: 0; padding-right: 4px; } .subscription-message { font-style: italic; } .hotplug-transient-box { spacing: 6px; padding: 2px 72px 2px 12px; } .hotplug-notification-item { padding: 2px 10px; } .hotplug-notification-item:focus { padding: 2px 10px; } .hotplug-notification-item-icon { icon-size: 24px; padding: 2px 5px; } .hotplug-resident-box { spacing: 8px; } .hotplug-resident-mount { spacing: 8px; border-radius: 2px 0 0 2px; background-gradient-direction: none; } .hotplug-resident-mount-label { color: inherit; padding-left: 6px; } .hotplug-resident-mount-icon { icon-size: 24px; padding-left: 6px; } .hotplug-resident-eject-icon { icon-size: 16px; } .hotplug-resident-eject-button { padding: 7px; border-radius: 0 2px 2px 0; color: #BAC3CF; border-left: none; } .magnifier-zoom-region { border: 2px solid #eb9605; } .magnifier-zoom-region.full-screen { border-width: 0; } #keyboard { background-color: rgba(53, 57, 69, 0.95); border-width: 0; border-top-width: 1px; border-color: rgba(0, 0, 0, 0.2); } .keyboard-layout { spacing: 10px; padding: 10px; } .keyboard-row { spacing: 15px; } .keyboard-key { min-height: 2em; min-width: 2em; font-size: 14pt; font-weight: bold; border-radius: 3px; box-shadow: none; background-gradient-direction: none; text-shadow: 0 1px rgba(64, 69, 82, 0); color: #BAC3CF; border: 1px solid rgba(0, 0, 0, 0.35); background-color: rgba(102, 109, 132, 0.35); } .keyboard-key:hover { text-shadow: 0 1px rgba(64, 69, 82, 0); color: #BAC3CF; border: 1px solid rgba(0, 0, 0, 0.35); background-color: rgba(119, 127, 151, 0.45); } .keyboard-key:active, .keyboard-key:checked { text-shadow: 0 1px rgba(64, 69, 82, 0); color: #ffffff; border: 1px solid #eb9605; background-color: #eb9605; } .keyboard-key:grayed { text-shadow: 0 1px rgba(64, 69, 82, 0); color: #5d626e; border: 1px solid rgba(0, 0, 0, 0.35); background-color: rgba(102, 109, 132, 0.2); } .keyboard-subkeys { color: #BAC3CF; padding: 5px; -arrow-border-radius: 2px; -arrow-background-color: rgba(53, 57, 69, 0.95); -arrow-border-width: 1px; -arrow-border-color: rgba(0, 0, 0, 0.4); -arrow-base: 20px; -arrow-rise: 10px; -boxpointer-gap: 5px; } .candidate-popup-content { padding: 0.5em; spacing: 0.3em; color: #BAC3CF; font-size: 1.15em; } .candidate-index { padding: 0 0.5em 0 0; color: #d8dde4; } .candidate-box { padding: 0.3em 0.5em 0.3em 0.5em; border-radius: 2px; color: #BAC3CF; } .candidate-box:selected, .candidate-box:hover { background-color: #eb9605; color: #ffffff; } .candidate-page-button-box { height: 2em; } .vertical .candidate-page-button-box { padding-top: 0.5em; } .horizontal .candidate-page-button-box { padding-left: 0.5em; } .candidate-page-button { padding: 4px; } .candidate-page-button-previous { border-radius: 2px 0px 0px 2px; border-right-width: 0; } .candidate-page-button-next { border-radius: 0px 2px 2px 0px; } .candidate-page-button-icon { icon-size: 1em; } .framed-user-icon { background-size: contain; border: 0px solid transparent; color: #D3DAE3; border-radius: 2px; } .framed-user-icon:hover { border-color: transparent; color: white; } .login-dialog-banner-view { padding-top: 24px; max-width: 23em; } .login-dialog { border: none; background-color: transparent; } .login-dialog .modal-dialog-button-box { spacing: 3px; } .login-dialog .modal-dialog-button { padding: 3px 18px; } .login-dialog .modal-dialog-button:default { text-shadow: 0 1px rgba(64, 69, 82, 0); color: #D3DAE3; background-color: #444a58; border: 1px solid #2b2e39; box-shadow: inset 0 2px 4px rgba(68, 74, 88, 0.05); } .login-dialog .modal-dialog-button:default:hover, .login-dialog .modal-dialog-button:default:focus { text-shadow: 0 1px rgba(64, 69, 82, 0); color: #D3DAE3; background-color: #505666; border: 1px solid #2b2e39; box-shadow: inset 0 2px 4px rgba(80, 86, 102, 0.05); } .login-dialog .modal-dialog-button:default:active { text-shadow: 0 1px rgba(64, 69, 82, 0); color: #ffffff; background-color: #eb9605; border: 1px solid #eb9605; box-shadow: inset 0 1px rgba(82, 148, 226, 0.05); } .login-dialog .modal-dialog-button:default:insensitive { text-shadow: 0 1px rgba(64, 69, 82, 0); color: rgba(211, 218, 227, 0.45); border: 1px solid rgba(43, 46, 57, 0.55); background-color: rgba(68, 74, 88, 0.55); box-shadow: inset 0 2px 4px rgba(68, 74, 88, 0.05); } .login-dialog-logo-bin { padding: 24px 0px; } .login-dialog-banner { color: #9ca9ba; } .login-dialog-button-box { spacing: 5px; } .login-dialog-message-warning { color: #F27835; } .login-dialog-message-hint { padding-top: 0; padding-bottom: 20px; } .login-dialog-user-selection-box { padding: 100px 0px; } .login-dialog-user-selection-box .login-dialog-not-listed-label { padding-left: 2px; } .login-dialog-not-listed-button:focus .login-dialog-user-selection-box .login-dialog-not-listed-label, .login-dialog-not-listed-button:hover .login-dialog-user-selection-box .login-dialog-not-listed-label { color: #BAC3CF; } .login-dialog-not-listed-label { font-size: 90%; font-weight: bold; color: #62758e; padding-top: 1em; } .login-dialog-user-list-view { -st-vfade-offset: 1em; } .login-dialog-user-list { spacing: 12px; padding: .2em; width: 23em; } .login-dialog-user-list:expanded .login-dialog-user-list-item:focus { background-color: #eb9605; color: #ffffff; } .login-dialog-user-list:expanded .login-dialog-user-list-item:logged-in { border-right: 2px solid #eb9605; } .login-dialog-user-list-item { border-radius: 5px; padding: .2em; color: #62758e; } .login-dialog-user-list-item:ltr { padding-right: 1em; } .login-dialog-user-list-item:rtl { padding-left: 1em; } .login-dialog-user-list-item:hover { background-color: #eb9605; color: #ffffff; } .login-dialog-user-list-item .login-dialog-timed-login-indicator { height: 2px; margin: 2px 0 0 0; background-color: #BAC3CF; } .login-dialog-user-list-item:focus .login-dialog-timed-login-indicator { background-color: #ffffff; } .login-dialog-username, .user-widget-label { color: #BAC3CF; font-size: 120%; font-weight: bold; text-align: left; padding-left: 15px; } .user-widget-label:ltr { padding-left: 18px; } .user-widget-label:rtl { padding-right: 18px; } .login-dialog-prompt-layout { padding-top: 24px; padding-bottom: 12px; spacing: 8px; width: 23em; } .login-dialog-prompt-label { color: #7e8fa5; font-size: 110%; padding-top: 1em; } .login-dialog-session-list-button StIcon { icon-size: 1.25em; } .login-dialog-session-list-button { color: #62758e; } .login-dialog-session-list-button:hover, .login-dialog-session-list-button:focus { color: #BAC3CF; } .login-dialog-session-list-button:active { color: #394351; } .screen-shield-arrows { padding-bottom: 3em; } .screen-shield-arrows Gjs_Arrow { color: white; width: 80px; height: 48px; -arrow-thickness: 12px; -arrow-shadow: 0 1px 1px rgba(0, 0, 0, 0.4); } .screen-shield-clock { color: white; text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.6); font-weight: bold; text-align: center; padding-bottom: 1.5em; } .screen-shield-clock-time { font-size: 72pt; text-shadow: 0px 2px 2px rgba(0, 0, 0, 0.4); } .screen-shield-clock-date { font-size: 28pt; } .screen-shield-notifications-container { spacing: 6px; width: 30em; background-color: transparent; max-height: 500px; } .screen-shield-notifications-container .summary-notification-stack-scrollview { padding-top: 0; padding-bottom: 0; } .screen-shield-notifications-container .notification, .screen-shield-notifications-container .screen-shield-notification-source { padding: 12px 6px; border: 1px solid rgba(186, 195, 207, 0.2); background-color: rgba(53, 57, 69, 0.45); color: #BAC3CF; border-radius: 4px; } .screen-shield-notifications-container .notification { margin-right: 15px; } .screen-shield-notification-label { font-weight: bold; padding: 0px 0px 0px 12px; } .screen-shield-notification-count-text { padding: 0px 0px 0px 12px; } #panel.lock-screen { background-color: rgba(53, 57, 69, 0.5); } .screen-shield-background { background: black; box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.4); } #lockDialogGroup { background: #2e3436 url(misc/noise-texture.png); background-repeat: repeat; } #screenShieldNotifications StButton#vhandle, #screenShieldNotifications StButton#hhandle { background-color: rgba(56, 60, 74, 0.3); } #screenShieldNotifications StButton#vhandle:hover, #screenShieldNotifications StButton#vhandle:focus, #screenShieldNotifications StButton#hhandle:hover, #screenShieldNotifications StButton#hhandle:focus { background-color: rgba(56, 60, 74, 0.5); } #screenShieldNotifications StButton#vhandle:active, #screenShieldNotifications StButton#hhandle:active { background-color: rgba(82, 148, 226, 0.5); } #LookingGlassDialog { spacing: 4px; padding: 8px 8px 10px 8px; background-color: rgba(0, 0, 0, 0.7); border: 1px solid black; border-image: url("common-assets/misc/bg.svg") 9 9 9 9; border-radius: 2px; color: #BAC3CF; } #LookingGlassDialog > #Toolbar { padding: 3px; border: none; background-color: transparent; border-radius: 0px; } #LookingGlassDialog .labels { spacing: 4px; } #LookingGlassDialog .notebook-tab { -natural-hpadding: 12px; -minimum-hpadding: 6px; font-weight: bold; color: #BAC3CF; transition-duration: 100ms; padding-left: .3em; padding-right: .3em; } #LookingGlassDialog .notebook-tab:hover { color: #ffffff; text-shadow: black 0px 2px 2px; } #LookingGlassDialog .notebook-tab:selected { border-bottom-width: 0px; color: #eb9605; text-shadow: black 0px 2px 2px; } #LookingGlassDialog StBoxLayout#EvalBox { padding: 4px; spacing: 4px; } #LookingGlassDialog StBoxLayout#ResultsArea { spacing: 4px; } .lg-dialog StEntry { selection-background-color: #eb9605; selected-color: #ffffff; color: #BAC3CF; background-color: rgba(102, 109, 132, 0.35); border: 1px solid rgba(26, 28, 34, 0.35); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05); } .lg-dialog StEntry:focus { color: #ffffff; background-color: #eb9605; border: 1px solid #eb9605; box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05); } .lg-dialog .shell-link { color: #a9caf1; } .lg-dialog .shell-link:hover { color: #d5e5f8; } .lg-completions-text { font-size: .9em; font-style: italic; } .lg-obj-inspector-title { spacing: 4px; } .lg-obj-inspector-button { border: 1px solid gray; padding: 4px; border-radius: 4px; } .lg-obj-inspector-button:hover { border: 1px solid #ffffff; } #lookingGlassExtensions { padding: 4px; } .lg-extensions-list { padding: 4px; spacing: 6px; } .lg-extension { border: 1px solid rgba(0, 0, 0, 0.7); border-radius: 2px; background-color: rgba(53, 57, 69, 0.95); padding: 4px; } .lg-extension-name { font-weight: bold; } .lg-extension-meta { spacing: 6px; } #LookingGlassPropertyInspector { background: rgba(0, 0, 0, 0.7); border: 1px solid grey; border-radius: 2px; padding: 6px; }
eti1337/arc-theme-orange
common/gnome-shell/3.14/gnome-shell-dark.css
CSS
gpl-3.0
60,923
<?php require_once './criscomp.notificacao.class.php'; // Exibir apena texto (new criscomp_notify('cristiano'))->enviarNotificacao("Criscomp exemplo", "Exemplo para exibir notificação"); // Exibir com icone, texto //(new criscomp_notify('cristiano'))->enviarNotificacao("Criscomp exemplo", "Exemplo para exibir notificação", "info"); // Exibir com icone, texto e dura 5 segundos para desaparece //(new criscomp_notify('cristiano'))->enviarNotificacao("Criscomp exemplo", "Exemplo para exibir notificação", "info", 5000); // Modo script simples $notify = new criscomp_notify('cristiano'); $notify->enviarNotificacao("Criscomp exemplo", "Exemplo para exibir notificação");
criscompbr/class_notify_send
index.php
PHP
gpl-3.0
683
import shesha.config as conf simul_name = "bench_scao_sh_16x16_8pix" layout = "layoutDeFab_SH" # loop p_loop = conf.Param_loop() p_loop.set_niter(1000) p_loop.set_ittime(0.002) # =1/500 # geom p_geom = conf.Param_geom() p_geom.set_zenithangle(0.) # tel p_tel = conf.Param_tel() p_tel.set_diam(4.0) p_tel.set_cobs(0.2) # atmos p_atmos = conf.Param_atmos() p_atmos.set_r0(0.16) p_atmos.set_nscreens(1) p_atmos.set_frac([1.0]) p_atmos.set_alt([0.0]) p_atmos.set_windspeed([10.]) p_atmos.set_winddir([45.]) p_atmos.set_L0([1.e5]) # target p_target = conf.Param_target() p_targets = [p_target] # p_target.set_ntargets(1) p_target.set_xpos(0.) p_target.set_ypos(0.) p_target.set_Lambda(1.65) p_target.set_mag(10.) # wfs p_wfs0 = conf.Param_wfs(roket=True) p_wfss = [p_wfs0] p_wfs0.set_type("sh") p_wfs0.set_nxsub(8) p_wfs0.set_npix(8) p_wfs0.set_pixsize(0.3) p_wfs0.set_fracsub(0.8) p_wfs0.set_xpos(0.) p_wfs0.set_ypos(0.) p_wfs0.set_Lambda(0.5) p_wfs0.set_gsmag(8.) p_wfs0.set_optthroughput(0.5) p_wfs0.set_zerop(1.e11) p_wfs0.set_noise(3.) p_wfs0.set_atmos_seen(1) # lgs parameters # p_wfs0.set_gsalt(90*1.e3) # p_wfs0.set_lltx(0) # p_wfs0.set_llty(0) # p_wfs0.set_laserpower(10) # p_wfs0.set_lgsreturnperwatt(1.e3) # p_wfs0.set_proftype("Exp") # p_wfs0.set_beamsize(0.8) # dm p_dm0 = conf.Param_dm() p_dm1 = conf.Param_dm() p_dms = [p_dm0, p_dm1] p_dm0.set_type("pzt") p_dm0.set_file_influ_fits("test_custom_dm.fits") p_dm0.set_alt(0.) p_dm0.set_thresh(0.3) p_dm0.set_unitpervolt(0.01) p_dm0.set_push4imat(100.) p_dm0.set_diam_dm_proj(4.1) p_dm1.set_type("tt") p_dm1.set_alt(0.) p_dm1.set_unitpervolt(0.0005) p_dm1.set_push4imat(10.) # centroiders p_centroider0 = conf.Param_centroider() p_centroiders = [p_centroider0] p_centroider0.set_nwfs(0) p_centroider0.set_type("cog") # p_centroider0.set_type("corr") # p_centroider0.set_type_fct("model") # controllers p_controller0 = conf.Param_controller() p_controllers = [p_controller0] p_controller0.set_type("ls") p_controller0.set_nwfs([0]) p_controller0.set_ndm([0, 1]) p_controller0.set_maxcond(1500.) p_controller0.set_delay(1.) p_controller0.set_gain(0.4) p_controller0.set_modopti(0) p_controller0.set_nrec(2048) p_controller0.set_nmodes(216) p_controller0.set_gmin(0.001) p_controller0.set_gmax(0.5) p_controller0.set_ngain(500)
ANR-COMPASS/shesha
data/par/par4tests/test_custom_dm_diam_dm_proj.py
Python
gpl-3.0
2,303
/******************************************************************************* moPostEffectDebug.h **************************************************************************** * * * This source is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This code is distributed in the hope that it will be useful, but * * WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * * General Public License for more details. * * * * A copy of the GNU General Public License is available on the World * * Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also * * obtain it by writing to the Free Software Foundation, * * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * * **************************************************************************** Copyright(C) 2006 Fabricio Costa Authors: Fabricio Costa Andrés Colubri *******************************************************************************/ #ifndef __MO_POST_EFFECT_DEBUG_H__ #define __MO_POST_EFFECT_DEBUG_H__ #include "moPostPlugin.h" enum moDebugParamIndex { DEBUG_ALPHA, DEBUG_COLOR, DEBUG_SYNC, DEBUG_PHASE, DEBUG_FONT, DEBUG_INLET, DEBUG_OUTLET }; class moPostEffectDebug : public moPostEffect { public: //config MOint color; MOint font; moTextArray textevents; MOuint ticks, ticksprevious, tickselapsed; MOdouble fps_current, fps_mean; MOint fps_count; moText fps_text; moPostEffectDebug(); virtual ~moPostEffectDebug(); MOboolean Init(); void Draw( moTempo*, moEffectState* parentstate = NULL); void Update( moEventList* p_EventList ); MOboolean Finish(); moConfigDefinition *GetDefinition( moConfigDefinition *p_configdefinition ); }; class moPostEffectDebugFactory : public moPostEffectFactory { public: moPostEffectDebugFactory() {} virtual ~moPostEffectDebugFactory() {} moPostEffect* Create(); void Destroy(moPostEffect* fx); }; extern "C" { MO_PLG_API moPostEffectFactory* CreatePostEffectFactory(); MO_PLG_API void DestroyPostEffectFactory(); } #endif
inaes-tic/tv-moldeo
plugins/PostEffects/Debug/inc/moPostEffectDebug.h
C
gpl-3.0
2,835
using System; using invertika_game.Game; using ISL.Server.Utilities; using System.Collections.Generic; using ISL.Server.Common; namespace invertika_game { public class TriggerArea: Thing { Rectangle mZone; TriggerAction mAction; bool mOnce; List<Actor> mInside; /** * Creates a rectangular trigger for a given map. */ public TriggerArea(MapComposite m, Rectangle r, TriggerAction ptr, bool once): base(ThingType.OBJECT_OTHER, m) { mZone=r; mAction=ptr; mOnce=once; } public void update() { //TODO Implementieren // std::set<Actor*> insideNow; // for (BeingIterator i(getMap()->getInsideRectangleIterator(mZone)); i; ++i) // { // // Don't deal with unitialized actors. // if (!(*i) || !(*i)->isPublicIdValid()) // continue; // // // The BeingIterator returns the mapZones in touch with the rectangle // // area. On the other hand, the beings contained in the map zones // // may not be within the rectangle area. Hence, this additional // // contains() condition. // if (mZone.contains((*i)->getPosition())) // { // insideNow.insert(*i); // // if (!mOnce || mInside.find(*i) == mInside.end()) // { // mAction->process(*i); // } // } // } // // mInside.swap(insideNow); //swapping is faster than assigning } } }
Invertika/server
invertika-game/Game/TriggerArea.cs
C#
gpl-3.0
1,740