code stringlengths 3 1.05M | repo_name stringlengths 4 116 | path stringlengths 4 991 | language stringclasses 9 values | license stringclasses 15 values | size int32 3 1.05M |
|---|---|---|---|---|---|
/**
* The GiftEntry class describes a gift in terms of three values:
* the gift name, the gift receipient, and whether the gift
* has been bought yet.
*
* @author Richard White
* @version 2013-12-05
*/
public class GiftEntry
{
/**
* Constructor for known recipient with blank Gift
* @param recipient The person who will receive an as yet unnamed gift
*/
/**
* Constructor for known recipient with known Gift
* @param recipient The person who will receive the gift
* @param gift The gift this person will receive
*/
/**
* setName establishes the giftName for a person's gift
* @param theGiftName the name of the gift
*/
/**
* setRecipient establishes the recipient of a gift
* @param theRecipient the name of the gift's receiver
*/
/**
* setAsPurchased checks the gift off as purchased
*/
/**
* getName returns giftName for a gift
* @return the name of the gift
*/
/**
* getRecipient identifies the recipient of a gift
* @return gift's receiver
*/
/**
* isPurchased identifies whether the gift has been purchased
* @return the value true if purchased, false if not yet purchased
*/
}
| mattsoulanille/compSci | GiftList/GiftEntry.java | Java | mit | 1,290 |
<?php
/**
* Copyright (c) 2014 Webflavia
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace Webflavia\Entity;
use Webflavia\Resource\ResourceInterface;
/**
* @package \Webflavia\Entity
* @author Dhyego Fernando <dhyegofernando@gmail.com>
* @license <https://github.com/Webflavia/webflavia-php-sdk-v1/raw/master/LICENSE> MIT
*/
abstract class AbstractNavigable implements NavigableInterface {
/**
* Resource object reference
*
* @var \Webflavia\Resource\ResourceInterface
*/
protected $resource;
/**
* Request's response
*
* @var mixed[]
*/
protected $body;
/**
* Hypermedia links of request's resource
*
* @var mixed[]
*/
protected $links = array();
/**
* {@inheritDoc}
*/
public function __construct(ResourceInterface $resource, array $body) {
$this->resource = $resource;
$this->body = $body;
if (isset($this->body['_links'])) {
$this->links = $this->body['_links'];
}
}
/**
* {@inheritDoc}
*/
public function getLinks($offset = null) {
if (null !== $offset) {
return isset($this->links[$offset]) ? $this->links[$offset] : null;
}
return $this->links;
}
}
| EduardoMRB/webflavia-php-sdk-v1 | src/Webflavia/Entity/AbstractNavigable.php | PHP | mit | 2,220 |
module.exports = function(params) {
params = params || {};
_.extend(this, params);
this.validate = params.validate || function() {
return true;
};
} | chrisharrington/traque | app/models/base.js | JavaScript | mit | 177 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Join_Arrays
{
class Program
{
static void Main(string[] args)
{
int[] nums = { 100, 200, 300 };
foreach (var x in nums)
{
Console.WriteLine();
}
}
}
}
| giggals/Software-University | Arrays - Lab/Join Arrays/Program.cs | C# | mit | 382 |
<?php
// EventFormBundle:Categoria:index.html.twig
return array (
);
| DelBianco/TesteSymfony | app/cache/dev/assetic/config/8/8933b2c685bce28af52752733fbcafbf.php | PHP | mit | 70 |
public class IsUnique {
public static boolean isUnique1(String input) {
int checker = 0;
int n = input.length();
if (n <= 1) return true;
for (int i = 0; i < n; i++) {
int c = input.charAt(i) - 'a';
if ((checker & (1 << c)) > 0) return false;
checker |= (1 << c);
}
return true;
}
public static boolean isUnique2(String input) {
int N = 256;
int[] map = new int[N];
int n = input.length();
if (n <= 1) return true;
for (int i = 0; i < n; i++) {
int c = input.charAt(i);
if (map[c] == 1) return false;
map[c] = 1;
}
return true;
}
public static boolean isUnique3(String input) {
HashMap<Character, Boolean> map = new HashMap<Character, Boolean>();
int n = input.length();
if (n <= 1) return true;
for (int i = 0; i < n; i++) {
if (null != map.get(input.charAt(i))) return false;
else map.put(input.charAt(i), true);
}
return true;
}
public static void main(String[] args) {
String[] tester = {"", "a", "aa", "ab", "strong", "stronger", "Hello World"};
for (String s : tester) {
System.out.println(s + ": " + isUnique1(s) + " | " + isUnique2(s) + " | " + isUnique3(s));
}
}
} | fzheng/codejam | ccup/ch1/IsUnique.java | Java | mit | 1,234 |
require_dependency "venture/application_controller"
module Venture
class ProjectsController < ApplicationController
before_action :set_project, only: [:show, :edit, :update, :destroy]
# GET /projects
def index
@projects = Project.all
end
# GET /projects/1
def show
end
# GET /projects/new
def new
@project = Project.new
end
# GET /projects/1/edit
def edit
end
# POST /projects
def create
@project = Project.new(project_params)
if @project.save
redirect_to @project, notice: 'Project was successfully created.'
else
render action: 'new'
end
end
# PATCH/PUT /projects/1
def update
if @project.update(project_params)
redirect_to @project, notice: 'Project was successfully updated.'
else
render action: 'edit'
end
end
# DELETE /projects/1
def destroy
@project.destroy
redirect_to projects_url, notice: 'Project was successfully destroyed.'
end
private
# Use callbacks to share common setup or constraints between actions.
def set_project
@project = Project.find(params[:id])
end
# Only allow a trusted parameter "white list" through.
def project_params
params.require(:project).permit(:projectname)
end
end
end
| LaunchU/QuadVenture | app/controllers/venture/projects_controller.rb | Ruby | mit | 1,365 |
#ifndef PANELITEM_HPP
#define PANELITEM_HPP
#include "LevelMakerPanel.hpp"
#include "Button.hpp"
#include "InputString.hpp"
#include "Text.hpp"
class PanelItem : public LevelMakerPanel {
private:
Sprite* sprite_input_mass;
Button* button_input_mass;
lalge::R2Vector input_mass_position;
bool invalid_input_mass;
InputString input_mass;
Text* text_input_mass;
Sprite* sprite_input_elasticity;
Button* button_input_elasticity;
lalge::R2Vector input_elasticity_position;
bool invalid_input_elasticity;
InputString input_elasticity;
Text* text_input_elasticity;
Sprite* sprite_input_value;
Button* button_input_value;
lalge::R2Vector input_value_position;
bool invalid_input_value;
InputString input_value;
Text* text_input_value;
Button* button_time;
lalge::R2Vector button_time_position;
Button* button_point;
lalge::R2Vector button_point_position;
Button* button_life;
lalge::R2Vector button_life_position;
Button* button_mass;
lalge::R2Vector button_mass_position;
Button* button_barrier;
lalge::R2Vector button_barrier_position;
public:
PanelItem();
~PanelItem();
void show();
void hide();
void update();
void render();
private:
void updatePositions();
void handleInputMass(const observer::Event& event, bool& stop);
void handleInputMassButton(const observer::Event& event, bool& stop);
void handleInputElasticity(const observer::Event& event, bool& stop);
void handleInputElasticityButton(const observer::Event& event, bool& stop);
void handleInputValue(const observer::Event& event, bool& stop);
void handleInputValueButton(const observer::Event& event, bool& stop);
void handleTime(const observer::Event& event, bool& stop);
void handlePoint(const observer::Event& event, bool& stop);
void handleLife(const observer::Event& event, bool& stop);
void handleMass(const observer::Event& event, bool& stop);
void handleBarrier(const observer::Event& event, bool& stop);
};
#endif
| matheuscscp/nanotrip | src/PanelItem.hpp | C++ | mit | 1,943 |
namespace StarsReloaded.Client.ViewModel.Controls
{
using System;
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows;
using System.Windows.Input;
using GalaSoft.MvvmLight.CommandWpf;
using GalaSoft.MvvmLight.Messaging;
using StarsReloaded.Client.Mediation.Messages;
using StarsReloaded.Client.ViewModel.Attributes;
using StarsReloaded.Client.ViewModel.ModelWrappers;
using StarsReloaded.Shared.Model;
public class GalaxyMapPanelViewModel : BaseViewModel
{
#region Private fields
private Galaxy galaxy;
private PlanetWrapper selectedPlanet;
#endregion
#region Constructors
public GalaxyMapPanelViewModel()
{
Messenger.Default.Register<GameStateLoadedMessage>(this, this.OnGameStateLoaded);
this.MapClickCommand = new RelayCommand<MouseButtonEventArgs>(this.MapClick);
if (this.IsInDesignMode)
{
if (this.Galaxy == null)
{
this.Galaxy = DemoData.GenerateGameState().Galaxy;
}
this.MapClick(new Point { X = 50, Y = 50 });
}
}
#endregion
#region Public properties
[DependsUpon(nameof(Galaxy))]
public ObservableCollection<PlanetWrapper> Planets
=> this.Galaxy == null
? new ObservableCollection<PlanetWrapper>()
: new ObservableCollection<PlanetWrapper>(this.Galaxy.Planets.Select(p => new PlanetWrapper(p)));
public Galaxy Galaxy
{
get
{
return this.galaxy;
}
set
{
this.Set(() => this.Galaxy, ref this.galaxy, value);
this.SelectedPlanet = null;
}
}
public PlanetWrapper SelectedPlanet
{
private get
{
return this.selectedPlanet;
}
set
{
this.Set(() => this.SelectedPlanet, ref this.selectedPlanet, value);
Messenger.Default.Send(new PlanetSelectedMessage(value?.Model));
}
}
[DependsUpon(nameof(SelectedPlanet))]
public string SelectedObjectName => this.SelectedPlanet == null ? string.Empty : this.SelectedPlanet.Name;
[DependsUpon(nameof(SelectedPlanet))]
public string SelectedObjectCoords => this.SelectedPlanet == null ? string.Empty : $"[{this.SelectedPlanet.X},{this.SelectedPlanet.Y}]";
[DependsUpon(nameof(SelectedPlanet))]
public int SelectedObjectX => this.SelectedPlanet?.X ?? 0;
[DependsUpon(nameof(SelectedPlanet))]
public int SelectedObjectY => this.SelectedPlanet?.Y ?? 0;
[DependsUpon(nameof(SelectedPlanet))]
public Visibility SelectionArrowVisibility => this.SelectedPlanet != null ? Visibility.Visible : Visibility.Hidden;
[DependsUpon(nameof(Galaxy))]
public int GalaxyWidth => this.Galaxy?.Width ?? 0;
[DependsUpon(nameof(Galaxy))]
public int GalaxyHeight => this.Galaxy?.Height ?? 0;
#endregion
#region Commands
public RelayCommand<MouseButtonEventArgs> MapClickCommand { get; }
#endregion
#region Private methods
private void MapClick(MouseButtonEventArgs e)
{
this.MapClick(e.GetPosition(e.Source as IInputElement));
}
private void MapClick(Point p)
{
var closest = this.Galaxy.Planets.Aggregate(
(curClosest, pl) =>
{
if (curClosest == null)
{
return pl;
}
if (Math.Pow(p.X - pl.X, 2) + Math.Pow(p.Y - pl.Y, 2) < Math.Pow(p.X - curClosest.X, 2) + Math.Pow(p.Y - curClosest.Y, 2))
{
return pl;
}
return curClosest;
});
this.SelectedPlanet = new PlanetWrapper(closest);
}
private void OnGameStateLoaded(GameStateLoadedMessage message)
{
this.Galaxy = message.GameState.Galaxy;
}
#endregion
}
}
| Misza13/StarsReloaded | StarsReloaded.Client.ViewModel/Controls/GalaxyMapPanelViewModel.cs | C# | mit | 4,361 |
<?xml version="1.0" ?><!DOCTYPE TS><TS language="sq" version="2.1">
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About Vector</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+39"/>
<source><b>Vector</b> version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+41"/>
<source>Copyright © 2009-2014 The Bitcoin developers
Copyright © 2012-2014 The NovaCoin developers
Copyright © 2014 The Vector developers</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>
This is experimental software.
Distributed under the MIT/X11 software license, see the accompanying file COPYING or <a href="http://www.opensource.org/licenses/mit-license.php">http://www.opensource.org/licenses/mit-license.php</a>.
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (<a href="https://www.openssl.org/">https://www.openssl.org/</a>) and cryptographic software written by Eric Young (<a href="mailto:eay@cryptsoft.com">eay@cryptsoft.com</a>) and UPnP software written by Thomas Bernard.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AddressBookPage</name>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>Address Book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<source>Double-click to edit address or label</source>
<translation>Klikoni 2 herë për të ndryshuar adressën ose etiketën</translation>
</message>
<message>
<location line="+24"/>
<source>Create a new address</source>
<translation>Krijo një adresë të re</translation>
</message>
<message>
<location line="+10"/>
<source>Copy the currently selected address to the system clipboard</source>
<translation>Kopjo adresën e zgjedhur në memorjen e sistemit </translation>
</message>
<message>
<location line="-7"/>
<source>&New Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-43"/>
<source>These are your Vector addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+53"/>
<source>&Copy Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Show &QR Code</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Sign a message to prove you own a Vector address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Delete the currently selected address from the list</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-10"/>
<source>Verify a message to ensure it was signed with a specified Vector address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Verify Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>&Delete</source>
<translation>&Fshi</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="+66"/>
<source>Copy &Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>&Edit</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+248"/>
<source>Export Address Book Data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Skedar i ndarë me pikëpresje(*.csv)</translation>
</message>
<message>
<location line="+13"/>
<source>Error exporting</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AddressTableModel</name>
<message>
<location filename="../addresstablemodel.cpp" line="+145"/>
<source>Label</source>
<translation>Etiketë</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Adresë</translation>
</message>
<message>
<location line="+36"/>
<source>(no label)</source>
<translation>(pa etiketë)</translation>
</message>
</context>
<context>
<name>AskPassphraseDialog</name>
<message>
<location filename="../forms/askpassphrasedialog.ui" line="+26"/>
<source>Passphrase Dialog</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>Enter passphrase</source>
<translation>Futni frazkalimin</translation>
</message>
<message>
<location line="+14"/>
<source>New passphrase</source>
<translation>Frazkalim i ri</translation>
</message>
<message>
<location line="+14"/>
<source>Repeat new passphrase</source>
<translation>Përsërisni frazkalimin e ri</translation>
</message>
<message>
<location line="+33"/>
<source>Serves to disable the trivial sendmoney when OS account compromised. Provides no real security.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>For staking only</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../askpassphrasedialog.cpp" line="+38"/>
<source>Encrypt wallet</source>
<translation>Enkripto portofolin</translation>
</message>
<message>
<location line="+7"/>
<source>This operation needs your wallet passphrase to unlock the wallet.</source>
<translation>Ky veprim ka nevojë per frazkalimin e portofolit tuaj që të ç'kyç portofolin.</translation>
</message>
<message>
<location line="+5"/>
<source>Unlock wallet</source>
<translation>ç'kyç portofolin.</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to decrypt the wallet.</source>
<translation>Ky veprim kërkon frazkalimin e portofolit tuaj që të dekriptoj portofolin.</translation>
</message>
<message>
<location line="+5"/>
<source>Decrypt wallet</source>
<translation>Dekripto portofolin</translation>
</message>
<message>
<location line="+3"/>
<source>Change passphrase</source>
<translation>Ndrysho frazkalimin</translation>
</message>
<message>
<location line="+1"/>
<source>Enter the old and new passphrase to the wallet.</source>
<translation>Futni frazkalimin e vjetër dhe të ri në portofol. </translation>
</message>
<message>
<location line="+45"/>
<source>Confirm wallet encryption</source>
<translation>Konfirmoni enkriptimin e portofolit</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR COINS</b>!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Are you sure you wish to encrypt your wallet?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+103"/>
<location line="+24"/>
<source>Warning: The Caps Lock key is on!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-133"/>
<location line="+60"/>
<source>Wallet encrypted</source>
<translation>Portofoli u enkriptua</translation>
</message>
<message>
<location line="-140"/>
<source>Enter the new passphrase to the wallet.<br/>Please use a passphrase of <b>ten or more random characters</b>, or <b>eight or more words</b>.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+82"/>
<source>Vector will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your coins from being stolen by malware infecting your computer.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<location line="+7"/>
<location line="+44"/>
<location line="+6"/>
<source>Wallet encryption failed</source>
<translation>Enkriptimi i portofolit dështoi</translation>
</message>
<message>
<location line="-56"/>
<source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source>
<translation>Enkriptimi i portofolit dështoi për shkak të një gabimi të brëndshëm. portofoli juaj nuk u enkriptua.</translation>
</message>
<message>
<location line="+7"/>
<location line="+50"/>
<source>The supplied passphrases do not match.</source>
<translation>Frazkalimet e plotësuara nuk përputhen.</translation>
</message>
<message>
<location line="-38"/>
<source>Wallet unlock failed</source>
<translation>ç'kyçja e portofolit dështoi</translation>
</message>
<message>
<location line="+1"/>
<location line="+12"/>
<location line="+19"/>
<source>The passphrase entered for the wallet decryption was incorrect.</source>
<translation>Frazkalimi i futur për dekriptimin e portofolit nuk ishte i saktë.</translation>
</message>
<message>
<location line="-20"/>
<source>Wallet decryption failed</source>
<translation>Dekriptimi i portofolit dështoi</translation>
</message>
<message>
<location line="+14"/>
<source>Wallet passphrase was successfully changed.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>BitcoinGUI</name>
<message>
<location filename="../bitcoingui.cpp" line="+297"/>
<source>Sign &message...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-64"/>
<source>Show general overview of wallet</source>
<translation>Trego një përmbledhje te përgjithshme të portofolit</translation>
</message>
<message>
<location line="+17"/>
<source>&Transactions</source>
<translation>&Transaksionet</translation>
</message>
<message>
<location line="+1"/>
<source>Browse transaction history</source>
<translation>Shfleto historinë e transaksioneve</translation>
</message>
<message>
<location line="+5"/>
<source>&Address Book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Edit the list of stored addresses and labels</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-18"/>
<source>Show the list of addresses for receiving payments</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+34"/>
<source>E&xit</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Quit application</source>
<translation>Mbyllni aplikacionin</translation>
</message>
<message>
<location line="+4"/>
<source>Show information about Vector</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>About &Qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show information about Qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>&Options...</source>
<translation>&Opsione</translation>
</message>
<message>
<location line="+4"/>
<source>&Encrypt Wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>&Backup Wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>&Change Passphrase...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>&Export...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-55"/>
<source>Send coins to a Vector address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+39"/>
<source>Modify configuration options for Vector</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Export the data in the current tab to a file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-13"/>
<source>Encrypt or decrypt wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Backup wallet to another location</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Change the passphrase used for wallet encryption</source>
<translation>Ndrysho frazkalimin e përdorur per enkriptimin e portofolit</translation>
</message>
<message>
<location line="+10"/>
<source>&Debug window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Open debugging and diagnostic console</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-5"/>
<source>&Verify message...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-214"/>
<location line="+555"/>
<source>Vector</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-555"/>
<source>Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+193"/>
<source>&About Vector</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>&Show / Hide</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Unlock wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>&Lock Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Lock wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+32"/>
<source>&File</source>
<translation>&Skedar</translation>
</message>
<message>
<location line="+8"/>
<source>&Settings</source>
<translation>&Konfigurimet</translation>
</message>
<message>
<location line="+8"/>
<source>&Help</source>
<translation>&Ndihmë</translation>
</message>
<message>
<location line="+17"/>
<source>Tabs toolbar</source>
<translation>Shiriti i mjeteve</translation>
</message>
<message>
<location line="+46"/>
<location line="+9"/>
<source>[testnet]</source>
<translation>[testo rrjetin]</translation>
</message>
<message>
<location line="+0"/>
<location line="+58"/>
<source>Vector client</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+70"/>
<source>%n active connection(s) to Vector network</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+488"/>
<source>Staking.<br>Your weight is %1<br>Network weight is %2<br>Expected time to earn reward is %3</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Not staking because wallet is locked</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Not staking because wallet is offline</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Not staking because wallet is syncing</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Not staking because you don't have mature coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-812"/>
<source>&Dashboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>&Receive</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>&Send</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+49"/>
<source>&Unlock Wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+277"/>
<source>Up to date</source>
<translation>I azhornuar</translation>
</message>
<message>
<location line="+43"/>
<source>Catching up...</source>
<translation>Duke u azhornuar...</translation>
</message>
<message>
<location line="+113"/>
<source>Confirm transaction fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Sent transaction</source>
<translation>Dërgo transaksionin</translation>
</message>
<message>
<location line="+1"/>
<source>Incoming transaction</source>
<translation>Transaksion në ardhje</translation>
</message>
<message>
<location line="+1"/>
<source>Date: %1
Amount: %2
Type: %3
Address: %4
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+100"/>
<location line="+15"/>
<source>URI handling</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-15"/>
<location line="+15"/>
<source>URI can not be parsed! This can be caused by an invalid Vector address or malformed URI parameters.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Wallet is <b>not encrypted</b></source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source>
<translation>Portofoli po <b> enkriptohet</b> dhe është <b> i ç'kyçur</b></translation>
</message>
<message>
<location line="+8"/>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation>Portofoli po <b> enkriptohet</b> dhe është <b> i kyçur</b></translation>
</message>
<message>
<location line="+24"/>
<source>Backup Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Wallet Data (*.dat)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Backup Failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>There was an error trying to save the wallet data to the new location.</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+91"/>
<source>%n second(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n minute(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="-429"/>
<location line="+433"/>
<source>%n hour(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="-456"/>
<source>Processed %1 blocks of transaction history.</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+27"/>
<location line="+433"/>
<source>%n day(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="-429"/>
<location line="+6"/>
<source>%n week(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+0"/>
<source>%1 and %2</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+0"/>
<source>%n year(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+5"/>
<source>%1 behind</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Last received block was generated %1 ago.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Transactions after this will not yet be visible.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Error</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+69"/>
<source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+324"/>
<source>Not staking</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../bitcoin.cpp" line="+104"/>
<source>A fatal error occurred. Vector can no longer continue safely and will quit.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>ClientModel</name>
<message>
<location filename="../clientmodel.cpp" line="+110"/>
<source>Network Alert</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>CoinControlDialog</name>
<message>
<location filename="../forms/coincontroldialog.ui" line="+14"/>
<source>Coin Control</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Quantity:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+32"/>
<source>Bytes:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+48"/>
<source>Amount:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+32"/>
<source>Priority:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+48"/>
<source>Fee:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Low Output:</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../coincontroldialog.cpp" line="+537"/>
<source>no</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../forms/coincontroldialog.ui" line="+51"/>
<source>After Fee:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Change:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+69"/>
<source>(un)select all</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Tree mode</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>List mode</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+45"/>
<source>Amount</source>
<translation>Sasia</translation>
</message>
<message>
<location line="+5"/>
<source>Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Address</source>
<translation>Adresë</translation>
</message>
<message>
<location line="+5"/>
<source>Date</source>
<translation>Data</translation>
</message>
<message>
<location line="+5"/>
<source>Confirmations</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Confirmed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Priority</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../coincontroldialog.cpp" line="-500"/>
<source>Copy address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<location line="+26"/>
<source>Copy amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-25"/>
<source>Copy transaction ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>Copy quantity</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Copy fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy after fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy bytes</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy priority</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy low output</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy change</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+317"/>
<source>highest</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>high</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>medium-high</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>medium</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>low-medium</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>low</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>lowest</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+140"/>
<source>DUST</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>yes</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>This label turns red, if the transaction size is bigger than 10000 bytes.
This means a fee of at least %1 per kb is required.
Can vary +/- 1 Byte per input.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transactions with higher priority get more likely into a block.
This label turns red, if the priority is smaller than "medium".
This means a fee of at least %1 per kb is required.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This label turns red, if any recipient receives an amount smaller than %1.
This means a fee of at least %2 is required.
Amounts below 0.546 times the minimum relay fee are shown as DUST.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This label turns red, if the change is smaller than %1.
This means a fee of at least %2 is required.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+36"/>
<location line="+66"/>
<source>(no label)</source>
<translation>(pa etiketë)</translation>
</message>
<message>
<location line="-9"/>
<source>change from %1 (%2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>(change)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>EditAddressDialog</name>
<message>
<location filename="../forms/editaddressdialog.ui" line="+14"/>
<source>Edit Address</source>
<translation>Ndrysho Adresën</translation>
</message>
<message>
<location line="+11"/>
<source>&Label</source>
<translation>&Etiketë</translation>
</message>
<message>
<location line="+10"/>
<source>The label associated with this address book entry</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Address</source>
<translation>&Adresa</translation>
</message>
<message>
<location line="+10"/>
<source>The address associated with this address book entry. This can only be modified for sending addresses.</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../editaddressdialog.cpp" line="+21"/>
<source>New receiving address</source>
<translation>Adresë e re pritëse</translation>
</message>
<message>
<location line="+4"/>
<source>New sending address</source>
<translation>Adresë e re dërgimi</translation>
</message>
<message>
<location line="+3"/>
<source>Edit receiving address</source>
<translation>Ndrysho adresën pritëse</translation>
</message>
<message>
<location line="+4"/>
<source>Edit sending address</source>
<translation>ndrysho adresën dërguese</translation>
</message>
<message>
<location line="+76"/>
<source>The entered address "%1" is already in the address book.</source>
<translation>Adresa e dhënë "%1" është e zënë në librin e adresave. </translation>
</message>
<message>
<location line="-5"/>
<source>The entered address "%1" is not a valid Vector address.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Could not unlock wallet.</source>
<translation>Nuk mund të ç'kyçet portofoli.</translation>
</message>
<message>
<location line="+5"/>
<source>New key generation failed.</source>
<translation>Krijimi i çelësit të ri dështoi.</translation>
</message>
</context>
<context>
<name>GUIUtil::HelpMessageBox</name>
<message>
<location filename="../guiutil.cpp" line="+426"/>
<location line="+12"/>
<source>Vector-Qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-12"/>
<source>version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Usage:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>command-line options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>UI options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set language, for example "de_DE" (default: system locale)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Start minimized</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show splash screen on startup (default: 1)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>OptionsDialog</name>
<message>
<location filename="../forms/optionsdialog.ui" line="+14"/>
<source>Options</source>
<translation>Opsionet</translation>
</message>
<message>
<location line="+16"/>
<source>&Main</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB. Fee 0.01 recommended.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Pay transaction &fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Reserved amount does not participate in staking and is therefore spendable at any time.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Reserve</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Automatically start Vector after logging in to the system.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Start Vector on system login</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>&Network</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Automatically open the Vector client port on the router. This only works when your router supports UPnP and it is enabled.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Map port using &UPnP</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Proxy &IP:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>IP address of the proxy (e.g. 127.0.0.1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Port:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Port of the proxy (e.g. 9050)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-57"/>
<source>Connect to the Vector network through a SOCKS5 proxy (e.g. when connecting through Tor).</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Connect through SOCKS5 proxy:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+90"/>
<source>&Window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Show only a tray icon after minimizing the window.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Minimize to the tray instead of the taskbar</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>M&inimize on close</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>&Display</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>User Interface &language:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>The user interface language can be set here. This setting will take effect after restarting Vector.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>&Unit to show amounts in:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Choose the default subdivision unit to show in the interface and when sending coins.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Whether to show coin control features or not.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Display coin &control features (experts only!)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Whether to select the coin outputs randomly or with minimal coin age.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Minimize weight consumption (experimental)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Use black visual theme (requires restart)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+71"/>
<source>&OK</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Cancel</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>&Apply</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../optionsdialog.cpp" line="+47"/>
<source>default</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+148"/>
<location line="+9"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-9"/>
<location line="+9"/>
<source>This setting will take effect after restarting Vector.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>The supplied proxy address is invalid.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>OverviewPage</name>
<message>
<location filename="../forms/overviewpage.ui" line="+14"/>
<source>Form</source>
<translation>Formilarë</translation>
</message>
<message>
<location line="+46"/>
<location line="+247"/>
<source>The displayed information may be out of date. Your wallet automatically synchronizes with the Vector network after a connection is established, but this process has not completed yet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-173"/>
<source>Stake:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+32"/>
<source>Unconfirmed:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-113"/>
<source>Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+49"/>
<source>Spendable:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Your current spendable balance</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+80"/>
<source>Immature:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Mined balance that has not yet matured</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Total:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Your current total balance</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+50"/>
<source><b>Recent transactions</b></source>
<translation><b>Transaksionet e fundit</b></translation>
</message>
<message>
<location line="-118"/>
<source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-32"/>
<source>Total of coins that was staked, and do not yet count toward the current balance</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../overviewpage.cpp" line="+116"/>
<location line="+1"/>
<source>out of sync</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>PaymentServer</name>
<message>
<location filename="../paymentserver.cpp" line="+107"/>
<source>Cannot start vector: click-to-pay handler</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>QRCodeDialog</name>
<message>
<location filename="../forms/qrcodedialog.ui" line="+14"/>
<source>QR Code Dialog</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>Request Payment</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+56"/>
<source>Amount:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-44"/>
<source>Label:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Message:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+71"/>
<source>&Save As...</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../qrcodedialog.cpp" line="+62"/>
<source>Error encoding URI into QR Code.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+40"/>
<source>The entered amount is invalid, please check.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Resulting URI too long, try to reduce the text for label / message.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Save QR Code</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>PNG Images (*.png)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>RPCConsole</name>
<message>
<location filename="../forms/rpcconsole.ui" line="+46"/>
<source>Client name</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<location line="+23"/>
<location line="+26"/>
<location line="+23"/>
<location line="+23"/>
<location line="+36"/>
<location line="+53"/>
<location line="+23"/>
<source>N/A</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-194"/>
<source>Client version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-45"/>
<source>&Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+68"/>
<source>Using OpenSSL version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+49"/>
<source>Startup time</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>Network</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Number of connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>On testnet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Block chain</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Current number of blocks</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+197"/>
<source>&Network Traffic</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+52"/>
<source>&Clear</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Totals</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+64"/>
<source>In:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+80"/>
<source>Out:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-383"/>
<source>Last block time</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+52"/>
<source>&Open</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Command-line options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Show the Vector-Qt help message to get a list with possible Vector command-line options.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Show</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>&Console</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-237"/>
<source>Build date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-104"/>
<source>Vector - Debug window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Vector Core</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+256"/>
<source>Debug log file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Open the Vector debug log file from the current data directory. This can take a few seconds for large log files.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+102"/>
<source>Clear console</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../rpcconsole.cpp" line="+325"/>
<source>Welcome to the Vector RPC console.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Type <b>help</b> for an overview of available commands.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+127"/>
<source>%1 B</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1 KB</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1 MB</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1 GB</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>%1 m</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>%1 h</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1 h %2 m</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SendCoinsDialog</name>
<message>
<location filename="../forms/sendcoinsdialog.ui" line="+14"/>
<location filename="../sendcoinsdialog.cpp" line="+182"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+6"/>
<location line="+5"/>
<location line="+5"/>
<source>Send Coins</source>
<translation>Dërgo Monedha</translation>
</message>
<message>
<location line="+76"/>
<source>Coin Control Features</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+20"/>
<source>Inputs...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>automatically selected</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Insufficient funds!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+77"/>
<source>Quantity:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<location line="+35"/>
<source>0</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-19"/>
<source>Bytes:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+51"/>
<source>Amount:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Priority:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>medium</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+32"/>
<source>Fee:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Low Output:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>no</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+32"/>
<source>After Fee:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Change</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+50"/>
<source>custom change address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+106"/>
<source>Send to multiple recipients at once</source>
<translation>Dërgo marrësve të ndryshëm njëkohësisht</translation>
</message>
<message>
<location line="+3"/>
<source>Add &Recipient</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Remove all transaction fields</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Clear &All</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>Balance:</source>
<translation>Balanca:</translation>
</message>
<message>
<location line="+47"/>
<source>Confirm the send action</source>
<translation>Konfirmo veprimin e dërgimit</translation>
</message>
<message>
<location line="+3"/>
<source>S&end</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../sendcoinsdialog.cpp" line="-174"/>
<source>Enter a Vector address (e.g. B8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Copy quantity</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy after fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy bytes</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy priority</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy low output</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy change</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+87"/>
<source><b>%1</b> to %2 (%3)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Confirm send coins</source>
<translation>konfirmo dërgimin e monedhave</translation>
</message>
<message>
<location line="+1"/>
<source>Are you sure you want to send %1?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source> and </source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>The recipient address is not valid, please recheck.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The amount to pay must be larger than 0.</source>
<translation>Shuma e paguar duhet të jetë më e madhe se 0.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount exceeds your balance.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The total exceeds your balance when the %1 transaction fee is included.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Duplicate address found, can only send to each address once per send operation.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: Transaction creation failed!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+247"/>
<source>WARNING: Invalid Vector address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>(no label)</source>
<translation>(pa etiketë)</translation>
</message>
<message>
<location line="+4"/>
<source>WARNING: unknown change address</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SendCoinsEntry</name>
<message>
<location filename="../forms/sendcoinsentry.ui" line="+14"/>
<source>Form</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>A&mount:</source>
<translation>Sh&uma:</translation>
</message>
<message>
<location line="+13"/>
<source>Pay &To:</source>
<translation>Paguaj &drejt:</translation>
</message>
<message>
<location line="+34"/>
<source>The address to send the payment to (e.g. B8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+60"/>
<location filename="../sendcoinsentry.cpp" line="+26"/>
<source>Enter a label for this address to add it to your address book</source>
<translation>Krijoni një etiketë për këtë adresë që t'ja shtoni librit të adresave</translation>
</message>
<message>
<location line="-78"/>
<source>&Label:</source>
<translation>&Etiketë:</translation>
</message>
<message>
<location line="+28"/>
<source>Choose address from address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="+7"/>
<source>Paste address from clipboard</source>
<translation>Ngjit nga memorja e sistemit</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+7"/>
<source>Remove this recipient</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../sendcoinsentry.cpp" line="+1"/>
<source>Enter a Vector address (e.g. B8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SignVerifyMessageDialog</name>
<message>
<location filename="../forms/signverifymessagedialog.ui" line="+14"/>
<source>Signatures - Sign / Verify a Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<location line="+124"/>
<source>&Sign Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-118"/>
<source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>The address to sign the message with (e.g. B8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<location line="+203"/>
<source>Choose an address from the address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-193"/>
<location line="+203"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="-193"/>
<source>Paste address from clipboard</source>
<translation>Ngjit nga memorja e sistemit</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+12"/>
<source>Enter the message you want to sign here</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>Copy the current signature to the system clipboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>Sign the message to prove you own this Vector address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Reset all sign message fields</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<location line="+146"/>
<source>Clear &All</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-87"/>
<location line="+70"/>
<source>&Verify Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-64"/>
<source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>The address the message was signed with (e.g. B8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+40"/>
<source>Verify the message to ensure it was signed with the specified Vector address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Reset all verify message fields</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../signverifymessagedialog.cpp" line="+27"/>
<location line="+3"/>
<source>Enter a Vector address (e.g. B8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>Click "Sign Message" to generate signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Enter Vector signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+85"/>
<location line="+81"/>
<source>The entered address is invalid.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-81"/>
<location line="+8"/>
<location line="+73"/>
<location line="+8"/>
<source>Please check the address and try again.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-81"/>
<location line="+81"/>
<source>The entered address does not refer to a key.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-73"/>
<source>Wallet unlock was cancelled.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Private key for the entered address is not available.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Message signing failed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Message signed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>The signature could not be decoded.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<location line="+13"/>
<source>Please check the signature and try again.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>The signature did not match the message digest.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Message verification failed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Message verified.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TrafficGraphWidget</name>
<message>
<location filename="../trafficgraphwidget.cpp" line="+75"/>
<source>KB/s</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionDesc</name>
<message>
<location filename="../transactiondesc.cpp" line="+25"/>
<source>Open until %1</source>
<translation>Hapur deri më %1</translation>
</message>
<message>
<location line="+6"/>
<source>conflicted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1/offline</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1/unconfirmed</source>
<translation>%1/I pakonfirmuar</translation>
</message>
<message>
<location line="+2"/>
<source>%1 confirmations</source>
<translation>%1 konfirmimet</translation>
</message>
<message>
<location line="+17"/>
<source>Status</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+7"/>
<source>, broadcast through %n node(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>Date</source>
<translation>Data</translation>
</message>
<message>
<location line="+7"/>
<source>Source</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Generated</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<location line="+13"/>
<source>From</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<location line="+19"/>
<location line="+58"/>
<source>To</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-74"/>
<location line="+2"/>
<source>own address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+34"/>
<location line="+12"/>
<location line="+45"/>
<location line="+17"/>
<location line="+30"/>
<source>Credit</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="-102"/>
<source>matures in %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+2"/>
<source>not accepted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+44"/>
<location line="+8"/>
<location line="+15"/>
<location line="+30"/>
<source>Debit</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-39"/>
<source>Transaction fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Net amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Comment</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Transaction ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Generated coins must mature 510 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to "not accepted" and it won't be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Debug information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Transaction</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Inputs</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>Amount</source>
<translation>Sasia</translation>
</message>
<message>
<location line="+1"/>
<source>true</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>false</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-202"/>
<source>, has not been successfully broadcast yet</source>
<translation>, nuk është transmetuar me sukses deri tani</translation>
</message>
<message numerus="yes">
<location line="-36"/>
<source>Open for %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+67"/>
<source>unknown</source>
<translation>i/e panjohur</translation>
</message>
</context>
<context>
<name>TransactionDescDialog</name>
<message>
<location filename="../forms/transactiondescdialog.ui" line="+14"/>
<source>Transaction details</source>
<translation>Detajet e transaksionit</translation>
</message>
<message>
<location line="+6"/>
<source>This pane shows a detailed description of the transaction</source>
<translation>Ky panel tregon një përshkrim të detajuar të transaksionit</translation>
</message>
</context>
<context>
<name>TransactionTableModel</name>
<message>
<location filename="../transactiontablemodel.cpp" line="+231"/>
<source>Date</source>
<translation>Data</translation>
</message>
<message>
<location line="+0"/>
<source>Type</source>
<translation>Lloji</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Adresë</translation>
</message>
<message>
<location line="+0"/>
<source>Amount</source>
<translation>Sasia</translation>
</message>
<message>
<location line="+52"/>
<source>Open until %1</source>
<translation>Hapur deri më %1</translation>
</message>
<message>
<location line="+12"/>
<source>Confirmed (%1 confirmations)</source>
<translation>I/E konfirmuar(%1 konfirmime)</translation>
</message>
<message numerus="yes">
<location line="-15"/>
<source>Open for %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+6"/>
<source>Offline</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Unconfirmed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Confirming (%1 of %2 recommended confirmations)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Conflicted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Immature (%1 confirmations, will be available after %2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>This block was not received by any other nodes and will probably not be accepted!</source>
<translation>Ky bllok është marrë nga ndonjë nyje dhe ka shumë mundësi të mos pranohet! </translation>
</message>
<message>
<location line="+3"/>
<source>Generated but not accepted</source>
<translation>I krijuar por i papranuar</translation>
</message>
<message>
<location line="+42"/>
<source>Received with</source>
<translation>Marrë me</translation>
</message>
<message>
<location line="+2"/>
<source>Received from</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Sent to</source>
<translation>Dërguar drejt</translation>
</message>
<message>
<location line="+2"/>
<source>Payment to yourself</source>
<translation>Pagesë ndaj vetvetes</translation>
</message>
<message>
<location line="+2"/>
<source>Mined</source>
<translation>Minuar</translation>
</message>
<message>
<location line="+38"/>
<source>(n/a)</source>
<translation>(p/a)</translation>
</message>
<message>
<location line="+194"/>
<source>Transaction status. Hover over this field to show number of confirmations.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Date and time that the transaction was received.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Type of transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Destination address of transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Amount removed from or added to balance.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionView</name>
<message>
<location filename="../transactionview.cpp" line="+54"/>
<location line="+17"/>
<source>All</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-16"/>
<source>Today</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This week</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This month</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Last month</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This year</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Range...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Received with</source>
<translation>Marrë me</translation>
</message>
<message>
<location line="+2"/>
<source>Sent to</source>
<translation>Dërguar drejt</translation>
</message>
<message>
<location line="+2"/>
<source>To yourself</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Mined</source>
<translation>Minuar</translation>
</message>
<message>
<location line="+1"/>
<source>Other</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Enter address or label to search</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Min amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+34"/>
<source>Copy address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy transaction ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Edit label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show transaction details</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+138"/>
<source>Export Transaction Data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Skedar i ndarë me pikëpresje(*.csv)</translation>
</message>
<message>
<location line="+8"/>
<source>Confirmed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Date</source>
<translation>Data</translation>
</message>
<message>
<location line="+1"/>
<source>Type</source>
<translation>Lloji</translation>
</message>
<message>
<location line="+1"/>
<source>Label</source>
<translation>Etiketë</translation>
</message>
<message>
<location line="+1"/>
<source>Address</source>
<translation>Adresë</translation>
</message>
<message>
<location line="+1"/>
<source>Amount</source>
<translation>Sasia</translation>
</message>
<message>
<location line="+1"/>
<source>ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error exporting</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+100"/>
<source>Range:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>to</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>WalletModel</name>
<message>
<location filename="../walletmodel.cpp" line="+212"/>
<source>Sending...</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>bitcoin-core</name>
<message>
<location filename="../bitcoinstrings.cpp" line="+171"/>
<source>Vector version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Usage:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Send command to -server or vectord</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>List commands</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Get help for a command</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-145"/>
<source>Options:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Specify configuration file (default: vector.conf)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Specify pid file (default: vectord.pid)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Specify wallet file (within data directory)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Specify data directory</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-25"/>
<source>%s, you must set a rpcpassword in the configuration file:
%s
It is recommended you use the following random password:
rpcuser=vectorrpc
rpcpassword=%s
(you do not need to remember this password)
The username and password MUST NOT be the same.
If the file does not exist, create it with owner-readable-only file permissions.
It is also recommended to set alertnotify so you are notified of problems;
for example: alertnotify=echo %%s | mail -s "Vector Alert" admin@foo.com
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Set database cache size in megabytes (default: 25)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set database disk log size in megabytes (default: 100)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Listen for connections on <port> (default: 1715 or testnet: 11715)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Maintain at most <n> connections to peers (default: 125)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Connect to a node to retrieve peer addresses, and disconnect</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Specify your own public address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Bind to given address. Use [host]:port notation for IPv6</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Query for peer addresses via DNS lookup, if low on addresses (default: 1 unless -connect)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Always query for peer addresses via DNS lookup (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Threshold for disconnecting misbehaving peers (default: 100)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-35"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+62"/>
<source>Listen for JSON-RPC connections on <port> (default: 1716 or testnet: 11716)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-16"/>
<source>Accept command line and JSON-RPC commands</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Run in the background as a daemon and accept commands</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Use the test network</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-23"/>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-28"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+93"/>
<source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-103"/>
<source>Warning: Please check that your computer's date and time are correct! If your clock is wrong Vector will not work properly.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+130"/>
<source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-16"/>
<source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-34"/>
<source>Attempt to recover private keys from a corrupt wallet.dat</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Block creation options:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-67"/>
<source>Connect only to the specified node(s)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Discover own IP address (default: 1 when listening and no -externalip)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+101"/>
<source>Failed to listen on any port. Use -listen=0 if you want this.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>Invalid -tor address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Invalid amount for -reservebalance=<amount></source>
<translation type="unfinished"/>
</message>
<message>
<location line="-89"/>
<source>Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-16"/>
<source>Only connect to nodes in network <net> (IPv4, IPv6 or Tor)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+30"/>
<source>Prepend debug output with timestamp</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+40"/>
<source>SSL options: (see the Bitcoin Wiki for SSL setup instructions)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-38"/>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+34"/>
<source>Set maximum block size in bytes (default: 250000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Set minimum block size in bytes (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-34"/>
<source>Shrink debug.log file on client startup (default: 1 when no -debug)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-41"/>
<source>Specify connection timeout in milliseconds (default: 5000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>Use UPnP to map the listening port (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Use UPnP to map the listening port (default: 1 when listening)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-25"/>
<source>Use proxy to reach tor hidden services (default: same as -proxy)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+45"/>
<source>Username for JSON-RPC connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+54"/>
<source>Verifying database integrity...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+42"/>
<source>Error: Wallet locked, unable to create transaction!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Error: Transaction creation failed!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Warning: This version is obsolete, upgrade required!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-52"/>
<source>wallet.dat corrupt, salvage failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-59"/>
<source>Password for JSON-RPC connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-47"/>
<source>Connect through SOCKS5 proxy</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Sync time with other nodes. Disable if time on your system is precise e.g. syncing with NTP (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>When creating transactions, ignore inputs with value less than this (default: 0.01)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Output debugging information (default: 0, supplying <category> is optional)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>If <category> is not supplied, output all debugging information.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source><category> can be:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Enter regression test mode, which uses a special chain in which blocks can be solved instantly. This is intended for regression testing tools and app development.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Allow JSON-RPC connections from specified IP address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Send commands to node running on <ip> (default: 127.0.0.1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Wait for RPC server to start</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set the number of threads to service RPC calls (default: 4)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Require a confirmations for change (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Upgrade wallet to latest format</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set key pool size to <n> (default: 100)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Rescan the block chain for missing wallet transactions</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>How thorough the block verification is (0-6, default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Imports blocks from external VEC000?.dat file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Keep at most <n> MiB of unconnectable blocks in memory (default: %u)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Use OpenSSL (https) for JSON-RPC connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Server certificate file (default: server.cert)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Server private key (default: server.pem)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: Unsupported argument -socks found. Setting SOCKS version isn't possible anymore, only SOCKS5 proxies are supported.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Initialization sanity check failed. Vector is shutting down.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+20"/>
<source>Error loading block database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>Error: Wallet unlocked for staking only, unable to create transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Error: Disk space is low!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This is a pre-release test build - use at your own risk - do not use for mining or merchant applications</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-168"/>
<source>This help message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+104"/>
<source>Wallet %s resides outside data directory %s.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Unable to bind to %s on this computer (bind returned error %d, %s)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-129"/>
<source>Allow DNS lookups for -addnode, -seednode and -connect</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+125"/>
<source>Loading addresses...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-10"/>
<source>Error loading wallet.dat: Wallet corrupted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error loading wallet.dat: Wallet requires newer version of Vector</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Wallet needed to be rewritten: restart Vector to complete</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error loading wallet.dat</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-15"/>
<source>Invalid -proxy address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Unknown network specified in -onlynet: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Cannot resolve -bind address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Cannot resolve -externalip address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-22"/>
<source>Invalid amount for -paytxfee=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+58"/>
<source>Sending...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Invalid amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Insufficient funds</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-40"/>
<source>Loading block index...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-109"/>
<source>Add a node to connect to and attempt to keep the connection open</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+124"/>
<source>Unable to bind to %s on this computer. Vector is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-101"/>
<source>Fee per KB to add to transactions you send</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+33"/>
<source>Minimize weight consumption (experimental) (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>How many blocks to check at startup (default: 500, 0 = all)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Acceptable ciphers (default: TLSv1.2+HIGH:TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!3DES:@STRENGTH)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning: Deprecated argument -debugnet ignored, use -debug=net</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Invalid amount for -mininput=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Cannot obtain a lock on data directory %s. Vector is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error initializing wallet database environment %s!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Loading wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Cannot downgrade wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Cannot write default address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Rescanning...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Done loading</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-159"/>
<source>To use the %s option</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+186"/>
<source>Error</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-18"/>
<source>You must set rpcpassword=<password> in the configuration file:
%s
If the file does not exist, create it with owner-readable-only file permissions.</source>
<translation type="unfinished"/>
</message>
</context>
</TS> | vectorcoindev/Vector | src/qt/locale/bitcoin_sq.ts | TypeScript | mit | 110,078 |
class DataControl {
constructor() {
this.appData
updateData()
}
updateData() {
this.appData = fetcherama()
}
fetcherama() {
lib.fetch(`http://localhost:8080/api/class/getNearbyClasses/${coor.long}/${coor.lat}`, opt, data => {
if (data.success === true) {
return data.classes
}
})
}
}
export default DataControl
| andrewgremlich/presence-keeper | pk_static_files_server/app/js/util/DataControl.js | JavaScript | mit | 369 |
<?php
if(!defined('ROOT')) exit('No direct script access allowed');
$dashboard=getConfig("DASHBOARD_PAGE");
?>
<div id="workspace" style='display:none;overflow:hidden;width: 100%;height: 100%;'>
<ul>
<?php if(strlen($dashboard)>0) { ?>
<li><a href='#dashboard'>Dashboard</a></li>
<?php } ?>
</ul>
<?php if(strlen($dashboard)>0) { ?>
<div id="dashboard" class="unclosable" style="overflow:hidden;width:100%;height:100%;">
<iframe id="dashboardframe" src="<?=generatePageRequest($dashboard,"")?>" style="width:100%;height:100%;margin:0px;padding:0px;" frameborder=0>
</iframe>
</div>
<?php } ?>
</div>
<a class='workspaceclose' onclick="closeCurrentTab()"> X</a>
<script language=javascript>
var $tabs=null;
var resizePageTimer=null;
var sitepath="<?=generatePageRequest("","")?>";
function resizePageUI() {
$("#dashboard").css("height",($("#content").height()-28)+"px");
$("#workspace .iframetab").css("height",$("#dashboard").height());
}
$(function() {
$(window).bind('resize', function() {
if (resizePageTimer) {
clearTimeout(resizePageTimer);
}
resizePageTimer=setTimeout(resizePageUI, 100);
});
setTimeout(function() {
resizePageUI();
$("#workspace").show();
}, 120);
$tabs = $("#workspace").tabs({
ajaxOptions:{
beforeSend:function() {
return false;
},
},
tabTemplate: "<li><a class='tabref' href='x' rel='#{href}'>#{label}</a> <span class='ui-icon ui-icon-closethick'>Remove Tab</span></li>",
spinner: 'Loading ...',
//fx: {},//opacity: 'toggle'
crossDomain:false,
cache:true,
add: function( event, ui ) {
//$( ui.panel ).append( "<p>" + tab_content + "</p>" );
$tabs.tabs('select', '#' + ui.panel.id);
loadTabFrame('#' + ui.panel.id,$("#workspace .tabref[href=#"+ui.panel.id+"]").attr("rel"));
},
select: function(event, ui) {
var url = $.data(ui.tab, 'load.tabs');
return true;
},
load: function(event, ui) {
//Keep links, form submissions, etc. contained within the tab
//$(ui.panel).hijack();
return false;
}
});
//$tabs.find( ".ui-tabs-nav" ).sortable({ axis: "x" }).disableSelection();
$("#workspace").delegate("span.ui-icon-close,span.ui-icon-closethick","click",function() {
var index = $( "li", $tabs ).index( $( this ).parent() );
closeTab(index);
});
});
function indexOfTab(url) {
var links = $("#workspace > ul").find("li a");
for(i=0;i<links.length;i++) {
var lnk = $.data(links[i], 'load.tabs');
if(lnk==url) return i;
}
return -1;
}
function closeTab(index) {
if(!$($tabs.find(">div")[index]).hasClass("unclosable")) {
$tabs.tabs("remove",index);
return true;
} else {
return false;
}
//if(index==0) return false;
//$tabs.tabs( "remove",index);
}
function closeCurrentTab() {
var n = $tabs.tabs('option', 'selected');
closeTab(n);
}
function openInNewTab(title, url) {
if(indexOfTab(url)>=0) {
$tabs.tabs("select",indexOfTab(url));
return;
}
if(!(url.indexOf("http:")>=0) && !(url.indexOf("https:")>=0)) {
if(!(url.indexOf("?")>=0)) {
url=sitepath+"&"+url;
} else {
url=SiteLocation+url;
}
}
$tabs.tabs("add", url, title );
$("a.tabref").click(function(event) {
loadTabFrame($(this).attr("href"),$(this).attr("rel"));
});
$("#workspace div.ui-tabs-panel").each(function() {
if($(this).html().length<=0) $(this).detach();
});
}
function openInCurrentTab(url) {
var n = $tabs.tabs('option', 'selected');
$tabs.tabs("url", n,url);
$tabs.tabs("load", n);
$tabs.tabs("select",n);
}
function loadTabFrame(tab, url) {
if ($(tab).find("iframe").length == 0) {
var html = [];
//html.push('<div class="tabIframeWrapper">');
html.push('<iframe class="iframetab" src="' + url + '" width=100% height=100% frameborder=0 style="padding:0px;border:0px;">Load Failed?</iframe>');
//html.push('</div>');
$(tab).append(html.join(""));
$(tab).find("iframe").height($("#dashboard").height());
}
return false;
}
</script>
<style>
.iframetab {
width:100%;
border:0px;
margin:0px;
padding:0px;
margin-top:0px;
}
#workspace div.ui-tabs-panel.ui-widget-content {
border:0px;
}
</style>
| LogiksPlugins/tabbedspace | index.php | PHP | mit | 4,102 |
package cn.cloudself.dao;
import cn.cloudself.model.AppJiyoujiaHeadEntity;
import cn.cloudself.model.IntegerEntity;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.Repository;
import java.util.List;
/**
* @author HerbLuo
* @version 1.0.0.d
* <p>
* change logs:
* 2017/5/19 HerbLuo 首次创建
*/
public interface IAppJiyoujiaHeadDao extends Repository<AppJiyoujiaHeadEntity, Integer> {
List<AppJiyoujiaHeadEntity> getDoubleColumn(int start, int length);
/**
* Max of 各类型(type 放置于左边还是右边)的记录数
* 如:type为0的记录数有3个,type为1的记录数有4个,返回结果就为4
*/
IntegerEntity maxCountOfDoubleColumn();
Page<AppJiyoujiaHeadEntity> findByType(byte type, Pageable pageable);
}
| HerbLuo/shop-api | src/main/java/cn/cloudself/dao/IAppJiyoujiaHeadDao.java | Java | mit | 887 |
#include "signverifymessagedialog.h"
#include "ui_signverifymessagedialog.h"
#include "addressbookpage.h"
#include "base58.h"
#include "guiutil.h"
#include "init.h"
#include "main.h"
#include "optionsmodel.h"
#include "walletmodel.h"
#include "wallet.h"
#include <string>
#include <vector>
#include <QClipboard>
SignVerifyMessageDialog::SignVerifyMessageDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::SignVerifyMessageDialog),
model(0)
{
ui->setupUi(this);
#if (QT_VERSION >= 0x040700)
/* Do not move this to the XML file, Qt before 4.7 will choke on it */
ui->addressIn_SM->setPlaceholderText(tr("Enter a Synapse address (e.g. XsyikK1pALjkLwYTnJSJMu2VHUmP5nJWfR)"));
ui->signatureOut_SM->setPlaceholderText(tr("Click \"Sign Message\" to generate signature"));
ui->addressIn_VM->setPlaceholderText(tr("Enter a Synapse address (e.g. XsyikK1pALjkLwYTnJSJMu2VHUmP5nJWfR)"));
ui->signatureIn_VM->setPlaceholderText(tr("Enter Synapse signature"));
#endif
GUIUtil::setupAddressWidget(ui->addressIn_SM, this);
GUIUtil::setupAddressWidget(ui->addressIn_VM, this);
ui->addressIn_SM->installEventFilter(this);
ui->messageIn_SM->installEventFilter(this);
ui->signatureOut_SM->installEventFilter(this);
ui->addressIn_VM->installEventFilter(this);
ui->messageIn_VM->installEventFilter(this);
ui->signatureIn_VM->installEventFilter(this);
ui->signatureOut_SM->setFont(GUIUtil::bitcoinAddressFont());
ui->signatureIn_VM->setFont(GUIUtil::bitcoinAddressFont());
}
SignVerifyMessageDialog::~SignVerifyMessageDialog()
{
delete ui;
}
void SignVerifyMessageDialog::setModel(WalletModel *model)
{
this->model = model;
}
void SignVerifyMessageDialog::setAddress_SM(QString address)
{
ui->addressIn_SM->setText(address);
ui->messageIn_SM->setFocus();
}
void SignVerifyMessageDialog::setAddress_VM(QString address)
{
ui->addressIn_VM->setText(address);
ui->messageIn_VM->setFocus();
}
void SignVerifyMessageDialog::showTab_SM(bool fShow)
{
ui->tabWidget->setCurrentIndex(0);
if (fShow)
this->show();
}
void SignVerifyMessageDialog::showTab_VM(bool fShow)
{
ui->tabWidget->setCurrentIndex(1);
if (fShow)
this->show();
}
void SignVerifyMessageDialog::on_addressBookButton_SM_clicked()
{
if (model && model->getAddressTableModel())
{
AddressBookPage dlg(AddressBookPage::ForSending, AddressBookPage::ReceivingTab, this);
dlg.setModel(model->getAddressTableModel());
if (dlg.exec())
{
setAddress_SM(dlg.getReturnValue());
}
}
}
void SignVerifyMessageDialog::on_pasteButton_SM_clicked()
{
setAddress_SM(QApplication::clipboard()->text());
}
void SignVerifyMessageDialog::on_signMessageButton_SM_clicked()
{
/* Clear old signature to ensure users don't get confused on error with an old signature displayed */
ui->signatureOut_SM->clear();
CBitcoinAddress addr(ui->addressIn_SM->text().toStdString());
if (!addr.IsValid())
{
ui->addressIn_SM->setValid(false);
ui->statusLabel_SM->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_SM->setText(tr("The entered address is invalid.") + QString(" ") + tr("Please check the address and try again."));
return;
}
CKeyID keyID;
if (!addr.GetKeyID(keyID))
{
ui->addressIn_SM->setValid(false);
ui->statusLabel_SM->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_SM->setText(tr("The entered address does not refer to a key.") + QString(" ") + tr("Please check the address and try again."));
return;
}
WalletModel::UnlockContext ctx(model->requestUnlock());
if (!ctx.isValid())
{
ui->statusLabel_SM->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_SM->setText(tr("Wallet unlock was cancelled."));
return;
}
CKey key;
if (!pwalletMain->GetKey(keyID, key))
{
ui->statusLabel_SM->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_SM->setText(tr("Private key for the entered address is not available."));
return;
}
CDataStream ss(SER_GETHASH, 0);
ss << strMessageMagic;
ss << ui->messageIn_SM->document()->toPlainText().toStdString();
std::vector<unsigned char> vchSig;
if (!key.SignCompact(Hash(ss.begin(), ss.end()), vchSig))
{
ui->statusLabel_SM->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_SM->setText(QString("<nobr>") + tr("Message signing failed.") + QString("</nobr>"));
return;
}
ui->statusLabel_SM->setStyleSheet("QLabel { color: green; }");
ui->statusLabel_SM->setText(QString("<nobr>") + tr("Message signed.") + QString("</nobr>"));
ui->signatureOut_SM->setText(QString::fromStdString(EncodeBase64(&vchSig[0], vchSig.size())));
}
void SignVerifyMessageDialog::on_copySignatureButton_SM_clicked()
{
QApplication::clipboard()->setText(ui->signatureOut_SM->text());
}
void SignVerifyMessageDialog::on_clearButton_SM_clicked()
{
ui->addressIn_SM->clear();
ui->messageIn_SM->clear();
ui->signatureOut_SM->clear();
ui->statusLabel_SM->clear();
ui->addressIn_SM->setFocus();
}
void SignVerifyMessageDialog::on_addressBookButton_VM_clicked()
{
if (model && model->getAddressTableModel())
{
AddressBookPage dlg(AddressBookPage::ForSending, AddressBookPage::SendingTab, this);
dlg.setModel(model->getAddressTableModel());
if (dlg.exec())
{
setAddress_VM(dlg.getReturnValue());
}
}
}
void SignVerifyMessageDialog::on_verifyMessageButton_VM_clicked()
{
CBitcoinAddress addr(ui->addressIn_VM->text().toStdString());
if (!addr.IsValid())
{
ui->addressIn_VM->setValid(false);
ui->statusLabel_VM->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_VM->setText(tr("The entered address is invalid.") + QString(" ") + tr("Please check the address and try again."));
return;
}
CKeyID keyID;
if (!addr.GetKeyID(keyID))
{
ui->addressIn_VM->setValid(false);
ui->statusLabel_VM->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_VM->setText(tr("The entered address does not refer to a key.") + QString(" ") + tr("Please check the address and try again."));
return;
}
bool fInvalid = false;
std::vector<unsigned char> vchSig = DecodeBase64(ui->signatureIn_VM->text().toStdString().c_str(), &fInvalid);
if (fInvalid)
{
ui->signatureIn_VM->setValid(false);
ui->statusLabel_VM->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_VM->setText(tr("The signature could not be decoded.") + QString(" ") + tr("Please check the signature and try again."));
return;
}
CDataStream ss(SER_GETHASH, 0);
ss << strMessageMagic;
ss << ui->messageIn_VM->document()->toPlainText().toStdString();
CKey key;
if (!key.SetCompactSignature(Hash(ss.begin(), ss.end()), vchSig))
{
ui->signatureIn_VM->setValid(false);
ui->statusLabel_VM->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_VM->setText(tr("The signature did not match the message digest.") + QString(" ") + tr("Please check the signature and try again."));
return;
}
if (!(CBitcoinAddress(key.GetPubKey().GetID()) == addr))
{
ui->statusLabel_VM->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_VM->setText(QString("<nobr>") + tr("Message verification failed.") + QString("</nobr>"));
return;
}
ui->statusLabel_VM->setStyleSheet("QLabel { color: green; }");
ui->statusLabel_VM->setText(QString("<nobr>") + tr("Message verified.") + QString("</nobr>"));
}
void SignVerifyMessageDialog::on_clearButton_VM_clicked()
{
ui->addressIn_VM->clear();
ui->signatureIn_VM->clear();
ui->messageIn_VM->clear();
ui->statusLabel_VM->clear();
ui->addressIn_VM->setFocus();
}
bool SignVerifyMessageDialog::eventFilter(QObject *object, QEvent *event)
{
if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::FocusIn)
{
if (ui->tabWidget->currentIndex() == 0)
{
/* Clear status message on focus change */
ui->statusLabel_SM->clear();
/* Select generated signature */
if (object == ui->signatureOut_SM)
{
ui->signatureOut_SM->selectAll();
return true;
}
}
else if (ui->tabWidget->currentIndex() == 1)
{
/* Clear status message on focus change */
ui->statusLabel_VM->clear();
}
}
return QDialog::eventFilter(object, event);
}
| thruelios/ab180 | src/qt/signverifymessagedialog.cpp | C++ | mit | 8,779 |
package view;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JButton;
import javax.swing.JTextField;
import java.awt.BorderLayout;
import java.awt.Font;
public class PasswordManagerRegistration {
JPanel regpanel;
private JTextField txtUsername;
private JPasswordField txtPass1;
private JPasswordField txtPass2;
private PasswordManagerGUI gui;
public PasswordManagerRegistration(PasswordManagerGUI gui) {
this.gui = gui;
regpanel = new JPanel();
regpanel.setLayout(new BorderLayout(0, 0));
JPanel panel_1 = new JPanel();
regpanel.add(panel_1, BorderLayout.NORTH);
JLabel lblRegistration = new JLabel(Labels.REG_REGISTRATION);
lblRegistration.setFont(new Font("Tahoma", Font.PLAIN, 38));
panel_1.add(lblRegistration);
JPanel panel_2 = new JPanel();
regpanel.add(panel_2, BorderLayout.CENTER);
panel_2.setLayout(null);
JLabel lblUsername = new JLabel(Labels.REG_USERNAME);
lblUsername.setBounds(74, 92, 132, 16);
panel_2.add(lblUsername);
JLabel lblPassword = new JLabel(Labels.REG_PASSWORD);
lblPassword.setBounds(74, 149, 173, 16);
panel_2.add(lblPassword);
JLabel lblPasswordAgain = new JLabel(Labels.REG_RE_PASSWORD);
lblPasswordAgain.setBounds(74, 204, 173, 16);
panel_2.add(lblPasswordAgain);
txtUsername = new JTextField();
txtUsername.setBounds(252, 89, 380, 22);
panel_2.add(txtUsername);
txtUsername.setColumns(10);
txtPass1 = new JPasswordField();
txtPass1.setBounds(252, 146, 380, 22);
panel_2.add(txtPass1);
txtPass2 = new JPasswordField();
txtPass2.setBounds(252, 201, 380, 22);
txtPass1.addActionListener(gui.getController());
txtPass1.setActionCommand(Labels.REG_PASS1FIELD);
txtPass2.addActionListener(gui.getController());
txtPass2.setActionCommand(Labels.REG_PASS2FIELD);
txtUsername.addActionListener(gui.getController());
txtUsername.setActionCommand(Labels.REG_USERFIELD);
panel_2.add(txtPass2);
JButton btnRegistration = new JButton(Labels.REG_REGBUTTON);
btnRegistration.addActionListener(gui.getController());
btnRegistration.setBounds(278, 288, 151, 25);
panel_2.add(btnRegistration);
}
public JTextField getTxtUsername() {
return txtUsername;
}
public JPasswordField getTxtPass1() {
return txtPass1;
}
public JPasswordField getTxtPass2() {
return txtPass2;
}
}
| zoltanvi/password-manager | src/view/PasswordManagerRegistration.java | Java | mit | 2,435 |
using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
namespace System.Data
{
public static class DbTypeConsts
{
/// <summary>
/// 自定义一个 DbType 表示 pgsql 的 json 类型
/// </summary>
public const DbType NpgJson = (DbType)135;
/// <summary>
/// 自定义一个 DbType 表示 pgsql 的 jsonb 类型
/// </summary>
public const DbType NpgJsonb = (DbType)136;
}
}
| shuxinqin/Chloe | src/ChloeDemo/DbTypeConsts.cs | C# | mit | 487 |
# -*- coding: utf-8 -*-
"""
This module provides the necessary methods for a Certification Authority.
For creating the self signed Certificate for the CA, use the following command:
$ openssl req -x509 -newkey rsa:2048 -keyout ca_priv.pem -out ca_cert.pem
@author: Vasco Santos
"""
import time
from M2Crypto import X509, RSA, EVP, BIO, ASN1
class CertificationAuthority(object):
""" Class responsible for keeping the CA self-signed certificate,
as well as, its private key.
"""
def __init__(self, cert, priv_key, passphrase):
""" Create a Certification Authority Object.
Arguments:
cert: file system path of the CA's self-signed certificate.
priv_key: file system path of the CA's private key (encrypted).
passphrase: Symmetric key for priv_key decryption.
"""
def getPassphrase(*args):
""" Callback for private key decrypting.
"""
return str(passphrase.encode('utf-8'))
self.cert = X509.load_cert(cert.encode('utf-8'))
self.priv_key = RSA.load_key(priv_key.encode('utf-8'), getPassphrase)
# Private key for signing
self.signEVP = EVP.PKey()
self.signEVP.assign_rsa(self.priv_key)
def createSignedCertificate(self, subj_id, pub_key, expiration_time):
""" Create a certificate for a subject public key, signed by the CA.
Arguments:
subj_id: certificate subject identifier.
pub_key: public key of the subject.
expiration_time: certificate life time.
Returns:
Certificate in PEM Format.
"""
# Public Key to certificate
bio = BIO.MemoryBuffer(str(pub_key.decode('hex')))
pub_key = RSA.load_pub_key_bio(bio)
pkey = EVP.PKey()
pkey.assign_rsa(pub_key)
# Certificate Fields
cur_time = ASN1.ASN1_UTCTIME()
cur_time.set_time(int(time.time()))
expire_time = ASN1.ASN1_UTCTIME()
expire_time.set_time(int(time.time()) + expiration_time * 60) # In expiration time minutes
# Certification Creation
cert = X509.X509()
cert.set_pubkey(pkey)
s_name = X509.X509_Name()
s_name.C = "PT"
s_name.CN = str(subj_id)
cert.set_subject(s_name)
i_name = X509.X509_Name()
i_name.C = "PT"
i_name.CN = "Register Server"
cert.set_issuer_name(i_name)
cert.set_not_before(cur_time)
cert.set_not_after(expire_time)
cert.sign(self.signEVP, md="sha1")
#cert.save_pem("peer_CA.pem")
return cert.as_pem().encode('hex')
def decryptData(self, data):
""" Decrypt the intended data with the entity private key.
Arguments:
data: data to be decrypted.
"""
return self.priv_key.private_decrypt(data.decode('base64'), RSA.pkcs1_padding)
def encryptData(self, data, certificate):
""" Encrypt the intended data with the public key contained in the certificate.
Arguments:
data: data to be encrypted.
certificate: subject certificate.
"""
cert = X509.load_cert_string(certificate.decode('hex'))
return cert.get_pubkey().get_rsa().public_encrypt(str(data), RSA.pkcs1_padding).encode('base64')
def getPublicKey(self):
""" Get the CA Public Key.
Returns:
CA Public Key in PEM Format.
"""
return self.cert.get_pubkey().get_rsa().as_pem().encode('hex')
def signData(self, data):
""" Sign a received String.
Arguments:
data: string to sign.
Returns:
signature of the received data.
"""
msgDigest = EVP.MessageDigest('sha1')
msgDigest.update(str(data))
self.signEVP.sign_init()
self.signEVP.sign_update(msgDigest.digest())
return self.signEVP.sign_final().encode('base64')
def signEncryptedData(self, cipherData):
""" Sign encrypted data.
Arguments:
cipherData: data encrypted (base64 format).
"""
msgDigest = EVP.MessageDigest('sha1')
msgDigest.update(cipherData.decode('base64'))
self.signEVP.sign_init()
self.signEVP.sign_update(msgDigest.digest())
return self.signEVP.sign_final().encode('base64')
def validCertificate(self, certificate):
""" Verify if a certificate of a subject was issued by this CA.
Arguments:
certificate: subject certificate.
Returns:
true if the certificate was issued by this CA. false otherwise.
"""
cert = X509.load_cert_string(certificate.decode('hex'))
# Data Analysis
# Subject confirmation
return cert.verify(self.cert.get_pubkey())
def validSelfSignedCertificate(self):
""" Verify if the self-signed CA certificate was not corrupted.
Returns:
true if the self signed certificate is valid, false otherwise.
"""
return self.cert.check_ca() and self.cert.verify(self.cert.get_pubkey())
def validSignedData(self, data, signature, certificate):
""" Verify if the received data was signed by the owner of the certificate.
Arguments:
data: received data.
signature: digital signature of the data.
certificate: certificate of the data issuer.
Returns:
true if the data maintains its integrity, false otherwise.
"""
msgDigest = EVP.MessageDigest('sha1')
msgDigest.update(str(data))
pub_key = X509.load_cert_string(certificate.decode('hex')).get_pubkey().get_rsa()
verifyEVP = EVP.PKey()
verifyEVP.assign_rsa(pub_key)
verifyEVP.verify_init()
verifyEVP.verify_update(msgDigest.digest())
return verifyEVP.verify_final(str(signature.decode('base64')))
def validSignedEncryptedData(self, cipherData, signature, certificate):
""" Verify if the received data was signed by the owner of the certificate.
Arguments:
cipherData: data encrypted (base64 format).
signature: digital signature of the data.
certificate: certificate of the data issuer.
Returns:
true if the data maintains its integrity, false otherwise.
"""
msgDigest = EVP.MessageDigest('sha1')
msgDigest.update(cipherData.decode('base64'))
pub_key = X509.load_cert_string(certificate.decode('hex')).get_pubkey().get_rsa()
verifyEVP = EVP.PKey()
verifyEVP.assign_rsa(pub_key)
verifyEVP.verify_init()
verifyEVP.verify_update(msgDigest.digest())
return verifyEVP.verify_final(str(signature.decode('base64')))
| vasco-santos/CertificationService | certModule/CertAuthority.py | Python | mit | 6,803 |
export class Power{
public id:string;
public code:string;
public url:string;
public title:string;
public explain:string;
public menuId:string;
public type:string;
public isValid:boolean;
public isChecked:boolean=false;
public operation:Array<string>=new Array<string>();
public operationChecked:Array<string>=new Array<string>();
public operationMap:Array<string>=new Array<string>();
public checkboxList:Array<CheckboxList>=[]
}
export class RolePower extends Power{
public roleId:string;
}
export class NavMenu{
public id:string;
public code:string;
public url:string;
public isValid:boolean=true;
public isLeaf:boolean=false;
public title:string;
public isChecked:boolean=false;
}
export class PowerFun{
public isSHOW:boolean;
public isADD:boolean;
public isUPDATE:boolean;
public isDELETE:boolean;
public isCHECK:boolean;
}
export class RoleInfo{
public id:string;
public roleName:string;
public name:string;
public desc:string;
}
export class Tree{
public id:string;
public pid:string;
public name:string;
public isLeaf:boolean;
public IsSubMenu:boolean;
public subTrees:Array<Tree>=[];
constructor(id:string,pid:string,name:string,isLeaf:boolean){
this.id=id;
this.pid=pid;
this.name=name;
this.isLeaf=isLeaf;
}
} | Lslgg/admin-manager | src/app/admin/power/shared/power.model.ts | TypeScript | mit | 1,410 |
from baby_steps import given, then, when
from district42 import represent, schema
def test_list_of_representation():
with given:
sch = schema.list(schema.bool)
with when:
res = represent(sch)
with then:
assert res == "schema.list(schema.bool)"
def test_list_of_values_representation():
with given:
sch = schema.list(schema.int(1))
with when:
res = represent(sch)
with then:
assert res == "schema.list(schema.int(1))"
def test_list_of_repr_values_representation():
with given:
sch = schema.list(schema.str("banana"))
with when:
res = represent(sch)
with then:
assert res == "schema.list(schema.str('banana'))"
def test_list_of_len_representation():
with given:
sch = schema.list(schema.int).len(10)
with when:
res = represent(sch)
with then:
assert res == "schema.list(schema.int).len(10)"
def test_list_of_min_len_representation():
with given:
sch = schema.list(schema.int).len(1, ...)
with when:
res = represent(sch)
with then:
assert res == "schema.list(schema.int).len(1, ...)"
def test_list_of_max_len_representation():
with given:
sch = schema.list(schema.int).len(..., 10)
with when:
res = represent(sch)
with then:
assert res == "schema.list(schema.int).len(..., 10)"
def test_list_of_min_max_len_representation():
with given:
sch = schema.list(schema.int).len(1, 10)
with when:
res = represent(sch)
with then:
assert res == "schema.list(schema.int).len(1, 10)"
| nikitanovosibirsk/district42 | tests/list/test_list_of_representation.py | Python | mit | 1,650 |
/* */
"format cjs";
(function(e){if("function"==typeof bootstrap)bootstrap("csv2geojson",e);else if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeCsv2geojson=e}else"undefined"!=typeof window?window.csv2geojson=e():global.csv2geojson=e()})(function(){var define,ses,bootstrap,module,exports;
return (function(e,t,n){function r(n,i){if(!t[n]){if(!e[n]){var s=typeof require=="function"&&require;if(!i&&s)return s(n,!0);throw new Error("Cannot find module '"+n+"'")}var o=t[n]={exports:{}};e[n][0](function(t){var i=e[n][1][t];return r(i?i:t)},o,o.exports)}return t[n].exports}for(var i=0;i<n.length;i++)r(n[i]);return r})({1:[function(require,module,exports){
function csv(text) {
var header;
return csv_parseRows(text, function(row, i) {
if (i) {
var o = {}, j = -1, m = header.length;
while (++j < m) o[header[j]] = row[j];
return o;
} else {
header = row;
return null;
}
});
function csv_parseRows (text, f) {
var EOL = {}, // sentinel value for end-of-line
EOF = {}, // sentinel value for end-of-file
rows = [], // output rows
re = /\r\n|[,\r\n]/g, // field separator regex
n = 0, // the current line number
t, // the current token
eol; // is the current token followed by EOL?
re.lastIndex = 0; // work-around bug in FF 3.6
/** @private Returns the next token. */
function token() {
if (re.lastIndex >= text.length) return EOF; // special case: end of file
if (eol) { eol = false; return EOL; } // special case: end of line
// special case: quotes
var j = re.lastIndex;
if (text.charCodeAt(j) === 34) {
var i = j;
while (i++ < text.length) {
if (text.charCodeAt(i) === 34) {
if (text.charCodeAt(i + 1) !== 34) break;
i++;
}
}
re.lastIndex = i + 2;
var c = text.charCodeAt(i + 1);
if (c === 13) {
eol = true;
if (text.charCodeAt(i + 2) === 10) re.lastIndex++;
} else if (c === 10) {
eol = true;
}
return text.substring(j + 1, i).replace(/""/g, "\"");
}
// common case
var m = re.exec(text);
if (m) {
eol = m[0].charCodeAt(0) !== 44;
return text.substring(j, m.index);
}
re.lastIndex = text.length;
return text.substring(j);
}
while ((t = token()) !== EOF) {
var a = [];
while ((t !== EOL) && (t !== EOF)) {
a.push(t);
t = token();
}
if (f && !(a = f(a, n++))) continue;
rows.push(a);
}
return rows;
}
}
function csv2geojson(x, lonfield, latfield) {
var features = [],
featurecollection = {
type: 'FeatureCollection',
features: features
};
var parsed = csv(x);
if (!parsed.length) return featurecollection;
latfield = latfield || '';
lonfield = lonfield || '';
for (var f in parsed[0]) {
if (!latfield && f.match(/^Lat/i)) latfield = f;
if (!lonfield && f.match(/^Lon/i)) lonfield = f;
}
if (!latfield || !lonfield) {
var fields = [];
for (var k in parsed[0]) fields.push(k);
return fields;
}
for (var i = 0; i < parsed.length; i++) {
if (parsed[i][lonfield] !== undefined &&
parsed[i][lonfield] !== undefined) {
features.push({
type: 'Feature',
properties: parsed[i],
geometry: {
type: 'Point',
coordinates: [
parseFloat(parsed[i][lonfield]),
parseFloat(parsed[i][latfield])]
}
});
}
}
return featurecollection;
}
function toline(gj) {
var features = gj.features;
var line = {
type: 'Feature',
geometry: {
type: 'LineString',
coordinates: []
}
};
for (var i = 0; i < features.length; i++) {
line.geometry.coordinates.push(features[i].geometry.coordinates);
}
line.properties = features[0].properties;
return {
type: 'FeatureSet',
features: [line]
};
}
function topolygon(gj) {
var features = gj.features;
var poly = {
type: 'Feature',
geometry: {
type: 'Polygon',
coordinates: [[]]
}
};
for (var i = 0; i < features.length; i++) {
poly.geometry.coordinates[0].push(features[i].geometry.coordinates);
}
poly.properties = features[0].properties;
return {
type: 'FeatureSet',
features: [poly]
};
}
module.exports = {
csv: csv,
toline: toline,
topolygon: topolygon,
csv2geojson: csv2geojson
};
},{}]},{},[1])(1)
});
;
| thomjoy/turftest | src/jspm_packages/npm/mapbox.js@2.1.5/docs/assets/csv2geojson.js | JavaScript | mit | 5,283 |
import { Buffer } from 'buffer';
const discordmailhooksLegacyBrailleRegex = /([\u2800-\u28FF]+)(?:.)([\u2800-\u28FF]+)/;
class DiscordMailHooks {
email: string
constructor(email: string) {
this.email = email;
}
matches() {
return discordmailhooksLegacyBrailleRegex.test(this.email);
}
toWebhook(): string | undefined {
if (this.matches()) {
const [idBraillePart, tokenBraillePart] = discordmailhooksLegacyBrailleRegex.exec(this.email);
const id = idBraillePart.split('')
.map(encoded => encoded.codePointAt(0) - 0x2800)
.reduce((previous: bigint, currentChar: number, index: number, array: number[]): BigInt => {
previous |= BigInt(currentChar)
if (array.length - 1 !== index) previous = previous << BigInt(8)
return previous
}, BigInt(0))
const token = Buffer.from(tokenBraillePart.split('').map(encoded => encoded.codePointAt(0) - 0x2800)).toString('base64').replace(/\+/g, '-').replace(/\//g, '_');
return `https://discordapp.com/api/webhooks/${id}/${token}`
} else {
return;
}
}
}
export default DiscordMailHooks
| moustacheminer/discordmail | src/mail/DiscordMailHooks.ts | TypeScript | mit | 1,161 |
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2020 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <util/system.h>
#ifdef ENABLE_EXTERNAL_SIGNER
#if defined(WIN32) && !defined(__kernel_entry)
// A workaround for boost 1.71 incompatibility with mingw-w64 compiler.
// For details see https://github.com/bitcoin/bitcoin/pull/22348.
#define __kernel_entry
#endif
#include <boost/process.hpp>
#endif // ENABLE_EXTERNAL_SIGNER
#include <chainparamsbase.h>
#include <sync.h>
#include <util/check.h>
#include <util/getuniquepath.h>
#include <util/strencodings.h>
#include <util/string.h>
#include <util/translation.h>
#if (defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__))
#include <pthread.h>
#include <pthread_np.h>
#endif
#ifndef WIN32
// for posix_fallocate, in configure.ac we check if it is present after this
#ifdef __linux__
#ifdef _POSIX_C_SOURCE
#undef _POSIX_C_SOURCE
#endif
#define _POSIX_C_SOURCE 200112L
#endif // __linux__
#include <algorithm>
#include <cassert>
#include <fcntl.h>
#include <sched.h>
#include <sys/resource.h>
#include <sys/stat.h>
#else
#ifdef _MSC_VER
#pragma warning(disable:4786)
#pragma warning(disable:4804)
#pragma warning(disable:4805)
#pragma warning(disable:4717)
#endif
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <codecvt>
#include <io.h> /* for _commit */
#include <shellapi.h>
#include <shlobj.h>
#endif
#ifdef HAVE_MALLOPT_ARENA_MAX
#include <malloc.h>
#endif
#include <boost/algorithm/string/replace.hpp>
#include <thread>
#include <typeinfo>
#include <univalue.h>
// Application startup time (used for uptime calculation)
const int64_t nStartupTime = GetTime();
const char * const BITCOIN_CONF_FILENAME = "bitcoin.conf";
const char * const BITCOIN_SETTINGS_FILENAME = "settings.json";
ArgsManager gArgs;
/** Mutex to protect dir_locks. */
static Mutex cs_dir_locks;
/** A map that contains all the currently held directory locks. After
* successful locking, these will be held here until the global destructor
* cleans them up and thus automatically unlocks them, or ReleaseDirectoryLocks
* is called.
*/
static std::map<std::string, std::unique_ptr<fsbridge::FileLock>> dir_locks GUARDED_BY(cs_dir_locks);
bool LockDirectory(const fs::path& directory, const std::string lockfile_name, bool probe_only)
{
LOCK(cs_dir_locks);
fs::path pathLockFile = directory / lockfile_name;
// If a lock for this directory already exists in the map, don't try to re-lock it
if (dir_locks.count(pathLockFile.string())) {
return true;
}
// Create empty lock file if it doesn't exist.
FILE* file = fsbridge::fopen(pathLockFile, "a");
if (file) fclose(file);
auto lock = std::make_unique<fsbridge::FileLock>(pathLockFile);
if (!lock->TryLock()) {
return error("Error while attempting to lock directory %s: %s", directory.string(), lock->GetReason());
}
if (!probe_only) {
// Lock successful and we're not just probing, put it into the map
dir_locks.emplace(pathLockFile.string(), std::move(lock));
}
return true;
}
void UnlockDirectory(const fs::path& directory, const std::string& lockfile_name)
{
LOCK(cs_dir_locks);
dir_locks.erase((directory / lockfile_name).string());
}
void ReleaseDirectoryLocks()
{
LOCK(cs_dir_locks);
dir_locks.clear();
}
bool DirIsWritable(const fs::path& directory)
{
fs::path tmpFile = GetUniquePath(directory);
FILE* file = fsbridge::fopen(tmpFile, "a");
if (!file) return false;
fclose(file);
remove(tmpFile);
return true;
}
bool CheckDiskSpace(const fs::path& dir, uint64_t additional_bytes)
{
constexpr uint64_t min_disk_space = 52428800; // 50 MiB
uint64_t free_bytes_available = fs::space(dir).available;
return free_bytes_available >= min_disk_space + additional_bytes;
}
std::streampos GetFileSize(const char* path, std::streamsize max) {
std::ifstream file(path, std::ios::binary);
file.ignore(max);
return file.gcount();
}
/**
* Interpret a string argument as a boolean.
*
* The definition of LocaleIndependentAtoi<int>() requires that non-numeric string values
* like "foo", return 0. This means that if a user unintentionally supplies a
* non-integer argument here, the return value is always false. This means that
* -foo=false does what the user probably expects, but -foo=true is well defined
* but does not do what they probably expected.
*
* The return value of LocaleIndependentAtoi<int>(...) is zero when given input not
* representable as an int.
*
* For a more extensive discussion of this topic (and a wide range of opinions
* on the Right Way to change this code), see PR12713.
*/
static bool InterpretBool(const std::string& strValue)
{
if (strValue.empty())
return true;
return (LocaleIndependentAtoi<int>(strValue) != 0);
}
static std::string SettingName(const std::string& arg)
{
return arg.size() > 0 && arg[0] == '-' ? arg.substr(1) : arg;
}
/**
* Interpret -nofoo as if the user supplied -foo=0.
*
* This method also tracks when the -no form was supplied, and if so,
* checks whether there was a double-negative (-nofoo=0 -> -foo=1).
*
* If there was not a double negative, it removes the "no" from the key
* and returns false.
*
* If there was a double negative, it removes "no" from the key, and
* returns true.
*
* If there was no "no", it returns the string value untouched.
*
* Where an option was negated can be later checked using the
* IsArgNegated() method. One use case for this is to have a way to disable
* options that are not normally boolean (e.g. using -nodebuglogfile to request
* that debug log output is not sent to any file at all).
*/
static util::SettingsValue InterpretOption(std::string& section, std::string& key, const std::string& value)
{
// Split section name from key name for keys like "testnet.foo" or "regtest.bar"
size_t option_index = key.find('.');
if (option_index != std::string::npos) {
section = key.substr(0, option_index);
key.erase(0, option_index + 1);
}
if (key.substr(0, 2) == "no") {
key.erase(0, 2);
// Double negatives like -nofoo=0 are supported (but discouraged)
if (!InterpretBool(value)) {
LogPrintf("Warning: parsed potentially confusing double-negative -%s=%s\n", key, value);
return true;
}
return false;
}
return value;
}
/**
* Check settings value validity according to flags.
*
* TODO: Add more meaningful error checks here in the future
* See "here's how the flags are meant to behave" in
* https://github.com/bitcoin/bitcoin/pull/16097#issuecomment-514627823
*/
static bool CheckValid(const std::string& key, const util::SettingsValue& val, unsigned int flags, std::string& error)
{
if (val.isBool() && !(flags & ArgsManager::ALLOW_BOOL)) {
error = strprintf("Negating of -%s is meaningless and therefore forbidden", key);
return false;
}
return true;
}
namespace {
fs::path StripRedundantLastElementsOfPath(const fs::path& path)
{
auto result = path;
while (result.filename().string() == ".") {
result = result.parent_path();
}
assert(fs::equivalent(result, path));
return result;
}
} // namespace
// Define default constructor and destructor that are not inline, so code instantiating this class doesn't need to
// #include class definitions for all members.
// For example, m_settings has an internal dependency on univalue.
ArgsManager::ArgsManager() {}
ArgsManager::~ArgsManager() {}
const std::set<std::string> ArgsManager::GetUnsuitableSectionOnlyArgs() const
{
std::set<std::string> unsuitables;
LOCK(cs_args);
// if there's no section selected, don't worry
if (m_network.empty()) return std::set<std::string> {};
// if it's okay to use the default section for this network, don't worry
if (m_network == CBaseChainParams::MAIN) return std::set<std::string> {};
for (const auto& arg : m_network_only_args) {
if (OnlyHasDefaultSectionSetting(m_settings, m_network, SettingName(arg))) {
unsuitables.insert(arg);
}
}
return unsuitables;
}
const std::list<SectionInfo> ArgsManager::GetUnrecognizedSections() const
{
// Section names to be recognized in the config file.
static const std::set<std::string> available_sections{
CBaseChainParams::REGTEST,
CBaseChainParams::SIGNET,
CBaseChainParams::TESTNET,
CBaseChainParams::MAIN
};
LOCK(cs_args);
std::list<SectionInfo> unrecognized = m_config_sections;
unrecognized.remove_if([](const SectionInfo& appeared){ return available_sections.find(appeared.m_name) != available_sections.end(); });
return unrecognized;
}
void ArgsManager::SelectConfigNetwork(const std::string& network)
{
LOCK(cs_args);
m_network = network;
}
bool ArgsManager::ParseParameters(int argc, const char* const argv[], std::string& error)
{
LOCK(cs_args);
m_settings.command_line_options.clear();
for (int i = 1; i < argc; i++) {
std::string key(argv[i]);
#ifdef MAC_OSX
// At the first time when a user gets the "App downloaded from the
// internet" warning, and clicks the Open button, macOS passes
// a unique process serial number (PSN) as -psn_... command-line
// argument, which we filter out.
if (key.substr(0, 5) == "-psn_") continue;
#endif
if (key == "-") break; //bitcoin-tx using stdin
std::string val;
size_t is_index = key.find('=');
if (is_index != std::string::npos) {
val = key.substr(is_index + 1);
key.erase(is_index);
}
#ifdef WIN32
key = ToLower(key);
if (key[0] == '/')
key[0] = '-';
#endif
if (key[0] != '-') {
if (!m_accept_any_command && m_command.empty()) {
// The first non-dash arg is a registered command
std::optional<unsigned int> flags = GetArgFlags(key);
if (!flags || !(*flags & ArgsManager::COMMAND)) {
error = strprintf("Invalid command '%s'", argv[i]);
return false;
}
}
m_command.push_back(key);
while (++i < argc) {
// The remaining args are command args
m_command.push_back(argv[i]);
}
break;
}
// Transform --foo to -foo
if (key.length() > 1 && key[1] == '-')
key.erase(0, 1);
// Transform -foo to foo
key.erase(0, 1);
std::string section;
util::SettingsValue value = InterpretOption(section, key, val);
std::optional<unsigned int> flags = GetArgFlags('-' + key);
// Unknown command line options and command line options with dot
// characters (which are returned from InterpretOption with nonempty
// section strings) are not valid.
if (!flags || !section.empty()) {
error = strprintf("Invalid parameter %s", argv[i]);
return false;
}
if (!CheckValid(key, value, *flags, error)) return false;
m_settings.command_line_options[key].push_back(value);
}
// we do not allow -includeconf from command line, only -noincludeconf
if (auto* includes = util::FindKey(m_settings.command_line_options, "includeconf")) {
const util::SettingsSpan values{*includes};
// Range may be empty if -noincludeconf was passed
if (!values.empty()) {
error = "-includeconf cannot be used from commandline; -includeconf=" + values.begin()->write();
return false; // pick first value as example
}
}
return true;
}
std::optional<unsigned int> ArgsManager::GetArgFlags(const std::string& name) const
{
LOCK(cs_args);
for (const auto& arg_map : m_available_args) {
const auto search = arg_map.second.find(name);
if (search != arg_map.second.end()) {
return search->second.m_flags;
}
}
return std::nullopt;
}
const fs::path& ArgsManager::GetBlocksDirPath() const
{
LOCK(cs_args);
fs::path& path = m_cached_blocks_path;
// Cache the path to avoid calling fs::create_directories on every call of
// this function
if (!path.empty()) return path;
if (IsArgSet("-blocksdir")) {
path = fs::system_complete(GetArg("-blocksdir", ""));
if (!fs::is_directory(path)) {
path = "";
return path;
}
} else {
path = GetDataDirBase();
}
path /= BaseParams().DataDir();
path /= "blocks";
fs::create_directories(path);
path = StripRedundantLastElementsOfPath(path);
return path;
}
const fs::path& ArgsManager::GetDataDir(bool net_specific) const
{
LOCK(cs_args);
fs::path& path = net_specific ? m_cached_network_datadir_path : m_cached_datadir_path;
// Cache the path to avoid calling fs::create_directories on every call of
// this function
if (!path.empty()) return path;
std::string datadir = GetArg("-datadir", "");
if (!datadir.empty()) {
path = fs::system_complete(datadir);
if (!fs::is_directory(path)) {
path = "";
return path;
}
} else {
path = GetDefaultDataDir();
}
if (net_specific)
path /= BaseParams().DataDir();
if (fs::create_directories(path)) {
// This is the first run, create wallets subdirectory too
fs::create_directories(path / "wallets");
}
path = StripRedundantLastElementsOfPath(path);
return path;
}
void ArgsManager::ClearPathCache()
{
LOCK(cs_args);
m_cached_datadir_path = fs::path();
m_cached_network_datadir_path = fs::path();
m_cached_blocks_path = fs::path();
}
std::optional<const ArgsManager::Command> ArgsManager::GetCommand() const
{
Command ret;
LOCK(cs_args);
auto it = m_command.begin();
if (it == m_command.end()) {
// No command was passed
return std::nullopt;
}
if (!m_accept_any_command) {
// The registered command
ret.command = *(it++);
}
while (it != m_command.end()) {
// The unregistered command and args (if any)
ret.args.push_back(*(it++));
}
return ret;
}
std::vector<std::string> ArgsManager::GetArgs(const std::string& strArg) const
{
std::vector<std::string> result;
for (const util::SettingsValue& value : GetSettingsList(strArg)) {
result.push_back(value.isFalse() ? "0" : value.isTrue() ? "1" : value.get_str());
}
return result;
}
bool ArgsManager::IsArgSet(const std::string& strArg) const
{
return !GetSetting(strArg).isNull();
}
bool ArgsManager::InitSettings(std::string& error)
{
if (!GetSettingsPath()) {
return true; // Do nothing if settings file disabled.
}
std::vector<std::string> errors;
if (!ReadSettingsFile(&errors)) {
error = strprintf("Failed loading settings file:\n%s\n", MakeUnorderedList(errors));
return false;
}
if (!WriteSettingsFile(&errors)) {
error = strprintf("Failed saving settings file:\n%s\n", MakeUnorderedList(errors));
return false;
}
return true;
}
bool ArgsManager::GetSettingsPath(fs::path* filepath, bool temp) const
{
if (IsArgNegated("-settings")) {
return false;
}
if (filepath) {
std::string settings = GetArg("-settings", BITCOIN_SETTINGS_FILENAME);
*filepath = fsbridge::AbsPathJoin(GetDataDirNet(), temp ? settings + ".tmp" : settings);
}
return true;
}
static void SaveErrors(const std::vector<std::string> errors, std::vector<std::string>* error_out)
{
for (const auto& error : errors) {
if (error_out) {
error_out->emplace_back(error);
} else {
LogPrintf("%s\n", error);
}
}
}
bool ArgsManager::ReadSettingsFile(std::vector<std::string>* errors)
{
fs::path path;
if (!GetSettingsPath(&path, /* temp= */ false)) {
return true; // Do nothing if settings file disabled.
}
LOCK(cs_args);
m_settings.rw_settings.clear();
std::vector<std::string> read_errors;
if (!util::ReadSettings(path, m_settings.rw_settings, read_errors)) {
SaveErrors(read_errors, errors);
return false;
}
for (const auto& setting : m_settings.rw_settings) {
std::string section;
std::string key = setting.first;
(void)InterpretOption(section, key, /* value */ {}); // Split setting key into section and argname
if (!GetArgFlags('-' + key)) {
LogPrintf("Ignoring unknown rw_settings value %s\n", setting.first);
}
}
return true;
}
bool ArgsManager::WriteSettingsFile(std::vector<std::string>* errors) const
{
fs::path path, path_tmp;
if (!GetSettingsPath(&path, /* temp= */ false) || !GetSettingsPath(&path_tmp, /* temp= */ true)) {
throw std::logic_error("Attempt to write settings file when dynamic settings are disabled.");
}
LOCK(cs_args);
std::vector<std::string> write_errors;
if (!util::WriteSettings(path_tmp, m_settings.rw_settings, write_errors)) {
SaveErrors(write_errors, errors);
return false;
}
if (!RenameOver(path_tmp, path)) {
SaveErrors({strprintf("Failed renaming settings file %s to %s\n", path_tmp.string(), path.string())}, errors);
return false;
}
return true;
}
bool ArgsManager::IsArgNegated(const std::string& strArg) const
{
return GetSetting(strArg).isFalse();
}
std::string ArgsManager::GetArg(const std::string& strArg, const std::string& strDefault) const
{
const util::SettingsValue value = GetSetting(strArg);
return value.isNull() ? strDefault : value.isFalse() ? "0" : value.isTrue() ? "1" : value.get_str();
}
int64_t ArgsManager::GetIntArg(const std::string& strArg, int64_t nDefault) const
{
const util::SettingsValue value = GetSetting(strArg);
return value.isNull() ? nDefault : value.isFalse() ? 0 : value.isTrue() ? 1 : value.isNum() ? value.get_int64() : LocaleIndependentAtoi<int64_t>(value.get_str());
}
bool ArgsManager::GetBoolArg(const std::string& strArg, bool fDefault) const
{
const util::SettingsValue value = GetSetting(strArg);
return value.isNull() ? fDefault : value.isBool() ? value.get_bool() : InterpretBool(value.get_str());
}
bool ArgsManager::SoftSetArg(const std::string& strArg, const std::string& strValue)
{
LOCK(cs_args);
if (IsArgSet(strArg)) return false;
ForceSetArg(strArg, strValue);
return true;
}
bool ArgsManager::SoftSetBoolArg(const std::string& strArg, bool fValue)
{
if (fValue)
return SoftSetArg(strArg, std::string("1"));
else
return SoftSetArg(strArg, std::string("0"));
}
void ArgsManager::ForceSetArg(const std::string& strArg, const std::string& strValue)
{
LOCK(cs_args);
m_settings.forced_settings[SettingName(strArg)] = strValue;
}
void ArgsManager::AddCommand(const std::string& cmd, const std::string& help)
{
Assert(cmd.find('=') == std::string::npos);
Assert(cmd.at(0) != '-');
LOCK(cs_args);
m_accept_any_command = false; // latch to false
std::map<std::string, Arg>& arg_map = m_available_args[OptionsCategory::COMMANDS];
auto ret = arg_map.emplace(cmd, Arg{"", help, ArgsManager::COMMAND});
Assert(ret.second); // Fail on duplicate commands
}
void ArgsManager::AddArg(const std::string& name, const std::string& help, unsigned int flags, const OptionsCategory& cat)
{
Assert((flags & ArgsManager::COMMAND) == 0); // use AddCommand
// Split arg name from its help param
size_t eq_index = name.find('=');
if (eq_index == std::string::npos) {
eq_index = name.size();
}
std::string arg_name = name.substr(0, eq_index);
LOCK(cs_args);
std::map<std::string, Arg>& arg_map = m_available_args[cat];
auto ret = arg_map.emplace(arg_name, Arg{name.substr(eq_index, name.size() - eq_index), help, flags});
assert(ret.second); // Make sure an insertion actually happened
if (flags & ArgsManager::NETWORK_ONLY) {
m_network_only_args.emplace(arg_name);
}
}
void ArgsManager::AddHiddenArgs(const std::vector<std::string>& names)
{
for (const std::string& name : names) {
AddArg(name, "", ArgsManager::ALLOW_ANY, OptionsCategory::HIDDEN);
}
}
std::string ArgsManager::GetHelpMessage() const
{
const bool show_debug = GetBoolArg("-help-debug", false);
std::string usage = "";
LOCK(cs_args);
for (const auto& arg_map : m_available_args) {
switch(arg_map.first) {
case OptionsCategory::OPTIONS:
usage += HelpMessageGroup("Options:");
break;
case OptionsCategory::CONNECTION:
usage += HelpMessageGroup("Connection options:");
break;
case OptionsCategory::ZMQ:
usage += HelpMessageGroup("ZeroMQ notification options:");
break;
case OptionsCategory::DEBUG_TEST:
usage += HelpMessageGroup("Debugging/Testing options:");
break;
case OptionsCategory::NODE_RELAY:
usage += HelpMessageGroup("Node relay options:");
break;
case OptionsCategory::BLOCK_CREATION:
usage += HelpMessageGroup("Block creation options:");
break;
case OptionsCategory::RPC:
usage += HelpMessageGroup("RPC server options:");
break;
case OptionsCategory::WALLET:
usage += HelpMessageGroup("Wallet options:");
break;
case OptionsCategory::WALLET_DEBUG_TEST:
if (show_debug) usage += HelpMessageGroup("Wallet debugging/testing options:");
break;
case OptionsCategory::CHAINPARAMS:
usage += HelpMessageGroup("Chain selection options:");
break;
case OptionsCategory::GUI:
usage += HelpMessageGroup("UI Options:");
break;
case OptionsCategory::COMMANDS:
usage += HelpMessageGroup("Commands:");
break;
case OptionsCategory::REGISTER_COMMANDS:
usage += HelpMessageGroup("Register Commands:");
break;
default:
break;
}
// When we get to the hidden options, stop
if (arg_map.first == OptionsCategory::HIDDEN) break;
for (const auto& arg : arg_map.second) {
if (show_debug || !(arg.second.m_flags & ArgsManager::DEBUG_ONLY)) {
std::string name;
if (arg.second.m_help_param.empty()) {
name = arg.first;
} else {
name = arg.first + arg.second.m_help_param;
}
usage += HelpMessageOpt(name, arg.second.m_help_text);
}
}
}
return usage;
}
bool HelpRequested(const ArgsManager& args)
{
return args.IsArgSet("-?") || args.IsArgSet("-h") || args.IsArgSet("-help") || args.IsArgSet("-help-debug");
}
void SetupHelpOptions(ArgsManager& args)
{
args.AddArg("-?", "Print this help message and exit", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
args.AddHiddenArgs({"-h", "-help"});
}
static const int screenWidth = 79;
static const int optIndent = 2;
static const int msgIndent = 7;
std::string HelpMessageGroup(const std::string &message) {
return std::string(message) + std::string("\n\n");
}
std::string HelpMessageOpt(const std::string &option, const std::string &message) {
return std::string(optIndent,' ') + std::string(option) +
std::string("\n") + std::string(msgIndent,' ') +
FormatParagraph(message, screenWidth - msgIndent, msgIndent) +
std::string("\n\n");
}
static std::string FormatException(const std::exception* pex, const char* pszThread)
{
#ifdef WIN32
char pszModule[MAX_PATH] = "";
GetModuleFileNameA(nullptr, pszModule, sizeof(pszModule));
#else
const char* pszModule = "bitcoin";
#endif
if (pex)
return strprintf(
"EXCEPTION: %s \n%s \n%s in %s \n", typeid(*pex).name(), pex->what(), pszModule, pszThread);
else
return strprintf(
"UNKNOWN EXCEPTION \n%s in %s \n", pszModule, pszThread);
}
void PrintExceptionContinue(const std::exception* pex, const char* pszThread)
{
std::string message = FormatException(pex, pszThread);
LogPrintf("\n\n************************\n%s\n", message);
tfm::format(std::cerr, "\n\n************************\n%s\n", message);
}
fs::path GetDefaultDataDir()
{
// Windows: C:\Users\Username\AppData\Roaming\Bitcoin
// macOS: ~/Library/Application Support/Bitcoin
// Unix-like: ~/.bitcoin
#ifdef WIN32
// Windows
return GetSpecialFolderPath(CSIDL_APPDATA) / "Bitcoin";
#else
fs::path pathRet;
char* pszHome = getenv("HOME");
if (pszHome == nullptr || strlen(pszHome) == 0)
pathRet = fs::path("/");
else
pathRet = fs::path(pszHome);
#ifdef MAC_OSX
// macOS
return pathRet / "Library/Application Support/Bitcoin";
#else
// Unix-like
return pathRet / ".bitcoin";
#endif
#endif
}
bool CheckDataDirOption()
{
std::string datadir = gArgs.GetArg("-datadir", "");
return datadir.empty() || fs::is_directory(fs::system_complete(datadir));
}
fs::path GetConfigFile(const std::string& confPath)
{
return AbsPathForConfigVal(fs::path(confPath), false);
}
static bool GetConfigOptions(std::istream& stream, const std::string& filepath, std::string& error, std::vector<std::pair<std::string, std::string>>& options, std::list<SectionInfo>& sections)
{
std::string str, prefix;
std::string::size_type pos;
int linenr = 1;
while (std::getline(stream, str)) {
bool used_hash = false;
if ((pos = str.find('#')) != std::string::npos) {
str = str.substr(0, pos);
used_hash = true;
}
const static std::string pattern = " \t\r\n";
str = TrimString(str, pattern);
if (!str.empty()) {
if (*str.begin() == '[' && *str.rbegin() == ']') {
const std::string section = str.substr(1, str.size() - 2);
sections.emplace_back(SectionInfo{section, filepath, linenr});
prefix = section + '.';
} else if (*str.begin() == '-') {
error = strprintf("parse error on line %i: %s, options in configuration file must be specified without leading -", linenr, str);
return false;
} else if ((pos = str.find('=')) != std::string::npos) {
std::string name = prefix + TrimString(str.substr(0, pos), pattern);
std::string value = TrimString(str.substr(pos + 1), pattern);
if (used_hash && name.find("rpcpassword") != std::string::npos) {
error = strprintf("parse error on line %i, using # in rpcpassword can be ambiguous and should be avoided", linenr);
return false;
}
options.emplace_back(name, value);
if ((pos = name.rfind('.')) != std::string::npos && prefix.length() <= pos) {
sections.emplace_back(SectionInfo{name.substr(0, pos), filepath, linenr});
}
} else {
error = strprintf("parse error on line %i: %s", linenr, str);
if (str.size() >= 2 && str.substr(0, 2) == "no") {
error += strprintf(", if you intended to specify a negated option, use %s=1 instead", str);
}
return false;
}
}
++linenr;
}
return true;
}
bool ArgsManager::ReadConfigStream(std::istream& stream, const std::string& filepath, std::string& error, bool ignore_invalid_keys)
{
LOCK(cs_args);
std::vector<std::pair<std::string, std::string>> options;
if (!GetConfigOptions(stream, filepath, error, options, m_config_sections)) {
return false;
}
for (const std::pair<std::string, std::string>& option : options) {
std::string section;
std::string key = option.first;
util::SettingsValue value = InterpretOption(section, key, option.second);
std::optional<unsigned int> flags = GetArgFlags('-' + key);
if (flags) {
if (!CheckValid(key, value, *flags, error)) {
return false;
}
m_settings.ro_config[section][key].push_back(value);
} else {
if (ignore_invalid_keys) {
LogPrintf("Ignoring unknown configuration value %s\n", option.first);
} else {
error = strprintf("Invalid configuration value %s", option.first);
return false;
}
}
}
return true;
}
bool ArgsManager::ReadConfigFiles(std::string& error, bool ignore_invalid_keys)
{
{
LOCK(cs_args);
m_settings.ro_config.clear();
m_config_sections.clear();
}
const std::string confPath = GetArg("-conf", BITCOIN_CONF_FILENAME);
fsbridge::ifstream stream(GetConfigFile(confPath));
// not ok to have a config file specified that cannot be opened
if (IsArgSet("-conf") && !stream.good()) {
error = strprintf("specified config file \"%s\" could not be opened.", confPath);
return false;
}
// ok to not have a config file
if (stream.good()) {
if (!ReadConfigStream(stream, confPath, error, ignore_invalid_keys)) {
return false;
}
// `-includeconf` cannot be included in the command line arguments except
// as `-noincludeconf` (which indicates that no included conf file should be used).
bool use_conf_file{true};
{
LOCK(cs_args);
if (auto* includes = util::FindKey(m_settings.command_line_options, "includeconf")) {
// ParseParameters() fails if a non-negated -includeconf is passed on the command-line
assert(util::SettingsSpan(*includes).last_negated());
use_conf_file = false;
}
}
if (use_conf_file) {
std::string chain_id = GetChainName();
std::vector<std::string> conf_file_names;
auto add_includes = [&](const std::string& network, size_t skip = 0) {
size_t num_values = 0;
LOCK(cs_args);
if (auto* section = util::FindKey(m_settings.ro_config, network)) {
if (auto* values = util::FindKey(*section, "includeconf")) {
for (size_t i = std::max(skip, util::SettingsSpan(*values).negated()); i < values->size(); ++i) {
conf_file_names.push_back((*values)[i].get_str());
}
num_values = values->size();
}
}
return num_values;
};
// We haven't set m_network yet (that happens in SelectParams()), so manually check
// for network.includeconf args.
const size_t chain_includes = add_includes(chain_id);
const size_t default_includes = add_includes({});
for (const std::string& conf_file_name : conf_file_names) {
fsbridge::ifstream conf_file_stream(GetConfigFile(conf_file_name));
if (conf_file_stream.good()) {
if (!ReadConfigStream(conf_file_stream, conf_file_name, error, ignore_invalid_keys)) {
return false;
}
LogPrintf("Included configuration file %s\n", conf_file_name);
} else {
error = "Failed to include configuration file " + conf_file_name;
return false;
}
}
// Warn about recursive -includeconf
conf_file_names.clear();
add_includes(chain_id, /* skip= */ chain_includes);
add_includes({}, /* skip= */ default_includes);
std::string chain_id_final = GetChainName();
if (chain_id_final != chain_id) {
// Also warn about recursive includeconf for the chain that was specified in one of the includeconfs
add_includes(chain_id_final);
}
for (const std::string& conf_file_name : conf_file_names) {
tfm::format(std::cerr, "warning: -includeconf cannot be used from included files; ignoring -includeconf=%s\n", conf_file_name);
}
}
}
// If datadir is changed in .conf file:
gArgs.ClearPathCache();
if (!CheckDataDirOption()) {
error = strprintf("specified data directory \"%s\" does not exist.", GetArg("-datadir", ""));
return false;
}
return true;
}
std::string ArgsManager::GetChainName() const
{
auto get_net = [&](const std::string& arg) {
LOCK(cs_args);
util::SettingsValue value = util::GetSetting(m_settings, /* section= */ "", SettingName(arg),
/* ignore_default_section_config= */ false,
/* get_chain_name= */ true);
return value.isNull() ? false : value.isBool() ? value.get_bool() : InterpretBool(value.get_str());
};
const bool fRegTest = get_net("-regtest");
const bool fSigNet = get_net("-signet");
const bool fTestNet = get_net("-testnet");
const bool is_chain_arg_set = IsArgSet("-chain");
if ((int)is_chain_arg_set + (int)fRegTest + (int)fSigNet + (int)fTestNet > 1) {
throw std::runtime_error("Invalid combination of -regtest, -signet, -testnet and -chain. Can use at most one.");
}
if (fRegTest)
return CBaseChainParams::REGTEST;
if (fSigNet) {
return CBaseChainParams::SIGNET;
}
if (fTestNet)
return CBaseChainParams::TESTNET;
return GetArg("-chain", CBaseChainParams::MAIN);
}
bool ArgsManager::UseDefaultSection(const std::string& arg) const
{
return m_network == CBaseChainParams::MAIN || m_network_only_args.count(arg) == 0;
}
util::SettingsValue ArgsManager::GetSetting(const std::string& arg) const
{
LOCK(cs_args);
return util::GetSetting(
m_settings, m_network, SettingName(arg), !UseDefaultSection(arg), /* get_chain_name= */ false);
}
std::vector<util::SettingsValue> ArgsManager::GetSettingsList(const std::string& arg) const
{
LOCK(cs_args);
return util::GetSettingsList(m_settings, m_network, SettingName(arg), !UseDefaultSection(arg));
}
void ArgsManager::logArgsPrefix(
const std::string& prefix,
const std::string& section,
const std::map<std::string, std::vector<util::SettingsValue>>& args) const
{
std::string section_str = section.empty() ? "" : "[" + section + "] ";
for (const auto& arg : args) {
for (const auto& value : arg.second) {
std::optional<unsigned int> flags = GetArgFlags('-' + arg.first);
if (flags) {
std::string value_str = (*flags & SENSITIVE) ? "****" : value.write();
LogPrintf("%s %s%s=%s\n", prefix, section_str, arg.first, value_str);
}
}
}
}
void ArgsManager::LogArgs() const
{
LOCK(cs_args);
for (const auto& section : m_settings.ro_config) {
logArgsPrefix("Config file arg:", section.first, section.second);
}
for (const auto& setting : m_settings.rw_settings) {
LogPrintf("Setting file arg: %s = %s\n", setting.first, setting.second.write());
}
logArgsPrefix("Command-line arg:", "", m_settings.command_line_options);
}
bool RenameOver(fs::path src, fs::path dest)
{
#ifdef WIN32
return MoveFileExW(src.wstring().c_str(), dest.wstring().c_str(),
MOVEFILE_REPLACE_EXISTING) != 0;
#else
int rc = std::rename(src.string().c_str(), dest.string().c_str());
return (rc == 0);
#endif /* WIN32 */
}
/**
* Ignores exceptions thrown by Boost's create_directories if the requested directory exists.
* Specifically handles case where path p exists, but it wasn't possible for the user to
* write to the parent directory.
*/
bool TryCreateDirectories(const fs::path& p)
{
try
{
return fs::create_directories(p);
} catch (const fs::filesystem_error&) {
if (!fs::exists(p) || !fs::is_directory(p))
throw;
}
// create_directories didn't create the directory, it had to have existed already
return false;
}
bool FileCommit(FILE *file)
{
if (fflush(file) != 0) { // harmless if redundantly called
LogPrintf("%s: fflush failed: %d\n", __func__, errno);
return false;
}
#ifdef WIN32
HANDLE hFile = (HANDLE)_get_osfhandle(_fileno(file));
if (FlushFileBuffers(hFile) == 0) {
LogPrintf("%s: FlushFileBuffers failed: %d\n", __func__, GetLastError());
return false;
}
#elif defined(MAC_OSX) && defined(F_FULLFSYNC)
if (fcntl(fileno(file), F_FULLFSYNC, 0) == -1) { // Manpage says "value other than -1" is returned on success
LogPrintf("%s: fcntl F_FULLFSYNC failed: %d\n", __func__, errno);
return false;
}
#elif HAVE_FDATASYNC
if (fdatasync(fileno(file)) != 0 && errno != EINVAL) { // Ignore EINVAL for filesystems that don't support sync
LogPrintf("%s: fdatasync failed: %d\n", __func__, errno);
return false;
}
#else
if (fsync(fileno(file)) != 0 && errno != EINVAL) {
LogPrintf("%s: fsync failed: %d\n", __func__, errno);
return false;
}
#endif
return true;
}
void DirectoryCommit(const fs::path &dirname)
{
#ifndef WIN32
FILE* file = fsbridge::fopen(dirname, "r");
if (file) {
fsync(fileno(file));
fclose(file);
}
#endif
}
bool TruncateFile(FILE *file, unsigned int length) {
#if defined(WIN32)
return _chsize(_fileno(file), length) == 0;
#else
return ftruncate(fileno(file), length) == 0;
#endif
}
/**
* this function tries to raise the file descriptor limit to the requested number.
* It returns the actual file descriptor limit (which may be more or less than nMinFD)
*/
int RaiseFileDescriptorLimit(int nMinFD) {
#if defined(WIN32)
return 2048;
#else
struct rlimit limitFD;
if (getrlimit(RLIMIT_NOFILE, &limitFD) != -1) {
if (limitFD.rlim_cur < (rlim_t)nMinFD) {
limitFD.rlim_cur = nMinFD;
if (limitFD.rlim_cur > limitFD.rlim_max)
limitFD.rlim_cur = limitFD.rlim_max;
setrlimit(RLIMIT_NOFILE, &limitFD);
getrlimit(RLIMIT_NOFILE, &limitFD);
}
return limitFD.rlim_cur;
}
return nMinFD; // getrlimit failed, assume it's fine
#endif
}
/**
* this function tries to make a particular range of a file allocated (corresponding to disk space)
* it is advisory, and the range specified in the arguments will never contain live data
*/
void AllocateFileRange(FILE *file, unsigned int offset, unsigned int length) {
#if defined(WIN32)
// Windows-specific version
HANDLE hFile = (HANDLE)_get_osfhandle(_fileno(file));
LARGE_INTEGER nFileSize;
int64_t nEndPos = (int64_t)offset + length;
nFileSize.u.LowPart = nEndPos & 0xFFFFFFFF;
nFileSize.u.HighPart = nEndPos >> 32;
SetFilePointerEx(hFile, nFileSize, 0, FILE_BEGIN);
SetEndOfFile(hFile);
#elif defined(MAC_OSX)
// OSX specific version
// NOTE: Contrary to other OS versions, the OSX version assumes that
// NOTE: offset is the size of the file.
fstore_t fst;
fst.fst_flags = F_ALLOCATECONTIG;
fst.fst_posmode = F_PEOFPOSMODE;
fst.fst_offset = 0;
fst.fst_length = length; // mac os fst_length takes the # of free bytes to allocate, not desired file size
fst.fst_bytesalloc = 0;
if (fcntl(fileno(file), F_PREALLOCATE, &fst) == -1) {
fst.fst_flags = F_ALLOCATEALL;
fcntl(fileno(file), F_PREALLOCATE, &fst);
}
ftruncate(fileno(file), static_cast<off_t>(offset) + length);
#else
#if defined(HAVE_POSIX_FALLOCATE)
// Version using posix_fallocate
off_t nEndPos = (off_t)offset + length;
if (0 == posix_fallocate(fileno(file), 0, nEndPos)) return;
#endif
// Fallback version
// TODO: just write one byte per block
static const char buf[65536] = {};
if (fseek(file, offset, SEEK_SET)) {
return;
}
while (length > 0) {
unsigned int now = 65536;
if (length < now)
now = length;
fwrite(buf, 1, now, file); // allowed to fail; this function is advisory anyway
length -= now;
}
#endif
}
#ifdef WIN32
fs::path GetSpecialFolderPath(int nFolder, bool fCreate)
{
WCHAR pszPath[MAX_PATH] = L"";
if(SHGetSpecialFolderPathW(nullptr, pszPath, nFolder, fCreate))
{
return fs::path(pszPath);
}
LogPrintf("SHGetSpecialFolderPathW() failed, could not obtain requested path.\n");
return fs::path("");
}
#endif
#ifndef WIN32
std::string ShellEscape(const std::string& arg)
{
std::string escaped = arg;
boost::replace_all(escaped, "'", "'\"'\"'");
return "'" + escaped + "'";
}
#endif
#if HAVE_SYSTEM
void runCommand(const std::string& strCommand)
{
if (strCommand.empty()) return;
#ifndef WIN32
int nErr = ::system(strCommand.c_str());
#else
int nErr = ::_wsystem(std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>,wchar_t>().from_bytes(strCommand).c_str());
#endif
if (nErr)
LogPrintf("runCommand error: system(%s) returned %d\n", strCommand, nErr);
}
#endif
UniValue RunCommandParseJSON(const std::string& str_command, const std::string& str_std_in)
{
#ifdef ENABLE_EXTERNAL_SIGNER
namespace bp = boost::process;
UniValue result_json;
bp::opstream stdin_stream;
bp::ipstream stdout_stream;
bp::ipstream stderr_stream;
if (str_command.empty()) return UniValue::VNULL;
bp::child c(
str_command,
bp::std_out > stdout_stream,
bp::std_err > stderr_stream,
bp::std_in < stdin_stream
);
if (!str_std_in.empty()) {
stdin_stream << str_std_in << std::endl;
}
stdin_stream.pipe().close();
std::string result;
std::string error;
std::getline(stdout_stream, result);
std::getline(stderr_stream, error);
c.wait();
const int n_error = c.exit_code();
if (n_error) throw std::runtime_error(strprintf("RunCommandParseJSON error: process(%s) returned %d: %s\n", str_command, n_error, error));
if (!result_json.read(result)) throw std::runtime_error("Unable to parse JSON: " + result);
return result_json;
#else
throw std::runtime_error("Compiled without external signing support (required for external signing).");
#endif // ENABLE_EXTERNAL_SIGNER
}
void SetupEnvironment()
{
#ifdef HAVE_MALLOPT_ARENA_MAX
// glibc-specific: On 32-bit systems set the number of arenas to 1.
// By default, since glibc 2.10, the C library will create up to two heap
// arenas per core. This is known to cause excessive virtual address space
// usage in our usage. Work around it by setting the maximum number of
// arenas to 1.
if (sizeof(void*) == 4) {
mallopt(M_ARENA_MAX, 1);
}
#endif
// On most POSIX systems (e.g. Linux, but not BSD) the environment's locale
// may be invalid, in which case the "C.UTF-8" locale is used as fallback.
#if !defined(WIN32) && !defined(MAC_OSX) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
try {
std::locale(""); // Raises a runtime error if current locale is invalid
} catch (const std::runtime_error&) {
setenv("LC_ALL", "C.UTF-8", 1);
}
#elif defined(WIN32)
// Set the default input/output charset is utf-8
SetConsoleCP(CP_UTF8);
SetConsoleOutputCP(CP_UTF8);
#endif
// The path locale is lazy initialized and to avoid deinitialization errors
// in multithreading environments, it is set explicitly by the main thread.
// A dummy locale is used to extract the internal default locale, used by
// fs::path, which is then used to explicitly imbue the path.
std::locale loc = fs::path::imbue(std::locale::classic());
#ifndef WIN32
fs::path::imbue(loc);
#else
fs::path::imbue(std::locale(loc, new std::codecvt_utf8_utf16<wchar_t>()));
#endif
}
bool SetupNetworking()
{
#ifdef WIN32
// Initialize Windows Sockets
WSADATA wsadata;
int ret = WSAStartup(MAKEWORD(2,2), &wsadata);
if (ret != NO_ERROR || LOBYTE(wsadata.wVersion ) != 2 || HIBYTE(wsadata.wVersion) != 2)
return false;
#endif
return true;
}
int GetNumCores()
{
return std::thread::hardware_concurrency();
}
std::string CopyrightHolders(const std::string& strPrefix)
{
const auto copyright_devs = strprintf(_(COPYRIGHT_HOLDERS).translated, COPYRIGHT_HOLDERS_SUBSTITUTION);
std::string strCopyrightHolders = strPrefix + copyright_devs;
// Make sure Bitcoin Core copyright is not removed by accident
if (copyright_devs.find("Bitcoin Core") == std::string::npos) {
strCopyrightHolders += "\n" + strPrefix + "The Bitcoin Core developers";
}
return strCopyrightHolders;
}
// Obtain the application startup time (used for uptime calculation)
int64_t GetStartupTime()
{
return nStartupTime;
}
fs::path AbsPathForConfigVal(const fs::path& path, bool net_specific)
{
if (path.is_absolute()) {
return path;
}
return fsbridge::AbsPathJoin(net_specific ? gArgs.GetDataDirNet() : gArgs.GetDataDirBase(), path);
}
void ScheduleBatchPriority()
{
#ifdef SCHED_BATCH
const static sched_param param{};
const int rc = pthread_setschedparam(pthread_self(), SCHED_BATCH, ¶m);
if (rc != 0) {
LogPrintf("Failed to pthread_setschedparam: %s\n", strerror(rc));
}
#endif
}
namespace util {
#ifdef WIN32
WinCmdLineArgs::WinCmdLineArgs()
{
wchar_t** wargv = CommandLineToArgvW(GetCommandLineW(), &argc);
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t> utf8_cvt;
argv = new char*[argc];
args.resize(argc);
for (int i = 0; i < argc; i++) {
args[i] = utf8_cvt.to_bytes(wargv[i]);
argv[i] = &*args[i].begin();
}
LocalFree(wargv);
}
WinCmdLineArgs::~WinCmdLineArgs()
{
delete[] argv;
}
std::pair<int, char**> WinCmdLineArgs::get()
{
return std::make_pair(argc, argv);
}
#endif
} // namespace util
| instagibbs/bitcoin | src/util/system.cpp | C++ | mit | 46,739 |
<?php
namespace AppBundle\Command;
use FOS\UserBundle\Util\Canonicalizer;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Config\Definition\Exception\Exception;
use Symfony\Component\Console\Style\SymfonyStyle;
class CanonicalisationCommand extends ContainerAwareCommand {
public function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$em = $this->getContainer()->get('doctrine')->getManager();
$ms = $em->getRepository('AppBundle:Membre')->findAll();
$c = new Canonicalizer();
try {
// Enregistre l'email et le pseudo sous forme canonique pour chaque membre
foreach($ms as $m){
$m->setUsernameCanonical($c->canonicalize($m->getUsername()));
$m->setEmailCanonical($c->canonicalize($m->getEmail()));
$em->persist($m);
$em->flush();
}
$io->success('All members canonized.');
}
catch(Exception $e) {
$io->error([
$e->getCode() . ' : ' . $e->getMessage(),
]);
}
}
protected function configure () {
// On set le nom de la commande
$this->setName('app:member:canonize');
// On set la description
$this->setDescription("Canonilizing members");
// On set l'aide
$this->setHelp("Set field username_canonical and email_canonical for all members");
}
}
| alexdu98/Ambiguss | src/AppBundle/Command/CanonicalisationCommand.php | PHP | mit | 1,454 |
package apimanagement
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"context"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"github.com/Azure/go-autorest/tracing"
"net/http"
)
// GroupClient is the apiManagement Client
type GroupClient struct {
BaseClient
}
// NewGroupClient creates an instance of the GroupClient client.
func NewGroupClient(subscriptionID string) GroupClient {
return NewGroupClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewGroupClientWithBaseURI creates an instance of the GroupClient client using a custom endpoint. Use this when
// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack).
func NewGroupClientWithBaseURI(baseURI string, subscriptionID string) GroupClient {
return GroupClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// CreateOrUpdate creates or Updates a group.
// Parameters:
// resourceGroupName - the name of the resource group.
// serviceName - the name of the API Management service.
// groupID - group identifier. Must be unique in the current API Management service instance.
// parameters - create parameters.
// ifMatch - eTag of the Entity. Not required when creating an entity, but required when updating an entity.
func (client GroupClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, groupID string, parameters GroupCreateParameters, ifMatch string) (result GroupContract, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.CreateOrUpdate")
defer func() {
sc := -1
if result.Response.Response != nil {
sc = result.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: serviceName,
Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil},
{Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil},
{Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}},
{TargetValue: groupID,
Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil},
{Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.GroupCreateParametersProperties", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.GroupCreateParametersProperties.DisplayName", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "parameters.GroupCreateParametersProperties.DisplayName", Name: validation.MaxLength, Rule: 300, Chain: nil},
{Target: "parameters.GroupCreateParametersProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil},
}},
}}}}}); err != nil {
return result, validation.NewError("apimanagement.GroupClient", "CreateOrUpdate", err.Error())
}
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, groupID, parameters, ifMatch)
if err != nil {
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "CreateOrUpdate", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "CreateOrUpdate", resp, "Failure sending request")
return
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "CreateOrUpdate", resp, "Failure responding to request")
return
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client GroupClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string, parameters GroupCreateParameters, ifMatch string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"groupId": autorest.Encode("path", groupID),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serviceName": autorest.Encode("path", serviceName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2021-01-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsContentType("application/json; charset=utf-8"),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
if len(ifMatch) > 0 {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-Match", autorest.String(ifMatch)))
}
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client GroupClient) CreateOrUpdateResponder(resp *http.Response) (result GroupContract, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Delete deletes specific group of the API Management service instance.
// Parameters:
// resourceGroupName - the name of the resource group.
// serviceName - the name of the API Management service.
// groupID - group identifier. Must be unique in the current API Management service instance.
// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET
// request or it should be * for unconditional update.
func (client GroupClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, groupID string, ifMatch string) (result autorest.Response, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.Delete")
defer func() {
sc := -1
if result.Response != nil {
sc = result.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: serviceName,
Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil},
{Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil},
{Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}},
{TargetValue: groupID,
Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil},
{Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
return result, validation.NewError("apimanagement.GroupClient", "Delete", err.Error())
}
req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, groupID, ifMatch)
if err != nil {
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Delete", resp, "Failure sending request")
return
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Delete", resp, "Failure responding to request")
return
}
return
}
// DeletePreparer prepares the Delete request.
func (client GroupClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string, ifMatch string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"groupId": autorest.Encode("path", groupID),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serviceName": autorest.Encode("path", serviceName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2021-01-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}", pathParameters),
autorest.WithQueryParameters(queryParameters),
autorest.WithHeader("If-Match", autorest.String(ifMatch)))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) DeleteSender(req *http.Request) (*http.Response, error) {
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body.
func (client GroupClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
return
}
// Get gets the details of the group specified by its identifier.
// Parameters:
// resourceGroupName - the name of the resource group.
// serviceName - the name of the API Management service.
// groupID - group identifier. Must be unique in the current API Management service instance.
func (client GroupClient) Get(ctx context.Context, resourceGroupName string, serviceName string, groupID string) (result GroupContract, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.Get")
defer func() {
sc := -1
if result.Response.Response != nil {
sc = result.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: serviceName,
Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil},
{Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil},
{Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}},
{TargetValue: groupID,
Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil},
{Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
return result, validation.NewError("apimanagement.GroupClient", "Get", err.Error())
}
req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, groupID)
if err != nil {
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Get", resp, "Failure responding to request")
return
}
return
}
// GetPreparer prepares the Get request.
func (client GroupClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"groupId": autorest.Encode("path", groupID),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serviceName": autorest.Encode("path", serviceName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2021-01-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client GroupClient) GetResponder(resp *http.Response) (result GroupContract, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// GetEntityTag gets the entity state (Etag) version of the group specified by its identifier.
// Parameters:
// resourceGroupName - the name of the resource group.
// serviceName - the name of the API Management service.
// groupID - group identifier. Must be unique in the current API Management service instance.
func (client GroupClient) GetEntityTag(ctx context.Context, resourceGroupName string, serviceName string, groupID string) (result autorest.Response, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.GetEntityTag")
defer func() {
sc := -1
if result.Response != nil {
sc = result.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: serviceName,
Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil},
{Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil},
{Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}},
{TargetValue: groupID,
Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil},
{Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
return result, validation.NewError("apimanagement.GroupClient", "GetEntityTag", err.Error())
}
req, err := client.GetEntityTagPreparer(ctx, resourceGroupName, serviceName, groupID)
if err != nil {
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "GetEntityTag", nil, "Failure preparing request")
return
}
resp, err := client.GetEntityTagSender(req)
if err != nil {
result.Response = resp
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "GetEntityTag", resp, "Failure sending request")
return
}
result, err = client.GetEntityTagResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "GetEntityTag", resp, "Failure responding to request")
return
}
return
}
// GetEntityTagPreparer prepares the GetEntityTag request.
func (client GroupClient) GetEntityTagPreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"groupId": autorest.Encode("path", groupID),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serviceName": autorest.Encode("path", serviceName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2021-01-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsHead(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// GetEntityTagSender sends the GetEntityTag request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) GetEntityTagSender(req *http.Request) (*http.Response, error) {
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// GetEntityTagResponder handles the response to the GetEntityTag request. The method always
// closes the http.Response Body.
func (client GroupClient) GetEntityTagResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByClosing())
result.Response = resp
return
}
// ListByService lists a collection of groups defined within a service instance.
// Parameters:
// resourceGroupName - the name of the resource group.
// serviceName - the name of the API Management service.
// filter - | Field | Usage | Supported operators | Supported functions
// |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq, ne, gt, lt
// | substringof, contains, startswith, endswith |</br>| displayName | filter | ge, le, eq, ne, gt, lt |
// substringof, contains, startswith, endswith |</br>| description | filter | ge, le, eq, ne, gt, lt |
// substringof, contains, startswith, endswith |</br>| externalId | filter | eq | |</br>
// top - number of records to return.
// skip - number of records to skip.
func (client GroupClient) ListByService(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result GroupCollectionPage, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.ListByService")
defer func() {
sc := -1
if result.gc.Response.Response != nil {
sc = result.gc.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: serviceName,
Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil},
{Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil},
{Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}},
{TargetValue: top,
Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}},
{TargetValue: skip,
Constraints: []validation.Constraint{{Target: "skip", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "skip", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}}}}); err != nil {
return result, validation.NewError("apimanagement.GroupClient", "ListByService", err.Error())
}
result.fn = client.listByServiceNextResults
req, err := client.ListByServicePreparer(ctx, resourceGroupName, serviceName, filter, top, skip)
if err != nil {
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "ListByService", nil, "Failure preparing request")
return
}
resp, err := client.ListByServiceSender(req)
if err != nil {
result.gc.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "ListByService", resp, "Failure sending request")
return
}
result.gc, err = client.ListByServiceResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "ListByService", resp, "Failure responding to request")
return
}
if result.gc.hasNextLink() && result.gc.IsEmpty() {
err = result.NextWithContext(ctx)
return
}
return
}
// ListByServicePreparer prepares the ListByService request.
func (client GroupClient) ListByServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serviceName": autorest.Encode("path", serviceName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2021-01-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
if len(filter) > 0 {
queryParameters["$filter"] = autorest.Encode("query", filter)
}
if top != nil {
queryParameters["$top"] = autorest.Encode("query", *top)
}
if skip != nil {
queryParameters["$skip"] = autorest.Encode("query", *skip)
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// ListByServiceSender sends the ListByService request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) ListByServiceSender(req *http.Request) (*http.Response, error) {
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// ListByServiceResponder handles the response to the ListByService request. The method always
// closes the http.Response Body.
func (client GroupClient) ListByServiceResponder(resp *http.Response) (result GroupCollection, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// listByServiceNextResults retrieves the next set of results, if any.
func (client GroupClient) listByServiceNextResults(ctx context.Context, lastResults GroupCollection) (result GroupCollection, err error) {
req, err := lastResults.groupCollectionPreparer(ctx)
if err != nil {
return result, autorest.NewErrorWithError(err, "apimanagement.GroupClient", "listByServiceNextResults", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListByServiceSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "apimanagement.GroupClient", "listByServiceNextResults", resp, "Failure sending next results request")
}
result, err = client.ListByServiceResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "listByServiceNextResults", resp, "Failure responding to next results request")
}
return
}
// ListByServiceComplete enumerates all values, automatically crossing page boundaries as required.
func (client GroupClient) ListByServiceComplete(ctx context.Context, resourceGroupName string, serviceName string, filter string, top *int32, skip *int32) (result GroupCollectionIterator, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.ListByService")
defer func() {
sc := -1
if result.Response().Response.Response != nil {
sc = result.page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
result.page, err = client.ListByService(ctx, resourceGroupName, serviceName, filter, top, skip)
return
}
// Update updates the details of the group specified by its identifier.
// Parameters:
// resourceGroupName - the name of the resource group.
// serviceName - the name of the API Management service.
// groupID - group identifier. Must be unique in the current API Management service instance.
// parameters - update parameters.
// ifMatch - eTag of the Entity. ETag should match the current entity state from the header response of the GET
// request or it should be * for unconditional update.
func (client GroupClient) Update(ctx context.Context, resourceGroupName string, serviceName string, groupID string, parameters GroupUpdateParameters, ifMatch string) (result GroupContract, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/GroupClient.Update")
defer func() {
sc := -1
if result.Response.Response != nil {
sc = result.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: serviceName,
Constraints: []validation.Constraint{{Target: "serviceName", Name: validation.MaxLength, Rule: 50, Chain: nil},
{Target: "serviceName", Name: validation.MinLength, Rule: 1, Chain: nil},
{Target: "serviceName", Name: validation.Pattern, Rule: `^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$`, Chain: nil}}},
{TargetValue: groupID,
Constraints: []validation.Constraint{{Target: "groupID", Name: validation.MaxLength, Rule: 256, Chain: nil},
{Target: "groupID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
return result, validation.NewError("apimanagement.GroupClient", "Update", err.Error())
}
req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, groupID, parameters, ifMatch)
if err != nil {
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Update", nil, "Failure preparing request")
return
}
resp, err := client.UpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Update", resp, "Failure sending request")
return
}
result, err = client.UpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "apimanagement.GroupClient", "Update", resp, "Failure responding to request")
return
}
return
}
// UpdatePreparer prepares the Update request.
func (client GroupClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, groupID string, parameters GroupUpdateParameters, ifMatch string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"groupId": autorest.Encode("path", groupID),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"serviceName": autorest.Encode("path", serviceName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2021-01-01-preview"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsContentType("application/json; charset=utf-8"),
autorest.AsPatch(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/groups/{groupId}", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters),
autorest.WithHeader("If-Match", autorest.String(ifMatch)))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// UpdateSender sends the Update request. The method will close the
// http.Response Body if it receives an error.
func (client GroupClient) UpdateSender(req *http.Request) (*http.Response, error) {
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// UpdateResponder handles the response to the Update request. The method always
// closes the http.Response Body.
func (client GroupClient) UpdateResponder(resp *http.Response) (result GroupContract, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
| Azure/azure-sdk-for-go | services/preview/apimanagement/mgmt/2021-01-01-preview/apimanagement/group.go | GO | mit | 28,709 |
var module = angular.module('mtg', ['ngRoute', 'timer']);
DEBUG = true;
module.controller('main', function($scope, $filter) {
$scope.matches = [];
$scope.players = [{}, {}];
var orderBy = $filter('orderBy');
$scope.importFromStorage = function() {
console.log("Importing from local storage");
tourney = JSON.parse(localStorage.tourney);
console.log(tourney);
$scope.title = tourney.title;
$scope.players = tourney.players;
$scope.matches = tourney.matches;
// ugly way of rebind players to respective matches.
for(var m = 0; m < $scope.matches.length; m++)
{
for(var i = 0; i < $scope.players.length; i++) {
if($scope.matches[m].players[0].id == $scope.players[i].id)
$scope.matches[m].players[0] = $scope.players[i];
if($scope.matches[m].players[1].id == $scope.players[i].id)
$scope.matches[m].players[1] = $scope.players[i];
}
}
$scope.inited = true;
$scope.updatePlayerRanks();
};
$scope.exportToStorage = function() {
localStorage.tourney = JSON.stringify({
players: $scope.players,
matches: $scope.matches,
title: $scope.title,
inited: $scope.inited,
});
console.log("Exported to storage");
};
$scope.initPlayers = function() {
for(var p = 0; p < $scope.players.length; p++) {
$scope.players[p].won =
$scope.players[p].lost =
$scope.players[p].draw = 0;
$scope.players[p].rank = 1;
$scope.players[p].id = p;
}
};
$scope.updatePlayerRanks = function() {
$scope.players = orderBy($scope.players, ['-won','-draw']);
prev = $scope.players[0];
prev.rank = 1;
for(var i = 1; i < $scope.players.length; i++) {
curr = $scope.players[i];
if(curr.won == prev.won && curr.draw == prev.draw) // Not counting losses here.
{
curr.rank = prev.rank;
} else {
curr.rank = prev.rank + 1;
prev = curr;
}
}
console.log($scope.players);
};
$scope.createMatches = function() {
$scope.matches = [];
index = 0;
for(var p = 0; p < $scope.players.length; p++) {
var player1 = $scope.players[p];
for(var p2 = p+1; p2 < $scope.players.length; p2++) {
var player2 = $scope.players[p2];
var match = {
players: [player1, player2],
scores: [0, 0],
status: 'queued',
index: -1
}
$scope.matches.push(match);
}
}
// Semi-Random ordering of the matches.
// Should be so that min n-1 players have a match in the first
// round. This problem could be reduced to finding a Hamilton path...
indexes = [];
for(var i = 0; i < $scope.matches.length; i++)
indexes.push(i);
// Random shuffle. This could probably be improved in terms of efficiency.
matches_without_index = [];
while(indexes.length > 0) {
pick = Math.floor(Math.random() * indexes.length);
ind = indexes[pick];
matches_without_index.push(ind);
indexes.splice(pick, 1);
}
console.log(matches_without_index);
picked_players = [];
for(var i = 0; i < $scope.matches.length;) {
var m = 0;
for(; m < $scope.matches.length; m++) {
var match = $scope.matches[matches_without_index[m]]; // accessing the random order.
if(match.index > -1)
continue; // already visited.
if(picked_players.indexOf(match.players[0]) > -1 || picked_players.indexOf(match.players[1]) > -1)
continue; // at least one of the players already has a matchup this round.
match.index = i++;
picked_players.push(match.players[0]);
picked_players.push(match.players[1]);
break;
}
if(m == $scope.matches.length) {
picked_players = []; // new round.
}
}
$scope.matchesLeft = $scope.matches.length;
};
$scope.init = function() {
console.log("Init was called");
$scope.inited = true;
$scope.initPlayers();
$scope.createMatches();
$scope.exportToStorage();
};
$scope.matchEvaluator = function(a) {
statusorder = ['playing','queued','ended']
letters = ['a','b','c'];
return letters[statusorder.indexOf(a.status)] + a.index;
};
$scope.getMatchesLeft = function() {
var count = 0;
for(var i = 0; i < $scope.matches.length; i++)
if($scope.matches[i].status != 'ended')
count++;
return count;
};
$scope.reorderMatches = function() {
$scope.matches = orderBy($scope.matches, $scope.matchEvaluator, false);
$scope.exportToStorage();
};
$scope.startMatch = function(match) {
match.status = 'playing';
match.endtime = new Date().getTime() + 45*60*1000; // todo flytta till setting.
$scope.reorderMatches();
};
$scope.editMatch = function(match) {
match.status = 'playing';
if(match.scores[0] == match.scores[1])
{
match.players[0].draw -= 1;
match.players[1].draw -= 1;
} else if(match.scores[0] > match.scores[1]) {
match.players[0].won -= 1;
match.players[1].lost -= 1;
} else {
match.players[1].won -= 1;
match.players[0].lost -= 1;
}
$scope.updatePlayerRanks();
$scope.reorderMatches();
};
$scope.endMatch = function(match) {
match.status = 'ended';
if(match.scores[0] == match.scores[1])
{
match.players[0].draw += 1;
match.players[1].draw += 1;
} else if(match.scores[0] > match.scores[1]) {
match.players[0].won += 1;
match.players[1].lost += 1;
} else {
match.players[1].won += 1;
match.players[0].lost += 1;
}
$scope.reorderMatches();
$scope.updatePlayerRanks();
};
$scope.reset = function() {
$scope.matches = [];
$scope.players = [{}, {}];
$scope.inited = false;
if(DEBUG) {
$scope.players = [{name:'Herp'}, {name:'Derp'}, {name:'Merp'}];
}
$scope.exportToStorage();
};
if (localStorage.tourney) {
$scope.importFromStorage();
}
});
| Tethik/mtg | mtg.js | JavaScript | mit | 5,687 |
// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "v8.h"
#if defined(V8_TARGET_ARCH_MIPS)
#include "assembler.h"
#include "assembler-mips.h"
#include "assembler-mips-inl.h"
#include "frames-inl.h"
#include "mips/assembler-mips-inl.h"
#include "macro-assembler.h"
#include "macro-assembler-mips.h"
namespace v8 {
namespace internal {
Address ExitFrame::ComputeStackPointer(Address fp) {
return Memory::Address_at(fp + ExitFrameConstants::kSPOffset);
}
Register StubFailureTrampolineFrame::fp_register() { return v8::internal::fp; }
Register StubFailureTrampolineFrame::context_register() { return cp; }
} } // namespace v8::internal
#endif // V8_TARGET_ARCH_MIPS
| Noah-Huppert/Website-2013 | vhosts/www.noahhuppert.com/htdocs/trex/deps/v8/src/mips/frames-mips.cc | C++ | mit | 2,234 |
var LOTUS = Symbol.for('lotus');
var lotus = global[LOTUS];
if (!lotus) {
var lotusPath = process.env.LOTUS_PATH;
// Try using the local version.
if (lotusPath) {
lotusPath += '/lotus-require';
if (__dirname === lotusPath) {
// We are already using the local version.
}
else if (require('fs').existsSync(lotusPath)) {
lotus = require(lotusPath);
}
}
// Default to using the installed remote version.
if (!lotus) {
lotus = require('./js/index');
}
global[LOTUS] = lotus;
}
module.exports = lotus;
| aleclarson/lotus-require | index.js | JavaScript | mit | 554 |
using System;
namespace Timesheet.Domain
{
public class TimeRegistration
{
public Guid Id { get; set; }
public Guid TaskId { get; set; }
public string EmployeeId { get; set; }
public DateTimeOffset TimeStart { get; set; }
public DateTimeOffset TimeEnd { get; set; }
public TimeSpan Time { get; set; }
public string Remarks { get; set; }
}
}
| wcabus/MADN-oAuth | Timesheet.Domain/TimeRegistration.cs | C# | mit | 423 |
<?php
class Shadowbox extends Modules {
static function __install() {
Like::install();
}
static function __uninstall($confirm) {
if ($confirm)
Like::uninstall();
}
static function admin_sb_settings($admin) {
if (!Visitor::current()->group->can("change_settings"))
show_403(__("Access Denied"), __("You do not have sufficient privileges to change settings."));
if (empty($_POST))
return $admin->display("sb_settings");
if (!isset($_POST['hash']) or $_POST['hash'] != Config::current()->secure_hashkey)
show_403(__("Access Denied"), __("Invalid security key."));
$config = Config::current();
$initSetup = str_replace(array("\n", "\r", "\t", " "), '', $_POST['initSetup']);
if (empty($initSetup))
$initSetup = 'handleOversize: "drag",modal: true';
$set = array($config->set("module_sb",
array("initSetup" => $initSetup)
)
);
if (!in_array(false, $set))
Flash::notice(__("Settings updated."), "/admin/?action=sb_settings");
}
static function settings_nav($navs) {
if (Visitor::current()->group->can("change_settings"))
$navs["sb_settings"] = array("title" => __("Shadowbox", "shadowbox"));
return $navs;
}
public function head() {
$config = Config::current();
?>
<link rel="stylesheet" href="<?php echo $config->chyrp_url; ?>/modules/shadowbox/src/shadowbox.css" type="text/css" media="screen" />
<script type="text/javascript" src="<?php echo $config->chyrp_url; ?>/modules/shadowbox/src/shadowbox.js"></script>
<script type="text/javascript">
<?php $this->initJS(); ?>
</script>
<?php
}
public static function initJS(){
$config = Config::current();
?>//<script>
console.log("shadowbox loaded");
$(document).ready(function(){
//add attr to img linkwhich width>100
$("#content img").each(function(e){
var a = $(this).parent();
if (a.attr("class")!="liked" && a.attr("class")!="like")
a.attr("rel","shadowbox");
});
$("#content a").each(function(e){
var img = $("img",this)[0];
});
//init shadowbox
Shadowbox.init({
<?php
echo $config->module_sb["initSetup"];
?>
});
});
<?php
}
}
| parttimenerd/chyrp_de | modules/shadowbox/shadowbox.php | PHP | mit | 2,824 |
module EasySerializer
class Cacher
attr_reader :serializer, :metadata
def initialize(serializer, metadata)
@serializer = serializer
@metadata = metadata
end
def execute
CacheOutput.new(_execute)
end
private
def _execute
strategy = if metadata.is_a?(EasySerializer::Collection)
Collection
elsif metadata.serializer?
Serializer
else
Method
end
strategy.call(serializer, metadata)
end
end
end
require 'easy_serializer/cacher/template'
require 'easy_serializer/cacher/collection'
require 'easy_serializer/cacher/method'
require 'easy_serializer/cacher/serializer'
| arturictus/easy_serializer | lib/easy_serializer/cacher.rb | Ruby | mit | 738 |
'use strict';
describe('Controller: HomeCtrl', function () {
it('should make a unit test ...', function () {
});
});
| topheman/cycle-infos | test/spec/controllers/home.js | JavaScript | mit | 123 |
<?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Core\Action;
use Fig\Http\Message\StatusCodeInterface;
use GuzzleHttp\Psr7\Response;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Shlinkio\Shlink\Core\Crawling\CrawlingHelperInterface;
use function sprintf;
use const PHP_EOL;
class RobotsAction implements RequestHandlerInterface, StatusCodeInterface
{
public function __construct(private CrawlingHelperInterface $crawlingHelper)
{
}
public function handle(ServerRequestInterface $request): ResponseInterface
{
// @phpstan-ignore-next-line The "Response" phpdoc is wrong
return new Response(self::STATUS_OK, ['Content-type' => 'text/plain'], $this->buildRobots());
}
private function buildRobots(): iterable
{
yield <<<ROBOTS
# For more information about the robots.txt standard, see:
# https://www.robotstxt.org/orig.html
User-agent: *
ROBOTS;
$shortCodes = $this->crawlingHelper->listCrawlableShortCodes();
foreach ($shortCodes as $shortCode) {
yield sprintf('Allow: /%s%s', $shortCode, PHP_EOL);
}
yield 'Disallow: /';
}
}
| shlinkio/shlink | module/Core/src/Action/RobotsAction.php | PHP | mit | 1,270 |
import cx_Freeze
import sys
import os
executables = [cx_Freeze.Executable("MusicCompiler.py", base=None)]
cx_Freeze.setup(
name= "MusicCompiler",
description = "Best Program Ever Known To Humanity.",
author = "Space Sheep Enterprises",
options = {"build_exe":{"excludes":["urllib","html","http","tkinter","socket","multiprocessing","threading","email","htmllib"]}},
version = "1.0",
executables = executables
)
| Jonathan-Z/PowerShellMusic | setup.py | Python | mit | 457 |
package com.anji_ahni.nn.activationfunction;
/**
* Square-root function.
*
* @author Oliver Coleman
*/
public class PowerActivationFunction implements ActivationFunction, ActivationFunctionNonIntegrating {
/**
* identifying string
*/
public final static String NAME = "power";
/**
* @see Object#toString()
*/
public String toString() {
return NAME;
}
/**
* This class should only be accessd via ActivationFunctionFactory.
*/
PowerActivationFunction() {
// no-op
}
/**
* Not used, returns 0.
*/
@Override
public double apply(double input) {
return 0;
}
/**
* Return first input raised to the power of the absolute value of the second input (or just first input if no second input).
*/
@Override
public double apply(double[] input, double bias) {
if (input.length < 2)
return input[0];
double v = Math.pow(input[0], Math.abs(input[1]));
if (Double.isNaN(v)) return 0;
if (Double.isInfinite(v)) return v < 0 ? -Double.MAX_VALUE / 2 : Double.MAX_VALUE / 2;
return v;
}
/**
* @see com.anji_ahni.nn.activationfunction.ActivationFunction#getMaxValue()
*/
public double getMaxValue() {
return Double.MAX_VALUE;
}
/**
* @see com.anji_ahni.nn.activationfunction.ActivationFunction#getMinValue()
*/
public double getMinValue() {
return -Double.MAX_VALUE;
}
/**
* @see com.anji_ahni.nn.activationfunction.ActivationFunction#cost()
*/
public long cost() {
return 75;
}
}
| Fumaloko92/MSc-Thesis | 17-05-2017/neuralturingmachines-master/src/com/anji_ahni/nn/activationfunction/PowerActivationFunction.java | Java | mit | 1,453 |
using EasyLOB.Data;
using System.Collections.Generic;
namespace Chinook.Data
{
public partial class Customer
{
#region Profile
public static IZProfile Profile { get; private set; } = new ZProfile
(
Name: "Customer",
IsIdentity: true,
Keys: new List<string> { "CustomerId" },
Lookup: "FirstName",
LINQOrderBy: "FirstName",
LINQWhere: "CustomerId == @0",
Associations: new List<string>
{
"Employee",
},
Collections: new Dictionary<string, bool>
{
{ "CustomerDocuments", true },
{ "Invoices", true }
},
Properties: new List<IZProfileProperty>
{
// Grd Grd Grd Edt Edt Edt
// Vis Src Wdt Vis RO CSS Name
new ZProfileProperty(false, true , 50, false, false, "col-md-1", "CustomerId"),
new ZProfileProperty(true , true , 200, true , false, "col-md-4", "FirstName"),
new ZProfileProperty(true , true , 200, true , false, "col-md-2", "LastName"),
new ZProfileProperty(false, true , 200, true , false, "col-md-4", "Company"),
new ZProfileProperty(false, true , 200, true , false, "col-md-4", "Address"),
new ZProfileProperty(false, true , 200, true , false, "col-md-4", "City"),
new ZProfileProperty(false, true , 200, true , false, "col-md-4", "State"),
new ZProfileProperty(false, true , 200, true , false, "col-md-4", "Country"),
new ZProfileProperty(false, true , 100, true , false, "col-md-1", "PostalCode"),
new ZProfileProperty(false, true , 200, true , false, "col-md-3", "Phone"),
new ZProfileProperty(false, true , 200, true , false, "col-md-3", "Fax"),
new ZProfileProperty(false, true , 200, true , false, "col-md-4", "Email"),
new ZProfileProperty(false, false, 50, true , false, "col-md-1", "SupportRepId"),
new ZProfileProperty(true , true , 200, false, false, "col-md-4", "EmployeeLookupText")
}
);
#endregion Profile
}
}
| EasyLOB/EasyLOB-Chinook-2 | Chinook.Data/Profiles/CustomerProfile.cs | C# | mit | 2,406 |
using System;
class PrintLongSequence
{
static void Main(string[] args)
{
for (int i = 2; i <= 1002; i++)
{
if ((i%2)==0)
{
Console.WriteLine(i);
}
else
{
Console.WriteLine(-i);
}
}
}
}
| KrisPetkov/Test-repository | Intro-Programming/16.Print-Long-Sequence/PrintLongSequence.cs | C# | mit | 331 |
<?php
namespace App\Jobs\Auth;
use App\Jobs\Job;
use App\Storage\EmailConfirmation\EmailConfirmationRepository;
use Illuminate\Support\Facades\Mail;
class SendEmailChangeConfirmation extends Job
{
protected $newEmail;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($newEmail)
{
$this->newEmail = $newEmail;
}
/**
* Execute the job.
*
* @return void
*/
public function handle(EmailConfirmationRepository $tokens)
{
$token = str_random(5);
$tokens->store($this->newEmail, $token);
Mail::queue('emails.auth.email_change_confirmation', ['new_email' => $this->newEmail, 'token' => $token], function ($m) {
$m->to($this->newEmail)->subject('Email Change');
});
}
}
| adiachenko/catchy_api | app/Jobs/Auth/SendEmailChangeConfirmation.php | PHP | mit | 828 |
using System; //default
using System.Collections.Generic; //dictionary,list
using System.Linq; //because jon skeet
using NetFwTypeLib; //firewall library
using System.Net.Sockets; //protocol enum
using System.Net; //IPAddress class
namespace msfw
{
/// <summary>
/// Provides a wrapper around the INetFwRule2 class and adds support for "serializing" the
/// rule into the same format as what is stored in the registry for group policy firewall rules
/// </summary>
public class MSFirewallRule
{
public INetFwRule2 rule;
public NET_FW_ACTION_ Action { get { return this.rule.Action; } }
public string ActionName { get { return MSFirewall.getActionName(this.rule.Action); } }
public string ApplicationName { get { return this.rule.ApplicationName; } }
public string AppAndService { get { return this.getAppAndService(); } }
public NET_FW_RULE_DIRECTION_ Direction { get { return this.rule.Direction; } }
public string DirectionName { get { return MSFirewall.getDirectionName(this.rule.Direction); } }
public bool Enabled { get { return this.rule.Enabled; } }
public string LocalAddresses { get { return this.getLocalAddresses(); } }
public string LocalPorts { get { return this.rule.LocalPorts ?? "*"; } }
public string Name { get { return this.rule.Name; } }
public int Profiles { get { return this.rule.Profiles; } }
public int Protocol { get { return this.rule.Protocol; } }
public string ProtocolName { get { return Enum.GetName(typeof(ProtocolType), rule.Protocol) ?? "*"; } }
public string RemoteAddresses { get { return this.getRemoteAddresses(); } }
public string RemotePorts { get { return this.rule.RemotePorts ?? "*"; } }
public string ServiceName { get { return this.rule.serviceName; } }
public bool Extended { get { return this.isExtended(); } }
/// <summary>
/// Constructor: takes in INetFwRule2.</summary>
public MSFirewallRule(INetFwRule2 rule)
{
this.rule = rule;
}
/// <summary>Constructor: Input is a "serialized" rule like one found in
/// "Software\Policies\Microsoft\WindowsFirewall\FirewallRules".</summary>
/// <remarks>See more details in the <see cref="parseRule"/> method</remarks>
public MSFirewallRule(string rulestr)
: this(rulestr, new Dictionary<string, string>())
{
}
/// <summary>
/// Constructor: Input is a "serialized" fw rule string like one found in
/// "Software\Policies\Microsoft\WindowsFirewall\FirewallRules"</summary>
/// <remarks>Allows variable substitution for key/values by providing
/// a dictionary of substitute information.
/// This is necessary since the registry rules store name/description
/// information in separate key/values.
/// See more details in the <see cref="parseRule"/> method</remarks>
public MSFirewallRule(string rulestr, Dictionary<string, string> info)
{
this.rule = this.parseRule(rulestr, info);
}
/// <summary>If rule contains attributes other than basic</summary>
/// <remarks>Basic attribures are:
/// 1. Action (Block, Allow)
/// 2. Direction (In, Out)
/// 3. Local IP Address/Port
/// 4. Remote IP Address/Port
/// 5. Application Name
/// 6. Rule Name</remarks>
private bool isExtended()
{
//basic
bool extended = false;
//if edge is false, then options is false
//rule.EdgeTraversal;
//rule.EdgeTraversalOptions;
if (this.rule.EdgeTraversal)
{
//Console.WriteLine("Edge:TRUE");
extended = true;
}
// "RemoteAccess", "Wireless", "Lan", and "All"
if(rule.InterfaceTypes != "All")
{
//Console.WriteLine("InterfaceTypes not all");
extended = true;
}
if (rule.Interfaces != null)
{
//Console.WriteLine("Interfaces not null");
extended = true;
}
if (rule.IcmpTypesAndCodes != null)
{
// Console.WriteLine("Icmp types and codes not all");
extended = true;
}
return extended;
}
/// <summary>Combines Application Name and Service Name</summary>
private string getAppAndService()
{
var appname = "*";
if (this.rule.ApplicationName != null)
{
appname = this.rule.ApplicationName;
if (this.rule.serviceName != null)
{
appname += ":" + this.rule.serviceName;
}
}
return appname;
}
/// <summary>Returns IP address, removing subnet mask for individual IPs (IPv4)</summary>
private string getLocalAddresses()
{
// TOOD: Support IPv6 LocalAddresses
var laddress = rule.LocalAddresses;
if (laddress.Contains("/255.255.255.255"))
{
laddress = laddress.Replace("/255.255.255.255", "");
}
return laddress ?? "*";
}
/// <summary>Returns IP address, removing subnet mask for individual IPs (IPv4)</summary>
private string getRemoteAddresses()
{
// TOOD: Support IPv6 RemoteAddresses
var raddress = rule.RemoteAddresses;
if (raddress.Contains("/255.255.255.255"))
{
raddress = raddress.Replace("/255.255.255.255", "");
}
return raddress ?? "*";
}
/// <summary>Parses a rule str to make a INetFwRule2</summary>
/// <remarks>This rule string is found in group policy rules and is undocumented,
/// as far as I can tell. I've done my best to document my findings here.
///
/// Field : rule Mapping : Values : Example
///"Action" : rule.Action : Allow,Block : Action=Allow
///"App" : rule.ApplicationName : Text : App=onenote.exe
///"Desc" : rule.Description : Text : Desc=My rule description
///"Dir" : rule.Direction : In,Out : Dir=In
///"Edge" : rule.EdgeTraversal : Bool : Edge=TRUE
///"Defer" : rule.EdgeTraversalOption : App,? : Defer=App
///"Active" : rule.Enabled : Bool : Active=TRUE
///"EmbedCtxt" : rule.Grouping : Text : EmbedCtxt=Core Networking
///"ICMP4","ICMP6" : rule.IcmpTypesAndCodes : :
///????????????????????? : rule.Interfaces : ??? :
///????????????????????? : rule.InterfaceTypes : ??? :
///"LA4","LA6" : rule.LocalAddresses : IP(s) or Enum : LA4=10.10.10.10 or LocalSubnet or ?
///"LPort","LPort2_10" : rule.LocalPorts : Port(s) or Enum : LPort=4500 or ?
///"Name" : rule.Name : Text : Name=My rule name
///"Profile" : rule.Profiles : Domain,Private,Public : Profile=Domain
///"Protocol" : rule.Protocol : ProtocolType : Protocol=6
///"RA4", "RA6" : rule.RemoteAddresses : IP(s) or Enum : RA4=10.10.10.10 or LocalSubnet or ?
///"RPort","RPort2_10" : rule.RemotePorts : Port(s) or Enum : RPort=4500 or ?
///"Svc" : rule.serviceName : Text : Svc=upnphost
///
/// Additional notes on fields:
///
/// All lists are comma-delimited
/// If not present, booleans are FALSE and normally restrictive fields allow all
/// "Action" : required. Will be "Allow" or "Block"
/// "App" : optional. Will be a complete path to an executable. Will be a complete path to svchost.exe if using "Svc" field
/// "Desc" : optional. Variable substitution needed for rules from registry.
/// "Dir" : required. Will be "In" or "Out"
/// "Edge" : optional. Will be "TRUE". Default is "FALSE"
/// "Defer" : optional. See enum NET_FW_EDGE_TRAVERSAL_TYPE_ for values. Only appears if "Edge" is TRUE and only used for DEFER_TO_APP and DEFER_TO_USER
/// "Active" : required. Will be "TRUE" or "FALSE"
/// "EmbedCtxt" : optional. Variable substitution needed for rules from registry.
/// "ICMP4" : optional. If Protocol is "Icmp", then list of allowed ICMP (v4) types and codes
/// "ICMP6" : optional. If Protocol is "IcmpV6", then list of allowed ICMP (v6) types and codes
/// "LA4" : optional. IPv4 Addresses (single, range, or subnet). Not allowed if "ICMP6" is defined.
/// "LA6" : optional. IPv6 Addresses (single, range, or subnet). Not allowed if "ICMP4" is defined.
/// "LPort" : optional. Port or port range.
/// TODO: complete field documentation
/// </remarks>
public INetFwRule2 parseRule(string rulestr, Dictionary<string, string> info)
{
INetFwRule2 rule = (INetFwRule2)Activator.CreateInstance(Type.GetTypeFromProgID("HNetCfg.FWRule"));
string[] ruleAttribs = rulestr.Split('|');
foreach (string ra in ruleAttribs)
{
var kv = ra.Split('=');
switch (kv[0])
{
case "":
case "v2.10":
//version ignore
break;
case "Action":
kv[1] = kv[1].ToLower();
if (kv[1] == "allow")
{
rule.Action = NET_FW_ACTION_.NET_FW_ACTION_ALLOW;
}
else if (kv[1] == "block")
{
rule.Action = NET_FW_ACTION_.NET_FW_ACTION_BLOCK;
}
else if (kv[1] == "max")
{
rule.Action = NET_FW_ACTION_.NET_FW_ACTION_MAX;
}
else
{
throw new Exception("parseRule: Unknown action in rule: " + kv[1]);
}
break;
case "Active":
kv[1] = kv[1].ToLower();
if (kv[1] == "true")
{
rule.Enabled = true;
}
else
{
rule.Enabled = false;
}
break;
case "App":
rule.ApplicationName = kv[1];
break;
case "Defer":
kv[1] = kv[1].ToLower();
if (kv[1] == "app")
{
rule.EdgeTraversalOptions = (int)NET_FW_EDGE_TRAVERSAL_TYPE_.NET_FW_EDGE_TRAVERSAL_TYPE_DEFER_TO_APP;
}
else
{
rule.EdgeTraversalOptions = (int)Enum.Parse(typeof(NET_FW_EDGE_TRAVERSAL_TYPE_), kv[1]);
}
break;
case "Desc":
if (info.ContainsKey(kv[1]))
{
rule.Description = info[kv[1]];
}
else
{
rule.Description = kv[1];
}
break;
case "Dir":
kv[1] = kv[1].ToLower();
if (kv[1] == "in")
{
rule.Direction = NET_FW_RULE_DIRECTION_.NET_FW_RULE_DIR_IN;
}
else if (kv[1] == "out")
{
rule.Direction = NET_FW_RULE_DIRECTION_.NET_FW_RULE_DIR_OUT;
}
else if (kv[1] == "max")
{
rule.Direction = NET_FW_RULE_DIRECTION_.NET_FW_RULE_DIR_MAX;
}
else
{
throw new Exception("parseRule: Unknown direction in rule: " + kv[1]);
}
break;
case "Edge":
kv[1] = kv[1].ToLower();
if (kv[1] == "true")
{
rule.EdgeTraversal = true;
}
else
{
rule.EdgeTraversal = false;
}
break;
case "EmbedCtxt":
if (info.ContainsKey(kv[1]))
{
rule.Grouping = info[kv[1]];
}
else
{
rule.Grouping = kv[1];
}
break;
case "ICMP4":
case "ICMP6":
if (rule.IcmpTypesAndCodes == "*")
{
rule.IcmpTypesAndCodes = kv[1];
}
else
{
//Console.WriteLine(rule.IcmpTypesAndCodes + " " + kv[1]);
rule.IcmpTypesAndCodes += "," + kv[1];
}
break;
case "LA4":
case "LA6":
if (rule.LocalAddresses == "*")
{
rule.LocalAddresses = kv[1];
}
else if (!rule.LocalAddresses.Contains(kv[1]))
{
rule.LocalAddresses += "," + kv[1];
}
break;
case "LPort":
if (rule.LocalPorts == "*")
{
//Console.WriteLine("init:" + kv[1]);
rule.LocalPorts = kv[1];
}
else
{
//Console.WriteLine("append: '" + rule.LocalPorts.ToString() + "'" + ":" + kv[1]);
rule.LocalPorts = rule.LocalPorts.ToString() + "," + kv[1];
}
break;
case "LPort2_10":
//todo:IPHTTPS maps to IPHTTPSIn AND IPTLSIn
//warning: unknown if correct; no example yet
rule.LocalPorts = kv[1];
break;
case "Name":
if (info.ContainsKey(kv[1]))
{
rule.Name = info[kv[1]];
}
else
{
rule.Name = kv[1];
}
break;
case "Profile":
if (rule.Profiles == (int)NET_FW_PROFILE_TYPE2_.NET_FW_PROFILE2_ALL)
{
switch (kv[1])
{
case "Domain":
rule.Profiles = (int)NET_FW_PROFILE_TYPE2_.NET_FW_PROFILE2_DOMAIN;
break;
case "Private":
rule.Profiles = (int)NET_FW_PROFILE_TYPE2_.NET_FW_PROFILE2_PRIVATE;
break;
case "Public":
rule.Profiles = (int)NET_FW_PROFILE_TYPE2_.NET_FW_PROFILE2_PUBLIC;
break;
}
}
else
{
switch (kv[1])
{
case "Domain":
rule.Profiles = rule.Profiles | (int)NET_FW_PROFILE_TYPE2_.NET_FW_PROFILE2_DOMAIN;
break;
case "Private":
rule.Profiles = rule.Profiles | (int)NET_FW_PROFILE_TYPE2_.NET_FW_PROFILE2_PRIVATE;
break;
case "Public":
rule.Profiles = rule.Profiles | (int)NET_FW_PROFILE_TYPE2_.NET_FW_PROFILE2_PUBLIC;
break;
}
}
break;
case "Protocol":
rule.Protocol = Int32.Parse(kv[1]);
break;
case "RA4":
case "RA6":
if (rule.RemoteAddresses == "*")
{
rule.RemoteAddresses = kv[1];
}
else if (!rule.RemoteAddresses.Contains(kv[1]))
{
rule.RemoteAddresses += "," + kv[1];
}
//Console.WriteLine(rule.RemoteAddresses + " + " + kv[1]);
//Console.WriteLine(rule.RemoteAddresses);
break;
case "RPort":
if (rule.RemotePorts == "*")
{
//Console.WriteLine("init:" + kv[1]);
rule.RemotePorts = kv[1];
}
else
{
//Console.WriteLine("append: '" + rule.RemotePorts.ToString() + "'" + ":" + kv[1]);
rule.RemotePorts += "," + kv[1];
}
break;
case "RPort2_10":
//does IPHTTPS maps to IPHTTPSOut AND IPTLSOut ????
//warning: unknown if correct; no example yet
rule.RemotePorts = kv[1];
break;
case "Svc":
rule.serviceName = kv[1];
break;
default:
throw new Exception("Uknown firewall rule type:" + kv[0]);
}
}
if (((rule.Profiles & (int)NET_FW_PROFILE_TYPE2_.NET_FW_PROFILE2_DOMAIN) == (int)NET_FW_PROFILE_TYPE2_.NET_FW_PROFILE2_DOMAIN) &&
((rule.Profiles & (int)NET_FW_PROFILE_TYPE2_.NET_FW_PROFILE2_PRIVATE) == (int)NET_FW_PROFILE_TYPE2_.NET_FW_PROFILE2_PRIVATE) &&
((rule.Profiles & (int)NET_FW_PROFILE_TYPE2_.NET_FW_PROFILE2_PUBLIC) == (int)NET_FW_PROFILE_TYPE2_.NET_FW_PROFILE2_PUBLIC)
)
{
rule.Profiles = (int)NET_FW_PROFILE_TYPE2_.NET_FW_PROFILE2_ALL;
}
return rule;
}
/// <summary>Returns the rule as a string using the same format as the group policy rules that are found in the registry</summary>
public override string ToString()
{
//todo: rule.Interfaces
//todo: rule.InterfaceTypes
INetFwRule2 rule = this.rule;
string rs = "v2.10";
var aorder = new List<string> { "Action", "Active", "Dir", "Protocol", "Profile", "ICMP4", "ICMP6", "LPort", "LPort2_10", "RPort", "RPort2_10", "LA4", "LA6", "RA4", "RA6", "App", "Svc", "Name", "Desc", "EmbedCtxt", "Edge", "Defer" };
var attributes = new Dictionary<string, List<string>>();
var strAddresses = new List<string> { "LocalSubnet", "DHCP", "DNS", "WINS", "DefaultGateway" };
IPAddress address;
var curA = "";
//required: if not present then "All"
curA = "Profile";
var fwProfiles = Enum.GetValues(typeof(NET_FW_PROFILE_TYPE2_));
foreach (NET_FW_PROFILE_TYPE2_ fwProfile in fwProfiles)
{
if (((NET_FW_PROFILE_TYPE2_)rule.Profiles & fwProfile) == fwProfile)
{
if (!attributes.ContainsKey(curA))
attributes.Add(curA, new List<string>());
attributes[curA].Add(curA + "=" + MSFirewall.getProfileName(fwProfile));
}
}
if ((NET_FW_PROFILE_TYPE2_)rule.Profiles == NET_FW_PROFILE_TYPE2_.NET_FW_PROFILE2_ALL)
{
attributes.Remove(curA);
}
//optional
if (rule.Grouping != null)
{
curA = "EmbedCtxt";
attributes.Add(curA, new List<string> { curA + "=" + rule.Grouping });
}
//required
curA = "Name";
attributes.Add(curA, new List<string> { curA + "=" + rule.Name });
//required
curA = "Action";
attributes.Add(curA, new List<string> { curA + "=" + MSFirewall.getActionName(rule.Action) });
//optional
if (rule.Description != null)
{
curA = "Desc";
attributes.Add(curA, new List<string> { curA + "=" + rule.Description });
}
//required
curA = "Dir";
attributes.Add(curA, new List<string> { curA + "=" + MSFirewall.getDirectionName(rule.Direction) });
if (rule.ApplicationName != null)
{
curA = "App";
if (!attributes.ContainsKey(curA))
attributes.Add(curA, new List<string>());
attributes[curA].Add(curA + "=" + rule.ApplicationName);
}
if (rule.serviceName != null)
{
curA = "Svc";
if (!attributes.ContainsKey(curA))
attributes.Add(curA, new List<string>());
attributes[curA].Add(curA + "=" + rule.serviceName);
}
if (rule.LocalPorts != "*" && rule.LocalPorts != null)
{
foreach (string r in rule.LocalPorts.Split(','))
{
if (r == "IPHTTPS")
{
curA = "LPort2_10";
if (rule.Direction == NET_FW_RULE_DIRECTION_.NET_FW_RULE_DIR_IN)
{
attributes.Add(curA, new List<string>());
attributes[curA].Add(curA + "=IPTLSIn");
attributes[curA].Add(curA + "=IPHTTPSIn");
}
else
{
attributes.Add(curA, new List<string>());
attributes[curA].Add(curA + "=IPTLSOut");
attributes[curA].Add(curA + "=IPHTTPSOut");
}
}
else
{
curA = "LPort";
if (!attributes.ContainsKey(curA))
attributes.Add(curA, new List<string>());
attributes[curA].Add(curA + "=" + r);
}
}
}
if (rule.LocalAddresses != null && rule.LocalAddresses != "*")
{
var ra = rule.LocalAddresses.Split(',');
foreach (string r in ra)
{
curA = "";
if (strAddresses.Contains(r))
{
curA = "LA4,LA6";
}
else if (IPAddress.TryParse(r, out address))
{
switch (address.AddressFamily)
{
case System.Net.Sockets.AddressFamily.InterNetwork:
curA = "LA4";
break;
case System.Net.Sockets.AddressFamily.InterNetworkV6:
curA = "LA6";
break;
default:
throw new Exception("Unknown remote address: {0}" + r);
}
}
else if (r.Contains(':'))
{
curA = "LA6";
}
else
{
curA = "LA4";
}
if (curA != "")
{
foreach (string a in curA.Split(','))
{
if (!attributes.ContainsKey(a))
attributes.Add(a, new List<string>());
var sub = false;
if (r.Contains('-'))
{
var rtest = r.Split('-');
if (rtest[0] == rtest[1])
{
attributes[a].Add(a + "=" + rtest[0]);
sub = true;
}
}
else if (r.Contains("/255.255.255.255"))
{
var rtest = r.Split('/');
attributes[a].Add(a + "=" + rtest[0]);
sub = true;
}
if (!sub)
{
attributes[a].Add(a + "=" + r);
}
}
}
}
}
if (rule.RemotePorts != "*" && rule.RemotePorts != null)
{
foreach (string r in rule.RemotePorts.Split(','))
{
if (r == "IPHTTPS")
{
curA = "RPort2_10";
if (rule.Direction == NET_FW_RULE_DIRECTION_.NET_FW_RULE_DIR_IN)
{
attributes.Add(curA, new List<string>());
attributes[curA].Add(curA + "=IPTLSIn");
attributes[curA].Add(curA + "=IPHTTPSIn");
}
else
{
attributes.Add(curA, new List<string>());
attributes[curA].Add(curA + "=IPTLSOut");
attributes[curA].Add(curA + "=IPHTTPSOut");
}
}
else
{
curA = "RPort";
if (!attributes.ContainsKey(curA))
attributes.Add(curA, new List<string>());
attributes[curA].Add(curA + "=" + r);
}
}
}
//if any, not present
if (rule.RemoteAddresses != null && rule.RemoteAddresses != "*")
{
var ra = rule.RemoteAddresses.Split(',');
foreach (string r in ra)
{
curA = "";
if (strAddresses.Contains(r))
{
curA = "RA4,RA6";
}
else if (IPAddress.TryParse(r, out address))
{
switch (address.AddressFamily)
{
case System.Net.Sockets.AddressFamily.InterNetwork:
curA = "RA4";
break;
case System.Net.Sockets.AddressFamily.InterNetworkV6:
curA = "RA6";
break;
default:
throw new Exception("Unknown remote address: {0}" + r);
}
}
else if (r.Contains(':'))
{
curA = "RA6";
}
else
{
curA = "RA4";
}
if (curA != "")
{
foreach (string a in curA.Split(','))
{
if (!attributes.ContainsKey(a))
attributes.Add(a, new List<string>());
var sub = false;
if (r.Contains('-'))
{
var rtest = r.Split('-');
if (rtest[0] == rtest[1])
{
attributes[a].Add(a + "=" + rtest[0]);
sub = true;
}
}
else if (r.Contains("/255.255.255.255"))
{
var rtest = r.Split('/');
attributes[a].Add(a + "=" + rtest[0]);
sub = true;
}
if (!sub)
{
attributes[a].Add(a + "=" + r);
}
}
}
}
}
//if any, then no setting
if (rule.Protocol != 256) //any
{
curA = "Protocol";
if (!attributes.ContainsKey(curA))
attributes.Add(curA, new List<string>());
attributes[curA].Add(curA + "=" + rule.Protocol);
}
//required
curA = "Active";
if (rule.Enabled)
attributes.Add(curA, new List<string> { curA + "=TRUE" });
else
attributes.Add(curA, new List<string> { curA + "=FALSE" });
//if not present, then false
if (rule.EdgeTraversal)
{
curA = "Edge";
attributes.Add(curA, new List<string> { curA + "=TRUE" });
}
//if any, then no setting
curA = "Defer";
if (rule.EdgeTraversalOptions > 0)
{
if (rule.EdgeTraversalOptions == (int)NET_FW_EDGE_TRAVERSAL_TYPE_.NET_FW_EDGE_TRAVERSAL_TYPE_DEFER_TO_APP)
{
if (!attributes.ContainsKey(curA))
attributes.Add(curA, new List<string>());
attributes[curA].Add(curA + "=App");
}
else if (rule.EdgeTraversalOptions == (int)NET_FW_EDGE_TRAVERSAL_TYPE_.NET_FW_EDGE_TRAVERSAL_TYPE_ALLOW)
{
//do nothing because rule.EdgeTraversal should be set to true already
}
else
{
if (!attributes.ContainsKey(curA))
attributes.Add(curA, new List<string>());
attributes[curA].Add(curA + "=" + rule.EdgeTraversalOptions);
}
}
if (rule.IcmpTypesAndCodes != null)
{
if (rule.Protocol == 1)
{
curA = "ICMP4";
}
else if (rule.Protocol == 58)
{
curA = "ICMP6";
}
if (!attributes.ContainsKey(curA))
attributes.Add(curA, new List<string>());
attributes[curA].Add(curA + "=" + rule.IcmpTypesAndCodes);
}
//ICMPv6 shouldn't have v4 local addresses and vice versa
// TODO: add 41,43,44,59,60 (test first)
if (rule.Protocol == 58 && attributes.ContainsKey("LA4"))
{
attributes.Remove("LA4");
}
else if (rule.Protocol == 1 && attributes.ContainsKey("LA6"))
{
attributes.Remove("LA6");
}
//ICMPv6 shouldn't have v4 remote addresses and vice versa
// TODO: add 41,43,44,59,60 (test first)
if (rule.Protocol == 58 && attributes.ContainsKey("RA4"))
{
attributes.Remove("RA4");
}
else if (rule.Protocol == 1 && attributes.ContainsKey("RA6"))
{
attributes.Remove("RA6");
}
//preserve order of keys
foreach (var a in aorder)
{
if (attributes.ContainsKey(a))
{
rs = rs + "|" + String.Join("|", attributes[a]);
}
}
rs = rs + "|";
return rs;
}
}
} | caesarshift/msfw | msfw/MSFirewallRule.cs | C# | mit | 34,510 |
const
pObj=pico.export('pico/obj'),
fb=require('api/fbJSON'),
rdTrip=require('redis/trip')
return {
setup(context,cb){
cb()
},
addPickup(user,action,evt,name,next){
const text=pObj.dotchain(evt,['message','text'])
if(!text) return next(null,`fb/ask${action[action.length-1]}`)
const a=action.pop()
switch(a){
case 'TripFirstPickup':
switch(text.toLowerCase()){
case 'done': return next(null,`fb/ask${a}`)
default:
action.push('-',text)
this.set(name,'TripPickup')
break
}
break
case 'TripPickup':
switch(text.toLowerCase()){
case 'done':
action.push('+:pickup',null)
this.set(name,'TripFirstDropoff')
break
default:
action.push('-',text)
this.set(name,'TripPickup')
break
}
break
default: return next(null,`fb/ask${a}`)
}
next()
},
addDropoff(user,action,evt,name,next){
const text=pObj.dotchain(evt,['message','text'])
if(!text) return next(null,`fb/ask${action[action.length-1]}`)
const a=action.pop()
switch(a){
case 'TripFirstDropoff':
switch(text.toLowerCase()){
case 'done': return next(null,`fb/ask${a}`)
default:
action.push('-',text)
this.set(name,'TripDropoff')
break
}
break
case 'TripDropoff':
switch(text.toLowerCase()){
case 'done':
action.push('+:dropoff',null)
this.set(name,'TripSeat')
break
default:
action.push('-',text)
this.set(name,'TripDropoff')
break
}
break
default: return next(null,`fb/ask${a}`)
}
next()
},
done(user,cmd,msg,next){
console.log('addTrp.done',user,cmd)
rdTrip.set(user,cmd,(err)=>{
if (err) Object.assign(msg, fb.message(user,fb.text(`An error has encountered when adding your trip: ${err}.\ntype help for more action`)))
else Object.assign(msg, fb.message(user,fb.text(`New trip on ${fb.toDateTime(user,cmd.date)} has been added.\ntype help for more action`)))
next()
})
}
}
| ldarren/mysg | api/addTrip.js | JavaScript | mit | 1,913 |
/*
* Property of RECAPT http://recapt.com.ec/
* Chief Developer Ing. Eduardo Alfonso Sanchez eddie.alfonso@gmail.com
*/
package com.recapt.domain;
import java.time.LocalDateTime;
/**
*
* @author Eduardo
*/
public class IssueHistory {
private String name;
private String description;
private String reference;
private LocalDateTime created;
private Usuario createBy;
private Issue issue;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getReference() {
return reference;
}
public void setReference(String reference) {
this.reference = reference;
}
public LocalDateTime getCreated() {
return created;
}
public void setCreated(LocalDateTime created) {
this.created = created;
}
public Usuario getCreateBy() {
return createBy;
}
public void setCreateBy(Usuario createBy) {
this.createBy = createBy;
}
public Issue getIssue() {
return issue;
}
public void setIssue(Issue issue) {
this.issue = issue;
}
}
| edecisions/recapt | src/main/java/com/recapt/domain/IssueHistory.java | Java | mit | 1,356 |
"use strict";
var testCase = require('nodeunit').testCase,
path = require('path'),
fs = require('fs'),
avconv;
function read(stream, callback) {
var output = [],
err = [];
stream.on('data', function(data) {
output.push(data);
});
stream.on('error', function(data) {
err.push(data);
});
stream.once('end', function(exitCode, signal) {
callback(exitCode, signal, output, err);
});
}
module.exports = testCase({
'TC 1: stability tests': testCase({
'loading avconv function (require)': function(t) {
t.expect(1);
avconv = require('../avconv.js');
t.ok(avconv, 'avconv is loaded.');
t.done();
},
'run without parameters (null) 1': function(t) {
t.expect(4);
var stream = avconv(null);
read(stream, function(exitCode, signal, output, err) {
t.strictEqual(exitCode, 1, 'avconv did nothing');
t.notEqual(output.length, 0, 'output is not empty');
t.strictEqual(err.length, 0, 'err is empty');
t.strictEqual(signal, null, 'Signal is null');
t.done();
});
},
'run with empty array ([])': function(t) {
t.expect(3);
var stream = avconv([]);
read(stream, function(exitCode, signal, output, err) {
t.strictEqual(exitCode, 1, 'avconv did nothing');
t.notEqual(output.length, 0, 'output is not empty');
t.strictEqual(err.length, 0, 'err is empty');
t.done();
});
},
'run with invalid string parameter (fdsfdsfsdf)': function(t) {
t.expect(1);
t.throws(
function() {
avconv('fdsfdsfsdf');
},
TypeError,
'a type error must be thrown here'
);
t.done();
},
'run with invalid array parameters ([fdsfdsfsdf])': function(t) {
t.expect(3);
var stream = avconv(['fdsfdsfsdf']);
read(stream, function(exitCode, signal, output, err) {
t.strictEqual(exitCode, 1, 'avconv did nothing');
t.notEqual(output.length, 0, 'stdout is not empty and contains a warning about the wrong parameter');
t.strictEqual(err.length, 0, 'stderr is still empty');
t.done();
});
}
}),
'TC 2: real tests': testCase({
'loading help (--help)': function(t) {
t.expect(3);
var stream = avconv(['--help']);
read(stream, function(exitCode, signal, output, err) {
t.strictEqual(exitCode, 0, 'avconv returned help');
t.notEqual(output.length, 0, 'stdout contains help');
t.strictEqual(err.length, 0, 'stderr is still empty');
t.done();
});
}
}),
'TC 3: do a conversion': testCase({
setUp: function(callback) {
this.exampleDir = path.join(__dirname, 'example');
var source = path.join(this.exampleDir, 'pokemon_card.webm');
try {
fs.unlinkSync(source);
} catch (exc) {
// ignore if it does not exist
}
callback();
},
'convert pokemon flv to webm': function(t) {
var params = [
'-i', path.join(this.exampleDir, 'pokemon_card.flv'),
'-c:v', 'libvpx',
'-deadline', 'realtime',
'-y', path.join(this.exampleDir, 'pokemon_card.webm')
];
var errors = '',
datas = '',
previousProgress = 0;
var stream = avconv(params);
stream.on('data', function(data) {
datas += data;
});
stream.on('progress', function(progress) {
t.ok(progress > previousProgress, 'Progress has been made');
t.ok(progress <= 1, 'Progress is never over 100%');
previousProgress = progress;
});
stream.on('meta', function(meta) {
t.strictEqual(meta.video.track, '0.0', 'Video track number is correct');
t.strictEqual(meta.video.codec, 'h264 (Main)', 'Video codec is correct');
t.strictEqual(meta.video.format, 'yuv420p', 'Video format is correct');
t.strictEqual(meta.video.width, 320, 'Video width is correct');
t.strictEqual(meta.video.height, 240, 'Video height is correct');
});
stream.on('error', function(data) {
errors += data;
});
stream.once('end', function(exitCode, signal) {
t.strictEqual(exitCode, 0, 'Video has been successfully generated');
t.strictEqual(errors, '', 'No errors occured at all');
t.strictEqual(signal, null, 'Signal is null');
t.ok(datas.length > 0, 'There is data');
t.done();
});
},
'convert and kill in the middle': function(t) {
var params = [
'-i', path.join(this.exampleDir, 'pokemon_card.flv'),
'-c:v', 'libvpx',
'-deadline', 'realtime',
'-y', path.join(this.exampleDir, 'pokemon_card.webm')
];
var errors = '';
var stream = avconv(params);
stream.on('error', function(data) {
errors += data;
});
stream.once('end', function(exitCode, signal) {
t.strictEqual(exitCode, null, 'There is no exit code when killed');
t.strictEqual(errors, '', 'No errors occured at all');
t.strictEqual(signal, 'SIGTERM', 'Signal is SIGTERM');
t.done();
});
setTimeout(function() {
stream.kill();
}, 10);
}
})
});
| olivererxleben/hipsterbility | serverside/node_modules/avconv/tests/basics.js | JavaScript | mit | 6,328 |
Clazz.declarePackage ("J.renderspecial");
Clazz.load (["J.render.ShapeRenderer"], "J.renderspecial.PolyhedraRenderer", ["JU.P3i", "JM.Atom", "JU.C"], function () {
c$ = Clazz.decorateAsClass (function () {
this.drawEdges = 0;
this.isAll = false;
this.frontOnly = false;
this.screens = null;
this.vibs = false;
Clazz.instantialize (this, arguments);
}, J.renderspecial, "PolyhedraRenderer", J.render.ShapeRenderer);
Clazz.overrideMethod (c$, "render",
function () {
var polyhedra = this.shape;
var polyhedrons = polyhedra.polyhedrons;
this.drawEdges = polyhedra.drawEdges;
this.g3d.addRenderer (1073742182);
this.vibs = (this.ms.vibrations != null && this.tm.vibrationOn);
var needTranslucent = false;
for (var i = polyhedra.polyhedronCount; --i >= 0; ) if (polyhedrons[i].isValid && this.render1 (polyhedrons[i])) needTranslucent = true;
return needTranslucent;
});
Clazz.defineMethod (c$, "render1",
function (p) {
if (p.visibilityFlags == 0) return false;
var colixes = (this.shape).colixes;
var iAtom = p.centralAtom.i;
var colix = (colixes == null || iAtom >= colixes.length ? 0 : colixes[iAtom]);
colix = JU.C.getColixInherited (colix, p.centralAtom.colixAtom);
var needTranslucent = false;
if (JU.C.renderPass2 (colix)) {
needTranslucent = true;
} else if (!this.g3d.setC (colix)) {
return false;
}var vertices = p.vertices;
var planes;
if (this.screens == null || this.screens.length < vertices.length) {
this.screens = new Array (vertices.length);
for (var i = vertices.length; --i >= 0; ) this.screens[i] = new JU.P3i ();
}planes = p.planes;
for (var i = vertices.length; --i >= 0; ) {
var atom = (Clazz.instanceOf (vertices[i], JM.Atom) ? vertices[i] : null);
if (atom == null) {
this.tm.transformPtScr (vertices[i], this.screens[i]);
} else if (!atom.isVisible (this.myVisibilityFlag)) {
this.screens[i].setT (this.vibs && atom.hasVibration () ? this.tm.transformPtVib (atom, this.ms.vibrations[atom.i]) : this.tm.transformPt (atom));
} else {
this.screens[i].set (atom.sX, atom.sY, atom.sZ);
}}
this.isAll = (this.drawEdges == 1);
this.frontOnly = (this.drawEdges == 2);
if (!needTranslucent || this.g3d.setC (colix)) for (var i = 0, j = 0; j < planes.length; ) this.fillFace (p.normixes[i++], this.screens[planes[j++]], this.screens[planes[j++]], this.screens[planes[j++]]);
if (p.colixEdge != 0) colix = p.colixEdge;
if (this.g3d.setC (JU.C.getColixTranslucent3 (colix, false, 0))) for (var i = 0, j = 0; j < planes.length; ) this.drawFace (p.normixes[i++], this.screens[planes[j++]], this.screens[planes[j++]], this.screens[planes[j++]]);
return needTranslucent;
}, "J.shapespecial.Polyhedron");
Clazz.defineMethod (c$, "drawFace",
function (normix, A, B, C) {
if (this.isAll || this.frontOnly && this.vwr.gdata.isDirectedTowardsCamera (normix)) {
this.drawCylinderTriangle (A.x, A.y, A.z, B.x, B.y, B.z, C.x, C.y, C.z);
}}, "~N,JU.P3i,JU.P3i,JU.P3i");
Clazz.defineMethod (c$, "drawCylinderTriangle",
function (xA, yA, zA, xB, yB, zB, xC, yC, zC) {
var d = (this.g3d.isAntialiased () ? 6 : 3);
this.g3d.fillCylinderScreen (3, d, xA, yA, zA, xB, yB, zB);
this.g3d.fillCylinderScreen (3, d, xB, yB, zB, xC, yC, zC);
this.g3d.fillCylinderScreen (3, d, xA, yA, zA, xC, yC, zC);
}, "~N,~N,~N,~N,~N,~N,~N,~N,~N");
Clazz.defineMethod (c$, "fillFace",
function (normix, A, B, C) {
this.g3d.fillTriangleTwoSided (normix, A.x, A.y, A.z, B.x, B.y, B.z, C.x, C.y, C.z);
}, "~N,JU.P3i,JU.P3i,JU.P3i");
});
| rishiloyola/jsmol-models | jsmol/j2s/J/renderspecial/PolyhedraRenderer.js | JavaScript | mit | 3,499 |
using System.Reflection;
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: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Grace.Tests")]
[assembly: AssemblyTrademark("")]
// 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("2a5e8af7-c99c-4bbc-bab6-cdfd100853f6")]
| ipjohnson/Grace | tests/Grace.Tests/Properties/AssemblyInfo.cs | C# | mit | 784 |
var taxi = require('..');
var chromedriver = require('chromedriver');
var fs = require('fs');
var user = process.env.SAUCE_USERNAME;
var accessKey = process.env.SAUCE_ACCESS_KEY;
var sauceLabsUrl = "http://" + user + ":" + accessKey + "@ondemand.saucelabs.com/wd/hub";
var tests = [
{ url:'http://localhost:9515/', capabilities: { browserName:'chrome' }, beforeFn: function () { chromedriver.start(); }, afterFn: function () { chromedriver.stop() } },
{ url:'http://localhost:9517/', capabilities: { browserName:'phantomjs', browserVersion:'1.9.8' } },
{ url:'http://localhost:4444/wd/hub', capabilities: { browserName:'firefox' } },
{ url:'http://makingshaking.corp.ne1.yahoo.com:4444', capabilities: { browserName:'phantomjs', browserVersion: '2.0.0 dev' } },
{ url:sauceLabsUrl, capabilities: { browserName:'chrome', version:'41.0', platform:'Windows 8.1' } },
{ url:sauceLabsUrl, capabilities: { browserName:'firefox', version:'37.0', platform:'Windows 8.1' } },
{ url:sauceLabsUrl, capabilities: { browserName:'internet explorer', version:'11.0', platform:'Windows 8.1' } },
{ url:sauceLabsUrl, capabilities: { browserName:'internet explorer', version:'10.0', platform:'Windows 8' } },
{ url:sauceLabsUrl, capabilities: { browserName:'internet explorer', version:'9.0', platform:'Windows 7' } },
{ url:sauceLabsUrl, capabilities: { browserName:'safari', version:'5.1', platform:'Windows 7' } },
{ url:sauceLabsUrl, capabilities: { browserName:'safari', version:'8.0', platform:'OS X 10.10' } },
{ url:sauceLabsUrl, capabilities: { browserName:'iphone', version:'8.2', platform: 'OS X 10.10', deviceName:'iPad Simulator', "device-orientation":'portrait' } },
{ url:sauceLabsUrl, capabilities: { browserName:'iphone', version:'8.2', platform: 'OS X 10.10', deviceName:'iPad Simulator', "device-orientation":'landscape' } },
{ url:sauceLabsUrl, capabilities: { browserName:'iphone', version:'8.2', platform: 'OS X 10.10', deviceName:'iPhone Simulator', "device-orientation":'portrait' } },
{ url:sauceLabsUrl, capabilities: { browserName:'iphone', version:'8.2', platform: 'OS X 10.10', deviceName:'iPhone Simulator', "device-orientation":'landscape' } }
];
tests.forEach(function (test) {
// Do we need to run something before the test-run?
if (test.beforeFn) {
test.beforeFn();
}
try {
var driver = taxi(test.url, test.capabilities, {mode: taxi.Driver.MODE_SYNC, debug: true, httpDebug: true});
var browser = driver.browser();
var activeWindow = browser.activeWindow();
// Navigate to Yahoo
activeWindow.navigator().setUrl('http://www.yahoo.com');
var browserId = (driver.deviceName() != '' ? driver.deviceName() : driver.browserName()) + " " + driver.deviceOrientation() + " " + driver.browserVersion() + " " + driver.platform();
// Write screenshot to a file
fs.writeFileSync(__dirname + '/' + browserId.trim() + '.png', activeWindow.documentScreenshot({
eachFn: function (index) {
// Remove the header when the second screenshot is reached.
// The header keeps following the scrolling position.
// So, we want to turn it off here.
if (index >= 1 && document.getElementById('masthead')) {
document.getElementById('masthead').style.display = 'none';
}
},
completeFn: function () {
// When it has a "masthead", then display it again
if (document.getElementById('masthead')) {
document.getElementById('masthead').style.display = '';
}
},
// Here is a list of areas that should be blocked-out
blockOuts: [
// Block-out all text-boxes
'input',
// Custom block-out at static location with custom color
{x:60, y: 50, width: 200, height: 200, color:{red:255,green:0,blue:128}}
]
// The element cannot be found in mobile browsers since they have a different layout
//, activeWindow.getElement('.footer-section')]
}));
} catch (err) {
console.error(err.stack);
} finally {
driver.dispose();
// Do we need to run something after the test-run?
if (test.afterFn) {
test.afterFn();
}
}
});
| preceptorjs/taxi | examples/stitching.js | JavaScript | mit | 4,049 |
#!/Users/Varun/Documents/GitHub/LockScreen/venv/bin/python
# $Id: rst2xml.py 4564 2006-05-21 20:44:42Z wiemann $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
A minimal front end to the Docutils Publisher, producing Docutils XML.
"""
try:
import locale
locale.setlocale(locale.LC_ALL, '')
except:
pass
from docutils.core import publish_cmdline, default_description
description = ('Generates Docutils-native XML from standalone '
'reStructuredText sources. ' + default_description)
publish_cmdline(writer_name='xml', description=description)
| LockScreen/Backend | venv/bin/rst2xml.py | Python | mit | 642 |
/**
* @author Chine
*/
function switchTheme(theme) {
$.cookie('blog_theme', theme, { expires: 30 });
location.href = location.href;
}
| harveyqing/Qingblog | Qingblog/public/static/dopetrope/js/theme.js | JavaScript | mit | 142 |
var mtd = require('mt-downloader');
var fs = require('fs');
var util = require('util');
var EventEmitter = require('events').EventEmitter;
var Download = function() {
EventEmitter.call(this);
this._reset();
this.url = '';
this.filePath = '';
this.options = {};
this.meta = {};
this._retryOptions = {
_nbRetries: 0,
maxRetries: 5,
retryInterval: 5000
};
};
util.inherits(Download, EventEmitter);
Download.prototype._reset = function(first_argument) {
this.status = 0; // -3 = destroyed, -2 = stopped, -1 = error, 0 = not started, 1 = started (downloading), 2 = error, retrying, 3 = finished
this.error = '';
this.stats = {
time: {
start: 0,
end: 0
},
total: {
size: 0,
downloaded: 0,
completed: 0
},
past: {
downloaded: 0
},
present: {
downloaded: 0,
time: 0,
speed: 0
},
future: {
remaining: 0,
eta: 0
},
threadStatus: {
idle: 0,
open: 0,
closed: 0,
failed: 0
}
};
};
Download.prototype.setUrl = function(url) {
this.url = url;
return this;
};
Download.prototype.setFilePath = function(filePath) {
this.filePath = filePath;
return this;
};
Download.prototype.setOptions = function(options) {
if(!options || options == {}) {
return this.options = {};
}
// The "options" object will be directly passed to mt-downloader, so we need to conform to his format
//To set the total number of download threads
this.options.count = options.threadsCount || options.count || 2;
//HTTP method
this.options.method = options.method || 'GET';
//HTTP port
this.options.port = options.port || 80;
//If no data is received the download times out. It is measured in seconds.
this.options.timeout = options.timeout/1000 || 5;
//Control the part of file that needs to be downloaded.
this.options.range = options.range || '0-100';
// Support customized header fields
this.options.headers = options.headers || {};
return this;
};
Download.prototype.setRetryOptions = function(options) {
this._retryOptions.maxRetries = options.maxRetries || 5;
this._retryOptions.retryInterval = options.retryInterval || 2000;
return this;
};
Download.prototype.setMeta = function(meta) {
this.meta = meta;
return this;
};
Download.prototype.setStatus = function(status) {
this.status = status;
return this;
};
Download.prototype.setError = function(error) {
this.error = error;
return this;
};
Download.prototype._computeDownloaded = function() {
if(!this.meta.threads) { return 0; }
var downloaded = 0;
this.meta.threads.forEach(function(thread) {
downloaded += thread.position - thread.start;
});
return downloaded;
};
// Should be called on start, set the start timestamp (in seconds)
Download.prototype._computeStartTime = function() {
this.stats.time.start = Math.floor(Date.now() / 1000);
};
// Should be called on end, set the end timestamp (in seconds)
Download.prototype._computeEndTime = function() {
this.stats.time.end = Math.floor(Date.now() / 1000);
};
// Should be called on start, count size already downloaded (eg. resumed download)
Download.prototype._computePastDownloaded = function() {
this.stats.past.downloaded = this._computeDownloaded();
};
// Should be called on start compute total size
Download.prototype._computeTotalSize = function() {
var threads = this.meta.threads;
if(!threads) { return 0; }
this.stats.total.size = threads[threads.length-1].end - threads[0].start;
};
Download.prototype._computeStats = function() {
this._computeTotalSize();
this._computeTotalDownloaded();
this._computePresentDownloaded();
this._computeTotalCompleted();
this._computeFutureRemaining();
// Only compute those stats when downloading
if(this.status == 1) {
this._computePresentTime();
this._computePresentSpeed();
this._computeFutureEta();
this._computeThreadStatus();
}
};
Download.prototype._computePresentTime = function() {
this.stats.present.time = Math.floor(Date.now() / 1000) - this.stats.time.start;
};
Download.prototype._computeTotalDownloaded = function() {
this.stats.total.downloaded = this._computeDownloaded();
};
Download.prototype._computePresentDownloaded = function() {
this.stats.present.downloaded = this.stats.total.downloaded - this.stats.past.downloaded;
};
Download.prototype._computeTotalCompleted = function() {
this.stats.total.completed = Math.floor((this.stats.total.downloaded) * 1000 / this.stats.total.size) / 10;
};
Download.prototype._computeFutureRemaining = function() {
this.stats.future.remaining = this.stats.total.size - this.stats.total.downloaded;
};
Download.prototype._computePresentSpeed = function() {
this.stats.present.speed = this.stats.present.downloaded / this.stats.present.time;
};
Download.prototype._computeFutureEta = function() {
this.stats.future.eta = this.stats.future.remaining / this.stats.present.speed;
};
Download.prototype._computeThreadStatus = function() {
var self = this;
this.stats.threadStatus = {
idle: 0,
open: 0,
closed: 0,
failed: 0
};
this.meta.threads.forEach(function(thread) {
self.stats.threadStatus[thread.connection]++;
});
};
Download.prototype.getStats = function() {
if(!this.meta.threads) {
return this.stats;
}
this._computeStats();
return this.stats;
};
Download.prototype._destroyThreads = function() {
if(this.meta.threads) {
this.meta.threads.forEach(function(i){
if(i.destroy) {
i.destroy();
}
});
}
};
Download.prototype.stop = function() {
this.setStatus(-2);
this._destroyThreads();
this.emit('stopped', this);
};
Download.prototype.destroy = function() {
var self = this;
this._destroyThreads();
this.setStatus(-3);
var filePath = this.filePath;
var tmpFilePath = filePath;
if (!filePath.match(/\.mtd$/)) {
tmpFilePath += '.mtd';
} else {
filePath = filePath.replace(new RegExp('(.mtd)*$', 'g'), '');
}
fs.unlink(filePath, function() {
fs.unlink(tmpFilePath, function() {
self.emit('destroyed', this);
});
});
};
Download.prototype.start = function() {
var self = this;
self._reset();
self._retryOptions._nbRetries = 0;
this.options.onStart = function(meta) {
self.setStatus(1);
self.setMeta(meta);
self.setUrl(meta.url);
self._computeStartTime();
self._computePastDownloaded();
self._computeTotalSize();
self.emit('start', self);
};
this.options.onEnd = function(err, result) {
// If stopped or destroyed, do nothing
if(self.status == -2 || self.status == -3) {
return;
}
// If we encountered an error and it's not an "Invalid file path" error, we try to resume download "maxRetries" times
if(err && (''+err).indexOf('Invalid file path') == -1 && self._retryOptions._nbRetries < self._retryOptions.maxRetries) {
self.setStatus(2);
self._retryOptions._nbRetries++;
setTimeout(function() {
self.resume();
self.emit('retry', self);
}, self._retryOptions.retryInterval);
// "Invalid file path" or maxRetries reached, emit error
} else if(err) {
self._computeEndTime();
self.setError(err);
self.setStatus(-1);
self.emit('error', self);
// No error, download ended successfully
} else {
self._computeEndTime();
self.setStatus(3);
self.emit('end', self);
}
};
this._downloader = new mtd(this.filePath, this.url, this.options);
this._downloader.start();
return this;
};
Download.prototype.resume = function() {
this._reset();
var filePath = this.filePath;
if (!filePath.match(/\.mtd$/)) {
filePath += '.mtd';
}
this._downloader = new mtd(filePath, null, this.options);
this._downloader.start();
return this;
};
// For backward compatibility, will be removed in next releases
Download.prototype.restart = util.deprecate(function() {
return this.resume();
}, 'Download `restart()` is deprecated, please use `resume()` instead.');
module.exports = Download; | leeroybrun/node-mt-files-downloader | lib/Download.js | JavaScript | mit | 8,675 |
import * as utils from '../../utils/utils'
import * as math from '../../math/math'
import QR from '../../math/qr'
import LMOptimizer from '../../math/lm'
import {ConstantWrapper, EqualsTo} from './constraints'
import {dog_leg} from '../../math/optim'
/** @constructor */
function Param(id, value, readOnly) {
this.reset(value);
}
Param.prototype.reset = function(value) {
this.set(value);
this.j = -1;
};
Param.prototype.set = function(value) {
this.value = value;
};
Param.prototype.get = function() {
return this.value;
};
Param.prototype.nop = function() {};
/** @constructor */
function System(constraints) {
this.constraints = constraints;
this.params = [];
for (var ci = 0; ci < constraints.length; ++ci) {
var c = constraints[ci];
for (var pi = 0; pi < c.params.length; ++pi) {
var p = c.params[pi];
if (p.j == -1) {
p.j = this.params.length;
this.params.push(p);
}
}
}
}
System.prototype.makeJacobian = function() {
var jacobi = [];
var i;
var j;
for (i=0; i < this.constraints.length; i++) {
jacobi[i] = [];
for (j=0; j < this.params.length; j++) {
jacobi[i][j] = 0;
}
}
for (i=0; i < this.constraints.length; i++) {
var c = this.constraints[i];
var cParams = c.params;
var grad = [];
utils.fillArray(grad, 0, cParams.length, 0);
c.gradient(grad);
for (var p = 0; p < cParams.length; p++) {
var param = cParams[p];
j = param.j;
jacobi[i][j] = grad[p];
}
}
return jacobi;
};
System.prototype.fillJacobian = function(jacobi) {
for (var i=0; i < this.constraints.length; i++) {
var c = this.constraints[i];
var cParams = c.params;
var grad = [];
utils.fillArray(grad, 0, cParams.length, 0);
c.gradient(grad);
for (var p = 0; p < cParams.length; p++) {
var param = cParams[p];
var j = param.j;
jacobi[i][j] = grad[p];
}
}
return jacobi;
};
System.prototype.calcResidual = function(r) {
var i=0;
var err = 0.;
for (i=0; i < this.constraints.length; i++) {
var c = this.constraints[i];
r[i] = c.error();
err += r[i]*r[i];
}
err *= 0.5;
return err;
};
System.prototype.calcGrad_ = function(out) {
var i;
for (i = 0; i < out.length || i < this.params.length; ++i) {
out[i][0] = 0;
}
for (i=0; i < this.constraints.length; i++) {
var c = this.constraints[i];
var cParams = c.params;
var grad = [];
utils.fillArray(grad, 0, cParams.length, 0);
c.gradient(grad);
for (var p = 0; p < cParams.length; p++) {
var param = cParams[p];
var j = param.j;
out[j][0] += this.constraints[i].error() * grad[p]; // (10.4)
}
}
};
System.prototype.calcGrad = function(out) {
var i;
for (i = 0; i < out.length || i < this.params.length; ++i) {
out[i] = 0;
}
for (i=0; i < this.constraints.length; i++) {
var c = this.constraints[i];
var cParams = c.params;
var grad = [];
utils.fillArray(grad, 0, cParams.length, 0);
for (var p = 0; p < cParams.length; p++) {
var param = cParams[p];
var j = param.j;
out[j] += this.constraints[i].error() * grad[p]; // (10.4)
}
}
};
System.prototype.fillParams = function(out) {
for (var p = 0; p < this.params.length; p++) {
out[p] = this.params[p].get();
}
};
System.prototype.getParams = function() {
var out = [];
this.fillParams(out);
return out;
};
System.prototype.setParams = function(point) {
for (var p = 0; p < this.params.length; p++) {
this.params[p].set(point[p]);
}
};
System.prototype.error = function() {
var error = 0;
for (var i=0; i < this.constraints.length; i++) {
error += Math.abs(this.constraints[i].error());
}
return error;
};
System.prototype.errorSquare = function() {
var error = 0;
for (var i=0; i < this.constraints.length; i++) {
var t = this.constraints[i].error();
error += t * t;
}
return error * 0.5;
};
System.prototype.getValues = function() {
var values = [];
for (var i=0; i < this.constraints.length; i++) {
values[i] = this.constraints[i].error();
}
return values;
};
var wrapAux = function(constrs, locked) {
var i, lockedSet = {};
for (i = 0; i < locked.length; i++) {
lockedSet[locked[i].j] = true;
}
for (i = 0; i < constrs.length; i++) {
var c = constrs[i];
var mask = [];
var needWrap = false;
for (var j = 0; j < c.params.length; j++) {
var param = c.params[j];
mask[j] = lockedSet[param.j] === true;
needWrap = needWrap || mask[j];
}
if (needWrap) {
var wrapper = new ConstantWrapper(c, mask);
constrs[i] = wrapper;
}
}
};
var lock2Equals2 = function(constrs, locked) {
var _locked = [];
for (var i = 0; i < locked.length; ++i) {
_locked.push(new EqualsTo([locked[i]], locked[i].get()));
}
return _locked;
};
var diagnose = function(sys) {
if (sys.constraints.length == 0 || sys.params.length == 0) {
return {
conflict : false,
dof : 0
}
}
var jacobian = sys.makeJacobian();
var qr = new QR(jacobian);
return {
conflict : sys.constraints.length > qr.rank,
dof : sys.params.length - qr.rank
}
};
var prepare = function(constrs, locked, aux, alg) {
var simpleMode = true;
if (!simpleMode) {
var lockingConstrs = lock2Equals2(constrs, locked);
Array.prototype.push.apply( constrs, lockingConstrs );
}
var sys = new System(constrs);
wrapAux(constrs, aux);
var model = function(point) {
sys.setParams(point);
return sys.getValues();
};
var jacobian = function(point) {
sys.setParams(point);
return sys.makeJacobian();
};
var nullResult = {
evalCount : 0,
error : 0,
returnCode : 1
};
function solve(rough, alg) {
//if (simpleMode) return nullResult;
if (constrs.length == 0) return nullResult;
if (sys.params.length == 0) return nullResult;
switch (alg) {
case 2:
return solve_lm(sys, model, jacobian, rough);
case 1:
default:
return dog_leg(sys, rough);
}
}
var systemSolver = {
diagnose : function() {return diagnose(sys)},
error : function() {return sys.error()},
solveSystem : solve,
system : sys,
updateLock : function(values) {
for (var i = 0; i < values.length; ++i) {
if (simpleMode) {
locked[i].set(values[i]);
} else {
lockingConstrs[i].value = values[i];
}
}
}
};
return systemSolver;
};
var solve_lm = function(sys, model, jacobian, rough) {
var opt = new LMOptimizer(sys.getParams(), math.vec(sys.constraints.length), model, jacobian);
opt.evalMaximalCount = 100 * sys.params.length;
var eps = rough ? 0.001 : 0.00000001;
opt.init0(eps, eps, eps);
var returnCode = 1;
try {
var res = opt.doOptimize();
} catch (e) {
returnCode = 2;
}
sys.setParams(res[0]);
return {
evalCount : opt.evalCount,
error : sys.error(),
returnCode : returnCode
};
};
export {Param, prepare} | Autodrop3d/autodrop3dServer | public/webcad/app/sketcher/constr/solver.js | JavaScript | mit | 7,075 |
(function() {
function Base(props) {
this.id = Ambient.getID();
$.extend(this, props || {});
}
Base.extend = function(methods) {
if (typeof methods === "function") {
methods = methods();
}
methods = (methods || {});
var self = this;
var Controller = function() {
self.apply(this, arguments);
};
Controller.prototype = Object.create(self.prototype);
Controller.prototype.constructor = Controller;
for (var key in methods) {
Controller.prototype[key] = methods[key];
}
Controller.extend = Base.extend.bind(Controller);
return Controller;
};
window.Ambient.Controller = Base;
})();
| lewie9021/ambient-js | src/Controller.js | JavaScript | mit | 870 |
import React from 'react'
import { Router, Route, hashHistory, browserHistory, IndexRoute } from 'react-router'
import MainContainer from '../components/MainContainer'
import Login from '../components/hello/Login'
import Register from '../components/hello/Register'
import Index from '../components/index/Index'
import HelloWorld from '../components/hello/HelloWorld'
import Header from '../components/common/Header'
import Xiexie from '../components/write/Write'
import ArticleDetail from '../components/index/ArticleDetail'
class Root extends React.Component {
render() {
return (
<Router history={browserHistory}>
<Route path="/" component={Header}>
<IndexRoute component={Index}/>
<Route path="/xiexie" component={Xiexie}/>
<Route path="/articleDetail" component={ArticleDetail}/>
</Route>
</Router>
)
}
}
export default Root | weifengsmile/xiexie | client/src/containers/Root.js | JavaScript | mit | 931 |
from messenger import Skype
import keyring
import utils
token = keyring.get_password('messagesReceiver', 'skypeToken')
registrationToken = keyring.get_password('messagesReceiver', 'skypeRegistrationToken')
username = keyring.get_password('messagesReceiver', 'skypeUsername')
password = keyring.get_password('messagesReceiver', 'skypePassword')
s = Skype(token, registrationToken)
if s.token == None:
s.login(username, password)
print "logging in..."
if s.registrationToken == None:
print s.createRegistrationToken()
print s.subcribe()
print "creating endpoint and registrationToken..."
while True:
data = s.pull()
if data == 404:
print s.createRegistrationToken()
print s.subcribe()
data = s.pull()
if data == 400:
continue
messages = utils.skypeParse(data)
if not messages:
continue
for sender, receiver, message in messages:
if receiver != None:
print "%s to %s" % (sender, receiver)
else:
print "From %s" % sender
print message
| khapota/messages-terminal | test.py | Python | mit | 1,064 |
package br.com.command.comandos;
import br.com.command.interfaces.Command;
import br.com.command.modelos.PersianaSuite;
/**
* Created by danielmarcoto on 17/11/15.
*/
public class PersianaSuiteAbrirCommand implements Command {
private PersianaSuite persiana;
public PersianaSuiteAbrirCommand(PersianaSuite persiana) {
this.persiana = persiana;
}
@Override
public void execute() {persiana.abrir();}
}
| danielmarcoto/ControleRemoto | app/src/main/java/br/com/command/comandos/PersianaSuiteAbrirCommand.java | Java | mit | 435 |
<?php
/**
* Used to implement Action Controllers for use with the Front Controller.
*
* @link Benri_Controller_Abstract.html Benri_Controller_Abstract
*/
abstract class Benri_Controller_Action extends Benri_Controller_Action_Abstract
{
/**
* Layout used by this controller.
* @var string
*/
protected $_layout;
/**
* A title for an action.
* @var string
*/
protected $_title = null;
/**
* Initialize object.
*/
public function init()
{
parent::init();
if ($this->_layout) {
$this->getHelper('layout')->setLayout($this->_layout);
}
}
/**
* Post-dispatch routines.
*
* Common usages for `postDispatch()` include rendering content in a
* sitewide template, link url correction, setting headers, etc.
*/
public function postDispatch()
{
if ($this->view instanceof Zend_View_Interface) {
// Common variables used in all views.
$this->view->assign([
'errors' => $this->_errors,
'messages' => $this->_messages,
'title' => $this->_title,
]);
// XMLHttpRequest requests should not render the entire layout,
// only the correct templates related to the action.
if ($this->getRequest()->isXmlHttpRequest()) {
$this->getHelper('layout')->disableLayout();
}
$this->getResponse()->setHeader('Content-Type', 'text/html; charset=utf-8', true);
}
}
}
| douggr/benri | library/Benri/Controller/Action.php | PHP | mit | 1,579 |
<?php
namespace Persona\Hris\Attendance\Model;
use Persona\Hris\Repository\RepositoryInterface;
/**
* @author Muhamad Surya Iksanudin <surya.iksanudin@personahris.com>
*/
interface ShiftmentRepositoryInterface extends RepositoryInterface
{
/**
* @param string $id
*
* @return ShiftmentInterface|null
*/
public function find(string $id): ? ShiftmentInterface;
}
| HRPersona/Backend | src/Attendance/Model/ShiftmentRepositoryInterface.php | PHP | mit | 394 |
var READONLY = false
// How much labor you generate per minute
var LABORGENRATE = 2;
if (READONLY){
// This is just for setting up a display-only example of this app
Characters = new Meteor.Collection(null)
Timers = new Meteor.Collection(null)
} else {
Characters = new Meteor.Collection("characters");
Timers = new Meteor.Collection("timers");
}
DayStrings = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
function pad(number, length) {
var str = '' + number;
while (str.length < length) {
str = '0' + str;1
}
return str;
}
function formattime(hour, minutes) {
if (hour >= 12) {
ampm = 'pm'
} else {
ampm = 'am'
}
hour = hour % 12;
if (hour == 0) {
hour = 12;
}
return hour+":"+pad(minutes,2)+ampm;
}
function parsetimerlength(timerstring) {
var totaltime = 0;
// Find days
var re = /(\d+) ?(?:days|day|d)/g;
var matches = re.exec(timerstring);
if(matches) {
totaltime += (Number(matches[1]) * 86400);
}
// Find hours
var re = /(\d+) ?(?:hours|hour|h|hr|hrs)/g;
var matches = re.exec(timerstring);
if(matches) {
totaltime += (Number(matches[1]) * 3600);
}
// Find minutes
var re = /(\d+) ?(?:minutes|minute|min|m)/g;
var matches = re.exec(timerstring);
if(matches) {
totaltime += (Number(matches[1]) * 60);
}
// Find seconds
var re = /(\d+) ?(?:seconds|second|secs|sec|s)/g;
var matches = re.exec(timerstring);
if(matches) {
totaltime += Number(matches[1]);
}
return totaltime;
}
function maxtime(now, max) {
return Date.now() + (max - now) * 1000 * 60 / LABORGENRATE;
}
if (Meteor.isClient) {
var highestMaxLabor = function () {
var highestchar = Characters.findOne({owner: Session.get('sessionid')}, {sort: {labormax: -1}})
if (highestchar)
return highestchar.labormax;
else
return 1000;
};
Session.set('sessionid', location.search);
// When editing a character name, ID of the character
Session.set('editing_charactername', null);
// When editing current labor, ID of the character
Session.set('editing_characterlabor', null);
// When editing current labormax, ID of the character
Session.set('editing_characterlabormax', null);
/* New version
Deps.autorun(function () {
Meteor.subscribe("characters");
});
*/
Meteor.autosubscribe(function () {
Meteor.subscribe('characters', {owner: Session.get('sessionid')});
Meteor.subscribe('timers', {owner: Session.get('sessionid')});
});
if (READONLY) {
// Super duper quickl and dirty hack for creating a read-only version of the app to show as an example from GitHub
newchar = Characters.insert({name: 'OverloadUT', labor: 4000, labormax: 4320, labortimestamp: Date.now(), maxtime: maxtime(4320, 4000), owner: Session.get('sessionid')});
newchar = Characters.insert({name: 'DiscoC', labor: 2400, labormax: 1650, labortimestamp: Date.now(), maxtime: maxtime(1650, 2400), owner: Session.get('sessionid')});
newchar = Characters.insert({name: 'RoughRaptors', labor: 1250, labormax: 5000, labortimestamp: Date.now(), maxtime: maxtime(5000, 1250), owner: Session.get('sessionid')});
var length = 3600
var percent = 0.75
Timers.insert({name: 'Strawberries', starttime: Date.now() - percent * length * 1000, timerlength: length, owner: Session.get('sessionid'), endtime: Date.now() + (1-percent) * length * 1000});
var length = 3600 * 72
var percent = 0.10
Timers.insert({name: 'Pine trees', starttime: Date.now() - percent * length * 1000, timerlength: length, owner: Session.get('sessionid'), endtime: Date.now() + (1-percent) * length * 1000});
var length = 3600 * 18
var percent = 0.90
Timers.insert({name: 'Cows', starttime: Date.now() - percent * length * 1000, timerlength: length, owner: Session.get('sessionid'), endtime: Date.now() + (1-percent) * length * 1000});
var length = 3600 * 24 * 7
var percent = 0.5
Timers.insert({name: 'Pay Taxes', starttime: Date.now() - percent * length * 1000, timerlength: length, owner: Session.get('sessionid'), endtime: Date.now() + (1-percent) * length * 1000});
var length = 3600 * 7
var percent = 1.5
Timers.insert({name: 'Goats', starttime: Date.now() - percent * length * 1000, timerlength: length, owner: Session.get('sessionid'), endtime: Date.now() + (1-percent) * length * 1000});
}
//{//////// Helpers for in-place editing //////////
// Returns an event map that handles the "escape" and "return" keys and
// "blur" events on a text input (given by selector) and interprets them
// as "ok" or "cancel".
var okCancelEvents = function (selector, callbacks) {
var ok = callbacks.ok || function () {};
var cancel = callbacks.cancel || function () {};
var events = {};
events['keyup '+selector+', keydown '+selector+', focusout '+selector] =
function (evt) {
if (evt.type === "keydown" && evt.which === 27) {
// escape = cancel
cancel.call(this, evt);
} else if (evt.type === "keyup" && evt.which === 13 ||
evt.type === "focusout") {
// blur/return/enter = ok/submit if non-empty
var value = String(evt.target.value || "");
if (value)
ok.call(this, value, evt);
else
cancel.call(this, evt);
}
};
return events;
};
var activateInput = function (input) {
input.focus();
input.select();
};
//} END IN-PLACE EDITING HELPERS
//{///////// NEED SESSION PAGE ///////////
Template.needsession.events({
'click input.sessionnamesubmit' : function () {
window.location = Meteor.absoluteUrl('?' + $("#sessionname").val())
}
});
//} END NEED SESSION PAGE
//{//////////// MAIN TEMPLATE //////////////
Template.main.need_session = function () {
return Session.get('sessionid') == "" || Session.get('sessionid') == "?undefined" || Session.get('sessionid') == "?";
};
Template.main.is_readonly = function () {
return READONLY;
};
Template.main.show_timers = function() {
//TODO: Make a way for the user to pick which modules are visible
return true;
}
//} END MAIN TEMPLATE
//{//////////// TIMERS LIST ///////////////////
// When editing timer name, ID of the timer
Session.set('editing_timername', null);
// When editing timer length, ID of the timer
Session.set('editing_timertimeleft', null);
// Preference to hide seconds from timers
Session.setDefault('pref_show_seconds', false);
var timersTimerDep = new Deps.Dependency;
var timersTimerUpdate = function () {
timersTimerDep.changed();
};
Meteor.setInterval(timersTimerUpdate, 1000);
Template.timers.timers = function () {
return Timers.find({owner: Session.get('sessionid')}, {sort: {endtime: 1}});
};
Template.timers.events({
'click a.add' : function () {
var newtimer = Timers.insert({name: 'Timer', starttime: Date.now(), timerlength: 3600, owner: Session.get('sessionid'), endtime: Date.now() + 3600 * 1000});
Session.set('editing_timername', newtimer);
Meteor.flush(); // force DOM redraw, so we can focus the edit field
activateInput($("#timer-name-input"));
},
'click th.timeleft' : function () {
Session.set('pref_show_seconds', !Session.get('pref_show_seconds'));
}
});
//} END TIMERS LIST
//{////////// EACH TIMER //////////////
Template.timer.displaytimeleft = function() {
return this.timerlength;
};
Template.timer.timerdone = function() {
return (this.endtime <= Date.now())
};
var format_time_left = function(totalsecondsleft) {
var daysleft = Math.floor(totalsecondsleft / 60 / 60 / 24);
var hoursleft = Math.floor(totalsecondsleft / 60 / 60 % 24);
var minutesleft = Math.floor(totalsecondsleft / 60 % 60);
var secondsleft = Math.floor(totalsecondsleft % 60);
var timestring = '';
if(totalsecondsleft > 86400) {
timestring += daysleft + 'd ';
}
if(totalsecondsleft > 3600) {
timestring += hoursleft + 'h ';
}
if(totalsecondsleft > 60) {
timestring += minutesleft + 'm ';
}
if (Session.get('pref_show_seconds')) {
timestring += secondsleft + 's';
}
return timestring;
}
Template.timer.timeleft = function() {
timersTimerDep.depend();
var totalsecondsleft = Math.abs((this.timerlength*1000 - (Date.now() - this.starttime)) / 1000);
return format_time_left(totalsecondsleft);
}
Template.timer.timeleftinput = function() {
if(this.endtime <= Date.now()) {
// Timer finished, so show the original timer length
return format_time_left(this.timerlength);
} else {
// Timer not finished, so show the current time left
var totalsecondsleft = Math.abs((this.timerlength*1000 - (Date.now() - this.starttime)) / 1000);
return format_time_left(totalsecondsleft);
}
}
Template.timer.endtimestring = function() {
timersTimerDep.depend();
var date = new Date(this.endtime);
var hour = date.getHours();
var minutes = date.getMinutes();
var day = date.getDay();
var hoursleft = Math.floor(Math.abs((this.endtime - Date.now()) / 1000 / 60 / 60))
var minutesleft = Math.floor(Math.abs((this.endtime - Date.now()) / 1000 / 60 % 60))
return DayStrings[day] + ' ' + formattime(hour,minutes);
}
Template.timer.percentage = function() {
timersTimerDep.depend();
var end = this.starttime + this.timerlength * 1000;
var now = Date.now();
return Math.min(100,Math.floor((now - this.starttime) / (end - this.starttime) * 100));
}
Template.timer.events({
'click a.remove' : function () {
Timers.remove({_id: this._id});
},
'click div.name': function (evt, tmpl) { // start editing list name
Session.set('editing_timername', this._id);
Meteor.flush(); // force DOM redraw, so we can focus the edit field
activateInput(tmpl.find("#timer-name-input"));
},
'click div.timeleft': function (evt, tmpl) { // start editing list name
Session.set('editing_timertimeleft', this._id);
Meteor.flush(); // force DOM redraw, so we can focus the edit field
activateInput(tmpl.find("#timer-timeleft-input"));
}
});
Template.timer.events(okCancelEvents(
'#timer-name-input', {
ok: function (value) {
Timers.update(this._id, {$set: {name: value}});
Session.set('editing_timername', null);
},
cancel: function () {
Session.set('editing_timername', null);
}
}
));
Template.timer.events(okCancelEvents(
'#timer-timeleft-input', {
ok: function (value) {
var timerlength = parsetimerlength(value);
Timers.update(this._id, {$set: {timerlength: timerlength, starttime: Date.now(), endtime: Date.now() + timerlength * 1000}});
Session.set('editing_timertimeleft', null);
},
cancel: function () {
Session.set('editing_timertimeleft', null);
}
}
));
Template.timer.editingname = function () {
return Session.equals('editing_timername', this._id);
};
Template.timer.editingtimeleft = function () {
return Session.equals('editing_timertimeleft', this._id);
};
//} END EACH TIMER
//{///////// CHARACTERS LIST //////////
// Preference to hide seconds from timers
Session.setDefault('pref_scale_maxlabor', true);
Session.setDefault('pref_sort_maxtime', false);
Template.characters.characters = function () {
if(Session.get('pref_sort_maxtime')) {
return Characters.find({owner: Session.get('sessionid')}, {sort: {maxtime: 1}});
} else {
return Characters.find({owner: Session.get('sessionid')}, {});
}
};
Template.characters.events({
'click a.add' : function () {
var newmaxtime = Date.now() + (this.labormax - this.labor) * 1000 * 60 / LABORGENRATE;
var newchar = Characters.insert({name: 'NewCharacter', labor: 50, labormax: 1000, labortimestamp: Date.now(), maxtime: newmaxtime, owner: Session.get('sessionid')});
Session.set('editing_charactername', newchar);
Meteor.flush(); // force DOM redraw, so we can focus the edit field
activateInput($("#character-name-input"));
},
'click th.labor' : function () {
Session.set('pref_scale_maxlabor', !Session.get('pref_scale_maxlabor'))
},
'click th.maxtime' : function () {
Session.set('pref_sort_maxtime', !Session.get('pref_sort_maxtime'))
}
});
//}
//{///////// EACH CHARACTER ///////////
var timerDep = new Deps.Dependency;
var timerUpdate = function () {
timerDep.changed();
};
Meteor.setInterval(timerUpdate, 60000 / LABORGENRATE);
Template.character.currentlabor = function() {
timerDep.depend();
var currentlabor = Math.floor((Date.now() - this.labortimestamp) / 1000 / 60 * LABORGENRATE) + this.labor;
return currentlabor;
};
Template.character.currentlaborcapped = function() {
timerDep.depend();
return Math.min(this.labormax,Math.floor((Date.now() - this.labortimestamp) / 1000 / 60 * LABORGENRATE) + this.labor);
};
// Returns the percentage of max labor, in integer format (50 for 50%)
Template.character.percentage = function() {
timerDep.depend();
var currentlabor = Math.floor((Date.now() - this.labortimestamp) / 1000 / 60 * LABORGENRATE) + this.labor;
return Math.min(100,Math.floor(currentlabor / this.labormax * 100))
};
// Returns the percentage of this character's max labor compared to,
// the character with the MOST max labor. Integer format (50 for 50%)
Template.character.percentagemax = function() {
if(Session.get('pref_scale_maxlabor')) {
return Math.min(100,Math.floor(this.labormax / highestMaxLabor() * 100))
} else {
return 100;
}
};
Template.character.laborcapped = function() {
timerDep.depend();
var currentlabor = Math.floor((Date.now() - this.labortimestamp) / 1000 / 60 * LABORGENRATE) + this.labor;
return (currentlabor >= this.labormax);
}
Template.character.laborwaste = function() {
timerDep.depend();
var currentlabor = Math.floor((Date.now() - this.labortimestamp) / 1000 / 60 * LABORGENRATE) + this.labor;
return Math.max(0,currentlabor - this.labormax);
}
Template.character.maxtimestring = function() {
var maxtimestamp = this.labortimestamp + (this.labormax - this.labor) * 1000 * 60 / LABORGENRATE;
var date = new Date(maxtimestamp);
var hour = date.getHours();
var minutes = date.getMinutes();
var day = date.getDay();
var hoursleft = Math.floor(Math.abs((maxtimestamp - Date.now()) / 1000 / 60 / 60))
var minutesleft = Math.floor(Math.abs((maxtimestamp - Date.now()) / 1000 / 60 % 60))
return DayStrings[day] + " " + formattime(hour,minutes)+" ("+hoursleft+"h "+minutesleft+"m)";
};
Template.character.events({
'click a.remove' : function () {
Characters.remove({_id: this._id});
},
'click div.name': function (evt, tmpl) { // start editing list name
Session.set('editing_charactername', this._id);
Meteor.flush(); // force DOM redraw, so we can focus the edit field
activateInput(tmpl.find("#character-name-input"));
},
'click div.labor': function (evt, tmpl) { // start editing list name
Session.set('editing_characterlabor', this._id);
Meteor.flush(); // force DOM redraw, so we can focus the edit field
activateInput(tmpl.find("#character-labor-input"));
},
'click div.labormax': function (evt, tmpl) { // start editing list name
Session.set('editing_characterlabormax', this._id);
Meteor.flush(); // force DOM redraw, so we can focus the edit field
activateInput(tmpl.find("#character-labormax-input"));
}
});
Template.character.events(okCancelEvents(
'#character-name-input', {
ok: function (value) {
Characters.update(this._id, {$set: {name: value}});
Session.set('editing_charactername', null);
},
cancel: function () {
Session.set('editing_charactername', null);
}
}
));
Template.character.events(okCancelEvents(
'#character-labor-input', {
ok: function (value) {
var newmaxtime = Date.now() + (this.labormax - Number(value)) * 1000 * 60 / LABORGENRATE;
Characters.update(this._id, {$set: {labor: Number(value), labortimestamp: Date.now(), maxtime: newmaxtime}});
Session.set('editing_characterlabor', null);
},
cancel: function () {
Session.set('editing_characterlabor', null);
}
}
));
Template.character.events(okCancelEvents(
'#character-labormax-input', {
ok: function (value) {
var newmaxtime = Date.now() + (Number(value) - this.labor) * 1000 * 60 / LABORGENRATE;
Characters.update(this._id, {$set: {labormax: Number(value), maxtime: newmaxtime}});
Session.set('editing_characterlabormax', null);
},
cancel: function () {
Session.set('editing_characterlabormax', null);
}
}
));
Template.character.editingname = function () {
return Session.equals('editing_charactername', this._id);
};
Template.character.editinglabor = function () {
return Session.equals('editing_characterlabor', this._id);
};
Template.character.editinglabormax = function () {
return Session.equals('editing_characterlabormax', this._id);
};
//} END EACH CHARACTER
}
if (Meteor.isServer) {
Meteor.startup(function () {
// code to run on server at startup
// Upgrade database from earlier version
Timers.find({}, {}).fetch().forEach(function(timer) {
if (timer.endtime == null) {
console.log('Updating timer ' + timer._id);
Timers.update(timer._id, {$set: {endtime: timer.starttime + timer.timerlength * 1000}});
}
});
// Upgrade database from earlier version
Characters.find({}, {}).fetch().forEach(function(character) {
if (character.maxtime == null) {
console.log('Updating character ' + character._id);
var newmaxtime = character.labortimestamp + (character.labormax - character.labor) * 1000 * 60 / LABORGENRATE;
Characters.update(character._id, {$set: {maxtime: newmaxtime}});
}
});
});
} | OverloadUT/LaborTracker | LaborTracker.js | JavaScript | mit | 18,428 |
/* */ package com.elcuk.jaxb;
/* */
/* */ import javax.xml.bind.annotation.XmlEnum;
/* */ import javax.xml.bind.annotation.XmlType;
/* */
/* */ @XmlType(name="OptionalWeightUnitOfMeasure")
/* */ @XmlEnum
/* */ public enum OptionalWeightUnitOfMeasure
/* */ {
/* 30 */ GR,
/* 31 */ KG,
/* 32 */ OZ,
/* 33 */ LB,
/* 34 */ MG;
/* */
/* */ public String value() {
/* 37 */ return name();
/* */ }
/* */
/* */ public static OptionalWeightUnitOfMeasure fromValue(String v) {
/* 41 */ return valueOf(v);
/* */ }
/* */ }
/* Location: /Users/mac/Desktop/jaxb/
* Qualified Name: com.elcuk.jaxb.OptionalWeightUnitOfMeasure
* JD-Core Version: 0.6.2
*/ | kenyonduan/amazon-mws | src/main/java/com/elcuk/jaxb/OptionalWeightUnitOfMeasure.java | Java | mit | 740 |
#!/usr/bin/env python
import os
import sys # provides interaction with the Python interpreter
from functools import partial
from PyQt4 import QtGui # provides the graphic elements
from PyQt4.QtCore import Qt # provides Qt identifiers
from PyQt4.QtGui import QPushButton
try:
from sh import inxi
except:
print(" 'inxi' not found, install it to get this info")
try:
from sh import mhwd
except:
print(" 'mhwd' not found, this is not Manjaro?")
try:
from sh import hwinfo
except:
print(" 'hwinfo' not found")
try:
from sh import free
except:
print(" 'free' not found")
try:
from sh import lsblk
except:
print(" 'lsblk' not found")
try:
from sh import df
except:
print(" 'df' not found")
try:
from sh import blockdev
except:
print(" 'blockdev' not found")
try:
from sh import test
except:
print(" 'test' not found")
try:
from sh import parted
except:
print(" 'parted' not found")
TMP_FILE = "/tmp/mlogsout.txt"
HEADER = '''
===================
|{:^17}| {}
===================
'''
checkbuttons = [
'Inxi',
'Installed g. drivers',
'List all g. drivers',
'Graphic Card Info',
'Memory Info',
'Partitions',
'Free Disk Space',
'Xorg.0',
'Xorg.1',
'pacman.log',
'journalctl - Emergency',
'journalctl - Alert',
'journalctl - Critical',
'journalctl - Failed',
'Open&Rc - rc.log',
]
def look_in_file(file_name, kws):
"""reads a file and returns only the lines that contain one of the keywords"""
with open(file_name) as f:
return "".join(filter(lambda line: any(kw in line for kw in kws), f))
class Window(QtGui.QWidget):
def __init__(self, parent=None):
super(Window, self).__init__(parent)
self.checks = [False]*len(checkbuttons) # initialize all buttons to False
# creates a vertical box layout for the window
vlayout = QtGui.QVBoxLayout()
# creates the checkboxes
for idx, text in enumerate(checkbuttons):
checkbox = QtGui.QCheckBox(text)
# connects the 'stateChanged()' signal with the 'checkbox_state_changed()' slot
checkbox.stateChanged.connect(partial(self.checkbox_state_changed, idx))
vlayout.addWidget(checkbox) # adds the checkbox to the layout
btn = QPushButton("&Show Info ({})".format(TMP_FILE), self)
btn.clicked.connect(self.to_computer)
btn.clicked.connect(self.to_editor)
vlayout.addWidget(btn)
vlayout.addStretch()
self.setLayout(vlayout) # sets the window layout
def checkbox_state_changed(self, idx, state):
self.checks[idx] = state == Qt.Checked
def to_computer(self, text):
f = open(TMP_FILE, 'w') # write mode clears any previous content from the file if it exists
if self.checks[0]:
print("Saving: inxi to file")
f.write(HEADER.format("Inxi -Fxzc0", "Listing computer information"))
try:
f.write(str(inxi('-Fxxxzc0')))
except:
" 'inxi' not found, install it to get this info"
f.write('\n')
if self.checks[1]:
print("Getting info about installed graphical driver")
f.write(HEADER.format("Installed drivers", "Shows which graphic driver is installed"))
try:
f.write(str(mhwd('-li')))
except:
print(" 'mhwd' not found, this is not Manjaro?")
f.write('\n')
if self.checks[2]:
print("Getting list of all drivers supported on detected gpu's")
f.write(HEADER.format("Available drivers", "list of all drivers supported on detected gpu's"))
try:
f.write(str(mhwd('-l')))
except:
print(" 'mhwd' not found, this is not Manjaro?")
# f.write('\n')
if self.checks[3]:
print('hwinfo -graphic card')
# os.system('hwinfo --gfxcard')
f.write(HEADER.format("hwinfo --gfxcard", "Show Graphic Card info"))
try:
f.write(str(hwinfo('--gfxcard')))
except:
print('hwinfo graphic card info error')
f.write('hwinfo graphic card info error')
f.write('\n')
if self.checks[4]:
print('memory info')
# os.system('free -h')
f.write(HEADER.format("Memory Info", "Info about Memory and Swap"))
try:
f.write(str(free(' -h')))
except:
print('memory info error')
f.write('memory info error')
f.write('\n')
if self.checks[5]:
print('disk info')
# os.system('lsblk')
f.write(HEADER.format("Disk Info", "Disks and Partitions"))
try:
f.write(str(lsblk()))
except:
print('lsblk error')
f.write('lsblk error')
f.write('\n')
if self.checks[6]:
print('free disk space')
# os.system('df')
f.write(HEADER.format("Free Disk Space", "Free space per pertition"))
try:
f.write(str(df()))
except:
print('free disk space error')
f.write('free disk space error')
f.write('\n')
if self.checks[9]:
print("Saving: Xorg.0.log to file")
f.write(HEADER.format("Xorg.0.log", "searching for: failed, error & (WW) keywords"))
try:
f.write(look_in_file('/var/log/Xorg.0.log', ['failed', 'error', '(WW)']))
except FileNotFoundError:
print("/var/log/Xorg.0.log not found!")
f.write("Xorg.0.log not found!")
f.write('\n')
if self.checks[10]:
print("Saving: Xorg.1.log to file")
f.write(HEADER.format("Xorg.1.log", "searching for: failed, error & (WW) keywords"))
try:
f.write(look_in_file('/var/log/Xorg.1.log', ['failed', 'error', '(WW)']))
except FileNotFoundError:
print("/var/log/Xorg.1.log not found!")
f.write("Xorg.1.log not found!")
f.write('\n')
if self.checks[11]:
print("Saving: pacman.log to file")
f.write(HEADER.format("pacman.log", "searching for: pacsave, pacnew, pacorig keywords"))
try:
f.write(look_in_file('/var/log/pacman.log', ['pacsave', 'pacnew', 'pacorig']))
except FileNotFoundError:
print("/var/log/pacman.log not found, this is not Manjaro or Arch based Linux?")
f.write("pacman.log not found! Not Arch based OS?")
f.write('\n')
if self.checks[12]:
print("Saving: journalctl (emergency) to file")
os.system("journalctl -b > /tmp/journalctl.txt")
f.write(HEADER.format("journalctl.txt", "Searching for: Emergency keywords"))
f.write(look_in_file('/tmp/journalctl.txt', ['emergency', 'Emergency', 'EMERGENCY']))
f.write('\n')
if self.checks[13]:
print("Saving: journalctl (alert) to file")
os.system("journalctl -b > /tmp/journalctl.txt")
f.write(HEADER.format("journalctl.txt", "Searching for: Alert keywords"))
f.write(look_in_file('/tmp/journalctl.txt', ['alert', 'Alert', 'ALERT']))
f.write('\n')
if self.checks[14]:
print("Saving: journalctl (critical) to file")
os.system("journalctl -b > /tmp/journalctl.txt")
f.write(HEADER.format("journalctl.txt", "Searching for: Critical keywords"))
f.write(look_in_file('/tmp/journalctl.txt', ['critical', 'Critical', 'CRITICAL']))
f.write('\n')
if self.checks[15]:
print("Saving: journalctl (failed) to file")
os.system("journalctl -b > /tmp/journalctl.txt")
f.write(HEADER.format("journalctl.txt", "Searching for: Failed keywords"))
f.write(look_in_file('/tmp/journalctl.txt', ['failed', 'Failed', 'FAILED']))
f.write('\n')
if self.checks[16]:
print("Saving: rc.log to file")
f.write(HEADER.format("rc.log", "OpenRc only! searching for: WARNING: keywords"))
try:
f.write(look_in_file('/var/log/rc.log', ['WARNING:']))
except FileNotFoundError:
print("/var/log/rc.log not found! Systemd based OS?")
f.write("rc.log not found! Systemd based OS?")
f.write('\n')
f.close()
def to_editor(self):
os.system("xdg-open "+TMP_FILE)
# creates the application and takes arguments from the command line
application = QtGui.QApplication(sys.argv)
# creates the window and sets its properties
window = Window()
window.setWindowTitle('Manjaro Logs') # title
window.resize(280, 50) # size
window.show() # shows the window
# runs the application and waits for its return value at the end
sys.exit(application.exec_())
| AlManja/logs.py | logsgui3.py | Python | mit | 9,203 |
<?php
$path = '/home3/johangau/orcapilot';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once 'framework_0_2/_include.inc';
$session = new Session();
$pa = new PilotArray();
$pa->loadOperationPilots($_GET['operation']);
include 'framework_0_2/_header.php';
?>
<h3>Make a payment</h3>
<p>select from the list</p>
<p><form action="singleoperation.php"><?php $pa->getHTMLdropdown(); ?> <input type="text" class="dark" name="amount"><br>
<input class="button" type="image" width="88" height="19" border="0" src="images/paypilot.png" />
<input type="hidden" name="operation" value="<?php if(isset($_GET['operation']))echo $_GET['operation'];?>" />
<input type="hidden" name="makepayment" value="yes" />
<input type="hidden" name="session" value="<?php echo $session->getSessionHash();?>">
<input type="hidden" name="verification" value="<?php echo Payment::getNewVerificationCode();?>">
</form></p>
<p>Or add a new pilot/user</p>
| johangau/Orca-Pilot | public_html/app/paypilot.php | PHP | mit | 965 |
import express from 'express'
import adminOnly from 'desktop/lib/admin_only'
import { buildServerApp } from 'reaction/Router'
import { routes } from './routes'
import { renderLayout } from '@artsy/stitch'
import { Meta } from './components/Meta'
const app = (module.exports = express())
app.get('/isomorphic-relay-example*', adminOnly, async (req, res, next) => {
try {
const { ServerApp, redirect, status } = await buildServerApp({
routes,
url: req.url,
})
if (redirect) {
res.redirect(302, redirect.url)
return
}
const layout = await renderLayout({
basePath: __dirname,
layout: '../../components/main_layout/templates/react_index.jade',
config: {
styledComponents: true,
},
blocks: {
head: Meta,
body: ServerApp,
},
locals: {
...res.locals,
assetPackage: 'relay',
styledComponents: true,
},
})
res.status(status).send(layout)
} catch (error) {
console.log(error)
next(error)
}
})
| kanaabe/force | src/desktop/apps/isomorphic-relay-example/server.js | JavaScript | mit | 1,049 |
var view = require("ui/core/view");
var proxy = require("ui/core/proxy");
var dependencyObservable = require("ui/core/dependency-observable");
var color = require("color");
var bindable = require("ui/core/bindable");
var types;
function ensureTypes() {
if (!types) {
types = require("utils/types");
}
}
var knownCollections;
(function (knownCollections) {
knownCollections.items = "items";
})(knownCollections = exports.knownCollections || (exports.knownCollections = {}));
var SegmentedBarItem = (function (_super) {
__extends(SegmentedBarItem, _super);
function SegmentedBarItem() {
_super.apply(this, arguments);
this._title = "";
}
Object.defineProperty(SegmentedBarItem.prototype, "title", {
get: function () {
return this._title;
},
set: function (value) {
if (this._title !== value) {
this._title = value;
this._update();
}
},
enumerable: true,
configurable: true
});
SegmentedBarItem.prototype._update = function () {
};
return SegmentedBarItem;
}(bindable.Bindable));
exports.SegmentedBarItem = SegmentedBarItem;
var SegmentedBar = (function (_super) {
__extends(SegmentedBar, _super);
function SegmentedBar() {
_super.apply(this, arguments);
}
SegmentedBar.prototype._addArrayFromBuilder = function (name, value) {
if (name === "items") {
this._setValue(SegmentedBar.itemsProperty, value);
}
};
SegmentedBar.prototype._adjustSelectedIndex = function (items) {
if (this.items) {
if (this.items.length > 0) {
ensureTypes();
if (types.isUndefined(this.selectedIndex) || (this.selectedIndex > this.items.length - 1)) {
this._setValue(SegmentedBar.selectedIndexProperty, 0);
}
}
else {
this._setValue(SegmentedBar.selectedIndexProperty, undefined);
}
}
else {
this._setValue(SegmentedBar.selectedIndexProperty, undefined);
}
};
Object.defineProperty(SegmentedBar.prototype, "selectedIndex", {
get: function () {
return this._getValue(SegmentedBar.selectedIndexProperty);
},
set: function (value) {
this._setValue(SegmentedBar.selectedIndexProperty, value);
},
enumerable: true,
configurable: true
});
Object.defineProperty(SegmentedBar.prototype, "items", {
get: function () {
return this._getValue(SegmentedBar.itemsProperty);
},
set: function (value) {
this._setValue(SegmentedBar.itemsProperty, value);
},
enumerable: true,
configurable: true
});
Object.defineProperty(SegmentedBar.prototype, "selectedBackgroundColor", {
get: function () {
return this._getValue(SegmentedBar.selectedBackgroundColorProperty);
},
set: function (value) {
this._setValue(SegmentedBar.selectedBackgroundColorProperty, value instanceof color.Color ? value : new color.Color(value));
},
enumerable: true,
configurable: true
});
SegmentedBar.prototype._onBindingContextChanged = function (oldValue, newValue) {
_super.prototype._onBindingContextChanged.call(this, oldValue, newValue);
if (this.items && this.items.length > 0) {
var i = 0;
var length = this.items.length;
for (; i < length; i++) {
this.items[i].bindingContext = newValue;
}
}
};
SegmentedBar.selectedBackgroundColorProperty = new dependencyObservable.Property("selectedBackgroundColor", "SegmentedBar", new proxy.PropertyMetadata(undefined));
SegmentedBar.selectedIndexProperty = new dependencyObservable.Property("selectedIndex", "SegmentedBar", new proxy.PropertyMetadata(undefined));
SegmentedBar.itemsProperty = new dependencyObservable.Property("items", "SegmentedBar", new proxy.PropertyMetadata(undefined));
SegmentedBar.selectedIndexChangedEvent = "selectedIndexChanged";
return SegmentedBar;
}(view.View));
exports.SegmentedBar = SegmentedBar;
| danik121/HAN-MAD-DT-NATIVESCRIPT | node_modules/tns-core-modules/ui/segmented-bar/segmented-bar-common.js | JavaScript | mit | 4,284 |
using System;
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
namespace advent.Solutions
{
[UsedImplicitly]
internal class Day1 : Day
{
public Day1()
{
DayNumber = 1;
LoadInput();
}
#region IDay Members
protected override ICollection<string> DoPart1()
{
var total = DataAsInts.Sum(DetermineFuel);
return new List<string> { $"Total fuel: {total}" };
}
protected override ICollection<string> DoPart2()
{
var total = DataAsInts.Sum(DetermineFuelRecursive);
return new List<string> {$"Total fuel: {total}"};
}
#endregion IDay Members
#region Private Methods
private int DetermineFuel(int mass)
{
var a = mass / 3.0;
var b = Math.Floor(a);
var c = int.Parse(b.ToString(Culture), Culture.NumberFormat);
var d = c - 2;
return int.Parse(d.ToString(Culture), Culture.NumberFormat);
}
private int DetermineFuelRecursive(int mass)
{
var fuel = DetermineFuel(mass);
if (fuel < 0)
return 0;
return fuel + DetermineFuelRecursive(fuel);
}
#endregion Private Methods
}
}
| rnelson/adventofcode | advent2019/advent/Solutions/Day1.cs | C# | mit | 1,433 |
// This code is part of the Fungus library (https://github.com/snozbot/fungus)
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
namespace Fungus
{
public class GameObjectCollection : GenericCollection<UnityEngine.GameObject>
{
}
} | snozbot/fungus | Assets/Fungus/Scripts/VariableTypes/Collection/GameObjectCollection.cs | C# | mit | 314 |
<?php
require_once __DIR__ . '/fpBaseErrorNotifierDecorator.php';
/**
*
* @package fpErrorNotifier
* @subpackage decorator
*
* @author Maksim Kotlyar <mkotlar@ukr.net>
*/
class fpErrorNotifierDecoratorHtml extends fpBaseErrorNotifierDecorator
{
/**
*
* @return string
*/
public function format()
{
return 'text/html';
}
/**
*
* @return string
*/
public function render()
{
return '<html><body style="font-family: Verdana, Arial;">'.parent::render().'</body></html>';
}
/**
*
* @param array $data
*
* @return string
*/
protected function _renderSection(array $data)
{
$body = '<table cellspacing="1" width="100%">';
foreach ($data as $name => $value) {
$body .= $this->_renderRow($name, $value);
}
$body .= '</table>';
return $body;
}
/**
*
* @param string $th
* @param string $td
*
* @return string
*/
protected function _renderRow($th, $td = '')
{
return "
<tr style=\"padding: 4px;spacing: 0;\">\n
<th style=\"background:#cccccc;padding-top: 13px;vertical-align:top\" width=\"140px\">
{$this->notifier()->helper()->formatTitle($th)}:
</th>\n
<td style=\"padding: 4px;spacing: 0;text-align: left;background:#eeeeee\">
{$this->_prepareValue($td)}
</td>\n
</tr>";
}
/**
*
* @param string $title
*
* @return string
*/
protected function _renderTitle($title)
{
return "<h1 style=\"background: #0055A4; color:#ffffff;padding:5px;\">
{$this->notifier()->helper()->formatTitle($title)}
</h1>";
}
/**
*
* @param string $value
*
* @return string
*/
protected function _prepareValue($value)
{
$return = "<pre style='margin: 0; display: block; color: black; font-family: Verdana; border: 1px solid #cccccc; padding: 5px 5px 8px; font-size: 15px;'>";
$return .= $this->notifier()->helper()->formatValue($value);
$return .= '</pre>';
return $return;
}
}
| CollectorsQuest/cqErrorNotifierPlugin | lib/decorator/fpErrorNotifierDecoratorHtml.php | PHP | mit | 2,031 |
package nineChap5_DP2;
/**
* http://www.lintcode.com/en/problem/regular-expression-matching/
* Created at 9:59 AM on 11/29/15.
*/
public class RegularExpressionMatching {
public static void main(String[] args) {
String s = "aaaab";
String p = "a*b";
boolean ans = new RegularExpressionMatching().isMatch(s,p);
System.out.println(ans);
}
/**
* @param s: A string
* @param p: A string includes "." and "*"
* @return: A boolean
*/
public boolean isMatch(String s, String p) {
// write your code here
// Ganker recursion
//return gankerRec(s,p,0,0);
// hehejun's DP
return heheDP(s, p);
}
/**
* Ganker's explanation is the best.
* @param s
* @param p
* @param i
* @param j
* @return
*/
private boolean gankerRec(String s, String p, int i, int j) {
if (j == p.length()) {
return i == s.length();
}
if (j == p.length()-1 || p.charAt(j+1) != '*') {
if (i == s.length() || s.charAt(i)!=p.charAt(j) && p.charAt(j) != '.') {
return false;
}
else {
return gankerRec(s,p,i+1,j+1);
}
}
// p.charAt(j+1) == '*'
while (i < s.length() && (p.charAt(j) == '.' || s.charAt(i) == p.charAt(j))) {
if (gankerRec(s,p,i,j+2)) {
return true;
}
i++;
}
return gankerRec(s,p,i,j+2);
}
/**
* http://hehejun.blogspot.com/2014/11/leetcoderegular-expression-matching_4.html
* So clean and elegant DP!
* @param s
* @param p
* @return
*/
private boolean heheDP(String s, String p) {
if (s == null || p == null) {
return false;
}
int lens = s.length();
int lenp = p.length();
boolean[][] F = new boolean[lenp+1][lens+1];
F[0][0] = true;
for (int i = 0; i < lenp; ++i) {
if (p.charAt(i) != '*') {
F[i+1][0] = false;
}
else {
F[i+1][0] = F[i-1][0];
}
}
for (int i = 0; i < lenp; ++i) {
for (int j = 0; j < lens; ++j) {
if (p.charAt(i) == s.charAt(j) || p.charAt(i) == '.') {
F[i+1][j+1] = F[i][j];
}
else if (p.charAt(i) == '*') {
F[i+1][j+1] = F[i][j+1] || F[i-1][j+1] ||
(F[i+1][j] && s.charAt(j) == p.charAt(i-1)
|| p.charAt(i-1) == '.');
}
}
}
return F[lenp][lens];
}
}
| vlsi1217/leetlint | src/nineChap5_DP2/RegularExpressionMatching.java | Java | mit | 2,348 |
a = [1,2,3,4,5]
b = [2,3,4,5,6]
to_100=list(range(1,100))
print ("Printing B")
for i in a:
print i
print ("Printing A")
for i in b:
print i
print ("Print 100 elements")
for i in to_100:
print i | davidvillaciscalderon/PythonLab | Session 4/bucles.py | Python | mit | 211 |
<?xml version="1.0" ?><!DOCTYPE TS><TS language="ca_ES" version="2.1">
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About BitSeeds</source>
<translation>Sobre BitSeeds</translation>
</message>
<message>
<location line="+39"/>
<source><b>BitSeeds</b> version</source>
<translation>versió <b>BitSeeds</b></translation>
</message>
<message>
<location line="+41"/>
<source>Copyright © 2009-2014 The Bitcoin developers
Copyright © 2012-2014 The NovaCoin developers
Copyright © 2014 The BitSeeds developers</source>
<translation>Copyright © 2009-2014 The Bitcoin developers
Copyright © 2012-2014 The NovaCoin developers
Copyright © 2014 The BitSeeds developers</translation>
</message>
<message>
<location line="+15"/>
<source>
This is experimental software.
Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard.</source>
<translation>\n Aquest és software experimental.\n\n Distribuït sota llicència de software MIT/11, veure l'arxiu COPYING o http://www.opensource.org/licenses/mit-license.php.\n\nAquest producte inclou software desarrollat pel projecte OpenSSL per a l'ús de OppenSSL Toolkit (http://www.openssl.org/) i de software criptogràfic escrit per l'Eric Young (eay@cryptsoft.com) i software UPnP escrit per en Thomas Bernard.</translation>
</message>
</context>
<context>
<name>AddressBookPage</name>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>Address Book</source>
<translation>Llibreta d'adreces</translation>
</message>
<message>
<location line="+22"/>
<source>Double-click to edit address or label</source>
<translation>Feu doble clic per editar l'adreça o l'etiqueta</translation>
</message>
<message>
<location line="+27"/>
<source>Create a new address</source>
<translation>Crear una nova adreça</translation>
</message>
<message>
<location line="+14"/>
<source>Copy the currently selected address to the system clipboard</source>
<translation>Copiar l'adreça seleccionada al porta-retalls del sistema</translation>
</message>
<message>
<location line="-11"/>
<source>&New Address</source>
<translation>&Nova adreça</translation>
</message>
<message>
<location line="-46"/>
<source>These are your BitSeeds addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source>
<translation>Aquestes són les teves adreces de BitSeeds per rebre els pagaments. És possible que vulgueu donar una diferent a cada remitent per a poder realitzar un seguiment de qui li está pagant.</translation>
</message>
<message>
<location line="+60"/>
<source>&Copy Address</source>
<translation>&Copiar adreça</translation>
</message>
<message>
<location line="+11"/>
<source>Show &QR Code</source>
<translation>Mostra el códi &QR</translation>
</message>
<message>
<location line="+11"/>
<source>Sign a message to prove you own a BitSeeds address</source>
<translation>Signar un missatge per demostrar que és propietari d'una adreça BitSeeds</translation>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation>Signar &Message</translation>
</message>
<message>
<location line="+25"/>
<source>Delete the currently selected address from the list</source>
<translation>Esborrar l'adreça sel·leccionada</translation>
</message>
<message>
<location line="-14"/>
<source>Verify a message to ensure it was signed with a specified BitSeeds address</source>
<translation>Comproveu el missatge per assegurar-se que es va signar amb una adreça BitSeeds especificada.</translation>
</message>
<message>
<location line="+3"/>
<source>&Verify Message</source>
<translation>&Verificar el missatge</translation>
</message>
<message>
<location line="+14"/>
<source>&Delete</source>
<translation>&Esborrar</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="+65"/>
<source>Copy &Label</source>
<translation>Copiar &Etiqueta</translation>
</message>
<message>
<location line="+2"/>
<source>&Edit</source>
<translation>&Editar</translation>
</message>
<message>
<location line="+250"/>
<source>Export Address Book Data</source>
<translation>Exportar dades de la llibreta d'adreces </translation>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Arxiu de separació per comes (*.csv)</translation>
</message>
<message>
<location line="+13"/>
<source>Error exporting</source>
<translation>Error a l'exportar</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>No s'ha pogut escriure al fitxer %1.</translation>
</message>
</context>
<context>
<name>AddressTableModel</name>
<message>
<location filename="../addresstablemodel.cpp" line="+144"/>
<source>Label</source>
<translation>Etiqueta</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Adreça</translation>
</message>
<message>
<location line="+36"/>
<source>(no label)</source>
<translation>(sense etiqueta)</translation>
</message>
</context>
<context>
<name>AskPassphraseDialog</name>
<message>
<location filename="../forms/askpassphrasedialog.ui" line="+26"/>
<source>Passphrase Dialog</source>
<translation>Dialeg de contrasenya</translation>
</message>
<message>
<location line="+21"/>
<source>Enter passphrase</source>
<translation>Introdueix contrasenya</translation>
</message>
<message>
<location line="+14"/>
<source>New passphrase</source>
<translation>Nova contrasenya</translation>
</message>
<message>
<location line="+14"/>
<source>Repeat new passphrase</source>
<translation>Repeteix la nova contrasenya</translation>
</message>
<message>
<location line="+33"/>
<source>Serves to disable the trivial sendmoney when OS account compromised. Provides no real security.</source>
<translation>Serveix per desactivar l'enviament trivial de diners quan el compte del sistema operatiu ha estat compromès. No ofereix seguretat real.</translation>
</message>
<message>
<location line="+3"/>
<source>For staking only</source>
<translation>Només per a fer "stake"</translation>
</message>
<message>
<location filename="../askpassphrasedialog.cpp" line="+35"/>
<source>Enter the new passphrase to the wallet.<br/>Please use a passphrase of <b>10 or more random characters</b>, or <b>eight or more words</b>.</source>
<translation>Introdueixi la nova contrasenya al moneder<br/>Si us plau useu una contrasenya de <b>10 o més caracters aleatoris</b>, o <b>vuit o més paraules</b>.</translation>
</message>
<message>
<location line="+1"/>
<source>Encrypt wallet</source>
<translation>Xifrar el moneder</translation>
</message>
<message>
<location line="+7"/>
<source>This operation needs your wallet passphrase to unlock the wallet.</source>
<translation>Aquesta operació requereix la seva contrasenya del moneder per a desbloquejar-lo.</translation>
</message>
<message>
<location line="+5"/>
<source>Unlock wallet</source>
<translation>Desbloqueja el moneder</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to decrypt the wallet.</source>
<translation>Aquesta operació requereix la seva contrasenya del moneder per a desencriptar-lo.</translation>
</message>
<message>
<location line="+5"/>
<source>Decrypt wallet</source>
<translation>Desencripta el moneder</translation>
</message>
<message>
<location line="+3"/>
<source>Change passphrase</source>
<translation>Canviar la contrasenya</translation>
</message>
<message>
<location line="+1"/>
<source>Enter the old and new passphrase to the wallet.</source>
<translation>Introdueixi tant l'antiga com la nova contrasenya de moneder.</translation>
</message>
<message>
<location line="+46"/>
<source>Confirm wallet encryption</source>
<translation>Confirmar l'encriptació del moneder</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR COINS</b>!</source>
<translation>Avís: Si xifra el seu moneder i perd la contrasenya, podrà <b> PERDRE TOTES LES SEVES MONEDES </ b>!</translation>
</message>
<message>
<location line="+0"/>
<source>Are you sure you wish to encrypt your wallet?</source>
<translation>Esteu segur que voleu encriptar el vostre moneder?</translation>
</message>
<message>
<location line="+15"/>
<source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source>
<translation>IMPORTANT: Tota copia de seguretat que hagis realitzat hauria de ser reemplaçada pel, recentment generat, arxiu encriptat del moneder.</translation>
</message>
<message>
<location line="+103"/>
<location line="+24"/>
<source>Warning: The Caps Lock key is on!</source>
<translation>Advertència: Les lletres majúscules estàn activades!</translation>
</message>
<message>
<location line="-133"/>
<location line="+60"/>
<source>Wallet encrypted</source>
<translation>Moneder encriptat</translation>
</message>
<message>
<location line="-58"/>
<source>BitSeeds will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your coins from being stolen by malware infecting your computer.</source>
<translation>BitSeeds tancarà ara per acabar el procés de xifrat. Recordeu que l'encriptació del seu moneder no pot protegir completament les seves monedes de ser robades pel malware que pugui infectar al seu equip.</translation>
</message>
<message>
<location line="+13"/>
<location line="+7"/>
<location line="+44"/>
<location line="+6"/>
<source>Wallet encryption failed</source>
<translation>L'encriptació del moneder ha fallat</translation>
</message>
<message>
<location line="-56"/>
<source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source>
<translation>L'encriptació del moneder ha fallat per un error intern. El seu moneder no ha estat encriptat.</translation>
</message>
<message>
<location line="+7"/>
<location line="+50"/>
<source>The supplied passphrases do not match.</source>
<translation>La contrasenya introduïda no coincideix.</translation>
</message>
<message>
<location line="-38"/>
<source>Wallet unlock failed</source>
<translation>El desbloqueig del moneder ha fallat</translation>
</message>
<message>
<location line="+1"/>
<location line="+12"/>
<location line="+19"/>
<source>The passphrase entered for the wallet decryption was incorrect.</source>
<translation>La contrasenya introduïda per a desencriptar el moneder és incorrecte.</translation>
</message>
<message>
<location line="-20"/>
<source>Wallet decryption failed</source>
<translation>La desencriptació del moneder ha fallat</translation>
</message>
<message>
<location line="+14"/>
<source>Wallet passphrase was successfully changed.</source>
<translation>La contrasenya del moneder ha estat modificada correctament.</translation>
</message>
</context>
<context>
<name>BitcoinGUI</name>
<message>
<location filename="../bitcoingui.cpp" line="+280"/>
<source>Sign &message...</source>
<translation>Signar &missatge...</translation>
</message>
<message>
<location line="+242"/>
<source>Synchronizing with network...</source>
<translation>Sincronitzant amb la xarxa ...</translation>
</message>
<message>
<location line="-308"/>
<source>&Overview</source>
<translation>&Panorama general</translation>
</message>
<message>
<location line="+1"/>
<source>Show general overview of wallet</source>
<translation>Mostra panorama general del moneder</translation>
</message>
<message>
<location line="+17"/>
<source>&Transactions</source>
<translation>&Transaccions</translation>
</message>
<message>
<location line="+1"/>
<source>Browse transaction history</source>
<translation>Cerca a l'historial de transaccions</translation>
</message>
<message>
<location line="+5"/>
<source>&Address Book</source>
<translation>&Llibreta d'adreces</translation>
</message>
<message>
<location line="+1"/>
<source>Edit the list of stored addresses and labels</source>
<translation>Edició de la llista d'adreces i etiquetes emmagatzemades</translation>
</message>
<message>
<location line="-13"/>
<source>&Receive coins</source>
<translation>&Rebre monedes</translation>
</message>
<message>
<location line="+1"/>
<source>Show the list of addresses for receiving payments</source>
<translation>Mostra la llista d'adreces per rebre pagaments</translation>
</message>
<message>
<location line="-7"/>
<source>&Send coins</source>
<translation>&Enviar monedes</translation>
</message>
<message>
<location line="+35"/>
<source>E&xit</source>
<translation>S&ortir</translation>
</message>
<message>
<location line="+1"/>
<source>Quit application</source>
<translation>Sortir de l'aplicació</translation>
</message>
<message>
<location line="+4"/>
<source>Show information about BitSeeds</source>
<translation>Mostra informació sobre BitSeeds</translation>
</message>
<message>
<location line="+2"/>
<source>About &Qt</source>
<translation>Sobre &Qt</translation>
</message>
<message>
<location line="+1"/>
<source>Show information about Qt</source>
<translation>Mostra informació sobre Qt</translation>
</message>
<message>
<location line="+2"/>
<source>&Options...</source>
<translation>&Opcions...</translation>
</message>
<message>
<location line="+4"/>
<source>&Encrypt Wallet...</source>
<translation>&Xifrar moneder</translation>
</message>
<message>
<location line="+3"/>
<source>&Backup Wallet...</source>
<translation>&Realitzar copia de seguretat del moneder...</translation>
</message>
<message>
<location line="+2"/>
<source>&Change Passphrase...</source>
<translation>&Canviar contrasenya...</translation>
</message>
<message numerus="yes">
<location line="+250"/>
<source>~%n block(s) remaining</source>
<translation><numerusform>~%n bloc restant</numerusform><numerusform>~%n blocs restants</numerusform></translation>
</message>
<message>
<location line="+6"/>
<source>Downloaded %1 of %2 blocks of transaction history (%3% done).</source>
<translation>Descarregats %1 de %2 blocs d'historial de transaccions (%3% completat).</translation>
</message>
<message>
<location line="-247"/>
<source>&Export...</source>
<translation>&Exportar...</translation>
</message>
<message>
<location line="-62"/>
<source>Send coins to a BitSeeds address</source>
<translation>Enviar monedes a una adreça BitSeeds</translation>
</message>
<message>
<location line="+45"/>
<source>Modify configuration options for BitSeeds</source>
<translation>Modificar les opcions de configuració per a BitSeeds</translation>
</message>
<message>
<location line="+18"/>
<source>Export the data in the current tab to a file</source>
<translation>Exportar les dades de la pestanya actual a un arxiu</translation>
</message>
<message>
<location line="-14"/>
<source>Encrypt or decrypt wallet</source>
<translation>Xifrar o desxifrar moneder</translation>
</message>
<message>
<location line="+3"/>
<source>Backup wallet to another location</source>
<translation>Realitzar còpia de seguretat del moneder a un altre directori</translation>
</message>
<message>
<location line="+2"/>
<source>Change the passphrase used for wallet encryption</source>
<translation>Canviar la constrasenya d'encriptació del moneder</translation>
</message>
<message>
<location line="+10"/>
<source>&Debug window</source>
<translation>&Finestra de depuració</translation>
</message>
<message>
<location line="+1"/>
<source>Open debugging and diagnostic console</source>
<translation>Obrir la consola de diagnòstic i depuració</translation>
</message>
<message>
<location line="-5"/>
<source>&Verify message...</source>
<translation>&Verifica el missatge..</translation>
</message>
<message>
<location line="-200"/>
<source>BitSeeds</source>
<translation>BitSeeds</translation>
</message>
<message>
<location line="+0"/>
<source>Wallet</source>
<translation>Moneder</translation>
</message>
<message>
<location line="+178"/>
<source>&About BitSeeds</source>
<translation>&Sobre BitSeeds</translation>
</message>
<message>
<location line="+9"/>
<source>&Show / Hide</source>
<translation>&Mostrar / Amagar</translation>
</message>
<message>
<location line="+9"/>
<source>Unlock wallet</source>
<translation>Desbloquejar el moneder</translation>
</message>
<message>
<location line="+1"/>
<source>&Lock Wallet</source>
<translation>&Bloquejar moneder</translation>
</message>
<message>
<location line="+1"/>
<source>Lock wallet</source>
<translation>Bloquejar moneder</translation>
</message>
<message>
<location line="+34"/>
<source>&File</source>
<translation>&Arxiu</translation>
</message>
<message>
<location line="+8"/>
<source>&Settings</source>
<translation>&Configuració</translation>
</message>
<message>
<location line="+8"/>
<source>&Help</source>
<translation>&Ajuda</translation>
</message>
<message>
<location line="+9"/>
<source>Tabs toolbar</source>
<translation>Barra d'eines de seccions</translation>
</message>
<message>
<location line="+8"/>
<source>Actions toolbar</source>
<translation>Barra d'eines d'accions</translation>
</message>
<message>
<location line="+13"/>
<location line="+9"/>
<source>[testnet]</source>
<translation>[testnet]</translation>
</message>
<message>
<location line="+0"/>
<location line="+60"/>
<source>BitSeeds client</source>
<translation>Client BitSeeds</translation>
</message>
<message numerus="yes">
<location line="+70"/>
<source>%n active connection(s) to BitSeeds network</source>
<translation><numerusform>%n conexió activa a la xarxa BitSeeds</numerusform><numerusform>%n conexions actives a la xarxa BitSeeds</numerusform></translation>
</message>
<message>
<location line="+40"/>
<source>Downloaded %1 blocks of transaction history.</source>
<translation>Descarregats %1 blocs d'historial de transaccions</translation>
</message>
<message>
<location line="+413"/>
<source>Staking.<br>Your weight is %1<br>Network weight is %2<br>Expected time to earn reward is %3</source>
<translation>Fent "stake".<br>El teu pes és %1<br>El pes de la xarxa és %2<br>El temps estimat per a guanyar una recompensa és 3%</translation>
</message>
<message>
<location line="+6"/>
<source>Not staking because wallet is locked</source>
<translation>No s'està fent "stake" perquè el moneder esa bloquejat</translation>
</message>
<message>
<location line="+2"/>
<source>Not staking because wallet is offline</source>
<translation>No s'està fent "stake" perquè el moneder està fora de línia</translation>
</message>
<message>
<location line="+2"/>
<source>Not staking because wallet is syncing</source>
<translation>No s'està fent "stake" perquè el moneder està sincronitzant</translation>
</message>
<message>
<location line="+2"/>
<source>Not staking because you don't have mature coins</source>
<translation>No s'està fent "stake" perquè no tens monedes madures</translation>
</message>
<message numerus="yes">
<location line="-403"/>
<source>%n second(s) ago</source>
<translation><numerusform>fa %n segon</numerusform><numerusform>fa %n segons</numerusform></translation>
</message>
<message>
<location line="-284"/>
<source>&Unlock Wallet...</source>
<translation>&Desbloquejar moneder</translation>
</message>
<message numerus="yes">
<location line="+288"/>
<source>%n minute(s) ago</source>
<translation><numerusform>fa %n minut</numerusform><numerusform>fa %n minuts</numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n hour(s) ago</source>
<translation><numerusform>fa %n hora</numerusform><numerusform>fa %n hores</numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n day(s) ago</source>
<translation><numerusform>fa %n dia</numerusform><numerusform>fa %n dies</numerusform></translation>
</message>
<message>
<location line="+6"/>
<source>Up to date</source>
<translation>Al dia</translation>
</message>
<message>
<location line="+7"/>
<source>Catching up...</source>
<translation>Posar-se al dia ...</translation>
</message>
<message>
<location line="+10"/>
<source>Last received block was generated %1.</source>
<translation>El darrer bloc rebut s'ha generat %1.</translation>
</message>
<message>
<location line="+59"/>
<source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source>
<translation>Aquesta transacció es troba sobre el límit de mida. Encara pot enviar-la amb una comisió de 1%, aquesta va als nodes que processen la seva transacció i ajuda a mantenir la xarxa. Vol pagar la quota?</translation>
</message>
<message>
<location line="+5"/>
<source>Confirm transaction fee</source>
<translation>Confirmeu comisió</translation>
</message>
<message>
<location line="+27"/>
<source>Sent transaction</source>
<translation>Transacció enviada</translation>
</message>
<message>
<location line="+1"/>
<source>Incoming transaction</source>
<translation>Transacció entrant</translation>
</message>
<message>
<location line="+1"/>
<source>Date: %1
Amount: %2
Type: %3
Address: %4
</source>
<translation>Data: %1\nQuantitat %2\n Tipus: %3\n Adreça: %4\n</translation>
</message>
<message>
<location line="+100"/>
<location line="+15"/>
<source>URI handling</source>
<translation>Manejant URI</translation>
</message>
<message>
<location line="-15"/>
<location line="+15"/>
<source>URI can not be parsed! This can be caused by an invalid BitSeeds address or malformed URI parameters.</source>
<translation>l'URI no es pot analitzar! Això pot ser causat per una adreça BitSeeds no vàlida o paràmetres URI malformats.</translation>
</message>
<message>
<location line="+18"/>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source>
<translation>El moneder està <b>encriptat</b> i actualment <b>desbloquejat</b></translation>
</message>
<message>
<location line="+10"/>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation>El moneder està <b>encriptat</b> i actualment <b>bloquejat</b></translation>
</message>
<message>
<location line="+25"/>
<source>Backup Wallet</source>
<translation>Realitzar còpia de seguretat del moneder</translation>
</message>
<message>
<location line="+0"/>
<source>Wallet Data (*.dat)</source>
<translation>Dades del moneder (*.dat)</translation>
</message>
<message>
<location line="+3"/>
<source>Backup Failed</source>
<translation>Còpia de seguretat fallida</translation>
</message>
<message>
<location line="+0"/>
<source>There was an error trying to save the wallet data to the new location.</source>
<translation>Hi ha un error al tractar de salvar les dades del seu moneder a la nova ubicació.</translation>
</message>
<message numerus="yes">
<location line="+76"/>
<source>%n second(s)</source>
<translation><numerusform>%n segon</numerusform><numerusform>%n segons</numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n minute(s)</source>
<translation><numerusform>%n minut</numerusform><numerusform>%n minuts</numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n hour(s)</source>
<translation><numerusform>%n hora</numerusform><numerusform>%n hores</numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n day(s)</source>
<translation><numerusform>%n dia</numerusform><numerusform>%n dies</numerusform></translation>
</message>
<message>
<location line="+18"/>
<source>Not staking</source>
<translation>No s'està fent "stake" </translation>
</message>
<message>
<location filename="../bitcoin.cpp" line="+109"/>
<source>A fatal error occurred. BitSeeds can no longer continue safely and will quit.</source>
<translation>S'ha produït un error fatal. BitSeeds ja no pot continuar de forma segura i es tancarà.</translation>
</message>
</context>
<context>
<name>ClientModel</name>
<message>
<location filename="../clientmodel.cpp" line="+90"/>
<source>Network Alert</source>
<translation>Alerta de xarxa</translation>
</message>
</context>
<context>
<name>CoinControlDialog</name>
<message>
<location filename="../forms/coincontroldialog.ui" line="+14"/>
<source>Coin Control</source>
<translation>Opcions del control de monedes</translation>
</message>
<message>
<location line="+31"/>
<source>Quantity:</source>
<translation>Quantitat:</translation>
</message>
<message>
<location line="+32"/>
<source>Bytes:</source>
<translation>Bytes:</translation>
</message>
<message>
<location line="+48"/>
<source>Amount:</source>
<translation>Quantitat:</translation>
</message>
<message>
<location line="+32"/>
<source>Priority:</source>
<translation>Prioritat:</translation>
</message>
<message>
<location line="+48"/>
<source>Fee:</source>
<translation>Quota:</translation>
</message>
<message>
<location line="+35"/>
<source>Low Output:</source>
<translation>Sortida baixa:</translation>
</message>
<message>
<location filename="../coincontroldialog.cpp" line="+551"/>
<source>no</source>
<translation>no</translation>
</message>
<message>
<location filename="../forms/coincontroldialog.ui" line="+51"/>
<source>After Fee:</source>
<translation>Quota posterior:</translation>
</message>
<message>
<location line="+35"/>
<source>Change:</source>
<translation>Canvi:</translation>
</message>
<message>
<location line="+69"/>
<source>(un)select all</source>
<translation>(de)seleccionar tot</translation>
</message>
<message>
<location line="+13"/>
<source>Tree mode</source>
<translation>Mode arbre</translation>
</message>
<message>
<location line="+16"/>
<source>List mode</source>
<translation>Mode llista</translation>
</message>
<message>
<location line="+45"/>
<source>Amount</source>
<translation>Quantitat</translation>
</message>
<message>
<location line="+5"/>
<source>Label</source>
<translation>Etiqueta</translation>
</message>
<message>
<location line="+5"/>
<source>Address</source>
<translation>Adreça</translation>
</message>
<message>
<location line="+5"/>
<source>Date</source>
<translation>Data</translation>
</message>
<message>
<location line="+5"/>
<source>Confirmations</source>
<translation>Confirmacions</translation>
</message>
<message>
<location line="+3"/>
<source>Confirmed</source>
<translation>Confirmat</translation>
</message>
<message>
<location line="+5"/>
<source>Priority</source>
<translation>Prioritat</translation>
</message>
<message>
<location filename="../coincontroldialog.cpp" line="-515"/>
<source>Copy address</source>
<translation>Copiar adreça </translation>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation>Copiar etiqueta</translation>
</message>
<message>
<location line="+1"/>
<location line="+26"/>
<source>Copy amount</source>
<translation>Copiar quantitat</translation>
</message>
<message>
<location line="-25"/>
<source>Copy transaction ID</source>
<translation>Copiar ID de transacció</translation>
</message>
<message>
<location line="+24"/>
<source>Copy quantity</source>
<translation>Copiar quantitat</translation>
</message>
<message>
<location line="+2"/>
<source>Copy fee</source>
<translation>Copiar comisió</translation>
</message>
<message>
<location line="+1"/>
<source>Copy after fee</source>
<translation>Copiar després de comisió</translation>
</message>
<message>
<location line="+1"/>
<source>Copy bytes</source>
<translation>Copiar bytes</translation>
</message>
<message>
<location line="+1"/>
<source>Copy priority</source>
<translation>Copiar prioritat</translation>
</message>
<message>
<location line="+1"/>
<source>Copy low output</source>
<translation>Copiar sortida baixa</translation>
</message>
<message>
<location line="+1"/>
<source>Copy change</source>
<translation>Copiar canvi</translation>
</message>
<message>
<location line="+317"/>
<source>highest</source>
<translation>El més alt</translation>
</message>
<message>
<location line="+1"/>
<source>high</source>
<translation>Alt</translation>
</message>
<message>
<location line="+1"/>
<source>medium-high</source>
<translation>mig-alt</translation>
</message>
<message>
<location line="+1"/>
<source>medium</source>
<translation>mig</translation>
</message>
<message>
<location line="+4"/>
<source>low-medium</source>
<translation>baix-mig</translation>
</message>
<message>
<location line="+1"/>
<source>low</source>
<translation>baix</translation>
</message>
<message>
<location line="+1"/>
<source>lowest</source>
<translation>el més baix</translation>
</message>
<message>
<location line="+155"/>
<source>DUST</source>
<translation>POLS</translation>
</message>
<message>
<location line="+0"/>
<source>yes</source>
<translation>si</translation>
</message>
<message>
<location line="+10"/>
<source>This label turns red, if the transaction size is bigger than 10000 bytes.
This means a fee of at least %1 per kb is required.
Can vary +/- 1 Byte per input.</source>
<translation>Aquesta etiqueta es tornarà vermell, si la mida de la transacció és més gran que 10000 bytes.
En aquest cas es requereix una comisió d'almenys el 1% per kb.
Pot variar + / - 1 Byte per entrada.</translation>
</message>
<message>
<location line="+1"/>
<source>Transactions with higher priority get more likely into a block.
This label turns red, if the priority is smaller than "medium".
This means a fee of at least %1 per kb is required.</source>
<translation>Les operacions amb més prioritat entren mes facilment a un bloc.
Aquesta etiqueta es torna vermella, si la prioritat és menor que "mitja".
En aquest cas es requereix una comisió d'almenys el 1% per kb.</translation>
</message>
<message>
<location line="+1"/>
<source>This label turns red, if any recipient receives an amount smaller than %1.
This means a fee of at least %2 is required.
Amounts below 0.546 times the minimum relay fee are shown as DUST.</source>
<translation>Aquesta etiqueta es torna vermella, si qualsevol beneficiari rep una quantitat inferior a 1%.
En aquest cas es requereix una comisió d'almenys 2%.
Les quantitats inferiors a 0.546 vegades la quota mínima del relé es mostren com a POLS.</translation>
</message>
<message>
<location line="+1"/>
<source>This label turns red, if the change is smaller than %1.
This means a fee of at least %2 is required.</source>
<translation>Aquesta etiqueta es torna vermella, si el canvi és menor que 1%.
En aquest cas es requereix una comisió d'almenys 2%.</translation>
</message>
<message>
<location line="+37"/>
<location line="+66"/>
<source>(no label)</source>
<translation>(sense etiqueta)</translation>
</message>
<message>
<location line="-9"/>
<source>change from %1 (%2)</source>
<translation>canvi desde %1 (%2)</translation>
</message>
<message>
<location line="+1"/>
<source>(change)</source>
<translation>(canviar)</translation>
</message>
</context>
<context>
<name>EditAddressDialog</name>
<message>
<location filename="../forms/editaddressdialog.ui" line="+14"/>
<source>Edit Address</source>
<translation>Editar Adreça</translation>
</message>
<message>
<location line="+11"/>
<source>&Label</source>
<translation>&Etiqueta</translation>
</message>
<message>
<location line="+10"/>
<source>The label associated with this address book entry</source>
<translation>L'etiqueta associada amb aquesta entrada de la llibreta d'adreces</translation>
</message>
<message>
<location line="+7"/>
<source>&Address</source>
<translation>&Direcció</translation>
</message>
<message>
<location line="+10"/>
<source>The address associated with this address book entry. This can only be modified for sending addresses.</source>
<translation>La direcció associada amb aquesta entrada de la llibreta d'adreces. Només pot ser modificada per a l'enviament d'adreces.</translation>
</message>
<message>
<location filename="../editaddressdialog.cpp" line="+20"/>
<source>New receiving address</source>
<translation>Nova adreça de recepció.</translation>
</message>
<message>
<location line="+4"/>
<source>New sending address</source>
<translation>Nova adreça d'enviament</translation>
</message>
<message>
<location line="+3"/>
<source>Edit receiving address</source>
<translation>Editar adreces de recepció</translation>
</message>
<message>
<location line="+4"/>
<source>Edit sending address</source>
<translation>Editar adreces d'enviament</translation>
</message>
<message>
<location line="+76"/>
<source>The entered address "%1" is already in the address book.</source>
<translation>L'adreça introduïda "%1" ja és present a la llibreta d'adreces.</translation>
</message>
<message>
<location line="-5"/>
<source>The entered address "%1" is not a valid BitSeeds address.</source>
<translation>La direcció introduïda "%1" no és una adreça BitSeeds vàlida.</translation>
</message>
<message>
<location line="+10"/>
<source>Could not unlock wallet.</source>
<translation>No s'ha pogut desbloquejar el moneder.</translation>
</message>
<message>
<location line="+5"/>
<source>New key generation failed.</source>
<translation>Ha fallat la generació d'una nova clau.</translation>
</message>
</context>
<context>
<name>GUIUtil::HelpMessageBox</name>
<message>
<location filename="../guiutil.cpp" line="+420"/>
<location line="+12"/>
<source>BitSeeds-Qt</source>
<translation>BitSeeds-Qt</translation>
</message>
<message>
<location line="-12"/>
<source>version</source>
<translation>versió</translation>
</message>
<message>
<location line="+2"/>
<source>Usage:</source>
<translation>Ús:</translation>
</message>
<message>
<location line="+1"/>
<source>command-line options</source>
<translation>Opcions de la línia d'ordres</translation>
</message>
<message>
<location line="+4"/>
<source>UI options</source>
<translation>Opcions de IU</translation>
</message>
<message>
<location line="+1"/>
<source>Set language, for example "de_DE" (default: system locale)</source>
<translation>Definir llenguatge, per exemple "de_DE" (per defecte: Preferències locals de sistema)</translation>
</message>
<message>
<location line="+1"/>
<source>Start minimized</source>
<translation>Iniciar minimitzat</translation>
</message>
<message>
<location line="+1"/>
<source>Show splash screen on startup (default: 1)</source>
<translation>Mostrar finestra de benvinguda a l'inici (per defecte: 1)</translation>
</message>
</context>
<context>
<name>OptionsDialog</name>
<message>
<location filename="../forms/optionsdialog.ui" line="+14"/>
<source>Options</source>
<translation>Opcions</translation>
</message>
<message>
<location line="+16"/>
<source>&Main</source>
<translation>&Principal</translation>
</message>
<message>
<location line="+6"/>
<source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB. Fee 0.01 recommended.</source>
<translation>Comisió opcional per kB que ajuda a assegurar-se que les seves transaccions es processen ràpidament. La majoria de les transaccions són 1 kB. Comisió d'0.01 recomenada.</translation>
</message>
<message>
<location line="+15"/>
<source>Pay transaction &fee</source>
<translation>Pagar &comisió de transacció</translation>
</message>
<message>
<location line="+31"/>
<source>Reserved amount does not participate in staking and is therefore spendable at any time.</source>
<translation>La quantitat reservada no participa en fer "stake" i per tant esta disponible en qualsevol moment.</translation>
</message>
<message>
<location line="+15"/>
<source>Reserve</source>
<translation>Reserva</translation>
</message>
<message>
<location line="+31"/>
<source>Automatically start BitSeeds after logging in to the system.</source>
<translation>Inicia automàticament BitSeeds després d'entrar en el sistema.</translation>
</message>
<message>
<location line="+3"/>
<source>&Start BitSeeds on system login</source>
<translation>&Iniciar BitSeeds amb l'inici de sessió</translation>
</message>
<message>
<location line="+7"/>
<source>Detach block and address databases at shutdown. This means they can be moved to another data directory, but it slows down shutdown. The wallet is always detached.</source>
<translation>Separeu el bloc i les bases de dades d'adreces en apagar l'equip. En aquest cas es pot moure a un altre directori de dades, però alenteix l'apagada. El moneder està sempre separat.</translation>
</message>
<message>
<location line="+3"/>
<source>&Detach databases at shutdown</source>
<translation>&Separar bases de dades a l'apagar l'equip</translation>
</message>
<message>
<location line="+21"/>
<source>&Network</source>
<translation>&Xarxa</translation>
</message>
<message>
<location line="+6"/>
<source>Automatically open the BitSeeds client port on the router. This only works when your router supports UPnP and it is enabled.</source>
<translation>Obrir automàticament el port de client BitSeeds en el router. Això només funciona quan el router és compatible amb UPnP i està habilitat.</translation>
</message>
<message>
<location line="+3"/>
<source>Map port using &UPnP</source>
<translation>Obrir ports amb &UPnP</translation>
</message>
<message>
<location line="+7"/>
<source>Connect to the BitSeeds network through a SOCKS proxy (e.g. when connecting through Tor).</source>
<translation>Connecteu-vos a la xarxa BitSeeds través d'un proxy SOCKS (per exemple, quan es connecta a través de Tor).</translation>
</message>
<message>
<location line="+3"/>
<source>&Connect through SOCKS proxy:</source>
<translation>&Conectar a través d'un proxy SOCKS:</translation>
</message>
<message>
<location line="+9"/>
<source>Proxy &IP:</source>
<translation>&IP del proxy:</translation>
</message>
<message>
<location line="+19"/>
<source>IP address of the proxy (e.g. 127.0.0.1)</source>
<translation>Adreça IP del servidor proxy (per exemple, 127.0.0.1)</translation>
</message>
<message>
<location line="+7"/>
<source>&Port:</source>
<translation>&Port:</translation>
</message>
<message>
<location line="+19"/>
<source>Port of the proxy (e.g. 9050)</source>
<translation>Port del proxy (per exemple 9050)</translation>
</message>
<message>
<location line="+7"/>
<source>SOCKS &Version:</source>
<translation>&Versió de SOCKS:</translation>
</message>
<message>
<location line="+13"/>
<source>SOCKS version of the proxy (e.g. 5)</source>
<translation>Versió SOCKS del proxy (per exemple 5)</translation>
</message>
<message>
<location line="+36"/>
<source>&Window</source>
<translation>&Finestra</translation>
</message>
<message>
<location line="+6"/>
<source>Show only a tray icon after minimizing the window.</source>
<translation>Mostrar només l'icona de la barra al minimitzar l'aplicació.</translation>
</message>
<message>
<location line="+3"/>
<source>&Minimize to the tray instead of the taskbar</source>
<translation>&Minimitzar a la barra d'aplicacions</translation>
</message>
<message>
<location line="+7"/>
<source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.</source>
<translation>Minimitza en comptes de sortir de la aplicació al tancar la finestra. Quan aquesta opció està activa, la aplicació només es tancarà al seleccionar Sortir al menú.</translation>
</message>
<message>
<location line="+3"/>
<source>M&inimize on close</source>
<translation>M&inimitzar al tancar</translation>
</message>
<message>
<location line="+21"/>
<source>&Display</source>
<translation>&Pantalla</translation>
</message>
<message>
<location line="+8"/>
<source>User Interface &language:</source>
<translation>Llenguatge de la Interfície d'Usuari:</translation>
</message>
<message>
<location line="+13"/>
<source>The user interface language can be set here. This setting will take effect after restarting BitSeeds.</source>
<translation>L'idioma de la interfície d'usuari es pot configurar aquí. Aquesta configuració s'aplicarà després de reiniciar BitSeeds.</translation>
</message>
<message>
<location line="+11"/>
<source>&Unit to show amounts in:</source>
<translation>&Unitats per mostrar les quantitats en:</translation>
</message>
<message>
<location line="+13"/>
<source>Choose the default subdivision unit to show in the interface and when sending coins.</source>
<translation>Sel·lecciona la unitat de subdivisió per defecte per mostrar en la interficie quan s'envien monedes.</translation>
</message>
<message>
<location line="+9"/>
<source>Whether to show BitSeeds addresses in the transaction list or not.</source>
<translation>Per mostrar BitSeeds adreces a la llista de transaccions o no.</translation>
</message>
<message>
<location line="+3"/>
<source>&Display addresses in transaction list</source>
<translation>&Mostrar adreces al llistat de transaccions</translation>
</message>
<message>
<location line="+7"/>
<source>Whether to show coin control features or not.</source>
<translation>Per mostrar les característiques de control de la moneda o no.</translation>
</message>
<message>
<location line="+3"/>
<source>Display coin &control features (experts only!)</source>
<translation>Mostrar controls i característiques de la moneda (només per a experts!)</translation>
</message>
<message>
<location line="+71"/>
<source>&OK</source>
<translation>&OK</translation>
</message>
<message>
<location line="+7"/>
<source>&Cancel</source>
<translation>&Cancel·la</translation>
</message>
<message>
<location line="+10"/>
<source>&Apply</source>
<translation>&Aplicar</translation>
</message>
<message>
<location filename="../optionsdialog.cpp" line="+55"/>
<source>default</source>
<translation>Per defecte</translation>
</message>
<message>
<location line="+149"/>
<location line="+9"/>
<source>Warning</source>
<translation>Avís</translation>
</message>
<message>
<location line="-9"/>
<location line="+9"/>
<source>This setting will take effect after restarting BitSeeds.</source>
<translation>Aquesta configuració s'aplicarà després de reiniciar BitSeeds.</translation>
</message>
<message>
<location line="+29"/>
<source>The supplied proxy address is invalid.</source>
<translation>L'adreça proxy introduïda és invalida.</translation>
</message>
</context>
<context>
<name>OverviewPage</name>
<message>
<location filename="../forms/overviewpage.ui" line="+14"/>
<source>Form</source>
<translation>Formulari</translation>
</message>
<message>
<location line="+33"/>
<location line="+231"/>
<source>The displayed information may be out of date. Your wallet automatically synchronizes with the BitSeeds network after a connection is established, but this process has not completed yet.</source>
<translation>La informació mostrada pot estar fora de data. El seu moneder es sincronitza automàticament amb la xarxa BitSeeds després d'establir una connexió, però aquest procés no s'ha completat encara.</translation>
</message>
<message>
<location line="-160"/>
<source>Stake:</source>
<translation>En "stake":</translation>
</message>
<message>
<location line="+29"/>
<source>Unconfirmed:</source>
<translation>Sense confirmar:</translation>
</message>
<message>
<location line="-107"/>
<source>Wallet</source>
<translation>Moneder</translation>
</message>
<message>
<location line="+49"/>
<source>Spendable:</source>
<translation>Disponible:</translation>
</message>
<message>
<location line="+16"/>
<source>Your current spendable balance</source>
<translation>El balanç de saldo actual disponible</translation>
</message>
<message>
<location line="+71"/>
<source>Immature:</source>
<translation>Immatur:</translation>
</message>
<message>
<location line="+13"/>
<source>Mined balance that has not yet matured</source>
<translation>Balanç minat que encara no ha madurat</translation>
</message>
<message>
<location line="+20"/>
<source>Total:</source>
<translation>Total:</translation>
</message>
<message>
<location line="+16"/>
<source>Your current total balance</source>
<translation>El seu balanç total</translation>
</message>
<message>
<location line="+46"/>
<source><b>Recent transactions</b></source>
<translation><b>Transaccions recents</b></translation>
</message>
<message>
<location line="-108"/>
<source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source>
<translation>Total de transaccions que encara no s'han confirmat, i encara no compten per al balanç actual</translation>
</message>
<message>
<location line="-29"/>
<source>Total of coins that was staked, and do not yet count toward the current balance</source>
<translation>Total de les monedes que s'han posat a fer "stake" (en joc, aposta), i encara no compten per al balanç actual</translation>
</message>
<message>
<location filename="../overviewpage.cpp" line="+113"/>
<location line="+1"/>
<source>out of sync</source>
<translation>Fora de sincronia</translation>
</message>
</context>
<context>
<name>QRCodeDialog</name>
<message>
<location filename="../forms/qrcodedialog.ui" line="+14"/>
<source>QR Code Dialog</source>
<translation>Diàleg de codi QR</translation>
</message>
<message>
<location line="+59"/>
<source>Request Payment</source>
<translation>Sol·licitud de pagament</translation>
</message>
<message>
<location line="+56"/>
<source>Amount:</source>
<translation>Quantitat:</translation>
</message>
<message>
<location line="-44"/>
<source>Label:</source>
<translation>Etiqueta:</translation>
</message>
<message>
<location line="+19"/>
<source>Message:</source>
<translation>Missatge:</translation>
</message>
<message>
<location line="+71"/>
<source>&Save As...</source>
<translation>&Desa com ...</translation>
</message>
<message>
<location filename="../qrcodedialog.cpp" line="+62"/>
<source>Error encoding URI into QR Code.</source>
<translation>Error codificant la URI en un codi QR.</translation>
</message>
<message>
<location line="+40"/>
<source>The entered amount is invalid, please check.</source>
<translation>La quantitat introduïda no és vàlida, comproveu-ho si us plau.</translation>
</message>
<message>
<location line="+23"/>
<source>Resulting URI too long, try to reduce the text for label / message.</source>
<translation>URI resultant massa llarga, intenta reduir el text per a la etiqueta / missatge</translation>
</message>
<message>
<location line="+25"/>
<source>Save QR Code</source>
<translation>Desar codi QR</translation>
</message>
<message>
<location line="+0"/>
<source>PNG Images (*.png)</source>
<translation>Imatges PNG (*.png)</translation>
</message>
</context>
<context>
<name>RPCConsole</name>
<message>
<location filename="../forms/rpcconsole.ui" line="+46"/>
<source>Client name</source>
<translation>Nom del client</translation>
</message>
<message>
<location line="+10"/>
<location line="+23"/>
<location line="+26"/>
<location line="+23"/>
<location line="+23"/>
<location line="+36"/>
<location line="+53"/>
<location line="+23"/>
<location line="+23"/>
<location filename="../rpcconsole.cpp" line="+348"/>
<source>N/A</source>
<translation>N/A</translation>
</message>
<message>
<location line="-217"/>
<source>Client version</source>
<translation>Versió del client</translation>
</message>
<message>
<location line="-45"/>
<source>&Information</source>
<translation>&Informació</translation>
</message>
<message>
<location line="+68"/>
<source>Using OpenSSL version</source>
<translation>Utilitzant OpenSSL versió</translation>
</message>
<message>
<location line="+49"/>
<source>Startup time</source>
<translation>&Temps d'inici</translation>
</message>
<message>
<location line="+29"/>
<source>Network</source>
<translation>Xarxa</translation>
</message>
<message>
<location line="+7"/>
<source>Number of connections</source>
<translation>Nombre de connexions</translation>
</message>
<message>
<location line="+23"/>
<source>On testnet</source>
<translation>A testnet</translation>
</message>
<message>
<location line="+23"/>
<source>Block chain</source>
<translation>Bloquejar cadena</translation>
</message>
<message>
<location line="+7"/>
<source>Current number of blocks</source>
<translation>Nombre de blocs actuals</translation>
</message>
<message>
<location line="+23"/>
<source>Estimated total blocks</source>
<translation>Total estimat de blocs</translation>
</message>
<message>
<location line="+23"/>
<source>Last block time</source>
<translation>Últim temps de bloc</translation>
</message>
<message>
<location line="+52"/>
<source>&Open</source>
<translation>&Obrir</translation>
</message>
<message>
<location line="+16"/>
<source>Command-line options</source>
<translation>Opcions de la línia d'ordres</translation>
</message>
<message>
<location line="+7"/>
<source>Show the BitSeeds-Qt help message to get a list with possible BitSeeds command-line options.</source>
<translation>Mostra el missatge d'ajuda de BitSeeds-Qt per obtenir una llista amb les possibles opcions de línia d'ordres BitSeeds.</translation>
</message>
<message>
<location line="+3"/>
<source>&Show</source>
<translation>&Mostra</translation>
</message>
<message>
<location line="+24"/>
<source>&Console</source>
<translation>&Consola</translation>
</message>
<message>
<location line="-260"/>
<source>Build date</source>
<translation>Data de compilació</translation>
</message>
<message>
<location line="-104"/>
<source>BitSeeds - Debug window</source>
<translation>BitSeeds - Finestra Depuració</translation>
</message>
<message>
<location line="+25"/>
<source>BitSeeds Core</source>
<translation>Nucli BitSeeds</translation>
</message>
<message>
<location line="+279"/>
<source>Debug log file</source>
<translation>Dietàri de depuració</translation>
</message>
<message>
<location line="+7"/>
<source>Open the BitSeeds debug log file from the current data directory. This can take a few seconds for large log files.</source>
<translation>Obriu el fitxer de registre de depuració BitSeeds des del directori de dades actual. Això pot trigar uns segons en els arxius de registre de grans dimensions.</translation>
</message>
<message>
<location line="+102"/>
<source>Clear console</source>
<translation>Netejar consola</translation>
</message>
<message>
<location filename="../rpcconsole.cpp" line="-33"/>
<source>Welcome to the BitSeeds RPC console.</source>
<translation>Benvingut a la consola RPC de BitSeeds.</translation>
</message>
<message>
<location line="+1"/>
<source>Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.</source>
<translation>Utilitza les fletxes d'amunt i avall per navegar per l'històric, i <b>Ctrl-L<\b> per netejar la pantalla.</translation>
</message>
<message>
<location line="+1"/>
<source>Type <b>help</b> for an overview of available commands.</source>
<translation>Escriu <b>help<\b> per a obtenir una llistat de les ordres disponibles.</translation>
</message>
</context>
<context>
<name>SendCoinsDialog</name>
<message>
<location filename="../forms/sendcoinsdialog.ui" line="+14"/>
<location filename="../sendcoinsdialog.cpp" line="+182"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+6"/>
<location line="+5"/>
<location line="+5"/>
<source>Send Coins</source>
<translation>Enviar monedes</translation>
</message>
<message>
<location line="+76"/>
<source>Coin Control Features</source>
<translation>(Opcions del control del Coin)</translation>
</message>
<message>
<location line="+20"/>
<source>Inputs...</source>
<translation>Entrades</translation>
</message>
<message>
<location line="+7"/>
<source>automatically selected</source>
<translation>Seleccionat automàticament</translation>
</message>
<message>
<location line="+19"/>
<source>Insufficient funds!</source>
<translation>Fons insuficient</translation>
</message>
<message>
<location line="+77"/>
<source>Quantity:</source>
<translation>Quantitat:</translation>
</message>
<message>
<location line="+22"/>
<location line="+35"/>
<source>0</source>
<translation>0</translation>
</message>
<message>
<location line="-19"/>
<source>Bytes:</source>
<translation>Bytes:</translation>
</message>
<message>
<location line="+51"/>
<source>Amount:</source>
<translation>Quantitat:</translation>
</message>
<message>
<location line="+22"/>
<location line="+86"/>
<location line="+86"/>
<location line="+32"/>
<source>0.00 BITS</source>
<translation>123.456 BITS {0.00 ?}</translation>
</message>
<message>
<location line="-191"/>
<source>Priority:</source>
<translation>Prioritat:</translation>
</message>
<message>
<location line="+19"/>
<source>medium</source>
<translation>mig</translation>
</message>
<message>
<location line="+32"/>
<source>Fee:</source>
<translation>Quota:</translation>
</message>
<message>
<location line="+35"/>
<source>Low Output:</source>
<translation>Sortida baixa:</translation>
</message>
<message>
<location line="+19"/>
<source>no</source>
<translation>no</translation>
</message>
<message>
<location line="+32"/>
<source>After Fee:</source>
<translation>Quota posterior:</translation>
</message>
<message>
<location line="+35"/>
<source>Change</source>
<translation>Canvi</translation>
</message>
<message>
<location line="+50"/>
<source>custom change address</source>
<translation>Adreça de canvi pròpia</translation>
</message>
<message>
<location line="+106"/>
<source>Send to multiple recipients at once</source>
<translation>Enviar a multiples destinataris al mateix temps</translation>
</message>
<message>
<location line="+3"/>
<source>Add &Recipient</source>
<translation>Afegir &Destinatari</translation>
</message>
<message>
<location line="+20"/>
<source>Remove all transaction fields</source>
<translation>Traieu tots els camps de transacció</translation>
</message>
<message>
<location line="+3"/>
<source>Clear &All</source>
<translation>Esborrar &Tot</translation>
</message>
<message>
<location line="+28"/>
<source>Balance:</source>
<translation>Balanç:</translation>
</message>
<message>
<location line="+16"/>
<source>123.456 BITS</source>
<translation>123.456 BITS</translation>
</message>
<message>
<location line="+31"/>
<source>Confirm the send action</source>
<translation>Confirmi l'acció d'enviament</translation>
</message>
<message>
<location line="+3"/>
<source>S&end</source>
<translation>E&nviar</translation>
</message>
<message>
<location filename="../sendcoinsdialog.cpp" line="-173"/>
<source>Enter a BitSeeds address (e.g. A8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</source>
<translation>Introdueix una adreça BitSeeds (p.ex. A8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</translation>
</message>
<message>
<location line="+15"/>
<source>Copy quantity</source>
<translation>Copiar quantitat</translation>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation>Copiar quantitat</translation>
</message>
<message>
<location line="+1"/>
<source>Copy fee</source>
<translation>Copiar comisió</translation>
</message>
<message>
<location line="+1"/>
<source>Copy after fee</source>
<translation>Copiar després de comisió</translation>
</message>
<message>
<location line="+1"/>
<source>Copy bytes</source>
<translation>Copiar bytes</translation>
</message>
<message>
<location line="+1"/>
<source>Copy priority</source>
<translation>Copiar prioritat</translation>
</message>
<message>
<location line="+1"/>
<source>Copy low output</source>
<translation>Copiar sortida baixa</translation>
</message>
<message>
<location line="+1"/>
<source>Copy change</source>
<translation>Copiar canvi</translation>
</message>
<message>
<location line="+86"/>
<source><b>%1</b> to %2 (%3)</source>
<translation><b>%1</b> a %2 (%3)</translation>
</message>
<message>
<location line="+5"/>
<source>Confirm send coins</source>
<translation>Confirmar l'enviament de monedes</translation>
</message>
<message>
<location line="+1"/>
<source>Are you sure you want to send %1?</source>
<translation>Esteu segur que voleu enviar %1?</translation>
</message>
<message>
<location line="+0"/>
<source> and </source>
<translation>i</translation>
</message>
<message>
<location line="+29"/>
<source>The recipient address is not valid, please recheck.</source>
<translation>L'adreça remetent no és vàlida, si us plau comprovi-la.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount to pay must be larger than 0.</source>
<translation>La quantitat a pagar ha de ser major que 0.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount exceeds your balance.</source>
<translation>Import superi el saldo de la seva compte.</translation>
</message>
<message>
<location line="+5"/>
<source>The total exceeds your balance when the %1 transaction fee is included.</source>
<translation>El total excedeix el teu balanç quan s'afegeix la comisió a la transacció %1.</translation>
</message>
<message>
<location line="+6"/>
<source>Duplicate address found, can only send to each address once per send operation.</source>
<translation>S'ha trobat una adreça duplicada, tan sols es pot enviar a cada adreça un cop per ordre de enviament.</translation>
</message>
<message>
<location line="+5"/>
<source>Error: Transaction creation failed.</source>
<translation>Error: La creació de transacció ha fallat.</translation>
</message>
<message>
<location line="+5"/>
<source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation>Error: La transacció ha sigut rebutjada. Això pot passar si algunes de les monedes al moneder ja s'han gastat, per exemple, si vostè utilitza una còpia del wallet.dat i les monedes han estat gastades a la cópia pero no s'han marcat com a gastades aqui.</translation>
</message>
<message>
<location line="+251"/>
<source>WARNING: Invalid BitSeeds address</source>
<translation>ADVERTÈNCIA: Direcció BitSeeds invàlida</translation>
</message>
<message>
<location line="+13"/>
<source>(no label)</source>
<translation>(sense etiqueta)</translation>
</message>
<message>
<location line="+4"/>
<source>WARNING: unknown change address</source>
<translation>ADVERTÈNCIA: direcció de canvi desconeguda</translation>
</message>
</context>
<context>
<name>SendCoinsEntry</name>
<message>
<location filename="../forms/sendcoinsentry.ui" line="+14"/>
<source>Form</source>
<translation>Formulari</translation>
</message>
<message>
<location line="+15"/>
<source>A&mount:</source>
<translation>Q&uantitat:</translation>
</message>
<message>
<location line="+13"/>
<source>Pay &To:</source>
<translation>Pagar &A:</translation>
</message>
<message>
<location line="+24"/>
<location filename="../sendcoinsentry.cpp" line="+25"/>
<source>Enter a label for this address to add it to your address book</source>
<translation>Introdueixi una etiquera per a aquesta adreça per afegir-la a la llibreta d'adreces</translation>
</message>
<message>
<location line="+9"/>
<source>&Label:</source>
<translation>&Etiqueta:</translation>
</message>
<message>
<location line="+18"/>
<source>The address to send the payment to (e.g. A8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</source>
<translation>L'adreça per a enviar el pagament (per exemple: A8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</translation>
</message>
<message>
<location line="+10"/>
<source>Choose address from address book</source>
<translation>Trieu la direcció de la llibreta d'adreces</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+A</source>
<translation>Alta+A</translation>
</message>
<message>
<location line="+7"/>
<source>Paste address from clipboard</source>
<translation>Enganxar adreça del porta-retalls</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+7"/>
<source>Remove this recipient</source>
<translation>Eliminar aquest destinatari</translation>
</message>
<message>
<location filename="../sendcoinsentry.cpp" line="+1"/>
<source>Enter a BitSeeds address (e.g. A8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</source>
<translation>Introdueix una adreça BitSeeds (p.ex. A8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</translation>
</message>
</context>
<context>
<name>SignVerifyMessageDialog</name>
<message>
<location filename="../forms/signverifymessagedialog.ui" line="+14"/>
<source>Signatures - Sign / Verify a Message</source>
<translation>Signatures .Signar/Verificar un Missatge</translation>
</message>
<message>
<location line="+13"/>
<location line="+124"/>
<source>&Sign Message</source>
<translation>&Signar Missatge</translation>
</message>
<message>
<location line="-118"/>
<source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source>
<translation>Pots signar missatges amb la teva adreça per provar que són teus. Sigues cautelòs al signar qualsevol cosa, ja que els atacs phising poden intentar confondre't per a que els hi signis amb la teva identitat. Tan sols signa als documents completament detallats amb els que hi estàs d'acord.</translation>
</message>
<message>
<location line="+18"/>
<source>The address to sign the message with (e.g. A8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</source>
<translation>L'adreça per a signar el missatge (per exemple A8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</translation>
</message>
<message>
<location line="+10"/>
<location line="+203"/>
<source>Choose an address from the address book</source>
<translation>Trieu una adreça de la llibreta d'adreces</translation>
</message>
<message>
<location line="-193"/>
<location line="+203"/>
<source>Alt+A</source>
<translation>Alta+A</translation>
</message>
<message>
<location line="-193"/>
<source>Paste address from clipboard</source>
<translation>Enganxar adreça del porta-retalls</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+12"/>
<source>Enter the message you want to sign here</source>
<translation>Introdueix aqui el missatge que vols signar</translation>
</message>
<message>
<location line="+24"/>
<source>Copy the current signature to the system clipboard</source>
<translation>Copiar la signatura actual al porta-retalls del sistema</translation>
</message>
<message>
<location line="+21"/>
<source>Sign the message to prove you own this BitSeeds address</source>
<translation>Signar un missatge per demostrar que és propietari d'aquesta adreça BitSeeds</translation>
</message>
<message>
<location line="+17"/>
<source>Reset all sign message fields</source>
<translation>Neteja tots els camps de clau</translation>
</message>
<message>
<location line="+3"/>
<location line="+146"/>
<source>Clear &All</source>
<translation>Esborrar &Tot</translation>
</message>
<message>
<location line="-87"/>
<location line="+70"/>
<source>&Verify Message</source>
<translation>&Verificar el missatge</translation>
</message>
<message>
<location line="-64"/>
<source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source>
<translation>Introdueixi l'adreça signant, missatge (assegura't que copies salts de línia, espais, tabuladors, etc excactament tot el text) i la signatura a sota per verificar el missatge. Per evitar ser enganyat per un atac home-entre-mig, vés amb compte de no llegir més en la signatura del que hi ha al missatge signat mateix.</translation>
</message>
<message>
<location line="+21"/>
<source>The address the message was signed with (e.g. A8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</source>
<translation>La direcció que va ser signada amb un missatge (per exemple A8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</translation>
</message>
<message>
<location line="+40"/>
<source>Verify the message to ensure it was signed with the specified BitSeeds address</source>
<translation>Comproveu el missatge per assegurar-se que es va signar amb l'adreça BitSeeds especificada.</translation>
</message>
<message>
<location line="+17"/>
<source>Reset all verify message fields</source>
<translation>Neteja tots els camps de verificació de missatge</translation>
</message>
<message>
<location filename="../signverifymessagedialog.cpp" line="+27"/>
<location line="+3"/>
<source>Enter a BitSeeds address (e.g. A8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</source>
<translation>Introdueix una adreça BitSeeds (p.ex. A8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)</translation>
</message>
<message>
<location line="-2"/>
<source>Click "Sign Message" to generate signature</source>
<translation>Clica "Signar Missatge" per a generar una signatura</translation>
</message>
<message>
<location line="+3"/>
<source>Enter BitSeeds signature</source>
<translation>Introduïu la signatura BitSeeds</translation>
</message>
<message>
<location line="+82"/>
<location line="+81"/>
<source>The entered address is invalid.</source>
<translation>L'adreça intoduïda és invàlida.</translation>
</message>
<message>
<location line="-81"/>
<location line="+8"/>
<location line="+73"/>
<location line="+8"/>
<source>Please check the address and try again.</source>
<translation>Siu us plau, comprovi l'adreça i provi de nou.</translation>
</message>
<message>
<location line="-81"/>
<location line="+81"/>
<source>The entered address does not refer to a key.</source>
<translation>L'adreça introduïda no referencia a cap clau.</translation>
</message>
<message>
<location line="-73"/>
<source>Wallet unlock was cancelled.</source>
<translation>El desbloqueig del moneder ha estat cancelat.</translation>
</message>
<message>
<location line="+8"/>
<source>Private key for the entered address is not available.</source>
<translation>La clau privada per a la adreça introduïda no està disponible.</translation>
</message>
<message>
<location line="+12"/>
<source>Message signing failed.</source>
<translation>El signat del missatge ha fallat.</translation>
</message>
<message>
<location line="+5"/>
<source>Message signed.</source>
<translation>Missatge signat.</translation>
</message>
<message>
<location line="+59"/>
<source>The signature could not be decoded.</source>
<translation>La signatura no s'ha pogut decodificar .</translation>
</message>
<message>
<location line="+0"/>
<location line="+13"/>
<source>Please check the signature and try again.</source>
<translation>Su us plau, comprovi la signatura i provi de nou.</translation>
</message>
<message>
<location line="+0"/>
<source>The signature did not match the message digest.</source>
<translation>La signatura no coincideix amb el resum del missatge.</translation>
</message>
<message>
<location line="+7"/>
<source>Message verification failed.</source>
<translation>Ha fallat la verificació del missatge.</translation>
</message>
<message>
<location line="+5"/>
<source>Message verified.</source>
<translation>Missatge verificat.</translation>
</message>
</context>
<context>
<name>TransactionDesc</name>
<message>
<location filename="../transactiondesc.cpp" line="+19"/>
<source>Open until %1</source>
<translation>Obert fins %1</translation>
</message>
<message numerus="yes">
<location line="-2"/>
<source>Open for %n block(s)</source>
<translation><numerusform>Obert per a %n bloc</numerusform><numerusform>Obert per a %n blocs</numerusform></translation>
</message>
<message>
<location line="+8"/>
<source>conflicted</source>
<translation>conflicte</translation>
</message>
<message>
<location line="+2"/>
<source>%1/offline</source>
<translation>%1/offline</translation>
</message>
<message>
<location line="+2"/>
<source>%1/unconfirmed</source>
<translation>%1/sense confirmar</translation>
</message>
<message>
<location line="+2"/>
<source>%1 confirmations</source>
<translation>%1 confrimacions</translation>
</message>
<message>
<location line="+18"/>
<source>Status</source>
<translation>Estat</translation>
</message>
<message numerus="yes">
<location line="+7"/>
<source>, broadcast through %n node(s)</source>
<translation><numerusform>, transmès a través de %n node</numerusform><numerusform>, transmès a través de %n nodes</numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>Date</source>
<translation>Data</translation>
</message>
<message>
<location line="+7"/>
<source>Source</source>
<translation>Font</translation>
</message>
<message>
<location line="+0"/>
<source>Generated</source>
<translation>Generat</translation>
</message>
<message>
<location line="+5"/>
<location line="+17"/>
<source>From</source>
<translation>Des de</translation>
</message>
<message>
<location line="+1"/>
<location line="+22"/>
<location line="+58"/>
<source>To</source>
<translation>A</translation>
</message>
<message>
<location line="-77"/>
<location line="+2"/>
<source>own address</source>
<translation>Adreça pròpia</translation>
</message>
<message>
<location line="-2"/>
<source>label</source>
<translation>etiqueta</translation>
</message>
<message>
<location line="+37"/>
<location line="+12"/>
<location line="+45"/>
<location line="+17"/>
<location line="+30"/>
<source>Credit</source>
<translation>Crèdit</translation>
</message>
<message numerus="yes">
<location line="-102"/>
<source>matures in %n more block(s)</source>
<translation><numerusform>madura en %n bloc més</numerusform><numerusform>madura en %n blocs més</numerusform></translation>
</message>
<message>
<location line="+2"/>
<source>not accepted</source>
<translation>no acceptat</translation>
</message>
<message>
<location line="+44"/>
<location line="+8"/>
<location line="+15"/>
<location line="+30"/>
<source>Debit</source>
<translation>Dèbit</translation>
</message>
<message>
<location line="-39"/>
<source>Transaction fee</source>
<translation>Comissió de transacció</translation>
</message>
<message>
<location line="+16"/>
<source>Net amount</source>
<translation>Quantitat neta</translation>
</message>
<message>
<location line="+6"/>
<source>Message</source>
<translation>Missatge</translation>
</message>
<message>
<location line="+2"/>
<source>Comment</source>
<translation>Comentar</translation>
</message>
<message>
<location line="+2"/>
<source>Transaction ID</source>
<translation>ID de transacció</translation>
</message>
<message>
<location line="+3"/>
<source>Generated coins must mature 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to "not accepted" and it won't be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source>
<translation>Les monedes generades han de madurar 510 blocs abans per a poder estar disponibles. En generar aquest bloc, que va ser transmès a la xarxa per ser afegit a la cadena de bloc. Si no aconsegueix entrar a la cadena, el seu estat canviarà a "no acceptat" i no es podrà gastar. Això pot succeir de tant en tant si un altre node genera un bloc a pocs segons del seu.</translation>
</message>
<message>
<location line="+7"/>
<source>Debug information</source>
<translation>Informació de depuració</translation>
</message>
<message>
<location line="+8"/>
<source>Transaction</source>
<translation>Transacció</translation>
</message>
<message>
<location line="+5"/>
<source>Inputs</source>
<translation>Entrades</translation>
</message>
<message>
<location line="+23"/>
<source>Amount</source>
<translation>Quantitat</translation>
</message>
<message>
<location line="+1"/>
<source>true</source>
<translation>cert</translation>
</message>
<message>
<location line="+0"/>
<source>false</source>
<translation>fals</translation>
</message>
<message>
<location line="-211"/>
<source>, has not been successfully broadcast yet</source>
<translation>, encara no ha estat emès correctement</translation>
</message>
<message>
<location line="+35"/>
<source>unknown</source>
<translation>desconegut</translation>
</message>
</context>
<context>
<name>TransactionDescDialog</name>
<message>
<location filename="../forms/transactiondescdialog.ui" line="+14"/>
<source>Transaction details</source>
<translation>Detall de la transacció</translation>
</message>
<message>
<location line="+6"/>
<source>This pane shows a detailed description of the transaction</source>
<translation>Aquest panell mostra una descripció detallada de la transacció</translation>
</message>
</context>
<context>
<name>TransactionTableModel</name>
<message>
<location filename="../transactiontablemodel.cpp" line="+226"/>
<source>Date</source>
<translation>Data</translation>
</message>
<message>
<location line="+0"/>
<source>Type</source>
<translation>Tipus</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Direcció</translation>
</message>
<message>
<location line="+0"/>
<source>Amount</source>
<translation>Quantitat</translation>
</message>
<message>
<location line="+60"/>
<source>Open until %1</source>
<translation>Obert fins %1</translation>
</message>
<message>
<location line="+12"/>
<source>Confirmed (%1 confirmations)</source>
<translation>Confirmat (%1 confirmacions)</translation>
</message>
<message numerus="yes">
<location line="-15"/>
<source>Open for %n more block(s)</source>
<translation><numerusform>Obert per a %n bloc més</numerusform><numerusform>Obert per a %n blocs més</numerusform></translation>
</message>
<message>
<location line="+6"/>
<source>Offline</source>
<translation>Desconnectat</translation>
</message>
<message>
<location line="+3"/>
<source>Unconfirmed</source>
<translation>Sense confirmar</translation>
</message>
<message>
<location line="+3"/>
<source>Confirming (%1 of %2 recommended confirmations)</source>
<translation>Confirmant (%1 de %2 confirmacions recomanat)</translation>
</message>
<message>
<location line="+6"/>
<source>Conflicted</source>
<translation>Conflicte</translation>
</message>
<message>
<location line="+3"/>
<source>Immature (%1 confirmations, will be available after %2)</source>
<translation>Immadurs (%1 confirmacions, estaran disponibles després de %2)</translation>
</message>
<message>
<location line="+3"/>
<source>This block was not received by any other nodes and will probably not be accepted!</source>
<translation>Aquest bloc no ha estat rebut per cap altre node i probablement no serà acceptat!</translation>
</message>
<message>
<location line="+3"/>
<source>Generated but not accepted</source>
<translation>Generat però no acceptat</translation>
</message>
<message>
<location line="+42"/>
<source>Received with</source>
<translation>Rebut desde</translation>
</message>
<message>
<location line="+2"/>
<source>Received from</source>
<translation>Rebut de</translation>
</message>
<message>
<location line="+3"/>
<source>Sent to</source>
<translation>Enviat a</translation>
</message>
<message>
<location line="+2"/>
<source>Payment to yourself</source>
<translation>Pagament a un mateix</translation>
</message>
<message>
<location line="+2"/>
<source>Mined</source>
<translation>Minat</translation>
</message>
<message>
<location line="+38"/>
<source>(n/a)</source>
<translation>(n/a)</translation>
</message>
<message>
<location line="+190"/>
<source>Transaction status. Hover over this field to show number of confirmations.</source>
<translation>Estat de la transacció. Desplaça't per aquí sobre per mostrar el nombre de confirmacions.</translation>
</message>
<message>
<location line="+2"/>
<source>Date and time that the transaction was received.</source>
<translation>Data i hora en que la transacció va ser rebuda.</translation>
</message>
<message>
<location line="+2"/>
<source>Type of transaction.</source>
<translation>Tipus de transacció.</translation>
</message>
<message>
<location line="+2"/>
<source>Destination address of transaction.</source>
<translation>Adreça del destinatari de la transacció.</translation>
</message>
<message>
<location line="+2"/>
<source>Amount removed from or added to balance.</source>
<translation>Quantitat extreta o afegida del balanç.</translation>
</message>
</context>
<context>
<name>TransactionView</name>
<message>
<location filename="../transactionview.cpp" line="+55"/>
<location line="+16"/>
<source>All</source>
<translation>Tot</translation>
</message>
<message>
<location line="-15"/>
<source>Today</source>
<translation>Avui</translation>
</message>
<message>
<location line="+1"/>
<source>This week</source>
<translation>Aquesta setmana</translation>
</message>
<message>
<location line="+1"/>
<source>This month</source>
<translation>Aquest mes</translation>
</message>
<message>
<location line="+1"/>
<source>Last month</source>
<translation>El mes passat</translation>
</message>
<message>
<location line="+1"/>
<source>This year</source>
<translation>Enguany</translation>
</message>
<message>
<location line="+1"/>
<source>Range...</source>
<translation>Rang...</translation>
</message>
<message>
<location line="+11"/>
<source>Received with</source>
<translation>Rebut desde</translation>
</message>
<message>
<location line="+2"/>
<source>Sent to</source>
<translation>Enviat a</translation>
</message>
<message>
<location line="+2"/>
<source>To yourself</source>
<translation>A tu mateix</translation>
</message>
<message>
<location line="+1"/>
<source>Mined</source>
<translation>Minat</translation>
</message>
<message>
<location line="+1"/>
<source>Other</source>
<translation>Altres</translation>
</message>
<message>
<location line="+7"/>
<source>Enter address or label to search</source>
<translation>Introdueix una adreça o una etiqueta per cercar</translation>
</message>
<message>
<location line="+7"/>
<source>Min amount</source>
<translation>Quantitat mínima</translation>
</message>
<message>
<location line="+34"/>
<source>Copy address</source>
<translation>Copiar adreça </translation>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation>Copiar etiqueta</translation>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation>Copiar quantitat</translation>
</message>
<message>
<location line="+1"/>
<source>Copy transaction ID</source>
<translation>Copiar ID de transacció</translation>
</message>
<message>
<location line="+1"/>
<source>Edit label</source>
<translation>Editar etiqueta</translation>
</message>
<message>
<location line="+1"/>
<source>Show transaction details</source>
<translation>Mostra detalls de la transacció</translation>
</message>
<message>
<location line="+144"/>
<source>Export Transaction Data</source>
<translation>Exportació de dades de transaccions</translation>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Arxiu de separació per comes (*.csv)</translation>
</message>
<message>
<location line="+8"/>
<source>Confirmed</source>
<translation>Confirmat</translation>
</message>
<message>
<location line="+1"/>
<source>Date</source>
<translation>Data</translation>
</message>
<message>
<location line="+1"/>
<source>Type</source>
<translation>Tipus</translation>
</message>
<message>
<location line="+1"/>
<source>Label</source>
<translation>Etiqueta</translation>
</message>
<message>
<location line="+1"/>
<source>Address</source>
<translation>Direcció</translation>
</message>
<message>
<location line="+1"/>
<source>Amount</source>
<translation>Quantitat</translation>
</message>
<message>
<location line="+1"/>
<source>ID</source>
<translation>ID</translation>
</message>
<message>
<location line="+4"/>
<source>Error exporting</source>
<translation>Error a l'exportar</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>No s'ha pogut escriure al fitxer %1.</translation>
</message>
<message>
<location line="+100"/>
<source>Range:</source>
<translation>Rang:</translation>
</message>
<message>
<location line="+8"/>
<source>to</source>
<translation>a</translation>
</message>
</context>
<context>
<name>WalletModel</name>
<message>
<location filename="../walletmodel.cpp" line="+206"/>
<source>Sending...</source>
<translation>Enviant...</translation>
</message>
</context>
<context>
<name>bitcoin-core</name>
<message>
<location filename="../bitcoinstrings.cpp" line="+33"/>
<source>BitSeeds version</source>
<translation>versió BitSeeds</translation>
</message>
<message>
<location line="+1"/>
<source>Usage:</source>
<translation>Ús:</translation>
</message>
<message>
<location line="+1"/>
<source>Send command to -server or bitseedsd</source>
<translation>Enviar comandes a -server o bitseedsd</translation>
</message>
<message>
<location line="+1"/>
<source>List commands</source>
<translation>Llista d'ordres</translation>
</message>
<message>
<location line="+1"/>
<source>Get help for a command</source>
<translation>Obtenir ajuda per a un ordre.</translation>
</message>
<message>
<location line="+2"/>
<source>Options:</source>
<translation>Opcions:</translation>
</message>
<message>
<location line="+2"/>
<source>Specify configuration file (default: bitseeds.conf)</source>
<translation>Especifiqueu el fitxer de configuració (per defecte: bitseeds.conf)</translation>
</message>
<message>
<location line="+1"/>
<source>Specify pid file (default: bitseedsd.pid)</source>
<translation>Especificar arxiu pid (per defecte: bitseedsd.pid)</translation>
</message>
<message>
<location line="+2"/>
<source>Specify wallet file (within data directory)</source>
<translation>Especifica un arxiu de moneder (dintre del directori de les dades)</translation>
</message>
<message>
<location line="-1"/>
<source>Specify data directory</source>
<translation>Especificar directori de dades</translation>
</message>
<message>
<location line="+2"/>
<source>Set database cache size in megabytes (default: 25)</source>
<translation>Establir tamany de la memoria cau en megabytes (per defecte: 25)</translation>
</message>
<message>
<location line="+1"/>
<source>Set database disk log size in megabytes (default: 100)</source>
<translation>Configurar la mida del registre en disc de la base de dades en megabytes (per defecte: 100)</translation>
</message>
<message>
<location line="+6"/>
<source>Listen for connections on <port> (default: 15714 or testnet: 25714)</source>
<translation>Escoltar connexions en <port> (per defecte: 15714 o testnet: 25714)</translation>
</message>
<message>
<location line="+1"/>
<source>Maintain at most <n> connections to peers (default: 125)</source>
<translation>Mantenir com a molt <n> connexions a peers (per defecte: 125)</translation>
</message>
<message>
<location line="+3"/>
<source>Connect to a node to retrieve peer addresses, and disconnect</source>
<translation>Connectar al node per obtenir les adreces de les connexions, i desconectar</translation>
</message>
<message>
<location line="+1"/>
<source>Specify your own public address</source>
<translation>Especificar la teva adreça pública</translation>
</message>
<message>
<location line="+5"/>
<source>Bind to given address. Use [host]:port notation for IPv6</source>
<translation>Enllaçar a l'adreça donada. Utilitzeu la notació [host]:port per a IPv6</translation>
</message>
<message>
<location line="+2"/>
<source>Stake your coins to support network and gain reward (default: 1)</source>
<translation>Posa les teves monedes a fer "stake" per donar suport a la xarxa i obtenir una recompensa (per defecte: 1)</translation>
</message>
<message>
<location line="+5"/>
<source>Threshold for disconnecting misbehaving peers (default: 100)</source>
<translation>Límit per a desconectar connexions errònies (per defecte: 100)</translation>
</message>
<message>
<location line="+1"/>
<source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source>
<translation>Nombre de segons abans de reconectar amb connexions errònies (per defecte: 86400)</translation>
</message>
<message>
<location line="-44"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source>
<translation>Ha sorgit un error al configurar el port RPC %u escoltant a IPv4: %s</translation>
</message>
<message>
<location line="+51"/>
<source>Detach block and address databases. Increases shutdown time (default: 0)</source>
<translation>Separeu el bloc i les bases de dades d'adreces. Augmenta el temps d'apagada (per defecte: 0)</translation>
</message>
<message>
<location line="+109"/>
<source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation>Error: La transacció ha sigut rebutjada. Això pot passar si algunes de les monedes al moneder ja s'han gastat, per exemple, si vostè utilitza una còpia del wallet.dat i les monedes han estat gastades a la cópia pero no s'han marcat com a gastades aqui.</translation>
</message>
<message>
<location line="-5"/>
<source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds </source>
<translation>Error: Aquesta transacció requereix una comisió d'almenys %s degut a la seva quantitat, complexitat, o l'ús dels fons rebuts recentment</translation>
</message>
<message>
<location line="-87"/>
<source>Listen for JSON-RPC connections on <port> (default: 15715 or testnet: 25715)</source>
<translation>Escoltar connexions JSON-RPC al port <port> (per defecte: 15715 o testnet: 25715)</translation>
</message>
<message>
<location line="-11"/>
<source>Accept command line and JSON-RPC commands</source>
<translation>Acceptar línia d'ordres i ordres JSON-RPC </translation>
</message>
<message>
<location line="+101"/>
<source>Error: Transaction creation failed </source>
<translation>Error: La creació de transacció ha fallat.</translation>
</message>
<message>
<location line="-5"/>
<source>Error: Wallet locked, unable to create transaction </source>
<translation>Error: Moneder bloquejat, no es pot de crear la transacció</translation>
</message>
<message>
<location line="-8"/>
<source>Importing blockchain data file.</source>
<translation>Important fitxer de dades de la cadena de blocs</translation>
</message>
<message>
<location line="+1"/>
<source>Importing bootstrap blockchain data file.</source>
<translation>Important fitxer de dades d'arrencada de la cadena de blocs</translation>
</message>
<message>
<location line="-88"/>
<source>Run in the background as a daemon and accept commands</source>
<translation>Executar en segon pla com a programa dimoni i acceptar ordres</translation>
</message>
<message>
<location line="+1"/>
<source>Use the test network</source>
<translation>Usar la xarxa de prova</translation>
</message>
<message>
<location line="-24"/>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
<translation>Aceptar connexions d'afora (per defecte: 1 si no -proxy o -connect)</translation>
</message>
<message>
<location line="-38"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source>
<translation>Ha sorgit un error al configurar el port RPC %u escoltant a IPv6, retrocedint a IPv4: %s</translation>
</message>
<message>
<location line="+117"/>
<source>Error initializing database environment %s! To recover, BACKUP THAT DIRECTORY, then remove everything from it except for wallet.dat.</source>
<translation>Error en inicialitzar l'entorn de base de dades %s! Per recuperar, FACI UNA COPIA DE SEGURETAT D'AQUEST DIRECTORI, a continuació, retiri tot d'ella excepte l'arxiu wallet.dat.</translation>
</message>
<message>
<location line="-20"/>
<source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source>
<translation>Establir la grandària màxima de les transaccions alta-prioritat/baixa-comisió en bytes (per defecte: 27000)</translation>
</message>
<message>
<location line="+11"/>
<source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source>
<translation>Advertència: el -paytxfee és molt elevat! Aquesta és la comissió de transacció que pagaràs quan enviis una transacció.</translation>
</message>
<message>
<location line="+61"/>
<source>Warning: Please check that your computer's date and time are correct! If your clock is wrong BitSeeds will not work properly.</source>
<translation>Avís: Comproveu que la data i hora de l'equip siguin correctes! Si el seu rellotge és erroni BitSeeds no funcionarà correctament.</translation>
</message>
<message>
<location line="-31"/>
<source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source>
<translation>Advertència: Error llegint l'arxiu wallet.dat!! Totes les claus es llegeixen correctament, però hi ha dades de transaccions o entrades del llibre d'adreces absents o bé son incorrectes.</translation>
</message>
<message>
<location line="-18"/>
<source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source>
<translation>Advertència: L'arxiu wallet.dat és corrupte, dades rescatades! L'arxiu wallet.dat original ha estat desat com wallet.{estampa_temporal}.bak al directori %s; si el teu balanç o transaccions son incorrectes hauries de restaurar-lo de un backup.</translation>
</message>
<message>
<location line="-30"/>
<source>Attempt to recover private keys from a corrupt wallet.dat</source>
<translation>Intentar recuperar les claus privades d'un arxiu wallet.dat corrupte</translation>
</message>
<message>
<location line="+4"/>
<source>Block creation options:</source>
<translation>Opcions de la creació de blocs:</translation>
</message>
<message>
<location line="-62"/>
<source>Connect only to the specified node(s)</source>
<translation>Connectar només al(s) node(s) especificats</translation>
</message>
<message>
<location line="+4"/>
<source>Discover own IP address (default: 1 when listening and no -externalip)</source>
<translation>Descobrir la pròpia adreça IP (per defecte: 1 quan escoltant i no -externalip)</translation>
</message>
<message>
<location line="+94"/>
<source>Failed to listen on any port. Use -listen=0 if you want this.</source>
<translation>Error al escoltar a qualsevol port. Utilitza -listen=0 si vols això.</translation>
</message>
<message>
<location line="-90"/>
<source>Find peers using DNS lookup (default: 1)</source>
<translation>Trobar companys utilitzant la recerca de DNS (per defecte: 1)</translation>
</message>
<message>
<location line="+5"/>
<source>Sync checkpoints policy (default: strict)</source>
<translation>Política dels punts de control de sincronització (per defecte: estricta)</translation>
</message>
<message>
<location line="+83"/>
<source>Invalid -tor address: '%s'</source>
<translation>Adreça -tor invalida: '%s'</translation>
</message>
<message>
<location line="+4"/>
<source>Invalid amount for -reservebalance=<amount></source>
<translation>Quantitat invalida per a -reservebalance=<amount></translation>
</message>
<message>
<location line="-82"/>
<source>Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)</source>
<translation>Mida màxima del buffer de recepció per a cada connexió, <n>*1000 bytes (default: 5000)</translation>
</message>
<message>
<location line="+1"/>
<source>Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)</source>
<translation>Mida màxima del buffer d'enviament per a cada connexió, <n>*1000 bytes (default: 5000)</translation>
</message>
<message>
<location line="-16"/>
<source>Only connect to nodes in network <net> (IPv4, IPv6 or Tor)</source>
<translation>Només connectar als nodes de la xarxa <net> (IPv4, IPv6 o Tor)</translation>
</message>
<message>
<location line="+28"/>
<source>Output extra debugging information. Implies all other -debug* options</source>
<translation>Sortida d'informació de depuració extra. Implica totes les opcions de depuracó -debug*</translation>
</message>
<message>
<location line="+1"/>
<source>Output extra network debugging information</source>
<translation>Sortida d'informació de depuració de xarxa addicional</translation>
</message>
<message>
<location line="+1"/>
<source>Prepend debug output with timestamp</source>
<translation>Anteposar marca de temps a la sortida de depuració</translation>
</message>
<message>
<location line="+35"/>
<source>SSL options: (see the Bitcoin Wiki for SSL setup instructions)</source>
<translation>Opcions SSL: (veure la Wiki de Bitcoin per a instruccions de configuració SSL)</translation>
</message>
<message>
<location line="-74"/>
<source>Select the version of socks proxy to use (4-5, default: 5)</source>
<translation>Seleccioneu la versió de proxy socks per utilitzar (4-5, per defecte: 5)</translation>
</message>
<message>
<location line="+41"/>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation>Enviar informació de traça/depuració a la consola en comptes del arxiu debug.log</translation>
</message>
<message>
<location line="+1"/>
<source>Send trace/debug info to debugger</source>
<translation>Enviar informació de traça/depuració al depurador</translation>
</message>
<message>
<location line="+28"/>
<source>Set maximum block size in bytes (default: 250000)</source>
<translation>Establir una mida máxima de bloc en bytes (per defecte: 250000)</translation>
</message>
<message>
<location line="-1"/>
<source>Set minimum block size in bytes (default: 0)</source>
<translation>Establir una mida mínima de bloc en bytes (per defecte: 0)</translation>
</message>
<message>
<location line="-29"/>
<source>Shrink debug.log file on client startup (default: 1 when no -debug)</source>
<translation>Reduir l'arxiu debug.log al iniciar el client (per defecte 1 quan no -debug)</translation>
</message>
<message>
<location line="-42"/>
<source>Specify connection timeout in milliseconds (default: 5000)</source>
<translation>Especificar el temps limit per a un intent de connexió en milisegons (per defecte: 5000)</translation>
</message>
<message>
<location line="+109"/>
<source>Unable to sign checkpoint, wrong checkpointkey?
</source>
<translation>No es pot signar el punt de control, la clau del punt de control esta malament?
</translation>
</message>
<message>
<location line="-80"/>
<source>Use UPnP to map the listening port (default: 0)</source>
<translation>Utilitza UPnP per a mapejar els ports d'escolta (per defecte: 0)</translation>
</message>
<message>
<location line="-1"/>
<source>Use UPnP to map the listening port (default: 1 when listening)</source>
<translation>Utilitza UPnP per a mapejar els ports d'escolta (per defecte: 1 quan s'escolta)</translation>
</message>
<message>
<location line="-25"/>
<source>Use proxy to reach tor hidden services (default: same as -proxy)</source>
<translation>Utilitza proxy per arribar als serveis ocults de Tor (per defecte: la mateixa que -proxy)</translation>
</message>
<message>
<location line="+42"/>
<source>Username for JSON-RPC connections</source>
<translation>Nom d'usuari per a connexions JSON-RPC</translation>
</message>
<message>
<location line="+47"/>
<source>Verifying database integrity...</source>
<translation>Comprovant la integritat de la base de dades ...</translation>
</message>
<message>
<location line="+57"/>
<source>WARNING: syncronized checkpoint violation detected, but skipped!</source>
<translation>ADVERTÈNCIA: violació de punt de control sincronitzat detectada, es saltarà!</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: Disk space is low!</source>
<translation>Avís: L'espai en disc és baix!</translation>
</message>
<message>
<location line="-2"/>
<source>Warning: This version is obsolete, upgrade required!</source>
<translation>Advertència: Aquetsa versió està obsoleta, és necessari actualitzar!</translation>
</message>
<message>
<location line="-48"/>
<source>wallet.dat corrupt, salvage failed</source>
<translation>L'arxiu wallet.data és corrupte, el rescat de les dades ha fallat</translation>
</message>
<message>
<location line="-54"/>
<source>Password for JSON-RPC connections</source>
<translation>Contrasenya per a connexions JSON-RPC</translation>
</message>
<message>
<location line="-84"/>
<source>%s, you must set a rpcpassword in the configuration file:
%s
It is recommended you use the following random password:
rpcuser=bitseedsrpc
rpcpassword=%s
(you do not need to remember this password)
The username and password MUST NOT be the same.
If the file does not exist, create it with owner-readable-only file permissions.
It is also recommended to set alertnotify so you are notified of problems;
for example: alertnotify=echo %%s | mail -s "BitSeeds Alert" admin@foo.com
</source>
<translation>%s, ha d'establir un rpcpassword al fitxer de configuració:
%s
Es recomana utilitzar la següent contrasenya aleatòria:
rpcuser=bitseedsrpc
rpcpassword=%s
(No cal recordar aquesta contrasenya)
El nom d'usuari i contrasenya NO HA DE SER el mateix.
Si no hi ha l'arxiu, s'ha de crear amb els permisos de només lectura per al propietari.
També es recomana establir alertnotify per a que se li notifiquin els problemes;
per exemple: alertnotify=echo %%s | mail -s "BitSeeds Alert" admin@foo.com
</translation>
</message>
<message>
<location line="+51"/>
<source>Find peers using internet relay chat (default: 0)</source>
<translation>Trobar companys utilitzant l'IRC (per defecte: 1) {0)?}</translation>
</message>
<message>
<location line="+5"/>
<source>Sync time with other nodes. Disable if time on your system is precise e.g. syncing with NTP (default: 1)</source>
<translation>Sincronitzar el temps amb altres nodes. Desactivar si el temps al seu sistema és precís, per exemple, si fa ús de sincronització amb NTP (per defecte: 1)</translation>
</message>
<message>
<location line="+15"/>
<source>When creating transactions, ignore inputs with value less than this (default: 0.01)</source>
<translation>En crear transaccions, ignorar les entrades amb valor inferior a aquesta (per defecte: 0.01)</translation>
</message>
<message>
<location line="+16"/>
<source>Allow JSON-RPC connections from specified IP address</source>
<translation>Permetre connexions JSON-RPC d'adreces IP específiques</translation>
</message>
<message>
<location line="+1"/>
<source>Send commands to node running on <ip> (default: 127.0.0.1)</source>
<translation>Enviar ordre al node en execució a <ip> (per defecte: 127.0.0.1)</translation>
</message>
<message>
<location line="+1"/>
<source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source>
<translation>Executar orde quan el millor bloc canviï (%s al cmd es reemplaça per un bloc de hash)</translation>
</message>
<message>
<location line="+3"/>
<source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source>
<translation>Executar una ordre quan una transacció del moneder canviï (%s in cmd es canvia per TxID)</translation>
</message>
<message>
<location line="+3"/>
<source>Require a confirmations for change (default: 0)</source>
<translation>Requerir les confirmacions de canvi (per defecte: 0)</translation>
</message>
<message>
<location line="+1"/>
<source>Enforce transaction scripts to use canonical PUSH operators (default: 1)</source>
<translation>Fer complir als scripts de transaccions d'utilitzar operadors PUSH canòniques (per defecte: 1)</translation>
</message>
<message>
<location line="+2"/>
<source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source>
<translation>
Executar una ordre quan es rep un avís rellevant (%s en cmd es substitueix per missatge)</translation>
</message>
<message>
<location line="+3"/>
<source>Upgrade wallet to latest format</source>
<translation>Actualitzar moneder a l'últim format</translation>
</message>
<message>
<location line="+1"/>
<source>Set key pool size to <n> (default: 100)</source>
<translation>Establir límit de nombre de claus a <n> (per defecte: 100)</translation>
</message>
<message>
<location line="+1"/>
<source>Rescan the block chain for missing wallet transactions</source>
<translation>Re-escanejar cadena de blocs en cerca de transaccions de moneder perdudes</translation>
</message>
<message>
<location line="+2"/>
<source>How many blocks to check at startup (default: 2500, 0 = all)</source>
<translation>Quants blocs s'han de confirmar a l'inici (per defecte: 2500, 0 = tots)</translation>
</message>
<message>
<location line="+1"/>
<source>How thorough the block verification is (0-6, default: 1)</source>
<translation>Com és de minuciosa la verificació del bloc (0-6, per defecte: 1)</translation>
</message>
<message>
<location line="+1"/>
<source>Imports blocks from external blk000?.dat file</source>
<translation>Importar blocs desde l'arxiu extern blk000?.dat</translation>
</message>
<message>
<location line="+8"/>
<source>Use OpenSSL (https) for JSON-RPC connections</source>
<translation>Utilitzar OpenSSL (https) per a connexions JSON-RPC</translation>
</message>
<message>
<location line="+1"/>
<source>Server certificate file (default: server.cert)</source>
<translation>Arxiu del certificat de servidor (per defecte: server.cert)</translation>
</message>
<message>
<location line="+1"/>
<source>Server private key (default: server.pem)</source>
<translation>Clau privada del servidor (per defecte: server.pem)</translation>
</message>
<message>
<location line="+1"/>
<source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source>
<translation>Xifres acceptables (per defecte: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</translation>
</message>
<message>
<location line="+53"/>
<source>Error: Wallet unlocked for staking only, unable to create transaction.</source>
<translation>Error: Cartera bloquejada nomès per a fer "stake", no es pot de crear la transacció</translation>
</message>
<message>
<location line="+18"/>
<source>WARNING: Invalid checkpoint found! Displayed transactions may not be correct! You may need to upgrade, or notify developers.</source>
<translation>ADVERTÈNCIA: Punt de control invàlid! Les transaccions mostrades podríen no ser correctes! Podria ser necessari actualitzar o notificar-ho als desenvolupadors.</translation>
</message>
<message>
<location line="-158"/>
<source>This help message</source>
<translation>Aquest misatge d'ajuda</translation>
</message>
<message>
<location line="+95"/>
<source>Wallet %s resides outside data directory %s.</source>
<translation>El moneder %s resideix fora del directori de dades %s.</translation>
</message>
<message>
<location line="+1"/>
<source>Cannot obtain a lock on data directory %s. BitSeeds is probably already running.</source>
<translation>No es pot obtenir un bloqueig en el directori de dades %s. BitSeeds probablement ja estigui en funcionament.</translation>
</message>
<message>
<location line="-98"/>
<source>BitSeeds</source>
<translation>BitSeeds</translation>
</message>
<message>
<location line="+140"/>
<source>Unable to bind to %s on this computer (bind returned error %d, %s)</source>
<translation>Impossible d'unir %s a aquest ordinador (s'ha retornat l'error %d, %s)</translation>
</message>
<message>
<location line="-130"/>
<source>Connect through socks proxy</source>
<translation>Conectar a través d'un proxy SOCKS</translation>
</message>
<message>
<location line="+3"/>
<source>Allow DNS lookups for -addnode, -seednode and -connect</source>
<translation>Permetre consultes DNS per a -addnode, -seednode i -connect</translation>
</message>
<message>
<location line="+122"/>
<source>Loading addresses...</source>
<translation>Carregant adreces...</translation>
</message>
<message>
<location line="-15"/>
<source>Error loading blkindex.dat</source>
<translation>Error carregant blkindex.dat</translation>
</message>
<message>
<location line="+2"/>
<source>Error loading wallet.dat: Wallet corrupted</source>
<translation>Error carregant wallet.dat: Moneder corrupte</translation>
</message>
<message>
<location line="+4"/>
<source>Error loading wallet.dat: Wallet requires newer version of BitSeeds</source>
<translation>Error en carregar wallet.dat: El moneder requereix la versió més recent de BitSeeds</translation>
</message>
<message>
<location line="+1"/>
<source>Wallet needed to be rewritten: restart BitSeeds to complete</source>
<translation>El moneder necessita ser reescrita: reiniciar BitSeeds per completar</translation>
</message>
<message>
<location line="+1"/>
<source>Error loading wallet.dat</source>
<translation>Error carregant wallet.dat</translation>
</message>
<message>
<location line="-16"/>
<source>Invalid -proxy address: '%s'</source>
<translation>Adreça -proxy invalida: '%s'</translation>
</message>
<message>
<location line="-1"/>
<source>Unknown network specified in -onlynet: '%s'</source>
<translation>Xarxa desconeguda especificada a -onlynet: '%s'</translation>
</message>
<message>
<location line="-1"/>
<source>Unknown -socks proxy version requested: %i</source>
<translation>S'ha demanat una versió desconeguda de -socks proxy: %i</translation>
</message>
<message>
<location line="+4"/>
<source>Cannot resolve -bind address: '%s'</source>
<translation>No es pot resoldre l'adreça -bind: '%s'</translation>
</message>
<message>
<location line="+2"/>
<source>Cannot resolve -externalip address: '%s'</source>
<translation>No es pot resoldre l'adreça -externalip: '%s'</translation>
</message>
<message>
<location line="-24"/>
<source>Invalid amount for -paytxfee=<amount>: '%s'</source>
<translation>Quantitat invalida per a -paytxfee=<amount>: '%s'</translation>
</message>
<message>
<location line="+44"/>
<source>Error: could not start node</source>
<translation>Error: no s'ha pogut iniciar el node</translation>
</message>
<message>
<location line="+11"/>
<source>Sending...</source>
<translation>Enviant...</translation>
</message>
<message>
<location line="+5"/>
<source>Invalid amount</source>
<translation>Quanitat invalida</translation>
</message>
<message>
<location line="+1"/>
<source>Insufficient funds</source>
<translation>Balanç insuficient</translation>
</message>
<message>
<location line="-34"/>
<source>Loading block index...</source>
<translation>Carregant índex de blocs...</translation>
</message>
<message>
<location line="-103"/>
<source>Add a node to connect to and attempt to keep the connection open</source>
<translation>Afegir un node per a connectar's-hi i intentar mantenir la connexió oberta</translation>
</message>
<message>
<location line="+122"/>
<source>Unable to bind to %s on this computer. BitSeeds is probably already running.</source>
<translation>No es pot enllaçar a %s en aquest equip. BitSeeds probablement ja estigui en funcionament.</translation>
</message>
<message>
<location line="-97"/>
<source>Fee per KB to add to transactions you send</source>
<translation>Comisió per KB per a afegir a les transaccions que enviï</translation>
</message>
<message>
<location line="+55"/>
<source>Invalid amount for -mininput=<amount>: '%s'</source>
<translation>Quantitat invalida per a -mininput=<amount>: '%s'</translation>
</message>
<message>
<location line="+25"/>
<source>Loading wallet...</source>
<translation>Carregant moneder...</translation>
</message>
<message>
<location line="+8"/>
<source>Cannot downgrade wallet</source>
<translation>No es pot reduir la versió del moneder</translation>
</message>
<message>
<location line="+1"/>
<source>Cannot initialize keypool</source>
<translation>No es pot inicialitzar el keypool</translation>
</message>
<message>
<location line="+1"/>
<source>Cannot write default address</source>
<translation>No es pot escriure l'adreça per defecte</translation>
</message>
<message>
<location line="+1"/>
<source>Rescanning...</source>
<translation>Re-escanejant...</translation>
</message>
<message>
<location line="+5"/>
<source>Done loading</source>
<translation>Càrrega acabada</translation>
</message>
<message>
<location line="-167"/>
<source>To use the %s option</source>
<translation>Utilitza la opció %s</translation>
</message>
<message>
<location line="+14"/>
<source>Error</source>
<translation>Error</translation>
</message>
<message>
<location line="+6"/>
<source>You must set rpcpassword=<password> in the configuration file:
%s
If the file does not exist, create it with owner-readable-only file permissions.</source>
<translation>Has de configurar el rpcpassword=<password> a l'arxiu de configuració:\n %s\n Si l'arxiu no existeix, crea'l amb els permís owner-readable-only.</translation>
</message>
</context>
</TS> | BitSeedsFoundation/BitSeeds | src/qt/locale/bitcoin_ca_ES.ts | TypeScript | mit | 132,255 |
'use strict';
module.exports = ({ app, controllers, authentication }) => {
const controller = controllers.auth;
const authRoute = '/api/auth';
app.post(authRoute + '/register', controller.register);
app.post(authRoute + '/login', controller.loginLocal);
app.get(authRoute + '/logout', controller.logout);
// app.get(authRoute + '//getLoggedUser', authController.getLoggedUser);
} | Team3OfAKind/course-project-back-end | server/routers/auth-router.js | JavaScript | mit | 405 |
<?php
namespace DF\PHPCoverFish\Common;
/**
* Class CoverFishPHPUnitTest, wrapper for all phpUnit testClass files
*
* @package DF\PHPCoverFish
* @author Patrick Paechnatz <patrick.paechnatz@gmail.com>
* @copyright 2015 Patrick Paechnatz <patrick.paechnatz@gmail.com>
* @license http://www.opensource.org/licenses/MIT
* @link http://github.com/dunkelfrosch/phpcoverfish/tree
* @since class available since Release 0.9.0
* @version 1.0.0
*
* @codeCoverageIgnore
*/
class CoverFishPHPUnitTest
{
/**
* @var bool
*/
private $fromClass = false;
/**
* @var bool
*/
private $fromMethod = false;
/**
* @var string
*/
private $docBlock;
/**
* @var string
*/
private $name;
/**
* @var string
*/
private $visibility;
/**
* @var string
*/
private $signature;
/**
* @var int
*/
private $line;
/**
* @var int
*/
private $loc;
/**
* @var string
*/
private $file;
/**
* @var string
*/
private $fileAndPath;
/**
* @var ArrayCollection
*/
private $coverAnnotations;
/**
* @var ArrayCollection
*/
private $coverMappings;
/**
* @return string
*/
public function getDocBlock()
{
return $this->docBlock;
}
/**
* @param string $docBlock
*/
public function setDocBlock($docBlock)
{
$this->docBlock = $docBlock;
}
/**
* @deprecated in version 0.9.3, signature will be used instead
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @deprecated in version 0.9.3, signature will be used instead
*
* @param string $name
*/
public function setName($name)
{
$this->name = $name;
}
/**
* @return string
*/
public function getVisibility()
{
return $this->visibility;
}
/**
* @param string $visibility
*/
public function setVisibility($visibility)
{
$this->visibility = $visibility;
}
/**
* @return string
*/
public function getSignature()
{
return $this->signature;
}
/**
* @param string $signature
*/
public function setSignature($signature)
{
$this->signature = $signature;
}
/**
* @return int
*/
public function getLine()
{
return $this->line;
}
/**
* @param int $line
*/
public function setLine($line)
{
$this->line = $line;
}
/**
* @return int
*/
public function getLoc()
{
return $this->loc;
}
/**
* @param int $loc
*/
public function setLoc($loc)
{
$this->loc = $loc;
}
/**
* @return ArrayCollection
*/
public function getCoverMappings()
{
return $this->coverMappings;
}
/**
* @param CoverFishMapping $coverMapping
*/
public function addCoverMapping(CoverFishMapping $coverMapping)
{
$this->coverMappings->add($coverMapping);
}
/**
* @param CoverFishMapping $coverMapping
*/
public function removeCoverMapping(CoverFishMapping $coverMapping)
{
$this->coverMappings->removeElement($coverMapping);
}
/*
* clear all defined coverMappings
*/
public function clearCoverMappings()
{
$this->coverMappings->clear();
}
/**
* @return ArrayCollection
*/
public function getCoverAnnotations()
{
return $this->coverAnnotations;
}
/**
* @param string $annotation
*/
public function addCoverAnnotation($annotation)
{
$this->coverAnnotations->add($annotation);
}
/**
* @param string $annotation
*/
public function removeCoverAnnotation($annotation)
{
$this->coverAnnotations->removeElement($annotation);
}
/*
* clear all defined annotations
*/
public function clearCoverAnnotation()
{
$this->coverAnnotations->clear();
}
/**
* @return string
*/
public function getFile()
{
return $this->file;
}
/**
* @param string $file
*/
public function setFile($file)
{
$this->file = $file;
}
/**
* @return string
*/
public function getFileAndPath()
{
return $this->fileAndPath;
}
/**
* @param string $fileAndPath
*/
public function setFileAndPath($fileAndPath)
{
$this->fileAndPath = $fileAndPath;
}
/**
* @return boolean
*/
public function isFromClass()
{
return $this->fromClass;
}
/**
* @param boolean $fromClass
*/
public function setFromClass($fromClass)
{
$this->fromClass = $fromClass;
}
/**
* @return boolean
*/
public function isFromMethod()
{
return $this->fromMethod;
}
/**
* @param boolean $fromMethod
*/
public function setFromMethod($fromMethod)
{
$this->fromMethod = $fromMethod;
}
/**
* class constructor
*/
public function __construct()
{
$this->coverMappings = new ArrayCollection();
$this->coverAnnotations = new ArrayCollection();
}
} | dunkelfrosch/phpcoverfish | src/PHPCoverFish/Common/CoverFishPHPUnitTest.php | PHP | mit | 5,429 |
var m2pong = require('./m2pong');
Player = function(connection, name, nr){
this.connection = connection;
this.name = name;
this.nr = nr;
this.x = 0;
this.y = 0;
this.height = 0;
this.width = 0;
this.score = 0;
this.move = function(x, y){
this.x = x;
this.y = y;
m2pong.sendToDisplays('movePlayer', {
nr: this.nr,
x: this.x,
y: this.y
});
};
this.setScore = function(score){
this.score = score;
m2pong.sendToDisplays('setScore', {
nr: this.nr,
score: score
});
};
};
exports.Player = Player;
| sabl0r/m2pong | server/player.js | JavaScript | mit | 547 |
var _ = require("underscore");
var os = require("os");
var path = require("path");
var assert = require("assert");
// All of these functions are attached to files.js for the tool;
// they live here because we need them in boot.js as well to avoid duplicating
// a lot of the code.
//
// Note that this file does NOT contain any of the "perform I/O maybe
// synchronously" functions from files.js; this is intentional, because we want
// to make it very hard to accidentally use fs.*Sync functions in the app server
// after bootup (since they block all concurrency!)
var files = module.exports;
var toPosixPath = function (p, partialPath) {
// Sometimes, you can have a path like \Users\IEUser on windows, and this
// actually means you want C:\Users\IEUser
if (p[0] === "\\" && (! partialPath)) {
p = process.env.SystemDrive + p;
}
p = p.replace(/\\/g, '/');
if (p[1] === ':' && ! partialPath) {
// transform "C:/bla/bla" to "/c/bla/bla"
p = '/' + p[0] + p.slice(2);
}
return p;
};
var toDosPath = function (p, partialPath) {
if (p[0] === '/' && ! partialPath) {
if (! /^\/[A-Za-z](\/|$)/.test(p))
throw new Error("Surprising path: " + p);
// transform a previously windows path back
// "/C/something" to "c:/something"
p = p[1] + ":" + p.slice(2);
}
p = p.replace(/\//g, '\\');
return p;
};
var convertToOSPath = function (standardPath, partialPath) {
if (process.platform === "win32") {
return toDosPath(standardPath, partialPath);
}
return standardPath;
};
var convertToStandardPath = function (osPath, partialPath) {
if (process.platform === "win32") {
return toPosixPath(osPath, partialPath);
}
return osPath;
}
var convertToOSLineEndings = function (fileContents) {
return fileContents.replace(/\n/g, os.EOL);
};
var convertToStandardLineEndings = function (fileContents) {
// Convert all kinds of end-of-line chars to linuxy "\n".
return fileContents.replace(new RegExp("\r\n", "g"), "\n")
.replace(new RegExp("\r", "g"), "\n");
};
// Return the Unicode Normalization Form of the passed in path string, using
// "Normalization Form Canonical Composition"
const unicodeNormalizePath = (path) => {
return (path) ? path.normalize('NFC') : path;
};
// wrappings for path functions that always run as they were on unix (using
// forward slashes)
var wrapPathFunction = function (name, partialPaths) {
var f = path[name];
assert.strictEqual(typeof f, "function");
return function (/* args */) {
if (process.platform === 'win32') {
var args = _.toArray(arguments);
args = _.map(args, function (p, i) {
// if partialPaths is turned on (for path.join mostly)
// forget about conversion of absolute paths for Windows
return toDosPath(p, partialPaths);
});
var result = f.apply(path, args);
if (typeof result === "string") {
result = toPosixPath(result, partialPaths);
}
return result;
}
return f.apply(path, arguments);
};
};
files.pathJoin = wrapPathFunction("join", true);
files.pathNormalize = wrapPathFunction("normalize");
files.pathRelative = wrapPathFunction("relative");
files.pathResolve = wrapPathFunction("resolve");
files.pathDirname = wrapPathFunction("dirname");
files.pathBasename = wrapPathFunction("basename");
files.pathExtname = wrapPathFunction("extname");
// The path.isAbsolute function is implemented in Node v4.
files.pathIsAbsolute = wrapPathFunction("isAbsolute");
files.pathSep = '/';
files.pathDelimiter = ':';
files.pathOsDelimiter = path.delimiter;
files.convertToStandardPath = convertToStandardPath;
files.convertToOSPath = convertToOSPath;
files.convertToWindowsPath = toDosPath;
files.convertToPosixPath = toPosixPath;
files.convertToStandardLineEndings = convertToStandardLineEndings;
files.convertToOSLineEndings = convertToOSLineEndings;
files.unicodeNormalizePath = unicodeNormalizePath;
| mjmasn/meteor | tools/static-assets/server/mini-files.js | JavaScript | mit | 3,947 |
<?php
$hostname_conn = "localhost";
$database_conn = "tcc_interface";
$username_conn = "root";
$password_conn = "senha.123";
$conn = mysql_pconnect($hostname_conn, $username_conn, $password_conn) or trigger_error(mysql_error(),E_USER_ERROR);
?>
| giovaniandrerizzardi/tccgiovani | script/conn.php | PHP | mit | 246 |
<?php
/**
* Enable an Item
*/
class fleetManagerOfficeItemEnableProcessor extends modObjectProcessor {
public $objectType = 'fleetManagerItem';
public $classKey = 'fleetManagerItem';
public $languageTopics = array('fleetmanager');
//public $permission = 'save';
/**
* @return array|string
*/
public function process() {
if (!$this->checkPermissions()) {
return $this->failure($this->modx->lexicon('access_denied'));
}
$ids = $this->modx->fromJSON($this->getProperty('ids'));
if (empty($ids)) {
return $this->failure($this->modx->lexicon('fleetmanager_item_err_ns'));
}
foreach ($ids as $id) {
/** @var fleetManagerItem $object */
if (!$object = $this->modx->getObject($this->classKey, $id)) {
return $this->failure($this->modx->lexicon('fleetmanager_item_err_nf'));
}
$object->set('active', true);
$object->save();
}
return $this->success();
}
}
return 'fleetManagerOfficeItemEnableProcessor';
| ananimals/fleetmanager | core/components/fleetmanager/processors/office/item/enable.class.php | PHP | mit | 957 |
<?php
/*******************************************************************************
*
* filename : PersonView.php
* last change : 2003-04-14
* description : Displays all the information about a single person
*
* http://www.infocentral.org/
* Copyright 2001-2003 Phillip Hullquist, Deane Barker, Chris Gebhardt
*
* InfoCentral 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.
*
******************************************************************************/
// Include the function library
require "Include/Config.php";
require "Include/Functions.php";
require 'Include/PersonFunctions.php';
require 'Include/MailchimpFunctions.php';
$mailchimp = new ChurchInfoMailchimp();
// Get the person ID from the querystring
$iPersonID = FilterInput($_GET["PersonID"],'int');
$iRemoveVO = 0;
if (array_key_exists ("RemoveVO", $_GET))
$iRemoveVO = FilterInput($_GET["RemoveVO"],'int');
if ( isset($_POST["GroupAssign"]) && $_SESSION['bManageGroups'] )
{
$iGroupID = FilterInput($_POST["GroupAssignID"],'int');
AddToGroup($iPersonID,$iGroupID,0);
}
if ( isset($_POST["VolunteerOpportunityAssign"]) && $_SESSION['bEditRecords'])
{
$volIDs = $_POST["VolunteerOpportunityIDs"];
if ($volIDs) {
foreach ($volIDs as $volID) {
AddVolunteerOpportunity($iPersonID, $volID);
}
}
}
// Service remove-volunteer-opportunity (these links set RemoveVO)
if ($iRemoveVO > 0 && $_SESSION['bEditRecords'])
{
RemoveVolunteerOpportunity($iPersonID, $iRemoveVO);
}
// Get this person's data
$sSQL = "SELECT a.*, family_fam.*, cls.lst_OptionName AS sClassName, fmr.lst_OptionName AS sFamRole, b.per_FirstName AS EnteredFirstName, b.per_ID AS EnteredId,
b.Per_LastName AS EnteredLastName, c.per_FirstName AS EditedFirstName, c.per_LastName AS EditedLastName, c.per_ID AS EditedId
FROM person_per a
LEFT JOIN family_fam ON a.per_fam_ID = family_fam.fam_ID
LEFT JOIN list_lst cls ON a.per_cls_ID = cls.lst_OptionID AND cls.lst_ID = 1
LEFT JOIN list_lst fmr ON a.per_fmr_ID = fmr.lst_OptionID AND fmr.lst_ID = 2
LEFT JOIN person_per b ON a.per_EnteredBy = b.per_ID
LEFT JOIN person_per c ON a.per_EditedBy = c.per_ID
WHERE a.per_ID = " . $iPersonID;
$rsPerson = RunQuery($sSQL);
extract(mysql_fetch_array($rsPerson));
// Get the lists of custom person fields
$sSQL = "SELECT person_custom_master.* FROM person_custom_master
ORDER BY custom_Order";
$rsCustomFields = RunQuery($sSQL);
// Get the custom field data for this person.
$sSQL = "SELECT * FROM person_custom WHERE per_ID = " . $iPersonID;
$rsCustomData = RunQuery($sSQL);
$aCustomData = mysql_fetch_array($rsCustomData, MYSQL_BOTH);
// Get the notes for this person
$sSQL = "SELECT nte_Private, nte_ID, nte_Text, nte_DateEntered, nte_EnteredBy, nte_DateLastEdited, nte_EditedBy, a.per_FirstName AS EnteredFirstName, a.Per_ID EnteredId, a.Per_LastName AS EnteredLastName, b.per_FirstName AS EditedFirstName, b.per_LastName AS EditedLastName, b.Per_ID EditedId ";
$sSQL .= "FROM note_nte ";
$sSQL .= "LEFT JOIN person_per a ON nte_EnteredBy = a.per_ID ";
$sSQL .= "LEFT JOIN person_per b ON nte_EditedBy = b.per_ID ";
$sSQL .= "WHERE nte_per_ID = " . $iPersonID;
// Admins should see all notes, private or not. Otherwise, only get notes marked non-private or private to the current user.
if (!$_SESSION['bAdmin'])
$sSQL .= " AND (nte_Private = 0 OR nte_Private = " . $_SESSION['iUserID'] . ")";
$rsNotes = RunQuery($sSQL);
// Get the Groups this Person is assigned to
$sSQL = "SELECT grp_ID, grp_Name, grp_hasSpecialProps, role.lst_OptionName AS roleName
FROM group_grp
LEFT JOIN person2group2role_p2g2r ON p2g2r_grp_ID = grp_ID
LEFT JOIN list_lst role ON lst_OptionID = p2g2r_rle_ID AND lst_ID = grp_RoleListID
WHERE person2group2role_p2g2r.p2g2r_per_ID = " . $iPersonID . "
ORDER BY grp_Name";
$rsAssignedGroups = RunQuery($sSQL);
$sAssignedGroups = ",";
// Get all the Groups
$sSQL = "SELECT grp_ID, grp_Name FROM group_grp ORDER BY grp_Name";
$rsGroups = RunQuery($sSQL);
// Get the volunteer opportunities this Person is assigned to
$sSQL = "SELECT vol_ID, vol_Name, vol_Description FROM volunteeropportunity_vol
LEFT JOIN person2volunteeropp_p2vo ON p2vo_vol_ID = vol_ID
WHERE person2volunteeropp_p2vo.p2vo_per_ID = " . $iPersonID . " ORDER by vol_Order";
$rsAssignedVolunteerOpps = RunQuery($sSQL);
// Get all the volunteer opportunities
$sSQL = "SELECT vol_ID, vol_Name FROM volunteeropportunity_vol ORDER BY vol_Order";
$rsVolunteerOpps = RunQuery($sSQL);
// Get the Properties assigned to this Person
$sSQL = "SELECT pro_Name, pro_ID, pro_Prompt, r2p_Value, prt_Name, pro_prt_ID
FROM record2property_r2p
LEFT JOIN property_pro ON pro_ID = r2p_pro_ID
LEFT JOIN propertytype_prt ON propertytype_prt.prt_ID = property_pro.pro_prt_ID
WHERE pro_Class = 'p' AND r2p_record_ID = " . $iPersonID .
" ORDER BY prt_Name, pro_Name";
$rsAssignedProperties = RunQuery($sSQL);
// Get all the properties
$sSQL = "SELECT * FROM property_pro WHERE pro_Class = 'p' ORDER BY pro_Name";
$rsProperties = RunQuery($sSQL);
// Get Field Security List Matrix
$sSQL = "SELECT * FROM list_lst WHERE lst_ID = 5 ORDER BY lst_OptionSequence";
$rsSecurityGrp = RunQuery($sSQL);
while ($aRow = mysql_fetch_array($rsSecurityGrp))
{
extract ($aRow);
$aSecurityType[$lst_OptionID] = $lst_OptionName;
}
if ($fam_ID != "") {
// Other family members by age
$sSQL = "SELECT per_ID, per_Title, per_FirstName, per_LastName, per_Suffix, per_Gender, per_Email,
per_BirthMonth, per_BirthDay, per_BirthYear, per_Flags, cls.lst_OptionName AS sClassName, fmr.lst_OptionName AS sFamRole
FROM person_per
LEFT JOIN list_lst cls ON per_cls_ID = cls.lst_OptionID AND cls.lst_ID = 1
LEFT JOIN list_lst fmr ON per_fmr_ID = fmr.lst_OptionID AND fmr.lst_ID = 2 where per_fam_ID = " . $fam_ID . " and per_Id != " . $per_ID . " order by per_BirthYear";
$rsOtherFamily = RunQuery($sSQL);
}
$dBirthDate = FormatBirthDate($per_BirthYear, $per_BirthMonth, $per_BirthDay,"-",$per_Flags);
$sFamilyInfoBegin = "<span style=\"color: red;\">";
$sFamilyInfoEnd = "</span>";
// Assign the values locally, after selecting whether to display the family or person information
SelectWhichAddress($sAddress1, $sAddress2, $per_Address1, $per_Address2, $fam_Address1, $fam_Address2, True);
$sCity = SelectWhichInfo($per_City, $fam_City, True);
$sState = SelectWhichInfo($per_State, $fam_State, True);
$sZip = SelectWhichInfo($per_Zip, $fam_Zip, True);
$sCountry = SelectWhichInfo($per_Country, $fam_Country, True);
$sPhoneCountry = SelectWhichInfo($per_Country, $fam_Country, False);
$sHomePhone = SelectWhichInfo(ExpandPhoneNumber($per_HomePhone,$sPhoneCountry,$dummy), ExpandPhoneNumber($fam_HomePhone,$fam_Country,$dummy), True);
$sWorkPhone = SelectWhichInfo(ExpandPhoneNumber($per_WorkPhone,$sPhoneCountry,$dummy), ExpandPhoneNumber($fam_WorkPhone,$fam_Country,$dummy), True);
$sCellPhone = SelectWhichInfo(ExpandPhoneNumber($per_CellPhone,$sPhoneCountry,$dummy), ExpandPhoneNumber($fam_CellPhone,$fam_Country,$dummy), True);
$sEmail = SelectWhichInfo($per_Email, $fam_Email, True);
$sUnformattedEmail = SelectWhichInfo($per_Email, $fam_Email, False);
if ($per_Envelope > 0)
$sEnvelope = $per_Envelope;
else
$sEnvelope = gettext("Not assigned");
// Set the page title and include HTML header
$sPageTitle = "Person Profile";
require "Include/Header.php";
$iTableSpacerWidth = 10;
$bOkToEdit = ($_SESSION['bEditRecords'] ||
($_SESSION['bEditSelf'] && $per_ID==$_SESSION['iUserID']) ||
($_SESSION['bEditSelf'] && $per_fam_ID==$_SESSION['iFamID'])
);
?>
<div class="btn-group pull-right">
<button type="button" class="btn btn-warning"><span class="glyphicon glyphicon-cog" aria-hidden="true"></span> Manage Profile</button>
<button type="button" class="btn btn-warning dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" role="menu">
<?php
if ($bOkToEdit) {
echo "<li><a href=\"#\" data-toggle=\"modal\" data-target=\"#upload-image\">". gettext("Upload Photo") ."</a></li>";
echo "<li><a href=\"#\" data-toggle=\"modal\" data-target=\"#confirm-delete-image\">". gettext("Delete Photo") ."</a></li>";
echo "<li class=\"divider\"></li>";
} ?>
<li><a href="VCardCreate.php?PersonID=<?php echo $per_ID; ?>" ><?php echo gettext("Create vCard"); ?></a></li>
<li><a href="PrintView.php?PersonID=<?php echo $per_ID; ?>"><?php echo gettext("Printable Page"); ?></a></li>
<li><a href="PersonView.php?PersonID=<?php echo $per_ID; ?>&AddToPeopleCart=<?php echo $per_ID; ?>"><?php echo gettext("Add to Cart"); ?></a></li>
<?php if ($_SESSION['bNotes']) { ?>
<li class="divider"></li>
<li><a href="WhyCameEditor.php?PersonID=<?php echo $per_ID ?>"><?php echo gettext("Edit \"Why Came\" Notes"); ?></a></li>
<li><a href="NoteEditor.php?PersonID=<?php echo $per_ID ?>"><?php echo gettext("Add a Note to this Record"); ?></a></li>
<?php } ?>
<li class="divider"></li>
<?php
if ($_SESSION['bDeleteRecords']) {
echo "<li><a href=\"SelectDelete.php?mode=person&PersonID=" . $per_ID . "\">" . gettext("Delete this Record") . "</a></li>";
}
if ($_SESSION['bAdmin'])
{
echo "<li class=\"divider\"></li>";
$sSQL = "SELECT usr_per_ID FROM user_usr WHERE usr_per_ID = " . $per_ID;
if (mysql_num_rows(RunQuery($sSQL)) == 0)
echo "<li> <a href=\"UserEditor.php?NewPersonID=" . $per_ID . "\">" . gettext("Make User") . "</a> </li>" ;
else
echo "<li> <a role=\"button\" href=\"UserEditor.php?PersonID=" . $per_ID . "\">" . gettext("Edit User") . "</a> " ;
}
?>
</ul>
<a class="btn btn-default" role="button" href="SelectList.php?mode=person"><span class="glyphicon glyphicon-list" aria-hidden="true"></span></a>
</div>
<p><br/><br/></p>
<div class="alert alert-warning alert-dismissable">
<i class="fa fa-magic"></i>
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<b><span style="color: red;"><?php echo gettext("Red text"); ?></span></b> <?php echo gettext("indicates items inherited from the associated family record.");?>
</div>
<div class="row">
<div class="col-lg-3 col-md-4 col-sm-4">
<div class="box box-solid box-info">
<div class="box-header">
<h3 class='box-title'>
<?php
echo getGenderIcon($per_Gender). " ".FormatFullName($per_Title, $per_FirstName, $per_MiddleName, $per_LastName, $per_Suffix, 0). " ";
if ($bOkToEdit) {?>
<a href="PersonEditor.php?PersonID=<?php echo $per_ID;?>">
<span class="fa-stack">
<i class="fa fa-square fa-stack-2x"></i>
<i class="fa fa-pencil fa-stack-1x fa-inverse"></i>
</span>
</a>
<?php }?>
</h3>
</div>
<div class="box-body">
<div class="box-tools">
<div class="label bg-light-blue"><?php
if ($sFamRole != "")
echo $sFamRole;
else
echo gettext("Member");
?>
</div>
<p />
</div>
<img src="<?php echo getPersonPhoto($iPersonID, $per_Gender, $sFamRole) ?>" alt="" class="img-circle center-block" />
<div class="box-tools">
<div class="label bg-olive">
<?php
echo $sClassName;
if ($per_MembershipDate) {
echo " since: ".FormatDate($per_MembershipDate,false);
} ?>
</div>
</div>
<p><hr/></p>
<div class="profile-details">
<ul class="fa-ul">
<li><i class="fa-li fa fa-group"></i>Family: <span>
<?php
if ($fam_ID != "") { ?>
<a href="FamilyView.php?FamilyID=<?php echo $fam_ID; ?>"><?php echo $fam_Name; ?> </a>
<a href="FamilyEditor.php?FamilyID=<?php echo $fam_ID; ?>" class="table-link">
<span class="fa-stack">
<i class="fa fa-square fa-stack-2x"></i>
<i class="fa fa-pencil fa-stack-1x fa-inverse"></i>
</span>
</a>
<?php } else
echo gettext("(No assigned family)");
?>
</span></li>
<li><i class="fa-li glyphicon glyphicon-home"></i>Address: <span>
<address>
<?php
if ($sAddress1 != "") { echo $sAddress1 . "<br>"; }
if ($sAddress2 != "") { echo $sAddress2 . "<br>"; }
if ($sCity != "") { echo $sCity . ", "; }
if ($sState != "") { echo $sState; }
if ($sZip != "") { echo " " . $sZip; }
if ($sCountry != "") {echo "<br>" . $sCountry; }
?>
</address>
</span></li>
<?php if ($dBirthDate) {?>
<li><i class="fa-li fa fa-calendar"></i><?php echo gettext("Birthdate:"); ?> <span><?php echo $dBirthDate; ?></span> (<?php PrintAge($per_BirthMonth,$per_BirthDay,$per_BirthYear,$per_Flags); ?>)</li>
<?php } if (!$bHideFriendDate) { /* Friend Date can be hidden - General Settings */ ?>
<li><i class="fa-li fa fa-tasks"></i><?php echo gettext("Friend Date:"); ?> <span><?php echo FormatDate($per_FriendDate,false); ?></span></li>
<?php } if ($sCellPhone) {?>
<li><i class="fa-li fa fa-mobile-phone"></i><?php echo gettext("Mobile Phone:"); ?> <span><?php echo $sCellPhone; ?></span></li>
<?php }
if ($sHomePhone) {
?>
<li><i class="fa-li fa fa-phone"></i><?php echo gettext("Home Phone:"); ?>
<span><?php echo $sHomePhone; ?></span></li>
<?php
}
if ($sEmail != "") { ?>
<li><i class="fa-li fa fa-envelope"></i><?php echo gettext("Email:"); ?> <span><?php echo "<a href=\"mailto:" . $sUnformattedEmail . "\">" . $sEmail . "</a>"; ?></span></li>
<?php if ($mailchimp->isActive()) { ?>
<li><i class="fa-li glyphicon glyphicon-send"></i>MailChimp: <span><?php echo $mailchimp->isEmailInMailChimp($sEmail);?></span></li>
<?php }
}
if ($sWorkPhone) {
?>
<li><i class="fa-li fa fa-phone"></i><?php echo gettext("Work Phone:"); ?> <span><?php echo $sWorkPhone; ?></span></li>
<?php } ?>
<?php if ($per_WorkEmail != "") { ?>
<li><i class="fa-li fa fa-envelope"></i><?php echo gettext("Work/Other Email:"); ?>: <span><?php echo "<a href=\"mailto:" . $per_WorkEmail . "\">" . $per_WorkEmail . "</a>"; ?></span></li>
<?php if ($mailchimp->isActive()) { ?>
<li><i class="fa-li glyphicon glyphicon-send"></i>MailChimp: <span><?php echo $mailchimp->isEmailInMailChimp($per_WorkEmail); ?></span></li>
<?php
}
}
// Display the right-side custom fields
while ($Row = mysql_fetch_array($rsCustomFields)) {
extract($Row);
$currentData = trim($aCustomData[$custom_Field]);
if ($currentData != "") {
if ($type_ID == 11) $custom_Special = $sPhoneCountry;
echo "<li><i class=\"fa-li glyphicon glyphicon-tag\"></i>" . $custom_Name . ": <span>";
echo nl2br((displayCustomField($type_ID, $currentData, $custom_Special)));
echo "</span></li>";
}
}
?>
</ul>
</div>
</div>
</div>
</div>
<div class="col-lg-9 col-md-8 col-sm-8">
<div class="box box-solid">
<div class="box-body clearfix">
<table width="100%">
<tr>
<td width="50%">
<img src="<?php echo getPersonPhoto($EnteredId, "", "") ?>" alt="" width="40" height="40" class="img-circle"/>
<?php echo gettext("Entered: ").FormatDate($per_DateEntered,false).gettext(" by ").$EnteredFirstName . " " . $EnteredLastName; ?>
</td>
<?php if (strlen($per_DateLastEdited) > 0) { ?>
<td width="50%">
<img src="<?php echo getPersonPhoto($EnteredId, "", "") ?>" alt="" width="40" height="40" class="img-circle"/>
<?php echo gettext("Updated: "). FormatDate($per_DateLastEdited,false) .gettext(" by ") . $EditedFirstName . " " . $EditedLastName."<br>"; ?>
</td>
<?php } ?>
</tr>
</table>
</div>
</div>
</div>
<div class="col-lg-9 col-md-8 col-sm-8">
<?php if (mysql_num_rows($rsOtherFamily) != 0) { ?>
<div class="row">
<div class="box box-solid">
<div class="box-body table-responsive clearfix">
<table class="table user-list table-hover">
<thead>
<tr>
<th><span>Family Members</span></th>
<th class="text-center"><span>Role</span></th>
<th><span>Birthday</span></th>
<th><span>Email</span></th>
<th> </th>
</tr>
</thead>
<tbody>
<?php while ($Row = mysql_fetch_array($rsOtherFamily)) {
$tmpPersonId = $Row["per_ID"];
?>
<tr>
<td>
<img src="<?php echo getPersonPhoto($tmpPersonId, $Row["per_Gender"], $Row["sFamRole"]) ?>" width="40" height="40" class="img-circle" />
<a href="PersonView.php?PersonID=<?php echo $tmpPersonId; ?>" class="user-link"><?php echo $Row["per_FirstName"]." ".$Row["per_LastName"]; ?> </a>
</td>
<td class="text-center">
<?php echo getRoleLabel($Row["sFamRole"]) ?>
</td>
<td>
<?php echo FormatBirthDate($Row["per_BirthYear"], $Row["per_BirthMonth"], $Row["per_BirthDay"],"-",$Row["per_Flags"]);?>
</td>
<td>
<?php $tmpEmail = $Row["per_Email"];
if ($tmpEmail != "") { ?>
<a href="#"><a href="mailto:<?php echo $tmpEmail; ?>"><?php echo $tmpEmail; ?></a></a>
<?php } ?>
</td>
<td style="width: 20%;">
<a href="PersonView.php?PersonID=<?php echo $tmpPersonId; ?>&AddToPeopleCart=<?php echo $tmpPersonId; ?>">
<span class="fa-stack">
<i class="fa fa-square fa-stack-2x"></i>
<i class="fa fa-shopping-cart fa-stack-1x fa-inverse"></i>
</span>
</a>
<?php if ($bOkToEdit) { ?>
<a href="PersonEditor.php?PersonID=<?php echo $tmpPersonId; ?>">
<span class="fa-stack">
<i class="fa fa-square fa-stack-2x"></i>
<i class="fa fa-pencil fa-stack-1x fa-inverse"></i>
</span>
</a>
<a href="SelectDelete.php?mode=person&PersonID=<?php echo $tmpPersonId; ?>">
<span class="fa-stack">
<i class="fa fa-square fa-stack-2x"></i>
<i class="fa fa-trash-o fa-stack-1x fa-inverse"></i>
</span>
</a>
<?php } ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
<div class="row">
<div class="box box-solid">
<div class="box-body clearfix">
<div class="nav-tabs-custom">
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#groups" aria-controls="groups" role="tab" data-toggle="tab"><?php echo gettext("Assigned Groups"); ?></a></li>
<li role="presentation"><a href="#properties" aria-controls="properties" role="tab" data-toggle="tab"><?php echo gettext("Assigned Properties"); ?></a></li>
<li role="presentation"><a href="#volunteer" aria-controls="volunteer" role="tab" data-toggle="tab"><?php echo gettext("Volunteer opportunities"); ?></a></li>
<?php if ($_SESSION['bNotes']) { ?>
<li role="presentation"><a href="#notes" aria-controls="notes" role="tab" data-toggle="tab"><?php echo gettext("Notes"); ?></a></li>
<?php } ?>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div role="tab-pane fade" class="tab-pane active" id="groups">
<div class="main-box clearfix">
<div class="main-box-body clearfix">
<?php
//Was anything returned?
if (mysql_num_rows($rsAssignedGroups) == 0) {?>
<br>
<div class="alert alert-warning">
<i class="fa fa-question-circle fa-fw fa-lg"></i> <span><?php echo gettext("No group assignments."); ?></span>
</div>
<?php } else {
echo "<div class=\"row\">";
// Loop through the rows
while ($aRow = mysql_fetch_array($rsAssignedGroups)) {
extract($aRow); ?>
<div class="col-md-3">
<p><br/></p>
<!-- Info box -->
<div class="box box-info">
<div class="box-header">
<h3 class="box-title"><a href="GroupView.php?GroupID=<?php echo $grp_ID ?>"><?php echo $grp_Name; ?></a></h3>
<div class="box-tools pull-right">
<div class="label bg-aqua"><?php echo $roleName;?></div>
</div>
</div>
<?php
// If this group has associated special properties, display those with values and prop_PersonDisplay flag set.
if ($grp_hasSpecialProps == 'true') {
// Get the special properties for this group
$sSQL = "SELECT groupprop_master.* FROM groupprop_master WHERE grp_ID = " . $grp_ID . " AND prop_PersonDisplay = 'true' ORDER BY prop_ID";
$rsPropList = RunQuery($sSQL);
$sSQL = "SELECT * FROM groupprop_" . $grp_ID . " WHERE per_ID = " . $iPersonID;
$rsPersonProps = RunQuery($sSQL);
$aPersonProps = mysql_fetch_array($rsPersonProps, MYSQL_BOTH);
echo "<div class=\"box-body\">";
while ($aProps = mysql_fetch_array($rsPropList)) {
extract($aProps);
$currentData = trim($aPersonProps[$prop_Field]);
if (strlen($currentData) > 0) {
$sRowClass = AlternateRowStyle($sRowClass);
if ($type_ID == 11) $prop_Special = $sPhoneCountry;
echo "<strong>" . $prop_Name . "</strong>: " . displayCustomField($type_ID, $currentData, $prop_Special) . "<br/>";
}
}
echo "</div><!-- /.box-body -->";
} ?>
<div class="box-footer">
<code>
<?php if ($_SESSION['bManageGroups']) {?>
<a href="GroupView.php?GroupID=<?php echo $grp_ID ?>" class="btn btn-default" role="button"><i class="glyphicon glyphicon-list"></i></a>
<div class="btn-group">
<button type="button" class="btn btn-default">Action</button>
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="MemberRoleChange.php?GroupID=<?php echo $grp_ID; ?>&PersonID=<?php echo $iPersonID; ?>" >Change Role</a></li>
<?php if ($grp_hasSpecialProps == 'true') { ?>
<li><a href="GroupPropsEditor.php?GroupID=<?php echo $grp_ID; ?>&PersonID=<?php echo $iPersonID; ?>">Update Properties</a></li>
<?php } ?>
</ul>
</div>
<a href="#" onclick="GroupRemove(<?php echo $grp_ID . ", " . $iPersonID ;?>);" class="btn btn-danger" role="button"><i class="fa fa-trash-o"></i></a>
<?php } ?>
</code>
</div><!-- /.box-footer-->
</div><!-- /.box -->
</div>
<?php
// NOTE: this method is crude. Need to replace this with use of an array.
$sAssignedGroups .= $grp_ID . ",";
}
echo "</div>";
}
if ($_SESSION['bManageGroups']) { ?>
<div class="alert alert-info">
<h4><strong>Assign New Group</strong></h4>
<i class="fa fa-info-circle fa-fw fa-lg"></i> <span><?php echo gettext("Person will be assigned to the Group in the Default Role."); ?></span>
<p><br></p>
<form method="post" action="PersonView.php?PersonID=<?php echo $iPersonID ?>">
<select name="GroupAssignID">
<?php while ($aRow = mysql_fetch_array($rsGroups)) {
extract($aRow);
//If the property doesn't already exist for this Person, write the <OPTION> tag
if (strlen(strstr($sAssignedGroups,"," . $grp_ID . ",")) == 0) {
echo "<option value=\"" . $grp_ID . "\">" . $grp_Name . "</option>";
}
}
?>
</select>
<input type="submit" class="btn-primary" <?php echo 'value="' . gettext("Assign") . '"'; ?> name="GroupAssign">
<br>
</form>
</div>
<?php } ?>
</div>
</div>
</div>
<div role="tab-pane fade" class="tab-pane" id="properties">
<div class="main-box clearfix">
<div class="main-box-body clearfix">
<?php
$sAssignedProperties = ",";
//Was anything returned?
if (mysql_num_rows($rsAssignedProperties) == 0) { ?>
<br>
<div class="alert alert-warning">
<i class="fa fa-question-circle fa-fw fa-lg"></i> <span><?php echo gettext("No property assignments."); ?></span>
</div>
<?php } else {
//Yes, start the table
echo "<table width=\"100%\" cellpadding=\"4\" cellspacing=\"0\">";
echo "<tr class=\"TableHeader\">";
echo "<td width=\"10%\" valign=\"top\"><b>" . gettext("Type") . "</b>";
echo "<td width=\"15%\" valign=\"top\"><b>" . gettext("Name") . "</b>";
echo "<td valign=\"top\"><b>" . gettext("Value") . "</b></td>";
if ($bOkToEdit)
{
echo "<td valign=\"top\"><b>" . gettext("Edit") . "</b></td>";
echo "<td valign=\"top\"><b>" . gettext("Remove") . "</b></td>";
}
echo "</tr>";
$last_pro_prt_ID = "";
$bIsFirst = true;
//Loop through the rows
while ($aRow = mysql_fetch_array($rsAssignedProperties))
{
$pro_Prompt = "";
$r2p_Value = "";
extract($aRow);
if ($pro_prt_ID != $last_pro_prt_ID)
{
echo "<tr class=\"";
if ($bIsFirst)
echo "RowColorB";
else
echo "RowColorC";
echo "\"><td><b>" . $prt_Name . "</b></td>";
$bIsFirst = false;
$last_pro_prt_ID = $pro_prt_ID;
$sRowClass = "RowColorB";
}
else
{
echo "<tr class=\"" . $sRowClass . "\">";
echo "<td valign=\"top\"> </td>";
}
echo "<td valign=\"center\">" . $pro_Name . " </td>";
echo "<td valign=\"center\">" . $r2p_Value . " </td>";
if ($bOkToEdit)
{
if (strlen($pro_Prompt) > 0)
{
echo "<td valign=\"center\"><a href=\"PropertyAssign.php?PersonID=" . $iPersonID . "&PropertyID=" . $pro_ID . "\">" . gettext("Edit") . "</a></td>";
}
else
{
echo "<td> </td>";
}
echo "<td valign=\"center\"><a href=\"PropertyUnassign.php?PersonID=" . $iPersonID . "&PropertyID=" . $pro_ID . "\">" . gettext("Remove") . "</a></td>";
}
echo "</tr>";
//Alternate the row style
$sRowClass = AlternateRowStyle($sRowClass);
$sAssignedProperties .= $pro_ID . ",";
}
echo "</table>";
}
?>
<?php if ($bOkToEdit && mysql_num_rows($rsProperties) != 0) { ?>
<div class="alert alert-info">
<div>
<h4><strong><?php echo gettext("Assign a New Property:"); ?></strong></h4>
<p><br></p>
<form method="post" action="PropertyAssign.php?PersonID=<?php echo $iPersonID; ?>">
<select name="PropertyID">
<?php
while ($aRow = mysql_fetch_array($rsProperties)) {
extract($aRow);
//If the property doesn't already exist for this Person, write the <OPTION> tag
if (strlen(strstr($sAssignedProperties,"," . $pro_ID . ",")) == 0) {
echo "<option value=\"" . $pro_ID . "\">" . $pro_Name . "</option>";
}
}
?>
</select>
<input type="submit" class="btn-primary" <?php echo 'value="' . gettext("Assign") . '"'; ?> name="Submit" >
</form>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
<div role="tab-pane fade" class="tab-pane" id="volunteer">
<div class="main-box clearfix">
<div class="main-box-body clearfix">
<?php
//Initialize row shading
$sRowClass = "RowColorA";
$sAssignedVolunteerOpps = ",";
//Was anything returned?
if (mysql_num_rows($rsAssignedVolunteerOpps) == 0) {?>
<br>
<div class="alert alert-warning">
<i class="fa fa-question-circle fa-fw fa-lg"></i> <span><?php echo gettext("No volunteer opportunity assignments."); ?></span>
</div>
<?php } else {
echo "<table width=\"100%\" cellpadding=\"4\" cellspacing=\"0\">";
echo "<tr class=\"TableHeader\">";
echo "<td>" . gettext("Name") . "</td>";
echo "<td>" . gettext("Description") . "</td>";
if ($_SESSION['bEditRecords']) {
echo "<td width=\"10%\">" . gettext("Remove") . "</td>";
}
echo "</tr>";
// Loop through the rows
while ($aRow = mysql_fetch_array($rsAssignedVolunteerOpps))
{
extract($aRow);
// Alternate the row style
$sRowClass = AlternateRowStyle($sRowClass);
echo "<tr class=\"" . $sRowClass . "\">";
echo "<td>" . $vol_Name . "</a></td>";
echo "<td>" . $vol_Description . "</a></td>";
if ($_SESSION['bEditRecords']) echo "<td><a class=\"SmallText\" href=\"PersonView.php?PersonID=" . $per_ID . "&RemoveVO=" . $vol_ID . "\">" . gettext("Remove") . "</a></td>";
echo "</tr>";
// NOTE: this method is crude. Need to replace this with use of an array.
$sAssignedVolunteerOpps .= $vol_ID . ",";
}
echo "</table>";
}
?>
<?php if ($_SESSION['bEditRecords']) { ?>
<div class="alert alert-info">
<div>
<h4><strong><?php echo gettext("Assign a New Volunteer Opportunity:"); ?></strong></h4>
<p><br></p>
<form method="post" action="PersonView.php?PersonID=<?php echo $iPersonID ?>">
<select name="VolunteerOpportunityIDs[]", size=6, multiple>
<?php
while ($aRow = mysql_fetch_array($rsVolunteerOpps)) {
extract($aRow);
//If the property doesn't already exist for this Person, write the <OPTION> tag
if (strlen(strstr($sAssignedVolunteerOpps,"," . $vol_ID . ",")) == 0) {
echo "<option value=\"" . $vol_ID . "\">" . $vol_Name . "</option>";
}
}
?>
</select>
<input type="submit" <?php echo 'value="' . gettext("Assign") . '"'; ?> name="VolunteerOpportunityAssign" class="btn-primary">
</form>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
<?php if ($_SESSION['bNotes']) { ?>
<div role="tab-pane fade" class="tab-pane" id="notes">
<div class="box box-solid">
<div class="box-header">
<p>
<div class="pull-right top-page-ui text-center clearfix">
<div class="profile-message-btn btn-group">
<a class="btn btn-primary active" role="button" href="NoteEditor.php?FamilyID=<?php echo $fam_ID; ?>"><span class="fa fa-plus" aria-hidden="true"></span> Add Note</a>
</div>
</div>
<br></p>
</div>
<div class="box-body chat" id="chat-box">
<?php
//Loop through all the notes
while($aRow = mysql_fetch_array($rsNotes)){
extract($aRow);
?>
<!-- chat item -->
<div class="item">
<img src="<?php echo getPersonPhoto($EnteredId, "", "") ?>"/>
<p class="message">
<a href="#" class="name">
<small class="text-muted pull-right"><i class="fa fa-clock-o"></i> <?php
if (!strlen($nte_DateLastEdited)) {
echo FormatDate($nte_DateEntered, True);
} else {
echo FormatDate($nte_DateLastEdited,True);
} ?>
</small>
<?php if (!strlen($nte_DateLastEdited)) {
echo $EnteredFirstName . " " . $EnteredLastName;
} else {
echo $EditedFirstName . " " . $EditedLastName;
}?>
</a>
<?php echo $nte_Text ?>
</p>
<?php if ($_SESSION['bNotes']) { ?>
<div class="pull-right">
<a href="NoteEditor.php?PersonID=<?php echo $iPersonID ?>&NoteID=<?php echo $nte_ID ?>">
<span class="fa-stack">
<i class="fa fa-square fa-stack-2x"></i>
<i class="fa fa-pencil fa-stack-1x fa-inverse"></i>
</span>
</a>
<a href="NoteDelete.php?NoteID=<?php echo $nte_ID ?>">
<span class="fa-stack">
<i class="fa fa-square fa-stack-2x"></i>
<i class="fa fa-trash-o fa-stack-1x fa-inverse"></i>
</span>
</a>
</div>
<?php } ?>
</div><!-- /.item -->
<?php } ?>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="upload-image" tabindex="-1" role="dialog" aria-labelledby="upload-Image-label" aria-hidden="true">
<div class="modal-dialog">
<form action="ImageUpload.php?PersonID=<?php echo $iPersonID;?>" method="post" enctype="multipart/form-data" id="UploadForm">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="upload-Image-label"><?php echo gettext("Upload Photo") ?></h4>
</div>
<div class="modal-body">
<input type="file" name="file" size="50" />
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<input type="submit" class="btn btn-primary" value="Upload Image">
</div>
</div>
</form>
</div>
</div>
<div class="modal fade" id="confirm-delete-image" tabindex="-1" role="dialog" aria-labelledby="delete-Image-label" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="delete-Image-label">Confirm Delete</h4>
</div>
<div class="modal-body">
<p>You are about to delete the profile photo, this procedure is irreversible.</p>
<p>Do you want to proceed?</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<a href="ImageDelete.php?PersonID=<?php echo $iPersonID;?>" class="btn btn-danger danger">Delete</a>
</div>
</div>
</div>
</div>
<script language="javascript">
function GroupRemove( Group, Person ) {
var answer = confirm (<?php echo "'", "'"; ?>)
if ( answer )
window.location="GroupMemberList.php?GroupID=" + Group + "&PersonToRemove=" + Person
}
</script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/jasny-bootstrap/3.1.3/css/jasny-bootstrap.min.css">
<!-- Latest compiled and minified JavaScript -->
<script src="//cdnjs.cloudflare.com/ajax/libs/jasny-bootstrap/3.1.3/js/jasny-bootstrap.min.js"></script>
<?php
require "Include/Footer.php";
?>
| focuz07/CRM | churchinfo/PersonView.php | PHP | mit | 35,722 |
import DS from 'ember-data';
export default DS.Model.extend({
user: DS.belongsTo('user'),
userUsername: DS.attr('string'),
emailNotifications: DS.attr('boolean')
});
| jbingham94/innovation-week-project | example_app/static/example_app/app/models/user-profile.js | JavaScript | mit | 179 |
from ga_starters import * | Drob-AI/music-queue-rec | src/playlistsRecomender/gaPlaylistGenerator/__init__.py | Python | mit | 25 |
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<?php
require_once("../../vendor/autoload.php");
use OpenDataAPI\aggregator\providers\government\BankGovUa;
use OpenDataAPI\aggregator\constants\DataFormat;
use OpenDataAPI\aggregator\constants\Currency;
$response = BankGovUa::getExchangeRate(DataFormat::XML, "20150314", Currency::USD);
var_dump($response);
$response = BankGovUa::getObligations(DataFormat::JSON);
var_dump($response);
$response = BankGovUa::getIndex(DataFormat::XML);
var_dump($response);
?>
</body>
</html>
| OpenDataAPI/aggregator | examples/government/bank-gov-ua.php | PHP | mit | 577 |
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("14. DecimalToBinaryNumber")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("14. DecimalToBinaryNumber")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[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("6330f0da-7a23-4460-9347-5e1348ce9efc")]
// 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")]
| g-yonchev/TelerikAcademy | Homeworks/C# 1/06.LoopsHW/14. DecimalToBinaryNumber/Properties/AssemblyInfo.cs | C# | mit | 1,426 |
#!/usr/bin/env python3
# Copyright (c) 2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from test_framework.mininode import *
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
import time
'''
FeeFilterTest -- test processing of feefilter messages
'''
def hashToHex(hash):
return format(hash, '064x')
# Wait up to 60 secs to see if the testnode has received all the expected invs
def allInvsMatch(invsExpected, testnode):
for x in range(60):
with mininode_lock:
if (sorted(invsExpected) == sorted(testnode.txinvs)):
return True;
time.sleep(1)
return False;
# TestNode: bare-bones "peer". Used to track which invs are received from a node
# and to send the node feefilter messages.
class TestNode(SingleNodeConnCB):
def __init__(self):
SingleNodeConnCB.__init__(self)
self.txinvs = []
def on_inv(self, conn, message):
for i in message.inv:
if (i.type == 1):
self.txinvs.append(hashToHex(i.hash))
def clear_invs(self):
with mininode_lock:
self.txinvs = []
def send_filter(self, feerate):
self.send_message(msg_feefilter(feerate))
self.sync_with_ping()
class FeeFilterTest(BitcoinTestFramework):
def __init__(self):
super().__init__()
self.num_nodes = 2
self.setup_clean_chain = False
def setup_network(self):
# Node1 will be used to generate txs which should be relayed from Node0
# to our test node
self.nodes = []
self.nodes.append(start_node(0, self.options.tmpdir, ["-debug", "-logtimemicros"]))
self.nodes.append(start_node(1, self.options.tmpdir, ["-debug", "-logtimemicros"]))
connect_nodes(self.nodes[0], 1)
def run_test(self):
node1 = self.nodes[1]
node0 = self.nodes[0]
# Get out of IBD
node1.generate(1)
sync_blocks(self.nodes)
node0.generate(21)
sync_blocks(self.nodes)
# Setup the p2p connections and start up the network thread.
test_node = TestNode()
connection = NodeConn('127.0.0.1', p2p_port(0), self.nodes[0], test_node)
test_node.add_connection(connection)
NetworkThread().start()
test_node.wait_for_verack()
# Test that invs are received for all txs at feerate of 20 sat/byte
node1.settxfee(Decimal("0.00020000"))
txids = [node1.sendtoaddress(node1.getnewaddress(), 1) for x in range(3)]
assert(allInvsMatch(txids, test_node))
test_node.clear_invs()
# Set a filter of 15 sat/byte
test_node.send_filter(15000)
# Test that txs are still being received (paying 20 sat/byte)
txids = [node1.sendtoaddress(node1.getnewaddress(), 1) for x in range(3)]
assert(allInvsMatch(txids, test_node))
test_node.clear_invs()
# Change tx fee rate to 10 sat/byte and test they are no longer received
node1.settxfee(Decimal("0.00010000"))
[node1.sendtoaddress(node1.getnewaddress(), 1) for x in range(3)]
sync_mempools(self.nodes) # must be sure node 0 has received all txs
# Send one transaction from node0 that should be received, so that we
# we can sync the test on receipt (if node1's txs were relayed, they'd
# be received by the time this node0 tx is received). This is
# unfortunately reliant on the current relay behavior where we batch up
# to 35 entries in an inv, which means that when this next transaction
# is eligible for relay, the prior transactions from node1 are eligible
# as well.
node0.settxfee(Decimal("0.00020000"))
txids = [node0.sendtoaddress(node0.getnewaddress(), 1)]
assert(allInvsMatch(txids, test_node))
test_node.clear_invs()
# Remove fee filter and check that txs are received again
test_node.send_filter(0)
txids = [node1.sendtoaddress(node1.getnewaddress(), 1) for x in range(3)]
assert(allInvsMatch(txids, test_node))
test_node.clear_invs()
if __name__ == '__main__':
FeeFilterTest().main()
| segwit/atbcoin-insight | qa/rpc-tests/p2p-feefilter.py | Python | mit | 4,317 |
'use strict';
// Tasks controller
angular.module('tasks').controller('TasksController', ['$scope', '$stateParams', '$location', 'Authentication', 'Tasks',
function($scope, $stateParams, $location, Authentication, Tasks) {
$scope.authentication = Authentication;
$scope.bases = [
{name: 'Squat', lift: 'squat'},
{name: 'Deadlift', lift: 'deadlift'},
{name: 'Bench Press', lift: 'benchPress'},
{name: 'Clean and Jerk', lift: 'cleanJerk'},
{name: 'Snatch', lift: 'snatch'},
{name: 'Front Squat', lift: 'frontSquat'}
];
// Create new Task
$scope.create = function() {
// Create new Task object
var task = new Tasks ({
name: this.name,
description: this.description,
reps: this.reps,
sets: this.sets,
weights: this.weights,
baseLift: this.baseLift
});
// Redirect after save
task.$save(function(response) {
$location.path('workoutplans/' + response._id);
// Clear form fields
$scope.name = '';
}, function(errorResponse) {
$scope.error = errorResponse.data.message;
});
};
// Remove existing Task
$scope.remove = function(task) {
if ( task ) {
task.$remove();
for (var i in $scope.tasks) {
if ($scope.tasks [i] === task) {
$scope.tasks.splice(i, 1);
}
}
} else {
$scope.task.$remove(function() {
$location.path('tasks');
});
}
};
// Update existing Task
$scope.update = function() {
var task = $scope.task;
task.$update(function() {
$location.path('tasks/' + task._id);
}, function(errorResponse) {
$scope.error = errorResponse.data.message;
});
};
// Find a list of Tasks
$scope.find = function() {
$scope.tasks = Tasks.query();
};
// Find existing Task
$scope.findOne = function() {
$scope.task = Tasks.get({
taskId: $stateParams.taskId
});
};
}
]); | kyleaziz/lptrack | public/modules/tasks/controllers/tasks.client.controller.js | JavaScript | mit | 1,862 |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.communication.models;
import com.azure.resourcemanager.communication.fluent.models.LinkedNotificationHubInner;
/** An immutable client-side representation of LinkedNotificationHub. */
public interface LinkedNotificationHub {
/**
* Gets the resourceId property: The resource ID of the notification hub.
*
* @return the resourceId value.
*/
String resourceId();
/**
* Gets the inner com.azure.resourcemanager.communication.fluent.models.LinkedNotificationHubInner object.
*
* @return the inner object.
*/
LinkedNotificationHubInner innerModel();
}
| Azure/azure-sdk-for-java | sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/models/LinkedNotificationHub.java | Java | mit | 796 |
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("Problem15NumberCalculations")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Johnson Controls")]
[assembly: AssemblyProduct("Problem15NumberCalculations")]
[assembly: AssemblyCopyright("Copyright © Johnson Controls 2015")]
[assembly: AssemblyTrademark("")]
[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("a94e537b-e2d0-4d96-84bb-c641a0a647ef")]
// 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")]
| atanas-georgiev/TelerikAcademy | 02.CSharp-Part-2/Homeworks/Homework3/Problem15NumberCalculations/Properties/AssemblyInfo.cs | C# | mit | 1,462 |
<?php
/* MyBlogBundle:Page1:show.html.twig */
class __TwigTemplate_08fcdadc891be1ff86c1a8975ebb45fd2499c330db77b218c31a75106267fb4f extends Twig_Template
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
// line 1
try {
$this->parent = $this->env->loadTemplate("MyBlogBundle::base.html.twig");
} catch (Twig_Error_Loader $e) {
$e->setTemplateFile($this->getTemplateName());
$e->setTemplateLine(1);
throw $e;
}
$this->blocks = array(
'body' => array($this, 'block_body'),
);
}
protected function doGetParent(array $context)
{
return "MyBlogBundle::base.html.twig";
}
protected function doDisplay(array $context, array $blocks = array())
{
$this->parent->display($context, array_merge($this->blocks, $blocks));
}
// line 3
public function block_body($context, array $blocks = array())
{
// line 5
echo "<h1>Текстова страница 1</h1>
\t
\t<div id=\"text-title\">
";
// line 8
echo twig_escape_filter($this->env, $this->getAttribute((isset($context["entity"]) ? $context["entity"] : $this->getContext($context, "entity")), "title", array()), "html", null, true);
echo "
</div>
\t
\t<div id=\"text-date\">
";
// line 12
echo twig_escape_filter($this->env, twig_date_format_filter($this->env, $this->getAttribute((isset($context["entity"]) ? $context["entity"] : $this->getContext($context, "entity")), "date", array()), "d.m.Y | H:i"), "html", null, true);
echo "
</div>
\t
<div id=\"text-content-show\">
";
// line 16
echo twig_escape_filter($this->env, $this->getAttribute((isset($context["entity"]) ? $context["entity"] : $this->getContext($context, "entity")), "text", array()), "html", null, true);
echo "
</div>
<div id=\"link-more\">
<a href=\"";
// line 20
echo $this->env->getExtension('routing')->getPath("page1");
echo "\"> Обратно към страницата </a>
</div>
\t\t
";
}
public function getTemplateName()
{
return "MyBlogBundle:Page1:show.html.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 65 => 20, 58 => 16, 51 => 12, 44 => 8, 39 => 5, 36 => 3, 11 => 1,);
}
}
| ceccy13/myblog-symfony2 | app/cache/dev/twig/08/fc/dadc891be1ff86c1a8975ebb45fd2499c330db77b218c31a75106267fb4f.php | PHP | mit | 2,528 |
require_relative '../../../spec_helper'
require_relative '../../../../lib/noaa_weather_client/responses/current_observation'
module NoaaWeatherClient
module Responses
describe CurrentObservation do
let(:body) {
VCR.use_cassette(:current_observations, match_requests_on: [:method, :uri]) { |c|
c.http_interactions.response_for(
VCR::Request.new.tap { |r|
r.method = :get
r.uri = 'http://w1.weather.gov/xml/current_obs/KSGF.xml'
}).body
}
}
let(:current_observation) { CurrentObservation.new body }
it "requires a response" do
current_observation
expect { CurrentObservation.new }.to raise_error(ArgumentError)
end
context "when the response is invalid" do
it "raises an ArgumentError" do
expect { CurrentObservation.new '<invalid></invalid>' }.to raise_error(Errors::InvalidXmlError)
end
end
it "exposes location" do
expect(current_observation.location).to eq('Springfield-Branson National Airport, MO')
end
it "exposes station_id" do
expect(current_observation.station_id).to eq('KSGF')
end
it "exposes latitude" do
expect(current_observation.latitude).to eq(37.23)
end
it "exposes longitude" do
expect(current_observation.longitude).to eq(-93.38)
end
it "exposes observation_time_string" do
expect(current_observation.observation_time_string).to eq('Last Updated on Aug 12 2013, 8:52 pm CDT')
end
it "exposes observation_time" do
expect(current_observation.observation_time).to eq(Time.parse '2013-08-12 20:52:00 -0500')
end
it "exposes weather" do
expect(current_observation.weather).to eq('Fair')
end
it "exposes temperature_string" do
expect(current_observation.temperature_string).to eq('74.0 F (23.3 C)')
end
it "exposes temperature_fahrenheit" do
expect(current_observation.temperature_fahrenheit).to eq(74.0)
end
it "exposes temperature_celsius" do
expect(current_observation.temperature_celsius).to eq(23.3)
end
it "exposes relative_humidity" do
expect(current_observation.relative_humidity).to eq(85)
end
it "exposes wind_string" do
expect(current_observation.wind_string).to eq('Calm')
end
it "exposes wind_dir" do
expect(current_observation.wind_dir).to eq('North')
end
it "exposes wind_degrees" do
expect(current_observation.wind_degrees).to eq(0)
end
it "exposes wind_mph" do
expect(current_observation.wind_mph).to eq(0.0)
end
it "exposes wind_kt" do
expect(current_observation.wind_kt).to eq(0)
end
it "exposes pressure_string" do
expect(current_observation.pressure_string).to eq('1014.7 mb')
end
it "exposes pressure_mb" do
expect(current_observation.pressure_mb).to eq(1014.7)
end
it "exposes pressure_in" do
expect(current_observation.pressure_in).to eq(30.00)
end
it "exposes dewpoint_string" do
expect(current_observation.dewpoint_string).to eq('69.1 F (20.6 C)')
end
it "exposes dewpoint_fahrenheit" do
expect(current_observation.dewpoint_fahrenheit).to eq(69.1)
end
it "exposes dewpoint_celsius" do
expect(current_observation.dewpoint_celsius).to eq(20.6)
end
it "exposes visibility_mi" do
expect(current_observation.visibility_mi).to eq(10.00)
end
it "exposes icon_url_base" do
expect(current_observation.icon_url_base).to eq('http://forecast.weather.gov/images/wtf/small/')
end
it "exposes two_day_history_url" do
expect(current_observation.two_day_history_url).to eq('http://www.weather.gov/data/obhistory/KSGF.html')
end
it "exposes icon_url_name" do
expect(current_observation.icon_url_name).to eq('nskc.png')
end
it "exposes ob_url" do
expect(current_observation.ob_url).to eq('http://www.weather.gov/data/METAR/KSGF.1.txt')
end
it "exposes disclaimer_url" do
expect(current_observation.disclaimer_url).to eq('http://weather.gov/disclaimer.html')
end
it "exposes copyright_url" do
expect(current_observation.copyright_url).to eq('http://weather.gov/disclaimer.html')
end
it "exposes privacy_policy_url" do
expect(current_observation.privacy_policy_url).to eq('http://weather.gov/notice.html')
end
end
end
end
| tylerdooling/noaa_weather_client | spec/lib/noaa_client/responses/current_observation_spec.rb | Ruby | mit | 4,618 |
angular
.module('eventApp', [
'ngResource',
'ui.bootstrap',
'ui.select',
'ui.bootstrap.datetimepicker',
'global',
'messagingApp',
'datasetApp'
])
.constant('HEK_URL', 'http://www.lmsal.com/hek/her')
.constant('HEK_QUERY_PARAMS', {
'cosec': 2, // ask for json
'cmd': 'search', // search command
'type': 'column',
'event_coordsys': 'helioprojective', //always specify wide coordinates, otherwise does not work
'x1': '-5000',
'x2': '5000',
'y1': '-5000',
'y2': '5000',
'return': 'event_type,event_starttime,event_endtime,kb_archivid,gs_thumburl,frm_name,frm_identifier', // limit the returned fields
'result_limit': 10, // limit the number of results
'event_type': '**', // override to only select some event types
'event_starttime': new Date(Date.UTC(1975, 9, 1)).toISOString(), // The first HEK event is in september 1975
'event_endtime': new Date().toISOString()
})
.constant('HEK_GET_PARAMS', {
'cosec': 2, // ask for json
'cmd': 'export-voevent' // search command
})
.constant('EVENT_TYPES', {
AR : 'Active Region',
CE : 'CME',
CD : 'Coronal Dimming',
CH : 'Coronal Hole',
CW : 'Coronal Wave',
FI : 'Filament',
FE : 'Filament Eruption',
FA : 'Filament Activation',
FL : 'Flare',
C_FL : 'Flare (C1+)',
M_FL : 'Flare (M1+)',
X_FL : 'Flare (X1+)',
LP : 'Loop',
OS : 'Oscillation',
SS : 'Sunspot',
EF : 'Emerging Flux',
CJ : 'Coronal Jet',
PG : 'Plage',
OT : 'Other',
NR : 'Nothing Reported',
SG : 'Sigmoid',
SP : 'Spray Surge',
CR : 'Coronal Rain',
CC : 'Coronal Cavity',
ER : 'Eruption',
TO : 'Topological Object'
}); | bmampaey/SVO | event/module.js | JavaScript | mit | 1,566 |
<?php
namespace BramR\Stack;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpKernelInterface;
class Heartbeat implements HttpKernelInterface
{
const MESSAGE = 'OK';
protected $app;
protected $handler;
protected $route;
/**
* @param HttpKernelInterface $app
* @param string $route = '/heartbeat.check'
* @param callable|null $handler = null
*/
public function __construct(HttpKernelInterface $app, $route = '/heartbeat.check', callable $handler = null)
{
$this->app = $app;
$this->route = $route;
$this->handler = $handler;
}
/**
* {@inheritdoc}
**/
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
{
if ($request->getPathInfo() === $this->route) {
$handler = $this->getHandler();
return $handler();
} else {
return $this->app->handle($request, $type, $catch);
}
}
/**
* getHandler
* @return callable
*/
protected function getHandler()
{
if (is_null($this->handler)) {
$this->handler = function () {
return new Response(self::MESSAGE, 200, array('Content-Type' => 'text/plain'));
};
}
return $this->handler;
}
}
| bramr/stack-heartbeat | src/Heartbeat.php | PHP | mit | 1,394 |
'use strict';
module.exports = {
db: 'mongodb://localhost/qaapp-dev',
//db: 'mongodb://nodejitsu:e0b737c9d532fc27e1e753a25a4f823e@troup.mongohq.com:10001/nodejitsudb3924701379',
mongoose: {
debug: true
},
app: {
name: 'AskOn'
},
facebook: {
clientID: 'DEFAULT_APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/facebook/callback'
},
twitter: {
clientID: 'DEFAULT_CONSUMER_KEY',
clientSecret: 'CONSUMER_SECRET',
callbackURL: 'http://localhost:3000/auth/twitter/callback'
},
github: {
clientID: 'DEFAULT_APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/github/callback'
},
google: {
clientID: 'DEFAULT_APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/google/callback'
},
linkedin: {
clientID: 'DEFAULT_API_KEY',
clientSecret: 'SECRET_KEY',
callbackURL: 'http://localhost:3000/auth/linkedin/callback'
},
emailFrom: 'SENDER EMAIL ADDRESS', // sender address like ABC <abc@example.com>
mailer: {
service: 'SERVICE_PROVIDER', // Gmail, SMTP
auth: {
user: 'EMAIL_ID',
pass: 'PASSWORD'
}
}
};
| Chien19861128/qa-app | config/env/development.js | JavaScript | mit | 1,201 |
package com.flowpowered.math.imaginary;
import java.io.Serializable;
import com.flowpowered.math.GenericMath;
import com.flowpowered.math.HashFunctions;
import com.flowpowered.math.TrigMath;
import com.flowpowered.math.matrix.Matrix3f;
import com.flowpowered.math.vector.Vector3f;
/**
* Represent a quaternion of the form <code>xi + yj + zk + w</code>. The x, y, z and w components are stored as floats. This class is immutable.
*/
public class Quaternionf implements Imaginaryf, Comparable<Quaternionf>, Serializable, Cloneable {
private static final long serialVersionUID = 1;
/**
* An immutable identity (0, 0, 0, 0) quaternion.
*/
public static final Quaternionf ZERO = new Quaternionf(0, 0, 0, 0);
/**
* An immutable identity (0, 0, 0, 1) quaternion.
*/
public static final Quaternionf IDENTITY = new Quaternionf(0, 0, 0, 1);
private final float x;
private final float y;
private final float z;
private final float w;
private transient volatile boolean hashed = false;
private transient volatile int hashCode = 0;
/**
* Constructs a new quaternion. The components are set to the identity (0, 0, 0, 1).
*/
public Quaternionf() {
this(0, 0, 0, 1);
}
/**
* Constructs a new quaternion from the double components.
*
* @param x The x (imaginary) component
* @param y The y (imaginary) component
* @param z The z (imaginary) component
* @param w The w (real) component
*/
public Quaternionf(double x, double y, double z, double w) {
this((float) x, (float) y, (float) z, (float) w);
}
/**
* Constructs a new quaternion from the float components.
*
* @param x The x (imaginary) component
* @param y The y (imaginary) component
* @param z The z (imaginary) component
* @param w The w (real) component
*/
public Quaternionf(float x, float y, float z, float w) {
this.x = x;
this.y = y;
this.z = z;
this.w = w;
}
/**
* Copy constructor.
*
* @param q The quaternion to copy
*/
public Quaternionf(Quaternionf q) {
this(q.x, q.y, q.z, q.w);
}
/**
* Gets the x (imaginary) component of this quaternion.
*
* @return The x (imaginary) component
*/
public float getX() {
return x;
}
/**
* Gets the y (imaginary) component of this quaternion.
*
* @return The y (imaginary) component
*/
public float getY() {
return y;
}
/**
* Gets the z (imaginary) component of this quaternion.
*
* @return The z (imaginary) component
*/
public float getZ() {
return z;
}
/**
* Gets the w (real) component of this quaternion.
*
* @return The w (real) component
*/
public float getW() {
return w;
}
/**
* Adds another quaternion to this one.
*
* @param q The quaternion to add
* @return A new quaternion, which is the sum of both
*/
public Quaternionf add(Quaternionf q) {
return add(q.x, q.y, q.z, q.w);
}
/**
* Adds the double components of another quaternion to this one.
*
* @param x The x (imaginary) component of the quaternion to add
* @param y The y (imaginary) component of the quaternion to add
* @param z The z (imaginary) component of the quaternion to add
* @param w The w (real) component of the quaternion to add
* @return A new quaternion, which is the sum of both
*/
public Quaternionf add(double x, double y, double z, double w) {
return add((float) x, (float) y, (float) z, (float) w);
}
/**
* Adds the float components of another quaternion to this one.
*
* @param x The x (imaginary) component of the quaternion to add
* @param y The y (imaginary) component of the quaternion to add
* @param z The z (imaginary) component of the quaternion to add
* @param w The w (real) component of the quaternion to add
* @return A new quaternion, which is the sum of both
*/
public Quaternionf add(float x, float y, float z, float w) {
return new Quaternionf(this.x + x, this.y + y, this.z + z, this.w + w);
}
/**
* Subtracts another quaternion from this one.
*
* @param q The quaternion to subtract
* @return A new quaternion, which is the difference of both
*/
public Quaternionf sub(Quaternionf q) {
return sub(q.x, q.y, q.z, q.w);
}
/**
* Subtracts the double components of another quaternion from this one.
*
* @param x The x (imaginary) component of the quaternion to subtract
* @param y The y (imaginary) component of the quaternion to subtract
* @param z The z (imaginary) component of the quaternion to subtract
* @param w The w (real) component of the quaternion to subtract
* @return A new quaternion, which is the difference of both
*/
public Quaternionf sub(double x, double y, double z, double w) {
return sub((float) x, (float) y, (float) z, (float) w);
}
/**
* Subtracts the float components of another quaternion from this one.
*
* @param x The x (imaginary) component of the quaternion to subtract
* @param y The y (imaginary) component of the quaternion to subtract
* @param z The z (imaginary) component of the quaternion to subtract
* @param w The w (real) component of the quaternion to subtract
* @return A new quaternion, which is the difference of both
*/
public Quaternionf sub(float x, float y, float z, float w) {
return new Quaternionf(this.x - x, this.y - y, this.z - z, this.w - w);
}
/**
* Multiplies the components of this quaternion by a double scalar.
*
* @param a The multiplication scalar
* @return A new quaternion, which has each component multiplied by the scalar
*/
public Quaternionf mul(double a) {
return mul((float) a);
}
/**
* Multiplies the components of this quaternion by a float scalar.
*
* @param a The multiplication scalar
* @return A new quaternion, which has each component multiplied by the scalar
*/
@Override
public Quaternionf mul(float a) {
return new Quaternionf(x * a, y * a, z * a, w * a);
}
/**
* Multiplies another quaternion with this one.
*
* @param q The quaternion to multiply with
* @return A new quaternion, which is the product of both
*/
public Quaternionf mul(Quaternionf q) {
return mul(q.x, q.y, q.z, q.w);
}
/**
* Multiplies the double components of another quaternion with this one.
*
* @param x The x (imaginary) component of the quaternion to multiply with
* @param y The y (imaginary) component of the quaternion to multiply with
* @param z The z (imaginary) component of the quaternion to multiply with
* @param w The w (real) component of the quaternion to multiply with
* @return A new quaternion, which is the product of both
*/
public Quaternionf mul(double x, double y, double z, double w) {
return mul((float) x, (float) y, (float) z, (float) w);
}
/**
* Multiplies the float components of another quaternion with this one.
*
* @param x The x (imaginary) component of the quaternion to multiply with
* @param y The y (imaginary) component of the quaternion to multiply with
* @param z The z (imaginary) component of the quaternion to multiply with
* @param w The w (real) component of the quaternion to multiply with
* @return A new quaternion, which is the product of both
*/
public Quaternionf mul(float x, float y, float z, float w) {
return new Quaternionf(
this.w * x + this.x * w + this.y * z - this.z * y,
this.w * y + this.y * w + this.z * x - this.x * z,
this.w * z + this.z * w + this.x * y - this.y * x,
this.w * w - this.x * x - this.y * y - this.z * z);
}
/**
* Divides the components of this quaternion by a double scalar.
*
* @param a The division scalar
* @return A new quaternion, which has each component divided by the scalar
*/
public Quaternionf div(double a) {
return div((float) a);
}
/**
* Divides the components of this quaternion by a float scalar.
*
* @param a The division scalar
* @return A new quaternion, which has each component divided by the scalar
*/
@Override
public Quaternionf div(float a) {
return new Quaternionf(x / a, y / a, z / a, w / a);
}
/**
* Divides this quaternions by another one.
*
* @param q The quaternion to divide with
* @return The quotient of the two quaternions
*/
public Quaternionf div(Quaternionf q) {
return div(q.x, q.y, q.z, q.w);
}
/**
* Divides this quaternions by the double components of another one.
*
* @param x The x (imaginary) component of the quaternion to divide with
* @param y The y (imaginary) component of the quaternion to divide with
* @param z The z (imaginary) component of the quaternion to divide with
* @param w The w (real) component of the quaternion to divide with
* @return The quotient of the two quaternions
*/
public Quaternionf div(double x, double y, double z, double w) {
return div((float) x, (float) y, (float) z, (float) w);
}
/**
* Divides this quaternions by the float components of another one.
*
* @param x The x (imaginary) component of the quaternion to divide with
* @param y The y (imaginary) component of the quaternion to divide with
* @param z The z (imaginary) component of the quaternion to divide with
* @param w The w (real) component of the quaternion to divide with
* @return The quotient of the two quaternions
*/
public Quaternionf div(float x, float y, float z, float w) {
final float d = x * x + y * y + z * z + w * w;
return new Quaternionf(
(this.x * w - this.w * x - this.z * y + this.y * z) / d,
(this.y * w + this.z * x - this.w * y - this.x * z) / d,
(this.z * w - this.y * x + this.x * y - this.w * z) / d,
(this.w * w + this.x * x + this.y * y + this.z * z) / d);
}
/**
* Returns the dot product of this quaternion with another one.
*
* @param q The quaternion to calculate the dot product with
* @return The dot product of the two quaternions
*/
public float dot(Quaternionf q) {
return dot(q.x, q.y, q.z, q.w);
}
/**
* Returns the dot product of this quaternion with the double components of another one.
*
* @param x The x (imaginary) component of the quaternion to calculate the dot product with
* @param y The y (imaginary) component of the quaternion to calculate the dot product with
* @param z The z (imaginary) component of the quaternion to calculate the dot product with
* @param w The w (real) component of the quaternion to calculate the dot product with
* @return The dot product of the two quaternions
*/
public float dot(double x, double y, double z, double w) {
return dot((float) x, (float) y, (float) z, (float) w);
}
/**
* Returns the dot product of this quaternion with the float components of another one.
*
* @param x The x (imaginary) component of the quaternion to calculate the dot product with
* @param y The y (imaginary) component of the quaternion to calculate the dot product with
* @param z The z (imaginary) component of the quaternion to calculate the dot product with
* @param w The w (real) component of the quaternion to calculate the dot product with
* @return The dot product of the two quaternions
*/
public float dot(float x, float y, float z, float w) {
return this.x * x + this.y * y + this.z * z + this.w * w;
}
/**
* Rotates a vector by this quaternion.
*
* @param v The vector to rotate
* @return The rotated vector
*/
public Vector3f rotate(Vector3f v) {
return rotate(v.getX(), v.getY(), v.getZ());
}
/**
* Rotates the double components of a vector by this quaternion.
*
* @param x The x component of the vector
* @param y The y component of the vector
* @param z The z component of the vector
* @return The rotated vector
*/
public Vector3f rotate(double x, double y, double z) {
return rotate((float) x, (float) y, (float) z);
}
/**
* Rotates the float components of a vector by this quaternion.
*
* @param x The x component of the vector
* @param y The y component of the vector
* @param z The z component of the vector
* @return The rotated vector
*/
public Vector3f rotate(float x, float y, float z) {
final float length = length();
if (Math.abs(length) < GenericMath.FLT_EPSILON) {
throw new ArithmeticException("Cannot rotate by the zero quaternion");
}
final float nx = this.x / length;
final float ny = this.y / length;
final float nz = this.z / length;
final float nw = this.w / length;
final float px = nw * x + ny * z - nz * y;
final float py = nw * y + nz * x - nx * z;
final float pz = nw * z + nx * y - ny * x;
final float pw = -nx * x - ny * y - nz * z;
return new Vector3f(
pw * -nx + px * nw - py * nz + pz * ny,
pw * -ny + py * nw - pz * nx + px * nz,
pw * -nz + pz * nw - px * ny + py * nx);
}
/**
* Returns a unit vector representing the direction of this quaternion, which is {@link Vector3f#FORWARD} rotated by this quaternion.
*
* @return The vector representing the direction this quaternion is pointing to
*/
public Vector3f getDirection() {
return rotate(Vector3f.FORWARD);
}
/**
* Returns the axis of rotation for this quaternion.
*
* @return The axis of rotation
*/
public Vector3f getAxis() {
final float q = (float) Math.sqrt(1 - w * w);
return new Vector3f(x / q, y / q, z / q);
}
/**
* Returns the angles in degrees around the x, y and z axes that correspond to the rotation represented by this quaternion.
*
* @return The angle in degrees for each axis, stored in a vector, in the corresponding component
*/
public Vector3f getAxesAnglesDeg() {
return getAxesAnglesRad().mul(TrigMath.RAD_TO_DEG);
}
/**
* Returns the angles in radians around the x, y and z axes that correspond to the rotation represented by this quaternion.
*
* @return The angle in radians for each axis, stored in a vector, in the corresponding component
*/
public Vector3f getAxesAnglesRad() {
final double roll;
final double pitch;
double yaw;
final double test = w * x - y * z;
if (Math.abs(test) < 0.4999) {
roll = TrigMath.atan2(2 * (w * z + x * y), 1 - 2 * (x * x + z * z));
pitch = TrigMath.asin(2 * test);
yaw = TrigMath.atan2(2 * (w * y + z * x), 1 - 2 * (x * x + y * y));
} else {
final int sign = (test < 0) ? -1 : 1;
roll = 0;
pitch = sign * Math.PI / 2;
yaw = -sign * 2 * TrigMath.atan2(z, w);
}
return new Vector3f(pitch, yaw, roll);
}
/**
* Conjugates the quaternion. <br> Conjugation of a quaternion <code>a</code> is an operation returning quaternion <code>a'</code> such that <code>a' * a = a * a' = |a|<sup>2</sup></code> where
* <code>|a|<sup>2<sup/></code> is squared length of <code>a</code>.
*
* @return the conjugated quaternion
*/
@Override
public Quaternionf conjugate() {
return new Quaternionf(-x, -y, -z, w);
}
/**
* Inverts the quaternion. <br> Inversion of a quaternion <code>a</code> returns quaternion <code>a<sup>-1</sup> = a' / |a|<sup>2</sup></code> where <code>a'</code> is {@link #conjugate()
* conjugation} of <code>a</code>, and <code>|a|<sup>2</sup></code> is squared length of <code>a</code>. <br> For any quaternions <code>a, b, c</code>, such that <code>a * b = c</code> equations
* <code>a<sup>-1</sup> * c = b</code> and <code>c * b<sup>-1</sup> = a</code> are true.
*
* @return the inverted quaternion
*/
@Override
public Quaternionf invert() {
final float lengthSquared = lengthSquared();
if (Math.abs(lengthSquared) < GenericMath.FLT_EPSILON) {
throw new ArithmeticException("Cannot invert a quaternion of length zero");
}
return conjugate().div(lengthSquared);
}
/**
* Returns the square of the length of this quaternion.
*
* @return The square of the length
*/
@Override
public float lengthSquared() {
return x * x + y * y + z * z + w * w;
}
/**
* Returns the length of this quaternion.
*
* @return The length
*/
@Override
public float length() {
return (float) Math.sqrt(lengthSquared());
}
/**
* Normalizes this quaternion.
*
* @return A new quaternion of unit length
*/
@Override
public Quaternionf normalize() {
final float length = length();
if (Math.abs(length) < GenericMath.FLT_EPSILON) {
throw new ArithmeticException("Cannot normalize the zero quaternion");
}
return new Quaternionf(x / length, y / length, z / length, w / length);
}
/**
* Converts this quaternion to a complex by extracting the rotation around
* the axis and returning it as a rotation in the plane perpendicular to the
* rotation axis.
*
* @return The rotation without the axis as a complex
*/
public Complexf toComplex() {
final float w2 = w * w;
return new Complexf(2 * w2 - 1, 2 * w * (float) Math.sqrt(1 - w2));
}
@Override
public Quaternionf toFloat() {
return new Quaternionf(x, y, z, w);
}
@Override
public Quaterniond toDouble() {
return new Quaterniond(x, y, z, w);
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Quaternionf)) {
return false;
}
final Quaternionf quaternion = (Quaternionf) o;
if (Float.compare(quaternion.w, w) != 0) {
return false;
}
if (Float.compare(quaternion.x, x) != 0) {
return false;
}
if (Float.compare(quaternion.y, y) != 0) {
return false;
}
if (Float.compare(quaternion.z, z) != 0) {
return false;
}
return true;
}
@Override
public int hashCode() {
if (!hashed) {
int result = (x != +0.0f ? HashFunctions.hash(x) : 0);
result = 31 * result + (y != +0.0f ? HashFunctions.hash(y) : 0);
result = 31 * result + (z != +0.0f ? HashFunctions.hash(z) : 0);
hashCode = 31 * result + (w != +0.0f ? HashFunctions.hash(w) : 0);
hashed = true;
}
return hashCode;
}
@Override
public int compareTo(Quaternionf q) {
return (int) Math.signum(lengthSquared() - q.lengthSquared());
}
@Override
public Quaternionf clone() {
return new Quaternionf(this);
}
@Override
public String toString() {
return "(" + x + ", " + y + ", " + z + ", " + w + ")";
}
/**
* Creates a new quaternion from the double angles in degrees around the x, y and z axes.
*
* @param pitch The rotation around x
* @param yaw The rotation around y
* @param roll The rotation around z
* @return The quaternion defined by the rotations around the axes
*/
public static Quaternionf fromAxesAnglesDeg(double pitch, double yaw, double roll) {
return fromAxesAnglesDeg((float) pitch, (float) yaw, (float) roll);
}
/**
* Creates a new quaternion from the double angles in radians around the x, y and z axes.
*
* @param pitch The rotation around x
* @param yaw The rotation around y
* @param roll The rotation around z
* @return The quaternion defined by the rotations around the axes
*/
public static Quaternionf fromAxesAnglesRad(double pitch, double yaw, double roll) {
return fromAxesAnglesRad((float) pitch, (float) yaw, (float) roll);
}
/**
* Creates a new quaternion from the float angles in degrees around the x, y and z axes.
*
* @param pitch The rotation around x
* @param yaw The rotation around y
* @param roll The rotation around z
* @return The quaternion defined by the rotations around the axes
*/
public static Quaternionf fromAxesAnglesDeg(float pitch, float yaw, float roll) {
return Quaternionf.fromAngleDegAxis(yaw, Vector3f.UNIT_Y).
mul(Quaternionf.fromAngleDegAxis(pitch, Vector3f.UNIT_X)).
mul(Quaternionf.fromAngleDegAxis(roll, Vector3f.UNIT_Z));
}
/**
* Creates a new quaternion from the float angles in radians around the x, y and z axes.
*
* @param pitch The rotation around x
* @param yaw The rotation around y
* @param roll The rotation around z
* @return The quaternion defined by the rotations around the axes
*/
public static Quaternionf fromAxesAnglesRad(float pitch, float yaw, float roll) {
return Quaternionf.fromAngleRadAxis(yaw, Vector3f.UNIT_Y).
mul(Quaternionf.fromAngleRadAxis(pitch, Vector3f.UNIT_X)).
mul(Quaternionf.fromAngleRadAxis(roll, Vector3f.UNIT_Z));
}
/**
* Creates a new quaternion from the angle-axis rotation defined from the first to the second vector.
*
* @param from The first vector
* @param to The second vector
* @return The quaternion defined by the angle-axis rotation between the vectors
*/
public static Quaternionf fromRotationTo(Vector3f from, Vector3f to) {
return Quaternionf.fromAngleRadAxis(TrigMath.acos(from.dot(to) / (from.length() * to.length())), from.cross(to));
}
/**
* Creates a new quaternion from the rotation double angle in degrees around the axis vector.
*
* @param angle The rotation angle in degrees
* @param axis The axis of rotation
* @return The quaternion defined by the rotation around the axis
*/
public static Quaternionf fromAngleDegAxis(double angle, Vector3f axis) {
return fromAngleRadAxis(Math.toRadians(angle), axis);
}
/**
* Creates a new quaternion from the rotation double angle in radians around the axis vector.
*
* @param angle The rotation angle in radians
* @param axis The axis of rotation
* @return The quaternion defined by the rotation around the axis
*/
public static Quaternionf fromAngleRadAxis(double angle, Vector3f axis) {
return fromAngleRadAxis((float) angle, axis);
}
/**
* Creates a new quaternion from the rotation float angle in degrees around the axis vector.
*
* @param angle The rotation angle in degrees
* @param axis The axis of rotation
* @return The quaternion defined by the rotation around the axis
*/
public static Quaternionf fromAngleDegAxis(float angle, Vector3f axis) {
return fromAngleRadAxis((float) Math.toRadians(angle), axis);
}
/**
* Creates a new quaternion from the rotation float angle in radians around the axis vector.
*
* @param angle The rotation angle in radians
* @param axis The axis of rotation
* @return The quaternion defined by the rotation around the axis
*/
public static Quaternionf fromAngleRadAxis(float angle, Vector3f axis) {
return fromAngleRadAxis(angle, axis.getX(), axis.getY(), axis.getZ());
}
/**
* Creates a new quaternion from the rotation double angle in degrees around the axis vector double components.
*
* @param angle The rotation angle in degrees
* @param x The x component of the axis vector
* @param y The y component of the axis vector
* @param z The z component of the axis vector
* @return The quaternion defined by the rotation around the axis
*/
public static Quaternionf fromAngleDegAxis(double angle, double x, double y, double z) {
return fromAngleRadAxis(Math.toRadians(angle), x, y, z);
}
/**
* Creates a new quaternion from the rotation double angle in radians around the axis vector double components.
*
* @param angle The rotation angle in radians
* @param x The x component of the axis vector
* @param y The y component of the axis vector
* @param z The z component of the axis vector
* @return The quaternion defined by the rotation around the axis
*/
public static Quaternionf fromAngleRadAxis(double angle, double x, double y, double z) {
return fromAngleRadAxis((float) angle, (float) x, (float) y, (float) z);
}
/**
* Creates a new quaternion from the rotation float angle in degrees around the axis vector float components.
*
* @param angle The rotation angle in degrees
* @param x The x component of the axis vector
* @param y The y component of the axis vector
* @param z The z component of the axis vector
* @return The quaternion defined by the rotation around the axis
*/
public static Quaternionf fromAngleDegAxis(float angle, float x, float y, float z) {
return fromAngleRadAxis((float) Math.toRadians(angle), x, y, z);
}
/**
* Creates a new quaternion from the rotation float angle in radians around the axis vector float components.
*
* @param angle The rotation angle in radians
* @param x The x component of the axis vector
* @param y The y component of the axis vector
* @param z The z component of the axis vector
* @return The quaternion defined by the rotation around the axis
*/
public static Quaternionf fromAngleRadAxis(float angle, float x, float y, float z) {
final float halfAngle = angle / 2;
final float q = TrigMath.sin(halfAngle) / (float) Math.sqrt(x * x + y * y + z * z);
return new Quaternionf(x * q, y * q, z * q, TrigMath.cos(halfAngle));
}
/**
* Creates a new quaternion from the rotation matrix. The matrix will be interpreted as a rotation matrix even if it is not.
*
* @param matrix The rotation matrix
* @return The quaternion defined by the rotation matrix
*/
public static Quaternionf fromRotationMatrix(Matrix3f matrix) {
final float trace = matrix.trace();
if (trace < 0) {
if (matrix.get(1, 1) > matrix.get(0, 0)) {
if (matrix.get(2, 2) > matrix.get(1, 1)) {
final float r = (float) Math.sqrt(matrix.get(2, 2) - matrix.get(0, 0) - matrix.get(1, 1) + 1);
final float s = 0.5f / r;
return new Quaternionf(
(matrix.get(2, 0) + matrix.get(0, 2)) * s,
(matrix.get(1, 2) + matrix.get(2, 1)) * s,
0.5f * r,
(matrix.get(1, 0) - matrix.get(0, 1)) * s);
} else {
final float r = (float) Math.sqrt(matrix.get(1, 1) - matrix.get(2, 2) - matrix.get(0, 0) + 1);
final float s = 0.5f / r;
return new Quaternionf(
(matrix.get(0, 1) + matrix.get(1, 0)) * s,
0.5f * r,
(matrix.get(1, 2) + matrix.get(2, 1)) * s,
(matrix.get(0, 2) - matrix.get(2, 0)) * s);
}
} else if (matrix.get(2, 2) > matrix.get(0, 0)) {
final float r = (float) Math.sqrt(matrix.get(2, 2) - matrix.get(0, 0) - matrix.get(1, 1) + 1);
final float s = 0.5f / r;
return new Quaternionf(
(matrix.get(2, 0) + matrix.get(0, 2)) * s,
(matrix.get(1, 2) + matrix.get(2, 1)) * s,
0.5f * r,
(matrix.get(1, 0) - matrix.get(0, 1)) * s);
} else {
final float r = (float) Math.sqrt(matrix.get(0, 0) - matrix.get(1, 1) - matrix.get(2, 2) + 1);
final float s = 0.5f / r;
return new Quaternionf(
0.5f * r,
(matrix.get(0, 1) + matrix.get(1, 0)) * s,
(matrix.get(2, 0) - matrix.get(0, 2)) * s,
(matrix.get(2, 1) - matrix.get(1, 2)) * s);
}
} else {
final float r = (float) Math.sqrt(trace + 1);
final float s = 0.5f / r;
return new Quaternionf(
(matrix.get(2, 1) - matrix.get(1, 2)) * s,
(matrix.get(0, 2) - matrix.get(2, 0)) * s,
(matrix.get(1, 0) - matrix.get(0, 1)) * s,
0.5f * r);
}
}
}
| DragonSphereZ/DragonSphereZ | src/com/flowpowered/math/imaginary/Quaternionf.java | Java | mit | 29,581 |
//
// kit.cpp
// Neo4j-cpp-driver
//
// Created by skyblue on 2017/7/9.
// Copyright © 2017年 skyblue. All rights reserved.
//
#include "kit.hpp"
#include <sstream>
namespace neo4jDriver
{
//Neo4j工具包
std::string Kit::getStatusCode(std::string httpHeader)
{
size_t begin = httpHeader.find_first_of(" ");
std::string temp = httpHeader.substr(begin+1, httpHeader.length());
size_t end = temp.find_first_of(" ");
std::string statusCode = temp.substr(0, end);
return statusCode;
};
std::string Kit::getWhereString(std::string fieldName, Json::Value &properties, std::string idFieldName)
{
return Kit::append(fieldName, properties, " AND ", idFieldName);
};
std::string Kit::getWhereString(std::string fieldName, std::string propertiesNamePrefix, Json::Value &properties, std::string idFieldName)
{
return Kit::append(fieldName, propertiesNamePrefix, properties, " AND ", idFieldName);
};
std::string Kit::getSetString(std::string fieldName, Json::Value &properties)
{
return Kit::append(fieldName, properties, ",");
};
std::string Kit::getLabelString(const std::vector<std::string> &labels)
{
std::string labelsString = "";
for (int i=0; i < labels.size(); i++)
{
if (i+1 < labels.size())
{
labelsString += labels[i] + ":";
}
else
{
labelsString += labels[i];
}
}
return labelsString;
};
unsigned long long int Kit::getNodeOrRelationshipID(std::string nodeOrRelationshipSelf)
{
size_t id;
size_t begin = nodeOrRelationshipSelf.find_last_of("/");
std::string idString = nodeOrRelationshipSelf.substr(begin + 1, nodeOrRelationshipSelf.length());
std::stringstream sstream;
sstream << idString;
sstream >> id;
sstream.clear();
return id;
};
/*
* 私有方法
*/
std::string Kit::append(std::string fieldName, Json::Value &properties, std::string appendToken, std::string idFieldName)
{
std::string parameters = "";
bool isFirst = true;
for (Json::ValueIterator i = properties.begin(); i != properties.end(); i++)
{
if (isFirst)
{
if (idFieldName == "" || (idFieldName != "" && i.name() != idFieldName))
{
parameters += fieldName + "." + i.name() + "={" + i.name() + "}";
}
else
{
parameters += "id(" + fieldName + ")={" + i.name() + "}";
}
isFirst = false;
}
else
{
if (idFieldName == "" || (idFieldName != "" && i.name() != idFieldName))
{
parameters += appendToken + fieldName + "." + i.name() + "={" + i.name() + "}";
}
else
{
parameters += appendToken + "id(" + fieldName + ")={" + i.name() + "}";
}
}
}
return parameters;
};
std::string Kit::append(std::string fieldName, std::string propertiesNamePrefix, Json::Value &properties, std::string appendToken, std::string idFieldName)
{
std::string parameters = "";
bool isFirst = true;
for (Json::ValueIterator i = properties.begin(); i != properties.end(); i++)
{
if (isFirst)
{
if (idFieldName == "" || (idFieldName != "" && i.name() != idFieldName))
{
parameters += fieldName + "." + i.name() + "={" + propertiesNamePrefix + i.name() + "}";
}
else
{
parameters += "id(" + fieldName + ")={" + propertiesNamePrefix + i.name() + "}";
}
isFirst = false;
}
else
{
if (idFieldName == "" || (idFieldName != "" && i.name() != idFieldName))
{
parameters += appendToken + fieldName + "." + i.name() + "={" + propertiesNamePrefix + i.name() + "}";
}
else
{
parameters += appendToken + "id(" + fieldName + ")={" + propertiesNamePrefix + i.name() + "}";
}
}
}
return parameters;
};
}
| skybluezx/Neo4j-cpp-driver | kit.cpp | C++ | mit | 4,696 |
// Based on original code by Tim Kientzle, March 2009.
#include <util.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <boost/filesystem.hpp>
/* Parse an octal number, ignoring leading and trailing nonsense. */
static int
parseoct(const char *p, size_t n)
{
int i = 0;
while ((*p < '0' || *p > '7') && n > 0) {
++p;
--n;
}
while (*p >= '0' && *p <= '7' && n > 0) {
i *= 8;
i += *p - '0';
++p;
--n;
}
return (i);
}
/* Returns true if this is 512 zero bytes. */
static int
is_end_of_archive(const char *p)
{
int n;
for (n = 511; n >= 0; --n)
if (p[n] != '\0')
return (0);
return (1);
}
/* Create a directory, including parent directories as necessary. */
static void
create_dir(const char *pathname, int mode)
{
std::string sFile = (GetDataDir(true) / pathname).string();
fprintf(stdout, "[UNTAR] Creating folder %s\n", sFile.c_str());
boost::filesystem::path p = sFile;
boost::filesystem::create_directories(p);
}
/* Create a file, including parent directory as necessary. */
static FILE *
create_file(char *pathname, int mode)
{
FILE *f;
std::string sFile = (GetDataDir(true) / pathname).string();
f = fopen(sFile.c_str(), "wb+");
fprintf(stdout, "[UNTAR] Creating file %s\n", sFile.c_str());
if (f == nullptr) {
/* Try creating parent dir and then creating file. */
char *p = strrchr(pathname, '/');
if (p != nullptr) {
*p = '\0';
create_dir(pathname, 0755);
*p = '/';
f = fopen(sFile.c_str(), "wb+");
}
}
return (f);
}
/* Verify the tar checksum. */
static int
verify_checksum(const char *p)
{
int n, u = 0;
for (n = 0; n < 512; ++n) {
if (n < 148 || n > 155)
/* Standard tar checksum adds unsigned bytes. */
u += ((unsigned char *)p)[n];
else
u += 0x20;
}
return (u == parseoct(p + 148, 8));
}
/* Extract a tar archive. */
bool
untar(FILE *a, const char *path)
{
char buff[512];
FILE *f = nullptr;
size_t bytes_read;
int filesize;
fprintf(stdout, "[UNTAR] Extracting from %s\n", path);
for (;;) {
bytes_read = fread(buff, 1, 512, a);
if (bytes_read < 512) {
fprintf(stderr, "[UNTAR] Short read on %s: expected 512, got %d\n",
path, (int)bytes_read);
return false;
}
if (is_end_of_archive(buff)) {
return true;
}
if (!verify_checksum(buff)) {
fprintf(stderr, "[UNTAR] Checksum failure\n");
return false;
}
filesize = parseoct(buff + 124, 12);
switch (buff[156]) {
case '1':
// Ignoring hardlink
break;
case '2':
// Ignoring symlink
break;
case '3':
// Ignoring character device
break;
case '4':
// Ignoring block device
break;
case '5':
// Extracting dir
create_dir(buff, parseoct(buff + 100, 8));
filesize = 0;
break;
case '6':
// Ignoring FIFO
break;
default:
// Extracting file
if(!strcmp(buff, "wallet.dat")) {
fprintf(stderr, "[UNTAR] Wrong bootstrap, it includes a wallet.dat file\n");
} else {
f = create_file(buff, parseoct(buff + 100, 8));
}
break;
}
while (filesize > 0) {
bytes_read = fread(buff, 1, 512, a);
if (bytes_read < 512) {
fprintf(stderr, "[UNTAR] Short read on %s: Expected 512, got %d\n",
path, (int)bytes_read);
return false;
}
if (filesize < 512)
bytes_read = filesize;
if (f != nullptr) {
if (fwrite(buff, 1, bytes_read, f)
!= bytes_read)
{
fprintf(stderr, "[UNTAR] Failed write\n");
fclose(f);
f = nullptr;
return false;
}
}
filesize -= bytes_read;
}
if (f != nullptr) {
fclose(f);
f = nullptr;
}
}
return true;
}
| navcoindev/navcoin-core | src/untar.cpp | C++ | mit | 4,450 |
package al.artofsoul.data;
import java.util.concurrent.CopyOnWriteArrayList;
public class TowerIce extends Tower {
public TowerIce(TowerType type, Pllaka filloPllaka, CopyOnWriteArrayList<Armiku> armiqt) {
super(type, filloPllaka, armiqt);
}
@Override
public void shoot (Armiku target) {
super.projectiles.add(new ProjectileIceball(super.type.projectileType, super.target, super.getX(), super.getY(), 32, 32));
}
}
| tonikolaba/MrTower | src/al/artofsoul/data/TowerIce.java | Java | mit | 429 |
""" TODO: Add docstring """
import re
import pexpect
class MediaObject(object):
"""Represents an encodable object"""
def __init__(self, input_filename, output_filename):
self.input_filename = input_filename
self.output_filename = output_filename
self.media_duration = self.get_media_duration()
# INFO: All other media information could potentially be put here too
def get_media_duration(self):
"""
Spawns an avprobe process to get the media duration.
Spawns an avprobe process and saves the output to a list, then uses
regex to find the duration of the media and return it as an integer.
"""
info_process = pexpect.spawn("/usr/bin/avprobe " + self.input_filename)
subprocess_output = info_process.readlines()
info_process.close
# Non-greedy match on characters 'Duration: ' followed by
# number in form 00:00:00:00
regex_group = re.compile(".*?Duration: .*?(\\d+):(\\d+):(\\d+).(\\d+)",
re.IGNORECASE | re.DOTALL)
# Exits as soon as duration is found
# PERF: Perform some tests to find the min number of lines
# certain not to contain the duration, then operate on a slice
# not containing those lines
for line in subprocess_output:
regex_match = regex_group.search(line)
if regex_match:
# Return the total duration in seconds
return ((int(regex_match.group(1)) * 3600) + # Hours
(int(regex_match.group(2)) * 60) + # Minutes
int(regex_match.group(3)) + # Seconds
# Round milliseconds to nearest second
1 if int(regex_match.group(3)) > 50 else 0)
# Not found so it's possible the process terminated early or an update
# broke the regex. Unlikely but we must return something just in case.
return -1
| thethomaseffect/travers-media-tools | traversme/encoder/media_object.py | Python | mit | 2,000 |
module.exports = function ( grunt ) {
grunt.initConfig( {
pkg: grunt.file.readJSON( 'package.json' ),
banner: '/*!\n' +
'* <%= pkg.name %> v<%= pkg.version %> - <%= pkg.description %>\n' +
'* Copyright (c) <%= grunt.template.today(\'yyyy\') %> <%= pkg.author %>. All rights reserved.\n' +
'* Licensed under <%= pkg.license %> License.\n' +
'*/',
connect: {
docs: {
options: {
protocol: 'http',
port: 8080,
hostname: 'localhost',
livereload: true,
base: {
path: 'docs/',
options: {
index: 'index.htm'
}
},
open: 'http://localhost:8080/index.htm'
}
}
},
sass: {
docs: {
options: {
style: 'expanded'
},
files: {
'dist/autoc.css': 'src/sass/autoc.scss',
'docs/css/layout.css': 'sass/layout.scss'
}
}
},
csslint: {
docs: {
options: {
'bulletproof-font-face': false,
'order-alphabetical': false,
'box-model': false,
'vendor-prefix': false,
'known-properties': false
},
src: [
'dist/autoc.css',
'docs/css/layout.css'
]
}
},
cssmin: {
dist: {
files: {
'dist/autoc.min.css': [
'dist/autoc.css'
]
}
},
docs: {
files: {
'docs/css/layout.min.css': [
'node_modules/normalize.css/normalize.css',
'docs/css/layout.css',
'dist/autoc.css'
]
}
}
},
jshint: {
src: {
options: {
jshintrc: '.jshintrc'
},
src: [
'src/**/*.js'
],
filter: 'isFile'
}
},
uglify: {
options: {
banner: '<%= banner %>'
},
docs: {
files: {
'docs/js/autoc.min.js': [
'src/autoc.js'
]
}
},
dist: {
files: {
'dist/autoc.min.js': [
'src/autoc.js'
]
}
}
},
copy: {
docs: {
files: [
{
'docs/js/jquery.js': 'node_modules/jquery/dist/jquery.js'
}
]
},
dist: {
files: [
{
'dist/autoc.js': 'src/autoc.js'
}
]
}
},
pug: {
docs: {
options: {
pretty: true,
data: {
debug: true
}
},
files: {
// create api home page
'docs/index.htm': 'pug/api/index.pug'
}
}
},
watch: {
css: {
files: [
'sass/**/**.scss'
],
tasks: [
'sass',
'csslint',
'cssmin'
]
},
js: {
files: [
'src/**/*.js'
],
tasks: [
'jshint:src',
'uglify',
'copy:docs'
]
},
pug: {
files: [
'pug/**/**.pug'
],
tasks: [
'pug:docs'
]
},
docs: {
files: [
'docs/**/**.html',
'docs/**/**.js',
'docs/**/**.css'
],
options: {
livereload: true
}
}
}
} );
grunt.loadNpmTasks( 'grunt-contrib-connect' );
grunt.loadNpmTasks( 'grunt-contrib-copy' );
grunt.loadNpmTasks( 'grunt-contrib-sass' );
grunt.loadNpmTasks( 'grunt-contrib-csslint' );
grunt.loadNpmTasks( 'grunt-contrib-cssmin' );
grunt.loadNpmTasks( 'grunt-contrib-jshint' );
grunt.loadNpmTasks( 'grunt-contrib-uglify' );
grunt.loadNpmTasks( 'grunt-contrib-pug' );
grunt.loadNpmTasks( 'grunt-contrib-watch' );
grunt.registerTask( 'html', [ 'pug' ] );
grunt.registerTask( 'http', [
'connect:docs',
'watch'
] );
grunt.registerTask( 'hint', [ 'jshint:src' ] );
grunt.registerTask( 'scripts', [
'jshint',
'uglify',
'copy'
] );
grunt.registerTask( 'styles', [
'sass',
'csslint',
'cssmin'
] );
grunt.registerTask( 'default', [
'connect:docs',
'sass',
'csslint',
'cssmin',
'jshint:src',
'uglify',
'copy',
'pug',
'watch'
] );
}; | yaohaixiao/AutocJS | Gruntfile.js | JavaScript | mit | 5,753 |
import random
import musictheory
import filezart
import math
from pydub import AudioSegment
from pydub.playback import play
class Part:
def __init__(self, typ=None, intensity=0, size=0, gen=0, cho=0):
self._type = typ #"n1", "n2", "bg", "ch", "ge"
if intensity<0 or gen<0 or cho<0 or size<0 or intensity>1 or size>1 or gen>1 or cho>1:
raise ValueError ("Invalid Values for Structure Part")
self._intensity = intensity # [0-1]
self._size = size # [0-1]
self._genover = gen # [0-1] overlay of general type lines
self._chover = cho # [0-1] overlay of chorus type lines
def __repr__(self):
return "[" + self._type + "-" + str(self._intensity) + "-" + str(self._size) + "-" + str(self._genover) + "-" + str(self._chover) + "]"
@classmethod
def fromString(cls, string): # [n1-0.123-1-0.321-0.2] type, intensity, size, genoverlay, chooverlay
while string[0] == " ":
string = string[1:]
while string[0] == "\n":
string = string[1:]
while string[-1] == " ":
string = string[:-1]
while string[-1] == "\0":
string = string[:-1]
while string[-1] == "\n":
string = string[:-1]
if len(string)<8:
raise ValueError("Invalid Part string: "+string)
if string[0] == "[" and string[-1] == "]":
string = string[1:-1]
else:
raise ValueError("Invalid Part string: "+string)
typ = string[:2]
string = string[3:]
if not typ in ("n1", "n2", "bg", "ch", "ge"):
raise ValueError("Invalid Part Type string: "+typ)
valstrings = str.split(string, "-")
inten = eval(valstrings[0])
size = eval(valstrings[1])
gen = eval(valstrings[2])
cho = eval(valstrings[3])
return cls(typ, inten, size, gen, cho)
def getTheme(self, pal):
if self._type == "n1":
return pal._n1
if self._type == "n2":
return pal._n2
if self._type == "bg":
return pal._bg
if self._type == "ch":
return pal._ch
if self._type == "ge":
return pal._ge
def getAudio(self, pal, bpm):
base = self.baseDur(pal, bpm)
total = base + 3000 #extra time for last note to play
nvoic = math.ceil(self._intensity * self.getTheme(pal).countVoices())
try:
ngeno = math.ceil(self._genover * pal._ge.countVoices())
except:
ngeno = 0
try:
nchoo = math.ceil(self._chover * pal._ch.countVoices())
except:
nchoo = 0
sound = AudioSegment.silent(total)
them = self.getTheme(pal)
for i in range(nvoic):
voic = them._sorting[i].getVoice(them)
print(them._sorting[i].indicationStr(them)) #DEBUG !!
vsound = voic.partialAudio(self._size, bpm)
sound = sound.overlay(vsound)
them = pal._ge
for i in range(ngeno):
voic = them._sorting[i].getVoice(them)
print(them._sorting[i].indicationStr(them)) #DEBUG !!
vsound = voic.partialAudio(self._size, bpm)
sound = sound.overlay(vsound)
them = pal._ch
for i in range(nchoo):
voic = them._sorting[i].getVoice(them)
print(them._sorting[i].indicationStr(them)) #DEBUG !!
vsound = voic.partialAudio(self._size, bpm)
sound = sound.overlay(vsound)
return sound
def baseDur(self, pal, bpm): #get the base duration of this part of the song
return self.getTheme(pal).baseDurForStruct(self._size, bpm)
class Structure:
def __init__(self):
self._parts = ()
def add(self, part):
self._parts = self._parts+(part,)
def __repr__(self):
return "@STRUCTURE:" + str(self._parts)
def baseDur(self, pal, bpm=None):
if bpm == None:
bpm = pal._bpm
curTime = 0
for p in self._parts:
curTime = curTime + p.baseDur(pal, bpm)
return curTime
def songAudio(self, pal, bpm=None):
if bpm == None:
bpm = pal._bpm
total = self.baseDur(pal, bpm) + 3000 # 3 seconds for last note to play
sound = AudioSegment.silent(total)
curTime = 0
for p in self._parts:
paudio = p.getAudio(pal, bpm)
sound = sound.overlay(paudio, curTime)
curTime = curTime + p.baseDur(pal, bpm)
print("curTime:",curTime)
return sound
# wselect WeightedSelect returns element of dictionary based on dict weights {element:weight}
def wselect(dicti):
total=0
for i in list(dicti):
total = total + dicti[i]
indice = total*random.random()
for i in list(dicti):
if dicti[i]>=indice:
return i
indice = indice - dicti[i]
raise ValueError ("something went wrong")
# rselect RandomSelect returns random element of list
def rselect(lista):
return random.choice(lista)
def lenweights():
return {3:1, 4:1, 5:2, 6:3, 7:4, 8:3, 9:2, 10:1, 11:1}
def stweights():
return {"n1":5, "n2":4, "ch":2, "bg":1}
def n1weights():
return {"n1":4, "n2":2, "ch":3, "bg":1}
def n2weights():
return {"n1":2, "n2":3, "ch":4, "bg":2}
def chweights():
return {"n1":2, "n2":1, "ch":4, "bg":1}
def bgweights():
return {"n1":1, "n2":1, "ch":20, "bg":8}
def typeSequence(size):
last = wselect(stweights())
sequence=(last,)
while len(sequence)<size:
if last == "n1":
last = wselect(n1weights())
elif last == "n2":
last = wselect(n2weights())
elif last == "ch":
last = wselect(chweights())
elif last == "bg":
last = wselect(bgweights())
sequence = sequence + (last,)
return sequence
def siweights():
return {0.1:1, 0.2:2, 0.3:4, 0.4:5, 0.5:5, 0.6:4, 0.7:3, 0.8:2, 0.9:1}
def deltaweights():
return {-0.3:1, -0.2:1, -0.1:1, 0:5, 0.1:3, 0.2:2, 0.3:2}
def intensitySequence(size):
val = wselect(siweights())
sequence = (val,)
while len(sequence)<size:
val = val + wselect(deltaweights())
if val<0.1:
val = 0.1
if val>1:
val = 1
sequence = sequence + (val,)
return sequence
def soweights():
return {0:6, 0.1:2, 0.2:1}
def deltoweights():
return {-0.2:1, -0.1:1, 0:8, 0.1:2, 0.2:2}
def overlaySequence(size):
val = wselect(soweights())
sequence = (val,)
while len(sequence)<size:
val = val + wselect(deltoweights())
if val<0.1:
val = 0.1
if val>1:
val = 1
sequence = sequence + (val,)
return sequence
def ssweights():
return {0.2:1, 0.4:1, 0.6:1, 0.8:1, 1:16}
def sizeSequence(size):
sequence = ()
while len(sequence)<size:
sequence = sequence + (wselect(ssweights()),)
return sequence
def makeStruct(size = None):
if size == None:
size = wselect(lenweights())
types = typeSequence(size)
inten = intensitySequence(size)
sizes = sizeSequence(size)
overl = overlaySequence(size)
return joinSeqs(types, inten, sizes, overl)
def joinSeqs(types, inten, sizes, overl):
struct = Structure()
for i in range(len(types)):
if types[i]=="bg":
string = "["+types[i]+"-"+str(inten[i])+"-"+str(sizes[i])+"-"+"0"+"-"+str(overl[i])+"]" # If its a bridge it has chord overlay
pt = Part.fromString(string)
struct.add(pt)
else:
string = "["+types[i]+"-"+str(inten[i])+"-"+str(sizes[i])+"-"+str(overl[i])+"-"+"0"+"]" # Else it has gen overlay
pt = Part.fromString(string)
struct.add(pt)
return struct
def pooptest():
for i in range(30):
print(makeStruct())
| joaoperfig/mikezart | source/markovzart2.py | Python | mit | 8,058 |
/*
setInterval(function() {
console.log(document.activeElement);
}, 1000);
*/
/*
* Notes regarding app state/modes, activeElements, focusing etc.
* ==============================================================
*
* 1) There is always exactly one item selected. All executed commands
* operate on this item.
*
* 2) The app distinguishes three modes with respect to focus:
* 2a) One of the UI panes has focus (inputs, buttons, selects).
* Keyboard shortcuts are disabled.
* 2b) Current item is being edited. It is contentEditable and focused.
* Blurring ends the edit mode.
* 2c) ELSE the Clipboard is focused (its invisible textarea)
*
* In 2a, we try to lose focus as soon as possible
* (after clicking, after changing select's value), switching to 2c.
*
* 3) Editing mode (2b) can be ended by multiple ways:
* 3a) By calling current.stopEditing();
* this shall be followed by some resolution.
* 3b) By executing MM.Command.{Finish,Cancel};
* these call 3a internally.
* 3c) By blurring the item itself (by selecting another);
* this calls MM.Command.Finish (3b).
* 3b) By blurring the currentElement;
* this calls MM.Command.Finish (3b).
*
*/
MM.App = {
keyboard: null,
current: null,
editing: false,
history: [],
historyIndex: 0,
portSize: [0, 0],
map: null,
ui: null,
io: null,
help: null,
_port: null,
_throbber: null,
_drag: {
pos: [0, 0],
item: null,
ghost: null
},
_fontSize: 100,
action: function(action) {
if (this.historyIndex < this.history.length) { /* remove undoed actions */
this.history.splice(this.historyIndex, this.history.length-this.historyIndex);
}
this.history.push(action);
this.historyIndex++;
action.perform();
return this;
},
setMap: function(map) {
if (this.map) { this.map.hide(); }
this.history = [];
this.historyIndex = 0;
this.map = map;
this.map.show(this._port);
},
select: function(item) {
if (this.current && this.current != item) { this.current.deselect(); }
this.current = item;
this.current.select();
},
adjustFontSize: function(diff) {
this._fontSize = Math.max(30, this._fontSize + 10*diff);
this._port.style.fontSize = this._fontSize + "%";
this.map.update();
this.map.ensureItemVisibility(this.current);
},
handleMessage: function(message, publisher) {
switch (message) {
case "ui-change":
this._syncPort();
break;
case "item-change":
if (publisher.isRoot() && publisher.getMap() == this.map) {
document.title = this.map.getName() + " :: 启示工作室";
}
break;
}
},
handleEvent: function(e) {
switch (e.type) {
case "resize":
this._syncPort();
break;
case "beforeunload":
e.preventDefault();
return "";
break;
}
},
setThrobber: function(visible) {
this._throbber.classList[visible ? "add" : "remove"]("visible");
},
init: function() {
this._port = document.querySelector("#port");
this._throbber = document.querySelector("#throbber");
this.ui = new MM.UI();
this.io = new MM.UI.IO();
this.help = new MM.UI.Help();
MM.Tip.init();
MM.Keyboard.init();
MM.Menu.init(this._port);
MM.Mouse.init(this._port);
MM.Clipboard.init();
window.addEventListener("resize", this);
window.addEventListener("beforeunload", this);
MM.subscribe("ui-change", this);
MM.subscribe("item-change", this);
this._syncPort();
this.setMap(new MM.Map());
},
_syncPort: function() {
this.portSize = [window.innerWidth - this.ui.getWidth(), window.innerHeight];
this._port.style.width = this.portSize[0] + "px";
this._port.style.height = this.portSize[1] + "px";
this._throbber.style.right = (20 + this.ui.getWidth())+ "px";
if (this.map) { this.map.ensureItemVisibility(this.current); }
}
}
| sysuzhang/my-mind | src/app.js | JavaScript | mit | 3,807 |
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class MenuSettingController extends MY_Controller {
public function __construct(){
parent ::__construct();
$this->is_logged_in();
$this->load->model('menuDao');
}
public function index(){
$menus = $this->menuDao->getAllMenu();
$treeMenu = $this->buildTreeMenu($menus);
print_r(json_encode($treeMenu));
die;
$data = array(
'title' => 'Menu Setting | DidikH',
'username' => $userSession[0]->ID,
'generatedMenuHtml' => $this->session->userdata('generatedMenuHtml')
);
$this->template->load('dashboard', 'menu-setting', $data);
}
private function buildTreeMenu($menus){
$menuArr = array();
$idx = 0;
foreach($menus as $menu){
if($menu->parentId() == 0 && $menu->isAdminMenu() && !$menu->isAction()){
if($this->hasChild($menus, $menu->id())){
$chids = $this->buildChilds($menus, $menu->id());
$menuArr[$idx] = array(
'id' => $menu->id(),
'children' => $chids
);
}else{
$menuArr[$idx] = array('id' => $menu->id());
}
$idx = $idx + 1;
}
}
return $menuArr;
}
private function buildChilds($menus, $parentId){
$chidsArr = array();
$idx = 0;
foreach($menus as $menu){
if($menu->parentId() == $parentId){
if($this->hasChild($menus, $menu->id())){
$chids = $this->buildChilds($menus, $menu->id());
$chidsArr[$idx] = array(
'id' => $menu->id(),
'children' => $chids
);
}else{
$chidsArr[$idx] = array('id' => $menu->id());
}
$idx = $idx + 1;
}
}
return $chidsArr;
}
public function hasChild($menus, $parentId){
$foundChild = false;
foreach($menus as $menu){
if($menu->parentId() == $parentId){
$foundChild = true;
}
}
return $foundChild;
}
}
?> | didikhari/sekode | application/controllers/MenuSettingController.php | PHP | mit | 2,837 |
'use strict';
// Setting up route
angular.module('publications').config(['$stateProvider',
function ($stateProvider) {
// publications state routing
$stateProvider
.state('publications', {
abstract: true,
url: '/publications',
template: '<ui-view/>'
})
.state('publications.list', {
url: '',
templateUrl: 'modules/publications/client/views/list-publications.client.view.html',
data: {
roles: ['user', 'admin']
}
})
.state('publications.search', {
url: '/search',
templateUrl: 'modules/publications/client/views/pagination-publications.client.view.html',
data: {
roles: ['user', 'admin']
}
})
.state('publications.create', {
url: '/create',
templateUrl: 'modules/publications/client/views/create-publication.client.view.html',
data: {
roles: ['user', 'admin']
}
})
.state('publications.view', {
url: '/:publicationId',
templateUrl: 'modules/publications/client/views/view-publication.client.view.html',
data: {
roles: ['user', 'admin']
}
})
.state('publications.edit', {
url: '/:publicationId/edit',
templateUrl: 'modules/publications/client/views/edit-publication.client.view.html',
data: {
roles: ['user', 'admin']
}
});
}
]);
| hibernator11/Galatea | modules/publications/client/config/publications.client.routes.js | JavaScript | mit | 1,447 |
define(function() {
var ctor = function () {
};
//Note: This module exports a function. That means that you, the developer, can create multiple instances.
//This pattern is also recognized by Durandal so that it can create instances on demand.
//If you wish to create a singleton, you should export an object instead of a function.
return ctor;
}); | monmamo/Website | app/Misc/home.js | JavaScript | mit | 375 |
package components;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class HttpClientExample {
private final String USER_AGENT = "Mozilla/5.0";
public String sendGet(String url) throws Exception {
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet(url);
request.addHeader("User-Agent", USER_AGENT);
HttpResponse response = client.execute(request);
BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
StringBuffer result = new StringBuffer();
String line = "";
while ((line = rd.readLine()) != null) {
result.append(line);
}
System.out.println(result.toString());
return result.toString();
}
public String sendPost(String url, Map<String, String> param) throws Exception {
HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(url);
post.setHeader("User-Agent", USER_AGENT);
List<NameValuePair> urlParameters = new ArrayList<NameValuePair>();
for (Map.Entry<String, String> entry : param.entrySet()) {
urlParameters.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
}
post.setEntity(new UrlEncodedFormEntity(urlParameters));
HttpResponse response = client.execute(post);
BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
StringBuffer result = new StringBuffer();
String line = "";
while ((line = rd.readLine()) != null) {
result.append(line);
}
System.out.println(result.toString());
return result.toString();
}
} | Zippocat/JavaFX-MyVoip | src/components/HttpClientExample.java | Java | mit | 2,204 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Aspose.Words;
using Aspose.Words.Reporting;
namespace CSharp.LINQ
{
class PieChart
{
public static void Run()
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_LINQ();
string fileName = "PieChart.docx";
// Load the template document.
Document doc = new Document(dataDir + fileName);
// Create a Reporting Engine.
ReportingEngine engine = new ReportingEngine();
// Execute the build report.
engine.BuildReport(doc, Common.GetManagers(), "managers");
dataDir = dataDir + RunExamples.GetOutputFilePath(fileName);
// Save the finished document to disk.
doc.Save(dataDir);
Console.WriteLine("\nPie chart template document is populated with the data about managers.\nFile saved at " + dataDir);
}
}
}
| assadvirgo/Aspose_Words_NET | Examples/CSharp/LINQ/PieChart.cs | C# | mit | 1,034 |
package demo.java.v2c03network.InetAddressTest;
import java.net.*;
/**
* This program demonstrates the InetAddress class. Supply a host name as command line argument, or
* run without command line arguments to see the address of the local host.
* @version 1.01 2001-06-26
* @author Cay Horstmann
*/
public class InetAddressTest
{
public static void main(String[] args)
{
try
{
if (args.length > 0)
{
String host = args[0];
InetAddress[] addresses = InetAddress.getAllByName(host);
for (InetAddress a : addresses)
System.out.println(a);
}
else
{
InetAddress localHostAddress = InetAddress.getLocalHost();
System.out.println(localHostAddress);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
| myid999/javademo | core/src/main/java/demo/java/v2c03network/InetAddressTest/InetAddressTest.java | Java | mit | 918 |