code stringlengths 5 1.01M | repo_name stringlengths 5 84 | path stringlengths 4 311 | language stringclasses 30 values | license stringclasses 15 values | size int64 5 1.01M | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|
using System;
using System.IO;
using MSBuild.Community.Tasks.Subversion;
using NUnit.Framework;
namespace MSBuild.Community.Tasks.Tests.Subversion
{
/// <summary>
/// Summary description for SvnExportTest
/// </summary>
[TestFixture]
public class SvnExportTest
{
private string testDirectory;
[OneTimeSetUp]
public void FixtureInit()
{
MockBuild buildEngine = new MockBuild();
testDirectory = TaskUtility.makeTestDirectory(buildEngine);
}
[Test(Description = "Export local repository")]
public void SvnExportLocal()
{
string repoPath = "d:/svn/repo/Test";
DirectoryInfo dirInfo = new DirectoryInfo(repoPath);
if (!dirInfo.Exists)
{
Assert.Ignore("Repository path '{0}' does not exist", repoPath);
}
string exportDir = Path.Combine(testDirectory, @"TestExport");
if (Directory.Exists(exportDir))
Directory.Delete(exportDir, true);
SvnExport export = new SvnExport();
export.BuildEngine = new MockBuild();
Assert.IsNotNull(export);
export.LocalPath = exportDir;
export.RepositoryPath = "file:///" + repoPath + "/trunk";
bool result = export.Execute();
Assert.IsTrue(result);
Assert.IsTrue(export.Revision > 0);
}
[Test(Description = "Export remote repository")]
public void SvnExportRemote()
{
string exportDir = Path.Combine(testDirectory, @"MSBuildTasksExport");
if (Directory.Exists(exportDir))
Directory.Delete(exportDir, true);
SvnExport export = new SvnExport();
export.BuildEngine = new MockBuild();
Assert.IsNotNull(export);
export.LocalPath = exportDir;
export.RepositoryPath =
"http://msbuildtasks.tigris.org/svn/msbuildtasks/trunk/Source/MSBuild.Community.Tasks.Tests/Subversion";
export.Username = "guest";
export.Password = "guest";
bool result = export.Execute();
Assert.IsTrue(result);
Assert.IsTrue(export.Revision > 0);
}
[Test]
public void SvnExportRemoteCommand()
{
string exportDir = Path.Combine(testDirectory, @"MSBuildTasksExport");
string remotePath =
"http://msbuildtasks.tigris.org/svn/msbuildtasks/trunk/Source/MSBuild.Community.Tasks.Tests/Subversion";
SvnExport export = new SvnExport();
export.LocalPath = exportDir;
export.RepositoryPath = remotePath;
export.Username = "guest";
export.Password = "guest1";
string expectedCommand =
String.Format(
"export \"{0}\" \"{1}\" --username guest --password guest1 --non-interactive --no-auth-cache",
remotePath, exportDir);
string actualCommand = TaskUtility.GetToolTaskCommand(export);
Assert.AreEqual(expectedCommand, actualCommand);
}
}
} | loresoft/msbuildtasks | Source/MSBuild.Community.Tasks.Tests/Subversion/SvnExportTest.cs | C# | bsd-2-clause | 3,200 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
22834,
1025,
2478,
5796,
8569,
4014,
2094,
1012,
2451,
1012,
8518,
1012,
4942,
27774,
1025,
2478,
16634,
4183,
1012,
7705,
1025,
3415,
15327,
5796,
8569,
4014,
2094,
1012,
2451,
1012,
8518,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
Copyright 2014 Shahriyar Amini
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 org.cmuchimps.gort.modules.database;
import org.cmuchimps.gort.api.gort.GortDatabaseServiceFactory;
import org.openide.modules.ModuleInstall;
public class Installer extends ModuleInstall {
@Override
public void restored() {
GortDatabaseServiceFactory gdsf = GortDatabaseServiceFactory.getDefault();
if (gdsf.createGortUser()) {
System.out.println("Created gort database user.");
} else {
System.out.println("Assuming gort database user exists.");
}
}
}
| samini/gort-public | Source/GortGUIv2/Gort/database/src/org/cmuchimps/gort/modules/database/Installer.java | Java | apache-2.0 | 1,134 | [
30522,
1013,
1008,
9385,
2297,
7890,
3089,
13380,
24432,
2072,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
12646,
2007,
1996,
6105,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* PetTrickCommand.h
*
* Created on: Dec 18, 2013
* Author: TheAnswer
*/
#ifndef PETTRICKCOMMAND_H_
#define PETTRICKCOMMAND_H_
#include "server/zone/objects/creature/commands/QueueCommand.h"
#include "server/zone/objects/scene/SceneObject.h"
#include "server/zone/objects/creature/ai/AiAgent.h"
class PetTrickCommand : public QueueCommand {
public:
PetTrickCommand(const String& name, ZoneProcessServer* server)
: QueueCommand(name, server) {
}
int doQueueCommand(CreatureObject* creature, const uint64& target, const UnicodeString& arguments) const {
ManagedReference<PetControlDevice*> controlDevice = creature->getControlDevice().castTo<PetControlDevice*>();
if (controlDevice == NULL)
return GENERALERROR;
// Creature specific command
if( controlDevice->getPetType() != PetManager::CREATUREPET )
return GENERALERROR;
if (!creature->isAiAgent())
return GENERALERROR;
// Target is the player commanding pet to perform the trick
ManagedReference<SceneObject*> commandTarget = server->getZoneServer()->getObject(target);
if (commandTarget == NULL || !commandTarget->isPlayerCreature())
return GENERALERROR;
ManagedReference<CreatureObject*> player = cast<CreatureObject*>(commandTarget.get());
if( player == NULL )
return GENERALERROR;
StringTokenizer tokenizer(arguments.toString());
if (!tokenizer.hasMoreTokens())
return GENERALERROR;
int trickNumber = tokenizer.getIntToken();
ManagedReference<AiAgent*> pet = cast<AiAgent*>(creature);
if( pet == NULL )
return GENERALERROR;
if( pet->getCooldownTimerMap() == NULL )
return GENERALERROR;
// Check pet states
if(pet->isInCombat() || pet->isDead() || pet->isIncapacitated() || pet->getPosture() == CreaturePosture::KNOCKEDDOWN){
player->sendSystemMessage("@pet/pet_menu:sys_cant_trick"); // "You can't have your pet perform a trick right now."
return GENERALERROR;
}
// Check cooldown (single cooldown for both tricks as we can't animate both at once)
if( !pet->getCooldownTimerMap()->isPast("trickCooldown") ){
player->sendSystemMessage("@pet/pet_menu:sys_cant_trick"); // "You can't have your pet perform a trick right now."
return GENERALERROR;
}
Locker locker(player, pet);
// Check player HAM
int actionCost = player->calculateCostAdjustment(CreatureAttribute::QUICKNESS, 50 * trickNumber );
int mindCost = player->calculateCostAdjustment(CreatureAttribute::FOCUS, 50 * trickNumber );
if (player->getHAM(CreatureAttribute::ACTION) <= actionCost || player->getHAM(CreatureAttribute::MIND) <= mindCost) {
player->sendSystemMessage("@pet/pet_menu:cant_trick"); // "You need to rest before you can have your pet perform a trick."
return INSUFFICIENTHAM;
}
// Heal 20% or 40% of base in wounds and damage
int mindHeal = pet->getBaseHAM(CreatureAttribute::MIND) * 0.20 * trickNumber;
int focusHeal = pet->getBaseHAM(CreatureAttribute::FOCUS) * 0.20 * trickNumber;
int willHeal = pet->getBaseHAM(CreatureAttribute::WILLPOWER) * 0.20 * trickNumber;
int shockHeal = 100 * trickNumber;
// Heal wounds
pet->healWound(player, CreatureAttribute::MIND, mindHeal, true, false);
pet->healWound(player, CreatureAttribute::FOCUS, focusHeal, true, false);
pet->healWound(player, CreatureAttribute::WILLPOWER, willHeal, true, false);
// Heal battle fatigue
pet->addShockWounds(-shockHeal, true, false);
// Heal damage
mindHeal = MIN( mindHeal, pet->getMaxHAM(CreatureAttribute::MIND) - pet->getHAM(CreatureAttribute::MIND) );
pet->inflictDamage(pet, CreatureAttribute::MIND, -mindHeal, false);
if (pet->getPosture() != CreaturePosture::UPRIGHT && pet->getPosture() != CreaturePosture::SITTING)
pet->setPosture(CreaturePosture::UPRIGHT);
// Perform trick animation
String animation = "trick_" + String::valueOf(trickNumber);
if (pet->getPosture() == CreaturePosture::SITTING)
animation = "sit_" + animation;
pet->doAnimation(animation);
// Set cooldown
pet->getCooldownTimerMap()->updateToCurrentAndAddMili("trickCooldown", 5000); // 5 sec
// Reduce player HAM
player->inflictDamage(player, CreatureAttribute::ACTION, actionCost, false);
player->inflictDamage(player, CreatureAttribute::MIND, mindCost, false);
return SUCCESS;
}
};
#endif /* PETTRICKCOMMAND_H_ */
| Tatwi/legend-of-hondo | MMOCoreORB/src/server/zone/objects/creature/commands/pet/PetTrickCommand.h | C | agpl-3.0 | 4,429 | [
30522,
1013,
1008,
1008,
9004,
22881,
9006,
2386,
2094,
1012,
1044,
1008,
1008,
2580,
2006,
1024,
11703,
2324,
1010,
2286,
1008,
3166,
1024,
1996,
6962,
13777,
1008,
1013,
1001,
2065,
13629,
2546,
9004,
22881,
9006,
2386,
2094,
1035,
1044,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\UrlRewrite\Block\Catalog\Category;
/**
* Block for Catalog Category URL rewrites
*/
class Edit extends \Magento\UrlRewrite\Block\Edit
{
/**
* @var \Magento\Catalog\Model\CategoryFactory
*/
protected $_categoryFactory;
/**
* @param \Magento\Backend\Block\Widget\Context $context
* @param \Magento\UrlRewrite\Model\UrlRewriteFactory $rewriteFactory
* @param \Magento\Backend\Helper\Data $adminhtmlData
* @param \Magento\Catalog\Model\CategoryFactory $categoryFactory
* @param array $data
*/
public function __construct(
\Magento\Backend\Block\Widget\Context $context,
\Magento\UrlRewrite\Model\UrlRewriteFactory $rewriteFactory,
\Magento\Backend\Helper\Data $adminhtmlData,
\Magento\Catalog\Model\CategoryFactory $categoryFactory,
array $data = []
) {
$this->_categoryFactory = $categoryFactory;
parent::__construct($context, $rewriteFactory, $adminhtmlData, $data);
}
/**
* Prepare layout for URL rewrite creating for category
*
* @return void
*/
protected function _prepareLayoutFeatures()
{
if ($this->_getUrlRewrite()->getId()) {
$this->_headerText = __('Edit URL Rewrite for a Category');
} else {
$this->_headerText = __('Add URL Rewrite for a Category');
}
if ($this->_getCategory()->getId()) {
$this->_addCategoryLinkBlock();
$this->_addEditFormBlock();
if ($this->_getUrlRewrite()->getId() === null) {
$this->_updateBackButtonLink($this->_adminhtmlData->getUrl('adminhtml/*/edit') . 'category');
}
} else {
$this->_addUrlRewriteSelectorBlock();
$this->_addCategoryTreeBlock();
}
}
/**
* Get or create new instance of category
*
* @return \Magento\Catalog\Model\Product
*/
private function _getCategory()
{
if (!$this->hasData('category')) {
$this->setCategory($this->_categoryFactory->create());
}
return $this->getCategory();
}
/**
* Add child category link block
*
* @return void
*/
private function _addCategoryLinkBlock()
{
$this->addChild(
'category_link',
'Magento\UrlRewrite\Block\Link',
[
'item_url' => $this->_adminhtmlData->getUrl('adminhtml/*/*') . 'category',
'item_name' => $this->_getCategory()->getName(),
'label' => __('Category:')
]
);
}
/**
* Add child category tree block
*
* @return void
*/
private function _addCategoryTreeBlock()
{
$this->addChild('categories_tree', 'Magento\UrlRewrite\Block\Catalog\Category\Tree');
}
/**
* Creates edit form block
*
* @return \Magento\UrlRewrite\Block\Catalog\Edit\Form
*/
protected function _createEditFormBlock()
{
return $this->getLayout()->createBlock(
'Magento\UrlRewrite\Block\Catalog\Edit\Form',
'',
['data' => ['category' => $this->_getCategory(), 'url_rewrite' => $this->_getUrlRewrite()]]
);
}
}
| rajmahesh/magento2-master | vendor/magento/module-url-rewrite/Block/Catalog/Category/Edit.php | PHP | gpl-3.0 | 3,372 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
9385,
1075,
2355,
17454,
13663,
1012,
2035,
2916,
9235,
1012,
1008,
2156,
24731,
1012,
19067,
2102,
2005,
6105,
4751,
1012,
1008,
1013,
3415,
15327,
17454,
13663,
1032,
24471,
20974,
7974,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2004 PathScale, Inc. All Rights Reserved.
*/
/*
Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307,
USA.
Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
#pragma ident "@(#) libfi/matrix/matmul_l1l2.c 92.1 07/09/99 15:18:08"
#include "matmul.h"
/*
* Name of this entry point
*/
#define NAME _MATMUL_L1L2
/*
* Name of routine called do computation (if any)
*/
#if defined(BUILD_COMPILER_GNU) && defined(BUILD_OS_DARWIN)
#define SUBNAME underscore_l1l2gemmx__
#else /* defined(BUILD_COMPILER_GNU) && defined(BUILD_OS_DARWIN) */
#define SUBNAME _l1l2gemmx__
#endif /* defined(BUILD_COMPILER_GNU) && defined(BUILD_OS_DARWIN) */
/*
* Type of constants alpha and beta
*/
#define RESULTTYPE _f_int2
void
NAME(DopeVectorType *RESULT, DopeVectorType *MATRIX_A,
DopeVectorType *MATRIX_B)
{
void SUBNAME();
const RESULTTYPE true = _btol(1);
const RESULTTYPE false = _btol(0);
MatrixDimenType matdimdata, *MATDIM;
MATDIM = (MatrixDimenType *) &matdimdata;
/*
* Parse dope vectors, and perform error checking.
*/
_premult(RESULT, MATRIX_A, MATRIX_B, MATDIM);
/*
* Perform the matrix multiplication.
*/
SUBNAME(&MATDIM->m, &MATDIM->n, &MATDIM->k, &true, MATDIM->A,
&MATDIM->inc1a, &MATDIM->inc2a, MATDIM->B, &MATDIM->inc1b,
&MATDIM->inc2b, &false, MATDIM->C, &MATDIM->inc1c, &MATDIM->inc2c);
return;
}
| uhhpctools/openuh-openacc | osprey/libfi/matrix/matmul_l1l2.c | C | gpl-3.0 | 2,636 | [
30522,
1013,
1008,
1008,
9385,
2432,
10425,
9289,
2063,
1010,
4297,
1012,
2035,
2916,
9235,
1012,
1008,
1013,
1013,
1008,
9385,
1006,
1039,
1007,
2456,
1010,
2541,
13773,
8389,
1010,
4297,
1012,
2035,
2916,
9235,
1012,
2023,
2565,
2003,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_11) on Mon Jun 16 17:36:07 PDT 2014 -->
<title>Uses of Class javax.swing.text.FieldView (Java Platform SE 8 )</title>
<meta name="date" content="2014-06-16">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class javax.swing.text.FieldView (Java Platform SE 8 )";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../javax/swing/text/FieldView.html" title="class in javax.swing.text">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><strong>Java™ Platform<br>Standard Ed. 8</strong></div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?javax/swing/text/class-use/FieldView.html" target="_top">Frames</a></li>
<li><a href="FieldView.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class javax.swing.text.FieldView" class="title">Uses of Class<br>javax.swing.text.FieldView</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">
<li class="blockList">
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../../javax/swing/text/FieldView.html" title="class in javax.swing.text">FieldView</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="#javax.swing.text">javax.swing.text</a></td>
<td class="colLast">
<div class="block">Provides classes and interfaces that deal with editable
and noneditable text components.</div>
</td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="javax.swing.text">
<!-- -->
</a>
<h3>Uses of <a href="../../../../javax/swing/text/FieldView.html" title="class in javax.swing.text">FieldView</a> in <a href="../../../../javax/swing/text/package-summary.html">javax.swing.text</a></h3>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing subclasses, and an explanation">
<caption><span>Subclasses of <a href="../../../../javax/swing/text/FieldView.html" title="class in javax.swing.text">FieldView</a> in <a href="../../../../javax/swing/text/package-summary.html">javax.swing.text</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Class and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>class </code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../javax/swing/text/PasswordView.html" title="class in javax.swing.text">PasswordView</a></span></code>
<div class="block">Implements a View suitable for use in JPasswordField
UI implementations.</div>
</td>
</tr>
</tbody>
</table>
</li>
</ul>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../javax/swing/text/FieldView.html" title="class in javax.swing.text">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><strong>Java™ Platform<br>Standard Ed. 8</strong></div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?javax/swing/text/class-use/FieldView.html" target="_top">Frames</a></li>
<li><a href="FieldView.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small><font size="-1"> <a href="http://bugreport.sun.com/bugreport/">Submit a bug or feature</a> <br>For further API reference and developer documentation, see <a href="http://download.oracle.com/javase/8/docs/index.html" target="_blank">Java SE Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.<br> Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved. </font></small></p>
</body>
</html>
| DeanAaron/jdk8 | jdk8en_us/docs/api/javax/swing/text/class-use/FieldView.html | HTML | gpl-3.0 | 6,982 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
16129,
1018,
1012,
5890,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
8917,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using Microsoft.SPOT.Hardware;
namespace GrFamily.MainBoard
{
/// <summary>
/// LEDNX
/// </summary>
public class Led
{
/// <summary>LEDªÚ±³ê½s</summary>
protected readonly OutputPort LedPort;
/// <summary>
/// RXgN^
/// </summary>
/// <param name="pin">LEDªÚ±³ê½s</param>
public Led(Cpu.Pin pin)
{
LedPort = new OutputPort(pin, false);
}
/// <summary>
/// LEDð_^Á·é
/// </summary>
/// <param name="on">LEDð_·éêÍ trueAÁ·éêÍ false</param>
public void SetLed(bool on)
{
LedPort.Write(on);
}
}
}
| netmf-lib-grfamily/GrFamilyLibrary | Library/MainBoard/Peach/Led.cs | C# | mit | 733 | [
30522,
2478,
7513,
1012,
3962,
1012,
8051,
1025,
3415,
15327,
24665,
7011,
4328,
2135,
1012,
2364,
6277,
1063,
1013,
1013,
1013,
1026,
12654,
1028,
1013,
1013,
1013,
2419,
26807,
1013,
1013,
1013,
1026,
1013,
12654,
1028,
2270,
2465,
2419,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
@extends('layouts.app_defect_vk')
@section('content')
<div class='col-sm-4 col-sm-offset-4'>
<h2></i> Изменить
<div class="pull-right">
{!! Form::open(['url' => '/defect/vkam/tables/ceh/' . $ceh->id, 'method' => 'DELETE']) !!}
{!! Form::submit('Удалить', ['class' => 'btn btn-danger']) !!}
{!! Form::close() !!}
</div>
</h2>
{!! Form::model($ceh, ['role' => 'form', 'url' => '/defect/vkam/tables/ceh/' . $ceh->id, 'method' => 'PUT']) !!}
<div class='form-group'>
{!! Form::label('ceh_id', 'Код') !!}
{!! Form::text('ceh_id', trim($ceh->ceh_id), ['placeholder' => 'Код', 'class' => 'form-control']) !!}
</div>
<div class='form-group'>
{!! Form::label('ceh_short', 'Краткое имя') !!}
{!! Form::text('ceh_short', trim($ceh->ceh_short), ['placeholder' => 'Краткое имя', 'class' => 'form-control']) !!}
</div>
<div class='form-group'>
{!! Form::label('ceh_name', 'Имя') !!}
{!! Form::text('ceh_name', trim($ceh->ceh_name), ['placeholder' => 'Имя', 'class' => 'form-control']) !!}
</div>
<div class='form-group'>
{!! Form::submit('Сохранить', ['class' => 'btn btn-primary']) !!}
</div>
{!! Form::close() !!}
@if ($errors->has())
@foreach ($errors->all() as $error)
<div class='bg-danger alert'>{{ $error }}</div>
@endforeach
@endif
</div>
@stop
| jips/mls-laravel | resources/views/defect/vkam/tables/ceh_edit.blade.php | PHP | mit | 1,499 | [
30522,
1030,
8908,
1006,
1005,
9621,
2015,
1012,
10439,
1035,
21262,
1035,
1058,
2243,
1005,
1007,
1030,
2930,
1006,
1005,
4180,
1005,
1007,
1026,
4487,
2615,
2465,
1027,
1005,
8902,
1011,
15488,
1011,
1018,
8902,
1011,
15488,
1011,
16396,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* This file is part of SpongeAPI, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered <https://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.data.types;
import org.spongepowered.api.CatalogType;
import org.spongepowered.api.util.annotation.CatalogedBy;
/**
* Represents a type of instrument.
*/
@CatalogedBy(InstrumentTypes.class)
public interface InstrumentType extends CatalogType {
}
| frogocomics/SpongeAPI | src/main/java/org/spongepowered/api/data/types/InstrumentType.java | Java | mit | 1,532 | [
30522,
1013,
1008,
1008,
2023,
5371,
2003,
2112,
1997,
25742,
9331,
2072,
1010,
7000,
2104,
1996,
10210,
6105,
1006,
10210,
1007,
1012,
1008,
1008,
9385,
1006,
1039,
1007,
25742,
27267,
1026,
16770,
1024,
1013,
1013,
7479,
1012,
25742,
2726... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2013, PAL Robotics S.L.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of hiDOF, Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//////////////////////////////////////////////////////////////////////////////
/// \author Adolfo Rodriguez Tsouroukdissian
#include <string>
#include <gtest/gtest.h>
#include <ros/console.h>
#include <hardware_interface/posvelacc_command_interface.h>
using std::string;
using namespace hardware_interface;
TEST(PosVelAccCommandHandleTest, HandleConstruction)
{
string name = "name1";
double pos, vel, eff;
double cmd_pos, cmd_vel, cmd_acc;
EXPECT_NO_THROW(PosVelAccJointHandle tmp(JointStateHandle(name, &pos, &vel, &eff), &cmd_pos, &cmd_vel, &cmd_acc));
EXPECT_THROW(PosVelAccJointHandle tmp(JointStateHandle(name, &pos, &vel, &eff), nullptr, &cmd_vel, &cmd_acc), HardwareInterfaceException);
EXPECT_THROW(PosVelAccJointHandle tmp(JointStateHandle(name, &pos, &vel, &eff), &cmd_pos, nullptr, &cmd_acc), HardwareInterfaceException);
EXPECT_THROW(PosVelAccJointHandle tmp(JointStateHandle(name, &pos, &vel, &eff), &cmd_pos, &cmd_vel, nullptr), HardwareInterfaceException);
// Print error messages
// Requires manual output inspection, but exception message should be descriptive
try {PosVelAccJointHandle tmp(JointStateHandle(name, &pos, &vel, &eff), nullptr, nullptr, nullptr);}
catch(const HardwareInterfaceException& e) {ROS_ERROR_STREAM(e.what());}
}
#ifndef NDEBUG // NOTE: This test validates assertion triggering, hence only gets compiled in debug mode
TEST(JointStateHandleTest, AssertionTriggering)
{
PosVelAccJointHandle h;
// Data with invalid pointers should trigger an assertion
EXPECT_DEATH(h.getPosition(), ".*");
EXPECT_DEATH(h.getVelocity(), ".*");
EXPECT_DEATH(h.getEffort(), ".*");
EXPECT_DEATH(h.getCommandPosition(), ".*");
EXPECT_DEATH(h.getCommandVelocity(), ".*");
EXPECT_DEATH(h.getCommandAcceleration(), ".*");
EXPECT_DEATH(h.setCommandPosition(2.0), ".*");
EXPECT_DEATH(h.setCommandVelocity(3.0), ".*");
EXPECT_DEATH(h.setCommandAcceleration(4.0), ".*");
EXPECT_DEATH(h.setCommand(1.0, 2.0, 3.0), ".*");
}
#endif // NDEBUG
class PosVelAccCommandInterfaceTest : public ::testing::Test
{
protected:
double pos1 = {1.0}, vel1 = {2.0}, eff1 = {3.0}, cmd_pos1 = {0.0}, cmd_vel1 = {0.0}, cmd_acc1 = {0.0};
double pos2 = {4.0}, vel2 = {5.0}, eff2 = {6.0}, cmd_pos2 = {0.0}, cmd_vel2 = {0.0}, cmd_acc2 = {0.0};
string name1 = {"name_1"};
string name2 = {"name_2"};
JointStateHandle hs1 = {name1, &pos1, &vel1, &eff1};
JointStateHandle hs2 = {name2, &pos2, &vel2, &eff2};
PosVelAccJointHandle hc1 = {hs1, &cmd_pos1, &cmd_vel1, &cmd_acc1};
PosVelAccJointHandle hc2 = {hs2, &cmd_pos2, &cmd_vel2, &cmd_acc2};
};
TEST_F(PosVelAccCommandInterfaceTest, ExcerciseApi)
{
PosVelAccJointInterface iface;
iface.registerHandle(hc1);
iface.registerHandle(hc2);
// Get handles
EXPECT_NO_THROW(iface.getHandle(name1));
EXPECT_NO_THROW(iface.getHandle(name2));
PosVelAccJointHandle hc1_tmp = iface.getHandle(name1);
EXPECT_EQ(name1, hc1_tmp.getName());
EXPECT_DOUBLE_EQ(pos1, hc1_tmp.getPosition());
EXPECT_DOUBLE_EQ(vel1, hc1_tmp.getVelocity());
EXPECT_DOUBLE_EQ(eff1, hc1_tmp.getEffort());
EXPECT_DOUBLE_EQ(cmd_pos1, hc1_tmp.getCommandPosition());
EXPECT_DOUBLE_EQ(cmd_vel1, hc1_tmp.getCommandVelocity());
EXPECT_DOUBLE_EQ(cmd_acc1, hc1_tmp.getCommandAcceleration());
const double new_cmd_pos1 = -1.0, new_cmd_vel1 = -2.0, new_cmd_acc1 = -3.0;
hc1_tmp.setCommand(new_cmd_pos1, new_cmd_vel1, new_cmd_acc1);
EXPECT_DOUBLE_EQ(new_cmd_pos1, hc1_tmp.getCommandPosition());
EXPECT_DOUBLE_EQ(new_cmd_vel1, hc1_tmp.getCommandVelocity());
EXPECT_DOUBLE_EQ(new_cmd_acc1, hc1_tmp.getCommandAcceleration());
PosVelAccJointHandle hc2_tmp = iface.getHandle(name2);
EXPECT_EQ(name2, hc2_tmp.getName());
EXPECT_DOUBLE_EQ(pos2, hc2_tmp.getPosition());
EXPECT_DOUBLE_EQ(vel2, hc2_tmp.getVelocity());
EXPECT_DOUBLE_EQ(eff2, hc2_tmp.getEffort());
EXPECT_DOUBLE_EQ(cmd_pos2, hc2_tmp.getCommandPosition());
EXPECT_DOUBLE_EQ(cmd_vel2, hc2_tmp.getCommandVelocity());
EXPECT_DOUBLE_EQ(cmd_acc2, hc2_tmp.getCommandAcceleration());
const double new_cmd_pos2 = -1.0, new_cmd_vel2 = -2.0, new_cmd_acc2 = -3.0;
hc2_tmp.setCommand(new_cmd_pos2, new_cmd_vel2, new_cmd_acc2);
EXPECT_DOUBLE_EQ(new_cmd_pos2, hc2_tmp.getCommandPosition());
EXPECT_DOUBLE_EQ(new_cmd_vel2, hc2_tmp.getCommandVelocity());
EXPECT_DOUBLE_EQ(new_cmd_acc2, hc2_tmp.getCommandAcceleration());
// This interface claims resources
EXPECT_EQ(2, iface.getClaims().size());
// Print error message
// Requires manual output inspection, but exception message should contain the interface name (not its base clase)
try {iface.getHandle("unknown_name");}
catch(const HardwareInterfaceException& e) {ROS_ERROR_STREAM(e.what());}
}
int main(int argc, char** argv)
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
| ros-controls/ros_control | hardware_interface/test/posvelacc_command_interface_test.cpp | C++ | bsd-3-clause | 6,470 | [
30522,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
1013,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Json library
* @class Produksi_detail_controller
* @version 07/05/2015 12:18:00
*/
class Produksi_detail_controller {
function read() {
$page = getVarClean('page','int',1);
$limit = getVarClean('rows','int',5);
$sidx = getVarClean('sidx','str','rd');
$sord = getVarClean('sord','str','asc');
$data = array('rows' => array(), 'page' => 1, 'records' => 0, 'total' => 1, 'success' => false, 'message' => '');
try {
$data['page'] = 1;
$data['total'] = 1;
$data['records'] = 1;
$data['rows'] = array(
['rd' => 1, 'rd_jenis_produk' => '6cm', 'rd_tgl_produksi' => date('Y-m-d'), 'rd_serial_number' => 'PROD/WH-001/FM001/20160724/0001','created_date' => date('Y-m-d'), 'created_by' => 'admin', 'updated_date' => date('Y-m-d'), 'updated_by' => 'admin'] );
$data['success'] = true;
}catch (Exception $e) {
$data['message'] = $e->getMessage();
}
return $data;
}
function crud() {
$data = array();
$oper = getVarClean('oper', 'str', '');
switch ($oper) {
case 'add' :
permission_check('add-repacking');
$data = $this->create();
break;
case 'edit' :
permission_check('edit-repacking');
$data = $this->update();
break;
case 'del' :
permission_check('delete-repacking');
$data = $this->destroy();
break;
default :
permission_check('view-repacking');
$data = $this->read();
break;
}
return $data;
}
}
/* End of file Warehouse_controller.php */ | wiliamdecosta/agripro | application/libraries/agripro/Produksi_detail_controller.php | PHP | mit | 1,940 | [
30522,
1026,
1029,
25718,
2065,
1006,
999,
4225,
1006,
1005,
2918,
15069,
1005,
1007,
1007,
6164,
1006,
1005,
2053,
3622,
5896,
3229,
3039,
1005,
1007,
1025,
1013,
1008,
1008,
1008,
1046,
3385,
3075,
1008,
1030,
2465,
4013,
28351,
5332,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//-----------------------------------------------------------------------------
//
// Copyright 1993-1996 id Software
// Copyright 1999-2016 Randy Heit
// Copyright 2016 Magnus Norddahl
//
// 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/
//
//-----------------------------------------------------------------------------
//
#pragma once
#include "swrenderer/viewport/r_walldrawer.h"
#include "r_line.h"
class FTexture;
struct FLightNode;
struct seg_t;
struct FLightNode;
struct FDynamicColormap;
namespace swrenderer
{
class RenderThread;
struct DrawSegment;
struct FWallCoords;
class ProjectedWallLine;
class ProjectedWallTexcoords;
struct WallSampler;
class RenderWallPart
{
public:
RenderWallPart(RenderThread *thread);
void Render(
sector_t *frontsector,
seg_t *curline,
const FWallCoords &WallC,
FSoftwareTexture *rw_pic,
int x1,
int x2,
const short *walltop,
const short *wallbottom,
double texturemid,
float *swall,
fixed_t *lwall,
double yscale,
double top,
double bottom,
bool mask,
bool additive,
fixed_t alpha,
fixed_t xoffset,
const ProjectedWallLight &light,
FLightNode *light_list);
RenderThread *Thread = nullptr;
private:
void ProcessWallNP2(const short *uwal, const short *dwal, double texturemid, float *swal, fixed_t *lwal, double top, double bot);
void ProcessWall(const short *uwal, const short *dwal, double texturemid, float *swal, fixed_t *lwal);
void ProcessStripedWall(const short *uwal, const short *dwal, double texturemid, float *swal, fixed_t *lwal);
void ProcessNormalWall(const short *uwal, const short *dwal, double texturemid, float *swal, fixed_t *lwal);
void SetLights(WallDrawerArgs &drawerargs, int x, int y1);
int x1 = 0;
int x2 = 0;
FSoftwareTexture *rw_pic = nullptr;
sector_t *frontsector = nullptr;
seg_t *curline = nullptr;
FWallCoords WallC;
ProjectedWallLight mLight;
double yrepeat = 0.0;
fixed_t xoffset = 0;
FLightNode *light_list = nullptr;
bool mask = false;
bool additive = false;
fixed_t alpha = 0;
};
}
| Xane123/MaryMagicalAdventure | src/rendering/swrenderer/line/r_walldraw.h | C | gpl-3.0 | 2,675 | [
30522,
1013,
1013,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Function ierase_all_copy</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../../string_algo/reference.html#header.boost.algorithm.string.erase_hpp" title="Header <boost/algorithm/string/erase.hpp>">
<link rel="prev" href="erase_all.html" title="Function template erase_all">
<link rel="next" href="ierase_all.html" title="Function template ierase_all">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
<td align="center"><a href="../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="erase_all.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../string_algo/reference.html#header.boost.algorithm.string.erase_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="ierase_all.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="boost.algorithm.ierase_all_copy"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Function ierase_all_copy</span></h2>
<p>boost::algorithm::ierase_all_copy — Erase all algorithm ( case insensitive ) </p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../string_algo/reference.html#header.boost.algorithm.string.erase_hpp" title="Header <boost/algorithm/string/erase.hpp>">boost/algorithm/string/erase.hpp</a>>
</span>
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> OutputIteratorT<span class="special">,</span> <span class="keyword">typename</span> Range1T<span class="special">,</span> <span class="keyword">typename</span> Range2T<span class="special">></span>
<span class="identifier">OutputIteratorT</span>
<span class="identifier">ierase_all_copy</span><span class="special">(</span><span class="identifier">OutputIteratorT</span> Output<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">Range1T</span> <span class="special">&</span> Input<span class="special">,</span>
<span class="keyword">const</span> <span class="identifier">Range2T</span> <span class="special">&</span> Search<span class="special">,</span>
<span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">locale</span> <span class="special">&</span> Loc <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">locale</span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> SequenceT<span class="special">,</span> <span class="keyword">typename</span> RangeT<span class="special">></span>
<span class="identifier">SequenceT</span> <span class="identifier">ierase_all_copy</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">SequenceT</span> <span class="special">&</span> Input<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">RangeT</span> <span class="special">&</span> Search<span class="special">,</span>
<span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">locale</span> <span class="special">&</span> Loc <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">locale</span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="idp116110272"></a><h2>Description</h2>
<p>Remove all the occurrences of the string from the input. The result is a modified copy of the input. It is returned as a sequence or copied to the output iterator. Searching is case insensitive.</p>
<p>
</p>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>The second variant of this function provides the strong exception-safety guarantee </p></td></tr>
</table></div>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><code class="computeroutput">Input</code></span></p></td>
<td><p>An input string </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">Loc</code></span></p></td>
<td><p>A locale used for case insensitive comparison </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">Output</code></span></p></td>
<td><p>An output iterator to which the result will be copied </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">Search</code></span></p></td>
<td><p>A substring to be searched for </p></td>
</tr>
</tbody>
</table></div></td>
</tr>
<tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p>An output iterator pointing just after the last inserted character or a modified copy of the input</p></td>
</tr>
</tbody>
</table></div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2002-2004 Pavol Droba<p>Use, modification and distribution is subject to the Boost
Software License, Version 1.0. (See accompanying file
<code class="filename">LICENSE_1_0.txt</code> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="erase_all.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../string_algo/reference.html#header.boost.algorithm.string.erase_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="ierase_all.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
| ntonjeta/iidea-Docker | examples/sobel/src/boost_1_63_0/doc/html/boost/algorithm/ierase_all_copy.html | HTML | agpl-3.0 | 8,001 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
16129,
1018,
1012,
5890,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
8917,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* ========================================================================== */
/* === SuiteSparse_config =================================================== */
/* ========================================================================== */
/* Configuration file for SuiteSparse: a Suite of Sparse matrix packages
* (AMD, COLAMD, CCOLAMD, CAMD, CHOLMOD, UMFPACK, CXSparse, and others).
*
* SuiteSparse_config.h provides the definition of the long integer. On most
* systems, a C program can be compiled in LP64 mode, in which long's and
* pointers are both 64-bits, and int's are 32-bits. Windows 64, however, uses
* the LLP64 model, in which int's and long's are 32-bits, and long long's and
* pointers are 64-bits.
*
* SuiteSparse packages that include long integer versions are
* intended for the LP64 mode. However, as a workaround for Windows 64
* (and perhaps other systems), the long integer can be redefined.
*
* If _WIN64 is defined, then the __int64 type is used instead of long.
*
* The long integer can also be defined at compile time. For example, this
* could be added to SuiteSparse_config.mk:
*
* CFLAGS = -O -D'SuiteSparse_long=long long' \
* -D'SuiteSparse_long_max=9223372036854775801' -D'SuiteSparse_long_idd="lld"'
*
* This file defines SuiteSparse_long as either long (on all but _WIN64) or
* __int64 on Windows 64. The intent is that a SuiteSparse_long is always a
* 64-bit integer in a 64-bit code. ptrdiff_t might be a better choice than
* long; it is always the same size as a pointer.
*
* This file also defines the SUITESPARSE_VERSION and related definitions.
*
* Copyright (c) 2012, Timothy A. Davis. No licensing restrictions apply
* to this file or to the SuiteSparse_config directory.
* Author: Timothy A. Davis.
*/
#ifndef _SUITESPARSECONFIG_H
#define _SUITESPARSECONFIG_H
#ifdef __cplusplus
extern "C" {
#endif
#include <limits.h>
#include <stdlib.h>
/* ========================================================================== */
/* === SuiteSparse_long ===================================================== */
/* ========================================================================== */
#ifndef SuiteSparse_long
#ifdef _WIN64
#define SuiteSparse_long __int64
#define SuiteSparse_long_max _I64_MAX
#define SuiteSparse_long_idd "I64d"
#else
#define SuiteSparse_long long
#define SuiteSparse_long_max LONG_MAX
#define SuiteSparse_long_idd "ld"
#endif
#define SuiteSparse_long_id "%" SuiteSparse_long_idd
#endif
/* For backward compatibility with prior versions of SuiteSparse. The UF_*
* macros are deprecated and will be removed in a future version. */
#ifndef UF_long
#define UF_long SuiteSparse_long
#define UF_long_max SuiteSparse_long_max
#define UF_long_idd SuiteSparse_long_idd
#define UF_long_id SuiteSparse_long_id
#endif
/* ========================================================================== */
/* === SuiteSparse_config parameters and functions ========================== */
/* ========================================================================== */
/* SuiteSparse-wide parameters will be placed in this struct. */
typedef struct SuiteSparse_config_struct
{
void *(*malloc_memory) (size_t) ; /* pointer to malloc */
void *(*realloc_memory) (void *, size_t) ; /* pointer to realloc */
void (*free_memory) (void *) ; /* pointer to free */
void *(*calloc_memory) (size_t, size_t) ; /* pointer to calloc */
} SuiteSparse_config ;
void *SuiteSparse_malloc /* pointer to allocated block of memory */
(
size_t nitems, /* number of items to malloc (>=1 is enforced) */
size_t size_of_item, /* sizeof each item */
int *ok, /* TRUE if successful, FALSE otherwise */
SuiteSparse_config *config /* SuiteSparse-wide configuration */
) ;
void *SuiteSparse_free /* always returns NULL */
(
void *p, /* block to free */
SuiteSparse_config *config /* SuiteSparse-wide configuration */
) ;
void SuiteSparse_tic /* start the timer */
(
double tic [2] /* output, contents undefined on input */
) ;
double SuiteSparse_toc /* return time in seconds since last tic */
(
double tic [2] /* input: from last call to SuiteSparse_tic */
) ;
double SuiteSparse_time /* returns current wall clock time in seconds */
(
void
) ;
/* determine which timer to use, if any */
#ifndef NTIMER
#ifdef _POSIX_C_SOURCE
#if _POSIX_C_SOURCE >= 199309L
#define SUITESPARSE_TIMER_ENABLED
#endif
#endif
#endif
/* ========================================================================== */
/* === SuiteSparse version ================================================== */
/* ========================================================================== */
/* SuiteSparse is not a package itself, but a collection of packages, some of
* which must be used together (UMFPACK requires AMD, CHOLMOD requires AMD,
* COLAMD, CAMD, and CCOLAMD, etc). A version number is provided here for the
* collection itself. The versions of packages within each version of
* SuiteSparse are meant to work together. Combining one packge from one
* version of SuiteSparse, with another package from another version of
* SuiteSparse, may or may not work.
*
* SuiteSparse contains the following packages:
*
* SuiteSparse_config version 4.0.0 (version always the same as SuiteSparse)
* AMD version 2.3.0
* BTF version 1.2.0
* CAMD version 2.3.0
* CCOLAMD version 2.8.0
* CHOLMOD version 2.0.0
* COLAMD version 2.8.0
* CSparse version 3.1.0
* CXSparse version 3.1.0
* KLU version 1.2.0
* LDL version 2.1.0
* RBio version 2.1.0
* SPQR version 1.3.0 (full name is SuiteSparseQR)
* UMFPACK version 5.6.0
* MATLAB_Tools various packages & M-files
*
* Other package dependencies:
* BLAS required by CHOLMOD and UMFPACK
* LAPACK required by CHOLMOD
* METIS 4.0.1 required by CHOLMOD (optional) and KLU (optional)
*/
#define SUITESPARSE_DATE "Jun 1, 2012"
#define SUITESPARSE_VER_CODE(main,sub) ((main) * 1000 + (sub))
#define SUITESPARSE_MAIN_VERSION 4
#define SUITESPARSE_SUB_VERSION 0
#define SUITESPARSE_SUBSUB_VERSION 0
#define SUITESPARSE_VERSION \
SUITESPARSE_VER_CODE(SUITESPARSE_MAIN_VERSION,SUITESPARSE_SUB_VERSION)
#ifdef __cplusplus
}
#endif
#endif
| eokeeffe/SSBA | SuiteSparse_config/SuiteSparse_config.h | C | lgpl-3.0 | 6,488 | [
30522,
1013,
1008,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*-
* Copyright (c) 1997-2002 The Protein Laboratory, University of Copenhagen
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id$
*/
/* Created by Dmitry Karasik <dk@plab.ku.dk> */
#include "img_conv.h"
#ifdef __cplusplus
extern "C" {
#endif
#define var (( PImage) self)
#define dEDIFF_ARGS \
int * err_buf
#define EDIFF_INIT \
if (!(err_buf = malloc(( width + 2) * 3 * sizeof( int)))) return;\
memset( err_buf, 0,( width + 2) * 3 * sizeof( int));
#define EDIFF_DONE free(err_buf)
#define EDIFF_CONV err_buf
#define BCPARMS self, dstData, dstPal, dstType, dstPalSize, palSize_only
#define FILL_PALETTE(_pal,_palsize,_maxpalsize,_colorref)\
fill_palette(self,palSize_only,dstPal,dstPalSize,_pal,_palsize,_maxpalsize,_colorref)
/* Mono */
static void
fill_palette( Handle self, Bool palSize_only, RGBColor * dstPal, int * dstPalSize,
RGBColor * fillPalette, int fillPalSize, int maxPalSize, Byte * colorref)
{
Bool do_colormap = 1;
if ( palSize_only) {
if ( var-> palSize > *dstPalSize)
cm_squeeze_palette( var-> palette, var-> palSize, dstPal, *dstPalSize);
else if ( *dstPalSize > fillPalSize + var-> palSize) {
memcpy( dstPal, var-> palette, var-> palSize * sizeof(RGBColor));
memcpy( dstPal + var-> palSize, fillPalette, fillPalSize * sizeof(RGBColor));
memset( dstPal + var-> palSize + fillPalSize, 0, (*dstPalSize - fillPalSize - var-> palSize) * sizeof(RGBColor));
do_colormap = 0;
} else {
memcpy( dstPal, var-> palette, var-> palSize * sizeof(RGBColor));
cm_squeeze_palette( fillPalette, fillPalSize, dstPal + var-> palSize, *dstPalSize - var-> palSize);
do_colormap = 0;
}
} else if ( *dstPalSize != 0) {
if ( *dstPalSize > maxPalSize)
cm_squeeze_palette( dstPal, *dstPalSize, dstPal, *dstPalSize = maxPalSize);
} else if ( var-> palSize > maxPalSize) {
cm_squeeze_palette( var-> palette, var-> palSize, dstPal, *dstPalSize = maxPalSize);
} else {
memcpy( dstPal, var-> palette, (*dstPalSize = var-> palSize) * sizeof(RGBColor));
do_colormap = 0;
}
if ( colorref) {
if ( do_colormap)
cm_fill_colorref( var->palette, var-> palSize, dstPal, *dstPalSize, colorref);
else
memcpy( colorref, map_stdcolorref, 256);
}
}
BC( mono, mono, None)
{
int j, ws, mask;
dBCARGS;
BCWARN;
if ( palSize_only || *dstPalSize == 0)
memcpy( dstPal, stdmono_palette, (*dstPalSize = 2) * sizeof( RGBColor));
if ((
(var->palette[0].r + var->palette[0].g + var->palette[0].b) >
(var->palette[1].r + var->palette[1].g + var->palette[1].b)
) == (
(dstPal[0].r + dstPal[0].g + dstPal[0].b) >
(dstPal[1].r + dstPal[1].g + dstPal[1].b)
)) {
if ( dstData != var-> data)
memcpy( dstData, var-> data, var-> dataSize);
} else {
/* preserve off-width zeros */
ws = width >> 3;
if ((width & 7) == 0) {
ws--;
mask = 0xff;
} else
mask = (0xff00 >> (width & 7)) & 0xff;
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine) {
for ( j = 0; j < ws; j++) dstData[j] =~ srcData[j];
dstData[ws] = (~srcData[j]) & mask;
}
}
}
BC( mono, mono, Optimized)
{
dBCARGS;
U16 * tree;
Byte * buf;
dEDIFF_ARGS;
BCWARN;
FILL_PALETTE( stdmono_palette, 2, 2, nil);
if ( !( buf = malloc( width))) goto FAIL;
EDIFF_INIT;
if (!( tree = cm_study_palette( dstPal, *dstPalSize))) {
EDIFF_DONE;
free( buf);
goto FAIL;
}
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine) {
bc_mono_byte( srcData, buf, width);
bc_byte_op( buf, buf, width, tree, var-> palette, dstPal, EDIFF_CONV);
bc_byte_mono_cr( buf, dstData, width, map_stdcolorref);
}
free( tree);
free( buf);
EDIFF_DONE;
return;
FAIL:
ic_mono_mono_ictNone(BCPARMS);
}
BC( mono, nibble, None)
{
dBCARGS;
BCWARN;
FILL_PALETTE( stdmono_palette, 2, 16, colorref);
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_mono_nibble_cr( BCCONV, colorref);
}
BC( mono, byte, None)
{
dBCARGS;
BCWARN;
FILL_PALETTE( stdmono_palette, 2, 256, colorref);
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_mono_byte_cr( BCCONV, colorref);
}
BC( mono, graybyte, None)
{
dBCARGS;
BCWARN;
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_mono_graybyte( BCCONV, var->palette);
}
BC( mono, rgb, None)
{
dBCARGS;
BCWARN;
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_mono_rgb( BCCONV, var->palette);
}
/* Nibble */
BC( nibble, mono, None)
{
dBCARGS;
BCWARN;
FILL_PALETTE( stdmono_palette, 2, 2, colorref);
cm_fill_colorref( var->palette, var-> palSize, dstPal, *dstPalSize, colorref);
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_nibble_mono_cr( BCCONV, colorref);
}
BC( nibble, mono, Ordered)
{
dBCARGS;
BCWARN;
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_nibble_mono_ht( BCCONV, var->palette, i);
memcpy( dstPal, stdmono_palette, (*dstPalSize = 2) * sizeof(RGBColor));
}
BC( nibble, mono, ErrorDiffusion)
{
dBCARGS;
dEDIFF_ARGS;
BCWARN;
EDIFF_INIT;
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_nibble_mono_ed( BCCONV, var->palette, EDIFF_CONV);
EDIFF_DONE;
memcpy( dstPal, stdmono_palette, (*dstPalSize = 2) * sizeof(RGBColor));
}
BC( nibble, mono, Optimized)
{
dBCARGS;
U16 * tree;
Byte * buf;
dEDIFF_ARGS;
BCWARN;
FILL_PALETTE( stdmono_palette, 2, 2, nil);
if ( !( buf = malloc( width))) goto FAIL;
EDIFF_INIT;
if (!( tree = cm_study_palette( dstPal, *dstPalSize))) {
EDIFF_DONE;
free( buf);
goto FAIL;
}
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine) {
bc_nibble_byte( srcData, buf, width);
bc_byte_op( buf, buf, width, tree, var-> palette, dstPal, EDIFF_CONV);
bc_byte_mono_cr( buf, dstData, width, map_stdcolorref);
}
free( tree);
free( buf);
EDIFF_DONE;
return;
FAIL:
ic_nibble_mono_ictErrorDiffusion(BCPARMS);
}
BC( nibble, nibble, None)
{
dBCARGS;
int j, w = (width >> 1) + (width & 1);
BCWARN;
FILL_PALETTE( cubic_palette16, 16, 16, colorref);
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine) {
for ( j = 0; j < w; j++)
dstData[j] = (colorref[srcData[j] >> 4] << 4) | colorref[srcData[j] & 0xf];
}
}
BC( nibble, nibble, Optimized)
{
dBCARGS;
U16 * tree;
Byte * buf;
dEDIFF_ARGS;
BCWARN;
FILL_PALETTE( cubic_palette16, 16, 16, nil);
if ( !( buf = malloc( width))) goto FAIL;
EDIFF_INIT;
if (!( tree = cm_study_palette( dstPal, *dstPalSize))) {
EDIFF_DONE;
free( buf);
goto FAIL;
}
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine) {
bc_nibble_byte( srcData, buf, width);
bc_byte_op( buf, buf, width, tree, var-> palette, dstPal, EDIFF_CONV);
bc_byte_nibble_cr( buf, dstData, width, map_stdcolorref);
}
free( tree);
free( buf);
EDIFF_DONE;
return;
FAIL:
ic_nibble_nibble_ictNone(BCPARMS);
}
BC( nibble, byte, None)
{
dBCARGS;
BCWARN;
FILL_PALETTE( cubic_palette, 216, 256, colorref);
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_nibble_byte_cr( BCCONV, colorref);
}
BC( nibble, graybyte, None)
{
dBCARGS;
BCWARN;
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_nibble_graybyte( BCCONV, var->palette);
}
BC( nibble, rgb, None)
{
dBCARGS;
BCWARN;
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_nibble_rgb( BCCONV, var->palette);
}
/* Byte */
BC( byte, mono, None)
{
dBCARGS;
BCWARN;
FILL_PALETTE( stdmono_palette, 2, 2, colorref);
cm_fill_colorref( var->palette, var-> palSize, dstPal, *dstPalSize, colorref);
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_byte_mono_cr( BCCONV, colorref);
}
BC( byte, mono, Ordered)
{
dBCARGS;
BCWARN;
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_byte_mono_ht( BCCONV, var->palette, i);
memcpy( dstPal, stdmono_palette, (*dstPalSize = 2) * sizeof(RGBColor));
}
BC( byte, mono, ErrorDiffusion)
{
dBCARGS;
dEDIFF_ARGS;
BCWARN;
EDIFF_INIT;
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_byte_mono_ed( BCCONV, var->palette, EDIFF_CONV);
EDIFF_DONE;
memcpy( dstPal, stdmono_palette, (*dstPalSize = 2) * sizeof(RGBColor));
}
BC( byte, mono, Optimized)
{
dBCARGS;
U16 * tree;
Byte * buf;
dEDIFF_ARGS;
BCWARN;
FILL_PALETTE( stdmono_palette, 2, 2, nil);
if ( !( buf = malloc( width))) goto FAIL;
EDIFF_INIT;
if (!( tree = cm_study_palette( dstPal, *dstPalSize))) {
EDIFF_DONE;
free( buf);
goto FAIL;
}
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine) {
bc_byte_op( srcData, buf, width, tree, var-> palette, dstPal, EDIFF_CONV);
bc_byte_mono_cr( buf, dstData, width, map_stdcolorref);
}
free( tree);
free( buf);
EDIFF_DONE;
return;
FAIL:
ic_byte_mono_ictErrorDiffusion(BCPARMS);
}
BC( byte, nibble, None)
{
dBCARGS;
BCWARN;
FILL_PALETTE( cubic_palette16, 16, 16, colorref);
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_byte_nibble_cr( BCCONV, colorref);
}
BC( byte, nibble, Ordered)
{
dBCARGS;
BCWARN;
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_byte_nibble_ht( BCCONV, var->palette, i);
memcpy( dstPal, cubic_palette8, (*dstPalSize = 8) * sizeof(RGBColor));
}
BC( byte, nibble, ErrorDiffusion)
{
dBCARGS;
dEDIFF_ARGS;
BCWARN;
EDIFF_INIT;
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_byte_nibble_ed( BCCONV, var->palette, EDIFF_CONV);
EDIFF_DONE;
memcpy( dstPal, cubic_palette8, (*dstPalSize = 8) * sizeof(RGBColor));
}
BC( byte, nibble, Optimized)
{
dBCARGS;
U16 * tree;
Byte * buf, hist[256];
RGBColor new_palette[256];
int j, new_pal_size = 0;
dEDIFF_ARGS;
BCWARN;
if ( *dstPalSize == 0 || palSize_only) {
int lim = palSize_only ? *dstPalSize : 16;
memset( hist, 0, sizeof( hist));
for ( i = 0; i < height; i++) {
Byte * d = srcData + srcLine * i;
for ( j = 0; j < width; j++, d++)
if ( hist[*d] == 0) {
hist[*d] = 1;
new_palette[new_pal_size++] = var-> palette[*d];
if ( new_pal_size == 256) goto END_HIST_LOOP;
}
}
END_HIST_LOOP:
if ( new_pal_size > lim) {
cm_squeeze_palette( new_palette, new_pal_size, new_palette, lim);
new_pal_size = lim;
}
} else
memcpy( new_palette, dstPal, ( new_pal_size = *dstPalSize) * sizeof(RGBColor));
if ( !( buf = malloc( width))) goto FAIL;
EDIFF_INIT;
if (!( tree = cm_study_palette( new_palette, new_pal_size))) {
EDIFF_DONE;
free( buf);
goto FAIL;
}
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine) {
bc_byte_op( srcData, buf, width, tree, var-> palette, new_palette, EDIFF_CONV);
bc_byte_nibble_cr( buf, dstData, width, map_stdcolorref);
}
memcpy( dstPal, new_palette, new_pal_size * sizeof(RGBColor));
*dstPalSize = new_pal_size;
free( tree);
free( buf);
EDIFF_DONE;
return;
FAIL:
ic_byte_nibble_ictErrorDiffusion(BCPARMS);
}
BC( byte, byte, None)
{
dBCARGS;
int j;
BCWARN;
FILL_PALETTE( cubic_palette, 216, 256, colorref);
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine) {
for ( j = 0; j < width; j++)
dstData[j] = colorref[srcData[j]];
}
}
BC( byte, byte, Optimized)
{
dBCARGS;
U16 * tree;
dEDIFF_ARGS;
BCWARN;
FILL_PALETTE( cubic_palette, 216, 256, nil);
EDIFF_INIT;
if (!( tree = cm_study_palette( dstPal, *dstPalSize))) {
EDIFF_DONE;
goto FAIL;
}
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_byte_op( srcData, dstData, width, tree, var-> palette, dstPal, EDIFF_CONV);
free( tree);
EDIFF_DONE;
return;
FAIL:
ic_byte_byte_ictNone(BCPARMS);
}
BC( byte, graybyte, None)
{
dBCARGS;
BCWARN;
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_byte_graybyte( BCCONV, var->palette);
}
BC( byte, rgb, None)
{
dBCARGS;
BCWARN;
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_byte_rgb( BCCONV, var->palette);
}
/* Graybyte */
BC( graybyte, mono, Ordered)
{
dBCARGS;
BCWARN;
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_graybyte_mono_ht( BCCONV, i);
memcpy( dstPal, stdmono_palette, (*dstPalSize = 2) * sizeof(RGBColor));
}
BC( graybyte, mono, ErrorDiffusion)
{
dBCARGS;
dEDIFF_ARGS;
BCWARN;
EDIFF_INIT;
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_byte_mono_ed( BCCONV, std256gray_palette, EDIFF_CONV);
EDIFF_DONE;
memcpy( dstPal, stdmono_palette, (*dstPalSize = 2) * sizeof(RGBColor));
}
BC( graybyte, nibble, Ordered)
{
dBCARGS;
BCWARN;
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_graybyte_nibble_ht( BCCONV, i);
memcpy( dstPal, std16gray_palette, sizeof( std16gray_palette));
*dstPalSize = 16;
}
BC( graybyte, nibble, ErrorDiffusion)
{
dBCARGS;
dEDIFF_ARGS;
BCWARN;
EDIFF_INIT;
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_graybyte_nibble_ed( BCCONV, EDIFF_CONV);
EDIFF_DONE;
memcpy( dstPal, std16gray_palette, sizeof( std16gray_palette));
*dstPalSize = 16;
}
BC( graybyte, rgb, None)
{
dBCARGS;
BCWARN;
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_graybyte_rgb( BCCONV);
}
/* RGB */
BC( rgb, mono, None)
{
dBCARGS;
Byte * convBuf = allocb( width);
BCWARN;
if ( !convBuf) return;
cm_fill_colorref(( PRGBColor) map_RGB_gray, 256, stdmono_palette, 2, colorref);
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
{
bc_rgb_graybyte( srcData, convBuf, width);
bc_byte_mono_cr( convBuf, dstData, width, colorref);
}
free( convBuf);
memcpy( dstPal, stdmono_palette, (*dstPalSize = 2) * sizeof(RGBColor));
}
BC( rgb, mono, Ordered)
{
dBCARGS;
BCWARN;
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_rgb_mono_ht( BCCONV, i);
memcpy( dstPal, stdmono_palette, (*dstPalSize = 2) * sizeof(RGBColor));
}
BC( rgb, mono, ErrorDiffusion)
{
dBCARGS;
dEDIFF_ARGS;
BCWARN;
EDIFF_INIT;
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_rgb_mono_ed( BCCONV, EDIFF_CONV);
EDIFF_DONE;
memcpy( dstPal, stdmono_palette, (*dstPalSize = 2) * sizeof(RGBColor));
}
BC( rgb, mono, Optimized)
{
dBCARGS;
Byte * buf;
U16 * tree;
dEDIFF_ARGS;
BCWARN;
if ( palSize_only) goto FAIL;
if ( !( buf = malloc( width))) goto FAIL;
EDIFF_INIT;
if (!( tree = cm_study_palette( dstPal, *dstPalSize))) {
EDIFF_DONE;
free( buf);
goto FAIL;
}
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine) {
bc_rgb_byte_op(( RGBColor *) srcData, buf, width, tree, dstPal, EDIFF_CONV);
bc_byte_mono_cr( buf, dstData, width, map_stdcolorref);
}
free( tree);
free( buf);
EDIFF_DONE;
return;
FAIL:
ic_rgb_mono_ictErrorDiffusion(BCPARMS);
}
BC( rgb, nibble, None)
{
dBCARGS;
BCWARN;
memcpy( dstPal, cubic_palette16, sizeof( cubic_palette16));
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_rgb_nibble(BCCONV);
*dstPalSize = 16;
}
BC( rgb, nibble, Ordered)
{
dBCARGS;
BCWARN;
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_rgb_nibble_ht( BCCONV, i);
memcpy( dstPal, cubic_palette8, (*dstPalSize = 8) * sizeof(RGBColor));
}
BC( rgb, nibble, ErrorDiffusion)
{
dBCARGS;
dEDIFF_ARGS;
BCWARN;
EDIFF_INIT;
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_rgb_nibble_ed( BCCONV, EDIFF_CONV);
EDIFF_DONE;
memcpy( dstPal, cubic_palette8, (*dstPalSize = 8) * sizeof(RGBColor));
}
BC( rgb, nibble, Optimized)
{
dBCARGS;
U16 * tree;
Byte * buf;
RGBColor new_palette[16];
int new_pal_size = 16;
dEDIFF_ARGS;
BCWARN;
if ( *dstPalSize == 0 || palSize_only) {
if ( palSize_only) new_pal_size = *dstPalSize;
if ( !cm_optimized_palette( srcData, srcLine, width, height, new_palette, &new_pal_size))
goto FAIL;
} else
memcpy( new_palette, dstPal, ( new_pal_size = *dstPalSize) * sizeof(RGBColor));
if ( !( buf = malloc( width))) goto FAIL;
EDIFF_INIT;
if (!( tree = cm_study_palette( new_palette, new_pal_size))) {
EDIFF_DONE;
free( buf);
goto FAIL;
}
memcpy( dstPal, new_palette, new_pal_size * 3);
*dstPalSize = new_pal_size;
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine) {
bc_rgb_byte_op(( RGBColor *) srcData, buf, width, tree, dstPal, EDIFF_CONV);
bc_byte_nibble_cr( buf, dstData, width, map_stdcolorref);
}
free( tree);
free( buf);
EDIFF_DONE;
return;
FAIL:
ic_rgb_nibble_ictErrorDiffusion(BCPARMS);
}
BC( rgb, byte, None)
{
dBCARGS;
BCWARN;
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_rgb_byte( BCCONV);
memcpy( dstPal, cubic_palette, (*dstPalSize = 216) * sizeof(RGBColor));
}
BC( rgb, byte, Ordered)
{
dBCARGS;
BCWARN;
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_rgb_byte_ht( BCCONV, i);
memcpy( dstPal, cubic_palette, (*dstPalSize = 216) * sizeof(RGBColor));
}
BC( rgb, byte, ErrorDiffusion)
{
dBCARGS;
dEDIFF_ARGS;
BCWARN;
EDIFF_INIT;
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_rgb_byte_ed( BCCONV, EDIFF_CONV);
EDIFF_DONE;
memcpy( dstPal, cubic_palette, (*dstPalSize = 216) * sizeof(RGBColor));
}
BC( rgb, byte, Optimized)
{
dBCARGS;
U16 * tree;
RGBColor new_palette[768];
int new_pal_size = 256;
dEDIFF_ARGS;
BCWARN;
if ( *dstPalSize == 0 || palSize_only) {
if ( palSize_only) new_pal_size = *dstPalSize;
if ( !cm_optimized_palette( srcData, srcLine, width, height, new_palette, &new_pal_size))
goto FAIL;
} else
memcpy( new_palette, dstPal, ( new_pal_size = *dstPalSize) * sizeof(RGBColor));
EDIFF_INIT;
if (!( tree = cm_study_palette( new_palette, new_pal_size))) {
EDIFF_DONE;
goto FAIL;
}
memcpy( dstPal, new_palette, new_pal_size * 3);
*dstPalSize = new_pal_size;
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_rgb_byte_op(( RGBColor *) srcData, dstData, width, tree, dstPal, EDIFF_CONV);
free( tree);
EDIFF_DONE;
return;
FAIL:
ic_rgb_byte_ictErrorDiffusion(BCPARMS);
}
BC( rgb, graybyte, None)
{
dBCARGS;
BCWARN;
for ( i = 0; i < height; i++, srcData += srcLine, dstData += dstLine)
bc_rgb_graybyte( BCCONV);
}
#ifdef __cplusplus
}
#endif
| run4flat/Primo | img/ic_conv.c | C | bsd-2-clause | 20,933 | [
30522,
1013,
1008,
1011,
1008,
9385,
1006,
1039,
1007,
2722,
1011,
2526,
1996,
5250,
5911,
1010,
2118,
1997,
9664,
1008,
2035,
2916,
9235,
1012,
1008,
1008,
25707,
1998,
2224,
1999,
3120,
1998,
12441,
3596,
1010,
2007,
2030,
2302,
1008,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using Nest;
using Tests.Framework.Integration;
using Tests.Framework.MockData;
using static Nest.Infer;
namespace Tests.Aggregations.Bucket.Children
{
/**
* A special single bucket aggregation that enables aggregating from buckets on parent document types to
* buckets on child documents.
*
* Be sure to read the Elasticsearch documentation on {ref_current}/search-aggregations-bucket-children-aggregation.html[Children Aggregation]
*/
public class ChildrenAggregationUsageTests : AggregationUsageTestBase
{
public ChildrenAggregationUsageTests(ReadOnlyCluster i, EndpointUsage usage) : base(i, usage) { }
protected override object ExpectJson => new
{
aggs = new
{
name_of_child_agg = new
{
children = new { type = "commits" },
aggs = new
{
average_per_child = new
{
avg = new { field = "confidenceFactor" }
},
max_per_child = new
{
max = new { field = "confidenceFactor" }
}
}
}
}
};
protected override Func<SearchDescriptor<Project>, ISearchRequest> Fluent => s => s
.Aggregations(aggs => aggs
.Children<CommitActivity>("name_of_child_agg", child => child
.Aggregations(childAggs => childAggs
.Average("average_per_child", avg => avg.Field(p => p.ConfidenceFactor))
.Max("max_per_child", avg => avg.Field(p => p.ConfidenceFactor))
)
)
);
protected override SearchRequest<Project> Initializer =>
new SearchRequest<Project>
{
Aggregations = new ChildrenAggregation("name_of_child_agg", typeof(CommitActivity))
{
Aggregations =
new AverageAggregation("average_per_child", "confidenceFactor") &&
new MaxAggregation("max_per_child", "confidenceFactor")
}
};
}
}
| UdiBen/elasticsearch-net | src/Tests/Aggregations/Bucket/Children/ChildrenAggregationUsageTests.cs | C# | apache-2.0 | 1,771 | [
30522,
2478,
2291,
1025,
2478,
9089,
1025,
2478,
5852,
1012,
7705,
1012,
8346,
1025,
2478,
5852,
1012,
7705,
1012,
12934,
2850,
2696,
1025,
2478,
10763,
9089,
1012,
1999,
7512,
1025,
3415,
15327,
5852,
1012,
28041,
2015,
1012,
13610,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#include <Gosu/WinUtility.hpp>
#include <Gosu/Utility.hpp>
#include <stdexcept>
#include <vector>
namespace
{
typedef std::vector<std::tr1::function<bool (MSG&)> > Hooks;
Hooks hooks;
bool handledByHook(MSG& message)
{
for (Hooks::iterator i = hooks.begin(); i != hooks.end(); ++i)
if ((*i)(message))
return true;
return false;
}
}
HINSTANCE Gosu::Win::instance()
{
return check(::GetModuleHandle(0), "getting the module handle");
}
void Gosu::Win::handleMessage()
{
MSG message;
BOOL ret = ::GetMessage(&message, 0, 0, 0);
switch (ret)
{
case -1:
{
// GetMessage() failed.
throwLastError("trying to get the next message");
}
case 0:
{
// GetMessage() found a WM_QUIT message.
// IMPR: Is there a better way to respond to this?
break;
}
default:
{
// Normal behaviour, if the message does not get handled by
// something else.
if (!handledByHook(message))
{
::TranslateMessage(&message);
::DispatchMessage(&message);
}
}
}
}
void Gosu::Win::processMessages()
{
MSG message;
while (::PeekMessage(&message, 0, 0, 0, PM_REMOVE))
if (!handledByHook(message))
{
::TranslateMessage(&message);
::DispatchMessage(&message);
}
}
void Gosu::Win::registerMessageHook(const std::tr1::function<bool (MSG&)>& hook)
{
hooks.push_back(hook);
}
void Gosu::Win::throwLastError(const std::string& action)
{
// Obtain error message from Windows.
char* buffer;
if (!::FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, 0,
::GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
reinterpret_cast<LPSTR>(&buffer), 0, 0) || buffer == 0)
{
// IMPR: Can we do better than this?
throw std::runtime_error("Unknown error");
}
// Move the message out of the ugly char* buffer.
std::string message;
try
{
message = buffer;
}
catch (...)
{
::LocalFree(buffer);
throw;
}
::LocalFree(buffer);
// Optionally prepend the action.
if (!action.empty())
message = "While " + action + ", the following error occured: " +
message;
// Now throw it.
throw std::runtime_error(message);
}
std::wstring Gosu::Win::appFilename()
{
static std::wstring result;
if (!result.empty())
return result;
wchar_t buffer[MAX_PATH * 2];
check(::GetModuleFileName(0, buffer, MAX_PATH * 2),
"getting the module filename");
result = buffer;
return result;
}
std::wstring Gosu::Win::appDirectory()
{
static std::wstring result;
if (!result.empty())
return result;
result = appFilename();
std::wstring::size_type lastDelim = result.find_last_of(L"\\/");
if (lastDelim != std::wstring::npos)
result.resize(lastDelim + 1);
else
result = L"";
return result;
}
| sustmi/oflute | gosu/GosuImpl/WinUtility.cpp | C++ | gpl-2.0 | 3,335 | [
30522,
1001,
2421,
1026,
2175,
6342,
1013,
2663,
21823,
18605,
1012,
6522,
2361,
1028,
1001,
2421,
1026,
2175,
6342,
1013,
9710,
1012,
6522,
2361,
1028,
1001,
2421,
1026,
2358,
3207,
2595,
3401,
13876,
1028,
1001,
2421,
1026,
9207,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package repack.org.bouncycastle.util.test;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.security.SecureRandom;
public class FixedSecureRandom
extends SecureRandom
{
private byte[] _data;
private int _index;
private int _intPad;
public FixedSecureRandom(byte[] value)
{
this(false, new byte[][] { value });
}
public FixedSecureRandom(
byte[][] values)
{
this(false, values);
}
/**
* Pad the data on integer boundaries. This is necessary for the classpath project's BigInteger
* implementation.
*/
public FixedSecureRandom(
boolean intPad,
byte[] value)
{
this(intPad, new byte[][] { value });
}
/**
* Pad the data on integer boundaries. This is necessary for the classpath project's BigInteger
* implementation.
*/
public FixedSecureRandom(
boolean intPad,
byte[][] values)
{
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
for (int i = 0; i != values.length; i++)
{
try
{
bOut.write(values[i]);
}
catch (IOException e)
{
throw new IllegalArgumentException("can't save value array.");
}
}
_data = bOut.toByteArray();
if (intPad)
{
_intPad = _data.length % 4;
}
}
public void nextBytes(byte[] bytes)
{
System.arraycopy(_data, _index, bytes, 0, bytes.length);
_index += bytes.length;
}
//
// classpath's implementation of SecureRandom doesn't currently go back to nextBytes
// when next is called. We can't override next as it's a final method.
//
public int nextInt()
{
int val = 0;
val |= nextValue() << 24;
val |= nextValue() << 16;
if (_intPad == 2)
{
_intPad--;
}
else
{
val |= nextValue() << 8;
}
if (_intPad == 1)
{
_intPad--;
}
else
{
val |= nextValue();
}
return val;
}
//
// classpath's implementation of SecureRandom doesn't currently go back to nextBytes
// when next is called. We can't override next as it's a final method.
//
public long nextLong()
{
long val = 0;
val |= (long)nextValue() << 56;
val |= (long)nextValue() << 48;
val |= (long)nextValue() << 40;
val |= (long)nextValue() << 32;
val |= (long)nextValue() << 24;
val |= (long)nextValue() << 16;
val |= (long)nextValue() << 8;
val |= (long)nextValue();
return val;
}
public boolean isExhausted()
{
return _index == _data.length;
}
private int nextValue()
{
return _data[_index++] & 0xff;
}
}
| bullda/DroidText | src/bouncycastle/repack/org/bouncycastle/util/test/FixedSecureRandom.java | Java | lgpl-3.0 | 3,088 | [
30522,
7427,
16360,
8684,
1012,
8917,
1012,
8945,
4609,
5666,
23662,
1012,
21183,
4014,
1012,
3231,
1025,
12324,
9262,
1012,
22834,
1012,
24880,
2906,
9447,
5833,
18780,
21422,
1025,
12324,
9262,
1012,
22834,
1012,
22834,
10288,
24422,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
Copyright (C) 2014-2019 de4dot@gmail.com
This file is part of dnSpy
dnSpy 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.
dnSpy 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 dnSpy. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.ComponentModel.Composition;
using System.Diagnostics;
using System.Linq;
using dnSpy.Contracts.Images;
using dnSpy.Contracts.Menus;
using dnSpy.Contracts.ToolWindows;
using dnSpy.Contracts.ToolWindows.App;
namespace dnSpy.MainApp {
sealed class ToolWindowGroupContext {
public readonly IDsToolWindowService DsToolWindowService;
public readonly IToolWindowGroupService ToolWindowGroupService;
public readonly IToolWindowGroup ToolWindowGroup;
public ToolWindowGroupContext(IDsToolWindowService toolWindowService, IToolWindowGroup toolWindowGroup) {
DsToolWindowService = toolWindowService;
ToolWindowGroupService = toolWindowGroup.ToolWindowGroupService;
ToolWindowGroup = toolWindowGroup;
}
}
abstract class CtxMenuToolWindowGroupCommand : MenuItemBase<ToolWindowGroupContext> {
protected sealed override object CachedContextKey => ContextKey;
static readonly object ContextKey = new object();
protected sealed override ToolWindowGroupContext? CreateContext(IMenuItemContext context) => CreateContextInternal(context);
readonly IDsToolWindowService toolWindowService;
protected CtxMenuToolWindowGroupCommand(IDsToolWindowService toolWindowService) => this.toolWindowService = toolWindowService;
protected ToolWindowGroupContext? CreateContextInternal(IMenuItemContext context) {
if (context.CreatorObject.Guid != new Guid(MenuConstants.GUIDOBJ_TOOLWINDOW_TABCONTROL_GUID))
return null;
var twg = context.Find<IToolWindowGroup>();
if (twg is null || !toolWindowService.Owns(twg))
return null;
return new ToolWindowGroupContext(toolWindowService, twg);
}
}
[ExportMenuItem(Header = "res:HideToolWindowCommand", InputGestureText = "res:ShortCutKeyShiftEsc", Icon = DsImagesAttribute.TableViewNameOnly, Group = MenuConstants.GROUP_CTX_TOOLWINS_CLOSE, Order = 10)]
sealed class HideTWCtxMenuCommand : CtxMenuToolWindowGroupCommand {
[ImportingConstructor]
HideTWCtxMenuCommand(IDsToolWindowService toolWindowService)
: base(toolWindowService) {
}
public override bool IsVisible(ToolWindowGroupContext context) => context.ToolWindowGroup.CloseActiveTabCanExecute;
public override void Execute(ToolWindowGroupContext context) => context.ToolWindowGroup.CloseActiveTab();
}
[ExportMenuItem(Header = "res:HideAllToolWindowsCommand", Icon = DsImagesAttribute.CloseDocumentGroup, Group = MenuConstants.GROUP_CTX_TOOLWINS_CLOSE, Order = 20)]
sealed class CloseAllTabsTWCtxMenuCommand : CtxMenuToolWindowGroupCommand {
[ImportingConstructor]
CloseAllTabsTWCtxMenuCommand(IDsToolWindowService toolWindowService)
: base(toolWindowService) {
}
public override bool IsVisible(ToolWindowGroupContext context) => context.ToolWindowGroupService.CloseAllTabsCanExecute;
public override void Execute(ToolWindowGroupContext context) => context.ToolWindowGroupService.CloseAllTabs();
}
static class CmdConstants {
public const string MOVE_CONTENT_GUID = "D54D52CB-A6FC-408C-9A52-EA0D53AEEC3A";
public const string GROUP_MOVE_CONTENT = "0,92C51A9F-DE4B-4D7F-B1DC-AAA482936B5C";
public const string MOVE_GROUP_GUID = "047ECD64-82EF-4774-9C0A-330A61989432";
public const string GROUP_MOVE_GROUP = "0,174B60EE-279F-4DA4-9F07-44FFD03E4421";
}
[ExportMenuItem(Header = "res:MoveToolWindowCommand", Guid = CmdConstants.MOVE_CONTENT_GUID, Group = MenuConstants.GROUP_CTX_TOOLWINS_CLOSE, Order = 30)]
sealed class MoveTWCtxMenuCommand : CtxMenuToolWindowGroupCommand {
[ImportingConstructor]
MoveTWCtxMenuCommand(IDsToolWindowService toolWindowService)
: base(toolWindowService) {
}
public override void Execute(ToolWindowGroupContext context) => Debug.Fail("Shouldn't be here");
}
[ExportMenuItem(Header = "res:MoveToolWindowGroupCommand", Guid = CmdConstants.MOVE_GROUP_GUID, Group = MenuConstants.GROUP_CTX_TOOLWINS_CLOSE, Order = 40)]
sealed class MoveGroupTWCtxMenuCommand : CtxMenuToolWindowGroupCommand {
[ImportingConstructor]
MoveGroupTWCtxMenuCommand(IDsToolWindowService toolWindowService)
: base(toolWindowService) {
}
public override bool IsVisible(ToolWindowGroupContext context) => context.ToolWindowGroup.TabContents.Count() > 1;
public override void Execute(ToolWindowGroupContext context) => Debug.Fail("Shouldn't be here");
}
[ExportMenuItem(OwnerGuid = CmdConstants.MOVE_CONTENT_GUID, Header = "res:MoveTopCommand", Icon = DsImagesAttribute.ToolstripPanelTop, Group = CmdConstants.GROUP_MOVE_CONTENT, Order = 0)]
sealed class MoveTWTopCtxMenuCommand : CtxMenuToolWindowGroupCommand {
[ImportingConstructor]
MoveTWTopCtxMenuCommand(IDsToolWindowService toolWindowService)
: base(toolWindowService) {
}
public override bool IsEnabled(ToolWindowGroupContext context) => context.DsToolWindowService.CanMove(context.ToolWindowGroup.ActiveTabContent, AppToolWindowLocation.Top);
public override void Execute(ToolWindowGroupContext context) => context.DsToolWindowService.Move(context.ToolWindowGroup.ActiveTabContent, AppToolWindowLocation.Top);
}
[ExportMenuItem(OwnerGuid = CmdConstants.MOVE_CONTENT_GUID, Header = "res:MoveLeftCommand", Icon = DsImagesAttribute.ToolstripPanelLeft, Group = CmdConstants.GROUP_MOVE_CONTENT, Order = 10)]
sealed class MoveTWLeftCtxMenuCommand : CtxMenuToolWindowGroupCommand {
[ImportingConstructor]
MoveTWLeftCtxMenuCommand(IDsToolWindowService toolWindowService)
: base(toolWindowService) {
}
public override bool IsEnabled(ToolWindowGroupContext context) => context.DsToolWindowService.CanMove(context.ToolWindowGroup.ActiveTabContent, AppToolWindowLocation.Left);
public override void Execute(ToolWindowGroupContext context) => context.DsToolWindowService.Move(context.ToolWindowGroup.ActiveTabContent, AppToolWindowLocation.Left);
}
[ExportMenuItem(OwnerGuid = CmdConstants.MOVE_CONTENT_GUID, Header = "res:MoveRightCommand", Icon = DsImagesAttribute.ToolstripPanelRight, Group = CmdConstants.GROUP_MOVE_CONTENT, Order = 20)]
sealed class MoveTWRightCtxMenuCommand : CtxMenuToolWindowGroupCommand {
[ImportingConstructor]
MoveTWRightCtxMenuCommand(IDsToolWindowService toolWindowService)
: base(toolWindowService) {
}
public override bool IsEnabled(ToolWindowGroupContext context) => context.DsToolWindowService.CanMove(context.ToolWindowGroup.ActiveTabContent, AppToolWindowLocation.Right);
public override void Execute(ToolWindowGroupContext context) => context.DsToolWindowService.Move(context.ToolWindowGroup.ActiveTabContent, AppToolWindowLocation.Right);
}
[ExportMenuItem(OwnerGuid = CmdConstants.MOVE_CONTENT_GUID, Header = "res:MoveBottomCommand", Icon = DsImagesAttribute.ToolstripPanelBottom, Group = CmdConstants.GROUP_MOVE_CONTENT, Order = 30)]
sealed class MoveTWBottomCtxMenuCommand : CtxMenuToolWindowGroupCommand {
[ImportingConstructor]
MoveTWBottomCtxMenuCommand(IDsToolWindowService toolWindowService)
: base(toolWindowService) {
}
public override bool IsEnabled(ToolWindowGroupContext context) => context.DsToolWindowService.CanMove(context.ToolWindowGroup.ActiveTabContent, AppToolWindowLocation.Bottom);
public override void Execute(ToolWindowGroupContext context) => context.DsToolWindowService.Move(context.ToolWindowGroup.ActiveTabContent, AppToolWindowLocation.Bottom);
}
[ExportMenuItem(OwnerGuid = CmdConstants.MOVE_GROUP_GUID, Header = "res:MoveTopCommand", Icon = DsImagesAttribute.ToolstripPanelTop, Group = CmdConstants.GROUP_MOVE_GROUP, Order = 0)]
sealed class MoveGroupTWTopCtxMenuCommand : CtxMenuToolWindowGroupCommand {
[ImportingConstructor]
MoveGroupTWTopCtxMenuCommand(IDsToolWindowService toolWindowService)
: base(toolWindowService) {
}
public override bool IsEnabled(ToolWindowGroupContext context) => context.DsToolWindowService.CanMove(context.ToolWindowGroup, AppToolWindowLocation.Top);
public override void Execute(ToolWindowGroupContext context) => context.DsToolWindowService.Move(context.ToolWindowGroup, AppToolWindowLocation.Top);
}
[ExportMenuItem(OwnerGuid = CmdConstants.MOVE_GROUP_GUID, Header = "res:MoveLeftCommand", Icon = DsImagesAttribute.ToolstripPanelLeft, Group = CmdConstants.GROUP_MOVE_GROUP, Order = 10)]
sealed class MoveGroupTWLeftCtxMenuCommand : CtxMenuToolWindowGroupCommand {
[ImportingConstructor]
MoveGroupTWLeftCtxMenuCommand(IDsToolWindowService toolWindowService)
: base(toolWindowService) {
}
public override bool IsEnabled(ToolWindowGroupContext context) => context.DsToolWindowService.CanMove(context.ToolWindowGroup, AppToolWindowLocation.Left);
public override void Execute(ToolWindowGroupContext context) => context.DsToolWindowService.Move(context.ToolWindowGroup, AppToolWindowLocation.Left);
}
[ExportMenuItem(OwnerGuid = CmdConstants.MOVE_GROUP_GUID, Header = "res:MoveRightCommand", Icon = DsImagesAttribute.ToolstripPanelRight, Group = CmdConstants.GROUP_MOVE_GROUP, Order = 20)]
sealed class MoveGroupTWRightCtxMenuCommand : CtxMenuToolWindowGroupCommand {
[ImportingConstructor]
MoveGroupTWRightCtxMenuCommand(IDsToolWindowService toolWindowService)
: base(toolWindowService) {
}
public override bool IsEnabled(ToolWindowGroupContext context) => context.DsToolWindowService.CanMove(context.ToolWindowGroup, AppToolWindowLocation.Right);
public override void Execute(ToolWindowGroupContext context) => context.DsToolWindowService.Move(context.ToolWindowGroup, AppToolWindowLocation.Right);
}
[ExportMenuItem(OwnerGuid = CmdConstants.MOVE_GROUP_GUID, Header = "res:MoveBottomCommand", Icon = DsImagesAttribute.ToolstripPanelBottom, Group = CmdConstants.GROUP_MOVE_GROUP, Order = 30)]
sealed class MoveGroupTWBottomCtxMenuCommand : CtxMenuToolWindowGroupCommand {
[ImportingConstructor]
MoveGroupTWBottomCtxMenuCommand(IDsToolWindowService toolWindowService)
: base(toolWindowService) {
}
public override bool IsEnabled(ToolWindowGroupContext context) => context.DsToolWindowService.CanMove(context.ToolWindowGroup, AppToolWindowLocation.Bottom);
public override void Execute(ToolWindowGroupContext context) => context.DsToolWindowService.Move(context.ToolWindowGroup, AppToolWindowLocation.Bottom);
}
[ExportMenuItem(Header = "res:NewHorizontalTabGroupCommand", Icon = DsImagesAttribute.SplitScreenHorizontally, Group = MenuConstants.GROUP_CTX_TOOLWINS_GROUPS, Order = 0)]
sealed class NewHorizontalTabGroupCtxMenuCommand : CtxMenuToolWindowGroupCommand {
[ImportingConstructor]
NewHorizontalTabGroupCtxMenuCommand(IDsToolWindowService toolWindowService)
: base(toolWindowService) {
}
public override bool IsVisible(ToolWindowGroupContext context) => context.ToolWindowGroupService.NewHorizontalTabGroupCanExecute;
public override void Execute(ToolWindowGroupContext context) => context.ToolWindowGroupService.NewHorizontalTabGroup();
}
[ExportMenuItem(Header = "res:NewVerticalTabGroupCommand", Icon = DsImagesAttribute.SplitScreenVertically, Group = MenuConstants.GROUP_CTX_TOOLWINS_GROUPS, Order = 10)]
sealed class NewVerticalTabGroupCtxMenuCommand : CtxMenuToolWindowGroupCommand {
[ImportingConstructor]
NewVerticalTabGroupCtxMenuCommand(IDsToolWindowService toolWindowService)
: base(toolWindowService) {
}
public override bool IsVisible(ToolWindowGroupContext context) => context.ToolWindowGroupService.NewVerticalTabGroupCanExecute;
public override void Execute(ToolWindowGroupContext context) => context.ToolWindowGroupService.NewVerticalTabGroup();
}
[ExportMenuItem(Header = "res:MoveToNextTabGroupCommand", Group = MenuConstants.GROUP_CTX_TOOLWINS_GROUPS, Order = 20)]
sealed class MoveToNextTabGroupCtxMenuCommand : CtxMenuToolWindowGroupCommand {
[ImportingConstructor]
MoveToNextTabGroupCtxMenuCommand(IDsToolWindowService toolWindowService)
: base(toolWindowService) {
}
public override bool IsVisible(ToolWindowGroupContext context) => context.ToolWindowGroupService.MoveToNextTabGroupCanExecute;
public override void Execute(ToolWindowGroupContext context) => context.ToolWindowGroupService.MoveToNextTabGroup();
}
[ExportMenuItem(Header = "res:MoveAllTabsToNextTabGroupCommand", Group = MenuConstants.GROUP_CTX_TOOLWINS_GROUPS, Order = 30)]
sealed class MoveAllToNextTabGroupCtxMenuCommand : CtxMenuToolWindowGroupCommand {
[ImportingConstructor]
MoveAllToNextTabGroupCtxMenuCommand(IDsToolWindowService toolWindowService)
: base(toolWindowService) {
}
public override bool IsVisible(ToolWindowGroupContext context) => context.ToolWindowGroupService.MoveAllToNextTabGroupCanExecute;
public override void Execute(ToolWindowGroupContext context) => context.ToolWindowGroupService.MoveAllToNextTabGroup();
}
[ExportMenuItem(Header = "res:MoveToPreviousTabGroupCommand", Group = MenuConstants.GROUP_CTX_TOOLWINS_GROUPS, Order = 40)]
sealed class MoveToPreviousTabGroupCtxMenuCommand : CtxMenuToolWindowGroupCommand {
[ImportingConstructor]
MoveToPreviousTabGroupCtxMenuCommand(IDsToolWindowService toolWindowService)
: base(toolWindowService) {
}
public override bool IsVisible(ToolWindowGroupContext context) => context.ToolWindowGroupService.MoveToPreviousTabGroupCanExecute;
public override void Execute(ToolWindowGroupContext context) => context.ToolWindowGroupService.MoveToPreviousTabGroup();
}
[ExportMenuItem(Header = "res:MoveAllToPreviousTabGroupCommand", Group = MenuConstants.GROUP_CTX_TOOLWINS_GROUPS, Order = 50)]
sealed class MoveAllToPreviousTabGroupCtxMenuCommand : CtxMenuToolWindowGroupCommand {
[ImportingConstructor]
MoveAllToPreviousTabGroupCtxMenuCommand(IDsToolWindowService toolWindowService)
: base(toolWindowService) {
}
public override bool IsVisible(ToolWindowGroupContext context) => context.ToolWindowGroupService.MoveAllToPreviousTabGroupCanExecute;
public override void Execute(ToolWindowGroupContext context) => context.ToolWindowGroupService.MoveAllToPreviousTabGroup();
}
[ExportMenuItem(Header = "res:CloseTabGroupCommand", Group = MenuConstants.GROUP_CTX_TOOLWINS_GROUPSCLOSE, Order = 0)]
sealed class CloseTabGroupCtxMenuCommand : CtxMenuToolWindowGroupCommand {
[ImportingConstructor]
CloseTabGroupCtxMenuCommand(IDsToolWindowService toolWindowService)
: base(toolWindowService) {
}
public override bool IsVisible(ToolWindowGroupContext context) => context.ToolWindowGroupService.CloseTabGroupCanExecute;
public override void Execute(ToolWindowGroupContext context) => context.ToolWindowGroupService.CloseTabGroup();
}
[ExportMenuItem(Header = "res:CloseAllTabGroupsButThisCommand", Group = MenuConstants.GROUP_CTX_TOOLWINS_GROUPSCLOSE, Order = 10)]
sealed class CloseAllTabGroupsButThisCtxMenuCommand : CtxMenuToolWindowGroupCommand {
[ImportingConstructor]
CloseAllTabGroupsButThisCtxMenuCommand(IDsToolWindowService toolWindowService)
: base(toolWindowService) {
}
public override bool IsVisible(ToolWindowGroupContext context) => context.ToolWindowGroupService.CloseAllTabGroupsButThisCanExecute;
public override void Execute(ToolWindowGroupContext context) => context.ToolWindowGroupService.CloseAllTabGroupsButThis();
}
[ExportMenuItem(Header = "res:MoveTabGroupAfterNextTabGroupCommand", Group = MenuConstants.GROUP_CTX_TOOLWINS_GROUPSCLOSE, Order = 20)]
sealed class MoveTabGroupAfterNextTabGroupCtxMenuCommand : CtxMenuToolWindowGroupCommand {
[ImportingConstructor]
MoveTabGroupAfterNextTabGroupCtxMenuCommand(IDsToolWindowService toolWindowService)
: base(toolWindowService) {
}
public override bool IsVisible(ToolWindowGroupContext context) => context.ToolWindowGroupService.MoveTabGroupAfterNextTabGroupCanExecute;
public override void Execute(ToolWindowGroupContext context) => context.ToolWindowGroupService.MoveTabGroupAfterNextTabGroup();
}
[ExportMenuItem(Header = "res:MoveTabGroupBeforePreviousTabGroupCommand", Group = MenuConstants.GROUP_CTX_TOOLWINS_GROUPSCLOSE, Order = 30)]
sealed class MoveTabGroupBeforePreviousTabGroupCtxMenuCommand : CtxMenuToolWindowGroupCommand {
[ImportingConstructor]
MoveTabGroupBeforePreviousTabGroupCtxMenuCommand(IDsToolWindowService toolWindowService)
: base(toolWindowService) {
}
public override bool IsVisible(ToolWindowGroupContext context) => context.ToolWindowGroupService.MoveTabGroupBeforePreviousTabGroupCanExecute;
public override void Execute(ToolWindowGroupContext context) => context.ToolWindowGroupService.MoveTabGroupBeforePreviousTabGroup();
}
[ExportMenuItem(Header = "res:MergeAllTabGroupsCommand", Group = MenuConstants.GROUP_CTX_TOOLWINS_GROUPSCLOSE, Order = 40)]
sealed class MergeAllTabGroupsCtxMenuCommand : CtxMenuToolWindowGroupCommand {
[ImportingConstructor]
MergeAllTabGroupsCtxMenuCommand(IDsToolWindowService toolWindowService)
: base(toolWindowService) {
}
public override bool IsVisible(ToolWindowGroupContext context) => context.ToolWindowGroupService.MergeAllTabGroupsCanExecute;
public override void Execute(ToolWindowGroupContext context) => context.ToolWindowGroupService.MergeAllTabGroups();
}
[ExportMenuItem(Header = "res:UseVerticalTabGroupsCommand", Icon = DsImagesAttribute.SplitScreenVertically, Group = MenuConstants.GROUP_CTX_TOOLWINS_GROUPSVERT, Order = 0)]
sealed class UseVerticalTabGroupsCtxMenuCommand : CtxMenuToolWindowGroupCommand {
[ImportingConstructor]
UseVerticalTabGroupsCtxMenuCommand(IDsToolWindowService toolWindowService)
: base(toolWindowService) {
}
public override bool IsVisible(ToolWindowGroupContext context) => context.ToolWindowGroupService.UseVerticalTabGroupsCanExecute;
public override void Execute(ToolWindowGroupContext context) => context.ToolWindowGroupService.UseVerticalTabGroups();
}
[ExportMenuItem(Header = "res:UseHorizontalTabGroupsCommand", Icon = DsImagesAttribute.SplitScreenHorizontally, Group = MenuConstants.GROUP_CTX_TOOLWINS_GROUPSVERT, Order = 10)]
sealed class UseHorizontalTabGroupsCtxMenuCommand : CtxMenuToolWindowGroupCommand {
[ImportingConstructor]
UseHorizontalTabGroupsCtxMenuCommand(IDsToolWindowService toolWindowService)
: base(toolWindowService) {
}
public override bool IsVisible(ToolWindowGroupContext context) => context.ToolWindowGroupService.UseHorizontalTabGroupsCanExecute;
public override void Execute(ToolWindowGroupContext context) => context.ToolWindowGroupService.UseHorizontalTabGroups();
}
}
| manojdjoshi/dnSpy | dnSpy/dnSpy/MainApp/DsToolWindowServiceCommands.cs | C# | gpl-3.0 | 19,003 | [
30522,
1013,
1008,
9385,
1006,
1039,
1007,
2297,
1011,
10476,
2139,
2549,
27364,
1030,
20917,
4014,
1012,
4012,
2023,
5371,
2003,
2112,
1997,
1040,
3619,
7685,
1040,
3619,
7685,
2003,
2489,
4007,
1024,
2017,
2064,
2417,
2923,
3089,
8569,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright © 2015, Peter Atashian
// Licensed under the MIT License <LICENSE.md>
extern crate build;
fn main() {
build::link("wow32", true)
}
| Boddlnagg/winapi-rs | lib/wow32/build.rs | Rust | mit | 149 | [
30522,
1013,
1013,
9385,
1075,
2325,
1010,
2848,
29533,
6182,
2319,
1013,
1013,
7000,
2104,
1996,
10210,
6105,
1026,
6105,
1012,
9108,
1028,
4654,
16451,
27297,
3857,
1025,
1042,
2078,
2364,
1006,
1007,
1063,
3857,
1024,
1024,
4957,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* Eegl.cpp - C++ random number generator Version 1.0.0 */
/* Copyright (C) 2016 aquila62 at github.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: */
/* Free Software Foundation, Inc. */
/* 59 Temple Place - Suite 330 */
/* Boston, MA 02111-1307, USA. */
/********************************************************/
/* The LFSR in this generator comes from the following */
/* website http://www.xilinx.com/support/documentation/ */
/* application_notes/xapp052.pdf */
/********************************************************/
#include <time.h>
#include <stdlib.h>
#include <gsl/gsl_rng.h>
#include "Eegl.hpp"
Eegl::Eegl(int initStates)
{
SetEegl(initStates);
} /* constructor */
void Eegl::SetEegl(int initStates)
{
int i;
states = initStates;
if (states < 1 || states > 1000)
{
fprintf(stderr,"Eegl::SetEegl - Invalid "
"number of states %d\n", states);
exit(1);
} /* invalid states */
/* declare the GSL random number generator as taus */
r = (gsl_rng *) gsl_rng_alloc(gsl_rng_taus);
/* allocate the GSL taus random number generator */
r = (gsl_rng *) gsl_rng_alloc(gsl_rng_taus);
/* initialize the GSL taus random number generator */
srand(time(0));
gsl_rng_set(r, rand());
for (i=0;i<states;i++)
{
state[i] = gsl_rng_get(r); /* set to random UINT */
} /* for each state */
} /* SetEegl */
int Eegl::eegl(void)
{
int i;
unsigned int tmpState;
/* select one out of 1000 states */
ofst = i = gsl_rng_uniform_int(r, states);
tmpState = state[i];
/* calculate LFSR step */
out = ((tmpState >> 31) ^ (tmpState >> 30)
^ (tmpState >> 10) ^ (tmpState >> 0)) & 1;
/* roll the LFSR right */
state[i] = ((tmpState >> 1) | (out << 31));
/* return the output of the LFSR step */
return((int) out);
} /* Eegl::eegl */
double Eegl::eeglunif(void)
{
int i;
double num;
num = 0.0;
i = 53;
while (i--)
{
if (Eegl::eegl())
{
num = (num * 0.5) + 0.5;
} /* if one bit */
else
{
num = num * 0.5;
} /* else zero bit */
} /* for each bit in the mantissa */
return(num);
} /* Eegl::eeglunif */
unsigned int Eegl::eeglpwr(int bits)
{
int i;
unsigned int num;
num = 0;
i = bits;
while (i--)
{
num = (num << 1) + Eegl::eegl();
} /* for each bit in the unsigned integer */
return(num);
} /* Eegl::eeglpwr */
int Eegl::eeglint(int limit)
{
double unif;
double dblLimit;
double rslt;
unif = Eegl::eeglunif();
dblLimit = (double) limit;
rslt = unif * dblLimit;
return((int) rslt);
} /* Eegl::eeglint */
| aquila62/eegl | cplusplus/Eegl.cpp | C++ | gpl-2.0 | 3,637 | [
30522,
1013,
1008,
25212,
23296,
1012,
18133,
2361,
1011,
1039,
1009,
1009,
6721,
2193,
13103,
2544,
1015,
1012,
1014,
1012,
1014,
1008,
1013,
1013,
1008,
9385,
1006,
1039,
1007,
2355,
1037,
26147,
2050,
2575,
2475,
2012,
21025,
2705,
12083... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
local function pre_process(msg)
local alirezapt = msg['id']
local user = msg.from.id
local chat = msg.to.id
local hash = 'mate:'..chat..':'..user
if msg.fwd_from and not is_momod(msg) then
if redis:get(hash) and msg.fwd_from and not is_momod(msg) then
delete_msg(msg.id, ok_cb, false)
redis:del(hash)
kick_user(user, chat)
else
local text = "کاربر ["..msg.from.first_name.."] از فوروارد کردن مطالب خودداری کنید\nدر صورت تکرار از گروه حذف خواهید شد"
reply_msg(alirezapt, text, ok_cb, true)
redis:set(hash, true)
end
end
return msg
end
local function run(msg, matches)
local alirezapt = msg['id']
if matches[1] == 'forward warn' then
if is_momod(msg) then
local hash = 'mate:'..msg.to.id
redis:set(hash, true)
local text = ' انجام شد\nاخطار برای فوروارد مطالب فعال شد'
reply_msg(alirezapt, text, ok_cb, true)
else
local text = 'شما مجاز نیستید'
reply_msg(alirezapt, text, ok_cb, true)
end
end
if matches[1] == 'forward ok' then
if is_momod(msg) then
local hash = 'mate:'..msg.to.id
redis:del(hash)
local text = ' انجام شد\nفوروارد کردن مطالب مجاز شد'
reply_msg(alirezapt, text, ok_cb, true)
else
local text = 'شما مجاز نیستید'
reply_msg(alirezapt, text, ok_cb, true)
end
end
end
return {
patterns = {
"^[#!/](forward warn)$",
"^[#!/](forward ok)$"
},
run = run,
pre_process = pre_process
}
--[[
در صورت کپی از محتوا منبع را ذکر کنید
@alireza_PT
@CliApi
@Create_antispam_bot
--]]
| adel8268adelad/Bot-thebest | plugins/forward-warn.lua | Lua | agpl-3.0 | 1,848 | [
30522,
2334,
3853,
3653,
1035,
2832,
1006,
5796,
2290,
1007,
2334,
4862,
2890,
4143,
13876,
1027,
5796,
2290,
1031,
1005,
8909,
1005,
1033,
2334,
5310,
1027,
5796,
2290,
1012,
2013,
1012,
8909,
2334,
11834,
1027,
5796,
2290,
1012,
2000,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Zwackhiomyces dispersus (J. Lahm ex Körb.) Triebel & Grube SPECIES
#### Status
ACCEPTED
#### According to
Index Fungorum
#### Published in
in Grube & Hafellner, Nova Hedwigia 51(3-4): 314 (1990)
#### Original name
Arthopyrenia dispersa J. Lahm ex Körb.
### Remarks
null | mdoering/backbone | life/Fungi/Ascomycota/Eurotiomycetes/Pyrenulales/Xanthopyreniaceae/Zwackhiomyces/Zwackhiomyces dispersus/README.md | Markdown | apache-2.0 | 278 | [
30522,
1001,
1062,
4213,
3600,
4048,
16940,
9623,
4487,
17668,
13203,
1006,
1046,
1012,
2474,
14227,
4654,
12849,
15185,
1012,
1007,
13012,
15878,
2884,
1004,
24665,
12083,
2063,
2427,
1001,
1001,
1001,
1001,
3570,
3970,
1001,
1001,
1001,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2013 by Erwin Marsi and TST-Centrale
#
# This file is part of the DAESO Framework.
#
# The DAESO Framework 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.
#
# The DAESO Framework 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/>.
"""
distutils setup script for distributing Timbl Tools
"""
# TODO:
# - docs, data and test are not installed when using bdist_wininst...
__authors__ = "Erwin Marsi <e.marsi@gmail.com>"
from distutils.core import setup
from glob import glob
from os import walk, path, remove
from os.path import basename, isdir, join, exists
from shutil import rmtree
if exists('MANIFEST'): remove('MANIFEST')
if exists("build"): rmtree("build")
name = "timbl-tools"
version = "0.5.0"
description = """Timbl Tools is a collection of Python modules and scripts for
working with TiMBL, the Tilburg Memory-based Learner."""
long_description = """
Timbl Tools is a collection of Python modules and scripts for working with
TiMBL, the Tilburg Memory-based Learner. It provides support for:
* creating Timbl servers and clients
* running (cross-validated) experiments
* lazy parsing of verbose Timbl ouput (e.g. NN distributions)
* down-sampling of instances
* writing ascii graphs of the feature weights
"""
packages = [ root[4:]
for (root, dirs, files) in walk("lib")
if not ".svn" in root ]
def get_data_files(data_dir_prefix, dir):
# data_files specifies a sequence of (directory, files) pairs
# Each (directory, files) pair in the sequence specifies the installation directory
# and the files to install there.
data_files = []
for base, subdirs, files in walk(dir):
install_dir = join(data_dir_prefix, base)
files = [ join(base, f) for f in files
if not f.endswith(".pyc") and not f.endswith("~") ]
data_files.append((install_dir, files))
if '.svn' in subdirs:
subdirs.remove('.svn') # ignore svn directories
return data_files
# data files are installed under sys.prefix/share/pycornetto-%(version)
data_dir = join("share", "%s-%s" % (name, version))
data_files = [(data_dir, ['CHANGES', 'COPYING', 'INSTALL', 'README'])]
data_files += get_data_files(data_dir, "doc")
data_files += get_data_files(data_dir, "data")
sdist_options = dict(
formats=["zip","gztar","bztar"])
setup(
name = name,
version = version,
description = description,
long_description = long_description,
license = "GNU Public License v3",
author = "Erwin Marsi",
author_email = "e.marsi@gmail.com",
url = "https://github.com/emsrc/timbl-tools",
requires = ["networkx"],
provides = ["tt (%s)" % version],
package_dir = {"": "lib"},
packages = packages,
scripts = glob(join("bin","*.py")),
data_files = data_files,
platforms = "POSIX, Mac OS X, MS Windows",
keywords = [
"TiMBL"],
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU Public License (GPL)",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Natural Language :: English"
],
options = dict(sdist=sdist_options)
)
| emsrc/timbl-tools | setup.py | Python | gpl-3.0 | 3,905 | [
30522,
1001,
999,
1013,
2149,
2099,
1013,
8026,
1013,
4372,
2615,
18750,
1001,
1011,
1008,
1011,
16861,
1024,
21183,
2546,
1011,
1022,
1011,
1008,
1011,
1001,
1001,
9385,
1006,
1039,
1007,
2289,
1011,
2286,
2011,
22209,
7733,
2072,
1998,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package mx.nic.jool.pktgen.type;
import mx.nic.jool.pktgen.BitArrayOutputStream;
public class ByteArrayField implements Field {
private String name;
private byte[] value;
public ByteArrayField(String name, byte[] defaultValue) {
this.name = name;
this.value = defaultValue;
}
@Override
public String toString() {
if (value == null)
return null;
StringBuilder sb = new StringBuilder();
for (byte bait : value)
sb.append(bait).append(",");
return sb.toString();
}
@Override
public void parse(String value) {
String[] strings = value.split(",");
this.value = new byte[strings.length];
for (int i = 0; i < strings.length; i++)
this.value[i] = Byte.valueOf(strings[i]);
}
@Override
public void write(BitArrayOutputStream out) {
if (value != null)
out.write(value);
}
@Override
public String getName() {
return name;
}
@Override
public int getLength() {
return (value != null) ? (8 * value.length) : 0;
}
public byte[] getValue() {
return value;
}
public void setValue(byte[] value) {
this.value = value;
}
}
| ydahhrk/PktGenerator | src/main/java/mx/nic/jool/pktgen/type/ByteArrayField.java | Java | gpl-2.0 | 1,079 | [
30522,
7427,
25630,
1012,
27969,
1012,
28576,
2140,
1012,
1052,
25509,
6914,
1012,
2828,
1025,
12324,
25630,
1012,
27969,
1012,
28576,
2140,
1012,
1052,
25509,
6914,
1012,
2978,
2906,
9447,
5833,
18780,
21422,
1025,
2270,
2465,
24880,
2906,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<script src="../src/util.js"></script>
<script src="../src/BNF-parser.js"></script>
<script src="../src/IR.js"></script>
<script src="../src/Zipper.js"></script>
<script src="../src/flow.js"></script>
<script src="../src/lex-parser.js"></script>
<script src="../src/LR1-parser.js"></script>
<script src="../src/symbol-table.js"></script>
<script src="../test/test.js"></script>
</head>
<body>
Log is in the Console.
</body>
</html> | qdwang/dawn.js | demo/test.html | HTML | mit | 526 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
2516,
1028,
3231,
1026,
1013,
2516,
1028,
1026,
5896,
5034,
2278,
1027,
1000,
1012,
1012,
1013,
5034,
2278,
1013,
21183,
4014,
1012,
1046,
2015,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* File CostMatrixConstraint.java
*
* This file is part of the jCoCoA project.
*
* Copyright 2016 Anonymous
*
* 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 org.anon.cocoa.constraints;
import org.anon.cocoa.variables.DiscreteVariable;
/**
* CostMatrixConstraint
*
* @author Anomymous
* @version 0.1
* @since 26 feb. 2016
*/
public class PreferentialEqualityConstraint<V> extends CostMatrixConstraint<V> {
/**
* @param var1
* @param var2
*/
public PreferentialEqualityConstraint(DiscreteVariable<V> var1,
DiscreteVariable<V> var2,
double[] pref1,
double[] pref2,
double inequalityCost) {
super(var1,
var2,
PreferentialEqualityConstraint.buildCostMatrix(pref1, inequalityCost),
PreferentialEqualityConstraint.buildCostMatrix(pref2, inequalityCost));
}
/**
* @param pref
* @param inequalityCost
* @return
*/
private static double[][] buildCostMatrix(double[] pref, double inequalityCost) {
int size = pref.length;
double[][] costs = new double[size][size];
for (int x = 0; x < size; x++) {
for (int y = 0; y < size; y++) {
if (x == y) {
costs[x][y] = pref[x];
} else {
costs[x][y] = inequalityCost;
}
}
}
return costs;
}
}
| anonc187/jCoCoA | src/main/java/org/anon/cocoa/constraints/PreferentialEqualityConstraint.java | Java | apache-2.0 | 2,039 | [
30522,
1013,
1008,
1008,
1008,
5371,
3465,
18900,
17682,
8663,
20528,
18447,
1012,
9262,
1008,
1008,
2023,
5371,
2003,
2112,
1997,
1996,
29175,
24163,
2050,
2622,
1012,
1008,
1008,
9385,
2355,
10812,
1008,
1008,
7000,
2104,
1996,
15895,
610... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>interval: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.7.2 / interval - 4.3.1</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
interval
<small>
4.3.1
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-01-22 06:02:19 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-01-22 06:02:19 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-num base Num library distributed with the OCaml compiler
base-ocamlbuild base OCamlbuild binary and libraries distributed with the OCaml compiler
base-threads base
base-unix base
camlp5 7.14 Preprocessor-pretty-printer of OCaml
conf-findutils 1 Virtual package relying on findutils
conf-perl 1 Virtual package relying on perl
coq 8.7.2 Formal proof management system
num 0 The Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.02.3 The OCaml compiler (virtual package)
ocaml-base-compiler 4.02.3 Official 4.02.3 release
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.1 A library manager for OCaml
# opam file:
opam-version: "2.0"
maintainer: "guillaume.melquiond@inria.fr"
homepage: "https://coqinterval.gitlabpages.inria.fr/"
dev-repo: "git+https://gitlab.inria.fr/coqinterval/interval.git"
bug-reports: "https://gitlab.inria.fr/coqinterval/interval/issues"
license: "CeCILL-C"
build: [
["autoconf"] {dev}
["./configure"]
["./remake" "-j%{jobs}%"]
]
install: ["./remake" "install"]
depends: [
"coq" {>= "8.8" & < "8.15~"}
"coq-bignums"
"coq-flocq" {>= "3.1"}
"coq-mathcomp-ssreflect" {>= "1.6"}
"coq-coquelicot" {>= "3.0"}
"conf-autoconf" {build & dev}
("conf-g++" {build} | "conf-clang" {build})
]
tags: [
"keyword:interval arithmetic"
"keyword:decision procedure"
"keyword:floating-point arithmetic"
"keyword:reflexive tactic"
"keyword:Taylor models"
"category:Mathematics/Real Calculus and Topology"
"category:Computer Science/Decision Procedures and Certified Algorithms/Decision procedures"
"logpath:Interval"
"date:2021-11-08"
]
authors: [
"Guillaume Melquiond <guillaume.melquiond@inria.fr>"
"Érik Martin-Dorel <erik.martin-dorel@irit.fr>"
"Pierre Roux <pierre.roux@onera.fr>"
"Thomas Sibut-Pinote <thomas.sibut-pinote@inria.fr>"
]
synopsis: "A Coq tactic for proving bounds on real-valued expressions automatically"
url {
src: "https://coqinterval.gitlabpages.inria.fr/releases/interval-4.3.1.tar.gz"
checksum: "sha512=ca04b178eecc6264116daf52a6b3dc6ca8f8bd9ce704761e574119a2caeceb4367b1c1e7b715b38ec79f4e226d87c3f39efdbde94b2415ef17ce39b0fe9ba9d8"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-interval.4.3.1 coq.8.7.2</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.7.2).
The following dependencies couldn't be met:
- coq-interval -> coq >= 8.8 -> ocaml >= 4.05.0
base of this switch (use `--unlock-base' to force)
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-interval.4.3.1</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| coq-bench/coq-bench.github.io | clean/Linux-x86_64-4.02.3-2.0.6/released/8.7.2/interval/4.3.1.html | HTML | mit | 7,912 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
11374,
1027,
1000,
4372,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
18804,
2171,
1027,
1000,
3193,
6442,
1000,
418... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
use std::str::FromStr;
fn read_line() -> String {
let mut input = String::new();
std::io::stdin().read_line(&mut input).expect("Could not read stdin!");
input
}
fn read_multiple<F>(sep: &str) -> Vec<F> where F: FromStr {
read_line().trim().split(sep).map(|token| token.parse().ok().unwrap()).collect()
}
fn gcd(a: u64, b: u64) -> u64 {
if a == 0 {
b
} else {
gcd(b % a, a)
}
}
fn main() {
let input = read_multiple::<u64>(" ");
let (a, b) = (input[0], input[1]);
println!("{}", gcd(a, b));
}
| Bugfry/exercism | hackerrank/30-days-of-code/day009.rs | Rust | mit | 527 | [
30522,
2224,
2358,
2094,
1024,
1024,
2358,
2099,
1024,
1024,
2013,
3367,
2099,
1025,
1042,
2078,
3191,
1035,
2240,
1006,
1007,
1011,
1028,
5164,
1063,
2292,
14163,
2102,
7953,
1027,
5164,
1024,
1024,
2047,
1006,
1007,
1025,
2358,
2094,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Braintree Multi-Merchant Example
================================
## Set Up
Note: This example requires multiple Braintree sandbox accounts.
1. Clone this repository
2. [Install Composer](https://getcomposer.org/download/), if necessary
3. Install dependencies (`composer install`)
4. Modify `credentials.php` to include all of your sandbox credentials
## Running
php multi_merchant_transaction_test.php
| matthewpatterson/braintree_multi_merchant_example | README.md | Markdown | mit | 413 | [
30522,
4167,
13334,
4800,
1011,
6432,
2742,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
module WinFFI
module User32
# Windowstation creation flags.
# https://msdn.microsoft.com/en-us/library/windows/desktop/ms682496
CreateWindowStationFlag = enum :create_window_station_flag, [:CREATE_ONLY, 0x00000001]
define_prefix(:CWF, CreateWindowStationFlag)
end
end | P3t3rU5/win-ffi-user32 | lib/win-ffi/user32/enum/window_station/create_window_station_flag.rb | Ruby | mit | 288 | [
30522,
11336,
2663,
26989,
11336,
5310,
16703,
1001,
3645,
12516,
4325,
9245,
1012,
1001,
16770,
1024,
1013,
1013,
5796,
2094,
2078,
1012,
7513,
1012,
4012,
1013,
4372,
1011,
2149,
1013,
3075,
1013,
3645,
1013,
15363,
1013,
5796,
2575,
2620... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 Freeman Zhang <zhanggyb@gmail.com>
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#pragma once
#include <cppevent/delegate.hpp>
#include <cppevent/invokable-token.hpp>
namespace CppEvent {
template<typename ... ParamTypes>
class DelegateToken : public InvokableToken < ParamTypes... >
{
public:
DelegateToken() = delete;
inline DelegateToken(const Delegate<void, ParamTypes...>& d);
virtual ~DelegateToken();
virtual void Invoke(ParamTypes... Args) override;
const Delegate<void, ParamTypes...>& delegate () const
{
return delegate_;
}
private:
Delegate<void, ParamTypes...> delegate_;
};
template<typename ... ParamTypes>
inline DelegateToken<ParamTypes...>::DelegateToken(const Delegate<void, ParamTypes...>& d)
: InvokableToken<ParamTypes...>(), delegate_(d)
{
}
template<typename ... ParamTypes>
DelegateToken<ParamTypes...>::~DelegateToken()
{
}
template<typename ... ParamTypes>
void DelegateToken<ParamTypes...>::Invoke(ParamTypes... Args)
{
delegate_(Args...);
}
} // namespace CppEvent
| zhanggyb/BlendInt | include/blendint/cppevent/delegate-token.hpp | C++ | lgpl-3.0 | 2,130 | [
30522,
1013,
1008,
1008,
1996,
10210,
6105,
1006,
10210,
1007,
1008,
1008,
9385,
1006,
1039,
1007,
2325,
11462,
9327,
1026,
9327,
6292,
2497,
1030,
20917,
4014,
1012,
4012,
1028,
1008,
1008,
6656,
2003,
2182,
3762,
4379,
1010,
2489,
1997,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
namespace Behat\Mink\Tests\Driver\Basic;
use Behat\Mink\Tests\Driver\TestCase;
class BasicAuthTest extends TestCase
{
/**
* @dataProvider setBasicAuthDataProvider
*/
public function testSetBasicAuth($user, $pass, $pageText)
{
$session = $this->getSession();
$session->setBasicAuth($user, $pass);
$session->visit($this->pathTo('/basic_auth.php'));
$this->assertStringContainsString($pageText, $session->getPage()->getContent());
}
public function setBasicAuthDataProvider()
{
return array(
array('mink-user', 'mink-password', 'is authenticated'),
array('', '', 'is not authenticated'),
);
}
public function testBasicAuthInUrl()
{
$session = $this->getSession();
$url = $this->pathTo('/basic_auth.php');
$url = str_replace('://', '://mink-user:mink-password@', $url);
$session->visit($url);
$this->assertStringContainsString('is authenticated', $session->getPage()->getContent());
$url = $this->pathTo('/basic_auth.php');
$url = str_replace('://', '://mink-user:wrong@', $url);
$session->visit($url);
$this->assertStringContainsString('is not authenticated', $session->getPage()->getContent());
}
public function testResetBasicAuth()
{
$session = $this->getSession();
$session->setBasicAuth('mink-user', 'mink-password');
$session->visit($this->pathTo('/basic_auth.php'));
$this->assertStringContainsString('is authenticated', $session->getPage()->getContent());
$session->setBasicAuth(false);
$session->visit($this->pathTo('/headers.php'));
$this->assertStringNotContainsString('PHP_AUTH_USER', $session->getPage()->getContent());
}
public function testResetWithBasicAuth()
{
$session = $this->getSession();
$session->setBasicAuth('mink-user', 'mink-password');
$session->visit($this->pathTo('/basic_auth.php'));
$this->assertStringContainsString('is authenticated', $session->getPage()->getContent());
$session->reset();
$session->visit($this->pathTo('/headers.php'));
$this->assertStringNotContainsString('PHP_AUTH_USER', $session->getPage()->getContent());
}
}
| minkphp/driver-testsuite | tests/Basic/BasicAuthTest.php | PHP | mit | 2,323 | [
30522,
1026,
1029,
25718,
3415,
15327,
2022,
12707,
1032,
8117,
2243,
1032,
5852,
1032,
4062,
1032,
3937,
1025,
2224,
2022,
12707,
1032,
8117,
2243,
1032,
5852,
1032,
4062,
1032,
3231,
18382,
1025,
2465,
3937,
4887,
2705,
22199,
8908,
3231,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package org.lantern.monitoring;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.io.IOUtils;
import org.lantern.HttpURLClient;
import org.lantern.JsonUtils;
import org.lantern.LanternConstants;
/**
* API for posting and querying stats to/from statshub.
*/
public class StatshubAPI extends HttpURLClient {
public StatshubAPI() {
this(null);
}
public StatshubAPI(InetSocketAddress proxyAddress) {
super(proxyAddress);
}
/**
* Submit stats for an instance to statshub.
*
* @param instanceId
* @param userGuid
* @param countryCode
* @param isFallback
* @param stats
* @throws Exception
*/
public void postInstanceStats(
String instanceId,
String userGuid,
String countryCode,
boolean isFallback,
Stats stats)
throws Exception {
postStats("instance_" + instanceId, userGuid, countryCode, isFallback,
stats, null);
}
/**
* Submit stats for a user to statshub.
*
* @param userGuid
* @param countryCode
* @param stats
* @throws Exception
*/
public void postUserStats(
String userGuid,
String countryCode,
Stats stats)
throws Exception {
postStats("user_" + userGuid, userGuid, countryCode, false, stats, null);
}
/**
* Submits stats to statshub.
*
* @param id
* the stat id (instanceId or userId)
* @param userGuid
* the userId (if applicable)
* @param countryCode
* the countryCode
* @param addFallbackDim
* if true, the id will be added to the dims as "fallback"
* @param stats
* the stats
* @param dims
* additional dimensions to post with the stats
*/
public void postStats(
String id,
String userGuid,
String countryCode,
boolean addFallbackDim,
Stats stats,
Map<String, String> additionalDims)
throws Exception {
Map<String, Object> request = new HashMap<String, Object>();
Map<String, String> dims = new HashMap<String, String>();
if (additionalDims != null) {
dims.putAll(additionalDims);
}
dims.put("user", userGuid);
dims.put("country", countryCode);
if (addFallbackDim) {
dims.put("fallback", id);
}
request.put("dims", dims);
request.put("counters", stats.getCounters());
request.put("increments", stats.getIncrements());
request.put("gauges", stats.getGauges());
request.put("members", stats.getMembers());
HttpURLConnection conn = null;
OutputStream out = null;
try {
String url = urlFor(id);
conn = newConn(url);
conn.setRequestMethod("POST");
conn.setDoOutput(true);
conn.setRequestProperty("Content-Type", "application/json");
out = conn.getOutputStream();
JsonUtils.OBJECT_MAPPER.writeValue(out, request);
int code = conn.getResponseCode();
if (code != 200) {
// will be logged below
throw new Exception("Got " + code + " response for " + url
+ ":\n"
+ conn.getResponseMessage());
}
} finally {
IOUtils.closeQuietly(out);
if (conn != null) {
conn.disconnect();
}
}
}
public StatsResponse getStats(final String dimension) throws IOException {
HttpURLConnection conn = null;
InputStream in = null;
try {
String url = urlFor(dimension + "/");
conn = newConn(url);
conn.setRequestMethod("GET");
conn.setRequestProperty("Content-Type", "application/json");
in = conn.getInputStream();
int code = conn.getResponseCode();
if (code != 200) {
// will be logged below
throw new IOException("Got " + code + " response for " + url
+ ":\n"
+ conn.getResponseMessage());
}
return JsonUtils.decode(in, StatsResponse.class);
} finally {
IOUtils.closeQuietly(in);
if (conn != null) {
conn.disconnect();
}
}
}
private String urlFor(String instanceId) {
return LanternConstants.statshubBaseAddress
+ instanceId;
}
}
| getlantern/lantern-common | src/main/java/org/lantern/monitoring/StatshubAPI.java | Java | apache-2.0 | 4,868 | [
30522,
7427,
8917,
1012,
12856,
1012,
8822,
1025,
12324,
9262,
1012,
22834,
1012,
22834,
10288,
24422,
1025,
12324,
9262,
1012,
22834,
1012,
20407,
25379,
1025,
12324,
9262,
1012,
22834,
1012,
27852,
25379,
1025,
12324,
9262,
1012,
5658,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
---
layout: base
---
<div class="body-container">
<!--[if lt IE 8]>
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<nav class="navbar navbar-light bg-faded">
<div class="d-flex justify-content-between">
<a class="navbar-brand" href="{{ '/' | relative_url }}">{{ site.title | escape }}</a>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="{{ '/about/' | relative_url }}" title="About">About</a>
</li>
</ul>
</div>
</nav>
<div class="content">
{{ content }}
</div>
<footer class="bg-faded p-3">
<p class="text-center mb-0 text-muted">© 2017 {{ site.author | escape }}</p>
</footer>
</div>
| bulnab/bulnab.github.io | _layouts/default.html | HTML | mit | 801 | [
30522,
1011,
1011,
1011,
9621,
1024,
2918,
1011,
1011,
1011,
1026,
4487,
2615,
2465,
1027,
1000,
2303,
1011,
11661,
1000,
1028,
1026,
999,
1011,
1011,
1031,
2065,
8318,
29464,
1022,
1033,
1028,
1026,
1052,
2465,
1027,
1000,
16602,
6279,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#include "factory_meas_periodic.hpp"
FactoryMeasPeriodic::FactoryMeasPeriodic() {
namePrefix = "stats_";
bufferMax = 365;
calcInterval = 5*60*1000;
interval = 24*60*60*1000;
}
void FactoryMeasPeriodic::makeItSo(std::shared_ptr<MeasTypeArray> measTypeArray, std::shared_ptr<AddonsArray> addonsArray) {
for(std::vector<std::shared_ptr<MeasType>>::iterator it = measTypeArray->measTypes.begin(); it != measTypeArray->measTypes.end(); ++it) {
std::shared_ptr<MeasType> measType = *it;
std::unique_ptr<MeasPeriodicStatsAddon> mps = std::make_unique<MeasPeriodicStatsAddon>();
mps->name = namePrefix + measType->name;
mps->bufferMax = bufferMax;
mps->calcInterval = calcInterval;
mps->interval = interval;
mps->measName = measType->name;
addonsArray->addons.push_back(std::move(mps));
}
}
| HomeIO/homeio_backend | src/backend/addons/factory_meas_periodic.cpp | C++ | gpl-3.0 | 833 | [
30522,
1001,
2421,
1000,
4713,
1035,
2033,
3022,
1035,
15861,
1012,
6522,
2361,
1000,
4713,
4168,
3022,
4842,
3695,
14808,
1024,
1024,
4713,
4168,
3022,
4842,
3695,
14808,
30524,
4168,
3022,
4842,
3695,
14808,
1024,
1024,
2191,
12762,
2080,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//------------------------------------------------------------------------------
// <auto-generated>
// Este código fue generado por una herramienta.
// Versión de runtime: <..>
//
// Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si
// se vuelve a generar el código.
// </auto-generated>
//------------------------------------------------------------------------------
#if !BUILD_LAND_XML
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
using XmlSchemaProcessor.Common;
namespace XmlSchemaProcessor.LandXml20
{
public enum DitchBottomShape
{
[StringValue("true-V")]
TrueV,
[StringValue("rounded-V")]
RoundedV,
[StringValue("rounded-trapezoidal")]
RoundedTrapezoidal,
[StringValue("flat-trapezoidal")]
FlatTrapezoidal,
}
}
#endif
| jlroviramartin/XsdProcessor | LandXml20/DitchBottomShape.cs | C# | lgpl-2.1 | 940 | [
30522,
1013,
1013,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_24) on Tue Oct 22 17:54:52 CEST 2013 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
Uses of Class de.ovgu.dke.teaching.ml.tictactoe.game.Board3D (TicTacToe Environment 1.3.0 API)
</TITLE>
<META NAME="date" CONTENT="2013-10-22">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class de.ovgu.dke.teaching.ml.tictactoe.game.Board3D (TicTacToe Environment 1.3.0 API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../de/ovgu/dke/teaching/ml/tictactoe/game/Board3D.html" title="class in de.ovgu.dke.teaching.ml.tictactoe.game"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../../../index.html?de/ovgu/dke/teaching/ml/tictactoe/game//class-useBoard3D.html" target="_top"><B>FRAMES</B></A>
<A HREF="Board3D.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<CENTER>
<H2>
<B>Uses of Class<br>de.ovgu.dke.teaching.ml.tictactoe.game.Board3D</B></H2>
</CENTER>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Packages that use <A HREF="../../../../../../../../de/ovgu/dke/teaching/ml/tictactoe/game/Board3D.html" title="class in de.ovgu.dke.teaching.ml.tictactoe.game">Board3D</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="#de.ovgu.dke.teaching.ml.tictactoe.game"><B>de.ovgu.dke.teaching.ml.tictactoe.game</B></A></TD>
<TD>Game logic, rules and a tournament class. </TD>
</TR>
</TABLE>
<P>
<A NAME="de.ovgu.dke.teaching.ml.tictactoe.game"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Uses of <A HREF="../../../../../../../../de/ovgu/dke/teaching/ml/tictactoe/game/Board3D.html" title="class in de.ovgu.dke.teaching.ml.tictactoe.game">Board3D</A> in <A HREF="../../../../../../../../de/ovgu/dke/teaching/ml/tictactoe/game/package-summary.html">de.ovgu.dke.teaching.ml.tictactoe.game</A></FONT></TH>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left" COLSPAN="2">Constructors in <A HREF="../../../../../../../../de/ovgu/dke/teaching/ml/tictactoe/game/package-summary.html">de.ovgu.dke.teaching.ml.tictactoe.game</A> with parameters of type <A HREF="../../../../../../../../de/ovgu/dke/teaching/ml/tictactoe/game/Board3D.html" title="class in de.ovgu.dke.teaching.ml.tictactoe.game">Board3D</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../../../../de/ovgu/dke/teaching/ml/tictactoe/game/Board3D.html#Board3D(de.ovgu.dke.teaching.ml.tictactoe.game.Board3D)">Board3D</A></B>(<A HREF="../../../../../../../../de/ovgu/dke/teaching/ml/tictactoe/game/Board3D.html" title="class in de.ovgu.dke.teaching.ml.tictactoe.game">Board3D</A> board)</CODE>
<BR>
Copy constructor for a 3d board.</TD>
</TR>
</TABLE>
<P>
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../de/ovgu/dke/teaching/ml/tictactoe/game/Board3D.html" title="class in de.ovgu.dke.teaching.ml.tictactoe.game"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../../../index.html?de/ovgu/dke/teaching/ml/tictactoe/game//class-useBoard3D.html" target="_top"><B>FRAMES</B></A>
<A HREF="Board3D.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright © 2013. All Rights Reserved.
</BODY>
</HTML>
| aczapata/TicTacToe | docs/javadoc/de/ovgu/dke/teaching/ml/tictactoe/game/class-use/Board3D.html | HTML | apache-2.0 | 8,445 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
16129,
1018,
1012,
5890,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
8917,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# kicad-bom-generator.js
KiCad components (.cmp) and netlist (.net) to JSON converter.
[](https://www.npmjs.org/package/kicad-bom-generator)
[](https://david-dm.org/mondalaci/kicad-bom-generator)
[](https://travis-ci.org/mondalaci/kicad-bom-generator)
# Usage
First, `npm install kicad-bom-generator`
Then let's take a KiCad components file and netlist file like [uhk-left-main.cmp](test/uhk-left-main.cmp) and
[uhk-left-main.net](test/uhk-left-main.net) and
```
var fs = require('fs');
var kicadBomGenerator = require('kicad-bom-generator');
var kicadComponents = fs.readFileSync(
'node_modules/kicad-bom-generator/test/uhk-left-main.cmp',
{encoding:'utf8'});
var kicadNetlist = fs.readFileSync(
'node_modules/kicad-bom-generator/test/uhk-left-main.net',
{encoding:'utf8'});
console.log(JSON.stringify(kicadBomGenerator(kicadComponents, kicadNetlist), null, 4));
```
This way you'll end up with [uhk-left-main.json](test/uhk-left-main.json)
| mondalaci/kicad-bom-generator | README.md | Markdown | gpl-3.0 | 1,185 | [
30522,
1001,
11382,
3540,
2094,
1011,
8945,
2213,
1011,
13103,
1012,
1046,
2015,
11382,
3540,
2094,
6177,
1006,
1012,
4642,
2361,
1007,
1998,
5658,
9863,
1006,
1012,
5658,
1007,
2000,
1046,
3385,
10463,
2121,
1012,
1031,
999,
1031,
27937,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/***********************************************************
Copyright (C) 2010-2013 Hewlett-Packard Development Company, L.P.
Copyright (C) 2015 Siemens AG
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
***********************************************************/
use Fossology\Lib\Auth\Auth;
use Fossology\Lib\Dao\UploadDao;
class ui_buckets extends FO_Plugin
{
var $uploadtree_tablename = "";
function __construct()
{
$this->Name = "bucketbrowser";
$this->Title = _("Bucket Browser");
$this->Dependency = array("browse","view");
$this->DBaccess = PLUGIN_DB_READ;
$this->LoginFlag = 0;
parent::__construct();
}
/**
* \brief Create and configure database tables
*/
function Install()
{
global $PG_CONN;
if (empty($PG_CONN)) {
return(1);
} /* No DB */
/**
* If there are no bucket pools defined,
* then create a simple demo.
* Note: that the bucketpool and two simple bucket definitions
* are created but no user default bucket pools are set.
* We don't want to automatically set this to be the
* default bucket pool because this may not be appropiate for
* the installation. The user or system administrator will
* have to set the default bucket pool in their account settings.
*/
/* Check if there is already a bucket pool, if there is
* then return because there is nothing to do.
*/
$sql = "SELECT bucketpool_pk FROM bucketpool limit 1";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
if (pg_num_rows($result) > 0)
{
pg_free_result($result);
return;
}
/* none exist so create the demo */
$DemoPoolName = "GPL Demo bucket pool";
$sql = "INSERT INTO bucketpool (bucketpool_name, version, active, description) VALUES ('$DemoPoolName', 1, 'Y', 'Demonstration of a very simple GPL/non-gpl bucket pool')";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
pg_free_result($result);
/* get the bucketpool_pk of the newly inserted record */
$sql = "select bucketpool_pk from bucketpool
where bucketpool_name='$DemoPoolName' limit 1";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
$row = pg_fetch_assoc($result);
$bucketpool_pk = $row['bucketpool_pk'];
pg_free_result($result);
/* Insert the bucket_def records */
$sql = "INSERT INTO bucketpool (bucketpool_name, version, active, description) VALUES ('$DemoPoolName', 1, 'Y', 'Demonstration of a very simple GPL/non-gpl bucket pool')";
$Columns = "bucket_name, bucket_color, bucket_reportorder, bucket_evalorder, bucketpool_fk, bucket_type, bucket_regex, stopon, applies_to";
$sql = "INSERT INTO bucket_def ($Columns) VALUES ('GPL Licenses (Demo)', 'orange', 50, 50, $bucketpool_pk, 3, '(affero|gpl)', 'N', 'f');
INSERT INTO bucket_def ($Columns) VALUES ('non-gpl (Demo)', 'yellow', 50, 1000, $bucketpool_pk, 99, NULL, 'N', 'f')";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
pg_free_result($result);
return(0);
} // Install()
/**
* \brief Customize submenus.
*/
function RegisterMenus()
{
// For all other menus, permit coming back here.
$URI = $this->Name . Traceback_parm_keep(array("format","page","upload","item","bp"));
$Item = GetParm("item",PARM_INTEGER);
$Upload = GetParm("upload",PARM_INTEGER);
$bucketpool_pk = GetParm("bp",PARM_INTEGER);
if (!empty($Item) && !empty($Upload))
{
if (GetParm("mod",PARM_STRING) == $this->Name)
{
menu_insert("Browse::Bucket Browser",1);
menu_insert("View::Bucket Browser",1);
//menu_insert("Browse::[BREAK]",100);
$text = _("Clear");
//menu_insert("Browse::Clear",101,NULL,NULL,NULL,"<a href='javascript:LicColor(\"\",\"\",\"\",\"\");'>$text</a>");
}
else
{
$text = _("Browse by buckets");
menu_insert("Browse::Bucket Browser",10,$URI,$text);
menu_insert("View::Bucket Browser",10,$URI,$text);
}
}
} // RegisterMenus()
/**
* \brief This is called before the plugin is used.
* It should assume that Install() was already run one time
* (possibly years ago and not during this object's creation).
*
* \return true on success, false on failure.
* A failed initialize is not used by the system.
* \note This function must NOT assume that other plugins are installed.
*/
function Initialize()
{
global $_GET;
if ($this->State != PLUGIN_STATE_INVALID) {
return(1);
} // don't re-run
if ($this->Name !== "") // Name must be defined
{
global $Plugins;
$this->State=PLUGIN_STATE_VALID;
array_push($Plugins,$this);
}
return($this->State == PLUGIN_STATE_VALID);
} // Initialize()
/**
* \brief Given an $Uploadtree_pk, display: \n
* (1) The histogram for the directory BY bucket. \n
* (2) The file listing for the directory.
*/
function ShowUploadHist($Uploadtree_pk,$Uri)
{
global $PG_CONN;
$VF=""; // return values for file listing
$VLic=""; // return values for output
$V=""; // total return value
$UniqueTagArray = array();
global $Plugins;
$ModLicView = &$Plugins[plugin_find_id("view-license")];
/******* Get Bucket names and counts ******/
/* Find lft and rgt bounds for this $Uploadtree_pk */
$sql = "SELECT lft,rgt,upload_fk FROM $this->uploadtree_tablename
WHERE uploadtree_pk = $Uploadtree_pk";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
if (pg_num_rows($result) < 1)
{
pg_free_result($result);
$text = _("Invalid URL, nonexistant item");
return "<h2>$text $Uploadtree_pk</h2>";
}
$row = pg_fetch_assoc($result);
$lft = $row["lft"];
$rgt = $row["rgt"];
$upload_pk = $row["upload_fk"];
pg_free_result($result);
/* Get the ars_pk of the scan to display, also the select list */
$ars_pk = GetArrayVal("ars", $_GET);
$BucketSelect = SelectBucketDataset($upload_pk, $ars_pk, "selectbdata",
"onchange=\"addArsGo('newds','selectbdata');\"");
if ($ars_pk == 0)
{
/* No bucket data for this upload */
return $BucketSelect;
}
/* Get scan keys */
$sql = "select agent_fk, nomosagent_fk, bucketpool_fk from bucket_ars where ars_pk=$ars_pk";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
$row = pg_fetch_assoc($result);
$bucketagent_pk = $row["agent_fk"];
$nomosagent_pk = $row["nomosagent_fk"];
$bucketpool_pk = $row["bucketpool_fk"];
pg_free_result($result);
/* Create bucketDefArray as individual query this is MUCH faster
than incorporating it with a join in the following queries.
*/
$bucketDefArray = initBucketDefArray($bucketpool_pk);
/*select all the buckets for entire tree for this bucketpool */
$sql = "SELECT distinct(bucket_fk) as bucket_pk,
count(bucket_fk) as bucketcount, bucket_reportorder
from bucket_file, bucket_def,
(SELECT distinct(pfile_fk) as PF from $this->uploadtree_tablename
where upload_fk=$upload_pk
and ((ufile_mode & (1<<28))=0)
and ((ufile_mode & (1<<29))=0)
and $this->uploadtree_tablename.lft BETWEEN $lft and $rgt) as SS
where PF=pfile_fk and agent_fk=$bucketagent_pk
and bucket_file.nomosagent_fk=$nomosagent_pk
and bucket_pk=bucket_fk
and bucketpool_fk=$bucketpool_pk
group by bucket_fk,bucket_reportorder
order by bucket_reportorder asc";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
$historows = pg_fetch_all($result);
pg_free_result($result);
/* Show dataset list */
if (!empty($BucketSelect))
{
$action = Traceback_uri() . "?mod=bucketbrowser&upload=$upload_pk&item=$Uploadtree_pk";
$VLic .= "<script type='text/javascript'>
function addArsGo(formid, selectid )
{
var selectobj = document.getElementById(selectid);
var ars_pk = selectobj.options[selectobj.selectedIndex].value;
document.getElementById(formid).action='$action'+'&ars='+ars_pk;
document.getElementById(formid).submit();
return;
}
</script>";
/* form to select new dataset (ars_pk) */
$VLic .= "<form action='$action' id='newds' method='POST'>\n";
$VLic .= $BucketSelect;
$VLic .= "</form>";
}
$sql = "select bucketpool_name, version from bucketpool where bucketpool_pk=$bucketpool_pk";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
$row = pg_fetch_assoc($result);
$bucketpool_name = $row['bucketpool_name'];
$bucketpool_version = $row['version'];
pg_free_result($result);
/* Write bucket histogram to $VLic */
$bucketcount = 0;
$Uniquebucketcount = 0;
$NoLicFound = 0;
if (is_array($historows))
{
$text = _("Bucket Pool");
$VLic .= "$text: $bucketpool_name v$bucketpool_version<br>";
$VLic .= "<table border=1 width='100%'>\n";
$text = _("Count");
$VLic .= "<tr><th width='10%'>$text</th>";
$text = _("Files");
$VLic .= "<th width='10%'>$text</th>";
$text = _("Bucket");
$VLic .= "<th align='left'>$text</th></tr>\n";
foreach($historows as $bucketrow)
{
$Uniquebucketcount++;
$bucket_pk = $bucketrow['bucket_pk'];
$bucketcount = $bucketrow['bucketcount'];
$bucket_name = $bucketDefArray[$bucket_pk]['bucket_name'];
$bucket_color = $bucketDefArray[$bucket_pk]['bucket_color'];
/* Count */
$VLic .= "<tr><td align='right' style='background-color:$bucket_color'>$bucketcount</td>";
/* Show */
$VLic .= "<td align='center'><a href='";
$VLic .= Traceback_uri();
$text = _("Show");
$VLic .= "?mod=list_bucket_files&bapk=$bucketagent_pk&item=$Uploadtree_pk&bpk=$bucket_pk&bp=$bucketpool_pk&napk=$nomosagent_pk" . "'>$text</a></td>";
/* Bucket name */
$VLic .= "<td align='left'>";
$VLic .= "<a id='$bucket_pk' onclick='FileColor_Get(\"" . Traceback_uri() . "?mod=ajax_filebucket&bapk=$bucketagent_pk&item=$Uploadtree_pk&bucket_pk=$bucket_pk\")'";
$VLic .= ">$bucket_name </a>";
/* Allow users to tag an entire bucket */
/* Future, maybe v 2.1
$TagHref = "<a href=" . Traceback_uri() . "?mod=bucketbrowser&upload=$upload_pk&item=$Uploadtree_pk&bapk=$bucketagent_pk&bpk=$bucket_pk&bp=$bucketpool_pk&napk=$nomosagent_pk&tagbucket=1>Tag</a>";
$VLic .= " [$TagHref]";
*/
$VLic .= "</td>";
$VLic .= "</tr>\n";
// if ($row['bucket_name'] == "No Buckets Found") $NoLicFound = $row['bucketcount'];
}
$VLic .= "</table>\n";
$VLic .= "<p>\n";
$text = _("Unique buckets");
$VLic .= "$text: $Uniquebucketcount<br>\n";
}
/******* File Listing ************/
/* Get ALL the items under this Uploadtree_pk */
$Children = GetNonArtifactChildren($Uploadtree_pk, $this->uploadtree_tablename);
if (count($Children) == 0)
{
$sql = "SELECT * FROM $this->uploadtree_tablename WHERE uploadtree_pk = '$Uploadtree_pk'";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
$row = pg_fetch_assoc($result);
pg_free_result($result);
if (empty($row) || (IsDir($row['ufile_mode']))) {
return;
}
// $ModLicView = &$Plugins[plugin_find_id("view-license")];
// return($ModLicView->Output() );
}
$ChildCount=0;
$Childbucketcount=0;
/* Countd disabled until we know we need them
$NumSrcPackages = 0;
$NumBinPackages = 0;
$NumBinNoSrcPackages = 0;
*/
/* get mimetypes for packages */
$MimetypeArray = GetPkgMimetypes();
$VF .= "<table border=0>";
foreach($Children as $C)
{
if (empty($C)) {
continue;
}
/* update package counts */
/* This is an expensive count. Comment out until we know we really need it
IncrSrcBinCounts($C, $MimetypeArray, $NumSrcPackages, $NumBinPackages, $NumBinNoSrcPackages);
*/
$IsDir = Isdir($C['ufile_mode']);
$IsContainer = Iscontainer($C['ufile_mode']);
/* Determine the hyperlink for non-containers to view-license */
if (!empty($C['pfile_fk']) && !empty($ModLicView))
{
$LinkUri = Traceback_uri();
$LinkUri .= "?mod=view-license&napk=$nomosagent_pk&bapk=$bucketagent_pk&upload=$upload_pk&item=$C[uploadtree_pk]";
}
else
{
$LinkUri = NULL;
}
/* Determine link for containers */
if (Iscontainer($C['ufile_mode']))
{
$uploadtree_pk = DirGetNonArtifact($C['uploadtree_pk'], $this->uploadtree_tablename);
$tmpuri = "?mod=" . $this->Name . Traceback_parm_keep(array("upload","folder","ars"));
$LicUri = "$tmpuri&item=" . $uploadtree_pk;
}
else
{
$LicUri = NULL;
}
/* Populate the output ($VF) - file list */
/* id of each element is its uploadtree_pk */
$VF .= "<tr><td id='$C[uploadtree_pk]' align='left'>";
$HasHref=0;
$HasBold=0;
if ($IsContainer)
{
$VF .= "<a href='$LicUri'>"; $HasHref=1;
$VF .= "<b>"; $HasBold=1;
}
else if (!empty($LinkUri))
{
$VF .= "<a href='$LinkUri'>"; $HasHref=1;
}
$VF .= $C['ufile_name'];
if ($IsDir) {
$VF .= "/";
};
if ($HasBold) {
$VF .= "</b>";
}
if ($HasHref) {
$VF .= "</a>";
}
/* print buckets */
$VF .= "<br>";
$VF .= "<span style='position:relative;left:1em'>";
/* get color coded string of bucket names */
$VF .= GetFileBuckets_string($nomosagent_pk, $bucketagent_pk, $C['uploadtree_pk'],
$bucketDefArray, ",", True);
$VF .= "</span>";
$VF .= "</td><td valign='top'>";
/* display item links */
$VF .= FileListLinks($C['upload_fk'], $C['uploadtree_pk'], $nomosagent_pk, $C['pfile_fk'], True, $UniqueTagArray, $this->uploadtree_tablename);
$VF .= "</td>";
$VF .= "</tr>\n";
$ChildCount++;
}
$VF .= "</table>\n";
$V .= ActiveHTTPscript("FileColor");
/* Add javascript for color highlighting
This is the response script needed by ActiveHTTPscript
responseText is bucket_pk',' followed by a comma seperated list of uploadtree_pk's */
$script = "
<script type=\"text/javascript\" charset=\"utf-8\">
var Lastutpks=''; /* save last list of uploadtree_pk's */
var Lastbupk=''; /* save last bucket_pk */
var color = '#4bfe78';
function FileColor_Reply()
{
if ((FileColor.readyState==4) && (FileColor.status==200))
{
/* remove previous highlighting */
var numpks = Lastutpks.length;
if (numpks > 0) document.getElementById(Lastbupk).style.backgroundColor='white';
while (numpks)
{
document.getElementById(Lastutpks[--numpks]).style.backgroundColor='white';
}
utpklist = FileColor.responseText.split(',');
Lastbupk = utpklist.shift();
numpks = utpklist.length;
Lastutpks = utpklist;
/* apply new highlighting */
elt = document.getElementById(Lastbupk);
if (elt != null) elt.style.backgroundColor=color;
while (numpks)
{
document.getElementById(utpklist[--numpks]).style.backgroundColor=color;
}
}
return;
}
</script>
";
$V .= $script;
/* Display source, binary, and binary missing source package counts */
/* Counts disabled above until we know we need these
$VLic .= "<ul>";
$text = _("source packages");
$VLic .= "<li> $NumSrcPackages $text";
$text = _("binary packages");
$VLic .= "<li> $NumBinPackages $text";
$text = _("binary packages with no source package");
$VLic .= "<li> $NumBinNoSrcPackages $text";
$VLic .= "</ul>";
*/
/* Combine VF and VLic */
$V .= "<table border=0 width='100%'>\n";
$V .= "<tr><td valign='top' width='50%'>$VLic</td><td valign='top'>$VF</td></tr>\n";
$V .= "</table>\n";
$V .= "<hr />\n";
return($V);
} // ShowUploadHist()
/**
* @brief tag a bucket
* @param $upload_pk
* @param $uploadtree_pk
* @param $bucketagent_pk
* @param $bucket_pk
* @param $bucketpool_pk
* @param $nomosagent_pk
**/
function TagBucket($upload_pk, $uploadtree_pk, $bucketagent_pk, $bucket_pk, $bucketpool_pk, $nomosagent_pk)
{
} // TagBucket()
/**
* \brief This function returns the scheduler status.
*/
public function Output()
{
$uTime = microtime(true);
$V="";
$Upload = GetParm("upload",PARM_INTEGER);
/** @var UploadDao $uploadDao */
$uploadDao = $GLOBALS['container']->get('dao.upload');
if ( !$uploadDao->isAccessible($Upload, Auth::getGroupId()) )
{
$text = _("Permission Denied");
return "<h2>$text</h2>";
}
$Item = GetParm("item",PARM_INTEGER);
if ( !$Item)
{
return _('No item selected');
}
$updcache = GetParm("updcache",PARM_INTEGER);
$tagbucket = GetParm("tagbucket",PARM_INTEGER);
$this->uploadtree_tablename = GetUploadtreeTableName($Upload);
/* Remove "updcache" from the GET args and set $this->UpdCache
* This way all the url's based on the input args won't be
* polluted with updcache
* Use Traceback_parm_keep to ensure that all parameters are in order
*/
$CacheKey = "?mod=" . $this->Name . Traceback_parm_keep(array("upload","item","folder","ars")) ;
if ($updcache)
{
$_SERVER['REQUEST_URI'] = preg_replace("/&updcache=[0-9]*/","",$_SERVER['REQUEST_URI']);
unset($_GET['updcache']);
$V = ReportCachePurgeByKey($CacheKey);
}
else
{
$V = ReportCacheGet($CacheKey);
}
if (!empty($tagbucket))
{
$bucketagent_pk = GetParm("bapk",PARM_INTEGER);
$bucket_pk = GetParm("bpk",PARM_INTEGER);
$bucketpool_pk = GetParm("bp",PARM_INTEGER);
$nomosagent_pk = GetParm("napk",PARM_INTEGER);
$this->TagBucket($Upload, $Item, $bucketagent_pk, $bucket_pk, $bucketpool_pk, $nomosagent_pk);
}
$Cached = !empty($V);
if(!$Cached)
{
$V .= "<font class='text'>\n";
$Children = GetNonArtifactChildren($Item, $this->uploadtree_tablename);
if (count($Children) == 0) // no children, display View micromenu
$V .= Dir2Browse($this->Name,$Item,NULL,1,"View", -1, '', '', $this->uploadtree_tablename) . "<P />\n";
else // has children, display Browse micormenu
$V .= Dir2Browse($this->Name,$Item,NULL,1,"Browse", -1, '', '', $this->uploadtree_tablename) . "<P />\n";
if (!empty($Upload))
{
$Uri = preg_replace("/&item=([0-9]*)/","",Traceback());
$V .= $this->ShowUploadHist($Item,$Uri);
}
$V .= "</font>\n";
$text = _("Loading...");
}
$Time = microtime(true) - $uTime; // convert usecs to secs
$text = _("Elapsed time: %.2f seconds");
$V .= sprintf( "<p><small>$text</small>", $Time);
if ($Cached){
$text = _("cached");
$text1 = _("Update");
echo " <i>$text</i> <a href=\"$_SERVER[REQUEST_URI]&updcache=1\"> $text1 </a>";
}
else if ($Time > 0.5)
{
ReportCachePut($CacheKey, $V);
}
return $V;
}
}
$NewPlugin = new ui_buckets;
$NewPlugin->Initialize();
| larainema/fossology | src/buckets/ui/ui-buckets.php | PHP | gpl-2.0 | 20,625 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package servicebus
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"context"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"github.com/Azure/go-autorest/tracing"
"net/http"
)
// QueuesClient is the client for the Queues methods of the Servicebus service.
type QueuesClient struct {
BaseClient
}
// NewQueuesClient creates an instance of the QueuesClient client.
func NewQueuesClient(subscriptionID string) QueuesClient {
return NewQueuesClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewQueuesClientWithBaseURI creates an instance of the QueuesClient client using a custom endpoint. Use this when
// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack).
func NewQueuesClientWithBaseURI(baseURI string, subscriptionID string) QueuesClient {
return QueuesClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// CreateOrUpdate creates or updates a Service Bus queue. This operation is idempotent.
// Parameters:
// resourceGroupName - name of the Resource group within the Azure subscription.
// namespaceName - the namespace name
// queueName - the queue name.
// parameters - parameters supplied to create or update a queue resource.
func (client QueuesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, parameters SBQueue) (result SBQueue, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.CreateOrUpdate")
defer func() {
sc := -1
if result.Response.Response != nil {
sc = result.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
{TargetValue: namespaceName,
Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil},
{Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}},
{TargetValue: queueName,
Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
return result, validation.NewError("servicebus.QueuesClient", "CreateOrUpdate", err.Error())
}
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, namespaceName, queueName, parameters)
if err != nil {
err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "CreateOrUpdate", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "CreateOrUpdate", resp, "Failure sending request")
return
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "CreateOrUpdate", resp, "Failure responding to request")
return
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client QueuesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, parameters SBQueue) (*http.Request, error) {
pathParameters := map[string]interface{}{
"namespaceName": autorest.Encode("path", namespaceName),
"queueName": autorest.Encode("path", queueName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2021-06-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
parameters.SystemData = nil
preparer := autorest.CreatePreparer(
autorest.AsContentType("application/json; charset=utf-8"),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error.
func (client QueuesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client QueuesClient) CreateOrUpdateResponder(resp *http.Response) (result SBQueue, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// CreateOrUpdateAuthorizationRule creates an authorization rule for a queue.
// Parameters:
// resourceGroupName - name of the Resource group within the Azure subscription.
// namespaceName - the namespace name
// queueName - the queue name.
// authorizationRuleName - the authorization rule name.
// parameters - the shared access authorization rule.
func (client QueuesClient) CreateOrUpdateAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string, parameters SBAuthorizationRule) (result SBAuthorizationRule, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.CreateOrUpdateAuthorizationRule")
defer func() {
sc := -1
if result.Response.Response != nil {
sc = result.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
{TargetValue: namespaceName,
Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil},
{Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}},
{TargetValue: queueName,
Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
{TargetValue: authorizationRuleName,
Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil},
{Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.SBAuthorizationRuleProperties", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.SBAuthorizationRuleProperties.Rights", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil {
return result, validation.NewError("servicebus.QueuesClient", "CreateOrUpdateAuthorizationRule", err.Error())
}
req, err := client.CreateOrUpdateAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, queueName, authorizationRuleName, parameters)
if err != nil {
err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "CreateOrUpdateAuthorizationRule", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrUpdateAuthorizationRuleSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure sending request")
return
}
result, err = client.CreateOrUpdateAuthorizationRuleResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "CreateOrUpdateAuthorizationRule", resp, "Failure responding to request")
return
}
return
}
// CreateOrUpdateAuthorizationRulePreparer prepares the CreateOrUpdateAuthorizationRule request.
func (client QueuesClient) CreateOrUpdateAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string, parameters SBAuthorizationRule) (*http.Request, error) {
pathParameters := map[string]interface{}{
"authorizationRuleName": autorest.Encode("path", authorizationRuleName),
"namespaceName": autorest.Encode("path", namespaceName),
"queueName": autorest.Encode("path", queueName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2021-06-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
parameters.SystemData = nil
preparer := autorest.CreatePreparer(
autorest.AsContentType("application/json; charset=utf-8"),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// CreateOrUpdateAuthorizationRuleSender sends the CreateOrUpdateAuthorizationRule request. The method will close the
// http.Response Body if it receives an error.
func (client QueuesClient) CreateOrUpdateAuthorizationRuleSender(req *http.Request) (*http.Response, error) {
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// CreateOrUpdateAuthorizationRuleResponder handles the response to the CreateOrUpdateAuthorizationRule request. The method always
// closes the http.Response Body.
func (client QueuesClient) CreateOrUpdateAuthorizationRuleResponder(resp *http.Response) (result SBAuthorizationRule, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Delete deletes a queue from the specified namespace in a resource group.
// Parameters:
// resourceGroupName - name of the Resource group within the Azure subscription.
// namespaceName - the namespace name
// queueName - the queue name.
func (client QueuesClient) Delete(ctx context.Context, resourceGroupName string, namespaceName string, queueName string) (result autorest.Response, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.Delete")
defer func() {
sc := -1
if result.Response != nil {
sc = result.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
{TargetValue: namespaceName,
Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil},
{Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}},
{TargetValue: queueName,
Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
return result, validation.NewError("servicebus.QueuesClient", "Delete", err.Error())
}
req, err := client.DeletePreparer(ctx, resourceGroupName, namespaceName, queueName)
if err != nil {
err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "Delete", resp, "Failure sending request")
return
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "Delete", resp, "Failure responding to request")
return
}
return
}
// DeletePreparer prepares the Delete request.
func (client QueuesClient) DeletePreparer(ctx context.Context, resourceGroupName string, namespaceName string, queueName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"namespaceName": autorest.Encode("path", namespaceName),
"queueName": autorest.Encode("path", queueName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2021-06-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client QueuesClient) DeleteSender(req *http.Request) (*http.Response, error) {
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body.
func (client QueuesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
return
}
// DeleteAuthorizationRule deletes a queue authorization rule.
// Parameters:
// resourceGroupName - name of the Resource group within the Azure subscription.
// namespaceName - the namespace name
// queueName - the queue name.
// authorizationRuleName - the authorization rule name.
func (client QueuesClient) DeleteAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (result autorest.Response, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.DeleteAuthorizationRule")
defer func() {
sc := -1
if result.Response != nil {
sc = result.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
{TargetValue: namespaceName,
Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil},
{Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}},
{TargetValue: queueName,
Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
{TargetValue: authorizationRuleName,
Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil},
{Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
return result, validation.NewError("servicebus.QueuesClient", "DeleteAuthorizationRule", err.Error())
}
req, err := client.DeleteAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, queueName, authorizationRuleName)
if err != nil {
err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "DeleteAuthorizationRule", nil, "Failure preparing request")
return
}
resp, err := client.DeleteAuthorizationRuleSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "DeleteAuthorizationRule", resp, "Failure sending request")
return
}
result, err = client.DeleteAuthorizationRuleResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "DeleteAuthorizationRule", resp, "Failure responding to request")
return
}
return
}
// DeleteAuthorizationRulePreparer prepares the DeleteAuthorizationRule request.
func (client QueuesClient) DeleteAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"authorizationRuleName": autorest.Encode("path", authorizationRuleName),
"namespaceName": autorest.Encode("path", namespaceName),
"queueName": autorest.Encode("path", queueName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2021-06-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// DeleteAuthorizationRuleSender sends the DeleteAuthorizationRule request. The method will close the
// http.Response Body if it receives an error.
func (client QueuesClient) DeleteAuthorizationRuleSender(req *http.Request) (*http.Response, error) {
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// DeleteAuthorizationRuleResponder handles the response to the DeleteAuthorizationRule request. The method always
// closes the http.Response Body.
func (client QueuesClient) DeleteAuthorizationRuleResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
return
}
// Get returns a description for the specified queue.
// Parameters:
// resourceGroupName - name of the Resource group within the Azure subscription.
// namespaceName - the namespace name
// queueName - the queue name.
func (client QueuesClient) Get(ctx context.Context, resourceGroupName string, namespaceName string, queueName string) (result SBQueue, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.Get")
defer func() {
sc := -1
if result.Response.Response != nil {
sc = result.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
{TargetValue: namespaceName,
Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil},
{Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}},
{TargetValue: queueName,
Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
return result, validation.NewError("servicebus.QueuesClient", "Get", err.Error())
}
req, err := client.GetPreparer(ctx, resourceGroupName, namespaceName, queueName)
if err != nil {
err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "Get", resp, "Failure responding to request")
return
}
return
}
// GetPreparer prepares the Get request.
func (client QueuesClient) GetPreparer(ctx context.Context, resourceGroupName string, namespaceName string, queueName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"namespaceName": autorest.Encode("path", namespaceName),
"queueName": autorest.Encode("path", queueName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2021-06-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client QueuesClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client QueuesClient) GetResponder(resp *http.Response) (result SBQueue, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// GetAuthorizationRule gets an authorization rule for a queue by rule name.
// Parameters:
// resourceGroupName - name of the Resource group within the Azure subscription.
// namespaceName - the namespace name
// queueName - the queue name.
// authorizationRuleName - the authorization rule name.
func (client QueuesClient) GetAuthorizationRule(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (result SBAuthorizationRule, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.GetAuthorizationRule")
defer func() {
sc := -1
if result.Response.Response != nil {
sc = result.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
{TargetValue: namespaceName,
Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil},
{Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}},
{TargetValue: queueName,
Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
{TargetValue: authorizationRuleName,
Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil},
{Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
return result, validation.NewError("servicebus.QueuesClient", "GetAuthorizationRule", err.Error())
}
req, err := client.GetAuthorizationRulePreparer(ctx, resourceGroupName, namespaceName, queueName, authorizationRuleName)
if err != nil {
err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "GetAuthorizationRule", nil, "Failure preparing request")
return
}
resp, err := client.GetAuthorizationRuleSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "GetAuthorizationRule", resp, "Failure sending request")
return
}
result, err = client.GetAuthorizationRuleResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "GetAuthorizationRule", resp, "Failure responding to request")
return
}
return
}
// GetAuthorizationRulePreparer prepares the GetAuthorizationRule request.
func (client QueuesClient) GetAuthorizationRulePreparer(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"authorizationRuleName": autorest.Encode("path", authorizationRuleName),
"namespaceName": autorest.Encode("path", namespaceName),
"queueName": autorest.Encode("path", queueName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2021-06-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// GetAuthorizationRuleSender sends the GetAuthorizationRule request. The method will close the
// http.Response Body if it receives an error.
func (client QueuesClient) GetAuthorizationRuleSender(req *http.Request) (*http.Response, error) {
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// GetAuthorizationRuleResponder handles the response to the GetAuthorizationRule request. The method always
// closes the http.Response Body.
func (client QueuesClient) GetAuthorizationRuleResponder(resp *http.Response) (result SBAuthorizationRule, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListAuthorizationRules gets all authorization rules for a queue.
// Parameters:
// resourceGroupName - name of the Resource group within the Azure subscription.
// namespaceName - the namespace name
// queueName - the queue name.
func (client QueuesClient) ListAuthorizationRules(ctx context.Context, resourceGroupName string, namespaceName string, queueName string) (result SBAuthorizationRuleListResultPage, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.ListAuthorizationRules")
defer func() {
sc := -1
if result.sarlr.Response.Response != nil {
sc = result.sarlr.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
{TargetValue: namespaceName,
Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil},
{Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}},
{TargetValue: queueName,
Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
return result, validation.NewError("servicebus.QueuesClient", "ListAuthorizationRules", err.Error())
}
result.fn = client.listAuthorizationRulesNextResults
req, err := client.ListAuthorizationRulesPreparer(ctx, resourceGroupName, namespaceName, queueName)
if err != nil {
err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAuthorizationRules", nil, "Failure preparing request")
return
}
resp, err := client.ListAuthorizationRulesSender(req)
if err != nil {
result.sarlr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAuthorizationRules", resp, "Failure sending request")
return
}
result.sarlr, err = client.ListAuthorizationRulesResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListAuthorizationRules", resp, "Failure responding to request")
return
}
if result.sarlr.hasNextLink() && result.sarlr.IsEmpty() {
err = result.NextWithContext(ctx)
return
}
return
}
// ListAuthorizationRulesPreparer prepares the ListAuthorizationRules request.
func (client QueuesClient) ListAuthorizationRulesPreparer(ctx context.Context, resourceGroupName string, namespaceName string, queueName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"namespaceName": autorest.Encode("path", namespaceName),
"queueName": autorest.Encode("path", queueName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2021-06-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// ListAuthorizationRulesSender sends the ListAuthorizationRules request. The method will close the
// http.Response Body if it receives an error.
func (client QueuesClient) ListAuthorizationRulesSender(req *http.Request) (*http.Response, error) {
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// ListAuthorizationRulesResponder handles the response to the ListAuthorizationRules request. The method always
// closes the http.Response Body.
func (client QueuesClient) ListAuthorizationRulesResponder(resp *http.Response) (result SBAuthorizationRuleListResult, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// listAuthorizationRulesNextResults retrieves the next set of results, if any.
func (client QueuesClient) listAuthorizationRulesNextResults(ctx context.Context, lastResults SBAuthorizationRuleListResult) (result SBAuthorizationRuleListResult, err error) {
req, err := lastResults.sBAuthorizationRuleListResultPreparer(ctx)
if err != nil {
return result, autorest.NewErrorWithError(err, "servicebus.QueuesClient", "listAuthorizationRulesNextResults", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListAuthorizationRulesSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "servicebus.QueuesClient", "listAuthorizationRulesNextResults", resp, "Failure sending next results request")
}
result, err = client.ListAuthorizationRulesResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "listAuthorizationRulesNextResults", resp, "Failure responding to next results request")
}
return
}
// ListAuthorizationRulesComplete enumerates all values, automatically crossing page boundaries as required.
func (client QueuesClient) ListAuthorizationRulesComplete(ctx context.Context, resourceGroupName string, namespaceName string, queueName string) (result SBAuthorizationRuleListResultIterator, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.ListAuthorizationRules")
defer func() {
sc := -1
if result.Response().Response.Response != nil {
sc = result.page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
result.page, err = client.ListAuthorizationRules(ctx, resourceGroupName, namespaceName, queueName)
return
}
// ListByNamespace gets the queues within a namespace.
// Parameters:
// resourceGroupName - name of the Resource group within the Azure subscription.
// namespaceName - the namespace name
// skip - skip is only used if a previous operation returned a partial result. If a previous response contains
// a nextLink element, the value of the nextLink element will include a skip parameter that specifies a
// starting point to use for subsequent calls.
// top - may be used to limit the number of results to the most recent N usageDetails.
func (client QueuesClient) ListByNamespace(ctx context.Context, resourceGroupName string, namespaceName string, skip *int32, top *int32) (result SBQueueListResultPage, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.ListByNamespace")
defer func() {
sc := -1
if result.sqlr.Response.Response != nil {
sc = result.sqlr.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
{TargetValue: namespaceName,
Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil},
{Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}},
{TargetValue: skip,
Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil},
{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil},
}}}},
{TargetValue: top,
Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil},
{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil},
}}}}}); err != nil {
return result, validation.NewError("servicebus.QueuesClient", "ListByNamespace", err.Error())
}
result.fn = client.listByNamespaceNextResults
req, err := client.ListByNamespacePreparer(ctx, resourceGroupName, namespaceName, skip, top)
if err != nil {
err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListByNamespace", nil, "Failure preparing request")
return
}
resp, err := client.ListByNamespaceSender(req)
if err != nil {
result.sqlr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListByNamespace", resp, "Failure sending request")
return
}
result.sqlr, err = client.ListByNamespaceResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListByNamespace", resp, "Failure responding to request")
return
}
if result.sqlr.hasNextLink() && result.sqlr.IsEmpty() {
err = result.NextWithContext(ctx)
return
}
return
}
// ListByNamespacePreparer prepares the ListByNamespace request.
func (client QueuesClient) ListByNamespacePreparer(ctx context.Context, resourceGroupName string, namespaceName string, skip *int32, top *int32) (*http.Request, error) {
pathParameters := map[string]interface{}{
"namespaceName": autorest.Encode("path", namespaceName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2021-06-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
if skip != nil {
queryParameters["$skip"] = autorest.Encode("query", *skip)
}
if top != nil {
queryParameters["$top"] = autorest.Encode("query", *top)
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// ListByNamespaceSender sends the ListByNamespace request. The method will close the
// http.Response Body if it receives an error.
func (client QueuesClient) ListByNamespaceSender(req *http.Request) (*http.Response, error) {
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// ListByNamespaceResponder handles the response to the ListByNamespace request. The method always
// closes the http.Response Body.
func (client QueuesClient) ListByNamespaceResponder(resp *http.Response) (result SBQueueListResult, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// listByNamespaceNextResults retrieves the next set of results, if any.
func (client QueuesClient) listByNamespaceNextResults(ctx context.Context, lastResults SBQueueListResult) (result SBQueueListResult, err error) {
req, err := lastResults.sBQueueListResultPreparer(ctx)
if err != nil {
return result, autorest.NewErrorWithError(err, "servicebus.QueuesClient", "listByNamespaceNextResults", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListByNamespaceSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "servicebus.QueuesClient", "listByNamespaceNextResults", resp, "Failure sending next results request")
}
result, err = client.ListByNamespaceResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "listByNamespaceNextResults", resp, "Failure responding to next results request")
}
return
}
// ListByNamespaceComplete enumerates all values, automatically crossing page boundaries as required.
func (client QueuesClient) ListByNamespaceComplete(ctx context.Context, resourceGroupName string, namespaceName string, skip *int32, top *int32) (result SBQueueListResultIterator, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.ListByNamespace")
defer func() {
sc := -1
if result.Response().Response.Response != nil {
sc = result.page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
result.page, err = client.ListByNamespace(ctx, resourceGroupName, namespaceName, skip, top)
return
}
// ListKeys primary and secondary connection strings to the queue.
// Parameters:
// resourceGroupName - name of the Resource group within the Azure subscription.
// namespaceName - the namespace name
// queueName - the queue name.
// authorizationRuleName - the authorization rule name.
func (client QueuesClient) ListKeys(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (result AccessKeys, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.ListKeys")
defer func() {
sc := -1
if result.Response.Response != nil {
sc = result.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
{TargetValue: namespaceName,
Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil},
{Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}},
{TargetValue: queueName,
Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
{TargetValue: authorizationRuleName,
Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil},
{Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
return result, validation.NewError("servicebus.QueuesClient", "ListKeys", err.Error())
}
req, err := client.ListKeysPreparer(ctx, resourceGroupName, namespaceName, queueName, authorizationRuleName)
if err != nil {
err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListKeys", nil, "Failure preparing request")
return
}
resp, err := client.ListKeysSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListKeys", resp, "Failure sending request")
return
}
result, err = client.ListKeysResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "ListKeys", resp, "Failure responding to request")
return
}
return
}
// ListKeysPreparer prepares the ListKeys request.
func (client QueuesClient) ListKeysPreparer(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"authorizationRuleName": autorest.Encode("path", authorizationRuleName),
"namespaceName": autorest.Encode("path", namespaceName),
"queueName": autorest.Encode("path", queueName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2021-06-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/ListKeys", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// ListKeysSender sends the ListKeys request. The method will close the
// http.Response Body if it receives an error.
func (client QueuesClient) ListKeysSender(req *http.Request) (*http.Response, error) {
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// ListKeysResponder handles the response to the ListKeys request. The method always
// closes the http.Response Body.
func (client QueuesClient) ListKeysResponder(resp *http.Response) (result AccessKeys, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// RegenerateKeys regenerates the primary or secondary connection strings to the queue.
// Parameters:
// resourceGroupName - name of the Resource group within the Azure subscription.
// namespaceName - the namespace name
// queueName - the queue name.
// authorizationRuleName - the authorization rule name.
// parameters - parameters supplied to regenerate the authorization rule.
func (client QueuesClient) RegenerateKeys(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string, parameters RegenerateAccessKeyParameters) (result AccessKeys, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/QueuesClient.RegenerateKeys")
defer func() {
sc := -1
if result.Response.Response != nil {
sc = result.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
{TargetValue: namespaceName,
Constraints: []validation.Constraint{{Target: "namespaceName", Name: validation.MaxLength, Rule: 50, Chain: nil},
{Target: "namespaceName", Name: validation.MinLength, Rule: 6, Chain: nil}}},
{TargetValue: queueName,
Constraints: []validation.Constraint{{Target: "queueName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
{TargetValue: authorizationRuleName,
Constraints: []validation.Constraint{{Target: "authorizationRuleName", Name: validation.MaxLength, Rule: 50, Chain: nil},
{Target: "authorizationRuleName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
return result, validation.NewError("servicebus.QueuesClient", "RegenerateKeys", err.Error())
}
req, err := client.RegenerateKeysPreparer(ctx, resourceGroupName, namespaceName, queueName, authorizationRuleName, parameters)
if err != nil {
err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "RegenerateKeys", nil, "Failure preparing request")
return
}
resp, err := client.RegenerateKeysSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "RegenerateKeys", resp, "Failure sending request")
return
}
result, err = client.RegenerateKeysResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicebus.QueuesClient", "RegenerateKeys", resp, "Failure responding to request")
return
}
return
}
// RegenerateKeysPreparer prepares the RegenerateKeys request.
func (client QueuesClient) RegenerateKeysPreparer(ctx context.Context, resourceGroupName string, namespaceName string, queueName string, authorizationRuleName string, parameters RegenerateAccessKeyParameters) (*http.Request, error) {
pathParameters := map[string]interface{}{
"authorizationRuleName": autorest.Encode("path", authorizationRuleName),
"namespaceName": autorest.Encode("path", namespaceName),
"queueName": autorest.Encode("path", queueName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2021-06-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsContentType("application/json; charset=utf-8"),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceBus/namespaces/{namespaceName}/queues/{queueName}/authorizationRules/{authorizationRuleName}/regenerateKeys", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// RegenerateKeysSender sends the RegenerateKeys request. The method will close the
// http.Response Body if it receives an error.
func (client QueuesClient) RegenerateKeysSender(req *http.Request) (*http.Response, error) {
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// RegenerateKeysResponder handles the response to the RegenerateKeys request. The method always
// closes the http.Response Body.
func (client QueuesClient) RegenerateKeysResponder(resp *http.Response) (result AccessKeys, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
| Azure/azure-sdk-for-go | services/preview/servicebus/mgmt/2021-06-01-preview/servicebus/queues.go | GO | mit | 49,392 | [
30522,
7427,
2326,
8286,
1013,
1013,
9385,
1006,
1039,
1007,
7513,
3840,
1012,
2035,
2916,
9235,
1012,
1013,
1013,
7000,
2104,
1996,
10210,
6105,
1012,
2156,
6105,
1012,
19067,
2102,
1999,
1996,
2622,
7117,
2005,
6105,
2592,
1012,
1013,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<div class="collapsibleregioninner" id="aera_core_competency_template_has_related_data_inner"><br/><div style="border:solid 1px #DEDEDE;background:#E2E0E0;
color:#222222;padding:4px;">Check if a template has related data</div><br/><br/><span style="color:#EA33A6">Arguments</span><br/><span style="font-size:80%"><b>id</b> (Required)<br/> The template id<br/><br/><div><div style="border:solid 1px #DEDEDE;background:#FFF1BC;color:#222222;padding:4px;"><pre><b>General structure</b><br/>
int <span style="color:#2A33A6"> <i>//The template id</i></span><br/>
</pre></div></div><div><div style="border:solid 1px #DEDEDE;background:#DFEEE7;color:#222222;padding:4px;"><pre><b>XML-RPC (PHP structure)</b><br/>
[id] => int
</pre></div></div><div><div style="border:solid 1px #DEDEDE;background:#FEEBE5;color:#222222;padding:4px;"><pre><b>REST (POST parameters)</b><br/>
id= int
</pre></div></div></span><br/><br/><span style="color:#EA33A6">Response</span><br/><span style="font-size:80%">True if the template has related data<br/><br/><div><div style="border:solid 1px #DEDEDE;background:#FFF1BC;color:#222222;padding:4px;"><pre><b>General structure</b><br/>
int <span style="color:#2A33A6"> <i>//True if the template has related data</i></span><br/>
</pre></div></div><div><div style="border:solid 1px #DEDEDE;background:#DFEEE7;color:#222222;padding:4px;"><pre><b>XML-RPC (PHP structure)</b><br/>
int
</pre></div></div><div><div style="border:solid 1px #DEDEDE;background:#FEEBE5;color:#222222;padding:4px;"><pre><b>REST</b><br/>
<?xml version="1.0" encoding="UTF-8" ?>
<RESPONSE>
<VALUE>int</VALUE>
</RESPONSE>
</pre></div></div></span><br/><br/><span style="color:#EA33A6">Error message</span><br/><br/><span style="font-size:80%"><div><div style="border:solid 1px #DEDEDE;background:#FEEBE5;color:#222222;padding:4px;"><pre><b>REST</b><br/>
<?xml version="1.0" encoding="UTF-8"?>
<EXCEPTION class="invalid_parameter_exception">
<MESSAGE>Invalid parameter value detected</MESSAGE>
<DEBUGINFO></DEBUGINFO>
</EXCEPTION>
</pre></div></div></span><br/><br/><span style="color:#EA33A6">Restricted to logged-in users<br/></span>Yes<br/><br/><span style="color:#EA33A6">Callable from AJAX<br/></span>Yes<br/><br/></div> | manly-man/moodle-destroyer-tools | docs/moodle_api_3.1/functions/core_competency_template_has_related_data.html | HTML | mit | 2,343 | [
30522,
1026,
4487,
2615,
2465,
1027,
1000,
8902,
2721,
4523,
7028,
23784,
23111,
2121,
1000,
8909,
1027,
1000,
29347,
2527,
1035,
4563,
1035,
5566,
9407,
1035,
23561,
1035,
2038,
1035,
3141,
1035,
2951,
1035,
5110,
1000,
1028,
1026,
7987,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!-- Mobile menu button. -->
<a href="/" id="js-mobile-menu" class="header-navigation__mobile-menu-link">MENU</a>
<!-- Main menu. -->
<nav role="navigation" class="header-navigation">
<ul id="js-navigation-menu" class="header-navigation__menu show">
{% for link in site.data.navigation %}
{% comment %} Assign active nav item class. {% endcomment %}
{% assign active-nav-item = nil %}
{% if (page.url contains link.url) or (link.title == "Blog" and page.path contains "_posts") %}
{% assign active-nav-item = ' header-navigation__active-nav-item' %}
{% endif %}
<li class="header-navigation__menu-link{{ active-nav-item }}">
<a href="{{ link.url }}">{{ link.title }}</a>
</li>
{% endfor %}
</ul>
</nav> | savaslabs/savaslabs.github.io | _includes/components/navigation--header.html | HTML | gpl-3.0 | 767 | [
30522,
1026,
999,
1011,
1011,
4684,
12183,
6462,
1012,
1011,
1011,
1028,
1026,
1037,
17850,
12879,
1027,
1000,
1013,
1000,
8909,
1027,
1000,
1046,
2015,
1011,
4684,
1011,
12183,
1000,
2465,
1027,
1000,
20346,
1011,
9163,
1035,
1035,
4684,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* 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 "bladerunner/script/scene_script.h"
namespace BladeRunner {
enum kRC03Loops {
kRC03LoopInshot = 0, // frames: 0 - 59
kRC03LoopMainLoop = 1 // frames: 60 - 120
};
void SceneScriptRC03::InitializeScene() {
if (Game_Flag_Query(kFlagRC01toRC03)) {
Setup_Scene_Information(298.0f, -4.0f, 405.0f, 800);
Game_Flag_Reset(kFlagRC01toRC03);
} else if (Game_Flag_Query(kFlagAR02toRC03)) {
Setup_Scene_Information(-469.0f, -4.0f, 279.0f, 250);
} else if (Game_Flag_Query(kFlagUG01toRC03)) {
Setup_Scene_Information(147.51f, -4.0f, 166.48f, 500);
if (!Game_Flag_Query(kFlagRC03UnlockedToUG01)) {
Game_Flag_Set(kFlagRC03UnlockedToUG01);
}
} else if (Game_Flag_Query(kFlagHC04toRC03)) {
Setup_Scene_Information(-487.0f, 1.0f, 116.0f, 400);
} else if (Game_Flag_Query(kFlagRC04toRC03)) {
Setup_Scene_Information(-22.0f, 1.0f, -63.0f, 400);
} else {
Setup_Scene_Information(0.0f, 0.0f, 0.0f, 0);
}
Scene_Exit_Add_2D_Exit(0, 610, 0, 639, 479, 1);
Scene_Exit_Add_2D_Exit(1, 0, 0, 30, 479, 3);
if (Game_Flag_Query(kFlagRC03UnlockedToUG01)) {
#if BLADERUNNER_ORIGINAL_BUGS
Scene_Exit_Add_2D_Exit(2, 524, 350, 573, 359, 2);
#else
// prevent Izo's corpse from blocking the exit hot-spot area
Scene_Exit_Add_2D_Exit(2, 524, 340, 573, 359, 2);
#endif // BLADERUNNER_ORIGINAL_BUGS
}
Scene_Exit_Add_2D_Exit(3, 85, 255, 112, 315, 0);
Scene_Exit_Add_2D_Exit(4, 428, 260, 453, 324, 0);
Ambient_Sounds_Add_Looping_Sound(kSfxCTRAIN1, 50, 0, 1);
Ambient_Sounds_Add_Sound(kSfxRCCARBY1, 5, 30, 40, 70, -100, 100, -101, -101, 0, 0);
Ambient_Sounds_Add_Sound(kSfxRCCARBY2, 5, 30, 40, 75, -100, 100, -101, -101, 0, 0);
Ambient_Sounds_Add_Sound(kSfxRCCARBY3, 5, 30, 40, 70, -100, 100, -101, -101, 0, 0);
Ambient_Sounds_Add_Speech_Sound(kActorBlimpGuy, 0, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1);
Ambient_Sounds_Add_Speech_Sound(kActorBlimpGuy, 20, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1);
Ambient_Sounds_Add_Speech_Sound(kActorBlimpGuy, 40, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1);
Ambient_Sounds_Add_Speech_Sound(kActorBlimpGuy, 50, 10, 260, 17, 24, -100, 100, -101, -101, 1, 1);
Ambient_Sounds_Add_Sound(kSfxSPIN2B, 60, 180, 16, 25, 0, 0, -101, -101, 0, 0);
Ambient_Sounds_Add_Sound(kSfxSPIN3A, 60, 180, 16, 25, 0, 0, -101, -101, 0, 0);
Ambient_Sounds_Add_Sound(kSfxTHNDER2, 60, 180, 50, 100, 0, 0, -101, -101, 0, 0);
Ambient_Sounds_Add_Sound(kSfxTHNDER3, 50, 180, 50, 100, 0, 0, -101, -101, 0, 0);
Ambient_Sounds_Add_Sound(kSfxTHNDER4, 50, 180, 50, 100, 0, 0, -101, -101, 0, 0);
Ambient_Sounds_Add_Sound(kSfx67_0470R, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0);
Ambient_Sounds_Add_Sound(kSfx67_0480R, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0);
Ambient_Sounds_Add_Sound(kSfx67_0500R, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0);
Ambient_Sounds_Add_Sound(kSfx67_0540R, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0);
Ambient_Sounds_Add_Sound(kSfx67_0560R, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0);
Ambient_Sounds_Add_Sound(kSfx67_0870R, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0);
Ambient_Sounds_Add_Sound(kSfx67_0900R, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0);
Ambient_Sounds_Add_Sound(kSfx67_0940R, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0);
Ambient_Sounds_Add_Sound(kSfx67_0960R, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0);
Ambient_Sounds_Add_Sound(kSfx67_1070R, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0);
Ambient_Sounds_Add_Sound(kSfx67_1080R, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0);
Ambient_Sounds_Add_Sound(kSfx67_1100R, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0);
Ambient_Sounds_Add_Sound(kSfx67_1140R, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0);
Ambient_Sounds_Add_Sound(kSfx67_1160R, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0);
if (Game_Flag_Query(kFlagHC04toRC03)
&& Actor_Query_Goal_Number(kActorIzo) != kGoalIzoWaitingAtRC03
) {
if (Random_Query(1, 3) == 1) {
// enhancement: don't always play this scene when exiting Hawker's Circle
Scene_Loop_Start_Special(kSceneLoopModeLoseControl, kRC03LoopInshot, false);
// Pause generic walkers while special loop is playing
// to prevent glitching over background (walkers coming from Hawker's Circle)
// This is done is a similar way to CT01
#if !BLADERUNNER_ORIGINAL_BUGS
Actor_Set_Goal_Number(kActorGenwalkerA, kGoalGenwalkerDefault);
Actor_Set_Goal_Number(kActorGenwalkerB, kGoalGenwalkerDefault);
Actor_Set_Goal_Number(kActorGenwalkerC, kGoalGenwalkerDefault);
Global_Variable_Set(kVariableGenericWalkerConfig, -1);
#endif // !BLADERUNNER_ORIGINAL_BUGS
}
}
Scene_Loop_Set_Default(kRC03LoopMainLoop);
}
void SceneScriptRC03::SceneLoaded() {
Obstacle_Object("Box-Streetlight01", true);
Obstacle_Object("Box-Streetlight02", true);
Obstacle_Object("Parking Meter 01", true);
Obstacle_Object("Parking Meter 02", true);
Obstacle_Object("Parking Meter 03", true);
Obstacle_Object("Trash can with fire", true);
Obstacle_Object("Baricade01", true);
Obstacle_Object("Foreground Junk01", true);
Obstacle_Object("Steam01", true);
Obstacle_Object("Steam02", true);
Obstacle_Object("Box-BBcolumn01", true);
Obstacle_Object("Box-BBcolumn02", true);
Obstacle_Object("Box-BBcolumn03", true);
Obstacle_Object("Box-BBcolumn04", true);
Obstacle_Object("Box-BBbuilding01", true);
Obstacle_Object("Box-BBbuilding02", true);
Obstacle_Object("Box-BBbuilding03", true);
Obstacle_Object("Box-BBbuilding04", true);
Unclickable_Object("BOX-BBBUILDING01");
Unclickable_Object("BOX-BBBUILDING02");
Unclickable_Object("BOX-BBBUILDING03");
Unclickable_Object("BOX-BBBUILDING04");
Unclickable_Object("BOX-STREETLIGHT01");
Unclickable_Object("BOX-STREETLIGHT02");
Unclickable_Object("BOX-BBCOLUMN01");
Unclickable_Object("BOX-BBCOLUMN02");
Unclickable_Object("BOX-BBCOLUMN03");
Unclickable_Object("BOX-BBCOLUMN04");
#if BLADERUNNER_ORIGINAL_BUGS
#else
Unclickable_Object("PARKING METER 01");
#endif // BLADERUNNER_ORIGINAL_BUGS
Unclickable_Object("PARKING METER 02");
Unclickable_Object("PARKING METER 03");
Unclickable_Object("TRASH CAN WITH FIRE");
Unclickable_Object("BARICADE01");
Unclickable_Object("FOREGROUND JUNK01");
}
bool SceneScriptRC03::MouseClick(int x, int y) {
return false;
}
bool SceneScriptRC03::ClickedOn3DObject(const char *objectName, bool a2) {
return false;
}
bool SceneScriptRC03::ClickedOnActor(int actorId) {
return false;
}
bool SceneScriptRC03::ClickedOnItem(int itemId, bool a2) {
return false;
}
bool SceneScriptRC03::ClickedOnExit(int exitId) {
if (exitId == 0) { // To Runciter's shop
if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 298.0f, -4.0f, 405.0f, 0, true, false, false)) {
if (Game_Flag_Query(kFlagRC04McCoyShotBob)) {
Game_Flag_Set(kFlagBulletBobDead);
}
Game_Flag_Set(kFlagRC03toRC01);
Set_Enter(kSetRC01, kSceneRC01);
#if BLADERUNNER_ORIGINAL_BUGS
Actor_Set_Goal_Number(kActorDektora, kGoalDektoraStartWalkingAround);
#else
// Restrict Dektora's "walking around" goal only in Chapter 2
// this is a bug fix for the case where Dektora's goal gets reset from kGoalDektoraGone in Chapter 4/5
if (Global_Variable_Query(kVariableChapter) == 2 ) {
Actor_Set_Goal_Number(kActorDektora, kGoalDektoraStartWalkingAround);
}
#endif // BLADERUNNER_ORIGINAL_BUGS
}
return true;
}
if (exitId == 1) { // to Animoid Row (Scorpion/Insect Lady)
if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -469.0f, -4.0f, 279.0f, 0, true, false, false)) {
if (Game_Flag_Query(kFlagRC04McCoyShotBob)) {
Game_Flag_Set(kFlagBulletBobDead);
}
Game_Flag_Set(kFlagRC03toAR02);
Game_Flag_Reset(kFlagMcCoyInRunciters);
Game_Flag_Set(kFlagMcCoyInAnimoidRow);
Set_Enter(kSetAR01_AR02, kSceneAR02);
}
return true;
}
if (exitId == 2) { // to sewers
if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 147.51f, -4.0f, 166.48f, 0, true, false, false)) {
Game_Flag_Set(kFlagRC03toUG01);
Game_Flag_Reset(kFlagMcCoyInRunciters);
Game_Flag_Set(kFlagMcCoyInUnderground);
if (Game_Flag_Query(kFlagRC04McCoyShotBob)) {
Game_Flag_Set(kFlagBulletBobDead);
}
Set_Enter(kSetUG01, kSceneUG01);
#if BLADERUNNER_ORIGINAL_BUGS
Actor_Set_Goal_Number(kActorDektora, kGoalDektoraStartWalkingAround);
#else
// Restrict Dektora's "walking around" goal only in Chapter 2
// this is a bug fix for the case where Dektora's goal gets reset from kGoalDektoraGone in Chapter 4/5
if (Global_Variable_Query(kVariableChapter) == 2 ) {
Actor_Set_Goal_Number(kActorDektora, kGoalDektoraStartWalkingAround);
}
#endif // BLADERUNNER_ORIGINAL_BUGS
}
return true;
}
if (exitId == 3) { // to Hawker's Circle (Mama Izabella's Kingston Kitchen)
if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -487.0f, 1.0f, 116.0f, 0, true, false, false)) {
Game_Flag_Set(kFlagRC03toHC04);
Game_Flag_Reset(kFlagMcCoyInRunciters);
Game_Flag_Set(kFlagMcCoyInHawkersCircle);
if (Game_Flag_Query(kFlagRC04McCoyShotBob)) {
Game_Flag_Set(kFlagBulletBobDead);
}
Set_Enter(kSetHC01_HC02_HC03_HC04, kSceneHC04);
#if BLADERUNNER_ORIGINAL_BUGS
Actor_Set_Goal_Number(kActorDektora, kGoalDektoraStartWalkingAround);
#else
// Restrict Dektora's "walking around" goal only in Chapter 2
// this is a bug fix for the case where Dektora's goal gets reset from kGoalDektoraGone in Chapter 4/5
if (Global_Variable_Query(kVariableChapter) == 2 ) {
Actor_Set_Goal_Number(kActorDektora, kGoalDektoraStartWalkingAround);
}
#endif // BLADERUNNER_ORIGINAL_BUGS
}
return true;
}
if (exitId == 4) { // To Bullet Bob's
if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -22.0f, 1.0f, -63.0f, 0, true, false, false)) {
if (Global_Variable_Query(kVariableChapter) == 3
|| Global_Variable_Query(kVariableChapter) == 5
|| Game_Flag_Query(kFlagBulletBobDead)
) {
Actor_Says(kActorMcCoy, 8522, 14);
} else {
Game_Flag_Set(kFlagRC03toRC04);
Set_Enter(kSetRC04, kSceneRC04);
}
}
return true;
}
return false;
}
bool SceneScriptRC03::ClickedOn2DRegion(int region) {
return false;
}
void SceneScriptRC03::SceneFrameAdvanced(int frame) {
if (frame == 1) {
Sound_Play(kSfxTRUCKBY1, Random_Query(33, 33), 100, -100, 50);
}
if (frame == 15) {
Sound_Play(kSfxCHEVBY1, Random_Query(50, 50), -100, 100, 50);
}
#if !BLADERUNNER_ORIGINAL_BUGS
if (frame == 59) {
// end of special loop
// Resume walkers
if (Global_Variable_Query(kVariableGenericWalkerConfig) < 0 ) {
Global_Variable_Set(kVariableGenericWalkerConfig, 2);
}
}
#endif // BLADERUNNER_ORIGINAL
}
void SceneScriptRC03::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) {
}
void SceneScriptRC03::talkWithSteele() {
Actor_Face_Actor(kActorSteele, kActorMcCoy, true);
Actor_Says(kActorSteele, 1820, 3);
Actor_Face_Actor(kActorMcCoy, kActorSteele, true);
Actor_Says(kActorMcCoy, 4815, 14);
Actor_Says(kActorSteele, 1830, 3);
Actor_Says(kActorSteele, 1840, 3);
Actor_Says(kActorMcCoy, 4820, 12);
Actor_Says(kActorSteele, 1850, 3);
Actor_Says(kActorSteele, 1950, 3);
Actor_Says(kActorMcCoy, 4835, 14);
Actor_Says(kActorSteele, 1960, 3);
Actor_Says(kActorSteele, 1980, 3);
Actor_Says(kActorMcCoy, 4840, 15);
Actor_Says(kActorSteele, 1990, 3);
Actor_Says(kActorSteele, 2000, 3);
}
void SceneScriptRC03::PlayerWalkedIn() {
if (Actor_Query_Goal_Number(kActorIzo) == kGoalIzoWaitingAtRC03) {
Scene_Exits_Disable();
if (Game_Flag_Query(kFlagUG01toRC03)) {
Player_Set_Combat_Mode(false);
Player_Loses_Control();
Actor_Set_At_XYZ(kActorMcCoy, 147.51f, -4.0f, 166.48f, 500);
Actor_Put_In_Set(kActorIzo, kSetRC03);
Actor_Set_At_XYZ(kActorIzo, 196.0f, -4.0f, 184.0f, 775);
Actor_Face_Actor(kActorIzo, kActorMcCoy, true);
Actor_Face_Actor(kActorMcCoy, kActorIzo, true);
Actor_Change_Animation_Mode(kActorIzo, kAnimationModeCombatIdle);
Actor_Says_With_Pause(kActorIzo, 630, 0.0f, -1); // TODO: A bug? why is animation mode set as -1? and why is "With_Pause" version used?
Actor_Says_With_Pause(kActorIzo, 640, 0.0f, -1); // TODO: A bug? why is animation mode set as -1? and why is "With_Pause" version used?
Actor_Says_With_Pause(kActorIzo, 650, 0.0f, -1); // TODO: A bug? why is animation mode set as -1? and why is "With_Pause" version used?
if (Game_Flag_Query(kFlagIzoIsReplicant) ) {
#if BLADERUNNER_ORIGINAL_BUGS
Actor_Set_Goal_Number(kActorSteele, kGoalSteeleApprehendIzo);
#else
// prevent re-apprehending of Izo
if (Actor_Query_Goal_Number(kActorIzo) != kGoalIzoDie
&& Actor_Query_Goal_Number(kActorIzo) != kGoalIzoDieHidden
&& Actor_Query_Goal_Number(kActorIzo) != kGoalIzoRC03RanAwayDone
&& Actor_Query_Goal_Number(kActorIzo) != kGoalIzoEscape
&& Actor_Query_Goal_Number(kActorSteele) != kGoalSteeleShootIzo
&& Actor_Query_Goal_Number(kActorSteele) != kGoalSteeleIzoBlockedByMcCoy
&& Actor_Query_Goal_Number(kActorSteele) != kGoalSteeleLeaveRC03
&& Actor_Query_Goal_Number(kActorSteele) != kGoalSteeleGoToPoliceStation
) {
Actor_Set_Goal_Number(kActorSteele, kGoalSteeleApprehendIzo);
}
#endif // BLADERUNNER_ORIGINAL_BUGS
}
Actor_Change_Animation_Mode(kActorMcCoy, kAnimationModeDodge);
Loop_Actor_Walk_To_XYZ(kActorIzo, 180.0f, -4.0f, 184.0f, 0, false, false, false);
Actor_Change_Animation_Mode(kActorIzo, kAnimationModeCombatAttack);
if (!Game_Flag_Query(kFlagIzoIsReplicant)) {
#if BLADERUNNER_ORIGINAL_BUGS
Actor_Set_Goal_Number(kActorSteele, kGoalSteeleApprehendIzo);
#else
// prevent re-apprehending of Izo
if (Actor_Query_Goal_Number(kActorIzo) != kGoalIzoGetArrested
&& Actor_Query_Goal_Number(kActorIzo) != kGoalIzoGotArrested
&& Actor_Query_Goal_Number(kActorIzo) != kGoalIzoRC03RanAwayDone
&& Actor_Query_Goal_Number(kActorIzo) != kGoalIzoEscape
&& Actor_Query_Goal_Number(kActorSteele) != kGoalSteeleApprehendIzo
&& Actor_Query_Goal_Number(kActorSteele) != kGoalSteeleArrestIzo
&& Actor_Query_Goal_Number(kActorSteele) != kGoalSteeleIzoBlockedByMcCoy
&& Actor_Query_Goal_Number(kActorSteele) != kGoalSteeleLeaveRC03
&& Actor_Query_Goal_Number(kActorSteele) != kGoalSteeleGoToPoliceStation
) {
Actor_Set_Goal_Number(kActorSteele, kGoalSteeleApprehendIzo);
}
#endif // BLADERUNNER_ORIGINAL_BUGS
}
Player_Gains_Control();
} else {
Actor_Put_In_Set(kActorIzo, kSetRC03);
Actor_Set_At_XYZ(kActorIzo, -226.0f, 1.72f, 86.0f, 0);
Actor_Set_Targetable(kActorIzo, true);
Actor_Set_Goal_Number(kActorIzo, kGoalIzoRC03Walk);
}
}
if (Actor_Query_Goal_Number(kActorIzo) == kGoalIzoEscape) {
Player_Loses_Control();
Actor_Set_Goal_Number(kActorSteele, 200);
Actor_Put_In_Set(kActorSteele, kSetRC03);
if (Game_Flag_Query(kFlagUG01toRC03)
|| Game_Flag_Query(kFlagRC04toRC03)
) {
Actor_Set_At_Waypoint(kActorSteele, 175, 0);
} else {
Actor_Set_At_Waypoint(kActorSteele, 203, 0);
}
talkWithSteele();
Async_Actor_Walk_To_Waypoint(kActorSteele, 174, 0, false);
Actor_Set_Goal_Number(kActorIzo, 200);
Player_Gains_Control();
}
Game_Flag_Reset(kFlagUG01toRC03);
Game_Flag_Reset(kFlagAR02toRC03);
Game_Flag_Reset(kFlagHC04toRC03);
Game_Flag_Reset(kFlagRC04toRC03);
if (Global_Variable_Query(kVariableChapter) == 1
|| Global_Variable_Query(kVariableChapter) == 2
) {
Actor_Set_Goal_Number(kActorDektora, kGoalDektoraStopWalkingAround);
}
}
void SceneScriptRC03::PlayerWalkedOut() {
if (Actor_Query_Goal_Number(kActorIzo) == kGoalIzoDie) {
Actor_Set_Goal_Number(kActorIzo, kGoalIzoDieHidden);
}
Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
Ambient_Sounds_Remove_All_Looping_Sounds(1);
}
void SceneScriptRC03::DialogueQueueFlushed(int a1) {
}
} // End of namespace BladeRunner
| somaen/scummvm | engines/bladerunner/script/scene/rc03.cpp | C++ | gpl-2.0 | 16,695 | [
30522,
1013,
1008,
8040,
2819,
2213,
2615,
2213,
1011,
8425,
6172,
3194,
1008,
1008,
8040,
2819,
2213,
2615,
2213,
2003,
1996,
3423,
3200,
1997,
2049,
9797,
1010,
3005,
3415,
1008,
2024,
2205,
3365,
2000,
2862,
2182,
1012,
3531,
6523,
200... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.bruce.android.knowledge.custom_view.scanAnimation;
/**
* @author zhenghao.qi
* @version 1.0
* @time 2015年11月09日14:45:32
*/
public class ScanAnimaitonStrategy implements IAnimationStrategy {
/**
* 起始X坐标
*/
private int startX;
/**
* 起始Y坐标
*/
private int startY;
/**
* 起始点到终点的Y轴位移。
*/
private int shift;
/**
* X Y坐标。
*/
private double currentX, currentY;
/**
* 动画开始时间。
*/
private long startTime;
/**
* 循环时间
*/
private long cyclePeriod;
/**
* 动画正在进行时值为true,反之为false。
*/
private boolean doing;
/**
* 进行动画展示的view
*/
private AnimationSurfaceView animationSurfaceView;
public ScanAnimaitonStrategy(AnimationSurfaceView animationSurfaceView, int shift, long cyclePeriod) {
this.animationSurfaceView = animationSurfaceView;
this.shift = shift;
this.cyclePeriod = cyclePeriod;
initParams();
}
public void start() {
startTime = System.currentTimeMillis();
doing = true;
}
/**
* 设置起始位置坐标
*/
private void initParams() {
int[] position = new int[2];
animationSurfaceView.getLocationInWindow(position);
this.startX = position[0];
this.startY = position[1];
}
/**
* 根据当前时间计算小球的X/Y坐标。
*/
public void compute() {
long intervalTime = (System.currentTimeMillis() - startTime) % cyclePeriod;
double angle = Math.toRadians(360 * 1.0d * intervalTime / cyclePeriod);
int y = (int) (shift / 2 * Math.cos(angle));
y = Math.abs(y - shift/2);
currentY = startY + y;
doing = true;
}
@Override
public boolean doing() {
return doing;
}
public double getX() {
return currentX;
}
public double getY() {
return currentY;
}
public void cancel() {
doing = false;
}
} | qizhenghao/Hello_Android | app/src/main/java/com/bruce/android/knowledge/custom_view/scanAnimation/ScanAnimaitonStrategy.java | Java | gpl-3.0 | 2,115 | [
30522,
7427,
4012,
1012,
5503,
1012,
11924,
1012,
3716,
1012,
7661,
1035,
3193,
1012,
13594,
7088,
28649,
1025,
1013,
1008,
1008,
1008,
1030,
3166,
20985,
3270,
2080,
1012,
18816,
1008,
1030,
2544,
1015,
1012,
1014,
1008,
1030,
2051,
2325,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Karoliina T. Salminen <karoliina.t.salminen@nokia.com>
**
** This file is part of duicontrolpanel.
**
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#include <QObject>
#include <QGraphicsSceneMouseEvent>
#include <QSignalSpy>
#include <dcpwidget.h>
#include <dcpwidget_p.h>
#include "ut_dcpwidget.h"
void Ut_DcpWidget::init()
{
m_subject = new DcpWidget();
}
void Ut_DcpWidget::cleanup()
{
delete m_subject;
m_subject = 0;
}
void Ut_DcpWidget::initTestCase()
{
}
void Ut_DcpWidget::cleanupTestCase()
{
}
void Ut_DcpWidget::testCreation()
{
QVERIFY(m_subject);
}
void Ut_DcpWidget::testWidgetId()
{
QCOMPARE(m_subject->d_ptr->m_WidgetId, -1);
QVERIFY(m_subject->setWidgetId(1));
QCOMPARE(m_subject->d_ptr->m_WidgetId, 1);
QCOMPARE(m_subject->getWidgetId(), 1);
QVERIFY(!m_subject->setWidgetId(10)); // already set
}
void Ut_DcpWidget::testBack()
{
QVERIFY(m_subject->back()); // default behaviour
}
void Ut_DcpWidget::testPagePans()
{
QVERIFY(m_subject->pagePans()); // default behaviour
}
void Ut_DcpWidget::testProgressIndicator()
{
// default value:
QVERIFY(!m_subject->isProgressIndicatorVisible());
QSignalSpy spy (m_subject, SIGNAL(inProgress(bool)));
// show it:
m_subject->setProgressIndicatorVisible(true);
QVERIFY(m_subject->isProgressIndicatorVisible());
QCOMPARE(spy.count(), 1);
QVERIFY(spy.takeFirst().at(0).toBool());
// hide it:
m_subject->setProgressIndicatorVisible(false);
QVERIFY(!m_subject->isProgressIndicatorVisible());
QCOMPARE(spy.count(), 1);
QVERIFY(!spy.takeFirst().at(0).toBool());
}
QTEST_APPLESS_MAIN(Ut_DcpWidget)
| dudochkin-victor/touch-controlpanel | lib/tests/ut_dcpwidget/ut_dcpwidget.cpp | C++ | lgpl-2.1 | 2,162 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Models in TimeAlign
## Annotations

### Label System
TimeAlign was orignially built around the concept of tense annotation. This is why the `Tense` model exists, and why every annotation has a foreign-key field that may refer to a tense. At a later stage of development, support was added for a more flexible annotation scheme based on generic labels. Under that new scheme, each annotation (or fragment) may be linked with multiple labels, and it is the reponsiblity of the corpus admin to define what set of labels may be provided by annotators.
The labeling scheme is modeled as follows:
- Each corpus (`Corpus`) is linked to a set of label keys (`LabelKey`) which have descriptive names.
- Each label key is linked to multiple labels (`Label`), however each label may only be linked to one parent label key.
- A label may have a custom color defined.
- A label **key** may be configured in 'open set' mode - this means annotators are allowed to create new labels during annotation. The alternative is limiting annotators to use only labels pre-defined by the admin.
- A label **key** may be designated as language-specific, which means each label belonging to that key is assigned to a specific language and may only be used to annotate fragments of that language.
#### Implementation details
In the code, both the `Annotation` and `Fragment` model classes extend the `HasLabelsMixin`. The mixin provides the `get_labels()` method that is used throughout the code to access labels in one of two forms:
1. A comma-separated list of labels in a string, used when displaying labels to the user.
1. A tuple of label identifier strings, where each identifier has the form `'Label:1'`, where 1 is the database id of the label. This format is used for running scenarios and saving results.
## Selections

## Stats

# Generating model diagrams (ERD)
Models generated using the `graph_models` command in [Django-extensions](http://django-extensions.readthedocs.io/en/latest/graph_models.html), using the following commands:
sudo apt-get install graphviz libgraphviz-dev pkg-config
pip install django-extensions pygraphviz
# add 'django_extensions' to INSTALLED_APPS in settings.py
python manage.py graph_models annotations -o annotations.png
python manage.py graph_models selections -o selections.png
python manage.py graph_models stats -o stats.png
| UUDigitalHumanitieslab/timealign | doc/models/README.md | Markdown | mit | 2,434 | [
30522,
1001,
4275,
1999,
2051,
11475,
16206,
1001,
1001,
5754,
17287,
9285,
999,
1031,
1033,
1006,
5754,
17287,
9285,
1012,
1052,
3070,
1007,
1001,
1001,
1001,
3830,
2291,
2051,
11475,
16206,
2001,
2030,
23773,
4818,
2135,
2328,
2105,
1996,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
require 'spec_helper'
describe 'update' do
before { load_simple_document }
before { 2.times { SimpleDocument.create(:field1 => 10, :field2 => [10, 10]) } }
context 'when passing a hash of attributes' do
it 'updates documents' do
SimpleDocument.update_all(:field1 => 2)['replaced'].should == 2
SimpleDocument.where(:field1 => 2).count.should == 2
end
it 'replaces documents' do
doc = SimpleDocument.first
SimpleDocument.all.limit(1).replace_all(doc.attributes.merge('field1' => 2))['replaced'].should == 1
SimpleDocument.where(:field1 => 2).count.should == 1
end
end
context 'when passing a block' do
it 'updates documents' do
res = SimpleDocument.update_all { |doc| {:field1 => doc[:field1] * 2} }
res['replaced'].should == 2
SimpleDocument.where(:field1 => 20).count.should == 2
end
end
context 'when using multi index' do
before { SimpleDocument.index :field2, :multi => true }
before { NoBrainer.sync_indexes }
after { NoBrainer.drop! }
before { NoBrainer.logger.level = Logger::FATAL }
it 'deletes documents' do
SimpleDocument.where(:field2.any => 10).update_all({:field1 => 1})
SimpleDocument.where(:field1 => 1).count.should == 2
expect { SimpleDocument.where(:field2.any => 10).update_all { |doc| {:field1 => doc[:field1] + 1 } } }
.to raise_error(NoBrainer::Error::DocumentNotPersisted, /Expected type SELECTION but found DATUM/)
end
end
end
| pap/nobrainer | spec/integration/criteria/update_spec.rb | Ruby | lgpl-3.0 | 1,498 | [
30522,
5478,
1005,
28699,
1035,
2393,
2121,
1005,
6235,
1005,
10651,
1005,
2079,
2077,
1063,
7170,
1035,
3722,
1035,
6254,
1065,
2077,
1063,
1016,
1012,
2335,
1063,
3722,
3527,
24894,
4765,
1012,
3443,
1006,
1024,
2492,
2487,
1027,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jsonp({"cep":"17603030","logradouro":"Rua Boror\u00f3s","bairro":"Vila Tup\u00e3 Mirim I","cidade":"Tup\u00e3","uf":"SP","estado":"S\u00e3o Paulo"});
| lfreneda/cepdb | api/v1/17603030.jsonp.js | JavaScript | cc0-1.0 | 150 | [
30522,
1046,
3385,
2361,
1006,
1063,
1000,
8292,
2361,
1000,
1024,
1000,
19096,
14142,
14142,
1000,
1010,
1000,
8833,
12173,
8162,
2080,
1000,
1024,
1000,
21766,
2050,
8945,
29165,
1032,
1057,
8889,
2546,
2509,
2015,
1000,
1010,
1000,
21790... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# daflt.github.io
| daflt/daflt.github.io | README.md | Markdown | gpl-2.0 | 18 | [
30522,
1001,
4830,
10258,
2102,
1012,
21025,
2705,
12083,
1012,
22834,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# grunt-svgatlas
A simple task to pack multiple svg file into one binary packed svg file.
## Installation
$ sudo npm install grunt-svgatlas --save-dev
## Usage
grunt.initConfig({
svgatlas:
{
main:{
dst:'resources/atlas/atlas',
src:['resources/svg/*.svg'],
png:true,
prettify:true
}
}
});
// load task.
grunt.loadNpmTasks('grunt-svgatlas');
# Options
* dst: Destination filename without extension
* src: Source svg's to be included
* png: If true, also generates a png version of the spritesheet
* prettify: if true .json output will be prettified | xperiments/grunt-svgatlas | README.md | Markdown | mit | 687 | [
30522,
1001,
20696,
1011,
17917,
20697,
8523,
1037,
3722,
4708,
2000,
5308,
3674,
17917,
2290,
5371,
2046,
2028,
12441,
8966,
17917,
2290,
5371,
1012,
1001,
1001,
8272,
1002,
19219,
2080,
27937,
2213,
16500,
20696,
1011,
17917,
20697,
8523,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package arez;
import java.text.ParseException;
import org.realityforge.guiceyloops.shared.ValueUtil;
import org.testng.annotations.Test;
import static org.testng.Assert.*;
public final class ZoneTest
extends AbstractTest
{
@Test
public void zone_safeRun_Function()
{
ArezTestUtil.enableZones();
final Zone zone1 = Arez.createZone();
assertEquals( ZoneHolder.getDefaultZone().getContext(), Arez.context() );
assertEquals( ZoneHolder.getZoneStack().size(), 0 );
assertFalse( zone1.isActive() );
final String expected = ValueUtil.randomString();
final String actual = zone1.safeRun( () -> {
assertEquals( zone1.getContext(), Arez.context() );
assertEquals( ZoneHolder.getZoneStack().size(), 1 );
assertTrue( zone1.isActive() );
return expected;
} );
assertEquals( actual, expected );
assertEquals( ZoneHolder.getDefaultZone().getContext(), Arez.context() );
assertEquals( ZoneHolder.getZoneStack().size(), 0 );
}
@Test
public void zone_safeRun_Procedure()
{
ArezTestUtil.enableZones();
final Zone zone1 = Arez.createZone();
assertEquals( ZoneHolder.getDefaultZone().getContext(), Arez.context() );
assertEquals( ZoneHolder.getZoneStack().size(), 0 );
assertFalse( zone1.isActive() );
zone1.safeRun( () -> {
assertEquals( zone1.getContext(), Arez.context() );
assertEquals( ZoneHolder.getZoneStack().size(), 1 );
assertTrue( zone1.isActive() );
} );
assertEquals( ZoneHolder.getDefaultZone().getContext(), Arez.context() );
assertEquals( ZoneHolder.getZoneStack().size(), 0 );
}
@Test
public void zone_run_Function_throwsException()
{
ArezTestUtil.enableZones();
final Zone zone1 = Arez.createZone();
assertEquals( ZoneHolder.getDefaultZone().getContext(), Arez.context() );
assertEquals( ZoneHolder.getZoneStack().size(), 0 );
assertFalse( zone1.isActive() );
assertThrows( ParseException.class, () -> zone1.run( () -> {
assertEquals( zone1.getContext(), Arez.context() );
assertEquals( ZoneHolder.getZoneStack().size(), 1 );
assertTrue( zone1.isActive() );
throw new ParseException( "", 1 );
} ) );
assertEquals( ZoneHolder.getDefaultZone().getContext(), Arez.context() );
assertEquals( ZoneHolder.getZoneStack().size(), 0 );
}
@Test
public void zone_run_Procedure_throwsException()
{
ArezTestUtil.enableZones();
final Zone zone1 = Arez.createZone();
assertEquals( ZoneHolder.getDefaultZone().getContext(), Arez.context() );
assertEquals( ZoneHolder.getZoneStack().size(), 0 );
assertFalse( zone1.isActive() );
final Procedure procedure = () -> {
assertEquals( zone1.getContext(), Arez.context() );
assertEquals( ZoneHolder.getZoneStack().size(), 1 );
assertTrue( zone1.isActive() );
throw new ParseException( "", 1 );
};
assertThrows( ParseException.class, () -> zone1.run( procedure ) );
assertEquals( ZoneHolder.getDefaultZone().getContext(), Arez.context() );
assertEquals( ZoneHolder.getZoneStack().size(), 0 );
}
@Test
public void zone_run_Procedure_completesNormally()
throws Throwable
{
ArezTestUtil.enableZones();
final Zone zone1 = Arez.createZone();
assertEquals( ZoneHolder.getDefaultZone().getContext(), Arez.context() );
assertEquals( ZoneHolder.getZoneStack().size(), 0 );
assertFalse( zone1.isActive() );
final Procedure procedure = () -> {
assertEquals( zone1.getContext(), Arez.context() );
assertEquals( ZoneHolder.getZoneStack().size(), 1 );
assertTrue( zone1.isActive() );
};
zone1.run( procedure );
assertEquals( ZoneHolder.getDefaultZone().getContext(), Arez.context() );
assertEquals( ZoneHolder.getZoneStack().size(), 0 );
}
}
| realityforge/arez | core/src/test/java/arez/ZoneTest.java | Java | apache-2.0 | 3,827 | [
30522,
7427,
2024,
2480,
1025,
12324,
9262,
1012,
3793,
1012,
11968,
19763,
2595,
24422,
1025,
12324,
8917,
1012,
4507,
29278,
3351,
1012,
26458,
25810,
4135,
11923,
1012,
4207,
1012,
3643,
21823,
2140,
1025,
12324,
8917,
1012,
3231,
3070,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package container
import (
"context"
"fmt"
"io"
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/client"
"github.com/moby/sys/signal"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
type attachOptions struct {
noStdin bool
proxy bool
detachKeys string
container string
}
func inspectContainerAndCheckState(ctx context.Context, cli client.APIClient, args string) (*types.ContainerJSON, error) {
c, err := cli.ContainerInspect(ctx, args)
if err != nil {
return nil, err
}
if !c.State.Running {
return nil, errors.New("You cannot attach to a stopped container, start it first")
}
if c.State.Paused {
return nil, errors.New("You cannot attach to a paused container, unpause it first")
}
if c.State.Restarting {
return nil, errors.New("You cannot attach to a restarting container, wait until it is running")
}
return &c, nil
}
// NewAttachCommand creates a new cobra.Command for `docker attach`
func NewAttachCommand(dockerCli command.Cli) *cobra.Command {
var opts attachOptions
cmd := &cobra.Command{
Use: "attach [OPTIONS] CONTAINER",
Short: "Attach local standard input, output, and error streams to a running container",
Args: cli.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
opts.container = args[0]
return runAttach(dockerCli, &opts)
},
}
flags := cmd.Flags()
flags.BoolVar(&opts.noStdin, "no-stdin", false, "Do not attach STDIN")
flags.BoolVar(&opts.proxy, "sig-proxy", true, "Proxy all received signals to the process")
flags.StringVar(&opts.detachKeys, "detach-keys", "", "Override the key sequence for detaching a container")
return cmd
}
func runAttach(dockerCli command.Cli, opts *attachOptions) error {
ctx := context.Background()
client := dockerCli.Client()
// request channel to wait for client
resultC, errC := client.ContainerWait(ctx, opts.container, "")
c, err := inspectContainerAndCheckState(ctx, client, opts.container)
if err != nil {
return err
}
if err := dockerCli.In().CheckTty(!opts.noStdin, c.Config.Tty); err != nil {
return err
}
if opts.detachKeys != "" {
dockerCli.ConfigFile().DetachKeys = opts.detachKeys
}
options := types.ContainerAttachOptions{
Stream: true,
Stdin: !opts.noStdin && c.Config.OpenStdin,
Stdout: true,
Stderr: true,
DetachKeys: dockerCli.ConfigFile().DetachKeys,
}
var in io.ReadCloser
if options.Stdin {
in = dockerCli.In()
}
if opts.proxy && !c.Config.Tty {
sigc := notifyAllSignals()
go ForwardAllSignals(ctx, dockerCli, opts.container, sigc)
defer signal.StopCatch(sigc)
}
resp, errAttach := client.ContainerAttach(ctx, opts.container, options)
if errAttach != nil {
return errAttach
}
defer resp.Close()
// If use docker attach command to attach to a stop container, it will return
// "You cannot attach to a stopped container" error, it's ok, but when
// attach to a running container, it(docker attach) use inspect to check
// the container's state, if it pass the state check on the client side,
// and then the container is stopped, docker attach command still attach to
// the container and not exit.
//
// Recheck the container's state to avoid attach block.
_, err = inspectContainerAndCheckState(ctx, client, opts.container)
if err != nil {
return err
}
if c.Config.Tty && dockerCli.Out().IsTerminal() {
resizeTTY(ctx, dockerCli, opts.container)
}
streamer := hijackedIOStreamer{
streams: dockerCli,
inputStream: in,
outputStream: dockerCli.Out(),
errorStream: dockerCli.Err(),
resp: resp,
tty: c.Config.Tty,
detachKeys: options.DetachKeys,
}
if err := streamer.stream(ctx); err != nil {
return err
}
return getExitStatus(errC, resultC)
}
func getExitStatus(errC <-chan error, resultC <-chan container.ContainerWaitOKBody) error {
select {
case result := <-resultC:
if result.Error != nil {
return fmt.Errorf(result.Error.Message)
}
if result.StatusCode != 0 {
return cli.StatusError{StatusCode: int(result.StatusCode)}
}
case err := <-errC:
return err
}
return nil
}
func resizeTTY(ctx context.Context, dockerCli command.Cli, containerID string) {
height, width := dockerCli.Out().GetTtySize()
// To handle the case where a user repeatedly attaches/detaches without resizing their
// terminal, the only way to get the shell prompt to display for attaches 2+ is to artificially
// resize it, then go back to normal. Without this, every attach after the first will
// require the user to manually resize or hit enter.
resizeTtyTo(ctx, dockerCli.Client(), containerID, height+1, width+1, false)
// After the above resizing occurs, the call to MonitorTtySize below will handle resetting back
// to the actual size.
if err := MonitorTtySize(ctx, dockerCli, containerID, false); err != nil {
logrus.Debugf("Error monitoring TTY size: %s", err)
}
}
| thaJeztah/cli | cli/command/container/attach.go | GO | apache-2.0 | 5,044 | [
30522,
7427,
11661,
12324,
1006,
1000,
6123,
1000,
1000,
4718,
2102,
1000,
1000,
22834,
1000,
1000,
21025,
2705,
12083,
1012,
4012,
1013,
8946,
2121,
1013,
18856,
2072,
1013,
18856,
2072,
1000,
1000,
21025,
2705,
12083,
1012,
4012,
1013,
89... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import { createEntityAdapter, EntityAdapter, EntityState } from '@ngrx/entity';
import { Book } from '../models/book';
import {
BooksApiActionsUnion,
BooksApiActionTypes,
} from '../actions/books-api.actions';
import { BookActionsUnion, BookActionTypes } from '../actions/book.actions';
import {
ViewBookPageActionsUnion,
ViewBookPageActionTypes,
} from '../actions/view-book-page.actions';
import {
CollectionApiActionsUnion,
CollectionApiActionTypes,
} from '../actions/collection-api.actions';
/**
* @ngrx/entity provides a predefined interface for handling
* a structured dictionary of records. This interface
* includes an array of ids, and a dictionary of the provided
* model type by id. This interface is extended to include
* any additional interface properties.
*/
export interface State extends EntityState<Book> {
selectedBookId: string | null;
}
/**
* createEntityAdapter creates an object of many helper
* functions for single or multiple operations
* against the dictionary of records. The configuration
* object takes a record id selector function and
* a sortComparer option which is set to a compare
* function if the records are to be sorted.
*/
export const adapter: EntityAdapter<Book> = createEntityAdapter<Book>({
selectId: (book: Book) => book.id,
sortComparer: false,
});
/**
* getInitialState returns the default initial state
* for the generated entity state. Initial state
* additional properties can also be defined.
*/
export const initialState: State = adapter.getInitialState({
selectedBookId: null,
});
export function reducer(
state = initialState,
action:
| BooksApiActionsUnion
| BookActionsUnion
| ViewBookPageActionsUnion
| CollectionApiActionsUnion
): State {
switch (action.type) {
case BooksApiActionTypes.SearchSuccess:
case CollectionApiActionTypes.LoadBooksSuccess: {
/**
* The addMany function provided by the created adapter
* adds many records to the entity dictionary
* and returns a new state including those records. If
* the collection is to be sorted, the adapter will
* sort each record upon entry into the sorted array.
*/
return adapter.addMany(action.payload, state);
}
case BookActionTypes.LoadBook: {
/**
* The addOne function provided by the created adapter
* adds one record to the entity dictionary
* and returns a new state including that records if it doesn't
* exist already. If the collection is to be sorted, the adapter will
* insert the new record into the sorted array.
*/
return adapter.addOne(action.payload, state);
}
case ViewBookPageActionTypes.SelectBook: {
return {
...state,
selectedBookId: action.payload,
};
}
default: {
return state;
}
}
}
/**
* Because the data structure is defined within the reducer it is optimal to
* locate our selector functions at this level. If store is to be thought of
* as a database, and reducers the tables, selectors can be considered the
* queries into said database. Remember to keep your selectors small and
* focused so they can be combined and composed to fit each particular
* use-case.
*/
export const getSelectedId = (state: State) => state.selectedBookId;
| sonicdelay/mtcms | src/app/books/reducers/books.reducer.ts | TypeScript | mit | 3,331 | [
30522,
12324,
1063,
3443,
4765,
3012,
8447,
13876,
2121,
1010,
9178,
8447,
13876,
2121,
1010,
9178,
9153,
2618,
1065,
2013,
1005,
1030,
12835,
2099,
2595,
1013,
9178,
30524,
1011,
17928,
1012,
4506,
1005,
1025,
12324,
1063,
2338,
18908,
849... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#!/usr/bin/perl
use strict;
use warnings;
use Net::SNMP;
my $OID_sysUpTime = '1.3.6.1.2.1.1.3.0';
my ($session, $error) = Net::SNMP->session(
-hostname => shift || '127.0.0.1',
-community => shift || 'public',
);
if (!defined $session) {
printf "ERROR: %s.\n", $error;
exit 1;
}
my $result = $session->get_request(-varbindlist => [ $OID_sysUpTime ],);
if (!defined $result) {
printf "ERROR: %s.\n", $session->error();
$session->close();
exit 1;
}
printf "The sysUpTime for host '%s' is %s.\n",
$session->hostname(), $result->{$OID_sysUpTime};
$session->close();
exit 0;
| cayu/nagios-scripts | perl_snmp_getoid_v1.pl | Perl | gpl-2.0 | 615 | [
30522,
1001,
999,
1013,
2149,
2099,
1013,
8026,
1013,
2566,
2140,
2224,
9384,
1025,
2224,
16234,
1025,
2224,
5658,
1024,
1024,
1055,
2078,
8737,
1025,
2026,
1002,
1051,
3593,
1035,
25353,
6342,
13876,
14428,
1027,
1005,
1015,
1012,
1017,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SharpDX.DirectComposition
{
partial class Device2
{
/// <summary>
/// Creates a new device object that can be used to create other Microsoft DirectComposition objects.
/// </summary>
/// <param name="renderingDevice">An optional reference to a DirectX device to be used to create DirectComposition surface
/// objects. Must be a reference to an object implementing the <strong><see cref="SharpDX.DXGI.Device"/></strong> or
/// <strong><see cref="SharpDX.Direct2D1.Device"/></strong> interfaces.</param>
public Device2(ComObject renderingDevice)
{
IntPtr temp;
DComp.CreateDevice2(renderingDevice, Utilities.GetGuidFromType(typeof(Device2)), out temp);
NativePointer = temp;
}
}
}
| TechPriest/SharpDX | Source/SharpDX.DirectComposition/Device2.cs | C# | mit | 811 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
2291,
1012,
11409,
4160,
1025,
2478,
2291,
1012,
3793,
1025,
3415,
15327,
4629,
2094,
2595,
1012,
3622,
9006,
26994,
1063,
7704,
2465,
5080,
2475,
1063,
1013,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-GB" xml:lang="en-GB" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Statistics of iobj in UD_Chinese-GSD</title>
<link rel="root" href=""/> <!-- for JS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="../../css/jquery-ui-redmond.css"/>
<link rel="stylesheet" type="text/css" href="../../css/style.css"/>
<link rel="stylesheet" type="text/css" href="../../css/style-vis.css"/>
<link rel="stylesheet" type="text/css" href="../../css/hint.css"/>
<script type="text/javascript" src="../../lib/ext/head.load.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/3.2.2/anchor.min.js"></script>
<script>document.addEventListener("DOMContentLoaded", function(event) {anchors.add();});</script>
<!-- Set up this custom Google search at https://cse.google.com/cse/business/settings?cx=001145188882102106025:dl1mehhcgbo -->
<!-- DZ 2021-01-22: I am temporarily hiding the search field to find out whether it slows down loading of the title page.
<script>
(function() {
var cx = '001145188882102106025:dl1mehhcgbo';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script> -->
<!-- <link rel="shortcut icon" href="favicon.ico"/> -->
</head>
<body>
<div id="main" class="center">
<div id="hp-header">
<table width="100%"><tr><td width="50%">
<span class="header-text"><a href="http://universaldependencies.org/#language-">home</a></span>
<span class="header-text"><a href="https://github.com/universaldependencies/docs/edit/pages-source/treebanks/zh_gsd/zh_gsd-dep-iobj.md" target="#">edit page</a></span>
<span class="header-text"><a href="https://github.com/universaldependencies/docs/issues">issue tracker</a></span>
</td><td>
<gcse:search></gcse:search>
</td></tr></table>
</div>
<hr/>
<div class="v2complete">
This page pertains to UD version 2.
</div>
<div id="content">
<noscript>
<div id="noscript">
It appears that you have Javascript disabled.
Please consider enabling Javascript for this page to see the visualizations.
</div>
</noscript>
<!-- The content may include scripts and styles, hence we must load the shared libraries before the content. -->
<script type="text/javascript">
console.time('loading libraries');
var root = '../../'; // filled in by jekyll
head.js(
// External libraries
// DZ: Copied from embedding.html. I don't know which one is needed for what, so I'm currently keeping them all.
root + 'lib/ext/jquery.min.js',
root + 'lib/ext/jquery.svg.min.js',
root + 'lib/ext/jquery.svgdom.min.js',
root + 'lib/ext/jquery.timeago.js',
root + 'lib/ext/jquery-ui.min.js',
root + 'lib/ext/waypoints.min.js',
root + 'lib/ext/jquery.address.min.js'
);
</script>
<h2 id="treebank-statistics-ud_chinese-gsd-relations-iobj">Treebank Statistics: UD_Chinese-GSD: Relations: <code class="language-plaintext highlighter-rouge">iobj</code></h2>
<p>This relation is universal.</p>
<p>78 nodes (0%) are attached to their parents as <code class="language-plaintext highlighter-rouge">iobj</code>.</p>
<p>78 instances of <code class="language-plaintext highlighter-rouge">iobj</code> (100%) are left-to-right (parent precedes child).
Average distance between parent and child is 2.12820512820513.</p>
<p>The following 4 pairs of parts of speech are connected with <code class="language-plaintext highlighter-rouge">iobj</code>: <tt><a href="zh_gsd-pos-VERB.html">VERB</a></tt>-<tt><a href="zh_gsd-pos-NOUN.html">NOUN</a></tt> (49; 63% instances), <tt><a href="zh_gsd-pos-VERB.html">VERB</a></tt>-<tt><a href="zh_gsd-pos-PROPN.html">PROPN</a></tt> (11; 14% instances), <tt><a href="zh_gsd-pos-VERB.html">VERB</a></tt>-<tt><a href="zh_gsd-pos-PART.html">PART</a></tt> (10; 13% instances), <tt><a href="zh_gsd-pos-VERB.html">VERB</a></tt>-<tt><a href="zh_gsd-pos-PRON.html">PRON</a></tt> (8; 10% instances).</p>
<pre><code class="language-conllu"># visual-style 22 bgColor:blue
# visual-style 22 fgColor:white
# visual-style 20 bgColor:blue
# visual-style 20 fgColor:white
# visual-style 20 22 iobj color:blue
1 2009 2009 NUM CD NumType=Card 2 nummod _ SpaceAfter=No
2 年 年 NOUN NNB _ 4 clf _ SpaceAfter=No
3 5 5 NUM CD NumType=Card 4 nummod _ SpaceAfter=No
4 月 月 NOUN NNB _ 9 nmod:tmod _ SpaceAfter=No
5 , , PUNCT , _ 9 punct _ SpaceAfter=No
6 國務 國務 NOUN NN _ 7 compound _ SpaceAfter=No
7 院 院 PART SFN _ 9 nsubj _ SpaceAfter=No
8 批複 批複 VERB VV _ 9 advcl _ SpaceAfter=No
9 同意 同意 VERB VV _ 0 root _ SpaceAfter=No
10 , , PUNCT , _ 9 punct _ SpaceAfter=No
11 撤銷 撤銷 VERB VV _ 20 advcl _ SpaceAfter=No
12 南匯 南匯 PROPN NNP _ 13 compound _ SpaceAfter=No
13 區 區 PART SFN _ 11 obj _ SpaceAfter=No
14 , , PUNCT , _ 20 punct _ SpaceAfter=No
15 將 將 ADP BB _ 18 case _ SpaceAfter=No
16 其 其 PRON PRP Person=3 18 nmod _ SpaceAfter=No
17 行政 行政 NOUN NN _ 18 nmod _ SpaceAfter=No
18 區域 區域 NOUN NN _ 20 obl:patient _ SpaceAfter=No
19 整體 整體 NOUN NN _ 20 advmod _ SpaceAfter=No
20 併入 併入 VERB VV _ 9 xcomp _ SpaceAfter=No
21 浦東 浦東 PROPN NNP _ 22 nmod _ SpaceAfter=No
22 新區 新區 NOUN NN _ 20 iobj _ SpaceAfter=No
23 。 。 PUNCT . _ 20 punct _ SpaceAfter=No
</code></pre>
<pre><code class="language-conllu"># visual-style 10 bgColor:blue
# visual-style 10 fgColor:white
# visual-style 9 bgColor:blue
# visual-style 9 fgColor:white
# visual-style 9 10 iobj color:blue
1 麥格林 麥格林 PROPN NNP _ 2 nmod _ SpaceAfter=No
2 神父 神父 NOUN NN _ 9 nsubj _ SpaceAfter=No
3 花 花 VERB VV _ 9 advcl _ SpaceAfter=No
4 了 了 AUX AS Aspect=Perf 3 aux _ SpaceAfter=No
5 相當 相當 ADV RB _ 6 advmod _ SpaceAfter=No
6 長 長 ADJ JJ _ 8 amod _ SpaceAfter=No
7 的 的 PART DEC _ 6 mark:rel _ SpaceAfter=No
8 時間 時間 NOUN NN _ 3 obj _ SpaceAfter=No
9 詢問 詢問 VERB VV _ 0 root _ SpaceAfter=No
10 路濟亞 路濟亞 PROPN NNP _ 9 iobj _ SpaceAfter=No
11 關於 關於 ADP IN _ 15 det _ SpaceAfter=No
12 聖母 聖母 PROPN NNP _ 13 nsubj _ SpaceAfter=No
13 顯靈 顯靈 VERB VV _ 11 ccomp _ SpaceAfter=No
14 的 的 PART DEC Case=Gen 11 case _ SpaceAfter=No
15 細節 細節 NOUN NN _ 9 obj _ SpaceAfter=No
16 。 。 PUNCT . _ 9 punct _ SpaceAfter=No
</code></pre>
<pre><code class="language-conllu"># visual-style 14 bgColor:blue
# visual-style 14 fgColor:white
# visual-style 12 bgColor:blue
# visual-style 12 fgColor:white
# visual-style 12 14 iobj color:blue
1 在 在 ADP IN _ 3 case _ SpaceAfter=No
2 1555 1555 NUM CD NumType=Card 3 nummod _ SpaceAfter=No
3 年 年 NOUN NNB _ 12 obl _ SpaceAfter=No
4 , , PUNCT , _ 12 punct _ SpaceAfter=No
5 哈布斯堡 哈布斯堡 PROPN NNP _ 6 nmod _ SpaceAfter=No
6 君主 君主 NOUN NN _ 12 nsubj _ SpaceAfter=No
7 簽署 簽署 VERB VV _ 12 advcl _ SpaceAfter=No
8 奧格斯堡 奧格斯堡 PROPN NNP _ 10 nmod _ SpaceAfter=No
9 宗教 宗教 NOUN NN _ 10 nmod _ SpaceAfter=No
10 和約 和約 NOUN NN _ 7 obj _ SpaceAfter=No
11 , , PUNCT , _ 12 punct _ SpaceAfter=No
12 授與 授與 VERB VV _ 0 root _ SpaceAfter=No
13 波希米亞 波希米亞 PROPN NNP _ 14 nsubj _ SpaceAfter=No
14 人 人 PART SFN _ 12 iobj _ SpaceAfter=No
15 宗教 宗教 NOUN NN _ 16 nmod _ SpaceAfter=No
16 自由 自由 NOUN NN _ 12 obj _ SpaceAfter=No
17 。 。 PUNCT . _ 12 punct _ SpaceAfter=No
</code></pre>
</div>
<!-- support for embedded visualizations -->
<script type="text/javascript">
var root = '../../'; // filled in by jekyll
head.js(
// We assume that external libraries such as jquery.min.js have already been loaded outside!
// (See _layouts/base.html.)
// brat helper modules
root + 'lib/brat/configuration.js',
root + 'lib/brat/util.js',
root + 'lib/brat/annotation_log.js',
root + 'lib/ext/webfont.js',
// brat modules
root + 'lib/brat/dispatcher.js',
root + 'lib/brat/url_monitor.js',
root + 'lib/brat/visualizer.js',
// embedding configuration
root + 'lib/local/config.js',
// project-specific collection data
root + 'lib/local/collections.js',
// Annodoc
root + 'lib/annodoc/annodoc.js',
// NOTE: non-local libraries
'https://spyysalo.github.io/conllu.js/conllu.js'
);
var webFontURLs = [
// root + 'static/fonts/Astloch-Bold.ttf',
root + 'static/fonts/PT_Sans-Caption-Web-Regular.ttf',
root + 'static/fonts/Liberation_Sans-Regular.ttf'
];
var setupTimeago = function() {
jQuery("time.timeago").timeago();
};
head.ready(function() {
setupTimeago();
// mark current collection (filled in by Jekyll)
Collections.listing['_current'] = '';
// perform all embedding and support functions
Annodoc.activate(Config.bratCollData, Collections.listing);
});
</script>
<!-- google analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-55233688-1', 'auto');
ga('send', 'pageview');
</script>
<div id="footer">
<p class="footer-text">© 2014–2021
<a href="http://universaldependencies.org/introduction.html#contributors" style="color:gray">Universal Dependencies contributors</a>.
Site powered by <a href="http://spyysalo.github.io/annodoc" style="color:gray">Annodoc</a> and <a href="http://brat.nlplab.org/" style="color:gray">brat</a></p>.
</div>
</div>
</body>
</html>
| UniversalDependencies/universaldependencies.github.io | treebanks/zh_gsd/zh_gsd-dep-iobj.html | HTML | apache-2.0 | 10,667 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
1060,
11039,
19968,
1015,
1012,
1014,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2012 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
#include <map>
#include <boost/version.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <leveldb/env.h>
#include <leveldb/cache.h>
#include <leveldb/filter_policy.h>
#include <memenv/memenv.h>
#include "kernel.h"
#include "checkpoints.h"
#include "txdb.h"
#include "util.h"
#include "main.h"
#include "chainparams.h"
using namespace std;
using namespace boost;
leveldb::DB *txdb; // global pointer for LevelDB object instance
static leveldb::Options GetOptions() {
leveldb::Options options;
int nCacheSizeMB = GetArg("-dbcache", 25);
options.block_cache = leveldb::NewLRUCache(nCacheSizeMB * 1048576);
options.filter_policy = leveldb::NewBloomFilterPolicy(10);
return options;
}
void init_blockindex(leveldb::Options& options, bool fRemoveOld = false) {
// First time init.
filesystem::path directory = GetDataDir() / "txleveldb";
if (fRemoveOld) {
filesystem::remove_all(directory); // remove directory
unsigned int nFile = 1;
while (true)
{
filesystem::path strBlockFile = GetDataDir() / strprintf("blk%04u.dat", nFile);
// Break if no such file
if( !filesystem::exists( strBlockFile ) )
break;
filesystem::remove(strBlockFile);
nFile++;
}
}
filesystem::create_directory(directory);
LogPrintf("Opening LevelDB in %s\n", directory.string());
leveldb::Status status = leveldb::DB::Open(options, directory.string(), &txdb);
if (!status.ok()) {
throw runtime_error(strprintf("init_blockindex(): error opening database environment %s", status.ToString()));
}
}
// CDB subclasses are created and destroyed VERY OFTEN. That's why
// we shouldn't treat this as a free operations.
CTxDB::CTxDB(const char* pszMode)
{
assert(pszMode);
activeBatch = NULL;
fReadOnly = (!strchr(pszMode, '+') && !strchr(pszMode, 'w'));
if (txdb) {
pdb = txdb;
return;
}
bool fCreate = strchr(pszMode, 'c');
options = GetOptions();
options.create_if_missing = fCreate;
options.filter_policy = leveldb::NewBloomFilterPolicy(10);
init_blockindex(options); // Init directory
pdb = txdb;
if (Exists(string("version")))
{
ReadVersion(nVersion);
LogPrintf("Transaction index version is %d\n", nVersion);
if (nVersion < DATABASE_VERSION)
{
LogPrintf("Required index version is %d, removing old database\n", DATABASE_VERSION);
// Leveldb instance destruction
delete txdb;
txdb = pdb = NULL;
delete activeBatch;
activeBatch = NULL;
init_blockindex(options, true); // Remove directory and create new database
pdb = txdb;
bool fTmp = fReadOnly;
fReadOnly = false;
WriteVersion(DATABASE_VERSION); // Save transaction index version
fReadOnly = fTmp;
}
}
else if (fCreate)
{
bool fTmp = fReadOnly;
fReadOnly = false;
WriteVersion(DATABASE_VERSION);
fReadOnly = fTmp;
}
LogPrintf("Opened LevelDB successfully\n");
}
void CTxDB::Close()
{
delete txdb;
txdb = pdb = NULL;
delete options.filter_policy;
options.filter_policy = NULL;
delete options.block_cache;
options.block_cache = NULL;
delete activeBatch;
activeBatch = NULL;
}
bool CTxDB::TxnBegin()
{
assert(!activeBatch);
activeBatch = new leveldb::WriteBatch();
return true;
}
bool CTxDB::TxnCommit()
{
assert(activeBatch);
leveldb::Status status = pdb->Write(leveldb::WriteOptions(), activeBatch);
delete activeBatch;
activeBatch = NULL;
if (!status.ok()) {
LogPrintf("LevelDB batch commit failure: %s\n", status.ToString());
return false;
}
return true;
}
class CBatchScanner : public leveldb::WriteBatch::Handler {
public:
std::string needle;
bool *deleted;
std::string *foundValue;
bool foundEntry;
CBatchScanner() : foundEntry(false) {}
virtual void Put(const leveldb::Slice& key, const leveldb::Slice& value) {
if (key.ToString() == needle) {
foundEntry = true;
*deleted = false;
*foundValue = value.ToString();
}
}
virtual void Delete(const leveldb::Slice& key) {
if (key.ToString() == needle) {
foundEntry = true;
*deleted = true;
}
}
};
// When performing a read, if we have an active batch we need to check it first
// before reading from the database, as the rest of the code assumes that once
// a database transaction begins reads are consistent with it. It would be good
// to change that assumption in future and avoid the performance hit, though in
// practice it does not appear to be large.
bool CTxDB::ScanBatch(const CDataStream &key, string *value, bool *deleted) const {
assert(activeBatch);
*deleted = false;
CBatchScanner scanner;
scanner.needle = key.str();
scanner.deleted = deleted;
scanner.foundValue = value;
leveldb::Status status = activeBatch->Iterate(&scanner);
if (!status.ok()) {
throw runtime_error(status.ToString());
}
return scanner.foundEntry;
}
bool CTxDB::ReadTxIndex(uint256 hash, CTxIndex& txindex)
{
txindex.SetNull();
return Read(make_pair(string("tx"), hash), txindex);
}
bool CTxDB::UpdateTxIndex(uint256 hash, const CTxIndex& txindex)
{
return Write(make_pair(string("tx"), hash), txindex);
}
bool CTxDB::AddTxIndex(const CTransaction& tx, const CDiskTxPos& pos, int nHeight)
{
// Add to tx index
uint256 hash = tx.GetHash();
CTxIndex txindex(pos, tx.vout.size());
return Write(make_pair(string("tx"), hash), txindex);
}
bool CTxDB::EraseTxIndex(const CTransaction& tx)
{
uint256 hash = tx.GetHash();
return Erase(make_pair(string("tx"), hash));
}
bool CTxDB::ContainsTx(uint256 hash)
{
return Exists(make_pair(string("tx"), hash));
}
bool CTxDB::ReadDiskTx(uint256 hash, CTransaction& tx, CTxIndex& txindex)
{
tx.SetNull();
if (!ReadTxIndex(hash, txindex))
return false;
return (tx.ReadFromDisk(txindex.pos));
}
bool CTxDB::ReadDiskTx(uint256 hash, CTransaction& tx)
{
CTxIndex txindex;
return ReadDiskTx(hash, tx, txindex);
}
bool CTxDB::ReadDiskTx(COutPoint outpoint, CTransaction& tx, CTxIndex& txindex)
{
return ReadDiskTx(outpoint.hash, tx, txindex);
}
bool CTxDB::ReadDiskTx(COutPoint outpoint, CTransaction& tx)
{
CTxIndex txindex;
return ReadDiskTx(outpoint.hash, tx, txindex);
}
bool CTxDB::WriteBlockIndex(const CDiskBlockIndex& blockindex)
{
return Write(make_pair(string("blockindex"), blockindex.GetBlockHash()), blockindex);
}
bool CTxDB::ReadHashBestChain(uint256& hashBestChain)
{
return Read(string("hashBestChain"), hashBestChain);
}
bool CTxDB::WriteHashBestChain(uint256 hashBestChain)
{
return Write(string("hashBestChain"), hashBestChain);
}
bool CTxDB::ReadBestInvalidTrust(CBigNum& bnBestInvalidTrust)
{
return Read(string("bnBestInvalidTrust"), bnBestInvalidTrust);
}
bool CTxDB::WriteBestInvalidTrust(CBigNum bnBestInvalidTrust)
{
return Write(string("bnBestInvalidTrust"), bnBestInvalidTrust);
}
bool CTxDB::ReadSyncCheckpoint(uint256& hashCheckpoint)
{
return Read(string("hashSyncCheckpoint"), hashCheckpoint);
}
bool CTxDB::WriteSyncCheckpoint(uint256 hashCheckpoint)
{
return Write(string("hashSyncCheckpoint"), hashCheckpoint);
}
bool CTxDB::ReadCheckpointPubKey(string& strPubKey)
{
return Read(string("strCheckpointPubKey"), strPubKey);
}
bool CTxDB::WriteCheckpointPubKey(const string& strPubKey)
{
return Write(string("strCheckpointPubKey"), strPubKey);
}
static CBlockIndex *InsertBlockIndex(uint256 hash)
{
if (hash == 0)
return NULL;
// Return existing
map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hash);
if (mi != mapBlockIndex.end())
return (*mi).second;
// Create new
CBlockIndex* pindexNew = new CBlockIndex();
if (!pindexNew)
throw runtime_error("LoadBlockIndex() : new CBlockIndex failed");
mi = mapBlockIndex.insert(make_pair(hash, pindexNew)).first;
pindexNew->phashBlock = &((*mi).first);
return pindexNew;
}
bool CTxDB::LoadBlockIndex()
{
if (mapBlockIndex.size() > 0) {
// Already loaded once in this session. It can happen during migration
// from BDB.
return true;
}
// The block index is an in-memory structure that maps hashes to on-disk
// locations where the contents of the block can be found. Here, we scan it
// out of the DB and into mapBlockIndex.
leveldb::Iterator *iterator = pdb->NewIterator(leveldb::ReadOptions());
// Seek to start key.
CDataStream ssStartKey(SER_DISK, CLIENT_VERSION);
ssStartKey << make_pair(string("blockindex"), uint256(0));
iterator->Seek(ssStartKey.str());
// Now read each entry.
while (iterator->Valid())
{
boost::this_thread::interruption_point();
// Unpack keys and values.
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
ssKey.write(iterator->key().data(), iterator->key().size());
CDataStream ssValue(SER_DISK, CLIENT_VERSION);
ssValue.write(iterator->value().data(), iterator->value().size());
string strType;
ssKey >> strType;
// Did we reach the end of the data to read?
if (strType != "blockindex")
break;
CDiskBlockIndex diskindex;
ssValue >> diskindex;
uint256 blockHash = diskindex.GetBlockHash();
// Construct block index object
CBlockIndex* pindexNew = InsertBlockIndex(blockHash);
pindexNew->pprev = InsertBlockIndex(diskindex.hashPrev);
pindexNew->pnext = InsertBlockIndex(diskindex.hashNext);
pindexNew->nFile = diskindex.nFile;
pindexNew->nBlockPos = diskindex.nBlockPos;
pindexNew->nHeight = diskindex.nHeight;
pindexNew->nMint = diskindex.nMint;
pindexNew->nMoneySupply = diskindex.nMoneySupply;
pindexNew->nFlags = diskindex.nFlags;
pindexNew->nStakeModifier = diskindex.nStakeModifier;
pindexNew->prevoutStake = diskindex.prevoutStake;
pindexNew->nStakeTime = diskindex.nStakeTime;
pindexNew->hashProof = diskindex.hashProof;
pindexNew->nVersion = diskindex.nVersion;
pindexNew->hashMerkleRoot = diskindex.hashMerkleRoot;
pindexNew->nTime = diskindex.nTime;
pindexNew->nBits = diskindex.nBits;
pindexNew->nNonce = diskindex.nNonce;
// Watch for genesis block
if (pindexGenesisBlock == NULL && blockHash == Params().HashGenesisBlock())
pindexGenesisBlock = pindexNew;
if (!pindexNew->CheckIndex()) {
delete iterator;
return error("LoadBlockIndex() : CheckIndex failed at %d", pindexNew->nHeight);
}
// xRadon: build setStakeSeen
if (pindexNew->IsProofOfStake())
setStakeSeen.insert(make_pair(pindexNew->prevoutStake, pindexNew->nStakeTime));
iterator->Next();
}
delete iterator;
boost::this_thread::interruption_point();
// Calculate nChainTrust
vector<pair<int, CBlockIndex*> > vSortedByHeight;
vSortedByHeight.reserve(mapBlockIndex.size());
BOOST_FOREACH(const PAIRTYPE(uint256, CBlockIndex*)& item, mapBlockIndex)
{
CBlockIndex* pindex = item.second;
vSortedByHeight.push_back(make_pair(pindex->nHeight, pindex));
}
sort(vSortedByHeight.begin(), vSortedByHeight.end());
BOOST_FOREACH(const PAIRTYPE(int, CBlockIndex*)& item, vSortedByHeight)
{
CBlockIndex* pindex = item.second;
pindex->nChainTrust = (pindex->pprev ? pindex->pprev->nChainTrust : 0) + pindex->GetBlockTrust();
}
// Load hashBestChain pointer to end of best chain
if (!ReadHashBestChain(hashBestChain))
{
if (pindexGenesisBlock == NULL)
return true;
return error("CTxDB::LoadBlockIndex() : hashBestChain not loaded");
}
if (!mapBlockIndex.count(hashBestChain))
return error("CTxDB::LoadBlockIndex() : hashBestChain not found in the block index");
pindexBest = mapBlockIndex[hashBestChain];
nBestHeight = pindexBest->nHeight;
nBestChainTrust = pindexBest->nChainTrust;
LogPrintf("LoadBlockIndex(): hashBestChain=%s height=%d trust=%s date=%s\n",
hashBestChain.ToString(), nBestHeight, CBigNum(nBestChainTrust).ToString(),
DateTimeStrFormat("%x %H:%M:%S", pindexBest->GetBlockTime()));
// xRadon: load hashSyncCheckpoint
if (!ReadSyncCheckpoint(Checkpoints::hashSyncCheckpoint))
return error("CTxDB::LoadBlockIndex() : hashSyncCheckpoint not loaded");
LogPrintf("LoadBlockIndex(): synchronized checkpoint %s\n", Checkpoints::hashSyncCheckpoint.ToString());
// Load bnBestInvalidTrust, OK if it doesn't exist
CBigNum bnBestInvalidTrust;
ReadBestInvalidTrust(bnBestInvalidTrust);
nBestInvalidTrust = bnBestInvalidTrust.getuint256();
// Verify blocks in the best chain
int nCheckLevel = GetArg("-checklevel", 1);
int nCheckDepth = GetArg( "-checkblocks", 500);
if (nCheckDepth == 0)
nCheckDepth = 1000000000; // suffices until the year 19000
if (nCheckDepth > nBestHeight)
nCheckDepth = nBestHeight;
LogPrintf("Verifying last %i blocks at level %i\n", nCheckDepth, nCheckLevel);
CBlockIndex* pindexFork = NULL;
map<pair<unsigned int, unsigned int>, CBlockIndex*> mapBlockPos;
for (CBlockIndex* pindex = pindexBest; pindex && pindex->pprev; pindex = pindex->pprev)
{
boost::this_thread::interruption_point();
if (pindex->nHeight < nBestHeight-nCheckDepth)
break;
CBlock block;
if (!block.ReadFromDisk(pindex))
return error("LoadBlockIndex() : block.ReadFromDisk failed");
// check level 1: verify block validity
// check level 7: verify block signature too
if (nCheckLevel>0 && !block.CheckBlock(true, true, (nCheckLevel>6)))
{
LogPrintf("LoadBlockIndex() : *** found bad block at %d, hash=%s\n", pindex->nHeight, pindex->GetBlockHash().ToString());
pindexFork = pindex->pprev;
}
// check level 2: verify transaction index validity
if (nCheckLevel>1)
{
pair<unsigned int, unsigned int> pos = make_pair(pindex->nFile, pindex->nBlockPos);
mapBlockPos[pos] = pindex;
BOOST_FOREACH(const CTransaction &tx, block.vtx)
{
uint256 hashTx = tx.GetHash();
CTxIndex txindex;
if (ReadTxIndex(hashTx, txindex))
{
// check level 3: checker transaction hashes
if (nCheckLevel>2 || pindex->nFile != txindex.pos.nFile || pindex->nBlockPos != txindex.pos.nBlockPos)
{
// either an error or a duplicate transaction
CTransaction txFound;
if (!txFound.ReadFromDisk(txindex.pos))
{
LogPrintf("LoadBlockIndex() : *** cannot read mislocated transaction %s\n", hashTx.ToString());
pindexFork = pindex->pprev;
}
else
if (txFound.GetHash() != hashTx) // not a duplicate tx
{
LogPrintf("LoadBlockIndex(): *** invalid tx position for %s\n", hashTx.ToString());
pindexFork = pindex->pprev;
}
}
// check level 4: check whether spent txouts were spent within the main chain
unsigned int nOutput = 0;
if (nCheckLevel>3)
{
BOOST_FOREACH(const CDiskTxPos &txpos, txindex.vSpent)
{
if (!txpos.IsNull())
{
pair<unsigned int, unsigned int> posFind = make_pair(txpos.nFile, txpos.nBlockPos);
if (!mapBlockPos.count(posFind))
{
LogPrintf("LoadBlockIndex(): *** found bad spend at %d, hashBlock=%s, hashTx=%s\n", pindex->nHeight, pindex->GetBlockHash().ToString(), hashTx.ToString());
pindexFork = pindex->pprev;
}
// check level 6: check whether spent txouts were spent by a valid transaction that consume them
if (nCheckLevel>5)
{
CTransaction txSpend;
if (!txSpend.ReadFromDisk(txpos))
{
LogPrintf("LoadBlockIndex(): *** cannot read spending transaction of %s:%i from disk\n", hashTx.ToString(), nOutput);
pindexFork = pindex->pprev;
}
else if (!txSpend.CheckTransaction())
{
LogPrintf("LoadBlockIndex(): *** spending transaction of %s:%i is invalid\n", hashTx.ToString(), nOutput);
pindexFork = pindex->pprev;
}
else
{
bool fFound = false;
BOOST_FOREACH(const CTxIn &txin, txSpend.vin)
if (txin.prevout.hash == hashTx && txin.prevout.n == nOutput)
fFound = true;
if (!fFound)
{
LogPrintf("LoadBlockIndex(): *** spending transaction of %s:%i does not spend it\n", hashTx.ToString(), nOutput);
pindexFork = pindex->pprev;
}
}
}
}
nOutput++;
}
}
}
// check level 5: check whether all prevouts are marked spent
if (nCheckLevel>4)
{
BOOST_FOREACH(const CTxIn &txin, tx.vin)
{
CTxIndex txindex;
if (ReadTxIndex(txin.prevout.hash, txindex))
if (txindex.vSpent.size()-1 < txin.prevout.n || txindex.vSpent[txin.prevout.n].IsNull())
{
LogPrintf("LoadBlockIndex(): *** found unspent prevout %s:%i in %s\n", txin.prevout.hash.ToString(), txin.prevout.n, hashTx.ToString());
pindexFork = pindex->pprev;
}
}
}
}
}
}
if (pindexFork)
{
boost::this_thread::interruption_point();
// Reorg back to the fork
LogPrintf("LoadBlockIndex() : *** moving best chain pointer back to block %d\n", pindexFork->nHeight);
CBlock block;
if (!block.ReadFromDisk(pindexFork))
return error("LoadBlockIndex() : block.ReadFromDisk failed");
CTxDB txdb;
block.SetBestChain(txdb, pindexFork);
}
return true;
}
| Bitspender/h10 | src/txdb-leveldb.cpp | C++ | mit | 20,331 | [
30522,
1013,
1013,
9385,
1006,
1039,
1007,
2268,
1011,
2230,
20251,
6182,
17823,
22591,
3406,
1013,
1013,
9385,
1006,
1039,
1007,
2268,
1011,
2262,
1996,
2978,
3597,
2378,
9797,
1013,
1013,
5500,
2104,
1996,
10210,
1013,
1060,
14526,
4007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<html><body>
<h4>Windows 10 x64 (18362.329)</h4><br>
<h2>_PS_CLIENT_SECURITY_CONTEXT</h2>
<font face="arial"> +0x000 ImpersonationData : Uint8B<br>
+0x000 ImpersonationToken : Ptr64 Void<br>
+0x000 ImpersonationLevel : Pos 0, 2 Bits<br>
+0x000 EffectiveOnly : Pos 2, 1 Bit<br>
</font></body></html> | epikcraw/ggool | public/Windows 10 x64 (18362.329)/_PS_CLIENT_SECURITY_CONTEXT.html | HTML | mit | 319 | [
30522,
1026,
16129,
1028,
1026,
2303,
1028,
1026,
1044,
2549,
1028,
3645,
2184,
1060,
21084,
1006,
10081,
2475,
1012,
29567,
1007,
1026,
1013,
1044,
2549,
1028,
1026,
7987,
1028,
1026,
1044,
2475,
1028,
1035,
8827,
1035,
7396,
1035,
3036,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
"""Copyright 2008 Orbitz WorldWide
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."""
# Django settings for graphite project.
# DO NOT MODIFY THIS FILE DIRECTLY - use local_settings.py instead
import sys, os
from os.path import abspath, dirname, join
from warnings import warn
GRAPHITE_WEB_APP_SETTINGS_LOADED = False
WEBAPP_VERSION = '0.10.0-alpha'
DEBUG = False
JAVASCRIPT_DEBUG = False
# Filesystem layout
WEB_DIR = dirname( abspath(__file__) )
WEBAPP_DIR = dirname(WEB_DIR)
GRAPHITE_ROOT = dirname(WEBAPP_DIR)
# Initialize additional path variables
# Defaults for these are set after local_settings is imported
CONTENT_DIR = ''
CSS_DIR = ''
CONF_DIR = ''
DASHBOARD_CONF = ''
GRAPHTEMPLATES_CONF = ''
STORAGE_DIR = ''
WHITELIST_FILE = ''
INDEX_FILE = ''
LOG_DIR = ''
CERES_DIR = ''
WHISPER_DIR = ''
RRD_DIR = ''
STANDARD_DIRS = []
CLUSTER_SERVERS = []
# Cluster settings
CLUSTER_SERVERS = []
REMOTE_FIND_TIMEOUT = 3.0
REMOTE_FETCH_TIMEOUT = 6.0
REMOTE_RETRY_DELAY = 60.0
REMOTE_READER_CACHE_SIZE_LIMIT = 1000
CARBON_METRIC_PREFIX='carbon'
CARBONLINK_HOSTS = ["127.0.0.1:7002"]
CARBONLINK_TIMEOUT = 1.0
CARBONLINK_HASHING_KEYFUNC = None
CARBONLINK_RETRY_DELAY = 15
REPLICATION_FACTOR = 1
MEMCACHE_HOSTS = []
MEMCACHE_KEY_PREFIX = ''
FIND_CACHE_DURATION = 300
FIND_TOLERANCE = 2 * FIND_CACHE_DURATION
DEFAULT_CACHE_DURATION = 60 #metric data and graphs are cached for one minute by default
LOG_CACHE_PERFORMANCE = False
LOG_ROTATE = True
MAX_FETCH_RETRIES = 2
#Remote rendering settings
REMOTE_RENDERING = False #if True, rendering is delegated to RENDERING_HOSTS
RENDERING_HOSTS = []
REMOTE_RENDER_CONNECT_TIMEOUT = 1.0
LOG_RENDERING_PERFORMANCE = False
#Miscellaneous settings
SMTP_SERVER = "localhost"
DOCUMENTATION_URL = "http://graphite.readthedocs.org/"
ALLOW_ANONYMOUS_CLI = True
LOG_METRIC_ACCESS = False
LEGEND_MAX_ITEMS = 10
RRD_CF = 'AVERAGE'
STORAGE_FINDERS = (
'graphite.finders.standard.StandardFinder',
)
#Authentication settings
USE_LDAP_AUTH = False
LDAP_SERVER = "" # "ldapserver.mydomain.com"
LDAP_PORT = 389
LDAP_USE_TLS = False
LDAP_SEARCH_BASE = "" # "OU=users,DC=mydomain,DC=com"
LDAP_BASE_USER = "" # "CN=some_readonly_account,DC=mydomain,DC=com"
LDAP_BASE_PASS = "" # "my_password"
LDAP_USER_QUERY = "" # "(username=%s)" For Active Directory use "(sAMAccountName=%s)"
LDAP_URI = None
#Set this to True to delegate authentication to the web server
USE_REMOTE_USER_AUTHENTICATION = False
# Django 1.5 requires this so we set a default but warn the user
SECRET_KEY = 'UNSAFE_DEFAULT'
# Django 1.5 requires this to be set. Here we default to prior behavior and allow all
ALLOWED_HOSTS = [ '*' ]
# Override to link a different URL for login (e.g. for django_openid_auth)
LOGIN_URL = '/account/login'
# Set to True to require authentication to save or delete dashboards
DASHBOARD_REQUIRE_AUTHENTICATION = False
# Require Django change/delete permissions to save or delete dashboards.
# NOTE: Requires DASHBOARD_REQUIRE_AUTHENTICATION to be set
DASHBOARD_REQUIRE_PERMISSIONS = False
# Name of a group to which the user must belong to save or delete dashboards. Alternative to
# DASHBOARD_REQUIRE_PERMISSIONS, particularly useful when using only LDAP (without Admin app)
# NOTE: Requires DASHBOARD_REQUIRE_AUTHENTICATION to be set
DASHBOARD_REQUIRE_EDIT_GROUP = None
DATABASES = {
'default': {
'NAME': '/opt/graphite/storage/graphite.db',
'ENGINE': 'django.db.backends.sqlite3',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
},
}
# If using rrdcached, set to the address or socket of the daemon
FLUSHRRDCACHED = ''
## Load our local_settings
try:
from graphite.local_settings import *
except ImportError:
print >> sys.stderr, "Could not import graphite.local_settings, using defaults!"
## Load Django settings if they werent picked up in local_settings
if not GRAPHITE_WEB_APP_SETTINGS_LOADED:
from graphite.app_settings import *
## Set config dependent on flags set in local_settings
# Path configuration
if not CONTENT_DIR:
CONTENT_DIR = join(WEBAPP_DIR, 'content')
if not CSS_DIR:
CSS_DIR = join(CONTENT_DIR, 'css')
if not CONF_DIR:
CONF_DIR = os.environ.get('GRAPHITE_CONF_DIR', join(GRAPHITE_ROOT, 'conf'))
if not DASHBOARD_CONF:
DASHBOARD_CONF = join(CONF_DIR, 'dashboard.conf')
if not GRAPHTEMPLATES_CONF:
GRAPHTEMPLATES_CONF = join(CONF_DIR, 'graphTemplates.conf')
if not STORAGE_DIR:
STORAGE_DIR = os.environ.get('GRAPHITE_STORAGE_DIR', join(GRAPHITE_ROOT, 'storage'))
if not WHITELIST_FILE:
WHITELIST_FILE = join(STORAGE_DIR, 'lists', 'whitelist')
if not INDEX_FILE:
INDEX_FILE = join(STORAGE_DIR, 'index')
if not LOG_DIR:
LOG_DIR = join(STORAGE_DIR, 'log', 'webapp')
if not WHISPER_DIR:
WHISPER_DIR = join(STORAGE_DIR, 'whisper/')
if not CERES_DIR:
CERES_DIR = join(STORAGE_DIR, 'ceres/')
if not RRD_DIR:
RRD_DIR = join(STORAGE_DIR, 'rrd/')
if not STANDARD_DIRS:
try:
import whisper
if os.path.exists(WHISPER_DIR):
STANDARD_DIRS.append(WHISPER_DIR)
except ImportError:
print >> sys.stderr, "WARNING: whisper module could not be loaded, whisper support disabled"
try:
import rrdtool
if os.path.exists(RRD_DIR):
STANDARD_DIRS.append(RRD_DIR)
except ImportError:
pass
# Default sqlite db file
# This is set here so that a user-set STORAGE_DIR is available
if 'sqlite3' in DATABASES.get('default',{}).get('ENGINE','') \
and not DATABASES.get('default',{}).get('NAME'):
DATABASES['default']['NAME'] = join(STORAGE_DIR, 'graphite.db')
# Caching shortcuts
if MEMCACHE_HOSTS:
CACHES['default'] = {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': MEMCACHE_HOSTS,
'TIMEOUT': DEFAULT_CACHE_DURATION,
'KEY_PREFIX': MEMCACHE_KEY_PREFIX,
}
# Authentication shortcuts
if USE_LDAP_AUTH and LDAP_URI is None:
LDAP_URI = "ldap://%s:%d/" % (LDAP_SERVER, LDAP_PORT)
if USE_REMOTE_USER_AUTHENTICATION:
MIDDLEWARE_CLASSES += ('django.contrib.auth.middleware.RemoteUserMiddleware',)
AUTHENTICATION_BACKENDS.insert(0,'django.contrib.auth.backends.RemoteUserBackend')
if USE_LDAP_AUTH:
AUTHENTICATION_BACKENDS.insert(0,'graphite.account.ldapBackend.LDAPBackend')
if SECRET_KEY == 'UNSAFE_DEFAULT':
warn('SECRET_KEY is set to an unsafe default. This should be set in local_settings.py for better security')
| g76r/graphite-web | webapp/graphite/settings.py | Python | apache-2.0 | 6,812 | [
30522,
1000,
1000,
1000,
9385,
2263,
8753,
2480,
4969,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
12646,
2007,
1996,
6105,
1012,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only 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.
*
*/
#ifndef __ASM_ARCH_MSM_SERIAL_HS_LITE_H
#define __ASM_ARCH_MSM_SERIAL_HS_LITE_H
struct msm_serial_hslite_platform_data {
unsigned config_gpio;
unsigned uart_tx_gpio;
unsigned uart_rx_gpio;
int line;
};
#endif
| Jarbu12/Xperia-M-Kernel | kernel/arch/arm/mach-msm/include/mach/msm_serial_hs_lite.h | C | gpl-3.0 | 748 | [
30522,
1013,
1008,
9385,
1006,
1039,
1007,
2249,
1010,
1996,
11603,
3192,
1012,
2035,
2916,
9235,
1012,
1008,
1008,
2023,
2565,
2003,
2489,
4007,
1025,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1998,
1013,
2030,
19933,
1008,
2009,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
namespace Insales\AppBundle\Lib;
use Symfony\Component\DependencyInjection\ContainerAware;
use Insales\AppBundle\Services\Myapp;
/*
* Класс который сохраняется в сессию и хранит данные об авторизации
*/
class Application
{
protected $authorized;
protected $shop;
protected $password;
protected $api_secret;
protected $api_key;
protected $api_host;
protected $api_autologin_path;
protected $auth_token;
protected $salt;
public function __construct($shop, $password, $api_secret, $api_key, $api_host, $api_autologin_path)
{
$this->authorized = false;
$this->shop = $shop;
$this->password = $password;
$this->api_secret = $api_secret;
$this->api_key = $api_key;
$this->api_host = $api_host;
$this->api_autologin_path = $api_autologin_path;
}
public function authorizationUrl()
{
$this->storeAuthToken();
return "http://$this->shop/admin/applications/$this->api_key/login?token=$this->salt&login=http://$this->api_host/$this->api_autologin_path";
}
public function getShop()
{
return $this->shop;
}
public function isAuthorized()
{
return $this->authorized;
}
public function storeAuthToken()
{
if (strlen($this->auth_token) == 0)
{
$this->auth_token = Myapp::generatePassword($this->password, $this->salt());
}
return $this->auth_token;
}
public function authorize($token)
{
$this->authorized = false;
if ($this->auth_token && $this->auth_token == $token)
{
$this->authorized = true;
}
return $this->authorized;
}
public function salt()
{
if (strlen($this->salt) == 0)
{
$this->salt = md5("Twulvyeik".getmypid().time()."thithAwn");
}
return $this->salt;
}
}
| insales/insales_php_application | src/Insales/AppBundle/Lib/Application.php | PHP | mit | 1,976 | [
30522,
1026,
1029,
25718,
3415,
15327,
16021,
23266,
1032,
10439,
27265,
2571,
1032,
5622,
2497,
1025,
2224,
25353,
2213,
14876,
4890,
1032,
6922,
1032,
24394,
2378,
20614,
3258,
1032,
11661,
10830,
2890,
1025,
2224,
16021,
23266,
1032,
10439... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// This is a part of the Microsoft Foundation Classes C++ library.
// Copyright (C) Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Microsoft Foundation Classes Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Microsoft Foundation Classes product.
#pragma once
#ifndef __AFXOLE_H__
#include <afxole.h>
#endif
#include "afxcontrolbarutil.h"
#ifdef _AFX_PACKING
#pragma pack(push, _AFX_PACKING)
#endif
#ifdef _AFX_MINREBUILD
#pragma component(minrebuild, off)
#endif
/////////////////////////////////////////////////////////////////////////////
// CMFCToolBarDropSource command target
class CMFCToolBarDropSource : public COleDropSource
{
public:
CMFCToolBarDropSource();
virtual ~CMFCToolBarDropSource();
// Attributes
public:
BOOL m_bDeleteOnDrop;
BOOL m_bEscapePressed;
BOOL m_bDragStarted;
HCURSOR m_hcurDelete;
HCURSOR m_hcurMove;
HCURSOR m_hcurCopy;
// Overrides
public:
virtual SCODE GiveFeedback(DROPEFFECT dropEffect);
virtual SCODE QueryContinueDrag(BOOL bEscapePressed, DWORD dwKeyState);
virtual BOOL OnBeginDrag(CWnd* pWnd);
// Implementation
protected:
DECLARE_MESSAGE_MAP()
};
#ifdef _AFX_MINREBUILD
#pragma component(minrebuild, on)
#endif
#ifdef _AFX_PACKING
#pragma pack(pop)
#endif
| pvpgn/pvpgn-magic-builder | module/include/atlmfc/afxtoolbardropsource.h | C | mit | 1,387 | [
30522,
1013,
1013,
2023,
2003,
1037,
2112,
1997,
1996,
7513,
3192,
4280,
1039,
1009,
1009,
3075,
1012,
1013,
1013,
9385,
1006,
1039,
1007,
7513,
3840,
1013,
1013,
2035,
2916,
9235,
1012,
1013,
1013,
1013,
1013,
2023,
3120,
3642,
2003,
206... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# UHDS documentation
| uhds/uhds-doc | README.md | Markdown | mit | 21 | [
30522,
1001,
7910,
5104,
12653,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>multiplier: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.9.1 / multiplier - 8.5.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
multiplier
<small>
8.5.0
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-02-18 14:03:32 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-02-18 14:03:32 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-num base Num library distributed with the OCaml compiler
base-ocamlbuild base OCamlbuild binary and libraries distributed with the OCaml compiler
base-threads base
base-unix base
camlp5 7.14 Preprocessor-pretty-printer of OCaml
conf-findutils 1 Virtual package relying on findutils
conf-perl 2 Virtual package relying on perl
coq 8.9.1 Formal proof management system
num 0 The Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.02.3 The OCaml compiler (virtual package)
ocaml-base-compiler 4.02.3 Official 4.02.3 release
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.3 A library manager for OCaml
# opam file:
opam-version: "2.0"
maintainer: "matej.kosik@inria.fr"
homepage: "https://github.com/coq-contribs/multiplier"
license: "LGPL 2"
build: [make "-j%{jobs}%"]
install: [make "install"]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/Multiplier"]
depends: [
"ocaml"
"coq" {>= "8.5" & < "8.6~"}
]
tags: [ "keyword:hardware verification" "keyword:circuit" "category:Computer Science/Architecture" "category:Miscellaneous/Extracted Programs/Hardware" ]
authors: [ "Christine Paulin <>" ]
bug-reports: "https://github.com/coq-contribs/multiplier/issues"
dev-repo: "git+https://github.com/coq-contribs/multiplier.git"
synopsis: "Proof of a multiplier circuit"
flags: light-uninstall
url {
src: "https://github.com/coq-contribs/multiplier/archive/v8.5.0.tar.gz"
checksum: "md5=5dff8fca270a7aaf1752a9fa26efbb30"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-multiplier.8.5.0 coq.8.9.1</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.9.1).
The following dependencies couldn't be met:
- coq-multiplier -> coq < 8.6~ -> ocaml < 4.02.0
base of this switch (use `--unlock-base' to force)
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-multiplier.8.5.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| coq-bench/coq-bench.github.io | clean/Linux-x86_64-4.02.3-2.0.6/released/8.9.1/multiplier/8.5.0.html | HTML | mit | 7,018 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
11374,
1027,
1000,
4372,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
18804,
2171,
1027,
1000,
3193,
6442,
1000,
418... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// --------------------------------------------------------------------------------------------
// <copyright file="TransformVisitor.UnionAll.cs" company="Effort Team">
// Copyright (C) 2011-2014 Effort Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// </copyright>
// --------------------------------------------------------------------------------------------
namespace Effort.Internal.DbCommandTreeTransformation
{
using System;
using System.Collections.Generic;
#if !EFOLD
using System.Data.Entity.Core.Common.CommandTrees;
#else
using System.Data.Common.CommandTrees;
#endif
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using Effort.Internal.Common;
internal partial class TransformVisitor
{
public override Expression Visit(DbUnionAllExpression expression)
{
Type resultType = edmTypeConverter.Convert(expression.ResultType);
Expression left = this.Visit(expression.Left);
Expression right = this.Visit(expression.Right);
var resultElemType = TypeHelper.GetElementType(resultType);
this.UnifyCollections(resultElemType, ref left, ref right);
return queryMethodExpressionBuilder.Concat(left, right);
}
}
} | wertzui/effort | Main/Source/Effort/Internal/DbCommandTreeTransformation/TransformVisitor.UnionAll.cs | C# | mit | 2,438 | [
30522,
1013,
1013,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Preface</title>
<link rel="stylesheet" href="gettingStarted.css" type="text/css" />
<meta name="generator" content="DocBook XSL Stylesheets V1.62.4" />
<link rel="home" href="index.html" title="Porting Berkeley DB" />
<link rel="up" href="index.html" title="Porting Berkeley DB" />
<link rel="previous" href="index.html" title="Porting Berkeley DB" />
<link rel="next" href="introduction.html" title="Chapter 1. Introduction to Porting Berkeley DB " />
</head>
<body>
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr>
<th colspan="3" align="center">Preface</th>
</tr>
<tr>
<td width="20%" align="left"><a accesskey="p" href="index.html">Prev</a> </td>
<th width="60%" align="center"> </th>
<td width="20%" align="right"> <a accesskey="n" href="introduction.html">Next</a></td>
</tr>
</table>
<hr />
</div>
<div class="preface" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h2 class="title"><a id="preface"></a>Preface</h2>
</div>
</div>
<div></div>
</div>
<div class="toc">
<p>
<b>Table of Contents</b>
</p>
<dl>
<dt>
<span class="sect1">
<a href="preface.html#conventions">Conventions Used in this Book</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="sect2">
<a href="preface.html#audience">Audience</a>
</span>
</dt>
<dt>
<span class="sect2">
<a href="preface.html#moreinfo">For More Information</a>
</span>
</dt>
</dl>
</dd>
</dl>
</div>
<p>
The Berkeley DB family of open source, embeddable databases
provides developers with fast, reliable persistence with zero
administration. Often deployed as "edge" databases, the Berkeley DB
family provides very high performance, reliability, scalability,
and availability for application use cases that do not require SQL.
</p>
<p>
As an open source database, Berkeley DB works on many different
platforms, from Wind River's Tornado system, to VMS, to
Windows NT and Windows 95, and most existing UNIX
platforms. It runs on 32 and 64-bit machines, little or big-endian.
</p>
<p>
<span class="emphasis"><em>Berkeley DB Porting Guide</em></span> provides the information you need to
port Berkeley DB to additional platforms.
</p>
<div class="sect1" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a id="conventions"></a>Conventions Used in this Book</h2>
</div>
</div>
<div></div>
</div>
<p>
The following typographical conventions are used within in this manual:
</p>
<p>
Structure names are represented in <tt class="classname">monospaced font</tt>, as are <tt class="methodname">method
names</tt>. For example: "<tt class="methodname">DB->open()</tt> is a method
on a <tt class="classname">DB</tt> handle."
</p>
<p>
Variable or non-literal text is presented in <span class="emphasis"><em>italics</em></span>. For example: "Go to your
<span class="emphasis"><em>DB_INSTALL</em></span>
directory."
</p>
<p>
Program examples are displayed in a <tt class="classname">monospaced font</tt> on a shaded background.
For example:
</p>
<pre class="programlisting">/* File: gettingstarted_common.h */
typedef struct stock_dbs {
DB *inventory_dbp; /* Database containing inventory information */
DB *vendor_dbp; /* Database containing vendor information */
char *db_home_dir; /* Directory containing the database files */
char *inventory_db_name; /* Name of the inventory database */
char *vendor_db_name; /* Name of the vendor database */
} STOCK_DBS; </pre>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Note</h3>
<p>
Finally, notes of interest are represented using a note block such
as this.
</p>
</div>
<div class="sect2" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="audience"></a>Audience</h3>
</div>
</div>
<div></div>
</div>
<p>
This guide is intended
for programmers porting Berkeley DB to a new platform. It
assumes that these programmers possess:
</p>
<div class="itemizedlist">
<ul type="disc">
<li>
<p>
Familiarity with standard ANSI C and POSIX C 1003.1 and 1003.2 library and system
calls.
</p>
</li>
<li>
<p>
Working knowledge of the target platform as well as the development tools (for example, compilers, linkers, and debuggers) available on that platform.
</p>
</li>
</ul>
</div>
</div>
<div class="sect2" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="moreinfo"></a>For More Information</h3>
</div>
</div>
<div></div>
</div>
<p>
Beyond this manual, you may also find the following sources of information useful when building a
DB application:
</p>
<div class="itemizedlist">
<ul type="disc">
<li>
<p>
<a href="http://www.oracle.com/technology/documentation/berkeley-db/db/gsg/C/index.html" target="_top">
Getting Started with Berkeley DB for C
</a>
</p>
</li>
<li>
<p>
<a href="http://www.oracle.com/technology/documentation/berkeley-db/db/gsg_txn/C/index.html" target="_top">
Getting Started with Transaction Processing for C
</a>
</p>
</li>
<li>
<p>
<a href="http://www.oracle.com/technology/documentation/berkeley-db/db/gsg_db_rep/C/index.html" target="_top">
Berkeley DB Getting Started with Replicated Applications for C
</a>
</p>
</li>
<li>
<p>
<a href="http://www.oracle.com/technology/documentation/berkeley-db/db/ref/toc.html" target="_top">
Berkeley DB Programmer's Reference Guide
</a>
</p>
</li>
<li>
<p>
<a href="http://www.oracle.com/technology/documentation/berkeley-db/db/api_c/frame.html" target="_top">
Berkeley DB C API
</a>
</p>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="navfooter">
<hr />
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left"><a accesskey="p" href="index.html">Prev</a> </td>
<td width="20%" align="center">
<a accesskey="u" href="index.html">Up</a>
</td>
<td width="40%" align="right"> <a accesskey="n" href="introduction.html">Next</a></td>
</tr>
<tr>
<td width="40%" align="left" valign="top">Porting Berkeley DB </td>
<td width="20%" align="center">
<a accesskey="h" href="index.html">Home</a>
</td>
<td width="40%" align="right" valign="top"> Chapter 1. Introduction to Porting Berkeley DB </td>
</tr>
</table>
</div>
</body>
</html>
| djsedulous/namecoind | libs/db-4.7.25.NC/docs/porting/preface.html | HTML | mit | 8,808 | [
30522,
1026,
1029,
20950,
2544,
1027,
1000,
1015,
1012,
1014,
1000,
17181,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
26609,
1027,
1000,
2053,
1000,
1029,
1028,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (c) 2004 Marcel Moolenaar
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR 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.
*
* $FreeBSD$
*/
#ifndef _KGDB_H_
#define _KGDB_H_
struct thread_info;
extern kvm_t *kvm;
struct kthr {
struct kthr *next;
uintptr_t paddr;
uintptr_t kaddr;
uintptr_t kstack;
uintptr_t pcb;
int tid;
int pid;
u_char cpu;
};
extern struct kthr *curkthr;
void initialize_kld_target(void);
void initialize_kgdb_target(void);
void kgdb_dmesg(void);
CORE_ADDR kgdb_trgt_core_pcb(u_int);
CORE_ADDR kgdb_trgt_stop_pcb(u_int, u_int);
void kgdb_trgt_new_objfile(struct objfile *);
void kgdb_trgt_fetch_registers(int);
void kgdb_trgt_store_registers(int);
void kld_init(void);
void kld_new_objfile(struct objfile *);
frame_unwind_sniffer_ftype kgdb_trgt_trapframe_sniffer;
struct kthr *kgdb_thr_first(void);
struct kthr *kgdb_thr_init(void);
struct kthr *kgdb_thr_lookup_tid(int);
struct kthr *kgdb_thr_lookup_pid(int);
struct kthr *kgdb_thr_lookup_paddr(uintptr_t);
struct kthr *kgdb_thr_lookup_taddr(uintptr_t);
struct kthr *kgdb_thr_next(struct kthr *);
struct kthr *kgdb_thr_select(struct kthr *);
char *kgdb_thr_extra_thread_info(int);
CORE_ADDR kgdb_lookup(const char *sym);
CORE_ADDR kgdb_parse_1(const char *, int);
#define kgdb_parse(exp) kgdb_parse_1((exp), 0)
#define kgdb_parse_quiet(exp) kgdb_parse_1((exp), 1)
#endif /* _KGDB_H_ */
| jrobhoward/SCADAbase | gnu/usr.bin/gdb/kgdb/kgdb.h | C | bsd-3-clause | 2,587 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2432,
13389,
9587,
9890,
2532,
2906,
1008,
2035,
2916,
9235,
1012,
1008,
1008,
25707,
1998,
2224,
1999,
3120,
1998,
12441,
3596,
1010,
2007,
2030,
2302,
1008,
14080,
1010,
2024,
7936,
3024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# -*- coding: utf-8 -*-
# Copyright 2009 James Hensman
# Licensed under the Gnu General Public license, see COPYING
#
# Gaussian Process Proper Orthogonal Decomposition.
| jameshensman/pythonGPLVM | GPPOD.py | Python | gpl-3.0 | 171 | [
30522,
1001,
1011,
1008,
1011,
16861,
1024,
21183,
2546,
1011,
1022,
1011,
1008,
1011,
1001,
9385,
2268,
2508,
21863,
11512,
1001,
7000,
2104,
1996,
27004,
2236,
2270,
6105,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="rustdoc">
<meta name="description" content="API documentation for the Rust `XKB_KEY_AudibleBell_Enable` constant in crate `wayland_kbd`.">
<meta name="keywords" content="rust, rustlang, rust-lang, XKB_KEY_AudibleBell_Enable">
<title>wayland_kbd::keysyms::XKB_KEY_AudibleBell_Enable - Rust</title>
<link rel="stylesheet" type="text/css" href="../../rustdoc.css">
<link rel="stylesheet" type="text/css" href="../../main.css">
</head>
<body class="rustdoc">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<p class='location'><a href='../index.html'>wayland_kbd</a>::<wbr><a href='index.html'>keysyms</a></p><script>window.sidebarCurrent = {name: 'XKB_KEY_AudibleBell_Enable', ty: 'constant', relpath: ''};</script><script defer src="sidebar-items.js"></script>
</nav>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
type="search">
</div>
</form>
</nav>
<section id='main' class="content constant">
<h1 class='fqn'><span class='in-band'><a href='../index.html'>wayland_kbd</a>::<wbr><a href='index.html'>keysyms</a>::<wbr><a class='constant' href=''>XKB_KEY_AudibleBell_Enable</a></span><span class='out-of-band'><span id='render-detail'>
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
[<span class='inner'>−</span>]
</a>
</span><a id='src-291' class='srclink' href='../../src/wayland_kbd/ffi/keysyms.rs.html#458' title='goto source code'>[src]</a></span></h1>
<pre class='rust const'>pub const XKB_KEY_AudibleBell_Enable: <a class='primitive' href='../../std/primitive.u32.html'>u32</a><code> = </code><code>65146</code></pre></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<aside id="help" class="hidden">
<div>
<h1 class="hidden">Help</h1>
<div class="shortcuts">
<h2>Keyboard Shortcuts</h2>
<dl>
<dt>?</dt>
<dd>Show this help dialog</dd>
<dt>S</dt>
<dd>Focus the search field</dd>
<dt>⇤</dt>
<dd>Move up in search results</dd>
<dt>⇥</dt>
<dd>Move down in search results</dd>
<dt>⏎</dt>
<dd>Go to active search result</dd>
<dt>+</dt>
<dd>Collapse/expand all sections</dd>
</dl>
</div>
<div class="infos">
<h2>Search Tricks</h2>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>type</code>, <code>macro</code>,
and <code>const</code>.
</p>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code> or <code>* -> vec</code>)
</p>
</div>
</div>
</aside>
<script>
window.rootPath = "../../";
window.currentCrate = "wayland_kbd";
window.playgroundUrl = "";
</script>
<script src="../../jquery.js"></script>
<script src="../../main.js"></script>
<script defer src="../../search-index.js"></script>
</body>
</html> | servo/doc.servo.org | wayland_kbd/keysyms/constant.XKB_KEY_AudibleBell_Enable.html | HTML | mpl-2.0 | 4,319 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
11374,
1027,
1000,
4372,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
18804,
2171,
1027,
1000,
3193,
6442,
1000,
418... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* @class A wrapper around WebGL.
* @name GL
* @param {HTMLCanvasElement} element A canvas element.
* @param {function} onload A callback function.
* @param {function} callbacks.onerror A callback function.
* @param {function} callbacks.onprogress A callback function.
* @param {function} callbacks.onloadstart A callback function.
* @param {function} callbacks.onremove A callback function.
* @property {WebGLRenderingContext} ctx
*/
function GL(element, callbacks) {
var ctx,
identifiers = ["webgl", "experimental-webgl"],
i,
l;
for (var i = 0, l = identifiers.length; i < l; ++i) {
try {
ctx = element.getContext(identifiers[i], {antialias: true, alpha: false/*, preserveDrawingBuffer: true*/});
} catch(e) {
}
if (ctx) {
break;
}
}
if (!ctx) {
console.error("[WebGLContext]: Failed to create a WebGLContext");
throw "[WebGLContext]: Failed to create a WebGLContext";
}
var hasVertexTexture = ctx.getParameter(ctx.MAX_VERTEX_TEXTURE_IMAGE_UNITS) > 0;
var hasFloatTexture = ctx.getExtension("OES_texture_float");
var compressedTextures = ctx.getExtension("WEBGL_compressed_texture_s3tc");
if (!hasVertexTexture) {
console.error("[WebGLContext]: No vertex shader texture support");
throw "[WebGLContext]: No vertex shader texture support";
}
if (!hasFloatTexture) {
console.error("[WebGLContext]: No float texture support");
throw "[WebGLContext]: No float texture support";
}
if (!compressedTextures) {
console.warn("[WebGLContext]: No compressed textures support");
}
var refreshViewProjectionMatrix = false;
var projectionMatrix = mat4.create();
var viewMatrix = mat4.create();
var viewProjectionMatrix = mat4.create();
var matrixStack = [];
var textureStore = {};
var textureStoreById = {};
var shaderUnitStore = {};
var shaderStore = {};
var boundShader;
var boundShaderName = "";
var boundTextures = [];
var floatPrecision = "precision mediump float;\n";
var textureHandlers = {};
ctx.viewport(0, 0, element.clientWidth, element.clientHeight);
ctx.depthFunc(ctx.LEQUAL);
ctx.enable(ctx.DEPTH_TEST);
ctx.enable(ctx.CULL_FACE);
function textureOptions(wrapS, wrapT, magFilter, minFilter) {
ctx.texParameteri(ctx.TEXTURE_2D, ctx.TEXTURE_WRAP_S, wrapS);
ctx.texParameteri(ctx.TEXTURE_2D, ctx.TEXTURE_WRAP_T, wrapT);
ctx.texParameteri(ctx.TEXTURE_2D, ctx.TEXTURE_MAG_FILTER, magFilter);
ctx.texParameteri(ctx.TEXTURE_2D, ctx.TEXTURE_MIN_FILTER, minFilter);
}
/**
* Sets a perspective projection matrix.
*
* @memberof GL
* @instance
* @param {number} fovy
* @param {number} aspect
* @param {number} near
* @param {number} far
*/
function setPerspective(fovy, aspect, near, far) {
mat4.perspective(projectionMatrix, fovy, aspect, near, far);
refreshViewProjectionMatrix = true;
}
/**
* Sets an orthogonal projection matrix.
*
* @memberof GL
* @instance
* @param {number} left
* @param {number} right
* @param {number} bottom
* @param {number} top
* @param {number} near
* @param {number} far
*/
function setOrtho(left, right, bottom, top, near, far) {
mat4.ortho(projectionMatrix, left, right, bottom, top, near, far);
refreshViewProjectionMatrix = true;
}
/**
* Resets the view matrix.
*
* @memberof GL
* @instance
*/
function loadIdentity() {
mat4.identity(viewMatrix);
refreshViewProjectionMatrix = true;
}
/**
* Translates the view matrix.
*
* @memberof GL
* @instance
* @param {vec3} v Translation.
*/
function translate(v) {
mat4.translate(viewMatrix, viewMatrix, v);
refreshViewProjectionMatrix = true;
}
/**
* Rotates the view matrix.
*
* @memberof GL
* @instance
* @param {number} radians Angle.
* @param {vec3} axis The rotation axis..
*/
function rotate(radians, axis) {
mat4.rotate(viewMatrix, viewMatrix, radians, axis);
refreshViewProjectionMatrix = true;
}
/**
* Scales the view matrix.
*
* @memberof GL
* @instance
* @param {vec3} v Scaling.
*/
function scale(v) {
mat4.scale(viewMatrix, viewMatrix, v);
refreshViewProjectionMatrix = true;
}
/**
* Sets the view matrix to a look-at matrix.
*
* @memberof GL
* @instance
* @param {vec3} eye
* @param {vec3} center
* @param {vec3} up
*/
function lookAt(eye, center, up) {
mat4.lookAt(viewMatrix, eye, center, up);
refreshViewProjectionMatrix = true;
}
/**
* Multiplies the view matrix by another matrix.
*
* @memberof GL
* @instance
* @param {mat4} mat.
*/
function multMat(mat) {
mat4.multiply(viewMatrix, viewMatrix, mat);
refreshViewProjectionMatrix = true;
}
/**
* Pushes the current view matrix in the matrix stack.
*
* @memberof GL
* @instance
*/
function pushMatrix() {
matrixStack.push(mat4.clone(viewMatrix));
refreshViewProjectionMatrix = true;
}
/**
* Pops the matrix stacks and sets the popped matrix to the view matrix.
*
* @memberof GL
* @instance
*/
function popMatrix() {
viewMatrix = matrixStack.pop();
refreshViewProjectionMatrix = true;
}
/**
* Gets the view-projection matrix.
*
* @memberof GL
* @instance
* @returns {mat4} MVP.
*/
function getViewProjectionMatrix() {
if (refreshViewProjectionMatrix) {
mat4.multiply(viewProjectionMatrix, projectionMatrix, viewMatrix);
refreshViewProjectionMatrix = false;
}
return viewProjectionMatrix;
}
/**
* Gets the projection matrix.
*
* @memberof GL
* @instance
* @returns {mat4} P.
*/
function getProjectionMatrix() {
return projectionMatrix;
}
/**
* Gets the view matrix.
*
* @memberof GL
* @instance
* @returns {mat4} MV.
*/
function getViewMatrix() {
return viewMatrix;
}
function setProjectionMatrix(matrix) {
mat4.copy(projectionMatrix, matrix);
refreshViewProjectionMatrix = true;
}
function setViewMatrix(matrix) {
mat4.copy(viewMatrix, matrix);
refreshViewProjectionMatrix = true;
}
/**
* Creates a new {@link GL.ShaderUnit}, or grabs it from the cache if it was previously created, and returns it.
*
* @memberof GL
* @instance
* @param {string} source GLSL source.
* @param {number} type Shader unit type.
* @param {string} name Owning shader's name.
* @returns {GL.ShaderUnit} The created shader unit.
*/
function createShaderUnit(source, type, name) {
var hash = String.hashCode(source);
if (!shaderUnitStore[hash]) {
shaderUnitStore[hash] = new ShaderUnit(ctx, source, type, name);
}
return shaderUnitStore[hash];
}
/**
* Creates a new {@link GL.Shader} program, or grabs it from the cache if it was previously created, and returns it.
*
* @memberof GL
* @instance
* @param {string} name The name of the shader.
* @param {string} vertexSource Vertex shader GLSL source.
* @param {string} fragmentSource Fragment shader GLSL source.
* @param {array} defines An array of strings that will be added as #define-s to the shader source.
* @returns {GL.Shader?} The created shader, or a previously cached version, or null if it failed to compile and link.
*/
function createShader(name, vertexSource, fragmentSource, defines) {
if (!shaderStore[name]) {
defines = defines || [];
for (var i = 0; i < defines.length; i++) {
defines[i] = "#define " + defines[i];
}
defines = defines.join("\n") + "\n";
var vertexUnit = createShaderUnit(defines + vertexSource, ctx.VERTEX_SHADER, name);
var fragmentUnit = createShaderUnit(floatPrecision + defines + fragmentSource, ctx.FRAGMENT_SHADER, name);
if (vertexUnit.ready && fragmentUnit.ready) {
shaderStore[name] = new Shader(ctx, name, vertexUnit, fragmentUnit);
}
}
if (shaderStore[name] && shaderStore[name].ready) {
return shaderStore[name];
}
}
/**
* Checks if a shader is ready for use.
*
* @memberof GL
* @instance
* @param {string} name The name of the shader.
* @returns {boolean} The shader's status.
*/
function shaderStatus(name) {
var shader = shaderStore[name];
return shader && shader.ready;
}
/**
* Enables the WebGL vertex attribute arrays in the range defined by start-end.
*
* @memberof GL
* @instance
* @param {number} start The first attribute.
* @param {number} end The last attribute.
*/
function enableVertexAttribs(start, end) {
for (var i = start; i < end; i++) {
ctx.enableVertexAttribArray(i);
}
}
/**
* Disables the WebGL vertex attribute arrays in the range defined by start-end.
*
* @memberof GL
* @instance
* @param {number} start The first attribute.
* @param {number} end The last attribute.
*/
function disableVertexAttribs(start, end) {
for (var i = start; i < end; i++) {
ctx.disableVertexAttribArray(i);
}
}
/**
* Binds a shader. This automatically handles the vertex attribute arrays. Returns the currently bound shader.
*
* @memberof GL
* @instance
* @param {string} name The name of the shader.
* @returns {GL.Shader} The bound shader.
*/
function bindShader(name) {
var shader = shaderStore[name];
if (shader && (!boundShader || boundShader.id !== shader.id)) {
var oldAttribs = 0;
if (boundShader) {
oldAttribs = boundShader.attribs;
}
var newAttribs = shader.attribs;
ctx.useProgram(shader.id);
if (newAttribs > oldAttribs) {
enableVertexAttribs(oldAttribs, newAttribs);
} else if (newAttribs < oldAttribs) {
disableVertexAttribs(newAttribs, oldAttribs);
}
boundShaderName = name;
boundShader = shader;
}
return boundShader;
}
/**
* Loads a texture, with optional options that will be sent to the texture's constructor,
* If the texture was already loaded previously, it returns it.
*
* @memberof GL
* @instance
* @param {string} source The texture's url.
* @param {object} options Options.
*/
function loadTexture(source, fileType, isFromMemory, options) {
if (!textureStore[source]) {
textureStore[source] = new AsyncTexture(source, fileType, options, textureHandlers, ctx, compressedTextures, callbacks, isFromMemory);
textureStoreById[textureStore[source].id] = textureStore[source];
}
return textureStore[source];
}
/**
* Unloads a texture.
*
* @memberof GL
* @instance
* @param {string} source The texture's url.
*/
function removeTexture(source) {
if (textureStore[source]) {
callbacks.onremove(textureStore[source]);
delete textureStore[source];
}
}
function textureLoaded(source) {
var texture = textureStore[source];
return (texture && texture.loaded());
}
/**
* Binds a texture to the specified texture unit.
*
* @memberof GL
* @instance
* @param {(string|null)} object A texture source.
* @param {number} [unit] The texture unit.
*/
function bindTexture(source, unit) {
//console.log(source);
var texture;
unit = unit || 0;
if (typeof source === "string") {
texture = textureStore[source];
} else if (typeof source === "number") {
texture = textureStoreById[source];
}
if (texture && texture.impl && texture.impl.ready) {
// Only bind if actually necessary
if (!boundTextures[unit] || boundTextures[unit].id !== texture.id) {
boundTextures[unit] = texture.impl;
ctx.activeTexture(ctx.TEXTURE0 + unit);
ctx.bindTexture(ctx.TEXTURE_2D, texture.impl.id);
}
} else {
boundTextures[unit] = null;
ctx.activeTexture(ctx.TEXTURE0 + unit);
ctx.bindTexture(ctx.TEXTURE_2D, null);
}
}
/**
* Creates a new {@link GL.Rect} and returns it.
*
* @memberof GL
* @instance
* @param {number} x X coordinate.
* @param {number} y Y coordinate.
* @param {number} z Z coordinate.
* @param {number} hw Half of the width.
* @param {number} hh Half of the height.
* @param {number} stscale A scale that is applied to the texture coordinates.
* @returns {GL.Rect} The rectangle.
*/
function createRect(x, y, z, hw, hh, stscale) {
return new Rect(ctx, x, y, z, hw, hh, stscale);
}
/**
* Creates a new {@link GL.Cube} and returns it.
*
* @memberof GL
* @instance
* @param {number} x1 Minimum X coordinate.
* @param {number} y1 Minimum Y coordinate.
* @param {number} z1 Minimum Z coordinate.
* @param {number} x2 Maximum X coordinate.
* @param {number} y2 Maximum Y coordinate.
* @param {number} z2 Maximum Z coordinate.
* @returns {GL.Cube} The cube.
*/
function createCube(x1, y1, z1, x2, y2, z2) {
return new Cube(ctx, x1, y1, z1, x2, y2, z2);
}
/**
* Creates a new {@link GL.Sphere} and returns it.
*
* @memberof GL
* @instance
* @param {number} x X coordinate.
* @param {number} y Y coordinate.
* @param {number} z Z coordinate.
* @param {number} latitudeBands Latitude bands.
* @param {number} longitudeBands Longitude bands.
* @param {number} radius The sphere radius.
* @returns {GL.Sphere} The sphere.
*/
function createSphere(x, y, z, latitudeBands, longitudeBands, radius) {
return new Sphere(ctx, x, y, z, latitudeBands, longitudeBands, radius);
}
/**
* Creates a new {@link GL.Cylinder} and returns it.
*
* @memberof GL
* @instance
* @param {number} x X coordinate.
* @param {number} y Y coordinate.
* @param {number} z Z coordinate.
* @param {number} r The cylinder radius.
* @param {number} h The cylinder height.
* @param {number} bands Number of bands..
* @returns {GL.Cylinder} The cylinder.
*/
function createCylinder(x, y, z, r, h, bands) {
return new Cylinder(ctx, x, y, z, r, h, bands);
}
/**
* Registers an external handler for an unsupported texture type.
*
* @memberof GL
* @instance
* @param {string} fileType The file format the handler handles.
* @param {function} textureHandler
*/
function registerTextureHandler(fileType, textureHandler) {
textureHandlers[fileType] = textureHandler;
}
textureHandlers[".png"] = NativeTexture;
textureHandlers[".gif"] = NativeTexture;
textureHandlers[".jpg"] = NativeTexture;
return {
setPerspective: setPerspective,
setOrtho: setOrtho,
loadIdentity: loadIdentity,
translate: translate,
rotate: rotate,
scale: scale,
lookAt: lookAt,
multMat: multMat,
pushMatrix: pushMatrix,
popMatrix: popMatrix,
createShader: createShader,
shaderStatus: shaderStatus,
bindShader: bindShader,
getViewProjectionMatrix: getViewProjectionMatrix,
getProjectionMatrix: getProjectionMatrix,
getViewMatrix: getViewMatrix,
setProjectionMatrix: setProjectionMatrix,
setViewMatrix: setViewMatrix,
loadTexture: loadTexture,
removeTexture: removeTexture,
textureLoaded: textureLoaded,
textureOptions: textureOptions,
bindTexture: bindTexture,
createRect: createRect,
createSphere: createSphere,
createCube: createCube,
createCylinder: createCylinder,
ctx: ctx,
registerTextureHandler: registerTextureHandler
};
}
| emnh/mdx-m3-viewer | src/gl/gl.js | JavaScript | mit | 15,053 | [
30522,
1013,
1008,
1008,
1008,
1030,
2465,
1037,
10236,
4842,
2105,
4773,
23296,
1012,
1008,
1030,
2171,
1043,
2140,
1008,
1030,
11498,
2213,
1063,
16129,
9336,
12044,
12260,
3672,
1065,
5783,
1037,
10683,
5783,
1012,
1008,
1030,
11498,
221... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
require 'rubygems/dependency'
require 'bundler/shared_helpers'
require 'bundler/rubygems_ext'
module Bundler
class Dependency < Gem::Dependency
attr_reader :autorequire
attr_reader :groups
attr_reader :platforms
PLATFORM_MAP = {
:ruby => Gem::Platform::RUBY,
:ruby_18 => Gem::Platform::RUBY,
:ruby_19 => Gem::Platform::RUBY,
:mri => Gem::Platform::RUBY,
:mri_18 => Gem::Platform::RUBY,
:mri_19 => Gem::Platform::RUBY,
:rbx => Gem::Platform::RUBY,
:jruby => Gem::Platform::JAVA,
:mswin => Gem::Platform::MSWIN,
:mingw => Gem::Platform::MINGW,
:mingw_18 => Gem::Platform::MINGW,
:mingw_19 => Gem::Platform::MINGW
}.freeze
def initialize(name, version, options = {}, &blk)
type = options["type"] || :runtime
super(name, version, type)
@autorequire = nil
@groups = Array(options["group"] || :default).map { |g| g.to_sym }
@source = options["source"]
@platforms = Array(options["platforms"])
@env = options["env"]
if options.key?('require')
@autorequire = Array(options['require'] || [])
end
end
def gem_platforms(valid_platforms)
return valid_platforms if @platforms.empty?
platforms = []
@platforms.each do |p|
platform = PLATFORM_MAP[p]
next unless valid_platforms.include?(platform)
platforms |= [platform]
end
platforms
end
def should_include?
current_env? && current_platform?
end
def current_env?
return true unless @env
if Hash === @env
@env.all? do |key, val|
ENV[key.to_s] && (String === val ? ENV[key.to_s] == val : ENV[key.to_s] =~ val)
end
else
ENV[@env.to_s]
end
end
def current_platform?
return true if @platforms.empty?
@platforms.any? { |p| send("#{p}?") }
end
def to_lock
out = super
out << '!' if source
out << "\n"
end
private
def ruby?
!mswin? && (!defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby" || RUBY_ENGINE == "rbx" || RUBY_ENGINE == "maglev")
end
def ruby_18?
ruby? && RUBY_VERSION < "1.9"
end
def ruby_19?
ruby? && RUBY_VERSION >= "1.9" && RUBY_VERSION < "2.0"
end
def mri?
!mswin? && (!defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby")
end
def mri_18?
mri? && RUBY_VERSION < "1.9"
end
def mri_19?
mri? && RUBY_VERSION >= "1.9" && RUBY_VERSION < "2.0"
end
def rbx?
ruby? && defined?(RUBY_ENGINE) && RUBY_ENGINE == "rbx"
end
def jruby?
defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
end
def maglev?
defined?(RUBY_ENGINE) && RUBY_ENGINE == "maglev"
end
def mswin?
Bundler::WINDOWS
end
def mingw?
Bundler::WINDOWS && Gem::Platform.local.os == "mingw32"
end
def mingw_18?
mingw? && RUBY_VERSION < "1.9"
end
def mingw_19?
mingw? && RUBY_VERSION >= "1.9"
end
end
end
| dwo/panicbutton | vendor/gems/bundler-1.1.0/lib/bundler/dependency.rb | Ruby | mit | 3,095 | [
30522,
5478,
1005,
10090,
3351,
5244,
1013,
24394,
1005,
5478,
1005,
14012,
2099,
1013,
4207,
1035,
2393,
2545,
1005,
5478,
1005,
14012,
2099,
1013,
10090,
3351,
5244,
1035,
4654,
2102,
1005,
11336,
14012,
2099,
2465,
24394,
1026,
17070,
30... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
namespace Omelet\Module;
use Doctrine\DBAL\Driver\Connection;
use Ray\Di\AbstractModule;
use Ray\Di\Scope;
use Ray\Di\Name;
use Ray\DbalModule\DbalModule;
use Omelet\Builder\Configuration;
use Omelet\Builder\DaoBuilderContext;
class DaoBuilderBearModule extends AbstractModule {
/**
* @var Configuration
*/
private $config;
/**
* @var array
*/
private $interfaces;
public function __construct(Configuration $config, array $interfaces)
{
$this->config = $config;
$this->interfaces = $interfaces;
}
/**
* {@inheritdoc}
*/
protected function configure()
{
$context = new DaoBuilderContext($this->config);
$this->bind(DaoBuilderContext::class)->toInstance($context);
$this->install(new DbalModule($context->connectionString()));
$this->getContainer()->move(Connection::class, Name::ANY, Connection::class, 'SqlLogger');
$this->bind(Connection::class)->toProvider(SqlLoggerProvider::class);
foreach ($this->interfaces as $intf) {
$context->build($intf);
$this->bind($intf)->to($context->getDaoClassName($intf))->in(Scope::SINGLETON);
}
}
}
| ritalin/omelet-bear-module | src/Module/DaoBuilderBearModule.php | PHP | mit | 1,281 | [
30522,
1026,
1029,
25718,
3415,
15327,
18168,
12260,
2102,
1032,
11336,
1025,
2224,
8998,
1032,
16962,
2389,
1032,
4062,
1032,
4434,
1025,
2224,
4097,
1032,
4487,
1032,
10061,
5302,
8566,
2571,
1025,
2224,
4097,
1032,
4487,
1032,
9531,
1025... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#ifndef DB_CLUSTER_H
#define DB_CLUSTER_H
#include <stdint.h>
#include <assert.h>
#include <util/atomic.h>
#include <raft/raft.pb.h>
namespace db {
class Cluster {
public:
explicit Cluster(const raft::Config &config)
: config_(config) {
util::atomic_set(&refs_, 0);
}
/*
* Reference count management (so Cluster do not disappear out from
* under live iterators)
*/
void Ref() {
util::atomic_inc(&refs_);
}
void Unref() {
assert(util::atomic_read(&refs_) >= 1);
if (util::atomic_dec_and_test(&refs_)) {
delete this;
}
}
const raft::Config& config() const { return config_; }
private:
util::atomic_t refs_;
raft::Config config_;
private:
/* Private since only Unref() should be used to delete it */
~Cluster() { }
/* No copying allowed */
Cluster(const Cluster &);
void operator=(const Cluster &);
};
} // namespace db
#endif /* DB_CLUSTER_H */
| jgli/maya | maya/db/cluster.h | C | bsd-3-clause | 991 | [
30522,
1001,
2065,
13629,
2546,
16962,
1035,
9324,
1035,
1044,
1001,
9375,
16962,
1035,
9324,
1035,
1044,
1001,
2421,
1026,
2358,
8718,
2102,
1012,
1044,
1028,
1001,
2421,
1026,
20865,
1012,
1044,
1028,
1001,
2421,
1026,
21183,
4014,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jsonp({"cep":"04087007","logradouro":"Alameda dos Anapurus","bairro":"Indian\u00f3polis","cidade":"S\u00e3o Paulo","uf":"SP","estado":"S\u00e3o Paulo"});
| lfreneda/cepdb | api/v1/04087007.jsonp.js | JavaScript | cc0-1.0 | 154 | [
30522,
1046,
3385,
2361,
1006,
1063,
1000,
8292,
2361,
1000,
1024,
1000,
5840,
2692,
2620,
19841,
2692,
2581,
1000,
1010,
1000,
8833,
12173,
8162,
2080,
1000,
1024,
1000,
26234,
11960,
9998,
9617,
5311,
2271,
1000,
1010,
1000,
21790,
18933,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
'''
' configurationGui.py
' Author: Iker Pedrosa
'
' License:
' This file is part of orderedFileCopy.
'
' orderedFileCopy 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.
'
' orderedFileCopy 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 orderedFileCopy. If not, see <http://www.gnu.org/licenses/>.
'
'''
#Imported modules
from Tkinter import *
from fileManager import *
import tkFileDialog
import globals
#Global variables
class configurationGUI:
def __init__(self, master):
master.grab_set()
#The contrary is master.grab_release()
#Window title
self.master = master
master.title("Configuration menu")
#Window position and size
windowWidth = 600
windowHeight = 150
screenWidth = master.winfo_screenwidth()
screenHeight = master.winfo_screenheight()
print("configurationGui: screenWidth %d" % screenWidth)
print("configurationGui: screenHeight %d" % screenHeight)
windowWidthPosition = (screenWidth - windowWidth) / 2
windowHeightPosition = ((screenHeight - windowHeight) / 2) - windowHeight
print("configurationGui: windowWidthPosition %d" % windowWidthPosition)
print("configurationGui: windowHeightPosition %d" % windowHeightPosition)
master.geometry("%dx%d+%d+%d" % (windowWidth, windowHeight, windowWidthPosition, windowHeightPosition))
#Create layouts
top_frame = Frame(master, width = 600, height = 50)
centre_frame = Frame(master, width = 600, height = 50)
below_frame = Frame(master, width = 600, height = 50)
bottom_frame = Frame(master, width = 600, height = 50)
top_frame.grid(row = 0)
centre_frame.grid(row = 1)
below_frame.grid(row = 2)
bottom_frame.grid(row = 3)
#Extension information
self.labelExtension = Label(top_frame, height = 1, width = 30, font = ("Helvetica", 11), text = "File extension to copy:")
self.labelExtension.grid(row = 0, column = 0)
self.textExtension = Text(top_frame, height = 1, width = 5, font = ("Helvetica", 11))
self.textExtension.grid(row = 0, column = 1)
self.textExtension.insert(END, globals.extension)
#Default origin information
globals.windowDefaultOrigin = StringVar()
globals.windowDefaultOrigin.set(globals.selectedDefaultOrigin)
self.textDefaultOriginPath = Entry(centre_frame, width = 55, font = ("Helvetica", 11), textvariable = globals.windowDefaultOrigin)
self.textDefaultOriginPath.grid(row = 1, column = 0)
self.buttonDefaultOriginPath = Button(centre_frame, text = "...", command = self.defaultOriginFileChooser)
self.buttonDefaultOriginPath.grid(row = 1, column = 1, padx = 10)
#Destination by USB information
self.labelUsb = Label(below_frame, width = 15, font = ("Helvetica", 11), text = "Destination by USB")
self.labelUsb.grid(row = 0, column = 0)
self.localUsbState = IntVar()
self.localUsbState.set(globals.selectedUsbState)
self.checkboxUsb = Checkbutton(below_frame, command = self.activateUsbName, variable = self.localUsbState, onvalue=1, offvalue=0)
self.checkboxUsb.grid(row = 0, column = 1)
self.textUsb = Text(below_frame, height = 1, width = 25, font = ("Helvetica", 11), state = "disabled")
self.textUsb.grid(row = 0, column = 2)
if globals.selectedUsbState == 1:
self.textUsb.configure(state = "normal")
else:
self.textUsb.configure(state = "disabled")
self.textUsb.insert(END, globals.selectedUsbName)
#Buttons
self.buttonAccept = Button(bottom_frame, text = "Accept", command = self.accept)
self.buttonAccept.grid(row = 2, column = 0, padx = 25, pady = 20)
self.buttonCancel = Button(bottom_frame, text = "Cancel", command = self.cancel)
self.buttonCancel.grid(row = 2, column = 1, padx = 25, pady = 20)
#Finished __init__
def defaultOriginFileChooser(self):
resultPath = tkFileDialog.askdirectory(initialdir = globals.selectedDefaultOrigin) + "/"
if resultPath != "/" and resultPath != "":
globals.selectedDefaultOrigin = resultPath.encode("utf-8")
globals.windowDefaultOrigin.set(globals.selectedDefaultOrigin)
#Finished originFileChooser
def accept(self):
globals.extension = self.textExtension.get("1.0", "end-1c")
globals.selectedUsbName = self.textUsb.get("1.0", "end-1c")
writeConfiguration()
print("accept: globals.selectedDefaultOrigin '%s'" % globals.selectedDefaultOrigin)
print("accept: globals.extension '%s'" % globals.extension)
self.master.destroy()
#Finished accept
def activateUsbName(self):
if self.localUsbState.get() == 1:
globals.selectedUsbState = 1
self.textUsb.configure(state = "normal")
self.textUsb.insert(END, globals.selectedUsbName)
else:
globals.selectedUsbState = 0
self.textUsb.delete("1.0", END)
self.textUsb.configure(state = "disabled")
#Finished activateUsbName
def cancel(self):
self.master.destroy()
#Finished cancel
#Finished configurationGUI
| ikerexxe/orderedFileCopy | configurationGui.py | Python | gpl-3.0 | 5,243 | [
30522,
1005,
1005,
1005,
1005,
9563,
25698,
1012,
1052,
2100,
1005,
3166,
1024,
25209,
2099,
7707,
3736,
1005,
1005,
6105,
1024,
1005,
2023,
5371,
2003,
2112,
1997,
3641,
8873,
2571,
3597,
7685,
1012,
1005,
1005,
3641,
8873,
2571,
3597,
7... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (c) 2016, baihw (javakf@163.com).
*
* 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.yoya.rdf.router;
/**
* Created by baihw on 16-6-13.
*
* 统一的服务请求处理器规范接口,此接口用于标识类文件为请求处理器实现类,无必须实现的方法。
*
* 实现类中所有符合public void xxx( IRequest request, IResponse response )签名规则的方法都将被自动注册到对应的请求处理器中。
*
* 如下所示:
*
* public void login( IRequest request, IResponse response ){};
*
* public void logout( IRequest request, IResponse response ){} ;
*
* 上边的login, logout将被自动注册到请求处理器路径中。
*
* 假如类名为LoginHnadler, 则注册的处理路径为:/Loginhandler/login, /Loginhandler/logout.
*
* 注意:大小写敏感。
*
*/
public interface IRequestHandler{
/**
* 当请求中没有明确指定处理方法时,默认执行的请求处理方法。
*
* @param request 请求对象
* @param response 响应对象
*/
void handle( IRequest request, IResponse response );
} // end class
| javakf/rdf | src/main/java/com/yoya/rdf/router/IRequestHandler.java | Java | apache-2.0 | 1,692 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2355,
1010,
21790,
2232,
2860,
1006,
9262,
2243,
2546,
1030,
17867,
1012,
4012,
1007,
1012,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
30524,
1011,
1016,
1012,
1014,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<img src="https://avatars0.githubusercontent.com/u/1342004?v=3&s=96" alt="Google Inc. logo" title="Google" align="right" height="96" width="96"/>
# customsearch
> Searches over a website or collection of websites
## Installation
```sh
$ npm install @googleapis/customsearch
```
## Usage
All documentation and usage information can be found on [GitHub](https://github.com/googleapis/google-api-nodejs-client).
Information on classes can be found in [Googleapis Documentation](https://googleapis.dev/nodejs/googleapis/latest/customsearch/classes/Customsearch.html).
## License
This library is licensed under Apache 2.0. Full license text is available in [LICENSE](https://github.com/googleapis/google-api-nodejs-client/blob/main/LICENSE).
## Contributing
We love contributions! Before submitting a Pull Request, it's always good to start with a new issue first. To learn more, see [CONTRIBUTING](https://github.com/google/google-api-nodejs-client/blob/main/.github/CONTRIBUTING.md).
## Questions/problems?
* Ask your development related questions on [StackOverflow](http://stackoverflow.com/questions/tagged/google-api-nodejs-client).
* If you've found an bug/issue, please [file it on GitHub](https://github.com/googleapis/google-api-nodejs-client/issues).
*Crafted with ❤️ by the Google Node.js team*
| googleapis/google-api-nodejs-client | src/apis/customsearch/README.md | Markdown | apache-2.0 | 1,315 | [
30522,
1026,
10047,
2290,
5034,
2278,
1027,
1000,
16770,
1024,
1013,
1013,
22128,
2015,
2692,
1012,
21025,
2705,
12083,
20330,
8663,
6528,
2102,
1012,
4012,
1013,
1057,
1013,
15170,
28332,
2549,
1029,
1058,
1027,
1017,
1004,
1055,
1027,
598... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
FreeCS Project
Copyright (C) 2016, 2017 Marco "eukara" Hladik
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.
*/
/*
TODO: This gamemode is odd about balancing, right now the last surviving terrorist
will decide the match. Still have to think about what rules to set up.
*/
/*
=================
func_escapezone_touch
=================
*/
void func_escapezone_touch( void ) {
if ( ( other.classname == "player" ) && ( other.team == TEAM_T ) ) {
entity eOld = self;
self = other;
Spawn_MakeSpectator();
self.classname = "player";
forceinfokey( self, "*dead", "0" );
iAlivePlayers_T--;
self = eOld;
if ( iAlivePlayers_T == 0 ) {
Rules_RoundOver( TEAM_T, 2500, FALSE );
}
}
}
/*
=================
SPAWN: func_escapezone
Entry function for the terrorist escape zone
=================
*/
void func_escapezone( void ) {
self.angles = '0 0 0';
self.movetype = MOVETYPE_NONE;
self.solid = SOLID_TRIGGER;
if ( self.model ) {
setmodel( self, self.model );
} else {
setsize( self, self.mins, self.maxs );
}
self.model = 0;
self.touch = func_escapezone_touch;
iEscapeZones++;
}
| eukos16/OpenCS | Source/Server/FuncEscapeZone.c | C | gpl-2.0 | 1,759 | [
30522,
1013,
1008,
2489,
6169,
30524,
2355,
1010,
2418,
8879,
1000,
7327,
16566,
1000,
1044,
27266,
5480,
2023,
2565,
2003,
2489,
4007,
1025,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1998,
1013,
2030,
19933,
2009,
2104,
1996,
3408,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
class CfSim::Portal
attr_reader :name, :latitude, :longitude
def initialize(name, latitude, longitude)
@name = name
@latitude = latitude
@longitude = longitude
end
def ==(other)
eql?(other)
end
def eql?(other)
@name == other.name && @latitude == other.latitude && @longitude == other.longitude
end
def hash
@name.hash + @latitude + @longitude
end
def to_s
"#{name}(#{latitude}, #{longitude})"
end
end
| pinzolo/cf_sim | lib/cf_sim/portal.rb | Ruby | mit | 456 | [
30522,
2465,
12935,
5332,
2213,
1024,
1024,
9445,
2012,
16344,
1035,
8068,
1024,
2171,
1010,
1024,
15250,
1010,
1024,
20413,
13366,
3988,
4697,
1006,
2171,
1010,
15250,
1010,
20413,
1007,
1030,
2171,
1027,
2171,
1030,
15250,
1027,
15250,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# -*- coding: utf-8 -*-
from __future__ import division
# -*- coding: utf-8 -*-
#
# Sphinx documentation build configuration file, created by
# sphinx-quickstart.py on Sat Mar 8 21:47:50 2008.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pickleable (module imports are okay, they're removed automatically).
#
# All configuration values have a default value; values that are commented out
# serve to show the default value.
import sys, os, re
# If your extensions are in another directory, add it here.
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
# General configuration
# ---------------------
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.addons.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# General substitutions.
project = 'SpiffWorkflow'
copyright = '2012 ' + ', '.join(open('../AUTHORS').readlines())
# The default replacements for |version| and |release|, also used in various
# other places throughout the built documents.
#
# The short X.Y version.
import SpiffWorkflow
version = SpiffWorkflow.__version__
# The full version, including alpha/beta/rc tags.
release = version
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of documents that shouldn't be included in the build.
#unused_docs = []
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
show_authors = True
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'friendly'
# Options for HTML output
# -----------------------
# The style sheet to use for HTML and HTML Help pages. A file of that name
# must exist either in Sphinx' static/ path, or in one of the custom paths
# given in html_static_path.
html_style = 'sphinxdoc.css'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['figures']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Content template for the index page.
html_index = 'index.html'
# Custom sidebar templates, maps page names to templates.
html_sidebars = {'index': 'indexsidebar.html'}
# Additional templates that should be rendered to pages, maps page names to
# templates.
html_additional_pages = {'index': 'index.html'}
# If true, the reST sources are included in the HTML build as _sources/<name>.
#html_copy_source = True
html_use_opensearch = 'http://sphinx.pocoo.org'
# Output file base name for HTML help builder.
htmlhelp_basename = 'Sphinxdoc'
# Options for LaTeX output
# ------------------------
# The paper size ('letter' or 'a4').
#latex_paper_size = 'letter'
# The font size ('10pt', '11pt' or '12pt').
#latex_font_size = '10pt'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, document class [howto/manual]).
latex_documents = [('contents', 'sphinx.tex', 'Sphinx Documentation',
'Georg Brandl', 'manual', 1)]
latex_logo = '_static/sphinx.png'
#latex_use_parts = True
# Additional stuff for the LaTeX preamble.
latex_elements = {
'fontpkg': '\\usepackage{palatino}'
}
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# Extension interface
# -------------------
from sphinx import addnodes
dir_sig_re = re.compile(r'\.\. ([^:]+)::(.*)$')
def parse_directive(env, sig, signode):
if not sig.startswith('.'):
dec_sig = '.. %s::' % sig
signode += addnodes.desc_name(dec_sig, dec_sig)
return sig
m = dir_sig_re.match(sig)
if not m:
signode += addnodes.desc_name(sig, sig)
return sig
name, args = m.groups()
dec_name = '.. %s::' % name
signode += addnodes.desc_name(dec_name, dec_name)
signode += addnodes.desc_addname(args, args)
return name
def parse_role(env, sig, signode):
signode += addnodes.desc_name(':%s:' % sig, ':%s:' % sig)
return sig
event_sig_re = re.compile(r'([a-zA-Z-]+)\s*\((.*)\)')
def parse_event(env, sig, signode):
m = event_sig_re.match(sig)
if not m:
signode += addnodes.desc_name(sig, sig)
return sig
name, args = m.groups()
signode += addnodes.desc_name(name, name)
plist = addnodes.desc_parameterlist()
for arg in args.split(','):
arg = arg.strip()
plist += addnodes.desc_parameter(arg, arg)
signode += plist
return name
def setup(app):
from sphinx.ext.autodoc import cut_lines
app.connect('autodoc-process-docstring', cut_lines(4, what=['module']))
app.add_description_unit('directive', 'dir', 'pair: %s; directive', parse_directive)
app.add_description_unit('role', 'role', 'pair: %s; role', parse_role)
app.add_description_unit('confval', 'confval', 'pair: %s; configuration value')
app.add_description_unit('event', 'event', 'pair: %s; event', parse_event) | zetaops/SpiffWorkflow | doc/conf.py | Python | lgpl-3.0 | 5,907 | [
30522,
1001,
1011,
1008,
1011,
16861,
1024,
21183,
2546,
1011,
1022,
1011,
1008,
1011,
2013,
1035,
1035,
2925,
1035,
1035,
12324,
2407,
1001,
1011,
1008,
1011,
16861,
1024,
21183,
2546,
1011,
1022,
1011,
1008,
1011,
1001,
1001,
27311,
12653... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Roslyn.Utilities;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using static Microsoft.CodeAnalysis.CommandLine.BuildProtocolConstants;
using static Microsoft.CodeAnalysis.CommandLine.CompilerServerLogger;
// This file describes data structures about the protocol from client program to server that is
// used. The basic protocol is this.
//
// After the server pipe is connected, it forks off a thread to handle the connection, and creates
// a new instance of the pipe to listen for new clients. When it gets a request, it validates
// the security and elevation level of the client. If that fails, it disconnects the client. Otherwise,
// it handles the request, sends a response (described by Response class) back to the client, then
// disconnects the pipe and ends the thread.
namespace Microsoft.CodeAnalysis.CommandLine
{
/// <summary>
/// Represents a request from the client. A request is as follows.
///
/// Field Name Type Size (bytes)
/// ----------------------------------------------------
/// Length Integer 4
/// RequestId Guid 16
/// Language RequestLanguage 4
/// CompilerHash String Variable
/// Argument Count UInteger 4
/// Arguments Argument[] Variable
///
/// See <see cref="Argument"/> for the format of an
/// Argument.
///
/// </summary>
internal class BuildRequest
{
/// <summary>
/// The maximum size of a request supported by the compiler server.
/// </summary>
/// <remarks>
/// Currently this limit is 5MB.
/// </remarks>
private const int MaximumRequestSize = 0x500000;
public readonly Guid RequestId;
public readonly RequestLanguage Language;
public readonly ReadOnlyCollection<Argument> Arguments;
public readonly string CompilerHash;
public BuildRequest(RequestLanguage language,
string compilerHash,
IEnumerable<Argument> arguments,
Guid? requestId = null)
{
RequestId = requestId ?? Guid.Empty;
Language = language;
Arguments = new ReadOnlyCollection<Argument>(arguments.ToList());
CompilerHash = compilerHash;
Debug.Assert(!string.IsNullOrWhiteSpace(CompilerHash), "A hash value is required to communicate with the server");
if (Arguments.Count > ushort.MaxValue)
{
throw new ArgumentOutOfRangeException(nameof(arguments),
"Too many arguments: maximum of "
+ ushort.MaxValue + " arguments allowed.");
}
}
public static BuildRequest Create(RequestLanguage language,
IList<string> args,
string workingDirectory,
string tempDirectory,
string compilerHash,
Guid? requestId = null,
string? keepAlive = null,
string? libDirectory = null)
{
Debug.Assert(!string.IsNullOrWhiteSpace(compilerHash), "CompilerHash is required to send request to the build server");
var requestLength = args.Count + 1 + (libDirectory == null ? 0 : 1);
var requestArgs = new List<Argument>(requestLength);
requestArgs.Add(new Argument(ArgumentId.CurrentDirectory, 0, workingDirectory));
requestArgs.Add(new Argument(ArgumentId.TempDirectory, 0, tempDirectory));
if (keepAlive != null)
{
requestArgs.Add(new Argument(ArgumentId.KeepAlive, 0, keepAlive));
}
if (libDirectory != null)
{
requestArgs.Add(new Argument(ArgumentId.LibEnvVariable, 0, libDirectory));
}
for (int i = 0; i < args.Count; ++i)
{
var arg = args[i];
requestArgs.Add(new Argument(ArgumentId.CommandLineArgument, i, arg));
}
return new BuildRequest(language, compilerHash, requestArgs, requestId);
}
public static BuildRequest CreateShutdown()
{
var requestArgs = new[] { new Argument(ArgumentId.Shutdown, argumentIndex: 0, value: "") };
return new BuildRequest(RequestLanguage.CSharpCompile, GetCommitHash() ?? "", requestArgs);
}
/// <summary>
/// Read a Request from the given stream.
///
/// The total request size must be less than <see cref="MaximumRequestSize"/>.
/// </summary>
/// <returns>null if the Request was too large, the Request otherwise.</returns>
public static async Task<BuildRequest> ReadAsync(Stream inStream, CancellationToken cancellationToken)
{
// Read the length of the request
var lengthBuffer = new byte[4];
await ReadAllAsync(inStream, lengthBuffer, 4, cancellationToken).ConfigureAwait(false);
var length = BitConverter.ToInt32(lengthBuffer, 0);
// Back out if the request is too large
if (length > MaximumRequestSize)
{
throw new ArgumentException($"Request is over {MaximumRequestSize >> 20}MB in length");
}
cancellationToken.ThrowIfCancellationRequested();
// Read the full request
var requestBuffer = new byte[length];
await ReadAllAsync(inStream, requestBuffer, length, cancellationToken).ConfigureAwait(false);
cancellationToken.ThrowIfCancellationRequested();
// Parse the request into the Request data structure.
using var reader = new BinaryReader(new MemoryStream(requestBuffer), Encoding.Unicode);
var requestId = readGuid(reader);
var language = (RequestLanguage)reader.ReadUInt32();
var compilerHash = reader.ReadString();
uint argumentCount = reader.ReadUInt32();
var argumentsBuilder = new List<Argument>((int)argumentCount);
for (int i = 0; i < argumentCount; i++)
{
cancellationToken.ThrowIfCancellationRequested();
argumentsBuilder.Add(BuildRequest.Argument.ReadFromBinaryReader(reader));
}
return new BuildRequest(language,
compilerHash,
argumentsBuilder,
requestId);
static Guid readGuid(BinaryReader reader)
{
const int size = 16;
var bytes = new byte[size];
if (size != reader.Read(bytes, 0, size))
{
throw new InvalidOperationException();
}
return new Guid(bytes);
}
}
/// <summary>
/// Write a Request to the stream.
/// </summary>
public async Task WriteAsync(Stream outStream, CancellationToken cancellationToken = default(CancellationToken))
{
using var memoryStream = new MemoryStream();
using var writer = new BinaryWriter(memoryStream, Encoding.Unicode);
writer.Write(RequestId.ToByteArray());
writer.Write((uint)Language);
writer.Write(CompilerHash);
writer.Write(Arguments.Count);
foreach (Argument arg in Arguments)
{
cancellationToken.ThrowIfCancellationRequested();
arg.WriteToBinaryWriter(writer);
}
writer.Flush();
cancellationToken.ThrowIfCancellationRequested();
// Write the length of the request
int length = checked((int)memoryStream.Length);
// Back out if the request is too large
if (memoryStream.Length > MaximumRequestSize)
{
throw new ArgumentOutOfRangeException($"Request is over {MaximumRequestSize >> 20}MB in length");
}
await outStream.WriteAsync(BitConverter.GetBytes(length), 0, 4,
cancellationToken).ConfigureAwait(false);
memoryStream.Position = 0;
await memoryStream.CopyToAsync(outStream, bufferSize: length, cancellationToken: cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// A command line argument to the compilation.
/// An argument is formatted as follows:
///
/// Field Name Type Size (bytes)
/// --------------------------------------------------
/// ID UInteger 4
/// Index UInteger 4
/// Value String Variable
///
/// Strings are encoded via a length prefix as a signed
/// 32-bit integer, followed by an array of characters.
/// </summary>
public struct Argument
{
public readonly ArgumentId ArgumentId;
public readonly int ArgumentIndex;
public readonly string? Value;
public Argument(ArgumentId argumentId,
int argumentIndex,
string? value)
{
ArgumentId = argumentId;
ArgumentIndex = argumentIndex;
Value = value;
}
public static Argument ReadFromBinaryReader(BinaryReader reader)
{
var argId = (ArgumentId)reader.ReadInt32();
var argIndex = reader.ReadInt32();
string? value = ReadLengthPrefixedString(reader);
return new Argument(argId, argIndex, value);
}
public void WriteToBinaryWriter(BinaryWriter writer)
{
writer.Write((int)ArgumentId);
writer.Write(ArgumentIndex);
WriteLengthPrefixedString(writer, Value);
}
}
}
/// <summary>
/// Base class for all possible responses to a request.
/// The ResponseType enum should list all possible response types
/// and ReadResponse creates the appropriate response subclass based
/// on the response type sent by the client.
/// The format of a response is:
///
/// Field Name Field Type Size (bytes)
/// -------------------------------------------------
/// responseLength int (positive) 4
/// responseType enum ResponseType 4
/// responseBody Response subclass variable
/// </summary>
internal abstract class BuildResponse
{
public enum ResponseType
{
// The client and server are using incompatible protocol versions.
MismatchedVersion,
// The build request completed on the server and the results are contained
// in the message.
Completed,
// The build request could not be run on the server due because it created
// an unresolvable inconsistency with analyzers.
AnalyzerInconsistency,
// The shutdown request completed and the server process information is
// contained in the message.
Shutdown,
// The request was rejected by the server.
Rejected,
// The server hash did not match the one supplied by the client
IncorrectHash,
}
public abstract ResponseType Type { get; }
public async Task WriteAsync(Stream outStream,
CancellationToken cancellationToken)
{
using (var memoryStream = new MemoryStream())
using (var writer = new BinaryWriter(memoryStream, Encoding.Unicode))
{
writer.Write((int)Type);
AddResponseBody(writer);
writer.Flush();
cancellationToken.ThrowIfCancellationRequested();
// Send the response to the client
// Write the length of the response
int length = checked((int)memoryStream.Length);
// There is no way to know the number of bytes written to
// the pipe stream. We just have to assume all of them are written.
await outStream.WriteAsync(BitConverter.GetBytes(length),
0,
4,
cancellationToken).ConfigureAwait(false);
memoryStream.Position = 0;
await memoryStream.CopyToAsync(outStream, bufferSize: length, cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
protected abstract void AddResponseBody(BinaryWriter writer);
/// <summary>
/// May throw exceptions if there are pipe problems.
/// </summary>
/// <param name="stream"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<BuildResponse> ReadAsync(Stream stream, CancellationToken cancellationToken = default(CancellationToken))
{
// Read the response length
var lengthBuffer = new byte[4];
await ReadAllAsync(stream, lengthBuffer, 4, cancellationToken).ConfigureAwait(false);
var length = BitConverter.ToUInt32(lengthBuffer, 0);
// Read the response
var responseBuffer = new byte[length];
await ReadAllAsync(stream,
responseBuffer,
responseBuffer.Length,
cancellationToken).ConfigureAwait(false);
using (var reader = new BinaryReader(new MemoryStream(responseBuffer), Encoding.Unicode))
{
var responseType = (ResponseType)reader.ReadInt32();
switch (responseType)
{
case ResponseType.Completed:
return CompletedBuildResponse.Create(reader);
case ResponseType.MismatchedVersion:
return new MismatchedVersionBuildResponse();
case ResponseType.IncorrectHash:
return new IncorrectHashBuildResponse();
case ResponseType.AnalyzerInconsistency:
return AnalyzerInconsistencyBuildResponse.Create(reader);
case ResponseType.Shutdown:
return ShutdownBuildResponse.Create(reader);
case ResponseType.Rejected:
return RejectedBuildResponse.Create(reader);
default:
throw new InvalidOperationException("Received invalid response type from server.");
}
}
}
}
/// <summary>
/// Represents a Response from the server. A response is as follows.
///
/// Field Name Type Size (bytes)
/// --------------------------------------------------
/// Length UInteger 4
/// ReturnCode Integer 4
/// Output String Variable
///
/// Strings are encoded via a character count prefix as a
/// 32-bit integer, followed by an array of characters.
///
/// </summary>
internal sealed class CompletedBuildResponse : BuildResponse
{
public readonly int ReturnCode;
public readonly bool Utf8Output;
public readonly string Output;
public CompletedBuildResponse(int returnCode,
bool utf8output,
string? output)
{
ReturnCode = returnCode;
Utf8Output = utf8output;
Output = output ?? string.Empty;
}
public override ResponseType Type => ResponseType.Completed;
public static CompletedBuildResponse Create(BinaryReader reader)
{
var returnCode = reader.ReadInt32();
var utf8Output = reader.ReadBoolean();
var output = ReadLengthPrefixedString(reader);
return new CompletedBuildResponse(returnCode, utf8Output, output);
}
protected override void AddResponseBody(BinaryWriter writer)
{
writer.Write(ReturnCode);
writer.Write(Utf8Output);
WriteLengthPrefixedString(writer, Output);
}
}
internal sealed class ShutdownBuildResponse : BuildResponse
{
public readonly int ServerProcessId;
public ShutdownBuildResponse(int serverProcessId)
{
ServerProcessId = serverProcessId;
}
public override ResponseType Type => ResponseType.Shutdown;
protected override void AddResponseBody(BinaryWriter writer)
{
writer.Write(ServerProcessId);
}
public static ShutdownBuildResponse Create(BinaryReader reader)
{
var serverProcessId = reader.ReadInt32();
return new ShutdownBuildResponse(serverProcessId);
}
}
internal sealed class MismatchedVersionBuildResponse : BuildResponse
{
public override ResponseType Type => ResponseType.MismatchedVersion;
/// <summary>
/// MismatchedVersion has no body.
/// </summary>
protected override void AddResponseBody(BinaryWriter writer) { }
}
internal sealed class IncorrectHashBuildResponse : BuildResponse
{
public override ResponseType Type => ResponseType.IncorrectHash;
/// <summary>
/// IncorrectHash has no body.
/// </summary>
protected override void AddResponseBody(BinaryWriter writer) { }
}
internal sealed class AnalyzerInconsistencyBuildResponse : BuildResponse
{
public override ResponseType Type => ResponseType.AnalyzerInconsistency;
public ReadOnlyCollection<string> ErrorMessages { get; }
public AnalyzerInconsistencyBuildResponse(ReadOnlyCollection<string> errorMessages)
{
ErrorMessages = errorMessages;
}
protected override void AddResponseBody(BinaryWriter writer)
{
writer.Write(ErrorMessages.Count);
foreach (var message in ErrorMessages)
{
WriteLengthPrefixedString(writer, message);
}
}
public static AnalyzerInconsistencyBuildResponse Create(BinaryReader reader)
{
var count = reader.ReadInt32();
var list = new List<string>(count);
for (var i = 0; i < count; i++)
{
list.Add(ReadLengthPrefixedString(reader) ?? "");
}
return new AnalyzerInconsistencyBuildResponse(new ReadOnlyCollection<string>(list));
}
}
internal sealed class RejectedBuildResponse : BuildResponse
{
public string Reason;
public override ResponseType Type => ResponseType.Rejected;
public RejectedBuildResponse(string reason)
{
Reason = reason;
}
protected override void AddResponseBody(BinaryWriter writer)
{
WriteLengthPrefixedString(writer, Reason);
}
public static RejectedBuildResponse Create(BinaryReader reader)
{
var reason = ReadLengthPrefixedString(reader);
Debug.Assert(reason is object);
return new RejectedBuildResponse(reason);
}
}
// The id numbers below are just random. It's useful to use id numbers
// that won't occur accidentally for debugging.
internal enum RequestLanguage
{
CSharpCompile = 0x44532521,
VisualBasicCompile = 0x44532522,
}
/// <summary>
/// Constants about the protocol.
/// </summary>
internal static class BuildProtocolConstants
{
// Arguments for CSharp and VB Compiler
public enum ArgumentId
{
// The current directory of the client
CurrentDirectory = 0x51147221,
// A comment line argument. The argument index indicates which one (0 .. N)
CommandLineArgument,
// The "LIB" environment variable of the client
LibEnvVariable,
// Request a longer keep alive time for the server
KeepAlive,
// Request a server shutdown from the client
Shutdown,
// The directory to use for temporary operations.
TempDirectory,
}
/// <summary>
/// Read a string from the Reader where the string is encoded
/// as a length prefix (signed 32-bit integer) followed by
/// a sequence of characters.
/// </summary>
public static string? ReadLengthPrefixedString(BinaryReader reader)
{
var length = reader.ReadInt32();
if (length < 0)
{
return null;
}
return new String(reader.ReadChars(length));
}
/// <summary>
/// Write a string to the Writer where the string is encoded
/// as a length prefix (signed 32-bit integer) follows by
/// a sequence of characters.
/// </summary>
public static void WriteLengthPrefixedString(BinaryWriter writer, string? value)
{
if (value is object)
{
writer.Write(value.Length);
writer.Write(value.ToCharArray());
}
else
{
writer.Write(-1);
}
}
/// <summary>
/// Reads the value of <see cref="CommitHashAttribute.Hash"/> of the assembly <see cref="BuildRequest"/> is defined in
/// </summary>
/// <returns>The hash value of the current assembly or an empty string</returns>
public static string? GetCommitHash()
{
var hashAttributes = typeof(BuildRequest).Assembly.GetCustomAttributes<CommitHashAttribute>();
var hashAttributeCount = hashAttributes.Count();
if (hashAttributeCount != 1)
{
return null;
}
return hashAttributes.Single().Hash;
}
/// <summary>
/// This task does not complete until we are completely done reading.
/// </summary>
internal static async Task ReadAllAsync(
Stream stream,
byte[] buffer,
int count,
CancellationToken cancellationToken)
{
int totalBytesRead = 0;
do
{
int bytesRead = await stream.ReadAsync(buffer,
totalBytesRead,
count - totalBytesRead,
cancellationToken).ConfigureAwait(false);
if (bytesRead == 0)
{
throw new EndOfStreamException("Reached end of stream before end of read.");
}
totalBytesRead += bytesRead;
} while (totalBytesRead < count);
}
}
}
| AmadeusW/roslyn | src/Compilers/Core/CommandLine/BuildProtocol.cs | C# | apache-2.0 | 24,152 | [
30522,
1013,
1013,
7000,
2000,
1996,
1012,
5658,
3192,
2104,
2028,
2030,
2062,
10540,
1012,
1013,
1013,
1996,
1012,
5658,
3192,
15943,
2023,
5371,
2000,
2017,
2104,
1996,
10210,
6105,
1012,
1013,
1013,
2156,
1996,
6105,
5371,
1999,
1996,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.velocity.model.transactions.query.response;
import com.velocity.gson.annotations.SerializedName;
/**
* This class holds the data for ScoreThreshold
*
* @author ranjitk
*
*/
public class ScoreThreshold {
/* Attribute for ScoreThreshold value exists or not. */
@SerializedName("Nillable")
private boolean nillable;
@SerializedName("Value")
private String value;
public boolean isNillable() {
return nillable;
}
public void setNillable(boolean nillable) {
this.nillable = nillable;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
| nab-velocity/android-sdk | VelocityLibrary/src/com/velocity/model/transactions/query/response/ScoreThreshold.java | Java | mit | 666 | [
30522,
7427,
4012,
1012,
10146,
1012,
2944,
1012,
11817,
1012,
23032,
1012,
3433,
1025,
12324,
4012,
1012,
10146,
1012,
28177,
2239,
1012,
5754,
17287,
9285,
1012,
27289,
18442,
1025,
1013,
1008,
1008,
1008,
2023,
2465,
4324,
1996,
2951,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Struct template variance_impl</title>
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="../../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../../../accumulators/reference.html#header.boost.accumulators.statistics.variance_hpp" title="Header <boost/accumulators/statistics/variance.hpp>">
<link rel="prev" href="lazy_variance_impl.html" title="Struct template lazy_variance_impl">
<link rel="next" href="../tag/lazy_variance.html" title="Struct lazy_variance">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
<td align="center"><a href="../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="lazy_variance_impl.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../accumulators/reference.html#header.boost.accumulators.statistics.variance_hpp"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../tag/lazy_variance.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="boost.accumulators.impl.variance_impl"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Struct template variance_impl</span></h2>
<p>boost::accumulators::impl::variance_impl — Iterative calculation of variance. </p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../../accumulators/reference.html#header.boost.accumulators.statistics.variance_hpp" title="Header <boost/accumulators/statistics/variance.hpp>">boost/accumulators/statistics/variance.hpp</a>>
</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> Sample<span class="special">,</span> <span class="keyword">typename</span> MeanFeature<span class="special">,</span> <span class="keyword">typename</span> Tag<span class="special">></span>
<span class="keyword">struct</span> <a class="link" href="variance_impl.html" title="Struct template variance_impl">variance_impl</a> <span class="special">{</span>
<span class="comment">// types</span>
<span class="keyword">typedef</span> <span class="identifier">numeric</span><span class="special">::</span><span class="identifier">functional</span><span class="special">::</span><span class="identifier">average</span><span class="special"><</span> <span class="identifier">Sample</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="special">></span><span class="special">::</span><span class="identifier">result_type</span> <a name="boost.accumulators.impl.variance_impl.result_type"></a><span class="identifier">result_type</span><span class="special">;</span>
<span class="comment">// <a class="link" href="variance_impl.html#boost.accumulators.impl.variance_implconstruct-copy-destruct">construct/copy/destruct</a></span>
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> Args<span class="special">></span> <a class="link" href="variance_impl.html#idp27182624-bb"><span class="identifier">variance_impl</span></a><span class="special">(</span><span class="identifier">Args</span> <span class="keyword">const</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span>
<span class="comment">// <a class="link" href="variance_impl.html#idp27180400-bb">public member functions</a></span>
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> Args<span class="special">></span> <span class="keyword">void</span> <a class="link" href="variance_impl.html#idp27180608-bb"><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span></a><span class="special">(</span><span class="identifier">Args</span> <span class="keyword">const</span> <span class="special">&</span><span class="special">)</span><span class="special">;</span>
<span class="identifier">result_type</span> <a class="link" href="variance_impl.html#idp27181824-bb"><span class="identifier">result</span></a><span class="special">(</span><span class="identifier">dont_care</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="idp18855296"></a><h2>Description</h2>
<p>Iterative calculation of sample variance <span class="inlinemediaobject"><img src="../../../images/accumulators/form_75.png"></span> according to the formula </p>
<div class="equation">
<a name="idp18856880"></a><p class="title"><b>Equation 1.23. </b></p>
<div class="equation-contents"><div class="mediaobject" align="center"><img src="../../../images/accumulators/form_76.png" align="middle"></div></div>
</div>
<p><br class="equation-break"> where </p>
<div class="equation">
<a name="idp18858480"></a><p class="title"><b>Equation 1.24. </b></p>
<div class="equation-contents"><div class="mediaobject" align="center"><img src="../../../images/accumulators/form_74.png" align="middle"></div></div>
</div>
<p><br class="equation-break"> is the estimate of the sample mean and <span class="inlinemediaobject"><img src="../../../images/accumulators/form_60.png"></span> is the number of samples.</p>
<p>Note that the sample variance is not defined for <span class="inlinemediaobject"><img src="../../../images/accumulators/form_77.png"></span>.</p>
<p>A simplification can be obtained by the approximate recursion </p>
<div class="equation">
<a name="idp18862672"></a><p class="title"><b>Equation 1.25. </b></p>
<div class="equation-contents"><div class="mediaobject" align="center"><img src="../../../images/accumulators/form_78.png" align="middle"></div></div>
</div>
<p><br class="equation-break"> because the difference </p>
<div class="equation">
<a name="idp18864224"></a><p class="title"><b>Equation 1.26. </b></p>
<div class="equation-contents"><div class="mediaobject" align="center"><img src="../../../images/accumulators/form_79.png" align="middle"></div></div>
</div>
<p><br class="equation-break"> converges to zero as <span class="inlinemediaobject"><img src="../../../images/accumulators/form_80.png"></span>. However, for small <span class="inlinemediaobject"><img src="../../../images/accumulators/form_17.png"></span> the difference can be non-negligible. </p>
<div class="refsect2">
<a name="idp18868256"></a><h3>
<a name="boost.accumulators.impl.variance_implconstruct-copy-destruct"></a><code class="computeroutput">variance_impl</code>
public
construct/copy/destruct</h3>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> Args<span class="special">></span> <a name="idp27182624-bb"></a><span class="identifier">variance_impl</span><span class="special">(</span><span class="identifier">Args</span> <span class="keyword">const</span> <span class="special">&</span> args<span class="special">)</span><span class="special">;</span></pre></li></ol></div>
</div>
<div class="refsect2">
<a name="idp18873408"></a><h3>
<a name="idp27180400-bb"></a><code class="computeroutput">variance_impl</code> public member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem"><pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> Args<span class="special">></span> <span class="keyword">void</span> <a name="idp27180608-bb"></a><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span><span class="special">(</span><span class="identifier">Args</span> <span class="keyword">const</span> <span class="special">&</span> args<span class="special">)</span><span class="special">;</span></pre></li>
<li class="listitem"><pre class="literallayout"><span class="identifier">result_type</span> <a name="idp27181824-bb"></a><span class="identifier">result</span><span class="special">(</span><span class="identifier">dont_care</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre></li>
</ol></div>
</div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2005, 2006 Eric Niebler<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="lazy_variance_impl.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../accumulators/reference.html#header.boost.accumulators.statistics.variance_hpp"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../tag/lazy_variance.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
| mxrrow/zaicoin | src/deps/boost/doc/html/boost/accumulators/impl/variance_impl.html | HTML | mit | 10,645 | [
30522,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
18804,
8299,
1011,
1041,
15549,
2615,
1027,
1000,
4180,
1011,
2828,
1000,
4180,
1027,
1000,
3793,
1013,
16129,
1025,
25869,
13462,
1027,
2149,
1011,
2004,
6895,
2072,
1000,
1028,
1026,
2516,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
@{
# Script module or binary module file associated with this manifest.
ModuleToProcess = 'RipGrep.psm1'
# Version number of this module.
ModuleVersion = '0.0.0.1'
# ID used to uniquely identify this module
GUID = '31fd4961-0e83-40ba-bc7f-8aa93ba85c73'
# Author of this module
Author = 'Dustin Venegas'
# Copyright statement for this module
Copyright = '(c) 2018 Dustin Venegas'
# Description of the functionality provided by this module
Description = 'Adds Dotfiles PowerShell Bindings for RipGrep'
# Minimum version of the Windows PowerShell engine required by this module
PowerShellVersion = '2.0'
# Functions to export from this module
FunctionsToExport = @(
'Invoke-RipGrep*'
'Get-RipGrep*'
)
# Cmdlets to export from this module
CmdletsToExport = @()
# Variables to export from this module
VariablesToExport = @()
# Aliases to export from this module
AliasesToExport = @(
'grep','rgu*'
)
# Private data to pass to the module specified in RootModule/ModuleToProcess.
# This may also contain a PSData hashtable with additional module metadata used by PowerShell.
PrivateData = @{
PSData = @{
# Tags applied to this module. These help with module discovery in online galleries.
Tags = @('grep', 'ripgrep', 'text', 'ascii', 'search')
# A URL to the license for this module.
LicenseUri = 'https://github.com/dustinvenegas/dotfiles/blob/master/LICENSE.txt'
# A URL to the main website for this project.
ProjectUri = 'https://github.com/dustinvenegas/dotfiles'
# TODO: REMOVE BEFOE RELEASE
PreReleaseVersion = 'pre0'
}
}
}
| DustinVenegas/dotfiles | powershell-modules/RipGrep/RipGrep.psd1 | PowerShell | mit | 1,786 | [
30522,
1030,
1063,
1001,
5896,
11336,
2030,
12441,
11336,
5371,
3378,
2007,
2023,
19676,
1012,
11336,
14399,
3217,
9623,
2015,
1027,
1005,
10973,
17603,
2361,
1012,
8827,
2213,
2487,
1005,
1001,
2544,
2193,
1997,
2023,
11336,
1012,
11336,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* print.c - library routines for printing ASN.1 values.
*
* Copyright (C) 1992 Michael Sample and the University of British Columbia
*
* This library is free software; you can redistribute it and/or
* modify it provided that this copyright/license information is retained
* in original form.
*
* If you modify this file, you must clearly indicate your changes.
*
* This source code is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Header: /baseline/SNACC/c-lib/src/print.c,v 1.8 2004/01/22 20:03:12 nicholar Exp $
*
*/
#include "config.h"
#include "asn-config.h"
#include "print.h"
void
Indent PARAMS ((f, i),
FILE *f _AND_
unsigned int i)
{
for (; i > 0; i--)
fputs (" ", f);
}
void Asn1DefaultErrorHandler PARAMS ((str, severity),
char* str ESNACC_UNUSED _AND_
int severity ESNACC_UNUSED)
{
/* fprintf(stderr,"%s",str); DAD - temp removing for now*/
}
static Asn1ErrorHandler asn1CurrentErrorHandler = Asn1DefaultErrorHandler;
void
Asn1Error PARAMS ((str),
char* str)
{
(*asn1CurrentErrorHandler)(str,1);
}
void
Asn1Warning PARAMS ((str),
char* str)
{
(*asn1CurrentErrorHandler)(str,0);
}
Asn1ErrorHandler
Asn1InstallErrorHandler PARAMS ((handler),
Asn1ErrorHandler handler)
{
Asn1ErrorHandler former = asn1CurrentErrorHandler;
asn1CurrentErrorHandler = handler;
return former;
}
| azsnacc/esnacc-ng | c-lib/src/print.c | C | gpl-2.0 | 1,502 | [
30522,
1013,
1008,
1008,
6140,
1012,
1039,
1011,
3075,
23964,
2005,
8021,
2004,
2078,
1012,
1015,
5300,
1012,
1008,
1008,
9385,
1006,
1039,
1007,
2826,
2745,
7099,
1998,
1996,
2118,
1997,
2329,
3996,
1008,
1008,
2023,
3075,
2003,
2489,
40... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#ifndef CGITCP_H
#define CGITCP_H
#include "httpd.h"
int cgiTcp(HttpdConnData *connData);
#endif
| twischer/WLAN-RGB-Para | esp-link/cgiadv/cgitcp.h | C | gpl-2.0 | 100 | [
30522,
1001,
2065,
13629,
2546,
1039,
23806,
21906,
1035,
1044,
1001,
9375,
1039,
23806,
21906,
1035,
1044,
1001,
2421,
1000,
8299,
2094,
1012,
1044,
1000,
20014,
1039,
23806,
21906,
1006,
8299,
16409,
2239,
8943,
2696,
1008,
9530,
8943,
26... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//
// detail/memory.hpp
// ~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_ASIO_DETAIL_MEMORY_HPP
#define BOOST_ASIO_DETAIL_MEMORY_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
#include <boost/asio/detail/config.hpp>
#include <memory>
#if defined(BOOST_ASIO_HAS_CXX11_ALLOCATORS)
# define BOOST_ASIO_REBIND_ALLOC(alloc, t) \
typename std::allocator_traits<alloc>::template rebind_alloc<t>
/**/
#else // defined(BOOST_ASIO_HAS_CXX11_ALLOCATORS)
# define BOOST_ASIO_REBIND_ALLOC(alloc, t) \
typename alloc::template rebind<t>::other
/**/
#endif // defined(BOOST_ASIO_HAS_CXX11_ALLOCATORS)
#endif // BOOST_ASIO_DETAIL_MEMORY_HPP
| jack8z/TODOP | third_party/boost_1_65_1/boost/asio/detail/memory.hpp | C++ | gpl-2.0 | 930 | [
30522,
1013,
1013,
1013,
1013,
6987,
1013,
3638,
1012,
6522,
2361,
1013,
1013,
1066,
1066,
1066,
1066,
1066,
1066,
1066,
1066,
1066,
1066,
1066,
1066,
1066,
1066,
1066,
1066,
1066,
1013,
1013,
1013,
1013,
9385,
1006,
1039,
1007,
2494,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Set-StrictMode -Version 2
function Test-SqlServer {
<#
.SYNOPSIS
Tests if a SQL Server exists and can be connected to. Optonally checks for a specific database or table.
.PARAMETER Server
The SQL Server to test
.PARAMETER Database
The database to test exists on the SQL Server
.PARAMETER Table
The Table to test exists in the database being connected
#>
[CmdletBinding()]
param(
[parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$Server,
[parameter(Mandatory=$false)]
[ValidateNotNullOrEmpty()]
[string]$Database,
[parameter(Mandatory=$false)]
[ValidateNotNullOrEmpty()]
[string]$Table
)
if ($Database) {
$Database = Encode-SqlName $Database
}
$parts = $Server.Split('\');
$hostName = Encode-SqlName $parts[0];
$instance = if ($parts.Count -eq 1) {'DEFAULT'} else { Encode-SqlName $parts[1] }
#Test-Path will only fail after a timeout. Reduce the timeout for the local scope to
Set-Variable -Scope Local -Name SqlServerConnectionTimeout 5
$path = "SQLSERVER:\Sql\$hostName\$instance"
if (!(Test-Path $path -EA SilentlyContinue)) {
throw "Unable to connect to SQL Instance '$Server'"
return
}
elseif ($Database) {
$path = Join-Path $path "Databases\$Database"
if (!(Test-Path $path -EA SilentlyContinue)) {
throw "Database '$Database' does not exist on server '$Server'"
return
}
elseif($Table)
{
$parts = $Table.Split('.');
if ($parts.Count -eq 1) {
$Table = "dbo.$Table"
}
$path = Join-Path $path "Tables\$Table"
if (!(Test-Path $path -EA SilentlyContinue)) {
throw "Table '$Table' does not exist in database '$Database' does not exist on server '$Server'"
return
}
}
}
$true
}
function New-TelligentDatabase {
<#
.SYNOPSIS
Creates a new database for Telligent Community.
.PARAMETER Server
The SQL server to install the community to
.PARAMETER Database
The name of the database to install the community to
.PARAMETER Package
The installation package to create the community database from
.PARAMETER WebDomain
The domain the community is being hosted at
.PARAMETER AdminPassword
The password to create the admin user with.
#>
[CmdletBinding()]
param(
[parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[ValidateScript({ Test-SqlServer $_ })]
[alias('ServerInstance')]
[alias('DataSource')]
[alias('dbServer')]
[string]$Server,
[parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[alias('dbName')]
[alias('InitialCatalog')]
[string]$Database,
[parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[ValidateScript({Test-Zip $_ })]
[string]$Package,
[parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$WebDomain,
[parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$AdminPassword,
[parameter(Mandatory=$true)]
[switch]$Legacy
)
$connectionInfo = @{
ServerInstance = $Server
Database = $database
}
Write-Progress "Database: $Database" 'Checking if database exists'
if(!(Test-SqlServer -Server $Server -Database $Database -EA SilentlyContinue)) {
Write-Progress "Database: $Database" 'Creating database'
New-Database @connectionInfo
} else {
Write-Warning "Database $Database already exists."
}
Write-Progress "Database: $Database" 'Checking if schema exists'
if(!(Test-SqlServer -Server $Server -Database $Database -Table 'cs_SchemaVersion' -ErrorAction SilentlyContinue)) {
Write-Progress "Database: $database" 'Creating Schema'
$tempDir = Join-Path ([System.IO.Path]::GetFullPath($env:TEMP)) ([guid]::NewGuid())
Expand-Zip -Path $package -Destination $tempDir -ZipDirectory SqlScripts
$sqlScript = @('Install.sql', 'cs_CreateFullDatabase.sql') |
ForEach-Object { Join-Path $tempDir $_ }|
Where-Object { Test-Path $_} |
Select-Object -First 1
Write-ProgressFromVerbose "Database: $database" 'Creating Schema' {
Invoke-Sqlcmd @connectionInfo -InputFile $sqlScript -QueryTimeout 6000 -DisableVariables
}
Remove-Item $tempDir -Recurse -Force | out-null
if($Legacy) {
$createCommunityQuery = @"
EXECUTE [dbo].[cs_system_CreateCommunity]
@SiteUrl = N'http://${WebDomain}/'
, @ApplicationName = N'$Name'
, @AdminEmail = N'notset@${WebDomain}'
, @AdminUserName = N'admin'
, @AdminPassword = N'$adminPassword'
, @PasswordFormat = 0
, @CreateSamples = 0
"@
}
else {
$createCommunityQuery = @"
EXECUTE [dbo].[cs_system_CreateCommunity]
@ApplicationName = N'$Name'
, @AdminEmail = N'notset@${WebDomain}'
, @AdminUserName = N'admin'
, @AdminPassword = N'$adminPassword'
, @PasswordFormat = 0
, @CreateSamples = 0
"@
}
Write-ProgressFromVerbose "Database: $database" 'Creating Community' {
Invoke-Sqlcmd @connectionInfo -query $createCommunityQuery -DisableVariables
}
}
}
function Update-TelligentDatabase {
<#
.SYNOPSIS
Updates an existing Telligent Community database to upgrade it to the version in the package
.PARAMETER Server
The SQL server to install the community to
.PARAMETER Database
The name of the database to install the community to
.PARAMETER Package
The installation package to create the community database from
#>
[CmdletBinding()]
param(
[parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[ValidateScript({ Test-SqlServer $_ })]
[alias('ServerInstance')]
[alias('DataSource')]
[alias('dbServer')]
[string]$Server,
[parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[alias('dbName')]
[alias('InitialCatalog')]
[string]$Database,
[parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[ValidateScript({Test-Zip $_ })]
[string]$Package
)
$connectionInfo = @{
Server = $Server
Database = $Database
}
Write-Progress "Database: $Database" 'Checking if database can be upgraded'
if(!(Test-SqlServer @connectionInfo -Table dbo.cs_schemaversion -EA SilentlyContinue)) {
throw "Database '$Database' on Server '$Server' is not a valid Telligent Community database to be upgraded"
}
Write-Progress "Database: $database" 'Creating Schema'
$tempDir = Join-Path ([System.IO.Path]::GetFullPath($env:TEMP)) ([guid]::NewGuid())
Expand-Zip -Path $package -Destination $tempDir -ZipDirectory SqlScripts
$sqlScript = @('Upgrade.sql', 'cs_UpdateSchemaAndProcedures.sql') |
ForEach-Object { Join-Path $tempDir $_ }|
Where-Object { Test-Path $_} |
Select-Object -First 1
Write-ProgressFromVerbose "Database: $Database" 'Upgrading Schema' {
Invoke-Sqlcmd @connectionInfo -InputFile $sqlScript -QueryTimeout 6000 -DisableVariables
}
Remove-Item $tempDir -Recurse -Force | out-null
}
function Grant-TelligentDatabaseAccess {
<#
.SYNOPSIS
Grants a user access to a Telligent Community database. If the user or login doesn't exist, in SQL server, they
are created before being granted access to the database.
.PARAMETER CommunityPath
The path to the Telligent Community you're granting database access for
.PARAMETER Username
The name of the user to grant access to. If no password is specified, the user is assumed to be a Windows
login.
.PARAMETER Password
The password for the SQL user
.EXAMPLE
Grant-TelligentDatabaseAccess (local)\SqlExpress SampleCommunity 'NT AUTHORITY\NETWORK SERVICE'
Description
-----------
This command grant access to the SampleCommunity database on the SqlExpress instance of the local SQL server
for the Network Service Windows account
.EXAMPLE
Grant-TelligentDatabaseAccess ServerName SampleCommunity CommunityUser -password SqlPa$$w0rd
Description
-----------
This command grant access to the SampleCommunity database on the default instance of the ServerName SQL server
for the CommunityUser SQL account. If this login does not exist, it gets created using the password SqlPa$$w0rd
#>
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[ValidateScript({ Test-TelligentPath $_ })]
[string]$CommunityPath,
[parameter(Mandatory=$true, Position = 2)]
[ValidateNotNullOrEmpty()]
[string]$Username,
[string]$Password
)
$info = Get-TelligentCommunity $CommunityPath
#TODO: Sanatise inputs
Write-Verbose "Granting database access to $Username"
if ($Password) {
$CreateLogin = "CREATE LOGIN [$Username] WITH PASSWORD=N'$Password', DEFAULT_DATABASE=[$($info.DatabaseName)];"
}
else {
$CreateLogin = "CREATE LOGIN [$Username] FROM WINDOWS WITH DEFAULT_DATABASE=[$($info.DatabaseName)];"
}
$query = @"
IF NOT EXISTS (SELECT 1 FROM master.sys.server_principals WHERE name = N'$Username')
BEGIN
$CreateLogin
END;
IF NOT EXISTS (SELECT 1 FROM sys.database_principals WHERE name = N'$Username') BEGIN
CREATE USER [$Username] FOR LOGIN [$Username];
END;
EXEC sp_addrolemember N'aspnet_Membership_FullAccess', N'$Username';
EXEC sp_addrolemember N'aspnet_Profile_FullAccess', N'$Username';
EXEC sp_addrolemember N'db_datareader', N'$Username';
EXEC sp_addrolemember N'db_datawriter', N'$Username';
EXEC sp_addrolemember N'db_ddladmin', N'$Username';
"@
Invoke-TelligentSqlCmd -WebsitePath $CommunityPath -Query $query
}
function Invoke-TelligentSqlCmd {
<#
.SYNOPSIS
Executes a SQL Script agains the specified community's database.
.PARAMETER WebsitePath
The path of the Telligent Community website. If not specified, defaults to the current directory.
.PARAMETER Query
A bespoke query to run agains the community's database.
.PARAMETER File
A script in an external file run agains the community's database.
.PARAMETER QueryTimeout
The maximum length of time the query can run for
#>
param (
[Parameter(Mandatory=$true, Position=0)]
[ValidateScript({ Test-TelligentPath $_ -Web })]
[string]$WebsitePath,
[Parameter(ParameterSetName='Query', Mandatory=$true)]
[string]$Query,
[Parameter(ParameterSetName='File', Mandatory=$true)]
[ValidateScript({Test-Path $_ -PathType Leaf})]
[string]$File,
[int]$QueryTimeout
)
$info = Get-TelligentCommunity $WebsitePath
$sqlParams = @{
ServerInstance = $info.DatabaseServer
Database = $info.DatabaseName
}
if ($Query) {
$sqlParams.Query = $Query
}
else {
$sqlParams.InputFile = $File
}
if ($QueryTimeout) {
$sqlParams.QueryTimeout = $QueryTimeout
}
Invoke-Sqlcmd @sqlParams -DisableVariables
}
function New-Database {
<#
.SYNOPSIS
Creates a new SQL Database
.PARAMETER Database
The name of the database to create
.PARAMETER Server
The server to create the database on
#>
[CmdletBinding()]
param(
[parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)]
[ValidateNotNullOrEmpty()]
[alias('Database')]
[string]$Name,
[ValidateNotNullOrEmpty()]
[alias('ServerInstance')]
[string]$Server = "."
)
$query = "Create Database [$Name]";
Invoke-Sqlcmd -ServerInstance $Server -Query $query
}
function Remove-Database {
<#
.SYNOPSIS
Drops a SQL Database
.PARAMETER Database
The name of the database to drop
.PARAMETER Server
The server to drop the database from
#>
[CmdletBinding()]
param(
[parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)]
[ValidateNotNullOrEmpty()]
[alias('dbName')]
[string]$Database,
[ValidateNotNullOrEmpty()]
[alias('dbServer')]
[string]$Server = "."
)
$query = @"
if DB_ID('$Database') is not null
begin
exec msdb.dbo.sp_delete_database_backuphistory @database_name = N'$Database'
alter database [$Database] set single_user with rollback immediate
drop database [$Database]
end
"@
Invoke-Sqlcmd -ServerInstance $Server -Query $query
}
| afscrome/TelligentInstanceManager | TelligentInstall/sql.ps1 | PowerShell | mit | 13,166 | [
30522,
2275,
1011,
9384,
5302,
3207,
1011,
2544,
1016,
3853,
3231,
1011,
29296,
8043,
6299,
1063,
1026,
1001,
1012,
19962,
22599,
5852,
2065,
1037,
29296,
8241,
6526,
1998,
2064,
2022,
4198,
2000,
1012,
23569,
16026,
2135,
14148,
2005,
1037... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Copyright 2015-2017 Rumma & Ko Ltd
# License: BSD (see file COPYING for details)
from lino.core.roles import UserRole
class SimpleContactsUser(UserRole):
pass
class ContactsUser(SimpleContactsUser):
pass
class ContactsStaff(ContactsUser):
pass
| khchine5/xl | lino_xl/lib/contacts/roles.py | Python | bsd-2-clause | 269 | [
30522,
1001,
9385,
2325,
1011,
2418,
19379,
2863,
1004,
12849,
5183,
1001,
6105,
1024,
18667,
2094,
1006,
2156,
5371,
24731,
2005,
4751,
1007,
2013,
11409,
2080,
1012,
4563,
1012,
4395,
12324,
5310,
13153,
2063,
2465,
3722,
8663,
2696,
1664... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<html>
<body>
Utility classes and functions.
@author Anders Møller <<a href="mailto:amoeller@cs.au.dk">amoeller@cs.au.dk</a>>
@author Mathias Schwarz <<a href="mailto:schwarz@cs.au.dk">schwarz@cs.au.dk</a>>
</body>
</html>
| cs-au-dk/JWIG | src/dk/brics/jwig/util/package.html | HTML | bsd-3-clause | 242 | [
30522,
1026,
16129,
1028,
1026,
2303,
1028,
9710,
4280,
1998,
4972,
1012,
1030,
3166,
15387,
1049,
1004,
9808,
27067,
1025,
2222,
2121,
1004,
8318,
1025,
1026,
1037,
17850,
12879,
1027,
1000,
5653,
3406,
1024,
2572,
8913,
10820,
1030,
20116... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* ShortTimeProcess.cpp
* Copyright 2016 (c) Jordi Adell
* Created on: 2015
* Author: Jordi Adell - adellj@gmail.com
*
* This file is part of DSPONE
*
* DSPONE 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.
*
* DSPONE 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
* alogn with DSPONE. If not, see <http://www.gnu.org/licenses/>.
*/
#include <dspone/rt/ShortTimeProcessImpl.h>
#include <dspone/rt/ShortTimeProcess.h>
namespace dsp {
ShortTimeProcessImpl::ShortTimeProcessImpl(ShortTimeProcess *frameProcessor,
int windowSize,
int analysisLength,
int nchannels,
Mode mode) :
_frameProcessor(frameProcessor),
_windowSize (windowSize),
_windowShift (_windowSize/2),
_halfWindowSize (_windowSize/2),
_nchannels(nchannels),
_nDataChannels(10),
_analysisLength((analysisLength == 0) ? _windowSize + 2 : analysisLength),
_window(new BaseType[_windowSize+1]), // Needs to be of odd length in order to preserve the original energy.
_iwindow(new BaseType[_windowSize]),
_mode(mode),
_doSynthesis(_mode == ShortTimeProcess::ANALYSIS_SYNTHESIS)
{
initVariableMembers();
initWindowBuffers();
initBuffers();
}
double ShortTimeProcessImpl::getRate() const
{
return _windowShift;
}
int ShortTimeProcessImpl::getNumberOfChannels() const
{
return _nchannels;
}
int ShortTimeProcessImpl::getNumberOfDataChannels() const
{
return _nDataChannels;
}
ShortTimeProcessImpl::~ShortTimeProcessImpl()
{
}
void ShortTimeProcessImpl::initVariableMembers()
{
_firstCall = true;
}
void ShortTimeProcessImpl::initWindowBuffers()
{
// Create auxiliar buffers
_frame.reset(new BaseType[_windowSize]);
// Setting window vector
wipp::set(1.0,_window.get(),_windowSize+1);
wipp::window(_window.get(), _windowSize+1, wipp::wippHANN);
wipp::sqrt(&_window[1],_windowSize-1);
_window[0]=0;
// Setting inverse window vector
BaseType ones[_windowSize];
wipp::set(1.0, ones, _windowSize);
wipp::copyBuffer(_window.get(),_iwindow.get(),_windowSize);
wipp::div(&_window[1], ones, &_iwindow[1], _windowSize-1);
}
void ShortTimeProcessImpl::initBuffers()
{
wipp::setZeros(_frame.get(),_windowSize);
for (unsigned int i = 0; i<_nchannels; ++i)
{
_latencyBufferProcessed.push_back(SignalPtr(new BaseType[_windowSize]));
wipp::wipp_circular_buffer_t *cb;
wipp::init_cirular_buffer(&cb, _maximumLatencyBufferSize, _frame.get(), _windowSize);
_latencyBufferSignal.push_back(cb);
wipp::setZeros(_latencyBufferProcessed.back().get(), _windowSize);
_analysisFramesPtr.push_back(new BaseType[_analysisLength]);
_analysisFrames.push_back(SignalPtr(_analysisFramesPtr.back()));
wipp::setZeros(_analysisFrames.back().get(), _analysisLength);
}
allocateNDataChannels(_nDataChannels);
}
void ShortTimeProcessImpl::allocateNDataChannels(int nDataChannels)
{
for (unsigned int i = _dataFrames.size(); i < nDataChannels; ++i)
{
_dataFramesPtr.push_back(new BaseType[_windowSize]);
_dataFrames.push_back(SignalPtr(_dataFramesPtr.back()));
wipp::setZeros(_dataFrames.back().get(), _windowSize);
}
for (unsigned int i = _latencyBufferSignal.size(); i < nDataChannels + _nchannels; ++i)
{
BaseType zeros[_windowSize];
wipp::setZeros(zeros, _windowSize);
// _latencyBufferSignal.push_back(container::CircularBuffer<BaseType, _maximumLatencyBufferSize>());
_latencyBufferProcessed.push_back(SignalPtr(new BaseType[_windowSize]));
wipp::setZeros(_latencyBufferProcessed.back().get(), _windowSize);
wipp::wipp_circular_buffer_t *cb;
wipp::init_cirular_buffer(&cb, _maximumLatencyBufferSize, zeros, _windowSize);
_latencyBufferSignal.push_back(cb);
}
}
int ShortTimeProcessImpl::getAmountOfRemainingSamples()
{
if (_firstCall)
return 0;
else
return _windowShift;
}
void ShortTimeProcessImpl::clear()
{
_latencyBufferSignal.clear();
_analysisFrames.clear();
_analysisFramesPtr.clear();
for (size_t i = 0; i < _latencyBufferSignal.size(); ++i)
{
wipp::wipp_circular_buffer_t *f = _latencyBufferSignal.at(i);
wipp::delete_circular_buffer(&f);
}
_dataFrames.clear();
_dataFramesPtr.clear();
_latencyBufferProcessed.clear();
initBuffers();
}
void ShortTimeProcessImpl::ShortTimeProcessing(const SignalVector &signal, const SignalVector &output, int length)
{
std::string msg = "ShortTimeProcess process frame of ";
msg += std::to_string(_windowSize) + " samples";
int lastFrame = length - _windowSize;
int sample = 0;
SignalVector::const_iterator it;
for (it = output.begin(); it != output.end(); ++it)
wipp::setZeros(it->get(), length);
for (sample=0; sample <= lastFrame; sample = sample + _windowShift)
{
unsigned int channel;
for (channel = 0, it = signal.begin(); // Foreach signal channel
it != signal.end() && channel < _nchannels;
++it, ++channel)
{
BaseType *ptr = it->get();
wipp::copyBuffer(&ptr[sample],_frame.get(),_windowSize);
wipp::mult(_window.get(),_frame.get(),_windowSize);
frameAnalysis(_frame.get(), _analysisFrames[channel].get(), _windowSize, _analysisLength, channel);
}
for(channel = 0; // Foreach data channel
it != signal.end() && channel < _nDataChannels;
++it, ++channel)
{
BaseType *ptr = it->get();
wipp::copyBuffer(&ptr[sample], _dataFrames[channel].get(), _windowSize);
}
/// Set data channels point to the actual signal channels.
processParametrisation();
if (!_doSynthesis)
continue;
for (channel = 0, it = output.begin(); // Foreach signal channel
it != output.end() && channel < _nchannels;
++it, ++channel)
{
BaseType *ptr =it->get();
frameSynthesis(_frame.get(), _analysisFrames[channel].get(), _windowSize, _analysisLength, channel);
wipp::mult(_window.get(),_frame.get(),_windowSize);
wipp::add(_frame.get(),&ptr[sample],_windowSize);
}
for(channel = 0; // Foreach data channel
it != output.end() && channel < _nDataChannels;
++it, ++channel)
{
BaseType *ptr = it->get();
wipp::copyBuffer(_dataFrames[channel].get(), &ptr[sample], _windowSize);
}
}
}
int ShortTimeProcessImpl::calculateOrderFromSampleRate(int sampleRate, double frameRate)
{
int order = static_cast<int>(log(2*frameRate*sampleRate)/log(2.0F) + 0.5);
if (0 < order && order < 4)
{
ERROR_STREAM("Too low order for FFT: " << order << " this might cose undefined errors.");
}
else if(order <= 0)
{
std::stringstream oss;
oss << "Negative or zero FFT order value: " << order << ". "
<< "Order is optained from frame rate: " << frameRate
<< " and sample rate: " << sampleRate;
throw(DspException(oss.str()));
}
return order;
}
void ShortTimeProcessImpl::unwindowFrame(double *frame, size_t length) const
{
wipp::mult(_iwindow.get(), frame, ((length < _windowSize) ? length : _windowSize));
}
void ShortTimeProcessImpl::unwindowFrame(double *frame, double *unwindowed, size_t length) const
{
wipp::setZeros(unwindowed, length);
wipp::copyBuffer(frame, unwindowed, length);
wipp::mult(_iwindow.get(), frame, ((length < _windowSize) ? length : _windowSize));
}
int ShortTimeProcessImpl::getLatency() const
{
size_t occupancy;
// return _latencyBufferSignal[0].getCountUsed();
wipp::cf_occupancy(_latencyBufferSignal[0], &occupancy);
return occupancy;
}
int ShortTimeProcessImpl::getMaxLatency() const
{
return getWindowSize() + _windowShift;
}
int ShortTimeProcessImpl::getMinLatency() const
{
return _windowShift;
}
int ShortTimeProcessImpl::getAnalysisLength() const
{
return _analysisLength;
}
int ShortTimeProcessImpl::getWindowSize() const
{
return _windowSize;
}
int ShortTimeProcessImpl::getFrameSize() const
{
return getWindowSize();
}
int ShortTimeProcessImpl::getFrameRate() const
{
return _windowShift;
}
void ShortTimeProcessImpl::frameAnalysis(BaseType *inFrame,
BaseType *analysis,
int frameLength,
int analysisLength,
int channel)
{
_qtdebug.plot(inFrame, frameLength, QtDebug::IN_FRAME, channel);
_frameProcessor->frameAnalysis(inFrame, analysis, frameLength, analysisLength, channel);
}
void ShortTimeProcessImpl::processParametrisation()
{
_qtdebug.plot(_analysisFrames, _analysisLength, QtDebug::IN_ANALYSIS);
_frameProcessor->processParametrisation(_analysisFramesPtr, _analysisLength, _dataFramesPtr, _windowSize);
_qtdebug.plot(_analysisFrames, _analysisLength, QtDebug::OUT_ANALYSIS);
}
void ShortTimeProcessImpl::frameSynthesis(BaseType *outFrame,
BaseType *analysis,
int frameLength,
int analysisLength,
int channel)
{
_frameProcessor->frameSynthesis(outFrame, analysis, frameLength, analysisLength, channel);
_qtdebug.plot(outFrame, frameLength, QtDebug::OUT_FRAME, channel);
}
}
| jordi-adell/dspone | src/dspone/rt/ShortTimeProcessImpl.cpp | C++ | lgpl-3.0 | 9,276 | [
30522,
1013,
1008,
1008,
2460,
7292,
21572,
9623,
2015,
1012,
18133,
2361,
1008,
9385,
2355,
1006,
1039,
1007,
8183,
17080,
4748,
5349,
1008,
2580,
2006,
1024,
2325,
1008,
3166,
1024,
8183,
17080,
4748,
5349,
1011,
4748,
5349,
3501,
1030,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Copyright 2015 ads-tec GmbH
*
* 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 jsonrpcdevice;
public class JSONRpcException extends Exception {
/**
*
*/
private static final long serialVersionUID = 1252532100215144699L;
public JSONRpcException() {
super();
}
public JSONRpcException(String message, Throwable cause) {
super(message, cause);
}
public JSONRpcException(Throwable cause) {
super(cause);
}
public JSONRpcException(String s) {
super(s);
}
}
| ads-tec/JSONRpcDevice | src/jsonrpcdevice/JSONRpcException.java | Java | apache-2.0 | 1,027 | [
30522,
1013,
1008,
1008,
1008,
9385,
2325,
14997,
1011,
8915,
2278,
18289,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Dicaeoma phlomidis (Thüm.) Kuntze, 1898 SPECIES
#### Status
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
Revis. gen. pl. (Leipzig) 3: 470 (1898)
#### Original name
Puccinia phlomidis Thüm., 1878
### Remarks
null | mdoering/backbone | life/Fungi/Basidiomycota/Pucciniomycetes/Pucciniales/Pucciniaceae/Puccinia/Puccinia phlomidis/ Syn. Dicaeoma phlomidis/README.md | Markdown | apache-2.0 | 259 | [
30522,
1001,
4487,
3540,
8780,
2863,
6887,
21297,
28173,
2015,
1006,
16215,
2819,
1012,
1007,
28919,
23102,
1010,
6068,
2427,
1001,
1001,
1001,
1001,
3570,
10675,
1001,
1001,
1001,
1001,
2429,
2000,
1996,
10161,
1997,
2166,
1010,
3822,
2254... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#!/bin/bash
# TODO remove requirement for ABI=0 once conda-forge has switched to new compiler packages.
#CXX=$PREFIX/bin/x86_64-conda_cos6-linux-gnu-g++
cmake -DCMAKE_CXX_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=0 -DCMAKE_INSTALL_PREFIX=$PREFIX -DBOOST_ROOT=$PREFIX -DBoost_NO_SYSTEM_PATHS=ON .
VERBOSE=TRUE make
make install
| gvlproject/bioconda-recipes | recipes/clever-toolkit/build.sh | Shell | mit | 318 | [
30522,
1001,
999,
1013,
8026,
1013,
24234,
1001,
28681,
2080,
6366,
9095,
2005,
11113,
2072,
1027,
1014,
2320,
9530,
2850,
1011,
15681,
2038,
7237,
2000,
2047,
21624,
14555,
1012,
1001,
1039,
20348,
1027,
1002,
17576,
1013,
8026,
1013,
1060... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
---
layout: text/textblock
section: Why use pair writing
---
- GatherContent: [Use pair writing to collaborate with subject matter experts](https://gathercontent.com/blog/use-pair-writing-to-collaborate-with-subject-matter-experts)
- GOV.UK: [It takes 2: How we use pair writing](https://gds.blog.gov.uk/2016/09/21/it-takes-2-how-we-use-pair-writing/)
- UK Parliamentary Digital Service: [Pair writing](https://pds.blog.parliament.uk/2017/03/29/pair-writing/)
| govau/service-manual | content/content-strategy/manage-content-requests/create-content/pair-writing/references.md | Markdown | mit | 462 | [
30522,
1011,
1011,
1011,
9621,
1024,
3793,
1013,
3793,
23467,
30524,
2007,
3395,
3043,
8519,
1033,
1006,
16770,
1024,
1013,
1013,
8587,
8663,
6528,
2102,
1012,
4012,
1013,
9927,
1013,
2224,
1011,
3940,
1011,
3015,
1011,
2000,
1011,
20880,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package models;
import java.util.Date;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import play.data.validation.Required;
import play.db.jpa.Model;
@Entity
public class UserEvent extends Model {
public static final int TYPE_LOGIN = 1;
public static final int TYPE_LOGOUT = 2;
@Required
public Date eventDate;
@Required
@ManyToOne
public User user;
@Required
public int eventType;
public UserEvent(final Date eventDate, final User user, final int eventType) {
super();
this.eventDate = eventDate;
this.user = user;
this.eventType = eventType;
}
public static List<UserEvent> findByUser(final long userId) {
return find("user =? order by eventDate desc", User.findById(userId)).fetch(100);
}
@Override
public String toString() {
return "UserEvent [eventDate=" + eventDate + ", user=" + user + ", eventType=" + eventType + "]";
}
}
| Thierry36tribus/Jeko | app/models/UserEvent.java | Java | gpl-3.0 | 916 | [
30522,
7427,
4275,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
3058,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
2862,
1025,
12324,
9262,
2595,
1012,
28297,
1012,
9178,
1025,
12324,
9262,
2595,
1012,
28297,
1012,
2116,
3406,
5643,
1025,
123... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
*
* Search for multiple elements on the page, starting from an element. The located
* elements will be returned as a WebElement JSON objects. The table below lists the
* locator strategies that each server should support. Elements should be returned in
* the order located in the DOM.
*
* @param {String} ID ID of a WebElement JSON object to route the command to
* @param {String} selector selector to query the elements
* @return {Object[]} A list of WebElement JSON objects for the located elements.
*
* @see https://w3c.github.io/webdriver/webdriver-spec.html#find-elements-from-element
* @type protocol
*
*/
import { ProtocolError } from '../utils/ErrorHandler'
import findStrategy from '../helpers/findElementStrategy'
export default function elementIdElements (id, selector) {
if (typeof id !== 'string' && typeof id !== 'number') {
throw new ProtocolError('number or type of arguments don\'t agree with elementIdElements protocol command')
}
let found = findStrategy(selector, true)
return this.requestHandler.create(`/session/:sessionId/element/${id}/elements`, {
using: found.using,
value: found.value
}).then((result) => {
result.selector = selector
/**
* W3C webdriver protocol has changed element identifier from `ELEMENT` to
* `element-6066-11e4-a52e-4f735466cecf`. Let's make sure both identifier
* are supported.
*/
result.value = result.value.map((elem) => {
const elemValue = elem.ELEMENT || elem['element-6066-11e4-a52e-4f735466cecf']
return {
ELEMENT: elemValue,
'element-6066-11e4-a52e-4f735466cecf': elemValue
}
})
return result
})
}
| isabela-angelo/scratch-tangible-blocks | scratch-blocks/node_modules/webdriverio/lib/protocol/elementIdElements.js | JavaScript | bsd-3-clause | 1,771 | [
30522,
1013,
1008,
1008,
1008,
1008,
3945,
2005,
3674,
3787,
2006,
1996,
3931,
1010,
3225,
2013,
2019,
5783,
1012,
1996,
2284,
1008,
3787,
2097,
2022,
2513,
2004,
1037,
4773,
12260,
3672,
1046,
3385,
5200,
30524,
1996,
1008,
8840,
11266,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// **********************************************************************
//
// Generated by the ORBacus IDL-to-C++ Translator
//
// Copyright (c) 2005
// IONA Technologies, Inc.
// Waltham, MA, USA
//
// All Rights Reserved
//
// **********************************************************************
// Version: 4.3.2
#ifndef ___Hello_h__
#define ___Hello_h__
#ifndef OB_INTEGER_VERSION
# error No ORBacus version defined! Is <OB/CORBA.h> included?
#endif
#ifndef OB_NO_VERSION_CHECK
# if (OB_INTEGER_VERSION != 4030200L)
# error ORBacus version mismatch!
# endif
#endif
class Hello;
typedef Hello* Hello_ptr;
typedef Hello* HelloRef;
void OBDuplicate(Hello_ptr);
void OBRelease(Hello_ptr);
void OBMarshal(Hello_ptr, OB::OutputStreamImpl*);
void OBUnmarshal(Hello_ptr&, OB::InputStreamImpl*);
typedef OB::ObjVar< Hello > Hello_var;
typedef OB::ObjOut< Hello > Hello_out;
class OBStubImpl_Hello;
typedef OBStubImpl_Hello* OBStubImpl_Hello_ptr;
void OBDuplicate(OBStubImpl_Hello_ptr);
void OBRelease(OBStubImpl_Hello_ptr);
typedef OB::ObjVar< OBStubImpl_Hello > OBStubImpl_Hello_var;
//
// IDL:Hello:1.0
//
class Hello : virtual public ::CORBA::Object
{
Hello(const Hello&);
void operator=(const Hello&);
protected:
static const char* ids_[];
public:
Hello() { }
virtual ~Hello() { }
typedef Hello_ptr _ptr_type;
typedef Hello_var _var_type;
static inline Hello_ptr
_duplicate(Hello_ptr p)
{
if(p)
p -> _add_ref();
return p;
}
static inline Hello_ptr
_nil()
{
return 0;
}
static Hello_ptr _narrow(::CORBA::Object_ptr);
static Hello_ptr _unchecked_narrow(::CORBA::Object_ptr);
static Hello_ptr _narrow(::CORBA::AbstractBase_ptr);
static Hello_ptr _unchecked_narrow(::CORBA::AbstractBase_ptr);
static const char** _OB_staticIds();
//
// IDL:Hello/say_hello:1.0
//
virtual void say_hello() = 0;
//
// IDL:Hello/shutdown:1.0
//
virtual void shutdown() = 0;
};
//
// IDL:Hello:1.0
//
class OBProxy_Hello : virtual public ::Hello,
virtual public OBCORBA::Object
{
OBProxy_Hello(const OBProxy_Hello&);
void operator=(const OBProxy_Hello&);
protected:
virtual OB::MarshalStubImpl_ptr _OB_createMarshalStubImpl();
public:
OBProxy_Hello() { }
virtual ~OBProxy_Hello() { }
virtual const char** _OB_ids() const;
//
// IDL:Hello/say_hello:1.0
//
void say_hello();
//
// IDL:Hello/shutdown:1.0
//
void shutdown();
};
//
// IDL:Hello:1.0
//
class OBStubImpl_Hello : virtual public OB::StubImplBase
{
OBStubImpl_Hello(const OBStubImpl_Hello&);
void operator=(const OBStubImpl_Hello&);
protected:
OBStubImpl_Hello() { }
public:
static inline OBStubImpl_Hello_ptr
_duplicate(OBStubImpl_Hello_ptr p)
{
if(p)
p -> _OB_incRef();
return p;
}
static inline OBStubImpl_Hello_ptr
_nil()
{
return 0;
}
//
// IDL:Hello/say_hello:1.0
//
virtual void say_hello() = 0;
//
// IDL:Hello/shutdown:1.0
//
virtual void shutdown() = 0;
};
//
// IDL:Hello:1.0
//
class OBMarshalStubImpl_Hello :
virtual public OBStubImpl_Hello,
virtual public OB::MarshalStubImpl
{
OBMarshalStubImpl_Hello(const OBMarshalStubImpl_Hello&);
void operator=(const OBMarshalStubImpl_Hello&);
protected:
OBMarshalStubImpl_Hello() { }
friend class OBProxy_Hello;
public:
//
// IDL:Hello/say_hello:1.0
//
virtual void say_hello();
//
// IDL:Hello/shutdown:1.0
//
virtual void shutdown();
};
//
// IDL:Hello:1.0
//
namespace CORBA
{
inline void
release(::Hello_ptr p)
{
if(p)
p -> _remove_ref();
}
inline Boolean
is_nil(::Hello_ptr p)
{
return p == 0;
}
inline void
release(OBStubImpl_Hello_ptr p)
{
if(p)
p -> _OB_decRef();
}
inline Boolean
is_nil(OBStubImpl_Hello_ptr p)
{
return p == 0;
}
} // End of namespace CORBA
#endif
| codeworkscn/learn-cpp | Corba/OBLearn/src/2.oci_info/Hello.h | C | apache-2.0 | 4,057 | [
30522,
1013,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Form Validation : CodeIgniter User Guide</title>
<style type='text/css' media='all'>@import url('../userguide.css');</style>
<link rel='stylesheet' type='text/css' media='all' href='../userguide.css' />
<script type="text/javascript" src="../nav/nav.js"></script>
<script type="text/javascript" src="../nav/prototype.lite.js"></script>
<script type="text/javascript" src="../nav/moo.fx.js"></script>
<script type="text/javascript" src="../nav/user_guide_menu.js"></script>
<meta http-equiv='expires' content='-1' />
<meta http-equiv= 'pragma' content='no-cache' />
<meta name='robots' content='all' />
<meta name='author' content='ExpressionEngine Dev Team' />
<meta name='description' content='CodeIgniter User Guide' />
</head>
<body>
<!-- START NAVIGATION -->
<div id="nav"><div id="nav_inner"><script type="text/javascript">create_menu('../');</script></div></div>
<div id="nav2"><a name="top"></a><a href="javascript:void(0);" onclick="myHeight.toggle();"><img src="../images/nav_toggle_darker.jpg" width="154" height="43" border="0" title="Toggle Table of Contents" alt="Toggle Table of Contents" /></a></div>
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
<td><h1>CodeIgniter User Guide Version 1.7.3</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
</div>
<!-- END NAVIGATION -->
<!-- START BREADCRUMB -->
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
<td id="breadcrumb">
<a href="http://codeigniter.com/">CodeIgniter Home</a> ›
<a href="../index.html">User Guide Home</a> ›
Form Validation
</td>
<td id="searchbox"><form method="get" action="http://www.google.com/search"><input type="hidden" name="as_sitesearch" id="as_sitesearch" value="codeigniter.com/user_guide/" />Search User Guide <input type="text" class="input" style="width:200px;" name="q" id="q" size="31" maxlength="255" value="" /> <input type="submit" class="submit" name="sa" value="Go" /></form></td>
</tr>
</table>
<!-- END BREADCRUMB -->
<br clear="all" />
<!-- START CONTENT -->
<div id="content">
<p class="important">
This library has been deprecated. Use of the form_validation library is encouraged.
</p>
<h1>Form Validation</h1>
<p>Before explaining CodeIgniter's approach to data validation, let's describe the ideal scenario:</p>
<ol>
<li>A form is displayed.</li>
<li>You fill it in and submit it.</li>
<li>If you submitted something invalid, or perhaps missed a required item, the form is redisplayed containing your data along with an error message describing the problem.</li>
<li>This process continues until you have submitted a valid form.</li>
</ol>
<p>On the receiving end, the script must:</p>
<ol>
<li>Check for required data.</li>
<li>Verify that the data is of the correct type, and meets the correct criteria. (For example, if a username is submitted
it must be validated to contain only permitted characters. It must be of a minimum length,
and not exceed a maximum length. The username can't be someone else's existing username, or perhaps even a reserved word. Etc.)</li>
<li>Sanitize the data for security.</li>
<li>Pre-format the data if needed (Does the data need to be trimmed? HTML encoded? Etc.)</li>
<li>Prep the data for insertion in the database.</li>
</ol>
<p>Although there is nothing complex about the above process, it usually requires a significant
amount of code, and to display error messages, various control structures are usually placed within the form HTML.
Form validation, while simple to create, is generally very messy and tedious to implement.</p>
<dfn>CodeIgniter provides a comprehensive validation framework that truly minimizes the amount of code you'll write.
It also removes all control structures from your form HTML, permitting it to be clean and free of code.</dfn>
<h2>Overview</h2>
<p>In order to implement CodeIgniter's form validation you'll need three things:</p>
<ol>
<li>A <a href="../general/views.html">View</a> file containing the form.</li>
<li>A View file containing a "success" message to be displayed upon successful submission.</li>
<li>A <a href="../general/controllers.html">controller</a> function to receive and process the submitted data.</li>
</ol>
<p>Let's create those three things, using a member sign-up form as the example.</p>
<h2>The Form</h2>
<p>Using a text editor, create a form called <dfn>myform.php</dfn>. In it, place this code and save it to your <samp>applications/views/</samp>
folder:</p>
<textarea class="textarea" style="width:100%" cols="50" rows="30"><html>
<head>
<title>My Form</title>
</head>
<body>
<?php echo $this->validation->error_string; ?>
<?php echo form_open('form'); ?>
<h5>Username</h5>
<input type="text" name="username" value="" size="50" />
<h5>Password</h5>
<input type="text" name="password" value="" size="50" />
<h5>Password Confirm</h5>
<input type="text" name="passconf" value="" size="50" />
<h5>Email Address</h5>
<input type="text" name="email" value="" size="50" />
<div><input type="submit" value="Submit" /></div>
</form>
</body>
</html>
</textarea>
<h2>The Success Page</h2>
<p>Using a text editor, create a form called <dfn>formsuccess.php</dfn>. In it, place this code and save it to your <samp>applications/views/</samp>
folder:</p>
<textarea class="textarea" style="width:100%" cols="50" rows="14">
<html>
<head>
<title>My Form</title>
</head>
<body>
<h3>Your form was successfully submitted!</h3>
<p><?php echo anchor('form', 'Try it again!'); ?></p>
</body>
</html>
</textarea>
<h2>The Controller</h2>
<p>Using a text editor, create a controller called <dfn>form.php</dfn>. In it, place this code and save it to your <samp>applications/controllers/</samp>
folder:</p>
<textarea class="textarea" style="width:100%" cols="50" rows="21"><?php
class Form extends Controller {
function index()
{
$this->load->helper(array('form', 'url'));
$this->load->library('validation');
if ($this->validation->run() == FALSE)
{
$this->load->view('myform');
}
else
{
$this->load->view('formsuccess');
}
}
}
?></textarea>
<h2>Try it!</h2>
<p>To try your form, visit your site using a URL similar to this one:</p>
<code>example.com/index.php/<var>form</var>/</code>
<p><strong>If you submit the form you should simply see the form reload. That's because you haven't set up any validation
rules yet, which we'll get to in a moment.</strong></p>
<h2>Explanation</h2>
<p>You'll notice several things about the above pages:</p>
<p>The <dfn>form</dfn> (myform.php) is a standard web form with a couple exceptions:</p>
<ol>
<li>It uses a <dfn>form helper</dfn> to create the form opening.
Technically, this isn't necessary. You could create the form using standard HTML. However, the benefit of using the helper
is that it generates the action URL for you, based on the URL in your config file. This makes your application more portable
and flexible in the event your URLs change.</li>
<li>At the top of the form you'll notice the following variable:
<code><?php echo $this->validation->error_string; ?></code>
<p>This variable will display any error messages sent back by the validator. If there are no messages it returns nothing.</p>
</li>
</ol>
<p>The <dfn>controller</dfn> (form.php) has one function: <dfn>index()</dfn>. This function initializes the validation class and
loads the <var>form helper</var> and <var>URL helper</var> used by your view files. It also <samp>runs</samp>
the validation routine. Based on
whether the validation was successful it either presents the form or the success page.</p>
<p><strong>Since you haven't told the validation class to validate anything yet, it returns "false" (boolean false) by default. The <samp>run()</samp>
function only returns "true" if it has successfully applied your rules without any of them failing.</strong></p>
<h2>Setting Validation Rules</h2>
<p>CodeIgniter lets you set as many validation rules as you need for a given field, cascading them in order, and it even lets you prep and pre-process the field data
at the same time. Let's see it in action, we'll explain it afterwards.</p>
<p>In your <dfn>controller</dfn> (form.php), add this code just below the validation initialization function:</p>
<code>$rules['username'] = "required";<br />
$rules['password'] = "required";<br />
$rules['passconf'] = "required";<br />
$rules['email'] = "required";<br />
<br />
$this->validation->set_rules($rules);</code>
<p>Your controller should now look like this:</p>
<textarea class="textarea" style="width:100%" cols="50" rows="28"><?php
class Form extends Controller {
function index()
{
$this->load->helper(array('form', 'url'));
$this->load->library('validation');
$rules['username'] = "required";
$rules['password'] = "required";
$rules['passconf'] = "required";
$rules['email'] = "required";
$this->validation->set_rules($rules);
if ($this->validation->run() == FALSE)
{
$this->load->view('myform');
}
else
{
$this->load->view('formsuccess');
}
}
}
?></textarea>
<p><dfn>Now submit the form with the fields blank and you should see the error message.
If you submit the form with all the fields populated you'll see your success page.</dfn></p>
<p class="important"><strong>Note:</strong> The form fields are not yet being re-populated with the data when
there is an error. We'll get to that shortly, once we're through explaining the validation rules.</p>
<h2>Changing the Error Delimiters</h2>
<p>By default, the system adds a paragraph tag (<p>) around each error message shown. You can easily change these delimiters with
this code, placed in your controller:</p>
<code>$this->validation->set_error_delimiters('<kbd><div class="error"></kbd>', '<kbd></div></kbd>');</code>
<p>In this example, we've switched to using div tags.</p>
<h2>Cascading Rules</h2>
<p>CodeIgniter lets you pipe multiple rules together. Let's try it. Change your rules array like this:</p>
<code>$rules['username'] = "required|min_length[5]|max_length[12]";<br />
$rules['password'] = "required|matches[passconf]";<br />
$rules['passconf'] = "required";<br />
$rules['email'] = "required|valid_email";</code>
<p>The above code requires that:</p>
<ol>
<li>The username field be no shorter than 5 characters and no longer than 12.</li>
<li>The password field must match the password confirmation field.</li>
<li>The email field must contain a valid email address.</li>
</ol>
<p>Give it a try!</p>
<p class="important"><strong>Note:</strong> There are numerous rules available which you can read about in the validation reference.</p>
<h2>Prepping Data</h2>
<p>In addition to the validation functions like the ones we used above, you can also prep your data in various ways.
For example, you can set up rules like this:</p>
<code>$rules['username'] = "<kbd>trim</kbd>|required|min_length[5]|max_length[12]|<kbd>xss_clean</kbd>";<br />
$rules['password'] = "<kbd>trim</kbd>|required|matches[passconf]|<kbd>md5</kbd>";<br />
$rules['passconf'] = "<kbd>trim</kbd>|required";<br />
$rules['email'] = "<kbd>trim</kbd>|required|valid_email";</code>
<p>In the above example, we are "trimming" the fields, converting the password to MD5, and running the username through
the "xss_clean" function, which removes malicious data.</p>
<p class="important"><strong>Any native PHP function that accepts one parameter can be used as a rule, like <dfn>htmlspecialchars</dfn>,
<dfn>trim</dfn>, <dfn>MD5</dfn>, etc.</strong></p>
<p><strong>Note:</strong> You will generally want to use the prepping functions <strong>after</strong>
the validation rules so if there is an error, the original data will be shown in the form.</p>
<h2>Callbacks: Your own Validation Functions</h2>
<p>The validation system supports callbacks to your own validation functions. This permits you to extend the validation class
to meet your needs. For example, if you need to run a database query to see if the user is choosing a unique username, you can
create a callback function that does that. Let's create a simple example.</p>
<p>In your controller, change the "username" rule to this:</p>
<code>$rules['username'] = "callback_username_check"; </code>
<p>Then add a new function called <dfn>username_check</dfn> to your controller. Here's how your controller should look:</p>
<textarea class="textarea" style="width:100%" cols="50" rows="44"><?php
class Form extends Controller {
function index()
{
$this->load->helper(array('form', 'url'));
$this->load->library('validation');
$rules['username'] = "callback_username_check";
$rules['password'] = "required";
$rules['passconf'] = "required";
$rules['email'] = "required";
$this->validation->set_rules($rules);
if ($this->validation->run() == FALSE)
{
$this->load->view('myform');
}
else
{
$this->load->view('formsuccess');
}
}
function username_check($str)
{
if ($str == 'test')
{
$this->validation->set_message('username_check', 'The %s field can not be the word "test"');
return FALSE;
}
else
{
return TRUE;
}
}
}
?></textarea>
<p>Reload your form and submit it with the word "test" as the username. You can see that the form field data was passed to your
callback function for you to process.</p>
<p><strong>To invoke a callback just put the function name in a rule, with "callback_" as the rule prefix.</strong></p>
<p>The error message was set using the <dfn>$this->validation->set_message</dfn> function.
Just remember that the message key (the first parameter) must match your function name.</p>
<p class="important"><strong>Note:</strong> You can apply your own custom error messages to any rule, just by setting the
message similarly. For example, to change the message for the "required" rule you will do this:</p>
<code>$this->validation->set_message('required', 'Your custom message here');</code>
<h2>Re-populating the form</h2>
<p>Thus far we have only been dealing with errors. It's time to repopulate the form field with the submitted data.
This is done similarly to your rules. Add the following code to your controller, just below your rules:</p>
<code>$fields['username'] = 'Username';<br />
$fields['password'] = 'Password';<br />
$fields['passconf'] = 'Password Confirmation';<br />
$fields['email'] = 'Email Address';<br />
<br />
$this->validation->set_fields($fields);</code>
<p>The array keys are the actual names of the form fields, the value represents the full name that you want shown in the
error message.</p>
<p>The index function of your controller should now look like this:</p>
<textarea class="textarea" style="width:100%" cols="50" rows="30">function index()
{
$this->load->helper(array('form', 'url'));
$this->load->library('validation');
$rules['username'] = "required";
$rules['password'] = "required";
$rules['passconf'] = "required";
$rules['email'] = "required";
$this->validation->set_rules($rules);
$fields['username'] = 'Username';
$fields['password'] = 'Password';
$fields['passconf'] = 'Password Confirmation';
$fields['email'] = 'Email Address';
$this->validation->set_fields($fields);
if ($this->validation->run() == FALSE)
{
$this->load->view('myform');
}
else
{
$this->load->view('formsuccess');
}
}</textarea>
<p>Now open your <dfn>myform.php</dfn> view file and update the value in each field so that it has an attribute corresponding to its name:</p>
<textarea class="textarea" style="width:100%" cols="50" rows="30">
<html>
<head>
<title>My Form</title>
</head>
<body>
<?php echo $this->validation->error_string; ?>
<?php echo form_open('form'); ?>
<h5>Username</h5>
<input type="text" name="username" value="<?php echo $this->validation->username;?>" size="50" />
<h5>Password</h5>
<input type="text" name="password" value="<?php echo $this->validation->password;?>" size="50" />
<h5>Password Confirm</h5>
<input type="text" name="passconf" value="<?php echo $this->validation->passconf;?>" size="50" />
<h5>Email Address</h5>
<input type="text" name="email" value="<?php echo $this->validation->email;?>" size="50" />
<div><input type="submit" value="Submit" /></div>
</form>
</body>
</html>
</textarea>
<p>Now reload your page and submit the form so that it triggers an error. Your form fields should be populated
and the error messages will contain a more relevant field name.</p>
<h2>Showing Errors Individually</h2>
<p>If you prefer to show an error message next to each form field, rather than as a list, you can change your form so that it looks like this:</p>
<textarea class="textarea" style="width:100%" cols="50" rows="20">
<h5>Username</h5>
<?php echo $this->validation->username_error; ?>
<input type="text" name="username" value="<?php echo $this->validation->username;?>" size="50" />
<h5>Password</h5>
<?php echo $this->validation->password_error; ?>
<input type="text" name="password" value="<?php echo $this->validation->password;?>" size="50" />
<h5>Password Confirm</h5>
<?php echo $this->validation->passconf_error; ?>
<input type="text" name="passconf" value="<?php echo $this->validation->passconf;?>" size="50" />
<h5>Email Address</h5>
<?php echo $this->validation->email_error; ?>
<input type="text" name="email" value="<?php echo $this->validation->email;?>" size="50" /></textarea>
<p>If there are no errors, nothing will be shown. If there is an error, the message will appear, wrapped in the delimiters you
have set (<p> tags by default).</p>
<p class="important"><strong>Note: </strong>To display errors this way you must remember to set your fields using the <kbd>$this->validation->set_fields</kbd>
function described earlier. The errors will be turned into variables that have "_error" after your field name.
For example, your "username" error will be available at:<br /><dfn>$this->validation->username_error</dfn>.</p>
<h2>Rule Reference</h2>
<p>The following is a list of all the native rules that are available to use:</p>
<table cellpadding="0" cellspacing="1" border="0" style="width:100%" class="tableborder">
<tr>
<th>Rule</th>
<th>Parameter</th>
<th>Description</th>
<th>Example</th>
</tr><tr>
<td class="td"><strong>required</strong></td>
<td class="td">No</td>
<td class="td">Returns FALSE if the form element is empty.</td>
<td class="td"> </td>
</tr><tr>
<td class="td"><strong>matches</strong></td>
<td class="td">Yes</td>
<td class="td">Returns FALSE if the form element does not match the one in the parameter.</td>
<td class="td">matches[form_item]</td>
</tr><tr>
<td class="td"><strong>min_length</strong></td>
<td class="td">Yes</td>
<td class="td">Returns FALSE if the form element is shorter then the parameter value.</td>
<td class="td">min_length[6]</td>
</tr><tr>
<td class="td"><strong>max_length</strong></td>
<td class="td">Yes</td>
<td class="td">Returns FALSE if the form element is longer then the parameter value.</td>
<td class="td">max_length[12]</td>
</tr><tr>
<td class="td"><strong>exact_length</strong></td>
<td class="td">Yes</td>
<td class="td">Returns FALSE if the form element is not exactly the parameter value.</td>
<td class="td">exact_length[8]</td>
</tr><tr>
<td class="td"><strong>alpha</strong></td>
<td class="td">No</td>
<td class="td">Returns FALSE if the form element contains anything other than alphabetical characters.</td>
<td class="td"> </td>
</tr><tr>
<td class="td"><strong>alpha_numeric</strong></td>
<td class="td">No</td>
<td class="td">Returns FALSE if the form element contains anything other than alpha-numeric characters.</td>
<td class="td"> </td>
</tr><tr>
<td class="td"><strong>alpha_dash</strong></td>
<td class="td">No</td>
<td class="td">Returns FALSE if the form element contains anything other than alpha-numeric characters, underscores or dashes.</td>
<td class="td"> </td>
</tr>
<tr>
<td class="td"><strong>numeric</strong></td>
<td class="td">No</td>
<td class="td">Returns FALSE if the form element contains anything other than numeric characters.</td>
<td class="td"> </td>
</tr>
<tr>
<td class="td"><strong>integer</strong></td>
<td class="td">No</td>
<td class="td">Returns FALSE if the form element contains anything other than an integer.</td>
<td class="td"> </td>
</tr><tr>
<td class="td"><strong>valid_email</strong></td>
<td class="td">No</td>
<td class="td">Returns FALSE if the form element does not contain a valid email address.</td>
<td class="td"> </td>
</tr>
<tr>
<td class="td"><strong>valid_emails</strong></td>
<td class="td">No</td>
<td class="td">Returns FALSE if any value provided in a comma separated list is not a valid email.</td>
<td class="td"> </td>
</tr>
<tr>
<td class="td"><strong>valid_ip</strong></td>
<td class="td">No</td>
<td class="td">Returns FALSE if the supplied IP is not valid.</td>
<td class="td"> </td>
</tr>
<tr>
<td class="td"><strong>valid_base64</strong></td>
<td class="td">No</td>
<td class="td">Returns FALSE if the supplied string contains anything other than valid Base64 characters.</td>
<td class="td"> </td>
</tr>
</table>
<p><strong>Note:</strong> These rules can also be called as discrete functions. For example:</p>
<code>$this->validation->required($string);</code>
<p class="important"><strong>Note:</strong> You can also use any native PHP functions that permit one parameter.</p>
<h2>Prepping Reference</h2>
<p>The following is a list of all the prepping functions that are available to use:</p>
<table cellpadding="0" cellspacing="1" border="0" style="width:100%" class="tableborder">
<tr>
<th>Name</th>
<th>Parameter</th>
<th>Description</th>
</tr><tr>
<td class="td"><strong>xss_clean</strong></td>
<td class="td">No</td>
<td class="td">Runs the data through the XSS filtering function, described in the <a href="input.html">Input Class</a> page.</td>
</tr><tr>
<td class="td"><strong>prep_for_form</strong></td>
<td class="td">No</td>
<td class="td">Converts special characters so that HTML data can be shown in a form field without breaking it.</td>
</tr><tr>
<td class="td"><strong>prep_url</strong></td>
<td class="td">No</td>
<td class="td">Adds "http://" to URLs if missing.</td>
</tr><tr>
<td class="td"><strong>strip_image_tags</strong></td>
<td class="td">No</td>
<td class="td">Strips the HTML from image tags leaving the raw URL.</td>
</tr><tr>
<td class="td"><strong>encode_php_tags</strong></td>
<td class="td">No</td>
<td class="td">Converts PHP tags to entities.</td>
</tr>
</table>
<p class="important"><strong>Note:</strong> You can also use any native PHP functions that permit one parameter,
like <kbd>trim</kbd>, <kbd>htmlspecialchars</kbd>, <kbd>urldecode</kbd>, etc.</p>
<h2>Setting Custom Error Messages</h2>
<p>All of the native error messages are located in the following language file: <dfn>language/english/validation_lang.php</dfn></p>
<p>To set your own custom message you can either edit that file, or use the following function:</p>
<code>$this->validation->set_message('<var>rule</var>', '<var>Error Message</var>');</code>
<p>Where <var>rule</var> corresponds to the name of a particular rule, and <var>Error Message</var> is the text you would like displayed.</p>
<h2>Dealing with Select Menus, Radio Buttons, and Checkboxes</h2>
<p>If you use select menus, radio buttons or checkboxes, you will want the state of
these items to be retained in the event of an error. The Validation class has three functions that help you do this:</p>
<h2>set_select()</h2>
<p>Permits you to display the menu item that was selected. The first parameter
must contain the name of the select menu, the second parameter must contain the value of
each item. Example:</p>
<code>
<select name="myselect"><br />
<option value="one" <dfn><?php echo $this->validation->set_select('myselect', 'one'); ?></dfn> >One</option><br />
<option value="two" <dfn><?php echo $this->validation->set_select('myselect', 'two'); ?></dfn> >Two</option><br />
<option value="three" <dfn><?php echo $this->validation->set_select('myselect', 'three'); ?></dfn> >Three</option><br />
</select>
</code>
<h2>set_checkbox()</h2>
<p>Permits you to display a checkbox in the state it was submitted. The first parameter
must contain the name of the checkbox, the second parameter must contain its value. Example:</p>
<code><input type="checkbox" name="mycheck" value="1" <dfn><?php echo $this->validation->set_checkbox('mycheck', '1'); ?></dfn> /></code>
<h2>set_radio()</h2>
<p>Permits you to display radio buttons in the state they were submitted. The first parameter
must contain the name of the radio button, the second parameter must contain its value. Example:</p>
<code><input type="radio" name="myradio" value="1" <dfn><?php echo $this->validation->set_radio('myradio', '1'); ?></dfn> /></code>
</div>
<!-- END CONTENT -->
<div id="footer">
<p>
Previous Topic: <a href="user_agent.html">User Agent Class</a>
·
<a href="#top">Top of Page</a> ·
<a href="../index.html">User Guide Home</a> ·
Next Topic: <a href="xmlrpc.html">XML-RPC Class</a>
</p>
<p><a href="http://codeigniter.com">CodeIgniter</a> · Copyright © 2006-2010 · <a href="http://ellislab.com/">Ellislab, Inc.</a></p>
</div>
</body>
</html> | prashants/webzash-v1-defunct | user_guide/libraries/validation.html | HTML | apache-2.0 | 26,145 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
1060,
11039,
19968,
1015,
1012,
1014,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.