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
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; namespace Smart_radio_controller_windows_forms { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new main()); } } }
RineshRamadhin/Smart-babyroom
Smart radio controller windows forms/Program.cs
C#
mit
536
namespace Bike.Ast { public partial class Argument : Node { public bool ShouldExpand; public ExprNode Expression; } }
buunguyen/bike
src/Bike/Ast/Expressions/Argument.cs
C#
mit
149
/** * Created by XD on 2016/7/24. */ export enum DeleteEnum{ //未删除 NotDel=0, //已删除 IsDel=1 } export function getDeleteEnumDisplayName(deleteEnum:DeleteEnum){ return { [DeleteEnum.IsDel]:'已删', [DeleteEnum.NotDel]:'未删' }[deleteEnum] } export enum CheckEnum { /// <summary> /// 未通过:2 /// </summary> UnPass = 2, /// 未审核:0 Waiting = 0, /// <summary> /// 已审核:1 /// </summary> Pass = 1, } export enum UseStateEnum { /// <summary> /// 启用1 /// </summary> Enable = 1, /// <summary> /// 停用0 /// </summary> Disable = 0 } export enum SexEnum { /// <summary> /// 未知0 /// </summary> Unknown = 0, /// <summary> /// 男1 // / </summary> Man = 1, /// <summary> /// 女2 /// </summary> Woman = 2 } export enum FormsRole { /// <summary> /// 管理员 /// </summary> Admin=0, /// <summary> /// 网站用户 /// </summary> Member=1 }
duanguang/react-node-cms
client/src/utils/EnumTool.ts
TypeScript
mit
1,064
//数据的视觉映射 // 数据可视化是 数据 到 视觉元素 的映射过程(这个过程也可称为视觉编码,视觉元素也可称为视觉通道)。 // data ----> graph //使用visualmap提供通用的视觉映射 visualmap 属性有 1.图形类别symbol 2.图像大小symbolSize 3.颜色color 4.透明度opacity 5.颜色透明度 colorAlpha // 6.颜色明暗度colorLightness 7.颜色饱和度colorSturaction 8.色调colorHue //数据和维度 // 引入 ECharts 主模块 var echarts = require('echarts/lib/echarts'); require('echarts/lib/chart/line'); require('echarts/lib/component/graphic'); require('echarts/lib/component/tooltip'); var symbolSize = 20; // 这个 data 变量在这里单独声明,在后面也会用到。 var data = [[15, 0], [-50, 10], [-56.5, 20], [-46.5, 30], [-22.1, 40]]; var myChart = echarts.init(document.getElementById('root')); myChart.setOption({ tooltip: { // 表示不使用默认的『显示』『隐藏』触发规则。 triggerOn: 'none', formatter: function (params) { return 'X: ' + params.data[0].toFixed(2) + '<br>Y: ' + params.data[1].toFixed(2); } }, xAxis: { min: -100, max: 80, type: 'value', axisLine: { onZero: false } }, yAxis: { min: -30, max: 60, type: 'value', axisLine: { onZero: false } }, series: [ { id: 'a', type: 'line', smooth: true, symbolSize: symbolSize, // 为了方便拖拽,把 symbolSize 尺寸设大了。 data: data } ] }); myChart.setOption({ // 声明一个 graphic component,里面有若干个 type 为 'circle' 的 graphic elements。 // 这里使用了 echarts.util.map 这个帮助方法,其行为和 Array.prototype.map 一样,但是兼容 es5 以下的环境。 // 用 map 方法遍历 data 的每项,为每项生成一个圆点。 graphic: echarts.util.map(data, function (dataItem, dataIndex) { return { // 'circle' 表示这个 graphic element 的类型是圆点。 type: 'circle', shape: { // 圆点的半径。 r: symbolSize / 2 }, // 用 transform 的方式对圆点进行定位。position: [x, y] 表示将圆点平移到 [x, y] 位置。 // 这里使用了 convertToPixel 这个 API 来得到每个圆点的位置,下面介绍。 position: myChart.convertToPixel('grid', dataItem), // 这个属性让圆点不可见(但是不影响他响应鼠标事件)。 invisible: true, // 这个属性让圆点可以被拖拽。 draggable: true, // 把 z 值设得比较大,表示这个圆点在最上方,能覆盖住已有的折线图的圆点。 z: 100, // 在 mouseover 的时候显示,在 mouseout 的时候隐藏。 onmousemove: echarts.util.curry(showTooltip, dataIndex), onmouseout: echarts.util.curry(hideTooltip, dataIndex), // 此圆点的拖拽的响应事件,在拖拽过程中会不断被触发。下面介绍详情。 // 这里使用了 echarts.util.curry 这个帮助方法,意思是生成一个与 onPointDragging // 功能一样的新的函数,只不过第一个参数永远为此时传入的 dataIndex 的值。 ondrag: echarts.util.curry(onPointDragging, dataIndex) }; }) }); // 拖拽某个圆点的过程中会不断调用此函数。 // 此函数中会根据拖拽后的新位置,改变 data 中的值,并用新的 data 值,重绘折线图,从而使折线图同步于被拖拽的隐藏圆点。 function onPointDragging(dataIndex) { // 这里的 data 就是本文最初的代码块中声明的 data,在这里会被更新。 // 这里的 this 就是被拖拽的圆点。this.position 就是圆点当前的位置。 data[dataIndex] = myChart.convertFromPixel('grid', this.position); // 用更新后的 data,重绘折线图。 myChart.setOption({ series: [{ id: 'a', data: data }] }); } window.addEventListener('resize', function () { // 对每个拖拽圆点重新计算位置,并用 setOption 更新。 myChart.setOption({ graphic: echarts.util.map(data, function (item, dataIndex) { return { position: myChart.convertToPixel('grid', item) }; }) }); }); function showTooltip(dataIndex) { myChart.dispatchAction({ type: 'showTip', seriesIndex: 0, dataIndex: dataIndex }); } function hideTooltip(dataIndex) { myChart.dispatchAction({ type: 'hideTip' }); }
wx11055/learn-js-webpack
examples/echarts/dragdemo.js
JavaScript
mit
4,827
<?php function connection() { // serwer $mysql_server = "127.0.0.1"; // admin $mysql_admin = "root"; // hasło $mysql_pass = ""; // nazwa baza $mysql_db = "zaklad_tapicerski"; // nawiązujemy połączenie z serwerem MySQL @mysql_connect($mysql_server, $mysql_admin, $mysql_pass) or die('Brak połączenia z serwerem MySQL.'); // łączymy się z bazą danych @mysql_select_db($mysql_db) or die('Błąd wyboru bazy danych.'); } ?>
seba316d/portfolio
zaklad-tapicerski/panel_admina/config/polacz.php
PHP
mit
523
package rodzillaa.github.io.rodzilla.utils; public class APIUtil { public static final String SERVER_URL = "http://ec2-54-174-96-216.compute-1.amazonaws.com:9000"; }
Rodzillaa/rodzilla-android
app/src/main/java/rodzillaa/github/io/rodzilla/utils/APIUtil.java
Java
mit
171
package weka.analyzers.mineData; import java.util.BitSet; /** * The Disjunction of other cached rules. * * @param <T> the type of CachedRule contained in this RuleSet */ public class CachedRuleDisjunction<T extends CachedRule> extends CachedRuleSet<T> { /** * Construct a new empty RuleDisjunction that covers all Instances. * * @param numInstances number of instances this RuleSet should cover */ public CachedRuleDisjunction(int numInstances) { super(numInstances, "OR"); } @Override protected void addBitSet(BitSet other) { covered.or(other); } }
chrisc36/weka-analyzer
src/main/java/weka/analyzers/mineData/CachedRuleDisjunction.java
Java
mit
645
require "spec_helper" describe LicensesController do describe "routing" do it "recognizes and generates #index" do { :get => "/licenses" }.should route_to(:controller => "licenses", :action => "index") end it "recognizes and generates #new" do { :get => "/licenses/new" }.should route_to(:controller => "licenses", :action => "new") end it "recognizes and generates #show" do { :get => "/licenses/1" }.should route_to(:controller => "licenses", :action => "show", :id => "1") end it "recognizes and generates #edit" do { :get => "/licenses/1/edit" }.should route_to(:controller => "licenses", :action => "edit", :id => "1") end it "recognizes and generates #create" do { :post => "/licenses" }.should route_to(:controller => "licenses", :action => "create") end it "recognizes and generates #update" do { :put => "/licenses/1" }.should route_to(:controller => "licenses", :action => "update", :id => "1") end it "recognizes and generates #destroy" do { :delete => "/licenses/1" }.should route_to(:controller => "licenses", :action => "destroy", :id => "1") end end end
MiraitSystems/enju_trunk
spec/routings/licenses_routing_spec.rb
Ruby
mit
1,180
'use strict'; var React = require('react'); var mui = require('material-ui'); var SvgIcon = mui.SvgIcon; var DeviceSignalCellularConnectedNoInternet2Bar = React.createClass({ displayName: 'DeviceSignalCellularConnectedNoInternet2Bar', render: function render() { return React.createElement( SvgIcon, this.props, React.createElement('path', { 'fillOpacity': '.3', d: 'M22 8V2L2 22h16V8z' }), React.createElement('path', { d: 'M14 22V10L2 22h12zm6-12v8h2v-8h-2zm0 12h2v-2h-2v2z' }) ); } }); module.exports = DeviceSignalCellularConnectedNoInternet2Bar;
jotamaggi/react-calendar-app
node_modules/react-material-icons/icons/device/signal-cellular-connected-no-internet-2-bar.js
JavaScript
mit
593
/** * Created by tkachenko on 14.04.15. */ ATF.invoke(['$directiveProvider', 'utils', 'jQuery'], function ($directiveProvider, utils, $) { $directiveProvider.register('$On', { link: function (name, $el, scope, args, vars) { var __vars = vars||{}; if (!args[0] || !args[1]) { return $el; } var eventName = args[0]; var expr = utils.eval(args[1]); var apply = args[2]; if (eventName.toLowerCase() === 'transitionend') { eventName = 'webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend'; } $($el).on(eventName, function ($event) { __vars.$event = $event; if (args[2] || eventName === 'click') { $event.preventDefault(); } expr.call(this, scope, __vars); if (apply) { scope.$apply(); } }); return $el; } }); });
andreytkachenko/atframework
src/annotations/on.js
JavaScript
mit
1,070
import Constants from '../constants'; import LinkDrawable from './link'; import SphericalPortalLinkMesh from '../mesh/spherical-portal-link'; /** * Represents a portal link that follows the surface of a sphere. * * Hooray for custom shaders, etc! */ class SphericalPortalLinkDrawable extends LinkDrawable { /** * Construct a spherical portal link * @param {Number} sphereRadius Radius of the sphere * @param {vec2} start Lat,lng of the origin portal * @param {vec2} end Lat,lng of the destination portal * @param {vec4} color Color of the link * @param {Number} startPercent Percent health of the origin portal * @param {Number} endPercent Percent health of the destination portal */ constructor(sphereRadius, start, end, color, startPercent, endPercent) { super(Constants.Program.SphericalLink, Constants.Texture.PortalLink); this.radius = sphereRadius; this.start = start; this.end = end; this.color = color; this.startPercent = startPercent; this.endPercent = endPercent; } /** * Constructs a mesh for the link, then initializes the remaining assets. * @param {AssetManager} manager AssetManager containing the program/texture * @return {Boolean} Success/failure */ init(manager) { this.mesh = new SphericalPortalLinkMesh( manager._gl, this.radius, this.start, this.end, this.color, this.startPercent, this.endPercent ); return super.init(manager); } updateView(viewProject, view, project) { super.updateView(viewProject, view, project); this.uniforms.u_model = this.model; } } export default SphericalPortalLinkDrawable;
evshiron/ingress-model-viewer
src/drawable/spherical-portal-link.js
JavaScript
mit
1,728
# Generated by Django 2.2.12 on 2020-08-23 07:26 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('job_board', '0004_jobpost_is_from_recruiting_agency'), ] operations = [ migrations.AlterField( model_name='jobpost', name='location', field=models.CharField(choices=[('CH', 'Chicago'), ('CT', 'Chicago and Temporarily Remote'), ('CR', 'Chicago and Remote'), ('RO', 'Remote Only')], default='CH', help_text='ChiPy is a locally based group. Position must not move candidate out of the Chicago area. Working remote or commuting is acceptable. Any position requiring relocation out of the Chicago land is out of scope of the mission of the group.', max_length=2), ), ]
chicagopython/chipy.org
chipy_org/apps/job_board/migrations/0005_auto_20200823_0726.py
Python
mit
793
using System; using System.Collections.Generic; using Unit = System.ValueTuple; namespace LaYumba.Functional { using System.Threading.Tasks; using static F; public static partial class F { public static Option<T> Some<T>(T value) => new Option.Some<T>(value); // wrap the given value into a Some public static Option.None None => Option.None.Default; // the None value } public struct Option<T> : IEquatable<Option.None>, IEquatable<Option<T>> { readonly T value; readonly bool isSome; bool isNone => !isSome; private Option(T value) { if (value == null) throw new ArgumentNullException(); this.isSome = true; this.value = value; } public static implicit operator Option<T>(Option.None _) => new Option<T>(); public static implicit operator Option<T>(Option.Some<T> some) => new Option<T>(some.Value); public static implicit operator Option<T>(T value) => value == null ? None : Some(value); public R Match<R>(Func<R> None, Func<T, R> Some) => isSome ? Some(value) : None(); public IEnumerable<T> AsEnumerable() { if (isSome) yield return value; } public bool Equals(Option<T> other) => this.isSome == other.isSome && (this.isNone || this.value.Equals(other.value)); public bool Equals(Option.None _) => isNone; public static bool operator ==(Option<T> @this, Option<T> other) => @this.Equals(other); public static bool operator !=(Option<T> @this, Option<T> other) => !(@this == other); public override string ToString() => isSome ? $"Some({value})" : "None"; } namespace Option { public struct None { internal static readonly None Default = new None(); } public struct Some<T> { internal T Value { get; } internal Some(T value) { if (value == null) throw new ArgumentNullException(nameof(value) , "Cannot wrap a null value in a 'Some'; use 'None' instead"); Value = value; } } } public static class OptionExt { public static Option<R> Apply<T, R> (this Option<Func<T, R>> @this, Option<T> arg) => @this.Match( () => None, (func) => arg.Match( () => None, (val) => Some(func(val)))); public static Option<Func<T2, R>> Apply<T1, T2, R> (this Option<Func<T1, T2, R>> @this, Option<T1> arg) => Apply(@this.Map(F.Curry), arg); public static Option<Func<T2, T3, R>> Apply<T1, T2, T3, R> (this Option<Func<T1, T2, T3, R>> @this, Option<T1> arg) => Apply(@this.Map(F.CurryFirst), arg); public static Option<Func<T2, T3, T4, R>> Apply<T1, T2, T3, T4, R> (this Option<Func<T1, T2, T3, T4, R>> @this, Option<T1> arg) => Apply(@this.Map(F.CurryFirst), arg); public static Option<Func<T2, T3, T4, T5, R>> Apply<T1, T2, T3, T4, T5, R> (this Option<Func<T1, T2, T3, T4, T5, R>> @this, Option<T1> arg) => Apply(@this.Map(F.CurryFirst), arg); public static Option<Func<T2, T3, T4, T5, T6, R>> Apply<T1, T2, T3, T4, T5, T6, R> (this Option<Func<T1, T2, T3, T4, T5, T6, R>> @this, Option<T1> arg) => Apply(@this.Map(F.CurryFirst), arg); public static Option<Func<T2, T3, T4, T5, T6, T7, R>> Apply<T1, T2, T3, T4, T5, T6, T7, R> (this Option<Func<T1, T2, T3, T4, T5, T6, T7, R>> @this, Option<T1> arg) => Apply(@this.Map(F.CurryFirst), arg); public static Option<Func<T2, T3, T4, T5, T6, T7, T8, R>> Apply<T1, T2, T3, T4, T5, T6, T7, T8, R> (this Option<Func<T1, T2, T3, T4, T5, T6, T7, T8, R>> @this, Option<T1> arg) => Apply(@this.Map(F.CurryFirst), arg); public static Option<Func<T2, T3, T4, T5, T6, T7, T8, T9, R>> Apply<T1, T2, T3, T4, T5, T6, T7, T8, T9, R> (this Option<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, R>> @this, Option<T1> arg) => Apply(@this.Map(F.CurryFirst), arg); public static Option<R> Bind<T, R> (this Option<T> optT, Func<T, Option<R>> f) => optT.Match( () => None, (t) => f(t)); public static IEnumerable<R> Bind<T, R> (this Option<T> @this, Func<T, IEnumerable<R>> func) => @this.AsEnumerable().Bind(func); public static Option<Unit> ForEach<T>(this Option<T> @this, Action<T> action) => Map(@this, action.ToFunc()); public static Option<R> Map<T, R> (this Option.None _, Func<T, R> f) => None; public static Option<R> Map<T, R> (this Option.Some<T> some, Func<T, R> f) => Some(f(some.Value)); public static Option<R> Map<T, R> (this Option<T> optT, Func<T, R> f) => optT.Match( () => None, (t) => Some(f(t))); public static Option<Func<T2, R>> Map<T1, T2, R> (this Option<T1> @this, Func<T1, T2, R> func) => @this.Map(func.Curry()); public static Option<Func<T2, T3, R>> Map<T1, T2, T3, R> (this Option<T1> @this, Func<T1, T2, T3, R> func) => @this.Map(func.CurryFirst()); public static IEnumerable<Option<R>> Traverse<T, R>(this Option<T> @this , Func<T, IEnumerable<R>> func) => @this.Match( () => List((Option<R>)None), (t) => func(t).Map(r => Some(r))); // utilities public static Unit Match<T>(this Option<T> @this, Action None, Action<T> Some) => @this.Match(None.ToFunc(), Some.ToFunc()); internal static bool IsSome<T>(this Option<T> @this) => @this.Match( () => false, (_) => true); internal static T ValueUnsafe<T>(this Option<T> @this) => @this.Match( () => { throw new InvalidOperationException(); }, (t) => t); public static T GetOrElse<T>(this Option<T> opt, T defaultValue) => opt.Match( () => defaultValue, (t) => t); public static T GetOrElse<T>(this Option<T> opt, Func<T> fallback) => opt.Match( () => fallback(), (t) => t); public static Task<T> GetOrElse<T>(this Option<T> opt, Func<Task<T>> fallback) => opt.Match( () => fallback(), (t) => Async(t)); public static Option<T> OrElse<T>(this Option<T> left, Option<T> right) => left.Match( () => right, (_) => left); public static Option<T> OrElse<T>(this Option<T> left, Func<Option<T>> right) => left.Match( () => right(), (_) => left); public static Validation<T> ToValidation<T>(this Option<T> opt, Func<Error> error) => opt.Match( () => Invalid(error()), (t) => Valid(t)); // LINQ public static Option<R> Select<T, R>(this Option<T> @this, Func<T, R> func) => @this.Map(func); public static Option<T> Where<T> (this Option<T> optT, Func<T, bool> predicate) => optT.Match( () => None, (t) => predicate(t) ? optT : None); public static Option<RR> SelectMany<T, R, RR> (this Option<T> opt, Func<T, Option<R>> bind, Func<T, R, RR> project) => opt.Match( () => None, (t) => bind(t).Match( () => None, (r) => Some(project(t, r)))); } }
la-yumba/functional-csharp-code
LaYumba.Functional/Option.cs
C#
mit
7,599
require "rails_helper" describe %q{ As an admin I can edit users } do let!(:admin) { create :user, :admin } before { login_as_admin admin } feature "submitting form" do let!(:user) { create :user } before do visit edit_admin_user_path(user) end let(:attributes) { attributes_for(:user).slice( :name, :nickname, :email, :password, :password_confirmation ) } it { # fill form! attributes.each do |key, value| label = I18n.t("activerecord.attributes.user.#{key}") fill_in label, with: value end # submit form! find("input[type='submit']").click expect(user.reload.name).to eq(attributes[:name]) expect(page).to have_content( I18n.t("admin.user.updated") ) } end end
noggalito/porttare-backend
spec/features/admin/users/update_spec.rb
Ruby
mit
842
<?php /** * Magento * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@magento.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magento.com for more information. * * @category Mage * @package Mage_Eav * @copyright Copyright (c) 2006-2019 Magento, Inc. (http://www.magento.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** * EAV Entity Attribute File Data Model * * @category Mage * @package Mage_Eav * @author Magento Core Team <core@magentocommerce.com> */ class Mage_Eav_Model_Attribute_Data_File extends Mage_Eav_Model_Attribute_Data_Abstract { /** * Validator for check not protected extensions * * @var Mage_Core_Model_File_Validator_NotProtectedExtension */ protected $_validatorNotProtectedExtensions; /** * Extract data from request and return value * * @param Zend_Controller_Request_Http $request * @return array|string */ public function extractValue(Zend_Controller_Request_Http $request) { if ($this->getIsAjaxRequest()) { return false; } $extend = $this->_getRequestValue($request); $attrCode = $this->getAttribute()->getAttributeCode(); if ($this->_requestScope) { $value = array(); if (strpos($this->_requestScope, '/') !== false) { $scopes = explode('/', $this->_requestScope); $mainScope = array_shift($scopes); } else { $mainScope = $this->_requestScope; $scopes = array(); } if (!empty($_FILES[$mainScope])) { foreach ($_FILES[$mainScope] as $fileKey => $scopeData) { foreach ($scopes as $scopeName) { if (isset($scopeData[$scopeName])) { $scopeData = $scopeData[$scopeName]; } else { $scopeData[$scopeName] = array(); } } if (isset($scopeData[$attrCode])) { $value[$fileKey] = $scopeData[$attrCode]; } } } else { $value = array(); } } else { if (isset($_FILES[$attrCode])) { $value = $_FILES[$attrCode]; } else { $value = array(); } } if (!empty($extend['delete'])) { $value['delete'] = true; } return $value; } /** * Validate file by attribute validate rules * Return array of errors * * @param array $value * @return array */ protected function _validateByRules($value) { $label = $this->getAttribute()->getStoreLabel(); $rules = $this->getAttribute()->getValidateRules(); $extension = pathinfo($value['name'], PATHINFO_EXTENSION); if (!empty($rules['file_extensions'])) { $extensions = explode(',', $rules['file_extensions']); $extensions = array_map('trim', $extensions); if (!in_array($extension, $extensions)) { return array( Mage::helper('eav')->__('"%s" is not a valid file extension.', $label) ); } } /** * Check protected file extension */ /** @var $validator Mage_Core_Model_File_Validator_NotProtectedExtension */ $validator = Mage::getSingleton('core/file_validator_notProtectedExtension'); if (!$validator->isValid($extension)) { return $validator->getMessages(); } if (!is_uploaded_file($value['tmp_name'])) { return array( Mage::helper('eav')->__('"%s" is not a valid file.', $label) ); } if (!empty($rules['max_file_size'])) { $size = $value['size']; if ($rules['max_file_size'] < $size) { return array( Mage::helper('eav')->__('"%s" exceeds the allowed file size.', $label) ); }; } return array(); } /** * Validate data * * @param array|string $value * @throws Mage_Core_Exception * @return boolean */ public function validateValue($value) { if ($this->getIsAjaxRequest()) { return true; } $errors = array(); $attribute = $this->getAttribute(); $label = $attribute->getStoreLabel(); $toDelete = !empty($value['delete']) ? true : false; $toUpload = !empty($value['tmp_name']) ? true : false; if (!$toUpload && !$toDelete && $this->getEntity()->getData($attribute->getAttributeCode())) { return true; } if (!$attribute->getIsRequired() && !$toUpload) { return true; } if ($attribute->getIsRequired() && !$toUpload) { $errors[] = Mage::helper('eav')->__('"%s" is a required value.', $label); } if ($toUpload) { $errors = array_merge($errors, $this->_validateByRules($value)); } if (count($errors) == 0) { $attribute->setAttributeValidationAsPassed(); return true; } return $errors; } /** * Export attribute value to entity model * * @param Mage_Core_Model_Abstract $entity * @param array|string $value * @return Mage_Eav_Model_Attribute_Data_File */ public function compactValue($value) { if ($this->getIsAjaxRequest()) { return $this; } $attribute = $this->getAttribute(); if (!$attribute->isAttributeValidationPassed()) { return $this; } $original = $this->getEntity()->getData($attribute->getAttributeCode()); $toDelete = false; if ($original) { if (!$attribute->getIsRequired() && !empty($value['delete'])) { $toDelete = true; } if (!empty($value['tmp_name'])) { $toDelete = true; } } $path = Mage::getBaseDir('media') . DS . $attribute->getEntity()->getEntityTypeCode(); // unlink entity file if ($toDelete) { $this->getEntity()->setData($attribute->getAttributeCode(), ''); $file = $path . $original; $ioFile = new Varien_Io_File(); if ($ioFile->fileExists($file)) { $ioFile->rm($file); } } if (!empty($value['tmp_name'])) { try { $uploader = new Varien_File_Uploader($value); $uploader->setFilesDispersion(true); $uploader->setFilenamesCaseSensitivity(false); $uploader->setAllowRenameFiles(true); $uploader->save($path, $value['name']); $fileName = $uploader->getUploadedFileName(); $this->getEntity()->setData($attribute->getAttributeCode(), $fileName); } catch (Exception $e) { Mage::logException($e); } } return $this; } /** * Restore attribute value from SESSION to entity model * * @param array|string $value * @return Mage_Eav_Model_Attribute_Data_File */ public function restoreValue($value) { return $this; } /** * Return formated attribute value from entity model * * @return string|array */ public function outputValue($format = Mage_Eav_Model_Attribute_Data::OUTPUT_FORMAT_TEXT) { $output = ''; $value = $this->getEntity()->getData($this->getAttribute()->getAttributeCode()); if ($value) { switch ($format) { case Mage_Eav_Model_Attribute_Data::OUTPUT_FORMAT_JSON: $output = array( 'value' => $value, 'url_key' => Mage::helper('core')->urlEncode($value) ); break; } } return $output; } }
portchris/NaturalRemedyCompany
src/app/code/core/Mage/Eav/Model/Attribute/Data/File.php
PHP
mit
8,811
/** * @fileOverview js-itm: a Javascript library for converting between Israel Transverse Mercator (ITM) and GPS (WGS84) coordinates.<p> * <a href="http://code.google.com/p/js-itm/">http://code.google.com/p/js-itm/</a> * @author Udi Oron (udioron at g mail dot com) * @author forked from <a href="http://www.nearby.org.uk/tests/GeoTools.html">GeoTools</a> by Paul Dixon * @copyright <a href="http://www.gnu.org/copyleft/gpl.html">GPL</a> * @version 0.1.1 ($Rev$ $Date$) */ /** * Parent namespace for the entire library * @namespace */ JSITM = {}; /**************************************************************/ /** * Creates a new LatLng. * * @class holds geographic coordinates measured in degrees.<br/> * <a href="http://en.wikipedia.org/wiki/Geographic_coordinate">http://en.wikipedia.org/wiki/Geographic_coordinate</a> * * @constructor * @param {Number} lat latitude in degrees ( http://en.wikipedia.org/wiki/Latitude ) * @param {Number} lng longtitude in degrees ( http://en.wikipedia.org/wiki/Longitude ) * @param {Number} alt altitude in meters above the uesd geoid surface - this was not used or tested - please keep this always 0. * @param {Number} precision number of digits after the decimal point, used in printout. see toString(). */ JSITM.LatLng = function(lat, lng, alt, precision){ this.lat = lat; this.lng = lng; this.alt = alt || 0; this.precision = precision || 5; } /** * Returns Latlng as string, using the defined preccision * @return {String} */ JSITM.LatLng.prototype.toString = function(){ function round(n, precision){ var m = Math.pow(10, precision || 0); return Math.round(n * m) / m; } return round(this.lat, this.precision) + " " + round(this.lng, this.precision); } /** * Creates a new LatLng by converting coordinates from a source ellipsoid to a target one. <p> * This process involves:<p> * 1. converting the angular latlng to cartesian coordinates using latLngToPoint()<p> * 2. translating the XYZ coordinates using a translation, with special values supplied to this translation.<p> * 3. converting the translated XYZ coords back to a new angular LatLng<p> *<p> * for example refer to {@link JSITM.itm2gps} * * @param {JSITM.Ellipsoid} from source elli * @param {JSITM.Ellipsoid} to * @param {JSITM.Translation} translation * @return {JSITM.LatLng} */ JSITM.LatLng.prototype.convertGrid = function(from, to, translation){ var point = from.latLngToPoint(this, 0); //removed 7 point Helmert translation (not needed in Israel's grids) var translated = translation.translate(point); return to.pointToLatLng(translated); } /** * Parses latitude and longtitude in a string into a new Latlng * @param {String} s * @return {JSITM.LatLng} */ JSITM.latlngFromString = function(s) { var pattern = new RegExp("^(-?\\d+(?:\\.\\d*)?)(?:(?:\\s*[:,]?\\s*)|\\s+)(-?\\d+(?:\\.\\d*)?)$", "i") var latlng = s.match(pattern); if (latlng) { var lat = parseFloat(latlng[1], 10); var lng = parseFloat(latlng[2], 10); return new JSITM.LatLng(lat, lng); } throw ("could not parse latlng") } /**************************************************************/ /** * Creates a new Point. * @class holds 2D/3D cartesian coordinates. * * @constructor * @param {Number} x * @param {Number} y * @param {Number} z * @return {JSITM.Point} */ JSITM.Point = function(x, y, z){ this.y = y; this.x = x; this.z = z || 0; } /** * Returns a string containing the Point coordinates in meters * @return {String} */ JSITM.Point.prototype.toString = function(){ return Math.round(this.x) + " " + Math.round(this.y); } /**************************************************************/ /** * Creates a new Translation. * <p> * (Helmert translation were depracted since they are not used in the ITM - feel free to add them back from geotools if you need them! :-) ) * * @constructor * @param {Number} dx * @param {Number} dy * @param {Number} dz */ JSITM.Translation = function(dx, dy, dz){ this.dx = dx; this.dy = dy; this.dz = dz; } /** * Return a new translated Point. (Original point kept intact) * * @param {JSITM.Point} point original point. * @return {JSITM.Point} */ JSITM.Translation.prototype.translate = function(point){ return new JSITM.Point(point.x + this.dx, point.y + this.dy, point.z + this.dz); } /** * Returns an new Translation with inverse values. * @return {JSITM.Translation} */ JSITM.Translation.prototype.inverse = function(){ return new JSITM.Translation(-this.dx, -this.dy, -this.dz); } /**************************************************************/ /** * Creates a new Ellipsoid.<p> * for more info see <a href="http://en.wikipedia.org/wiki/Reference_ellipsoid">http://en.wikipedia.org/wiki/Reference_ellipsoid</a> * * @constructor * @param {Number} a length of the equatorial radius (the semi-major axis) in meters * @param {Number} b length of the polar radius (the semi-minor axis) in meters */ JSITM.Ellipsoid = function(a, b){ this.a = a; this.b = b; // Compute eccentricity squared this.e2 = (Math.pow(a, 2) - Math.pow(b, 2)) / Math.pow(a, 2); } /**************************************************************/ /** * Creates a new LatLng containing an angular representation of a cartesian Point on the surface of the Ellipsoid. * * @param {JSITM.Point} point * @return {JSITM.LatLng} */ JSITM.Ellipsoid.prototype.pointToLatLng = function(point){ var RootXYSqr = Math.sqrt(Math.pow(point.x, 2) + Math.pow(point.y, 2)); var radlat1 = Math.atan2(point.z, (RootXYSqr * (1 - this.e2))); do { var V = this.a / (Math.sqrt(1 - (this.e2 * Math.pow(Math.sin(radlat1), 2)))); var radlat2 = Math.atan2((point.z + (this.e2 * V * (Math.sin(radlat1)))), RootXYSqr); if (Math.abs(radlat1 - radlat2) > 0.000000001) { radlat1 = radlat2; } else { break; } } while (true); var lat = radlat2 * (180 / Math.PI); var lng = Math.atan2(point.y, point.x) * (180 / Math.PI); return new JSITM.LatLng(lat, lng); } /** * Creates a new Point object containing a cartesian representation of an angular LatLng on the surface of the Ellipsoid. * * @param {JSITM.LatLng} latlng * @return {JSITM.Point} */ JSITM.Ellipsoid.prototype.latLngToPoint = function(latlng){ // Convert angle measures to radians var radlat = latlng.lat * (Math.PI / 180); var radlng = latlng.lng * (Math.PI / 180); // Compute nu var V = this.a / (Math.sqrt(1 - (this.e2 * (Math.pow(Math.sin(radlat), 2))))); // Compute XYZ var x = (V + latlng.alt) * (Math.cos(radlat)) * (Math.cos(radlng)); var y = (V + latlng.alt) * (Math.cos(radlat)) * (Math.sin(radlng)); var z = ((V * (1 - this.e2)) + latlng.alt) * (Math.sin(radlat)); return new JSITM.Point(x, y, z); } /** * Cretaes a new TM (Transverse Mercator Projection).<br> * For more info see <a href="http://en.wikipedia.org/wiki/Transverse_Mercator">http://en.wikipedia.org/wiki/Transverse_Mercator</a> * * @constructor * @param {JSITM.Ellipsoid} reference ellipsoid * @param {Number} e0 eastings of false origin in meters * @param {Number} n0 northings of false origin in meters * @param {Number} f0 central meridian scale factor * @param {Number} lat0 latitude of false origin in decimal degrees. * @param {Number} lng0 longitude of false origin in decimal degrees. */ JSITM.TM = function(ellipsoid, e0, n0, f0, lat0, lng0){ //eastings (e0) and northings (n0) of false origin in meters; _ //central meridian scale factor (f0) and _ //latitude (lat0) and longitude (lng0) of false origin in decimal degrees. this.ellipsoid = ellipsoid; this.e0 = e0; this.n0 = n0; this.f0 = f0; this.lat0 = lat0; this.lng0 = lng0; this.radlat0 = lat0 * (Math.PI / 180); this.radlng0 = lng0 * (Math.PI / 180); this.af0 = ellipsoid.a * f0; this.bf0 = ellipsoid.b * f0; this.e2 = (Math.pow(this.af0, 2) - Math.pow(this.bf0, 2)) / Math.pow(this.af0, 2); this.n = (this.af0 - this.bf0) / (this.af0 + this.bf0); this.n2 = this.n * this.n; //for optimizing and clarity of Marc() this.n3 = this.n2 * this.n; //for optimizing and clarity of Marc() } /** * Compute meridional arc * @private * @param {Number} radlat latitude of meridian in radians * @return {Number} */ JSITM.TM.prototype.Marc = function(radlat){ return ( this.bf0 * ( ((1 + this.n + ((5 / 4) * this.n2) + ((5 / 4) * this.n3)) * (radlat - this.radlat0)) - (((3 * this.n) + (3 * this.n2) + ((21 / 8) * this.n3)) * (Math.sin(radlat - this.radlat0)) * (Math.cos(radlat + this.radlat0))) + ((((15 / 8) * this.n2) + ((15 / 8) * this.n3)) * (Math.sin(2 * (radlat - this.radlat0))) * (Math.cos(2 * (radlat + this.radlat0)))) - (((35 / 24) * this.n3) * (Math.sin(3 * (radlat - this.radlat0))) * (Math.cos(3 * (radlat + this.radlat0)))) ) ); } /** * Returns the initial value for Latitude in radians. * @private * @param {Number} y northings of point * @return {Number} */ JSITM.TM.prototype.InitialLat = function(y){ var radlat1 = ((y - this.n0) / this.af0) + this.radlat0; var M = this.Marc(radlat1); var radlat2 = ((y - this.n0 - M) / this.af0) + radlat1; while (Math.abs(y - this.n0 - M) > 0.00001) { radlat2 = ((y - this.n0 - M) / this.af0) + radlat1; M = this.Marc(radlat2); radlat1 = radlat2; } return radlat2; } /** * Un-project Transverse Mercator eastings and northings back to latitude and longtitude. * * @param {JSITM.Point} point * @return {JSITM.LatLng} latitude and longtitude on the refernced ellipsoid's surface */ JSITM.TM.prototype.unproject = function(point){ // //Input: - _ //Compute Et var Et = point.x - this.e0; //Compute initial value for latitude (PHI) in radians var PHId = this.InitialLat(point.y); //Compute nu, rho and eta2 using value for PHId var nu = this.af0 / (Math.sqrt(1 - (this.e2 * (Math.pow(Math.sin(PHId), 2))))); var rho = (nu * (1 - this.e2)) / (1 - (this.e2 * Math.pow(Math.sin(PHId), 2))); var eta2 = (nu / rho) - 1; //Compute Latitude var VII = (Math.tan(PHId)) / (2 * rho * nu); var VIII = ((Math.tan(PHId)) / (24 * rho * Math.pow(nu, 3))) * (5 + (3 * Math.pow(Math.tan(PHId), 2)) + eta2 - (9 * eta2 * (Math.pow(Math.tan(PHId), 2)))); var IX = (Math.tan(PHId) / (720 * rho * Math.pow(nu, 5))) * (61 + (90 * Math.pow(Math.tan(PHId), 2)) + (45 * (Math.pow(Math.tan(PHId), 4)))); var lat = (180 / Math.PI) * (PHId - (Math.pow(Et, 2) * VII) + (Math.pow(Et, 4) * VIII) - (Math.pow(Et, 6) * IX)); //Compute Longitude var X = (Math.pow(Math.cos(PHId), -1)) / nu; var XI = ((Math.pow(Math.cos(PHId), -1)) / (6 * Math.pow(nu, 3))) * ((nu / rho) + (2 * (Math.pow(Math.tan(PHId), 2)))); var XII = ((Math.pow(Math.cos(PHId), -1)) / (120 * Math.pow(nu, 5))) * (5 + (28 * (Math.pow(Math.tan(PHId), 2))) + (24 * (Math.pow(Math.tan(PHId), 4)))); var XIIA = ((Math.pow(Math.cos(PHId), -1)) / (5040 * Math.pow(nu, 7))) * (61 + (662 * (Math.pow(Math.tan(PHId), 2))) + (1320 * (Math.pow(Math.tan(PHId), 4))) + (720 * (Math.pow(Math.tan(PHId), 6)))); var lng = (180 / Math.PI) * (this.radlng0 + (Et * X) - (Math.pow(Et, 3) * XI) + (Math.pow(Et, 5) * XII) - (Math.pow(Et, 7) * XIIA)); var latlng = new JSITM.LatLng(lat, lng); return (latlng); } /** * Project Latitude and longitude to Transverse Mercator coordinates * @param {JSITM.LatLng} latitude and longtitude to convert * @return {JSITM.Point} projected coordinates */ JSITM.TM.prototype.project = function(latlng){ // Convert angle measures to radians var RadPHI = latlng.lat * (Math.PI / 180); var RadLAM = latlng.lng * (Math.PI / 180); var nu = this.af0 / (Math.sqrt(1 - (this.e2 * Math.pow(Math.sin(RadPHI), 2)))); var rho = (nu * (1 - this.e2)) / (1 - (this.e2 * Math.pow(Math.sin(RadPHI), 2))); var eta2 = (nu / rho) - 1; var p = RadLAM - this.radlng0; var M = this.Marc(RadPHI); var I = M + this.n0; var II = (nu / 2) * (Math.sin(RadPHI)) * (Math.cos(RadPHI)); var III = ((nu / 24) * (Math.sin(RadPHI)) * (Math.pow(Math.cos(RadPHI), 3))) * (5 - (Math.pow(Math.tan(RadPHI), 2)) + (9 * eta2)); var IIIA = ((nu / 720) * (Math.sin(RadPHI)) * (Math.pow(Math.cos(RadPHI), 5))) * (61 - (58 * (Math.pow(Math.tan(RadPHI), 2))) + (Math.pow(Math.tan(RadPHI), 4))); var y = I + (Math.pow(p, 2) * II) + (Math.pow(p, 4) * III) + (Math.pow(p, 6) * IIIA); var IV = nu * (Math.cos(RadPHI)); var V = (nu / 6) * (Math.pow(Math.cos(RadPHI), 3)) * ((nu / rho) - (Math.pow(Math.tan(RadPHI), 2))); var VI = (nu / 120) * (Math.pow(Math.cos(RadPHI), 5)) * (5 - (18 * (Math.pow(Math.tan(RadPHI), 2))) + (Math.pow(Math.tan(RadPHI), 4)) + (14 * eta2) - (58 * (Math.pow(Math.tan(RadPHI), 2)) * eta2)); var x = this.e0 + (p * IV) + (Math.pow(p, 3) * V) + (Math.pow(p, 5) * VI); return new JSITM.Point(x, y, 0) } /** Juicy part 1 ***************************************************************************/ /** * Ellipsoid for GRS80 (The refernce ellipsoid of ITM * @see http://en.wikipedia.org/wiki/GRS80 * @type JSITM.Ellipsoid */ JSITM.GRS80 = new JSITM.Ellipsoid(6378137, 6356752.31414); /** * Ellipsoid for WGS84 (Used by GPS) * @see http://en.wikipedia.org/wiki/WGS80 * @type JSITM.Ellipsoid */ JSITM.WGS84 = new JSITM.Ellipsoid(6378137, 6356752.314245); /** * Simple Translation from GRS80 to WGS84 * @see http://spatialreference.org/ref/epsg/2039/ * @type JSITM.Translation */ JSITM.GRS80toWGS84 = new JSITM.Translation(-48, 55, 52); /** * Translation back from WGS84 to GRS80 * @type JSITM.Translation */ JSITM.WGS84toGRS80 = JSITM.GRS80toWGS84.inverse(); /** * ITM (Israel Transverse Mercator) Projection * @see http://en.wikipedia.org/wiki/Israeli_Transverse_Mercator * @type JSITM.TM */ JSITM.ITM = new JSITM.TM(JSITM.GRS80, 219529.58400, 626907.38999, 1.000006700000000, 31.734394, 35.204517); /** Juicy part 2 ***************************************************************************/ /** * Converts a point to an ITM reference. * * @example * JSITM.point2ItmRef(new JSITM.Point(200, 500)); // prints "200000500000" * JSITM.point2ItmRef(new JSITM.Point(200, 500), 3); // prints "200500" * @param {JSITM.Point} point * @param {Number} precision 3=km, 4=100 meter, 5=decameter 6=meter. optional, default is 6, * @return {String} */ JSITM.point2ItmRef = function(point, precision){ function zeropad(num, len){ var str = new String(num); while (str.length < len) { str = '0' + str; } return str; } var p = precision || 6; if (p < 3) p = 3; if (p > 6) p = 6; var div = Math.pow(10, (6 - p)); var east = Math.round(point.x / div); var north = Math.round(point.y / div); return zeropad(east, p) + ' ' + zeropad(north, p); } /** * Parses an ITM reference and returns a Point object.<p> * throws an exception for invalid refernce!<p> * <p> * @example valid inputs: * 200500 * 20005000 * 2000000500000 * 130:540 * 131550:44000 * 131 400 * 210222 432111 * * @param {String} s * @return {JSITM.Point} */ JSITM.itmRef2Point = function(s){ var precision; for (precision = 6; precision >= 3; precision--) { var pattern = new RegExp("^(\\d{" + precision + "})\\s*:?\\s*(\\d{" + precision + "})$", "i") var ref = s.match(pattern); if (ref) { if (precision > 0) { var mult = Math.pow(10, 6 - precision); var x = parseInt(ref[1], 10) * mult; var y = parseInt(ref[2], 10) * mult; return new JSITM.Point(x, y); } } } throw "Could not parse reference"; } /** Juicy part 3 ***************************************************************************/ /** * Converts a Point on ITM to a LatLng on GPS * @param {JSITM.Point} point * @return {JSITM.LatLng} */ JSITM.itm2gps = function(point){ var latlng = this.ITM.unproject(point); //however, latlng is still on GRS80! return latlng.convertGrid(this.GRS80, this.WGS84, this.GRS80toWGS84); } /** * Converts a LatLng on GPS to a Point on ITM * @param {JSITM.LatLng} latlng * @return {JSITM.Point} */ JSITM.gps2itm = function(latlng){ var wgs84 = latlng.convertGrid(this.WGS84, this.GRS80, this.WGS84toGRS80); //first convert to GRS80 return this.ITM.project(wgs84); } /** Juicy part 4 ***************************************************************************/ /** * Converts an ITM grid refernece in 6, 8, 10 or 12 digits to a GPS angular Point instace * @param {String} s * @return {JSITM.Point} */ JSITM.itmRef2gps = function(s){ var point = this.itmRef2Point(s); return this.itm2gps(point); } /** * Converts an ITM grid refernece in 6, 8, 10 or 12 digits to a GPS angular reference * @param {String} s * @return {String} */ JSITM.itmRef2gpsRef = function(s){ return this.itmRef2gps(s).toString(); } /** * Converts a GPS angular reference to an ITM LatLng instance * @param {String} s * @return {JSITM.LatLng} */ JSITM.gpsRef2itm = function(s){ var latlng = this.latlngFromString(s); return this.gps2itm(latlng); } /** * Converts a GPS angular reference to an ITM grid refernece in 6, 8, 10 or 12 digits * @param {String} s * @param {Number} precision 3=km, 4=100 meter, 5=decameter 6=meter. Optional. Default value is 6=meter * @return {String} */ JSITM.gpsRef2itmRef = function(s, precision){ return this.point2ItmRef(this.gpsRef2itm(s), precision || 6); }
YanivNoema/Final-Project2
app/js-itm.js
JavaScript
mit
17,913
var models = require('../models'); var Message = models.Message; var User = require('../proxy').User; var messageProxy = require('../proxy/message'); var mail = require('./mail'); exports.sendReplyMessage = function (master_id, author_id, topic_id, reply_id) { var message = new Message(); message.type = 'reply'; message.master_id = master_id; message.author_id = author_id; message.topic_id = topic_id; message.reply_id = reply_id; message.save(function (err) { // TODO: 异常处理 User.getUserById(master_id, function (err, master) { // TODO: 异常处理 if (master && master.receive_reply_mail) { message.has_read = true; message.save(); messageProxy.getMessageById(message._id, function (err, msg) { msg.reply_id = reply_id; // TODO: 异常处理 mail.sendReplyMail(master.email, msg); }); } }); }); }; exports.sendReply2Message = function (master_id, author_id, topic_id, reply_id) { var message = new Message(); message.type = 'reply2'; message.master_id = master_id; message.author_id = author_id; message.topic_id = topic_id; message.reply_id = reply_id; message.save(function (err) { // TODO: 异常处理 User.getUserById(master_id, function (err, master) { // TODO: 异常处理 if (master && master.receive_reply_mail) { message.has_read = true; message.save(); messageProxy.getMessageById(message._id, function (err, msg) { msg.reply_id = reply_id; // TODO: 异常处理 mail.sendReplyMail(master.email, msg); }); } }); }); }; exports.sendAtMessage = function (master_id, author_id, topic_id, reply_id, callback) { var message = new Message(); message.type = 'at'; message.master_id = master_id; message.author_id = author_id; message.topic_id = topic_id; message.reply_id = reply_id; message.save(function (err) { // TODO: 异常处理 User.getUserById(master_id, function (err, master) { // TODO: 异常处理 if (master && master.receive_at_mail) { message.has_read = true; message.save(); messageProxy.getMessageById(message._id, function (err, msg) { // TODO: 异常处理 mail.sendAtMail(master.email, msg); }); } }); callback(err); }); }; //author_id is the follower, so the message of the master is master_id exports.sendFollowMessage = function (follow_id, author_id) { var message = new Message(); message.type = 'follow'; message.master_id = follow_id; message.author_id = author_id; message.save(); }; //author_id is the attendee exports.sendAttendMessage = function (master_id, topic_id, author_id) { var message = new Message(); message.type = 'attend'; message.master_id = master_id; message.author_id = author_id; message.topic_id= topic_id; message.save(); };
tianyisheng/icardyou
services/message.js
JavaScript
mit
2,941
import os from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker Base = declarative_base() class DBConnector(): ''' where every row is the details one employee was paid for an entire month. ''' @classmethod def get_session(cls): database_path = os.environ["SQL_DATABASE"] engine = create_engine(database_path) session = sessionmaker(bind=engine)() return session
JasonThomasData/payslip_code_test
app/models/db_connector.py
Python
mit
498
using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using CppSharp.AST; using CppSharp.AST.Extensions; using CppSharp.Types; using ParserTargetInfo = CppSharp.Parser.ParserTargetInfo; using Type = CppSharp.AST.Type; namespace CppSharp.Generators.CSharp { public class CSharpTypePrinter : TypePrinter { public const string IntPtrType = "global::System.IntPtr"; public BindingContext Context { get; set; } public DriverOptions Options => Context.Options; public TypeMapDatabase TypeMapDatabase => Context.TypeMaps; public CSharpTypePrinter(BindingContext context) { Context = context; } public override TypePrinterResult VisitTagType(TagType tag, TypeQualifiers quals) { if (tag.Declaration == null) return string.Empty; TypeMap typeMap; if (TypeMapDatabase.FindTypeMap(tag.Declaration, out typeMap)) { typeMap.Type = tag; var typePrinterContext = new TypePrinterContext() { Kind = Kind, MarshalKind = MarshalKind, Type = tag }; string type = typeMap.CSharpSignature(typePrinterContext); if (!string.IsNullOrEmpty(type)) { return new TypePrinterResult { Type = type, TypeMap = typeMap }; } } return base.VisitTagType(tag, quals); } public override TypePrinterResult VisitArrayType(ArrayType array, TypeQualifiers quals) { Type arrayType = array.Type.Desugar(); if ((MarshalKind == MarshalKind.NativeField || (ContextKind == TypePrinterContextKind.Native && MarshalKind == MarshalKind.ReturnVariableArray)) && array.SizeType == ArrayType.ArraySize.Constant) { if (array.Size == 0) { var pointer = new PointerType(array.QualifiedType); return pointer.Visit(this); } PrimitiveType primitiveType; if ((arrayType.IsPointerToPrimitiveType(out primitiveType) && !(arrayType is FunctionType)) || (arrayType.IsPrimitiveType() && MarshalKind != MarshalKind.NativeField)) { if (primitiveType == PrimitiveType.Void) return "void*"; return array.QualifiedType.Visit(this); } if (Parameter != null) return IntPtrType; Enumeration @enum; if (arrayType.TryGetEnum(out @enum)) { return new TypePrinterResult { Type = $"fixed {@enum.BuiltinType}", NameSuffix = $"[{array.Size}]" }; } Class @class; if (arrayType.TryGetClass(out @class)) { return new TypePrinterResult { Type = "fixed byte", NameSuffix = $"[{array.Size * @class.Layout.Size}]" }; } var arrayElemType = array.QualifiedType.Visit(this).ToString(); // C# does not support fixed arrays of machine pointer type (void* or IntPtr). // In that case, replace it by a pointer to an integer type of the same size. if (arrayElemType == IntPtrType) arrayElemType = Context.TargetInfo.PointerWidth == 64 ? "long" : "int"; // Do not write the fixed keyword multiple times for nested array types var fixedKeyword = arrayType is ArrayType ? string.Empty : "fixed "; return new TypePrinterResult { Type = $"{fixedKeyword}{arrayElemType}", NameSuffix = $"[{array.Size}]" }; } // const char* and const char[] are the same so we can use a string if (array.SizeType == ArrayType.ArraySize.Incomplete && arrayType.IsPrimitiveType(PrimitiveType.Char) && array.QualifiedType.Qualifiers.IsConst) return "string"; if (arrayType.IsPointerToPrimitiveType(PrimitiveType.Char)) { var prefix = ContextKind == TypePrinterContextKind.Managed ? string.Empty : "[MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStr)] "; return $"{prefix}string[]"; } var arraySuffix = array.SizeType != ArrayType.ArraySize.Constant && MarshalKind == MarshalKind.ReturnVariableArray ? (ContextKind == TypePrinterContextKind.Managed && arrayType.IsPrimitiveType() ? "*" : string.Empty) : "[]"; return $"{arrayType.Visit(this)}{arraySuffix}"; } public override TypePrinterResult VisitFunctionType(FunctionType function, TypeQualifiers quals) { var arguments = function.Parameters; var returnType = function.ReturnType; var args = string.Empty; PushMarshalKind(MarshalKind.GenericDelegate); if (arguments.Count > 0) args = VisitParameters(function.Parameters, hasNames: false).Type; PopMarshalKind(); if (ContextKind != TypePrinterContextKind.Managed) return IntPtrType; if (returnType.Type.IsPrimitiveType(PrimitiveType.Void)) { if (!string.IsNullOrEmpty(args)) args = string.Format("<{0}>", args); return string.Format("Action{0}", args); } if (!string.IsNullOrEmpty(args)) args = string.Format(", {0}", args); PushMarshalKind(MarshalKind.GenericDelegate); var returnTypePrinterResult = returnType.Visit(this); PopMarshalKind(); return string.Format("Func<{0}{1}>", returnTypePrinterResult, args); } public static bool IsConstCharString(PointerType pointer) { var pointee = pointer.Pointee.Desugar(); return (pointee.IsPrimitiveType(PrimitiveType.Char) || pointee.IsPrimitiveType(PrimitiveType.Char16) || pointee.IsPrimitiveType(PrimitiveType.WideChar)) && pointer.QualifiedPointee.Qualifiers.IsConst; } public static bool IsConstCharString(Type type) { var desugared = type.Desugar(); if (!(desugared is PointerType)) return false; var pointer = desugared as PointerType; return IsConstCharString(pointer); } public static bool IsConstCharString(QualifiedType qualType) { return IsConstCharString(qualType.Type); } private bool allowStrings = true; public override TypePrinterResult VisitPointerType(PointerType pointer, TypeQualifiers quals) { if (MarshalKind == MarshalKind.NativeField) return IntPtrType; var pointee = pointer.Pointee; if (pointee is FunctionType) { var function = pointee as FunctionType; return string.Format("{0}", function.Visit(this, quals)); } var isManagedContext = ContextKind == TypePrinterContextKind.Managed; if (allowStrings && IsConstCharString(pointer)) { if (isManagedContext) return "string"; return IntPtrType; } var desugared = pointee.Desugar(); // From http://msdn.microsoft.com/en-us/library/y31yhkeb.aspx // Any of the following types may be a pointer type: // * sbyte, byte, short, ushort, int, uint, long, ulong, char, float, double, // decimal, or bool. // * Any enum type. // * Any pointer type. // * Any user-defined struct type that contains fields of unmanaged types only. var finalPointee = pointer.GetFinalPointee(); if (finalPointee.IsPrimitiveType()) { // Skip one indirection if passed by reference bool isRefParam = Parameter != null && (Parameter.IsOut || Parameter.IsInOut); if (isManagedContext && isRefParam) return pointer.QualifiedPointee.Visit(this); if (pointee.IsPrimitiveType(PrimitiveType.Void)) return IntPtrType; if (IsConstCharString(pointee) && isRefParam) return IntPtrType + "*"; // Do not allow strings inside primitive arrays case, else we'll get invalid types // like string* for const char **. allowStrings = isRefParam; var result = pointer.QualifiedPointee.Visit(this); allowStrings = true; return !isRefParam && result.Type == IntPtrType ? "void**" : result + "*"; } Enumeration @enum; if (desugared.TryGetEnum(out @enum)) { // Skip one indirection if passed by reference if (isManagedContext && Parameter != null && (Parameter.IsOut || Parameter.IsInOut) && pointee == finalPointee) return pointer.QualifiedPointee.Visit(this); return pointer.QualifiedPointee.Visit(this) + "*"; } Class @class; if ((desugared.IsDependent || desugared.TryGetClass(out @class)) && ContextKind == TypePrinterContextKind.Native) { return IntPtrType; } return pointer.QualifiedPointee.Visit(this); } public override TypePrinterResult VisitMemberPointerType(MemberPointerType member, TypeQualifiers quals) { FunctionType functionType; if (member.IsPointerTo(out functionType)) return functionType.Visit(this, quals); // TODO: Non-function member pointer types are tricky to support. // Re-visit this. return IntPtrType; } public override TypePrinterResult VisitTypedefType(TypedefType typedef, TypeQualifiers quals) { var decl = typedef.Declaration; TypeMap typeMap; if (TypeMapDatabase.FindTypeMap(decl, out typeMap)) { typeMap.Type = typedef; var typePrinterContext = new TypePrinterContext { Kind = ContextKind, MarshalKind = MarshalKind, Type = typedef }; string type = typeMap.CSharpSignature(typePrinterContext); if (!string.IsNullOrEmpty(type)) { return new TypePrinterResult { Type = type, TypeMap = typeMap }; } } FunctionType func = decl.Type as FunctionType; if (func != null || decl.Type.IsPointerTo(out func)) { if (ContextKind == TypePrinterContextKind.Native) return IntPtrType; // TODO: Use SafeIdentifier() return VisitDeclaration(decl); } return decl.Type.Visit(this); } public override TypePrinterResult VisitTemplateSpecializationType( TemplateSpecializationType template, TypeQualifiers quals) { var decl = template.GetClassTemplateSpecialization() ?? template.Template.TemplatedDecl; TypeMap typeMap; if (!TypeMapDatabase.FindTypeMap(template, out typeMap)) { if (ContextKind == TypePrinterContextKind.Managed && decl == template.Template.TemplatedDecl && template.Arguments.All(IsValid)) return $@"{VisitDeclaration(decl)}<{string.Join(", ", template.Arguments.Select(VisitTemplateArgument))}>"; if (ContextKind == TypePrinterContextKind.Native) return template.Desugared.Visit(this); return decl.Visit(this); } typeMap.Declaration = decl; typeMap.Type = template; var typePrinterContext = new TypePrinterContext { Type = template, Kind = ContextKind, MarshalKind = MarshalKind }; var type = typeMap.CSharpSignature(typePrinterContext); if (!string.IsNullOrEmpty(type)) { return new TypePrinterResult { Type = type, TypeMap = typeMap }; } return decl.Visit(this); } public override TypePrinterResult VisitDependentTemplateSpecializationType( DependentTemplateSpecializationType template, TypeQualifiers quals) { if (template.Desugared.Type != null) return template.Desugared.Visit(this); return string.Empty; } public override TypePrinterResult VisitTemplateParameterType( TemplateParameterType param, TypeQualifiers quals) { return param.Parameter.Name; } public override TypePrinterResult VisitTemplateParameterSubstitutionType( TemplateParameterSubstitutionType param, TypeQualifiers quals) { var type = param.Replacement.Type; return type.Visit(this, param.Replacement.Qualifiers); } public override TypePrinterResult VisitInjectedClassNameType( InjectedClassNameType injected, TypeQualifiers quals) { return injected.InjectedSpecializationType.Type != null ? injected.InjectedSpecializationType.Visit(this) : injected.Class.Visit(this); } public override TypePrinterResult VisitDependentNameType(DependentNameType dependent, TypeQualifiers quals) { if (dependent.Qualifier.Type == null) return dependent.Identifier; return $"{dependent.Qualifier.Visit(this)}.{dependent.Identifier}"; } public override TypePrinterResult VisitPackExpansionType(PackExpansionType type, TypeQualifiers quals) { return string.Empty; } public override TypePrinterResult VisitCILType(CILType type, TypeQualifiers quals) { return type.Type.FullName; } public static void GetPrimitiveTypeWidth(PrimitiveType primitive, ParserTargetInfo targetInfo, out uint width, out bool signed) { switch (primitive) { case PrimitiveType.Char: width = targetInfo?.CharWidth ?? 8; signed = true; break; case PrimitiveType.WideChar: width = targetInfo?.WCharWidth ?? 16; signed = false; break; case PrimitiveType.UChar: width = targetInfo?.CharWidth ?? 8; signed = false; break; case PrimitiveType.Short: width = targetInfo?.ShortWidth ?? 16; signed = true; break; case PrimitiveType.UShort: width = targetInfo?.ShortWidth ?? 16; signed = false; break; case PrimitiveType.Int: width = targetInfo?.IntWidth ?? 32; signed = true; break; case PrimitiveType.UInt: width = targetInfo?.IntWidth ?? 32; signed = false; break; case PrimitiveType.Long: width = targetInfo?.LongWidth ?? 32; signed = true; break; case PrimitiveType.ULong: width = targetInfo?.LongWidth ?? 32; signed = false; break; case PrimitiveType.LongLong: width = targetInfo?.LongLongWidth ?? 64; signed = true; break; case PrimitiveType.ULongLong: width = targetInfo?.LongLongWidth ?? 64; signed = false; break; default: throw new NotImplementedException(); } } static string GetIntString(PrimitiveType primitive, ParserTargetInfo targetInfo) { uint width; bool signed; GetPrimitiveTypeWidth(primitive, targetInfo, out width, out signed); switch (width) { case 8: return signed ? "sbyte" : "byte"; case 16: return signed ? "short" : "ushort"; case 32: return signed ? "int" : "uint"; case 64: return signed ? "long" : "ulong"; default: throw new NotImplementedException(); } } public override TypePrinterResult VisitPrimitiveType(PrimitiveType primitive, TypeQualifiers quals) { switch (primitive) { case PrimitiveType.Bool: // returned structs must be blittable and bool isn't return MarshalKind == MarshalKind.NativeField ? "byte" : "bool"; case PrimitiveType.Void: return "void"; case PrimitiveType.Char16: case PrimitiveType.Char32: return "char"; case PrimitiveType.WideChar: return (ContextKind == TypePrinterContextKind.Native) ? GetIntString(primitive, Context.TargetInfo) : "CppSharp.Runtime.WideChar"; case PrimitiveType.Char: // returned structs must be blittable and char isn't return Options.MarshalCharAsManagedChar && ContextKind != TypePrinterContextKind.Native ? "char" : "sbyte"; case PrimitiveType.SChar: return "sbyte"; case PrimitiveType.UChar: return "byte"; case PrimitiveType.Short: case PrimitiveType.UShort: case PrimitiveType.Int: case PrimitiveType.UInt: case PrimitiveType.Long: case PrimitiveType.ULong: case PrimitiveType.LongLong: case PrimitiveType.ULongLong: return GetIntString(primitive, Context.TargetInfo); case PrimitiveType.Int128: return new TypePrinterResult { Type = "fixed byte", NameSuffix = "[16]"}; // The type is always 128 bits wide case PrimitiveType.UInt128: return new TypePrinterResult { Type = "fixed byte", NameSuffix = "[16]"}; // The type is always 128 bits wide case PrimitiveType.Half: return new TypePrinterResult { Type = "fixed byte", NameSuffix = $"[{Context.TargetInfo.HalfWidth}]"}; case PrimitiveType.Float: return "float"; case PrimitiveType.Double: return "double"; case PrimitiveType.LongDouble: return new TypePrinterResult { Type = "fixed byte", NameSuffix = $"[{Context.TargetInfo.LongDoubleWidth}]"}; case PrimitiveType.IntPtr: return IntPtrType; case PrimitiveType.UIntPtr: return "global::System.UIntPtr"; case PrimitiveType.Null: return "void*"; case PrimitiveType.String: return "string"; case PrimitiveType.Float128: return "__float128"; } throw new NotSupportedException(); } public override TypePrinterResult VisitDeclaration(Declaration decl) { return GetName(decl); } public override TypePrinterResult VisitClassDecl(Class @class) { if (ContextKind == TypePrinterContextKind.Native) return $"{VisitDeclaration(@class.OriginalClass ?? @class)}.{Helpers.InternalStruct}"; var printed = VisitDeclaration(@class).Type; if (!@class.IsDependent) return printed; return $@"{printed}<{string.Join(", ", @class.TemplateParameters.Select(p => p.Name))}>"; } public override TypePrinterResult VisitClassTemplateSpecializationDecl( ClassTemplateSpecialization specialization) { if (ContextKind == TypePrinterContextKind.Native) return $@"{VisitClassDecl(specialization)}{ Helpers.GetSuffixForInternal(specialization)}"; var args = string.Join(", ", specialization.Arguments.Select(VisitTemplateArgument)); return $"{VisitClassDecl(specialization)}<{args}>"; } public TypePrinterResult VisitTemplateArgument(TemplateArgument a) { if (a.Type.Type == null) return a.Integral.ToString(CultureInfo.InvariantCulture); var type = a.Type.Type.Desugar(); return type.IsPointerToPrimitiveType() ? IntPtrType : type.Visit(this); } public override TypePrinterResult VisitParameterDecl(Parameter parameter) { var paramType = parameter.Type; if (parameter.Kind == ParameterKind.IndirectReturnType) return IntPtrType; Parameter = parameter; var ret = paramType.Visit(this); Parameter = null; return ret; } string GetName(Declaration decl) { var names = new Stack<string>(); Declaration ctx; var specialization = decl as ClassTemplateSpecialization; if (specialization != null && ContextKind == TypePrinterContextKind.Native) { ctx = specialization.TemplatedDecl.TemplatedClass.Namespace; if (specialization.OriginalNamespace is Class && !(specialization.OriginalNamespace is ClassTemplateSpecialization)) { names.Push(string.Format("{0}_{1}", decl.OriginalNamespace.Name, decl.Name)); ctx = ctx.Namespace ?? ctx; } else { names.Push(decl.Name); } } else { names.Push(decl.Name); ctx = decl.Namespace; } if (decl is Variable && !(decl.Namespace is Class)) names.Push(decl.TranslationUnit.FileNameWithoutExtension); while (!(ctx is TranslationUnit)) { var isInlineNamespace = ctx is Namespace && ((Namespace)ctx).IsInline; if (!string.IsNullOrWhiteSpace(ctx.Name) && !isInlineNamespace) names.Push(ctx.Name); ctx = ctx.Namespace; } var unit = ctx.TranslationUnit; if (!unit.IsSystemHeader && unit.IsValid && !string.IsNullOrWhiteSpace(unit.Module.OutputNamespace)) names.Push(unit.Module.OutputNamespace); return $"global::{string.Join(".", names)}"; } public override TypePrinterResult VisitParameters(IEnumerable<Parameter> @params, bool hasNames) { @params = @params.Where( p => ContextKind == TypePrinterContextKind.Native || (p.Kind != ParameterKind.IndirectReturnType && !p.Ignore)); return base.VisitParameters(@params, hasNames); } public override TypePrinterResult VisitParameter(Parameter param, bool hasName) { var typeBuilder = new StringBuilder(); if (param.Type.Desugar().IsPrimitiveType(PrimitiveType.Bool) && MarshalKind == MarshalKind.GenericDelegate) typeBuilder.Append("[MarshalAs(UnmanagedType.I1)] "); var printedType = param.Type.Visit(this, param.QualifiedType.Qualifiers); typeBuilder.Append(printedType); var type = typeBuilder.ToString(); if (ContextKind == TypePrinterContextKind.Native) return $"{type} {param.Name}"; var extension = param.Kind == ParameterKind.Extension ? "this " : string.Empty; var usage = GetParameterUsage(param.Usage); if (param.DefaultArgument == null || !Options.GenerateDefaultValuesForArguments) return $"{extension}{usage}{type} {param.Name}"; var defaultValue = expressionPrinter.VisitParameter(param); return $"{extension}{usage}{type} {param.Name} = {defaultValue}"; } public override TypePrinterResult VisitDelegate(FunctionType function) { PushMarshalKind(MarshalKind.GenericDelegate); var functionRetType = function.ReturnType.Visit(this); var @params = VisitParameters(function.Parameters, hasNames: true); PopMarshalKind(); return $"delegate {functionRetType} {{0}}({@params})"; } public override string ToString(Type type) { return type.Visit(this).Type; } public override TypePrinterResult VisitTemplateTemplateParameterDecl( TemplateTemplateParameter templateTemplateParameter) { return templateTemplateParameter.Name; } public override TypePrinterResult VisitTemplateParameterDecl( TypeTemplateParameter templateParameter) { return templateParameter.Name; } public override TypePrinterResult VisitNonTypeTemplateParameterDecl( NonTypeTemplateParameter nonTypeTemplateParameter) { return nonTypeTemplateParameter.Name; } public override TypePrinterResult VisitUnaryTransformType( UnaryTransformType unaryTransformType, TypeQualifiers quals) { if (unaryTransformType.Desugared.Type != null) return unaryTransformType.Desugared.Visit(this); return unaryTransformType.BaseType.Visit(this); } public override TypePrinterResult VisitVectorType(VectorType vectorType, TypeQualifiers quals) { return vectorType.ElementType.Visit(this); } private static string GetParameterUsage(ParameterUsage usage) { switch (usage) { case ParameterUsage.Out: return "out "; case ParameterUsage.InOut: return "ref "; default: return string.Empty; } } public override TypePrinterResult VisitFieldDecl(Field field) { var cSharpSourcesDummy = new CSharpSources(Context, new List<TranslationUnit>()); var safeIdentifier = cSharpSourcesDummy.SafeIdentifier(field.Name); if (safeIdentifier.All(c => c.Equals('_'))) { safeIdentifier = cSharpSourcesDummy.SafeIdentifier(field.Name); } PushMarshalKind(MarshalKind.NativeField); var fieldTypePrinted = field.QualifiedType.Visit(this); PopMarshalKind(); var returnTypePrinter = new TypePrinterResult(); if (!string.IsNullOrWhiteSpace(fieldTypePrinted.NameSuffix)) returnTypePrinter.NameSuffix = fieldTypePrinted.NameSuffix; returnTypePrinter.Type = $"{fieldTypePrinted.Type} {safeIdentifier}"; return returnTypePrinter; } public TypePrinterResult PrintNative(Declaration declaration) { PushContext(TypePrinterContextKind.Native); var typePrinterResult = declaration.Visit(this); PopContext(); return typePrinterResult; } public TypePrinterResult PrintNative(Type type) { PushContext(TypePrinterContextKind.Native); var typePrinterResult = type.Visit(this); PopContext(); return typePrinterResult; } public TypePrinterResult PrintNative(QualifiedType type) { PushContext(TypePrinterContextKind.Native); var typePrinterResult = type.Visit(this); PopContext(); return typePrinterResult; } private static bool IsValid(TemplateArgument a) { if (a.Type.Type == null) return true; var templateParam = a.Type.Type.Desugar() as TemplateParameterType; // HACK: TemplateParameterType.Parameter is null in some corner cases, see the parser return templateParam == null || templateParam.Parameter != null; } private CSharpExpressionPrinter expressionPrinter => new CSharpExpressionPrinter(this); } }
zillemarco/CppSharp
src/Generator/Generators/CSharp/CSharpTypePrinter.cs
C#
mit
30,406
#!env /usr/bin/python3 import sys import urllib.parse import urllib.request def main(): search = sys.argv[1] url = 'http://rarbg.to/torrents.php?order=seeders&by=DESC&search=' url = url + search print(url) req = urllib.request.Request(url, headers={'User-Agent' : "Magic Browser"}) resp = urllib.request.urlopen(req) respData = resp.read() if __name__ == '__main__': main()
jadams/rarbg-get
rarbg-get.py
Python
mit
409
module Sspy class Cli def run end end end
toddsiegel/sspy
lib/cli.rb
Ruby
mit
53
import Services from '../src/lib/services'; const _ = require('lodash'); require('db-migrate-mysql'); const expect = require('unexpected'); const request = require('./request.func'); let rds; class Email { // eslint-disable-next-line sendHtml() { return Promise.resolve(); } } class Slack { // eslint-disable-next-line sendAppUpdate() { return Promise.resolve(); } } export default class FuncTestServices extends Services { // eslint-disable-next-line class-methods-use-this getEmail() { return new Email(); } // eslint-disable-next-line class-methods-use-this getSlack() { return new Slack(); } getMysql() { if (!rds) { // eslint-disable-next-line global-require rds = require('serverless-mysql')({ config: { host: this.getEnv('RDS_HOST'), user: this.getEnv('RDS_USER'), password: this.getEnv('RDS_PASSWORD'), database: this.getEnv('RDS_DATABASE'), ssl: this.getEnv('RDS_SSL'), port: this.getEnv('RDS_PORT'), multipleStatements: true, }, }); } return rds; } static async initDb() { await rds.query( 'INSERT IGNORE INTO vendors SET id=?, name=?, address=?, email=?, isPublic=?', [process.env.FUNC_VENDOR, 'test', 'test', process.env.FUNC_USER_EMAIL, 0], ); await rds.query('DELETE FROM appVersions WHERE vendor=?', [process.env.FUNC_VENDOR]); } static async login() { const res = await expect(request({ method: 'post', url: `${_.get(process.env, 'API_ENDPOINT')}/auth/login`, responseType: 'json', data: { email: process.env.FUNC_USER_EMAIL, password: process.env.FUNC_USER_PASSWORD, }, }), 'to be fulfilled'); expect(_.get(res, 'status'), 'to be', 200); expect(_.get(res, 'data'), 'to have key', 'token'); return _.get(res, 'data.token'); } static async cleanIconsFromS3(appId) { const s3 = Services.getS3(); const data = await s3.listObjects({ Bucket: process.env.S3_BUCKET, Prefix: `${appId}/` }).promise(); if (data && _.has(data, 'Contents')) { const promises = []; _.each(data.Contents, (file) => { promises.push(s3.deleteObject({ Bucket: process.env.S3_BUCKET, Key: file.Key }).promise()); }); return Promise.all(promises); } return Promise.resolve(); } }
keboola/developer-portal
test/services.func.js
JavaScript
mit
2,387
#include "BinaryLLHeap.h" int main(int argc, char* argv[]) { BinaryLLHeap <int> heap; heap.insert(5); return 0; }
HaozheGuAsh/Undergraduate
2013-2017/OLD/60hw3/BinaryMain.cpp
C++
mit
123
using Pliant.Captures; using Pliant.Diagnostics; using Pliant.Utilities; namespace Pliant.Languages.Pdl { public class PdlQualifiedIdentifier : PdlNode { private readonly int _hashCode; public ICapture<char> Identifier { get; private set; } public PdlQualifiedIdentifier(string identifier) : this(identifier.AsCapture()) { } public PdlQualifiedIdentifier(ICapture<char> identifier) { Assert.IsNotNull(identifier, nameof(identifier)); Identifier = identifier; _hashCode = ComputeHashCode(); } public override PdlNodeType NodeType => PdlNodeType.PdlQualifiedIdentifier; public override bool Equals(object obj) { if (obj is null) return false; if (!(obj is PdlQualifiedIdentifier qualifiedIdentifier)) return false; return qualifiedIdentifier.NodeType == NodeType && qualifiedIdentifier.Identifier.Equals(Identifier); } int ComputeHashCode() { return HashCode.Compute(((int)NodeType).GetHashCode(), Identifier.GetHashCode()); } public override int GetHashCode() => _hashCode; public override string ToString() => Identifier.ToString(); } public class PdlQualifiedIdentifierConcatenation : PdlQualifiedIdentifier { private readonly int _hashCode; public PdlQualifiedIdentifier QualifiedIdentifier { get; private set; } public PdlQualifiedIdentifierConcatenation( string identifier, PdlQualifiedIdentifier qualifiedIdentifier) : this(identifier.AsCapture(), qualifiedIdentifier) { } public PdlQualifiedIdentifierConcatenation( ICapture<char> identifier, PdlQualifiedIdentifier qualifiedIdentifier) : base(identifier) { QualifiedIdentifier = qualifiedIdentifier; _hashCode = ComputeHashCode(); } public override PdlNodeType NodeType => PdlNodeType.PdlQualifiedIdentifierConcatenation; public override bool Equals(object obj) { if (obj is null) return false; if (!(obj is PdlQualifiedIdentifierConcatenation qualifiedIdentifier)) return false; return qualifiedIdentifier.NodeType == NodeType && qualifiedIdentifier.Identifier.Equals(Identifier) && qualifiedIdentifier.QualifiedIdentifier.Equals(QualifiedIdentifier); } int ComputeHashCode() { return HashCode.Compute( ((int)NodeType).GetHashCode(), Identifier.GetHashCode(), QualifiedIdentifier.GetHashCode()); } public override int GetHashCode() => _hashCode; public override string ToString() => $"{QualifiedIdentifier}.{Identifier}"; } }
patrickhuber/Pliant
libraries/Pliant/Languages/Pdl/PdlQualifiedIdentifier.cs
C#
mit
3,011
using System.Collections.Generic; namespace HectorSharp { public class CassandraClientConfig { public LoadBalancingStrategy LoadBalancingStrategy { get; set; } public IList<Endpoint> Hosts { get; set; } } }
mattvv/hectorsharp
Service/CassandraClientConfig.cs
C#
mit
218
#!/usr/bin/env node var JavaScriptBuffer = require('../type-inference'), fs = require('fs'), clc = require('cli-color'); var filename = process.argv[2]; var text = fs.readFileSync(filename, {encoding:"utf8"}); var lines = text.split(/\r?\n|\r/); var buffer = new JavaScriptBuffer; buffer.add(filename, text); var groups = buffer.renamePropertyName(process.argv[3] || "add"); groups.forEach(function(group) { console.log(clc.green("---------------- (" + group.length + ")")); group.forEach(function (item,index) { if (index > 0) console.log(clc.blackBright("--")); var idx = item.start.line - 1; var line = lines[idx]; line = clc.black(line.substring(0,item.start.column)) + clc.red(line.substring(item.start.column, item.end.column)) + clc.black(line.substring(item.end.column)); console.log(clc.black(lines[idx-1]) || ''); console.log(line); console.log(clc.black(lines[idx+1]) || ''); }); }); console.log(clc.green("----------------"));
asgerf/light-refactor.js
tools/dump-rename.js
JavaScript
mit
1,047
var espeak = require('node-espeak'); espeak.initialize(); espeak.onVoice(function(wav, samples, samplerate) { }); espeak.speak("hello world!");
robotfreak/NodeBots-Tutorial
code/espeak-demo.js
JavaScript
mit
147
import { Injectable } from '@angular/core'; import { Router} from '@angular/router'; import { Store, ActionReducer, Action} from '@ngrx/store'; import { Observable } from 'rxjs/Rx'; const initSearchContext: any = { q: null, i: 1, n: 100, sortId: 0 }; export const searchContext: ActionReducer<any> = (state: any = initSearchContext, action: Action) => { switch (action.type) { case 'SEARCHCONTEXT.CREATE': return Object.assign({}, action.payload); case 'SEARCHCONTEXT.UDPATE': return Object.assign({}, state, action.payload); case 'SEARCHCONTEXT.RESET': return Object.assign({}, initSearchContext); case 'SEARCHCONTEXT.REMOVE': return Object.assign({}, Object.keys(state).reduce((result: any, key: any) => { if (key !== action.payload) result[key] = state[key]; return result; }, {})); default: return state; } }; @Injectable() export class SearchContext { public data: Observable<any>; constructor(public router: Router, public store: Store<any>) { this.data = this.store.select('searchContext'); } public new(params: Object): void { this.create = params; this.go(); } public get state(): any { let s: any; this.data.take(1).subscribe(state => s = state); return s; } public set remove(param: any) { this.store.dispatch({ type: 'SEARCHCONTEXT.REMOVE', payload: param }); } public set update(params: any) { this.store.dispatch({ type: 'SEARCHCONTEXT.UDPATE', payload: this.decodeParams(params) }); } public set create(params: any) { this.store.dispatch({ type: 'SEARCHCONTEXT.CREATE', payload: this.decodeParams(params) }); } public go(): void { this.router.navigate(['/search', this.state]); } private decodeParams(params: any) { let decodedParams: any = {}; let d: any = JSON.parse(JSON.stringify(params)); for (let param in d) { if (d[param] === '' || params[param] === 'true') { delete d[param]; return d; } decodedParams[param] = decodeURIComponent(params[param]); } return decodedParams; } }
jimmybillings/wazee
src/client/app/shared/services/search-context.service.ts
TypeScript
mit
2,120
<div class="modal slide-down fade" id="wizard-reincripcion"> <div class="modal-dialog"> <div class="v-cell"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button> <h4 class="modal-title">Reinscripción</h4> </div> <div class="modal-body"> <div class="panel panel-default"> <div id="resp-reinsc" style="z-index: 100;position: fixed;"></div> <!-- <div class="panel-heading panel-heading-gray"> Total a pagar: <i class="fa fa-fw fa-dollar" style="font-size: 25px;"></i> <strong id="total_a_apagar" style="font-size: 25px;">123.00</strong> </div>--> <div class="panel-body"> <div class="row"> <div class="col-md-12"> <h6>Inscribir a</h6> <select class="form-control" name="REgrupo" id="REgrupo"> <option value="0">Seleccione una opción</option> <?php echo getCatOpciones("CatGrado", "REgrupo") ?> </select> </div> <div class="col-md-12" id="listado_servicios"> <h6>Renovar Servicios</h6> <?php echo getCatOpcionesCheckBoxes("CatServicio", "REservicio[]") ?> <!-- <table style="width: 100%"> </table>--> </div> <div class="col-md-12"> <h6>Observaciones</h6> <textarea rows="2" type="text" class="form-control" name="DescBaja" id="DescBaja">N/A</textarea> </div> <div class="col-md-12"> <h6>Docentes</h6> <ul id="docentes_encargados"> <li>-- Sin Asignar --</li> </ul> </div> </div> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-danger" data-dismiss="modal" id="REcancelar">Cancelar</button> <button type="button" class="btn btn-danger" data-dismiss="modal" id="REsalir" style="display: none">Salir</button> <!--<button type="button" class="btn btn-primary" id="RErecibo" style="display: none">Recibo</button>--> <a class="btn btn-primary btnPrint" href="<?php echo site_url('imprimir/recibo_reinscripcion'); ?>" id="RErecibo" style="display: none">Recibo</a> <button type="button" class="btn btn-success" id="REguardar" data-save-ID="">Guardar</button> </div> </div> </div> </div> </div>
ericksuarez/GestEsc
application/views/modal/estudiante/wizard_reinscripcion.php
PHP
mit
3,618
/** * Copyright (c) 2013, FeedHenry Ltd. All Rights Reserved. * * Class which exposes collection of utility / helper functions for managing user sessions. * - Creates new session for valid user. * - Validates session for incoming requests. * - Returns the session object associated to the specified sessionId. * - Returns the value for the specified attribute stored in the session. * - Sets an attribute in the current session object. * - Resets the session timeout. */ // Dependencies. var winston = require("winston"); var constants = require("../config/constants.js"); var config = require("../config/config.js"); var uuid = require("../uuid/uuid.js"); var utils = require("../utils/utils.js"); var fh = require('fh-mbaas-api'); var SessionManager = function() { // Global module level variables. var MODULE_NAME = "SessionManager.js: "; // Public functions (this.methodName makes a method publicly accessible, otherwise it is accessible only within module). this.createSession = createSession; this.getSession = getSession; this.setSessionAttributes = setSessionAttributes; this.isValidSession = isValidSession; this.destroySession = destroySession; this.generateSessionId = generateSessionId; /** * Generates a pseudo-random UUID as the session id. */ function generateSessionId() { return uuid(); }; /** * Creates new session object and returns the sessionId. */ function createSession(callback) { var METHOD_NAME = "createSession(): "; // Pseudo random sessionId. var sessionId = generateSessionId(); // Initial session Json Object. var sessionObjectJson = { "sessionId": sessionId }; // Serialize it. var sessionObject = JSON.stringify(sessionObjectJson); var currentEnv = constants.ENV_DEVELOPMENT; if (config.currentEnv != null) { currentEnv = config.currentEnv; } // Save it. fh.session.set(sessionId, sessionObject, config.environments[currentEnv].sessionTimeout, function(error) { if (error) { return callback("Failed to save session object to fh.session() - " + JSON.stringify(error), null); } winston.info(MODULE_NAME + METHOD_NAME + "Session created successfully - " + sessionId); return callback(null, { "sessionId": sessionId }); }); }; /** * Gets the session object associated to the specified sessionId. */ function getSession(sessionId, callback) { if (utils.isBlank(sessionId)) { return callback("SessionId not provided to getSession().", null); } // Do we have the object in session? fh.session.get(sessionId, function handleSessionLoad(error, data) { if (error) { return callback("Error fetching session object from session - " + JSON.stringify(error), null); } // Extend the session expiry time. resetSessionTimeout(sessionId, data, function(errorMessage, status) { // Failed to extend session lifetime? if (errorMessage != null) { return callback(errorMessage, null); } // All ok! Deserialize session string and return. return callback(null, JSON.parse(data)); }); }); }; /** * Sets an attribute in the current session object. */ function setSessionAttributes(sessionId, attributesMap, callback) { if (utils.isBlank(sessionId)) { return callback("SessionId not provided to setSessionAttributes().", null); } if (attributesMap == null) { return callback("AttributesMap not provided to setSessionAttributes().", null); } // Fetch session object from session. getSession(sessionId, function(errorMessage, sessionObject) { // Trouble? if (errorMessage != null) { return callback(errorMessage, null); } // No session state? if (sessionObject == null) { return callback(null, false); } // Update all items from the attributesMap to sessionObject. for (var attrributeName in attributesMap) { var attributeValue = attributesMap[attrributeName]; sessionObject[attrributeName] = attributeValue; } // Serialize the sessionObject if required. var sessionObjectToCache = sessionObject; if (typeof(sessionObject) == 'object') { sessionObjectToCache = JSON.stringify(sessionObject); } var currentEnv = constants.ENV_DEVELOPMENT; if (config.currentEnv != null) { currentEnv = config.currentEnv; } // Store the sessionObject back to the session. fh.session.set(sessionId, sessionObjectToCache, config.environments[currentEnv].sessionTimeout, function(error) { if (error) { return callback("Unable to set attribute into Session - " + JSON.stringify(error), null); } // Not invoking resetSessionTimeout(), since the getSession() call above has already done it. // All ok! return callback(null, true); }); }); }; /** * Checks whether the session is valid and active. */ function isValidSession(sessionId, callback) { var METHOD_NAME = "isValidSession(): "; if (utils.isBlank(sessionId)) { return callback("SessionId not provided to isValidSession().", null); } // Do we have a session object in session for the specified sessionId? fh.session.get(sessionId, function handleSessionLoad(error, data) { if (error) { return callback("Error fetching session object from session - " + JSON.stringify(error), null); } // Session object found? if (data == null) { winston.info(MODULE_NAME + METHOD_NAME + "Session does not exist for sessionId - " + sessionId); return callback(null, false); } // Extend the session expiry time. resetSessionTimeout(sessionId, data, function(errorMessage, status) { // Trouble? if (errorMessage != null) { return callback(errorMessage, null); } // All ok! return callback(null, true); }); }); }; /** * Resets the timeout upon every request so that the session doesn't expire until the user is active. * Private function that will be called whenever there is call to any of the public methods of this class. */ function resetSessionTimeout(sessionId, sessionObject, callback) { var METHOD_NAME = "resetSessionTimeout(): "; if (utils.isBlank(sessionId)) { return callback("SessionId not provided to resetSessionTimeout().", null); } if (sessionObject == null) { return callback("SessionObject not provided to resetSessionTimeout().", null); } // Serialize the sessionObject if required. var sessionObjectToCache = sessionObject; if (typeof(sessionObject) == 'object') { sessionObjectToCache = JSON.stringify(sessionObject); } var currentEnv = constants.ENV_DEVELOPMENT; if (config.currentEnv != null) { currentEnv = config.currentEnv; } // Save sessionObject back to cache. Hopefully, this resets the expiry time in the fh.cache? fh.session.set(sessionId, sessionObjectToCache, config.environments[currentEnv].sessionTimeout, function(error) { if (error) { return callback("Unable to reset session timeout - " + JSON.stringify(error), null); } return callback(null, true); }); }; /** * Code for invalidating/destroying session. */ function destroySession(sessionId, callback) { var METHOD_NAME = "destroySession(): "; winston.info(MODULE_NAME + METHOD_NAME + "Attempting to destroy session for SessionId - " + sessionId); if (utils.isBlank(sessionId)) { return callback("SessionId not provided to destroySession().", null); } fh.session.remove(sessionId, function(error, data) { if (error) { winston.error(MODULE_NAME + METHOD_NAME + "Error removing session object from the session store - " + JSON.stringify(error)); return callback("Error removing session object from the session store - " + JSON.stringify(error), null); } if (data == true) { winston.info(MODULE_NAME + METHOD_NAME + "Session object removed successfully from session store. SessionId - " + sessionId); return callback(null, true); } else { winston.error(MODULE_NAME + METHOD_NAME + "Error removing session object from session store or bad sessionId. SessionId - " + sessionId); return callback("Error removing session object from session store or bad sessionId. SessionId - " + sessionId, false); } }); }; }; // Export Module module.exports = new SessionManager();
feedhenry-templates/team-todo-cloud
lib/session/sessionManager.js
JavaScript
mit
8,687
// @flow import getKeys from "./getKeys"; import type {Composite} from "./types"; /** * Returns true if composite has no own enumerable keys (is empty) or false * otherwise */ const isEmpty = (composite: Composite): boolean => getKeys(composite).length === 0; export default isEmpty;
jumpn/utils-composite
src/isEmpty.js
JavaScript
mit
293
this.NesDb = this.NesDb || {}; NesDb[ 'EFA19C34C9DC95F7511AF979CAD72884A6746A3B' ] = { "$": { "name": "Arkanoid", "altname": "アルカノイド", "class": "Licensed", "subclass": "3rd-Party", "catalog": "TFC-AN-5400-10", "publisher": "Taito", "developer": "Taito", "region": "Japan", "players": "1", "date": "1986-12-26" }, "peripherals": [ { "device": [ { "$": { "type": "arkanoid", "name": "Vaus Controller" } } ] } ], "cartridge": [ { "$": { "system": "Famicom", "crc": "D89E5A67", "sha1": "EFA19C34C9DC95F7511AF979CAD72884A6746A3B", "dump": "ok", "dumper": "bootgod", "datedumped": "2007-06-29" }, "board": [ { "$": { "type": "TAITO-CNROM", "pcb": "FC-010", "mapper": "3" }, "prg": [ { "$": { "size": "32k", "crc": "35893B67", "sha1": "7BB46BD1070F09DBBBA3AA9A05E6265FCF9A3376" } } ], "chr": [ { "$": { "size": "16k", "crc": "C5789B20", "sha1": "58551085A755781030EAFA8C0E9238C9B1A50F5B" } } ], "chip": [ { "$": { "type": "74xx161" } } ], "pad": [ { "$": { "h": "0", "v": "1" } } ] } ] } ], "gameGenieCodes": [ { "name": "Player 1 start with 1 life", "codes": [ [ "PAOPUGLA" ] ] }, { "name": "Player 1 start with 6 lives", "codes": [ [ "TAOPUGLA" ] ] }, { "name": "Player 1 start with 9 lives", "codes": [ [ "PAOPUGLE" ] ] }, { "name": "Infinite lives, players 1 & 2", "codes": [ [ "OZNEATVK" ] ] }, { "name": "Player 1 start at level 5", "codes": [ [ "IAOONGPA" ] ] }, { "name": "Player 1 start at level 10", "codes": [ [ "ZAOONGPE" ] ] }, { "name": "Player 1 start at level 15", "codes": [ [ "YAOONGPE" ] ] }, { "name": "Player 1 start at level 20", "codes": [ [ "GPOONGPA" ] ] }, { "name": "Player 1 start at level 25", "codes": [ [ "PPOONGPE" ] ] }, { "name": "Player 1 start at level 30", "codes": [ [ "TPOONGPE" ] ] }, { "name": "No bat enhancement capsules", "codes": [ [ "SXNAIAAX" ] ] }, { "name": "No lasers", "codes": [ [ "SXVATAAX" ] ] } ] };
peteward44/WebNES
project/js/db/EFA19C34C9DC95F7511AF979CAD72884A6746A3B.js
JavaScript
mit
2,533
<style type="text/css"> #sidebar{ width:200px;} #tab-content{padding:10px; margin-top:-40px;} </style> <style type="text/css"> #sidebar{ width:200px;} #tab-content{padding:10px; margin-top:-20px;} </style> <?php $this->load->view('common/header'); ?> <script> $(document).ready(function () { //alert('hi'); //$('#user_like').click(function(){ var like_to='<?php echo $user_profile->ID; ?>'; //alert('love you'); $.ajax({ url: "<?php echo base_url().'user/getall_like';?>", type:'POST', dataType: "json", data: "like_to="+like_to, success:function(response){ $("#nuser_like").text('('+response.like+')'); } }); //}); }); </script> <script> $(document).ready(function () { //alert('hi'); //$('#user_like').click(function(){ var follow_to='<?php echo $user_profile->ID; ?>'; //alert('love you'); $.ajax({ url: "<?php echo base_url().'user/getall_follow';?>", type:'POST', dataType: "json", data: "followed_to="+follow_to, success:function(response){ $("#nfollow").text('('+response.follow+')'); } }); //}); }); </script> <script defer src="<?php echo base_url(); ?>assets/js/jquery.flexslider.js"></script> <link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/flexslider.css" type="text/css"/> <script type="text/JavaScript" > // Can also be used with $(document).ready() jQuery(window).load(function() { jQuery('.flexslider').flexslider({ animation: "slide", controlNav: "thumbnails", slideshow: false }); }); </script> <div class="container"> <div class="row single-grids user-profile"> <div class="col-sm-7 col-md-7"> <?php $current_user = $this->session->userdata('username');?> <div class="col-sm-2 user-profile-col pading0"> <div class="user-profile-photo"><a style="color:#000;" href="<?php if ($current_user==$user_profile->username){ echo base_url().'user/myaccount';}else{ ?><?php echo base_url(); ?>user/user_detail/<?php echo $user_profile->ID;} ?>"> <?php if($user_profile->profile_pic==NuLL){ ?><img class="img-responsive img-circle" src="<?php echo base_url().'assets/images/user.jpg'; ?>"><?php }else{?><img class="img-responsive img-circle" src="<?php echo base_url().'assets/images/'.$user_profile->username.'/adds/'.$user_profile->profile_pic; ?>"><?php } ?></a> </div> </div> <div class="col-sm-10 pading0"> <h2 class="user-title"><a style="color:#000;" href="<?php if ($current_user==$user_profile->username){ echo base_url().'user/myaccount';}else{ ?><?php echo base_url(); ?>user/user_detail/<?php echo $user_profile->ID;} ?>"><?php echo $user_profile->first_name.' '.$user_profile->last_name;?></a></h2> <h5 class="pull-left user-info"> <a style="color:#969696;" href="<?php if ($current_user==$user_profile->username){ echo base_url().'user/myaccount';}else{ ?><?php echo base_url(); ?>user/user_detail/<?php echo $user_profile->ID;} ?>"><i class="fa fa-map-marker"></i> <?php echo $user_profile->city;?></a></h5> <h6 class="pull-right user-link"> <span class="link-icon"><i class="glyphicon glyphicon-link "></i> </span> <a href="#">www.pornstar.com/red-lights</a></h6> </div> </div> </div> <div id="content" > <h3>Messages</h3> <div class="row message-page"> <div class="col-sm-4 col-md-4 media-thumb-wrap "> <div class="flexslider" > <ul class="slides"> <?php if($user_photo==NULL){ if($user_profile->profile_pic==NULL){ echo "Please Upload Your Profile Picture Or Photos to show image on empty area!";}else{?> <li data-thumb="<?php echo base_url(); ?>assets/images/<?php echo $user_profile->username; ?>/adds/<?php echo $user_profile->profile_pic; ?>"> <div class="thumb-image" style="height:350px;"> <img src="<?php echo base_url(); ?>assets/images/<?php echo $user_profile->username; ?>/services/<?php echo $user_profile->profile_pic; ?>" data-imagezoom="true" class="img-responsive"> </div> </li> <?php } }else{ foreach($user_photo as $row){ ?> <li data-thumb="<?php echo base_url(); ?>assets/images/<?php echo $user_profile->username; ?>/images/<?php echo $row->img_path; ?>"> <div class="thumb-image" style="height:350px;"> <img src="<?php echo base_url(); ?>assets/images/<?php echo $user_profile->username; ?>/images/<?php echo $row->img_path; ?>" data-imagezoom="true" class="img-responsive"> </div> </li> <?php }}?> </ul> </div> <?php if($user_profile->profile_pic!=NULL &&$user_photo!=NULL ){?> <p class="click-image">* Click on image to enlarge</p> <?php } ?> </div> <!-- Tab panes --> <div class="col-sm-8 col-md-8"> <div class="panel-heading contact-menu"> <ul class="nav nav-tabs"> <li class="col-sm-4"> <a href="<?php echo base_url();?>user/messages"> <span class="link-icon Send-message-icon"> </span> Messages <span class="count-like">(<?php print_r($page_no);?>) </span> </a> </li> <li class="col-sm-4"> <a href="<?php echo base_url();?>user/ads">Ads <span class="count-like">(<?php print_r($post_count);?>) </span> </a> </li> <li> <a href="<?php echo base_url(); ?>user/showfollower/<?php echo $user_profile->ID; ?>"> <span class="glyphicon glyphicon-record"> </span> Followers <span class="count-followers"><?php //print_r($get_follow);?><span id="nfollow"></span></span> </a> </li> <li> <!--<a href="#" data-toggle="tab"> <span class="glyphicon glyphicon-star"></span> Likes <span class="count-like">(<?php //print_r($get_follow);?>) </span> </a>--> <a href="<?php echo base_url(); ?>user/showlikes/<?php echo $user_profile->ID; ?>" > <span class="glyphicon glyphicon-star"></span> Likes <span class="count-like"><span id="nuser_like"></span> </span> </a> </li> </ul> </div> </div> <div class="col-sm-2 col-md-2"> <h3>Messages</h3> <ul class="tab-part nav nav-tabs" role="tablist"> <li role="presentation" id="sidebar" > <a href="<?php echo base_url(); ?>user/mymessages" > <span class="glyphicon glyphicon-envelope"></span>Inbox</a> </li> <li role="presentation" class="active" id="sidebar"><a href="<?php echo base_url(); ?>user/composemessages"><span class="glyphicon glyphicon-pencil"></span>Compose</a></li> <li role="presentation" " id="sidebar"> <a href="<?php echo base_url(); ?>user/sentmessages"> <span class="glyphicon glyphicon-send"></span>Sent</a> </li> </ul> </div> <!-- Tab panes --> <div class="col-sm-6" id="tab-content"> <div class=""> <div id="compose"> <h4><br>New Message</h4> <?php echo form_open_multipart('user/composemail'); ?> <div class="form-group"> <label for="new-email" class="col-sm-2 col-xs-12 control-label">To:</label> <div class="col-sm-10 col-xs-12"> <input type="text" name="to" class="form-control" value="<?php echo set_value('to'); ?>" id="new-email" placeholder=""> <?php echo "<span style='color:red;'>".form_error('to')."</span>"; ?> </div> </div> <div class="form-group"> <label for="cc" class="col-sm-2 col-xs-12 control-label">Cc:</label> <div class="col-sm-10 col-xs-12"> <input type="text" class="form-control" name="cc" value="<?php echo set_value('cc'); ?>" id="cc" placeholder=""> </div> </div> <div class="form-group"> <label for="subject" class="col-sm-2 col-xs-12 control-label">Subject:</label> <div class="col-sm-10 col-xs-12"> <input type="text" class="form-control" name="subject" value="<?php echo set_value('subject'); ?>" id="subject" placeholder=""> </div> </div> <div class="form-group"> <label for="subject" class="col-sm-2 col-xs-12 control-label">Message:</label> <div class="col-sm-10 col-xs-12"> <textarea name="description" rows="3" class="form-control" cols="5"><?php echo set_value('description'); ?></textarea> <?php echo"<span style='color:red'>". form_error('description')."</span>"; ?> </div> </div> <div class="col-sm-offset-2 col-sm-10"> <div class="file-input"> <label> <span class="glyphicon glyphicon-paperclip"></span> <input type="file" name="file" id="InputFile"> </label> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <?php echo "<span style='color:green;'>".$this->session->flashdata('message')."</span><br />"; ?> <input type="submit" value="Send Email" class="btn btn-primary" /> </div> </div> <?php echo form_close(); ?> </div> <div role="tabpanel" class="tab-pane" id="settings">...</div> </div> </div> </div> </div><!--content-closed--> </div> <?php $this->load->view('common/stay-in-new'); ?> <?php $this->load->view('common/sfooter'); ?>
cubicwebsolutions/pstar
application/views/user/composemail.php
PHP
mit
9,901
require_relative '../examine' module InternetScrabbleClub class Client module ResponseParsers class Examine::History < Examine rule(:sub_command) { str('HISTORY') } rule(:arguments) { delimited([stats, settings, (player_info.as(:info) >> newline_with_whitespace >> plays.as(:plays) ).as(:first_player), str('STOP'), (player_info.as(:info) >> newline_with_whitespace >> plays.as(:plays) ).as(:second_player), str('STOP') ], newline_with_whitespace) >> newline_with_whitespace } rule(:newline_with_whitespace) { space.repeat >> newline >> space.repeat } rule(:stats) { _int >> space >> date.as(:date) } rule(:settings) { delimited [int.as(:dictionary_code), _int, _int, _int] } rule(:player_info) { delimited [word.as(:nickname), int.as(:rating), rack.as(:initial_rack), (int | null).as(:final_score)] } rule(:plays) { ((move | change | pass) >> space?).repeat } rule(:move) { delimited [str('MOVE').as(:word).as(:type), position.as(:position), tiles.as(:word), int.as(:score), _int, _int, rack.as(:rack), _int] } rule(:change) { delimited [str('CHANGE').as(:word).as(:type), rack.as(:rack), _int, _int, (dashes | int).as(:swap_count)] } rule(:pass) { delimited [str('PAS').as(:word).as(:type), _int, _int, (dashes | suggestion).as(:suggestion)] } rule(:suggestion) { delimited [position.as(:position), word.as(:word), int.as(:score)], underscore } rule(:underscore) { match('_') } rule(:underscored_word) { word >> underscore >> word } rule(:position) { horizontal_position.as(:horizontal) | vertical_position.as(:vertical) } rule(:horizontal_position) { alpha.as(:word).as(:column) >> int.as(:row) } rule(:vertical_position) { int.as(:row) >> alpha.as(:word).as(:column) } end end end end
thomasbrus/internet-scrabble-club
lib/internet_scrabble_club/client/response_parsers/examine/history.rb
Ruby
mit
1,980
var searchData= [ ['screeningsolver',['ScreeningSolver',['../classhdim_1_1internal_1_1_screening_solver.html',1,'hdim::internal']]], ['sgd',['SGD',['../classhdim_1_1hdim_1_1_s_g_d.html',1,'hdim::hdim']]], ['sgd_5fsr',['SGD_SR',['../classhdim_1_1hdim_1_1_s_g_d___s_r.html',1,'hdim::hdim']]], ['softthres',['SoftThres',['../structhdim_1_1_soft_thres.html',1,'hdim']]], ['solver',['Solver',['../classhdim_1_1internal_1_1_solver.html',1,'hdim::internal']]], ['solver',['Solver',['../classocl_1_1internal_1_1_solver.html',1,'ocl::internal']]], ['solver',['Solver',['../classhdim_1_1vcl_1_1internal_1_1_solver.html',1,'hdim::vcl::internal']]], ['solver_5fd',['Solver_d',['../classhdim_1_1hdim_1_1_solver__d.html',1,'hdim::hdim']]], ['solver_5ff',['Solver_f',['../classhdim_1_1hdim_1_1_solver__f.html',1,'hdim::hdim']]], ['srsolver_5fd',['SRSolver_d',['../classhdim_1_1hdim_1_1_s_r_solver__d.html',1,'hdim::hdim']]], ['srsolver_5ff',['SRSolver_f',['../classhdim_1_1hdim_1_1_s_r_solver__f.html',1,'hdim::hdim']]], ['subgradientsolver',['SubGradientSolver',['../classhdim_1_1vcl_1_1internal_1_1_sub_gradient_solver.html',1,'hdim::vcl::internal']]], ['subgradientsolver',['SubGradientSolver',['../classhdim_1_1internal_1_1_sub_gradient_solver.html',1,'hdim::internal']]], ['subgradientsolver',['SubGradientSolver',['../classhdim_1_1ocl_1_1internal_1_1_sub_gradient_solver.html',1,'hdim::ocl::internal']]], ['supportsift',['SupportSift',['../structhdim_1_1_support_sift.html',1,'hdim']]], ['swig_5fcast_5finfo',['swig_cast_info',['../structswig__cast__info.html',1,'']]], ['swig_5fconst_5finfo',['swig_const_info',['../structswig__const__info.html',1,'']]], ['swig_5fglobalvar',['swig_globalvar',['../structswig__globalvar.html',1,'']]], ['swig_5fmodule_5finfo',['swig_module_info',['../structswig__module__info.html',1,'']]], ['swig_5ftype_5finfo',['swig_type_info',['../structswig__type__info.html',1,'']]], ['swig_5fvarlinkobject',['swig_varlinkobject',['../structswig__varlinkobject.html',1,'']]], ['swigptr_5fpyobject',['SwigPtr_PyObject',['../classswig_1_1_swig_ptr___py_object.html',1,'swig']]], ['swigpyclientdata',['SwigPyClientData',['../struct_swig_py_client_data.html',1,'']]], ['swigpyobject',['SwigPyObject',['../struct_swig_py_object.html',1,'']]], ['swigpypacked',['SwigPyPacked',['../struct_swig_py_packed.html',1,'']]], ['swigvar_5fpyobject',['SwigVar_PyObject',['../structswig_1_1_swig_var___py_object.html',1,'swig']]] ];
LedererLab/FOS
docs/search/classes_a.js
JavaScript
mit
2,483
#!/usr/bin/env ruby # encoding: utf-8 require_relative '../environment.rb' puts 'Starting to build library of descriptors' descriptors = Linepig::DescriptorExtractor.new descriptors.create puts 'Done'
dshorthouse/linepig-image-match
bin/build_descriptors.rb
Ruby
mit
201
package analysisservices // Copyright (c) Microsoft and contributors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // // See the License for the specific language governing permissions and // limitations under the License. // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/validation" "net/http" ) // ServersClient is the the Azure Analysis Services Web API provides a RESTful set of web services that enables users // to create, retrieve, update, and delete Analysis Services servers type ServersClient struct { BaseClient } // NewServersClient creates an instance of the ServersClient client. func NewServersClient(subscriptionID string) ServersClient { return NewServersClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewServersClientWithBaseURI creates an instance of the ServersClient client. func NewServersClientWithBaseURI(baseURI string, subscriptionID string) ServersClient { return ServersClient{NewWithBaseURI(baseURI, subscriptionID)} } // CheckNameAvailability check the name availability in the target location. // Parameters: // location - the region name which the operation will lookup into. // serverParameters - contains the information used to provision the Analysis Services server. func (client ServersClient) CheckNameAvailability(ctx context.Context, location string, serverParameters CheckServerNameAvailabilityParameters) (result CheckServerNameAvailabilityResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: serverParameters, Constraints: []validation.Constraint{{Target: "serverParameters.Name", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "serverParameters.Name", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "serverParameters.Name", Name: validation.MinLength, Rule: 3, Chain: nil}, {Target: "serverParameters.Name", Name: validation.Pattern, Rule: `^[a-z][a-z0-9]*$`, Chain: nil}, }}}}}); err != nil { return result, validation.NewError("analysisservices.ServersClient", "CheckNameAvailability", err.Error()) } req, err := client.CheckNameAvailabilityPreparer(ctx, location, serverParameters) if err != nil { err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "CheckNameAvailability", nil, "Failure preparing request") return } resp, err := client.CheckNameAvailabilitySender(req) if err != nil { result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "CheckNameAvailability", resp, "Failure sending request") return } result, err = client.CheckNameAvailabilityResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "CheckNameAvailability", resp, "Failure responding to request") } return } // CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. func (client ServersClient) CheckNameAvailabilityPreparer(ctx context.Context, location string, serverParameters CheckServerNameAvailabilityParameters) (*http.Request, error) { pathParameters := map[string]interface{}{ "location": autorest.Encode("path", location), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2017-08-01-beta" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.AnalysisServices/locations/{location}/checkNameAvailability", pathParameters), autorest.WithJSON(serverParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the // http.Response Body if it receives an error. func (client ServersClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, azure.DoRetryWithRegistration(client.Client)) } // CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always // closes the http.Response Body. func (client ServersClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckServerNameAvailabilityResult, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // Create provisions the specified Analysis Services server based on the configuration specified in the request. // Parameters: // resourceGroupName - the name of the Azure Resource group of which a given Analysis Services server is part. // This name must be at least 1 character in length, and no more than 90. // serverName - the name of the Analysis Services server. It must be a minimum of 3 characters, and a maximum // of 63. // serverParameters - contains the information used to provision the Analysis Services server. func (client ServersClient) Create(ctx context.Context, resourceGroupName string, serverName string, serverParameters Server) (result ServersCreateFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, {TargetValue: serverName, Constraints: []validation.Constraint{{Target: "serverName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "serverName", Name: validation.MinLength, Rule: 3, Chain: nil}, {Target: "serverName", Name: validation.Pattern, Rule: `^[a-z][a-z0-9]*$`, Chain: nil}}}}); err != nil { return result, validation.NewError("analysisservices.ServersClient", "Create", err.Error()) } req, err := client.CreatePreparer(ctx, resourceGroupName, serverName, serverParameters) if err != nil { err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Create", nil, "Failure preparing request") return } result, err = client.CreateSender(req) if err != nil { err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Create", result.Response(), "Failure sending request") return } return } // CreatePreparer prepares the Create request. func (client ServersClient) CreatePreparer(ctx context.Context, resourceGroupName string, serverName string, serverParameters Server) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "serverName": autorest.Encode("path", serverName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2017-08-01-beta" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AnalysisServices/servers/{serverName}", pathParameters), autorest.WithJSON(serverParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // CreateSender sends the Create request. The method will close the // http.Response Body if it receives an error. func (client ServersClient) CreateSender(req *http.Request) (future ServersCreateFuture, err error) { sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) future.Future = azure.NewFuture(req) future.req = req _, err = future.Done(sender) if err != nil { return } err = autorest.Respond(future.Response(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated)) return } // CreateResponder handles the response to the Create request. The method always // closes the http.Response Body. func (client ServersClient) CreateResponder(resp *http.Response) (result Server, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // Delete deletes the specified Analysis Services server. // Parameters: // resourceGroupName - the name of the Azure Resource group of which a given Analysis Services server is part. // This name must be at least 1 character in length, and no more than 90. // serverName - the name of the Analysis Services server. It must be at least 3 characters in length, and no // more than 63. func (client ServersClient) Delete(ctx context.Context, resourceGroupName string, serverName string) (result ServersDeleteFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, {TargetValue: serverName, Constraints: []validation.Constraint{{Target: "serverName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "serverName", Name: validation.MinLength, Rule: 3, Chain: nil}, {Target: "serverName", Name: validation.Pattern, Rule: `^[a-z][a-z0-9]*$`, Chain: nil}}}}); err != nil { return result, validation.NewError("analysisservices.ServersClient", "Delete", err.Error()) } req, err := client.DeletePreparer(ctx, resourceGroupName, serverName) if err != nil { err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Delete", nil, "Failure preparing request") return } result, err = client.DeleteSender(req) if err != nil { err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Delete", result.Response(), "Failure sending request") return } return } // DeletePreparer prepares the Delete request. func (client ServersClient) DeletePreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "serverName": autorest.Encode("path", serverName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2017-08-01-beta" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsDelete(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AnalysisServices/servers/{serverName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client ServersClient) DeleteSender(req *http.Request) (future ServersDeleteFuture, err error) { sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) future.Future = azure.NewFuture(req) future.req = req _, err = future.Done(sender) if err != nil { return } err = autorest.Respond(future.Response(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) return } // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. func (client ServersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), autorest.ByClosing()) result.Response = resp return } // DissociateGateway dissociates a Unified Gateway associated with the server. // Parameters: // resourceGroupName - the name of the Azure Resource group of which a given Analysis Services server is part. // This name must be at least 1 character in length, and no more than 90. // serverName - the name of the Analysis Services server. It must be at least 3 characters in length, and no // more than 63. func (client ServersClient) DissociateGateway(ctx context.Context, resourceGroupName string, serverName string) (result autorest.Response, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, {TargetValue: serverName, Constraints: []validation.Constraint{{Target: "serverName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "serverName", Name: validation.MinLength, Rule: 3, Chain: nil}, {Target: "serverName", Name: validation.Pattern, Rule: `^[a-z][a-z0-9]*$`, Chain: nil}}}}); err != nil { return result, validation.NewError("analysisservices.ServersClient", "DissociateGateway", err.Error()) } req, err := client.DissociateGatewayPreparer(ctx, resourceGroupName, serverName) if err != nil { err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "DissociateGateway", nil, "Failure preparing request") return } resp, err := client.DissociateGatewaySender(req) if err != nil { result.Response = resp err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "DissociateGateway", resp, "Failure sending request") return } result, err = client.DissociateGatewayResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "DissociateGateway", resp, "Failure responding to request") } return } // DissociateGatewayPreparer prepares the DissociateGateway request. func (client ServersClient) DissociateGatewayPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "serverName": autorest.Encode("path", serverName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2017-08-01-beta" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AnalysisServices/servers/{serverName}/dissociateGateway", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // DissociateGatewaySender sends the DissociateGateway request. The method will close the // http.Response Body if it receives an error. func (client ServersClient) DissociateGatewaySender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, azure.DoRetryWithRegistration(client.Client)) } // DissociateGatewayResponder handles the response to the DissociateGateway request. The method always // closes the http.Response Body. func (client ServersClient) DissociateGatewayResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByClosing()) result.Response = resp return } // GetDetails gets details about the specified Analysis Services server. // Parameters: // resourceGroupName - the name of the Azure Resource group of which a given Analysis Services server is part. // This name must be at least 1 character in length, and no more than 90. // serverName - the name of the Analysis Services server. It must be a minimum of 3 characters, and a maximum // of 63. func (client ServersClient) GetDetails(ctx context.Context, resourceGroupName string, serverName string) (result Server, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, {TargetValue: serverName, Constraints: []validation.Constraint{{Target: "serverName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "serverName", Name: validation.MinLength, Rule: 3, Chain: nil}, {Target: "serverName", Name: validation.Pattern, Rule: `^[a-z][a-z0-9]*$`, Chain: nil}}}}); err != nil { return result, validation.NewError("analysisservices.ServersClient", "GetDetails", err.Error()) } req, err := client.GetDetailsPreparer(ctx, resourceGroupName, serverName) if err != nil { err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "GetDetails", nil, "Failure preparing request") return } resp, err := client.GetDetailsSender(req) if err != nil { result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "GetDetails", resp, "Failure sending request") return } result, err = client.GetDetailsResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "GetDetails", resp, "Failure responding to request") } return } // GetDetailsPreparer prepares the GetDetails request. func (client ServersClient) GetDetailsPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "serverName": autorest.Encode("path", serverName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2017-08-01-beta" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AnalysisServices/servers/{serverName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // GetDetailsSender sends the GetDetails request. The method will close the // http.Response Body if it receives an error. func (client ServersClient) GetDetailsSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, azure.DoRetryWithRegistration(client.Client)) } // GetDetailsResponder handles the response to the GetDetails request. The method always // closes the http.Response Body. func (client ServersClient) GetDetailsResponder(resp *http.Response) (result Server, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // List lists all the Analysis Services servers for the given subscription. func (client ServersClient) List(ctx context.Context) (result Servers, err error) { req, err := client.ListPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "List", nil, "Failure preparing request") return } resp, err := client.ListSender(req) if err != nil { result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "List", resp, "Failure sending request") return } result, err = client.ListResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "List", resp, "Failure responding to request") } return } // ListPreparer prepares the List request. func (client ServersClient) ListPreparer(ctx context.Context) (*http.Request, error) { pathParameters := map[string]interface{}{ "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2017-08-01-beta" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.AnalysisServices/servers", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. func (client ServersClient) ListSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, azure.DoRetryWithRegistration(client.Client)) } // ListResponder handles the response to the List request. The method always // closes the http.Response Body. func (client ServersClient) ListResponder(resp *http.Response) (result Servers, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // ListByResourceGroup gets all the Analysis Services servers for the given resource group. // Parameters: // resourceGroupName - the name of the Azure Resource group of which a given Analysis Services server is part. // This name must be at least 1 character in length, and no more than 90. func (client ServersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result Servers, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { return result, validation.NewError("analysisservices.ServersClient", "ListByResourceGroup", err.Error()) } req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) if err != nil { err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "ListByResourceGroup", nil, "Failure preparing request") return } resp, err := client.ListByResourceGroupSender(req) if err != nil { result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "ListByResourceGroup", resp, "Failure sending request") return } result, err = client.ListByResourceGroupResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "ListByResourceGroup", resp, "Failure responding to request") } return } // ListByResourceGroupPreparer prepares the ListByResourceGroup request. func (client ServersClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2017-08-01-beta" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AnalysisServices/servers", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the // http.Response Body if it receives an error. func (client ServersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, azure.DoRetryWithRegistration(client.Client)) } // ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always // closes the http.Response Body. func (client ServersClient) ListByResourceGroupResponder(resp *http.Response) (result Servers, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // ListGatewayStatus return the gateway status of the specified Analysis Services server instance. // Parameters: // resourceGroupName - the name of the Azure Resource group of which a given Analysis Services server is part. // This name must be at least 1 character in length, and no more than 90. // serverName - the name of the Analysis Services server. func (client ServersClient) ListGatewayStatus(ctx context.Context, resourceGroupName string, serverName string) (result GatewayListStatusLive, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, {TargetValue: serverName, Constraints: []validation.Constraint{{Target: "serverName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "serverName", Name: validation.MinLength, Rule: 3, Chain: nil}, {Target: "serverName", Name: validation.Pattern, Rule: `^[a-z][a-z0-9]*$`, Chain: nil}}}}); err != nil { return result, validation.NewError("analysisservices.ServersClient", "ListGatewayStatus", err.Error()) } req, err := client.ListGatewayStatusPreparer(ctx, resourceGroupName, serverName) if err != nil { err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "ListGatewayStatus", nil, "Failure preparing request") return } resp, err := client.ListGatewayStatusSender(req) if err != nil { result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "ListGatewayStatus", resp, "Failure sending request") return } result, err = client.ListGatewayStatusResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "ListGatewayStatus", resp, "Failure responding to request") } return } // ListGatewayStatusPreparer prepares the ListGatewayStatus request. func (client ServersClient) ListGatewayStatusPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "serverName": autorest.Encode("path", serverName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2017-08-01-beta" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AnalysisServices/servers/{serverName}/listGatewayStatus", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // ListGatewayStatusSender sends the ListGatewayStatus request. The method will close the // http.Response Body if it receives an error. func (client ServersClient) ListGatewayStatusSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, azure.DoRetryWithRegistration(client.Client)) } // ListGatewayStatusResponder handles the response to the ListGatewayStatus request. The method always // closes the http.Response Body. func (client ServersClient) ListGatewayStatusResponder(resp *http.Response) (result GatewayListStatusLive, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // ListOperationResults list the result of the specified operation. // Parameters: // location - the region name which the operation will lookup into. // operationID - the target operation Id. func (client ServersClient) ListOperationResults(ctx context.Context, location string, operationID string) (result autorest.Response, err error) { req, err := client.ListOperationResultsPreparer(ctx, location, operationID) if err != nil { err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "ListOperationResults", nil, "Failure preparing request") return } resp, err := client.ListOperationResultsSender(req) if err != nil { result.Response = resp err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "ListOperationResults", resp, "Failure sending request") return } result, err = client.ListOperationResultsResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "ListOperationResults", resp, "Failure responding to request") } return } // ListOperationResultsPreparer prepares the ListOperationResults request. func (client ServersClient) ListOperationResultsPreparer(ctx context.Context, location string, operationID string) (*http.Request, error) { pathParameters := map[string]interface{}{ "location": autorest.Encode("path", location), "operationId": autorest.Encode("path", operationID), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2017-08-01-beta" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.AnalysisServices/locations/{location}/operationresults/{operationId}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // ListOperationResultsSender sends the ListOperationResults request. The method will close the // http.Response Body if it receives an error. func (client ServersClient) ListOperationResultsSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, azure.DoRetryWithRegistration(client.Client)) } // ListOperationResultsResponder handles the response to the ListOperationResults request. The method always // closes the http.Response Body. func (client ServersClient) ListOperationResultsResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), autorest.ByClosing()) result.Response = resp return } // ListOperationStatuses list the status of operation. // Parameters: // location - the region name which the operation will lookup into. // operationID - the target operation Id. func (client ServersClient) ListOperationStatuses(ctx context.Context, location string, operationID string) (result OperationStatus, err error) { req, err := client.ListOperationStatusesPreparer(ctx, location, operationID) if err != nil { err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "ListOperationStatuses", nil, "Failure preparing request") return } resp, err := client.ListOperationStatusesSender(req) if err != nil { result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "ListOperationStatuses", resp, "Failure sending request") return } result, err = client.ListOperationStatusesResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "ListOperationStatuses", resp, "Failure responding to request") } return } // ListOperationStatusesPreparer prepares the ListOperationStatuses request. func (client ServersClient) ListOperationStatusesPreparer(ctx context.Context, location string, operationID string) (*http.Request, error) { pathParameters := map[string]interface{}{ "location": autorest.Encode("path", location), "operationId": autorest.Encode("path", operationID), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2017-08-01-beta" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.AnalysisServices/locations/{location}/operationstatuses/{operationId}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // ListOperationStatusesSender sends the ListOperationStatuses request. The method will close the // http.Response Body if it receives an error. func (client ServersClient) ListOperationStatusesSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, azure.DoRetryWithRegistration(client.Client)) } // ListOperationStatusesResponder handles the response to the ListOperationStatuses request. The method always // closes the http.Response Body. func (client ServersClient) ListOperationStatusesResponder(resp *http.Response) (result OperationStatus, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // ListSkusForExisting lists eligible SKUs for an Analysis Services resource. // Parameters: // resourceGroupName - the name of the Azure Resource group of which a given Analysis Services server is part. // This name must be at least 1 character in length, and no more than 90. // serverName - the name of the Analysis Services server. It must be at least 3 characters in length, and no // more than 63. func (client ServersClient) ListSkusForExisting(ctx context.Context, resourceGroupName string, serverName string) (result SkuEnumerationForExistingResourceResult, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, {TargetValue: serverName, Constraints: []validation.Constraint{{Target: "serverName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "serverName", Name: validation.MinLength, Rule: 3, Chain: nil}, {Target: "serverName", Name: validation.Pattern, Rule: `^[a-z][a-z0-9]*$`, Chain: nil}}}}); err != nil { return result, validation.NewError("analysisservices.ServersClient", "ListSkusForExisting", err.Error()) } req, err := client.ListSkusForExistingPreparer(ctx, resourceGroupName, serverName) if err != nil { err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "ListSkusForExisting", nil, "Failure preparing request") return } resp, err := client.ListSkusForExistingSender(req) if err != nil { result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "ListSkusForExisting", resp, "Failure sending request") return } result, err = client.ListSkusForExistingResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "ListSkusForExisting", resp, "Failure responding to request") } return } // ListSkusForExistingPreparer prepares the ListSkusForExisting request. func (client ServersClient) ListSkusForExistingPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "serverName": autorest.Encode("path", serverName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2017-08-01-beta" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AnalysisServices/servers/{serverName}/skus", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // ListSkusForExistingSender sends the ListSkusForExisting request. The method will close the // http.Response Body if it receives an error. func (client ServersClient) ListSkusForExistingSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, azure.DoRetryWithRegistration(client.Client)) } // ListSkusForExistingResponder handles the response to the ListSkusForExisting request. The method always // closes the http.Response Body. func (client ServersClient) ListSkusForExistingResponder(resp *http.Response) (result SkuEnumerationForExistingResourceResult, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // ListSkusForNew lists eligible SKUs for Analysis Services resource provider. func (client ServersClient) ListSkusForNew(ctx context.Context) (result SkuEnumerationForNewResourceResult, err error) { req, err := client.ListSkusForNewPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "ListSkusForNew", nil, "Failure preparing request") return } resp, err := client.ListSkusForNewSender(req) if err != nil { result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "ListSkusForNew", resp, "Failure sending request") return } result, err = client.ListSkusForNewResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "ListSkusForNew", resp, "Failure responding to request") } return } // ListSkusForNewPreparer prepares the ListSkusForNew request. func (client ServersClient) ListSkusForNewPreparer(ctx context.Context) (*http.Request, error) { pathParameters := map[string]interface{}{ "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2017-08-01-beta" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.AnalysisServices/skus", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // ListSkusForNewSender sends the ListSkusForNew request. The method will close the // http.Response Body if it receives an error. func (client ServersClient) ListSkusForNewSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, azure.DoRetryWithRegistration(client.Client)) } // ListSkusForNewResponder handles the response to the ListSkusForNew request. The method always // closes the http.Response Body. func (client ServersClient) ListSkusForNewResponder(resp *http.Response) (result SkuEnumerationForNewResourceResult, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return } // Resume resumes operation of the specified Analysis Services server instance. // Parameters: // resourceGroupName - the name of the Azure Resource group of which a given Analysis Services server is part. // This name must be at least 1 character in length, and no more than 90. // serverName - the name of the Analysis Services server. It must be at least 3 characters in length, and no // more than 63. func (client ServersClient) Resume(ctx context.Context, resourceGroupName string, serverName string) (result ServersResumeFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, {TargetValue: serverName, Constraints: []validation.Constraint{{Target: "serverName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "serverName", Name: validation.MinLength, Rule: 3, Chain: nil}, {Target: "serverName", Name: validation.Pattern, Rule: `^[a-z][a-z0-9]*$`, Chain: nil}}}}); err != nil { return result, validation.NewError("analysisservices.ServersClient", "Resume", err.Error()) } req, err := client.ResumePreparer(ctx, resourceGroupName, serverName) if err != nil { err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Resume", nil, "Failure preparing request") return } result, err = client.ResumeSender(req) if err != nil { err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Resume", result.Response(), "Failure sending request") return } return } // ResumePreparer prepares the Resume request. func (client ServersClient) ResumePreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "serverName": autorest.Encode("path", serverName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2017-08-01-beta" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AnalysisServices/servers/{serverName}/resume", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // ResumeSender sends the Resume request. The method will close the // http.Response Body if it receives an error. func (client ServersClient) ResumeSender(req *http.Request) (future ServersResumeFuture, err error) { sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) future.Future = azure.NewFuture(req) future.req = req _, err = future.Done(sender) if err != nil { return } err = autorest.Respond(future.Response(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) return } // ResumeResponder handles the response to the Resume request. The method always // closes the http.Response Body. func (client ServersClient) ResumeResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), autorest.ByClosing()) result.Response = resp return } // Suspend supends operation of the specified Analysis Services server instance. // Parameters: // resourceGroupName - the name of the Azure Resource group of which a given Analysis Services server is part. // This name must be at least 1 character in length, and no more than 90. // serverName - the name of the Analysis Services server. It must be at least 3 characters in length, and no // more than 63. func (client ServersClient) Suspend(ctx context.Context, resourceGroupName string, serverName string) (result ServersSuspendFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, {TargetValue: serverName, Constraints: []validation.Constraint{{Target: "serverName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "serverName", Name: validation.MinLength, Rule: 3, Chain: nil}, {Target: "serverName", Name: validation.Pattern, Rule: `^[a-z][a-z0-9]*$`, Chain: nil}}}}); err != nil { return result, validation.NewError("analysisservices.ServersClient", "Suspend", err.Error()) } req, err := client.SuspendPreparer(ctx, resourceGroupName, serverName) if err != nil { err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Suspend", nil, "Failure preparing request") return } result, err = client.SuspendSender(req) if err != nil { err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Suspend", result.Response(), "Failure sending request") return } return } // SuspendPreparer prepares the Suspend request. func (client ServersClient) SuspendPreparer(ctx context.Context, resourceGroupName string, serverName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "serverName": autorest.Encode("path", serverName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2017-08-01-beta" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AnalysisServices/servers/{serverName}/suspend", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // SuspendSender sends the Suspend request. The method will close the // http.Response Body if it receives an error. func (client ServersClient) SuspendSender(req *http.Request) (future ServersSuspendFuture, err error) { sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) future.Future = azure.NewFuture(req) future.req = req _, err = future.Done(sender) if err != nil { return } err = autorest.Respond(future.Response(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) return } // SuspendResponder handles the response to the Suspend request. The method always // closes the http.Response Body. func (client ServersClient) SuspendResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), autorest.ByClosing()) result.Response = resp return } // Update updates the current state of the specified Analysis Services server. // Parameters: // resourceGroupName - the name of the Azure Resource group of which a given Analysis Services server is part. // This name must be at least 1 character in length, and no more than 90. // serverName - the name of the Analysis Services server. It must be at least 3 characters in length, and no // more than 63. // serverUpdateParameters - request object that contains the updated information for the server. func (client ServersClient) Update(ctx context.Context, resourceGroupName string, serverName string, serverUpdateParameters ServerUpdateParameters) (result ServersUpdateFuture, err error) { if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, {TargetValue: serverName, Constraints: []validation.Constraint{{Target: "serverName", Name: validation.MaxLength, Rule: 63, Chain: nil}, {Target: "serverName", Name: validation.MinLength, Rule: 3, Chain: nil}, {Target: "serverName", Name: validation.Pattern, Rule: `^[a-z][a-z0-9]*$`, Chain: nil}}}}); err != nil { return result, validation.NewError("analysisservices.ServersClient", "Update", err.Error()) } req, err := client.UpdatePreparer(ctx, resourceGroupName, serverName, serverUpdateParameters) if err != nil { err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Update", nil, "Failure preparing request") return } result, err = client.UpdateSender(req) if err != nil { err = autorest.NewErrorWithError(err, "analysisservices.ServersClient", "Update", result.Response(), "Failure sending request") return } return } // UpdatePreparer prepares the Update request. func (client ServersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serverName string, serverUpdateParameters ServerUpdateParameters) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "serverName": autorest.Encode("path", serverName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } const APIVersion = "2017-08-01-beta" queryParameters := map[string]interface{}{ "api-version": APIVersion, } preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AnalysisServices/servers/{serverName}", pathParameters), autorest.WithJSON(serverUpdateParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } // UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. func (client ServersClient) UpdateSender(req *http.Request) (future ServersUpdateFuture, err error) { sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) future.Future = azure.NewFuture(req) future.req = req _, err = future.Done(sender) if err != nil { return } err = autorest.Respond(future.Response(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) return } // UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. func (client ServersClient) UpdateResponder(resp *http.Response) (result Server, err error) { err = autorest.Respond( resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return }
seuffert/rclone
vendor/github.com/Azure/azure-sdk-for-go/services/preview/analysisservices/preview/mgmt/2017-08-01-beta/analysisservices/servers.go
GO
mit
53,591
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.airlift.compress; public interface Compressor { int maxCompressedLength(int uncompressedSize); /** * @return number of bytes written to the output */ int compress(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset, int maxOutputLength); //void compress(ByteBuffer input, ByteBuffer output); }
wknishio/variable-terminal
src/aircompressor/io/airlift/compress/Compressor.java
Java
mit
924
(function () { 'use strict'; angular .module('openSenseMapApp') .controller('EditBoxLocationController', EditBoxLocationController); EditBoxLocationController.$inject = ['$scope', 'boxData', 'notifications', 'AccountService', 'Box']; function EditBoxLocationController ($scope, boxData, notifications, AccountService, Box) { var vm = this; vm.editMarkerInput = {}; vm.originalPosition = {}; vm.save = save; vm.resetPosition = resetPosition; activate(); //// function activate () { var icon = ''; var color = ''; if (boxData.exposure === 'indoor' || boxData.exposure === 'outdoor') { icon = 'cube'; color = 'green'; } if (boxData.exposure === 'mobile') { icon = 'rocket'; color = 'blue'; } var marker = L.AwesomeMarkers.icon({ type: 'awesomeMarker', prefix: 'fa', icon: icon, markerColor: color }); var lat = parseFloat(boxData.currentLocation.coordinates[1].toFixed(6)); var lng = parseFloat(boxData.currentLocation.coordinates[0].toFixed(6)); vm.boxPosition = { layerName: 'registration', lng: lng, lat: lat, latLng: [lat, lng], height: boxData.currentLocation.coordinates[2], draggable: true, zoom: 17, icon: marker }; angular.copy(vm.boxPosition, vm.originalPosition); vm.editMarker = { m1: angular.copy(vm.boxPosition) }; angular.copy(vm.boxPosition, vm.editMarkerInput); } function save () { return AccountService.updateBox(boxData._id, { location: vm.editMarker.m1 }) .then(function (response) { angular.copy(new Box(response.data), boxData); notifications.addAlert('info', 'NOTIFICATION_BOX_UPDATE_SUCCESS'); }) .catch(function () { notifications.addAlert('danger', 'NOTIFICATION_BOX_UPDATE_FAILED'); }); } function resetPosition () { vm.editMarker = { m1: angular.copy(vm.originalPosition) }; vm.editMarkerInput = angular.copy(vm.originalPosition); vm.editMarker.m1.draggable = true; } function setCoordinates (coords) { vm.editMarker = { m1: angular.copy(vm.originalPosition) }; var lng = parseFloat(coords.lng.toFixed(6)); var lat = parseFloat(coords.lat.toFixed(6)); vm.editMarker.m1.lng = lng; vm.editMarker.m1.lat = lat; vm.editMarker.m1.latLng = [lat, lng]; vm.editMarker.m1.height = coords.height; vm.editMarkerInput.lng = vm.editMarker.m1.lng; vm.editMarkerInput.lat = vm.editMarker.m1.lat; } //// $scope.$on('osemMapClick.map_edit', function (e, args) { setCoordinates(args.latlng); }); $scope.$on('osemMarkerDragend.map_edit', function (e, args) { setCoordinates(args.target._latlng); }); $scope.$watchCollection('location.editMarkerInput', function (newValue) { if (newValue && newValue.lat && newValue.lng) { setCoordinates({ lng: newValue.lng, lat: newValue.lat, height: newValue.height, }); } }); } })();
sensebox/OpenSenseMap
app/scripts/controllers/account.box.edit.location.js
JavaScript
mit
3,209
function foo<T = string>() {}
motiz88/astring-flow
test/data/roundtrip/flow-parser-tests/test-479.js
JavaScript
mit
29
<?php namespace app\controllers; use Yii; use yii\web\Response; use yii\web\Controller; use yii\web\NotFoundHttpException; use yii\filters\AccessControl; use yii\filters\VerbFilter; use yii\data\ActiveDataProvider; use yii\base\Exception; use app\components\StringUtils; use app\models\Category; /** * CategoryController implements the CRUD actions for Category model. */ class CategoryController extends Controller { /** * @inheritdoc */ public function behaviors() { return [ 'verbs' => [ 'class' => VerbFilter::className(), 'actions' => [ 'delete' => ['POST'], ], ], 'access' => [ 'class' => AccessControl::className(), 'rules' => [ [ 'allow' => true, 'roles' => ['@'], ], ], 'denyCallback' => function () { return Yii::$app->response->redirect(['/login']); }, ], ]; } /** * Lists all Category models. * @return mixed */ public function actionIndex() { $dataProvider = new ActiveDataProvider([ 'query' => Category::find(), ]); return $this->render('index', [ 'dataProvider' => $dataProvider, ]); } /** * Displays a single Category model. * @param integer $id * @return mixed */ public function actionView($id) { return $this->render('view', [ 'model' => $this->findModel($id), ]); } /** * Creates a new Category model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Category(); return $this->render('create', ['model' => $model,]); } /** * Save a new Category model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionSave($id = null) { Yii::$app->response->format = Response::FORMAT_JSON; $model = new Category(); if( Yii::$app->request->isAjax ) { if( $id ) { $model = $this->findModel($id); } if(!$model->load(Yii::$app->request->post()) || !$model->save()) { throw new Exception( 'Sorry, can\'t save data, fill all fields and try again!' ); } return $model; } throw new Exception( 'Page not found!' ); } /** * Updates an existing Category model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id * @return mixed */ public function actionUpdate($id) { $model = $this->findModel($id); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('update', [ 'model' => $model, ]); } } /** * Deletes an existing Category model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param integer $id * @return mixed */ public function actionDeleteAjax($id) { Yii::$app->response->format = Response::FORMAT_JSON; return $this->findModel($id)->delete(); } /** * Deletes an existing DocumentRepository model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param string $id * @return mixed */ public function actionDelete($id) { $this->findModel($id)->delete(); return $this->redirect(['index']); } /** * Finds the Category model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Category the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Category::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } } }
pauloteixeira/Warehouse
basic/controllers/CategoryController.php
PHP
mit
4,516
<?php class LayoutView extends \Owl\Layout{}
daveWid/Owl
tests/classes/LayoutView.php
PHP
mit
47
<?xml version="1.0" ?><!DOCTYPE TS><TS language="el_GR" version="2.0"> <defaultcodec>UTF-8</defaultcodec> <context> <name>AboutDialog</name> <message> <location filename="../forms/aboutdialog.ui" line="+14"/> <source>About Colossus</source> <translation>Σχετικά με το Colossus</translation> </message> <message> <location line="+39"/> <source>&lt;b&gt;Colossus&lt;/b&gt; version</source> <translation>Έκδοση Colossus</translation> </message> <message> <location line="+57"/> <source> This is experimental software. Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php. This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard.</source> <translation> This is experimental software. Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php. This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard.</translation> </message> <message> <location filename="../aboutdialog.cpp" line="+14"/> <source>Copyright</source> <translation>Πνευματική ιδιοκτησία </translation> </message> <message> <location line="+0"/> <source>The Colossus developers</source> <translation>Οι Colossus προγραμματιστές </translation> </message> </context> <context> <name>AddressBookPage</name> <message> <location filename="../forms/addressbookpage.ui" line="+14"/> <source>Address Book</source> <translation>Βιβλίο Διευθύνσεων</translation> </message> <message> <location line="+19"/> <source>Double-click to edit address or label</source> <translation>Διπλό-κλικ για επεξεργασία της διεύθυνσης ή της ετικέτας</translation> </message> <message> <location line="+27"/> <source>Create a new address</source> <translation>Δημιούργησε νέα διεύθυνση</translation> </message> <message> <location line="+14"/> <source>Copy the currently selected address to the system clipboard</source> <translation>Αντέγραψε την επιλεγμένη διεύθυνση στο πρόχειρο του συστήματος</translation> </message> <message> <location line="-11"/> <source>&amp;New Address</source> <translation>&amp;Νέα διεύθυνση</translation> </message> <message> <location filename="../addressbookpage.cpp" line="+63"/> <source>These are your Colossus addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source> <translation>Αυτές είναι οι Colossus διευθύνσεις σας για να λαμβάνετε πληρωμές. Δίνοντας μία ξεχωριστή διεύθυνση σε κάθε αποστολέα, θα μπορείτε να ελέγχετε ποιος σας πληρώνει.</translation> </message> <message> <location filename="../forms/addressbookpage.ui" line="+14"/> <source>&amp;Copy Address</source> <translation>&amp;Αντιγραφή διεύθυνσης</translation> </message> <message> <location line="+11"/> <source>Show &amp;QR Code</source> <translation>Δείξε &amp;QR κωδικα</translation> </message> <message> <location line="+11"/> <source>Sign a message to prove you own a Colossus address</source> <translation>Υπογράψτε ένα μήνυμα για ν&apos; αποδείξετε πως σας ανήκει μια συγκεκριμένη διεύθυνση Colossus</translation> </message> <message> <location line="+3"/> <source>Sign &amp;Message</source> <translation>&amp;Υπέγραψε το μήνυμα</translation> </message> <message> <location line="+25"/> <source>Delete the currently selected address from the list</source> <translation>Αντιγραφη της επιλεγμενης διεύθυνσης στο πρόχειρο του συστηματος</translation> </message> <message> <location line="+27"/> <source>Export the data in the current tab to a file</source> <translation>Εξαγωγή δεδομένων καρτέλας σε αρχείο</translation> </message> <message> <location line="+3"/> <source>&amp;Export</source> <translation>&amp;Εξαγωγή</translation> </message> <message> <location line="-44"/> <source>Verify a message to ensure it was signed with a specified Colossus address</source> <translation>Υπογράψτε ένα μήνυμα για ν&apos; αποδείξετε πως ανήκει μια συγκεκριμένη διεύθυνση Colossus</translation> </message> <message> <location line="+3"/> <source>&amp;Verify Message</source> <translation>&amp;Επιβεβαίωση μηνύματος</translation> </message> <message> <location line="+14"/> <source>&amp;Delete</source> <translation>&amp;Διαγραφή</translation> </message> <message> <location filename="../addressbookpage.cpp" line="-5"/> <source>These are your Colossus addresses for sending payments. Always check the amount and the receiving address before sending coins.</source> <translation>Αυτές είναι οι Colossus διευθύνσεις σας για να λαμβάνετε πληρωμές. Δίνοντας μία ξεχωριστή διεύθυνση σε κάθε αποστολέα, θα μπορείτε να ελέγχετε ποιος σας πληρώνει.</translation> </message> <message> <location line="+13"/> <source>Copy &amp;Label</source> <translation>Αντιγραφή &amp;επιγραφής</translation> </message> <message> <location line="+1"/> <source>&amp;Edit</source> <translation>&amp;Επεξεργασία</translation> </message> <message> <location line="+1"/> <source>Send &amp;Coins</source> <translation>Αποστολή νομισμάτων</translation> </message> <message> <location line="+260"/> <source>Export Address Book Data</source> <translation>Εξαγωγή Δεδομενων Βιβλίου Διευθύνσεων</translation> </message> <message> <location line="+1"/> <source>Comma separated file (*.csv)</source> <translation>Αρχείο οριοθετημένο με κόμματα (*.csv)</translation> </message> <message> <location line="+13"/> <source>Error exporting</source> <translation>Εξαγωγή λαθών</translation> </message> <message> <location line="+0"/> <source>Could not write to file %1.</source> <translation>Αδυναμία εγγραφής στο αρχείο %1.</translation> </message> </context> <context> <name>AddressTableModel</name> <message> <location filename="../addresstablemodel.cpp" line="+144"/> <source>Label</source> <translation>Ετικέτα</translation> </message> <message> <location line="+0"/> <source>Address</source> <translation>Διεύθυνση</translation> </message> <message> <location line="+36"/> <source>(no label)</source> <translation>(χωρίς ετικέτα)</translation> </message> </context> <context> <name>AskPassphraseDialog</name> <message> <location filename="../forms/askpassphrasedialog.ui" line="+26"/> <source>Passphrase Dialog</source> <translation>Φράση πρόσβασης </translation> </message> <message> <location line="+21"/> <source>Enter passphrase</source> <translation>Βάλτε κωδικό πρόσβασης</translation> </message> <message> <location line="+14"/> <source>New passphrase</source> <translation>Νέος κωδικός πρόσβασης</translation> </message> <message> <location line="+14"/> <source>Repeat new passphrase</source> <translation>Επανέλαβε τον νέο κωδικό πρόσβασης</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="+33"/> <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>Εισάγετε τον νέο κωδικό πρόσβασης στον πορτοφόλι &lt;br/&gt; Παρακαλώ χρησιμοποιείστε ένα κωδικό με &lt;b&gt; 10 ή περισσότερους τυχαίους χαρακτήρες&lt;/b&gt; ή &lt;b&gt; οχτώ ή παραπάνω λέξεις&lt;/b&gt;.</translation> </message> <message> <location line="+1"/> <source>Encrypt wallet</source> <translation>Κρυπτογράφησε το πορτοφόλι</translation> </message> <message> <location line="+3"/> <source>This operation needs your wallet passphrase to unlock the wallet.</source> <translation>Αυτη η ενεργεία χρειάζεται τον κωδικό του πορτοφολιού για να ξεκλειδώσει το πορτοφόλι.</translation> </message> <message> <location line="+5"/> <source>Unlock wallet</source> <translation>Ξεκλειδωσε το πορτοφολι</translation> </message> <message> <location line="+3"/> <source>This operation needs your wallet passphrase to decrypt the wallet.</source> <translation>Αυτη η ενεργεια χρειάζεται τον κωδικο του πορτοφολιου για να αποκρυπτογραφησειι το πορτοφολι.</translation> </message> <message> <location line="+5"/> <source>Decrypt wallet</source> <translation>Αποκρυπτογράφησε το πορτοφολι</translation> </message> <message> <location line="+3"/> <source>Change passphrase</source> <translation>Άλλαξε κωδικο πρόσβασης</translation> </message> <message> <location line="+1"/> <source>Enter the old and new passphrase to the wallet.</source> <translation>Εισάγετε τον παλιό και τον νεο κωδικο στο πορτοφολι.</translation> </message> <message> <location line="+46"/> <source>Confirm wallet encryption</source> <translation>Επιβεβαίωσε την κρυπτογραφηση του πορτοφολιού</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 LITECOINS&lt;/b&gt;!</source> <translation>Προσοχη: Εαν κρυπτογραφησεις το πορτοφολι σου και χάσεις τον κωδικο σου θα χάσεις &lt;b&gt; ΟΛΑ ΣΟΥ ΤΑ LITECOINS&lt;/b&gt;! Είσαι σίγουρος ότι θέλεις να κρυπτογραφησεις το πορτοφολι;</translation> </message> <message> <location line="+0"/> <source>Are you sure you wish to encrypt your wallet?</source> <translation>Είστε σίγουροι ότι θέλετε να κρυπτογραφήσετε το πορτοφόλι σας;</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>ΣΗΜΑΝΤΙΚΟ: Τα προηγούμενα αντίγραφα ασφαλείας που έχετε κάνει από το αρχείο του πορτοφόλιου σας θα πρέπει να αντικατασταθουν με το νέο που δημιουργείται, κρυπτογραφημένο αρχείο πορτοφόλιου. Για λόγους ασφαλείας, τα προηγούμενα αντίγραφα ασφαλείας του μη κρυπτογραφημένου αρχείου πορτοφόλιου θα καταστουν άχρηστα μόλις αρχίσετε να χρησιμοποιείτε το νέο κρυπτογραφημένο πορτοφόλι. </translation> </message> <message> <location line="+100"/> <location line="+24"/> <source>Warning: The Caps Lock key is on!</source> <translation>Προσοχη: το πλήκτρο Caps Lock είναι ενεργο.</translation> </message> <message> <location line="-130"/> <location line="+58"/> <source>Wallet encrypted</source> <translation>Κρυπτογραφημενο πορτοφολι</translation> </message> <message> <location line="-56"/> <source>Colossus will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your colossuss from being stolen by malware infecting your computer.</source> <translation>Το Colossus θα κλεισει τώρα για να τελειώσει την διαδικασία κρυπτογραφησης. Θυμησου ότι κρυπτογραφώντας το πορτοφολι σου δεν μπορείς να προστατέψεις πλήρως τα colossuss σου από κλοπή στην περίπτωση όπου μολυνθεί ο υπολογιστής σου με κακόβουλο λογισμικο.</translation> </message> <message> <location line="+13"/> <location line="+7"/> <location line="+42"/> <location line="+6"/> <source>Wallet encryption failed</source> <translation>Η κρυπτογραφηση του πορτοφολιού απέτυχε</translation> </message> <message> <location line="-54"/> <source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source> <translation>Η κρυπτογράφηση του πορτοφολιού απέτυχε λογω εσωτερικού σφάλματος. Το πορτοφολι δεν κρυπτογραφηθηκε.</translation> </message> <message> <location line="+7"/> <location line="+48"/> <source>The supplied passphrases do not match.</source> <translation>Οι εισαχθέντες κωδικοί δεν ταιριάζουν.</translation> </message> <message> <location line="-37"/> <source>Wallet unlock failed</source> <translation>το ξεκλείδωμα του πορτοφολιού απέτυχε</translation> </message> <message> <location line="+1"/> <location line="+11"/> <location line="+19"/> <source>The passphrase entered for the wallet decryption was incorrect.</source> <translation>Ο κωδικος που εισήχθη για την αποκρυπτογραφηση του πορτοφολιού ήταν λαθος.</translation> </message> <message> <location line="-20"/> <source>Wallet decryption failed</source> <translation>Η αποκρυπτογραφηση του πορτοφολιού απέτυχε</translation> </message> <message> <location line="+14"/> <source>Wallet passphrase was successfully changed.</source> <translation>Ο κωδικος του πορτοφολιού άλλαξε με επιτυχία.</translation> </message> </context> <context> <name>BitcoinGUI</name> <message> <location filename="../bitcoingui.cpp" line="+233"/> <source>Sign &amp;message...</source> <translation>Υπογραφή &amp;Μηνύματος...</translation> </message> <message> <location line="+280"/> <source>Synchronizing with network...</source> <translation>Συγχρονισμός με το δίκτυο...</translation> </message> <message> <location line="-349"/> <source>&amp;Overview</source> <translation>&amp;Επισκόπηση</translation> </message> <message> <location line="+1"/> <source>Show general overview of wallet</source> <translation>Εμφάνισε γενική εικονα του πορτοφολιού</translation> </message> <message> <location line="+20"/> <source>&amp;Transactions</source> <translation>&amp;Συναλλαγές</translation> </message> <message> <location line="+1"/> <source>Browse transaction history</source> <translation>Περιήγηση στο ιστορικο συνναλαγων</translation> </message> <message> <location line="+7"/> <source>Edit the list of stored addresses and labels</source> <translation>Εξεργασια της λιστας των αποθηκευμενων διευθύνσεων και ετικετων</translation> </message> <message> <location line="-14"/> <source>Show the list of addresses for receiving payments</source> <translation>Εμφάνισε την λίστα των διευθύνσεων για την παραλαβή πληρωμων</translation> </message> <message> <location line="+31"/> <source>E&amp;xit</source> <translation>Έ&amp;ξοδος</translation> </message> <message> <location line="+1"/> <source>Quit application</source> <translation>Εξοδος από την εφαρμογή</translation> </message> <message> <location line="+4"/> <source>Show information about Colossus</source> <translation>Εμφάνισε πληροφορίες σχετικά με το Colossus</translation> </message> <message> <location line="+2"/> <source>About &amp;Qt</source> <translation>Σχετικά με &amp;Qt</translation> </message> <message> <location line="+1"/> <source>Show information about Qt</source> <translation>Εμφάνισε πληροφορίες σχετικά με Qt</translation> </message> <message> <location line="+2"/> <source>&amp;Options...</source> <translation>&amp;Επιλογές...</translation> </message> <message> <location line="+6"/> <source>&amp;Encrypt Wallet...</source> <translation>&amp;Κρυπτογράφησε το πορτοφόλι</translation> </message> <message> <location line="+3"/> <source>&amp;Backup Wallet...</source> <translation>&amp;Αντίγραφο ασφαλείας του πορτοφολιού</translation> </message> <message> <location line="+2"/> <source>&amp;Change Passphrase...</source> <translation>&amp;Άλλαξε κωδικο πρόσβασης</translation> </message> <message> <location line="+285"/> <source>Importing blocks from disk...</source> <translation>Εισαγωγή μπλοκ από τον σκληρο δίσκο ... </translation> </message> <message> <location line="+3"/> <source>Reindexing blocks on disk...</source> <translation>Φόρτωση ευρετηρίου μπλοκ στον σκληρο δισκο...</translation> </message> <message> <location line="-347"/> <source>Send coins to a Colossus address</source> <translation>Στείλε νομισματα σε μια διεύθυνση colossus</translation> </message> <message> <location line="+49"/> <source>Modify configuration options for Colossus</source> <translation>Επεργασία ρυθμισεων επιλογών για το Colossus</translation> </message> <message> <location line="+9"/> <source>Backup wallet to another location</source> <translation>Δημιουργία αντιγράφου ασφαλείας πορτοφολιού σε άλλη τοποθεσία</translation> </message> <message> <location line="+2"/> <source>Change the passphrase used for wallet encryption</source> <translation>Αλλαγή του κωδικού κρυπτογράφησης του πορτοφολιού</translation> </message> <message> <location line="+6"/> <source>&amp;Debug window</source> <translation>&amp;Παράθυρο αποσφαλμάτωσης</translation> </message> <message> <location line="+1"/> <source>Open debugging and diagnostic console</source> <translation>Άνοιγμα κονσόλας αποσφαλμάτωσης και διαγνωστικών</translation> </message> <message> <location line="-4"/> <source>&amp;Verify message...</source> <translation>&amp;Επιβεβαίωση μηνύματος</translation> </message> <message> <location line="-165"/> <location line="+530"/> <source>Colossus</source> <translation>Colossus</translation> </message> <message> <location line="-530"/> <source>Wallet</source> <translation>Πορτοφόλι</translation> </message> <message> <location line="+101"/> <source>&amp;Send</source> <translation>&amp;Αποστολή</translation> </message> <message> <location line="+7"/> <source>&amp;Receive</source> <translation>&amp;Παραλαβή </translation> </message> <message> <location line="+14"/> <source>&amp;Addresses</source> <translation>&amp;Διεύθυνσεις</translation> </message> <message> <location line="+22"/> <source>&amp;About Colossus</source> <translation>&amp;Σχετικα:Colossus</translation> </message> <message> <location line="+9"/> <source>&amp;Show / Hide</source> <translation>&amp;Εμφάνισε/Κρύψε</translation> </message> <message> <location line="+1"/> <source>Show or hide the main Window</source> <translation>Εμφάνιση ή αποκρύψη του κεντρικου παράθυρου </translation> </message> <message> <location line="+3"/> <source>Encrypt the private keys that belong to your wallet</source> <translation>Κρυπτογραφήστε τα ιδιωτικά κλειδιά που ανήκουν στο πορτοφόλι σας </translation> </message> <message> <location line="+7"/> <source>Sign messages with your Colossus addresses to prove you own them</source> <translation>Υπογράψτε ένα μήνυμα για να βεβαιώσετε πως είστε ο κάτοχος αυτής της διεύθυνσης</translation> </message> <message> <location line="+2"/> <source>Verify messages to ensure they were signed with specified Colossus addresses</source> <translation>Υπογράψτε ένα μήνυμα για ν&apos; αποδείξετε πως ανήκει μια συγκεκριμένη διεύθυνση Colossus</translation> </message> <message> <location line="+28"/> <source>&amp;File</source> <translation>&amp;Αρχείο</translation> </message> <message> <location line="+7"/> <source>&amp;Settings</source> <translation>&amp;Ρυθμίσεις</translation> </message> <message> <location line="+6"/> <source>&amp;Help</source> <translation>&amp;Βοήθεια</translation> </message> <message> <location line="+9"/> <source>Tabs toolbar</source> <translation>Εργαλειοθήκη καρτελών</translation> </message> <message> <location line="+17"/> <location line="+10"/> <source>[testnet]</source> <translation>[testnet]</translation> </message> <message> <location line="+47"/> <source>Colossus client</source> <translation>Πελάτης Colossus</translation> </message> <message numerus="yes"> <location line="+141"/> <source>%n active connection(s) to Colossus network</source> <translation><numerusform>%n ενεργή σύνδεση στο δίκτυο Colossus</numerusform><numerusform>%n ενεργές συνδέσεις στο δίκτυο Βitcoin</numerusform></translation> </message> <message> <location line="+22"/> <source>No block source available...</source> <translation>Η πηγή του μπλοκ δεν ειναι διαθέσιμη... </translation> </message> <message> <location line="+12"/> <source>Processed %1 of %2 (estimated) blocks of transaction history.</source> <translation>Μεταποιημένα %1 απο % 2 (κατ &apos;εκτίμηση) μπλοκ της ιστορίας της συναλλαγής. </translation> </message> <message> <location line="+4"/> <source>Processed %1 blocks of transaction history.</source> <translation>Έγινε λήψη %1 μπλοκ ιστορικού συναλλαγών</translation> </message> <message numerus="yes"> <location line="+20"/> <source>%n hour(s)</source> <translation><numerusform>%n ώρες </numerusform><numerusform>%n ώρες </numerusform></translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n day(s)</source> <translation><numerusform>%n ημέρες </numerusform><numerusform>%n ημέρες </numerusform></translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n week(s)</source> <translation><numerusform>%n εβδομαδες</numerusform><numerusform>%n εβδομαδες</numerusform></translation> </message> <message> <location line="+4"/> <source>%1 behind</source> <translation>%1 πίσω</translation> </message> <message> <location line="+14"/> <source>Last received block was generated %1 ago.</source> <translation>Το τελευταίο μπλοκ που ελήφθη δημιουργήθηκε %1 πριν.</translation> </message> <message> <location line="+2"/> <source>Transactions after this will not yet be visible.</source> <translation>Οι συναλλαγές μετά από αυτό δεν θα είναι ακόμη ορατες.</translation> </message> <message> <location line="+22"/> <source>Error</source> <translation>Σφάλμα</translation> </message> <message> <location line="+3"/> <source>Warning</source> <translation>Προειδοποίηση</translation> </message> <message> <location line="+3"/> <source>Information</source> <translation>Πληροφορία</translation> </message> <message> <location line="+70"/> <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>Η συναλλαγή ξεπερνάει το όριο. Μπορεί να ολοκληρωθεί με μια αμοιβή των %1, η οποία αποδίδεται στους κόμβους που επεξεργάζονται τις συναλλαγές και βοηθούν στην υποστήριξη του δικτύου. Θέλετε να συνεχίσετε;</translation> </message> <message> <location line="-140"/> <source>Up to date</source> <translation>Ενημερωμένο</translation> </message> <message> <location line="+31"/> <source>Catching up...</source> <translation>Ενημέρωση...</translation> </message> <message> <location line="+113"/> <source>Confirm transaction fee</source> <translation>Επιβεβαίωση αμοιβής συναλλαγής</translation> </message> <message> <location line="+8"/> <source>Sent transaction</source> <translation>Η συναλλαγή απεστάλη</translation> </message> <message> <location line="+0"/> <source>Incoming transaction</source> <translation>Εισερχόμενη συναλλαγή</translation> </message> <message> <location line="+1"/> <source>Date: %1 Amount: %2 Type: %3 Address: %4 </source> <translation>Ημερομηνία: %1 Ποσό: %2 Τύπος: %3 Διεύθυνση: %4 </translation> </message> <message> <location line="+33"/> <location line="+23"/> <source>URI handling</source> <translation>Χειρισμός URI</translation> </message> <message> <location line="-23"/> <location line="+23"/> <source>URI can not be parsed! This can be caused by an invalid Colossus address or malformed URI parameters.</source> <translation>Το URI δεν μπορεί να αναλυθεί! Αυτό μπορεί να προκληθεί από μια μη έγκυρη διεύθυνση Colossus ή ακατάλληλη παραμέτρο URI.</translation> </message> <message> <location line="+17"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;unlocked&lt;/b&gt;</source> <translation>Το πορτοφόλι είναι &lt;b&gt;κρυπτογραφημένο&lt;/b&gt; και &lt;b&gt;ξεκλείδωτο&lt;/b&gt;</translation> </message> <message> <location line="+8"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;locked&lt;/b&gt;</source> <translation>Το πορτοφόλι είναι &lt;b&gt;κρυπτογραφημένο&lt;/b&gt; και &lt;b&gt;κλειδωμένο&lt;/b&gt;</translation> </message> <message> <location filename="../bitcoin.cpp" line="+111"/> <source>A fatal error occurred. Colossus can no longer continue safely and will quit.</source> <translation>Παρουσιάστηκε ανεπανόρθωτο σφάλμα. Το Colossus δεν μπορεί πλέον να συνεχίσει με ασφάλεια και θα τερματισθει.</translation> </message> </context> <context> <name>ClientModel</name> <message> <location filename="../clientmodel.cpp" line="+104"/> <source>Network Alert</source> <translation>Ειδοποίηση Δικτύου</translation> </message> </context> <context> <name>EditAddressDialog</name> <message> <location filename="../forms/editaddressdialog.ui" line="+14"/> <source>Edit Address</source> <translation>Επεξεργασία Διεύθυνσης</translation> </message> <message> <location line="+11"/> <source>&amp;Label</source> <translation>&amp;Επιγραφή</translation> </message> <message> <location line="+10"/> <source>The label associated with this address book entry</source> <translation>Η επιγραφή που σχετίζεται με αυτή την καταχώρηση του βιβλίου διευθύνσεων</translation> </message> <message> <location line="+7"/> <source>&amp;Address</source> <translation>&amp;Διεύθυνση</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>Η διεύθυνση που σχετίζεται με αυτή την καταχώρηση του βιβλίου διευθύνσεων. Μπορεί να τροποποιηθεί μόνο για τις διευθύνσεις αποστολής.</translation> </message> <message> <location filename="../editaddressdialog.cpp" line="+21"/> <source>New receiving address</source> <translation>Νέα διεύθυνση λήψης</translation> </message> <message> <location line="+4"/> <source>New sending address</source> <translation>Νέα διεύθυνση αποστολής</translation> </message> <message> <location line="+3"/> <source>Edit receiving address</source> <translation>Επεξεργασία διεύθυνσης λήψης</translation> </message> <message> <location line="+4"/> <source>Edit sending address</source> <translation>Επεξεργασία διεύθυνσης αποστολής</translation> </message> <message> <location line="+76"/> <source>The entered address &quot;%1&quot; is already in the address book.</source> <translation>Η διεύθυνση &quot;%1&quot; βρίσκεται ήδη στο βιβλίο διευθύνσεων.</translation> </message> <message> <location line="-5"/> <source>The entered address &quot;%1&quot; is not a valid Colossus address.</source> <translation>Η διεύθυνση &quot;%1&quot; δεν είναι έγκυρη Colossus διεύθυνση.</translation> </message> <message> <location line="+10"/> <source>Could not unlock wallet.</source> <translation>Δεν είναι δυνατό το ξεκλείδωμα του πορτοφολιού.</translation> </message> <message> <location line="+5"/> <source>New key generation failed.</source> <translation>Η δημιουργία νέου κλειδιού απέτυχε.</translation> </message> </context> <context> <name>GUIUtil::HelpMessageBox</name> <message> <location filename="../guiutil.cpp" line="+424"/> <location line="+12"/> <source>Colossus-Qt</source> <translation>colossus-qt</translation> </message> <message> <location line="-12"/> <source>version</source> <translation>έκδοση</translation> </message> <message> <location line="+2"/> <source>Usage:</source> <translation>Χρήση:</translation> </message> <message> <location line="+1"/> <source>command-line options</source> <translation>επιλογής γραμμής εντολών</translation> </message> <message> <location line="+4"/> <source>UI options</source> <translation>επιλογές UI</translation> </message> <message> <location line="+1"/> <source>Set language, for example &quot;de_DE&quot; (default: system locale)</source> <translation>Όρισε γλώσσα, για παράδειγμα &quot;de_DE&quot;(προεπιλογή:τοπικές ρυθμίσεις)</translation> </message> <message> <location line="+1"/> <source>Start minimized</source> <translation>Έναρξη ελαχιστοποιημένο</translation> </message> <message> <location line="+1"/> <source>Show splash screen on startup (default: 1)</source> <translation>Εμφάνισε την οθόνη εκκίνησης κατά την εκκίνηση(προεπιλογή:1)</translation> </message> </context> <context> <name>OptionsDialog</name> <message> <location filename="../forms/optionsdialog.ui" line="+14"/> <source>Options</source> <translation>Ρυθμίσεις</translation> </message> <message> <location line="+16"/> <source>&amp;Main</source> <translation>&amp;Κύριο</translation> </message> <message> <location line="+6"/> <source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB.</source> <translation>Η προαιρετική αμοιβή για κάθε kB επισπεύδει την επεξεργασία των συναλλαγών σας. Οι περισσότερες συναλλαγές είναι 1 kB. </translation> </message> <message> <location line="+15"/> <source>Pay transaction &amp;fee</source> <translation>Αμοιβή &amp;συναλλαγής</translation> </message> <message> <location line="+31"/> <source>Automatically start Colossus after logging in to the system.</source> <translation>Αυτόματη εκκίνηση του Colossus μετά την εισαγωγή στο σύστημα</translation> </message> <message> <location line="+3"/> <source>&amp;Start Colossus on system login</source> <translation>&amp;Έναρξη του Βιtcoin κατά την εκκίνηση του συστήματος</translation> </message> <message> <location line="+35"/> <source>Reset all client options to default.</source> <translation>Επαναφορα όλων των επιλογων του πελάτη σε default.</translation> </message> <message> <location line="+3"/> <source>&amp;Reset Options</source> <translation>Επαναφορα ρυθμίσεων</translation> </message> <message> <location line="+13"/> <source>&amp;Network</source> <translation>&amp;Δίκτυο</translation> </message> <message> <location line="+6"/> <source>Automatically open the Colossus client port on the router. This only works when your router supports UPnP and it is enabled.</source> <translation>Αυτόματο άνοιγμα των θυρών Colossus στον δρομολογητή. Λειτουργεί μόνο αν ο δρομολογητής σας υποστηρίζει τη λειτουργία UPnP.</translation> </message> <message> <location line="+3"/> <source>Map port using &amp;UPnP</source> <translation>Απόδοση θυρών με χρήστη &amp;UPnP</translation> </message> <message> <location line="+7"/> <source>Connect to the Colossus network through a SOCKS proxy (e.g. when connecting through Tor).</source> <translation>Σύνδεση στο Colossus δίκτυο μέσω διαμεσολαβητή SOCKS4 (π.χ. για σύνδεση μέσω Tor)</translation> </message> <message> <location line="+3"/> <source>&amp;Connect through SOCKS proxy:</source> <translation>&amp;Σύνδεση μέσω διαμεσολαβητή SOCKS</translation> </message> <message> <location line="+9"/> <source>Proxy &amp;IP:</source> <translation>&amp;IP διαμεσολαβητή:</translation> </message> <message> <location line="+19"/> <source>IP address of the proxy (e.g. 127.0.0.1)</source> <translation>Διεύθυνση IP του διαμεσολαβητή (π.χ. 127.0.0.1)</translation> </message> <message> <location line="+7"/> <source>&amp;Port:</source> <translation>&amp;Θύρα:</translation> </message> <message> <location line="+19"/> <source>Port of the proxy (e.g. 9050)</source> <translation>Θύρα διαμεσολαβητή</translation> </message> <message> <location line="+7"/> <source>SOCKS &amp;Version:</source> <translation>SOCKS &amp;Έκδοση:</translation> </message> <message> <location line="+13"/> <source>SOCKS version of the proxy (e.g. 5)</source> <translation>SOCKS εκδοση του διαμεσολαβητη (e.g. 5)</translation> </message> <message> <location line="+36"/> <source>&amp;Window</source> <translation>&amp;Παράθυρο</translation> </message> <message> <location line="+6"/> <source>Show only a tray icon after minimizing the window.</source> <translation>Εμφάνιση μόνο εικονιδίου στην περιοχή ειδοποιήσεων κατά την ελαχιστοποίηση</translation> </message> <message> <location line="+3"/> <source>&amp;Minimize to the tray instead of the taskbar</source> <translation>&amp;Ελαχιστοποίηση στην περιοχή ειδοποιήσεων αντί της γραμμής εργασιών</translation> </message> <message> <location line="+7"/> <source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.</source> <translation>Ελαχιστοποίηση αντί για έξοδο κατά το κλείσιμο του παραθύρου</translation> </message> <message> <location line="+3"/> <source>M&amp;inimize on close</source> <translation>Ε&amp;λαχιστοποίηση κατά το κλείσιμο</translation> </message> <message> <location line="+21"/> <source>&amp;Display</source> <translation>%Απεικόνιση</translation> </message> <message> <location line="+8"/> <source>User Interface &amp;language:</source> <translation>Γλώσσα περιβάλλοντος εργασίας: </translation> </message> <message> <location line="+13"/> <source>The user interface language can be set here. This setting will take effect after restarting Colossus.</source> <translation>Εδώ μπορεί να ρυθμιστεί η γλώσσα διεπαφής χρήστη. Αυτή η ρύθμιση θα ισχύσει μετά την επανεκκίνηση του Colossus.</translation> </message> <message> <location line="+11"/> <source>&amp;Unit to show amounts in:</source> <translation>&amp;Μονάδα μέτρησης:</translation> </message> <message> <location line="+13"/> <source>Choose the default subdivision unit to show in the interface and when sending coins.</source> <translation>Διαλέξτε την προεπιλεγμένη υποδιαίρεση που θα εμφανίζεται όταν στέλνετε νομίσματα.</translation> </message> <message> <location line="+9"/> <source>Whether to show Colossus addresses in the transaction list or not.</source> <translation>Επιλέξτε αν θέλετε να εμφανίζονται οι διευθύνσεις Colossus στη λίστα συναλλαγών.</translation> </message> <message> <location line="+3"/> <source>&amp;Display addresses in transaction list</source> <translation>Εμφάνιση διευθύνσεων στη λίστα συναλλαγών</translation> </message> <message> <location line="+71"/> <source>&amp;OK</source> <translation>&amp;ΟΚ</translation> </message> <message> <location line="+7"/> <source>&amp;Cancel</source> <translation>&amp;Ακύρωση</translation> </message> <message> <location line="+10"/> <source>&amp;Apply</source> <translation>&amp;Εφαρμογή</translation> </message> <message> <location filename="../optionsdialog.cpp" line="+53"/> <source>default</source> <translation>προεπιλογή</translation> </message> <message> <location line="+130"/> <source>Confirm options reset</source> <translation>Επιβεβαιώση των επιλογων επαναφοράς </translation> </message> <message> <location line="+1"/> <source>Some settings may require a client restart to take effect.</source> <translation>Για ορισμένες ρυθμίσεις πρεπει η επανεκκίνηση να τεθεί σε ισχύ.</translation> </message> <message> <location line="+0"/> <source>Do you want to proceed?</source> <translation>Θέλετε να προχωρήσετε;</translation> </message> <message> <location line="+42"/> <location line="+9"/> <source>Warning</source> <translation>Προειδοποίηση</translation> </message> <message> <location line="-9"/> <location line="+9"/> <source>This setting will take effect after restarting Colossus.</source> <translation>Αυτή η ρύθμιση θα ισχύσει μετά την επανεκκίνηση του Colossus.</translation> </message> <message> <location line="+29"/> <source>The supplied proxy address is invalid.</source> <translation>Δεν είναι έγκυρη η διεύθυνση διαμεσολαβητή</translation> </message> </context> <context> <name>OverviewPage</name> <message> <location filename="../forms/overviewpage.ui" line="+14"/> <source>Form</source> <translation>Φόρμα</translation> </message> <message> <location line="+50"/> <location line="+166"/> <source>The displayed information may be out of date. Your wallet automatically synchronizes with the Colossus network after a connection is established, but this process has not completed yet.</source> <translation>Οι πληροφορίες που εμφανίζονται μπορεί να είναι ξεπερασμένες. Το πορτοφόλι σας συγχρονίζεται αυτόματα με το δίκτυο Colossus μετά από μια σύνδεση, αλλά αυτή η διαδικασία δεν έχει ακόμη ολοκληρωθεί. </translation> </message> <message> <location line="-124"/> <source>Balance:</source> <translation>Υπόλοιπο</translation> </message> <message> <location line="+29"/> <source>Unconfirmed:</source> <translation>Ανεπιβεβαίωτες</translation> </message> <message> <location line="-78"/> <source>Wallet</source> <translation>Πορτοφόλι</translation> </message> <message> <location line="+107"/> <source>Immature:</source> <translation>Ανώριμος</translation> </message> <message> <location line="+13"/> <source>Mined balance that has not yet matured</source> <translation>Εξορυγμενο υπόλοιπο που δεν έχει ακόμα ωριμάσει </translation> </message> <message> <location line="+46"/> <source>&lt;b&gt;Recent transactions&lt;/b&gt;</source> <translation>&lt;b&gt;Πρόσφατες συναλλαγές&lt;/b&gt;</translation> </message> <message> <location line="-101"/> <source>Your current balance</source> <translation>Το τρέχον υπόλοιπο</translation> </message> <message> <location line="+29"/> <source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source> <translation>Το άθροισμα των συναλλαγών που δεν έχουν ακόμα επιβεβαιωθεί και δεν προσμετρώνται στο τρέχον υπόλοιπό σας</translation> </message> <message> <location filename="../overviewpage.cpp" line="+116"/> <location line="+1"/> <source>out of sync</source> <translation>εκτός συγχρονισμού</translation> </message> </context> <context> <name>PaymentServer</name> <message> <location filename="../paymentserver.cpp" line="+107"/> <source>Cannot start colossus: click-to-pay handler</source> <translation>Δεν είναι δυνατή η εκκίνηση του Colossus: click-to-pay handler</translation> </message> </context> <context> <name>QRCodeDialog</name> <message> <location filename="../forms/qrcodedialog.ui" line="+14"/> <source>QR Code Dialog</source> <translation>Κώδικας QR</translation> </message> <message> <location line="+59"/> <source>Request Payment</source> <translation>Αίτηση πληρωμής</translation> </message> <message> <location line="+56"/> <source>Amount:</source> <translation>Ποσό:</translation> </message> <message> <location line="-44"/> <source>Label:</source> <translation>Επιγραφή:</translation> </message> <message> <location line="+19"/> <source>Message:</source> <translation>Μήνυμα:</translation> </message> <message> <location line="+71"/> <source>&amp;Save As...</source> <translation>&amp;Αποθήκευση ως...</translation> </message> <message> <location filename="../qrcodedialog.cpp" line="+62"/> <source>Error encoding URI into QR Code.</source> <translation>Σφάλμα κατά την κωδικοποίηση του URI σε κώδικα QR</translation> </message> <message> <location line="+40"/> <source>The entered amount is invalid, please check.</source> <translation>Το αναγραφόμενο ποσό δεν είναι έγκυρο, παρακαλούμε να το ελέγξετε.</translation> </message> <message> <location line="+23"/> <source>Resulting URI too long, try to reduce the text for label / message.</source> <translation>Το αποτέλεσμα της διεύθυνσης είναι πολύ μεγάλο. Μειώστε το μέγεθος για το κείμενο της ετικέτας/ μηνύματος.</translation> </message> <message> <location line="+25"/> <source>Save QR Code</source> <translation>Αποθήκευση κώδικα QR</translation> </message> <message> <location line="+0"/> <source>PNG Images (*.png)</source> <translation>Εικόνες PNG (*.png)</translation> </message> </context> <context> <name>RPCConsole</name> <message> <location filename="../forms/rpcconsole.ui" line="+46"/> <source>Client name</source> <translation>Όνομα Πελάτη</translation> </message> <message> <location line="+10"/> <location line="+23"/> <location line="+26"/> <location line="+23"/> <location line="+23"/> <location line="+36"/> <location line="+53"/> <location line="+23"/> <location line="+23"/> <location filename="../rpcconsole.cpp" line="+339"/> <source>N/A</source> <translation>Μη διαθέσιμο</translation> </message> <message> <location line="-217"/> <source>Client version</source> <translation>Έκδοση Πελάτη</translation> </message> <message> <location line="-45"/> <source>&amp;Information</source> <translation>&amp;Πληροφορία</translation> </message> <message> <location line="+68"/> <source>Using OpenSSL version</source> <translation>Χρησιμοποιηση της OpenSSL εκδοσης</translation> </message> <message> <location line="+49"/> <source>Startup time</source> <translation>Χρόνος εκκίνησης</translation> </message> <message> <location line="+29"/> <source>Network</source> <translation>Δίκτυο</translation> </message> <message> <location line="+7"/> <source>Number of connections</source> <translation>Αριθμός συνδέσεων</translation> </message> <message> <location line="+23"/> <source>On testnet</source> <translation>Στο testnet</translation> </message> <message> <location line="+23"/> <source>Block chain</source> <translation>αλυσίδα εμποδισμού</translation> </message> <message> <location line="+7"/> <source>Current number of blocks</source> <translation>Τρέχον αριθμός μπλοκ</translation> </message> <message> <location line="+23"/> <source>Estimated total blocks</source> <translation>Κατ&apos; εκτίμηση συνολικά μπλοκς</translation> </message> <message> <location line="+23"/> <source>Last block time</source> <translation>Χρόνος τελευταίου μπλοκ</translation> </message> <message> <location line="+52"/> <source>&amp;Open</source> <translation>&amp;Άνοιγμα</translation> </message> <message> <location line="+16"/> <source>Command-line options</source> <translation>επιλογής γραμμής εντολών</translation> </message> <message> <location line="+7"/> <source>Show the Colossus-Qt help message to get a list with possible Colossus command-line options.</source> <translation>Εμφανιση του Colossus-Qt μήνυματος βοήθειας για να πάρετε μια λίστα με τις πιθανές επιλογές Colossus γραμμής εντολών.</translation> </message> <message> <location line="+3"/> <source>&amp;Show</source> <translation>&amp;Εμφάνιση</translation> </message> <message> <location line="+24"/> <source>&amp;Console</source> <translation>&amp;Κονσόλα</translation> </message> <message> <location line="-260"/> <source>Build date</source> <translation>Ημερομηνία κατασκευής</translation> </message> <message> <location line="-104"/> <source>Colossus - Debug window</source> <translation>Colossus - Παράθυρο αποσφαλμάτωσης</translation> </message> <message> <location line="+25"/> <source>Colossus Core</source> <translation>Colossus Core</translation> </message> <message> <location line="+279"/> <source>Debug log file</source> <translation>Αρχείο καταγραφής εντοπισμού σφαλμάτων </translation> </message> <message> <location line="+7"/> <source>Open the Colossus debug log file from the current data directory. This can take a few seconds for large log files.</source> <translation>Ανοίξτε το αρχείο καταγραφής εντοπισμού σφαλμάτων από τον τρέχοντα κατάλογο δεδομένων. Αυτό μπορεί να πάρει μερικά δευτερόλεπτα για τα μεγάλα αρχεία καταγραφής. </translation> </message> <message> <location line="+102"/> <source>Clear console</source> <translation>Καθαρισμός κονσόλας</translation> </message> <message> <location filename="../rpcconsole.cpp" line="-30"/> <source>Welcome to the Colossus RPC console.</source> <translation>Καλώς ήρθατε στην Colossus RPC κονσόλα.</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>Χρησιμοποιήστε το πάνω και κάτω βέλος για να περιηγηθείτε στο ιστορικο, και &lt;b&gt;Ctrl-L&lt;/b&gt; για εκκαθαριση οθονης.</translation> </message> <message> <location line="+1"/> <source>Type &lt;b&gt;help&lt;/b&gt; for an overview of available commands.</source> <translation>Γράψτε &lt;b&gt;βοήθεια&lt;/b&gt; για μια επισκόπηση των διαθέσιμων εντολών</translation> </message> </context> <context> <name>SendCoinsDialog</name> <message> <location filename="../forms/sendcoinsdialog.ui" line="+14"/> <location filename="../sendcoinsdialog.cpp" line="+124"/> <location line="+5"/> <location line="+5"/> <location line="+5"/> <location line="+6"/> <location line="+5"/> <location line="+5"/> <source>Send Coins</source> <translation>Αποστολή νομισμάτων</translation> </message> <message> <location line="+50"/> <source>Send to multiple recipients at once</source> <translation>Αποστολή σε πολλούς αποδέκτες ταυτόχρονα</translation> </message> <message> <location line="+3"/> <source>Add &amp;Recipient</source> <translation>&amp;Προσθήκη αποδέκτη</translation> </message> <message> <location line="+20"/> <source>Remove all transaction fields</source> <translation>Διαγραφή όλων των πεδίων συναλλαγής</translation> </message> <message> <location line="+3"/> <source>Clear &amp;All</source> <translation>Καθαρισμός &amp;Όλων</translation> </message> <message> <location line="+22"/> <source>Balance:</source> <translation>Υπόλοιπο:</translation> </message> <message> <location line="+10"/> <source>123.456 BTC</source> <translation>123,456 BTC</translation> </message> <message> <location line="+31"/> <source>Confirm the send action</source> <translation>Επιβεβαίωση αποστολής</translation> </message> <message> <location line="+3"/> <source>S&amp;end</source> <translation>Αποστολη</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="-59"/> <source>&lt;b&gt;%1&lt;/b&gt; to %2 (%3)</source> <translation>&lt;b&gt;%1&lt;/b&gt; σε %2 (%3)</translation> </message> <message> <location line="+5"/> <source>Confirm send coins</source> <translation>Επιβεβαίωση αποστολής νομισμάτων</translation> </message> <message> <location line="+1"/> <source>Are you sure you want to send %1?</source> <translation>Είστε βέβαιοι για την αποστολή %1;</translation> </message> <message> <location line="+0"/> <source> and </source> <translation>και</translation> </message> <message> <location line="+23"/> <source>The recipient address is not valid, please recheck.</source> <translation>Η διεύθυνση του αποδέκτη δεν είναι σωστή. Παρακαλώ ελέγξτε ξανά.</translation> </message> <message> <location line="+5"/> <source>The amount to pay must be larger than 0.</source> <translation>Το ποσό πληρωμής πρέπει να είναι μεγαλύτερο από 0.</translation> </message> <message> <location line="+5"/> <source>The amount exceeds your balance.</source> <translation>Το ποσό ξεπερνάει το διαθέσιμο υπόλοιπο</translation> </message> <message> <location line="+5"/> <source>The total exceeds your balance when the %1 transaction fee is included.</source> <translation>Το σύνολο υπερβαίνει το υπόλοιπό σας όταν συμπεριληφθεί και η αμοιβή %1</translation> </message> <message> <location line="+6"/> <source>Duplicate address found, can only send to each address once per send operation.</source> <translation>Βρέθηκε η ίδια διεύθυνση δύο φορές. Επιτρέπεται μία μόνο εγγραφή για κάθε διεύθυνση, σε κάθε διαδικασία αποστολής.</translation> </message> <message> <location line="+5"/> <source>Error: Transaction creation failed!</source> <translation>Σφάλμα: Η δημιουργία της συναλλαγής απέτυχε</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>Σφάλμα: Η συναλλαγή απερρίφθη. Αυτό ενδέχεται να συμβαίνει αν κάποια από τα νομίσματα έχουν ήδη ξοδευθεί, όπως αν χρησιμοποιήσατε αντίγραφο του wallet.dat και τα νομίσματα ξοδεύθηκαν εκεί.</translation> </message> </context> <context> <name>SendCoinsEntry</name> <message> <location filename="../forms/sendcoinsentry.ui" line="+14"/> <source>Form</source> <translation>Φόρμα</translation> </message> <message> <location line="+15"/> <source>A&amp;mount:</source> <translation>&amp;Ποσό:</translation> </message> <message> <location line="+13"/> <source>Pay &amp;To:</source> <translation>Πληρωμή &amp;σε:</translation> </message> <message> <location line="+34"/> <source>The address to send the payment to (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source> <translation>Διεύθυνση αποστολής της πληρωμής (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation> </message> <message> <location line="+60"/> <location filename="../sendcoinsentry.cpp" line="+26"/> <source>Enter a label for this address to add it to your address book</source> <translation>Εισάγετε μια επιγραφή για αυτή τη διεύθυνση ώστε να καταχωρηθεί στο βιβλίο διευθύνσεων</translation> </message> <message> <location line="-78"/> <source>&amp;Label:</source> <translation>&amp;Επιγραφή</translation> </message> <message> <location line="+28"/> <source>Choose address from address book</source> <translation>Επιλογή διεύθυνσης από το βιβλίο διευθύνσεων</translation> </message> <message> <location line="+10"/> <source>Alt+A</source> <translation>Alt+A</translation> </message> <message> <location line="+7"/> <source>Paste address from clipboard</source> <translation>Επικόλληση διεύθυνσης από το πρόχειρο</translation> </message> <message> <location line="+10"/> <source>Alt+P</source> <translation>Alt+P</translation> </message> <message> <location line="+7"/> <source>Remove this recipient</source> <translation>Αφαίρεση αποδέκτη</translation> </message> <message> <location filename="../sendcoinsentry.cpp" line="+1"/> <source>Enter a Colossus address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source> <translation>Εισάγετε μια διεύθυνση Colossus (π.χ. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation> </message> </context> <context> <name>SignVerifyMessageDialog</name> <message> <location filename="../forms/signverifymessagedialog.ui" line="+14"/> <source>Signatures - Sign / Verify a Message</source> <translation>Υπογραφές - Είσοδος / Επαλήθευση μήνυματος </translation> </message> <message> <location line="+13"/> <source>&amp;Sign Message</source> <translation>&amp;Υπογραφή Μηνύματος</translation> </message> <message> <location line="+6"/> <source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source> <translation>Μπορείτε να υπογράφετε μηνύματα με τις διευθύνσεις σας, ώστε ν&apos; αποδεικνύετε πως αυτές σας ανήκουν. Αποφεύγετε να υπογράφετε κάτι αόριστο καθώς ενδέχεται να εξαπατηθείτε. Υπογράφετε μόνο πλήρης δηλώσεις με τις οποίες συμφωνείτε.</translation> </message> <message> <location line="+18"/> <source>The address to sign the message with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source> <translation>Εισάγετε μια διεύθυνση Colossus (π.χ. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation> </message> <message> <location line="+10"/> <location line="+213"/> <source>Choose an address from the address book</source> <translation>Επιλογή διεύθυνσης από το βιβλίο διευθύνσεων</translation> </message> <message> <location line="-203"/> <location line="+213"/> <source>Alt+A</source> <translation>Alt+A</translation> </message> <message> <location line="-203"/> <source>Paste address from clipboard</source> <translation>Επικόλληση διεύθυνσης από το βιβλίο διευθύνσεων</translation> </message> <message> <location line="+10"/> <source>Alt+P</source> <translation>Alt+P</translation> </message> <message> <location line="+12"/> <source>Enter the message you want to sign here</source> <translation>Εισάγετε εδώ το μήνυμα που θέλετε να υπογράψετε</translation> </message> <message> <location line="+7"/> <source>Signature</source> <translation>Υπογραφή</translation> </message> <message> <location line="+27"/> <source>Copy the current signature to the system clipboard</source> <translation>Αντέγραφη της επιλεγμενης διεύθυνσης στο πρόχειρο του συστηματος</translation> </message> <message> <location line="+21"/> <source>Sign the message to prove you own this Colossus address</source> <translation>Υπογράψτε ένα μήνυμα για ν&apos; αποδείξετε πως σας ανήκει μια συγκεκριμένη διεύθυνση Colossus</translation> </message> <message> <location line="+3"/> <source>Sign &amp;Message</source> <translation>Υπογραφη μήνυματος</translation> </message> <message> <location line="+14"/> <source>Reset all sign message fields</source> <translation>Επαναφορά όλων των πεδίων μήνυματος</translation> </message> <message> <location line="+3"/> <location line="+146"/> <source>Clear &amp;All</source> <translation>Καθαρισμός &amp;Όλων</translation> </message> <message> <location line="-87"/> <source>&amp;Verify Message</source> <translation>&amp;Επιβεβαίωση μηνύματος</translation> </message> <message> <location line="+6"/> <source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source> <translation>Πληκτρολογήστε την υπογραφή διεύθυνσης, μήνυμα (βεβαιωθείτε ότι έχετε αντιγράψει τις αλλαγές γραμμής, κενά, tabs, κ.λπ. ακριβώς) και την υπογραφή παρακάτω, για να ελέγξει το μήνυμα. Να είστε προσεκτικοί για να μην διαβάσετε περισσότερα στην υπογραφή ό, τι είναι στην υπογραφή ίδιο το μήνυμα , για να μην εξαπατηθούν από έναν άνθρωπο -in - the-middle επίθεση.</translation> </message> <message> <location line="+21"/> <source>The address the message was signed with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source> <translation>Εισάγετε μια διεύθυνση Colossus (π.χ. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation> </message> <message> <location line="+40"/> <source>Verify the message to ensure it was signed with the specified Colossus address</source> <translation>Υπογράψτε ένα μήνυμα για ν&apos; αποδείξετε πως υπογραφθηκε απο μια συγκεκριμένη διεύθυνση Colossus</translation> </message> <message> <location line="+3"/> <source>Verify &amp;Message</source> <translation>Επιβεβαίωση μηνύματος</translation> </message> <message> <location line="+14"/> <source>Reset all verify message fields</source> <translation>Επαναφορά όλων επαλήθευμενων πεδίων μήνυματος </translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="+27"/> <location line="+3"/> <source>Enter a Colossus address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source> <translation>Εισάγετε μια διεύθυνση Colossus (π.χ. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation> </message> <message> <location line="-2"/> <source>Click &quot;Sign Message&quot; to generate signature</source> <translation>Κάντε κλικ στο &quot;Υπογραφή Μηνύματος&quot; για να λάβετε την υπογραφή</translation> </message> <message> <location line="+3"/> <source>Enter Colossus signature</source> <translation>Εισαγωγή υπογραφής Colossus</translation> </message> <message> <location line="+82"/> <location line="+81"/> <source>The entered address is invalid.</source> <translation>Η διεύθυνση που εισήχθη είναι λάθος.</translation> </message> <message> <location line="-81"/> <location line="+8"/> <location line="+73"/> <location line="+8"/> <source>Please check the address and try again.</source> <translation>Παρακαλούμε ελέγξτε την διεύθυνση και δοκιμάστε ξανά.</translation> </message> <message> <location line="-81"/> <location line="+81"/> <source>The entered address does not refer to a key.</source> <translation>Η διεύθυνση που έχει εισαχθεί δεν αναφέρεται σε ένα πλήκτρο.</translation> </message> <message> <location line="-73"/> <source>Wallet unlock was cancelled.</source> <translation>το ξεκλείδωμα του πορτοφολιού απέτυχε</translation> </message> <message> <location line="+8"/> <source>Private key for the entered address is not available.</source> <translation>Το προσωπικό κλειδί εισαγμενης διευθυνσης δεν είναι διαθέσιμο.</translation> </message> <message> <location line="+12"/> <source>Message signing failed.</source> <translation>Η υπογραφή του μηνύματος απέτυχε.</translation> </message> <message> <location line="+5"/> <source>Message signed.</source> <translation>Μήνυμα υπεγράφη.</translation> </message> <message> <location line="+59"/> <source>The signature could not be decoded.</source> <translation>Η υπογραφή δεν μπόρεσε να αποκρυπτογραφηθεί.</translation> </message> <message> <location line="+0"/> <location line="+13"/> <source>Please check the signature and try again.</source> <translation>Παρακαλούμε ελέγξτε την υπογραφή και δοκιμάστε ξανά.</translation> </message> <message> <location line="+0"/> <source>The signature did not match the message digest.</source> <translation>Η υπογραφή δεν ταιριάζει με το μήνυμα. </translation> </message> <message> <location line="+7"/> <source>Message verification failed.</source> <translation>Η επιβεβαίωση του μηνύματος απέτυχε</translation> </message> <message> <location line="+5"/> <source>Message verified.</source> <translation>Μήνυμα επιβεβαιώθηκε.</translation> </message> </context> <context> <name>SplashScreen</name> <message> <location filename="../splashscreen.cpp" line="+22"/> <source>The Colossus developers</source> <translation>Οι Colossus προγραμματιστές </translation> </message> <message> <location line="+1"/> <source>[testnet]</source> <translation>[testnet]</translation> </message> </context> <context> <name>TransactionDesc</name> <message> <location filename="../transactiondesc.cpp" line="+20"/> <source>Open until %1</source> <translation>Ανοιχτό μέχρι %1</translation> </message> <message> <location line="+6"/> <source>%1/offline</source> <translation>%1/χωρίς σύνδεση;</translation> </message> <message> <location line="+2"/> <source>%1/unconfirmed</source> <translation>%1/χωρίς επιβεβαίωση</translation> </message> <message> <location line="+2"/> <source>%1 confirmations</source> <translation>%1 επιβεβαιώσεις</translation> </message> <message> <location line="+18"/> <source>Status</source> <translation>Κατάσταση</translation> </message> <message numerus="yes"> <location line="+7"/> <source>, broadcast through %n node(s)</source> <translation><numerusform>, έχει μεταδοθεί μέσω %n κόμβων</numerusform><numerusform>, έχει μεταδοθεί μέσω %n κόμβων</numerusform></translation> </message> <message> <location line="+4"/> <source>Date</source> <translation>Ημερομηνία</translation> </message> <message> <location line="+7"/> <source>Source</source> <translation>Πηγή</translation> </message> <message> <location line="+0"/> <source>Generated</source> <translation>Δημιουργία </translation> </message> <message> <location line="+5"/> <location line="+17"/> <source>From</source> <translation>Από</translation> </message> <message> <location line="+1"/> <location line="+22"/> <location line="+58"/> <source>To</source> <translation>Προς</translation> </message> <message> <location line="-77"/> <location line="+2"/> <source>own address</source> <translation> δική σας διεύθυνση </translation> </message> <message> <location line="-2"/> <source>label</source> <translation>eπιγραφή</translation> </message> <message> <location line="+37"/> <location line="+12"/> <location line="+45"/> <location line="+17"/> <location line="+30"/> <source>Credit</source> <translation>Πίστωση </translation> </message> <message numerus="yes"> <location line="-102"/> <source>matures in %n more block(s)</source> <translation><numerusform>ωρίμανση σε %n επιπλέον μπλοκ</numerusform><numerusform>ωρίμανση σε %n επιπλέον μπλοκ</numerusform></translation> </message> <message> <location line="+2"/> <source>not accepted</source> <translation>μη αποδεκτό</translation> </message> <message> <location line="+44"/> <location line="+8"/> <location line="+15"/> <location line="+30"/> <source>Debit</source> <translation>Debit</translation> </message> <message> <location line="-39"/> <source>Transaction fee</source> <translation>Τέλος συναλλαγής </translation> </message> <message> <location line="+16"/> <source>Net amount</source> <translation>Καθαρό ποσό</translation> </message> <message> <location line="+6"/> <source>Message</source> <translation>Μήνυμα</translation> </message> <message> <location line="+2"/> <source>Comment</source> <translation>Σχόλιο:</translation> </message> <message> <location line="+2"/> <source>Transaction ID</source> <translation>ID Συναλλαγής:</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>Πρέπει να περιμένετε 120 μπλοκ πριν μπορέσετε να χρησιμοποιήσετε τα νομίσματα που έχετε δημιουργήσει. Το μπλοκ που δημιουργήσατε μεταδόθηκε στο δίκτυο για να συμπεριληφθεί στην αλυσίδα των μπλοκ. Αν δεν μπει σε αυτή θα μετατραπεί σε &quot;μη αποδεκτό&quot; και δε θα μπορεί να καταναλωθεί. Αυτό συμβαίνει σπάνια όταν κάποιος άλλος κόμβος δημιουργήσει ένα μπλοκ λίγα δευτερόλεπτα πριν από εσάς.</translation> </message> <message> <location line="+7"/> <source>Debug information</source> <translation>Πληροφορίες αποσφαλμάτωσης</translation> </message> <message> <location line="+8"/> <source>Transaction</source> <translation>Συναλλαγή</translation> </message> <message> <location line="+3"/> <source>Inputs</source> <translation>εισροές </translation> </message> <message> <location line="+23"/> <source>Amount</source> <translation>Ποσό</translation> </message> <message> <location line="+1"/> <source>true</source> <translation>αληθής</translation> </message> <message> <location line="+0"/> <source>false</source> <translation>αναληθής </translation> </message> <message> <location line="-209"/> <source>, has not been successfully broadcast yet</source> <translation>, δεν έχει ακόμα μεταδοθεί μ&apos; επιτυχία</translation> </message> <message numerus="yes"> <location line="-35"/> <source>Open for %n more block(s)</source> <translation><numerusform>Ανοιχτό για %n μπλοκ</numerusform><numerusform>Ανοιχτό για %n μπλοκ</numerusform></translation> </message> <message> <location line="+70"/> <source>unknown</source> <translation>άγνωστο</translation> </message> </context> <context> <name>TransactionDescDialog</name> <message> <location filename="../forms/transactiondescdialog.ui" line="+14"/> <source>Transaction details</source> <translation>Λεπτομέρειες συναλλαγής</translation> </message> <message> <location line="+6"/> <source>This pane shows a detailed description of the transaction</source> <translation>Αυτό το παράθυρο δείχνει μια λεπτομερή περιγραφή της συναλλαγής</translation> </message> </context> <context> <name>TransactionTableModel</name> <message> <location filename="../transactiontablemodel.cpp" line="+225"/> <source>Date</source> <translation>Ημερομηνία</translation> </message> <message> <location line="+0"/> <source>Type</source> <translation>Τύπος</translation> </message> <message> <location line="+0"/> <source>Address</source> <translation>Διεύθυνση</translation> </message> <message> <location line="+0"/> <source>Amount</source> <translation>Ποσό</translation> </message> <message numerus="yes"> <location line="+57"/> <source>Open for %n more block(s)</source> <translation><numerusform>Ανοιχτό για %n μπλοκ</numerusform><numerusform>Ανοιχτό για %n μπλοκ</numerusform></translation> </message> <message> <location line="+3"/> <source>Open until %1</source> <translation>Ανοιχτό μέχρι %1</translation> </message> <message> <location line="+3"/> <source>Offline (%1 confirmations)</source> <translation>Χωρίς σύνδεση (%1 επικυρώσεις)</translation> </message> <message> <location line="+3"/> <source>Unconfirmed (%1 of %2 confirmations)</source> <translation>Χωρίς επιβεβαίωση (%1 από %2 επικυρώσεις)</translation> </message> <message> <location line="+3"/> <source>Confirmed (%1 confirmations)</source> <translation>Επικυρωμένη (%1 επικυρώσεις)</translation> </message> <message numerus="yes"> <location line="+8"/> <source>Mined balance will be available when it matures in %n more block(s)</source> <translation><numerusform>Το υπόλοιπο από την εξόρυξη θα είναι διαθέσιμο μετά από %n μπλοκ</numerusform><numerusform>Το υπόλοιπο από την εξόρυξη θα είναι διαθέσιμο μετά από %n μπλοκ</numerusform></translation> </message> <message> <location line="+5"/> <source>This block was not received by any other nodes and will probably not be accepted!</source> <translation>Αυτό το μπλοκ δεν έχει παραληφθεί από κανέναν άλλο κόμβο και κατά πάσα πιθανότητα θα απορριφθεί!</translation> </message> <message> <location line="+3"/> <source>Generated but not accepted</source> <translation>Δημιουργήθηκε αλλά απορρίφθηκε</translation> </message> <message> <location line="+43"/> <source>Received with</source> <translation>Παραλαβή με</translation> </message> <message> <location line="+2"/> <source>Received from</source> <translation>Ελήφθη από</translation> </message> <message> <location line="+3"/> <source>Sent to</source> <translation>Αποστολή προς</translation> </message> <message> <location line="+2"/> <source>Payment to yourself</source> <translation>Πληρωμή προς εσάς</translation> </message> <message> <location line="+2"/> <source>Mined</source> <translation>Εξόρυξη</translation> </message> <message> <location line="+38"/> <source>(n/a)</source> <translation>(δ/α)</translation> </message> <message> <location line="+199"/> <source>Transaction status. Hover over this field to show number of confirmations.</source> <translation>Κατάσταση συναλλαγής. Πηγαίνετε το ποντίκι πάνω από αυτό το πεδίο για να δείτε τον αριθμό των επικυρώσεων</translation> </message> <message> <location line="+2"/> <source>Date and time that the transaction was received.</source> <translation>Ημερομηνία κι ώρα λήψης της συναλλαγής.</translation> </message> <message> <location line="+2"/> <source>Type of transaction.</source> <translation>Είδος συναλλαγής.</translation> </message> <message> <location line="+2"/> <source>Destination address of transaction.</source> <translation>Διεύθυνση αποστολής της συναλλαγής.</translation> </message> <message> <location line="+2"/> <source>Amount removed from or added to balance.</source> <translation>Ποσό που αφαιρέθηκε ή προστέθηκε στο υπόλοιπο.</translation> </message> </context> <context> <name>TransactionView</name> <message> <location filename="../transactionview.cpp" line="+52"/> <location line="+16"/> <source>All</source> <translation>Όλα</translation> </message> <message> <location line="-15"/> <source>Today</source> <translation>Σήμερα</translation> </message> <message> <location line="+1"/> <source>This week</source> <translation>Αυτή την εβδομάδα</translation> </message> <message> <location line="+1"/> <source>This month</source> <translation>Αυτόν τον μήνα</translation> </message> <message> <location line="+1"/> <source>Last month</source> <translation>Τον προηγούμενο μήνα</translation> </message> <message> <location line="+1"/> <source>This year</source> <translation>Αυτό το έτος</translation> </message> <message> <location line="+1"/> <source>Range...</source> <translation>Έκταση...</translation> </message> <message> <location line="+11"/> <source>Received with</source> <translation>Ελήφθη με</translation> </message> <message> <location line="+2"/> <source>Sent to</source> <translation>Απεστάλη προς</translation> </message> <message> <location line="+2"/> <source>To yourself</source> <translation>Προς εσάς</translation> </message> <message> <location line="+1"/> <source>Mined</source> <translation>Εξόρυξη</translation> </message> <message> <location line="+1"/> <source>Other</source> <translation>Άλλο</translation> </message> <message> <location line="+7"/> <source>Enter address or label to search</source> <translation>Αναζήτηση με βάση τη διεύθυνση ή την επιγραφή</translation> </message> <message> <location line="+7"/> <source>Min amount</source> <translation>Ελάχιστο ποσό</translation> </message> <message> <location line="+34"/> <source>Copy address</source> <translation>Αντιγραφή διεύθυνσης</translation> </message> <message> <location line="+1"/> <source>Copy label</source> <translation>Αντιγραφή επιγραφής</translation> </message> <message> <location line="+1"/> <source>Copy amount</source> <translation>Αντιγραφή ποσού</translation> </message> <message> <location line="+1"/> <source>Copy transaction ID</source> <translation>Αντιγραφη του ID Συναλλαγής</translation> </message> <message> <location line="+1"/> <source>Edit label</source> <translation>Επεξεργασία επιγραφής</translation> </message> <message> <location line="+1"/> <source>Show transaction details</source> <translation>Εμφάνιση λεπτομερειών συναλλαγής</translation> </message> <message> <location line="+139"/> <source>Export Transaction Data</source> <translation>Εξαγωγή Στοιχείων Συναλλαγών</translation> </message> <message> <location line="+1"/> <source>Comma separated file (*.csv)</source> <translation>Αρχείο οριοθετημένο με κόμματα (*.csv)</translation> </message> <message> <location line="+8"/> <source>Confirmed</source> <translation>Επικυρωμένες</translation> </message> <message> <location line="+1"/> <source>Date</source> <translation>Ημερομηνία</translation> </message> <message> <location line="+1"/> <source>Type</source> <translation>Τύπος</translation> </message> <message> <location line="+1"/> <source>Label</source> <translation>Επιγραφή</translation> </message> <message> <location line="+1"/> <source>Address</source> <translation>Διεύθυνση</translation> </message> <message> <location line="+1"/> <source>Amount</source> <translation>Ποσό</translation> </message> <message> <location line="+1"/> <source>ID</source> <translation>ID</translation> </message> <message> <location line="+4"/> <source>Error exporting</source> <translation>Σφάλμα εξαγωγής</translation> </message> <message> <location line="+0"/> <source>Could not write to file %1.</source> <translation>Αδυναμία εγγραφής στο αρχείο %1.</translation> </message> <message> <location line="+100"/> <source>Range:</source> <translation>Έκταση:</translation> </message> <message> <location line="+8"/> <source>to</source> <translation>έως</translation> </message> </context> <context> <name>WalletModel</name> <message> <location filename="../walletmodel.cpp" line="+193"/> <source>Send Coins</source> <translation>Αποστολή νομισμάτων</translation> </message> </context> <context> <name>WalletView</name> <message> <location filename="../walletview.cpp" line="+42"/> <source>&amp;Export</source> <translation>&amp;Εξαγωγή</translation> </message> <message> <location line="+1"/> <source>Export the data in the current tab to a file</source> <translation>Εξαγωγή δεδομένων καρτέλας σε αρχείο</translation> </message> <message> <location line="+193"/> <source>Backup Wallet</source> <translation>Αντίγραφο ασφαλείας του πορτοφολιού</translation> </message> <message> <location line="+0"/> <source>Wallet Data (*.dat)</source> <translation>Αρχεία δεδομένων πορτοφολιού (*.dat)</translation> </message> <message> <location line="+3"/> <source>Backup Failed</source> <translation>Αποτυχία κατά τη δημιουργία αντιγράφου</translation> </message> <message> <location line="+0"/> <source>There was an error trying to save the wallet data to the new location.</source> <translation>Παρουσιάστηκε σφάλμα κατά την αποθήκευση των δεδομένων πορτοφολιού στη νέα τοποθεσία.</translation> </message> <message> <location line="+4"/> <source>Backup Successful</source> <translation>Η δημιουργια αντιγραφου ασφαλειας πετυχε</translation> </message> <message> <location line="+0"/> <source>The wallet data was successfully saved to the new location.</source> <translation>Τα δεδομένα πορτοφόλιου αποθηκεύτηκαν με επιτυχία στη νέα θέση. </translation> </message> </context> <context> <name>bitcoin-core</name> <message> <location filename="../bitcoinstrings.cpp" line="+94"/> <source>Colossus version</source> <translation>Έκδοση Colossus</translation> </message> <message> <location line="+102"/> <source>Usage:</source> <translation>Χρήση:</translation> </message> <message> <location line="-29"/> <source>Send command to -server or colossusd</source> <translation>Αποστολή εντολής στον εξυπηρετητή ή στο colossusd</translation> </message> <message> <location line="-23"/> <source>List commands</source> <translation>Λίστα εντολών</translation> </message> <message> <location line="-12"/> <source>Get help for a command</source> <translation>Επεξήγηση εντολής</translation> </message> <message> <location line="+24"/> <source>Options:</source> <translation>Επιλογές:</translation> </message> <message> <location line="+24"/> <source>Specify configuration file (default: colossus.conf)</source> <translation>Ορίστε αρχείο ρυθμίσεων (προεπιλογή: colossus.conf)</translation> </message> <message> <location line="+3"/> <source>Specify pid file (default: colossusd.pid)</source> <translation>Ορίστε αρχείο pid (προεπιλογή: colossusd.pid)</translation> </message> <message> <location line="-1"/> <source>Specify data directory</source> <translation>Ορισμός φακέλου δεδομένων</translation> </message> <message> <location line="-9"/> <source>Set database cache size in megabytes (default: 25)</source> <translation>Όρισε το μέγεθος της βάσης προσωρινής αποθήκευσης σε megabytes(προεπιλογή:25)</translation> </message> <message> <location line="-28"/> <source>Listen for connections on &lt;port&gt; (default: 8500 or testnet: 18000)</source> <translation>Εισερχόμενες συνδέσεις στη θύρα &lt;port&gt; (προεπιλογή: 8500 ή στο testnet: 18000)</translation> </message> <message> <location line="+5"/> <source>Maintain at most &lt;n&gt; connections to peers (default: 125)</source> <translation>Μέγιστες αριθμός συνδέσεων με τους peers &lt;n&gt; (προεπιλογή: 125)</translation> </message> <message> <location line="-48"/> <source>Connect to a node to retrieve peer addresses, and disconnect</source> <translation>Σύνδεση σε έναν κόμβο για την ανάκτηση διευθύνσεων από ομοτίμους, και αποσυνδέσh</translation> </message> <message> <location line="+82"/> <source>Specify your own public address</source> <translation>Διευκρινίστε τη δικιά σας δημόσια διεύθυνση.</translation> </message> <message> <location line="+3"/> <source>Threshold for disconnecting misbehaving peers (default: 100)</source> <translation>Όριο αποσύνδεσης προβληματικών peers (προεπιλογή: 100)</translation> </message> <message> <location line="-134"/> <source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source> <translation>Δευτερόλεπτα πριν επιτραπεί ξανά η σύνδεση των προβληματικών peers (προεπιλογή: 86400)</translation> </message> <message> <location line="-29"/> <source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source> <translation>Ένα σφάλμα συνέβη καθώς προετοιμαζόταν η πόρτα RPC %u για αναμονή IPv4: %s</translation> </message> <message> <location line="+27"/> <source>Listen for JSON-RPC connections on &lt;port&gt; (default: 20120 or testnet: 17300)</source> <translation>Εισερχόμενες συνδέσεις JSON-RPC στη θύρα &lt;port&gt; (προεπιλογή: 20120 or testnet: 17300)</translation> </message> <message> <location line="+37"/> <source>Accept command line and JSON-RPC commands</source> <translation>Αποδοχή εντολών κονσόλας και JSON-RPC</translation> </message> <message> <location line="+76"/> <source>Run in the background as a daemon and accept commands</source> <translation>Εκτέλεση στο παρασκήνιο κι αποδοχή εντολών</translation> </message> <message> <location line="+37"/> <source>Use the test network</source> <translation>Χρήση του δοκιμαστικού δικτύου</translation> </message> <message> <location line="-112"/> <source>Accept connections from outside (default: 1 if no -proxy or -connect)</source> <translation>Να δέχεσαι συνδέσεις από έξω(προεπιλογή:1)</translation> </message> <message> <location line="-80"/> <source>%s, you must set a rpcpassword in the configuration file: %s It is recommended you use the following random password: rpcuser=colossusrpc 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;Colossus Alert&quot; admin@foo.com </source> <translation>%s, you must set a rpcpassword in the configuration file: %s It is recommended you use the following random password: rpcuser=colossusrpc 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;Colossus Alert&quot; admin@foo.com </translation> </message> <message> <location line="+17"/> <source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source> <translation>Ένα σφάλμα συνέβη καθώς προετοιμαζόταν η υποδοχη RPC %u για αναμονη του IPv6, επεσε πισω στο IPv4:%s</translation> </message> <message> <location line="+3"/> <source>Bind to given address and always listen on it. Use [host]:port notation for IPv6</source> <translation>Αποθηκευση σε συγκεκριμένη διεύθυνση. Χρησιμοποιήστε τα πλήκτρα [Host] : συμβολισμός θύρα για IPv6</translation> </message> <message> <location line="+3"/> <source>Cannot obtain a lock on data directory %s. Colossus is probably already running.</source> <translation>Αδυναμία κλειδώματος του φακέλου δεδομένων %s. Πιθανώς το Colossus να είναι ήδη ενεργό.</translation> </message> <message> <location line="+3"/> <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>Σφάλμα: Η συναλλαγή απορρίφθηκε. Αυτό ίσως οφείλεται στο ότι τα νομίσματά σας έχουν ήδη ξοδευτεί, π.χ. με την αντιγραφή του wallet.dat σε άλλο σύστημα και την χρήση τους εκεί, χωρίς η συναλλαγή να έχει καταγραφεί στο παρόν σύστημα.</translation> </message> <message> <location line="+4"/> <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>Σφάλμα: Αυτή η συναλλαγή απαιτεί αμοιβή συναλλαγής τουλάχιστον %s λόγω του μεγέθους, πολυπλοκότητας ή της χρήσης πρόσφατης παραλαβής κεφαλαίου</translation> </message> <message> <location line="+3"/> <source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source> <translation>Εκτέλεση της εντολής όταν το καλύτερο μπλοκ αλλάξει(%s στην εντολή αντικαθίσταται από το hash του μπλοκ)</translation> </message> <message> <location line="+3"/> <source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source> <translation>Εκτέλεσε την εντολή όταν το καλύτερο μπλοκ αλλάξει(%s στην εντολή αντικαθίσταται από το hash του μπλοκ)</translation> </message> <message> <location line="+11"/> <source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source> <translation>Ορίστε το μέγιστο μέγεθος των high-priority/low-fee συναλλαγων σε bytes (προεπιλογή: 27000)</translation> </message> <message> <location line="+6"/> <source>This is a pre-release test build - use at your own risk - do not use for mining or merchant applications</source> <translation>Αυτό είναι ένα προ-τεστ κυκλοφορίας - χρησιμοποιήστε το με δική σας ευθύνη - δεν χρησιμοποιείτε για εξόρυξη ή για αλλες εφαρμογές</translation> </message> <message> <location line="+5"/> <source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source> <translation>Προειδοποίηση: Η παράμετρος -paytxfee είναι πολύ υψηλή. Πρόκειται για την αμοιβή που θα πληρώνετε για κάθε συναλλαγή που θα στέλνετε.</translation> </message> <message> <location line="+3"/> <source>Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.</source> <translation>Προειδοποίηση: Εμφανίσεις συναλλαγων δεν μπορεί να είναι σωστες! Μπορεί να χρειαστεί να αναβαθμίσετε, ή άλλοι κόμβοι μπορεί να χρειαστεί να αναβαθμίστουν. </translation> </message> <message> <location line="+3"/> <source>Warning: Please check that your computer&apos;s date and time are correct! If your clock is wrong Colossus will not work properly.</source> <translation>Προειδοποίηση: Παρακαλώ βεβαιωθείτε πως η ημερομηνία κι ώρα του συστήματός σας είναι σωστές. Αν το ρολόι του υπολογιστή σας πάει λάθος, ενδέχεται να μη λειτουργεί σωστά το Colossus.</translation> </message> <message> <location line="+3"/> <source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source> <translation>Προειδοποίηση : Σφάλμα wallet.dat κατα την ανάγνωση ! Όλα τα κλειδιά αναγνωρισθηκαν σωστά, αλλά τα δεδομένα των συναλλαγών ή καταχωρήσεις στο βιβλίο διευθύνσεων μπορεί να είναι ελλιπείς ή λανθασμένα. </translation> </message> <message> <location line="+3"/> <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>Προειδοποίηση : το αρχειο wallet.dat ειναι διεφθαρμένο, τα δεδομένα σώζονται ! Original wallet.dat αποθηκεύονται ως πορτοφόλι { timestamp } bak στο % s ? . . Αν το υπόλοιπο του ή τις συναλλαγές σας, είναι λάθος θα πρέπει να επαναφέρετε από ένα αντίγραφο ασφαλείας</translation> </message> <message> <location line="+14"/> <source>Attempt to recover private keys from a corrupt wallet.dat</source> <translation>Προσπάθεια για ανακτησει ιδιωτικων κλειδιων από ενα διεφθαρμένο αρχειο wallet.dat </translation> </message> <message> <location line="+2"/> <source>Block creation options:</source> <translation>Αποκλεισμός επιλογων δημιουργίας: </translation> </message> <message> <location line="+5"/> <source>Connect only to the specified node(s)</source> <translation>Σύνδεση μόνο με ορισμένους κόμβους</translation> </message> <message> <location line="+3"/> <source>Corrupted block database detected</source> <translation>Εντοπισθηκε διεφθαρμενη βαση δεδομενων των μπλοκ</translation> </message> <message> <location line="+1"/> <source>Discover own IP address (default: 1 when listening and no -externalip)</source> <translation>Ανακαλύψτε την δικη σας IP διεύθυνση (προεπιλογή: 1 όταν ακούει και δεν - externalip) </translation> </message> <message> <location line="+1"/> <source>Do you want to rebuild the block database now?</source> <translation>Θελετε να δημιουργηθει τωρα η βαση δεδομενων του μπλοκ? </translation> </message> <message> <location line="+2"/> <source>Error initializing block database</source> <translation>Σφάλμα κατά την ενεργοποίηση της βάσης δεδομένων μπλοκ</translation> </message> <message> <location line="+1"/> <source>Error initializing wallet database environment %s!</source> <translation>Σφάλμα κατά την ενεργοποίηση της βάσης δεδομένων πορτοφόλιου %s!</translation> </message> <message> <location line="+1"/> <source>Error loading block database</source> <translation>Σφάλμα φορτωσης της βασης δεδομενων των μπλοκ</translation> </message> <message> <location line="+4"/> <source>Error opening block database</source> <translation>Σφάλμα φορτωσης της βασης δεδομενων των μπλοκ</translation> </message> <message> <location line="+2"/> <source>Error: Disk space is low!</source> <translation>Προειδοποίηση: Χαμηλός χώρος στο δίσκο </translation> </message> <message> <location line="+1"/> <source>Error: Wallet locked, unable to create transaction!</source> <translation>Σφάλμα: το πορτοφόλι είναι κλειδωμένο, δεν μπορεί να δημιουργηθεί συναλλαγή</translation> </message> <message> <location line="+1"/> <source>Error: system error: </source> <translation>Λάθος: λάθος συστήματος:</translation> </message> <message> <location line="+1"/> <source>Failed to listen on any port. Use -listen=0 if you want this.</source> <translation>ταλαιπωρηθειτε για να ακούσετε σε οποιαδήποτε θύρα. Χρήση - ακούστε = 0 , αν θέλετε αυτό.</translation> </message> <message> <location line="+1"/> <source>Failed to read block info</source> <translation>Αποτυχία αναγνωσης των block πληροφοριων</translation> </message> <message> <location line="+1"/> <source>Failed to read block</source> <translation>Η αναγνωση του μπλοκ απετυχε</translation> </message> <message> <location line="+1"/> <source>Failed to sync block index</source> <translation>Ο συγχρονισμος του μπλοκ ευρετηριου απετυχε</translation> </message> <message> <location line="+1"/> <source>Failed to write block index</source> <translation>Η δημιουργια του μπλοκ ευρετηριου απετυχε</translation> </message> <message> <location line="+1"/> <source>Failed to write block info</source> <translation>Η δημιουργια των μπλοκ πληροφοριων απετυχε</translation> </message> <message> <location line="+1"/> <source>Failed to write block</source> <translation>Η δημιουργια του μπλοκ απετυχε</translation> </message> <message> <location line="+1"/> <source>Failed to write file info</source> <translation>Αδυναμία εγγραφής πληροφοριων αρχειου</translation> </message> <message> <location line="+1"/> <source>Failed to write to coin database</source> <translation>Αποτυχία εγγραφής στη βάση δεδομένων νομίσματος</translation> </message> <message> <location line="+1"/> <source>Failed to write transaction index</source> <translation>Αποτυχία εγγραφής δείκτη συναλλαγών </translation> </message> <message> <location line="+1"/> <source>Failed to write undo data</source> <translation>Αποτυχία εγγραφής αναίρεσης δεδομένων </translation> </message> <message> <location line="+2"/> <source>Find peers using DNS lookup (default: 1 unless -connect)</source> <translation>Βρες ομότιμους υπολογιστές χρησιμοποιώντας αναζήτηση DNS(προεπιλογή:1)</translation> </message> <message> <location line="+1"/> <source>Generate coins (default: 0)</source> <translation>Δημιουργία νομισμάτων (προκαθορισμος: 0)</translation> </message> <message> <location line="+2"/> <source>How many blocks to check at startup (default: 288, 0 = all)</source> <translation>Πόσα μπλοκ να ελέγχθουν κατά την εκκίνηση (προεπιλογή:288,0=όλα)</translation> </message> <message> <location line="+1"/> <source>How thorough the block verification is (0-4, default: 3)</source> <translation>Πόσο εξονυχιστική να είναι η επιβεβαίωση του μπλοκ(0-4, προεπιλογή:3)</translation> </message> <message> <location line="+19"/> <source>Not enough file descriptors available.</source> <translation>Δεν ειναι αρκετες περιγραφες αρχείων διαθέσιμες.</translation> </message> <message> <location line="+8"/> <source>Rebuild block chain index from current blk000??.dat files</source> <translation>Εισαγωγή μπλοκ από εξωτερικό αρχείο blk000?.dat</translation> </message> <message> <location line="+16"/> <source>Set the number of threads to service RPC calls (default: 4)</source> <translation>Ορίσμος του αριθμόυ θεματων στην υπηρεσία κλήσεων RPC (προεπιλογή: 4) </translation> </message> <message> <location line="+26"/> <source>Verifying blocks...</source> <translation>Επαλήθευση των μπλοκ... </translation> </message> <message> <location line="+1"/> <source>Verifying wallet...</source> <translation>Επαλήθευση πορτοφολιου... </translation> </message> <message> <location line="-69"/> <source>Imports blocks from external blk000??.dat file</source> <translation>Εισαγωγή μπλοκ από εξωτερικό αρχείο blk000?.dat</translation> </message> <message> <location line="-76"/> <source>Set the number of script verification threads (up to 16, 0 = auto, &lt;0 = leave that many cores free, default: 0)</source> <translation>Ορίσμος του αριθμό των νημάτων ελέγχου σεναρίου (μέχρι 16, 0 = auto, &lt;0 = αφήνουν τους πολλους πυρήνες δωρεάν, default: 0)</translation> </message> <message> <location line="+77"/> <source>Information</source> <translation>Πληροφορία</translation> </message> <message> <location line="+3"/> <source>Invalid -tor address: &apos;%s&apos;</source> <translation>Δεν είναι έγκυρη η διεύθυνση διαμεσολαβητή: &apos;%s&apos;</translation> </message> <message> <location line="+1"/> <source>Invalid amount for -minrelaytxfee=&lt;amount&gt;: &apos;%s&apos;</source> <translation>Μη έγκυρο ποσό για την παράμετρο -paytxfee=&lt;amount&gt;: &apos;%s&apos;</translation> </message> <message> <location line="+1"/> <source>Invalid amount for -mintxfee=&lt;amount&gt;: &apos;%s&apos;</source> <translation>Μη έγκυρο ποσό για την παράμετρο -paytxfee=&lt;amount&gt;: &apos;%s&apos;</translation> </message> <message> <location line="+8"/> <source>Maintain a full transaction index (default: 0)</source> <translation>Διατηρήση ένος πλήρες ευρετήριου συναλλαγών (προεπιλογή: 0) </translation> </message> <message> <location line="+2"/> <source>Maximum per-connection receive buffer, &lt;n&gt;*1000 bytes (default: 5000)</source> <translation>Μέγιστος buffer λήψης ανά σύνδεση, &lt;n&gt;*1000 bytes (προεπιλογή: 5000)</translation> </message> <message> <location line="+1"/> <source>Maximum per-connection send buffer, &lt;n&gt;*1000 bytes (default: 1000)</source> <translation>Μέγιστος buffer αποστολής ανά σύνδεση, &lt;n&gt;*1000 bytes (προεπιλογή: 1000)</translation> </message> <message> <location line="+2"/> <source>Only accept block chain matching built-in checkpoints (default: 1)</source> <translation>Μονο αποδοχη αλυσίδας μπλοκ που ταιριάζει με τα ενσωματωμένα σημεία ελέγχου (προεπιλογή: 1) </translation> </message> <message> <location line="+1"/> <source>Only connect to nodes in network &lt;net&gt; (IPv4, IPv6 or Tor)</source> <translation> Συνδέση μόνο σε κόμβους του δικτύου &lt;net&gt; (IPv4, IPv6 ή Tor) </translation> </message> <message> <location line="+2"/> <source>Output extra debugging information. Implies all other -debug* options</source> <translation>Έξοδος επιπλέον πληροφοριών εντοπισμού σφαλμάτων</translation> </message> <message> <location line="+1"/> <source>Output extra network debugging information</source> <translation>Έξοδος επιπλέον πληροφοριών εντοπισμού σφαλμάτων</translation> </message> <message> <location line="+2"/> <source>Prepend debug output with timestamp</source> <translation>Χρονοσφραγίδα πληροφοριών εντοπισμού σφαλμάτων</translation> </message> <message> <location line="+5"/> <source>SSL options: (see the Colossus Wiki for SSL setup instructions)</source> <translation>Ρυθμίσεις SSL: (ανατρέξτε στο Colossus Wiki για οδηγίες ρυθμίσεων SSL)</translation> </message> <message> <location line="+1"/> <source>Select the version of socks proxy to use (4-5, default: 5)</source> <translation>Επιλέξτε την έκδοση του διαμεσολαβητη για να χρησιμοποιήσετε (4-5 , προεπιλογή: 5)</translation> </message> <message> <location line="+3"/> <source>Send trace/debug info to console instead of debug.log file</source> <translation>Αποστολή πληροφοριών εντοπισμού σφαλμάτων στην κονσόλα αντί του αρχείου debug.log</translation> </message> <message> <location line="+1"/> <source>Send trace/debug info to debugger</source> <translation>Αποστολή πληροφοριών εντοπισμού σφαλμάτων στον debugger</translation> </message> <message> <location line="+5"/> <source>Set maximum block size in bytes (default: 250000)</source> <translation>Ορίσμος του μέγιστου μέγεθος block σε bytes (προεπιλογή: 250000)</translation> </message> <message> <location line="+1"/> <source>Set minimum block size in bytes (default: 0)</source> <translation>Ορίστε το μέγιστο μέγεθος block σε bytes (προεπιλογή: 0)</translation> </message> <message> <location line="+2"/> <source>Shrink debug.log file on client startup (default: 1 when no -debug)</source> <translation>Συρρίκνωση του αρχείο debug.log κατα την εκκίνηση του πελάτη (προεπιλογή: 1 όταν δεν-debug)</translation> </message> <message> <location line="+1"/> <source>Signing transaction failed</source> <translation>Η υπογραφή συναλλαγής απέτυχε </translation> </message> <message> <location line="+2"/> <source>Specify connection timeout in milliseconds (default: 5000)</source> <translation>Ορισμός λήξης χρονικού ορίου σε χιλιοστά του δευτερολέπτου(προεπιλογή:5000)</translation> </message> <message> <location line="+4"/> <source>System error: </source> <translation>Λάθος Συστήματος:</translation> </message> <message> <location line="+4"/> <source>Transaction amount too small</source> <translation>Το ποσό της συναλλαγής είναι πολύ μικρο </translation> </message> <message> <location line="+1"/> <source>Transaction amounts must be positive</source> <translation>Τα ποσά των συναλλαγών πρέπει να είναι θετικα</translation> </message> <message> <location line="+1"/> <source>Transaction too large</source> <translation>Η συναλλαγή ειναι πολύ μεγάλη </translation> </message> <message> <location line="+7"/> <source>Use UPnP to map the listening port (default: 0)</source> <translation>Χρησιμοποίηση του UPnP για την χρήση της πόρτας αναμονής (προεπιλογή:0)</translation> </message> <message> <location line="+1"/> <source>Use UPnP to map the listening port (default: 1 when listening)</source> <translation>Χρησιμοποίηση του UPnP για την χρήση της πόρτας αναμονής (προεπιλογή:1)</translation> </message> <message> <location line="+1"/> <source>Use proxy to reach tor hidden services (default: same as -proxy)</source> <translation>Χρήση διακομιστή μεσολάβησης για την επίτευξη των Tor κρυμμένων υπηρεσιων (προεπιλογή: ίδιο με το-proxy) </translation> </message> <message> <location line="+2"/> <source>Username for JSON-RPC connections</source> <translation>Όνομα χρήστη για τις συνδέσεις JSON-RPC</translation> </message> <message> <location line="+4"/> <source>Warning</source> <translation>Προειδοποίηση</translation> </message> <message> <location line="+1"/> <source>Warning: This version is obsolete, upgrade required!</source> <translation>Προειδοποίηση: Αυτή η έκδοση είναι ξεπερασμένη, απαιτείται αναβάθμιση </translation> </message> <message> <location line="+1"/> <source>You need to rebuild the databases using -reindex to change -txindex</source> <translation>Θα πρέπει να ξαναχτίστουν οι βάσεις δεδομένων που χρησιμοποιούντε-Αναδημιουργία αλλάγων-txindex </translation> </message> <message> <location line="+1"/> <source>wallet.dat corrupt, salvage failed</source> <translation>Το αρχειο wallet.dat ειναι διεφθαρμένο, η διάσωση απέτυχε</translation> </message> <message> <location line="-50"/> <source>Password for JSON-RPC connections</source> <translation>Κωδικός για τις συνδέσεις JSON-RPC</translation> </message> <message> <location line="-67"/> <source>Allow JSON-RPC connections from specified IP address</source> <translation>Αποδοχή συνδέσεων JSON-RPC από συγκεκριμένη διεύθυνση IP</translation> </message> <message> <location line="+76"/> <source>Send commands to node running on &lt;ip&gt; (default: 127.0.0.1)</source> <translation>Αποστολή εντολών στον κόμβο &lt;ip&gt; (προεπιλογή: 127.0.0.1)</translation> </message> <message> <location line="-120"/> <source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source> <translation>Εκτέλεσε την εντολή όταν το καλύτερο μπλοκ αλλάξει(%s στην εντολή αντικαθίσταται από το hash του μπλοκ)</translation> </message> <message> <location line="+147"/> <source>Upgrade wallet to latest format</source> <translation>Αναβάθμισε το πορτοφόλι στην τελευταία έκδοση</translation> </message> <message> <location line="-21"/> <source>Set key pool size to &lt;n&gt; (default: 100)</source> <translation>Όριο πλήθους κλειδιών pool &lt;n&gt; (προεπιλογή: 100)</translation> </message> <message> <location line="-12"/> <source>Rescan the block chain for missing wallet transactions</source> <translation>Επανέλεγχος της αλυσίδας μπλοκ για απούσες συναλλαγές</translation> </message> <message> <location line="+35"/> <source>Use OpenSSL (https) for JSON-RPC connections</source> <translation>Χρήση του OpenSSL (https) για συνδέσεις JSON-RPC</translation> </message> <message> <location line="-26"/> <source>Server certificate file (default: server.cert)</source> <translation>Αρχείο πιστοποιητικού του διακομιστή (προεπιλογή: server.cert)</translation> </message> <message> <location line="+1"/> <source>Server private key (default: server.pem)</source> <translation>Προσωπικό κλειδί του διακομιστή (προεπιλογή: server.pem)</translation> </message> <message> <location line="-151"/> <source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source> <translation>Αποδεκτά κρυπτογραφήματα (προεπιλογή: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</translation> </message> <message> <location line="+165"/> <source>This help message</source> <translation>Αυτό το κείμενο βοήθειας</translation> </message> <message> <location line="+6"/> <source>Unable to bind to %s on this computer (bind returned error %d, %s)</source> <translation>Αδύνατη η σύνδεση με τη θύρα %s αυτού του υπολογιστή (bind returned error %d, %s) </translation> </message> <message> <location line="-91"/> <source>Connect through socks proxy</source> <translation>Σύνδεση μέσω διαμεσολαβητή socks</translation> </message> <message> <location line="-10"/> <source>Allow DNS lookups for -addnode, -seednode and -connect</source> <translation>Να επιτρέπονται οι έλεγχοι DNS για προσθήκη και σύνδεση κόμβων</translation> </message> <message> <location line="+55"/> <source>Loading addresses...</source> <translation>Φόρτωση διευθύνσεων...</translation> </message> <message> <location line="-35"/> <source>Error loading wallet.dat: Wallet corrupted</source> <translation>Σφάλμα φόρτωσης wallet.dat: Κατεστραμμένο Πορτοφόλι</translation> </message> <message> <location line="+1"/> <source>Error loading wallet.dat: Wallet requires newer version of Colossus</source> <translation>Σφάλμα φόρτωσης wallet.dat: Το Πορτοφόλι απαιτεί μια νεότερη έκδοση του Colossus</translation> </message> <message> <location line="+93"/> <source>Wallet needed to be rewritten: restart Colossus to complete</source> <translation>Απαιτείται η επανεγγραφή του Πορτοφολιού, η οποία θα ολοκληρωθεί στην επανεκκίνηση του Colossus</translation> </message> <message> <location line="-95"/> <source>Error loading wallet.dat</source> <translation>Σφάλμα φόρτωσης αρχείου wallet.dat</translation> </message> <message> <location line="+28"/> <source>Invalid -proxy address: &apos;%s&apos;</source> <translation>Δεν είναι έγκυρη η διεύθυνση διαμεσολαβητή: &apos;%s&apos;</translation> </message> <message> <location line="+56"/> <source>Unknown network specified in -onlynet: &apos;%s&apos;</source> <translation>Άγνωστo δίκτυο ορίζεται σε onlynet: &apos;%s&apos;</translation> </message> <message> <location line="-1"/> <source>Unknown -socks proxy version requested: %i</source> <translation>Άγνωστo δίκτυο ορίζεται: %i</translation> </message> <message> <location line="-96"/> <source>Cannot resolve -bind address: &apos;%s&apos;</source> <translation>Δεν μπορώ να γράψω την προεπιλεγμένη διεύθυνση: &apos;%s&apos;</translation> </message> <message> <location line="+1"/> <source>Cannot resolve -externalip address: &apos;%s&apos;</source> <translation>Δεν μπορώ να γράψω την προεπιλεγμένη διεύθυνση: &apos;%s&apos;</translation> </message> <message> <location line="+44"/> <source>Invalid amount for -paytxfee=&lt;amount&gt;: &apos;%s&apos;</source> <translation>Μη έγκυρο ποσό για την παράμετρο -paytxfee=&lt;amount&gt;: &apos;%s&apos;</translation> </message> <message> <location line="+1"/> <source>Invalid amount</source> <translation>Λάθος ποσότητα</translation> </message> <message> <location line="-6"/> <source>Insufficient funds</source> <translation>Ανεπαρκές κεφάλαιο</translation> </message> <message> <location line="+10"/> <source>Loading block index...</source> <translation>Φόρτωση ευρετηρίου μπλοκ...</translation> </message> <message> <location line="-57"/> <source>Add a node to connect to and attempt to keep the connection open</source> <translation>Προσέθεσε ένα κόμβο για σύνδεση και προσπάθησε να κρατήσεις την σύνδεση ανοιχτή</translation> </message> <message> <location line="-25"/> <source>Unable to bind to %s on this computer. Colossus is probably already running.</source> <translation>Αδύνατη η σύνδεση με τη θύρα %s αυτού του υπολογιστή. Το Colossus είναι πιθανώς ήδη ενεργό.</translation> </message> <message> <location line="+64"/> <source>Fee per KB to add to transactions you send</source> <translation>Αμοιβή ανά KB που θα προστίθεται στις συναλλαγές που στέλνεις</translation> </message> <message> <location line="+19"/> <source>Loading wallet...</source> <translation>Φόρτωση πορτοφολιού...</translation> </message> <message> <location line="-52"/> <source>Cannot downgrade wallet</source> <translation>Δεν μπορώ να υποβαθμίσω το πορτοφόλι</translation> </message> <message> <location line="+3"/> <source>Cannot write default address</source> <translation>Δεν μπορώ να γράψω την προεπιλεγμένη διεύθυνση</translation> </message> <message> <location line="+64"/> <source>Rescanning...</source> <translation>Ανίχνευση...</translation> </message> <message> <location line="-57"/> <source>Done loading</source> <translation>Η φόρτωση ολοκληρώθηκε</translation> </message> <message> <location line="+82"/> <source>To use the %s option</source> <translation>Χρήση της %s επιλογής</translation> </message> <message> <location line="-74"/> <source>Error</source> <translation>Σφάλμα</translation> </message> <message> <location line="-31"/> <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>Πρέπει να βάλεις ένα κωδικό στο αρχείο παραμέτρων: %s Εάν το αρχείο δεν υπάρχει, δημιούργησε το με δικαιώματα μόνο για ανάγνωση από τον δημιουργό</translation> </message> </context> </TS>
gfneto/colossus
src/qt/locale/bitcoin_el_GR.ts
TypeScript
mit
138,191
/** */ package IFML.Core.presentation; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.EventObject; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResourceChangeEvent; import org.eclipse.core.resources.IResourceChangeListener; import org.eclipse.core.resources.IResourceDelta; import org.eclipse.core.resources.IResourceDeltaVisitor; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.jface.action.IMenuListener; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.IStatusLineManager; import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.dialogs.ProgressMonitorDialog; import org.eclipse.jface.util.LocalSelectionTransfer; import org.eclipse.jface.viewers.ColumnWeightData; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.ListViewer; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.StructuredViewer; import org.eclipse.jface.viewers.TableLayout; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.viewers.Viewer; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.dnd.DND; import org.eclipse.swt.dnd.FileTransfer; import org.eclipse.swt.dnd.Transfer; import org.eclipse.swt.events.ControlAdapter; import org.eclipse.swt.events.ControlEvent; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableColumn; import org.eclipse.swt.widgets.Tree; import org.eclipse.swt.widgets.TreeColumn; import org.eclipse.ui.IActionBars; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IEditorSite; import org.eclipse.ui.IPartListener; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.PartInitException; import org.eclipse.ui.dialogs.SaveAsDialog; import org.eclipse.ui.ide.IGotoMarker; import org.eclipse.ui.part.FileEditorInput; import org.eclipse.ui.part.MultiPageEditorPart; import org.eclipse.ui.views.contentoutline.ContentOutline; import org.eclipse.ui.views.contentoutline.ContentOutlinePage; import org.eclipse.ui.views.contentoutline.IContentOutlinePage; import org.eclipse.ui.views.properties.IPropertySheetPage; import org.eclipse.ui.views.properties.PropertySheet; import org.eclipse.ui.views.properties.PropertySheetPage; import org.eclipse.emf.common.command.BasicCommandStack; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.common.command.CommandStack; import org.eclipse.emf.common.command.CommandStackListener; import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.ui.MarkerHelper; import org.eclipse.emf.common.ui.ViewerPane; import org.eclipse.emf.common.ui.editor.ProblemEditorPart; import org.eclipse.emf.common.ui.viewer.IViewerProvider; import org.eclipse.emf.common.util.BasicDiagnostic; import org.eclipse.emf.common.util.Diagnostic; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.util.EContentAdapter; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.domain.IEditingDomainProvider; import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator; import org.eclipse.emf.edit.provider.ComposedAdapterFactory; import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory; import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory; import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor; import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter; import org.eclipse.emf.edit.ui.dnd.LocalTransfer; import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter; import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; import org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider; import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper; import org.eclipse.emf.edit.ui.util.EditUIUtil; import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage; import IFML.Core.provider.CoreItemProviderAdapterFactory; import IFML.DataTypes.presentation.IFMLMetamodelEditorPlugin; import IFML.Extensions.provider.ExtensionsItemProviderAdapterFactory; import org.eclipse.ui.actions.WorkspaceModifyOperation; import org.eclipse.uml2.uml.edit.providers.UMLItemProviderAdapterFactory; /** * This is an example of a Core model editor. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public class CoreEditor extends MultiPageEditorPart implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker { /** * This keeps track of the editing domain that is used to track all changes to the model. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected AdapterFactoryEditingDomain editingDomain; /** * This is the one adapter factory used for providing views of the model. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ComposedAdapterFactory adapterFactory; /** * This is the content outline page. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected IContentOutlinePage contentOutlinePage; /** * This is a kludge... * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected IStatusLineManager contentOutlineStatusLineManager; /** * This is the content outline page's viewer. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected TreeViewer contentOutlineViewer; /** * This is the property sheet page. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected List<PropertySheetPage> propertySheetPages = new ArrayList<PropertySheetPage>(); /** * This is the viewer that shadows the selection in the content outline. * The parent relation must be correctly defined for this to work. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected TreeViewer selectionViewer; /** * This inverts the roll of parent and child in the content provider and show parents as a tree. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected TreeViewer parentViewer; /** * This shows how a tree view works. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected TreeViewer treeViewer; /** * This shows how a list view works. * A list viewer doesn't support icons. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ListViewer listViewer; /** * This shows how a table view works. * A table can be used as a list with icons. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected TableViewer tableViewer; /** * This shows how a tree view with columns works. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected TreeViewer treeViewerWithColumns; /** * This keeps track of the active viewer pane, in the book. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ViewerPane currentViewerPane; /** * This keeps track of the active content viewer, which may be either one of the viewers in the pages or the content outline viewer. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected Viewer currentViewer; /** * This listens to which ever viewer is active. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ISelectionChangedListener selectionChangedListener; /** * This keeps track of all the {@link org.eclipse.jface.viewers.ISelectionChangedListener}s that are listening to this editor. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected Collection<ISelectionChangedListener> selectionChangedListeners = new ArrayList<ISelectionChangedListener>(); /** * This keeps track of the selection of the editor as a whole. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ISelection editorSelection = StructuredSelection.EMPTY; /** * The MarkerHelper is responsible for creating workspace resource markers presented * in Eclipse's Problems View. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected MarkerHelper markerHelper = new EditUIMarkerHelper(); /** * This listens for when the outline becomes active * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected IPartListener partListener = new IPartListener() { public void partActivated(IWorkbenchPart p) { if (p instanceof ContentOutline) { if (((ContentOutline)p).getCurrentPage() == contentOutlinePage) { getActionBarContributor().setActiveEditor(CoreEditor.this); setCurrentViewer(contentOutlineViewer); } } else if (p instanceof PropertySheet) { if (propertySheetPages.contains(((PropertySheet)p).getCurrentPage())) { getActionBarContributor().setActiveEditor(CoreEditor.this); handleActivate(); } } else if (p == CoreEditor.this) { handleActivate(); } } public void partBroughtToTop(IWorkbenchPart p) { // Ignore. } public void partClosed(IWorkbenchPart p) { // Ignore. } public void partDeactivated(IWorkbenchPart p) { // Ignore. } public void partOpened(IWorkbenchPart p) { // Ignore. } }; /** * Resources that have been removed since last activation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected Collection<Resource> removedResources = new ArrayList<Resource>(); /** * Resources that have been changed since last activation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected Collection<Resource> changedResources = new ArrayList<Resource>(); /** * Resources that have been saved. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected Collection<Resource> savedResources = new ArrayList<Resource>(); /** * Map to store the diagnostic associated with a resource. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected Map<Resource, Diagnostic> resourceToDiagnosticMap = new LinkedHashMap<Resource, Diagnostic>(); /** * Controls whether the problem indication should be updated. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected boolean updateProblemIndication = true; /** * Adapter used to update the problem indication when resources are demanded loaded. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected EContentAdapter problemIndicationAdapter = new EContentAdapter() { @Override public void notifyChanged(Notification notification) { if (notification.getNotifier() instanceof Resource) { switch (notification.getFeatureID(Resource.class)) { case Resource.RESOURCE__IS_LOADED: case Resource.RESOURCE__ERRORS: case Resource.RESOURCE__WARNINGS: { Resource resource = (Resource)notification.getNotifier(); Diagnostic diagnostic = analyzeResourceProblems(resource, null); if (diagnostic.getSeverity() != Diagnostic.OK) { resourceToDiagnosticMap.put(resource, diagnostic); } else { resourceToDiagnosticMap.remove(resource); } if (updateProblemIndication) { getSite().getShell().getDisplay().asyncExec (new Runnable() { public void run() { updateProblemIndication(); } }); } break; } } } else { super.notifyChanged(notification); } } @Override protected void setTarget(Resource target) { basicSetTarget(target); } @Override protected void unsetTarget(Resource target) { basicUnsetTarget(target); resourceToDiagnosticMap.remove(target); if (updateProblemIndication) { getSite().getShell().getDisplay().asyncExec (new Runnable() { public void run() { updateProblemIndication(); } }); } } }; /** * This listens for workspace changes. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected IResourceChangeListener resourceChangeListener = new IResourceChangeListener() { public void resourceChanged(IResourceChangeEvent event) { IResourceDelta delta = event.getDelta(); try { class ResourceDeltaVisitor implements IResourceDeltaVisitor { protected ResourceSet resourceSet = editingDomain.getResourceSet(); protected Collection<Resource> changedResources = new ArrayList<Resource>(); protected Collection<Resource> removedResources = new ArrayList<Resource>(); public boolean visit(IResourceDelta delta) { if (delta.getResource().getType() == IResource.FILE) { if (delta.getKind() == IResourceDelta.REMOVED || delta.getKind() == IResourceDelta.CHANGED && delta.getFlags() != IResourceDelta.MARKERS) { Resource resource = resourceSet.getResource(URI.createPlatformResourceURI(delta.getFullPath().toString(), true), false); if (resource != null) { if (delta.getKind() == IResourceDelta.REMOVED) { removedResources.add(resource); } else if (!savedResources.remove(resource)) { changedResources.add(resource); } } } return false; } return true; } public Collection<Resource> getChangedResources() { return changedResources; } public Collection<Resource> getRemovedResources() { return removedResources; } } final ResourceDeltaVisitor visitor = new ResourceDeltaVisitor(); delta.accept(visitor); if (!visitor.getRemovedResources().isEmpty()) { getSite().getShell().getDisplay().asyncExec (new Runnable() { public void run() { removedResources.addAll(visitor.getRemovedResources()); if (!isDirty()) { getSite().getPage().closeEditor(CoreEditor.this, false); } } }); } if (!visitor.getChangedResources().isEmpty()) { getSite().getShell().getDisplay().asyncExec (new Runnable() { public void run() { changedResources.addAll(visitor.getChangedResources()); if (getSite().getPage().getActiveEditor() == CoreEditor.this) { handleActivate(); } } }); } } catch (CoreException exception) { IFMLMetamodelEditorPlugin.INSTANCE.log(exception); } } }; /** * Handles activation of the editor or it's associated views. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void handleActivate() { // Recompute the read only state. // if (editingDomain.getResourceToReadOnlyMap() != null) { editingDomain.getResourceToReadOnlyMap().clear(); // Refresh any actions that may become enabled or disabled. // setSelection(getSelection()); } if (!removedResources.isEmpty()) { if (handleDirtyConflict()) { getSite().getPage().closeEditor(CoreEditor.this, false); } else { removedResources.clear(); changedResources.clear(); savedResources.clear(); } } else if (!changedResources.isEmpty()) { changedResources.removeAll(savedResources); handleChangedResources(); changedResources.clear(); savedResources.clear(); } } /** * Handles what to do with changed resources on activation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void handleChangedResources() { if (!changedResources.isEmpty() && (!isDirty() || handleDirtyConflict())) { if (isDirty()) { changedResources.addAll(editingDomain.getResourceSet().getResources()); } editingDomain.getCommandStack().flush(); updateProblemIndication = false; for (Resource resource : changedResources) { if (resource.isLoaded()) { resource.unload(); try { resource.load(Collections.EMPTY_MAP); } catch (IOException exception) { if (!resourceToDiagnosticMap.containsKey(resource)) { resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); } } } } if (AdapterFactoryEditingDomain.isStale(editorSelection)) { setSelection(StructuredSelection.EMPTY); } updateProblemIndication = true; updateProblemIndication(); } } /** * Updates the problems indication with the information described in the specified diagnostic. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void updateProblemIndication() { if (updateProblemIndication) { BasicDiagnostic diagnostic = new BasicDiagnostic (Diagnostic.OK, "IFMLEditor.editor", 0, null, new Object [] { editingDomain.getResourceSet() }); for (Diagnostic childDiagnostic : resourceToDiagnosticMap.values()) { if (childDiagnostic.getSeverity() != Diagnostic.OK) { diagnostic.add(childDiagnostic); } } int lastEditorPage = getPageCount() - 1; if (lastEditorPage >= 0 && getEditor(lastEditorPage) instanceof ProblemEditorPart) { ((ProblemEditorPart)getEditor(lastEditorPage)).setDiagnostic(diagnostic); if (diagnostic.getSeverity() != Diagnostic.OK) { setActivePage(lastEditorPage); } } else if (diagnostic.getSeverity() != Diagnostic.OK) { ProblemEditorPart problemEditorPart = new ProblemEditorPart(); problemEditorPart.setDiagnostic(diagnostic); problemEditorPart.setMarkerHelper(markerHelper); try { addPage(++lastEditorPage, problemEditorPart, getEditorInput()); setPageText(lastEditorPage, problemEditorPart.getPartName()); setActivePage(lastEditorPage); showTabs(); } catch (PartInitException exception) { IFMLMetamodelEditorPlugin.INSTANCE.log(exception); } } if (markerHelper.hasMarkers(editingDomain.getResourceSet())) { markerHelper.deleteMarkers(editingDomain.getResourceSet()); if (diagnostic.getSeverity() != Diagnostic.OK) { try { markerHelper.createMarkers(diagnostic); } catch (CoreException exception) { IFMLMetamodelEditorPlugin.INSTANCE.log(exception); } } } } } /** * Shows a dialog that asks if conflicting changes should be discarded. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected boolean handleDirtyConflict() { return MessageDialog.openQuestion (getSite().getShell(), getString("_UI_FileConflict_label"), getString("_WARN_FileConflict")); } /** * This creates a model editor. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public CoreEditor() { super(); initializeEditingDomain(); } /** * This sets up the editing domain for the model editor. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void initializeEditingDomain() { // Create an adapter factory that yields item providers. // adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE); adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory()); adapterFactory.addAdapterFactory(new CoreItemProviderAdapterFactory()); adapterFactory.addAdapterFactory(new ExtensionsItemProviderAdapterFactory()); adapterFactory.addAdapterFactory(new EcoreItemProviderAdapterFactory()); adapterFactory.addAdapterFactory(new UMLItemProviderAdapterFactory()); adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory()); // Create the command stack that will notify this editor as commands are executed. // BasicCommandStack commandStack = new BasicCommandStack(); // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus. // commandStack.addCommandStackListener (new CommandStackListener() { public void commandStackChanged(final EventObject event) { getContainer().getDisplay().asyncExec (new Runnable() { public void run() { firePropertyChange(IEditorPart.PROP_DIRTY); // Try to select the affected objects. // Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand(); if (mostRecentCommand != null) { setSelectionToViewer(mostRecentCommand.getAffectedObjects()); } for (Iterator<PropertySheetPage> i = propertySheetPages.iterator(); i.hasNext(); ) { PropertySheetPage propertySheetPage = i.next(); if (propertySheetPage.getControl().isDisposed()) { i.remove(); } else { propertySheetPage.refresh(); } } } }); } }); // Create the editing domain with a special command stack. // editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>()); } /** * This is here for the listener to be able to call it. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected void firePropertyChange(int action) { super.firePropertyChange(action); } /** * This sets the selection into whichever viewer is active. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setSelectionToViewer(Collection<?> collection) { final Collection<?> theSelection = collection; // Make sure it's okay. // if (theSelection != null && !theSelection.isEmpty()) { Runnable runnable = new Runnable() { public void run() { // Try to select the items in the current content viewer of the editor. // if (currentViewer != null) { currentViewer.setSelection(new StructuredSelection(theSelection.toArray()), true); } } }; getSite().getShell().getDisplay().asyncExec(runnable); } } /** * This returns the editing domain as required by the {@link IEditingDomainProvider} interface. * This is important for implementing the static methods of {@link AdapterFactoryEditingDomain} * and for supporting {@link org.eclipse.emf.edit.ui.action.CommandAction}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EditingDomain getEditingDomain() { return editingDomain; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public class ReverseAdapterFactoryContentProvider extends AdapterFactoryContentProvider { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ReverseAdapterFactoryContentProvider(AdapterFactory adapterFactory) { super(adapterFactory); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object [] getElements(Object object) { Object parent = super.getParent(object); return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object [] getChildren(Object object) { Object parent = super.getParent(object); return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean hasChildren(Object object) { Object parent = super.getParent(object); return parent != null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object getParent(Object object) { return null; } } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setCurrentViewerPane(ViewerPane viewerPane) { if (currentViewerPane != viewerPane) { if (currentViewerPane != null) { currentViewerPane.showFocus(false); } currentViewerPane = viewerPane; } setCurrentViewer(currentViewerPane.getViewer()); } /** * This makes sure that one content viewer, either for the current page or the outline view, if it has focus, * is the current one. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setCurrentViewer(Viewer viewer) { // If it is changing... // if (currentViewer != viewer) { if (selectionChangedListener == null) { // Create the listener on demand. // selectionChangedListener = new ISelectionChangedListener() { // This just notifies those things that are affected by the section. // public void selectionChanged(SelectionChangedEvent selectionChangedEvent) { setSelection(selectionChangedEvent.getSelection()); } }; } // Stop listening to the old one. // if (currentViewer != null) { currentViewer.removeSelectionChangedListener(selectionChangedListener); } // Start listening to the new one. // if (viewer != null) { viewer.addSelectionChangedListener(selectionChangedListener); } // Remember it. // currentViewer = viewer; // Set the editors selection based on the current viewer's selection. // setSelection(currentViewer == null ? StructuredSelection.EMPTY : currentViewer.getSelection()); } } /** * This returns the viewer as required by the {@link IViewerProvider} interface. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Viewer getViewer() { return currentViewer; } /** * This creates a context menu for the viewer and adds a listener as well registering the menu for extension. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void createContextMenuFor(StructuredViewer viewer) { MenuManager contextMenu = new MenuManager("#PopUp"); contextMenu.add(new Separator("additions")); contextMenu.setRemoveAllWhenShown(true); contextMenu.addMenuListener(this); Menu menu= contextMenu.createContextMenu(viewer.getControl()); viewer.getControl().setMenu(menu); getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer)); int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK; Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance(), LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance() }; viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer)); viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer)); } /** * This is the method called to load a resource into the editing domain's resource set based on the editor's input. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void createModel() { URI resourceURI = EditUIUtil.getURI(getEditorInput()); Exception exception = null; Resource resource = null; try { // Load the resource through the editing domain. // resource = editingDomain.getResourceSet().getResource(resourceURI, true); } catch (Exception e) { exception = e; resource = editingDomain.getResourceSet().getResource(resourceURI, false); } Diagnostic diagnostic = analyzeResourceProblems(resource, exception); if (diagnostic.getSeverity() != Diagnostic.OK) { resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); } editingDomain.getResourceSet().eAdapters().add(problemIndicationAdapter); } /** * Returns a diagnostic describing the errors and warnings listed in the resource * and the specified exception (if any). * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) { if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()) { BasicDiagnostic basicDiagnostic = new BasicDiagnostic (Diagnostic.ERROR, "IFMLEditor.editor", 0, getString("_UI_CreateModelError_message", resource.getURI()), new Object [] { exception == null ? (Object)resource : exception }); basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true)); return basicDiagnostic; } else if (exception != null) { return new BasicDiagnostic (Diagnostic.ERROR, "IFMLEditor.editor", 0, getString("_UI_CreateModelError_message", resource.getURI()), new Object[] { exception }); } else { return Diagnostic.OK_INSTANCE; } } /** * This is the method used by the framework to install your own controls. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void createPages() { // Creates the model from the editor input // createModel(); // Only creates the other pages if there is something that can be edited // if (!getEditingDomain().getResourceSet().getResources().isEmpty()) { // Create a page for the selection tree view. // { ViewerPane viewerPane = new ViewerPane(getSite().getPage(), CoreEditor.this) { @Override public Viewer createViewer(Composite composite) { Tree tree = new Tree(composite, SWT.MULTI); TreeViewer newTreeViewer = new TreeViewer(tree); return newTreeViewer; } @Override public void requestActivation() { super.requestActivation(); setCurrentViewerPane(this); } }; viewerPane.createControl(getContainer()); selectionViewer = (TreeViewer)viewerPane.getViewer(); selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); selectionViewer.setInput(editingDomain.getResourceSet()); selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); viewerPane.setTitle(editingDomain.getResourceSet()); new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory); createContextMenuFor(selectionViewer); int pageIndex = addPage(viewerPane.getControl()); setPageText(pageIndex, getString("_UI_SelectionPage_label")); } // Create a page for the parent tree view. // { ViewerPane viewerPane = new ViewerPane(getSite().getPage(), CoreEditor.this) { @Override public Viewer createViewer(Composite composite) { Tree tree = new Tree(composite, SWT.MULTI); TreeViewer newTreeViewer = new TreeViewer(tree); return newTreeViewer; } @Override public void requestActivation() { super.requestActivation(); setCurrentViewerPane(this); } }; viewerPane.createControl(getContainer()); parentViewer = (TreeViewer)viewerPane.getViewer(); parentViewer.setAutoExpandLevel(30); parentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory)); parentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); createContextMenuFor(parentViewer); int pageIndex = addPage(viewerPane.getControl()); setPageText(pageIndex, getString("_UI_ParentPage_label")); } // This is the page for the list viewer // { ViewerPane viewerPane = new ViewerPane(getSite().getPage(), CoreEditor.this) { @Override public Viewer createViewer(Composite composite) { return new ListViewer(composite); } @Override public void requestActivation() { super.requestActivation(); setCurrentViewerPane(this); } }; viewerPane.createControl(getContainer()); listViewer = (ListViewer)viewerPane.getViewer(); listViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); listViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); createContextMenuFor(listViewer); int pageIndex = addPage(viewerPane.getControl()); setPageText(pageIndex, getString("_UI_ListPage_label")); } // This is the page for the tree viewer // { ViewerPane viewerPane = new ViewerPane(getSite().getPage(), CoreEditor.this) { @Override public Viewer createViewer(Composite composite) { return new TreeViewer(composite); } @Override public void requestActivation() { super.requestActivation(); setCurrentViewerPane(this); } }; viewerPane.createControl(getContainer()); treeViewer = (TreeViewer)viewerPane.getViewer(); treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory); createContextMenuFor(treeViewer); int pageIndex = addPage(viewerPane.getControl()); setPageText(pageIndex, getString("_UI_TreePage_label")); } // This is the page for the table viewer. // { ViewerPane viewerPane = new ViewerPane(getSite().getPage(), CoreEditor.this) { @Override public Viewer createViewer(Composite composite) { return new TableViewer(composite); } @Override public void requestActivation() { super.requestActivation(); setCurrentViewerPane(this); } }; viewerPane.createControl(getContainer()); tableViewer = (TableViewer)viewerPane.getViewer(); Table table = tableViewer.getTable(); TableLayout layout = new TableLayout(); table.setLayout(layout); table.setHeaderVisible(true); table.setLinesVisible(true); TableColumn objectColumn = new TableColumn(table, SWT.NONE); layout.addColumnData(new ColumnWeightData(3, 100, true)); objectColumn.setText(getString("_UI_ObjectColumn_label")); objectColumn.setResizable(true); TableColumn selfColumn = new TableColumn(table, SWT.NONE); layout.addColumnData(new ColumnWeightData(2, 100, true)); selfColumn.setText(getString("_UI_SelfColumn_label")); selfColumn.setResizable(true); tableViewer.setColumnProperties(new String [] {"a", "b"}); tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); createContextMenuFor(tableViewer); int pageIndex = addPage(viewerPane.getControl()); setPageText(pageIndex, getString("_UI_TablePage_label")); } // This is the page for the table tree viewer. // { ViewerPane viewerPane = new ViewerPane(getSite().getPage(), CoreEditor.this) { @Override public Viewer createViewer(Composite composite) { return new TreeViewer(composite); } @Override public void requestActivation() { super.requestActivation(); setCurrentViewerPane(this); } }; viewerPane.createControl(getContainer()); treeViewerWithColumns = (TreeViewer)viewerPane.getViewer(); Tree tree = treeViewerWithColumns.getTree(); tree.setLayoutData(new FillLayout()); tree.setHeaderVisible(true); tree.setLinesVisible(true); TreeColumn objectColumn = new TreeColumn(tree, SWT.NONE); objectColumn.setText(getString("_UI_ObjectColumn_label")); objectColumn.setResizable(true); objectColumn.setWidth(250); TreeColumn selfColumn = new TreeColumn(tree, SWT.NONE); selfColumn.setText(getString("_UI_SelfColumn_label")); selfColumn.setResizable(true); selfColumn.setWidth(200); treeViewerWithColumns.setColumnProperties(new String [] {"a", "b"}); treeViewerWithColumns.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); treeViewerWithColumns.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); createContextMenuFor(treeViewerWithColumns); int pageIndex = addPage(viewerPane.getControl()); setPageText(pageIndex, getString("_UI_TreeWithColumnsPage_label")); } getSite().getShell().getDisplay().asyncExec (new Runnable() { public void run() { setActivePage(0); } }); } // Ensures that this editor will only display the page's tab // area if there are more than one page // getContainer().addControlListener (new ControlAdapter() { boolean guard = false; @Override public void controlResized(ControlEvent event) { if (!guard) { guard = true; hideTabs(); guard = false; } } }); getSite().getShell().getDisplay().asyncExec (new Runnable() { public void run() { updateProblemIndication(); } }); } /** * If there is just one page in the multi-page editor part, * this hides the single tab at the bottom. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void hideTabs() { if (getPageCount() <= 1) { setPageText(0, ""); if (getContainer() instanceof CTabFolder) { ((CTabFolder)getContainer()).setTabHeight(1); Point point = getContainer().getSize(); getContainer().setSize(point.x, point.y + 6); } } } /** * If there is more than one page in the multi-page editor part, * this shows the tabs at the bottom. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void showTabs() { if (getPageCount() > 1) { setPageText(0, getString("_UI_SelectionPage_label")); if (getContainer() instanceof CTabFolder) { ((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT); Point point = getContainer().getSize(); getContainer().setSize(point.x, point.y - 6); } } } /** * This is used to track the active viewer. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected void pageChange(int pageIndex) { super.pageChange(pageIndex); if (contentOutlinePage != null) { handleContentOutlineSelection(contentOutlinePage.getSelection()); } } /** * This is how the framework determines which interfaces we implement. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("rawtypes") @Override public Object getAdapter(Class key) { if (key.equals(IContentOutlinePage.class)) { return showOutlineView() ? getContentOutlinePage() : null; } else if (key.equals(IPropertySheetPage.class)) { return getPropertySheetPage(); } else if (key.equals(IGotoMarker.class)) { return this; } else { return super.getAdapter(key); } } /** * This accesses a cached version of the content outliner. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public IContentOutlinePage getContentOutlinePage() { if (contentOutlinePage == null) { // The content outline is just a tree. // class MyContentOutlinePage extends ContentOutlinePage { @Override public void createControl(Composite parent) { super.createControl(parent); contentOutlineViewer = getTreeViewer(); contentOutlineViewer.addSelectionChangedListener(this); // Set up the tree viewer. // contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); contentOutlineViewer.setInput(editingDomain.getResourceSet()); // Make sure our popups work. // createContextMenuFor(contentOutlineViewer); if (!editingDomain.getResourceSet().getResources().isEmpty()) { // Select the root object in the view. // contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); } } @Override public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) { super.makeContributions(menuManager, toolBarManager, statusLineManager); contentOutlineStatusLineManager = statusLineManager; } @Override public void setActionBars(IActionBars actionBars) { super.setActionBars(actionBars); getActionBarContributor().shareGlobalActions(this, actionBars); } } contentOutlinePage = new MyContentOutlinePage(); // Listen to selection so that we can handle it is a special way. // contentOutlinePage.addSelectionChangedListener (new ISelectionChangedListener() { // This ensures that we handle selections correctly. // public void selectionChanged(SelectionChangedEvent event) { handleContentOutlineSelection(event.getSelection()); } }); } return contentOutlinePage; } /** * This accesses a cached version of the property sheet. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public IPropertySheetPage getPropertySheetPage() { PropertySheetPage propertySheetPage = new ExtendedPropertySheetPage(editingDomain) { @Override public void setSelectionToViewer(List<?> selection) { CoreEditor.this.setSelectionToViewer(selection); CoreEditor.this.setFocus(); } @Override public void setActionBars(IActionBars actionBars) { super.setActionBars(actionBars); getActionBarContributor().shareGlobalActions(this, actionBars); } }; propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory)); propertySheetPages.add(propertySheetPage); return propertySheetPage; } /** * This deals with how we want selection in the outliner to affect the other views. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void handleContentOutlineSelection(ISelection selection) { if (currentViewerPane != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { Iterator<?> selectedElements = ((IStructuredSelection)selection).iterator(); if (selectedElements.hasNext()) { // Get the first selected element. // Object selectedElement = selectedElements.next(); // If it's the selection viewer, then we want it to select the same selection as this selection. // if (currentViewerPane.getViewer() == selectionViewer) { ArrayList<Object> selectionList = new ArrayList<Object>(); selectionList.add(selectedElement); while (selectedElements.hasNext()) { selectionList.add(selectedElements.next()); } // Set the selection to the widget. // selectionViewer.setSelection(new StructuredSelection(selectionList)); } else { // Set the input to the widget. // if (currentViewerPane.getViewer().getInput() != selectedElement) { currentViewerPane.getViewer().setInput(selectedElement); currentViewerPane.setTitle(selectedElement); } } } } } /** * This is for implementing {@link IEditorPart} and simply tests the command stack. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean isDirty() { return ((BasicCommandStack)editingDomain.getCommandStack()).isSaveNeeded(); } /** * This is for implementing {@link IEditorPart} and simply saves the model file. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void doSave(IProgressMonitor progressMonitor) { // Save only resources that have actually changed. // final Map<Object, Object> saveOptions = new HashMap<Object, Object>(); saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER); saveOptions.put(Resource.OPTION_LINE_DELIMITER, Resource.OPTION_LINE_DELIMITER_UNSPECIFIED); // Do the work within an operation because this is a long running activity that modifies the workbench. // WorkspaceModifyOperation operation = new WorkspaceModifyOperation() { // This is the method that gets invoked when the operation runs. // @Override public void execute(IProgressMonitor monitor) { // Save the resources to the file system. // boolean first = true; for (Resource resource : editingDomain.getResourceSet().getResources()) { if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !editingDomain.isReadOnly(resource)) { try { long timeStamp = resource.getTimeStamp(); resource.save(saveOptions); if (resource.getTimeStamp() != timeStamp) { savedResources.add(resource); } } catch (Exception exception) { resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); } first = false; } } } }; updateProblemIndication = false; try { // This runs the options, and shows progress. // new ProgressMonitorDialog(getSite().getShell()).run(true, false, operation); // Refresh the necessary state. // ((BasicCommandStack)editingDomain.getCommandStack()).saveIsDone(); firePropertyChange(IEditorPart.PROP_DIRTY); } catch (Exception exception) { // Something went wrong that shouldn't. // IFMLMetamodelEditorPlugin.INSTANCE.log(exception); } updateProblemIndication = true; updateProblemIndication(); } /** * This returns whether something has been persisted to the URI of the specified resource. * The implementation uses the URI converter from the editor's resource set to try to open an input stream. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected boolean isPersisted(Resource resource) { boolean result = false; try { InputStream stream = editingDomain.getResourceSet().getURIConverter().createInputStream(resource.getURI()); if (stream != null) { result = true; stream.close(); } } catch (IOException e) { // Ignore } return result; } /** * This always returns true because it is not currently supported. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean isSaveAsAllowed() { return true; } /** * This also changes the editor's input. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void doSaveAs() { SaveAsDialog saveAsDialog = new SaveAsDialog(getSite().getShell()); saveAsDialog.open(); IPath path = saveAsDialog.getResult(); if (path != null) { IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path); if (file != null) { doSaveAs(URI.createPlatformResourceURI(file.getFullPath().toString(), true), new FileEditorInput(file)); } } } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void doSaveAs(URI uri, IEditorInput editorInput) { (editingDomain.getResourceSet().getResources().get(0)).setURI(uri); setInputWithNotify(editorInput); setPartName(editorInput.getName()); IProgressMonitor progressMonitor = getActionBars().getStatusLineManager() != null ? getActionBars().getStatusLineManager().getProgressMonitor() : new NullProgressMonitor(); doSave(progressMonitor); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void gotoMarker(IMarker marker) { List<?> targetObjects = markerHelper.getTargetObjects(editingDomain, marker); if (!targetObjects.isEmpty()) { setSelectionToViewer(targetObjects); } } /** * This is called during startup. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void init(IEditorSite site, IEditorInput editorInput) { setSite(site); setInputWithNotify(editorInput); setPartName(editorInput.getName()); site.setSelectionProvider(this); site.getPage().addPartListener(partListener); ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener, IResourceChangeEvent.POST_CHANGE); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void setFocus() { if (currentViewerPane != null) { currentViewerPane.setFocus(); } else { getControl(getActivePage()).setFocus(); } } /** * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void addSelectionChangedListener(ISelectionChangedListener listener) { selectionChangedListeners.add(listener); } /** * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void removeSelectionChangedListener(ISelectionChangedListener listener) { selectionChangedListeners.remove(listener); } /** * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to return this editor's overall selection. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ISelection getSelection() { return editorSelection; } /** * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection. * Calling this result will notify the listeners. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setSelection(ISelection selection) { editorSelection = selection; for (ISelectionChangedListener listener : selectionChangedListeners) { listener.selectionChanged(new SelectionChangedEvent(this, selection)); } setStatusLineManager(selection); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setStatusLineManager(ISelection selection) { IStatusLineManager statusLineManager = currentViewer != null && currentViewer == contentOutlineViewer ? contentOutlineStatusLineManager : getActionBars().getStatusLineManager(); if (statusLineManager != null) { if (selection instanceof IStructuredSelection) { Collection<?> collection = ((IStructuredSelection)selection).toList(); switch (collection.size()) { case 0: { statusLineManager.setMessage(getString("_UI_NoObjectSelected")); break; } case 1: { String text = new AdapterFactoryItemDelegator(adapterFactory).getText(collection.iterator().next()); statusLineManager.setMessage(getString("_UI_SingleObjectSelected", text)); break; } default: { statusLineManager.setMessage(getString("_UI_MultiObjectSelected", Integer.toString(collection.size()))); break; } } } else { statusLineManager.setMessage(""); } } } /** * This looks up a string in the plugin's plugin.properties file. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static String getString(String key) { return IFMLMetamodelEditorPlugin.INSTANCE.getString(key); } /** * This looks up a string in plugin.properties, making a substitution. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static String getString(String key, Object s1) { return IFMLMetamodelEditorPlugin.INSTANCE.getString(key, new Object [] { s1 }); } /** * This implements {@link org.eclipse.jface.action.IMenuListener} to help fill the context menus with contributions from the Edit menu. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void menuAboutToShow(IMenuManager menuManager) { ((IMenuListener)getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EditingDomainActionBarContributor getActionBarContributor() { return (EditingDomainActionBarContributor)getEditorSite().getActionBarContributor(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public IActionBars getActionBars() { return getActionBarContributor().getActionBars(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public AdapterFactory getAdapterFactory() { return adapterFactory; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void dispose() { updateProblemIndication = false; ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener); getSite().getPage().removePartListener(partListener); adapterFactory.dispose(); if (getActionBarContributor().getActiveEditor() == this) { getActionBarContributor().setActiveEditor(null); } for (PropertySheetPage propertySheetPage : propertySheetPages) { propertySheetPage.dispose(); } if (contentOutlinePage != null) { contentOutlinePage.dispose(); } super.dispose(); } /** * Returns whether the outline view should be presented to the user. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected boolean showOutlineView() { return true; } }
ifml/ifml-editor
plugins/IFMLEditor.editor/src/IFML/Core/presentation/CoreEditor.java
Java
mit
54,335
<?php if($_POST) { //check if its an ajax request, exit if not if(!isset($_SERVER['HTTP_X_REQUESTED_WITH']) AND strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest') { $output = json_encode(array( //create JSON data 'type'=>'error', 'text' => 'Invalid request, must be AJAX POST' )); die($output); //exit script outputting json data } $user_email = $_POST["user_email"]; $user_comments = $_POST["user_comments"]; $volunteer = $_POST["volunteer"]; $volunteer_name = $_POST["volunteer_name"]; $btdt = ($_POST["btdt"] === "true"); $dbConnection = new PDO('mysql:dbname=dgm;host=localhost;charset=utf8', 'dgm', 'dgm'); $dbConnection->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); $dbConnection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $dbConnection->prepare('INSERT INTO data (email, comments, volunteer, volunteer_name, btdt, timestamp) VALUES (:email, :comments, :volunteer, :volunteer_name, :btdt, NOW())'); $stmt->execute(array('email' => $user_email, 'comments' => $user_comments, 'volunteer' => $volunteer, 'volunteer_name' => $volunteer_name, 'btdt' => $btdt)); die(json_encode(array('type'=>'done'))); } ?>
digitalgamemuseum/signup
submit.php
PHP
mit
1,285
<div class="first_column ui-corner-all ui-widget ui-widget-content"> <h3>Add new site</h3> <?php if(!empty($_SESSION['error_message'])){ ?> <div class="ui-widget"> <div class="ui-state-error ui-corner-all" style="margin-top: 20px; padding: 0 .7em;"> <p> <span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span> <strong><?php echo $_SESSION['error_message']; ?></strong> </p> </div> </div> <?php unset($_SESSION['error_message']); } echo form_open('admin/site/add_new'); if(!empty($_SESSION['_submited'])){ $submited_site_name = $_SESSION['_submited']['site_name']; $submited_site_url = $_SESSION['_submited']['site_url']; $submited_site_status = $_SESSION['_submited']['site_status']; unset($_SESSION['_submited']); }else{ $submited_site_name = ''; $submited_site_url = ''; $submited_site_status = '1'; } ?> <table cellspacing="5" align="center"> <tr> <td>Site name</td> <td><input type="text" class="ui-state-default ui-corner-all field large" autocomplete="off" name="site_name" value="<?php echo $submited_site_name; ?>"></td> </tr> <tr> <td>Site url</td> <td><input type="text" class="ui-state-default ui-corner-all field large" autocomplete="off" name="site_url" value="<?php echo $submited_site_url; ?>"></td> </tr> <tr> <td>Status</td> <td> <select class="ui-state-default ui-corner-all field" autocomplete="off" name="site_status"> <option value="1"<?php echo ($submited_site_status == '1') ? ' selected="selected"' : ''; ?>>Active</option> <option value="0"<?php echo ($submited_site_status == '0') ? ' selected="selected"' : ''; ?>>Disabled</option> </select> </td> </tr> <tr> <td colspan="2"> <div class="login_form_button"> <button id="submit_add_new_button" type="submit" style="margin-right: 0;">Add new site</button> </div> </td> </tr> </table> <?php echo form_close(); ?> <div class="clear"></div> </div> <script type="text/javascript"> $("#submit_add_new_button").button(); </script>
BrielSoftware/Codeigniter
application/views/template/admin/site/site_list_add.php
PHP
mit
2,581
/** * For proper JSON escaping for use as JS object literal in a <script> tag * For your education: http://timelessrepo.com/json-isnt-a-javascript-subset * * Javascript implementation of http://golang.org/pkg/encoding/json/#HTMLEscape */ 'use strict'; var ESCAPE_LOOKUP = { '&': '\\u0026', '>': '\\u003e', '<': '\\u003c', '\u2028': '\\u2028', '\u2029': '\\u2029' }; var ESCAPE_REGEX = /[&><\u2028\u2029]/g; function escaper(match) { return ESCAPE_LOOKUP[match]; } module.exports = function(obj) { return JSON.stringify(obj).replace(ESCAPE_REGEX, escaper); };
zertosh/pollen
htmlescape.js
JavaScript
mit
583
import {Observable} from '../Observable'; import {filter} from './filter'; const not = <T>(fn: (val: T) => boolean) => (x: T) => !fn(x); /** * Splits the source Observable into two, one with values that satisfy a predicate, * and another with values that don't satisfy the predicate. * * Marble diagram: * * ```text * --1--2--3--4--5--6--7--8--| * partition * --1-----3-----5-----7-----| * -----2-----4-----6-----8--| * * @param predicate A function that evaluates each value emitted by the source Observable. * If it returns true, the value is emitted on the first Observable in the returned array, * if false the value is emitted on the second Observable in the array. * @returns [Observable<T>, Observable<T>] */ export function partition<T>(predicate: (val: T) => boolean): [Observable<T>, Observable<T>] { return [ filter.call(this, predicate), filter.call(this, not(predicate)) ]; }
SekibOmazic/myoo
src/operator/partition.ts
TypeScript
mit
963
<?php /* * Category Bundle * This file is part of the BardisCMS. * * (c) George Bardis <george@bardis.info> * */ namespace BardisCMS\CategoryBundle\Repository; use Doctrine\ORM\EntityRepository; class CategoryRepository extends EntityRepository { }
bardius/the-web-dev-ninja-blog
src/BardisCMS/CategoryBundle/Repository/CategoryRepository.php
PHP
mit
264
""" Module containing classes for HTTP client/server interactions """ # Python 2.x/3.x compatibility imports try: from urllib.error import HTTPError, URLError from urllib.parse import urlencode except ImportError: from urllib2 import HTTPError, URLError from urllib import urlencode import socket from pyowm.exceptions import api_call_error, unauthorized_error, not_found_error from pyowm.webapi25.configuration25 import ROOT_API_URL class WeatherHttpClient(object): API_SUBSCRIPTION_SUBDOMAINS = { 'free': 'api', 'pro': 'pro' } """ An HTTP client class for the OWM web API. The class can leverage a caching mechanism :param API_key: a Unicode object representing the OWM web API key :type API_key: Unicode :param cache: an *OWMCache* concrete instance that will be used to cache OWM web API responses. :type cache: an *OWMCache* concrete instance :param subscription_type: the type of OWM web API subscription to be wrapped. The value is used to pick the proper API subdomain for HTTP calls. Defaults to: 'free' :type subscription_type: str """ def __init__(self, API_key, cache, subscription_type='free'): self._API_key = API_key self._cache = cache self._API_root_URL = ROOT_API_URL % \ (self.API_SUBSCRIPTION_SUBDOMAINS[subscription_type],) def _lookup_cache_or_invoke_API(self, cache, API_full_url, timeout): cached = cache.get(API_full_url) if cached: return cached else: try: try: from urllib.request import urlopen except ImportError: from urllib2 import urlopen response = urlopen(API_full_url, None, timeout) except HTTPError as e: if '401' in str(e): raise unauthorized_error.UnauthorizedError('Invalid API key') if '404' in str(e): raise not_found_error.NotFoundError('The resource was not found') if '502' in str(e): raise api_call_error.BadGatewayError(str(e), e) except URLError as e: raise api_call_error.APICallError(str(e), e) else: data = response.read().decode('utf-8') cache.set(API_full_url, data) return data def call_API(self, API_endpoint_URL, params_dict, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): """ Invokes a specific OWM web API endpoint URL, returning raw JSON data. :param API_endpoint_URL: the API endpoint to be invoked :type API_endpoint_URL: str :param params_dict: a dictionary containing the query parameters to be used in the HTTP request (given as key-value couples in the dict) :type params_dict: dict :param timeout: how many seconds to wait for connection establishment (defaults to ``socket._GLOBAL_DEFAULT_TIMEOUT``) :type timeout: int :returns: a string containing raw JSON data :raises: *APICallError* """ url = self._build_full_URL(API_endpoint_URL, params_dict) return self._lookup_cache_or_invoke_API(self._cache, url, timeout) def _build_full_URL(self, API_endpoint_URL, params_dict): """ Adds the API key and the query parameters dictionary to the specified API endpoint URL, returning a complete HTTP request URL. :param API_endpoint_URL: the API endpoint base URL :type API_endpoint_URL: str :param params_dict: a dictionary containing the query parameters to be used in the HTTP request (given as key-value couples in the dict) :type params_dict: dict :param API_key: the OWM web API key :type API_key: str :returns: a full string HTTP request URL """ url =self._API_root_URL + API_endpoint_URL params = params_dict.copy() if self._API_key is not None: params['APPID'] = self._API_key return self._build_query_parameters(url, params) def _build_query_parameters(self, base_URL, params_dict): """ Turns dictionary items into query parameters and adds them to the base URL :param base_URL: the base URL whom the query parameters must be added to :type base_URL: str :param params_dict: a dictionary containing the query parameters to be used in the HTTP request (given as key-value couples in the dict) :type params_dict: dict :returns: a full string HTTP request URL """ return base_URL + '?' + urlencode(params_dict) def __repr__(self): return "<%s.%s - cache=%s>" % \ (__name__, self.__class__.__name__, repr(self._cache))
mpvoss/RickAndMortyWeatherTweets
env/lib/python3.5/site-packages/pyowm/commons/weather_client.py
Python
mit
4,935
class Object def maybe self end end
johnbender/perchance
lib/perchance/object.rb
Ruby
mit
44
from django.db import models from django.contrib.sites.models import Site # Create your models here. class Link(models.Model): url = models.URLField(max_length=512) site = models.ForeignKey(Site, on_delete=models.SET_NULL, null=True) request_times = models.PositiveIntegerField(default=0) updated = models.DateTimeField(auto_now=True) created = models.DateTimeField(auto_now_add=True) def __str__(self): return '{}-{}'.format(self.pk, self.url) class RateLimit(models.Model): ip = models.GenericIPAddressField(unique=True) start_time = models.DateTimeField() count = models.PositiveIntegerField(default=0) def __str__(self): return self.ip
typefj/django-miniurl
shortener/models.py
Python
mit
702
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Count_Substring_Ocurrences { class Program { static void Main(string[] args) { var text = Console.ReadLine().ToLower(); var specialWord = Console.ReadLine().ToLower(); var countWord = 0; var index = text.IndexOf(specialWord); while(index!=-1) { countWord++; index = text.IndexOf(specialWord, index + 1); } Console.WriteLine(countWord); } } }
mitaka00/SoftUni
Programing Fundamentals/28-String and Text Processing-Lab/Count Substring Ocurrences/Program.cs
C#
mit
660
namespace Expresso.Resolvers { using System; using System.Collections.Generic; using System.Linq; using System.Reflection; /// <summary> /// Поставщик сборок текущего домена /// </summary> public class AppDomainAssembliesProvider : IAssemblyProvider { /// <summary> /// Возвращает набор сборок /// </summary> public IEnumerable<Assembly> GetAssemblies() { return AppDomain.CurrentDomain.GetAssemblies().Where(x => !x.IsDynamic); } } }
devIceMan/Expresso
Expresso/Resolvers/AppDomainAssembliesProvider.cs
C#
mit
596
package com.showka.service.query.u05.i; import java.util.List; import com.showka.domain.u05.UriageRireki; import com.showka.domain.z00.Busho; import com.showka.entity.RUriage; import com.showka.value.TheDate; public interface UriageRirekiQuery { /** * 計上日と部署を指定しての売上を検索します。 * * @param busho * 顧客の主管理部署 * @param date * 計上日 * @return 未計上売上リスト(売上履歴) */ public List<RUriage> getEntityList(Busho busho, TheDate date); /** * 売上履歴取得. * * @param uriageId * 売上ID * @return 売上履歴 */ public UriageRireki get(String uriageId); }
ShowKa/HanbaiKanri
src/main/java/com/showka/service/query/u05/i/UriageRirekiQuery.java
Java
mit
733
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Http\Requests; use App\Http\Controllers\Controller; class ReminderController extends Controller { // public function showReminder() { //return view('reminder')->with('page' => 'reminder'); return view('reminder' , ['page' => 'reminder']); } public function setReminder() { //return view('reminder')->with('page' => 'reminder'); return view('reminder' , ['page' => 'reminder']); } }
manishdwibedy/SCaller
app/Http/Controllers/ReminderController.php
PHP
mit
522
import styled from 'styled-components'; import Stones from '../Stones'; const StyledStones = styled(Stones)` display: inline-block; width: 100%; min-height: 30px; div { display: inline-block; width: 20px; height: 20px; border: 1px solid #000000; border-radius: 50%; margin: 0 1px 0 0; padding: 0; text-align: center; font-size: 16px; line-height: 20px; } ${props => typeof props.stoneClick == 'function' ? 'div:hover { cursor: pointer; }' : ''} div.black { color: white; background: black; } div.red { color: white; background: red; } div.blue { color: white; background: blue; } div.white { color: black; background: white; } div.disabled { color: #AAA; background: #666; } div.plus, div.and, div.equals { color: black; background: white; border: none; } `; export default StyledStones;
ryanabragg/VanguardLARP
src/components/Character/styled/Stones.js
JavaScript
mit
924
class InvalidValueState(ValueError): pass
szopu/datadiffs
datadiffs/exceptions.py
Python
mit
46
import java.util.Scanner; /** * Created by mvieck on 12/21/16. */ public class CarProject { Car[] cars = new Car[3]; public CarProject() { cars[0] = new Car("Ford",80, 7); cars[1] = new Car("Kia", 70, 6); cars[2] = new Car("Lexus", 60, 8); } public static void main(String[] args) { CarProject carProgram = new CarProject(); Scanner scanner = new Scanner(System.in); System.out.print("Enter in a car brand (Ford, Kia, Lexus): "); String brand = scanner.nextLine(); Car car; if (carProgram.cars[0].getBrand().equals(brand)) { car = carProgram.cars[0]; } else if (carProgram.cars[1].getBrand().equals(brand)) { car = carProgram.cars[1]; } else if (carProgram.cars[2].getBrand().equals(brand)) { car = carProgram.cars[2]; } else { System.out.println("Could not find the brand. Try Ford, Kia or Lexus"); return; } System.out.printf("Brand: %s, Speed: %d mph/kmh, Drive: %dth gear\n",car.getBrand(), car.getSpeed(), car.getDrive()); } }
vieck/Udemy-Java-Square-One
Car/src/CarProject.java
Java
mit
1,133
using System; using System.Collections; namespace hub { public class logicproxy { public logicproxy(juggle.Ichannel ch) { _hub_call_logic = new caller.hub_call_logic(ch); } public void reg_logic_sucess_and_notify_hub_nominate() { _hub_call_logic.reg_logic_sucess_and_notify_hub_nominate(hub.name); } public void call_logic(String module_name, String func_name, params object[] argvs) { ArrayList _argvs = new ArrayList(); foreach (var o in argvs) { _argvs.Add(o); } _hub_call_logic.hub_call_logic_mothed(module_name, func_name, _argvs); } private caller.hub_call_logic _hub_call_logic; } }
yinchunlong/abelkhan-1
servers/hub/hub/logicproxy.cs
C#
mit
647
@extends('protected.admin.master') @section('title', 'CRUD - Ampur') @section('content') @if (Session::has('flash_message')) <p>{{ Session::get('flash_message') }}</p> @endif <ol class="breadcrumb"> <li><a href="{{URL::to('database')}}">Database</a></li> <li class="active">tbl_province</li> </ol> <div class="pull-right"> <a href="{{{ URL::to('database/tbl_province/create') }}}" class="btn btn-small btn-info iframe"> <span class="glyphicon glyphicon-plus-sign"></span> Create</a> </div> <br> <div class="page-header"> </div> <table id="gridview" class="table table-striped table-hover table-condensed " > <thead> <tr> <th class="col-md-1">province_id</th> <th class="col-md-1">province_name</th> <th class="col-md-1">region_id</th> <th class="col-md-1"> </th> </tr> </thead> </table> @endsection {{-- Style --}} @section('style') {{ HTML::style('packages/datatables/css/dataTables.bootstrap.css')}} {{ HTML::style('packages/colorbox/css/colorbox.css')}} @endsection {{-- Scripts --}} @section('scripts') {{ HTML::script('packages/jquery/jquery.min.js'); }} {{ HTML::script('packages/bootstrap/js/bootstrap.min.js'); }} {{ HTML::script('packages/datatables/js/jquery.dataTables.min.js')}} {{ HTML::script('packages/datatables/js/dataTables.bootstrap.js')}} {{ HTML::script('packages/colorbox/js/jquery.colorbox.js')}} {{ HTML::script('packages/datatables/js/fnReloadAjax.js')}} {{ HTML::script('packages/bootbox/bootbox.min.js')}} <script type="text/javascript"> var oTable; $(document).ready(function() { oTable = $('#gridview').dataTable( { "sDom": "<'row'<'col-md-6'l><'col-md-6'f>r>t<'row'<'col-md-6'i><'col-md-6'p>>", "oLanguage": { "sLengthMenu": "_MENU_ records per page" }, "bProcessing": true, "bServerSide": true, "iDisplayLength": 25, "sAjaxSource": "{{ URL::to('database/tbl_province/data') }}", "fnDrawCallback": function ( oSettings ) { $(".iframe").colorbox({iframe:true, transition:"none", width:"80%", height:"80%", escKey: false, overlayClose: false}); } }); }); function Delete(id) { bootbox.confirm("<code>province_id "+id+" </code>will be deleted immediately. Are you sure you want to continue?", function(result) { if(result){ $.ajax( { url: 'tbl_province/'+id+'/delete', type: 'POST', success: function(result) { parent.oTable.fnReloadAjax(null,null,true); } }); }}); } </script> @endsection
i2x/raindb
app/views/crud/tbl_province/table.blade.php
PHP
mit
2,767
#include <bits/stdc++.h> using namespace std; using ull = unsigned long long; ull arr[int(1e5)+5]; int n, q, x; int bs(int key) { int l = 0, r = n-1, mid, ans=-1; while (l <= r) { mid = l + (r - l + 1)/2; if (arr[mid] == key) { r = mid - 1; ans = mid; } else if (arr[mid] < key) l = mid + 1; else r = mid - 1; } return ans; } int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n >> q; for (int i = 0; i < n; ++i) cin >> x, arr[i] = x + INT_MAX; for (int i = 0; i < q; ++i) { cin >> x; cout << bs(x + INT_MAX) << '\n'; } return 0; }
sazid/codes
problem_solving/vjudge/277066/a.cpp
C++
mit
581
var plain = require('./workers/plain.js'); var NodeMover = require('./modules/NodeMover').NodeMover; var PixiGraphics = require('./modules/PixiGraphics').PixiGraphics; module.exports.main = function () { var _layoutIterations = 1000; var _layoutStepsPerMessage = 25; //--simple frame-rate display for renders vs layouts var _counts = {renders: 0, layouts: 0, renderRate: 0, layoutRate: 0}; var $info = $('<div>').appendTo('body'); var startTime = new Date(); var _updateInfo = function () { var endTime = new Date(); var timeDiff = (endTime - startTime) / 1000; if (_counts.layouts < _layoutIterations) { _counts.layoutRate = _counts.layouts / timeDiff; } _counts.renderRate = _counts.renders / timeDiff; $info.text('Renders: ' + _counts.renders + ' (' + Math.round(_counts.renderRate) + ') | Layouts: ' + _counts.layouts + ' (' + Math.round(_counts.layoutRate) + ')'); }; var _nodeMovers = {}; $.getJSON('data/graph.json', function (jsonData) { jsonData.nodes.forEach(function (node, i) { var nodeMover = new NodeMover(); nodeMover.data('id', node.id); _nodeMovers[node.id] = nodeMover; }); var _layoutPositions = {}; function updatePos(ev) { _layoutPositions = ev.data; _counts.layouts = _layoutPositions.i; }; plain(jsonData); var graphics = new PixiGraphics(0.75, jsonData, function () { $.each(_nodeMovers, function (id, nodeMover) { if (_layoutPositions.nodePositions) { nodeMover.position(_layoutPositions.nodePositions[id]); nodeMover.animate(); } }); return _nodeMovers; }); function renderFrame() { plain.step(updatePos); graphics.renderFrame(); _counts.renders++; _updateInfo(); requestAnimFrame(renderFrame); } // begin animation loop: renderFrame(); }); };
anvaka/pixi-ngraph
index-plain.js
JavaScript
mit
2,108
# frozen_string_literal: true require "rails_helper" module Renalware describe Letters::PathologyLayout do subject(:layout) { described_class.new } describe "#each_group" do it "yields a block for each group of path description that should be displayed in a letter" do da = build_stubbed( :pathology_observation_description, letter_group: 1, letter_order: 1, code: "A" ) db = build_stubbed( :pathology_observation_description, letter_group: 1, letter_order: 2, code: "B" ) dc = build_stubbed( :pathology_observation_description, letter_group: 2, letter_order: 1, code: "C" ) layout.each_group do |group_number, descriptions| expect(descriptions).to eq([da, db]) if group_number == 1 expect(descriptions).to eq([dc]) if group_number == 2 end end end end end
airslie/renalware-core
spec/models/renalware/letters/pathology_layout_spec.rb
Ruby
mit
903
//////////////////////////////////////////////////////////////////////////////// // The MIT License (MIT) // // Copyright (c) 2021 Tim Stair // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. //////////////////////////////////////////////////////////////////////////////// namespace CardMaker.Events.Args { public delegate void IssueAdded(object sender, IssueMessageEventArgs args); public class IssueMessageEventArgs { public string Message { get; private set; } public IssueMessageEventArgs(string sMessage) { Message = sMessage; } } }
nhmkdev/cardmaker
CardMaker/Events/Args/IssueMessageEventArgs.cs
C#
mit
1,629
function SignupController() { // redirect to homepage when cancel button is clicked // $('#account-form-btn1').click(function(){ window.location.href = '/#section-3';}); // redirect to homepage on new account creation, add short delay so user can read alert window // $('.modal-alert #ok').click(function(){ setTimeout(function(){window.location.href = '/#';}, 300)}); }
lucianoportela/hiverbook
app/public/js/controllers/signupController.js
JavaScript
mit
374
'use strict'; function posix(path) { return path.charAt(0) === '/'; }; function win32(path) { // https://github.com/joyent/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56 var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; var result = splitDeviceRe.exec(path); var device = result[1] || ''; var isUnc = !!device && device.charAt(1) !== ':'; // UNC paths are always absolute return !!result[2] || isUnc; }; module.exports = process.platform === 'win32' ? win32 : posix; module.exports.posix = posix; module.exports.win32 = win32; //# sourceMappingURL=index-compiled.js.map
patelsan/fetchpipe
node_modules/fsevents/node_modules/node-pre-gyp/node_modules/rimraf/node_modules/glob/node_modules/path-is-absolute/index-compiled.js
JavaScript
mit
642
#!/Library/Frameworks/Python.framework/Versions/2.7/bin/python import numpy as np import sys import scipy from scipy import stats data_file = sys.argv[1] data = np.loadtxt(data_file) slope, intercept, r_value, p_value, std_err = stats.linregress(data[499:2499,0], data[499:2499,1]) nf = open('linear_reg.dat', 'w') nf.write("Linear Regression for data between %5d ps (frame: 499) and %5d ps (frame 2499) \n" %(data[499][0], data[2499][0])) nf.write("slope: %10.5E Angstrom^2 ps^-1 \n" %(slope)) nf.write("intercept: %10.5E Angstrom^2\n" %(intercept)) nf.write("R^2: %10.5f \n" %(r_value**2)) nf.write('Diffusion coeff: %10.5E Angstrom^2 ps^-1$ \n' %(slope/6.0)) nf.write('Diffusion coeff: %10.5E m^2 s^-1$ \n' %(slope*10**(-8)/6.0)) nf.close()
rbdavid/MolecDynamics
Analysis/MSD/slope.py
Python
mit
754
<?php $_lang['blockdown'] = 'EpicEditor for ContentBlocks'; $_lang['blockdown.description'] = 'Markdown Input Type powered by EpicEditor.'; $_lang['blockdown.theme_preview'] = 'Preview Theme'; $_lang['blockdown.theme_preview.description'] = 'The theme for the previewer.'; $_lang['blockdown.theme_editor'] = 'Theme Editor'; $_lang['blockdown.theme_editor.description'] = 'The theme for the editor which is the area you type into.'; $_lang['blockdown.togglePreview'] = 'Toggle Preview'; $_lang['blockdown.togglePreview.description'] = 'The tooltip text that appears when hovering the preview icon.'; $_lang['blockdown.toggleEdit'] = 'Toggle Edit'; $_lang['blockdown.toggleEdit.description'] = 'The tooltip text that appears when hovering the edit icon.'; $_lang['blockdown.toggleFullscreen'] = 'Toggle Fullscreen'; $_lang['blockdown.toggleFullscreen.description'] = 'The tooltip text that appears when hovering the fullscreen icon.';
jpdevries/blockdown
core/components/blockdown/lexicon/en/default.inc.php
PHP
mit
937
class String def tab(spaces=2) ' ' * spaces + self end def then_add(string) self << "\n#{string}" end end
nakajima/calendar-maker
lib/core_ext/string.rb
Ruby
mit
123
/* * cocos2d-x http://www.cocos2d-x.org * * Copyright (c) 2010-2014 - cocos2d-x community * Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. * * Portions Copyright (c) Microsoft Open Technologies, Inc. * All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and limitations under the License. */ #include "App.xaml.h" #include "OpenGLESPage.xaml.h" using namespace CocosAppWinRT; using namespace cocos2d; using namespace Platform; using namespace Concurrency; using namespace Windows::Foundation; using namespace Windows::Graphics::Display; using namespace Windows::System::Threading; using namespace Windows::UI::Core; using namespace Windows::UI::Input; using namespace Windows::UI::Xaml; using namespace Windows::UI::Xaml::Controls; using namespace Windows::UI::Xaml::Controls::Primitives; using namespace Windows::UI::Xaml::Data; using namespace Windows::UI::Xaml::Input; using namespace Windows::UI::Xaml::Media; using namespace Windows::UI::Xaml::Navigation; #if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) || _MSC_VER >= 1900 using namespace Windows::Phone::UI::Input; #endif OpenGLESPage::OpenGLESPage() : OpenGLESPage(nullptr) { } OpenGLESPage::OpenGLESPage(OpenGLES* openGLES) : mOpenGLES(openGLES), mRenderSurface(EGL_NO_SURFACE), mCoreInput(nullptr), mDpi(0.0f), mDeviceLost(false), mCursorVisible(true), mVisible(false), mOrientation(DisplayOrientations::Landscape) { InitializeComponent(); Windows::UI::Core::CoreWindow^ window = Windows::UI::Xaml::Window::Current->CoreWindow; window->VisibilityChanged += ref new Windows::Foundation::TypedEventHandler<Windows::UI::Core::CoreWindow^, Windows::UI::Core::VisibilityChangedEventArgs^>(this, &OpenGLESPage::OnVisibilityChanged); window->KeyDown += ref new TypedEventHandler<CoreWindow^, KeyEventArgs^>(this, &OpenGLESPage::OnKeyPressed); window->KeyUp += ref new TypedEventHandler<CoreWindow^, KeyEventArgs^>(this, &OpenGLESPage::OnKeyReleased); window->CharacterReceived += ref new TypedEventHandler<CoreWindow^, CharacterReceivedEventArgs^>(this, &OpenGLESPage::OnCharacterReceived); DisplayInformation^ currentDisplayInformation = DisplayInformation::GetForCurrentView(); currentDisplayInformation->OrientationChanged += ref new TypedEventHandler<DisplayInformation^, Object^>(this, &OpenGLESPage::OnOrientationChanged); mOrientation = currentDisplayInformation->CurrentOrientation; this->Loaded += ref new Windows::UI::Xaml::RoutedEventHandler(this, &OpenGLESPage::OnPageLoaded); #if _MSC_VER >= 1900 if (Windows::Foundation::Metadata::ApiInformation::IsTypePresent("Windows.UI.ViewManagement.StatusBar")) { Windows::UI::ViewManagement::StatusBar::GetForCurrentView()->HideAsync(); } if (Windows::Foundation::Metadata::ApiInformation::IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")) { HardwareButtons::BackPressed += ref new EventHandler<BackPressedEventArgs^>(this, &OpenGLESPage::OnBackButtonPressed); } #else #if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) Windows::UI::ViewManagement::StatusBar::GetForCurrentView()->HideAsync(); HardwareButtons::BackPressed += ref new EventHandler<BackPressedEventArgs^>(this, &OpenGLESPage::OnBackButtonPressed); #else // Disable all pointer visual feedback for better performance when touching. // This is not supported on Windows Phone applications. auto pointerVisualizationSettings = Windows::UI::Input::PointerVisualizationSettings::GetForCurrentView(); pointerVisualizationSettings->IsContactFeedbackEnabled = false; pointerVisualizationSettings->IsBarrelButtonFeedbackEnabled = false; #endif #endif CreateInput(); } void OpenGLESPage::CreateInput() { // Register our SwapChainPanel to get independent input pointer events auto workItemHandler = ref new WorkItemHandler([this](IAsyncAction ^) { // The CoreIndependentInputSource will raise pointer events for the specified device types on whichever thread it's created on. mCoreInput = swapChainPanel->CreateCoreIndependentInputSource( Windows::UI::Core::CoreInputDeviceTypes::Mouse | Windows::UI::Core::CoreInputDeviceTypes::Touch | Windows::UI::Core::CoreInputDeviceTypes::Pen ); // Register for pointer events, which will be raised on the background thread. mCoreInput->PointerPressed += ref new TypedEventHandler<Object^, PointerEventArgs^>(this, &OpenGLESPage::OnPointerPressed); mCoreInput->PointerMoved += ref new TypedEventHandler<Object^, PointerEventArgs^>(this, &OpenGLESPage::OnPointerMoved); mCoreInput->PointerReleased += ref new TypedEventHandler<Object^, PointerEventArgs^>(this, &OpenGLESPage::OnPointerReleased); mCoreInput->PointerWheelChanged += ref new TypedEventHandler<Object^, PointerEventArgs^>(this, &OpenGLESPage::OnPointerWheelChanged); if (GLViewImpl::sharedOpenGLView() && !GLViewImpl::sharedOpenGLView()->isCursorVisible()) { mCoreInput->PointerCursor = nullptr; } // Begin processing input messages as they're delivered. mCoreInput->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessUntilQuit); }); // Run task on a dedicated high priority background thread. mInputLoopWorker = ThreadPool::RunAsync(workItemHandler, WorkItemPriority::High, WorkItemOptions::TimeSliced); } OpenGLESPage::~OpenGLESPage() { StopRenderLoop(); DestroyRenderSurface(); } void OpenGLESPage::OnPageLoaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) { // The SwapChainPanel has been created and arranged in the page layout, so EGL can be initialized. CreateRenderSurface(); StartRenderLoop(); mVisible = true; } void OpenGLESPage::CreateRenderSurface() { if (mOpenGLES && mRenderSurface == EGL_NO_SURFACE) { // The app can configure the SwapChainPanel which may boost performance. // By default, this template uses the default configuration. mRenderSurface = mOpenGLES->CreateSurface(swapChainPanel, nullptr, nullptr); // You can configure the SwapChainPanel to render at a lower resolution and be scaled up to // the swapchain panel size. This scaling is often free on mobile hardware. // // One way to configure the SwapChainPanel is to specify precisely which resolution it should render at. // Size customRenderSurfaceSize = Size(800, 600); // mRenderSurface = mOpenGLES->CreateSurface(swapChainPanel, &customRenderSurfaceSize, nullptr); // // Another way is to tell the SwapChainPanel to render at a certain scale factor compared to its size. // e.g. if the SwapChainPanel is 1920x1280 then setting a factor of 0.5f will make the app render at 960x640 // float customResolutionScale = 0.5f; // mRenderSurface = mOpenGLES->CreateSurface(swapChainPanel, nullptr, &customResolutionScale); // } } void OpenGLESPage::DestroyRenderSurface() { if (mOpenGLES) { mOpenGLES->DestroySurface(mRenderSurface); } mRenderSurface = EGL_NO_SURFACE; } void OpenGLESPage::RecoverFromLostDevice() { critical_section::scoped_lock lock(mRenderSurfaceCriticalSection); DestroyRenderSurface(); mOpenGLES->Reset(); CreateRenderSurface(); std::unique_lock<std::mutex> locker(mSleepMutex); mDeviceLost = false; mSleepCondition.notify_one(); } void OpenGLESPage::TerminateApp() { { critical_section::scoped_lock lock(mRenderSurfaceCriticalSection); if (mOpenGLES) { mOpenGLES->DestroySurface(mRenderSurface); mOpenGLES->Cleanup(); } } Windows::UI::Xaml::Application::Current->Exit(); } void OpenGLESPage::StartRenderLoop() { // If the render loop is already running then do not start another thread. if (mRenderLoopWorker != nullptr && mRenderLoopWorker->Status == Windows::Foundation::AsyncStatus::Started) { return; } DisplayInformation^ currentDisplayInformation = DisplayInformation::GetForCurrentView(); mDpi = currentDisplayInformation->LogicalDpi; auto dispatcher = Windows::UI::Xaml::Window::Current->CoreWindow->Dispatcher; // Create a task for rendering that will be run on a background thread. auto workItemHandler = ref new Windows::System::Threading::WorkItemHandler([this, dispatcher](Windows::Foundation::IAsyncAction ^ action) { mOpenGLES->MakeCurrent(mRenderSurface); GLsizei panelWidth = 0; GLsizei panelHeight = 0; mOpenGLES->GetSurfaceDimensions(mRenderSurface, &panelWidth, &panelHeight); if (mRenderer.get() == nullptr) { mRenderer = std::make_shared<Cocos2dRenderer>(panelWidth, panelHeight, mDpi, mOrientation, dispatcher, swapChainPanel); } mRenderer->Resume(); while (action->Status == Windows::Foundation::AsyncStatus::Started) { if (!mVisible) { mRenderer->Pause(); } // wait until app is visible again or thread is cancelled while (!mVisible) { std::unique_lock<std::mutex> lock(mSleepMutex); mSleepCondition.wait(lock); if (action->Status != Windows::Foundation::AsyncStatus::Started) { return; // thread was cancelled. Exit thread } if (mVisible) { mRenderer->Resume(); } else // spurious wake up { continue; } } mOpenGLES->GetSurfaceDimensions(mRenderSurface, &panelWidth, &panelHeight); mRenderer.get()->Draw(panelWidth, panelHeight, mDpi, mOrientation); // Recreate input dispatch if (GLViewImpl::sharedOpenGLView() && mCursorVisible != GLViewImpl::sharedOpenGLView()->isCursorVisible()) { CreateInput(); mCursorVisible = GLViewImpl::sharedOpenGLView()->isCursorVisible(); } if (mRenderer->AppShouldExit()) { // run on main UI thread swapChainPanel->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::High, ref new DispatchedHandler([=]() { TerminateApp(); })); return; } EGLBoolean result = GL_FALSE; { critical_section::scoped_lock lock(mRenderSurfaceCriticalSection); result = mOpenGLES->SwapBuffers(mRenderSurface); } if (result != GL_TRUE) { // The call to eglSwapBuffers was not be successful (i.e. due to Device Lost) // If the call fails, then we must reinitialize EGL and the GL resources. mRenderer->Pause(); mDeviceLost = true; // XAML objects like the SwapChainPanel must only be manipulated on the UI thread. swapChainPanel->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::High, ref new Windows::UI::Core::DispatchedHandler([=]() { RecoverFromLostDevice(); }, CallbackContext::Any)); // wait until OpenGL is reset or thread is cancelled while (mDeviceLost) { std::unique_lock<std::mutex> lock(mSleepMutex); mSleepCondition.wait(lock); if (action->Status != Windows::Foundation::AsyncStatus::Started) { return; // thread was cancelled. Exit thread } if (!mDeviceLost) { mOpenGLES->MakeCurrent(mRenderSurface); // restart cocos2d-x mRenderer->DeviceLost(); } else // spurious wake up { continue; } } } } }); // Run task on a dedicated high priority background thread. mRenderLoopWorker = Windows::System::Threading::ThreadPool::RunAsync(workItemHandler, Windows::System::Threading::WorkItemPriority::High, Windows::System::Threading::WorkItemOptions::TimeSliced); } void OpenGLESPage::StopRenderLoop() { if (mRenderLoopWorker) { mRenderLoopWorker->Cancel(); std::unique_lock<std::mutex> locker(mSleepMutex); mSleepCondition.notify_one(); mRenderLoopWorker = nullptr; } } void OpenGLESPage::OnPointerPressed(Object^ sender, PointerEventArgs^ e) { bool isMouseEvent = e->CurrentPoint->PointerDevice->PointerDeviceType == Windows::Devices::Input::PointerDeviceType::Mouse; if (mRenderer) { mRenderer->QueuePointerEvent(isMouseEvent ? PointerEventType::MousePressed : PointerEventType::PointerPressed, e); } } void OpenGLESPage::OnPointerMoved(Object^ sender, PointerEventArgs^ e) { bool isMouseEvent = e->CurrentPoint->PointerDevice->PointerDeviceType == Windows::Devices::Input::PointerDeviceType::Mouse; if (mRenderer) { mRenderer->QueuePointerEvent(isMouseEvent ? PointerEventType::MouseMoved : PointerEventType::PointerMoved, e); } } void OpenGLESPage::OnPointerReleased(Object^ sender, PointerEventArgs^ e) { bool isMouseEvent = e->CurrentPoint->PointerDevice->PointerDeviceType == Windows::Devices::Input::PointerDeviceType::Mouse; if (mRenderer) { mRenderer->QueuePointerEvent(isMouseEvent ? PointerEventType::MouseReleased : PointerEventType::PointerReleased, e); } } void OpenGLESPage::OnPointerWheelChanged(Object^ sender, PointerEventArgs^ e) { bool isMouseEvent = e->CurrentPoint->PointerDevice->PointerDeviceType == Windows::Devices::Input::PointerDeviceType::Mouse; if (mRenderer && isMouseEvent) { mRenderer->QueuePointerEvent(PointerEventType::MouseWheelChanged, e); } } void OpenGLESPage::OnKeyPressed(CoreWindow^ sender, KeyEventArgs^ e) { //log("OpenGLESPage::OnKeyPressed %d", e->VirtualKey); if (mRenderer) { mRenderer->QueueKeyboardEvent(WinRTKeyboardEventType::KeyPressed, e); } } void OpenGLESPage::OnCharacterReceived(CoreWindow^ sender, CharacterReceivedEventArgs^ e) { #if 0 if (!e->KeyStatus.WasKeyDown) { log("OpenGLESPage::OnCharacterReceived %d", e->KeyCode); } #endif } void OpenGLESPage::OnKeyReleased(CoreWindow^ sender, KeyEventArgs^ e) { //log("OpenGLESPage::OnKeyReleased %d", e->VirtualKey); if (mRenderer) { mRenderer->QueueKeyboardEvent(WinRTKeyboardEventType::KeyReleased, e); } } void OpenGLESPage::OnOrientationChanged(DisplayInformation^ sender, Object^ args) { mOrientation = sender->CurrentOrientation; } void OpenGLESPage::SetVisibility(bool isVisible) { if (isVisible && mRenderSurface != EGL_NO_SURFACE) { if (!mVisible) { std::unique_lock<std::mutex> locker(mSleepMutex); mVisible = true; mSleepCondition.notify_one(); } } else { mVisible = false; } } void OpenGLESPage::OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args) { if (args->Visible && mRenderSurface != EGL_NO_SURFACE) { SetVisibility(true); } else { SetVisibility(false); } } #if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) || _MSC_VER >= 1900 /* We set args->Handled = true to prevent the app from quitting when the back button is pressed. This is because this back button event happens on the XAML UI thread and not the cocos2d-x UI thread. We need to give the game developer a chance to decide to exit the app depending on where they are in their game. They can receive the back button event by listening for the EventKeyboard::KeyCode::KEY_ESCAPE event. The default behavior is to exit the app if the EventKeyboard::KeyCode::KEY_ESCAPE event is not handled by the game. */ void OpenGLESPage::OnBackButtonPressed(Object^ sender, BackPressedEventArgs^ args) { if (mRenderer) { mRenderer->QueueBackButtonEvent(); args->Handled = true; } } #endif
ecmas/cocos2d
cocos/platform/win8.1-universal/OpenGLESPage.xaml.cpp
C++
mit
16,993
import {Component, ViewEncapsulation, ViewChild, ElementRef} from '@angular/core'; import {InteractivityChecker} from './interactivity-checker'; /** * Directive for trapping focus within a region. * * NOTE: This directive currently uses a very simple (naive) approach to focus trapping. * It assumes that the tab order is the same as DOM order, which is not necessarily true. * Things like tabIndex > 0, flex `order`, and shadow roots can cause to two to misalign. * This will be replaced with a more intelligent solution before the library is considered stable. */ @Component({ moduleId: module.id, selector: 'focus-trap', templateUrl: 'focus-trap.html', encapsulation: ViewEncapsulation.None, }) export class FocusTrap { @ViewChild('trappedContent') trappedContent: ElementRef; constructor(private _checker: InteractivityChecker) { } /** Focuses the first tabbable element within the focus trap region. */ focusFirstTabbableElement() { let rootElement = this.trappedContent.nativeElement; let redirectToElement = rootElement.querySelector('[md-focus-start]') as HTMLElement || this._getFirstTabbableElement(rootElement); if (redirectToElement) { redirectToElement.focus(); } } /** Focuses the last tabbable element within the focus trap region. */ focusLastTabbableElement() { let rootElement = this.trappedContent.nativeElement; let focusTargets = rootElement.querySelectorAll('[md-focus-end]'); let redirectToElement: HTMLElement = null; if (focusTargets.length) { redirectToElement = focusTargets[focusTargets.length - 1] as HTMLElement; } else { redirectToElement = this._getLastTabbableElement(rootElement); } if (redirectToElement) { redirectToElement.focus(); } } /** Get the first tabbable element from a DOM subtree (inclusive). */ private _getFirstTabbableElement(root: HTMLElement): HTMLElement { if (this._checker.isFocusable(root) && this._checker.isTabbable(root)) { return root; } // Iterate in DOM order. let childCount = root.children.length; for (let i = 0; i < childCount; i++) { let tabbableChild = this._getFirstTabbableElement(root.children[i] as HTMLElement); if (tabbableChild) { return tabbableChild; } } return null; } /** Get the last tabbable element from a DOM subtree (inclusive). */ private _getLastTabbableElement(root: HTMLElement): HTMLElement { if (this._checker.isFocusable(root) && this._checker.isTabbable(root)) { return root; } // Iterate in reverse DOM order. for (let i = root.children.length - 1; i >= 0; i--) { let tabbableChild = this._getLastTabbableElement(root.children[i] as HTMLElement); if (tabbableChild) { return tabbableChild; } } return null; } }
metaory/md2
src/lib/core/a11y/focus-trap.ts
TypeScript
mit
2,877
declare interface KernelOpts { // } declare interface StonehengeOpts { // } declare namespace NodeJS { interface Global { kernel: StonehengeKernel opts: StonehengeOpts hardReset: () => void } } // Extended Screeps globals interface Memory { pidCounter: number kernel: KernelMemory stats: any }
resir014/screeps
src/includes/globals.d.ts
TypeScript
mit
324
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe Cart do before :each do cart_item = Cart.new :product_id => 18, :unit_price => 6.50, :quantity => 7, :session_id => 999 cart_item2 = Cart.new :product_id => 29, :unit_price => 12.50, :quantity => 10, :session_id => 999 cart_item.save cart_item2.save end it { should belong_to :product } it "should get the right total" do expect(described_class.total(999)).to eq(170.50) end it "should have the correct items" do described_class.any_instance.stub(:as_json).and_return('product' => {'name' => 'Soap','description' => "Some desc" }, 'quantity' => 10, 'unit_price' => 5 ) result = [{:name=>"Soap", :description=>"Some desc", :quantity=>10, :amount=>50}, {:name=>"Soap", :description=>"Some desc", :quantity=>10, :amount=>50}] expect(described_class.items_in_cart(999)).to eq(result) end end
chugh97/eshop
spec/models/cart_spec.rb
Ruby
mit
1,034
require 'metricity-server/version' require 'metricity-server/log' require 'metricity-server/config' require 'metricity-server/daemon' require 'metricity-server/metric' require 'metricity-server/receiver' require 'metricity-server/dashboard' module Metricity # Server module Server end end
VvanGemert/metricity-server
lib/metricity_server.rb
Ruby
mit
296
#include <algorithm> #include <utility> #include "ini_doc.hpp" namespace Utility { namespace { std::string& trim(std::string& str) { auto pos = str.find_first_not_of(" \t"); str.erase(0, pos); pos = str.find_last_not_of(" \t"); if (pos != str.npos) { str.erase(pos + 1); } return str; } IniDoc::Section::value_type parseParameter(std::string& line) { auto pos = line.find('='); if (pos == line.npos) { throw InvalidIniDoc(std::string("Invalid parameter: \"").append(line).append("\"")); } std::string parameterName = line.substr(0, pos); IniDoc::Property parameterValue{line.substr(pos + 1)}; return std::make_pair(std::move(parameterName), std::move(parameterValue)); } void writeSection(std::ostream& os, const IniDoc::Section& section) { for (const auto& propertyPair : section) { os << propertyPair.first << "=" << propertyPair.second.string() << std::endl; } os << std::endl; } } // void IniDoc::Property::syncStr() const { if (strSync_) return; str_.clear(); if (!items_.empty()) { auto itbeg = items_.cbegin(); str_.append(getValue<std::string>(*itbeg++)); std::for_each(itbeg, items_.cend(), [this](const value_type& item){ str_.append(1, ',').append(item); }); } strSync_ = true; } void IniDoc::Property::syncItems() const { if (itemsSync_) return; Cont_ value; auto itbeg = str_.cbegin(); auto itend = str_.cend(); auto it0 = itbeg; decltype(it0) it1; items_.clear(); do { it1 = std::find(it0, itend, ','); items_.emplace_back(it0, it1); it0 = it1; } while (it1 != itend && ++it0 != itbeg); itemsSync_ = true; } void IniDoc::merge(const IniDoc &toMerge, DuplicateAction daction) { const auto& rdoc = toMerge.doc(); for (const auto& rs: rdoc) { if (!doc_.count(rs.first) || daction == DuplicateAction::overwriteSection) { doc_[rs.first] = rs.second; } else { auto& s = doc_[rs.first]; for (const auto& rp: rs.second) { if (!s.count(rp.first) || daction == DuplicateAction::overwriteProperty) { s[rp.first] = rp.second; } else if (daction == DuplicateAction::combineProperty) { auto& is = s[rp.first].items(); for (const auto& ri: rp.second.items()) { is.push_back(ri); } } else if (daction == DuplicateAction::fail) { throw std::runtime_error(std::string{ "duplicated property: \""}.append(rp.first).append("\" in section \"").append(rp.first)); } } } } } std::istream& read(std::istream& is, IniDoc& inidoc) { auto& doc = inidoc.doc(); IniDoc::SectionName sname{}; doc[sname]; for (std::string line; std::getline(is, line);) { // trim line trim(line); // skip empty and comments if (line.empty() || line[0] == ';') { continue; } if (*line.cbegin() == '[') { if (*line.crbegin() != ']') { throw InvalidIniDoc(std::string("Invalid line: \"").append(line).append("\"")); } doc[sname = line.substr(1, line.size() - 2)]; continue; } doc[sname].insert(parseParameter(line)); } return is; } std::ostream& write(std::ostream& os, const IniDoc& inidoc) { const auto& doc = inidoc.doc(); if (doc.empty()) { return os; } auto it = doc.cbegin(); if (it->first.empty()) { // default section writeSection(os, it->second); ++it; } std::for_each(it, doc.cend(), [&os](const IniDoc::Doc::value_type& sectionPair) { os << "[" << sectionPair.first << "]" << std::endl; writeSection(os, sectionPair.second); }); return os; } } // Utility
gonmator/busplan
utility/ini_doc.cpp
C++
mit
4,058
require "active_model" class Document include ActiveModel::Model attr_accessor( :title, :description, :base_path, :public_updated_at, :end_date, :change_note, :format, :content_store_document_type, :organisations, :image_url, ) end
alphagov/collections
app/models/document.rb
Ruby
mit
280
import angular from 'angular'; import uiRouter from 'angular-ui-router'; import uiBoostrap from 'angular-ui-bootstrap'; import angularJwt from 'angular-jwt'; let librariesModules = angular.module('app.libraries', [ uiRouter, uiBoostrap, angularJwt ]); export default librariesModules;
brahian609/tenant-company
app/app.libraries.js
JavaScript
mit
303
require 'mock/bot/server_mock' require 'mock/bot/role_mock' require 'mock/bot/channel_mock' require 'mock/bot/command_mock' require 'mock/bot/command_event_mock' require 'mock/bot/log_events_mock' module Mock class CommandBot def initialize @commands = {} end def command(name, *attributes, &block) @commands[name] = Command.new(name, attributes, block) end def call(command, args) @commands[command].call(CommandEvent.new, args) end def sync; end def member_join(&block) event = MemberJoinEvent.new block.call(event) end end end
Madobe/shimapan
spec/mock/command_bot.rb
Ruby
mit
605
package cn.newcapec.jwxt.jcxxgl.model; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; /** * JwxtPkxtBjkb entity. @author MyEclipse Persistence Tools */ @Entity @Table(name="JWXT_PKXT_BJKB" ,schema="JWXT" ) public class JwxtPkxtBjkb extends cn.newcapec.function.digitalcampus.common.model.AbstractModel implements java.io.Serializable { // Fields private String id; private String xnxqid; private String pkjxbid; private String bz; private String cjr; private String jlssdw; private Date whsj; private Date cjsj; // Constructors /** default constructor */ public JwxtPkxtBjkb() { } /** minimal constructor */ public JwxtPkxtBjkb(String id, String xnxqid, String pkjxbid, String cjr, String jlssdw, Date cjsj) { this.id = id; this.xnxqid = xnxqid; this.pkjxbid = pkjxbid; this.cjr = cjr; this.jlssdw = jlssdw; this.cjsj = cjsj; } /** full constructor */ public JwxtPkxtBjkb(String id, String xnxqid, String pkjxbid, String bz, String cjr, String jlssdw, Date whsj, Date cjsj) { this.id = id; this.xnxqid = xnxqid; this.pkjxbid = pkjxbid; this.bz = bz; this.cjr = cjr; this.jlssdw = jlssdw; this.whsj = whsj; this.cjsj = cjsj; } // Property accessors @Id @Column(name="ID", unique=true, nullable=false, length=32) public String getId() { return this.id; } public void setId(String id) { this.id = id; } @Column(name="XNXQID", nullable=false, length=32) public String getXnxqid() { return this.xnxqid; } public void setXnxqid(String xnxqid) { this.xnxqid = xnxqid; } @Column(name="PKJXBID", nullable=false, length=32) public String getPkjxbid() { return this.pkjxbid; } public void setPkjxbid(String pkjxbid) { this.pkjxbid = pkjxbid; } @Column(name="BZ", length=2000) public String getBz() { return this.bz; } public void setBz(String bz) { this.bz = bz; } @Column(name="CJR", nullable=false, length=32) public String getCjr() { return this.cjr; } public void setCjr(String cjr) { this.cjr = cjr; } @Column(name="JLSSDW", nullable=false, length=32) public String getJlssdw() { return this.jlssdw; } public void setJlssdw(String jlssdw) { this.jlssdw = jlssdw; } @Temporal(TemporalType.DATE) @Column(name="WHSJ", length=7) public Date getWhsj() { return this.whsj; } public void setWhsj(Date whsj) { this.whsj = whsj; } @Temporal(TemporalType.DATE) @Column(name="CJSJ", nullable=false, length=7) public Date getCjsj() { return this.cjsj; } public void setCjsj(Date cjsj) { this.cjsj = cjsj; } }
3203317/2013
nsp/digitalcampus/JWXT/Develop/trunk/project/cn.newcapec.function.digitalcampus.jwxt.jcxxgl/src/main/java/cn/newcapec/jwxt/jcxxgl/model/JwxtPkxtBjkb.java
Java
mit
3,186
#!/usr/bin/env python3 import sys import os import urllib.request import path_utils # credit: https://stackoverflow.com/questions/22676/how-to-download-a-file-over-http def download_url(source_url, target_path): if os.path.exists(target_path): return False, "Target path [%s] already exists" % target_path contents = None try: with urllib.request.urlopen(source_url) as f: contents = f.read().decode("utf8") except urllib.error.HTTPError as httpex: return False, "Downloading failed: [%s]" % httpex with open(target_path, "w") as f: f.write(contents) return True, None def puaq(): print("Usage: %s source_url target_path" % path_utils.basename_filtered(__file__)) sys.exit(1) if __name__ == "__main__": if len(sys.argv) < 3: puaq() source_url = sys.argv[1] target_path = sys.argv[2] v, r = download_url(source_url, target_path) if not v: print(r) sys.exit(1)
mvendra/mvtools
download_url.py
Python
mit
992
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Security\Core\User; use Symfony\Component\Security\Core\Role\Role; /** * Represents the interface that all user classes must implement. * * This interface is useful because the authentication layer can deal with * the object through its lifecycle, using the object to get the encoded * password (for checking against a submitted password), assigning roles * and so on. * * Regardless of how your user are loaded or where they come from (a database, * configuration, web service, etc), you will have a class that implements * this interface. Objects that implement this interface are created and * loaded by different objects that implement UserProviderInterface * * @see UserProviderInterface * * @author Fabien Potencier <fabien@symfony.com> */ interface UserInterface { /** * Returns the roles granted to the user. * * public function getRoles() * { * return ['ROLE_USER']; * } * * Alternatively, the roles might be stored on a ``roles`` property, * and populated in any number of different ways when the user object * is created. * * @return (Role|string)[] The user roles */ public function getRoles(); /** * Returns the password used to authenticate the user. * * This should be the encoded password. On authentication, a plain-text * password will be salted, encoded, and then compared to this value. * * @return string|null The encoded password if any */ public function getPassword(); /** * Returns the salt that was originally used to encode the password. * * This can return null if the password was not encoded using a salt. * * @return string|null The salt */ public function getSalt(); /** * Returns the username used to authenticate the user. * * @return string The username */ public function getUsername(); /** * Removes sensitive data from the user. * * This is important if, at any given point, sensitive information like * the plain-text password is stored on this object. */ public function eraseCredentials(); }
zcodes/symfony
src/Symfony/Component/Security/Core/User/UserInterface.php
PHP
mit
2,456
ar_menu=new Array('downloaded','featured','popular','new','free','random'); str=1; id_component=0; ctype_component=""; flag_auto=true; res=""; function zcomponent(id,ctype,page) { if(id!=id_component) { document.getElementById('home_boxes').innerHTML = ""; } str=page; var req = new JsHttpRequest(); // Code automatically called on load finishing. req.onreadystatechange = function() { if (req.readyState == 4) { for(i=0;i<ar_menu.length;i++) { if(ar_menu[i]==ctype) { document.getElementById('menu_'+ctype).className="tact"; } else { document.getElementById('menu_'+ar_menu[i]).className="tact2"; } } if(page==1) { document.getElementById('home_boxes').innerHTML =req.responseText; res=req.responseText; check_carts(''); } else { document.getElementById('home_boxes').innerHTML = document.getElementById('home_boxes').innerHTML + req.responseText; res=req.responseText; check_carts(''); } $('#home_boxes').masonry({ itemSelector: '.home_box' }); $('#home_boxes').masonry('reload') ; $('.home_preview').each(function(){ $(this).animate({opacity:'1.0'},1); $(this).mouseover(function(){ $(this).stop().animate({opacity:'0.6'},600); }); $(this).mouseout(function(){ $(this).stop().animate({opacity:'1.0'},300); }); $(".hb_cart").mouseover(function(){ $(this).stop().animate({ opacity: 1}, 600); }); $(".hb_cart").mouseout(function(){ $(this).stop().animate({ opacity: 0.5}, 600); }); $(".hb_lightbox").mouseover(function(){ $(this).stop().animate({ opacity: 1}, 600); }); $(".hb_lightbox").mouseout(function(){ $(this).stop().animate({ opacity: 0.5}, 600); }); $(".hb_free").mouseover(function(){ $(this).stop().animate({ opacity: 1}, 600); }); $(".hb_free").mouseout(function(){ $(this).stop().animate({ opacity: 0.5}, 600); }); }); } } req.open(null, 'members/component_light2.php', true); req.send( {id: id, ctype: ctype,str: str} ); str++; id_component=id; ctype_component=ctype; } $(document).ready(function(){ $(window).scroll(function(){ if($(document).height() - $(window).height() - $(window).scrollTop() <150) { if(str!=1 && flag_auto) { flag_auto=false; if(res!="") { //zcomponent(id_component,ctype_component,str); } } } else { flag_auto=true; } }); $('#slides').superslides({ slide_easing: 'easeInOutCubic', slide_speed: 800, pagination: false, hashchange: true, scrollable: false, inherit_width_from: '#wrapper_slideshow', inherit_height_from: '#wrapper_slideshow', animation:'fade', play:5000 }); $(".prev1").css({ opacity: 0.5}); $(".next1").css({ opacity: 0.5}); $(".next1").mouseover(function(){ $(this).stop().animate({ opacity: 1}, 600); }); $(".next1").mouseout(function(){ $(this).stop().animate({ opacity: 0.5}, 600); }); $(".prev1").mouseover(function(){ $(this).stop().animate({ opacity: 1}, 600); }); $(".prev1").mouseout(function(){ $(this).stop().animate({ opacity: 0.5}, 600); }); });
binidini/mstock
templates/template22/custom_home.js
JavaScript
mit
3,484
// <copyright file="Delegates.cs" company="Autonomic Systems, Quamotion"> // Copyright (c) Autonomic Systems. All rights reserved. // Copyright (c) Quamotion. All rights reserved. // </copyright> using System; using System.Runtime.InteropServices; namespace TurboJpegWrapper { /// <summary> /// A callback function that can be used to modify the DCT coefficients /// after they are losslessly transformed but before they are transcoded to a /// new JPEG image. This allows for custom filters or other transformations /// to be applied in the frequency domain. /// </summary> /// <param name="coeffs"> /// Pointer to an array of transformed DCT coefficients. (NOTE /// this pointer is not guaranteed to be valid once the callback returns, so /// applications wishing to hand off the DCT coefficients to another function /// or library should make a copy of them within the body of the callback.) /// </param> /// <param name="arrayRegion"> /// <see cref="TJRegion"/> structure containing the width and height of /// the array pointed to by <paramref name="coeffs"/> as well as its offset relative to /// the component plane. TurboJPEG implementations may choose to split each /// component plane into multiple DCT coefficient arrays and call the callback /// function once for each array. /// </param> /// <param name="planeRegion"> /// <see cref="TJRegion"/> structure containing the width and height of /// the component plane to which <paramref name="coeffs"/> belongs. /// </param> /// <param name="componentIndex"> /// ID number of the component plane to which /// <paramref name="coeffs"/> belongs (Y, Cb, and Cr have, respectively, ID's of 0, 1, /// and 2 in typical JPEG images.) /// </param> /// <param name="transformIndex"> /// ID number of the transformed image to which /// <paramref name="coeffs"/> belongs. This is the same as the index of the transform /// in the "transforms" array that was passed to <see cref="TurboJpegImport.TjTransform"/>. /// </param> /// <param name="transform"> /// A pointer to a <see cref="TjTransform"/> structure that specifies the /// parameters and/or cropping region for this transform. /// </param> /// <returns>0 if the callback was successful, or -1 if an error occurred.</returns> /// <remarks> /// Original signature is: /// <para><c>int customFilter(short *coeffs, tjregion arrayRegion, tjregion planeRegion, int componentIndex, int transformIndex, struct tjtransform * transform)</c>.</para> /// </remarks> public delegate int CustomFilter(IntPtr coeffs, IntPtr arrayRegion, IntPtr planeRegion, int componentIndex, int transformIndex, IntPtr transform); }
qmfrederik/AS.TurboJpegWrapper
Quamotion.TurboJpegWrapper/Delegates.cs
C#
mit
2,790
import Ember from 'ember'; import config from './config/environment'; import googlePageview from './mixins/google-pageview'; const Router = Ember.Router.extend(googlePageview, { location: config.locationType }); Router.map(function() { this.route('routes', function(){ this.route('route', { path: "/:route-id" }); this.route('loading'); }); this.route('stops', function(){ this.route('by-frequency'); this.route('walkshed'); this.route('transitshed'); this.route('stop', { path: "/:stop-id" }); }); this.route('operators', function(){ this.route('service-areas'); this.route('operator', { path: "/:operator-id" }); }); this.route('route-stop-patterns', function(){ }); this.route('error', { path: "*path" }); this.route('isochrones'); this.route('map-matching'); }); export default Router;
mapzen/mobility-explorer
app/router.js
JavaScript
mit
862
# Plot histogram import os import numpy as np from plantcv.plantcv.threshold import binary as binary_threshold from plantcv.plantcv import params from plantcv.plantcv import fatal_error from plantcv.plantcv._debug import _debug import pandas as pd from plotnine import ggplot, aes, geom_line, labels, scale_color_manual def _hist_gray(gray_img, bins, lower_bound, upper_bound, mask=None): """ Prepare the ready to plot histogram data Inputs: gray_img = grayscale image to analyze bins = divide the data into n evenly spaced bins lower_bound = the lower bound of the bins (x-axis min value) upper_bound = the upper bound of the bins (x-axis max value) mask = binary mask, calculate histogram from masked area only (default=None) Returns: bin_labels = an array of histogram bin labels hist_percent = an array of histogram represented by percent values hist_gray_data = an array of histogram (original values) :param gray_img: numpy.ndarray :param bins: int :param lower_bound: int :param upper_bound: int :param mask: numpy.ndarray :return bin_labels: numpy.ndarray :return hist_percent: numpy.ndarray :return hist_gray_data: numpy.ndarray """ params.device += 1 debug = params.debug # Apply mask if one is supplied if mask is not None: min_val = np.min(gray_img) pixels = len(np.where(mask > 0)[0]) # apply plant shaped mask to image params.debug = None mask1 = binary_threshold(mask, 0, 255, 'light') mask1 = (mask1 / 255) masked = np.where(mask1 != 0, gray_img, min_val - 5000) else: pixels = gray_img.shape[0] * gray_img.shape[1] masked = gray_img params.debug = debug # Store histogram data hist_gray_data, hist_bins = np.histogram(masked, bins, (lower_bound, upper_bound)) # make hist percentage for plotting hist_percent = (hist_gray_data / float(pixels)) * 100 # use middle value of every bin as bin label bin_labels = np.array([np.average([hist_bins[i], hist_bins[i+1]]) for i in range(0, len(hist_bins) - 1)]) return bin_labels, hist_percent, hist_gray_data # hist_data = pd.DataFrame({'pixel intensity': bin_labels, 'proportion of pixels (%)': hist_percent}) # return hist_data def histogram(img, mask=None, bins=100, lower_bound=None, upper_bound=None, title=None, hist_data=False): """Plot histograms of each input image channel Inputs: img = an RGB or grayscale image to analyze mask = binary mask, calculate histogram from masked area only (default=None) bins = divide the data into n evenly spaced bins (default=100) lower_bound = the lower bound of the bins (x-axis min value) (default=None) upper_bound = the upper bound of the bins (x-axis max value) (default=None) title = a custom title for the plot (default=None) hist_data = return the frequency distribution data if True (default=False) Returns: fig_hist = histogram figure hist_df = dataframe with histogram data, with columns "pixel intensity" and "proportion of pixels (%)" :param img: numpy.ndarray :param mask: numpy.ndarray :param bins: int :param lower_bound: int :param upper_bound: int :param title: str :param hist_data: bool :return fig_hist: plotnine.ggplot.ggplot :return hist_df: pandas.core.frame.DataFrame """ if not isinstance(img, np.ndarray): fatal_error("Only image of type numpy.ndarray is supported input!") if len(img.shape) < 2: fatal_error("Input image should be at least a 2d array!") if mask is not None: masked = img[np.where(mask > 0)] img_min, img_max = np.nanmin(masked), np.nanmax(masked) else: img_min, img_max = np.nanmin(img), np.nanmax(img) # for lower / upper bound, if given, use the given value, otherwise, use the min / max of the image lower_bound = lower_bound if lower_bound is not None else img_min upper_bound = upper_bound if upper_bound is not None else img_max if len(img.shape) > 2: if img.shape[2] == 3: b_names = ['blue', 'green', 'red'] else: b_names = [str(i) for i in range(img.shape[2])] if len(img.shape) == 2: bin_labels, hist_percent, hist_ = _hist_gray(img, bins=bins, lower_bound=lower_bound, upper_bound=upper_bound, mask=mask) hist_df = pd.DataFrame( {'pixel intensity': bin_labels, 'proportion of pixels (%)': hist_percent, 'hist_count': hist_, 'color channel': ['0' for _ in range(len(hist_percent))]}) else: # Assumption: RGB image # Initialize dataframe column arrays px_int = np.array([]) prop = np.array([]) hist_count = np.array([]) channel = [] for (b, b_name) in enumerate(b_names): bin_labels, hist_percent, hist_ = _hist_gray(img[:, :, b], bins=bins, lower_bound=lower_bound, upper_bound=upper_bound, mask=mask) # Append histogram data for each channel px_int = np.append(px_int, bin_labels) prop = np.append(prop, hist_percent) hist_count = np.append(hist_count, hist_) channel = channel + [b_name for _ in range(len(hist_percent))] # Create dataframe hist_df = pd.DataFrame( {'pixel intensity': px_int, 'proportion of pixels (%)': prop, 'hist_count': hist_count, 'color channel': channel}) fig_hist = (ggplot(data=hist_df, mapping=aes(x='pixel intensity', y='proportion of pixels (%)', color='color channel')) + geom_line()) if title is not None: fig_hist = fig_hist + labels.ggtitle(title) if len(img.shape) > 2 and img.shape[2] == 3: fig_hist = fig_hist + scale_color_manual(['blue', 'green', 'red']) # Plot or print the histogram _debug(visual=fig_hist, filename=os.path.join(params.debug_outdir, str(params.device) + '_hist.png')) if hist_data is True: return fig_hist, hist_df return fig_hist
stiphyMT/plantcv
plantcv/plantcv/visualize/histogram.py
Python
mit
6,304
import { Data } from 'fake-types-lib-2/data'; export declare type MyData = Data | string; export {};
timocov/dts-bundle-generator
tests/e2e/test-cases/custom-types-folder/output.d.ts
TypeScript
mit
103
package com.jayway.rps.game; import java.lang.reflect.Field; import java.util.HashMap; import java.util.Map; import java.util.UUID; import com.jayway.es.api.Event; public class EventStringUtil { public static String toString(Event event) { String simpleName = event.getClass().getSimpleName(); Map<String, Object> values = new HashMap<String, Object>(); for (Field field : event.getClass().getFields()) { try { Object object = field.get(event); if (object instanceof UUID) { object = ((UUID)object).getLeastSignificantBits() % 255; } values.put(field.getName(), object); } catch (Exception e) { throw new RuntimeException(e); } } return simpleName + values; } }
jankronquist/rock-paper-scissors-in-java
src/test/java/com/jayway/rps/game/EventStringUtil.java
Java
mit
715
<?php /** * Recursively iterates files starting from a base path, replacing strings in any files matching a valid Mime type * @param $aBasePaths - Array of base paths which will each be iterated recursively to find files for string replacement * @param $aStringReplacements - Associative array of strings to replace in files. Any keys found in this array will be replaced by their corresponding value */ function recursiveStringReplace($aBasePaths = array(), $aStringReplacements = array()) { // Replacement will only occur in files of the following Mime types $aValidFileMimeTypes = array( "text/css", "text/html", "text/x-php", "text/plain", "application/xml", "application/json", "application/javascript" ); // Iterate through each directory recursively, starting at the base path foreach ($aBasePaths as $strBasePath) { $hDirectoryIterator = new RecursiveDirectoryIterator($strBasePath); foreach (new RecursiveIteratorIterator($hDirectoryIterator) as $strFilePath) { // Get the Mime type of the file $hFileInfo = finfo_open(FILEINFO_MIME_TYPE); $strFileMimeType = finfo_file($hFileInfo, $strFilePath); finfo_close($hFileInfo); // If file is of a valid Mime type, attempt to get its contents if(in_array($strFileMimeType, $aValidFileMimeTypes)) { $strFileContents = file_get_contents($strFilePath); // If we were able to get the contents of the file, replace all string instances in aReplacements if($strFileContents) { $strFileContents = strtr($strFileContents, $aStringReplacements); file_put_contents($strFilePath, $strFileContents); } } } } } recursiveStringReplace( array( "./files/", "./more-files/" ), array( "Hello" => "Howdy", "World" => "Planet", "Howdy" => "Hello", "Planet" => "World" ) );
codybonney/codybonney-com
content/sandbox/php-find-and-replace-strings-in-files-recursively-2/index.php
PHP
mit
2,285
require 'fathom_authorization_system' # Methods added to this helper will be available to all templates in the application. module ApplicationHelper include FathomAuthorizationSystem def stylesheet_files if APPLICATION_DOMAIN == 'shanti.virginia.edu' #['fathom', 'jquery-ui','jquery.autocomplete', 'jquery.checktree', 'jquery.draggable.popup'] + super ['fathom', 'jquery-ui'] + super else #'thlib.org' if @current_style == :details super + ['fathom','thickbox','communications', 'jquery-ui-tabs', 'jquery-ui'] else super + ['fathom','communications', 'jquery-ui-tabs', 'jquery-ui', 'Hypertreebase', 'Hypertree'] end end end def javascript_files if @current_style == :home if APPLICATION_DOMAIN == 'shanti.virginia.edu' if logged_in? super + ['togglesections','jquery.jcarousel','thickbox-compressed','jquery-plugins','load-latest-news'] else super + ['jquery.jcarousel','thickbox-compressed','jquery-plugins','load-latest-news'] end else #'thlib.org' #super + ['jquery.jcarousel','jquery-plugins'] #neither news or toggle action is used on connections ['min/jquery.jcarousel'] #jquery loaded from thl template end else if @current_style == :details if APPLICATION_DOMAIN == 'shanti.virginia.edu' if logged_in? ##['category_selector','application','togglesections','thickbox-compressed','jquery-plugins','encodemailto','profile-detail-view','yahoo-dom-event','element-beta-min','tabview-min'] + super #super + ['category_selector','application','togglesections','thickbox-compressed','encodemailto','profile-detail-view','yahoo-dom-event','element-beta-min','tabview-min'] super + ['jquery.autocomplete', 'jquery.checktree', 'model-searcher', 'jquery.draggable.popup','application','togglesections','thickbox-compressed','encodemailto','profile-detail-view','yahoo-dom-event','element-beta-min','tabview-min'] else super + ['category_selector','application','thickbox-compressed','jquery-plugins','encodemailto','profile-detail-view','yahoo-dom-event','element-beta-min','tabview-min'] end else #'thlib.org' if logged_in? #super + ['category_selector','application','thickbox-compressed','encodemailto','profile-detail-view','yahoo-dom-event','element-beta-min','tabview-min'] super + ['category_selector','thickbox-compressed','encodemailto','profile-detail-view','yahoo-dom-event','element-beta-min','tabview-min'] #jquery loaded from thl template else #super + ['category_selector','application','thickbox-compressed','encodemailto','profile-detail-view','yahoo-dom-event','element-beta-min','tabview-min'] super + ['category_selector','thickbox-compressed','encodemailto','profile-detail-view','yahoo-dom-event','element-beta-min','tabview-min'] #jquery loaded from thl template end end else if @current_style == :showview if APPLICATION_DOMAIN == 'shanti.virginia.edu' if logged_in? super + ['category_selector','application','togglesections','thickbox-compressed','jquery-plugins','encodemailto','profile-detail-view','yahoo-dom-event','element-beta-min','tabview-min'] else super + ['category_selector','application','thickbox-compressed','jquery-plugins','encodemailto','profile-detail-view','yahoo-dom-event','element-beta-min','tabview-min'] end else #'thlib.org' if logged_in? ['encodemailto','profile-detail-view','yahoo-dom-event','element-beta-min','tabview-min'] #jquery loaded from thl template else ['encodemailto','profile-detail-view','yahoo-dom-event','element-beta-min','tabview-min'] #jquery loaded from thl template end end else if APPLICATION_DOMAIN == 'shanti.virginia.edu' if logged_in? super + ['category_selector','application','togglesections','thickbox-compressed','jquery-plugins','encodemailto'] else super + ['category_selector','application','thickbox-compressed','jquery-plugins','encodemailto'] end else if logged_in? if params[:inline] ['jquery','jrails'] + ['encodemailto'] #jquery loaded locally since modal window loads no template else ['jrails'] + ['encodemailto','jit'] #jquery loaded from thl template end else if params[:inline] ['jquery','jrails'] + ['encodemailto'] #jquery loaded locally since modal window loads no template else ['jrails'] + ['encodemailto', 'jit'] #jquery loaded from thl template end end end end end end end def javascripts if APPLICATION_DOMAIN == 'shanti.virginia.edu' [super, include_tiny_mce_if_needed].join("\n").html_safe else #'thlib.org' if @current_style == :details #edit mode then needs tiny_mce #Commented - on May 21, 2013 - temporary removal of tinymce #[super, include_tiny_mce_if_needed].join("\n").html_safe super else super end end end #Commented - on May 21, 2013 - temporary removal of tinymce #def tinymce_reinitialization_script # str = "<script type='text/javascript'>"+ "\n" # str += "//<![CDATA[" + "\n" # str += "tinyMCE.init({" + "\n" # str += "editor_selector : 'mceEditor'," + "\n" # str += "strict_loading_mode : tinymce.isWebKit," + "\n" # str += "height : '220px'," + "\n" # str += "mode : 'textareas'," + "\n" # str += "relative_urls : false," + "\n" # str += "noneditable_leave_contenteditable : 'true'," + "\n" # str += "plugins : 'contextmenu,paste,media,fullscreen,template,noneditable, table, spellchecker'," + "\n" # str += "template_external_list_url : '/templates/templates.js'," + "\n" # str += "content_css : '/stylesheets/customtinymce.css'," + "\n" # str += "theme : 'advanced'," + "\n" # str += "theme_advanced_blockformats : 'p,h1,h2,h3,h4,h5,h6'," + "\n" # str += "theme_advanced_buttons1 : ' fullscreen,separator,bold,italic,underline,strikethrough,separator,undo,redo,separator,link,unlink,template,formatselect, code'," + "\n" # str += "theme_advanced_buttons2 : 'cut,copy,paste,separator,pastetext,pasteword,separator,bullist,numlist,outdent,indent,separator,justifyleft,justifycenter,justifyright,justifiyfull,separator,removeformat,charmap'," + "\n" # str += "theme_advanced_buttons3 : 'spellchecker,tablecontrols '," + "\n" # str += "spellchecker_languages : '+English=en'," + "\n" # str += "spellchecker_rpc_url : '/application/spellchecker'," + "\n" # str += "gecko_spellcheck : 'true'," + "\n" # str += "table_styles : 'Header 1=header1;Header 2=header2;Header 3=header3'," + "\n" # str += "table_cell_styles : 'Header 1=header1;Header 2=header2;Header 3=header3;Table Cell=tableCel1'," + "\n" # str += "table_row_styles : 'Header 1=header1;Header 2=header2;Header 3=header3;Table Row=tableRow1'," + "\n" # str += "theme_advanced_resizing : 'true'," + "\n" # str += "theme_advanced_toolbar_align : 'left'," + "\n" # str += "theme_advanced_toolbar_location : 'top'," + "\n" # str += "width : '550px'" + "\n" # str += "});" + "\n" # str += "//]]>" + "\n" # str += "</script> " # return str.html_safe #end def site_title(opts={:html=>true}) opts[:html] ? 'SHANTI UVa' : 'SHANTI UVa' #'SHANTI at the University of Virginia' : 'SHANTI at the University of Virginia' end def banner_title(opts={:html=>true}) opts[:html] ? 'SHANTI - Sciences, Humanities, and Arts Network of Technological Initiatives' : 'SHANTI - Sciences, Humanities, and Arts Network of Technological Initiatives' end # takes :person_profile / :profile_profile etc. for the "profile_type" # The "fields" is a hash where the keys match the profiles' tag attributes (see PersonProfile etc..) # and the values map to HTML elements (the id attribute) # EXAMPLE: # # generate_js_for_tag_autocomplete(:person_profile, {:general_interests=>'person_profile_general_interest_list'}) # def generate_js_tag_jquery_ui_autocomplete(tag_combiner, profile_type, fields) js = '' fields.each_pair do |tag_field,tag_field_input_id| # list of tag values, var name prefixed by the tag field js << %(var #{tag_field}_profile_tags = [];\n) # Get a hash of the tags for this field tag_set = tag_combiner.tag_counts(tag_field) tag_set.keys.sort.each do |tag| js << %(#{tag_field}_profile_tags.push({value: '#{escape_javascript tag}' , label:'#{escape_javascript tag} (#{tag_set[tag].to_i})' });\n) end end js.html_safe end # takes :person_profile / :profile_profile etc. for the "profile_type" # The "fields" is a hash where the keys match the profiles' tag attributes (see PersonProfile etc..) # and the values map to HTML elements (the id attribute) # EXAMPLE: # # generate_js_for_tag_autocomplete(:person_profile, {:general_interests=>'person_profile_general_interest_list'}) # def generate_js_for_tag_autocomplete(tag_combiner, profile_type, fields) js = '' fields.each_pair do |tag_field,tag_field_input_id| # list of tag values, var name prefixed by the tag field js << %(var #{tag_field}_profile_tags = [];\n) # the key is the tag, the value is the hit count, var name prefixed by the tag field js << %(var #{tag_field}_profile_tag_counts = {};\n) # Get a hash of the tags for this field tag_set = tag_combiner.tag_counts(tag_field) tag_set.keys.each do |tag| js << %(#{tag_field}_profile_tags.push('#{escape_javascript tag}');\n) js << %(#{tag_field}_profile_tag_counts['#{escape_javascript tag}'] = #{tag_set[tag].to_i};\n) end js << %($("##{escape_javascript tag_field_input_id}").autocomplete(#{tag_field}_profile_tags, { multiple : true, formatItem : function(row) { return row + " (" + #{tag_field}_profile_tag_counts[row] + ")"; }, formatResult : function(row) { return row } });\n) end js.html_safe end def entity_profile_tag_block(tag_combiner, entity, tag_list_name, label) entity_name = entity.class.to_s.downcase # the organization model extends the project model # so switch back to project if the "entity" is an "organization" entity_name = 'project' if entity_name=='organization' profile_method = entity_name + '_profile' associated_tag_list = entity.send(profile_method).send(tag_list_name) complete_tag_list = tag_combiner.tag_counts(tag_list_name) unless associated_tag_list.empty? # create the url path and :f param (facet) in the form f[FACET_FIELD][]=VALUE #html = "<h3>#{label}</h3>" html = "<dt>#{label}</dt>" html += "<dd>" html += associated_tag_list.map do |t| link_params = search_path({:f=>{(tag_list_name.to_s + '_facet')=>[t.name]}}) "#{link_to(t.name.s, link_params)} <em>(#{complete_tag_list[t.name]})</em>" end.sort.join(', ') html += "</dd>" html.html_safe end end # # Convert the Textile/RedCloth input text to HTML # def rc(string) RedCloth.new(string).to_html end # # Add a # def th(area) #return "<div class='textarea_wrapper'>" + area + "</div><a class='text_help_icon' onclick=\"window.open('" + compute_public_path('index.html', 'text_help', '.html') + "','mywindow','width=550,height=700, scrollbars=yes')\">?</a>" return area end def ssl_link(path) SSL_ENABLED ? "https://#{request.env['SERVER_NAME']}#{path}" : path end def ssl_stylesheet_link(stylesheet, media_type = 'screen' ) "<link rel=\"stylesheet\" href=\"#{ssl_link('/stylesheets/'+stylesheet)}\" type=\"text/css\" media=\"#{media_type}\" />" end def ssl_javascript_link( javascript ) "<script type=\"text/javascript\" src=\"#{ssl_link('/javascripts/'+javascript)}\"></script>" end def main_navigation_items() return @main_navigation_items if @main_navigation_items # basic menu options if APPLICATION_DOMAIN == 'shanti.virginia.edu' home_text_link = 'Home' #'UVa Profiles' else home_text_link = 'Connections' end if APPLICATION_DOMAIN != 'shanti.virginia.edu' @main_navigation_items = [ { :id => :home, :text => home_text_link, :link => home_page_path }, { :id => :profile, :text => 'My Profile', :link => me_path }, { :id => :people, :text => 'People', :link => people_path }, { :id => :projects, :text => 'Projects', :link => projects_path }, { :id => :organizations, :text => 'Organizations', :link => organizations_path }, { :id => :tools, :text => 'Tools', :link => tools_path }, { :id => :posts, :text => 'Posts', :link => posts_path }, { :id => :knowledge_base, :text => 'Knowledge Base', :link => 'https://wiki.shanti.virginia.edu/display/KB/SHANTI+Knowledge+Base' }, { :id => :events, :text => 'Activities', :link => '/wordpress/?page_id=414' }, { :id => :news, :text => 'News', :link => '/wordpress/?page_id=400' }, #{ :id => :about_us, :text => 'SHANTI Activities', :link => '/wordpress/?page_id=6' }, ] # don't display my profile if I am not logged in (on main navigation) if not logged_in? my_profile = main_navigation_items.select { |item| item[:id] == :profile }.first @main_navigation_items.delete(my_profile) end else @main_navigation_items = [ { :id => :home, :text => home_text_link, :link => home_page_path }, { :id => :uva_profiles, :text => "UVa Profiles", :link => people_path }, #{ :id => :profile, :text => 'My Profile', :link => me_path }, #{ :id => :people, :text => 'People', :link => people_path }, #{ :id => :projects, :text => 'Projects', :link => projects_path }, #{ :id => :organizations, :text => 'Organizations', :link => organizations_path }, #{ :id => :tools, :text => 'Tools', :link => tools_path }, #{ :id => :posts, :text => 'Posts', :link => posts_path }, { :id => :knowledge_base, :text => 'Knowledge Base', :link => 'https://wiki.shanti.virginia.edu/x/o4G' }, #{ :id => :community_tools, :text => 'Community Tools', :link => '/wordpress/?page_id=116' }, #{ :id => :uva_profiles, :text => "UVa Profiles", :link => home_page_path }, { :id => :events, :text => 'Activities', :link => '/wordpress/?page_id=414' }, { :id => :news, :text => 'News', :link => '/wordpress/?page_id=400' }, #{ :id => :about_us, :text => 'SHANTI Activities', :link => '/wordpress/?page_id=6' }, ] end #verification, to handle different menus for shanti & thl if APPLICATION_DOMAIN != 'shanti.virginia.edu' tools = main_navigation_items.select { |item| item[:id] == :tools }.first @main_navigation_items.delete(tools) kbase = main_navigation_items.select { |item| item[:id] == :knowledge_base }.first @main_navigation_items.delete(kbase) events = main_navigation_items.select { |item| item[:id] == :events }.first @main_navigation_items.delete(events) news = main_navigation_items.select { |item| item[:id] == :news }.first @main_navigation_items.delete(news) aboutus = main_navigation_items.select { |item| item[:id] == :about_us }.first @main_navigation_items.delete(aboutus) end return @main_navigation_items end # Sub navigation items. def secondary_navigation_items() return @secondary_navigation_items if @secondary_navigation_items @secondary_navigation_items = [ #{ :id => :home, :text => "Profiles", :link => home_page_path }, { :id => :profile, :text => 'My Profile', :link => me_path }, { :id => :people, :text => 'People', :link => people_path }, { :id => :projects, :text => 'Projects', :link => projects_path }, { :id => :organizations, :text => 'Organizations', :link => organizations_path }, { :id => :tools, :text => 'Tools', :link => tools_path }, { :id => :posts, :text => 'Posts', :link => posts_path } ] # don't display my profile if I am not logged in if not logged_in? my_profile = secondary_navigation_items.select { |item| item[:id] == :profile }.first @secondary_navigation_items.delete(my_profile) end return @secondary_navigation_items end # Secondary navigation items. def ancillary_navigation_items() return @ancillary_navigation_items if @ancillary_navigation_items @ancillary_navigation_items = [ # FUTURE: Shanti-specific. { :id => :about_us, :text => 'SHANTI', :link => '/wordpress/?page_id=6' }, # FUTURE: Shanti-specific. { :id => :resources, :text => 'Resources', :link => '/wordpress/?page_id=7' }, # FUTURE: Shanti-specific. { :id => :news, :text => 'News', :link => '/wordpress/?page_id=4' } ] return @ancillary_navigation_items end # Override side_column_links method that come from thl_integration plugin def side_column_links str = "<h3 class=\"head\">#{link_to 'Communications THL', '#nogo', {:hreflang => 'Fathom Communications THL.'}}</h3>\n<ul>\n" str += "<li>#{link_to 'Home', root_path, {:hreflang => 'Home communications.'}}</li>\n" #str += "<li>#{link_to 'My Profile', me_path, {:hreflang => 'My Profile.'}}</li>\n" if logged_in? #str += "<li>#{link_to 'People', people_path, {:hreflang => 'Manage People'}}</li>\n" #str += "<li>#{link_to 'Projects', projects_path, {:hreflang => 'Manage Projects.'}}</li>\n" #str += "<li>#{link_to 'Organizations', organizations_path, {:hreflang => 'Manage Organizations.'}}</li>\n" #str += "<li>#{link_to 'Tools', tools_path, {:hreflang => 'Manage Tools.'}}</li>\n" str += "</ul>" return str end # Override flash_notice method that come from thl_integration plugin def flash_notice(options = Hash.new) return "" end # Override language_option_links method that come from thl_integration plugin def language_option_links return "" end #Override login_status so we don't show thl integration login status, but fathom one def login_status return "" end def editor_note_tip return '<p class="text-editor-note">NEVER paste text directly from other programs. Use the W button to paste from Word; use the T button to paste from other programs.</p>'.html_safe end def page_title() return "Search Results" if @current_nav_item == :search return "CONTROL PANEL" if @current_nav_item == :admin return "Banned Email" if @current_nav_item == :banned return "" if @current_nav_item == :users # Supply reasonable default if no current_nav_item is given. if @current_nav_item main_navigation_items.select { |item| item[:id] == @current_nav_item }.first[:text] else '' end end def simple_date( date ) "#{date.month}/#{date.day}/#{date.year}" end def collection_select_multiple(object, method, collection, value_method, text_method, options = {}, html_options = {}) real_method = "#{method.to_s.singularize}_ids".to_sym collection_select( object, real_method, collection, value_method, text_method, options, html_options.merge({ :multiple => true, :name => "#{object}[#{real_method}][]" }) ) end def collection_select_multiple_categories(object, method, options = {}, html_options = {}) collection_select_multiple( object, method, Category.find(:all), :id, :title, options, html_options ) end def join_with_and(list) size = list.size case size when 0 then nil when 1 then list.first when 2 then list.join(' and ') when 3 then [list[0..size-2].join(', '), list[size-1]].join(', and ') end end def entity_for_post(p) Entity.find(p.entity_id) end def user_access_levels [ "Pending", "Guest", "Full", "Admin" ] end def disciplines [ "English", "Media Studies", "Computer Science", "History", "Religious Studies" ] end def professional_profile_options [ '', 'Faculty', 'Undergraduate', 'Graduate Student', 'Technologist', 'Administrator', 'Independent Scholar','Businessperson', 'Artist', 'Singer/Musician', 'Community Service Person', 'Writer'] end def country_names [ [ "Afghanistan", "AF" ], [ "Albania", "AL" ], [ "Algeria", "DZ" ], [ "American Samoa", "AS" ], [ "Andorra", "AD" ], [ "Angola", "AO" ], [ "Anguilla", "AI" ], [ "Antarctica", "AQ" ], [ "Antigua and Barbuda", "AG" ], [ "Argentina", "AR" ], [ "Armenia", "AM" ], [ "Aruba", "AW" ], [ "Australia", "AU" ], [ "Austria", "AT" ], [ "Azerbaijan", "AZ" ], [ "Bahrain", "BH" ], [ "Bangladesh", "BD" ], [ "Barbados", "BB" ], [ "Belarus", "BY" ], [ "Belgium", "BE" ], [ "Belize", "BZ" ], [ "Benin", "BJ" ], [ "Bermuda", "BM" ], [ "Bhutan", "BT" ], [ "Bolivia", "BO" ], [ "Bosnia and Herzegovina", "BA" ], [ "Botswana", "BW" ], [ "Bouvet Island", "BV" ], [ "Brazil", "BR" ], [ "British Indian Ocean Territory", "IO" ], [ "British Virgin Islands", "VG" ], [ "Brunei", "BN" ], [ "Bulgaria", "BG" ], [ "Burkina Faso", "BF" ], [ "Burundi", "BI" ], [ "Côte d'Ivoire", "CI" ], [ "Cambodia", "KH" ], [ "Cameroon", "CM" ], [ "Canada", "CA" ], [ "Cape Verde", "CV" ], [ "Cayman Islands", "KY" ], [ "Central African Republic", "CF" ], [ "Chad", "TD" ], [ "Chile", "CL" ], [ "China", "CN" ], [ "Christmas Island", "CX" ], [ "Cocos (Keeling) Islands", "CC" ], [ "Colombia", "CO" ], [ "Comoros", "KM" ], [ "Congo", "CG" ], [ "Cook Islands", "CK" ], [ "Costa Rica", "CR" ], [ "Croatia", "HR" ], [ "Cuba", "CU" ], [ "Cyprus", "CY" ], [ "Czech Republic", "CZ" ], [ "Democratic Republic of the Congo", "CD" ], [ "Denmark", "DK" ], [ "Djibouti", "DJ" ], [ "Dominica", "DM" ], [ "Dominican Republic", "DO" ], [ "East Timor", "TL" ], [ "Ecuador", "EC" ], [ "Egypt", "EG" ], [ "El Salvador", "SV" ], [ "Equatorial Guinea", "GQ" ], [ "Eritrea", "ER" ], [ "Estonia", "EE" ], [ "Ethiopia", "ET" ], [ "Faeroe Islands", "FO" ], [ "Falkland Islands", "FK" ], [ "Fiji", "FJ" ], [ "Finland", "FI" ], [ "Former Yugoslav Republic of Macedonia", "MK" ], [ "France", "FR" ], [ "French Guiana", "GF" ], [ "French Polynesia", "PF" ], [ "French Southern Territories", "TF" ], [ "Gabon", "GA" ], [ "Georgia", "GE" ], [ "Germany", "DE" ], [ "Ghana", "GH" ], [ "Gibraltar", "GI" ], [ "Greece", "GR" ], [ "Greenland", "GL" ], [ "Grenada", "GD" ], [ "Guadeloupe", "GP" ], [ "Guam", "GU" ], [ "Guatemala", "GT" ], [ "Guinea", "GN" ], [ "Guinea-Bissau", "GW" ], [ "Guyana", "GY" ], [ "Haiti", "HT" ], [ "Heard Island and McDonald Islands", "HM" ], [ "Honduras", "HN" ], [ "Hong Kong", "HK" ], [ "Hungary", "HU" ], [ "Iceland", "IS" ], [ "India", "IN" ], [ "Indonesia", "ID" ], [ "Iran", "IR" ], [ "Iraq", "IQ" ], [ "Ireland", "IE" ], [ "Israel", "IL" ], [ "Italy", "IT" ], [ "Jamaica", "JM" ], [ "Japan", "JP" ], [ "Jordan", "JO" ], [ "Kazakhstan", "KZ" ], [ "Kenya", "KE" ], [ "Kiribati", "KI" ], [ "Kuwait", "KW" ], [ "Kyrgyzstan", "KG" ], [ "Laos", "LA" ], [ "Latvia", "LV" ], [ "Lebanon", "LB" ], [ "Lesotho", "LS" ], [ "Liberia", "LR" ], [ "Libya", "LY" ], [ "Liechtenstein", "LI" ], [ "Lithuania", "LT" ], [ "Luxembourg ", "LU" ], [ "Macau", "MO" ], [ "Madagascar", "MG" ], [ "Malawi", "MW" ], [ "Malaysia", "MY" ], [ "Maldives", "MV" ], [ "Mali", "ML" ], [ "Malta", "MT" ], [ "Marshall Islands", "MH" ], [ "Martinique", "MQ" ], [ "Mauritania", "MR" ], [ "Mauritius", "MU" ], [ "Mayotte", "YT" ], [ "Mexico", "MX" ], [ "Micronesia", "FM" ], [ "Moldova", "MD" ], [ "Monaco", "MC" ], [ "Mongolia", "MN" ], [ "Montserrat", "MS" ], [ "Morocco", "MA" ], [ "Mozambique", "MZ" ], [ "Myanmar", "MM" ], [ "Namibia", "NA" ], [ "Nauru", "NR" ], [ "Nepal", "NP" ], [ "Netherlands", "NL" ], [ "Netherlands Antilles", "AN" ], [ "New Caledonia", "NC" ], [ "New Zealand", "NZ" ], [ "Nicaragua", "NI" ], [ "Niger", "NE" ], [ "Nigeria", "NG" ], [ "Niue", "NU" ], [ "Norfolk Island", "NF" ], [ "North Korea", "KP" ], [ "Northern Marianas", "MP" ], [ "Norway", "NO" ], [ "Oman", "OM" ], [ "Pakistan", "PK" ], [ "Palau", "PW" ], [ "Panama", "PA" ], [ "Papua New Guinea", "PG" ], [ "Paraguay", "PY" ], [ "Peru", "PE" ], [ "Philippines", "PH" ], [ "Pitcairn Islands", "PN" ], [ "Poland", "PL" ], [ "Portugal", "PT" ], [ "Puerto Rico", "PR" ], [ "Qatar", "QA" ], [ "Réunion", "RE" ], [ "Romania", "RO" ], [ "Russia", "RU" ], [ "Rwanda", "RW" ], [ "São Tomé and Príncipe", "ST" ], [ "Saint Helena", "SH" ], [ "Saint Kitts and Nevis", "KN" ], [ "Saint Lucia", "LC" ], [ "Saint Pierre and Miquelon", "PM" ], [ "Saint Vincent and the Grenadines", "VC" ], [ "Samoa", "WS" ], [ "San Marino", "SM" ], [ "Saudi Arabia", "SA" ], [ "Senegal", "SN" ], [ "Seychelles", "SC" ], [ "Sierra Leone", "SL" ], [ "Singapore", "SG" ], [ "Slovakia", "SK" ], [ "Slovenia", "SI" ], [ "Solomon Islands", "SB" ], [ "Somalia", "SO" ], [ "South Africa", "ZA" ], [ "South Georgia and the South Sandwich Islands", "GS" ], [ "South Korea", "KR" ], [ "Spain", "ES" ], [ "Sri Lanka", "LK" ], [ "Sudan", "SD" ], [ "Suriname", "SR" ], [ "Svalbard and Jan Mayen", "SJ" ], [ "Swaziland", "SZ" ], [ "Sweden", "SE" ], [ "Switzerland", "CH" ], [ "Syria", "SY" ], [ "Taiwan", "TW" ], [ "Tajikistan", "TJ" ], [ "Tanzania", "TZ" ], [ "Thailand", "TH" ], [ "The Bahamas", "BS" ], [ "The Gambia", "GM" ], [ "Togo", "TG" ], [ "Tokelau", "TK" ], [ "Tonga", "TO" ], [ "Trinidad and Tobago", "TT" ], [ "Tunisia", "TN" ], [ "Turkey", "TR" ], [ "Turkmenistan", "TM" ], [ "Turks and Caicos Islands", "TC" ], [ "Tuvalu", "TV" ], [ "US Virgin Islands", "VI" ], [ "Uganda", "UG" ], [ "Ukraine", "UA" ], [ "United Arab Emirates", "AE" ], [ "United Kingdom", "GB" ], [ "United States", "US" ], [ "United States Minor Outlying Islands", "UM" ], [ "Uruguay", "UY" ], [ "Uzbekistan", "UZ" ], [ "Vanuatu", "VU" ], [ "Vatican City", "VA" ], [ "Venezuela", "VE" ], [ "Vietnam", "VN" ], [ "Wallis and Futuna", "WF" ], [ "Western Sahara", "EH" ], [ "Yemen", "YE" ], [ "Yugoslavia", "YU" ], [ "Zambia", "ZM" ], [ "Zimbabwe", "ZW" ] ] end def state_names [ [ "Alabama", "AL" ], [ "Alaska", "AK" ], [ "Arizona", "AZ" ], [ "Arkansas", "AR" ], [ "California", "CA" ], [ "Colorado", "CO" ], [ "Connecticut", "CT" ], [ "Delaware", "DE" ], [ "District Of Columbia", "DC" ], [ "Florida", "FL" ], [ "Georgia", "GA" ], [ "Hawaii", "HI" ], [ "Idaho", "ID" ], [ "Illinois", "IL" ], [ "Indiana", "IN" ], [ "Iowa", "IA" ], [ "Kansas", "KS" ], [ "Kentucky", "KY" ], [ "Louisiana", "LA" ], [ "Maine", "ME" ], [ "Maryland", "MD" ], [ "Massachusetts", "MA" ], [ "Michigan", "MI" ], [ "Minnesota", "MN" ], [ "Mississippi", "MS" ], [ "Missouri", "MO" ], [ "Montana", "MT" ], [ "Nebraska", "NE" ], [ "Nevada", "NV" ], [ "New Hampshire", "NH" ], [ "New Jersey", "NJ" ], [ "New Mexico", "NM" ], [ "New York", "NY" ], [ "North Carolina", "NC" ], [ "North Dakota", "ND" ], [ "Ohio", "OH" ], [ "Oklahoma", "OK" ], [ "Oregon", "OR" ], [ "Pennsylvania", "PA" ], [ "Rhode Island", "RI" ], [ "South Carolina", "SC" ], [ "South Dakota", "SD" ], [ "Tennessee", "TN" ], [ "Texas", "TX" ], [ "Utah", "UT" ], [ "Vermont", "VT" ], [ "Virginia", "VA" ], [ "Washington", "WA" ], [ "West Virginia", "WV" ], [ "Wisconsin", "WI" ], [ "Wyoming", "WY" ] ] end # create the <li> element for the specified tab def tab_tag( tab_id, tab_label, selected_id ) tab_name = tab_id.to_s selected = tab_id == selected_id ? "class='selected'" : "" "<li id='#{tab_name}-tab-button' #{selected}><a href='##{tab_name}-tab'><span>#{tab_label}</span></a></li>".html_safe end end
shanti-uva/fathom_engine
app/helpers/application_helper.rb
Ruby
mit
29,998
import { Injectable } from '@angular/core'; import { ActivatedRouteSnapshot, RouterStateSnapshot, Router, Route, CanActivate, CanActivateChild, CanLoad } from '@angular/router'; import { AuthService } from './auth.service'; @Injectable() export  class AuthGuard implements CanActivate, CanActivateChild, CanLoad { constructor(private authService: AuthService, private router: Router) { } canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean { console.log('In canActivate: ' + state.url); return this.checkLoggedIn(state.url); } canActivateChild(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean { console.log('In canActivateChild: ' + state.url); return this.checkLoggedIn(state.url); } canLoad(route: Route): boolean { console.log('In canLoad: ' + route.path); return this.checkLoggedIn(route.path); } checkLoggedIn(url: string): boolean { if (this.authService.isLoggedIn()) { return true; } // Retain the attempted URL for redirection this.authService.redirectUrl = url; this.router.navigate(['/login']); return false; } }
jock-dalby/tabletalkr-2
APM-Final/src/app/user/auth-guard.service.ts
TypeScript
mit
1,248
<?php /* * Sendanor SimpleREST PHP Framework * Copyright 2017-2020 Jaakko Heusala <jheusala@iki.fi> */ namespace SimpleREST\Legacy; /* Security check */ if(!defined('REST_PHP')) { die("Direct access not permitted\n"); } /** Collection of elements */ abstract class Collection extends Resource implements iCollection { }
sendanor/php-rest
lib/SimpleREST/Legacy/Collection.class.php
PHP
mit
330
import assert from 'assert' import { planetposition, julian, sexagesimal as sexa } from '../src/index.js' import data from '../data/index.js' describe('#planetposition', function () { describe('position2000', function () { it('Mars at 2415020.0', function () { // Mars 1899 spherical data from vsop87.chk. const jd = 2415020.0 const planet = new planetposition.Planet(data.mars) const res = planet.position2000(jd) assert.strictEqual(res.lon, 5.018579265623366) assert.strictEqual(res.lat, -0.02740734998738619) assert.strictEqual(res.range, 1.421877771845356) }) it('Mars at 2415020.0 VSOP D', function () { // Mars 1899 spherical data from vsop87.chk. const jd = 2415020.0 const planet = new planetposition.Planet(data.vsop87Dmars) const res = planet.position2000(jd) assert.strictEqual(res.lon, 5.01857925809491) assert.strictEqual(res.lat, -0.02740737901167283) assert.strictEqual(res.range, 1.4218777705060395) }) it('Venus at 1992-12-20', function () { // Example 32.a, p. 219 const jd = julian.CalendarGregorianToJD(1992, 12, 20) const planet = new planetposition.Planet(data.venus) const res = planet.position2000(jd) assert.strictEqual(res.lon, 0.45749253478276586) // rad assert.strictEqual(res.lat, -0.045729822980889484) // rad assert.strictEqual(res.range, 0.7246016739689574) // AU }) }) describe('position', function () { it('Venus at 1992-12-20', function () { // Example 32.a, p. 219 const jd = julian.CalendarGregorianToJD(1992, 12, 20) const planet = new planetposition.Planet(data.venus) const res = planet.position(jd) assert.strictEqual(new sexa.Angle(res.lon).toDegString(5), '26°.11412') assert.strictEqual(new sexa.Angle(res.lat).toDegString(5), '-2°.6206') assert.strictEqual(res.range, 0.7246016739689574) }) it('Venus at 1992-12-20 VSOPD', function () { // Example 32.a, p. 219 const jd = julian.CalendarGregorianToJD(1992, 12, 20) const planet = new planetposition.Planet(data.vsop87Dvenus) const res = planet.position(jd) assert.strictEqual(new sexa.Angle(res.lon).toDegString(5), '26°.11412') assert.strictEqual(new sexa.Angle(res.lat).toDegString(5), '-2°.6206') assert.strictEqual(res.range, 0.7246016759555222) }) }) describe('toFK5', function () { it('Venus at 1992-12-20', function () { // Meeus provides no worked example for the FK5 conversion given by // formula 32.3, p. 219. This at least displays the result when applied // to the position of Example 32.a on that page. const jd = julian.CalendarGregorianToJD(1992, 12, 20) const planet = new planetposition.Planet(data.venus) const pos = planet.position(jd) const fk5 = planetposition.toFK5(pos.lon, pos.lat, jd) assert.strictEqual(new sexa.Angle(fk5.lon).toDegString(5), '26°.11409') assert.strictEqual(new sexa.Angle(fk5.lat).toDegString(5), '-2°.6206') }) }) })
commenthol/astronomia
test/planetposition.test.js
JavaScript
mit
3,098
//Pathway model var FormModel = function () { var self = this; self.id = undefined; self.name = undefined; self.dataElements = [] ko.track(self); self.previewForm = function(){ console.log('need to add form preview here') window.location = '../../formDesign/show/' + self.id } }
amilward/MDR
web-app/js/pathways/model/FormModel.js
JavaScript
mit
415
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('basicviz', '0002_auto_20160717_1939'), ] operations = [ migrations.AlterField( model_name='document', name='name', field=models.CharField(unique=True, max_length=32), ), ]
sdrogers/ms2ldaviz
ms2ldaviz/basicviz/migrations/0003_auto_20160717_1943.py
Python
mit
416
version https://git-lfs.github.com/spec/v1 oid sha256:3e0c436bb4be5a94bea0b2ce84121c3a8c6fbe226e7559f80cd0db5b4b93fdb0 size 17334
yogeshsaroya/new-cdnjs
ajax/libs/yui/3.9.0/series-bar/series-bar-coverage.js
JavaScript
mit
130
<?php // .pomm_cli_bootstrap.php $loader = require_once __DIR__.'/app/bootstrap.php.cache'; require_once __DIR__.'/app/AppKernel.php'; $kernel = new AppKernel('dev', true); $kernel->loadClassCache(); $kernel->boot(); return $kernel->getContainer()->get('pomm');
tlode/pomm2-test-app
.pomm_cli_bootstrap.php
PHP
mit
265
using System; namespace C5 { /// <summary> /// An exception thrown when an operation attempts to create a duplicate in a collection with set semantics /// (<see cref="P:C5.IExtensible`1.AllowsDuplicates"/> is false) or attempts to create a duplicate key in a dictionary. /// <para>With collections this can only happen with Insert operations on lists, since the Add operations will /// not try to create duplictes and either ignore the failure or report it in a bool return value. /// </para> /// <para>With dictionaries this can happen with the <see cref="M:C5.IDictionary`2.Add(`0,`1)"/> metod.</para> /// </summary> [Serializable] public class DuplicateNotAllowedException : Exception { /// <summary> /// Create a simple exception with no further explanation. /// </summary> public DuplicateNotAllowedException() : base() { } /// <summary> /// Create the exception with an explanation of the reason. /// </summary> /// <param name="message"></param> public DuplicateNotAllowedException(string message) : base(message) { } } }
sestoft/C5
C5/Exceptions/DuplicateNotAllowedException.cs
C#
mit
1,150
@extends('app') @section('content') <div class="container-fluid"> <div class="row"> <div class="col-md-8 col-md-offset-2"> <div class="panel panel-default"> <div class="panel-heading">Register</div> <div class="panel-body"> @if (count($errors) > 0) <div class="alert alert-danger"> <strong>Whoops!</strong> There were some problems with your input.<br><br> <ul> @foreach ($errors->all() as $error) <li>{{ $error }}</li> @endforeach </ul> </div> @endif <form class="form-horizontal" role="form" method="POST" action="/auth/register"> <input type="hidden" name="_token" value="{{ csrf_token() }}"> <div class="form-group"> <label class="col-md-4 control-label">Name</label> <div class="col-md-6"> <input type="text" class="form-control" name="name" value="{{ old('name') }}"> </div> </div> <div class="form-group"> <label class="col-md-4 control-label">E-Mail Address</label> <div class="col-md-6"> <input type="email" class="form-control" name="email" value="{{ old('email') }}"> </div> </div> <div class="form-group"> <label class="col-md-4 control-label">Password</label> <div class="col-md-6"> <input type="password" class="form-control" name="password"> </div> </div> <div class="form-group"> <label class="col-md-4 control-label">Confirm Password</label> <div class="col-md-6"> <input type="password" class="form-control" name="password_confirmation"> </div> </div> <div class="form-group"> <div class="col-md-6 col-md-offset-4"> <button type="submit" class="btn btn-primary"> Register </button> </div> </div> </form> </div> </div> </div> </div> </div> @endsection
decebal/MealJournal
resources/views/auth/register.blade.php
PHP
mit
3,092
package com.smash.player.Models; import com.orm.*; public class Artista extends SugarRecord { public String name; public Artista() {} public Artista(Long id,String name){ setId(id);setName(name);save(); } public void setName(String name) { this.name = name; } public String getName() { return name; } }
rafael2ll/Smash
SmashMusic/app/src/main/java/com/smash/player/Models/Artista.java
Java
mit
325