repo_name
stringlengths 4
116
| path
stringlengths 4
379
| size
stringlengths 1
7
| content
stringlengths 3
1.05M
| license
stringclasses 15
values |
---|---|---|---|---|
apicloudcom/APICloud-Studio
|
org.cef/src/org/cef/handler/CefKeyboardHandler.java
|
4361
|
// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
package org.cef.handler;
import org.cef.browser.CefBrowser;
import org.cef.misc.BoolRef;
/**
* Implement this interface to handle events related to keyboard input. The
* methods of this class will be called on the UI thread.
*/
public interface CefKeyboardHandler {
/**
* Structure representing keyboard event information.
*/
public static final class CefKeyEvent {
/**
* Key event types.
*/
public static enum EventType {
KEYEVENT_RAWKEYDOWN,
KEYEVENT_KEYDOWN,
KEYEVENT_KEYUP,
KEYEVENT_CHAR
}
CefKeyEvent(EventType typeAttr,
int modifiersAttr,
int windows_key_codeAttr,
int native_key_codeAttr,
boolean is_system_keyAttr,
char characterAttr,
char unmodified_characterAttr,
boolean focus_on_editable_fieldAttr) {
type = typeAttr;
modifiers = modifiersAttr;
windows_key_code = windows_key_codeAttr;
native_key_code = native_key_codeAttr;
is_system_key = is_system_keyAttr;
character = characterAttr;
unmodified_character = unmodified_characterAttr;
focus_on_editable_field = focus_on_editable_fieldAttr;
}
/**
* The type of keyboard event.
*/
public final EventType type;
/**
* Bit flags describing any pressed modifier keys.
* @see org.cef.handler.CefContextMenuHandler.EventFlags for values.
*/
public final int modifiers;
/**
* The Windows key code for the key event. This value is used by the DOM
* specification. Sometimes it comes directly from the event (i.e. on
* Windows) and sometimes it's determined using a mapping function. See
* WebCore/platform/chromium/KeyboardCodes.h for the list of values.
*/
public final int windows_key_code;
/**
* The actual key code genenerated by the platform.
*/
public final int native_key_code;
/**
* Indicates whether the event is considered a "system key" event (see
* http://msdn.microsoft.com/en-us/library/ms646286(VS.85).aspx for details).
* This value will always be false on non-Windows platforms.
*/
public final boolean is_system_key;
/**
* The character generated by the keystroke.
*/
public final char character;
/**
* Same as character but unmodified by any concurrently-held modifiers
* (except shift). This is useful for working out shortcut keys.
**/
public final char unmodified_character;
/**
* True if the focus is currently on an editable field on the page. This is
* useful for determining if standard key events should be intercepted.
*/
public final boolean focus_on_editable_field;
@Override
public String toString() {
return "CefKeyEvent [type=" + type + ", modifiers=" + modifiers
+ ", windows_key_code=" + windows_key_code + ", native_key_code="
+ native_key_code + ", is_system_key=" + is_system_key
+ ", character=" + character + ", unmodified_character="
+ unmodified_character + ", focus_on_editable_field="
+ focus_on_editable_field + "]";
}
}
/**
* Called before a keyboard event is sent to the renderer.
*
* @param browser the corresponding browser.
* @param event contains information about the keyboard event.
* @param is_keyboard_shortcut set to true and return false, if
* the event will be handled in OnKeyEvent() as a keyboard shortcut.
* @return true if the event was handled or false otherwise.
*/
public boolean onPreKeyEvent(CefBrowser browser,
CefKeyEvent event,
BoolRef is_keyboard_shortcut);
/**
* Called after the renderer and JavaScript in the page has had a chance to
* handle the event.
*
* @param browser the corresponding browser.
* @param event contains information about the keyboard event.
* @return true if the keyboard event was handled or false otherwise.
*/
public boolean onKeyEvent(CefBrowser browser,
CefKeyEvent event);
}
|
gpl-3.0
|
rukzuk/rukzuk
|
app/server/tests/helper/Test/Seitenbau/Cms/Response.php
|
1984
|
<?php
namespace Test\Seitenbau\Cms;
use Cms\Response as CmsResponse;
/**
* Response
*
* @package Cms
*/
class Response extends CmsResponse
{
/**
* @var array
*/
private $expectedResponseBodySectionKeys;
/**
* @var string
*/
private $rawResponseBody;
/**
* @string
*/
public function __construct($rawResponseBody)
{
$this->rawResponseBody = $rawResponseBody;
$this->expectedResponseBodySectionKeys = array(
'success',
'error',
'data'
);
$this->dissolveSections();
}
/**
* @return string
*/
public function getRawResponseBody()
{
return $this->rawResponseBody;
}
/**
* @throws \Exception
*/
private function dissolveSections()
{
$responseBodySections = json_decode($this->rawResponseBody);
if (is_object($responseBodySections))
{
if ($this->areAllSectionsAvailable($responseBodySections))
{
$this->setSuccess($responseBodySections->success);
if (is_array($responseBodySections->error)
&& count($responseBodySections->error) > 0)
{
$this->setError($responseBodySections->error);
}
$this->setData($responseBodySections->data);
}
else
{
$exceptionMessage = sprintf(
"Not all Response body sections '%s' available",
implode(', ', $this->expectedResponseBodySectionKeys)
);
throw new \Exception($exceptionMessage);
}
} else {
throw new \Exception('No Response body sections found to dissolve');
}
}
/**
* @return boolean
*/
private function areAllSectionsAvailable($responseBodySections)
{
$responseBodyValues = get_object_vars($responseBodySections);
$responseBodySectionKeys = array_keys($responseBodyValues);
sort($this->expectedResponseBodySectionKeys);
sort($responseBodySectionKeys);
return $this->expectedResponseBodySectionKeys === $responseBodySectionKeys;
}
}
|
gpl-3.0
|
competitive-programming-itb/contests
|
NPC2021/qualification/F - Ayam Bangkok Putih cs.cpp
|
729
|
/**
* Contest : NPC Schemastics 2021
* Team : Ayam Bangkok Putih cs.
* Author : Jauhar Wibisono
* Problem : F - Fun Quiz
*/
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9+7;
long long mod_pow(long long a, long long b){
long long ret = 1;
for (; b; b>>=1){
if (b&1) ret = (ret * a) % mod;
a = (a * a) % mod;
}
return ret;
}
long long mod_inv(long long a){
return mod_pow(a, mod-2);
}
const long long inv2 = mod_inv(2);
long long tri(long long a){
return a * (a+1) % mod * inv2 % mod;
}
long long n, s;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> n >> s;
n %= mod;
s %= mod;
cout << (tri(s*n % mod) - tri((n-1+mod) % mod) + mod) % mod << '\n';
return 0;
}
|
gpl-3.0
|
daftano/dl-learner
|
components-core/src/main/java/org/dllearner/core/owl/LabelAnnotation.java
|
1086
|
/**
* Copyright (C) 2007-2011, Jens Lehmann
*
* This file is part of DL-Learner.
*
* DL-Learner 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.
*
* DL-Learner is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.dllearner.core.owl;
import java.net.URI;
/**
* @author Jens Lehmann
*
*/
public class LabelAnnotation extends ConstantAnnotation {
/**
*
*/
private static final long serialVersionUID = -2217233341939580997L;
public LabelAnnotation(URI annotationURI, Constant annotationValue) {
super(annotationURI, annotationValue);
}
}
|
gpl-3.0
|
gohdan/DFC
|
known_files/hashes/bitrix/modules/sale/lib/tradingplatform/vk/feed/data/sources/section.php
|
63
|
Bitrix 17.0.9 Business Demo = c025464b5ea3ecdbe3db72188d0e2d93
|
gpl-3.0
|
hdecarne/java-default
|
src/test/java/de/carne/test/util/prefs/FilePreferencesTest.java
|
5617
|
/*
* Copyright (c) 2018-2020 Holger de Carne and contributors, All Rights Reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.carne.test.util.prefs;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Path;
import java.util.Objects;
import java.util.Properties;
import java.util.prefs.BackingStoreException;
import java.util.prefs.Preferences;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import de.carne.util.prefs.FilePreferencesFactory;
/**
* Test {@linkplain FilePreferencesFactory} class.
*/
class FilePreferencesTest {
@BeforeAll
static void setUpStoreHomeAndSystemProperties(@TempDir Path storeHome) {
System.setProperty("de.carne.util.prefs.FilePreferences", storeHome.toString());
}
@Test
void testCustomPreferences() throws IOException, BackingStoreException {
Preferences customPrefs1 = FilePreferencesFactory.customRoot(loadTestData());
Assertions.assertEquals(1, customPrefs1.keys().length);
Assertions.assertEquals(2, customPrefs1.childrenNames().length);
for (String key : customPrefs1.keys()) {
customPrefs1.remove(key);
}
for (String childrenName : customPrefs1.childrenNames()) {
customPrefs1.node(childrenName).removeNode();
}
Assertions.assertEquals(0, customPrefs1.keys().length);
Assertions.assertEquals(0, customPrefs1.childrenNames().length);
Preferences customPrefs2 = FilePreferencesFactory.customRoot(loadTestData());
copyPrefs(customPrefs2, customPrefs1);
verifyPrefs(customPrefs2, customPrefs1);
customPrefs1.sync();
verifyPrefs(customPrefs2, customPrefs1);
copyPrefs(customPrefs2, customPrefs1);
verifyPrefs(customPrefs2, customPrefs1);
customPrefs1.flush();
verifyPrefs(customPrefs2, customPrefs1);
FilePreferencesFactory.flush();
}
@Test
void testUserPreferences() throws IOException, BackingStoreException {
Preferences referencePrefs = FilePreferencesFactory.customRoot(loadTestData());
Preferences userPrefs1 = Preferences.userRoot();
Assertions.assertEquals(0, userPrefs1.keys().length);
Assertions.assertEquals(0, userPrefs1.childrenNames().length);
copyPrefs(referencePrefs, userPrefs1);
verifyPrefs(referencePrefs, userPrefs1);
userPrefs1.sync();
copyPrefs(referencePrefs, userPrefs1);
verifyPrefs(referencePrefs, userPrefs1);
userPrefs1.flush();
verifyPrefs(referencePrefs, userPrefs1);
Preferences userPrefs2 = Objects.requireNonNull(Preferences.userRoot());
verifyPrefs(referencePrefs, userPrefs2);
Preferences userPrefs3 = FilePreferencesFactory.customRoot(FilePreferencesFactory.userRootFile());
verifyPrefs(referencePrefs, userPrefs3);
FilePreferencesFactory.flush();
}
@Test
void testSystemPreferences() throws IOException, BackingStoreException {
Preferences referencePrefs = FilePreferencesFactory.customRoot(loadTestData());
Preferences systemPrefs1 = Preferences.systemRoot();
Assertions.assertEquals(0, systemPrefs1.keys().length);
Assertions.assertEquals(0, systemPrefs1.childrenNames().length);
copyPrefs(referencePrefs, systemPrefs1);
verifyPrefs(referencePrefs, systemPrefs1);
systemPrefs1.sync();
copyPrefs(referencePrefs, systemPrefs1);
verifyPrefs(referencePrefs, systemPrefs1);
systemPrefs1.flush();
verifyPrefs(referencePrefs, systemPrefs1);
Preferences systemPrefs2 = Objects.requireNonNull(Preferences.userRoot());
verifyPrefs(referencePrefs, systemPrefs2);
Preferences userPrefs3 = FilePreferencesFactory.customRoot(FilePreferencesFactory.userRootFile().toFile());
verifyPrefs(referencePrefs, userPrefs3);
FilePreferencesFactory.flush();
}
private Properties loadTestData() throws IOException {
Properties data = new Properties();
try (InputStream dataStream = getClass().getResourceAsStream(getClass().getSimpleName() + ".properties")) {
data.load(dataStream);
}
return data;
}
private void copyPrefs(Preferences from, Preferences to) throws BackingStoreException {
for (String key : from.keys()) {
to.put(key, from.get(key, null));
}
for (String childrenName : from.childrenNames()) {
Preferences subFrom = Objects.requireNonNull(from.node(childrenName));
Preferences subTo = Objects.requireNonNull(to.node(childrenName));
copyPrefs(subFrom, subTo);
}
}
private void verifyPrefs(Preferences expected, Preferences actual) throws BackingStoreException {
Assertions.assertEquals(expected.keys().length, actual.keys().length);
for (String key : expected.keys()) {
Assertions.assertEquals(expected.get(key, null), actual.get(key, key));
}
Assertions.assertEquals(expected.childrenNames().length, actual.childrenNames().length);
for (String childrenName : expected.childrenNames()) {
Preferences subExpected = Objects.requireNonNull(expected.node(childrenName));
Preferences subActual = Objects.requireNonNull(actual.node(childrenName));
verifyPrefs(subExpected, subActual);
}
}
}
|
gpl-3.0
|
ut/zakk-admin
|
spec/controllers/home_controller_spec.rb
|
146
|
require 'spec_helper'
describe HomeController do
it "should show homepage" do
get :index
expect(response).to be_successful
end
end
|
gpl-3.0
|
makmaksim/monitoring
|
www/crm/views/groups/groups.php
|
6673
|
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');?>
<div class="page_title"><?=$menu_item->name?></div>
<div class="form filter_form navbar-collapse" style="margin-bottom: 15px;">
<div class="form-inline navbar-nav">
<form class="filter_form">
<?php if($perms->control_user) : ?>
<div class="form-group"><button type="button" class="btn btn-primary add_user_btn" data-group_id="<?=$menu_item->group_id?>"><?=lang('add_user')?></button></div>
<?php endif; ?>
<label class="form-group"> </label>
<label class="form-group"><?=lang('filter_label')?></label>
<div class="form-group">
<?=ViewInput::_list(array(
'only' => true,
'name' => 'filter_field',
'label' => lang('field_text'),
'list' => $fields,
'key' => 'field_id',
'val' => 'name',
'value' => $this->input->get('filter_field')
))?>
</div>
<div class="form-group filter_val">
<?=$filter_val?>
</div>
<?=ViewInput::_get_send_button(array(
'only' => true,
'label' => lang('filter_button')
))?>
<?=ViewInput::_get_button(array(
'only' => true,
'label' => lang('filter_button_clean')
), 'onclick="location.href=\'' . $group_href . '\'"')?>
<?php if($perms->control_export) : ?>
<a href="<?=$export_link?>" target="_blank" class="btn btn-success"><?=lang('export_text')?></a>
<?php endif; ?>
</form>
</div>
<?=$count_in_page?>
</div>
<div class="users_list">
<table class="table table-hover table-bordered table-responsive table-striped table-condensed" id="userlist_table">
<thead>
<tr>
<th></th>
<th></th>
<?php foreach($fields as $field) : ?>
<th>
<span class="clean_sort glyphicon <?php if($field->order == 2){
echo 'glyphicon glyphicon-sort-by-attributes-alt';
}elseif($field->order == 1){
echo 'glyphicon glyphicon-sort-by-attributes';
} ?>" title="<?=lang('clean_sort_text')?>"></span>
<span class="sort_btn" data-order="<?=$field->order?>" data-field="<?=$field->unique?>"><?=$field->name?></span></th>
<?php endforeach; ?>
</tr>
</thead>
<tbody>
<?php foreach($users as $user) : ?>
<tr class="user_tr_<?=$user->user_id?>">
<td>
<div class="dropdown">
<span class="glyphicon glyphicon-menu-hamburger dropdown-toggle" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"></span>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li>
<span class="glyphicon glyphicon-pencil"></span>
<span class="btn edit_fields_btn" data-user_id="<?=$user->user_id?>"><?=lang('edit_user_text')?></span>
</li>
<?php if($editop == $user->user_id || $perms->control_user) : ?>
<li>
<span class="glyphicon glyphicon-cog"></span>
<span class="btn edit_params_user_btn" data-user_id="<?=$user->user_id?>"><?=lang('params_user_text')?></span>
</li>
<?php endif; ?>
<?php if($perms->control_user) : ?>
<li>
<span class="glyphicon glyphicon-trash"></span>
<span class="btn remove_user_btn" data-user_id="<?=$user->user_id?>"><?=lang('remove_user_text')?></span>
</li>
<?php endif; ?>
</ul>
</div>
</td>
<td>
<a href="/home/<?=$user->user_id?>" class="glyphicon glyphicon-eye-open tooltop_title user_status_<?=($user->status) ? $user->status : 0 ; ?>" target="_blank" title="<?=($user->last_active) ? lang('last_active_text') . date(lang('datetime_format'), strtotime($user->last_active)): lang('last_active_text') . lang('last_active_text_undefined') ; ?>"></a>
</td>
<?php foreach($fields as $field) : ?>
<td style="<?=$field->data?>"
<?php if($perms->{$field->unique . '_rec'}) : ?>
class="dynamic_field_edit" data-field="<?=$field->unique?>" data-user="<?=$user->user_id?>" data-cell="<?=$user->cell_id?>"
<?php endif; ?>
>
<?php if(($field->in_cell && $user->count_cell) || !$field->in_cell) : ?>
<?php if($field->params == 1) : ?>
<a href="/home/<?=$user->user_id?>"><?=ViewInput::get_field_data($user, $field)?></a>
<?php else : ?>
<?=ViewInput::get_field_data($user, $field)?>
<?php endif; ?>
<?php endif; ?>
</td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?=$pagination?>
</div>
<div class="modal fade" id="delete_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<p><?=lang('delete_text')?></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default no_btn" data-dismiss="modal"><?=lang('no')?></button>
<button type="button" class="btn btn-primary yes_btn" data-dismiss="modal"><?=lang('yes')?></button>
</div>
</div>
</div>
</div>
|
gpl-3.0
|
jonathankablan/prestashop-1.6
|
prestashop_1.7/app/Resources/translations/fr-FR/1.6modulesautoupgradetranslationsfr-FR.php
|
79465
|
<?php
global $_MODULE;
$_MODULE = array();
$_MODULE['<{autoupgrade}prestashop>adminpreferences_6adf97f83acf6453d4a6a4b1070f3754'] = 'Aucun';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_c035796995e11f000835780bbadbd575'] = 'Standard (5 étapes)';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_b563636fd3896671be0104bbc6783be4'] = 'Commande express';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_27f3765c3871cd5fe52f88f31dfe2c89'] = 'supérieur';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_f8d23e159df67b2673d7c29166864453'] = 'inférieur';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_700e61469b84a66ddb24304a85b0c181'] = 'classique';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_7fe15a347d66e291d7a1375273226205'] = 'Activer la boutique';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_049104cffa3c1841dece50e6e41f749c'] = 'Activez ou désactivez votre boutique. Désactivez votre boutique pendant que vous effectuez la maintenance. Veuillez noter que le webservice ne sera pas désactivé pour autant et que vos données seront toujours accessibles par ce biais';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_daf835712085aaaf81818e7ebfeb66b8'] = 'IP de maintenance';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_894cd7887e47ca0e836e31577664b1ea'] = 'Adresses IP autorisées à accéder au front-office même si la boutique est désactivée. Utilisez une virgule (\',\') pour les séparer (par exemple : 42.24.4.2,127.0.0.1,99.98.97.96)';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_1656072e927c8d3acd24359cbb648bb5'] = 'Activer le SSL';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_8de64d6b49cebd2306af6ddbcd268700'] = 'Si votre hébergeur propose le protocole SSL, vous pouvez activer le cryptage SSL (https://) pour l\'identification des clients et le processus de commande';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_ed5454727fb14b9800ead242d0972184'] = 'Vérifier l\'IP dans le cookie';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_9cfc2e28ebe44b3e14f9d780d2150650'] = 'Vérifie l\'adresse IP du cookie pour éviter qu\'il ne soit volé';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_c87330f475e4384552c0077927d26e1a'] = 'Durée de vie du cookie front-office';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_6d964e25aa6aa88c8353880e00202cf4'] = 'Indiquez le nombre d\'heures';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_e673b146824251548feecf1f3929aceb'] = 'Durée de vie du cookie back-office';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_e12874163bcb256726ddfe643aa53a63'] = 'Améliorer la sécurité du Front-Office';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_cce43372fe8624c0edf870f417557b84'] = 'Active ou désactive les jetons en front-office afin d\'améliorer la sécurité de PrestaShop';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_16c390c0fd1efc4f493a6a861aa22d2f'] = 'Bulles d\'aide du back-office';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_dc58d598b2b22e50c5af01134305a4fb'] = 'Active l\'aide contextuelle en dessous des champs de saisie dans le Back-Office';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_59aad85b376259844b471a758908a3c1'] = 'Type de processus de commande';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_6c9f73b6b5d16baa641cf8343348eb8d'] = 'Vous pouvez choisir le type de processus de commande : standard (5 étapes, 5 pages) ou "commande en 1 clic" (5 étapes au sein d\'une même page)';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_403e42a4b26e379cb13563c98ab63067'] = 'Activer la commande express (sans création de compte)';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_11e7774c4aeee369f9de701a795fb58d'] = 'Cette fonctionnalité permet le passage de commande sans création de compte';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_e4045598261988d9988c594243a9434d'] = 'Conditions générales de vente';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_342b52e8fe475dc8b5bf11afbfd46ea4'] = 'Requiert l\'acceptation des Conditions Générales de Vente par le client avant de passer commande';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_d4d27f93d89b170800f7896e3e438468'] = 'Page CMS de conditions générales de vente';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_6cda6c81a66d7faecf49e94a3b55e924'] = 'Choisissez la page CMS de conditions générales de vente';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_cd712537c39c43dcbf61e61a6df83cdd'] = 'Proposer des emballages cadeaux';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_28a318da44a83a4124b9cbcfa4978722'] = 'Propose l\'emballage cadeau au client et la possibilité de laisser un message';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_2a0677dae563d574fb1c50badaa4eabf'] = 'Tarifs emballages cadeaux';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_c173252856179a44a9506a968359de8b'] = 'Indiquez le prix de l\'emballage cadeau';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_0d8bdbe98feb696dd76760ee1374a740'] = 'Taxe des emballages cadeaux';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_9311ccba175a9f2fc72e7c6a3dfb6078'] = 'Indiquez une taxe pour l\'emballage cadeau';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_3aadb5e86b174ecada1174e22f5a6368'] = 'Taille maximale des fichiers joints';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_0550caa9a256c7672bda5f09a45c9334'] = 'Définissez la taille maximale des fichiers joints (en mégaoctets)';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_b667478ccafce4bff6d427a6bca06269'] = 'Proposer des emballages recyclés';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_e84eed89f38f20639431d99ad2f5ee8a'] = 'Proposez au client de choisir un emballage en matières recyclées';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_e6b03a6bdf49d1cd0655e0f7a3d990cb'] = 'Réafficher le panier après identification';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_8d7a93422a7ecd89d12811e22055f6d5'] = 'Après l\'authentification du client, récupération et affichage de son dernier panier';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_ac2021d3c67ee796d7ab20a466ebd583'] = 'Règle d\'arrondi';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_95be164e850e88c5282e84669f368e1b'] = 'Vous pouvez choisir le mode d\'arrondi : arrondir toujours au supérieur, à l\'inférieur, ou arrondi classique.';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_46f18d3960afc01e5a1a5a0e0e9d571b'] = 'Vérifier automatiquement les mises à jour de modules';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_686a2ac82a5a64eca870ba9a55b8a675'] = 'De nouveaux modules et mises à jour sont affichés sur la page des modules';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_a9fff6d50be898f47a507354626b8b8d'] = 'Masquer les conseils d\'optimisation';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_e4e2107f99e82247d7e32ac7919c4416'] = 'Masquer les conseils d\'optimisation sur la page d\'accueil du panneau d\'administration';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_79a8435260e0c3b17e30ccb1c6dfc75c'] = 'Afficher les fournisseurs et les fabricants';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_4be87dc8773fa2fb95b7b8302cb47fa9'] = 'Afficher la liste des fournisseurs et des fabricants même si les blocs correspondants sont désactivés';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_9f47ef1ea6bca844b91ceb0322e6ae83'] = 'Utiliser Smarty 2 au lieu de Smarty 3';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_e0357226a7cbd43985e1b49bb30f9c55'] = 'Activer si votre thème n\'est pas compatible avec Smarty 3 (vous devriez mettre à jour le thème car Smarty 2 n\'est pas supporté à partir de la version 1.5 de PrestaShop)';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_d5bc5fd307b108537039b6b6f98889d5'] = 'Fuseau horaire :';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_bbd6622dbbdf4bcb166f5e3f018a2351'] = 'Cliquez ici pour utiliser le protocole HTTPS avant d\'activer le mode SSL.';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_0db377921f4ce762c62526131097968f'] = 'Paramètres généraux';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_93cba07454f06a4a960172bbd6e2a435'] = 'Oui';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_bafd7322c6e97d25b6299b5d6fe8920b'] = 'Non';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_c6e98a4b0af7d0f66842f744d999e436'] = 'Afin d\'utiliser un nouveau thème, merci de suivre les étapes suivantes';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_432eb00cc8aace97c632fea212575b51'] = 'Importer votre thème en utilisant ce module';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_2b5bde814a5f94ea73f447cdbcfb49fd'] = 'Installeur de thème';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_64915993f11c4fbd47d8a6465f44125c'] = 'Quand votre thème est importé, merci de sélectionner celui-ci sur cette page';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_21034ae6d01a83e702839a72ba8a77b0'] = '(HT)';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_c770d8e0d1d1943ce239c64dbd6acc20'] = 'Ajouter mon IP';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_6a7a397c4d4b5842440eb4eab1f7af8c'] = 'Si vous modifiez le thème, le fichier settings.inc.php doit être accessible en écriture (chmod 755 / 777)';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_38fb7d24e0d60a048f540ecb18e13376'] = 'Enregistrer';
$_MODULE['<{autoupgrade}prestashop>adminpreferences_19f823c6453c2b1ffd09cb715214813d'] = 'Champ requis';
$_MODULE['<{autoupgrade}prestashop>adminselftab_87a2663d841b78f01c27c0edb4f50b76'] = 'Suppression réussie';
$_MODULE['<{autoupgrade}prestashop>adminselftab_a7df4df5ba87b5e752c81b276959e797'] = 'Sélection supprimée avec succès';
$_MODULE['<{autoupgrade}prestashop>adminselftab_84b4d8c8cdd02488c0f868e97b22a3c2'] = 'Création réussie';
$_MODULE['<{autoupgrade}prestashop>adminselftab_151648106e4bf98297882ea2ea1c4b0e'] = 'Mise à jour réussie';
$_MODULE['<{autoupgrade}prestashop>adminselftab_23b865d0b880b74fa330741e1cb25b73'] = 'Nouvelle version vérifiée avec succès';
$_MODULE['<{autoupgrade}prestashop>adminselftab_def73ea130852d9e7813ee61eefa24e7'] = 'Mise à jour des réglages réussie';
$_MODULE['<{autoupgrade}prestashop>adminselftab_ee05efe0548fdafc9e85cb4c34fbe845'] = 'Image supprimée avec succès';
$_MODULE['<{autoupgrade}prestashop>adminselftab_7cfc3f369b8123e1c2d22a37b31a49a7'] = 'Module téléchargé avec succès';
$_MODULE['<{autoupgrade}prestashop>adminselftab_6175b106e638d4dd873cb3ff96724392'] = 'Miniatures régénérées avec succès';
$_MODULE['<{autoupgrade}prestashop>adminselftab_ad3737feaf28ed81b4073c7113f6228e'] = 'Message envoyé au client';
$_MODULE['<{autoupgrade}prestashop>adminselftab_e41431d37c0f818843740e11a69c5ec2'] = 'Commentaire ajouté';
$_MODULE['<{autoupgrade}prestashop>adminselftab_a7c974ac23201089a5d17536bbb09f05'] = 'Module installé';
$_MODULE['<{autoupgrade}prestashop>adminselftab_bbaed3b1f842925ef862ec19261744d8'] = 'Module désinstallé';
$_MODULE['<{autoupgrade}prestashop>adminselftab_2c76ba09452e3da727ed4e65cf2f2593'] = 'Langue copiée avec succès';
$_MODULE['<{autoupgrade}prestashop>adminselftab_9469a4605b719b91e2cdac9e3bbf460d'] = 'Traductions ajoutées avec succès';
$_MODULE['<{autoupgrade}prestashop>adminselftab_16c64b6f203dd2b0a840184ef902a704'] = 'Module greffé sur le point d\'accroche avec succès';
$_MODULE['<{autoupgrade}prestashop>adminselftab_46b1b35fd252d60dd4d1b610a9224943'] = 'Module retiré du point d\'accroche avec succès';
$_MODULE['<{autoupgrade}prestashop>adminselftab_2df9f8b8654e79c091ab5f33c9e1b67b'] = 'Mise en ligne réussie';
$_MODULE['<{autoupgrade}prestashop>adminselftab_b85b9d2e7e1153bd3d5a4bb0f57d347b'] = 'Duplication réussie';
$_MODULE['<{autoupgrade}prestashop>adminselftab_4402aa7e384266cd7d0350c1cc9a0123'] = 'La traduction a été ajoutée avec succès mais la langue n\'a pas été créée';
$_MODULE['<{autoupgrade}prestashop>adminselftab_2aa80a00e1c76b0c14ef567e0e322a0e'] = 'Module réinitialisé avec succès';
$_MODULE['<{autoupgrade}prestashop>adminselftab_40606a2d55f7c33c732f1d3c1b5b1e66'] = 'Module supprimé';
$_MODULE['<{autoupgrade}prestashop>adminselftab_0c6992101fe78e4f1ae3f391c485de29'] = 'Pack de localisation importé';
$_MODULE['<{autoupgrade}prestashop>adminselftab_d4fecde5ac83b59cc690fd4d26d79abe'] = 'Remboursement effectué';
$_MODULE['<{autoupgrade}prestashop>adminselftab_795aa39f13629841edad6c04d3aca405'] = 'Images déplacées avec succès';
$_MODULE['<{autoupgrade}prestashop>adminselftab_93cba07454f06a4a960172bbd6e2a435'] = 'Oui';
$_MODULE['<{autoupgrade}prestashop>adminselftab_bafd7322c6e97d25b6299b5d6fe8920b'] = 'Non';
$_MODULE['<{autoupgrade}prestashop>adminselftab_c6e98a4b0af7d0f66842f744d999e436'] = 'Afin d\'utiliser un nouveau thème, merci de suivre les étapes suivantes';
$_MODULE['<{autoupgrade}prestashop>adminselftab_432eb00cc8aace97c632fea212575b51'] = 'Importer votre thème en utilisant ce module';
$_MODULE['<{autoupgrade}prestashop>adminselftab_2b5bde814a5f94ea73f447cdbcfb49fd'] = 'Installeur de thème';
$_MODULE['<{autoupgrade}prestashop>adminselftab_64915993f11c4fbd47d8a6465f44125c'] = 'Quand votre thème est importé, merci de sélectionner celui-ci sur cette page';
$_MODULE['<{autoupgrade}prestashop>adminselftab_21034ae6d01a83e702839a72ba8a77b0'] = '(HT)';
$_MODULE['<{autoupgrade}prestashop>adminselftab_c770d8e0d1d1943ce239c64dbd6acc20'] = 'Ajouter mon IP';
$_MODULE['<{autoupgrade}prestashop>adminselftab_6a7a397c4d4b5842440eb4eab1f7af8c'] = 'Si vous modifiez le thème, le fichier settings.inc.php doit être accessible en écriture (chmod 755 / 777)';
$_MODULE['<{autoupgrade}prestashop>adminselftab_38fb7d24e0d60a048f540ecb18e13376'] = 'Enregistrer';
$_MODULE['<{autoupgrade}prestashop>adminselftab_19f823c6453c2b1ffd09cb715214813d'] = 'Champ requis';
$_MODULE['<{autoupgrade}prestashop>adminselftab_0557fa923dcee4d0f86b1409f5c2167f'] = 'Précédent';
$_MODULE['<{autoupgrade}prestashop>adminselftab_630f6dc397fe74e52d5189e2c80f282b'] = 'Retour à la liste';
$_MODULE['<{autoupgrade}prestashop>adminselftab_32397e87e6e403cbad4f3d26385ad6ef'] = 'Vous n\'avez pas les droits suffisants pour l\'ajout';
$_MODULE['<{autoupgrade}prestashop>adminselftab_ddcaee4edc8938535941b620ae5ec359'] = 'Vous n\'avez pas la permission d\'éditer ici';
$_MODULE['<{autoupgrade}prestashop>adminselftab_0470d45929f27e1161330164c423b415'] = 'Définir les champs requis pour cette section';
$_MODULE['<{autoupgrade}prestashop>adminselftab_e54b38290c8bdd95e8bc10412c9cc096'] = 'Champs requis';
$_MODULE['<{autoupgrade}prestashop>adminselftab_81f32b96f6626b8968e6a0f4a9bce62e'] = 'Sélectionnez les champs que vous voulez rendre obligatoires pour cette section.';
$_MODULE['<{autoupgrade}prestashop>adminselftab_ee9b2f3cf31c23c944b15fb0b33d6a77'] = 'Nom du champ';
$_MODULE['<{autoupgrade}prestashop>adminselftab_5f010bff822f60730a2ce82bf4e996ed'] = 'Le champ nommé %s est requis.';
$_MODULE['<{autoupgrade}prestashop>adminselftab_cc59329bfcbfff0fe8f6cb50571ebe46'] = 'Le champ nommé %1$s est requis au moins dans la langue %2$s.';
$_MODULE['<{autoupgrade}prestashop>adminselftab_86fd808b199a8633c43be9407f98e365'] = 'Le champ %1$s est trop long (maximum %2$s caractères).';
$_MODULE['<{autoupgrade}prestashop>adminselftab_300d1d56be6fd86077c2553c2e5a281d'] = 'Le champ nommé %1$s (dans la langue %2$s) est trop long (maximum %3$s caractères, caractères HTML compris).';
$_MODULE['<{autoupgrade}prestashop>adminselftab_01f8544c8fd4628bc686502e8b727d95'] = 'le champ';
$_MODULE['<{autoupgrade}prestashop>adminselftab_998b344cff693ad388a14ba89b1523c7'] = 'n\'est pas valide';
$_MODULE['<{autoupgrade}prestashop>adminselftab_07213a0161f52846ab198be103b5ab43'] = 'erreurs';
$_MODULE['<{autoupgrade}prestashop>adminselftab_6357d3551190ec7e79371a8570121d3a'] = 'Il y a';
$_MODULE['<{autoupgrade}prestashop>adminselftab_4ce81305b7edb043d0a7a5c75cab17d0'] = 'Il y a';
$_MODULE['<{autoupgrade}prestashop>adminselftab_3879149292f9af4469cec013785d6dfd'] = 'avertissements';
$_MODULE['<{autoupgrade}prestashop>adminselftab_7b83d3f08fa392b79e3f553b585971cd'] = 'avertissement';
$_MODULE['<{autoupgrade}prestashop>adminselftab_8a3cfd894d57e33c55400fc9d76aa08a'] = 'Cliquez ici pour en savoir plus';
$_MODULE['<{autoupgrade}prestashop>adminselftab_a92269f5f14ac147a821728c23204c0b'] = 'Masquer l\'avertissement';
$_MODULE['<{autoupgrade}prestashop>adminselftab_00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Activé';
$_MODULE['<{autoupgrade}prestashop>adminselftab_b9f5c797ebbf55adccdd8539a65a0241'] = 'Désactivé';
$_MODULE['<{autoupgrade}prestashop>adminselftab_ed75712b0eb1913c28a3872731ffd48d'] = 'Dupliquer';
$_MODULE['<{autoupgrade}prestashop>adminselftab_bfc18def58cfa50029d149e9b932e974'] = 'Copier aussi les images ?';
$_MODULE['<{autoupgrade}prestashop>adminselftab_4351cfebe4b61d8aa5efa1d020710005'] = 'Afficher';
$_MODULE['<{autoupgrade}prestashop>adminselftab_7dce122004969d56ae2e0245cb754d35'] = 'Modifier';
$_MODULE['<{autoupgrade}prestashop>adminselftab_f2a6c498fb90ee345d997f888fce3b18'] = 'Supprimer';
$_MODULE['<{autoupgrade}prestashop>adminselftab_0071aa279bd1583754a544277740f047'] = 'Supprimer l\'élément n°';
$_MODULE['<{autoupgrade}prestashop>adminselftab_6adab6d3fdf92c448d60cf8824e4851c'] = 'Supprimer la sélection';
$_MODULE['<{autoupgrade}prestashop>adminselftab_e25f0ecd41211b01c83e5fec41df4fe7'] = 'Supprimer les éléments sélectionnés ?';
$_MODULE['<{autoupgrade}prestashop>adminselftab_cc3787ca78f445f481069a4c047f7e7a'] = 'Choisissez la langue :';
$_MODULE['<{autoupgrade}prestashop>adminselftab_b51d77dc443d4051900f1bad9fe885aa'] = 'Vous êtes actuellement connecté avec le nom de domaine suivant :';
$_MODULE['<{autoupgrade}prestashop>adminselftab_6aa5c0d2cbc4a0f53206777be432056a'] = 'Celui-ci est différent du nom de domaine de la boutique principale présent dans l\'onglet "Préférences > SEO et URLs" :';
$_MODULE['<{autoupgrade}prestashop>adminselftab_7e4b7faf0fc36dc296e66f6ea3096dcd'] = 'Cliquez ici si vous souhaitez modifier le nom de domaine de la boutique principale';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_bb7748991e29366d42f8fa2c361f4d55'] = 'Sauvegarder ma base de données et mes fichiers';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_e53b4fd73748419564a1742f66ba631f'] = 'Sauvegarde automatiquement votre base de données et vos fichiers afin de pouvoir restaurer votre boutique en cas de besoin. Cette fonctionnalité est expérimentale : vous devriez toujours sauvegarder manuellement par sécurité.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_d5342bfd5b032cd75faeebdf2a918a79'] = 'Sauvegarder mes images';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_9a2cad898ee3d0ea4573946becdec9cf'] = 'Pour gagner du temps, vous pouvez choisir de ne pas sauvegarder vos images. Dans tous les cas, veillez à ce qu\'elles aient été sauvegardées manuellement.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_5243e62512552a2cd6369e446bbf10f4'] = 'Puissance du serveur';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_a94e6f7e27ad55c963170658ee6a9e28'] = 'A moins que vous n\'utilisiez un serveur dédié, choisissez "Basse".';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_9e435ab00f5e0606f46337fdc73164ff'] = 'Une valeur élevée peut faire échouer la mise à jour si votre serveur n\'est pas assez puissant pour traiter les différentes tâches de la mise à jour en un temps suffisamment court.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_73ae0e1bfd470f9e26dac64d270cda9d'] = 'Basse (recommandée)';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_87f8a6ab85c9ced3702b4ea641ad4bb5'] = 'Moyenne';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_655d20c1ca69519ca647684edbb2db35'] = 'Haute';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_26f07ad840fb1c17d29f5be0f428f015'] = 'Désactiver les modules non-natifs';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_70c06c37194d755dd9aef11cf0469981'] = 'Comme les modules non-natifs peuvent être source d\'incompatibilités, nous recommandons de les désactiver par défaut.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_469ab377c49ea68b2ecdfe76d628a53b'] = 'Les garder actifs peut vous empêcher de charger la page "Modules" correctement après la mise à jour.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_fa2508196ef3391139d01d8d38b2c1bb'] = 'Mettre à jour le thème par défaut';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_837f859cdd8b16024d72169ed315e9b5'] = 'Si vous avez personnalisé le thème PrestaShop par défaut dans son dossier (dossier nommé "prestashop" en 1.4, "default" en 1.5, "bootstrap-defaut" en 1.6), activer cette option vous fera perdre vos modifications.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_97a989a73b46233ae4330fb7682a70a2'] = 'Si vous utilisez votre propre thème, activer cette option mettra simplement à jour les fichiers du thème par défaut, sans modifier votre thème.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_92991497ed914de6bb7795b701b4c6e4'] = 'Utiliser le thème par défaut';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_c7ae0af8d5653beb68b344415aca135d'] = 'Cela modifiera votre thème : votre boutique utilisera le thème par défaut de la version de PrestaShop vers laquelle vous faites la mise à jour.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_5a6925648fc1286cae7924e80690d3a7'] = 'Mettre à jour les e-mails standards.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_9770c64dad08073b1291334767e0f99c'] = 'Ceci va mettre à jour les e-mails standards.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_bd25c8f0a4d9745cbefc666500c45c84'] = 'Si vous avez personnalisé les modèles des emails PrestaShop par défaut, activer cette option vous fera perdre vos modifications.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_947a49c0d390e5984c04751dfaeef83e'] = 'Mode pas à pas.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_5daa24f177056cf9b1ac69738471bca9'] = 'Toujours réaliser la mise à jour pas à pas (mode debug)';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_e803dd4410d411c286544d04af33732e'] = 'Afficher les erreurs PHP';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_d5e479152ae739641ca1bc69cbab0b3e'] = 'Cette option gardera le paramètre PHP "display_errors" activé (ou le forcera).';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_04c9fb8fb8679a8fbaf09f5a3568f0a9'] = 'Ceci n\'est pas recommandé parce que la mise à jour va immédiatement échouer si une erreur PHP survient pendant un appel Ajax.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_36be1130454bc8c4e0a41d36fa062a8b'] = 'Impossible de créer le répertoire %s';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_6215d33db0d099fcaae168dd4715135a'] = 'Impossible d\'écrire dans le dossier "%s"';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_dec33e9cf9ab739bc3a27b98b343a4ef'] = 'Impossible de créer le fichier %s';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_56195ded2802813800f43e3be1babe1c'] = 'Erreur à la suppression des sauvegardes %s';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_a520e5cbdc465c7b7d39c98f78fe2506'] = 'Mise à jour terminée. Félicitation ! Vous pouvez maintenant réactiver votre boutique.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_2a7e17be5dc799b0c478ec5f576f0713'] = 'Le processus de mise à jour est terminé. Félicitations ! Vous pouvez maintenant réactiver votre boutique.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_7a32329d6776ff98d77f7344caf7e00b'] = 'Mise à jour terminée, mais des avertissements sont apparus.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_d2b9f1e39aa8e96bb61f3a4bfe133f58'] = '%s supprimé';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_75802ba44ba3369defd92ef897bf2f21'] = 'Veuillez supprimer %s via FTP';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_93cba07454f06a4a960172bbd6e2a435'] = 'Oui';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_bafd7322c6e97d25b6299b5d6fe8920b'] = 'Non';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_38fb7d24e0d60a048f540ecb18e13376'] = 'Enregistrer';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_19f823c6453c2b1ffd09cb715214813d'] = 'Champ requis';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_f2ff9d001d0a553c78da73443e7fcd97'] = 'La configuration a bien été mise à jour.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_40b980e89ae332507380470cd26cdf4d'] = 'Cette page va maintenant être rafraîchie et le module va vérifier si une nouvelle version est disponible.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_1d1a5763d2901dbd435b378358a149b4'] = 'Le fichier %s n\'existe pas. Impossible de sélectionner ce canal.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_c944c279a9e87437e100f65b8c87c391'] = 'Numéro de version manquant. Impossible de sélectionner ce canal.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_ab232f4b20c0e50dad9081bc39382569'] = 'La mise à jour utilisera le canal "archive"';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_1fe9dd96f646eaa0cd3a0fcc7632ce12'] = 'Impossible de sauver la configuration.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_02a400be38a385b3aa5a07df9a39e9d7'] = '%1$s fichiers seront modifiés, %2$s fichiers seront supprimés (s\'ils existent).';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_c6fd96a9aed05923b617fdc8d98d1181'] = 'Les fichiers sont identiques';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_335b4c111b193a855539368676837af4'] = 'Impossible de vérifier les fichiers de la version installée de PrestaShop.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_4ad974c7f06be7aa3ce318299d3b5dbb'] = 'Impossible de vérifier les fichiers';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_8d8e0207549d32c6f864246403034279'] = 'Les fichiers du coeur sont ok';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_8ed8bd0ec34ae857cb99e4196d3154f4'] = '%1$s modifications de fichiers ont été détectées, dont %2$s fichiers natifs (coeur et modules) :';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_ca895e37bd5dfe413d7ffdd592580117'] = 'Démarrage de la mise à jour...';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_c96aad12b8ec23c5788682f0e5e0999d'] = 'Étapes téléchargement et désarchivage ignorées, le processus de mise à jour va maintenant supprimer les données de démonstration.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_b06a965d6f83ecc3c04eefe175482f1d'] = 'Boutique désactivée. Suppression de fichiers d\'exemple...';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_12a183559f01986a8b177528124e1b4b'] = 'Étape de téléchargement ignorée, le processus de mise à jour va maintenant désarchiver l\'archive locale.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_1a74ca8250ceb3e4df43a70181064e03'] = 'Boutique désactivée. Décompression de l\'archive...';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_a3e702f156f1b517ba98d2487f58bd91'] = 'Boutique désactivée. Téléchargement en cours... (peut prendre un moment)';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_10b5aa33077df49427f04cd33ad3843f'] = 'L\'archive téléchargée viendra de %s';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_da652b8ece8ba2da84d5f5116f6ef63e'] = 'Le hash MD5 va être comparé à %s';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_654f7ceb787fd455c166d5d8744cbf90'] = 'Le répertoire "/latest" a été vidé';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_7dce6149440985f89756b4c451d7dc03'] = 'Extraction du fichier terminée. Suppression des fichiers de démonstration...';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_89640d2ed666aab722d12be60a61938d'] = 'Impossible d\'extraire le fichier %1$s dans le dossier %2$s...';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_064a15c7711dd82e5026a17a453b3a3b'] = 'Impossible d\'écrire dans le dossier d\'extraction.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_01d9d38b1d4d8eff5b530eeecfd3ccd5'] = 'Impossible d\'écrire dans le dossier d\'extraction %s.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_99f0e3a6d61b6d39da9213c647fd35ce'] = '[ERREUR] %s n\'existe pas ou n\'est pas un répertoire.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_d8316e26b7d1322f4445d3ffeec4bcfb'] = 'Rien n\'a été extrait. Il semble que l\'étape "décompression" ait été sautée.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_2de9cd00fdcc22adb43ea03f2a09dee5'] = '[ERREUR] Impossible de trouver les fichiers à mettre à jour.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_c165b990be724cefca897c7c4cc70cac'] = 'Impossible de lister les fichiers à mettre à jour';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_5479863b0426e29c3a17a3f9cc6e3746'] = '%s fichiers seront mis à jour.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_4f7c02592a962e40a920f32f3a24f2df'] = 'filesToUpgrade n\'est pas un tableau';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_6274f940a4c03421253b1acc4064349e'] = 'Tous les fichiers ont été mis à jour. Mise à jour de la base de données en cours...';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_41deb3bc122b8e650d7a4758ea95f5c3'] = 'Erreur lors de la mise à jour du fichier %s.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_b0f289346085535bae89eadc15991f24'] = 'encore %1$s fichier(s) à mettre à jour.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_078a325fbcc1dbd50bd9f969ce954965'] = 'encore %2$s fichiers à mettre à jour.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_8994f47952b9b29743e45a72ed30707c'] = 'Rien n\'a été extrait. Il semble que l\'étape "décompression" ait été sautée.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_0530243ad5b9bd205a04b975d3ef8aaf'] = '%s modules seront mis à jour.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_0f786a53b1674815c24679ed64770223'] = 'l\'étape upgradeModule (mise à jour des modules) ne s\'est pas terminée correctement.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_1baa2ea6cee198c6b7f19011431dcc73'] = 'La variable "listModules" n\'est pas un tableau. Aucun module n\'a été mis à jour.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_d88a8630bd4e8fdbd61c550e53d62a94'] = '%s module(s) restant à mettre à jour.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_fb9740393108d477fc3606647cb14ee7'] = 'Le module %1$s n\'est pas compatible avec la version 1.5.X, il sera supprimé de votre serveur FTP.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_7bb21f802330e2539d8342f05c0cd78f'] = 'Le module %1$s n\'est pas compatible avec la version 1.6.X, veuillez le supprimer de votre installation.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_f0d18de100ab33463602ea5b8165d842'] = 'Les modules Addons (extensions) ont bien été mis à jour.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_35687f9e2d83cd9e89860c47fb3a7bbd'] = 'Les fichiers du module %s ont été mis à jour.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_2743947c7353cf849fbff70085764d76'] = '[ATTENTION] Erreur lors de la mise à jour du module %s.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_0aebfe257803d2dc4f444fe079edd7ec'] = '[ERREUR] Impossible d\'écrire le fichier zip du module %s dans le répertoire temporaire.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_36d56d20b3894281531cd4108e2c4cec'] = '[ERREUR] Aucune réponse du serveur Addons.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_eac34868b4fb511702e53d1405c45454'] = 'Erreur lors de la mise à jour de la base de données. Nous vous conseillons de restaurer votre base de données.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_08ee54c048e1589f4072a351035db2ad'] = 'Base de données mise à jour. Mise à jour de vos modules Addons...';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_ead14b0273e8d6cae7d146130d4be8f6'] = 'La base de données a été nettoyée.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_ca02217f9735e1acce9d586baeeac905'] = 'Le dossier /install/upgrade/php est manquant dans l\'archive ou le répertoire';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_3b8f044559a7568ea572776caf1d6526'] = 'Le fichier config/settings.inc.php n\'a pas été trouvé.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_22f18bac5d420d7ac5aca37b1afe30c9'] = 'Version actuelle : %1$s. Version à installer : %2$s.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_6b81346a0c9173213e0c32d0082dc073'] = 'Version actuelle : %1$s. Version à installer : %2$s';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_f8498f0014f0b834b635ad879ae1b3fd'] = '[ERREUR] La version à installer est trop ancienne.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_89928a14f2090aec4fd7aff9ea983f95'] = 'Il n\'y a pas de version plus ancienne. Avez-vous supprimé ou renommé le fichier settings.inc.php du dossier config ?';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_b3884f9e8ed49a8d7165787d3adec342'] = 'Configuration de la base de données invalide';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_f25792b5b08a78dd01810297d219c10c'] = 'Impossible de trouver le répertoire de mise à jour "upgrade" dans le chemin d\'installation.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_8abd985d095a1282f6f01b98c121b41b'] = 'Impossible de trouver les fichiers de mise à jour SQL. Veuillez vérifier que le dossier %s n\'est pas vide.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_bf3abb5f80807c7453c246193372e1ae'] = '%s n\'est pas un numéro de version valide.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_f8b97ae2c4f8cc2a9dc74ca3d4306ce3'] = 'Erreur lors du chargement du fichier de mise à jour SQL "%s.sql".';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_7e6f1194307c585ca2e97f81c3db4bb3'] = '[SUPPRESSION] La table SQL %s a été supprimée.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_3c2e3b812ebc9bc95ccd9bf9086c4af7'] = 'Une erreur est survenue pendant la mise à jour de la base de données.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_257f5523f283710c6859d8f425a0c657'] = 'Mise à jour de la base de données terminée';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_9dcf84f429818d396d05335d52ef5f42'] = '[IGNORE] le répertoire "%s" n\'existe pas et ne peut pas être vidé.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_4cb8d96f333a2339fe544b96ee2740de'] = '[NETTOYAGE DU CACHE] Fichier %s supprimé';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_9c7e0ba2c6ecb11af7f39843bbc18ff8'] = 'Erreur(s) détectée(s) pendant la mise à jour.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_c4615fc8cb7877b074cbe9813cd742b1'] = 'Mise à jour de la base de données terminée';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_f08c0f19e801344fe73ef0a0f4cd1dcb'] = 'Erreur lors de l\'ouverture de settings.inc.php en mode écriture';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_38ef745d6a25e051fe2463983dd735b8'] = 'Erreur à la génération du nouveau settings.inc.php';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_618bfc1f9ba85d07157a388208fe3ff8'] = 'Fichiers de configuration mis à jour';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_c76662717bc0a1c0a601534af98f537b'] = '[AVERTISSEMENT] Le fichier %s n\'existe pas, il n\'a pas été fusionné.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_cbdc88f921ee4831120cc2c516f9115b'] = '[ATTENTION] La variable %1$s est manquante dans le fichier %2$s. La fusion a été ignorée.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_ef697ec05df3c9e19d683663849ec6dc'] = '[ATTENTION] La variable %1$s est manquante dans le fichier %2$s. Le fichier %2$s a été supprimé et la fusion ignorée.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_9a2f2cf276ea9f79b31a815897c0e3e6'] = '%s ignoré';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_4794a520f862841749c18466119acfed'] = '[ATTENTION] Le fichier %1$s a été supprimé.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_cbfafdaa2e7968a86bd6a437027edfea'] = 'Répertoire %1$s créé.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_a61e66de5e0b581cc66f73f5662660c6'] = 'Erreur lors de la création du répertoire %s.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_6548fa42c02566c65bcf4be7eaf9612d'] = 'Le répertoire %1$s existe déjà.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_3cff0684b1efe09d70bd5c9a54389ff6'] = '[TRADUCTION] Les fichiers de traduction ont été combinés dans le fichier %1$s.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_3a18d253ac081dd79cfeee690c90627c'] = '[TRADUCTION] Les fichiers de traduction ont été combinés dans le fichier %1$s. Passage à la copie de %2$s.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_b8db10001e04b8f947415aeb8b8fd19f'] = '%1$s copié.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_6b9a4ce3d1e99d730ce3a56a0986d966'] = 'erreur lors de la copie de %1$s';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_29e063a740d59d8759b52d4cf9c39fa0'] = 'Erreur lors de la copie du fichier %1$s';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_d75374f4463479bfc16764f06fc8d33e'] = '[ERREUR] Le fichier %s est manquant : impossible de restaurer les fichiers. Opération annulée.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_99db61185a28a3f862dcb99e891b2897'] = '[ERREUR] Aucun fichier de sauvegarde de la base de données trouvé : il sera impossible de restaurer la base de données. Opération annulée.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_0438424c05d45646dc089ef15df7e0e2'] = 'Restauration des fichiers...';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_222102295c3c6626ff141687b0f49b6b'] = 'Rien à restaurer';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_7ead6886c2e0fb40e873da8426e80988'] = '%s fichier(s) seront supprimés avant la restauration des fichiers sauvegardés.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_e3ca00e5b833d0a90d433416435dcaf5'] = '[ERREUR] Le fichier de sauvegarde %s n\'existe pas.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_8dbf48bc796e7f70a17c63dd084bf068'] = '[ERREUR] Le fichier "%s" n\'existe pas.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_2a2c187bdb804ba79fd4bf8972ba5073'] = 'Impossible de supprimer les fichiers mis à jour.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_7575346d53af6b5bb70539f2cf9e87ea'] = 'Fichiers de mise à jour ont été supprimés.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_b582cb787be5a12424b3b8ed2cca3cd3'] = '%s fichiers supprimés';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_2c6bc2c84e0d76d1091e754d5780ab15'] = 'Erreur lors de la suppression de %1$s.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_37dc35abea377bac2bcd5bf174ea7b57'] = 'Fichier %s non supprimé.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_45303d089088042b5373afc26af8dc7f'] = '[AVERTISSEMENT] %s supprimé.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_06a4c1e9de1558a80e838aeced377231'] = '[AVERTISSEMENT] Le dossier %s a été ignoré (il n\'est pas vide).';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_0eaea22b698a8194099f1eb6d5d35eb0'] = '[AVERTISSEMENT] %s n\'existe pas';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_509c213d2211a33977ce4ac516fe615a'] = 'Encore %s fichier(s) à supprimer.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_671537225baa948d4c92cf4681283326'] = 'Fichiers restaurés. Restauration de la base de données...';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_cb7dce5f6a1934d54c0d3335c7ffe841'] = 'Fichiers restaurés.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_c9d5c2286b4b5212cba58d0dd4ab369d'] = 'Impossible d\'extraire le fichier %1$s dans le dossier %2$s .';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_5ce67d010ab9c98ae1dbd6b5ea149982'] = 'La sauvegarde de la base de données est vide.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_24e93c50e3a9e22e8c948c7986cbeb66'] = 'Le fichier %1$s de restauration de la base de donnée est terminé. Encore %2$s fichier(s)...';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_55fc6682e256e387afb10ebf6c95aed5'] = 'Restauration du fichier de BDD %1$s faite.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_5b37242b8a0a39af0a9dc28abdabba28'] = 'La base de données à été restaurée.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_e40517de82d2888877a24f233cef618e'] = '[ERREUR SQL] ';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_b232a418538e3f6904357039ff7b1052'] = 'Erreur lors de la restauration de la base de données';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_64736d2638d494df1bedffae7fa10c86'] = '%1$s requêtes restantes pour le fichier %2$s';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_30da45f850d1f1a2b42f215836382f19'] = 'Restauration de la base de donnée terminée';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_926abe867e8b1be1c0b053234cae77ba'] = 'Sauvegarde de la base non effectuée. Début de la mise à jour des fichiers...';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_2b0e9a817cf34a8251bdf75c9b1cfefc'] = 'Chemin de sauvegarde interdit en écriture ';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_d12ae4e7f0d20f4a4ca357d48e42877e'] = 'Le fichier %s existe déjà. Opération annulée.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_d82896159c60199272e5ea481a733eba'] = 'Impossible de créer le fichier %s de sauvegarde de la base de données.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_dcb7d833c69d6e0c3f009381c51f898e'] = 'Erreur pendant la sauvegarde de la base de données';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_52033453d4d673bae012b9c8ccb1e79c'] = 'Une erreur est apparue lors de la sauvegarde. Impossible d\'obtenir le schema de %s';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_ca3f0a9c2464acb36a341a9bf8df0e3f'] = 'la table %1$s a été sauvegardée.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_0af2a5642ce31adf7b91aa934f4f57ae'] = '%1$s tables ont été sauvegardées.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_c2a086cb5c3373d7e11acbd3ace6a553'] = 'Sauvegarde de la base de données : %s table(s) restantes...';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_f5f6ee32184b6a03c5c9928cbefa07f7'] = 'Aucun table valide n\'a été trouvée pour sauvegarder. Sauvegarde du fichier %s annulée.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_0e27b7ac485e03dabd5648acd5982dde'] = 'Erreur pendant la sauvegarde de la base de données pour le fichier %s.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_4b85e344355a8c135644f239db898749'] = 'La sauvegarde de la base de donnée est faite dans le fichier %s. Mise à jour des fichiers...';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_e6de5ce7d70a6ed1e2d2d2a25c1bffb4'] = 'Erreur lors de la sauvegarde des fichiers';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_f2afc9e120786d21fd6809c836258669'] = '[ERREUR] Le nom de fichier backupFiles n\'a pas été paramétré';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_48f95ff09327408a578e91655ed872a1'] = '%s fichiers à sauvegarder.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_70960f2aa87d307170d3a1bc3e06d904'] = 'sauvegarde des fichiers initilialisée dans %s';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_9bebecbf68b6ce5a6d656c5ea793b762'] = 'Sauvegarde des fichiers en cours. Encore %d fichiers.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_43021c1fdde702e1ce1aebb2a8bf6978'] = 'Utilisation de la classe ZipArchive...';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_cf460c5ac4a650da739cf774cd5f8944'] = 'Utilisation de la classe PclZip...';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_f36d7ee6cae92008008a95bf5898daf2'] = 'Tous les fichiers sont enregistrés. Sauvegarde de la base de données';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_f39b870765d50b64ba7a6facea83010d'] = 'Tous les fichiers ont été ajoutés à l\'archive.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_995d693d79b7f8a95c6b7b195970eed2'] = '%1$s ajouté à l\'archive. Encore %2$s fichiers.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_4f1030e1e84ec150a7786a243cd7fb08'] = 'Erreur lorsque vous essayez d\'ajouter %1$s à l\'archive %2$s.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_c7c570b3566699e8c10eabb1a12c3b07'] = 'Fichier %1$s (taille : %3$s) ajouté à l\'archive. Encore %2$s fichiers.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_d85360d9b6992f471292bf16fe32a16d'] = 'Fichier %1$s (taille : %2$s) ajouté à l\'archive.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_6e30d5ad868a1053455a9219e14883fc'] = 'Le fichier %1$s (taille : %2$s) a été ignoré pendant la sauvegarde.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_8a5062d4832b42720342c513d7d52f7d'] = '[ERREUR] Erreur de la sauvegarde avec PclZip : %s.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_b9a2db69065827812dd4b7a7f9ffc0b1'] = 'impossible d\'ouvrir l\'archive';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_41247d1e5ee2ca774bfdc3262ee1770b'] = 'Tous les fichiers sont enregistrés. Sauvegarde de la base de données.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_a3549a19c865da802e8aaaf45390d579'] = '%1$s éléments supprimés. Encore %2$s éléments.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_d268ccafaebc89d9c5fec0e4de024456'] = 'Erreur lors de la suppression de l\'élément %1$s, encore %2$s éléments.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_344c592d141604c614c219fad3fa0dae'] = '%1$s fichiers exemple à supprimer';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_6db37da3334e8a950c5bcdabc9fcf8f8'] = 'Tous les fichiers exemple ont été supprimés. Sauvegarde ignorée. Mise à jour des fichiers.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_1d62b7d31a19dde578c4c56babef264a'] = 'Tous les exemples de fichiers supprimés. Sauvegarde des fichiers en cours.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_65b259727ac87919e232bd9b63920f36'] = 'Téléchargement de %s';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_549e11f82d3c02b92e5db1b38b858eb6'] = 'Sauvegarde du fichier dans %s';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_42cfe8e0aff754a0951f95b5285171bc'] = 'le dossier de téléchargement a été vidé';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_3c2681ea85407c2c0d252e05a8eaf6aa'] = 'Téléchargement terminé.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_a55401a11251f53f612e950d4115e116'] = 'Téléchargement terminé. Extraction...';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_2d9a3f4a92c008b32903541e9af8aff0'] = 'Téléchargement terminé, mais le calcul MD5 ne correspond pas (%s).';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_df88998b6b9585bbcfd201186695b686'] = 'Téléchargement terminé, mais le calcul MD5 ne correspond pas (%s). Opération annulée.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_412cb9a2978bf041be4ca6c6ded0030c'] = 'Erreur au téléchargement. La "clef communautaire" est peut-être erronnée';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_0c0db54fe8212c1a7215005fef75d7dd'] = 'Erreur pendant le téléchargement';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_60a77be5a62b1c663b12ccaf97250986'] = 'Impossible d\'écrire dans le dossier de téléchargement.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_5385901e5bed459563860e2f08a90a1c'] = 'Impossible d\'écrire dans le dossier de téléchargement %s.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_6d60c7758acae39203ef1fadcbb2010b'] = 'Vous devez activer "allow_url_fopen" ou cURL pour que le téléchargement automatique fonctionne.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_fb1ca1f5f3eb5a2ca85201f449525527'] = 'Vous devez activer "allow_url_fopen" ou cURL pour que le téléchargement automatique fonctionne. Vous pouvez également mettre le fichier en ligne dans le chemin de fichier %s.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_a75d0dd3210dc796149dd5503a4b9b9f'] = '[ATTENTION] La propriété %s est manquante';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_3bb38e7d0bfd5a02f7c06cae446fee86'] = 'l\'action %s ignorée';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_b4302e98d94591ee9afa09e769b2ee63'] = 'action "%1$s" non trouvée';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_760c4026bc5a0bd5378e6efc3f1370b4'] = 'Trop long !';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_4f2e28904946a09d8c7f36dd3ee72457'] = 'Les champs sont différents !';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_e5110300599f995b9d8cfbe930fba83e'] = 'Cette adresse est invalide !';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_2e170dfd78c2171a25605ececc0950a4'] = 'Impossible d\'envoyer l\'email !';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_015463558b0e4910ecff6b418977c872'] = 'Impossible de créer le fichier settings.inc.php. Si /config/settings.inc.php existes, merci de donner les droits en écriture à l\'utilsateur apache. Sinon, merci de créer ce fichier dans votre dossier config';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_128a6722ff88445b488e4eb3319fa5b7'] = 'Le fichier de paramètres n\'a pu être écrit, veuillez créer un fichier nommé settings.inc.php dans votre dossier "config".';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_e930e2474c664a3a7e89ecfb8793694b'] = 'Impossible d\'envoyer le fichier !';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_774fc7a0f56391abc5d8856f2436ca07'] = 'L\'intégrité des données n\'est pas validée.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_8fd007bf08e0717537825a3e91cb4fcc'] = 'Impossible de lire le contenu d\'un des fichiers *.sql.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_17a90b480e6f6b8d1214df46c8678015'] = 'Impossible d\'accéder au contenu du fichier MySQL.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_3d5c8f1d29b1a1dc4ea0673122e0d277'] = 'Erreur lors de l\'insertion dans la base';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_17e1581d01152347bfaacd153b961379'] = 'Mot de passe incorrect (chaîne alpha-numérique d\'au moins 8 caractères)';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_26b66034d6aa1380df1d30fe33e2e0f6'] = 'Une base de données PrestaShop existe déjà, vous devez la supprimer manuellement ou changer son préfixe.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_bc5e1163a15106f9e941a7603124709d'] = 'Ce n\'est pas un nom valide.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_a9d82945b8603f0c8807958d7db9a24d'] = 'Ce n\'est pas une image valide.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_b37eef07b764ea58eec9afe624e20a40'] = 'Erreur lors de la création du fichier /config/settings.inc.php.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_3d9f514d46849760ef1b1412e314fd99'] = 'Erreur :';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_c5bcaf2cc3be924182f0ec0e3124ed99'] = 'Cette base de données PrestaShop existe déjà, veuillez revalider vos informations d\'authentification à la base de données.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_d7a99f61bb284d096ea4f221784af85a'] = 'Une erreur est survenue lors du redimensionnement de l\'image.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_428c933bafbf262d693fbf1c22c03e5d'] = 'La base de données a été trouvée !';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_76bd190129b7aefb90fdf42f09ec3ec7'] = 'Le serveur de bases de données est disponible mais la base de données n\'a pas été trouvée';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_045f4b5c3f990e5a26e2837495d68259'] = 'Le serveur de bases de données n\'a pas été trouvé, merci de vérifier vos identifiants ou le nom du serveur.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_757fc72e8d69106dd2cf9da22cc7adb1'] = 'Une erreur est survenue lors de l\'envoi de l\'email, merci de vérifier vos paramètres.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_d18ad19290b3bfc3cd0d7badbb6cb6a3'] = 'Impossible d\'écrire l\'image /img/logo.jpg. Si celle-ci existe déjà, merci de la supprimer manuellement.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_2368e33e3e01d53abb9b60061ab83903'] = 'Le fichier envoyé dépasse la taille maximum autorisée.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_a10ef376d9f4c877ac86d8e4350116bf'] = 'Le fichier envoyé dépasse la taille maximum autorisée.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_f8fe8cba1625eaf8e5c253b041d57dbd'] = 'Le fichier a été envoyé partiellement.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_8c9067e52e4440d8a20e74fdc745b0c6'] = 'Aucun fichier n\'a été envoyé';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_2384d693d9af53b4727c092af7570a19'] = 'Il manque le dossier temporaire de réception de vos envois de fichiers. Merci de consulter votre administrateur système.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_f5985b2c059d5cc36968baab7585baba'] = 'Impossible d\'écrire le fichier sur le disque';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_9e54dfe54e03b0010c1fe70bd65cd5e6'] = 'Envoi de fichier interrompu à cause de l\'extension incorrecte';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_32af3a59b50e98d254d6c03c5b320a94'] = 'Impossible de convertir les données de votre base de données en UTF-8.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_989a45a4ca01ee222f4370172bf8850d'] = 'Nom de votre boutique non valide';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_68499acecfba9d3bf0ca8711f300d3ed'] = 'Votre prénom contient des caractères invalides';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_2399cf4ca7b49f2706f6e147a32efa78'] = 'Votre nom contient des caractères invalides';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_7d72600fcff52fb3a2d2f73572117311'] = 'Votre serveur de base de données ne supporte pas le jeu de caractère utf-8.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_7186f703d20b263cfb91161418996e43'] = 'Votre serveur MySQL ne peut pas utiliser ce moteur de base de données, veuillez en choisir un autre tel que MyISAM';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_24b481455c1b72b0c2539e7d516b9582'] = 'Le fichier /img/logo.jpg n\'a pas les droits d\'écriture, merci d\'effectuer un CHMOD 755 ou 777 sur ce fichier';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_5746b74663148afffd1350c97d4fcdfe'] = 'Champ mode catalog invalide';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_9e5459c4deb20b7842ac01e97390b334'] = 'Erreur inconnue.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_dafe44b99256a7783bc37f4f949da373'] = 'Cet installeur est trop vieux.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_37ce0f29c7377c827e7247fe5645a782'] = 'Vous êtes déjà en possession de la version %s';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_5276a8cbd9e3e467396089b267564f51'] = 'Le fichier config/settings.inc.php n\'a pas été trouvé. L\'avez-vous supprimé ou renommé ?';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_5908157f5787d0050586f5629562f1f0'] = 'Impossible de trouver les fichiers de mise à jour SQL. Veuillez vérifier que le dossier /install/upgrade/sql n\'est pas vide.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_580e4b216e324f675f0237cdb34b6c2d'] = 'Pas de mise à jour possible.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_94c7530ebb30de665b276d6881cb2f7b'] = 'Erreur lors du chargement du fichier de mise à jour SQL.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_b8286438fbb6c7df9129fadc5316c19f'] = 'Erreur lors de l\'insertion dans la base de données';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_229ee8046cafc09ddaf46fb9db710e91'] = 'Malheureusement, ';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_e805a556799b7cef40e9760c81d99218'] = 'erreurs SQL sont apparues.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_5627353fd6ac678497af3ece05087068'] = 'Le fichier config/defines.inc.php n\'a pas été trouvé. Ou est-il passé ?';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_446c9e952debe114c86bbd9e5eea7d61'] = 'Restaurer (Rollback)';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_946a7fdf02f1a9f08e6711d014e3bc47'] = 'Après avoir mis à jour votre boutique, vous pouvez restaurer la version précédente. Utilisez cette fonction si votre thème ou un module essentiel ne fonctionne pas correctement.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_a4d88b46c8edb6b0ee2fb4d6bd0690b0'] = 'Choisissez votre sauvegarde :';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_c629f24e672b4e1165ebf1c10b5c5c5d'] = '-- Choisissez la sauvegarde à restaurer --';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_69ff9aca0bd03b3981784593311d866a'] = 'La liste des points à vérifier avant la mise à jour';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_03f945bba76ea63369d50a340e5b17bf'] = 'Tous les points de la liste de vérifications ne sont pas validés. Vous pouvez mettre à jour votre boutique seulement quand tous les indicateurs sont au vert.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_1b631ee6d890a5d6f2ede2f386f5aa3d'] = 'Avant de lancer la mise à jour, veuillez vous assurer que tous les points de la liste de vérifications sont au vert.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_0058c0de9990c3b6a816affc3ffac3ef'] = 'Le module de mise à jour en 1 clic est à jour (votre version est v%s)';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_06933067aafd48425d67bcb01bba5cb6'] = 'Mettre à jour';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_801ab24683a4a8c433c6eb40c48bcd9d'] = 'Téléchargement';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_a1b48c4a544d688c34c20950c74e474a'] = 'La racine de votre boutique doit être accessible en écriture (permissions CHMOD appropriées)';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_b398e46a283dd457aa7dc0302004208c'] = 'Le répertoire "/admin/autoupgrade" est accessible en écriture (permissions CHMOD appropriées)';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_6509fb64b7a0331814629513e36d1402'] = 'L\'option PHP "Safe mode" est désactivée';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_027d4866414c87a3af00e3acf98f2012'] = 'L\'option PHP "allow_url_fopen" est activée, ou cURL est installé';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_49c20044e894d8cc2da7783adbf79f16'] = 'Votre boutique est en mode maintenance';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_10f7f752bbed690312dff7e8814b6994'] = 'Cliquez ici pour mettre votre shop en maintenance';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_2ec74fb71dd2f8f0111f2d74bfe7a7b3'] = 'Les fonctionnalités de cache de PrestaShop sont désactivées';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_2b1af926a233d2fd8826d281e03ae5d7'] = 'Le thème mobile est désactivé';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_0c3d04ce8fc363ea466bc20e377367e6'] = 'Le paramètre PHP max_execution_time a une valeur élevée ou est complètement désactivé (valeur actuelle : %s)';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_958f470d0b1c8fb2b9e62b48e8903299'] = 'illimité';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_8641eaacafab9d58e7e93a92ff318714'] = '%s secondes';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_aa9b0228ac4e3e44b836f79eebf5e481'] = 'Veuillez aussi vous assurez de faire vous-même une sauvegarde manuelle complète de vos fichiers et de votre base de donnée.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_d5d4eff97eccea28fa291fecac84fa14'] = 'branche :';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_e4894ca167b08880bfc35862f18575eb'] = 'disponible';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_7060e0481896e00b3f7d20f1e8e2749a'] = 'non disponible';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_4e140ba723a03baa6948340bf90e2ef6'] = 'Nom :';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_987023af1c4e507ea04eb5069578f7f0'] = 'Numéro de version :';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_3b3d06023f6353f8fd05f859b298573e'] = 'URL :';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_ededa0b9a77dd39dad86a79cdc2a7521'] = 'Hash MD5 :';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_bca4ff8cbf5fd614a700ca81c820dc1b'] = 'Changelog :';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_39089ec5b14aadac3156e62cde5027b1'] = 'voir le changelog';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_628decaabab912af39cfda7aaf47b059'] = 'Version majeure';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_43899376e3f4d4cb70dad59c81a4b957'] = 'version mineures (recommandé)';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_1436348d2e10c88964c87efe3ebe7e4c'] = 'version candidates (RC)';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_3da4e7a86631518f47d8cedf7f09a5ed'] = 'Versions béta';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_0c960ac8fc33e1516a568248519b4d03'] = 'Versions béta';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_8ed3e1637b29848c46224287390822ad'] = 'Version privée (requiert un lien et un hash MD5)';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_15e90667b50b56b1f8a01bdb1190f3dc'] = 'Archive locale';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_17897209dd708b862fe417f6d429a8da'] = 'Dossier local';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_3b3d4b4b6a128cfeafc8e3f8987ddb9b'] = 'Canal :';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_e710e20abcca585174701a265f39885f'] = 'Cette option vous fera profiter de toutes les versions stables.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_ef2f59f06132ddc2e1bc8d00abbe6e02'] = 'Lien :';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_6e843a36f447872179db90ceff68d970'] = 'Clé de hash :';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_b77d20ed1ba7b2ee7139dc4f3fd13117'] = 'Autoriser les mise à jour majeure :';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_780daf2510c5c9e1c58948f138629817'] = 'Archive a utiliser :';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_db992f14c2e79f2e8650cdb5d918f27f'] = 'Choisir une archive';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_0bce225c5aed0aaee0d357a11a079962'] = 'pour mettre à jour vers la version';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_5be0150b075f706fc27b09753ce6646d'] = 'Aucune archive trouvée dans votre dossier admin/autoupgrade/download';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_4b0319a87fb1baabe2fdb810e5cd4e62'] = 'Cette option va ignorer l\'étape téléchargement.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_d477bfdc10c5b1dc8afaf9018555e28f'] = 'L\'archive contenue dans le répertoire %1$s sera utilisée pour la mise à jour.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_58a7807a7c90ca70d471aeab775f32a9'] = 'Le répertoire %1$s sera utilisé pour la mise à jour vers la version ';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_59934c8d535a30c791e371449d6b564c'] = 'Cette option évite les étapes de téléchargement et décompression de l\'archive.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_c9cc8cce247e49bae79f15173ce97354'] = 'Enregistrer';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_9e68a57463e52beb2b2d4d116085044e'] = 'Plus d\'options (mode expert)';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_d0285505fd09db653a4ec0fd3799f357'] = 'Mode expert';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_89f144934543c527b7b064ee64361d90'] = 'Veuillez choisir votre canal:';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_cdcf07ad291a3b7a0cc30b870705ba63'] = 'Les canaux vous offrent différentes manières de réaliser une mise à jour. Vous pouvez soit télécharger la nouvelle version sur votre serveur manuellement, soit laisser le module Mise à Jour en 1 Clic le télécharger pour vous.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_87ad8a8ff4a99ffd2e72d5e69765f830'] = 'Les canaux Alpha, Beta et Privé vous donnent la possibilité de mettre à jour votre boutique vers une version non officielle ou instable (à des fins de test uniquement).';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_7d71d389caebafeecac50e98c8e14dec'] = 'Par défaut, vous devriez utiliser le canal "Versions mineures" qui offre la dernière version stable disponible.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_48c7c41b72e1d678923ce3571aa65b2d'] = 'Étape';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_eeb5a49c38d2d8c2baa51ed09beccf88'] = 'Étapes de mise à jour';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_2359934469520d062d98f6b3e91e1523'] = 'Comparaison des versions';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_71aa2b9774b005c47f9cd225766b2045'] = 'version non modifiée de PrestaShop';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_68d0661e6a4150c4cc813001958f47f1'] = 'Différences entre les versions';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_2b16564e6e838ce86608620b70beb570'] = 'Journal d\'activité';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_1f966606f0a941f655a4e9b7791a1ae0'] = 'traitement en cours';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_21739f79b8e95f4187fce4fefb12af28'] = 'Analyse des fichiers...';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_5ef0c737746fae2ca90e66c39333f8f6'] = 'Erreurs';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_dc3fd488f03d423a04da27ce66274c1b'] = 'Attention !';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_95095fc4bbc8b42ec512cfb1cfa19d8a'] = 'Vous utilisez la version %s de PHP. PrestaShop ne supportera bientôt plus les versions PHP antérieures à 5.4. Pour anticiper ce changement, nous vous recommandons d\'effectuer une mise à jour vers PHP 5.4 dès maintenant !';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_e58eae3d7ced672a49b5716587b15f89'] = 'Commencer la mise à jour.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_5784315a8bcebe79611d3353723e010d'] = 'Félicitations ! Vous utilisez déjà la version de PrestaShop la plus récente !';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_da3cd17bbbbd3ef7da8e817d3c4cdb46'] = 'Vous venez du futur ! Vous utilisez une version plus récente que la dernière disponible !';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_762b3814b0c85540ac4be47c7815fc0c'] = 'Votre version actuelle de PrestaShop';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_40cb0f190ec55b9721df3aed84b0b29b'] = 'Dernière version officielle pour le canal %1$s.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_382b0f5185773fa0f67a8ed8056c7759'] = 'N/D';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_f34ac641f410c44e719fbc1496efd3d8'] = 'Mettre à jour PrestaShop maintenant !';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_7926343e047e18778b6819beb8468086'] = 'Vous utilisez Smarty 3';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_a9bf52016ab038b62d072d35039a76b4'] = 'Smarty 2 est déprécié dans la version 1.4 et a été supprimé en 1.5. Vous pouvez choisir de mettre à jour votre thème actuel ou utiliser un nouveau thème.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_d19581ebc0d99bfda1b0bb789dc65c5f'] = 'Utilisation de Smarty 3 :';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_411d9b409e4b9a6c2db930dae9f1feb1'] = 'Editez votre configuration Smarty';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_7f6336f29afd114798bf8ff3e6f2f9c9'] = 'PrestaShop sera téléchargé depuis %s';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_a0c7f60d480662bb235ca5e204d71883'] = 'Ouvrir le changelog dans une nouvelle fenêtre';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_7f07c36a3eb42fc24f4777e3619316f0'] = 'Aucun fichier ne sera téléchargé (canal %s est utilisé)';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_604862f03b56fde085c8f0350f63d707'] = 'Les actions suivantes seront automatiquement remplacées';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_a14d4d3e7a25e288bacd896ca2eda847'] = '%1$s sera remplacé par %2$s';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_a07a3b4fc3a73fd0a8014aa40819c357'] = 'Pour changer ce comportement, vous devez éditer manuellement vos fichiers php';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_ef754ad37c689704ede322b9a6ae66a7'] = 'Vérifier si une nouvelle version est disponible';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_89de86aa34494d545d8cbb4fff3a4e59'] = 'Dernière vérification : %s';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_c7561db7a418dd39b2201dfe110ab4a4'] = 'jamais';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_d6c41259de614f426844d7caeaf532ed'] = 'Rafraichir la page';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_64acebe80a242d6dbb2013d92db337d9'] = 'Dernière vérification : %s ';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_a7eca295291f53a23ab7ba0a9c7fd9de'] = 'Cette fonctionnalité a été désactivé.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_c1b55bdd4c292214e4ef2570ffe069dc'] = '[ERREUR TECHNIQUE] ajax-upgradetab.php est manquant. Veuillez réinstaller ou réinitialiser le module.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_96f1fa7f23402c1307c8e2c57c6bccfa'] = 'Mise à jour en un clic';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_9a843f20677a52ca79af903123147af0'] = 'Bienvenue !';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_f0afedd1444b8ac9f765b544cb5b4911'] = 'Avec le module de mise à jour en un clic, mettre à jour votre boutique vers la version de PrestaShop la plus récente n\'a jamais été aussi facile !';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_68e5fa63e9c51108b49d3d643ec36972'] = 'Veuillez s\'il vous plaît toujours faire une sauvegarde manuelle complète de vos fichiers et de votre base de données avant de commencer une mise à jour.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_a1f24b1cec5482ed0d97bce1ba0570a4'] = 'Vérifiez bien l\'intégrité de votre sauvegarde des données et vérifiez que vous pouvez facilement restaurer votre boutique manuellement si nécessaire.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_0a8276f35797dc24e6ccb5b5ff5cf102'] = 'Si vous ne savez pas comment procéder, demandez à votre hébergeur.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_017697f698d570dffed5f88a5a933d01'] = 'Options de sauvegarde';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_564b7c9d8683f1a94798e9f7449564e4'] = 'Options de mise à jour';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_f15547fe5f9f307bd42b2c01657efbcb'] = 'Votre serveur ne peut télécharger le fichier. Merci de l\'envoyer par FTP dans votre dossier admin/autoupgrade';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_f2a6c498fb90ee345d997f888fce3b18'] = 'Supprimer';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_48995d15304fe79fc0240bf6544f2395'] = 'Êtes-vous sûr de vouloir supprimer cette sauvegarde ?';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_f1a1fb67c8350e8881bc59f09e42d5ab'] = 'Cliquez pour rafraichir la page et utiliser la nouvelle configuration';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_f03a04d1f440e359840035679b49b212'] = 'Une mise à jour est en cours... Cliquez sur "OK" pour annuler.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_98a399b35ec9e03ec985254acfe5e3a0'] = 'Mise à jour PrestaShop';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_e02d726a7e733ffb7737e53c89be5e4f'] = 'Mise à jour terminée';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_c5e0a7b512fd616279924a1396bb0802'] = 'Mise à jour terminée !';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_f67d595b77c8c85da5434ddf41b840d4'] = 'Mise à jour complète, mais il y a des alertes.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_a9cb4ff8ba5698ccdc9672435be31d24'] = 'Les cookies ont été modifiés : vous devrez vous identifier à nouveau après avoir rechargé la page';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_546c6a7b5ca345af3880bfc74a339606'] = 'Les fichiers javascript et CSS ont été modifiés, il peut être nécessaire de vider le cache de votre navigateur en appuyant simultanément sur CTRL + F5';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_19ea4327ee1bad0ed94b42a77255f3c6'] = 'Pensez à vérifier que tout fonctionne bien en front office (créez un compte, passez une commande...)';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_c12803674a35ccc28e5da00a50a84591'] = 'Les images des produits n\'apparaissent pas sur le site ? Essayez de régénérer les miniatures dans Préférences > Images';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_e27d0a2f9e5caa433fc14667a1a3a15a'] = 'N\'oubliez pas de réactiver votre boutique une fois toutes vos vérifications terminées !';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_bb64b7cb55bd1db0abc03b6884144113'] = 'À faire :';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_bdec5eb7ca6ae2b5646bb9524df5579a'] = 'Restauration terminée.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_a8192fd08a431bf547ebf9a3eaa9b6bb'] = 'Erreur Javascript (parseJSON) détectée pour l\'action';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_ecb2935cd99ace66750ffdee7954f126'] = 'Début de la restauration ...';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_e47b67bdaa4f2c695e46ce1e5231aa9f'] = 'Erreur détectée pendant';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_4e265d12ee7ee679a4f40a4c4fde1208'] = 'La requête a dépassé le temps d"exécution maximum autorisé. Vous devez changer votre configuration serveur pour augmenter la durée de max_execution_time.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_c050dd9e80b7658fbf59103b2b982c5d'] = 'Cliquez sur le bouton %s';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_67dab01827a619fdbcb137f18a83feb5'] = 'Fin du processus';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_3b388ab38f6539009cf82a0577205cd8'] = 'Opération annulée. Vérification de la restauration...';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_e3d2f07a805f02286c6ad420a70478c4'] = 'Voulez-vous restaurer';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_f234e8051cec7a79e996e67f179bd68b'] = 'Opération annulée. Une erreur est survenue.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_95e42bb250909b740190f9a46e80070c'] = 'est manquant. Merci de réinstaller le module';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_1607e6098b7b62a2791653b059c975d2'] = 'Afficher / masquer la liste';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_25b91596a896c6cf688104169b4b6a71'] = 'Fichier(s) coeur';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_65f04958837ddd3643fd5edaee3a0f8d'] = 'Fichier(s) e-mail';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_54aca96b35b48dd39265175f61b6bdd2'] = 'fichier(s) des traductions';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_6a103ec34561f1daa9e3028e78bf319b'] = 'Votre serveur ne peut pas télécharger ce fichier. Veuillez le charger sur votre serveur FTP et le placer dans votre dossier /[admin]/autoupgrade.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_7f034b1e149cf228e8dfc51dcab6cb96'] = 'Ces fichiers seront supprimés';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_22f1a4b9e524d8fabb6f058bf3bb5a9f'] = 'Ces fichiers seront modifiés';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_8c4e88bd9187e21ab076fb9a92343e8b'] = 'Moins d\'options';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_e3da2aa16a78084597288574550e7f39'] = 'Les champs lien et hash ne doivent pas être vides';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_0fdb05748bf1f267f54c2353b9fa5fbb'] = 'Vous devez entrer le numéro de version correspondant à l\'archive.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_4f926e733c4f9087633a1be8c59cbd5e'] = 'Aucune archive n\'a été sélectionnée.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_69baf56a7bdc48c0637f98298742332d'] = 'Vous devez entrer le numéro de version correspondant au répertoire.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_3414adbd0397d764eec7f8900051331f'] = 'Veuillez confirmer que vous ne souhaitez pas effectuer la sauvegarde.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_43195fe6505d6439239d03e00a8e7310'] = 'Veuillez confirmer que vous souhaitez conserver les options des fichiers.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_9311ab161709b4f5efe9c6ff08b33699'] = '%s n\'est pas un fichier';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_3d72a59cd44079c486a184a6a7bcec34'] = 'Impossible de créer le répertoire %s.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_9015190dc360d94efb0a5013a76697dd'] = 'Archive extraite';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_42a346b8cddc0d5a6b7494735eb68b10'] = 'zip->extractTo() : Impossible d\'utiliser %s comme destination des fichiers extraits.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_0f9f19a4f5e93b3d5a94405e3af32a28'] = 'Impossible d\'ouvrir le fichier zip %s';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_a15762146514c451817fb7bb8cbecd96'] = '[ERREUR] Erreur lors de l\'extraction de l\'archive par PclZip : %s.';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_3858aebfe7dce0a1dc398d199cb85a2b'] = '[ERREUR] Impossible de lister les fichiers archivés';
$_MODULE['<{autoupgrade}prestashop>adminselfupgrade_ece95fa62a665fc3779168e698d6913a'] = 'Le fichier %s est conservé';
$_MODULE['<{autoupgrade}prestashop>autoupgrade_bf544d00f0406f90f6e658a2571f5e9c'] = 'Cette version de PrestaShop ne peut pas être mise à jour. La constante PS_ADMIN_DIR est manquante.';
$_MODULE['<{autoupgrade}prestashop>autoupgrade_786cc166a84595ae291b2d8b26d93bb3'] = 'Mise à jour en un clic';
$_MODULE['<{autoupgrade}prestashop>autoupgrade_990a862982b19c0c1266a4cf6afbdd96'] = 'Permet une mise à jour automatisée de votre boutique vers la dernière version de PrestaShop.';
$_MODULE['<{autoupgrade}prestashop>autoupgrade_a1c06846db19625473aa4ffacb6307e4'] = 'Impossible de supprimer le menu "AdminUpgrade" (ID : %d) qui n\'est plus à jour.';
$_MODULE['<{autoupgrade}prestashop>autoupgrade_cade82f9025d8fb9d2af869af19c72b8'] = 'Impossible de créer le menu "AdminSelfUpgrade"';
$_MODULE['<{autoupgrade}prestashop>autoupgrade_12de3725023e3c02c25c7898f524b25d'] = 'Impossible de copier le logo dans %s';
$_MODULE['<{autoupgrade}prestashop>autoupgrade_5d7ef5c6fd32feb5d482ec1459e86f83'] = 'Impossible de charger le menu "AdminSelfUpgrade"';
$_MODULE['<{autoupgrade}prestashop>autoupgrade_21dc065f2d8653ebca37ec552d17b37e'] = 'Impossible de créer le dossier "%s"';
$_MODULE['<{autoupgrade}prestashop>autoupgrade_6215d33db0d099fcaae168dd4715135a'] = 'Impossible d\'écrire dans le dossier "%s"';
$_MODULE['<{autoupgrade}prestashop>autoupgrade_10c008d228c9f35d12ce0437aa3eade9'] = 'Impossible de copier le fichier ajax-upgradetab.php dans %s';
return $_MODULE;
|
gpl-3.0
|
Lewis-Birkett/TeamAvengersVoteSystem
|
VoteCaster/VoteCaster/Program.cs
|
735
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VoteCaster
{
class Program
{
static void Main(string[] args)
{
List<string> listOfCandidates = new List<string>();
listOfCandidates.Add("Jack");
listOfCandidates.Add("Jill");
Console.WriteLine("Please enter a UNIQUE boothID");
string boothID = Console.ReadLine();
VoteCaster thisVoteCaster = new VoteCaster(boothID,listOfCandidates);
thisVoteCaster.DisplayCandidates();
while(true)
{
thisVoteCaster.CastVote();
}
}
}
}
|
gpl-3.0
|
weiznich/geomonitoring
|
ICP/run_icp.cpp
|
1647
|
/*
* testdata.cpp
*
* Created on: 05.05.2014
* Author: Georg Semmler
*/
#include <iostream>
#include <string>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include "../Parser/PlyParser.h"
#include "ICP.h"
/*
* This function copy PCL pointclouds from input to output
*
* @param input, the cloud which should be copied
*
* @param output, the copied cloud, output
*/
void copyCloud(const pcl::PointCloud<pcl::PointXYZRGBNormal>* const input,
pcl::PointCloud<pcl::PointXYZRGBNormal>* output)
{
for (auto p : input->points) {
output->push_back(p);
}
}
//mainfunction
int main(int argc, char** argv)
{
//check arguments
if (argc <3 || argc>4) {
std::cout<<argc<<std::endl;
std::cerr << "call "<<argv[0]<<" <path to inputcloud> <path to targetcloud> [<outputpath>]" << std::endl;
return 0;
}
boost::optional<std::string> output_path=boost::none;
if(argc==4){
output_path=std::string(argv[3]);
}
//read inputcloud
auto cloud = Parser::PlyParser::parse(std::string(argv[1]));
pcl::PointCloud<pcl::PointXYZRGBNormal>* input =
new pcl::PointCloud<pcl::PointXYZRGBNormal>();
copyCloud(&cloud, input);
//read target cloud
cloud = Parser::PlyParser::parse(std::string(argv[2]));
pcl::PointCloud<pcl::PointXYZRGBNormal>* target =
new pcl::PointCloud<pcl::PointXYZRGBNormal>();
copyCloud(&cloud, target);
//calculate transformation
auto trafo=Calculation::ICP::getTransformation(pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr(input),
pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr(target),output_path);
std::cout << "Final transformation: " << std::endl << trafo
<< std::endl;
}
|
gpl-3.0
|
phoronix-test-suite/phoronix-test-suite
|
pts-core/objects/pts_Graph/pts_graph_radar_chart.php
|
10850
|
<?php
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2010 - 2021, Phoronix Media
Copyright (C) 2010 - 2021, Michael Larabel
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/>.
*/
class pts_graph_radar_chart extends pts_graph_core
{
private $result_objects = array();
private $systems = array();
private $logarithmic_view = false;
private $selection_view = null;
public static function cmp_result_object_sort($a, $b)
{
$a = $a->test_profile->get_test_hardware_type() . $a->test_profile->get_result_scale_formatted() . $a->test_profile->get_test_software_type() . $a->test_profile->get_identifier(true) . $a->get_arguments_description();
$b = $b->test_profile->get_test_hardware_type() . $b->test_profile->get_result_scale_formatted() . $b->test_profile->get_test_software_type() . $b->test_profile->get_identifier(true) . $b->get_arguments_description();
return strcmp($a, $b);
}
public function __construct($result_file, $selector = null)
{
$rf = clone $result_file;
$this->selection_view = $selector;
$this->systems = $rf->get_system_identifiers();
$system_count = count($this->systems);
if($system_count < 2)
{
return false;
}
$result_object = null;
parent::__construct($result_object, $rf);
// System Identifiers
$result_objects = $rf->get_result_objects();
$ignore_qualify_check = false;
if(count($result_objects) > 12)
{
$ros = pts_result_file_analyzer::generate_geometric_mean_result_per_test($result_file, false, $this->selection_view);
if(count($ros) > 2)
{
$ignore_qualify_check = true;
$result_objects = $ros;
}
}
usort($result_objects, array('pts_graph_run_vs_run', 'cmp_result_object_sort'));
$longest_header = 0;
$all_max = array();
foreach($result_objects as &$r)
{
if($this->selection_view == null && $r->test_profile->get_identifier() == null && !$ignore_qualify_check)
{
continue;
}
if($this->selection_view != null && strpos($r->get_arguments_description(), $this->selection_view) === false && strpos($r->test_profile->get_title(), $this->selection_view) === false && strpos($r->test_profile->get_result_scale(), $this->selection_view) === false)
{
continue;
}
if(count($r->test_result_buffer->get_buffer_items()) != $system_count)
{
continue;
}
if($r->normalize_buffer_values() == false)
{
continue;
}
$relative_win = $r->get_result_first(false);
if($relative_win < 1.03 && count($result_objects) > 88)
{
continue;
}
$this->i['graph_max_value'] = max($this->i['graph_max_value'], $relative_win);
$rel = array();
$max = 0;
foreach($r->test_result_buffer->get_buffer_items() as $buffer_item)
{
if(in_array($buffer_item->get_result_identifier(), $this->systems))
{
$val_check = $buffer_item->get_result_value();
if(empty($val_check) || !is_numeric($val_check))
continue;
$rel[$buffer_item->get_result_identifier()] = $val_check;
$max = max($max, $buffer_item->get_result_value());
}
}
if($max == 0)
{
continue;
}
if(count($rel) != $system_count)
{
continue;
}
$all_max[] = $max;
$this->result_objects[] = array('rel' => $rel, 'ro' => $r, 'max' => $max);
$longest_header = max($longest_header, strlen($r->test_profile->get_title()), strlen($r->get_arguments_description_shortened()));
}
if(count($this->result_objects) < 3)
{
// No point in generating this if there aren't many valid tests
return false;
}
if($this->i['graph_max_value'] > 4 && pts_math::arithmetic_mean($all_max) < ($this->i['graph_max_value'] * 0.48))
{
// better to show a logarithmic view
$this->i['graph_max_value'] = 0;
$this->logarithmic_view = true;
foreach($this->result_objects as &$r)
{
$max = 0;
foreach($r['rel'] as $identifier => $value)
{
$r['rel'][$identifier] = log10($value * 10);
$max = max($max, $r['rel'][$identifier]);
}
$r['max'] = $max;
$this->i['graph_max_value'] = max($this->i['graph_max_value'], $max);
}
}
foreach($this->systems as $system)
{
//$this->get_paint_color($system, true);
$this->results[$system] = $system;
}
$this->i['identifier_size'] = 6.5;
$this->i['top_heading_height'] = max(self::$c['size']['headers'] + 22 + self::$c['size']['key'], 48);
$this->i['top_start'] = $this->i['top_heading_height'];
$this->i['left_start'] = pts_graph_core::text_string_width(str_repeat('Z', $longest_header), self::$c['size']['tick_mark']) * 0.85;
$this->i['graph_title'] = ($this->logarithmic_view ? 'Logarithmic ' : '') . ($this->selection_view ? $this->selection_view . ' ' : null) . 'Result Overview';
$this->i['iveland_view'] = true;
$this->i['show_graph_key'] = true;
$this->i['is_multi_way_comparison'] = false;
$this->i['graph_width'] = round($this->i['graph_width'] * 1.5, PHP_ROUND_HALF_EVEN);
$this->i['top_start'] += $this->graph_key_height();
$this->i['graph_height'] = $this->i['graph_width'] + $this->i['top_start'] + (count($this->result_objects) > 14 ? 50 : 0);
$this->update_graph_dimensions($this->i['graph_width'], $this->i['graph_height'], true);
//$this->results = $this->systems;
return true;
}
protected function render_graph_heading($with_version = true)
{
$this->svg_dom->add_element('path', array('d' => 'm74 22v9m-5-16v16m-5-28v28m-23-2h12.5c2.485281 0 4.5-2.014719 4.5-4.5s-2.014719-4.5-4.5-4.5h-8c-2.485281 0-4.5-2.014719-4.5-4.5s2.014719-4.5 4.5-4.5h12.5m-21 5h-11m11 13h-2c-4.970563 0-9-4.029437-9-9v-20m-24 40v-20c0-4.970563 4.0294373-9 9-9 4.970563 0 9 4.029437 9 9s-4.029437 9-9 9h-9', 'stroke' => self::$c['color']['main_headers'], 'stroke-width' => 4, 'fill' => 'none', 'transform' => 'translate(' . 10 . ',' . round($this->i['top_heading_height'] / 40 + 1) . ')'));
$this->svg_dom->add_text_element($this->i['graph_title'], array('x' => 100, 'y' => (4 + self::$c['size']['headers']), 'font-size' => self::$c['size']['headers'], 'fill' => self::$c['color']['main_headers'], 'text-anchor' => 'start'));
$this->svg_dom->add_text_element($this->i['graph_version'], array('x' => 100, 'y' => (self::$c['size']['headers'] + 16), 'font-size' => self::$c['size']['key'], 'fill' => self::$c['color']['main_headers'], 'text-anchor' => 'start', 'xlink:href' => 'http://www.phoronix-test-suite.com/'));
}
public function renderGraph()
{
if(count($this->result_objects) < 3)
{
// No point in generating this if there aren't many valid tests
return false;
}
//$this->update_graph_dimensions($this->i['graph_width'], $this->i['graph_height'] + $this->i['top_start'], true);
$this->render_graph_init();
//$this->graph_key_height();
$this->render_graph_key();
$this->render_graph_heading();
$center_x = $this->i['graph_width'] / 2;
$center_y = (($this->i['graph_height'] - $this->i['top_start']) / 2) + $this->i['top_start'];
$max_depth = $center_x * 0.7;
$scale = $max_depth / $this->i['graph_max_value'];
$ro_count = count($this->result_objects);
$degree_offset = 360 / $ro_count;
$g_txt_common = $this->svg_dom->make_g(array('font-size' => self::$c['size']['tick_mark'], 'fill' => self::$c['color']['notches']));
$g_txt_circle = $this->svg_dom->make_g(array('font-size' => self::$c['size']['tick_mark'] - 1, 'fill' => self::$c['color']['body_light'], 'text-anchor' => 'middle'));
$g_txt_tests = $this->svg_dom->make_g(array('font-size' => self::$c['size']['tick_mark'] + 0.5, 'fill' => self::$c['color']['notches'], 'font-weight' => '800', 'dominant-baseline' => 'text-after-edge'));
$g_txt_desc = $this->svg_dom->make_g(array('font-size' => self::$c['size']['tick_mark'], 'fill' => self::$c['color']['notches'], 'dominant-baseline' => 'text-after-edge'));
for($i = 1; $i <= $this->i['graph_max_value']; $i += (($this->i['graph_max_value'] -1) / 4))
{
$radius = round($scale * $i);
$this->svg_dom->draw_svg_circle($center_x, $center_y, $radius, 'transparent', array('stroke' => self::$c['color']['body_light'], 'stroke-width' => 1, 'stroke-dasharray' => '10,10,10'));
if(!$this->logarithmic_view)
{
$this->svg_dom->add_text_element(round($i * 100) . '%', array('x' => $center_x, 'y' => $center_y + $radius + 2, 'dominant-baseline' => 'hanging'), $g_txt_circle);
}
}
$i = 0;
$prev_x = array();
$prev_y = array();
$orig_x = array();
$orig_y = array();
foreach($this->result_objects as &$r)
{
$deg = round($degree_offset * $i);
foreach($r['rel'] as $identifier => $value)
{
$x = $center_x + round(($value * $scale) * cos(deg2rad($deg)));
$y = $center_y + round(($value * $scale) * sin(deg2rad($deg)));
if(isset($prev_x[$identifier]))
{
$this->svg_dom->draw_svg_line($prev_x[$identifier], $prev_y[$identifier], $x, $y, $this->get_paint_color($identifier), 3);
}
$prev_x[$identifier] = $x;
$prev_y[$identifier] = $y;
}
$x_txt = $center_x + ceil(($this->i['graph_max_value'] * 1.03 * $scale) * cos(deg2rad($deg)));
$y_txt = $center_y + ceil(($this->i['graph_max_value'] * 1.03 * $scale) * sin(deg2rad($deg)));
$desc = $r['ro']->get_arguments_description_shortened();
if($x_txt >= $center_x)
{
$text_anchor = 'start';
}
else
{
$text_anchor = 'end';
}
$v_offset = $y_txt < $center_y && !empty($desc) ? -5 : 0;
$rotate = $ro_count > 14 ? array('transform' => 'rotate(' . ($deg > 90 && $deg < 270 ? $deg + 180 : $deg) . ' ' . $x_txt . ' ' . $y_txt . ')') : array();
$this->svg_dom->add_text_element($r['ro']->test_profile->get_title(), array_merge(array('x' => $x_txt, 'y' => $y_txt + $v_offset, 'text-anchor' => $text_anchor), $rotate), $g_txt_tests);
if($desc && $desc != 'Geometric Mean' && $desc != 'D.G.M')
{
$this->svg_dom->add_text_element($desc, array_merge(array('x' => $x_txt, 'y' => $y_txt + 10, 'text-anchor' => $text_anchor), $rotate), $g_txt_desc);
}
if($i == 0)
{
$orig_x = $prev_x;
$orig_y = $prev_y;
}
$i++;
}
if(!empty($orig_x))
{
foreach($r['rel'] as $identifier => $value)
{
$this->svg_dom->draw_svg_line($prev_x[$identifier], $prev_y[$identifier], $orig_x[$identifier], $orig_y[$identifier], $this->get_paint_color($identifier), 2);
}
}
return true;
}
}
?>
|
gpl-3.0
|
Zarius/Bukkit-OtherBlocks
|
src/com/gmail/zariust/otherdrops/event/DropsMap.java
|
2646
|
// OtherDrops - a Bukkit plugin
// Copyright (C) 2011 Robert Sargant, Zarius Tularial, Celtic Minstrel
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package com.gmail.zariust.otherdrops.event;
import java.util.HashMap;
import java.util.Map;
import com.gmail.zariust.otherdrops.parameters.Trigger;
import com.gmail.zariust.otherdrops.subject.Target;
public class DropsMap {
private Map<Trigger, Map<String, DropsList>> blocksHash = new HashMap<Trigger, Map<String, DropsList>>();
public void addDrop(CustomDrop drop) {
if (!blocksHash.containsKey(drop.getTrigger()))
blocksHash.put(drop.getTrigger(), new HashMap<String, DropsList>());
Map<String, DropsList> triggerHash = blocksHash.get(drop.getTrigger());
for (Target target : drop.getTarget().canMatch()) {
String key = target.getKey();
if (key == null)
continue; // shouldn't happen though...?
if (!triggerHash.containsKey(key))
triggerHash.put(key, new DropsList());
DropsList drops = triggerHash.get(key);
drops.add(drop);
}
}
public DropsList getList(Trigger trigger, Target target) {
if (!blocksHash.containsKey(trigger))
return null;
if (target == null)
return null;
return blocksHash.get(trigger).get(target.getKey());
}
public void clear() {
blocksHash.clear();
}
@Override
public String toString() {
return blocksHash.toString();
}
@Override
public int hashCode() {
return blocksHash.hashCode();
}
@Override
public boolean equals(Object other) {
if (!(other instanceof DropsMap))
return false;
return blocksHash.equals(((DropsMap) other).blocksHash);
}
public void applySorting() {
for (Trigger trigger : blocksHash.keySet()) {
for (DropsList list : blocksHash.get(trigger).values()) {
list.sort();
}
}
}
}
|
gpl-3.0
|
lcpt/xc
|
verif/tests/materials/ehe/test_shrinkage_02.py
|
10113
|
# -*- coding: utf-8 -*-
# home made test
# Shrinking load pattern test.
import xc_base
import geom
import xc
from materials.ehe import EHE_materials
__author__= "Luis C. Pérez Tato (LCPT)"
__copyright__= "Copyright 2014, LCPT"
__license__= "GPL"
__version__= "3.0"
__email__= "l.pereztato@gmail.com"
concrHA30= EHE_materials.HA30
concrHA30.cemType='N'
fckHA30= 30e6 # Concrete characteristic compressive strength HA-30.
Hrel= 0.8 # Relative humidity of the air.
Ec= 2e5*9.81/1e-4 # Concrete Young modulus (Pa).
nuC= 0.2 # Concrete Poisson's ratio EHE-08.
hLosa= 0.2 # Thickness.
densLosa= 2500*hLosa # Deck density kg/m2.
t0= 28 # Concrete age at loading
tFin= 10000 # Service life.
arido= "cuarcita"
# Load
F= 5.5e4 # Load magnitude en N
# Concrete shrinkage
tS= 7 # Inicio del secado.
# active reinforcement
Ep= 190e9 # Elastic modulus expressed in MPa
Ap= 140e-6 # bar area expressed in square meters
fMax= 1860e6 # Maximum unit load of the material expressed in MPa.
fy= 1171e6 # Yield stress of the material expressed in Pa.
tInic= 0.75**2*fMax # Effective prestress (0.75*P0 y 25% prestress losses).
import xc_base
import geom
import xc
from solution import predefined_solutions
from model import predefined_spaces
from materials import typical_materials
# Problem type
feProblem= xc.FEProblem()
preprocessor= feProblem.getPreprocessor
nodes= preprocessor.getNodeHandler
modelSpace= predefined_spaces.StructuralMechanics3D(nodes)
nodes.defaultTag= 1 #First node number.
nod1= nodes.newNodeXYZ(0,0,0)
nod2= nodes.newNodeXYZ(1,0,0)
nod3= nodes.newNodeXYZ(2,0,0)
nod4= nodes.newNodeXYZ(3,0,0)
nod5= nodes.newNodeXYZ(0,1,0)
nod6= nodes.newNodeXYZ(1,1,0)
nod7= nodes.newNodeXYZ(2,1,0)
nod8= nodes.newNodeXYZ(3,1,0)
nod9= nodes.newNodeXYZ(0,2,0)
nod10= nodes.newNodeXYZ(1,2,0)
nod11= nodes.newNodeXYZ(2,2,0)
nod12= nodes.newNodeXYZ(3,2,0)
# Materials definition
hLosa= typical_materials.defElasticMembranePlateSection(preprocessor, "hLosa",Ec,nuC,densLosa,hLosa)
prestressingSteel= typical_materials.defSteel02(preprocessor, "prestressingSteel",Ep,fy,0.001,tInic)
elements= preprocessor.getElementHandler
# Reinforced concrete deck
elements.defaultMaterial= "hLosa"
elements.defaultTag= 1
elem= elements.newElement("ShellMITC4",xc.ID([1,2,6,5]))
elem= elements.newElement("ShellMITC4",xc.ID([2,3,7,6]))
elem= elements.newElement("ShellMITC4",xc.ID([3,4,8,7]))
elem= elements.newElement("ShellMITC4",xc.ID([5,6,10,9]))
elem= elements.newElement("ShellMITC4",xc.ID([6,7,11,10]))
elem= elements.newElement("ShellMITC4",xc.ID([7,8,12,11]))
# active reinforcement
elements.defaultMaterial= "prestressingSteel"
elements.dimElem= 3 # Dimension of element space
truss= elements.newElement("Truss",xc.ID([1,2]))
truss.area= Ap
truss= elements.newElement("Truss",xc.ID([2,3]))
truss.area= Ap
truss= elements.newElement("Truss",xc.ID([3,4]))
truss.area= Ap
truss= elements.newElement("Truss",xc.ID([5,6]))
truss.area= Ap
truss= elements.newElement("Truss",xc.ID([6,7]))
truss.area= Ap
truss= elements.newElement("Truss",xc.ID([7,8]))
truss.area= Ap
truss= elements.newElement("Truss",xc.ID([9,10]))
truss.area= Ap
truss= elements.newElement("Truss",xc.ID([10,11]))
truss.area= Ap
truss= elements.newElement("Truss",xc.ID([11,12]))
truss.area= Ap
# Constraints
modelSpace.fixNode000_000(1)
modelSpace.fixNode000_000(5)
modelSpace.fixNode000_000(9)
# Loads definition
loadHandler= preprocessor.getLoadHandler
lPatterns= loadHandler.getLoadPatterns
#Load modulation.
ts= lPatterns.newTimeSeries("constant_ts","ts")
lPatterns.currentTimeSeries= "ts"
lpSHRINKAGE= lPatterns.newLoadPattern("default","SHRINKAGE")
lpFLU= lPatterns.newLoadPattern("default","FLU")
lpG= lPatterns.newLoadPattern("default","G")
lpSC= lPatterns.newLoadPattern("default","SC")
lpVT= lPatterns.newLoadPattern("default","VT")
lpNV= lPatterns.newLoadPattern("default","NV")
nodes= preprocessor.getNodeHandler
nod4= nodes.getNode(4)
nod8= nodes.getNode(8)
nod12= nodes.getNode(12)
lpG.newNodalLoad(nod4.tag,xc.Vector([F,0.0,0.0,0.0,0.0,0.0]))
lpG.newNodalLoad(nod8.tag,xc.Vector([F,0.0,0.0,0.0,0.0,0.0]))
lpG.newNodalLoad(nod12.tag,xc.Vector([F,0.0,0.0,0.0,0.0,0.0]))
lpSC.newNodalLoad(nod4.tag,xc.Vector([F,0.0,0.0,0.0,0.0,0.0]))
lpSC.newNodalLoad(nod8.tag,xc.Vector([F,0.0,0.0,0.0,0.0,0.0]))
lpSC.newNodalLoad(nod12.tag,xc.Vector([F,0.0,0.0,0.0,0.0,0.0]))
lpVT.newNodalLoad(nod4.tag,xc.Vector([F,0.0,0.0,0.0,0.0,0.0]))
lpVT.newNodalLoad(nod8.tag,xc.Vector([F,0.0,0.0,0.0,0.0,0.0]))
lpVT.newNodalLoad(nod12.tag,xc.Vector([F,0.0,0.0,0.0,0.0,0.0]))
lpNV.newNodalLoad(nod4.tag,xc.Vector([F,0.0,0.0,0.0,0.0,0.0]))
lpNV.newNodalLoad(nod8.tag,xc.Vector([F,0.0,0.0,0.0,0.0,0.0]))
lpNV.newNodalLoad(nod12.tag,xc.Vector([F,0.0,0.0,0.0,0.0,0.0]))
# Combinaciones
combs= loadHandler.getLoadCombinations
comb= combs.newLoadCombination("ELU001","1.00*G")
comb= combs.newLoadCombination("ELU002","1.35*G")
comb= combs.newLoadCombination("ELU003","1.00*G + 1.50*SC")
comb= combs.newLoadCombination("ELU004","1.00*G + 1.50*SC + 0.90*NV")
comb= combs.newLoadCombination("ELU005","1.00*G + 1.50*SC + 0.90*VT")
comb= combs.newLoadCombination("ELU006","1.00*G + 1.50*SC + 0.90*VT + 0.90*NV")
comb= combs.newLoadCombination("ELU007","1.00*G + 1.50*VT")
comb= combs.newLoadCombination("ELU008","1.00*G + 1.50*VT + 0.90*NV")
comb= combs.newLoadCombination("ELU009","1.00*G + 1.05*SC + 1.50*VT")
comb= combs.newLoadCombination("ELU010","1.00*G + 1.05*SC + 1.50*VT + 0.90*NV")
comb= combs.newLoadCombination("ELU011","1.00*G + 1.50*NV")
comb= combs.newLoadCombination("ELU012","1.00*G + 0.90*VT + 1.50*NV")
comb= combs.newLoadCombination("ELU013","1.00*G + 1.05*SC + 1.50*NV")
comb= combs.newLoadCombination("ELU014","1.00*G + 1.05*SC + 0.90*VT + 1.50*NV")
comb= combs.newLoadCombination("ELU015","1.35*G + 1.50*SC")
comb= combs.newLoadCombination("ELU016","1.35*G + 1.50*SC + 0.90*NV")
comb= combs.newLoadCombination("ELU017","1.35*G + 1.50*SC + 0.90*VT")
comb= combs.newLoadCombination("ELU018","1.35*G + 1.50*SC + 0.90*VT + 0.90*NV")
comb= combs.newLoadCombination("ELU019","1.35*G + 1.50*VT")
comb= combs.newLoadCombination("ELU020","1.35*G + 1.50*VT + 0.90*NV")
comb= combs.newLoadCombination("ELU021","1.35*G + 1.05*SC + 1.50*VT")
comb= combs.newLoadCombination("ELU022","1.35*G + 1.05*SC + 1.50*VT + 0.90*NV")
comb= combs.newLoadCombination("ELU023","1.35*G + 1.50*NV")
comb= combs.newLoadCombination("ELU024","1.35*G + 0.90*VT + 1.50*NV")
comb= combs.newLoadCombination("ELU025","1.35*G + 1.05*SC + 1.50*NV")
comb= combs.newLoadCombination("ELU026","1.35*G + 1.05*SC + 0.90*VT + 1.50*NV")
#printFlag= 0
#ctest.printFlag= printFlag
analysis= predefined_solutions.penalty_newton_raphson(feProblem)
from solution import database_helper
def resuelveCombEstatLin(tagComb,comb,tagSaveFase0):
preprocessor.resetLoadCase()
db.restore(tagSaveFase0)
#execfile("solution/database_helper_solve.xci")
'''
print "nombrePrevia= ",nombrePrevia
print "tag= ",tagComb
print "tagPrevia= ",tagPrevia
print "descomp previa= ",getDescompCombPrevia
print "resto sobre previa= ",getDescompRestoSobrePrevia
'''
comb.addToDomain()
result= analysis.analyze(1)
db.save(tagComb*100)
comb.removeFromDomain()
dXMin=1e9
dXMax=-1e9
def procesResultVerif(tagComb, nmbComb):
nodes= preprocessor.getNodeHandler
nod8= nodes.getNode(8)
deltaX= nod8.getDisp[0] # x displacement of node 8
global dXMin; dXMin= min(dXMin,deltaX)
global dXMax; dXMax= max(dXMax,deltaX)
'''
print "nmbComb= ",nmbComb
print "tagComb= ",tagComb
print "descomp= ",getDescomp("%3.1f")
print "dXMin= ",(dXMin*1e3)," mm\n"
print "dXMax= ",(dXMax*1e3)," mm\n"
'''
import os
os.system("rm -r -f /tmp/test_shrinkage_02.db")
db= feProblem.newDatabase("BerkeleyDB","/tmp/test_shrinkage_02.db")
# Fase 0: pretensado, shrinking
# Fase 1: pretensado, shrinking and creep
# Shrinkage strains.
sets= preprocessor.getSets
shells= preprocessor.getSets.defSet("shells")
elements= preprocessor.getSets.getSet("total").getElements
for e in elements:
dim= e.getDimension
if(dim==2):
shells.getElements.append(e)
shellElems= shells.getElements
for e in shellElems:
averageSideLength= e.getPerimeter(True)/4.0
material= e.getPhysicalProperties.getVectorMaterials[0]
grueso= material.h
Ac= averageSideLength*grueso
u= 2*averageSideLength+grueso
espMedio= 2.0*Ac/u
RH=Hrel*100
h0mm=espMedio*1e3
epsShrinkage= concrHA30.getShrEpscs(tFin,tS,RH,h0mm)
#loadHandler.setCurrentLoadPattern("SHRINKAGE")
for e in shellElems:
eleLoad= lpSHRINKAGE.newElementalLoad("shell_strain_load")
eleLoad.elementTags= xc.ID([e.tag])
eleLoad.setStrainComp(0,0,epsShrinkage) #(id of Gauss point, id of component, value)
eleLoad.setStrainComp(1,0,epsShrinkage)
eleLoad.setStrainComp(2,0,epsShrinkage)
eleLoad.setStrainComp(3,0,epsShrinkage)
eleLoad.setStrainComp(0,1,epsShrinkage) #(id of Gauss point, id of component, value)
eleLoad.setStrainComp(1,1,epsShrinkage)
eleLoad.setStrainComp(2,1,epsShrinkage)
eleLoad.setStrainComp(3,1,epsShrinkage)
preprocessor.resetLoadCase()
comb= combs.newLoadCombination("FASE0","1.00*SHRINKAGE")
tagSaveFase0= comb.tag*100
comb.addToDomain()
result= analysis.analyze(1)
combs.remove("FASE0") # Avoid adding shrinking on each computation.
db.save(tagSaveFase0)
db.restore(tagSaveFase0)
nombrePrevia=""
tagPrevia= 0
tagSave= 0
for key in combs.getKeys():
comb= combs[key]
resuelveCombEstatLin(comb.tag,comb,tagSaveFase0)
procesResultVerif(comb.tag,comb.getName)
dXMaxTeor= -0.752509e-3
ratio1= abs(((dXMax-dXMaxTeor)/dXMaxTeor))
dXMinTeor= -0.955324e-3
ratio2= abs(((dXMin-dXMinTeor)/dXMinTeor))
#'''
print "dXMax= ",(dXMax*1e3)," mm"
print "dXMaxTeor= ",(dXMaxTeor*1e3)," mm"
print "ratio1= ",ratio1
print "dXMin= ",(dXMin*1e3)," mm"
print "dXMinTeor= ",(dXMinTeor*1e3)," mm"
print "ratio2= ",ratio2
# '''
import os
from miscUtils import LogMessages as lmsg
fname= os.path.basename(__file__)
if (ratio1<1e-5) & (ratio2<1e-5) :
print "test ",fname,": ok."
else:
lmsg.error(fname+' ERROR.')
os.system("rm -r -f /tmp/test_shrinkage_02.db") # Your garbage you clean it
|
gpl-3.0
|
PoufPoufProduction/jlodb
|
editors/asm/asm.js
|
3906
|
(function($) {
var defaults = {
name: "asm",
args: {}, // activity arguments
validation: false,
debug: true
};
// private methods
var helpers = {
// Get the settings
settings: function($this, _val) { if (_val) { $this.data("settings", _val); } return $this.data("settings"); },
load: function($this, _args) {
var settings = helpers.settings($this), debug = "";
if (settings.debug) { var tmp = new Date(); debug="?time="+tmp.getTime(); }
var templatepath = "editors/"+settings.name+"/template.html"+debug;
$this.load( templatepath, function(response, status, xhr) {
settings.$activity = $this.find("#e_screen>div");
if (!settings.validation) { $this.find("#e_submit").hide(); }
if (_args.locale.editor) { $.each(_args.locale.editor, function(id,value) {
if($.type(value) === "string") { $this.find("#"+id).html(value); }
}); }
helpers.launch($this, _args);
});
},
launch: function($this, _args) {
var settings = helpers.settings($this);
settings.locale = _args.locale;
$this.find("#e_export").val(JSON.stringify(_args.data));
settings.$activity.html("");
settings.$activity.jlodb({
onedit: function($activity, _data) { },
onstart: function($activity) { settings.$activity.addClass("nosplash"); },
onfinish: function($activity, _hide) { },
onscore: function($activity, _ret) { return true; },
onexercice: function($activity, _id, _data) { _data.edit = true; } }, _args);
}
};
// The plugin
$.fn.asm_editor = function(method) {
// public methods
var methods = {
init: function(options) {
// The settings
var settings = {
interactive : true,
$activity : 0, // The activity object
locale : "" // Locale object for relaunch
};
return this.each(function() {
var $this = $(this);
var $settings = $.extend({}, defaults, options, settings);
$this.removeClass();
helpers.settings($this.addClass(defaults.name+"_editor").addClass("j_editor"), $settings);
helpers.load($this, options.args);
});
},
import:function(_elt) {
var $this = $(this) , settings = helpers.settings($this);
if (settings.interactive)
{
settings.interactive = false;
$(_elt).addClass("touch");
setTimeout(function() { $(_elt).removeClass("touch"); }, 50);
setTimeout(function() { settings.interactive = true; }, 800);
try {
var args = jQuery.parseJSON($this.find("#e_export").val());
args.edit = true;
args.context = { onquit:function() { }, onload:function($t) { $t.addClass("nosplash"); } };
args.locale = settings.locale;
settings.$activity[settings.name](args);
}
catch (e) { alert(e.message); return; }
}
},
edit:function(_elt) {
var $this = $(this) , settings = helpers.settings($this);
if (settings.interactive)
{
settings.interactive = false;
$(_elt).addClass("touch");
setTimeout(function() { $(_elt).removeClass("touch"); }, 50);
setTimeout(function() { settings.interactive = true; }, 800);
if (settings.validation) { settings.validation($this.find("#e_export").val()); }
}
}
};
if (methods[method]) { return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); }
else if (typeof method === 'object' || !method) { return methods.init.apply(this, arguments); }
else { $.error( 'Method "' + method + '" does not exist in editor plugin!'); }
};
})(jQuery);
|
gpl-3.0
|
nicoechaniz/lime-app
|
plugins/lime-plugin-rx/src/rxConstants.js
|
667
|
export const GET_NODE_STATUS = 'rx/GET_NODE_STATUS';
export const GET_NODE_STATUS_SUCCESS = 'rx/GET_NODE_STATUS_SUCCESS';
export const GET_NODE_STATUS_ERROR = 'rx/GET_NODE_STATUS_ERROR';
export const TIMER_START = 'rx/TIMER_START';
export const TIMER_STOP = 'rx/TIMER_STOP';
export const INTERVAL_GET = 'rx/INTERVAL_GET';
export const GET_SIGNAL = 'rx/GET_SIGNAL';
export const GET_SIGNAL_SUCCESS = 'rx/GET_SIGNAL_SUCCESS';
export const GET_TRAFFIC = 'rx/GET_TRAFFIC';
export const GET_TRAFFIC_SUCCESS = 'rx/GET_TRAFFIC_SUCCESS';
export const GET_INTERNET_STATUS = 'rx/GET_INTERNET_STATUS';
export const GET_INTERNET_STATUS_SUCCESS = 'rx/GET_INTERNET_STATUS_SUCCESS';
|
gpl-3.0
|
cjd/xLights
|
xLights/models/ChannelBlockModel.cpp
|
9467
|
/***************************************************************
* This source files comes from the xLights project
* https://www.xlights.org
* https://github.com/smeighan/xLights
* See the github commit history for a record of contributing
* developers.
* Copyright claimed based on commit dates recorded in Github
* License: https://github.com/smeighan/xLights/blob/master/License.txt
**************************************************************/
#include <wx/xml/xml.h>
#include <wx/propgrid/propgrid.h>
#include <wx/propgrid/advprops.h>
#include "ChannelBlockModel.h"
#include "ModelScreenLocation.h"
#include "../OutputModelManager.h"
std::vector<std::string> ChannelBlockModel::LINE_BUFFER_STYLES;
ChannelBlockModel::ChannelBlockModel(wxXmlNode *node, const ModelManager &manager, bool zeroBased) : ModelWithScreenLocation(manager)
{
SetFromXml(node, zeroBased);
}
ChannelBlockModel::~ChannelBlockModel()
{
}
const std::vector<std::string> &ChannelBlockModel::GetBufferStyles() const {
struct Initializer {
Initializer() {
LINE_BUFFER_STYLES = Model::DEFAULT_BUFFER_STYLES;
auto it = std::find(LINE_BUFFER_STYLES.begin(), LINE_BUFFER_STYLES.end(), "Single Line");
if (it != LINE_BUFFER_STYLES.end()) {
LINE_BUFFER_STYLES.erase(it);
}
}
};
static Initializer ListInitializationGuard;
return LINE_BUFFER_STYLES;
}
void ChannelBlockModel::AddTypeProperties(wxPropertyGridInterface *grid) {
wxPGProperty *p = grid->Append(new wxUIntProperty("# Channels", "ChannelBlockCount", parm1));
p->SetAttribute("Min", 1);
p->SetAttribute("Max", 64);
p->SetEditor("SpinCtrl");
p = grid->Append(new wxBoolProperty("Indiv Colors", "ChannelProperties", true));
//p->SetAttribute("UseCheckbox", true);
p->Enable(false);
for (int x = 0; x < parm1; ++x) {
wxString nm = ChanColorAttrName(x);
std::string val = ModelXml->GetAttribute("ChannelProperties." + nm).ToStdString();
if (val == "") {
val = "white";
ModelXml->DeleteAttribute("ChannelProperties." + nm);
ModelXml->AddAttribute("ChannelProperties." + nm, val);
}
grid->AppendIn(p, new wxColourProperty(nm, nm, wxColor(val)));
}
}
int ChannelBlockModel::OnPropertyGridChange(wxPropertyGridInterface *grid, wxPropertyGridEvent& event) {
if ("ChannelBlockCount" == event.GetPropertyName()) {
ModelXml->DeleteAttribute("parm1");
ModelXml->AddAttribute("parm1", wxString::Format("%d", (int)event.GetPropertyValue().GetLong()));
//AdjustChannelProperties(grid, event.GetPropertyValue().GetLong());
//AdjustStringProperties(grid, event.GetPropertyValue().GetLong());
AddASAPWork(OutputModelManager::WORK_RGBEFFECTS_CHANGE, "ChannelBlockModel::OnPropertyGridChange::ChannelBlockCount");
AddASAPWork(OutputModelManager::WORK_MODELS_CHANGE_REQUIRING_RERENDER, "ChannelBlockModel::OnPropertyGridChange::ChannelBlockCount");
AddASAPWork(OutputModelManager::WORK_RELOAD_MODEL_FROM_XML, "ChannelBlockModel::OnPropertyGridChange::ChannelBlockCount");
AddASAPWork(OutputModelManager::WORK_REDRAW_LAYOUTPREVIEW, "ChannelBlockModel::OnPropertyGridChange::ChannelBlockCount");
AddASAPWork(OutputModelManager::WORK_RELOAD_PROPERTYGRID, "ChannelBlockModel::OnPropertyGridChange::ChannelBlockCount");
AddASAPWork(OutputModelManager::WORK_CALCULATE_START_CHANNELS, "ChannelBlockModel::OnPropertyGridChange::ChannelBlockCount");
AddASAPWork(OutputModelManager::WORK_MODELS_REWORK_STARTCHANNELS, "ChannelBlockModel::OnPropertyGridChange::ChannelBlockCount");
AddASAPWork(OutputModelManager::WORK_RELOAD_MODELLIST, "ChannelBlockModel::OnPropertyGridChange::ChannelBlockCount");
return 0;
}
else if (event.GetPropertyName().StartsWith("ChannelProperties."))
{
wxColor c;
c << event.GetProperty()->GetValue();
xlColor xc = c;
ModelXml->DeleteAttribute(event.GetPropertyName());
ModelXml->AddAttribute(event.GetPropertyName(), xc);
AddASAPWork(OutputModelManager::WORK_RGBEFFECTS_CHANGE, "ChannelBlockModel::OnPropertyGridChange::ChannelProperties");
AddASAPWork(OutputModelManager::WORK_MODELS_CHANGE_REQUIRING_RERENDER, "ChannelBlockModel::OnPropertyGridChange::ChannelProperties");
AddASAPWork(OutputModelManager::WORK_RELOAD_MODEL_FROM_XML, "ChannelBlockModel::OnPropertyGridChange::ChannelProperties");
return 0;
}
return Model::OnPropertyGridChange(grid, event);
}
void ChannelBlockModel::AdjustChannelProperties(wxPropertyGridInterface *grid, int newNum) {
wxPropertyGrid *pg = (wxPropertyGrid*)grid;
wxPGProperty *p = grid->GetPropertyByName("ChannelProperties");
if (p != nullptr) {
pg->Freeze();
int count = p->GetChildCount();
while (count > newNum) {
count--;
wxString nm = ChanColorAttrName(count);
wxPGProperty *sp = grid->GetPropertyByName(wxS("ChannelProperties." + nm));
if (sp != nullptr) {
grid->DeleteProperty(sp);
}
ModelXml->DeleteAttribute("ChannelProperties." + nm);
}
while (count < newNum) {
wxString nm = ChanColorAttrName(count);
std::string val = ModelXml->GetAttribute("ChannelProperties." + nm).ToStdString();
if (val == "") {
ModelXml->DeleteAttribute("ChannelProperties." + nm);
ModelXml->AddAttribute("ChannelProperties." + nm, "white");
}
grid->AppendIn(p, new wxColourProperty(nm, nm, wxColor(val)));
count++;
}
pg->Thaw();
pg->RefreshGrid();
}
}
void ChannelBlockModel::GetBufferSize(const std::string &type, const std::string &camera, const std::string &transform, int &BufferWi, int &BufferHi) const {
BufferHi = 1;
BufferWi = GetNodeCount();
}
void ChannelBlockModel::InitRenderBufferNodes(const std::string &type, const std::string &camera, const std::string &transform,
std::vector<NodeBaseClassPtr> &newNodes, int &BufferWi, int &BufferHi) const {
BufferHi = 1;
BufferWi = GetNodeCount();
int NumChannels=parm1;
int cur = 0;
for (int y=0; y < NumChannels; ++y) {
int idx = y;
newNodes.push_back(NodeBaseClassPtr(Nodes[idx]->clone()));
for(size_t c=0; c < newNodes[cur]->Coords.size(); ++c) {
newNodes[cur]->Coords[c].bufX=cur;
newNodes[cur]->Coords[c].bufY=0;
}
cur++;
}
}
void ChannelBlockModel::DisableUnusedProperties(wxPropertyGridInterface *grid)
{
// disable string type properties. Only Single Color White allowed.
wxPGProperty *p = grid->GetPropertyByName("ModelStringType");
if (p != nullptr) {
p->Enable(false);
}
p = grid->GetPropertyByName("ModelStringColor");
if (p != nullptr) {
p->Enable(false);
}
p = grid->GetPropertyByName("ModelFaces");
if (p != nullptr) {
p->Enable(false);
}
// Don't remove ModelStates ... these can be used for DMX devices that use a value range to set a colour or behaviour
}
void ChannelBlockModel::InitModel() {
StringType = "Single Color Custom";
customColor = xlWHITE;
SingleNode = true;
InitChannelBlock();
for (auto node = Nodes.begin(); node != Nodes.end(); ++node) {
int count = 0;
int num = node->get()->Coords.size();
float offset = 0.0;
if (num == 1) {
offset = 0.5;
}
else {
offset = (float)1 / (float)num / 2.0;
}
for (auto coord = node->get()->Coords.begin(); coord != node->get()->Coords.end(); ++coord) {
coord->screenY = 0;
if (num > 1) {
coord->screenX = (float)coord->bufX + (float)count / (float)num + offset;
count++;
}
else {
coord->screenX = coord->bufX + offset;
}
}
}
screenLocation.SetRenderSize(BufferWi, 1);
}
void ChannelBlockModel::InitChannelBlock() {
SetNodeCount(parm1, 1, rgbOrder);
SetBufferSize(1, parm1);
int LastStringNum = -1;
int chan = 0;
int ChanIncr = 1;
size_t NodeCount = GetNodeCount();
int idx = 0;
for (size_t n = 0; n<NodeCount; ++n) {
if (Nodes[n]->StringNum != LastStringNum) {
LastStringNum = Nodes[n]->StringNum;
chan = stringStartChan[LastStringNum];
}
Nodes[n]->ActChan = chan;
chan += ChanIncr;
Nodes[n]->Coords.resize(1);
size_t CoordCount = GetCoordCount(n);
for (size_t c = 0; c < CoordCount; ++c) {
Nodes[n]->Coords[c].bufX = idx;
Nodes[n]->Coords[c].bufY = 0;
}
idx++;
wxString nm = ChanColorAttrName(n);
std::string val = ModelXml->GetAttribute("ChannelProperties." + nm).ToStdString();
xlColor c = xlColor(val);
Nodes[n]->SetMaskColor(c);
NodeClassCustom* ncc = dynamic_cast<NodeClassCustom*>(Nodes[n].get());
ncc->SetCustomColor(c);
}
}
int ChannelBlockModel::MapToNodeIndex(int strand, int node) const {
return strand;
}
int ChannelBlockModel::GetNumStrands() const {
return parm1;
}
int ChannelBlockModel::CalcCannelsPerString() {
return GetNodeChannelCount(StringType);
}
|
gpl-3.0
|
HexHive/datashield
|
compiler/llvm/tools/clang/test/SemaCXX/typo-correction-crash.cpp
|
335
|
// RUN: %clang_cc1 -fsyntax-only -std=c++14 -verify %s
auto check1() {
return 1;
return s; // expected-error {{use of undeclared identifier 's'}}
}
int test = 11; // expected-note {{'test' declared here}}
auto check2() {
return "s";
return tes; // expected-error {{use of undeclared identifier 'tes'; did you mean 'test'?}}
}
|
gpl-3.0
|
3cky/bkemu-android
|
app/src/main/java/su/comp/bk/arch/io/memory/SmkMemoryManager.java
|
11548
|
/*
* Copyright (C) 2021 Victor Antonovich (v.antonovich@gmail.com)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package su.comp.bk.arch.io.memory;
import android.os.Bundle;
import java.util.List;
import su.comp.bk.arch.Computer;
import su.comp.bk.arch.io.Device;
import su.comp.bk.arch.io.disk.FloppyController;
import su.comp.bk.arch.memory.SegmentedMemory;
import su.comp.bk.arch.memory.SelectableMemory;
/**
* SMK512 controller extended memory manager.
*/
public class SmkMemoryManager implements Device {
// State save/restore: Current memory layout value
private static final String STATE_MEMORY_CONFIGURATION = SmkMemoryManager.class.getName() +
"#current_layout";
// Total size of SMK memory in words (512 Kbytes / 256 Kwords)
public final static int MEMORY_TOTAL_SIZE = 512 * 1024 / 2;
// Start address of SMK memory window
public final static int MEMORY_START_ADDRESS = 0100000;
// Number of segments in SMK memory window
public final static int NUM_MEMORY_SEGMENTS = 8;
// Size of single segment in words (4 Kbytes / 2 KWords )
public final static int MEMORY_SEGMENT_SIZE = 4 * 1024 / 2;
// BIOS ROM start addresses
public final static int BIOS_ROM_0_START_ADDRESS = 0160000;
public final static int BIOS_ROM_1_START_ADDRESS = 0170000;
// Memory segment 7 non-restricted area size in words (address range 0170000 - 0177000)
private final static int MEMORY_SEGMENT_7_NON_RESTRICTED_SIZE = 03400;
// SMK controller (ab)uses floppy disk drive control register to set up memory layout
private final static int[] ADDRESSES = { FloppyController.CONTROL_REGISTER_ADDRESS };
// SMK memory modes
private final static int MODE_SYS = 0160;
private final static int MODE_STD10 = 060;
private final static int MODE_RAM10 = 0120;
private final static int MODE_ALL = 020;
private final static int MODE_STD11 = 0140;
private final static int MODE_RAM11 = 040;
private final static int MODE_HLT10 = 0100;
private final static int MODE_HLT11 = 0;
// 8 memory segments 4K bytes each
private final SegmentedMemory[] memorySegments = new SegmentedMemory[NUM_MEMORY_SEGMENTS];
private final static int MEMORY_LAYOUT_UPDATE_STROBE_PATTERN = 0b0110;
private static final int MEMORY_LAYOUT_MODE_MASK = 0160;
private static final int MEMORY_LAYOUT_PAGE_MASK = 02015;
private boolean memoryLayoutUpdateStrobe;
private SelectableMemory bk11BosRom;
private SelectableMemory bk11SecondBankedMemory;
private SelectableMemory romSegment6;
private SelectableMemory romSegment7;
private int currentMemoryLayoutValue;
public SmkMemoryManager(List<SegmentedMemory> smkMemorySegments,
SelectableMemory selectableSmkBiosRom0,
SelectableMemory selectableSmkBiosRom1) {
for (int segment = 0; segment < NUM_MEMORY_SEGMENTS; segment++) {
setMemorySegment(smkMemorySegments.get(segment), segment);
}
setSelectableBiosRoms(selectableSmkBiosRom0, selectableSmkBiosRom1);
}
public SegmentedMemory getMemorySegment(int segment) {
return memorySegments[segment];
}
public void setMemorySegment(SegmentedMemory memory, int segment) {
memorySegments[segment] = memory;
}
@Override
public int[] getAddresses() {
return ADDRESSES;
}
@Override
public void init(long cpuTime, boolean isHardwareReset) {
if (isHardwareReset) {
initMemoryLayout();
}
}
@Override
public void saveState(Bundle outState) {
outState.putInt(STATE_MEMORY_CONFIGURATION, currentMemoryLayoutValue);
}
@Override
public void restoreState(Bundle inState) {
updateMemoryLayout(inState.getInt(STATE_MEMORY_CONFIGURATION, MODE_SYS));
}
@Override
public int read(long cpuTime, int address) {
// Register is write only
return Computer.BUS_ERROR;
}
@Override
public boolean write(long cpuTime, boolean isByteMode, int address, int value) {
boolean lastMemoryLayoutUpdateStrobe = memoryLayoutUpdateStrobe;
memoryLayoutUpdateStrobe = (value & 0b1111) == MEMORY_LAYOUT_UPDATE_STROBE_PATTERN;
// Memory layout is updated on the falling edge of the strobe
if (lastMemoryLayoutUpdateStrobe && !memoryLayoutUpdateStrobe) {
updateMemoryLayout(value);
}
return true;
}
public void setSelectableBk11BosRom(SelectableMemory bk11BosRom) {
this.bk11BosRom = bk11BosRom;
}
private void selectBk11BosRom(boolean isSelected) {
if (bk11BosRom != null) {
bk11BosRom.setSelected(isSelected);
}
}
public void setSelectableBk11SecondBankedMemory(SelectableMemory bk11SecondBankedMemory) {
this.bk11SecondBankedMemory = bk11SecondBankedMemory;
}
private void selectBk11SecondBankedMemory(boolean isSelected) {
if (bk11SecondBankedMemory != null) {
bk11SecondBankedMemory.setSelected(isSelected);
}
}
public void setSelectableBiosRoms(SelectableMemory biosRom0, SelectableMemory biosRom1) {
this.romSegment6 = biosRom0;
this.romSegment7 = biosRom1;
}
private void resetMemoryLayout() {
for (int i = 0; i < NUM_MEMORY_SEGMENTS; i++) {
setupMemorySegment(i, -1);
}
romSegment6.setSelected(false);
romSegment7.setSelected(false);
selectBk11BosRom(true);
selectBk11SecondBankedMemory(true);
}
public void initMemoryLayout() {
updateMemoryLayout(MODE_SYS);
}
private void updateMemoryLayout(int memoryLayoutValue) {
currentMemoryLayoutValue = memoryLayoutValue;
int memoryLayoutPageValue = memoryLayoutValue & MEMORY_LAYOUT_PAGE_MASK;
int memoryLayoutModeValue = memoryLayoutValue & MEMORY_LAYOUT_MODE_MASK;
setupMemoryLayout(memoryLayoutPageValue, memoryLayoutModeValue);
}
private void setupMemoryLayout(int pageValue, int modeValue) {
int pageStartIndex = 0;
if ((pageValue & 02000) != 0) {
pageStartIndex += 010;
}
if ((pageValue & 4) != 0) {
pageStartIndex += 020;
}
if ((pageValue & 010) != 0) {
pageStartIndex += 040;
}
if ((pageValue & 1) != 0) {
pageStartIndex += 0100;
}
resetMemoryLayout();
switch (modeValue) {
case MODE_SYS:
setupMemorySegment(2, pageStartIndex + 6);
setupMemorySegment(3, pageStartIndex + 7);
setupMemorySegment(4, pageStartIndex + 0);
setupMemorySegment(5, pageStartIndex + 1);
romSegment6.setSelected(true);
romSegment7.setSelected(true);
selectBk11SecondBankedMemory(false);
break;
case MODE_STD10:
setupMemorySegment(2, pageStartIndex + 2);
setupMemorySegment(3, pageStartIndex + 3);
setupMemorySegment(4, pageStartIndex + 4);
setupMemorySegment(5, pageStartIndex + 5);
setupMemorySegment7(pageStartIndex + 7, false, false);
romSegment6.setSelected(true);
selectBk11BosRom(false);
selectBk11SecondBankedMemory(false);
break;
case MODE_RAM10:
setupMemorySegment(0, pageStartIndex + 0);
setupMemorySegment(1, pageStartIndex + 1);
setupMemorySegment(2, pageStartIndex + 2);
setupMemorySegment(3, pageStartIndex + 3);
setupMemorySegment(4, pageStartIndex + 4);
setupMemorySegment(5, pageStartIndex + 5);
setupMemorySegment(6, pageStartIndex + 6);
setupMemorySegment7(pageStartIndex + 7, false, false);
selectBk11SecondBankedMemory(false);
break;
case MODE_ALL:
setupMemorySegment(0, pageStartIndex + 4);
setupMemorySegment(1, pageStartIndex + 5);
setupMemorySegment(2, pageStartIndex + 6);
setupMemorySegment(3, pageStartIndex + 7);
setupMemorySegment(4, pageStartIndex + 0);
setupMemorySegment(5, pageStartIndex + 1);
setupMemorySegment(6, pageStartIndex + 2);
setupMemorySegment7(pageStartIndex + 3, true, false);
selectBk11BosRom(false);
selectBk11SecondBankedMemory(false);
break;
case MODE_STD11:
setupMemorySegment7(pageStartIndex + 7, false, false);
romSegment6.setSelected(true);
break;
case MODE_RAM11:
setupMemorySegment(4, pageStartIndex + 4);
setupMemorySegment(5, pageStartIndex + 5);
setupMemorySegment(6, pageStartIndex + 6);
setupMemorySegment7(pageStartIndex + 7, false, false);
selectBk11BosRom(false);
break;
case MODE_HLT10:
setupMemorySegment(0, pageStartIndex + 0,
MEMORY_SEGMENT_SIZE, -1);
setupMemorySegment(1, pageStartIndex + 1);
setupMemorySegment(2, pageStartIndex + 2);
setupMemorySegment(3, pageStartIndex + 3);
setupMemorySegment(4, pageStartIndex + 4);
setupMemorySegment(5, pageStartIndex + 5);
setupMemorySegment(6, pageStartIndex + 6);
setupMemorySegment7(pageStartIndex + 7, false, true);
break;
case MODE_HLT11:
setupMemorySegment(4, pageStartIndex + 4);
setupMemorySegment(5, pageStartIndex + 5);
setupMemorySegment(6, pageStartIndex + 6);
setupMemorySegment7(pageStartIndex + 7, false, true);
selectBk11BosRom(false);
break;
}
}
private void setupMemorySegment(int segment, int index) {
setupMemorySegment(segment, index, MEMORY_SEGMENT_SIZE, MEMORY_SEGMENT_SIZE);
}
private void setupMemorySegment(int segment, int index, int readableSize, int writableSize) {
SegmentedMemory memory = getMemorySegment(segment);
memory.setActiveSegmentIndex(index);
memory.setReadableSize(readableSize);
memory.setWritableSize(writableSize);
}
private void setupMemorySegment7(int index, boolean isExtentReadable, boolean isExtentWritable) {
setupMemorySegment(7, index,
isExtentReadable ? MEMORY_SEGMENT_SIZE : MEMORY_SEGMENT_7_NON_RESTRICTED_SIZE,
isExtentWritable ? MEMORY_SEGMENT_SIZE : MEMORY_SEGMENT_7_NON_RESTRICTED_SIZE);
}
}
|
gpl-3.0
|
gohdan/DFC
|
known_files/hashes/templates/beez/html/com_contact/contact/default_form.php
|
49
|
Joomla 1.5.23 = 91626d8a09a940fe7272b00577b7322d
|
gpl-3.0
|
OXID-eSales/oxideshop_ce
|
tests/Integration/Internal/Framework/Module/Configuration/Dao/ModuleConfigurationDaoTest.php
|
1592
|
<?php
/**
* Copyright © OXID eSales AG. All rights reserved.
* See LICENSE file for license details.
*/
declare(strict_types=1);
namespace OxidEsales\EshopCommunity\Tests\Integration\Internal\Framework\Module\Configuration\Dao;
use OxidEsales\EshopCommunity\Internal\Framework\Module\Configuration\Dao\ModuleConfigurationDaoInterface;
use OxidEsales\EshopCommunity\Internal\Framework\Module\Configuration\Dao\ShopConfigurationDaoInterface;
use OxidEsales\EshopCommunity\Internal\Framework\Module\Configuration\DataObject\ModuleConfiguration;
use OxidEsales\EshopCommunity\Internal\Framework\Module\Configuration\DataObject\ShopConfiguration;
use OxidEsales\EshopCommunity\Tests\Integration\Internal\ContainerTrait;
use PHPUnit\Framework\TestCase;
/**
* @internal
*/
class ModuleConfigurationDaoTest extends TestCase
{
use ContainerTrait;
protected function setUp(): void
{
$this->prepareProjectConfiguration();
parent::setUp();
}
public function testSaving()
{
$moduleConfiguration = new ModuleConfiguration();
$moduleConfiguration
->setId('testId')
->setModuleSource('test');
$dao = $this->get(ModuleConfigurationDaoInterface::class);
$dao->save($moduleConfiguration, 1);
$this->assertEquals(
$moduleConfiguration,
$dao->get('testId', 1)
);
}
private function prepareProjectConfiguration()
{
$this->get(ShopConfigurationDaoInterface::class)->save(
new ShopConfiguration(),
1
);
}
}
|
gpl-3.0
|
Dabblecraft2DevTeam/Movecraft-3
|
modules/Movecraft/src/main/java/net/countercraft/movecraft/mapUpdater/update/UpdateCommand.java
|
131
|
package net.countercraft.movecraft.mapUpdater.update;
public abstract class UpdateCommand{
public abstract void doUpdate();
}
|
gpl-3.0
|
1stsetup/TVHClient
|
src/org/tvheadend/tvhclient/model/SeriesInfo.java
|
912
|
package org.tvheadend.tvhclient.model;
import java.util.Locale;
public class SeriesInfo {
public int seasonNumber;
public int seasonCount;
public int episodeNumber;
public int episodeCount;
public int partNumber;
public int partCount;
public String onScreen;
public String toString() {
if (onScreen != null && onScreen.length() > 0) {
return onScreen;
}
String s = "";
if (seasonNumber > 0) {
if (s.length() > 0)
s += ", ";
s += String.format("season %02d", seasonNumber);
}
if (episodeNumber > 0) {
if (s.length() > 0)
s += ", ";
s += String.format("episode %02d", episodeNumber);
}
if (partNumber > 0) {
if (s.length() > 0)
s += ", ";
s += String.format("part %d", partNumber);
}
if(s.length() > 0) {
s = s.substring(0,1).toLowerCase(Locale.getDefault()) + s.substring(1);
}
return s;
}
}
|
gpl-3.0
|
sharun-s/kiwix-html5
|
www/js/lib/sw.js
|
11290
|
// ServiceWorker related code - HTML pages in the archive can be rendered in one of two ways
// Parse article HTML for assets and load assets from the ZIM - Parse and Load
// Load HTML and Intercept HTTP asset requests, and load assets from the ZIM - Intercept and Load
// A service worker is used to implement Intercept and Load.
// It is the faster method for article loading, but doesn't have support across all browsers.
// The current default loading process is jquery based parse and load.
// The interception method below should work on browsers (Safari, Chrome) that support service workers, though in this branch isn't in use.
// To see in in action refer to the main branch on github.com/kiwix/kiwix-js/
'use strict';
define(['jquery'], function($) {
var messageChannel;
var contentInjectionMode;
var serviceWorkerRegistration = null;
$('input:radio[name=contentInjectionMode]').on('change', function(e) {
if (sw.checkWarnServiceWorkerMode(this.value)) {
// Do the necessary to enable or disable the Service Worker
sw.setContentInjectionMode(this.value);
}
else {
sw.setContentInjectionMode('ParseAndLoad');
}
});
// At launch, we try to set the last content injection mode (stored in a cookie)
var lastContentInjectionMode = cookies.getItem('lastContentInjectionMode');
if (lastContentInjectionMode) {
sw.setContentInjectionMode(lastContentInjectionMode);
}
else {
sw.setContentInjectionMode('ParseAndLoad');
}
/**
* Displays or refreshes the API status shown to the user
*/
function refreshAPIStatus() {
if (isMessageChannelAvailable()) {
$('#messageChannelStatus').html("MessageChannel API available");
$('#messageChannelStatus').removeClass("apiAvailable apiUnavailable")
.addClass("apiAvailable");
} else {
$('#messageChannelStatus').html("MessageChannel API unavailable");
$('#messageChannelStatus').removeClass("apiAvailable apiUnavailable")
.addClass("apiUnavailable");
}
if (isServiceWorkerAvailable()) {
if (isServiceWorkerReady()) {
$('#serviceWorkerStatus').html("ServiceWorker API available, and registered");
$('#serviceWorkerStatus').removeClass("apiAvailable apiUnavailable")
.addClass("apiAvailable");
} else {
$('#serviceWorkerStatus').html("ServiceWorker API available, but not registered");
$('#serviceWorkerStatus').removeClass("apiAvailable apiUnavailable")
.addClass("apiUnavailable");
}
} else {
$('#serviceWorkerStatus').html("ServiceWorker API unavailable");
$('#serviceWorkerStatus').removeClass("apiAvailable apiUnavailable")
.addClass("apiUnavailable");
}
}
/**
* Sets the given injection mode.
* This involves registering (or re-enabling) the Service Worker if necessary
* It also refreshes the API status for the user afterwards.
*
* @param {String} value The chosen content injection mode : 'ParseAndLoad' or 'InterceptAndLoad'
*/
function setContentInjectionMode(value) {
if (value === 'ParseAndLoad') {
if (isServiceWorkerReady()) {
// We need to disable the ServiceWorker
// Unregistering it does not seem to work as expected : the ServiceWorker
// is indeed unregistered but still active...
// So we have to disable it manually (even if it's still registered and active)
navigator.serviceWorker.controller.postMessage({'action': 'disable'});
messageChannel = null;
}
refreshAPIStatus();
} else if (value === 'InterceptAndLoad') {
if (!isServiceWorkerAvailable()) {
alert("The ServiceWorker API is not available on your device. Falling back to ParseAndLoad mode");
setContentInjectionMode('ParseAndLoad');
return;
}
if (!isMessageChannelAvailable()) {
alert("The MessageChannel API is not available on your device. Falling back to ParseAndLoad mode");
setContentInjectionMode('ParseAndLoad');
return;
}
if (!messageChannel) {
// Let's create the messageChannel for the 2-way communication
// with the Service Worker
messageChannel = new MessageChannel();
messageChannel.port1.onmessage = handleMessageChannelMessage;
}
if (!isServiceWorkerReady()) {
$('#serviceWorkerStatus').html("ServiceWorker API available : trying to register it...");
navigator.serviceWorker.register('../../service-worker.js').then(function (reg) {
console.log('serviceWorker registered', reg);
serviceWorkerRegistration = reg;
refreshAPIStatus();
// We need to wait for the ServiceWorker to be activated
// before sending the first init message
var serviceWorker = reg.installing || reg.waiting || reg.active;
serviceWorker.addEventListener('statechange', function(statechangeevent) {
if (statechangeevent.target.state === 'activated') {
console.log("try to post an init message to ServiceWorker");
navigator.serviceWorker.controller.postMessage({'action': 'init'}, [messageChannel.port2]);
console.log("init message sent to ServiceWorker");
}
});
}, function (err) {
console.error('error while registering serviceWorker', err);
refreshAPIStatus();
});
} else {
console.log("try to re-post an init message to ServiceWorker, to re-enable it in case it was disabled");
navigator.serviceWorker.controller.postMessage({'action': 'init'}, [messageChannel.port2]);
console.log("init message sent to ServiceWorker");
}
}
$('input:radio[name=contentInjectionMode]').prop('checked', false);
$('input:radio[name=contentInjectionMode]').filter('[value="' + value + '"]').prop('checked', true);
contentInjectionMode = value;
// Save the value in a cookie, so that to be able to keep it after a reload/restart
cookies.setItem('lastContentInjectionMode', value, Infinity);
}
/**
* If the ServiceWorker mode is selected, warn the user before activating it
* @param chosenContentInjectionMode The mode that the user has chosen
*/
function checkWarnServiceWorkerMode(chosenContentInjectionMode) {
if (chosenContentInjectionMode === 'InterceptAndLoad' && !cookies.hasItem("warnedServiceWorkerMode")) {
// The user selected the "serviceworker" mode, which is still unstable
// So let's display a warning to the user
// If the focus is on the search field, we have to move it,
// else the keyboard hides the message
if ($("#prefix").is(":focus")) {
$("searchArticles").focus();
}
if (confirm("The 'InterceptAndLoad' mode is still UNSTABLE for now."
+ " It happens that the application needs to be reinstalled (or the ServiceWorker manually removed)."
+ " Please confirm with OK that you're ready to face this kind of bugs, or click Cancel to stay in 'ParseAndLoad' mode.")) {
// We will not display this warning again for one day
cookies.setItem("warnedServiceWorkerMode", true, 86400);
return true;
}
else {
return false;
}
}
return true;
}
/**
* Tells if the ServiceWorker API is available
* https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker
* @returns {Boolean}
*/
function isServiceWorkerAvailable() {
return ('serviceWorker' in navigator);
}
/**
* Tells if the MessageChannel API is available
* https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel
* @returns {Boolean}
*/
function isMessageChannelAvailable() {
try{
var dummyMessageChannel = new MessageChannel();
if (dummyMessageChannel) return true;
}
catch (e){
return false;
}
return false;
}
/**
* Tells if the ServiceWorker is registered, and ready to capture HTTP requests
* and inject content in articles.
* @returns {Boolean}
*/
function isServiceWorkerReady() {
// Return true if the serviceWorkerRegistration is not null and not undefined
return (serviceWorkerRegistration);
}
/**
* Function that handles a message of the messageChannel.
* It tries to read the content in the backend, and sends it back to the ServiceWorker
* @param {Event} event
*/
function handleMessageChannelMessage(event) {
if (event.data.error) {
console.error("Error in MessageChannel", event.data.error);
reject(event.data.error);
} else {
console.log("the ServiceWorker sent a message on port1", event.data);
if (event.data.action === "askForContent") {
console.log("we are asked for a content : let's try to answer to this message");
var url = event.data.url;
var messagePort = event.ports[0];
var readFile = function(dirEntry) {
if (dirEntry === null) {
console.error("URL " + url + " not found in archive.");
messagePort.postMessage({'action': 'giveContent', 'url' : url, 'content': ''});
} else if (dirEntry.isRedirect()) {
selectedArchive.resolveRedirect(dirEntry, readFile);
} else {
console.log("Reading binary file...");
selectedArchive.readBinaryFile(dirEntry, function(content) {
messagePort.postMessage({'action': 'giveContent', 'url' : url, 'content': content});
console.log("content sent to ServiceWorker");
});
}
};
selectedArchive.getDirEntryByURL(url).then(readFile).fail(function() {
messagePort.postMessage({'action': 'giveContent', 'url' : url, 'content': new UInt8Array()});
});
}
else {
console.error("Invalid message received", event.data);
}
}
};
function init(){
//TODO
};
return {
init: init;
}
});
|
gpl-3.0
|
h4h13/RetroMusicPlayer
|
app/src/main/java/code/name/monkey/retromusic/ui/fragments/settings/AudioSettings.java
|
1681
|
package code.name.monkey.retromusic.ui.fragments.settings;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.media.audiofx.AudioEffect;
import android.os.Bundle;
import android.support.v7.preference.Preference;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.util.NavigationUtil;
import code.name.monkey.retromusic.util.PreferenceUtil;
/**
* @author Hemanth S (h4h13).
*/
public class AudioSettings extends AbsSettingsFragment {
@Override
public void invalidateSettings() {
Preference findPreference = findPreference("equalizer");
if (!hasEqualizer() && !PreferenceUtil.getInstance(getContext()).getSelectedEqualizer().equals("retro")) {
findPreference.setEnabled(false);
findPreference.setSummary(getResources().getString(R.string.no_equalizer));
} else {
findPreference.setEnabled(true);
}
findPreference.setOnPreferenceClickListener(preference -> {
//noinspection ConstantConditions
NavigationUtil.openEqualizer(getActivity());
return true;
});
}
private boolean hasEqualizer() {
final Intent effects = new Intent(AudioEffect.ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL);
//noinspection ConstantConditions
PackageManager pm = getActivity().getPackageManager();
ResolveInfo ri = pm.resolveActivity(effects, 0);
return ri != null;
}
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
addPreferencesFromResource(R.xml.pref_audio);
}
}
|
gpl-3.0
|
cyberang3l/sysdata-collector
|
yapsy/PluginInfo.py
|
7078
|
#!/usr/bin/python
# -*- coding: utf-8; tab-width: 4; indent-tabs-mode: t; python-indent: 4 -*-
"""
Role
====
Encapsulate a plugin instance as well as some metadata.
API
===
"""
from ConfigParser import ConfigParser
from distutils.version import StrictVersion
class PluginInfo(object):
"""
Representation of the most basic set of information related to a
given plugin such as its name, author, description...
Any additional information can be stored ad retrieved in a
PluginInfo, when this one is created with a
``ConfigParser.ConfigParser`` instance.
This typically means that when metadata is read from a text file
(the original way for yapsy to describe plugins), all info that is
not part of the basic variables (name, path, version etc), can
still be accessed though the ``details`` member variables that
behaves like Python's ``ConfigParser.ConfigParser``.
"""
def __init__(self, plugin_name, plugin_path):
"""
Set the basic information (at least name and path) about the
plugin as well as the default values for other usefull
variables.
*plugin_name* is a simple string describing the name of
the plugin.
*plugin_path* describe the location where the plugin can be
found.
.. warning:: The ``path`` attribute is the full path to the
plugin if it is organised as a directory or the
full path to a file without the ``.py`` extension
if the plugin is defined by a simple file. In the
later case, the actual plugin is reached via
``plugin_info.path+'.py'``.
"""
self.__details = ConfigParser()
self.name = plugin_name
self.path = plugin_path
self._ensureDetailsDefaultsAreBackwardCompatible()
# Storage for stuff created during the plugin lifetime
self.plugin_object = None
self.categories = []
self.error = None
def __setDetails(self,cfDetails):
"""
Fill in all details by storing a ``ConfigParser`` instance.
.. warning: The values for ``plugin_name`` and
``plugin_path`` given a init time will superseed
any value found in ``cfDetails`` in section
'Core' for the options 'Name' and 'Module' (this
is mostly for backward compatibility).
"""
bkp_name = self.name
bkp_path = self.path
self.__details = cfDetails
self.name = bkp_name
self.path = bkp_path
self._ensureDetailsDefaultsAreBackwardCompatible()
def __getDetails(self):
return self.__details
def __getName(self):
return self.details.get("Core","Name")
def __setName(self, name):
if not self.details.has_section("Core"):
self.details.add_section("Core")
self.details.set("Core","Name",name)
def __getPath(self):
return self.details.get("Core","Module")
def __setPath(self,path):
if not self.details.has_section("Core"):
self.details.add_section("Core")
self.details.set("Core","Module",path)
def __getVersion(self):
return StrictVersion(self.details.get("Core","Version"))
def setVersion(self, vstring):
"""
Set the version of the plugin.
Used by subclasses to provide different handling of the
version number.
"""
if isinstance(vstring,StrictVersion):
vstring = str(vstring)
if not self.details.has_section("Documentation"):
self.details.add_section("Documentation")
self.details.set("Core","Version",vstring)
def __getAuthor(self):
return self.details.get("Documentation","Author")
def __setAuthor(self,author):
if not self.details.has_section("Documentation"):
self.details.add_section("Documentation")
self.details.set("Documentation","Author",author)
def __getCopyright(self):
return self.details.get("Documentation","Copyright")
def __setCopyright(self,copyrightTxt):
if not self.details.has_section("Documentation"):
self.details.add_section("Documentation")
self.details.set("Documentation","Copyright",copyrightTxt)
def __getWebsite(self):
return self.details.get("Documentation","website")
def __setWebsite(self,website):
if not self.details.has_section("Documentation"):
self.details.add_section("Documentation")
self.details.set("Documentation","Website",website)
def __getDescription(self):
return self.details.get("Documentation","Description")
def __setDescription(self,description):
if not self.details.has_section("Documentation"):
self.details.add_section("Documentation")
self.details.set("Documentation","Description",description)
def __getCategory(self):
"""
DEPRECATED (>1.9): Mimic former behaviour when what is
noz the first category was considered as the only one the
plugin belonged to.
"""
if self.categories:
return self.categories[0]
else:
return "UnknownCategory"
def __setCategory(self,c):
"""
DEPRECATED (>1.9): Mimic former behaviour by making so
that if a category is set as it it was the only category to
which the plugin belongs, then a __getCategory will return
this newly set category.
"""
self.categories = [c] + self.categories
name = property(fget=__getName,fset=__setName)
path = property(fget=__getPath,fset=__setPath)
version = property(fget=__getVersion,fset=setVersion)
author = property(fget=__getAuthor,fset=__setAuthor)
copyright = property(fget=__getCopyright,fset=__setCopyright)
website = property(fget=__getWebsite,fset=__setWebsite)
description = property(fget=__getDescription,fset=__setDescription)
details = property(fget=__getDetails,fset=__setDetails)
# deprecated (>1.9): plugins are not longer assocaited to a
# single category !
category = property(fget=__getCategory,fset=__setCategory)
def _getIsActivated(self):
"""
Return the activated state of the plugin object.
Makes it possible to define a property.
"""
return self.plugin_object.is_activated
is_activated = property(fget=_getIsActivated)
def _ensureDetailsDefaultsAreBackwardCompatible(self):
"""
Internal helper function.
"""
if not self.details.has_option("Documentation","Author"):
self.author = "None"
if not self.details.has_option("Documentation","Website"):
self.website = "None"
if not self.details.has_option("Documentation","Copyright"):
self.copyright = "None"
if not self.details.has_option("Documentation","Description"):
self.description = "None"
|
gpl-3.0
|
GEWIS/gewisweb
|
module/Frontpage/src/Controller/Factory/PageControllerFactory.php
|
668
|
<?php
namespace Frontpage\Controller\Factory;
use Frontpage\Controller\PageController;
use Interop\Container\ContainerInterface;
use Laminas\ServiceManager\Factory\FactoryInterface;
class PageControllerFactory implements FactoryInterface
{
/**
* @param ContainerInterface $container
* @param string $requestedName
* @param array|null $options
*
* @return PageController
*/
public function __invoke(
ContainerInterface $container,
$requestedName,
?array $options = null,
): PageController {
return new PageController(
$container->get('frontpage_service_page'),
);
}
}
|
gpl-3.0
|
sogeti-java-nl/masters-of-java-software
|
ctrlaltdev/src/main/java/nl/ctrlaltdev/net/server/HTTPSocketHandler.java
|
4895
|
package nl.ctrlaltdev.net.server;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.Socket;
import java.util.HashMap;
import java.util.Map;
/**
* Simple implementation of the HTTP protocol. Use as baseclass for all HTTP
* communications. Override the handle request method.
*
* @author E.Hooijmeijer / (C) 2003-2004 E.Hooijmeijer / Licence : LGPL 2.1
*/
public class HTTPSocketHandler implements Runnable {
/** Wrapper for a HTTP request, containing the headers and content */
public static class HTTPRequest {
private String myRequest, myContent;
private Map<String, String> myHeader;
public HTTPRequest(String req, Map<String, String> header,
String content) {
myRequest = req;
myHeader = header;
myContent = content;
}
public String getRequest() {
return myRequest;
}
public String getContent() {
return myContent;
}
public String getHeaderValue(String name) {
return myHeader.get(name.toLowerCase());
}
public String[] getHeaderNames() {
return myHeader.keySet().toArray(new String[myHeader.size()]);
}
}
/**
* Wrapper for a HTTP response, allowing header and content creation. Any
* modifications to the header should be done prior to getting the Writer.
*/
public static class HTTPResponse {
private BufferedWriter myOutput;
private int myContentLength;
private int myReplyCode;
private String myContentType;
private boolean headerSent;
public HTTPResponse(OutputStream out) {
myOutput = new BufferedWriter(new OutputStreamWriter(out));
myReplyCode = 200;
myContentLength = -1;
myContentType = "text/html";
}
public void setReplyCode(int code) {
myReplyCode = code;
}
public void setContentType(String contentType) {
myContentType = contentType;
}
public void setContentLength(int len) {
myContentLength = len;
}
public BufferedWriter getWriter() throws IOException {
if (!headerSent) {
if (myReplyCode == 200)
myOutput.write("HTTP/1.0 200 OK");
else
myOutput.write("HTTP/1.0 " + myReplyCode + " ERR");
myOutput.newLine();
myOutput.write("Content-type: " + myContentType);
myOutput.newLine();
if (myContentLength > 0)
myOutput.write("Content-length: " + myContentLength);
myOutput.newLine();
myOutput.newLine();
myOutput.flush();
headerSent = true;
}
return myOutput;
}
}
private Socket mySocket;
protected Log myLog;
private String myRequest;
private Map<String, String> myHeaderData;
private StringBuffer myContent;
public HTTPSocketHandler(Socket s, Log l) {
mySocket = s;
myLog = l;
myHeaderData = new HashMap<String, String>();
myContent = new StringBuffer();
}
public void run() {
try {
try {
BufferedReader in = new BufferedReader(new InputStreamReader(
mySocket.getInputStream()));
String s = null;
//
// Read Header
//
int cnt = 0;
do {
s = in.readLine();
if (s != null) {
if (cnt == 0)
myRequest = s;
else if (s.indexOf(':') >= 0) {
myHeaderData.put(s.substring(0, s.indexOf(':'))
.toLowerCase(),
s.substring(s.indexOf(':') + 2));
}
cnt++;
}
} while ((s != null) && (!s.equals("")));
//
// Read Content, if any.
//
String l = getHeaderField("Content-length");
if (l != null) {
int size = Integer.parseInt(l);
int read = 0;
char[] buffer = new char[256];
while (read < size) {
int r = in.read(buffer);
if (r == -1)
throw new IOException("End of Stream ??");
myContent.append(buffer, 0, r);
read = read + r;
}
s = null;
}
//
//
//
HTTPRequest req = new HTTPRequest(myRequest, myHeaderData,
myContent.toString());
HTTPResponse res = new HTTPResponse(mySocket.getOutputStream());
//
try {
handleRequest(req, res);
} catch (Exception e) {
myLog.error(e.getMessage());
res.setReplyCode(500);
res.getWriter().write(e.toString());
res.getWriter().newLine();
}
//
res.getWriter().flush();
//
} catch (IOException e) {
myLog.error(e.getMessage());
} finally {
//
mySocket.close();
//
}
//
} catch (IOException e) {
myLog.error(e.getMessage());
}
}
public String getHeaderField(String name) {
return myHeaderData.get(name.toLowerCase());
}
/**
* handleRequest contains the actual implementation of the request. This one
* prints HelloWorld. Override and do something useful with it.
*/
protected void handleRequest(HTTPRequest req, HTTPResponse res)
throws IOException {
//
// Do Nothing Implementation.
//
res.getWriter().write("Hallo Wereld");
res.getWriter().newLine();
}
}
|
gpl-3.0
|
mstritt/orbit-image-analysis
|
src/main/java/com/l2fprod/common/beans/BeanUtils.java
|
2191
|
/**
* $ $ License.
*
* Copyright $ L2FProd.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.l2fprod.common.beans;
import java.lang.reflect.Method;
/**
* BeanUtils. <br>
*
*/
public class BeanUtils {
private BeanUtils() {
}
public static Method getReadMethod(Class clazz, String propertyName) {
Method readMethod = null;
String base = capitalize(propertyName);
// Since there can be multiple setter methods but only one getter
// method, find the getter method first so that you know what the
// property type is. For booleans, there can be "is" and "get"
// methods. If an "is" method exists, this is the official
// reader method so look for this one first.
try {
readMethod = clazz.getMethod("is" + base);
} catch (Exception getterExc) {
try {
// no "is" method, so look for a "get" method.
readMethod = clazz.getMethod("get" + base);
} catch (Exception e) {
// no is and no get, we will return null
}
}
return readMethod;
}
public static Method getWriteMethod(
Class clazz,
String propertyName,
Class propertyType) {
Method writeMethod = null;
String base = capitalize(propertyName);
Class params[] = { propertyType };
try {
writeMethod = clazz.getMethod("set" + base, params);
} catch (Exception e) {
// no write method
}
return writeMethod;
}
private static String capitalize(String s) {
if (s.length() == 0) {
return s;
} else {
char chars[] = s.toCharArray();
chars[0] = Character.toUpperCase(chars[0]);
return String.valueOf(chars);
}
}
}
|
gpl-3.0
|
fisherMartyn/draw.io
|
war/js/diagramly/DropboxFile.js
|
4599
|
/**
* Copyright (c) 2006-2017, JGraph Ltd
* Copyright (c) 2006-2017, Gaudenz Alder
*/
DropboxFile = function(ui, data, stat)
{
DrawioFile.call(this, ui, data);
this.stat = stat;
};
//Extends mxEventSource
mxUtils.extend(DropboxFile, DrawioFile);
/**
* Translates this point by the given vector.
*
* @param {number} dx X-coordinate of the translation.
* @param {number} dy Y-coordinate of the translation.
*/
DropboxFile.prototype.getHash = function()
{
return 'D' + encodeURIComponent(this.stat.path.substring(1));
};
/**
* Translates this point by the given vector.
*
* @param {number} dx X-coordinate of the translation.
* @param {number} dy Y-coordinate of the translation.
*/
DropboxFile.prototype.getMode = function()
{
return App.MODE_DROPBOX;
};
/**
* Overridden to enable the autosave option in the document properties dialog.
*/
DropboxFile.prototype.isAutosaveOptional = function()
{
return true;
};
/**
* Translates this point by the given vector.
*
* @param {number} dx X-coordinate of the translation.
* @param {number} dy Y-coordinate of the translation.
*/
DropboxFile.prototype.getTitle = function()
{
return this.stat.name;
};
/**
* Translates this point by the given vector.
*
* @param {number} dx X-coordinate of the translation.
* @param {number} dy Y-coordinate of the translation.
*/
DropboxFile.prototype.isRenamable = function()
{
return true;
};
/**
* Translates this point by the given vector.
*
* @param {number} dx X-coordinate of the translation.
* @param {number} dy Y-coordinate of the translation.
*/
DropboxFile.prototype.save = function(revision, success, error)
{
this.doSave(this.getTitle(), success, error);
};
/**
* Translates this point by the given vector.
*
* @param {number} dx X-coordinate of the translation.
* @param {number} dy Y-coordinate of the translation.
*/
DropboxFile.prototype.saveAs = function(title, success, error)
{
this.doSave(title, success, error);
};
/**
* Translates this point by the given vector.
*
* @param {number} dx X-coordinate of the translation.
* @param {number} dy Y-coordinate of the translation.
*/
DropboxFile.prototype.doSave = function(title, success, error)
{
// Forces update of data for new extensions
var prev = this.stat.name;
this.stat.name = title;
DrawioFile.prototype.save.apply(this, arguments);
this.stat.name = prev;
this.saveFile(title, false, success, error);
};
/**
* Translates this point by the given vector.
*
* @param {number} dx X-coordinate of the translation.
* @param {number} dy Y-coordinate of the translation.
*/
DropboxFile.prototype.saveFile = function(title, revision, success, error)
{
if (!this.isEditable())
{
if (success != null)
{
success();
}
}
else if (!this.savingFile)
{
var fn = mxUtils.bind(this, function(checked)
{
if (checked)
{
this.savingFile = true;
// Makes sure no changes get lost while the file is saved
var prevModified = this.isModified;
var modified = this.isModified();
this.setModified(false);
this.isModified = function()
{
return modified;
};
this.ui.dropbox.saveFile(title, this.getData(), mxUtils.bind(this, function(stat)
{
this.savingFile = false;
this.isModified = prevModified;
this.stat = stat;
this.contentChanged();
if (success != null)
{
success();
}
}), mxUtils.bind(this, function(resp)
{
this.savingFile = false;
this.isModified = prevModified;
this.setModified(modified || this.isModified());
if (error != null)
{
error(resp);
}
}));
}
else if (error != null)
{
error();
}
});
if (this.getTitle() == title)
{
fn(true);
}
else
{
this.ui.dropbox.checkExists(title, fn);
}
}
else if (error != null)
{
error({code: App.ERROR_BUSY});
}
};
/**
* Translates this point by the given vector.
*
* @param {number} dx X-coordinate of the translation.
* @param {number} dy Y-coordinate of the translation.
*/
DropboxFile.prototype.rename = function(title, success, error)
{
this.ui.dropbox.renameFile(this, title, mxUtils.bind(this, function(stat)
{
if (!this.hasSameExtension(title, this.getTitle()))
{
this.stat = stat;
// Required in this case to update hash tag in page
// before saving so that the edit link is correct
this.descriptorChanged();
this.save(true, success, error);
}
else
{
this.stat = stat;
this.descriptorChanged();
if (success != null)
{
success();
}
}
}), error);
};
|
gpl-3.0
|
rfmaze2012/rfmaze-client
|
src/main/java/com/rfview/MatrixLabel.java
|
683
|
package com.rfview;
public class MatrixLabel {
private final int id;
private final String label;
private final String description;
public MatrixLabel(int id, String label, String description) {
super();
this.id = id;
this.label = label;
this.description = description;
}
public int getId() {
return id;
}
public String getLabel() {
return label;
}
public String getDescription() {
return description;
}
@Override
public String toString() {
return "MatrixLabel [id=" + id + ", label=" + label + ", description="
+ description + "]";
}
}
|
gpl-3.0
|
sWoRm/Spojo
|
spojo-core/src/main/java/com/github/sworm/spojo/exceptions/RuleException.java
|
389
|
/**
*
*/
package com.github.sworm.spojo.exceptions;
/**
* @author Vincent Palau
* @Since Feb 27, 2011
*
*/
public class RuleException extends SpojoException {
/**
*
*/
private static final long serialVersionUID = -6706010699182962172L;
/**
* @param description
*/
public RuleException(final String description) {
super(description);
}
}
|
gpl-3.0
|
G2159687/espd
|
app/src/main/java/com/github/epd/sprout/levels/SewerLevel.java
|
4971
|
package com.github.epd.sprout.levels;
import com.github.epd.sprout.Assets;
import com.github.epd.sprout.Dungeon;
import com.github.epd.sprout.DungeonTilemap;
import com.github.epd.sprout.actors.hero.HeroClass;
import com.github.epd.sprout.actors.mobs.npcs.Ghost;
import com.github.epd.sprout.actors.mobs.npcs.Ghost.GnollArcher;
import com.github.epd.sprout.items.bombs.Bomb;
import com.github.epd.sprout.items.food.Blackberry;
import com.github.epd.sprout.items.food.Blueberry;
import com.github.epd.sprout.items.food.Cloudberry;
import com.github.epd.sprout.items.food.Moonberry;
import com.github.epd.sprout.levels.painters.Painter;
import com.github.epd.sprout.levels.painters.SewerPainter;
import com.github.epd.sprout.messages.Messages;
import com.github.epd.sprout.scenes.GameScene;
import com.watabou.noosa.Game;
import com.watabou.noosa.Scene;
import com.watabou.noosa.particles.Emitter;
import com.watabou.noosa.particles.PixelParticle;
import com.watabou.utils.ColorMath;
import com.watabou.utils.PointF;
import com.watabou.utils.Random;
public class SewerLevel extends RegularLevel {
{
color1 = 0x48763c;
color2 = 0x59994a;
}
@Override
protected int standardRooms() {
switch (Dungeon.mapSize){
case 1:
return 5 + Random.chances(new float[]{4, 2, 1});
case 2:
return 10 + Random.chances(new float[]{4, 2, 1});
case 3:
return 15 + Random.chances(new float[]{4, 2, 1});
default:
return 5 + Random.chances(new float[]{4, 2, 1});
}
}
@Override
protected int specialRooms() {
switch (Dungeon.mapSize){
case 1:
return 1 + Random.chances(new float[]{4, 4, 2});
case 2:
return 2 + Random.chances(new float[]{4, 4, 2});
case 3:
return 3 + Random.chances(new float[]{4, 4, 2});
default:
return 1 + Random.chances(new float[]{4, 2, 1});
}
}
@Override
protected Painter painter() {
return new SewerPainter()
.setWater(feeling == Feeling.WATER ? 0.85f : 0.30f, 5)
.setGrass(feeling == Feeling.GRASS ? 0.80f : 0.20f, 4);
}
@Override
public String tilesTex() {
return Assets.TILES_SEWERS;
}
@Override
public String waterTex() {
return Assets.WATER_SEWERS;
}
@Override
protected void setPar() {
Dungeon.pars[Dungeon.depth] = (450 + (Dungeon.depth * 50) + (secretDoors * 50)) * Math.round(0.5f + 0.5f * Dungeon.mapSize);
}
@Override
protected void createItems() {
if (Dungeon.depth == 1) {
addItemToSpawn(new Moonberry());
addItemToSpawn(new Blueberry());
addItemToSpawn(new Cloudberry());
addItemToSpawn(new Blackberry());
}
Ghost.Quest.spawn(this);
spawnGnoll(this);
if (Dungeon.hero.heroClass == HeroClass.ROGUE && Random.Int(3) == 0) {
addItemToSpawn(new Bomb());
}
super.createItems();
}
public static void spawnGnoll(SewerLevel level) {
if (Dungeon.depth == 4) {
GnollArcher gnoll = new Ghost.GnollArcher();
do {
gnoll.pos = level.randomRespawnCell();
} while (gnoll.pos == -1);
level.mobs.add(gnoll);
}
}
@Override
public void addVisuals(Scene scene) {
super.addVisuals(scene);
addVisuals(this, scene);
}
public static void addVisuals(Level level, Scene scene) {
for (int i = 0; i < Dungeon.level.getLength(); i++) {
if (level.map[i] == Terrain.WALL_DECO) {
scene.add(new Sink(i));
}
}
}
@Override
public String tileName(int tile) {
switch (tile) {
case Terrain.WATER:
return Messages.get(SewerLevel.class, "water_name");
default:
return super.tileName(tile);
}
}
@Override
public String tileDesc(int tile) {
switch (tile) {
case Terrain.EMPTY_DECO:
return Messages.get(SewerLevel.class, "empty_deco_desc");
case Terrain.BOOKSHELF:
return Messages.get(SewerLevel.class, "bookshelf_desc");
default:
return super.tileDesc(tile);
}
}
private static class Sink extends Emitter {
private int pos;
private float rippleDelay = 0;
private static final Emitter.Factory factory = new Factory() {
@Override
public void emit(Emitter emitter, int index, float x, float y) {
WaterParticle p = (WaterParticle) emitter
.recycle(WaterParticle.class);
p.reset(x, y);
}
};
public Sink(int pos) {
super();
this.pos = pos;
PointF p = DungeonTilemap.tileCenterToWorld(pos);
pos(p.x - 2, p.y + 1, 4, 0);
pour(factory, 0.1f);
}
@Override
public void update() {
if (visible = Dungeon.visible[pos]) {
super.update();
if ((rippleDelay -= Game.elapsed) <= 0) {
GameScene.ripple(pos + Dungeon.level.getWidth()).y -= DungeonTilemap.SIZE / 2;
rippleDelay = Random.Float(0.4f, 0.6f);
}
}
}
}
public static final class WaterParticle extends PixelParticle {
public WaterParticle() {
super();
acc.y = 50;
am = 0.5f;
color(ColorMath.random(0xb6ccc2, 0x3b6653));
size(2);
}
public void reset(float x, float y) {
revive();
this.x = x;
this.y = y;
speed.set(Random.Float(-2, +2), 0);
left = lifespan = 0.5f;
}
}
}
|
gpl-3.0
|
edabg/fpgate
|
FPGateSrv/src/main/java/TremolZFP/Bluetooth_PasswordRes.java
|
537
|
package TremolZFP;
public class Bluetooth_PasswordRes {
/**
*(Length) Up to 3 symbols for the BT password length
*/
public Double PassLength;
public Double getPassLength() {
return PassLength;
}
protected void setPassLength(Double value) {
PassLength = value;
}
/**
*Up to 100 symbols for the BT password
*/
public String Password;
public String getPassword() {
return Password;
}
protected void setPassword(String value) {
Password = value;
}
}
|
gpl-3.0
|
Niky4000/UsefulUtils
|
projects/tutorials-master/tutorials-master/spring-5-reactive/src/main/java/com/baeldung/functional/FormHandler.java
|
1706
|
package com.baeldung.functional;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.util.MultiValueMap;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;
import java.util.List;
import java.util.concurrent.atomic.AtomicLong;
import static org.springframework.web.reactive.function.BodyExtractors.toDataBuffers;
import static org.springframework.web.reactive.function.BodyExtractors.toFormData;
import static org.springframework.web.reactive.function.BodyInserters.fromObject;
import static org.springframework.web.reactive.function.server.ServerResponse.ok;
public class FormHandler {
Mono<ServerResponse> handleLogin(ServerRequest request) {
return request.body(toFormData())
.map(MultiValueMap::toSingleValueMap)
.filter(formData -> "baeldung".equals(formData.get("user")))
.filter(formData -> "you_know_what_to_do".equals(formData.get("token")))
.flatMap(formData -> ok().body(Mono.just("welcome back!"), String.class))
.switchIfEmpty(ServerResponse.badRequest()
.build());
}
Mono<ServerResponse> handleUpload(ServerRequest request) {
return request.body(toDataBuffers())
.collectList()
.flatMap(dataBuffers -> ok().body(fromObject(extractData(dataBuffers).toString())));
}
private AtomicLong extractData(List<DataBuffer> dataBuffers) {
AtomicLong atomicLong = new AtomicLong(0);
dataBuffers.forEach(d -> atomicLong.addAndGet(d.readableByteCount()));
return atomicLong;
}
}
|
gpl-3.0
|
Keitaro-Bzh/MyERP
|
main/class/User.php
|
1951
|
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . '/main/class/Personne.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/main/class/classFonctions/fnClasse_User.php';
class User extends Personne
{
protected $idUser;
protected $username;
protected $password;
protected $acces;
protected $template;
protected $onArchive;
protected $Avatar;
/* Fonctions spécifiques à la classe en cours */
public function get_AvatarChemin() {
$cheminDefault = 'templates\backend\default\images\avatar.png';
// On ne charge l'information que si l'objet Avatar est défini et s'il s'agit bien d'un objet (cas d'un enregistrement ou la valeur sera un string)
if(isset($this->Avatar) && is_object($this->Avatar)) {
$cheminDefault = $this->Avatar->get_Valeur('chemin').$this->Avatar->get_Valeur('nomFichier');
}
return $cheminDefault;
}
/* Fonctions issues de la class MyERP surchargées */
public function set_ObjetToBase() {
// Lors de l'enregistrement, on va vérifier qu'il existe des valeurs par défaut pour le template
if (!$this->template) {
$this->template = 'backend/default';
}
// Il faut aussi gérer le cryptage du mot de passe
if (isset($_POST['formulaire'])) {
// On est dans le cas d'une page de configuration de l'utilisateur avec le champ password
if (isset($_POST['password'])) {
$chiffrePassword = false;
if (strcmp($this->password,$_POST['password']) !== 0) {
$chiffrePassword = true;
}
$this->set_FormPostToObjet();
if ($chiffrePassword) {
$this->password = md5($this->password);
}
}
// On provient de la page profil, donc on procède à une exception pour le formulaire
else {
$pwd = $this->password;
$this->set_FormPostToObjet();
$this->password = $pwd;
}
// On va vérifier qu'il y a eu une modification du mot de passe
unset($_POST);
}
parent::set_ObjetToBase();
}
}
|
gpl-3.0
|
mkuron/espresso
|
testsuite/python/tests_common.py
|
18274
|
# Copyright (C) 2010-2018 The ESPResSo project
#
# This file is part of ESPResSo.
#
# ESPResSo 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.
#
# ESPResSo is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import numpy as np
def params_match(inParams, outParams):
"""Check if the parameters set and gotten back match.
Only check keys present in inParams.
"""
for k in list(inParams.keys()):
if k not in outParams:
print(k, "missing from returned parameters")
return False
if isinstance(inParams[k], float):
if abs(outParams[k] - inParams[k]) >= 1E-14:
print("Mismatch in parameter ", k, inParams[k], outParams[k], type(
inParams[k]), type(outParams[k]), abs(inParams[k] - outParams[k]))
return False
else:
if outParams[k] != inParams[k]:
print("Mismatch in parameter ", k, inParams[
k], outParams[k], type(inParams[k]), type(outParams[k]))
return False
return True
def generate_test_for_class(_system, _interClass, _params):
"""Generates test cases for checking interaction parameters set and gotten back
from Es actually match. Only keys which are present in _params are checked
1st: Interaction parameters as dictionary, i.e., {"k": 1.,"r_0": 0}
2nd: Name of the interaction property to set (i.e. "P3M")
"""
params = _params
interClass = _interClass
system = _system
def func(self):
# This code is run at the execution of the generated function.
# It will use the state of the variables in the outer function,
# which was there, when the outer function was called
# set Parameter
Inter = interClass(**params)
Inter.validate_params()
system.actors.add(Inter)
# Read them out again
outParams = Inter.get_params()
del system.actors[0]
self.assertTrue(
params_match(params, outParams),
"Mismatch of parameters.\nParameters set " +
params.__str__() +
" vs. output parameters " +
outParams.__str__())
return func
def lj_force_vector(v_d, d, lj_params):
"""Returns lj force for distance d and distance vector v_d based on the given lj_params.
Supports epsilon and cutoff."""
if d >= lj_params["cutoff"]:
return np.zeros(3)
return 4. * lj_params["epsilon"] * v_d * (-12.0 * d**-14 + 6.0 * d**-8)
def verify_lj_forces(system, tolerance, ids_to_skip=[]):
"""Goes over all pairs of particles in system and compares the forces on them
to what would be expected based on the systems LJ parameters.
Particle ids listed in ids_to_skip are not checked
Do not run this with a thermostat enabled."""
# Initialize dict with expected forces
f_expected = {}
for id in system.part[:].id:
f_expected[id] = np.zeros(3)
# Cache some stuff to speed up pair loop
dist_vec = system.distance_vec
norm = np.linalg.norm
non_bonded_inter = system.non_bonded_inter
# lj parameters
lj_params = {}
all_types = np.unique(system.part[:].type)
for i in all_types:
for j in all_types:
lj_params[i, j] = non_bonded_inter[
int(i), int(j)].lennard_jones.get_params()
# Go over all pairs of particles
for pair in system.part.pairs():
p0 = pair[0]
p1 = pair[1]
if p0.id in ids_to_skip or p1.id in ids_to_skip:
continue
# Distance and distance vec
v_d = dist_vec(p0, p1)
d = norm(v_d)
# calc and add expected lj force
f = lj_force_vector(v_d, d, lj_params[p0.type, p1.type])
f_expected[p0.id] += f
f_expected[p1.id] -= f
# Check actual forces against expected
for id in system.part[:].id:
if id in ids_to_skip:
continue
if np.linalg.norm(system.part[id].f - f_expected[id]) >= tolerance:
raise Exception("LJ force verification failed on particle " +
str(id) +
". Got " +
str(system.part[id].f) +
", expected " +
str(f_expected[id]))
def abspath(path):
return os.path.join(os.path.dirname(os.path.abspath(__file__)), path)
def transform_pos_from_cartesian_to_polar_coordinates(pos):
"""Transform the given cartesian coordinates to polar coordinates.
Parameters
----------
pos : array_like :obj:`float`
``x``, ``y``, and ``z``-component of the cartesian position.
Returns
-------
array_like
The given position in polar coordinates.
"""
return np.array([np.sqrt(pos[0]**2.0 + pos[1]**2.0), np.arctan2(pos[1], pos[0]), pos[2]])
def transform_vel_from_cartesian_to_polar_coordinates(pos, vel):
"""Transform the given cartesian velocities to polar velocities.
Parameters
----------
pos : array_like :obj:`float`
``x``, ``y``, and ``z``-component of the cartesian position.
vel : array_like :obj:`float`
``x``, ``y``, and ``z``-component of the cartesian velocity.
"""
return np.array([
(pos[0] * vel[0] + pos[1] * vel[1]) / np.sqrt(pos[0]**2 + pos[1]**2),
(pos[0] * vel[1] - pos[1] * vel[0]) / (pos[0]**2 + pos[1]**2), vel[2]])
def rotation_matrix(axis, theta):
"""
Return the rotation matrix associated with counterclockwise rotation about
the given axis by theta radians.
Parameters
----------
axis : array_like :obj:`float`
Axis to rotate around.
theta : :obj:`float`
Rotation angle.
"""
axis = np.asarray(axis)
axis = axis / np.sqrt(np.dot(axis, axis))
a = np.cos(theta / 2.0)
b, c, d = -axis * np.sin(theta / 2.0)
aa, bb, cc, dd = a * a, b * b, c * c, d * d
bc, ad, ac, ab, bd, cd = b * c, a * d, a * c, a * b, b * d, c * d
return np.array([[aa + bb - cc - dd, 2 * (bc + ad), 2 * (bd - ac)],
[2 * (bc - ad), aa + cc - bb - dd, 2 * (cd + ab)],
[2 * (bd + ac), 2 * (cd - ab), aa + dd - bb - cc]])
def rotation_matrix_quat(system, part):
"""
Return the rotation matrix associated with quaternion.
Parameters
----------
part : :obj:`int`
Particle index.
"""
A = np.zeros((3, 3))
quat = system.part[part].quat
qq = np.power(quat, 2)
A[0, 0] = qq[0] + qq[1] - qq[2] - qq[3]
A[1, 1] = qq[0] - qq[1] + qq[2] - qq[3]
A[2, 2] = qq[0] - qq[1] - qq[2] + qq[3]
A[0, 1] = 2 * (quat[1] * quat[2] + quat[0] * quat[3])
A[0, 2] = 2 * (quat[1] * quat[3] - quat[0] * quat[2])
A[1, 0] = 2 * (quat[1] * quat[2] - quat[0] * quat[3])
A[1, 2] = 2 * (quat[2] * quat[3] + quat[0] * quat[1])
A[2, 0] = 2 * (quat[1] * quat[3] + quat[0] * quat[2])
A[2, 1] = 2 * (quat[2] * quat[3] - quat[0] * quat[1])
return A
def get_cylindrical_bin_volume(
n_r_bins,
n_phi_bins,
n_z_bins,
min_r,
max_r,
min_phi,
max_phi,
min_z,
max_z):
"""
Return the bin volumes for a cylindrical histogram.
Parameters
----------
n_r_bins : :obj:`float`
Number of bins in ``r`` direction.
n_phi_bins : :obj:`float`
Number of bins in ``phi`` direction.
n_z_bins : :obj:`float`
Number of bins in ``z`` direction.
min_r : :obj:`float`
Minimum considered value in ``r`` direction.
max_r : :obj:`float`
Maximum considered value in ``r`` direction.
min_phi : :obj:`float`
Minimum considered value in ``phi`` direction.
max_phi : :obj:`float`
Maximum considered value in ``phi`` direction.
min_z : :obj:`float`
Minimum considered value in ``z`` direction.
max_z : :obj:`float`
Maximum considered value in ``z`` direction.
Returns
-------
array_like
Bin volumes.
"""
bin_volume = np.zeros(n_r_bins)
r_bin_size = (max_r - min_r) / n_r_bins
phi_bin_size = (max_phi - min_phi) / n_phi_bins
z_bin_size = (max_z - min_z) / n_z_bins
for i in range(n_r_bins):
bin_volume[i] = np.pi * ((min_r + r_bin_size * (i + 1))**2.0 -
(min_r + r_bin_size * i)**2.0) * \
phi_bin_size / (2.0 * np.pi) * z_bin_size
return bin_volume
#
# Analytical Expressions for interactions
#
# Harmonic bond
def harmonic_potential(scalar_r, k, r_0, r_cut):
return 0.5 * k * (scalar_r - r_0)**2
def harmonic_force(scalar_r, k, r_0, r_cut):
return -k * (scalar_r - r_0)
# FENE bond
def fene_potential(scalar_r, k, d_r_max, r_0):
return -0.5 * k * d_r_max**2 * np.log(1 - ((scalar_r - r_0) / d_r_max)**2)
def fene_force(scalar_r, k, d_r_max, r_0):
return k * (scalar_r - r_0) * d_r_max**2 / ((scalar_r - r_0)**2 - d_r_max**2)
def fene_force2(bond_vector, k, d_r_max, r_0):
r = np.linalg.norm(bond_vector)
return k * (r - r_0) / (r * (1 - ((r - r_0) / d_r_max)**2)) * np.array(bond_vector)
# Coulomb bond
def coulomb_potential(scalar_r, k, q1, q2):
return k * q1 * q2 / scalar_r
def coulomb_force(scalar_r, k, q1, q2):
return k * q1 * q2 / scalar_r**2
# QUARTIC bond
def quartic_force(k0, k1, r, r_cut, scalar_r):
if scalar_r > r_cut:
return 0.0
return - k0 * (scalar_r - r) - k1 * (scalar_r - r)**3
def quartic_potential(k0, k1, r, r_cut, scalar_r):
if scalar_r > r_cut:
return 0.0
return 0.5 * k0 * (scalar_r - r)**2 + 0.25 * k1 * (scalar_r - r)**4
# Generic Lennard-Jones
def lj_generic_potential(r, eps, sig, cutoff, offset=0., shift=0., e1=12.,
e2=6., b1=4., b2=4., delta=0., lam=1.):
r = np.array(r)
V = np.zeros_like(r)
cutoffMask = (r <= cutoff + offset)
# LJGEN_SOFTCORE transformations
rroff = np.sqrt(
np.power(r[cutoffMask] - offset, 2) + (1 - lam) * delta * sig**2)
V[cutoffMask] = eps * lam * \
(b1 * np.power(sig / rroff, e1) -
b2 * np.power(sig / rroff, e2) + shift)
return V
def lj_generic_force(espressomd, r, eps, sig, cutoff, offset=0., e1=12, e2=6,
b1=4., b2=4., delta=0., lam=1., generic=True):
f = 1.
if (r >= offset + cutoff):
f = 0.
else:
h = (r - offset)**2 + delta * (1. - lam) * sig**2
f = (r - offset) * eps * lam * (
b1 * e1 * np.power(sig / np.sqrt(h), e1) - b2 * e2 * np.power(sig / np.sqrt(h), e2)) / h
if (not espressomd.has_features("LJGEN_SOFTCORE")) and generic:
f *= np.sign(r - offset)
return f
# Lennard-Jones
def lj_potential(r, eps, sig, cutoff, shift, offset=0.):
V = lj_generic_potential(
r, eps, sig, cutoff, offset=offset, shift=shift * 4.)
return V
def lj_force(espressomd, r, eps, sig, cutoff, offset=0.):
f = lj_generic_force(
espressomd, r, eps, sig, cutoff, offset=offset, generic=False)
return f
# Lennard-Jones Cosine
def lj_cos_potential(r, eps, sig, cutoff, offset):
V = 0.
r_min = offset + np.power(2., 1. / 6.) * sig
r_cut = cutoff + offset
if (r < r_min):
V = lj_potential(r, eps=eps, sig=sig,
cutoff=cutoff, offset=offset, shift=0.)
elif (r < r_cut):
alpha = np.pi / \
(np.power(r_cut - offset, 2) - np.power(r_min - offset, 2))
beta = np.pi - np.power(r_min - offset, 2) * alpha
V = 0.5 * eps * \
(np.cos(alpha * np.power(r - offset, 2) + beta) - 1.)
return V
def lj_cos_force(espressomd, r, eps, sig, cutoff, offset):
f = 0.
r_min = offset + np.power(2., 1. / 6.) * sig
r_cut = cutoff + offset
if (r < r_min):
f = lj_force(espressomd, r, eps=eps, sig=sig,
cutoff=cutoff, offset=offset)
elif (r < r_cut):
alpha = np.pi / \
(np.power(r_cut - offset, 2) - np.power(r_min - offset, 2))
beta = np.pi - np.power(r_min - offset, 2) * alpha
f = (r - offset) * alpha * eps * \
np.sin(alpha * np.power(r - offset, 2) + beta)
return f
# Lennard-Jones Cosine^2
def lj_cos2_potential(r, eps, sig, offset, width):
V = 0.
r_min = offset + np.power(2., 1. / 6.) * sig
r_cut = r_min + width
if (r < r_min):
V = lj_potential(r, eps=eps, sig=sig,
offset=offset, cutoff=r_cut, shift=0.)
elif (r < r_cut):
V = -eps * np.power(np.cos(np.pi /
(2. * width) * (r - r_min)), 2)
return V
def lj_cos2_force(espressomd, r, eps, sig, offset, width):
f = 0.
r_min = offset + np.power(2., 1. / 6.) * sig
r_cut = r_min + width
if (r < r_min):
f = lj_force(espressomd, r, eps=eps,
sig=sig, cutoff=r_cut, offset=offset)
elif (r < r_cut):
f = - np.pi * eps * \
np.sin(np.pi * (r - r_min) / width) / (2. * width)
return f
# Smooth-Step
def smooth_step_potential(r, eps, sig, cutoff, d, n, k0):
V = 0.
if (r < cutoff):
V = np.power(d / r, n) + eps / \
(1 + np.exp(2 * k0 * (r - sig)))
return V
def smooth_step_force(r, eps, sig, cutoff, d, n, k0):
f = 0.
if (r < cutoff):
f = n * d / r**2 * np.power(d / r, n - 1) + 2 * k0 * eps * np.exp(
2 * k0 * (r - sig)) / (1 + np.exp(2 * k0 * (r - sig))**2)
return f
# BMHTF
def bmhtf_potential(r, a, b, c, d, sig, cutoff):
V = 0.
if (r == cutoff):
V = a * np.exp(b * (sig - r)) - c * np.power(
r, -6) - d * np.power(r, -8)
if (r < cutoff):
V = a * np.exp(b * (sig - r)) - c * np.power(
r, -6) - d * np.power(r, -8)
V -= bmhtf_potential(cutoff, a, b, c, d, sig, cutoff)
return V
def bmhtf_force(r, a, b, c, d, sig, cutoff):
f = 0.
if (r < cutoff):
f = a * b * np.exp(b * (sig - r)) - 6 * c * np.power(
r, -7) - 8 * d * np.power(r, -9)
return f
# Morse
def morse_potential(r, eps, alpha, cutoff, rmin=0):
V = 0.
if (r < cutoff):
V = eps * (np.exp(-2. * alpha * (r - rmin)) -
2 * np.exp(-alpha * (r - rmin)))
V -= eps * (np.exp(-2. * alpha * (cutoff - rmin)
) - 2 * np.exp(-alpha * (cutoff - rmin)))
return V
def morse_force(r, eps, alpha, cutoff, rmin=0):
f = 0.
if (r < cutoff):
f = 2. * np.exp((rmin - r) * alpha) * \
(np.exp((rmin - r) * alpha) - 1) * alpha * eps
return f
# Buckingham
def buckingham_potential(r, a, b, c, d, cutoff, discont, shift):
V = 0.
if (r < discont):
m = - buckingham_force(
discont, a, b, c, d, cutoff, discont, shift)
c = buckingham_potential(
discont, a, b, c, d, cutoff, discont, shift) - m * discont
V = m * r + c
if (r >= discont) and (r < cutoff):
V = a * np.exp(- b * r) - c * np.power(
r, -6) - d * np.power(r, -4) + shift
return V
def buckingham_force(r, a, b, c, d, cutoff, discont, shift):
f = 0.
if (r < discont):
f = buckingham_force(
discont, a, b, c, d, cutoff, discont, shift)
if (r >= discont) and (r < cutoff):
f = a * b * np.exp(- b * r) - 6 * c * np.power(
r, -7) - 4 * d * np.power(r, -5)
return f
# Soft-sphere
def soft_sphere_potential(r, a, n, cutoff, offset=0):
V = 0.
if (r < offset + cutoff):
V = a * np.power(r - offset, -n)
return V
def soft_sphere_force(r, a, n, cutoff, offset=0):
f = 0.
if ((r > offset) and (r < offset + cutoff)):
f = n * a * np.power(r - offset, -(n + 1))
return f
# Hertzian
def hertzian_potential(r, eps, sig):
V = 0.
if (r < sig):
V = eps * np.power(1 - r / sig, 5. / 2.)
return V
def hertzian_force(r, eps, sig):
f = 0.
if (r < sig):
f = 5. / 2. * eps / sig * np.power(1 - r / sig, 3. / 2.)
return f
# Gaussian
def gaussian_potential(r, eps, sig, cutoff):
V = 0.
if (r < cutoff):
V = eps * np.exp(-np.power(r / sig, 2) / 2)
return V
def gaussian_force(r, eps, sig, cutoff):
f = 0.
if (r < cutoff):
f = eps * r / sig**2 * np.exp(-np.power(r / sig, 2) / 2)
return f
def gay_berne_potential(r_ij, u_i, u_j, epsilon_0, sigma_0, mu, nu, k_1, k_2):
r_normed = r_ij / np.linalg.norm(r_ij)
r_u_i = np.dot(r_normed, u_i)
r_u_j = np.dot(r_normed, u_j)
u_i_u_j = np.dot(u_i, u_j)
chi = (k_1**2 - 1.) / (k_1**2 + 1.)
chi_d = (k_2**(1. / mu) - 1) / (k_2**(1. / mu) + 1)
sigma = sigma_0 \
/ np.sqrt(
(1 - 0.5 * chi * (
(r_u_i + r_u_j)**2 / (1 + chi * u_i_u_j) +
(r_u_i - r_u_j)**2 / (1 - chi * u_i_u_j))))
epsilon = epsilon_0 *\
(1 - chi**2 * u_i_u_j**2)**(-nu / 2.) *\
(1 - chi_d / 2. * (
(r_u_i + r_u_j)**2 / (1 + chi_d * u_i_u_j) +
(r_u_i - r_u_j)**2 / (1 - chi_d * u_i_u_j)))**mu
rr = np.linalg.norm((np.linalg.norm(r_ij) - sigma + sigma_0) / sigma_0)
return 4. * epsilon * (rr**-12 - rr**-6)
class DynamicDict(dict):
def __getitem__(self, key):
value = super().__getitem__(key)
return eval(value, self) if isinstance(value, str) else value
def single_component_maxwell(x1, x2, kT):
"""Integrate the probability density from x1 to x2 using the trapezoidal rule"""
x = np.linspace(x1, x2, 1000)
return np.trapz(np.exp(-x**2 / (2. * kT)), x) / np.sqrt(2. * np.pi * kT)
def lists_contain_same_elements(list1, list2):
return len(list1) == len(list2) and sorted(list1) == sorted(list2)
|
gpl-3.0
|
Gepardec/Hogarama
|
Hogajama/hogajama-angular-frontend/src/main/ionic/src/app/modules/config-connect-to-device-info/config-connect-to-device-info.page.spec.ts
|
828
|
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ConfigConnectToDeviceInfoPage } from './config-connect-to-device-info.page';
describe('ConfigConnectToDeviceInfoPage', () => {
let component: ConfigConnectToDeviceInfoPage;
let fixture: ComponentFixture<ConfigConnectToDeviceInfoPage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ConfigConnectToDeviceInfoPage ],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ConfigConnectToDeviceInfoPage);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
|
gpl-3.0
|
oeil/feudboard
|
feudboard/src/main/java/org/teknux/feudboard/ws/model/BaseSearch.java
|
2787
|
/*
* Copyright (C) 2016 TekNux.org
*
* This file is part of the feudboard GPL Source Code.
*
* feudboard Source Code 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.
*
* feudboard 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with dropbitz Community Source Code. If not, see <http://www.gnu.org/licenses/>.
*/
package org.teknux.feudboard.ws.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
/**
* Describes shared Search Response properties resource in JIRA.
*
* @author Francois EYL
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public abstract class BaseSearch {
private String expand;
private Integer startAt;
private Integer maxResults;
private Integer total;
public String getExpand() {
return expand;
}
public void setExpand(String expand) {
this.expand = expand;
}
public Integer getStartAt() {
return startAt;
}
public void setStartAt(Integer startAt) {
this.startAt = startAt;
}
public Integer getMaxResults() {
return maxResults;
}
public void setMaxResults(Integer maxResults) {
this.maxResults = maxResults;
}
public Integer getTotal() {
return total;
}
public void setTotal(Integer total) {
this.total = total;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
BaseSearch that = (BaseSearch) o;
if (expand != null ? !expand.equals(that.expand) : that.expand != null)
return false;
if (startAt != null ? !startAt.equals(that.startAt) : that.startAt != null)
return false;
if (maxResults != null ? !maxResults.equals(that.maxResults) : that.maxResults != null)
return false;
return total != null ? total.equals(that.total) : that.total == null;
}
@Override
public int hashCode() {
int result = expand != null ? expand.hashCode() : 0;
result = 31 * result + (startAt != null ? startAt.hashCode() : 0);
result = 31 * result + (maxResults != null ? maxResults.hashCode() : 0);
result = 31 * result + (total != null ? total.hashCode() : 0);
return result;
}
}
|
gpl-3.0
|
Phil-LiDAR2-Geonode/pl2-geonode
|
geonode/api/urls.py
|
893
|
from tastypie.api import Api
from .api import TagResource, TopicCategoryResource, ProfileResource, \
GroupResource, RegionResource, OwnersResource
from .resourcebase_api import LayerResource, MapResource, DocumentResource, \
ResourceBaseResource, FeaturedResourceBaseResource, DownloadCountResource
from django.conf.urls import patterns, url
api = Api(api_name='api')
urlpatterns = patterns(
'geonode.api.views',
url(r'^total_count', 'total_count', name="total_count"),
)
api.register(LayerResource())
api.register(MapResource())
api.register(DocumentResource())
api.register(ProfileResource())
api.register(ResourceBaseResource())
api.register(TagResource())
api.register(RegionResource())
api.register(TopicCategoryResource())
api.register(GroupResource())
api.register(FeaturedResourceBaseResource())
api.register(OwnersResource())
api.register(DownloadCountResource())
|
gpl-3.0
|
webmaster442/McuTools
|
MCUBrowser/TabViewCollection.cs
|
1170
|
/********************************************************************************
* Project : Awesomium.NET (TabbedWPFSample)
* File : TabViewCollection.cs
* Version : 1.7.0.0
* Date : 3/5/2013
* Author : Perikles C. Stephanidis (perikles@awesomium.com)
* Copyright : ©2013 Awesomium Technologies LLC
*
* This code is provided "AS IS" and for demonstration purposes only,
* without warranty of any kind.
*
*-------------------------------------------------------------------------------
*
* Notes :
*
* Collection of TabView elements.
*
*
********************************************************************************/
using System;
using System.Linq;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Collections.ObjectModel;
namespace TabbedWPFSample
{
class TabViewCollection : ObservableCollection<TabView>
{
public void RaiseResetCollection()
{
OnCollectionChanged( new NotifyCollectionChangedEventArgs( NotifyCollectionChangedAction.Reset ) );
}
}
}
|
gpl-3.0
|
Salamek/Shadow-of-Dust
|
neo/sys/win32/win_wndproc.cpp
|
13538
|
/*
===========================================================================
Shadow of Dust GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Shadow of Dust GPL Source Code ("Shadow of Dust Source Code").
Shadow of Dust Source Code 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.
Shadow of Dust 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. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Shadow of Dust Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Shadow of Dust Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Shadow of Dust Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#include "sys/platform.h"
#include "framework/Session.h"
#include "framework/KeyInput.h"
#include "renderer/tr_local.h"
#include "sys/win32/win_local.h"
LONG WINAPI MainWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
static bool s_alttab_disabled;
static void WIN_DisableAltTab( void ) {
if ( s_alttab_disabled || win32.win_allowAltTab.GetBool() ) {
return;
}
if ( !idStr::Icmp( cvarSystem->GetCVarString( "sys_arch" ), "winnt" ) ) {
RegisterHotKey( 0, 0, MOD_ALT, VK_TAB );
} else {
BOOL old;
SystemParametersInfo( SPI_SCREENSAVERRUNNING, 1, &old, 0 );
}
s_alttab_disabled = true;
}
static void WIN_EnableAltTab( void ) {
if ( !s_alttab_disabled || win32.win_allowAltTab.GetBool() ) {
return;
}
if ( !idStr::Icmp( cvarSystem->GetCVarString( "sys_arch" ), "winnt" ) ) {
UnregisterHotKey( 0, 0 );
} else {
BOOL old;
SystemParametersInfo( SPI_SCREENSAVERRUNNING, 0, &old, 0 );
}
s_alttab_disabled = false;
}
void WIN_Sizing(WORD side, RECT *rect)
{
if ( !glConfig.isInitialized || glConfig.vidHeight <= 0 || glConfig.vidWidth <= 0 ) {
return;
}
if ( idKeyInput::IsDown( K_CTRL ) ) {
return;
}
int width = rect->right - rect->left;
int height = rect->bottom - rect->top;
// Adjust width/height for window decoration
RECT decoRect = { 0, 0, 0, 0 };
AdjustWindowRect( &decoRect, WINDOW_STYLE|WS_SYSMENU, FALSE );
int decoWidth = decoRect.right - decoRect.left;
int decoHeight = decoRect.bottom - decoRect.top;
width -= decoWidth;
height -= decoHeight;
// Clamp to a minimum size
int minWidth = 160;
int minHeight = minWidth * SCREEN_HEIGHT / SCREEN_WIDTH;
if ( width < minWidth ) {
width = minWidth;
}
if ( height < minHeight ) {
height = minHeight;
}
// Set the new size
switch ( side ) {
case WMSZ_LEFT:
rect->left = rect->right - width - decoWidth;
rect->bottom = rect->top + ( width * SCREEN_HEIGHT / SCREEN_WIDTH ) + decoHeight;
break;
case WMSZ_RIGHT:
rect->right = rect->left + width + decoWidth;
rect->bottom = rect->top + ( width * SCREEN_HEIGHT / SCREEN_WIDTH ) + decoHeight;
break;
case WMSZ_BOTTOM:
case WMSZ_BOTTOMRIGHT:
rect->bottom = rect->top + height + decoHeight;
rect->right = rect->left + ( height * SCREEN_WIDTH / SCREEN_HEIGHT ) + decoWidth;
break;
case WMSZ_TOP:
case WMSZ_TOPRIGHT:
rect->top = rect->bottom - height - decoHeight;
rect->right = rect->left + ( height * SCREEN_WIDTH / SCREEN_HEIGHT ) + decoWidth;
break;
case WMSZ_BOTTOMLEFT:
rect->bottom = rect->top + height + decoHeight;
rect->left = rect->right - ( height * SCREEN_WIDTH / SCREEN_HEIGHT ) - decoWidth;
break;
case WMSZ_TOPLEFT:
rect->top = rect->bottom - height - decoHeight;
rect->left = rect->right - ( height * SCREEN_WIDTH / SCREEN_HEIGHT ) - decoWidth;
break;
}
}
//==========================================================================
// Keep this in sync with the one in win_input.cpp
// This one is used in the menu, the other one is used in game
static byte s_scantokey[128] =
{
// 0 1 2 3 4 5 6 7
// 8 9 A B C D E F
0, 27, '1', '2', '3', '4', '5', '6',
'7', '8', '9', '0', '-', '=', K_BACKSPACE, 9, // 0
'q', 'w', 'e', 'r', 't', 'y', 'u', 'i',
'o', 'p', '[', ']', K_ENTER,K_CTRL, 'a', 's', // 1
'd', 'f', 'g', 'h', 'j', 'k', 'l', ';',
'\'', '`', K_SHIFT, '\\', 'z', 'x', 'c', 'v', // 2
'b', 'n', 'm', ',', '.', '/', K_SHIFT, K_KP_STAR,
K_ALT, ' ', K_CAPSLOCK,K_F1, K_F2, K_F3, K_F4, K_F5, // 3
K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE, K_SCROLL, K_HOME,
K_UPARROW, K_PGUP, K_KP_MINUS,K_LEFTARROW,K_KP_5, K_RIGHTARROW,K_KP_PLUS,K_END, // 4
K_DOWNARROW,K_PGDN, K_INS, K_DEL, 0, 0, 0, K_F11,
K_F12, 0, 0, K_LWIN, K_RWIN, K_MENU, 0, 0, // 5
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, // 6
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0 // 7
};
static byte s_scantoshift[128] =
{
// 0 1 2 3 4 5 6 7
// 8 9 A B C D E F
0, 27, '!', '@', '#', '$', '%', '^',
'&', '*', '(', ')', '_', '+', K_BACKSPACE, 9, // 0
'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I',
'O', 'P', '{', '}', K_ENTER,K_CTRL, 'A', 'S', // 1
'D', 'F', 'G', 'H', 'J', 'K', 'L', ':',
'|' , '~', K_SHIFT, '\\', 'Z', 'X', 'C', 'V', // 2
'B', 'N', 'M', '<', '>', '?', K_SHIFT, K_KP_STAR,
K_ALT, ' ', K_CAPSLOCK,K_F1, K_F2, K_F3, K_F4, K_F5, // 3
K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE, K_SCROLL, K_HOME,
K_UPARROW, K_PGUP, K_KP_MINUS,K_LEFTARROW,K_KP_5, K_RIGHTARROW,K_KP_PLUS,K_END, // 4
K_DOWNARROW,K_PGDN, K_INS, K_DEL, 0, 0, 0, K_F11,
K_F12, 0, 0, K_LWIN, K_RWIN, K_MENU, 0, 0, // 5
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, // 6
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0 // 7
};
/*
=======
MapKey
Map from windows to Doom keynums
=======
*/
int MapKey (int key)
{
int result;
int modified;
bool is_extended;
modified = ( key >> 16 ) & 255;
if ( modified > 127 )
return 0;
if ( key & ( 1 << 24 ) ) {
is_extended = true;
}
else {
is_extended = false;
}
//Check for certain extended character codes.
//The specific case we are testing is the numpad / is not being translated
//properly for localized builds.
if(is_extended) {
switch(modified) {
case 0x35: //Numpad /
return K_KP_SLASH;
}
}
const unsigned char *scanToKey = Sys_GetScanTable();
result = scanToKey[modified];
// common->Printf( "Key: 0x%08x Modified: 0x%02x Extended: %s Result: 0x%02x\n", key, modified, (is_extended?"Y":"N"), result);
if ( is_extended ) {
switch ( result )
{
case K_PAUSE:
return K_KP_NUMLOCK;
case 0x0D:
return K_KP_ENTER;
case 0x2F:
return K_KP_SLASH;
case 0xAF:
return K_KP_PLUS;
case K_KP_STAR:
return K_PRINT_SCR;
case K_ALT:
return K_RIGHT_ALT;
}
}
else {
switch ( result )
{
case K_HOME:
return K_KP_HOME;
case K_UPARROW:
return K_KP_UPARROW;
case K_PGUP:
return K_KP_PGUP;
case K_LEFTARROW:
return K_KP_LEFTARROW;
case K_RIGHTARROW:
return K_KP_RIGHTARROW;
case K_END:
return K_KP_END;
case K_DOWNARROW:
return K_KP_DOWNARROW;
case K_PGDN:
return K_KP_PGDN;
case K_INS:
return K_KP_INS;
case K_DEL:
return K_KP_DEL;
}
}
return result;
}
/*
====================
MainWndProc
main window procedure
====================
*/
LONG WINAPI MainWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) {
int key;
switch( uMsg ) {
case WM_WINDOWPOSCHANGED:
if (glConfig.isInitialized) {
RECT rect;
if (::GetClientRect(win32.hWnd, &rect)) {
glConfig.vidWidth = rect.right - rect.left;
glConfig.vidHeight = rect.bottom - rect.top;
}
}
break;
case WM_CREATE:
win32.hWnd = hWnd;
if ( win32.cdsFullscreen ) {
WIN_DisableAltTab();
} else {
WIN_EnableAltTab();
}
break;
case WM_DESTROY:
// let sound and input know about this?
win32.hWnd = NULL;
if ( win32.cdsFullscreen ) {
WIN_EnableAltTab();
}
break;
case WM_CLOSE:
cmdSystem->BufferCommandText( CMD_EXEC_APPEND, "quit" );
break;
case WM_ACTIVATE:
// if we got here because of an alt-tab or maximize,
// we should activate immediately. If we are here because
// the mouse was clicked on a title bar or drag control,
// don't activate until the mouse button is released
{
int fActive, fMinimized;
fActive = LOWORD(wParam);
fMinimized = (BOOL) HIWORD(wParam);
win32.activeApp = (fActive != WA_INACTIVE);
if ( win32.activeApp ) {
idKeyInput::ClearStates();
com_editorActive = false;
Sys_GrabMouseCursor( true );
}
if ( fActive == WA_INACTIVE ) {
win32.movingWindow = false;
}
// start playing the game sound world
session->SetPlayingSoundWorld();
// we do not actually grab or release the mouse here,
// that will be done next time through the main loop
}
break;
case WM_MOVE: {
int xPos, yPos;
RECT r;
int style;
if (!win32.cdsFullscreen )
{
xPos = (short) LOWORD(lParam); // horizontal position
yPos = (short) HIWORD(lParam); // vertical position
r.left = 0;
r.top = 0;
r.right = 1;
r.bottom = 1;
style = GetWindowLong( hWnd, GWL_STYLE );
AdjustWindowRect( &r, style, FALSE );
win32.win_xpos.SetInteger( xPos + r.left );
win32.win_ypos.SetInteger( yPos + r.top );
win32.win_xpos.ClearModified();
win32.win_ypos.ClearModified();
}
break;
}
case WM_TIMER: {
if ( win32.win_timerUpdate.GetBool() ) {
common->Frame();
}
break;
}
case WM_SYSCOMMAND:
if ( wParam == SC_SCREENSAVE || wParam == SC_KEYMENU ) {
return 0;
}
break;
case WM_SYSKEYDOWN:
if ( wParam == 13 ) { // alt-enter toggles full-screen
cvarSystem->SetCVarBool( "r_fullscreen", !renderSystem->IsFullScreen() );
cmdSystem->BufferCommandText( CMD_EXEC_APPEND, "vid_restart\n" );
return 0;
}
// fall through for other keys
case WM_KEYDOWN:
key = MapKey( lParam );
if ( key == K_CTRL || key == K_ALT || key == K_RIGHT_ALT ) {
// let direct-input handle this because windows sends Alt-Gr
// as two events (ctrl then alt)
break;
}
Sys_QueEvent( win32.sysMsgTime, SE_KEY, key, true, 0, NULL );
break;
case WM_SYSKEYUP:
case WM_KEYUP:
key = MapKey( lParam );
if ( key == K_PRINT_SCR ) {
// don't queue printscreen keys. Since windows doesn't send us key
// down events for this, we handle queueing them with DirectInput
break;
} else if ( key == K_CTRL || key == K_ALT || key == K_RIGHT_ALT ) {
// let direct-input handle this because windows sends Alt-Gr
// as two events (ctrl then alt)
break;
}
Sys_QueEvent( win32.sysMsgTime, SE_KEY, key, false, 0, NULL );
break;
case WM_CHAR:
Sys_QueEvent( win32.sysMsgTime, SE_CHAR, wParam, 0, 0, NULL );
break;
case WM_NCLBUTTONDOWN:
// win32.movingWindow = true;
break;
case WM_ENTERSIZEMOVE:
win32.movingWindow = true;
break;
case WM_EXITSIZEMOVE:
win32.movingWindow = false;
break;
case WM_SIZING:
WIN_Sizing(wParam, (RECT *)lParam);
break;
case WM_RBUTTONDOWN:
case WM_RBUTTONUP:
case WM_MBUTTONDOWN:
case WM_MBUTTONUP:
case WM_MOUSEMOVE: {
break;
}
case WM_MOUSEWHEEL: {
int delta = GET_WHEEL_DELTA_WPARAM( wParam ) / WHEEL_DELTA;
int key = delta < 0 ? K_MWHEELDOWN : K_MWHEELUP;
delta = abs( delta );
while( delta-- > 0 ) {
Sys_QueEvent( win32.sysMsgTime, SE_KEY, key, true, 0, NULL );
Sys_QueEvent( win32.sysMsgTime, SE_KEY, key, false, 0, NULL );
}
break;
}
}
return DefWindowProc( hWnd, uMsg, wParam, lParam );
}
|
gpl-3.0
|
mbeyeler/opencv-python-blueprints
|
chapter1/filters.py
|
7008
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" A module containing a number of interesting image filter effects,
such as:
* Black-and-white pencil sketch
* Warming/cooling filters
* Cartoonizer
"""
import numpy as np
import cv2
from scipy.interpolate import UnivariateSpline
__author__ = "Michael Beyeler"
__license__ = "GNU GPL 3.0 or later"
class PencilSketch:
"""Pencil sketch effect
A class that applies a pencil sketch effect to an image.
The processed image is overlayed over a background image for visual
effect.
"""
def __init__(self, (width, height), bg_gray='pencilsketch_bg.jpg'):
"""Initialize parameters
:param (width, height): Image size.
:param bg_gray: Optional background image to improve the illusion
that the pencil sketch was drawn on a canvas.
"""
self.width = width
self.height = height
# try to open background canvas (if it exists)
self.canvas = cv2.imread(bg_gray, cv2.CV_8UC1)
if self.canvas is not None:
self.canvas = cv2.resize(self.canvas, (self.width, self.height))
def render(self, img_rgb):
"""Applies pencil sketch effect to an RGB image
:param img_rgb: RGB image to be processed
:returns: Processed RGB image
"""
img_gray = cv2.cvtColor(img_rgb, cv2.COLOR_RGB2GRAY)
img_blur = cv2.GaussianBlur(img_gray, (21, 21), 0, 0)
img_blend = cv2.divide(img_gray, img_blur, scale=256)
# if available, blend with background canvas
if self.canvas is not None:
img_blend = cv2.multiply(img_blend, self.canvas, scale=1. / 256)
return cv2.cvtColor(img_blend, cv2.COLOR_GRAY2RGB)
class WarmingFilter:
"""Warming filter
A class that applies a warming filter to an image.
The class uses curve filters to manipulate the perceived color
temparature of an image. The warming filter will shift the image's
color spectrum towards red, away from blue.
"""
def __init__(self):
"""Initialize look-up table for curve filter"""
# create look-up tables for increasing and decreasing a channel
self.incr_ch_lut = self._create_LUT_8UC1([0, 64, 128, 192, 256],
[0, 70, 140, 210, 256])
self.decr_ch_lut = self._create_LUT_8UC1([0, 64, 128, 192, 256],
[0, 30, 80, 120, 192])
def render(self, img_rgb):
"""Applies warming filter to an RGB image
:param img_rgb: RGB image to be processed
:returns: Processed RGB image
"""
# warming filter: increase red, decrease blue
c_r, c_g, c_b = cv2.split(img_rgb)
c_r = cv2.LUT(c_r, self.incr_ch_lut).astype(np.uint8)
c_b = cv2.LUT(c_b, self.decr_ch_lut).astype(np.uint8)
img_rgb = cv2.merge((c_r, c_g, c_b))
# increase color saturation
c_h, c_s, c_v = cv2.split(cv2.cvtColor(img_rgb, cv2.COLOR_RGB2HSV))
c_s = cv2.LUT(c_s, self.incr_ch_lut).astype(np.uint8)
return cv2.cvtColor(cv2.merge((c_h, c_s, c_v)), cv2.COLOR_HSV2RGB)
def _create_LUT_8UC1(self, x, y):
"""Creates a look-up table using scipy's spline interpolation"""
spl = UnivariateSpline(x, y)
return spl(xrange(256))
class CoolingFilter:
"""Cooling filter
A class that applies a cooling filter to an image.
The class uses curve filters to manipulate the perceived color
temparature of an image. The warming filter will shift the image's
color spectrum towards blue, away from red.
"""
def __init__(self):
"""Initialize look-up table for curve filter"""
# create look-up tables for increasing and decreasing a channel
self.incr_ch_lut = self._create_LUT_8UC1([0, 64, 128, 192, 256],
[0, 70, 140, 210, 256])
self.decr_ch_lut = self._create_LUT_8UC1([0, 64, 128, 192, 256],
[0, 30, 80, 120, 192])
def render(self, img_rgb):
"""Applies pencil sketch effect to an RGB image
:param img_rgb: RGB image to be processed
:returns: Processed RGB image
"""
# cooling filter: increase blue, decrease red
c_r, c_g, c_b = cv2.split(img_rgb)
c_r = cv2.LUT(c_r, self.decr_ch_lut).astype(np.uint8)
c_b = cv2.LUT(c_b, self.incr_ch_lut).astype(np.uint8)
img_rgb = cv2.merge((c_r, c_g, c_b))
# decrease color saturation
c_h, c_s, c_v = cv2.split(cv2.cvtColor(img_rgb, cv2.COLOR_RGB2HSV))
c_s = cv2.LUT(c_s, self.decr_ch_lut).astype(np.uint8)
return cv2.cvtColor(cv2.merge((c_h, c_s, c_v)), cv2.COLOR_HSV2RGB)
def _create_LUT_8UC1(self, x, y):
"""Creates a look-up table using scipy's spline interpolation"""
spl = UnivariateSpline(x, y)
return spl(xrange(256))
class Cartoonizer:
"""Cartoonizer effect
A class that applies a cartoon effect to an image.
The class uses a bilateral filter and adaptive thresholding to create
a cartoon effect.
"""
def __init__(self):
pass
def render(self, img_rgb):
numDownSamples = 2 # number of downscaling steps
numBilateralFilters = 7 # number of bilateral filtering steps
# -- STEP 1 --
# downsample image using Gaussian pyramid
img_color = img_rgb
for _ in xrange(numDownSamples):
img_color = cv2.pyrDown(img_color)
# repeatedly apply small bilateral filter instead of applying
# one large filter
for _ in xrange(numBilateralFilters):
img_color = cv2.bilateralFilter(img_color, 9, 9, 7)
# upsample image to original size
for _ in xrange(numDownSamples):
img_color = cv2.pyrUp(img_color)
# make sure resulting image has the same dims as original
img_color = cv2.resize(img_color, img_rgb.shape[:2])
# -- STEPS 2 and 3 --
# convert to grayscale and apply median blur
img_gray = cv2.cvtColor(img_rgb, cv2.COLOR_RGB2GRAY)
img_blur = cv2.medianBlur(img_gray, 7)
# -- STEP 4 --
# detect and enhance edges
img_edge = cv2.adaptiveThreshold(img_blur, 255,
cv2.ADAPTIVE_THRESH_MEAN_C,
cv2.THRESH_BINARY, 9, 2)
# -- STEP 5 --
# convert back to color so that it can be bit-ANDed with color image
img_edge = cv2.cvtColor(img_edge, cv2.COLOR_GRAY2RGB)
return cv2.bitwise_and(img_color, img_edge)
|
gpl-3.0
|
shubhamkmr47/Helikar
|
inst/www/js/components/QQPlotModal.js
|
1495
|
/*
copyright 2016 Helikar Lab
Developed by Shubham Kumar, Vinit Ravishankar and Akram Mohammed
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/>
*/
var QQPlotModal = React.createClass({
render: function() {
var options_list = [];
this.props.variables.forEach(function (variable) {
options_list.push(<option value={variable}>{variable}</option>);
});
return (
<Modal {...this.props} title="QQ Plot">
<div className='modal-body'>
<Input type='select' label='Variable - X' ref='first'>
{options_list}
</Input>
<Input type='select' label='Variable - Y' ref='second'>
{options_list}
</Input>
</div>
<div className='modal-footer'>
<Button onClick={this.handleClick}>Submit</Button>
</div>
</Modal>
);
},
handleClick: function() {
this.props.onRequestHide();
this.props.onClick(this, this.refs.first.getValue(), this.refs.second.getValue());
}
});
|
gpl-3.0
|
petebrew/fhaes
|
fhaes/src/main/java/org/fhaes/fhrecorder/util/MetaDataTextField.java
|
2036
|
/**************************************************************************************************
* Fire History Analysis and Exploration System (FHAES), Copyright (C) 2015
*
* Contributors: Alex Beatty, Clayton Bodendein, Kyle Hartmann, Scott Goble, and Peter Brewer
*
* This program is free software: you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by the Free Software Foundation, either version
* 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program.
* If not, see <http://www.gnu.org/licenses/>.
*
*************************************************************************************************/
package org.fhaes.fhrecorder.util;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.JTextField;
/**
* MetaDataTextField Class. This class is a specialized type of text field that will be used to display meta data.
*
* @author beattya
*/
public class MetaDataTextField extends JTextField implements KeyListener, FocusListener {
private static final long serialVersionUID = 1L;
/**
* Constructor for MetaDataTextField.
*/
public MetaDataTextField() {
this.addKeyListener(this);
this.addFocusListener(this);
}
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyChar() == KeyEvent.VK_ENTER)
this.transferFocus();
}
@Override
public void keyReleased(KeyEvent e) {
}
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void focusGained(FocusEvent fe) {
}
@Override
public void focusLost(FocusEvent fe) {
}
}
|
gpl-3.0
|
applifireAlgo/appDemoApps201115
|
surveyportal/src/main/webapp/app/surveyportal/shared/com/survey/viewmodel/contacts/ContactTypeViewModel.js
|
237
|
Ext.define('Surveyportal.surveyportal.shared.com.survey.viewmodel.contacts.ContactTypeViewModel', {
"extend": "Ext.app.ViewModel",
"alias": "viewmodel.ContactTypeViewModel",
"model": "ContactTypeModel",
"data": {}
});
|
gpl-3.0
|
YinYanfei/CadalWorkspace
|
CadalRecFromPK/src/project/cadal/SimUserRecommend.java
|
7625
|
package project.cadal;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
import com.sleepycat.je.Cursor;
import com.sleepycat.je.DatabaseEntry;
import com.sleepycat.je.LockMode;
import com.sleepycat.je.OperationStatus;
public class SimUserRecommend {
private static HashMap<String,wordCollect> userProfile=null;
public static ArrayList<String> getUserList(){
ArrayList<String> userList=new ArrayList<String>();
Cursor cursor = BerkeleyDB.getUserInfoDB().openCursor(null, null);
// DatabaseEntry objects used for reading records
DatabaseEntry foundKey = new DatabaseEntry();
DatabaseEntry foundData = new DatabaseEntry();
try { // always want to make sure the cursor gets closed
while (cursor.getNext(foundKey, foundData,LockMode.DEFAULT) == OperationStatus.SUCCESS) {
String name=new String(foundKey.getData(),"utf-8");
userList.add(name);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
cursor.close();
}
return userList;
}
public static HashMap<String,wordCollect> getUserProfile(){
HashMap<String,wordCollect> userList=new HashMap<String,wordCollect>();
Cursor cursor = BerkeleyDB.getProfileDB().openCursor(null, null);
// DatabaseEntry objects used for reading records
DatabaseEntry foundKey = new DatabaseEntry();
DatabaseEntry foundData = new DatabaseEntry();
try { // always want to make sure the cursor gets closed
while (cursor.getNext(foundKey, foundData,LockMode.DEFAULT) == OperationStatus.SUCCESS) {
String name=new String(foundKey.getData(),"utf-8");
String nn=new String(foundData.getData(),"utf-8");
System.out.println(nn);
String[] profiles=nn.split("#");
wordCollect wc=new wordCollect();
for(int i=0;i<profiles.length;i++){
if(profiles[i].equals("")||!profiles[i].contains("|"))continue;
String[] temp=profiles[i].split("\\|");
System.out.println(profiles[i]);
try{
wc.wordunit.add(new wordUnit(temp[0],Integer.parseInt(temp[1])));
}catch(java.lang.NumberFormatException e){
System.err.println(profiles[i]+"&&&"+temp[1]);
}
}
wc.wordnum=wc.wordunit.size();
userList.put(name, wc);
}
} catch (Exception e) {;
e.printStackTrace();
} finally {
cursor.close();
}
return userList;
}
public static void recommendGroup() throws Exception{
System.out.println("start build recommendGroup~~~");
ArrayList<String> userList=getUserList();
String activeUserList=RecommendTopic.getMostActiveUser();
userProfile=getUserProfile();
int len=userList.size();
for(int i=0;i<len;i++){
String username=userList.get(i);
int recommendnum=0;
if(!username.equals("\\N")&&!username.equals("")&&userProfile.containsKey(username)){
StringBuilder sb=new StringBuilder();
personalRecommendList recommendunit=Recommendation(username);
recommendnum=recommendunit.recommendNum;
int count=0;
for(int k=0;k<recommendnum;k++){
String friendname=recommendunit.similarityList.get(k).user;
double tempf=recommendunit.similarityList.get(k).similarity;
if(tempf>0.8){
sb.append(friendname+":"+BerkeleyDB.getUserInfo(friendname)+":"+recommendunit.similarityList.get(k).similarity+"#");
count++;
}
}
if(count<20){
sb.append(activeUserList);
}
//System.out.println(sb.toString());
try {
BerkeleyDB.putRec("interest",username, sb.toString());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}else{
//BerkeleyDB.getRecommendByInterestDB()
BerkeleyDB.putRec("interest",username, activeUserList);
}
}
System.out.println("finish build recommendGroup~~~");
}
public static personalRecommendList Recommendation(String CurrentUserName) throws NumberFormatException, IOException{
//建立hashMap/////////
userProfileUnit currentUserProfileUnit=new userProfileUnit();
HashMap<String,wordCollect> hashMap=userProfile;
currentUserProfileUnit.username=CurrentUserName;
currentUserProfileUnit.wordunitArray=hashMap.get(CurrentUserName).wordunit;
//遍历hashMap, 产生推荐序列并排序
long mod1=0;
long mod2=0;
long multi=0;
double similarity=0;
int ncurrent=currentUserProfileUnit.wordunitArray.size();
for(int k=0;k<ncurrent&&k<100;k++){
mod2+=currentUserProfileUnit.wordunitArray.get(k).wordCount*currentUserProfileUnit.wordunitArray.get(k).wordCount;
// System.out.println(currentUserProfileUnit.wordunitArray.get(k).wordCount+"::::");
}
// System.out.println("mod2: "+mod2);
int simUserCount=0;
userSimlarityUnit current_user_recommend_list=new userSimlarityUnit();
current_user_recommend_list.username=CurrentUserName;
Iterator iter=hashMap.entrySet().iterator();
while(iter.hasNext()){
Entry entry=(Entry) iter.next();
wordCollect tempwords=(wordCollect)(entry.getValue());
String user=(String)(entry.getKey());
SimUserUnit tempSimUser=new SimUserUnit();
tempSimUser.simusername=user;
mod1=0;
multi=0;
int n1=tempwords.wordnum;
int n2=currentUserProfileUnit.wordunitArray.size();
if(n1<=1)continue;//////////////////////////////////
for(int j=0;j<n1&&j<100;j++){
for(int i=0;i<n2&&i<100;i++){
if(tempwords.wordunit.get(j).wordName.equals(currentUserProfileUnit.wordunitArray.get(i).wordName)){
multi+=tempwords.wordunit.get(j).wordCount*currentUserProfileUnit.wordunitArray.get(i).wordCount;
}
}
mod1+=tempwords.wordunit.get(j).wordCount*tempwords.wordunit.get(j).wordCount;
}
similarity=multi/(Math.sqrt(mod1)*Math.sqrt(mod2));
if(similarity<=0)continue;////////////////////////////////////
tempSimUser.simlarity=similarity;
//System.out.println(mod2+":"+mod1+":"+multi);
current_user_recommend_list.simUserArray.add(tempSimUser);
simUserCount++;
//System.out.println("simUserCount: "+simUserCount);
}
current_user_recommend_list.friendsCount=simUserCount;
// System.out.println("simUserCount: "+simUserCount);
//计算的用户相似度列表进行排序,降序存储返回
Collections.sort(current_user_recommend_list.simUserArray, new Comparator(){
//public int compare(Object o1, Object o2){return (((SimUserUnit)(o1)).simlarity>((SimUserUnit)(o2)).simlarity)?1:-1; }
public int compare(Object o1, Object o2){return ((Double)((SimUserUnit)(o1)).simlarity).compareTo(((SimUserUnit)(o2)).simlarity); }
});
int friendnum=current_user_recommend_list.friendsCount;
personalRecommendList recommendlist=new personalRecommendList();
recommendlist.recommendNum=0;
for(int i=current_user_recommend_list.friendsCount-1;i>current_user_recommend_list.friendsCount-100&&i>0;i--){
similarityUnit simunit=new similarityUnit();
simunit.user=current_user_recommend_list.simUserArray.get(i).simusername;
simunit.similarity=current_user_recommend_list.simUserArray.get(i).simlarity;
recommendlist.similarityList.add(simunit);
recommendlist.recommendNum++;
// System.out.println(recommendlist.recommendNum);/////////////////////////
}
return recommendlist;
}
}
|
gpl-3.0
|
SeqWare/queryengine
|
seqware-queryengine-backend/src/main/java/org/apache/commons/cli/HackedPosixParser.java
|
1992
|
/*
* Copyright (C) 2012 SeqWare
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.apache.commons.cli;
import java.util.ListIterator;
/**
* Workaround for bug with Apache CLI https://issues.apache.org/jira/browse/CLI-185
* This can be removed when CLI 1.3 is released
*
* @author dyuen
* @version $Id: $Id
*/
public class HackedPosixParser extends PosixParser {
/** {@inheritDoc} */
@Override
public void processArgs(Option opt, ListIterator iter)
throws ParseException
{
// loop until an option is found
while (iter.hasNext())
{
String str = (String) iter.next();
// found an Option
if (super.getOptions().hasOption(str))
{
iter.previous();
break;
}
// found a value
else
{
try
{
opt.addValueForProcessing( (str) );
}
catch (RuntimeException exp)
{
iter.previous();
break;
}
}
}
if ((opt.getValues() == null) && !opt.hasOptionalArg())
{
throw new MissingArgumentException("no argument for:"
+ opt.getKey());
}
}
}
|
gpl-3.0
|
frits-scholer/pr
|
pr172/p172_v9.cpp
|
2636
|
#include <iostream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,a) FOR(i,0,a)
#define SP << " " <<
#define ALL(x) x.begin(),x.end()
#define PB push_back
#define S size()
#define MP make_pair
#define X first
#define Y second
#define VC vector
#define VI VC<int>
const int mod = 1e9+7;
void show_event(string s, clock_t& tm) {
tm = clock()-tm;
cerr << "\t" << s << " " << (double) tm/CLOCKS_PER_SEC << " s "<< endl;
}
template <typename I>
I mult(const I a, const I b) {
return ((long long) a*b)%mod;
}
template <typename I>
I add(const I a, const I b) {
return (a+b)%mod;
}
template <typename I>
I sub(const I a, const I b) {
I result = a - b;
if (result < 0) result = mod - (-result%mod);
return result % mod;
}
template <typename I>
I power_mod(I base, unsigned int exp) {
I result = 1;
while (exp > 0) {
if (exp&1) result = mult(result,base);//(result*base)%mod;
base = mult(base,base);//(base*base)%mod;
exp >>=1;
}
return result;
}
template <typename I>
I inverse(I a) {
return power_mod(a, mod-2);
}
int choose(int n, int k) {
if (k > n) return 0;
//calculate numerator
int num = 1;
for (int i=n;i>n-k;i--) num = mult(num,i);
//calculate denominator
int denom = 1;
for (int i=1;i<k+1;i++) denom = mult(denom, i);
return mult(num , inverse(denom));
}
int main() {
int m, T;
cin >> m >> T;
VI digits(T);
REP(i, T) cin >> digits[i];
clock_t tm=clock();
int max_len = *max_element(ALL(digits));
int *cb[max_len];
for(int i = 0; i < max_len; ++i)
cb[i] = new int[min(i,m)+1];
REP(i, max_len) {
cb[i][0]=1;
FOR(j,1,min(i,m)+1) {
cb[i][j] = i==j?1:add(cb[i-1][j-1], cb[i-1][j]);
//cout << i SP j SP cb[i][j] << endl;
}
//cout << endl;
}
VI f(max_len);
f[0]=1;
for (int i = 0; i < 9; ++i) {
VI g{f};
for (int j = 0; j < max_len; ++j) {
//cout << i SP j SP f[j] << endl;;
for (int k = 1; k <= m; ++k) {
if (j+k == max_len) break;
f[j + k] = add(f[j + k], mult(g[j] , cb[j + k][k]));
//cout << i+1 SP j+k SP f[i+1][j+k] << endl;
}
}
}
VI Sol(T);
REP(i, T) {
for (int k = 1; k <= m; ++k) {
if (k <= digits[i]) Sol[i] = add(Sol[i], mult(f[digits[i] - k] , cb[digits[i] - 1][k - 1]));
else break;
}
}
//for each nonzero digit
REP(i,T)
cout << mult(9, Sol[i]) << endl;
show_event("total time", tm);
return 0;
}
|
gpl-3.0
|
SCI2SUGR/KEEL
|
src/keel/Algorithms/PSO_Learning/CPSO/CPSO.java
|
20069
|
/***********************************************************************
This file is part of KEEL-software, the Data Mining tool for regression,
classification, clustering, pattern mining and so on.
Copyright (C) 2004-2010
F. Herrera (herrera@decsai.ugr.es)
L. Sánchez (luciano@uniovi.es)
J. Alcalá-Fdez (jalcala@decsai.ugr.es)
S. García (sglopez@ujaen.es)
A. Fernández (alberto.fernandez@ujaen.es)
J. Luengo (julianlm@decsai.ugr.es)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/
**********************************************************************/
package keel.Algorithms.PSO_Learning.CPSO;
import java.io.IOException;
import java.util.Vector;
import keel.Dataset.Attributes;
import org.core.*;
/**
* <p>Title: Algorithm CPSO</p>
*
* <p>Description: It contains the implementation of the algorithm</p>
*
*
* <p>Company: KEEL </p>
*
* @author Jose A. Saez Munoz
* @version 1.0
*/
public class CPSO {
/**
* Training dataset.
*/
static public myDataset train,
/**
* Validation dataset.
*/
val,
/**
* Test dataset.
*/
test;
String outputTr, outputTst, outputRules;
//parameters
private long semilla;
private int NumParticles;
private int NumAttributes;
private int NumInstances;
private double ConvergenceRadius;
private double WeightsUpperLimit;
private double maxUncoveredInstances;
private double indifferenceThreshold;
private double constrictionCoefficient;
private int numDimensions;
private int numCenters;
private int ConvergencePlatformWidth;
private Crono cronometro;
private Vector<Particle> ruleSet;
private boolean somethingWrong = false; //to check if everything is correct.
/**
* Default constructor
*/
public CPSO(){
}
/**
* It reads the data from the input files (training, validation and test) and parse all the parameters
* from the parameters array.
* @param parameters parseParameters It contains the input files, output files and parameters
*/
public CPSO(parseParameters parameters) {
train = new myDataset();
val = new myDataset();
test = new myDataset();
try {
System.out.println("\nReading the training set: "+parameters.getTrainingInputFile());
train.readClassificationSet(parameters.getTrainingInputFile(), true);
System.out.println("\nReading the validation set: "+parameters.getValidationInputFile());
val.readClassificationSet(parameters.getValidationInputFile(), false);
System.out.println("\nReading the test set: "+parameters.getTestInputFile());
test.readClassificationSet(parameters.getTestInputFile(), false);
} catch (IOException e) {
System.err.println("There was a problem while reading the input data-sets: " + e);
somethingWrong = true;
}
outputTr = parameters.getTrainingOutputFile();
outputTst = parameters.getTestOutputFile();
outputRules = parameters.getOutputFile(0);
//Now we parse the parameters
semilla = Long.parseLong(parameters.getParameter(0));
NumParticles=Integer.parseInt(parameters.getParameter(1));
ConvergenceRadius = Double.parseDouble(parameters.getParameter(2));
WeightsUpperLimit = Double.parseDouble(parameters.getParameter(3));
maxUncoveredInstances = Double.parseDouble(parameters.getParameter(4));
indifferenceThreshold = Double.parseDouble(parameters.getParameter(5));
constrictionCoefficient = Double.parseDouble(parameters.getParameter(6));
ConvergencePlatformWidth = Integer.parseInt(parameters.getParameter(7));
//inicializar la semilla
Randomize.setSeed(semilla);
NumAttributes=train.getnInputs();
numDimensions=NumAttributes*2;
numCenters=NumAttributes;
NumInstances=train.getnData();
ruleSet=new Vector<Particle>(25,10);
Particle.InitializeParameters(indifferenceThreshold, constrictionCoefficient, WeightsUpperLimit);
cronometro=new Crono();
}
/**
* It launches the algorithm
*/
public void execute() {
if (somethingWrong) { //We do not execute the program
System.err.println("An error was found, either the data-set have numerical values or missing values.");
System.err.println("Aborting the program");
}
else {
train.normalize(indifferenceThreshold);
val.normalize(indifferenceThreshold);
test.normalize(indifferenceThreshold);
cronometro.inicializa();
CPSO_Method();
cronometro.fin();
//Finally we should fill the training and test output files
double accTrain=doOutput(val, outputTr);
double accTest=doOutput(test, outputTst);
PrintOutputRules();
double mediaAtts=0;
for(int i=0 ; i<ruleSet.size() ; ++i)
mediaAtts+=ruleSet.get(i).presentAttsBest();
mediaAtts/=ruleSet.size();
System.out.print("\n\n************************************************");
System.out.print("\nPorcertanje acierto train:\t"+accTrain);
System.out.print("\nPorcertanje acierto test:\t"+accTest);
System.out.print("\nNumero de reglas:\t\t"+ruleSet.size());
System.out.print("\nNumero atributos inicial:\t"+NumAttributes);
System.out.print("\nMedia de atributos/regla:\t"+mediaAtts);
System.out.print("\nTiempo:\t\t\t\t"+cronometro.tiempoTotal());
System.out.print("\n************************************************\n\n");
System.out.println("Algorithm Finished");
}
}
//*********************************************************************
//***************** CPSO method ***************************************
//*********************************************************************
private void CPSO_Method(){
Particle bestRule;
System.out.println("Total de instancias sin clasificar = "+train.noClasificadas());
for(int classChosen=train.ClasePredominante() ; train.QuedanMasInstancias(maxUncoveredInstances)&&train.NumClassesNotRemoved()>1 ; classChosen=train.ClasePredominante()){
bestRule=GetRule(classChosen); //get bestRule
RemoveUnnecesaryVariables(bestRule,0);
ruleSet.add(bestRule); //add bestRule to ruleSet
EliminarInstanciasClasificadas(bestRule); //remove matched instances
System.out.println("Total de instancias sin clasificar = "+train.noClasificadas());
}
//add default rule
Particle defaultRule=new Particle(numDimensions, train.ClasePredominante());
defaultRule.setAsDefaultRule();
ruleSet.add(defaultRule);
//remove unnecesary rules
EliminarReglasInnecesarias();
}
//*********************************************************************
//***************** PSO algorithm to get a rule ***********************
//*********************************************************************
private Particle GetRule(int classChosen){
Particle[] P=new Particle[NumParticles];
Particle bestActual=new Particle(numDimensions,classChosen);
Particle bestPrevious=new Particle(numDimensions,classChosen);
boolean mejoraItActual;
//inicializo las posiciones y velocidades aleatoriamente
for(int i=0 ; i<NumParticles ; ++i){
P[i]=new Particle(numDimensions,classChosen);
P[i].randomInitialization();
}
int ItActOpt=0;
int iter=0;
do{
mejoraItActual=false;
bestActual.bestEvaluation=-1; //the first particle will be the best of the swarm at start
//1) evaluar el fitness de cada particula
for(int i=0 ; i<NumParticles ; ++i){
//1) evaluar P
P[i].lastEvaluation=P[i].evaluation();
//2) actualizar Bp
if(P[i].lastEvaluation>P[i].bestEvaluation)
P[i].setB(P[i].X,P[i].lastEvaluation);
//3) actualizar Bg
if(P[i].isBetter(bestActual))
bestActual=P[i].cloneParticle();
}
if(bestActual.isBetter(bestPrevious))
mejoraItActual=true;
//2) mover cada particula a su siguiente posicion
for(int i=0 ; i<NumParticles ; ++i){
P[i].updateV(bestActual);
P[i].updateX();
}
//ver si en esta iteracion se mejoro el global
if(mejoraItActual){
ItActOpt=0;
}
else{
ItActOpt++;
}
iter++;
bestPrevious=bestActual.cloneParticle();
}while(ItActOpt<ConvergencePlatformWidth && !ParticulasCercanas(P,bestActual));
Particle bestParticle=bestActual.cloneParticle();
bestParticle.lastEvaluation=bestParticle.bestEvaluation;
bestParticle.setX(bestParticle.B);
//set attribute presence
bestParticle.fixAttributePresence();
return bestParticle;
}
//*********************************************************************
//***************** Distance between particles ************************
//*********************************************************************
private Boolean ParticulasCercanas(Particle[] P, Particle G){
for(int i=0 ; i<NumParticles ; ++i)
if(EuclideanDistance(P[i],G)>(ConvergenceRadius*indifferenceThreshold))
return false;
return true;
}
private double EuclideanDistance(Particle p1, Particle p2){
double distance=0;
//distance for centers
for(int d=0 ; d<numCenters ; ++d)
distance+=Math.pow(p1.B[d]-p2.B[d], 2);
//distance for radius
for(int d=numCenters ; d<numDimensions ; ++d)
if(train.getTipo(d-(NumAttributes))!=myDataset.NOMINAL)
distance+=Math.pow(p1.B[d]-p2.B[d], 2);
distance=Math.sqrt(distance);
//count real number of dimensions
int cont=0;
for(int d=0 ; d<NumAttributes ; ++d)
if(train.getTipo(d)!=myDataset.NOMINAL)
cont+=2;
else
cont++;
distance=distance/(Math.sqrt(cont));
return distance;
}
//*********************************************************************
//***************** Remove unnecesary attributes of a rule ************
//*********************************************************************
private double RemoveUnnecesaryVariables(Particle rule, int pos){
double bestEvaluation=rule.evaluation();
double newEvaluation;
for(int i=pos ; i<NumAttributes ; ++i){
if(rule.GetAttributePresence(i)){
rule.SetAttributePresence(i, false);
newEvaluation=RemoveUnnecesaryVariables(rule, i+1);
if(newEvaluation>=bestEvaluation)
bestEvaluation=newEvaluation;
else
rule.SetAttributePresence(i, true);
}
}
return bestEvaluation;
}
//*********************************************************************
//***************** Remove unnecesary rules ***************************
//*********************************************************************
private void EliminarReglasInnecesarias(){
Boolean continuar=true;
//elimino reglas que son mas amplias que otras
for(int i=ruleSet.size()-2 ; i>=0 ; --i){
continuar=true;
for(int j=i-1 ; j>=0&&continuar ; --j){
if(IsSubSet(ruleSet.get(j),ruleSet.get(i))){//veo si alguna j, es menor que i (j incluido en i)
ruleSet.remove(i);
continuar=false;
}
}
}
//elimino reglas que predicen misma clase que la regla por defecto y estan justo antes que ella
continuar=true;
for(int i=ruleSet.size()-2 ; i>=0&&continuar ; --i){
if(ruleSet.get(i).clase==ruleSet.get(ruleSet.size()-1).clase)
ruleSet.remove(i);
else//en el momento que no elimine una, salgo del bucle
continuar=false;
}
//elimino si hay reglas despues de una regla por defecto
continuar=false;
for(int i=0 ; i<ruleSet.size() ; ++i){
if(continuar)
ruleSet.remove(i--);
if(!continuar && ruleSet.get(i).presentAttsBest()==0)
continuar=true;
}
}
private Boolean IsSubSet(Particle Rule1, Particle Rule2){
//para los atributos presentes
for(int d=0 ; d<NumAttributes ; ++d){
if(Rule1.GetAttributePresence(d)){
//ATRIBUTOS NUMERICOS
if(train.getTipo(d)!=myDataset.NOMINAL){
if( !(Rule2.GetAttributePresence(d)) ||
!((Rule1.X[d]-Rule1.X[NumAttributes+d])<=(Rule2.X[d]-Rule2.X[NumAttributes+d])) ||
!((Rule1.X[d]+Rule1.X[NumAttributes+d])>=(Rule2.X[d]+Rule2.X[NumAttributes+d])))
return false;
}
//atributos nominales
else{
int rango=(int)train.devuelveRangos()[d][1]+1;
int valueR1=(int)((Rule1.B[d]*rango)/indifferenceThreshold);
int valueR2=(int)((Rule2.B[d]*rango)/indifferenceThreshold);
if( !(Rule2.GetAttributePresence(d)) ||
!(valueR1==valueR2))
return false;
}
}
}
return true;
}
//*********************************************************************
//***************** Remove classified instances ***********************
//*********************************************************************
/**
* Removes from the dataset the instances that are correctly classified by the rule contained in the particle given as argument.
* @param p particle that contains the rule to check with.
*/
public void EliminarInstanciasClasificadas(Particle p){
for(int i=0 ; i<NumInstances ; ++i){
//si satisface la clase y el antecedente se remueve
if(p.CoverInstance(train.getExample(i))&&train.getOutputAsInteger(i)==p.clase)
train.setRemoved(i,true);
}
}
//*********************************************************************
//***************** To do outputs files *******************************
//*********************************************************************
/**
* Prints on the ouput rules file the rules inferenced by the algorithm.
*/
public void PrintOutputRules(){
double valor1, valor2;
double min[]=train.getemin();
double max[]=train.getemax();
String cad="";
//atributos presentes
for(int i=0 ; i<ruleSet.size() ; ++i){
cad+="\n\n\nIF\t";
if(ruleSet.get(i).presentAttsBest()==0)
cad+="TRUE\n\tTHEN CLASS = "+train.getOutputValue(ruleSet.get(i).clase);
else{
for(int j=0 ; j<NumAttributes ; ++j){
if(ruleSet.get(i).GetAttributePresence(j)){
String nombreAtt=Attributes.getInputAttribute(j).getName();
valor1=(ruleSet.get(i).B[j]-ruleSet.get(i).B[j+numCenters]);
valor2=(ruleSet.get(i).B[j]+ruleSet.get(i).B[j+numCenters]);
valor1=train.Desnormalizar(valor1, j, indifferenceThreshold);
valor2=train.Desnormalizar(valor2, j, indifferenceThreshold);
if(valor1<min[j])
valor1=min[j];
if(valor2>max[j])
valor2=max[j];
if(train.getTipo(j)!=myDataset.NOMINAL)
cad+="\t"+nombreAtt+"\tin\t["+valor1+" , "+valor2+"]\n\tAND";
else{
int rango=(int)train.devuelveRangos()[j][1]+1;
int value=(int)((ruleSet.get(i).B[j]*rango)/indifferenceThreshold);
cad+="\t"+nombreAtt+" = "+Attributes.getInputAttribute(j).getNominalValue(value)+"\n\tAND";
}
}
}
cad=cad.substring(0, cad.length()-4);
cad+="\tTHEN CLASS = "+train.getOutputValue(ruleSet.get(i).clase);
}
}
Fichero.escribeFichero(outputRules, cad);
}
/**
* It generates the output file from a given dataset and stores it in a file
* @param dataset myDataset input dataset
* @param filename String the name of the file
*/
private double doOutput(myDataset dataset, String filename) {
double aciertos=0;
String output = new String("");
output = dataset.copyHeader(); //we insert the header in the output file
//We write the output for each example
for (int i = 0; i < dataset.getnData(); i++) {
output += dataset.getOutputAsString(i) + " " + this.classificationOutput(dataset.getExample(i)) + "\n";
if(dataset.getOutputAsString(i).equals(this.classificationOutput(dataset.getExample(i))))
aciertos++;
}
Fichero.escribeFichero(filename, output);
return aciertos/dataset.getnData();
}
/**
* It returns the algorithm classification output given an input example
* @param example double[] The input example
* @return String the output generated by the algorithm
*/
private String classificationOutput(double[] example){
String output = "";
for(int i=0 ; i<ruleSet.size() ; ++i){
//veo si coincide el antecedente
if(ruleSet.get(i).CoverInstance(example)){//coincide el antecedente, devuelvo la primera clase que lo cumple
output=train.getOutputValue(ruleSet.get(i).clase);
return output;
}
}
return output;
}
}
|
gpl-3.0
|
skedastik/Alberti
|
web/htdocs/js/alberti/ToolEllipticalArc.js
|
5403
|
/*
* Copyright (C) 2011, Alaric Holloway <alaric.holloway@gmail.com>
*
* This file is part of Alberti.
*
* Alberti 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.
*
* Alberti 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 Alberti. If not, see <http://www.gnu.org/licenses/>.
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* ToolEllipticalArc.js
* extends ToolArc
*
* Tool for drawing ellipses and elliptical arcs inscribed within convex
* quadrilaterals (effectively perspective projections).
*
* * */
function ToolEllipticalArc(uiObjects) {
ToolEllipticalArc.baseConstructor.call(this, -1, 4, false, uiObjects);
this.quadPoints = []; // Contains points of quadrilateral
}
Util.extend(ToolEllipticalArc, ToolArc);
ToolEllipticalArc.prototype.executeStep = function(stepNum, gx, gy) {
switch (stepNum) {
case 0:
case 1:
case 2:
var mouseCoord = new Coord2D(gx, gy);
this.excludeSnapPoint = null;
this.clearSnapPoints();
if (stepNum != 0 && mouseCoord.isEqual(this.quadPoints[stepNum - 1])) {
// Do not advance to next step if quad point is same as previous step's
this.decrementStep();
} else {
var p = Point.fromCoord(mouseCoord).generate();
this.quadPoints[stepNum] = p.coord;
this.registerShape(p, "quad_point"+stepNum);
}
break;
case 3:
this.quadPoints[3] = new Coord2D(gx, gy);
var hull = Coord2D.convexHull(this.quadPoints);
if (hull.length == 4) {
var pq = Point.fromCoord(this.quadPoints[3]).generate();
var e = EllipticalShape.projectToQuad(new Ellipse(), hull[0], hull[1], hull[2], hull[3]).generate();
var pc = Point.fromCoord(e.center).generate();
var l1 = Line.fromPoints(hull[0], hull[1]).generate();
var l2 = Line.fromPoints(hull[1], hull[2]).generate();
var l3 = Line.fromPoints(hull[2], hull[3]).generate();
var l4 = Line.fromPoints(hull[3], hull[0]).generate();
var lr = Line.fromPoints(e.center, e.center).generate();
this.registerShape(pq, "quad_point"+stepNum);
this.registerShape(pc, "center_point");
this.registerShape(l1, "quad_line1", true);
this.registerShape(l2, "quad_line2", true);
this.registerShape(l3, "quad_line3", true);
this.registerShape(l4, "quad_line4", true);
this.registerShape(e, "ellipse_guide", true);
this.registerShape(lr, "line_radius");
this.excludeSnapPoint = e.center; // Do not snap to point at center of elliptical arc
this.generateIsectSnaps("ellipse_guide");
} else {
// Do not advance to the next step if the convex hull has
// less than four points as this indicates the quadrilateral
// was not, in fact, convex.
this.decrementStep();
this.displayTip("Invalid point. Quad must be convex.", true, true);
}
break;
default:
var keyCoord = new Coord2D(gx, gy);
var e = this.getShape("ellipse_guide");
var p = Point.fromCoord(keyCoord).generate();
var l = Line.fromPoints(e.center, keyCoord).generate();
switch ((stepNum - 3) % 2) {
case 0:
if (!Util.equals(this.getShape("arc"+(stepNum - 1)).da, 1e-4)) {
this.registerShape(l, "line_delta_angle"+stepNum, true);
this.registerShape(p, "point_delta_angle"+stepNum);
this.bakeShape("arc"+(stepNum - 1));
} else {
// Do not advance to next step if arc's delta angle is 0
this.decrementStep();
}
break;
case 1:
var ea = EllipticalArc.fromEllipse(this.getShape("ellipse_guide")).generate();
ea.sa = l.getAngle();
ea.coeffs = e.coeffs;
this.registerShape(ea, "arc"+stepNum);
this.registerShape(l, "line_start_angle"+stepNum, true);
this.registerShape(p, "point_start_angle"+stepNum);
break;
}
break;
}
};
ToolEllipticalArc.prototype.mouseMoveDuringStep = function(stepNum, gx, gy) {
if (stepNum > 2) {
var e = this.getShape("ellipse_guide");
var lr = this.getShape("line_radius");
var mouseCoord = new Coord2D(gx, gy);
var mouseAngle = e.center.angleTo(mouseCoord);
if (this.checkModifierKeys([KeyCode.shift])) {
// Constrain to quarter degrees
mouseAngle = Util.degToRad(Util.roundToMultiple(Util.radToDeg(mouseAngle), 0.25));
}
var p = e.getPointGivenAngle(mouseAngle);
// Calculate point on ellipse for next step regardless of constrain
this.lockMouseCoords(p);
lr.p2.x = p.x;
lr.p2.y = p.y;
lr.push();
if ((stepNum - 3) % 2 == 1) {
ea = this.getShape("arc"+stepNum);
var newDeltaAngle = Util.angleRelativeTo(mouseAngle, ea.sa);
ea.da = this.getClockDirection(newDeltaAngle) > 0 ? newDeltaAngle : newDeltaAngle - twoPi;
ea.push();
}
}
};
ToolEllipticalArc.prototype.complete = function(stepNum) {
// Create an ellipse rather than an arc if user completed shape at step 4 or 5
if (stepNum < 5) {
this.bakeShape("ellipse_guide");
}
};
|
gpl-3.0
|
RhysU/suzerain
|
suzerain/support/field.hpp
|
4591
|
//--------------------------------------------------------------------------
//
// Copyright (C) 2008-2014 Rhys Ulerich
// Copyright (C) 2012-2014 The PECOS Development Team
// Please see http://pecos.ices.utexas.edu for more information on PECOS.
//
// This file is part of Suzerain.
//
// Suzerain 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.
//
// Suzerain 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 Suzerain. If not, see <http://www.gnu.org/licenses/>.
//
//--------------------------------------------------------------------------
#ifndef SUZERAIN_SUPPORT_FIELD_HPP
#define SUZERAIN_SUPPORT_FIELD_HPP
/** @file
* Logic for saving and loading distributed state fields.
*/
#include <suzerain/common.hpp>
#include <suzerain/bspline.hpp>
#include <suzerain/exprparse.hpp>
#include <suzerain/pencil_grid.hpp>
#include <suzerain/specification_grid.hpp>
#include <suzerain/state_fwd.hpp>
#include <suzerain/support/esio_fwd.hpp>
namespace suzerain {
namespace support {
/**
* Collects details about scalar-valued fields.
* For example, spanwise momentum.
*/
class field
{
public:
/**
* A brief string used in status displays.
* For example, "rho_w".
*/
std::string identifier;
/**
* Human-readable text used to generate descriptions.
* For example, "spanwise momentum".
*/
std::string description;
/**
* The ESIO location (that is, HDF5 dataset) in which the field is stored
* in files. Often this will just be \c identifier.
*/
std::string location;
};
/** Read a complex-valued field via ESIO */
int complex_field_read(
esio_handle h,
const char *name,
complex_t *field,
int cstride = 0,
int bstride = 0,
int astride = 0);
/** Write a complex-valued field via ESIO */
int complex_field_write(
esio_handle h,
const char *name,
const complex_t *field,
int cstride = 0,
int bstride = 0,
int astride = 0,
const char * comment = 0);
/**
* Save the current simulation conserved state as expansion coefficients into
* an open restart file. Only non-dealiased, conserved state is saved as
* "wave space" coefficients. This is the most efficient and flexible way to
* save state to disk.
*/
void save_coefficients(
const esio_handle h,
const std::vector<field> &fields,
const contiguous_state<4,complex_t> &swave,
const specification_grid& grid,
const pencil_grid& dgrid);
/**
* Load the current simulation state from an open coefficient-based restart
* file. Handles the non-trivial task of adjusting the restart to match the
* provided \c grid, \c dgrid, \c b, and \c cop.
*/
void load_coefficients(
const esio_handle h,
const std::vector<field> &fields,
contiguous_state<4,complex_t> &state,
const specification_grid& grid,
const pencil_grid& dgrid,
const bsplineop& cop,
const bspline& b);
/**
* Save the current simulation state as collocation point values into an open
* restart file. Note that <tt>state</tt>'s contents are destroyed.
* Collocation point values required only for dealiasing purposes <i>are</i>
* stored but only those points informed by non-dealiased state. This method
* is less efficient and the restart data less flexible than that produced by
* save_coefficients().
*/
void save_collocation_values(
const esio_handle h,
const std::vector<field> &fields,
contiguous_state<4,complex_t>& swave,
const specification_grid& grid,
const pencil_grid& dgrid,
const bsplineop& cop);
/**
* Load the current simulation state from an open collocation point value
* restart file. Cannot handle interpolating onto a different grid.
*/
void load_collocation_values(
const esio_handle h,
const std::vector<field> &fields,
contiguous_state<4,complex_t>& state,
const specification_grid& grid,
const pencil_grid& dgrid,
const bsplineop& cop,
const bspline& b);
} // end namespace support
} // end namespace suzerain
#endif // SUZERAIN_SUPPORT_FIELD_HPP
|
gpl-3.0
|
1aurent/CloudBackup
|
CloudBackup.Manager/Schedule/IScheduleEditor.cs
|
1346
|
/* ........................................................................
* copyright 2015 Laurent Dupuis
* ........................................................................
* < This program is free software: you can redistribute it and/or modify
* < it under the terms of the GNU General Public License as published by
* < the Free Software Foundation, either version 3 of the License, or
* < (at your option) any later version.
* <
* < This program is distributed in the hope that it will be useful,
* < but WITHOUT ANY WARRANTY; without even the implied warranty of
* < MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* < GNU General Public License for more details.
* <
* < You should have received a copy of the GNU General Public License
* < along with this program. If not, see <http://www.gnu.org/licenses/>.
* ........................................................................
*
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CloudBackup.API;
namespace CloudBackup.Manager.Schedule
{
interface IScheduleEditor
{
void LoadJobSchedule(JobSchedule schedule);
void UpdateJobSchedule(JobSchedule schedule);
void EnableEdit(bool status);
}
}
|
gpl-3.0
|
potsky/laravel-boilerplate-42
|
laravel/app/lang/en/message.php
|
171
|
<?php
return array (
'You have arrived' => 'TODO: You have arrived',
'arrived' =>
array (
'You really have arrived' => 'TODO: You really have arrived',
),
);
|
gpl-3.0
|
lab-experiments/ipmt
|
src/command_factory.cpp
|
697
|
/*
@file: InputFactory.cpp
@brief: arquivo de implementação do método do método GetCommand.
ipmt
*/
#include "command_factory.hpp"
/*
@brief: função responsável por retorna o objeto referente ao comando informado via argumentos.
*/
Command *CommandFactory::GetCommand(InputModel input_model)
{
Command *command = NULL;
switch (input_model.GetCommandType())
{
case InputModel::search:
{
command = new Search(input_model);
break;
}
case InputModel::index:
{
command = new Indexing(input_model);
break;
}
default:
break;
}
return command;
}
|
gpl-3.0
|
undeath/joinmarket-clientserver
|
scripts/yg-privacyenhanced.py
|
6006
|
#!/usr/bin/env python3
from future.utils import iteritems
import random
import sys
from jmbase import get_log, jmprint, EXIT_ARGERROR
from jmbitcoin import amount_to_str
from jmclient import YieldGeneratorBasic, ygmain, jm_single
# This is a maker for the purposes of generating a yield from held bitcoins
# while maximising the difficulty of spying on blockchain activity.
# This is primarily attempted by randomizing all aspects of orders
# after transactions wherever possible.
# YIELD GENERATOR SETTINGS ARE NOW IN YOUR joinmarket.cfg CONFIG FILE
# (You can also use command line flags; see --help for this script).
jlog = get_log()
class YieldGeneratorPrivacyEnhanced(YieldGeneratorBasic):
def __init__(self, wallet_service, offerconfig):
super().__init__(wallet_service, offerconfig)
def select_input_mixdepth(self, available, offer, amount):
"""Mixdepths are in cyclic order and we select the mixdepth to
maximize the largest interval of non-available mixdepths by choosing
the first mixdepth available after the largest such interval.
This forces the biggest UTXOs to stay in a bulk of few mixdepths so
that the maker can always maximize the size of his orders even when
some coins are sent from the last to the first mixdepth"""
# We sort the available depths for linear scaling of the interval search
available = sorted(available.keys())
# For an available mixdepth, the smallest interval starting from this mixdepth
# containing all the other available mixdepths necessarily ends at the previous
# available mixdepth in the cyclic order. The successive difference of sorted
# depths is then the length of the largest interval ending at the same mixdepth
# without any available mixdepths, modulo the number of mixdepths if 0 is in it
# which is only the case for the first (in linear order) available mixdepth case
intervals = ([self.wallet_service.mixdepth + 1 + available[0] - available[-1]] + \
[(available[i+1] - available[i]) for i in range(len(available)-1)])
# We return the mixdepth value at which the largest interval without
# available mixdepths ends. Selecting this mixdepth will send the CoinJoin
# outputs closer to the others available mixdepths which are after in cyclical order
return available[max(range(len(available)), key = intervals.__getitem__)]
def create_my_orders(self):
mix_balance = self.get_available_mixdepths()
# We publish ONLY the maximum amount and use minsize for lower bound;
# leave it to oid_to_order to figure out the right depth to use.
f = '0'
if self.ordertype in ['swreloffer', 'sw0reloffer']:
f = self.cjfee_r
elif self.ordertype in ['swabsoffer', 'sw0absoffer']:
f = str(self.txfee + self.cjfee_a)
mix_balance = dict([(m, b) for m, b in iteritems(mix_balance)
if b > self.minsize])
if len(mix_balance) == 0:
jlog.error('You do not have the minimum required amount of coins'
' to be a maker: ' + str(self.minsize) + \
'\nTry setting txfee to zero and/or lowering the minsize.')
return []
max_mix = max(mix_balance, key=mix_balance.get)
# randomizing the different values
randomize_txfee = int(random.uniform(self.txfee * (1 - float(self.txfee_factor)),
self.txfee * (1 + float(self.txfee_factor))))
randomize_minsize = int(random.uniform(self.minsize * (1 - float(self.size_factor)),
self.minsize * (1 + float(self.size_factor))))
if randomize_minsize < jm_single().DUST_THRESHOLD:
jlog.warn("Minsize was randomized to below dust; resetting to dust "
"threshold: " + amount_to_str(jm_single().DUST_THRESHOLD))
randomize_minsize = jm_single().DUST_THRESHOLD
possible_maxsize = mix_balance[max_mix] - max(jm_single().DUST_THRESHOLD, randomize_txfee)
randomize_maxsize = int(random.uniform(possible_maxsize * (1 - float(self.size_factor)),
possible_maxsize))
if self.ordertype in ['swabsoffer', 'sw0absoffer']:
randomize_cjfee = int(random.uniform(float(self.cjfee_a) * (1 - float(self.cjfee_factor)),
float(self.cjfee_a) * (1 + float(self.cjfee_factor))))
randomize_cjfee = randomize_cjfee + randomize_txfee
else:
randomize_cjfee = random.uniform(float(f) * (1 - float(self.cjfee_factor)),
float(f) * (1 + float(self.cjfee_factor)))
randomize_cjfee = "{0:.6f}".format(randomize_cjfee) # round to 6 decimals
order = {'oid': 0,
'ordertype': self.ordertype,
'minsize': randomize_minsize,
'maxsize': randomize_maxsize,
'txfee': randomize_txfee,
'cjfee': str(randomize_cjfee)}
# sanity check
assert order['minsize'] >= jm_single().DUST_THRESHOLD
assert order['minsize'] <= order['maxsize']
if order['ordertype'] in ['swreloffer', 'sw0reloffer']:
for i in range(20):
if order['txfee'] < (float(order['cjfee']) * order['minsize']):
break
order['txfee'] = int(order['txfee'] / 2)
jlog.info('Warning: too high txfee to be profitable, halving it to: ' + str(order['txfee']))
else:
jlog.error("Tx fee reduction algorithm failed. Quitting.")
sys.exit(EXIT_ARGERROR)
return [order]
if __name__ == "__main__":
ygmain(YieldGeneratorPrivacyEnhanced, nickserv_password='')
jmprint('done', "success")
|
gpl-3.0
|
l2jserver2/l2jserver2
|
l2jserver2-gameserver/l2jserver2-gameserver-core/src/main/java/com/l2jserver/model/world/actor/calculator/ActorFormula.java
|
1127
|
/*
* This file is part of l2jserver2 <l2jserver2.com>.
*
* l2jserver2 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.
*
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.model.world.actor.calculator;
import com.l2jserver.model.world.actor.stat.StatType;
/**
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public abstract class ActorFormula extends ActorCalculatorFunction {
/**
* @param order
* the calculation order
* @param type
* the stat type
*/
public ActorFormula(int order, StatType type) {
super(order, type);
}
}
|
gpl-3.0
|
belissent/GrampsDynamicWebReport
|
speed_tests/dynamicweb_BIG/dwr_db_I_fams_20.js
|
105696
|
// This file is generated
I_fams_20 = [
[],
[],
[
43304
],
[],
[],
[
43305
],
[],
[],
[
43306
],
[
20203
],
[
20096
],
[
20133
],
[
20046
],
[
20114
],
[],
[],
[
9196
],
[
8714
],
[
9189
],
[
8836
],
[
2327
],
[
2222
],
[
43307
],
[
1630
],
[
13120
],
[
12852
],
[
13119
],
[],
[
47364
],
[
29731
],
[
38557
],
[],
[],
[],
[],
[
38343
],
[
46021
],
[
43308
],
[
43309
],
[
29562
],
[
43311,
43310
],
[],
[],
[
43312
],
[
43313
],
[],
[],
[],
[],
[
43314
],
[
43315
],
[
46020
],
[
42303
],
[],
[
35012
],
[
43316
],
[
29927
],
[
34845
],
[],
[
43317
],
[],
[
34676
],
[
35818
],
[],
[],
[],
[],
[],
[
43318
],
[],
[
28850
],
[],
[],
[
43319
],
[],
[],
[],
[],
[
43320
],
[],
[],
[],
[
43321
],
[],
[
43731
],
[],
[],
[
29512
],
[],
[
40311
],
[
43322
],
[],
[],
[
43323
],
[],
[],
[],
[],
[
34924
],
[
30178
],
[
42665
],
[
34390
],
[],
[
43324
],
[],
[
43325
],
[
31164
],
[
39319
],
[
30145
],
[
43326
],
[],
[
40149
],
[],
[],
[],
[],
[],
[],
[],
[
43056
],
[],
[
29659
],
[
42101
],
[],
[
33893
],
[],
[
43328
],
[
43327
],
[
43330,
43329
],
[
43331
],
[
43332
],
[
43333
],
[],
[],
[],
[],
[],
[],
[
43334
],
[],
[],
[],
[],
[
43335
],
[
43336
],
[],
[],
[
45951
],
[
32767
],
[
43337
],
[],
[
40558
],
[],
[
43338
],
[],
[],
[
29934
],
[
28849
],
[],
[],
[
43339
],
[
43340
],
[],
[
43341
],
[
29890
],
[
36592
],
[
43342
],
[],
[
29561
],
[],
[],
[],
[
43344,
43343
],
[],
[],
[
40552
],
[],
[],
[
34507,
47913
],
[],
[
43345
],
[],
[
37862
],
[],
[],
[],
[
33144
],
[
36338
],
[
43346
],
[
43347
],
[
36555
],
[
33892
],
[
37674
],
[
33389
],
[
42301
],
[
42003
],
[
43348
],
[],
[
43349
],
[
42198
],
[],
[],
[],
[],
[],
[],
[
43351,
43352,
43350
],
[],
[],
[
43353
],
[
36147
],
[
43354
],
[
33141
],
[],
[
30147
],
[],
[
42913
],
[],
[
29654
],
[],
[],
[],
[],
[],
[],
[],
[
41681
],
[
43356,
43355
],
[
40214
],
[
38506
],
[
43357,
43358
],
[
43359
],
[],
[],
[
43361,
43360
],
[],
[],
[
43362
],
[],
[],
[
43364,
43365,
43363
],
[],
[
43366
],
[
43367
],
[
43368
],
[],
[],
[
43369
],
[
43370
],
[
43372,
43371
],
[
34910
],
[
43373
],
[
43374
],
[
43376,
43375
],
[
43377
],
[
43378
],
[],
[
42302
],
[
43379
],
[],
[],
[
43380
],
[
43381
],
[],
[],
[],
[],
[
32098
],
[
31999
],
[],
[
39556
],
[],
[],
[],
[
43382
],
[],
[
43383
],
[],
[],
[
38417
],
[
38881
],
[],
[],
[],
[],
[
38869
],
[],
[
43384
],
[
43385
],
[],
[
43386
],
[],
[],
[
43387
],
[
43388
],
[],
[
43389
],
[
43390
],
[
43391
],
[
43392
],
[
43393
],
[
43394
],
[
43395
],
[
43396,
43397
],
[
43399,
43398
],
[
43400
],
[],
[
38601
],
[
40334,
41349
],
[],
[
38444
],
[
43401
],
[
45787
],
[],
[],
[
33834
],
[],
[
43402
],
[
43403
],
[
43404
],
[
36590
],
[],
[],
[
31944
],
[],
[
43406,
43405
],
[
43407
],
[
43408
],
[
43409
],
[],
[],
[
43410
],
[
43411,
43412
],
[
43414,
43413
],
[
43415
],
[
43416
],
[
43417
],
[],
[],
[
43418
],
[
43419
],
[
43420
],
[
43421
],
[
43422
],
[],
[
43423
],
[
43424
],
[
43425
],
[
43426
],
[
43427,
43428
],
[],
[],
[
43429
],
[],
[
32230
],
[
42141
],
[
43430
],
[],
[
30728,
38871
],
[],
[
43431
],
[],
[],
[
45954,
29902
],
[
30148
],
[],
[
40553
],
[],
[
43432
],
[
43433
],
[
43434
],
[],
[],
[
32231
],
[],
[
43435
],
[
43436,
43437
],
[
35238
],
[],
[],
[],
[
43438
],
[
43439
],
[
43440
],
[
43442,
43441
],
[
42094
],
[],
[
43443
],
[],
[],
[
43444
],
[
43446,
43445
],
[
43447
],
[
45050
],
[
28617
],
[
43448
],
[],
[],
[
43449
],
[],
[],
[
45034
],
[
43450
],
[],
[
42631
],
[
41952,
42177
],
[
38564
],
[],
[
38880
],
[
42632
],
[],
[
34900
],
[
31150
],
[
39274
],
[],
[
43451
],
[],
[],
[],
[
31255
],
[
36561
],
[
43452
],
[
29443,
31176
],
[],
[
36554
],
[
38568
],
[
43453
],
[],
[],
[],
[
43454
],
[
43455
],
[
43456
],
[
43457
],
[
30173,
41568
],
[],
[],
[],
[
38476
],
[],
[],
[
46160
],
[
34848
],
[],
[
42323
],
[],
[
38555
],
[],
[
31198
],
[
37807
],
[
29519
],
[
45994
],
[],
[
45755
],
[],
[],
[],
[
37864
],
[
35411
],
[],
[
32253
],
[],
[
40155
],
[
38729
],
[],
[
38509
],
[],
[
43459,
43458
],
[],
[],
[
43460,
43461
],
[
29756
],
[],
[
43649
],
[
43462
],
[],
[],
[
43463
],
[],
[],
[],
[
45979
],
[
43464
],
[],
[],
[],
[],
[
43697
],
[
29544
],
[
43465
],
[
35191
],
[],
[
41462
],
[
35436
],
[],
[],
[
38720
],
[],
[
43475
],
[
43466
],
[
32308
],
[
46043
],
[],
[],
[
30940
],
[],
[
43467
],
[
43416
],
[
39558
],
[],
[
38653
],
[
35193,
34650
],
[
43468
],
[
43469
],
[
33140
],
[
43471,
43470
],
[
43472
],
[
34921
],
[],
[
37857,
33663
],
[
29757
],
[],
[],
[],
[
34361,
34362,
39521
],
[
43473
],
[
43474
],
[
43475
],
[
43476
],
[],
[
43477
],
[
43478
],
[
43479
],
[
44115
],
[
43480
],
[],
[
43481
],
[
43482
],
[],
[
43483
],
[],
[],
[],
[
41367
],
[
42671
],
[
40571
],
[],
[],
[],
[],
[],
[],
[],
[
43484
],
[
43485
],
[
43486
],
[],
[
43487
],
[
43488
],
[],
[
43489
],
[
43490
],
[
42172
],
[
43491
],
[
42005
],
[
36149,
30086,
36148
],
[],
[
47578,
38724
],
[
30767
],
[],
[],
[
36594
],
[
41998
],
[],
[
43492
],
[
43493
],
[
43494
],
[],
[],
[
32332
],
[],
[],
[],
[
29936
],
[],
[
42206
],
[
45856
],
[],
[
38250
],
[
43495
],
[
42657
],
[],
[],
[
35239
],
[
43496
],
[
43497
],
[
32644
],
[],
[
43498
],
[],
[],
[],
[
43499
],
[],
[
38548
],
[],
[],
[],
[
41887
],
[],
[
34919
],
[
42646
],
[],
[],
[],
[
43500
],
[
43501
],
[],
[],
[],
[],
[],
[
43502
],
[
43504,
43503
],
[],
[],
[
43506,
43505
],
[],
[
43507
],
[
43508
],
[],
[],
[
43509
],
[
43511
],
[],
[
43510
],
[],
[
43512
],
[],
[
43513
],
[
43514,
43515
],
[],
[
43516
],
[
43517
],
[
43518,
43519
],
[],
[],
[
43520
],
[],
[],
[
43521
],
[],
[],
[
43522
],
[
36885
],
[
43523
],
[],
[
43524
],
[],
[],
[],
[
37086
],
[],
[
43525
],
[],
[
43526
],
[
43527
],
[],
[
43528
],
[],
[],
[
43529
],
[
43530,
43531
],
[],
[],
[
43532,
43534,
43533
],
[
43535,
43536
],
[
43537
],
[],
[
43538
],
[
43539
],
[
43541,
43540
],
[
43543,
43542
],
[
43544,
43545
],
[
43546
],
[
43547
],
[
43548,
43551,
43550,
43549
],
[
43552,
43553
],
[
43554
],
[
43555
],
[
43556
],
[],
[],
[],
[
43557,
43558
],
[],
[],
[
43559
],
[],
[
43560
],
[
43561
],
[
30776
],
[
43562
],
[
43563
],
[
43564
],
[
37250
],
[
40317
],
[],
[
43565
],
[
43566
],
[
43567
],
[
43568
],
[],
[
45928
],
[
28908
],
[],
[],
[
43569
],
[],
[],
[
9730
],
[
34619
],
[
13090
],
[],
[
12825
],
[],
[
13198
],
[
42406,
29643
],
[
3159
],
[
3923
],
[
43570
],
[
43571
],
[
39467
],
[
4002
],
[
43572
],
[
4406
],
[
25004
],
[
44427
],
[
43573
],
[
43029
],
[
6490
],
[
43574
],
[
43575
],
[
43576
],
[
43577
],
[
44657
],
[
44470
],
[
44475
],
[
43578
],
[
28503,
44500
],
[
3183
],
[
43579
],
[
38488
],
[],
[],
[
4106,
4429
],
[],
[],
[
43069
],
[],
[],
[],
[
4430
],
[
43580
],
[
3153
],
[],
[
44421
],
[
43581
],
[],
[
43582
],
[
43583
],
[
43584
],
[
43585
],
[],
[],
[
44366
],
[
4091
],
[
43586,
43587
],
[
43588
],
[],
[],
[
43589
],
[
43590
],
[
43591
],
[],
[
43592
],
[
43593
],
[
35465
],
[],
[],
[
43594
],
[
43595
],
[
43597,
43596
],
[],
[
43598
],
[],
[
43941
],
[],
[
43599
],
[
43600
],
[
43601
],
[
43602
],
[],
[
43603
],
[
44416
],
[],
[
39174
],
[
41849
],
[
22777
],
[
35335
],
[
43605,
43604
],
[],
[
32172
],
[],
[
42901
],
[],
[
43606
],
[
35872,
21930
],
[],
[
38045
],
[
6327
],
[
43607
],
[
30655
],
[
6245
],
[
6146
],
[
40381
],
[],
[
43608
],
[
43609
],
[],
[
3726
],
[],
[
43610
],
[],
[
43611
],
[
43276
],
[
45561
],
[
43612
],
[
4558
],
[
4131
],
[
4130
],
[
28603
],
[
38498
],
[
43613
],
[
43614
],
[],
[
4105
],
[
4278
],
[
3724
],
[
3139
],
[],
[
6585
],
[],
[
43615
],
[],
[
43616
],
[],
[],
[],
[
43617
],
[],
[],
[
44273
],
[
43618
],
[
3686
],
[
43619
],
[
3217
],
[],
[
43274
],
[
3569
],
[],
[],
[
43620
],
[
44283
],
[
43621
],
[],
[],
[
4085,
4112
],
[],
[],
[
43622
],
[],
[],
[],
[
32888
],
[],
[],
[],
[],
[
11118
],
[
24282
],
[],
[
43035
],
[],
[],
[
3727
],
[
43623
],
[],
[],
[
3615
],
[
43624
],
[],
[
24042
],
[],
[],
[
26670
],
[
43625
],
[
43626
],
[],
[],
[],
[
43627
],
[
43628
],
[
43629,
3614
],
[
43630
],
[],
[
43631
],
[],
[],
[
27522
],
[
3676,
43625,
35679
],
[
43632
],
[],
[],
[
3617
],
[
44354
],
[
4280
],
[
6351
],
[
5897
],
[
5687
],
[
6124
],
[
16487
],
[
14604
],
[
30988
],
[
43633
],
[
37755,
41981
],
[
32460
],
[
2384
],
[
43634
],
[],
[
43635
],
[],
[],
[],
[
29542
],
[
43636
],
[],
[
43637
],
[],
[],
[],
[],
[],
[],
[],
[
43638
],
[
1620,
43640,
1621,
43639,
1622,
43641
],
[],
[],
[],
[],
[],
[
43642
],
[
2345,
2275
],
[],
[
2346
],
[],
[
43643
],
[
1689
],
[
24954,
32251,
42655
],
[
25926,
1623
],
[
2230
],
[
26538
],
[
35190
],
[
41846,
43087
],
[
43644
],
[
43645
],
[],
[],
[],
[],
[
2232
],
[
13115
],
[
21342
],
[
13395
],
[],
[
13735
],
[
40354
],
[
5652
],
[
13913
],
[
6257
],
[
43646
],
[
26338
],
[
43171
],
[
12328
],
[
18181
],
[
43647
],
[
29586
],
[
2302
],
[],
[],
[],
[],
[],
[
20681
],
[],
[
15963
],
[
16171
],
[
38727
],
[
40437
],
[
14490
],
[
26912
],
[
43648
],
[
43649
],
[
30129,
40347
],
[
43650
],
[
43652,
43651
],
[
43653
],
[
42326
],
[
3006
],
[
38475,
43399
],
[
2495
],
[],
[],
[
40003
],
[
29455
],
[
43654,
43655
],
[
20459
],
[
13876
],
[
43656
],
[],
[
26096
],
[],
[
43657
],
[
42231
],
[
30204
],
[
27689
],
[
45353
],
[
33984
],
[
6066
],
[
5803
],
[],
[
5887,
5905
],
[
43658
],
[
5191
],
[
4629
],
[
3465
],
[],
[
3380
],
[
18487
],
[
41590
],
[
43659
],
[
43660
],
[],
[
30182
],
[
32079
],
[],
[],
[
43661
],
[
43314
],
[],
[
43672
],
[
43662
],
[],
[
41467
],
[
42174
],
[],
[],
[
35192
],
[],
[],
[],
[
43663
],
[],
[],
[
43664
],
[],
[],
[
31964
],
[
43665,
43666,
43667
],
[
32005
],
[
34842
],
[],
[
43668
],
[],
[],
[],
[
43524
],
[
45872
],
[],
[],
[
43669
],
[
35204
],
[],
[],
[
42006
],
[
43670
],
[],
[
43671
],
[],
[],
[],
[],
[
42204
],
[
43672
],
[],
[],
[],
[
43673
],
[
43674
],
[],
[],
[],
[
43675
],
[],
[
43676
],
[
43677
],
[],
[
43678
],
[
42050
],
[
43680,
43679,
43681
],
[],
[
43682
],
[],
[],
[
43683
],
[
43685,
43684
],
[],
[
43686
],
[
43687
],
[],
[
43688
],
[],
[],
[
40569
],
[
43690,
43689
],
[],
[],
[
43691
],
[
43692
],
[
43693
],
[
43696,
43695,
43694
],
[],
[
43697
],
[],
[
30128
],
[],
[],
[
43698
],
[
43699
],
[
30127
],
[
38590
],
[
43700
],
[
43701
],
[
35199
],
[],
[
35171
],
[
42637
],
[],
[],
[
31155
],
[],
[
43702
],
[],
[],
[
43512
],
[],
[
30180,
29943
],
[],
[
38558
],
[
31961
],
[
30993
],
[],
[],
[
34558
],
[
43703
],
[
29555
],
[
29029
],
[],
[],
[
43704
],
[
43705
],
[
38414
],
[
29889
],
[
43706
],
[
37475
],
[
42179
],
[],
[],
[
38469
],
[],
[
43707
],
[
43708
],
[],
[
43709
],
[
43710
],
[],
[],
[
43711
],
[],
[],
[
43712
],
[],
[
45910
],
[
31965
],
[],
[],
[
43713
],
[
45871
],
[
43714
],
[],
[
43715
],
[
43716
],
[
43717
],
[
24186
],
[
43718
],
[],
[
30456
],
[
43719
],
[],
[
43720
],
[
43721
],
[
43722,
43723
],
[
43724
],
[],
[
43725
],
[
43726
],
[],
[],
[
4239
],
[
4240
],
[
3095
],
[
4543
],
[
16156
],
[
43114
],
[
4149
],
[],
[],
[],
[],
[],
[],
[
3240
],
[],
[
3265,
6236
],
[
32212
],
[
4564
],
[
4563
],
[
43727
],
[
13050
],
[
4320
],
[
29651
],
[
10794
],
[
43728
],
[
11053
],
[
10956
],
[
10973
],
[
3688
],
[
3495
],
[
5901
],
[],
[],
[
43729
],
[
20830
],
[],
[],
[
18105
],
[
402
],
[
43730
],
[
16068
],
[],
[],
[
43731
],
[
43732
],
[
43733
],
[
43734
],
[
43735
],
[],
[
15817
],
[
28515
],
[
6159
],
[
43736
],
[
43737
],
[
11670
],
[
11667
],
[
11666
],
[
11668
],
[
11669
],
[
36400
],
[
28090
],
[
43738
],
[
43739
],
[
43740
],
[
47852
],
[
43741
],
[
43742
],
[
43743
],
[
43744
],
[
45144
],
[
33166
],
[
15793
],
[
42964
],
[],
[
19913
],
[
16733
],
[
43982,
5073
],
[
15784
],
[
15781
],
[
31335
],
[
17259
],
[
7590
],
[
15940
],
[
16168
],
[
15937
],
[],
[
43745
],
[
43746
],
[
11096
],
[
11137
],
[
12938
],
[
16722
],
[
43747
],
[
8025
],
[
43748
],
[
12994
],
[
13058
],
[
13178
],
[],
[
9899
],
[],
[
9796
],
[],
[],
[
12788
],
[
9846
],
[
13072
],
[
12836
],
[
12915,
12938
],
[
12892
],
[
12916
],
[],
[],
[
13119
],
[
13141
],
[],
[
5509
],
[],
[
9855
],
[],
[
13013,
13051
],
[
9722
],
[
5271
],
[],
[
13181
],
[
13028
],
[
9894
],
[],
[
12826
],
[],
[
9809
],
[],
[
13139
],
[],
[
13157
],
[
12900
],
[],
[],
[
12859
],
[
12959
],
[],
[
13173
],
[
22279
],
[
27627
],
[
43749
],
[
45095
],
[
43750
],
[
32672
],
[
32673
],
[
46382
],
[
43751
],
[],
[
43752
],
[
22701
],
[
43753
],
[
31996
],
[
7521
],
[
45452
],
[
31419
],
[
43754
],
[
11193
],
[
48037
],
[
31113
],
[],
[
43755
],
[],
[],
[],
[],
[
43756
],
[],
[],
[],
[],
[
43757
],
[
43769
],
[
46756
],
[],
[
43758
],
[
43759
],
[
43761
],
[
43760
],
[],
[
31893
],
[],
[
3325
],
[
43762
],
[
29646
],
[
46798
],
[
43763
],
[],
[],
[],
[],
[
43262
],
[
29595
],
[
43764
],
[
43765
],
[
46750
],
[
43766
],
[],
[
40067
],
[
32171
],
[
41743
],
[
43784
],
[],
[],
[
43773
],
[
31108
],
[],
[],
[],
[],
[
46797
],
[],
[],
[],
[],
[],
[
43767
],
[],
[
43768
],
[],
[],
[],
[
43769
],
[],
[
43770
],
[
4008
],
[
33334
],
[],
[
43771
],
[
43772
],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[
189
],
[
14235
],
[
16594
],
[
1487
],
[
1431
],
[
32652
],
[
46840
],
[
4533
],
[
9832
],
[
9770
],
[
9804
],
[
9810
],
[
43773
],
[],
[],
[],
[],
[
43774
],
[
22075
],
[
32014
],
[],
[],
[
43775
],
[
16740
],
[
43776
],
[
43777
],
[
19986
],
[
46963
],
[
43778
],
[
43779
],
[
17402
],
[
31520
],
[
19579
],
[
17189
],
[
6728
],
[
13452
],
[
18058
],
[
13597
],
[
6652
],
[
43780
],
[
43781
],
[
8084
],
[
13510
],
[
7967
],
[
7827
],
[
43782
],
[
43783
],
[
31814
],
[
1166
],
[
1402
],
[
31455
],
[
5784
],
[
6042
],
[],
[],
[
43784
],
[],
[],
[],
[],
[
43785
],
[],
[
45417
],
[
5830
],
[
5936
],
[
17444
],
[
17446
],
[
43786
],
[
3515
],
[
5954
],
[
3383
],
[
5706
],
[],
[],
[
44035
],
[
20401
],
[],
[],
[],
[
20376
],
[],
[],
[
16950
],
[],
[],
[],
[],
[
20025,
20061
],
[],
[
19751
],
[],
[],
[],
[],
[
30909
],
[],
[],
[
16980
],
[
17103
],
[
18251
],
[
17080
],
[
38614
],
[
45619
],
[
43787
],
[
43788
],
[
18072
],
[
30211
],
[
30590
],
[
41663
],
[
43789
],
[],
[
43790
],
[
33634
],
[
43791
],
[],
[
36743
],
[
16686
],
[],
[],
[
43792
],
[],
[
36395
],
[
14218
],
[
16022
],
[
37793
],
[
16125
],
[
15360
],
[
43793
],
[
30914
],
[
6111
],
[
4063
],
[
23541
],
[
5816
],
[
46964
],
[
36609
],
[
15910
],
[
15909,
15911
],
[
42037
],
[
15989
],
[
20277
],
[
20167
],
[
20242
],
[
20165
],
[],
[
43794
],
[
32771
],
[],
[
43795
],
[
48138
],
[
43796
],
[
43798,
43797
],
[],
[
47815
],
[
12740
],
[
13202
],
[
13201
],
[],
[],
[],
[],
[
13260
],
[
12956
],
[],
[],
[
13001,
13019
],
[
13810
],
[
18011
],
[
18078
],
[
18015
],
[
18215
],
[
18132
],
[
18003,
18041
],
[
18265
],
[],
[
16821
],
[
14135,
14163
],
[],
[
14259
],
[],
[],
[
16595
],
[
16616
],
[
16820
],
[
16644
],
[],
[],
[],
[
16655
],
[],
[
14184
],
[],
[
16659
],
[
43799
],
[
13083
],
[
9941
],
[
9936
],
[
43800
],
[
43801
],
[
10945
],
[
48371,
39928
],
[
43802
],
[
41473
],
[
30634
],
[
44777
],
[
42908
],
[
9768
],
[
11054
],
[
43803
],
[
30019
],
[
43804
],
[
43805
],
[
39832
],
[
34572,
42068,
48289,
46841
],
[
10293
],
[],
[
43806
],
[
11166
],
[
11123
],
[
11167
],
[
20140
],
[
16472
],
[
26790
],
[
43807
],
[
15785
],
[
15411
],
[
16420
],
[
43808
],
[
39334
],
[
37388
],
[
37379
],
[],
[],
[
43809
],
[
43810
],
[
43811
],
[
44773
],
[
43812
],
[
30588
],
[
36999
],
[],
[
16940
],
[
12797
],
[
22020
],
[
43813
],
[
14246
],
[
14824
],
[
14123
],
[
43814
],
[
16531
],
[],
[
43815
],
[
48335
],
[
35061
],
[
43816
],
[
30286
],
[],
[
38765
],
[
48336
],
[],
[
14249
],
[
16815
],
[],
[],
[],
[
43817
],
[
43818
],
[
43819
],
[
10952
],
[
10955
],
[
43820
],
[
35257
],
[
16368
],
[
43821
],
[],
[
17379
],
[],
[],
[
43822,
43823
],
[
43825,
43824
],
[
43826
],
[
43827
],
[
43828
],
[
17380
],
[],
[],
[],
[],
[],
[
43829
],
[],
[],
[],
[
39509
],
[
41154,
27248
],
[
43830
],
[],
[],
[
43831
],
[
43832
],
[
43833
],
[
43834
],
[
43835
],
[
35445
],
[
28335
],
[],
[],
[
37481
],
[],
[
43836
],
[
43837
],
[
43838
],
[
32038
],
[
44154
],
[
24103
],
[
13437
],
[
43839
],
[
43840
],
[],
[
41602
],
[
16597
],
[],
[
43872
],
[
43841
],
[],
[
43842
],
[
43776
],
[],
[
16615
],
[
29526
],
[
14182
],
[
36139
],
[
36134
],
[
43843
],
[
30450
],
[
10577
],
[
43844
],
[
44414
],
[
46712,
37896
],
[
32939
],
[
16356
],
[
10878
],
[
43845
],
[
48310
],
[
41320
],
[
9861
],
[],
[
46299
],
[
43846
],
[],
[
9903
],
[
43847
],
[
30609
],
[
37380
],
[
43848
],
[
36470
],
[
16302
],
[
16280
],
[
41610
],
[
16563
],
[],
[
30416
],
[
16052
],
[
12683
],
[
43849
],
[
27012
],
[
43850
],
[
62
],
[],
[],
[],
[
40010
],
[
8059
],
[
8054
],
[],
[
8049
],
[],
[
7711
],
[],
[
8058
],
[],
[],
[],
[
7702
],
[
7816
],
[
7817
],
[],
[
42348
],
[
8053
],
[
39312,
7710
],
[
34217
],
[
8052
],
[],
[
8057
],
[
7818
],
[
8050,
7813
],
[
7814
],
[
7815
],
[
7712
],
[
7713
],
[
43851
],
[
8048
],
[],
[],
[
33448
],
[
33805
],
[],
[
8056
],
[
8055
],
[
43852
],
[
43853
],
[],
[],
[
43854
],
[
43855
],
[
6043
],
[],
[],
[],
[
43856
],
[
43857
],
[
5889
],
[
5905
],
[],
[
35314
],
[
18277
],
[
10193
],
[
17007
],
[
43858
],
[
41441
],
[
43859
],
[
31496
],
[
43860
],
[
20312
],
[
43861
],
[
43862
],
[],
[
20186
],
[],
[],
[],
[
33668
],
[],
[
45307
],
[
14209
],
[
15335
],
[
36192
],
[
16126
],
[
43863
],
[
7789
],
[
46421
],
[
16184
],
[
43864
],
[
7638
],
[
43865
],
[
3173
],
[
43866
],
[
4301
],
[
6407
],
[
6220
],
[
18330
],
[
18085
],
[
18197
],
[
18332
],
[
18086
],
[
9743,
9786
],
[
9895
],
[
13145
],
[],
[
13020
],
[],
[
13140
],
[
38851
],
[
13188
],
[
13203
],
[],
[],
[],
[
48182
],
[],
[
13148
],
[
47947
],
[
21190
],
[],
[],
[
43867
],
[
16464
],
[
14195
],
[
43868
],
[
43869
],
[],
[
43870
],
[
16767
],
[
43871
],
[
37789
],
[
16152
],
[
16201
],
[
16348
],
[
16085
],
[
16049
],
[
16313
],
[
16190
],
[
16223
],
[
16170
],
[
16040
],
[
16047
],
[
16353
],
[
14252
],
[
14119
],
[
16015
],
[
43872
],
[
30373
],
[
16752
],
[
43873
],
[],
[
43874
],
[
43875
],
[],
[
43876
],
[
42976,
15361
],
[],
[],
[
14127
],
[],
[
16434
],
[],
[],
[
16453
],
[
36127
],
[
42965
],
[
16622
],
[
43877
],
[],
[
43020
],
[
30297
],
[
31645
],
[
43878
],
[],
[
28863
],
[],
[
43879
],
[],
[],
[
33051
],
[
43880
],
[
43881
],
[
16088
],
[
16208
],
[
30371
],
[
16322
],
[
16355
],
[
16285
],
[
16289
],
[
16361
],
[
36917
],
[
41872
],
[
43882
],
[
15896
],
[
5432
],
[
3349
],
[],
[
43883
],
[
6116
],
[
5740
],
[
27175
],
[
5998
],
[
6073
],
[
43884
],
[
4074,
6053
],
[],
[
31147,
30261
],
[
30592
],
[],
[
43885
],
[
43886
],
[
43887
],
[
30200
],
[
33038
],
[
43888
],
[
40478
],
[],
[
15972
],
[
40342
],
[
16069
],
[],
[],
[
16068
],
[
16070
],
[
39494
],
[],
[
16071
],
[],
[
43889
],
[],
[],
[],
[
43890
],
[],
[],
[
30584
],
[
43891
],
[
43892
],
[
16160
],
[],
[],
[
15992
],
[
43893
],
[
43894
],
[
15989
],
[
15987
],
[
15997
],
[
15910
],
[
16153
],
[],
[
16136
],
[
16056
],
[],
[],
[
15996
],
[
15988
],
[
16130
],
[],
[
43895
],
[
15998
],
[],
[
16031
],
[],
[
16155
],
[
16136
],
[
38337
],
[
15994
],
[
16192
],
[
16330
],
[],
[],
[
15990
],
[
16000
],
[
15999
],
[],
[],
[
15995
],
[
15993
],
[
15991
],
[
15967
],
[],
[
16032
],
[
16239
],
[],
[],
[
16179
],
[
37790
],
[
15958
],
[
30391
],
[
43893
],
[],
[],
[
43896
],
[],
[
32853
],
[],
[
3430
],
[
43897
],
[
43898
],
[
43899
],
[
43900
],
[
17523
],
[
8011
],
[
7946
],
[
43902,
43901
],
[
8013
],
[
37027
],
[
8010
],
[],
[
37561
],
[
8012
],
[
7805
],
[
7945
],
[
7775
],
[
43904,
43903
],
[],
[
43905
],
[],
[
41235
],
[
45394
],
[],
[
20548
],
[],
[
20895
],
[],
[],
[
20564
],
[
20535
],
[
20906
],
[
29297
],
[
20607
],
[
43906
],
[
43907
],
[
35281
],
[
43908
],
[
43936
],
[
43909
],
[],
[
16083
],
[],
[
15871
],
[
43910
],
[
43911
],
[
33031
],
[
13033
],
[
43912
],
[
18200
],
[
18007
],
[
32690
],
[
16984
],
[
25978
],
[
17543
],
[
13230
],
[
17985
],
[],
[
31406
],
[],
[
15463
],
[
16807
],
[
43913
],
[
37969
],
[
38365
],
[
41373
],
[],
[],
[],
[
43914
],
[
43915
],
[],
[
39852
],
[
17834
],
[],
[],
[],
[
43916
],
[],
[],
[
43917,
43918
],
[],
[
43919,
43920
],
[
43921
],
[
43922
],
[],
[],
[],
[
31465
],
[
43923
],
[
43093
],
[],
[
8049
],
[
13700
],
[
43924
],
[],
[
6711
],
[],
[],
[
13464
],
[
13538
],
[
13727
],
[
6840
],
[
13646
],
[
6644
],
[
6676
],
[
6644
],
[
6780,
13609
],
[
6685,
6705
],
[],
[],
[],
[
13389
],
[
6845
],
[],
[
13554
],
[
6684
],
[
6761
],
[],
[],
[],
[],
[
13723
],
[
6650
],
[
6688
],
[
13339
],
[],
[],
[
13290
],
[
6727
],
[],
[
6837
],
[
13388
],
[],
[
13231
],
[
9496
],
[],
[
13675
],
[
13646
],
[
6710
],
[
13309
],
[],
[
33649
],
[],
[],
[
6788
],
[
13574
],
[],
[
6861
],
[
35774
],
[
43925
],
[
13301
],
[
13293
],
[
6835
],
[
13495
],
[],
[
6853
],
[],
[],
[
13680
],
[],
[
13602
],
[
6843
],
[],
[],
[
13757
],
[],
[],
[],
[],
[
46277
],
[],
[
20303
],
[
16897
],
[
16922,
16943
],
[
20158
],
[
41163
],
[],
[],
[],
[],
[
43926
],
[
43927
],
[
43928
],
[
5622
],
[
45646
],
[
13480
],
[
6646
],
[
17837
],
[
15190
],
[
43929
],
[],
[
39774
],
[
37745
],
[
37363
],
[
43930
],
[
43931
],
[],
[
43932
],
[],
[],
[
5319
],
[
36582
],
[],
[
19783
],
[
43933
],
[
45413
],
[
9816
],
[
9949
],
[
17148
],
[],
[],
[],
[],
[],
[
34396
],
[],
[],
[
43934
],
[
43935
],
[],
[
18998
],
[],
[
18997
],
[],
[
18996
],
[
43936
],
[],
[
43937
],
[
43939,
43938
],
[
20784
],
[
36000
],
[
43940
],
[
40472
],
[
40998
],
[
19437
],
[
43941
],
[
9863
],
[
29848
],
[
43942
],
[
16856
],
[
16621
],
[],
[
43943
],
[
43944
],
[
41483
],
[],
[
48132
],
[
19457
],
[
19078
],
[
43945
],
[
43946
],
[
43947
],
[
44519
],
[
43948
],
[
45681
],
[
33543
],
[
43949
],
[
36017
],
[
43950
],
[
43951
],
[
43952
],
[
17096
],
[
45770
],
[
17873
],
[
29581
],
[
38815
],
[
43953
],
[
29548
],
[
37752
],
[
43954
],
[
43955
],
[
12800
],
[
43956
],
[
43957
],
[
12789
],
[
10744
],
[
12890
],
[
32857
],
[
37055
],
[
24871
],
[
24251
],
[
5995
],
[
5782
],
[
6045
],
[
3519
],
[],
[
3450
],
[
5729
],
[
6107
],
[
6062
],
[
43958
],
[
38999
],
[
43959
],
[
31320
],
[
46687
],
[
39584
],
[
37149
],
[
43960
],
[
3254
],
[
9923
],
[
43961
],
[],
[
43962
],
[],
[
20196
],
[
20230
],
[
17016
],
[
17090
],
[
16986
],
[
17047
],
[
16965
],
[
17112
],
[
17025
],
[
20238
],
[
20281
],
[
20257
],
[
20112
],
[
20394
],
[
17114
],
[
15370
],
[
43963
],
[
16297
],
[
16296
],
[
32942
],
[
16300
],
[
13113
],
[],
[],
[
12864
],
[
13026
],
[
13084
],
[
9874
],
[
13264
],
[
9900
],
[
42073
],
[
43964
],
[],
[],
[],
[],
[
43965
],
[
43966
],
[
24782
],
[],
[],
[
43967
],
[
18671
],
[],
[
20288
],
[],
[
17047
],
[],
[],
[
20207
],
[],
[
20378
],
[
23060,
26864
],
[
46050
],
[
24212
],
[
43968
],
[
43969
],
[
43970
],
[
14671
],
[],
[],
[],
[],
[
20129
],
[
17835
],
[
17748
],
[
43971
],
[
38177
],
[
31400
],
[
14905
],
[
20794
],
[
41384
],
[
29294
],
[
43972
],
[],
[
39785
],
[
28363
],
[
43973
],
[
43974
],
[],
[],
[],
[
43975
],
[
43976
],
[],
[],
[
43977
],
[
45630
],
[
32019
],
[
45644
],
[
16804
],
[
14253
],
[
13285
],
[
43978
],
[
44226
],
[
33987,
5056
],
[
44219
],
[],
[
4990,
4991,
43980
],
[
43979,
43981
],
[
4787
],
[
43982
],
[
43983,
5072
],
[
5050
],
[
45354
],
[
43984
],
[],
[
43985
],
[
4686
],
[
4688
],
[
4696
],
[],
[
43986
],
[
4992
],
[
43987,
4788
],
[
13341
],
[
6707
],
[
13631
],
[
13320
],
[
13463
],
[
6795
],
[
6706
],
[],
[
13738
],
[
43988
],
[
43989
],
[
43990
],
[
42317
],
[
11917
],
[
11900
],
[],
[
12143
],
[
12123
],
[
12112
],
[],
[
12079
],
[
30785
],
[
44664
],
[
11932
],
[
11808
],
[
11904
],
[
12151
],
[
46762
],
[
11919
],
[
30782
],
[],
[],
[
11788
],
[
12121
],
[
11958
],
[
12068
],
[
11778
],
[
11929
],
[
12153
],
[
12095
],
[
12096
],
[
12154
],
[
11283
],
[],
[
20867
],
[],
[
33027
],
[
43992,
43991
],
[
3406
],
[
5166
],
[
43993
],
[
43994
],
[
43995
],
[
5610
],
[
10990
],
[
5989
],
[
43219
],
[
45314
],
[
5503
],
[
5505
],
[
5201
],
[
9945
],
[],
[
47735
],
[],
[
43996
],
[
43997
],
[
43998
],
[],
[
43999
],
[
44000
],
[],
[
47988
],
[],
[
7844
],
[
10988
],
[
44001
],
[],
[],
[
13325,
13345
],
[],
[
13520
],
[
44002
],
[],
[
4527
],
[
32923
],
[
30169
],
[
4147
],
[
46779
],
[
6357
],
[],
[
6155
],
[
44003
],
[
40833
],
[
44004
],
[
44005
],
[],
[
44006
],
[],
[
4134
],
[],
[
35826
],
[
43578
],
[],
[
44617
],
[
30572,
32994
],
[
44003
],
[
30159
],
[
30154
],
[],
[
30160
],
[
44007,
44008
],
[
44009
],
[
44010
],
[
35557
],
[
4089
],
[
44011
],
[
44012
],
[],
[
44497
],
[
6465
],
[
44013
],
[
44453
],
[],
[
6374
],
[],
[
25005
],
[
6332
],
[
3283
],
[
6093
],
[],
[
6401
],
[
6485
],
[
30718
],
[],
[
5227
],
[],
[
5408
],
[],
[],
[],
[
5189
],
[
5561
],
[
5182
],
[
5393
],
[
5572
],
[
5181
],
[],
[],
[],
[],
[],
[
5233
],
[],
[
5309
],
[
5352
],
[
5339
],
[
5306
],
[],
[],
[],
[],
[
5531
],
[],
[],
[],
[],
[
5449
],
[
5549
],
[],
[
5351
],
[
5292,
5293
],
[
5529
],
[],
[],
[],
[
5557
],
[],
[],
[],
[
5462
],
[
5532
],
[
5521
],
[
5579
],
[],
[
5601
],
[],
[
5286
],
[
5537
],
[],
[
5560
],
[
5285
],
[
5180
],
[
5562
],
[
5387
],
[
5261
],
[],
[
44014
],
[
5200
],
[],
[
5416,
5417
],
[],
[
5312
],
[],
[],
[
5491
],
[],
[],
[
5580
],
[
5343
],
[
5440,
5441
],
[
5419
],
[
5602
],
[
5545
],
[
5436
],
[],
[
5353,
5354
],
[
5581
],
[],
[],
[],
[],
[
5301
],
[],
[
5231,
5230
],
[
5589
],
[],
[
5492
],
[
5600
],
[],
[],
[],
[
5287
],
[],
[
5388
],
[
5551
],
[
5322
],
[
5566,
5567
],
[],
[],
[
5488
],
[],
[
5457
],
[
5577
],
[
5229
],
[
5297,
5298
],
[
5582
],
[
5307,
5308
],
[
5395,
5396
],
[
5400,
5401
],
[],
[
5185
],
[
5421
],
[
5521
],
[
5456
],
[],
[
5328
],
[],
[],
[],
[],
[],
[],
[],
[
5546
],
[],
[],
[],
[],
[],
[
5569
],
[
35284
],
[],
[
5535
],
[
5326
],
[
5603
],
[],
[],
[
5596,
5597
],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[
5418
],
[
5487
],
[],
[
5288
],
[],
[
5347
],
[
5484
],
[
5407
],
[],
[
5225,
5224
],
[],
[
5344,
5345
],
[],
[
5295,
5296
],
[
5284
],
[
5586,
5585
],
[
44015
],
[
5186
],
[
5578
],
[
5540
],
[
5356
],
[],
[],
[
5538
],
[
5184
],
[],
[
44016
],
[
5262
],
[
5310,
5311
],
[
5419
],
[
5526
],
[
5541
],
[
5550
],
[],
[
5303
],
[],
[
5228,
5291
],
[
5482
],
[
5338
],
[
5402
],
[
5437
],
[],
[
5263
],
[
5412
],
[],
[],
[
5323,
5325,
5324
],
[],
[],
[],
[],
[],
[
5282,
5283
],
[],
[
5415
],
[],
[
5445
],
[],
[
5599,
5598
],
[],
[],
[],
[],
[
5342
],
[],
[],
[
5489
],
[],
[],
[],
[],
[],
[
5583
],
[
5527
],
[
5420
],
[
5483
],
[
5346
],
[
44017
],
[
5300
],
[
5294
],
[
5226
],
[
44018
],
[
5351
],
[],
[
5232
],
[],
[
5435
],
[
5485,
5486
],
[
5553
],
[
5305
],
[
5422
],
[],
[
5584
],
[
5348
],
[],
[],
[
5281
],
[
5410,
5411
],
[
5453
],
[],
[],
[],
[],
[],
[
5199
],
[],
[
5604
],
[
5447
],
[],
[
5314
],
[
5542
],
[
5525
],
[],
[],
[
5304
],
[],
[
5414
],
[],
[
5398
],
[
5455
],
[
5536
],
[],
[
5392
],
[
5399
],
[
5221,
5223,
5222
],
[
5448
],
[
44019
],
[
44020,
5147
],
[],
[
5290
],
[],
[
5564
],
[
5327
],
[
5571
],
[
5552
],
[],
[],
[
5523,
5522,
5524
],
[
5337
],
[
5442
],
[],
[],
[
5406,
5405
],
[
5561
],
[],
[
5595
],
[],
[],
[
5544
],
[
5183
],
[
5547
],
[],
[
5587,
5588
],
[
5543
],
[
5528
],
[],
[
5450
],
[
5434
],
[
47775
],
[
5559
],
[
5302
],
[],
[
5555
],
[],
[
5438,
5439
],
[
5548
],
[
5590
],
[],
[],
[
5565
],
[],
[],
[
5563
],
[
5490
],
[
5568
],
[
5556
],
[],
[
5533
],
[
5558
],
[
5258,
5259
],
[],
[
5175
],
[
5340,
5341
],
[],
[],
[],
[
5534
],
[
5554
],
[
5530
],
[
5289,
5350
],
[],
[
5539
],
[
5187
],
[],
[],
[],
[
5475
],
[],
[
5433
],
[
5474
],
[
5477
],
[],
[
5204
],
[],
[
5429
],
[],
[],
[
5260
],
[
5476
],
[],
[
5479
],
[],
[],
[
5432
],
[
5478
],
[
44021
],
[],
[],
[
5430
],
[
5480
],
[
5428,
5148
],
[
5431
],
[],
[
44022
],
[],
[],
[],
[],
[
44023
],
[
33464
],
[
13638
],
[
7864
],
[
44024
],
[
13460
],
[
13544
],
[
32622
],
[
38801
],
[
16508
],
[
16510
],
[
46250
],
[
29181
],
[
13859
],
[
15266
],
[
39769
],
[
44025
],
[
19200
],
[
44026
],
[
44027
],
[],
[],
[
7988
],
[
44028,
7926
],
[],
[
5055
],
[
19241
],
[
24931
],
[
14227
],
[],
[],
[
20799
],
[
44029
],
[
9725
],
[],
[],
[
38757
],
[],
[
44030
],
[],
[
44031
],
[],
[],
[
44032
],
[],
[
44033
],
[],
[],
[],
[
44034
],
[
40314
],
[],
[
44035
],
[],
[],
[
29330
],
[],
[
44036
],
[
31785
],
[],
[],
[],
[
44037
],
[
14172
],
[
30320
],
[
13706
],
[
44038
],
[
18311
],
[
16138
],
[
14188
],
[],
[
44039
],
[],
[],
[
16158
],
[],
[
30309
],
[
16232
],
[],
[
16207
],
[
15929
],
[],
[
30329,
40253
],
[
16137
],
[],
[
16298
],
[],
[],
[],
[
44040
],
[
44649
],
[
19304
],
[
41583
],
[
44041
],
[
14264
],
[
40047
],
[
44479
],
[
35959
],
[
3640
],
[
4581
],
[
19603
],
[
3373
],
[
6026
],
[
44042
],
[
44043
],
[
5685
],
[
44044
],
[],
[
44045
],
[
5766
],
[
5518
],
[
21427
],
[
27013
],
[
19159
],
[
36737
],
[
18036
],
[],
[
18297
],
[
18175
],
[
18006
],
[],
[
17986
],
[
44046
],
[
18090
],
[],
[
18351
],
[
20208
],
[
18229
],
[
18114
],
[
18350
],
[],
[
18067
],
[],
[],
[],
[],
[],
[
18353
],
[],
[],
[
18186
],
[],
[],
[
44047
],
[
35055
],
[
19023
],
[
5274
],
[
19759
],
[],
[],
[
38736
],
[
18978
],
[
44887
],
[
38021
],
[
19359
],
[
44048
],
[
44049
],
[
19360
],
[],
[
44050
],
[
28579
],
[
32507
],
[
4467
],
[
13420
],
[
13025
],
[],
[
9943
],
[
12821
],
[],
[],
[
19326
],
[
30024
],
[
42702
],
[
33903
],
[
629
],
[
606,
628
],
[
44051
],
[
30344
],
[
31744
],
[
18110
],
[
25496
],
[
44052
],
[
15947
],
[
14826
],
[
33042
],
[
20439
],
[
44053
],
[
40357
],
[
44054
],
[
9722
],
[
44704
],
[
22021
],
[
44055
],
[
25006
],
[
44056
],
[
44057
],
[
22778
],
[
10357
],
[
38284,
34602
],
[
10361,
26731
],
[
44058
],
[
44060,
44059
],
[],
[],
[
11259
],
[],
[
44062,
44061
],
[
44063
],
[
44064
],
[
46666,
26719
],
[
44065
],
[
44066
],
[],
[
44067
],
[],
[],
[
44068
],
[
44069
],
[
25315
],
[
44070
],
[
36160
],
[
44071
],
[
19669
],
[
38534
],
[
17901
],
[
44072
],
[
34948
],
[
12329
],
[
12663
],
[
12639
],
[
12391
],
[
41577
],
[],
[],
[
44073
],
[
44074
],
[],
[],
[],
[],
[
42130
],
[],
[],
[],
[
34657
],
[],
[],
[
26339
],
[],
[
44075
],
[],
[],
[],
[
33907
],
[
10062
],
[
28287
],
[],
[],
[],
[
5958
],
[],
[
44076
],
[
41410
],
[
44077
],
[],
[
45456
],
[
44078
],
[],
[],
[
44079
],
[],
[
44080
],
[
44081
],
[
33208
],
[],
[
39030
],
[
45400
],
[
44082
],
[
44083
],
[
35993
],
[],
[],
[],
[],
[],
[
31606
],
[
5526
],
[
37869
],
[
47766
],
[
31828
],
[
44084
],
[
4598
],
[],
[
47763
],
[
45289
],
[
44085
],
[],
[
44792
],
[
44086
],
[
44087
],
[],
[
40599
],
[
44088
],
[],
[
32153
],
[
44089
],
[
44090
],
[
44091
],
[
44092
],
[
44093
],
[
44094
],
[
38151
],
[
39713
],
[
44095
],
[],
[
47771
],
[
45324,
39988
],
[],
[
44096
],
[
44097
],
[],
[],
[],
[
41386
],
[
38121
],
[
44528
],
[
46103
],
[],
[],
[
32660
],
[
35834
],
[
32155
],
[],
[
32625
],
[
44098
],
[
28577,
31249
],
[
44551
],
[
32154
],
[
44099
],
[],
[
45634
],
[],
[
44100
],
[
44101
],
[
44102
],
[
40202
],
[],
[
44103
],
[
44104
],
[
44105
],
[],
[
44106
],
[],
[
44975
],
[
5292
],
[
44107
],
[],
[
44108
],
[
44109
],
[],
[],
[],
[],
[
32144
],
[
44110
],
[
30181
],
[
43456
],
[
44111
],
[
39875
],
[],
[
39517
],
[
19727
],
[
32123
],
[
44112
],
[
21571
],
[
26803
],
[
1730
],
[
1829
],
[
1837
],
[
1811
],
[
43667
],
[
43506
],
[
44115
],
[
44113
],
[
44114
],
[
43462
],
[
43519
],
[
45859
],
[
45860
],
[
11644
],
[
18895
],
[
18896
],
[
18879
],
[
18894
],
[
18877,
18874,
18878
],
[],
[
41411
],
[
1989
],
[
19832
],
[],
[
19934
],
[
19469
],
[
19853
],
[
19873
],
[
3502
],
[
44116
],
[
18888
],
[
27014
],
[
33312,
41156
],
[],
[
44117
],
[
13356
],
[
13454
],
[
44118
],
[],
[
7715
],
[],
[
44119
],
[
32949
],
[],
[
46621
],
[],
[],
[],
[],
[],
[
44120
],
[],
[
7714
],
[
34218
],
[],
[
7716
],
[],
[],
[],
[],
[
7953
],
[
8106
],
[
13754
],
[
44563
],
[
4676
],
[
4997
],
[
44121
],
[],
[
13332
],
[],
[
46281
],
[],
[],
[
34743
],
[
21655
],
[],
[],
[],
[],
[
44122
],
[],
[],
[],
[
44123
],
[],
[
44124
],
[
44125
],
[],
[],
[],
[],
[],
[
44126
],
[],
[],
[],
[],
[
44127
],
[],
[
44129
],
[
44128
],
[],
[
36707
],
[],
[],
[],
[
38540
],
[
44130
],
[],
[],
[
44131
],
[
44132
],
[
27814
],
[
38208
],
[
44133
],
[
44134
],
[
38209
],
[],
[
30106
],
[],
[
6589
],
[],
[
3241
],
[
5827
],
[],
[],
[
3291
],
[],
[],
[
6217
],
[
3201
],
[
3272
],
[],
[
3170
],
[
3209
],
[
6372
],
[],
[],
[],
[
6272
],
[],
[
13404
],
[],
[
28619
],
[
44136
],
[
44135
],
[
30123
],
[
36894
],
[
44137
],
[
44138
],
[
44139
],
[
44140
],
[
28544
],
[
44141
],
[
46800
],
[
44142
],
[
13721
],
[
13644
],
[
13295
],
[],
[],
[],
[],
[],
[],
[],
[
13350
],
[],
[],
[
6673
],
[
13312
],
[],
[],
[
13473,
13493
],
[],
[],
[
6809
],
[],
[],
[],
[
13321
],
[
40239
],
[
7273,
7259
],
[
7274
],
[
20085
],
[
6677
],
[],
[],
[],
[
7314
],
[
44143
],
[
7706
],
[
46474
],
[],
[
7520
],
[],
[
17555
],
[
23411
],
[
47969,
33874,
39792
],
[
13196
],
[
13014
],
[],
[
21442
],
[
17407
],
[
15295
],
[
10309
],
[
7781
],
[
7984
],
[
16774
],
[
41796
],
[
44144
],
[
39968
],
[
36858
],
[
44145
],
[
44146
],
[],
[],
[
44147
],
[
44148
],
[
44149,
7112
],
[
44150
],
[],
[],
[
44151
],
[],
[
44152,
7270
],
[],
[
44153
],
[],
[
22255
],
[],
[
44154
],
[
32838,
41310
],
[
44155
],
[],
[
44156
],
[],
[
44157
],
[],
[
44158
],
[],
[
44159
],
[
7641
],
[],
[
26239
],
[],
[],
[],
[
7643
],
[
7272
],
[],
[],
[],
[
27338
],
[
44160
],
[
7640
],
[
44161
],
[
7271
],
[],
[
44162
],
[
7639
],
[],
[],
[
44163
],
[
44164
],
[
47902
],
[
7127,
39476
],
[],
[],
[
44165,
44166
],
[
44167
],
[
7268,
7269
],
[],
[
44168
],
[
44169
],
[],
[],
[
7126
],
[],
[
44171,
44170
],
[
44147
],
[
44172
],
[
37340,
46931
],
[
13316
],
[
5051
],
[
7774
],
[
4659
],
[
4830
],
[
44173
],
[
599
],
[
41129
],
[
29997
],
[
28682
],
[],
[
33097
],
[
44174
],
[
26340
],
[
599
],
[
45049
],
[
34129
],
[
477
],
[
44175
],
[
21463
],
[
44176
],
[
495
],
[],
[
24783
],
[
44177
],
[
21367
],
[
24175
],
[
42355,
45048
],
[
22022
],
[
27339
],
[
591
],
[
17910
],
[],
[
44178
],
[
33074
],
[
44179
],
[
44180
],
[
43808
],
[
39252
],
[
44181
],
[
44182
],
[
32837
],
[
16467
],
[
14094
],
[
33110
],
[
41250
],
[
13262
],
[
48168
],
[],
[],
[],
[
30219
],
[
16714
],
[
44183
],
[],
[
44184
],
[
15939
],
[
44185
],
[
44186
],
[
12946
],
[
20364
],
[
17065
],
[],
[],
[
29668
],
[
4314
],
[],
[
16674
],
[
14131,
14159
],
[
14057
],
[],
[],
[],
[
14149
],
[
14228
],
[],
[
16544
],
[
16686
],
[],
[
14107
],
[
16401
],
[
16599
],
[
16421
],
[],
[],
[
14226
],
[],
[],
[
14077
],
[
16559
],
[
16712
],
[],
[],
[
16488
],
[
16387
],
[],
[
16400
],
[],
[
14123
],
[
16702
],
[
16460
],
[],
[
16485
],
[],
[
16395
],
[
16377
],
[
44187
],
[],
[],
[],
[
44188
],
[
15824
],
[
16352
],
[
30434
],
[
16604
],
[
30315
],
[
16790
],
[
3581
],
[
20823
],
[
44189
],
[
44190
],
[
44191
],
[
6233
],
[
16430
],
[],
[
29408
],
[],
[
14260
],
[],
[],
[],
[
43092
],
[
30379
],
[
30380
],
[
14035
],
[
31980
],
[
16381
],
[
44192
],
[],
[
20758,
20745
],
[],
[],
[
15245
],
[],
[],
[
36080
],
[],
[
20717
],
[
44193
],
[
44194
],
[
14073
],
[
44034
],
[
36732
],
[
16391
],
[],
[],
[],
[],
[
13089
],
[
12975
],
[],
[
46951
],
[
44196
],
[
44195
],
[
15624
],
[
15626
],
[],
[
15798
],
[
46812,
15799
],
[
40209,
39316,
15800
],
[
15628
],
[
44197
],
[
15508
],
[
15625
],
[
15627
],
[],
[
37599
],
[
42874
],
[
20650
],
[
13951
],
[
16638
],
[
44198
],
[],
[],
[],
[],
[],
[
13457
],
[
16432
],
[
6871
],
[],
[],
[],
[
44935,
35634
],
[],
[],
[],
[
44199
],
[
5996
],
[
29965
],
[],
[
44200
],
[],
[],
[
9784
],
[],
[],
[],
[
9833
],
[
24237
],
[
15403,
15404
],
[
44201
],
[
15407,
15405,
15406
],
[
15341
],
[
24441
],
[
24357
],
[
40344
],
[
31100
],
[
44202
],
[],
[
21909
],
[
20220
],
[
17993
],
[],
[],
[],
[],
[
44203
],
[],
[],
[
18288
],
[
17937
],
[
17959
],
[
17902
],
[
44204
],
[
17907
],
[
20540
],
[
17178
],
[
19632
],
[
17883
],
[],
[
44205
],
[
26791
],
[
18118
],
[
48340
],
[
12911
],
[
48137
],
[
44206
],
[
48374
],
[
9740
],
[
44207
],
[],
[
45103
],
[
6553
],
[
6850
],
[
10641
],
[
47081
],
[
17195
],
[
5780
],
[
31299
],
[
45418
],
[],
[
44213
],
[
45450
],
[
45652
],
[
44208
],
[
44209
],
[
41354
],
[],
[
44210
],
[
43946
],
[
44211
],
[
44212
],
[
44213
],
[],
[
31795
],
[
39731
],
[
40327
],
[
45419,
33343
],
[
45617
],
[
43945
],
[
45260
],
[
44214
],
[
39045
],
[],
[],
[
44215
],
[],
[
31916
],
[
44524
],
[
31834
],
[
44216
],
[
44217
],
[],
[
44218
],
[],
[
44219
],
[
44220
],
[
6117
],
[
44221
],
[
44222
],
[
47785
],
[
44223
],
[
44224,
4608
],
[
44226,
44225
],
[
44227
],
[
35000
],
[
44228
],
[],
[
44229
],
[
4979
],
[
39708
],
[
32275
],
[
33522
],
[
5621
],
[
5359
],
[
5498
],
[
5361
],
[
45317
],
[
44284
],
[
44230
],
[
12877
],
[
17206
],
[
4321
],
[
44231
],
[
44232
],
[
44233
],
[],
[
44234
],
[
10736
],
[],
[
44235
],
[
46967
],
[],
[
12936
],
[
44236
],
[
48100
],
[
44237
],
[],
[
44238
],
[],
[
44239
],
[],
[],
[],
[],
[],
[
44240
],
[],
[],
[
44241
],
[],
[],
[
44242
],
[
19714
],
[
19603
],
[
19641
],
[
19551
],
[
19621
],
[],
[],
[
11220
],
[
10738
],
[
11213
],
[
10860
],
[
4351
],
[
4246
],
[
44243
],
[
3639
],
[
12631
],
[
12357
],
[
12630
],
[],
[
48222
],
[
30885
],
[
39168
],
[],
[],
[],
[],
[
38982
],
[
46922
],
[
44244
],
[
44245
],
[
30693
],
[
44247,
44246
],
[],
[],
[
44248
],
[
44249
],
[],
[],
[],
[],
[
44250
],
[
44251
],
[
46921
],
[
43255
],
[],
[
35673
],
[
44252
],
[
31090
],
[
35500
],
[],
[
44253
],
[],
[
35336
],
[
36517
],
[],
[],
[],
[],
[],
[
44254
],
[],
[
29942
],
[],
[],
[
44255
],
[],
[],
[],
[],
[
44256
],
[],
[],
[],
[
44257
],
[],
[
44667
],
[],
[],
[
30645
],
[],
[
40826
],
[
44258
],
[],
[],
[
44259
],
[],
[],
[],
[],
[
35580
],
[
31315
],
[
43620
],
[
35087
],
[],
[
44260
],
[],
[
44261
],
[
32211
],
[
39850
],
[
31278
],
[
44262
],
[],
[
40669
],
[],
[],
[],
[],
[],
[],
[],
[
44008
],
[],
[
30791
],
[
43049
],
[],
[
34648
],
[],
[
44264
],
[
44263
],
[
44266,
44265
],
[
44267
],
[
44268
],
[
44269
],
[],
[],
[],
[],
[],
[],
[
44270
],
[],
[],
[],
[],
[
44271
],
[
44272
],
[],
[],
[
46861
],
[
33391
],
[
44273
],
[],
[
41097
],
[],
[
44274
],
[],
[],
[
31097
],
[
29941
],
[],
[],
[
44275
],
[
44276
],
[],
[
44277
],
[
31053
],
[
37335
],
[
44278
],
[],
[
30692
],
[],
[],
[],
[
44280,
44279
],
[],
[],
[
41091
],
[],
[],
[
35177,
27964
],
[],
[
44281
],
[],
[
38598
],
[],
[],
[],
[
33772
],
[
37061
],
[
44282
],
[
44283
],
[
37298
],
[
34647
],
[
38416
],
[
34042
],
[
43253
],
[
42951
],
[
44284
],
[],
[
44285
],
[
43147
],
[],
[],
[],
[],
[],
[],
[
44287,
44288,
44286
],
[],
[],
[
44289
],
[
36849
],
[
44290
],
[
33769
],
[],
[
31280
],
[],
[
43866
],
[],
[
30786
],
[],
[],
[],
[],
[],
[],
[],
[
42298
],
[
44292,
44291
],
[
40732
],
[
39121
],
[
44293,
44294
],
[
44295
],
[],
[],
[
44297,
44296
],
[],
[],
[
44298
],
[],
[],
[
44300,
44301,
44299
],
[],
[
44302
],
[
44303
],
[
44304
],
[],
[],
[
44305
],
[
44306
],
[
44308,
44307
],
[
35566
],
[
44309
],
[
44310
],
[
44312,
44311
],
[
44313
],
[
44314
],
[],
[
43254
],
[
44315
],
[],
[],
[
44316
],
[
44317
],
[],
[],
[],
[],
[
33054
],
[
32959
],
[],
[
40081
],
[],
[],
[],
[
44318
],
[],
[
44319
],
[],
[],
[
39047
],
[
39462
],
[],
[],
[],
[],
[
39451
],
[],
[
44320
],
[
44321
],
[],
[
44322
],
[],
[],
[
44323
],
[
44324
],
[],
[
44325
],
[
44326
],
[
44327
],
[
44328
],
[
44329
],
[
44330
],
[
44331
],
[
44332,
44333
],
[
44335,
44334
],
[
44336
],
[],
[
39210
],
[
40851,
42004
],
[],
[
39069
],
[
44337
],
[
46730
],
[],
[],
[
34576
],
[],
[
44338
],
[
44339
],
[
44340
],
[
37333
],
[],
[],
[
32902
],
[],
[
44342,
44341
],
[
44343
],
[
44344
],
[
44345
],
[],
[],
[
44346
],
[
44347,
44348
],
[
44350,
44349
],
[
44351
],
[
44352
],
[
44353
],
[],
[],
[
44354
],
[
44355
],
[
44356
],
[
44357
],
[
44358
],
[],
[
44359
],
[
44360
],
[
44361
],
[
44362
],
[
44363,
44364
],
[],
[],
[
44365
],
[],
[
33194
],
[
43089
],
[
44366
],
[],
[
31858,
39453
],
[],
[
44367
],
[],
[],
[
46864,
31065
],
[
31281
],
[],
[
41092
],
[],
[
44368
],
[
44369
],
[
44370
],
[],
[],
[
33195
],
[],
[
44371
],
[
44373,
44372
],
[
35925
],
[],
[],
[],
[
44374
],
[
44375
],
[
44376
],
[
44378,
44377
],
[
43042
],
[],
[
44379
],
[],
[],
[
44380
],
[
44382,
44381
],
[
44383
],
[
46037
],
[
29676
],
[
44384
],
[],
[],
[
44385
],
[],
[],
[
46022
],
[
44386
],
[],
[
43584
],
[
42900,
43126
],
[
39175
],
[],
[
39461
],
[
43585
],
[],
[
35556
],
[
32197
],
[
39802
],
[],
[
44387
],
[],
[],
[],
[
32277
],
[
37304
],
[
44388
],
[
30575,
32223
],
[],
[
37297
],
[
39179
],
[
44389
],
[],
[],
[],
[
44390
],
[
44391
],
[
44392
],
[
44393
],
[
31309,
42214
],
[],
[],
[],
[
39096
],
[],
[],
[
47046
],
[
35503
],
[],
[
43275
],
[],
[
39166
],
[],
[
32242
],
[
38544
],
[
30652
],
[
46897
],
[],
[
46714
],
[],
[],
[],
[
38600
],
[
36098
],
[],
[
33218
],
[],
[
40675
],
[
39313
],
[],
[
39124
],
[],
[
44395,
44394
],
[],
[],
[
44396,
44397
],
[
30920
],
[],
[
44585
],
[
44398
],
[],
[],
[
44399
],
[],
[],
[],
[
46889
],
[
44400
],
[],
[],
[],
[],
[
44633
],
[
30675
],
[
44401
],
[
35867
],
[],
[
42123
],
[
36123
],
[],
[],
[
39304
],
[],
[
44411
],
[
44402
],
[
33277
],
[
46942
],
[],
[],
[
32035
],
[],
[
44403
],
[
44352
],
[
40083
],
[],
[
39262
],
[
35869,
35310
],
[
44404
],
[
44405
],
[
33768
],
[
44407,
44406
],
[
44408
],
[
35577
],
[],
[
38593,
34369
],
[
30921
],
[],
[],
[],
[
35075,
35076,
40058
],
[
44409
],
[
44410
],
[
44411
],
[
44412
],
[],
[
44413
],
[
44414
],
[
44415
],
[
45119
],
[
44416
],
[],
[
44417
],
[
44418
],
[],
[
44419
],
[],
[],
[],
[
42021
],
[
43626
],
[
41110
],
[],
[],
[],
[],
[],
[],
[],
[
44420
],
[
44421
],
[
44422
],
[],
[
44423
],
[
44424
],
[],
[
44425
],
[
44426
],
[
43121
],
[
44427
],
[
42953
],
[
36851,
31219,
36850
],
[],
[
27632,
39308
],
[
31894
],
[],
[],
[
37337
],
[
42946
],
[],
[
44428
],
[
44429
],
[
44430
],
[],
[],
[
33301
],
[],
[],
[],
[
31099
],
[],
[
43155
],
[
46773
],
[],
[
38928
],
[
44431
],
[
43610
],
[],
[],
[
35926
],
[
44432
],
[
44433
],
[
33339
],
[],
[
44434
],
[],
[],
[],
[
44435
],
[],
[
39157
],
[],
[],
[],
[
42835
],
[],
[
35575
],
[
43599
],
[],
[],
[],
[
44436
],
[
44437
],
[],
[],
[],
[],
[],
[
44438
],
[
44440,
44439
],
[],
[],
[
44442,
44441
],
[],
[
44443
],
[
44444
],
[],
[],
[
44445
],
[
44447
],
[],
[
44446
],
[],
[
44448
],
[],
[
44449
],
[
44450,
44451
],
[],
[
44452
],
[
44453
],
[
44454,
44455
],
[],
[],
[
44456
],
[],
[],
[
44457
],
[],
[],
[
44458
],
[
37641
],
[
44459
],
[],
[
44460
],
[],
[],
[],
[
37892
],
[],
[
44461
],
[],
[
44462
],
[
44463
],
[],
[
44464
],
[],
[],
[
44465
],
[
44466,
44467
],
[],
[],
[
44468,
44470,
44469
],
[
44471,
44472
],
[
44473
],
[],
[
44474
],
[
44475
],
[
44477,
44476
],
[
44479,
44478
],
[
44480,
44481
],
[
44482
],
[
44483
],
[
44484,
44487,
44486,
44485
],
[
44488,
44489
],
[
44490
],
[
44491
],
[
44492
],
[],
[],
[],
[
44493,
44494
],
[],
[],
[
44495
],
[],
[
44496
],
[
44497
],
[
31903
],
[
44498
],
[
44499
],
[
44500
],
[
38061
],
[
40832
],
[],
[
44501
],
[
44502
],
[
44503
],
[
44504
],
[],
[
46838
],
[
30006
],
[],
[],
[
44505
],
[],
[],
[
9965
],
[
35279
],
[
12602
],
[],
[
12330
],
[],
[
12709
],
[
43358,
30771
],
[
3394
],
[
4981
],
[
44506
],
[
44507
],
[
40001
],
[
5060
],
[
44508
],
[
5449
],
[
25007
],
[
45439
],
[
44509
],
[
43981
],
[
6001
],
[
44510
],
[
44511
],
[
44512
],
[
44513
],
[
45677
],
[
45482
],
[
45487
],
[
44514
],
[
29534,
45512
],
[
3418
],
[
44515
],
[
39104
],
[],
[],
[
5149,
5472
],
[],
[],
[
44021
],
[],
[],
[],
[
5473
],
[
44516
],
[
3388
],
[],
[
45433
],
[
44517
],
[],
[
44518
],
[
44519
],
[
44520
],
[
44521
],
[],
[],
[
45378
],
[
5134
],
[
44522,
44523
],
[
44524
],
[],
[],
[
44525
],
[
44526
],
[
44527
],
[],
[
44528
],
[
44529
],
[
36152
],
[],
[],
[
44530
],
[
44531
],
[
44533,
44532
],
[],
[
44534
],
[],
[
44900
],
[],
[
44535
],
[
44536
],
[
44537
],
[
44538
],
[],
[
44539
],
[
45428
],
[],
[
39717
],
[
42797
],
[
22779
],
[
36022
],
[
44541,
44540
],
[],
[
33131
],
[],
[
43854
],
[],
[
44542
],
[
36573,
21931
],
[],
[
38740
],
[
5837
],
[
44543
],
[
31801
],
[
5750
],
[
5651
],
[
40897
],
[],
[
44544
],
[
44545
],
[],
[
4784
],
[],
[
44546
],
[],
[
44547
],
[
44212
],
[
46529
],
[
44548
],
[
5601
],
[
5174
],
[
5173
],
[
29658
],
[
39113
],
[
44549
],
[
44550
],
[],
[
5148
],
[
5321
],
[
4782
],
[
3374
],
[],
[
6097
],
[],
[
44551
],
[],
[
44552
],
[],
[],
[],
[
44553
],
[],
[],
[
45285
],
[
44554
],
[
4744
],
[
44555
],
[
3453
],
[],
[
44210
],
[
4627
],
[],
[],
[
44556
],
[
45295
],
[
44557
],
[],
[],
[
5128,
5155
],
[],
[],
[
44558
],
[],
[],
[],
[
33511
],
[],
[],
[],
[],
[
12161
],
[
24283
],
[],
[
43987
],
[],
[],
[
4785
],
[
44559
],
[],
[],
[
4673
],
[
44560
],
[],
[
24043
],
[],
[],
[
26671
],
[
44561
],
[
44562
],
[],
[],
[],
[
44563
],
[
44564
],
[
44565,
4672
],
[
44566
],
[],
[
44567
],
[],
[],
[
27523
],
[
4734,
44561,
36371
],
[
44568
],
[],
[],
[
4675
],
[
45366
],
[
5323
],
[
5860
],
[
13523
]
]
scriptLoaded('dwr_db_I_fams_20.js');
|
gpl-3.0
|
Phalynx/WOT-Statistics
|
Solution/WOT.Stats/Scripts/sorttable.js
|
15446
|
/*
SortTable
version 2
7th April 2007
Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/
Instructions:
Download this file
Add <script src="sorttable.js"></script> to your HTML
Add class="sortable" to any table you'd like to make sortable
Click on the headers to sort
Thanks to many, many people for contributions and suggestions.
Licenced as X11: http://www.kryogenix.org/code/browser/licence.html
This basically means: do what you want with it.
*/
var stIsIE = /*@cc_on!@*/false;
sorttable = {
init: function() {
// quit if this function has already been called
if (arguments.callee.done) return;
// flag this function so we don't do the same thing twice
arguments.callee.done = true;
// kill the timer
if (_timer) clearInterval(_timer);
if (!document.createElement || !document.getElementsByTagName) return;
sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/;
forEach(document.getElementsByTagName('table'), function(table) {
if (table.className.search(/\bsortable\b/) != -1) {
sorttable.makeSortable(table);
}
});
},
makeSortable: function(table) {
if (table.getElementsByTagName('thead').length == 0) {
// table doesn't have a tHead. Since it should have, create one and
// put the first table row in it.
the = document.createElement('thead');
the.appendChild(table.rows[0]);
table.insertBefore(the,table.firstChild);
}
// Safari doesn't support table.tHead, sigh
if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0];
if (table.tHead.rows.length != 1) return; // can't cope with two header rows
// Sorttable v1 put rows with a class of "sortbottom" at the bottom (as
// "total" rows, for example). This is B&R, since what you're supposed
// to do is put them in a tfoot. So, if there are sortbottom rows,
// for backwards compatibility, move them to tfoot (creating it if needed).
sortbottomrows = [];
for (var i=0; i<table.rows.length; i++) {
if (table.rows[i].className.search(/\bsortbottom\b/) != -1) {
sortbottomrows[sortbottomrows.length] = table.rows[i];
}
}
if (sortbottomrows) {
if (table.tFoot == null) {
// table doesn't have a tfoot. Create one.
tfo = document.createElement('tfoot');
table.appendChild(tfo);
}
for (var i=0; i<sortbottomrows.length; i++) {
tfo.appendChild(sortbottomrows[i]);
}
delete sortbottomrows;
}
// work through each column and calculate its type
headrow = table.tHead.rows[0].cells;
for (var i=0; i<headrow.length; i++) {
// manually override the type with a sorttable_type attribute
if (!headrow[i].className.match(/\bsorttable_nosort\b/)) { // skip this col
mtch = headrow[i].className.match(/\bsorttable_([a-z0-9]+)\b/);
if (mtch) { override = mtch[1]; }
if (mtch && typeof sorttable["sort_"+override] == 'function') {
headrow[i].sorttable_sortfunction = sorttable["sort_"+override];
} else {
headrow[i].sorttable_sortfunction = sorttable.guessType(table,i);
}
// make it clickable to sort
headrow[i].sorttable_columnindex = i;
headrow[i].sorttable_tbody = table.tBodies[0];
dean_addEvent(headrow[i],"click", function(e) {
if (this.className.search(/\bsorttable_sorted\b/) != -1) {
// if we're already sorted by this column, just
// reverse the table, which is quicker
sorttable.reverse(this.sorttable_tbody);
this.className = this.className.replace('sorttable_sorted',
'sorttable_sorted_reverse');
this.removeChild(document.getElementById('sorttable_sortfwdind'));
sortrevind = document.createElement('span');
sortrevind.id = "sorttable_sortrevind";
sortrevind.innerHTML = stIsIE ? ' <font face="webdings">6</font>' : ' ▴';
this.appendChild(sortrevind);
return;
}
if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) {
// if we're already sorted by this column in reverse, just
// re-reverse the table, which is quicker
sorttable.reverse(this.sorttable_tbody);
this.className = this.className.replace('sorttable_sorted_reverse',
'sorttable_sorted');
this.removeChild(document.getElementById('sorttable_sortrevind'));
sortfwdind = document.createElement('span');
sortfwdind.id = "sorttable_sortfwdind";
sortfwdind.innerHTML = stIsIE ? ' <font face="webdings">5</font>' : ' ▾';
this.appendChild(sortfwdind);
return;
}
// remove sorttable_sorted classes
theadrow = this.parentNode;
forEach(theadrow.childNodes, function(cell) {
if (cell.nodeType == 1) { // an element
cell.className = cell.className.replace('sorttable_sorted_reverse','');
cell.className = cell.className.replace('sorttable_sorted','');
}
});
sortfwdind = document.getElementById('sorttable_sortfwdind');
if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); }
sortrevind = document.getElementById('sorttable_sortrevind');
if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); }
this.className += ' sorttable_sorted';
sortfwdind = document.createElement('span');
sortfwdind.id = "sorttable_sortfwdind";
sortfwdind.innerHTML = stIsIE ? ' <font face="webdings">5</font>' : ' ▾';
this.appendChild(sortfwdind);
// build an array to sort. This is a Schwartzian transform thing,
// i.e., we "decorate" each row with the actual sort key,
// sort based on the sort keys, and then put the rows back in order
// which is a lot faster because you only do getInnerText once per row
row_array = [];
col = this.sorttable_columnindex;
rows = this.sorttable_tbody.rows;
for (var j=0; j<rows.length; j++) {
row_array[row_array.length] = [sorttable.getInnerText(rows[j].cells[col]), rows[j]];
}
/* If you want a stable sort, uncomment the following line */
//sorttable.shaker_sort(row_array, this.sorttable_sortfunction);
/* and comment out this one */
row_array.sort(this.sorttable_sortfunction);
tb = this.sorttable_tbody;
for (var j=0; j<row_array.length; j++) {
tb.appendChild(row_array[j][1]);
}
delete row_array;
});
}
}
},
guessType: function(table, column) {
// guess the type of a column based on its first non-blank row
sortfn = sorttable.sort_alpha;
for (var i=0; i<table.tBodies[0].rows.length; i++) {
text = sorttable.getInnerText(table.tBodies[0].rows[i].cells[column]);
if (text != '') {
if (text.match(/^-?[£$¤]?[\d,.]+%?$/)) {
return sorttable.sort_numeric;
}
// check for a date: dd/mm/yyyy or dd/mm/yy
// can have / or . or - as separator
// can be mm/dd as well
possdate = text.match(sorttable.DATE_RE)
if (possdate) {
// looks like a date
first = parseInt(possdate[1]);
second = parseInt(possdate[2]);
if (first > 12) {
// definitely dd/mm
return sorttable.sort_ddmm;
} else if (second > 12) {
return sorttable.sort_mmdd;
} else {
// looks like a date, but we can't tell which, so assume
// that it's dd/mm (English imperialism!) and keep looking
sortfn = sorttable.sort_ddmm;
}
}
}
}
return sortfn;
},
getInnerText: function(node) {
// gets the text we want to use for sorting for a cell.
// strips leading and trailing whitespace.
// this is *not* a generic getInnerText function; it's special to sorttable.
// for example, you can override the cell text with a customkey attribute.
// it also gets .value for <input> fields.
if (!node) return "";
hasInputs = (typeof node.getElementsByTagName == 'function') &&
node.getElementsByTagName('input').length;
if (node.getAttribute("sorttable_customkey") != null) {
return node.getAttribute("sorttable_customkey");
}
else if (typeof node.textContent != 'undefined' && !hasInputs) {
return node.textContent.replace(/^\s+|\s+$/g, '');
}
else if (typeof node.innerText != 'undefined' && !hasInputs) {
return node.innerText.replace(/^\s+|\s+$/g, '');
}
else if (typeof node.text != 'undefined' && !hasInputs) {
return node.text.replace(/^\s+|\s+$/g, '');
}
else {
switch (node.nodeType) {
case 3:
if (node.nodeName.toLowerCase() == 'input') {
return node.value.replace(/^\s+|\s+$/g, '');
}
case 4:
return node.nodeValue.replace(/^\s+|\s+$/g, '');
break;
case 1:
case 11:
var innerText = '';
for (var i = 0; i < node.childNodes.length; i++) {
innerText += sorttable.getInnerText(node.childNodes[i]);
}
return innerText.replace(/^\s+|\s+$/g, '');
break;
default:
return '';
}
}
},
reverse: function(tbody) {
// reverse the rows in a tbody
newrows = [];
for (var i=0; i<tbody.rows.length; i++) {
newrows[newrows.length] = tbody.rows[i];
}
for (var i=newrows.length-1; i>=0; i--) {
tbody.appendChild(newrows[i]);
}
delete newrows;
},
/* sort functions
each sort function takes two parameters, a and b
you are comparing a[0] and b[0] */
sort_numeric: function(a,b) {
aa = parseFloat(a[0].replace(/[^0-9.-]/g,''));
if (isNaN(aa)) aa = 0;
bb = parseFloat(b[0].replace(/[^0-9.-]/g,''));
if (isNaN(bb)) bb = 0;
return aa-bb;
},
sort_alpha: function(a,b) {
if (a[0]==b[0]) return 0;
if (a[0]<b[0]) return -1;
return 1;
},
sort_ddmm: function(a,b) {
mtch = a[0].match(sorttable.DATE_RE);
y = mtch[3]; m = mtch[2]; d = mtch[1];
if (m.length == 1) m = '0'+m;
if (d.length == 1) d = '0'+d;
dt1 = y+m+d;
mtch = b[0].match(sorttable.DATE_RE);
y = mtch[3]; m = mtch[2]; d = mtch[1];
if (m.length == 1) m = '0'+m;
if (d.length == 1) d = '0'+d;
dt2 = y+m+d;
if (dt1==dt2) return 0;
if (dt1<dt2) return -1;
return 1;
},
sort_mmdd: function(a,b) {
mtch = a[0].match(sorttable.DATE_RE);
y = mtch[3]; d = mtch[2]; m = mtch[1];
if (m.length == 1) m = '0'+m;
if (d.length == 1) d = '0'+d;
dt1 = y+m+d;
mtch = b[0].match(sorttable.DATE_RE);
y = mtch[3]; d = mtch[2]; m = mtch[1];
if (m.length == 1) m = '0'+m;
if (d.length == 1) d = '0'+d;
dt2 = y+m+d;
if (dt1==dt2) return 0;
if (dt1<dt2) return -1;
return 1;
},
shaker_sort: function(list, comp_func) {
// A stable sort function to allow multi-level sorting of data
// see: http://en.wikipedia.org/wiki/Cocktail_sort
// thanks to Joseph Nahmias
var b = 0;
var t = list.length - 1;
var swap = true;
while(swap) {
swap = false;
for(var i = b; i < t; ++i) {
if ( comp_func(list[i], list[i+1]) > 0 ) {
var q = list[i]; list[i] = list[i+1]; list[i+1] = q;
swap = true;
}
} // for
t--;
if (!swap) break;
for(var i = t; i > b; --i) {
if ( comp_func(list[i], list[i-1]) < 0 ) {
var q = list[i]; list[i] = list[i-1]; list[i-1] = q;
swap = true;
}
} // for
b++;
} // while(swap)
}
}
/* ******************************************************************
Supporting functions: bundled here to avoid depending on a library
****************************************************************** */
// Dean Edwards/Matthias Miller/John Resig
/* for Mozilla/Opera9 */
if (document.addEventListener) {
document.addEventListener("DOMContentLoaded", sorttable.init, false);
}
/* for Internet Explorer */
/*@cc_on @*/
/*@if (@_win32)
document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
var script = document.getElementById("__ie_onload");
script.onreadystatechange = function() {
if (this.readyState == "complete") {
sorttable.init(); // call the onload handler
}
};
/*@end @*/
/* for Safari */
if (/WebKit/i.test(navigator.userAgent)) { // sniff
var _timer = setInterval(function() {
if (/loaded|complete/.test(document.readyState)) {
sorttable.init(); // call the onload handler
}
}, 10);
}
/* for other browsers */
window.onload = sorttable.init;
// written by Dean Edwards, 2005
// with input from Tino Zijdel, Matthias Miller, Diego Perini
// http://dean.edwards.name/weblog/2005/10/add-event/
function dean_addEvent(element, type, handler) {
if (element.addEventListener) {
element.addEventListener(type, handler, false);
} else {
// assign each event handler a unique ID
if (!handler.$$guid) handler.$$guid = dean_addEvent.guid++;
// create a hash table of event types for the element
if (!element.events) element.events = {};
// create a hash table of event handlers for each element/event pair
var handlers = element.events[type];
if (!handlers) {
handlers = element.events[type] = {};
// store the existing event handler (if there is one)
if (element["on" + type]) {
handlers[0] = element["on" + type];
}
}
// store the event handler in the hash table
handlers[handler.$$guid] = handler;
// assign a global event handler to do all the work
element["on" + type] = handleEvent;
}
};
// a counter used to create unique IDs
dean_addEvent.guid = 1;
function removeEvent(element, type, handler) {
if (element.removeEventListener) {
element.removeEventListener(type, handler, false);
} else {
// delete the event handler from the hash table
if (element.events && element.events[type]) {
delete element.events[type][handler.$$guid];
}
}
};
function handleEvent(event) {
var returnValue = true;
// grab the event object (IE uses a global event object)
event = event || fixEvent(((this.ownerDocument || this.document || this).parentWindow || window).event);
// get a reference to the hash table of event handlers
var handlers = this.events[event.type];
// execute each event handler
for (var i in handlers) {
this.$$handleEvent = handlers[i];
if (this.$$handleEvent(event) === false) {
returnValue = false;
}
}
return returnValue;
};
function fixEvent(event) {
// add W3C standard event methods
event.preventDefault = fixEvent.preventDefault;
event.stopPropagation = fixEvent.stopPropagation;
return event;
};
fixEvent.preventDefault = function() {
this.returnValue = false;
};
fixEvent.stopPropagation = function() {
this.cancelBubble = true;
}
// Dean's forEach: http://dean.edwards.name/base/forEach.js
/*
forEach, version 1.0
Copyright 2006, Dean Edwards
License: http://www.opensource.org/licenses/mit-license.php
*/
// array-like enumeration
if (!Array.forEach) { // mozilla already supports this
Array.forEach = function(array, block, context) {
for (var i = 0; i < array.length; i++) {
block.call(context, array[i], i, array);
}
};
}
// generic enumeration
Function.prototype.forEach = function(object, block, context) {
for (var key in object) {
if (typeof this.prototype[key] == "undefined") {
block.call(context, object[key], key, object);
}
}
};
// character enumeration
String.forEach = function(string, block, context) {
Array.forEach(string.split(""), function(chr, index) {
block.call(context, chr, index, string);
});
};
// globally resolve forEach enumeration
var forEach = function(object, block, context) {
if (object) {
var resolve = Object; // default
if (object instanceof Function) {
// functions have a "length" property
resolve = Function;
} else if (object.forEach instanceof Function) {
// the object implements a custom forEach method so use that
object.forEach(block, context);
return;
} else if (typeof object == "string") {
// the object is a string
resolve = String;
} else if (typeof object.length == "number") {
// the object is array-like
resolve = Array;
}
resolve.forEach(object, block, context);
}
};
|
gpl-3.0
|
RogerRordo/ACM
|
Source/78.cpp
|
1459
|
/*
Time: 161106
Prob: URAL1503
By RogerRo
*/
#include<cstdio>
#include<cmath>
#define tr(i,l,r) for((i)=(l);(i)<=(r);++i)
#define rtr(i,r,l) for((i)=(r);(i)>=(l);--i)
#define oo 1E5
#define eps 1E-15
#define maxn 10
using namespace std;
double a[maxn][maxn],ans[maxn][maxn];
int n,anss[maxn];
int cmp(double x)
{
if (x>eps) return 1;
if (x<-eps) return -1;
return 0;
}
int read()
{
int x=0,f=1;
char ch=getchar();
while (ch<'0'||ch>'9') {if (ch=='-') f=-1; ch=getchar();}
while (ch>='0'&&ch<='9') {x=x*10+ch-'0'; ch=getchar();}
return x*f;
}
void init(){int i;n=read();rtr(i,n,0) a[n][i]=read();}
double get(int x,double y)
{
int i; double res=0;
rtr(i,x,0) res=res*y+a[x][i];
return res;
}
void ef(int x,double ll,double rr)
{
if (cmp(get(x,ll))==0){ans[x][++anss[x]]=ll;return;}
if (cmp(get(x,rr))==0){ans[x][++anss[x]]=rr;return;}
if (cmp(get(x,ll)*get(x,rr))>0) return;
double l=ll,r=rr,mid;
while (l+eps<r)
{
int tl=cmp(get(x,l)),tm=cmp(get(x,mid=(l+r)/2));
if (tl==0) break;
if (tl*tm>=0) l=mid; else r=mid;
}
ans[x][++anss[x]]=l;
}
void work()
{
int i,j; double l,r;
rtr(i,n-1,1) tr(j,0,i) a[i][j]=a[i+1][j+1]*(j+1);
tr(i,0,n-1)
{
l=-oo;
tr(j,1,anss[i]){ef(i+1,l,r=ans[i][j]); l=r;}
ef(i+1,l,oo);
}
tr(i,1,anss[n]) printf("%.10lf\n",ans[n][i]);
}
int main()
{
init();
work();
return 0;
}
|
gpl-3.0
|
QiuLihua83/Magento_with_some_popular_mods
|
app/code/local/Autocompleteplus/Autosuggest/Model/Mysql4/Fulltext.php
|
4184
|
<?php
/**
* InstantSearchPlus (Autosuggest)
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
*
* @category Mage
* @package InstantSearchPlus
* @copyright Copyright (c) 2014 Fast Simon (http://www.instantsearchplus.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
class Autocompleteplus_Autosuggest_Model_Mysql4_Fulltext extends Mage_CatalogSearch_Model_Mysql4_Fulltext
{
/**
* Prepare results for query
*
* @param Mage_CatalogSearch_Model_Fulltext $object
* @param string $queryText
* @param Mage_CatalogSearch_Model_Query $query
* @return Mage_CatalogSearch_Model_Mysql4_Fulltext
*/
public function prepareResult($object, $queryText, $query)
{
$optimDisabled= Mage::getStoreConfig('autocompleteplus/config/searchoptim');
if (!$query->getIsProcessed()) {
$searchType = $object->getSearchType($query->getStoreId());
$stringHelper = Mage::helper('core/string');
/* @var $stringHelper Mage_Core_Helper_String */
$bind = array(
':query' => $queryText
);
$like = array();
$fulltextCond = '';
$likeCond = '';
$separateCond = '';
if ($searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_LIKE
|| $searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_COMBINE) {
$words = $stringHelper->splitWords($queryText, true, $query->getMaxQueryWords());
$likeI = 0;
foreach ($words as $word) {
$like[] = '`s`.`data_index` LIKE :likew' . $likeI;
$bind[':likew' . $likeI] = '%' . $word . '%';
$likeI ++;
}
if ($like) {
$likeCond = '(' . join(' AND ', $like) . ')';
}
}
if ($searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_FULLTEXT
|| $searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_COMBINE) {
$fulltextCond = 'MATCH (`s`.`data_index`) AGAINST (:query IN BOOLEAN MODE)';
}
if ($searchType == Mage_CatalogSearch_Model_Fulltext::SEARCH_TYPE_COMBINE && $likeCond) {
$separateCond = ' OR ';
}
if($optimDisabled==1){
$sql = sprintf("INSERT INTO `{$this->getTable('catalogsearch/result')}` "
. "(SELECT '%d', `s`.`product_id`, MATCH (`s`.`data_index`) AGAINST (:query IN BOOLEAN MODE) "
. "FROM `{$this->getMainTable()}` AS `s` INNER JOIN `{$this->getTable('catalog/product')}` AS `e`"
. "ON `e`.`entity_id`=`s`.`product_id` WHERE (%s%s%s) AND `s`.`store_id`='%d')"
. " ON DUPLICATE KEY UPDATE `relevance`=VALUES(`relevance`)",
$query->getId(),
$fulltextCond,
$separateCond,
$likeCond,
$query->getStoreId()
);
}else{
$sql = sprintf("INSERT INTO `{$this->getTable('catalogsearch/result')}` "
. "(SELECT STRAIGHT_JOIN '%d', `s`.`product_id`, MATCH (`s`.`data_index`) "
. "AGAINST (:query IN BOOLEAN MODE) FROM `{$this->getMainTable()}` AS `s` "
. "INNER JOIN `{$this->getTable('catalog/product')}` AS `e` "
. "ON `e`.`entity_id`=`s`.`product_id` WHERE (%s%s%s) AND `s`.`store_id`='%d')"
. " ON DUPLICATE KEY UPDATE `relevance`=VALUES(`relevance`)",
$query->getId(),
$fulltextCond,
$separateCond,
$likeCond,
$query->getStoreId()
);
}
$this->_getWriteAdapter()->query($sql, $bind);
$query->setIsProcessed(1);
}
return $this;
}
}
|
gpl-3.0
|
cryporchild/rusty-neutron
|
rusty_neutron/utils/extract_data_from_exif.py
|
1167
|
import pathlib
import re
from pymongo import MongoClient
from ..rusty_webapp.api import PhotoFields, DEFAULT_RATING, DEFAULT_DATE
from ..rusty_webapp.exif import ExifTags
client = MongoClient()
db = client.rusty_neutron
# TODO Put this into celery tasks
def all_photo_paths_in_database_missing_date():
photos = db.photos.find({PhotoFields.DATE: None})
return [p[PhotoFields.PATH] for p in photos]
def update_photo_details(tags):
try:
rating = tags.rating if tags.rating >= 20 else DEFAULT_RATING
except KeyError:
rating = DEFAULT_RATING
try:
date = tags.date
except (KeyError, ValueError):
date = DEFAULT_DATE
db.photos.update(
{PhotoFields.PATH: tags.path},
{'$set': {PhotoFields.RATING: rating, PhotoFields.DATE: date}},
upsert=False,
multi=False,
)
def main():
photos = all_photo_paths_in_database_missing_date()
print('Found {} photos in DB missing details'.format(len(photos)))
if photos:
exif_tags = ExifTags.read_tags(photos)
for tags in exif_tags:
update_photo_details(tags)
print('Finished updating.')
|
gpl-3.0
|
tpilz/lumpR
|
example/make_wasa_input/compute_musle_k.php
|
15454
|
<?php
//Till:
//0.9$ 14.7.2014: fixed faulty checking of dd_version
//Till:
//0.9$ alpha: 3.8.2006
//RENAMED table cum_* to t_cum_*
//computationally irrelevant
//Till:
//0.93 alpha: 3.8.2006
//fixed bug in computation of USDA-silt content (computationally relevant)
//Till:
//0.92 alpha: 1.8.2006
//fixed bug in output of unreferenced soils (computationally irrelevant)
//Till:
//0.91 alpha: 27.2.2006
//version check and warning counter included
//Till:
//0.9 alpha: 20.12.2005
//include settings.php for user settings
//compute the MUSLE-K factor according to Williams (1995) from particle size distribution and organic matter content
//insert calculated values into database tabel soil_veg_components
//see make_wasa_input_manual.txt for details (yet to be done)
//Till Francke, till@comets.de
//-------------------------------------------------------------
include("sql_lib_odbc.php"); //include ODBC-support
global $sql_err_msg;
include ("settings.php"); //include user settings
if (!$con)
die ("$sql_err_msg: could not connect to odbc-database, quitting.");
$warnings=0;
$db_ver_exp=7; //this script expects a database of version 14
include("check_db_version.php"); //check data-dase version
echo("\ncheck availability of all soils referenced in soil_veg_components...");
$sql = "SELECT soil_veg_components.pid AS svc_pid, soil_id".
" FROM soil_veg_components LEFT JOIN soils ON soil_veg_components.soil_id=soils.pid".
" WHERE soils.pid is NULL";
//look for soils that are referenced in "soil_veg_components", but not contained in "soils"
$res = sql_query($sql);
if(!$res)
die("\nCould not read one of the relevant tables ($sql_err_msg).");
else
{
if ($row = sql_fetch_array($res))
{
print("\nWARNING: \"soil_veg_components\" contains soils not contained in \"soils\"\n");
do
{
print(" SVC: ".$row["svc_pid"]." soil: ".$row["soil_id"]."\n");
}
while($row = sql_fetch_array($res)); //do for all soils found
}
else print("OK\n");
}
echo("\ncheck availability of particle information of all soils referenced in soil_veg_components...");
$sql = "SELECT soil_veg_components.pid AS svc_pid, soil_veg_components.soil_id".
" FROM soil_veg_components LEFT JOIN r_soil_contains_particles ON r_soil_contains_particles.soil_id=soil_veg_components.soil_id".
" WHERE r_soil_contains_particles.soil_id is NULL";
//look for soils that are referenced in "soil_veg_components", but not contained in "r_soil_contains_particles"
$res = sql_query($sql);
if(!$res)
die("\nCould not read one of the relevant tables ($sql_err_msg).");
else
{
if ($row = sql_fetch_array($res))
{
print("\nWARNING: \"soil_veg_components\" contains soils unknown in \"r_soil_contains_particles\"\n");
do
{
print(" SVC: ".$row["svc_pid"]." soil: ".$row["soil_id"]."\n");
}
while($row = sql_fetch_array($res)); //do for all soils found
}
else print("OK\n");
}
//these are the particle size classes that are converted to (USDA-soil classification), used by Williams (1995)
$clay_upper_limit=0.002;
$silt_upper_limit=0.05;
$sand_upper_limit=2.0;
//compute clay fraction according to USDA-----------------------------------------------------
$sql = "select class_id, upper_limit from particle_classes where upper_limit>=$clay_upper_limit order by upper_limit";
//get ID of class that is at or just over usda clay
$res = sql_query($sql);
if(!$res)
die("Could not update relevant tables ($sql_err_msg).");
if (!($row = sql_fetch_array($res)))
die("All specified particle classes are finer than USDA-clay, cannot compute K-factor.");
$class_above_usda_clay=$row["class_id"]; //get the id of the user-defined class that sits just above USDA-clay
$class_above_usda_clay_limit=$row["upper_limit"]; //get uppper limit of respective class
$sql = "DROP TABLE t_cum_above;";
$res = sql_query($sql); //delete any existing table
$sql = "SELECT soil_id, sum(fraction) AS a_cum_above INTO t_cum_above".
" FROM r_soil_contains_particles WHERE class_id<=$class_above_usda_clay GROUP BY soil_id;";
$res = sql_query($sql); //produce a table containing the cumulative fractions up to $class_above_usda_clay for each soil
if(!$res)
die("Table t_cum_above could not be created ($sql_err_msg).");
$sql = "DROP TABLE a_cum_below;";
$res = sql_query($sql); //delete any existing table
$class_below_usda_clay=$class_above_usda_clay-1; //the class below USDA clay
if ($class_below_usda_clay==0) //no lower classes that can be used as a point for interpolation
{
$class_below_usda_clay_limit=0; //interpolation starts at 0
$sql="SELECT soil_id, 0 AS a_cum_below INTO t_cum_below".
" FROM r_soil_contains_particles".
" GROUP BY soil_id"; //sql-statement that produces a table containing zeros for each soil
}
else //use the nearest lower class as a point for interpolation
{
$sql = "select upper_limit from particle_classes where class_id<=$class_below_usda_clay";
$res = sql_query($sql);
if(!$res)
die("Could not update relevant tables ($sql_err_msg).");
if (!($row = sql_fetch_array($res)))
die("USER-Class below USDA-clay not found.");
$class_below_usda_clay_limit=$row["upper_limit"]; //get uppper limit of respective class
$sql="SELECT soil_id, sum(fraction) AS a_cum_below INTO t_cum_below".
" FROM r_soil_contains_particles".
" WHERE class_id<=$class_below_usda_clay".
" GROUP BY soil_id"; //sql-statement that produces a table containing the cumulative fractions up to $class_below_usda_clay for each soil
}
$res = sql_query($sql); //produce a table containing the cumulative fractions up to $class_below_usda_clay for each soil
if(!$res)
die("Table t_cum_below could not be created ($sql_err_msg).");
$sql = "UPDATE soils SET a_clay=0,a_silt=0,a_sand=0";
$res = sql_query($sql);
if(!$res)
die("\nCould not initialise USDA-fractions content ($sql_err_msg).");
print("\ncomputing USDA-clay-content...");
$sql = "UPDATE (soils LEFT JOIN t_cum_above ON soils.pid=t_cum_above.soil_id) LEFT JOIN t_cum_below ON soils.pid=t_cum_below.soil_id".
" SET a_clay = ((a_cum_above-a_cum_below)*($clay_upper_limit-$class_below_usda_clay_limit))/($class_above_usda_clay_limit-$class_below_usda_clay_limit);";
$res = sql_query($sql);
if(!$res)
die("\nCould not compute USDA-clay content ($sql_err_msg).");
else
print("OK\n");
//die();
//compute silt fraction according to USDA-----------------------------------------------------
$sql = "select class_id, upper_limit from particle_classes where upper_limit>=$silt_upper_limit order by upper_limit";
//get ID of class that is at or just over usda silt
$res = sql_query($sql);
if(!$res)
die("Could not read relevant tables ($sql_err_msg).");
if (!($row = sql_fetch_array($res)))
die("All specified particle classes are finer than USDA-silt, cannot compute K-factor.");
$class_above_usda_silt=$row["class_id"]; //get the user-class that sits just above USDA-silt
$class_above_usda_silt_limit=$row["upper_limit"]; //get uppper limit of respective class
$sql = "DROP TABLE t_cum_above;";
$res = sql_query($sql); //delete any existing table
if(!$res)
print("Table t_cum_above could not be deleted ($sql_err_msg).");
$sql = "SELECT soil_id, sum(fraction) AS a_cum_above INTO t_cum_above".
" FROM r_soil_contains_particles WHERE class_id<=$class_above_usda_silt GROUP BY soil_id;";
$res = sql_query($sql); //produce a table containing the cumulative fractions up to $class_above_usda_silt for each soil
if(!$res)
die("Table t_cum_above could not be created ($sql_err_msg).");
$sql = "DROP TABLE t_cum_below;";
$res = sql_query($sql); //delete any existing table
if(!$res)
print("Table t_cum_below could not be deleted ($sql_err_msg).");
$class_below_usda_silt=$class_above_usda_silt-1; //the class below USDA silt
if ($class_below_usda_silt==0) //no lower classes that can be used as a point for interpolation
{
$class_below_usda_silt_limit=0; //interpolation starts at 0
$sql="SELECT soil_id, 0 AS a_cum_below INTO t_cum_below".
" FROM r_soil_contains_particles".
" GROUP BY soil_id"; //sql-statement that produces a table containing zeros for each soil
}
else //use the nearest lower class as a point for interpolation
{
$sql = "select upper_limit from particle_classes where class_id=$class_below_usda_silt"; //?
$res = sql_query($sql);
if(!$res)
die("Could not update relevant tables ($sql_err_msg).");
if (!($row = sql_fetch_array($res)))
die("USER-Class below USDA-silt not found.");
$class_below_usda_silt_limit=$row["upper_limit"]; //get uppper limit of respective class
$sql="SELECT soil_id, sum(fraction) AS a_cum_below INTO t_cum_below".
" FROM r_soil_contains_particles".
" WHERE class_id<=$class_below_usda_silt".
" GROUP BY soil_id"; //sql-statement that produces a table containing the cumulative fractions up to $class_below_usda_silt for each soil
}
$res = sql_query($sql); //produce a table containing the cumulative fractions up to $class_below_usda_silt for each soil
if(!$res)
die("Table t_cum_below could not be created ($sql_err_msg).");
/*
print("computing USDA-silt-content...");
$sql = "UPDATE (soils LEFT JOIN t_cum_above ON soils.pid=t_cum_above.soil_id) LEFT JOIN t_cum_below ON soils.pid=t_cum_below.soil_id".
" SET a_silt = ((a_cum_above-a_cum_below)*($silt_upper_limit-$class_below_usda_silt_limit))/($class_above_usda_silt_limit-$class_below_usda_silt_limit);";
$res = sql_query($sql);
if(!$res)
die("\nCould not compute USDA-silt content ($sql_err_msg).");
else
*/
print("OK\n");
//compute sand fraction according to USDA-----------------------------------------------------
$sql = "select class_id, upper_limit from particle_classes where upper_limit>=$sand_upper_limit order by upper_limit";
//get ID of class that is at or just over usda sand
$res = sql_query($sql);
if(!$res)
die("Could not update relevant tables ($sql_err_msg).");
if (!($row = sql_fetch_array($res)))
die("All specified particle classes are finer than USDA-sand, cannot compute K-factor.");
$class_above_usda_sand=$row["class_id"]; //get the user-class that sits just above USDA-sand
$class_above_usda_sand_limit=$row["upper_limit"]; //get uppper limit of respective class
$sql = "DROP TABLE t_cum_above;";
$res = sql_query($sql); //delete any existing table
if(!$res)
print("Table t_cum_above could not be deleted ($sql_err_msg).");
$sql = "SELECT soil_id, sum(fraction) AS a_cum_above INTO t_cum_above".
" FROM r_soil_contains_particles WHERE class_id<=$class_above_usda_sand GROUP BY soil_id;";
$res = sql_query($sql); //produce a table containing the cumulative fractions up to $class_above_usda_sand for each soil
if(!$res)
die("Table t_cum_above could not be created ($sql_err_msg).");
$sql = "DROP TABLE t_cum_below;";
$res = sql_query($sql); //delete any existing table
if(!$res)
print("Table t_cum_below could not be deleted ($sql_err_msg).");
$class_below_usda_sand=$class_above_usda_sand-1; //the class below USDA sand
if ($class_below_usda_sand==0) //no lower classes that can be used as a point for interpolation
{
$class_below_usda_sand_limit=0; //interpolation starts at 0
$sql="SELECT soil_id, 0 AS a_cum_below INTO t_cum_below".
" FROM r_soil_contains_particles".
" GROUP BY soil_id"; //sql-statement that produces a table containing zeros for each soil
}
else //use the nearest lower class as a point for interpolation
{
$sql = "select upper_limit from particle_classes where class_id<=$class_below_usda_sand";
$res = sql_query($sql);
if(!$res)
die("Could not update relevant tables ($sql_err_msg).");
if (!($row = sql_fetch_array($res)))
die("USER-Class below USDA-sand not found.");
$class_below_usda_sand_limit=$row["upper_limit"]; //get uppper limit of respective class
$sql="SELECT soil_id, sum(fraction) AS a_cum_below INTO t_cum_below".
" FROM r_soil_contains_particles".
" WHERE class_id<=$class_below_usda_sand".
" GROUP BY soil_id"; //sql-statement that produces a table containing the cumulative fractions up to $class_below_usda_sand for each soil
}
$res = sql_query($sql); //produce a table containing the cumulative fractions up to $class_below_usda_sand for each soil
if(!$res)
die("Table t_cum_below could not be created ($sql_err_msg).");
print("computing USDA-sand-content...");
$sql = "UPDATE (soils LEFT JOIN t_cum_above ON soils.pid=t_cum_above.soil_id) LEFT JOIN t_cum_below ON soils.pid=t_cum_below.soil_id".
" SET a_sand = ((a_cum_above-a_cum_below)*($sand_upper_limit-$class_below_usda_sand_limit))/($class_above_usda_sand_limit-$class_below_usda_sand_limit);";
$res = sql_query($sql);
if(!$res)
die("\nCould not compute USDA-sand content ($sql_err_msg).");
else
print("OK\n");
$sql = "UPDATE (soils LEFT JOIN t_cum_above ON soils.pid=t_cum_above.soil_id) LEFT JOIN t_cum_below ON soils.pid=t_cum_below.soil_id".
" SET a_silt=1-a_sand-a_clay;";
$res = sql_query($sql);
if(!$res)
die("\nCould not set USDA-silt content ($sql_err_msg).");
else
print("OK\n");
print("computing f_cl_si factor...");
$sql = "UPDATE soils SET a_f_cl_si = 1 WHERE a_silt=0;"; //formula doesn't work for zero silt content - factor is set to 1
$res = sql_query($sql);
if(!$res)
die("\nCould not compute f_cl_si factor ($sql_err_msg).");
$sql = "UPDATE soils SET a_f_cl_si = exp(0.3*log(a_silt/(a_clay+a_silt)))".
" WHERE a_silt>0;";
$res = sql_query($sql);
if(!$res)
die("\nCould not compute f_cl_si factor ($sql_err_msg).");
else
print("OK\n");
print("computing f_csand factor...");
//$sql = "UPDATE soils SET a_f_csand = (0.2+(0.3*exp(-0.256*a_sand*100*(1-a_silt))));"; //as cited in SWAT manual
$sql = "UPDATE soils SET a_f_csand = (0.2+(0.3*exp(-0.0256*a_sand*100*(1-a_silt))));"; //as in Williams, 1995
$res = sql_query($sql);
if(!$res)
die("\nCould not compute f_csand factor ($sql_err_msg).");
else
print("OK\n");
print("computing f_hisand factor...");
$sql = "UPDATE soils SET a_f_hisand = (1-(0.7*(1-a_sand)/((1-a_sand)+exp(-5.51+22.9*(1-a_sand)))));";
$res = sql_query($sql);
if(!$res)
die("\nCould not compute f_hisand factor ($sql_err_msg).");
else
print("OK\n");
print("computing f_orgc factor...");
$sql = "UPDATE soils SET a_f_orgc = (1-(0.25*b_om/1.72*100/(b_om/1.72*100+exp(3.72-2.95*b_om/1.72*100))));";
$res = sql_query($sql);
if(!$res)
die("\nCould not compute f_orgc factor ($sql_err_msg).");
else
print("OK\n");
//compute K and insert results into table soil-----------------------------------------------------
print("computing MUSLE-K and inserting into \"soil\"...");
$sql = "UPDATE soils SET a_musle_k = a_f_csand*a_f_cl_si*a_f_orgc*a_f_hisand;";
$res = sql_query($sql);
if(!$res)
die("Could not update MUSLE-K ($sql_err_msg).");
else
print("OK\n");
//compute insert K into table soil_veg_components-----------------------------------------------------
print("inserting MUSLE-K into \"soil_veg_components\"...");
$sql = "UPDATE soil_veg_components INNER JOIN soils ON soils.pid=soil_veg_components.soil_id SET musle_k = a_musle_k;";
$res = sql_query($sql);
if(!$res)
die("Could not update MUSLE-K ($sql_err_msg).");
else
print("OK\n");
$sql = "DROP TABLE t_cum_above;";
$res = sql_query($sql); //delete table
if(!$res)
print("Table t_cum_above could not be deleted ($sql_err_msg).");
$sql = "DROP TABLE t_cum_below;";
$res = sql_query($sql); //delete table
if(!$res)
print("Table t_cum_below could not be deleted ($sql_err_msg).");
echo("\nfinished script, $warnings warnings issued.\n");
die();
?>
|
gpl-3.0
|
metomi/rose
|
metomi/rosie/svn_pre_commit.py
|
13444
|
#!/usr/bin/env python3
# -----------------------------------------------------------------------------
# Copyright (C) British Crown (Met Office) & Contributors.
#
# This file is part of Rose, a framework for meteorological suites.
#
# Rose 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.
#
# Rose 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 Rose. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------
"""A pre-commit hook on a Rosie Subversion repository.
Ensure that commits conform to the rules of Rosie.
"""
from fnmatch import fnmatch
import re
import shlex
import sys
import traceback
import metomi.rose
from metomi.rose.config import ConfigSyntaxError
from metomi.rose.macro import (
add_meta_paths,
get_reports_as_text,
load_meta_config,
)
from metomi.rose.macros import DefaultValidators
from metomi.rose.opt_parse import RoseOptionParser
from metomi.rose.popen import RosePopenError
from metomi.rose.reporter import Reporter
from metomi.rose.resource import ResourceLocator
from metomi.rose.scheme_handler import SchemeHandlersManager
from metomi.rosie.svn_hook import (
BadChange,
BadChanges,
InfoFileError,
RosieSvnHook,
)
class RosieSvnPreCommitHook(RosieSvnHook):
"""A pre-commit hook on a Rosie Subversion repository.
Ensure that commits conform to the rules of Rosie.
"""
IGNORES = "svnperms.conf"
RE_ID_NAMES = [r"[Ra-z]", r"[Oa-z]", r"[S\d]", r"[I\d]", r"[E\d]"]
TRUNK_KNOWN_KEYS_FILE = "trunk/rosie-keys"
def __init__(self, event_handler=None, popen=None):
super(RosieSvnPreCommitHook, self).__init__(event_handler, popen)
self.usertools_manager = SchemeHandlersManager(
[self.path], "rosie.usertools", ["verify_users"]
)
def _get_access_info(self, info_node):
"""Return (owner, access_list) from "info_node"."""
owner = info_node.get_value(["owner"])
access_list = info_node.get_value(["access-list"], "").split()
access_list.sort()
return owner, access_list
def _verify_users(
self, status, path, txn_owner, txn_access_list, bad_changes
):
"""Check txn_owner and txn_access_list.
For any invalid users, append to bad_changes and return True.
"""
# The owner and names in access list must be real users
conf = ResourceLocator.default().get_conf()
user_tool_name = conf.get_value(["rosa-svn", "user-tool"])
if not user_tool_name:
return False
user_tool = self.usertools_manager.get_handler(user_tool_name)
txn_users = set([txn_owner] + txn_access_list)
txn_users.discard("*")
bad_users = user_tool.verify_users(txn_users)
for bad_user in bad_users:
if txn_owner == bad_user:
bad_change = BadChange(
status, path, BadChange.USER, "owner=" + bad_user
)
bad_changes.append(bad_change)
if bad_user in txn_access_list:
bad_change = BadChange(
status, path, BadChange.USER, "access-list=" + bad_user
)
bad_changes.append(bad_change)
return bool(bad_users)
def run(self, repos, txn):
"""Apply the rule engine on transaction "txn" to repository "repos"."""
changes = set() # set([(status, path), ...])
for line in self._svnlook("changed", "-t", txn, repos).splitlines():
status, path = line.split(None, 1)
changes.add((status, path))
bad_changes = []
author = None
super_users = None
rev_info_map = {}
txn_info_map = {}
conf = ResourceLocator.default().get_conf()
ignores_str = conf.get_value(["rosa-svn", "ignores"], self.IGNORES)
ignores = shlex.split(ignores_str)
for status, path in sorted(changes):
if any(fnmatch(path, ignore) for ignore in ignores):
continue
names = path.split("/", self.LEN_ID + 1)
tail = None
if not names[-1]:
tail = names.pop()
# Directories above the suites must match the ID patterns
is_bad = False
for name, pattern in zip(names, self.RE_ID_NAMES):
if not re.compile(r"\A" + pattern + r"\Z").match(name):
is_bad = True
break
if is_bad:
msg = "Directories above the suites must match the ID patterns"
bad_changes.append(BadChange(status, path, content=msg))
continue
# At levels above the suites, can only add directories
if len(names) < self.LEN_ID:
if status[0] != self.ST_ADDED:
msg = (
"At levels above the suites, "
"can only add directories"
)
bad_changes.append(BadChange(status, path, content=msg))
continue
# Cannot have a file at the branch level
if len(names) == self.LEN_ID + 1 and tail is None:
msg = "Cannot have a file at the branch level"
bad_changes.append(BadChange(status, path, content=msg))
continue
# New suite should have an info file
if len(names) == self.LEN_ID and status == self.ST_ADDED:
if (self.ST_ADDED, path + "trunk/") not in changes:
bad_changes.append(
BadChange(status, path, BadChange.NO_TRUNK)
)
continue
path_trunk_info_file = path + self.TRUNK_INFO_FILE
if (self.ST_ADDED, path_trunk_info_file) not in changes and (
self.ST_UPDATED,
path_trunk_info_file,
) not in changes:
bad_changes.append(
BadChange(status, path, BadChange.NO_INFO)
)
continue
sid = "".join(names[0 : self.LEN_ID])
branch = names[self.LEN_ID] if len(names) > self.LEN_ID else None
path_head = "/".join(sid) + "/"
path_tail = path[len(path_head) :]
is_meta_suite = sid == "ROSIE"
if status != self.ST_DELETED:
# Check info file
if sid not in txn_info_map:
try:
txn_info_map[sid] = self._load_info(
repos, sid, branch=branch, transaction=txn
)
err = None
except ConfigSyntaxError as exc:
err = InfoFileError(InfoFileError.VALUE, exc)
except RosePopenError as exc:
err = InfoFileError(InfoFileError.NO_INFO, exc.stderr)
if err:
bad_changes.append(err)
txn_info_map[sid] = err
continue
# Suite must have an owner
txn_owner, txn_access_list = self._get_access_info(
txn_info_map[sid]
)
if not txn_owner:
bad_changes.append(
InfoFileError(InfoFileError.NO_OWNER)
)
continue
# No need to check other non-trunk changes
if branch and branch != "trunk":
continue
# For meta suite, make sure keys in keys file can be parsed
if is_meta_suite and path_tail == self.TRUNK_KNOWN_KEYS_FILE:
out = self._svnlook("cat", "-t", txn, repos, path)
try:
shlex.split(out)
except ValueError:
bad_changes.append(
BadChange(status, path, BadChange.VALUE)
)
continue
# User IDs of owner and access list must be real
if (
status != self.ST_DELETED
and path_tail == self.TRUNK_INFO_FILE
and not isinstance(txn_info_map[sid], InfoFileError)
):
txn_owner, txn_access_list = self._get_access_info(
txn_info_map[sid]
)
if self._verify_users(
status, path, txn_owner, txn_access_list, bad_changes
):
continue
reports = DefaultValidators().validate(
txn_info_map[sid],
load_meta_config(
txn_info_map[sid],
config_type=metomi.rose.INFO_CONFIG_NAME,
),
)
if reports:
reports_str = get_reports_as_text({None: reports}, path)
bad_changes.append(
BadChange(status, path, BadChange.VALUE, reports_str)
)
continue
# Can only remove trunk information file with suite
if status == self.ST_DELETED and path_tail == self.TRUNK_INFO_FILE:
if (self.ST_DELETED, path_head) not in changes:
bad_changes.append(
BadChange(status, path, BadChange.NO_INFO)
)
continue
# Can only remove trunk with suite
# (Don't allow replacing trunk with a copy from elsewhere, either)
if status == self.ST_DELETED and path_tail == "trunk/":
if (self.ST_DELETED, path_head) not in changes:
bad_changes.append(
BadChange(status, path, BadChange.NO_TRUNK)
)
continue
# New suite trunk: ignore the rest
if (self.ST_ADDED, path_head + "trunk/") in changes:
continue
# See whether author has permission to make changes
if author is None:
author = self._svnlook("author", "-t", txn, repos).strip()
if super_users is None:
super_users = []
for s_key in ["rosa-svn", "rosa-svn-pre-commit"]:
value = conf.get_value([s_key, "super-users"])
if value is not None:
super_users = shlex.split(value)
break
if sid not in rev_info_map:
rev_info_map[sid] = self._load_info(repos, sid, branch=branch)
owner, access_list = self._get_access_info(rev_info_map[sid])
admin_users = super_users + [owner]
# Only admin users can remove the suite
if author not in admin_users and not path_tail:
msg = "Only the suite owner can remove the suite"
bad_changes.append(BadChange(status, path, content=msg))
continue
# Admin users and those in access list can modify everything in
# trunk apart from specific entries in the trunk info file
if "*" in access_list or author in admin_users + access_list:
if path_tail != self.TRUNK_INFO_FILE:
continue
else:
msg = "User not in access list"
bad_changes.append(BadChange(status, path, content=msg))
continue
# Only the admin users can change owner and access list
if owner == txn_owner and access_list == txn_access_list:
continue
if author not in admin_users:
if owner != txn_owner:
bad_changes.append(
BadChange(
status, path, BadChange.PERM, "owner=" + txn_owner
)
)
else: # access list
bad_change = BadChange(
status,
path,
BadChange.PERM,
"access-list=" + " ".join(txn_access_list),
)
bad_changes.append(bad_change)
continue
if bad_changes:
raise BadChanges(bad_changes)
__call__ = run
def main():
"""Implement "rosa svn-pre-commit"."""
add_meta_paths()
opt_parser = RoseOptionParser()
opts, args = opt_parser.parse_args()
repos, txn = args
report = Reporter(opts.verbosity - opts.quietness)
hook = RosieSvnPreCommitHook(report)
try:
hook(repos, txn)
except Exception as exc:
report(exc)
if opts.debug_mode:
traceback.print_exc()
sys.exit(1)
if __name__ == "__main__":
main()
|
gpl-3.0
|
jeremybernstein/cutechess
|
projects/cli/src/enginematch.cpp
|
21948
|
/*
This file is part of Cute Chess.
Cute Chess 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.
Cute Chess 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 Cute Chess. If not, see <http://www.gnu.org/licenses/>.
*/
#include "econode.h"
#include "board/board.h"
#include "enginematch.h"
#include <cmath>
#include <QMultiMap>
#include <QTextCodec>
#include <chessplayer.h>
#include <playerbuilder.h>
#include <chessgame.h>
#include <polyglotbook.h>
#include <tournament.h>
#include <gamemanager.h>
#include <sprt.h>
EngineMatch::EngineMatch(Tournament* tournament, QObject* parent)
: QObject(parent),
m_tournament(tournament),
m_debug(false),
m_ratingInterval(0)
{
Q_ASSERT(tournament != 0);
m_startTime.start();
}
EngineMatch::~EngineMatch()
{
qDeleteAll(m_books);
}
OpeningBook* EngineMatch::addOpeningBook(const QString& fileName)
{
if (fileName.isEmpty())
return 0;
if (m_books.contains(fileName))
return m_books[fileName];
PolyglotBook* book = new PolyglotBook;
if (!book->read(fileName))
{
delete book;
qWarning("Can't read opening book file %s", qPrintable(fileName));
return 0;
}
m_books[fileName] = book;
return book;
}
void EngineMatch::start()
{
connect(m_tournament, SIGNAL(finished()),
this, SLOT(onTournamentFinished()));
connect(m_tournament, SIGNAL(gameStarted(ChessGame*, int, int, int)),
this, SLOT(onGameStarted(ChessGame*, int)));
connect(m_tournament, SIGNAL(gameFinished(ChessGame*, int, int, int)),
this, SLOT(onGameFinished(ChessGame*, int)));
if (m_debug)
connect(m_tournament->gameManager(), SIGNAL(debugMessage(QString)),
this, SLOT(print(QString)));
QMetaObject::invokeMethod(m_tournament, "start", Qt::QueuedConnection);
}
void EngineMatch::stop()
{
QMetaObject::invokeMethod(m_tournament, "stop", Qt::QueuedConnection);
}
void EngineMatch::setDebugMode(bool debug)
{
m_debug = debug;
}
void EngineMatch::setRatingInterval(int interval)
{
Q_ASSERT(interval >= 0);
m_ratingInterval = interval;
}
void EngineMatch::setTournamentFile(QString& tournamentFile)
{
m_tournamentFile = tournamentFile;
}
void EngineMatch::generateSchedule(QVariantList& pList)
{
QVariantMap pMap;
QList< QPair<QString, QString> > pairings = m_tournament->getPairings();
if (pairings.isEmpty()) return;
int maxName = 5, maxTerm = 11, maxFen = 9;
for (int i = 0; i < pList.size(); i++) {
int len;
pMap = pList.at(i).toMap();
if (pMap.contains("terminationDetails")) {
len = pMap["terminationDetails"].toString().length();
if (len > maxTerm) maxTerm = len;
}
if (pMap.contains("finalFen")) {
len = pMap["finalFen"].toString().length();
if (len > maxFen) maxFen = len;
}
}
// now check the player list for maxName
int playerCount = m_tournament->playerCount();
for (int i = 0; i < playerCount; i++) {
int len = m_tournament->playerAt(i).builder->name().length();
if (len > maxName) maxName = len;
}
QString scheduleFile(m_tournamentFile);
QString scheduleText;
scheduleFile = scheduleFile.remove(".json") + "_schedule.txt";
scheduleText = QString("%1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11 %12 %13 %14\n")
.arg("Nr", pairings.size() >= 100 ? 3 : 2)
.arg("White", maxName)
.arg("", 3)
.arg("", -3)
.arg("Black", -maxName)
.arg("Termination", -maxTerm)
.arg("Mov", 3)
.arg("WhiteEv", 7)
.arg("BlackEv", -7)
.arg("Start", -22)
.arg("Duration", 8)
.arg("ECO", 3)
.arg("FinalFen", -maxFen)
.arg("Opening");
if (!pairings.isEmpty()) {
QList< QPair<QString, QString> >::iterator i;
int count = 0;
for (i = pairings.begin(); i != pairings.end(); ++i, ++count) {
QString whiteName, blackName, whiteResult, blackResult, termination, startTime, duration, ECO, finalFen, opening;
QString whiteEval, blackEval;
QString plies = 0;
whiteName = i->first;
blackName = i->second;
if (count < pList.size()) {
pMap = pList.at(count).toMap();
if (!pMap.isEmpty()) {
if (pMap.contains("white")) // TODO error check against above
whiteName = pMap["white"].toString();
if (pMap.contains("black"))
blackName = pMap["black"].toString();
if (pMap.contains("startTime"))
startTime = pMap["startTime"].toString();
if (pMap.contains("result")) {
QString result = pMap["result"].toString();
if (result == "*") {
whiteResult = blackResult = result;
} else if (result == "1-0") {
whiteResult = "1";
blackResult = "0";
} else if (result == "0-1") {
blackResult = "1";
whiteResult = "0";
} else {
whiteResult = blackResult = "1/2";
}
}
if (pMap.contains("terminationDetails"))
termination = pMap["terminationDetails"].toString();
if (pMap.contains("gameDuration"))
duration = pMap["gameDuration"].toString();
if (pMap.contains("finalFen"))
finalFen = pMap["finalFen"].toString();
if (pMap.contains("ECO"))
ECO = pMap["ECO"].toString();
if (pMap.contains("opening"))
opening = pMap["opening"].toString();
if (pMap.contains("variation")) {
QString variation = pMap["variation"].toString();
if (!variation.isEmpty())
opening += ", " + variation;
}
if (pMap.contains("plyCount"))
plies = pMap["plyCount"].toString();
if (pMap.contains("whiteEval"))
whiteEval = pMap["whiteEval"].toString();
if (pMap.contains("blackEval")) {
blackEval = pMap["blackEval"].toString();
if (blackEval.at(0) == '-') {
blackEval.remove(0, 1);
} else {
if (blackEval != "0.00")
blackEval = "-" + blackEval;
}
}
}
}
scheduleText += QString("%1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11 %12 %13 %14\n")
.arg(QString::number(count+1), pairings.size() >= 100 ? 3 : 2)
.arg(whiteName, maxName)
.arg(whiteResult, 3)
.arg(blackResult, -3)
.arg(blackName, -maxName)
.arg(termination, -maxTerm)
.arg(plies, 3)
.arg(whiteEval, 7)
.arg(blackEval, -7)
.arg(startTime, -22)
.arg(duration, 8)
.arg(ECO, 3)
.arg(finalFen, -maxFen)
.arg(opening);
}
QFile output(scheduleFile);
if (!output.open(QIODevice::WriteOnly | QIODevice::Text)) {
qWarning("cannot open tournament configuration file: %s", qPrintable(scheduleFile));
} else {
QTextStream out(&output);
out.setCodec(QTextCodec::codecForName("latin1")); // otherwise output is converted to ASCII
out << scheduleText;
}
}
}
struct CrossTableData
{
public:
CrossTableData(QString engineName, int elo = 0) :
m_score(0),
m_neustadtlScore(0),
m_gamesPlayedAsWhite(0),
m_gamesPlayedAsBlack(0),
m_winsAsWhite(0),
m_winsAsBlack(0)
{
m_engineName = engineName;
m_elo = elo;
};
CrossTableData() :
m_score(0),
m_neustadtlScore(0),
m_elo(0),
m_gamesPlayedAsWhite(0),
m_gamesPlayedAsBlack(0),
m_winsAsWhite(0),
m_winsAsBlack(0)
{
};
bool isEmpty() { return m_engineName.isEmpty(); }
QString m_engineName;
QString m_engineAbbrev;
double m_score;
double m_neustadtlScore;
int m_elo;
int m_gamesPlayedAsWhite;
int m_gamesPlayedAsBlack;
int m_winsAsWhite;
int m_winsAsBlack;
QMap<QString, QString> m_tableData;
};
bool sortCrossTableDataByScore(const CrossTableData &s1, const CrossTableData &s2)
{
if (s1.m_score == s2.m_score) {
if (s1.m_neustadtlScore == s2.m_neustadtlScore) {
if (s1.m_gamesPlayedAsBlack == s2.m_gamesPlayedAsBlack) {
if ((s1.m_winsAsWhite + s1.m_winsAsBlack) == (s2.m_winsAsWhite + s2.m_winsAsBlack)) {
return (s1.m_winsAsBlack > s2.m_winsAsBlack);
} else {
return (s1.m_winsAsWhite + s1.m_winsAsBlack) > (s2.m_winsAsWhite + s2.m_winsAsBlack);
}
} else {
return s1.m_gamesPlayedAsBlack > s2.m_gamesPlayedAsBlack;
}
} else {
return s1.m_neustadtlScore > s2.m_neustadtlScore;
}
}
return s1.m_score > s2.m_score;
}
void EngineMatch::generateCrossTable(QVariantList& pList)
{
int playerCount = m_tournament->playerCount();
QMap<QString, CrossTableData> ctMap;
QStringList abbrevList;
int roundLength = 2;
int maxName = 6;
// ensure names and abbreviations
for (int i = 0; i < playerCount; i++) {
CrossTableData ctd(m_tournament->playerAt(i).builder->name(), m_tournament->playerAt(i).builder->rating());
if (ctd.m_engineName.length() > maxName) maxName = ctd.m_engineName.length();
int n = 1;
QString abbrev;
abbrev.append(ctd.m_engineName.at(0).toUpper()).append(ctd.m_engineName.length() > n ? ctd.m_engineName.at(n++).toLower() : ' ');
while (abbrevList.contains(abbrev)) {
abbrev[1] = ctd.m_engineName.length() > n ? ctd.m_engineName.at(n++).toLower() : ' ';
}
ctd.m_engineAbbrev = abbrev;
abbrevList.append(abbrev);
ctMap.insert(ctd.m_engineName, ctd);
}
// calculate scores and crosstable strings
for (int i = 0; i < pList.size(); i++) {
QVariantMap pMap = pList.at(i).toMap();
if (pMap.contains("white") && pMap.contains("black") && pMap.contains("result")) {
QString whiteName = pMap["white"].toString();
QString blackName = pMap["black"].toString();
QString result = pMap["result"].toString();
CrossTableData& whiteData = ctMap[whiteName];
CrossTableData& blackData = ctMap[blackName];
QString& whiteDataString = whiteData.m_tableData[blackName];
QString& blackDataString = blackData.m_tableData[whiteName];
if (result == "*") {
continue; // game in progress or invalid or something
}
if (result == "1-0") {
whiteData.m_score += 1;
whiteData.m_winsAsWhite++;
whiteDataString += "1";
blackDataString += "0";
} else if (result == "0-1") {
blackData.m_score += 1;
blackData.m_winsAsBlack++;
whiteDataString += "0";
blackDataString += "1";
} else if (result == "1/2-1/2") {
whiteData.m_score += 0.5;
blackData.m_score += 0.5;
whiteDataString += "=";
blackDataString += "=";
}
if (whiteDataString.length() > roundLength) roundLength = whiteDataString.length();
if (blackDataString.length() > roundLength) roundLength = blackDataString.length();
whiteData.m_gamesPlayedAsWhite++;
blackData.m_gamesPlayedAsBlack++;
}
}
// calculate SB
QMapIterator<QString, CrossTableData> ct(ctMap);
double largestSB = 0;
double largestScore = 0;
while (ct.hasNext()) {
ct.next();
CrossTableData& ctd = ctMap[ct.key()];
QMapIterator<QString, QString> td(ctd.m_tableData);
double sb = 0;
while (td.hasNext()) {
td.next();
QString::ConstIterator c = td.value().begin();
while (c != td.value().end()) {
if (*c == QChar('1')) {
sb += ctMap[td.key()].m_score;
} else if (*c == QChar('=')) {
sb += ctMap[td.key()].m_score / 2.;
}
c++;
}
}
ctd.m_neustadtlScore = sb;
if (ctd.m_neustadtlScore > largestSB) largestSB = ctd.m_neustadtlScore;
if (ctd.m_score > largestScore) largestScore = ctd.m_score;
}
if (playerCount == 2) {
roundLength = 2;
QVariantMap pMap = pList.at(0).toMap();
if (pMap.contains("white") && pMap.contains("black")) {
QString whiteName = pMap["white"].toString();
QString blackName = pMap["black"].toString();
CrossTableData& whiteData = ctMap[whiteName];
CrossTableData& blackData = ctMap[blackName];
QString& whiteDataString = whiteData.m_tableData[blackName];
QString& blackDataString = blackData.m_tableData[whiteName];
int whiteWin = 0;
int whiteLose = 0;
int whiteDraw = 0;
for (int i = 0; i < whiteDataString.length(); i++) {
if (whiteDataString[i] == '1')
whiteWin++;
else if (whiteDataString[i] == '0')
whiteLose++;
else
whiteDraw++;
}
whiteDataString = QString("+ %1 = %2 - %3")
.arg(whiteWin)
.arg(whiteDraw)
.arg(whiteLose);
blackDataString = QString("+ %1 = %2 - %3")
.arg(whiteLose)
.arg(whiteDraw)
.arg(whiteWin);
if (whiteDataString.length() > roundLength) roundLength = whiteDataString.length();
if (blackDataString.length() > roundLength) roundLength = blackDataString.length();
}
}
int maxScore = largestScore >= 100 ? 5 : largestScore >= 10 ? 4 : 3;
int maxSB = largestSB >= 100 ? 6 : largestSB >= 10 ? 5 : 4;
int maxGames = m_tournament->currentRound() >= 100 ? 4 : m_tournament->currentRound() >= 10 ? 3 : 2;
QString crossTableHeaderText = QString("%1 %2 %3 %4 %5 %6")
.arg("N", 2)
.arg("Engine", -maxName)
.arg("Rtng", -4)
.arg("Pts", maxScore)
.arg("Gm", maxGames)
.arg("SB", maxSB);
QString crossTableBodyText;
QList<CrossTableData> list = ctMap.values();
qSort(list.begin(), list.end(), sortCrossTableDataByScore);
QList<CrossTableData>::iterator i;
int count = 1;
for (i = list.begin(); i != list.end(); ++i, ++count) {
crossTableHeaderText += QString(" %1").arg(i->m_engineAbbrev, -roundLength);
crossTableBodyText += QString("%1 %2 %3 %4 %5 %6")
.arg(count, 2)
.arg(i->m_engineName, -maxName)
.arg(i->m_elo, 4)
.arg(i->m_score, maxScore, 'f', 1)
.arg(i->m_gamesPlayedAsWhite + i->m_gamesPlayedAsBlack, maxGames)
.arg(i->m_neustadtlScore, maxSB, 'f', 2);
QList<CrossTableData>::iterator j;
for (j = list.begin(); j != list.end(); ++j) {
if (j->m_engineName == i->m_engineName) {
crossTableBodyText += " ";
int rl = roundLength;
while(rl--) crossTableBodyText += "\u00B7";
} else crossTableBodyText += QString(" %1").arg(i->m_tableData[j->m_engineName], -roundLength);
}
crossTableBodyText += "\n";
}
QString crossTableText = crossTableHeaderText + "\n\n" + crossTableBodyText;
QString crossTableFile(m_tournamentFile);
crossTableFile = crossTableFile.remove(".json") + "_crosstable.txt";
QFile output(crossTableFile);
if (!output.open(QIODevice::WriteOnly | QIODevice::Text)) {
qWarning("cannot open tournament configuration file: %s", qPrintable(crossTableFile));
} else {
QTextStream out(&output);
out.setCodec(QTextCodec::codecForName("latin1")); // otherwise output is converted to ASCII
out << crossTableText;
}
}
void EngineMatch::onGameStarted(ChessGame* game, int number)
{
Q_ASSERT(game != 0);
qDebug("Started game %d of %d (%s vs %s)",
number,
m_tournament->finalGameCount(),
qPrintable(game->player(Chess::Side::White)->name()),
qPrintable(game->player(Chess::Side::Black)->name()));
if (!m_tournamentFile.isEmpty()) {
QVariantMap tfMap;
if (QFile::exists(m_tournamentFile)) {
QFile input(m_tournamentFile);
if (!input.open(QIODevice::ReadOnly | QIODevice::Text)) {
qWarning("cannot open tournament configuration file: %s", qPrintable(m_tournamentFile));
return;
}
QTextStream stream(&input);
JsonParser jsonParser(stream);
tfMap = jsonParser.parse().toMap();
}
QVariantList pList;
if (!tfMap.isEmpty()) {
if (tfMap.contains("matchProgress")) {
pList = tfMap["matchProgress"].toList();
int length = pList.length();
if (length >= number) {
qWarning("game %d already exists, deleting", number);
while(length-- >= number) {
pList.removeLast();
}
}
}
}
QVariantMap pMap;
pMap.insert("index", number);
pMap.insert("white", game->player(Chess::Side::White)->name());
pMap.insert("black", game->player(Chess::Side::Black)->name());
QDateTime qdt = QDateTime::currentDateTime();
pMap.insert("startTime", qdt.toString("HH:mm:ss' on 'yyyy.MM.dd"));
pMap.insert("result", "*");
pMap.insert("terminationDetails", "in progress");
pList.append(pMap);
tfMap.insert("matchProgress", pList);
{
QFile output(m_tournamentFile);
if (!output.open(QIODevice::WriteOnly | QIODevice::Text)) {
qWarning("cannot open tournament configuration file: %s", qPrintable(m_tournamentFile));
} else {
QTextStream out(&output);
JsonSerializer serializer(tfMap);
serializer.serialize(out);
}
}
generateSchedule(pList);
generateCrossTable(pList);
}
}
void EngineMatch::onGameFinished(ChessGame* game, int number)
{
Q_ASSERT(game != 0);
Chess::Result result(game->result());
qDebug("Finished game %d (%s vs %s): %s",
number,
qPrintable(game->player(Chess::Side::White)->name()),
qPrintable(game->player(Chess::Side::Black)->name()),
qPrintable(result.toVerboseString()));
if (!m_tournamentFile.isEmpty()) {
QVariantMap tfMap;
if (QFile::exists(m_tournamentFile)) {
QFile input(m_tournamentFile);
if (!input.open(QIODevice::ReadOnly | QIODevice::Text)) {
qWarning("cannot open tournament configuration file: %s", qPrintable(m_tournamentFile));
} else {
QTextStream stream(&input);
JsonParser jsonParser(stream);
tfMap = jsonParser.parse().toMap();
}
QVariantMap pMap;
QVariantList pList;
if (!tfMap.isEmpty()) {
if (tfMap.contains("matchProgress")) {
pList = tfMap["matchProgress"].toList();
int length = pList.length();
if (length < number) {
qWarning("game %d doesn't exist", number);
} else
pMap = pList.at(number-1).toMap();
}
}
if (!pMap.isEmpty()) {
pMap.insert("result", result.toShortString());
pMap.insert("terminationDetails", result.shortDescription());
PgnGame *pgn = game->pgn();
if (pgn) {
const EcoInfo eco = pgn->eco();
QString val;
val = eco.ecoCode();
if (!val.isEmpty()) pMap.insert("ECO", val);
val = eco.opening();
if (!val.isEmpty()) pMap.insert("opening", val);
val = eco.variation();
if (!val.isEmpty()) pMap.insert("variation", val);
// TODO: after TCEC is over, change this to moveCount, since that's what it is
pMap.insert("plyCount", qRound(game->moves().size() / 2.));
}
pMap.insert("finalFen", game->board()->fenString());
MoveEvaluation eval;
QString sScore;
Chess::Side sides[] = { Chess::Side::White, Chess::Side::Black, Chess::Side::NoSide };
for (int i = 0; sides[i] != Chess::Side::NoSide; i++) {
Chess::Side side = sides[i];
MoveEvaluation eval = game->player(side)->evaluation();
int score = eval.score();
int absScore = qAbs(score);
QString sScore;
// Detect mate-in-n scores
if (absScore > 9900
&& (absScore = 1000 - (absScore % 1000)) < 100)
{
if (score < 0)
sScore = "-";
sScore += "M" + QString::number(absScore);
}
else
sScore = QString::number(double(score) / 100.0, 'f', 2);
if (side == Chess::Side::White)
pMap.insert("whiteEval", sScore);
else
pMap.insert("blackEval", sScore);
}
pMap.insert("gameDuration", game->gameDuration());
pList.replace(number-1, pMap);
tfMap.insert("matchProgress", pList);
QFile output(m_tournamentFile);
if (!output.open(QIODevice::WriteOnly | QIODevice::Text)) {
qWarning("cannot open tournament configuration file: %s", qPrintable(m_tournamentFile));
} else {
QTextStream out(&output);
JsonSerializer serializer(tfMap);
serializer.serialize(out);
}
generateSchedule(pList);
generateCrossTable(pList);
}
}
}
if (m_tournament->playerCount() == 2)
{
Tournament::PlayerData fcp = m_tournament->playerAt(0);
Tournament::PlayerData scp = m_tournament->playerAt(1);
int totalResults = fcp.wins + fcp.losses + fcp.draws;
qDebug("Score of %s vs %s: %d - %d - %d [%.3f] %d",
qPrintable(fcp.builder->name()),
qPrintable(scp.builder->name()),
fcp.wins, scp.wins, fcp.draws,
double(fcp.wins * 2 + fcp.draws) / (totalResults * 2),
totalResults);
}
if (m_ratingInterval != 0
&& (m_tournament->finishedGameCount() % m_ratingInterval) == 0)
printRanking();
}
void EngineMatch::onTournamentFinished()
{
if (m_ratingInterval == 0
|| m_tournament->finishedGameCount() % m_ratingInterval != 0)
printRanking();
QString error = m_tournament->errorString();
if (!error.isEmpty())
qWarning("%s", qPrintable(error));
else
{
switch (m_tournament->sprt()->status())
{
case Sprt::AcceptH0:
qDebug("SPRT: H0 was accepted");
break;
case Sprt::AcceptH1:
qDebug("SPRT: H1 was accepted");
break;
default:
break;
}
}
qDebug("Finished match");
connect(m_tournament->gameManager(), SIGNAL(finished()),
this, SIGNAL(finished()));
m_tournament->gameManager()->finish();
}
void EngineMatch::print(const QString& msg)
{
qDebug() << m_startTime.elapsed() << " " << qPrintable(msg);
}
struct RankingData
{
QString name;
int games;
qreal score;
qreal draws;
};
void EngineMatch::printRanking()
{
QMultiMap<qreal, RankingData> ranking;
for (int i = 0; i < m_tournament->playerCount(); i++)
{
Tournament::PlayerData player(m_tournament->playerAt(i));
int score = player.wins * 2 + player.draws;
int total = (player.wins + player.losses + player.draws) * 2;
if (total <= 0)
continue;
qreal ratio = qreal(score) / qreal(total);
qreal eloDiff = -400.0 * std::log(1.0 / ratio - 1.0) / std::log(10.0);
if (m_tournament->playerCount() == 2)
{
qDebug("ELO difference: %.0f", eloDiff);
break;
}
RankingData data = { player.builder->name(),
total / 2,
ratio,
qreal(player.draws * 2) / qreal(total) };
ranking.insert(-eloDiff, data);
}
if (!ranking.isEmpty())
qDebug("%4s %-23s %7s %7s %7s %7s",
"Rank", "Name", "ELO", "Games", "Score", "Draws");
int rank = 0;
QMultiMap<qreal, RankingData>::const_iterator it;
for (it = ranking.constBegin(); it != ranking.constEnd(); ++it)
{
const RankingData& data = it.value();
qDebug("%4d %-23s %7.0f %7d %6.0f%% %6.0f%%",
++rank,
qPrintable(data.name),
-it.key(),
data.games,
data.score * 100.0,
data.draws * 100.0);
}
}
|
gpl-3.0
|
CLLKazan/iCQA
|
qa-engine/forum/management/commands/checkinstall.py
|
3457
|
import re
import sys, traceback
from django.core.management.base import NoArgsCommand
OK_MESSAGE = " Found %(what)s version %(version)s - OK"
OLD_VERSION_ERROR = """ ERROR: Found %(what)s version %(version)s - you should upgrade it to at least %(minimum)s.
Package installers like apt-get or yum usually maintain old versions of libraries in the repositories."""
NOT_FOUND_ERROR = "ERROR: %(what)s was not found on your system."
HOW_TO_INSTALL = """ Try easy_install %(what)s or download it from %(where)s"""
IMPORT_ERROR_MESSAGE = """Importing %(what)s is throwing an exception. Here's the full stack trace:"""
class Command(NoArgsCommand):
def handle_noargs(self, **options):
print "Checking dependencies:"
try:
import html5lib
print " Found html5lib - OK"
except ImportError:
print NOT_FOUND_ERROR % dict(what='html5lib')
print HOW_TO_INSTALL % dict(what='html5lib', where='http://code.google.com/p/html5lib/')
except Exception, e:
print IMPORT_ERROR_MESSAGE % dict(what='html5lib')
traceback.print_exc(file=sys.stdout)
try:
import markdown
version = int(re.findall('^\d+', markdown.version)[0])
if version < 2:
print OLD_VERSION_ERROR % dict(what='markdown', version=markdown.version, minimum='2.0')
print HOW_TO_INSTALL % dict(what='markdown', where='http://www.freewisdom.org/projects/python-markdown/')
else:
print OK_MESSAGE % dict(what='markdown', version=markdown.version)
except ImportError:
print NOT_FOUND_ERROR % dict(what='markdown')
print HOW_TO_INSTALL % dict(what='markdown', where='http://www.freewisdom.org/projects/python-markdown/')
except Exception, e:
print IMPORT_ERROR_MESSAGE % dict(what='markdown')
traceback.print_exc(file=sys.stdout)
try:
import south
version = re.findall('\d+', south.__version__)
if int(version[1]) < 6 and int(version[0]) == 0:
print OLD_VERSION_ERROR % dict(what='south', version=south.__version__, minimum='0.6')
print HOW_TO_INSTALL % dict(what='south', where='http://south.aeracode.org/')
else:
print OK_MESSAGE % dict(what='south', version=south.__version__)
except ImportError:
print NOT_FOUND_ERROR % dict(what='south')
print HOW_TO_INSTALL % dict(what='south', where='http://south.aeracode.org/')
except Exception, e:
print IMPORT_ERROR_MESSAGE % dict(what='south')
traceback.print_exc(file=sys.stdout)
print "\n\nChecking database connection:"
try:
from forum.models import User
User.objects.all().count()
print " Connection OK"
except Exception, e:
print "There seems to be a problem with your database: %s" % str(e)
from django.conf import settings
print "\n\nChecking important settings:"
if not re.match('^https?:\/\/\w+', settings.APP_URL):
print " Your APP_URL does not seem to be a valid url. Please fill this setting with the URL of your OSQA installation"
else:
print " APP_URL - %s" % settings.APP_URL
print " APP_BASE_URL - %s" % settings.APP_BASE_URL
|
gpl-3.0
|
SafirSDK/safir-sdk-core
|
src/tests/dose_test.ss/StressTests/MultiPingPong/Ponger.cpp
|
3877
|
/******************************************************************************
*
* Copyright Saab AB, 2006-2013 (http://safirsdkcore.com)
*
* Created by: Lars Hagström / stlrha
*
*******************************************************************************
*
* This file is part of Safir SDK Core.
*
* Safir SDK Core is free software: you can redistribute it and/or modify
* it under the terms of version 3 of the GNU General Public License as
* published by the Free Software Foundation.
*
* Safir SDK Core 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 Safir SDK Core. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#include "Ponger.h"
#include "CommandLine.h"
#include <Safir/Dob/OverflowException.h>
#include <Safir/Dob/NodeParameters.h>
#include <Safir/Dob/ThisNodeParameters.h>
#include <DoseStressTest/Ping.h>
#include "../common/ErrorReporter.h"
#include <Safir/Dob/ResponseGeneralErrorCodes.h>
#include <sstream>
Ponger::Ponger():
m_handler(Safir::Dob::Typesystem::InstanceId::GenerateRandom().GetRawValue())
{
m_connection.Attach();
m_connection.RegisterEntityHandler(DoseStressTest::Pong::ClassTypeId,
m_handler,
Safir::Dob::InstanceIdPolicy::HandlerDecidesInstanceId,
this);
m_entity = DoseStressTest::Pong::Create();
m_connection.SubscribeEntity(DoseStressTest::Ping::ClassTypeId,
this);
}
void Ponger::OnNewEntity(const Safir::Dob::EntityProxy entityProxy)
{
Pong(entityProxy);
}
void Ponger::OnUpdatedEntity(const Safir::Dob::EntityProxy entityProxy)
{
Pong(entityProxy);
}
void Ponger::OnDeletedEntity(const Safir::Dob::EntityProxy entityProxy,
const bool /*deletedByOwner*/)
{
const Safir::Dob::Typesystem::InstanceId instance = entityProxy.GetInstanceId();
PingPongTable::iterator findIt = m_pingPongTable.find(instance);
if (findIt == m_pingPongTable.end())
{
std::wostringstream ostr;
ostr << "Got a delete for an instance that I haven't seen before! instanceId = " << instance;
ErrorReporter::Log(Safir::Dob::Typesystem::Utilities::ToUtf8(ostr.str()));
std::wcout << ostr.str() << std::endl;
return;
}
m_connection.Delete(Safir::Dob::Typesystem::EntityId(DoseStressTest::Pong::ClassTypeId,findIt->second),m_handler);
m_pingPongTable.erase(findIt);
}
void Ponger::Pong(const Safir::Dob::EntityProxy& entityProxy)
{
const Safir::Dob::Typesystem::InstanceId instance = entityProxy.GetInstanceId();
// std::wcout << "Pong " << instance << std::endl;
PingPongTable::iterator findIt = m_pingPongTable.find(instance);
//if it is not in the table it is the first time we've seen it, so add to the table
if (findIt == m_pingPongTable.end())
{
findIt = m_pingPongTable.insert(std::make_pair(instance,Safir::Dob::Typesystem::InstanceId::GenerateRandom())).first;
}
m_entity->Number() = boost::static_pointer_cast<DoseStressTest::Ping>(entityProxy.GetEntity())->Number();
m_entity->WhichPing() = instance;
m_connection.SetAll(m_entity,findIt->second,m_handler);
}
void Ponger::OnRevokedRegistration(const Safir::Dob::Typesystem::TypeId /*typeId*/,
const Safir::Dob::Typesystem::HandlerId& handlerId)
{
std::wcout << "GAAH: Someone overregistered handler " << handlerId << " for DoseStressTest.Pong" << std::endl;
}
|
gpl-3.0
|
drogenlied/qudi
|
interface/confocal_scanner_interface.py
|
5250
|
# -*- coding: utf-8 -*-
"""
This module contains the Qudi interface file for confocal scanner.
Qudi 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.
Qudi 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 Qudi. If not, see <http://www.gnu.org/licenses/>.
Copyright (c) the Qudi Developers. See the COPYRIGHT.txt file at the
top-level directory of this distribution and at <https://github.com/Ulm-IQO/qudi/>
"""
import abc
from core.util.interfaces import InterfaceMetaclass
class ConfocalScannerInterface(metaclass=InterfaceMetaclass):
""" This is the Interface class to define the controls for the simple
microwave hardware.
"""
_modtype = 'ConfocalScannerInterface'
_modclass = 'interface'
@abc.abstractmethod
def reset_hardware(self):
""" Resets the hardware, so the connection is lost and other programs
can access it.
@return int: error code (0:OK, -1:error)
"""
pass
@abc.abstractmethod
def get_position_range(self):
""" Returns the physical range of the scanner.
@return float [4][2]: array of 4 ranges with an array containing lower
and upper limit
"""
pass
@abc.abstractmethod
def set_position_range(self, myrange=None):
""" Sets the physical range of the scanner.
@param float [4][2] myrange: array of 4 ranges with an array containing
lower and upper limit
@return int: error code (0:OK, -1:error)
"""
pass
@abc.abstractmethod
def set_voltage_range(self, myrange=None):
""" Sets the voltage range of the NI Card.
@param float [2] myrange: array containing lower and upper limit
@return int: error code (0:OK, -1:error)
"""
pass
@abc.abstractmethod
def set_up_scanner_clock(self, clock_frequency=None, clock_channel=None):
""" Configures the hardware clock of the NiDAQ card to give the timing.
@param float clock_frequency: if defined, this sets the frequency of the
clock
@param str clock_channel: if defined, this is the physical channel of
the clock
@return int: error code (0:OK, -1:error)
"""
pass
@abc.abstractmethod
def set_up_scanner(self, counter_channel=None, photon_source=None,
clock_channel=None, scanner_ao_channels=None):
""" Configures the actual scanner with a given clock.
@param str counter_channel: if defined, this is the physical channel
of the counter
@param str photon_source: if defined, this is the physical channel where
the photons are to count from
@param str clock_channel: if defined, this specifies the clock for the
counter
@param str scanner_ao_channels: if defined, this specifies the analoque
output channels
@return int: error code (0:OK, -1:error)
"""
pass
@abc.abstractmethod
def scanner_set_position(self, x=None, y=None, z=None, a=None):
"""Move stage to x, y, z, a (where a is the fourth voltage channel).
@param float x: postion in x-direction (volts)
@param float y: postion in y-direction (volts)
@param float z: postion in z-direction (volts)
@param float a: postion in a-direction (volts)
@return int: error code (0:OK, -1:error)
"""
pass
@abc.abstractmethod
def get_scanner_position(self):
""" Get the current position of the scanner hardware.
@return float[]: current position in (x, y, z, a).
"""
pass
@abc.abstractmethod
def set_up_line(self, length=100):
""" Sets up the analoque output for scanning a line.
@param int length: length of the line in pixel
@return int: error code (0:OK, -1:error)
"""
pass
@abc.abstractmethod
def scan_line(self, line_path=None):
""" Scans a line and returns the counts on that line.
@param float[][4] line_path: array of 4-part tuples defining the
positions pixels
@return float[]: the photon counts per second
"""
pass
@abc.abstractmethod
def close_scanner(self):
""" Closes the scanner and cleans up afterwards.
@return int: error code (0:OK, -1:error)
"""
pass
@abc.abstractmethod
def close_scanner_clock(self, power=0):
""" Closes the clock and cleans up afterwards.
@return int: error code (0:OK, -1:error)
"""
pass
|
gpl-3.0
|
monkeyiq/ferris
|
Ferris/Shell.cpp
|
37143
|
/******************************************************************************
*******************************************************************************
*******************************************************************************
ferris
Copyright (C) 2001 Ben Martin
libferris 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.
libferris 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 libferris. If not, see <http://www.gnu.org/licenses/>.
For more details see the COPYING file in the root directory of this
distribution.
$Id: Shell.cpp,v 1.16 2010/09/24 21:30:59 ben Exp $
*******************************************************************************
*******************************************************************************
******************************************************************************/
#include <config.h>
#include "Shell.hh"
#include <Enamel.hh>
#include <Resolver.hh>
#include <Resolver_private.hh>
#include <Ferris.hh>
#include <Ferris_private.hh>
#include <Trimming.hh>
//#include "Ferrisls.hh"
#include "SignalStreams.hh"
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <grp.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/types.h>
#include <utime.h>
using namespace std;
namespace Ferris
{
static bool priv_isTransitiveParent( fh_context base, fh_context p )
{
if( base->isParentBound() )
{
fh_context basep = base->getParent();
if( basep == p )
return true;
return priv_isTransitiveParent( basep, p );
}
return false;
}
bool isTransitiveParent( fh_context base, fh_context p )
{
if( base == p || !base || !p )
return false;
return priv_isTransitiveParent( base, p );
}
static bool running_set_UID = false;
void setRunningSetUID( bool v )
{
running_set_UID = v;
}
bool runningSetUID()
{
return running_set_UID;
}
bool canResolve( const std::string& s )
{
if( starts_with( s, "file:" ) )
{
string subs = s.substr( strlen( "file:" ) );
struct stat buf;
int rc = lstat( subs.c_str(), &buf );
return !rc;
}
try
{
Resolve( s );
return 1;
}
catch( ... )
{
return 0;
}
}
std::string canonicalizeMissing( const std::string& earl )
{
fh_context rootc = Resolve("/");
Context::SplitPath_t sp = rootc->splitPath( earl );
Context::SplitPath_t col;
for( Context::SplitPath_t::iterator si = sp.begin();
si != sp.end(); ++si )
{
string s = *si;
if( s == "." )
continue;
if( s == ".." )
{
col.pop_back();
continue;
}
col.push_back(s);
}
std::string ret = rootc->unSplitPath( col );
return ret;
}
/********************************************************************************/
/********************************************************************************/
/********************************************************************************/
/**
* Save the data from byteContent into the context at rdn with the parent
* parentURL.
*
* One can control if the context is created if it does not exist by setting
* overwrite=true. If one wants to create a new file then set shouldMonsterName=true
* and overwrite=false, which will not overwrite existing data and create a unique
* file with a prefix of the given rdn.
*
* If shouldMonsterName=false and overwrite=false then if a context exists with
* the desired rdn an exception will be thrown.
*
* @parentURL Parent of the desired context
* @rdn_raw Rdn of where to store the data in parentURL
* @byteContent The data to save
* @shouldMonsterName Keep chaning the rdn if objects already exist with the
* given rdn
* @overwrite Overwrite data in existing contexts without prompting
*
*/
fh_context saveFile( const std::string& parentURL,
const std::string& rdn_raw,
const std::string& byteContent,
bool shouldMonsterName,
bool overwrite )
{
fh_context parent = Shell::acquireContext( parentURL );
string rdn = rdn_raw;
fh_context c;
if( shouldMonsterName )
{
rdn = monsterName( parent, rdn );
}
if( parent->isSubContextBound( rdn ) )
{
if( overwrite )
{
c = parent->getSubContext( rdn );
}
else
{
fh_stringstream ss;
ss << "context exists and told not to overwrite existing\n"
<< "for:" << rdn;
Throw_ObjectExists( tostr(ss), 0 );
}
}
else
{
c = Shell::CreateFile( parent, rdn );
}
fh_iostream oss = c->getIOStream( ios::trunc );
oss << byteContent;
return c;
}
/********************************************************************************/
/********************************************************************************/
/********************************************************************************/
namespace Shell
{
ContextCreated_Sig_t& getNullContextCreated_Sig()
{
static ContextCreated_Sig_t x;
return x;
}
std::string quote( const std::string& s )
{
static StringQuote sq( StringQuote::SHELL_QUOTING );
return sq(s);
}
fh_context unrollLinks( fh_context c,
bool throwForException,
int levelOfRecursion )
{
string realpath = getStrAttr( c, "realpath", "" );
// cerr << "unrollLinks() c:" << c->getURL()
// << " realpath:" << realpath
// << endl;
if( realpath.empty() )
return c;
try
{
fh_context nextc = Resolve( realpath );
if( nextc->getURL() == c->getURL() )
return c;
return unrollLinks( nextc, levelOfRecursion - 1 );
}
catch( exception& e )
{
if( !throwForException )
return c;
throw;
}
}
string getCWDString()
{
return getCWDDirPath();
// fh_char c_dir(getcwd(0,0)); // FIXME: Linux only.
// const string& dir = tostr(c_dir);
// return dir;
}
fh_context
getCWD()
{
const string& dir = getCWDString();
RootContextFactory f;
f.setContextClass( "file" );
f.AddInfo( RootContextFactory::ROOT, "/" );
f.AddInfo( RootContextFactory::PATH, dir );
fh_context ret = f.resolveContext( RESOLVE_EXACT );
return ret;
}
const fh_context&
setCWD(fh_context& ctx)
{
int rc = chdir( ctx->getDirPath().c_str() );
if( !rc )
return ctx;
ostringstream ss;
ss << "Ferris::setCWD() for path:" << ctx->getDirPath();
Throw_FerrisSetCWDException( tostr(ss), GetImpl(ctx) );
}
void ensureEA( fh_context c,
const std::string& name,
const std::string& value )
{
setStrAttr( c, name, value, true, true );
}
static void priv_createEA( fh_context c,
const std::string& name,
const std::string& value,
const std::string& explicitPluginShortName,
bool dontDelegateToOvermountContext )
{
fh_mdcontext md = new f_mdcontext();
fh_mdcontext child = md->setChild( "ea", "" );
child->setChild( "name", name );
child->setChild( "value", value );
if( dontDelegateToOvermountContext )
{
child->setChild( "dont-delegate-to-overmount-context", "1" );
}
if( !explicitPluginShortName.empty() )
{
child->setChild( "explicit-plugin-name", explicitPluginShortName );
}
// cerr << "priv_createEA() name:" << name << " value:" << value
// << " value2:" << getStrSubCtx( child, "value", "", true )
// << endl;
c->createSubContext( "", md );
}
void createEA( fh_context c,
const std::string& name,
const std::string& value )
{
priv_createEA( c, name, value, "", false );
}
void createEA( fh_context c,
const std::string& name,
const std::string& value,
const std::string& explicitPluginShortName )
{
priv_createEA( c, name, value, explicitPluginShortName, true );
}
void createEA( fh_context c,
const std::string& name,
const std::string& value,
bool dontDelegateToOvermountContext )
{
priv_createEA( c, name, value, "", dontDelegateToOvermountContext );
}
/**
* If the subcontext is bound, return it, otherwise try to create a
* new subcontext with the given name and return it.
*
* @param parent the parent of the desired context
* @param rdn the name of the child of parent that is desired
*/
fh_context acquireSubContext( fh_context parent,
const std::string& rdn,
bool isDir,
int mode,
ContextCreated_Sig_t& sigh )
{
parent->read();
LG_CTX_D << "acquireSubContext parent:" << parent->getURL()
<< " rdn:" << rdn
<< " bound:" << parent->isSubContextBound( rdn )
<< endl;
if( parent->isSubContextBound( rdn ) )
{
return parent->getSubContext( rdn );
}
if( isDir )
{
return Shell::CreateDir( parent, rdn, false, mode, sigh );
}
else
{
return Shell::CreateFile( parent, rdn, mode, sigh );
}
}
fh_context CreateFile( fh_context c,
const std::string& n,
int mode,
ContextCreated_Sig_t& sigh )
{
fh_mdcontext md = new f_mdcontext();
fh_mdcontext child = md->setChild( "file", "" );
child->setChild( "name", n );
if( mode )
{
child->setChild( "mode", tostr( mode ) );
child->setChild( "ignore-umask", "1" );
}
fh_context newc = c->createSubContext( "", md );
sigh.emit( newc );
return newc;
}
fh_context CreateDB4( fh_context c,
const std::string& n,
int mode,
ContextCreated_Sig_t& sigh )
{
fh_mdcontext md = new f_mdcontext();
fh_mdcontext child = md->setChild( "db4", "" );
child->setChild( "name", n );
if( mode )
{
child->setChild( "mode", tostr( mode ) );
child->setChild( "ignore-umask", "1" );
}
fh_context newc = c->createSubContext( "", md );
sigh.emit( newc );
return newc;
}
fh_context EnsureDB4( const std::string& path, const std::string& n )
{
try
{
fh_context ret = Resolve( path + "/" + n );
return ret;
}
catch( exception& e )
{
return CreateDB4( Resolve(path), n );
}
}
/**
* Create a link to existingc in a new object with newrdn under the parent newc_parent.
* Optionally use the URL of the existing object.
*/
fh_context CreateLink( fh_context existingc,
fh_context newc_parent,
const std::string& newrdn,
bool useURL,
bool isSoft,
ContextCreated_Sig_t& sigh )
{
fh_mdcontext md = new f_mdcontext();
fh_mdcontext child;
if( isSoft )
child = md->setChild( "softlink", "" );
else
child = md->setChild( "hardlink", "" );
string target = existingc->getDirPath();
if( useURL )
target = existingc->getURL();
child->setChild( "name", newrdn );
child->setChild( "link-target", target );
fh_context newc = newc_parent->createSubContext( "", md );
sigh.emit( newc );
return newc;
}
static fh_context CreateDirOneLevel( fh_context c,
const std::string& n,
int mode,
ContextCreated_Sig_t& sigh )
{
LG_CTX_D << "CreateDirOneLevel() c:" << c->getURL() << " n:" << n << endl;
fh_mdcontext md = new f_mdcontext();
fh_mdcontext child = md->setChild( "dir", "" );
child->setChild( "name", n );
if( mode )
{
// cerr << "CreateDirOneLevel() user supplied mode:" << mode << endl;
child->setChild( "mode", tostr(mode) );
child->setChild( "ignore-umask", "1" );
}
else
{
// cerr << "CreateDirOneLevel() using mode 770" << endl;
child->setChild( "mode", "770" );
// child->setChild( "ignore-umask", "1" );
}
fh_context newc = c->createSubContext( "", md );
// cerr << "calling emit on sigh for newc:" << newc->getURL() << endl;
sigh.emit( newc );
LG_CTX_D << "CreateDirOneLevel() c:" << c->getURL() << " n:" << n
<< " newc:" << newc->getURL()
<< endl;
return newc;
}
fh_context CreateDirWithParents( fh_context c,
const std::string& n,
int mode,
ContextCreated_Sig_t& sigh )
{
typedef Context::SplitPath_t SplitPath_t;
SplitPath_t sp = c->splitPath( n );
for( SplitPath_t::iterator iter = sp.begin(); iter != sp.end(); ++iter )
{
LG_CTX_D << "CreateDirWithParents() c:" << c->getURL()
<< " n:" << n
<< " iter:" << *iter
<< " iter.len:" << iter->length()
<< endl;
string rdn = *iter;
if( rdn.empty() )
continue;
try
{
if( c->isSubContextBound( rdn ) )
{
c = c->getSubContext( rdn );
}
else
{
fh_context newc = Shell::CreateDirOneLevel( c, rdn, mode, sigh );
c = newc;
}
}
catch( FerrisCreateSubContextFailed& e )
{
LG_CTX_D << "CreateDirWithParents() c:" << c->getURL()
<< " n:" << n
<< " iter:" << *iter
<< " FerrisCreateSubContextFailed:" << e.what()
<< endl;
c = c->getSubContext( rdn );
}
}
return c;
}
/**
* Create a directory context.
*
* @param c parent of new context
* @param n rdn of new context
* @param WithParents if true then 'n' can be a partial path and all directories
* in that path will be created under the context 'c'. Handy for creating
* directories from a given compile time prefix or ~ etc.
*/
fh_context CreateDir( fh_context c,
const std::string& n,
bool WithParents,
int mode,
ContextCreated_Sig_t& sigh )
{
if( !WithParents )
{
return CreateDirOneLevel( c, n, mode, sigh );
}
return CreateDirWithParents( c, n, mode, sigh );
}
/**
* Create a directory context.
*
* @param path the new context to create
* @param WithParents if true then create all parent directories if they
* dont already exist. If false then only one directory may be created.
*/
fh_context CreateDir( const std::string& path,
bool WithParents,
int mode,
ContextCreated_Sig_t& sigh )
{
fh_context rc = Resolve("/");
if( !WithParents )
{
typedef Context::SplitPath_t SplitPath_t;
SplitPath_t sp = rc->splitPath( path );
string rdn = sp.back();
string cpath = path.substr( 0, path.length() - rdn.length() );
fh_context c = Resolve( cpath );
return CreateDirOneLevel( c, rdn, mode, sigh );
}
string earl = CleanupURL( path );
FerrisURL u = FerrisURL::fromString( earl );
string scheme = u.getInternalFerisScheme();
string url = u.getPath();
LG_CTX_D << "CreateDir() scheme:" << scheme << " url:" << url << endl;
return CreateDirWithParents( Resolve(scheme + ":///"), url, mode, sigh );
}
// //
// // FIXME: should walk known schemes here too
// //
// bool isRelativePath( const std::string& path )
// {
// return( !starts_with( path, "/" )
// && !starts_with( path, "file:" )
// && !starts_with( path, "~" )
// && !starts_with( path, "root:" )
// && !starts_with( path, "x-ferris:" ) );
// }
// template<>
stringlist_t::iterator XparseSeperatedList( const std::string& s,
stringlist_t& c,
stringlist_t::iterator out,
const char sepchar )
{
// bool dummy = Loki::Conversion< OutputIterator, stringlist_t::iterator >::exists;
std::string tmp;
std::stringstream ss(s);
while( std::getline( ss, tmp, sepchar ))
if( !tmp.empty() )
{
*++out = tmp;
}
return out;
}
fh_context acquireContext( std::string path,
int mode,
bool isDir,
ContextCreated_Sig_t& sigh )
{
// cerr << "acquireContext() path:" << path << " isrel:" << isRelativePath(path)
// << endl;
// if( isRelativePath(path) )
// {
// path = getCWDDirPath() + "/" + path;
// }
LG_CTX_D << "acquireContext(top) path:" << path << endl;
try
{
fh_context c = Resolve( path );
return c;
}
catch( exception& e )
{
LG_CTX_D << "acquireContext() e:" << e.what() << endl;
// string rootdir = "/";
// if( path.find(":") != string::npos )
// {
// rootdir = path.substr( 0, path.find(":") ) + "://";
// path = path.substr( path.find(":")+1 );
// PrefixTrimmer trimmer;
// trimmer.push_back( "/" );
// path = trimmer( path );
// }
// if( starts_with( path, "~" ))
// {
// rootdir = "~";
// PrefixTrimmer trimmer;
// trimmer.push_back( "/" );
// trimmer.push_back( "~" );
// path = trimmer( path );
// }
// LG_CTX_D << "acquireContext() path:" << path
// << " root:" << rootdir
// << endl;
// fh_context c = 0;
// if( isDir )
// c = Shell::CreateDir( Resolve( rootdir ), path, true, mode, sigh );
// else
// c = Shell::CreateFile( Resolve( rootdir ), path, mode, sigh );
// return c;
// cerr << "acquireContext(make) path:" << path << endl;
string rdn = "";
// int slashpos = path.find("/");
int slashpos = -1;
fh_context lastc = 0;
if( string::npos == path.find("/") )
{
lastc = getCWD();
}
else
{
if( path.find("/") == 0 )
slashpos = 0;
while( true )
{
try
{
int tpos = path.find( '/', slashpos+1 );
LG_CTX_D << "acquireContext(seeking) path:" << path
<< " path.substr:" << path.substr( 0, tpos )
<< " slashpos:" << slashpos
<< " tpos:" << tpos
<< endl;
fh_context tc = Resolve( path.substr( 0, tpos ));
slashpos = tpos;
lastc = tc;
}
catch( ... )
{
break;
}
}
}
LG_CTX_D << "acquireContext(lastc) lastc:" << toVoid(lastc) << endl;
fh_context parent = lastc;
LG_CTX_D << "acquireContext(lastc) parent:" << toVoid(parent) << endl;
LG_CTX_D << "acquireContext(lastc) parent:" << parent->getURL() << endl;
rdn = path.substr( slashpos+1, path.length() - slashpos );
LG_CTX_D << "TOUCH() parent:" << parent->getURL()
<< " rdn:" << rdn
<< " slashpos:" << slashpos
<< endl;
// cerr << "TOUCH() parent:" << parent->getURL()
// << " rdn:" << rdn
// << " slashpos:" << slashpos
// << endl;
/**
* Make all non terminal objects directories and the last object a file
* if we are requested to make a 'file'
*/
fh_context c = parent;
stringlist_t rdnlist;
Util::parseSeperatedList( rdn, rdnlist, back_inserter( rdnlist ), '/' );
// XparseSeperatedList( rdn, rdnlist, back_inserter( rdnlist ), '/' );
for( stringlist_t::const_iterator si = rdnlist.begin(); si != rdnlist.end(); ++si )
{
string rdn = *si;
bool createDir = isDir;
stringlist_t::const_iterator nextiter = si;
++nextiter;
if( nextiter != rdnlist.end() )
createDir = true;
LG_CTX_D << "TOUCH(building) c:" << c->getURL()
<< " rdn:" << rdn
<< endl;
if( createDir )
c = Shell::CreateDir( c, rdn, true, mode, sigh );
else
c = Shell::CreateFile( c, rdn, mode, sigh );
}
return c;
}
}
};
/********************************************************************************/
/********************************************************************************/
/********************************************************************************/
namespace Shell
{
string getHomeDirPath_nochecks()
{
static bool cached_ret_set = false;
static string cached_ret;
if( !runningSetUID() && cached_ret_set )
return cached_ret;
string ret;
// const char *home = g_get_home_dir();
// const char *home = getenv("HOME");
// ret = home;
ret = ferris_g_get_home_dir();
if( !cached_ret_set )
{
cached_ret_set = true;
cached_ret = ret;
}
return ret;
}
string getCWDDirPath()
{
gchar* cdir = g_get_current_dir();
string ret = cdir;
g_free(cdir);
return ret;
}
void setCWDDirPath( const std::string& p )
{
if( 0 != chdir( p.c_str() ))
{
int eno = errno;
fh_stringstream ss;
ss << "Can not setCWDDirPath to p:" << p << endl;
ThrowFromErrno( eno, tostr(ss), 0 );
}
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/**
*
* NOTE: This is under debait as to if this class should be used or
* appendToPath() used to pass the full path to system calls.
*
* Sets the CWD to the given value and then restores it when this
* object is deleted. The use of this class could also hold a lock
* against other users of setCWDDirPath() so that they have to wait
* for this object to die.
*/
class FERRISEXP_DLLLOCAL HoldRestoreCWD
{
const std::string& oldCWD;
public:
HoldRestoreCWD( const std::string& p );
~HoldRestoreCWD();
};
HoldRestoreCWD::HoldRestoreCWD( const std::string& p )
:
oldCWD( getCWDDirPath() )
{
setCWDDirPath( p );
}
HoldRestoreCWD::~HoldRestoreCWD()
{
setCWDDirPath( oldCWD );
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
string getTmpDirPath()
{
const char *td = getenv("FERRIS_TMP");
// cerr << "getTmpDirPath() td:" << ( td ? td : "null" ) << endl;
if( td )
{
return td;
}
return g_get_tmp_dir();
}
string getHomeDirPath()
{
string ret = getHomeDirPath_nochecks();
if(!ret.length())
{
LG_PATHS_ER
<< "Can not determine home directory! please set HOME and try again"
<< endl;
exit(1);
}
return ret;
}
bool contextExists( const std::string& path )
{
try
{
fh_context c = Resolve( path );
return true;
}
catch(...)
{
}
return false;
}
static struct passwd* passwd_lookup_by_name( string name )
{
if( name.empty() )
{
struct passwd* ptr = getpwuid( getuid() );
return ptr;
}
struct passwd* ptr = getpwnam( name.c_str() );
return ptr;
// struct passwd* ptr = 0;
// setpwent();
// while( ptr = getpwent() )
// {
// if( name == ptr->pw_name )
// break;
// }
// endpwent();
// return ptr;
}
uid_t getUserID( const std::string& name )
{
struct passwd* ptr = passwd_lookup_by_name( name );
if( ptr )
return ptr->pw_uid;
fh_stringstream ss;
ss << "Cant find user:" << name << " in password database";
Throw_NoSuchUser( tostr(ss), 0 );
}
gid_t getGroupID( const std::string& name )
{
struct passwd* ptr = passwd_lookup_by_name( name );
if( ptr )
return ptr->pw_gid;
fh_stringstream ss;
ss << "Cant find user:" << name << " in password database";
Throw_NoSuchUser( tostr(ss), 0 );
}
string getUserName( uid_t id )
{
struct passwd* p = getpwuid( id );
return ( p ? p->pw_name : "" );
}
string getGroupName( gid_t id )
{
struct group *g = getgrgid( id );
return( g ? g->gr_name : "" );
}
fh_context touch( const std::string& path,
bool create,
bool isDir,
int mode,
bool touchMTime,
bool touchATime,
time_t useMTime,
time_t useATime )
{
return touch( path, "",
create, isDir, mode,
touchMTime, touchATime,
useMTime, useATime );
}
fh_context touch( const std::string& path,
const std::string& SELinux_context,
bool create,
bool isDir,
int mode,
bool touchMTime,
bool touchATime,
time_t useMTime,
time_t useATime )
{
int rc = 0;
fh_context c = 0;
if( create )
{
c = acquireContext( path, mode, isDir );
}
else
c = Resolve( path );
if( !SELinux_context.empty() )
{
setStrAttr( c,
"dontfollow-selinux-context",
SELinux_context,
true, true );
}
struct utimbuf tbuf;
time_t timenow = Time::getTime();
if( touchMTime )
{
if( useMTime ) tbuf.modtime = useMTime;
else tbuf.modtime = timenow;
}
else
{
tbuf.modtime = toType<time_t>(getStrAttr( c, "mtime", "0", true, true ));
}
if( touchATime )
{
if( useATime ) tbuf.actime = useATime;
else tbuf.actime = timenow;
}
else
{
tbuf.actime = toType<time_t>(getStrAttr( c, "atime", "0", true, true ));
}
if( c->getIsNativeContext() )
{
rc = utime( c->getDirPath().c_str(), &tbuf );
if( rc )
{
int eno = errno;
fh_stringstream ss;
ss << "Can not touch file url:" << c->getURL() << endl;
ThrowFromErrno( eno, tostr(ss), 0 );
}
}
return c;
}
int generateTempFD( std::string& templateStr )
{
string s = templateStr;
if( !ends_with( s, "XXXXXX" ) )
{
int dotpos = s.rfind( "." );
if( dotpos == string::npos )
{
s = s + "XXXXXX";
}
else
{
s = s.substr( 0, dotpos ) + "-XXXXXX" + s.substr( dotpos );
}
}
int fd = mkstemp( (char*)s.c_str() );
if( fd == -1 )
{
ThrowFromErrno( errno, (string)"error creating tempfile at:" + s );
}
templateStr = s;
return fd;
}
fh_iostream generteTempFile( std::string& templateStr, bool closeFD )
{
int fd = generateTempFD( templateStr );
fh_iostream ret = Factory::MakeFdIOStream( fd, closeFD );
return ret;
}
fh_context generateTempDir( std::string& templateStr )
{
string s = templateStr;
if( !starts_with( s, "/tmp" ) )
{
stringstream ss;
ss << "/tmp/" << getuid() << "-" << s;
s = ss.str();
}
if( !ends_with( s, "XXXXXX" ) )
{
int dotpos = s.rfind( "." );
if( dotpos == string::npos )
{
s = s + "XXXXXX";
}
else
{
s = s.substr( 0, dotpos ) + "-XXXXXX" + s.substr( dotpos );
}
}
char* p = mkdtemp( (char*)s.c_str() );
if( !p )
{
ThrowFromErrno( errno, (string)"error creating temp dir at:" + s );
}
templateStr = p;
fh_context ret = Resolve( templateStr );
return ret;
}
int generateTempFD()
{
string s = "/tmp/temp";
return generateTempFD( s );
}
int
generateTempFD( const char* templateStrReadOnly )
{
string s = templateStrReadOnly;
return generateTempFD( s );
}
fh_iostream generteTempFile( bool closeFD )
{
string s = "/tmp/temp";
return generteTempFile( s, closeFD );
}
};
};
|
gpl-3.0
|
deathcap/BedrockAPI
|
src/main/java/org/bukkit/material/MonsterEggs.java
|
612
|
package org.bukkit.material;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.material.MaterialData;
import org.bukkit.material.MonsterEggs;
import org.bukkit.material.TexturedMaterial;
public class MonsterEggs extends TexturedMaterial {
public MonsterEggs() {
}
@Deprecated public MonsterEggs(int type) {
}
public MonsterEggs(Material type) {
}
@Deprecated public MonsterEggs(int type, byte data) {
}
@Deprecated public MonsterEggs(Material type, byte data) {
}
public List<Material> getTextures() {
return null;
}
public MonsterEggs clone() {
return null;
}
}
|
gpl-3.0
|
nicolaswenk/cf_heritage
|
Assets/Scripts/Model/Input/PepInputController.cs
|
2361
|
using UnityEngine;
using System.IO.Ports;
/// <summary>
/// This class manages the device that gets the pressure / flow from the PEP.
/// The input selection is done in BuildAndStart() in Assets/Scripts/Controller/LevelController.cs.
/// </summary>
public class PepInputController : InputController_I
{
public static string arduinoValue;
public static float pepValue = 0f;
SerialPort stream = new SerialPort("COM4", 9600);
private float initPepValue = 0.0f;
private float calibrationFactor = 1.0f;
public PepInputController()
{
stream.Open();
streamIn();
initPepValue = pepValue;
Debug.Log("HEY_PEP");
// stream.ReadTimeout = 100; // milliseconds
//InvokeRepeating("streamIn", 0.01f, 0.01f); // start delay, repeat delay in seconds
}
void streamIn()
{
if (stream.IsOpen)
{
try
{
arduinoValue = stream.ReadLine(); // reads serial port
pepValue = float.Parse(arduinoValue); // should be from 0 to 100
pepValue = pepValue / 100.0f;
pepValue -= initPepValue;
Debug.Log(pepValue);
}
catch (System.Exception) // exit the reading if no value to avoid infinite run
{
Debug.LogError("exception Arduino");
}
}
}
/// <summary>
/// Gets the strength of expiration. 0.0f means that the patient is not blowing.
/// </summary>
public float GetStrength()
{
return pepValue;
}
/// <summary>
/// Gets the BreathingState (expiration, inspiration, holding breath, ...).
/// </summary>
public BreathingState GetInputState(){
if (pepValue > 0.1f) {
return BreathingState.EXPIRATION;
} else {
return BreathingState.HOLDING_BREATH;
}
}
/// <summary>
/// Determines whether the patient is holding the moving input or not (if the right arrow of the keyboard is down or not).
/// </summary>
public bool IsMoving(){
return Input.GetKey (KeyCode.RightArrow);
}
void InputController_I.Update()
{
streamIn();
}
public void SetCalibrationFactor(float calibrationFactor)
{
this.calibrationFactor = calibrationFactor;
}
public float GetCalibrationFactor()
{
return calibrationFactor;
}
}
|
gpl-3.0
|
Darkpeninsula/Darkcore-Rebase
|
src/server/worldserver/CommandLine/CliRunnable.cpp
|
19348
|
/*
* Copyright (C) 2011-2012 DarkCore <http://www.darkpeninsula.eu/>
* Copyright (C) 2011-2012 Project SkyFire <http://www.projectskyfire.org/>
* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 3 of the License, or (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/>.
*/
/// \addtogroup Darkcored
/// @{
/// \file
#include "Common.h"
#include "ObjectMgr.h"
#include "World.h"
#include "WorldSession.h"
#include "Configuration/Config.h"
#include "AccountMgr.h"
#include "Chat.h"
#include "CliRunnable.h"
#include "Language.h"
#include "Log.h"
#include "MapManager.h"
#include "Player.h"
#include "Util.h"
#if PLATFORM != PLATFORM_WINDOWS
#include <readline/readline.h>
#include <readline/history.h>
char * command_finder(const char* text, int state)
{
static int idx, len;
const char* ret;
ChatCommand* cmd = ChatHandler::getCommandTable();
if (!state)
{
idx = 0;
len = strlen(text);
}
while ((ret = cmd[idx].Name))
{
if (!cmd[idx].AllowConsole)
{
idx++;
continue;
}
idx++;
//printf("Checking %s \n", cmd[idx].Name);
if (strncmp(ret, text, len) == 0)
return strdup(ret);
if (cmd[idx].Name == NULL)
break;
}
return ((char*)NULL);
}
char ** cli_completion(const char * text, int start, int /*end*/)
{
char ** matches;
matches = (char**)NULL;
if (start == 0)
matches = rl_completion_matches((char*)text, &command_finder);
else
rl_bind_key('\t', rl_abort);
return (matches);
}
int cli_hook_func(void)
{
if (World::IsStopped())
rl_done = 1;
return 0;
}
#endif
void utf8print(void* /*arg*/, const char* str)
{
#if PLATFORM == PLATFORM_WINDOWS
wchar_t wtemp_buf[6000];
size_t wtemp_len = 6000-1;
if (!Utf8toWStr(str, strlen(str), wtemp_buf, wtemp_len))
return;
char temp_buf[6000];
CharToOemBuffW(&wtemp_buf[0], &temp_buf[0], wtemp_len+1);
printf(temp_buf);
#else
{
printf("%s", str);
fflush(stdout);
}
#endif
}
void commandFinished(void*, bool /*success*/)
{
printf("DarkCore> ");
fflush(stdout);
}
/**
* Collects all GUIDs (and related info) from deleted characters which are still in the database.
*
* @param foundList a reference to an std::list which will be filled with info data
* @param searchString the search string which either contains a player GUID or a part fo the character-name
* @return returns false if there was a problem while selecting the characters (e.g. player name not normalizeable)
*/
bool ChatHandler::GetDeletedCharacterInfoList(DeletedInfoList& foundList, std::string searchString)
{
QueryResult resultChar;
if (!searchString.empty())
{
// search by GUID
if (isNumeric(searchString.c_str()))
resultChar = CharacterDatabase.PQuery("SELECT guid, deleteInfos_Name, deleteInfos_Account, deleteDate FROM characters WHERE deleteDate IS NOT NULL AND guid = %u", uint64(atoi(searchString.c_str())));
// search by name
else
{
if (!normalizePlayerName(searchString))
return false;
resultChar = CharacterDatabase.PQuery("SELECT guid, deleteInfos_Name, deleteInfos_Account, deleteDate FROM characters WHERE deleteDate IS NOT NULL AND deleteInfos_Name " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), searchString.c_str());
}
}
else
resultChar = CharacterDatabase.Query("SELECT guid, deleteInfos_Name, deleteInfos_Account, deleteDate FROM characters WHERE deleteDate IS NOT NULL");
if (resultChar)
{
do
{
Field* fields = resultChar->Fetch();
DeletedInfo info;
info.lowguid = fields[0].GetUInt32();
info.name = fields[1].GetString();
info.accountId = fields[2].GetUInt32();
// account name will be empty for Does not exist account
AccountMgr::GetName(info.accountId, info.accountName);
info.deleteDate = time_t(fields[3].GetUInt32());
foundList.push_back(info);
} while (resultChar->NextRow());
}
return true;
}
/**
* Generate WHERE guids list by deleted info in way preventing return too long where list for existed query string length limit.
*
* @param itr a reference to an deleted info list iterator, it updated in function for possible next function call if list to long
* @param itr_end a reference to an deleted info list iterator end()
* @return returns generated where list string in form: 'guid IN (gui1, guid2, ...)'
*/
std::string ChatHandler::GenerateDeletedCharacterGUIDsWhereStr(DeletedInfoList::const_iterator& itr, DeletedInfoList::const_iterator const& itr_end)
{
std::ostringstream wherestr;
wherestr << "guid IN ('";
for (; itr != itr_end; ++itr)
{
wherestr << itr->lowguid;
if (wherestr.str().size() > MAX_QUERY_LEN - 50) // near to max query
{
++itr;
break;
}
DeletedInfoList::const_iterator itr2 = itr;
if (++itr2 != itr_end)
wherestr << "', '";
}
wherestr << "')";
return wherestr.str();
}
/**
* Shows all deleted characters which matches the given search string, expected non empty list
*
* @see ChatHandler::HandleCharacterDeletedListCommand
* @see ChatHandler::HandleCharacterDeletedRestoreCommand
* @see ChatHandler::HandleCharacterDeletedDeleteCommand
* @see ChatHandler::DeletedInfoList
*
* @param foundList contains a list with all found deleted characters
*/
void ChatHandler::HandleCharacterDeletedListHelper(DeletedInfoList const& foundList)
{
if (!_session)
{
SendSysMessage(LANG_CHARACTER_DELETED_LIST_BAR);
SendSysMessage(LANG_CHARACTER_DELETED_LIST_HEADER);
SendSysMessage(LANG_CHARACTER_DELETED_LIST_BAR);
}
for (DeletedInfoList::const_iterator itr = foundList.begin(); itr != foundList.end(); ++itr)
{
std::string dateStr = TimeToTimestampStr(itr->deleteDate);
if (!_session)
PSendSysMessage(LANG_CHARACTER_DELETED_LIST_LINE_CONSOLE,
itr->lowguid, itr->name.c_str(), itr->accountName.empty() ? "<Does not exist>" : itr->accountName.c_str(),
itr->accountId, dateStr.c_str());
else
PSendSysMessage(LANG_CHARACTER_DELETED_LIST_LINE_CHAT,
itr->lowguid, itr->name.c_str(), itr->accountName.empty() ? "<Does not exist>" : itr->accountName.c_str(),
itr->accountId, dateStr.c_str());
}
if (!_session)
SendSysMessage(LANG_CHARACTER_DELETED_LIST_BAR);
}
/**
* Handles the '.character deleted list' command, which shows all deleted characters which matches the given search string
*
* @see ChatHandler::HandleCharacterDeletedListHelper
* @see ChatHandler::HandleCharacterDeletedRestoreCommand
* @see ChatHandler::HandleCharacterDeletedDeleteCommand
* @see ChatHandler::DeletedInfoList
*
* @param args the search string which either contains a player GUID or a part fo the character-name
*/
bool ChatHandler::HandleCharacterDeletedListCommand(const char* args)
{
DeletedInfoList foundList;
if (!GetDeletedCharacterInfoList(foundList, args))
return false;
// if no characters have been found, output a warning
if (foundList.empty())
{
SendSysMessage(LANG_CHARACTER_DELETED_LIST_EMPTY);
return false;
}
HandleCharacterDeletedListHelper(foundList);
return true;
}
/**
* Restore a previously deleted character
*
* @see ChatHandler::HandleCharacterDeletedListHelper
* @see ChatHandler::HandleCharacterDeletedRestoreCommand
* @see ChatHandler::HandleCharacterDeletedDeleteCommand
* @see ChatHandler::DeletedInfoList
*
* @param delInfo the informations about the character which will be restored
*/
void ChatHandler::HandleCharacterDeletedRestoreHelper(DeletedInfo const& delInfo)
{
if (delInfo.accountName.empty()) // account not exist
{
PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_ACCOUNT, delInfo.name.c_str(), delInfo.lowguid, delInfo.accountId);
return;
}
// check character count
uint32 charcount = AccountMgr::GetCharactersCount(delInfo.accountId);
if (charcount >= 10)
{
PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_FULL, delInfo.name.c_str(), delInfo.lowguid, delInfo.accountId);
return;
}
if (sObjectMgr->GetPlayerGUIDByName(delInfo.name))
{
PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_NAME, delInfo.name.c_str(), delInfo.lowguid, delInfo.accountId);
return;
}
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_RESTORE_DELETE_INFO);
stmt->setString(0, delInfo.name);
stmt->setUInt32(1, delInfo.accountId);
stmt->setUInt32(2, delInfo.lowguid);
CharacterDatabase.Execute(stmt);
}
/**
* Handles the '.character deleted restore' command, which restores all deleted characters which matches the given search string
*
* The command automatically calls '.character deleted list' command with the search string to show all restored characters.
*
* @see ChatHandler::HandleCharacterDeletedRestoreHelper
* @see ChatHandler::HandleCharacterDeletedListCommand
* @see ChatHandler::HandleCharacterDeletedDeleteCommand
*
* @param args the search string which either contains a player GUID or a part of the character-name
*/
bool ChatHandler::HandleCharacterDeletedRestoreCommand(const char* args)
{
// It is required to submit at least one argument
if (!*args)
return false;
std::string searchString;
std::string newCharName;
uint32 newAccount = 0;
// GCC by some strange reason fail build code without temporary variable
std::istringstream params(args);
params >> searchString >> newCharName >> newAccount;
DeletedInfoList foundList;
if (!GetDeletedCharacterInfoList(foundList, searchString))
return false;
if (foundList.empty())
{
SendSysMessage(LANG_CHARACTER_DELETED_LIST_EMPTY);
return false;
}
SendSysMessage(LANG_CHARACTER_DELETED_RESTORE);
HandleCharacterDeletedListHelper(foundList);
if (newCharName.empty())
{
// Drop Does not exist account cases
for (DeletedInfoList::iterator itr = foundList.begin(); itr != foundList.end(); ++itr)
HandleCharacterDeletedRestoreHelper(*itr);
}
else if (foundList.size() == 1 && normalizePlayerName(newCharName))
{
DeletedInfo delInfo = foundList.front();
// update name
delInfo.name = newCharName;
// if new account provided update deleted info
if (newAccount && newAccount != delInfo.accountId)
{
delInfo.accountId = newAccount;
AccountMgr::GetName(newAccount, delInfo.accountName);
}
HandleCharacterDeletedRestoreHelper(delInfo);
}
else
SendSysMessage(LANG_CHARACTER_DELETED_ERR_RENAME);
return true;
}
/**
* Handles the '.character deleted delete' command, which completely deletes all deleted characters which matches the given search string
*
* @see Player::GetDeletedCharacterGUIDs
* @see Player::DeleteFromDB
* @see ChatHandler::HandleCharacterDeletedListCommand
* @see ChatHandler::HandleCharacterDeletedRestoreCommand
*
* @param args the search string which either contains a player GUID or a part fo the character-name
*/
bool ChatHandler::HandleCharacterDeletedDeleteCommand(const char* args)
{
// It is required to submit at least one argument
if (!*args)
return false;
DeletedInfoList foundList;
if (!GetDeletedCharacterInfoList(foundList, args))
return false;
if (foundList.empty())
{
SendSysMessage(LANG_CHARACTER_DELETED_LIST_EMPTY);
return false;
}
SendSysMessage(LANG_CHARACTER_DELETED_DELETE);
HandleCharacterDeletedListHelper(foundList);
// Call the appropriate function to delete them (current account for deleted characters is 0)
for (DeletedInfoList::const_iterator itr = foundList.begin(); itr != foundList.end(); ++itr)
Player::DeleteFromDB(itr->lowguid, 0, false, true);
return true;
}
/**
* Handles the '.character deleted old' command, which completely deletes all deleted characters deleted with some days ago
*
* @see Player::DeleteOldCharacters
* @see Player::DeleteFromDB
* @see ChatHandler::HandleCharacterDeletedDeleteCommand
* @see ChatHandler::HandleCharacterDeletedListCommand
* @see ChatHandler::HandleCharacterDeletedRestoreCommand
*
* @param args the search string which either contains a player GUID or a part fo the character-name
*/
bool ChatHandler::HandleCharacterDeletedOldCommand(const char* args)
{
int32 keepDays = sWorld->getIntConfig(CONFIG_CHARDELETE_KEEP_DAYS);
char* px = strtok((char*)args, " ");
if (px)
{
if (!isNumeric(px))
return false;
keepDays = atoi(px);
if (keepDays < 0)
return false;
}
// config option value 0 -> disabled and can't be used
else if (keepDays <= 0)
return false;
Player::DeleteOldCharacters((uint32)keepDays);
return true;
}
bool ChatHandler::HandleCharacterEraseCommand(const char* args){
if (!*args)
return false;
char *character_name_str = strtok((char*)args, " ");
if (!character_name_str)
return false;
std::string character_name = character_name_str;
if (!normalizePlayerName(character_name))
return false;
uint64 character_guid;
uint32 account_id;
Player* player = sObjectAccessor->FindPlayerByName(character_name.c_str());
if (player)
{
character_guid = player->GetGUID();
account_id = player->GetSession()->GetAccountId();
player->GetSession()->KickPlayer();
}
else
{
character_guid = sObjectMgr->GetPlayerGUIDByName(character_name);
if (!character_guid)
{
PSendSysMessage(LANG_NO_PLAYER, character_name.c_str());
SetSentErrorMessage(true);
return false;
}
account_id = sObjectMgr->GetPlayerAccountIdByGUID(character_guid);
}
std::string account_name;
AccountMgr::GetName (account_id, account_name);
Player::DeleteFromDB(character_guid, account_id, true, true);
PSendSysMessage(LANG_CHARACTER_DELETED, character_name.c_str(), GUID_LOPART(character_guid), account_name.c_str(), account_id);
return true;
}
/// Exit the realm
bool ChatHandler::HandleServerExitCommand(const char* /*args*/)
{
SendSysMessage(LANG_COMMAND_EXIT);
World::StopNow(SHUTDOWN_EXIT_CODE);
return true;
}
/// Set the level of logging
bool ChatHandler::HandleServerSetLogFileLevelCommand(const char *args)
{
if (!*args)
return false;
char *NewLevel = strtok((char*)args, " ");
if (!NewLevel)
return false;
sLog->SetLogFileLevel(NewLevel);
return true;
}
/// Set the level of logging
bool ChatHandler::HandleServerSetLogLevelCommand(const char *args)
{
if (!*args)
return false;
char *NewLevel = strtok((char*)args, " ");
if (!NewLevel)
return false;
sLog->SetLogLevel(NewLevel);
return true;
}
/// set diff time record interval
bool ChatHandler::HandleServerSetDiffTimeCommand(const char *args)
{
if (!*args)
return false;
char *NewTimeStr = strtok((char*)args, " ");
if (!NewTimeStr)
return false;
int32 NewTime =atoi(NewTimeStr);
if (NewTime < 0)
return false;
sWorld->SetRecordDiffInterval(NewTime);
printf( "Record diff every %u ms\n", NewTime);
return true;
}
/// toggle sql driver query logging
bool ChatHandler::HandleServerToggleQueryLogging(const char* /* args */)
{
sLog->SetSQLDriverQueryLogging(!sLog->GetSQLDriverQueryLogging());
if (sLog->GetSQLDriverQueryLogging())
PSendSysMessage(LANG_SQLDRIVER_QUERY_LOGGING_ENABLED);
else
PSendSysMessage(LANG_SQLDRIVER_QUERY_LOGGING_DISABLED);
return true;
}
/// @}
#ifdef linux
// Non-blocking keypress detector, when return pressed, return 1, else always return 0
int kb_hit_return()
{
struct timeval tv;
fd_set fds;
tv.tv_sec = 0;
tv.tv_usec = 0;
FD_ZERO(&fds);
FD_SET(STDIN_FILENO, &fds);
select(STDIN_FILENO+1, &fds, NULL, NULL, &tv);
return FD_ISSET(STDIN_FILENO, &fds);
}
#endif
/// %Thread start
void CliRunnable::run()
{
///- Display the list of available CLI functions then beep
//sLog->outString("");
#if PLATFORM != PLATFORM_WINDOWS
rl_attempted_completion_function = cli_completion;
rl_event_hook = cli_hook_func;
#endif
if (ConfigMgr::GetBoolDefault("BeepAtStart", true))
printf("\a"); // \a = Alert
// print this here the first time
// later it will be printed after command queue updates
printf("DarkCore>");
///- As long as the World is running (no World::m_stopEvent), get the command line and handle it
while (!World::IsStopped())
{
fflush(stdout);
char *command_str ; // = fgets(commandbuf, sizeof(commandbuf), stdin);
#if PLATFORM == PLATFORM_WINDOWS
char commandbuf[256];
command_str = fgets(commandbuf, sizeof(commandbuf), stdin);
#else
command_str = readline("DarkCore>");
rl_bind_key('\t', rl_complete);
#endif
if (command_str != NULL)
{
for (int x=0; command_str[x]; x++)
if (command_str[x]=='\r'||command_str[x]=='\n')
{
command_str[x]=0;
break;
}
if (!*command_str)
{
#if PLATFORM == PLATFORM_WINDOWS
printf("DarkCore>");
#endif
continue;
}
std::string command;
if (!consoleToUtf8(command_str, command)) // convert from console encoding to utf8
{
#if PLATFORM == PLATFORM_WINDOWS
printf("DarkCore>");
#endif
continue;
}
fflush(stdout);
sWorld->QueueCliCommand(new CliCommandHolder(NULL, command.c_str(), &utf8print, &commandFinished));
#if PLATFORM != PLATFORM_WINDOWS
add_history(command.c_str());
#endif
}
else if (feof(stdin))
{
World::StopNow(SHUTDOWN_EXIT_CODE);
}
}
}
|
gpl-3.0
|
jeromeetienne/neoip
|
src/neoip_libsess/base/clineopt/base/nunit/neoip_clineopt_nunit.hpp
|
677
|
/*! \file
\brief Header of the test of clineopt_t
*/
#ifndef __NEOIP_CLINEOPT_NUNIT_HPP__
#define __NEOIP_CLINEOPT_NUNIT_HPP__
/* system include */
/* local include */
#include "neoip_nunit_testclass_api.hpp"
#include "neoip_nunit_testclass_ftor.hpp"
#include "neoip_namespace.hpp"
NEOIP_NAMESPACE_BEGIN;
/** \brief Class which implement a nunit for the clineopt_t
*/
class clineopt_testclass_t : public nunit_testclass_api_t {
private:
public:
/*************** nunit test function *******************************/
nunit_res_t general(const nunit_testclass_ftor_t &testclass_ftor) throw();
};
NEOIP_NAMESPACE_END
#endif /* __NEOIP_CLINEOPT_NUNIT_HPP__ */
|
gpl-3.0
|
alamaison/washer
|
test/filesystem_test.cpp
|
2246
|
/**
@file
Tests for file and directory functions.
@if license
Copyright (C) 2012 Alexander Lamaison <awl03@doc.ic.ac.uk>
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/>.
If you modify this Program, or any covered work, by linking or
combining it with the OpenSSL project's OpenSSL library (or a
modified version of that library), containing parts covered by the
terms of the OpenSSL or SSLeay licenses, the licensors of this
Program grant you additional permission to convey the resulting work.
@endif
*/
#include "wchar_output.hpp" // wstring output
#include <washer/filesystem.hpp> // test subject
#include <boost/filesystem/path.hpp> // path, wpath
#include <boost/test/unit_test.hpp>
#include <string>
#include <vector>
using washer::filesystem::temporary_directory_path;
using washer::filesystem::unique_path;
using boost::filesystem::path;
using boost::filesystem::wpath;
BOOST_AUTO_TEST_SUITE(filesystem_tests)
/**
* Create unique file name.
*/
BOOST_AUTO_TEST_CASE( unique_name )
{
BOOST_CHECK(!unique_path<char>().empty());
BOOST_CHECK(!unique_path<wchar_t>().empty());
}
/**
* Temp directory path.
*/
BOOST_AUTO_TEST_CASE( temp_directory )
{
BOOST_CHECK(!temporary_directory_path<char>().empty());
BOOST_CHECK(temporary_directory_path<char>().is_complete());
BOOST_CHECK(is_directory(temporary_directory_path<char>()));
BOOST_CHECK(!temporary_directory_path<wchar_t>().empty());
BOOST_CHECK(temporary_directory_path<wchar_t>().is_complete());
BOOST_CHECK(is_directory(temporary_directory_path<wchar_t>()));
}
BOOST_AUTO_TEST_SUITE_END();
|
gpl-3.0
|
12019/svn.gov.pt
|
_src/eidmw/misc/Wix_MW35/pteidcleanup/embedded_rc.cpp
|
3833
|
/* ****************************************************************************
* eID Middleware Project.
* Copyright (C) 2008-2009 FedICT.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version
* 3.0 as published by the Free Software Foundation.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, see
* http://www.gnu.org/licenses/.
**************************************************************************** */
#include <windows.h>
#include <iostream>
#include "embedded_rc.h"
#include "error.h"
#include "log.h"
#include "file.h"
////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////// PRIVATE FUNCTIONS ////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////// PUBLIC FUNCTIONS /////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////
int CleanResource(wchar_t *zTempName)
{
if(DeleteFile(zTempName))
return RETURN_OK;
LOG(L" --> ERROR - CleanResource failed in DeleteFile (LastError=%d)\n", GetLastError());
return RETURN_ERR_INTERNAL;
}
////////////////////////////////////////////////////////////////////////////////////////////////
int ExtractResource(int resource,wchar_t *wzTempFile)
{
FILE *f=NULL;
wzTempFile[0]=0;
int iReturnCode = RETURN_OK;
// Create a temporary file.
if(RETURN_OK != (iReturnCode=GetTempFileName(wzTempFile, MAX_PATH)))
{
iReturnCode = RETURN_ERR_INTERNAL;
goto cleaning;
}
//Extract the resource in the temp file
HRSRC hResource;
if (NULL == (hResource= FindResource(NULL, MAKEINTRESOURCE(resource), TEXT("ISS"))))
{
LOG(L" --> ERROR - ExtractResource failed in FindResource (LastError=%d)\n", GetLastError());
iReturnCode = RETURN_ERR_INTERNAL;
goto cleaning;
}
//Load the resource
HGLOBAL hResourceLoaded;
if (NULL == (hResourceLoaded = LoadResource(NULL, hResource)))
{
LOG(L" --> ERROR - ExtractResource failed in LoadResource (LastError=%d)\n", GetLastError());
iReturnCode = RETURN_ERR_INTERNAL;
goto cleaning;
}
//Get the resource size
DWORD dwFileSize = SizeofResource(NULL, hResource);
//Access the byte data
LPBYTE lpBuffer;
if (NULL == (lpBuffer = (LPBYTE) LockResource(hResourceLoaded)))
{
LOG(L" --> ERROR - ExtractResource failed in LockResource (LastError=%d)\n", GetLastError());
iReturnCode = RETURN_ERR_INTERNAL;
goto cleaning;
}
//Write to the file
errno_t err=_wfopen_s(&f,wzTempFile,L"wb");
if(f==NULL || err!=0)
{
LOG(L" --> ERROR - ExtractResource failed while opening temp file for write (err=%d)\n", err);
iReturnCode = RETURN_ERR_INTERNAL;
goto cleaning;
}
if(dwFileSize != fwrite(lpBuffer,1,dwFileSize,f))
{
LOG(L" --> ERROR - ExtractResource failed while writing into temp file\n");
iReturnCode = RETURN_ERR_INTERNAL;
goto cleaning;
}
fclose(f);
f=NULL;
return iReturnCode;
cleaning:
if(f) fclose(f);
if(wzTempFile[0]!=0) CleanResource(wzTempFile);
return iReturnCode;
}
|
gpl-3.0
|
hashashin/ksp_notes
|
notesRPM/Properties/AssemblyInfo.cs
|
1576
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// La información general sobre un ensamblado se controla mediante el siguiente
// conjunto de atributos. Cambie estos atributos para modificar la información
// asociada con un ensamblado.
[assembly: AssemblyTitle("notesRPM")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("notesRPM")]
[assembly: AssemblyCopyright("Copyright © 2015 hashashin")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Si establece ComVisible como false, los tipos de este ensamblado no estarán visibles
// para los componentes COM. Si necesita obtener acceso a un tipo de este ensamblado desde
// COM, establezca el atributo ComVisible como true en este tipo.
[assembly: ComVisible(false)]
// El siguiente GUID sirve como identificador de typelib si este proyecto se expone a COM
[assembly: Guid("9eed1e7a-ae2d-48a1-847c-2555bdeb4487")]
// La información de versión de un ensamblado consta de los cuatro valores siguientes:
//
// Versión principal
// Versión secundaria
// Número de compilación
// Revisión
//
// Puede especificar todos los valores o establecer como predeterminados los números de compilación y de revisión
// mediante el carácter '*', como se muestra a continuación:
// [assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyVersion("0.2")]
[assembly: AssemblyFileVersion("0.16")]
[assembly: AssemblyVersion("0.16")]
|
gpl-3.0
|
emogames-gbr/syndicates
|
src/public/php/syndadmin/emo_preise_verteilen.php
|
8659
|
<?php
require("../../../includes.php");
connectdb();
set_time_limit(3600);
$time = time();
$identifier = "pawldwl2";
$globals = assoc("select * from globals order by round desc limit 1");
$round = $globals[round]-1;
echo "round: $round<br>";
if (!single("select count(*) from announcements where headline like 'Gewinner von Runde ".($round-2)."'")) {
// TOP 10 der letzten Runde rausholen
$stats_top_10 = assocs("select * from stats where round = $round and alive > 0 order by lastnetworth desc limit 10", "user_id");
// User_Ids in $ids speichern
$ids = array();
foreach ($stats_top_10 as $ky => $vl) {
$ids[] = $ky;
}
// TOP 5 Syndikate
// geht nicht mehr wenn nur die 10 besten spieler zaehlen // $syndikate_top_10 = assocs("select rid, sum(lastnetworth) as lastnw from stats where round = $round and alive > 0 group by rid order by lastnw desc limit 10", "rid");
// new 13. April 2010
$players_raw = assocs("select rid, lastnetworth as lastnw from stats where round = $round and alive > 0 order by lastnw desc");
$NUM_PLAYERS_THAT_COUNT = 10;
$syndikate_count = array();
foreach ($players_raw as $player) {
if ($syndikate_count[$player['rid']]++ < $NUM_PLAYERS_THAT_COUNT) {
//echo $syndikate_count[$player['rid']]."<br>";
$syndikate_nw[$player['rid']] += $player['lastnw'];
}
}
arsort($syndikate_nw);
$i = 0;
$syndikate_top_10 = array();
foreach ($syndikate_nw as $syn_id => $nw) {
if ($i < 10) {
$syndikate_top_10[$syn_id] = array('rid' => $syn_id, 'lastnw' => $nw);
}
$i++;
}
//pvar($syndikate_top_10);
// new 13. April 2010 ENDE
$rids = array();
foreach ($syndikate_top_10 as $ky => $vl) {
$rids[] = $ky;
}
$syndikatsdata = assocs("select * from syndikate_round_$round where synd_id in (".join(",", $rids).")", "synd_id");
$stats_player_top10syn = assocs("select * from stats where round = $round and alive > 0 and rid in (".join(",", $rids).")", "user_id");
foreach ($stats_player_top10syn as $ky => $vl) {
$ids[] = $ky;
$stats_player_top10syn_nach_syn[$vl['rid']][$ky] = $vl;
}
/*
// Gucken welche Noobsyns auf den ersten drei Pl?tzen gelandet sind
$top_3_noobsyns = assocs("select rid, sum(lastnetworth) as lastnetworth from stats where round = $round and alive > 0 and isnoob = 1 group by rid order by lastnetworth desc limit 3", "rid");
// Die Mentorensyns dieser Syndikate ermitteln
$count = 0;
foreach ($top_3_noobsyns as $ky => $vl) {
$count++;
$mentoren_syns_3_noobsyns[] = single("select mentorenboard from syndikate".($round != $globals[round] ? "_round_$round":"")." where synd_id = $ky");
echo "Top Noobsyn $count: #$ky<br>";
}
$mentoren_syns_3_noobsyns = array(18, 3, 66);
// Und schlie?lich die Spieler dieser Syndikat ermitteln
$mentoren_top_3_noobsyns = assocs("select * from stats where round = $round and alive > 0 and rid in (".join(",", $mentoren_syns_3_noobsyns).") and isnoob = 0", "user_id");
//Und die User_Ids dieser Spieler dem ids-Array hinzuf?gen
foreach ($mentoren_top_3_noobsyns as $ky => $vl) {
$ids[] = $ky;
}*/
// Und nun die Userdaten holen:
$userdata = assocs("select * from users where id in (".join(",", $ids).")", "id");
// Test-Ausgabe:
$a = "Top10:<br><br>";
$i = 0;
foreach ($stats_top_10 as $ky => $vl) {
$i++;
$a .= $userdata[$ky][username]." - ".$vl[syndicate]."<br>";
$reason = "Rang $i in Runde ".($round-2)." bei Syndicates";
$amount = 500 - $i * 20;
//EMOGAMES_donate_bonus_emos($userdata[$ky][emogames_user_id],$amount,$reason,$identifier);
$image = "medaillegold";
$width = 25;
$height = 35;
if ($i == 1) $image = "pokalgold";
if ($i == 2) $image = "pokalsilber";
if ($i == 3) $image = "pokalbronze";
if ($i <= 3) { $width = 35; $height = 66; }
$top10winnerlines .= "<tr class=body><td align=center><img src=php/images/$image.gif width=$width height=$height></td><td align=middle>$i</td><td> ".$userdata[$ky][username]."</td><td align=right>".$vl[syndicate]." (#".$vl[rid].") </td></tr>";
}
// Syndikatsranking
$i = 0;
$totalemos = 0;
foreach ($syndikate_top_10 as $ky => $vl) {
$i++;
$a .= "Syndikat $ky - ".$syndikatsdata[$ky]['name']."<BR>";
$reason = "Syndikatsrang $i in Runde ".($round-2)." bei Syndicates";
$amounts = array(0, 240, 120, 70, 50, 40, 30, 20, 15, 10, 5);
$amount = $amounts[$i];
$image = "medaillebronze";
$width = 25;
$height = 35;
if ($i == 1) $image = "pokalgold";
if ($i == 2) $image = "pokalsilber";
if ($i == 3) $image = "pokalbronze";
if ($i == 4) $image = "medaillegold";
if ($i == 5) $image = "medaillesilber";
if ($i == 6) $image = "medaillesilber";
if ($i <= 3) { $width = 35; $height = 66; }
$spielernamen = array();
foreach ($stats_player_top10syn_nach_syn[$ky] as $uid => $trash) {
$spielernamen[] = "<i>".$userdata[$uid]['username']."</i>";
$totalemos += $amount;
EMOGAMES_donate_bonus_emos($userdata[$uid][emogames_user_id],$amount,$reason,$identifier);
}
$top10synwinnerlines .= "<tr class=body><td align=center><img src=php/images/$image.gif width=$width height=$height></td><td align=middle>$i</td><td> ".$syndikatsdata[$ky]['name']." (#$ky)</td><td align=center>$amount</td><td align=right>".join (", ", $spielernamen)."</td></tr>";
}
/*
$a .= "<br><br><br>Top 3 Noobsyns:<br><br>";
$ompf = 0;
foreach ($mentoren_top_3_noobsyns as $ky => $vl) {
$ompf++;
$a .= ($ompf)." - ".$userdata[$ky][username]." - ".$vl[syndicate]."<br>";
$amount = 100;
$reason = "Tutor eines Top-3-Anf?ngersyndikats in Runde ".($round-2);
//EMOGAMES_donate_bonus_emos($userdata[$ky][emogames_user_id],$amount,$reason,$identifier);
$tutoren[] = "<b>".$userdata[$ky][username]."<b>";
}
echo "<br><br>";
*/
echo $a;
/*
$content = "Letzte Runde konnten sich folgende Spieler einen Platz in den Top 10 zu Rundenende hin sichern. Als kleine Anerkennung für diese doch beachtliche Leistung gibt es ein paar Bonus-EMOs :)
";*/
$content = "<b>Letzte Runde konnten sich folgende Syndikate einen Platz in den Top 10 sichern und insgesamt ".pointit($totalemos)." EMOs gewinnen:</b>
<table class=rand align=center cellspacing=0 cellpadding=0 width=730><tr><td><table align=center cellpadding=2 cellspacing=1><tr class=subhead><td width=60><b>Runde ".($round-2)."</b></td><td align=middle width=60>Rang</td><td align=middle width=200>Syndikat</td><td align=middle width=70>Bonus-EMOs</td><td align=center width=340>Spieler</td></tr>$top10synwinnerlines</table></td></tr></table>
<br>
<center>Herzlichen Glückwunsch :)</center>
<br><br>Auch wenn es für sie keine EMO-Preise mehr gibt, wollen wir an dieser Stelle trotzdem diejenigen 10 Spieler nennen, die letzte Runde in der Einzelrangliste am besten abschnitten:<br><br>
<table class=rand align=center cellspacing=0 cellpadding=0><tr><td><table align=center cellpadding=2 cellspacing=1><tr class=subhead><td width=60><b>Runde ".($round-2)."</b></td><td align=middle width=80>Rang</td><td align=middle width=100>Spieler</td><td align=center width=220>Konzern (#Syndikatsnummer)</td></tr>$top10winnerlines</table></td></tr></table>";
echo "<br><br>CONTENT:<br>$content<br>";
// <br><br>Wir m?chten uns au?erdem recht herzlich bei den Tutoren bedanken, die den neuen Spielern letzte Runde kr?ftig unter die Arme gegriffen haben.<br>Folgende Spieler haben sich dabei besonders hervorgetan, indem sie ihren Sch?tzlingen auf einen der ersten drei Pl?tze im Anf?nger-Syndikatsranking verholfen haben und erhalten als kleines Dankesch?n und Preis jeweils 100 Bonus-EMOs:<br><br>".join(", ", $tutoren);
$headline = "Gewinner von Runde ".($round-2);
select("insert into announcements (time, headline, content, poster, type) values ($time, '$headline', '$content', 'Bogul', 'outgame')");
} else { echo "Preise wurden bereits ausgesch?ttet und das Posting wurde schon erstellt"; }
?>
|
gpl-3.0
|
runsoftdev/bVnc
|
bVNC/src/com/iiordanov/tigervnc/rfb/Decoder.java
|
2566
|
/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
*
* This 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 software 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 software; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
package com.iiordanov.tigervnc.rfb;
import com.iiordanov.runsoft.bVNC.RemoteCanvas;
abstract public class Decoder {
abstract public void readRect(Rect r, CMsgHandler handler);
static public boolean supported(int encoding)
{
/*
return encoding <= Encodings.encodingMax && createFns[encoding];
*/
return (encoding == Encodings.encodingRaw ||
encoding == Encodings.encodingRRE ||
encoding == Encodings.encodingHextile ||
encoding == Encodings.encodingTight ||
encoding == Encodings.encodingZRLE);
}
static public Decoder createDecoder(int encoding, CMsgReader reader) {
/*
if (encoding <= Encodings.encodingMax && createFns[encoding])
return (createFns[encoding])(reader);
return 0;
*/
switch(encoding) {
case Encodings.encodingRaw: return new RawDecoder(reader);
case Encodings.encodingRRE: return new RREDecoder(reader);
case Encodings.encodingHextile: return new HextileDecoder(reader);
case Encodings.encodingTight: return new TightDecoder(reader);
case Encodings.encodingZRLE: return new ZRLEDecoder(reader);
}
return null;
}
static public Decoder createDecoder(int encoding, CMsgReader reader, RemoteCanvas c) {
/*
if (encoding <= Encodings.encodingMax && createFns[encoding])
return (createFns[encoding])(reader);
return 0;
*/
switch(encoding) {
case Encodings.encodingRaw: return new RawDecoder(reader);
case Encodings.encodingRRE: return new RREDecoder(reader);
case Encodings.encodingHextile: return new HextileDecoder(reader);
case Encodings.encodingTight: return new TightDecoder(reader, c);
case Encodings.encodingZRLE: return new ZRLEDecoder(reader);
}
return null;
}
}
|
gpl-3.0
|
petr-stety-stetka/SlovanEngine
|
external/glm/mat3x2.hpp
|
3105
|
///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net)
/// 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.
///
/// Restrictions:
/// By making use of the Software for military purposes, you choose to make
/// a Bunny unhappy.
///
/// 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.
///
/// @ref core
/// @file glm/mat3x2.hpp
/// @date 2013-12-24 / 2013-12-24
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "detail/type_mat3x2.hpp"
namespace glm {
/// 3 columns of 2 components matrix of low precision floating-point numbers.
/// There is no guarantee on the actual precision.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef tmat3x2<float, lowp> lowp_mat3x2;
/// 3 columns of 2 components matrix of medium precision floating-point numbers.
/// There is no guarantee on the actual precision.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef tmat3x2<float, mediump> mediump_mat3x2;
/// 3 columns of 2 components matrix of high precision floating-point numbers.
/// There is no guarantee on the actual precision.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef tmat3x2<float, highp> highp_mat3x2;
}//namespace
|
gpl-3.0
|
JoseLoarca/jc-chat
|
JCChat/app/src/main/java/org/jcloarca/jcchat/lib/GlideImageLoader.java
|
553
|
package org.jcloarca.jcchat.lib;
import android.content.Context;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestManager;
/**
* Created by JCLoarca on 6/10/2016.
*/
public class GlideImageLoader implements ImageLoader {
private RequestManager requestManager;
public GlideImageLoader(Context context) {
this.requestManager = Glide.with(context);
}
@Override
public void load(ImageView imgAvatar, String url) {
requestManager.load(url).into(imgAvatar);
}
}
|
gpl-3.0
|
xrootd/xrootd-test-framework
|
src/XrdTest/ClusterUtils.py
|
19547
|
#!/usr/bin/env python
#-------------------------------------------------------------------------------
#
# Copyright (c) 2011-2012 by European Organization for Nuclear Research (CERN)
# Author: Lukasz Trzaska <ltrzaska@cern.ch>
#
# This file is part of XrdTest.
#
# XrdTest 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.
#
# XrdTest 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 XrdTest. If not, see <http://www.gnu.org/licenses/>.
#
#-------------------------------------------------------------------------------
#
# File: ClusterManager module
# Desc: Virtual machines clusters manager.
#-------------------------------------------------------------------------------
from Utils import Logger
LOGGER = Logger(__name__).setup()
try:
import Utils
import logging
import os
import sys
import socket
import random
import hashlib
from uuid import uuid1
from Utils import State
from string import join
except ImportError, e:
LOGGER.error(str(e))
sys.exit(1)
# Global error types
ERR_UNKNOWN = 1
ERR_CONNECTION = 2
ERR_ADD_HOST = 4
ERR_CREATE_NETWORK = 8
class ClusterManagerException(Exception):
'''
General Exception raised by module
'''
def __init__(self, desc, typeFlag=ERR_UNKNOWN):
'''
Constructs Exception
@param desc: description of an error
@param typeFlag: represents type of an error, taken from class constants
'''
self.desc = desc
self.type = typeFlag
def __str__(self):
'''
Returns textual representation of an error
'''
return repr(self.desc)
def getFileContent(filePath):
'''
Read and return whole file content as a string
@param filePath:
'''
fd = open(filePath, "r")
lines = fd.readlines()
fd.close()
xmlDesc = join(lines)
if len(xmlDesc) <= 0:
logging.info("File %s is empty." % file)
return xmlDesc
class Network(object):
'''
Represents a virtual network
'''
# XML pattern representing XML configuration of libvirt network
xmlDescPattern = """
<network>
<name>%(name)s</name>
<dns>
<txt name="xrd.test" value="Welcome to xrd testing framework domain." />
<host ip="%(xrdTestMasterIP)s">
<hostname>master.xrd.test</hostname>
</host>
%(dnshostsxml)s
</dns>
<forward mode="nat"/>
<bridge name="%(bridgename)s" />
<ip address="%(ip)s" netmask="%(netmask)s">
<dhcp>
<range start="%(rangestart)s" end="%(rangeend)s" />
%(hostsxml)s
</dhcp>
</ip>
</network>
"""
xmlHostPattern = """
<host mac="%(mac)s" name="%(name)s" ip="%(ip)s" />
"""
xmlDnsHostPattern = """
<host ip="%(ip)s">
<hostname>%(hostname)s</hostname>
%(aliases)s
</host>
"""
def __init__(self, name, clusterName):
self.name = name
m = hashlib.md5()
m.update(name)
self.bridgeName = "virbr_" + m.hexdigest()[:8]
self.ip = ""
self.netmask = ""
self.DHCPRange = ("", "") #(begin_address, end_address)
self.DHCPHosts = []
self.DnsHosts = []
self.lbHosts = []
self.clusterName = clusterName
self.xrdTestMasterIP = socket.gethostbyname(socket.gethostname())
def addDnsHost(self, host):
hostup = (host.ip, host.name, host.aliases)
self.DnsHosts.append(hostup)
def addDHCPHost(self, host):
hostup = (host.mac, host.ip, host.name)
self.DHCPHosts.append(hostup)
def addHost(self, host):
'''
Add host to network. First to DHCP and then to DNS.
@param host: tuple (MAC address, IP address, HOST fqdn)
'''
self.addDHCPHost(host)
self.addDnsHost(host)
def addHosts(self, hostsList):
'''
Add hosts to network.
@param param: hostsList
'''
for h in hostsList:
self.addHost(h)
@property
def uname(self):
'''
Return unique name of the machine within cluster's namespace.
'''
if not self.clusterName:
raise ClusterManagerException(("Can't refer to host.uname if " + \
" clusterName property not " + \
"defined for host %s") % self.name)
return self.clusterName + "_" + self.name
@property
def xmlDesc(self):
hostsXML = ""
dnsHostsXML = ""
aliasXML = "<hostname>%s</hostname>\n"
values = dict()
for h in self.DHCPHosts:
values = {"mac": h[0], "ip": h[1], "name": h[2]}
hostsXML = hostsXML + Network.xmlHostPattern % values
for dns in self.DnsHosts:
aliasTag = ""
for alias in dns[2]:
aliasTag += aliasXML % alias
values = {"ip": dns[0], "hostname": dns[1], "aliases": aliasTag}
dnsHostsXML = dnsHostsXML + Network.xmlDnsHostPattern % values
values = {"name": self.uname,
"ip": self.ip, "netmask": self.netmask,
"bridgename": self.bridgeName,
"rangestart": self.DHCPRange[0],
"rangeend": self.DHCPRange[1],
"hostsxml": hostsXML,
"dnshostsxml" : dnsHostsXML,
"xrdTestMasterIP": self.xrdTestMasterIP
}
self.__xmlDesc = Network.xmlDescPattern % values
LOGGER.debug(self.__xmlDesc)
return self.__xmlDesc
class Host(object):
'''
Represents a virtual host which may be added to network
'''
# XML pattern representing XML configuration of libvirt domain
xmlDomainPattern = """
<domain type='kvm'>
<name>%(uname)s</name>
<uuid>%(uuid)s</uuid>
<memory>%(ramSize)s</memory>
<vcpu>1</vcpu>
<os>
<type arch='%(arch)s' machine='pc'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>%(emulatorPath)s</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='%(runningDiskImage)s'/>
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
<disk type='block' device='cdrom'>
<driver name='qemu' type='raw'/>
<target dev='hdc' bus='ide'/>
<readonly/>
<address type='drive' controller='0' bus='1' unit='0'/>
</disk>
<controller type='ide' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01'
function='0x1'/>
</controller>
<interface type='network'>
<mac address='%(mac)s'/>
<source network='%(net)s'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
<model type='virtio'/>
</interface>
<input type='mouse' bus='ps2'/>
<!-- VIDEO SECTION - NORMALLY NOT NEEDED -->
<graphics type='vnc' port='5900' autoport='yes' keymap='en-us'/>
<video>
<model type='cirrus' vram='9216' heads='1' />
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0' />
</video>
<!-- END OF VIDEO SECTION -->
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04'
function='0x0'/>
</memballoon>
</devices>
</domain>
"""
def __init__(self, name="", ip="", net="", ramSize="", arch="", \
bootImage=None, cacheBootImage=True, emulatorPath="", uuid="",
aliases=[], mac=""):
self.uuid = uuid
self.name = name
self.ip = ip
if len(mac):
self.mac = mac
else:
self.mac = self.randMac()
self.ramSize = ramSize
self.arch = arch
self.bootImage = bootImage
self.cacheBootImage = cacheBootImage
self.net = net
self.emulatorPath = emulatorPath
self.aliases = aliases
#filled automatically
self.clusterName = ""
self.disks = {}
self.runningDiskImage = ""
# private properties
self.__xmlDesc = ""
@property
def uname(self):
'''
Return unique name of the machine within cluster's namespace.
'''
if not self.clusterName:
raise ClusterManagerException(("Can't refer to host.uname if " + \
" clusterName property not " + \
"defined for host %s") % self.name)
return self.clusterName + "_" + self.name
@property
def xmlDesc(self):
values = self.__dict__
values['uname'] = self.uname
values['net'] = self.clusterName + "_" + self.net
self.__xmlDesc = self.xmlDomainPattern % values
return self.__xmlDesc
def randMac(self):
return ':'.join(map(lambda x: "%02x" % x, \
[ 0x00, random.randint(0x00, 0xFF), \
random.randint(0x00, 0xFF), \
random.randint(0x00, 0xFF), \
random.randint(0x00, 0xFF), \
random.randint(0x00, 0xFF) ]))
class Disk(object):
def __init__(self, name, size, device='vda', mountPoint='/data', cache=True):
self.name = name
self.size = self.parseDiskSize(size)
self.readableSize = size
self.device = device
self.mountPoint = mountPoint
self.cache = cache
def parseDiskSize(self, size):
'''
Takes a size in readable format, e.g. 50G or 200M and returns the size in bytes.
If a purely numeric string is given, a byte value will be assumed.
'''
suffixes = ('B', 'K', 'M', 'G', 'T', 'P')
if size[-1] in suffixes and size[:-1].isdigit():
return int(size[:-1]) * (1024 ** suffixes.index(size[-1]))
elif size.isdigit():
return size
else:
raise ClusterManagerException('Invalid disk size definition for disk %s' % self.name)
class Cluster(Utils.Stateful):
S_ERROR = (-4, "Cluster error")
S_ERROR_START = (-3, "Error at start:")
S_ERROR_STOP = (-2, "Error at stop:")
S_UNKNOWN_NOHYPERV = (-1, "Cluster state unknown: no hypervisor to run cluster.")
S_UNKNOWN = (0, "Cluster state unknown.")
S_DEFINED = (0, "Cluster defined correctly.")
S_DEFINITION_SENT = (1, "Cluster start command sent to hypervisor.")
S_STARTING_CLUSTER = (2, 'Starting cluster.')
S_CREATING_NETWORK = (3, 'Creating network.')
S_CREATING_SLAVES = (4, 'Creating slaves.')
S_COPYING_IMAGES = (5, 'Copying slave images.')
S_ATTACHING_DISKS = (6, 'Attaching slave disks.')
S_WAITING_SLAVES = (7, 'Waiting for slaves to connect.')
S_ACTIVE = (8, "Cluster active.")
S_STOPCOMMAND_SENT = (9, "Cluster stop command sent to hypervisor.")
S_DESTROYING_CLUSTER = (10, 'Destroying cluster')
S_STOPPED = (11, "Cluster stopped.")
'''
Represents a cluster comprised of hosts connected through network.
'''
def __init__(self, name):
Utils.Stateful.__init__(self)
self.hosts = []
self.name = name
self.info = None
self.defaultHost = Host()
self.defaultHost.net = self.name + '_net'
self.__network = Network( self.defaultHost.net, name )
def addHost(self, host):
if not self.network:
raise ClusterManagerException(('First assign network ' + \
'before you add hosts to cluster' + \
' %s definition.') % (self.name))
if not hasattr(host, "uuid") or not host.uuid:
host.uuid = str(uuid1())
if not hasattr(host, "arch") or not host.arch:
host.arch = self.defaultHost.arch
if not hasattr(host, "ramSize") or not host.ramSize:
host.ramSize = self.defaultHost.ramSize
if not hasattr(host, "net") or not host.net:
host.net = self.defaultHost.net
if not (hasattr(host, "bootImage") or host.bootImage) \
or not (hasattr(host, "bootImage") or self.defaultHost.bootImage):
raise ClusterManagerException(('Machine %s definition nor ' + \
'cluster %s has disk image ' + \
'defined') % (host.name, self.name))
host.clusterName = self.name
self.network.addHost(host)
self.hosts.append(host)
def addHosts(self, hosts):
for h in hosts:
self.addHost(h)
def networkSet(self, net):
net.clusterName = self.name
self.defaultHost.net = net.name
self.__network = net
def networkGet(self):
return self.__network
network = property(networkGet, networkSet)
def setEmulatorPath(self, emulator_path):
if len(self.hosts):
for h in self.hosts:
h.emulatorPath = emulator_path
def validateStatic(self):
'''
Check if Cluster definition is correct and sufficient
to create a cluster.
'''
#check if network definition provided: whether by arguments or xmlDesc
#@todo: validate if names, uuids and mac definitions of hosts
# are different
if not self.name:
raise ClusterManagerException('Cluster definition incomplete: ' + \
' no name of cluster given')
if not self.network or not (self.network.name and self.network.xmlDesc):
raise ClusterManagerException('Cluster definition incomplete: ' + \
' no or wrong network definition')
umacs = []
uips = []
for h in self.hosts:
if h.mac in umacs:
raise ClusterManagerException(('Host MAC %s address ' + \
'doubled') % h.mac)
umacs.append(h.mac)
if h.net != self.network.name:
raise ClusterManagerException(('Network name %s in host %s' + \
' definition not defined in' + \
' cluster %s.') % \
(h.net, h.name, self.name))
if self.network.ip == self.network.DHCPRange[0]:
raise ClusterManagerException(('Network %s [%s] IP is the ' + \
'same as DHCPRange ' + \
' first address') \
% (self.network.name, \
self.definitionFile))
def validateAgainstSystem(self, clusters):
'''
Check if cluster definition is correct with other
clusters defined in the system. This correctness is critical for
cluster definition to be added.
@param clusters:
'''
n = [c.name for c in clusters \
if self.name == c.name or \
self.network.name == c.network.name or \
self.network.bridgeName == c.network.bridgeName or \
self.network.ip == c.network.ip]
if len(n) != 0:
raise ClusterManagerException(
("Some network parameters doubled" + \
" in %s") % (self.name))
def validateDynamic(self):
'''
Check if Cluster definition is semantically correct i.e. on the
hypervisor's machine e.g. if disk images really exists on
the machine it's to be planted.
'''
if self.hosts:
for h in self.hosts:
if h.bootImage and not os.path.exists(h.bootImage):
return (False, ("Custom boot image given at %s, " + \
"but does not exist") % (h.bootImage))
if self.defaultHost.bootImage and \
not os.path.exists(self.defaultHost.bootImage):
return (False, ("Default boot image %s " + \
"does not exist") % \
(self.defaultHost.bootImage))
return (True, "")
def extractClusterName(path):
(modPath, modFile) = os.path.split(path)
modPath = os.path.abspath(modPath)
(modName, ext) = os.path.splitext(modFile)
return (modName, ext, modPath, modFile)
def loadClusterDef(fp, clusters = [], validateWithRest=True):
(modName, ext, modPath, modFile) = extractClusterName(fp)
cl = None
if os.path.isfile(fp) and ext == '.py':
mod = None
try:
if not modPath in sys.path:
sys.path.insert(0, modPath)
if sys.modules.has_key(modName):
del sys.modules[modName]
mod = __import__(modName, globals(), {}, ['getCluster'])
cl = mod.getCluster()
if cl.name != modName:
raise ClusterManagerException(("Cluster name %s in file %s" + \
" does not match filename.") % \
(cl.name, modFile))
cl.definitionFile = modFile
#after load, check if cluster definition is correct
cl.state = State(Cluster.S_UNKNOWN)
cl.validateStatic()
if validateWithRest:
cl.validateAgainstSystem(clusters)
except ImportError, e:
raise ClusterManagerException("Can't import %s: %s." % \
(modName, e))
except NameError, e:
raise ClusterManagerException("Name error during " + \
"cluster %s import: %s." % \
(modName, e))
elif ext == ".pyc":
return None
else:
raise ClusterManagerException("%s is not a cluster definition." % \
(modFile))
return cl
def loadClustersDefs(path):
'''
Loads cluster definitions from .py files stored in path directory
@param path: path for .py files, storing cluster definitions
'''
clusters = []
if os.path.exists(path):
for f in os.listdir(path):
if not f.startswith('cluster') or not f.endswith('.py'):
continue
cp = path + os.sep + f
try:
clu = loadClusterDef(cp, clusters)
if clu:
clu.state = State(Cluster.S_DEFINED)
clusters.append(clu)
except ClusterManagerException, e:
LOGGER.error("Error in cluster definition %s: %s" % (f, str(e)))
clu = Cluster(f+"_BROKEN")
clu.state = State((-1, e.desc))
clusters.append(clu)
return clusters
|
gpl-3.0
|
simontb/Fussball-Regelfragen-Android
|
app/src/main/java/de/simontenbeitel/regelfragen/domain/interactor/base/Interactor.java
|
379
|
package de.simontenbeitel.regelfragen.domain.interactor.base;
/**
* This is the main interface of an interactor. Each interactor serves a specific use case.
*/
public interface Interactor {
/**
* This is the main method that starts an interactor. It will make sure that the interactor operation is done on a
* background thread.
*/
void execute();
}
|
gpl-3.0
|
BerntA/SourceProjectCleaner
|
ProjectCleaner/Properties/AssemblyInfo.cs
|
1459
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ProjectCleaner")]
[assembly: AssemblyDescription("Source Project Cleaner")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Reperio Studios")]
[assembly: AssemblyProduct("ProjectCleaner")]
[assembly: AssemblyCopyright("Copyright © Reperio Studios 2018")]
[assembly: AssemblyTrademark("BAE")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("87aae478-43ff-4282-a7e9-13faf9b66821")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
gpl-3.0
|
KineticIsEpic/CadenciiStudio
|
src/cadencii.apputil/BVScrollBar.cs
|
2087
|
#if !JAVA
/*
* BVScrollBar.cs
* Copyright © 2009-2011 kbinani
*
* This file is part of cadencii.apputil.
*
* cadencii.apputil is free software; you can redistribute it and/or
* modify it under the terms of the BSD License.
*
* cadencii.apputil 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.
*/
using System;
using System.Windows.Forms;
namespace cadencii.apputil {
/// <summary>
/// Valueの値が正しくMinimumからMaximumの間を動くスクロールバー
/// </summary>
public partial class OBSOLUTE_BVScrollBar : UserControl {
int m_max = 100;
int m_min = 0;
public event EventHandler ValueChanged;
public OBSOLUTE_BVScrollBar() {
InitializeComponent();
}
public int Value {
get {
return vScroll.Value;
}
set {
vScroll.Value = value;
}
}
public int LargeChange {
get {
return vScroll.LargeChange;
}
set {
vScroll.LargeChange = value;
vScroll.Maximum = m_max + value;
}
}
public int SmallChange {
get {
return vScroll.SmallChange;
}
set {
vScroll.SmallChange = value;
}
}
public int Maximum {
get {
return m_max;
}
set {
m_max = value;
vScroll.Maximum = m_max + vScroll.LargeChange;
}
}
public int Minimum {
get {
return m_min;
}
set {
m_min = value;
}
}
private void vScroll_ValueChanged( object sender, EventArgs e ) {
if ( ValueChanged != null ) {
ValueChanged( this, e );
}
}
}
}
#endif
|
gpl-3.0
|
deyvedvm/cederj
|
fund-prog/2017-2/ap1/questao2.py
|
1408
|
# coding=utf-8
"""
A função fatorial duplo é definida como o produto de todos os números naturais ímpares de 1 até algum número natural
ímpar N. Por exemplo, se N é igual a 5 então o fatorial duplo de N é calculado como:
5!! = 1 × 3 × 5 = 15
Implemente um programa que recebe uma sequência de números naturais via entrada padrão e, para cada número ímpar N
informado, calcule seu fatorial duplo R e imprima a mensagem “O fatorial duplo de N é R”, onde N deve ser substituído
pelo número lido e R deve ser substituído pelo fatorial duplo calculado, conforme mostram os exemplos abaixo. Caso o
número natural N informado seja par, seu programa deverá imprimir a mensagem “O número N é par”, conforme mostram os
exemplos abaixo.
Um número N é dito natural se ele é inteiro positivo, incluindo o zero.
Restrição: Serão aceitos na correção apenas programas que calculam o fatorial duplo de N por meio de uma função
recursiva que atenda ao seguinte protótipo (sem variações):
def fatorial_duplo(n):
# Implemente essa função
"""
def fatorial_duplo(n):
if n == 1:
return 1
else:
return fatorial_duplo(n - 2) * n
while True:
N = int(input())
if N == -1:
break
if N % 2 == 0:
print("O número {} é par".format(N))
continue
print("O fatorial duplo de {} é {}".format(N, fatorial_duplo(N)))
|
gpl-3.0
|
icgc-dcc/dcc-portal
|
dcc-portal-pql/src/main/java/org/dcc/portal/pql/es/utils/ParseTrees.java
|
2372
|
/*
* Copyright (c) 2015 The Ontario Institute for Cancer Research. All rights reserved.
*
* This program and the accompanying materials are made available under the terms of the GNU Public License v3.0.
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* THIS 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 HOLDER 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.
*/
package org.dcc.portal.pql.es.utils;
import static lombok.AccessLevel.PRIVATE;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.val;
import org.antlr.v4.runtime.ANTLRInputStream;
import org.antlr.v4.runtime.CommonTokenStream;
import org.icgc.dcc.portal.pql.antlr4.PqlLexer;
import org.icgc.dcc.portal.pql.antlr4.PqlParser;
@NoArgsConstructor(access = PRIVATE)
public final class ParseTrees {
public static PqlParser getParser(@NonNull String query) {
val inputStream = new ANTLRInputStream(query);
val lexer = new PqlLexer(inputStream);
val tokenStream = new CommonTokenStream((lexer));
return new PqlParser(tokenStream);
}
}
|
gpl-3.0
|
kosgroup/odoo
|
addons/stock/tests/test_stock_flow.py
|
89284
|
# -*- coding: utf-8 -*-
from odoo.addons.stock.tests.common import TestStockCommon
from odoo.tools import mute_logger, float_round
class TestStockFlow(TestStockCommon):
@mute_logger('odoo.addons.base.ir.ir_model', 'odoo.models')
def test_00_picking_create_and_transfer_quantity(self):
""" Basic stock operation on incoming and outgoing shipment. """
LotObj = self.env['stock.production.lot']
# ----------------------------------------------------------------------
# Create incoming shipment of product A, B, C, D
# ----------------------------------------------------------------------
# Product A ( 1 Unit ) , Product C ( 10 Unit )
# Product B ( 1 Unit ) , Product D ( 10 Unit )
# Product D ( 5 Unit )
# ----------------------------------------------------------------------
picking_in = self.PickingObj.create({
'partner_id': self.partner_delta_id,
'picking_type_id': self.picking_type_in,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location})
self.MoveObj.create({
'name': self.productA.name,
'product_id': self.productA.id,
'product_uom_qty': 1,
'product_uom': self.productA.uom_id.id,
'picking_id': picking_in.id,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location})
self.MoveObj.create({
'name': self.productB.name,
'product_id': self.productB.id,
'product_uom_qty': 1,
'product_uom': self.productB.uom_id.id,
'picking_id': picking_in.id,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location})
self.MoveObj.create({
'name': self.productC.name,
'product_id': self.productC.id,
'product_uom_qty': 10,
'product_uom': self.productC.uom_id.id,
'picking_id': picking_in.id,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location})
self.MoveObj.create({
'name': self.productD.name,
'product_id': self.productD.id,
'product_uom_qty': 10,
'product_uom': self.productD.uom_id.id,
'picking_id': picking_in.id,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location})
self.MoveObj.create({
'name': self.productD.name,
'product_id': self.productD.id,
'product_uom_qty': 5,
'product_uom': self.productD.uom_id.id,
'picking_id': picking_in.id,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location})
# Check incoming shipment move lines state.
for move in picking_in.move_lines:
self.assertEqual(move.state, 'draft', 'Wrong state of move line.')
# Confirm incoming shipment.
picking_in.action_confirm()
# Check incoming shipment move lines state.
for move in picking_in.move_lines:
self.assertEqual(move.state, 'assigned', 'Wrong state of move line.')
# ----------------------------------------------------------------------
# Replace pack operation of incoming shipments.
# ----------------------------------------------------------------------
picking_in.do_prepare_partial()
self.StockPackObj.search([('product_id', '=', self.productA.id), ('picking_id', '=', picking_in.id)]).write({
'product_qty': 4.0})
self.StockPackObj.search([('product_id', '=', self.productB.id), ('picking_id', '=', picking_in.id)]).write({
'product_qty': 5.0})
self.StockPackObj.search([('product_id', '=', self.productC.id), ('picking_id', '=', picking_in.id)]).write({
'product_qty': 5.0})
self.StockPackObj.search([('product_id', '=', self.productD.id), ('picking_id', '=', picking_in.id)]).write({
'product_qty': 5.0})
lot2_productC = LotObj.create({'name': 'C Lot 2', 'product_id': self.productC.id})
self.StockPackObj.create({
'product_id': self.productC.id,
'product_qty': 2,
'product_uom_id': self.productC.uom_id.id,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location,
'picking_id': picking_in.id,
'pack_lot_ids': [(0, 0, {'lot_id': lot2_productC.id, 'qty': 2.0})],
})
self.StockPackObj.create({
'product_id': self.productD.id,
'product_qty': 2,
'product_uom_id': self.productD.uom_id.id,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location,
'picking_id': picking_in.id})
# Check incoming shipment total quantity of pack operation
packs = self.StockPackObj.search([('picking_id', '=', picking_in.id)])
total_qty = [pack.product_qty for pack in packs]
self.assertEqual(sum(total_qty), 23, 'Wrong quantity in pack operation (%s found instead of 23)' % (sum(total_qty)))
# Transfer Incoming Shipment.
picking_in.do_transfer()
# ----------------------------------------------------------------------
# Check state, quantity and total moves of incoming shipment.
# ----------------------------------------------------------------------
# Check total no of move lines of incoming shipment.
self.assertEqual(len(picking_in.move_lines), 6, 'Wrong number of move lines.')
# Check incoming shipment state.
self.assertEqual(picking_in.state, 'done', 'Incoming shipment state should be done.')
# Check incoming shipment move lines state.
for move in picking_in.move_lines:
self.assertEqual(move.state, 'done', 'Wrong state of move line.')
# Check product A done quantity must be 3 and 1
moves = self.MoveObj.search([('product_id', '=', self.productA.id), ('picking_id', '=', picking_in.id)])
a_done_qty = [move.product_uom_qty for move in moves]
self.assertEqual(set(a_done_qty), set([1.0, 3.0]), 'Wrong move quantity for product A.')
# Check product B done quantity must be 4 and 1
moves = self.MoveObj.search([('product_id', '=', self.productB.id), ('picking_id', '=', picking_in.id)])
b_done_qty = [move.product_uom_qty for move in moves]
self.assertEqual(set(b_done_qty), set([4.0, 1.0]), 'Wrong move quantity for product B.')
# Check product C done quantity must be 7
c_done_qty = self.MoveObj.search([('product_id', '=', self.productC.id), ('picking_id', '=', picking_in.id)], limit=1).product_uom_qty
self.assertEqual(c_done_qty, 7.0, 'Wrong move quantity of product C (%s found instead of 7)' % (c_done_qty))
# Check product D done quantity must be 7
d_done_qty = self.MoveObj.search([('product_id', '=', self.productD.id), ('picking_id', '=', picking_in.id)], limit=1).product_uom_qty
self.assertEqual(d_done_qty, 7.0, 'Wrong move quantity of product D (%s found instead of 7)' % (d_done_qty))
# ----------------------------------------------------------------------
# Check Back order of Incoming shipment.
# ----------------------------------------------------------------------
# Check back order created or not.
back_order_in = self.PickingObj.search([('backorder_id', '=', picking_in.id)])
self.assertEqual(len(back_order_in), 1, 'Back order should be created.')
# Check total move lines of back order.
self.assertEqual(len(back_order_in.move_lines), 3, 'Wrong number of move lines.')
# Check back order should be created with 3 quantity of product C.
moves = self.MoveObj.search([('product_id', '=', self.productC.id), ('picking_id', '=', back_order_in.id)])
product_c_qty = [move.product_uom_qty for move in moves]
self.assertEqual(sum(product_c_qty), 3.0, 'Wrong move quantity of product C (%s found instead of 3)' % (product_c_qty))
# Check back order should be created with 8 quantity of product D.
moves = self.MoveObj.search([('product_id', '=', self.productD.id), ('picking_id', '=', back_order_in.id)])
product_d_qty = [move.product_uom_qty for move in moves]
self.assertEqual(sum(product_d_qty), 8.0, 'Wrong move quantity of product D (%s found instead of 8)' % (product_d_qty))
# ======================================================================
# Create Outgoing shipment with ...
# product A ( 10 Unit ) , product B ( 5 Unit )
# product C ( 3 unit ) , product D ( 10 Unit )
# ======================================================================
picking_out = self.PickingObj.create({
'partner_id': self.partner_agrolite_id,
'picking_type_id': self.picking_type_out,
'location_id': self.stock_location,
'location_dest_id': self.customer_location})
self.MoveObj.create({
'name': self.productA.name,
'product_id': self.productA.id,
'product_uom_qty': 10,
'product_uom': self.productA.uom_id.id,
'picking_id': picking_out.id,
'location_id': self.stock_location,
'location_dest_id': self.customer_location})
self.MoveObj.create({
'name': self.productB.name,
'product_id': self.productB.id,
'product_uom_qty': 5,
'product_uom': self.productB.uom_id.id,
'picking_id': picking_out.id,
'location_id': self.stock_location,
'location_dest_id': self.customer_location})
self.MoveObj.create({
'name': self.productC.name,
'product_id': self.productC.id,
'product_uom_qty': 3,
'product_uom': self.productC.uom_id.id,
'picking_id': picking_out.id,
'location_id': self.stock_location,
'location_dest_id': self.customer_location})
self.MoveObj.create({
'name': self.productD.name,
'product_id': self.productD.id,
'product_uom_qty': 10,
'product_uom': self.productD.uom_id.id,
'picking_id': picking_out.id,
'location_id': self.stock_location,
'location_dest_id': self.customer_location})
# Confirm outgoing shipment.
picking_out.action_confirm()
for move in picking_out.move_lines:
self.assertEqual(move.state, 'confirmed', 'Wrong state of move line.')
# Product assign to outgoing shipments
picking_out.action_assign()
self.assertEqual(picking_out.move_lines[0].state, 'confirmed', 'Wrong state of move line.')
self.assertEqual(picking_out.move_lines[1].state, 'assigned', 'Wrong state of move line.')
self.assertEqual(picking_out.move_lines[2].state, 'assigned', 'Wrong state of move line.')
self.assertEqual(picking_out.move_lines[3].state, 'confirmed', 'Wrong state of move line.')
# Check availability for product A
aval_a_qty = self.MoveObj.search([('product_id', '=', self.productA.id), ('picking_id', '=', picking_out.id)], limit=1).reserved_availability
self.assertEqual(aval_a_qty, 4.0, 'Wrong move quantity availability of product A (%s found instead of 4)' % (aval_a_qty))
# Check availability for product B
aval_b_qty = self.MoveObj.search([('product_id', '=', self.productB.id), ('picking_id', '=', picking_out.id)], limit=1).reserved_availability
self.assertEqual(aval_b_qty, 5.0, 'Wrong move quantity availability of product B (%s found instead of 5)' % (aval_b_qty))
# Check availability for product C
aval_c_qty = self.MoveObj.search([('product_id', '=', self.productC.id), ('picking_id', '=', picking_out.id)], limit=1).reserved_availability
self.assertEqual(aval_c_qty, 3.0, 'Wrong move quantity availability of product C (%s found instead of 3)' % (aval_c_qty))
# Check availability for product D
aval_d_qty = self.MoveObj.search([('product_id', '=', self.productD.id), ('picking_id', '=', picking_out.id)], limit=1).reserved_availability
self.assertEqual(aval_d_qty, 7.0, 'Wrong move quantity availability of product D (%s found instead of 7)' % (aval_d_qty))
# ----------------------------------------------------------------------
# Replace pack operation of outgoing shipment.
# ----------------------------------------------------------------------
picking_out.do_prepare_partial()
self.StockPackObj.search([('product_id', '=', self.productA.id), ('picking_id', '=', picking_out.id)]).write({'product_qty': 2.0})
self.StockPackObj.search([('product_id', '=', self.productB.id), ('picking_id', '=', picking_out.id)]).write({'product_qty': 3.0})
self.StockPackObj.create({
'product_id': self.productB.id,
'product_qty': 2,
'product_uom_id': self.productB.uom_id.id,
'location_id': self.stock_location,
'location_dest_id': self.customer_location,
'picking_id': picking_out.id})
self.StockPackObj.search([('product_id', '=', self.productC.id), ('picking_id', '=', picking_out.id)]).write({
'product_qty': 2.0, 'pack_lot_ids': [(0, 0, {'lot_id': lot2_productC.id, 'qty': 2.0})],})
self.StockPackObj.create({
'product_id': self.productC.id,
'product_qty': 3,
'product_uom_id': self.productC.uom_id.id,
'location_id': self.stock_location,
'location_dest_id': self.customer_location,
'picking_id': picking_out.id})
self.StockPackObj.search([('product_id', '=', self.productD.id), ('picking_id', '=', picking_out.id)]).write({'product_qty': 6.0})
# Transfer picking.
picking_out.do_transfer()
# ----------------------------------------------------------------------
# Check state, quantity and total moves of outgoing shipment.
# ----------------------------------------------------------------------
# check outgoing shipment status.
self.assertEqual(picking_out.state, 'done', 'Wrong state of outgoing shipment.')
# check outgoing shipment total moves and and its state.
self.assertEqual(len(picking_out.move_lines), 5, 'Wrong number of move lines')
for move in picking_out.move_lines:
self.assertEqual(move.state, 'done', 'Wrong state of move line.')
back_order_out = self.PickingObj.search([('backorder_id', '=', picking_out.id)])
#------------------
# Check back order.
# -----------------
self.assertEqual(len(back_order_out), 1, 'Back order should be created.')
# Check total move lines of back order.
self.assertEqual(len(back_order_out.move_lines), 2, 'Wrong number of move lines')
# Check back order should be created with 8 quantity of product A.
product_a_qty = self.MoveObj.search([('product_id', '=', self.productA.id), ('picking_id', '=', back_order_out.id)], limit=1).product_uom_qty
self.assertEqual(product_a_qty, 8.0, 'Wrong move quantity of product A (%s found instead of 8)' % (product_a_qty))
# Check back order should be created with 4 quantity of product D.
product_d_qty = self.MoveObj.search([('product_id', '=', self.productD.id), ('picking_id', '=', back_order_out.id)], limit=1).product_uom_qty
self.assertEqual(product_d_qty, 4.0, 'Wrong move quantity of product D (%s found instead of 4)' % (product_d_qty))
#-----------------------------------------------------------------------
# Check stock location quant quantity and quantity available
# of product A, B, C, D
#-----------------------------------------------------------------------
# Check quants and available quantity for product A
quants = self.StockQuantObj.search([('product_id', '=', self.productA.id), ('location_id', '=', self.stock_location)])
total_qty = [quant.qty for quant in quants]
self.assertEqual(sum(total_qty), 2.0, 'Expecting 2.0 Unit , got %.4f Unit on location stock!' % (sum(total_qty)))
self.assertEqual(self.productA.qty_available, 2.0, 'Wrong quantity available (%s found instead of 2.0)' % (self.productA.qty_available))
# Check quants and available quantity for product B
quants = self.StockQuantObj.search([('product_id', '=', self.productB.id), ('location_id', '=', self.stock_location)])
self.assertFalse(quants, 'No quant should found as outgoing shipment took everything out of stock.')
self.assertEqual(self.productB.qty_available, 0.0, 'Product B should have zero quantity available.')
# Check quants and available quantity for product C
quants = self.StockQuantObj.search([('product_id', '=', self.productC.id), ('location_id', '=', self.stock_location)])
total_qty = [quant.qty for quant in quants]
self.assertEqual(sum(total_qty), 2.0, 'Expecting 2.0 Unit, got %.4f Unit on location stock!' % (sum(total_qty)))
self.assertEqual(self.productC.qty_available, 2.0, 'Wrong quantity available (%s found instead of 2.0)' % (self.productC.qty_available))
# Check quants and available quantity for product D
quant = self.StockQuantObj.search([('product_id', '=', self.productD.id), ('location_id', '=', self.stock_location)], limit=1)
self.assertEqual(quant.qty, 1.0, 'Expecting 1.0 Unit , got %.4f Unit on location stock!' % (quant.qty))
self.assertEqual(self.productD.qty_available, 1.0, 'Wrong quantity available (%s found instead of 1.0)' % (self.productD.qty_available))
#-----------------------------------------------------------------------
# Back Order of Incoming shipment
#-----------------------------------------------------------------------
lot3_productC = LotObj.create({'name': 'Lot 3', 'product_id': self.productC.id})
lot4_productC = LotObj.create({'name': 'Lot 4', 'product_id': self.productC.id})
lot5_productC = LotObj.create({'name': 'Lot 5', 'product_id': self.productC.id})
lot6_productC = LotObj.create({'name': 'Lot 6', 'product_id': self.productC.id})
lot1_productD = LotObj.create({'name': 'Lot 1', 'product_id': self.productD.id})
lot2_productD = LotObj.create({'name': 'Lot 2', 'product_id': self.productD.id})
# Confirm back order of incoming shipment.
back_order_in.action_confirm()
self.assertEqual(back_order_in.state, 'assigned', 'Wrong state of incoming shipment back order: %s instead of %s' % (back_order_in.state, 'assigned'))
for move in back_order_in.move_lines:
self.assertEqual(move.state, 'assigned', 'Wrong state of move line.')
# ----------------------------------------------------------------------
# Replace pack operation (Back order of Incoming shipment)
# ----------------------------------------------------------------------
back_order_in.do_prepare_partial()
packD = self.StockPackObj.search([('product_id', '=', self.productD.id), ('picking_id', '=', back_order_in.id)])
self.assertEqual(len(packD), 1, 'Wrong number of pack operation.')
packD.write({'product_qty': 4, 'pack_lot_ids': [(0, 0, {'lot_id': lot1_productD.id, 'qty': 4.0})],})
self.StockPackObj.create({
'product_id': self.productD.id,
'product_qty': 4,
'product_uom_id': self.productD.uom_id.id,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location,
'picking_id': back_order_in.id,
'pack_lot_ids': [(0, 0, {'lot_id': lot1_productD.id, 'qty': 4.0})],})
packCs = self.StockPackObj.search([('product_id', '=', self.productC.id), ('picking_id', '=', back_order_in.id)], limit=1)
packCs.write({'product_qty': 1,
'pack_lot_ids': [(0, 0, {'lot_id': lot3_productC.id, 'qty': 1.0})]
})
self.StockPackObj.create({
'product_id': self.productC.id,
'product_qty': 1,
'product_uom_id': self.productC.uom_id.id,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location,
'picking_id': back_order_in.id,
'pack_lot_ids': [(0, 0, {'lot_id': lot4_productC.id, 'qty': 1.0})]})
self.StockPackObj.create({
'product_id': self.productC.id,
'product_qty': 2,
'product_uom_id': self.productC.uom_id.id,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location,
'picking_id': back_order_in.id,
'pack_lot_ids': [(0, 0, {'lot_id': lot5_productC.id, 'qty': 2.0})]})
self.StockPackObj.create({
'product_id': self.productC.id,
'product_qty': 2,
'product_uom_id': self.productC.uom_id.id,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location,
'picking_id': back_order_in.id,
'pack_lot_ids': [(0, 0, {'lot_id': lot6_productC.id, 'qty': 2.0})]})
self.StockPackObj.create({
'product_id': self.productA.id,
'product_qty': 10,
'product_uom_id': self.productA.uom_id.id,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location,
'picking_id': back_order_in.id})
back_order_in.do_transfer()
# ----------------------------------------------------------------------
# Check state, quantity and total moves (Back order of Incoming shipment).
# ----------------------------------------------------------------------
# Check total no of move lines.
self.assertEqual(len(back_order_in.move_lines), 6, 'Wrong number of move lines')
# Check incoming shipment state must be 'Done'.
self.assertEqual(back_order_in.state, 'done', 'Wrong state of picking.')
# Check incoming shipment move lines state must be 'Done'.
for move in back_order_in.move_lines:
self.assertEqual(move.state, 'done', 'Wrong state of move lines.')
# Check product A done quantity must be 10
movesA = self.MoveObj.search([('product_id', '=', self.productA.id), ('picking_id', '=', back_order_in.id)])
self.assertEqual(movesA.product_uom_qty, 10, "Wrong move quantity of product A (%s found instead of 10)" % (movesA.product_uom_qty))
# Check product C done quantity must be 3.0, 1.0, 2.0
movesC = self.MoveObj.search([('product_id', '=', self.productC.id), ('picking_id', '=', back_order_in.id)])
c_done_qty = [move.product_uom_qty for move in movesC]
self.assertEqual(set(c_done_qty), set([3.0, 1.0, 2.0]), 'Wrong quantity of moves product C.')
# Check product D done quantity must be 5.0 and 3.0
movesD = self.MoveObj.search([('product_id', '=', self.productD.id), ('picking_id', '=', back_order_in.id)])
d_done_qty = [move.product_uom_qty for move in movesD]
self.assertEqual(set(d_done_qty), set([3.0, 5.0]), 'Wrong quantity of moves product D.')
# Check no back order is created.
self.assertFalse(self.PickingObj.search([('backorder_id', '=', back_order_in.id)]), "Should not create any back order.")
#-----------------------------------------------------------------------
# Check stock location quant quantity and quantity available
# of product A, B, C, D
#-----------------------------------------------------------------------
# Check quants and available quantity for product A.
quants = self.StockQuantObj.search([('product_id', '=', self.productA.id), ('location_id', '=', self.stock_location)])
total_qty = [quant.qty for quant in quants]
self.assertEqual(sum(total_qty), 12.0, 'Wrong total stock location quantity (%s found instead of 12)' % (sum(total_qty)))
self.assertEqual(self.productA.qty_available, 12.0, 'Wrong quantity available (%s found instead of 12)' % (self.productA.qty_available))
# Check quants and available quantity for product B.
quants = self.StockQuantObj.search([('product_id', '=', self.productB.id), ('location_id', '=', self.stock_location)])
self.assertFalse(quants, 'No quant should found as outgoing shipment took everything out of stock')
self.assertEqual(self.productB.qty_available, 0.0, 'Total quantity in stock should be 0 as the backorder took everything out of stock')
# Check quants and available quantity for product C.
quants = self.StockQuantObj.search([('product_id', '=', self.productC.id), ('location_id', '=', self.stock_location)])
total_qty = [quant.qty for quant in quants]
self.assertEqual(sum(total_qty), 8.0, 'Wrong total stock location quantity (%s found instead of 8)' % (sum(total_qty)))
self.assertEqual(self.productC.qty_available, 8.0, 'Wrong quantity available (%s found instead of 8)' % (self.productC.qty_available))
# Check quants and available quantity for product D.
quants = self.StockQuantObj.search([('product_id', '=', self.productD.id), ('location_id', '=', self.stock_location)])
total_qty = [quant.qty for quant in quants]
self.assertEqual(sum(total_qty), 9.0, 'Wrong total stock location quantity (%s found instead of 9)' % (sum(total_qty)))
self.assertEqual(self.productD.qty_available, 9.0, 'Wrong quantity available (%s found instead of 9)' % (self.productD.qty_available))
#-----------------------------------------------------------------------
# Back order of Outgoing shipment
# ----------------------------------------------------------------------
back_order_out.do_prepare_partial()
back_order_out.do_transfer()
# Check stock location quants and available quantity for product A.
quants = self.StockQuantObj.search([('product_id', '=', self.productA.id), ('location_id', '=', self.stock_location)])
total_qty = [quant.qty for quant in quants]
self.assertGreaterEqual(float_round(sum(total_qty), precision_rounding=0.0001), 1, 'Total stock location quantity for product A should not be nagative.')
def test_10_pickings_transfer_with_different_uom(self):
""" Picking transfer with diffrent unit of meassure. """
# ----------------------------------------------------------------------
# Create incoming shipment of products DozA, SDozA, SDozARound, kgB, gB
# ----------------------------------------------------------------------
# DozA ( 10 Dozen ) , SDozA ( 10.5 SuperDozen )
# SDozARound ( 10.5 10.5 SuperDozenRound ) , kgB ( 0.020 kg )
# gB ( 525.3 g )
# ----------------------------------------------------------------------
picking_in_A = self.PickingObj.create({
'partner_id': self.partner_delta_id,
'picking_type_id': self.picking_type_in,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location})
self.MoveObj.create({
'name': self.DozA.name,
'product_id': self.DozA.id,
'product_uom_qty': 10,
'product_uom': self.DozA.uom_id.id,
'picking_id': picking_in_A.id,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location})
self.MoveObj.create({
'name': self.SDozA.name,
'product_id': self.SDozA.id,
'product_uom_qty': 10.5,
'product_uom': self.SDozA.uom_id.id,
'picking_id': picking_in_A.id,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location})
self.MoveObj.create({
'name': self.SDozARound.name,
'product_id': self.SDozARound.id,
'product_uom_qty': 10.5,
'product_uom': self.SDozARound.uom_id.id,
'picking_id': picking_in_A.id,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location})
self.MoveObj.create({
'name': self.kgB.name,
'product_id': self.kgB.id,
'product_uom_qty': 0.020,
'product_uom': self.kgB.uom_id.id,
'picking_id': picking_in_A.id,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location})
self.MoveObj.create({
'name': self.gB.name,
'product_id': self.gB.id,
'product_uom_qty': 525.3,
'product_uom': self.gB.uom_id.id,
'picking_id': picking_in_A.id,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location})
# Check incoming shipment move lines state.
for move in picking_in_A.move_lines:
self.assertEqual(move.state, 'draft', 'Move state must be draft.')
# Confirm incoming shipment.
picking_in_A.action_confirm()
# Check incoming shipment move lines state.
for move in picking_in_A.move_lines:
self.assertEqual(move.state, 'assigned', 'Move state must be draft.')
picking_in_A.do_prepare_partial()
# ----------------------------------------------------
# Check pack operation quantity of incoming shipments.
# ----------------------------------------------------
PackSdozAround = self.StockPackObj.search([('product_id', '=', self.SDozARound.id), ('picking_id', '=', picking_in_A.id)], limit=1)
self.assertEqual(PackSdozAround.product_qty, 11, 'Wrong quantity in pack operation (%s found instead of 11)' % (PackSdozAround.product_qty))
picking_in_A.do_transfer()
#-----------------------------------------------------------------------
# Check stock location quant quantity and quantity available
#-----------------------------------------------------------------------
# Check quants and available quantity for product DozA
quants = self.StockQuantObj.search([('product_id', '=', self.DozA.id), ('location_id', '=', self.stock_location)])
total_qty = [quant.qty for quant in quants]
self.assertEqual(sum(total_qty), 10, 'Expecting 10 Dozen , got %.4f Dozen on location stock!' % (sum(total_qty)))
self.assertEqual(self.DozA.qty_available, 10, 'Wrong quantity available (%s found instead of 10)' % (self.DozA.qty_available))
# Check quants and available quantity for product SDozA
quants = self.StockQuantObj.search([('product_id', '=', self.SDozA.id), ('location_id', '=', self.stock_location)])
total_qty = [quant.qty for quant in quants]
self.assertEqual(sum(total_qty), 10.5, 'Expecting 10.5 SDozen , got %.4f SDozen on location stock!' % (sum(total_qty)))
self.assertEqual(self.SDozA.qty_available, 10.5, 'Wrong quantity available (%s found instead of 10.5)' % (self.SDozA.qty_available))
# Check quants and available quantity for product SDozARound
quants = self.StockQuantObj.search([('product_id', '=', self.SDozARound.id), ('location_id', '=', self.stock_location)])
total_qty = [quant.qty for quant in quants]
self.assertEqual(sum(total_qty), 11, 'Expecting 11 SDozenRound , got %.4f SDozenRound on location stock!' % (sum(total_qty)))
self.assertEqual(self.SDozARound.qty_available, 11, 'Wrong quantity available (%s found instead of 11)' % (self.SDozARound.qty_available))
# Check quants and available quantity for product gB
quants = self.StockQuantObj.search([('product_id', '=', self.gB.id), ('location_id', '=', self.stock_location)])
total_qty = [quant.qty for quant in quants]
self.assertEqual(sum(total_qty), 525.3, 'Expecting 525.3 gram , got %.4f gram on location stock!' % (sum(total_qty)))
self.assertEqual(self.gB.qty_available, 525.3, 'Wrong quantity available (%s found instead of 525.3' % (self.gB.qty_available))
# Check quants and available quantity for product kgB
quants = self.StockQuantObj.search([('product_id', '=', self.kgB.id), ('location_id', '=', self.stock_location)])
total_qty = [quant.qty for quant in quants]
self.assertEqual(sum(total_qty), 0.020, 'Expecting 0.020 kg , got %.4f kg on location stock!' % (sum(total_qty)))
self.assertEqual(self.kgB.qty_available, 0.020, 'Wrong quantity available (%s found instead of 0.020)' % (self.kgB.qty_available))
# ----------------------------------------------------------------------
# Create Incoming Shipment B
# ----------------------------------------------------------------------
picking_in_B = self.PickingObj.create({
'partner_id': self.partner_delta_id,
'picking_type_id': self.picking_type_in,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location})
self.MoveObj.create({
'name': self.DozA.name,
'product_id': self.DozA.id,
'product_uom_qty': 120,
'product_uom': self.uom_unit.id,
'picking_id': picking_in_B.id,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location})
self.MoveObj.create({
'name': self.SDozA.name,
'product_id': self.SDozA.id,
'product_uom_qty': 1512,
'product_uom': self.uom_unit.id,
'picking_id': picking_in_B.id,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location})
self.MoveObj.create({
'name': self.SDozARound.name,
'product_id': self.SDozARound.id,
'product_uom_qty': 1584,
'product_uom': self.uom_unit.id,
'picking_id': picking_in_B.id,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location})
self.MoveObj.create({
'name': self.kgB.name,
'product_id': self.kgB.id,
'product_uom_qty': 20.0,
'product_uom': self.uom_gm.id,
'picking_id': picking_in_B.id,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location})
self.MoveObj.create({
'name': self.gB.name,
'product_id': self.gB.id,
'product_uom_qty': 0.525,
'product_uom': self.uom_kg.id,
'picking_id': picking_in_B.id,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location})
# Check incoming shipment move lines state.
for move in picking_in_B.move_lines:
self.assertEqual(move.state, 'draft', 'Wrong state of move line.')
# Confirm incoming shipment.
picking_in_B.action_confirm()
# Check incoming shipment move lines state.
for move in picking_in_B.move_lines:
self.assertEqual(move.state, 'assigned', 'Wrong state of move line.')
picking_in_B.do_prepare_partial()
# ----------------------------------------------------------------------
# Check product quantity and unit of measure of pack operaation.
# ----------------------------------------------------------------------
# Check pack operation quantity and unit of measure for product DozA.
PackdozA = self.StockPackObj.search([('product_id', '=', self.DozA.id), ('picking_id', '=', picking_in_B.id)], limit=1)
self.assertEqual(PackdozA.product_qty, 120, 'Wrong quantity in pack operation (%s found instead of 120)' % (PackdozA.product_qty))
self.assertEqual(PackdozA.product_uom_id.id, self.uom_unit.id, 'Wrong uom in pack operation for product DozA.')
# Check pack operation quantity and unit of measure for product SDozA.
PackSdozA = self.StockPackObj.search([('product_id', '=', self.SDozA.id), ('picking_id', '=', picking_in_B.id)], limit=1)
self.assertEqual(PackSdozA.product_qty, 1512, 'Wrong quantity in pack operation (%s found instead of 1512)' % (PackSdozA.product_qty))
self.assertEqual(PackSdozA.product_uom_id.id, self.uom_unit.id, 'Wrong uom in pack operation for product SDozA.')
# Check pack operation quantity and unit of measure for product SDozARound.
PackSdozAround = self.StockPackObj.search([('product_id', '=', self.SDozARound.id), ('picking_id', '=', picking_in_B.id)], limit=1)
self.assertEqual(PackSdozAround.product_qty, 1584, 'Wrong quantity in pack operation (%s found instead of 1584)' % (PackSdozAround.product_qty))
self.assertEqual(PackSdozAround.product_uom_id.id, self.uom_unit.id, 'Wrong uom in pack operation for product SDozARound.')
# Check pack operation quantity and unit of measure for product gB.
packgB = self.StockPackObj.search([('product_id', '=', self.gB.id), ('picking_id', '=', picking_in_B.id)], limit=1)
self.assertEqual(packgB.product_qty, 525, 'Wrong quantity in pack operation (%s found instead of 525)' % (packgB.product_qty))
self.assertEqual(packgB.product_uom_id.id, self.uom_gm.id, 'Wrong uom in pack operation for product gB.')
# Check pack operation quantity and unit of measure for product kgB.
packkgB = self.StockPackObj.search([('product_id', '=', self.kgB.id), ('picking_id', '=', picking_in_B.id)], limit=1)
self.assertEqual(packkgB.product_qty, 20.0, 'Wrong quantity in pack operation (%s found instead of 20)' % (packkgB.product_qty))
self.assertEqual(packkgB.product_uom_id.id, self.uom_gm.id, 'Wrong uom in pack operation for product kgB')
# ----------------------------------------------------------------------
# Replace pack operation of incoming shipment.
# ----------------------------------------------------------------------
self.StockPackObj.search([('product_id', '=', self.kgB.id), ('picking_id', '=', picking_in_B.id)]).write({
'product_qty': 0.020, 'product_uom_id': self.uom_kg.id})
self.StockPackObj.search([('product_id', '=', self.gB.id), ('picking_id', '=', picking_in_B.id)]).write({
'product_qty': 525.3, 'product_uom_id': self.uom_gm.id})
self.StockPackObj.search([('product_id', '=', self.DozA.id), ('picking_id', '=', picking_in_B.id)]).write({
'product_qty': 4, 'product_uom_id': self.uom_dozen.id})
self.StockPackObj.create({
'product_id': self.DozA.id,
'product_qty': 48,
'product_uom_id': self.uom_unit.id,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location,
'picking_id': picking_in_B.id})
# Transfer product.
# -----------------
picking_in_B.do_transfer()
#-----------------------------------------------------------------------
# Check incoming shipment
#-----------------------------------------------------------------------
# Check incoming shipment state.
self.assertEqual(picking_in_B.state, 'done', 'Incoming shipment state should be done.')
# Check incoming shipment move lines state.
for move in picking_in_B.move_lines:
self.assertEqual(move.state, 'done', 'Wrong state of move line.')
# Check total done move lines for incoming shipment.
self.assertEqual(len(picking_in_B.move_lines), 6, 'Wrong number of move lines')
# Check product DozA done quantity.
moves_DozA = self.MoveObj.search([('product_id', '=', self.DozA.id), ('picking_id', '=', picking_in_B.id)], limit=1)
self.assertEqual(moves_DozA.product_uom_qty, 96, 'Wrong move quantity (%s found instead of 96)' % (moves_DozA.product_uom_qty))
self.assertEqual(moves_DozA.product_uom.id, self.uom_unit.id, 'Wrong uom in move for product DozA.')
# Check product SDozA done quantity.
moves_SDozA = self.MoveObj.search([('product_id', '=', self.SDozA.id), ('picking_id', '=', picking_in_B.id)], limit=1)
self.assertEqual(moves_SDozA.product_uom_qty, 1512, 'Wrong move quantity (%s found instead of 1512)' % (moves_SDozA.product_uom_qty))
self.assertEqual(moves_SDozA.product_uom.id, self.uom_unit.id, 'Wrong uom in move for product SDozA.')
# Check product SDozARound done quantity.
moves_SDozARound = self.MoveObj.search([('product_id', '=', self.SDozARound.id), ('picking_id', '=', picking_in_B.id)], limit=1)
self.assertEqual(moves_SDozARound.product_uom_qty, 1584, 'Wrong move quantity (%s found instead of 1584)' % (moves_SDozARound.product_uom_qty))
self.assertEqual(moves_SDozARound.product_uom.id, self.uom_unit.id, 'Wrong uom in move for product SDozARound.')
# Check product kgB done quantity.
moves_kgB = self.MoveObj.search([('product_id', '=', self.kgB.id), ('picking_id', '=', picking_in_B.id)], limit=1)
self.assertEqual(moves_kgB.product_uom_qty, 20, 'Wrong quantity in move (%s found instead of 20)' % (moves_kgB.product_uom_qty))
self.assertEqual(moves_kgB.product_uom.id, self.uom_gm.id, 'Wrong uom in move for product kgB.')
# Check two moves created for product gB with quantity (0.525 kg and 0.3 g)
moves_gB_kg = self.MoveObj.search([('product_id', '=', self.gB.id), ('picking_id', '=', picking_in_B.id), ('product_uom', '=', self.uom_kg.id)], limit=1)
self.assertEqual(moves_gB_kg.product_uom_qty, 0.525, 'Wrong move quantity (%s found instead of 0.525)' % (moves_gB_kg.product_uom_qty))
self.assertEqual(moves_gB_kg.product_uom.id, self.uom_kg.id, 'Wrong uom in move for product gB.')
moves_gB_g = self.MoveObj.search([('product_id', '=', self.gB.id), ('picking_id', '=', picking_in_B.id), ('product_uom', '=', self.uom_gm.id)], limit=1)
self.assertEqual(moves_gB_g.product_uom_qty, 0.3, 'Wrong move quantity (%s found instead of 0.3)' % (moves_gB_g.product_uom_qty))
self.assertEqual(moves_gB_g.product_uom.id, self.uom_gm.id, 'Wrong uom in move for product gB.')
# ----------------------------------------------------------------------
# Check Back order of Incoming shipment.
# ----------------------------------------------------------------------
# Check back order created or not.
bo_in_B = self.PickingObj.search([('backorder_id', '=', picking_in_B.id)])
self.assertEqual(len(bo_in_B), 1, 'Back order should be created.')
# Check total move lines of back order.
self.assertEqual(len(bo_in_B.move_lines), 1, 'Wrong number of move lines')
# Check back order created with correct quantity and uom or not.
moves_DozA = self.MoveObj.search([('product_id', '=', self.DozA.id), ('picking_id', '=', bo_in_B.id)], limit=1)
self.assertEqual(moves_DozA.product_uom_qty, 24.0, 'Wrong move quantity (%s found instead of 0.525)' % (moves_DozA.product_uom_qty))
self.assertEqual(moves_DozA.product_uom.id, self.uom_unit.id, 'Wrong uom in move for product DozA.')
# ----------------------------------------------------------------------
# Check product stock location quantity and quantity available.
# ----------------------------------------------------------------------
# Check quants and available quantity for product DozA
quants = self.StockQuantObj.search([('product_id', '=', self.DozA.id), ('location_id', '=', self.stock_location)])
total_qty = [quant.qty for quant in quants]
self.assertEqual(sum(total_qty), 18, 'Expecting 18 Dozen , got %.4f Dozen on location stock!' % (sum(total_qty)))
self.assertEqual(self.DozA.qty_available, 18, 'Wrong quantity available (%s found instead of 18)' % (self.DozA.qty_available))
# Check quants and available quantity for product SDozA
quants = self.StockQuantObj.search([('product_id', '=', self.SDozA.id), ('location_id', '=', self.stock_location)])
total_qty = [quant.qty for quant in quants]
self.assertEqual(sum(total_qty), 21, 'Expecting 18 SDozen , got %.4f SDozen on location stock!' % (sum(total_qty)))
self.assertEqual(self.SDozA.qty_available, 21, 'Wrong quantity available (%s found instead of 21)' % (self.SDozA.qty_available))
# Check quants and available quantity for product SDozARound
quants = self.StockQuantObj.search([('product_id', '=', self.SDozARound.id), ('location_id', '=', self.stock_location)])
total_qty = [quant.qty for quant in quants]
self.assertEqual(sum(total_qty), 22, 'Expecting 22 SDozenRound , got %.4f SDozenRound on location stock!' % (sum(total_qty)))
self.assertEqual(self.SDozARound.qty_available, 22, 'Wrong quantity available (%s found instead of 22)' % (self.SDozARound.qty_available))
# Check quants and available quantity for product gB.
quants = self.StockQuantObj.search([('product_id', '=', self.gB.id), ('location_id', '=', self.stock_location)])
total_qty = [quant.qty for quant in quants]
self.assertEqual(sum(total_qty), 1050.6, 'Expecting 1050.6 Gram , got %.4f Gram on location stock!' % (sum(total_qty)))
self.assertEqual(self.gB.qty_available, 1050.6, 'Wrong quantity available (%s found instead of 1050.6)' % (self.gB.qty_available))
# Check quants and available quantity for product kgB.
quants = self.StockQuantObj.search([('product_id', '=', self.kgB.id), ('location_id', '=', self.stock_location)])
total_qty = [quant.qty for quant in quants]
self.assertEqual(sum(total_qty), 0.040, 'Expecting 0.040 kg , got %.4f kg on location stock!' % (sum(total_qty)))
self.assertEqual(self.kgB.qty_available, 0.040, 'Wrong quantity available (%s found instead of 0.040)' % (self.kgB.qty_available))
# ----------------------------------------------------------------------
# Create outgoing shipment.
# ----------------------------------------------------------------------
before_out_quantity = self.kgB.qty_available
picking_out = self.PickingObj.create({
'partner_id': self.partner_agrolite_id,
'picking_type_id': self.picking_type_out,
'location_id': self.stock_location,
'location_dest_id': self.customer_location})
self.MoveObj.create({
'name': self.kgB.name,
'product_id': self.kgB.id,
'product_uom_qty': 0.966,
'product_uom': self.uom_gm.id,
'picking_id': picking_out.id,
'location_id': self.stock_location,
'location_dest_id': self.customer_location})
self.MoveObj.create({
'name': self.kgB.name,
'product_id': self.kgB.id,
'product_uom_qty': 0.034,
'product_uom': self.uom_gm.id,
'picking_id': picking_out.id,
'location_id': self.stock_location,
'location_dest_id': self.customer_location})
picking_out.action_confirm()
picking_out.action_assign()
picking_out.do_prepare_partial()
picking_out.do_transfer()
# Check quantity difference after stock transfer.
quantity_diff = before_out_quantity - self.kgB.qty_available
self.assertEqual(float_round(quantity_diff, precision_rounding=0.0001), 0.001, 'Wrong quantity diffrence.')
self.assertEqual(self.kgB.qty_available, 0.039, 'Wrong quantity available (%s found instead of 0.039)' % (self.kgB.qty_available))
# ======================================================================
# Outgoing shipments.
# ======================================================================
# Create Outgoing shipment with ...
# product DozA ( 54 Unit ) , SDozA ( 288 Unit )
# product SDozRound ( 360 unit ) , product gB ( 0.503 kg )
# product kgB ( 19 g )
# ======================================================================
picking_out = self.PickingObj.create({
'partner_id': self.partner_agrolite_id,
'picking_type_id': self.picking_type_out,
'location_id': self.stock_location,
'location_dest_id': self.customer_location})
self.MoveObj.create({
'name': self.DozA.name,
'product_id': self.DozA.id,
'product_uom_qty': 54,
'product_uom': self.uom_unit.id,
'picking_id': picking_out.id,
'location_id': self.stock_location,
'location_dest_id': self.customer_location})
self.MoveObj.create({
'name': self.SDozA.name,
'product_id': self.SDozA.id,
'product_uom_qty': 288,
'product_uom': self.uom_unit.id,
'picking_id': picking_out.id,
'location_id': self.stock_location,
'location_dest_id': self.customer_location})
self.MoveObj.create({
'name': self.SDozARound.name,
'product_id': self.SDozARound.id,
'product_uom_qty': 360,
'product_uom': self.uom_unit.id,
'picking_id': picking_out.id,
'location_id': self.stock_location,
'location_dest_id': self.customer_location})
self.MoveObj.create({
'name': self.gB.name,
'product_id': self.gB.id,
'product_uom_qty': 0.503,
'product_uom': self.uom_kg.id,
'picking_id': picking_out.id,
'location_id': self.stock_location,
'location_dest_id': self.customer_location})
self.MoveObj.create({
'name': self.kgB.name,
'product_id': self.kgB.id,
'product_uom_qty': 20,
'product_uom': self.uom_gm.id,
'picking_id': picking_out.id,
'location_id': self.stock_location,
'location_dest_id': self.customer_location})
# Confirm outgoing shipment.
picking_out.action_confirm()
for move in picking_out.move_lines:
self.assertEqual(move.state, 'confirmed', 'Wrong state of move line.')
# Assing product to outgoing shipments
picking_out.action_assign()
for move in picking_out.move_lines:
self.assertEqual(move.state, 'assigned', 'Wrong state of move line.')
# Check product A available quantity
DozA_qty = self.MoveObj.search([('product_id', '=', self.DozA.id), ('picking_id', '=', picking_out.id)], limit=1).reserved_availability
self.assertEqual(DozA_qty, 4.5, 'Wrong move quantity availability (%s found instead of 4.5)' % (DozA_qty))
# Check product B available quantity
SDozA_qty = self.MoveObj.search([('product_id', '=', self.SDozA.id), ('picking_id', '=', picking_out.id)], limit=1).reserved_availability
self.assertEqual(SDozA_qty, 2, 'Wrong move quantity availability (%s found instead of 2)' % (SDozA_qty))
# Check product C available quantity
SDozARound_qty = self.MoveObj.search([('product_id', '=', self.SDozARound.id), ('picking_id', '=', picking_out.id)], limit=1).reserved_availability
self.assertEqual(SDozARound_qty, 3, 'Wrong move quantity availability (%s found instead of 3)' % (SDozARound_qty))
# Check product D available quantity
gB_qty = self.MoveObj.search([('product_id', '=', self.gB.id), ('picking_id', '=', picking_out.id)], limit=1).reserved_availability
self.assertEqual(gB_qty, 503, 'Wrong move quantity availability (%s found instead of 503)' % (gB_qty))
# Check product D available quantity
kgB_qty = self.MoveObj.search([('product_id', '=', self.kgB.id), ('picking_id', '=', picking_out.id)], limit=1).reserved_availability
self.assertEqual(kgB_qty, 0.020, 'Wrong move quantity availability (%s found instead of 0.020)' % (kgB_qty))
picking_out.do_prepare_partial()
picking_out.do_transfer()
# ----------------------------------------------------------------------
# Check product stock location quantity and quantity available.
# ----------------------------------------------------------------------
# Check quants and available quantity for product DozA
quants = self.StockQuantObj.search([('product_id', '=', self.DozA.id), ('location_id', '=', self.stock_location)])
total_qty = [quant.qty for quant in quants]
self.assertEqual(sum(total_qty), 13.5, 'Expecting 13.5 Dozen , got %.4f Dozen on location stock!' % (sum(total_qty)))
self.assertEqual(self.DozA.qty_available, 13.5, 'Wrong quantity available (%s found instead of 13.5)' % (self.DozA.qty_available))
# Check quants and available quantity for product SDozA
quants = self.StockQuantObj.search([('product_id', '=', self.SDozA.id), ('location_id', '=', self.stock_location)])
total_qty = [quant.qty for quant in quants]
self.assertEqual(sum(total_qty), 19, 'Expecting 19 SDozen , got %.4f SDozen on location stock!' % (sum(total_qty)))
self.assertEqual(self.SDozA.qty_available, 19, 'Wrong quantity available (%s found instead of 19)' % (self.SDozA.qty_available))
# Check quants and available quantity for product SDozARound
quants = self.StockQuantObj.search([('product_id', '=', self.SDozARound.id), ('location_id', '=', self.stock_location)])
total_qty = [quant.qty for quant in quants]
self.assertEqual(sum(total_qty), 19, 'Expecting 19 SDozRound , got %.4f SDozRound on location stock!' % (sum(total_qty)))
self.assertEqual(self.SDozARound.qty_available, 19, 'Wrong quantity available (%s found instead of 19)' % (self.SDozARound.qty_available))
# Check quants and available quantity for product gB.
quants = self.StockQuantObj.search([('product_id', '=', self.gB.id), ('location_id', '=', self.stock_location)])
total_qty = [quant.qty for quant in quants]
self.assertEqual(float_round(sum(total_qty), precision_rounding=0.0001), 547.6, 'Expecting 547.6 g , got %.4f g on location stock!' % (sum(total_qty)))
self.assertEqual(self.gB.qty_available, 547.6, 'Wrong quantity available (%s found instead of 547.6)' % (self.gB.qty_available))
# Check quants and available quantity for product kgB.
quants = self.StockQuantObj.search([('product_id', '=', self.kgB.id), ('location_id', '=', self.stock_location)])
total_qty = [quant.qty for quant in quants]
self.assertEqual(sum(total_qty), 0.019, 'Expecting 0.019 kg , got %.4f kg on location stock!' % (sum(total_qty)))
self.assertEqual(self.kgB.qty_available, 0.019, 'Wrong quantity available (%s found instead of 0.019)' % (self.kgB.qty_available))
# ----------------------------------------------------------------------
# Receipt back order of incoming shipment.
# ----------------------------------------------------------------------
bo_in_B.do_prepare_partial()
bo_in_B.do_transfer()
# Check quants and available quantity for product kgB.
quants = self.StockQuantObj.search([('product_id', '=', self.DozA.id), ('location_id', '=', self.stock_location)])
total_qty = [quant.qty for quant in quants]
self.assertEqual(sum(total_qty), 15.5, 'Expecting 15.5 Dozen , got %.4f Dozen on location stock!' % (sum(total_qty)))
self.assertEqual(self.DozA.qty_available, 15.5, 'Wrong quantity available (%s found instead of 15.5)' % (self.DozA.qty_available))
# -----------------------------------------
# Create product in kg and receive in ton.
# -----------------------------------------
productKG = self.ProductObj.create({'name': 'Product KG', 'uom_id': self.uom_kg.id, 'uom_po_id': self.uom_kg.id})
picking_in = self.PickingObj.create({
'partner_id': self.partner_delta_id,
'picking_type_id': self.picking_type_in,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location})
self.MoveObj.create({
'name': productKG.name,
'product_id': productKG.id,
'product_uom_qty': 1.0,
'product_uom': self.uom_tone.id,
'picking_id': picking_in.id,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location})
# Check incoming shipment state.
self.assertEqual(picking_in.state, 'draft', 'Incoming shipment state should be draft.')
# Check incoming shipment move lines state.
for move in picking_in.move_lines:
self.assertEqual(move.state, 'draft', 'Wrong state of move line.')
# Confirm incoming shipment.
picking_in.action_confirm()
# Check incoming shipment move lines state.
for move in picking_in.move_lines:
self.assertEqual(move.state, 'assigned', 'Wrong state of move line.')
picking_in.do_prepare_partial()
# Check pack operation quantity.
packKG = self.StockPackObj.search([('product_id', '=', productKG.id), ('picking_id', '=', picking_in.id)], limit=1)
self.assertEqual(packKG.product_qty, 1000, 'Wrong product quantity in pack operation (%s found instead of 1000)' % (packKG.product_qty))
self.assertEqual(packKG.product_uom_id.id, self.uom_kg.id, 'Wrong product uom in pack operation.')
# Transfer Incoming shipment.
picking_in.do_transfer()
#-----------------------------------------------------------------------
# Check incoming shipment after transfer.
#-----------------------------------------------------------------------
# Check incoming shipment state.
self.assertEqual(picking_in.state, 'done', 'Incoming shipment state: %s instead of %s' % (picking_in.state, 'done'))
# Check incoming shipment move lines state.
for move in picking_in.move_lines:
self.assertEqual(move.state, 'done', 'Wrong state of move lines.')
# Check total done move lines for incoming shipment.
self.assertEqual(len(picking_in.move_lines), 1, 'Wrong number of move lines')
# Check product DozA done quantity.
move = self.MoveObj.search([('product_id', '=', productKG.id), ('picking_id', '=', picking_in.id)], limit=1)
self.assertEqual(move.product_uom_qty, 1, 'Wrong product quantity in done move.')
self.assertEqual(move.product_uom.id, self.uom_tone.id, 'Wrong unit of measure in done move.')
self.assertEqual(productKG.qty_available, 1000, 'Wrong quantity available of product (%s found instead of 1000)' % (productKG.qty_available))
picking_out = self.PickingObj.create({
'partner_id': self.partner_agrolite_id,
'picking_type_id': self.picking_type_out,
'location_id': self.stock_location,
'location_dest_id': self.customer_location})
self.MoveObj.create({
'name': productKG.name,
'product_id': productKG.id,
'product_uom_qty': 2.5,
'product_uom': self.uom_gm.id,
'picking_id': picking_out.id,
'location_id': self.stock_location,
'location_dest_id': self.customer_location})
picking_out.action_confirm()
picking_out.action_assign()
picking_out.do_prepare_partial()
pack_opt = self.StockPackObj.search([('product_id', '=', productKG.id), ('picking_id', '=', picking_out.id)], limit=1)
pack_opt.write({'product_qty': 0.5})
picking_out.do_transfer()
quants = self.StockQuantObj.search([('product_id', '=', productKG.id), ('location_id', '=', self.stock_location)])
total_qty = [quant.qty for quant in quants]
# Check total quantity stock location.
self.assertEqual(sum(total_qty), 999.9995, 'Expecting 999.9995 kg , got %.4f kg on location stock!' % (sum(total_qty)))
# Check Back order created or not.
#---------------------------------
bo_out_1 = self.PickingObj.search([('backorder_id', '=', picking_out.id)])
self.assertEqual(len(bo_out_1), 1, 'Back order should be created.')
# Check total move lines of back order.
self.assertEqual(len(bo_out_1.move_lines), 1, 'Wrong number of move lines')
moves_KG = self.MoveObj.search([('product_id', '=', productKG.id), ('picking_id', '=', bo_out_1.id)], limit=1)
# Check back order created with correct quantity and uom or not.
self.assertEqual(moves_KG.product_uom_qty, 2.0, 'Wrong move quantity (%s found instead of 2.0)' % (moves_KG.product_uom_qty))
self.assertEqual(moves_KG.product_uom.id, self.uom_gm.id, 'Wrong uom in move for product KG.')
bo_out_1.action_assign()
bo_out_1.do_prepare_partial()
pack_opt = self.StockPackObj.search([('product_id', '=', productKG.id), ('picking_id', '=', bo_out_1.id)], limit=1)
pack_opt.write({'product_qty': 0.5})
bo_out_1.do_transfer()
quants = self.StockQuantObj.search([('product_id', '=', productKG.id), ('location_id', '=', self.stock_location)])
total_qty = [quant.qty for quant in quants]
# Check total quantity stock location.
self.assertEqual(sum(total_qty), 999.9990, 'Expecting 999.9990 kg , got %.4f kg on location stock!' % (sum(total_qty)))
# Check Back order created or not.
#---------------------------------
bo_out_2 = self.PickingObj.search([('backorder_id', '=', bo_out_1.id)])
self.assertEqual(len(bo_out_2), 1, 'Back order should be created.')
# Check total move lines of back order.
self.assertEqual(len(bo_out_2.move_lines), 1, 'Wrong number of move lines')
# Check back order created with correct move quantity and uom or not.
moves_KG = self.MoveObj.search([('product_id', '=', productKG.id), ('picking_id', '=', bo_out_2.id)], limit=1)
self.assertEqual(moves_KG.product_uom_qty, 1.5, 'Wrong move quantity (%s found instead of 1.5)' % (moves_KG.product_uom_qty))
self.assertEqual(moves_KG.product_uom.id, self.uom_gm.id, 'Wrong uom in move for product KG.')
bo_out_2.action_assign()
bo_out_2.do_prepare_partial()
pack_opt = self.StockPackObj.search([('product_id', '=', productKG.id), ('picking_id', '=', bo_out_2.id)], limit=1)
pack_opt.write({'product_qty': 0.5})
bo_out_2.do_transfer()
# Check total quantity stock location of product KG.
quants = self.StockQuantObj.search([('product_id', '=', productKG.id), ('location_id', '=', self.stock_location)])
total_qty = [quant.qty for quant in quants]
self.assertEqual(sum(total_qty), 999.9985, 'Expecting 999.9985 kg , got %.4f kg on location stock!' % (sum(total_qty)))
# Check Back order created or not.
#---------------------------------
bo_out_3 = self.PickingObj.search([('backorder_id', '=', bo_out_2.id)])
self.assertEqual(len(bo_out_3), 1, 'Back order should be created.')
# Check total move lines of back order.
self.assertEqual(len(bo_out_3.move_lines), 1, 'Wrong number of move lines')
# Check back order created with correct quantity and uom or not.
moves_KG = self.MoveObj.search([('product_id', '=', productKG.id), ('picking_id', '=', bo_out_3.id)], limit=1)
self.assertEqual(moves_KG.product_uom_qty, 1, 'Wrong move quantity (%s found instead of 1.0)' % (moves_KG.product_uom_qty))
self.assertEqual(moves_KG.product_uom.id, self.uom_gm.id, 'Wrong uom in move for product KG.')
bo_out_3.action_assign()
bo_out_3.do_prepare_partial()
pack_opt = self.StockPackObj.search([('product_id', '=', productKG.id), ('picking_id', '=', bo_out_3.id)], limit=1)
pack_opt.write({'product_qty': 0.5})
bo_out_3.do_transfer()
quants = self.StockQuantObj.search([('product_id', '=', productKG.id), ('location_id', '=', self.stock_location)])
total_qty = [quant.qty for quant in quants]
self.assertEqual(sum(total_qty), 999.9980, 'Expecting 999.9980 kg , got %.4f kg on location stock!' % (sum(total_qty)))
# Check Back order created or not.
#---------------------------------
bo_out_4 = self.PickingObj.search([('backorder_id', '=', bo_out_3.id)])
self.assertEqual(len(bo_out_4), 1, 'Back order should be created.')
# Check total move lines of back order.
self.assertEqual(len(bo_out_4.move_lines), 1, 'Wrong number of move lines')
# Check back order created with correct quantity and uom or not.
moves_KG = self.MoveObj.search([('product_id', '=', productKG.id), ('picking_id', '=', bo_out_4.id)], limit=1)
self.assertEqual(moves_KG.product_uom_qty, 0.5, 'Wrong move quantity (%s found instead of 0.5)' % (moves_KG.product_uom_qty))
self.assertEqual(moves_KG.product_uom.id, self.uom_gm.id, 'Wrong uom in move for product KG.')
bo_out_4.action_assign()
bo_out_4.do_prepare_partial()
pack_opt = self.StockPackObj.search([('product_id', '=', productKG.id), ('picking_id', '=', bo_out_4.id)], limit=1)
pack_opt.write({'product_qty': 0.5})
bo_out_4.do_transfer()
quants = self.StockQuantObj.search([('product_id', '=', productKG.id), ('location_id', '=', self.stock_location)])
total_qty = [quant.qty for quant in quants]
self.assertEqual(sum(total_qty), 999.9975, 'Expecting 999.9975 kg , got %.4f kg on location stock!' % (sum(total_qty)))
def test_20_create_inventory_with_different_uom(self):
"""Create inventory with different unit of measure."""
# ------------------------------------------------
# Test inventory with product A(Unit).
# ------------------------------------------------
inventory = self.InvObj.create({'name': 'Test',
'product_id': self.UnitA.id,
'filter': 'product'})
inventory.prepare_inventory()
self.assertFalse(inventory.line_ids, "Inventory line should not created.")
inventory_line = self.InvLineObj.create({
'inventory_id': inventory.id,
'product_id': self.UnitA.id,
'product_uom_id': self.uom_dozen.id,
'product_qty': 10,
'location_id': self.stock_location})
inventory.action_done()
# Check quantity available of product UnitA.
quants = self.StockQuantObj.search([('product_id', '=', self.UnitA.id), ('location_id', '=', self.stock_location)])
total_qty = [quant.qty for quant in quants]
self.assertEqual(sum(total_qty), 120, 'Expecting 120 Units , got %.4f Units on location stock!' % (sum(total_qty)))
self.assertEqual(self.UnitA.qty_available, 120, 'Expecting 120 Units , got %.4f Units of quantity available!' % (self.UnitA.qty_available))
# Create Inventory again for product UnitA.
inventory = self.InvObj.create({'name': 'Test',
'product_id': self.UnitA.id,
'filter': 'product'})
inventory.prepare_inventory()
self.assertEqual(len(inventory.line_ids), 1, "One inventory line should be created.")
inventory_line = self.InvLineObj.search([('product_id', '=', self.UnitA.id), ('inventory_id', '=', inventory.id)], limit=1)
self.assertEqual(inventory_line.product_qty, 120, "Wrong product quantity in inventory line.")
# Modify the inventory line and set the quantity to 144 product on this new inventory.
inventory_line.write({'product_qty': 144})
inventory.action_done()
move = self.MoveObj.search([('product_id', '=', self.UnitA.id), ('inventory_id', '=', inventory.id)], limit=1)
self.assertEqual(move.product_uom_qty, 24, "Wrong move quantity of product UnitA.")
# Check quantity available of product UnitA.
quants = self.StockQuantObj.search([('product_id', '=', self.UnitA.id), ('location_id', '=', self.stock_location)])
total_qty = [quant.qty for quant in quants]
self.assertEqual(sum(total_qty), 144, 'Expecting 144 Units , got %.4f Units on location stock!' % (sum(total_qty)))
self.assertEqual(self.UnitA.qty_available, 144, 'Expecting 144 Units , got %.4f Units of quantity available!' % (self.UnitA.qty_available))
# ------------------------------------------------
# Test inventory with product KG.
# ------------------------------------------------
productKG = self.ProductObj.create({'name': 'Product KG', 'uom_id': self.uom_kg.id, 'uom_po_id': self.uom_kg.id})
inventory = self.InvObj.create({'name': 'Inventory Product KG',
'product_id': productKG.id,
'filter': 'product'})
inventory.prepare_inventory()
self.assertFalse(inventory.line_ids, "Inventory line should not created.")
inventory_line = self.InvLineObj.create({
'inventory_id': inventory.id,
'product_id': productKG.id,
'product_uom_id': self.uom_tone.id,
'product_qty': 5,
'location_id': self.stock_location})
inventory.action_done()
quants = self.StockQuantObj.search([('product_id', '=', productKG.id), ('location_id', '=', self.stock_location)])
total_qty = [quant.qty for quant in quants]
self.assertEqual(sum(total_qty), 5000, 'Expecting 5000 kg , got %.4f kg on location stock!' % (sum(total_qty)))
self.assertEqual(productKG.qty_available, 5000, 'Expecting 5000 kg , got %.4f kg of quantity available!' % (productKG.qty_available))
# Create Inventory again.
inventory = self.InvObj.create({'name': 'Test',
'product_id': productKG.id,
'filter': 'product'})
inventory.prepare_inventory()
self.assertEqual(len(inventory.line_ids), 1, "One inventory line should be created.")
inventory_line = self.InvLineObj.search([('product_id', '=', productKG.id), ('inventory_id', '=', inventory.id)], limit=1)
self.assertEqual(inventory_line.product_qty, 5000, "Wrong product quantity in inventory line.")
# Modify the inventory line and set the quantity to 4000 product on this new inventory.
inventory_line.write({'product_qty': 4000})
inventory.action_done()
# Check inventory move quantity of product KG.
move = self.MoveObj.search([('product_id', '=', productKG.id), ('inventory_id', '=', inventory.id)], limit=1)
self.assertEqual(move.product_uom_qty, 1000, "Wrong move quantity of product KG.")
# Check quantity available of product KG.
quants = self.StockQuantObj.search([('product_id', '=', productKG.id), ('location_id', '=', self.stock_location)])
total_qty = [quant.qty for quant in quants]
self.assertEqual(sum(total_qty), 4000, 'Expecting 4000 kg , got %.4f on location stock!' % (sum(total_qty)))
self.assertEqual(productKG.qty_available, 4000, 'Expecting 4000 kg , got %.4f of quantity available!' % (productKG.qty_available))
#--------------------------------------------------------
# TEST PARTIAL INVENTORY WITH PACKS and LOTS
#---------------------------------------------------------
packproduct = self.ProductObj.create({'name': 'Pack Product', 'uom_id': self.uom_unit.id, 'uom_po_id': self.uom_unit.id})
lotproduct = self.ProductObj.create({'name': 'Lot Product', 'uom_id': self.uom_unit.id, 'uom_po_id': self.uom_unit.id})
inventory = self.InvObj.create({'name': 'Test Partial and Pack',
'filter': 'partial',
'location_id': self.stock_location})
inventory.prepare_inventory()
pack_obj = self.env['stock.quant.package']
lot_obj = self.env['stock.production.lot']
pack1 = pack_obj.create({'name': 'PACK00TEST1'})
pack2 = pack_obj.create({'name': 'PACK00TEST2'})
lot1 = lot_obj.create({'name': 'Lot001', 'product_id': lotproduct.id})
move = self.MoveObj.search([('product_id', '=', productKG.id), ('inventory_id', '=', inventory.id)], limit=1)
self.assertEqual(len(move), 0, "Partial filter should not create a lines upon prepare")
line_vals = []
line_vals += [{'location_id': self.stock_location, 'product_id': packproduct.id, 'product_qty': 10, 'product_uom_id': packproduct.uom_id.id}]
line_vals += [{'location_id': self.stock_location, 'product_id': packproduct.id, 'product_qty': 20, 'product_uom_id': packproduct.uom_id.id, 'package_id': pack1.id}]
line_vals += [{'location_id': self.stock_location, 'product_id': lotproduct.id, 'product_qty': 30, 'product_uom_id': lotproduct.uom_id.id, 'prod_lot_id': lot1.id}]
line_vals += [{'location_id': self.stock_location, 'product_id': lotproduct.id, 'product_qty': 25, 'product_uom_id': lotproduct.uom_id.id, 'prod_lot_id': False}]
inventory.write({'line_ids': [(0, 0, x) for x in line_vals]})
inventory.action_done()
self.assertEqual(packproduct.qty_available, 30, "Wrong qty available for packproduct")
self.assertEqual(lotproduct.qty_available, 55, "Wrong qty available for lotproduct")
quants = self.StockQuantObj.search([('product_id', '=', packproduct.id), ('location_id', '=', self.stock_location), ('package_id', '=', pack1.id)])
total_qty = sum([quant.qty for quant in quants])
self.assertEqual(total_qty, 20, 'Expecting 20 units on package 1 of packproduct, but we got %.4f on location stock!' % (total_qty))
#Create an inventory that will put the lots without lot to 0 and check that taking without pack will not take it from the pack
inventory2 = self.InvObj.create({'name': 'Test Partial Lot and Pack2',
'filter': 'partial',
'location_id': self.stock_location})
inventory2.prepare_inventory()
line_vals = []
line_vals += [{'location_id': self.stock_location, 'product_id': packproduct.id, 'product_qty': 20, 'product_uom_id': packproduct.uom_id.id}]
line_vals += [{'location_id': self.stock_location, 'product_id': lotproduct.id, 'product_qty': 0, 'product_uom_id': lotproduct.uom_id.id, 'prod_lot_id': False}]
line_vals += [{'location_id': self.stock_location, 'product_id': lotproduct.id, 'product_qty': 10, 'product_uom_id': lotproduct.uom_id.id, 'prod_lot_id': lot1.id}]
inventory2.write({'line_ids': [(0, 0, x) for x in line_vals]})
inventory2.action_done()
self.assertEqual(packproduct.qty_available, 40, "Wrong qty available for packproduct")
self.assertEqual(lotproduct.qty_available, 10, "Wrong qty available for lotproduct")
quants = self.StockQuantObj.search([('product_id', '=', lotproduct.id), ('location_id', '=', self.stock_location), ('lot_id', '=', lot1.id)])
total_qty = sum([quant.qty for quant in quants])
self.assertEqual(total_qty, 10, 'Expecting 0 units lot of lotproduct, but we got %.4f on location stock!' % (total_qty))
quants = self.StockQuantObj.search([('product_id', '=', lotproduct.id), ('location_id', '=', self.stock_location), ('lot_id', '=', False)])
total_qty = sum([quant.qty for quant in quants])
self.assertEqual(total_qty, 0, 'Expecting 0 units lot of lotproduct, but we got %.4f on location stock!' % (total_qty))
# check product available of saleable category in stock location
category_id = self.ref('product.product_category_5')
inventory3 = self.InvObj.create({
'name': 'Test Category',
'filter': 'category',
'location_id': self.stock_location,
'category_id': category_id
})
# Start Inventory
inventory3.prepare_inventory()
# check all products have given category id
products_category = inventory3.line_ids.mapped('product_id.categ_id')
self.assertEqual(len(products_category), 1, "Inventory line should have only one category")
inventory3.action_done()
# check category with exhausted in stock location
inventory4 = self.InvObj.create({
'name': 'Test Exhausted Product',
'filter': 'category',
'location_id': self.stock_location,
'category_id': category_id,
'exhausted': True,
})
inventory4.prepare_inventory()
inventory4._get_inventory_lines_values()
inventory4_lines_count = len(inventory4.line_ids)
inventory4.action_done()
# Add one product in this product category
product = self.ProductObj.create({'name': 'Product A', 'type': 'product', 'categ_id': category_id})
# Check that this exhausted product is in the product category inventory adjustment
inventory5 = self.InvObj.create({
'name': 'Test Exhausted Product',
'filter': 'category',
'location_id': self.stock_location,
'category_id': category_id,
'exhausted': True,
})
inventory5.prepare_inventory()
inventory5._get_inventory_lines_values()
inventory5_lines_count = len(inventory5.line_ids)
inventory5.action_done()
self.assertEqual(inventory5_lines_count, inventory4_lines_count + 1, "The new product is not taken into account in the inventory valuation.")
self.assertTrue(product.id in inventory5.line_ids.mapped('product_id').ids, "The new product is not take into account in the inventory valuation.")
def test_30_check_with_no_incoming_lot(self):
""" Picking in without lots and picking out with"""
# Change basic picking type not to get lots
# Create product with lot tracking
picking_in = self.env['stock.picking.type'].browse(self.picking_type_in)
picking_in.use_create_lots = False
self.productA.tracking = 'lot'
picking_in = self.PickingObj.create({
'partner_id': self.partner_delta_id,
'picking_type_id': self.picking_type_in,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location})
self.MoveObj.create({
'name': self.productA.name,
'product_id': self.productA.id,
'product_uom_qty': 4,
'product_uom': self.productA.uom_id.id,
'picking_id': picking_in.id,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location})
# Check incoming shipment move lines state.
for move in picking_in.move_lines:
self.assertEqual(move.state, 'draft', 'Wrong state of move line.')
# Confirm incoming shipment.
picking_in.action_confirm()
# Check incoming shipment move lines state.
for move in picking_in.move_lines:
self.assertEqual(move.state, 'assigned', 'Wrong state of move line.')
picking_in.do_transfer()
picking_out = self.PickingObj.create({
'partner_id': self.partner_agrolite_id,
'name': 'testpicking',
'picking_type_id': self.picking_type_out,
'location_id': self.stock_location,
'location_dest_id': self.customer_location})
self.MoveObj.create({
'name': self.productA.name,
'product_id': self.productA.id,
'product_uom_qty': 3,
'product_uom': self.productA.uom_id.id,
'picking_id': picking_out.id,
'location_id': self.stock_location,
'location_dest_id': self.customer_location})
picking_out.action_confirm()
picking_out.action_assign()
pack_opt = self.StockPackObj.search([('picking_id', '=', picking_out.id)], limit=1)
lot1 = self.LotObj.create({'product_id': self.productA.id, 'name': 'LOT1'})
lot2 = self.LotObj.create({'product_id': self.productA.id, 'name': 'LOT2'})
lot3 = self.LotObj.create({'product_id': self.productA.id, 'name': 'LOT3'})
self.env['stock.pack.operation.lot'].create({'operation_id': pack_opt.id, 'lot_id': lot1.id, 'qty': 1.0})
self.env['stock.pack.operation.lot'].create({'operation_id': pack_opt.id,'lot_id': lot2.id, 'qty': 1.0})
self.env['stock.pack.operation.lot'].create({'operation_id': pack_opt.id, 'lot_id': lot3.id, 'qty': 2.0})
pack_opt.qty_done = 4.0
picking_out.do_new_transfer()
quants = self.StockQuantObj.search([('product_id', '=', self.productA.id), ('location_id', '=', self.stock_location)])
self.assertFalse(quants, 'Should not have any quants in stock anymore')
quants = self.StockQuantObj.search([('product_id', '=', self.productA.id), ('location_id', '=', self.customer_location)])
self.assertEqual(sum([x.qty for x in quants]), 4, 'Wrong total sum of quants')
self.assertEqual(sum([x.qty for x in quants if not x.lot_id]), 0.0, 'Wrong sum of quants with no lot')
self.assertEqual(sum([x.qty for x in quants if x.lot_id.id == lot1.id]), 1.0, 'Wrong sum of quants with lot 1')
self.assertEqual(sum([x.qty for x in quants if x.lot_id.id == lot2.id]), 1.0, 'Wrong sum of quants with lot 2')
self.assertEqual(sum([x.qty for x in quants if x.lot_id.id == lot3.id]), 2.0, 'Wrong sum of quants with lot 3')
def test_40_pack_in_pack(self):
""" Put a pack in pack"""
picking_out = self.PickingObj.create({
'partner_id': self.partner_agrolite_id,
'picking_type_id': self.picking_type_out,
'location_id': self.pack_location,
'location_dest_id': self.customer_location})
move_out = self.MoveObj.create({
'name': self.productA.name,
'product_id': self.productA.id,
'product_uom_qty': 3,
'product_uom': self.productA.uom_id.id,
'picking_id': picking_out.id,
'location_id': self.pack_location,
'location_dest_id': self.customer_location})
picking_pack = self.PickingObj.create({
'partner_id': self.partner_agrolite_id,
'picking_type_id': self.picking_type_out,
'location_id': self.stock_location ,
'location_dest_id': self.pack_location})
move_pack = self.MoveObj.create({
'name': self.productA.name,
'product_id': self.productA.id,
'product_uom_qty': 3,
'product_uom': self.productA.uom_id.id,
'picking_id': picking_pack.id,
'location_id': self.stock_location,
'location_dest_id': self.pack_location,
'move_dest_id': move_out.id})
picking_in = self.PickingObj.create({
'partner_id': self.partner_delta_id,
'picking_type_id': self.picking_type_in,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location})
move_in = self.MoveObj.create({
'name': self.productA.name,
'product_id': self.productA.id,
'product_uom_qty': 3,
'product_uom': self.productA.uom_id.id,
'picking_id': picking_in.id,
'location_id': self.supplier_location,
'location_dest_id': self.stock_location,
'move_dest_id': move_pack.id})
# Check incoming shipment move lines state.
for move in picking_in.move_lines:
self.assertEqual(move.state, 'draft', 'Wrong state of move line.')
# Confirm incoming shipment.
picking_in.action_confirm()
# Check incoming shipment move lines state.
for move in picking_in.move_lines:
self.assertEqual(move.state, 'assigned', 'Wrong state of move line.')
# Check incoming shipment move lines state.
for move in picking_pack.move_lines:
self.assertEqual(move.state, 'draft', 'Wrong state of move line.')
# Confirm incoming shipment.
picking_pack.action_confirm()
# Check incoming shipment move lines state.
for move in picking_pack.move_lines:
self.assertEqual(move.state, 'waiting', 'Wrong state of move line.')
# Check incoming shipment move lines state.
for move in picking_out.move_lines:
self.assertEqual(move.state, 'draft', 'Wrong state of move line.')
# Confirm incoming shipment.
picking_out.action_confirm()
# Check incoming shipment move lines state.
for move in picking_out.move_lines:
self.assertEqual(move.state, 'waiting', 'Wrong state of move line.')
# Set the quantity done on the pack operation
picking_in.pack_operation_product_ids.qty_done = 3.0
# Put in a pack
picking_in.put_in_pack()
# Get the new package
picking_in_package = picking_in.pack_operation_ids.result_package_id
# Validate picking
picking_in.do_new_transfer()
# Check first picking state changed to done
for move in picking_in.move_lines:
self.assertEqual(move.state, 'done', 'Wrong state of move line.')
# Check next picking state changed to 'assigned'
for move in picking_pack.move_lines:
self.assertEqual(move.state, 'assigned', 'Wrong state of move line.')
# set the pack in pack operation to 'done'
for pack in picking_pack.pack_operation_pack_ids:
pack.qty_done = 1.0
# Put in a pack
picking_pack.put_in_pack()
# Get the new package
picking_pack_package = picking_pack.pack_operation_ids.result_package_id
# Validate picking
picking_pack.do_new_transfer()
# Check second picking state changed to done
for move in picking_pack.move_lines:
self.assertEqual(move.state, 'done', 'Wrong state of move line.')
# Check next picking state changed to 'assigned'
for move in picking_out.move_lines:
self.assertEqual(move.state, 'assigned', 'Wrong state of move line.')
# set the pack in pack operation to 'done'
for pack in picking_out.pack_operation_pack_ids:
pack.qty_done = 1.0
# Validate picking
picking_out.do_new_transfer()
# check all pickings are done
for move in picking_in.move_lines:
self.assertEqual(move.state, 'done', 'Wrong state of move line.')
for move in picking_pack.move_lines:
self.assertEqual(move.state, 'done', 'Wrong state of move line.')
for move in picking_out.move_lines:
self.assertEqual(move.state, 'done', 'Wrong state of move line.')
# Check picking_in_package is in picking_pack_package
self.assertEqual(picking_in_package.parent_id.id, picking_pack_package.id, 'The package created in the picking in is not in the one created in picking pack')
# Check that both packages are in the customer location
self.assertEqual(picking_pack_package.location_id.id, self.customer_location, 'The package created in picking pack is not in the customer location')
self.assertEqual(picking_in_package.location_id.id, self.customer_location, 'The package created in picking in is not in the customer location')
# Check that we have a quant in customer location, for the productA with qty 3
quant = self.StockQuantObj.search([('location_id', '=', self.customer_location), ('product_id', '=', self.productA.id)])
self.assertTrue(quant.id, 'There is no quant in customer location for productA')
self.assertEqual(quant.qty, 3.0, 'The quant in customer location for productA has not a quantity of 3.0')
# Check that the parent package of the quant is the picking_in_package
self.assertEqual(quant.package_id.id, picking_in_package.id, 'The quant in customer location is not in its package created in picking in')
|
gpl-3.0
|
explosivose/CHASERS
|
Assets/BrainStorm/Scripts/Equipment/WeaponLaserEffects.cs
|
545
|
using UnityEngine;
using System.Collections;
public class WeaponLaserEffects : MonoBehaviour {
public Transform[] startPoints;
public Transform laserEffect;
private Transform _nozzle;
void Awake() {
_nozzle = transform.FindChild("Nozzle");
ObjectPool.CreatePool(laserEffect);
}
void FireEffect() {
foreach(Transform t in startPoints) {
// these lasers need to be using local space
Transform i = laserEffect.Spawn(t.position);
i.parent = this.transform;
i.SendMessage("HitPosition", _nozzle.position);
}
}
}
|
gpl-3.0
|
callummoffat/Unigram
|
Unigram/Unigram/Views/InvitePage.xaml.cs
|
817
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
namespace Unigram.Views
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class InvitePage : Page
{
public InvitePage()
{
this.InitializeComponent();
}
}
}
|
gpl-3.0
|
jugal-ionic/parse-server
|
node_modules/parse-server/lib/testing-routes.js
|
2732
|
'use strict';
var _cache = require('./cache');
var _cache2 = _interopRequireDefault(_cache);
var _middlewares = require('./middlewares');
var middlewares = _interopRequireWildcard(_middlewares);
var _index = require('./index');
var _node = require('parse/node');
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// testing-routes.js
var express = require('express'),
cryptoUtils = require('./cryptoUtils');
var router = express.Router();
// creates a unique app in the cache, with a collection prefix
function createApp(req, res) {
var appId = cryptoUtils.randomHexString(32);
(0, _index.ParseServer)({
appId: appId,
masterKey: 'master',
serverURL: _node.Parse.serverURL,
collectionPrefix: appId
});
var keys = {
'application_id': appId,
'client_key': 'unused',
'windows_key': 'unused',
'javascript_key': 'unused',
'webhook_key': 'unused',
'rest_api_key': 'unused',
'master_key': 'master'
};
res.status(200).send(keys);
}
// deletes all collections that belong to the app
function clearApp(req, res) {
if (!req.auth.isMaster) {
return res.status(401).send({ "error": "unauthorized" });
}
return req.config.database.deleteEverything().then(function () {
res.status(200).send({});
});
}
// deletes all collections and drops the app from cache
function dropApp(req, res) {
if (!req.auth.isMaster) {
return res.status(401).send({ "error": "unauthorized" });
}
return req.config.database.deleteEverything().then(function () {
_cache2.default.apps.remove(req.config.applicationId);
res.status(200).send({});
});
}
// Lets just return a success response and see what happens.
function notImplementedYet(req, res) {
res.status(200).send({});
}
router.post('/rest_clear_app', middlewares.handleParseHeaders, clearApp);
router.post('/rest_block', middlewares.handleParseHeaders, notImplementedYet);
router.post('/rest_mock_v8_client', middlewares.handleParseHeaders, notImplementedYet);
router.post('/rest_unmock_v8_client', middlewares.handleParseHeaders, notImplementedYet);
router.post('/rest_verify_analytics', middlewares.handleParseHeaders, notImplementedYet);
router.post('/rest_create_app', createApp);
router.post('/rest_drop_app', middlewares.handleParseHeaders, dropApp);
router.post('/rest_configure_app', middlewares.handleParseHeaders, notImplementedYet);
module.exports = {
router: router
};
|
gpl-3.0
|
cdkrot/RoomedGame
|
src/tests/src/aabb-test.cpp
|
502
|
#include <glm/glm.hpp>
#include "gtest/gtest.h"
#include "aabb.h"
TEST (AABB, isInsideAABB)
{
AABB aabb = {glm::vec3(-10.0f, 4.0f, -8.0f), glm::vec3(+4.0f, +10.0f, +2.0f)};
EXPECT_TRUE(isInsideAABB(aabb, glm::vec3(0.0f, 5.0f, 0.0f)));
EXPECT_TRUE(isInsideAABB(aabb, glm::vec3(3.0f, 4.3f, -4.0f)));
EXPECT_FALSE(isInsideAABB(aabb, glm::vec3(-10.5f, 5.0f, 0.0f)));
EXPECT_FALSE(isInsideAABB(aabb, glm::vec3(5.0f, 0.4f, 0.0f)));
EXPECT_FALSE(isInsideAABB(aabb, glm::vec3(3.0f, 3.0f, 3.0f)));
}
|
gpl-3.0
|
dedefajriansyah/jibas
|
kepegawaian/logout.php
|
1259
|
<?
/**[N]**
* JIBAS Education Community
* Jaringan Informasi Bersama Antar Sekolah
*
* @version: 3.8 (January 25, 2016)
* @notes: JIBAS Education Community will be managed by Yayasan Indonesia Membaca (http://www.indonesiamembaca.net)
*
* Copyright (C) 2009 Yayasan Indonesia Membaca (http://www.indonesiamembaca.net)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 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
**[N]**/ ?>
<?php
session_name("_JIBAS_KEPEGAWAIAN__");
session_start();
unset($_SESSION['login']);
unset($_SESSION['tingkatsimpeg']);
unset($_SESSION['temasimpeg']);
unset($_SESSION['namasimpeg']);
unset($_SESSION['departemensimpeg']);
?>
<script language="javascript">
top.window.location='login.php';
</script>
|
gpl-3.0
|
thebatua/debus
|
debus_agent/moc_DTPCommands.cpp
|
2640
|
/****************************************************************************
** Meta object code from reading C++ file 'DTPCommands.h'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.7.0)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../debusd/DTPCommands.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'DTPCommands.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.7.0. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
struct qt_meta_stringdata_DTPCommands_t {
QByteArrayData data[1];
char stringdata0[12];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_DTPCommands_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_DTPCommands_t qt_meta_stringdata_DTPCommands = {
{
QT_MOC_LITERAL(0, 0, 11) // "DTPCommands"
},
"DTPCommands"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_DTPCommands[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
0 // eod
};
void DTPCommands::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
Q_UNUSED(_o);
Q_UNUSED(_id);
Q_UNUSED(_c);
Q_UNUSED(_a);
}
const QMetaObject DTPCommands::staticMetaObject = {
{ &QObject::staticMetaObject, qt_meta_stringdata_DTPCommands.data,
qt_meta_data_DTPCommands, qt_static_metacall, Q_NULLPTR, Q_NULLPTR}
};
const QMetaObject *DTPCommands::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *DTPCommands::qt_metacast(const char *_clname)
{
if (!_clname) return Q_NULLPTR;
if (!strcmp(_clname, qt_meta_stringdata_DTPCommands.stringdata0))
return static_cast<void*>(const_cast< DTPCommands*>(this));
return QObject::qt_metacast(_clname);
}
int DTPCommands::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QObject::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
return _id;
}
QT_END_MOC_NAMESPACE
|
gpl-3.0
|
viggyprabhu/UVCE-1stSem-ME-CN-TCPIP-Lab
|
ICMPImpl/src/org/uvce/cn/tcpip/labprograms/program5/PingIP.java
|
704
|
package org.uvce.cn.tcpip.labprograms.program5;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class PingIP {
// In this program we use system command Ping
// We call java inbuilt class Runtime.getRuntime.exec to execute the command
//Whatever output comes from the command, we show it to the user
public static void main(String args[]) {
try {
Process p = Runtime.getRuntime().exec("ping 127.0.0.1");
BufferedReader inputStream = new BufferedReader(new InputStreamReader(p.getInputStream()));
String s = "";
while ((s = inputStream.readLine()) != null) {
System.out.println(s);
}
}
catch (Exception e) {
e.printStackTrace();
}
}
}
|
gpl-3.0
|
scirner22/astah-parametrics-plugin
|
src/test/java/com/astah/diagram/AstahModelTest.java
|
1019
|
package com.astah.diagram;
import static org.junit.Assert.*;
import java.util.Arrays;
import java.util.List;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import com.change_vision.jude.api.inf.model.IDiagram;
import com.change_vision.jude.api.inf.model.IModel;
public class AstahModelTest {
private IModel project;
@Before
public void createAstahModel() throws Exception {
project = AstahTestProject.getInstance().getProject();
}
@After
public void tearDown() throws Exception {
AstahTestProject.getInstance().close();
}
@Test
public void testBlockDefinitionDiagrams() {
List<IDiagram> elements = AstahModel.getBlockDefinitionDiagrams(project);
assertEquals(Arrays.asList("BDD1", "BDD2", "BDD3"), AstahTestProject.convertToNames(elements));
}
@Test
public void testParametricDiagrams() {
List<IDiagram> elements = AstahModel.getParametricDiagrams(project);
assertEquals(Arrays.asList("Par1", "Par2"), AstahTestProject.convertToNames(elements));
}
}
|
gpl-3.0
|
kylethayer/bioladder
|
wiki/includes/api/ApiFeedWatchlist.php
|
9436
|
<?php
/**
* Copyright © 2006 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 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.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
*/
/**
* This action allows users to get their watchlist items in RSS/Atom formats.
* When executed, it performs a nested call to the API to get the needed data,
* and formats it in a proper format.
*
* @ingroup API
*/
class ApiFeedWatchlist extends ApiBase {
private $watchlistModule = null;
private $linkToSections = false;
/**
* This module uses a custom feed wrapper printer.
*
* @return ApiFormatFeedWrapper
*/
public function getCustomPrinter() {
return new ApiFormatFeedWrapper( $this->getMain() );
}
/**
* Make a nested call to the API to request watchlist items in the last $hours.
* Wrap the result as an RSS/Atom feed.
*/
public function execute() {
$config = $this->getConfig();
$feedClasses = $config->get( 'FeedClasses' );
$params = [];
try {
$params = $this->extractRequestParams();
if ( !$config->get( 'Feed' ) ) {
$this->dieWithError( 'feed-unavailable' );
}
if ( !isset( $feedClasses[$params['feedformat']] ) ) {
$this->dieWithError( 'feed-invalid' );
}
// limit to the number of hours going from now back
$endTime = wfTimestamp( TS_MW, time() - (int)$params['hours'] * 60 * 60 );
// Prepare parameters for nested request
$fauxReqArr = [
'action' => 'query',
'meta' => 'siteinfo',
'siprop' => 'general',
'list' => 'watchlist',
'wlprop' => 'title|user|comment|timestamp|ids|loginfo',
'wldir' => 'older', // reverse order - from newest to oldest
'wlend' => $endTime, // stop at this time
'wllimit' => min( 50, $this->getConfig()->get( 'FeedLimit' ) )
];
if ( $params['wlowner'] !== null ) {
$fauxReqArr['wlowner'] = $params['wlowner'];
}
if ( $params['wltoken'] !== null ) {
$fauxReqArr['wltoken'] = $params['wltoken'];
}
if ( $params['wlexcludeuser'] !== null ) {
$fauxReqArr['wlexcludeuser'] = $params['wlexcludeuser'];
}
if ( $params['wlshow'] !== null ) {
$fauxReqArr['wlshow'] = $params['wlshow'];
}
if ( $params['wltype'] !== null ) {
$fauxReqArr['wltype'] = $params['wltype'];
}
// Support linking directly to sections when possible
// (possible only if section name is present in comment)
if ( $params['linktosections'] ) {
$this->linkToSections = true;
}
// Check for 'allrev' parameter, and if found, show all revisions to each page on wl.
if ( $params['allrev'] ) {
$fauxReqArr['wlallrev'] = '';
}
$fauxReq = new FauxRequest( $fauxReqArr );
$module = new ApiMain( $fauxReq );
$module->execute();
$data = $module->getResult()->getResultData( [ 'query', 'watchlist' ] );
$feedItems = [];
foreach ( (array)$data as $key => $info ) {
if ( ApiResult::isMetadataKey( $key ) ) {
continue;
}
$feedItem = $this->createFeedItem( $info );
if ( $feedItem ) {
$feedItems[] = $feedItem;
}
}
$msg = wfMessage( 'watchlist' )->inContentLanguage()->text();
$feedTitle = $this->getConfig()->get( 'Sitename' ) . ' - ' . $msg .
' [' . $this->getConfig()->get( 'LanguageCode' ) . ']';
$feedUrl = SpecialPage::getTitleFor( 'Watchlist' )->getFullURL();
$feed = new $feedClasses[$params['feedformat']] (
$feedTitle,
htmlspecialchars( $msg ),
$feedUrl
);
ApiFormatFeedWrapper::setResult( $this->getResult(), $feed, $feedItems );
} catch ( Exception $e ) {
// Error results should not be cached
$this->getMain()->setCacheMaxAge( 0 );
// @todo FIXME: Localise brackets
$feedTitle = $this->getConfig()->get( 'Sitename' ) . ' - Error - ' .
wfMessage( 'watchlist' )->inContentLanguage()->text() .
' [' . $this->getConfig()->get( 'LanguageCode' ) . ']';
$feedUrl = SpecialPage::getTitleFor( 'Watchlist' )->getFullURL();
$feedFormat = $params['feedformat'] ?? 'rss';
$msg = wfMessage( 'watchlist' )->inContentLanguage()->escaped();
$feed = new $feedClasses[$feedFormat] ( $feedTitle, $msg, $feedUrl );
if ( $e instanceof ApiUsageException ) {
foreach ( $e->getStatusValue()->getErrors() as $error ) {
$msg = ApiMessage::create( $error )
->inLanguage( $this->getLanguage() );
$errorTitle = $this->msg( 'api-feed-error-title', $msg->getApiCode() );
$errorText = $msg->text();
$feedItems[] = new FeedItem( $errorTitle, $errorText, '', '', '' );
}
} else {
// Something is seriously wrong
$errorCode = 'internal_api_error';
$errorTitle = $this->msg( 'api-feed-error-title', $errorCode );
$errorText = $e->getMessage();
$feedItems[] = new FeedItem( $errorTitle, $errorText, '', '', '' );
}
ApiFormatFeedWrapper::setResult( $this->getResult(), $feed, $feedItems );
}
}
/**
* @param array $info
* @return FeedItem
*/
private function createFeedItem( $info ) {
if ( !isset( $info['title'] ) ) {
// Probably a revdeled log entry, skip it.
return null;
}
$titleStr = $info['title'];
$title = Title::newFromText( $titleStr );
$curidParam = [];
if ( !$title || $title->isExternal() ) {
// Probably a formerly-valid title that's now conflicting with an
// interwiki prefix or the like.
if ( isset( $info['pageid'] ) ) {
$title = Title::newFromID( $info['pageid'] );
$curidParam = [ 'curid' => $info['pageid'] ];
}
if ( !$title || $title->isExternal() ) {
return null;
}
}
if ( isset( $info['revid'] ) ) {
if ( $info['revid'] === 0 && isset( $info['logid'] ) ) {
$logTitle = Title::makeTitle( NS_SPECIAL, 'Log' );
$titleUrl = $logTitle->getFullURL( [ 'logid' => $info['logid'] ] );
} else {
$titleUrl = $title->getFullURL( [ 'diff' => $info['revid'] ] );
}
} else {
$titleUrl = $title->getFullURL( $curidParam );
}
$comment = $info['comment'] ?? null;
// Create an anchor to section.
// The anchor won't work for sections that have dupes on page
// as there's no way to strip that info from ApiWatchlist (apparently?).
// RegExp in the line below is equal to Linker::formatAutocomments().
if ( $this->linkToSections && $comment !== null &&
preg_match( '!(.*)/\*\s*(.*?)\s*\*/(.*)!', $comment, $matches )
) {
global $wgParser;
$titleUrl .= $wgParser->guessSectionNameFromWikiText( $matches[ 2 ] );
}
$timestamp = $info['timestamp'];
if ( isset( $info['user'] ) ) {
$user = $info['user'];
$completeText = "$comment ($user)";
} else {
$user = '';
$completeText = (string)$comment;
}
return new FeedItem( $titleStr, $completeText, $titleUrl, $timestamp, $user );
}
private function getWatchlistModule() {
if ( $this->watchlistModule === null ) {
$this->watchlistModule = $this->getMain()->getModuleManager()->getModule( 'query' )
->getModuleManager()->getModule( 'watchlist' );
}
return $this->watchlistModule;
}
public function getAllowedParams( $flags = 0 ) {
$feedFormatNames = array_keys( $this->getConfig()->get( 'FeedClasses' ) );
$ret = [
'feedformat' => [
ApiBase::PARAM_DFLT => 'rss',
ApiBase::PARAM_TYPE => $feedFormatNames
],
'hours' => [
ApiBase::PARAM_DFLT => 24,
ApiBase::PARAM_TYPE => 'integer',
ApiBase::PARAM_MIN => 1,
ApiBase::PARAM_MAX => 72,
],
'linktosections' => false,
];
$copyParams = [
'allrev' => 'allrev',
'owner' => 'wlowner',
'token' => 'wltoken',
'show' => 'wlshow',
'type' => 'wltype',
'excludeuser' => 'wlexcludeuser',
];
if ( $flags ) {
$wlparams = $this->getWatchlistModule()->getAllowedParams( $flags );
foreach ( $copyParams as $from => $to ) {
$p = $wlparams[$from];
if ( !is_array( $p ) ) {
$p = [ ApiBase::PARAM_DFLT => $p ];
}
if ( !isset( $p[ApiBase::PARAM_HELP_MSG] ) ) {
$p[ApiBase::PARAM_HELP_MSG] = "apihelp-query+watchlist-param-$from";
}
if ( isset( $p[ApiBase::PARAM_TYPE] ) && is_array( $p[ApiBase::PARAM_TYPE] ) &&
isset( $p[ApiBase::PARAM_HELP_MSG_PER_VALUE] )
) {
foreach ( $p[ApiBase::PARAM_TYPE] as $v ) {
if ( !isset( $p[ApiBase::PARAM_HELP_MSG_PER_VALUE][$v] ) ) {
$p[ApiBase::PARAM_HELP_MSG_PER_VALUE][$v] = "apihelp-query+watchlist-paramvalue-$from-$v";
}
}
}
$ret[$to] = $p;
}
} else {
foreach ( $copyParams as $from => $to ) {
$ret[$to] = null;
}
}
return $ret;
}
protected function getExamplesMessages() {
return [
'action=feedwatchlist'
=> 'apihelp-feedwatchlist-example-default',
'action=feedwatchlist&allrev=&hours=6'
=> 'apihelp-feedwatchlist-example-all6hrs',
];
}
public function getHelpUrls() {
return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Watchlist_feed';
}
}
|
gpl-3.0
|
ZeroOne71/ql
|
02_ECCentral/02_Portal/UI/ECCentral.Portal.UI.Common/Resources/ResQueryPayType.Designer.cs
|
9377
|
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.269
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ECCentral.Portal.UI.Common.Resources {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class ResQueryPayType {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
public ResQueryPayType() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ECCentral.Portal.UI.Common.Resources.ResQueryPayType", typeof(ResQueryPayType).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to 关闭.
/// </summary>
public static string Button_Close {
get {
return ResourceManager.GetString("Button_Close", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 新建.
/// </summary>
public static string Button_NewItem {
get {
return ResourceManager.GetString("Button_NewItem", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 保存.
/// </summary>
public static string Button_Save {
get {
return ResourceManager.GetString("Button_Save", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 查询.
/// </summary>
public static string Button_Search {
get {
return ResourceManager.GetString("Button_Search", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 操作.
/// </summary>
public static string Grid_Edit {
get {
return ResourceManager.GetString("Grid_Edit", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 保存操作成功.
/// </summary>
public static string Info_SaveSuccessfully {
get {
return ResourceManager.GetString("Info_SaveSuccessfully", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 是否网上支付:.
/// </summary>
public static string Label_IsNet {
get {
return ResourceManager.GetString("Label_IsNet", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 是否前台显示:.
/// </summary>
public static string Label_IsOnlineShow {
get {
return ResourceManager.GetString("Label_IsOnlineShow", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 是否货到付款:.
/// </summary>
public static string Label_IsPayWhenRecv {
get {
return ResourceManager.GetString("Label_IsPayWhenRecv", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 支付类型.
/// </summary>
public static string Label_NetPayType {
get {
return ResourceManager.GetString("Label_NetPayType", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 显示优先级:.
/// </summary>
public static string Label_OrderNumber {
get {
return ResourceManager.GetString("Label_OrderNumber", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 支付页面:.
/// </summary>
public static string Label_PaymentPage {
get {
return ResourceManager.GetString("Label_PaymentPage", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 费率:.
/// </summary>
public static string Label_PayRate {
get {
return ResourceManager.GetString("Label_PayRate", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 描述:.
/// </summary>
public static string Label_PayTypeDesc {
get {
return ResourceManager.GetString("Label_PayTypeDesc", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 编号:.
/// </summary>
public static string Label_PayTypeID {
get {
return ResourceManager.GetString("Label_PayTypeID", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 名称:.
/// </summary>
public static string Label_PayTypeName {
get {
return ResourceManager.GetString("Label_PayTypeName", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 到账周期:.
/// </summary>
public static string Label_Period {
get {
return ResourceManager.GetString("Label_Period", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 您没有此功能的操作权限!.
/// </summary>
public static string Msg_HasNoRight {
get {
return ResourceManager.GetString("Msg_HasNoRight", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 支付方式名称:.
/// </summary>
public static string TextBlock_PayTypeName {
get {
return ResourceManager.GetString("TextBlock_PayTypeName", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 系统编号.
/// </summary>
public static string TextBlock_SysNo {
get {
return ResourceManager.GetString("TextBlock_SysNo", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 编辑支付类型.
/// </summary>
public static string Title_EditPayType {
get {
return ResourceManager.GetString("Title_EditPayType", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 新建支付类型.
/// </summary>
public static string Title_NewPayType {
get {
return ResourceManager.GetString("Title_NewPayType", resourceCulture);
}
}
}
}
|
gpl-3.0
|
giacomocerquone/ilcorsaronero-api
|
index.js
|
2982
|
'use strict';
var request = require('request'),
cheerio = require('cheerio');
function search(term, cat, callback) {
if (typeof term !== 'string') {
callback(new Error("You must enter a string to search."));
return;
}
scrape("http://ilcorsaronero.info/argh.php?search=" + encodeURIComponent(term), cat, callback);
}
function latest(cat, callback) {
scrape("http://ilcorsaronero.info/recenti", cat, callback);
}
function scrape(url, cat, callback) {
if (typeof callback === 'undefined' && typeof cat !== 'function') {
console.log("Missing callback function.");
return;
}
request(url, function (error, response, body) {
if (!error && response.statusCode == 200) {
var $ = cheerio.load(body);
// We'll store retrieved data here
var result = [],
counter = 0,
items = $('.odd, .odd2');
// We don't scrape the category if it's specified and if it isn't an array
if (typeof cat === 'undefined' || typeof cat === 'function') {
callback = cat;
} else if (typeof cat === 'string') {
items = $('.odd, .odd2').filter(function() {
return $(this).children('td').eq(0).children('a').text() === cat;
});
} else if (Array.isArray(cat)) {
} else {
callback(new Error("The category parameter must be a String or an array of String."));
return;
}
items.each(function(i, row) {
// Unluckily the magnets are not accessible from the search page. We must access the torrent page and get the magnet
request( $(row).children('td').eq(1).children('a').attr("href"), function(error, response, body) {
if (!error && response.statusCode == 200) {
var $2 = cheerio.load(body),
catScraped = $(row).children('td').eq(0).children('a').text(),
name = $2('#content > #body > center').text(),
link = $2('.magnet').attr('href'),
size = $(row).children('td').eq(2).text(),
date = $(row).children('td').eq(4).text(),
seeds = $(row).children('td').eq(5).text(),
peers = $(row).children('td').eq(6).text();
// We've to do this awful thing because I didn't fastly find a way to filter multiple times a cheerio object
if (Array.isArray(cat)) {
cat.forEach(function(el) {
if (catScraped == el)
result.push( { "cat": catScraped, "name": name, "link": link, "size": size, "date": date, "seeds": seeds, "peers": peers } );
});
} else {
result.push( { "cat": catScraped, "name": name, "link": link, "size": size, "date": date, "seeds": seeds, "peers": peers } );
}
counter++;
if(counter == items.length) {
callback(null, result);
}
}
});
});
}
});
}
exports.search = search;
exports.latest = latest;
|
gpl-3.0
|
s20121035/rk3288_android5.1_repo
|
external/apache-harmony/security/src/test/api/java/org/apache/harmony/security/tests/java/security/serialization/KeyExceptionTest.java
|
1761
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author Vera Y. Petrashkova
*/
package org.apache.harmony.security.tests.java.security.serialization;
import java.security.KeyException;
import org.apache.harmony.testframework.serialization.SerializationTest;
/**
* Test for KeyException serialization
*/
public class KeyExceptionTest extends SerializationTest {
public static String[] msgs = {
"New message",
"Long message for Exception. Long message for Exception. Long message for Exception." };
protected Object[] getData() {
Exception cause = new Exception(msgs[1]);
KeyException dExc = new KeyException(msgs[0], cause);
String msg = null;
Throwable th = null;
return new Object[] { new KeyException(), new KeyException(msg),
new KeyException(msgs[1]),
new KeyException(new Throwable()), new KeyException(th),
new KeyException(msgs[1], dExc) };
}
}
|
gpl-3.0
|
Forlini91/Empire-Earth---DB-Editor
|
src/datstructure/structures/TerrainGrayTextures.java
|
1131
|
package datstructure.structures;
import java.io.IOException;
import java.util.List;
import datstructure.DatStructure;
import datstructure.Entry;
/**
* Represents the file dbterraingraytextures.dat
*
* @author MarcoForlini
*/
public class TerrainGrayTextures extends DatStructure {
/**
* Unique instance of this structure
*/
public static final TerrainGrayTextures instance = new TerrainGrayTextures();
/**
* Creates a new {@link TerrainGrayTextures}
*/
private TerrainGrayTextures() {
super("Terrain gray textures", "dbterraingraytextures.dat", true, 0, 1, 0, 2, 3, 4, -1, 4, 125, 175);
}
@Override
public void customInit() throws IOException {
newEntryValues = new Object[] {
0, "", "<New terrain gray>", 0, -1, 0, 0, 0
};
}
@Override
public int indexExtraFields() {
return -1;
}
@Override
public boolean hasCustomEntryName() {
return false;
}
@Override
public String getCustomEntryName(int index, List<Object> values) {
return null;
}
@Override
public String getEntryDescription(Entry entry) {
return null;
}
}
|
gpl-3.0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.