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
#region PDFsharp Charting - A .NET charting library based on PDFsharp // // Authors: // Niklas Schneider // // Copyright (c) 2005-2016 empira Software GmbH, Cologne Area (Germany) // // http://www.pdfsharp.com // http://sourceforge.net/projects/pdfsharp // // 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. #endregion namespace PdfSharp.Charting { /// <summary> /// The Pdf-Sharp-Charting-String-Resources. /// </summary> // ReSharper disable once InconsistentNaming internal class PSCSR { internal static string InvalidChartTypeForCombination(ChartType chartType) { return string.Format("ChartType '{0}' not valid for combination of charts.", chartType.ToString()); } internal static string PercentNotSupportedByColumnDataLabel { get { return "Column data label cannot be set to 'Percent'"; } } } }
jumpchain/jumpmaker
JumpMaker/PDFSharp/PdfSharp.Charting/Charting/PSCSR.cs
C#
mit
1,927
#!/usr/bin/env python # -*- coding: utf-8 -*- """ The daemon that calls auto_copy.py uppon optical disc insertion """ import signal import sys import time sys.path.append('/usr/local/bin') import auto_copy SIGNAL_RECEIVED = False def run_daemon(config): """ Run the damon config: configParser object """ signal.signal(signal.SIGUSR1, signal_handler) while True: time.sleep(1) global SIGNAL_RECEIVED if SIGNAL_RECEIVED: auto_copy.auto_copy(config) SIGNAL_RECEIVED = False def signal_handler(dump1, dump2): global SIGNAL_RECEIVED SIGNAL_RECEIVED = True if __name__ == "__main__": main_config = auto_copy.read_config('/etc/auto_copy.yml') auto_copy.setup_logging(main_config) run_daemon(main_config)
shoubamzlibap/small_projects
auto_copy/auto_copy_daemon.py
Python
mit
798
db.groups.update( {lname: "marrasputki"}, {$set:{users: ["Jörö"], description: "Marrasputki 2018"}})
jrosti/ontrail
groupaddjs/updatemarras.js
JavaScript
mit
110
# Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. import json import os import unittest from monty.json import MontyDecoder from pymatgen.apps.battery.conversion_battery import ConversionElectrode from pymatgen.apps.battery.insertion_battery import InsertionElectrode from pymatgen.apps.battery.plotter import VoltageProfilePlotter from pymatgen.core.composition import Composition from pymatgen.entries.computed_entries import ComputedEntry from pymatgen.util.testing import PymatgenTest class VoltageProfilePlotterTest(unittest.TestCase): def setUp(self): entry_Li = ComputedEntry("Li", -1.90753119) with open(os.path.join(PymatgenTest.TEST_FILES_DIR, "LiTiO2_batt.json")) as f: entries_LTO = json.load(f, cls=MontyDecoder) self.ie_LTO = InsertionElectrode.from_entries(entries_LTO, entry_Li) with open(os.path.join(PymatgenTest.TEST_FILES_DIR, "FeF3_batt.json")) as fid: entries = json.load(fid, cls=MontyDecoder) self.ce_FF = ConversionElectrode.from_composition_and_entries(Composition("FeF3"), entries) def testName(self): plotter = VoltageProfilePlotter(xaxis="frac_x") plotter.add_electrode(self.ie_LTO, "LTO insertion") plotter.add_electrode(self.ce_FF, "FeF3 conversion") self.assertIsNotNone(plotter.get_plot_data(self.ie_LTO)) self.assertIsNotNone(plotter.get_plot_data(self.ce_FF)) def testPlotly(self): plotter = VoltageProfilePlotter(xaxis="frac_x") plotter.add_electrode(self.ie_LTO, "LTO insertion") plotter.add_electrode(self.ce_FF, "FeF3 conversion") fig = plotter.get_plotly_figure() self.assertEqual(fig.layout.xaxis.title.text, "Atomic Fraction of Li") plotter = VoltageProfilePlotter(xaxis="x_form") plotter.add_electrode(self.ce_FF, "FeF3 conversion") fig = plotter.get_plotly_figure() self.assertEqual(fig.layout.xaxis.title.text, "x in Li<sub>x</sub>FeF3") plotter.add_electrode(self.ie_LTO, "LTO insertion") fig = plotter.get_plotly_figure() self.assertEqual(fig.layout.xaxis.title.text, "x Workion Ion per Host F.U.") if __name__ == "__main__": unittest.main()
materialsproject/pymatgen
pymatgen/apps/battery/tests/test_plotter.py
Python
mit
2,269
//============== IV: Multiplayer - http://code.iv-multiplayer.com ============== // // File: CMutex.cpp // Project: Shared // Author(s): jenksta // License: See LICENSE in root directory // //============================================================================== #include "CMutex.h" #include <SharedUtility.h> CMutex::CMutex() { // Create the mutex #ifdef WIN32 #ifdef USE_CRITICAL_SECTION InitializeCriticalSection(&m_criticalSection); #else m_hMutex = CreateMutex(NULL, FALSE, NULL); #endif #else pthread_mutex_init(&m_mutex, NULL); #endif // Set the lock count to its default value m_iLockCount = 0; } CMutex::~CMutex() { // Delete the mutex #ifdef WIN32 #ifdef USE_CRITICAL_SECTION DeleteCriticalSection(&m_criticalSection); #else CloseHandle(m_hMutex); #endif #else pthread_mutex_destroy(&m_mutex); #endif } void CMutex::Lock() { // Lock the mutex #ifdef WIN32 #ifdef USE_CRITICAL_SECTION EnterCriticalSection(&m_criticalSection); #else WaitForSingleObject(m_hMutex, INFINITE); #endif #else pthread_mutex_lock(&m_mutex); #endif // Increment the lock count m_iLockCount++; } bool CMutex::TryLock(unsigned int uiTimeOutMilliseconds) { // Attempt to lock the mutex bool bLocked = false; #if defined(WIN32) && !defined(USE_CRITICAL_SECTION) bLocked = (WaitForSingleObject(m_hMutex, uiTimeOutMilliseconds) == 0); #else if(uiTimeOutMilliseconds == 0) { #ifdef WIN32 bLocked = (TryEnterCriticalSection(&m_criticalSection) != 0); #else bLocked = pthread_mutex_trylock(&m_mutex); #endif } else { unsigned long ulEndTime = (SharedUtility::GetTime() + uiTimeOutMilliseconds); while(SharedUtility::GetTime() < ulEndTime) { #ifdef WIN32 if(TryEnterCriticalSection(&m_criticalSection)) #else if(pthread_mutex_trylock(&m_mutex)) #endif { bLocked = true; break; } } } #endif // Did the mutex lock successfully? if(bLocked) { // Increment the lock count m_iLockCount++; } return bLocked; } void CMutex::Unlock() { // Decrement the lock count m_iLockCount--; // Unlock the mutex #ifdef WIN32 #ifdef USE_CRITICAL_SECTION LeaveCriticalSection(&m_criticalSection); #else ReleaseMutex(m_hMutex); #endif #else pthread_mutex_unlock(&m_mutex); #endif }
purm/IvmpDotNet
IvmpDotNet.Proxy/SDK/Shared/Threading/CMutex.cpp
C++
mit
2,225
#include <zmq.h> #include <zlib.h> #include <czmq.h> #include <zframe.h> #include "Crowbar.h" #include "boost/thread.hpp" #include "g2log.hpp" #include "Death.h" /** * Construct a crowbar for beating things at the binding location * * @param binding * A std::string description of a ZMQ socket */ Crowbar::Crowbar(const std::string& binding) : mContext(NULL), mBinding(binding), mTip(NULL), mOwnsContext(true) { } /** * Construct a crowbar for beating the specific headcrab * * @param target * A living(initialized) headcrab */ Crowbar::Crowbar(const Headcrab& target) : mContext(target.GetContext()), mBinding(target.GetBinding()), mTip(NULL), mOwnsContext(false) { if (mContext == NULL) { mOwnsContext = true; } } /** * Construct a crowbar for beating things at binding with the given context * @param binding * The binding of the bound socket for the given context * @param context * A working context */ Crowbar::Crowbar(const std::string& binding, zctx_t* context) : mContext(context), mBinding(binding), mTip(NULL), mOwnsContext(false) { } /** * Default deconstructor */ Crowbar::~Crowbar() { if (mOwnsContext && mContext != NULL) { zctx_destroy(&mContext); } } /** * Get the high water mark for socket sends * * @return * the high water mark */ int Crowbar::GetHighWater() { return 1024; } /** * Get the "tip" socket used to hit things * * @return * A pointer to a zmq socket (or NULL in a failure) */ void* Crowbar::GetTip() { void* tip = zsocket_new(mContext, ZMQ_REQ); if (!tip) { return NULL; } zsocket_set_sndhwm(tip, GetHighWater()); zsocket_set_rcvhwm(tip, GetHighWater()); zsocket_set_linger(tip, 0); int connectRetries = 100; while (zsocket_connect(tip, mBinding.c_str()) != 0 && connectRetries-- > 0 && !zctx_interrupted) { boost::this_thread::interruption_point(); int err = zmq_errno(); if (err == ETERM) { zsocket_destroy(mContext, tip); return NULL; } std::string error(zmq_strerror(err)); LOG(WARNING) << "Could not connect to " << mBinding << ":" << error; zclock_sleep(100); } Death::Instance().RegisterDeathEvent(&Death::DeleteIpcFiles, mBinding); if (zctx_interrupted) { LOG(INFO) << "Caught Interrupt Signal"; } if (connectRetries <= 0) { zsocket_destroy(mContext, tip); return NULL; } return tip; } bool Crowbar::Wield() { if (!mContext) { mContext = zctx_new(); zctx_set_linger(mContext, 0); // linger for a millisecond on close zctx_set_sndhwm(mContext, GetHighWater()); zctx_set_rcvhwm(mContext, GetHighWater()); // HWM on internal thread communicaiton zctx_set_iothreads(mContext, 1); } if (!mTip) { mTip = GetTip(); if (!mTip && mOwnsContext) { zctx_destroy(&mContext); mContext = NULL; } } return ((mContext != NULL) && (mTip != NULL)); } bool Crowbar::Swing(const std::string& hit) { //std::cout << "sending " << hit << std::endl; std::vector<std::string> hits; hits.push_back(hit); return Flurry(hits); } /** * Poll to see if the other side of the socket is ready * @return */ bool Crowbar::PollForReady() { zmq_pollitem_t item; if (!mTip) { return false; } item.socket = mTip; item.events = ZMQ_POLLOUT; int returnVal = zmq_poll(&item, 1, 0); if (returnVal < 0) { LOG(WARNING) << "Socket error: " << zmq_strerror(zmq_errno()); } return (returnVal >= 1); } /** * Send a bunch of strings to a socket * @param hits * @return */ bool Crowbar::Flurry(std::vector<std::string>& hits) { if (!mTip) { LOG(WARNING) << "Cannot send, not Wielded"; return false; } if (!PollForReady()) { LOG(WARNING) << "Cannot send, no listener ready"; return false; } zmsg_t* message = zmsg_new(); for (auto it = hits.begin(); it != hits.end(); it++) { zmsg_addmem(message, &((*it)[0]), it->size()); } bool success = true; //std::cout << "Sending message with " << zmsg_size(message) << " " << hits.size() << std::endl; if (zmsg_send(&message, mTip) != 0) { LOG(WARNING) << "zmsg_send returned non-zero exit " << zmq_strerror(zmq_errno()); success = false; } if (message) { zmsg_destroy(&message); } return success; } bool Crowbar::BlockForKill(std::string& guts) { std::vector<std::string> allReplies; if (BlockForKill(allReplies) && !allReplies.empty()) { guts = allReplies[0]; return true; } return false; } bool Crowbar::BlockForKill(std::vector<std::string>& guts) { if (!mTip) { return false; } zmsg_t* message = zmsg_recv(mTip); if (!message) { return false; } guts.clear(); int msgSize = zmsg_size(message); for (int i = 0; i < msgSize; i++) { zframe_t* frame = zmsg_pop(message); std::string aString; aString.insert(0, reinterpret_cast<const char*> (zframe_data(frame)), zframe_size(frame)); guts.push_back(aString); zframe_destroy(&frame); //std::cout << guts[0] << " found " << aString << std::endl; } zmsg_destroy(&message); return true; } bool Crowbar::WaitForKill(std::string& guts, const int timeout) { std::vector<std::string> allReplies; if (WaitForKill(allReplies, timeout) && !allReplies.empty()) { guts = allReplies[0]; return true; } return false; } bool Crowbar::WaitForKill(std::vector<std::string>& guts, const int timeout) { if (!mTip) { return false; } if (zsocket_poll(mTip, timeout)) { return BlockForKill(guts); } return false; } zctx_t* Crowbar::GetContext() { return mContext; }
alexweltman/QueueNado
src/Crowbar.cpp
C++
mit
5,762
# encoding: utf-8 # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::KeyVault::V2015_06_01 module Models # # The certificate issuer list result # class CertificateIssuerListResult include MsRestAzure include MsRest::JSONable # @return [Array<CertificateIssuerItem>] A response message containing a # list of certificate issuers in the vault along with a link to the next # page of certificate issuers attr_accessor :value # @return [String] The URL to get the next set of certificate issuers. attr_accessor :next_link # return [Proc] with next page method call. attr_accessor :next_method # # Gets the rest of the items for the request, enabling auto-pagination. # # @return [Array<CertificateIssuerItem>] operation results. # def get_all_items items = @value page = self while page.next_link != nil && !page.next_link.strip.empty? do page = page.get_next_page items.concat(page.value) end items end # # Gets the next page of results. # # @return [CertificateIssuerListResult] with next page content. # def get_next_page response = @next_method.call(@next_link).value! unless @next_method.nil? unless response.nil? @next_link = response.body.next_link @value = response.body.value self end end # # Mapper for CertificateIssuerListResult class as Ruby Hash. # This will be used for serialization/deserialization. # def self.mapper() { client_side_validation: true, required: false, serialized_name: 'CertificateIssuerListResult', type: { name: 'Composite', class_name: 'CertificateIssuerListResult', model_properties: { value: { client_side_validation: true, required: false, read_only: true, serialized_name: 'value', type: { name: 'Sequence', element: { client_side_validation: true, required: false, serialized_name: 'CertificateIssuerItemElementType', type: { name: 'Composite', class_name: 'CertificateIssuerItem' } } } }, next_link: { client_side_validation: true, required: false, read_only: true, serialized_name: 'nextLink', type: { name: 'String' } } } } } end end end end
Azure/azure-sdk-for-ruby
data/azure_key_vault/lib/2015-06-01/generated/azure_key_vault/models/certificate_issuer_list_result.rb
Ruby
mit
3,008
name 'meteor' maintainer 'Logan Koester' maintainer_email 'logan@logankoester.com' license 'MIT' description 'Install the Meteor JavaScript App Platform' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version '0.1.3'
logankoester/chef-meteor
metadata.rb
Ruby
mit
243
import React from 'react'; import ReactDOM from 'react-dom'; import { BrowserRouter } from "react-router-dom"; import App, {serviceWorkCallbacks} from './App'; import Globals from './Globals'; import * as serviceWorker from './serviceWorkerRegistration'; // Enable at the very start for logging most messages. Globals.enableAppLog(); ReactDOM.render(<BrowserRouter><App /></BrowserRouter>, document.getElementById('root')); // If you want your app to work offline and load faster, you can change // unregister() to register() below. Note this comes with some pitfalls. // Learn more about service workers: https://bit.ly/CRA-PWA serviceWorker.register({ onSuccess: (registration: ServiceWorkerRegistration) => { console.log('Precache app loaded!'); serviceWorkCallbacks.onSuccess(registration); }, onUpdate: (registration: ServiceWorkerRegistration) => { console.log('Found app updated!'); serviceWorkCallbacks.onUpdate(registration); }, });
MrMYHuang/taa
src/index.tsx
TypeScript
mit
953
from abc import ABCMeta, abstractmethod class AbstractAuthenticator(metaclass=ABCMeta): def __init__(self): """ Every authenticator has to have a name :param name: """ super().__init__() @abstractmethod def authorise_transaction(self, customer): """ Decide whether to authorise transaction. Note that all relevant information can be obtained from the customer. :param customer: the customer making a transaction :return: boolean, whether or not to authorise the transaction """
lmzintgraf/MultiMAuS
authenticators/abstract_authenticator.py
Python
mit
596
using System.Diagnostics; namespace ChainUtils.BouncyCastle.Math.EC.Custom.Sec { internal class SecP192K1Field { // 2^192 - 2^32 - 2^12 - 2^8 - 2^7 - 2^6 - 2^3 - 1 internal static readonly uint[] P = new uint[]{ 0xFFFFEE37, 0xFFFFFFFE, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }; internal static readonly uint[] PExt = new uint[]{ 0x013C4FD1, 0x00002392, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0xFFFFDC6E, 0xFFFFFFFD, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }; private static readonly uint[] PExtInv = new uint[]{ 0xFEC3B02F, 0xFFFFDC6D, 0xFFFFFFFE, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00002391, 0x00000002 }; private const uint P5 = 0xFFFFFFFF; private const uint PExt11 = 0xFFFFFFFF; private const uint PInv33 = 0x11C9; public static void Add(uint[] x, uint[] y, uint[] z) { var c = Nat192.Add(x, y, z); if (c != 0 || (z[5] == P5 && Nat192.Gte(z, P))) { Nat.Add33To(6, PInv33, z); } } public static void AddExt(uint[] xx, uint[] yy, uint[] zz) { var c = Nat.Add(12, xx, yy, zz); if (c != 0 || (zz[11] == PExt11 && Nat.Gte(12, zz, PExt))) { if (Nat.AddTo(PExtInv.Length, PExtInv, zz) != 0) { Nat.IncAt(12, zz, PExtInv.Length); } } } public static void AddOne(uint[] x, uint[] z) { var c = Nat.Inc(6, x, z); if (c != 0 || (z[5] == P5 && Nat192.Gte(z, P))) { Nat.Add33To(6, PInv33, z); } } public static uint[] FromBigInteger(BigInteger x) { var z = Nat192.FromBigInteger(x); if (z[5] == P5 && Nat192.Gte(z, P)) { Nat192.SubFrom(P, z); } return z; } public static void Half(uint[] x, uint[] z) { if ((x[0] & 1) == 0) { Nat.ShiftDownBit(6, x, 0, z); } else { var c = Nat192.Add(x, P, z); Nat.ShiftDownBit(6, z, c); } } public static void Multiply(uint[] x, uint[] y, uint[] z) { var tt = Nat192.CreateExt(); Nat192.Mul(x, y, tt); Reduce(tt, z); } public static void MultiplyAddToExt(uint[] x, uint[] y, uint[] zz) { var c = Nat192.MulAddTo(x, y, zz); if (c != 0 || (zz[11] == PExt11 && Nat.Gte(12, zz, PExt))) { if (Nat.AddTo(PExtInv.Length, PExtInv, zz) != 0) { Nat.IncAt(12, zz, PExtInv.Length); } } } public static void Negate(uint[] x, uint[] z) { if (Nat192.IsZero(x)) { Nat192.Zero(z); } else { Nat192.Sub(P, x, z); } } public static void Reduce(uint[] xx, uint[] z) { var cc = Nat192.Mul33Add(PInv33, xx, 6, xx, 0, z, 0); var c = Nat192.Mul33DWordAdd(PInv33, cc, z, 0); Debug.Assert(c == 0 || c == 1); if (c != 0 || (z[5] == P5 && Nat192.Gte(z, P))) { Nat.Add33To(6, PInv33, z); } } public static void Reduce32(uint x, uint[] z) { if ((x != 0 && Nat192.Mul33WordAdd(PInv33, x, z, 0) != 0) || (z[5] == P5 && Nat192.Gte(z, P))) { Nat.Add33To(6, PInv33, z); } } public static void Square(uint[] x, uint[] z) { var tt = Nat192.CreateExt(); Nat192.Square(x, tt); Reduce(tt, z); } public static void SquareN(uint[] x, int n, uint[] z) { Debug.Assert(n > 0); var tt = Nat192.CreateExt(); Nat192.Square(x, tt); Reduce(tt, z); while (--n > 0) { Nat192.Square(z, tt); Reduce(tt, z); } } public static void Subtract(uint[] x, uint[] y, uint[] z) { var c = Nat192.Sub(x, y, z); if (c != 0) { Nat.Sub33From(6, PInv33, z); } } public static void SubtractExt(uint[] xx, uint[] yy, uint[] zz) { var c = Nat.Sub(12, xx, yy, zz); if (c != 0) { if (Nat.SubFrom(PExtInv.Length, PExtInv, zz) != 0) { Nat.DecAt(12, zz, PExtInv.Length); } } } public static void Twice(uint[] x, uint[] z) { var c = Nat.ShiftUpBit(6, x, 0, z); if (c != 0 || (z[5] == P5 && Nat192.Gte(z, P))) { Nat.Add33To(6, PInv33, z); } } } }
assinnata/ChainUtils
ChainUtils.BouncyCastle/math/ec/custom/sec/SecP192K1Field.cs
C#
mit
5,315
document.body.onkeydown = function( e ) { var keys = { 37: 'left', 39: 'right', 40: 'down', 38: 'rotate', 80: 'pause' }; if ( typeof keys[ e.keyCode ] != 'undefined' ) { keyPress( keys[ e.keyCode ] ); render(); } };
ThomasBower/ChatApp
public/games/tetris/controller.js
JavaScript
mit
288
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using Sigil; using System.Reflection; using Jil.Common; namespace Jil.Serialize { class SerializeDynamicThunk<T> { public static Action<object, TextWriter, Options> Thunk; static SerializeDynamicThunk() { var serializeGenMtd = typeof(JSON).GetMethods(BindingFlags.Public | BindingFlags.Static).Single(s => s.Name == "Serialize" && s.ReturnType == typeof(void)); var t = typeof(T); var serialize = serializeGenMtd.MakeGenericMethod(t); var emit = Emit<Action<object, TextWriter, Options>>.NewDynamicMethod(); emit.LoadArgument(0); // obj if (t._IsValueType()) { emit.UnboxAny<T>(); // T } else { emit.CastClass(t); // T } emit.LoadArgument(1); emit.LoadArgument(2); emit.Call(serialize); emit.Return(); Thunk = emit.CreateDelegate(Utils.DelegateOptimizationOptions); } } }
mgravell/Jil
Jil/Serialize/SerializeDynamicThunk.cs
C#
mit
1,211
# frozen_string_literal: true module Gitlab module GithubImport # HTTP client for interacting with the GitHub API. # # This class is basically a fancy wrapped around Octokit while adding some # functionality to deal with rate limiting and parallel imports. Usage is # mostly the same as Octokit, for example: # # client = GithubImport::Client.new('hunter2') # # client.labels.each do |label| # puts label.name # end class Client include ::Gitlab::Utils::StrongMemoize attr_reader :octokit # A single page of data and the corresponding page number. Page = Struct.new(:objects, :number) # The minimum number of requests we want to keep available. # # We don't use a value of 0 as multiple threads may be using the same # token in parallel. This could result in all of them hitting the GitHub # rate limit at once. The threshold is put in place to not hit the limit # in most cases. RATE_LIMIT_THRESHOLD = 50 # token - The GitHub API token to use. # # per_page - The number of objects that should be displayed per page. # # parallel - When set to true hitting the rate limit will result in a # dedicated error being raised. When set to `false` we will # instead just `sleep()` until the rate limit is reset. Setting # this value to `true` for parallel importing is crucial as # otherwise hitting the rate limit will result in a thread # being blocked in a `sleep()` call for up to an hour. def initialize(token, per_page: 100, parallel: true) @octokit = ::Octokit::Client.new( access_token: token, per_page: per_page, api_endpoint: api_endpoint ) @octokit.connection_options[:ssl] = { verify: verify_ssl } @parallel = parallel end def parallel? @parallel end # Returns the details of a GitHub user. # # username - The username of the user. def user(username) with_rate_limit { octokit.user(username) } end # Returns the details of a GitHub repository. # # name - The path (in the form `owner/repository`) of the repository. def repository(name) with_rate_limit { octokit.repo(name) } end def labels(*args) each_object(:labels, *args) end def milestones(*args) each_object(:milestones, *args) end def releases(*args) each_object(:releases, *args) end # Fetches data from the GitHub API and yields a Page object for every page # of data, without loading all of them into memory. # # method - The Octokit method to use for getting the data. # args - Arguments to pass to the Octokit method. # # rubocop: disable GitlabSecurity/PublicSend def each_page(method, *args, &block) return to_enum(__method__, method, *args) unless block_given? page = if args.last.is_a?(Hash) && args.last[:page] args.last[:page] else 1 end collection = with_rate_limit { octokit.public_send(method, *args) } next_url = octokit.last_response.rels[:next] yield Page.new(collection, page) while next_url response = with_rate_limit { next_url.get } next_url = response.rels[:next] yield Page.new(response.data, page += 1) end end # Iterates over all of the objects for the given method (e.g. `:labels`). # # method - The method to send to Octokit for querying data. # args - Any arguments to pass to the Octokit method. def each_object(method, *args, &block) return to_enum(__method__, method, *args) unless block_given? each_page(method, *args) do |page| page.objects.each do |object| yield object end end end # Yields the supplied block, responding to any rate limit errors. # # The exact strategy used for handling rate limiting errors depends on # whether we are running in parallel mode or not. For more information see # `#rate_or_wait_for_rate_limit`. def with_rate_limit return yield unless rate_limiting_enabled? request_count_counter.increment raise_or_wait_for_rate_limit unless requests_remaining? begin yield rescue ::Octokit::TooManyRequests raise_or_wait_for_rate_limit # This retry will only happen when running in sequential mode as we'll # raise an error in parallel mode. retry end end # Returns `true` if we're still allowed to perform API calls. def requests_remaining? remaining_requests > RATE_LIMIT_THRESHOLD end def remaining_requests octokit.rate_limit.remaining end def raise_or_wait_for_rate_limit rate_limit_counter.increment if parallel? raise RateLimitError else sleep(rate_limit_resets_in) end end def rate_limit_resets_in # We add a few seconds to the rate limit so we don't _immediately_ # resume when the rate limit resets as this may result in us performing # a request before GitHub has a chance to reset the limit. octokit.rate_limit.resets_in + 5 end def rate_limiting_enabled? strong_memoize(:rate_limiting_enabled) do api_endpoint.include?('.github.com') end end def api_endpoint custom_api_endpoint || default_api_endpoint end def custom_api_endpoint github_omniauth_provider.dig('args', 'client_options', 'site') end def default_api_endpoint OmniAuth::Strategies::GitHub.default_options[:client_options][:site] end def verify_ssl github_omniauth_provider.fetch('verify_ssl', true) end def github_omniauth_provider @github_omniauth_provider ||= Gitlab::Auth::OAuth::Provider.config_for('github').to_h end def rate_limit_counter @rate_limit_counter ||= Gitlab::Metrics.counter( :github_importer_rate_limit_hits, 'The number of times we hit the GitHub rate limit when importing projects' ) end def request_count_counter @request_counter ||= Gitlab::Metrics.counter( :github_importer_request_count, 'The number of GitHub API calls performed when importing projects' ) end end end end
stoplightio/gitlabhq
lib/gitlab/github_import/client.rb
Ruby
mit
6,728
# frozen_string_literal: true require 'slack-notifier' module ChatMessage class BaseMessage attr_reader :markdown attr_reader :user_full_name attr_reader :user_name attr_reader :user_avatar attr_reader :project_name attr_reader :project_url attr_reader :commit_message_html def initialize(params) @markdown = params[:markdown] || false @project_name = params.dig(:project, :path_with_namespace) || params[:project_name] @project_url = params.dig(:project, :web_url) || params[:project_url] @user_full_name = params.dig(:user, :name) || params[:user_full_name] @user_name = params.dig(:user, :username) || params[:user_name] @user_avatar = params.dig(:user, :avatar_url) || params[:user_avatar] @commit_message_html = params[:commit_message_html] || false end def user_combined_name if user_full_name.present? "#{user_full_name} (#{user_name})" else user_name end end def summary return message if markdown format(message) end def pretext summary end def fallback format(message) end def attachments raise NotImplementedError end def activity raise NotImplementedError end private def message raise NotImplementedError end def format(string) Slack::Notifier::LinkFormatter.format(string) end def attachment_color '#345' end def link(text, url) "[#{text}](#{url})" end def pretty_duration(seconds) parse_string = if duration < 1.hour '%M:%S' else '%H:%M:%S' end Time.at(seconds).utc.strftime(parse_string) end end end
stoplightio/gitlabhq
app/models/project_services/chat_message/base_message.rb
Ruby
mit
1,757
module.exports = { 'plugins': { 'local': { 'browsers': [ 'chrome', 'firefox' ] } } }
SimplaElements/simpla-collection
wct.conf.js
JavaScript
mit
103
<?php /** * Copyright (c) 2017 Yohei Yoshikawa * */ $lang = 'ja'; require_once dirname(__FILE__).'/../../lib/Controller.php'; if ($argv[1] == 1) $is_excute_sql = true; if (!$host) $host = 'localhost'; if ($is_excute_sql) { echo('--- Mode: excute SQL ---').PHP_EOL; } else { echo('--- Mode: Do not excute SQL ---').PHP_EOL; } echo("host: {$host}").PHP_EOL; $pgsql = new PwPgsql(); $pgsql->is_excute_sql = $is_excute_sql; $pgsql->diffFromVoModel();
yoo16/project-manager
script/sql/check_schema_from_model.php
PHP
mit
460
package sales.bucket.domain; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import sales.users.domain.User; import javax.persistence.*; import java.util.List; /** * Created by taras on 13.08.15. */ @Entity @Table(name="buckets") public class Bucket { @Id @GeneratedValue(strategy = GenerationType.AUTO) @JsonProperty private Long id; @ManyToOne(targetEntity = User.class) @JoinColumn(name = "client", referencedColumnName = "id") @JsonProperty private User client; @OneToMany(cascade = CascadeType.ALL, mappedBy="bucket", fetch = FetchType.EAGER) @JsonProperty private List<GoodInBucket> goodsInBucket; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public User getClient() { return client; } public void setClient(User client) { this.client = client; } }
softjourn-internship/sales-if-ua
src/main/java/sales/bucket/domain/Bucket.java
Java
mit
968
import React, { useEffect, useMemo, useRef } from 'react' import styled from 'styled-components' import { Box, Button, Dialog, extend, Paragraph, Progress, RefreshIcon, themeGet, } from '../../components' import { useFullSizeMode } from '../FullSizeView' import { useIntersection } from '../IntersectionObserver' import { usePages } from '../Pages' import { Nav, useRouteActions } from '../Router' import { Overlay, ScrollSpy } from '../ScrollSpy' import { isUgoira } from '../Ugoira' import { PADDING, StandardImg } from './StandardImg' import { StandardUgoira } from './StandardUgoira' import { LazyLoadingObserver } from './useLazyLoad' interface Props { illustId: string } interface SuspenseProps extends Props { children?: React.ReactNode } interface SuccessProps { pages: Pixiv.Pages } export const StandardView = ({ illustId, children }: SuspenseProps) => { const root = useRef<HTMLDivElement>(null) const { unset } = useRouteActions() const [isFullSize, setFullSize] = useFullSizeMode() // 作品を移動したら先頭までスクロールしてフォーカス useEffect(() => { setFullSize(false) const node = root.current if (!node) return node.scroll(0, 0) node.focus() }, [illustId, setFullSize]) // フルサイズモードから戻ったらルートにフォーカス useEffect(() => { if (isFullSize) return const node = root.current if (!node) return node.focus() }, [isFullSize]) return ( <Root ref={root} tabIndex={0} hidden={isFullSize}> <Box sx={{ userSelect: 'none', position: 'relative' }}> <span onClick={unset}> <React.Suspense fallback={<Loading />}> <Loader illustId={illustId} /> </React.Suspense> </span> <Nav /> </Box> {children} </Root> ) } const Loader = ({ illustId }: Props) => { const pages = usePages(illustId) if (!pages) return <Failure illustId={illustId} /> return <Success pages={pages} /> } const Loading = () => ( <ImageBox> <Progress /> </ImageBox> ) const Failure = ({ illustId }: Props) => ( <ImageBox> <Dialog onClick={(e) => e.stopPropagation()}> <Dialog.Content> <Paragraph>リクエストに失敗しました[illustId: {illustId}]</Paragraph> </Dialog.Content> <Dialog.Footer> <Button onClick={() => usePages.remove(illustId)}> <RefreshIcon width={18} height={18} sx={{ mr: 2 }} /> 再取得 </Button> </Dialog.Footer> </Dialog> </ImageBox> ) const Success = ({ pages }: SuccessProps) => { const isMultiple = pages.length > 1 const imgs = useMemo(() => { const ugoira = isUgoira(pages[0]) return pages.map((page, index) => ( <ScrollSpy.SpyItem key={page.urls.original} index={index}> <ImageBox tabIndex={0}> {!ugoira && <StandardImg {...page} />} {ugoira && <StandardUgoira {...page} />} </ImageBox> </ScrollSpy.SpyItem> )) }, [pages]) const observer = useIntersection() useEffect(() => { observer.start() }, [observer]) return ( <LazyLoadingObserver.Provider value={observer}> {imgs} <ScrollSpy.SpyItemLast /> {isMultiple && <Overlay pages={pages} />} </LazyLoadingObserver.Provider> ) } const Root = styled.section( extend({ '--caption-height': '56px', pointerEvents: 'auto', outline: 'none', position: 'relative', overflow: 'auto', width: '100%', height: '100vh', '&[hidden]': { display: 'block', opacity: 0, }, } as any) ) const ImageBox = styled.div( extend({ outline: 'none', position: 'relative', display: 'flex', flexDirection: 'column', width: '100%', height: 'calc(100vh - var(--caption-height))', p: PADDING, }) ) const Action = styled.div( extend({ pointerEvents: 'none', position: 'absolute', top: 0, left: 0, display: 'flex', justifyContent: 'space-between', width: '100%', height: '100%', }) ) const Circle = styled.div( extend({ pointerEvents: 'auto', position: 'sticky', top: 'calc(50vh - var(--caption-height))', width: '48px', height: '48px', mx: 2, borderRadius: '50%', bg: 'surface', opacity: themeGet('opacities.inactive'), transform: 'translateY(-50%)', ':hover': { opacity: 1, }, }) ) if (__DEV__) { Loader.displayName = 'StandardView.Loader' Loading.displayName = 'StandardView.Loading' Success.displayName = 'StandardView.Success' Failure.displayName = 'StandardView.Failure' Root.displayName = 'StandardView.Root' ImageBox.displayName = 'StandardView.ImageBox' Action.displayName = 'StandardView.Action' Circle.displayName = 'StandardView.Circle' }
8th713/cockpit-for-pixiv
packages/core/features/StandardView/StandardView.tsx
TypeScript
mit
4,802
// JScript File var borderstyle function editorOn(divid){ $('#'+divid).parent().parent().find(' >*:last-child img').css('visibility','hidden'); borderstyle = $('#'+divid).parent().parent().css('border'); $('#'+divid).parent().parent().css('border','') } function editorOff(divid){ $('#'+divid).parent().parent().find(' >*:last-child img').css('visibility',''); $('#'+divid).parent().parent().css('border',borderstyle); }
Micmaz/DTIControls
Rotator/Rotator/Rotator/editorFunctions.js
JavaScript
mit
426
<?php namespace LaravelDoctrine\Extensions\Uploadable; use Doctrine\Common\Annotations\Reader; use Doctrine\Common\EventManager; use Doctrine\ORM\EntityManagerInterface; use Gedmo\Uploadable\UploadableListener; use LaravelDoctrine\ORM\Extensions\Extension; class UploadableExtension implements Extension { public function __construct(UploadableListener $uploadableListener) { $this->uploadableListener = $uploadableListener; } /** * @param EventManager $manager * @param EntityManagerInterface $em * @param Reader $reader */ public function addSubscribers(EventManager $manager, EntityManagerInterface $em, Reader $reader = null) { $this->uploadableListener->setAnnotationReader($reader); $manager->addEventSubscriber($this->uploadableListener); } /** * @return array */ public function getFilters() { return []; } }
jee7/extensions
src/Uploadable/UploadableExtension.php
PHP
mit
954
using System; using System.Collections.Generic; using System.ComponentModel; using System.Net.Http.Headers; namespace food_therapist.Areas.HelpPage { /// <summary> /// This is used to identify the place where the sample should be applied. /// </summary> public class HelpPageSampleKey { /// <summary> /// Creates a new <see cref="HelpPageSampleKey"/> based on media type. /// </summary> /// <param name="mediaType">The media type.</param> public HelpPageSampleKey(MediaTypeHeaderValue mediaType) { if (mediaType == null) { throw new ArgumentNullException("mediaType"); } ActionName = String.Empty; ControllerName = String.Empty; MediaType = mediaType; ParameterNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase); } /// <summary> /// Creates a new <see cref="HelpPageSampleKey"/> based on media type and CLR type. /// </summary> /// <param name="mediaType">The media type.</param> /// <param name="type">The CLR type.</param> public HelpPageSampleKey(MediaTypeHeaderValue mediaType, Type type) : this(mediaType) { if (type == null) { throw new ArgumentNullException("type"); } ParameterType = type; } /// <summary> /// Creates a new <see cref="HelpPageSampleKey"/> based on <see cref="SampleDirection"/>, controller name, action name and parameter names. /// </summary> /// <param name="sampleDirection">The <see cref="SampleDirection"/>.</param> /// <param name="controllerName">Name of the controller.</param> /// <param name="actionName">Name of the action.</param> /// <param name="parameterNames">The parameter names.</param> public HelpPageSampleKey(SampleDirection sampleDirection, string controllerName, string actionName, IEnumerable<string> parameterNames) { if (!Enum.IsDefined(typeof(SampleDirection), sampleDirection)) { throw new InvalidEnumArgumentException("sampleDirection", (int)sampleDirection, typeof(SampleDirection)); } if (controllerName == null) { throw new ArgumentNullException("controllerName"); } if (actionName == null) { throw new ArgumentNullException("actionName"); } if (parameterNames == null) { throw new ArgumentNullException("parameterNames"); } ControllerName = controllerName; ActionName = actionName; ParameterNames = new HashSet<string>(parameterNames, StringComparer.OrdinalIgnoreCase); SampleDirection = sampleDirection; } /// <summary> /// Creates a new <see cref="HelpPageSampleKey"/> based on media type, <see cref="SampleDirection"/>, controller name, action name and parameter names. /// </summary> /// <param name="mediaType">The media type.</param> /// <param name="sampleDirection">The <see cref="SampleDirection"/>.</param> /// <param name="controllerName">Name of the controller.</param> /// <param name="actionName">Name of the action.</param> /// <param name="parameterNames">The parameter names.</param> public HelpPageSampleKey(MediaTypeHeaderValue mediaType, SampleDirection sampleDirection, string controllerName, string actionName, IEnumerable<string> parameterNames) : this(sampleDirection, controllerName, actionName, parameterNames) { if (mediaType == null) { throw new ArgumentNullException("mediaType"); } MediaType = mediaType; } /// <summary> /// Gets the name of the controller. /// </summary> /// <value> /// The name of the controller. /// </value> public string ControllerName { get; private set; } /// <summary> /// Gets the name of the action. /// </summary> /// <value> /// The name of the action. /// </value> public string ActionName { get; private set; } /// <summary> /// Gets the media type. /// </summary> /// <value> /// The media type. /// </value> public MediaTypeHeaderValue MediaType { get; private set; } /// <summary> /// Gets the parameter names. /// </summary> public HashSet<string> ParameterNames { get; private set; } public Type ParameterType { get; private set; } /// <summary> /// Gets the <see cref="SampleDirection"/>. /// </summary> public SampleDirection? SampleDirection { get; private set; } public override bool Equals(object obj) { HelpPageSampleKey otherKey = obj as HelpPageSampleKey; if (otherKey == null) { return false; } return String.Equals(ControllerName, otherKey.ControllerName, StringComparison.OrdinalIgnoreCase) && String.Equals(ActionName, otherKey.ActionName, StringComparison.OrdinalIgnoreCase) && (MediaType == otherKey.MediaType || (MediaType != null && MediaType.Equals(otherKey.MediaType))) && ParameterType == otherKey.ParameterType && SampleDirection == otherKey.SampleDirection && ParameterNames.SetEquals(otherKey.ParameterNames); } public override int GetHashCode() { int hashCode = ControllerName.ToUpperInvariant().GetHashCode() ^ ActionName.ToUpperInvariant().GetHashCode(); if (MediaType != null) { hashCode ^= MediaType.GetHashCode(); } if (SampleDirection != null) { hashCode ^= SampleDirection.GetHashCode(); } if (ParameterType != null) { hashCode ^= ParameterType.GetHashCode(); } foreach (string parameterName in ParameterNames) { hashCode ^= parameterName.ToUpperInvariant().GetHashCode(); } return hashCode; } } }
raduaron26/food-therapist
food-therapist/Areas/HelpPage/SampleGeneration/HelpPageSampleKey.cs
C#
mit
6,478
package com.f2prateek.segment.model; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import java.util.Collections; import java.util.Date; import java.util.Map; import static com.f2prateek.segment.model.Utils.assertNotNull; import static com.f2prateek.segment.model.Utils.assertNotNullOrEmpty; import static com.f2prateek.segment.model.Utils.immutableCopyOf; import static com.f2prateek.segment.model.Utils.isNullOrEmpty; /** * The screen call lets you record whenever a user sees a screen, along with any properties about * the screen. * * @see <a href="https://segment.com/docs/spec/screen/">Screen</a> */ public final class ScreenMessage extends Message { private @NonNull final String name; private @Nullable final Map<String, Object> properties; @Private ScreenMessage(Type type, String messageId, Date timestamp, Map<String, Object> context, Map<String, Object> integrations, String userId, String anonymousId, @NonNull String name, @Nullable Map<String, Object> properties) { super(type, messageId, timestamp, context, integrations, userId, anonymousId); this.name = name; this.properties = properties; } public @NonNull String name() { return name; } public @Nullable Map<String, Object> properties() { return properties; } @Override public @NonNull Builder toBuilder() { return new Builder(this); } @Override public String toString() { return "ScreenMessage{" + "type=" + type + ", " + "messageId=" + messageId + ", " + "timestamp=" + timestamp + ", " + "context=" + context + ", " + "integrations=" + integrations + ", " + "userId=" + userId + ", " + "anonymousId=" + anonymousId + ", " + "name=" + name + ", " + "properties=" + properties + "}"; } @Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof ScreenMessage) { ScreenMessage that = (ScreenMessage) o; return (this.type.equals(that.type())) && ((this.messageId == null) ? (that.messageId() == null) : this.messageId.equals(that.messageId())) && ((this.timestamp == null) ? (that.timestamp() == null) : this.timestamp.equals(that.timestamp())) && ((this.context == null) ? (that.context() == null) : this.context.equals(that.context())) && ((this.integrations == null) ? (that.integrations() == null) : this.integrations.equals(that.integrations())) && ((this.userId == null) ? (that.userId() == null) : this.userId.equals(that.userId())) && ((this.anonymousId == null) ? (that.anonymousId() == null) : this.anonymousId.equals(that.anonymousId())) && (this.name.equals(that.name())) && ((this.properties == null) ? (that.properties() == null) : this.properties.equals(that.properties())); } return false; } @Override public int hashCode() { int h = 1; h *= 1000003; h ^= this.type.hashCode(); h *= 1000003; h ^= (messageId == null) ? 0 : this.messageId.hashCode(); h *= 1000003; h ^= (timestamp == null) ? 0 : this.timestamp.hashCode(); h *= 1000003; h ^= (context == null) ? 0 : this.context.hashCode(); h *= 1000003; h ^= (integrations == null) ? 0 : this.integrations.hashCode(); h *= 1000003; h ^= (userId == null) ? 0 : this.userId.hashCode(); h *= 1000003; h ^= (anonymousId == null) ? 0 : this.anonymousId.hashCode(); h *= 1000003; h ^= this.name.hashCode(); h *= 1000003; h ^= (properties == null) ? 0 : this.properties.hashCode(); return h; } /** Fluent API for creating {@link ScreenMessage} instances. */ public static class Builder extends Message.Builder<ScreenMessage, Builder> { private String name; private Map<String, Object> properties; public Builder() { super(Type.screen); } @Private Builder(ScreenMessage screen) { super(screen); name = screen.name(); properties = screen.properties(); } public @NonNull Builder name(@NonNull String name) { this.name = assertNotNullOrEmpty(name, "name"); return this; } public @NonNull Builder properties(@NonNull Map<String, Object> properties) { assertNotNull(properties, "properties"); this.properties = immutableCopyOf(properties); return this; } @Override protected ScreenMessage realBuild(Type type, String messageId, Date timestamp, Map<String, Object> context, Map<String, Object> integrations, String userId, String anonymousId) { assertNotNullOrEmpty(name, "name"); Map<String, Object> properties = this.properties; if (isNullOrEmpty(properties)) { properties = Collections.emptyMap(); } return new ScreenMessage(type, messageId, timestamp, context, integrations, userId, anonymousId, name, properties); } @Override Builder self() { return this; } } }
f2prateek/segment-android
segment-model/src/main/java/com/f2prateek/segment/model/ScreenMessage.java
Java
mit
5,218
namespace BlockEngine.Math { public class Mathx { public static int DivideRoundDown(int numerator, int positiveDivisor) { if (numerator >= 0) { return numerator / positiveDivisor; } else { return (numerator + 1) / positiveDivisor - 1; } } } }
teinemaa/worldgen2d
Assets/BlockEngine/Math/Mathx.cs
C#
mit
386
(function () { 'use strict'; // var matcher = require('../../lib/matchUsers'); angular .module('chat.routes') .config(routeConfig); routeConfig.$inject = ['$stateProvider']; var c = "/room";// need to make this somehow return the correct room function routeConfig($stateProvider) { $stateProvider .state('chat', { url: c, templateUrl: '/modules/chat/client/views/chat.client.view.html', controller: 'ChatController', controllerAs: 'vm', data: { roles: ['user', 'admin'], pageTitle: 'Chat' } }); } }());
Hkurtis/capstone
modules/chat/client/config/chat.client.routes.js
JavaScript
mit
608
import React from 'react'; import { shallow } from 'enzyme'; import { expect } from 'chai'; import sinon from 'sinon'; import RadioInput from './'; describe('RadioInput', () => { let wrapper; let value; let style; let onChange; beforeEach(() => { value = 'test'; style = { backgroundColor: 'blue' }; onChange = sinon.spy(); wrapper = shallow( <RadioInput style={style} value={value} onChange={onChange} /> ); }); it('should render a radio tag', () => { expect(wrapper.find('radio')).to.have.length(1); }); it('should have a style value set via the style prop', () => { expect(wrapper.find('radio')).to.have.style('background-color', 'blue'); }); it('should have a value set via the value prop', () => { expect(wrapper.find('radio').text()).to.equal(value); }); it('should call onChange on change', () => { wrapper.find('radio').simulate('change'); expect(onChange.calledOnce).to.equal(true); }); });
bjlaa/facebook-clone
src/components/RadioInput/RadioInput.spec.js
JavaScript
mit
1,012
#include <iostream> #include <future> #include <signal.h> #include <string.h> #include <vector> #include "BotHandler.h" #include "BotService.h" #include "config.h" #include "ClientHandler.h" #include "Net/TCPConnection.h" #include "Net/TCPServer.h" using namespace std; using namespace hlt; vector<ClientHandler::Ptr> clientHandlers; vector<BotHandler::Ptr> botHandlers; void removeBot(BotHandler::Ptr handler) { BotService::UnregisterBot(handler->getName()); auto iter = std::find(botHandlers.begin(), botHandlers.end(), handler); if (iter != botHandlers.end()) botHandlers.erase(iter); } void registerBot(const BotHandler::EventArgument& arg, BotHandler::Ptr botHandler) { cout << "Trying to register new bot: " << arg["name"] << endl; int result = BotService::RegisterBot(arg["name"], botHandler); if (result == 0) { cout << "Registered new bot: " << arg["name"] << endl; } else { cout << "Couldn't register bot closing..." << endl; botHandler->close(); removeBot(botHandler); } } static void signalHandler(int signum) { // TODO Handle signals } int main(int argc, char** argv) { struct sigaction sa; sa.sa_handler = signalHandler; sigemptyset(&sa.sa_mask); if (sigaction(SIGPIPE, &sa, NULL) == -1) { cout << "Couldn't set signal handler. Exiting..." << endl; return 1; } TCPServer clientServer(string(CLIENT_PORT)); clientServer.getEventEmitter().on("connection", [](const TCPServer::EventArgument& arg) { cout << "New connection to client server!" << endl; clientHandlers.push_back(ClientHandler::Ptr( new ClientHandler(arg.connection))); } ); clientServer.start(); TCPServer spServer(string(SP_PORT)); spServer.getEventEmitter().on("connection", [](const TCPServer::EventArgument& arg) { cout << "New connection to bot server!" << endl; BotHandler::Ptr botHandler(new BotHandler(arg.connection)); botHandlers.push_back(botHandler); botHandler->getEventEmitter().on("close", std::bind(removeBot, botHandler)); botHandler->getEventEmitter().on("info", std::bind(registerBot, placeholders::_1, botHandler)); } ); spServer.start(); while (1) { string in; cin >> in; // Possible UI here } return 0; }
mhalitk/RemoteBot
src/server.cpp
C++
mit
2,455
/*global describe, beforeEach, it*/ 'use strict'; var assert = require('assert'); describe('ttwebapp generator', function () { it('can be imported without blowing up', function () { var app = require('../app'); assert(app !== undefined); }); });
times/generator-ttwebapp
test/test-load.js
JavaScript
mit
272
require 'test_helper' class GridTest < ActiveSupport::TestCase test 'load Grid model correctly' do assert_kind_of Gridder::Grid, Gridder::Grid.new(12, 60, 20) end test 'handle accessors correctly' do grid = Gridder::Grid.new(12, 60, 20) assert_same 12, grid.num_cols assert_same 60, grid.col_width assert_same 20, grid.gutter grid.num_cols = 10 assert_same 10, grid.num_cols grid.col_width = 80 assert_same 80, grid.col_width grid.gutter = 30 assert_same 30, grid.gutter end test 'validate correctly' do assert Gridder::Grid.new(12, 60, 20).valid? assert Gridder::Grid.new(false, false, false).invalid? assert Gridder::Grid.new(12, false, false).invalid? assert Gridder::Grid.new(12, 60, false).invalid? assert Gridder::Grid.new(12, 60, 'test').invalid? assert Gridder::Grid.new(12, 60.5, 20).invalid? assert Gridder::Grid.new(-12, 60, 20).invalid? assert Gridder::Grid.new(0, 60, 20).invalid? assert Gridder::Grid.new(1, 60, 20).valid? assert Gridder::Grid.new(12, -60, 20).invalid? assert Gridder::Grid.new(12, 0, 20).invalid? assert Gridder::Grid.new(12, 1, 20).valid? assert Gridder::Grid.new(12, 60, -20).invalid? assert Gridder::Grid.new(12, 60, 0).valid? assert Gridder::Grid.new(12, 60, 11).invalid? assert Gridder::Grid.new(12, 200, 100).invalid? assert Gridder::Grid.new(200, 60, 20).invalid? end end
stephan83/gridder
test/unit/grid_test.rb
Ruby
mit
1,439
//setup Dependencies var connect = require('connect'); //Setup Express var express = require('express'); var path = require('path'); let app = express(); var server = require('http').Server(app); var io = require('socket.io')(server); var keypress = require('keypress'); var port = (process.env.PORT || 8081); var muted = false; const debug = true; app.set("view engine", "pug"); app.set("views", path.join(__dirname, "views")); app.use(express.static(path.join(__dirname, "public"))); app.set('env', 'development'); server.listen(port); var message = ''; var main_socket; var auksalaq_mode = 'chatMode'; //Setup Socket.IO io.on('connection', function(socket){ if(debug){ console.log('Client Connected'); } main_socket = socket; //start time setInterval(sendTime, 1000); //ceiling socket.on('ceiling_newuser', function (data) { if(debug){ console.log('new user added! ' + data.username); console.log(data); } socket.emit('ceiling_user_confirmed', data); socket.broadcast.emit('ceiling_user_confirmed', data); }); //see NomadsMobileClient.js for data var socket.on('ceiling_message', function(data){ socket.broadcast.emit('ceiling_proc_update',data); //send data to all clients for processing sketch socket.broadcast.emit('ceiling_client_update',data); //send data back to all clients? if(debug){ console.log(data); } }); //auksalaq socket.on('auksalaq_newuser', function (data) { if(debug){ console.log('new user added! ' + data.username); console.log(data); } data.mode = auksalaq_mode; data.muted = muted; socket.emit('auksalaq_user_confirmed', data); socket.broadcast.emit('auksalaq_user_confirmed', data); }); //see NomadsMobileClient.js for data var socket.on('auksalaq_message', function(data){ //socket.broadcast.emit('auksalaq_proc_update',data); //send data to all clients for processing sketch socket.broadcast.emit('auksalaq_client_update',data); socket.emit('auksalaq_client_update',data); if(debug){ console.log(data); } }); //mode change from controller socket.on('auksalaq_mode', function(data){ socket.broadcast.emit('auksalaq_mode', data); auksalaq_mode = data; if(debug){ console.log(data); } }); socket.on('mute_state', function(data){ muted = data; socket.broadcast.emit('mute_state', data); console.log(data); }); //clocky socket.on('clock_start', function(data){ socket.broadcast.emit('clock_start', data); if(debug){ console.log(data); } }); socket.on('clock_stop', function(data){ socket.broadcast.emit('clock_stop', data); if(debug){ console.log(data); } }); socket.on('clock_reset', function(data){ socket.broadcast.emit('clock_reset', data); if(debug){ console.log("resettting clock"); } }); /* socket.on('begin_ceiling', function(){ ; }); socket.on('begin_auksalak', function(){ ; }); socket.on('stop_ceiling', function(){ ; }); socket.on('stop_auksalak', function(){ ; }); */ socket.on('disconnect', function(){ if(debug){ console.log('Client Disconnected.'); } }); }); /////////////////////////////////////////// // Routes // /////////////////////////////////////////// /////// ADD ALL YOUR ROUTES HERE ///////// app.get('/', function(req,res){ //res.send('hello world'); res.render('index.pug', { locals : { title : 'Nomads' ,description: 'Nomads System' ,author: 'TThatcher' ,analyticssiteid: 'XXXXXXX' ,cache: 'false' } }); }); // The Ceiling Floats Away Routes app.get('/ceiling', function(req,res){ res.render('ceiling/ceiling_client.pug', { locals : { title : 'The Ceiling Floats Away' ,description: 'The Ceiluing Floats Away' ,author: 'TThatcher' ,analyticssiteid: 'XXXXXXX' } }); }); app.get('/ceiling_display', function(req,res){ res.render('ceiling/ceiling_display.pug', { locals : { title : 'The Ceiling Floats Away' ,description: 'Ceiling Nomads message disply' ,author: 'TThatcher' ,analyticssiteid: 'XXXXXXX' } }); }); app.get('/ceiling_control', function(req,res){ res.render('ceiling/ceiling_control.pug', { locals : { title : 'The Ceiling Floats Away Control' ,description: 'Ceiling Nomads System Control' ,author: 'TThatcher' ,analyticssiteid: 'XXXXXXX' } }); }); // Auksalaq Routes app.get('/auksalaq', function(req,res){ res.render('auksalaq/auksalaq_client.pug', { locals : { title : 'Auksalaq' ,description: 'Auksalaq Nomads System' ,author: 'TThatcher' ,analyticssiteid: 'XXXXXXX' } }); }); app.get('/auksalaq_display', function(req,res){ res.render('auksalaq/auksalaq_display.pug', { locals : { title : 'Auksalaq' ,description: 'Auksalaq Nomads message disply' ,author: 'TThatcher' ,analyticssiteid: 'XXXXXXX' } }); }); app.get('/auksalaq_control', function(req,res){ res.render('auksalaq/auksalaq_control.pug', { locals : { title : 'Auksalaq Control' ,description: 'Auksalaq Nomads System Control' ,author: 'TThatcher' ,analyticssiteid: 'XXXXXXX' } }); }); app.get('/auksalaq_clock', function(req,res){ res.render('auksalaq/auksalaq_clock.pug', { locals : { title : 'Auksalaq Clock' ,description: 'Auksalaq Nomads System Clock' ,author: 'TThatcher' ,analyticssiteid: 'XXXXXXX' } }); }); // catch 404 and forward to error handler app.use(function(req, res, next) { var err = new Error('Not Found '+req); err.status = 404; next(err); }); // error handler app.use(function(err, req, res, next) { // set locals, only providing error in development res.locals.message = err.message; res.locals.error = req.app.get('env') === 'development' ? err : {}; // very basic! if(debug){ console.error(err.stack); } // render the error page res.status(err.status || 500); res.render('404'); }); function NotFound(msg){ this.name = 'NotFound'; Error.call(this, msg); Error.captureStackTrace(this, arguments.callee); } if(debug){ console.log('Listening on http://127.0.0.1:' + port ); } //for testing sendChat = function(data, type){ if(debug) console.log("sending data ", data); var messageToSend = {}; messageToSend.id = 123; messageToSend.username = "Nomads_Server"; messageToSend.type = type; messageToSend.messageText = data; messageToSend.location = 0; messageToSend.latitude = 0; messageToSend.longitude = 0; messageToSend.x = 0; messageToSend.y = 0; var date = new Date(); d = date.getMonth()+1+"."+date.getDate()+"."+date.getFullYear()+ " at " + date.getHours()+":"+date.getMinutes()+":"+date.getSeconds(); messageToSend.timestamp = d; main_socket.broadcast.emit('auksalaq_client_update', messageToSend); } sendTime = function(){ var d = new Date(); main_socket.broadcast.emit('clock_update', d.getTime()); }
nomads2/new-nomads
server.js
JavaScript
mit
7,491
<?php defined('BASEPATH') OR exit('No direct script access allowed'); class Pso extends CI_Controller { function __construct() { parent::__construct(); $this->load->helper('url'); $this->PARTICLE_COUNT = 6; $this->V_MAX = 8; $this->MAX_EPOCH = 10000; $this->CITY_COUNT = 8; $this->TARGET = 86.63; $this->particles = []; $this->map = []; $this->XLocs = [30, 40, 40, 29, 19, 9, 9, 20]; //City X coordinate $this->YLocs = [5, 10, 20, 25, 25, 19, 9, 5]; //City Y coordinate $this->totalEpoch = 0; $this->shortestRoute = ''; $this->shortestDistance = 0.0; } public function index() { $this->load->model('pso_model'); $init = $this->input->get(); $init_param = $this->pso_model->get_init_param($init['init_param_id'])->row_array(); if($init['particle_count'] > 0){ $this->PARTICLE_COUNT = $init['particle_count']; }else{ $this->PARTICLE_COUNT = $init_param['particle_count']; } if($init['v_max'] > $init_param['city_count'] || $init['v_max'] < 1){ $this->V_MAX = $init_param['v_max']; }else{ $this->V_MAX = $init['v_max']; } if($init['max_epoch'] > 0){ $this->MAX_EPOCH = $init['max_epoch']; }else{ $this->MAX_EPOCH = $init_param['max_epoch']; } if(isset($init['target']) && $init['target'] == "Y"){ $this->TARGET = $init_param['target']; }else{ $this->TARGET = 0; } $this->CITY_COUNT = $init_param['city_count']; $this->XLocs = []; foreach(explode(',',$init_param['xlocs']) as $x){ array_push($this->XLocs, $x); } $this->YLocs = []; foreach(explode(',',$init_param['ylocs']) as $y){ array_push($this->YLocs, $y); } $this->initMap(); $this->PSOAlgorithm(); $this->printBestSolution(); if($init['command'] == 'save') $this->save_result($init); } public function save_result($init){ $this->load->model('pso_model'); $data = [ 'init_param_id' => $init['init_param_id'], 'v_max' => $this->V_MAX, 'max_epoch' => $this->MAX_EPOCH, 'particle_count'=> $this->PARTICLE_COUNT, 'epoch_number' => $this->totalEpoch, 'shortest_route'=> $this->shortestRoute, 'shortest_distance'=> $this->shortestDistance ]; $this->pso_model->save_result($data); } public function initMap() { for($i = 0; $i < $this->CITY_COUNT; $i++) { $city = new CCity(); $city->setX($this->XLocs[$i]); $city->setY($this->YLocs[$i]); array_push($this->map, $city); } } public function PSOAlgorithm(){ $aParticle = null; $epoch = 0; $done = FALSE; $this->initialize(); while(!$done) { // Two conditions can end this loop: // if the maximum number of epochs allowed has been reached, or, // if the Target value has been found. if($epoch < $this->MAX_EPOCH){ echo "<br><br>Iteration number: ".$epoch."<br>"; for($i = 0; $i < $this->PARTICLE_COUNT; $i++){ $aParticle = $this->particles[$i]; echo "Particle <strong>".$aParticle->label()."</strong> "; echo "Route: "; for($j = 0; $j < $this->CITY_COUNT; $j++){ echo $aParticle->data($j)." - "; } $this->getTotalDistance($i); echo "Distance: ".$aParticle->pBest().'<br>'; if($aParticle->pBest() <= $this->TARGET){ $this->shortestDistance = $aParticle->pBest(); for($j = 0; $j < $this->CITY_COUNT; $j++) { $this->shortestRoute.= $aParticle->data($j) . ","; } $done = TRUE; } } $this->bubbleSort(); // sort particles by their pBest scores, best to worst. $this->getVelocity(); $this->updateParticle(); $epoch++; }else{ $done = TRUE; } $this->totalEpoch = $epoch; } } public function printBestSolution(){ if($this->particles[0]->pBest() <= $this->TARGET){ echo "<h4>Target Reached</h4>"; }else{ echo "<h4>Target not Reached</h4>"; } echo "<h5>Shortest Route:"; for($i = 0; $i < $this->CITY_COUNT; $i++){ echo $this->particles[0]->data($i)."-"; } echo "</h5>"; echo "<h5>Distance :".$this->particles[0]->pBest()."</h5>"; } private function initialize(){ for($i = 0; $i < $this->PARTICLE_COUNT; $i++){ $newParticle = new Particle(); $newParticle->setlabel($i+1); for($j = 0; $j < $this->CITY_COUNT; $j++){ $newParticle->setData($j, $j); } array_push($this->particles, $newParticle); for($j = 0; $j < 10; $j++){ $this->randomlyArrange(array_search($newParticle, $this->particles)); } //console.log("cetak " + particles.indexOf(newParticle)); $this->getTotalDistance(array_search($newParticle, $this->particles)); } } private function randomlyArrange($index){ $cityA = rand(0, $this->CITY_COUNT - 1); $cityB = 0; $done = FALSE; while(!$done){ $cityB = rand(0, $this->CITY_COUNT - 1); if($cityB != $cityA) $done = TRUE; } $temp = $this->particles[$index]->data($cityA); $this->particles[$index]->setData($cityA, $this->particles[$index]->data($cityB)); $this->particles[$index]->setData($cityB, $temp); } private function getVelocity(){ $worstResult = $this->particles[$this->PARTICLE_COUNT - 1]->pBest(); for($i = 0; $i < $this->PARTICLE_COUNT; $i++){ $vValue = ($this->V_MAX * $this->particles[$i]->pBest()) / $worstResult; if($vValue > $this->V_MAX){ $this->particles[$i]->setVelocity($this->V_MAX); }elseif($vValue < 0.0){ $this->particles[$i]->setVelocity(0.0); }else{ $this->particles[$i]->setVelocity($vValue); } } } private function updateParticle(){ echo "Sort :<br>"; echo "Best is Particle <strong>".$this->particles[0]->label()."</strong> <strong>Distance: ".$this->particles[0]->pBest().'</strong><br>'; // Best is at index 0, so start from the second best. for($i = 1; $i < $this->PARTICLE_COUNT; $i++){ // The higher the velocity score, the more changes it will need. $changes = (int)(floor(abs($this->particles[$i]->velocity()))); echo "Changes velocity for particle <strong>".$this->particles[$i]->label()."</strong>: ".$changes; echo " <strong>Distance: ".$this->particles[$i]->pBest().'</strong><br>'; for($j = 0; $j < $changes; $j++){ if(rand(0,1) == 1) $this->randomlyArrange($i); // Push it closer to it's best neighbor. $this->copyFromParticle($i - 1, $i); } // Update pBest value. $this->getTotalDistance($i); } } private function copyFromParticle($source, $destination){ // push destination's data points closer to source's data points. $best = $this->particles[$source]; $targetA = rand(0, $this->CITY_COUNT - 1); // source's city distance to target. $targetB = $indexA = $indexB = $tempIndex = 0; // targetB will be source's neighbor immediately succeeding targetA (circular). for($i = 0; $i < $this->CITY_COUNT; $i++){ if($best->data($i) == $targetA) { if ($i == $this->CITY_COUNT - 1) $targetB = $best->data(0); // if end of array, take from beginning. else $targetB = $best->data($i + 1); break; } } // Move targetB next to targetA by switching values. for($j = 0; $j < $this->CITY_COUNT; $j++){ if($this->particles[$destination]->data($j) == $targetA) $indexA = $j; if($this->particles[$destination]->data($j) == $targetB) $indexB = $j; } // get temp index succeeding indexA. if($indexA == $this->CITY_COUNT - 1) $tempIndex = 0; else $tempIndex = $indexA + 1; // Switch indexB value with tempIndex value. $temp = $this->particles[$destination]->data($tempIndex); $this->particles[$destination]->setData($tempIndex, $this->particles[$destination]->data($indexB)); $this->particles[$destination]->setData($indexB, $temp); } private function getTotalDistance($index){ $thisParticle = $this->particles[$index]; $thisParticle->setpBest(0.0); for($i = 0; $i < $this->CITY_COUNT; $i++){ if(($this->CITY_COUNT - 1) == $i){ $thisParticle->setpBest($thisParticle->pBest() + $this->getDistance($thisParticle->data($this->CITY_COUNT - 1), $thisParticle->data(0))); }else{ $thisParticle->setpBest($thisParticle->pBest() + $this->getDistance($thisParticle->data($i), $thisParticle->data($i+1))); } } } private function getDistance($firstCity, $secondCity){ $cityA = $cityB = NULL; $a2 = $b2 = 0; $cityA = $this->map[$firstCity]; $cityB = $this->map[$secondCity]; $a2 = pow(abs($cityA->x() - $cityB->x()), 2); $b2 = pow(abs($cityA->y() - $cityB->y()), 2); return sqrt($a2 + $b2); } private function bubbleSort(){ $done = false; while(!$done){ $changes = 0; $listSize = count($this->particles); for($i = 0; $i < $listSize -1; $i++){ if($this->particles[$i]->compareTo($this->particles[$i + 1]) == 1){ $temp = $this->particles[$i]; $this->particles[$i] = $this->particles[$i+1]; $this->particles[$i+1] = $temp; $changes++; } } if($changes == 0){ $done = true; } } } } class CCity { function __construct() { $this->mX = 0; $this->mY = 0; } public function x(){ return $this->mX; } public function y(){ return $this->mY; } public function setX($xCoordinate){ $this->mX = $xCoordinate; } public function setY($yCoordinate){ $this->mY = $yCoordinate; } } class Particle { function __construct() { $this->mData = []; $this->mpBest = 0; $this->mVelocity = 0.0; $this->label = 0; } public function compareTo($that){ if($this->pBest() < $that->pBest()) return -1; elseif($this->pBest() > $that->pBest()) return 1; else return 0; } public function data($index){ return $this->mData[$index]; } public function setData($index, $value){ $this->mData[$index] = $value; } public function pBest(){ return $this->mpBest; } public function setpBest($value){ $this->mpBest = $value; } public function velocity(){ return $this->mVelocity; } public function setVelocity($velocityScore){ $this->mVelocity = $velocityScore; } public function label(){ return $this->label; } public function setlabel($value){ $this->label = $value; } }
fr3ndyl33/PSO-TSP
application/controllers/Pso.php
PHP
mit
12,309
class ProfilesController < ApplicationController before_action :authenticate_user! before_action :only_current_user def new # form where a user can fill out their own profile @user = User.find( params[:user_id] ) @profile = Profile.new end def create @user = User.find( params[:user_id] ) @profile = @user.build_profile(profile_params) if @profile.save flash[:success] = "Profile Updated!" redirect_to user_path( params[:user_id] ) else render action: :new end end def edit @user = User.find( params[:user_id] ) @profile = @user.profile end def update @user = User.find( params[:user_id] ) @profile = @user.profile if @profile.update_attributes(profile_params) flash[:success] = "Profile Updated" redirect_to user_path( params[:user_id] ) else render action: :edit end end private def profile_params params.require(:profile).permit(:first_name, :last_name, :avatar, :job_title, :phone_number, :contact_email, :description) end def only_current_user @user = User.find(params[:user_id]) redirect_to root_url unless @user == current_user end end
SlurmzMckenzie/SaaS-App
app/controllers/profiles_controller.rb
Ruby
mit
1,124
// The MIT License (MIT) // // Copyright (c) 2015-2016 Rasmus Mikkelsen // Copyright (c) 2015-2016 eBay Software Foundation // https://github.com/rasmus/EventFlow // // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of // the Software, and to permit persons to whom the Software is furnished to do so, // subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace EventFlow.Core { public interface IJsonSerializer { string Serialize(object obj, bool indented = false); object Deserialize(string json, Type type); T Deserialize<T>(string json); } }
AntoineGa/EventFlow
Source/EventFlow/Core/IJsonSerializer.cs
C#
mit
1,491
from django.conf.urls import url, include urlpatterns = [ url(r'^postcode-lookup/', include('django_postcode_lookup.urls')), ]
LabD/django-postcode-lookup
sandbox/urls.py
Python
mit
132
package com.witchworks.api.brew; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.DamageSource; import net.minecraftforge.event.entity.living.LivingDeathEvent; /** * This class was created by Arekkuusu on 06/06/2017. * It's distributed as part of Witchworks under * the MIT license. */ public interface IBrewDeath { void onDeath(LivingDeathEvent event, DamageSource source, EntityLivingBase dying, int amplifier); }
backuporg/Witchworks
src/main/java/com/witchworks/api/brew/IBrewDeath.java
Java
mit
447
<?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreatePcLoginRequest extends Migration { /** * Run the migrations. * * @return void */ public function up() { // Recently no errors detected, the deprecated tables should be destoryed. Schema::dropIfExists('wx_order_item_temp'); Schema::dropIfExists('wx_order_temp'); Schema::create('pc_login_request', function (Blueprint $t) { $t->bigIncrements('id')->unsigned(); $t->string('code', '32'); $t->index('code'); $t->tinyInteger('status')->default(0); $t->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('pc_login_request'); } }
dreamingodd/casarover_2.0
database/migrations/2016_07_05_164111_create_pc_login_request.php
PHP
mit
878
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: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DddDemo.Domain")] [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("fc984400-902e-4563-ae83-0fc1116074d7")]
hikalkan/samples
DddDemo/src/DddDemo.Domain/Properties/AssemblyInfo.cs
C#
mit
826
<?php declare(strict_types=1); namespace Doctrine\ORM\Mapping; /** * @Annotation * @Target("PROPERTY") */ final class JoinColumns implements Annotation { /** @var array<\Doctrine\ORM\Mapping\JoinColumn> */ public $value; }
doctrine/doctrine2
lib/Doctrine/ORM/Mapping/JoinColumns.php
PHP
mit
237
<?php namespace AvalancheDevelopment\Approach\Schema; class ExternalDocumentation { use Part\Extensions; /** @var string */ protected $description; /** @var string */ protected $url; /** * @return string */ public function getDescription() { return $this->description; } /** * @param string $description */ public function setDescription($description) { $this->description = $description; } /** * @return string */ public function getUrl() { return $this->url; } /** * @param string $url */ public function setUrl($url) { $this->url = $url; } }
avalanche-development/approach
src/Schema/ExternalDocumentation.php
PHP
mit
710
using MVC.View; using System; using System.Collections.Generic; using System.Linq; using System.Net.Configuration; using System.Text; using System.Threading.Tasks; using Webshop.Models; using DataModels; using MVC; namespace Webshop.Controllers { public class PublisherController : MVC.Controller.Controller { private readonly Context context; public PublisherController() { context = new Context(); } //public ViewObject GetAll() //{ // //IEnumerable<Publisher> genres = context.Genres.GetAll().Result; // //return Json(genres); //} } }
barld/project5_6
Webshop/Controllers/PublisherController.cs
C#
mit
646
package demo import ( _ "fmt" cp "github.com/eka-tel72/go-chipmunk62/chipmunk" ) /* #include <stdlib.h> int Random(void) { return rand(); } void Seed(unsigned int i) { srand(i); } */ import "C" type tumble struct { *demoClass rogueBoxBody *cp.Body } var tumbleInst = &tumble{ &demoClass{ name: "Tumble", timestep: 1.0/180.0, }, nil, } func (t *tumble) Update(space *cp.Space, dt float64) { fdt := cp.Float(dt) cp.BodyUpdatePosition(t.rogueBoxBody, fdt) cp.SpaceStep(space, fdt) } func tumbleAddBox(space *cp.Space, pos cp.Vect, mass, width, height cp.Float) { body := cp.SpaceAddBody( space, cp.BodyNew(mass, cp.MomentForBox(mass, width, height)) ) cp.BodySetPos(body, pos) shape := cp.SpaceAddShape(space, cp.BoxShapeNew(body, width, height)) cp.ShapeSetElasticity(shape, 0.0) cp.ShapeSetFriction(shape, 0.7) } func tumbleAddSegment(space *cp.Space, pos cp.Vect, mass, width, height cp.Float) { body := cp.SpaceAddBody( space, cp.BodyNew(mass, cp.MomentForBox(mass, width, height)) ) cp.BodySetPos(body, pos) shape := cp.SpaceAddShape(space, cp.SegmentShapeNew(body, cp.V(0.0, (height - width)/2.0), cp.V(0.0, (width - height)/2.0), width/2.0)) cp.ShapeSetElasticity(shape, 0.0) cp.ShapeSetFriction(shape, 0.7) } func tumbleAddCircle(space *cp.Space, pos cp.Vect, mass, radius cp.Float) { body := cp.SpaceAddBody( space, cp.BodyNew(mass, cp.MomentForCircle(mass, 0.0, radius, cpvzero)) ) cp.BodySetPos(body, pos) shape := cp.SpaceAddShape(space, cp.CircleShapeNew(body, radius, cpvzero)) cp.ShapeSetElasticity(shape, 0.0) cp.ShapeSetFriction(shape, 0.7) } func (t *tumble) Init() *cp.Space { C.Seed(45073) space := cp.SpaceNew() cp.SpaceSetGravity(space, cp.V(0, -600)) rogueBoxBody := cp.BodyNew(infinity, infinity) cp.BodySetAngVel(rogueBoxBody, 0.4) a := cp.V(-200, -200) b := cp.V(-200, 200) c := cp.V( 200, 200) d := cp.V( 200, -200) seg := [][]cp.Vect {{a, b}, {b, c}, {c, d}, {d, a}} for i := 0; i < len(seg); i++ { vs := seg[i] shape := cp.SpaceAddShape(space, cp.SegmentShapeNew(rogueBoxBody, vs[0], vs[1], 0.0)) cp.ShapeSetElasticity(shape, 1.0) cp.ShapeSetFriction(shape, 1.0) cp.ShapeSetLayers(shape, notGrabableMask) } mass := cp.Float(1.0) width := cp.Float(30.0) height := width*2 for i := 0; i < 7; i++ { for j := 0; j < 3; j++ { pos := cp.V(cp.Float(i)*width - 150, cp.Float(j)*height - 150) switch (C.Random()%3000)/1000 { default: tumbleAddCircle(space, cp.Vadd(pos, cp.V(0.0, (height - width)/2.0)), mass, width/2.0) tumbleAddCircle(space, cp.Vadd(pos, cp.V(0.0, (width - height)/2.0)), mass, width/2.0) case 0: tumbleAddBox(space, pos, mass, width, height) case 1: tumbleAddSegment(space, pos, mass, width, height) } } } t.rogueBoxBody = rogueBoxBody return space } func (t *tumble) Destroy(space *cp.Space) { freeSpaceChildren(space) cp.BodyFree(t.rogueBoxBody) cp.SpaceFree(space) }
eka-tel72/go-chipmunk62
chipmunk62demo/demo/tumble.go
GO
mit
2,935
<?php /** * @copyright 2009-2016 Vanilla Forums Inc. * @license MIT */ namespace HipChat\v2\Auth; /** * Represents a HipChat auth token. * * @author Tim Gunter <tim@vanillaforums.com> */ class AuthContainer { /** * Token * @var string */ protected $token; /** * Token type (Basic or Bearer) * @var string */ protected $type; /** * Auth Container * * @param string $token oauth2 token for hipchat */ public function __construct($token, $type) { $this->token = $token; $this->type = $type; } /** * Get token * * @return string */ public function getToken() { return $this->token; } /** * Get Authorization Header * * @return string */ public function getAuth() { return "{$this->type} {$this->token}"; } }
vanilla/hipchat-api
src/Auth/AuthContainer.php
PHP
mit
892
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> <TS version="2.1" language="sl_SI"> <context> <name>AboutDialog</name> <message> <location filename="../forms/aboutdialog.ui" line="+14"/> <source>About LEOcoin</source> <translation>O LEOcoin</translation> </message> <message> <location line="+39"/> <source>&lt;b&gt;LEOcoin&lt;/b&gt; version</source> <translation>&lt;b&gt;LEOcoin&lt;/b&gt; verzija</translation> </message> <message> <location line="+41"/> <source>Copyright © 2009-2014 The Bitcoin developers Copyright © 2012-2014 The NovaCoin developers Copyright © 2014 The BlackCoin developers Copyright © 2014-%1 The LEOcoin developers</source> <translation type="unfinished"></translation> </message> <message> <location line="+16"/> <source> This is experimental software. Distributed under the MIT/X11 software license, see the accompanying file COPYING or &lt;a href=&quot;http://www.opensource.org/licenses/mit-license.php&quot;&gt;http://www.opensource.org/licenses/mit-license.php&lt;/a&gt;. This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (&lt;a href=&quot;https://www.openssl.org/&quot;&gt;https://www.openssl.org/&lt;/a&gt;) and cryptographic software written by Eric Young (&lt;a href=&quot;mailto:eay@cryptsoft.com&quot;&gt;eay@cryptsoft.com&lt;/a&gt;) and UPnP software written by Thomas Bernard.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>AddressTableModel</name> <message> <location filename="../addresstablemodel.cpp" line="+218"/> <source>Label</source> <translation>Oznaka</translation> </message> <message> <location line="+0"/> <source>Address</source> <translation>Naslov</translation> </message> <message> <location line="+0"/> <source>pubkey</source> <translation type="unfinished"></translation> </message> <message> <location line="+0"/> <source>stealth</source> <translation type="unfinished"></translation> </message> <message> <location line="+34"/> <source>(no label)</source> <translation>(ni oznake)</translation> </message> <message> <location line="+4"/> <source>Stealth Address</source> <translation type="unfinished"></translation> </message> <message> <location line="+0"/> <source>n/a</source> <translation type="unfinished"></translation> </message> </context> <context> <name>AskPassphraseDialog</name> <message> <location filename="../forms/askpassphrasedialog.ui" line="+26"/> <source>Passphrase Dialog</source> <translation>Poziv gesla</translation> </message> <message> <location line="+21"/> <source>Enter passphrase</source> <translation>Vnesite geslo</translation> </message> <message> <location line="+14"/> <source>New passphrase</source> <translation>Novo geslo</translation> </message> <message> <location line="+14"/> <source>Repeat new passphrase</source> <translation>Ponovite novo geslo</translation> </message> <message> <location line="+33"/> <location line="+16"/> <source>Serves to disable the trivial sendmoney when OS account compromised. Provides no real security.</source> <translation>Služi kot onemogočenje pošiljanja prostega denarja, v primerih okužbe operacijskega sistema. Ne ponuja prave zaščite.</translation> </message> <message> <location line="-13"/> <source>For staking only</source> <translation>Samo za staking.</translation> </message> <message> <location line="+16"/> <source>Enable messaging</source> <translation type="unfinished"></translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="+39"/> <source>Enter the new passphrase to the wallet.&lt;br/&gt;Please use a passphrase of &lt;b&gt;10 or more random characters&lt;/b&gt;, or &lt;b&gt;eight or more words&lt;/b&gt;.</source> <translation>Vnesite novo geslo za vstop v denarnico.&lt;br/&gt;Prosimo, da geslo sestavite iz &lt;b&gt; 10 ali več naključnih znakov&lt;/b&gt; oz. &lt;b&gt;osem ali več besed&lt;/b&gt;.</translation> </message> <message> <location line="+1"/> <source>Encrypt wallet</source> <translation>Šifriraj denarnico</translation> </message> <message> <location line="+11"/> <source>This operation needs your wallet passphrase to unlock the wallet.</source> <translation>To dejanje zahteva geslo za odklepanje vaše denarnice.</translation> </message> <message> <location line="+5"/> <source>Unlock wallet</source> <translation>Odkleni denarnico</translation> </message> <message> <location line="+3"/> <source>This operation needs your wallet passphrase to decrypt the wallet.</source> <translation>To dejanje zahteva geslo za dešifriranje vaše denarnice.</translation> </message> <message> <location line="+5"/> <source>Decrypt wallet</source> <translation>Dešifriraj denarnico</translation> </message> <message> <location line="+3"/> <source>Change passphrase</source> <translation>Zamenjaj geslo</translation> </message> <message> <location line="+1"/> <source>Enter the old and new passphrase to the wallet.</source> <translation>Vnesite staro in novo geslo denarnice.</translation> </message> <message> <location line="+45"/> <source>Confirm wallet encryption</source> <translation>Potrdi šifriranje denarnice</translation> </message> <message> <location line="+1"/> <source>Warning: If you encrypt your wallet and lose your passphrase, you will &lt;b&gt;LOSE ALL OF YOUR COINS&lt;/b&gt;!</source> <translation>Opozorilo: Če šifrirate svojo denarnico in izgubite svoje geslo, boste &lt;b&gt; IZGUBILI VSE SVOJE KOVANCE&lt;/b&gt;!</translation> </message> <message> <location line="+0"/> <source>Are you sure you wish to encrypt your wallet?</source> <translation>Ali ste prepričani, da želite šifrirati vašo denarnico?</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>POMEMBNO: Vsaka predhodna varnostna kopija datoteke denarnice mora biti nadomeščena z novo datoteko šifrirane denarnice. Zaradi varnostnih razlogov bodo namreč prejšnje varnostne kopije datoteke nešifrirane denarnice postale neuporabne takoj ko boste pričeli uporabljati novo, šifrirano denarnico.</translation> </message> <message> <location line="+104"/> <location line="+24"/> <source>Warning: The Caps Lock key is on!</source> <translation>Opozorilo: imate prižgan Cap Lock</translation> </message> <message> <location line="-134"/> <location line="+61"/> <source>Wallet encrypted</source> <translation>Denarnica šifrirana</translation> </message> <message> <location line="-59"/> <source>LEOcoin 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>LEOcoin se bo sedaj zaprl, da dokonča proces šifriranje. Pomnite, da tudi šifriranje vaše denarnice ne more v celoti zaščititi vaših kovancev pred krajo z zlonamernimi programi in računalniškimi virusi, če ti okužijo vaš računalnik.</translation> </message> <message> <location line="+13"/> <location line="+7"/> <location line="+45"/> <location line="+6"/> <source>Wallet encryption failed</source> <translation>Šifriranje denarnice je spodletelo</translation> </message> <message> <location line="-57"/> <source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source> <translation>Šifriranje denarnice spodletelo je zaradi notranje napake. Vaša denarnica ni šifrirana.</translation> </message> <message> <location line="+7"/> <location line="+51"/> <source>The supplied passphrases do not match.</source> <translation>Vnešeno geslo se ne ujema</translation> </message> <message> <location line="-39"/> <source>Wallet unlock failed</source> <translation>Odklep denarnice spodletel</translation> </message> <message> <location line="+1"/> <location line="+13"/> <location line="+19"/> <source>The passphrase entered for the wallet decryption was incorrect.</source> <translation>Geslo za dešifriranje denarnice, ki ste ga vnesli, ni pravilno.</translation> </message> <message> <location line="-20"/> <source>Wallet decryption failed</source> <translation>Dešifriranje denarnice je spodletelo</translation> </message> <message> <location line="+14"/> <source>Wallet passphrase was successfully changed.</source> <translation>Geslo denarnice je bilo uspešno spremenjeno.</translation> </message> </context> <context> <name>ClientModel</name> <message> <location filename="../clientmodel.cpp" line="+137"/> <source>Network Alert</source> <translation>Omrežno Opozorilo</translation> </message> </context> <context> <name>CoinControlDialog</name> <message> <location filename="../forms/coincontroldialog.ui" line="+14"/> <source>Coin Control</source> <translation>Kontrola kovancev</translation> </message> <message> <location line="+31"/> <source>Quantity:</source> <translation>Količina:</translation> </message> <message> <location line="+32"/> <source>Bytes:</source> <translation>Biti:</translation> </message> <message> <location line="+48"/> <source>Amount:</source> <translation>Količina:</translation> </message> <message> <location line="+32"/> <source>Priority:</source> <translation>Prednostno mesto:</translation> </message> <message> <location line="+48"/> <source>Fee:</source> <translation>Provizija:</translation> </message> <message> <location line="+35"/> <source>Low Output:</source> <translation>Nizek output:</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="+528"/> <location line="+30"/> <source>no</source> <translation>ne</translation> </message> <message> <location filename="../forms/coincontroldialog.ui" line="+51"/> <source>After Fee:</source> <translation>Po proviziji:</translation> </message> <message> <location line="+35"/> <source>Change:</source> <translation>Sprememba:</translation> </message> <message> <location line="+69"/> <source>(un)select all</source> <translation>od/obkljukaj vse</translation> </message> <message> <location line="+13"/> <source>Tree mode</source> <translation>Drevo</translation> </message> <message> <location line="+16"/> <source>List mode</source> <translation>Seznam</translation> </message> <message> <location line="+45"/> <source>Amount</source> <translation>Količina</translation> </message> <message> <location line="+5"/> <source>Label</source> <translation>Oznaka</translation> </message> <message> <location line="+5"/> <source>Address</source> <translation>Naslov</translation> </message> <message> <location line="+5"/> <source>Date</source> <translation>Datum</translation> </message> <message> <location line="+5"/> <source>Confirmations</source> <translation>Potrdila</translation> </message> <message> <location line="+3"/> <source>Confirmed</source> <translation>Potrjeno</translation> </message> <message> <location line="+5"/> <source>Priority</source> <translation>Prednostno mesto</translation> </message> <message> <location filename="../coincontroldialog.cpp" line="-520"/> <source>Copy address</source> <translation>Kopiraj naslov</translation> </message> <message> <location line="+1"/> <source>Copy label</source> <translation>Kopiraj oznako</translation> </message> <message> <location line="+1"/> <location line="+26"/> <source>Copy amount</source> <translation>Kopiraj količino</translation> </message> <message> <location line="-25"/> <source>Copy transaction ID</source> <translation>Kopiraj ID transakcije</translation> </message> <message> <location line="+24"/> <source>Copy quantity</source> <translation>Kopiraj količino</translation> </message> <message> <location line="+2"/> <source>Copy fee</source> <translation>Kopiraj provizijo</translation> </message> <message> <location line="+1"/> <source>Copy after fee</source> <translation>Kopiraj po proviziji</translation> </message> <message> <location line="+1"/> <source>Copy bytes</source> <translation>Kopiraj bite</translation> </message> <message> <location line="+1"/> <source>Copy priority</source> <translation>Kopiraj prednostno mesto</translation> </message> <message> <location line="+1"/> <source>Copy low output</source> <translation>Kopiraj nizek output:</translation> </message> <message> <location line="+1"/> <source>Copy change</source> <translation>Kopiraj spremembo</translation> </message> <message> <location line="+317"/> <source>highest</source> <translation>najvišja</translation> </message> <message> <location line="+1"/> <source>high</source> <translation>visoka</translation> </message> <message> <location line="+1"/> <source>medium-high</source> <translation>srednje visoka</translation> </message> <message> <location line="+1"/> <source>medium</source> <translation>srednje</translation> </message> <message> <location line="+4"/> <source>low-medium</source> <translation>srednje nizka</translation> </message> <message> <location line="+1"/> <source>low</source> <translation>nizka</translation> </message> <message> <location line="+1"/> <source>lowest</source> <translation>najnižja</translation> </message> <message> <location line="+130"/> <location line="+30"/> <source>DUST</source> <translation>PRAH</translation> </message> <message> <location line="-30"/> <location line="+30"/> <source>yes</source> <translation>da</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>Ta oznakla se obarva rdeče, če je transakcija večja od 10000 bajtov. To pomeni, da je zahtevana provizija vsaj %1 na kb. Lahko variira +/- 1 Bajt na vnos.</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 &quot;medium&quot;. This means a fee of at least %1 per kb is required.</source> <translation>Transakcije z višjo prioriteto imajo višjo verjetnost, da so vključene v blok. Ta oznaka se obarva rdeče, če je prioriteta manjša kot &quot;srednja&quot;. To pomeni, da je zahtevana provizija vsaj %1 na 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>Ta oznaka se obarva rdeče, če prejemnik dobi količino manjšo od %1. To pomeni, da je potrebna vsaj %2 provizija. Zneski pod 0.546 krat minimalna transakcijska provizija so prikazani kot PRAH.</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>Ta oznakla se obarva rdeče, če je sprememba manjša od %1. To pomeni, da je zahtevana provizija vsaj %2.</translation> </message> <message> <location line="+40"/> <location line="+66"/> <source>(no label)</source> <translation>(ni oznake)</translation> </message> <message> <location line="-9"/> <source>change from %1 (%2)</source> <translation>spremeni iz %1 (%2)</translation> </message> <message> <location line="+1"/> <source>(change)</source> <translation>(spremeni)</translation> </message> </context> <context> <name>EditAddressDialog</name> <message> <location filename="../forms/editaddressdialog.ui" line="+14"/> <source>Edit Address</source> <translation>Uredi naslov</translation> </message> <message> <location line="+11"/> <source>&amp;Label</source> <translation>&amp;Oznaka</translation> </message> <message> <location line="+10"/> <source>The label associated with this address book entry</source> <translation>Oznaka povezana s tem vnosom v imeniku</translation> </message> <message> <location line="+7"/> <source>&amp;Address</source> <translation>&amp;Naslov</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>Naslov povezan s tem vnosom v imeniku. Spremenite ga lahko le za naslove odlivov.</translation> </message> <message> <location line="+7"/> <source>&amp;Stealth Address</source> <translation type="unfinished"></translation> </message> <message> <location filename="../editaddressdialog.cpp" line="+20"/> <source>New receiving address</source> <translation>Nov naslov za prilive</translation> </message> <message> <location line="+7"/> <source>New sending address</source> <translation>Nov naslov za odlive</translation> </message> <message> <location line="+4"/> <source>Edit receiving address</source> <translation>Uredi naslov za prilive</translation> </message> <message> <location line="+7"/> <source>Edit sending address</source> <translation>Uredi naslov za odlive</translation> </message> <message> <location line="+82"/> <source>The entered address &quot;%1&quot; is already in the address book.</source> <translation>Vnešeni naslov &quot;&amp;1&quot; je že v imeniku.</translation> </message> <message> <location line="-5"/> <source>The entered address &quot;%1&quot; is not a valid LEOcoin address.</source> <translation>Vneseni naslov &quot;%1&quot; ni veljaven LEOcoin naslov.</translation> </message> <message> <location line="+10"/> <source>Could not unlock wallet.</source> <translation>Denarnice ni bilo mogoče odkleniti.</translation> </message> <message> <location line="+5"/> <source>New key generation failed.</source> <translation>Ustvarjanje novega ključa je spodletelo.</translation> </message> </context> <context> <name>GUIUtil::HelpMessageBox</name> <message> <location filename="../guiutil.cpp" line="+526"/> <source>version</source> <translation>različica</translation> </message> <message> <location line="+0"/> <location line="+12"/> <source>LEOcoin</source> <translation type="unfinished">LEOcoin</translation> </message> <message> <location line="-10"/> <source>Usage:</source> <translation>Uporaba:</translation> </message> <message> <location line="+1"/> <source>command-line options</source> <translation>možnosti ukazne vrstice</translation> </message> <message> <location line="+4"/> <source>UI options</source> <translation>možnosti uporabniškega vmesnika</translation> </message> <message> <location line="+1"/> <source>Set language, for example &quot;de_DE&quot; (default: system locale)</source> <translation>Nastavi jezik, npr. &quot;sl_SI&quot; (privzeto: jezikovna oznaka sistema)</translation> </message> <message> <location line="+1"/> <source>Start minimized</source> <translation>Zaženi pomanjšano</translation> </message> <message> <location line="+1"/> <source>Show splash screen on startup (default: 1)</source> <translation>Prikaži splash screen ob zagonu (default: 1)</translation> </message> </context> <context> <name>LEOcoinBridge</name> <message> <location filename="../LEOcoinbridge.cpp" line="+410"/> <source>Incoming Message</source> <translation type="unfinished"></translation> </message> <message> <location line="+12"/> <source>default</source> <translation type="unfinished"></translation> </message> <message> <location line="+58"/> <source>&lt;b&gt;%1&lt;/b&gt; to %2 (%3)</source> <translation type="unfinished"></translation> </message> <message> <location line="+4"/> <source>&lt;b&gt;%1&lt;/b&gt; to LEO %2 (%3)</source> <translation type="unfinished"></translation> </message> <message> <location line="+5"/> <location line="+5"/> <source>&lt;b&gt;%1&lt;/b&gt; LEO, ring size %2 to LEO %3 (%4)</source> <translation type="unfinished"></translation> </message> <message> <location line="+4"/> <location line="+10"/> <location line="+12"/> <location line="+8"/> <source>Error:</source> <translation type="unfinished"></translation> </message> <message> <location line="-30"/> <source>Unknown txn type detected %1.</source> <translation type="unfinished"></translation> </message> <message> <location line="+10"/> <source>Input types must match for all recipients.</source> <translation type="unfinished"></translation> </message> <message> <location line="+12"/> <source>Ring sizes must match for all recipients.</source> <translation type="unfinished"></translation> </message> <message> <location line="+8"/> <source>Ring size outside range [%1, %2].</source> <translation type="unfinished"></translation> </message> <message> <location line="+8"/> <location line="+9"/> <source>Confirm send coins</source> <translation type="unfinished"></translation> </message> <message> <location line="-9"/> <source>Are you sure you want to send? Ring size of one is not anonymous, and harms the network.</source> <translation type="unfinished"></translation> </message> <message> <location line="+0"/> <location line="+9"/> <source> and </source> <translation type="unfinished"></translation> </message> <message> <location line="+0"/> <source>Are you sure you want to send %1?</source> <translation type="unfinished"></translation> </message> <message> <location line="+15"/> <location line="+25"/> <location line="+5"/> <location line="+5"/> <location line="+5"/> <location line="+6"/> <location line="+5"/> <location line="+5"/> <location line="+5"/> <location line="+5"/> <location line="+5"/> <location line="+5"/> <location line="+5"/> <location line="+5"/> <location line="+5"/> <location line="+5"/> <source>Send Coins</source> <translation type="unfinished"></translation> </message> <message> <location line="-95"/> <source>The change address is not valid, please recheck.</source> <translation type="unfinished"></translation> </message> <message> <location line="+25"/> <location line="+376"/> <source>The recipient address is not valid, please recheck.</source> <translation type="unfinished"></translation> </message> <message> <location line="-371"/> <source>The amount to pay must be larger than 0.</source> <translation type="unfinished"></translation> </message> <message> <location line="+5"/> <source>The amount exceeds your balance.</source> <translation type="unfinished"></translation> </message> <message> <location line="+5"/> <source>The total exceeds your balance when the %1 transaction fee is included.</source> <translation type="unfinished"></translation> </message> <message> <location line="+6"/> <location line="+365"/> <source>Duplicate address found, can only send to each address once per send operation.</source> <translation type="unfinished"></translation> </message> <message> <location line="-360"/> <source>Error: Transaction creation failed.</source> <translation type="unfinished"></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 type="unfinished"></translation> </message> <message> <location line="+5"/> <source>Error: Narration is too long.</source> <translation type="unfinished"></translation> </message> <message> <location line="+5"/> <source>Error: Ring Size Error.</source> <translation type="unfinished"></translation> </message> <message> <location line="+5"/> <source>Error: Input Type Error.</source> <translation type="unfinished"></translation> </message> <message> <location line="+5"/> <source>Error: Must be in full mode to send anon.</source> <translation type="unfinished"></translation> </message> <message> <location line="+5"/> <source>Error: Invalid Stealth Address.</source> <translation type="unfinished"></translation> </message> <message> <location line="+5"/> <source>The total exceeds your LEOcoin balance when the %1 transaction fee is included.</source> <translation type="unfinished"></translation> </message> <message> <location line="+5"/> <source>Error generating transaction.</source> <translation type="unfinished"></translation> </message> <message> <location line="+5"/> <source>Error generating transaction: %1</source> <translation type="unfinished"></translation> </message> <message> <location line="+304"/> <location line="+5"/> <location line="+5"/> <location line="+5"/> <location line="+5"/> <source>Send Message</source> <translation type="unfinished"></translation> </message> <message> <location line="-14"/> <source>The message can&apos;t be empty.</source> <translation type="unfinished"></translation> </message> <message> <location line="+10"/> <source>Error: Message creation failed.</source> <translation type="unfinished"></translation> </message> <message> <location line="+5"/> <source>Error: The message was rejected.</source> <translation type="unfinished"></translation> </message> <message> <location line="+98"/> <source>Sanity Error!</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Error: a sanity check prevented the transfer of a non-group private key, please close your wallet and report this error to the development team as soon as possible.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../bridgetranslations.h" line="+8"/> <source>Overview</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Wallet</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Send</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Receive</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Transactions</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Address Book</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Chat</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Notifications</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Options</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Wallet Management</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Add New Wallet</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Import Wallet</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Advanced</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Backup</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Backup Wallet</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Encrypt Wallet</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Change Passphrase</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>(Un)lock Wallet</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Tools</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Chain Data</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Block Explorer</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Sign Message</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Verify Message</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Debug</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>About LEOcoin</source> <translation type="unfinished">O LEOcoin</translation> </message> <message> <location line="+1"/> <source>About QT</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>QR code</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Address:</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Label:</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Narration:</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Amount:</source> <translation type="unfinished">Količina:</translation> </message> <message> <location line="+1"/> <source>LEO</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>mLEO</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>µLEO</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Satoshi</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Add new receive address</source> <translation type="unfinished"></translation> </message> <message> <location line="+4"/> <source>Add Address</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Add a new contact</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Address Lookup</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Address Type</source> <translation type="unfinished"></translation> </message> <message> <location line="-6"/> <source>Normal</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Stealth</source> <translation type="unfinished"></translation> </message> <message> <location line="+6"/> <source>Group</source> <translation type="unfinished"></translation> </message> <message> <location line="-5"/> <source>BIP32</source> <translation type="unfinished"></translation> </message> <message> <location line="+6"/> <source>Label</source> <translation type="unfinished">Oznaka</translation> </message> <message> <location line="+1"/> <source>Address</source> <translation type="unfinished">Naslov</translation> </message> <message> <location line="+1"/> <source>Public Key</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Transaction Hash</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Recent Transactions</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Market</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Advanced Options</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Coin Control</source> <translation type="unfinished">Kontrola kovancev</translation> </message> <message> <location line="+1"/> <source>Make payment</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Balance transfer</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Select Inputs</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Automatically selected</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Quantity:</source> <translation type="unfinished">Količina:</translation> </message> <message> <location line="+1"/> <source>Fee:</source> <translation type="unfinished">Provizija:</translation> </message> <message> <location line="+1"/> <source>After Fee:</source> <translation type="unfinished">Po proviziji:</translation> </message> <message> <location line="+1"/> <source>Bytes:</source> <translation type="unfinished">Biti:</translation> </message> <message> <location line="+1"/> <source>Priority:</source> <translation type="unfinished">Prednostno mesto:</translation> </message> <message> <location line="+1"/> <source>LowOutput:</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Change:</source> <translation type="unfinished">Sprememba:</translation> </message> <message> <location line="+1"/> <source>Custom change address</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>From account</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>PUBLIC</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>PRIVATE</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Balance:</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Ring Size:</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>To account</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Pay to</source> <translation type="unfinished"></translation> </message> <message> <location line="+135"/> <source>Tor connection offline</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>i2p connection offline</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Wallet is encrypted and currently locked</source> <translation type="unfinished"></translation> </message> <message> <location line="+3"/> <source>Wallet is syncing</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Open chat list</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Enter a label for this address to add it to your address book</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Enter a address to add it to your address book</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Inputs</source> <translation type="unfinished">Vnosi</translation> </message> <message> <location line="+1"/> <source>Values</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Outputs</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Enter a LEOcoin address to sign the message with (e.g. 8MfTCSnMvix9mVVNb2MGiEw92GpLrvzhVp)</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Enter the message you want to sign</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Click sign message to generate signature</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Copy the signed message signature</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Enter a LEOcoin address to verify the message with (e.g. 8MfTCSnMvix9mVVNb2MGiEw92GpLrvzhVp)</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Enter the message you want to verify</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Enter a LEOcoin signature</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Paste signature from clipboard</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Your total balance</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Balances overview</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Recent in/out transactions or stakes</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Select inputs to spend</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Optional address to receive transaction change</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Choose from address book</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Paste address from clipboard</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Remove this recipient</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Current spendable send payment balance</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Current spendable balance to account</source> <translation type="unfinished"></translation> </message> <message> <location line="+4"/> <source>The address to transfer the balance to</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>The label for this address</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Amount to transfer</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Send to multiple recipients at once</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Double click to edit</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Date and time that the transaction was received.</source> <translation type="unfinished">Datum in čas, ko je transakcija bila prejeta.</translation> </message> <message> <location line="+1"/> <source>Transaction status. Hover over this field to show number of confirmations.</source> <translation type="unfinished">Stanje transakcije. Zapeljite z miško čez to polje za prikaz števila potrdil. </translation> </message> <message> <location line="+1"/> <source>Type of transaction.</source> <translation type="unfinished">Vrsta transakcije.</translation> </message> <message> <location line="+1"/> <source>Destination address of transaction.</source> <translation type="unfinished">Naslov prejemnika transakcije.</translation> </message> <message> <location line="+1"/> <source>Short payment note.</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Amount removed from or added to balance.</source> <translation type="unfinished">Količina odlita ali prilita dobroimetju.</translation> </message> <message> <location line="+1"/> <source>The address to send the payment to (e.g. SXywGBZBowrppUwwNUo1GCRDTibzJi7g2M)</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Choose address from address book</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Enter a public key for the address above</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Enter a label for this group</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Name for this Wallet</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Enter a password</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Would you like to create a bip44 path?</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Your recovery phrase (Keep this safe!)</source> <translation type="unfinished"></translation> </message> <message> <location line="-80"/> <source>Recovery Phrase</source> <translation type="unfinished"></translation> </message> <message> <location line="+26"/> <source>Make Default</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Activate/Deactivate</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Set as Master</source> <translation type="unfinished"></translation> </message> <message> <location line="+4"/> <source>Not staking because wallet is offline</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>0 active connections to LEOcoin network</source> <translation type="unfinished"></translation> </message> <message> <location line="+26"/> <source>The address to send the payment to</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Enter a label for this address</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Enter a short note to send with payment (max 24 characters)</source> <translation type="unfinished"></translation> </message> <message> <location line="+20"/> <source>Wallet Name for recovered account</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Enter the password for the wallet you are trying to recover</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Is this a bip44 path?</source> <translation type="unfinished"></translation> </message> <message> <location line="-66"/> <source>ID</source> <translation type="unfinished"></translation> </message> <message> <location line="-122"/> <source>Narration</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Amount</source> <translation type="unfinished">Količina</translation> </message> <message> <location line="+1"/> <source>Default Stealth Address</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Add Recipient</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Clear All</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Suggest Ring Size</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Send Payment</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>RECEIVE</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Filter by type..</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Type</source> <translation type="unfinished">Vrsta</translation> </message> <message> <location line="+1"/> <source>Show QR Code</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>New Address</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Copy Address</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>TRANSACTIONS</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Date</source> <translation type="unfinished">Datum</translation> </message> <message> <location line="+1"/> <source>ADDRESSBOOK</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Delete</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Start Private Conversation</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Name:</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Public Key:</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Start Conversation</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Choose identity</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Identity:</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Start Group Conversation</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Group name:</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Create Group</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Invite others</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Search</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Invite others to group</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Invite to Group</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Invite</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>GROUP</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>BOOK</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Start private conversation</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Start group conversation</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>CHAT</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Leave Group</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>CHAIN DATA</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Coin Value</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Owned (Mature)</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>System (Mature)</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Spends</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Least Depth</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>BLOCK EXPLORER</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Refresh</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Hash</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Height</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Timestamp</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Value Out</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>OPTIONS</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Main</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Network</source> <translation type="unfinished">Omrežje</translation> </message> <message> <location line="+1"/> <source>Window</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Display</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>I2P</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Tor</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Start LEOcoin on system login</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Detach databases at shutdown</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Pay transaction fee:</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Optional transaction fee per kB that helps make sure your transactions are processed quickly.</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Most transactions are 1kB. Fee 0.01 recommended.</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Enable Staking</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Reserve:</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Reserved amount does not participate in staking and is therefore spendable at any time.</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Minimum Stake Interval</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Minimum Ring size:</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Maximum Ring size:</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Automatically select ring size</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Enable Secure messaging</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Thin Mode (Requires Restart)</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Thin Full Index</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Thin Index Window</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Map port using UPnP</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Connect through SOCKS proxy:</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Details</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Proxy IP:</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Port:</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>SOCKS Version:</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Minimize to the tray instead of the taskbar</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Minimize on close</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>User Interface language:</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Unit to show amounts in:</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Rows per page:</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Display addresses in transaction list</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Notifications:</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Visible Transaction Types:</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>I2P (coming soon)</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>TOR (coming soon)</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Cancel</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Apply</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Ok</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Lets create a New Wallet and Account to get you started!</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Wallet Name</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Password</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Add an optional Password to secure the Recovery Phrase (shown on next page)</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Would you like to create a Multi-Account HD Key? (BIP44)</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Language</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>English</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>French</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Japanese</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Spanish</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Chinese (Simplified)</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Chinese (Traditional)</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Next Step</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Write your Wallet Recovery Phrase</source> <translation type="unfinished"></translation> </message> <message> <location line="+2"/> <source>Important!</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>You need the Wallet Recovery Phrase to restore this wallet. Write it down and keep them somewhere safe. You will be asked to confirm the Wallet Recovery Phrase in the next screen to ensure you have written it down correctly</source> <translation type="unfinished"></translation> </message> <message> <location line="+2"/> <source>Back</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Please confirm your Wallet Recovery Phrase</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Congratulations! You have successfully created a New Wallet and Account</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>You can now use your Account to send and receive funds :) Remember to keep your Wallet Recovery Phrase and Password (if set) safe in case you ever need to recover your wallet</source> <translation type="unfinished"></translation> </message> <message> <location line="+2"/> <source>Lets import your Wallet</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>The Wallet Recovery Phrase could require a password to be imported</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Is this a Multi-Account HD Key (BIP44)</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Recovery Phrase (Usually 24 words)</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Congratulations! You have successfully imported your Wallet from your Recovery Phrase</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>You can now use your Account to send and receive funds :) Remember to keep your Wallet Recovery Phrase and Password safe in case you ever need to recover your wallet again!</source> <translation type="unfinished"></translation> </message> <message> <location line="+2"/> <source>Accounts</source> <translation type="unfinished"></translation> </message> <message> <location line="+2"/> <source>Name</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Created</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Active Account</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Default</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Wallet Keys</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Path</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Active</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Master</source> <translation type="unfinished"></translation> </message> <message> <location line="+61"/> <source>LEOcoin Notification</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>A new version of the LEOcoin wallet is available.</source> <translation type="unfinished"></translation> </message> <message> <location line="+3"/> <source>Please go to</source> <translation type="unfinished"></translation> </message> <message> <location line="+2"/> <source>and upgrade to the latest version.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>LEOcoinGUI</name> <message> <location filename="../LEOcoin.cpp" line="+111"/> <source>A fatal error occurred. LEOcoin can no longer continue safely and will quit.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../LEOcoingui.cpp" line="+89"/> <location line="+178"/> <source>LEOcoin</source> <translation type="unfinished">LEOcoin</translation> </message> <message> <location line="-178"/> <source>Client</source> <translation type="unfinished"></translation> </message> <message> <location line="+90"/> <source>E&amp;xit</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Quit application</source> <translation type="unfinished"></translation> </message> <message> <location line="+3"/> <source>&amp;About LEOcoin</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Show information about LEOcoin</source> <translation type="unfinished"></translation> </message> <message> <location line="+2"/> <source>About &amp;Qt</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Show information about Qt</source> <translation type="unfinished"></translation> </message> <message> <location line="+2"/> <source>&amp;Options...</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Modify configuration options for LEOcoin</source> <translation type="unfinished"></translation> </message> <message> <location line="+2"/> <source>&amp;Show / Hide</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>&amp;Encrypt Wallet...</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Encrypt or decrypt wallet</source> <translation type="unfinished"></translation> </message> <message> <location line="+2"/> <source>&amp;Backup Wallet...</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Backup wallet to another location</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>&amp;Change Passphrase...</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Change the passphrase used for wallet encryption</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>&amp;Unlock Wallet...</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Unlock wallet</source> <translation type="unfinished">Odkleni denarnico</translation> </message> <message> <location line="+1"/> <source>&amp;Lock Wallet</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Lock wallet</source> <translation type="unfinished"></translation> </message> <message> <location line="+4"/> <source>&amp;Debug window</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Open debugging and diagnostic console</source> <translation type="unfinished"></translation> </message> <message> <location line="+26"/> <source>&amp;File</source> <translation type="unfinished"></translation> </message> <message> <location line="+6"/> <source>&amp;Settings</source> <translation type="unfinished"></translation> </message> <message> <location line="+8"/> <source>&amp;Help</source> <translation type="unfinished"></translation> </message> <message> <location line="+19"/> <source>Wallet</source> <translation type="unfinished"></translation> </message> <message> <location line="+6"/> <location line="+9"/> <source>[testnet]</source> <translation type="unfinished"></translation> </message> <message> <location line="+0"/> <location line="+74"/> <source>LEOcoin client</source> <translation type="unfinished"></translation> </message> <message numerus="yes"> <location line="+63"/> <source>%n active connection(s) to LEOcoin network</source> <translation type="unfinished"> <numerusform></numerusform> <numerusform></numerusform> <numerusform></numerusform> <numerusform></numerusform> </translation> </message> <message> <location line="+18"/> <source>block</source> <translation type="unfinished"></translation> </message> <message> <location line="+0"/> <source>header</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>blocks</source> <translation type="unfinished"></translation> </message> <message> <location line="+0"/> <source>headers</source> <translation type="unfinished"></translation> </message> <message> <location line="+8"/> <location line="+22"/> <source>Synchronizing with network...</source> <translation type="unfinished"></translation> </message> <message> <location line="-20"/> <source>Downloading filtered blocks...</source> <translation type="unfinished"></translation> </message> <message> <location line="+6"/> <source>~%1 filtered block(s) remaining (%2% done).</source> <translation type="unfinished"></translation> </message> <message> <location line="+14"/> <source>Importing blocks...</source> <translation type="unfinished"></translation> </message> <message numerus="yes"> <location line="+5"/> <source>~%n block(s) remaining</source> <translation type="unfinished"> <numerusform></numerusform> <numerusform></numerusform> <numerusform></numerusform> <numerusform></numerusform> </translation> </message> <message> <location line="+13"/> <location line="+4"/> <source>Imported</source> <translation type="unfinished"></translation> </message> <message> <location line="-4"/> <location line="+4"/> <source>Downloaded</source> <translation type="unfinished"></translation> </message> <message> <location line="-3"/> <source>%1 of %2 %3 of transaction history (%4% done).</source> <translation type="unfinished"></translation> </message> <message> <location line="+3"/> <source>%1 blocks of transaction history.</source> <translation type="unfinished"></translation> </message> <message numerus="yes"> <location line="+23"/> <source>%n second(s) ago</source> <translation type="unfinished"> <numerusform></numerusform> <numerusform></numerusform> <numerusform></numerusform> <numerusform></numerusform> </translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n minute(s) ago</source> <translation type="unfinished"> <numerusform></numerusform> <numerusform></numerusform> <numerusform></numerusform> <numerusform></numerusform> </translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n hour(s) ago</source> <translation type="unfinished"> <numerusform></numerusform> <numerusform></numerusform> <numerusform></numerusform> <numerusform></numerusform> </translation> </message> <message numerus="yes"> <location line="+3"/> <source>%n day(s) ago</source> <translation type="unfinished"> <numerusform></numerusform> <numerusform></numerusform> <numerusform></numerusform> <numerusform></numerusform> </translation> </message> <message> <location line="+7"/> <source>Up to date</source> <translation type="unfinished"></translation> </message> <message> <location line="+12"/> <source>Catching up...</source> <translation type="unfinished"></translation> </message> <message> <location line="+16"/> <source>Last received %1 was generated %2.</source> <translation type="unfinished"></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 type="unfinished"></translation> </message> <message> <location line="+5"/> <source>Confirm transaction fee</source> <translation type="unfinished"></translation> </message> <message> <location line="+28"/> <source>Sent transaction</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Incoming transaction</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Date: %1 Amount: %2 Type: %3 Address: %4 </source> <translation type="unfinished"></translation> </message> <message> <location line="+16"/> <location line="+15"/> <source>Incoming Message</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Date: %1 From Address: %2 To Address: %3 Message: %4 </source> <translation type="unfinished"></translation> </message> <message> <location line="+45"/> <location line="+23"/> <source>URI handling</source> <translation type="unfinished"></translation> </message> <message> <location line="-23"/> <location line="+23"/> <source>URI can not be parsed! This can be caused by an invalid LEOcoin address or malformed URI parameters.</source> <translation type="unfinished"></translation> </message> <message> <location line="+42"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;unlocked&lt;/b&gt; for staking and messaging only.</source> <translation type="unfinished"></translation> </message> <message> <location line="+3"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;unlocked&lt;/b&gt; for messaging only.</source> <translation type="unfinished"></translation> </message> <message> <location line="+3"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;unlocked&lt;/b&gt; for staking only.</source> <translation type="unfinished"></translation> </message> <message> <location line="+12"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;unlocked&lt;/b&gt;</source> <translation type="unfinished"></translation> </message> <message> <location line="+25"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;locked&lt;/b&gt;</source> <translation type="unfinished"></translation> </message> <message> <location line="+33"/> <source>Backup Wallet</source> <translation type="unfinished"></translation> </message> <message> <location line="+0"/> <source>Wallet Data (*.dat)</source> <translation type="unfinished"></translation> </message> <message> <location line="+5"/> <source>Backup Failed</source> <translation type="unfinished"></translation> </message> <message> <location line="+0"/> <source>There was an error trying to save the wallet data to the new location.</source> <translation type="unfinished"></translation> </message> <message> <location line="+48"/> <source>Lock Wallet</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Error: Wallet must first be encrypted to be locked.</source> <translation type="unfinished"></translation> </message> <message numerus="yes"> <location line="+69"/> <source>%n second(s)</source> <translation type="unfinished"> <numerusform></numerusform> <numerusform></numerusform> <numerusform></numerusform> <numerusform></numerusform> </translation> </message> <message numerus="yes"> <location line="+1"/> <source>%n minute(s)</source> <translation type="unfinished"> <numerusform></numerusform> <numerusform></numerusform> <numerusform></numerusform> <numerusform></numerusform> </translation> </message> <message numerus="yes"> <location line="+1"/> <source>%n hour(s)</source> <translation type="unfinished"> <numerusform></numerusform> <numerusform></numerusform> <numerusform></numerusform> <numerusform></numerusform> </translation> </message> <message numerus="yes"> <location line="+1"/> <source>%n day(s)</source> <translation type="unfinished"> <numerusform></numerusform> <numerusform></numerusform> <numerusform></numerusform> <numerusform></numerusform> </translation> </message> <message> <location line="+9"/> <source>Staking. Your weight is %1 Network weight is %2 Expected time to earn reward is %3</source> <translation type="unfinished"></translation> </message> <message> <location line="+7"/> <source>Not staking because wallet is in thin mode</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Not staking, staking is disabled</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Not staking because wallet is locked</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Not staking because wallet is offline</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Not staking because wallet is syncing</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Not staking because you don&apos;t have mature coins</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Not staking</source> <translation type="unfinished"></translation> </message> <message> <location filename="../transactionrecord.cpp" line="+23"/> <source>Received with</source> <translation type="unfinished"></translation> </message> <message> <location line="+2"/> <source>Received from</source> <translation type="unfinished"></translation> </message> <message> <location line="+3"/> <source>Sent to</source> <translation type="unfinished"></translation> </message> <message> <location line="+2"/> <source>Payment to yourself</source> <translation type="unfinished"></translation> </message> <message> <location line="+2"/> <source>Mined</source> <translation type="unfinished"></translation> </message> <message> <location line="+2"/> <source>Received LEOcoin</source> <translation type="unfinished"></translation> </message> <message> <location line="+2"/> <source>Sent LEOcoin</source> <translation type="unfinished"></translation> </message> <message> <location line="+2"/> <source>Other</source> <translation type="unfinished"></translation> </message> </context> <context> <name>MessageModel</name> <message> <location filename="../messagemodel.cpp" line="+376"/> <source>Type</source> <translation type="unfinished">Vrsta</translation> </message> <message> <location line="+0"/> <source>Sent Date Time</source> <translation type="unfinished"></translation> </message> <message> <location line="+0"/> <source>Received Date Time</source> <translation type="unfinished"></translation> </message> <message> <location line="+0"/> <source>Label</source> <translation type="unfinished">Oznaka</translation> </message> <message> <location line="+0"/> <source>To Address</source> <translation type="unfinished"></translation> </message> <message> <location line="+0"/> <source>From Address</source> <translation type="unfinished"></translation> </message> <message> <location line="+0"/> <source>Message</source> <translation type="unfinished">Sporočilo</translation> </message> <message> <location line="+41"/> <source>Send Secure Message</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Send failed: %1.</source> <translation type="unfinished"></translation> </message> <message> <location line="+22"/> <location line="+1"/> <source>(no label)</source> <translation type="unfinished">(ni oznake)</translation> </message> </context> <context> <name>PaymentServer</name> <message> <location filename="../paymentserver.cpp" line="+107"/> <source>Cannot start LEOcoin: click-to-pay handler</source> <translation type="unfinished"></translation> </message> </context> <context> <name>PeerTableModel</name> <message> <location filename="../peertablemodel.cpp" line="+118"/> <source>Address/Hostname</source> <translation type="unfinished"></translation> </message> <message> <location line="+0"/> <source>User Agent</source> <translation type="unfinished"></translation> </message> <message> <location line="+0"/> <source>Ping Time</source> <translation type="unfinished"></translation> </message> </context> <context> <name>QObject</name> <message> <location filename="../guiutil.cpp" line="-470"/> <source>%1 d</source> <translation type="unfinished"></translation> </message> <message> <location line="+2"/> <source>%1 h</source> <translation type="unfinished"></translation> </message> <message> <location line="+2"/> <source>%1 m</source> <translation type="unfinished"></translation> </message> <message> <location line="+2"/> <location line="+55"/> <source>%1 s</source> <translation type="unfinished"></translation> </message> <message> <location line="-10"/> <source>None</source> <translation type="unfinished"></translation> </message> <message> <location line="+5"/> <source>N/A</source> <translation type="unfinished">Neznano</translation> </message> <message> <location line="+0"/> <source>%1 ms</source> <translation type="unfinished"></translation> </message> </context> <context> <name>RPCConsole</name> <message> <location filename="../forms/rpcconsole.ui" line="+46"/> <source>Client name</source> <translation>Ime odjemalca</translation> </message> <message> <location line="+10"/> <location line="+23"/> <location line="+26"/> <location line="+26"/> <location line="+23"/> <location line="+23"/> <location line="+36"/> <location line="+23"/> <location line="+36"/> <location line="+23"/> <location line="+23"/> <location line="+491"/> <location line="+23"/> <location line="+23"/> <location line="+23"/> <location line="+23"/> <location line="+23"/> <location line="+23"/> <location line="+23"/> <location line="+23"/> <location line="+23"/> <location line="+23"/> <location line="+23"/> <location line="+23"/> <location line="+23"/> <location line="+23"/> <source>N/A</source> <translation>Neznano</translation> </message> <message> <location line="-1062"/> <source>Client version</source> <translation>Različica odjemalca</translation> </message> <message> <location line="-45"/> <source>&amp;Information</source> <translation>&amp;Informacije</translation> </message> <message> <location line="-10"/> <source>LEOcoin - Debug window</source> <translation type="unfinished"></translation> </message> <message> <location line="+25"/> <source>LEOcoin Core</source> <translation type="unfinished"></translation> </message> <message> <location line="+53"/> <source>Using OpenSSL version</source> <translation>OpenSSL različica v rabi</translation> </message> <message> <location line="+26"/> <source>Using BerkeleyDB version</source> <translation type="unfinished"></translation> </message> <message> <location line="+49"/> <source>Startup time</source> <translation>Čas zagona</translation> </message> <message> <location line="+29"/> <source>Network</source> <translation>Omrežje</translation> </message> <message> <location line="+7"/> <source>Name</source> <translation type="unfinished"></translation> </message> <message> <location line="+23"/> <source>Number of connections</source> <translation>Število povezav</translation> </message> <message> <location line="+157"/> <source>Show the LEOcoin help message to get a list with possible LEOcoin command-line options.</source> <translation type="unfinished"></translation> </message> <message> <location line="+99"/> <source>&amp;Network Traffic</source> <translation type="unfinished"></translation> </message> <message> <location line="+52"/> <source>&amp;Clear</source> <translation type="unfinished"></translation> </message> <message> <location line="+16"/> <source>Totals</source> <translation type="unfinished"></translation> </message> <message> <location line="+64"/> <location filename="../rpcconsole.cpp" line="+396"/> <source>In:</source> <translation type="unfinished"></translation> </message> <message> <location line="+80"/> <location filename="../rpcconsole.cpp" line="+1"/> <source>Out:</source> <translation type="unfinished"></translation> </message> <message> <location line="+41"/> <source>&amp;Peers</source> <translation type="unfinished"></translation> </message> <message> <location line="+39"/> <location filename="../rpcconsole.cpp" line="-167"/> <location line="+328"/> <source>Select a peer to view detailed information.</source> <translation type="unfinished"></translation> </message> <message> <location line="+25"/> <source>Peer ID</source> <translation type="unfinished"></translation> </message> <message> <location line="+23"/> <source>Direction</source> <translation type="unfinished"></translation> </message> <message> <location line="+23"/> <source>Version</source> <translation type="unfinished"></translation> </message> <message> <location line="+23"/> <source>User Agent</source> <translation type="unfinished"></translation> </message> <message> <location line="+23"/> <source>Services</source> <translation type="unfinished"></translation> </message> <message> <location line="+23"/> <source>Starting Height</source> <translation type="unfinished"></translation> </message> <message> <location line="+23"/> <source>Sync Height</source> <translation type="unfinished"></translation> </message> <message> <location line="+23"/> <source>Ban Score</source> <translation type="unfinished"></translation> </message> <message> <location line="+23"/> <source>Connection Time</source> <translation type="unfinished"></translation> </message> <message> <location line="+23"/> <source>Last Send</source> <translation type="unfinished"></translation> </message> <message> <location line="+23"/> <source>Last Receive</source> <translation type="unfinished"></translation> </message> <message> <location line="+23"/> <source>Bytes Sent</source> <translation type="unfinished"></translation> </message> <message> <location line="+23"/> <source>Bytes Received</source> <translation type="unfinished"></translation> </message> <message> <location line="+23"/> <source>Ping Time</source> <translation type="unfinished"></translation> </message> <message> <location line="+23"/> <source>Time Offset</source> <translation type="unfinished"></translation> </message> <message> <location line="-866"/> <source>Block chain</source> <translation>veriga blokov</translation> </message> <message> <location line="+7"/> <source>Current number of blocks</source> <translation>Trenutno število blokov</translation> </message> <message> <location line="+23"/> <source>Estimated total blocks</source> <translation>Ocena vseh blokov</translation> </message> <message> <location line="+23"/> <source>Last block time</source> <translation>Čas zadnjega bloka</translation> </message> <message> <location line="+49"/> <source>Open the LEOcoin debug log file from the current data directory. This can take a few seconds for large log files.</source> <translation type="unfinished"></translation> </message> <message> <location line="+3"/> <source>&amp;Open</source> <translation>&amp;Odpri</translation> </message> <message> <location line="+16"/> <source>Command-line options</source> <translation>Možnosti ukazne vrstice.</translation> </message> <message> <location line="+10"/> <source>&amp;Show</source> <translation>&amp;Prikaži</translation> </message> <message> <location line="+24"/> <source>&amp;Console</source> <translation>&amp;Konzola</translation> </message> <message> <location line="-266"/> <source>Build date</source> <translation>Datum izgradnje</translation> </message> <message> <location line="+206"/> <source>Debug log file</source> <translation>Razhroščevalna dnevniška datoteka</translation> </message> <message> <location line="+109"/> <source>Clear console</source> <translation>Počisti konzolo</translation> </message> <message> <location filename="../rpcconsole.cpp" line="-197"/> <source>Welcome to the LEOcoin Core RPC console.</source> <translation type="unfinished"></translation> </message> <message> <location line="+1"/> <source>Use up and down arrows to navigate history, and &lt;b&gt;Ctrl-L&lt;/b&gt; to clear screen.</source> <translation>Za navigiranje po zgodovini uporabite puščici gor in dol, in &lt;b&gt;Ctrl-L&lt;/b&gt; za izpraznjenje zaslona.</translation> </message> <message> <location line="+1"/> <source>Type &lt;b&gt;help&lt;/b&gt; for an overview of available commands.</source> <translation>Vtipkaj &lt;b&gt;pomoč&lt;/b&gt; za vpogled v razpožljive ukaze.</translation> </message> <message> <location line="+233"/> <source>via %1</source> <translation type="unfinished"></translation> </message> <message> <location line="+3"/> <location line="+1"/> <source>never</source> <translation type="unfinished"></translation> </message> <message> <location line="+9"/> <source>Inbound</source> <translation type="unfinished"></translation> </message> <message> <location line="+0"/> <source>Outbound</source> <translation type="unfinished"></translation> </message> <message> <location line="+7"/> <source>Unknown</source> <translation type="unfinished"></translation> </message> </context> <context> <name>TrafficGraphWidget</name> <message> <location filename="../trafficgraphwidget.cpp" line="+79"/> <source>KB/s</source> <translation type="unfinished"></translation> </message> </context> <context> <name>TransactionDesc</name> <message> <location filename="../transactiondesc.cpp" line="+20"/> <source>Open until %1</source> <translation>Odpri enoto %1</translation> </message> <message numerus="yes"> <location line="-2"/> <source>Open for %n block(s)</source> <translation> <numerusform>Odprt za %n blok</numerusform> <numerusform>Odprt za %n bloka</numerusform> <numerusform>Odprt za %n blokov</numerusform> <numerusform>Odprt za %n blokov</numerusform> </translation> </message> <message> <location line="+7"/> <source>conflicted</source> <translation>sporen</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/nepotrjeno</translation> </message> <message> <location line="+2"/> <source>%1 confirmations</source> <translation>%1 potrdil</translation> </message> <message> <location line="+18"/> <source>Status</source> <translation>Stanje</translation> </message> <message numerus="yes"> <location line="+7"/> <source>, broadcast through %n node(s)</source> <translation> <numerusform>, predvajanje skozi %n vozlišče</numerusform> <numerusform>, predvajanje skozi %n vozlišči</numerusform> <numerusform>, predvajanje skozi %n vozlišč</numerusform> <numerusform>, predvajanje skozi %n vozlišč</numerusform> </translation> </message> <message> <location line="+5"/> <source>Date</source> <translation>Datum</translation> </message> <message> <location line="+7"/> <source>Source</source> <translation>Izvor</translation> </message> <message> <location line="+0"/> <source>Generated</source> <translation>Generirano</translation> </message> <message> <location line="+5"/> <location line="+17"/> <location line="+20"/> <source>From</source> <translation>Pošiljatelj</translation> </message> <message> <location line="-19"/> <location line="+20"/> <location line="+23"/> <location line="+57"/> <source>To</source> <translation>Prejemnik</translation> </message> <message> <location line="-96"/> <location line="+2"/> <location line="+18"/> <location line="+2"/> <source>own address</source> <translation>lasten naslov</translation> </message> <message> <location line="-22"/> <location line="+20"/> <source>label</source> <translation>oznaka</translation> </message> <message> <location line="+37"/> <location line="+12"/> <location line="+44"/> <location line="+20"/> <location line="+40"/> <source>Credit</source> <translation>Kredit</translation> </message> <message numerus="yes"> <location line="-114"/> <source>matures in %n more block(s)</source> <translation> <numerusform>dozori čez %n blok</numerusform> <numerusform>dozori čez %n bloka</numerusform> <numerusform>dozori čez %n blokov</numerusform> <numerusform>dozori čez %n blokov</numerusform> </translation> </message> <message> <location line="+2"/> <source>not accepted</source> <translation>ni bilo sprejeto</translation> </message> <message> <location line="+43"/> <location line="+8"/> <location line="+16"/> <location line="+42"/> <source>Debit</source> <translation>Dolg</translation> </message> <message> <location line="-52"/> <source>Transaction fee</source> <translation>Provizija transakcije</translation> </message> <message> <location line="+19"/> <source>Net amount</source> <translation>Neto količina</translation> </message> <message> <location line="+6"/> <source>Message</source> <translation>Sporočilo</translation> </message> <message> <location line="+2"/> <source>Comment</source> <translation>Opomba</translation> </message> <message> <location line="+12"/> <source>Transaction ID</source> <translation>ID transakcije</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 &quot;not accepted&quot; and it won&apos;t be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source> <translation type="unfinished"></translation> </message> <message> <location line="+7"/> <source>Debug information</source> <translation>Razhroščevalna informacija</translation> </message> <message> <location line="+8"/> <source>Transaction</source> <translation>Transakcija</translation> </message> <message> <location line="+5"/> <source>Inputs</source> <translation>Vnosi</translation> </message> <message> <location line="+44"/> <source>Amount</source> <translation>Količina</translation> </message> <message> <location line="+1"/> <source>true</source> <translation>pravilno</translation> </message> <message> <location line="+0"/> <source>false</source> <translation>nepravilno</translation> </message> <message> <location line="-266"/> <source>, has not been successfully broadcast yet</source> <translation>, še ni bil uspešno predvajan</translation> </message> <message> <location line="+36"/> <location line="+20"/> <source>unknown</source> <translation>neznano</translation> </message> </context> <context> <name>TransactionDescDialog</name> <message> <location filename="../forms/transactiondescdialog.ui" line="+14"/> <source>Transaction details</source> <translation>Podrobnosti transakcije</translation> </message> <message> <location line="+6"/> <source>This pane shows a detailed description of the transaction</source> <translation>To podokno prikazuje podroben opis transakcije</translation> </message> </context> <context> <name>TransactionTableModel</name> <message> <location filename="../transactiontablemodel.cpp" line="+217"/> <source>Date</source> <translation>Datum</translation> </message> <message> <location line="+0"/> <source>Type</source> <translation>Vrsta</translation> </message> <message> <location line="+0"/> <source>Address</source> <translation>Naslov</translation> </message> <message> <location line="+0"/> <source>Amount</source> <translation>Količina</translation> </message> <message> <location line="+54"/> <source>Open until %1</source> <translation>Odpri enoto %1</translation> </message> <message> <location line="+12"/> <source>Confirmed (%1 confirmations)</source> <translation>Potrjeno (%1 potrdil)</translation> </message> <message numerus="yes"> <location line="-15"/> <source>Open for %n more block(s)</source> <translation> <numerusform>Odprt še %n blok</numerusform> <numerusform>Odprt še %n bloka</numerusform> <numerusform>Odprt še %n blokov</numerusform> <numerusform>Odprt še %n blokov</numerusform> </translation> </message> <message> <location line="-51"/> <source>Narration</source> <translation type="unfinished"></translation> </message> <message> <location line="+57"/> <source>Offline</source> <translation>Nepovezan</translation> </message> <message> <location line="+3"/> <source>Unconfirmed</source> <translation>Nepotrjeno</translation> </message> <message> <location line="+3"/> <source>Confirming (%1 of %2 recommended confirmations)</source> <translation>Potrjuje (%1 od %2 priporočenih potrditev)</translation> </message> <message> <location line="+6"/> <source>Conflicted</source> <translation>Sporen</translation> </message> <message> <location line="+3"/> <source>Immature (%1 confirmations, will be available after %2)</source> <translation>Nezrel (%1 potrditev, na voljo bo po %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>Ta blok ni prejelo še nobeno vozlišče. Najverjetneje ne bo sprejet!</translation> </message> <message> <location line="+3"/> <source>Generated but not accepted</source> <translation>Generirano, toda ne sprejeto</translation> </message> <message> <location line="+49"/> <source>(n/a)</source> <translation>(ni na voljo)</translation> </message> <message> <location line="+202"/> <source>Transaction status. Hover over this field to show number of confirmations.</source> <translation>Stanje transakcije. Zapeljite z miško čez to polje za prikaz števila potrdil. </translation> </message> <message> <location line="+2"/> <source>Date and time that the transaction was received.</source> <translation>Datum in čas, ko je transakcija bila prejeta.</translation> </message> <message> <location line="+2"/> <source>Type of transaction.</source> <translation>Vrsta transakcije.</translation> </message> <message> <location line="+2"/> <source>Destination address of transaction.</source> <translation>Naslov prejemnika transakcije.</translation> </message> <message> <location line="+2"/> <source>Amount removed from or added to balance.</source> <translation>Količina odlita ali prilita dobroimetju.</translation> </message> </context> <context> <name>WalletModel</name> <message> <location filename="../walletmodel.cpp" line="+402"/> <location line="+246"/> <source>Sending...</source> <translation>Pošiljanje...</translation> </message> </context> <context> <name>bitcoin-core</name> <message> <location filename="../bitcoinstrings.cpp" line="+33"/> <source>LEOcoin version</source> <translation>LEOcoin različica</translation> </message> <message> <location line="+1"/> <source>Usage:</source> <translation>Uporaba:</translation> </message> <message> <location line="+1"/> <source>Send command to -server or LEOcoind</source> <translation>Pošlji ukaz na -server ali LEOcoind</translation> </message> <message> <location line="+1"/> <source>List commands</source> <translation>Prikaži ukaze</translation> </message> <message> <location line="+1"/> <source>Get help for a command</source> <translation>Prikaži pomoč za ukaz</translation> </message> <message> <location line="+2"/> <source>Options:</source> <translation>Možnosti:</translation> </message> <message> <location line="+2"/> <source>Specify configuration file (default: LEOcoin.conf)</source> <translation>Določi konfiguracijsko datoteko (privzeto: LEOcoin.conf)</translation> </message> <message> <location line="+1"/> <source>Specify pid file (default: LEOcoind.pid)</source> <translation>Določi pid datoteko (privzeto: LEOcoind.pid)</translation> </message> <message> <location line="+2"/> <source>Specify wallet file (within data directory)</source> <translation>Določi datoteko denarnice (znotraj imenika s podatki)</translation> </message> <message> <location line="-1"/> <source>Specify data directory</source> <translation>Določi podatkovni imenik</translation> </message> <message> <location line="+2"/> <source>Set database cache size in megabytes (default: 25)</source> <translation>Nastavi pomnilnik podatkovne zbirke v megabajtih (privzeto: 25)</translation> </message> <message> <location line="+1"/> <source>Set database disk log size in megabytes (default: 100)</source> <translation>Nastavi velikost zapisa podatkovne baze na disku v megabajtih (privzeto: 100)</translation> </message> <message> <location line="+6"/> <source>Listen for connections on &lt;port&gt; (default: 51737 or testnet: 51997)</source> <translation>Sprejmi povezave na &lt;port&gt; (privzeta vrata: 51737 ali testnet: 51997) </translation> </message> <message> <location line="+1"/> <source>Maintain at most &lt;n&gt; connections to peers (default: 125)</source> <translation>Obdrži maksimalno število &lt;n&gt; povezav (privzeto: 125)</translation> </message> <message> <location line="+3"/> <source>Connect to a node to retrieve peer addresses, and disconnect</source> <translation>Poveži se na vozlišče da pridobiš naslove soležnikov in prekini povezavo</translation> </message> <message> <location line="+1"/> <source>Specify your own public address</source> <translation>Določite vaš lasten javni naslov</translation> </message> <message> <location line="+5"/> <source>Bind to given address. Use [host]:port notation for IPv6</source> <translation>Naveži na dani naslov. Uporabi [host]:port ukaz za IPv6</translation> </message> <message> <location line="+2"/> <source>Stake your coins to support network and gain reward (default: 1)</source> <translation>Deleži svoje kovance za podporo omrežja in pridobi nagrado (default: 1)</translation> </message> <message> <location line="+5"/> <source>Threshold for disconnecting misbehaving peers (default: 100)</source> <translation>Prag za prekinitev povezav s slabimi odjemalci (privzeto: 1000)</translation> </message> <message> <location line="+1"/> <source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source> <translation>Število sekund preden se ponovno povežejo neodzivni soležniki (privzeto: 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>Prišlo je do napake pri nastavljanju RPC porta %u za vhodne povezave na IPv4: %s</translation> </message> <message> <location line="+51"/> <source>Detach block and address databases. Increases shutdown time (default: 0)</source> <translation>Loči podatkovne baze blokov in naslovov. Podaljša čas zaustavitve (privzeto: 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>Napaka: Transakcija je bila zavrnjena. To se je lahko zgodilo, če so bili kovanci v vaši denarnici že zapravljeni, na primer če ste uporabili kopijo wallet.dat in so bili kovanci zapravljeni v kopiji, a tu še niso bili označeni kot zapravljeni.</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>Napaka: Ta transakcija zahteva transakcijsko provizijo vsaj %s zaradi svoje količine, kompleksnosti ali uporabo sredstev, ki ste jih prejeli pred kratkim. </translation> </message> <message> <location line="-87"/> <source>Listen for JSON-RPC connections on &lt;port&gt; (default: 51736 or testnet: 51996)</source> <translation>Sprejmi povezave na &lt;port&gt; (privzeta vrata: 51737 ali testnet: 51997) </translation> </message> <message> <location line="-11"/> <source>Accept command line and JSON-RPC commands</source> <translation>Sprejmi ukaze iz ukazne vrstice in JSON-RPC</translation> </message> <message> <location line="+101"/> <source>Error: Transaction creation failed </source> <translation>Napaka: Ustvarjanje transakcije spodletelo</translation> </message> <message> <location line="-5"/> <source>Error: Wallet locked, unable to create transaction </source> <translation>Napaka: Zaklenjena denarnica, ni mogoče opraviti transakcije</translation> </message> <message> <location line="-8"/> <source>Importing blockchain data file.</source> <translation>Uvažanje blockchain podatkovne datoteke.</translation> </message> <message> <location line="+1"/> <source>Importing bootstrap blockchain data file.</source> <translation>Uvažanje podatkovne datoteke verige blokov.</translation> </message> <message> <location line="-88"/> <source>Run in the background as a daemon and accept commands</source> <translation>Teci v ozadju in sprejemaj ukaze</translation> </message> <message> <location line="+1"/> <source>Use the test network</source> <translation>Uporabi testno omrežje</translation> </message> <message> <location line="-24"/> <source>Accept connections from outside (default: 1 if no -proxy or -connect)</source> <translation>Sprejmi zunanje povezave (privzeto: 1 če ni nastavljen -proxy ali -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>Prišlo je do napake pri nastavljanju RPC porta %u za vhodne povezave na IPv6: %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>Napaka pri zagonu podatkovne baze okolja %s! Za popravilo, NAPRAVITE VARNOSTNO KOPIJO IMENIKA, in iz njega odstranite vse razen datoteke wallet.dat</translation> </message> <message> <location line="-20"/> <source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source> <translation>Nastavi maksimalno velikost visoke-prioritete/nizke-provizije transakcij v bajtih (privzeto: 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>Opozorilo: -paytxfee je nastavljen zelo visoko! To je transakcijska provizija, ki jo boste plačali ob pošiljanju transakcije.</translation> </message> <message> <location line="+61"/> <source>Warning: Please check that your computer&apos;s date and time are correct! If your clock is wrong LEOcoin will not work properly.</source> <translation>Opozorilo: Prosimo preverite svoj datum in čas svojega računalnika! Če je vaša ura nastavljena napačno LEOcoin ne bo deloval.</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>Opozorilo: napaka pri branju wallet.dat! Vsi ključi so bili pravilno prebrani, podatki o transakciji ali imenik vnešenih naslovov so morda izgubljeni ali nepravilni.</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>Opozorilo: wallet.dat je pokvarjena, podatki rešeni! Originalna wallet.dat je bila shranjena kot denarnica. {timestamp}.bak v %s; če imate napačno prikazano stanje na računu ali v transakcijah prenovite datoteko z varnostno kopijo. </translation> </message> <message> <location line="-30"/> <source>Attempt to recover private keys from a corrupt wallet.dat</source> <translation>Poizkusi rešiti zasebni ključ iz pokvarjene wallet.dat </translation> </message> <message> <location line="+4"/> <source>Block creation options:</source> <translation>Možnosti ustvarjanja blokov:</translation> </message> <message> <location line="-62"/> <source>Connect only to the specified node(s)</source> <translation>Poveži se samo na določena vozlišče(a)</translation> </message> <message> <location line="+4"/> <source>Discover own IP address (default: 1 when listening and no -externalip)</source> <translation>Odkrij svoj IP naslov (privzeto: 1 ob poslušanju, ko ni aktiviran -externalip)</translation> </message> <message> <location line="+94"/> <source>Failed to listen on any port. Use -listen=0 if you want this.</source> <translation>Poslušanje za vrata je spodletelo. Če želite lahko uporabite ukaz -listen=0.</translation> </message> <message> <location line="-90"/> <source>Find peers using DNS lookup (default: 1)</source> <translation>Najdi soležnike z uporabno DNS vpogleda (privzeto: 1)</translation> </message> <message> <location line="+5"/> <source>Sync checkpoints policy (default: strict)</source> <translation>Sinhronizacija načina točk preverjanja (privzeto: strogo)</translation> </message> <message> <location line="+83"/> <source>Invalid -tor address: &apos;%s&apos;</source> <translation>Neveljaven -tor naslov: &apos;%s&apos;</translation> </message> <message> <location line="+4"/> <source>Invalid amount for -reservebalance=&lt;amount&gt;</source> <translation>Neveljavni znesek za -reservebalance=&lt;amount&gt;</translation> </message> <message> <location line="-82"/> <source>Maximum per-connection receive buffer, &lt;n&gt;*1000 bytes (default: 5000)</source> <translation>Največji sprejemni medpomnilnik glede na povezavo, &lt;n&gt;*1000 bytov (privzeto: 5000)</translation> </message> <message> <location line="+1"/> <source>Maximum per-connection send buffer, &lt;n&gt;*1000 bytes (default: 1000)</source> <translation>Največji oddajni medpomnilnik glede na povezavo, &lt;n&gt;*1000 bytov (privzeto: 1000)</translation> </message> <message> <location line="-16"/> <source>Only connect to nodes in network &lt;net&gt; (IPv4, IPv6 or Tor)</source> <translation>Poveži se samo z vozlišči v omrežju &lt;net&gt; (IPv4, IPv6 in Tor)</translation> </message> <message> <location line="+28"/> <source>Output extra debugging information. Implies all other -debug* options</source> <translation>Output dodatnih informacij razhroščevanja. Obsega vse druge -debug* možnosti.</translation> </message> <message> <location line="+1"/> <source>Output extra network debugging information</source> <translation>Output dodatnih informacij razhroščevanja omrežja. </translation> </message> <message> <location line="+1"/> <source>Prepend debug output with timestamp</source> <translation>Opremi output rahroščevanja s časovnim žigom. </translation> </message> <message> <location line="+35"/> <source>SSL options: (see the Bitcoin Wiki for SSL setup instructions)</source> <translation>SSL možnosti: (glejte Bitcoin Wiki za navodla, kako nastaviti SSL)</translation> </message> <message> <location line="-74"/> <source>Select the version of socks proxy to use (4-5, default: 5)</source> <translation>Izberi verzijo socks proxya za uporabo (4-5, privzeto: 5)</translation> </message> <message> <location line="+41"/> <source>Send trace/debug info to console instead of debug.log file</source> <translation>Pošlji sledilne/razhroščevalne informacije v konzolo namesto jih shraniti v debug.log datoteko</translation> </message> <message> <location line="+1"/> <source>Send trace/debug info to debugger</source> <translation>Pošlji sledilne/razhroščevalne informacije v razhroščevalnik</translation> </message> <message> <location line="+28"/> <source>Set maximum block size in bytes (default: 250000)</source> <translation>Nastavi največjo velikost bloka v bajtih (privzeto: 250000)</translation> </message> <message> <location line="-1"/> <source>Set minimum block size in bytes (default: 0)</source> <translation>Nastavi najmanjšo velikost bloka v bajtih (privzeto: 0)</translation> </message> <message> <location line="-29"/> <source>Shrink debug.log file on client startup (default: 1 when no -debug)</source> <translation>Skrči debug.log datoteko ob zagonu aplikacije (privzeto: 1 ko ni aktiviran -debug)</translation> </message> <message> <location line="-42"/> <source>Specify connection timeout in milliseconds (default: 5000)</source> <translation>Določi čas pavze povezovanja v milisekundah (privzeto: 5000)</translation> </message> <message> <location line="+109"/> <source>Unable to sign checkpoint, wrong checkpointkey? </source> <translation>Ni bilo mogoče vpisati točke preverjanja, napačen ključ za točko preverjanja? </translation> </message> <message> <location line="-80"/> <source>Use UPnP to map the listening port (default: 0)</source> <translation>Uporabi UPnP za mapiranje vrat poslušanja (privzeto: 0)</translation> </message> <message> <location line="-1"/> <source>Use UPnP to map the listening port (default: 1 when listening)</source> <translation>Uporabi UPnP za mapiranje vrat poslušanja (privzeto: 1 med poslušanjem)</translation> </message> <message> <location line="-25"/> <source>Use proxy to reach tor hidden services (default: same as -proxy)</source> <translation>Uporabi proxy za povezavo s skritimi storitvami tora (privzeto: isto kot -proxy) </translation> </message> <message> <location line="+42"/> <source>Username for JSON-RPC connections</source> <translation>Uporabniško ime za JSON-RPC povezave</translation> </message> <message> <location line="+47"/> <source>Verifying database integrity...</source> <translation>Potrdite neoporečnost baze podatkov...</translation> </message> <message> <location line="+57"/> <source>WARNING: syncronized checkpoint violation detected, but skipped!</source> <translation>OPOZORILO: zaznana je bila kršitev s sinhronizirami točkami preverjanja, a je bila izpuščena.</translation> </message> <message> <location line="+1"/> <source>Warning: Disk space is low!</source> <translation>Opozorilo: Malo prostora na disku!</translation> </message> <message> <location line="-2"/> <source>Warning: This version is obsolete, upgrade required!</source> <translation>Opozorilo: ta različica je zastarela, potrebna je nadgradnja!</translation> </message> <message> <location line="-48"/> <source>wallet.dat corrupt, salvage failed</source> <translation>wallet.dat poškodovana, neuspešna obnova</translation> </message> <message> <location line="-54"/> <source>Password for JSON-RPC connections</source> <translation>Geslo za JSON-RPC povezave</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=LEOcoinrpc 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 &quot;LEOcoin Alert&quot; admin@foo.com </source> <translation>%s, nastaviti morate rpcgeslo v konfiguracijski datoteki: %s Priporočeno je, da uporabite naslednje naključno geslo: rpcuser=LEOcoinrpc rpcpassword=%s (tega gesla si vam ni potrebno zapomniti) Uporabniško ime in geslo NE SMETA biti ista. Če datoteka ne obstaja, jo ustvarite z lastniškimi dovoljenji za datoteke. Prav tako je priporočeno, da nastavite alernotify, tkako da vas opozori na probleme; na primer: alertnotify=echo %%s | mail -s &quot;LEOcoin Alarm&quot; admin@foo.com </translation> </message> <message> <location line="+51"/> <source>Find peers using internet relay chat (default: 0)</source> <translation>Najdi soležnike prek irca (privzeto: 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>Sinhroniziraj čas z drugimi vozlišči. Onemogoči, če je čas na vašem sistemu točno nastavljen, npr. sinhroniziranje z NTP (privzeto: 1)</translation> </message> <message> <location line="+15"/> <source>When creating transactions, ignore inputs with value less than this (default: 0.01)</source> <translation>Ob ustvarjanju transakcij, prezri vnose z manjšo vrednostjo kot (privzeto: 0.01)</translation> </message> <message> <location line="+16"/> <source>Allow JSON-RPC connections from specified IP address</source> <translation>Dovoli JSON-RPC povezave z določenega IP naslova</translation> </message> <message> <location line="+1"/> <source>Send commands to node running on &lt;ip&gt; (default: 127.0.0.1)</source> <translation>Pošlji ukaze vozlišču na &lt;ip&gt; (privzet: 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>Izvrši ukaz, ko se najboljši blok spremeni (%s je v cmd programu nadomeščen z zgoščenimi bloki).</translation> </message> <message> <location line="+3"/> <source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source> <translation>Izvedi ukaz, ko bo transakcija denarnice se spremenila (V cmd je bil TxID zamenjan za %s)</translation> </message> <message> <location line="+3"/> <source>Require a confirmations for change (default: 0)</source> <translation>Zahtevaj potrditve za spremembo (default: 0)</translation> </message> <message> <location line="+1"/> <source>Enforce transaction scripts to use canonical PUSH operators (default: 1)</source> <translation>Zahtevaj da transakcijske skripte uporabljajo operatorje canonical PUSH (privzeto: 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>Izvrši ukaz, ko je prejet relevanten alarm (%s je v cmd programu nadomeščen s sporočilom)</translation> </message> <message> <location line="+3"/> <source>Upgrade wallet to latest format</source> <translation>Posodobi denarnico v najnovejši zapis</translation> </message> <message> <location line="+1"/> <source>Set key pool size to &lt;n&gt; (default: 100)</source> <translation>Nastavi velikost ključa bazena na &lt;n&gt; (privzeto: 100)</translation> </message> <message> <location line="+1"/> <source>Rescan the block chain for missing wallet transactions</source> <translation>Ponovno preglej verigo blokov za manjkajoče transakcije denarnice</translation> </message> <message> <location line="+2"/> <source>How many blocks to check at startup (default: 2500, 0 = all)</source> <translation>Koliko blokov naj preveri ob zagonu aplikacije (privzeto: 2500, 0 = vse)</translation> </message> <message> <location line="+1"/> <source>How thorough the block verification is (0-6, default: 1)</source> <translation>Kako temeljito naj bo preverjanje blokov (0-6, privzeto: 1)</translation> </message> <message> <location line="+1"/> <source>Imports blocks from external blk000?.dat file</source> <translation>Uvozi bloke iz zunanje blk000?.dat datoteke</translation> </message> <message> <location line="+8"/> <source>Use OpenSSL (https) for JSON-RPC connections</source> <translation>Uporabi OpenSSL (https) za JSON-RPC povezave</translation> </message> <message> <location line="+1"/> <source>Server certificate file (default: server.cert)</source> <translation>Datoteka potrdila strežnika (privzeta: server.cert)</translation> </message> <message> <location line="+1"/> <source>Server private key (default: server.pem)</source> <translation>Zasebni ključ strežnika (privzet: server.pem)</translation> </message> <message> <location line="+1"/> <source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source> <translation>Dovoljeni kodirniki (privzeti: 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 type="unfinished"></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>OPOZORILO: Najdene so bile neveljavne točke preverjanja! Prikazane transakcije so morda napačne! Poiščite novo različico aplikacije ali pa obvestite razvijalce.</translation> </message> <message> <location line="-158"/> <source>This help message</source> <translation>To sporočilo pomoči</translation> </message> <message> <location line="+95"/> <source>Wallet %s resides outside data directory %s.</source> <translation>Denarnica %s se nahaja zunaj datotečnega imenika %s.</translation> </message> <message> <location line="+1"/> <source>Cannot obtain a lock on data directory %s. LEOcoin is probably already running.</source> <translation>Ni bilo mogoče najti podatkovnega imenika %s. Aplikacija LEOcoin je verjetno že zagnana.</translation> </message> <message> <location line="-98"/> <source>LEOcoin</source> <translation>LEOcoin</translation> </message> <message> <location line="+140"/> <source>Unable to bind to %s on this computer (bind returned error %d, %s)</source> <translation>Na tem računalniku je bilo nemogoče vezati na %s (bind returned error %d, %s)</translation> </message> <message> <location line="-130"/> <source>Connect through socks proxy</source> <translation>Poveži se skozi socks proxy</translation> </message> <message> <location line="+3"/> <source>Allow DNS lookups for -addnode, -seednode and -connect</source> <translation>Omogoči DNS povezave za -addnode, -seednode in -connect</translation> </message> <message> <location line="+122"/> <source>Loading addresses...</source> <translation>Nalaganje naslovov ...</translation> </message> <message> <location line="-15"/> <source>Error loading blkindex.dat</source> <translation>Napaka pri nalaganju blkindex.dat</translation> </message> <message> <location line="+2"/> <source>Error loading wallet.dat: Wallet corrupted</source> <translation>Napaka pri nalaganju wallet.dat: denarnica pokvarjena</translation> </message> <message> <location line="+4"/> <source>Error loading wallet.dat: Wallet requires newer version of LEOcoin</source> <translation>Napaka pri nalaganju wallet.dat: denarnica zahteva novejšo verzijo LEOcoin</translation> </message> <message> <location line="+1"/> <source>Wallet needed to be rewritten: restart LEOcoin to complete</source> <translation>Denarnica mora biti prepisana: ponovno odprite LEOcoin za dokončanje</translation> </message> <message> <location line="+1"/> <source>Error loading wallet.dat</source> <translation>Napaka pri nalaganju wallet.dat</translation> </message> <message> <location line="-16"/> <source>Invalid -proxy address: &apos;%s&apos;</source> <translation>Neveljaven -proxy naslov: &apos;%s&apos;</translation> </message> <message> <location line="-1"/> <source>Unknown network specified in -onlynet: &apos;%s&apos;</source> <translation>Neznano omrežje določeno v -onlynet: &apos;%s&apos;</translation> </message> <message> <location line="-1"/> <source>Unknown -socks proxy version requested: %i</source> <translation>Zahtevana neznana -socks proxy različica: %i</translation> </message> <message> <location line="+4"/> <source>Cannot resolve -bind address: &apos;%s&apos;</source> <translation>Ni mogoče določiti -bind naslova: &apos;%s&apos;</translation> </message> <message> <location line="+2"/> <source>Cannot resolve -externalip address: &apos;%s&apos;</source> <translation>Ni mogoče določiti -externalip naslova: &apos;%s&apos;</translation> </message> <message> <location line="-24"/> <source>Invalid amount for -paytxfee=&lt;amount&gt;: &apos;%s&apos;</source> <translation>Neveljavni znesek za -paytxfee=&lt;amount&gt;: &apos;%s&apos;</translation> </message> <message> <location line="+44"/> <source>Error: could not start node</source> <translation>Napaka: ni mogoče zagnati vozlišča</translation> </message> <message> <location line="+11"/> <source>Sending...</source> <translation>Pošiljanje...</translation> </message> <message> <location line="+5"/> <source>Invalid amount</source> <translation>Neveljavna količina</translation> </message> <message> <location line="+1"/> <source>Insufficient funds</source> <translation>Premalo sredstev</translation> </message> <message> <location line="-34"/> <source>Loading block index...</source> <translation>Nalaganje indeksa blokov ...</translation> </message> <message> <location line="-103"/> <source>Add a node to connect to and attempt to keep the connection open</source> <translation>Dodaj vozlišče za povezavo nanj in skušaj le to obdržati odprto</translation> </message> <message> <location line="+122"/> <source>Unable to bind to %s on this computer. LEOcoin is probably already running.</source> <translation>Navezava v %s na tem računalniku ni mogoča LEOcoin aplikacija je verjetno že zagnana.</translation> </message> <message> <location line="-97"/> <source>Fee per KB to add to transactions you send</source> <translation>Provizija na KB ki jo morate dodati transakcijam, ki jih pošiljate</translation> </message> <message> <location line="+55"/> <source>Invalid amount for -mininput=&lt;amount&gt;: &apos;%s&apos;</source> <translation>Neveljavni znesek za -miniput=&lt;amount&gt;: &apos;%s&apos;</translation> </message> <message> <location line="+25"/> <source>Loading wallet...</source> <translation>Nalaganje denarnice ...</translation> </message> <message> <location line="+8"/> <source>Cannot downgrade wallet</source> <translation>Ne morem </translation> </message> <message> <location line="+1"/> <source>Cannot initialize keypool</source> <translation>Ni mogoče zagnati keypoola</translation> </message> <message> <location line="+1"/> <source>Cannot write default address</source> <translation>Ni mogoče zapisati privzetega naslova</translation> </message> <message> <location line="+1"/> <source>Rescanning...</source> <translation>Ponovno pregledovanje ...</translation> </message> <message> <location line="+5"/> <source>Done loading</source> <translation>Nalaganje končano</translation> </message> <message> <location line="-167"/> <source>To use the %s option</source> <translation>Za uporabo %s opcije</translation> </message> <message> <location line="+14"/> <source>Error</source> <translation>Napaka</translation> </message> <message> <location line="+6"/> <source>You must set rpcpassword=&lt;password&gt; in the configuration file: %s If the file does not exist, create it with owner-readable-only file permissions.</source> <translation>Nastaviti morate rpcpassword=&lt;password&gt; v konfiguracijski datoteki: %s Če datoteka ne obstaja, jo ustvarite z lastniškimi dovoljenji za datoteke.</translation> </message> </context> </TS>
Leocoin-project/LEOcoin
src/qt/locale/LEOcoin_sl_SI.ts
TypeScript
mit
148,042
<?php /** * This is a Loom pagecontroller. * Show search form and overview of movies * together with administration links like edit, delete, ... * */ // Include the essential config-file which also creates the $loom variable with its defaults. include(__DIR__.'/config.php'); // Do it and store it all in variables in the Loom container. // Add style for movie_db $loom['stylesheets'][] = 'css/movie.css'; $loom['title'] = "movieDb"; // Connect to a MySQL database using PHP PDO $db = new CDatabase($loom['database']); if (isset($_POST['title'])) { // User is searchin movies through search form $movieSearch = new CRMMovieSearch($db, $_POST); $out = $movieSearch->output(); } else { // User is searchin movies via url query $movieSearch = new CRMMovieSearch($db, $_GET); // Get html-output for movie search form and // movie search results. $out = $movieSearch->output(); } // Do it and store it all in variables in the Loom container. $loom['title'] = "Filmer - Administration"; $loom['main'] = <<<EOD <h1>{$loom['title']}</h1> $out EOD; // Finally, leave it all to the rendering phase of Loom. include(LOOM_THEME_PATH);
fnlive/loom
webroot/rm-movieadminview.php
PHP
mit
1,167
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. using MixedRealityToolkit.InputModule.EventData; using UnityEngine.EventSystems; namespace MixedRealityToolkit.InputModule.InputHandlers { /// <summary> /// Interface to implement to react to speech recognition. /// </summary> public interface ISpeechHandler : IEventSystemHandler { void OnSpeechKeywordRecognized(SpeechEventData eventData); } }
davidezordan/MixedRealitySamples
Two-hands manipulation/Assets/MixedRealityToolkit/InputModule/Scripts/InputHandlers/ISpeechHandler.cs
C#
mit
535
import sys [_, ms, _, ns] = list(sys.stdin) ms = set(int(m) for m in ms.split(' ')) ns = set(int(n) for n in ns.split(' ')) print(sep='\n', *sorted(ms.difference(ns).union(ns.difference(ms))))
alexander-matsievsky/HackerRank
All_Domains/Python/Sets/symmetric-difference.py
Python
mit
194
package org.innovateuk.ifs.management.publiccontent.formpopulator.section; import org.innovateuk.ifs.competition.publiccontent.resource.PublicContentSectionType; import org.innovateuk.ifs.management.publiccontent.form.section.ScopeForm; import org.innovateuk.ifs.management.publiccontent.formpopulator.PublicContentFormPopulator; import org.innovateuk.ifs.management.publiccontent.formpopulator.AbstractContentGroupFormPopulator; import org.springframework.stereotype.Service; @Service public class ScopeFormPopulator extends AbstractContentGroupFormPopulator<ScopeForm> implements PublicContentFormPopulator<ScopeForm> { @Override protected ScopeForm createInitial() { return new ScopeForm(); } @Override protected PublicContentSectionType getType() { return PublicContentSectionType.SCOPE; } }
InnovateUKGitHub/innovation-funding-service
ifs-web-service/ifs-competition-mgt-service/src/main/java/org/innovateuk/ifs/management/publiccontent/formpopulator/section/ScopeFormPopulator.java
Java
mit
842
import os import numpy as np class Dataset(object): """ This class represents a dataset and consists of a list of SongData along with some metadata about the dataset """ def __init__(self, songs_data=None): if songs_data is None: self.songs_data = [] else: self.songs_data = songs_data def add_song(self, song_data): self.songs_data.append(song_data) def songs(self): for s in self.songs_data: yield s @property def num_features(self): if len(self.songs_data): return self.songs_data[0].X.shape[1] @property def size(self): return len(self.songs_data) def __repr__(self): return ', '.join([s.name for s in self.songs()]) class SongData(object): """ This class holds features, labels, and metadata for a song. """ def __init__(self, audio_path, label_path): if not os.path.isfile(audio_path): raise IOError("Audio file at %s does not exist" % audio_path) if label_path and not os.path.isfile(label_path): raise IOError("MIDI file at %s does not exist" % label_path) self.audio_path = audio_path self.label_path = label_path """ x [num_samples,] is the samples of the song """ @property def x(self): return self.__x @x.setter def x(self, x): self.__x = x """ X [num_frames x num_features] is the feature matrix for the song """ @property def X(self): return self.__X @X.setter def X(self, X): if hasattr(self, 'Y') and self.Y.shape[0] != X.shape[0]: raise ValueError("Number of feature frames must equal number of label frames") self.__X = X """ Y [num_frames x num_pitches] is the label matrix for the song """ @property def Y(self): return self.__Y @Y.setter def Y(self, Y): if hasattr(self, 'X') and self.X.shape[0] != Y.shape[0]: raise ValueError("Number of label frames must equal number of feature frames") self.__Y = Y @property def num_pitches(self): if hasattr(self, 'Y'): return np.shape(self.Y)[1] return 0 @property def num_features(self): if hasattr(self, 'X'): return self.X.shape[1] @property def num_frames(self): if hasattr(self, 'X'): return self.X.shape[0] @property def name(self): return os.path.splitext(os.path.split(self.audio_path)[-1])[0]
Guitar-Machine-Learning-Group/guitar-transcriber
dataset.py
Python
mit
2,586
import gevent import time def doit(i): print "do it:%s" % (i) gevent.sleep(2) print "done:%s" %(i) t2 = time.time() threads = {} for i in range(5): t = gevent.spawn(doit, i) threads[i] = t #print dir(t) gevent.sleep(1) print threads print threads[3].dead threads[3].kill() print threads[3].dead del threads[3] threads[2].kill() print threads #gevent.sleep(3) print time.time() - t2 for i in threads: print threads[ i ].dead #print t gevent.sleep(3) print time.time() - t2 for i in threads: print threads[ i ].dead
mabotech/maboss.py
maboss/motorx/scheduler/test01.py
Python
mit
577
import sys import os import time import numpy import cv2 import cv2.cv as cv from PIL import Image sys.path.insert(0, os.path.join( os.path.dirname(os.path.dirname(os.path.dirname(__file__))))) from picture.util import define from picture.util.system import POINT from picture.util.log import LOG as L THRESHOLD = 0.96 class PatternMatch(object): def __init__(self): pass @classmethod def __patternmatch(self, reference, target): L.info("reference : %s" % reference) img_rgb = cv2.imread(reference) img_gray = cv2.cvtColor(img_rgb, cv2.COLOR_BGR2GRAY) template = cv2.imread(target, 0) w, h = template.shape[::-1] res = cv2.matchTemplate(img_gray,template,cv2.TM_CCOEFF_NORMED) loc = numpy.where( res >= THRESHOLD) result = None for pt in zip(*loc[::-1]): result = POINT(pt[0], pt[1], w, h) return result @classmethod def bool(self, reference, target): result = PatternMatch.__patternmatch(reference, target) if result is None: return False else: return True @classmethod def coordinate(self, reference, target): return PatternMatch.__patternmatch(reference, target) if __name__ == "__main__": pmc = PatternMatch() print pmc.bool(os.path.join(define.APP_TMP,"screen.png"), os.path.join(define.APP_TMP,"login.png"))
setsulla/owanimo
lib/picture/bin/patternmatch.py
Python
mit
1,439
export var lusolveDocs = { name: 'lusolve', category: 'Algebra', syntax: ['x=lusolve(A, b)', 'x=lusolve(lu, b)'], description: 'Solves the linear system A * x = b where A is an [n x n] matrix and b is a [n] column vector.', examples: ['a = [-2, 3; 2, 1]', 'b = [11, 9]', 'x = lusolve(a, b)'], seealso: ['lup', 'slu', 'lsolve', 'usolve', 'matrix', 'sparse'] };
Michayal/michayal.github.io
node_modules/mathjs/es/expression/embeddedDocs/function/algebra/lusolve.js
JavaScript
mit
371
/** * Copyright (C) 2014 Kasper Kronborg Isager. */ package dk.itu.donkey; // SQL utilities import java.sql.SQLException; /** * The Schema class is used for executing Data Definition Language (DDL) * statements against a database thus handling schema definition. * * @see <a href="https://en.wikipedia.org/wiki/Data_definition_language"> * Wikipedia - Data definition language</a> * * @since 1.0.0 Initial release. */ public final class Schema { /** * The database to run the schema against. */ private Database db; /** * The SQL grammar to use for the schema. */ private Grammar grammar; /** * Initialize a new schema. * * @param db The database to run the schema against. */ public Schema(final Database db) { this.db = db; this.grammar = db.grammar(); } /** * Begin a table creation statement. * * @param table The name of the table to create. * @return The current {@link Schema} object, for chaining. */ public Schema create(final String table) { this.grammar.addTable(table); return this; } /** * Run the create statement. * * @throws SQLException In case of a SQL error. */ public void run() throws SQLException { this.db.execute(this.grammar.compileCreate()); } /** * Drop a database table. * * @param table The table to drop from the database. * * @throws SQLException In case of a SQL error. */ public void drop(final String table) throws SQLException { this.grammar.addTable(table); this.db.execute(this.grammar.compileDrop()); } /** * Add a text column to the schema. * * @param column The name of the column. * @return The current {@link Schema} object, for chaining. */ public Schema text(final String column) { this.grammar.addDataType(column, "text", true); return this; } /** * Add an integer column to the schema. * * @param column The name of the column. * @return The current {@link Schema} object, for chaining. */ public Schema integer(final String column) { this.grammar.addDataType(column, "integer", true); return this; } /** * Add a double column to the schema. * * @param column The name of the column. * @return The current {@link Schema} object, for chaining. */ public Schema doublePrecision(final String column) { this.grammar.addDataType(column, "double precision", true); return this; } /** * Add a float column to the schema. * * @param column The name of the column. * @return The current {@link Schema} object, for chaining. */ public Schema floatingPoint(final String column) { this.grammar.addDataType(column, "float", 24, true); return this; } /** * Add a long column to the schema. * * @param column The name of the column. * @return The current {@link Schema} object, for chaining. */ public Schema longInteger(final String column) { this.grammar.addDataType(column, "bigint", true); return this; } /** * Add a real column to the schema. * * @param column The name of the column. * @return The current {@link Schema} object, for chaining. */ public Schema real(final String column) { this.grammar.addDataType(column, "real", true); return this; } /** * Add a numeric column to the schema. * * @param column The name of the column. * @return The current {@link Schema} object, for chaining. */ public Schema numeric(final String column) { this.grammar.addDataType(column, "numeric", true); return this; } /** * Add a boolean column to the schema. * * @param column The name of the column. * @return The current {@link Schema} object, for chaining. */ public Schema bool(final String column) { this.grammar.addDataType(column, "boolean", true); return this; } /** * Add a date column to the schema. * * @param column The name of the column. * @return The current {@link Schema} object, for chaining. */ public Schema date(final String column) { this.grammar.addDataType(column, "date", true); return this; } /** * Add a time column to the schema. * * @param column The name of the column. * @return The current {@link Schema} object, for chaining. */ public Schema time(final String column) { this.grammar.addDataType(column, "time", true); return this; } /** * Add a timestamp column to the schema. * * @param column The name of the column. * @return The current {@link Schema} object, for chaining. */ public Schema timestamp(final String column) { this.grammar.addDataType(column, "timestamp", true); return this; } /** * Add an auto incrementing integer column to the schema. * * @param column The name of the column. * @return The current {@link Schema} object, for chaining. */ public Schema increments(final String column) { this.grammar.addAutoIncrement(column); return this; } /** * Add a foreign key to the schema. * * @param column The name of the column. * @param foreignTable The name of the foreign table. * @param foreignColumn The name of the foreign column. * @return The current {@link Schema} object, for chaining. */ public Schema foreignKey( final String column, final String foreignTable, final String foreignColumn ) { this.grammar.addForeignKey(column, foreignTable, foreignColumn); return this; } }
kasperisager/bookie
src/main/java/dk/itu/donkey/Schema.java
Java
mit
5,660
class EducatorSectionAssignmentRow < Struct.new(:row, :school_ids_dictionary) # Represents a row in a CSV export from Somerville's Aspen X2 student information system. # This structure represents student section assignments. # # Expects the following headers: # # :local_id, :course_number, :school_local_id, :section_number, # :term_local_id # def self.build(row) new(row).build end def build if educator and section educator_section_assignment = EducatorSectionAssignment.find_or_initialize_by(educator: educator, section: section) return educator_section_assignment end end def educator return Educator.find_by_local_id(row[:local_id]) if row[:local_id] end def section return Section.find_by_section_number(row[:section_number]) if row[:section_number] end end
jhilde/studentinsights
app/importers/rows/educator_section_assignment_row.rb
Ruby
mit
926
def output_gpx(points, output_filename): """ Output a GPX file with latitude and longitude from the points DataFrame. """ from xml.dom.minidom import getDOMImplementation def append_trkpt(pt, trkseg, doc): trkpt = doc.createElement('trkpt') trkpt.setAttribute('lat', '%.8f' % (pt['lat'])) trkpt.setAttribute('lon', '%.8f' % (pt['lon'])) trkseg.appendChild(trkpt) doc = getDOMImplementation().createDocument(None, 'gpx', None) trk = doc.createElement('trk') doc.documentElement.appendChild(trk) trkseg = doc.createElement('trkseg') trk.appendChild(trkseg) points.apply(append_trkpt, axis=1, trkseg=trkseg, doc=doc) with open(output_filename, 'w') as fh: doc.writexml(fh, indent=' ') def main(): points = get_data(sys.argv[1]) print('Unfiltered distance: %0.2f' % (distance(points),)) smoothed_points = smooth(points) print('Filtered distance: %0.2f' % (distance(smoothed_points),)) output_gpx(smoothed_points, 'out.gpx') if __name__ == '__main__': main()
MockyJoke/numbers
ex3/code/calc_distance_hint.py
Python
mit
1,089
<?php require_once(__DIR__ . "/../model/config.php"); $username = filter_input(INPUT_POST, "username", FILTER_SANITIZE_STRING); $password = filter_input(INPUT_POST, "password", FILTER_SANITIZE_STRING); $salt = "$5$" . "rounds=5000$" . uniqid(mt_rand(), true) . "$"; $hashedPassword = crypt($password, $salt); $query = $_SESSION["connection"]->query("INSERT INTO users SET " . "email = '$email', " . "username = '$username', " . "password = '$hashedPassword', " . "salt = '$salt', " . "exp = 0, " . "exp1 = 0, " . "exp2 = 0, " . "exp3 = 0, " . "exp4 = 0"); $_SESSION["name"] = $username; if ($query) { echo "true"; } else { echo "<p>" . $_SESSION["connection"]->error . "</p>"; }
RaulRamir/awsomenauts
php/controller/create-user.php
PHP
mit
925
/* * PaintableShape.cpp * * Created on: Mar 19, 2017 * Author: Brian Schnepp * License: See 'LICENSE' in root of this repository. */ #include <PathToolKit/graphic/gstructs.h> #include <PathToolKit/graphic/PaintableShape.h> #include <PathToolKit/gutil/Color.h> #include <cstdlib> namespace PathDraw { PaintableShape::PaintableShape() { this->fill = true; this->stroke = static_cast<PTK_Stroke*>(malloc(sizeof(PTK_Stroke))); this->stroke->colors = { new Color(0,0,0)}; this->stroke->joinstyle = PTK_Join_Style::JOIN_MITER; this->stroke->capstyle = PTK_Cap_Style::CAP_BUTT; } PaintableShape::~PaintableShape() { delete[] this->stroke->colors; free(this->stroke); } uint16_t PaintableShape::GetNumPoints() { //Circle/Arcs should always return 1 //Shape should do this as intended. return 0; } PTK_Point* PaintableShape::GetPoints() { //Circle/arc should return their single point as a pointer. return nullptr; } bool PaintableShape::GetFill() { return this->fill; } void PaintableShape::SetFill(bool fill) { this->fill = fill; } bool PaintableShape::IsArc() { return false; } bool PaintableShape::IsCircle() { return false; } bool PaintableShape::isRectangle() { return false; } bool PaintableShape::isIrregularArc() { return false; } bool PaintableShape::isIrregularCircle() { return false; } void PaintableShape::SetStroke(PTK_Stroke* stroke) { delete this->stroke; this->stroke = stroke; } PTK_Stroke PaintableShape::GetStroke() { return *(this->stroke); } void PaintableShape::SetSolidColor(Color* color) { free(this->stroke->colors); this->stroke->colors = color; } void PaintableShape::SetLinearGradientColor(Color* color1, Color* color2) { free(this->stroke->colors); Color colors[2] = new Color[2]; colors[0] = *color1; colors[1] = *color2; this->stroke->colors = colors; //Gradients can only be between two colors. } void PaintableShape::SetGradientRadial(bool val) { this->stroke->radial = val; } } /* namespace Pathfinder */
bSchnepp/PathToolKit
PathToolKit/graphic/PaintableShape.cpp
C++
mit
2,001
/* Copyright (c) 2017, Dogan Yazar 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. */ /** * Remove commonly used diacritic marks from a string as these * are not used in a consistent manner. Leave only ä, ö, å. */ var remove_diacritics = function(text) { text = text.replace('à', 'a'); text = text.replace('À', 'A'); text = text.replace('á', 'a'); text = text.replace('Á', 'A'); text = text.replace('è', 'e'); text = text.replace('È', 'E'); text = text.replace('é', 'e'); text = text.replace('É', 'E'); return text; }; // export the relevant stuff. exports.remove_diacritics = remove_diacritics;
Hugo-ter-Doest/natural
lib/natural/normalizers/normalizer_sv.js
JavaScript
mit
1,642
#!/usr/bin/env python # -*- coding: utf-8 -*- import json import urllib import time import datetime #From PatMap by Jason Young, available on GitHub at github.com/JasYoung314/PatMap #Function to get distance between 2 points from google maps. By default route is by car, distance is given in miles and time in minutes. def CalculateDistance(Origin = False,Destination = False, Method = "driving",TimeUnits = "Minutes",DistUnits = "Miles"): #this is the start of a distnace matrix url base = "https://maps.googleapis.com/maps/api/distancematrix/json?" #Converts the variables to the required format urlorigin = "origins=%s&".encode('utf-8') %(Origin) urldestination = "destinations=%s&".encode('utf-8') %(Destination) urlmethod = "mode=%s&" %(Method) if DistUnits == "Kilometers" or DistUnits == "Meters": urlunits = "units=metric&" else: urlunits = "units=imperial&" #constructs the completed url url = base.decode('utf-8') + urlorigin.decode('utf-8') + urldestination.decode('utf-8') + urlmethod.decode('utf-8') + urlunits.decode('utf-8') + "language=en-EN&sensor=false".decode('utf-8') #Interprets the json data recieved try: result= json.load(urllib.urlopen(url)) except: return 'ERROR','ERROR' #Reads the status code and takes the appropriate action if result["status"] == "OK": if result["rows"][0]["elements"][0]["status"] == "OK": time = result["rows"][0]["elements"][0]["duration"]["value"] distance = result["rows"][0]["elements"][0]["distance"]["value"] if TimeUnits == "Minutes": time = time/60.0 elif TimeUnits == "Hours": time = time/3600.0 if DistUnits == "Kilometres": distance = distance/1000.0 elif DistUnits == "Yards": distance = distance*1.0936133 elif DistUnits == "Miles": distance = distance*0.000621371192 return time,distance else: return result["rows"][0]["elements"][0]["status"],result["rows"][0]["elements"][0]["status"] else: return result["status"]
MatthewGWilliams/Staff-Transport
emergencyTransport/RouteFinder/GoogleDistances.py
Python
mit
1,984
import { StyleSheet } from "react-native"; const styles = StyleSheet.create({ container: { flex: 1, justifyContent: "flex-start", alignItems: "center", backgroundColor: "#669999" }, buttons: { // flex: 0.15, flexDirection: "row", alignItems: "center", marginVertical: 20 }, button: { marginHorizontal: 20, padding: 20, backgroundColor: "#0D4D4D", color: "white", textAlign: "center" }, selectedButton: { backgroundColor: "#006699" }, body: { // flex: 0.8, justifyContent: "flex-start", alignItems: "center" }, subTitle: { marginVertical: 10 }, viewport: { // flex: 1, alignSelf: "center", backgroundColor: "white" } }); export default styles;
machadogj/react-native-layout-tester
styles.js
JavaScript
mit
869
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers // Copyright (c) 2015-2021 The Neutron Developers // // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "rpcconsole.h" #include "ui_rpcconsole.h" #include "clientmodel.h" #include "bitcoinrpc.h" #include "guiutil.h" #include "main.h" #include "util.h" #ifdef USE_UPNP // used to retrieve miniupnpc version #include <miniupnpc/miniupnpc.h> #endif #ifdef ENABLE_WALLET #include <db_cxx.h> #endif #include <QDir> #include <QTime> #include <QTimer> #include <QThread> #include <QTextEdit> #include <QKeyEvent> #include <QUrl> #include <QScrollBar> #include <QStringList> #include <QDesktopServices> #include <QAbstractItemView> #include <openssl/crypto.h> #ifdef USE_UPNP static const string MINIUPNPC_VERSION_NUM = strprintf("MiniUPnPc %s", MINIUPNPC_VERSION); #else static const string MINIUPNPC_VERSION_NUM = strprintf("MiniUPnPc Disabled"); #endif // TODO: make it possible to filter out categories (esp debug messages when implemented) // TODO: receive errors and debug messages through ClientModel const int CONSOLE_SCROLLBACK = 50; const int CONSOLE_HISTORY = 50; const QSize ICON_SIZE(24, 24); // Repair parameters const QString SALVAGEWALLET("-salvagewallet"); const QString RESCAN("-rescan"); const QString ZAPTXES1("-zapwallettxes=1"); const QString ZAPTXES2("-zapwallettxes=2"); const QString UPGRADEWALLET("-upgradewallet"); const QString REINDEX("-reindex"); const struct { const char *url; const char *source; } ICON_MAPPING[] = { {"cmd-request", ":/icons/tx_input"}, {"cmd-reply", ":/icons/tx_output"}, {"cmd-error", ":/icons/tx_output"}, {"misc", ":/icons/tx_inout"}, {NULL, NULL} }; namespace { // don't add private key handling cmd's to the history const QStringList historyFilter = QStringList() << "importprivkey" << "importmulti" << "signmessagewithprivkey" << "signrawtransaction" << "walletpassphrase" << "walletpassphrasechange" << "encryptwallet"; } /* Object for executing console RPC commands in a separate thread. */ class RPCExecutor: public QObject { Q_OBJECT public slots: void start(); void request(const QString &command); signals: void reply(int category, const QString &command); }; #include "rpcconsole.moc" void RPCExecutor::start() { // Nothing to do } /** * Split shell command line into a list of arguments and optionally execute the command(s). * Aims to emulate \c bash and friends. * * - Command nesting is possible with parenthesis; for example: validateaddress(getnewaddress()) * - Arguments are delimited with whitespace or comma * - Extra whitespace at the beginning and end and between arguments will be ignored * - Text can be "double" or 'single' quoted * - The backslash \c \ is used as escape character * - Outside quotes, any character can be escaped * - Within double quotes, only escape \c " and backslashes before a \c " or another backslash * - Within single quotes, no escaping is possible and no special interpretation takes place * * @param[out] result stringified Result from the executed command(chain) * @param[in] strCommand Command line to split * @param[in] fExecute set true if you want the command to be executed * @param[out] pstrFilteredOut Command line, filtered to remove any sensitive data */ bool RPCConsole::RPCParseCommandLine(std::string &strResult, const std::string &strCommand, const bool fExecute, std::string * const pstrFilteredOut) { std::vector< std::vector<std::string> > stack; stack.push_back(std::vector<std::string>()); enum CmdParseState { STATE_EATING_SPACES, STATE_EATING_SPACES_IN_ARG, STATE_EATING_SPACES_IN_BRACKETS, STATE_ARGUMENT, STATE_SINGLEQUOTED, STATE_DOUBLEQUOTED, STATE_ESCAPE_OUTER, STATE_ESCAPE_DOUBLEQUOTED, STATE_COMMAND_EXECUTED, STATE_COMMAND_EXECUTED_INNER } state = STATE_EATING_SPACES; std::string curarg; UniValue lastResult; unsigned nDepthInsideSensitive = 0; size_t filter_begin_pos = 0, chpos; std::vector<std::pair<size_t, size_t>> filter_ranges; auto add_to_current_stack = [&](const std::string& strArg) { if (stack.back().empty() && (!nDepthInsideSensitive) && historyFilter.contains(QString::fromStdString(strArg), Qt::CaseInsensitive)) { nDepthInsideSensitive = 1; filter_begin_pos = chpos; } // Make sure stack is not empty before adding something if (stack.empty()) { stack.push_back(std::vector<std::string>()); } stack.back().push_back(strArg); }; auto close_out_params = [&]() { if (nDepthInsideSensitive) { if (!--nDepthInsideSensitive) { assert(filter_begin_pos); filter_ranges.push_back(std::make_pair(filter_begin_pos, chpos)); filter_begin_pos = 0; } } stack.pop_back(); }; std::string strCommandTerminated = strCommand; if (strCommandTerminated.back() != '\n') strCommandTerminated += "\n"; for (chpos = 0; chpos < strCommandTerminated.size(); ++chpos) { char ch = strCommandTerminated[chpos]; switch(state) { case STATE_COMMAND_EXECUTED_INNER: case STATE_COMMAND_EXECUTED: { bool breakParsing = true; switch(ch) { case '[': curarg.clear(); state = STATE_COMMAND_EXECUTED_INNER; break; default: if (state == STATE_COMMAND_EXECUTED_INNER) { if (ch != ']') { // append char to the current argument (which is also used for the query command) curarg += ch; break; } if (curarg.size() && fExecute) { // if we have a value query, query arrays with index and objects with a string key UniValue subelement; if (lastResult.isArray()) { for(char argch: curarg) if (!std::isdigit(argch)) throw std::runtime_error("Invalid result query"); subelement = lastResult[atoi(curarg.c_str())]; } else if (lastResult.isObject()) subelement = find_value(lastResult, curarg); else throw std::runtime_error("Invalid result query"); //no array or object: abort lastResult = subelement; } state = STATE_COMMAND_EXECUTED; break; } // don't break parsing when the char is required for the next argument breakParsing = false; // pop the stack and return the result to the current command arguments close_out_params(); // don't stringify the json in case of a string to avoid doublequotes if (lastResult.isStr()) curarg = lastResult.get_str(); else curarg = lastResult.write(2); // if we have a non empty result, use it as stack argument otherwise as general result if (curarg.size()) { if (stack.size()) add_to_current_stack(curarg); else strResult = curarg; } curarg.clear(); // assume eating space state state = STATE_EATING_SPACES; } if (breakParsing) break; } case STATE_ARGUMENT: // In or after argument case STATE_EATING_SPACES_IN_ARG: case STATE_EATING_SPACES_IN_BRACKETS: case STATE_EATING_SPACES: // Handle runs of whitespace switch(ch) { case '"': state = STATE_DOUBLEQUOTED; break; case '\'': state = STATE_SINGLEQUOTED; break; case '\\': state = STATE_ESCAPE_OUTER; break; case '(': case ')': case '\n': if (state == STATE_EATING_SPACES_IN_ARG) throw std::runtime_error("Invalid Syntax"); if (state == STATE_ARGUMENT) { if (ch == '(' && stack.size() && stack.back().size() > 0) { if (nDepthInsideSensitive) { ++nDepthInsideSensitive; } stack.push_back(std::vector<std::string>()); } // don't allow commands after executed commands on baselevel if (!stack.size()) throw std::runtime_error("Invalid Syntax"); add_to_current_stack(curarg); curarg.clear(); state = STATE_EATING_SPACES_IN_BRACKETS; } if ((ch == ')' || ch == '\n') && stack.size() > 0) { if (fExecute) { // Convert argument list to JSON objects in method-dependent way, // and pass it along with the method name to the dispatcher. JSONRPCRequest req; req.params = RPCConvertValues(stack.back()[0], std::vector<std::string>(stack.back().begin() + 1, stack.back().end())); req.strMethod = stack.back()[0]; lastResult = tableRPC.execute(req); } state = STATE_COMMAND_EXECUTED; curarg.clear(); } break; case ' ': case ',': case '\t': if(state == STATE_EATING_SPACES_IN_ARG && curarg.empty() && ch == ',') throw std::runtime_error("Invalid Syntax"); else if(state == STATE_ARGUMENT) // Space ends argument { add_to_current_stack(curarg); curarg.clear(); } if ((state == STATE_EATING_SPACES_IN_BRACKETS || state == STATE_ARGUMENT) && ch == ',') { state = STATE_EATING_SPACES_IN_ARG; break; } state = STATE_EATING_SPACES; break; default: curarg += ch; state = STATE_ARGUMENT; } break; case STATE_SINGLEQUOTED: // Single-quoted string switch(ch) { case '\'': state = STATE_ARGUMENT; break; default: curarg += ch; } break; case STATE_DOUBLEQUOTED: // Double-quoted string switch(ch) { case '"': state = STATE_ARGUMENT; break; case '\\': state = STATE_ESCAPE_DOUBLEQUOTED; break; default: curarg += ch; } break; case STATE_ESCAPE_OUTER: // '\' outside quotes curarg += ch; state = STATE_ARGUMENT; break; case STATE_ESCAPE_DOUBLEQUOTED: // '\' in double-quoted text if(ch != '"' && ch != '\\') curarg += '\\'; // keep '\' for everything but the quote and '\' itself curarg += ch; state = STATE_DOUBLEQUOTED; break; } } if (pstrFilteredOut) { if (STATE_COMMAND_EXECUTED == state) { assert(!stack.empty()); close_out_params(); } *pstrFilteredOut = strCommand; for (auto i = filter_ranges.rbegin(); i != filter_ranges.rend(); ++i) { pstrFilteredOut->replace(i->first, i->second - i->first, "(…)"); } } switch(state) // final state { case STATE_COMMAND_EXECUTED: if (lastResult.isStr()) strResult = lastResult.get_str(); else strResult = lastResult.write(2); case STATE_ARGUMENT: case STATE_EATING_SPACES: return true; default: // ERROR to end in one of the other states return false; } } void RPCExecutor::request(const QString &command) { try { std::string result; std::string executableCommand = command.toStdString() + "\n"; if(!RPCConsole::RPCExecuteCommandLine(result, executableCommand)) { Q_EMIT reply(RPCConsole::CMD_ERROR, QString("Parse error: unbalanced ' or \"")); return; } Q_EMIT reply(RPCConsole::CMD_REPLY, QString::fromStdString(result)); } catch (UniValue& objError) { try // Nice formatting for standard-format error { int code = find_value(objError, "code").get_int(); std::string message = find_value(objError, "message").get_str(); Q_EMIT reply(RPCConsole::CMD_ERROR, QString::fromStdString(message) + " (code " + QString::number(code) + ")"); } catch (const std::runtime_error&) // raised when converting to invalid type, i.e. missing code or message { // Show raw JSON object Q_EMIT reply(RPCConsole::CMD_ERROR, QString::fromStdString(objError.write())); } } catch (const std::exception& e) { Q_EMIT reply(RPCConsole::CMD_ERROR, QString("Error: ") + QString::fromStdString(e.what())); } } RPCConsole::RPCConsole(QWidget *parent) : QDialog(parent), ui(new Ui::RPCConsole), historyPtr(0) { ui->setupUi(this); #ifndef Q_OS_MAC ui->openDebugLogfileButton->setIcon(QIcon(":/icons/export")); ui->showCLOptionsButton->setIcon(QIcon(":/icons/options")); #endif // Install event filter for up and down arrow ui->lineEdit->installEventFilter(this); ui->messagesWidget->installEventFilter(this); connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear())); // Wallet Repair Buttons(rpcconsole.ui) //connect(ui->btn_salvagewallet, SIGNAL(clicked()), this, SLOT(walletSalvage())); //connect(ui->discordButton, SIGNAL(clicked()), this, SLOT(walletSalvage())); //connect(ui->btn_rescan, SIGNAL(clicked()), this, SLOT(walletRescan())); //connect(ui->btn_zapwallettxes1, SIGNAL(clicked()), this, SLOT(walletZaptxes1())); //connect(ui->btn_zapwallettxes2, SIGNAL(clicked()), this, SLOT(walletZaptxes2())); //connect(ui->btn_upgradewallet, SIGNAL(clicked()), this, SLOT(walletUpgrade())); //connect(ui->btn_reindex, SIGNAL(clicked()), this, SLOT(walletReindex())); // set library version labels #ifdef ENABLE_WALLET ui->berkeleyDBVersion->setText(DbEnv::version(0, 0, 0)); ui->wallet_path->setText(QString::fromStdString(GetDataDir().string() + QDir::separator().toLatin1() + GetArg("-wallet", "wallet.dat"))); #else ui->label_berkeleyDBVersion->hide(); ui->berkeleyDBVersion->hide(); #endif // set OpenSSL version label ui->openSSLVersion->setText(SSLeay_version(SSLEAY_VERSION)); // set Boost version label ui->boostVersion->setText(BOOST_VERSION_NUM.c_str()); // set UPNP status ui->UPNPInfo->setText(tr("%1 | %2").arg(MINIUPNPC_VERSION_NUM.c_str()).arg(fUseUPnP ? "Enabled": "Disabled")); startExecutor(); clear(); } RPCConsole::~RPCConsole() { emit stopExecutor(); delete ui; } bool RPCConsole::eventFilter(QObject* obj, QEvent *event) { if(event->type() == QEvent::KeyPress) // Special key handling { QKeyEvent *keyevt = static_cast<QKeyEvent*>(event); int key = keyevt->key(); Qt::KeyboardModifiers mod = keyevt->modifiers(); switch(key) { case Qt::Key_Up: if(obj == ui->lineEdit) { browseHistory(-1); return true; } break; case Qt::Key_Down: if(obj == ui->lineEdit) { browseHistory(1); return true; } break; case Qt::Key_PageUp: /* pass paging keys to messages widget */ case Qt::Key_PageDown: if(obj == ui->lineEdit) { QApplication::postEvent(ui->messagesWidget, new QKeyEvent(*keyevt)); return true; } break; case Qt::Key_Return: case Qt::Key_Enter: // forward these events to lineEdit if(obj == autoCompleter->popup()) { autoCompleter->popup()->hide(); QApplication::postEvent(ui->lineEdit, new QKeyEvent(*keyevt)); return true; } break; default: // Typing in messages widget brings focus to line edit, and redirects key there // Exclude most combinations and keys that emit no text, except paste shortcuts if(obj == ui->messagesWidget && ( (!mod && !keyevt->text().isEmpty() && key != Qt::Key_Tab) || ((mod & Qt::ControlModifier) && key == Qt::Key_V) || ((mod & Qt::ShiftModifier) && key == Qt::Key_Insert))) { ui->lineEdit->setFocus(); QApplication::postEvent(ui->lineEdit, new QKeyEvent(*keyevt)); return true; } } } return QDialog::eventFilter(obj, event); } void RPCConsole::setClientModel(ClientModel *model) { this->clientModel = model; if(model) { // Keep up to date with client setNumConnections(model->getNumConnections()); connect(model, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int))); setNumBlocks(model->getNumBlocks()); connect(model, SIGNAL(numBlocksChanged(int,int)), this, SLOT(setNumBlocks(int))); setMasternodeCount(model->getMasternodeCountString()); connect(model, SIGNAL(strMasternodesChanged(QString)), this, SLOT(setMasternodeCount(QString))); timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(refreshDebugInfo())); timer->start(60 * 1000); // 60 seconds connect(model, SIGNAL(mempoolSizeChanged(long)), this, SLOT(setMempoolSize(long))); // Provide initial values ui->clientVersion->setText(model->formatFullVersion()); ui->clientName->setText(model->clientName()); ui->buildDate->setText(model->formatBuildDate()); ui->startupTime->setText(model->formatClientStartupTime()); ui->isTestNet->setChecked(model->isTestNet()); //Setup autocomplete and attach it QStringList wordList; std::vector<std::string> commandList = tableRPC.listCommands(); for (size_t i = 0; i < commandList.size(); ++i) { wordList << commandList[i].c_str(); } autoCompleter = new QCompleter(wordList, this); ui->lineEdit->setCompleter(autoCompleter); autoCompleter->popup()->installEventFilter(this); } } static QString categoryClass(int category) { switch(category) { case RPCConsole::CMD_REQUEST: return "cmd-request"; break; case RPCConsole::CMD_REPLY: return "cmd-reply"; break; case RPCConsole::CMD_ERROR: return "cmd-error"; break; default: return "misc"; } } /** Restart wallet with "-salvagewallet" */ void RPCConsole::walletSalvage() { buildParameterlist(SALVAGEWALLET); } /** Restart wallet with "-rescan" */ void RPCConsole::walletRescan() { buildParameterlist(RESCAN); } /** Restart wallet with "-zapwallettxes=1" */ void RPCConsole::walletZaptxes1() { buildParameterlist(ZAPTXES1); } /** Restart wallet with "-zapwallettxes=2" */ void RPCConsole::walletZaptxes2() { buildParameterlist(ZAPTXES2); } /** Restart wallet with "-upgradewallet" */ void RPCConsole::walletUpgrade() { buildParameterlist(UPGRADEWALLET); } /** Restart wallet with "-reindex" */ void RPCConsole::walletReindex() { buildParameterlist(REINDEX); } /** Build command-line parameter list for restart */ void RPCConsole::buildParameterlist(QString arg) { // Get command-line arguments and remove the application name QStringList args = QApplication::arguments(); args.removeFirst(); // Remove existing repair-options args.removeAll(SALVAGEWALLET); args.removeAll(RESCAN); args.removeAll(ZAPTXES1); args.removeAll(ZAPTXES2); args.removeAll(UPGRADEWALLET); args.removeAll(REINDEX); // Append repair parameter to command line. args.append(arg); // Send command-line arguments to BitcoinGUI::handleRestart() emit handleRestart(args); } void RPCConsole::clear() { ui->messagesWidget->clear(); ui->lineEdit->clear(); ui->lineEdit->setFocus(); // Add smoothly scaled icon images. // (when using width/height on an img, Qt uses nearest instead of linear interpolation) for(int i=0; ICON_MAPPING[i].url; ++i) { ui->messagesWidget->document()->addResource( QTextDocument::ImageResource, QUrl(ICON_MAPPING[i].url), QImage(ICON_MAPPING[i].source).scaled(ICON_SIZE, Qt::IgnoreAspectRatio, Qt::SmoothTransformation)); } // Set default style sheet ui->messagesWidget->document()->setDefaultStyleSheet( "table { }" "td.time { color: #808080; padding-top: 3px; } " "td.message { font-family: Monospace; font-size: 12px; } " "td.cmd-request { color: #006060; } " "td.cmd-error { color: red; } " "b { color: #006060; } " ); message(CMD_REPLY, (tr("Welcome to the Neutron RPC console.") + "<br>" + tr("Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.") + "<br>" + tr("Type <b>help</b> for an overview of available commands.")), true); } void RPCConsole::message(int category, const QString &message, bool html) { QTime time = QTime::currentTime(); QString timeString = time.toString(); QString out; out += "<table><tr><td class=\"time\" width=\"65\">" + timeString + "</td>"; out += "<td class=\"icon\" width=\"32\"><img src=\"" + categoryClass(category) + "\"></td>"; out += "<td class=\"message " + categoryClass(category) + "\" valign=\"middle\">"; if(html) out += message; else out += GUIUtil::HtmlEscape(message, true); out += "</td></tr></table>"; ui->messagesWidget->append(out); } void RPCConsole::refreshDebugInfo() { // set UPNP status ui->UPNPInfo->setText(tr("%1 | %2").arg(MINIUPNPC_VERSION_NUM.c_str()).arg(fUseUPnP ? "Enabled": "Disabled")); updateLastBlockSeen(); } void RPCConsole::updateLastBlockSeen() { setNumBlocks(clientModel->getNumBlocks()); } void RPCConsole::updateNetworkState() { QString connections = QString::number(clientModel->getNumConnections()) + " ("; connections += tr("In:") + " " + QString::number(clientModel->getNumConnections(CONNECTIONS_IN)) + " / "; connections += tr("Out:") + " " + QString::number(clientModel->getNumConnections(CONNECTIONS_OUT)) + ")"; ui->numberOfConnections->setText(connections); } void RPCConsole::setNumConnections(int count) { if (!clientModel) return; updateNetworkState(); } void RPCConsole::setNumBlocks(int count) { ui->numberOfBlocks->setText(QString::number(count)); if(clientModel) { QDateTime lastBlockDate = clientModel->getLastBlockDate(); int secs = lastBlockDate.secsTo(QDateTime::currentDateTime()); QString howLongAgo = GUIUtil::formatNiceTimeOffset(secs); ui->lastBlockTime->setText(tr("%1 [%2 ago]").arg(lastBlockDate.toString(), howLongAgo)); } } void RPCConsole::setMasternodeCount(const QString &strMasternodes) { ui->masternodeCount->setText(strMasternodes); } void RPCConsole::setMempoolSize(long numberOfTxs) { ui->mempoolNumberTxs->setText(QString::number(numberOfTxs)); } void RPCConsole::on_lineEdit_returnPressed() { QString cmd = ui->lineEdit->text(); if(!cmd.isEmpty()) { std::string strFilteredCmd; try { std::string dummy; if (!RPCParseCommandLine(dummy, cmd.toStdString(), false, &strFilteredCmd)) { // Failed to parse command, so we cannot even filter it for the history throw std::runtime_error("Invalid command line"); } } catch (const std::exception& e) { QMessageBox::critical(this, "Error", QString("Error: ") + QString::fromStdString(e.what())); return; } ui->lineEdit->clear(); cmdBeforeBrowsing = QString(); message(CMD_REQUEST, cmd); Q_EMIT cmdRequest(cmd); cmd = QString::fromStdString(strFilteredCmd); // Remove command, if already in history history.removeOne(cmd); // Append command to history history.append(cmd); // Enforce maximum history size while(history.size() > CONSOLE_HISTORY) history.removeFirst(); // Set pointer to end of history historyPtr = history.size(); // Scroll console view to end scrollToEnd(); } } void RPCConsole::browseHistory(int offset) { historyPtr += offset; if(historyPtr < 0) historyPtr = 0; if(historyPtr > history.size()) historyPtr = history.size(); QString cmd; if(historyPtr < history.size()) cmd = history.at(historyPtr); ui->lineEdit->setText(cmd); } void RPCConsole::startExecutor() { QThread* thread = new QThread; RPCExecutor *executor = new RPCExecutor(); executor->moveToThread(thread); // Notify executor when thread started (in executor thread) connect(thread, SIGNAL(started()), executor, SLOT(start())); // Replies from executor object must go to this object connect(executor, SIGNAL(reply(int,QString)), this, SLOT(message(int,QString))); // Requests from this object must go to executor connect(this, SIGNAL(cmdRequest(QString)), executor, SLOT(request(QString))); // On stopExecutor signal // - queue executor for deletion (in execution thread) // - quit the Qt event loop in the execution thread connect(this, SIGNAL(stopExecutor()), executor, SLOT(deleteLater())); connect(this, SIGNAL(stopExecutor()), thread, SLOT(quit())); // Queue the thread for deletion (in this thread) when it is finished connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater())); // Default implementation of QThread::run() simply spins up an event loop in the thread, // which is what we want. thread->start(); } void RPCConsole::on_tabWidget_currentChanged(int index) { if(ui->tabWidget->widget(index) == ui->tab_console) { ui->lineEdit->setFocus(); } } void RPCConsole::on_discordButton_clicked() { GUIUtil::discordButtonLink(); } void RPCConsole::on_explorerButton_clicked() { GUIUtil::explorerButtonLink(); } void RPCConsole::on_supportButton_clicked() { GUIUtil::supportButtonLink(); } void RPCConsole::on_bootstrapButton_clicked() { GUIUtil::bootstrapButtonLink(); } void RPCConsole::on_repoButton_clicked() { GUIUtil::repoButtonLink(); } void RPCConsole::on_cmcButton_clicked() { GUIUtil::cmcButtonLink(); } void RPCConsole::on_openDebugLogfileButton_clicked() { GUIUtil::openDebugLogfile(); } void RPCConsole::scrollToEnd() { QScrollBar *scrollbar = ui->messagesWidget->verticalScrollBar(); scrollbar->setValue(scrollbar->maximum()); } void RPCConsole::on_showCLOptionsButton_clicked() { GUIUtil::HelpMessageBox help; help.exec(); } void RPCConsole::setTabFocus(enum TabTypes tabType) { ui->tabWidget->setCurrentIndex(tabType); }
neutroncoin/neutron
src/qt/rpcconsole.cpp
C++
mit
28,865
'use strict'; module.exports = { "definitions": { "validation-error": { "type": "object", "description": "Validation error", "properties": { "param": { "type": "string", "description": "The parameter in error" }, "msg": { "type": "string", "enum": ["invalid","required"], "description": "The error code" } } }, "validation-errors": { "type": "array", "description": "Validation errors", "items": { "$ref": "#/definitions/validation-error" } }, "system-error": { "type": "object", "description": "System error", "properties": { "error": { "type": "string", "description": "The error message" } } } } };
dennoa/node-api-seed
server/api/swagger/error-definitions.js
JavaScript
mit
828
class Lancamento < ActiveRecord::Base belongs_to :user belongs_to :categoria belongs_to :tipo_lancamento belongs_to :rotina belongs_to :sub_categoria validates_presence_of :valor, :user_id, :tipo_lancamento_id, :categoria_id, :descricao, :data_pagamento scope :mes_atual, -> (data,user_id) { where(["(data_pagamento::date between ? and ?) and user_id = ?", data.beginning_of_month, data.end_of_month, user_id]) } scope :receita, -> { where("tipo_lancamento_id = 1") } scope :despesa, -> { where("tipo_lancamento_id = 2") } #default_scope { order(:id => :desc) } end
djosino/controle_pessoal
app/models/lancamento.rb
Ruby
mit
599
version https://git-lfs.github.com/spec/v1 oid sha256:2e65db5b56d276f8bcf293bede932b782ec29e72a25125d3412f81315301ecc4 size 14066
yogeshsaroya/new-cdnjs
ajax/libs/echarts/2.2.1/chart/radar.js
JavaScript
mit
130
/*jslint node: true */ 'use strict'; var _ = require('underscore.string'), inquirer = require('inquirer'), path = require('path'), chalk = require('chalk-log'); module.exports = function() { return function (done) { var prompts = [{ name: 'taglibName', message: 'What is the name of your taglib or taglibs (, separated) ?', }, { name: 'appName', message: 'For which app (empty: global) ?' }, { type: 'confirm', name: 'moveon', message: 'Continue?' }]; //Ask inquirer.prompt(prompts, function (answers) { if (!answers.moveon) { return done(); } if (_.isBlank(answers.taglibName)) { chalk.error('Taglib name can NOT be empty'); done(); } answers.taglibName = _.clean(answers.taglibName); var appPath = path.join('./apps', answers.appName); var targetDir = _.isBlank(answers.appName) ? './apps/_global' : appPath; var createTagLib = require('./create-taglib'); if (answers.taglibName.match(/,/)) { var taglibs = answers.taglibName.split(',').map(function(taglib) { return _.clean(taglib); }); for (let taglib of taglibs) { answers = {taglibName: taglib, appName: answers.appName}; createTagLib(answers, targetDir); } } else { createTagLib(answers, targetDir); } } ); }; };
kristianmandrup/slush-markoa
taglib/index.js
JavaScript
mit
1,760
<?php namespace App; use Illuminate\Database\Eloquent\Model; class Member extends Model { protected $fillable = ['first_name', 'last_name', 'district_id']; public function groups() { return $this->belongsToMany('App\Group'); } public function votes() { return $this->hasMany('App\Vote'); } public function district() { return $this->belongsTo('App\District'); } /** * Get a list of group ids that this member is in * * @return array */ public function getGroupListAttribute() { return $this->groups->lists('id'); } /** * Function that returns the default answer of this member, * for a specified voting and voting item, based on the * first group that they are in * * @param $votingId The id of the voting * @param $votingItemId The id of the votingItem * @return int The id of the answer */ public function groupAnswer($votingId, $votingItemId) { // Check if member is in ANY group if ($this->groups()->count() > 0) { $firstGroup = $this->groups()->firstOrFail(); // Get the first group // Get the group vote of the above group in the specified voting and get the answer id $answerId = GroupVote::where([ 'voting_id' => $votingId, 'voting_item_id' => $votingItemId, 'group_id' => $firstGroup->id ])->first()->answer->id; // If there was an answer for this group, voting and voting item, return it (otherwise will be null) return $answerId; } return null; // If the member isn't in any groups, return null so the first answer is selected } /** * Returns the id of the answer that this member voted for in a specified voting and for a specific voting item, * or null if the member hasn't voted on that voting at all yet. * * @param $votingId The id of the voting * @param $votingItemId The id of the votingItem * @return int VoteTypeAnswer id! */ public function vote($votingId, $votingItemId) { $vote = $this->votes()->where([ 'voting_id' => $votingId, 'voting_item_id' => $votingItemId ])->first(); if ($vote != null) { if ($vote->answer != null) { return $vote->answer->id; } else { return ''; // Return empty string to show that the member was saved as absent } } return null; } }
scify/Vote-collector
app/Member.php
PHP
mit
2,603
<?php namespace App\AdminBundle\Controller; use Sonata\AdminBundle\Controller\CoreController as BaseCoreController; use Symfony\Component\HttpFoundation\StreamedResponse; class CoreController extends BaseCoreController { protected function createStreamedFileResponse($file, $filename) { // $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'wave-speed-report.xls'); return new StreamedResponse(function () use ($file) { readfile($file); }, 200, array( 'Content-length', filesize($file), 'Content-Type' => mime_content_type($file), 'Content-Disposition' => 'attachment; filename='.$filename )); } public function addFlash($type, $message) { $this->get('session') ->getFlashBag() ->add($type, $message); } }
r1dd1ck777/td
src/App/AdminBundle/Controller/CoreController.php
PHP
mit
874
'use strict'; var _ = require('lodash'); var Q = require('q'); var util = require('util'); var should = require('./utils/should'); var descriptors = require('./utils/descriptors'); var Attribute = require('./attribute'); var AssertionResult = require('./assertion-result'); var PropertyAssertion = require('./assertions/property-assertion'); var StateAssertion = require('./assertions/state-assertion'); var tinto = {}; tinto.Entity = function Entity() { this._properties = {}; this._states = {}; /** * @name tinto.Entity#should * @type {tinto.Assertion} */ /** * @name tinto.Entity#should * @function * @param {...tinto.Assertion} assertions */ Object.defineProperty(this, 'should', { get: should }); }; /** * @param {string} state * @returns {function() : Promise.<tinto.AssertionResult>} */ tinto.Entity.prototype.is = function(state) { var self = this; if (!this._states[state]) { throw new Error(util.format('Unsupported state "%s"', state)); } return function() { return self._states[state].call(self).then(function(result) { return new AssertionResult(result); }); }; }; /** * @param {string} property * @param {*} expected * @returns {function() : Promise.<tinto.AssertionResult>} */ tinto.Entity.prototype.has = function(property, expected) { if (typeof property === 'number') { return hasCount.call(this, expected, property); } else { return hasValue.call(this, property, expected); } }; /** * @param {string} name * @param {function} [matcher] * @param {Array.<*>} [args] */ tinto.Entity.prototype.state = function(name, matcher, args) { this._states[name] = wrap(matcher, args); StateAssertion.register(name); }; /** * @param {Object.<string, function>} mappings */ tinto.Entity.prototype.states = function() { processMappings.call(this, 'state', arguments); }; /** * @param {string} name * @param {function} [matcher] * @param {Array.<*>} [args] */ tinto.Entity.prototype.property = function(name, matcher, args) { this._properties[name] = wrap(matcher, args); PropertyAssertion.register(name); this.getter(name, function() { return new Attribute(this, name, matcher.call(this)); }); }; /** * @param {Object.<string, function>} mappings */ tinto.Entity.prototype.properties = function() { processMappings.call(this, 'property', arguments); }; /** * @param {string} prop * @param {function()} func */ tinto.Entity.prototype.getter = function(prop, func) { Object.defineProperty(this, prop, { get: func, enumerable: true, configurable: true }); }; /** * @param {Object} props */ tinto.Entity.prototype.getters = function(props) { _.forIn(descriptors(props), function(descriptor, prop) { if (descriptor.enumerable) { if (descriptor.get) { this.getter(prop, descriptor.get); } else if (descriptor.value && typeof descriptor.value === 'function') { this.getter(prop, descriptor.value); } } }, this); }; /** * @private * @param {function()} matcher * @param {Array.<*>} args * @returns {Function} */ function wrap(matcher, args) { return function() { return Q.when(args ? matcher.apply(this, args) : matcher.call(this)); }; } /** * @private * @param {string} property * @param {*} value * @returns {function() : Promise.<tinto.AssertionResult>} */ function hasValue(property, value) { var self = this; if (!this._properties[property]) { throw new Error(util.format('Unsupported property "%s"', property)); } return function() { return self._properties[property].call(self).then(function(actual) { return new AssertionResult(_.isEqual(value, actual), value, actual); }); }; } /** * @private * @param {string} property * @param {Number} count * @returns {function() : Promise.<tinto.AssertionResult>} */ function hasCount(property, count) { var collection = this[property]; if (collection.count === undefined || typeof collection.count !== 'function') { throw new Error('Count assertions can only be applied to collections'); } return function() { return Q.resolve(collection.count()).then(function(length) { return new AssertionResult(count === length, count, length); }); }; } /** * @private * @param {string} type * @param {Array.<string|Object>} mappings */ function processMappings(type, mappings) { var self = this; mappings = Array.prototype.slice.call(mappings, 0); mappings.forEach(function(mapping) { if (typeof mapping === 'string') { self[type](mapping); } else { _.forEach(mapping, function(matcher, name) { self[type](name, matcher); }, self); } }); } module.exports = tinto.Entity;
alannesta/tinto
lib/entity.js
JavaScript
mit
4,743
require 'rails/generators' module Conductor class MailersController < ApplicationController def new end def create @form = MailerGeneratorForm.new(params[:mailer]) if @form.valid? Rails.logger.info @form.command_line @form.run flash[:success] = "The mailer was created!" else flash[:error] = "Cannot create the mailer! Please verify the information" end redirect_to(new_mailer_url) end end end
NewRosies/conductor
app/controllers/conductor/mailers_controller.rb
Ruby
mit
486
require 'rails_helper' describe Standup do describe 'permitted params' do it 'allows the scalars through as well as supporting complex attributes such as the image_days array' do unpermitted = ActionController::Parameters.new( title: 'Foo', to_address: 'Bar', subject_prefix: 'Baz', closing_message: 'Quux', time_zone_name: 'Corge', start_time_string: 'Fred', image_urls: 'Garply', image_days: ['', 'Mon', 'Thu'], not_allowed: 'Biteme' ) permitted = unpermitted.permit(Standup::ACCESSIBLE_ATTRS) expect(permitted.keys.map(&:to_sym) - [:image_days]).to match_array(Standup::ACCESSIBLE_SCALARS) expect(permitted[:image_days]).to eq(['', 'Mon', 'Thu']) end end describe 'associations' do it { is_expected.to have_many(:items).dependent(:destroy) } it { is_expected.to have_many(:posts).dependent(:destroy) } end describe 'validations' do it { is_expected.to validate_presence_of(:title) } it { is_expected.to validate_presence_of(:to_address) } it "should validate the format of the standup time" do standup = FactoryBot.build(:standup) expect(standup).to be_valid standup.start_time_string = "9:00 am" expect(standup).to be_valid standup.start_time_string = "09:10 AM" expect(standup).to be_valid standup.start_time_string = "10:00" expect(standup).to_not be_valid standup.start_time_string = "23:00" expect(standup).to_not be_valid end end it 'has a closing message' do standup = FactoryBot.create(:standup, closing_message: 'Yay') expect(standup.closing_message).to eq 'Yay' end describe "dates" do before do @utc_today = Time.new(2012, 1, 1).utc.to_date @utc_yesterday = @utc_today - 1.day @standup = FactoryBot.create(:standup, closing_message: 'Yay') @standup.time_zone_name = "Pacific Time (US & Canada)" Timecop.freeze(@utc_today) end after do Timecop.return end describe "#date_today" do it "returns the date based on the time zone" do expect(@standup.date_today).to eq @utc_yesterday end end describe "#date_tomorrow" do it "returns the date based on the time zone" do expect(@standup.date_tomorrow).to eq @utc_today end end describe "#time_zone_name_iana" do it "returns IANA format of the time zone" do expect(@standup.time_zone_name_iana).to eq "America/Los_Angeles" end end describe "#next_standup_date" do context "when the standup is today" do it "returns date and time as an integer" do standup_beginning_of_day = @standup.time_zone.now.beginning_of_day @standup.start_time_string = "5:00pm" expect(@standup.next_standup_date).to eq standup_beginning_of_day + 17.hours end end context "when the standup is tomorrow" do it "returns date and time as an integer" do standup_beginning_of_day = @standup.time_zone.now.beginning_of_day @standup.start_time_string = "8:00am" expect(@standup.next_standup_date).to eq standup_beginning_of_day + 1.day + 8.hour end end end end it "allows mass assignment" do expect { Standup.new( title: "Berlin", to_address: "berlin+standup@pivotallabs.com", subject_prefix: "[FOO]", closing_message: "Go Running.", time_zone_name: "Mountain Time (US & Canada)", start_time_string: "9:00am", image_urls: 'http://example.com/bar.png', image_days: '["M"]', ) }.to_not raise_exception end it 'serializes the image_days array for storage in the db' do standup = create(:standup, image_days: ['mon', 'tue']) expect(standup.image_days).to eq ['mon', 'tue'] end describe "#last_email_time" do context "when there are no posts" do let (:standup_with_no_posts) { create(:standup) } it "is nil" do expect(standup_with_no_posts.last_email_time).to be_nil end end context "when there are posts" do let (:last_email_time) { Time.local(2016, 1, 1, 19, 42) } let (:last_emailed_post) { create(:post, sent_at: last_email_time) } let (:standup_with_posts) { create(:standup, posts: [ create(:post, sent_at: last_email_time - 1), last_emailed_post, create(:post, sent_at: last_email_time - 1), create(:post, sent_at: nil) ])} it "is the time the most recently emailed post was emailed" do expect(standup_with_posts.last_email_time).to eq(last_email_time) end end end end
pivotal/whiteboard
spec/models/standup_spec.rb
Ruby
mit
4,737
// // RootViewController.cs // // Author: // Alan McGovern <alan@xamarin.com> // // Copyright 2011, Xamarin Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using CoreGraphics; using System.Linq; using UIKit; using Foundation; using System.Collections.ObjectModel; using System.Threading.Tasks; using System.Net; using System.Threading; namespace LazyTableImages { public partial class RootViewController : UITableViewController { public ObservableCollection<App> Apps { get; private set; } public RootViewController (string nibName, NSBundle bundle) : base (nibName, bundle) { Apps = new ObservableCollection<App> (); Title = NSBundle.MainBundle.LocalizedString ("Top 50 Apps", "Master"); } public override void ViewDidLoad () { base.ViewDidLoad (); TableView.Source = new DataSource (this); } public override bool ShouldAutorotateToInterfaceOrientation (UIInterfaceOrientation toInterfaceOrientation) { return (toInterfaceOrientation != UIInterfaceOrientation.PortraitUpsideDown); } public override void DidReceiveMemoryWarning () { // Release all cached images. This will cause them to be redownloaded // later as they're displayed. foreach (var v in Apps) v.Image = null; } class DataSource : UITableViewSource { RootViewController Controller { get; set; } Task DownloadTask { get; set; } UIImage PlaceholderImage { get; set; } public DataSource (RootViewController controller) { Controller = controller; // Listen for changes to the Apps collection so the TableView can be updated Controller.Apps.CollectionChanged += HandleAppsCollectionChanged; // Initialise DownloadTask with an empty and complete task DownloadTask = Task.Factory.StartNew (() => { }); // Load the Placeholder image so it's ready to be used immediately PlaceholderImage = UIImage.FromFile ("Images/Placeholder.png"); // If either a download fails or the image we download is corrupt, ignore the problem. TaskScheduler.UnobservedTaskException += delegate(object sender, UnobservedTaskExceptionEventArgs e) { e.SetObserved (); }; } void HandleAppsCollectionChanged (object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { // Whenever the Items change, reload the data. Controller.TableView.ReloadData (); } public override nint NumberOfSections (UITableView tableView) { return 1; } public override nint RowsInSection (UITableView tableview, nint section) { return Controller.Apps.Count; } // Customize the appearance of table view cells. public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath) { UITableViewCell cell; // If the list is empty, put in a 'loading' entry if (Controller.Apps.Count == 0 && indexPath.Row == 0) { cell = tableView.DequeueReusableCell ("Placeholder"); if (cell == null) { cell = new UITableViewCell (UITableViewCellStyle.Subtitle, "Placeholder"); cell.DetailTextLabel.TextAlignment = UITextAlignment.Center; cell.SelectionStyle = UITableViewCellSelectionStyle.None; cell.DetailTextLabel.Text = "Loading"; } return cell; } cell = tableView.DequeueReusableCell ("Cell"); if (cell == null) { cell = new UITableViewCell (UITableViewCellStyle.Subtitle, "Cell"); cell.SelectionStyle = UITableViewCellSelectionStyle.None; } // Set the tag of each cell to the index of the App that // it's displaying. This allows us to directly match a cell // with an item when we're updating the Image var app = Controller.Apps [indexPath.Row]; cell.Tag = indexPath.Row; cell.TextLabel.Text = app.Name; cell.DetailTextLabel.Text = app.Artist; // If the Image for this App has not been downloaded, // use the Placeholder image while we try to download // the real image from the web. if (app.Image == null) { app.Image = PlaceholderImage; BeginDownloadingImage (app, indexPath); } cell.ImageView.Image = app.Image; return cell; } void BeginDownloadingImage (App app, NSIndexPath path) { // Queue the image to be downloaded. This task will execute // as soon as the existing ones have finished. byte[] data = null; DownloadTask = DownloadTask.ContinueWith (prevTask => { try { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true; using (var c = new GzipWebClient ()) data = c.DownloadData (app.ImageUrl); } finally { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; } }); // When the download task is finished, queue another task to update the UI. // Note that this task will run only if the download is successful and it // uses the CurrentSyncronisationContext, which on MonoTouch causes the task // to be run on the main UI thread. This allows us to safely access the UI. DownloadTask = DownloadTask.ContinueWith (t => { // Load the image from the byte array. app.Image = UIImage.LoadFromData (NSData.FromArray (data)); // Retrieve the cell which corresponds to the current App. If the cell is null, it means the user // has already scrolled that app off-screen. var cell = Controller.TableView.VisibleCells.Where (c => c.Tag == Controller.Apps.IndexOf (app)).FirstOrDefault (); if (cell != null) cell.ImageView.Image = app.Image; }, CancellationToken.None, TaskContinuationOptions.OnlyOnRanToCompletion, TaskScheduler.FromCurrentSynchronizationContext ()); } } } }
xamarin/monotouch-samples
LazyTableImages/RootViewController.cs
C#
mit
6,677
// Vaca - Visual Application Components Abstraction // Copyright (c) 2005-2009 David Capello // // This file is distributed under the terms of the MIT license, // please read LICENSE.txt for more information. #include <vaca/vaca.h> #include "../resource.h" using namespace vaca; class TimerViewer : public Widget { Timer m_timer; bool m_on; public: TimerViewer(int msecs, Color color, Widget* parent) : Widget(parent) , m_timer(msecs) , m_on(false) { setBgColor(color); setPreferredSize(Size(64, 64)); m_timer.Tick.connect(&TimerViewer::onTick, this); m_timer.start(); } protected: virtual void onPaint(PaintEvent& ev) { Graphics& g = ev.getGraphics(); Rect rc = getClientBounds(); Color bg = getBgColor(); Pen blackPen(Color::Black); Brush foreBrush(m_on ? getBgColor()+Color(200, 200, 200): getBgColor()); g.drawRect(blackPen, rc); rc.shrink(1); g.fillRect(foreBrush, rc); } private: void onTick() { // switch state m_on = !m_on; invalidate(true); } }; // the main window class MainFrame : public Frame { Label m_label1; Label m_label2; Label m_label3; TimerViewer m_timer1; TimerViewer m_timer2; TimerViewer m_timer3; public: MainFrame() : Frame(L"Timers", NULL, Frame::Styles::Default - Frame::Styles::Resizable - Frame::Styles::Maximizable) , m_label1(L"1 sec", this) , m_label2(L"2 sec", this) , m_label3(L"4 sec", this) , m_timer1(1000, Color::Red, this) , m_timer2(2000, Color(0, 128, 0), this) , m_timer3(4000, Color::Blue, this) { setLayout(Bix::parse(L"XY[%,%,%;%,%,%]", &m_label1, &m_label2, &m_label3, &m_timer1, &m_timer2, &m_timer3)); setSize(getPreferredSize()); } }; int VACA_MAIN() { Application app; MainFrame frm; frm.setIcon(ResourceId(IDI_VACA)); frm.setVisible(true); app.run(); return 0; }
dacap/vaca
examples/Timers/Timers.cpp
C++
mit
2,020
package com.dwarfartisan.parsec; import java.io.EOFException; /** * Created by Mars Liu on 2016-01-07. * Digit 判断下一个项是否是一个表示数字的字符.它仅接受 Character/char . */ public class Digit<Status, Tran> implements Parsec<Character, Character, Status, Tran> { @Override public Character parse(State<Character, Status, Tran> s) throws EOFException, ParsecException { Character re = s.next(); if (Character.isDigit(re)) { return re; } else { String message = String.format("Expect %c is digit.", re); throw s.trap(message); } } }
Dwarfartisan/jparsec
advance/src/java/com/dwarfartisan/parsec/Digit.java
Java
mit
653
import React from 'react' import MediaSummary from './MediaSummary' import { Button } from 'semantic-ui-react' import './mediaverticallist.css' export default class MediaVerticalList extends React.Component { render () { var arr = this.props.data if (arr === undefined) { arr = [] } var mediaNodes = arr.map((media, idx) => { return ( <MediaSummary key={media.id + '-' + idx} logo_url={media.logo_url} /> ) }) return ( <div> <h3 className='text-centered'>{this.props.title}</h3> {mediaNodes} <Button fluid size='huge'>3 Media Lainnya</Button> </div> ) } }
imrenagi/rojak-web-frontend
src/routes/Election/routes/Candidate/components/MediaBreakdown/MediaVerticalList.js
JavaScript
mit
653
 namespace PatientManagement.Administration.Repositories { using Serenity; using Serenity.Data; using Serenity.Services; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Reflection; using MyRow = Entities.UserRoleRow; public class UserRoleRepository { private static MyRow.RowFields fld { get { return MyRow.Fields; } } public SaveResponse Update(IUnitOfWork uow, UserRoleUpdateRequest request) { Check.NotNull(request, "request"); Check.NotNull(request.UserID, "userID"); Check.NotNull(request.Roles, "permissions"); var userID = request.UserID.Value; var oldList = new HashSet<Int32>( GetExisting(uow.Connection, userID) .Select(x => x.RoleId.Value)); var newList = new HashSet<Int32>(request.Roles.ToList()); if (oldList.SetEquals(newList)) return new SaveResponse(); foreach (var k in oldList) { if (newList.Contains(k)) continue; new SqlDelete(fld.TableName) .Where( new Criteria(fld.UserId) == userID & new Criteria(fld.RoleId) == k) .Execute(uow.Connection); } foreach (var k in newList) { if (oldList.Contains(k)) continue; uow.Connection.Insert(new MyRow { UserId = userID, RoleId = k }); } BatchGenerationUpdater.OnCommit(uow, fld.GenerationKey); BatchGenerationUpdater.OnCommit(uow, Entities.UserPermissionRow.Fields.GenerationKey); return new SaveResponse(); } private List<MyRow> GetExisting(IDbConnection connection, Int32 userId) { return connection.List<MyRow>(q => { q.Select(fld.UserRoleId, fld.RoleId) .Where(new Criteria(fld.UserId) == userId); }); } public UserRoleListResponse List(IDbConnection connection, UserRoleListRequest request) { Check.NotNull(request, "request"); Check.NotNull(request.UserID, "userID"); var response = new UserRoleListResponse(); response.Entities = GetExisting(connection, request.UserID.Value) .Select(x => x.RoleId.Value).ToList(); return response; } private void ProcessAttributes<TAttr>(HashSet<string> hash, MemberInfo member, Func<TAttr, string> getRole) where TAttr : Attribute { foreach (var attr in member.GetCustomAttributes<TAttr>()) { var permission = getRole(attr); if (!permission.IsEmptyOrNull()) hash.Add(permission); } } } }
Magik3a/PatientManagement_Admin
PatientManagement/PatientManagement.Web/Modules/Administration/UserRole/UserRoleRepository.cs
C#
mit
3,066
using System; using System.Collections.Generic; namespace TietoCRM.Models { /// <summary> /// Denna klass används inte längre! /// </summary> public class MainContractText { public enum MainContractType { MainHead, Subheading, Text }; private MainContractType type; public MainContractType Type { get { return type; } set { type = value; } } private String name; public String Name { get { return name; } set { name = value; } } private String value; public String Value { get { return this.value; } set { this.value = value; } } private List<MainContractText> children; public List<MainContractText> Children { get { return children; } set { children = value; } } /// <summary> /// init the object with certain values. /// </summary> /// <param name="name">The column name in the database</param> /// <param name="type">The heading type of the object, MainHead, Subheading, Text</param> /// <param name="value">The value the database holds</param> public MainContractText(String name, MainContractType type, String value) { this.Name = name; this.Type = type; this.Value = value; this.Children = new List<MainContractText>(); } } }
erlingsjostrom/TSS
TESS/Models/MainContractText.cs
C#
mit
1,630
<?php namespace Web\GeneralBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; class GeneralController extends Controller { //Muestra Index public function indexAction() { $name='mensaje index'; return $this->render('GeneralBundle:General:index.html.twig', array('name' => $name)); } //Muestra sección. public function seccionAction() { $name='mensaje seccion'; return $this->render('GeneralBundle:General:index.html.twig', array('name' => $name)); } }
JCeci/Webstandar
src/Web/GeneralBundle/Controller/GeneralController.php
PHP
mit
543
<?php namespace Sebastienheyd\Boilerplate\View\Composers; use Illuminate\Support\Facades\App; use Illuminate\View\View; class DatatablesComposer { /** * Called when view load/datatables.blade.php is called. * This is defined in BoilerPlateServiceProvider. * * @param View $view */ public function compose(View $view) { $languages = collect(config('boilerplate.locale.languages'))->map(function ($element) { return $element['datatable']; })->toArray(); $view->with('locale', $languages[App::getLocale()] ?? 'English'); $plugins = [ 'select', 'autoFill', 'buttons', 'colReorder', 'fixedHeader', 'keyTable', 'responsive', 'rowGroup', 'rowReorder', 'scroller', 'searchBuilder', 'searchPanes', ]; $view->with('plugins', $plugins); } }
sebastienheyd/boilerplate
src/View/Composers/DatatablesComposer.php
PHP
mit
983
import { Component, OnInit, ViewEncapsulation } from '@angular/core'; @Component({ selector: 'app-native', templateUrl: './native.component.html', styleUrls: ['./native.component.css'], encapsulation: ViewEncapsulation.Native }) export class NativeComponent implements OnInit { constructor() { } ngOnInit() { } }
shopOFF/TelerikAcademyCourses
Angular/Topics/03. Components/demos/view-encapsulation-strategies/src/app/view-strategies/native.component.ts
TypeScript
mit
332
t = PryTheme.create :name => 'pry-modern-16', :color_model => 16 do author :name => 'Kyrylo Silin', :email => 'silin@kyrylo.org' description 'Simplied version of pry-modern-256' define_theme do class_ 'bright_magenta' class_variable 'bright_cyan' comment 'blue' constant 'bright_blue' error 'black', 'white' float 'bright_red' global_variable 'bright_yellow' inline_delimiter 'bright_green' instance_variable 'bright_cyan' integer 'bright_blue' keyword 'bright_red' method 'bright_yellow' predefined_constant 'bright_cyan' symbol 'bright_green' regexp do self_ 'bright_red' char 'bright_red' content 'magenta' delimiter 'red' modifier 'red' escape 'red' end shell do self_ 'bright_green' char 'bright_green' content 'green' delimiter 'green' escape 'green' end string do self_ 'bright_green' char 'bright_green' content 'green' delimiter 'green' escape 'green' end end end PryTheme::ThemeList.add_theme(t)
americanhanko/dotfiles
config/.pry/themes/pry-modern-16.prytheme.rb
Ruby
mit
1,095
/** * Created by Wayne on 16/3/16. */ 'use strict'; var tender = require('../controllers/tender'), cardContr = require('../controllers/card'), cardFilter = require('../../../libraries/filters/card'), truckFileter = require('../../../libraries/filters/truck'), driverFilter = require('../../../libraries/filters/driver'); module.exports = function (app) { // app.route('/tender/wechat2/details').get(driverFilter.requi, cardContr.create); // app.route('/tender/driver/card/bindTruck').post(driverFilter.requireDriver, cardFilter.requireById, truckFileter.requireById, cardContr.bindTruck); };
hardylake8020/youka-server
tender/app/routes/wechat2.server.routes.js
JavaScript
mit
610
from rest_framework import test, status from waldur_core.structure.models import CustomerRole, ProjectRole from waldur_core.structure.tests import factories as structure_factories from . import factories class ServiceProjectLinkPermissionTest(test.APITransactionTestCase): def setUp(self): self.users = { 'owner': structure_factories.UserFactory(), 'admin': structure_factories.UserFactory(), 'manager': structure_factories.UserFactory(), 'no_role': structure_factories.UserFactory(), 'not_connected': structure_factories.UserFactory(), } # a single customer self.customer = structure_factories.CustomerFactory() self.customer.add_user(self.users['owner'], CustomerRole.OWNER) # that has 3 users connected: admin, manager self.connected_project = structure_factories.ProjectFactory(customer=self.customer) self.connected_project.add_user(self.users['admin'], ProjectRole.ADMINISTRATOR) self.connected_project.add_user(self.users['manager'], ProjectRole.MANAGER) # has defined a service and connected service to a project self.service = factories.OpenStackServiceFactory(customer=self.customer) self.service_project_link = factories.OpenStackServiceProjectLinkFactory( project=self.connected_project, service=self.service) # the customer also has another project with users but without a permission link self.not_connected_project = structure_factories.ProjectFactory(customer=self.customer) self.not_connected_project.add_user(self.users['not_connected'], ProjectRole.ADMINISTRATOR) self.not_connected_project.save() self.url = factories.OpenStackServiceProjectLinkFactory.get_list_url() def test_anonymous_user_cannot_grant_service_to_project(self): response = self.client.post(self.url, self._get_valid_payload()) self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED) def test_user_can_connect_service_and_project_he_owns(self): user = self.users['owner'] self.client.force_authenticate(user=user) service = factories.OpenStackServiceFactory(customer=self.customer) project = structure_factories.ProjectFactory(customer=self.customer) payload = self._get_valid_payload(service, project) response = self.client.post(self.url, payload) self.assertEqual(response.status_code, status.HTTP_201_CREATED) def test_admin_cannot_connect_new_service_and_project_if_he_is_project_admin(self): user = self.users['admin'] self.client.force_authenticate(user=user) service = factories.OpenStackServiceFactory(customer=self.customer) project = self.connected_project payload = self._get_valid_payload(service, project) response = self.client.post(self.url, payload) # the new service should not be visible to the user self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) self.assertDictContainsSubset( {'service': ['Invalid hyperlink - Object does not exist.']}, response.data) def test_user_cannot_revoke_service_and_project_permission_if_he_is_project_manager(self): user = self.users['manager'] self.client.force_authenticate(user=user) url = factories.OpenStackServiceProjectLinkFactory.get_url(self.service_project_link) response = self.client.delete(url) self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) def _get_valid_payload(self, service=None, project=None): return { 'service': factories.OpenStackServiceFactory.get_url(service), 'project': structure_factories.ProjectFactory.get_url(project) }
opennode/nodeconductor-openstack
src/waldur_openstack/openstack/tests/test_service_project_link.py
Python
mit
3,839
#!/bin/env python # # The MIT License (MIT) # # Copyright (c) 2015 Billy Olsen # # 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. from email.mime.text import MIMEText from jinja2 import Environment, FileSystemLoader from datetime import datetime as dt import os import six import smtplib # Get the directory for this file. SECRET_SANTA_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'templates') j2env = Environment(loader=FileSystemLoader(SECRET_SANTA_DIR), trim_blocks=False) class SantaMail(object): """ The SantaMail object is used to send email. This class will load email templates that should be sent out (the master list email and the email for each Secret Santa. Templates will be loaded from the template directory and is configurable via the template_master and template_santa configuration variables. """ REQUIRED_PARAMS = ['author', 'email', 'smtp', 'username', 'password'] def __init__(self, author, email, smtp, username, password, template_master="master.tmpl", template_santa="santa.tmpl"): self.author = author self.email = email self.smtp = smtp self.username = username self.password = password self.template_master = template_master self.template_santa = template_santa def send(self, pairings): """ Sends the emails out to the secret santa participants. The secret santa host (the user configured to send the email from) will receive a copy of the master list. Each Secret Santa will receive an email with the contents of the template_santa template. """ for pair in pairings: self._send_to_secret_santa(pair) self._send_master_list(pairings) def _do_send(self, toaddr, body, subject): try: msg = MIMEText(body) msg['Subject'] = subject msg['From'] = self.email msg['To'] = toaddr server = smtplib.SMTP(self.smtp) server.starttls() server.login(self.username, self.password) server.sendmail(self.email, [toaddr], msg.as_string()) server.quit() except: print("Error sending email to %s!" % toaddr) def _send_to_secret_santa(self, pair): """ Sends an email to the secret santa pairing. """ (giver, receiver) = pair template = j2env.get_template(self.template_santa) body = template.render(giver=giver, receiver=receiver) year = dt.utcnow().year subject = ('Your %s Farmer Family Secret Santa Match' % year) self._do_send(giver.email, body, subject) def _send_master_list(self, pairings): """ Sends an email to the game master. """ pair_list = [] for pair in pairings: (giver, recipient) = pair pair_list.append("%s -> %s" % (giver.name, recipient.name)) template = j2env.get_template(self.template_master) body = template.render(pairs=pair_list) year = dt.utcnow().year subject = ('%s Farmer Family Secret Santa Master List' % year) self._do_send(self.email, body, subject)
wolsen/secret-santa
secretsanta/mail.py
Python
mit
4,308
/** * Imports */ import React from 'react'; import connectToStores from 'fluxible-addons-react/connectToStores'; import {RouteHandler} from 'react-router'; import {slugify} from '../../../utils/strings'; // Flux import AccountStore from '../../../stores/Account/AccountStore'; import ApplicationStore from '../../../stores/Application/ApplicationStore'; import CollectionsStore from '../../../stores/Collections/CollectionsStore'; import DrawerStore from '../../../stores/Application/DrawerStore'; import IntlStore from '../../../stores/Application/IntlStore'; import NotificationQueueStore from '../../../stores/Application/NotificationQueueStore'; import PageLoadingStore from '../../../stores/Application/PageLoadingStore'; import popNotification from '../../../actions/Application/popNotification'; import triggerDrawer from '../../../actions/Application/triggerDrawer'; // Required components import Drawer from '../../common/layout/Drawer/Drawer'; import Footer from '../../common/layout/Footer'; import Header from '../../common/layout/Header'; import Heading from '../../common/typography/Heading'; import OverlayLoader from '../../common/indicators/OverlayLoader'; import SideCart from '../../common/cart/SideCart'; import SideMenu from '../../common/navigation/SideMenu'; import PopTopNotification from '../../common/notifications/PopTopNotification'; /** * Component */ class Application extends React.Component { static contextTypes = { executeAction: React.PropTypes.func.isRequired, getStore: React.PropTypes.func.isRequired, router: React.PropTypes.func.isRequired }; //*** Initial State ***// state = { navCollections: this.context.getStore(CollectionsStore).getMainNavigationCollections(), collectionsTree: this.context.getStore(CollectionsStore).getCollectionsTree(), notification: this.context.getStore(NotificationQueueStore).pop(), openedDrawer: this.context.getStore(DrawerStore).getOpenedDrawer(), pageLoading: this.context.getStore(PageLoadingStore).isLoading() }; //*** Component Lifecycle ***// componentDidMount() { // Load styles require('./Application.scss'); } componentWillReceiveProps(nextProps) { this.setState({ navCollections: nextProps._navCollections, collectionsTree: nextProps._collectionsTree, notification: nextProps._notification, openedDrawer: nextProps._openedDrawer, pageLoading: nextProps._pageLoading }); } //*** View Controllers ***// handleNotificationDismissClick = () => { this.context.executeAction(popNotification); }; handleOverlayClick = () => { this.context.executeAction(triggerDrawer, null); }; //*** Template ***// render() { let intlStore = this.context.getStore(IntlStore); // Main navigation menu items let collections = this.state.navCollections.map(function (collection) { return { name: intlStore.getMessage(collection.name), to: 'collection-slug', params: { collectionId: collection.id, collectionSlug: slugify(intlStore.getMessage(collection.name)) } }; }); // Compute CSS classes for the overlay let overlayClass = 'application__overlay'; if (this.state.openedDrawer === 'menu') { overlayClass += ' application__overlay--left-drawer-open'; } else if (this.state.openedDrawer === 'cart') { overlayClass += ' application__overlay--right-drawer-open'; } // Compute CSS classes for the content let contentClass = 'application__container'; if (this.state.openedDrawer === 'menu') { contentClass += ' application__container--left-drawer-open'; } else if (this.state.openedDrawer === 'cart') { contentClass += ' application__container--right-drawer-open'; } // Check if user logged-in is an Admin //let isAdmin = this.context.getStore(AccountStore).isAuthorized(['admin']); // Return return ( <div className="application"> {this.state.pageLoading ? <OverlayLoader /> : null } {this.state.notification ? <PopTopNotification key={this.context.getStore(ApplicationStore).uniqueId()} type={this.state.notification.type} onDismissClick={this.handleNotificationDismissClick}> {this.state.notification.message} </PopTopNotification> : null } <Drawer position="left" open={this.state.openedDrawer === 'menu'}> <SideMenu collections={collections} /> </Drawer> <Drawer position="right" open={this.state.openedDrawer === 'cart'}> <SideCart /> </Drawer> <div className={overlayClass} onClick={this.handleOverlayClick}> <div className="application__overlay-content"></div> </div> <div className={contentClass}> <Header collections={collections} collectionsTree={this.state.collectionsTree} /> <div className="application__container-wrapper"> <div className="application__container-content"> <RouteHandler /> </div> </div> <Footer /> </div> </div> ); } } /** * Flux */ Application = connectToStores(Application, [ AccountStore, CollectionsStore, DrawerStore, NotificationQueueStore, PageLoadingStore ], (context) => { return { _navCollections: context.getStore(CollectionsStore).getMainNavigationCollections(), _collectionsTree: context.getStore(CollectionsStore).getCollectionsTree(), _notification: context.getStore(NotificationQueueStore).pop(), _openedDrawer: context.getStore(DrawerStore).getOpenedDrawer(), _pageLoading: context.getStore(PageLoadingStore).isLoading() }; }); /** * Exports */ export default Application;
ESTEBANMURUZABAL/my-ecommerce-template
src/components/pages/Application/Application.js
JavaScript
mit
6,524
# frozen_string_literal: true require 'spec_helper' describe CloudPayments::Namespaces do subject{ CloudPayments::Client.new } describe '#payments' do specify{ expect(subject.payments).to be_instance_of(CloudPayments::Namespaces::Payments) } end describe '#subscriptions' do specify{ expect(subject.subscriptions).to be_instance_of(CloudPayments::Namespaces::Subscriptions) } end describe '#ping' do context 'when successful response' do before{ stub_api_request('ping/successful').perform } specify{ expect(subject.ping).to be_truthy } end context 'when failed response' do before{ stub_api_request('ping/failed').perform } specify{ expect(subject.ping).to be_falsy } end context 'when empty response' do before{ stub_api_request('ping/failed').to_return(body: '') } specify{ expect(subject.ping).to be_falsy } end context 'when error response' do before{ stub_api_request('ping/failed').to_return(status: 404) } specify{ expect(subject.ping).to be_falsy } end context 'when exception occurs while request' do before{ stub_api_request('ping/failed').to_raise(::Faraday::Error::ConnectionFailed) } specify{ expect(subject.ping).to be_falsy } end context 'when timeout occurs while request' do before{ stub_api_request('ping/failed').to_timeout } specify{ expect(subject.ping).to be_falsy } end end end
undr/cloud_payments
spec/cloud_payments/namespaces_spec.rb
Ruby
mit
1,453
/** * The main purpose of this in my mind is for navigation * this way when this route is entered either via direct url * or by a link-to etc you send a ping so that nav can be updated * in the hierarchy. * * curious about feedback. I have used something similar in practice * but it's mainly for keeping the ui correct and things like that * without tightly coupling things together or at least that is my * hope. */ export default Ember.Route.extend({ beforeModel: function(trans) { trans.send('ping', this.routeName); } });
matthewphilyaw/ember-demo
app/lib/routes/nav/ping.js
JavaScript
mit
554
using Windows.UI.Xaml.Controls; namespace ZhihuDaily.Models { public enum ArticleParagraphType { ArticleParagraphTypeText, ArticleParagraphTypeImage, ArticleParagraphTypeRichText, ArticleParagraphTypeLink, ArticleParagraphTypeLiangpingLink, ArticleParagraphTypeHrLine, //引用 ArticleParagraphTypeBlockquote, //标题 ArticleParagraphTypeH1, //引用 ArticleParagraphTypePre, //作者信息 ArticleParagraphTypeAuthor, //空行 ArticleParagraphTypeEmptyLine, //加粗 ArticleParagraphTypeStrongText, //视频 ArticleParagraphTypeVideo, //头像 ArticleParagraphTypeAvatar, //没有长评论 ArticleParagraphTypeNoLongComment, //评论 ArticleParagraphTypeComment, //广告 ArticleParagraphTypeAd, //评论标题 ArticleParagraphTypeCommentTitle, } public class ArticleParagraph { public ArticleParagraphType Type { get; set; } public string Content { get; set; } public string Value { get; set; } public string SubValue { get; set; } public object TagValue { get; set; } public RichTextBlock RichTextBlock { get; set; } } }
zhengbomo/ZhihuDaily
ZhihuDaily/ZhihuDaily/Models/ArticleParagraph.cs
C#
mit
1,353
// Copyright (c) the authors of nanoGames. All rights reserved. // Licensed under the MIT license. See LICENSE.txt in the project root. using OpenTK.Graphics.OpenGL4; using System; using System.Text; namespace NanoGames.Engine.OpenGLWrappers { /// <summary> /// Represents a shader program. /// </summary> internal sealed class Shader : IDisposable { private readonly int _id; /// <summary> /// Initializes a new instance of the <see cref="Shader"/> class /// loaded and compiled from an embedded resource. /// </summary> /// <param name="name">The name/path of the resource to load.</param> public Shader(string name) { int vertexShaderId = LoadProgram(name + ".vs.glsl", ShaderType.VertexShader); int fragmentShaderId = LoadProgram(name + ".fs.glsl", ShaderType.FragmentShader); _id = GL.CreateProgram(); GL.AttachShader(_id, vertexShaderId); GL.AttachShader(_id, fragmentShaderId); GL.LinkProgram(_id); int status; GL.GetProgram(_id, GetProgramParameterName.LinkStatus, out status); if (status == 0) { throw new Exception("Error linking shader: " + GL.GetProgramInfoLog(_id)); } } /// <inheritdoc/> public void Dispose() { GL.DeleteProgram(_id); } /// <summary> /// Binds the shader to the OpenGL context. /// </summary> public void Bind() { GL.UseProgram(_id); } private static int LoadProgram(string path, ShaderType type) { var source = LoadResource(path); var id = GL.CreateShader(type); GL.ShaderSource(id, source); GL.CompileShader(id); int status; GL.GetShader(id, ShaderParameter.CompileStatus, out status); if (status == 0) { throw new Exception("Error compiling shader: " + GL.GetShaderInfoLog(id)); } return id; } private static string LoadResource(string path) { var stream = typeof(Shader).Assembly.GetManifestResourceStream(path); using (var reader = new System.IO.StreamReader(stream, Encoding.UTF8)) { return reader.ReadToEnd(); } } } }
codeflo/nanogames
NanoGames/Engine/OpenGLWrappers/Shader.cs
C#
mit
2,467
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("Yet Another Patcher")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Martomo")] [assembly: AssemblyProduct("Yet Another Patcher")] [assembly: AssemblyCopyright("Copyright © Martomo 2012")] [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("92a94924-f318-4a9d-a3a1-33db6edbdbbf")] // 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")]
martomo/YAPatcher
YAPatcher/Properties/AssemblyInfo.cs
C#
mit
1,428
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace task_2 { class Program { static void Main(string[] args) { Console.WriteLine("Ohjelma laskee N ensimmäistä lukua yhteen."); string userInput = Console.ReadLine(); int number = int.Parse(userInput); int i = 1; int f = 1; int k = 1; if (number < 0) { k = -1; } do { i = i + 1; f = f + i; } while (i < number*k); Console.Write($"Syötit: {number}, Summa: {f*k}"); Console.ReadLine(); } } }
JoonasLeminen/programming-basics
loop-statements/loop-statements/task-2/Program.cs
C#
mit
792
import React, { PropTypes } from 'react'; import { Provider } from 'react-redux'; import Routers from './Routers'; /** * Component is exported for conditional usage in Root.js */ const Root = ({ store }) => ( /** * Provider is a component provided to us by the 'react-redux' bindings that * wraps our app - thus making the Redux store/state available to our 'connect()' * calls in component hierarchy below. */ <Provider store={store}> <div> {Routers} </div> </Provider> ); Root.propTypes = { store: PropTypes.object.isRequired // eslint-disable-line react/forbid-prop-types }; module.exports = Root;
yyssc/ssc30-admin
src/containers/Root.prod.js
JavaScript
mit
640
import actions from './shortcuts'; class MockClientStore { update(cb) { this.updateCallback = cb; } } describe('manager.shortcuts.actions.shortcuts', () => { describe('setOptions', () => { test('should update options', () => { const clientStore = new MockClientStore(); actions.setOptions({ clientStore }, { abc: 10 }); const state = { shortcutOptions: { bbc: 50, abc: 40 }, }; const stateUpdates = clientStore.updateCallback(state); expect(stateUpdates).toEqual({ shortcutOptions: { bbc: 50, abc: 10 }, }); }); test('should only update options for the key already defined', () => { const clientStore = new MockClientStore(); actions.setOptions({ clientStore }, { abc: 10, kki: 50 }); const state = { shortcutOptions: { bbc: 50, abc: 40 }, }; const stateUpdates = clientStore.updateCallback(state); expect(stateUpdates).toEqual({ shortcutOptions: { bbc: 50, abc: 10 }, }); }); test('should warn about deprecated option names', () => { const clientStore = new MockClientStore(); const spy = jest.spyOn(console, 'warn').mockImplementation(() => {}); actions.setOptions( { clientStore }, { showLeftPanel: 1, showDownPanel: 2, downPanelInRight: 3, } ); const state = { shortcutOptions: {}, }; const stateUpdates = clientStore.updateCallback(state); expect(spy).toHaveBeenCalledTimes(3); expect(stateUpdates).toEqual({ shortcutOptions: { showStoriesPanel: 1, showAddonPanel: 2, addonPanelInRight: 3, }, }); spy.mockReset(); spy.mockRestore(); }); }); });
rhalff/storybook
lib/ui/src/modules/shortcuts/actions/shortcuts.test.js
JavaScript
mit
1,792
using Builder.Localization; using Builder.Resolver; using System.Collections.Generic; namespace Builder.ParseTree { internal class FieldDefinition : TopLevelEntity, ICodeContainer { public Token NameToken { get; set; } public Expression DefaultValue { get; set; } public int MemberID { get; set; } public int StaticMemberID { get; set; } public AnnotationCollection Annotations { get; set; } public List<Lambda> Lambdas { get; private set; } public AType FieldType { get; private set; } public ResolvedType ResolvedFieldType { get; private set; } public HashSet<string> ArgumentNameLookup { get; private set; } public FieldDefinition( Token fieldToken, AType fieldType, Token nameToken, ClassDefinition owner, ModifierCollection modifiers, AnnotationCollection annotations) : base(fieldToken, owner, owner.FileScope, modifiers) { this.NameToken = nameToken; this.FieldType = fieldType; this.DefaultValue = null; this.MemberID = -1; this.Annotations = annotations; this.Lambdas = new List<Lambda>(); this.ArgumentNameLookup = new HashSet<string>(); if (modifiers.HasAbstract) throw new ParserException(modifiers.AbstractToken, "Fields cannot be abstract."); if (modifiers.HasOverride) throw new ParserException(modifiers.OverrideToken, "Fields cannot be marked as overrides."); if (modifiers.HasFinal) throw new ParserException(modifiers.FinalToken, "Final fields are not supported yet."); } public override string GetFullyQualifiedLocalizedName(Locale locale) { string name = this.NameToken.Value; if (this.TopLevelEntity != null) { name = this.TopLevelEntity.GetFullyQualifiedLocalizedName(locale) + "." + name; } return name; } internal override void Resolve(ParserContext parser) { this.DefaultValue = this.DefaultValue.Resolve(parser); } internal override void ResolveEntityNames(ParserContext parser) { if (this.DefaultValue != null) { parser.CurrentCodeContainer = this; this.DefaultValue = this.DefaultValue.ResolveEntityNames(parser); parser.CurrentCodeContainer = null; } } internal override void ResolveSignatureTypes(ParserContext parser, TypeResolver typeResolver) { this.ResolvedFieldType = typeResolver.ResolveType(this.FieldType); if (this.DefaultValue == null) { switch (this.ResolvedFieldType.Category) { case ResolvedTypeCategory.INTEGER: this.DefaultValue = new IntegerConstant(this.FirstToken, 0, this); break; case ResolvedTypeCategory.FLOAT: this.DefaultValue = new FloatConstant(this.FirstToken, 0.0, this); break; case ResolvedTypeCategory.BOOLEAN: this.DefaultValue = new BooleanConstant(this.FirstToken, false, this); break; default: this.DefaultValue = new NullConstant(this.FirstToken, this); break; } } } internal override void EnsureModifierAndTypeSignatureConsistency(TypeContext tc) { bool isStatic = this.Modifiers.HasStatic; ClassDefinition classDef = (ClassDefinition)this.Owner; ClassDefinition baseClass = classDef.BaseClass; bool hasBaseClass = baseClass != null; if (!isStatic && classDef.Modifiers.HasStatic) { throw new ParserException(this, "Cannot have non-static fields in a static class."); } if (hasBaseClass && baseClass.GetMember(this.NameToken.Value, true) != null) { throw new ParserException(this, "This field definition hides a member in a base class."); } } internal override void ResolveTypes(ParserContext parser, TypeResolver typeResolver) { this.DefaultValue.ResolveTypes(parser, typeResolver); this.DefaultValue.ResolvedType.EnsureCanAssignToA(this.DefaultValue.FirstToken, this.ResolvedFieldType); } internal void ResolveVariableOrigins(ParserContext parser) { if (this.DefaultValue != null) { VariableScope varScope = VariableScope.NewEmptyScope(this.CompilationScope.IsStaticallyTyped); this.DefaultValue.ResolveVariableOrigins(parser, varScope, VariableIdAllocPhase.REGISTER_AND_ALLOC); if (varScope.Size > 0) { // Although if you manage to trigger this, I'd love to know how. throw new ParserException(this, "Cannot declare a variable this way."); } Lambda.DoVarScopeIdAllocationForLambdaContainer(parser, varScope, this); } } } }
blakeohare/crayon
Compiler/Builder/ParseTree/FieldDefinition.cs
C#
mit
5,507
using System; using System.Collections.Generic; namespace Nucleo.Web { /// <summary> /// Represents a CSS file reference. This file is not used directly within any custom controls/extenders you may develop, though you can use it for your own needs. /// </summary> public class CssReference { private string _path = null; #region " Properties " /// <summary> /// Gets the path to the CSS file. /// </summary> public string Path { get { return _path; } } #endregion #region " Constructors " public CssReference(CssReferenceRequestDetails details) : this(details.Path) { } public CssReference(string path) { _path = path; } #endregion } }
brianmains/Nucleo.NET
src/Nucleo.Web/Web/CssReference.cs
C#
mit
700
ScalaJS.impls.scala_PartialFunction$class__orElse__Lscala_PartialFunction__Lscala_PartialFunction__Lscala_PartialFunction = (function($$this, that) { return new ScalaJS.c.scala_PartialFunction$OrElse().init___Lscala_PartialFunction__Lscala_PartialFunction($$this, that) }); ScalaJS.impls.scala_PartialFunction$class__andThen__Lscala_PartialFunction__Lscala_Function1__Lscala_PartialFunction = (function($$this, k) { return new ScalaJS.c.scala_PartialFunction$AndThen().init___Lscala_PartialFunction__Lscala_Function1($$this, k) }); ScalaJS.impls.scala_PartialFunction$class__lift__Lscala_PartialFunction__Lscala_Function1 = (function($$this) { return new ScalaJS.c.scala_PartialFunction$Lifted().init___Lscala_PartialFunction($$this) }); ScalaJS.impls.scala_PartialFunction$class__applyOrElse__Lscala_PartialFunction__O__Lscala_Function1__O = (function($$this, x, default$2) { if ($$this.isDefinedAt__O__Z(x)) { return $$this.apply__O__O(x) } else { return default$2.apply__O__O(x) } }); ScalaJS.impls.scala_PartialFunction$class__runWith__Lscala_PartialFunction__Lscala_Function1__Lscala_Function1 = (function($$this, action) { return new ScalaJS.c.scala_scalajs_runtime_AnonFunction1().init___Lscala_scalajs_js_Function1((function(arg$outer, action$1) { return (function(x) { var z = arg$outer.applyOrElse__O__Lscala_Function1__O(x, ScalaJS.modules.scala_PartialFunction().scala$PartialFunction$$checkFallback__Lscala_PartialFunction()); if ((!ScalaJS.modules.scala_PartialFunction().scala$PartialFunction$$fallbackOccurred__O__Z(z))) { action$1.apply__O__O(z); var jsx$1 = true } else { var jsx$1 = false }; return ScalaJS.bZ(jsx$1) }) })($$this, action)) }); ScalaJS.impls.scala_PartialFunction$class__$init$__Lscala_PartialFunction__V = (function($$this) { /*<skip>*/ }); //@ sourceMappingURL=PartialFunction$class.js.map
ignaciocases/hermeneumatics
node_modules/scala-node/main/target/streams/compile/externalDependencyClasspath/$global/package-js/extracted-jars/scalajs-library_2.10-0.4.0.jar--29fb2f8b/scala/PartialFunction$class.js
JavaScript
mit
1,915
public class SockServer { /** * @param args */ public static void main(String[] args) { SockServerController server = new SockServerController(9679); server.runServer(); } }
shwarzes89/ExpressionPredictor
src/SockServer.java
Java
mit
203
require 'spec_helper' module JustShellScripts describe Connection do end end
MYOB-Technology/just_shell_scripts
spec/just_shell_scripts/connection_spec.rb
Ruby
mit
82
function autonomous_start() { autonomousStartTime = gameVideo.currentTime; initializeEvents(); }
movon/scoutingReimagined
ScoutingReimagined/public/js/scouting/events/autonomousEventsHandling.js
JavaScript
mit
104
<?php return array ( 'id' => 'ght_chat_ver1', 'fallback' => 'generic_ght', 'capabilities' => array ( 'mobile_browser' => 'MAUI Wap Browser', 'pointing_method' => 'touchscreen', 'mobile_browser_version' => '1.0', 'uaprof' => 'http://www.ghtmobile.com/ght/T500.xml', 'model_name' => 'Chat', 'brand_name' => 'BayMobile', 'release_date' => '2010_october', 'softkey_support' => 'true', 'table_support' => 'true', 'wml_1_3' => 'true', 'columns' => '16', 'rows' => '16', 'resolution_width' => '220', 'resolution_height' => '176', 'jpg' => 'true', 'gif' => 'true', 'bmp' => 'true', 'wbmp' => 'true', 'colors' => '4096', 'nokia_voice_call' => 'true', 'wta_phonebook' => 'true', 'max_deck_size' => '65536', 'wap_push_support' => 'true', 'mms_max_size' => '100000', 'mms_max_width' => '640', 'mms_spmidi' => 'true', 'mms_max_height' => '480', 'mms_gif_static' => 'true', 'mms_wav' => 'true', 'mms_vcard' => 'true', 'mms_midi_monophonic' => 'true', 'mms_bmp' => 'true', 'mms_wbmp' => 'true', 'mms_amr' => 'true', 'mms_jpeg_baseline' => 'true', 'wav' => 'true', 'sp_midi' => 'true', 'amr' => 'true', 'midi_monophonic' => 'true', 'imelody' => 'true', 'streaming_vcodec_h263_0' => '10', 'streaming_3gpp' => 'true', 'streaming_acodec_amr' => 'nb', 'streaming_video' => 'true', 'playback_vcodec_h263_3' => '10', 'playback_3gpp' => 'true', 'playback_acodec_amr' => 'nb', ), );
cuckata23/wurfl-data
data/ght_chat_ver1.php
PHP
mit
1,558
<?php class VMAlumno_Controller extends CI_Controller{ function index(){ $this->load->view('admin/VMA'); } } ?>
Gabriel2793/siprac
application/controllers/VMAlumno_Controller.php
PHP
mit
124
import java.awt.Color; import java.awt.Dimension; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; /** * Demonstrate 2D array of GUI components. (This could all be done using a * 1D array. See MiniColorChooserV1.java and MiniColorChooserV2.java). * * Get color from the clicked button, itself. * * @author CS121 Instructors */ @SuppressWarnings("serial") public class TwoDColorChooser extends JPanel { private final Color[][] COLORS = { { Color.RED, Color.GREEN, Color.BLUE }, { Color.YELLOW, Color.CYAN, Color.MAGENTA }, { Color.WHITE, Color.BLACK, Color.GRAY }, { Color.PINK, Color.ORANGE, Color.LIGHT_GRAY} }; private JButton[][] colorButtons; private JPanel displayPanel; /** * main panel constructor */ private TwoDColorChooser() { //sub-panel for grid of color choices JPanel gridPanel = new JPanel(); gridPanel.setLayout(new GridLayout(COLORS.length, COLORS[0].length)); gridPanel.setPreferredSize(new Dimension(300, 300)); //sub-panel to display chosen color displayPanel = new JPanel(); displayPanel.setPreferredSize(new Dimension(300,300)); //instantiate a ColorButtonListener. all buttons should share the same instance. ColorButtonListener listener = new ColorButtonListener(); //buttons colorButtons = new JButton[COLORS.length][COLORS[0].length]; for (int i = 0; i < colorButtons.length; i++) { for(int j = 0; j < colorButtons[0].length; j++) { colorButtons[i][j] = new JButton(); colorButtons[i][j].setBackground(COLORS[i][j]); colorButtons[i][j].addActionListener(listener); gridPanel.add(colorButtons[i][j]); } } //add sub-panels to this panel this.add(gridPanel); this.add(displayPanel); } private class ColorButtonListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { // have to cast generic Object reference from e.getSource() // to a JButton reference in order to use button method // getBackground() JButton source = (JButton)(e.getSource()); //set display panel to the color of the button that was clicked displayPanel.setBackground(source.getBackground()); } } /** * Initialize the GUI and make it visible * @param args unused */ public static void main(String[] args) { JFrame frame = new JFrame("Mini-ColorChooser"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(new TwoDColorChooser()); frame.pack(); frame.setVisible(true); } }
BoiseState/CS121-resources
examples/chap06/TwoDColorChooser.java
Java
mit
2,653