repo_name
stringlengths
4
116
path
stringlengths
4
379
size
stringlengths
1
7
content
stringlengths
3
1.05M
license
stringclasses
15 values
espertechinc/nesper
src/NEsper.Runtime/client/scopetest/SupportSubscriberMRD.cs
3579
/////////////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2006-2019 Esper Team. All rights reserved. / // http://esper.codehaus.org / // ---------------------------------------------------------------------------------- / // The software in this package is published under the terms of the GPL license / // a copy of which has been included with this distribution in the license.txt file. / /////////////////////////////////////////////////////////////////////////////////////// using System.Collections.Generic; namespace com.espertech.esper.runtime.client.scopetest { /// <summary>EPSubscriber for multi-row delivery that retains the events it receives for use in assertions. </summary> public class SupportSubscriberMRD { private readonly List<object[][]> _insertStreamList = new List<object[][]>(); private readonly List<object[][]> _removeStreamList = new List<object[][]>(); private bool _isInvoked; /// <summary> /// Receive multi-row subscriber data through this methods. /// </summary> /// <param name="insertStream">new data</param> /// <param name="removeStream">removed data</param> public void Update(object[][] insertStream, object[][] removeStream) { lock (this) { _isInvoked = true; _insertStreamList.Add(insertStream); _removeStreamList.Add(insertStream); } } /// <summary> /// Returns all insert-stream events received so far. /// <para/> /// The list contains an item for each delivery. Each item contains a row with the event and each event is itself a tuple (object array). /// </summary> /// <value>list of Object array-array</value> public IList<object[][]> InsertStreamList { get { return _insertStreamList; } } /// <summary> /// Returns all removed-stream events received so far. /// <para/> /// The list contains an item for each delivery. Each item contains a row with the event and each event is itself a tuple (object array). /// </summary> /// <value>list of Object array-array</value> public IList<object[][]> RemoveStreamList { get { return _removeStreamList; } } /// <summary> /// Reset subscriber, clearing all associated state. /// </summary> public void Reset() { lock (this) { _isInvoked = false; _insertStreamList.Clear(); _removeStreamList.Clear(); } } /// <summary> /// Returns true if the subscriber was invoked at least once. /// </summary> /// <returns>invoked flag</returns> public bool IsInvoked() { return _isInvoked; } /// <summary> /// Returns true if the subscriber was invoked at least once and clears the invocation flag. /// </summary> /// <returns>invoked flag</returns> public bool GetAndClearIsInvoked() { lock (this) { bool invoked = _isInvoked; _isInvoked = false; return invoked; } } } }
gpl-2.0
robksawyer/preciousplasticwiki
extensions/EmbedVideo/EmbedVideo.hooks.php
10215
<?php /** * EmbedVideo * EmbedVideo Hooks * * @license MIT * @package EmbedVideo * @link https://www.mediawiki.org/wiki/Extension:EmbedVideo * **/ class EmbedVideoHooks { /** * Temporary storage for the current service object. * * @var object */ static private $service; /** * Description Parameter * * @var string */ static private $description = false; /** * Alignment Parameter * * @var string */ static private $alignment = false; /** * Container Parameter * * @var string */ static private $container = false; /** * Hook to setup defaults. */ public static function onExtension() { global $wgEmbedVideoDefaultWidth; if ( !isset($wgEmbedVideoDefaultWidth) && (isset($_SERVER['HTTP_X_MOBILE']) && $_SERVER['HTTP_X_MOBILE'] == 'true') && $_COOKIE['stopMobileRedirect'] != 1 ) { //Set a smaller default width when in mobile view. $wgEmbedVideoDefaultWidth = 320; } } /** * Valid Arguments for the parseEV function hook. * * @var string */ static private $validArguments = [ 'service' => null, 'id' => null, 'dimensions' => null, 'alignment' => null, 'description' => null, 'container' => null, 'urlargs' => null, 'autoresize' => null ]; /** * Sets up this extension's parser functions. * * @access public * @param object Parser object passed as a reference. * @return boolean true */ static public function onParserFirstCallInit( Parser &$parser ) { $parser->setFunctionHook( "ev", "EmbedVideoHooks::parseEV" ); $parser->setFunctionHook( "evt", "EmbedVideoHooks::parseEVT" ); $parser->setFunctionHook( "evp", "EmbedVideoHooks::parseEVP" ); $parser->setHook( "embedvideo", "EmbedVideoHooks::parseEVTag" ); return true; } /** * Adapter to call the new style tag. * * @access public * @param object Parser * @return string Error Message */ static public function parseEVP( $parser ) { wfDeprecated( __METHOD__, '2.0', 'EmbedVideo' ); return self::error( 'evp_deprecated' ); } /** * Adapter to call the EV parser tag with template like calls. * * @access public * @param object Parser * @return string Error Message */ static public function parseEVT( $parser ) { $arguments = func_get_args(); array_shift( $arguments ); foreach ( $arguments as $argumentPair ) { $argumentPair = trim( $argumentPair ); if ( !strpos( $argumentPair, '=' ) ) { continue; } list( $key, $value ) = explode( '=', $argumentPair, 2 ); if (!array_key_exists($key, self::$validArguments)) { continue; } $args[$key] = $value; } $args = array_merge( self::$validArguments, $args ); return self::parseEV( $parser, $args['service'], $args['id'], $args['dimensions'], $args['alignment'], $args['description'], $args['container'], $args['urlargs'], $args['autoresize'] ); } /** * Adapter to call the parser hook. * * @access public * @param string Raw User Input * @param array Arguments on the tag. * @param object Parser object. * @param object PPFrame object. * @return string Error Message */ static public function parseEVTag( $input, array $args, Parser $parser, PPFrame $frame ) { $args = array_merge( self::$validArguments, $args ); return self::parseEV( $parser, $args['service'], $input, $args['dimensions'], $args['alignment'], $args['description'], $args['container'], $args['urlargs'], $args['autoresize'] ); } /** * Embeds a video of the chosen service. * * @access public * @param object Parser * @param string [Optional] Which online service has the video. * @param string [Optional] Identifier Code or URL for the video on the service. * @param string [Optional] Dimensions of video * @param string [Optional] Description to show * @param string [Optional] Alignment of the video * @param string [Optional] Container to use.(Frame is currently the only option.) * @param string [Optional] Extra URL Arguments * @param string [Optional] Automatically Resize video that will break its parent container. * @return string Encoded representation of input params (to be processed later) */ static public function parseEV( $parser, $service = null, $id = null, $dimensions = null, $alignment = null, $description = null, $container = null, $urlArgs = null, $autoResize = null ) { self::resetParameters(); $service = trim( $service ); $id = trim( $id ); $alignment = trim( $alignment ); $description = trim( $description ); $dimensions = trim( $dimensions ); $urlArgs = trim( $urlArgs ); $width = null; $height = null; $autoResize = ( isset( $autoResize ) && strtolower( trim( $autoResize ) ) == "false" ) ? false : true; // I am not using $parser->parseWidthParam() since it can not handle height only. Example: x100 if ( stristr( $dimensions, 'x' ) ) { $dimensions = strtolower( $dimensions ); list( $width, $height ) = explode( 'x', $dimensions ); } elseif ( is_numeric( $dimensions ) ) { $width = $dimensions; } /************************************/ /* Error Checking */ /************************************/ if ( !$service || !$id ) { return self::error( 'missingparams', $service, $id ); } self::$service = \EmbedVideo\VideoService::newFromName( $service ); if ( !self::$service ) { return self::error( 'service', $service ); } // Let the service automatically handle bad dimensional values. self::$service->setWidth( $width ); self::$service->setHeight( $height ); // If the service has an ID pattern specified, verify the id number. if ( !self::$service->setVideoID( $id ) ) { return self::error( 'id', $service, $id ); } if ( !self::$service->setUrlArgs( $urlArgs ) ) { return self::error( 'urlargs', $service, $urlArgs ); } self::setDescription( $description, $parser ); if ( !self::setContainer( $container ) ) { return self::error( 'container', $container ); } if ( !self::setAlignment( $alignment ) ) { return self::error( 'alignment', $alignment ); } /************************************/ /* HMTL Generation */ /************************************/ $html = self::$service->getHtml(); if ( !$html ) { return self::error( 'unknown', $service ); } if ($autoResize) { $html = self::generateWrapperHTML( $html, null, "autoResize" ); } else { $html = self::generateWrapperHTML( $html ); } $parser->getOutput()->addModules( ['ext.embedVideo'] ); return [ $html, 'noparse' => true, 'isHTML' => true ]; } /** * Generate the HTML necessary to embed the video with the given alignment * and text description * * @access private * @param string [Optional] Horizontal Alignment * @param string [Optional] Description * @param string [Optional] Additional Classes to add to the wrapper * @return string */ static private function generateWrapperHTML( $html, $description = null, $addClass = null ) { $classString = "embedvideo"; $styleString = ""; $innerClassString = "embedvideowrap"; if ( self::getContainer() == 'frame' ) { $classString .= " thumb"; $innerClassString .= " thumbinner"; } if (self::getAlignment() !== false) { $classString .= " ev_" . self::getAlignment(); $styleString .= " width: " . ( self::$service->getWidth() + 6 ) . "px;'"; } if ($addClass) { $classString .= " " . $addClass; } $html = "<div class='" . $classString . "' style='" . $styleString . "'> <div class='" . $innerClassString . "' style='width: " . self::$service->getWidth() . "px;'> {$html} " . ( self::getDescription() !== false ? "<div class='thumbcaption'>" . self::getDescription() . "</div>" : null ) . " </div> </div>"; return $html; } /** * Return the alignment parameter. * * @access public * @return mixed Alignment or false for not set. */ static private function getAlignment() { return self::$alignment; } /** * Set the align parameter. * * @access private * @param string Alignment Parameter * @return boolean Valid */ static private function setAlignment( $alignment ) { if ( !empty( $alignment ) && ( $alignment == 'left' || $alignment == 'right' || $alignment == 'center' || $alignment == 'inline' ) ) { self::$alignment = $alignment; } elseif ( !empty( $alignment ) ) { return false; } return true; } /** * Return description text. * * @access private * @return mixed String description or false for not set. */ static private function getDescription() { return self::$description; } /** * Set the description. * * @access private * @param string Description * @param object Mediawiki Parser object * @return void */ static private function setDescription( $description, \Parser $parser ) { self::$description = ( !$description ? false : $parser->recursiveTagParse( $description ) ); } /** * Return container type. * * @access private * @return mixed String container type or false for not set. */ static private function getContainer() { return self::$container; } /** * Set the container type. * * @access private * @param string Container * @return boolean Success */ static private function setContainer( $container ) { if ( !empty( $container ) && ( $container == 'frame' ) ) { self::$container = $container; } elseif ( !empty( $container ) ) { return false; } return true; } /** * Reset parameters between parses. * * @access private * @return void */ static private function resetParameters() { self::$description = false; self::$alignment = false; self::$container = false; } /** * Error Handler * * @access private * @param string [Optional] Error Type * @param mixed [...] Multiple arguments to be retrieved with func_get_args(). * @return string Printable Error Message */ static private function error( $type = 'unknown' ) { $arguments = func_get_args(); array_shift( $arguments ); $message = wfMessage( 'error_embedvideo_' . $type, $arguments )->escaped(); return "<div class='errorbox'>{$message}</div>"; } }
gpl-2.0
idiginfo/scholar2text
python/scholarfolder2txt.py
1417
#!/usr/bin/python # -*- coding: utf-8 -*- # # Scholar2Text - Python App for converting Scholarly PDFs to Text # # Directory Iterator for PDFs # # Author: Casey McLaughlin # License: GPLv2 (see LICENSE.md) # import scholar2txt, sys, os def runAnalysisFromCli(): #Input folder inFolder = os.path.abspath(sys.argv[1]) #Output folder try: outFolder = sys.argv[2] except IndexError: outFolder = '.' outFolder = os.path.abspath(outFolder) iterateThroughFolder(inFolder, outFolder) #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def iterateThroughFolder(inFolder, outFolder): for root, _, files in os.walk(inFolder): for f in files: fullPath = os.path.join(root, f) baseName, fileExtension = os.path.splitext(f) outFileName = os.path.join(outFolder, baseName + '.txt') if (fileExtension.lower() == '.pdf'): print 'Processing ' + f + '...', res = scholar2txt.runPdfAnalysis(fullPath) if (res != False): outFile = open(outFileName, 'w') outFile.write(res) outFile.close() print 'done' else: print 'FAIL' #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if __name__ == "__main__": runAnalysisFromCli()
gpl-2.0
alx/SimplePress
wp-content/plugins/wp-e-commerce/wpsc-admin/display-variations.page.php
6920
<?php /** * WP eCommerce edit and add variation group page functions * * These are the main WPSC Admin functions * * @package wp-e-commerce * @since 3.7 */ function wpsc_display_variations_page() { $columns = array( 'title' => TXT_WPSC_NAME, 'edit' => TXT_WPSC_EDIT, ); register_column_headers('display-variations-list', $columns); ?> <script language='javascript' type='text/javascript'> function conf() { var check = confirm("<?php echo TXT_WPSC_SURETODELETEPRODUCT;?>"); if(check) { return true; } else { return false; } } <?php ?> </script> <noscript> </noscript> <div class="wrap"> <?php// screen_icon(); ?> <h2><?php echo wp_specialchars( TXT_WPSC_DISPLAYVARIATIONS ); ?> </h2> <p> <?php echo TXT_WPSC_DISPLAYVARIATIONSDESCRIPTION;?> </p> <?php if (isset($_GET['deleted']) || isset($_GET['message'])) { ?> <div id="message" class="updated fade"> <p> <?php if (isset($_GET['message']) ) { $message = absint( $_GET['message'] ); $messages[1] = __( 'Product updated.' ); echo $messages[$message]; unset($_GET['message']); } $_SERVER['REQUEST_URI'] = remove_query_arg( array('deleted', 'message'), $_SERVER['REQUEST_URI'] ); ?> </p> </div> <?php } ?> <div id="col-container" class=''> <div id="col-right"> <div id='poststuff' class="col-wrap"> <form id="modify-variation-groups" method="post" action="" enctype="multipart/form-data" > <?php //$product_id = absint($_GET['product_id']); //wpsc_display_product_form($product_id); wpsc_admin_variation_forms($_GET['variation_id']); ?> </form> </div> </div> <div id="col-left"> <div class="col-wrap"> <?php wpsc_admin_variation_group_list($category_id); ?> </div> </div> </div> </div> <?php } function wpsc_admin_variation_group_list() { global $wpdb; $variations = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_PRODUCT_VARIATIONS."` ORDER BY `id`",ARRAY_A); ?> <table class="widefat page fixed" id='wpsc_variation_list' cellspacing="0"> <thead> <tr> <?php print_column_headers('display-variations-list'); ?> </tr> </thead> <tfoot> <tr> <?php print_column_headers('display-variations-list', false); ?> </tr> </tfoot> <tbody> <?php foreach((array)$variations as $variation) { ?> <tr class="variation-edit" id="variation-<?php echo $product['id']?>"> <td class="variation-name"><?php echo htmlentities(stripslashes($variation['name']), ENT_QUOTES, 'UTF-8'); ?></td> <td class="edit-variation"> <a href='<?php echo add_query_arg('variation_id', $variation['id']); ?>'><?php echo TXT_WPSC_EDIT; ?></a> </td> </tr> <?php } ?> </tbody> </table> <?php } function wpsc_admin_variation_forms($variation_id = null) { global $wpdb; $variation_value_count = 0; $variation_name = ''; if($variation_id > 0 ) { $variation_id = absint($variation_id); $variation_name = $wpdb->get_var("SELECT `name` FROM `".WPSC_TABLE_PRODUCT_VARIATIONS."` WHERE `id`='$variation_id' LIMIT 1") ; $variation_values = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_VARIATION_VALUES."` WHERE `variation_id`='$variation_id' ORDER BY `id` ASC",ARRAY_A); $variation_value_count = count($variation_values); } // if people add more than 90 variations, bad things may happen, like servers dying if more than one such variation group is put on a product. 90*90 = 8100 combinations if(($_GET['valuecount'] > 0) && ($_GET['valuecount'] <= 90)) { $value_form_count = absint($_GET['valuecount']); } else { $value_form_count = 2; remove_query_arg( array('valuecount'), $_SERVER['REQUEST_URI'] ); } if($variation_name != '') { ?> <h3><?php echo TXT_WPSC_EDITVARIATION;?><span> (<a href="admin.php?page=wpsc-edit-variations">Add new Variation Set</a>)</span></h3> <?php } else { ?> <h3><?php echo TXT_WPSC_ADDVARIATION;?></h3> <?php } ?> <table class='category_forms'> <tr> <td> <?php echo TXT_WPSC_NAME;?>: </td> <td> <input type='text' class="text" name='name' value='<?php echo $variation_name; ?>' /> </td> </tr> <tr> <td> <?php echo TXT_WPSC_VARIATION_VALUES;?>: </td> <td> <div id='variation_values'> <?php if($variation_value_count > 0) { $num = 0; foreach($variation_values as $variation_value) { ?> <div class='variation_value'> <input type='text' class='text' name='variation_values[<?php echo $variation_value['id']; ?>]' value='<?php echo htmlentities(stripslashes($variation_value['name']), ENT_QUOTES, 'UTF-8'); ?>' /> <input type='hidden' class='variation_values_id' name='variation_values_id[]' value='<?php echo $variation_value['id']; ?>' /> <?php if($variation_value_count > 1): ?> <a class='image_link delete_variation_value' href='#'> <img src='<?php echo WPSC_URL; ?>/images/trash.gif' alt='<?php echo TXT_WPSC_DELETE; ?>' title='<?php echo TXT_WPSC_DELETE; ?>' /> </a> <?php endif; ?> </div> <?php $num++; } } else { for($i = 0; $i <= $value_form_count; $i++) { ?> <div class='variation_value'> <input type='text' class="text" name='new_variation_values[]' value='' /> <a class='image_link delete_variation_value' href='#'> <img src='<?php echo WPSC_URL; ?>/images/trash.gif' alt='<?php echo TXT_WPSC_DELETE; ?>' title='<?php echo TXT_WPSC_DELETE; ?>' /> </a> </div> <?php } } ?> </div> <a href='#' class='add_variation_item_form'>+ <?php _e('Add Value'); ?></a> </td> </tr> <tr> <td> </td> <td> <?php wp_nonce_field('edit-variation', 'wpsc-edit-variation'); ?> <input type='hidden' name='wpsc_admin_action' value='wpsc-variation-set' /> <?php if($variation_id > 0) { ?> <input type='hidden' name='variation_id' value='<?php echo $variation_id; ?>' /> <input type='hidden' name='submit_action' value='edit' /> <input class='button' style='float:left;' type='submit' name='submit' value='<?php echo TXT_WPSC_EDIT; ?>' /> <a class='button delete_button' href='<?php echo wp_nonce_url("admin.php?wpsc_admin_action=wpsc-delete-variation-set&amp;deleteid={$variation_id}", 'delete-variation'); ?>' onclick="return conf();" ><?php echo TXT_WPSC_DELETE; ?></a> <?php } else { ?> <input type='hidden' name='submit_action' value='add' /> <input class='button' type='submit' name='submit' value='<?php echo TXT_WPSC_ADD;?>' /> <?php } ?> </td> </tr> </table> <?php } ?>
gpl-2.0
oat-sa/tao-core
test/unit/models/classes/Lists/DataAccess/Repository/DependentPropertiesRepositoryTest.php
3709
<?php /** * 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; under version 2 * of the License (non-upgradable). * * 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. * * Copyright (c) 2021 (original work) Open Assessment Technologies SA; */ declare(strict_types=1); namespace oat\tao\test\unit\model\Lists\DataAccess\Repository; use ArrayIterator; use oat\generis\test\TestCase; use core_kernel_classes_Property; use oat\generis\model\OntologyRdf; use oat\search\base\QueryInterface; use oat\search\base\QueryBuilderInterface; use oat\search\base\ResultSetInterface; use oat\search\base\SearchGateWayInterface; use PHPUnit\Framework\MockObject\MockObject; use oat\tao\model\Lists\DataAccess\Repository\DependentPropertiesRepository; use oat\tao\model\Lists\Business\Domain\DependentPropertiesRepositoryContext; use oat\generis\model\kernel\persistence\smoothsql\search\ComplexSearchService; class DependentPropertiesRepositoryTest extends TestCase { /** @var DependentPropertiesRepository */ private $sut; /** @var ComplexSearchService|MockObject */ private $complexSearchService; protected function setUp(): void { $this->complexSearchService = $this->createMock(ComplexSearchService::class); $this->sut = new DependentPropertiesRepository(); $this->sut->setServiceLocator( $this->getServiceLocatorMock([ ComplexSearchService::SERVICE_ID => $this->complexSearchService, ]) ); } public function testFindAll(): void { $this->mockFindSearch(); $context = $this->createMock(DependentPropertiesRepositoryContext::class); $context ->method('getParameter') ->willReturn($this->createMock(core_kernel_classes_Property::class)); $this->assertSame([], $this->sut->findAll($context)); } public function testFindTotalChildren(): void { $this->mockFindSearch(); $context = $this->createMock(DependentPropertiesRepositoryContext::class); $context ->method('getParameter') ->willReturn($this->createMock(core_kernel_classes_Property::class)); $this->assertSame(1, $this->sut->findTotalChildren($context)); } private function mockFindSearch(): void { $queryBuilder = $this->createMock(QueryBuilderInterface::class); $queryBuilder ->method('setCriteria') ->willReturnSelf(); $result = $this->createMock(ResultSetInterface::class); $result->method('total') ->willReturn(1); $gateway = $this->createMock(SearchGateWayInterface::class); $gateway ->method('search') ->willReturn($result); $this->complexSearchService ->method('query') ->willReturn($queryBuilder); $this->complexSearchService ->method('searchType') ->with($queryBuilder, OntologyRdf::RDF_PROPERTY, true) ->willReturn($this->createMock(QueryInterface::class)); $this->complexSearchService ->method('getGateway') ->willReturn($gateway); } }
gpl-2.0
unioslo/cerebrum
Cerebrum/modules/disk_quota/__init__.py
8313
# -*- coding: utf-8 -*- # Copyright 2003-2019 University of Oslo, Norway # # This file is part of Cerebrum. # # Cerebrum 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. # # Cerebrum 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 Cerebrum; if not, write to the Free Software Foundation, # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. """ Implementation of mod_disk_quota. The disk_quota module provides disk quotas for individual homedirs, as well as default disk quotas for disks or disk hosts. Default disk quotas are stored as traits on host or disk entities. Individual homedir quotas are stored in a separate table, ``disk_quota``. Configuration ------------- If mod_disk_quota is in use, the following cereconf-variables needs to be configured: CLASS_DISK Should be set to/include 'Cerebrum.modules.disk_quota.mixins/DiskQuotaMixin' CLASS_CONSTANTS Should include Cerebrum.modules.disk_quota.constants/Constants CLASS_CL_CONSTANTS Should include 'Cerebrum.modules.disk_quota.constants/CLConstants' History ------- This submodule used to live in Cerebrum.modules.no.{uio,uit}.{Disk,DiskQuota}. It was moved to a separate module after: commit b09f87aca4a1b6ed715f863dd7cf8730465391a3 Merge: e940e928e ddf367002 Date: Tue Mar 26 12:18:52 2019 +0100 """ from Cerebrum import Account from Cerebrum import Errors from Cerebrum.DatabaseAccessor import DatabaseAccessor from Cerebrum.Utils import Factory, NotSet, argument_to_sql __version__ = '1.0' class DiskQuota(DatabaseAccessor): """ Methods for maintaining disk-quotas for accounts. Typical usage would be something like: :: dq = DiskQuota(db) # Set initial quota (or update) dq.set_quota(account_home.homedir_id, quota=50) # Set override for quota dq.set_quota( account_home.homedir_id, override_quota=90, override_expiration=mx.DateTime.now(), description='nice guy') # Remove override dq.clear_override(account_home.homedir_id) """ def __init__(self, database): super(DiskQuota, self).__init__(database) self.const = Factory.get('Constants')(database) self.clconst = Factory.get('CLConstants')(database) def _get_account_id(self, homedir_id): ah = Account.Account(self._db) row = ah.get_homedir(homedir_id) return row['account_id'] def __insert_disk_quota(self, homedir_id, values): binds = {} binds.update(values) binds.update({'homedir_id': int(homedir_id)}) query = """ INSERT INTO [:table schema=cerebrum name=disk_quota] ({cols}) VALUES ({params}) """.format(cols=', '.join(sorted(binds)), params=', '.join(':' + k for k in sorted(binds))) self._db.execute(query, binds) def __update_disk_quota(self, homedir_id, values): binds = {} binds.update(values) binds.update({'homedir_id': int(homedir_id)}) query = """ UPDATE [:table schema=cerebrum name=disk_quota] SET {assign} WHERE homedir_id=:homedir_id """.format(assign=', '.join(k + '=:' + k for k in sorted(values))) self._db.execute(query, binds) def set_quota( self, homedir_id, quota=NotSet, override_quota=NotSet, override_expiration=NotSet, description=NotSet): """ Insert or update disk_quota for homedir_id. Will only affect the columns used as keyword arguments. """ try: old_values = self.get_quota(homedir_id) is_new = False except Errors.NotFoundError: old_values = {} is_new = True new_values = {} def update_param(k, v): if v is NotSet or (k in old_values and v == old_values[k]): return new_values[k] = v update_param('quota', quota) update_param('override_quota', override_quota) update_param('override_expiration', override_expiration) update_param('description', description) if not new_values: return if is_new: self.__insert_disk_quota(homedir_id, new_values) else: self.__update_disk_quota(homedir_id, new_values) # Update change_params # TODO: We should really changelog the old_values... change_params = dict(new_values) change_params['homedir_id'] = homedir_id if 'override_expiration' in change_params: change_params.update({ 'override_expiration': override_expiration.strftime('%Y-%m-%d'), }) self._db.log_change( self._get_account_id(homedir_id), self.clconst.disk_quota_set, None, change_params=change_params) def clear_override(self, homedir_id): """Convenience method for clearing override settings""" self.set_quota( homedir_id, override_quota=None, override_expiration=None, description=None, ) def clear(self, homedir_id): """Remove the disk_quota entry from the table""" try: self.get_quota(homedir_id) exists = True except Errors.NotFoundError: exists = False if not exists: return change_entity = self._get_account_id(homedir_id) binds = {'homedir_id': int(homedir_id)} query = """ DELETE FROM [:table schema=cerebrum name=disk_quota] WHERE homedir_id=:homedir_id """ self._db.execute(query, binds) self._db.log_change( change_entity, self.clconst.disk_quota_clear, None, change_params=binds) def get_quota(self, homedir_id): """Return quota information for a given homedir""" binds = {'homedir_id': int(homedir_id)} query = """ SELECT * FROM [:table schema=cerebrum name=disk_quota] WHERE homedir_id=:homedir_id """ return self._db.query_1(query, binds) def list_quotas(self, spread=None, disk_id=None, all_users=False): """ List quota and homedir information for all users that has quota. """ binds = {} where = [] where.append( argument_to_sql( self.const.account_namespace, 'en.value_domain', binds, int)) if spread: where.append(argument_to_sql(spread, 'ah.spread', binds, int)) if disk_id: where.append(argument_to_sql(disk_id, 'di.disk_id', binds, int)) query = """ SELECT dq.homedir_id, ah.account_id, hi.home, en.entity_name, di.path, dq.quota, dq.override_quota, dq.override_expiration, ah.spread FROM [:table schema=cerebrum name=disk_info] di, [:table schema=cerebrum name=account_home] ah, [:table schema=cerebrum name=account_info] ai, [:table schema=cerebrum name=entity_name] en, [:table schema=cerebrum name=homedir] hi {if_left} JOIN [:table schema=cerebrum name=disk_quota] dq ON dq.homedir_id = hi.homedir_id WHERE hi.disk_id=di.disk_id AND hi.homedir_id=ah.homedir_id AND ah.account_id=en.entity_id AND ai.account_id=en.entity_id AND (ai.expire_date IS NULL OR ai.expire_date > [:now]) AND {where} """.format( if_left=('LEFT' if all_users else ''), where=' AND '.join(where), ) return self._db.query(query, binds)
gpl-2.0
michellab/Sire
corelib/src/libs/SireUnits/convert.cpp
6993
/********************************************\ * * Sire - Molecular Simulation Framework * * Copyright (C) 2007 Christopher Woods * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * For full details of the license please see the COPYING file * that should have come with this distribution. * * You can contact the authors via the developer's mailing list * at http://siremol.org * \*********************************************/ #include <QString> #include <QStringList> #include <QMap> #include <QPair> #include <boost/shared_ptr.hpp> #include "convert.h" #include "dimensions.h" #include <QDebug> namespace SireUnits { namespace Dimension { static void appendString(int M, QString rep, QStringList &pos, QStringList &neg) { if (M > 1) { pos.append( QString("%1^%2").arg(rep).arg(M) ); } else if (M == 1) { pos.append(rep); } else if (M < 0) { neg.append( QString("%1%2").arg(rep).arg(M) ); } } static QString getGenericUnitString(int M, int L, int T, int C, int t, int Q, int A) { QStringList pos; QStringList neg; appendString(M, "M", pos, neg); appendString(L, "L", pos, neg); appendString(T, "T", pos, neg); appendString(C, "C", pos, neg); appendString(t, "t", pos, neg); appendString(Q, "Q", pos, neg); appendString(A, "A", pos, neg); if (pos.isEmpty() and neg.isEmpty()) return ""; else if (neg.isEmpty()) return pos.join(" "); else if (pos.isEmpty()) return neg.join(" "); else return QString("%1 %2").arg(pos.join(" "), neg.join(" ")); } class DimensionKey { public: template<int M, int L, int T, int C, int t, int Q, int A> DimensionKey(const PhysUnit<M,L,T,C,t,Q,A> &unit) : M_(M), L_(L), T_(T), C_(C), t_(t), Q_(Q), A_(A) {} DimensionKey(int M, int L, int T, int C, int t, int Q, int A) : M_(M), L_(L), T_(T), C_(C), t_(t), Q_(Q), A_(A) {} DimensionKey(const DimensionKey &other) : M_(other.M_), L_(other.L_), T_(other.T_), C_(other.C_), t_(other.t_), Q_(other.Q_), A_(other.A_) {} ~DimensionKey() {} int M_, L_, T_, C_, t_, Q_, A_; bool operator==(const DimensionKey &other) const { return M_ == other.M_ and L_ == other.L_ and T_ == other.T_ and C_ == other.C_ and t_ == other.t_ and Q_ == other.Q_ and A_ == other.A_; } bool operator!=(const DimensionKey &other) const { return not this->operator==(other); } bool operator<(const DimensionKey &other) const { return (M_ < other.M_) or (M_ == other.M_ and L_ < other.L_) or (M_ == other.M_ and L_ == other.L_ and T_ < other.T_) or (M_ == other.M_ and L_ == other.L_ and T_ == other.T_ and C_ < other.C_) or (M_ == other.M_ and L_ == other.L_ and T_ == other.T_ and C_ == other.C_ and t_ < other.t_) or (M_ == other.M_ and L_ == other.L_ and T_ == other.T_ and C_ == other.C_ and t_ == other.t_ and Q_ < other.Q_) or (M_ == other.M_ and L_ == other.L_ and T_ == other.T_ and C_ == other.C_ and t_ == other.t_ and Q_ == other.Q_ and A_ < other.A_); } bool operator<=(const DimensionKey &other) const { return this->operator==(other) or this->operator<(other); } bool operator>=(const DimensionKey &other) const { return not this->operator<(other); } bool operator>(const DimensionKey &other) const { return not this->operator<=(other); } }; boost::shared_ptr< QMap< DimensionKey,QPair<double,QString> > > default_strings; /** Return a string representing the unit with specified dimensions */ QString getUnitString(double value, int M, int L, int T, int C, int t, int Q, int A) { if (default_strings == 0) { boost::shared_ptr< QMap< DimensionKey, QPair<double,QString> > > strings( new QMap< DimensionKey,QPair<double,QString> >() ); strings->insert( DimensionKey(kcal_per_mol), QPair<double,QString>( kcal_per_mol, "kcal mol-1" ) ); strings->insert( DimensionKey(degree), QPair<double,QString>( degree, "degree" ) ); strings->insert( DimensionKey(angstrom), QPair<double,QString>( angstrom, "angstrom" ) ); strings->insert( DimensionKey(angstrom2), QPair<double,QString>( angstrom2, "angstrom^2" ) ); strings->insert( DimensionKey(angstrom3), QPair<double,QString>( angstrom3, "angstrom^3" ) ); strings->insert( DimensionKey(g_per_mol), QPair<double,QString>( g_per_mol, "g mol-1" ) ); strings->insert( DimensionKey(mod_electron), QPair<double,QString>( mod_electron, "|e|" ) ); strings->insert( DimensionKey(picosecond), QPair<double,QString>( picosecond, "ps" ) ); strings->insert( DimensionKey(atm), QPair<double,QString>( atm, "atm" ) ); strings->insert( DimensionKey(angstrom/femtosecond), QPair<double,QString>( angstrom/femtosecond, "angstrom fs-1" ) ); default_strings = strings; } QMap< DimensionKey,QPair<double,QString> >::const_iterator it = default_strings->constFind(DimensionKey(M,L,T,C,t,Q,A)); if (it != default_strings->constEnd()) { return QString("%1 %2").arg( value / it->first ) .arg( it->second ); } else return QString("%1 %2").arg(value).arg(getGenericUnitString(M,L,T,C,t,Q,A)); } } }
gpl-2.0
seankooler/wordpress
wp-content/plugins/wpjb-mod/CashMod.php
1493
<?php /** * Payment class * * This is the only class you will need to add new payment method to the * job board. * * It's important for the class to implement Wpjb_Payment_Interface, * otherwise it won't be registered. * * If you are creating more advanced integration than payment by cash * please look into file wpjobboard/application/libraries/Payment/PayPal.php * which contains full PayPal IPN integration. * */ class Wpjb_Payment_CashMod implements Wpjb_Payment_Interface { public function __construct(Wpjb_Model_Payment $data = null) { } /** * Returns engine identifier * * @return string */ public function getEngine() { return "Cash"; } /** * Returns title describing * * @return string */ public function getTitle() { return translate("Chèque (l’annonce sera publiée après l’encaissement du chèque)", WPJB_DOMAIN); } /** * Procesess transaction (for online payments only) * * @param array $data Post data returned from payment processor * @throws Exception If transaction is invalid * @return void */ public function processTransaction(array $data) { } /** * Returns payment button or how to pay instructions * * @return string */ public function render() { return translate("Par chèque à l’ordre de ChinForm, 116, avenue de la République, 92400 Courbevoie. Attention, l’annonce sera publiée après l’encaissement du chèque", WPJB_DOMAIN); } }
gpl-2.0
england9911/matteng.land
core/modules/dblog/src/Tests/DbLogTest.php
23317
<?php /** * @file * Contains \Drupal\dblog\Tests\DbLogTest. */ namespace Drupal\dblog\Tests; use Drupal\Component\Utility\Xss; use Drupal\dblog\Controller\DbLogController; use Drupal\simpletest\WebTestBase; /** * Generate events and verify dblog entries; verify user access to log reports * based on persmissions. * * @group dblog */ class DbLogTest extends WebTestBase { /** * Modules to enable. * * @var array */ public static $modules = array('dblog', 'node', 'forum', 'help'); /** * A user with some relevant administrative permissions. * * @var object */ protected $big_user; /** * A user without any permissions. * * @var object */ protected $any_user; function setUp() { parent::setUp(); // Create users with specific permissions. $this->big_user = $this->drupalCreateUser(array('administer site configuration', 'access administration pages', 'access site reports', 'administer users')); $this->any_user = $this->drupalCreateUser(array()); } /** * Tests Database Logging module functionality through interfaces. * * First logs in users, then creates database log events, and finally tests * Database Logging module functionality through both the admin and user * interfaces. */ function testDbLog() { // Login the admin user. $this->drupalLogin($this->big_user); $row_limit = 100; $this->verifyRowLimit($row_limit); $this->verifyCron($row_limit); $this->verifyEvents(); $this->verifyReports(); $this->verifyBreadcrumbs(); // Login the regular user. $this->drupalLogin($this->any_user); $this->verifyReports(403); } /** * Verifies setting of the database log row limit. * * @param int $row_limit * The row limit. */ private function verifyRowLimit($row_limit) { // Change the database log row limit. $edit = array(); $edit['dblog_row_limit'] = $row_limit; $this->drupalPostForm('admin/config/development/logging', $edit, t('Save configuration')); $this->assertResponse(200); // Check row limit variable. $current_limit = \Drupal::config('dblog.settings')->get('row_limit'); $this->assertTrue($current_limit == $row_limit, format_string('[Cache] Row limit variable of @count equals row limit of @limit', array('@count' => $current_limit, '@limit' => $row_limit))); } /** * Verifies that cron correctly applies the database log row limit. * * @param int $row_limit * The row limit. */ private function verifyCron($row_limit) { // Generate additional log entries. $this->generateLogEntries($row_limit + 10); // Verify that the database log row count exceeds the row limit. $count = db_query('SELECT COUNT(wid) FROM {watchdog}')->fetchField(); $this->assertTrue($count > $row_limit, format_string('Dblog row count of @count exceeds row limit of @limit', array('@count' => $count, '@limit' => $row_limit))); // Run a cron job. $this->cronRun(); // Verify that the database log row count equals the row limit plus one // because cron adds a record after it runs. $count = db_query('SELECT COUNT(wid) FROM {watchdog}')->fetchField(); $this->assertTrue($count == $row_limit + 1, format_string('Dblog row count of @count equals row limit of @limit plus one', array('@count' => $count, '@limit' => $row_limit))); } /** * Generates a number of random database log events. * * @param int $count * Number of watchdog entries to generate. * @param string $type * (optional) The type of watchdog entry. Defaults to 'custom'. * @param int $severity * (optional) The severity of the watchdog entry. Defaults to WATCHDOG_NOTICE. */ private function generateLogEntries($count, $type = 'custom', $severity = WATCHDOG_NOTICE) { global $base_root; // Prepare the fields to be logged $log = array( 'channel' => $type, 'message' => 'Log entry added to test the dblog row limit.', 'variables' => array(), 'severity' => $severity, 'link' => NULL, 'user' => $this->big_user, 'uid' => $this->big_user->id(), 'request_uri' => $base_root . request_uri(), 'referer' => \Drupal::request()->server->get('HTTP_REFERER'), 'ip' => '127.0.0.1', 'timestamp' => REQUEST_TIME, ); $message = 'Log entry added to test the dblog row limit. Entry #'; for ($i = 0; $i < $count; $i++) { $log['message'] = $message . $i; $this->container->get('logger.dblog')->log($severity, $log['message'], $log); } } /** * Confirms that database log reports are displayed at the correct paths. * * @param int $response * (optional) HTTP response code. Defaults to 200. */ private function verifyReports($response = 200) { // View the database log help page. $this->drupalGet('admin/help/dblog'); $this->assertResponse($response); if ($response == 200) { $this->assertText(t('Database Logging'), 'DBLog help was displayed'); } // View the database log report page. $this->drupalGet('admin/reports/dblog'); $this->assertResponse($response); if ($response == 200) { $this->assertText(t('Recent log messages'), 'DBLog report was displayed'); } // View the database log page-not-found report page. $this->drupalGet('admin/reports/page-not-found'); $this->assertResponse($response); if ($response == 200) { $this->assertText("Top 'page not found' errors", 'DBLog page-not-found report was displayed'); } // View the database log access-denied report page. $this->drupalGet('admin/reports/access-denied'); $this->assertResponse($response); if ($response == 200) { $this->assertText("Top 'access denied' errors", 'DBLog access-denied report was displayed'); } // View the database log event page. $wid = db_query('SELECT MIN(wid) FROM {watchdog}')->fetchField(); $this->drupalGet('admin/reports/dblog/event/' . $wid); $this->assertResponse($response); if ($response == 200) { $this->assertText(t('Details'), 'DBLog event node was displayed'); } } /** * Generates and then verifies breadcrumbs. */ private function verifyBreadcrumbs() { // View the database log event page. $wid = db_query('SELECT MIN(wid) FROM {watchdog}')->fetchField(); $this->drupalGet('admin/reports/dblog/event/' . $wid); $xpath = '//nav[@class="breadcrumb"]/ol/li[last()]/a'; $this->assertEqual(current($this->xpath($xpath)), 'Recent log messages', 'DBLogs link displayed at breadcrumb in event page.'); } /** * Generates and then verifies various types of events. */ private function verifyEvents() { // Invoke events. $this->doUser(); $this->drupalCreateContentType(array('type' => 'article', 'name' => t('Article'))); $this->drupalCreateContentType(array('type' => 'page', 'name' => t('Basic page'))); $this->doNode('article'); $this->doNode('page'); $this->doNode('forum'); // When a user account is canceled, any content they created remains but the // uid = 0. Records in the watchdog table related to that user have the uid // set to zero. } /** * Generates and then verifies some user events. */ private function doUser() { // Set user variables. $name = $this->randomName(); $pass = user_password(); // Add a user using the form to generate an add user event (which is not // triggered by drupalCreateUser). $edit = array(); $edit['name'] = $name; $edit['mail'] = $name . '@example.com'; $edit['pass[pass1]'] = $pass; $edit['pass[pass2]'] = $pass; $edit['status'] = 1; $this->drupalPostForm('admin/people/create', $edit, t('Create new account')); $this->assertResponse(200); // Retrieve the user object. $user = user_load_by_name($name); $this->assertTrue($user != NULL, format_string('User @name was loaded', array('@name' => $name))); // pass_raw property is needed by drupalLogin. $user->pass_raw = $pass; // Login user. $this->drupalLogin($user); // Logout user. $this->drupalLogout(); // Fetch the row IDs in watchdog that relate to the user. $result = db_query('SELECT wid FROM {watchdog} WHERE uid = :uid', array(':uid' => $user->id())); foreach ($result as $row) { $ids[] = $row->wid; } $count_before = (isset($ids)) ? count($ids) : 0; $this->assertTrue($count_before > 0, format_string('DBLog contains @count records for @name', array('@count' => $count_before, '@name' => $user->getUsername()))); // Login the admin user. $this->drupalLogin($this->big_user); // Delete the user created at the start of this test. // We need to POST here to invoke batch_process() in the internal browser. $this->drupalPostForm('user/' . $user->id() . '/cancel', array('user_cancel_method' => 'user_cancel_reassign'), t('Cancel account')); // View the database log report. $this->drupalGet('admin/reports/dblog'); $this->assertResponse(200); // Verify that the expected events were recorded. // Add user. // Default display includes name and email address; if too long, the email // address is replaced by three periods. $this->assertLogMessage(t('New user: %name %email.', array('%name' => $name, '%email' => '<' . $user->getEmail() . '>')), 'DBLog event was recorded: [add user]'); // Login user. $this->assertLogMessage(t('Session opened for %name.', array('%name' => $name)), 'DBLog event was recorded: [login user]'); // Logout user. $this->assertLogMessage(t('Session closed for %name.', array('%name' => $name)), 'DBLog event was recorded: [logout user]'); // Delete user. $message = t('Deleted user: %name %email.', array('%name' => $name, '%email' => '<' . $user->getEmail() . '>')); $message_text = truncate_utf8(Xss::filter($message, array()), 56, TRUE, TRUE); // Verify that the full message displays on the details page. $link = FALSE; if ($links = $this->xpath('//a[text()="' . html_entity_decode($message_text) . '"]')) { // Found link with the message text. $links = array_shift($links); foreach ($links->attributes() as $attr => $value) { if ($attr == 'href') { // Extract link to details page. $link = drupal_substr($value, strpos($value, 'admin/reports/dblog/event/')); $this->drupalGet($link); // Check for full message text on the details page. $this->assertRaw($message, 'DBLog event details was found: [delete user]'); break; } } } $this->assertTrue($link, 'DBLog event was recorded: [delete user]'); // Visit random URL (to generate page not found event). $not_found_url = $this->randomName(60); $this->drupalGet($not_found_url); $this->assertResponse(404); // View the database log page-not-found report page. $this->drupalGet('admin/reports/page-not-found'); $this->assertResponse(200); // Check that full-length URL displayed. $this->assertText($not_found_url, 'DBLog event was recorded: [page not found]'); } /** * Generates and then verifies some node events. * * @param string $type * A node type (e.g., 'article', 'page' or 'forum'). */ private function doNode($type) { // Create user. $perm = array('create ' . $type . ' content', 'edit own ' . $type . ' content', 'delete own ' . $type . ' content'); $user = $this->drupalCreateUser($perm); // Login user. $this->drupalLogin($user); // Create a node using the form in order to generate an add content event // (which is not triggered by drupalCreateNode). $edit = $this->getContent($type); $title = $edit['title[0][value]']; $this->drupalPostForm('node/add/' . $type, $edit, t('Save')); $this->assertResponse(200); // Retrieve the node object. $node = $this->drupalGetNodeByTitle($title); $this->assertTrue($node != NULL, format_string('Node @title was loaded', array('@title' => $title))); // Edit the node. $edit = $this->getContentUpdate($type); $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save')); $this->assertResponse(200); // Delete the node. $this->drupalPostForm('node/' . $node->id() . '/delete', array(), t('Delete')); $this->assertResponse(200); // View the node (to generate page not found event). $this->drupalGet('node/' . $node->id()); $this->assertResponse(404); // View the database log report (to generate access denied event). $this->drupalGet('admin/reports/dblog'); $this->assertResponse(403); // Login the admin user. $this->drupalLogin($this->big_user); // View the database log report. $this->drupalGet('admin/reports/dblog'); $this->assertResponse(200); // Verify that node events were recorded. // Was node content added? $this->assertLogMessage(t('@type: added %title.', array('@type' => $type, '%title' => $title)), 'DBLog event was recorded: [content added]'); // Was node content updated? $this->assertLogMessage(t('@type: updated %title.', array('@type' => $type, '%title' => $title)), 'DBLog event was recorded: [content updated]'); // Was node content deleted? $this->assertLogMessage(t('@type: deleted %title.', array('@type' => $type, '%title' => $title)), 'DBLog event was recorded: [content deleted]'); // View the database log access-denied report page. $this->drupalGet('admin/reports/access-denied'); $this->assertResponse(200); // Verify that the 'access denied' event was recorded. $this->assertText('admin/reports/dblog', 'DBLog event was recorded: [access denied]'); // View the database log page-not-found report page. $this->drupalGet('admin/reports/page-not-found'); $this->assertResponse(200); // Verify that the 'page not found' event was recorded. $this->assertText('node/' . $node->id(), 'DBLog event was recorded: [page not found]'); } /** * Creates random content based on node content type. * * @param string $type * Node content type (e.g., 'article'). * * @return array * Random content needed by various node types. */ private function getContent($type) { switch ($type) { case 'forum': $content = array( 'title[0][value]' => $this->randomName(8), 'taxonomy_forums' => array(1), 'body[0][value]' => $this->randomName(32), ); break; default: $content = array( 'title[0][value]' => $this->randomName(8), 'body[0][value]' => $this->randomName(32), ); break; } return $content; } /** * Creates random content as an update based on node content type. * * @param string $type * Node content type (e.g., 'article'). * * @return array * Random content needed by various node types. */ private function getContentUpdate($type) { $content = array( 'body[0][value]' => $this->randomName(32), ); return $content; } /** * Tests the addition and clearing of log events through the admin interface. * * Logs in the admin user, creates a database log event, and tests the * functionality of clearing the database log through the admin interface. */ protected function testDBLogAddAndClear() { global $base_root; // Get a count of how many watchdog entries already exist. $count = db_query('SELECT COUNT(*) FROM {watchdog}')->fetchField(); $log = array( 'channel' => 'system', 'message' => 'Log entry added to test the doClearTest clear down.', 'variables' => array(), 'severity' => WATCHDOG_NOTICE, 'link' => NULL, 'user' => $this->big_user, 'uid' => $this->big_user->id(), 'request_uri' => $base_root . request_uri(), 'referer' => \Drupal::request()->server->get('HTTP_REFERER'), 'ip' => '127.0.0.1', 'timestamp' => REQUEST_TIME, ); // Add a watchdog entry. $this->container->get('logger.dblog')->log($log['severity'], $log['message'], $log); // Make sure the table count has actually been incremented. $this->assertEqual($count + 1, db_query('SELECT COUNT(*) FROM {watchdog}')->fetchField(), format_string('dblog_watchdog() added an entry to the dblog :count', array(':count' => $count))); // Login the admin user. $this->drupalLogin($this->big_user); // Post in order to clear the database table. $this->drupalPostForm('admin/reports/dblog', array(), t('Clear log messages')); // Confirm that the logs should be cleared. $this->drupalPostForm(NULL, array(), 'Confirm'); // Count the rows in watchdog that previously related to the deleted user. $count = db_query('SELECT COUNT(*) FROM {watchdog}')->fetchField(); $this->assertEqual($count, 0, format_string('DBLog contains :count records after a clear.', array(':count' => $count))); } /** * Tests the database log filter functionality at admin/reports/dblog. */ protected function testFilter() { $this->drupalLogin($this->big_user); // Clear the log to ensure that only generated entries will be found. db_delete('watchdog')->execute(); // Generate 9 random watchdog entries. $type_names = array(); $types = array(); for ($i = 0; $i < 3; $i++) { $type_names[] = $type_name = $this->randomName(); $severity = WATCHDOG_EMERGENCY; for ($j = 0; $j < 3; $j++) { $types[] = $type = array( 'count' => $j + 1, 'type' => $type_name, 'severity' => $severity++, ); $this->generateLogEntries($type['count'], $type['type'], $type['severity']); } } // View the database log page. $this->drupalGet('admin/reports/dblog'); // Confirm that all the entries are displayed. $count = $this->getTypeCount($types); foreach ($types as $key => $type) { $this->assertEqual($count[$key], $type['count'], 'Count matched'); } // Filter by each type and confirm that entries with various severities are // displayed. foreach ($type_names as $type_name) { $edit = array( 'type[]' => array($type_name), ); $this->drupalPostForm(NULL, $edit, t('Filter')); // Count the number of entries of this type. $type_count = 0; foreach ($types as $type) { if ($type['type'] == $type_name) { $type_count += $type['count']; } } $count = $this->getTypeCount($types); $this->assertEqual(array_sum($count), $type_count, 'Count matched'); } // Set the filter to match each of the two filter-type attributes and // confirm the correct number of entries are displayed. foreach ($types as $type) { $edit = array( 'type[]' => array($type['type']), 'severity[]' => array($type['severity']), ); $this->drupalPostForm(NULL, $edit, t('Filter')); $count = $this->getTypeCount($types); $this->assertEqual(array_sum($count), $type['count'], 'Count matched'); } $this->drupalGet('admin/reports/dblog', array('query' => array('order' => 'Type'))); $this->assertResponse(200); $this->assertText(t('Operations'), 'Operations text found'); // Clear all logs and make sure the confirmation message is found. $this->drupalPostForm('admin/reports/dblog', array(), t('Clear log messages')); // Confirm that the logs should be cleared. $this->drupalPostForm(NULL, array(), 'Confirm'); $this->assertText(t('Database log cleared.'), 'Confirmation message found'); } /** * Gets the database log event information from the browser page. * * @return array * List of log events where each event is an array with following keys: * - severity: (int) A database log severity constant. * - type: (string) The type of database log event. * - message: (string) The message for this database log event. * - user: (string) The user associated with this database log event. */ protected function getLogEntries() { $entries = array(); if ($table = $this->xpath('.//table[@id="admin-dblog"]')) { $table = array_shift($table); foreach ($table->tbody->tr as $row) { $entries[] = array( 'severity' => $this->getSeverityConstant($row['class']), 'type' => $this->asText($row->td[1]), 'message' => $this->asText($row->td[3]), 'user' => $this->asText($row->td[4]), ); } } return $entries; } /** * Gets the count of database log entries by database log event type. * * @param array $types * The type information to compare against. * * @return array * The count of each type keyed by the key of the $types array. */ protected function getTypeCount(array $types) { $entries = $this->getLogEntries(); $count = array_fill(0, count($types), 0); foreach ($entries as $entry) { foreach ($types as $key => $type) { if ($entry['type'] == $type['type'] && $entry['severity'] == $type['severity']) { $count[$key]++; break; } } } return $count; } /** * Gets the watchdog severity constant corresponding to the CSS class. * * @param string $class * CSS class attribute. * * @return int|null * The watchdog severity constant or NULL if not found. */ protected function getSeverityConstant($class) { $map = array_flip(DbLogController::getLogLevelClassMap()); // Find the class that contains the severity. $classes = explode(' ', $class); foreach ($classes as $class) { if (isset($map[$class])) { return $map[$class]; } } return NULL; } /** * Extracts the text contained by the XHTML element. * * @param \SimpleXMLElement $element * Element to extract text from. * * @return string * Extracted text. */ protected function asText(\SimpleXMLElement $element) { if (!is_object($element)) { return $this->fail('The element is not an element.'); } return trim(html_entity_decode(strip_tags($element->asXML()))); } /** * Confirms that a log message appears on the database log overview screen. * * This function should only be used for the admin/reports/dblog page, because * it checks for the message link text truncated to 56 characters. Other log * pages have no detail links so they contain the full message text. * * @param string $log_message * The database log message to check. * @param string $message * The message to pass to simpletest. */ protected function assertLogMessage($log_message, $message) { $message_text = truncate_utf8(Xss::filter($log_message, array()), 56, TRUE, TRUE); // After \Drupal\Component\Utility\Xss::filter(), HTML entities should be // converted to their character equivalents because assertLink() uses this // string in xpath() to query the Document Object Model (DOM). $this->assertLink(html_entity_decode($message_text), 0, $message); } }
gpl-2.0
ugeneunipro/ugene
src/plugins/workflow_designer/src/util/WriteSequenceValidator.cpp
3827
/** * UGENE - Integrated Bioinformatics Tools. * Copyright (C) 2008-2022 UniPro <ugene@unipro.ru> * http://ugene.net * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ #include "WriteSequenceValidator.h" #include <U2Core/AppContext.h> #include <U2Core/DocumentModel.h> #include <U2Core/U2SafePoints.h> #include <U2Lang/BaseAttributes.h> #include <U2Lang/BaseSlots.h> #include <U2Lang/SupportClass.h> namespace U2 { namespace Workflow { WriteSequenceValidator::WriteSequenceValidator(const QString &attr, const QString &port, const QString &slot) : ScreenedParamValidator(attr, port, slot) { } bool WriteSequenceValidator::validate(const Configuration *cfg, NotificationsList &notificationList) const { const Actor *actor = dynamic_cast<const Actor *>(cfg); SAFE_POINT(nullptr != actor, "NULL actor", false); if (!isAnnotationsBinded(actor)) { return true; } DocumentFormat *format = getFormatSafe(actor); CHECK(nullptr != format, true); if (!isAnnotationsSupported(format)) { QString warning = QObject::tr("The format %1 does not support annotations").arg(format->getFormatId().toUpper()); notificationList << WorkflowNotification(warning, "", WorkflowNotification::U2_WARNING); cmdLog.trace(warning); } return true; } DocumentFormat *WriteSequenceValidator::getFormatSafe(const Actor *actor) { Attribute *attr = actor->getParameter(BaseAttributes::DOCUMENT_FORMAT_ATTRIBUTE().getId()); SAFE_POINT(nullptr != attr, "NULL format attribute", nullptr); CHECK(actor->isAttributeVisible(attr), nullptr); QString formatId = attr->getAttributePureValue().toString(); return AppContext::getDocumentFormatRegistry()->getFormatById(formatId); } bool WriteSequenceValidator::isAnnotationsBinded(const Actor *actor) const { Port *p = actor->getPort(port); SAFE_POINT(nullptr != p, "NULL port", false); Attribute *attr = p->getParameter(IntegralBusPort::BUS_MAP_ATTR_ID); SAFE_POINT(nullptr != attr, "NULL busmap attribute", false); StrStrMap busMap = attr->getAttributeValueWithoutScript<StrStrMap>(); QString bindData = busMap.value(BaseSlots::ANNOTATION_TABLE_SLOT().getId(), ""); return !bindData.isEmpty(); } bool WriteSequenceValidator::isAnnotationsSupported(const DocumentFormat *format) { return format->getSupportedObjectTypes().contains(GObjectTypes::ANNOTATION_TABLE); } bool WriteSequencePortValidator::validate(const IntegralBusPort *port, NotificationsList &notificationList) const { bool result = true; Actor *actor = port->owner(); QStringList screenedSlots(BaseSlots::URL_SLOT().getId()); if (!isBinded(port, BaseSlots::ANNOTATION_TABLE_SLOT().getId())) { DocumentFormat *format = WriteSequenceValidator::getFormatSafe(actor); CHECK(nullptr != format, result); if (!WriteSequenceValidator::isAnnotationsSupported(format)) { screenedSlots << BaseSlots::ANNOTATION_TABLE_SLOT().getId(); } } result &= ScreenedSlotValidator::validate(screenedSlots, port, notificationList); return result; } } // namespace Workflow } // namespace U2
gpl-2.0
everythingtype/heckscher
parts/mediarelations.php
306
<h2>News</h2> <?php get_template_part('parts/news-dropdown'); ?> <div class="thegrid postgrid"> <?php $newsargs = array( 'post_type' => array('post'), 'numberposts' => 9, 'order' => 'DESC', ); query_posts($newsargs); get_template_part('parts/archivegrid'); wp_reset_query(); ?> </div>
gpl-2.0
stefanvr/WebTracks
spec/acceptance/steps/authentication_steps.rb
169
step 'I am a unregistered user' do end step 'I open webtracks' do visit '/' end step 'I see a welcome message' do expect(page).to have_content('hello world') end
gpl-2.0
sanderpotjer/joomla-cms
libraries/src/Version.php
7982
<?php /** * Joomla! Content Management System * * @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\CMS; defined('JPATH_PLATFORM') or die; use Joomla\CMS\Helper\LibraryHelper; /** * Version information class for the Joomla CMS. * * @since 1.0 */ final class Version { /** * Product name. * * @var string * @since 3.5 */ const PRODUCT = 'Joomla!'; /** * Major release version. * * @var integer * @since 3.8.0 */ const MAJOR_VERSION = 3; /** * Minor release version. * * @var integer * @since 3.8.0 */ const MINOR_VERSION = 9; /** * Patch release version. * * @var integer * @since 3.8.0 */ const PATCH_VERSION = 6; /** * Extra release version info. * * This constant when not empty adds an additional identifier to the version string to reflect the development state. * For example, for 3.8.0 when this is set to 'dev' the version string will be `3.8.0-dev`. * * @var string * @since 3.8.0 */ const EXTRA_VERSION = 'dev'; /** * Release version. * * @var string * @since 3.5 * @deprecated 4.0 Use separated version constants instead */ const RELEASE = '3.9'; /** * Maintenance version. * * @var string * @since 3.5 * @deprecated 4.0 Use separated version constants instead */ const DEV_LEVEL = '6-dev'; /** * Development status. * * @var string * @since 3.5 */ const DEV_STATUS = 'Development'; /** * Build number. * * @var string * @since 3.5 * @deprecated 4.0 */ const BUILD = ''; /** * Code name. * * @var string * @since 3.5 */ const CODENAME = 'Amani'; /** * Release date. * * @var string * @since 3.5 */ const RELDATE = '30-April-2019'; /** * Release time. * * @var string * @since 3.5 */ const RELTIME = '22:17'; /** * Release timezone. * * @var string * @since 3.5 */ const RELTZ = 'GMT'; /** * Copyright Notice. * * @var string * @since 3.5 */ const COPYRIGHT = 'Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.'; /** * Link text. * * @var string * @since 3.5 */ const URL = '<a href="https://www.joomla.org">Joomla!</a> is Free Software released under the GNU General Public License.'; /** * Magic getter providing access to constants previously defined as class member vars. * * @param string $name The name of the property. * * @return mixed A value if the property name is valid. * * @since 3.5 * @deprecated 4.0 Access the constants directly */ public function __get($name) { if (defined("JVersion::$name")) { \JLog::add( 'Accessing Version data through class member variables is deprecated, use the corresponding constant instead.', \JLog::WARNING, 'deprecated' ); return constant("\\Joomla\\CMS\\Version::$name"); } $trace = debug_backtrace(); trigger_error( 'Undefined constant via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_NOTICE ); } /** * Check if we are in development mode * * @return boolean * * @since 3.4.3 */ public function isInDevelopmentState() { return strtolower(self::DEV_STATUS) !== 'stable'; } /** * Compares two a "PHP standardized" version number against the current Joomla version. * * @param string $minimum The minimum version of the Joomla which is compatible. * * @return boolean True if the version is compatible. * * @link https://www.php.net/version_compare * @since 1.0 */ public function isCompatible($minimum) { return version_compare(JVERSION, $minimum, 'ge'); } /** * Method to get the help file version. * * @return string Version suffix for help files. * * @since 1.0 */ public function getHelpVersion() { return '.' . self::MAJOR_VERSION . self::MINOR_VERSION; } /** * Gets a "PHP standardized" version string for the current Joomla. * * @return string Version string. * * @since 1.5 */ public function getShortVersion() { $version = self::MAJOR_VERSION . '.' . self::MINOR_VERSION . '.' . self::PATCH_VERSION; // Has to be assigned to a variable to support PHP 5.3 and 5.4 $extraVersion = self::EXTRA_VERSION; if (!empty($extraVersion)) { $version .= '-' . $extraVersion; } return $version; } /** * Gets a version string for the current Joomla with all release information. * * @return string Complete version string. * * @since 1.5 */ public function getLongVersion() { return self::PRODUCT . ' ' . $this->getShortVersion() . ' ' . self::DEV_STATUS . ' [ ' . self::CODENAME . ' ] ' . self::RELDATE . ' ' . self::RELTIME . ' ' . self::RELTZ; } /** * Returns the user agent. * * @param string $component Name of the component. * @param bool $mask Mask as Mozilla/5.0 or not. * @param bool $add_version Add version afterwards to component. * * @return string User Agent. * * @since 1.0 */ public function getUserAgent($component = null, $mask = false, $add_version = true) { if ($component === null) { $component = 'Framework'; } if ($add_version) { $component .= '/' . self::RELEASE; } // If masked pretend to look like Mozilla 5.0 but still identify ourselves. if ($mask) { return 'Mozilla/5.0 ' . self::PRODUCT . '/' . self::RELEASE . '.' . self::DEV_LEVEL . ($component ? ' ' . $component : ''); } else { return self::PRODUCT . '/' . self::RELEASE . '.' . self::DEV_LEVEL . ($component ? ' ' . $component : ''); } } /** * Generate a media version string for assets * Public to allow third party developers to use it * * @return string * * @since 3.2 */ public function generateMediaVersion() { $date = new \JDate; return md5($this->getLongVersion() . \JFactory::getConfig()->get('secret') . $date->toSql()); } /** * Gets a media version which is used to append to Joomla core media files. * * This media version is used to append to Joomla core media in order to trick browsers into * reloading the CSS and JavaScript, because they think the files are renewed. * The media version is renewed after Joomla core update, install, discover_install and uninstallation. * * @return string The media version. * * @since 3.2 */ public function getMediaVersion() { // Load the media version and cache it for future use static $mediaVersion = null; if ($mediaVersion === null) { // Get the joomla library params $params = LibraryHelper::getParams('joomla'); // Get the media version $mediaVersion = $params->get('mediaversion', ''); // Refresh assets in debug mode or when the media version is not set if (JDEBUG || empty($mediaVersion)) { $mediaVersion = $this->generateMediaVersion(); $this->setMediaVersion($mediaVersion); } } return $mediaVersion; } /** * Function to refresh the media version * * @return Version Instance of $this to allow chaining. * * @since 3.2 */ public function refreshMediaVersion() { $newMediaVersion = $this->generateMediaVersion(); return $this->setMediaVersion($newMediaVersion); } /** * Sets the media version which is used to append to Joomla core media files. * * @param string $mediaVersion The media version. * * @return Version Instance of $this to allow chaining. * * @since 3.2 */ public function setMediaVersion($mediaVersion) { // Do not allow empty media versions if (!empty($mediaVersion)) { // Get library parameters $params = LibraryHelper::getParams('joomla'); $params->set('mediaversion', $mediaVersion); // Save modified params LibraryHelper::saveParams('joomla', $params); } return $this; } }
gpl-2.0
CzBiX/Telegram
TMessagesProj/src/main/java/com/google/android/exoplayer2/text/SubtitleOutputBuffer.java
2434
/* * Copyright (C) 2016 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.android.exoplayer2.text; import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.decoder.OutputBuffer; import com.google.android.exoplayer2.util.Assertions; import java.util.List; /** * Base class for {@link SubtitleDecoder} output buffers. */ public abstract class SubtitleOutputBuffer extends OutputBuffer implements Subtitle { private Subtitle subtitle; private long subsampleOffsetUs; /** * Sets the content of the output buffer, consisting of a {@link Subtitle} and associated * metadata. * * @param timeUs The time of the start of the subtitle in microseconds. * @param subtitle The subtitle. * @param subsampleOffsetUs An offset that must be added to the subtitle's event times, or * {@link Format#OFFSET_SAMPLE_RELATIVE} if {@code timeUs} should be added. */ public void setContent(long timeUs, Subtitle subtitle, long subsampleOffsetUs) { this.timeUs = timeUs; this.subtitle = subtitle; this.subsampleOffsetUs = subsampleOffsetUs == Format.OFFSET_SAMPLE_RELATIVE ? this.timeUs : subsampleOffsetUs; } @Override public int getEventTimeCount() { return Assertions.checkNotNull(subtitle).getEventTimeCount(); } @Override public long getEventTime(int index) { return Assertions.checkNotNull(subtitle).getEventTime(index) + subsampleOffsetUs; } @Override public int getNextEventTimeIndex(long timeUs) { return Assertions.checkNotNull(subtitle).getNextEventTimeIndex(timeUs - subsampleOffsetUs); } @Override public List<Cue> getCues(long timeUs) { return Assertions.checkNotNull(subtitle).getCues(timeUs - subsampleOffsetUs); } @Override public abstract void release(); @Override public void clear() { super.clear(); subtitle = null; } }
gpl-2.0
Elanis/SciFi-Pack-Addon-Gamemode
lua/entities/sw_oldjedistarfighter/shared.lua
356
ENT.Type = "anim" ENT.Base = "base_anim" ENT.PrintName = "Old Jedi StarFigther" ENT.Author = "Elanis" ENT.Contact = "" ENT.Purpose = "" ENT.Instructions= "" ENT.Spawnable = true ENT.AdminSpawnable = true list.Set("SW.Ent", ENT.PrintName, ENT); if(gmod.GetGamemode().Name=="SciFiPack") then ENT.Category = "SpaceShips" else ENT.Category = "Star Wars" end
gpl-2.0
filipac/Free-Torrent-Source
shoutbox.php
11606
<?php /** * @description Fts ShoutBox backend. Here the messages are posted, edited and * all stuff regaring shoutbox are made here. * @author Filip Pacurar * @version 2.2.1 * @lastmodified 05.05.2008 **/ ## Require backend require_once("include/bittorrent.php"); #Check if user is logged loggedinorreturn(); #Create a good header global $charset; header("Content-Type: text/html; charset=$charset"); #=>>> Edit Shout: Start if ($_GET['do'] == 'edit' && is_valid_id($_GET['id'])){ # JsB::insertjq(1); echo <<<E <script type="text/javascript"> $(document).ready(function() { $('#shout').ajaxForm(function() { $('#shoutbox').html('<b>Shout Edited!!(Wait 1 second)</b>'); setTimeout("getShouts();", 1000) setTimeout("getWOL();", 1000) }); }); </script> E; $id = 0+$_GET['id']; $q = mysql_query("SELECT text FROM shoutbox WHERE id = $id"); $q = mysql_fetch_assoc($q); echo("<form action=shoutbox.php method=post id=\"shout\"><input type=hidden name=do value=takeedit /><input type=hidden name=id value=$id />"); echo '<textarea name=message cols=100 rows=10>'.$q['text'].'</textarea>'; echo"<BR><input type=submit value=Edit />"; echo"</form>"; die; } elseif ($_POST['do'] == 'takeedit') { if(!empty($_POST['message'])) { $ch = mysql_query("UPDATE shoutbox SET text='$_POST[message]' WHERE id='$_POST[id]'") or die(mysql_error(__FILE__)); if($ch) { header("Location: index.php"); ?> <?php die;} } } #=>>> Edit Shout: End | Write Shout: Start elseif ($_GET["do"] == "shout") { #=> Change the charset usign the iconv menthod. $shout = iconv("$charset", "$charset", urldecode(decode_unicode_url($_GET["shout"]))); #=>>> Empty Shoutbox: Start if ($shout == "/empty" && ur::ismod()) { mysql_query("TRUNCATE TABLE shoutbox"); $message = '/notice The Shoutbox has been truncated by '.$CURUSER['username']; mysql_query("INSERT INTO shoutbox (date, text, userid, username) VALUES (".implode(", ", array_map("sqlesc", array(time(), $message, '1','system'))).")") or sqlerr(__FILE__,__LINE__); #die('The Shoutbox has been truncated'); } if ($shout == "/prune" && ur::ismod()) { mysql_query("TRUNCATE TABLE shoutbox"); $message = '/notice The Shoutbox has been truncated by '.$CURUSER['username']; mysql_query("INSERT INTO shoutbox (date, text, userid, username) VALUES (".implode(", ", array_map("sqlesc", array(time(), $message, '1','system'))).")") or sqlerr(__FILE__,__LINE__); #die('The Shoutbox has been truncated'); } if ($shout == "/pruneshout" && ur::ismod()) { mysql_query("TRUNCATE TABLE shoutbox"); $message = '/notice The Shoutbox has been truncated by '.$CURUSER['username']; mysql_query("INSERT INTO shoutbox (date, text, userid, username) VALUES (".implode(", ", array_map("sqlesc", array(time(), $message, '1','system'))).")") or sqlerr(__FILE__,__LINE__); #die('The Shoutbox has been truncated'); } #=>>> Empty Shoutbox: End #=>>> Help Command: Start if ($shout == '/help') { ?> <script> clear(); </script> <?php echo "<div class=success>"; if(ur::ismod()) echo <<<HELP <p>As an member of the staff, you have the folowing commands:</p> <p>If you want to make an notice - use the /notice command.</p> <p>If you want to empty the whole shoutbox - use the /empty command</p> <p>If you want to warn or unwarn an user - use the /warn and /unwarn commands</p> <p>If you want to ban(disable) or unban(enable) an user - use the /ban and /unban commands</p> <p>To delete all notices from the shout, use /deletenotice command</p> HELP; echo <<<HELP <p>As an user, you have the folowing commands:</p> <p>If you want to view this message in the shout, use the /help command</p> <p>If you want to speak at 3rd person, use the /me command.</p> HELP; echo "</div>"; } #=>>> Help Command: End #=>>> Staff Functions: Start if(preg_match("/\/warn (.*)/",$shout,$matches) && ur::ismod()) { if($CURUSER['username'] != $matches[1]) { $a = sql_query("SELECT id FROM users WHERE username = '$matches[1]' AND warned = 'no' LIMIT 1"); if(mysql_num_rows($a) > 0) { $id = mysql_fetch_assoc($a); $id1 = $id['id']; $warn = sql_query("UPDATE users SET warned = 'yes' WHERE id = '$id1'"); $message = 'You have been quick-warned(using shoutbox) by '.$CURUSER['username'].'!'; send_message($id1,$message,'WARNED!'); add_shout("User $matches[1] has been warned by $CURUSER[username]"); } else { echo <<<E <p class=error>No user with that username!! WARN <b>FAILED</b></p> E; } } else { echo <<<E <p class=error>You CANNOT WARN YOURSELF!! WARN <b>FAILED</b></p> E; } } if(preg_match("/\/unwarn (.*)/",$shout,$matches) && ur::ismod()) { if($CURUSER['username'] != $matches[1]) { $a = sql_query("SELECT id FROM users WHERE username = '$matches[1]' AND warned = 'yes' LIMIT 1"); if(mysql_num_rows($a) > 0) { $id = mysql_fetch_assoc($a); $id1 = $id['id']; $warn = sql_query("UPDATE users SET warned = 'no' WHERE id = '$id1'"); $message = 'You have been quick-unwarned(using shoutbox) by '.$CURUSER['username'].'!'; send_message($id1,$message,'UNWARNED!'); add_shout("User $matches[1] has been unwarned by $CURUSER[username]"); } else { echo <<<E <p class=error>No user with that username!! UNWARN <b>FAILED</b></p> E; } } else { echo <<<E <p class=error>You CANNOT UNWARN YOURSELF!! UNWARN <b>FAILED</b></p> E; } } if(preg_match("/\/ban (.*)/",$shout,$matches) && ur::ismod()) { if($CURUSER['username'] != $matches[1]) { $a = sql_query("SELECT id FROM users WHERE username = '$matches[1]' AND enabled = 'yes' LIMIT 1"); if(mysql_num_rows($a) > 0) { $id = mysql_fetch_assoc($a); $id1 = $id['id']; $warn = sql_query("UPDATE users SET enabled = 'no' WHERE id = '$id1'"); $message = 'You have been quick-banned(using shoutbox) by '.$CURUSER['username'].'!'; send_message($id1,$message,'BANNED!'); add_shout("User $matches[1] has been banned by $CURUSER[username]"); } else { echo <<<E <p class=error>No user with that username!! BAN <b>FAILED</b></p> E; } }else { echo <<<E <p class=error>You cannot ban yourself!! BAN <b>FAILED</b></p> E; } } if(preg_match("/\/deletenotice/",$shout,$matches) && ur::ismod()) { mysql_query("DELETE FROM shoutbox WHERE text LIKE '%/notice%'") or die(mysql_error()); } if(preg_match("/\/unban (.*)/",$shout,$matches) && ur::ismod()) { if($CURUSER['username'] != $matches[1]) { $a = sql_query("SELECT id FROM users WHERE username = '$matches[1]' AND enabled = 'no' LIMIT 1"); if(mysql_num_rows($a) > 0) { $id = mysql_fetch_assoc($a); $id1 = $id['id']; $warn = sql_query("UPDATE users SET enabled = 'yes' WHERE id = '$id1'"); $message = 'You have been quick-unbanned(using shoutbox) by '.$CURUSER['username'].'!'; send_message($id1,$message,'UNBanned!'); add_shout("User $matches[1] has been unbanned by $CURUSER[username]"); } else { echo <<<E <p class=error>No user with that username!! UNBAN <b>FAILED</b></p> E; } }else { echo <<<E <p class=error>You cannot unban yourself!! UNBAN <b>FAILED</b></p> E; } } #=>>> Staff Functions: END # Define the sender $sender = $CURUSER["id"]; #Check if user is trying to type an staff command and stop thim $shout = preg_replace("/\/empty/",'',$shout); $shout = preg_replace("/\/ban (.*)/",'',$shout); $shout = preg_replace("/\/unban (.*)/",'',$shout); $shout = preg_replace("/\/warn (.*)/",'',$shout); $shout = preg_replace("/\/unwarn (.*)/",'',$shout); $shout = preg_replace("/\/help/",'',$shout); $shout = preg_replace("/\/prune/",'',$shout); $shout = preg_replace("/\/pruneshout/",'',$shout); $shout = preg_replace("/\/deletenotice/",'',$shout); if(!ur::ismod()) $shout = preg_replace("/\/notice/",'',$shout); #END #Check for empty shouts as we do not need them. if (!empty($shout)) { global $___flood___,$usergroups; $___flood___->protect('last_shout','shout',$usergroups['antifloodtime']); #Start Message processing if(preg_match("/\/notice/i",$shout) AND ur::ismod()) { $message = $shout; sql_query("INSERT INTO shoutbox (date, text, userid, username) VALUES (".implode(", ", array_map("sqlesc", array(time(), $message, '1','system'))).")") or sqlerr(__FILE__,__LINE__); $___flood___->update('last_shout'); }else{ sql_query("INSERT INTO shoutbox (date, text, userid) VALUES (".implode(", ", array_map("sqlesc", array(time(), $shout, $sender))).")") or sqlerr(__FILE__,__LINE__); $___flood___->update('last_shout');} } else print("<script>alert('message?!');</script>"); } elseif ($_GET["do"] == "delete" ) { $id = $_GET["id"]; $q = mysql_query("SELECT userid FROM shoutbox WHERE id = '$id'"); $q = mysql_fetch_assoc($q); if(get_user_class() >= UC_MODERATOR OR $CURUSER['id']==$q['userid'] && is_valid_id($_GET["id"])) mysql_query("DELETE FROM shoutbox WHERE id = $id") or sqlerr(__FILE__,__LINE__); } $res = mysql_query("SELECT shoutbox.*, users.username, users.class, users.gender FROM shoutbox INNER JOIN users ON shoutbox.userid = users.id ORDER BY id DESC LIMIT 0, 30") or sqlerr(__FILE__,__LINE__); if (mysql_num_rows($res) == 0) die(); global $shoutname; while ($arr = mysql_fetch_array($res)) { $comment=format_comment($arr["text"] ); if(preg_match("/\/notice/",$comment)) { $comment = preg_replace('/\/notice/','',$comment); print("<b><span style=\"background-color:#ADCBE7;font-size:10px;\">[".strftime("%I:%M %p",$arr["date"])."] ".(get_user_class() >= UC_MODERATOR ? "<span onclick=\"deleteShout($arr[id]);\" style=\"cursor: pointer;\">[x]</span> <span onclick=\"editShout($arr[id]);\" style=\"cursor: pointer;\">[e]</span> " : "")."<b>$shoutname</b> - $comment</span></b><BR>\n"); }elseif(preg_match("/\/me (.*)/",$comment,$m)) { $comment = preg_replace('/\/me/','',$comment); $dateshow = false; if($dateshow) print("<font color=gray>[".strftime("%I:%M %p",$arr["date"])."]</font> ".(get_user_class() >= UC_MODERATOR ? "<span onclick=\"deleteShout($arr[id]);\" style=\"cursor: pointer;\">[x]</span> <span onclick=\"editShout($arr[id]);\" style=\"cursor: pointer;\">[e]</span> " : $arr['userid'] == $CURUSER['id'] ? "<span onclick=\"deleteShout($arr[id]);\" style=\"cursor: pointer;\">[x]</span> <span onclick=\"editShout($arr[id]);\" style=\"cursor: pointer;\">[e]</span>" : '')." <b><a href=\"#\" onClick=\"SmileIT('$arr[username]:','shoutform','shout');return false;\" >".get_user_class_color($arr["class"], $arr["username"], $arr["gender"])."</a></b> $comment<br/>\n"); else print(" <b>".get_user_class_color($arr["class"], $arr["username"], $arr["gender"])."</b> $comment".(get_user_class() >= UC_MODERATOR ? "<span onclick=\"deleteShout($arr[id]);\" style=\"cursor: pointer;\">[x]</span> <span onclick=\"editShout($arr[id]);\" style=\"cursor: pointer;\">[e]</span> " : $arr['userid'] == $CURUSER['id'] ? "<span onclick=\"deleteShout($arr[id]);\" style=\"cursor: pointer;\">[x]</span> <span onclick=\"editShout($arr[id]);\" style=\"cursor: pointer;\">[e]</span>" : '')._br."\n"); }else print("<font color=gray>[".strftime("%I:%M %p",$arr["date"])."]</font> ".(get_user_class() >= UC_MODERATOR ? "<span onclick=\"deleteShout($arr[id]);\" style=\"cursor: pointer;\">[x]</span> <span onclick=\"editShout($arr[id]);\" style=\"cursor: pointer;\">[e]</span> " : $arr['userid'] == $CURUSER['id'] ? "<span onclick=\"deleteShout($arr[id]);\" style=\"cursor: pointer;\">[x]</span> <span onclick=\"editShout($arr[id]);\" style=\"cursor: pointer;\">[e]</span>" : '')."<b><a href=\"userdetails.php?id=$arr[userid]\"onClick=\"SmileIT('$arr[username]:','shoutform','shout');return false;\" >".get_user_class_color($arr["class"], $arr["username"], $arr["gender"])."</a></b> - $comment<br/>\n"); } #END Message processing ####### END ####### ?>
gpl-2.0
wilddom/admidio
adm_program/modules/lists/photo_show.php
1127
<?php /** *********************************************************************************************** * Show user photo * * @copyright 2004-2016 The Admidio Team * @see https://www.admidio.org/ * @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2.0 only * * Parameters: * * usr_id : Id of the user whose photo should be shown *********************************************************************************************** */ require_once('../../system/common.php'); require_once('../../system/login_valid.php'); $getUserId = admFuncVariableIsValid($_GET, 'usr_id', 'int', array('requireValue' => true, 'directOutput' => true)); $user = new User($gDb, $gProfileFields, $getUserId); $userPhoto = $user->getValue('usr_photo'); // if user has no photo or current user is not allowed to see photos then show default photo if(strlen($userPhoto) === 0 || !$gCurrentUser->hasRightViewProfile($user)) { header('Content-Type: image/png'); echo readfile(THEME_SERVER_PATH. '/images/no_profile_pic.png'); } else { header('Content-Type: image/jpeg'); echo $userPhoto; }
gpl-2.0
webmasterpf/Celony-cyrano
node/node-page_pole.tpl.php
1630
<!-- ______________________ NODE-PAGE_POLE.TPL _______________________ --> <div class="node <?php print $classes; ?>" id="node-<?php print $node->nid; ?>"> <div class="node-inner"> <?php if (!$page): ?> <h2 class="title"><a href="<?php //print $node_url; ?>"><?php //print $title; ?></a></h2> <?php endif; ?> <?php print $picture; ?> <?php if ($submitted): ?> <span class="submitted"><?php print $submitted; ?></span> <?php endif; ?> <!-- ______________________ PARTIE CUSTOMISEE _______________________ --> <?php if ($title): ?> <h1 class="title-page-bloc"><?php print $title; ?></h1> <?php endif; ?> <!-- ______________________ BLOC GAUCHE _______________________ --> <div id="bloc-gauche-pole"> <?php print $pole_bloc_G; ?> </div> <!-- ______________________ BLOC CENTRE _______________________ --> <div id="bloc-centre-pole"> <?php print $pole_bloc_C; ?> </div> <!-- ______________________ BLOC DROIT _______________________ --> <div id="bloc-droit-pole"> <?php print $pole_bloc_D; ?> </div> <?php if ($terms): ?> <div class="taxonomy"><?php //print $terms; ?></div> <?php endif;?> <?php if ($links): ?> <div class="links"> <?php print $links; ?></div> <?php endif; ?> <!-- retour haut selon resolution de l'ecran --> <a href="#general" id="retour_haut">Haut de page</a> </div> <!-- /node-inner --> </div> <!-- /node-->
gpl-2.0
erpragatisingh/androidTraining
Android_6_weekTraning/Agro Calculator/src/ishan/bhatnagar/Display.java
986
package ishan.bhatnagar; import android.app.Activity; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.widget.TextView; public class Display extends Activity{ TextView tt; Helpere hlp=new Helpere(this, "agro.db", null,1); protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.display); tt=(TextView) findViewById(R.id.dis); Cursor c=getcur(); Mydis(c); } public Cursor getcur(){ SQLiteDatabase s=hlp.getReadableDatabase(); Cursor cr=s.query(Helpere.table, null, null, null, null, null, null); startManagingCursor(cr); return cr; } public Cursor Mydis(Cursor c){ StringBuilder s=new StringBuilder(); while(c.moveToNext()){ String name=c.getString(0); String pass=c.getString(2); s.append("name:---"+name+"\n\n"+"password:---"+pass+"\n\n"); } tt.setText(s); return c; } }
gpl-2.0
duynguyenhai/wordpress
wp-content/plugins/wp-external-links/js/src/admin-wp-external-links.js
6806
/* WP External Links Plugin - Admin */ /*global jQuery, window*/ jQuery(function ($) { 'use strict'; /* Tipsy Plugin */ (function () { $.fn.tipsy = function (options) { options = $.extend({}, $.fn.tipsy.defaults, options); return this.each(function () { var opts = $.fn.tipsy.elementOptions(this, options); $(this).hover(function () { $.data(this, 'cancel.tipsy', true); var tip = $.data(this, 'active.tipsy'); if (!tip) { tip = $('<div class="tipsy"><div class="tipsy-inner"/></div>'); tip.css({position: 'absolute', zIndex: 100000}); $.data(this, 'active.tipsy', tip); } if ($(this).attr('title') || typeof $(this).attr('original-title') !== 'string') { $(this).attr('original-title', $(this).attr('title') || '').removeAttr('title'); } var title; if (typeof opts.title === 'string') { title = $(this).attr(opts.title === 'title' ? 'original-title' : opts.title); } else if (typeof opts.title === 'function') { title = opts.title.call(this); } tip.find('.tipsy-inner')[opts.html ? 'html' : 'text'](title || opts.fallback); var pos = $.extend({}, $(this).offset(), {width: this.offsetWidth, height: this.offsetHeight}); tip.get(0).className = 'tipsy'; // reset classname in case of dynamic gravity tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).appendTo(document.body); var actualWidth = tip[0].offsetWidth, actualHeight = tip[0].offsetHeight; var gravity = (typeof opts.gravity == 'function') ? opts.gravity.call(this) : opts.gravity; switch (gravity.charAt(0)) { case 'n': tip.css({top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}).addClass('tipsy-north'); break; case 's': tip.css({top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}).addClass('tipsy-south'); break; case 'e': tip.css({top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}).addClass('tipsy-east'); break; case 'w': tip.css({top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}).addClass('tipsy-west'); break; } if (opts.fade) { tip.css({opacity: 0, display: 'block', visibility: 'visible'}).animate({opacity: 0.9}); } else { tip.css({visibility: 'visible'}); } }, function () { $.data(this, 'cancel.tipsy', false); var self = this; setTimeout(function () { if ($.data(this, 'cancel.tipsy')) return; var tip = $.data(self, 'active.tipsy'); if (opts.fade) { tip.stop().fadeOut(function () { $(this).remove(); }); } else { tip.remove(); } }, 100); }); }); }; // Overwrite this method to provide options on a per-element basis. // For example, you could store the gravity in a 'tipsy-gravity' attribute: // return $.extend({}, options, {gravity: $(ele).attr('tipsy-gravity') || 'n' }); // (remember - do not modify 'options' in place!) $.fn.tipsy.elementOptions = function (ele, options) { return $.metadata ? $.extend({}, options, $(ele).metadata()) : options; }; $.fn.tipsy.defaults = { fade: false, fallback: '', gravity: 'w', html: false, title: 'title' }; $.fn.tipsy.autoNS = function () { return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n'; }; $.fn.tipsy.autoWE = function () { return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'e' : 'w'; }; })(); // End Tipsy Plugin $('#setting-error-settings_updated').click(function () { $(this).hide(); }); // option filter page $('input#filter_page') .change(function () { var $i = $('input#filter_posts, input#filter_comments, input#filter_widgets'); if ($(this).attr('checked')) { $i.attr('disabled', true) .attr('checked', true); } else { $i.attr('disabled', false); } }) .change(); // option use js $('input#use_js') .change(function () { var $i = $('input#load_in_footer'); if ($(this).attr('checked')) { $i.attr('disabled', false); } else { $i.attr('disabled', true) .attr('checked', false); } }) .change(); // option filter_excl_sel $('input#phpquery') .change(function () { if ($(this).attr('checked')) { $('.filter_excl_sel').fadeIn(); } else { $('.filter_excl_sel').fadeOut(); } }) .change(); // refresh page when updated menu position $('#menu_position').parents('form.ajax-form').on('ajax_saved_options', function () { var s = $(this).val() || ''; window.location.href = s + (s.indexOf('?') > -1 ? '&' : '?') + 'page=wp_external_links&settings-updated=true'; }); // set tooltips $('.tooltip-help').css('margin', '0 5px').tipsy({ fade: true, live: true, gravity: 'w', fallback: 'No help text.' }); // remove class to fix button background $('*[type="submit"]').removeClass('submit'); // slide postbox $('.postbox').find('.handlediv, .hndle').click(function () { var $inside = $(this).parent().find('.inside'); if ($inside.css('display') === 'block') { $inside.css({ display: 'none' }); } else { $inside.css({ display: 'block' }); } }); });
gpl-2.0
pauloangelo/hogzilla
src/HogzillaStream.scala
2426
/* * Copyright (C) 2015-2016 Paulo Angelo Alves Resende <pa@pauloangelo.com> * * 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. You may not use, modify or * distribute this program under any other version of the GNU General * Public License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ import org.apache.spark.SparkConf import org.apache.spark.SparkContext import org.hogzilla.hbase.HogHBaseRDD import org.hogzilla.initiate.HogInitiate import org.hogzilla.prepare.HogPrepare import org.hogzilla.sflow._ import org.hogzilla.http.HogHTTP import org.hogzilla.auth.HogAuth import org.hogzilla.dns.HogDNS import org.apache.spark.streaming.Seconds import org.apache.spark.streaming.StreamingContext import org.apache.spark.storage.StorageLevel /** * * Keep it useful, simple, robust, and scalable. * * NOT RUNNING! DEPENDS ON IMPLEMENTATION ON AUTH2HZ! * */ object HogzillaStream { def main(args: Array[String]) { val sparkConf = new SparkConf() .setAppName("HogzillaStream") .setMaster("local[2]") .set("spark.executor.memory", "512m") .set("spark.default.parallelism", "16") // 160 val ssc = new StreamingContext(sparkConf, Seconds(1)) val spark = new SparkContext(sparkConf) // Get the HBase RDD val HogRDD = HogHBaseRDD.connect(spark); val lines = ssc.socketTextStream("localhost", 9999,StorageLevel.MEMORY_AND_DISK_SER) val HogRDDAuth = HogHBaseRDD.connectAuth(spark); HogAuth.run(HogRDDAuth,spark); val words = lines.flatMap(_.split(" ")) val wordCounts = words.map(x => (x, 1)).reduceByKey(_ + _) wordCounts.print() ssc.start() ssc.awaitTermination() // Stop Spark spark.stop() // Close the HBase Connection HogHBaseRDD.close(); } }
gpl-2.0
arrivu/elearning-wordpress
wp-content/plugins/woocommerce-product-sort-and-display-------/classes/class-wc-psad-admin-hook.php
16362
<?php /** * WC_PSAD_Settings_Hook Class * * Class Function into WooCommerce plugin * * Table Of Contents * __construct() * psad_add_category_fields() * psad_edit_category_fields() * psad_category_fields_save() * */ class WC_PSAD_Settings_Hook { public function __construct() { add_action( 'product_cat_add_form_fields', array( &$this, 'psad_add_category_fields'), 11 ); add_action( 'product_cat_edit_form', array( &$this, 'psad_edit_category_fields' ), 10, 1 ); } public function psad_add_category_fields(){ ?> <style> #a3_upgrade_area_box { border:2px solid #E6DB55;-webkit-border-radius:10px;-moz-border-radius:10px;-o-border-radius:10px; border-radius: 10px; padding:10px; position:relative} #a3_upgrade_area_box legend {margin-left:4px; font-weight:bold;} </style> <fieldset id="a3_upgrade_area_box"><legend><?php _e('Upgrade to','wc_psad'); ?> <a href="<?php echo WC_PSAD_AUTHOR_URI; ?>" target="_blank"><?php _e('Pro Version', 'wc_psad'); ?></a> <?php _e('to activate', 'wc_psad'); ?></legend> <h3><?php _e('a3rev Shop Page Categories', 'wc_psad'); ?></h3> <div><?php _e("The WooCommerce 'Display type' settings above do not apply to Shop page Categories. They do apply to the a3rev Category Page settings below.", 'wc_psad'); ?></div> <div class="form-field"> <label for="psad_shop_product_per_page"><?php _e( 'Products per Category', 'wc_psad' ); ?></label> <input disabled="disabled" id="psad_shop_product_per_page" name="psad_shop_product_per_page" type="text" style="width:120px;" value="" /> <p class="description"><?php _e("Set the number of products to show per Category on Shop pages.", 'wc_psad'); ?> <?php _e('Empty to use global settings.', 'wc_psad'); ?></p> </div> <div class="form-field"> <label for="psad_shop_product_show_type"><?php _e( 'Product Sort', 'wc_psad' ); ?></label> <select id="psad_shop_product_show_type" name="psad_shop_product_show_type" class="postform" style="width:120px;"> <option value=""><?php _e( 'Global Settings', 'wc_psad' ); ?></option> <option value="none"><?php _e( 'Default (Recent)', 'wc_psad' ); ?></option> <option value="onsale"><?php _e( 'On Sale', 'wc_psad' ); ?></option> <option value="featured"><?php _e( 'Featured', 'wc_psad' ); ?></option> </select> </div> <h3><?php _e('a3rev Category Page', 'wc_psad'); ?></h3> <div><?php _e("'Display type' settings: Select 'Both' to show Parent Cat products and Child Cats with Products on the one page. Select 'Products' if this category has just products. Select 'Subcategories' to show just this Categories Sub cats and Products. Then use the settings below to configure the product display.", 'wc_psad'); ?></div> <div class="form-field"> <label for="psad_category_product_nosub_per_page"><?php _e( 'Category Products (No Sub Cats)', 'wc_psad' ); ?></label> <input disabled="disabled" id="psad_category_product_nosub_per_page" name="psad_category_product_nosub_per_page" type="text" style="width:120px;" value="" /> <p class="description"><?php _e("The number of products to show per Endless Scroll or pagination.", 'wc_psad'); ?> <?php _e('Empty to use global settings.', 'wc_psad'); ?></p> </div> <div class="form-field"> <label for="psad_top_product_per_page"><?php _e( 'Parent Category Products', 'wc_psad' ); ?></label> <input disabled="disabled" id="psad_top_product_per_page" name="psad_top_product_per_page" type="text" style="width:120px;" value="" /> <p class="description"><?php _e("Sets the number of Parent Category Products to show before Child Cat Product Groups.", 'wc_psad'); ?> <?php _e('Empty to use global settings.', 'wc_psad'); ?></p> </div> <div class="form-field"> <label for="psad_category_per_page"><?php _e( 'Sub Categories Per Page', 'wc_psad' ); ?></label> <input disabled="disabled" id="psad_category_per_page" name="psad_category_per_page" type="text" style="width:120px;" value="" /> <p class="description"><?php _e('Set the number of Sub Category product groups to show per pagination or endless scroll event.', 'wc_psad'); ?> <?php _e('Empty to use global settings.', 'wc_psad'); ?></p> </div> <div class="form-field"> <label for="psad_product_per_page"><?php _e( 'Products per Sub Category', 'wc_psad' ); ?></label> <input disabled="disabled" id="psad_product_per_page" name="psad_product_per_page" type="text" style="width:120px;" value="" /> <p class="description"><?php _e("Set the number of products to show per sub Category.", 'wc_psad'); ?> <?php _e('Empty to use global settings.', 'wc_psad'); ?></p> </div> <div class="form-field"> <label for="psad_product_show_type"><?php _e( 'Product Sort', 'wc_psad' ); ?></label> <select id="psad_product_show_type" name="psad_product_show_type" class="postform" style="width:120px;"> <option value=""><?php _e( 'Global Settings', 'wc_psad' ); ?></option> <option value="none"><?php _e( 'Default (Recent)', 'wc_psad' ); ?></option> <option value="onsale"><?php _e( 'On Sale', 'wc_psad' ); ?></option> <option value="featured"><?php _e( 'Featured', 'wc_psad' ); ?></option> </select> </div> </fieldset> <?php } public function psad_edit_category_fields($term){ ?> <style> #a3_upgrade_area_box { border:2px solid #E6DB55;-webkit-border-radius:10px;-moz-border-radius:10px;-o-border-radius:10px; border-radius: 10px; padding:10px; position:relative} #a3_upgrade_area_box legend {margin-left:4px; font-weight:bold;} </style> <fieldset id="a3_upgrade_area_box"><legend><?php _e('Upgrade to','wc_psad'); ?> <a href="<?php echo WC_PSAD_AUTHOR_URI; ?>" target="_blank"><?php _e('Pro Version', 'wc_psad'); ?></a> <?php _e('to activate', 'wc_psad'); ?></legend> <h3><?php _e('a3rev Shop Page Categories', 'wc_psad'); ?></h3> <div><?php _e("The WooCommerce 'Display type' settings above do not apply to Shop page Categories. They do apply to the a3rev Category Page settings below.", 'wc_psad'); ?></div> <table class="form-table"> <tr class="form-field"> <th scope="row" valign="top"><label for="psad_shop_product_per_page"><?php _e( 'Products per Category', 'wc_psad' ); ?></label></th> <td> <input disabled="disabled" id="psad_shop_product_per_page" name="psad_shop_product_per_page" type="text" style="width:120px;" value="" /> <p class="description"><?php _e("Set the number of products to show per Category on Shop pages.", 'wc_psad'); ?> <?php _e('Empty to use global settings.', 'wc_psad'); ?></p> </td> </tr> <tr class="form-field"> <th scope="row" valign="top"><label for="psad_shop_product_show_type"><?php _e( 'Product Sort', 'wc_psad' ); ?></label></th> <td> <select id="psad_shop_product_show_type" name="psad_shop_product_show_type" class="postform" style="width:120px;"> <option value="" selected="selected"><?php _e( 'Global Settings', 'wc_psad' ); ?></option> <option value="none"><?php _e( 'Default (Recent)', 'wc_psad' ); ?></option> <option value="onsale"><?php _e( 'On Sale', 'wc_psad' ); ?></option> <option value="featured"><?php _e( 'Featured', 'wc_psad' ); ?></option> </select> </td> </tr> </table> <h3><?php _e('a3rev Category Page', 'wc_psad'); ?></h3> <div><?php _e("'Display type' settings: Select 'Both' to show Parent Cat products and Child Cats with Products on the one page. Select 'Products' if this category has just products. Select 'Subcategories' to show just this Categories Sub cats and Products. Then use the settings below to configure the product display.", 'wc_psad'); ?></div> <table class="form-table"> <tr class="form-field"> <th scope="row" valign="top"><label for="psad_category_product_nosub_per_page"><?php _e( 'Category Products (No Sub Cats)', 'wc_psad' ); ?></label></th> <td> <input disabled="disabled" id="psad_category_product_nosub_per_page" name="psad_category_product_nosub_per_page" type="text" style="width:120px;" value="" /> <p class="description"><?php _e("The number of products to show per Endless Scroll or pagination.", 'wc_psad'); ?> <?php _e('Empty to use global settings.', 'wc_psad'); ?></p> </td> </tr> <tr class="form-field"> <th scope="row" valign="top"><label for="psad_top_product_per_page"><?php _e( 'Parent Category Products', 'wc_psad' ); ?></label></th> <td> <input disabled="disabled" id="psad_top_product_per_page" name="psad_top_product_per_page" type="text" style="width:120px;" value="" /> <p class="description"><?php _e("Sets the number of Parent Category Products to show before Child Cat Product Groups.", 'wc_psad'); ?> <?php _e('Empty to use global settings.', 'wc_psad'); ?></p> </td> </tr> <tr class="form-field"> <th scope="row" valign="top"><label for="psad_category_per_page"><?php _e( 'Sub Categories Per Page', 'wc_psad' ); ?></label></th> <td> <input disabled="disabled" id="psad_category_per_page" name="psad_category_per_page" type="text" style="width:120px;" value="" /> <p class="description"><?php _e('Set the number of Sub Category product groups to show per pagination or endless scroll event.', 'wc_psad'); ?> <?php _e('Empty to use global settings.', 'wc_psad'); ?></p> </td> </tr> <tr class="form-field"> <th scope="row" valign="top"><label for="psad_product_per_page"><?php _e( 'Products per Sub Category', 'wc_psad' ); ?></label></th> <td> <input disabled="disabled" id="psad_product_per_page" name="psad_product_per_page" type="text" style="width:120px;" value="" /> <p class="description"><?php _e("Set the number of products to show per sub Category.", 'wc_psad'); ?> <?php _e('Empty to use global settings.', 'wc_psad'); ?></p> </td> </tr> <tr class="form-field"> <th scope="row" valign="top"><label for="psad_product_show_type"><?php _e( 'Product Sort', 'wc_psad' ); ?></label></th> <td> <select id="psad_product_show_type" name="psad_product_show_type" class="postform" style="width:120px;"> <option value="" selected="selected"><?php _e( 'Global Settings', 'wc_psad' ); ?></option> <option value="none"><?php _e( 'Default (Recent)', 'wc_psad' ); ?></option> <option value="onsale"><?php _e( 'On Sale', 'wc_psad' ); ?></option> <option value="featured"><?php _e( 'Featured', 'wc_psad' ); ?></option> </select> </td> </tr> </table> </fieldset> <?php } public function plugin_extension() { $html = ''; $html .= '<div id="a3_plugin_panel_extensions">'; $html .= '<a href="http://a3rev.com/shop/" target="_blank" style="float:right;margin-top:5px; margin-left:10px;" ><img src="'.WC_PSAD_IMAGES_URL.'/a3logo.png" /></a>'; $html .= '<h3>'.__('Upgrade to Product Sort and Display Pro', 'wc_psad').'</h3>'; $html .= '<p>'.__("<strong>NOTE:</strong> All the functions inside the Yellow border on the plugins admin panel are extra functionality that is activated by upgrading to the Pro version", 'wc_psad').':</p>'; $html .= '<p>'; $html .= '<h3 style="margin-bottom:5px;">* <a href="'.WC_PSAD_AUTHOR_URI.'" target="_blank">'.__('WooCommerce Product Sort and Display Pro', 'wc_psad').'</a></h3>'; $html .= '<div><strong>'.__('Activates these advanced Features', 'wc_psad').':</strong></div>'; $html .= '<p>'; $html .= '<ul style="padding-left:10px;">'; $html .= '<li>1. '.__("Sort by 'On Sale' on all Product Category pages.", 'wc_psad').'</li>'; $html .= '<li>2. '.__("Sort by 'Featured' on all Product Category pages.", 'wc_psad').'</li>'; $html .= '<li>3. '.__('Category by Category Sort and Display settings for Shop page.', 'wc_psad').'</li>'; $html .= '<li>4. '.__('Category by Category Sort and display settings for Product Cat pages.', 'wc_psad').'</li>'; $html .= '<li>5. '.__('Endless Scroll feature for the entire store (Category pages).', 'wc_psad').'</li>'; $html .= '<li>6. '.__('Category pages Endless Scroll on Click WYSIWYG style editor.', 'wc_psad').'</li>'; $html .= '<li>7. '.__('Parent Category page show parent cat products and Child Cats with products.', 'wc_psad').'</li>'; $html .= '<li>8. '.__("Set number of products to show on parent cat before sub cats.", 'wc_psad').'</li>'; $html .= '<li>9. '.__("WYSIWYG count meta styling and position.", 'wc_psad').'</li>'; $html .= '<li>10. '.__("Lifetime priority same day support.", 'wc_psad').'</li>'; $html .= '</ul>'; $html .= '</p>'; $html .= '<h3>'.__('View this plugins', 'wc_psad').' <a href="http://docs.a3rev.com/user-guides/plugins-extensions/woocommerce/product-sort-and-display/" target="_blank">'.__('documentation', 'wc_psad').'</a></h3>'; $html .= '<h3>'.__('Visit this plugins', 'wc_psad').' <a href="http://wordpress.org/support/plugin/woocommerce-product-sort-and-display/" target="_blank">'.__('support forum', 'wc_psad').'</a></h3>'; $html .= '<h3>'.__('More FREE a3rev WooCommerce Plugins', 'wc_psad').'</h3>'; $html .= '<p>'; $html .= '<ul style="padding-left:10px;">'; $html .= '<li>* <a href="http://wordpress.org/plugins/woocommerce-dynamic-gallery/" target="_blank">'.__('WooCommerce Dynamic Products Gallery', 'wc_psad').'</a></li>'; $html .= '<li>* <a href="http://wordpress.org/plugins/woocommerce-predictive-search/" target="_blank">'.__('WooCommerce Predictive Search', 'wc_psad').'</a></li>'; $html .= '<li>* <a href="http://wordpress.org/plugins/woocommerce-compare-products/" target="_blank">'.__('WooCommerce Compare Products', 'wc_psad').'</a></li>'; $html .= '<li>* <a href="http://wordpress.org/plugins/woo-widget-product-slideshow/" target="_blank">'.__('WooCommerce Widget Product Slideshow', 'wc_psad').'</a></li>'; $html .= '<li>* <a href="http://wordpress.org/plugins/woocommerce-email-inquiry-cart-options/" target="_blank">'.__('WooCommerce Email Inquiry & Cart Options', 'wc_psad').'</a></li>'; $html .= '<li>* <a href="http://a3rev.com/shop/woocommerce-email-inquiry-ultimate/" target="_blank">'.__('WooCommerce Email Inquiry Ultimate (Pro Only)', 'wc_psad').'</a></li>'; $html .= '<li>* <a href="http://a3rev.com/shop/woocommerce-quotes-and-orders/" target="_blank">'.__('WooCommerce Quotes and Orders (Pro Only)', 'wc_psad').'</a></li>'; $html .= '</ul>'; $html .= '</p>'; $html .= '<h3>'.__('FREE a3rev WordPress Plugins', 'wc_psad').'</h3>'; $html .= '<p>'; $html .= '<ul style="padding-left:10px;">'; $html .= '<li>* <a href="http://wordpress.org/plugins/contact-us-page-contact-people/" target="_blank">'.__('Contact Us Page - Contact People', 'wc_psad').'</a></li>'; $html .= '<li>* <a href="http://wordpress.org/plugins/wp-email-template/" target="_blank">'.__('WordPress Email Template', 'wc_psad').'</a></li>'; $html .= '<li>* <a href="http://wordpress.org/plugins/page-views-count/" target="_blank">'.__('Page View Count', 'wc_psad').'</a></li>'; $html .= '</ul>'; $html .= '</p>'; $html .= '</div>'; return $html; } public function plugin_extra_links($links, $plugin_name) { if ( $plugin_name != WC_PSAD_NAME) { return $links; } $links[] = '<a href="http://docs.a3rev.com/user-guides/plugins-extensions/woocommerce/product-sort-and-display/" target="_blank">'.__('Documentation', 'wc_psad').'</a>'; $links[] = '<a href="http://wordpress.org/support/plugin/woocommerce-product-sort-and-display/" target="_blank">'.__('Support', 'wc_psad').'</a>'; return $links; } } ?>
gpl-2.0
lstyls/ml_coursework_python
learning/scoring.py
312
import numpy as np def inf_entropy(cond_probs): entropy = 0 for p in cond_probs: if p != 0: entropy -= p*np.log2(p) return entropy def gini(cond_probs): return 1-np.sum(pow(np.array(cond_probs),2)) def rand(cond_probs): return np.random.rand()
gpl-2.0
AllAboutDatBass/SmartCommandLine
SCL/MainWindow.cs
12429
/* SmartCommandLine - A DOS commandline wrapper Copyright (C) 2010 Daniel Randall 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.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Diagnostics; using System.IO; using System.Runtime.InteropServices; namespace SCL { public partial class MainWindow : Form { protected Process cmd; protected StreamWriter input; protected List<string> history; protected int historyIterator = 0; protected List<string> files; protected int fileIterator = 0; delegate void CloseCallback(); delegate void WriteLineCallback( RichTextBox textBox, string text, string wasDir, Color color); delegate void SetReadOnlyCallback( TextBox textBox, bool state); private string _wasDir = ""; public MainWindow() { InitializeComponent(); history = new List<string>(); files = new List<string>(); tbCommands.PreviewKeyDown += new PreviewKeyDownEventHandler(tbCommands_PreviewKeyDown); Process cmd; cmd = new Process(); cmd.StartInfo.FileName = "cmd.exe"; cmd.StartInfo.UseShellExecute = false; cmd.StartInfo.CreateNoWindow = true; cmd.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory(); cmd.Exited += new EventHandler(cmd_Exited); cmd.StartInfo.RedirectStandardOutput = true; cmd.OutputDataReceived += new DataReceivedEventHandler(cmd_OutputDataReceived); cmd.StartInfo.RedirectStandardError = true; cmd.ErrorDataReceived += new DataReceivedEventHandler(cmd_ErrorDataReceived); cmd.StartInfo.RedirectStandardInput = true; cmd.Start(); input = cmd.StandardInput; cmd.BeginOutputReadLine(); cmd.BeginErrorReadLine(); this.tbCommands.Focus(); } void cmd_Exited(object sender, EventArgs e) { this.Invoke(new CloseCallback(Close), null); } static void AddItem( ListBox listBox, string text) { if (text.Equals("\f")) { // "cls" command returned character for clear screen: listBox.Items.Clear(); } else { int nItem = listBox.Items.Add(text); listBox.TopIndex = nItem; } } static void SetReadOnly( TextBox textBox, bool state) { textBox.ReadOnly = state; textBox.BackColor = state ? SystemColors.GrayText : SystemColors.WindowText; textBox.ForeColor = state ? SystemColors.WindowText : SystemColors.Window; if (!state) { textBox.Clear(); } textBox.Focus(); } void cmd_ErrorDataReceived( object sender, DataReceivedEventArgs e) { if (null == e.Data) { this.Invoke(new CloseCallback(Close), null); } else { this.Invoke(new WriteLineCallback(WriteLine), new object[] { tbOutput, e.Data, _wasDir, Color.Red }); this.Invoke(new SetReadOnlyCallback(SetReadOnly), new object[]{tbCommands, false}); } } private void cmd_OutputDataReceived( object sendingProcess, DataReceivedEventArgs e) { if (null == e.Data) { this.Invoke(new CloseCallback(Close), null); } else { this.Invoke(new WriteLineCallback(WriteLine), new object[] { tbOutput, e.Data, _wasDir, Color.White }); this.Invoke(new SetReadOnlyCallback(SetReadOnly), new object[] { tbCommands, false }); } } static void WriteLine( RichTextBox textBox, string text, string wasDir, Color color) { if (text.Length < 1) { return; } if (text.Equals("\f")) { // "cls" command returned character for clear screen: textBox.ResetText(); } else { string curDir = Directory.GetCurrentDirectory(); if ((wasDir.Length > 0) && text.StartsWith(wasDir)) { text = text.Replace(wasDir, ""); textBox.SelectionColor = Color.LightGreen; } else { textBox.SelectionColor = color; } textBox.SelectionStart = textBox.Text.Length; textBox.SelectionLength = 0; if (!(text.Contains('\r') || text.Contains('\n'))) { text += "\r\n"; } textBox.AppendText(text); textBox.ScrollToCaret(); } } void tbCommands_PreviewKeyDown( object sender, PreviewKeyDownEventArgs e) { bool fTabbing = false; switch (e.KeyCode) { case Keys.Enter: { // retain where we were: // _wasDir = cmd ; _wasDir = ""; // strip out the special whitespace characters: tbCommands.Text = tbCommands.Text.Replace((char)0x00A0, ' '); input.WriteLine(tbCommands.Text); history.Add(tbCommands.Text); //tbCommands.Clear(); SetReadOnly(tbCommands, true); break; } case Keys.Up: { tbCommands.Text = GetHistory(true); break; } case Keys.Down: { tbCommands.Text = GetHistory(false); tbCommands.SelectionStart = tbCommands.Text.Length; tbCommands.SelectionLength = 0; break; } case Keys.Escape: { tbCommands.Clear(); break; } case Keys.Tab: { fTabbing = true; string substring = ""; int space = tbCommands.Text.LastIndexOf(' ') + 1; if (space > 1) { if (space < tbCommands.Text.Length) { substring = tbCommands.Text.Substring(space); tbCommands.Text = tbCommands.Text.Remove(space); } } else { substring = tbCommands.Text; tbCommands.Text = ""; } if (e.Shift) { tbCommands.Text += GetFiles(substring, false); } else { tbCommands.Text += GetFiles(substring, true); } tbCommands.SelectionStart = tbCommands.Text.Length; tbCommands.SelectionLength = 0; break; } } if (!fTabbing) { files.Clear(); } } protected string GetHistory( bool fUp) { int dir = fUp ? -1 : 1; historyIterator += dir; int range = history.Count; if (range > 0) { if (historyIterator < 0) { historyIterator = range - 1; } if (historyIterator < range) { return history[historyIterator]; } else { historyIterator = 0; return history[historyIterator]; } } return ""; } protected string GetFiles( string search, bool fUp) { if (files.Count < 1) { if (search.Length < 1) { // search for all files: search = "*.*"; } else if ((!search.Contains('*')) && (!search.Contains('?'))) { // append wildcard for prefix search: search += "*"; } fileIterator = 0; string path = Directory.GetCurrentDirectory(); // collect files: string[] list = Directory.GetFiles(path, search, SearchOption.TopDirectoryOnly); foreach (string filename in list) { string wrapped = Path.GetFileName(filename); if (wrapped.Contains(' ')) { // wrap filename in quotes: wrapped = "\"" + wrapped + "\""; } files.Add(wrapped.Replace(' ', (char)0x00A0)); } } int range = files.Count; if (range > 0) { if (fUp) { fileIterator++; if (fileIterator >= range) { // wrap around to head of list: fileIterator = 0; } } else { fileIterator--; if (fileIterator < 0) { // wrap around to end of list: fileIterator += range; } } return files[fileIterator]; } return ""; } private void tbCommands_TextChanged( object sender, EventArgs e) { } } }
gpl-2.0
csd/csd
lib/csd/application/minisip/error.rb
524
# -*- encoding: UTF-8 -*- require 'csd/error' module CSD module Error module Minisip # See 'csd/error' to find out which status code range has been assigned to MiniSIP class BuildDirNotFound < CSDError; status_code(200); end class Amd64NotSupported < CSDError; status_code(201); end module Core class FFmpegInstalled < CSDError; status_code(210); end class PackagingNeedsInstalledMinisip < CSDError; status_code(220); end end end end end
gpl-2.0
goranefbl/swifty-bar
admin/class-sb-bar-admin.php
20611
<?php /** * Admin Part of Plugin, dashboard and options. * * @package sb_bar * @subpackage sb_bar/admin */ class sb_bar_Admin { /** * The ID of this plugin. * * @since 1.0.0 * @access private * @var string $sb_bar The ID of this plugin. */ private $sb_bar; /** * The version of this plugin. * * @since 1.0.0 * @access private * @var string $version The current version of this plugin. */ private $version; /** * Initialize the class and set its properties. * * @since 1.0.0 * @var string $sb_bar The name of this plugin. * @var string $version The version of this plugin. */ public function __construct( $sb_bar, $version ) { $this->sb_bar = $sb_bar; $this->version = $version; } /** * Register the Settings page. * * @since 1.0.0 */ public function sb_bar_admin_menu() { add_options_page( __('Swifty Bar', $this->sb_bar), __('Swifty Bar', $this->sb_bar), 'manage_options', $this->sb_bar, array($this, 'display_plugin_admin_page')); } /** * Callback function for the admin settings page. * * @since 1.0.0 */ public function display_plugin_admin_page(){ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/partials/sb-bar-admin-display.php'; } /** * Plugin Settings Link on plugin page * * @since 1.0.0 * @return mixed The settings field */ function add_settings_link( $links ) { $mylinks = array( '<a href="' . admin_url( 'options-general.php?page=sb_bar' ) . '">Settings</a>', ); return array_merge( $links, $mylinks ); } /** * Creates our settings sections with fields etc. * * @since 1.0.0 */ public function settings_api_init(){ // register_setting( $option_group, $option_name, $sanitize_callback ); register_setting( $this->sb_bar . '_options', $this->sb_bar . '_options', array( $this, 'sanitize' ) ); // add_settings_section( $id, $title, $callback, $menu_slug ); add_settings_section( $this->sb_bar . '-display-options', // section apply_filters( $this->sb_bar . '-display-section-title', __( '', $this->sb_bar ) ), array( $this, 'display_options_section' ), $this->sb_bar ); // add_settings_field( $id, $title, $callback, $menu_slug, $section, $args ); add_settings_field( 'disable-bar', apply_filters( $this->sb_bar . '-disable-bar-label', __( 'Disable Bar', $this->sb_bar ) ), array( $this, 'disable_bar_options_field' ), $this->sb_bar, $this->sb_bar . '-display-options' // section to add to ); add_settings_field( 'post-type', apply_filters( $this->sb_bar . '-post-type-label', __( 'Show on which post types', $this->sb_bar ) ), array( $this, 'post_type' ), $this->sb_bar, $this->sb_bar . '-display-options' // section to add to ); add_settings_field( 'ttr-text', apply_filters( $this->sb_bar . '-ttr-text-label', __( 'Change "Time to read" text', $this->sb_bar ) ), array( $this, 'ttr_input_field' ), $this->sb_bar, $this->sb_bar . '-display-options' ); add_settings_field( 'by-text', apply_filters( $this->sb_bar . '-author-text-label', __( 'Change Author "by" text', $this->sb_bar ) ), array( $this, 'author_input_field' ), $this->sb_bar, $this->sb_bar . '-display-options' ); add_settings_field( 'wpm-left', apply_filters( $this->sb_bar . '-wpm-left', __( 'Words Per Minute', $this->sb_bar ) ), array( $this, 'wpm_field' ), $this->sb_bar, $this->sb_bar . '-display-options' ); add_settings_field( 'comment-box-id', apply_filters( $this->sb_bar . '-comment-box-label', __( 'Comment box ID', $this->sb_bar ) ), array( $this, 'comment_box_id' ), $this->sb_bar, $this->sb_bar . '-display-options' ); add_settings_field( 'prev-next-posts', apply_filters( $this->sb_bar . '-prev-next-posts', __( 'Prev/Next Posts', $this->sb_bar ) ), array( $this, 'prev_next_posts' ), $this->sb_bar, $this->sb_bar . '-display-options' ); add_settings_field( 'custom-color', apply_filters( $this->sb_bar . '-custom-color', __( 'Choose Color', $this->sb_bar ) ), array( $this, 'custom_color' ), $this->sb_bar, $this->sb_bar . '-display-options' ); add_settings_field( 'custom-title', apply_filters( $this->sb_bar . '-custom-title', __( 'Shorten Big Post Titles', $this->sb_bar ) ), array( $this, 'custom_title' ), $this->sb_bar, $this->sb_bar . '-display-options' ); // add_settings_section( $id, $title, $callback, $menu_slug ); add_settings_section( $this->sb_bar . '-enable-options', // section apply_filters( $this->sb_bar . '-display-section-title', __( '', $this->sb_bar ) ), array( $this, 'display_options_section' ), $this->sb_bar . '-enable' ); add_settings_field( 'disable-author', apply_filters( $this->sb_bar . '-disable-author', __( 'Disable Author', $this->sb_bar ) ), array( $this, 'disable_author' ), $this->sb_bar . '-enable', $this->sb_bar . '-enable-options' ); add_settings_field( 'disable-ttr', apply_filters( $this->sb_bar . '-disable-ttr', __( 'Disable Time to Read', $this->sb_bar ) ), array( $this, 'disable_ttr' ), $this->sb_bar . '-enable', $this->sb_bar . '-enable-options' ); add_settings_field( 'disable-comments', apply_filters( $this->sb_bar . '-disable-comments', __( 'Disable Comments', $this->sb_bar ) ), array( $this, 'disable_comments' ), $this->sb_bar . '-enable', $this->sb_bar . '-enable-options' ); add_settings_field( 'disable-share', apply_filters( $this->sb_bar . '-disable-share', __( 'Disable Share', $this->sb_bar ) ), array( $this, 'disable_share' ), $this->sb_bar . '-enable', $this->sb_bar . '-enable-options' ); add_settings_field( 'disable-pinterest', apply_filters( $this->sb_bar . '-disable-pinterest', __( 'Disable Pinterest Button', $this->sb_bar ) ), array( $this, 'disable_pinterest' ), $this->sb_bar . '-enable', $this->sb_bar . '-enable-options' ); add_settings_field( 'disable-linkedin', apply_filters( $this->sb_bar . '-disable-linkedin', __( 'Disable LinkedIn Button', $this->sb_bar ) ), array( $this, 'disable_linkedin' ), $this->sb_bar . '-enable', $this->sb_bar . '-enable-options' ); add_settings_field( 'disable-googleplus', apply_filters( $this->sb_bar . '-disable-googleplus', __( 'Disable Google Plus Button', $this->sb_bar ) ), array( $this, 'disable_googleplus' ), $this->sb_bar . '-enable', $this->sb_bar . '-enable-options' ); add_settings_field( 'disable-twitter', apply_filters( $this->sb_bar . '-disable-twitter', __( 'Disable Twitter Button', $this->sb_bar ) ), array( $this, 'disable_twitter' ), $this->sb_bar . '-enable', $this->sb_bar . '-enable-options' ); add_settings_field( 'smaller-facebook', apply_filters( $this->sb_bar . '-smaller-facebook', __( 'Hide "Share on Facebook" Button text', $this->sb_bar ) ), array( $this, 'smaller_facebook' ), $this->sb_bar . '-enable', $this->sb_bar . '-enable-options' ); add_settings_field( 'disable-facebook', apply_filters( $this->sb_bar . '-disable-facebook', __( 'Disable Facebook Button (Why would you do that?)', $this->sb_bar ) ), array( $this, 'disable_facebook' ), $this->sb_bar . '-enable', $this->sb_bar . '-enable-options' ); } /** * Validates saved options * * @since 1.0.0 * @param array $input array of submitted plugin options * @return array array of validated plugin options */ public function sanitize( $input ) { // Initialize the new array that will hold the sanitize values $new_input = array(); if(isset($input)) { // Loop through the input and sanitize each of the values foreach ( $input as $key => $val ) { if($key == 'post-type') { // dont sanitize array $new_input[ $key ] = $val; } else { $new_input[ $key ] = sanitize_text_field( $val ); } } } return $new_input; } // sanitize() /** * Creates a settings section * * @since 1.0.0 * @param array $params Array of parameters for the section * @return mixed The settings section */ public function display_options_section( $params ) { echo '<p>' . $params['title'] . '</p>'; } // display_options_section() /** * Enable Bar Field * * @since 1.0.0 * @return mixed The settings field */ public function disable_bar_options_field() { $options = get_option( $this->sb_bar . '_options' ); $option = 0; if ( ! empty( $options['disable-bar'] ) ) { $option = $options['disable-bar']; } ?><input type="checkbox" id="<?php echo $this->sb_bar; ?>_options[disable-bar]" name="<?php echo $this->sb_bar; ?>_options[disable-bar]" value="1" <?php checked( $option, 1 , true ); ?> /> <p class="description">Disabling bar is also disabling front end loading of scripts css/js.</p> <?php } // disable_bar_options_field() /** * Post Type Selection Field * * @since 1.0.0 * @return mixed The settings field */ public function post_type() { $options = get_option( $this->sb_bar . '_options' ); $option = array(); if ( ! empty( $options['post-type'] ) ) { $option = $options['post-type']; } $args = array( 'public' => true ); $post_types = get_post_types( $args, 'names' ); foreach ( $post_types as $post_type ) { if($post_type != 'page' && $post_type != 'attachment') { $checked = in_array($post_type, $option) ? 'checked="checked"' : ''; ?> <p> <input type="checkbox" id="<?php echo $this->sb_bar; ?>_options[post-type]" name="<?php echo $this->sb_bar; ?>_options[post-type][]" value="<?php echo esc_attr( $post_type ); ?>" <?php echo $checked; ?> /> <?php echo $post_type; ?> </p> <?php } } ?> <p class="description">IMPORTANT: Bar will not show up until one of these is checked.</p> <?php } // post_type() /** * Time to read text field * * @since 1.0.0 * @return mixed The settings field */ public function ttr_input_field() { $options = get_option( $this->sb_bar . '_options' ); $option = 'time to read:'; if ( ! empty( $options['ttr-text'] ) ) { $option = $options['ttr-text']; } ?> <input type="text" id="<?php echo $this->sb_bar; ?>_options[ttr-text]" name="<?php echo $this->sb_bar; ?>_options[ttr-text]" value="<?php echo esc_attr( $option ); ?>"> <?php } // ttr_input_field() /** * Author Text Field * * @since 1.0.0 * @return mixed The settings field */ public function author_input_field() { $options = get_option( $this->sb_bar . '_options' ); $option = 'by'; if ( ! empty( $options['by-text'] ) ) { $option = $options['by-text']; } ?> <input type="text" id="<?php echo $this->sb_bar; ?>_options[by-text]" name="<?php echo $this->sb_bar; ?>_options[by-text]" value="<?php echo esc_attr( $option ); ?>"> <?php } // author_input_field() /** * Word Per Minute Field * * @since 1.0.0 * @return mixed The settings field */ public function wpm_field() { $options = get_option( $this->sb_bar . '_options' ); $option = '250'; if ( ! empty( $options['wpm-text'] ) ) { $option = $options['wpm-text']; } ?> <input type="text" id="<?php echo $this->sb_bar; ?>_options[wpm-text]" name="<?php echo $this->sb_bar; ?>_options[wpm-text]" value="<?php echo esc_attr( $option ); ?>"> <p class="description">They say 250 words per minute is avarage read time, you can increase/decrease it here. After which plugin will calculate new time to read per article.</p> <?php } // wpm_field() /** * Comments box ID * * @since 1.0.0 * @return mixed The settings field */ public function comment_box_id() { $options = get_option( $this->sb_bar . '_options' ); $option = 'comments'; if ( ! empty( $options['comment-box-id'] ) ) { $option = $options['comment-box-id']; } ?> <input type="text" id="<?php echo $this->sb_bar; ?>_options[comment-box-id]" name="<?php echo $this->sb_bar; ?>_options[comment-box-id]" value="<?php echo esc_attr( $option ); ?>"> <p class="description">(without #) This is needed for comment to scroll to comment box on click. Default one is "comments".</p> <?php } // comment_box_id() /** * Prev/Next Posts * * @since 1.0.0 * @return mixed The settings field */ public function prev_next_posts() { $options = get_option( $this->sb_bar . '_options' ); $option = ''; if ( ! empty( $options['prev-next-posts'] ) ) { $option = $options['prev-next-posts']; } ?> <select id="<?php echo $this->sb_bar; ?>_options[prev-next-posts]" name="<?php echo $this->sb_bar; ?>_options[prev-next-posts]" > <option value="cat" <?php selected( $option, "cat" ); ?> >Posts from Same Category</option> <option value="tags" <?php selected( $option, "tags" ); ?> >Posts with same Tags</option> <option value="all" <?php selected( $option, "all" ); ?> >All Posts</option> </select> <p class="description">Do you want prev/next buttons to show posts from all categories or just from current post category?</p> <?php } // prev_next_posts() /** * Custom Color Scheme * * @since 1.1.0 * @return mixed The settings field */ public function custom_color() { $options = get_option( $this->sb_bar . '_options' ); $option = 'default'; if ( ! empty( $options['custom-color'] ) ) { $option = $options['custom-color']; } ?> <select id="<?php echo $this->sb_bar; ?>_options[custom-color]" name="<?php echo $this->sb_bar; ?>_options[custom-color]" > <option value="default" <?php selected( $option, "default" ); ?> >Default (Everyone loves blue)</option> <option value="white" <?php selected( $option, "white" ); ?> >Clouds(White)</option> <option value="green" <?php selected( $option, "green" ); ?> >Green</option> <option value="orange" <?php selected( $option, "orange" ); ?> >Orange</option> <option value="red" <?php selected( $option, "red" ); ?> >Red</option> <option value="purple" <?php selected( $option, "purple" ); ?> >Purple</option> <option value="asphalt" <?php selected( $option, "asphalt" ); ?> >Wet Asphalt</option> </select> <p class="description">Choose one of predefined colors. Color picker will come later, remember - keeping plugin fast and light is priority.</p> <?php } // custom_color() /** * Custom Title * * @since 1.1.1 * @return mixed The settings field */ public function custom_title() { $options = get_option( $this->sb_bar . '_options' ); $option = ''; if ( ! empty( $options['custom-title'] ) ) { $option = $options['custom-title']; } ?> <input type="text" id="<?php echo $this->sb_bar; ?>_options[custom-title]" name="<?php echo $this->sb_bar; ?>_options[custom-title]" value="<?php echo esc_attr( $option ); ?>"> <p class="description">You can shorten long post titles so that share buttons can fit. Enter maximum number of letters title can have before cutting it and placing three dots. Leave blank to always show full title.</p> <?php } // custom_title() /** * Disable Author Box * * @since 1.0.0 * @return mixed The settings field */ public function disable_author() { $options = get_option( $this->sb_bar . '_options' ); $option = 0; if ( ! empty( $options['disable-author'] ) ) { $option = $options['disable-author']; } ?><input type="checkbox" id="<?php echo $this->sb_bar; ?>_options[disable-author]" name="<?php echo $this->sb_bar; ?>_options[disable-author]" value="1" <?php checked( $option, 1 , true ); ?> /> <?php } // disable_author() /** * Disable TTR Box * * @since 1.0.0 * @return mixed The settings field */ public function disable_ttr() { $options = get_option( $this->sb_bar . '_options' ); $option = 0; if ( ! empty( $options['disable-ttr'] ) ) { $option = $options['disable-ttr']; } ?><input type="checkbox" id="<?php echo $this->sb_bar; ?>_options[disable-ttr]" name="<?php echo $this->sb_bar; ?>_options[disable-ttr]" value="1" <?php checked( $option, 1 , true ); ?> /> <?php } // disable_ttr() /** * Disable Share Box * * @since 1.0.0 * @return mixed The settings field */ public function disable_share() { $options = get_option( $this->sb_bar . '_options' ); $option = 0; if ( ! empty( $options['disable-share'] ) ) { $option = $options['disable-share']; } ?><input type="checkbox" id="<?php echo $this->sb_bar; ?>_options[disable-share]" name="<?php echo $this->sb_bar; ?>_options[disable-share]" value="1" <?php checked( $option, 1 , true ); ?> /> <?php } // disable_share() /** * Disable Comments Box * * @since 1.0.0 * @return mixed The settings field */ public function disable_comments() { $options = get_option( $this->sb_bar . '_options' ); $option = 0; if ( ! empty( $options['disable-comments'] ) ) { $option = $options['disable-comments']; } ?><input type="checkbox" id="<?php echo $this->sb_bar; ?>_options[disable-comments]" name="<?php echo $this->sb_bar; ?>_options[disable-comments]" value="1" <?php checked( $option, 1 , true ); ?> /> <?php } // disable_comments() /** * Disable Pinterest Button * * @since 1.1.1 * @return mixed The settings field */ public function disable_pinterest() { $options = get_option( $this->sb_bar . '_options' ); $option = 0; if ( ! empty( $options['disable-pinterest'] ) ) { $option = $options['disable-pinterest']; } ?><input type="checkbox" id="<?php echo $this->sb_bar; ?>_options[disable-pinterest]" name="<?php echo $this->sb_bar; ?>_options[disable-pinterest]" value="1" <?php checked( $option, 1 , true ); ?> /> <?php } // disable_pinterest() /** * Disable Linkedin Button * * @since 1.1.1 * @return mixed The settings field */ public function disable_linkedin() { $options = get_option( $this->sb_bar . '_options' ); $option = 0; if ( ! empty( $options['disable-linkedin'] ) ) { $option = $options['disable-linkedin']; } ?><input type="checkbox" id="<?php echo $this->sb_bar; ?>_options[disable-linkedin]" name="<?php echo $this->sb_bar; ?>_options[disable-linkedin]" value="1" <?php checked( $option, 1 , true ); ?> /> <?php } // disable_linkedin() /** * Disable Google Plus * * @since 1.1.1 * @return mixed The settings field */ public function disable_googleplus() { $options = get_option( $this->sb_bar . '_options' ); $option = 0; if ( ! empty( $options['disable-googleplus'] ) ) { $option = $options['disable-googleplus']; } ?><input type="checkbox" id="<?php echo $this->sb_bar; ?>_options[disable-googleplus]" name="<?php echo $this->sb_bar; ?>_options[disable-googleplus]" value="1" <?php checked( $option, 1 , true ); ?> /> <?php } // disable_googleplus() /** * Disable Twitter * * @since 1.1.1 * @return mixed The settings field */ public function disable_twitter() { $options = get_option( $this->sb_bar . '_options' ); $option = 0; if ( ! empty( $options['disable-twitter'] ) ) { $option = $options['disable-twitter']; } ?><input type="checkbox" id="<?php echo $this->sb_bar; ?>_options[disable-twitter]" name="<?php echo $this->sb_bar; ?>_options[disable-twitter]" value="1" <?php checked( $option, 1 , true ); ?> /> <?php } // disable_twitter() /** * Smaller Facebook * * @since 1.1.2 * @return mixed The settings field */ public function smaller_facebook() { $options = get_option( $this->sb_bar . '_options' ); $option = 0; if ( ! empty( $options['smaller-facebook'] ) ) { $option = $options['smaller-facebook']; } ?><input type="checkbox" id="<?php echo $this->sb_bar; ?>_options[smaller-facebook]" name="<?php echo $this->sb_bar; ?>_options[smaller-facebook]" value="1" <?php checked( $option, 1 , true ); ?> /> <?php } // smaller_facebook() /** * Disable Facebook * * @since 1.1.1 * @return mixed The settings field */ public function disable_facebook() { $options = get_option( $this->sb_bar . '_options' ); $option = 0; if ( ! empty( $options['disable-facebook'] ) ) { $option = $options['disable-facebook']; } ?><input type="checkbox" id="<?php echo $this->sb_bar; ?>_options[disable-facebook]" name="<?php echo $this->sb_bar; ?>_options[disable-facebook]" value="1" <?php checked( $option, 1 , true ); ?> /> <?php } // disable_facebook() }
gpl-2.0
adum/bitbath
Engine/src/org/hacker/engine/war/CountdownViewer.java
1022
package org.hacker.engine.war; import java.awt.Font; import java.awt.Graphics2D; import org.hacker.engine.GameModel; /** * displays a 3..2..1 countdown. * this lets people adjust speed before replay starts. */ public class CountdownViewer extends WarViewer { private long startTime = System.currentTimeMillis(); Font font = new Font("Sans Serif", Font.BOLD, 48); public CountdownViewer() { } @Override public void draw(GameModel model, Graphics2D g, int dx, int dy, boolean showInfo) { super.draw(model, g, dx, dy, showInfo); long t = countdown(); if (t < 2000) { int secs = 2 - ((int) (t / 1000)); g.setFont(font); g.drawString(""+secs, dx / 2, dy / 2); } } private long countdown() { long t = System.currentTimeMillis() - startTime; return t; } public boolean finishedCountdown() { long t = countdown(); return (t > 2000); } }
gpl-2.0
memoupao/Fondo-Simon
clases/BLBene.class.php
22233
<?php require_once ("BLBase.class.php"); class BLBene extends BLBase { var $fecha; var $Session; function __construct() { $this->fecha = date("Y-m-d H:i:s", time()); $this->Session = $_SESSION['ObjSession']; $this->SetConexionID($this->Session->GetConection()->Conexion_ID); } // Esta funcion es muy importante, ya que las funciones dependen de la conexion function SetConexionID($ConexID) { $this->SetConection($ConexID); } function Dispose() { $this->Destroy(); } // ----------------------------------------------------------------------------- // egion Read Beneficiarios function BeneListado($idProy) { // ContactosListado $sql = "SELECT t11_bco_bene.t11_cod_bene, t11_bco_bene.t02_cod_proy, t11_bco_bene.t11_dni, CONCAT(t11_bco_bene.t11_ape_pat, ' ', t11_bco_bene.t11_ape_mat, ', ', t11_bco_bene.t11_nom ) as nombres, t11_bco_bene.t11_sexo, t11_bco_bene.t11_edad, t11_bco_bene.t11_nivel_educ, t11_bco_bene.t11_especialidad, DATE_FORMAT(t11_bco_bene.t11_fec_ini,'%d/%m/%Y') as t11_fec_ini, DATE_FORMAT(t11_bco_bene.t11_fec_ter,'%d/%m/%Y') as t11_fec_ter, t11_bco_bene.t11_sec_prod,t11_bco_bene.t11_subsector,t11_bco_bene.t11_unid_prod_1,t11_bco_bene.t11_nro_up_b,t11_bco_bene.t11_sec_prod_2,t11_bco_bene.t11_subsec_prod_2,t11_bco_bene.t11_tot_unid_prod,t11_bco_bene.t11_tot_unid_prod_2,t11_bco_bene.t11_unid_prod_2,t11_bco_bene.t11_nro_up_b_2,t11_bco_bene.t11_sec_prod_3, t11_bco_bene.t11_subsec_prod_3, t11_bco_bene.t11_unid_prod_3, t11_bco_bene.t11_tot_unid_prod_3, t11_bco_bene.t11_nro_up_b_3,t11_bco_bene.t11_nom_prod, t11_bco_bene.t11_direccion, t11_bco_bene.t11_ciudad, t11_bco_bene.t11_telefono, t11_bco_bene.t11_celular, t11_bco_bene.t11_mail, t11_bco_bene.t11_estado, t11_bco_bene.usr_crea, t11_bco_bene.fch_crea, t11_bco_bene.usr_actu, t11_bco_bene.fch_actu, t11_bco_bene.est_audi , u.nom_ubig FROM t11_bco_bene LEFT JOIN adm_ubigeo u ON (u.cod_dpto = t11_bco_bene.t11_dpto AND u.cod_prov = '00' AND u.cod_dist = '00') WHERE t02_cod_proy = '$idProy' ;"; return $this->ExecuteQuery($sql); } function BeneSeleccionar($idProy, $id) { // ContactosSeleccionar $sql = " SELECT t11_cod_bene, t02_cod_proy, t11_dni, t11_ape_pat, t11_ape_mat, t11_nom , t11_sexo, t11_edad, t11_nivel_educ,t11_especialidad, DATE_FORMAT(t11_fec_ini,'%d/%m/%Y') as t11_fec_ini, DATE_FORMAT(t11_fec_ter,'%d/%m/%Y') as t11_fec_ter, t11_sec_prod_main, t11_sec_prod,t11_subsector,t11_unid_prod_1,t11_nro_up_b,t11_sec_prod_main_2, t11_sec_prod_2,t11_subsec_prod_2,t11_tot_unid_prod,t11_tot_unid_prod_2,t11_unid_prod_2,t11_nro_up_b_2, t11_sec_prod_main_3, t11_sec_prod_3, t11_subsec_prod_3, t11_unid_prod_3, t11_tot_unid_prod_3, t11_nro_up_b_3,t11_nom_prod, t11_direccion, t11_dpto,t11_prov,t11_dist, t11_ciudad, t11_case, t11_telefono, t11_celular, t11_mail, t11_act_princ, t11_estado, t11_obs, usr_crea, fch_crea, usr_actu, fch_actu, est_audi, t11_esp_otro FROM t11_bco_bene WHERE t02_cod_proy = '$idProy' and t11_cod_bene='$id' ;"; // echo("<pre>".$sql."</pre>"); $ConsultaID = $this->ExecuteQuery($sql); $row = mysql_fetch_assoc($ConsultaID); return $row; } // ndRegion // egion CRUD Beneficiarios function BeneNuevo($t11_cod_bene, $t02_cod_proy, $t11_dni, $t11_ape_pat, $t11_ape_mat, $t11_nom, $t11_sexo, $t11_edad, $t11_nivel_educ, $t11_especialidad, $t11_fec_ini, $t11_fec_ter, $t11_sec_prod_main, $t11_sec_prod, $t11_subsector, $t11_unid_prod_1, $t11_nro_up_b, $t11_sec_prod_main_2, $t11_sec_prod_2, $t11_subsec_prod_2, $t11_tot_unid_prod, $t11_tot_unid_prod_2, $t11_unid_prod_2, $t11_nro_up_b_2, $t11_sec_prod_main_3, $t11_sec_prod_3, $t11_subsec_prod_3, $t11_unid_prod_3, $t11_tot_unid_prod_3, $t11_nro_up_b_3, $t11_nom_prod, $t11_direccion, $t11_dpto, $t11_prov, $t11_dist, $t11_ciudad, $t11_case, $t11_act_princ, $t11_telefono, $t11_celular, $t11_mail, $t11_estado, $t11_obs, $t11_esp_otros) { // ContactoNuevo /* Validaciones antes de grabar */ $sql = "Select count(*) from t11_bco_bene where t11_dni='" . $t11_dni . "' and t02_cod_proy ='" . $t02_cod_proy . "'; "; $sql2 = "Select * from t11_bco_bene where t11_dni='" . $t11_dni . "' and t02_cod_proy ='" . $t02_cod_proy . "'; "; $resultado = mysql_query($sql2); while ($row = mysql_fetch_array($resultado)) { $nombre = $row['t11_nom']; $paterno = $row['t11_ape_pat']; $materno = $row['t11_ape_mat']; } if ($this->GetValue($sql) > 0) { $this->Error = "La Persona con DNI \"" . $t11_dni . "\" se encuentra registrada como \" " . $paterno . " " . $materno . ", " . $nombre . "\". Comuniquese con el Administrador"; return false; } $est_audi = '1'; $t11_cod_bene = $this->Autogenerate("t11_bco_bene", "t11_cod_bene"); $arrayfields = array( 't11_cod_bene', 't02_cod_proy', 't11_dni', 't11_ape_pat', 't11_ape_mat', 't11_nom', 't11_sexo', 't11_edad', 't11_nivel_educ', 't11_especialidad', 't11_fec_ini', 't11_fec_ter', 't11_sec_prod_main', 't11_sec_prod', 't11_subsector', 't11_unid_prod_1', 't11_nro_up_b', 't11_sec_prod_main_2', 't11_sec_prod_2', 't11_subsec_prod_2', 't11_tot_unid_prod', 't11_tot_unid_prod_2', 't11_unid_prod_2', 't11_nro_up_b_2', 't11_sec_prod_main_3', 't11_sec_prod_3', 't11_subsec_prod_3', 't11_unid_prod_3', 't11_tot_unid_prod_3', 't11_nro_up_b_3', 't11_nom_prod', 't11_direccion', 't11_dpto', 't11_prov', 't11_dist', 't11_ciudad', 't11_case', 't11_act_princ', 't11_telefono', 't11_celular', 't11_mail', 't11_estado', 't11_obs', 'usr_crea', 'fch_crea', 'est_audi', 't11_esp_otro' ); $arrayvalues = array( $t11_cod_bene, $t02_cod_proy, $t11_dni, $t11_ape_pat, $t11_ape_mat, $t11_nom, $t11_sexo, $t11_edad, $t11_nivel_educ, $t11_especialidad, $this->ConvertDate($t11_fec_ini), $this->ConvertDate($t11_fec_ter), $t11_sec_prod_main, $t11_sec_prod, $t11_subsector, $t11_unid_prod_1, $t11_nro_up_b, $t11_sec_prod_main_2, $t11_sec_prod_2, $t11_subsec_prod_2, $t11_tot_unid_prod, $t11_tot_unid_prod_2, $t11_unid_prod_2, $t11_nro_up_b_2, $t11_sec_prod_main_3, $t11_sec_prod_3, $t11_subsec_prod_3, $t11_unid_prod_3, $t11_tot_unid_prod_3, $t11_nro_up_b_3, $t11_nom_prod, $t11_direccion, $t11_dpto, $t11_prov, $t11_dist, $t11_ciudad, $t11_case, $t11_act_princ, $t11_telefono, $t11_celular, $t11_mail, $t11_estado, $t11_obs, $this->Session->UserID, $this->fecha, $est_audi, $t11_esp_otros ); $sql = $this->DBOBaseMySQL->createqueryInsert("t11_bco_bene", $arrayfields, $arrayvalues); return $this->ExecuteCreate($sql); } function BeneActualizar($t11_cod_bene, $t02_cod_proy, $t11_dni, $t11_ape_pat, $t11_ape_mat, $t11_nom, $t11_sexo, $t11_edad, $t11_nivel_educ, $t11_especialidad, $t11_fec_ini, $t11_fec_ter, $t11_sec_prod_main, $t11_sec_prod, $t11_subsector, $t11_unid_prod_1, $t11_nro_up_b, $t11_sec_prod_main_2, $t11_sec_prod_2, $t11_subsec_prod_2, $t11_tot_unid_prod, $t11_tot_unid_prod_2, $t11_unid_prod_2, $t11_nro_up_b_2, $t11_sec_prod_main_3, $t11_sec_prod_3, $t11_subsec_prod_3, $t11_unid_prod_3, $t11_tot_unid_prod_3, $t11_nro_up_b_3, $t11_nom_prod, $t11_direccion, $t11_dpto, $t11_prov, $t11_dist, $t11_ciudad, $t11_case, $t11_act_princ, $t11_telefono, $t11_celular, $t11_mail, $t11_estado, $t11_obs, $t11_esp_otros) { /* * $sql = "Select count(*) from t11_bco_bene where t11_dni='".$t11_dni."' and t02_cod_proy ='".$t02_cod_proy."'; " ; $sql2 = "Select * from t11_bco_bene where t11_dni='".$t11_dni."' and t02_cod_proy ='".$t02_cod_proy."'; " ; $resultado=mysql_query($sql2); while($row = mysql_fetch_array($resultado)) { $nombre=$row['t11_nom']; $paterno=$row['t11_ape_pat']; $materno=$row['t11_ape_mat']; $dni=$row['t11_dni']; } if($this->GetValue($sql)>0 ) { $this->Error=" La Persona con DNI \"".$t11_dni."\" se encuentra registrada como \" ". $paterno." ".$materno. ", ".$nombre."\". Comuniquese con el Administrador"; return false; } */ $est_audi = '1'; $arrayfields = array( 't11_cod_bene', 't02_cod_proy', 't11_dni', 't11_ape_pat', 't11_ape_mat', 't11_nom', 't11_sexo', 't11_edad', 't11_nivel_educ', 't11_especialidad', 't11_fec_ini', 't11_fec_ter', 't11_sec_prod_main', 't11_sec_prod', 't11_subsector', 't11_unid_prod_1', 't11_nro_up_b', 't11_sec_prod_main_2', 't11_sec_prod_2', 't11_subsec_prod_2', 't11_tot_unid_prod', 't11_tot_unid_prod_2', 't11_unid_prod_2', 't11_nro_up_b_2', 't11_sec_prod_main_3', 't11_sec_prod_3', 't11_subsec_prod_3', 't11_unid_prod_3', 't11_tot_unid_prod_3', 't11_nro_up_b_3', 't11_nom_prod', 't11_direccion', 't11_dpto', 't11_prov', 't11_dist', 't11_ciudad', 't11_case', 't11_act_princ', 't11_telefono', 't11_celular', 't11_mail', 't11_estado', 't11_obs', 'usr_actu', 'fch_actu', 'est_audi', 't11_esp_otro' ); $arrayvalues = array( $t11_cod_bene, $t02_cod_proy, $t11_dni, $t11_ape_pat, $t11_ape_mat, $t11_nom, $t11_sexo, $t11_edad, empty($t11_nivel_educ) ? 0 : $t11_nivel_educ, $t11_especialidad, $this->ConvertDate($t11_fec_ini), $this->ConvertDate($t11_fec_ter), $t11_sec_prod_main, $t11_sec_prod, $t11_subsector, empty($t11_unid_prod_1) ? 0 : $t11_unid_prod_1, $t11_nro_up_b, empty($t11_sec_prod_main_2) ? 0 : $t11_sec_prod_main_2, empty($t11_sec_prod_2) ? 0 : $t11_sec_prod_2, empty($t11_subsec_prod_2) ? 0 : $t11_subsec_prod_2, $t11_tot_unid_prod, $t11_tot_unid_prod_2, empty($t11_unid_prod_2) ? 0 : $t11_unid_prod_2, $t11_nro_up_b_2, empty($t11_sec_prod_main_3) ? 0 : $t11_sec_prod_main_3, empty($t11_sec_prod_3) ? 0 : $t11_sec_prod_3, empty($t11_subsec_prod_3) ? 0 : $t11_subsec_prod_3, empty($t11_unid_prod_3) ? 0 : $t11_unid_prod_3, $t11_tot_unid_prod_3, $t11_nro_up_b_3, $t11_nom_prod, $t11_direccion, $t11_dpto, $t11_prov, $t11_dist, $t11_ciudad, $t11_case, $t11_act_princ, $t11_telefono, $t11_celular, $t11_mail, $t11_estado, $t11_obs, $this->Session->UserID, $this->fecha, $est_audi, $t11_esp_otros ); $where = "t02_cod_proy='$t02_cod_proy' and t11_cod_bene='$t11_cod_bene' "; $sql = $this->DBOBaseMySQL->createqueryUpdate("t11_bco_bene", $arrayfields, $arrayvalues, $where); return $this->ExecuteUpdate($sql); } function BeneEliminar($t02_cod_proy, $t11_cod_bene) { // ContactoEliminar $sql = " DELETE from t11_bco_bene WHERE t02_cod_proy='$t02_cod_proy' and t11_cod_bene='$t11_cod_bene';"; return $this->ExecuteDelete($sql); } // ndRegion Beneficiarios function ListadoBeneficiarios($idProy) { $SP = "sp_rpt_beneficiarios"; $params = array( $idProy ); $ret = $this->ExecuteProcedureReader($SP, $params); return $ret; } function NumeroBeneficiariosCap($idProy, $anio, $trim) { $SP = "sp_cap_x_inf_tri"; $params = array( $idProy, $anio, $trim ); $ret = $this->ExecuteProcedureReader($SP, $params); return $ret; } function NumeroBeneficiariosAT($idProy, $anio, $trim) { $SP = "sp_at_x_inf_tri"; $params = array( $idProy, $anio, $trim ); $ret = $this->ExecuteProcedureReader($SP, $params); return $ret; } function NumeroBeneficiariosOtros($idProy, $anio, $trim) { $SP = "sp_otros_x_inf_tri"; $params = array( $idProy, $anio, $trim ); $ret = $this->ExecuteProcedureReader($SP, $params); return $ret; } function NumeroBeneficiariosCred($idProy, $anio, $trim) { $SP = "sp_cred_x_inf_tri"; $params = array( $idProy, $anio, $trim ); $ret = $this->ExecuteProcedureReader($SP, $params); return $ret; } function NumeroTemasPOA($idProy, $ver) { $SP = "sp_lis_temas"; $params = array( $idProy, $ver ); $ret = $this->ExecuteProcedureReader($SP, $params); return $ret; } function NumeroTemasAT($idProy, $ver) { $SP = "sp_lis_at"; $params = array( $idProy, $ver ); $ret = $this->ExecuteProcedureReader($SP, $params); return $ret; } function NumeroTemasOtros($idProy, $ver) { $SP = "sp_lis_otros"; $params = array( $idProy, $ver ); $ret = $this->ExecuteProcedureReader($SP, $params); return $ret; } function NumeroTemasCred($idProy, $ver) { $SP = "sp_lis_cred"; $params = array( $idProy, $ver ); $ret = $this->ExecuteProcedureReader($SP, $params); return $ret; } function ListadoBeneficiariosTotales($pIdConc = null) { $SP = "sp_rpt_beneficiarios_tot"; $params = array( $pIdConc ); $ret = $this->ExecuteProcedureReader($SP, $params); return $ret; } // egion Ubigeo function ListaUbigeoDpto($proy) { return $this->ExecuteProcedureReader("sp_bene_ubigeo", array( $proy, '', '', '' )); } function ListaUbigeoProv($proy, $dpto) { return $this->ExecuteProcedureReader("sp_bene_ubigeo", array( $proy, $dpto, '', '' )); } function ListaUbigeoDist($proy, $dpto, $prov) { return $this->ExecuteProcedureReader("sp_bene_ubigeo", array( $proy, $dpto, $prov, '' )); } function ListaUbigeoCaserio($proy, $dpto, $prov, $dist) { return $this->ExecuteProcedureReader("sp_bene_ubigeo", array( $proy, $dpto, $prov, $dist )); } function ListaBeneficiarioUbigeo($proy, $dpto, $prov, $dist, $case) { return $this->ExecuteProcedureReader("sp_lis_bene_ubigeo", array( $proy, $dpto, $prov, $dist, $case )); } /** * Importador datos desde XLSX de beneficiarios. * * @author DA * @since Version 2.0 * @access public * @param string $t02_cod_proy Codigo del Proyecto * @param string $t11_dni Nro. de DNI * @param string $t11_ape_pat Apellidos Paternos * @param string $t11_ape_mat Apellidos Maternos * @param string $t11_nom Nombres * @param string $t11_sexo Sexo * @param string $t11_edad Edad * @param string $t11_nivel_educ Nivel de Educacion * @param string $t11_especialidad Especialidad * @param string $t11_fec_ini Fecha de Inicio laboral (dd/mm/yyyy) * @param string $t11_fec_ter Fecha de Termino laboral (dd/mm/yyyy) * @param string $t11_direccion Direccion * @param string $t11_ciudad Ciudad * @param string $t11_act_princ Actividad Principal * @param string $t11_telefono Telefono * @param string $t11_celular Celular * @param string $t11_mail Email * @param string $t11_estado Estado * @param string $t11_obs Observaciones * @param string $t11_esp_otros Otra especialidad * @param string $text_t11_dpto Departamento * @param string $text_t11_prov Provincia * @param string $text_t11_dist Distrito * @param string $centro_poblado Centro Poblado * @return resource * */ function importBeneNuevos($t02_cod_proy, $t11_dni, $t11_ape_pat, $t11_ape_mat, $t11_nom, $t11_sexo, $t11_edad, $t11_nivel_educ, $t11_especialidad, $t11_fec_ini, $t11_fec_ter, $t11_direccion, $t11_ciudad, $t11_act_princ, $t11_telefono, $t11_celular, $t11_mail, $t11_estado, $t11_obs, $t11_esp_otros, $text_t11_dpto, $text_t11_prov, $text_t11_dist, $centro_poblado) { /* Validaciones antes de grabar */ $t11_dni = mysql_real_escape_string($t11_dni); $t02_cod_proy = mysql_real_escape_string($t02_cod_proy); $t11_fec_ini = trim($t11_fec_ini); $t11_fec_ter = trim($t11_fec_ter); $sql = "select count(t11_dni) from t11_bco_bene where t11_dni='" . $t11_dni . "' and t02_cod_proy ='" . $t02_cod_proy . "'"; $sql2 = "select t11_nom, t11_ape_pat, t11_ape_mat FROM t11_bco_bene WHERE t11_dni='" . $t11_dni . "' and t02_cod_proy ='" . $t02_cod_proy . "' GROUP BY t11_dni"; $resultado = mysql_query($sql2); if (mysql_num_rows($resultado) >0) { $row = mysql_fetch_array($resultado); $nombre = $row['t11_nom']; $paterno = $row['t11_ape_pat']; $materno = $row['t11_ape_mat']; if ($this->GetValue($sql) > 0) { $this->Error = "La Persona con DNI \"" . $t11_dni . "\" se encuentra registrada como \" " . $paterno . " " . $materno . ", " . $nombre . "\". Comuniquese con el Administrador <br/>"; return false; } } $est_audi = '1'; $t11_cod_bene = $this->Autogenerate("t11_bco_bene", "t11_cod_bene"); //$sql = $this->DBOBaseMySQL->createqueryInsert("t11_bco_bene", $arrayfields, $arrayvalues); $sql = "INSERT INTO t11_bco_bene(t11_cod_bene, t02_cod_proy, t11_dni, t11_ape_pat, t11_ape_mat, t11_nom, t11_sexo, t11_edad, t11_nivel_educ, t11_especialidad, "; if (!empty($t11_fec_ini)) { $sql .= " t11_fec_ini,"; } if (!empty($t11_fec_ter)) { $sql .= " t11_fec_ter, "; } $sql .= " t11_dpto, t11_prov, t11_dist, t11_case, t11_direccion, t11_ciudad, t11_act_princ, t11_telefono, t11_celular, t11_mail, t11_estado, t11_obs, usr_crea, fch_crea, est_audi, t11_esp_otro) VALUES( '{$t11_cod_bene}', '{$t02_cod_proy}', '{$t11_dni}', '{$t11_ape_pat}', '{$t11_ape_mat}', '{$t11_nom}', '{$t11_sexo}', '{$t11_edad}', '{$t11_nivel_educ}', '{$t11_especialidad}', "; if (!empty($t11_fec_ini)) { $sql .= "'{$t11_fec_ini}',"; } if (!empty($t11_fec_ter)) { $sql .= "'{$t11_fec_ter}',"; } $sqlDpto = "SELECT cod_dpto FROM adm_ubigeo WHERE cod_prov='00' AND cod_dist='00' AND nom_ubig = '{$text_t11_dpto}' GROUP BY cod_dpto"; $sqlProv = "SELECT cod_prov FROM adm_ubigeo WHERE cod_dpto = ($sqlDpto) AND cod_prov<>'00' AND cod_dist='00' AND nom_ubig = '{$text_t11_prov}' GROUP BY cod_prov"; $sqlDist = "SELECT cod_dist FROM adm_ubigeo WHERE cod_dpto = ($sqlDpto) AND cod_prov = ($sqlProv) AND cod_dist<>'00' AND nom_ubig = '{$text_t11_dist}' GROUP BY cod_dist"; $sqlCent = "SELECT cod_case FROM adm_caserios WHERE cod_dpto = ($sqlDpto) AND cod_prov = ($sqlProv) AND cod_dist<>'00' AND cod_dist=($sqlDist) AND nom_case = '{$centro_poblado}' GROUP BY cod_case"; $sql .= "(".$sqlDpto."),"; $sql .= "(".$sqlProv."),"; $sql .= "(".$sqlDist."),"; $sql .= "(".$sqlCent."),"; $sql .= "'{$t11_direccion}', '{$t11_ciudad}', '{$t11_act_princ}', '{$t11_telefono}', '{$t11_celular}', '{$t11_mail}', '{$t11_estado}', '{$t11_obs}', '{$this->Session->UserID}', '{$this->fecha}', '{$est_audi}', '{$t11_esp_otros}')"; return $this->ExecuteCreate($sql); } // ndRegion } // fin de la Clase BLBene
gpl-2.0
stuart-knock/tvb-framework
tvb/core/entities/file/files_helper.py
19852
# -*- coding: utf-8 -*- # # # TheVirtualBrain-Framework Package. This package holds all Data Management, and # Web-UI helpful to run brain-simulations. To use it, you also need do download # TheVirtualBrain-Scientific Package (for simulators). See content of the # documentation-folder for more details. See also http://www.thevirtualbrain.org # # (c) 2012-2013, Baycrest Centre for Geriatric Care ("Baycrest") # # 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, you can download it here # http://www.gnu.org/licenses/old-licenses/gpl-2.0 # # # CITATION: # When using The Virtual Brain for scientific publications, please cite it as follows: # # Paula Sanz Leon, Stuart A. Knock, M. Marmaduke Woodman, Lia Domide, # Jochen Mersmann, Anthony R. McIntosh, Viktor Jirsa (2013) # The Virtual Brain: a simulator of primate brain network dynamics. # Frontiers in Neuroinformatics (7:10. doi: 10.3389/fninf.2013.00010) # # """ .. moduleauthor:: Calin Pavel <calin.pavel@codemart.ro> .. moduleauthor:: Lia Domide <lia.domide@codemart.ro> """ import os import shutil import json import zipfile from contextlib import closing from zipfile import ZipFile, ZIP_DEFLATED, BadZipfile from tvb.basic.config.settings import TVBSettings from tvb.basic.logger.builder import get_logger from tvb.core.decorators import synchronized from tvb.core.entities.transient.structure_entities import DataTypeMetaData, GenericMetaData from tvb.core.entities.file.xml_metadata_handlers import XMLReader, XMLWriter from tvb.core.entities.file.exceptions import FileStructureException from threading import Lock LOCK_CREATE_FOLDER = Lock() class FilesHelper(): """ This class manages all Structure related operations, using File storage. It will handle creating meaning-full entities and retrieving existent ones. """ TEMP_FOLDER = "TEMP" IMAGES_FOLDER = "IMAGES" PROJECTS_FOLDER = "PROJECTS" TVB_FILE_EXTENSION = XMLWriter.FILE_EXTENSION TVB_STORAGE_FILE_EXTENSION = ".h5" TVB_PROJECT_FILE = "Project" + TVB_FILE_EXTENSION TVB_OPERARATION_FILE = "Operation" + TVB_FILE_EXTENSION def __init__(self): self.logger = get_logger(self.__class__.__module__) ############# PROJECT RELATED methods ################################## @synchronized(LOCK_CREATE_FOLDER) def check_created(self, path=TVBSettings.TVB_STORAGE): """ Check that the given folder exists, otherwise create it, with the entire tree of parent folders. This method is synchronized, for parallel access from events, to avoid conflicts. """ try: if not os.path.exists(path): self.logger.debug("Creating folder:" + str(path)) os.makedirs(path, mode=TVBSettings.ACCESS_MODE_TVB_FILES) os.chmod(path, TVBSettings.ACCESS_MODE_TVB_FILES) except OSError, excep: self.logger.error("COULD NOT CREATE FOLDER! CHECK ACCESS ON IT!") self.logger.exception(excep) raise FileStructureException("Could not create Folder" + str(path)) def get_project_folder(self, project, *sub_folders): """ Retrieve the root path for the given project. If root folder is not created yet, will create it. """ if hasattr(project, 'name'): project = project.name complete_path = os.path.join(TVBSettings.TVB_STORAGE, self.PROJECTS_FOLDER, project) if sub_folders is not None: complete_path = os.path.join(complete_path, *sub_folders) if not os.path.exists(complete_path): self.check_created(complete_path) return complete_path def rename_project_structure(self, project_name, new_name): """ Rename Project folder or THROW FileStructureException. """ try: path = self.get_project_folder(project_name) folder = os.path.split(path)[0] new_full_name = os.path.join(folder, new_name) except Exception, excep: self.logger.error("Could not rename node!") self.logger.exception(excep) raise FileStructureException("Could not Rename:" + str(new_name)) if os.path.exists(new_full_name): raise FileStructureException("File already used " + str(new_name) + " Can not add a duplicate!") try: os.rename(path, new_full_name) return path, new_full_name except Exception, excep: self.logger.error("Could not rename node!") self.logger.exception(excep) raise FileStructureException("Could not Rename: " + str(new_name)) def remove_project_structure(self, project_name): """ Remove all folders for project or THROW FileStructureException. """ try: complete_path = self.get_project_folder(project_name) if os.path.exists(complete_path): if os.path.isdir(complete_path): shutil.rmtree(complete_path) else: os.remove(complete_path) self.logger.debug("Project folders were removed for " + project_name) except OSError, excep: self.logger.error("A problem occurred while removing folder.") self.logger.exception(excep) raise FileStructureException("Permission denied. Make sure you have write access on TVB folder!") def get_project_meta_file_path(self, project_name): """ Retrieve project meta info file path. :returns: File path for storing Project meta-data File might not exist yet, but parent folder is created after this method call. """ complete_path = self.get_project_folder(project_name) complete_path = os.path.join(complete_path, self.TVB_PROJECT_FILE) return complete_path def write_project_metadata(self, project): """ :param project: Project instance, to get metadata from it. """ proj_path = self.get_project_meta_file_path(project.name) _, meta_dictionary = project.to_dict() meta_entity = GenericMetaData(meta_dictionary) XMLWriter(meta_entity).write(proj_path) os.chmod(proj_path, TVBSettings.ACCESS_MODE_TVB_FILES) ############# OPERATION related METHODS Start Here ######################### def get_operation_folder(self, project_name, operation_id): """ Computes the folder where operation details are stored """ operation_path = self.get_project_folder(project_name, str(operation_id)) if not os.path.exists(operation_path): self.check_created(operation_path) return operation_path def get_operation_meta_file_path(self, project_name, operation_id): """ Retrieve the path to operation meta file :param project_name: name of the current project. :param operation_id: Identifier of Operation in given project :returns: File path for storing Operation meta-data. File might not be yet created, but parent folder exists after this method. """ complete_path = self.get_operation_folder(project_name, operation_id) complete_path = os.path.join(complete_path, self.TVB_OPERARATION_FILE) return complete_path def write_operation_metadata(self, operation): """ :param operation: DB stored operation instance. """ project_name = operation.project.name op_path = self.get_operation_meta_file_path(project_name, operation.id) _, equivalent_dict = operation.to_dict() meta_entity = GenericMetaData(equivalent_dict) XMLWriter(meta_entity).write(op_path) os.chmod(op_path, TVBSettings.ACCESS_MODE_TVB_FILES) def update_operation_metadata(self, project_name, new_group_name, operation_id, is_group=False): """ Update operation meta data. :param is_group: when FALSE, use parameter 'new_group_name' for direct assignment on operation.user_group when TRUE, update operation.operation_group.name = parameter 'new_group_name' """ op_path = self.get_operation_meta_file_path(project_name, operation_id) if not os.path.exists(op_path): self.logger.warning("Trying to update an operation-meta file which does not exist." " It could happen in a group where partial entities have errors!") return op_meta_data = XMLReader(op_path).read_metadata() if is_group: group_meta_str = op_meta_data[DataTypeMetaData.KEY_FK_OPERATION_GROUP] group_meta = json.loads(group_meta_str) group_meta[DataTypeMetaData.KEY_OPERATION_GROUP_NAME] = new_group_name op_meta_data[DataTypeMetaData.KEY_FK_OPERATION_GROUP] = json.dumps(group_meta) else: op_meta_data[DataTypeMetaData.KEY_OPERATION_TAG] = new_group_name XMLWriter(op_meta_data).write(op_path) def remove_operation_data(self, project_name, operation_id): """ Remove H5 storage fully. """ try: complete_path = self.get_operation_folder(project_name, operation_id) if os.path.isdir(complete_path): shutil.rmtree(complete_path) else: os.remove(complete_path) except Exception, excep: self.logger.error(excep) raise FileStructureException("Could not remove files for OP" + str(operation_id)) ####################### DATA-TYPES METHODS Start Here ##################### def remove_datatype(self, datatype): """ Remove H5 storage fully. """ try: if os.path.exists(datatype.get_storage_file_path()): os.remove(datatype.get_storage_file_path()) else: self.logger.warning("Data file already removed:" + str(datatype.get_storage_file_path())) except Exception, excep: self.logger.error(excep) raise FileStructureException("Could not remove " + str(datatype)) def move_datatype(self, datatype, new_project_name, new_op_id): """ Move H5 storage into a new location """ try: full_path = datatype.get_storage_file_path() folder = self.get_project_folder(new_project_name, str(new_op_id)) full_new_file = os.path.join(folder, os.path.split(full_path)[1]) os.rename(full_path, full_new_file) except Exception, excep: self.logger.error(excep) raise FileStructureException("Could not move " + str(datatype)) ######################## IMAGES METHODS Start Here ####################### def get_images_folder(self, project_name, operation_id): """ Computes the name/path of the folder where to store images. """ operation_folder = self.get_operation_folder(project_name, operation_id) images_folder = os.path.join(operation_folder, self.IMAGES_FOLDER) if not os.path.exists(images_folder): self.check_created(images_folder) return images_folder def write_image_metadata(self, figure): """ Writes figure meta-data into XML file """ _, dict_data = figure.to_dict() meta_entity = GenericMetaData(dict_data) XMLWriter(meta_entity).write(self._compute_image_metadata_file(figure)) def remove_image_metadata(self, figure): """ Remove the file storing image meta data """ metadata_file = self._compute_image_metadata_file(figure) if os.path.exists(metadata_file): os.remove(metadata_file) def _compute_image_metadata_file(self, figure): """ Computes full path of image meta data XML file. """ name = figure.file_path.split('.')[0] images_folder = self.get_images_folder(figure.project.name, figure.operation.id) return os.path.join(TVBSettings.TVB_STORAGE, images_folder, name + XMLWriter.FILE_EXTENSION) @staticmethod def find_relative_path(full_path, root_path=TVBSettings.TVB_STORAGE): """ :param full_path: Absolute full path :root_path: find relative path from param full_path to this root. """ try: full = os.path.normpath(full_path) prefix = os.path.normpath(root_path) result = full.replace(prefix, '') # Make sure the resulting relative path doesn't start with root, # to be then treated as an absolute path. if result.startswith(os.path.sep): result = result.replace(os.path.sep, '', 1) return result except Exception, excep: logger = get_logger(__name__) logger.warning("Could not normalize " + str(full_path)) logger.warning(str(excep)) return full_path ######################## GENERIC METHODS Start Here ####################### @staticmethod def parse_xml_content(xml_content): """ Delegate reading of some XML content. Will parse the XMl and return a dictionary of elements with max 2 levels. """ return XMLReader(None).parse_xml_content_to_dict(xml_content) @staticmethod def zip_files(zip_full_path, files): """ This method creates a ZIP file with all files provided as parameters :param zip_full_path: full path and name of the result ZIP file :param files: array with the FULL names/path of the files to add into ZIP """ with closing(ZipFile(zip_full_path, "w", ZIP_DEFLATED, True)) as zip_file: for file_to_include in files: zip_file.write(file_to_include, os.path.basename(file_to_include)) @staticmethod def zip_folders(zip_full_path, folders, folder_prefix=None): """ This method creates a ZIP file with all folders provided as parameters :param zip_full_path: full path and name of the result ZIP file :param folders: array with the FULL names/path of the folders to add into ZIP """ with closing(ZipFile(zip_full_path, "w", ZIP_DEFLATED, True)) as zip_res: for folder in set(folders): parent_folder, _ = os.path.split(folder) for root, _, files in os.walk(folder): #NOTE: ignore empty directories for file_n in files: abs_file_n = os.path.join(root, file_n) zip_file_n = abs_file_n[len(parent_folder) + len(os.sep):] if folder_prefix is not None: zip_file_n = folder_prefix + zip_file_n zip_res.write(abs_file_n, zip_file_n) @staticmethod def zip_folder(result_name, folder_root): """ Given a folder and a ZIP result name, create the corresponding archive. """ with closing(ZipFile(result_name, "w", ZIP_DEFLATED, True)) as zip_res: for root, _, files in os.walk(folder_root): #NOTE: ignore empty directories for file_n in files: abs_file_n = os.path.join(root, file_n) zip_file_n = abs_file_n[len(folder_root) + len(os.sep):] zip_res.write(abs_file_n, zip_file_n) return result_name def unpack_zip(self, uploaded_zip, folder_path): """ Simple method to unpack ZIP archive in a given folder. """ try: zip_arch = zipfile.ZipFile(uploaded_zip) result = [] for filename in zip_arch.namelist(): new_file_name = os.path.join(folder_path, filename) src = zip_arch.open(filename, 'rU') if new_file_name.endswith('/'): os.makedirs(new_file_name) else: FilesHelper.copy_file(src, new_file_name) result.append(new_file_name) return result except BadZipfile, excep: self.logger.error(excep) raise FileStructureException("Invalid ZIP file...") except Exception, excep: self.logger.error(excep) raise FileStructureException("Could not unpack the given ZIP file...") @staticmethod def copy_file(source, dest, dest_postfix=None, buffer_size=1024 * 1024): """ Copy a file from source to dest. source and dest can either be strings or any object with a read or write method, like StringIO for example. """ if not hasattr(source, 'read'): source = open(source, 'rb') if not hasattr(dest, 'write'): if dest_postfix is not None: dest = os.path.join(dest, dest_postfix) if not os.path.exists(os.path.dirname(dest)): os.makedirs(os.path.dirname(dest)) dest = open(dest, 'wb') while 1: copy_buffer = source.read(buffer_size) if copy_buffer: dest.write(copy_buffer) else: break source.close() dest.close() @staticmethod def remove_files(file_list, ignore_exception=False): """ :param file_list: list of file paths to be removed. :param ignore_exception: When True and one of the specified files could not be removed, an exception is raised. """ for file_ in file_list: try: if os.path.isfile(file_): os.remove(file_) if os.path.isdir(file_): shutil.rmtree(file_) except Exception, exc: logger = get_logger(__name__) logger.error("Could not remove " + str(file_)) logger.exception(exc) if not ignore_exception: raise exc @staticmethod def remove_folder(folder_path, ignore_errors=False): """ Given a folder path, try to remove that folder from disk. :param ignore_errors: When False throw FileStructureException if folder_path is invalid. """ if os.path.exists(folder_path) and os.path.isdir(folder_path): shutil.rmtree(folder_path, ignore_errors) return if not ignore_errors: raise FileStructureException("Given path does not exists, or is not a folder " + str(folder_path)) @staticmethod def compute_size_on_disk(file_path): """ Given a file's path, return size occupied on disk by that file. Size should be a number, representing size in KB. """ if os.path.exists(file_path) and os.path.isfile(file_path): return int(os.path.getsize(file_path) / 1024) return 0
gpl-2.0
flagbug/FlvExtract
FlvExtract/FlvFile.cs
12901
// FLV Extract // Copyright (C) 2006-2012 J.D. Purcell (moitah@yahoo.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 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA using System; using System.Collections.Generic; using System.IO; namespace FlvExtract { internal class FLVFile : IDisposable { private readonly long _fileLength; private readonly List<string> _warnings; private readonly Stream audioOutputStream; private readonly Stream videoOutputStream; private IAudioWriter _audioWriter; private FractionUInt32? _averageFrameRate, _trueFrameRate; private long _fileOffset; private Stream _fs; private List<uint> _videoTimeStamps; private IVideoWriter _videoWriter; public FLVFile(Stream inputStream, Stream audioOutputStream = null, Stream videoOutputStream = null) { if (inputStream == null) throw new ArgumentNullException("inputStream"); if (audioOutputStream == null && videoOutputStream == null) throw new ArgumentNullException(); _warnings = new List<string>(); _fs = inputStream; this.audioOutputStream = audioOutputStream; this.videoOutputStream = videoOutputStream; _fileOffset = 0; _fileLength = _fs.Length; } public event EventHandler<ProgressEventArgs> ProgressChanged; public AudioFormat AudioFormat { get; private set; } public FractionUInt32? AverageFrameRate { get { return _averageFrameRate; } } public FractionUInt32? TrueFrameRate { get { return _trueFrameRate; } } public VideoFormat VideoFormat { get; private set; } public string[] Warnings { get { return _warnings.ToArray(); } } public void Close() { Dispose(); } public void Dispose() { if (_fs != null) { _fs.Dispose(); _fs = null; } CloseOutput(null); } public void ExtractStreams() { uint dataOffset; _videoTimeStamps = new List<uint>(); Seek(0); if (_fileLength < 4 || ReadUInt32() != 0x464C5601) { if (_fileLength >= 8 && ReadUInt32() == 0x66747970) { throw new ExtractionException("This is a MP4 file. YAMB or MP4Box can be used to extract streams."); } throw new ExtractionException("This isn't a FLV file."); } ReadUInt8(); dataOffset = ReadUInt32(); Seek(dataOffset); ReadUInt32(); while (_fileOffset < _fileLength) { if (!ReadTag()) break; if ((_fileLength - _fileOffset) < 4) break; ReadUInt32(); double progress = (this._fileOffset * 1.0 / this._fileLength) * 100; if (this.ProgressChanged != null) { this.ProgressChanged(this, new ProgressEventArgs(progress)); } } _averageFrameRate = CalculateAverageFrameRate(); _trueFrameRate = CalculateTrueFrameRate(); CloseOutput(_averageFrameRate); } private FractionUInt32? CalculateAverageFrameRate() { int frameCount = _videoTimeStamps.Count; if (frameCount > 1) { FractionUInt32 frameRate; frameRate.N = (uint)(frameCount - 1) * 1000; frameRate.D = _videoTimeStamps[frameCount - 1] - _videoTimeStamps[0]; frameRate.Reduce(); return frameRate; } return null; } private FractionUInt32? CalculateTrueFrameRate() { var deltaCount = new Dictionary<uint, uint>(); int i, threshold; uint delta, count, minDelta; // Calculate the distance between the timestamps, count how many times each delta appears for (i = 1; i < _videoTimeStamps.Count; i++) { int deltaS = (int)((long)_videoTimeStamps[i] - _videoTimeStamps[i - 1]); if (deltaS <= 0) continue; delta = (uint)deltaS; if (deltaCount.ContainsKey(delta)) { deltaCount[delta] += 1; } else { deltaCount.Add(delta, 1); } } threshold = _videoTimeStamps.Count / 10; minDelta = UInt32.MaxValue; // Find the smallest delta that made up at least 10% of the frames (grouping in delta+1 // because of rounding, e.g. a NTSC video will have deltas of 33 and 34 ms) foreach (KeyValuePair<uint, uint> deltaItem in deltaCount) { delta = deltaItem.Key; count = deltaItem.Value; if (deltaCount.ContainsKey(delta + 1)) { count += deltaCount[delta + 1]; } if ((count >= threshold) && (delta < minDelta)) { minDelta = delta; } } // Calculate the frame rate based on the smallest delta, and delta+1 if present if (minDelta != UInt32.MaxValue) { uint totalTime, totalFrames; count = deltaCount[minDelta]; totalTime = minDelta * count; totalFrames = count; if (deltaCount.ContainsKey(minDelta + 1)) { count = deltaCount[minDelta + 1]; totalTime += (minDelta + 1) * count; totalFrames += count; } if (totalTime != 0) { FractionUInt32 frameRate; frameRate.N = totalFrames * 1000; frameRate.D = totalTime; frameRate.Reduce(); return frameRate; } } // Unable to calculate frame rate return null; } private void CloseOutput(FractionUInt32? averageFrameRate) { if (_videoWriter != null) { _videoWriter.Finish(averageFrameRate ?? new FractionUInt32(25, 1)); _videoWriter = null; } if (_audioWriter != null) { _audioWriter.Dispose(); _audioWriter = null; } } private IAudioWriter GetAudioWriter(uint mediaInfo) { uint format = mediaInfo >> 4; uint rate = (mediaInfo >> 2) & 0x3; uint bits = (mediaInfo >> 1) & 0x1; uint chans = mediaInfo & 0x1; switch (format) { case 14: case 2: return new MP3Writer(this.audioOutputStream, _warnings); case 3: case 0: { // PCM int sampleRate = 0; switch (rate) { case 0: sampleRate = 5512; break; case 1: sampleRate = 11025; break; case 2: sampleRate = 22050; break; case 3: sampleRate = 44100; break; } if (format == 0) { _warnings.Add("PCM byte order unspecified, assuming little endian."); } return new WAVWriter(this.audioOutputStream, (bits == 1) ? 16 : 8, (chans == 1) ? 2 : 1, sampleRate); } case 10: return new AACWriter(this.audioOutputStream); case 11: return new SpeexWriter(this.audioOutputStream, (int)(_fileLength & 0xFFFFFFFF)); } string typeStr; switch (format) { case 1: typeStr = "ADPCM"; break; case 6: case 5: case 4: typeStr = "Nellymoser"; break; default: typeStr = "format=" + format; break; } throw new ExtractionException("Unable to extract audio (" + typeStr + " is unsupported)."); } private IVideoWriter GetVideoWriter(uint mediaInfo) { uint codecID = mediaInfo & 0x0F; switch (codecID) { case 5: case 4: case 2: return new AVIWriter(this.videoOutputStream, (int)codecID, _warnings, false); case 7: return new RawH264Writer(this.videoOutputStream); } string typeStr; if (codecID == 3) typeStr = "Screen"; else if (codecID == 6) typeStr = "Screen2"; else typeStr = "codecID=" + codecID; throw new ExtractionException("Unable to extract video (" + typeStr + " is unsupported)."); } private byte[] ReadBytes(int length) { var buff = new byte[length]; _fs.Read(buff, 0, length); _fileOffset += length; return buff; } private bool ReadTag() { uint tagType, dataSize, timeStamp, mediaInfo; if ((_fileLength - _fileOffset) < 11) { return false; } // Read tag header tagType = ReadUInt8(); dataSize = ReadUInt24(); timeStamp = ReadUInt24(); timeStamp |= ReadUInt8() << 24; ReadUInt24(); // Read tag data if (dataSize == 0) { return true; } if ((_fileLength - _fileOffset) < dataSize) { return false; } mediaInfo = ReadUInt8(); dataSize -= 1; byte[] data = ReadBytes((int)dataSize); if (tagType == 0x8 && this.audioOutputStream != null) { // Audio if (_audioWriter == null) { _audioWriter = this.GetAudioWriter(mediaInfo); this.AudioFormat = this._audioWriter.AudioFormat; } _audioWriter.WriteChunk(data, timeStamp); } else if ((tagType == 0x9) && ((mediaInfo >> 4) != 5) && this.videoOutputStream != null) { // Video if (_videoWriter == null) { _videoWriter = this.GetVideoWriter(mediaInfo); this.VideoFormat = this._videoWriter.VideoFormat; } _videoTimeStamps.Add(timeStamp); _videoWriter.WriteChunk(data, timeStamp, (int)((mediaInfo & 0xF0) >> 4)); } return true; } private uint ReadUInt24() { var x = new byte[4]; _fs.Read(x, 1, 3); _fileOffset += 3; return BitConverterBE.ToUInt32(x, 0); } private uint ReadUInt32() { var x = new byte[4]; _fs.Read(x, 0, 4); _fileOffset += 4; return BitConverterBE.ToUInt32(x, 0); } private uint ReadUInt8() { _fileOffset += 1; return (uint)_fs.ReadByte(); } private void Seek(long offset) { _fs.Seek(offset, SeekOrigin.Begin); _fileOffset = offset; } } }
gpl-2.0
sgonzalez/wsn-parking-project
sensor-pi/testimages.py
764
#!/usr/bin/env python from time import sleep import os import RPi.GPIO as GPIO import subprocess import datetime GPIO.setmode(GPIO.BCM) GPIO.setup(24, GPIO.IN) count = 0 up = False down = False command = "" filename = "" index = 0 camera_pause = "500" def takepic(imageName): print("picture") command = "sudo raspistill -o " + imageName + " -q 100 -t " + camera_pause print(command) os.system(command) while(True): if(up==True): if(GPIO.input(24)==False): now = datetime.datetime.now() timeString = now.strftime("%Y-%m-%d_%H%M%S") filename = "photo-"+timeString+".jpg" takepic(filename) subprocess.call(['./processImage.sh', filename, '&']) up = GPIO.input(24) count = count+1 sleep(.1) print "done"
gpl-2.0
vineethkrishnan/Laravel-Eloquent-Relationship-Example
app/routes.php
450
<?php /* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the Closure to execute when that URI is requested. | */ Route::get('/', array('uses'=> 'HomeController@test'));
gpl-2.0
cristal/Patch
src/server/scripts/Commands/cs_jail.cpp
3115
// Copyright (C) 2008-2011 by WarHead - United Worlds of MaNGOS - http://www.uwom.de #include "Jail.h" #include "ScriptMgr.h" #include "Chat.h" class jail_commandscript : public CommandScript { public: jail_commandscript() : CommandScript("jail_commandscript") { } ChatCommand * GetCommands() const { static ChatCommand JailCommandTable[] = { { "info", SEC_PLAYER, true, &HandleJailInfoCmd, "", NULL }, { "goto", SEC_PLAYER, true, &HandleJailGotoCmd, "", NULL }, { "pinfo", SEC_MODERATOR, true, &HandleJailPInfoCmd, "", NULL }, { "arrest", SEC_GAMEMASTER, true, &HandleJailArrestCmd, "", NULL }, { "release", SEC_GAMEMASTER, true, &HandleJailReleaseCmd, "", NULL }, { "reset", SEC_GAMEMASTER, true, &HandleJailResetCmd, "", NULL }, { "reload", SEC_GAMEMASTER, true, &HandleJailReloadCmd, "", NULL }, { "enable", SEC_GAMEMASTER, true, &HandleJailEnableCmd, "", NULL }, { "disable", SEC_GAMEMASTER, true, &HandleJailDisableCmd, "", NULL }, { "delete", SEC_ADMINISTRATOR, true, &HandleJailDeleteCmd, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; static ChatCommand commandTable[] = { { "jail", SEC_PLAYER, true, NULL, "", JailCommandTable }, { NULL, 0, false, NULL, "", NULL } }; return commandTable; } static bool HandleJailInfoCmd(ChatHandler * handler, const char * /*args*/) { return sJail->InfoCommand(handler); } static bool HandleJailGotoCmd(ChatHandler * handler, const char * args) { return sJail->GotoCommand(handler, args); } static bool HandleJailPInfoCmd(ChatHandler * handler, const char * args) { return sJail->PInfoCommand(handler, args); } static bool HandleJailArrestCmd(ChatHandler * handler, const char * args) { return sJail->ArrestCommand(handler, args); } static bool HandleJailReleaseCmd(ChatHandler * handler, const char * args) { return sJail->ReleaseCommand(handler, args); } static bool HandleJailResetCmd(ChatHandler * handler, const char * args) { return sJail->ResetCommand(handler, args); } static bool HandleJailReloadCmd(ChatHandler * handler, const char * /*args*/) { return sJail->ReloadCommand(handler); } static bool HandleJailEnableCmd(ChatHandler * handler, const char * /*args*/) { return sJail->EnableCommand(handler); } static bool HandleJailDisableCmd(ChatHandler * handler, const char * /*args*/) { return sJail->DisableCommand(handler); } static bool HandleJailDeleteCmd(ChatHandler * handler, const char * args) { return sJail->ResetCommand(handler, args, true); } }; void AddSC_jail_commandscript() { new jail_commandscript(); }
gpl-2.0
saracope/us-web-standards-wordpress-theme
components/comment-navigation-below/comment-navigation-below.php
688
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?> <nav id="comment-nav-below" class="navigation comment-navigation" role="navigation"> <h2 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', 'us-web-standards' ); ?></h2> <div class="nav-links"> <div class="nav-previous"><?php previous_comments_link( esc_html__( 'Older Comments', 'us-web-standards' ) ); ?></div> <div class="nav-next"><?php next_comments_link( esc_html__( 'Newer Comments', 'us-web-standards' ) ); ?></div> </div><!-- .nav-links --> </nav><!-- #comment-nav-below --> <?php endif; // Check for comment navigation. ?>
gpl-2.0
flegastelois/kimios-dolibarr
kimios/class/api/bootstrap.php
227
<?php function __autoload($className) { $classFile = DOL_DOCUMENT_ROOT."/kimios/class/api/" . $className . '.php'; if (file_exists($classFile)) { require_once($classFile); return true; } return false; }
gpl-2.0
oh3ebf/MeasurementToolKit
sw/Instrument/src/instruments/hp3488/HP3488Card.java
10824
/*********************************************************** * Software: instrument client * Module: HP3488 option card class * Version: 0.1 * Licence: GPL2 * * Owner: Kim Kristo * Date creation : 29.10.2012 * ***********************************************************/ package instruments.hp3488; import eu.hansolo.steelseries.tools.LedColor; import javax.swing.JLabel; import javax.swing.border.TitledBorder; import org.apache.log4j.Logger; public class HP3488Card extends javax.swing.JPanel { private static Logger logger; private static final String cardType[] = { "HP44470", "HP44471", "HP44472", "HP44473", "HP44474", "HP44475", "HP44476", "HP44477", "HP44478", "empty" }; private JLabel[] labels; private eu.hansolo.steelseries.extras.Led[] leds; private boolean[] ledStates; private int slot; private int type; private HP3488CardInterface cardIf; private int cnt = 0, blocks = 0; public final static int HP44470 = 0; public final static int HP44471 = 1; public final static int HP44472 = 2; public final static int HP44473 = 3; public final static int HP44474 = 4; public final static int HP44475 = 5; public final static int HP44476 = 6; public final static int HP44477 = 7; public final static int HP44478 = 8; public final static int HP_EMPTY_SLOT = 9; private final static int MAX_CNT = 16; /** Creates new form HP3488Card */ public HP3488Card(int slot, int type, HP3488CardInterface iface) { this.slot = slot; this.type = type; this.cardIf = iface; labels = new JLabel[MAX_CNT]; leds = new eu.hansolo.steelseries.extras.Led[MAX_CNT]; ledStates = new boolean[MAX_CNT]; // get logger instance for this class logger = Logger.getLogger(HP3488Card.class); initComponents(); init(type); ((TitledBorder) this.getBorder()).setTitle("Slot " + (slot + 1) + ": " + cardType[type]); repaint(); } /** Creates new form HP3488Card */ public HP3488Card(int slot, String card, HP3488CardInterface iface) { int i = 0; this.slot = slot; this.cardIf = iface; labels = new JLabel[MAX_CNT]; leds = new eu.hansolo.steelseries.extras.Led[MAX_CNT]; ledStates = new boolean[MAX_CNT]; // get logger instance for this class logger = Logger.getLogger(HP3488Card.class); initComponents(); // scan card list and set card type for (i = 0; i < cardType.length; i++) { if ((card.toUpperCase()).equals(cardType[i])) { this.type = i; ((TitledBorder) this.getBorder()).setTitle("Slot " + (slot + 1) + ": " + cardType[i]); break; } } // initialize visual buttons init(type); } /** Function initializes led components to screen * * @param cardType to initialize user interface * */ private void init(int cardType) { int x = 10, y = 20; int xInc = 0; int blockIndex = 0, blockSpacing = 0; // TODO label pitää vaihtaa kortin mukaan String labelText = "RL"; switch (cardType) { case HP44470: case HP44471: // 10 relay / switch lines cnt = 10; xInc = 30; break; case HP44472: // 2 x 4 relay / switch lines cnt = 8; xInc = 30; blocks = 2; blockIndex = 4; blockSpacing = 50; break; case HP44473: case HP44474: // 16 digital I/O lines cnt = 10; xInc = 30; break; case HP44475: // testi levy 8 in 8 out break; case HP44476: // 3 kpl 2 x vaihto break; case HP44477: // 7 relay / switch lines cnt = 7; xInc = 30; break; case HP44478: break; } for (int i = 0; i < cnt; i++) { if (blocks > 0) { // if items are grouped, add extra space between groups if (i == blockIndex) { blockIndex += cnt / blocks; x += blockSpacing; } } labels[i] = new JLabel(); //labels[i].setFont(new java.awt.Font("Dialog", 0, 10)); labels[i].setFont(new java.awt.Font("SansSerif", 0, 10)); labels[i].setHorizontalAlignment(javax.swing.SwingConstants.CENTER); labels[i].setText(labelText + (i + 1)); add(labels[i], new org.netbeans.lib.awtextra.AbsoluteConstraints(x, y + 30, 30, 20)); leds[i] = new eu.hansolo.steelseries.extras.Led(); leds[i].setName(String.valueOf(i)); leds[i].setLedColor(LedColor.GREEN_LED); leds[i].addMouseListener(new java.awt.event.MouseAdapter() { @Override public void mouseClicked(java.awt.event.MouseEvent evt) { ledMouseClicked(evt); } }); // set layout org.jdesktop.layout.GroupLayout ledLayout = new org.jdesktop.layout.GroupLayout(leds[i]); leds[i].setLayout(ledLayout); ledLayout.setHorizontalGroup( ledLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(0, 30, Short.MAX_VALUE)); ledLayout.setVerticalGroup( ledLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(0, 30, Short.MAX_VALUE)); // add to panel add(leds[i], new org.netbeans.lib.awtextra.AbsoluteConstraints(x, y, -1, 30)); ledStates[i] = false; leds[i].setLedOn(false); x += xInc; } } /** Function implements mouse listener and updates led visual states * * @evt mouse event * */ private void ledMouseClicked(java.awt.event.MouseEvent evt) { try { int n = 0; // get event source object eu.hansolo.steelseries.extras.Led s = (eu.hansolo.steelseries.extras.Led) evt.getSource(); n = Integer.parseInt(s.getName()); // change led state if (ledStates[n]) { ledStates[n] = false; } else { ledStates[n] = true; } setLedState(n); } catch (Exception ex) { logger.warn("failed to parse led number: " + ex.getMessage()); } } /** Function sets led and I/O state on device * * @param ledIndex to to set * @return */ private boolean setLedState(int ledIndex) { int blockIndex = 0, index = 0, selection = 0; // check led index bounds if (ledIndex > ledStates.length) { logger.error("trying to access led array out of bounds."); return (false); } // set visual state leds[ledIndex].setLedOn(ledStates[ledIndex]); // send command to target switch (type) { case HP44470: case HP44471: cardIf.setLineState(ledStates[ledIndex], slot, ledIndex); break; case HP44472: // get block number blockIndex = ledIndex / (cnt / blocks); // handle leds in group for (int i = (blockIndex * (cnt / blocks)); i < (blockIndex * (cnt / blocks)) + (cnt / blocks); i++) { // clear all other than selected if (i != ledIndex) { ledStates[i] = false; leds[i].setLedOn(ledStates[i]); } else { // save selected led selection = index; } // calculate led position in group index++; } // write to device, valid values are s10 s11 s12 s13 s20 s21 s22 s23 s24 cardIf.setLineState(ledStates[ledIndex], slot, (blockIndex * 10) + selection); break; } return (true); } /** Function sets all leds to off state * */ public void resetState() { for (int i = 0; i < leds.length; i++) { // change led state ledStates[i] = false; // set visual state leds[i].setLedOn(ledStates[i]); } } /** Function sets indexed led in given state * * @param index to led * @param state to set * @return */ public boolean setState(int index, boolean state) { ledStates[index] = state; return(setLedState(index)); } /** Function return card slot number * * @return slot number */ public int getSlot() { return(slot); } /** Function return card type * * @return type number */ public int getType() { return(type); } /** Function return current realy states * * @return states in boolean array */ public boolean[] getStates() { return(ledStates); } /** Function return number of actively used relays in boolean state storage * * @return count */ public int getRelayInUseCount() { return(cnt); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { setBackground(new java.awt.Color(194, 225, 255)); setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED), "HP44470")); setMaximumSize(new java.awt.Dimension(330, 80)); setMinimumSize(new java.awt.Dimension(330, 80)); setName(""); // NOI18N setPreferredSize(new java.awt.Dimension(330, 80)); setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); }// </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables // End of variables declaration//GEN-END:variables }
gpl-2.0
dragonfly-science/numpy-wavy
test/test_wavy.py
3533
import os import unittest import numpy as np from cStringIO import StringIO from wavy import get_audio, slice_wave class TestThreeSeconds(unittest.TestCase): def setUp(self): self.audio, self.framerate = get_audio('test/three-second.wav') def test_framerate(self): self.assertEqual(self.framerate, 8000) def test_threeseconds(self): self.assertEqual(len(self.audio), 24000) def test_array(self): self.assertEqual(type(self.audio), np.ndarray) class TestFramerate(unittest.TestCase): def test_halfsampling(self): audio, framerate = get_audio('test/three-second.wav', max_framerate=4000) self.assertEqual(len(audio), 12000) self.assertEqual(framerate, 4000) def test_subsampling(self): audio, framerate = get_audio('test/three-second.wav', max_framerate=6000) self.assertEqual(len(audio), 12000) self.assertEqual(framerate, 4000) def test_third_sampling(self): audio, framerate = get_audio('test/three-second.wav', max_framerate=3000) self.assertEqual(len(audio), 8000) self.assertEqual(framerate, 8000/3.0) def test_no_upsampling(self): audio, framerate = get_audio('test/three-second.wav', max_framerate=10000) self.assertEqual(len(audio), 24000) self.assertEqual(framerate, 8000) def test_keep_framerate(self): audio, framerate = get_audio('test/three-second.wav', max_framerate=8000) self.assertEqual(len(audio), 24000) self.assertEqual(framerate, 8000) class TestOffset(unittest.TestCase): def setUp(self): self.audio, self.framerate = get_audio('test/three-second.wav') def test_offset(self): audio2, framerate2 = get_audio('test/three-second.wav', offset=1) self.assertEqual(len(audio2), 16000) self.assertEqual(audio2[0], self.audio[8000]) def test_offset_duration(self): audio1, framerate1 = get_audio('test/three-second.wav', offset=1, duration=1) self.assertEqual(len(audio1), 8000) self.assertEqual(audio1[0], self.audio[8000]) def test_duration(self): audio0, framerate0 = get_audio('test/three-second.wav', duration=0.5) self.assertEqual(len(audio0), 4000) self.assertEqual(audio0[0], self.audio[0]) class TestSlice(unittest.TestCase): def setUp(self): self.one_second = StringIO() slice_wave('test/three-second.wav', self.one_second, offset=1, duration=1) self.low_framerate = StringIO() slice_wave('test/three-second.wav', self.low_framerate, max_framerate=4000) def test_slice_length(self): self.one_second.seek(0) audio1, framerate1 = get_audio(self.one_second) self.assertEqual(len(audio1), 8000) self.assertEqual(framerate1, 8000) def test_slice(self): self.one_second.seek(0) audio3, framerate3 = get_audio('test/three-second.wav') audio1, framerate1 = get_audio(self.one_second) self.assertEqual(audio3[8000], audio1[0]) def test_low_framerate(self): self.low_framerate.seek(0) audio, framerate = get_audio(self.low_framerate) self.assertEqual(len(audio), 12000) self.assertEqual(framerate, 4000) def test_subsampling(self): self.low_framerate.seek(0) audio, framerate = get_audio(self.low_framerate) audio3, framerate3 = get_audio('test/three-second.wav') self.assertEqual(audio[2000], audio3[4000])
gpl-2.0
Droces/casabio
vendor/phpexiftool/phpexiftool/lib/PHPExiftool/Driver/Tag/DICOM/DataPointRows.php
708
<?php /* * This file is part of PHPExifTool. * * (c) 2012 Romain Neutron <imprec@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace PHPExiftool\Driver\Tag\DICOM; use PHPExiftool\Driver\AbstractTag; class DataPointRows extends AbstractTag { protected $Id = '0028,9001'; protected $Name = 'DataPointRows'; protected $FullName = 'DICOM::Main'; protected $GroupName = 'DICOM'; protected $g0 = 'DICOM'; protected $g1 = 'DICOM'; protected $g2 = 'Image'; protected $Type = '?'; protected $Writable = false; protected $Description = 'Data Point Rows'; }
gpl-2.0
adrianjonmiller/Anacap-Tech
xmlrpc.php
2723
<?php /** * XML-RPC protocol support for WordPress * * @package WordPress */ /** * Whether this is an XML-RPC Request * * @var bool */ define('XMLRPC_REQUEST', true); // Some browser-embedded clients send cookies. We don't want them. $_COOKIE = array(); // A bug in PHP < 5.2.2 makes $HTTP_RAW_POST_DATA not set by default, // but we can do it ourself. if ( !isset( $HTTP_RAW_POST_DATA ) ) { $HTTP_RAW_POST_DATA = file_get_contents( 'php://input' ); } // fix for mozBlog and other cases where '<?xml' isn't on the very first line if ( isset($HTTP_RAW_POST_DATA) ) $HTTP_RAW_POST_DATA = trim($HTTP_RAW_POST_DATA); /** Include the bootstrap for setting up WordPress environment */ include('./wp-load.php'); if ( isset( $_GET['rsd'] ) ) { // http://archipelago.phrasewise.com/rsd header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true); ?> <?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?> <rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd"> <service> <engineName>WordPress</engineName> <engineLink>http://wordpress.org/</engineLink> <homePageLink><?php bloginfo_rss('url') ?></homePageLink> <apis> <api name="WordPress" blogID="1" preferred="true" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" /> <api name="Movable Type" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" /> <api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" /> <api name="Blogger" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" /> <?php do_action( 'xmlrpc_rsd_apis' ); ?> </apis> </service> </rsd> <?php exit; } include_once(ABSPATH . 'wp-admin/includes/admin.php'); include_once(ABSPATH . WPINC . '/class-IXR.php'); include_once(ABSPATH . WPINC . '/class-wp-xmlrpc-server.php'); /** * Posts submitted via the XML-RPC interface get that title * @name post_default_title * @var string */ $post_default_title = ""; // Allow for a plugin to insert a different class to handle requests. $wp_xmlrpc_server_class = apply_filters('wp_xmlrpc_server_class', 'wp_xmlrpc_server'); $wp_xmlrpc_server = new $wp_xmlrpc_server_class; // Fire off the request $wp_xmlrpc_server->serve_request(); exit; /** * logIO() - Writes logging info to a file. * * @deprecated 3.4.0 * @deprecated Use error_log() * * @param string $io Whether input or output * @param string $msg Information describing logging reason. */ function logIO( $io, $msg ) { _deprecated_function( __FUNCTION__, '3.4', 'error_log()' ); if ( ! empty( $GLOBALS['xmlrpc_logging'] ) ) error_log( $io . ' - ' . $msg ); }
gpl-2.0
BlacksheepNZ/BattleOn
BattleOn/Assets/Engine/Engine/Event/StepFinishedEvent.cs
204
namespace BattleOn.Engine { public class StepFinishedEvent { public readonly Step Step; public StepFinishedEvent(Step step) { Step = step; } } }
gpl-2.0
juanmtorrijos/pmts-training
js/script.js
5791
//options var rttheme_slider_time_out = jQuery("meta[name=rttheme_slider_time_out]").attr('content'); var rttheme_slider_numbers = jQuery("meta[name=rttheme_slider_numbers]").attr('content'); var rttheme_template_dir = jQuery("meta[name=rttheme_template_dir]").attr('content'); //home page slider jQuery(document).ready(function(){ var slider_area; var slider_buttons; // Which slider if (jQuery('#slider_area').length>0){ // Home Page Slider slider_area="#slider_area"; if(rttheme_slider_numbers=='true'){slider_buttons="#numbers";} jQuery(slider_area).cycle({ fx: 'fade', timeout: rttheme_slider_time_out, pager: slider_buttons, cleartype: 1, pagerAnchorBuilder: function(idx) { return '<a href="#" title=""><img src="'+rttheme_template_dir+'/images/pixel.gif" width="14" heigth="14"></a>'; } }); } // portfolio slider if (jQuery('.portfolio_slides').length>0){ slider_area=".portfolio_slides"; jQuery(slider_area).cycle({ fx: 'fade', timeout: 4000, prev: '.left', next: '.right' }); } }); //pretty photo jQuery(document).ready(function(){ jQuery("a[rel^='prettyPhoto']").prettyPhoto({animationSpeed:'slow',theme:'light_rounded',slideshow:false,overlay_gallery: false,social_tools:false,deeplinking:false}); }); //image effects jQuery(document).ready(function(){ var image_e= jQuery(".image.portfolio, .image.product_image"); image_e.mouseover(function(){jQuery(this).stop().animate({ opacity:0.6 }, 400); }).mouseout(function(){ image_e.stop().animate({ opacity:1 }, 400 ); }); }); //validate contact form jQuery(document).ready(function(){ // show a simple loading indicator var loader = jQuery('<img src="'+rttheme_template_dir+'/images/loading.gif" alt="loading..." />') .appendTo(".loading") .hide(); jQuery().ajaxStart(function() { loader.show(); }).ajaxStop(function() { loader.hide(); }).ajaxError(function(a, b, e) { throw e; }); jQuery.validator.messages.required = ""; var v = jQuery("#validate_form").validate({ submitHandler: function(form) { jQuery(form).ajaxSubmit({ target: "#result" }); } }); jQuery("#reset").click(function() { v.resetForm(); }); }); //cufon fonts var rttheme_disable_cufon= jQuery("meta[name=rttheme_disable_cufon]").attr('content'); if(rttheme_disable_cufon!='true') { jQuery(document).ready(function(){ Cufon.replace('h1,h2,h3,h4,h5,h6,.portfolio_categories ul,.title a', {hover: true}); }); } //RT single level drop down menu function rt_navigation(){ var rt_dd_menu = jQuery(".navigation ul.navigation > li"); var first_li_items = jQuery(".navigation ul.navigation li > ul"); first_li_items.each(function(){ jQuery(this).find('>li:first').addClass('first_li'); // class for first li jQuery(this).find('>li:last a').addClass('last_li'); // remove last border }); //current item jQuery(".navigation ul.navigation >li .current_page_item").parent("li:eq(0)").addClass('active'); //first-last list items rt_dd_menu.each(function(){ jQuery(this).children("ul:eq(0)").addClass('first_ul'); jQuery(".navigation ul.navigation li > ul").addClass('first_ul'); jQuery(this).find('li:first').addClass('first_li'); // class for first li jQuery(this).find('li:last a').addClass('last_li'); // remove last border }); //hover jQuery(".navigation ul.navigation > li").hover(function() { jQuery(this).addClass('li_active'); jQuery(this).children("a:eq(0)").addClass('a_active'); jQuery(this).find('ul:first').stop().css({overflow:"hidden", height:"auto", display:"none",'paddingTop':'5px','paddingBottom':'15px'}).slideDown(200, function(){jQuery(this).css({overflow:"visible", height:"auto"});}); }, function() { jQuery(this).find('ul:first').stop().slideUp(200, function(){jQuery(this).css({overflow:"hidden", display:"none"});}); var active_class=jQuery(this).attr("class"); if (active_class!="active"){ jQuery(this).removeClass('li_active'); jQuery(this).children("a:eq(0)").removeClass('a_active'); } }); } jQuery(document).ready(function() { rt_navigation(); }); //search field function jQuery(document).ready(function() { var search_text=jQuery(".search_bar .search_text").val(); jQuery(".search_bar .search_text").focus(function() { jQuery(".search_bar .search_text").val(''); }) }); //product tabs jQuery(document).ready(function() { if (jQuery('#tabs').length>0){ jQuery('#tabs > ul').tabs({ fx: { height: 'toggle', opacity: 'toggle' } }); } }); //preloading jQuery(function () { //jQuery('.preload').hide();//hide all the images on the page jQuery('.play,.magnifier').css({opacity:0}); jQuery('.preload').css({opacity:0}); jQuery('.preload').addClass("animated"); jQuery('.play,.magnifier').addClass("animated_icon"); }); var i = 0;//initialize var cint=0;//Internet Explorer Fix jQuery(window).bind("load", function() {//The load event will only fire if the entire page or document is fully loaded var cint = setInterval("doThis(i)",70);//500 is the fade in speed in milliseconds }); function doThis() { var images = jQuery('.preload').length;//count the number of images on the page if (i >= images) {// Loop the images clearInterval(cint);//When it reaches the last image the loop ends } //jQuery('.preload:hidden').eq(i).fadeIn(500);//fades in the hidden images one by one jQuery('.animated_icon').eq(0).animate({opacity:1},{"duration": 500}); jQuery('.animated').eq(0).animate({opacity:1},{"duration": 500}); jQuery('.animated').eq(0).removeClass("animated"); jQuery('.animated_icon').eq(0).removeClass("animated_icon"); i++;//add 1 to the count }
gpl-2.0
makiozmurai/dig-wp
wp-content/themes/chill_tcd016/comments.php
8183
<?php if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME'])) die ('Please do not load this page directly. Thanks!'); if (function_exists('post_password_required')) { if ( post_password_required() ) { echo '<div id="comments"><div class="password_protected"><p>';_e('This post is password protected. Enter the password to view comments.','tcd-w'); echo '</p></div></div>'; return; }; } else { if (!empty($post->post_password)) { // if there's a password if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie ?> <div id="comments"><div class="password_protected"><p><?php _e('This post is password protected. Enter the password to view comments.','tcd-w'); ?></p></div></div> <?php return; } } } ?> <?php //custom comments function by mg12 - http://www.neoease.com/ ?> <?php if (function_exists('wp_list_comments')) { $trackbacks = $comments_by_type['pings']; } else { $trackbacks = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1' AND (comment_type = 'pingback' OR comment_type = 'trackback') ORDER BY comment_date", $post->ID)); } ?> <?php if ($comments || comments_open()) ://if there is comment and comment is open ?> <div id="comment_header"> <h3 id="comment_headline"><?php _e('Comment', 'tcd-w'); ?></h3> <ul class="clearfix"> <?php if(pings_open()) ://if trackback is open ?> <li id="trackback_switch"><a class="no_effect" href="javascript:void(0);"><?php _e('Trackback','tcd-w'); ?><?php echo (' ( ' . count($trackbacks) . ' )'); ?></a></li> <li id="comment_switch" class="comment_switch_active"><a class="no_effect" href="javascript:void(0);"><?php _e('Comments','tcd-w'); ?><?php echo (' ( ' . (count($comments)-count($trackbacks)) . ' )'); ?></a></li> <?php else ://if comment is closed,show onky number ?> <li id="trackback_closed"><p><?php _e('Trackback are closed','tcd-w'); ?></p></li> <li id="comment_closed"><p><?php _e('Comments', 'tcd-w'); echo (' (' . (count($comments)-count($trackbacks)) . ')'); ?></p></li> <?php endif; ?> </ul> <?php if(pings_open()) ://if trackback is open ?> <?php endif; ?> </div><!-- END #comment_header --> <div id="comments"> <div id="comment_area"> <!-- start commnet --> <ol class="commentlist"> <?php if ($comments && count($comments) - count($trackbacks) > 0) { // for WordPress 2.7 or higher if (function_exists('wp_list_comments')) { wp_list_comments('type=comment&callback=custom_comments'); // for WordPress 2.6.3 or lower } else { foreach ($comments as $comment) { if($comment->comment_type != 'pingback' && $comment->comment_type != 'trackback') { custom_comments($comment, null, null); } } } } else { ?> <li class="comment"> <div class="comment-content"><p><?php _e('No comments yet.','tcd-w'); ?></p></div> </li> <?php } ?> </ol> <!-- comments END --> <?php if (get_option('page_comments')) { $comment_pages = paginate_comments_links('echo=0'); if ($comment_pages) { ?> <div id="comment_pager" class="clearfix"> <?php echo $comment_pages; ?> </div> <?php }} // END comment pages ?> </div><!-- #comment-list END --> <div id="trackback_area"> <!-- start trackback --> <?php if (pings_open()) ://id trackback is open ?> <ol class="commentlist"> <?php if ($trackbacks) : $trackbackcount = 0; ?> <?php foreach ($trackbacks as $comment) : ?> <li class="comment"> <div class="trackback_time"> <?php echo get_comment_time(__('F jS, Y', 'tcd-w')) ?> <?php edit_comment_link(__('[ EDIT ]', 'tcd-w'), '', ''); ?> </div> <div class="trackback_title"> <?php _e('Trackback from : ' , 'tcd-w'); ?><a href="<?php comment_author_url() ?>" rel="nofollow"><?php comment_author(); ?></a> </div> </li> <?php endforeach; ?> <?php else : ?> <li class="comment"><div class="comment-content"><p><?php _e('No trackbacks yet.','tcd-w'); ?></p></div></li> <?php endif; ?> </ol> <?php $options = get_desing_plus_option(); if ($options['show_trackback']) : ?> <div id="trackback_url_area"> <label for="trackback_url"><?php _e('TRACKBACK URL' , 'tcd-w'); ?></label> <input type="text" name="trackback_url" id="trackback_url" size="60" value="<?php trackback_url() ?>" readonly="readonly" onfocus="this.select()" /> </div> <?php endif; ?> <?php endif; ?> <!-- trackback end --> </div><!-- #trackbacklist END --> <?php else : // if comment is close ?> <div id="comments"> <?php endif; // END comment is open ?> <?php if (!comments_open()) : // if comment are closed and don't have any comments ?> <div class="comment_closed" id="respond"> <?php _e('Comment are closed.','tcd-w'); ?> </div> <?php elseif ( get_option('comment_registration') && !$user_ID ) : // If registration required and not logged in. ?> <div class="comment_form_wrapper" id="respond"> <?php if (function_exists('wp_login_url')) { $login_link = wp_login_url(); } else { $login_link = get_site_url() . '/wp-login.php?redirect_to=' . urlencode(get_permalink()); } ?> <?php printf(__('You must be <a href="%s">logged in</a> to post a comment.', 'tcd-w'), $login_link); ?> </div> <?php else ://if comment is open ?> <fieldset class="comment_form_wrapper" id="respond"> <?php if (function_exists('comment_reply_link')) { ?> <div id="cancel_comment_reply"><?php cancel_comment_reply_link() ?></div> <?php } ?> <form action="<?php echo esc_url(site_url('/')); ?>wp-comments-post.php" method="post" id="commentform"> <?php if ( $user_ID ) : ?> <div id="comment_user_login"> <p><?php printf(__('Logged in as <a href="%1$s">%2$s</a>.', 'tcd-w'), get_site_url() . '/wp-admin/profile.php', $user_identity); ?><span><a href="<?php echo wp_logout_url(get_permalink()); ?>" title="<?php _e('Log out of this account', 'tcd-w'); ?>"><?php _e('[ Log out ]', 'tcd-w'); ?></a></span></p> </div><!-- #comment-user-login END --> <?php else : ?> <div id="guest_info"> <div id="guest_name"><label for="author"><span><?php _e('NAME','tcd-w'); ?></span><?php if ($req) _e('( required )', 'tcd-w'); ?></label><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> /></div> <div id="guest_email"><label for="email"><span><?php _e('E-MAIL','tcd-w'); ?></span><?php if ($req) _e('( required )', 'tcd-w'); ?> <?php _e('- will not be published -','tcd-w'); ?></label><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> /></div> <div id="guest_url"><label for="url"><span><?php _e('URL','tcd-w'); ?></span></label><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" /></div> <?php if ( function_exists('cs_print_smilies') ) { echo '<div id="custom_smilies">'; cs_print_smilies(); echo "</div>\n"; } ?> </div> <?php endif; ?> <div id="comment_textarea"> <textarea name="comment" id="comment" cols="50" rows="10" tabindex="4"></textarea> </div> <?php if (function_exists('show_subscription_checkbox')) { show_subscription_checkbox(); } ?> <div id="submit_comment_wrapper"> <?php do_action('comment_form', $post->ID); ?> <input name="submit" type="submit" id="submit_comment" tabindex="5" value="<?php _e('Submit Comment', 'tcd-w'); ?>" title="<?php _e('Submit Comment', 'tcd-w'); ?>" alt="<?php _e('Submit Comment', 'tcd-w'); ?>" /> </div> <div id="input_hidden_field"> <?php if (function_exists('comment_id_fields')) { ?> <?php comment_id_fields(); ?> <?php } else { ?> <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" /> <?php } ?> </div> </form> </fieldset><!-- #comment-form-area END --> <?php endif; ?> </div><!-- #comment end -->
gpl-2.0
Automattic/wp-calypso
packages/launch/src/focused-launch/summary/index.tsx
22985
/* eslint-disable wpcalypso/jsx-classname-namespace */ import DomainPicker, { mockDomainSuggestion, SUGGESTION_ITEM_TYPE_INDIVIDUAL, } from '@automattic/domain-picker'; import { useLocalizeUrl, useLocale } from '@automattic/i18n-utils'; import { ActionButtons, NextButton, SubTitle, Title } from '@automattic/onboarding'; import { TextControl, SVG, Path, Tooltip, Circle, Rect, Button } from '@wordpress/components'; import { useSelect, useDispatch } from '@wordpress/data'; import { createInterpolateElement } from '@wordpress/element'; import { __, sprintf } from '@wordpress/i18n'; import { Icon, check } from '@wordpress/icons'; import classNames from 'classnames'; import * as React from 'react'; import { Link } from 'react-router-dom'; import { FOCUSED_LAUNCH_FLOW_ID } from '../../constants'; import LaunchContext from '../../context'; import { useTitle, useDomainSearch, useSiteDomains, useDomainSelection, useSite, usePlans, useCart, } from '../../hooks'; import { LAUNCH_STORE, SITE_STORE, PLANS_STORE } from '../../stores'; import { Route } from '../route'; import FocusedLaunchSummaryItem, { LeadingContentSide, TrailingContentSide, } from './focused-launch-summary-item'; import type { Plan, PlanProduct } from '../../stores'; import './style.scss'; const bulb = ( <SVG viewBox="0 0 24 24"> <Path d="M12 15.8c-3.7 0-6.8-3-6.8-6.8s3-6.8 6.8-6.8c3.7 0 6.8 3 6.8 6.8s-3.1 6.8-6.8 6.8zm0-12C9.1 3.8 6.8 6.1 6.8 9s2.4 5.2 5.2 5.2c2.9 0 5.2-2.4 5.2-5.2S14.9 3.8 12 3.8zM8 17.5h8V19H8zM10 20.5h4V22h-4z" /> </SVG> ); const info = ( <SVG className="focused-launch-summary__info-icon" viewBox="0 0 24 24" width="16"> <Circle cx="12" cy="12" stroke="#8C8F94" strokeWidth="2" r="10" fill="transparent" /> <Rect x="10.5" y="5" width="3" height="3" fill="#8C8F94" /> <Rect x="10.5" y="10" width="3" height="8" fill="#8C8F94" /> </SVG> ); type SummaryStepProps = { input: React.ReactNode; commentary?: React.ReactNode; highlighted: boolean; }; const SummaryStep: React.FunctionComponent< SummaryStepProps > = ( { input, commentary, highlighted, } ) => ( <div className={ classNames( 'focused-launch-summary__step', { highlighted } ) }> <div className="focused-launch-summary__data-input"> <div className="focused-launch-summary__section">{ input }</div> </div> <div className="focused-launch-summary__side-commentary">{ commentary }</div> </div> ); type CommonStepProps = { stepIndex?: number; highlighted?: boolean; }; // Props in common between all summary steps + a few props from <TextControl> type SiteTitleStepProps = CommonStepProps & Pick< React.ComponentProps< typeof TextControl >, 'value' | 'onChange' | 'onBlur' >; const SiteTitleStep: React.FunctionComponent< SiteTitleStepProps > = ( { stepIndex, value, onChange, onBlur, } ) => { return ( <SummaryStep highlighted input={ <TextControl className="focused-launch-summary__input" label={ <label className="focused-launch-summary__label"> { stepIndex && `${ stepIndex }. ` } { __( 'Name your site', __i18n_text_domain__ ) } </label> } value={ value } onChange={ onChange } onBlur={ onBlur } /> } /> ); }; // Props in common between all summary steps + a few props from <DomainPicker> + // the remaining extra props type DomainStepProps = CommonStepProps & { hasPaidDomain?: boolean; isLoading: boolean } & Pick< React.ComponentProps< typeof DomainPicker >, | 'existingSubdomain' | 'currentDomain' | 'initialDomainSearch' | 'onDomainSelect' | 'onExistingSubdomainSelect' >; const DomainStep: React.FunctionComponent< DomainStepProps > = ( { stepIndex, existingSubdomain, currentDomain, initialDomainSearch, hasPaidDomain, onDomainSelect, onExistingSubdomainSelect, isLoading, highlighted, } ) => { const locale = useLocale(); return ( <SummaryStep highlighted={ !! highlighted } input={ hasPaidDomain ? ( <> <label className="focused-launch-summary__label"> { __( 'Your domain', __i18n_text_domain__ ) } <Tooltip position="top center" text={ __( 'Changes to your purchased domain can be managed from your Domains page.', __i18n_text_domain__ ) } > <span>{ info }</span> </Tooltip> <p className="focused-launch-summary__mobile-commentary"> <Icon icon={ bulb } /> <span> { createInterpolateElement( __( '<strong>Unique domains</strong> help build brand trust', __i18n_text_domain__ ), { strong: <strong />, } ) } </span> </p> </label> <FocusedLaunchSummaryItem readOnly> <LeadingContentSide label={ currentDomain?.domain_name || '' } /> <TrailingContentSide nodeType="PRICE"> <Icon icon={ check } size={ 18 } /> { __( 'Purchased', __i18n_text_domain__ ) } </TrailingContentSide> </FocusedLaunchSummaryItem> </> ) : ( <> <DomainPicker header={ <> <label className="focused-launch-summary__label"> { stepIndex && `${ stepIndex }. ` } { __( 'Confirm your domain', __i18n_text_domain__ ) } </label> <p className="focused-launch-summary__mobile-commentary"> <Icon icon={ bulb } /> <span> { createInterpolateElement( __( '<strong>46.9%</strong> of registered domains are <strong>.com</strong>', __i18n_text_domain__ ), { strong: <strong />, } ) } </span> </p> </> } areDependenciesLoading={ isLoading } existingSubdomain={ existingSubdomain } currentDomain={ currentDomain } onDomainSelect={ onDomainSelect } onExistingSubdomainSelect={ onExistingSubdomainSelect } initialDomainSearch={ initialDomainSearch } showSearchField={ false } analyticsFlowId={ FOCUSED_LAUNCH_FLOW_ID } analyticsUiAlgo="summary_domain_step" quantity={ 3 } quantityExpanded={ 3 } itemType={ SUGGESTION_ITEM_TYPE_INDIVIDUAL } locale={ locale } orderSubDomainsLast={ true } /> <Link to={ Route.DomainDetails } className="focused-launch-summary__details-link"> { __( 'View all domains', __i18n_text_domain__ ) } </Link> </> ) } commentary={ <> { hasPaidDomain ? ( <p className="focused-launch-summary__side-commentary-title"> { createInterpolateElement( __( '<strong>Unique domains</strong> help build brand recognition and trust', __i18n_text_domain__ ), { strong: <strong />, } ) } </p> ) : ( <> <p className="focused-launch-summary__side-commentary-title"> { createInterpolateElement( __( '<strong>46.9%</strong> of globally registered domains are <strong>.com</strong>', __i18n_text_domain__ ), { strong: <strong />, } ) } </p> <ul className="focused-launch-summary__side-commentary-list"> <li className="focused-launch-summary__side-commentary-list-item"> <Icon icon={ check } /> { __( 'Stand out with a unique domain', __i18n_text_domain__ ) } </li> <li className="focused-launch-summary__side-commentary-list-item"> <Icon icon={ check } /> { __( 'Easy to remember and easy to share', __i18n_text_domain__ ) } </li> <li className="focused-launch-summary__side-commentary-list-item"> <Icon icon={ check } /> { __( 'Builds brand recognition and trust', __i18n_text_domain__ ) } </li> </ul> </> ) } </> } /> ); }; type PlanStepProps = CommonStepProps & { hasPaidPlan?: boolean; hasPaidDomain?: boolean; selectedPaidDomain?: boolean; }; const PlanStep: React.FunctionComponent< PlanStepProps > = ( { stepIndex, highlighted, hasPaidPlan = false, hasPaidDomain = false, selectedPaidDomain = false, } ) => { const locale = useLocale(); const { setPlanProductId } = useDispatch( LAUNCH_STORE ); const [ selectedPlanProductId, billingPeriod ] = useSelect( ( select ) => [ select( LAUNCH_STORE ).getSelectedPlanProductId(), select( LAUNCH_STORE ).getLastPlanBillingPeriod(), ] ); const { selectedPlan, selectedPlanProduct } = useSelect( ( select ) => { const plansStore = select( PLANS_STORE ); return { selectedPlan: plansStore.getPlanByProductId( selectedPlanProductId, locale ), selectedPlanProduct: plansStore.getPlanProductById( selectedPlanProductId ), }; } ); // persist non-default selected paid plan if it's paid in order to keep displaying it in the plan picker const [ nonDefaultPaidPlan, setNonDefaultPaidPlan ] = React.useState< Plan | undefined >(); const [ nonDefaultPaidPlanProduct, setNonDefaultPaidPlanProduct ] = React.useState< PlanProduct | undefined >(); const { defaultPaidPlan, defaultFreePlan, defaultPaidPlanProduct, defaultFreePlanProduct, } = usePlans( billingPeriod ); React.useEffect( () => { if ( selectedPlan && defaultPaidPlan && ! selectedPlan.isFree && selectedPlan.periodAgnosticSlug !== defaultPaidPlan.periodAgnosticSlug ) { setNonDefaultPaidPlan( selectedPlan ); setNonDefaultPaidPlanProduct( selectedPlanProduct ); } }, [ selectedPlan, defaultPaidPlan, nonDefaultPaidPlan, selectedPlanProduct ] ); const isPlanSelected = ( plan: Plan ) => plan && plan.periodAgnosticSlug === selectedPlan?.periodAgnosticSlug; const { sitePlan } = useSite(); const allAvailablePlans: ( Plan | undefined )[] = nonDefaultPaidPlan ? [ defaultPaidPlan, nonDefaultPaidPlan, defaultFreePlan ] : [ defaultPaidPlan, defaultFreePlan ]; const allAvailablePlansProducts: ( PlanProduct | undefined )[] = nonDefaultPaidPlanProduct ? [ defaultPaidPlanProduct, nonDefaultPaidPlanProduct, defaultFreePlanProduct ] : [ defaultPaidPlanProduct, defaultFreePlanProduct ]; const popularLabel = __( 'Popular', __i18n_text_domain__ ); const freePlanLabel = __( 'Free', __i18n_text_domain__ ); const freePlanLabelNotAvailable = __( 'Not available with your domain selection', __i18n_text_domain__ ); return ( <SummaryStep highlighted={ !! highlighted } input={ hasPaidPlan ? ( <> <label className="focused-launch-summary__label"> { __( 'Your plan', __i18n_text_domain__ ) } <Tooltip position="top center" text={ __( 'Changes to your purchased plan can be managed from your Plans page.', __i18n_text_domain__ ) } > <span>{ info }</span> </Tooltip> <p className="focused-launch-summary__mobile-commentary focused-launch-summary__mobile-only"> <Icon icon={ bulb } /> <span> { createInterpolateElement( __( 'More than <strong>38%</strong> of the internet uses <strong>WordPress</strong>', __i18n_text_domain__ ), { strong: <strong />, } ) } </span> </p> </label> <div> <FocusedLaunchSummaryItem readOnly={ true }> <LeadingContentSide label={ sprintf( /* translators: Purchased plan label where %s is the WordPress.com plan name (eg: Personal, Premium, Business) */ __( '%s Plan', __i18n_text_domain__ ), sitePlan?.product_name_short ) } /> <TrailingContentSide nodeType="PRICE"> <Icon icon={ check } size={ 18 } /> { __( 'Purchased', __i18n_text_domain__ ) } </TrailingContentSide> </FocusedLaunchSummaryItem> </div> </> ) : ( <> <label className="focused-launch-summary__label"> { stepIndex && `${ stepIndex }. ` } { __( 'Confirm your plan', __i18n_text_domain__ ) } </label> <p className="focused-launch-summary__mobile-commentary focused-launch-summary__mobile-only"> <Icon icon={ bulb } /> <span> { createInterpolateElement( __( 'Grow your business with <strong>WordPress Business</strong>', __i18n_text_domain__ ), { strong: <strong />, } ) } </span> </p> <div> { allAvailablePlans.map( ( plan, index ) => { const planProduct = allAvailablePlansProducts[ index ]; if ( ! plan || ! planProduct || plan.periodAgnosticSlug !== planProduct?.periodAgnosticSlug ) { return <FocusedLaunchSummaryItem key={ index } isLoading />; } return ( <FocusedLaunchSummaryItem key={ plan.periodAgnosticSlug } isLoading={ ! defaultFreePlan || ! defaultPaidPlan } onClick={ () => setPlanProductId( allAvailablePlansProducts[ index ]?.productId ) } isSelected={ isPlanSelected( plan ) } readOnly={ plan.isFree && ( hasPaidDomain || selectedPaidDomain ) } > <LeadingContentSide label={ sprintf( /* translators: %s is WordPress.com plan name (eg: Premium Plan) */ __( '%s Plan', __i18n_text_domain__ ), plan.title ?? '' ) } badgeText={ plan.isPopular ? popularLabel : '' } /> { plan.isFree ? ( <TrailingContentSide nodeType={ hasPaidDomain || selectedPaidDomain ? 'WARNING' : 'PRICE' } > { hasPaidDomain || selectedPaidDomain ? freePlanLabelNotAvailable : freePlanLabel } </TrailingContentSide> ) : ( <TrailingContentSide nodeType="PRICE"> <span>{ allAvailablePlansProducts[ index ]?.price }</span> <span> { // translators: /mo is short for "per-month" __( '/mo', __i18n_text_domain__ ) } </span> </TrailingContentSide> ) } </FocusedLaunchSummaryItem> ); } ) } </div> <Link to={ Route.PlanDetails } className="focused-launch-summary__details-link"> { __( 'View all plans', __i18n_text_domain__ ) } </Link> </> ) } commentary={ hasPaidPlan ? ( <p className="focused-launch-summary__side-commentary-title"> { createInterpolateElement( __( 'More than <strong>38%</strong> of the internet uses <strong>WordPress</strong>', __i18n_text_domain__ ), { strong: <strong />, } ) } </p> ) : ( <> <p className="focused-launch-summary__side-commentary-title"> { createInterpolateElement( __( 'Monetize your site with <strong>WordPress Premium</strong>', __i18n_text_domain__ ), { strong: <strong />, } ) } </p> <ul className="focused-launch-summary__side-commentary-list"> <li className="focused-launch-summary__side-commentary-list-item"> <Icon icon={ check } /> { __( 'Advanced tools and customization', __i18n_text_domain__ ) } </li> <li className="focused-launch-summary__side-commentary-list-item"> <Icon icon={ check } /> { __( 'Accept payments', __i18n_text_domain__ ) } </li> </ul> </> ) } /> ); }; type StepIndexRenderFunction = ( renderOptions: { stepIndex: number; forwardStepIndex: boolean; } ) => React.ReactNode; const Summary: React.FunctionComponent = () => { const { siteId } = React.useContext( LaunchContext ); const [ hasSelectedDomain, isSiteTitleStepVisible, selectedDomain, selectedPlanProductId, ] = useSelect( ( select ) => { const launchStore = select( LAUNCH_STORE ); const { isSiteTitleStepVisible, domain, planProductId } = launchStore.getState(); return [ launchStore.hasSelectedDomainOrSubdomain(), isSiteTitleStepVisible, domain, planProductId, ]; }, [] ); const isSelectedPlanPaid = useSelect( ( select ) => select( LAUNCH_STORE ).isSelectedPlanPaid(), [] ); const { launchSite } = useDispatch( SITE_STORE ); const { setModalDismissible, unsetModalDismissible, showModalTitle, showSiteTitleStep, } = useDispatch( LAUNCH_STORE ); const { title, isValidTitle, isDefaultTitle, updateTitle } = useTitle(); const { siteSubdomain, hasPaidDomain } = useSiteDomains(); const { onDomainSelect, onExistingSubdomainSelect, currentDomain } = useDomainSelection(); const { domainSearch, isLoading } = useDomainSearch(); const { hasPaidPlan } = useSite(); const locale = useLocale(); const localizeUrl = useLocalizeUrl(); const { goToCheckoutAndLaunch, isCartUpdating } = useCart(); // When the summary view is active, if cart is not updating, the modal should be dismissible, and // the modal title should be visible React.useEffect( () => { if ( isCartUpdating ) { unsetModalDismissible(); } else { setModalDismissible(); } showModalTitle(); }, [ isCartUpdating, setModalDismissible, showModalTitle, unsetModalDismissible ] ); // If the user needs to change the site title, always show the site title // step to the user when in this launch flow. // Allow changing site title when it's the default value or when it's an empty string. React.useEffect( () => { if ( ! isSiteTitleStepVisible && isDefaultTitle ) { showSiteTitleStep(); } }, [ isDefaultTitle, showSiteTitleStep, isSiteTitleStepVisible, title ] ); // Launch the site directly if Free plan and subdomain are selected. // Otherwise, show checkout as the next step. const handleLaunch = () => { // checking for not having a selected paid plan instead of checking for a selected Free plan because // user may be entering the launch flow after they have paid for a plan. if ( ! selectedDomain && ! isSelectedPlanPaid ) { launchSite( siteId ); } else { goToCheckoutAndLaunch(); } }; // Prepare Steps const renderSiteTitleStep: StepIndexRenderFunction = ( { stepIndex, forwardStepIndex } ) => ( <SiteTitleStep stepIndex={ forwardStepIndex ? stepIndex : undefined } key={ stepIndex } value={ title || '' } onChange={ updateTitle } /> ); const isDomainStepHighlighted = !! selectedPlanProductId || !! hasSelectedDomain || isValidTitle; const renderDomainStep: StepIndexRenderFunction = ( { stepIndex, forwardStepIndex } ) => ( <DomainStep highlighted={ isDomainStepHighlighted } stepIndex={ forwardStepIndex ? stepIndex : undefined } key={ stepIndex } existingSubdomain={ mockDomainSuggestion( siteSubdomain?.domain ) } currentDomain={ currentDomain } initialDomainSearch={ domainSearch } hasPaidDomain={ hasPaidDomain } isLoading={ isLoading } onDomainSelect={ onDomainSelect } /** NOTE: this makes the assumption that the user has a free domain, * thus when they click the free domain, we just remove the value from the store * this is a valid strategy in this context because they won't even see this step if * they already have a paid domain * */ onExistingSubdomainSelect={ onExistingSubdomainSelect } /> ); const isPlansStepHighlighted = !! hasSelectedDomain || !! selectedPlanProductId; const renderPlanStep: StepIndexRenderFunction = ( { stepIndex, forwardStepIndex } ) => ( <PlanStep highlighted={ isPlansStepHighlighted } hasPaidPlan={ hasPaidPlan } selectedPaidDomain={ selectedDomain && ! selectedDomain.is_free } // @TODO: check if selectedDomain can ever be free hasPaidDomain={ hasPaidDomain } stepIndex={ forwardStepIndex ? stepIndex : undefined } key={ stepIndex } /> ); // Disabled steps are not interactive (e.g. user has already selected domain/plan) // Active steps require user interaction // Using this arrays allows to easily sort the steps correctly in both // groups, and allows the active steps to always show the correct step index. const disabledSteps: StepIndexRenderFunction[] = []; const activeSteps: StepIndexRenderFunction[] = []; isSiteTitleStepVisible && activeSteps.push( renderSiteTitleStep ); ( hasPaidDomain ? disabledSteps : activeSteps ).push( renderDomainStep ); ( hasPaidPlan ? disabledSteps : activeSteps ).push( renderPlanStep ); /* * Enable the launch button if: * - the site title input is not empty * - there is a purchased or selected domain * - there is a purchased or selected plan */ const isReadyToLaunch = title && ( hasPaidDomain || hasSelectedDomain ) && ( hasPaidPlan || selectedPlanProductId ); const titleReady = __( "You're ready to launch", __i18n_text_domain__ ); const titleInProgress = __( "You're almost there", __i18n_text_domain__ ); const subtitleReady = __( "You're good to go! Launch your site and share your site address.", __i18n_text_domain__ ); const subtitleInProgress = __( 'Prepare for launch! Confirm a few final things before you take it live.', __i18n_text_domain__ ); return ( <div className="focused-launch-container"> <div className="focused-launch-summary__section"> <Title tagName="h2">{ hasPaidDomain && hasPaidPlan ? titleReady : titleInProgress }</Title> <SubTitle tagName="p" className="focused-launch-summary__caption"> { hasPaidDomain && hasPaidPlan ? subtitleReady : subtitleInProgress } </SubTitle> </div> { disabledSteps.map( ( disabledStepRenderer, disabledStepIndex ) => // Disabled steps don't show the step index disabledStepRenderer( { stepIndex: disabledStepIndex + 1, forwardStepIndex: false, } ) ) } { activeSteps.map( ( activeStepRenderer, activeStepIndex ) => // Active steps show the step index only if there are at least 2 steps activeStepRenderer( { stepIndex: activeStepIndex + 1, forwardStepIndex: activeSteps.length > 1, } ) ) } <div className="focused-launch-summary__actions-wrapper"> <ActionButtons className="focused-launch-summary__launch-action-bar"> <NextButton className={ classNames( 'focused-launch-summary__launch-button', { 'focused-launch-summary__launch-button--is-loading': isCartUpdating, } ) } disabled={ ! isReadyToLaunch || isCartUpdating } onClick={ handleLaunch } > { __( 'Launch your site', __i18n_text_domain__ ) } </NextButton> </ActionButtons> <div className="focused-launch-summary__ask-for-help"> <p>{ __( 'Questions? Our experts can assist.', __i18n_text_domain__ ) }</p> <Button isLink href={ localizeUrl( 'https://wordpress.com/help/contact', locale ) } target="_blank" rel="noopener noreferrer" > { __( 'Ask a Happiness Engineer', __i18n_text_domain__ ) } </Button> </div> </div> </div> ); }; export default Summary;
gpl-2.0
ShoppinPal/warehouse
admin/src/app/home/worker-settings/services/worker-settings-resolver.service.ts
853
import {Injectable} from '@angular/core'; import {Observable} from 'rxjs'; import {UserProfileService} from '../../../shared/services/user-profile.service'; import {StoreConfigModelApi} from '../../../shared/lb-sdk'; @Injectable() export class WorkerSettingsResolverService { private userProfile: any = this._userProfileService.getProfileData(); constructor(private _userProfileService: UserProfileService, private _storeConfigModelApi: StoreConfigModelApi) { } resolve(): Observable<any> { return this.fetchWorkerSettings(); } fetchWorkerSettings(): Observable<any> { return this._storeConfigModelApi.getWorkerSettings(this.userProfile.storeConfigModelId) .map((data: any)=> { return data; }, err => { console.log('Could not find worker status', err); }); } }
gpl-2.0
zhiyu-he/algorithm-trip
growth/oj/leet_code/algorithms/1286-iterator-for-combination.cpp
1143
#include<iostream> #include<string> #include<vector> using namespace std; class CombinationIterator { public: vector<string> all; int next_element; CombinationIterator(string characters, int combinationLength) { next_element = 0; build(characters, combinationLength, "", 0); } void build(string& characters, int combinationLength, string str, int idx) { if (str.length() == combinationLength) { all.push_back(str); return; } if (characters.length() == idx) return; build(characters, combinationLength, str + characters[idx], idx+1); build(characters, combinationLength, str, idx+1); } string next() { return all[next_element++]; } bool hasNext() { return next_element < all.size(); } }; /** * Your CombinationIterator object will be instantiated and called as such: * CombinationIterator* obj = new CombinationIterator(characters, combinationLength); * string param_1 = obj->next(); * bool param_2 = obj->hasNext(); */ int main() { CombinationIterator c("abc", 2); return 0; }
gpl-2.0
atmark-techno/atmark-dist
user/ruby-tzinfo-data/lib/tzinfo/data/definitions/CET.rb
10691
# encoding: UTF-8 # This file contains data derived from the IANA Time Zone Database # (http://www.iana.org/time-zones). module TZInfo module Data module Definitions module CET include TimezoneDefinition timezone 'CET' do |tz| tz.offset :o0, 3600, 0, :CET tz.offset :o1, 3600, 3600, :CEST tz.transition 1916, 4, :o1, -1693706400, 29051813, 12 tz.transition 1916, 9, :o0, -1680483600, 58107299, 24 tz.transition 1917, 4, :o1, -1663455600, 58112029, 24 tz.transition 1917, 9, :o0, -1650150000, 58115725, 24 tz.transition 1918, 4, :o1, -1632006000, 58120765, 24 tz.transition 1918, 9, :o0, -1618700400, 58124461, 24 tz.transition 1940, 4, :o1, -938905200, 58313293, 24 tz.transition 1942, 11, :o0, -857257200, 58335973, 24 tz.transition 1943, 3, :o1, -844556400, 58339501, 24 tz.transition 1943, 10, :o0, -828226800, 58344037, 24 tz.transition 1944, 4, :o1, -812502000, 58348405, 24 tz.transition 1944, 10, :o0, -796777200, 58352773, 24 tz.transition 1945, 4, :o1, -781052400, 58357141, 24 tz.transition 1945, 9, :o0, -766623600, 58361149, 24 tz.transition 1977, 4, :o1, 228877200 tz.transition 1977, 9, :o0, 243997200 tz.transition 1978, 4, :o1, 260326800 tz.transition 1978, 10, :o0, 276051600 tz.transition 1979, 4, :o1, 291776400 tz.transition 1979, 9, :o0, 307501200 tz.transition 1980, 4, :o1, 323830800 tz.transition 1980, 9, :o0, 338950800 tz.transition 1981, 3, :o1, 354675600 tz.transition 1981, 9, :o0, 370400400 tz.transition 1982, 3, :o1, 386125200 tz.transition 1982, 9, :o0, 401850000 tz.transition 1983, 3, :o1, 417574800 tz.transition 1983, 9, :o0, 433299600 tz.transition 1984, 3, :o1, 449024400 tz.transition 1984, 9, :o0, 465354000 tz.transition 1985, 3, :o1, 481078800 tz.transition 1985, 9, :o0, 496803600 tz.transition 1986, 3, :o1, 512528400 tz.transition 1986, 9, :o0, 528253200 tz.transition 1987, 3, :o1, 543978000 tz.transition 1987, 9, :o0, 559702800 tz.transition 1988, 3, :o1, 575427600 tz.transition 1988, 9, :o0, 591152400 tz.transition 1989, 3, :o1, 606877200 tz.transition 1989, 9, :o0, 622602000 tz.transition 1990, 3, :o1, 638326800 tz.transition 1990, 9, :o0, 654656400 tz.transition 1991, 3, :o1, 670381200 tz.transition 1991, 9, :o0, 686106000 tz.transition 1992, 3, :o1, 701830800 tz.transition 1992, 9, :o0, 717555600 tz.transition 1993, 3, :o1, 733280400 tz.transition 1993, 9, :o0, 749005200 tz.transition 1994, 3, :o1, 764730000 tz.transition 1994, 9, :o0, 780454800 tz.transition 1995, 3, :o1, 796179600 tz.transition 1995, 9, :o0, 811904400 tz.transition 1996, 3, :o1, 828234000 tz.transition 1996, 10, :o0, 846378000 tz.transition 1997, 3, :o1, 859683600 tz.transition 1997, 10, :o0, 877827600 tz.transition 1998, 3, :o1, 891133200 tz.transition 1998, 10, :o0, 909277200 tz.transition 1999, 3, :o1, 922582800 tz.transition 1999, 10, :o0, 941331600 tz.transition 2000, 3, :o1, 954032400 tz.transition 2000, 10, :o0, 972781200 tz.transition 2001, 3, :o1, 985482000 tz.transition 2001, 10, :o0, 1004230800 tz.transition 2002, 3, :o1, 1017536400 tz.transition 2002, 10, :o0, 1035680400 tz.transition 2003, 3, :o1, 1048986000 tz.transition 2003, 10, :o0, 1067130000 tz.transition 2004, 3, :o1, 1080435600 tz.transition 2004, 10, :o0, 1099184400 tz.transition 2005, 3, :o1, 1111885200 tz.transition 2005, 10, :o0, 1130634000 tz.transition 2006, 3, :o1, 1143334800 tz.transition 2006, 10, :o0, 1162083600 tz.transition 2007, 3, :o1, 1174784400 tz.transition 2007, 10, :o0, 1193533200 tz.transition 2008, 3, :o1, 1206838800 tz.transition 2008, 10, :o0, 1224982800 tz.transition 2009, 3, :o1, 1238288400 tz.transition 2009, 10, :o0, 1256432400 tz.transition 2010, 3, :o1, 1269738000 tz.transition 2010, 10, :o0, 1288486800 tz.transition 2011, 3, :o1, 1301187600 tz.transition 2011, 10, :o0, 1319936400 tz.transition 2012, 3, :o1, 1332637200 tz.transition 2012, 10, :o0, 1351386000 tz.transition 2013, 3, :o1, 1364691600 tz.transition 2013, 10, :o0, 1382835600 tz.transition 2014, 3, :o1, 1396141200 tz.transition 2014, 10, :o0, 1414285200 tz.transition 2015, 3, :o1, 1427590800 tz.transition 2015, 10, :o0, 1445734800 tz.transition 2016, 3, :o1, 1459040400 tz.transition 2016, 10, :o0, 1477789200 tz.transition 2017, 3, :o1, 1490490000 tz.transition 2017, 10, :o0, 1509238800 tz.transition 2018, 3, :o1, 1521939600 tz.transition 2018, 10, :o0, 1540688400 tz.transition 2019, 3, :o1, 1553994000 tz.transition 2019, 10, :o0, 1572138000 tz.transition 2020, 3, :o1, 1585443600 tz.transition 2020, 10, :o0, 1603587600 tz.transition 2021, 3, :o1, 1616893200 tz.transition 2021, 10, :o0, 1635642000 tz.transition 2022, 3, :o1, 1648342800 tz.transition 2022, 10, :o0, 1667091600 tz.transition 2023, 3, :o1, 1679792400 tz.transition 2023, 10, :o0, 1698541200 tz.transition 2024, 3, :o1, 1711846800 tz.transition 2024, 10, :o0, 1729990800 tz.transition 2025, 3, :o1, 1743296400 tz.transition 2025, 10, :o0, 1761440400 tz.transition 2026, 3, :o1, 1774746000 tz.transition 2026, 10, :o0, 1792890000 tz.transition 2027, 3, :o1, 1806195600 tz.transition 2027, 10, :o0, 1824944400 tz.transition 2028, 3, :o1, 1837645200 tz.transition 2028, 10, :o0, 1856394000 tz.transition 2029, 3, :o1, 1869094800 tz.transition 2029, 10, :o0, 1887843600 tz.transition 2030, 3, :o1, 1901149200 tz.transition 2030, 10, :o0, 1919293200 tz.transition 2031, 3, :o1, 1932598800 tz.transition 2031, 10, :o0, 1950742800 tz.transition 2032, 3, :o1, 1964048400 tz.transition 2032, 10, :o0, 1982797200 tz.transition 2033, 3, :o1, 1995498000 tz.transition 2033, 10, :o0, 2014246800 tz.transition 2034, 3, :o1, 2026947600 tz.transition 2034, 10, :o0, 2045696400 tz.transition 2035, 3, :o1, 2058397200 tz.transition 2035, 10, :o0, 2077146000 tz.transition 2036, 3, :o1, 2090451600 tz.transition 2036, 10, :o0, 2108595600 tz.transition 2037, 3, :o1, 2121901200 tz.transition 2037, 10, :o0, 2140045200 tz.transition 2038, 3, :o1, 2153350800, 59172253, 24 tz.transition 2038, 10, :o0, 2172099600, 59177461, 24 tz.transition 2039, 3, :o1, 2184800400, 59180989, 24 tz.transition 2039, 10, :o0, 2203549200, 59186197, 24 tz.transition 2040, 3, :o1, 2216250000, 59189725, 24 tz.transition 2040, 10, :o0, 2234998800, 59194933, 24 tz.transition 2041, 3, :o1, 2248304400, 59198629, 24 tz.transition 2041, 10, :o0, 2266448400, 59203669, 24 tz.transition 2042, 3, :o1, 2279754000, 59207365, 24 tz.transition 2042, 10, :o0, 2297898000, 59212405, 24 tz.transition 2043, 3, :o1, 2311203600, 59216101, 24 tz.transition 2043, 10, :o0, 2329347600, 59221141, 24 tz.transition 2044, 3, :o1, 2342653200, 59224837, 24 tz.transition 2044, 10, :o0, 2361402000, 59230045, 24 tz.transition 2045, 3, :o1, 2374102800, 59233573, 24 tz.transition 2045, 10, :o0, 2392851600, 59238781, 24 tz.transition 2046, 3, :o1, 2405552400, 59242309, 24 tz.transition 2046, 10, :o0, 2424301200, 59247517, 24 tz.transition 2047, 3, :o1, 2437606800, 59251213, 24 tz.transition 2047, 10, :o0, 2455750800, 59256253, 24 tz.transition 2048, 3, :o1, 2469056400, 59259949, 24 tz.transition 2048, 10, :o0, 2487200400, 59264989, 24 tz.transition 2049, 3, :o1, 2500506000, 59268685, 24 tz.transition 2049, 10, :o0, 2519254800, 59273893, 24 tz.transition 2050, 3, :o1, 2531955600, 59277421, 24 tz.transition 2050, 10, :o0, 2550704400, 59282629, 24 tz.transition 2051, 3, :o1, 2563405200, 59286157, 24 tz.transition 2051, 10, :o0, 2582154000, 59291365, 24 tz.transition 2052, 3, :o1, 2595459600, 59295061, 24 tz.transition 2052, 10, :o0, 2613603600, 59300101, 24 tz.transition 2053, 3, :o1, 2626909200, 59303797, 24 tz.transition 2053, 10, :o0, 2645053200, 59308837, 24 tz.transition 2054, 3, :o1, 2658358800, 59312533, 24 tz.transition 2054, 10, :o0, 2676502800, 59317573, 24 tz.transition 2055, 3, :o1, 2689808400, 59321269, 24 tz.transition 2055, 10, :o0, 2708557200, 59326477, 24 tz.transition 2056, 3, :o1, 2721258000, 59330005, 24 tz.transition 2056, 10, :o0, 2740006800, 59335213, 24 tz.transition 2057, 3, :o1, 2752707600, 59338741, 24 tz.transition 2057, 10, :o0, 2771456400, 59343949, 24 tz.transition 2058, 3, :o1, 2784762000, 59347645, 24 tz.transition 2058, 10, :o0, 2802906000, 59352685, 24 tz.transition 2059, 3, :o1, 2816211600, 59356381, 24 tz.transition 2059, 10, :o0, 2834355600, 59361421, 24 tz.transition 2060, 3, :o1, 2847661200, 59365117, 24 tz.transition 2060, 10, :o0, 2866410000, 59370325, 24 tz.transition 2061, 3, :o1, 2879110800, 59373853, 24 tz.transition 2061, 10, :o0, 2897859600, 59379061, 24 tz.transition 2062, 3, :o1, 2910560400, 59382589, 24 tz.transition 2062, 10, :o0, 2929309200, 59387797, 24 tz.transition 2063, 3, :o1, 2942010000, 59391325, 24 tz.transition 2063, 10, :o0, 2960758800, 59396533, 24 tz.transition 2064, 3, :o1, 2974064400, 59400229, 24 tz.transition 2064, 10, :o0, 2992208400, 59405269, 24 end end end end end
gpl-2.0
stonexx/ideavim
src/com/maddyhome/idea/vim/action/motion/text/MotionParagraphPreviousAction.java
1894
/* * IdeaVim - Vim emulator for IDEs based on the IntelliJ platform * Copyright (C) 2003-2016 The IdeaVim authors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.maddyhome.idea.vim.action.motion.text; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.editor.Caret; import com.intellij.openapi.editor.Editor; import com.maddyhome.idea.vim.VimPlugin; import com.maddyhome.idea.vim.action.motion.MotionEditorAction; import com.maddyhome.idea.vim.command.Argument; import com.maddyhome.idea.vim.handler.MotionEditorActionHandler; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** */ public class MotionParagraphPreviousAction extends MotionEditorAction { public MotionParagraphPreviousAction() { super(new MotionParagraphPreviousHandler()); } private static class MotionParagraphPreviousHandler extends MotionEditorActionHandler { public MotionParagraphPreviousHandler() { super(true); } @Override public int getOffset(@NotNull Editor editor, @NotNull Caret caret, @NotNull DataContext context, int count, int rawCount, @Nullable Argument argument) { return VimPlugin.getMotion().moveCaretToNextParagraph(editor, caret, -count); } } }
gpl-2.0
oat-sa/qti-sdk
test/qtismtest/data/storage/xml/versions/QtiVersionTest.php
2987
<?php namespace qtismtest\data\storage\xml\versions; use qtism\data\storage\xml\versions\QtiVersion; use qtism\data\storage\xml\versions\QtiVersion200; use qtism\data\storage\xml\versions\QtiVersion210; use qtism\data\storage\xml\versions\QtiVersion211; use qtism\data\storage\xml\versions\QtiVersion220; use qtism\data\storage\xml\versions\QtiVersion221; use qtism\data\storage\xml\versions\QtiVersion222; use qtism\data\storage\xml\versions\QtiVersion223; use qtism\data\storage\xml\versions\QtiVersion224; use qtism\data\storage\xml\versions\QtiVersion300; use qtism\data\storage\xml\versions\QtiVersionException; use qtismtest\QtiSmTestCase; /** * Class QtiVersionTest */ class QtiVersionTest extends QtiSmTestCase { public function testVersionCompareValid() { $this::assertTrue(QtiVersion::compare('2', '2.0.0', '=')); $this::assertFalse(QtiVersion::compare('2', '2.1', '=')); } public function testVersionCompareInvalidVersion1() { $msg = 'QTI version "2.1.4" is not supported. Supported versions are "2.0.0", "2.1.0", "2.1.1", "2.2.0", "2.2.1", "2.2.2", "2.2.3", "2.2.4", "3.0.0".'; $this->expectException(QtiVersionException::class); $this->expectExceptionMessage($msg); QtiVersion::compare('2.1.4', '2.1.1', '>'); } public function testVersionCompareInvalidVersion2() { $msg = 'QTI version "2.1.4" is not supported. Supported versions are "2.0.0", "2.1.0", "2.1.1", "2.2.0", "2.2.1", "2.2.2", "2.2.3", "2.2.4", "3.0.0".'; $this->expectException(QtiVersionException::class); $this->expectExceptionMessage($msg); QtiVersion::compare('2.1.0', '2.1.4', '<'); } /** * @dataProvider versionsToCreate * @param string $version * @param string $expectedVersion * @param string $expectedClass */ public function testCreateWithSupportedVersion(string $version, string $expectedVersion, string $expectedClass) { $versionObject = QtiVersion::create($version); $this::assertInstanceOf($expectedClass, $versionObject); $this::assertEquals($expectedVersion, (string)$versionObject); } /** * @return array */ public function versionsToCreate(): array { return [ ['2', '2.0.0', QtiVersion200::class], ['2.1', '2.1.0', QtiVersion210::class], ['2.1.1', '2.1.1', QtiVersion211::class], ['2.2', '2.2.0', QtiVersion220::class], ['2.2.1', '2.2.1', QtiVersion221::class], ['2.2.2', '2.2.2', QtiVersion222::class], ['2.2.3', '2.2.3', QtiVersion223::class], ['2.2.4', '2.2.4', QtiVersion224::class], ['3', '3.0.0', QtiVersion300::class], ]; } public function testCreateWithUnsupportedVersionThrowsException() { $wrongVersion = '36.15'; $this->expectException(QtiVersionException::class); QtiVersion::create($wrongVersion); } }
gpl-2.0
yakuzmenko/bereg
components/com_youtubegallery/includes/flv4php/Util/BitStreamReader.php
3044
<?php /* Copyright 2006 Iván Montes, Morten Hundevad This file is part of FLV tools for PHP (FLV4PHP from now on). FLV4PHP is free software; you can redistribute it and/or modify it under the terms of the GNU General var License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. FLV4PHP 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 var License for more details. You should have received a copy of the GNU General var License along with FLV4PHP; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ /** * A simple streamer class to work with bit sequences and extract integers * */ class FLV_Util_BitStreamReader { var $data; var $bits; var $pos; var $ofs; /** * Class constructor which can initilaze the stream * * @param string $data An optional binary string */ function FLV_Util_BitStreamReader( $data = '' ) { $this->__construct( $data ); } function __construct( $data = '' ) { $this->setPayload( $data ); } /** * Sets the binary stream to use * * @param string $data The binary string */ function setPayload( $data ) { $this->data = $data; $this->pos = 0; $this->bits = ''; $this->ofs = 0; } /** * Makes sure we have the requested number of bits in the working buffer * * @access private * @param int $cnt The number of bits needed */ function fetch( $cnt ) { if ($this->pos < $this->ofs*8 || $this->pos + $cnt > $this->ofs*8 + strlen($this->bits) ) { $this->bits = ''; $this->ofs = FLOOR($this->pos/8); for ($i = $this->ofs; $i <= $this->ofs + CEIL($cnt/8); $i++ ) { $this->bits .= str_pad( decbin(ord($this->data[$i])), 8, '0', STR_PAD_LEFT ); } } } /** * Consume an integer from an arbitrary number of bits in the stream * * @param int $cnt Length in bits of the integer */ function getInt( $cnt ) { $this->fetch( $cnt ); $ret = bindec( substr($this->bits, $this->pos-($this->ofs << 3), $cnt) ); $this->pos += $cnt; return $ret; } /** * Seeks into the bit stream in a similar way to fseek() * * @param int $cnt Number of bits to seek * @param int $whence Either SEEK_SET (default), SEEK_CUR or SEEK_END */ function seek( $ofs, $whence = SEEK_SET ) { switch ($whence) { case SEEK_SET: $this->pos = $ofs; break; case SEEK_CUR: $this->pos += $ofs; break; case SEEK_END: $this->pos -= strlen($this->data)*8 - $ofs; break; } if ($this->pos < 0) $this->pos; elseif ($this->pos > strlen($this->data)*8) $this->pos = $this->data*8; } } ?>
gpl-2.0
Ikon-Srl/IkonAuthor
Librerie/IKGD_ResourceType_Standard/ResourceTypes/Intranet/IKGD_StandardWidgetsSingleton.cs
18705
/* * * Intranet Ikon * * Copyright (C) 2008 Ikon Srl * Tutti i Diritti Riservati. All Rights Reserved * */ using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Data; using System.Configuration; using System.Web; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Security; using System.Security.Principal; using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; using System.Xml; using System.Xml.Linq; using System.ComponentModel; using System.Runtime.Serialization; using System.Runtime.Serialization.Json; // assembly System.ServiceModel.Web using Ikon; using Ikon.Log; using Ikon.Support; using Ikon.GD; namespace Ikon.IKGD.Library.Resources { // // WidgetSettings XYZ (da usare come dummy) // [DataContract] public class IKGD_WidgetData_XYZ : IKGD_WidgetDataBase { public new ClassConfig_XYZ Config { get { return (this as IKGD_WidgetData_Interface).Config as ClassConfig_XYZ; } set { (this as IKGD_WidgetData_Interface).Config = value; } } public new ClassSettings_XYZ Settings { get { return (this as IKGD_WidgetData_Interface).Settings as ClassSettings_XYZ; } set { (this as IKGD_WidgetData_Interface).Settings = value; } } // public override Type[] knownTypes { get { return new Type[] { typeof(ClassWindow), typeof(ClassConfig_XYZ), typeof(ClassSettings_XYZ), typeof(ClassData) }; } } public static IKGD_WidgetData_XYZ DefaultValue { get { return new IKGD_WidgetData_XYZ { Window = ClassWindow.DefaultValue, Config = ClassConfig_XYZ.DefaultValue, Settings = ClassSettings_XYZ.DefaultValue, Data = ClassData.DefaultValue }; } } // // classi inline per la definizione dei parametri del widget // [DataContract] public class ClassConfig_XYZ { [DataMember] public string XYZ { get; set; } // public static ClassConfig_XYZ DefaultValue { get { return new ClassConfig_XYZ { XYZ = string.Empty }; } } } // [DataContract] public class ClassSettings_XYZ { [DataMember] public string XYZ { get; set; } // public static ClassSettings_XYZ DefaultValue { get { return new ClassSettings_XYZ { XYZ = string.Empty }; } } } } // // Widget Menù // public class IKGD_Widget_Menu : IKGD_WidgetBaseSingleton { public new IKGD_WidgetData_Menu WidgetSettings { get { return (this as IKGD_Widget_Interface).WidgetSettings as IKGD_WidgetData_Menu; } set { (this as IKGD_Widget_Interface).WidgetSettings = value; } } public override Type WidgetSettingsType { get { return typeof(IKGD_WidgetData_Menu); } } public override string IconEditor { get { return "ResourceType.Menu.gif"; } } // // WidgetSettings // [DataContract] public class IKGD_WidgetData_Menu : IKGD_WidgetDataBase { public new ClassConfig_Menu Config { get { return (this as IKGD_WidgetData_Interface).Config as ClassConfig_Menu; } set { (this as IKGD_WidgetData_Interface).Config = value; } } // public override Type[] knownTypes { get { return new Type[] { typeof(ClassWindow), typeof(ClassConfig_Menu), typeof(ClassSettings), typeof(ClassData) }; } } public static IKGD_WidgetData_Menu DefaultValue { get { return new IKGD_WidgetData_Menu { Window = ClassWindow.DefaultValue, Config = ClassConfig_Menu.DefaultValue, Settings = ClassSettings.DefaultValue, Data = ClassData.DefaultValue }; } } // // classi inline per la definizione dei parametri del widget (per ora non c'e' necessita' di customizzazioni) // [DataContract] public class ClassConfig_Menu { //[DataMember] //public string Text { get; set; } // public static ClassConfig_Menu DefaultValue { get { return new ClassConfig_Menu { }; } } } } // } // // Widget Search // public class IKGD_Widget_Search : IKGD_WidgetBaseSingleton { public new IKGD_WidgetData_Search WidgetSettings { get { return (this as IKGD_Widget_Interface).WidgetSettings as IKGD_WidgetData_Search; } set { (this as IKGD_Widget_Interface).WidgetSettings = value; } } public override Type WidgetSettingsType { get { return typeof(IKGD_WidgetData_Search); } } public override string IconEditor { get { return "ResourceType.Search.gif"; } } // // WidgetSettings // [DataContract] public class IKGD_WidgetData_Search : IKGD_WidgetDataBase { public new ClassConfig_Search Config { get { return (this as IKGD_WidgetData_Interface).Config as ClassConfig_Search; } set { (this as IKGD_WidgetData_Interface).Config = value; } } // public override Type[] knownTypes { get { return new Type[] { typeof(ClassWindow), typeof(ClassConfig_Search), typeof(ClassSettings), typeof(ClassData) }; } } public static IKGD_WidgetData_Search DefaultValue { get { return new IKGD_WidgetData_Search { Window = ClassWindow.DefaultValue, Config = ClassConfig_Search.DefaultValue, Settings = ClassSettings.DefaultValue, Data = ClassData.DefaultValue }; } } // // classi inline per la definizione dei parametri del widget (per ora non c'e' necessita' di customizzazioni) // [DataContract] public class ClassConfig_Search { //[DataMember] //public string Text { get; set; } // public static ClassConfig_Search DefaultValue { get { return new ClassConfig_Search { }; } } } } // } // // Widget HTML // public class IKGD_Widget_HTML : IKGD_WidgetBaseSingleton, IKCMS_Widget_Interface, IKCMS_HasResourceData_Interface, IKCMS_IsIndexable_Interface { public override bool HasInode { get { return true; } } // questo widget ha un INODE // public new IKGD_WidgetData_HTML WidgetSettings { get { return (this as IKGD_Widget_Interface).WidgetSettings as IKGD_WidgetData_HTML; } set { (this as IKGD_Widget_Interface).WidgetSettings = value; } } public override Type WidgetSettingsType { get { return typeof(IKGD_WidgetData_HTML); } } public override string IconEditor { get { return "ResourceType.Html.gif"; } } // // WidgetSettings // [DataContract] public class IKGD_WidgetData_HTML : IKGD_WidgetDataBase { public new ClassConfig_HTML Config { get { return (this as IKGD_WidgetData_Interface).Config as ClassConfig_HTML; } set { (this as IKGD_WidgetData_Interface).Config = value; } } // public override Type[] knownTypes { get { return new Type[] { typeof(ClassWindow), typeof(ClassConfig_HTML), typeof(ClassSettings), typeof(ClassData) }; } } public static IKGD_WidgetData_HTML DefaultValue { get { return new IKGD_WidgetData_HTML { Window = ClassWindow.DefaultValue, Config = ClassConfig_HTML.DefaultValue, Settings = ClassSettings.DefaultValue, Data = ClassData.DefaultValue }; } } // // classi inline per la definizione dei parametri del widget // [DataContract] public class ClassConfig_HTML { [DataMember] public string Text { get; set; } // public static ClassConfig_HTML DefaultValue { get { return new ClassConfig_HTML { Text = string.Empty }; } } } } // } // // Widget Web Site // public class IKGD_Widget_WebSite : IKGD_WidgetBaseSingleton, IKCMS_IsIndexable_Interface { public new IKGD_WidgetData_WebSite WidgetSettings { get { return (this as IKGD_Widget_Interface).WidgetSettings as IKGD_WidgetData_WebSite; } set { (this as IKGD_Widget_Interface).WidgetSettings = value; } } public override Type WidgetSettingsType { get { return typeof(IKGD_WidgetData_WebSite); } } public override string IconEditor { get { return "ResourceType.App.gif"; } } public override string SearchTitleMember { get { return "UrlSite"; } } // // WidgetSettings // [DataContract] public class IKGD_WidgetData_WebSite : IKGD_WidgetDataBase { public new ClassConfig_WebSite Config { get { return (this as IKGD_WidgetData_Interface).Config as ClassConfig_WebSite; } set { (this as IKGD_WidgetData_Interface).Config = value; } } // public override Type[] knownTypes { get { return new Type[] { typeof(ClassWindow), typeof(ClassConfig_WebSite), typeof(ClassSettings), typeof(ClassData) }; } } public static IKGD_WidgetData_WebSite DefaultValue { get { return new IKGD_WidgetData_WebSite { Window = ClassWindow.DefaultValue, Config = ClassConfig_WebSite.DefaultValue, Settings = ClassSettings.DefaultValue, Data = ClassData.DefaultValue }; } } // // classi inline per la definizione dei parametri del widget // [DataContract] public class ClassConfig_WebSite { [DataMember] public string UrlSite { get; set; } [DataMember] public string Text { get; set; } [DataMember] public bool TargetBlank { get; set; } [DataMember] public bool IntranetOnly { get; set; } [DataMember] public string UrlSiteExternal { get; set; } // public static ClassConfig_WebSite DefaultValue { get { return new ClassConfig_WebSite { UrlSite = "http://", Text = string.Empty, TargetBlank = false, IntranetOnly = false, UrlSiteExternal = string.Empty }; } } } } // } // // Widget Contenuto Multimediale // public class IKGD_Widget_Multimedia : IKGD_WidgetBaseSingleton, IKCMS_Widget_Interface, IKCMS_HasResourceData_Interface, IKCMS_IsIndexable_Interface { public new IKGD_WidgetData_Multimedia WidgetSettings { get { return (this as IKGD_Widget_Interface).WidgetSettings as IKGD_WidgetData_Multimedia; } set { (this as IKGD_Widget_Interface).WidgetSettings = value; } } public override Type WidgetSettingsType { get { return typeof(IKGD_WidgetData_Multimedia); } } public override string IconEditor { get { return "ResourceType.Multimediale.gif"; } } public override string SearchTitleMember { get { return "UrlSite"; } } // // WidgetSettings // [DataContract] public class IKGD_WidgetData_Multimedia : IKGD_WidgetDataBase { public new ClassConfig_Multimedia Config { get { return (this as IKGD_WidgetData_Interface).Config as ClassConfig_Multimedia; } set { (this as IKGD_WidgetData_Interface).Config = value; } } // public override Type[] knownTypes { get { return new Type[] { typeof(ClassWindow), typeof(ClassConfig_Multimedia), typeof(ClassSettings), typeof(ClassData) }; } } public static IKGD_WidgetData_Multimedia DefaultValue { get { return new IKGD_WidgetData_Multimedia { Window = ClassWindow.DefaultValue, Config = ClassConfig_Multimedia.DefaultValue, Settings = ClassSettings.DefaultValue, Data = ClassData.DefaultValue }; } } // // classi inline per la definizione dei parametri del widget // [DataContract] public class ClassConfig_Multimedia { [DataMember] public string UrlSite { get; set; } [DataMember] public string Text { get; set; } [DataMember] public string WidgetQS { get; set; } [DataMember] public int Width { get; set; } [DataMember] public int Height { get; set; } [DataMember] public bool Loop { get; set; } // public static ClassConfig_Multimedia DefaultValue { get { return new ClassConfig_Multimedia { UrlSite = string.Empty, Text = "VAI", WidgetQS = string.Empty, Width = 300, Height = 200, Loop = true }; } } } } // } // // Widget Feed RSS // public class IKGD_Widget_RSS : IKGD_WidgetBaseSingleton, IKCMS_Widget_Interface, IKCMS_HasResourceData_Interface { public new IKGD_WidgetData_RSS WidgetSettings { get { return (this as IKGD_Widget_Interface).WidgetSettings as IKGD_WidgetData_RSS; } set { (this as IKGD_Widget_Interface).WidgetSettings = value; } } public override Type WidgetSettingsType { get { return typeof(IKGD_WidgetData_RSS); } } public override string IconEditor { get { return "ResourceType.FeedRSS.gif"; } } // // WidgetSettings // [DataContract] public class IKGD_WidgetData_RSS : IKGD_WidgetDataBase { public new ClassConfig_RSS Config { get { return (this as IKGD_WidgetData_Interface).Config as ClassConfig_RSS; } set { (this as IKGD_WidgetData_Interface).Config = value; } } public new ClassSettings_RSS Settings { get { return (this as IKGD_WidgetData_Interface).Settings as ClassSettings_RSS; } set { (this as IKGD_WidgetData_Interface).Settings = value; } } // public override Type[] knownTypes { get { return new Type[] { typeof(ClassWindow), typeof(ClassConfig_RSS), typeof(ClassSettings_RSS), typeof(ClassData) }; } } public static IKGD_WidgetData_RSS DefaultValue { get { return new IKGD_WidgetData_RSS { Window = ClassWindow.DefaultValue, Config = ClassConfig_RSS.DefaultValue, Settings = ClassSettings_RSS.DefaultValue, Data = ClassData.DefaultValue }; } } // // classi inline per la definizione dei parametri del widget // [DataContract] public class ClassConfig_RSS { [DataMember] public string UrlRSS { get; set; } [DataMember] public string UrlHome { get; set; } // public static ClassConfig_RSS DefaultValue { get { return new ClassConfig_RSS { UrlRSS = "http://", UrlHome = "http://" }; } } } // [DataContract] public class ClassSettings_RSS { [DataMember] public int ItemsCount { get; set; } // public static ClassSettings_RSS DefaultValue { get { return new ClassSettings_RSS { ItemsCount = 5 }; } } } } // } // // Widget Google gadget // public class IKGD_Widget_iGoogle : IKGD_WidgetBaseSingleton { public new IKGD_WidgetData_iGoogle WidgetSettings { get { return (this as IKGD_Widget_Interface).WidgetSettings as IKGD_WidgetData_iGoogle; } set { (this as IKGD_Widget_Interface).WidgetSettings = value; } } public override Type WidgetSettingsType { get { return typeof(IKGD_WidgetData_iGoogle); } } public override string IconEditor { get { return "ResourceType.iGoogle.gif"; } } // // WidgetSettings // [DataContract] public class IKGD_WidgetData_iGoogle : IKGD_WidgetDataBase { public new ClassConfig_iGoogle Config { get { return (this as IKGD_WidgetData_Interface).Config as ClassConfig_iGoogle; } set { (this as IKGD_WidgetData_Interface).Config = value; } } // public override Type[] knownTypes { get { return new Type[] { typeof(ClassWindow), typeof(ClassConfig_iGoogle), typeof(ClassSettings), typeof(ClassData) }; } } public static IKGD_WidgetData_iGoogle DefaultValue { get { return new IKGD_WidgetData_iGoogle { Window = ClassWindow.DefaultValue, Config = ClassConfig_iGoogle.DefaultValue, Settings = ClassSettings.DefaultValue, Data = ClassData.DefaultValue }; } } // // classi inline per la definizione dei parametri del widget // [DataContract] public class ClassConfig_iGoogle { [DataMember] public string UrlGadget { get; set; } // [DataMember] public string XmlGadget { get; set; } // public static ClassConfig_iGoogle DefaultValue { get { return new ClassConfig_iGoogle { UrlGadget = "http://www.google.com/ig", XmlGadget = null }; } } } } // } // // Widget IkonHelpDeskTicket // public class IKGD_Widget_IkonHelpDeskTicket : IKGD_WidgetBaseSingleton { public new IKGD_WidgetData_IkonHelpDeskTicket WidgetSettings { get { return (this as IKGD_Widget_Interface).WidgetSettings as IKGD_WidgetData_IkonHelpDeskTicket; } set { (this as IKGD_Widget_Interface).WidgetSettings = value; } } public override Type WidgetSettingsType { get { return typeof(IKGD_WidgetData_IkonHelpDeskTicket); } } public override string IconEditor { get { return "ResourceType.Organigramma.gif"; } } // // WidgetSettings // [DataContract] public class IKGD_WidgetData_IkonHelpDeskTicket : IKGD_WidgetDataBase { public new ClassConfig Config { get { return (this as IKGD_WidgetData_Interface).Config as ClassConfig; } set { (this as IKGD_WidgetData_Interface).Config = value; } } public new ClassSettings Settings { get { return (this as IKGD_WidgetData_Interface).Settings as ClassSettings; } set { (this as IKGD_WidgetData_Interface).Settings = value; } } // public override Type[] knownTypes { get { return new Type[] { typeof(ClassWindow), typeof(ClassConfig), typeof(ClassSettings), typeof(ClassData) }; } } public static IKGD_WidgetData_IkonHelpDeskTicket DefaultValue { get { return new IKGD_WidgetData_IkonHelpDeskTicket { Window = ClassWindow.DefaultValue, Config = ClassConfig.DefaultValue, Settings = ClassSettings.DefaultValue, Data = ClassData.DefaultValue }; } } // // classi inline per la definizione dei parametri del widget (che non ci sono...) // } // } // // Widget IkonAnagrafica // public class IKGD_Widget_IkonAnagrafica : IKGD_WidgetBaseSingleton { public new IKGD_WidgetData_IkonAnagrafica WidgetSettings { get { return (this as IKGD_Widget_Interface).WidgetSettings as IKGD_WidgetData_IkonAnagrafica; } set { (this as IKGD_Widget_Interface).WidgetSettings = value; } } public override Type WidgetSettingsType { get { return typeof(IKGD_WidgetData_IkonAnagrafica); } } public override string IconEditor { get { return "ResourceType.Organigramma.gif"; } } // // WidgetSettings // [DataContract] public class IKGD_WidgetData_IkonAnagrafica : IKGD_WidgetDataBase { public new ClassConfig Config { get { return (this as IKGD_WidgetData_Interface).Config as ClassConfig; } set { (this as IKGD_WidgetData_Interface).Config = value; } } public new ClassSettings Settings { get { return (this as IKGD_WidgetData_Interface).Settings as ClassSettings; } set { (this as IKGD_WidgetData_Interface).Settings = value; } } // public override Type[] knownTypes { get { return new Type[] { typeof(ClassWindow), typeof(ClassConfig), typeof(ClassSettings), typeof(ClassData) }; } } public static IKGD_WidgetData_IkonAnagrafica DefaultValue { get { return new IKGD_WidgetData_IkonAnagrafica { Window = ClassWindow.DefaultValue, Config = ClassConfig.DefaultValue, Settings = ClassSettings.DefaultValue, Data = ClassData.DefaultValue }; } } // // classi inline per la definizione dei parametri del widget (che non ci sono...) // } // } }
gpl-2.0
firetw/Ripper
Ripper/QqPiao/Utils/Utils.cs
1611
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; using WebLoginer.Core; namespace QqPiao { public class Utils { static Encoding encoding = Encoding.UTF8; public static WebOperResult Get(string url, CookieContainer container, CookieCollection cookies) { RequestContext reContext = RequestContext.DefaultContext(); reContext.Encoding = encoding; reContext.ContentType = "text/html"; reContext.URL = url; reContext.CookieContainer = container; reContext.CookieContainer.Add(cookies); WebOperResult reResult = HttpWebHelper.Get(reContext); return reResult; } public static WebOperResult Post(string url, CookieContainer container, CookieCollection cookies, string postData, bool autoRedirect = true) { RequestContext postContext = RequestContext.DefaultContext(); postContext.Encoding = encoding; postContext.URL = url; postContext.Allowautoredirect = autoRedirect; postContext.Method = "POST"; postContext.Accept = "application/xhtml+xml, */*"; postContext.ContentType = "application/x-www-form-urlencoded"; postContext.Postdata = postData; postContext.CookieContainer = container; postContext.CookieContainer.Add(cookies); WebOperResult postResult = HttpWebHelper.Post(postContext); return postResult; } } }
gpl-2.0
DotNetAge/dotnetage
src/DNA.Mvc.Web/Scripts/doctor.js
2885
/* ** Project : TaoUI ** Copyright (c) 2009-2013 DotNetAge (http://www.dotnetage.com) ** Licensed under the GPLv2: http://dotnetage.codeplex.com/license ** Project owner : Ray Liang (csharp2002@hotmail.com) */ $.seo = new function () { this.analyse = function (url) { var dfd = new $.Deferred(), _start = new Date(); $.ajax(url) .done(function (data) { var report = { has_title: false, has_keywords: false, has_desc: false, title_len: 0, desc_len: 0, keywords_len: 0, links: 0, no_alt_imgs: 0, h1_count: 0, h2_count: 0, loading_time: (new Date().getTime()) - _start.getTime() }, _helper = $("<div/>").appendTo("body"), _frameHtml = "<iframe src='javascript:void(0);' style='display:none;'></iframe>"; _helper.append(_frameHtml); var _frame = $("iframe", _helper)[0]; var _contentWin = _frame.contentWindow; _contentWin.document.designMode = 'on'; _contentWin.document.open(); _contentWin.document.write(data); _contentWin.document.close(); var _head = $("head", _contentWin.document); //title var _title = _head.children("title"); report.has_title = _title.length > 0; if (_title.length) report.title_len = _title.text().length; //desc var _desc = $("meta[name='description']", _head); report.has_desc = _desc.length > 0; if (_desc.length) report.desc_len = _desc.text().length; //keywords var _keys = $("meta[name='keywords']", _head); report.has_keywords = _keys.length > 0; if (_keys.length) report.keywords_len = _keys.text().length; //number of links report.links = $("body a[rel!='nofollow']", _contentWin.document).length; //page rank flow //page indexable //alt image tag var _imgs = $("body img", _contentWin.document); report.no_alt_imgs = _imgs.length - $("[alt]", _imgs).length; //h1 report.h1_count = $("body h1", _contentWin.document).length; //h2 report.h2_count = $("body h2", _contentWin.document).length; _helper.remove(); //console.log(report); dfd.resolve(report); }) .fail(function () { dfd.reject(); }); return dfd; } }
gpl-2.0
pkaranja/zuku
components/com_channels/controllers/channels.php
697
<?php /** * @version 1.0.0 * @package com_channels * @copyright Copyright (C) 2014. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * @author Peter <pittskay@gmail.com> - http://aimgroup.co.tz/ */ // No direct access. defined('_JEXEC') or die; require_once JPATH_COMPONENT.'/controller.php'; /** * Channels list controller class. */ class ChannelsControllerChannels extends ChannelsController { /** * Proxy for getModel. * @since 1.6 */ public function &getModel($name = 'Channels', $prefix = 'ChannelsModel') { $model = parent::getModel($name, $prefix, array('ignore_request' => true)); return $model; } }
gpl-2.0
belgianpolice/intranet-platform
libraries/koowa/loader/adapter/exception.php
572
<?php /** * @version $Id: exception.php 2876 2011-03-07 22:19:20Z johanjanssens $ * @category Koowa * @package Koowa_Loader * @subpackage Adapter * @copyright Copyright (C) 2007 - 2012 Johan Janssens. All rights reserved. * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> * @link http://www.nooku.org */ /** * Koowa Factory Adapter Exception class * * @author Johan Janssens <johan@nooku.org> * @category Koowa * @package Koowa_Loader * @subpackage Adapter */ class KLoaderAdapterException extends KException {}
gpl-2.0
mentaman/visualmutator
Backup1/Infra/InApplicationSettingsManager.cs
854
namespace CommonUtilityInfrastructure { #region using System; using PiotrTrzpil.VisualMutator_VSPackage.Properties; using UsefulTools.Core; #endregion public class InApplicationSettingsManager : ISettingsManager { private readonly Settings _settings; public InApplicationSettingsManager(Settings settings) { _settings = settings; } public string this[string key] { get { return (string)_settings[key]; } set { _settings[key] = value; } } public void Initialize() { } public bool ContainsKey(string mutationresultsfilepath) { throw new NotImplementedException(); } } }
gpl-2.0
edineicolli/daruma-exemplo-python
scripts/generico/ui_generico_rreceberdados.py
2793
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'ui_generico_rreceberdados.ui' # # Created: Mon Nov 24 22:26:38 2014 # by: pyside-uic 0.2.15 running on PySide 1.2.2 # # WARNING! All changes made in this file will be lost! from ctypes import create_string_buffer from PySide import QtCore, QtGui from pydaruma.pydaruma import rReceberDados_Daruma from scripts.generico.retornogenerico import tratarRetornoGenerico class Ui_ui_GENERICO_rReceberDados(QtGui.QWidget): def __init__(self): super(Ui_ui_GENERICO_rReceberDados, self).__init__() self.setupUi(self) self.pushButtonReceber.clicked.connect(self.on_pushButtonReceber_clicked) self.pushButtonCancelar.clicked.connect(self.on_pushButtonCancelar_clicked) def on_pushButtonReceber_clicked(self): StrRecebe = create_string_buffer(100) iRetorno = rReceberDados_Daruma(bytes(StrRecebe)) tratarRetornoGenerico(iRetorno, self) self.textEditRecebeDados.setText(StrRecebe.value.decode('utf-8')) def on_pushButtonCancelar_clicked(self): self.close() def setupUi(self, ui_GENERICO_rReceberDados): ui_GENERICO_rReceberDados.setObjectName("ui_GENERICO_rReceberDados") ui_GENERICO_rReceberDados.resize(370, 181) ui_GENERICO_rReceberDados.setMaximumSize(QtCore.QSize(370, 181)) self.verticalLayout = QtGui.QVBoxLayout(ui_GENERICO_rReceberDados) self.verticalLayout.setObjectName("verticalLayout") self.textEditRecebeDados = QtGui.QTextEdit(ui_GENERICO_rReceberDados) self.textEditRecebeDados.setObjectName("textEditRecebeDados") self.verticalLayout.addWidget(self.textEditRecebeDados) self.pushButtonReceber = QtGui.QPushButton(ui_GENERICO_rReceberDados) self.pushButtonReceber.setObjectName("pushButtonReceber") self.verticalLayout.addWidget(self.pushButtonReceber) self.pushButtonCancelar = QtGui.QPushButton(ui_GENERICO_rReceberDados) self.pushButtonCancelar.setObjectName("pushButtonCancelar") self.verticalLayout.addWidget(self.pushButtonCancelar) self.retranslateUi(ui_GENERICO_rReceberDados) QtCore.QMetaObject.connectSlotsByName(ui_GENERICO_rReceberDados) def retranslateUi(self, ui_GENERICO_rReceberDados): ui_GENERICO_rReceberDados.setWindowTitle(QtGui.QApplication.translate("ui_GENERICO_rReceberDados", "Método rReceberDados_Daruma", None, QtGui.QApplication.UnicodeUTF8)) self.pushButtonReceber.setText(QtGui.QApplication.translate("ui_GENERICO_rReceberDados", "Receber", None, QtGui.QApplication.UnicodeUTF8)) self.pushButtonCancelar.setText(QtGui.QApplication.translate("ui_GENERICO_rReceberDados", "Cancelar", None, QtGui.QApplication.UnicodeUTF8))
gpl-2.0
baiwei0427/PIAS
backup/pias/dynamic workload/trace.py
888
import os import sys import string #This function is to print usage of this script def usage(): sys.stderr.write('This script is used to analyze dynamic flow trace:\n') sys.stderr.write('dynamic_flow.py [trace file] [percentage] \n') #main function if len(sys.argv)!=3: usage() else: trace_filename=sys.argv[1] percentage=float(sys.argv[2]) #Open trace file trace_file=open(trace_filename,'r') lines=trace_file.readlines() flows=[] for line in lines: tmp=line.split() if len(tmp)>=3: flows.append(int(tmp[1])) trace_file.close() flows.sort() sum=sum(flows) size=0 for i in range(int(len(flows)*percentage)): size=size+flows[i] print 'The '+str(int(percentage*100))+'th flow in our trace is '+str(flows[int(len(flows)*percentage)-1])+'KB' print float(size)/sum print (float(size)+flows[int(len(flows)*percentage)-1]*(len(flows)-int(len(flows)*percentage)))/sum
gpl-2.0
BerserkerDotNet/UniversalWorldClock
UniversalWorldClock.Shared/Common/TimeShiftStateChangedArgs.cs
287
using System; namespace UniversalWorldClock.Common { public class TimeShiftStateChangedArgs : EventArgs { public TimeShiftStateChangedArgs(bool isStarted) { IsStarted = isStarted; } public bool IsStarted { get; private set; } } }
gpl-2.0
shyaken/cp.eaemcb
controllers/pgsql/basic.py
4601
# Author: Zhang Huangbin <zhb@iredmail.org> import os import time from socket import getfqdn from urllib import urlencode import web import settings from libs import __url_latest_ose__, __version_ose__ from libs import iredutils, languages from libs.pgsql import core, decorators session = web.config.get('_session') class Login: def GET(self): if session.get('logged') is False: i = web.input(_unicode=False) # Show login page. return web.render( 'login.html', languagemaps=languages.get_language_maps(), msg=i.get('msg'), ) else: raise web.seeother('/dashboard') def POST(self): # Get username, password. i = web.input(_unicode=False) username = web.safestr(i.get('username').strip()) password = str(i.get('password').strip()) save_pass = web.safestr(i.get('save_pass', 'no').strip()) auth = core.Auth() auth_result = auth.auth(username=username, password=password) if auth_result[0] is True: # Config session data. web.config.session_parameters['cookie_name'] = 'iRedAdmin-Pro' # Session expire when client ip was changed. web.config.session_parameters['ignore_change_ip'] = False # Don't ignore session expiration. web.config.session_parameters['ignore_expiry'] = False if save_pass == 'yes': # Session timeout (in seconds). web.config.session_parameters['timeout'] = 86400 # 24 hours else: # Expire session when browser closed. web.config.session_parameters['timeout'] = 600 # 10 minutes web.logger(msg="Login success", event='login',) # Save selected language selected_language = str(i.get('lang').strip()) if selected_language != web.ctx.lang and \ selected_language in languages.get_language_maps(): session['lang'] = selected_language raise web.seeother('/dashboard/checknew') else: session['failed_times'] += 1 web.logger(msg="Login failed.", admin=username, event='login', loglevel='error',) raise web.seeother('/login?msg=%s' % web.urlquote(auth_result[1])) class Logout: def GET(self): session.kill() raise web.seeother('/login') class Dashboard: @decorators.require_login def GET(self, checknew=False): if checknew: checknew = True # Get network interface related infomation. netif_data = {} try: import netifaces ifaces = netifaces.interfaces() for iface in ifaces: addr = netifaces.ifaddresses(iface) if netifaces.AF_INET in addr.keys(): data = addr[netifaces.AF_INET][0] try: netif_data[iface] = {'addr': data['addr'], 'netmask': data['netmask'], } except: pass except: pass # Check new version. newVersionInfo = (None, ) if session.get('domainGlobalAdmin') is True and checknew is True: try: curdate = time.strftime('%Y-%m-%d') vars = dict(date=curdate) r = web.admindb.select('updatelog', vars=vars, where='date >= $date',) if len(r) == 0: urlInfo = { 'v': __version_ose__, 'lang': settings.default_language, 'host': getfqdn(), 'backend': settings.backend, } url = __url_latest_ose__ + '?' + urlencode(urlInfo) newVersionInfo = iredutils.getNewVersion(url) # Always remove all old records, just keep the last one. web.admindb.delete('updatelog', vars=vars, where='date < $date',) # Insert updating date. web.admindb.insert('updatelog', date=curdate,) except Exception, e: newVersionInfo = (False, str(e)) return web.render( 'dashboard.html', version=__version_ose__, hostname=getfqdn(), uptime=iredutils.get_server_uptime(), loadavg=os.getloadavg(), netif_data=netif_data, newVersionInfo=newVersionInfo, )
gpl-2.0
jakowisp/FirmwareEssentials_e4357
hw3/main.cpp
480
#include "mbed.h" BusOut leds(LED1,LED2); DigitalIn sw1(p20); DigitalIn sw2(p19); Serial async_port(p9,p10); unsigned char outByte; unsigned char inByte; int main(){ async_port.baud(9600); while(true){ outByte =0xa0; outByte |= sw1; outByte |= sw2<<1; if(async_port.readable()==1) { inByte = async_port.getc(); leds = inByte & 0x03; } async_port.putc(outByte); } }
gpl-2.0
Hshore/TrinityCore
src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp
75657
/* * Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "ScriptMgr.h" #include "DBCStores.h" #include "GameObject.h" #include "GameObjectAI.h" #include "InstanceScript.h" #include "Map.h" #include "ObjectAccessor.h" #include "Player.h" #include "ruby_sanctum.h" #include "ScriptedCreature.h" #include "Spell.h" #include "SpellAuraEffects.h" #include "SpellScript.h" #include "TemporarySummon.h" #include "Vehicle.h" enum Texts { // Shared SAY_REGENERATE = 0, // Without pressure in both realms, %s begins to regenerate. // Halion SAY_INTRO = 1, // Meddlesome insects! You are too late. The Ruby Sanctum is lost! SAY_AGGRO = 2, // Your world teeters on the brink of annihilation. You will ALL bear witness to the coming of a new age of DESTRUCTION! SAY_METEOR_STRIKE = 3, // The heavens burn! SAY_PHASE_TWO = 4, // You will find only suffering within the realm of twilight! Enter if you dare! SAY_DEATH = 5, // Relish this victory, mortals, for it will be your last! This world will burn with the master's return! SAY_KILL = 6, // Another "hero" falls. SAY_BERSERK = 7, // Not good enough. EMOTE_CORPOREALITY_POT = 8, // Your efforts force %s further out of the physical realm! EMOTE_CORPOREALITY_PIP = 9, // Your companions' efforts force %s further into the physical realm! // Twilight Halion SAY_SPHERE_PULSE = 1, // Beware the shadow! SAY_PHASE_THREE = 2, // I am the light and the darkness! Cower, mortals, before the herald of Deathwing! EMOTE_CORPOREALITY_TIT = 3, // Your companions' efforts force %s further into the twilight realm! EMOTE_CORPOREALITY_TOT = 4, // Your efforts force %s further out of the twilight realm! EMOTE_WARN_LASER = 0 // The orbiting spheres pulse with dark energy! }; enum Spells { // Halion SPELL_FLAME_BREATH = 74525, SPELL_CLEAVE = 74524, SPELL_METEOR_STRIKE = 74637, SPELL_TAIL_LASH = 74531, SPELL_FIERY_COMBUSTION = 74562, SPELL_MARK_OF_COMBUSTION = 74567, SPELL_FIERY_COMBUSTION_EXPLOSION = 74607, SPELL_FIERY_COMBUSTION_SUMMON = 74610, // Combustion & Consumption SPELL_SCALE_AURA = 70507, // Aura created in spell_dbc. SPELL_COMBUSTION_DAMAGE_AURA = 74629, SPELL_CONSUMPTION_DAMAGE_AURA = 74803, // Twilight Halion SPELL_DARK_BREATH = 74806, SPELL_MARK_OF_CONSUMPTION = 74795, SPELL_SOUL_CONSUMPTION = 74792, SPELL_SOUL_CONSUMPTION_EXPLOSION = 74799, SPELL_SOUL_CONSUMPTION_SUMMON = 74800, // Living Inferno SPELL_BLAZING_AURA = 75885, SPELL_SPAWN_LIVING_EMBERS = 75880, SPELL_SUMMON_LIVING_EMBER = 75881, // Halion Controller SPELL_COSMETIC_FIRE_PILLAR = 76006, SPELL_FIERY_EXPLOSION = 76010, SPELL_CLEAR_DEBUFFS = 75396, // Meteor Strike SPELL_METEOR_STRIKE_COUNTDOWN = 74641, SPELL_METEOR_STRIKE_AOE_DAMAGE = 74648, SPELL_METEOR_STRIKE_FIRE_AURA_1 = 74713, SPELL_METEOR_STRIKE_FIRE_AURA_2 = 74718, SPELL_BIRTH_NO_VISUAL = 40031, // Shadow Orb SPELL_TWILIGHT_CUTTER = 74768, // Unknown dummy effect (EFFECT_0) SPELL_TWILIGHT_CUTTER_TRIGGERED = 74769, SPELL_TWILIGHT_PULSE_PERIODIC = 78861, SPELL_TRACK_ROTATION = 74758, // Misc SPELL_TWILIGHT_DIVISION = 75063, // Phase spell from phase 2 to phase 3 SPELL_LEAVE_TWILIGHT_REALM = 74812, SPELL_TWILIGHT_PHASING = 74808, // Phase spell from phase 1 to phase 2 SPELL_SUMMON_TWILIGHT_PORTAL = 74809, // Summons go 202794 SPELL_SUMMON_EXIT_PORTALS = 74805, // Custom spell created in spell_dbc. // Used in Cataclysm, need a sniff of cata and up SPELL_TWILIGHT_MENDING = 75509, SPELL_TWILIGHT_REALM = 74807, SPELL_DUSK_SHROUD = 75476, SPELL_TWILIGHT_PRECISION = 78243, SPELL_COPY_DAMAGE = 74810 // Aura not found in DBCs. }; enum Events { // Halion EVENT_ACTIVATE_FIREWALL = 1, EVENT_CLEAVE = 2, EVENT_BREATH = 3, EVENT_METEOR_STRIKE = 4, EVENT_FIERY_COMBUSTION = 5, EVENT_TAIL_LASH = 6, // Twilight Halion EVENT_SOUL_CONSUMPTION = 7, // Meteor Strike EVENT_SPAWN_METEOR_FLAME = 8, // Halion Controller EVENT_START_INTRO = 9, EVENT_INTRO_PROGRESS_1 = 10, EVENT_INTRO_PROGRESS_2 = 11, EVENT_INTRO_PROGRESS_3 = 12, EVENT_CHECK_CORPOREALITY = 13, EVENT_SHADOW_PULSARS_SHOOT = 14, EVENT_TRIGGER_BERSERK = 15, EVENT_TWILIGHT_MENDING = 16, EVENT_ACTIVATE_EMBERS = 17, EVENT_EVADE_CHECK = 18 }; enum Actions { // Meteor Strike ACTION_METEOR_STRIKE_BURN = 1, ACTION_METEOR_STRIKE_AOE = 2, // Halion Controller ACTION_MONITOR_CORPOREALITY = 3, // Orb Carrier ACTION_WARNING_SHOOT = 4, ACTION_SHOOT = 5, ACTION_ACTIVATE_EMBERS = 6 }; enum Phases { PHASE_ALL = 0, PHASE_INTRO = 1, PHASE_ONE = 2, PHASE_TWO = 3, PHASE_THREE = 4 }; enum Misc { DATA_TWILIGHT_DAMAGE_TAKEN = 1, DATA_MATERIAL_DAMAGE_TAKEN = 2, DATA_STACKS_DISPELLED = 3, DATA_FIGHT_PHASE = 4, DATA_SPAWNED_FLAMES = 5 }; enum OrbCarrierSeats { SEAT_NORTH = 0, SEAT_SOUTH = 1, SEAT_EAST = 2, SEAT_WEST = 3 }; enum CorporealityEvent { CORPOREALITY_NONE = 0, CORPOREALITY_TWILIGHT_MENDING = 1, CORPOREALITY_INCREASE = 2, CORPOREALITY_DECREASE = 3 }; Position const HalionSpawnPos = {3156.67f, 533.8108f, 72.98822f, 3.159046f}; Position const HalionRespawnPos = {3156.625f, 533.2674f, 72.97205f, 0.0f}; uint8 const MAX_CORPOREALITY_STATE = 11; struct CorporealityEntry { uint32 twilightRealmSpell; uint32 materialRealmSpell; }; CorporealityEntry const _corporealityReference[MAX_CORPOREALITY_STATE] = { {74836, 74831}, {74835, 74830}, {74834, 74829}, {74833, 74828}, {74832, 74827}, {74826, 74826}, {74827, 74832}, {74828, 74833}, {74829, 74834}, {74830, 74835}, {74831, 74836} }; class boss_halion : public CreatureScript { public: boss_halion() : CreatureScript("boss_halion") { } struct boss_halionAI : public BossAI { boss_halionAI(Creature* creature) : BossAI(creature, DATA_HALION) { } void EnterEvadeMode(EvadeReason why) override { if (why == EVADE_REASON_BOUNDARY || events.IsInPhase(PHASE_ONE)) if (Creature* controller = instance->GetCreature(DATA_HALION_CONTROLLER)) controller->AI()->EnterEvadeMode(why); } void EnterCombat(Unit* /*who*/) override { Talk(SAY_AGGRO); events.Reset(); events.SetPhase(PHASE_ONE); _EnterCombat(); me->AddAura(SPELL_TWILIGHT_PRECISION, me); events.ScheduleEvent(EVENT_ACTIVATE_FIREWALL, Seconds(5)); events.ScheduleEvent(EVENT_BREATH, randtime(Seconds(5), Seconds(15))); events.ScheduleEvent(EVENT_CLEAVE, randtime(Seconds(6), Seconds(10))); events.ScheduleEvent(EVENT_TAIL_LASH, randtime(Seconds(7), Seconds(12))); events.ScheduleEvent(EVENT_FIERY_COMBUSTION, randtime(Seconds(15), Seconds(18))); events.ScheduleEvent(EVENT_METEOR_STRIKE, Seconds(18)); instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me, 1); if (Creature* controller = instance->GetCreature(DATA_HALION_CONTROLLER)) controller->AI()->SetData(DATA_FIGHT_PHASE, PHASE_ONE); } void JustDied(Unit* /*killer*/) override { _JustDied(); Talk(SAY_DEATH); instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); if (Creature* twilightHalion = instance->GetCreature(DATA_TWILIGHT_HALION)) if (twilightHalion->IsAlive()) twilightHalion->KillSelf(); if (Creature* controller = instance->GetCreature(DATA_HALION_CONTROLLER)) if (controller->IsAlive()) controller->KillSelf(); } Position const* GetMeteorStrikePosition() const { return &_meteorStrikePos; } void DamageTaken(Unit* attacker, uint32& damage) override { if (me->HealthBelowPctDamaged(75, damage) && events.IsInPhase(PHASE_ONE)) { events.SetPhase(PHASE_TWO); Talk(SAY_PHASE_TWO); me->CastStop(); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); DoCastSelf(SPELL_TWILIGHT_PHASING); if (Creature* controller = instance->GetCreature(DATA_HALION_CONTROLLER)) controller->AI()->SetData(DATA_FIGHT_PHASE, PHASE_TWO); return; } if (events.IsInPhase(PHASE_THREE)) { // Don't consider copied damage. if (!me->InSamePhase(attacker)) return; if (Creature* controller = instance->GetCreature(DATA_HALION_CONTROLLER)) controller->AI()->SetData(DATA_MATERIAL_DAMAGE_TAKEN, damage); } } void SpellHit(Unit* /*who*/, SpellInfo const* spellInfo) override { if (spellInfo->Id == SPELL_TWILIGHT_MENDING) Talk(SAY_REGENERATE); } void UpdateAI(uint32 diff) override { if (events.IsInPhase(PHASE_TWO)) return; if (!UpdateVictim() || me->HasUnitState(UNIT_STATE_CASTING)) return; events.Update(diff); while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_CLEAVE: DoCastVictim(SPELL_CLEAVE); events.ScheduleEvent(EVENT_CLEAVE, randtime(Seconds(8), Seconds(10))); break; case EVENT_TAIL_LASH: DoCastAOE(SPELL_TAIL_LASH); events.ScheduleEvent(EVENT_TAIL_LASH, randtime(Seconds(11), Seconds(16))); break; case EVENT_BREATH: DoCastSelf(SPELL_FLAME_BREATH); events.ScheduleEvent(EVENT_BREATH, randtime(Seconds(16), Seconds(25))); break; case EVENT_ACTIVATE_FIREWALL: // Flame ring is activated 5 seconds after starting encounter, DOOR_TYPE_ROOM is only instant. for (uint8 i = DATA_FLAME_RING; i <= DATA_TWILIGHT_FLAME_RING; ++i) if (GameObject* flameRing = instance->GetGameObject(i)) instance->HandleGameObject(ObjectGuid::Empty, false, flameRing); break; case EVENT_METEOR_STRIKE: { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, true, -SPELL_TWILIGHT_REALM)) { _meteorStrikePos = target->GetPosition(); me->CastSpell(_meteorStrikePos.GetPositionX(), _meteorStrikePos.GetPositionY(), _meteorStrikePos.GetPositionZ(), SPELL_METEOR_STRIKE, true, nullptr, nullptr, me->GetGUID()); Talk(SAY_METEOR_STRIKE); } events.ScheduleEvent(EVENT_METEOR_STRIKE, Seconds(38)); break; } case EVENT_FIERY_COMBUSTION: { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true, true, -SPELL_TWILIGHT_REALM)) me->CastSpell(target, SPELL_FIERY_COMBUSTION, TRIGGERED_IGNORE_SET_FACING); events.ScheduleEvent(EVENT_FIERY_COMBUSTION, Seconds(25)); break; } default: break; } } DoMeleeAttackIfReady(); } void SetData(uint32 index, uint32 value) override { if (index != DATA_FIGHT_PHASE) return; events.SetPhase(value); } private: Position _meteorStrikePos; }; CreatureAI* GetAI(Creature* creature) const override { return GetRubySanctumAI<boss_halionAI>(creature); } }; typedef boss_halion::boss_halionAI HalionAI; class boss_twilight_halion : public CreatureScript { public: boss_twilight_halion() : CreatureScript("boss_twilight_halion") { } struct boss_twilight_halionAI : public BossAI { boss_twilight_halionAI(Creature* creature) : BossAI(creature, DATA_TWILIGHT_HALION) { Creature* halion = instance->GetCreature(DATA_HALION); if (!halion) return; // Using AddAura because no spell cast packet in sniffs. halion->AddAura(SPELL_COPY_DAMAGE, me); // We use explicit targeting here to avoid conditions + SPELL_ATTR6_CANT_TARGET_SELF. me->AddAura(SPELL_COPY_DAMAGE, halion); DoCastSelf(SPELL_DUSK_SHROUD, true); me->SetHealth(halion->GetHealth()); me->SetPhaseMask(0x20, true); me->SetReactState(REACT_DEFENSIVE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); events.ScheduleEvent(EVENT_TAIL_LASH, Seconds(12)); events.ScheduleEvent(EVENT_SOUL_CONSUMPTION, Seconds(15)); } void EnterCombat(Unit* /*who*/) override { events.SetPhase(PHASE_TWO); _EnterCombat(); me->AddAura(SPELL_TWILIGHT_PRECISION, me); events.ScheduleEvent(EVENT_CLEAVE, Seconds(3)); events.ScheduleEvent(EVENT_BREATH, Seconds(12)); instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me, 2); } void Reset() override { } void EnterEvadeMode(EvadeReason /*why*/) override { } void KilledUnit(Unit* victim) override { if (victim->GetTypeId() == TYPEID_PLAYER) Talk(SAY_KILL); // Victims should not be in the Twilight Realm me->CastSpell(victim, SPELL_LEAVE_TWILIGHT_REALM, true); } void JustDied(Unit* killer) override { if (Creature* halion = instance->GetCreature(DATA_HALION)) { // Ensure looting if (me->IsDamageEnoughForLootingAndReward()) halion->LowerPlayerDamageReq(halion->GetMaxHealth()); if (halion->IsAlive()) killer->Kill(halion); } if (Creature* controller = instance->GetCreature(DATA_HALION_CONTROLLER)) if (controller->IsAlive()) controller->KillSelf(); instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); } void DamageTaken(Unit* attacker, uint32& damage) override { //Needed because we already have UNIT_FLAG_IN_COMBAT, otherwise EnterCombat won't ever be called if (!events.IsInPhase(PHASE_TWO) && !events.IsInPhase(PHASE_THREE)) EnterCombat(attacker); if (me->HealthBelowPctDamaged(50, damage) && events.IsInPhase(PHASE_TWO)) { events.SetPhase(PHASE_THREE); me->CastStop(); DoCastSelf(SPELL_TWILIGHT_DIVISION); Talk(SAY_PHASE_THREE); return; } if (events.IsInPhase(PHASE_THREE)) { // Don't consider copied damage. if (!me->InSamePhase(attacker)) return; if (Creature* controller = instance->GetCreature(DATA_HALION_CONTROLLER)) controller->AI()->SetData(DATA_TWILIGHT_DAMAGE_TAKEN, damage); } } void SpellHit(Unit* /*who*/, SpellInfo const* spell) override { switch (spell->Id) { case SPELL_TWILIGHT_DIVISION: if (Creature* controller = instance->GetCreature(DATA_HALION_CONTROLLER)) controller->AI()->DoAction(ACTION_MONITOR_CORPOREALITY); break; case SPELL_TWILIGHT_MENDING: Talk(SAY_REGENERATE); break; default: break; } } void UpdateAI(uint32 diff) override { if (me->HasUnitState(UNIT_STATE_CASTING)) return; if (!UpdateVictim()) return; events.Update(diff); while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_CLEAVE: DoCastVictim(SPELL_CLEAVE); events.ScheduleEvent(EVENT_CLEAVE, randtime(Seconds(7), Seconds(10))); break; case EVENT_TAIL_LASH: DoCastAOE(SPELL_TAIL_LASH); events.ScheduleEvent(EVENT_TAIL_LASH, randtime(Seconds(12), Seconds(16))); break; case EVENT_BREATH: DoCastSelf(SPELL_DARK_BREATH); events.ScheduleEvent(EVENT_BREATH, randtime(Seconds(10), Seconds(14))); break; case EVENT_SOUL_CONSUMPTION: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true, true, SPELL_TWILIGHT_REALM)) me->CastSpell(target, SPELL_SOUL_CONSUMPTION, TRIGGERED_IGNORE_SET_FACING); events.ScheduleEvent(EVENT_SOUL_CONSUMPTION, Seconds(20)); break; default: break; } } DoMeleeAttackIfReady(); } }; CreatureAI* GetAI(Creature* creature) const override { return GetRubySanctumAI<boss_twilight_halionAI>(creature); } }; class npc_halion_controller : public CreatureScript { public: npc_halion_controller() : CreatureScript("npc_halion_controller") { } struct npc_halion_controllerAI : public ScriptedAI { npc_halion_controllerAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()), _summons(me) { Initialize(); } void Initialize() { _materialCorporealityValue = 5; _materialDamageTaken = 0; _twilightDamageTaken = 0; } void JustRespawned() override { if (_instance->GetGuidData(DATA_HALION) || _instance->GetBossState(DATA_GENERAL_ZARITHRIAN) != DONE) return; Reset(); me->GetMap()->SummonCreature(NPC_HALION, HalionRespawnPos); } void Reset() override { _summons.DespawnAll(); _events.Reset(); Initialize(); DoCastSelf(SPELL_CLEAR_DEBUFFS); } void JustSummoned(Creature* who) override { _summons.Summon(who); } void JustDied(Unit* /*killer*/) override { _events.Reset(); _summons.DespawnAll(); DoCastSelf(SPELL_CLEAR_DEBUFFS); } void EnterCombat(Unit* /*who*/) override { _twilightDamageTaken = 0; _materialDamageTaken = 0; _events.ScheduleEvent(EVENT_TRIGGER_BERSERK, Minutes(8)); _events.ScheduleEvent(EVENT_EVADE_CHECK, Seconds(5)); } void EnterEvadeMode(EvadeReason /*why*/) override { if (Creature* twilightHalion = _instance->GetCreature(DATA_TWILIGHT_HALION)) { twilightHalion->DespawnOrUnsummon(); _instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, twilightHalion); } if (Creature* halion = _instance->GetCreature(DATA_HALION)) { halion->DespawnOrUnsummon(); _instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, halion); } _instance->SetBossState(DATA_HALION, FAIL); _summons.DespawnAll(); uint32 corpseDelay = me->GetCorpseDelay(); uint32 respawnDelay = me->GetRespawnDelay(); me->SetCorpseDelay(1); me->SetRespawnDelay(30); me->DespawnOrUnsummon(); me->SetCorpseDelay(corpseDelay); me->SetRespawnDelay(respawnDelay); } void DoAction(int32 action) override { switch (action) { case ACTION_INTRO_HALION: _events.Reset(); _events.SetPhase(PHASE_INTRO); _events.ScheduleEvent(EVENT_START_INTRO, Seconds(2)); break; case ACTION_INTRO_HALION_2: if (_instance->GetGuidData(DATA_HALION)) return; for (uint8 i = DATA_BURNING_TREE_1; i <= DATA_BURNING_TREE_4; ++i) if (GameObject* tree = _instance->GetGameObject(i)) _instance->HandleGameObject(ObjectGuid::Empty, true, tree); me->GetMap()->SummonCreature(NPC_HALION, HalionRespawnPos); break; case ACTION_MONITOR_CORPOREALITY: { for (uint8 itr = DATA_HALION; itr <= DATA_TWILIGHT_HALION; itr++) { Creature* halion = _instance->GetCreature(itr); if (!halion) continue; halion->CastSpell(halion, GetSpell(_materialCorporealityValue, itr == DATA_TWILIGHT_HALION), false); halion->AI()->SetData(DATA_FIGHT_PHASE, PHASE_THREE); if (itr == DATA_TWILIGHT_HALION) continue; halion->RemoveAurasDueToSpell(SPELL_TWILIGHT_PHASING); halion->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } // Summon Twilight portals DoCastSelf(SPELL_SUMMON_EXIT_PORTALS); _instance->DoUpdateWorldState(WORLDSTATE_CORPOREALITY_TOGGLE, 1); // Hardcoding doesn't really matter here. _instance->DoUpdateWorldState(WORLDSTATE_CORPOREALITY_MATERIAL, 50); _instance->DoUpdateWorldState(WORLDSTATE_CORPOREALITY_TWILIGHT, 50); _events.ScheduleEvent(EVENT_CHECK_CORPOREALITY, Seconds(7)); break; } case ACTION_ACTIVATE_EMBERS: _events.ScheduleEvent(EVENT_ACTIVATE_EMBERS, Seconds(6)); break; default: break; } } void UpdateAI(uint32 diff) override { // The IsInCombat() check is needed because that check should be false when Halion is // not engaged, while it would return true without as UpdateVictim() checks for // combat state. if (!_events.IsInPhase(PHASE_INTRO) && me->IsInCombat() && !UpdateVictim()) { EnterEvadeMode(EVADE_REASON_NO_HOSTILES); return; } _events.Update(diff); while (uint32 eventId = _events.ExecuteEvent()) { switch (eventId) { case EVENT_START_INTRO: DoCastSelf(SPELL_COSMETIC_FIRE_PILLAR, true); _events.ScheduleEvent(EVENT_INTRO_PROGRESS_1, Seconds(4)); break; case EVENT_INTRO_PROGRESS_1: for (uint8 i = DATA_BURNING_TREE_3; i <= DATA_BURNING_TREE_4; ++i) if (GameObject* tree = _instance->GetGameObject(i)) _instance->HandleGameObject(ObjectGuid::Empty, true, tree); _events.ScheduleEvent(EVENT_INTRO_PROGRESS_2, Seconds(4)); break; case EVENT_INTRO_PROGRESS_2: for (uint8 i = DATA_BURNING_TREE_1; i <= DATA_BURNING_TREE_2; ++i) if (GameObject* tree = _instance->GetGameObject(i)) _instance->HandleGameObject(ObjectGuid::Empty, true, tree); _events.ScheduleEvent(EVENT_INTRO_PROGRESS_3, Seconds(4)); break; case EVENT_INTRO_PROGRESS_3: DoCastSelf(SPELL_FIERY_EXPLOSION); if (_instance->GetGuidData(DATA_HALION)) return; if (Creature* halion = me->GetMap()->SummonCreature(NPC_HALION, HalionSpawnPos)) halion->AI()->Talk(SAY_INTRO); break; case EVENT_TWILIGHT_MENDING: if (_instance->GetCreature(DATA_HALION)) // Just check if physical Halion is spawned if (Creature* twilightHalion = _instance->GetCreature(DATA_TWILIGHT_HALION)) twilightHalion->CastSpell((Unit*)nullptr, SPELL_TWILIGHT_MENDING, true); break; case EVENT_TRIGGER_BERSERK: for (uint8 i = DATA_HALION; i <= DATA_TWILIGHT_HALION; i++) if (Creature* halion = _instance->GetCreature(i)) halion->CastSpell(halion, SPELL_BERSERK, true); break; case EVENT_SHADOW_PULSARS_SHOOT: if (Creature* orbCarrier = _instance->GetCreature(DATA_ORB_CARRIER)) orbCarrier->AI()->DoAction(ACTION_WARNING_SHOOT); _events.ScheduleEvent(EVENT_SHADOW_PULSARS_SHOOT, Seconds(30)); break; case EVENT_CHECK_CORPOREALITY: UpdateCorporeality(); _events.ScheduleEvent(EVENT_CHECK_CORPOREALITY, Seconds(5)); break; case EVENT_ACTIVATE_EMBERS: _summons.DoZoneInCombat(NPC_LIVING_EMBER); break; case EVENT_EVADE_CHECK: DoCheckEvade(); _events.Repeat(Seconds(5)); break; default: break; } } } void DoCheckEvade() { Map::PlayerList const& players = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) if (Player* player = i->GetSource()) if (player->IsAlive() && CheckBoundary(player) && !player->IsGameMaster()) return; EnterEvadeMode(EVADE_REASON_NO_HOSTILES); } void SetData(uint32 id, uint32 value) override { switch (id) { case DATA_MATERIAL_DAMAGE_TAKEN: _materialDamageTaken += value; break; case DATA_TWILIGHT_DAMAGE_TAKEN: _twilightDamageTaken += value; break; case DATA_FIGHT_PHASE: _events.SetPhase(value); switch (value) { case PHASE_ONE: DoZoneInCombat(); break; case PHASE_TWO: _events.ScheduleEvent(EVENT_SHADOW_PULSARS_SHOOT, Seconds(35)); break; default: break; } break; default: break; } } private: //// @todo Find out a better scaling, if any. // [0 , 0.98[: Corporeality goes down // [0.98, 0.99]: Do nothing // ]0.99, 1.01[: Twilight Mending // [1.01, 1.02]: Do nothing // ]1.02, +oo [: Corporeality goes up void UpdateCorporeality() { uint8 oldValue = _materialCorporealityValue; if (_twilightDamageTaken == 0 || _materialDamageTaken == 0) { _events.ScheduleEvent(EVENT_TWILIGHT_MENDING, Milliseconds(100)); _twilightDamageTaken = 0; _materialDamageTaken = 0; return; } float damageRatio = float(_materialDamageTaken) / float(_twilightDamageTaken); CorporealityEvent action = CORPOREALITY_NONE; if (damageRatio < 0.98f) // [0 , 0.98[: Corporeality goes down action = CORPOREALITY_DECREASE; else if (0.99f < damageRatio && damageRatio < 1.01f) // ]0.99, 1.01[: Twilight Mending action = CORPOREALITY_TWILIGHT_MENDING; else if (1.02f < damageRatio) // ]1.02, +oo [: Corporeality goes up action = CORPOREALITY_INCREASE; switch (action) { case CORPOREALITY_NONE: { _materialDamageTaken = 0; _twilightDamageTaken = 0; return; } case CORPOREALITY_INCREASE: { if (_materialCorporealityValue >= (MAX_CORPOREALITY_STATE - 1)) return; ++_materialCorporealityValue; break; } case CORPOREALITY_DECREASE: { if (_materialCorporealityValue <= 0) return; --_materialCorporealityValue; break; } case CORPOREALITY_TWILIGHT_MENDING: { _events.ScheduleEvent(EVENT_TWILIGHT_MENDING, Milliseconds(100)); _materialDamageTaken = 0; _twilightDamageTaken = 0; return; } } _materialDamageTaken = 0; _twilightDamageTaken = 0; _instance->DoUpdateWorldState(WORLDSTATE_CORPOREALITY_MATERIAL, _materialCorporealityValue * 10); _instance->DoUpdateWorldState(WORLDSTATE_CORPOREALITY_TWILIGHT, 100 - _materialCorporealityValue * 10); for (uint8 itr = DATA_HALION; itr <= DATA_TWILIGHT_HALION; itr++) { if (Creature* halion = _instance->GetCreature(itr)) { halion->CastSpell(halion, GetSpell(_materialCorporealityValue, itr == DATA_TWILIGHT_HALION), true); if (itr == DATA_TWILIGHT_HALION) halion->AI()->Talk(oldValue < _materialCorporealityValue ? EMOTE_CORPOREALITY_TOT : EMOTE_CORPOREALITY_TIT, halion); else // if (itr == DATA_HALION) halion->AI()->Talk(oldValue > _materialCorporealityValue ? EMOTE_CORPOREALITY_POT : EMOTE_CORPOREALITY_PIP, halion); } } } uint32 GetSpell(uint8 pctValue, bool isTwilight = false) const { CorporealityEntry entry = _corporealityReference[pctValue]; return isTwilight ? entry.twilightRealmSpell : entry.materialRealmSpell; } EventMap _events; InstanceScript* _instance; SummonList _summons; uint32 _twilightDamageTaken; uint32 _materialDamageTaken; uint8 _materialCorporealityValue; }; CreatureAI* GetAI(Creature* creature) const override { return GetRubySanctumAI<npc_halion_controllerAI>(creature); } }; class npc_orb_carrier : public CreatureScript { public: npc_orb_carrier() : CreatureScript("npc_orb_carrier") { } struct npc_orb_carrierAI : public ScriptedAI { npc_orb_carrierAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { ASSERT(creature->GetVehicleKit()); } void UpdateAI(uint32 diff) override { /// According to sniffs this spell is cast every 1 or 2 seconds. /// However, refreshing it looks bad, so just cast the spell if /// we are not channeling it. if (!me->HasUnitState(UNIT_STATE_CASTING)) me->CastSpell((Unit*)nullptr, SPELL_TRACK_ROTATION, false); scheduler.Update(diff); /// Workaround: This is here because even though the above spell has SPELL_ATTR1_CHANNEL_TRACK_TARGET, /// we are having two creatures involded here. This attribute is handled clientside, meaning the client /// sends orientation update itself. Here, no packet is sent, and the creature does not rotate. By /// forcing the carrier to always be facing the rotation focus, we ensure everything works as it should. if (Creature* rotationFocus = _instance->GetCreature(DATA_ORB_ROTATION_FOCUS)) me->SetFacingToObject(rotationFocus); // setInFront } void DoAction(int32 action) override { switch (action) { case ACTION_WARNING_SHOOT: { Vehicle* vehicle = me->GetVehicleKit(); Unit* northOrb = vehicle->GetPassenger(SEAT_NORTH); if (northOrb && northOrb->GetTypeId() == TYPEID_UNIT) northOrb->ToCreature()->AI()->Talk(EMOTE_WARN_LASER); scheduler.Schedule(Seconds(5), [this](TaskContext /*context*/) { DoAction(ACTION_SHOOT); }); break; } case ACTION_SHOOT: { Vehicle* vehicle = me->GetVehicleKit(); Unit* southOrb = vehicle->GetPassenger(SEAT_SOUTH); Unit* northOrb = vehicle->GetPassenger(SEAT_NORTH); if (southOrb && northOrb) TriggerCutter(northOrb, southOrb); if (Creature* twilightHalion = _instance->GetCreature(DATA_TWILIGHT_HALION)) twilightHalion->AI()->Talk(SAY_SPHERE_PULSE); if (!IsHeroic()) return; Unit* eastOrb = vehicle->GetPassenger(SEAT_EAST); Unit* westOrb = vehicle->GetPassenger(SEAT_WEST); if (eastOrb && westOrb) TriggerCutter(eastOrb, westOrb); break; } default: break; } } private: InstanceScript* _instance; TaskScheduler scheduler; void TriggerCutter(Unit* caster, Unit* target) { caster->CastSpell(caster, SPELL_TWILIGHT_PULSE_PERIODIC, true); target->CastSpell(target, SPELL_TWILIGHT_PULSE_PERIODIC, true); caster->CastSpell(target, SPELL_TWILIGHT_CUTTER, false); } }; CreatureAI* GetAI(Creature* creature) const override { return GetRubySanctumAI<npc_orb_carrierAI>(creature); } }; class npc_meteor_strike_initial : public CreatureScript { public: npc_meteor_strike_initial() : CreatureScript("npc_meteor_strike_initial") { } struct npc_meteor_strike_initialAI : public ScriptedAI { npc_meteor_strike_initialAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { SetCombatMovement(false); } void DoAction(int32 action) override { switch (action) { case ACTION_METEOR_STRIKE_AOE: DoCastSelf(SPELL_METEOR_STRIKE_AOE_DAMAGE, true); DoCastSelf(SPELL_METEOR_STRIKE_FIRE_AURA_1, true); for (std::list<Creature*>::iterator itr = _meteorList.begin(); itr != _meteorList.end(); ++itr) (*itr)->AI()->DoAction(ACTION_METEOR_STRIKE_BURN); break; } } void IsSummonedBy(Unit* summoner) override { Creature* owner = summoner->ToCreature(); if (!owner) return; // Let Controller count as summoner if (Creature* controller = _instance->GetCreature(DATA_HALION_CONTROLLER)) controller->AI()->JustSummoned(me); DoCastSelf(SPELL_METEOR_STRIKE_COUNTDOWN); DoCastSelf(SPELL_BIRTH_NO_VISUAL); if (HalionAI* halionAI = CAST_AI(HalionAI, owner->AI())) { Position const* ownerPos = halionAI->GetMeteorStrikePosition(); float randomAdjustment = frand(static_cast<float>(M_PI / 5.0f), static_cast<float>(M_PI / 2.0f)); float angle[4]; angle[0] = me->GetAngle(ownerPos); angle[1] = angle[0] + randomAdjustment; angle[2] = angle[0] + static_cast<float>(M_PI); angle[3] = angle[2] + randomAdjustment; _meteorList.clear(); for (uint8 i = 0; i < 4; i++) { angle[i] = Position::NormalizeOrientation(angle[i]); me->SetOrientation(angle[i]); Position newPos = me->GetNearPosition(10.0f, 0.0f); // Exact distance if (Creature* meteor = me->SummonCreature(NPC_METEOR_STRIKE_NORTH + i, newPos, TEMPSUMMON_TIMED_DESPAWN, 30000)) _meteorList.push_back(meteor); } } } void UpdateAI(uint32 /*diff*/) override { } void EnterEvadeMode(EvadeReason /*why*/) override { } private: InstanceScript* _instance; std::list<Creature*> _meteorList; }; CreatureAI* GetAI(Creature* creature) const override { return GetRubySanctumAI<npc_meteor_strike_initialAI>(creature); } }; class npc_meteor_strike : public CreatureScript { public: npc_meteor_strike() : CreatureScript("npc_meteor_strike") { } struct npc_meteor_strikeAI : public ScriptedAI { npc_meteor_strikeAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()), _spawnCount(0) { SetCombatMovement(false); } void DoAction(int32 action) override { if (action == ACTION_METEOR_STRIKE_BURN) { DoCastSelf(SPELL_METEOR_STRIKE_FIRE_AURA_2, true); me->setActive(true); _events.ScheduleEvent(EVENT_SPAWN_METEOR_FLAME, Milliseconds(500)); } } void IsSummonedBy(Unit* /*summoner*/) override { // Let Halion Controller count as summoner. if (Creature* controller = _instance->GetCreature(DATA_HALION_CONTROLLER)) controller->AI()->JustSummoned(me); } void SetData(uint32 dataType, uint32 dataCount) override { if (dataType == DATA_SPAWNED_FLAMES) _spawnCount += dataCount; } uint32 GetData(uint32 dataType) const override { if (dataType == DATA_SPAWNED_FLAMES) return _spawnCount; return 0; } void UpdateAI(uint32 diff) override { _events.Update(diff); if (_events.ExecuteEvent() == EVENT_SPAWN_METEOR_FLAME) { Position pos = me->GetNearPosition(5.0f, frand(-static_cast<float>(M_PI / 6.0f), static_cast<float>(M_PI / 6.0f))); if (Creature* flame = me->SummonCreature(NPC_METEOR_STRIKE_FLAME, pos, TEMPSUMMON_TIMED_DESPAWN, 25000)) flame->AI()->SetGUID(me->GetGUID()); } } private: InstanceScript* _instance; EventMap _events; uint8 _spawnCount; }; CreatureAI* GetAI(Creature* creature) const override { return GetRubySanctumAI<npc_meteor_strikeAI>(creature); } }; class npc_meteor_strike_flame : public CreatureScript { public: npc_meteor_strike_flame() : CreatureScript("npc_meteor_strike_flame") { } struct npc_meteor_strike_flameAI : public ScriptedAI { npc_meteor_strike_flameAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { SetCombatMovement(false); } void SetGUID(ObjectGuid guid, int32 /*id = 0 */) override { _rootOwnerGuid = guid; _events.ScheduleEvent(EVENT_SPAWN_METEOR_FLAME, Milliseconds(800)); } void IsSummonedBy(Unit* /*summoner*/) override { // Let Halion Controller count as summoner. if (Creature* controller = _instance->GetCreature(DATA_HALION_CONTROLLER)) controller->AI()->JustSummoned(me); } void UpdateAI(uint32 diff) override { _events.Update(diff); if (_events.ExecuteEvent() != EVENT_SPAWN_METEOR_FLAME) return; me->CastSpell(me, SPELL_METEOR_STRIKE_FIRE_AURA_2, true); Creature* meteorStrike = ObjectAccessor::GetCreature(*me, _rootOwnerGuid); if (!meteorStrike) return; meteorStrike->AI()->SetData(DATA_SPAWNED_FLAMES, 1); if (meteorStrike->AI()->GetData(DATA_SPAWNED_FLAMES) > 5) return; Position pos = me->GetNearPosition(5.0f, frand(-static_cast<float>(M_PI / 6.0f), static_cast<float>(M_PI / 6.0f))); if (Creature* flame = me->SummonCreature(NPC_METEOR_STRIKE_FLAME, pos, TEMPSUMMON_TIMED_DESPAWN, 25000)) flame->AI()->SetGUID(_rootOwnerGuid); } void EnterEvadeMode(EvadeReason /*why*/) override { } private: InstanceScript* _instance; EventMap _events; ObjectGuid _rootOwnerGuid; }; CreatureAI* GetAI(Creature* creature) const override { return GetRubySanctumAI<npc_meteor_strike_flameAI>(creature); } }; class npc_combustion_consumption : public CreatureScript { public: npc_combustion_consumption() : CreatureScript("npc_combustion_consumption") { } struct npc_combustion_consumptionAI : public ScriptedAI { npc_combustion_consumptionAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { SetCombatMovement(false); switch (creature->GetEntry()) { case NPC_COMBUSTION: _explosionSpell = SPELL_FIERY_COMBUSTION_EXPLOSION; _damageSpell = SPELL_COMBUSTION_DAMAGE_AURA; creature->SetPhaseMask(IsHeroic() ? 0x21 : 0x01, true); break; case NPC_CONSUMPTION: _explosionSpell = SPELL_SOUL_CONSUMPTION_EXPLOSION; _damageSpell = SPELL_CONSUMPTION_DAMAGE_AURA; creature->SetPhaseMask(IsHeroic() ? 0x21 : 0x20, true); break; default: // Should never happen _explosionSpell = 0; _damageSpell = 0; break; } } void IsSummonedBy(Unit* summoner) override { // Let Halion Controller count as summoner if (Creature* controller = _instance->GetCreature(DATA_HALION_CONTROLLER)) controller->AI()->JustSummoned(me); _summonerGuid = summoner->GetGUID(); } void SetData(uint32 type, uint32 stackAmount) override { Unit* summoner = ObjectAccessor::GetUnit(*me, _summonerGuid); if (type != DATA_STACKS_DISPELLED || !_damageSpell || !_explosionSpell || !summoner) return; me->CastCustomSpell(SPELL_SCALE_AURA, SPELLVALUE_AURA_STACK, stackAmount + 1, me); DoCastSelf(_damageSpell); int32 damage = 1200 + (stackAmount * 1290); // Needs more research. summoner->CastCustomSpell(_explosionSpell, SPELLVALUE_BASE_POINT0, damage, summoner); } void UpdateAI(uint32 /*diff*/) override { } private: InstanceScript* _instance; uint32 _explosionSpell; uint32 _damageSpell; ObjectGuid _summonerGuid; }; CreatureAI* GetAI(Creature* creature) const override { return GetRubySanctumAI<npc_combustion_consumptionAI>(creature); } }; class npc_living_inferno : public CreatureScript { public: npc_living_inferno() : CreatureScript("npc_living_inferno") { } struct npc_living_infernoAI : public ScriptedAI { npc_living_infernoAI(Creature* creature) : ScriptedAI(creature) { } void IsSummonedBy(Unit* /*summoner*/) override { me->SetInCombatWithZone(); me->CastSpell(me, SPELL_BLAZING_AURA, true); // SMSG_SPELL_GO for the living ember stuff isn't even sent to the client - Blizzard on drugs. if (me->GetMap()->GetDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC) scheduler.Schedule(Seconds(3), [this](TaskContext /*context*/) { me->CastSpell(me, SPELL_SPAWN_LIVING_EMBERS, true); }); if (InstanceScript* instance = me->GetInstanceScript()) if (Creature* controller = instance->GetCreature(DATA_HALION_CONTROLLER)) { controller->AI()->DoAction(ACTION_ACTIVATE_EMBERS); controller->AI()->JustSummoned(me); } } void JustDied(Unit* /*killer*/) override { me->DespawnOrUnsummon(1); } void UpdateAI(uint32 diff) override { scheduler.Update(diff); ScriptedAI::UpdateAI(diff); } private: TaskScheduler scheduler; }; CreatureAI* GetAI(Creature* creature) const override { return GetRubySanctumAI<npc_living_infernoAI>(creature); } }; class npc_living_ember : public CreatureScript { public: npc_living_ember() : CreatureScript("npc_living_ember") { } struct npc_living_emberAI : public ScriptedAI { npc_living_emberAI(Creature* creature) : ScriptedAI(creature) { } void IsSummonedBy(Unit* /*summoner*/) override { if (InstanceScript* instance = me->GetInstanceScript()) if (Creature* controller = instance->GetCreature(DATA_HALION_CONTROLLER)) controller->AI()->JustSummoned(me); } void JustDied(Unit* /*killer*/) override { me->DespawnOrUnsummon(1); } }; CreatureAI* GetAI(Creature* creature) const override { return GetRubySanctumAI<npc_living_emberAI>(creature); } }; class go_twilight_portal : public GameObjectScript { public: go_twilight_portal() : GameObjectScript("go_twilight_portal") { } struct go_twilight_portalAI : public GameObjectAI { go_twilight_portalAI(GameObject* gameobject) : GameObjectAI(gameobject), _instance(gameobject->GetInstanceScript()), _deleted(false) { switch (gameobject->GetEntry()) { case GO_HALION_PORTAL_EXIT: gameobject->SetPhaseMask(0x20, true); _spellId = gameobject->GetGOInfo()->goober.spellId; break; case GO_HALION_PORTAL_1: case GO_HALION_PORTAL_2: gameobject->SetPhaseMask(0x1, true); /// Because WDB template has non-existent spell ID, not seen in sniffs either, meh _spellId = SPELL_TWILIGHT_REALM; break; default: _spellId = 0; break; } } bool GossipHello(Player* player) override { if (_spellId != 0) player->CastSpell(player, _spellId, true); return true; } void UpdateAI(uint32 /*diff*/) override { if (_instance->GetBossState(DATA_HALION) == IN_PROGRESS) return; if (!_deleted) { _deleted = true; me->Delete(); } } private: InstanceScript* _instance; uint32 _spellId; bool _deleted; }; GameObjectAI* GetAI(GameObject* gameobject) const override { return GetRubySanctumAI<go_twilight_portalAI>(gameobject); } }; class spell_halion_meteor_strike_marker : public SpellScriptLoader { public: spell_halion_meteor_strike_marker() : SpellScriptLoader("spell_halion_meteor_strike_marker") { } class spell_halion_meteor_strike_marker_AuraScript : public AuraScript { PrepareAuraScript(spell_halion_meteor_strike_marker_AuraScript); void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { if (!GetCaster()) return; if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE) if (Creature* creCaster = GetCaster()->ToCreature()) creCaster->AI()->DoAction(ACTION_METEOR_STRIKE_AOE); } void Register() override { AfterEffectRemove += AuraEffectRemoveFn(spell_halion_meteor_strike_marker_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); } }; AuraScript* GetAuraScript() const override { return new spell_halion_meteor_strike_marker_AuraScript(); } }; class spell_halion_combustion_consumption : public SpellScriptLoader { public: spell_halion_combustion_consumption(char const* scriptName, uint32 spell) : SpellScriptLoader(scriptName), _spellID(spell) { } class spell_halion_combustion_consumption_AuraScript : public AuraScript { PrepareAuraScript(spell_halion_combustion_consumption_AuraScript); public: spell_halion_combustion_consumption_AuraScript(uint32 spellID) : AuraScript(), _markSpell(spellID) { } private: bool Validate(SpellInfo const* /*spellInfo*/) override { return ValidateSpellInfo({ _markSpell }); } void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH) return; if (GetTarget()->HasAura(_markSpell)) GetTarget()->RemoveAurasDueToSpell(_markSpell, ObjectGuid::Empty, 0, AURA_REMOVE_BY_EXPIRE); } void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { GetTarget()->CastSpell(GetTarget(), _markSpell, true); } void AddMarkStack(AuraEffect const* /*aurEff*/) { GetTarget()->CastSpell(GetTarget(), _markSpell, true); } void Register() override { OnEffectPeriodic += AuraEffectPeriodicFn(spell_halion_combustion_consumption_AuraScript::AddMarkStack, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); AfterEffectApply += AuraEffectApplyFn(spell_halion_combustion_consumption_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); AfterEffectRemove += AuraEffectRemoveFn(spell_halion_combustion_consumption_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); } uint32 _markSpell; }; AuraScript* GetAuraScript() const override { return new spell_halion_combustion_consumption_AuraScript(_spellID); } private: uint32 _spellID; }; class spell_halion_combustion_consumption_periodic : public SpellScriptLoader { public: spell_halion_combustion_consumption_periodic() : SpellScriptLoader("spell_halion_combustion_consumption_periodic") { } class spell_halion_combustion_consumption_periodic_AuraScript : public AuraScript { PrepareAuraScript(spell_halion_combustion_consumption_periodic_AuraScript); bool Validate(SpellInfo const* spellInfo) override { return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell }); } void HandleTick(AuraEffect const* aurEff) { PreventDefaultAction(); Unit* caster = GetCaster(); if (!caster) return; uint32 triggerSpell = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell; int32 radius = caster->GetObjectScale() * M_PI * 10000 / 3; caster->CastCustomSpell(triggerSpell, SPELLVALUE_RADIUS_MOD, radius, (Unit*)nullptr, TRIGGERED_FULL_MASK, nullptr, aurEff, caster->GetGUID()); } void Register() override { OnEffectPeriodic += AuraEffectPeriodicFn(spell_halion_combustion_consumption_periodic_AuraScript::HandleTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); } }; AuraScript* GetAuraScript() const override { return new spell_halion_combustion_consumption_periodic_AuraScript(); } }; class spell_halion_marks : public SpellScriptLoader { public: spell_halion_marks(char const* scriptName, uint32 summonSpell, uint32 removeSpell) : SpellScriptLoader(scriptName), _summonSpell(summonSpell), _removeSpell(removeSpell) { } class spell_halion_marks_AuraScript : public AuraScript { PrepareAuraScript(spell_halion_marks_AuraScript); public: spell_halion_marks_AuraScript(uint32 summonSpell, uint32 removeSpell) : AuraScript(), _summonSpellId(summonSpell), _removeSpellId(removeSpell) { } private: bool Validate(SpellInfo const* /*spell*/) override { return ValidateSpellInfo({ _summonSpellId, _removeSpellId }); } /// We were purged. Force removed stacks to zero and trigger the appropriated remove handler. void BeforeDispel(DispelInfo* dispelData) { // Prevent any stack from being removed at this point. dispelData->SetRemovedCharges(0); if (Unit* dispelledUnit = GetUnitOwner()) if (dispelledUnit->HasAura(_removeSpellId)) dispelledUnit->RemoveAurasDueToSpell(_removeSpellId, ObjectGuid::Empty, 0, AURA_REMOVE_BY_EXPIRE); } void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE) return; // Stacks marker GetTarget()->CastCustomSpell(_summonSpellId, SPELLVALUE_BASE_POINT1, aurEff->GetBase()->GetStackAmount(), GetTarget(), TRIGGERED_FULL_MASK, nullptr, nullptr, GetCasterGUID()); } void Register() override { OnDispel += AuraDispelFn(spell_halion_marks_AuraScript::BeforeDispel); AfterEffectRemove += AuraEffectRemoveFn(spell_halion_marks_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); } uint32 _summonSpellId; uint32 _removeSpellId; }; AuraScript* GetAuraScript() const override { return new spell_halion_marks_AuraScript(_summonSpell, _removeSpell); } private: uint32 _summonSpell; uint32 _removeSpell; }; class spell_halion_damage_aoe_summon : public SpellScriptLoader { public: spell_halion_damage_aoe_summon() : SpellScriptLoader("spell_halion_damage_aoe_summon") { } class spell_halion_damage_aoe_summon_SpellScript : public SpellScript { PrepareSpellScript(spell_halion_damage_aoe_summon_SpellScript); void HandleSummon(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); Unit* caster = GetCaster(); uint32 entry = uint32(GetSpellInfo()->Effects[effIndex].MiscValue); SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(uint32(GetSpellInfo()->Effects[effIndex].MiscValueB)); uint32 duration = uint32(GetSpellInfo()->GetDuration()); Position pos = caster->GetPosition(); if (Creature* summon = caster->GetMap()->SummonCreature(entry, pos, properties, duration, caster, GetSpellInfo()->Id)) if (summon->IsAIEnabled) summon->AI()->SetData(DATA_STACKS_DISPELLED, GetSpellValue()->EffectBasePoints[EFFECT_1]); } void Register() override { OnEffectHit += SpellEffectFn(spell_halion_damage_aoe_summon_SpellScript::HandleSummon, EFFECT_0, SPELL_EFFECT_SUMMON); } }; SpellScript* GetSpellScript() const override { return new spell_halion_damage_aoe_summon_SpellScript(); } }; class spell_halion_twilight_realm_handlers : public SpellScriptLoader { public: spell_halion_twilight_realm_handlers(char const* scriptName, uint32 beforeHitSpell, bool isApplyHandler) : SpellScriptLoader(scriptName), _beforeHitSpell(beforeHitSpell), _isApplyHandler(isApplyHandler) { } class spell_halion_twilight_realm_handlers_AuraScript : public AuraScript { PrepareAuraScript(spell_halion_twilight_realm_handlers_AuraScript); public: spell_halion_twilight_realm_handlers_AuraScript(uint32 beforeHitSpell, bool isApplyHandler) : AuraScript(), _isApply(isApplyHandler), _beforeHitSpellId(beforeHitSpell) { } private: bool Validate(SpellInfo const* /*spell*/) override { return ValidateSpellInfo({ _beforeHitSpellId }); } void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*handle*/) { GetTarget()->RemoveAurasDueToSpell(SPELL_TWILIGHT_REALM); if (InstanceScript* instance = GetTarget()->GetInstanceScript()) instance->SendEncounterUnit(ENCOUNTER_FRAME_UNK7); } void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*handle*/) { Unit* target = GetTarget(); if (!target) return; target->RemoveAurasDueToSpell(_beforeHitSpellId, ObjectGuid::Empty, 0, AURA_REMOVE_BY_ENEMY_SPELL); if (InstanceScript* instance = target->GetInstanceScript()) instance->SendEncounterUnit(ENCOUNTER_FRAME_UNK7); } void Register() override { if (!_isApply) { AfterEffectApply += AuraEffectApplyFn(spell_halion_twilight_realm_handlers_AuraScript::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); AfterEffectRemove += AuraEffectRemoveFn(spell_halion_twilight_realm_handlers_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); } else AfterEffectApply += AuraEffectApplyFn(spell_halion_twilight_realm_handlers_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PHASE, AURA_EFFECT_HANDLE_REAL); } bool _isApply; uint32 _beforeHitSpellId; }; AuraScript* GetAuraScript() const override { return new spell_halion_twilight_realm_handlers_AuraScript(_beforeHitSpell, _isApplyHandler); } private: uint32 _beforeHitSpell; bool _isApplyHandler; }; class spell_halion_clear_debuffs : public SpellScriptLoader { public: spell_halion_clear_debuffs() : SpellScriptLoader("spell_halion_clear_debuffs") { } class spell_halion_clear_debuffs_SpellScript : public SpellScript { PrepareSpellScript(spell_halion_clear_debuffs_SpellScript); bool Validate(SpellInfo const* /*spell*/) override { return ValidateSpellInfo({ SPELL_CLEAR_DEBUFFS, SPELL_TWILIGHT_REALM }); } void HandleScript(SpellEffIndex effIndex) { if (GetHitUnit()->HasAura(GetSpellInfo()->Effects[effIndex].CalcValue())) GetHitUnit()->RemoveAurasDueToSpell(GetSpellInfo()->Effects[effIndex].CalcValue()); } void Register() override { OnEffectHitTarget += SpellEffectFn(spell_halion_clear_debuffs_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; SpellScript* GetSpellScript() const override { return new spell_halion_clear_debuffs_SpellScript(); } }; class TwilightCutterSelector { public: TwilightCutterSelector(Unit* caster, Unit* target) : _caster(caster), _channelTarget(target) { } bool operator()(WorldObject* unit) { return !unit->IsInBetween(_caster, _channelTarget, 4.0f); } private: Unit* _caster; Unit* _channelTarget; }; class spell_halion_twilight_cutter : public SpellScriptLoader { public: spell_halion_twilight_cutter() : SpellScriptLoader("spell_halion_twilight_cutter") { } class spell_halion_twilight_cutter_SpellScript : public SpellScript { PrepareSpellScript(spell_halion_twilight_cutter_SpellScript); void RemoveNotBetween(std::list<WorldObject*>& unitList) { if (unitList.empty()) return; Unit* caster = GetCaster(); if (Unit* channelTarget = ObjectAccessor::GetUnit(*caster, caster->GetChannelObjectGuid())) { unitList.remove_if(TwilightCutterSelector(caster, channelTarget)); return; } // In case cutter caster werent found for some reason unitList.clear(); } void Register() override { OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_halion_twilight_cutter_SpellScript::RemoveNotBetween, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); } }; SpellScript* GetSpellScript() const override { return new spell_halion_twilight_cutter_SpellScript(); } }; class spell_halion_twilight_phasing : public SpellScriptLoader { public: spell_halion_twilight_phasing() : SpellScriptLoader("spell_halion_twilight_phasing") { } class spell_halion_twilight_phasing_SpellScript : public SpellScript { PrepareSpellScript(spell_halion_twilight_phasing_SpellScript); bool Validate(SpellInfo const* /*spellInfo*/) override { return ValidateSpellInfo({ SPELL_SUMMON_TWILIGHT_PORTAL }); } void Phase() { Unit* caster = GetCaster(); caster->CastSpell(caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ(), SPELL_SUMMON_TWILIGHT_PORTAL, true); caster->GetMap()->SummonCreature(NPC_TWILIGHT_HALION, HalionSpawnPos); } void Register() override { OnHit += SpellHitFn(spell_halion_twilight_phasing_SpellScript::Phase); } }; SpellScript* GetSpellScript() const override { return new spell_halion_twilight_phasing_SpellScript(); } }; // 74805 - Summon Exit Portals class spell_halion_summon_exit_portals : public SpellScriptLoader { public: spell_halion_summon_exit_portals() : SpellScriptLoader("spell_halion_summon_exit_portals") { } class spell_halion_summon_exit_portals_SpellScript : public SpellScript { PrepareSpellScript(spell_halion_summon_exit_portals_SpellScript); void SetDest0(SpellDestination& dest) { Position const offset = { 0.0f, 20.0f, 0.0f, 0.0f }; dest.RelocateOffset(offset); } void SetDest1(SpellDestination& dest) { Position const offset = { 0.0f, -20.0f, 0.0f, 0.0f }; dest.RelocateOffset(offset); } void Register() override { OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_halion_summon_exit_portals_SpellScript::SetDest0, EFFECT_0, TARGET_DEST_CASTER); OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_halion_summon_exit_portals_SpellScript::SetDest1, EFFECT_1, TARGET_DEST_CASTER); } }; SpellScript* GetSpellScript() const override { return new spell_halion_summon_exit_portals_SpellScript(); } }; class spell_halion_spawn_living_embers : public SpellScriptLoader { public: spell_halion_spawn_living_embers() : SpellScriptLoader("spell_halion_spawn_living_embers") { } class spell_halion_spawn_living_embers_SpellScript : public SpellScript { PrepareSpellScript(spell_halion_spawn_living_embers_SpellScript); void SelectMeteorFlames(std::list<WorldObject*>& unitList) { if (!unitList.empty()) Trinity::Containers::RandomResize(unitList, 10); } void HandleScript(SpellEffIndex /* effIndex */) { GetHitUnit()->CastSpell(GetHitUnit(), SPELL_SUMMON_LIVING_EMBER, true); } void Register() override { OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_halion_spawn_living_embers_SpellScript::SelectMeteorFlames, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); OnEffectHitTarget += SpellEffectFn(spell_halion_spawn_living_embers_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; SpellScript* GetSpellScript() const override { return new spell_halion_spawn_living_embers_SpellScript(); } }; class spell_halion_blazing_aura : public SpellScriptLoader { public: spell_halion_blazing_aura() : SpellScriptLoader("spell_halion_blazing_aura") { } class spell_halion_blazing_aura_SpellScript : public SpellScript { PrepareSpellScript(spell_halion_blazing_aura_SpellScript); void HandleScript(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); GetHitUnit()->CastSpell(GetHitUnit(), GetSpellInfo()->Effects[EFFECT_1].TriggerSpell); } void Register() override { OnEffectHitTarget += SpellEffectFn(spell_halion_blazing_aura_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_FORCE_CAST); } }; SpellScript* GetSpellScript() const override { return new spell_halion_blazing_aura_SpellScript(); } }; void AddSC_boss_halion() { new boss_halion(); new boss_twilight_halion(); new npc_halion_controller(); new npc_meteor_strike_flame(); new npc_meteor_strike_initial(); new npc_meteor_strike(); new npc_combustion_consumption(); new npc_orb_carrier(); new npc_living_inferno(); new npc_living_ember(); new go_twilight_portal(); new spell_halion_meteor_strike_marker(); new spell_halion_combustion_consumption("spell_halion_soul_consumption", SPELL_MARK_OF_CONSUMPTION); new spell_halion_combustion_consumption("spell_halion_fiery_combustion", SPELL_MARK_OF_COMBUSTION); new spell_halion_marks("spell_halion_mark_of_combustion", SPELL_FIERY_COMBUSTION_SUMMON, SPELL_FIERY_COMBUSTION); new spell_halion_marks("spell_halion_mark_of_consumption", SPELL_SOUL_CONSUMPTION_SUMMON, SPELL_SOUL_CONSUMPTION); new spell_halion_combustion_consumption_periodic(); new spell_halion_damage_aoe_summon(); new spell_halion_twilight_realm_handlers("spell_halion_leave_twilight_realm", SPELL_SOUL_CONSUMPTION, false); new spell_halion_twilight_realm_handlers("spell_halion_enter_twilight_realm", SPELL_FIERY_COMBUSTION, true); new spell_halion_summon_exit_portals(); new spell_halion_twilight_phasing(); new spell_halion_twilight_cutter(); new spell_halion_clear_debuffs(); new spell_halion_spawn_living_embers(); new spell_halion_blazing_aura(); }
gpl-2.0
THEMETEORY/wp-pointers-tour
PointersManager.php
2233
<?php class PointersManager implements PointersManagerInterface { private $pfile; private $version; private $prefix; private $pointers = array(); public function __construct( $file, $version, $prefix ) { $this->pfile = file_exists( $file ) ? $file : FALSE; $this->version = str_replace( '.', '_', $version ); $this->prefix = $prefix; add_action("switch_theme", array( $this, 'deactivation' ), 10 , 2); } public function parse() { if ( empty( $this->pfile ) ) return; $pointers = (array) require_once $this->pfile; if ( empty($pointers) ) return; foreach ( $pointers as $i => $pointer ) { $pointer['id'] = "{$this->prefix}{$this->version}_{$i}"; $this->pointers[$pointer['id']] = (object) $pointer; } } public function filter( $page ) { if ( empty( $this->pointers ) ) return array(); $uid = get_current_user_id(); $no = explode( ',', (string) get_user_meta( $uid, 'dismissed_wp_pointers', TRUE ) ); $active_ids = array_diff( array_keys( $this->pointers ), $no ); $good = array(); foreach( $this->pointers as $i => $pointer ) { if ( in_array( $i, $active_ids, TRUE ) // is active && isset( $pointer->where ) // has where && in_array( $page, (array) $pointer->where, TRUE ) // current page is in where ) { $good[] = $pointer; } } $count = count( $good ); if ( $good === 0 ) return array(); foreach( array_values( $good ) as $i => $pointer ) { $good[$i]->next = $i+1 < $count ? $good[$i+1]->id : ''; } return $good; } public function deactivation(){ /* $dismissed_pointers = explode( ',', get_user_meta( $user_id, 'dismissed_wp_pointers', true ) ); // Check if our pointer is among dismissed ones and delete that mofo if ( in_array( 'gmb_welcome_pointer', $dismissed_pointers ) ) { $key = array_search( 'gmb_welcome_pointer', $dismissed_pointers ); delete_user_meta( $user_id, 'dismissed_wp_pointers', $key['gmb_welcome_pointer'] ); } */ } }
gpl-2.0
Br3nda/indefero
src/IDF/Form/Admin/ProjectCreate.php
15653
<?php /* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* # ***** BEGIN LICENSE BLOCK ***** # This file is part of InDefero, an open source project management application. # Copyright (C) 2008 Céondo Ltd and contributors. # # InDefero 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. # # InDefero 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 # # ***** END LICENSE BLOCK ***** */ /** * Create a project. * * A kind of merge of the member configuration, overview and the * former source tab. * */ class IDF_Form_Admin_ProjectCreate extends Pluf_Form { public function initFields($extra=array()) { $choices = array(); $options = array( 'git' => __('git'), 'svn' => __('Subversion'), 'mercurial' => __('mercurial'), 'mtn' => __('monotone'), ); foreach (Pluf::f('allowed_scm', array()) as $key => $class) { $choices[$options[$key]] = $key; } $this->fields['name'] = new Pluf_Form_Field_Varchar( array('required' => true, 'label' => __('Name'), 'initial' => '', )); $this->fields['private_project'] = new Pluf_Form_Field_Boolean( array('required' => false, 'label' => __('Private project'), 'initial' => false, 'widget' => 'Pluf_Form_Widget_CheckboxInput', )); $this->fields['shortname'] = new Pluf_Form_Field_Varchar( array('required' => true, 'label' => __('Shortname'), 'initial' => '', 'help_text' => __('It must be unique for each project and composed only of letters, digits and dash (-) like "my-project".'), )); $this->fields['scm'] = new Pluf_Form_Field_Varchar( array('required' => true, 'label' => __('Repository type'), 'initial' => 'git', 'widget_attrs' => array('choices' => $choices), 'widget' => 'Pluf_Form_Widget_SelectInput', )); $this->fields['svn_remote_url'] = new Pluf_Form_Field_Varchar( array('required' => false, 'label' => __('Remote Subversion repository'), 'initial' => '', 'widget_attrs' => array('size' => '30'), )); $this->fields['svn_username'] = new Pluf_Form_Field_Varchar( array('required' => false, 'label' => __('Repository username'), 'initial' => '', 'widget_attrs' => array('size' => '15'), )); $this->fields['svn_password'] = new Pluf_Form_Field_Varchar( array('required' => false, 'label' => __('Repository password'), 'initial' => '', 'widget' => 'Pluf_Form_Widget_PasswordInput', )); $this->fields['mtn_master_branch'] = new Pluf_Form_Field_Varchar( array('required' => false, 'label' => __('Master branch'), 'initial' => '', 'help_text' => __('This should be a world-wide unique identifier for your project. A reverse DNS notation like "com.my-domain.my-project" is a good idea.'), )); $this->fields['owners'] = new Pluf_Form_Field_Varchar( array('required' => false, 'label' => __('Project owners'), 'initial' => $extra['user']->login, 'widget' => 'Pluf_Form_Widget_TextareaInput', 'widget_attrs' => array('rows' => 5, 'cols' => 40), )); $this->fields['members'] = new Pluf_Form_Field_Varchar( array('required' => false, 'label' => __('Project members'), 'initial' => '', 'widget_attrs' => array('rows' => 7, 'cols' => 40), 'widget' => 'Pluf_Form_Widget_TextareaInput', )); $projects = array('--' => '--'); foreach (Pluf::factory('IDF_Project')->getList(array('order' => 'name ASC')) as $proj) { $projects[$proj->name] = $proj->shortname; } $this->fields['template'] = new Pluf_Form_Field_Varchar( array('required' => false, 'label' => __('Project template'), 'initial' => '--', 'help_text' => __('Use the given project to initialize the new project. Access rights and general configuration will be taken from the template project.'), 'widget' => 'Pluf_Form_Widget_SelectInput', 'widget_attrs' => array('choices' => $projects), )); /** * [signal] * * IDF_Form_Admin_ProjectCreate::initFields * * [sender] * * IDF_Form_Admin_ProjectCreate * * [description] * * This signal allows an application to modify the form * for the creation of a project. * * [parameters] * * array('form' => $form) * */ $params = array('form' => $this); Pluf_Signal::send('IDF_Form_Admin_ProjectCreate::initFields', 'IDF_Form_Admin_ProjectCreate', $params); } public function clean_owners() { return IDF_Form_MembersConf::checkBadLogins($this->cleaned_data['owners']); } public function clean_members() { return IDF_Form_MembersConf::checkBadLogins($this->cleaned_data['members']); } public function clean_svn_remote_url() { $this->cleaned_data['svn_remote_url'] = (!empty($this->cleaned_data['svn_remote_url'])) ? $this->cleaned_data['svn_remote_url'] : ''; $url = trim($this->cleaned_data['svn_remote_url']); if (strlen($url) == 0) return $url; // we accept only starting with http(s):// to avoid people // trying to access the local filesystem. if (!preg_match('#^(http|https)://#', $url)) { throw new Pluf_Form_Invalid(__('Only a remote repository available throught http or https are allowed. For example "http://somewhere.com/svn/trunk".')); } return $url; } public function clean_mtn_master_branch() { // do not validate, but empty the field if a different // SCM should be used if ($this->cleaned_data['scm'] != 'mtn') return ''; $mtn_master_branch = mb_strtolower($this->cleaned_data['mtn_master_branch']); if (!preg_match('/^([\w\d]+([-][\w\d]+)*)(\.[\w\d]+([-][\w\d]+)*)*$/', $mtn_master_branch)) { throw new Pluf_Form_Invalid(__( 'The master branch is empty or contains illegal characters, '. 'please use only letters, digits, dashs and dots as separators.' )); } $sql = new Pluf_SQL('vkey=%s AND vdesc=%s', array("mtn_master_branch", $mtn_master_branch)); $l = Pluf::factory('IDF_Conf')->getList(array('filter'=>$sql->gen())); if ($l->count() > 0) { throw new Pluf_Form_Invalid(__( 'This master branch is already used. Please select another one.' )); } return $mtn_master_branch; } public function clean_shortname() { $shortname = mb_strtolower($this->cleaned_data['shortname']); if (preg_match('/[^\-A-Za-z0-9]/', $shortname)) { throw new Pluf_Form_Invalid(__('This shortname contains illegal characters, please use only letters, digits and dash (-).')); } if (mb_substr($shortname, 0, 1) == '-') { throw new Pluf_Form_Invalid(__('The shortname cannot start with the dash (-) character.')); } if (mb_substr($shortname, -1) == '-') { throw new Pluf_Form_Invalid(__('The shortname cannot end with the dash (-) character.')); } $sql = new Pluf_SQL('shortname=%s', array($shortname)); $l = Pluf::factory('IDF_Project')->getList(array('filter'=>$sql->gen())); if ($l->count() > 0) { throw new Pluf_Form_Invalid(__('This shortname is already used. Please select another one.')); } return $shortname; } public function clean() { if ($this->cleaned_data['scm'] != 'svn') { foreach (array('svn_remote_url', 'svn_username', 'svn_password') as $key) { $this->cleaned_data[$key] = ''; } } if ($this->cleaned_data['scm'] != 'mtn') { $this->cleaned_data['mtn_master_branch'] = ''; } /** * [signal] * * IDF_Form_Admin_ProjectCreate::clean * * [sender] * * IDF_Form_Admin_ProjectCreate * * [description] * * This signal allows an application to clean the form * for the creation of a project. * * [parameters] * * array('cleaned_data' => $cleaned_data) * */ $params = array('cleaned_data' => $this->cleaned_data); Pluf_Signal::send('IDF_Form_Admin_ProjectCreate::clean', 'IDF_Form_Admin_ProjectCreate', $params); return $this->cleaned_data; } public function save($commit=true) { if (!$this->isValid()) { throw new Exception(__('Cannot save the model from an invalid form.')); } $project = new IDF_Project(); $project->name = $this->cleaned_data['name']; $project->shortname = $this->cleaned_data['shortname']; if ($this->cleaned_data['template'] != '--') { // Find the template project $sql = new Pluf_SQL('shortname=%s', array($this->cleaned_data['template'])); $tmpl = Pluf::factory('IDF_Project')->getOne(array('filter' => $sql->gen())); $project->private = $tmpl->private; $project->description = $tmpl->description; } else { $project->private = $this->cleaned_data['private_project']; $project->description = __('Click on the Project Management tab to set the description of your project.'); } $project->create(); $conf = new IDF_Conf(); $conf->setProject($project); $keys = array('scm', 'svn_remote_url', 'svn_username', 'svn_password', 'mtn_master_branch'); foreach ($keys as $key) { $this->cleaned_data[$key] = (!empty($this->cleaned_data[$key])) ? $this->cleaned_data[$key] : ''; $conf->setVal($key, $this->cleaned_data[$key]); } if ($this->cleaned_data['template'] != '--') { $tmplconf = new IDF_Conf(); $tmplconf->setProject($tmpl); // We need to get all the configuration variables we want from // the old project and put them into the new project. $props = array( 'labels_download_predefined' => IDF_Form_UploadConf::init_predefined, 'labels_download_one_max' => IDF_Form_UploadConf::init_one_max, 'labels_wiki_predefined' => IDF_Form_WikiConf::init_predefined, 'labels_wiki_one_max' => IDF_Form_WikiConf::init_one_max, 'labels_issue_open' => IDF_Form_IssueTrackingConf::init_open, 'labels_issue_closed' => IDF_Form_IssueTrackingConf::init_closed, 'labels_issue_predefined' => IDF_Form_IssueTrackingConf::init_predefined, 'labels_issue_one_max' => IDF_Form_IssueTrackingConf::init_one_max, 'webhook_url' => '', 'downloads_access_rights' => 'all', 'review_access_rights' => 'all', 'wiki_access_rights' => 'all', 'source_access_rights' => 'all', 'issues_access_rights' => 'all', 'downloads_notification_email' => '', 'review_notification_email' => '', 'wiki_notification_email' => '', 'source_notification_email' => '', 'issues_notification_email' => '', ); foreach ($props as $prop => $def) { $conf->setVal($prop, $tmplconf->getVal($prop, $def)); } } $project->created(); if ($this->cleaned_data['template'] == '--') { IDF_Form_MembersConf::updateMemberships($project, $this->cleaned_data); } else { // Get the membership of the template $tmpl IDF_Form_MembersConf::updateMemberships($project, $tmpl->getMembershipData('string')); } $project->membershipsUpdated(); return $project; } /** * Check that the template project exists. */ public function clean_template() { if ($this->cleaned_data['template'] == '--') { return $this->cleaned_data['template']; } $sql = new Pluf_SQL('shortname=%s', array($this->cleaned_data['template'])); if (Pluf::factory('IDF_Project')->getOne(array('filter' => $sql->gen())) == null) { throw new Pluf_Form_Invalid(__('This project is not available.')); } return $this->cleaned_data['template']; } }
gpl-2.0
centreon/centreon
www/front_src/src/route-maps/index.js
70
import reactRoutes from './reactRoutes'; export default reactRoutes;
gpl-2.0
Nexus-Mods/Nexus-Mod-Manager
NexusClient/ModAuthoring/UI/Controls/ModFilesTreeView.Designer.cs
7151
namespace Nexus.Client.ModAuthoring.UI.Controls { partial class ModFilesTreeView { /// <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 Component 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(); this.panel3 = new System.Windows.Forms.Panel(); this.label1 = new System.Windows.Forms.Label(); this.ofdFileChooser = new System.Windows.Forms.OpenFileDialog(); this.fbdFolderChooser = new System.Windows.Forms.FolderBrowserDialog(); this.toolStrip1 = new System.Windows.Forms.ToolStrip(); this.ftvSource = new Nexus.UI.Controls.VirtualFileSystemTreeView(); this.tspAddFiles = new System.Windows.Forms.ToolStripButton(); this.tspAddFilteredFiles = new System.Windows.Forms.ToolStripButton(); this.tsbAddFolder = new System.Windows.Forms.ToolStripButton(); this.tsbDelete = new System.Windows.Forms.ToolStripButton(); this.panel3.SuspendLayout(); this.toolStrip1.SuspendLayout(); this.SuspendLayout(); // // panel3 // this.panel3.Controls.Add(this.label1); this.panel3.Dock = System.Windows.Forms.DockStyle.Top; this.panel3.Location = new System.Drawing.Point(0, 0); this.panel3.Name = "panel3"; this.panel3.Size = new System.Drawing.Size(398, 20); this.panel3.TabIndex = 2; // // label1 // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label1.Location = new System.Drawing.Point(3, 3); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(61, 13); this.label1.TabIndex = 0; this.label1.Text = "Mod Files"; // // ofdFileChooser // this.ofdFileChooser.Multiselect = true; this.ofdFileChooser.RestoreDirectory = true; // // fbdFolderChooser // this.fbdFolderChooser.RootFolder = System.Environment.SpecialFolder.MyComputer; // // toolStrip1 // this.toolStrip1.ImageScalingSize = new System.Drawing.Size(32, 32); this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.tspAddFiles, this.tspAddFilteredFiles, this.tsbAddFolder, this.tsbDelete}); this.toolStrip1.Location = new System.Drawing.Point(0, 20); this.toolStrip1.Name = "toolStrip1"; this.toolStrip1.Size = new System.Drawing.Size(398, 39); this.toolStrip1.TabIndex = 1; this.toolStrip1.Text = "toolStrip1"; // // ftvSource // this.ftvSource.AllowDrop = true; this.ftvSource.Cursor = System.Windows.Forms.Cursors.Default; this.ftvSource.Dock = System.Windows.Forms.DockStyle.Fill; this.ftvSource.HideSelection = false; this.ftvSource.ImageIndex = 0; this.ftvSource.LabelEdit = true; this.ftvSource.Location = new System.Drawing.Point(0, 59); this.ftvSource.Name = "ftvSource"; this.ftvSource.SelectedImageIndex = 0; this.ftvSource.Size = new System.Drawing.Size(398, 350); this.ftvSource.Sorted = true; this.ftvSource.TabIndex = 2; // // tspAddFiles // this.tspAddFiles.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.tspAddFiles.Image = global::Nexus.Client.Properties.Resources.AddFile_48x48; this.tspAddFiles.ImageTransparentColor = System.Drawing.Color.Magenta; this.tspAddFiles.Name = "tspAddFiles"; this.tspAddFiles.Size = new System.Drawing.Size(36, 36); this.tspAddFiles.Text = "Add Files..."; this.tspAddFiles.Click += new System.EventHandler(this.tspAddFiles_Click); // // tspAddFilteredFiles // this.tspAddFilteredFiles.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.tspAddFilteredFiles.Image = global::Nexus.Client.Properties.Resources.add_filtered_file_48x48; this.tspAddFilteredFiles.ImageTransparentColor = System.Drawing.Color.Magenta; this.tspAddFilteredFiles.Name = "tspAddFilteredFiles"; this.tspAddFilteredFiles.Size = new System.Drawing.Size(36, 36); this.tspAddFilteredFiles.Text = "Add Filtered Files..."; this.tspAddFilteredFiles.Click += new System.EventHandler(this.tspAddFilteredFiles_Click); // // tsbAddFolder // this.tsbAddFolder.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.tsbAddFolder.Image = global::Nexus.Client.Properties.Resources.AddFolder_48x48; this.tsbAddFolder.ImageTransparentColor = System.Drawing.Color.Magenta; this.tsbAddFolder.Name = "tsbAddFolder"; this.tsbAddFolder.Size = new System.Drawing.Size(36, 36); this.tsbAddFolder.Text = "Add Folder..."; this.tsbAddFolder.Click += new System.EventHandler(this.tsbAddFolder_Click); // // tsbDelete // this.tsbDelete.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.tsbDelete.Image = global::Nexus.Client.Properties.Resources.edit_delete_6; this.tsbDelete.ImageTransparentColor = System.Drawing.Color.Magenta; this.tsbDelete.Name = "tsbDelete"; this.tsbDelete.Size = new System.Drawing.Size(36, 36); this.tsbDelete.Text = "Delete"; this.tsbDelete.ToolTipText = "Delete Selected Files"; this.tsbDelete.Click += new System.EventHandler(this.tsbDelete_Click); // // ModFilesTreeView // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.ftvSource); this.Controls.Add(this.toolStrip1); this.Controls.Add(this.panel3); this.Name = "ModFilesTreeView"; this.Size = new System.Drawing.Size(398, 409); this.panel3.ResumeLayout(false); this.panel3.PerformLayout(); this.toolStrip1.ResumeLayout(false); this.toolStrip1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Label label1; private System.Windows.Forms.Panel panel3; private System.Windows.Forms.OpenFileDialog ofdFileChooser; private System.Windows.Forms.FolderBrowserDialog fbdFolderChooser; private Nexus.UI.Controls.VirtualFileSystemTreeView ftvSource; private System.Windows.Forms.ToolStrip toolStrip1; private System.Windows.Forms.ToolStripButton tspAddFiles; private System.Windows.Forms.ToolStripButton tspAddFilteredFiles; private System.Windows.Forms.ToolStripButton tsbAddFolder; private System.Windows.Forms.ToolStripButton tsbDelete; } }
gpl-2.0
TheTypoMaster/calligra
plugins/karbonplugins/filtereffects/ComponentTransferEffectFactory.cpp
1468
/* This file is part of the KDE project * Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #include "ComponentTransferEffectFactory.h" #include "ComponentTransferEffect.h" #include "ComponentTransferEffectConfigWidget.h" #include <klocalizedstring.h> ComponentTransferEffectFactory::ComponentTransferEffectFactory() : KoFilterEffectFactoryBase(ComponentTransferEffectId, i18n("Component transfer")) { } KoFilterEffect * ComponentTransferEffectFactory::createFilterEffect() const { return new ComponentTransferEffect(); } KoFilterEffectConfigWidgetBase * ComponentTransferEffectFactory::createConfigWidget() const { return new ComponentTransferEffectConfigWidget(); }
gpl-2.0
rjbaniel/upoor
wp-content/themes/Foxy/woocommerce/single-product/related.php
1116
<?php /** * Related Products * * @author WooThemes * @package WooCommerce/Templates * @version 1.6.4 */ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly global $product, $woocommerce_loop; $related = $product->get_related(); if ( sizeof( $related ) == 0 ) return; $args = apply_filters('woocommerce_related_products_args', array( 'post_type' => 'product', 'ignore_sticky_posts' => 1, 'no_found_rows' => 1, 'posts_per_page' => $posts_per_page, 'orderby' => $orderby, 'post__in' => $related, 'post__not_in' => array($product->id) ) ); $products = new WP_Query( $args ); $woocommerce_loop['columns'] = $columns; if ( $products->have_posts() ) : ?> <div class="related products"> <h2><?php _e('Related Products', 'woocommerce'); ?></h2> <ul class="et-products"> <?php while ( $products->have_posts() ) : $products->the_post(); ?> <?php woocommerce_get_template_part( 'content', 'product' ); ?> <?php endwhile; // end of the loop. ?> </ul> </div> <?php endif; wp_reset_postdata();
gpl-2.0
thomas-moulard/visp-deb
example/math/exponentialMap.cpp
3675
/**************************************************************************** * * $Id: exponentialMap.cpp 4056 2013-01-05 13:04:42Z fspindle $ * * This file is part of the ViSP software. * Copyright (C) 2005 - 2013 by INRIA. All rights reserved. * * This software is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * ("GPL") version 2 as published by the Free Software Foundation. * See the file LICENSE.txt at the root directory of this source * distribution for additional information about the GNU GPL. * * For using ViSP with software that can not be combined with the GNU * GPL, please contact INRIA about acquiring a ViSP Professional * Edition License. * * See http://www.irisa.fr/lagadic/visp/visp.html for more information. * * This software was developed at: * INRIA Rennes - Bretagne Atlantique * Campus Universitaire de Beaulieu * 35042 Rennes Cedex * France * http://www.irisa.fr/lagadic * * If you have questions regarding the use of this file, please contact * INRIA at visp@inria.fr * * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * * Description: * Test some vpColVector functionalities. * * Authors: * Eric Marchand * *****************************************************************************/ /*! \example exponentialMap.cpp Test some vpExponentialMap functionalities. */ #include <visp/vpTranslationVector.h> #include <visp/vpRotationVector.h> #include <visp/vpThetaUVector.h> #include <visp/vpRxyzVector.h> #include <visp/vpColVector.h> #include <visp/vpHomogeneousMatrix.h> #include <visp/vpExponentialMap.h> int main() { vpTranslationVector t; t[0] = 0.1; // t_x in m/s t[1] = 0.2f; // t_y in m/s t[2] = 0.f; // t_z in m/s vpRxyzVector rxyz; rxyz[0] = vpMath::rad(0.f); // r_x in rad/s rxyz[1] = vpMath::rad(0.f); // r_y in rad/s rxyz[2] = vpMath::rad(90.f); // r_z in rad/s // Build a ThetaU rotation vector from a Rxyz vector vpThetaUVector tu; tu.buildFrom(rxyz); vpColVector v(6); // Velocity vector [t, thetaU]^t v[0] = t[0]; // t_x v[1] = t[1]; // t_y v[2] = t[2]; // t_z v[3] = tu[0]; // ThetaU_x v[4] = tu[1]; // ThetaU_y v[5] = tu[2]; // ThetaU_z std::cout << "Considered velocity : \n" << v << std::endl; vpHomogeneousMatrix M; // Compute the displacement from the velocity applied during 1 second M = vpExponentialMap::direct(v); { // Extract translation from homogenous matrix vpTranslationVector dt; // translation displacement M.extract(dt); // Extract rotation from homogenous matrix vpRotationMatrix R; M.extract(R); vpRxyzVector drxyz(R); // rotational displacement std::cout << "Displacement if velocity is applied during 1 s : \n" << dt << " " << drxyz << std::endl; } // Compute the displacement from the velocity applied during 2 seconds M = vpExponentialMap::direct(v, 2.f); { // Extract translation from homogenous matrix vpTranslationVector dt; // translation displacement M.extract(dt); // Extract rotation from homogenous matrix vpRotationMatrix R; M.extract(R); vpRxyzVector drxyz(R); // rotational displacement std::cout << "Displacement if velocity is applied during 2 s : \n" << dt << " " << drxyz << std::endl; } // Compute the velocity from the displacement observed during 2 seconds v = vpExponentialMap::inverse(M, 2.f); std::cout << "Velocity from displacement observed during 2 s: \n" << v << std::endl; }
gpl-2.0
soynerdito/GeoCarDroid
gen/com/geocar/geocarconnect/R.java
5970
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package com.geocar.geocarconnect; public final class R { public static final class array { public static final int entries_list_preference=0x7f050000; public static final int entryvalues_list_preference=0x7f050001; } public static final class attr { } public static final class dimen { /** Default screen margins, per the Android Design guidelines. Customize dimensions originally defined in res/values/dimens.xml (such as screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here. */ public static final int activity_horizontal_margin=0x7f060000; public static final int activity_vertical_margin=0x7f060001; } public static final class drawable { public static final int connect300=0x7f020000; public static final int connect_button=0x7f020001; public static final int connect_press=0x7f020002; public static final int disconnect=0x7f020003; public static final int disconnect_button=0x7f020004; public static final int disconnect_press=0x7f020005; public static final int ic_app_logo=0x7f020006; public static final int ic_launcher=0x7f020007; public static final int main_logo=0x7f020008; } public static final class id { public static final int action_settings=0x7f0a0008; public static final int button2=0x7f0a0006; public static final int ibConnect=0x7f0a0004; public static final int imageView1=0x7f0a0003; public static final int pager=0x7f0a0000; public static final int pager_title_strip=0x7f0a0001; public static final int pbLoading=0x7f0a0007; public static final int section_label=0x7f0a0002; public static final int tvStatus=0x7f0a0005; } public static final class layout { public static final int activity_main=0x7f030000; public static final int fragment_main_dummy=0x7f030001; public static final int start_menu=0x7f030002; } public static final class menu { public static final int main=0x7f090000; } public static final class string { public static final int action_settings=0x7f070001; public static final int app_name=0x7f070000; public static final int dialog_based_preferences=0x7f07000d; public static final int dialog_title_edittext_preference=0x7f070009; public static final int dialog_title_list_preference=0x7f070012; public static final int inline_preferences=0x7f07000c; public static final int launch_preferences=0x7f07000e; public static final int loading=0x7f070005; public static final int preference_attributes=0x7f07000f; public static final int press_to_start=0x7f070006; public static final int security_code=0x7f070020; public static final int summary_checkbox_preference=0x7f07000b; public static final int summary_child_preference=0x7f07001f; public static final int summary_edittext_security_code=0x7f070008; public static final int summary_enable_sms_security=0x7f07001d; public static final int summary_fragment_preference=0x7f070014; public static final int summary_intent_preference=0x7f070016; public static final int summary_list_preference=0x7f070011; public static final int summary_my_preference=0x7f070018; public static final int summary_off_advanced_toggle_preference=0x7f07001b; public static final int summary_on_advanced_toggle_preference=0x7f07001a; public static final int title_advanced_toggle_preference=0x7f070019; public static final int title_checkbox_preference=0x7f07000a; public static final int title_child_preference=0x7f07001e; public static final int title_edittext_preference=0x7f070007; public static final int title_enable_sms_security=0x7f07001c; public static final int title_fragment_preference=0x7f070013; public static final int title_intent_preference=0x7f070015; public static final int title_list_preference=0x7f070010; public static final int title_my_preference=0x7f070017; public static final int title_section1=0x7f070002; public static final int title_section2=0x7f070003; public static final int title_section3=0x7f070004; public static final int title_security_code=0x7f070021; } public static final class style { /** Base application theme, dependent on API level. This theme is replaced by AppBaseTheme from res/values-vXX/styles.xml on newer devices. Theme customizations available in newer API levels can go in res/values-vXX/styles.xml, while customizations related to backward-compatibility can go here. Base application theme for API 11+. This theme completely replaces AppBaseTheme from res/values/styles.xml on API 11+ devices. API 11 theme customizations can go here. Base application theme for API 14+. This theme completely replaces AppBaseTheme from BOTH res/values/styles.xml and res/values-v11/styles.xml on API 14+ devices. API 14 theme customizations can go here. */ public static final int AppBaseTheme=0x7f080000; /** Application theme. All customizations that are NOT specific to a particular API-level can go here. */ public static final int AppTheme=0x7f080001; } public static final class xml { public static final int preferences=0x7f040000; } }
gpl-2.0
SomeoddpilotInc/lohand
test/trimRight.js
338
import {trimRight} from './../lib/helpers'; import {expect} from 'chai'; describe('trimRight', function () { it('should trimRight text', function () { expect(trimRight(' abc ')).to.equal(' abc'); expect(trimRight('-_-abc-_-', '_-')).to.equal('-_-abc'); expect(trimRight('-_-abc-_-')).to.equal('-_-abc-_-'); }); });
gpl-2.0
kepstin/picard
picard/util/mimetype.py
2002
# -*- coding: utf-8 -*- # # Picard, the next-generation MusicBrainz tagger # Copyright (C) 2009 Philipp Wolfer # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. import os MIME_TYPE_EXTENSION_MAP = { 'image/jpeg': '.jpg', 'image/png': '.png', 'image/gif': '.gif', 'image/tiff': '.tiff', } EXTENSION_MIME_TYPE_MAP = dict([(b, a) for a, b in MIME_TYPE_EXTENSION_MAP.items()]) def get_from_data(data, filename=None, default=None): """Tries to determine the mime type from the given data.""" if data.startswith('\xff\xd8\xff'): return 'image/jpeg' elif data.startswith('\x89PNG\x0d\x0a\x1a\x0a'): return 'image/png' elif data.startswith('GIF87a') or data.startswith('GIF89a'): return 'image/gif' elif data.startswith('MM\x00*') or data.startswith('II*\x00'): return 'image/tiff' elif filename: return get_from_filename(filename, default) else: return default def get_from_filename(filename, default=None): """Tries to determine the mime type from the given filename.""" name, ext = os.path.splitext(os.path.basename(filename)) return EXTENSION_MIME_TYPE_MAP.get(ext, default) def get_extension(mimetype, default=None): """Returns the file extension for a given mime type.""" return MIME_TYPE_EXTENSION_MAP.get(mimetype, default)
gpl-2.0
sanyogs/camptix-indian-payments
campt-indian-payment-gateway.php
5256
<?php /** * Plugin Name: CampTix Indian Payments * Plugin URI: https://github.com/wpindiaorg/camptix-indian-payments * Description: Simple and Flexible payment ticketing for Camptix using Indian Payment Platforms * Author: India WordPress Community * Author URI: https://github.com/wpindiaorg/ * Version: 1.5 * License: GPLv2 or later * Text Domain: campt-indian-payment-gateway * Domain Path: /languages * GitHub Plugin URI: https://github.com/wpindiaorg/camptix-indian-payments */ if ( ! defined( 'ABSPATH' ) ) { exit; } // Exit if accessed directly class Camptix_Indian_Payments { /** * Instance. * * @since * @access static * @var */ static private $instance; /** * Singleton pattern. * * @since * @access private */ private function __construct() { } /** * Get instance. * * @since * @access static * @return static */ static function get_instance() { if ( null === static::$instance ) { self::$instance = new static(); } return self::$instance; } /** * Setup plugin. * * @since 1.0 * @access public */ public function setup() { $this->setup_contants(); $this->load_files(); $this->setup_hooks(); } /** * Setup hooks * * @since 1.0 * @access private */ private function setup_hooks() { // Add INR currency add_filter( 'camptix_currencies', array( $this, 'add_inr_currency' ) ); // Load the Instamojo Payment Method add_action( 'camptix_load_addons', array( $this, 'load_payment_methods' ) ); // Load scripts ans styles. add_action( 'wp_enqueue_scripts', array( $this, 'enqueue' ) ); //Load languages add_action( 'plugins_loaded', array($this, 'camptindian_load_textdomain') ); } /** * Setup constants * * @since 1.0 * @access private */ private function setup_contants() { // Definitions define( 'CAMPTIX_INDIAN_PAYMENTS_VERSION', '1.5' ); define( 'CAMPTIX_MULTI_DIR', plugin_dir_path( __FILE__ ) ); define( 'CAMPTIX_MULTI_URL', plugin_dir_url( __FILE__ ) ); } /** * Load plugin textdomain. * * @since 1.0.0 */ private function camptindian_load_textdomain() { load_plugin_textdomain( 'campt-indian-payment-gateway', false, basename( dirname( __FILE__ ) ) . '/languages/' ); } /** * Setup constants * * @since 1.0 * @access private */ private function load_files() { require_once CAMPTIX_MULTI_DIR . 'inc/class-camptix-payment-methods.php'; } /** * Add indian currency. * * @since 1.0 * @access public * * @param $currencies * * @return mixed */ public function add_inr_currency( $currencies ) { $currencies['INR'] = array( 'label' => __( 'Indian Rupees', 'campt-indian-payment-gateway' ), 'format' => '₹ %s', ); return $currencies; } /** * Register payment gateways * * @since 1.0 * @access public */ public function load_payment_methods() { $payment_gateways = array( array( 'class' => 'CampTix_Payment_Method_Instamojo', 'file_path' => plugin_dir_path( __FILE__ ) . 'inc/instamojo/class-camptix-payment-method-instamojo.php', ), array( 'class' => 'CampTix_Payment_Method_RazorPay', 'file_path' => plugin_dir_path( __FILE__ ) . 'inc/razorpay/class-camptix-payment-method-razorpay.php', ), ); foreach ( $payment_gateways as $gateway ) { if ( ! class_exists( $gateway['class'] ) ) { require_once $gateway['file_path']; } camptix_register_addon( $gateway['class'] ); } } /** * Load scripts and styles * * @since 1.0 * @access public */ public function enqueue() { // Bailout. if ( ! isset( $_GET['tix_action'] ) || ( 'attendee_info' !== $_GET['tix_action'] ) ) { return; } wp_register_script( 'camptix-indian-payments-main-js', CAMPTIX_MULTI_URL . 'assets/js/camptix-multi-popup.js', array( 'jquery' ), false, CAMPTIX_INDIAN_PAYMENTS_VERSION ); wp_enqueue_script( 'camptix-indian-payments-main-js' ); $data = apply_filters( 'camptix_indian_payments_localize_vars', array( 'errors' => array( 'phone' => __( 'Please fill in all required fields.', 'campt-indian-payment-gateway' ), ), ) ); wp_localize_script( 'camptix-indian-payments-main-js', 'camptix_inr_vars', $data ); } } /** * Initialize plugin. * * @since 1.0 */ function cip_init() { if ( class_exists( 'CampTix_Plugin' ) ) { Camptix_Indian_Payments::get_instance()->setup(); } } // Check if PHP current version is greater then 5.3. if ( version_compare( phpversion(), '5.3', '>=' ) ) { add_action( 'plugins_loaded', 'cip_init', 9999 ); } else { if ( defined( 'WP_CLI' ) ) { WP_CLI::warning( _cip_php_version_text() ); } else { add_action( 'admin_notices', '_cip_php_version_error' ); } } /** * Admin notice for incompatible versions of PHP. * * @since 1.0 */ function _cip_php_version_error() { printf( '<div class="error"><p>%s</p></div>', esc_html( _cip_php_version_text() ) ); } /** * String describing the minimum PHP version. * * @since 1.0 * * @return string */ function _cip_php_version_text() { return __( 'CampTix Indian Payments plugin error: Your version of PHP is too old to run this plugin. You must be running PHP 5.3 or higher.', 'campt-indian-payment-gateway' ); }
gpl-2.0
lloydsaldanha/WebMowgli
mowgli/application/modules/admin/views/includes/sidebar.php
2752
<!-- <div id="sidebar-label"> <div class="left_arrow" title="Hide Sidebar">&#x25C0;</div> <div class="right_arrow" title="Show Sidebar">&#x25B6;</div> </div> --> <div id="sidebar" class="sidebar-nav"> <!-- <div id="pin-holder" class="pin-holder unpinned"></div> <a href="{sidebar:logo_url}" target="_blank"><div class="header">{sidebar:logo}</div></a> <div class="welcome-msg">Howdy {admin:user}</div> <div class="site-links"> <a href="{site:root}">Site</a> &bull; <a href="{site:root}/admin/dashboard">Dashboard</a> &bull; <a href="{site:root}/user/logout">Logout</a> <br/><br/> <a href="{site:root}/user/change_password">Change password</a> </div> --> <!-- Accordion Menu --> <ul id="main-nav" class="menu-{active-module}"> {sidebar:menu} <li class="sub-nav-item"><!-- Add the class "current" to current menu item --> <a href="{sidebar:menu:uri}" class="nav-top-item menu-{module}" title="{sidebar:menu:description}" > <!-- Add the class "no-submenu" to menu items with no sub menu --> <i class="icon-plus-sign" style="padding-right:8px;"></i> {sidebar:menu:name} <!-- Module Icon ( hidden temporarily ) --> <!-- <div class="icon" style="background:url({module:icon}) no-repeat scroll 0 0 transparent;background-position:0 -65px; "></div>--> </a> <ul class="nav-sub-item-grp" > {sidebar:menu:sub} <li><a class="nav-sub-item" href="{sidebar:menu:sub:uri}" title="{sidebar:menu:sub:description}" >{sidebar:menu:sub:name}</a></li> {/sidebar:menu:sub} </ul> </li> {/sidebar:menu} </ul><!--end Accordion Menu--> <!-- <div class="footer">t <p style="color: black;"> <br/><br/><br/> execution time : {elapsed_time}<br/> memory used : {memory_usage}<br/> <?php // echo $this->benchmark->memory_usage(); ?> </p> <p align="left">Copyright 2012 &copy; <a href="http://encube.co.in" target='_blank'>encube.co.in</a></p> </div>--> </div><!-- end Sidebar --> <!-- {sidebar:menu} {sidebar:menu:module_name} {sidebar:menu:sub} {sidebar:menu:sub:link} {sidebar:menu:sub:name} {/sidebar:menu:sub} {/sidebar:menu} -->
gpl-2.0
Tlahui/TlahuiAPI
application/models/UserModel.php
1475
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class UserModel extends CI_Model { /** * Modelo definido para interactuar con la tabla "User" * */ public function __construct() { // Call the Model constructor parent::__construct(); //Connect to database $this->load->database(); } /** * Listado de usuarios * * Obtiene un array con los registros de la tabla user * y en caso que no exista devuelve false * * @author Feli * @return Array|boolean */ public function listar() { $this->db->select("id, correoElectronico, usuario, password, nombre, fechaNacimiento, direccion, telefono, admin"); $user = $this->db->get("user")->result(); return $user; } public function update($userID,$user) { $this->db->where("id",$userID); $found = $this->db->get("user")->row(); if ( $found ) { $this->db->where("id",$userID); $this->db->update("user",$user); return true; } else { return false; } } public function deleteUser($userID) { $this->db->where("id",$userID); $found = $this->db->get("user")->row(); if ($found){ $this->db->where("id",$userID); $this->db->delete("user"); return true; } else { return false; } } }
gpl-2.0
hitlic/SimPage
SimPage.js
7170
/** * @Author: liuchen * * ----------------------------------------- 使用说明 (1)-(6) ------------------------------------------- * * (1)后端使用mybatis的pagehelper插件; * (2)后端使用 pagehelper 的 PageHelper.startPage(pageNum, pageSize) 方法; * (3)服务器返回 paehelper的PageInfo的JSON对象; * (4)CSS样式设置同 bootstrap 分页组件的样式设置一致; * (5)例: <!-- JS代码 --> var sp=$("#pagePanel").SimPage({ url: '/ajax/route/route_routePage', //*2* ajax访问的『url』 requestNameOfPageNum:'pageNum', //*3* 『request中的参数名』, 默认为'pageNum', // 用于从request中获取PageHelper.startPage(pageNum, pageSize)的参数pageNum requestNameOfPageSize:'pageSize', //*4* 『request中的参数名』, 默认为'pageSize', // 用于从request中获取PageHelper.startPage(pageNum, pageSize)的参数pageSize pageSize:10, //*5* 『页面大小』,默认值10 data:{ }, //*6* ajax访问的『其他参数』 method:'post', //*7* 『请求方法』,默认为 post, 如果为 get 则上述参数也可放在url中 length:10, //*8* 页码面板中显示的『页码数量』,默认值10 onPageChange:function(page){ //*9* 『回调函数』,页面切换时返回的页面数据 alert(page['pageNum']); alert(page['pageSize']); alert(page['size']); alert(page['startRow']); alert(page['endRow']); alert(page['total']); alert(page['pages']); alert(page['list']); //数据列表 } }); <!-- HTML代码 --> <div id="pagePanel"></div> //存放页码面板的『容器id』 * (6)重要函数 sp.refresh(pageNum, data) //** 刷新页面,使用场景:页面删除、修改或添加一条记录后刷新页面 // pageNum为要显示的页面,默认为当前页面, data为ajax的访问数据, 含意同(5)中的 data // 该函数的两个参数在页面面要变动时使用,例:删除记录、输入检索条件进行搜索 * ----------------------------------------------------------------------------------------------------------------------- **/ ;(function($, window, document, undefined){ $.fn.SimPage=function(options){ if(!options["url"]){ alert("A ajax url is needed!"); return; } return new SimPage(this,options); }; var SimPage=function($container,options){ this.$container = $container; this.settings={//默认值 requestNameOfPageNum:'pageNum', requestNameOfPageSize:'pageSize', pageSize:10, data:{ }, method:'post', length:10, onPageChange:function(page){} }; $.extend(this.settings,options); this.startPage=1; this.endPage=this.settings['length']; //this.createPage(1); this.currentPage=1; }; SimPage.prototype = { /** * 根据url及参数,ajax访问,创建页面 */ createPage : function(pageNum){ var params= $.extend({},this.settings["data"]); params[this.settings['requestNameOfPageNum']]=pageNum; params[this.settings['requestNameOfPageSize']]=this.settings['pageSize']; var sp=this; $.ajax({ url:this.settings['url'], type:this.settings['method'], data: params, dataType:"json", success:function (pageInfo){ sp.createPanel(pageInfo); var userfunc=sp.settings['onPageChange']; userfunc(pageInfo); }, error:function(request,message,error){ alert("Server errors happend:"+message); } }); }, /** * 创建页码面板,绑定事件 */ createPanel : function(pageInfo){ var totalPage=pageInfo['pages']; var currentPage=pageInfo['pageNum']; this.currentPage=currentPage; var length=this.settings['length']; /**调整页码显示*/ if(pageInfo['pages']==0 || pageInfo['pages']==null){ this.endPage=0; }else{ if(currentPage==1){ this.startPage=1; this.endPage=length<pageInfo['pages']?length:pageInfo['pages']; } if(currentPage==pageInfo['pages']){ this.startPage=pageInfo['pages']-length+1; this.endPage=pageInfo['pages']; } } if(currentPage==this.startPage){ this.startPage = currentPage-parseInt(length/2); if(this.startPage<=1) this.startPage=1; this.endPage=this.startPage+length-1; if (this.endPage>=pageInfo['pages']) this.endPage=pageInfo['pages']; }else if(this.endPage==currentPage){ this.endPage = currentPage+parseInt(length/2); if(this.endPage>=pageInfo['pages']) this.endPage=pageInfo['pages']; this.startPage=this.endPage-length+1; if(this.startPage<=1) this.startPage=1; } /**创建页码面板*/ var html="<nav> <ul class='pagination'> <li> <a href='javascript:;' aria-label='First'> <span aria-hidden='true'>首页</span> </a> </li> <li> <a href='javascript:;' aria-label='Previous'> <span aria-hidden='true'>上页</span> </a> </li>"; for(var i=this.startPage;i<=this.endPage;i++){ if(currentPage==i){ html+="<li class='active'> <span>"+i+"<span class='sr-only'>(current)</span></span> </li>"; }else{ html+="<li><a href='javascript:;' page='"+i+"'>"+i+"</a></li>"; } } html+="<li> <a href='javascript:;' aria-label='Next'> <span aria-hidden='true'>下页</span> </a> </li> <li> <a href='javascript:;' aria-label='Last'> <span aria-hidden='true'>尾页</span> </a> </li> </ul> </nav>"; this.$container.html(html); sp=this; //绑定页码点击事件 this.$container.find("[page]").click(function(){ sp.createPage($(this).attr('page')); }); //绑定首页点击事件 this.$container.find("a[aria-label='First']").click(function(){ sp.createPage(1); }); //绑定上页点击事件 this.$container.find("a[aria-label='Previous']").click(function(){ if(currentPage>1){ sp.createPage(currentPage-1); } }); //绑定下页点击事件 this.$container.find("a[aria-label='Next']").click(function(){ if(currentPage<totalPage){ sp.createPage(currentPage+1); } }); //绑定尾页点击事件 this.$container.find("a[aria-label='Last']").click(function(){ sp.createPage(totalPage); }); }, /** * 刷新页面 * @pageNum: 要显示的页面,默认为当前页面 * @data: ajax访问的其他条件,默认为null,该参数在动态添加检索条件时用,例:页面有过滤功能时 * */ refresh : function(pageNum, data){ if(data!=null) this.settings['data']=data; if(pageNum==null) this.createPage(this.currentPage); else this.createPage(pageNum); } }; })($,window,document);
gpl-2.0
ssj-gz/emscripten-kdelibs
kio/tests/jobtest.cpp
50520
/* This file is part of the KDE project Copyright (C) 2004-2006 David Faure <faure@kde.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "qtest_kde.h" #include "jobtest.h" #include <config.h> #include <kurl.h> #include <kio/netaccess.h> #include <kio/previewjob.h> #include <kdebug.h> #include <klocale.h> #include <kcmdlineargs.h> #include <QtCore/QFileInfo> #include <QtCore/QEventLoop> #include <QtCore/QDir> #include <QtCore/QHash> #include <QtCore/QVariant> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <time.h> #include <sys/time.h> #include <sys/types.h> #include <kprotocolinfo.h> #include <kio/scheduler.h> #include <kio/directorysizejob.h> #include <kio/copyjob.h> #include <kio/deletejob.h> #include "kiotesthelper.h" // createTestFile etc. QTEST_KDEMAIN( JobTest, NoGUI ) // The code comes partly from kdebase/kioslave/trash/testtrash.cpp static QString otherTmpDir() { #ifdef Q_WS_WIN return QDir::tempPath() + "/jobtest/"; #else // This one needs to be on another partition return "/tmp/jobtest/"; #endif } #if 0 static KUrl systemTmpDir() { #ifdef Q_WS_WIN return KUrl( "system:" + QDir::homePath() + "/.kde-unit-test/jobtest-system/" ); #else return KUrl( "system:/home/.kde-unit-test/jobtest-system/" ); #endif } static QString realSystemPath() { return QFile::decodeName( getenv( "KDEHOME" ) ) + "/jobtest-system/"; } #endif Q_DECLARE_METATYPE(KIO::Job*) void JobTest::initTestCase() { s_referenceTimeStamp = QDateTime::currentDateTime().addSecs( -30 ); // 30 seconds ago // Start with a clean base dir cleanupTestCase(); homeTmpDir(); // create it if ( !QFile::exists( otherTmpDir() ) ) { bool ok = QDir().mkdir( otherTmpDir() ); if ( !ok ) kFatal() << "Couldn't create " << otherTmpDir(); } #if 0 if ( KProtocolInfo::isKnownProtocol( "system" ) ) { if ( !QFile::exists( realSystemPath() ) ) { bool ok = dir.mkdir( realSystemPath() ); if ( !ok ) kFatal() << "Couldn't create " << realSystemPath(); } } #endif qRegisterMetaType<KJob*>("KJob*"); qRegisterMetaType<KIO::Job*>("KIO::Job*"); qRegisterMetaType<KUrl>("KUrl"); qRegisterMetaType<time_t>("time_t"); } static void delDir(const QString& pathOrUrl) { KIO::Job* job = KIO::del(KUrl(pathOrUrl), KIO::HideProgressInfo); job->setUiDelegate(0); KIO::NetAccess::synchronousRun(job, 0); } void JobTest::cleanupTestCase() { delDir( homeTmpDir() ); delDir( otherTmpDir() ); #if 0 if ( KProtocolInfo::isKnownProtocol( "system" ) ) { delDir(systemTmpDir()); } #endif } void JobTest::enterLoop() { QEventLoop eventLoop; connect(this, SIGNAL(exitLoop()), &eventLoop, SLOT(quit())); eventLoop.exec(QEventLoop::ExcludeUserInputEvents); } void JobTest::storedGet() { kDebug() ; const QString filePath = homeTmpDir() + "fileFromHome"; createTestFile( filePath ); KUrl u( filePath ); m_result = -1; KIO::StoredTransferJob* job = KIO::storedGet( u, KIO::NoReload, KIO::HideProgressInfo ); QSignalSpy spyPercent(job, SIGNAL(percent(KJob*,ulong))); QVERIFY(spyPercent.isValid()); job->setUiDelegate( 0 ); connect( job, SIGNAL(result(KJob*)), this, SLOT(slotGetResult(KJob*)) ); enterLoop(); QCOMPARE( m_result, 0 ); // no error QCOMPARE( m_data, QByteArray("Hello\0world", 11) ); QCOMPARE( m_data.size(), 11 ); QVERIFY(!spyPercent.isEmpty()); } void JobTest::slotGetResult( KJob* job ) { m_result = job->error(); m_data = static_cast<KIO::StoredTransferJob *>(job)->data(); emit exitLoop(); } void JobTest::put() { const QString filePath = homeTmpDir() + "fileFromHome"; KUrl u(filePath); KIO::TransferJob* job = KIO::put( u, 0600, KIO::Overwrite | KIO::HideProgressInfo ); QDateTime mtime = QDateTime::currentDateTime().addSecs( -30 ); // 30 seconds ago mtime.setTime_t(mtime.toTime_t()); // hack for losing the milliseconds job->setModificationTime(mtime); job->setUiDelegate( 0 ); connect( job, SIGNAL(result(KJob*)), this, SLOT(slotResult(KJob*)) ); connect( job, SIGNAL(dataReq(KIO::Job*,QByteArray&)), this, SLOT(slotDataReq(KIO::Job*,QByteArray&)) ); m_result = -1; m_dataReqCount = 0; enterLoop(); QVERIFY( m_result == 0 ); // no error QFileInfo fileInfo(filePath); QVERIFY(fileInfo.exists()); QCOMPARE(fileInfo.size(), 30LL); // "This is a test for KIO::put()\n" QCOMPARE((int)fileInfo.permissions(), (int)(QFile::ReadOwner | QFile::WriteOwner | QFile::ReadUser | QFile::WriteUser )); QCOMPARE(fileInfo.lastModified(), mtime); } void JobTest::slotDataReq( KIO::Job*, QByteArray& data ) { // Really not the way you'd write a slotDataReq usually :) switch(m_dataReqCount++) { case 0: data = "This is a test for "; break; case 1: data = "KIO::put()\n"; break; case 2: data = QByteArray(); break; } } void JobTest::slotResult( KJob* job ) { m_result = job->error(); emit exitLoop(); } void JobTest::storedPut() { const QString filePath = homeTmpDir() + "fileFromHome"; KUrl u(filePath); QByteArray putData = "This is the put data"; KIO::TransferJob* job = KIO::storedPut( putData, u, 0600, KIO::Overwrite | KIO::HideProgressInfo ); QSignalSpy spyPercent(job, SIGNAL(percent(KJob*,ulong))); QVERIFY(spyPercent.isValid()); QDateTime mtime = QDateTime::currentDateTime().addSecs( -30 ); // 30 seconds ago mtime.setTime_t(mtime.toTime_t()); // hack for losing the milliseconds job->setModificationTime(mtime); job->setUiDelegate( 0 ); QVERIFY(job->exec()); QFileInfo fileInfo(filePath); QVERIFY(fileInfo.exists()); QCOMPARE(fileInfo.size(), (long long)putData.size()); QCOMPARE((int)fileInfo.permissions(), (int)(QFile::ReadOwner | QFile::WriteOwner | QFile::ReadUser | QFile::WriteUser )); QCOMPARE(fileInfo.lastModified(), mtime); QVERIFY(!spyPercent.isEmpty()); } //// void JobTest::copyLocalFile( const QString& src, const QString& dest ) { const KUrl u( src ); const KUrl d( dest ); // copy the file with file_copy KIO::Job* job = KIO::file_copy(u, d, -1, KIO::HideProgressInfo ); job->setUiDelegate(0); bool ok = KIO::NetAccess::synchronousRun(job, 0); QVERIFY( ok ); QVERIFY( QFile::exists( dest ) ); QVERIFY( QFile::exists( src ) ); // still there { // check that the timestamp is the same (#24443) // Note: this only works because of copy() in kio_file. // The datapump solution ignores mtime, the app has to call FileCopyJob::setModificationTime() QFileInfo srcInfo( src ); QFileInfo destInfo( dest ); #ifdef Q_WS_WIN // win32 time may differs in msec part QCOMPARE( srcInfo.lastModified().toString("dd.MM.yyyy hh:mm"), destInfo.lastModified().toString("dd.MM.yyyy hh:mm") ); #else QCOMPARE( srcInfo.lastModified(), destInfo.lastModified() ); #endif } // cleanup and retry with KIO::copy() QFile::remove( dest ); job = KIO::copy(u, d, KIO::HideProgressInfo ); QSignalSpy spyCopyingDone(job, SIGNAL(copyingDone(KIO::Job*,KUrl,KUrl,time_t,bool,bool))); job->setUiDelegate(0); ok = KIO::NetAccess::synchronousRun(job, 0); QVERIFY( ok ); QVERIFY( QFile::exists( dest ) ); QVERIFY( QFile::exists( src ) ); // still there { // check that the timestamp is the same (#24443) QFileInfo srcInfo( src ); QFileInfo destInfo( dest ); #ifdef Q_WS_WIN // win32 time may differs in msec part QCOMPARE( srcInfo.lastModified().toString("dd.MM.yyyy hh:mm"), destInfo.lastModified().toString("dd.MM.yyyy hh:mm") ); #else QCOMPARE( srcInfo.lastModified(), destInfo.lastModified() ); #endif } QCOMPARE(spyCopyingDone.count(), 1); } void JobTest::copyLocalDirectory( const QString& src, const QString& _dest, int flags ) { QVERIFY( QFileInfo( src ).isDir() ); QVERIFY( QFileInfo( src + "/testfile" ).isFile() ); KUrl u; u.setPath( src ); QString dest( _dest ); KUrl d; d.setPath( dest ); if ( flags & AlreadyExists ) QVERIFY( QFile::exists( dest ) ); else QVERIFY( !QFile::exists( dest ) ); KIO::Job* job = KIO::copy(u, d, KIO::HideProgressInfo); job->setUiDelegate(0); bool ok = KIO::NetAccess::synchronousRun(job, 0); QVERIFY( ok ); QVERIFY( QFile::exists( dest ) ); QVERIFY( QFileInfo( dest ).isDir() ); QVERIFY( QFileInfo( dest + "/testfile" ).isFile() ); QVERIFY( QFile::exists( src ) ); // still there if ( flags & AlreadyExists ) { dest += '/' + u.fileName(); //kDebug() << "Expecting dest=" << dest; } // CopyJob::setNextDirAttribute isn't implemented for Windows currently. #ifndef Q_WS_WIN { // Check that the timestamp is the same (#24443) QFileInfo srcInfo( src ); QFileInfo destInfo( dest ); QCOMPARE( srcInfo.lastModified(), destInfo.lastModified() ); } #endif // Do it again, with Overwrite. // Use copyAs, we don't want a subdir inside d. job = KIO::copyAs(u, d, KIO::HideProgressInfo | KIO::Overwrite); job->setUiDelegate(0); ok = KIO::NetAccess::synchronousRun(job, 0); QVERIFY( ok ); // Do it again, without Overwrite (should fail). job = KIO::copyAs(u, d, KIO::HideProgressInfo); job->setUiDelegate(0); ok = KIO::NetAccess::synchronousRun(job, 0); QVERIFY( !ok ); } void JobTest::copyFileToSamePartition() { kDebug() ; const QString filePath = homeTmpDir() + "fileFromHome"; const QString dest = homeTmpDir() + "fileFromHome_copied"; createTestFile( filePath ); copyLocalFile( filePath, dest ); } void JobTest::copyDirectoryToSamePartition() { kDebug() ; const QString src = homeTmpDir() + "dirFromHome"; const QString dest = homeTmpDir() + "dirFromHome_copied"; createTestDirectory( src ); copyLocalDirectory( src, dest ); } void JobTest::copyDirectoryToExistingDirectory() { kDebug() ; // just the same as copyDirectoryToSamePartition, but this time dest exists. // So we get a subdir, "dirFromHome_copy/dirFromHome" const QString src = homeTmpDir() + "dirFromHome"; const QString dest = homeTmpDir() + "dirFromHome_copied"; createTestDirectory( src ); createTestDirectory( dest ); copyLocalDirectory( src, dest, AlreadyExists ); } void JobTest::copyFileToOtherPartition() { kDebug() ; const QString filePath = homeTmpDir() + "fileFromHome"; const QString dest = otherTmpDir() + "fileFromHome_copied"; createTestFile( filePath ); copyLocalFile( filePath, dest ); } void JobTest::copyDirectoryToOtherPartition() { kDebug() ; const QString src = homeTmpDir() + "dirFromHome"; const QString dest = otherTmpDir() + "dirFromHome_copied"; createTestDirectory( src ); copyLocalDirectory( src, dest ); } void JobTest::moveLocalFile( const QString& src, const QString& dest ) { QVERIFY( QFile::exists( src ) ); KUrl u; u.setPath( src ); KUrl d; d.setPath( dest ); // move the file with file_move KIO::Job* job = KIO::file_move(u, d, -1, KIO::HideProgressInfo); job->setUiDelegate( 0 ); bool ok = KIO::NetAccess::synchronousRun(job, 0); QVERIFY( ok ); QVERIFY( QFile::exists( dest ) ); QVERIFY( !QFile::exists( src ) ); // not there anymore // move it back with KIO::move() job = KIO::move( d, u, KIO::HideProgressInfo ); job->setUiDelegate( 0 ); ok = KIO::NetAccess::synchronousRun(job, 0); QVERIFY( ok ); QVERIFY( !QFile::exists( dest ) ); QVERIFY( QFile::exists( src ) ); // it's back } static void moveLocalSymlink( const QString& src, const QString& dest ) { KDE_struct_stat buf; QVERIFY ( KDE_lstat( QFile::encodeName( src ), &buf ) == 0 ); KUrl u; u.setPath( src ); KUrl d; d.setPath( dest ); // move the symlink with move, NOT with file_move KIO::Job* job = KIO::move( u, d, KIO::HideProgressInfo ); job->setUiDelegate( 0 ); bool ok = KIO::NetAccess::synchronousRun(job, 0); if ( !ok ) kWarning() << KIO::NetAccess::lastError(); QVERIFY( ok ); QVERIFY ( KDE_lstat( QFile::encodeName( dest ), &buf ) == 0 ); QVERIFY( !QFile::exists( src ) ); // not there anymore // move it back with KIO::move() job = KIO::move( d, u, KIO::HideProgressInfo ); job->setUiDelegate( 0 ); ok = KIO::NetAccess::synchronousRun(job, 0); QVERIFY( ok ); QVERIFY ( KDE_lstat( QFile::encodeName( dest ), &buf ) != 0 ); // doesn't exist anymore QVERIFY ( KDE_lstat( QFile::encodeName( src ), &buf ) == 0 ); // it's back } void JobTest::moveLocalDirectory( const QString& src, const QString& dest ) { kDebug() << src << " " << dest; QVERIFY( QFile::exists( src ) ); QVERIFY( QFileInfo( src ).isDir() ); QVERIFY( QFileInfo( src + "/testfile" ).isFile() ); #ifndef Q_WS_WIN QVERIFY( QFileInfo( src + "/testlink" ).isSymLink() ); #endif KUrl u; u.setPath( src ); KUrl d; d.setPath( dest ); KIO::Job* job = KIO::move( u, d, KIO::HideProgressInfo ); job->setUiDelegate( 0 ); bool ok = KIO::NetAccess::synchronousRun(job, 0); QVERIFY( ok ); QVERIFY( QFile::exists( dest ) ); QVERIFY( QFileInfo( dest ).isDir() ); QVERIFY( QFileInfo( dest + "/testfile" ).isFile() ); QVERIFY( !QFile::exists( src ) ); // not there anymore #ifndef Q_WS_WIN QVERIFY( QFileInfo( dest + "/testlink" ).isSymLink() ); #endif } void JobTest::moveFileToSamePartition() { kDebug() ; const QString filePath = homeTmpDir() + "fileFromHome"; const QString dest = homeTmpDir() + "fileFromHome_moved"; createTestFile( filePath ); moveLocalFile( filePath, dest ); } void JobTest::moveDirectoryToSamePartition() { kDebug() ; const QString src = homeTmpDir() + "dirFromHome"; const QString dest = homeTmpDir() + "dirFromHome_moved"; createTestDirectory( src ); moveLocalDirectory( src, dest ); } void JobTest::moveFileToOtherPartition() { kDebug() ; const QString filePath = homeTmpDir() + "fileFromHome"; const QString dest = otherTmpDir() + "fileFromHome_moved"; createTestFile( filePath ); moveLocalFile( filePath, dest ); } void JobTest::moveSymlinkToOtherPartition() { #ifndef Q_WS_WIN kDebug() ; const QString filePath = homeTmpDir() + "testlink"; const QString dest = otherTmpDir() + "testlink_moved"; createTestSymlink( filePath ); moveLocalSymlink( filePath, dest ); #endif } void JobTest::moveDirectoryToOtherPartition() { kDebug() ; #ifndef Q_WS_WIN const QString src = homeTmpDir() + "dirFromHome"; const QString dest = otherTmpDir() + "dirFromHome_moved"; createTestDirectory( src ); moveLocalDirectory( src, dest ); #endif } void JobTest::moveFileNoPermissions() { kDebug() ; #ifdef Q_WS_WIN kDebug() << "port to win32"; #else const QString src = "/etc/passwd"; const QString dest = homeTmpDir() + "passwd"; QVERIFY( QFile::exists( src ) ); QVERIFY( QFileInfo( src ).isFile() ); KUrl u; u.setPath( src ); KUrl d; d.setPath( dest ); KIO::CopyJob* job = KIO::move( u, d, KIO::HideProgressInfo ); job->setUiDelegate( 0 ); // no skip dialog, thanks QMap<QString, QString> metaData; bool ok = KIO::NetAccess::synchronousRun( job, 0, 0, 0, &metaData ); QVERIFY( !ok ); QVERIFY( KIO::NetAccess::lastError() == KIO::ERR_ACCESS_DENIED ); // OK this is fishy. Just like mv(1), KIO's behavior depends on whether // a direct rename(2) was used, or a full copy+del. In the first case // there is no destination file created, but in the second case the // destination file remains. //QVERIFY( QFile::exists( dest ) ); QVERIFY( QFile::exists( src ) ); #endif } void JobTest::moveDirectoryNoPermissions() { kDebug() ; #ifdef Q_WS_WIN kDebug() << "port to win32"; #else // All of /etc is a bit much, so try to find something smaller: QString src = "/etc/fonts"; if ( !QFile::exists( src ) ) src = "/etc"; const QString dest = homeTmpDir() + "mdnp"; QVERIFY( QFile::exists( src ) ); QVERIFY( QFileInfo( src ).isDir() ); KUrl u; u.setPath( src ); KUrl d; d.setPath( dest ); KIO::CopyJob* job = KIO::move( u, d, KIO::HideProgressInfo ); job->setUiDelegate( 0 ); // no skip dialog, thanks QMap<QString, QString> metaData; bool ok = KIO::NetAccess::synchronousRun( job, 0, 0, 0, &metaData ); QVERIFY( !ok ); QCOMPARE( KIO::NetAccess::lastError(), (int)KIO::ERR_ACCESS_DENIED ); //QVERIFY( QFile::exists( dest ) ); // see moveFileNoPermissions QVERIFY( QFile::exists( src ) ); #endif } void JobTest::listRecursive() { // Note: many other tests must have been run before since we rely on the files they created const QString src = homeTmpDir(); #ifndef Q_WS_WIN // Add a symlink to a dir, to make sure we don't recurse into those bool symlinkOk = symlink( "dirFromHome", QFile::encodeName( src + "/dirFromHome_link" ) ) == 0; QVERIFY( symlinkOk ); #endif KIO::ListJob* job = KIO::listRecursive( KUrl(src), KIO::HideProgressInfo ); job->setUiDelegate( 0 ); connect( job, SIGNAL(entries(KIO::Job*,KIO::UDSEntryList)), SLOT(slotEntries(KIO::Job*,KIO::UDSEntryList)) ); bool ok = KIO::NetAccess::synchronousRun( job, 0 ); QVERIFY( ok ); m_names.sort(); QByteArray ref_names = QByteArray( ".,..," "dirFromHome,dirFromHome/testfile," #ifndef Q_WS_WIN "dirFromHome/testlink," #endif "dirFromHome_copied," "dirFromHome_copied/dirFromHome,dirFromHome_copied/dirFromHome/testfile," #ifndef Q_WS_WIN "dirFromHome_copied/dirFromHome/testlink," #endif "dirFromHome_copied/testfile," #ifndef Q_WS_WIN "dirFromHome_copied/testlink,dirFromHome_link," #endif "fileFromHome,fileFromHome_copied"); const QString joinedNames = m_names.join( "," ); if (joinedNames.toLatin1() != ref_names) { qDebug( "%s", qPrintable( joinedNames ) ); qDebug( "%s", ref_names.data() ); } QCOMPARE( joinedNames.toLatin1(), ref_names ); } void JobTest::listFile() { const QString filePath = homeTmpDir() + "fileFromHome"; createTestFile( filePath ); KIO::ListJob* job = KIO::listDir(KUrl(filePath), KIO::HideProgressInfo); job->setUiDelegate( 0 ); QVERIFY(!job->exec()); QCOMPARE(job->error(), static_cast<int>(KIO::ERR_IS_FILE)); // And list something that doesn't exist const QString path = homeTmpDir() + "fileFromHomeDoesNotExist"; job = KIO::listDir(KUrl(path), KIO::HideProgressInfo); job->setUiDelegate( 0 ); QVERIFY(!job->exec()); QCOMPARE(job->error(), static_cast<int>(KIO::ERR_DOES_NOT_EXIST)); } void JobTest::killJob() { const QString src = homeTmpDir(); KIO::ListJob* job = KIO::listDir( KUrl(src), KIO::HideProgressInfo ); QVERIFY(job->isAutoDelete()); QPointer<KIO::ListJob> ptr(job); job->setUiDelegate( 0 ); qApp->processEvents(); // let the job start, it's no fun otherwise job->kill(); qApp->sendPostedEvents(0, QEvent::DeferredDelete); // process the deferred delete of the job QVERIFY(ptr.isNull()); } void JobTest::killJobBeforeStart() { const QString src = homeTmpDir(); KIO::Job* job = KIO::stat( KUrl(src), KIO::HideProgressInfo ); QVERIFY(job->isAutoDelete()); QPointer<KIO::Job> ptr(job); job->setUiDelegate( 0 ); job->kill(); qApp->sendPostedEvents(0, QEvent::DeferredDelete); // process the deferred delete of the job QVERIFY(ptr.isNull()); qApp->processEvents(); // does KIO scheduler crash here? nope. } void JobTest::deleteJobBeforeStart() // #163171 { const QString src = homeTmpDir(); KIO::Job* job = KIO::stat( KUrl(src), KIO::HideProgressInfo ); QVERIFY(job->isAutoDelete()); job->setUiDelegate( 0 ); delete job; qApp->processEvents(); // does KIO scheduler crash here? } void JobTest::directorySize() { // Note: many other tests must have been run before since we rely on the files they created const QString src = homeTmpDir(); KIO::DirectorySizeJob* job = KIO::directorySize( KUrl(src) ); job->setUiDelegate( 0 ); bool ok = KIO::NetAccess::synchronousRun( job, 0 ); QVERIFY( ok ); kDebug() << "totalSize: " << job->totalSize(); kDebug() << "totalFiles: " << job->totalFiles(); kDebug() << "totalSubdirs: " << job->totalSubdirs(); #ifdef Q_WS_WIN QCOMPARE(job->totalFiles(), 5ULL); // see expected result in listRecursive() above QCOMPARE(job->totalSubdirs(), 3ULL); // see expected result in listRecursive() above QVERIFY(job->totalSize() > 54); #else QCOMPARE(job->totalFiles(), 8ULL); // see expected result in listRecursive() above QCOMPARE(job->totalSubdirs(), 4ULL); // see expected result in listRecursive() above QVERIFY(job->totalSize() >= 325); #endif qApp->sendPostedEvents(0, QEvent::DeferredDelete); } void JobTest::directorySizeError() { KIO::DirectorySizeJob* job = KIO::directorySize( KUrl("/I/Dont/Exist") ); job->setUiDelegate( 0 ); bool ok = KIO::NetAccess::synchronousRun( job, 0 ); QVERIFY( !ok ); qApp->sendPostedEvents(0, QEvent::DeferredDelete); } void JobTest::slotEntries( KIO::Job*, const KIO::UDSEntryList& lst ) { for( KIO::UDSEntryList::ConstIterator it = lst.begin(); it != lst.end(); ++it ) { QString displayName = (*it).stringValue( KIO::UDSEntry::UDS_NAME ); //KUrl url = (*it).stringValue( KIO::UDSEntry::UDS_URL ); m_names.append( displayName ); } } #if 0 // old performance tests class OldUDSAtom { public: QString m_str; long long m_long; unsigned int m_uds; }; typedef QList<OldUDSAtom> OldUDSEntry; // well it was a QValueList :) static void fillOldUDSEntry( OldUDSEntry& entry, time_t now_time_t, const QString& nameStr ) { OldUDSAtom atom; atom.m_uds = KIO::UDSEntry::UDS_NAME; atom.m_str = nameStr; entry.append( atom ); atom.m_uds = KIO::UDSEntry::UDS_SIZE; atom.m_long = 123456ULL; entry.append( atom ); atom.m_uds = KIO::UDSEntry::UDS_MODIFICATION_TIME; atom.m_long = now_time_t; entry.append( atom ); atom.m_uds = KIO::UDSEntry::UDS_ACCESS_TIME; atom.m_long = now_time_t; entry.append( atom ); atom.m_uds = KIO::UDSEntry::UDS_FILE_TYPE; atom.m_long = S_IFREG; entry.append( atom ); atom.m_uds = KIO::UDSEntry::UDS_ACCESS; atom.m_long = 0644; entry.append( atom ); atom.m_uds = KIO::UDSEntry::UDS_USER; atom.m_str = nameStr; entry.append( atom ); atom.m_uds = KIO::UDSEntry::UDS_GROUP; atom.m_str = nameStr; entry.append( atom ); } // QHash or QMap? doesn't seem to make much difference. typedef QHash<uint, QVariant> UDSEntryHV; static void fillUDSEntryHV( UDSEntryHV& entry, const QDateTime& now, const QString& nameStr ) { entry.reserve( 8 ); entry.insert( KIO::UDSEntry::UDS_NAME, nameStr ); // we might need a method to make sure people use unsigned long long entry.insert( KIO::UDSEntry::UDS_SIZE, 123456ULL ); entry.insert( KIO::UDSEntry::UDS_MODIFICATION_TIME, now ); entry.insert( KIO::UDSEntry::UDS_ACCESS_TIME, now ); entry.insert( KIO::UDSEntry::UDS_FILE_TYPE, S_IFREG ); entry.insert( KIO::UDSEntry::UDS_ACCESS, 0644 ); entry.insert( KIO::UDSEntry::UDS_USER, nameStr ); entry.insert( KIO::UDSEntry::UDS_GROUP, nameStr ); } // Which one is used depends on UDS_STRING vs UDS_LONG struct UDSAtom4 // can't be a union due to qstring... { UDSAtom4() {} // for QHash or QMap UDSAtom4( const QString& s ) : m_str( s ) {} UDSAtom4( long long l ) : m_long( l ) {} QString m_str; long long m_long; }; // Another possibility, to save on QVariant costs typedef QHash<uint, UDSAtom4> UDSEntryHS; // hash+struct static void fillQHashStructEntry( UDSEntryHS& entry, time_t now_time_t, const QString& nameStr ) { entry.reserve( 8 ); entry.insert( KIO::UDSEntry::UDS_NAME, nameStr ); entry.insert( KIO::UDSEntry::UDS_SIZE, 123456ULL ); entry.insert( KIO::UDSEntry::UDS_MODIFICATION_TIME, now_time_t ); entry.insert( KIO::UDSEntry::UDS_ACCESS_TIME, now_time_t ); entry.insert( KIO::UDSEntry::UDS_FILE_TYPE, S_IFREG ); entry.insert( KIO::UDSEntry::UDS_ACCESS, 0644 ); entry.insert( KIO::UDSEntry::UDS_USER, nameStr ); entry.insert( KIO::UDSEntry::UDS_GROUP, nameStr ); } // Let's see if QMap makes any difference typedef QMap<uint, UDSAtom4> UDSEntryMS; // map+struct static void fillQMapStructEntry( UDSEntryMS& entry, time_t now_time_t, const QString& nameStr ) { entry.insert( KIO::UDSEntry::UDS_NAME, nameStr ); entry.insert( KIO::UDSEntry::UDS_SIZE, 123456ULL ); entry.insert( KIO::UDSEntry::UDS_MODIFICATION_TIME, now_time_t ); entry.insert( KIO::UDSEntry::UDS_ACCESS_TIME, now_time_t ); entry.insert( KIO::UDSEntry::UDS_FILE_TYPE, S_IFREG ); entry.insert( KIO::UDSEntry::UDS_ACCESS, 0644 ); entry.insert( KIO::UDSEntry::UDS_USER, nameStr ); entry.insert( KIO::UDSEntry::UDS_GROUP, nameStr ); } void JobTest::newApiPerformance() { const QDateTime now = QDateTime::currentDateTime(); const time_t now_time_t = now.toTime_t(); // use 30000 for callgrind, at least 100 times that for timing-based // use /10 times that in svn, so that jobtest doesn't last forever const int iterations = 30000 /* * 100 */ / 10; const int lookupIterations = 5 * iterations; const QString nameStr = QString::fromLatin1( "name" ); /* This is to compare the old list-of-lists API vs a QMap/QHash-based API in terms of performance. The number of atoms and their type map to what kio_file would put in for any normal file. The lookups are done for two atoms that are present, and for one that is not. */ /// Old API { qDebug( "Timing old api..." ); // Slave code time_t start = time(0); for (int i = 0; i < iterations; ++i) { OldUDSEntry entry; fillOldUDSEntry( entry, now_time_t, nameStr ); } qDebug("Old API: slave code: %ld", time(0) - start); OldUDSEntry entry; fillOldUDSEntry( entry, now_time_t, nameStr ); QCOMPARE( entry.count(), 8 ); start = time(0); // App code QString displayName; KIO::filesize_t size; KUrl url; for (int i = 0; i < lookupIterations; ++i) { OldUDSEntry::ConstIterator it2 = entry.begin(); for( ; it2 != entry.end(); it2++ ) { switch ((*it2).m_uds) { case KIO::UDSEntry::UDS_NAME: displayName = (*it2).m_str; break; case KIO::UDSEntry::UDS_URL: url = (*it2).m_str; break; case KIO::UDSEntry::UDS_SIZE: size = (*it2).m_long; break; } } } qDebug("Old API: app code: %ld", time(0) - start); QCOMPARE( size, 123456ULL ); QCOMPARE( displayName, QString::fromLatin1( "name" ) ); QVERIFY( url.isEmpty() ); } ///////// TEST CODE FOR FUTURE KIO API //// { qDebug( "Timing new QHash+QVariant api..." ); // Slave code time_t start = time(0); for (int i = 0; i < iterations; ++i) { UDSEntryHV entry; fillUDSEntryHV( entry, now, nameStr ); } qDebug("QHash+QVariant API: slave code: %ld", time(0) - start); UDSEntryHV entry; fillUDSEntryHV( entry, now, nameStr ); QCOMPARE( entry.count(), 8 ); start = time(0); // App code // Normally the code would look like this, but let's change it to time it like the old api /* QString displayName = entry.value( KIO::UDSEntry::UDS_NAME ).toString(); KUrl url = entry.value( KIO::UDSEntry::UDS_URL ).toString(); KIO::filesize_t size = entry.value( KIO::UDSEntry::UDS_SIZE ).toULongLong(); */ QString displayName; KIO::filesize_t size; KUrl url; for (int i = 0; i < lookupIterations; ++i) { // For a field that we assume to always be there displayName = entry.value( KIO::UDSEntry::UDS_NAME ).toString(); // For a field that might not be there UDSEntryHV::const_iterator it = entry.find( KIO::UDSEntry::UDS_URL ); const UDSEntryHV::const_iterator end = entry.end(); if ( it != end ) url = it.value().toString(); it = entry.find( KIO::UDSEntry::UDS_SIZE ); if ( it != end ) size = it.value().toULongLong(); } qDebug("QHash+QVariant API: app code: %ld", time(0) - start); QCOMPARE( size, 123456ULL ); QCOMPARE( displayName, QString::fromLatin1( "name" ) ); QVERIFY( url.isEmpty() ); } // ########### THE CHOSEN SOLUTION: { qDebug( "Timing new QHash+struct api..." ); // Slave code time_t start = time(0); for (int i = 0; i < iterations; ++i) { UDSEntryHS entry; fillQHashStructEntry( entry, now_time_t, nameStr ); } qDebug("QHash+struct API: slave code: %ld", time(0) - start); UDSEntryHS entry; fillQHashStructEntry( entry, now_time_t, nameStr ); QCOMPARE( entry.count(), 8 ); start = time(0); // App code QString displayName; KIO::filesize_t size; KUrl url; for (int i = 0; i < lookupIterations; ++i) { // For a field that we assume to always be there displayName = entry.value( KIO::UDSEntry::UDS_NAME ).m_str; // For a field that might not be there UDSEntryHS::const_iterator it = entry.find( KIO::UDSEntry::UDS_URL ); const UDSEntryHS::const_iterator end = entry.end(); if ( it != end ) url = it.value().m_str; it = entry.find( KIO::UDSEntry::UDS_SIZE ); if ( it != end ) size = it.value().m_long; } qDebug("QHash+struct API: app code: %ld", time(0) - start); QCOMPARE( size, 123456ULL ); QCOMPARE( displayName, QString::fromLatin1( "name" ) ); QVERIFY( url.isEmpty() ); } { qDebug( "Timing new QMap+struct api..." ); // Slave code time_t start = time(0); for (int i = 0; i < iterations; ++i) { UDSEntryMS entry; fillQMapStructEntry( entry, now_time_t, nameStr ); } qDebug("QMap+struct API: slave code: %ld", time(0) - start); UDSEntryMS entry; fillQMapStructEntry( entry, now_time_t, nameStr ); QCOMPARE( entry.count(), 8 ); start = time(0); // App code QString displayName; KIO::filesize_t size; KUrl url; for (int i = 0; i < lookupIterations; ++i) { // For a field that we assume to always be there displayName = entry.value( KIO::UDSEntry::UDS_NAME ).m_str; // For a field that might not be there UDSEntryMS::const_iterator it = entry.find( KIO::UDSEntry::UDS_URL ); const UDSEntryMS::const_iterator end = entry.end(); if ( it != end ) url = it.value().m_str; it = entry.find( KIO::UDSEntry::UDS_SIZE ); if ( it != end ) size = it.value().m_long; } qDebug("QMap+struct API: app code: %ld", time(0) - start); QCOMPARE( size, 123456ULL ); QCOMPARE( displayName, QString::fromLatin1( "name" ) ); QVERIFY( url.isEmpty() ); } } #endif void JobTest::calculateRemainingSeconds() { unsigned int seconds = KIO::calculateRemainingSeconds( 2 * 86400 - 60, 0, 1 ); QCOMPARE( seconds, static_cast<unsigned int>( 2 * 86400 - 60 ) ); QString text = KIO::convertSeconds( seconds ); QCOMPARE( text, i18n( "1 day 23:59:00" ) ); seconds = KIO::calculateRemainingSeconds( 520, 20, 10 ); QCOMPARE( seconds, static_cast<unsigned int>( 50 ) ); text = KIO::convertSeconds( seconds ); QCOMPARE( text, i18n( "00:00:50" ) ); } #if 0 void JobTest::copyFileToSystem() { if ( !KProtocolInfo::isKnownProtocol( "system" ) ) { kDebug() << "no kio_system, skipping test"; return; } // First test with support for UDS_LOCAL_PATH copyFileToSystem( true ); QString dest = realSystemPath() + "fileFromHome_copied"; QFile::remove( dest ); // Then disable support for UDS_LOCAL_PATH, i.e. test what would // happen for ftp, smb, http etc. copyFileToSystem( false ); } void JobTest::copyFileToSystem( bool resolve_local_urls ) { kDebug() << resolve_local_urls; extern KIO_EXPORT bool kio_resolve_local_urls; kio_resolve_local_urls = resolve_local_urls; const QString src = homeTmpDir() + "fileFromHome"; createTestFile( src ); KUrl u; u.setPath( src ); KUrl d = systemTmpDir(); d.addPath( "fileFromHome_copied" ); kDebug() << "copying " << u << " to " << d; // copy the file with file_copy m_mimetype.clear(); KIO::FileCopyJob* job = KIO::file_copy(u, d, -1, KIO::HideProgressInfo); job->setUiDelegate( 0 ); connect( job, SIGNAL(mimetype(KIO::Job*,QString)), this, SLOT(slotMimetype(KIO::Job*,QString)) ); bool ok = KIO::NetAccess::synchronousRun( job, 0 ); QVERIFY( ok ); QString dest = realSystemPath() + "fileFromHome_copied"; QVERIFY( QFile::exists( dest ) ); QVERIFY( QFile::exists( src ) ); // still there { // do NOT check that the timestamp is the same. // It can't work with file_copy when it uses the datapump, // unless we use setModificationTime in the app code. } // Check mimetype QCOMPARE(m_mimetype, QString("text/plain")); // cleanup and retry with KIO::copy() QFile::remove( dest ); job = KIO::copy(u, d, KIO::HideProgressInfo); job->setUiDelegate(0); ok = KIO::NetAccess::synchronousRun(job, 0); QVERIFY( ok ); QVERIFY( QFile::exists( dest ) ); QVERIFY( QFile::exists( src ) ); // still there { // check that the timestamp is the same (#79937) QFileInfo srcInfo( src ); QFileInfo destInfo( dest ); QCOMPARE( srcInfo.lastModified(), destInfo.lastModified() ); } // restore normal behavior kio_resolve_local_urls = true; } #endif void JobTest::getInvalidUrl() { KUrl url("http://strange<hostname>/"); QVERIFY(!url.isValid()); KIO::SimpleJob* job = KIO::get(url, KIO::NoReload, KIO::HideProgressInfo); QVERIFY(job != 0); job->setUiDelegate( 0 ); KIO::Scheduler::setJobPriority(job, 1); // shouldn't crash (#135456) bool ok = KIO::NetAccess::synchronousRun( job, 0 ); QVERIFY( !ok ); // it should fail :) } void JobTest::slotMimetype(KIO::Job* job, const QString& type) { QVERIFY( job != 0 ); m_mimetype = type; } void JobTest::deleteFile() { const QString dest = otherTmpDir() + "fileFromHome_copied"; QVERIFY(QFile::exists(dest)); KIO::Job* job = KIO::del(KUrl(dest), KIO::HideProgressInfo); job->setUiDelegate(0); bool ok = KIO::NetAccess::synchronousRun(job, 0); QVERIFY(ok); QVERIFY(!QFile::exists(dest)); } void JobTest::deleteDirectory() { const QString dest = otherTmpDir() + "dirFromHome_copied"; if (!QFile::exists(dest)) createTestDirectory(dest); // Let's put a few things in there to see if the recursive deletion works correctly // A hidden file: createTestFile(dest + "/.hidden"); #ifndef Q_WS_WIN // A broken symlink: createTestSymlink(dest+"/broken_symlink"); // A symlink to a dir: bool symlink_ok = symlink( KDESRCDIR, QFile::encodeName( dest + "/symlink_to_dir" ) ) == 0; if ( !symlink_ok ) kFatal() << "couldn't create symlink: " << strerror( errno ) ; #endif KIO::Job* job = KIO::del(KUrl(dest), KIO::HideProgressInfo); job->setUiDelegate(0); bool ok = KIO::NetAccess::synchronousRun(job, 0); QVERIFY(ok); QVERIFY(!QFile::exists(dest)); } void JobTest::deleteSymlink(bool using_fast_path) { extern KIO_EXPORT bool kio_resolve_local_urls; kio_resolve_local_urls = !using_fast_path; #ifndef Q_WS_WIN const QString src = homeTmpDir() + "dirFromHome"; createTestDirectory(src); QVERIFY(QFile::exists(src)); const QString dest = homeTmpDir() + "/dirFromHome_link"; if (!QFile::exists(dest)) { // Add a symlink to a dir, to make sure we don't recurse into those bool symlinkOk = symlink(QFile::encodeName(src), QFile::encodeName(dest)) == 0; QVERIFY( symlinkOk ); QVERIFY(QFile::exists(dest)); } KIO::Job* job = KIO::del(KUrl(dest), KIO::HideProgressInfo); job->setUiDelegate(0); bool ok = KIO::NetAccess::synchronousRun(job, 0); QVERIFY(ok); QVERIFY(!QFile::exists(dest)); QVERIFY(QFile::exists(src)); #endif kio_resolve_local_urls = true; } void JobTest::deleteSymlink() { #ifndef Q_WS_WIN deleteSymlink(true); deleteSymlink(false); #endif } void JobTest::deleteManyDirs(bool using_fast_path) { extern KIO_EXPORT bool kio_resolve_local_urls; kio_resolve_local_urls = !using_fast_path; const int numDirs = 50; KUrl::List dirs; for (int i = 0; i < numDirs; ++i) { const QString dir = homeTmpDir() + "dir" + QString::number(i); createTestDirectory(dir); dirs << KUrl(dir); } QTime dt; dt.start(); KIO::Job* job = KIO::del(dirs, KIO::HideProgressInfo); job->setUiDelegate(0); bool ok = KIO::NetAccess::synchronousRun(job, 0); QVERIFY(ok); Q_FOREACH(const KUrl& dir, dirs) { QVERIFY(!QFile::exists(dir.path())); } kDebug() << "Deleted" << numDirs << "dirs in" << dt.elapsed() << "milliseconds"; kio_resolve_local_urls = true; } void JobTest::deleteManyDirs() { deleteManyDirs(true); deleteManyDirs(false); } static void createManyFiles(const QString& baseDir, int numFiles) { for (int i = 0; i < numFiles; ++i) { // create empty file QFile f(baseDir + QString::number(i)); QVERIFY(f.open(QIODevice::WriteOnly)); } } void JobTest::deleteManyFilesIndependently() { QTime dt; dt.start(); const int numFiles = 100; // Use 1000 for performance testing const QString baseDir = homeTmpDir(); createManyFiles(baseDir, numFiles); for (int i = 0; i < numFiles; ++i) { // delete each file independently. lots of jobs. this stress-tests kio scheduling. const QString file = baseDir + QString::number(i); QVERIFY(QFile::exists(file)); //kDebug() << file; KIO::Job* job = KIO::del(KUrl(file), KIO::HideProgressInfo); job->setUiDelegate(0); bool ok = KIO::NetAccess::synchronousRun(job, 0); QVERIFY(ok); QVERIFY(!QFile::exists(file)); } kDebug() << "Deleted" << numFiles << "files in" << dt.elapsed() << "milliseconds"; } void JobTest::deleteManyFilesTogether(bool using_fast_path) { extern KIO_EXPORT bool kio_resolve_local_urls; kio_resolve_local_urls = !using_fast_path; QTime dt; dt.start(); const int numFiles = 100; // Use 1000 for performance testing const QString baseDir = homeTmpDir(); createManyFiles(baseDir, numFiles); KUrl::List urls; for (int i = 0; i < numFiles; ++i) { const QString file = baseDir + QString::number(i); QVERIFY(QFile::exists(file)); urls.append(KUrl(file)); } //kDebug() << file; KIO::Job* job = KIO::del(urls, KIO::HideProgressInfo); job->setUiDelegate(0); bool ok = KIO::NetAccess::synchronousRun(job, 0); QVERIFY(ok); kDebug() << "Deleted" << numFiles << "files in" << dt.elapsed() << "milliseconds"; kio_resolve_local_urls = true; } void JobTest::deleteManyFilesTogether() { deleteManyFilesTogether(true); deleteManyFilesTogether(false); } void JobTest::rmdirEmpty() { const QString dir = homeTmpDir() + "dir"; QDir().mkdir(dir); QVERIFY(QFile::exists(dir)); KIO::Job* job = KIO::rmdir(dir); QVERIFY(job->exec()); QVERIFY(!QFile::exists(dir)); } void JobTest::rmdirNotEmpty() { const QString dir = homeTmpDir() + "dir"; createTestDirectory(dir); createTestDirectory(dir + "/subdir"); KIO::Job* job = KIO::rmdir(dir); QVERIFY(!job->exec()); QVERIFY(QFile::exists(dir)); } void JobTest::stat() { #if 1 const QString filePath = homeTmpDir() + "fileFromHome"; createTestFile( filePath ); KIO::StatJob* job = KIO::stat(filePath, KIO::HideProgressInfo); QVERIFY(job); bool ok = KIO::NetAccess::synchronousRun(job, 0); QVERIFY(ok); // TODO set setSide, setDetails const KIO::UDSEntry& entry = job->statResult(); QVERIFY(!entry.isDir()); QVERIFY(!entry.isLink()); QCOMPARE(entry.stringValue(KIO::UDSEntry::UDS_NAME), QString("fileFromHome")); #else // Testing stat over HTTP KIO::StatJob* job = KIO::stat(KUrl("http://www.kde.org"), KIO::HideProgressInfo); QVERIFY(job); bool ok = KIO::NetAccess::synchronousRun(job, 0); QVERIFY(ok); // TODO set setSide, setDetails const KIO::UDSEntry& entry = job->statResult(); QVERIFY(!entry.isDir()); QVERIFY(!entry.isLink()); QCOMPARE(entry.stringValue(KIO::UDSEntry::UDS_NAME), QString()); #endif } void JobTest::mostLocalUrl() { const QString filePath = homeTmpDir() + "fileFromHome"; createTestFile( filePath ); KIO::StatJob* job = KIO::mostLocalUrl(filePath, KIO::HideProgressInfo); QVERIFY(job); bool ok = job->exec(); QVERIFY(ok); QCOMPARE(job->mostLocalUrl().toLocalFile(), filePath); } void JobTest::mimeType() { #if 1 const QString filePath = homeTmpDir() + "fileFromHome"; createTestFile( filePath ); KIO::MimetypeJob* job = KIO::mimetype(filePath, KIO::HideProgressInfo); QVERIFY(job); QSignalSpy spyMimeType(job, SIGNAL(mimetype(KIO::Job*,QString))); bool ok = KIO::NetAccess::synchronousRun(job, 0); QVERIFY(ok); QCOMPARE(spyMimeType.count(), 1); QCOMPARE(spyMimeType[0][0], QVariant::fromValue(static_cast<KIO::Job*>(job))); QCOMPARE(spyMimeType[0][1].toString(), QString("application/octet-stream")); #else // Testing mimetype over HTTP KIO::MimetypeJob* job = KIO::mimetype(KUrl("http://www.kde.org"), KIO::HideProgressInfo); QVERIFY(job); QSignalSpy spyMimeType(job, SIGNAL(mimetype(KIO::Job*,QString))); bool ok = KIO::NetAccess::synchronousRun(job, 0); QVERIFY(ok); QCOMPARE(spyMimeType.count(), 1); QCOMPARE(spyMimeType[0][0], QVariant::fromValue(static_cast<KIO::Job*>(job))); QCOMPARE(spyMimeType[0][1].toString(), QString("text/html")); #endif } void JobTest::mimeTypeError() { // KIO::mimetype() on a file that doesn't exist const QString filePath = homeTmpDir() + "doesNotExist"; KIO::MimetypeJob* job = KIO::mimetype(QUrl::fromLocalFile(filePath), KIO::HideProgressInfo); QVERIFY(job); QSignalSpy spyMimeType(job, SIGNAL(mimetype(KIO::Job*,QString))); QSignalSpy spyResult(job, SIGNAL(result(KJob*))); bool ok = KIO::NetAccess::synchronousRun(job, 0); QVERIFY(!ok); QCOMPARE(spyMimeType.count(), 0); QCOMPARE(spyResult.count(), 1); } void JobTest::moveFileDestAlreadyExists() // #157601 { const QString file1 = homeTmpDir() + "fileFromHome"; createTestFile( file1 ); const QString file2 = homeTmpDir() + "anotherFile"; createTestFile( file2 ); const QString existingDest = otherTmpDir() + "fileFromHome"; createTestFile( existingDest ); KUrl::List urls; urls << KUrl(file1) << KUrl(file2); KIO::CopyJob* job = KIO::move(urls, otherTmpDir(), KIO::HideProgressInfo); job->setUiDelegate(0); job->setAutoSkip(true); bool ok = KIO::NetAccess::synchronousRun(job, 0); QVERIFY(ok); QVERIFY(QFile::exists(file1)); // it was skipped QVERIFY(!QFile::exists(file2)); // it was moved } void JobTest::moveDestAlreadyExistsAutoRename_data() { QTest::addColumn<bool>("samePartition"); QTest::addColumn<bool>("moveDirs"); QTest::newRow("files same partition") << true << false; QTest::newRow("files other partition") << false << false; QTest::newRow("dirs same partition") << true << true; QTest::newRow("dirs other partition") << false << true; } void JobTest::moveDestAlreadyExistsAutoRename() { QFETCH(bool, samePartition); QFETCH(bool, moveDirs); QString dir; if (samePartition) { dir = homeTmpDir() + "dir/"; QVERIFY(QDir(dir).exists() || QDir().mkdir(dir)); } else { dir = otherTmpDir(); } moveDestAlreadyExistsAutoRename(dir, moveDirs); if (samePartition) { // cleanup KIO::Job* job = KIO::del(dir, KIO::HideProgressInfo); QVERIFY(job->exec()); QVERIFY(!QFile::exists(dir)); } } void JobTest::moveDestAlreadyExistsAutoRename(const QString& destDir, bool moveDirs) // #256650 { const QString prefix = moveDirs ? "dir " : "file "; QStringList sources; const QString file1 = homeTmpDir() + prefix + "1"; const QString file2 = homeTmpDir() + prefix + "2"; const QString existingDest1 = destDir + prefix + "1"; const QString existingDest2 = destDir + prefix + "2"; sources << file1 << file2 << existingDest1 << existingDest2; Q_FOREACH(const QString& source, sources) { if (moveDirs) QVERIFY(QDir().mkdir(source)); else createTestFile(source); } KUrl::List urls; urls << KUrl(file1) << KUrl(file2); KIO::CopyJob* job = KIO::move(urls, destDir, KIO::HideProgressInfo); job->setUiDelegate(0); job->setAutoRename(true); //kDebug() << QDir(destDir).entryList(); bool ok = KIO::NetAccess::synchronousRun(job, 0); kDebug() << QDir(destDir).entryList(); QVERIFY(ok); QVERIFY(!QFile::exists(file1)); // it was moved QVERIFY(!QFile::exists(file2)); // it was moved QVERIFY(QFile::exists(existingDest1)); QVERIFY(QFile::exists(existingDest2)); const QString file3 = destDir + prefix + "3"; const QString file4 = destDir + prefix + "4"; QVERIFY(QFile::exists(file3)); QVERIFY(QFile::exists(file4)); if (moveDirs) { QDir().rmdir(file1); QDir().rmdir(file2); QDir().rmdir(file3); QDir().rmdir(file4); } else { QFile::remove(file1); QFile::remove(file2); QFile::remove(file3); QFile::remove(file4); } } void JobTest::moveAndOverwrite() { const QString sourceFile = homeTmpDir() + "fileFromHome"; createTestFile( sourceFile ); QString existingDest = otherTmpDir() + "fileFromHome"; createTestFile( existingDest ); KIO::FileCopyJob* job = KIO::file_move(KUrl(sourceFile), KUrl(existingDest), -1, KIO::HideProgressInfo | KIO::Overwrite); job->setUiDelegate(0); bool ok = KIO::NetAccess::synchronousRun(job, 0); QVERIFY(ok); QVERIFY(!QFile::exists(sourceFile)); // it was moved #ifndef Q_WS_WIN // Now same thing when the target is a symlink to the source createTestFile( sourceFile ); createTestSymlink( existingDest, QFile::encodeName(sourceFile) ); QVERIFY(QFile::exists(existingDest)); job = KIO::file_move(KUrl(sourceFile), KUrl(existingDest), -1, KIO::HideProgressInfo | KIO::Overwrite); job->setUiDelegate(0); ok = KIO::NetAccess::synchronousRun(job, 0); QVERIFY(ok); QVERIFY(!QFile::exists(sourceFile)); // it was moved // Now same thing when the target is a symlink to another file createTestFile( sourceFile ); createTestFile( sourceFile + "2" ); createTestSymlink( existingDest, QFile::encodeName(sourceFile + "2") ); QVERIFY(QFile::exists(existingDest)); job = KIO::file_move(KUrl(sourceFile), KUrl(existingDest), -1, KIO::HideProgressInfo | KIO::Overwrite); job->setUiDelegate(0); ok = KIO::NetAccess::synchronousRun(job, 0); QVERIFY(ok); QVERIFY(!QFile::exists(sourceFile)); // it was moved // Now same thing when the target is a _broken_ symlink createTestFile( sourceFile ); createTestSymlink( existingDest ); QVERIFY(!QFile::exists(existingDest)); // it exists, but it's broken... job = KIO::file_move(KUrl(sourceFile), KUrl(existingDest), -1, KIO::HideProgressInfo | KIO::Overwrite); job->setUiDelegate(0); ok = KIO::NetAccess::synchronousRun(job, 0); QVERIFY(ok); QVERIFY(!QFile::exists(sourceFile)); // it was moved #endif } void JobTest::moveOverSymlinkToSelf() // #169547 { #ifndef Q_WS_WIN const QString sourceFile = homeTmpDir() + "fileFromHome"; createTestFile( sourceFile ); const QString existingDest = homeTmpDir() + "testlink"; createTestSymlink( existingDest, QFile::encodeName(sourceFile) ); QVERIFY(QFile::exists(existingDest)); KIO::CopyJob* job = KIO::move(KUrl(sourceFile), KUrl(existingDest), KIO::HideProgressInfo); job->setUiDelegate(0); bool ok = KIO::NetAccess::synchronousRun(job, 0); QVERIFY(!ok); QCOMPARE(job->error(), (int)KIO::ERR_FILE_ALREADY_EXIST); // and not ERR_IDENTICAL_FILES! QVERIFY(QFile::exists(sourceFile)); // it not moved #endif } #include "jobtest.moc"
gpl-2.0
cuongnd/test_pro
media/elements/ui/rangeofintegers.php
6204
<?php class elementRangeOfIntegersHelper extends elementHelper { function initElement($TablePosition) { $path=$TablePosition->ui_path; $pathInfo = pathinfo($path); $filename=$pathInfo['filename']; $dirName=$pathInfo['dirname']; $doc=JFactory::getDocument(); $lessInput = JPATH_ROOT . "/$dirName/$filename.less"; $cssOutput = JPATH_ROOT . "/$dirName/$filename.css"; JUtility::compileLess($lessInput, $cssOutput); } function getHeaderHtml($block,$enableEditWebsite) { $app=JFactory::getApplication(); $path=$block->ui_path; $pathInfo = pathinfo($path); $filename=$pathInfo['filename']; $dirName=$pathInfo['dirname']; $doc=JFactory::getDocument(); $doc->addStyleSheet(JUri::root() . "/$dirName/$filename.css"); $doc->addScript(JUri::root() ."/$dirName/$filename.js"); $doc->addStyleSheet(JUri::root() . "/media/system/js/ion.rangeSlider-master/css/ion.rangeSlider.css"); $doc->addStyleSheet(JUri::root() . "/media/system/js/ion.rangeSlider-master/css/ion.rangeSlider.skinHTML5.css"); $doc->addScript(JUri::root().'/media/system/js/ion.rangeSlider-master/js/ion.rangeSlider.js'); $html=''; ob_start(); if($enableEditWebsite) { ?> <div class="control-element control-element-passengers item_control item_control_<?php echo $block->parent_id ?>" <?php echo $enable_resizable_for_control==1?'enabled-resizable="true"':'' ?> data-block-id="<?php echo $block->id ?>" data-block-parent-id="<?php echo $block->parent_id ?>" element-type="<?php echo $block->type ?>" data-gs-x="<?php echo $block->gs_x ?>" data-gs-y="<?php echo $block->gs_y ?>" data-gs-width="<?php echo $block->width ?>" data-gs-height="<?php echo $block->height ?>"> <span data-block-id="<?php echo $block->id ?>" data-block-parent-id="<?php echo $block->parent_id ?>" class="drag label label-default element-move-handle element-move-handle_<?php echo $block->parent_id ?>"><i class="glyphicon glyphicon-move"></i></span> <a data-block-id="<?php echo $block->id ?>" data-block-parent-id="<?php echo $block->parent_id ?>" class="menu label config-block label-danger menu-list" href="javascript:void(0)"><i class="im-menu2"></i></a> <a data-block-id="<?php echo $block->id ?>" data-block-parent-id="<?php echo $block->parent_id ?>"class="remove label label-danger remove-element" href="javascript:void(0)"><i class="glyphicon-remove glyphicon"></i></a> <?php echo elementRangeOfIntegersHelper::render_element($block,$enableEditWebsite); }else{ echo elementRangeOfIntegersHelper::render_element($block,$enableEditWebsite); ?> <?php } $html.=ob_get_clean(); return $html; } public function render_element($block,$enableEditWebsite) { $list_param=array( 'name_from,element_config.name_from', 'name_to,element_config.name_to', 'step,element_config.step', 'min,element_config.min', 'max,element_config.max', 'data.text,data.bindingSource', 'text,element_config.text', 'name,element_config.name', 'placeholder,element_config.placeholder', 'inputmask,element_config.config_update_inputmask' ); parent::merge_param($list_param,$block->id); $params = new JRegistry; $params->loadString($block->params); $name_from=$params->get('element_config.name_from','name_from_'.$block->id); $name_to=$params->get('element_config.name_to','name_to_'.$block->id); $enable_resizable_for_control=$params->get('enable_resizable_for_control',0); $id=$params->get('element_config.id',''); $step=(int)$params->get('element_config.step',1); $type=$params->get('element_config.type','double'); $min=(int)$params->get('element_config.min',0); $max=(int)$params->get('element_config.max',100); $text_from=(int)$params->get('element_config.text_from',0); $text_to=(int)$params->get('element_config.text_to',100); $enable_submit=$params->get('element_config.enable_submit',1); $placeholder=$params->get('placeholder','placeholder_'.$block->id); $data_text_from=$params->get('element_config.data.text_from',0); $data_text_to=$params->get('data.text_to',100); if($data_text_from){ $text_from=parent::getValueDataSourceByKey($data_text_from); } if($data_text_to){ $text_to=(int)parent::getValueDataSourceByKey($data_text_to); } $html=''; ob_start(); ?> <div class="block-item block-item-rangeofintegers " data-step="<?php echo $step ?>" data-min="<?php echo $min ?>" data-max="<?php echo $max ?>" data-type="<?php echo $type ?>" data-block-id="<?php echo $block->id ?>" data-block-parent-id="<?php echo $block->parent_id ?>" element-type="<?php echo $block->type ?>" > <input type="hidden" value="<?php echo $text_from ?>" enable-submit="<?php echo $enable_submit?'true':'false' ?>" class="block-item block-item-rangeofintegers-from" name="<?php echo $name_from ?>" data-block-id="<?php echo $block->id ?>" data-block-parent-id="<?php echo $block->parent_id ?>" element-type="<?php echo $block->type ?>" /> <input type="hidden" value="<?php echo $text_to ?>" enable-submit="<?php echo $enable_submit?'true':'false' ?>" class="block-item block-item-rangeofintegers-to" name="<?php echo $name_to ?>" data-block-id="<?php echo $block->id ?>" data-block-parent-id="<?php echo $block->parent_id ?>" element-type="<?php echo $block->type ?>" /> </div> <?php $html=ob_get_clean(); return $html; } function getFooterHtml($block,$enableEditWebsite) { $html=''; ob_start(); if($enableEditWebsite) { ?> </div> <?php }else{ ?> <?php } $html.=ob_get_clean(); return $html; } } ?>
gpl-2.0
QuantiModo/QuantiModo-SDK-Qt5cpp
client/SWGInline_response_200_19.cpp
2169
#include "SWGInline_response_200_19.h" #include "SWGHelpers.h" #include <QJsonDocument> #include <QJsonArray> #include <QObject> #include <QDebug> namespace Swagger { SWGInline_response_200_19::SWGInline_response_200_19(QString* json) { init(); this->fromJson(*json); } SWGInline_response_200_19::SWGInline_response_200_19() { init(); } SWGInline_response_200_19::~SWGInline_response_200_19() { this->cleanup(); } void SWGInline_response_200_19::init() { data = new QList<SWGUpdate*>(); success = false; } void SWGInline_response_200_19::cleanup() { if(data != NULL) { QList<SWGUpdate*>* arr = data; foreach(SWGUpdate* o, *arr) { delete o; } delete data; } } SWGInline_response_200_19* SWGInline_response_200_19::fromJson(QString &json) { QByteArray array (json.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); return this; } void SWGInline_response_200_19::fromJsonObject(QJsonObject &pJson) { setValue(&data, pJson["data"], "QList", "SWGUpdate"); setValue(&success, pJson["success"], "bool", ""); } QString SWGInline_response_200_19::asJson () { QJsonObject* obj = this->asJsonObject(); QJsonDocument doc(*obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject* SWGInline_response_200_19::asJsonObject() { QJsonObject* obj = new QJsonObject(); QList<SWGUpdate*>* dataList = data; QJsonArray dataJsonArray; toJsonArray((QList<void*>*)data, &dataJsonArray, "data", "SWGUpdate"); obj->insert("data", dataJsonArray); obj->insert("success", QJsonValue(success)); return obj; } QList<SWGUpdate*>* SWGInline_response_200_19::getData() { return data; } void SWGInline_response_200_19::setData(QList<SWGUpdate*>* data) { this->data = data; } bool SWGInline_response_200_19::getSuccess() { return success; } void SWGInline_response_200_19::setSuccess(bool success) { this->success = success; } } /* namespace Swagger */
gpl-2.0
Oliv95/DIT212-Project
Client/app/src/main/java/se/ice/client/utility/Constants.java
342
package se.ice.client.utility; /** * Created by Simon on 2016-05-17. * This class is intended to hold constants that are used in the whole app. */ public class Constants { public static final String SETTINGS_FILE = "settings"; public static final String EMAIL_FIELD = "email"; public static final String IS_ADMIN = "admin"; }
gpl-2.0
mtwstudios/comtor
unitTesting/simpletest/test/reflection_php4_test.php
2003
<?php // $Id: reflection_php4_test.php,v 1.1 2009-04-28 17:58:30 ssigwart Exp $ require_once(dirname(__FILE__) . '/../autorun.php'); class AnyOldThing { function aMethod() { } } class AnyOldChildThing extends AnyOldThing { } class TestOfReflection extends UnitTestCase { function testClassExistence() { $reflection = new SimpleReflection('AnyOldThing'); $this->assertTrue($reflection->classOrInterfaceExists()); $this->assertTrue($reflection->classOrInterfaceExistsSansAutoload()); } function testClassNonExistence() { $reflection = new SimpleReflection('UnknownThing'); $this->assertFalse($reflection->classOrInterfaceExists()); $this->assertFalse($reflection->classOrInterfaceExistsSansAutoload()); } function testDetectionOfInterfacesAlwaysFalse() { $reflection = new SimpleReflection('AnyOldThing'); $this->assertFalse($reflection->isAbstract()); $this->assertFalse($reflection->isInterface()); } function testFindingParentClass() { $reflection = new SimpleReflection('AnyOldChildThing'); $this->assertEqual(strtolower($reflection->getParent()), 'anyoldthing'); } function testMethodsListFromClass() { $reflection = new SimpleReflection('AnyOldThing'); $methods = $reflection->getMethods(); $this->assertEqualIgnoringCase($methods[0], 'aMethod'); } function testNoInterfacesForPHP4() { $reflection = new SimpleReflection('AnyOldThing'); $this->assertEqual( $reflection->getInterfaces(), array()); } function testMostGeneralPossibleSignature() { $reflection = new SimpleReflection('AnyOldThing'); $this->assertEqualIgnoringCase( $reflection->getSignature('aMethod'), 'function &aMethod()'); } function assertEqualIgnoringCase($a, $b) { return $this->assertEqual(strtolower($a), strtolower($b)); } } ?>
gpl-2.0
ssxenon01/mm
resources/plugins/sabai/lib/Sabai/Platform/WordPress/comments_template.php
104
<?php // This is a dummy file for WordPress to include when displaying comments on Sabai WordPress pages
gpl-2.0
davidguillemet/fashionphotosub
administrator/components/com_sh404sef/views/urls/view.html.php
7550
<?php /** * sh404SEF - SEO extension for Joomla! * * @author Yannick Gaultier * @copyright (c) Yannick Gaultier 2014 * @package sh404SEF * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL * @version 4.4.6.2271 * @date 2014-11-03 */ // Security check to ensure this file is being included by a parent file. if (!defined('_JEXEC')) die('Direct Access to this location is not allowed.'); jimport('joomla.application.component.view'); class Sh404sefViewUrlsBase extends ShlMvcView_Base { // we are in 'urls' view protected $_context = 'urls'; public function display($tpl = null) { // version prefix $this->joomlaVersionPrefix = Sh404sefHelperGeneral::getJoomlaVersionPrefix(); $this->footerText = JText::sprintf('COM_SH404SEF_FOOTER_' . strtoupper(Sh404sefConfigurationEdition::$id), Sh404sefFactory::getConfig()->version, Sh404sefConfigurationEdition::$name, date('Y')); // get model and update context with current $model = $this->getModel(); $context = $model->setContext($this->_context . '.' . $this->getLayout()); // display type: simple for very large sites/slow slq servers $sefConfig = Sh404sefFactory::getConfig(); // if set for a slowServer, display simplified version of the url manager $this->slowServer = $sefConfig->slowServer; // read data from model $list = $model ->getList((object) array('layout' => $this->getLayout(), 'simpleUrlList' => $this->slowServer, 'slowServer' => $sefConfig->slowServer)); // and push it into the view for display $this->items = $list; $this->itemCount = count($this->items); $this->pagination = $model ->getPagination( (object) array('layout' => $this->getLayout(), 'simpleUrlList' => $this->slowServer, 'slowServer' => $sefConfig->slowServer)); $options = $model->getDisplayOptions(); $this->options = $options; if (version_compare(JVERSION, '3.0', 'ge')) { $document = JFactory::getDocument(); // add our own css JHtml::styleSheet(Sh404sefHelperGeneral::getComponentUrl() . '/assets/css/' . $this->joomlaVersionPrefix . '_list.css'); JHtml::script(Sh404sefHelperGeneral::getComponentUrl() . '/assets/js/j3.js'); // add modal css and js ShlHtmlBs_helper::addBootstrapCss(JFactory::getDocument()); ShlHtmlBs_helper::addBootstrapJs(JFactory::getDocument()); // variable for modal, not used in 3..x+ $params = array(); // add display filters $this->_addFilters(); // render submenu sidebar $this->sidebar = Sh404sefHelperHtml::renderSubmenu(); } else { // add our own css //JHtml::styleSheet(Sh404sefHelperGeneral::getComponentUrl() . '/assets/css/' . $this->joomlaVersionPrefix . '_urls.css'); JHtml::styleSheet(Sh404sefHelperGeneral::getComponentUrl() . '/assets/css/list.css'); // link to custom javascript JHtml::script(Sh404sefHelperGeneral::getComponentUrl() . '/assets/js/list.js'); // add behaviors and styles as needed $modalSelector = 'a.modalediturl'; $js = '\\function(){window.parent.shAlreadySqueezed = false;if(window.parent.shReloadModal) {parent.window.location=\'' . $this->defaultRedirectUrl . '\';window.parent.shReloadModal=true}}'; $params = array('overlayOpacity' => 0, 'classWindow' => 'sh404sef-popup', 'classOverlay' => 'sh404sef-popup', 'onClose' => $js); Sh404sefHelperHtml::modal($modalSelector, $params); $this->optionsSelect = $this->_makeOptionsSelect($options); } // build the toolbar $toolbarMethod = '_makeToolbar' . ucfirst($this->getLayout() . ucfirst($this->joomlaVersionPrefix)); if (is_callable(array($this, $toolbarMethod))) { $this->$toolbarMethod($params); } // now display normally parent::display($this->joomlaVersionPrefix); } protected function _makeOptionsSelect($options) { $selects = $this->_doMakeOptionsSelect($options); // return set of select lists return $selects; } protected function _addFilters() { $this->_doAddFilters(); } protected function _doMakeOptionsSelect($options) { $selects = new StdClass(); // component list $current = $options->filter_component; $name = 'filter_component'; $selectAllTitle = JText::_('COM_SH404SEF_ALL_COMPONENTS'); $selects->components = Sh404sefHelperHtml::buildComponentsSelectList($current, $name, $autoSubmit = true, $addSelectAll = true, $selectAllTitle); // language list $current = $options->filter_language; $name = 'filter_language'; $selectAllTitle = JText::_('COM_SH404SEF_ALL_LANGUAGES'); $selects->languages = Sh404sefHelperHtml::buildLanguagesSelectList($current, $name, $autoSubmit = true, $addSelectAll = true, $selectAllTitle); // select duplicates $current = $options->filter_duplicate; $name = 'filter_duplicate'; $selectAllTitle = JText::_('COM_SH404SEF_ALL_DUPLICATES'); $data = array(array('id' => Sh404sefHelperGeneral::COM_SH404SEF_ONLY_DUPLICATES, 'title' => JText::_('COM_SH404SEF_ONLY_DUPLICATES')), array('id' => Sh404sefHelperGeneral::COM_SH404SEF_NO_DUPLICATES, 'title' => JText::_('COM_SH404SEF_ONLY_NO_DUPLICATES'))); $selects->filter_duplicate = Sh404sefHelperHtml::buildSelectList($data, $current, $name, $autoSubmit = true, $addSelectAll = true, $selectAllTitle); // select aliases $current = $options->filter_alias; $name = 'filter_alias'; $selectAllTitle = JText::_('COM_SH404SEF_ALL_ALIASES'); $data = array(array('id' => Sh404sefHelperGeneral::COM_SH404SEF_ONLY_ALIASES, 'title' => JText::_('COM_SH404SEF_ONLY_ALIASES')), array('id' => Sh404sefHelperGeneral::COM_SH404SEF_NO_ALIASES, 'title' => JText::_('COM_SH404SEF_ONLY_NO_ALIASES'))); $selects->filter_alias = Sh404sefHelperHtml::buildSelectList($data, $current, $name, $autoSubmit = true, $addSelectAll = true, $selectAllTitle); // select custom $current = $options->filter_url_type; $name = 'filter_url_type'; $selectAllTitle = JText::_('COM_SH404SEF_ALL_URL_TYPES'); $data = array(array('id' => Sh404sefHelperGeneral::COM_SH404SEF_ONLY_CUSTOM, 'title' => JText::_('COM_SH404SEF_ONLY_CUSTOM')), array('id' => Sh404sefHelperGeneral::COM_SH404SEF_ONLY_AUTO, 'title' => JText::_('COM_SH404SEF_ONLY_AUTO'))); $selects->filter_url_type = Sh404sefHelperHtml::buildSelectList($data, $current, $name, $autoSubmit = true, $addSelectAll = true, $selectAllTitle); // return set of select lists return $selects; } protected function _doAddFilters() { // component selector JHtmlSidebar::addFilter(JText::_('COM_SH404SEF_ALL_COMPONENTS'), 'filter_component', JHtml::_('select.options', Sh404sefHelperGeneral::getComponentsList(), 'element', 'name', $this->options->filter_component, true)); // language list $languages = JHtml::_('contentlanguage.existing', $all = false, $translate = true); foreach($languages as $id => $language) { // this will be used to filter short codes in urls // so we keep only the short code, not the full language code $languages[$id]->value = Sh404sefHelperLanguage::getUrlCodeFromTag($languages[$id]->value); } JHtmlSidebar::addFilter(JText::_('COM_SH404SEF_ALL_LANGUAGES'), 'filter_language', JHtml::_('select.options', $languages, 'value', 'text', $this->options->filter_language, false)); } } // now include version (lite/pro) specific things include_once str_replace('.php', '.' . Sh404sefConfigurationEdition::$id . '.php', basename(__FILE__));
gpl-2.0
db89/php-redis
example/rpop.php
519
<?php /* * 函数: rpop * 描述: 返回和移除列表的最后一个元素 * 参数: key * 返回值: 成功返回最后一个元素的值 ,失败返回false. * * author: DuBin * mail: db89@163.com * blog: http://blog.db89.org * */ $redis = new redis(); $redis -> connect('127.0.0.1', 6379); $redis -> delete('name'); $redis->lpush('name', "DuBin"); $redis->lpush('name', "LWP"); $redis->rpush('name', "DJM"); $redis->rpush('name', "CLL"); var_dump($redis->rpop('name')); //返回:CLL ?>
gpl-2.0
iammyr/Benchmark
src/main/java/org/owasp/benchmark/testcode/BenchmarkTest18523.java
2899
/** * OWASP Benchmark Project v1.1 * * This file is part of the Open Web Application Security Project (OWASP) * Benchmark Project. For details, please see * <a href="https://www.owasp.org/index.php/Benchmark">https://www.owasp.org/index.php/Benchmark</a>. * * The Benchmark 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, version 2. * * The Benchmark 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 * * @author Nick Sanidas <a href="https://www.aspectsecurity.com">Aspect Security</a> * @created 2015 */ package org.owasp.benchmark.testcode; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet("/BenchmarkTest18523") public class BenchmarkTest18523 extends HttpServlet { private static final long serialVersionUID = 1L; @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } @Override public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { org.owasp.benchmark.helpers.SeparateClassRequest scr = new org.owasp.benchmark.helpers.SeparateClassRequest( request ); String param = scr.getTheParameter("foo"); String bar = doSomething(param); try { javax.crypto.Cipher c = javax.crypto.Cipher.getInstance("RSA/ECB/PKCS1Padding", "SunJCE"); } catch (java.security.NoSuchAlgorithmException e) { System.out.println("Problem executing crypto - javax.crypto.Cipher.getInstance(java.lang.String,java.lang.String) Test Case"); throw new ServletException(e); } catch (java.security.NoSuchProviderException e) { System.out.println("Problem executing crypto - javax.crypto.Cipher.getInstance(java.lang.String,java.lang.String) Test Case"); throw new ServletException(e); } catch (javax.crypto.NoSuchPaddingException e) { System.out.println("Problem executing crypto - javax.crypto.Cipher.getInstance(java.lang.String,java.lang.String) Test Case"); throw new ServletException(e); } response.getWriter().println("Crypto Test javax.crypto.Cipher.getInstance(java.lang.String,java.lang.String) executed"); } // end doPost private static String doSomething(String param) throws ServletException, IOException { String bar; // Simple ? condition that assigns constant to bar on true condition int i = 106; bar = (7*18) + i > 200 ? "This_should_always_happen" : param; return bar; } }
gpl-2.0
gnuitar/gnuitar
src/preferences.cpp
1341
#include <gnu-guitar-qt/preferences.hpp> #include <gnu-guitar-qt/api-preferences.hpp> #include <gnu-guitar-qt/driver-preferences.hpp> #include <gnu-guitar/gui/api-settings.hpp> #include <QTabWidget> #include <QVBoxLayout> namespace GnuGuitar { namespace Qt { Preferences::Preferences(QWidget *parent) : QDialog(parent) { setWindowTitle("Preferences"); driverPreferences = new DriverPreferences(this); apiPreferences = new ApiPreferences(this); tabWidget = new QTabWidget(this); tabWidget->addTab(apiPreferences, "API"); tabWidget->addTab(driverPreferences, "Driver"); layout = new QVBoxLayout(this); layout->addWidget(tabWidget); setLayout(layout); } Preferences::~Preferences() { if (apiPreferences != nullptr) { delete apiPreferences; apiPreferences = nullptr; } if (driverPreferences != nullptr) { delete driverPreferences; driverPreferences = nullptr; } if (tabWidget != nullptr) { delete tabWidget; tabWidget = nullptr; } if (layout != nullptr) { delete layout; layout = nullptr; } } void Preferences::addApi(const Gui::ApiSettings &apiSettings) { apiPreferences->addApi(apiSettings); } void Preferences::getSelectedApi(Gui::ApiSettings &apiSettings) const { apiPreferences->getSelectedApi(apiSettings); } } // namespace Qt } // namespace GnuGuitar
gpl-2.0
jchevrie/visp
modules/core/src/math/matrix/vpMatrix_qr.cpp
25241
/**************************************************************************** * * This file is part of the ViSP software. * Copyright (C) 2005 - 2017 by Inria. All rights reserved. * * This software 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. * See the file LICENSE.txt at the root directory of this source * distribution for additional information about the GNU GPL. * * For using ViSP with software that can not be combined with the GNU * GPL, please contact Inria about acquiring a ViSP Professional * Edition License. * * See http://visp.inria.fr for more information. * * This software was developed at: * Inria Rennes - Bretagne Atlantique * Campus Universitaire de Beaulieu * 35042 Rennes Cedex * France * * If you have questions regarding the use of this file, please contact * Inria at visp@inria.fr * * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * Description: * Matrix QR decomposition. * * Authors: * Filip Novotny * *****************************************************************************/ #include <algorithm> // for (std::min) and (std::max) #include <visp3/core/vpConfig.h> #include <visp3/core/vpColVector.h> #include <visp3/core/vpMath.h> #include <visp3/core/vpMatrix.h> // Exception #include <visp3/core/vpException.h> #include <visp3/core/vpMatrixException.h> // Debug trace #include <visp3/core/vpDebug.h> #ifndef DOXYGEN_SHOULD_SKIP_THIS #ifdef VISP_HAVE_LAPACK #ifdef VISP_HAVE_LAPACK_BUILT_IN typedef long int integer; #else typedef int integer; #endif extern "C" int dgeqrf_(integer *m, integer *n, double *a, integer *lda, double *tau, double *work, integer *lwork, integer *info); extern "C" int dormqr_(char *side, char *trans, integer *m, integer *n, integer *k, double *a, integer *lda, double *tau, double *c__, integer *ldc, double *work, integer *lwork, integer *info); extern "C" int dorgqr_(integer *, integer *, integer *, double *, integer *, double *, double *, integer *, integer *); extern "C" int dtrtri_(char *uplo, char *diag, integer *n, double *a, integer *lda, integer *info); extern "C" int dgeqp3_(integer *m, integer *n, double*a, integer *lda, integer *p, double *tau, double *work, integer* lwork, integer *info); int allocate_work(double **work); int allocate_work(double **work) { unsigned int dimWork = (unsigned int)((*work)[0]); delete[] * work; *work = new double[dimWork]; return (int)dimWork; } #endif #ifdef VISP_HAVE_LAPACK /*! Compute the inverse of a n-by-n matrix using the QR decomposition with Lapack 3rd party. \return The inverse matrix. Here an example: \code #include <visp3/core/vpMatrix.h> int main() { vpMatrix A(4,4); A[0][0] = 1/1.; A[0][1] = 1/2.; A[0][2] = 1/3.; A[0][3] = 1/4.; A[1][0] = 1/5.; A[1][1] = 1/3.; A[1][2] = 1/3.; A[1][3] = 1/5.; A[2][0] = 1/6.; A[2][1] = 1/4.; A[2][2] = 1/2.; A[2][3] = 1/6.; A[3][0] = 1/7.; A[3][1] = 1/5.; A[3][2] = 1/6.; A[3][3] = 1/7.; // Compute the inverse vpMatrix A_1 = A.inverseByQRLapack(); std::cout << "Inverse by QR: \n" << A_1 << std::endl; std::cout << "A*A^-1: \n" << A * A_1 << std::endl; } \endcode \sa inverseByQR() */ vpMatrix vpMatrix::inverseByQRLapack() const { if (rowNum != colNum) { throw(vpMatrixException(vpMatrixException::matrixError, "Cannot inverse a non-square matrix (%ux%u) by QR", rowNum, colNum)); } integer rowNum_ = (integer)this->getRows(); integer colNum_ = (integer)this->getCols(); integer lda = (integer)rowNum_; // lda is the number of rows because we don't use a submatrix integer dimTau = (std::min)(rowNum_, colNum_); integer dimWork = -1; double *tau = new double[dimTau]; double *work = new double[1]; integer info; vpMatrix C; vpMatrix A = *this; try { // 1) Extract householder reflections (useful to compute Q) and R dgeqrf_(&rowNum_, // The number of rows of the matrix A. M >= 0. &colNum_, // The number of columns of the matrix A. N >= 0. A.data, /*On entry, the M-by-N matrix A. On exit, the elements on and above the diagonal of the array contain the min(M,N)-by-N upper trapezoidal matrix R (R is upper triangular if m >= n); the elements below the diagonal, with the array TAU, represent the orthogonal matrix Q as a product of min(m,n) elementary reflectors. */ &lda, // The leading dimension of the array A. LDA >= max(1,M). tau, /*Dimension (min(M,N)) The scalar factors of the elementary reflectors */ work, // Internal working array. dimension (MAX(1,LWORK)) &dimWork, // The dimension of the array WORK. LWORK >= max(1,N). &info // status ); if (info != 0) { std::cout << "dgeqrf_:Preparation:" << -info << "th element had an illegal value" << std::endl; throw vpMatrixException::badValue; } dimWork = allocate_work(&work); dgeqrf_(&rowNum_, // The number of rows of the matrix A. M >= 0. &colNum_, // The number of columns of the matrix A. N >= 0. A.data, /*On entry, the M-by-N matrix A. On exit, the elements on and above the diagonal of the array contain the min(M,N)-by-N upper trapezoidal matrix R (R is upper triangular if m >= n); the elements below the diagonal, with the array TAU, represent the orthogonal matrix Q as a product of min(m,n) elementary reflectors. */ &lda, // The leading dimension of the array A. LDA >= max(1,M). tau, /*Dimension (min(M,N)) The scalar factors of the elementary reflectors */ work, // Internal working array. dimension (MAX(1,LWORK)) &dimWork, // The dimension of the array WORK. LWORK >= max(1,N). &info // status ); if (info != 0) { std::cout << "dgeqrf_:" << -info << "th element had an illegal value" << std::endl; throw vpMatrixException::badValue; } // A now contains the R matrix in its upper triangular (in lapack // convention) C = A; // 2) Invert R dtrtri_((char *)"U", (char *)"N", &dimTau, C.data, &lda, &info); if (info != 0) { if (info < 0) std::cout << "dtrtri_:" << -info << "th element had an illegal value" << std::endl; else if (info > 0) { std::cout << "dtrtri_:R(" << info << "," << info << ")" << " is exactly zero. The triangular matrix is singular " "and its inverse can not be computed." << std::endl; std::cout << "R=" << std::endl << C << std::endl; } throw vpMatrixException::badValue; } // 3) Zero-fill R^-1 // the matrix is upper triangular for lapack but lower triangular for visp // we fill it with zeros above the diagonal (where we don't need the // values) for (unsigned int i = 0; i < C.getRows(); i++) for (unsigned int j = 0; j < C.getRows(); j++) if (j > i) C[i][j] = 0.; dimWork = -1; integer ldc = lda; // 4) Transpose Q and left-multiply it by R^-1 // get R^-1*tQ // C contains R^-1 // A contains Q dormqr_((char *)"R", (char *)"T", &rowNum_, &colNum_, &dimTau, A.data, &lda, tau, C.data, &ldc, work, &dimWork, &info); if (info != 0) { std::cout << "dormqr_:Preparation" << -info << "th element had an illegal value" << std::endl; throw vpMatrixException::badValue; } dimWork = allocate_work(&work); dormqr_((char *)"R", (char *)"T", &rowNum_, &colNum_, &dimTau, A.data, &lda, tau, C.data, &ldc, work, &dimWork, &info); if (info != 0) { std::cout << "dormqr_:" << -info << "th element had an illegal value" << std::endl; throw vpMatrixException::badValue; } delete[] tau; delete[] work; } catch (vpMatrixException &) { delete[] tau; delete[] work; throw; } return C; } #endif #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS /*! Compute the inverse of a n-by-n matrix using the QR decomposition. Only available if Lapack 3rd party is installed. If Lapack is not installed we use a Lapack built-in version. \return The inverse matrix. Here an example: \code #include <visp3/core/vpMatrix.h> int main() { vpMatrix A(4,4); A[0][0] = 1/1.; A[0][1] = 1/2.; A[0][2] = 1/3.; A[0][3] = 1/4.; A[1][0] = 1/5.; A[1][1] = 1/3.; A[1][2] = 1/3.; A[1][3] = 1/5.; A[2][0] = 1/6.; A[2][1] = 1/4.; A[2][2] = 1/2.; A[2][3] = 1/6.; A[3][0] = 1/7.; A[3][1] = 1/5.; A[3][2] = 1/6.; A[3][3] = 1/7.; // Compute the inverse vpMatrix A_1 = A.inverseByQR(); std::cout << "Inverse by QR: \n" << A_1 << std::endl; std::cout << "A*A^-1: \n" << A * A_1 << std::endl; } \endcode \sa inverseByLU(), inverseByCholesky() */ vpMatrix vpMatrix::inverseByQR() const { #ifdef VISP_HAVE_LAPACK return inverseByQRLapack(); #else throw(vpException(vpException::fatalError, "Cannot inverse matrix by QR. Install Lapack 3rd party")); #endif } /*! Compute the QR decomposition of a (m x n) matrix of rank r. Only available if Lapack 3rd party is installed. If Lapack is not installed we use a Lapack built-in version. \param Q : orthogonal matrix (will be modified). \param R : upper-triangular matrix (will be modified). \param full : whether or not we want full decomposition. \param squareR : will return only the square (min(m,n) x min(m,n)) part of R. \param tol : tolerance to test the rank of R. \return The rank r of the matrix. If full is false (default) then Q is (m x min(n,m)) and R is (min(n,m) x n). We then have this = QR. If full is true and m > n then Q is (m x m) and R is (n x n). In this case this = Q (R, 0)^T If squareR is true and n > m then R is (m x m). If r = m then R is invertible. Here an example: \code #include <visp3/core/vpMatrix.h> double residual(vpMatrix M1, vpMatrix M2) { return (M1 - M2).euclideanNorm(); } int main() { vpMatrix A(4,3); A[0][0] = 1/1.; A[0][1] = 1/2.; A[0][2] = 1/3.; A[1][0] = 1/5.; A[1][1] = 1/3.; A[1][2] = 1/3.; A[2][0] = 1/6.; A[2][1] = 1/4.; A[2][2] = 1/2.; A[3][0] = 1/7.; A[3][1] = 1/5.; A[3][2] = 1/6.; // Economic QR (Q 4x3, R 3x3) vpMatrix Q, R; int r = A.qr(A, R); std::cout << "QR Residual: " << residual(A, Q*R) << std::endl; // Full QR (Q 4x4, R 3x3) r = A.qr(Q, R, true); std::cout << "Full QR Residual: " << residual(A, Q.extract(0, 0, 4, 3)*R) << std::endl; } \endcode \sa qrPivot() */ unsigned int vpMatrix::qr(vpMatrix &Q, vpMatrix &R, bool full, bool squareR, double tol) const { #ifdef VISP_HAVE_LAPACK integer m = (integer) rowNum; // also rows of Q integer n = (integer) colNum; // also columns of R integer r = std::min(n,m); // a priori non-null rows of R = rank of R integer q = r; // columns of Q and rows of R integer na = n; // columns of A // cannot be full decomposition if m < n if(full && m > n) { q = m; // Q is square na = m; // A is square } // prepare matrices and deal with r = 0 Q.resize(m,q); if(squareR) R.resize(r,r); else R.resize(r,n); if(r == 0) return 0; integer dimWork = -1; double * qrdata = new double[m*na]; double *tau = new double[std::min(m,q)]; double *work = new double[1]; integer info; // copy this to qrdata in Lapack convention for(int i = 0; i < m; ++i) { for(int j = 0; j < n; ++j) qrdata[i+m*j] = data[j + n*i]; for(int j = n; j < na; ++j) qrdata[i+m*j] = 0; } // work = new double[1]; //1) Extract householder reflections (useful to compute Q) and R dgeqrf_( &m, //The number of rows of the matrix A. M >= 0. &na, //The number of columns of the matrix A. N >= 0. qrdata, &m, tau, work, //Internal working array. dimension (MAX(1,LWORK)) &dimWork, //The dimension of the array WORK. LWORK >= max(1,N). &info //status ); if(info != 0){ std::cout << "dgeqrf_:Preparation:" << -info << "th element had an illegal value" << std::endl; delete[] qrdata; delete[] work; delete[] tau; throw vpMatrixException::badValue; } dimWork = allocate_work(&work); dgeqrf_( &m, //The number of rows of the matrix A. M >= 0. &na, //The number of columns of the matrix A. N >= 0. qrdata, &m, //The leading dimension of the array A. LDA >= max(1,M). tau, work, //Internal working array. dimension (MAX(1,LWORK)) &dimWork, //The dimension of the array WORK. LWORK >= max(1,N). &info //status ); if(info != 0){ std::cout << "dgeqrf_:" << -info << "th element had an illegal value" << std::endl; delete[] qrdata; delete[] work; delete[] tau; throw vpMatrixException::badValue; } // data now contains the R matrix in its upper triangular (in lapack convention) // copy useful part of R from Q and update rank na = std::min(m,n); if(squareR) { for(int i=0;i<na;i++) { for(int j=i;j<na;j++) R[i][j] = qrdata[i+m*j]; if(std::abs(qrdata[i+m*i]) < tol) r--; } } else { for(int i=0;i<na;i++) { for(int j=i;j<n;j++) R[i][j] = qrdata[i+m*j]; if(std::abs(qrdata[i+m*i]) < tol) r--; } } // extract Q dorgqr_(&m, // The number of rows of the matrix Q. M >= 0. &q, // The number of columns of the matrix Q. M >= N >= 0. &q, qrdata, &m, //The leading dimension of the array A. LDA >= max(1,M). tau, work, //Internal working array. dimension (MAX(1,LWORK)) &dimWork, //The dimension of the array WORK. LWORK >= max(1,N). &info //status ); // write qrdata into Q for(int i = 0; i < m; ++i) for(int j = 0; j < q; ++j) Q[i][j] = qrdata[i+m*j]; delete[] qrdata; delete[] work; delete[] tau; return (unsigned int) r; #else (void)Q; (void)R; (void)full; (void)squareR; (void)tol; throw(vpException(vpException::fatalError, "Cannot perform QR decomposition. Install Lapack 3rd party")); #endif } /*! Compute the QR pivot decomposition of a (m x n) matrix of rank r. Only available if Lapack 3rd party is installed. If Lapack is not installed we use a Lapack built-in version. \param Q : orthogonal matrix (will be modified). \param R : upper-triangular matrix (will be modified). \param P : the (n x n) permutation matrix. \param full : whether or not we want full decomposition. \param squareR : will return only the (r x r) part of R and the (r x n) part of P. \param tol : tolerance to test the rank of R. \return The rank r of the matrix. If full is false (default) then Q is (m x min(n,m)) and R is (min(n,m) x n). We then have this.P = Q.R. If full is true and m > n then Q is (m x m) and R is (n x n). In this case this.P = Q (R, 0)^T If squareR is true then R is (r x r) invertible. Here an example: \code #include <visp3/core/vpMatrix.h> double residual(vpMatrix M1, vpMatrix M2) { return (M1 - M2).euclideanNorm(); } int main() { vpMatrix A(4,3); A[0][0] = 1/1.; A[0][1] = 1/2.; A[0][2] = 1/2.; A[1][0] = 1/5.; A[1][1] = 1/3.; A[1][2] = 1/3.; A[2][0] = 1/6.; A[2][1] = 1/4.; A[2][2] = 1/4.; A[3][0] = 1/7.; A[3][1] = 1/5.; A[3][2] = 1/5.; // A is rank (4x3) but rank 2 // Economic QR (Q 4x3, R 3x3) vpMatrix Q, R, P; int r = A.qrPivot(Q, R, P); std::cout << "A rank: " << r << std::endl; std::cout << "Residual: " << residual(A*P, Q*R) << std::endl; // Full QR (Q 4x4, R 3x3) r = A.qrPivot(Q, R, P, true); std::cout << "QRPivot Residual: " << residual(A*P, Q.extract(0, 0, 4, 3)*R) << std::endl; // Using permutation matrix: keep only non-null part of R Q.resize(4, r, false); // Q is 4 x 2 R = R.extract(0, 0, r, 3)*P.t(); // R is 2 x 3 std::cout << "Full QRPivot Residual: " << residual(A, Q*R) << std::endl; } \endcode \sa qrPivot() */ unsigned int vpMatrix::qrPivot(vpMatrix &Q, vpMatrix &R, vpMatrix &P, bool full, bool squareR, double tol) const { #ifdef VISP_HAVE_LAPACK integer m = (integer) rowNum; // also rows of Q integer n = (integer) colNum; // also columns of R integer r = std::min(n,m); // a priori non-null rows of R = rank of R integer q = r; // columns of Q and rows of R integer na = n; // cannot be full decomposition if m < n if(full && m > n) { q = m; // Q is square na = m; } // prepare Q and deal with r = 0 Q.resize(m, q); if(r == 0) { if(squareR) { R.resize(0, 0); P.resize(0, n); } else { R.resize(r, n); P.resize(n, n); } return 0; } integer dimWork = -1; double* qrdata = new double[m*na]; double* tau = new double[std::min(q,m)]; double* work = new double[1]; integer* p = new integer[na]; for(int i = 0; i < na; ++i) p[i] = 0; integer info; // copy this to qrdata in Lapack convention for(int i = 0; i < m; ++i) { for(int j = 0; j < n; ++j) qrdata[i+m*j] = data[j + n*i]; for(int j = n; j < na; ++j) qrdata[i+m*j] = 0; } //1) Extract householder reflections (useful to compute Q) and R dgeqp3_( &m, //The number of rows of the matrix A. M >= 0. &na, //The number of columns of the matrix A. N >= 0. qrdata, /*On entry, the M-by-N matrix A. */ &m, //The leading dimension of the array A. LDA >= max(1,M). p, // Dimension N tau, /*Dimension (min(M,N)) */ work, //Internal working array. dimension (3*N) &dimWork, &info //status ); if(info != 0){ std::cout << "dgeqp3_:Preparation:" << -info << "th element had an illegal value" << std::endl; delete[] qrdata; delete[] work; delete[] tau; delete[] p; throw vpMatrixException::badValue; } dimWork = allocate_work(&work); dgeqp3_( &m, //The number of rows of the matrix A. M >= 0. &na, //The number of columns of the matrix A. N >= 0. qrdata, /*On entry, the M-by-N matrix A. */ &m, //The leading dimension of the array A. LDA >= max(1,M). p, // Dimension N tau, /*Dimension (min(M,N)) */ work, //Internal working array. dimension (3*N) &dimWork, &info //status ); if(info != 0){ std::cout << "dgeqp3_:" << -info << " th element had an illegal value" << std::endl; delete[] qrdata; delete[] work; delete[] tau; delete[] p; throw vpMatrixException::badValue; } // data now contains the R matrix in its upper triangular (in lapack convention) // get rank of R in r na = std::min(n,m); for(int i = 0; i < na; ++i) if(std::abs(qrdata[i+m*i]) < tol) r--; // write R if(squareR) // R r x r { R.resize(r, r); for(int i=0;i<r;i++) for(int j=i;j<r;j++) R[i][j] = qrdata[i+m*j]; // write P P.resize(r,n); for(int i = 0; i < r; ++i) P[i][p[i]-1] = 1; } else // R is min(m,n) x n of rank r { R.resize(na, n); for(int i=0;i<na;i++) for(int j=i;j<n;j++) R[i][j] = qrdata[i+m*j]; // write P P.resize(n,n); for(int i = 0; i < n; ++i) P[i][p[i]-1] = 1; } // extract Q dorgqr_(&m, // The number of rows of the matrix Q. M >= 0. &q, // The number of columns of the matrix Q. M >= N >= 0. &q, qrdata, &m, //The leading dimension of the array A. LDA >= max(1,M). tau, work, //Internal working array. dimension (MAX(1,LWORK)) &dimWork, //The dimension of the array WORK. LWORK >= max(1,N). &info //status ); // write qrdata into Q for(int i = 0; i < m; ++i) for(int j = 0; j < q; ++j) Q[i][j] = qrdata[i+m*j]; delete[] qrdata; delete[] work; delete[] tau; delete[] p; return (unsigned int) r; #else (void)Q; (void)R; (void)P; (void)full; (void)squareR; (void)tol; throw(vpException(vpException::fatalError, "Cannot perform QR decomposition. Install Lapack 3rd party")); #endif } /*! Compute the inverse of a full-rank n-by-n triangular matrix. Only available if Lapack 3rd party is installed. If Lapack is not installed we use a Lapack built-in version. \param upper : if it is an upper triangular matrix The function does not check if the matrix is actually upper or lower triangular. \return The inverse matrix */ vpMatrix vpMatrix::inverseTriangular(bool upper) const { #ifdef VISP_HAVE_LAPACK if(rowNum != colNum || rowNum == 0) throw vpMatrixException::dimensionError; integer n = (integer) rowNum; // lda is the number of rows because we don't use a submatrix vpMatrix R = *this; integer info; // we just use the other (upper / lower) method from Lapack if(rowNum > 1 && upper) // upper triangular dtrtri_((char *)"L", (char *)"N", &n, R.data, &n, &info); else dtrtri_((char *)"U", (char *)"N", &n, R.data, &n, &info); if (info != 0) { if (info < 0) std::cout << "dtrtri_:" << -info << "th element had an illegal value" << std::endl; else if (info > 0) { std::cout << "dtrtri_:R(" << info << "," << info << ")" << " is exactly zero. The triangular matrix is singular " "and its inverse can not be computed." << std::endl; throw vpMatrixException::rankDeficient; } throw vpMatrixException::badValue; } return R; #else (void)upper; throw(vpException(vpException::fatalError, "Cannot perform triangular inverse. Install Lapack 3rd party")); #endif } /*! Solve a linear system Ax = b using QR Decomposition. Non destructive wrt. A and b. \param b : Vector b \param x : Vector x \warning If Ax = b does not have a solution, this method does not return the least-square minimizer. Use solveBySVD() to get this vector. Here an example: \code #include <visp3/core/vpColVector.h> #include <visp3/core/vpMatrix.h> int main() { vpMatrix A(3,3); A[0][0] = 4.64; A[0][1] = 0.288; A[0][2] = -0.384; A[1][0] = 0.288; A[1][1] = 7.3296; A[1][2] = 2.2272; A[2][0] = -0.384; A[2][1] = 2.2272; A[2][2] = 6.0304; vpColVector X(3), B(3); B[0] = 1; B[1] = 2; B[2] = 3; A.solveByQR(B, X); // Obtained values of X // X[0] = 0.2468; // X[1] = 0.120782; // X[2] = 0.468587; std::cout << "X:\n" << X << std::endl; } \endcode \sa qrPivot() */ void vpMatrix::solveByQR(const vpColVector &b, vpColVector &x) const { vpMatrix Q, R, P; unsigned int r = t().qrPivot(Q, R, P, false, true); x = Q.extract(0, 0, colNum, r) * R.inverseTriangular().t() * P * b; } /*! Solve a linear system Ax = b using QR Decomposition. Non destructive wrt. A and B. \param b : Vector b \return Vector x \warning If Ax = b does not have a solution, this method does not return the least-square minimizer. Use solveBySVD() to get this vector. Here an example: \code #include <visp3/core/vpColVector.h> #include <visp3/core/vpMatrix.h> int main() { vpMatrix A(3,3); A[0][0] = 4.64; A[0][1] = 0.288; A[0][2] = -0.384; A[1][0] = 0.288; A[1][1] = 7.3296; A[1][2] = 2.2272; A[2][0] = -0.384; A[2][1] = 2.2272; A[2][2] = 6.0304; vpColVector X(3), B(3); B[0] = 1; B[1] = 2; B[2] = 3; X = A.solveByQR(B); // Obtained values of X // X[0] = 0.2468; // X[1] = 0.120782; // X[2] = 0.468587; std::cout << "X:\n" << X << std::endl; } \endcode \sa qrPivot() */ vpColVector vpMatrix::solveByQR(const vpColVector &b) const { vpColVector x(colNum); solveByQR(b, x); return x; }
gpl-2.0
Software-Design-2017/EmbelezaMais
EmbelezaMais/user/views.py
12686
# standard library import logging import hashlib import datetime import random import abc # Django from django.shortcuts import ( render, redirect, get_object_or_404 ) from django.core.mail import send_mail from django.utils import timezone from django.http import HttpResponse from django.contrib.auth.decorators import login_required from django.contrib import auth from django.views.generic import ( FormView, View ) # third part from geoposition.fields import Geoposition # local Django from .forms import ( ClientRegisterForm, CompanyRegisterForm, CompanyLoginForm, CompanyEditForm, ClientEditForm, ) from .models import ( Client, Company, UserProfile, User ) from . import constants logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger('EmbelezaMais') class ClientRegisterView(View): def register_client(request): form = ClientRegisterForm(request.POST or None) if form.is_valid(): logger.debug("Register form was valid.") email = form.cleaned_data.get('email') password = form.cleaned_data.get('password') name = form.cleaned_data.get('name') phone_number = form.cleaned_data.get('phone_number') Client.objects.create_user(email=email, password=password, name=name, phone_number=phone_number) user = Client.objects.get(email=email) return CountConfirmation.send_email_confirmation(user) else: logger.debug("Register form was invalid.") return render(request, "client_register_form.html", {"form": form}) class CompanyResgisterView(View): def register_company(request): form = CompanyRegisterForm(request.POST or None) if form.is_valid(): email = form.cleaned_data.get('email') password = form.cleaned_data.get('password') name = form.cleaned_data.get('name') description = form.cleaned_data.get('description') target_genre = form.cleaned_data.get('target_genre') has_parking_availability = form.cleaned_data.get('has_parking_availability') latitude = float(str(form.cleaned_data.get('latitude'))) longitude = float(str(form.cleaned_data.get('longitude'))) position = Geoposition(latitude, longitude) Company.objects.create_user(email=email, password=password, name=name, target_genre=target_genre, has_parking_availability=has_parking_availability, description=description, position=position) user = Company.objects.get(email=email) return CountConfirmation.send_email_confirmation(user) else: pass return render(request, "company_register_form.html", {"form": form}) class CountConfirmation(View): def send_email_confirmation(user): # Prepare the information needed to send the account verification # email. salt = hashlib.sha1(str(random.random()). encode('utf-8')).hexdigest()[:5] email = user.email activation_key = hashlib.sha1(str(salt+email). encode('utf‌​-8')).hexdigest() key_expires = datetime.datetime.today() + datetime.timedelta(2) new_profile = UserProfile(user=user, activation_key=activation_key, key_expires=key_expires) new_profile.save() # Send account confirmation email. email_subject = (constants.EMAIL_CONFIRMATION_SUBJECT) email_body = constants.EMAIL_CONFIRMATION_BODY % (activation_key) send_mail(email_subject, email_body, constants.EMBELEZAMAIS_EMAIL, [email], fail_silently=False) logger.info("Email sended to user.") return redirect('/') def register_confirm(request, activation_key): # Check if activation token is valid, if not valid return an 404 error. # Verify if user is already confirmed. if request.user.id is not None: logger.info("Logged user: " + request.user.name) HttpResponse('Conta ja confirmada') else: # Nothing to do pass user_profile = get_object_or_404(UserProfile, activation_key=activation_key) # Verifies if the activation token has expired and if so renders the html # of expired registration. if user_profile.key_expires < timezone.now(): user_profile.delete() return HttpResponse("Tempo para confirmar conta expirou." + "Crie sua conta novamente") else: # Nothing to do. pass # If the token has not expired, the user is activated and the # confirmation html is displayed. user = user_profile.user user.is_active = True user.save() return redirect('/') class ClientProfile(View): @login_required def client_profile(request, email): if request.method == "GET": client = Client.objects.get(email=email) logger.debug(client) else: client = Client() # args = {'company': company} return render(request, 'client_profile.html', {'client': client}) @login_required def client_edit_profile_view(request, email): logger.info("Entering edit client profile page.") client = Client.objects.get(email=email) form = ClientEditForm(request.POST or None, instance=request.user.client) if request.user.email == client.email: if request.method == "POST": logger.debug("Edit profile view request is POST.") if form.is_valid(): logger.debug("Valid edit form.") name = form.cleaned_data.get('name') phone_number = form.cleaned_data.get('phone_number') if len(name) != 0: client.name = name else: pass if len(phone_number) != 0: client.phone_number = phone_number else: pass client.save() return redirect('client_profile', email=email) else: logger.debug("Invalid edit form.") pass else: logger.debug("Edit profile view request is GET.") pass else: logger.debug("User can't edit other users information.") return HttpResponse("Oops! You don't have acess to this page.") return render(request, 'client_edit_profile_form.html', {'form': form, 'client': client}) class CompanyAction(View): def show_edit_button(visitor_email, current_user_email): editable_profile = False if current_user_email == visitor_email: logger.debug("Profile page should be editable") editable_profile = True else: logger.debug("Profile page shouldn't be editable.") # Nothing to do. return editable_profile @login_required def company_profile(request, email): if request.method == "GET": company = Company.objects.get(email=email) editable_profile = CompanyAction.show_edit_button(company.email, request.user.email) logger.debug(company) else: company = Company() return render(request, 'company_profile.html', {'company': company, 'editable_profile': editable_profile}) @login_required def delete_company_view(request, email): company = User.objects.get(email=email) logger.debug("Chegou aqui") company.delete() # TODO (Thiago)Create confirm delete page return redirect('/') @login_required def company_edit_profile_view(request, email): logger.info("Entering edit profile page.") company = Company.objects.get(email=email) form = CompanyEditForm(request.POST or None, instance=request.user.company) if request.user.email == company.email: if request.method == "POST": logger.debug("Edit profile view request is POST.") if form.is_valid(): logger.debug("Valid edit form.") name = form.cleaned_data.get('name') description = form.cleaned_data.get('description') target_genre = form.cleaned_data.get('target_genre') if len(name) != 0: company.name = name else: pass if len(target_genre) != 0: company.target_genre = target_genre else: pass if len(description) != 0: company.description = description else: pass company.save() return redirect('profile', email=email) else: logger.debug("Invalid edit form.") pass else: logger.debug("Edit profile view request is GET.") pass else: logger.debug("User can't edit other users information.") return HttpResponse("Oops! You don't have acess to this page.") return render(request, 'company_edit_profile_form.html', {'form': form, 'company': company}) def show_client_view(request): client = request.user return render(request, 'show_client_view.html', {'client': client}) def remove_client_view(request): client = request.user client.delete() return redirect('/') class LoginView(FormView): form_class = None template_name = None def get(self, request, *args, **kwargs): form = self.form_class(initial=self.initial) return render(request, self.template_name, {'form': form}) def post(self, request, *args, **kwargs): form = self.form_class(request.POST) if form.is_valid(): user = auth.authenticate( email=form.cleaned_data['email'], password=form.cleaned_data['password'], ) if user is not None: return self._verify_user_is_especific_type(request, user, form) else: return render(request, self.template_name, {'form': form, 'message': constants.MESSAGE_LOGIN_ERROR}) else: return render(request, self.template_name, {'form': form}) @abc.abstractmethod def _verify_user_is_especific_type(self, request, user): return class LoginCompanyView(LoginView): form_class = CompanyLoginForm template_name = 'login_company.html' message = None def _verify_user_is_especific_type(self, request, user, form): success_url = '/dashboard' is_company = hasattr(user, 'company') if is_company: if user.is_active: auth.login(request, user) return redirect(str(success_url)) else: return HttpResponse('User is not active') else: return render(request, self.template_name, {'form': form, 'message': constants.MESSAGE_LOGIN_COMPANY_ERROR}) # TODO(JOAO) CHANGE THE REDIRECT WHEN USER DON'T EXISTS class LoginClientView(LoginView): form_class = CompanyLoginForm template_name = 'login_client.html' message = None def _verify_user_is_especific_type(self, request, user, form): success_url = '/search' is_client = hasattr(user, 'client') if is_client: if user.is_active: auth.login(request, user) return redirect(str(success_url)) else: return HttpResponse('User is not active') else: message = 'Hey, parece que você não é um cliente.' return render(request, self.template_name, {'form': form, 'message': message}) class LogoutView(View): def get(self, request): auth.logout(request) return redirect('/')
gpl-2.0
blueantlabs/blueantlabs
wp-content/themes/blueantplate/home.php
1423
<?php get_header(); ?> <div id="home-content" class="home-img"> <ul> <li><a id="port-tfp" href="<?php bloginfo('url') ?>/portfolio" alt="The Future Project" > <img src="<?php bloginfo('url') ?>/wp-content/themes/blueantplate/img/port-wide/thefutureproject-605.png" /> </a></li> <li><a id="port-icurt" href="<?php bloginfo('url') ?>/portfolio" alt="iPhone Curt" > <img src="<?php bloginfo('url') ?>/wp-content/themes/blueantplate/img/port-wide/iphonecurt-605.png" /> </a></li> <li><a id="port-vside" href="<?php bloginfo('url') ?>/portfolio" alt="Villeside Promotions" > <img src="<?php bloginfo('url') ?>/wp-content/themes/blueantplate/img/port-wide/vside-605.png" /> </a></li> <li><a id="port-rlw" href="<?php bloginfo('url') ?>/portfolio" alt="Read Learn Write" > <img src="<?php bloginfo('url') ?>/wp-content/themes/blueantplate/img/port-wide/readlearnwrite-605.png" /> </a></li> <li><a id="port-theights" href="<?php bloginfo('url') ?>/portfolio" alt="Thetis Heights" > <img src="<?php bloginfo('url') ?>/wp-content/themes/blueantplate/img/port-wide/theights-605.png" /> </a></li> <li><a id="port-mobi" href="<?php bloginfo('url') ?>/portfolio" alt="mobiLIFE, Inc." > <img src="<?php bloginfo('url') ?>/wp-content/themes/blueantplate/img/port-wide/mobi-605.png" /> </a></li> </ul> </div> <?php get_footer(); ?>
gpl-2.0
Myvar/eStd
eStd/System.Parsing/Writers/Code/SequenceWriter.cs
444
using System; using System.Parsing.Parsers; namespace System.Parsing.Writers.Code { public class SequenceWriter : ListWriter<SequenceParser> { public override void WriteObject(System.Parsing.TextParserWriterArgs args, SequenceParser parser, string name) { base.WriteObject(args, parser, name); if (parser.Separator != null) args.Output.WriteLine("{0}.Separator = {1};", name, args.Write(parser.Separator)); } } }
gpl-2.0
314parley/SUPER-DUPER-HACKED-TOGETHER-COPYPASTA-SHITFEST-PENIS
dwoo/templates_c/media/dmu/parley/www/711chan.org/public_html/dwoo/templates/img_footer.tpl.d15.php
12976
<?php if (function_exists('smarty_block_t')===false) $this->getLoader()->loadPlugin('t'); if (function_exists('Dwoo_Plugin_include')===false) $this->getLoader()->loadPlugin('include'); ob_start(); /* template body */ ; if (! (isset($this->scope["isread"]) ? $this->scope["isread"] : null)) { ?> <table class="userdelete"> <tbody> <tr> <td> <?php if (!isset($_tag_stack)){ $_tag_stack = array(); } $_tag_stack[] = array(); $_block_repeat=true; smarty_block_t($_tag_stack[count($_tag_stack)-1], null, $this, $_block_repeat); while ($_block_repeat) { ob_start();?>Delete post<?php $_block_content = ob_get_clean(); $_block_repeat=false; echo smarty_block_t($_tag_stack[count($_tag_stack)-1], $_block_content, $this, $_block_repeat); } array_pop($_tag_stack);?> [<input type="checkbox" name="fileonly" id="fileonly" value="on" /><label for="fileonly"><?php if (!isset($_tag_stack)){ $_tag_stack = array(); } $_tag_stack[] = array(); $_block_repeat=true; smarty_block_t($_tag_stack[count($_tag_stack)-1], null, $this, $_block_repeat); while ($_block_repeat) { ob_start();?>File Only<?php $_block_content = ob_get_clean(); $_block_repeat=false; echo smarty_block_t($_tag_stack[count($_tag_stack)-1], $_block_content, $this, $_block_repeat); } array_pop($_tag_stack);?></label>]<br /><?php if (!isset($_tag_stack)){ $_tag_stack = array(); } $_tag_stack[] = array(); $_block_repeat=true; smarty_block_t($_tag_stack[count($_tag_stack)-1], null, $this, $_block_repeat); while ($_block_repeat) { ob_start();?>Password<?php $_block_content = ob_get_clean(); $_block_repeat=false; echo smarty_block_t($_tag_stack[count($_tag_stack)-1], $_block_content, $this, $_block_repeat); } array_pop($_tag_stack);?> <input type="password" name="postpassword" size="8" />&nbsp;<input name="deletepost" value="<?php if (!isset($_tag_stack)){ $_tag_stack = array(); } $_tag_stack[] = array(); $_block_repeat=true; smarty_block_t($_tag_stack[count($_tag_stack)-1], null, $this, $_block_repeat); while ($_block_repeat) { ob_start();?>Delete<?php $_block_content = ob_get_clean(); $_block_repeat=false; echo smarty_block_t($_tag_stack[count($_tag_stack)-1], $_block_content, $this, $_block_repeat); } array_pop($_tag_stack);?>" type="submit" /> <?php if ((isset($this->scope["board"]["enablereporting"]) ? $this->scope["board"]["enablereporting"]:null) == 1) { ?> </td> </tr> <tr> <td> <?php if (!isset($_tag_stack)){ $_tag_stack = array(); } $_tag_stack[] = array(); $_block_repeat=true; smarty_block_t($_tag_stack[count($_tag_stack)-1], null, $this, $_block_repeat); while ($_block_repeat) { ob_start();?>Report post<?php if (!isset($_tag_stack)){ $_tag_stack = array(); } $_tag_stack[] = array(); $_block_repeat=true; smarty_block_t($_tag_stack[count($_tag_stack)-1], null, $this, $_block_repeat); while ($_block_repeat) { ob_start();?><br /> <?php if (!isset($_tag_stack)){ $_tag_stack = array(); } $_tag_stack[] = array(); $_block_repeat=true; smarty_block_t($_tag_stack[count($_tag_stack)-1], null, $this, $_block_repeat); while ($_block_repeat) { ob_start();?>Reason<?php $_block_content = ob_get_clean(); $_block_repeat=false; echo smarty_block_t($_tag_stack[count($_tag_stack)-1], $_block_content, $this, $_block_repeat); } array_pop($_tag_stack);?> <input type="text" name="reportreason" size="10" />&nbsp;<input name="reportpost" value="<?php if (!isset($_tag_stack)){ $_tag_stack = array(); } $_tag_stack[] = array(); $_block_repeat=true; smarty_block_t($_tag_stack[count($_tag_stack)-1], null, $this, $_block_repeat); while ($_block_repeat) { ob_start();?>Report<?php $_block_content = ob_get_clean(); $_block_repeat=false; echo smarty_block_t($_tag_stack[count($_tag_stack)-1], $_block_content, $this, $_block_repeat); } array_pop($_tag_stack);?>" type="submit" /> <?php $_block_content = ob_get_clean(); $_block_repeat=false; echo smarty_block_t($_tag_stack[count($_tag_stack)-1], $_block_content, $this, $_block_repeat); } array_pop($_tag_stack); $_block_content = ob_get_clean(); $_block_repeat=false; echo smarty_block_t($_tag_stack[count($_tag_stack)-1], $_block_content, $this, $_block_repeat); } array_pop($_tag_stack); }?> </td> </tr> </tbody> </table> </form> <script type="text/javascript"><!-- set_delpass("delform"); //--></script> <?php }?> <?php if ((isset($this->scope["replythread"]) ? $this->scope["replythread"] : null) == 0) { ?> <table border="1"> <tbody> <tr> <td> <?php if ((isset($this->scope["thispage"]) ? $this->scope["thispage"] : null) == 0) { ?> <?php if (!isset($_tag_stack)){ $_tag_stack = array(); } $_tag_stack[] = array(); $_block_repeat=true; smarty_block_t($_tag_stack[count($_tag_stack)-1], null, $this, $_block_repeat); while ($_block_repeat) { ob_start();?>Previous<?php $_block_content = ob_get_clean(); $_block_repeat=false; echo smarty_block_t($_tag_stack[count($_tag_stack)-1], $_block_content, $this, $_block_repeat); } array_pop($_tag_stack);?> <?php } else { ?> <form method="get" action="<?php echo KU_BOARDSFOLDER; echo $this->scope["board"]["name"];?>/<?php if (( ((isset($this->scope["thispage"]) ? $this->scope["thispage"] : null) - 1) ) != 0) { echo ($this->scope["thispage"] - 1);?>.html<?php }?>"> <input value="<?php if (!isset($_tag_stack)){ $_tag_stack = array(); } $_tag_stack[] = array(); $_block_repeat=true; smarty_block_t($_tag_stack[count($_tag_stack)-1], null, $this, $_block_repeat); while ($_block_repeat) { ob_start();?>Previous<?php $_block_content = ob_get_clean(); $_block_repeat=false; echo smarty_block_t($_tag_stack[count($_tag_stack)-1], $_block_content, $this, $_block_repeat); } array_pop($_tag_stack);?>" type="submit" /></form> <?php }?> </td> <td> &#91;<?php if ((isset($this->scope["thispage"]) ? $this->scope["thispage"] : null) != 0) { ?><a href="<?php echo KU_BOARDSPATH;?>/<?php echo $this->scope["board"]["name"];?>/"><?php }?>0<?php if ((isset($this->scope["thispage"]) ? $this->scope["thispage"] : null) != 0) { ?></a><?php }?>&#93; <?php $this->globals['section']['pages'] = array(); $_section0 =& $this->globals['section']['pages']; $_section0['loop'] = is_array($tmp = (isset($this->scope["numpages"]) ? $this->scope["numpages"] : null)) ? count($tmp) : max(0, (int) $tmp); $_section0['show'] = true; $_section0['name'] = 'pages'; $_section0['max'] = $_section0['loop']; $_section0['step'] = 1; $_section0['start'] = $_section0['step'] > 0 ? 0 : $_section0['loop'] - 1; if ($_section0['start'] < 0) { $_section0['start'] = max($_section0['step'] > 0 ? 0 : -1, $_section0['loop'] + $_section0['start']); } else { $_section0['start'] = min($_section0['start'], $_section0['step'] > 0 ? $_section0['loop'] : $_section0['loop'] -1); } if ($_section0['show']) { $_section0['total'] = $_section0['loop']; if ($_section0['total'] == 0) { $_section0['show'] = false; } } else { $_section0['total'] = 0; } if ($_section0['show']) { for ($this->scope['pages'] = $_section0['start'], $_section0['iteration'] = 1; $_section0['iteration'] <= $_section0['total']; $this->scope['pages'] += $_section0['step'], $_section0['iteration']++) { $_section0['rownum'] = $_section0['iteration']; $_section0['index_prev'] = $this->scope['pages'] - $_section0['step']; $_section0['index_next'] = $this->scope['pages'] + $_section0['step']; $_section0['first'] = ($_section0['iteration'] == 1); $_section0['last'] = ($_section0['iteration'] == $_section0['total']); ?> &#91;<?php if ((isset($this->globals["section"]["pages"]["iteration"]) ? $this->globals["section"]["pages"]["iteration"]:null) != (isset($this->scope["thispage"]) ? $this->scope["thispage"] : null)) {?><a href="<?php echo KU_BOARDSFOLDER; echo $this->scope["board"]["name"];?>/<?php echo $this->globals["section"]["pages"]["iteration"];?>.html"><?php } echo $this->globals["section"]["pages"]["iteration"]; if ((isset($this->globals["section"]["pages"]["iteration"]) ? $this->globals["section"]["pages"]["iteration"]:null) != (isset($this->scope["thispage"]) ? $this->scope["thispage"] : null)) {?></a><?php }?>&#93; <?php } } ?> </td> <td> <?php if ((isset($this->scope["thispage"]) ? $this->scope["thispage"] : null) == (isset($this->scope["numpages"]) ? $this->scope["numpages"] : null)) { ?> <?php if (!isset($_tag_stack)){ $_tag_stack = array(); } $_tag_stack[] = array(); $_block_repeat=true; smarty_block_t($_tag_stack[count($_tag_stack)-1], null, $this, $_block_repeat); while ($_block_repeat) { ob_start();?>Next<?php $_block_content = ob_get_clean(); $_block_repeat=false; echo smarty_block_t($_tag_stack[count($_tag_stack)-1], $_block_content, $this, $_block_repeat); } array_pop($_tag_stack);?> <?php } else { ?> <form method="get" action="<?php echo KU_BOARDSPATH;?>/<?php echo $this->scope["board"]["name"];?>/<?php echo ($this->scope["thispage"] + 1);?>.html"><input value="<?php if (!isset($_tag_stack)){ $_tag_stack = array(); } $_tag_stack[] = array(); $_block_repeat=true; smarty_block_t($_tag_stack[count($_tag_stack)-1], null, $this, $_block_repeat); while ($_block_repeat) { ob_start();?>Next<?php $_block_content = ob_get_clean(); $_block_repeat=false; echo smarty_block_t($_tag_stack[count($_tag_stack)-1], $_block_content, $this, $_block_repeat); } array_pop($_tag_stack);?>" type="submit" /></form> <?php }?> </td> </tr> </tbody> </table> <?php }?> <br /> <?php if ((isset($this->scope["boardlist"]) ? $this->scope["boardlist"] : null)) { ?> <div class="navbar"> <?php if ((defined("KU_GENERATEBOARDLIST") ? KU_GENERATEBOARDLIST : null)) { ?> <?php $_fh7_data = (isset($this->scope["boardlist"]) ? $this->scope["boardlist"] : null); if ($this->isArray($_fh7_data) === true) { foreach ($_fh7_data as $this->scope['sect']) { /* -- foreach start output */ ?> [ <?php $_fh6_data = (isset($this->scope["sect"]) ? $this->scope["sect"] : null); $this->globals["foreach"]['brds'] = array ( "iteration" => 1, "last" => null, "total" => $this->isArray($_fh6_data) ? count($_fh6_data) : 0, ); $_fh6_glob =& $this->globals["foreach"]['brds']; if ($this->isArray($_fh6_data) === true) { foreach ($_fh6_data as $this->scope['brd']) { $_fh6_glob["last"] = (string) ($_fh6_glob["iteration"] === $_fh6_glob["total"]); /* -- foreach start output */ ?> <a title="<?php echo $this->scope["brd"]["desc"];?>" href="<?php echo KU_BOARDSFOLDER; echo $this->scope["brd"]["name"];?>/"><?php echo $this->scope["brd"]["name"];?></a><?php if ((isset($this->globals["foreach"]["brds"]["last"]) ? $this->globals["foreach"]["brds"]["last"]:null)) { } else { ?> / <?php }?> <?php /* -- foreach end output */ $_fh6_glob["iteration"]+=1; } }?> ] <?php /* -- foreach end output */ } }?> <?php } else { ?> <?php if (is_file((isset($this->scope["boardlist"]) ? $this->scope["boardlist"] : null))) { ?> <?php echo Dwoo_Plugin_include($this, (isset($this->scope["boardlist"]) ? $this->scope["boardlist"] : null), null, null, null, '_root', null);?> <?php }?> <?php }?> </div> <?php }?> <br /> <div class="footer" style="clear: both;"> - <a href="http://kusabax.cultnet.net/" target="_top">kusaba x <?php echo KU_VERSION;?></a> <?php if ((isset($this->scope["executiontime"]) ? $this->scope["executiontime"] : null) != '') { ?> + <?php if (!isset($_tag_stack)){ $_tag_stack = array(); } $_tag_stack[] = array(); $_block_repeat=true; smarty_block_t($_tag_stack[count($_tag_stack)-1], null, $this, $_block_repeat); while ($_block_repeat) { ob_start();?>Took<?php $_block_content = ob_get_clean(); $_block_repeat=false; echo smarty_block_t($_tag_stack[count($_tag_stack)-1], $_block_content, $this, $_block_repeat); } array_pop($_tag_stack);?> <?php echo $this->scope["executiontime"];?>s -<?php }?> <?php if ((isset($this->scope["botads"]) ? $this->scope["botads"] : null) != '') { ?> <div class="content ads"> <center> <?php echo $this->scope["botads"];?> </center> </div> <?php }?> </div> <!-- Start Open Web Analytics Tracker --> <script type="text/javascript"> //<![CDATA[ var owa_baseUrl = 'http://anal.314chan.org/'; var owa_cmds = owa_cmds || []; owa_cmds.push(['setSiteId', '3b255593e892e38748ef9756495909b9']); owa_cmds.push(['trackPageView']); owa_cmds.push(['trackClicks']); owa_cmds.push(['trackDomStream']); (function() { var _owa = document.createElement('script'); _owa.type = 'text/javascript'; _owa.async = true; owa_baseUrl = ('https:' == document.location.protocol ? window.owa_baseSecUrl || owa_baseUrl.replace(/http:/, 'https:') : owa_baseUrl ); _owa.src = owa_baseUrl + 'modules/base/js/owa.tracker-combined-min.js'; var _owa_s = document.getElementsByTagName('script')[0]; _owa_s.parentNode.insertBefore(_owa, _owa_s); }()); //]]> </script> <!-- End Open Web Analytics Code --><?php /* end template body */ return $this->buffer . ob_get_clean(); ?>
gpl-2.0
knr1/ch.bfh.mobicomp
ch.quantasy.iot.gateway.tinkerforge/src/main/java/ch/quantasy/iot/mqtt/tinkerforge/device/deviceHandler/IMUV2/IMUV2.java
10889
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package ch.quantasy.iot.mqtt.tinkerforge.device.deviceHandler.IMUV2; import ch.quantasy.iot.mqtt.tinkerforge.device.deviceHandler.IMUV2.event.AccelerationEvent; import ch.quantasy.iot.mqtt.tinkerforge.device.deviceHandler.IMUV2.event.AllDataEvent; import ch.quantasy.iot.mqtt.tinkerforge.device.deviceHandler.IMUV2.event.AngularVelocityEvent; import ch.quantasy.iot.mqtt.tinkerforge.device.deviceHandler.IMUV2.event.GravityVectorEvent; import ch.quantasy.iot.mqtt.tinkerforge.device.deviceHandler.IMUV2.event.LinearAccelerationEvent; import ch.quantasy.iot.mqtt.tinkerforge.device.deviceHandler.IMUV2.event.MagneticFieldEvent; import ch.quantasy.iot.mqtt.tinkerforge.device.deviceHandler.IMUV2.event.OrientationEvent; import ch.quantasy.iot.mqtt.tinkerforge.device.deviceHandler.IMUV2.event.QuaternionEvent; import ch.quantasy.iot.mqtt.tinkerforge.device.deviceHandler.IMUV2.intent.AccelerationPeriodIntent; import ch.quantasy.iot.mqtt.tinkerforge.device.deviceHandler.IMUV2.intent.AllDataPeriodIntent; import ch.quantasy.iot.mqtt.tinkerforge.device.deviceHandler.IMUV2.intent.AngularVelocityPeriodIntent; import ch.quantasy.iot.mqtt.tinkerforge.device.deviceHandler.IMUV2.intent.GravityPeriodIntent; import ch.quantasy.iot.mqtt.tinkerforge.device.deviceHandler.IMUV2.intent.LEDIntent; import ch.quantasy.iot.mqtt.tinkerforge.device.deviceHandler.IMUV2.intent.LinearAccelerationPeriodIntent; import ch.quantasy.iot.mqtt.tinkerforge.device.deviceHandler.IMUV2.intent.MagneticFieldPeriodIntent; import ch.quantasy.iot.mqtt.tinkerforge.device.deviceHandler.IMUV2.intent.OrientationPeriodIntent; import ch.quantasy.iot.mqtt.tinkerforge.device.deviceHandler.IMUV2.intent.QuaternionPeriodIntent; import ch.quantasy.iot.mqtt.tinkerforge.device.deviceHandler.IMUV2.intent.TemperaturePeriodIntent; import ch.quantasy.iot.mqtt.tinkerforge.device.deviceHandler.IMUV2.status.AccelerationPeriodStatus; import ch.quantasy.iot.mqtt.tinkerforge.device.deviceHandler.IMUV2.status.AllDataPeriodStatus; import ch.quantasy.iot.mqtt.tinkerforge.device.deviceHandler.IMUV2.status.AngularVelocityPeriodStatus; import ch.quantasy.iot.mqtt.tinkerforge.device.deviceHandler.IMUV2.status.GravityPeriodStatus; import ch.quantasy.iot.mqtt.tinkerforge.device.deviceHandler.IMUV2.status.LEDStatus; import ch.quantasy.iot.mqtt.tinkerforge.device.deviceHandler.IMUV2.status.LinearAccelerationPeriodStatus; import ch.quantasy.iot.mqtt.tinkerforge.device.deviceHandler.IMUV2.status.MagneticFieldPeriodStatus; import ch.quantasy.iot.mqtt.tinkerforge.device.deviceHandler.IMUV2.status.OrientationPeriodStatus; import ch.quantasy.iot.mqtt.tinkerforge.device.deviceHandler.IMUV2.status.QuaternionPeriodStatus; import ch.quantasy.iot.mqtt.tinkerforge.device.deviceHandler.IMUV2.status.TemperaturePeriodStatus; import ch.quantasy.iot.mqtt.tinkerforge.device.deviceHandler.base.ADeviceHandler; import ch.quantasy.iot.mqtt.tinkerforge.device.deviceHandler.color.event.TemperatureEvent; import ch.quantasy.iot.mqtt.tinkerforge.device.stackHandler.MQTTTinkerforgeStackHandler; import ch.quantasy.tinkerforge.tinker.core.implementation.TinkerforgeStackAddress; import com.tinkerforge.BrickIMUV2; import com.tinkerforge.NotConnectedException; import com.tinkerforge.TimeoutException; import java.net.URI; /** * * @author Reto E. Koenig <reto.koenig@bfh.ch> */ public class IMUV2 extends ADeviceHandler<BrickIMUV2> implements BrickIMUV2.AccelerationListener, BrickIMUV2.AllDataListener, BrickIMUV2.AngularVelocityListener, BrickIMUV2.GravityVectorListener, BrickIMUV2.LinearAccelerationListener, BrickIMUV2.MagneticFieldListener, BrickIMUV2.OrientationListener, BrickIMUV2.QuaternionListener, BrickIMUV2.TemperatureListener { public static final String PERIOD = "period"; public static final String ENABLEDs = "enabled"; public static final String VALUE = "value"; public String getApplicationName() { return "IMUV2"; } public IMUV2(MQTTTinkerforgeStackHandler stackApplication, URI mqttURI, TinkerforgeStackAddress stackAddress, String identityString) throws Throwable { super(stackApplication, mqttURI, stackAddress, identityString); super.addStatusClass(AccelerationPeriodStatus.class, AllDataPeriodStatus.class, AngularVelocityPeriodStatus.class, GravityPeriodStatus.class, LinearAccelerationPeriodStatus.class, MagneticFieldPeriodStatus.class, QuaternionPeriodStatus.class, TemperaturePeriodStatus.class, LEDStatus.class); super.addEventClass(AccelerationEvent.class, AllDataEvent.class, AngularVelocityEvent.class, GravityVectorEvent.class, LinearAccelerationEvent.class, MagneticFieldEvent.class, OrientationEvent.class, QuaternionEvent.class, TemperatureEvent.class); super.addIntentClass(AccelerationPeriodIntent.class, AllDataPeriodIntent.class, AngularVelocityPeriodIntent.class, GravityPeriodIntent.class, LinearAccelerationPeriodIntent.class, MagneticFieldPeriodIntent.class, OrientationPeriodIntent.class, QuaternionPeriodIntent.class, TemperaturePeriodIntent.class, LEDIntent.class); } @Override protected void addDeviceListeners() { getDevice().addAccelerationListener(this); getDevice().addAllDataListener(this); getDevice().addAngularVelocityListener(this); getDevice().addGravityVectorListener(this); getDevice().addLinearAccelerationListener(this); getDevice().addMagneticFieldListener(this); getDevice().addOrientationListener(this); getDevice().addQuaternionListener(this); getDevice().addTemperatureListener(this); } @Override protected void removeDeviceListeners() { getDevice().removeAccelerationListener(this); getDevice().removeAllDataListener(this); getDevice().removeAngularVelocityListener(this); getDevice().removeGravityVectorListener(this); getDevice().removeLinearAccelerationListener(this); getDevice().removeMagneticFieldListener(this); getDevice().removeOrientationListener(this); getDevice().removeQuaternionListener(this); getDevice().removeTemperatureListener(this); } public void executeIntent(LEDIntent intent) throws TimeoutException, NotConnectedException { boolean isLightOn = intent.getValue(VALUE, Boolean.class); if (isLightOn) { getDevice().ledsOn(); } else { getDevice().ledsOff(); } getStatus(LEDStatus.class).update(VALUE, getDevice().areLedsOn()); } public void executeIntent(AccelerationPeriodIntent intent) throws TimeoutException, NotConnectedException { long period = intent.getValue(IMUV2.PERIOD, Long.class); getDevice().setAccelerationPeriod(period); getStatus(AccelerationPeriodStatus.class).update(IMUV2.PERIOD, getDevice().getAccelerationPeriod()); } public void executeIntent(AllDataPeriodIntent intent) throws TimeoutException, NotConnectedException { long period = intent.getValue(IMUV2.PERIOD, Long.class); getDevice().setAllDataPeriod(period); getStatus(AllDataPeriodStatus.class).update(IMUV2.PERIOD, getDevice().getAllDataPeriod()); } public void executeIntent(AngularVelocityPeriodIntent intent) throws TimeoutException, NotConnectedException { long period = intent.getValue(IMUV2.PERIOD, Long.class); getDevice().setAngularVelocityPeriod(period); getStatus(AngularVelocityPeriodStatus.class).update(IMUV2.PERIOD, getDevice().getAngularVelocityPeriod()); } public void executeIntent(GravityPeriodIntent intent) throws TimeoutException, NotConnectedException { long period = intent.getValue(IMUV2.PERIOD, Long.class); getDevice().setGravityVectorPeriod(period); getStatus(GravityPeriodStatus.class).update(IMUV2.PERIOD, getDevice().getGravityVectorPeriod()); } public void executeIntent(LinearAccelerationPeriodIntent intent) throws TimeoutException, NotConnectedException { long period = intent.getValue(IMUV2.PERIOD, Long.class); getDevice().setLinearAccelerationPeriod(period); getStatus(LinearAccelerationPeriodStatus.class).update(IMUV2.PERIOD, getDevice().getLinearAccelerationPeriod()); } public void executeIntent(MagneticFieldPeriodIntent intent) throws TimeoutException, NotConnectedException { long period = intent.getValue(IMUV2.PERIOD, Long.class); getDevice().setMagneticFieldPeriod(period); getStatus(MagneticFieldPeriodStatus.class).update(IMUV2.PERIOD, getDevice().getMagneticFieldPeriod()); } public void executeIntent(OrientationPeriodIntent intent) throws TimeoutException, NotConnectedException { long period = intent.getValue(IMUV2.PERIOD, Long.class); getDevice().setOrientationPeriod(period); getStatus(OrientationPeriodStatus.class).update(IMUV2.PERIOD, getDevice().getOrientationPeriod()); } public void executeIntent(QuaternionPeriodIntent intent) throws TimeoutException, NotConnectedException { long period = intent.getValue(IMUV2.PERIOD, Long.class); getDevice().setQuaternionPeriod(period); getStatus(QuaternionPeriodStatus.class).update(IMUV2.PERIOD, getDevice().getQuaternionPeriod()); } public void executeIntent(TemperaturePeriodIntent intent) throws TimeoutException, NotConnectedException { long period = intent.getValue(IMUV2.PERIOD, Long.class); getDevice().setTemperaturePeriod(period); getStatus(TemperaturePeriodStatus.class).update(IMUV2.PERIOD, getDevice().getTemperaturePeriod()); } @Override public void acceleration(short s, short s1, short s2) { getEvent(AccelerationEvent.class).update(VALUE, new Short[]{s, s1, s2}); } @Override public void angularVelocity(short s, short s1, short s2) { getEvent(AngularVelocityEvent.class).update(VALUE, new Short[]{s, s1, s2}); } @Override public void gravityVector(short s, short s1, short s2) { getEvent(GravityVectorEvent.class).update(VALUE, new Short[]{s, s1, s2}); } @Override public void linearAcceleration(short s, short s1, short s2) { getEvent(LinearAccelerationEvent.class).update(VALUE, new Short[]{s, s1, s2}); } @Override public void magneticField(short s, short s1, short s2) { getEvent(MagneticFieldEvent.class).update(VALUE, new Short[]{s, s1, s2}); } @Override public void orientation(short s, short s1, short s2) { getEvent(OrientationEvent.class).update(VALUE, new Short[]{s, s1, s2}); } @Override public void quaternion(short s, short s1, short s2, short s3) { getEvent(QuaternionEvent.class).update(VALUE, new Short[]{s, s1, s2, s3}); } @Override public void temperature(byte b) { getEvent(TemperatureEvent.class).update(VALUE, b); } @Override public void allData(short[] shorts, short[] shorts1, short[] shorts2, short[] shorts3, short[] shorts4, short[] shorts5, short[] shorts6, byte b, short s) { getEvent(AllDataEvent.class).update(VALUE, new short[][]{shorts, shorts1, shorts2, shorts3, shorts4, shorts5, shorts6}); } }
gpl-2.0
Droces/casabio
vendor/phpexiftool/phpexiftool/lib/PHPExiftool/Driver/Tag/Olympus/ContrastSetting.php
758
<?php /* * This file is part of PHPExifTool. * * (c) 2012 Romain Neutron <imprec@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace PHPExiftool\Driver\Tag\Olympus; use PHPExiftool\Driver\AbstractTag; class ContrastSetting extends AbstractTag { protected $Id = 'mixed'; protected $Name = 'ContrastSetting'; protected $FullName = 'mixed'; protected $GroupName = 'Olympus'; protected $g0 = 'MakerNotes'; protected $g1 = 'Olympus'; protected $g2 = 'Camera'; protected $Type = 'int16s'; protected $Writable = true; protected $Description = 'Contrast Setting'; protected $flag_Permanent = true; }
gpl-2.0
V-Web/vwebadmin
cache/gantry5/vw_vweb/compiled/yaml/4263d7bb84b666e80e76b26e88b8eae0.yaml.php
392
<?php return [ '@class' => 'Gantry\\Component\\File\\CompiledYamlFile', 'filename' => '/Users/Marcel/Sites/hello/templates/vw_vweb/config/default/particles/totop.yaml', 'modified' => 1488361828, 'data' => [ 'enabled' => '1', 'css' => [ 'class' => '' ], 'icon' => 'fa fa-chevron-up fa-fw', 'content' => 'Naar boven' ] ];
gpl-2.0
h0tw1r3/mame
scripts/target/mame/mess.lua
97118
-- license:BSD-3-Clause -- copyright-holders:MAMEdev Team --------------------------------------------------------------------------- -- -- mess.lua -- -- MESS target makefile -- --------------------------------------------------------------------------- -------------------------------------------------- -- specify available CPU cores -------------------------------------------------- CPUS["Z80"] = true CPUS["Z180"] = true CPUS["I8085"] = true CPUS["I8089"] = true CPUS["M6502"] = true CPUS["H6280"] = true CPUS["I86"] = true CPUS["I386"] = true CPUS["NEC"] = true CPUS["V30MZ"] = true CPUS["V60"] = true CPUS["MCS48"] = true CPUS["MCS51"] = true CPUS["MCS96"] = true CPUS["M6800"] = true CPUS["M6805"] = true CPUS["HD6309"] = true CPUS["M6809"] = true CPUS["KONAMI"] = true CPUS["M680X0"] = true CPUS["T11"] = true CPUS["S2650"] = true CPUS["TMS340X0"] = true CPUS["TMS9900"] = true CPUS["TMS9995"] = true CPUS["TMS9900L"] = true CPUS["Z8000"] = true CPUS["Z8001"] = true CPUS["TMS32010"] = true CPUS["TMS32025"] = true CPUS["TMS32031"] = true CPUS["TMS32051"] = true CPUS["TMS32082"] = true CPUS["TMS57002"] = true CPUS["CCPU"] = true CPUS["ADSP21XX"] = true CPUS["ASAP"] = true CPUS["AM29000"] = true CPUS["UPD7810"] = true CPUS["ARM"] = true CPUS["ARM7"] = true CPUS["JAGUAR"] = true CPUS["CUBEQCPU"] = true CPUS["ESRIP"] = true CPUS["MIPS"] = true CPUS["R3000"] = true CPUS["PSX"] = true CPUS["SH2"] = true CPUS["SH4"] = true CPUS["DSP16A"] = true CPUS["DSP32C"] = true CPUS["PIC16C5X"] = true CPUS["PIC16C62X"] = true CPUS["G65816"] = true CPUS["SPC700"] = true CPUS["E1"] = true CPUS["I860"] = true CPUS["I960"] = true CPUS["H8"] = true CPUS["V810"] = true CPUS["M37710"] = true CPUS["POWERPC"] = true CPUS["SE3208"] = true CPUS["MC68HC11"] = true CPUS["ADSP21062"] = true CPUS["DSP56156"] = true CPUS["RSP"] = true CPUS["ALPHA8201"] = true CPUS["COP400"] = true CPUS["TLCS90"] = true CPUS["TLCS900"] = true CPUS["MB88XX"] = true CPUS["MB86233"] = true CPUS["MB86235"] = true CPUS["SSP1601"] = true CPUS["APEXC"] = true CPUS["CP1610"] = true CPUS["F8"] = true CPUS["LH5801"] = true CPUS["PATINHOFEIO"] = true CPUS["PDP1"] = true CPUS["SATURN"] = true CPUS["SC61860"] = true CPUS["LR35902"] = true CPUS["TMS7000"] = true CPUS["SM8500"] = true CPUS["MINX"] = true CPUS["SSEM"] = true CPUS["AVR8"] = true CPUS["TMS1000"] = true CPUS["I4004"] = true CPUS["SUPERFX"] = true CPUS["Z8"] = true CPUS["I8008"] = true CPUS["SCMP"] = true --CPUS["MN10200"] = true CPUS["COSMAC"] = true CPUS["UNSP"] = true CPUS["HCD62121"] = true CPUS["PPS4"] = true CPUS["UPD7725"] = true CPUS["HD61700"] = true CPUS["LC8670"] = true CPUS["SCORE"] = true CPUS["ES5510"] = true CPUS["SCUDSP"] = true CPUS["IE15"] = true CPUS["8X300"] = true CPUS["ALTO2"] = true --CPUS["W65816"] = true CPUS["ARC"] = true CPUS["ARCOMPACT"] = true CPUS["AMIS2000"] = true CPUS["UCOM4"] = true CPUS["HMCS40"] = true CPUS["E0C6200"] = true CPUS["MELPS4"] = true CPUS["HPHYBRID"] = true CPUS["SM510"] = true CPUS["MB86901"] = true -------------------------------------------------- -- specify available sound cores; some of these are -- only for MAME and so aren't included -------------------------------------------------- --SOUNDS["SAMPLES"] = true SOUNDS["DAC"] = true SOUNDS["DMADAC"] = true SOUNDS["SPEAKER"] = true SOUNDS["BEEP"] = true SOUNDS["DISCRETE"] = true SOUNDS["AY8910"] = true SOUNDS["YM2151"] = true SOUNDS["YM2203"] = true SOUNDS["YM2413"] = true SOUNDS["YM2608"] = true SOUNDS["YM2610"] = true SOUNDS["YM2610B"] = true SOUNDS["YM2612"] = true --SOUNDS["YM3438"] = true SOUNDS["YM3812"] = true SOUNDS["YM3526"] = true SOUNDS["Y8950"] = true SOUNDS["YMF262"] = true --SOUNDS["YMF271"] = true SOUNDS["YMF278B"] = true --SOUNDS["YMZ280B"] = true SOUNDS["SN76477"] = true SOUNDS["SN76496"] = true SOUNDS["POKEY"] = true SOUNDS["TIA"] = true SOUNDS["NES_APU"] = true SOUNDS["AMIGA"] = true SOUNDS["ASTROCADE"] = true --SOUNDS["NAMCO"] = true --SOUNDS["NAMCO_15XX"] = true --SOUNDS["NAMCO_CUS30"] = true --SOUNDS["NAMCO_52XX"] = true --SOUNDS["NAMCO_63701X"] = true SOUNDS["T6W28"] = true --SOUNDS["SNKWAVE"] = true --SOUNDS["C140"] = true --SOUNDS["C352"] = true --SOUNDS["TMS36XX"] = true --SOUNDS["TMS3615"] = true SOUNDS["TMS5110"] = true SOUNDS["TMS5220"] = true SOUNDS["VLM5030"] = true --SOUNDS["ADPCM"] = true SOUNDS["MSM5205"] = true --SOUNDS["MSM5232"] = true SOUNDS["OKIM6258"] = true SOUNDS["OKIM6295"] = true --SOUNDS["OKIM6376"] = true --SOUNDS["OKIM9810"] = true SOUNDS["UPD7752"] = true SOUNDS["UPD7759"] = true SOUNDS["HC55516"] = true --SOUNDS["TC8830F"] = true --SOUNDS["K005289"] = true --SOUNDS["K007232"] = true SOUNDS["K051649"] = true --SOUNDS["K053260"] = true --SOUNDS["K054539"] = true --SOUNDS["K056800"] = true --SOUNDS["SEGAPCM"] = true --SOUNDS["MULTIPCM"] = true SOUNDS["SCSP"] = true SOUNDS["AICA"] = true SOUNDS["RF5C68"] = true --SOUNDS["RF5C400"] = true --SOUNDS["CEM3394"] = true SOUNDS["QSOUND"] = true --SOUNDS["QS1000"] = true SOUNDS["SAA1099"] = true --SOUNDS["IREMGA20"] = true SOUNDS["ES5503"] = true SOUNDS["ES5505"] = true SOUNDS["ES5506"] = true --SOUNDS["BSMT2000"] = true --SOUNDS["GAELCO_CG1V"] = true --SOUNDS["GAELCO_GAE1"] = true SOUNDS["C6280"] = true --SOUNDS["SP0250"] = true SOUNDS["SPU"] = true SOUNDS["CDDA"] = true --SOUNDS["ICS2115"] = true --SOUNDS["I5000_SND"] = true --SOUNDS["ST0016"] = true --SOUNDS["NILE"] = true --SOUNDS["X1_010"] = true --SOUNDS["VRENDER0"] = true SOUNDS["VOTRAX"] = true --SOUNDS["ES8712"] = true SOUNDS["CDP1869"] = true SOUNDS["S14001A"] = true SOUNDS["WAVE"] = true SOUNDS["SID6581"] = true SOUNDS["SID8580"] = true SOUNDS["SP0256"] = true --SOUNDS["DIGITALKER"] = true SOUNDS["CDP1863"] = true SOUNDS["CDP1864"] = true --SOUNDS["ZSG2"] = true SOUNDS["MOS656X"] = true SOUNDS["ASC"] = true --SOUNDS["MAS3507D"] = true SOUNDS["SOCRATES"] = true SOUNDS["TMC0285"] = true SOUNDS["TMS5200"] = true SOUNDS["CD2801"] = true SOUNDS["CD2802"] = true --SOUNDS["M58817"] = true SOUNDS["TMC0281"] = true SOUNDS["TMS5100"] = true SOUNDS["TMS5110A"] = true SOUNDS["LMC1992"] = true SOUNDS["AWACS"] = true --SOUNDS["YMZ770"] = true --SOUNDS["MPEG_AUDIO"] = true SOUNDS["T6721A"] = true SOUNDS["MOS7360"] = true SOUNDS["ESQPUMP"] = true SOUNDS["VRC6"] = true SOUNDS["UPD1771"] = true SOUNDS["GB_SOUND"] = true -------------------------------------------------- -- specify available video cores -------------------------------------------------- VIDEOS["SEGA315_5124"] = true VIDEOS["SEGA315_5313"] = true --VIDEOS+= BUFSPRITE"] = true VIDEOS["CDP1861"] = true VIDEOS["CDP1862"] = true VIDEOS["CRT9007"] = true VIDEOS["CRT9021"] = true VIDEOS["CRT9212"] = true VIDEOS["CRTC_EGA"] = true VIDEOS["DL1416"] = true VIDEOS["DM9368"] = true VIDEOS["EF9340_1"] = true VIDEOS["EF9345"] = true VIDEOS["EF9364"] = true VIDEOS["EF9365"] = true VIDEOS["GF4500"] = true --VIDEOS+= EPIC12"] = true --VIDEOS+= FIXFREQ"] = true VIDEOS["HD44102"] = true VIDEOS["HD44352"] = true VIDEOS["HD44780"] = true VIDEOS["HD61830"] = true --VIDEOS+= HD63484"] = true VIDEOS["HD66421"] = true VIDEOS["HUC6202"] = true VIDEOS["HUC6260"] = true VIDEOS["HUC6261"] = true VIDEOS["HUC6270"] = true VIDEOS["HUC6272"] = true VIDEOS["I8244"] = true VIDEOS["I82730"] = true VIDEOS["I8275"] = true --VIDEOS+= M50458"] = true --VIDEOS+= MB90082"] = true --VIDEOS+= MB_VCU"] = true VIDEOS["MC6845"] = true VIDEOS["MC6847"] = true VIDEOS["MSM6222B"] = true VIDEOS["MSM6255"] = true VIDEOS["MOS6566"] = true VIDEOS["PC_VGA"] = true VIDEOS["PCD8544"] = true --VIDEOS+= POLY"] = true VIDEOS["PSX"] = true VIDEOS["RAMDAC"] = true VIDEOS["S2636"] = true VIDEOS["SAA5050"] = true VIDEOS["SED1200"] = true VIDEOS["SED1330"] = true VIDEOS["SED1520"] = true VIDEOS["SNES_PPU"] = true VIDEOS["STVVDP"] = true VIDEOS["T6A04"] = true VIDEOS["TEA1002"] = true --VIDEOS+= TLC34076"] = true --VIDEOS+= TMS34061"] = true VIDEOS["TMS3556"] = true VIDEOS["TMS9927"] = true VIDEOS["TMS9928A"] = true VIDEOS["UPD3301"] = true VIDEOS["UPD7220"] = true VIDEOS["UPD7227"] = true VIDEOS["V9938"] = true VIDEOS["VIC4567"] = true --VIDEOS+= VOODOO"] = true VIDEOS["SCN2674"] = true VIDEOS["GB_LCD"] = true -------------------------------------------------- -- specify available machine cores -------------------------------------------------- MACHINES["AKIKO"] = true MACHINES["AUTOCONFIG"] = true MACHINES["CR511B"] = true MACHINES["DMAC"] = true MACHINES["GAYLE"] = true --MACHINES["NCR53C7XX"] = true --MACHINES["LSI53C810"] = true MACHINES["6522VIA"] = true --MACHINES["TPI6525"] = true --MACHINES["RIOT6532"] = true MACHINES["6821PIA"] = true MACHINES["6840PTM"] = true MACHINES["68561MPCC"] = true --MACHINES["ACIA6850"] = true MACHINES["68681"] = true MACHINES["7200FIFO"] = true MACHINES["8530SCC"] = true --MACHINES["TTL74123"] = true --MACHINES["TTL74145"] = true --MACHINES["TTL74148"] = true --MACHINES["TTL74153"] = true --MACHINES["TTL74181"] = true --MACHINES["TTL7474"] = true --MACHINES["KBDC8042"] = true --MACHINES["I8257"] = true MACHINES["AAKARTDEV"] = true MACHINES["ACIA6850"] = true MACHINES["ADC0808"] = true MACHINES["ADC083X"] = true MACHINES["ADC1038"] = true MACHINES["ADC1213X"] = true MACHINES["AICARTC"] = true MACHINES["AM53CF96"] = true MACHINES["AM9517A"] = true MACHINES["AMIGAFDC"] = true MACHINES["AT_KEYBC"] = true MACHINES["AT28C16"] = true MACHINES["AT29X"] = true MACHINES["AT45DBXX"] = true MACHINES["ATAFLASH"] = true MACHINES["AY31015"] = true MACHINES["BANKDEV"] = true MACHINES["CDP1852"] = true MACHINES["CDP1871"] = true MACHINES["CMOS40105"] = true --MACHINES["CDU76S"] = true MACHINES["COM8116"] = true MACHINES["CR589"] = true MACHINES["CS4031"] = true MACHINES["CS8221"] = true MACHINES["DP8390"] = true --MACHINES["DS1204"] = true MACHINES["DS1302"] = true MACHINES["DS1315"] = true MACHINES["DS2401"] = true MACHINES["DS2404"] = true MACHINES["DS75160A"] = true MACHINES["DS75161A"] = true MACHINES["E0516"] = true MACHINES["E05A03"] = true MACHINES["E05A30"] = true MACHINES["EEPROMDEV"] = true MACHINES["ER2055"] = true MACHINES["F3853"] = true MACHINES["HD63450"] = true MACHINES["HD64610"] = true MACHINES["HP_TACO"] = true MACHINES["I2CMEM"] = true MACHINES["I80130"] = true MACHINES["I8089"] = true MACHINES["I8155"] = true MACHINES["I8212"] = true MACHINES["I8214"] = true MACHINES["I8243"] = true MACHINES["I8251"] = true MACHINES["I8255"] = true MACHINES["I8257"] = true MACHINES["I8271"] = true MACHINES["I8279"] = true MACHINES["I8355"] = true MACHINES["IDE"] = true MACHINES["IM6402"] = true MACHINES["INS8154"] = true MACHINES["INS8250"] = true MACHINES["INTELFLASH"] = true MACHINES["JVS"] = true MACHINES["K033906"] = true MACHINES["K053252"] = true MACHINES["K056230"] = true MACHINES["KB3600"] = true MACHINES["KBDC8042"] = true MACHINES["KR2376"] = true MACHINES["LATCH8"] = true MACHINES["LC89510"] = true MACHINES["LDPR8210"] = true MACHINES["LDSTUB"] = true MACHINES["LDV1000"] = true MACHINES["LDVP931"] = true MACHINES["LH5810"] = true MACHINES["LINFLASH"] = true MACHINES["LPCI"] = true MACHINES["LSI53C810"] = true MACHINES["M68307"] = true MACHINES["M68340"] = true MACHINES["M6M80011AP"] = true MACHINES["MATSUCD"] = true MACHINES["MB14241"] = true MACHINES["MB3773"] = true MACHINES["MB8421"] = true MACHINES["MB87078"] = true MACHINES["MB8795"] = true MACHINES["MB89352"] = true MACHINES["MB89371"] = true MACHINES["MC146818"] = true MACHINES["MC2661"] = true MACHINES["MC6843"] = true MACHINES["MC6846"] = true MACHINES["MC6852"] = true MACHINES["MC6854"] = true MACHINES["MC68328"] = true MACHINES["MC68901"] = true MACHINES["MCCS1850"] = true --MACHINES["M68307"] = true --MACHINES["M68340"] = true MACHINES["MCF5206E"] = true MACHINES["MICROTOUCH"] = true MACHINES["MIOT6530"] = true MACHINES["MM58167"] = true MACHINES["MM58274C"] = true MACHINES["MM74C922"] = true MACHINES["MOS6526"] = true MACHINES["MOS6529"] = true --MACHINES["MIOT6530"] = true MACHINES["MOS6551"] = true MACHINES["MOS6702"] = true MACHINES["MOS8706"] = true MACHINES["MOS8722"] = true MACHINES["MOS8726"] = true MACHINES["MPU401"] = true MACHINES["MSM5832"] = true MACHINES["MSM58321"] = true MACHINES["MSM6242"] = true MACHINES["NCR5380"] = true MACHINES["NCR5380N"] = true MACHINES["NCR5390"] = true MACHINES["NCR539x"] = true MACHINES["NCR53C7XX"] = true MACHINES["NETLIST"] = true MACHINES["NMC9306"] = true MACHINES["NSC810"] = true MACHINES["NSCSI"] = true MACHINES["OMTI5100"] = true MACHINES["PC_FDC"] = true MACHINES["PC_LPT"] = true MACHINES["PCCARD"] = true MACHINES["PCF8593"] = true MACHINES["PCKEYBRD"] = true MACHINES["PDC"] = true MACHINES["PIC8259"] = true MACHINES["PIT68230"] = true MACHINES["PIT8253"] = true MACHINES["PLA"] = true --MACHINES["PROFILE"] = true MACHINES["R64H156"] = true MACHINES["RF5C296"] = true MACHINES["RIOT6532"] = true MACHINES["ROC10937"] = true MACHINES["RP5C01"] = true MACHINES["RP5C15"] = true MACHINES["RP5H01"] = true MACHINES["RTC4543"] = true MACHINES["RTC65271"] = true MACHINES["RTC9701"] = true --MACHINES["S2636"] = true MACHINES["S3520CF"] = true MACHINES["S3C2400"] = true MACHINES["S3C2410"] = true MACHINES["S3C2440"] = true MACHINES["S3C44B0"] = true MACHINES["SATURN"] = true --MACHINES["SCSI"] = true MACHINES["SCUDSP"] = true MACHINES["SECFLASH"] = true MACHINES["SEIBU_COP"] = true --MACHINES["SERFLASH"] = true MACHINES["SMC91C9X"] = true MACHINES["SMPC"] = true MACHINES["STVCD"] = true MACHINES["TC0091LVC"] = true MACHINES["TIMEKPR"] = true MACHINES["TMC0430"] = true MACHINES["TMP68301"] = true MACHINES["TMS5501"] = true MACHINES["TMS6100"] = true MACHINES["TMS9901"] = true MACHINES["TMS9902"] = true MACHINES["TPI6525"] = true MACHINES["TTL74123"] = true MACHINES["TTL74145"] = true MACHINES["TTL74148"] = true MACHINES["TTL74153"] = true MACHINES["TTL74181"] = true MACHINES["TTL7474"] = true MACHINES["UPD1990A"] = true --MACHINES["UPD4992"] = true MACHINES["UPD4701"] = true MACHINES["UPD7002"] = true MACHINES["UPD71071"] = true MACHINES["UPD765"] = true MACHINES["FDC_PLL"] = true MACHINES["V3021"] = true MACHINES["WD_FDC"] = true MACHINES["WD11C00_17"] = true MACHINES["WD2010"] = true MACHINES["WD33C93"] = true MACHINES["WD7600"] = true MACHINES["X2212"] = true MACHINES["X76F041"] = true MACHINES["X76F100"] = true MACHINES["YM2148"] = true MACHINES["Z80CTC"] = true MACHINES["Z80DART"] = true MACHINES["Z80SIO"] = true MACHINES["Z80SCC"] = true MACHINES["Z80DMA"] = true MACHINES["Z80PIO"] = true MACHINES["Z80STI"] = true MACHINES["Z8536"] = true --MACHINES["SECFLASH"] = true --MACHINES["PCCARD"] = true MACHINES["SMC92X4"] = true MACHINES["HDC9234"] = true MACHINES["TI99_HD"] = true MACHINES["STRATA"] = true MACHINES["STEPPERS"] = true MACHINES["CORVUSHD"] = true MACHINES["WOZFDC"] = true MACHINES["DIABLO_HD"] = true MACHINES["TMS1024"] = true MACHINES["NSC810"] = true MACHINES["VT82C496"] = true MACHINES["GENPC"] = true MACHINES["GEN_LATCH"] = true MACHINES["WATCHDOG"] = true MACHINES["SMARTMEDIA"] = true MACHINES["APPLE_DRIVE"] = true MACHINES["APPLE_FDC"] = true MACHINES["SONY_DRIVE"] = true MACHINES["SCNXX562"] = true -------------------------------------------------- -- specify available bus cores -------------------------------------------------- BUSES["A1BUS"] = true BUSES["A2BUS"] = true BUSES["A7800"] = true BUSES["A800"] = true BUSES["ABCBUS"] = true BUSES["ABCKB"] = true BUSES["ADAM"] = true BUSES["ADAMNET"] = true BUSES["APF"] = true BUSES["APRICOT_EXPANSION"] = true BUSES["ARCADIA"] = true BUSES["ASTROCADE"] = true BUSES["BML3"] = true BUSES["BW2"] = true BUSES["C64"] = true BUSES["CBM2"] = true BUSES["CBMIEC"] = true BUSES["CENTRONICS"] = true BUSES["CGENIE_EXPANSION"] = true BUSES["CGENIE_PARALLEL"] = true BUSES["CHANNELF"] = true BUSES["COCO"] = true BUSES["COLECO"] = true BUSES["COMPUCOLOR"] = true BUSES["COMX35"] = true BUSES["CPC"] = true BUSES["CRVISION"] = true BUSES["DMV"] = true BUSES["ECBBUS"] = true BUSES["ECONET"] = true BUSES["ELECTRON"] = true BUSES["EP64"] = true BUSES["EPSON_SIO"] = true BUSES["GAMEBOY"] = true BUSES["GAMEGEAR"] = true BUSES["GBA"] = true BUSES["GENERIC"] = true BUSES["IEEE488"] = true BUSES["IMI7000"] = true BUSES["INTV"] = true BUSES["INTV_CTRL"] = true BUSES["IQ151"] = true BUSES["ISA"] = true BUSES["ISBX"] = true BUSES["HP_OPTROM"] = true BUSES["KC"] = true BUSES["LPCI"] = true BUSES["M5"] = true BUSES["MACPDS"] = true BUSES["MIDI"] = true BUSES["MEGADRIVE"] = true BUSES["MSX_SLOT"] = true BUSES["NASBUS"] = true BUSES["NEOGEO"] = true BUSES["NEOGEO_CTRL"] = true BUSES["NES"] = true BUSES["NES_CTRL"] = true BUSES["NEWBRAIN"] = true BUSES["NUBUS"] = true BUSES["O2"] = true BUSES["ORICEXT"] = true BUSES["PCE"] = true BUSES["PC_JOY"] = true BUSES["PC_KBD"] = true BUSES["PET"] = true BUSES["PLUS4"] = true BUSES["POFO"] = true BUSES["PSX_CONTROLLER"] = true BUSES["QL"] = true BUSES["RS232"] = true BUSES["S100"] = true BUSES["SAT_CTRL"] = true BUSES["SATURN"] = true BUSES["SCSI"] = true BUSES["SCV"] = true BUSES["SEGA8"] = true BUSES["SG1000_EXP"] = true BUSES["SMS_CTRL"] = true BUSES["SMS_EXP"] = true BUSES["SNES"] = true BUSES["SNES_CTRL"] = true BUSES["SPC1000"] = true BUSES["SVI_EXPANDER"] = true BUSES["SVI_SLOT"] = true BUSES["TI99PEB"] = true BUSES["TI99X"] = true BUSES["TIKI100"] = true BUSES["TVC"] = true BUSES["VBOY"] = true BUSES["VC4000"] = true BUSES["VCS"] = true BUSES["VCS_CTRL"] = true BUSES["VECTREX"] = true BUSES["VIC10"] = true BUSES["VIC20"] = true BUSES["VIDBRAIN"] = true BUSES["VIP"] = true BUSES["VTECH_IOEXP"] = true BUSES["VTECH_MEMEXP"] = true BUSES["WANGPC"] = true BUSES["WSWAN"] = true BUSES["X68K"] = true BUSES["Z88"] = true BUSES["ZORRO"] = true -------------------------------------------------- -- this is the list of driver libraries that -- comprise MESS plus messdriv.*", which contains -- the list of drivers -------------------------------------------------- function linkProjects_mame_mess(_target, _subtarget) links { "acorn", "act", "adc", "alesis", "altos", "amiga", "amstrad", "apf", "apollo", "apple", "applied", "arcadia", "ascii", "at", "atari", "att", "bally", "bandai", "banctec", "be", "bnpo", "bondwell", "booth", "camputers", "canon", "cantab", "casio", "cbm", "cccp", "cce", "ccs", "chromatics", "coleco", "cromemco", "comx", "concept", "conitec", "cybiko", "dai", "ddr", "dec", "dicksmth", "dms", "dragon", "drc", "eaca", "einis", "elektor", "elektrka", "ensoniq", "enterprise", "entex", "epoch", "epson", "exidy", "fairch", "fidelity", "force", "fujitsu", "funtech", "galaxy", "gamepark", "gi", "grundy", "hartung", "heathkit", "hec2hrp", "hegener", "heurikon", "hitachi", "homebrew", "homelab", "hp", "imp", "intel", "interton", "intv", "isc", "kaypro", "koei", "kyocera", "luxor", "magnavox", "makerbot", "marx", "matsushi", "mattel", "mb", "mchester", "memotech", "mgu", "microkey", "microsoft", "mit", "mits", "mitsubishi", "mizar", "morrow", "mos", "motorola", "multitch", "nakajima", "nascom", "ne", "nec", "netronic", "next", "nintendo", "nokia", "northstar", "novag", "ns", "olivetti", "olympia", "omnibyte", "orion", "osborne", "osi", "palm", "parker", "pc", "pdp1", "pel", "philips", "pitronic", "poly88", "psion", "radio", "rca", "regnecentralen", "ritam", "rm", "robotron", "rockwell", "roland", "rolm", "sage", "samcoupe", "samsung", "sanyo", "saturn", "sega", "sequential", "sgi", "sharp", "siemens", "sinclair", "skeleton", "slicer", "snk", "sony", "sord", "special", "sun", "svi", "svision", "swtpc09", "synertec", "ta", "tandberg", "tangerin", "tatung", "teamconc", "tektroni", "telenova", "telercas", "televideo", "tem", "tesla", "test", "thomson", "ti", "tiger", "tigertel", "tiki", "tomy", "toshiba", "trainer", "trs", "ultimachine", "ultratec", "unisonic", "unisys", "usp", "veb", "vidbrain", "videoton", "visual", "votrax", "vtech", "wang", "wavemate", "xerox", "xussrpc", "yamaha", "zenith", "zpa", "zvt", "messshared", } if (_subtarget=="mess") then links { "mameshared", } end end function createMESSProjects(_target, _subtarget, _name) project (_name) targetsubdir(_target .."_" .. _subtarget) kind (LIBTYPE) uuid (os.uuid("drv-" .. _target .."_" .. _subtarget .. "_" .._name)) addprojectflags() precompiledheaders() includedirs { MAME_DIR .. "src/osd", MAME_DIR .. "src/emu", MAME_DIR .. "src/devices", MAME_DIR .. "src/mame", MAME_DIR .. "src/lib", MAME_DIR .. "src/lib/util", MAME_DIR .. "src/lib/netlist", MAME_DIR .. "3rdparty", GEN_DIR .. "mess/layout", GEN_DIR .. "mame/layout", } end function createProjects_mame_mess(_target, _subtarget) -------------------------------------------------- -- the following files are MAME components and -- shared across a number of drivers -- -- a310.c (MESS), aristmk5.c, ertictac.c (MAME) -- amiga.c (MESS), alg.c, arcadia.c, cubo.c, mquake.c, upscope.c (MAME) -- a2600.c (MESS), tourtabl.c (MAME) -- atari400.c (MESS), bartop52.c, maxaflex.c (MAME) -- jaguar.c (MAME) -- astrocde.c (MAME+MESS), g627.c -- cps1.c (MAME + MESS), cbaseball.c, mitchell.c (MAME) -- pk8000.c (MESS), photon.c (MAME) -- nes.c (MESS), cham23.c, famibox.c, multigam.c, playch10.c, vsnes.c (MAME) -- snes.c (MESS), nss.c, sfcbox.c, snesb.c (MAME) -- n64.c (MESS), aleck64.c (MAME) -- megadriv.c, segapico.c (MESS), hshavoc.c, megadrvb.c, megaplay.c, megatech.c, puckpkmn.c, segac2.c, segas18.c (MAME) -- dccons.c (MESS), naomi.c (MAME) -- neogeocd.c (MESS), midas.c, neogeo.c, neoprint.c (MAME) -- cdi.c (MESS + MAME) -- 3do.c (MESS + MAME), konamim2.c (MAME) -- vectrex.c (MESS + MAME) -- cps1.c (MESS + MAME) -------------------------------------------------- if (_subtarget=="mess") then createMESSProjects(_target, _subtarget, "mameshared") files { MAME_DIR .. "src/mame/machine/archimds.cpp", MAME_DIR .. "src/mame/video/archimds.cpp", MAME_DIR .. "src/mame/machine/amiga.cpp", MAME_DIR .. "src/mame/video/amiga.cpp", MAME_DIR .. "src/mame/video/amigaaga.cpp", MAME_DIR .. "src/mame/video/amigaaga.h", MAME_DIR .. "src/mame/video/tia.cpp", MAME_DIR .. "src/mame/video/tia.h", MAME_DIR .. "src/mame/machine/atari400.cpp", MAME_DIR .. "src/mame/video/atari400.cpp", MAME_DIR .. "src/mame/includes/atari400.h", MAME_DIR .. "src/mame/video/antic.cpp", MAME_DIR .. "src/mame/video/antic.h", MAME_DIR .. "src/mame/video/gtia.cpp", MAME_DIR .. "src/mame/video/gtia.h", MAME_DIR .. "src/mame/drivers/jaguar.cpp", MAME_DIR .. "src/mame/includes/jaguar.h", MAME_DIR .. "src/mame/audio/jaguar.cpp", MAME_DIR .. "src/mame/video/jaguar.cpp", MAME_DIR .. "src/mame/video/jagblit.h", MAME_DIR .. "src/mame/video/jagblit.hxx", MAME_DIR .. "src/mame/video/jagobj.hxx", MAME_DIR .. "src/mame/audio/gorf.cpp", MAME_DIR .. "src/mame/audio/wow.cpp", MAME_DIR .. "src/mame/drivers/astrocde.cpp", MAME_DIR .. "src/mame/includes/astrocde.h", MAME_DIR .. "src/mame/video/astrocde.cpp", MAME_DIR .. "src/mame/machine/kabuki.cpp", MAME_DIR .. "src/mame/machine/kabuki.h", MAME_DIR .. "src/mame/video/pk8000.cpp", MAME_DIR .. "src/mame/video/ppu2c0x.cpp", MAME_DIR .. "src/mame/video/ppu2c0x.h", MAME_DIR .. "src/mame/machine/snes.cpp", MAME_DIR .. "src/mame/audio/snes_snd.cpp", MAME_DIR .. "src/mame/audio/snes_snd.h", MAME_DIR .. "src/mame/machine/n64.cpp", MAME_DIR .. "src/mame/video/n64.cpp", MAME_DIR .. "src/mame/video/n64types.h", MAME_DIR .. "src/mame/video/rdpfiltr.hxx", MAME_DIR .. "src/mame/video/n64.h", MAME_DIR .. "src/mame/video/rdpblend.cpp", MAME_DIR .. "src/mame/video/rdpblend.h", MAME_DIR .. "src/mame/video/rdptpipe.cpp", MAME_DIR .. "src/mame/video/rdptpipe.h", MAME_DIR .. "src/mame/machine/megadriv.cpp", MAME_DIR .. "src/mame/drivers/naomi.cpp", MAME_DIR .. "src/mame/includes/naomi.h", MAME_DIR .. "src/mame/includes/dc.h", MAME_DIR .. "src/mame/machine/awboard.cpp", MAME_DIR .. "src/mame/machine/awboard.h", MAME_DIR .. "src/mame/machine/dc.cpp", MAME_DIR .. "src/mame/machine/dc-ctrl.cpp", MAME_DIR .. "src/mame/machine/dc-ctrl.h", MAME_DIR .. "src/mame/machine/gdrom.cpp", MAME_DIR .. "src/mame/machine/gdrom.h", MAME_DIR .. "src/mame/machine/jvs13551.cpp", MAME_DIR .. "src/mame/machine/jvs13551.h", MAME_DIR .. "src/mame/machine/maple-dc.cpp", MAME_DIR .. "src/mame/machine/maple-dc.h", MAME_DIR .. "src/mame/machine/mapledev.cpp", MAME_DIR .. "src/mame/machine/mapledev.h", MAME_DIR .. "src/mame/machine/mie.cpp", MAME_DIR .. "src/mame/machine/mie.h", MAME_DIR .. "src/mame/machine/naomi.cpp", MAME_DIR .. "src/mame/machine/naomibd.cpp", MAME_DIR .. "src/mame/machine/naomibd.h", MAME_DIR .. "src/mame/machine/naomig1.cpp", MAME_DIR .. "src/mame/machine/naomig1.h", MAME_DIR .. "src/mame/machine/naomigd.cpp", MAME_DIR .. "src/mame/machine/naomigd.h", MAME_DIR .. "src/mame/machine/naomim1.cpp", MAME_DIR .. "src/mame/machine/naomim1.h", MAME_DIR .. "src/mame/machine/naomim2.cpp", MAME_DIR .. "src/mame/machine/naomim2.h", MAME_DIR .. "src/mame/machine/naomim4.cpp", MAME_DIR .. "src/mame/machine/naomim4.h", MAME_DIR .. "src/mame/machine/naomirom.cpp", MAME_DIR .. "src/mame/machine/naomirom.h", MAME_DIR .. "src/mame/machine/315-5881_crypt.cpp", MAME_DIR .. "src/mame/machine/315-5881_crypt.h", MAME_DIR .. "src/mame/video/powervr2.cpp", MAME_DIR .. "src/mame/video/powervr2.h", MAME_DIR .. "src/mame/drivers/neogeo.cpp", MAME_DIR .. "src/mame/includes/neogeo.h", MAME_DIR .. "src/mame/machine/ng_memcard.cpp", MAME_DIR .. "src/mame/machine/ng_memcard.h", MAME_DIR .. "src/mame/video/neogeo.cpp", MAME_DIR .. "src/mame/video/neogeo_spr.cpp", MAME_DIR .. "src/mame/video/neogeo_spr.h", MAME_DIR .. "src/mame/drivers/cdi.cpp", MAME_DIR .. "src/mame/includes/cdi.h", MAME_DIR .. "src/mame/machine/cdi070.cpp", MAME_DIR .. "src/mame/machine/cdi070.h", MAME_DIR .. "src/mame/machine/cdicdic.cpp", MAME_DIR .. "src/mame/machine/cdicdic.h", MAME_DIR .. "src/mame/machine/cdislave.cpp", MAME_DIR .. "src/mame/machine/cdislave.h", MAME_DIR .. "src/mame/video/mcd212.cpp", MAME_DIR .. "src/mame/video/mcd212.h", MAME_DIR .. "src/mame/drivers/3do.cpp", MAME_DIR .. "src/mame/includes/3do.h", MAME_DIR .. "src/mame/machine/3do.cpp", MAME_DIR .. "src/mame/drivers/konamim2.cpp", MAME_DIR .. "src/mame/drivers/vectrex.cpp", MAME_DIR .. "src/mame/includes/vectrex.h", MAME_DIR .. "src/mame/machine/vectrex.cpp", MAME_DIR .. "src/mame/video/vectrex.cpp", MAME_DIR .. "src/mame/drivers/cps1.cpp", MAME_DIR .. "src/mame/includes/cps1.h", MAME_DIR .. "src/mame/video/cps1.cpp", MAME_DIR .. "src/mame/video/chihiro.cpp", MAME_DIR .. "src/mame/machine/xbox.cpp", MAME_DIR .. "src/mame/machine/xbox_usb.cpp", MAME_DIR .. "src/mame/includes/saturn.h", MAME_DIR .. "src/mame/drivers/saturn.cpp", MAME_DIR .. "src/mame/machine/saturn.cpp", } end -------------------------------------------------- -- the following files are general components and -- shared across a number of drivers -------------------------------------------------- createMESSProjects(_target, _subtarget, "messshared") files { MAME_DIR .. "src/mame/audio/mea8000.cpp", MAME_DIR .. "src/mame/audio/mea8000.h", MAME_DIR .. "src/mame/machine/microdrv.cpp", MAME_DIR .. "src/mame/machine/microdrv.h", MAME_DIR .. "src/mame/machine/teleprinter.cpp", MAME_DIR .. "src/mame/machine/teleprinter.h", MAME_DIR .. "src/mame/machine/z80bin.cpp", MAME_DIR .. "src/mame/machine/z80bin.h", } -------------------------------------------------- -- manufacturer-specific groupings for drivers -------------------------------------------------- createMESSProjects(_target, _subtarget, "acorn") files { MAME_DIR .. "src/mame/drivers/a310.cpp", MAME_DIR .. "src/mame/drivers/a6809.cpp", MAME_DIR .. "src/mame/drivers/acrnsys1.cpp", MAME_DIR .. "src/mame/drivers/atom.cpp", MAME_DIR .. "src/mame/includes/atom.h", MAME_DIR .. "src/mame/drivers/bbc.cpp", MAME_DIR .. "src/mame/includes/bbc.h", MAME_DIR .. "src/mame/machine/bbc.cpp", MAME_DIR .. "src/mame/video/bbc.cpp", MAME_DIR .. "src/mame/drivers/bbcbc.cpp", MAME_DIR .. "src/mame/drivers/electron.cpp", MAME_DIR .. "src/mame/includes/electron.h", MAME_DIR .. "src/mame/machine/electron.cpp", MAME_DIR .. "src/mame/video/electron.cpp", MAME_DIR .. "src/mame/drivers/riscpc.cpp", MAME_DIR .. "src/mame/drivers/z88.cpp", MAME_DIR .. "src/mame/includes/z88.h", MAME_DIR .. "src/mame/machine/upd65031.cpp", MAME_DIR .. "src/mame/machine/upd65031.h", MAME_DIR .. "src/mame/video/z88.cpp", } createMESSProjects(_target, _subtarget, "act") files { MAME_DIR .. "src/mame/drivers/apricot.cpp", MAME_DIR .. "src/mame/drivers/apricotf.cpp", MAME_DIR .. "src/mame/drivers/apricotp.cpp", MAME_DIR .. "src/mame/machine/apricotkb.cpp", MAME_DIR .. "src/mame/machine/apricotkb.h", MAME_DIR .. "src/mame/machine/apricotkb_hle.cpp", MAME_DIR .. "src/mame/machine/apricotkb_hle.h", MAME_DIR .. "src/mame/drivers/victor9k.cpp", MAME_DIR .. "src/mame/includes/victor9k.h", MAME_DIR .. "src/mame/machine/victor9kb.cpp", MAME_DIR .. "src/mame/machine/victor9kb.h", MAME_DIR .. "src/mame/machine/victor9k_fdc.cpp", MAME_DIR .. "src/mame/machine/victor9k_fdc.h", } createMESSProjects(_target, _subtarget, "adc") files { MAME_DIR .. "src/mame/drivers/super6.cpp", MAME_DIR .. "src/mame/includes/super6.h", MAME_DIR .. "src/mame/drivers/superslave.cpp", MAME_DIR .. "src/mame/includes/superslave.h", } createMESSProjects(_target, _subtarget, "alesis") files { MAME_DIR .. "src/mame/drivers/alesis.cpp", MAME_DIR .. "src/mame/includes/alesis.h", MAME_DIR .. "src/mame/audio/alesis.cpp", MAME_DIR .. "src/mame/video/alesis.cpp", } createMESSProjects(_target, _subtarget, "altos") files { MAME_DIR .. "src/mame/drivers/altos5.cpp", MAME_DIR .. "src/mame/drivers/altos486.cpp", } createMESSProjects(_target, _subtarget, "amiga") files { MAME_DIR .. "src/mame/drivers/amiga.cpp", MAME_DIR .. "src/mame/includes/amiga.h", MAME_DIR .. "src/mame/machine/amigakbd.cpp", MAME_DIR .. "src/mame/machine/amigakbd.h", } createMESSProjects(_target, _subtarget, "amstrad") files { MAME_DIR .. "src/mame/drivers/amstrad.cpp", MAME_DIR .. "src/mame/includes/amstrad.h", MAME_DIR .. "src/mame/machine/amstrad.cpp", MAME_DIR .. "src/mame/drivers/amstr_pc.cpp", MAME_DIR .. "src/mame/drivers/nc.cpp", MAME_DIR .. "src/mame/includes/nc.h", MAME_DIR .. "src/mame/machine/nc.cpp", MAME_DIR .. "src/mame/video/nc.cpp", MAME_DIR .. "src/mame/drivers/pc1512.cpp", MAME_DIR .. "src/mame/includes/pc1512.h", MAME_DIR .. "src/mame/machine/pc1512kb.cpp", MAME_DIR .. "src/mame/machine/pc1512kb.h", MAME_DIR .. "src/mame/video/pc1512.cpp", MAME_DIR .. "src/mame/drivers/pcw.cpp", MAME_DIR .. "src/mame/includes/pcw.h", MAME_DIR .. "src/mame/video/pcw.cpp", MAME_DIR .. "src/mame/drivers/pcw16.cpp", MAME_DIR .. "src/mame/includes/pcw16.h", MAME_DIR .. "src/mame/video/pcw16.cpp", MAME_DIR .. "src/mame/drivers/pda600.cpp", } createMESSProjects(_target, _subtarget, "apf") files { MAME_DIR .. "src/mame/drivers/apf.cpp", } createMESSProjects(_target, _subtarget, "apollo") files { MAME_DIR .. "src/mame/drivers/apollo.cpp", MAME_DIR .. "src/mame/includes/apollo.h", MAME_DIR .. "src/mame/machine/apollo.cpp", MAME_DIR .. "src/mame/machine/apollo_dbg.cpp", MAME_DIR .. "src/mame/machine/apollo_kbd.cpp", MAME_DIR .. "src/mame/machine/apollo_kbd.h", MAME_DIR .. "src/mame/video/apollo.cpp", } createMESSProjects(_target, _subtarget, "apple") files { MAME_DIR .. "src/mame/drivers/apple1.cpp", MAME_DIR .. "src/mame/drivers/apple2.cpp", MAME_DIR .. "src/mame/includes/apple2.h", MAME_DIR .. "src/mame/drivers/apple2e.cpp", MAME_DIR .. "src/mame/includes/apple2e.h", MAME_DIR .. "src/mame/machine/apple2.cpp", MAME_DIR .. "src/mame/video/apple2.cpp", MAME_DIR .. "src/mame/video/apple2.h", MAME_DIR .. "src/mame/drivers/tk2000.cpp", MAME_DIR .. "src/mame/drivers/apple2gs.cpp", MAME_DIR .. "src/mame/includes/apple2gs.h", MAME_DIR .. "src/mame/machine/apple2gs.cpp", MAME_DIR .. "src/mame/video/apple2gs.cpp", MAME_DIR .. "src/mame/drivers/apple3.cpp", MAME_DIR .. "src/mame/includes/apple3.h", MAME_DIR .. "src/mame/machine/apple3.cpp", MAME_DIR .. "src/mame/video/apple3.cpp", MAME_DIR .. "src/mame/drivers/lisa.cpp", MAME_DIR .. "src/mame/includes/lisa.h", MAME_DIR .. "src/mame/machine/lisa.cpp", MAME_DIR .. "src/mame/drivers/mac.cpp", MAME_DIR .. "src/mame/includes/mac.h", MAME_DIR .. "src/mame/audio/mac.cpp", MAME_DIR .. "src/mame/machine/egret.cpp", MAME_DIR .. "src/mame/machine/egret.h", MAME_DIR .. "src/mame/machine/mac.cpp", MAME_DIR .. "src/mame/machine/macadb.cpp", MAME_DIR .. "src/mame/machine/macadb.h", MAME_DIR .. "src/mame/machine/macrtc.cpp", MAME_DIR .. "src/mame/machine/macrtc.h", MAME_DIR .. "src/mame/machine/mackbd.cpp", MAME_DIR .. "src/mame/machine/mackbd.h", MAME_DIR .. "src/mame/machine/swim.cpp", MAME_DIR .. "src/mame/machine/swim.h", MAME_DIR .. "src/mame/video/mac.cpp", MAME_DIR .. "src/mame/drivers/macpci.cpp", MAME_DIR .. "src/mame/includes/macpci.h", MAME_DIR .. "src/mame/machine/macpci.cpp", MAME_DIR .. "src/mame/machine/cuda.cpp", MAME_DIR .. "src/mame/machine/cuda.h", } createMESSProjects(_target, _subtarget, "applied") files { MAME_DIR .. "src/mame/drivers/mbee.cpp", MAME_DIR .. "src/mame/includes/mbee.h", MAME_DIR .. "src/mame/machine/mbee.cpp", MAME_DIR .. "src/mame/video/mbee.cpp", } createMESSProjects(_target, _subtarget, "arcadia") files { MAME_DIR .. "src/mame/drivers/arcadia.cpp", MAME_DIR .. "src/mame/includes/arcadia.h", MAME_DIR .. "src/mame/audio/arcadia.cpp", MAME_DIR .. "src/mame/audio/arcadia.h", MAME_DIR .. "src/mame/video/arcadia.cpp", } createMESSProjects(_target, _subtarget, "ascii") files { MAME_DIR .. "src/mame/drivers/msx.cpp", MAME_DIR .. "src/mame/includes/msx.h", MAME_DIR .. "src/mame/machine/msx.cpp", MAME_DIR .. "src/mame/machine/msx_matsushita.cpp", MAME_DIR .. "src/mame/machine/msx_matsushita.h", MAME_DIR .. "src/mame/machine/msx_s1985.cpp", MAME_DIR .. "src/mame/machine/msx_s1985.h", MAME_DIR .. "src/mame/machine/msx_switched.cpp", MAME_DIR .. "src/mame/machine/msx_switched.h", MAME_DIR .. "src/mame/machine/msx_systemflags.cpp", MAME_DIR .. "src/mame/machine/msx_systemflags.h", } createMESSProjects(_target, _subtarget, "at") files { MAME_DIR .. "src/mame/drivers/at.cpp", MAME_DIR .. "src/mame/drivers/atpci.cpp", MAME_DIR .. "src/mame/drivers/ps2.cpp", MAME_DIR .. "src/mame/machine/at.h", MAME_DIR .. "src/mame/machine/at.cpp", MAME_DIR .. "src/mame/drivers/ct486.cpp", } createMESSProjects(_target, _subtarget, "atari") files { MAME_DIR .. "src/mame/drivers/a2600.cpp", MAME_DIR .. "src/mame/drivers/a7800.cpp", MAME_DIR .. "src/mame/video/maria.cpp", MAME_DIR .. "src/mame/video/maria.h", MAME_DIR .. "src/mame/drivers/atari400.cpp", MAME_DIR .. "src/mame/machine/atarifdc.cpp", MAME_DIR .. "src/mame/machine/atarifdc.h", MAME_DIR .. "src/mame/drivers/atarist.cpp", MAME_DIR .. "src/mame/includes/atarist.h", MAME_DIR .. "src/mame/video/atarist.cpp", MAME_DIR .. "src/mame/video/atarist.h", MAME_DIR .. "src/mame/drivers/lynx.cpp", MAME_DIR .. "src/mame/includes/lynx.h", MAME_DIR .. "src/mame/audio/lynx.cpp", MAME_DIR .. "src/mame/audio/lynx.h", MAME_DIR .. "src/mame/machine/lynx.cpp", MAME_DIR .. "src/mame/drivers/pofo.cpp", } createMESSProjects(_target, _subtarget, "att") files { MAME_DIR .. "src/mame/drivers/unixpc.cpp", } createMESSProjects(_target, _subtarget, "bally") files { MAME_DIR .. "src/mame/drivers/astrohome.cpp", } createMESSProjects(_target, _subtarget, "banctec") files { MAME_DIR .. "src/mame/drivers/banctec.cpp", MAME_DIR .. "src/mame/includes/banctec.h", } createMESSProjects(_target, _subtarget, "bandai") files { MAME_DIR .. "src/mame/drivers/sv8000.cpp", MAME_DIR .. "src/mame/drivers/rx78.cpp", MAME_DIR .. "src/mame/drivers/tamag1.cpp", MAME_DIR .. "src/mame/drivers/wswan.cpp", MAME_DIR .. "src/mame/includes/wswan.h", MAME_DIR .. "src/mame/audio/wswan.cpp", MAME_DIR .. "src/mame/audio/wswan.h", MAME_DIR .. "src/mame/machine/wswan.cpp", MAME_DIR .. "src/mame/video/wswan.cpp", MAME_DIR .. "src/mame/video/wswan.h", } createMESSProjects(_target, _subtarget, "be") files { MAME_DIR .. "src/mame/drivers/bebox.cpp", MAME_DIR .. "src/mame/includes/bebox.h", MAME_DIR .. "src/mame/machine/bebox.cpp", } createMESSProjects(_target, _subtarget, "bnpo") files { MAME_DIR .. "src/mame/drivers/b2m.cpp", MAME_DIR .. "src/mame/includes/b2m.h", MAME_DIR .. "src/mame/machine/b2m.cpp", MAME_DIR .. "src/mame/video/b2m.cpp", } createMESSProjects(_target, _subtarget, "bondwell") files { MAME_DIR .. "src/mame/drivers/bw12.cpp", MAME_DIR .. "src/mame/includes/bw12.h", MAME_DIR .. "src/mame/drivers/bw2.cpp", MAME_DIR .. "src/mame/includes/bw2.h", } createMESSProjects(_target, _subtarget, "booth") files { MAME_DIR .. "src/mame/drivers/apexc.cpp", } createMESSProjects(_target, _subtarget, "camputers") files { MAME_DIR .. "src/mame/drivers/camplynx.cpp", } createMESSProjects(_target, _subtarget, "canon") files { MAME_DIR .. "src/mame/drivers/cat.cpp", MAME_DIR .. "src/mame/drivers/x07.cpp", MAME_DIR .. "src/mame/includes/x07.h", MAME_DIR .. "src/mame/drivers/canon_s80.cpp", } createMESSProjects(_target, _subtarget, "cantab") files { MAME_DIR .. "src/mame/drivers/jupace.cpp", } createMESSProjects(_target, _subtarget, "casio") files { MAME_DIR .. "src/mame/drivers/casloopy.cpp", MAME_DIR .. "src/mame/drivers/cfx9850.cpp", MAME_DIR .. "src/mame/drivers/fp200.cpp", MAME_DIR .. "src/mame/drivers/fp1100.cpp", MAME_DIR .. "src/mame/drivers/fp6000.cpp", MAME_DIR .. "src/mame/drivers/pb1000.cpp", MAME_DIR .. "src/mame/drivers/pv1000.cpp", MAME_DIR .. "src/mame/drivers/pv2000.cpp", } createMESSProjects(_target, _subtarget, "cbm") files { MAME_DIR .. "src/mame/drivers/c128.cpp", MAME_DIR .. "src/mame/includes/c128.h", MAME_DIR .. "src/mame/drivers/c64.cpp", MAME_DIR .. "src/mame/includes/c64.h", MAME_DIR .. "src/mame/drivers/c64dtv.cpp", MAME_DIR .. "src/mame/drivers/c65.cpp", MAME_DIR .. "src/mame/includes/c65.h", MAME_DIR .. "src/mame/drivers/c900.cpp", MAME_DIR .. "src/mame/drivers/cbm2.cpp", MAME_DIR .. "src/mame/includes/cbm2.h", MAME_DIR .. "src/mame/drivers/clcd.cpp", MAME_DIR .. "src/mame/drivers/pet.cpp", MAME_DIR .. "src/mame/includes/pet.h", MAME_DIR .. "src/mame/drivers/plus4.cpp", MAME_DIR .. "src/mame/includes/plus4.h", MAME_DIR .. "src/mame/drivers/vic10.cpp", MAME_DIR .. "src/mame/includes/vic10.h", MAME_DIR .. "src/mame/drivers/vic20.cpp", MAME_DIR .. "src/mame/includes/vic20.h", MAME_DIR .. "src/mame/machine/cbm_snqk.cpp", MAME_DIR .. "src/mame/machine/cbm_snqk.h", MAME_DIR .. "src/mame/drivers/mps1230.cpp", } createMESSProjects(_target, _subtarget, "cccp") files { MAME_DIR .. "src/mame/drivers/argo.cpp", MAME_DIR .. "src/mame/drivers/cm1800.cpp", MAME_DIR .. "src/mame/drivers/lviv.cpp", MAME_DIR .. "src/mame/includes/lviv.h", MAME_DIR .. "src/mame/machine/lviv.cpp", MAME_DIR .. "src/mame/video/lviv.cpp", MAME_DIR .. "src/mame/drivers/mikro80.cpp", MAME_DIR .. "src/mame/includes/mikro80.h", MAME_DIR .. "src/mame/machine/mikro80.cpp", MAME_DIR .. "src/mame/video/mikro80.cpp", MAME_DIR .. "src/mame/drivers/pk8000.cpp", MAME_DIR .. "src/mame/includes/pk8000.h", MAME_DIR .. "src/mame/drivers/pk8020.cpp", MAME_DIR .. "src/mame/includes/pk8020.h", MAME_DIR .. "src/mame/machine/pk8020.cpp", MAME_DIR .. "src/mame/video/pk8020.cpp", MAME_DIR .. "src/mame/drivers/pyl601.cpp", MAME_DIR .. "src/mame/drivers/sm1800.cpp", MAME_DIR .. "src/mame/drivers/uknc.cpp", MAME_DIR .. "src/mame/drivers/unior.cpp", MAME_DIR .. "src/mame/drivers/ut88.cpp", MAME_DIR .. "src/mame/includes/ut88.h", MAME_DIR .. "src/mame/machine/ut88.cpp", MAME_DIR .. "src/mame/video/ut88.cpp", MAME_DIR .. "src/mame/drivers/vector06.cpp", MAME_DIR .. "src/mame/includes/vector06.h", MAME_DIR .. "src/mame/machine/vector06.cpp", MAME_DIR .. "src/mame/video/vector06.cpp", MAME_DIR .. "src/mame/drivers/vta2000.cpp", } createMESSProjects(_target, _subtarget, "cce") files { MAME_DIR .. "src/mame/drivers/mc1000.cpp", MAME_DIR .. "src/mame/includes/mc1000.h", } createMESSProjects(_target, _subtarget, "ccs") files { MAME_DIR .. "src/mame/drivers/ccs2810.cpp", MAME_DIR .. "src/mame/drivers/ccs300.cpp", } createMESSProjects(_target, _subtarget, "chromatics") files { MAME_DIR .. "src/mame/drivers/cgc7900.cpp", MAME_DIR .. "src/mame/includes/cgc7900.h", MAME_DIR .. "src/mame/video/cgc7900.cpp", } createMESSProjects(_target, _subtarget, "coleco") files { MAME_DIR .. "src/mame/drivers/adam.cpp", MAME_DIR .. "src/mame/includes/adam.h", MAME_DIR .. "src/mame/drivers/coleco.cpp", MAME_DIR .. "src/mame/includes/coleco.h", MAME_DIR .. "src/mame/machine/coleco.cpp", MAME_DIR .. "src/mame/machine/coleco.h", } createMESSProjects(_target, _subtarget, "cromemco") files { MAME_DIR .. "src/mame/drivers/c10.cpp", MAME_DIR .. "src/mame/drivers/mcb216.cpp", } createMESSProjects(_target, _subtarget, "comx") files { MAME_DIR .. "src/mame/drivers/comx35.cpp", MAME_DIR .. "src/mame/includes/comx35.h", MAME_DIR .. "src/mame/video/comx35.cpp", } createMESSProjects(_target, _subtarget, "concept") files { MAME_DIR .. "src/mame/drivers/concept.cpp", MAME_DIR .. "src/mame/includes/concept.h", MAME_DIR .. "src/mame/machine/concept.cpp", } createMESSProjects(_target, _subtarget, "conitec") files { MAME_DIR .. "src/mame/drivers/prof180x.cpp", MAME_DIR .. "src/mame/includes/prof180x.h", MAME_DIR .. "src/mame/drivers/prof80.cpp", MAME_DIR .. "src/mame/includes/prof80.h", MAME_DIR .. "src/mame/machine/prof80mmu.cpp", MAME_DIR .. "src/mame/machine/prof80mmu.h", } createMESSProjects(_target, _subtarget, "cybiko") files { MAME_DIR .. "src/mame/drivers/cybiko.cpp", MAME_DIR .. "src/mame/includes/cybiko.h", MAME_DIR .. "src/mame/machine/cybiko.cpp", } createMESSProjects(_target, _subtarget, "dai") files { MAME_DIR .. "src/mame/drivers/dai.cpp", MAME_DIR .. "src/mame/includes/dai.h", MAME_DIR .. "src/mame/audio/dai_snd.cpp", MAME_DIR .. "src/mame/audio/dai_snd.h", MAME_DIR .. "src/mame/machine/dai.cpp", MAME_DIR .. "src/mame/video/dai.cpp", } createMESSProjects(_target, _subtarget, "ddr") files { MAME_DIR .. "src/mame/drivers/ac1.cpp", MAME_DIR .. "src/mame/includes/ac1.h", MAME_DIR .. "src/mame/machine/ac1.cpp", MAME_DIR .. "src/mame/video/ac1.cpp", MAME_DIR .. "src/mame/drivers/bcs3.cpp", MAME_DIR .. "src/mame/drivers/c80.cpp", MAME_DIR .. "src/mame/includes/c80.h", MAME_DIR .. "src/mame/drivers/huebler.cpp", MAME_DIR .. "src/mame/includes/huebler.h", MAME_DIR .. "src/mame/drivers/jtc.cpp", MAME_DIR .. "src/mame/drivers/kramermc.cpp", MAME_DIR .. "src/mame/includes/kramermc.h", MAME_DIR .. "src/mame/machine/kramermc.cpp", MAME_DIR .. "src/mame/video/kramermc.cpp", MAME_DIR .. "src/mame/drivers/llc.cpp", MAME_DIR .. "src/mame/includes/llc.h", MAME_DIR .. "src/mame/machine/llc.cpp", MAME_DIR .. "src/mame/video/llc.cpp", MAME_DIR .. "src/mame/drivers/nanos.cpp", MAME_DIR .. "src/mame/drivers/pcm.cpp", MAME_DIR .. "src/mame/drivers/vcs80.cpp", MAME_DIR .. "src/mame/includes/vcs80.h", MAME_DIR .. "src/mame/machine/k7659kb.cpp", MAME_DIR .. "src/mame/machine/k7659kb.h", } createMESSProjects(_target, _subtarget, "dec") files { MAME_DIR .. "src/mame/drivers/dct11em.cpp", MAME_DIR .. "src/mame/drivers/dectalk.cpp", MAME_DIR .. "src/mame/drivers/decwritr.cpp", MAME_DIR .. "src/mame/drivers/pdp11.cpp", MAME_DIR .. "src/mame/drivers/vax11.cpp", MAME_DIR .. "src/mame/drivers/rainbow.cpp", MAME_DIR .. "src/mame/drivers/vk100.cpp", MAME_DIR .. "src/mame/drivers/vt100.cpp", MAME_DIR .. "src/mame/drivers/vt220.cpp", MAME_DIR .. "src/mame/drivers/vt240.cpp", MAME_DIR .. "src/mame/drivers/vt320.cpp", MAME_DIR .. "src/mame/drivers/vt520.cpp", MAME_DIR .. "src/mame/machine/dec_lk201.cpp", MAME_DIR .. "src/mame/machine/dec_lk201.h", MAME_DIR .. "src/mame/machine/rx01.cpp", MAME_DIR .. "src/mame/machine/rx01.h", MAME_DIR .. "src/mame/video/vtvideo.cpp", MAME_DIR .. "src/mame/video/vtvideo.h", } createMESSProjects(_target, _subtarget, "dicksmth") files { MAME_DIR .. "src/mame/drivers/super80.cpp", MAME_DIR .. "src/mame/includes/super80.h", MAME_DIR .. "src/mame/machine/super80.cpp", MAME_DIR .. "src/mame/video/super80.cpp", } createMESSProjects(_target, _subtarget, "dms") files { MAME_DIR .. "src/mame/drivers/dms5000.cpp", MAME_DIR .. "src/mame/drivers/dms86.cpp", MAME_DIR .. "src/mame/drivers/zsbc3.cpp", } createMESSProjects(_target, _subtarget, "dragon") files { MAME_DIR .. "src/mame/drivers/dgn_beta.cpp", MAME_DIR .. "src/mame/includes/dgn_beta.h", MAME_DIR .. "src/mame/machine/dgn_beta.cpp", MAME_DIR .. "src/mame/video/dgn_beta.cpp", } createMESSProjects(_target, _subtarget, "drc") files { MAME_DIR .. "src/mame/drivers/zrt80.cpp", } createMESSProjects(_target, _subtarget, "eaca") files { MAME_DIR .. "src/mame/drivers/cgenie.cpp", } createMESSProjects(_target, _subtarget, "einis") files { MAME_DIR .. "src/mame/drivers/pecom.cpp", MAME_DIR .. "src/mame/includes/pecom.h", MAME_DIR .. "src/mame/machine/pecom.cpp", MAME_DIR .. "src/mame/video/pecom.cpp", } createMESSProjects(_target, _subtarget, "elektrka") files { MAME_DIR .. "src/mame/drivers/bk.cpp", MAME_DIR .. "src/mame/includes/bk.h", MAME_DIR .. "src/mame/machine/bk.cpp", MAME_DIR .. "src/mame/video/bk.cpp", MAME_DIR .. "src/mame/drivers/dvk_kcgd.cpp", MAME_DIR .. "src/mame/drivers/dvk_ksm.cpp", MAME_DIR .. "src/mame/machine/ms7004.cpp", MAME_DIR .. "src/mame/machine/ms7004.h", MAME_DIR .. "src/mame/drivers/mk85.cpp", MAME_DIR .. "src/mame/drivers/mk90.cpp", } createMESSProjects(_target, _subtarget, "elektor") files { MAME_DIR .. "src/mame/drivers/ec65.cpp", MAME_DIR .. "src/mame/drivers/elekscmp.cpp", MAME_DIR .. "src/mame/drivers/junior.cpp", } createMESSProjects(_target, _subtarget, "ensoniq") files { MAME_DIR .. "src/mame/drivers/esq1.cpp", MAME_DIR .. "src/mame/drivers/esq5505.cpp", MAME_DIR .. "src/mame/drivers/esqasr.cpp", MAME_DIR .. "src/mame/drivers/esqkt.cpp", MAME_DIR .. "src/mame/drivers/esqmr.cpp", MAME_DIR .. "src/mame/drivers/enmirage.cpp", MAME_DIR .. "src/mame/machine/esqpanel.cpp", MAME_DIR .. "src/mame/machine/esqpanel.h", MAME_DIR .. "src/mame/machine/esqvfd.cpp", MAME_DIR .. "src/mame/machine/esqvfd.h", MAME_DIR .. "src/mame/machine/esqlcd.cpp", MAME_DIR .. "src/mame/machine/esqlcd.h", } createMESSProjects(_target, _subtarget, "enterprise") files { MAME_DIR .. "src/mame/drivers/ep64.cpp", MAME_DIR .. "src/mame/includes/ep64.h", MAME_DIR .. "src/mame/audio/dave.cpp", MAME_DIR .. "src/mame/audio/dave.h", MAME_DIR .. "src/mame/video/nick.cpp", MAME_DIR .. "src/mame/video/nick.h", } createMESSProjects(_target, _subtarget, "entex") files { MAME_DIR .. "src/mame/drivers/advision.cpp", MAME_DIR .. "src/mame/includes/advision.h", MAME_DIR .. "src/mame/machine/advision.cpp", MAME_DIR .. "src/mame/video/advision.cpp", } createMESSProjects(_target, _subtarget, "epoch") files { MAME_DIR .. "src/mame/drivers/gamepock.cpp", MAME_DIR .. "src/mame/includes/gamepock.h", MAME_DIR .. "src/mame/machine/gamepock.cpp", MAME_DIR .. "src/mame/drivers/scv.cpp", } createMESSProjects(_target, _subtarget, "epson") files { MAME_DIR .. "src/mame/drivers/hx20.cpp", MAME_DIR .. "src/mame/includes/hx20.h", MAME_DIR .. "src/mame/drivers/px4.cpp", MAME_DIR .. "src/mame/drivers/px8.cpp", MAME_DIR .. "src/mame/includes/px8.h", MAME_DIR .. "src/mame/drivers/qx10.cpp", MAME_DIR .. "src/mame/machine/qx10kbd.cpp", MAME_DIR .. "src/mame/machine/qx10kbd.h", } createMESSProjects(_target, _subtarget, "exidy") files { MAME_DIR .. "src/mame/machine/sorcerer.cpp", MAME_DIR .. "src/mame/drivers/sorcerer.cpp", MAME_DIR .. "src/mame/includes/sorcerer.h", MAME_DIR .. "src/mame/machine/micropolis.cpp", MAME_DIR .. "src/mame/machine/micropolis.h", } createMESSProjects(_target, _subtarget, "fairch") files { MAME_DIR .. "src/mame/drivers/channelf.cpp", MAME_DIR .. "src/mame/includes/channelf.h", MAME_DIR .. "src/mame/audio/channelf.cpp", MAME_DIR .. "src/mame/audio/channelf.h", MAME_DIR .. "src/mame/video/channelf.cpp", } createMESSProjects(_target, _subtarget, "fidelity") files { MAME_DIR .. "src/mame/drivers/fidelz80.cpp", MAME_DIR .. "src/mame/includes/fidelz80.h", MAME_DIR .. "src/mame/drivers/fidel6502.cpp", MAME_DIR .. "src/mame/drivers/fidel68k.cpp", } createMESSProjects(_target, _subtarget, "force") files { MAME_DIR .. "src/mame/drivers/fccpu30.cpp", MAME_DIR .. "src/mame/drivers/force68k.cpp", } createMESSProjects(_target, _subtarget, "fujitsu") files { MAME_DIR .. "src/mame/drivers/fmtowns.cpp", MAME_DIR .. "src/mame/includes/fmtowns.h", MAME_DIR .. "src/mame/video/fmtowns.cpp", MAME_DIR .. "src/mame/machine/fm_scsi.cpp", MAME_DIR .. "src/mame/machine/fm_scsi.h", MAME_DIR .. "src/mame/drivers/fm7.cpp", MAME_DIR .. "src/mame/includes/fm7.h", MAME_DIR .. "src/mame/video/fm7.cpp", } createMESSProjects(_target, _subtarget, "funtech") files { MAME_DIR .. "src/mame/drivers/supracan.cpp", } createMESSProjects(_target, _subtarget, "galaxy") files { MAME_DIR .. "src/mame/drivers/galaxy.cpp", MAME_DIR .. "src/mame/includes/galaxy.h", MAME_DIR .. "src/mame/machine/galaxy.cpp", MAME_DIR .. "src/mame/video/galaxy.cpp", } createMESSProjects(_target, _subtarget, "gamepark") files { MAME_DIR .. "src/mame/drivers/gp2x.cpp", MAME_DIR .. "src/mame/drivers/gp32.cpp", MAME_DIR .. "src/mame/includes/gp32.h", } createMESSProjects(_target, _subtarget, "gi") files { MAME_DIR .. "src/mame/drivers/hh_pic16.cpp", } createMESSProjects(_target, _subtarget, "grundy") files { MAME_DIR .. "src/mame/drivers/newbrain.cpp", MAME_DIR .. "src/mame/includes/newbrain.h", MAME_DIR .. "src/mame/video/newbrain.cpp", } createMESSProjects(_target, _subtarget, "hartung") files { MAME_DIR .. "src/mame/drivers/gmaster.cpp", } createMESSProjects(_target, _subtarget, "heathkit") files { MAME_DIR .. "src/mame/drivers/et3400.cpp", MAME_DIR .. "src/mame/drivers/h8.cpp", MAME_DIR .. "src/mame/drivers/h19.cpp", MAME_DIR .. "src/mame/drivers/h89.cpp", } createMESSProjects(_target, _subtarget, "hegener") files { MAME_DIR .. "src/mame/drivers/glasgow.cpp", MAME_DIR .. "src/mame/drivers/mephisto.cpp", MAME_DIR .. "src/mame/drivers/mmodular.cpp", MAME_DIR .. "src/mame/drivers/stratos.cpp", } createMESSProjects(_target, _subtarget, "hitachi") files { MAME_DIR .. "src/mame/drivers/b16.cpp", MAME_DIR .. "src/mame/drivers/bmjr.cpp", MAME_DIR .. "src/mame/drivers/bml3.cpp", MAME_DIR .. "src/mame/drivers/hh_hmcs40.cpp", } createMESSProjects(_target, _subtarget, "homebrew") files { MAME_DIR .. "src/mame/drivers/4004clk.cpp", MAME_DIR .. "src/mame/drivers/68ksbc.cpp", MAME_DIR .. "src/mame/drivers/craft.cpp", MAME_DIR .. "src/mame/drivers/homez80.cpp", MAME_DIR .. "src/mame/drivers/p112.cpp", MAME_DIR .. "src/mame/drivers/phunsy.cpp", MAME_DIR .. "src/mame/drivers/pimps.cpp", MAME_DIR .. "src/mame/drivers/ravens.cpp", MAME_DIR .. "src/mame/drivers/sbc6510.cpp", MAME_DIR .. "src/mame/drivers/sitcom.cpp", MAME_DIR .. "src/mame/drivers/slc1.cpp", MAME_DIR .. "src/mame/drivers/uzebox.cpp", MAME_DIR .. "src/mame/drivers/z80dev.cpp", } createMESSProjects(_target, _subtarget, "homelab") files { MAME_DIR .. "src/mame/drivers/homelab.cpp", } createMESSProjects(_target, _subtarget, "hp") files { MAME_DIR .. "src/mame/drivers/hp16500.cpp", MAME_DIR .. "src/mame/drivers/hp48.cpp", MAME_DIR .. "src/mame/includes/hp48.h", MAME_DIR .. "src/mame/machine/hp48.cpp", MAME_DIR .. "src/mame/video/hp48.cpp", MAME_DIR .. "src/mame/drivers/hp49gp.cpp", MAME_DIR .. "src/mame/drivers/hp9845.cpp", MAME_DIR .. "src/mame/drivers/hp9k.cpp", MAME_DIR .. "src/mame/drivers/hp9k_3xx.cpp", MAME_DIR .. "src/mame/drivers/hp64k.cpp", MAME_DIR .. "src/mame/drivers/hp_ipc.cpp", } createMESSProjects(_target, _subtarget, "hec2hrp") files { MAME_DIR .. "src/mame/drivers/hec2hrp.cpp", MAME_DIR .. "src/mame/includes/hec2hrp.h", MAME_DIR .. "src/mame/machine/hec2hrp.cpp", MAME_DIR .. "src/mame/video/hec2hrp.cpp", MAME_DIR .. "src/mame/drivers/interact.cpp", } createMESSProjects(_target, _subtarget, "heurikon") files { MAME_DIR .. "src/mame/drivers/hk68v10.cpp", } createMESSProjects(_target, _subtarget, "intel") files { MAME_DIR .. "src/mame/drivers/basic52.cpp", MAME_DIR .. "src/mame/drivers/imds.cpp", MAME_DIR .. "src/mame/drivers/ipc.cpp", MAME_DIR .. "src/mame/drivers/ipds.cpp", MAME_DIR .. "src/mame/drivers/isbc.cpp", MAME_DIR .. "src/mame/drivers/isbc8010.cpp", MAME_DIR .. "src/mame/drivers/isbc8030.cpp", MAME_DIR .. "src/mame/machine/isbc_215g.cpp", MAME_DIR .. "src/mame/machine/isbc_215g.h", MAME_DIR .. "src/mame/drivers/rex6000.cpp", MAME_DIR .. "src/mame/drivers/sdk80.cpp", MAME_DIR .. "src/mame/drivers/sdk85.cpp", MAME_DIR .. "src/mame/drivers/sdk86.cpp", MAME_DIR .. "src/mame/drivers/imds2.cpp", MAME_DIR .. "src/mame/includes/imds2.h", } createMESSProjects(_target, _subtarget, "imp") files { MAME_DIR .. "src/mame/drivers/tim011.cpp", MAME_DIR .. "src/mame/drivers/tim100.cpp", } createMESSProjects(_target, _subtarget, "interton") files { MAME_DIR .. "src/mame/drivers/vc4000.cpp", MAME_DIR .. "src/mame/includes/vc4000.h", MAME_DIR .. "src/mame/audio/vc4000.cpp", MAME_DIR .. "src/mame/audio/vc4000.h", MAME_DIR .. "src/mame/video/vc4000.cpp", } createMESSProjects(_target, _subtarget, "intv") files { MAME_DIR .. "src/mame/drivers/intv.cpp", MAME_DIR .. "src/mame/includes/intv.h", MAME_DIR .. "src/mame/machine/intv.cpp", MAME_DIR .. "src/mame/video/intv.cpp", MAME_DIR .. "src/mame/video/stic.cpp", MAME_DIR .. "src/mame/video/stic.h", } createMESSProjects(_target, _subtarget, "isc") files { MAME_DIR .. "src/mame/drivers/compucolor.cpp", } createMESSProjects(_target, _subtarget, "kaypro") files { MAME_DIR .. "src/mame/drivers/kaypro.cpp", MAME_DIR .. "src/mame/includes/kaypro.h", MAME_DIR .. "src/mame/machine/kaypro.cpp", MAME_DIR .. "src/mame/machine/kay_kbd.cpp", MAME_DIR .. "src/mame/machine/kay_kbd.h", MAME_DIR .. "src/mame/video/kaypro.cpp", } createMESSProjects(_target, _subtarget, "koei") files { MAME_DIR .. "src/mame/drivers/pasogo.cpp", } createMESSProjects(_target, _subtarget, "kyocera") files { MAME_DIR .. "src/mame/drivers/kyocera.cpp", MAME_DIR .. "src/mame/includes/kyocera.h", MAME_DIR .. "src/mame/video/kyocera.cpp", } createMESSProjects(_target, _subtarget, "luxor") files { MAME_DIR .. "src/mame/drivers/abc80.cpp", MAME_DIR .. "src/mame/includes/abc80.h", MAME_DIR .. "src/mame/machine/abc80kb.cpp", MAME_DIR .. "src/mame/machine/abc80kb.h", MAME_DIR .. "src/mame/video/abc80.cpp", MAME_DIR .. "src/mame/drivers/abc80x.cpp", MAME_DIR .. "src/mame/includes/abc80x.h", MAME_DIR .. "src/mame/video/abc800.cpp", MAME_DIR .. "src/mame/video/abc800.h", MAME_DIR .. "src/mame/video/abc802.cpp", MAME_DIR .. "src/mame/video/abc802.h", MAME_DIR .. "src/mame/video/abc806.cpp", MAME_DIR .. "src/mame/video/abc806.h", MAME_DIR .. "src/mame/drivers/abc1600.cpp", MAME_DIR .. "src/mame/includes/abc1600.h", MAME_DIR .. "src/mame/machine/abc1600mac.cpp", MAME_DIR .. "src/mame/machine/abc1600mac.h", MAME_DIR .. "src/mame/video/abc1600.cpp", MAME_DIR .. "src/mame/video/abc1600.h", } createMESSProjects(_target, _subtarget, "magnavox") files { MAME_DIR .. "src/mame/drivers/odyssey2.cpp", } createMESSProjects(_target, _subtarget, "makerbot") files { MAME_DIR .. "src/mame/drivers/replicator.cpp", } createMESSProjects(_target, _subtarget, "marx") files { MAME_DIR .. "src/mame/drivers/elecbowl.cpp", } createMESSProjects(_target, _subtarget, "mattel") files { MAME_DIR .. "src/mame/drivers/aquarius.cpp", MAME_DIR .. "src/mame/includes/aquarius.h", MAME_DIR .. "src/mame/video/aquarius.cpp", MAME_DIR .. "src/mame/drivers/juicebox.cpp", MAME_DIR .. "src/mame/drivers/hyperscan.cpp", } createMESSProjects(_target, _subtarget, "matsushi") files { MAME_DIR .. "src/mame/drivers/jr100.cpp", MAME_DIR .. "src/mame/drivers/jr200.cpp", MAME_DIR .. "src/mame/drivers/myb3k.cpp", } createMESSProjects(_target, _subtarget, "mb") files { MAME_DIR .. "src/mame/drivers/mbdtower.cpp", MAME_DIR .. "src/mame/drivers/microvsn.cpp", MAME_DIR .. "src/mame/drivers/phantom.cpp", } createMESSProjects(_target, _subtarget, "mchester") files { MAME_DIR .. "src/mame/drivers/ssem.cpp", } createMESSProjects(_target, _subtarget, "memotech") files { MAME_DIR .. "src/mame/drivers/mtx.cpp", MAME_DIR .. "src/mame/includes/mtx.h", MAME_DIR .. "src/mame/machine/mtx.cpp", } createMESSProjects(_target, _subtarget, "mgu") files { MAME_DIR .. "src/mame/drivers/irisha.cpp", } createMESSProjects(_target, _subtarget, "microkey") files { MAME_DIR .. "src/mame/drivers/primo.cpp", MAME_DIR .. "src/mame/includes/primo.h", MAME_DIR .. "src/mame/machine/primo.cpp", MAME_DIR .. "src/mame/video/primo.cpp", } createMESSProjects(_target, _subtarget, "microsoft") files { MAME_DIR .. "src/mame/drivers/xbox.cpp", MAME_DIR .. "src/mame/includes/xbox.h", MAME_DIR .. "src/mame/includes/xbox_usb.h", } createMESSProjects(_target, _subtarget, "mit") files { MAME_DIR .. "src/mame/drivers/tx0.cpp", MAME_DIR .. "src/mame/includes/tx0.h", MAME_DIR .. "src/mame/video/crt.cpp", MAME_DIR .. "src/mame/video/crt.h", MAME_DIR .. "src/mame/video/tx0.cpp", } createMESSProjects(_target, _subtarget, "mits") files { MAME_DIR .. "src/mame/drivers/altair.cpp", MAME_DIR .. "src/mame/drivers/mits680b.cpp", } createMESSProjects(_target, _subtarget, "mitsubishi") files { MAME_DIR .. "src/mame/drivers/hh_melps4.cpp", MAME_DIR .. "src/mame/drivers/multi8.cpp", MAME_DIR .. "src/mame/drivers/multi16.cpp", } createMESSProjects(_target, _subtarget, "mizar") files { MAME_DIR .. "src/mame/drivers/mzr8105.cpp", } createMESSProjects(_target, _subtarget, "morrow") files { MAME_DIR .. "src/mame/drivers/microdec.cpp", MAME_DIR .. "src/mame/drivers/mpz80.cpp", MAME_DIR .. "src/mame/includes/mpz80.h", MAME_DIR .. "src/mame/drivers/tricep.cpp", } createMESSProjects(_target, _subtarget, "mos") files { MAME_DIR .. "src/mame/drivers/kim1.cpp", } createMESSProjects(_target, _subtarget, "motorola") files { MAME_DIR .. "src/mame/drivers/m6805evs.cpp", MAME_DIR .. "src/mame/drivers/mekd2.cpp", MAME_DIR .. "src/mame/drivers/mvme147.cpp", } createMESSProjects(_target, _subtarget, "multitch") files { MAME_DIR .. "src/mame/drivers/mkit09.cpp", MAME_DIR .. "src/mame/drivers/mpf1.cpp", MAME_DIR .. "src/mame/includes/mpf1.h", } createMESSProjects(_target, _subtarget, "nakajima") files { MAME_DIR .. "src/mame/drivers/nakajies.cpp", } createMESSProjects(_target, _subtarget, "nascom") files { MAME_DIR .. "src/mame/drivers/nascom1.cpp", } createMESSProjects(_target, _subtarget, "ne") files { MAME_DIR .. "src/mame/drivers/z80ne.cpp", MAME_DIR .. "src/mame/includes/z80ne.h", MAME_DIR .. "src/mame/machine/z80ne.cpp", } createMESSProjects(_target, _subtarget, "nec") files { MAME_DIR .. "src/mame/drivers/apc.cpp", MAME_DIR .. "src/mame/drivers/pce.cpp", MAME_DIR .. "src/mame/includes/pce.h", MAME_DIR .. "src/mame/machine/pce.cpp", MAME_DIR .. "src/mame/machine/pce_cd.cpp", MAME_DIR .. "src/mame/machine/pce_cd.h", MAME_DIR .. "src/mame/drivers/pcfx.cpp", MAME_DIR .. "src/mame/drivers/pc6001.cpp", MAME_DIR .. "src/mame/drivers/pc8401a.cpp", MAME_DIR .. "src/mame/includes/pc8401a.h", MAME_DIR .. "src/mame/video/pc8401a.cpp", MAME_DIR .. "src/mame/drivers/pc8001.cpp", MAME_DIR .. "src/mame/includes/pc8001.h", MAME_DIR .. "src/mame/drivers/pc8801.cpp", MAME_DIR .. "src/mame/drivers/pc88va.cpp", MAME_DIR .. "src/mame/drivers/pc100.cpp", MAME_DIR .. "src/mame/drivers/pc9801.cpp", MAME_DIR .. "src/mame/machine/pc9801_26.cpp", MAME_DIR .. "src/mame/machine/pc9801_26.h", MAME_DIR .. "src/mame/machine/pc9801_86.cpp", MAME_DIR .. "src/mame/machine/pc9801_86.h", MAME_DIR .. "src/mame/machine/pc9801_118.cpp", MAME_DIR .. "src/mame/machine/pc9801_118.h", MAME_DIR .. "src/mame/machine/pc9801_cbus.cpp", MAME_DIR .. "src/mame/machine/pc9801_cbus.h", MAME_DIR .. "src/mame/machine/pc9801_kbd.cpp", MAME_DIR .. "src/mame/machine/pc9801_kbd.h", MAME_DIR .. "src/mame/machine/pc9801_cd.cpp", MAME_DIR .. "src/mame/machine/pc9801_cd.h", MAME_DIR .. "src/mame/drivers/tk80bs.cpp", MAME_DIR .. "src/mame/drivers/hh_ucom4.cpp", MAME_DIR .. "src/mame/includes/hh_ucom4.h", } createMESSProjects(_target, _subtarget, "netronic") files { MAME_DIR .. "src/mame/drivers/elf.cpp", MAME_DIR .. "src/mame/includes/elf.h", MAME_DIR .. "src/mame/drivers/exp85.cpp", MAME_DIR .. "src/mame/includes/exp85.h", } createMESSProjects(_target, _subtarget, "next") files { MAME_DIR .. "src/mame/drivers/next.cpp", MAME_DIR .. "src/mame/includes/next.h", MAME_DIR .. "src/mame/machine/nextkbd.cpp", MAME_DIR .. "src/mame/machine/nextkbd.h", MAME_DIR .. "src/mame/machine/nextmo.cpp", MAME_DIR .. "src/mame/machine/nextmo.h", } createMESSProjects(_target, _subtarget, "nintendo") files { MAME_DIR .. "src/mame/drivers/gb.cpp", MAME_DIR .. "src/mame/includes/gb.h", MAME_DIR .. "src/mame/machine/gb.cpp", MAME_DIR .. "src/mame/drivers/gba.cpp", MAME_DIR .. "src/mame/includes/gba.h", MAME_DIR .. "src/mame/video/gba.cpp", MAME_DIR .. "src/mame/drivers/n64.cpp", MAME_DIR .. "src/mame/includes/n64.h", MAME_DIR .. "src/mame/drivers/nes.cpp", MAME_DIR .. "src/mame/includes/nes.h", MAME_DIR .. "src/mame/machine/nes.cpp", MAME_DIR .. "src/mame/video/nes.cpp", MAME_DIR .. "src/mame/drivers/pokemini.cpp", MAME_DIR .. "src/mame/drivers/snes.cpp", MAME_DIR .. "src/mame/includes/snes.h", MAME_DIR .. "src/mame/machine/snescx4.cpp", MAME_DIR .. "src/mame/machine/snescx4.h", MAME_DIR .. "src/mame/machine/cx4data.hxx", MAME_DIR .. "src/mame/machine/cx4fn.hxx", MAME_DIR .. "src/mame/machine/cx4oam.hxx", MAME_DIR .. "src/mame/machine/cx4ops.hxx", MAME_DIR .. "src/mame/drivers/vboy.cpp", MAME_DIR .. "src/mame/audio/vboy.cpp", MAME_DIR .. "src/mame/audio/vboy.h", } createMESSProjects(_target, _subtarget, "nokia") files { MAME_DIR .. "src/mame/drivers/mikromik.cpp", MAME_DIR .. "src/mame/includes/mikromik.h", MAME_DIR .. "src/mame/machine/mm1kb.cpp", MAME_DIR .. "src/mame/machine/mm1kb.h", MAME_DIR .. "src/mame/video/mikromik.cpp", MAME_DIR .. "src/mame/drivers/nokia_3310.cpp", } createMESSProjects(_target, _subtarget, "northstar") files { MAME_DIR .. "src/mame/drivers/horizon.cpp", } createMESSProjects(_target, _subtarget, "novag") files { MAME_DIR .. "src/mame/drivers/mk1.cpp", MAME_DIR .. "src/mame/drivers/mk2.cpp", MAME_DIR .. "src/mame/drivers/novag6502.cpp", MAME_DIR .. "src/mame/drivers/ssystem3.cpp", MAME_DIR .. "src/mame/includes/ssystem3.h", MAME_DIR .. "src/mame/video/ssystem3.cpp", } createMESSProjects(_target, _subtarget, "olivetti") files { MAME_DIR .. "src/mame/drivers/m20.cpp", MAME_DIR .. "src/mame/machine/m20_kbd.cpp", MAME_DIR .. "src/mame/machine/m20_kbd.h", MAME_DIR .. "src/mame/machine/m20_8086.cpp", MAME_DIR .. "src/mame/machine/m20_8086.h", MAME_DIR .. "src/mame/drivers/m24.cpp", MAME_DIR .. "src/mame/machine/m24_kbd.cpp", MAME_DIR .. "src/mame/machine/m24_kbd.h", MAME_DIR .. "src/mame/machine/m24_z8000.cpp", MAME_DIR .. "src/mame/machine/m24_z8000.h", } createMESSProjects(_target, _subtarget, "olympia") files { MAME_DIR .. "src/mame/drivers/peoplepc.cpp" } createMESSProjects(_target, _subtarget, "ns") files { MAME_DIR .. "src/mame/drivers/hh_cop400.cpp", } createMESSProjects(_target, _subtarget, "omnibyte") files { MAME_DIR .. "src/mame/drivers/msbc1.cpp", MAME_DIR .. "src/mame/includes/msbc1.h", MAME_DIR .. "src/mame/drivers/ob68k1a.cpp", MAME_DIR .. "src/mame/includes/ob68k1a.h", } createMESSProjects(_target, _subtarget, "orion") files { MAME_DIR .. "src/mame/drivers/orion.cpp", MAME_DIR .. "src/mame/includes/orion.h", MAME_DIR .. "src/mame/machine/orion.cpp", MAME_DIR .. "src/mame/video/orion.cpp", } createMESSProjects(_target, _subtarget, "osborne") files { MAME_DIR .. "src/mame/drivers/osborne1.cpp", MAME_DIR .. "src/mame/includes/osborne1.h", MAME_DIR .. "src/mame/machine/osborne1.cpp", MAME_DIR .. "src/mame/drivers/osbexec.cpp", MAME_DIR .. "src/mame/drivers/vixen.cpp", MAME_DIR .. "src/mame/includes/vixen.h", } createMESSProjects(_target, _subtarget, "osi") files { MAME_DIR .. "src/mame/drivers/osi.cpp", MAME_DIR .. "src/mame/includes/osi.h", MAME_DIR .. "src/mame/video/osi.cpp", } createMESSProjects(_target, _subtarget, "palm") files { MAME_DIR .. "src/mame/drivers/palm.cpp", MAME_DIR .. "src/mame/drivers/palm_dbg.hxx", MAME_DIR .. "src/mame/drivers/palmz22.cpp", } createMESSProjects(_target, _subtarget, "parker") files { MAME_DIR .. "src/mame/drivers/wildfire.cpp", } createMESSProjects(_target, _subtarget, "pitronic") files { MAME_DIR .. "src/mame/drivers/beta.cpp", } createMESSProjects(_target, _subtarget, "pc") files { MAME_DIR .. "src/mame/drivers/asst128.cpp", MAME_DIR .. "src/mame/drivers/europc.cpp", MAME_DIR .. "src/mame/drivers/genpc.cpp", MAME_DIR .. "src/mame/drivers/ibmpc.cpp", MAME_DIR .. "src/mame/drivers/ibmpcjr.cpp", MAME_DIR .. "src/mame/drivers/pc.cpp", MAME_DIR .. "src/mame/drivers/tandy1t.cpp", MAME_DIR .. "src/mame/video/pc_t1t.cpp", MAME_DIR .. "src/mame/video/pc_t1t.h", } createMESSProjects(_target, _subtarget, "pdp1") files { MAME_DIR .. "src/mame/drivers/pdp1.cpp", MAME_DIR .. "src/mame/includes/pdp1.h", MAME_DIR .. "src/mame/video/pdp1.cpp", } createMESSProjects(_target, _subtarget, "pel") files { MAME_DIR .. "src/mame/drivers/galeb.cpp", MAME_DIR .. "src/mame/includes/galeb.h", MAME_DIR .. "src/mame/video/galeb.cpp", MAME_DIR .. "src/mame/drivers/orao.cpp", MAME_DIR .. "src/mame/includes/orao.h", MAME_DIR .. "src/mame/machine/orao.cpp", MAME_DIR .. "src/mame/video/orao.cpp", } createMESSProjects(_target, _subtarget, "philips") files { MAME_DIR .. "src/mame/drivers/p2000t.cpp", MAME_DIR .. "src/mame/includes/p2000t.h", MAME_DIR .. "src/mame/machine/p2000t.cpp", MAME_DIR .. "src/mame/video/p2000t.cpp", MAME_DIR .. "src/mame/drivers/vg5k.cpp", } createMESSProjects(_target, _subtarget, "poly88") files { MAME_DIR .. "src/mame/drivers/poly88.cpp", MAME_DIR .. "src/mame/includes/poly88.h", MAME_DIR .. "src/mame/machine/poly88.cpp", MAME_DIR .. "src/mame/video/poly88.cpp", } createMESSProjects(_target, _subtarget, "psion") files { MAME_DIR .. "src/mame/drivers/psion.cpp", MAME_DIR .. "src/mame/includes/psion.h", MAME_DIR .. "src/mame/machine/psion_pack.cpp", MAME_DIR .. "src/mame/machine/psion_pack.h", } createMESSProjects(_target, _subtarget, "radio") files { MAME_DIR .. "src/mame/drivers/apogee.cpp", MAME_DIR .. "src/mame/drivers/mikrosha.cpp", MAME_DIR .. "src/mame/drivers/partner.cpp", MAME_DIR .. "src/mame/includes/partner.h", MAME_DIR .. "src/mame/machine/partner.cpp", MAME_DIR .. "src/mame/drivers/radio86.cpp", MAME_DIR .. "src/mame/includes/radio86.h", MAME_DIR .. "src/mame/machine/radio86.cpp", } createMESSProjects(_target, _subtarget, "rca") files { MAME_DIR .. "src/mame/drivers/microkit.cpp", MAME_DIR .. "src/mame/drivers/studio2.cpp", MAME_DIR .. "src/mame/drivers/vip.cpp", MAME_DIR .. "src/mame/includes/vip.h", } createMESSProjects(_target, _subtarget, "regnecentralen") files { MAME_DIR .. "src/mame/drivers/rc759.cpp", } createMESSProjects(_target, _subtarget, "ritam") files { MAME_DIR .. "src/mame/drivers/monty.cpp", } createMESSProjects(_target, _subtarget, "rm") files { MAME_DIR .. "src/mame/drivers/rm380z.cpp", MAME_DIR .. "src/mame/includes/rm380z.h", MAME_DIR .. "src/mame/machine/rm380z.cpp", MAME_DIR .. "src/mame/video/rm380z.cpp", MAME_DIR .. "src/mame/drivers/rmnimbus.cpp", MAME_DIR .. "src/mame/includes/rmnimbus.h", MAME_DIR .. "src/mame/machine/rmnimbus.cpp", MAME_DIR .. "src/mame/video/rmnimbus.cpp", MAME_DIR .. "src/mame/machine/rmnkbd.cpp", MAME_DIR .. "src/mame/machine/rmnkbd.h", } createMESSProjects(_target, _subtarget, "robotron") files { MAME_DIR .. "src/mame/drivers/a5105.cpp", MAME_DIR .. "src/mame/drivers/a51xx.cpp", MAME_DIR .. "src/mame/drivers/a7150.cpp", MAME_DIR .. "src/mame/drivers/k1003.cpp", MAME_DIR .. "src/mame/drivers/k8915.cpp", MAME_DIR .. "src/mame/drivers/rt1715.cpp", MAME_DIR .. "src/mame/drivers/z1013.cpp", MAME_DIR .. "src/mame/drivers/z9001.cpp", } createMESSProjects(_target, _subtarget, "roland") files { MAME_DIR .. "src/mame/drivers/rmt32.cpp", MAME_DIR .. "src/mame/drivers/rd110.cpp", MAME_DIR .. "src/mame/drivers/rsc55.cpp", MAME_DIR .. "src/mame/drivers/tb303.cpp", MAME_DIR .. "src/mame/drivers/tr606.cpp", } createMESSProjects(_target, _subtarget, "rolm") files { MAME_DIR .. "src/mame/drivers/r9751.cpp", } createMESSProjects(_target, _subtarget, "rockwell") files { MAME_DIR .. "src/mame/drivers/aim65.cpp", MAME_DIR .. "src/mame/includes/aim65.h", MAME_DIR .. "src/mame/machine/aim65.cpp", MAME_DIR .. "src/mame/drivers/aim65_40.cpp", } createMESSProjects(_target, _subtarget, "saturn") files { MAME_DIR .. "src/mame/drivers/st17xx.cpp", } createMESSProjects(_target, _subtarget, "sage") files { MAME_DIR .. "src/mame/drivers/sage2.cpp", MAME_DIR .. "src/mame/includes/sage2.h", } createMESSProjects(_target, _subtarget, "samcoupe") files { MAME_DIR .. "src/mame/drivers/samcoupe.cpp", MAME_DIR .. "src/mame/includes/samcoupe.h", MAME_DIR .. "src/mame/machine/samcoupe.cpp", MAME_DIR .. "src/mame/video/samcoupe.cpp", } createMESSProjects(_target, _subtarget, "samsung") files { MAME_DIR .. "src/mame/drivers/spc1000.cpp", MAME_DIR .. "src/mame/drivers/spc1500.cpp", } createMESSProjects(_target, _subtarget, "sanyo") files { MAME_DIR .. "src/mame/drivers/mbc200.cpp", MAME_DIR .. "src/mame/drivers/mbc55x.cpp", MAME_DIR .. "src/mame/includes/mbc55x.h", MAME_DIR .. "src/mame/machine/mbc55x.cpp", MAME_DIR .. "src/mame/video/mbc55x.cpp", MAME_DIR .. "src/mame/drivers/phc25.cpp", MAME_DIR .. "src/mame/includes/phc25.h", } createMESSProjects(_target, _subtarget, "sega") files { MAME_DIR .. "src/mame/drivers/dccons.cpp", MAME_DIR .. "src/mame/includes/dccons.h", MAME_DIR .. "src/mame/machine/dccons.cpp", MAME_DIR .. "src/mame/drivers/megadriv.cpp", MAME_DIR .. "src/mame/includes/megadriv.h", MAME_DIR .. "src/mame/drivers/segapico.cpp", MAME_DIR .. "src/mame/drivers/sega_sawatte.cpp", MAME_DIR .. "src/mame/drivers/segapm.cpp", MAME_DIR .. "src/mame/drivers/sg1000.cpp", MAME_DIR .. "src/mame/includes/sg1000.h", MAME_DIR .. "src/mame/drivers/sms.cpp", MAME_DIR .. "src/mame/includes/sms.h", MAME_DIR .. "src/mame/machine/sms.cpp", MAME_DIR .. "src/mame/drivers/svmu.cpp", MAME_DIR .. "src/mame/machine/mega32x.cpp", MAME_DIR .. "src/mame/machine/mega32x.h", MAME_DIR .. "src/mame/machine/megacd.cpp", MAME_DIR .. "src/mame/machine/megacd.h", MAME_DIR .. "src/mame/machine/megacdcd.cpp", MAME_DIR .. "src/mame/machine/megacdcd.h", } createMESSProjects(_target, _subtarget, "sequential") files { MAME_DIR .. "src/mame/drivers/prophet600.cpp", } createMESSProjects(_target, _subtarget, "sgi") files { MAME_DIR .. "src/mame/machine/sgi.cpp", MAME_DIR .. "src/mame/machine/sgi.h", MAME_DIR .. "src/mame/drivers/iris3130.cpp", MAME_DIR .. "src/mame/drivers/4dpi.cpp", MAME_DIR .. "src/mame/drivers/indigo.cpp", MAME_DIR .. "src/mame/drivers/indy_indigo2.cpp", MAME_DIR .. "src/mame/video/newport.cpp", MAME_DIR .. "src/mame/video/newport.h", } createMESSProjects(_target, _subtarget, "sharp") files { MAME_DIR .. "src/mame/drivers/hh_sm510.cpp", MAME_DIR .. "src/mame/video/mz700.cpp", MAME_DIR .. "src/mame/drivers/mz700.cpp", MAME_DIR .. "src/mame/includes/mz700.h", MAME_DIR .. "src/mame/drivers/pc1500.cpp", MAME_DIR .. "src/mame/drivers/pocketc.cpp", MAME_DIR .. "src/mame/includes/pocketc.h", MAME_DIR .. "src/mame/video/pc1401.cpp", MAME_DIR .. "src/mame/machine/pc1401.cpp", MAME_DIR .. "src/mame/includes/pc1401.h", MAME_DIR .. "src/mame/video/pc1403.cpp", MAME_DIR .. "src/mame/machine/pc1403.cpp", MAME_DIR .. "src/mame/includes/pc1403.h", MAME_DIR .. "src/mame/video/pc1350.cpp", MAME_DIR .. "src/mame/machine/pc1350.cpp", MAME_DIR .. "src/mame/includes/pc1350.h", MAME_DIR .. "src/mame/video/pc1251.cpp", MAME_DIR .. "src/mame/machine/pc1251.cpp", MAME_DIR .. "src/mame/includes/pc1251.h", MAME_DIR .. "src/mame/video/pocketc.cpp", MAME_DIR .. "src/mame/machine/mz700.cpp", MAME_DIR .. "src/mame/drivers/x68k.cpp", MAME_DIR .. "src/mame/includes/x68k.h", MAME_DIR .. "src/mame/video/x68k.cpp", MAME_DIR .. "src/mame/machine/x68k_hdc.cpp", MAME_DIR .. "src/mame/machine/x68k_hdc.h", MAME_DIR .. "src/mame/machine/x68k_kbd.cpp", MAME_DIR .. "src/mame/machine/x68k_kbd.h", MAME_DIR .. "src/mame/drivers/mz80.cpp", MAME_DIR .. "src/mame/includes/mz80.h", MAME_DIR .. "src/mame/video/mz80.cpp", MAME_DIR .. "src/mame/machine/mz80.cpp", MAME_DIR .. "src/mame/drivers/mz2000.cpp", MAME_DIR .. "src/mame/drivers/x1.cpp", MAME_DIR .. "src/mame/includes/x1.h", MAME_DIR .. "src/mame/machine/x1.cpp", MAME_DIR .. "src/mame/drivers/x1twin.cpp", MAME_DIR .. "src/mame/drivers/mz2500.cpp", MAME_DIR .. "src/mame/drivers/mz3500.cpp", MAME_DIR .. "src/mame/drivers/pce220.cpp", MAME_DIR .. "src/mame/machine/pce220_ser.cpp", MAME_DIR .. "src/mame/machine/pce220_ser.h", MAME_DIR .. "src/mame/drivers/mz6500.cpp", MAME_DIR .. "src/mame/drivers/zaurus.cpp", MAME_DIR .. "src/mame/machine/pxa255.h", } createMESSProjects(_target, _subtarget, "sinclair") files { MAME_DIR .. "src/mame/video/spectrum.cpp", MAME_DIR .. "src/mame/video/timex.cpp", MAME_DIR .. "src/mame/video/zx.cpp", MAME_DIR .. "src/mame/drivers/zx.cpp", MAME_DIR .. "src/mame/includes/zx.h", MAME_DIR .. "src/mame/machine/zx.cpp", MAME_DIR .. "src/mame/drivers/spectrum.cpp", MAME_DIR .. "src/mame/includes/spectrum.h", MAME_DIR .. "src/mame/drivers/spec128.cpp", MAME_DIR .. "src/mame/includes/spec128.h", MAME_DIR .. "src/mame/drivers/timex.cpp", MAME_DIR .. "src/mame/includes/timex.h", MAME_DIR .. "src/mame/drivers/specpls3.cpp", MAME_DIR .. "src/mame/includes/specpls3.h", MAME_DIR .. "src/mame/drivers/scorpion.cpp", MAME_DIR .. "src/mame/drivers/atm.cpp", MAME_DIR .. "src/mame/drivers/pentagon.cpp", MAME_DIR .. "src/mame/machine/beta.cpp", MAME_DIR .. "src/mame/machine/beta.h", MAME_DIR .. "src/mame/machine/spec_snqk.cpp", MAME_DIR .. "src/mame/machine/spec_snqk.h", MAME_DIR .. "src/mame/drivers/ql.cpp", MAME_DIR .. "src/mame/includes/ql.h", MAME_DIR .. "src/mame/machine/qimi.cpp", MAME_DIR .. "src/mame/machine/qimi.h", MAME_DIR .. "src/mame/video/zx8301.cpp", MAME_DIR .. "src/mame/video/zx8301.h", MAME_DIR .. "src/mame/machine/zx8302.cpp", MAME_DIR .. "src/mame/machine/zx8302.h", } createMESSProjects(_target, _subtarget, "siemens") files { MAME_DIR .. "src/mame/drivers/pcd.cpp", MAME_DIR .. "src/mame/machine/pcd_kbd.cpp", MAME_DIR .. "src/mame/machine/pcd_kbd.h", MAME_DIR .. "src/mame/video/pcd.cpp", MAME_DIR .. "src/mame/video/pcd.h", } createMESSProjects(_target, _subtarget, "slicer") files { MAME_DIR .. "src/mame/drivers/slicer.cpp", } createMESSProjects(_target, _subtarget, "snk") files { MAME_DIR .. "src/mame/drivers/neogeocd.cpp", MAME_DIR .. "src/mame/drivers/ngp.cpp", MAME_DIR .. "src/mame/video/k1ge.cpp", MAME_DIR .. "src/mame/video/k1ge.h", } createMESSProjects(_target, _subtarget, "sony") files { MAME_DIR .. "src/mame/drivers/pockstat.cpp", MAME_DIR .. "src/mame/drivers/psx.cpp", MAME_DIR .. "src/mame/machine/psxcd.cpp", MAME_DIR .. "src/mame/machine/psxcd.h", MAME_DIR .. "src/mame/drivers/pve500.cpp", MAME_DIR .. "src/mame/drivers/smc777.cpp", } createMESSProjects(_target, _subtarget, "sord") files { MAME_DIR .. "src/mame/drivers/m5.cpp", MAME_DIR .. "src/mame/includes/m5.h", } createMESSProjects(_target, _subtarget, "special") files { MAME_DIR .. "src/mame/drivers/special.cpp", MAME_DIR .. "src/mame/includes/special.h", MAME_DIR .. "src/mame/audio/special.cpp", MAME_DIR .. "src/mame/audio/special.h", MAME_DIR .. "src/mame/machine/special.cpp", MAME_DIR .. "src/mame/video/special.cpp", } createMESSProjects(_target, _subtarget, "sun") files { MAME_DIR .. "src/mame/drivers/sun1.cpp", MAME_DIR .. "src/mame/drivers/sun2.cpp", MAME_DIR .. "src/mame/drivers/sun3.cpp", MAME_DIR .. "src/mame/drivers/sun3x.cpp", MAME_DIR .. "src/mame/drivers/sun4.cpp", } createMESSProjects(_target, _subtarget, "svi") files { MAME_DIR .. "src/mame/drivers/svi318.cpp", } createMESSProjects(_target, _subtarget, "svision") files { MAME_DIR .. "src/mame/drivers/svision.cpp", MAME_DIR .. "src/mame/includes/svision.h", MAME_DIR .. "src/mame/audio/svis_snd.cpp", MAME_DIR .. "src/mame/audio/svis_snd.h", } createMESSProjects(_target, _subtarget, "swtpc09") files { MAME_DIR .. "src/mame/drivers/swtpc09.cpp", MAME_DIR .. "src/mame/includes/swtpc09.h", MAME_DIR .. "src/mame/machine/swtpc09.cpp", } createMESSProjects(_target, _subtarget, "synertec") files { MAME_DIR .. "src/mame/drivers/sym1.cpp", } createMESSProjects(_target, _subtarget, "ta") files { MAME_DIR .. "src/mame/drivers/alphatro.cpp", } createMESSProjects(_target, _subtarget, "tandberg") files { MAME_DIR .. "src/mame/drivers/tdv2324.cpp", MAME_DIR .. "src/mame/includes/tdv2324.h", } createMESSProjects(_target, _subtarget, "tangerin") files { MAME_DIR .. "src/mame/drivers/microtan.cpp", MAME_DIR .. "src/mame/includes/microtan.h", MAME_DIR .. "src/mame/machine/microtan.cpp", MAME_DIR .. "src/mame/video/microtan.cpp", MAME_DIR .. "src/mame/drivers/oric.cpp", } createMESSProjects(_target, _subtarget, "tatung") files { MAME_DIR .. "src/mame/drivers/einstein.cpp", MAME_DIR .. "src/mame/includes/einstein.h", MAME_DIR .. "src/mame/machine/einstein.cpp", } createMESSProjects(_target, _subtarget, "teamconc") files { MAME_DIR .. "src/mame/drivers/comquest.cpp", MAME_DIR .. "src/mame/includes/comquest.h", MAME_DIR .. "src/mame/video/comquest.cpp", } createMESSProjects(_target, _subtarget, "tektroni") files { MAME_DIR .. "src/mame/drivers/tek405x.cpp", MAME_DIR .. "src/mame/includes/tek405x.h", MAME_DIR .. "src/mame/drivers/tek410x.cpp", MAME_DIR .. "src/mame/drivers/tek440x.cpp", MAME_DIR .. "src/mame/drivers/tekxp33x.cpp", } createMESSProjects(_target, _subtarget, "telenova") files { MAME_DIR .. "src/mame/drivers/compis.cpp", MAME_DIR .. "src/mame/includes/compis.h", MAME_DIR .. "src/mame/machine/compiskb.cpp", MAME_DIR .. "src/mame/machine/compiskb.h", } createMESSProjects(_target, _subtarget, "telercas") files { MAME_DIR .. "src/mame/drivers/tmc1800.cpp", MAME_DIR .. "src/mame/includes/tmc1800.h", MAME_DIR .. "src/mame/video/tmc1800.cpp", MAME_DIR .. "src/mame/drivers/tmc600.cpp", MAME_DIR .. "src/mame/includes/tmc600.h", MAME_DIR .. "src/mame/video/tmc600.cpp", MAME_DIR .. "src/mame/drivers/tmc2000e.cpp", MAME_DIR .. "src/mame/includes/tmc2000e.h", } createMESSProjects(_target, _subtarget, "televideo") files { MAME_DIR .. "src/mame/drivers/ts802.cpp", MAME_DIR .. "src/mame/drivers/ts803.cpp", MAME_DIR .. "src/mame/drivers/ts816.cpp", MAME_DIR .. "src/mame/drivers/tv950.cpp", } createMESSProjects(_target, _subtarget, "tem") files { MAME_DIR .. "src/mame/drivers/tec1.cpp", } createMESSProjects(_target, _subtarget, "tesla") files { MAME_DIR .. "src/mame/drivers/ondra.cpp", MAME_DIR .. "src/mame/includes/ondra.h", MAME_DIR .. "src/mame/machine/ondra.cpp", MAME_DIR .. "src/mame/video/ondra.cpp", MAME_DIR .. "src/mame/drivers/pmd85.cpp", MAME_DIR .. "src/mame/includes/pmd85.h", MAME_DIR .. "src/mame/machine/pmd85.cpp", MAME_DIR .. "src/mame/drivers/pmi80.cpp", MAME_DIR .. "src/mame/drivers/sapi1.cpp", } createMESSProjects(_target, _subtarget, "test") files { MAME_DIR .. "src/mame/drivers/test_t400.cpp", MAME_DIR .. "src/mame/drivers/zexall.cpp", } createMESSProjects(_target, _subtarget, "thomson") files { MAME_DIR .. "src/mame/drivers/thomson.cpp", MAME_DIR .. "src/mame/includes/thomson.h", MAME_DIR .. "src/mame/machine/thomson.cpp", MAME_DIR .. "src/mame/machine/thomflop.cpp", MAME_DIR .. "src/mame/machine/thomflop.h", MAME_DIR .. "src/mame/video/thomson.cpp", } createMESSProjects(_target, _subtarget, "ti") files { MAME_DIR .. "src/mame/drivers/avigo.cpp", MAME_DIR .. "src/mame/includes/avigo.h", MAME_DIR .. "src/mame/video/avigo.cpp", MAME_DIR .. "src/mame/drivers/cc40.cpp", MAME_DIR .. "src/mame/drivers/evmbug.cpp", MAME_DIR .. "src/mame/drivers/exelv.cpp", MAME_DIR .. "src/mame/drivers/geneve.cpp", MAME_DIR .. "src/mame/drivers/ticalc1x.cpp", MAME_DIR .. "src/mame/drivers/tispeak.cpp", MAME_DIR .. "src/mame/drivers/tispellb.cpp", MAME_DIR .. "src/mame/drivers/ti74.cpp", MAME_DIR .. "src/mame/drivers/ti85.cpp", MAME_DIR .. "src/mame/includes/ti85.h", MAME_DIR .. "src/mame/machine/ti85.cpp", MAME_DIR .. "src/mame/video/ti85.cpp", MAME_DIR .. "src/mame/drivers/ti89.cpp", MAME_DIR .. "src/mame/includes/ti89.h", MAME_DIR .. "src/mame/drivers/ti99_2.cpp", MAME_DIR .. "src/mame/drivers/ti99_4x.cpp", MAME_DIR .. "src/mame/drivers/ti99_4p.cpp", MAME_DIR .. "src/mame/drivers/ti99_8.cpp", MAME_DIR .. "src/mame/drivers/ti990_4.cpp", MAME_DIR .. "src/mame/drivers/ti990_10.cpp", MAME_DIR .. "src/mame/drivers/tm990189.cpp", MAME_DIR .. "src/mame/video/733_asr.cpp", MAME_DIR .. "src/mame/video/733_asr.h", MAME_DIR .. "src/mame/video/911_vdt.cpp", MAME_DIR .. "src/mame/video/911_vdt.h", MAME_DIR .. "src/mame/video/911_chr.h", MAME_DIR .. "src/mame/video/911_key.h", MAME_DIR .. "src/mame/drivers/hh_tms1k.cpp", MAME_DIR .. "src/mame/includes/hh_tms1k.h", } createMESSProjects(_target, _subtarget, "tiger") files { MAME_DIR .. "src/mame/drivers/gamecom.cpp", MAME_DIR .. "src/mame/includes/gamecom.h", MAME_DIR .. "src/mame/machine/gamecom.cpp", MAME_DIR .. "src/mame/video/gamecom.cpp", MAME_DIR .. "src/mame/drivers/k28.cpp", } createMESSProjects(_target, _subtarget, "tigertel") files { MAME_DIR .. "src/mame/drivers/gizmondo.cpp", MAME_DIR .. "src/mame/machine/docg3.cpp", MAME_DIR .. "src/mame/machine/docg3.h", } createMESSProjects(_target, _subtarget, "tiki") files { MAME_DIR .. "src/mame/drivers/tiki100.cpp", MAME_DIR .. "src/mame/includes/tiki100.h", } createMESSProjects(_target, _subtarget, "tomy") files { MAME_DIR .. "src/mame/drivers/tutor.cpp", } createMESSProjects(_target, _subtarget, "toshiba") files { MAME_DIR .. "src/mame/drivers/pasopia.cpp", MAME_DIR .. "src/mame/includes/pasopia.h", MAME_DIR .. "src/mame/drivers/pasopia7.cpp", MAME_DIR .. "src/mame/drivers/paso1600.cpp", } createMESSProjects(_target, _subtarget, "trainer") files { MAME_DIR .. "src/mame/drivers/amico2k.cpp", MAME_DIR .. "src/mame/drivers/babbage.cpp", MAME_DIR .. "src/mame/drivers/bob85.cpp", MAME_DIR .. "src/mame/drivers/cvicny.cpp", MAME_DIR .. "src/mame/drivers/dolphunk.cpp", MAME_DIR .. "src/mame/drivers/instruct.cpp", MAME_DIR .. "src/mame/drivers/mk14.cpp", MAME_DIR .. "src/mame/drivers/pro80.cpp", MAME_DIR .. "src/mame/drivers/savia84.cpp", MAME_DIR .. "src/mame/drivers/selz80.cpp", MAME_DIR .. "src/mame/drivers/tk80.cpp", MAME_DIR .. "src/mame/drivers/zapcomputer.cpp", } createMESSProjects(_target, _subtarget, "trs") files { MAME_DIR .. "src/mame/drivers/coco12.cpp", MAME_DIR .. "src/mame/includes/coco12.h", MAME_DIR .. "src/mame/drivers/coco3.cpp", MAME_DIR .. "src/mame/includes/coco3.h", MAME_DIR .. "src/mame/drivers/dragon.cpp", MAME_DIR .. "src/mame/includes/dragon.h", MAME_DIR .. "src/mame/drivers/mc10.cpp", MAME_DIR .. "src/mame/machine/6883sam.cpp", MAME_DIR .. "src/mame/machine/6883sam.h", MAME_DIR .. "src/mame/machine/coco.cpp", MAME_DIR .. "src/mame/includes/coco.h", MAME_DIR .. "src/mame/machine/coco12.cpp", MAME_DIR .. "src/mame/machine/coco3.cpp", MAME_DIR .. "src/mame/machine/coco_vhd.cpp", MAME_DIR .. "src/mame/machine/coco_vhd.h", MAME_DIR .. "src/mame/machine/dragon.cpp", MAME_DIR .. "src/mame/machine/dgnalpha.cpp", MAME_DIR .. "src/mame/includes/dgnalpha.h", MAME_DIR .. "src/mame/video/gime.cpp", MAME_DIR .. "src/mame/video/gime.h", MAME_DIR .. "src/mame/drivers/trs80.cpp", MAME_DIR .. "src/mame/includes/trs80.h", MAME_DIR .. "src/mame/machine/trs80.cpp", MAME_DIR .. "src/mame/video/trs80.cpp", MAME_DIR .. "src/mame/drivers/trs80m2.cpp", MAME_DIR .. "src/mame/includes/trs80m2.h", MAME_DIR .. "src/mame/machine/trs80m2kb.cpp", MAME_DIR .. "src/mame/machine/trs80m2kb.h", MAME_DIR .. "src/mame/drivers/tandy2k.cpp", MAME_DIR .. "src/mame/includes/tandy2k.h", MAME_DIR .. "src/mame/machine/tandy2kb.cpp", MAME_DIR .. "src/mame/machine/tandy2kb.h", } createMESSProjects(_target, _subtarget, "ultimachine") files { MAME_DIR .. "src/mame/drivers/rambo.cpp", } createMESSProjects(_target, _subtarget, "ultratec") files { MAME_DIR .. "src/mame/drivers/minicom.cpp", } createMESSProjects(_target, _subtarget, "unisonic") files { MAME_DIR .. "src/mame/drivers/unichamp.cpp", MAME_DIR .. "src/mame/video/gic.cpp", MAME_DIR .. "src/mame/video/gic.h", MAME_DIR .. "src/mame/video/gic.cpp", MAME_DIR .. "src/mame/video/gic.h", } createMESSProjects(_target, _subtarget, "unisys") files { MAME_DIR .. "src/mame/drivers/univac.cpp", } createMESSProjects(_target, _subtarget, "usp") files { MAME_DIR .. "src/mame/drivers/patinho_feio.cpp", MAME_DIR .. "src/mame/includes/patinhofeio.h", } createMESSProjects(_target, _subtarget, "veb") files { MAME_DIR .. "src/mame/drivers/chessmst.cpp", MAME_DIR .. "src/mame/drivers/kc.cpp", MAME_DIR .. "src/mame/includes/kc.h", MAME_DIR .. "src/mame/machine/kc.cpp", MAME_DIR .. "src/mame/machine/kc_keyb.cpp", MAME_DIR .. "src/mame/machine/kc_keyb.h", MAME_DIR .. "src/mame/video/kc.cpp", MAME_DIR .. "src/mame/drivers/lc80.cpp", MAME_DIR .. "src/mame/includes/lc80.h", MAME_DIR .. "src/mame/drivers/mc80.cpp", MAME_DIR .. "src/mame/includes/mc80.h", MAME_DIR .. "src/mame/machine/mc80.cpp", MAME_DIR .. "src/mame/video/mc80.cpp", MAME_DIR .. "src/mame/drivers/poly880.cpp", MAME_DIR .. "src/mame/includes/poly880.h", MAME_DIR .. "src/mame/drivers/sc1.cpp", MAME_DIR .. "src/mame/drivers/sc2.cpp", } createMESSProjects(_target, _subtarget, "vidbrain") files { MAME_DIR .. "src/mame/drivers/vidbrain.cpp", MAME_DIR .. "src/mame/includes/vidbrain.h", MAME_DIR .. "src/mame/video/uv201.cpp", MAME_DIR .. "src/mame/video/uv201.h", } createMESSProjects(_target, _subtarget, "videoton") files { MAME_DIR .. "src/mame/drivers/tvc.cpp", MAME_DIR .. "src/mame/audio/tvc.cpp", MAME_DIR .. "src/mame/audio/tvc.h", } createMESSProjects(_target, _subtarget, "visual") files { MAME_DIR .. "src/mame/drivers/v1050.cpp", MAME_DIR .. "src/mame/includes/v1050.h", MAME_DIR .. "src/mame/machine/v1050kb.cpp", MAME_DIR .. "src/mame/machine/v1050kb.h", MAME_DIR .. "src/mame/video/v1050.cpp", } createMESSProjects(_target, _subtarget, "votrax") files { MAME_DIR .. "src/mame/drivers/votrpss.cpp", MAME_DIR .. "src/mame/drivers/votrtnt.cpp", } createMESSProjects(_target, _subtarget, "vtech") files { MAME_DIR .. "src/mame/drivers/crvision.cpp", MAME_DIR .. "src/mame/includes/crvision.h", MAME_DIR .. "src/mame/drivers/geniusiq.cpp", MAME_DIR .. "src/mame/drivers/laser3k.cpp", MAME_DIR .. "src/mame/drivers/lcmate2.cpp", MAME_DIR .. "src/mame/drivers/pc4.cpp", MAME_DIR .. "src/mame/includes/pc4.h", MAME_DIR .. "src/mame/video/pc4.cpp", MAME_DIR .. "src/mame/drivers/pc2000.cpp", MAME_DIR .. "src/mame/drivers/pitagjr.cpp", MAME_DIR .. "src/mame/drivers/prestige.cpp", MAME_DIR .. "src/mame/drivers/vtech1.cpp", MAME_DIR .. "src/mame/drivers/vtech2.cpp", MAME_DIR .. "src/mame/includes/vtech2.h", MAME_DIR .. "src/mame/machine/vtech2.cpp", MAME_DIR .. "src/mame/video/vtech2.cpp", MAME_DIR .. "src/mame/drivers/socrates.cpp", MAME_DIR .. "src/mame/audio/socrates.cpp", MAME_DIR .. "src/mame/audio/socrates.h", } createMESSProjects(_target, _subtarget, "wang") files { MAME_DIR .. "src/mame/drivers/wangpc.cpp", MAME_DIR .. "src/mame/includes/wangpc.h", MAME_DIR .. "src/mame/machine/wangpckb.cpp", MAME_DIR .. "src/mame/machine/wangpckb.h", } createMESSProjects(_target, _subtarget, "wavemate") files { MAME_DIR .. "src/mame/drivers/bullet.cpp", MAME_DIR .. "src/mame/includes/bullet.h", MAME_DIR .. "src/mame/drivers/jupiter.cpp", MAME_DIR .. "src/mame/includes/jupiter.h", } createMESSProjects(_target, _subtarget, "xerox") files { MAME_DIR .. "src/mame/drivers/xerox820.cpp", MAME_DIR .. "src/mame/includes/xerox820.h", MAME_DIR .. "src/mame/machine/x820kb.cpp", MAME_DIR .. "src/mame/machine/x820kb.h", MAME_DIR .. "src/mame/drivers/bigbord2.cpp", MAME_DIR .. "src/mame/drivers/alto2.cpp", } createMESSProjects(_target, _subtarget, "xussrpc") files { MAME_DIR .. "src/mame/drivers/ec184x.cpp", MAME_DIR .. "src/mame/includes/ec184x.h", MAME_DIR .. "src/mame/drivers/iskr103x.cpp", MAME_DIR .. "src/mame/drivers/mc1502.cpp", MAME_DIR .. "src/mame/machine/kb_7007_3.h", MAME_DIR .. "src/mame/includes/mc1502.h", MAME_DIR .. "src/mame/drivers/poisk1.cpp", MAME_DIR .. "src/mame/machine/kb_poisk1.h", } createMESSProjects(_target, _subtarget, "yamaha") files { MAME_DIR .. "src/mame/drivers/ymmu100.cpp", MAME_DIR .. "src/mame/drivers/fb01.cpp", } createMESSProjects(_target, _subtarget, "zenith") files { MAME_DIR .. "src/mame/drivers/z100.cpp", } createMESSProjects(_target, _subtarget, "zpa") files { MAME_DIR .. "src/mame/drivers/iq151.cpp", } createMESSProjects(_target, _subtarget, "zvt") files { MAME_DIR .. "src/mame/drivers/pp01.cpp", MAME_DIR .. "src/mame/includes/pp01.h", MAME_DIR .. "src/mame/machine/pp01.cpp", MAME_DIR .. "src/mame/video/pp01.cpp", } createMESSProjects(_target, _subtarget, "skeleton") files { MAME_DIR .. "src/mame/drivers/alesis_qs.cpp", MAME_DIR .. "src/mame/drivers/alphasma.cpp", MAME_DIR .. "src/mame/drivers/ampro.cpp", MAME_DIR .. "src/mame/drivers/amust.cpp", MAME_DIR .. "src/mame/drivers/applix.cpp", MAME_DIR .. "src/mame/drivers/argox.cpp", MAME_DIR .. "src/mame/drivers/attache.cpp", MAME_DIR .. "src/mame/drivers/aussiebyte.cpp", MAME_DIR .. "src/mame/includes/aussiebyte.h", MAME_DIR .. "src/mame/video/aussiebyte.cpp", MAME_DIR .. "src/mame/drivers/ax20.cpp", MAME_DIR .. "src/mame/drivers/beehive.cpp", MAME_DIR .. "src/mame/drivers/binbug.cpp", MAME_DIR .. "src/mame/drivers/besta.cpp", MAME_DIR .. "src/mame/drivers/bitgraph.cpp", MAME_DIR .. "src/mame/drivers/br8641.cpp", MAME_DIR .. "src/mame/drivers/busicom.cpp", MAME_DIR .. "src/mame/includes/busicom.h", MAME_DIR .. "src/mame/video/busicom.cpp", MAME_DIR .. "src/mame/drivers/chaos.cpp", MAME_DIR .. "src/mame/drivers/chesstrv.cpp", MAME_DIR .. "src/mame/drivers/cd2650.cpp", MAME_DIR .. "src/mame/drivers/cdc721.cpp", MAME_DIR .. "src/mame/drivers/codata.cpp", MAME_DIR .. "src/mame/drivers/cortex.cpp", MAME_DIR .. "src/mame/drivers/cosmicos.cpp", MAME_DIR .. "src/mame/includes/cosmicos.h", MAME_DIR .. "src/mame/drivers/cp1.cpp", MAME_DIR .. "src/mame/drivers/cxhumax.cpp", MAME_DIR .. "src/mame/includes/cxhumax.h", MAME_DIR .. "src/mame/drivers/czk80.cpp", MAME_DIR .. "src/mame/drivers/d6800.cpp", MAME_DIR .. "src/mame/drivers/d6809.cpp", MAME_DIR .. "src/mame/drivers/daruma.cpp", MAME_DIR .. "src/mame/drivers/didact.cpp", MAME_DIR .. "src/mame/drivers/digel804.cpp", MAME_DIR .. "src/mame/drivers/dim68k.cpp", MAME_DIR .. "src/mame/drivers/dm7000.cpp", MAME_DIR .. "src/mame/includes/dm7000.h", MAME_DIR .. "src/mame/drivers/dmv.cpp", MAME_DIR .. "src/mame/machine/dmv_keyb.cpp", MAME_DIR .. "src/mame/machine/dmv_keyb.h", MAME_DIR .. "src/mame/drivers/dps1.cpp", MAME_DIR .. "src/mame/drivers/dsb46.cpp", MAME_DIR .. "src/mame/drivers/dual68.cpp", MAME_DIR .. "src/mame/drivers/eacc.cpp", MAME_DIR .. "src/mame/drivers/elwro800.cpp", MAME_DIR .. "src/mame/drivers/eti660.cpp", MAME_DIR .. "src/mame/includes/eti660.h", MAME_DIR .. "src/mame/drivers/excali64.cpp", MAME_DIR .. "src/mame/drivers/fanucs15.cpp", MAME_DIR .. "src/mame/drivers/fanucspmg.cpp", MAME_DIR .. "src/mame/drivers/fc100.cpp", MAME_DIR .. "src/mame/drivers/fcisio.cpp", MAME_DIR .. "src/mame/drivers/fcscsi.cpp", MAME_DIR .. "src/mame/drivers/fk1.cpp", MAME_DIR .. "src/mame/drivers/ft68m.cpp", MAME_DIR .. "src/mame/drivers/gamate.cpp", MAME_DIR .. "src/mame/includes/gamate.h", MAME_DIR .. "src/mame/audio/gamate.cpp", MAME_DIR .. "src/mame/drivers/gameking.cpp", MAME_DIR .. "src/mame/drivers/gimix.cpp", MAME_DIR .. "src/mame/drivers/goupil.cpp", MAME_DIR .. "src/mame/drivers/grfd2301.cpp", MAME_DIR .. "src/mame/drivers/harriet.cpp", MAME_DIR .. "src/mame/drivers/hprot1.cpp", MAME_DIR .. "src/mame/drivers/hpz80unk.cpp", MAME_DIR .. "src/mame/drivers/ht68k.cpp", MAME_DIR .. "src/mame/drivers/hunter2.cpp", MAME_DIR .. "src/mame/drivers/i7000.cpp", MAME_DIR .. "src/mame/drivers/ibm3153.cpp", MAME_DIR .. "src/mame/drivers/ibm6580.cpp", MAME_DIR .. "src/mame/drivers/icatel.cpp", MAME_DIR .. "src/mame/drivers/ie15.cpp", MAME_DIR .. "src/mame/machine/ie15_kbd.cpp", MAME_DIR .. "src/mame/machine/ie15_kbd.h", MAME_DIR .. "src/mame/drivers/if800.cpp", MAME_DIR .. "src/mame/drivers/imsai.cpp", MAME_DIR .. "src/mame/drivers/indiana.cpp", MAME_DIR .. "src/mame/drivers/itt3030.cpp", MAME_DIR .. "src/mame/drivers/jade.cpp", MAME_DIR .. "src/mame/drivers/jonos.cpp", MAME_DIR .. "src/mame/drivers/konin.cpp", MAME_DIR .. "src/mame/drivers/leapster.cpp", MAME_DIR .. "src/mame/drivers/lft.cpp", MAME_DIR .. "src/mame/drivers/lg-dvd.cpp", MAME_DIR .. "src/mame/drivers/lola8a.cpp", MAME_DIR .. "src/mame/drivers/m79152pc.cpp", MAME_DIR .. "src/mame/drivers/marywu.cpp", MAME_DIR .. "src/mame/drivers/mccpm.cpp", MAME_DIR .. "src/mame/drivers/mes.cpp", MAME_DIR .. "src/mame/drivers/mice.cpp", MAME_DIR .. "src/mame/drivers/micral.cpp", MAME_DIR .. "src/mame/drivers/micronic.cpp", MAME_DIR .. "src/mame/includes/micronic.h", MAME_DIR .. "src/mame/drivers/mini2440.cpp", MAME_DIR .. "src/mame/drivers/mmd1.cpp", MAME_DIR .. "src/mame/drivers/mod8.cpp", MAME_DIR .. "src/mame/drivers/modellot.cpp", MAME_DIR .. "src/mame/drivers/molecular.cpp", MAME_DIR .. "src/mame/drivers/ms0515.cpp", MAME_DIR .. "src/mame/drivers/ms9540.cpp", MAME_DIR .. "src/mame/drivers/mstation.cpp", MAME_DIR .. "src/mame/drivers/mt735.cpp", MAME_DIR .. "src/mame/drivers/mx2178.cpp", MAME_DIR .. "src/mame/drivers/mycom.cpp", MAME_DIR .. "src/mame/drivers/myvision.cpp", MAME_DIR .. "src/mame/drivers/notetaker.cpp", MAME_DIR .. "src/mame/drivers/ngen.cpp", MAME_DIR .. "src/mame/machine/ngen_kb.cpp", MAME_DIR .. "src/mame/machine/ngen_kb.h", MAME_DIR .. "src/mame/drivers/octopus.cpp", MAME_DIR .. "src/mame/drivers/onyx.cpp", MAME_DIR .. "src/mame/drivers/okean240.cpp", MAME_DIR .. "src/mame/drivers/p8k.cpp", MAME_DIR .. "src/mame/drivers/pegasus.cpp", MAME_DIR .. "src/mame/drivers/pencil2.cpp", MAME_DIR .. "src/mame/drivers/pes.cpp", MAME_DIR .. "src/mame/includes/pes.h", MAME_DIR .. "src/mame/drivers/pipbug.cpp", MAME_DIR .. "src/mame/drivers/plan80.cpp", MAME_DIR .. "src/mame/drivers/pm68k.cpp", MAME_DIR .. "src/mame/drivers/pockchal.cpp", MAME_DIR .. "src/mame/drivers/poly.cpp", MAME_DIR .. "src/mame/drivers/proteus3.cpp", MAME_DIR .. "src/mame/drivers/pt68k4.cpp", MAME_DIR .. "src/mame/drivers/ptcsol.cpp", MAME_DIR .. "src/mame/drivers/pulsar.cpp", MAME_DIR .. "src/mame/drivers/pv9234.cpp", MAME_DIR .. "src/mame/drivers/qtsbc.cpp", MAME_DIR .. "src/mame/drivers/rd100.cpp", MAME_DIR .. "src/mame/drivers/rvoice.cpp", MAME_DIR .. "src/mame/drivers/sacstate.cpp", MAME_DIR .. "src/mame/drivers/sbrain.cpp", MAME_DIR .. "src/mame/drivers/seattlecmp.cpp", MAME_DIR .. "src/mame/drivers/sh4robot.cpp", MAME_DIR .. "src/mame/drivers/sansa_fuze.cpp", MAME_DIR .. "src/mame/drivers/softbox.cpp", MAME_DIR .. "src/mame/includes/softbox.h", MAME_DIR .. "src/mame/drivers/squale.cpp", MAME_DIR .. "src/mame/drivers/swtpc.cpp", MAME_DIR .. "src/mame/drivers/swyft.cpp", MAME_DIR .. "src/mame/drivers/symbolics.cpp", MAME_DIR .. "src/mame/drivers/sys2900.cpp", MAME_DIR .. "src/mame/drivers/systec.cpp", MAME_DIR .. "src/mame/drivers/tavernie.cpp", MAME_DIR .. "src/mame/drivers/tecnbras.cpp", MAME_DIR .. "src/mame/drivers/terak.cpp", MAME_DIR .. "src/mame/drivers/ti630.cpp", MAME_DIR .. "src/mame/drivers/tsispch.cpp", MAME_DIR .. "src/mame/includes/tsispch.h", MAME_DIR .. "src/mame/drivers/tvgame.cpp", MAME_DIR .. "src/mame/drivers/unistar.cpp", MAME_DIR .. "src/mame/drivers/v6809.cpp", MAME_DIR .. "src/mame/drivers/vector4.cpp", MAME_DIR .. "src/mame/drivers/vii.cpp", MAME_DIR .. "src/mame/drivers/vsmilepro.cpp", MAME_DIR .. "src/mame/drivers/wicat.cpp", MAME_DIR .. "src/mame/drivers/xor100.cpp", MAME_DIR .. "src/mame/includes/xor100.h", MAME_DIR .. "src/mame/drivers/xavix.cpp", MAME_DIR .. "src/mame/drivers/zorba.cpp", MAME_DIR .. "src/mame/drivers/mvme350.cpp", } end
gpl-2.0
assaad/JavaBlasLapack
src/main/java/org/netlib/lapack/Dlaein.java
22163
package org.netlib.lapack; import org.netlib.blas.Dasum; import org.netlib.blas.Dnrm2; import org.netlib.blas.Dscal; import org.netlib.blas.Idamax; import org.netlib.util.doubleW; import org.netlib.util.intW; public final class Dlaein { public static void dlaein(boolean paramBoolean1, boolean paramBoolean2, int paramInt1, double[] paramArrayOfDouble1, int paramInt2, int paramInt3, double paramDouble1, double paramDouble2, double[] paramArrayOfDouble2, int paramInt4, double[] paramArrayOfDouble3, int paramInt5, double[] paramArrayOfDouble4, int paramInt6, int paramInt7, double[] paramArrayOfDouble5, int paramInt8, double paramDouble3, double paramDouble4, double paramDouble5, intW paramintW) { String str1 = new String(" "); String str2 = new String(" "); int i = 0; int j = 0; int k = 0; int m = 0; intW localintW = new intW(0); int n = 0; int i1 = 0; double d1 = 0.0D; double d2 = 0.0D; double d3 = 0.0D; double d4 = 0.0D; double d5 = 0.0D; double d6 = 0.0D; double d7 = 0.0D; double d8 = 0.0D; double d9 = 0.0D; doubleW localdoubleW = new doubleW(0.0D); double d10 = 0.0D; double d11 = 0.0D; double d12 = 0.0D; double d13 = 0.0D; double d14 = 0.0D; double d15 = 0.0D; double d16 = 0.0D; double d17 = 0.0D; double d18 = 0.0D; double d19 = 0.0D; paramintW.val = 0; d9 = Math.sqrt(paramInt1); d5 = 0.1D / d9; d7 = Math.max(1.0D, paramDouble3 * d9) * paramDouble4; i1 = 1; int i3; for (int i2 = paramInt1 - 1 + 1; i2 > 0; i2--) { i = 1; for (i3 = i1 - 1 - 1 + 1; i3 > 0; i3--) { paramArrayOfDouble4[(i - 1 + (i1 - 1) * paramInt7 + paramInt6)] = paramArrayOfDouble1[(i - 1 + (i1 - 1) * paramInt3 + paramInt2)]; i += 1; } paramArrayOfDouble1[(i1 - 1 + (i1 - 1) * paramInt3 + paramInt2)] -= paramDouble1; i1 += 1; } if ((paramDouble2 != 0.0D ? 0 : 1) != 0) { if (paramBoolean2) { i = 1; for (i2 = paramInt1 - 1 + 1; i2 > 0; i2--) { paramArrayOfDouble2[(i - 1 + paramInt4)] = paramDouble3; i += 1; } } else { d13 = Dnrm2.dnrm2(paramInt1, paramArrayOfDouble2, paramInt4, 1); Dscal.dscal(paramInt1, paramDouble3 * d9 / Math.max(d13, d7), paramArrayOfDouble2, paramInt4, 1); } if (paramBoolean1) { i = 1; for (i2 = paramInt1 - 1 - 1 + 1; i2 > 0; i2--) { d3 = paramArrayOfDouble1[(i + 1 - 1 + (i - 1) * paramInt3 + paramInt2)]; if ((Math.abs(paramArrayOfDouble4[(i - 1 + (i - 1) * paramInt7 + paramInt6)]) >= Math.abs(d3) ? 0 : 1) != 0) { d16 = paramArrayOfDouble4[(i - 1 + (i - 1) * paramInt7 + paramInt6)] / d3; paramArrayOfDouble4[(i - 1 + (i - 1) * paramInt7 + paramInt6)] = d3; i1 = i + 1; for (i3 = paramInt1 - (i + 1) + 1; i3 > 0; i3--) { d10 = paramArrayOfDouble4[(i + 1 - 1 + (i1 - 1) * paramInt7 + paramInt6)]; paramArrayOfDouble4[(i + 1 - 1 + (i1 - 1) * paramInt7 + paramInt6)] = (paramArrayOfDouble4[(i - 1 + (i1 - 1) * paramInt7 + paramInt6)] - d16 * d10); paramArrayOfDouble4[(i - 1 + (i1 - 1) * paramInt7 + paramInt6)] = d10; i1 += 1; } } else { if ((paramArrayOfDouble4[(i - 1 + (i - 1) * paramInt7 + paramInt6)] != 0.0D ? 0 : 1) != 0) { paramArrayOfDouble4[(i - 1 + (i - 1) * paramInt7 + paramInt6)] = paramDouble3; } d16 = d3 / paramArrayOfDouble4[(i - 1 + (i - 1) * paramInt7 + paramInt6)]; if ((d16 == 0.0D ? 0 : 1) != 0) { i1 = i + 1; for (i3 = paramInt1 - (i + 1) + 1; i3 > 0; i3--) { paramArrayOfDouble4[(i + 1 - 1 + (i1 - 1) * paramInt7 + paramInt6)] -= d16 * paramArrayOfDouble4[(i - 1 + (i1 - 1) * paramInt7 + paramInt6)]; i1 += 1; } } } i += 1; } if ((paramArrayOfDouble4[(paramInt1 - 1 + (paramInt1 - 1) * paramInt7 + paramInt6)] != 0.0D ? 0 : 1) != 0) { paramArrayOfDouble4[(paramInt1 - 1 + (paramInt1 - 1) * paramInt7 + paramInt6)] = paramDouble3; } str2 = "N"; } else { i1 = paramInt1; for (i2 = (2 - paramInt1 + -1) / -1; i2 > 0; i2--) { d4 = paramArrayOfDouble1[(i1 - 1 + (i1 - 1 - 1) * paramInt3 + paramInt2)]; if ((Math.abs(paramArrayOfDouble4[(i1 - 1 + (i1 - 1) * paramInt7 + paramInt6)]) >= Math.abs(d4) ? 0 : 1) != 0) { d16 = paramArrayOfDouble4[(i1 - 1 + (i1 - 1) * paramInt7 + paramInt6)] / d4; paramArrayOfDouble4[(i1 - 1 + (i1 - 1) * paramInt7 + paramInt6)] = d4; i = 1; for (i3 = i1 - 1 - 1 + 1; i3 > 0; i3--) { d10 = paramArrayOfDouble4[(i - 1 + (i1 - 1 - 1) * paramInt7 + paramInt6)]; paramArrayOfDouble4[(i - 1 + (i1 - 1 - 1) * paramInt7 + paramInt6)] = (paramArrayOfDouble4[(i - 1 + (i1 - 1) * paramInt7 + paramInt6)] - d16 * d10); paramArrayOfDouble4[(i - 1 + (i1 - 1) * paramInt7 + paramInt6)] = d10; i += 1; } } else { if ((paramArrayOfDouble4[(i1 - 1 + (i1 - 1) * paramInt7 + paramInt6)] != 0.0D ? 0 : 1) != 0) { paramArrayOfDouble4[(i1 - 1 + (i1 - 1) * paramInt7 + paramInt6)] = paramDouble3; } d16 = d4 / paramArrayOfDouble4[(i1 - 1 + (i1 - 1) * paramInt7 + paramInt6)]; if ((d16 == 0.0D ? 0 : 1) != 0) { i = 1; for (i3 = i1 - 1 - 1 + 1; i3 > 0; i3--) { paramArrayOfDouble4[(i - 1 + (i1 - 1 - 1) * paramInt7 + paramInt6)] -= d16 * paramArrayOfDouble4[(i - 1 + (i1 - 1) * paramInt7 + paramInt6)]; i += 1; } } } i1 += -1; } if ((paramArrayOfDouble4[(1 - 1 + (1 - 1) * paramInt7 + paramInt6)] != 0.0D ? 0 : 1) != 0) { paramArrayOfDouble4[(1 - 1 + (1 - 1) * paramInt7 + paramInt6)] = paramDouble3; } str2 = "T"; } str1 = "N"; n = 1; for (i2 = paramInt1 - 1 + 1; i2 > 0; i2--) { Dlatrs.dlatrs("Upper", str2, "Nonunit", str1, paramInt1, paramArrayOfDouble4, paramInt6, paramInt7, paramArrayOfDouble2, paramInt4, localdoubleW, paramArrayOfDouble5, paramInt8, localintW); str1 = "Y"; d13 = Dasum.dasum(paramInt1, paramArrayOfDouble2, paramInt4, 1); if ((d13 < d5 * localdoubleW.val ? 0 : 1) != 0) { break; } d10 = paramDouble3 / (d9 + 1.0D); paramArrayOfDouble2[(1 - 1 + paramInt4)] = paramDouble3; i = 2; for (i3 = paramInt1 - 2 + 1; i3 > 0; i3--) { paramArrayOfDouble2[(i - 1 + paramInt4)] = d10; i += 1; } paramArrayOfDouble2[(paramInt1 - n + 1 - 1 + paramInt4)] -= paramDouble3 * d9; n += 1; } paramintW.val = 1; i = Idamax.idamax(paramInt1, paramArrayOfDouble2, paramInt4, 1); Dscal.dscal(paramInt1, 1.0D / Math.abs(paramArrayOfDouble2[(i - 1 + paramInt4)]), paramArrayOfDouble2, paramInt4, 1); } else { if (paramBoolean2) { i = 1; for (i2 = paramInt1 - 1 + 1; i2 > 0; i2--) { paramArrayOfDouble2[(i - 1 + paramInt4)] = paramDouble3; paramArrayOfDouble3[(i - 1 + paramInt5)] = 0.0D; i += 1; } } else { d6 = Dlapy2.dlapy2(Dnrm2.dnrm2(paramInt1, paramArrayOfDouble2, paramInt4, 1), Dnrm2.dnrm2(paramInt1, paramArrayOfDouble3, paramInt5, 1)); d8 = paramDouble3 * d9 / Math.max(d6, d7); Dscal.dscal(paramInt1, d8, paramArrayOfDouble2, paramInt4, 1); Dscal.dscal(paramInt1, d8, paramArrayOfDouble3, paramInt5, 1); } if (paramBoolean1) { paramArrayOfDouble4[(2 - 1 + (1 - 1) * paramInt7 + paramInt6)] = (-paramDouble2); i = 2; for (i2 = paramInt1 - 2 + 1; i2 > 0; i2--) { paramArrayOfDouble4[(i + 1 - 1 + (1 - 1) * paramInt7 + paramInt6)] = 0.0D; i += 1; } i = 1; for (i2 = paramInt1 - 1 - 1 + 1; i2 > 0; i2--) { d1 = Dlapy2.dlapy2(paramArrayOfDouble4[(i - 1 + (i - 1) * paramInt7 + paramInt6)], paramArrayOfDouble4[(i + 1 - 1 + (i - 1) * paramInt7 + paramInt6)]); d3 = paramArrayOfDouble1[(i + 1 - 1 + (i - 1) * paramInt3 + paramInt2)]; if ((d1 >= Math.abs(d3) ? 0 : 1) != 0) { d18 = paramArrayOfDouble4[(i - 1 + (i - 1) * paramInt7 + paramInt6)] / d3; d17 = paramArrayOfDouble4[(i + 1 - 1 + (i - 1) * paramInt7 + paramInt6)] / d3; paramArrayOfDouble4[(i - 1 + (i - 1) * paramInt7 + paramInt6)] = d3; paramArrayOfDouble4[(i + 1 - 1 + (i - 1) * paramInt7 + paramInt6)] = 0.0D; i1 = i + 1; for (i3 = paramInt1 - (i + 1) + 1; i3 > 0; i3--) { d10 = paramArrayOfDouble4[(i + 1 - 1 + (i1 - 1) * paramInt7 + paramInt6)]; paramArrayOfDouble4[(i + 1 - 1 + (i1 - 1) * paramInt7 + paramInt6)] = (paramArrayOfDouble4[(i - 1 + (i1 - 1) * paramInt7 + paramInt6)] - d18 * d10); paramArrayOfDouble4[(i1 + 1 - 1 + (i + 1 - 1) * paramInt7 + paramInt6)] = (paramArrayOfDouble4[(i1 + 1 - 1 + (i - 1) * paramInt7 + paramInt6)] - d17 * d10); paramArrayOfDouble4[(i - 1 + (i1 - 1) * paramInt7 + paramInt6)] = d10; paramArrayOfDouble4[(i1 + 1 - 1 + (i - 1) * paramInt7 + paramInt6)] = 0.0D; i1 += 1; } paramArrayOfDouble4[(i + 2 - 1 + (i - 1) * paramInt7 + paramInt6)] = (-paramDouble2); paramArrayOfDouble4[(i + 1 - 1 + (i + 1 - 1) * paramInt7 + paramInt6)] -= d17 * paramDouble2; paramArrayOfDouble4[(i + 2 - 1 + (i + 1 - 1) * paramInt7 + paramInt6)] += d18 * paramDouble2; } else { if ((d1 != 0.0D ? 0 : 1) != 0) { paramArrayOfDouble4[(i - 1 + (i - 1) * paramInt7 + paramInt6)] = paramDouble3; paramArrayOfDouble4[(i + 1 - 1 + (i - 1) * paramInt7 + paramInt6)] = 0.0D; d1 = paramDouble3; } d3 = d3 / d1 / d1; d18 = paramArrayOfDouble4[(i - 1 + (i - 1) * paramInt7 + paramInt6)] * d3; d17 = -(paramArrayOfDouble4[(i + 1 - 1 + (i - 1) * paramInt7 + paramInt6)] * d3); i1 = i + 1; for (i3 = paramInt1 - (i + 1) + 1; i3 > 0; i3--) { paramArrayOfDouble4[(i + 1 - 1 + (i1 - 1) * paramInt7 + paramInt6)] = (paramArrayOfDouble4[(i + 1 - 1 + (i1 - 1) * paramInt7 + paramInt6)] - d18 * paramArrayOfDouble4[(i - 1 + (i1 - 1) * paramInt7 + paramInt6)] + d17 * paramArrayOfDouble4[(i1 + 1 - 1 + (i - 1) * paramInt7 + paramInt6)]); paramArrayOfDouble4[(i1 + 1 - 1 + (i + 1 - 1) * paramInt7 + paramInt6)] = (-(d18 * paramArrayOfDouble4[(i1 + 1 - 1 + (i - 1) * paramInt7 + paramInt6)]) - d17 * paramArrayOfDouble4[(i - 1 + (i1 - 1) * paramInt7 + paramInt6)]); i1 += 1; } paramArrayOfDouble4[(i + 2 - 1 + (i + 1 - 1) * paramInt7 + paramInt6)] -= paramDouble2; } paramArrayOfDouble5[(i - 1 + paramInt8)] = (Dasum.dasum(paramInt1 - i, paramArrayOfDouble4, i - 1 + (i + 1 - 1) * paramInt7 + paramInt6, paramInt7) + Dasum.dasum(paramInt1 - i, paramArrayOfDouble4, i + 2 - 1 + (i - 1) * paramInt7 + paramInt6, 1)); i += 1; } if ((paramArrayOfDouble4[(paramInt1 - 1 + (paramInt1 - 1) * paramInt7 + paramInt6)] != 0.0D ? 0 : 1) != 0) {} if (((paramArrayOfDouble4[(paramInt1 + 1 - 1 + (paramInt1 - 1) * paramInt7 + paramInt6)] != 0.0D ? 0 : 1) != 0 ? 1 : 0) != 0) { paramArrayOfDouble4[(paramInt1 - 1 + (paramInt1 - 1) * paramInt7 + paramInt6)] = paramDouble3; } paramArrayOfDouble5[(paramInt1 - 1 + paramInt8)] = 0.0D; j = paramInt1; k = 1; m = -1; } else { paramArrayOfDouble4[(paramInt1 + 1 - 1 + (paramInt1 - 1) * paramInt7 + paramInt6)] = paramDouble2; i1 = 1; for (i2 = paramInt1 - 1 - 1 + 1; i2 > 0; i2--) { paramArrayOfDouble4[(paramInt1 + 1 - 1 + (i1 - 1) * paramInt7 + paramInt6)] = 0.0D; i1 += 1; } i1 = paramInt1; for (i2 = (2 - paramInt1 + -1) / -1; i2 > 0; i2--) { d4 = paramArrayOfDouble1[(i1 - 1 + (i1 - 1 - 1) * paramInt3 + paramInt2)]; d2 = Dlapy2.dlapy2(paramArrayOfDouble4[(i1 - 1 + (i1 - 1) * paramInt7 + paramInt6)], paramArrayOfDouble4[(i1 + 1 - 1 + (i1 - 1) * paramInt7 + paramInt6)]); if ((d2 >= Math.abs(d4) ? 0 : 1) != 0) { d18 = paramArrayOfDouble4[(i1 - 1 + (i1 - 1) * paramInt7 + paramInt6)] / d4; d17 = paramArrayOfDouble4[(i1 + 1 - 1 + (i1 - 1) * paramInt7 + paramInt6)] / d4; paramArrayOfDouble4[(i1 - 1 + (i1 - 1) * paramInt7 + paramInt6)] = d4; paramArrayOfDouble4[(i1 + 1 - 1 + (i1 - 1) * paramInt7 + paramInt6)] = 0.0D; i = 1; for (i3 = i1 - 1 - 1 + 1; i3 > 0; i3--) { d10 = paramArrayOfDouble4[(i - 1 + (i1 - 1 - 1) * paramInt7 + paramInt6)]; paramArrayOfDouble4[(i - 1 + (i1 - 1 - 1) * paramInt7 + paramInt6)] = (paramArrayOfDouble4[(i - 1 + (i1 - 1) * paramInt7 + paramInt6)] - d18 * d10); paramArrayOfDouble4[(i1 - 1 + (i - 1) * paramInt7 + paramInt6)] = (paramArrayOfDouble4[(i1 + 1 - 1 + (i - 1) * paramInt7 + paramInt6)] - d17 * d10); paramArrayOfDouble4[(i - 1 + (i1 - 1) * paramInt7 + paramInt6)] = d10; paramArrayOfDouble4[(i1 + 1 - 1 + (i - 1) * paramInt7 + paramInt6)] = 0.0D; i += 1; } paramArrayOfDouble4[(i1 + 1 - 1 + (i1 - 1 - 1) * paramInt7 + paramInt6)] = paramDouble2; paramArrayOfDouble4[(i1 - 1 - 1 + (i1 - 1 - 1) * paramInt7 + paramInt6)] += d17 * paramDouble2; paramArrayOfDouble4[(i1 - 1 + (i1 - 1 - 1) * paramInt7 + paramInt6)] -= d18 * paramDouble2; } else { if ((d2 != 0.0D ? 0 : 1) != 0) { paramArrayOfDouble4[(i1 - 1 + (i1 - 1) * paramInt7 + paramInt6)] = paramDouble3; paramArrayOfDouble4[(i1 + 1 - 1 + (i1 - 1) * paramInt7 + paramInt6)] = 0.0D; d2 = paramDouble3; } d4 = d4 / d2 / d2; d18 = paramArrayOfDouble4[(i1 - 1 + (i1 - 1) * paramInt7 + paramInt6)] * d4; d17 = -(paramArrayOfDouble4[(i1 + 1 - 1 + (i1 - 1) * paramInt7 + paramInt6)] * d4); i = 1; for (i3 = i1 - 1 - 1 + 1; i3 > 0; i3--) { paramArrayOfDouble4[(i - 1 + (i1 - 1 - 1) * paramInt7 + paramInt6)] = (paramArrayOfDouble4[(i - 1 + (i1 - 1 - 1) * paramInt7 + paramInt6)] - d18 * paramArrayOfDouble4[(i - 1 + (i1 - 1) * paramInt7 + paramInt6)] + d17 * paramArrayOfDouble4[(i1 + 1 - 1 + (i - 1) * paramInt7 + paramInt6)]); paramArrayOfDouble4[(i1 - 1 + (i - 1) * paramInt7 + paramInt6)] = (-(d18 * paramArrayOfDouble4[(i1 + 1 - 1 + (i - 1) * paramInt7 + paramInt6)]) - d17 * paramArrayOfDouble4[(i - 1 + (i1 - 1) * paramInt7 + paramInt6)]); i += 1; } paramArrayOfDouble4[(i1 - 1 + (i1 - 1 - 1) * paramInt7 + paramInt6)] += paramDouble2; } paramArrayOfDouble5[(i1 - 1 + paramInt8)] = (Dasum.dasum(i1 - 1, paramArrayOfDouble4, 1 - 1 + (i1 - 1) * paramInt7 + paramInt6, 1) + Dasum.dasum(i1 - 1, paramArrayOfDouble4, i1 + 1 - 1 + (1 - 1) * paramInt7 + paramInt6, paramInt7)); i1 += -1; } if ((paramArrayOfDouble4[(1 - 1 + (1 - 1) * paramInt7 + paramInt6)] != 0.0D ? 0 : 1) != 0) {} if (((paramArrayOfDouble4[(2 - 1 + (1 - 1) * paramInt7 + paramInt6)] != 0.0D ? 0 : 1) != 0 ? 1 : 0) != 0) { paramArrayOfDouble4[(1 - 1 + (1 - 1) * paramInt7 + paramInt6)] = paramDouble3; } paramArrayOfDouble5[(1 - 1 + paramInt8)] = 0.0D; j = 1; k = paramInt1; m = 1; } n = 1; for (i2 = paramInt1 - 1 + 1; i2 > 0; i2--) { localdoubleW.val = 1.0D; d12 = 1.0D; d11 = paramDouble5; i = j; for (i3 = (k - j + m) / m; i3 > 0; i3--) { if ((paramArrayOfDouble5[(i - 1 + paramInt8)] <= d11 ? 0 : 1) != 0) { d8 = 1.0D / d12; Dscal.dscal(paramInt1, d8, paramArrayOfDouble2, paramInt4, 1); Dscal.dscal(paramInt1, d8, paramArrayOfDouble3, paramInt5, 1); localdoubleW.val *= d8; d12 = 1.0D; d11 = paramDouble5; } d18 = paramArrayOfDouble2[(i - 1 + paramInt4)]; d17 = paramArrayOfDouble3[(i - 1 + paramInt5)]; int i4; if (paramBoolean1) { i1 = i + 1; for (i4 = paramInt1 - (i + 1) + 1; i4 > 0; i4--) { d18 = d18 - paramArrayOfDouble4[(i - 1 + (i1 - 1) * paramInt7 + paramInt6)] * paramArrayOfDouble2[(i1 - 1 + paramInt4)] + paramArrayOfDouble4[(i1 + 1 - 1 + (i - 1) * paramInt7 + paramInt6)] * paramArrayOfDouble3[(i1 - 1 + paramInt5)]; d17 = d17 - paramArrayOfDouble4[(i - 1 + (i1 - 1) * paramInt7 + paramInt6)] * paramArrayOfDouble3[(i1 - 1 + paramInt5)] - paramArrayOfDouble4[(i1 + 1 - 1 + (i - 1) * paramInt7 + paramInt6)] * paramArrayOfDouble2[(i1 - 1 + paramInt4)]; i1 += 1; } } else { i1 = 1; for (i4 = i - 1 - 1 + 1; i4 > 0; i4--) { d18 = d18 - paramArrayOfDouble4[(i1 - 1 + (i - 1) * paramInt7 + paramInt6)] * paramArrayOfDouble2[(i1 - 1 + paramInt4)] + paramArrayOfDouble4[(i + 1 - 1 + (i1 - 1) * paramInt7 + paramInt6)] * paramArrayOfDouble3[(i1 - 1 + paramInt5)]; d17 = d17 - paramArrayOfDouble4[(i1 - 1 + (i - 1) * paramInt7 + paramInt6)] * paramArrayOfDouble3[(i1 - 1 + paramInt5)] - paramArrayOfDouble4[(i + 1 - 1 + (i1 - 1) * paramInt7 + paramInt6)] * paramArrayOfDouble2[(i1 - 1 + paramInt4)]; i1 += 1; } } d14 = Math.abs(paramArrayOfDouble4[(i - 1 + (i - 1) * paramInt7 + paramInt6)]) + Math.abs(paramArrayOfDouble4[(i + 1 - 1 + (i - 1) * paramInt7 + paramInt6)]); if ((d14 <= paramDouble4 ? 0 : 1) != 0) { if ((d14 >= 1.0D ? 0 : 1) != 0) { d15 = Math.abs(d18) + Math.abs(d17); if ((d15 <= d14 * paramDouble5 ? 0 : 1) != 0) { d8 = 1.0D / d15; Dscal.dscal(paramInt1, d8, paramArrayOfDouble2, paramInt4, 1); Dscal.dscal(paramInt1, d8, paramArrayOfDouble3, paramInt5, 1); d18 = paramArrayOfDouble2[(i - 1 + paramInt4)]; d17 = paramArrayOfDouble3[(i - 1 + paramInt5)]; localdoubleW.val *= d8; d12 *= d8; } } dladiv_adapter(d18, d17, paramArrayOfDouble4[(i - 1 + (i - 1) * paramInt7 + paramInt6)], paramArrayOfDouble4[(i + 1 - 1 + (i - 1) * paramInt7 + paramInt6)], paramArrayOfDouble2, i - 1 + paramInt4, paramArrayOfDouble3, i - 1 + paramInt5); d12 = Math.max(Math.abs(paramArrayOfDouble2[(i - 1 + paramInt4)]) + Math.abs(paramArrayOfDouble3[(i - 1 + paramInt5)]), d12); d11 = paramDouble5 / d12; } else { i1 = 1; for (i4 = paramInt1 - 1 + 1; i4 > 0; i4--) { paramArrayOfDouble2[(i1 - 1 + paramInt4)] = 0.0D; paramArrayOfDouble3[(i1 - 1 + paramInt5)] = 0.0D; i1 += 1; } paramArrayOfDouble2[(i - 1 + paramInt4)] = 1.0D; paramArrayOfDouble3[(i - 1 + paramInt5)] = 1.0D; localdoubleW.val = 0.0D; d12 = 1.0D; d11 = paramDouble5; } i += m; } d13 = Dasum.dasum(paramInt1, paramArrayOfDouble2, paramInt4, 1) + Dasum.dasum(paramInt1, paramArrayOfDouble3, paramInt5, 1); if ((d13 < d5 * localdoubleW.val ? 0 : 1) != 0) { break; } d19 = paramDouble3 / (d9 + 1.0D); paramArrayOfDouble2[(1 - 1 + paramInt4)] = paramDouble3; paramArrayOfDouble3[(1 - 1 + paramInt5)] = 0.0D; i = 2; for (i3 = paramInt1 - 2 + 1; i3 > 0; i3--) { paramArrayOfDouble2[(i - 1 + paramInt4)] = d19; paramArrayOfDouble3[(i - 1 + paramInt5)] = 0.0D; i += 1; } paramArrayOfDouble2[(paramInt1 - n + 1 - 1 + paramInt4)] -= paramDouble3 * d9; n += 1; } paramintW.val = 1; d13 = 0.0D; i = 1; for (i2 = paramInt1 - 1 + 1; i2 > 0; i2--) { d13 = Math.max(d13, Math.abs(paramArrayOfDouble2[(i - 1 + paramInt4)]) + Math.abs(paramArrayOfDouble3[(i - 1 + paramInt5)])); i += 1; } Dscal.dscal(paramInt1, 1.0D / d13, paramArrayOfDouble2, paramInt4, 1); Dscal.dscal(paramInt1, 1.0D / d13, paramArrayOfDouble3, paramInt5, 1); } } private static void dladiv_adapter(double paramDouble1, double paramDouble2, double paramDouble3, double paramDouble4, double[] paramArrayOfDouble1, int paramInt1, double[] paramArrayOfDouble2, int paramInt2) { doubleW localdoubleW1 = new doubleW(paramArrayOfDouble1[paramInt1]); doubleW localdoubleW2 = new doubleW(paramArrayOfDouble2[paramInt2]); Dladiv.dladiv(paramDouble1, paramDouble2, paramDouble3, paramDouble4, localdoubleW1, localdoubleW2); paramArrayOfDouble1[paramInt1] = localdoubleW1.val; paramArrayOfDouble2[paramInt2] = localdoubleW2.val; } } /* Location: /Users/assaad/Downloads/arpack_combined_all/!/org/netlib/lapack/Dlaein.class * Java compiler version: 1 (45.3) * JD-Core Version: 0.7.1 */
gpl-2.0
Hyrtwol/NUnit-HTML-Report-Generator
NUnitHtmlReportGenerator.Test/BuildEngineTest.cs
1973
using System; using System.Diagnostics; using Microsoft.Build.BuildEngine; using Microsoft.Build.Framework; using NUnit.Framework; namespace Jatech.NUnit.Test { public abstract class BuildEngineTest { #pragma warning disable 0618 protected BuildEngineTest() { Verbosity = LoggerVerbosity.Normal; } protected Engine Engine { get; private set; } protected string DefaultTargets { get; set; } protected LoggerVerbosity Verbosity { get; set; } [SetUp] public virtual void SetUp() { //Console.WriteLine("Engine SetUp"); Engine = new Engine(); Engine.DefaultToolsVersion = "4.0"; WriteEngineVersions(); RegisterEngineLoggers(); /* project = engine.CreateNewProject(); project.DefaultTargets = "Build"; var buildTarget = project.Targets.AddNewTarget("Build"); */ } protected virtual void RegisterEngineLoggers() { var logger = new ConsoleLogger(); logger.Verbosity = Verbosity; Engine.RegisterLogger(logger); } [Conditional("DEBUG")] protected void WriteEngineVersions() { Debug.WriteLine("Engine.Version={0}", Engine.Version); Debug.WriteLine("Engine.DefaultToolsVersion={0}", Engine.DefaultToolsVersion); } [TearDown] public virtual void TearDown() { //Console.WriteLine("Engine TearDown"); Engine.UnloadAllProjects(); Engine.UnregisterAllLoggers(); Engine.Shutdown(); Engine = null; } protected void AssertProjectBuild(Project project, bool expectedResult = true) { Assert.AreEqual(expectedResult, project.Build(DefaultTargets), "MSBuild failed."); } #pragma warning restore 0618 } }
gpl-2.0
iammyr/Benchmark
src/main/java/org/owasp/benchmark/testcode/BenchmarkTest16115.java
3753
/** * OWASP Benchmark Project v1.1 * * This file is part of the Open Web Application Security Project (OWASP) * Benchmark Project. For details, please see * <a href="https://www.owasp.org/index.php/Benchmark">https://www.owasp.org/index.php/Benchmark</a>. * * The Benchmark 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, version 2. * * The Benchmark 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 * * @author Nick Sanidas <a href="https://www.aspectsecurity.com">Aspect Security</a> * @created 2015 */ package org.owasp.benchmark.testcode; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet("/BenchmarkTest16115") public class BenchmarkTest16115 extends HttpServlet { private static final long serialVersionUID = 1L; @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } @Override public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String param = ""; java.util.Enumeration<String> headers = request.getHeaders("foo"); if (headers.hasMoreElements()) { param = headers.nextElement(); // just grab first element } String bar = doSomething(param); // Create the file first so the test won't throw an exception if it doesn't exist. // Note: Don't actually do this because this method signature could cause a tool to find THIS file constructor // as a vuln, rather than the File signature we are trying to actually test. // If necessary, just run the benchmark twice. The 1st run should create all the necessary files. //new java.io.File(org.owasp.benchmark.helpers.Utils.testfileDir + bar).createNewFile(); java.io.FileInputStream fileInputStream = new java.io.FileInputStream( org.owasp.benchmark.helpers.Utils.testfileDir + bar); java.io.FileDescriptor fd = fileInputStream.getFD(); java.io.FileOutputStream anotOutputStream = new java.io.FileOutputStream(fd); } // end doPost private static String doSomething(String param) throws ServletException, IOException { // Chain a bunch of propagators in sequence String a48960 = param; //assign StringBuilder b48960 = new StringBuilder(a48960); // stick in stringbuilder b48960.append(" SafeStuff"); // append some safe content b48960.replace(b48960.length()-"Chars".length(),b48960.length(),"Chars"); //replace some of the end content java.util.HashMap<String,Object> map48960 = new java.util.HashMap<String,Object>(); map48960.put("key48960", b48960.toString()); // put in a collection String c48960 = (String)map48960.get("key48960"); // get it back out String d48960 = c48960.substring(0,c48960.length()-1); // extract most of it String e48960 = new String( new sun.misc.BASE64Decoder().decodeBuffer( new sun.misc.BASE64Encoder().encode( d48960.getBytes() ) )); // B64 encode and decode it String f48960 = e48960.split(" ")[0]; // split it on a space org.owasp.benchmark.helpers.ThingInterface thing = org.owasp.benchmark.helpers.ThingFactory.createThing(); String g48960 = "barbarians_at_the_gate"; // This is static so this whole flow is 'safe' String bar = thing.doSomething(g48960); // reflection return bar; } }
gpl-2.0
TU-Berlin-SNET/jTR-ABE
src/main/java/trabe/lw14/policy/LsssMatrixCell.java
1688
package trabe.lw14.policy; import it.unisa.dia.gas.jpbc.Element; import trabe.AbeInputStream; import trabe.AbeOutputStream; import java.io.IOException; /** * */ public class LsssMatrixCell { public int i; public int j; public int value; public String attribute; public Element hashedElement; private LsssMatrixCell(){} public LsssMatrixCell(int i, int j, int value, String attribute, Element hashedElement) { this.i = i; this.j = j; this.value = value; this.attribute = attribute; this.hashedElement = hashedElement; } public String toString(){ return "["+i+","+j+"] " + attribute + ": " + value + "(" + hashedElement + ")"; } public void writeToStream(AbeOutputStream stream) throws IOException { stream.writeInt(value); stream.writeString(attribute); stream.writeElement(hashedElement); } public static LsssMatrixCell readFromStream(AbeInputStream stream) throws IOException { LsssMatrixCell cell = new LsssMatrixCell(); cell.value = stream.readInt(); cell.attribute = stream.readString(); cell.hashedElement = stream.readElement(); return cell; } @Override public boolean equals(Object obj) { if (obj == null || !(obj instanceof LsssMatrixCell)) { return false; } else if(this == obj) { return true; } LsssMatrixCell c = (LsssMatrixCell)obj; return i == c.i && j == c.j && value == c.value && attribute.equals(c.attribute) && hashedElement.equals(c.hashedElement); } }
gpl-2.0
wavexx/python-bond
bond/__init__.py
14300
import json import os import pexpect import pkg_resources import re import sys import tty from bond import protocols try: from shlex import quote except ImportError: from pipes import quote # Host constants LANG = 'Python' # Identity language PROTO = ['PICKLE', 'JSON'] # Supported protocols, in order of preference # pexpect helper class Spawn(pexpect.spawn): def __init__(self, *args, **kwargs): kwargs.setdefault('env', {})['TERM'] = 'dumb' super(Spawn, self).__init__(*args, **kwargs) tty.setraw(self.child_fd) def noecho(self): self.setecho(False) self.waitnoecho() def sendline_noecho(self, *args, **kwargs): self.noecho() return self.sendline(*args, **kwargs) def expect_noecho(self, *args, **kwargs): self.noecho() return self.expect(*args, **kwargs) def expect_exact_noecho(self, *args, **kwargs): self.noecho() return self.expect_exact(*args, **kwargs) # Our exceptions class BondException(RuntimeError): def __init__(self, lang, error): self.lang = lang self.error = error super(BondException, self).__init__(error) def __str__(self): return "BondException[{lang}]: {msg}".format(lang=self.lang, msg=self.error) class TerminatedException(BondException): def __init__(self, lang, error): super(TerminatedException, self).__init__(lang, error) def __str__(self): return "TerminatedException[{lang}]: {msg}".format(lang=self.lang, msg=self.error) class SerializationException(BondException, TypeError): def __init__(self, lang, error, side): self.side = side super(SerializationException, self).__init__(lang, error) def __str__(self): return "SerializationException[{lang}, {side}]: {msg}".format( lang=self.lang, side=self.side, msg=self.error) class RemoteException(BondException): def __init__(self, lang, error, data): self.data = data super(RemoteException, self).__init__(lang, error) def __str__(self): return "RemoteException[{lang}]: {msg}".format(lang=self.lang, msg=self.error) # The main host controller class Ref(object): def __init__(self, bond, code): self.bond = bond self.code = code class Bond(object): def __init__(self, proc, trans_except, lang='<unknown>', proto=protocols.JSON): '''Construct a bond using an pre-initialized interpreter. Use ``bond.make_bond()`` to initialize it using a language driver. "proc": a pexpect object, with an open communication to a bond driver "trans_except": local behavior for transparent exceptions "lang": language name "proto": serialization object supporting "dumps/loads"''' self.channels = {'STDOUT': sys.stdout, 'STDERR': sys.stderr} self.bindings = {} self.trans_except = trans_except self._proc = proc self.lang = lang self._proto = proto def loads(self, *args): return self._proto.loads(*args) def dumps(self, *args): try: return self._proto.dumps(*args) except Exception as e: raise SerializationException(self.lang, str(e), 'local') def _sendstate(self, cmd, code): ret = bytes(cmd.encode('ascii')) + b' ' + code self._proc.sendline(ret) def _repl(self): while self._proc.expect_exact(b'\n') == 0: line = self._proc.before.split(b' ', 1) cmd = line[0].decode('ascii') args = self.loads(line[1]) if len(line) > 1 else [] # interpret the serial protocol if cmd == "RETURN": return args elif cmd == "OUTPUT": self.channels[args[0]].write(args[1]) continue elif cmd == "EXCEPT": raise RemoteException(self.lang, str(args), args) elif cmd == "ERROR": raise SerializationException(self.lang, str(args), 'remote') elif cmd == "BYE": raise TerminatedException(self.lang, str(args)) elif cmd == "CALL": ret = None state = "RETURN" try: ret = self.bindings[args[0]](*args[1]) except Exception as e: state = "EXCEPT" ret = e if self.trans_except else str(e) try: code = self.dumps(ret) except SerializationException as e: state = "ERROR" code = self.dumps(str(e)) self._sendstate(state, code) continue raise BondException(self.lang, 'unknown interpreter state') def _data(self, maybe_ref): if not isinstance(maybe_ref, Ref): return maybe_ref if maybe_ref.bond is self: return maybe_ref.code raise BondException(self.lang, 'cannot use a reference coming from a different bond') def ref(self, code): '''Return a reference to an *single, unevaluated statement* of code, which can be later used in eval(), eval_block() or as an *immediate* argument to call()''' return Ref(self, code) def eval(self, code): '''Evaluate and return the value of a single statement of code in the interpreter.''' self._sendstate('EVAL', self.dumps(self._data(code))) return self._repl() def eval_block(self, code): '''Evaluate a "code" block inside the interpreter. Nothing is returned.''' self._sendstate('EVAL_BLOCK', self.dumps(self._data(code))) return self._repl() def call(self, name, *args): '''Call a function "name" using *args (apply *args to a callable statement "name")''' if not any(isinstance(arg, Ref) for arg in args): self._sendstate('CALL', self.dumps([name, args])) else: xargs = [] for arg in args: xargs.append([int(isinstance(arg, Ref)), self._data(arg)]) self._sendstate('XCALL', self.dumps([name, xargs])) return self._repl() def close(self): '''Terminate the underlying interpreter''' self._proc.sendeof() def export(self, func, name=None): '''Export a local function "func" to be callable in the interpreter as "name". If "name" is not specified, use the local function name directly.''' if name is None: name = func.__name__ self._sendstate('EXPORT', self.dumps(name)) self.bindings[name] = func return self._repl() def callable(self, name): '''Return a function calling "name"''' return lambda *args: self.call(name, *args) def proxy(self, name, other, remote=None): '''Export a function "name" to the "other" bond, named as "remote"''' other.export(self.callable(name), remote or name) def interact(self, **kwargs): '''Start an interactive session with this bond. See ``bond.interact()`` for a full list of keyword options''' interact(self, **kwargs) # Drivers def query_driver(lang): '''Query an individual driver by language name and return its raw data''' path = os.path.join('drivers', lang, 'bond.json') try: code = pkg_resources.resource_string(__name__, path).decode('utf-8') data = json.loads(code) except IOError as e: raise BondException(lang, 'unable to load driver data: {error}'.format(error=str(e))) except ValueError as e: raise BondException(lang, 'malformed driver data: {error}'.format(error=str(e))) return data def list_drivers(): '''Return a list of available language driver names''' langs = [] drivers_path = pkg_resources.resource_filename(__name__, 'drivers') for path in os.listdir(drivers_path): data_path = os.path.join(drivers_path, path, 'bond.json') if os.path.isfile(data_path): langs.append(path) return langs def _load_stage(lang, data): stage = os.path.join('drivers', lang, data['file']) stage = pkg_resources.resource_string(__name__, stage).decode('utf-8') if 'sub' in data: sub = data['sub'] stage = re.sub(sub[0], sub[1], stage) return stage.strip() def make_bond(lang, cmd=None, args=None, cwd=None, env=os.environ, def_args=True, trans_except=None, timeout=60, protocol=None, logfile=None): '''Construct a ``Bond`` using the specified language/command. "lang": a valid, supported language name (see ``list_drivers()``). "cmd": a valid shell command used to start the interpreter. If not specified, the default command is taken from the driver. "args": a list of command line arguments which are automatically quoted and appended to the final command line. "cwd": the working directory of the interpreter (defaulting to the current working directory) "env": the environment passed to the interpreter. "def_args": enable (default) or suppress default, extra command-line arguments provided by the driver. "trans_except": forces/disables transparent exceptions. When transparent exceptions are enabled, exceptions themselves are serialized and rethrown across the bond. It's disabled by default on all languages except Python. "timeout": the default communication timeout. "protocol": forces a specific serialization protocol to be chosen. It's automatically selected when not specified, and usually matches "JSON". "logfile": a file handle which is used to copy all input/output with the interpreter for debugging purposes.''' data = query_driver(lang) # select the highest compatible protocol protocol_list = list(filter(PROTO.__contains__, data['proto'])) if protocol is not None: if not isinstance(protocol, list): protocol = [protocol] protocol_list = list(filter(protocol_list.__contains__, protocol)) if len(protocol_list) < 1: raise BondException(lang, 'no compatible protocol supported') protocol = protocol_list[0] # determine a good default for trans_except if trans_except is None: trans_except = (lang == LANG and protocol == PROTO[0]) # find a suitable command proc = None cmdline = None if args is None: args = [] if cmd is not None: xargs = data['command'][0][1:] if def_args else [] cmdline = ' '.join([cmd] + list(map(quote, xargs + args))) try: proc = Spawn(cmdline, cwd=cwd, env=env, timeout=timeout, logfile=logfile) except pexpect.ExceptionPexpect: raise BondException(lang, 'cannot execute: ' + cmdline) else: for cmd in data['command']: xargs = cmd[1:] if def_args else [] cmdline = ' '.join([cmd[0]] + list(map(quote, xargs + args))) try: proc = Spawn(cmdline, cwd=cwd, env=env, timeout=timeout, logfile=logfile) break except pexpect.ExceptionPexpect: pass if proc is None: raise BondException(lang, 'no suitable interpreter found') try: # wait for a prompt if needed if 'wait' in data['init']: proc.expect_noecho(data['init']['wait']) # probe the interpreter probe = data['init']['probe'] proc.sendline_noecho(probe) if proc.expect_exact_noecho(['STAGE1\n', 'STAGE1\r\n']) == 1: tty.setraw(proc.child_fd) except pexpect.ExceptionPexpect: raise BondException(lang, 'cannot get an interactive prompt using: ' + cmdline) # inject base loader try: stage1 = _load_stage(lang, data['init']['stage1']) proc.sendline_noecho(stage1) if proc.expect_exact_noecho(['STAGE2\n', 'STAGE2\r\n']) == 1: raise BondException(lang, 'cannot switch terminal to raw mode') except pexpect.ExceptionPexpect: errors = proc.before.decode('utf-8') raise BondException(lang, 'cannot initialize stage1: ' + errors) # load the second stage try: stage2 = _load_stage(lang, data['init']['stage2']) stage2 = protocols.JSON.dumps({'code': stage2, 'start': [protocol, trans_except]}) proc.sendline(stage2) proc.expect_exact("READY\n") except pexpect.ExceptionPexpect: errors = proc.before.decode('utf-8') raise BondException(lang, 'cannot initialize stage2: ' + errors) # remote environment is ready proc.delaybeforesend = 0 proto = getattr(protocols, protocol) return Bond(proc, trans_except, lang=lang, proto=proto) # Utilities def interact(bond, prompt=None): '''Start an interactive session with "bond" If "prompt" is not specified, use the language name of the bond. By default, all input lines are executed with bond.eval_block(). If "!" is pre-pended, execute a single statement with bond.eval() and print it's return value. You can continue the statement on multiple lines by leaving a trailing "\\". Type Ctrl+C to abort a multi-line block without executing it.''' ps1 = "{lang}> ".format(lang=bond.lang) if prompt is None else prompt ps1_len = len(ps1.rstrip()) ps2 = '.' * ps1_len + ' ' * (len(ps1) - ps1_len) # start a simple repl buf = "" while True: try: ps = ps1 if not buf else ps2 line = raw_input(ps) except EOFError: print("") break except KeyboardInterrupt: print("") buf = "" continue # handle multi-line blocks buf = (buf + "\n" + line).strip() if not buf: continue if buf[-1] == '\\': buf = buf[0:-1] continue # execute the statement/block ret = None try: if buf[0] == '!': ret = bond.eval(buf[1:]) else: bond.eval_block(buf) except (RemoteException, SerializationException) as e: ret = e buf = "" # answer if ret is not None: print(ret)
gpl-2.0
pastewka/lammps
lib/kokkos/core/src/eti/HPX/Kokkos_HPX_ViewCopyETIInst_int_int_LayoutStride_Rank4.cpp
2620
//@HEADER // ************************************************************************ // // Kokkos v. 3.0 // Copyright (2020) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // // Kokkos is licensed under 3-clause BSD terms of use: // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // 1. Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // 2. Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // // 3. Neither the name of the Corporation nor the names of the // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY NTESS "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 NTESS OR THE // 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. // // Questions? Contact Christian R. Trott (crtrott@sandia.gov) // // ************************************************************************ //@HEADER #define KOKKOS_IMPL_COMPILING_LIBRARY true #include <Kokkos_Core.hpp> namespace Kokkos { namespace Impl { KOKKOS_IMPL_VIEWCOPY_ETI_INST(int****, LayoutStride, LayoutRight, Experimental::HPX, int) KOKKOS_IMPL_VIEWCOPY_ETI_INST(int****, LayoutStride, LayoutLeft, Experimental::HPX, int) KOKKOS_IMPL_VIEWCOPY_ETI_INST(int****, LayoutStride, LayoutStride, Experimental::HPX, int) KOKKOS_IMPL_VIEWFILL_ETI_INST(int****, LayoutStride, Experimental::HPX, int) } // namespace Impl } // namespace Kokkos
gpl-2.0